code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
#include "apfSIM.h" #include <apf.h> #include <apfShape.h> #include <SimModel.h> #include <MeshSim.h> #include <SimPartitionedMesh.h> #include <gmi.h> #include <gmi_sim.h> #include <apf_simConfig.h> #include <cstdlib> #include <cassert> #include <algorithm> #ifdef USE_FIELDSIM #include "apfSIMDataOf.h" apf::Field* apf::createSIMField(Mesh* m, const char* name, int valueType, FieldShape* shape) { return makeField(m, name, valueType, 0,shape, new SIMDataOf<double>); } ::Field* apf::getSIMField(apf::Field* f) { apf::SIMDataOf<double>* data = dynamic_cast<apf::SIMDataOf<double>*>(f->getData()); return data->getSimField(); } apf::Field* apf::wrapSIMField(Mesh* m, pField fd) { pPolyField pf = static_cast<pPolyField>(Field_def(fd)); int order = PolyField_entOrder(pf, 0); apf::FieldShape* shape = apf::getLagrange(order); char const* name = Field_name(fd); int num_comp = Field_numComp(fd); int valueType = -1; switch (num_comp) { case 1: valueType = apf::SCALAR; break; case 3: valueType = apf::VECTOR; break; case 9: valueType = apf::MATRIX; break; } return makeField(m, name, valueType, 0, shape, new SIMDataOf<double>(fd)); } #else apf::Field* apf::createSIMField(Mesh* m, const char* name, int valueType, FieldShape* shape) { (void)m; (void)name; (void)valueType; (void)shape; apf::fail("SimField not found when APF_SIM compiled"); } ::Field* apf::getSIMField(apf::Field* f) { (void)f; apf::fail("SimField not found when APF_SIM compiled"); } apf::Field* apf::wrapSIMField(Mesh* m, pField fd) { (void)m; (void)fd; apf::fail("SimField not found when APF_SIM compiled"); } #endif namespace apf { apf::Field* createSIMLagrangeField(Mesh* m, const char* name, int valueType, int order) { return createSIMField(m, name, valueType, getLagrange(order)); } apf::Field* createSIMFieldOn(Mesh* m, const char* name, int valueType) { return createSIMField(m, name, valueType, m->getShape()); } MeshSIM::MeshSIM(pParMesh m): mesh(m) { part = PM_mesh(mesh,0); d = M_numRegions(part) ? 3 : 2; iterDim = -1; model = gmi_import_sim(M_model(part)); } MeshSIM::~MeshSIM() { gmi_destroy(model); } int MeshSIM::getDimension() { return d; } class IteratorSIM { public: virtual ~IteratorSIM() {} virtual MeshEntity* iterate() = 0; }; class VertexIteratorSIM : public IteratorSIM { public: VertexIteratorSIM(pMesh part) {iterator = M_vertexIter(part);} virtual ~VertexIteratorSIM() {VIter_delete(iterator);} virtual MeshEntity* iterate() {return reinterpret_cast<MeshEntity*>(VIter_next(iterator));} private: VIter iterator; }; class EdgeIteratorSIM : public IteratorSIM { public: EdgeIteratorSIM(pMesh part) {iterator = M_edgeIter(part);} virtual ~EdgeIteratorSIM() {EIter_delete(iterator);} virtual MeshEntity* iterate() {return reinterpret_cast<MeshEntity*>(EIter_next(iterator));} private: EIter iterator; }; class FaceIteratorSIM : public IteratorSIM { public: FaceIteratorSIM(pMesh part) {iterator = M_faceIter(part);} virtual ~FaceIteratorSIM() {FIter_delete(iterator);} virtual MeshEntity* iterate() {return reinterpret_cast<MeshEntity*>(FIter_next(iterator));} private: FIter iterator; }; class RegionIteratorSIM : public IteratorSIM { public: RegionIteratorSIM(pMesh part) {iterator = M_regionIter(part);} virtual ~RegionIteratorSIM() {RIter_delete(iterator);} virtual MeshEntity* iterate() {return reinterpret_cast<MeshEntity*>(RIter_next(iterator));} private: RIter iterator; }; std::size_t MeshSIM::count(int dimension) { if (dimension == 0) return M_numVertices(part); if (dimension == 1) return M_numEdges(part); if (dimension == 2) return M_numFaces(part); return M_numRegions(part); } MeshIterator* MeshSIM::begin(int dimension) { IteratorSIM* iterator = 0; if (dimension == 0) iterator = new VertexIteratorSIM(part); if (dimension == 1) iterator = new EdgeIteratorSIM(part); if (dimension == 2) iterator = new FaceIteratorSIM(part); if (dimension == 3) iterator = new RegionIteratorSIM(part); return reinterpret_cast<MeshIterator*>(iterator); } MeshEntity* MeshSIM::iterate(MeshIterator* it) { return reinterpret_cast<IteratorSIM*>(it)->iterate(); } void MeshSIM::end(MeshIterator* it) { delete reinterpret_cast<IteratorSIM*>(it); } bool MeshSIM::isShared(MeshEntity* e) { return EN_isOnPartBdry(reinterpret_cast<pEntity>(e)); } bool MeshSIM::isOwned(MeshEntity* e) { return EN_isOwnerProc(reinterpret_cast<pEntity>(e)); } int MeshSIM::getOwner(MeshEntity* e) { return EN_ownerProc(reinterpret_cast<pEntity>(e)); } static int pListToArray(pPList list, MeshEntity** array) { int n = PList_size(list); for (int i=0; i < n; ++i) array[i] = reinterpret_cast<MeshEntity*>(PList_item(list,i)); PList_delete(list); return n; } void MeshSIM::getAdjacent(MeshEntity* e, int dimension, DynamicArray<MeshEntity*>& adjacent) { pEntity entity = reinterpret_cast<pEntity>(e); eType ent_type = EN_type(entity); if (apf::getDimension(this, e) == dimension) { adjacent.setSize(1); adjacent[0] = e; return; } if (ent_type == Tvertex) { pVertex vertex = static_cast<pVertex>(entity); if (dimension == 1) { int n = V_numEdges(vertex); adjacent.setSize(n); for (int i=0; i < n; ++i) adjacent[i] = reinterpret_cast<MeshEntity*>(V_edge(vertex,i)); } if (dimension == 2) pListToDynamicArray<MeshEntity*>(V_faces(vertex),adjacent); if (dimension == 3) pListToDynamicArray<MeshEntity*>(V_regions(vertex),adjacent); } if (ent_type == Tedge) { pEdge edge = static_cast<pEdge>(entity); if (dimension == 0) { adjacent.setSize(2); for (int i=0; i < 2; ++i) adjacent[i] = reinterpret_cast<MeshEntity*>(E_vertex(edge,i)); } if (dimension == 2) { int n = E_numFaces(edge); adjacent.setSize(n); for (int i=0; i < n; ++i) adjacent[i] = reinterpret_cast<MeshEntity*>(E_face(edge,i)); } if (dimension == 3) pListToDynamicArray<MeshEntity*>(E_regions(edge),adjacent); } if (ent_type == Tface) { pFace face = static_cast<pFace>(entity); if (dimension == 0) pListToDynamicArray<MeshEntity*>(F_vertices(face,1),adjacent); if (dimension == 1) { int n = F_numEdges(face); adjacent.setSize(n); for (int i=0; i < n; ++i) adjacent[i] = reinterpret_cast<MeshEntity*>(F_edge(face,i)); } if (dimension == 3) { adjacent.setSize(countUpward(e)); int a=0; for (int i=0; i < 2; ++i) { MeshEntity * me = reinterpret_cast<MeshEntity*>(F_region(face,i)); if(me != NULL) adjacent[a++] = me; } } } if (ent_type == Tregion) { pRegion region = static_cast<pRegion>(entity); if (dimension == 0) pListToDynamicArray<MeshEntity*>(R_vertices(region,1),adjacent); if (dimension == 1) pListToDynamicArray<MeshEntity*>(R_edges(region,1),adjacent); if (dimension == 2) { int n = R_numFaces(region); adjacent.setSize(n); for (int i=0; i < n; ++i) adjacent[i] = reinterpret_cast<MeshEntity*>(R_face(region,i)); } } } int MeshSIM::getDownward(MeshEntity* e, int dimension, MeshEntity** down) { pEntity entity = reinterpret_cast<pEntity>(e); eType ent_type = EN_type(entity); if (apf::getDimension(this, e) == dimension) { down[0] = e; } else if (ent_type == Tedge) { pEdge edge = static_cast<pEdge>(entity); for (int i=0; i < 2; ++i) down[i] = reinterpret_cast<MeshEntity*>(E_vertex(edge,i)); } else if (ent_type == Tface) { pFace face = static_cast<pFace>(entity); if (dimension == 0) pListToArray(F_vertices(face,1),down); if (dimension == 1) { int n = F_numEdges(face); for (int i=0; i < n; ++i) down[i] = reinterpret_cast<MeshEntity*>(F_edge(face,i)); } } else if (ent_type == Tregion) { pRegion region = static_cast<pRegion>(entity); if (dimension == 0) pListToArray(R_vertices(region,1),down); if (dimension == 1) pListToArray(R_edges(region,1),down); if (dimension == 2) { int n = R_numFaces(region); for (int i=0; i < n; ++i) down[i] = reinterpret_cast<MeshEntity*>(R_face(region,i)); } } return Mesh::adjacentCount[getType(e)][dimension]; } int MeshSIM::countUpward(MeshEntity* e) { pEntity entity = reinterpret_cast<pEntity>(e); eType ent_type = EN_type(entity); if (ent_type == Tvertex) return V_numEdges(reinterpret_cast<pVertex>(entity)); if (ent_type == Tedge) return E_numFaces(reinterpret_cast<pEdge>(entity)); if (ent_type == Tface) { int n = 0; for (int i=0; i < 2; ++i) if (F_region(reinterpret_cast<pFace>(entity),i)) ++n; return n; } return 0; } MeshEntity* MeshSIM::getUpward(MeshEntity* e, int i) { pEntity entity = reinterpret_cast<pEntity>(e); eType ent_type = EN_type(entity); if (ent_type == Tvertex) return reinterpret_cast<MeshEntity*>( V_edge(reinterpret_cast<pVertex>(entity),i)); if (ent_type == Tedge) return reinterpret_cast<MeshEntity*>( E_face(reinterpret_cast<pEdge>(entity),i)); if (ent_type == Tface) { int a = 0; for (int i=0; i < 2; ++i) { MeshEntity* r = reinterpret_cast<MeshEntity*>( F_region(reinterpret_cast<pFace>(entity),i)); if ((r)&&(a++ == i)) return r; } } return 0; } void MeshSIM::getUp(MeshEntity* e, Up& up) { up.n = countUpward(e); for (int i = 0; i < up.n; ++i) up.e[i] = getUpward(e,i); } bool MeshSIM::hasUp(MeshEntity* e) { return countUpward(e) != 0; } void MeshSIM::getPoint_(MeshEntity* e, int node, Vector3& point) { pEntity entity = reinterpret_cast<pEntity>(e); eType type = EN_type(entity); pPoint pt = 0; if (type == Tvertex) pt = V_point(static_cast<pVertex>(entity)); if (type == Tedge) pt = E_point(static_cast<pEdge>(entity),node); P_coord(pt,&(point[0])); } void MeshSIM::getParam(MeshEntity* e, Vector3& point) { pVertex v = reinterpret_cast<pVertex>(e); pPoint pt = V_point(v); int d = getModelType(toModel(e)); if (d==1) point[0] = P_param1(pt); if (d==2) { int obsolete_patch; P_param2(pt,&(point[0]),&(point[1]),&obsolete_patch); } } Mesh::Type MeshSIM::getType(MeshEntity* e) { pEntity entity = reinterpret_cast<pEntity>(e); eType ent_type = EN_type(entity); if(ent_type == Tvertex) return Mesh::VERTEX; else if(ent_type == Tedge) return Mesh::EDGE; else if(ent_type == Tface) { int num_edges = F_numEdges(static_cast<pFace>(entity)); if(num_edges == 3) return Mesh::TRIANGLE; else if(num_edges == 4) return Mesh::QUAD; } else { rType reg_type = R_topoType(static_cast<pRegion>(entity)); if(reg_type == Rtet) return Mesh::TET; else if(reg_type == Rwedge) return Mesh::PRISM; else if(reg_type == Rpyramid) return Mesh::PYRAMID; else if(reg_type == Rhex) return Mesh::HEX; } abort(); } void MeshSIM::getRemotes(MeshEntity* e, Copies& remotes) { pEntity entity = reinterpret_cast<pEntity>(e); pEntCopies copies = EN_copies(entity); if (!copies) return; for (int i=0; i < EntCopies_size(copies); ++i) remotes[PMU_proc(EntCopies_gid(copies,i))] = reinterpret_cast<MeshEntity*>( EntCopies_ent(copies,i)); } void MeshSIM::getResidence(MeshEntity* e, Parts& residence) { pEntity entity = reinterpret_cast<pEntity>(e); pEntCopies copies = EN_copies(entity); residence.insert(getId()); if (!copies) return; for (int i=0; i < EntCopies_size(copies); ++i) residence.insert(PMU_proc(EntCopies_gid(copies,i))); } class TagSIM { public: TagSIM(pParMesh m, const char* n, std::size_t unitSize, int c): count(c), mesh(m), name(n) { id = MD_newMeshDataId(n); comm = PM_newAttachDataCommu(unitSize/sizeof(int),0,count); PM_setMigrId(mesh,id); } virtual ~TagSIM() { MD_removeMeshCallback(id,CBdelete); MD_removeMeshCallback(id,CBmigrateOut); MD_removeMeshCallback(id,CBmigrateIn); PM_removeMigrId(mesh,id); MD_deleteMeshDataId(id); AttachDataCommu_delete(comm); } virtual void* allocate() = 0; virtual void deallocate(void* p) = 0; virtual int getType() = 0; bool has(MeshEntity* e) { pEntity entity = reinterpret_cast<pEntity>(e); return EN_getDataPtr(entity,id,NULL); } void set(MeshEntity* e, void* p) { pEntity entity = reinterpret_cast<pEntity>(e); EN_attachDataPtr(entity,id,p); } void* get(MeshEntity* e) { pEntity entity = reinterpret_cast<pEntity>(e); if ( ! has(e)) set(e,this->allocate()); void* p; EN_getDataPtr(entity,id,&p); return p; } void remove(MeshEntity* e) { pEntity entity = reinterpret_cast<pEntity>(e); this->deallocate(this->get(e)); EN_deleteData(entity,id); } int count; pParMesh mesh; pMeshDataId id; pAttachDataCommu comm; std::string name; //Simmetrix has no "get tag name" API }; class DoubleTagSIM : public TagSIM { public: static int deleteDoubleCB( void*, pAttachDataId id, int ev, void** data, void*) { static_cast<DoubleTagSIM*>(MD_callbackData(static_cast<pMeshDataId>(id), ev))->deallocate(*data); *data = 0; return 1; } DoubleTagSIM(pParMesh m, const char* name, int c): TagSIM(m,name,sizeof(double),c) { MD_setMeshCallback(id,CBdelete,deleteDoubleCB,this); MD_setMeshCallback(id,CBmigrateOut,pm_sendDblArray,comm); MD_setMeshCallback(id,CBmigrateIn,pm_recvDblArray,comm); } virtual void* allocate() { return count == 1 ? new double() : new double[count](); } virtual void deallocate(void* p) { double* p2 = static_cast<double*>(p); if (count == 1) delete p2; else delete [] p2; } virtual int getType() {return Mesh::DOUBLE;} void get(MeshEntity* e, double* p) { double* internal = static_cast<double*>(TagSIM::get(e)); for (int i=0; i < count; ++i) p[i] = internal[i]; } void set(MeshEntity* e, double const* p) { double* internal = static_cast<double*>(TagSIM::get(e)); for (int i=0; i < count; ++i) internal[i] = p[i]; } }; class IntTagSIM : public TagSIM { public: static int deleteIntCB( void*, pAttachDataId id, int ev, void** data, void*) { static_cast<IntTagSIM*>(MD_callbackData(static_cast<pMeshDataId>(id), ev))->deallocate(*data); *data = 0; return 1; } IntTagSIM(pParMesh m, const char* name, int c): TagSIM(m,name,sizeof(int),c) { MD_setMeshCallback(id,CBdelete,deleteIntCB,this); MD_setMeshCallback(id,CBmigrateOut,pm_sendIntArray,comm); MD_setMeshCallback(id,CBmigrateIn,pm_recvIntArray,comm); } virtual void* allocate() { return count == 1 ? new int() : new int[count](); } virtual void deallocate(void* p) { int* p2 = static_cast<int*>(p); if (count == 1) delete p2; else delete [] p2; } virtual int getType() {return Mesh::INT;} void get(MeshEntity* e, int* p) { int* internal = static_cast<int*>(TagSIM::get(e)); for (int i=0; i < count; ++i) p[i] = internal[i]; } void set(MeshEntity* e, int const* p) { int* internal = static_cast<int*>(TagSIM::get(e)); for (int i=0; i < count; ++i) internal[i] = p[i]; } }; class LongTagSIM : public TagSIM { public: static int deleteLongCB( void*, pAttachDataId id, int ev, void** data, void*) { static_cast<LongTagSIM*>(MD_callbackData(static_cast<pMeshDataId>(id), ev))->deallocate(*data); *data = 0; return 1; } LongTagSIM(pParMesh m, const char* name, int c): TagSIM(m,name,sizeof(long),c) { MD_setMeshCallback(id,CBdelete,deleteLongCB,this); /* note: long tags won't get auto-migration support until this is filled in: */ // MD_setMeshCallback(id,CBmigrateOut,pm_sendIntArray,comm); // MD_setMeshCallback(id,CBmigrateIn,pm_recvIntArray,comm); PM_removeMigrId(m, id); } virtual void* allocate() { return count == 1 ? new long() : new long[count](); } virtual void deallocate(void* p) { long* p2 = static_cast<long*>(p); if (count == 1) delete p2; else delete [] p2; } virtual int getType() {return Mesh::LONG;} void get(MeshEntity* e, long* p) { long* internal = static_cast<long*>(TagSIM::get(e)); for (int i=0; i < count; ++i) p[i] = internal[i]; } void set(MeshEntity* e, long const* p) { long* internal = static_cast<long*>(TagSIM::get(e)); for (int i=0; i < count; ++i) internal[i] = p[i]; } }; MeshTag* MeshSIM::createDoubleTag(const char* name, int size) { TagSIM* tag = new DoubleTagSIM(mesh,name,size); tags.push_back(tag); return reinterpret_cast<MeshTag*>(tag); } MeshTag* MeshSIM::createIntTag(const char* name, int size) { TagSIM* tag = new IntTagSIM(mesh,name,size); tags.push_back(tag); return reinterpret_cast<MeshTag*>(tag); } MeshTag* MeshSIM::createLongTag(const char* name, int size) { TagSIM* tag = new LongTagSIM(mesh,name,size); tags.push_back(tag); return reinterpret_cast<MeshTag*>(tag); } MeshTag* MeshSIM::findTag(const char* name) { for (size_t i=0; i < tags.size(); ++i) if (tags[i]->name == name) return reinterpret_cast<MeshTag*>(tags[i]); return 0; } void MeshSIM::destroyTag(MeshTag* tag) { TagSIM* tagSim = reinterpret_cast<TagSIM*>(tag); tags.erase(std::find(tags.begin(),tags.end(),tagSim)); delete tagSim; } void MeshSIM::renameTag(MeshTag*, const char*) { apf::fail("MeshSIM::renameTag called!\n"); } void MeshSIM::getTags(DynamicArray<MeshTag*>& ts) { ts.setSize(tags.size()); for (size_t i=0; i < tags.size(); ++i) ts[i] = reinterpret_cast<MeshTag*>(tags[i]); } void MeshSIM::getDoubleTag(MeshEntity* e, MeshTag* tag, double* data) { DoubleTagSIM* tagSim = reinterpret_cast<DoubleTagSIM*>(tag); tagSim->get(e,data); } void MeshSIM::setDoubleTag(MeshEntity* e, MeshTag* tag, double const* data) { DoubleTagSIM* tagSim = reinterpret_cast<DoubleTagSIM*>(tag); tagSim->set(e,data); } void MeshSIM::getIntTag(MeshEntity* e, MeshTag* tag, int* data) { IntTagSIM* tagSim = reinterpret_cast<IntTagSIM*>(tag); tagSim->get(e,data); } void MeshSIM::setIntTag(MeshEntity* e, MeshTag* tag, int const* data) { IntTagSIM* tagSim = reinterpret_cast<IntTagSIM*>(tag); tagSim->set(e,data); } void MeshSIM::getLongTag(MeshEntity* e, MeshTag* tag, long* data) { LongTagSIM* tagSim = reinterpret_cast<LongTagSIM*>(tag); tagSim->get(e,data); } void MeshSIM::setLongTag(MeshEntity* e, MeshTag* tag, long const* data) { LongTagSIM* tagSim = reinterpret_cast<LongTagSIM*>(tag); tagSim->set(e,data); } void MeshSIM::removeTag(MeshEntity* e, MeshTag* tag) { TagSIM* tagSim = reinterpret_cast<TagSIM*>(tag); tagSim->remove(e); } bool MeshSIM::hasTag(MeshEntity* e, MeshTag* tag) { TagSIM* tagSim = reinterpret_cast<TagSIM*>(tag); return tagSim->has(e); } int MeshSIM::getTagType(MeshTag* t) { TagSIM* tag = reinterpret_cast<TagSIM*>(t); return tag->getType(); } int MeshSIM::getTagSize(MeshTag* t) { TagSIM* tag = reinterpret_cast<TagSIM*>(t); return tag->count; } const char* MeshSIM::getTagName(MeshTag* t) { TagSIM* tag = reinterpret_cast<TagSIM*>(t); return tag->name.c_str(); } ModelEntity* MeshSIM::toModel(MeshEntity* e) { pEntity entity = reinterpret_cast<pEntity>(e); return reinterpret_cast<ModelEntity*>(EN_whatIn(entity)); } gmi_model* MeshSIM::getModel() { return model; } void MeshSIM::migrate(Migration* plan) { pMigrator migrator = PM_newMigrator(mesh,sthreadNone); Migrator_reset(migrator,this->getDimension()); int gid = PMU_gid(getId(),0); for (int i=0; i < plan->count(); ++i) { MeshEntity* e = plan->get(i); int newgid = PMU_gid(plan->sending(e),0); pEntity entity = reinterpret_cast<pEntity>(e); Migrator_add(migrator,entity,newgid,gid); } delete plan; Migrator_run(migrator,NULL); Migrator_delete(migrator); } int MeshSIM::getId() { return PMU_gid(PMU_rank(),0); } void MeshSIM::writeNative(const char* fileName) { PM_write(mesh,fileName,sthreadNone,NULL); } void MeshSIM::destroyNative() { M_release(mesh); } void MeshSIM::verify() { assert(PM_verify(mesh,0,sthreadNone,NULL)); } void MeshSIM::getMatches(MeshEntity* e, Matches& m) { pEntity ent = reinterpret_cast<pEntity>(e); pPList l = EN_getMatchingEnts(ent, NULL); if (!l) return; int n = PList_size(l); m.setSize(n - 1); int j = 0; for (int i=0; i < n; ++i) { MeshEntity* match = reinterpret_cast<MeshEntity*>(PList_item(l,i)); if (match == e) continue; m[j].peer = this->getId(); m[j].entity = match; j++; } assert(j == n - 1); PList_delete(l); } void MeshSIM::setPoint_(MeshEntity * me, int node, Vector3 const & p) { pEntity entity = reinterpret_cast<pEntity>(me); eType type = EN_type(entity); pPoint pt = 0; if (type == Tvertex) pt = V_point(static_cast<pVertex>(entity)); if (type == Tedge) pt = E_point(static_cast<pEdge>(entity),node); P_setPos(pt,p[0],p[1],p[2]); } static bool isQuadratic(pParMesh mesh) { pMesh part = PM_mesh(mesh,0); EIter it = M_edgeIter(part); pEdge e; bool result = true; while ((e = EIter_next(it))) { if (E_numPoints(e) != 1) { result = false; break; } } EIter_delete(it); return result; } static bool findMatches(Mesh* m) { bool found = false; for (int i = 0; i < 4; ++i) { MeshIterator* it = m->begin(i); MeshEntity* e; while ((e = m->iterate(it))) { pEntity ent = reinterpret_cast<pEntity>(e); pPList l = EN_getMatchingEnts(ent, NULL); if (l) { found = true; PList_delete(l); break; } } m->end(it); if (found) break; } return found; } Mesh2* createMesh(pParMesh mesh) { /* require one part per process currently for SIM */ assert(PM_numParts(mesh)==1); MeshSIM* m = new MeshSIM(mesh); int order = 1; if (isQuadratic(mesh)) order = 2; m->init(getLagrange(order)); m->hasMatches = findMatches(m); return m; } MeshEntity* castEntity(pEntity entity) { return reinterpret_cast<MeshEntity*>(entity); } }//namespace apf
yangf4/core
apf_sim/apfSIM.cc
C++
bsd-3-clause
22,965
package com.freebasicacc.main; import com.freebasicacc.action.SettingsAction; import com.freebasicacc.services.LogService; import com.freebasicacc.ui.MainFrame; import java.util.Locale; import java.util.Properties; import javax.swing.UIManager; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class Main{ static final Logger logger = LogManager.getLogger(Main.class); public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try{ Properties langProperties = SettingsAction.loadLanguageSettings(); Locale.setDefault(new Locale(langProperties.getProperty("display_lang"))); logger.info("Main - main() - DefaultLocale : "+Locale.getDefault()); /*LogService logService = new LogService(); logService.intiallizeLogger();*/ java.awt.Font defaultFont = new java.awt.Font("Tahoma", 0, 12); UIManager.put("Label.font", defaultFont); UIManager.put("Button.font", defaultFont); new MainFrame().setVisible(true); }catch(Exception ex){ ex.printStackTrace(); //logger.info("Error", ex); } } }); } }
benzyaa/javaapplication
FreeBasicAccountManagement/src/main/java/com/freebasicacc/main/Main.java
Java
bsd-3-clause
1,432
from contextlib import contextmanager from datetime import datetime from django import forms from django.conf import settings from django.contrib.auth.models import AbstractBaseUser from django.core import validators from django.db import models from django.utils import translation from django.utils.encoding import smart_unicode from django.utils.functional import lazy import commonware.log import tower from cache_nuggets.lib import memoize from tower import ugettext as _ import amo import amo.models from amo.urlresolvers import reverse from mkt.translations.fields import NoLinksField, save_signal from mkt.translations.query import order_by_translation log = commonware.log.getLogger('z.users') class UserForeignKey(models.ForeignKey): """ A replacement for models.ForeignKey('users.UserProfile'). This field uses UserEmailField to make form fields key off the user's email instead of the primary key id. We also hook up autocomplete automatically. """ def __init__(self, *args, **kw): super(UserForeignKey, self).__init__(UserProfile, *args, **kw) def value_from_object(self, obj): return getattr(obj, self.name).email def formfield(self, **kw): defaults = {'form_class': UserEmailField} defaults.update(kw) return models.Field.formfield(self, **defaults) class UserEmailField(forms.EmailField): def clean(self, value): if value in validators.EMPTY_VALUES: raise forms.ValidationError(self.error_messages['required']) try: return UserProfile.objects.get(email=value) except UserProfile.DoesNotExist: raise forms.ValidationError(_('No user with that email.')) def widget_attrs(self, widget): lazy_reverse = lazy(reverse, str) return {'class': 'email-autocomplete', 'data-src': lazy_reverse('users.ajax')} AbstractBaseUser._meta.get_field('password').max_length = 255 class UserProfile(amo.models.OnChangeMixin, amo.models.ModelBase, AbstractBaseUser): USERNAME_FIELD = 'username' username = models.CharField(max_length=255, default='', unique=True) display_name = models.CharField(max_length=255, default='', null=True, blank=True) email = models.EmailField(unique=True, null=True) averagerating = models.CharField(max_length=255, blank=True, null=True) bio = NoLinksField(short=False) confirmationcode = models.CharField(max_length=255, default='', blank=True) deleted = models.BooleanField(default=False) display_collections = models.BooleanField(default=False) display_collections_fav = models.BooleanField(default=False) emailhidden = models.BooleanField(default=True) homepage = models.URLField(max_length=255, blank=True, default='') location = models.CharField(max_length=255, blank=True, default='') notes = models.TextField(blank=True, null=True) notifycompat = models.BooleanField(default=True) notifyevents = models.BooleanField(default=True) occupation = models.CharField(max_length=255, default='', blank=True) # This is essentially a "has_picture" flag right now picture_type = models.CharField(max_length=75, default='', blank=True) resetcode = models.CharField(max_length=255, default='', blank=True) resetcode_expires = models.DateTimeField(default=datetime.now, null=True, blank=True) read_dev_agreement = models.DateTimeField(null=True, blank=True) last_login_ip = models.CharField(default='', max_length=45, editable=False) last_login_attempt = models.DateTimeField(null=True, editable=False) last_login_attempt_ip = models.CharField(default='', max_length=45, editable=False) failed_login_attempts = models.PositiveIntegerField(default=0, editable=False) source = models.PositiveIntegerField(default=amo.LOGIN_SOURCE_UNKNOWN, editable=False, db_index=True) is_verified = models.BooleanField(default=True) region = models.CharField(max_length=11, null=True, blank=True, editable=False) lang = models.CharField(max_length=5, null=True, blank=True, editable=False) class Meta: db_table = 'users' def __init__(self, *args, **kw): super(UserProfile, self).__init__(*args, **kw) if self.username: self.username = smart_unicode(self.username) def __unicode__(self): return u'%s: %s' % (self.id, self.display_name or self.username) def save(self, force_insert=False, force_update=False, using=None, **kwargs): # we have to fix stupid things that we defined poorly in remora if not self.resetcode_expires: self.resetcode_expires = datetime.now() super(UserProfile, self).save(force_insert, force_update, using, **kwargs) @property def is_superuser(self): return self.groups.filter(rules='*:*').exists() @property def is_staff(self): from mkt.access import acl return acl.action_allowed_user(self, 'Admin', '%') def has_perm(self, perm, obj=None): return self.is_superuser def has_module_perms(self, app_label): return self.is_superuser def get_backend(self): return 'django_browserid.auth.BrowserIDBackend' def set_backend(self, val): pass backend = property(get_backend, set_backend) def is_anonymous(self): return False def get_url_path(self, src=None): # See: bug 880767. return '#' def my_apps(self, n=8): """Returns n apps""" qs = self.addons.filter(type=amo.ADDON_WEBAPP) qs = order_by_translation(qs, 'name') return qs[:n] @amo.cached_property def is_developer(self): return self.addonuser_set.exists() @property def name(self): return smart_unicode(self.display_name or self.username) @amo.cached_property def reviews(self): """All reviews that are not dev replies.""" qs = self._reviews_all.filter(reply_to=None) # Force the query to occur immediately. Several # reviews-related tests hang if this isn't done. return qs def anonymize(self): log.info(u"User (%s: <%s>) is being anonymized." % (self, self.email)) self.email = None self.password = "sha512$Anonymous$Password" self.username = "Anonymous-%s" % self.id # Can't be null self.display_name = None self.homepage = "" self.deleted = True self.picture_type = "" self.save() def check_password(self, raw_password): # BrowserID does not store a password. return True def log_login_attempt(self, successful): """Log a user's login attempt""" self.last_login_attempt = datetime.now() self.last_login_attempt_ip = commonware.log.get_remote_addr() if successful: log.debug(u"User (%s) logged in successfully" % self) self.failed_login_attempts = 0 self.last_login_ip = commonware.log.get_remote_addr() else: log.debug(u"User (%s) failed to log in" % self) if self.failed_login_attempts < 16777216: self.failed_login_attempts += 1 self.save() def purchase_ids(self): """ I'm special casing this because we use purchase_ids a lot in the site and we are not caching empty querysets in cache-machine. That means that when the site is first launched we are having a lot of empty queries hit. We can probably do this in smarter fashion by making cache-machine cache empty queries on an as need basis. """ # Circular import from mkt.prices.models import AddonPurchase @memoize(prefix='users:purchase-ids') def ids(pk): return (AddonPurchase.objects.filter(user=pk) .values_list('addon_id', flat=True) .filter(type=amo.CONTRIB_PURCHASE) .order_by('pk')) return ids(self.pk) @contextmanager def activate_lang(self): """ Activate the language for the user. If none is set will go to the site default which is en-US. """ lang = self.lang if self.lang else settings.LANGUAGE_CODE old = translation.get_language() tower.activate(lang) yield tower.activate(old) models.signals.pre_save.connect(save_signal, sender=UserProfile, dispatch_uid='userprofile_translations') class UserNotification(amo.models.ModelBase): user = models.ForeignKey(UserProfile, related_name='notifications') notification_id = models.IntegerField() enabled = models.BooleanField(default=False) class Meta: db_table = 'users_notifications' @staticmethod def update_or_create(update={}, **kwargs): rows = UserNotification.objects.filter(**kwargs).update(**update) if not rows: update.update(dict(**kwargs)) UserNotification.objects.create(**update)
andymckay/zamboni
mkt/users/models.py
Python
bsd-3-clause
9,476
def extractVodkatranslationsCom(item): ''' Parser for 'vodkatranslations.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('Ordinary I and Extraordinary Them', 'Ordinary I and Extraordinary Them', 'translated'), ('PRC', 'PRC', 'translated'), ('Loiterous', 'Loiterous', 'oel'), ] for tagname, name, tl_type in tagmap: if tagname in item['tags']: return buildReleaseMessageWithType(item, name, vol, chp, frag=frag, postfix=postfix, tl_type=tl_type) return False
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extractVodkatranslationsCom.py
Python
bsd-3-clause
671
<?php class ControllersController extends Controller { /** * @var string the default layout for the views. Defaults to '//layouts/column2', meaning * using two-column layout. See 'protected/views/layouts/column2.php'. */ public $layout='//layouts/column2'; /** * @var CActiveRecord the currently loaded data model instance. */ private $_model; /** * @return array action filters */ public function filters() { return array( 'accessControl', // perform access control for CRUD operations ); } /** * Specifies the access control rules. * This method is used by the 'accessControl' filter. * @return array access control rules */ public function accessRules1() { return array( array('allow', // allow all users to perform 'index' and 'view' actions 'actions'=>array('index','view'), 'users'=>array('*'), ), array('allow', // allow authenticated user to perform 'create' and 'update' actions 'actions'=>array('create','update'), 'users'=>array('@'), ), array('allow', // allow admin user to perform 'admin' and 'delete' actions 'actions'=>array('admin','delete'), 'users'=>array('admin'), ), array('deny', // deny all users 'users'=>array('*'), ), ); } /** * Displays a particular model. */ public function actionView() { $this->render('view',array( 'model'=>$this->loadModel(), )); } /** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model=new controllers; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if(isset($_POST['controllers'])) { $model->attributes=$_POST['controllers']; if($model->save()) $this->redirect(array('view','id'=>$model->id)); } $this->render('create',array( 'model'=>$model, )); } /** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. */ public function actionUpdate() { $model=$this->loadModel(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if(isset($_POST['controllers'])) { $model->attributes=$_POST['controllers']; if($model->save()) $this->redirect(array('view','id'=>$model->id)); } $this->render('update',array( 'model'=>$model, )); } /** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'index' page. */ public function actionDelete() { if(Yii::app()->request->isPostRequest) { // we only allow deletion via POST request $this->loadModel()->delete(); // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if(!isset($_GET['ajax'])) $this->redirect(array('index')); } else throw new CHttpException(400,'Invalid request. Please do not repeat this request again.'); } /** * Lists all models. */ public function actionIndex() { $dataProvider=new CActiveDataProvider('controllers'); $this->render('index',array( 'dataProvider'=>$dataProvider, )); } /** * Manages all models. */ public function actionAdmin() { $model=new controllers('search'); $model->unsetAttributes(); // clear any default values if(isset($_GET['controllers'])) $model->attributes=$_GET['controllers']; $this->render('admin',array( 'model'=>$model, )); } /** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if($this->_model===null) { if(isset($_GET['id'])) $this->_model=controllers::model()->findbyPk($_GET['id']); if($this->_model===null) throw new CHttpException(404,'The requested page does not exist.'); } return $this->_model; } /** * Performs the AJAX validation. * @param CModel the model to be validated */ protected function performAjaxValidation($model) { if(isset($_POST['ajax']) && $_POST['ajax']==='controllers-form') { echo CActiveForm::validate($model); Yii::app()->end(); } } public function actionHtmlentities() { $src=$_GET['src']; print htmlentities($src); } public function actionWriteC1() { $controller=$_GET['controller']; $model= Controllers::model()->findByPk($controller); $name= $model->name; $path= $model->path; $functions=Functions::model()->findAllByAttributes(array('controller'=>$controller)); $str="<?php\n"; $str.=$model->comments; $str.="\n Class ".$model->name."Controller extends Controller\n"; $str.="\n{"; foreach ($functions as $function) { $str.="\n".$function->comments."\n"; $str.="\n"."function ".$function->name.'('.$function->parameters.")\n"; $str.= "\n{\n"; $str.= $function->code; $str.= "\n}\n"; } $str.="\n}\n"; file_put_contents($path.'/'.$name.'Controller.php',$str); } public function actionImportC() { $controller=$_GET['controller']; Functions::importFile($controller); } public function actionAllF() { if (isset($_GET['c'])) { $controller=$_GET['c']; Controllers::allFunctions($controller); } } }
ranvirp/viewcreater
protected/controllers/ControllersController.php
PHP
bsd-3-clause
5,582
/* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header: /cvs/src/src/binutils/Attic/rclex.c,v 1.1.14.1 2005/03/08 17:19:44 drow Exp $ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include <stdio.h> #include <errno.h> /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include <stdlib.h> #ifndef _WIN32 #include <unistd.h> #endif /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include <io.h> #include <stdlib.h> #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 86 #define YY_END_OF_BUFFER 87 static yyconst short int yy_accept[470] = { 0, 0, 0, 87, 85, 84, 83, 85, 78, 80, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 2, 4, 84, 0, 81, 78, 80, 79, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 81, 0, 82, 11, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 3, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 76, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 41, 82, 82, 82, 53, 42, 82, 82, 82, 82, 82, 82, 82, 46, 82, 82, 82, 82, 82, 82, 71, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 7, 82, 82, 82, 38, 1, 82, 82, 82, 82, 82, 18, 82, 82, 25, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 70, 82, 82, 39, 40, 82, 82, 82, 82, 82, 30, 82, 82, 82, 82, 82, 82, 50, 82, 82, 82, 82, 82, 34, 82, 82, 9, 82, 82, 19, 82, 68, 82, 82, 82, 82, 82, 82, 12, 0, 82, 82, 82, 82, 82, 82, 82, 13, 82, 14, 82, 82, 82, 82, 65, 82, 82, 82, 52, 82, 72, 82, 82, 82, 82, 82, 82, 47, 82, 82, 82, 82, 82, 82, 82, 82, 82, 58, 82, 82, 36, 82, 82, 82, 82, 82, 82, 82, 82, 0, 82, 0, 77, 17, 82, 82, 51, 82, 10, 82, 82, 82, 82, 16, 82, 82, 82, 82, 82, 82, 82, 29, 82, 82, 82, 82, 82, 82, 82, 73, 82, 31, 82, 82, 82, 82, 82, 82, 45, 6, 82, 82, 82, 82, 77, 82, 23, 24, 82, 15, 82, 27, 82, 82, 66, 82, 28, 54, 43, 82, 82, 82, 48, 82, 69, 8, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 64, 82, 82, 82, 82, 56, 82, 82, 82, 82, 35, 49, 82, 82, 82, 82, 20, 82, 82, 82, 82, 82, 82, 82, 82, 74, 82, 82, 82, 32, 82, 82, 37, 82, 82, 82, 82, 82, 82, 75, 82, 67, 61, 82, 82, 82, 33, 59, 60, 5, 21, 82, 82, 82, 82, 55, 57, 82, 82, 82, 26, 63, 82, 82, 82, 62, 22, 44, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 19, 26, 27, 28, 29, 30, 19, 31, 32, 19, 1, 1, 1, 1, 1, 1, 33, 33, 33, 33, 33, 33, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 33, 19, 19, 34, 1, 35, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[36] = { 0, 1, 2, 3, 2, 1, 4, 2, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1 } ; static yyconst short int yy_base[476] = { 0, 0, 0, 517, 518, 34, 518, 511, 0, 494, 25, 26, 45, 25, 28, 24, 488, 499, 49, 0, 40, 43, 488, 51, 66, 67, 484, 35, 518, 518, 81, 505, 84, 0, 488, 518, 0, 496, 479, 494, 477, 75, 476, 479, 477, 46, 491, 70, 486, 473, 483, 55, 479, 483, 468, 69, 471, 86, 84, 469, 479, 466, 480, 466, 461, 477, 472, 75, 455, 81, 459, 87, 77, 470, 469, 467, 454, 454, 460, 96, 463, 455, 449, 448, 110, 468, 458, 0, 453, 446, 451, 450, 445, 454, 437, 438, 451, 435, 450, 432, 428, 431, 432, 435, 443, 426, 0, 425, 438, 437, 422, 417, 419, 429, 421, 422, 426, 414, 430, 425, 412, 426, 407, 408, 409, 421, 411, 0, 404, 411, 418, 416, 412, 410, 417, 395, 401, 414, 408, 394, 403, 399, 393, 389, 390, 388, 394, 396, 105, 385, 389, 401, 390, 391, 398, 387, 379, 381, 378, 375, 378, 372, 376, 389, 370, 365, 105, 383, 0, 381, 369, 365, 0, 0, 364, 365, 362, 360, 377, 363, 358, 105, 375, 374, 353, 357, 357, 351, 0, 368, 354, 349, 348, 354, 348, 345, 358, 348, 356, 358, 354, 349, 346, 351, 0, 337, 346, 352, 0, 0, 336, 122, 336, 347, 107, 0, 347, 333, 0, 330, 328, 338, 327, 338, 330, 329, 322, 319, 315, 332, 0, 332, 333, 0, 0, 329, 324, 331, 316, 316, 0, 116, 307, 309, 320, 324, 320, 0, 323, 320, 110, 320, 320, 0, 308, 318, 0, 318, 310, 0, 296, 0, 300, 309, 296, 293, 306, 306, 0, 135, 139, 295, 289, 292, 302, 290, 292, 0, 295, 297, 297, 278, 294, 297, 0, 295, 280, 278, 0, 279, 0, 272, 285, 269, 287, 272, 283, 0, 282, 281, 273, 267, 279, 263, 259, 261, 259, 0, 276, 258, 0, 257, 256, 260, 250, 271, 270, 267, 260, 272, 145, 271, 151, 0, 261, 243, 0, 242, 0, 261, 240, 260, 241, 0, 252, 239, 252, 238, 233, 249, 248, 0, 251, 249, 249, 236, 229, 242, 227, 0, 224, 0, 225, 224, 241, 226, 239, 220, 229, 0, 218, 217, 224, 219, 237, 215, 0, 0, 211, 0, 228, 0, 211, 205, 0, 218, 0, 0, 0, 214, 208, 213, 0, 222, 0, 0, 217, 206, 201, 202, 201, 215, 201, 201, 199, 208, 210, 209, 201, 190, 196, 194, 190, 190, 192, 198, 0, 200, 184, 186, 184, 0, 0, 186, 183, 190, 178, 0, 179, 173, 174, 172, 185, 188, 183, 173, 0, 185, 173, 166, 0, 169, 177, 0, 166, 162, 157, 159, 158, 161, 0, 157, 0, 0, 162, 167, 158, 0, 0, 0, 0, 0, 143, 152, 143, 141, 0, 0, 130, 124, 124, 0, 0, 107, 85, 80, 0, 0, 0, 518, 158, 163, 65, 168, 173, 178 } ; static yyconst short int yy_def[476] = { 0, 469, 1, 469, 469, 469, 469, 470, 471, 472, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 469, 469, 469, 470, 469, 471, 472, 469, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 469, 470, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 469, 474, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 475, 474, 475, 474, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 475, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 0, 469, 469, 469, 469, 469, 469 } ; static yyconst short int yy_nxt[554] = { 0, 4, 5, 6, 5, 7, 8, 4, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 19, 23, 24, 25, 19, 26, 27, 19, 19, 19, 28, 29, 30, 37, 30, 50, 41, 52, 55, 51, 42, 81, 38, 43, 56, 82, 63, 53, 39, 83, 40, 44, 95, 67, 64, 54, 96, 59, 45, 60, 65, 103, 46, 68, 66, 47, 34, 61, 62, 48, 49, 70, 73, 71, 74, 76, 72, 77, 104, 30, 78, 30, 84, 84, 90, 85, 108, 91, 98, 99, 75, 79, 111, 113, 123, 126, 109, 129, 124, 131, 132, 114, 139, 468, 467, 127, 112, 130, 84, 84, 205, 85, 241, 206, 273, 242, 225, 274, 140, 243, 269, 269, 295, 270, 141, 226, 466, 207, 227, 228, 304, 229, 465, 269, 269, 305, 319, 321, 296, 321, 322, 36, 321, 321, 464, 321, 322, 36, 321, 321, 463, 321, 322, 36, 321, 31, 31, 462, 31, 31, 33, 33, 461, 33, 33, 36, 460, 459, 36, 36, 320, 320, 458, 320, 320, 321, 321, 457, 456, 321, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 364, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 303, 302, 301, 300, 299, 298, 297, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 272, 271, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 32, 145, 144, 143, 142, 138, 137, 136, 135, 134, 133, 128, 125, 122, 121, 120, 119, 118, 117, 116, 115, 110, 107, 106, 105, 102, 101, 100, 97, 94, 93, 92, 89, 88, 87, 86, 35, 32, 80, 69, 58, 57, 35, 32, 469, 3, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469 } ; static yyconst short int yy_chk[554] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 10, 5, 13, 11, 14, 15, 13, 11, 27, 10, 11, 15, 27, 20, 14, 10, 27, 10, 12, 45, 21, 20, 14, 45, 18, 12, 18, 20, 51, 12, 21, 20, 12, 472, 18, 18, 12, 12, 23, 24, 23, 24, 25, 23, 25, 51, 30, 25, 30, 32, 32, 41, 32, 55, 41, 47, 47, 24, 25, 57, 58, 67, 69, 55, 71, 67, 72, 72, 58, 79, 465, 464, 69, 57, 71, 84, 84, 148, 84, 181, 148, 214, 181, 166, 214, 79, 181, 211, 211, 241, 211, 79, 166, 463, 148, 166, 166, 250, 166, 460, 269, 269, 250, 269, 270, 241, 270, 270, 270, 270, 320, 459, 320, 320, 320, 320, 322, 458, 322, 322, 322, 322, 470, 470, 455, 470, 470, 471, 471, 454, 471, 471, 473, 453, 452, 473, 473, 474, 474, 446, 474, 474, 475, 475, 445, 444, 475, 441, 439, 438, 437, 436, 435, 434, 432, 431, 429, 428, 427, 425, 424, 423, 422, 421, 420, 419, 418, 416, 415, 414, 413, 410, 409, 408, 407, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, 386, 383, 381, 380, 379, 375, 373, 372, 370, 368, 365, 364, 363, 362, 361, 360, 358, 357, 356, 355, 354, 353, 352, 350, 348, 347, 346, 345, 344, 343, 342, 340, 339, 338, 337, 336, 335, 334, 332, 331, 330, 329, 327, 325, 324, 321, 319, 318, 317, 316, 315, 314, 313, 312, 311, 309, 308, 306, 305, 304, 303, 302, 301, 300, 299, 298, 296, 295, 294, 293, 292, 291, 289, 287, 286, 285, 283, 282, 281, 280, 279, 278, 276, 275, 274, 273, 272, 271, 267, 266, 265, 264, 263, 262, 260, 258, 257, 255, 254, 252, 251, 249, 248, 246, 245, 244, 243, 242, 239, 238, 237, 236, 235, 232, 231, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 217, 216, 213, 212, 210, 207, 206, 205, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 187, 186, 185, 184, 183, 182, 180, 179, 178, 177, 176, 175, 174, 171, 170, 169, 167, 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 86, 85, 83, 82, 81, 80, 78, 77, 76, 75, 74, 73, 70, 68, 66, 65, 64, 63, 62, 61, 60, 59, 56, 54, 53, 52, 50, 49, 48, 46, 44, 43, 42, 40, 39, 38, 37, 34, 31, 26, 22, 17, 16, 9, 7, 3, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, 469 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "rclex.l" #define INITIAL 0 #line 2 "rclex.l" /* Copyright 1997, 1998, 1999, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This is a lex input file which generates a lexer used by the Windows rc file parser. It basically just recognized a bunch of keywords. */ #include "bfd.h" #include "bucomm.h" #include "libiberty.h" #include "safe-ctype.h" #include "windres.h" #include "rcparse.h" #include <assert.h> #define YY_NO_UNPUT /* Whether we are in rcdata mode, in which we returns the lengths of strings. */ static int rcdata_mode; /* Whether we are supressing lines from cpp (including windows.h or headers from your C sources may bring in externs and typedefs). When active, we return IGNORED_TOKEN, which lets us ignore these outside of resource constructs. Thus, it isn't required to protect all the non-preprocessor lines in your header files with #ifdef RC_INVOKED. It also means your RC file can't include other RC files if they're named "*.h". Sorry. Name them *.rch or whatever. */ static int suppress_cpp_data; #define MAYBE_RETURN(x) return suppress_cpp_data ? IGNORED_TOKEN : (x) /* The first filename we detect in the cpp output. We use this to tell included files from the original file. */ static char *initial_fn; /* List of allocated strings. */ struct alloc_string { struct alloc_string *next; char *s; }; static struct alloc_string *strings; /* Local functions. */ static void cpp_line (const char *); static char *handle_quotes (const char *, unsigned long *); static char *get_string (int); #line 716 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include <stdlib.h> #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ } #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 78 "rclex.l" #line 881 "lex.yy.c" if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 470 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 518 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 80 "rclex.l" { MAYBE_RETURN (BEG); } YY_BREAK case 2: YY_RULE_SETUP #line 81 "rclex.l" { MAYBE_RETURN (BEG); } YY_BREAK case 3: YY_RULE_SETUP #line 82 "rclex.l" { MAYBE_RETURN (END); } YY_BREAK case 4: YY_RULE_SETUP #line 83 "rclex.l" { MAYBE_RETURN (END); } YY_BREAK case 5: YY_RULE_SETUP #line 84 "rclex.l" { MAYBE_RETURN (ACCELERATORS); } YY_BREAK case 6: YY_RULE_SETUP #line 85 "rclex.l" { MAYBE_RETURN (VIRTKEY); } YY_BREAK case 7: YY_RULE_SETUP #line 86 "rclex.l" { MAYBE_RETURN (ASCII); } YY_BREAK case 8: YY_RULE_SETUP #line 87 "rclex.l" { MAYBE_RETURN (NOINVERT); } YY_BREAK case 9: YY_RULE_SETUP #line 88 "rclex.l" { MAYBE_RETURN (SHIFT); } YY_BREAK case 10: YY_RULE_SETUP #line 89 "rclex.l" { MAYBE_RETURN (CONTROL); } YY_BREAK case 11: YY_RULE_SETUP #line 90 "rclex.l" { MAYBE_RETURN (ALT); } YY_BREAK case 12: YY_RULE_SETUP #line 91 "rclex.l" { MAYBE_RETURN (BITMAP); } YY_BREAK case 13: YY_RULE_SETUP #line 92 "rclex.l" { MAYBE_RETURN (CURSOR); } YY_BREAK case 14: YY_RULE_SETUP #line 93 "rclex.l" { MAYBE_RETURN (DIALOG); } YY_BREAK case 15: YY_RULE_SETUP #line 94 "rclex.l" { MAYBE_RETURN (DIALOGEX); } YY_BREAK case 16: YY_RULE_SETUP #line 95 "rclex.l" { MAYBE_RETURN (EXSTYLE); } YY_BREAK case 17: YY_RULE_SETUP #line 96 "rclex.l" { MAYBE_RETURN (CAPTION); } YY_BREAK case 18: YY_RULE_SETUP #line 97 "rclex.l" { MAYBE_RETURN (CLASS); } YY_BREAK case 19: YY_RULE_SETUP #line 98 "rclex.l" { MAYBE_RETURN (STYLE); } YY_BREAK case 20: YY_RULE_SETUP #line 99 "rclex.l" { MAYBE_RETURN (AUTO3STATE); } YY_BREAK case 21: YY_RULE_SETUP #line 100 "rclex.l" { MAYBE_RETURN (AUTOCHECKBOX); } YY_BREAK case 22: YY_RULE_SETUP #line 101 "rclex.l" { MAYBE_RETURN (AUTORADIOBUTTON); } YY_BREAK case 23: YY_RULE_SETUP #line 102 "rclex.l" { MAYBE_RETURN (CHECKBOX); } YY_BREAK case 24: YY_RULE_SETUP #line 103 "rclex.l" { MAYBE_RETURN (COMBOBOX); } YY_BREAK case 25: YY_RULE_SETUP #line 104 "rclex.l" { MAYBE_RETURN (CTEXT); } YY_BREAK case 26: YY_RULE_SETUP #line 105 "rclex.l" { MAYBE_RETURN (DEFPUSHBUTTON); } YY_BREAK case 27: YY_RULE_SETUP #line 106 "rclex.l" { MAYBE_RETURN (EDITTEXT); } YY_BREAK case 28: YY_RULE_SETUP #line 107 "rclex.l" { MAYBE_RETURN (GROUPBOX); } YY_BREAK case 29: YY_RULE_SETUP #line 108 "rclex.l" { MAYBE_RETURN (LISTBOX); } YY_BREAK case 30: YY_RULE_SETUP #line 109 "rclex.l" { MAYBE_RETURN (LTEXT); } YY_BREAK case 31: YY_RULE_SETUP #line 110 "rclex.l" { MAYBE_RETURN (PUSHBOX); } YY_BREAK case 32: YY_RULE_SETUP #line 111 "rclex.l" { MAYBE_RETURN (PUSHBUTTON); } YY_BREAK case 33: YY_RULE_SETUP #line 112 "rclex.l" { MAYBE_RETURN (RADIOBUTTON); } YY_BREAK case 34: YY_RULE_SETUP #line 113 "rclex.l" { MAYBE_RETURN (RTEXT); } YY_BREAK case 35: YY_RULE_SETUP #line 114 "rclex.l" { MAYBE_RETURN (SCROLLBAR); } YY_BREAK case 36: YY_RULE_SETUP #line 115 "rclex.l" { MAYBE_RETURN (STATE3); } YY_BREAK case 37: YY_RULE_SETUP #line 116 "rclex.l" { MAYBE_RETURN (USERBUTTON); } YY_BREAK case 38: YY_RULE_SETUP #line 117 "rclex.l" { MAYBE_RETURN (BEDIT); } YY_BREAK case 39: YY_RULE_SETUP #line 118 "rclex.l" { MAYBE_RETURN (HEDIT); } YY_BREAK case 40: YY_RULE_SETUP #line 119 "rclex.l" { MAYBE_RETURN (IEDIT); } YY_BREAK case 41: YY_RULE_SETUP #line 120 "rclex.l" { MAYBE_RETURN (FONT); } YY_BREAK case 42: YY_RULE_SETUP #line 121 "rclex.l" { MAYBE_RETURN (ICON); } YY_BREAK case 43: YY_RULE_SETUP #line 122 "rclex.l" { MAYBE_RETURN (LANGUAGE); } YY_BREAK case 44: YY_RULE_SETUP #line 123 "rclex.l" { MAYBE_RETURN (CHARACTERISTICS); } YY_BREAK case 45: YY_RULE_SETUP #line 124 "rclex.l" { MAYBE_RETURN (VERSIONK); } YY_BREAK case 46: YY_RULE_SETUP #line 125 "rclex.l" { MAYBE_RETURN (MENU); } YY_BREAK case 47: YY_RULE_SETUP #line 126 "rclex.l" { MAYBE_RETURN (MENUEX); } YY_BREAK case 48: YY_RULE_SETUP #line 127 "rclex.l" { MAYBE_RETURN (MENUITEM); } YY_BREAK case 49: YY_RULE_SETUP #line 128 "rclex.l" { MAYBE_RETURN (SEPARATOR); } YY_BREAK case 50: YY_RULE_SETUP #line 129 "rclex.l" { MAYBE_RETURN (POPUP); } YY_BREAK case 51: YY_RULE_SETUP #line 130 "rclex.l" { MAYBE_RETURN (CHECKED); } YY_BREAK case 52: YY_RULE_SETUP #line 131 "rclex.l" { MAYBE_RETURN (GRAYED); } YY_BREAK case 53: YY_RULE_SETUP #line 132 "rclex.l" { MAYBE_RETURN (HELP); } YY_BREAK case 54: YY_RULE_SETUP #line 133 "rclex.l" { MAYBE_RETURN (INACTIVE); } YY_BREAK case 55: YY_RULE_SETUP #line 134 "rclex.l" { MAYBE_RETURN (MENUBARBREAK); } YY_BREAK case 56: YY_RULE_SETUP #line 135 "rclex.l" { MAYBE_RETURN (MENUBREAK); } YY_BREAK case 57: YY_RULE_SETUP #line 136 "rclex.l" { MAYBE_RETURN (MESSAGETABLE); } YY_BREAK case 58: YY_RULE_SETUP #line 137 "rclex.l" { MAYBE_RETURN (RCDATA); } YY_BREAK case 59: YY_RULE_SETUP #line 138 "rclex.l" { MAYBE_RETURN (STRINGTABLE); } YY_BREAK case 60: YY_RULE_SETUP #line 139 "rclex.l" { MAYBE_RETURN (VERSIONINFO); } YY_BREAK case 61: YY_RULE_SETUP #line 140 "rclex.l" { MAYBE_RETURN (FILEVERSION); } YY_BREAK case 62: YY_RULE_SETUP #line 141 "rclex.l" { MAYBE_RETURN (PRODUCTVERSION); } YY_BREAK case 63: YY_RULE_SETUP #line 142 "rclex.l" { MAYBE_RETURN (FILEFLAGSMASK); } YY_BREAK case 64: YY_RULE_SETUP #line 143 "rclex.l" { MAYBE_RETURN (FILEFLAGS); } YY_BREAK case 65: YY_RULE_SETUP #line 144 "rclex.l" { MAYBE_RETURN (FILEOS); } YY_BREAK case 66: YY_RULE_SETUP #line 145 "rclex.l" { MAYBE_RETURN (FILETYPE); } YY_BREAK case 67: YY_RULE_SETUP #line 146 "rclex.l" { MAYBE_RETURN (FILESUBTYPE); } YY_BREAK case 68: YY_RULE_SETUP #line 147 "rclex.l" { MAYBE_RETURN (VALUE); } YY_BREAK case 69: YY_RULE_SETUP #line 148 "rclex.l" { MAYBE_RETURN (MOVEABLE); } YY_BREAK case 70: YY_RULE_SETUP #line 149 "rclex.l" { MAYBE_RETURN (FIXED); } YY_BREAK case 71: YY_RULE_SETUP #line 150 "rclex.l" { MAYBE_RETURN (PURE); } YY_BREAK case 72: YY_RULE_SETUP #line 151 "rclex.l" { MAYBE_RETURN (IMPURE); } YY_BREAK case 73: YY_RULE_SETUP #line 152 "rclex.l" { MAYBE_RETURN (PRELOAD); } YY_BREAK case 74: YY_RULE_SETUP #line 153 "rclex.l" { MAYBE_RETURN (LOADONCALL); } YY_BREAK case 75: YY_RULE_SETUP #line 154 "rclex.l" { MAYBE_RETURN (DISCARDABLE); } YY_BREAK case 76: YY_RULE_SETUP #line 155 "rclex.l" { MAYBE_RETURN (NOT); } YY_BREAK case 77: YY_RULE_SETUP #line 157 "rclex.l" { char *s, *send; /* This is a hack to let us parse version information easily. */ s = strchr (yytext, '"'); ++s; send = strchr (s, '"'); if (strncmp (s, "StringFileInfo", sizeof "StringFileInfo" - 1) == 0 && s + sizeof "StringFileInfo" - 1 == send) MAYBE_RETURN (BLOCKSTRINGFILEINFO); else if (strncmp (s, "VarFileInfo", sizeof "VarFileInfo" - 1) == 0 && s + sizeof "VarFileInfo" - 1 == send) MAYBE_RETURN (BLOCKVARFILEINFO); else { char *r; r = get_string (send - s + 1); strncpy (r, s, send - s); r[send - s] = '\0'; yylval.s = r; MAYBE_RETURN (BLOCK); } } YY_BREAK case 78: YY_RULE_SETUP #line 186 "rclex.l" { cpp_line (yytext); } YY_BREAK case 79: YY_RULE_SETUP #line 190 "rclex.l" { yylval.i.val = strtoul (yytext, 0, 0); yylval.i.dword = 1; MAYBE_RETURN (NUMBER); } YY_BREAK case 80: YY_RULE_SETUP #line 196 "rclex.l" { yylval.i.val = strtoul (yytext, 0, 0); yylval.i.dword = 0; MAYBE_RETURN (NUMBER); } YY_BREAK case 81: YY_RULE_SETUP #line 202 "rclex.l" { char *s; unsigned long length; s = handle_quotes (yytext, &length); if (! rcdata_mode) { yylval.s = s; MAYBE_RETURN (QUOTEDSTRING); } else { yylval.ss.length = length; yylval.ss.s = s; MAYBE_RETURN (SIZEDSTRING); } } YY_BREAK case 82: YY_RULE_SETUP #line 220 "rclex.l" { char *s; /* I rejected comma in a string in order to handle VIRTKEY, CONTROL in an accelerator resource. This means that an unquoted file name can not contain a comma. I don't know what rc permits. */ s = get_string (strlen (yytext) + 1); strcpy (s, yytext); yylval.s = s; MAYBE_RETURN (STRING); } YY_BREAK case 83: YY_RULE_SETUP #line 235 "rclex.l" { ++rc_lineno; } YY_BREAK case 84: YY_RULE_SETUP #line 236 "rclex.l" { /* ignore whitespace */ } YY_BREAK case 85: YY_RULE_SETUP #line 237 "rclex.l" { MAYBE_RETURN (*yytext); } YY_BREAK case 86: YY_RULE_SETUP #line 239 "rclex.l" ECHO; YY_BREAK #line 1460 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 470 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 470 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 469); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifndef _WIN32 #include <unistd.h> #else #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE extern int isatty YY_PROTO(( int )); #endif #endif #endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { yylex(); return 0; } #endif #line 239 "rclex.l" #ifndef yywrap /* This is needed for some versions of lex. */ int yywrap (void) { return 1; } #endif /* Handle a C preprocessor line. */ static void cpp_line (const char *s) { int line; char *send, *fn; ++s; while (ISSPACE (*s)) ++s; line = strtol (s, &send, 0); if (*send != '\0' && ! ISSPACE (*send)) return; /* Subtract 1 because we are about to count the newline. */ rc_lineno = line - 1; s = send; while (ISSPACE (*s)) ++s; if (*s != '"') return; ++s; send = strchr (s, '"'); if (send == NULL) return; fn = (char *) xmalloc (send - s + 1); strncpy (fn, s, send - s); fn[send - s] = '\0'; free (rc_filename); rc_filename = fn; if (!initial_fn) { initial_fn = xmalloc (strlen (fn) + 1); strcpy (initial_fn, fn); } /* Allow the initial file, regardless of name. Suppress all other files if they end in ".h" (this allows included "*.rc"). */ if (strcmp (initial_fn, fn) == 0 || strcmp (fn + strlen (fn) - 2, ".h") != 0) suppress_cpp_data = 0; else suppress_cpp_data = 1; } /* Handle a quoted string. The quotes are stripped. A pair of quotes in a string are turned into a single quote. Adjacent strings are merged separated by whitespace are merged, as in C. */ static char * handle_quotes (const char *input, unsigned long *len) { char *ret, *s; const char *t; int ch; ret = get_string (strlen (input) + 1); s = ret; t = input; if (*t == '"') ++t; while (*t != '\0') { if (*t == '\\') { ++t; switch (*t) { case '\0': rcparse_warning ("backslash at end of string"); break; case '\"': rcparse_warning ("use \"\" to put \" in a string"); break; case 'a': *s++ = ESCAPE_B; /* Strange, but true... */ ++t; break; case 'b': *s++ = ESCAPE_B; ++t; break; case 'f': *s++ = ESCAPE_F; ++t; break; case 'n': *s++ = ESCAPE_N; ++t; break; case 'r': *s++ = ESCAPE_R; ++t; break; case 't': *s++ = ESCAPE_T; ++t; break; case 'v': *s++ = ESCAPE_V; ++t; break; case '\\': *s++ = *t++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': ch = *t - '0'; ++t; if (*t >= '0' && *t <= '7') { ch = (ch << 3) | (*t - '0'); ++t; if (*t >= '0' && *t <= '7') { ch = (ch << 3) | (*t - '0'); ++t; } } *s++ = ch; break; case 'x': ++t; ch = 0; while (1) { if (*t >= '0' && *t <= '9') ch = (ch << 4) | (*t - '0'); else if (*t >= 'a' && *t <= 'f') ch = (ch << 4) | (*t - 'a' + 10); else if (*t >= 'A' && *t <= 'F') ch = (ch << 4) | (*t - 'A' + 10); else break; ++t; } *s++ = ch; break; default: rcparse_warning ("unrecognized escape sequence"); *s++ = '\\'; *s++ = *t++; break; } } else if (*t != '"') *s++ = *t++; else if (t[1] == '\0') break; else if (t[1] == '"') { *s++ = '"'; t += 2; } else { ++t; assert (ISSPACE (*t)); while (ISSPACE (*t)) { if ((*t) == '\n') ++rc_lineno; ++t; } if (*t == '\0') break; assert (*t == '"'); ++t; } } *s = '\0'; *len = s - ret; return ret; } /* Allocate a string of a given length. */ static char * get_string (int len) { struct alloc_string *as; as = (struct alloc_string *) xmalloc (sizeof *as); as->s = xmalloc (len); as->next = strings; strings = as; return as->s; } /* Discard all the strings we have allocated. The parser calls this when it no longer needs them. */ void rcparse_discard_strings (void) { struct alloc_string *as; as = strings; while (as != NULL) { struct alloc_string *n; free (as->s); n = as->next; free (as); as = n; } strings = NULL; } /* Enter rcdata mode. */ void rcparse_rcdata (void) { rcdata_mode = 1; } /* Go back to normal mode from rcdata mode. */ void rcparse_normal (void) { rcdata_mode = 0; }
shaotuanchen/sunflower_exp
tools/source/binutils-2.16.1/binutils/rclex.c
C
bsd-3-clause
67,235
--------------------------------------------------------------------------------------------- -- CRQ: APPLINK-25117: [GENIVI] TTS interface: SDL behavior in case HMI does not respond to -- IsReady_request or respond with "available" = false -- -- Requirement(s): APPLINK-25139:[TTS Interface] HMI does NOT respond to IsReady and -- mobile app sends RPC that must be splitted -- APPLINK-25303:[HMI_API] TTS.IsReady --------------------------------------------------------------------------------------------- TestedInterface = "TTS" Tested_resultCode = "ABORTED" Tested_wrongJSON = false Test = require('user_modules/IsReady_Template/ATF_Interface_IsReady_missing_SplitRPC_Template') return Test
smartdevicelink/sdl_atf_test_scripts
test_scripts/API/IsReady/TTS_IsReady/ATF_TTS_IsReady_missing_SplitRPC_ABORTED.lua
Lua
bsd-3-clause
782
/*----------------------------------------------------------------------------- | Copyright (c) 2014-2015, S. Chris Colbert | | Distributed under the terms of the BSD 3-Clause License. | | The full license is in the file LICENSE, distributed with this software. |----------------------------------------------------------------------------*/ module phosphor.core { /** * A singleton frozen empty object. */ export var emptyObject = Object.freeze({}); /** * A singleton frozen empty array. */ export var emptyArray: any[] = Object.freeze([]); /** * A singleton empty no-op function. */ export var emptyFunction = () => { }; } // module phosphor.core
KesterTong/phoshpor-notebook
src/core/empty.ts
TypeScript
bsd-3-clause
661
<?php class Stoa_Model_GlobalConfig { /** * Single Zend_Config instance * * @var Zend_Config */ static protected $_config = null; /** * This is a static class! * * @throws ErrorException */ protected function __construct() { throw new ErrorException('This class should not be instantiated'); } /** * Get the global configuration object * * @return Zend_Config */ static public function getConfig() { if (self::$_config == null) { self::$_config = new Zend_Config(array( // TODO: Move this to DB / INI file 'format' => array( 'timestamp' => array( 'long' => 'D M jS Y, h:ia' ) ) )); } return self::$_config; } }
shevron/stoa
application/models/GlobalConfig.php
PHP
bsd-3-clause
920
#!/bin/bash function add_dependency_override() { local name=$1 local path=$2 if ! cat pubspec.yaml | grep "dependency_overrides:" ; then echo "dependency_overrides:" >> pubspec.yaml fi local pubspec=`cat pubspec.yaml | grep -v "$name: .path: "` echo "$pubspec" > pubspec.yaml if [[ -n "$path" ]]; then echo " $name: {path: $path}" >> pubspec.yaml fi } function checkout_dependency_override_from_github() { local dependency_name=$1 local org_project=$2 local branch=$3 local path=${4:-/} local url=https://github.com/$org_project echo "dependency_name = $dependency_name" echo "url = $url$path" echo "branch = $branch" local dep_dir=dependency_overrides/$dependency_name [[ -d `dirname $dep_dir` ]] || mkdir `dirname $dep_dir` if [[ -d $dep_dir ]]; then # Check there's no local modifications before removing existing directory. ( cd $dep_dir if git status -s | grep . ; then echo "Found local modifications in $dep_dir: aborting" exit 1 fi ) rm -fR $dep_dir fi if [[ "$path" == "/" ]]; then # Checkout only the branch, with no history: git clone --depth 1 --branch $branch $url $dep_dir else ( mkdir $dep_dir cd $dep_dir # Sparse-checkout only the path + branch, with no history: git init git remote add origin $url git config core.sparsecheckout true echo $path >> .git/info/sparse-checkout git pull --depth=1 origin $branch ) fi add_dependency_override $dependency_name $dep_dir$path }
ochafik/dev_compiler
tool/dependency_overrides.sh
Shell
bsd-3-clause
1,568
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This file defines all the public base::FeatureList features for the content // module. #ifndef CONTENT_PUBLIC_COMMON_CONTENT_FEATURES_H_ #define CONTENT_PUBLIC_COMMON_CONTENT_FEATURES_H_ #include "base/feature_list.h" #include "base/metrics/field_trial_params.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "content/common/content_export.h" namespace features { // All features in alphabetical order. The features should be documented // alongside the definition of their values in the .cc file. CONTENT_EXPORT extern const base::Feature kAllowActivationDelegationAttr; CONTENT_EXPORT extern const base::Feature kAllowContentInitiatedDataUrlNavigations; CONTENT_EXPORT extern const base::Feature kAndroidDownloadableFontsMatching; #if defined(OS_WIN) CONTENT_EXPORT extern const base::Feature kAudioProcessHighPriorityWin; #endif CONTENT_EXPORT extern const base::Feature kAudioServiceLaunchOnStartup; CONTENT_EXPORT extern const base::Feature kAudioServiceOutOfProcess; CONTENT_EXPORT extern const base::Feature kAudioServiceSandbox; CONTENT_EXPORT extern const base::Feature kAvoidUnnecessaryBeforeUnloadCheck; CONTENT_EXPORT extern const base::Feature kBackgroundFetch; CONTENT_EXPORT extern const base::Feature kBackForwardCache; CONTENT_EXPORT extern const base::Feature kBackForwardCacheSameSiteForBots; CONTENT_EXPORT extern const base::Feature kBackForwardCacheMemoryControls; CONTENT_EXPORT extern const base::Feature kBackForwardCacheMediaSessionService; CONTENT_EXPORT extern const base::Feature kBlockCredentialedSubresources; CONTENT_EXPORT extern const base::Feature kBlockInsecurePrivateNetworkRequests; CONTENT_EXPORT extern const base::Feature kBlockInsecurePrivateNetworkRequestsFromPrivate; CONTENT_EXPORT extern const base::Feature kBlockInsecurePrivateNetworkRequestsFromUnknown; CONTENT_EXPORT extern const base::Feature kBlockInsecurePrivateNetworkRequestsDeprecationTrial; CONTENT_EXPORT extern const base::Feature kBlockInsecurePrivateNetworkRequestsForNavigations; CONTENT_EXPORT extern const base::Feature kBrowserUseDisplayThreadPriority; CONTENT_EXPORT extern const base::Feature kBrowserVerifiedUserActivationKeyboard; CONTENT_EXPORT extern const base::Feature kBrowserVerifiedUserActivationMouse; CONTENT_EXPORT extern const base::Feature kCacheInlineScriptCode; CONTENT_EXPORT extern const base::Feature kCanvas2DImageChromium; CONTENT_EXPORT extern const base::Feature kCapabilityDelegationPaymentRequest; CONTENT_EXPORT extern const base::Feature kClearCrossSiteCrossBrowsingContextGroupWindowName; CONTENT_EXPORT extern const base::Feature kClickPointerEvent; CONTENT_EXPORT extern const base::Feature kCompositeBGColorAnimation; CONTENT_EXPORT extern const base::Feature kCodeCacheDeletionWithoutFilter; CONTENT_EXPORT extern const base::Feature kConsolidatedMovementXY; CONTENT_EXPORT extern const base::Feature kCooperativeScheduling; CONTENT_EXPORT extern const base::Feature kCrashReporting; CONTENT_EXPORT extern const base::Feature kCriticalClientHint; CONTENT_EXPORT extern const base::Feature kCrossOriginWebAssemblyModuleSharingEnabled; CONTENT_EXPORT extern const base::Feature kDataSaverHoldback; CONTENT_EXPORT extern const base::Feature kDebugHistoryInterventionNoUserActivation; CONTENT_EXPORT extern const base::Feature kDesktopCaptureChangeSource; CONTENT_EXPORT extern const base::Feature kDesktopPWAsTabStrip; CONTENT_EXPORT extern const base::Feature kDevicePosture; CONTENT_EXPORT extern const base::Feature kDocumentPolicy; CONTENT_EXPORT extern const base::Feature kDocumentPolicyNegotiation; CONTENT_EXPORT extern const base::Feature kEarlyHintsPreloadForNavigation; CONTENT_EXPORT extern const base::Feature kEmbeddingRequiresOptIn; CONTENT_EXPORT extern const base::Feature kEnableCanvas2DLayers; CONTENT_EXPORT extern const base::Feature kEnableCanvasContextLostInBackground; CONTENT_EXPORT extern const base::Feature kEnableNewCanvas2DAPI; CONTENT_EXPORT extern const base::Feature kEnumerateDevicesHideDeviceIDs; CONTENT_EXPORT extern const base::Feature kExperimentalAccessibilityLabels; CONTENT_EXPORT extern const base::Feature kExperimentalContentSecurityPolicyFeatures; CONTENT_EXPORT extern const base::Feature kExtraSafelistedRequestHeadersForOutOfBlinkCors; CONTENT_EXPORT extern const base::Feature kFeaturePolicyForClientHints; CONTENT_EXPORT extern const base::Feature kFontSrcLocalMatching; #if !defined(OS_ANDROID) CONTENT_EXPORT extern const base::Feature kForwardMemoryPressureEventsToGpuProcess; #endif CONTENT_EXPORT extern const base::Feature kFractionalScrollOffsets; CONTENT_EXPORT extern const base::Feature kGreaseUACH; CONTENT_EXPORT extern const base::Feature kHistoryPreventSandboxedNavigation; CONTENT_EXPORT extern const base::Feature kIdleDetection; CONTENT_EXPORT extern const base::Feature kInstalledApp; CONTENT_EXPORT extern const base::Feature kInstalledAppProvider; CONTENT_EXPORT extern const base::Feature kInstalledAppsInCbd; CONTENT_EXPORT extern const base::Feature kIsolateOrigins; CONTENT_EXPORT extern const char kIsolateOriginsFieldTrialParamName[]; CONTENT_EXPORT extern const base::Feature kLazyFrameLoading; CONTENT_EXPORT extern const base::Feature kLazyFrameVisibleLoadTimeMetrics; CONTENT_EXPORT extern const base::Feature kLazyImageLoading; CONTENT_EXPORT extern const base::Feature kLazyImageVisibleLoadTimeMetrics; CONTENT_EXPORT extern const base::Feature kLazyInitializeMediaControls; CONTENT_EXPORT extern const base::Feature kLegacyWindowsDWriteFontFallback; CONTENT_EXPORT extern const base::Feature kLogJsConsoleMessages; CONTENT_EXPORT extern const base::Feature kMBIMode; enum class MBIMode { // In this mode, the AgentSchedulingGroup will use the process-wide legacy IPC // channel for communication with the renderer process and to associate its // interfaces with. AgentSchedulingGroup will effectively be a pass-through, // enabling legacy IPC and mojo behavior. kLegacy, // In this mode, each AgentSchedulingGroup will have its own legacy IPC // channel for communication with the renderer process and to associate its // interfaces with. Communication over that channel will not be ordered with // respect to the process-global legacy IPC channel. There will only be a // single AgentSchedulingGroup per RenderProcessHost. kEnabledPerRenderProcessHost, // This is just like the above state, however there will be a single // AgentSchedulingGroup per SiteInstance, and therefore potentially multiple // AgentSchedulingGroups per RenderProcessHost. Ordering between the // AgentSchedulingGroups in the same render process is not preserved. kEnabledPerSiteInstance, }; CONTENT_EXPORT extern const base::FeatureParam<MBIMode> kMBIModeParam; CONTENT_EXPORT extern const base::Feature kMediaDevicesSystemMonitorCache; CONTENT_EXPORT extern const base::Feature kMojoDedicatedThread; CONTENT_EXPORT extern const base::Feature kMojoVideoCapture; CONTENT_EXPORT extern const base::Feature kMojoVideoCaptureSecondary; CONTENT_EXPORT extern const base::Feature kMouseSubframeNoImplicitCapture; CONTENT_EXPORT extern const base::Feature kNavigationThreadingOptimizations; CONTENT_EXPORT extern const base::Feature kNetworkQualityEstimatorWebHoldback; CONTENT_EXPORT extern const base::Feature kNetworkServiceInProcess; CONTENT_EXPORT extern const base::Feature kNeverSlowMode; CONTENT_EXPORT extern const base::Feature kNotificationContentImage; CONTENT_EXPORT extern const base::Feature kNotificationTriggers; CONTENT_EXPORT extern const base::Feature kOriginIsolationHeader; CONTENT_EXPORT extern const base::Feature kOriginPolicy; CONTENT_EXPORT extern const base::Feature kOverscrollHistoryNavigation; CONTENT_EXPORT extern const base::Feature kPaymentRequestBasicCard; CONTENT_EXPORT extern const base::Feature kPeriodicBackgroundSync; CONTENT_EXPORT extern const base::Feature kFeaturePolicyHeader; CONTENT_EXPORT extern const base::Feature kPepper3DImageChromium; CONTENT_EXPORT extern const base::Feature kPepperCrossOriginRedirectRestriction; CONTENT_EXPORT extern const base::Feature kPlzServiceWorker; CONTENT_EXPORT extern const base::Feature kHighPriorityBeforeUnload; CONTENT_EXPORT extern const base::Feature kPrivateNetworkAccessRespectPreflightResults; CONTENT_EXPORT extern const base::Feature kPrivateNetworkAccessSendPreflights; CONTENT_EXPORT extern const base::Feature kProactivelySwapBrowsingInstance; CONTENT_EXPORT extern const base::Feature kProcessSharingWithDefaultSiteInstances; CONTENT_EXPORT extern const base::Feature kProcessSharingWithStrictSiteInstances; CONTENT_EXPORT extern const base::Feature kPushSubscriptionChangeEvent; CONTENT_EXPORT extern const base::Feature kDirectSockets; CONTENT_EXPORT extern const base::Feature kReloadHiddenTabsWithCrashedSubframes; CONTENT_EXPORT extern const base::Feature kRenderAccessibilityHostDeserializationOffMainThread; CONTENT_EXPORT extern const base::Feature kRenderDocument; CONTENT_EXPORT extern const base::Feature kRunVideoCaptureServiceInBrowserProcess; CONTENT_EXPORT extern const base::Feature kSavePageAsWebBundle; CONTENT_EXPORT extern const base::Feature kSecurePaymentConfirmation; CONTENT_EXPORT extern const base::Feature kSecurePaymentConfirmationDebug; CONTENT_EXPORT extern const base::Feature kSendBeaconThrowForBlobWithNonSimpleType; CONTENT_EXPORT extern const base::Feature kServiceWorkerPaymentApps; CONTENT_EXPORT extern const base::Feature kServiceWorkerTerminationOnNoControllee; CONTENT_EXPORT extern const base::Feature kSharedArrayBuffer; CONTENT_EXPORT extern const base::Feature kSharedArrayBufferOnDesktop; CONTENT_EXPORT extern const base::Feature kSignedExchangeReportingForDistributors; CONTENT_EXPORT extern const base::Feature kSignedExchangeSubresourcePrefetch; CONTENT_EXPORT extern const base::Feature kSignedHTTPExchange; CONTENT_EXPORT extern const base::Feature kSignedHTTPExchangePingValidity; CONTENT_EXPORT extern const base::Feature kSiteIsolationForCrossOriginOpenerPolicy; CONTENT_EXPORT extern const base::FeatureParam<bool> kSiteIsolationForCrossOriginOpenerPolicyShouldPersistParam; CONTENT_EXPORT extern const base::FeatureParam<int> kSiteIsolationForCrossOriginOpenerPolicyMaxSitesParam; CONTENT_EXPORT extern const base::FeatureParam<base::TimeDelta> kSiteIsolationForCrossOriginOpenerPolicyExpirationTimeoutParam; CONTENT_EXPORT extern const base::Feature kDisableProcessReuse; CONTENT_EXPORT extern const base::Feature kSkipEarlyCommitPendingForCrashedFrame; CONTENT_EXPORT extern const base::Feature kUserMediaCaptureOnFocus; CONTENT_EXPORT extern const base::Feature kWebOTP; CONTENT_EXPORT extern const base::Feature kWebOTPAssertionFeaturePolicy; CONTENT_EXPORT extern const base::Feature kServiceWorkerSubresourceFilter; #if defined(OS_ANDROID) CONTENT_EXPORT extern const base::Feature kSpareRenderer; #endif CONTENT_EXPORT extern const base::Feature kSpareRendererForSitePerProcess; CONTENT_EXPORT extern const base::Feature kStopVideoCaptureOnScreenLock; CONTENT_EXPORT extern const base::Feature kStorageServiceOutOfProcess; CONTENT_EXPORT extern const base::Feature kStrictOriginIsolation; CONTENT_EXPORT extern const base::Feature kSubframeShutdownDelay; enum class SubframeShutdownDelayType { // A flat 2s shutdown delay. kConstant, // A flat 8s shutdown delay. kConstantLong, // A variable delay from 0s to 8s based on the median interval between // subframe shutdown and process reuse over the past 5 subframe navigations. // A subframe that could not be reused is counted as 0s. kHistoryBased, // A variable delay from 0s to 8s based on the 75th-percentile interval // between subframe shutdown and process reuse over the past 5 subframe // navigations. A subframe that could not be reused is counted as 0s. kHistoryBasedLong, // A 2s base delay at 8 GB available memory or lower. Above 8 GB available // memory, scales up linearly to a maximum 8s delay at 16 GB or more. kMemoryBased }; CONTENT_EXPORT extern const base::FeatureParam<SubframeShutdownDelayType> kSubframeShutdownDelayTypeParam; CONTENT_EXPORT extern const base::Feature kSubresourceWebBundles; CONTENT_EXPORT extern const base::Feature kSuppressDifferentOriginSubframeJSDialogs; CONTENT_EXPORT extern const base::Feature kSyntheticPointerActions; CONTENT_EXPORT extern const base::Feature kTopLevelAwait; CONTENT_EXPORT extern const base::Feature kTouchpadAsyncPinchEvents; CONTENT_EXPORT extern const base::Feature kTouchpadOverscrollHistoryNavigation; CONTENT_EXPORT extern const base::Feature kTrustedDOMTypes; CONTENT_EXPORT extern const base::Feature kUnrestrictedSharedArrayBuffer; #if defined(OS_ANDROID) && defined(INCLUDE_BOTH_V8_SNAPSHOTS) CONTENT_EXPORT extern const base::Feature kUseContextSnapshot; #endif CONTENT_EXPORT extern const base::Feature kUserActivationSameOriginVisibility; CONTENT_EXPORT extern const base::Feature kVerifyDidCommitParams; CONTENT_EXPORT extern const base::Feature kVideoPlaybackQuality; CONTENT_EXPORT extern const base::Feature kV8VmFuture; CONTENT_EXPORT extern const base::Feature kWarnAboutSecurePrivateNetworkRequests; CONTENT_EXPORT extern const base::Feature kWebAppWindowControlsOverlay; CONTENT_EXPORT extern const base::Feature kWebAssemblyBaseline; CONTENT_EXPORT extern const base::Feature kWebAssemblyCodeProtection; #if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_64) CONTENT_EXPORT extern const base::Feature kWebAssemblyCodeProtectionPku; #endif // (defined(OS_LINUX) || defined(OS_CHROMEOS)) && // defined(ARCH_CPU_X86_64) CONTENT_EXPORT extern const base::Feature kWebAssemblyLazyCompilation; CONTENT_EXPORT extern const base::Feature kWebAssemblySimd; CONTENT_EXPORT extern const base::Feature kWebAssemblyTiering; CONTENT_EXPORT extern const base::Feature kWebAssemblyTrapHandler; CONTENT_EXPORT extern const base::Feature kWebAuth; CONTENT_EXPORT extern const base::Feature kWebAuthCable; CONTENT_EXPORT extern const base::Feature kWebAuthConditionalUI; CONTENT_EXPORT extern const base::Feature kWebBluetoothNewPermissionsBackend; CONTENT_EXPORT extern const base::Feature kWebBluetoothBondOnDemand; CONTENT_EXPORT extern const base::Feature kWebBundles; CONTENT_EXPORT extern const base::Feature kWebBundlesFromNetwork; CONTENT_EXPORT extern const base::Feature kWebGLImageChromium; CONTENT_EXPORT extern const base::Feature kWebID; CONTENT_EXPORT extern const base::Feature kWebMidi; CONTENT_EXPORT extern const base::Feature kWebOtpBackendAuto; CONTENT_EXPORT extern const base::Feature kWebPayments; CONTENT_EXPORT extern const base::Feature kWebRtcUseGpuMemoryBufferVideoFrames; CONTENT_EXPORT extern const base::Feature kWebUICodeCache; CONTENT_EXPORT extern const base::Feature kWebUIReportOnlyTrustedTypes; CONTENT_EXPORT extern const base::Feature kWebUsb; CONTENT_EXPORT extern const base::Feature kWebXr; CONTENT_EXPORT extern const base::Feature kWebXrArModule; CONTENT_EXPORT extern const base::Feature kChangeServiceWorkerPriorityForClientForegroundStateChange; #if defined(OS_ANDROID) CONTENT_EXPORT extern const base::Feature kAccessibilityPageZoom; CONTENT_EXPORT extern const base::Feature kBackgroundMediaRendererHasModerateBinding; CONTENT_EXPORT extern const base::Feature kBigLittleScheduling; CONTENT_EXPORT extern const base::Feature kBindingManagementWaiveCpu; CONTENT_EXPORT extern const base::Feature kOnDemandAccessibilityEvents; CONTENT_EXPORT extern const base::Feature kRequestDesktopSiteGlobal; CONTENT_EXPORT extern const base::Feature kUserMediaScreenCapturing; CONTENT_EXPORT extern const base::Feature kWarmUpNetworkProcess; CONTENT_EXPORT extern const base::Feature kWebNfc; extern const char kBigLittleSchedulingBrowserMainBiggerParam[]; extern const char kBigLittleSchedulingBrowserMainBigParam[]; extern const char kBigLittleSchedulingBrowserIOBigParam[]; extern const char kBigLittleSchedulingRenderMainBigParam[]; extern const char kBigLittleSchedulingNetworkMainBigParam[]; extern const char kBigLittleSchedulingGpuMainBigParam[]; #endif // defined(OS_ANDROID) #if defined(OS_MAC) CONTENT_EXPORT extern const base::Feature kDeviceMonitorMac; CONTENT_EXPORT extern const base::Feature kIOSurfaceCapturer; CONTENT_EXPORT extern const base::Feature kMacSyscallSandbox; CONTENT_EXPORT extern const base::Feature kRetryGetVideoCaptureDeviceInfos; #endif // defined(OS_MAC) #if defined(OS_LINUX) || defined(OS_CHROMEOS) CONTENT_EXPORT extern const base::Feature kSendWebUIJavaScriptErrorReports; CONTENT_EXPORT extern const char kSendWebUIJavaScriptErrorReportsSendToProductionVariation[]; CONTENT_EXPORT extern const base::FeatureParam<bool> kWebUIJavaScriptErrorReportsSendToProductionParam; #endif // defined(OS_LINUX) || defined(OS_CHROMEOS) #if defined(WEBRTC_USE_PIPEWIRE) CONTENT_EXPORT extern const base::Feature kWebRtcPipeWireCapturer; #endif // defined(WEBRTC_USE_PIPEWIRE) // DON'T ADD RANDOM STUFF HERE. Put it in the main section above in // alphabetical order, or in one of the ifdefs (also in order in each section). CONTENT_EXPORT bool IsVideoCaptureServiceEnabledForOutOfProcess(); CONTENT_EXPORT bool IsVideoCaptureServiceEnabledForBrowserProcess(); } // namespace features #endif // CONTENT_PUBLIC_COMMON_CONTENT_FEATURES_H_
scheib/chromium
content/public/common/content_features.h
C
bsd-3-clause
17,531
# -*- coding: utf-8 -*- from __future__ import unicode_literals from aldryn_client import forms class Form(forms.BaseForm): plugin_module = forms.CharField('Plugin module name', initial='Generic') plugin_name = forms.CharField('Plugin name', initial='Facebook Comments') plugin_template = forms.CharField('Plugin Template', initial='djangocms_fbcomments/default.html') app_id = forms.CharField('Facebook App ID', required=False) def to_settings(self, data, settings): settings['DJANGOCMS_FBCOMMENTS_PLUGIN_MODULE'] = data['plugin_module'] settings['DJANGOCMS_FBCOMMENTS_PLUGIN_NAME'] = data['plugin_name'] settings['DJANGOCMS_FBCOMMENTS_PLUGIN_TEMPLATE'] = data['plugin_template'] settings['DJANGOCMS_FBCOMMENTS_APP_ID'] = data['app_id'] return settings
mishbahr/djangocms-fbcomments
aldryn_config.py
Python
bsd-3-clause
819
from django.conf.urls.defaults import * from models import Entry, Tag from django.views.generic.dates import ArchiveIndexView, DateDetailView from django.views.generic import TemplateView urlpatterns = patterns('', url(r'^/?$', ArchiveIndexView.as_view(model=Entry, date_field="published_on"), name="news-main"), # url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[0-9A-Za-z-]+)/$', 'date_based.object_detail', dict(entry_dict, slug_field='slug', month_format='%m'),name="news-detail"), url(r'^(?P<year>\d+)/(?P<month>[-\w]+)/(?P<day>\d+)/(?P<pk>\d+)/$', DateDetailView.as_view(model=Entry, date_field="published_on"), name="news_detail"), url(r'^about/$', TemplateView.as_view(template_name='news/about.html'), name='news-about'), )
underbluewaters/marinemap
lingcod/news/urls.py
Python
bsd-3-clause
788
<?php // smf_import.php language file $lang[0]='نعم'; $lang[1]='لا'; $lang[2]='<center><u><strong><font size="4" face="Arial">المرحلة الاولى: المتطلبات الاولية</font></strong></u></center><br />'; $lang[3]='<center><strong><font size="2" face="Arial">هل ملفات منتديات SMF موجودة فل مجلد SMF<font color="'; $lang[4]='">&nbsp;&nbsp;&nbsp; '; $lang[5]='</font></center></strong>'; $lang[6]='<br /><center>Please <a target="_new" href="http://www.simplemachines.org/download/">حمل منتديات SMF</a>ثم ارفعها الى مجلد SMF<br />اذا لم يكن لديك مجلد SMF قم بعمل مجلد داخل مجلد التراكر باسم smf<br />ثم ارفع المنتدى اليها<br /><br />'; // p at end is a lowercase p for use with $lang[8] $lang[7]='<br /><center>P'; // P at end is an uppercase p for use with $lang[8] $lang[8]='ركب المنتدى<a target="_new" href="smf/install.php">بالكبس هنا</a>*<br /><br /><strong>* الرجاء استخدام معلومات قاعدة البيانات التي تستخدم بالتراكر<br />يمكن استخدام اي بادئة تريد لكن لا تستخدم نفس بادئة التراكر<br />)<br /><br />'; $lang[9]='<font color="#0000FF" size="3">يمكنك تحديث هذه الصفحة بعد عمل المطلوب</font></strong></center>'; $lang[10]='<center><strong>هل تم تركيب SMF؟<font color="'; $lang[11]='الملفات غير موجودة'; $lang[12]='الملف موجود لكن لا يمكن الكتابة عليه'; $lang[13]='<center><strong>هل ملفات smf الانجلزية موجودة؟<font color="'; $lang[14]='<center><strong>smf.sql هل هذا الملف موجود في مجلد قاعدة البيانات<font color="'; $lang[15]='<br /><center><strong>ملف اللغة'; $lang[16]=')<br />غير موجود الرجاء التاكد <font color="#FF0000"><u>ان كل ملفات SMF</u></font> تم رفعها<br /><br />'; $lang[17]=')<br />لا يمكن الكتابة عليه <font color="#FF0000"><u>الرجاء اعطاء هذا الملف صلاحية 777</u></font><br /><br />'; $lang[18]='<br /><center><strong>smf.sql الملف ضائع <font color="#FF0000"><u>الرجاء التاكد ان هذا الملف موجودة في مجلد "sql" </u></font><br />(عليه ان يكون موجود في توزيع اكس بتيت ايضاً!)<br /><br />'; $lang[19]='<br /><center>كل المتطلبات موجودة <a href="'; $lang[20]='">اكبس هنا للمتابعة</a></center>'; $lang[21]='<center><u><strong><font size="4" face="Arial">المرحلة الثانية : التثبيت الاولي</font></strong></u></center><br />'; $lang[22]='<center>بما ان لدينا كل شياء فلنقم بعمل بعض التعديلات على قاعدة البيانات ومطابقة التراكر</center><br />'; $lang[23]='<center><form name="db_pwd" action="smf_import.php" method="GET">ادخل كلمة سر قاعدة البينات:&nbsp;<input name="pwd" size="20" /><br />'."\n".'<br />."\n".<strong>رجاء <input type="submit" name="confirm" value="yes" size="20" /> للاستمرار</strong><input type="hidden" name="act" value="init_setup" /></form></center>'; $lang[24]='<center><u><strong><font size="4" face="Arial">المرحلة الثالثة - استيراد اعضاء التراكر</font></strong></u></center><br />'; $lang[25]='<center>بما ان تعديلات قاعدت البيانات كانت جيدة لنقم بجلب الاعضاء الى المنتدى من التراكر<br />هذا قد ياخذ وقت على حسب عدد اعضاء التراكر عندك<br /><br /><br /><strong>رجاء <a href="'.$_SERVER['PHP_SELF'].'?act=member_import&amp;confirm=yes">اكبس هنا</a> للاستمرار</center>'; $lang[26]='<center><u><strong><font size="4" face="Arial">عذراً</font></strong></u></center><br />'; $lang[27]='<center>هذه الشفرة تستعمل مرة واحدة وقد تم اقفالها، اذهب الى منتدى الدعم لمعرفة طريقة الفتح</center>'; $lang[28]='<center><br /><strong><font color="#FF0000"><br />'; $lang[29]='</strong></font> تم انشاء حسابات المنتدى <a href="'.$_SERVER['PHP_SELF'].'?act=import_forum&amp;confirm=no">اكبس هنا للاستمرار</a></center>'; $lang[30]='<center><u><strong><font size="4" face="Arial">الخطوة الاخيرة استيراد المنتدى والمشاركات</font></strong></u></center><br />'; $lang[31]='<center>هذه هي المرحلة الاخيرة سوف يتم استيراد المنتدى والمواضيع من المتتبع<br />سوف يتم استيرادها الى مجموعة تدعى "My BTI import",<br />رجاء <a href="'.$_SERVER['PHP_SELF'].'?act=import_forum&amp;confirm=yes">اكبس هنا</a> للمتابعة</center>'; $lang[32]='<center><u><strong><font size="4" face="Arial">تم الاستيراد بنجاح</font></strong></u></center><br />'; $lang[33]='<center><font face="Arial" size="2">رجاء <a target="_new" href="smf/index.php?action=login">قم بتسجيل الدخول لمنتداك</a> باستخدام نفس معلومات التراكر<br />the <strong>قسم الاشراف</strong> ثم حدد <strong>ادارة المنتديات</strong> وقم بتفعيل<br /><strong>Find and repair any errors.</strong> ثم اتبعها <strong>Recount all forum totals<br />and statistics.</strong> لتحسين الاستيراد واعاد عد المواضيع<br /><br /><strong><font color="#0000FF">المنتدى جاهز للاستعمال</font></strong></font></center>'; $lang[34]='<center><u><strong><font size="4" face="Arial" color="#FF0000">ERROR!</font></strong></u></center><br />'."\n".'<br />'."\n".'<center><font face="Arial" size="3">لقد كتبت كلمة سر خطاء او انك لست المالك لهذا المنتدى<br />'."\n".'Please note that your IP has been logged.</font></center>'; $lang[35]='</body>'."\n".'</html>'."\n"; $lang[36]='<center>لم نتمكن من الكتابة الى:<br /><br /><b>'; $lang[37]='</b><br /><br />الرجاء التاكد من انه يمكن الكتابة على الملف ثم اعد الكرة</center>'; $lang[38]='<center><br /><font color="red" size="4"><b>منع الوصول</b></font></center>'; ?>
cybyd/cybyd
language/arabic/lang_smf_import.php
PHP
bsd-3-clause
6,491
/* simq.c * * Solution of simultaneous linear equations AX = B * by Gaussian elimination with partial pivoting * * * * SYNOPSIS: * * double A[n*n], B[n], X[n]; * int n, flag; * int IPS[]; * int simq(); * * ercode = simq( A, B, X, n, flag, IPS ); * * * * DESCRIPTION: * * B, X, IPS are vectors of length n. * A is an n x n matrix (i.e., a vector of length n*n), * stored row-wise: that is, A(i,j) = A[ij], * where ij = i*n + j, which is the transpose of the normal * column-wise storage. * * The contents of matrix A are destroyed. * * Set flag=0 to solve. * Set flag=-1 to do a new back substitution for different B vector * using the same A matrix previously reduced when flag=0. * * The routine returns nonzero on error; messages are printed. * * * ACCURACY: * * Depends on the conditioning (range of eigenvalues) of matrix A. * * * REFERENCE: * * Computer Solution of Linear Algebraic Systems, * by George E. Forsythe and Cleve B. Moler; Prentice-Hall, 1967. * */ /* simq 2 */ #include <stdio.h> #define ANSIPROT #ifdef ANSIPROT int simq(double [], double [], double [], int, int, int [] ); #endif #define fabs(x) ((x) < 0 ? -(x) : (x)) int simq( A, B, X, n, flag, IPS ) double A[], B[], X[]; int n, flag; int IPS[]; { int i, j, ij, ip, ipj, ipk, ipn; int idxpiv, iback; int k, kp, kp1, kpk, kpn; int nip, nkp, nm1; double em, q, rownrm, big, size, pivot, sum; nm1 = n-1; if( flag < 0 ) goto solve; /* Initialize IPS and X */ ij=0; for( i=0; i<n; i++ ) { IPS[i] = i; rownrm = 0.0; for( j=0; j<n; j++ ) { q = fabs( A[ij] ); if( rownrm < q ) rownrm = q; ++ij; } if( rownrm == 0.0 ) { puts("SIMQ ROWNRM=0"); return(1); } X[i] = 1.0/rownrm; } /* simq 3 */ /* Gaussian elimination with partial pivoting */ for( k=0; k<nm1; k++ ) { big= 0.0; idxpiv = 0; for( i=k; i<n; i++ ) { ip = IPS[i]; ipk = n*ip + k; size = fabs( A[ipk] ) * X[ip]; if( size > big ) { big = size; idxpiv = i; } } if( big == 0.0 ) { puts( "SIMQ BIG=0" ); return(2); } if( idxpiv != k ) { j = IPS[k]; IPS[k] = IPS[idxpiv]; IPS[idxpiv] = j; } kp = IPS[k]; kpk = n*kp + k; pivot = A[kpk]; kp1 = k+1; for( i=kp1; i<n; i++ ) { ip = IPS[i]; ipk = n*ip + k; em = -A[ipk]/pivot; A[ipk] = -em; nip = n*ip; nkp = n*kp; for( j=kp1; j<n; j++ ) { ipj = nip + j; A[ipj] = A[ipj] + em * A[nkp + j]; } } } kpn = n * IPS[n-1] + n - 1; /* last element of IPS[n] th row */ if( A[kpn] == 0.0 ) { puts( "SIMQ A[kpn]=0"); return(3); } /* simq 4 */ /* back substitution */ solve: ip = IPS[0]; X[0] = B[ip]; for( i=1; i<n; i++ ) { ip = IPS[i]; ipj = n * ip; sum = 0.0; for( j=0; j<i; j++ ) { sum += A[ipj] * X[j]; ++ipj; } X[i] = B[ip] - sum; } ipn = n * IPS[n-1] + n - 1; X[n-1] = X[n-1]/A[ipn]; for( iback=1; iback<n; iback++ ) { /* i goes (n-1),...,1 */ i = nm1 - iback; ip = IPS[i]; nip = n*ip; sum = 0.0; for( j=i+1; j<n; j++ ) sum += A[nip+j] * X[j]; X[i] = (X[i] - sum)/A[nip+i]; } return(0); }
huard/scipy-work
scipy/special/cephes/simq.c
C
bsd-3-clause
3,074
<?php namespace app\controllers; use Yii; use app\models\Lieu; use app\models\LieuSearch; use yii\filters\AccessControl; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; /** * LieuController implements the CRUD actions for Lieu model. */ class LieuController extends Controller { /** * @inheritdoc */ public function behaviors() { return [ 'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'allow' => true, 'roles' => ['@'], ], // ... ], ], 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'delete' => ['POST'], ], ], ]; } /** * Lists all Lieu models. * @return mixed */ public function actionIndex() { $searchModel = new LieuSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); } /** * Displays a single Lieu model. * @param integer $id * @return mixed */ public function actionView($id) { return $this->render('view', [ 'model' => $this->findModel($id), ]); } /** * Creates a new Lieu model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Lieu(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', [ 'model' => $model, ]); } } /** * Updates an existing Lieu model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', [ 'model' => $model, ]); } } /** * Deletes an existing Lieu model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $this->findModel($id)->delete(); return $this->redirect(['index']); } /** * Finds the Lieu model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Lieu the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Lieu::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } } }
LatifaCh/GestionInterventions
controllers/LieuController.php
PHP
bsd-3-clause
3,415
<div style="position: relative; padding: 3px;"> <div dojoAttachPoint="controlsContainer"> <input type="button" value="pause" dojoAttachPoint="startStopButton" dojoAttachEvent="onClick: togglePaused;"> </div> <div style="position: relative; width: 800px; height: 600px;" dojoAttachPoint="imagesContainer" dojoAttachEvent="onClick: togglePaused;"> <img dojoAttachPoint="img1" class="slideShowImg" style="z-index: 1;" /> <img dojoAttachPoint="img2" class="slideShowImg" style="z-index: 0;" /> </div> </div>
vivo-project/Vitro
webapp/src/main/webapp/src/widget/templates/HtmlSlideShow.html
HTML
bsd-3-clause
544
<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @package Zend_Validator */ namespace ZendTest\Validator\Db; use Zend\Validator\Db\NoRecordExists; use ArrayObject; /** * @category Zend * @package Zend_Validator * @subpackage UnitTests * @group Zend_Validator */ class NoRecordExistsTest extends \PHPUnit_Framework_TestCase { /** * Return a Mock object for a Db result with rows * * @return \Zend\Db\Adapter\Adapter */ protected function getMockHasResult() { // mock the adapter, driver, and parts $mockConnection = $this->getMock('Zend\Db\Adapter\Driver\ConnectionInterface'); // Mock has result $mockHasResultRow = new ArrayObject(); $mockHasResultRow->one = 'one'; $mockHasResult = $this->getMock('Zend\Db\Adapter\Driver\ResultInterface'); $mockHasResult->expects($this->any()) ->method('current') ->will($this->returnValue($mockHasResultRow)); $mockHasResultStatement = $this->getMock('Zend\Db\Adapter\Driver\StatementInterface'); $mockHasResultStatement->expects($this->any()) ->method('execute') ->will($this->returnValue($mockHasResult)); $mockHasResultDriver = $this->getMock('Zend\Db\Adapter\Driver\DriverInterface'); $mockHasResultDriver->expects($this->any()) ->method('createStatement') ->will($this->returnValue($mockHasResultStatement)); $mockHasResultDriver->expects($this->any()) ->method('getConnection') ->will($this->returnValue($mockConnection)); return $this->getMock('Zend\Db\Adapter\Adapter', null, array($mockHasResultDriver)); } /** * Return a Mock object for a Db result without rows * * @return \Zend\Db\Adapter\Adapter */ protected function getMockNoResult() { // mock the adapter, driver, and parts $mockConnection = $this->getMock('Zend\Db\Adapter\Driver\ConnectionInterface'); $mockNoResult = $this->getMock('Zend\Db\Adapter\Driver\ResultInterface'); $mockNoResult->expects($this->any()) ->method('current') ->will($this->returnValue(null)); $mockNoResultStatement = $this->getMock('Zend\Db\Adapter\Driver\StatementInterface'); $mockNoResultStatement->expects($this->any()) ->method('execute') ->will($this->returnValue($mockNoResult)); $mockNoResultDriver = $this->getMock('Zend\Db\Adapter\Driver\DriverInterface'); $mockNoResultDriver->expects($this->any()) ->method('createStatement') ->will($this->returnValue($mockNoResultStatement)); $mockNoResultDriver->expects($this->any()) ->method('getConnection') ->will($this->returnValue($mockConnection)); return $this->getMock('Zend\Db\Adapter\Adapter', null, array($mockNoResultDriver)); } /** * Test basic function of RecordExists (no exclusion) * * @return void */ public function testBasicFindsRecord() { $validator = new NoRecordExists('users', 'field1', null, $this->getMockHasResult()); $this->assertFalse($validator->isValid('value1')); } /** * Test basic function of RecordExists (no exclusion) * * @return void */ public function testBasicFindsNoRecord() { $validator = new NoRecordExists('users', 'field1', null, $this->getMockNoResult()); $this->assertTrue($validator->isValid('nosuchvalue')); } /** * Test the exclusion function * * @return void */ public function testExcludeWithArray() { $validator = new NoRecordExists('users', 'field1', array('field' => 'id', 'value' => 1), $this->getMockHasResult()); $this->assertFalse($validator->isValid('value3')); } /** * Test the exclusion function * with an array * * @return void */ public function testExcludeWithArrayNoRecord() { $validator = new NoRecordExists('users', 'field1', array('field' => 'id', 'value' => 1), $this->getMockNoResult()); $this->assertTrue($validator->isValid('nosuchvalue')); } /** * Test the exclusion function * with a string * * @return void */ public function testExcludeWithString() { $validator = new NoRecordExists('users', 'field1', 'id != 1', $this->getMockHasResult()); $this->assertFalse($validator->isValid('value3')); } /** * Test the exclusion function * with a string * * @return void */ public function testExcludeWithStringNoRecord() { $validator = new NoRecordExists('users', 'field1', 'id != 1', $this->getMockNoResult()); $this->assertTrue($validator->isValid('nosuchvalue')); } /** * Test that the class throws an exception if no adapter is provided * and no default is set. * * @return void */ public function testThrowsExceptionWithNoAdapter() { $validator = new NoRecordExists('users', 'field1', 'id != 1'); $this->setExpectedException('Zend\Validator\Exception\RuntimeException', 'No database adapter present'); $validator->isValid('nosuchvalue'); } /** * Test that schemas are supported and run without error * * @return void */ public function testWithSchema() { $validator = new NoRecordExists(array('table' => 'users', 'schema' => 'my'), 'field1', null, $this->getMockHasResult()); $this->assertFalse($validator->isValid('value1')); } /** * Test that schemas are supported and run without error * * @return void */ public function testWithSchemaNoResult() { $validator = new NoRecordExists(array('table' => 'users', 'schema' => 'my'), 'field1', null, $this->getMockNoResult()); $this->assertTrue($validator->isValid('value1')); } public function testEqualsMessageTemplates() { $validator = new NoRecordExists('users', 'field1'); $this->assertAttributeEquals($validator->getOption('messageTemplates'), 'messageTemplates', $validator); } }
w3ird0/stickynotes
vendor/ZF2/tests/ZendTest/Validator/Db/NoRecordExistsTest.php
PHP
bsd-3-clause
6,981
package dvb // Device delivery sytem type DeliverySystem uint32 const ( SysUndefined DeliverySystem = iota SysDVBCAnnexA SysDVBCAnnexB SysDVBT SysDSS SysDVBS SysDVBS2 SysDVBH SysISDBT SysISDBS SysISDBC SysATSC SysATSCMH SysDMBTH SysCMMB SysDAB SysDVBT2 SysTURBO SysDVBCAnnexC ) var dsn = []string{ "Undefined", "DVB-C Annex AC", "DVB-C Annex B", "DVB-T", "DSS", "DVB-S", "DVB-S2", "DVB-H", "ISDB-T", "ISDB-S", "ISDB-C", "ATSC", "ATSC-MH", "DMBT-H", "CMMB", "DAB", "DVB-T2", "TURBO", } func (ds DeliverySystem) String() string { if ds > DeliverySystem(len(dsn)) { return "unknown" } return dsn[ds] } type Inversion uint32 const ( InversionOff Inversion = iota InversionOn InversionAuto ) var inversionNames = []string{ "off", "on", "auto", } func (i Inversion) String() string { if i > InversionAuto { return "unknown" } return inversionNames[i] } type CodeRate uint32 const ( FECNone CodeRate = iota FEC12 FEC23 FEC34 FEC45 FEC56 FEC67 FEC78 FEC89 FECAuto FEC35 FEC910 ) var codeRateNames = []string{ "none", "1/2", "2/3", "3/4", "4/5", "5/6", "6/7", "7/8", "8/9", "auto", "3/5", "9/10", } func (cr CodeRate) String() string { if cr > FEC910 { return "unknown" } return codeRateNames[cr] } type Modulation uint32 const ( QPSK Modulation = iota QAM16 QAM32 QAM64 QAM128 QAM256 QAMAuto VSB8 VSB16 PSK8 APSK16 APSK32 DQPSK ) var modulationNames = []string{ "QPSK", "QAM16", "QAM32", "QAM64", "QAM128", "QAM256", "QAMAuto", "VSB8", "VSB16", "PSK8", "APSK16", "APSK32", "DQPSK", } func (m Modulation) String() string { if m > DQPSK { return "unknown" } return modulationNames[m] } type TxMode uint32 const ( TxMode2k TxMode = iota TxMode8k TxModeAuto TxMode4k TxMode1k TxMode16k TxMode32k ) var txModeNames = []string{ "2k", "8k", "auto", "4k", "1k", "16k", "32k", } func (tm TxMode) String() string { if tm > TxMode32k { return "unknown" } return txModeNames[tm] } type Guard uint32 const ( Guard32 Guard = iota // 1/32 Guard16 // 1/16 Guard8 // 1/8 Guard4 // 1/4 GuardAuto Guard128 // 1/128 GuardN128 // 19/128 GuardN256 // 19/256 ) var guardNames = []string{ "1/32", "1/16", "1/8", "1/4", "auto", "1/128", "19/128", "19/256", } func (gi Guard) String() string { if gi > GuardN256 { return "unknown" } return guardNames[gi] } type Hierarchy uint32 const ( HierarchyNone Hierarchy = iota Hierarchy1 Hierarchy2 Hierarchy4 HierarchyAuto ) var hierarchyNames = []string{ "none", "uniform", "HP/LP=2", "HP/LP=4", "auto", } func (h Hierarchy) String() string { if h > HierarchyAuto { return "unknown" } return hierarchyNames[h] } // DVB-S2 pilot type Pilot uint32 const ( PilotOn Pilot = iota PilotOff PilotAuto ) // DVB-S2 rolloff type Rolloff uint32 const ( Rolloff35 Rolloff = iota // Implied value in DVB-S, default for DVB-S2 Rolloff20 Rolloff25 RolloffAuto )
ziutek/dvb
params.go
GO
bsd-3-clause
3,005
// htonll.cc // htonll definition on some machine typedef unsigned long long uint64; inline uint64 htonll(uint64 x) { return (__extension__ ({ union { __extension__ unsigned long long int __ll; unsigned long int __l[2]; } __w, __r; if (__builtin_constant_p (x)) __r.__ll = ((((x) & 0xff00000000000000ull) >> 56) | (((x) & 0x00ff000000000000ull) >> 40) | (((x) & 0x0000ff0000000000ull) >> 24) | (((x) & 0x000000ff00000000ull) >> 8) | (((x) & 0x00000000ff000000ull) << 8) | (((x) & 0x0000000000ff0000ull) << 24) | (((x) & 0x000000000000ff00ull) << 40) | (((x) & 0x00000000000000ffull) << 56) ); else { __w.__ll = (x); __r.__l[0] = (__extension__ ({ register unsigned int __v; if (__builtin_constant_p (__w.__l[1])) __v = ((((__w.__l[1]) & 0xff000000) >> 24) | (((__w.__l[1]) & 0x00ff0000) >> 8) | (((__w.__l[1]) & 0x0000ff00) << 8) | (((__w.__l[1]) & 0x000000ff) << 24)); else __asm__ __volatile__ ( "rorw $8, %w0;" "rorl $16, %0;" "rorw $8, %w0" : "=r" (__v) : "0" ((unsigned int) (__w.__l[1])) : "cc"); __v; })); __r.__l[1] = (__extension__ ({ register unsigned int __v; if (__builtin_constant_p(__w.__l[0])) __v = ((((__w.__l[0]) & 0xff000000) >> 24) | (((__w.__l[0]) & 0x00ff0000) >> 8) | (((__w.__l[0]) & 0x0000ff00) << 8) | (((__w.__l[0]) & 0x000000ff) << 24)); else __asm__ __volatile__ ( "rorw $8, %w0;" "rorl $16, %0;" "rorw $8, %w0" : "=r" (__v) : "0" ((unsigned int) (__w.__l[0])) : "cc"); __v; })); } __r.__ll; })); }
angavrilov/olmar
elsa/in/htonll.cc
C++
bsd-3-clause
2,012
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} ----------------------------------------------------------------------------- -- | DBSocketT transformer which signs and issues network requests. ----------------------------------------------------------------------------- module Azure.DocDB.SocketMonad.DBSocketT ( DBSocketState, DBSocketT, execDBSocketT, mkDBSocketState ) where import Control.Applicative import Control.Lens (Lens', lens, (%~), (.=), (%=)) import Control.Monad.Except import Control.Monad.Reader import Control.Monad.State import Control.Monad.Catch (MonadThrow) import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as L import Data.Time.Clock (getCurrentTime) import qualified Data.Text as T import qualified Data.Text.IO as T import qualified Data.Text.Encoding as T import Network.HTTP.Client as HC import qualified Network.HTTP.Types as HT import Web.HttpApiData (ToHttpApiData(..)) import Azure.DocDB.Auth import Azure.DocDB.ResourceId import qualified Azure.DocDB.ServiceHeader as AH import Azure.DocDB.SocketMonad.Class -- | Socket state for DB connections data DBSocketState = DBSocketState { dbSSRequest :: Request, -- ^ Verb, uri, body, and additional headers being sent sbSSSigning :: SigningParams -> DocDBSignature, -- ^ Method to sign requests sendHttps :: Request -> IO (Response L.ByteString) } newtype DBSocketT m a = DBSocketT { runDBSocketT :: ExceptT DBError (ReaderT DBSocketState m) a } deriving (Functor, Applicative, Monad, MonadIO) instance MonadTrans DBSocketT where lift = DBSocketT . lift . lift -- Lenses for a request method' :: Lens' Request HT.Method method' = lens method (\req m -> req { method = m }) path' :: Lens' Request B.ByteString path' = lens path (\req m -> req { path = m }) requestBody' :: Lens' Request RequestBody requestBody' = lens requestBody (\req m -> req { requestBody = m }) requestHeaders' :: Lens' Request [HT.Header] requestHeaders' = lens requestHeaders (\req m -> req { requestHeaders = m }) -- | Execute the DB operation execDBSocketT :: MonadIO m => DBSocketT m a -> DBSocketState -> m (Either DBError a) execDBSocketT (DBSocketT m) = runReaderT (runExceptT m) --- | DBSocketState constructor mkDBSocketState :: (MonadThrow m, MonadIO m, Alternative m) => B.ByteString -- ^ Signing key -> T.Text -- ^ Root url -> Manager -- ^ Network manager -> m DBSocketState mkDBSocketState signingKey root mgr = do r <- parseRequest $ T.unpack root return DBSocketState { dbSSRequest = r { requestHeaders = [AH.version] } , sbSSSigning = signRequestInfo signingKey , sendHttps = mkDebuggable (`httpLbs` mgr) } -- | Add IO printing to network activity mkDebuggable :: MonadIO m => (Request -> m (Response L.ByteString)) -> Request -> m (Response L.ByteString) mkDebuggable f req = do liftIO $ do print req T.putStrLn (case requestBody req of RequestBodyLBS lb -> T.decodeUtf8 $ L.toStrict lb RequestBodyBS sb -> T.decodeUtf8 sb _ -> "Unknown response") rspTmp <- f req liftIO $ print rspTmp return rspTmp instance Monad m => MonadError DBError (DBSocketT m) where throwError e = DBSocketT $ throwError e catchError (DBSocketT ma) fema = DBSocketT $ catchError ma (runDBSocketT . fema) instance MonadIO m => DBSocketMonad (DBSocketT m) where sendSocketRequest socketRequest = DBSocketT $ do (DBSocketState req fsign sendHttpsProc) <- ask -- Pick a timestamp for signing now <- MSDate <$> liftIO getCurrentTime -- Sign the request let signature = fsign SigningParams { spMethod = srMethod socketRequest, spResourceType = srResourceType socketRequest, spPath = srResourceLink socketRequest, spWhen = now } -- Build and issue the request response <- liftIO . sendHttpsProc . applySocketRequest . applySignature now signature $ req let status = responseStatus response let statusText = T.decodeUtf8 . HT.statusMessage $ status case HT.statusCode status of 403 -> throwError DBForbidden 404 -> throwError DBNotFound 409 -> throwError DBConflict 412 -> throwError DBPreconditionFailure 413 -> throwError DBEntityTooLarge code | code >= 400 && code < 500 -> throwError $ DBBadRequest statusText code | code >= 500 -> throwError $ DBServiceError statusText _ -> return . responseToSocketResponse $ response -- where -- Update the request to match the top level socketRequest parameters applySocketRequest :: Request -> Request applySocketRequest = execState $ do method' .= HT.renderStdMethod (srMethod socketRequest) path' %= (</> T.encodeUtf8 (srUriPath socketRequest)) requestBody' .= RequestBodyLBS (srContent socketRequest) requestHeaders' %= (srHeaders socketRequest ++) -- Apply the signature info applySignature :: ToHttpApiData a => MSDate -> a -> Request -> Request applySignature dateWhen docDBSignature = requestHeaders' %~ execState (do AH.header' AH.msDate .= Just (toHeader dateWhen) AH.header' HT.hAuthorization .= Just (toHeader docDBSignature) ) responseToSocketResponse :: Response L.ByteString -> SocketResponse responseToSocketResponse response = SocketResponse (HT.statusCode $ responseStatus response) (responseHeaders response) (responseBody response)
jnonce/azure-docdb
lib/Azure/DocDB/SocketMonad/DBSocketT.hs
Haskell
bsd-3-clause
5,678
/* * Copyright 2008 The Closure Compiler Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Definitions for W3C's DOM Level 2 specification. * This file depends on w3c_dom1.js. * The whole file has been fully type annotated. * Created from * http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html * * @externs */ // All the provided definitions have been type annotated. /** * @constructor * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-75708506 */ function HTMLCollection() {} /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-40057551 */ HTMLCollection.prototype.length; /** * @param {number} index * @return {Node} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-33262535 * @nosideeffects */ HTMLCollection.prototype.item = function(index) {}; /** * @constructor * @see http://www.w3.org/TR/DOM-Level-2-HTML/html.html#HTMLOptionsCollection */ function HTMLOptionsCollection() {} /** * @type {number} * @see http://www.w3.org/TR/DOM-Level-2-HTML/html.html#HTMLOptionsCollection-length */ HTMLOptionsCollection.prototype.length; /** * @param {number} index * @return {Node} * @see http://www.w3.org/TR/DOM-Level-2-HTML/html.html#HTMLOptionsCollection-item * @nosideeffects */ HTMLOptionsCollection.prototype.item = function(index) {}; /** * @constructor * @extends {Document} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-26809268 */ function HTMLDocument() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-18446827 */ HTMLDocument.prototype.title; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-95229140 */ HTMLDocument.prototype.referrer; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-2250147 */ HTMLDocument.prototype.domain; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-46183437 */ HTMLDocument.prototype.URL; /** * @type {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-56360201 */ HTMLDocument.prototype.body; /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-90379117 */ HTMLDocument.prototype.images; /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-85113862 */ HTMLDocument.prototype.applets; /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-7068919 */ HTMLDocument.prototype.links; /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-1689064 */ HTMLDocument.prototype.forms; /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-7577272 */ HTMLDocument.prototype.anchors; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-8747038 */ HTMLDocument.prototype.cookie; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-72161170 * @override */ HTMLDocument.prototype.open = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-98948567 * @override */ HTMLDocument.prototype.close = function() {}; /** * @param {string} text * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-75233634 * @override */ HTMLDocument.prototype.write = function(text) {}; /** * @param {string} text * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-35318390 * @override */ HTMLDocument.prototype.writeln = function(text) {}; /** * @param {string} elementName * @return {!NodeList} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-71555259 * @override * @nosideeffects */ HTMLDocument.prototype.getElementsByName = function(elementName) {}; /** * @constructor * @extends {Element} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-58190037 */ function HTMLElement() {} /** * @implicitCast * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-63534901 */ HTMLElement.prototype.id; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-78276800 */ HTMLElement.prototype.title; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-59132807 */ HTMLElement.prototype.lang; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-52460740 */ HTMLElement.prototype.dir; /** * @implicitCast * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-95362176 */ HTMLElement.prototype.className; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-33759296 */ function HTMLHtmlElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-9383775 */ HTMLHtmlElement.prototype.version; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-77253168 */ function HTMLHeadElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-96921909 */ HTMLHeadElement.prototype.profile; /** * @constructor * @extends {HTMLElement} * @implements {LinkStyle} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-35143001 */ function HTMLLinkElement() {} /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-87355129 */ HTMLLinkElement.prototype.disabled; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-63954491 */ HTMLLinkElement.prototype.charset; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-33532588 */ HTMLLinkElement.prototype.href; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-85145682 */ HTMLLinkElement.prototype.hreflang; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-75813125 */ HTMLLinkElement.prototype.media; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-41369587 */ HTMLLinkElement.prototype.rel; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-40715461 */ HTMLLinkElement.prototype.rev; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-84183095 */ HTMLLinkElement.prototype.target; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-32498296 */ HTMLLinkElement.prototype.type; /** @override */ HTMLLinkElement.prototype.sheet; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-79243169 */ function HTMLTitleElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-77500413 */ HTMLTitleElement.prototype.text; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-37041454 */ function HTMLMetaElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-87670826 */ HTMLMetaElement.prototype.content; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-77289449 */ HTMLMetaElement.prototype.httpEquiv; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-31037081 */ HTMLMetaElement.prototype.name; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-35993789 */ HTMLMetaElement.prototype.scheme; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-73629039 */ function HTMLBaseElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-65382887 */ HTMLBaseElement.prototype.href; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-73844298 */ HTMLBaseElement.prototype.target; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-85283003 */ // Doesn't exist in Firefox 17.0.3esr. //function HTMLIsIndexElement() {} /** * @type {HTMLFormElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-87069980 */ //HTMLIsIndexElement.prototype.form; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-33589862 */ //HTMLIsIndexElement.prototype.prompt; /** * @constructor * @extends {HTMLElement} * @implements {LinkStyle} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-16428977 */ function HTMLStyleElement() {} /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-51162010 */ HTMLStyleElement.prototype.disabled; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-76412738 */ HTMLStyleElement.prototype.media; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-22472002 */ HTMLStyleElement.prototype.type; /** @override */ HTMLStyleElement.prototype.sheet; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-62018039 */ function HTMLBodyElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-59424581 */ HTMLBodyElement.prototype.aLink; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-37574810 */ HTMLBodyElement.prototype.background; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-24940084 */ HTMLBodyElement.prototype.bgColor; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-7662206 */ HTMLBodyElement.prototype.link; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-73714763 */ HTMLBodyElement.prototype.text; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-83224305 */ HTMLBodyElement.prototype.vLink; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-40002357 */ function HTMLFormElement() {} /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-76728479 */ HTMLFormElement.prototype.elements; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#HTML-HTMLFormElement-length */ HTMLFormElement.prototype.length; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-22051454 */ HTMLFormElement.prototype.name; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-19661795 */ HTMLFormElement.prototype.acceptCharset; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-74049184 */ HTMLFormElement.prototype.action; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-84227810 */ HTMLFormElement.prototype.enctype; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-82545539 */ HTMLFormElement.prototype.method; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-6512890 */ HTMLFormElement.prototype.target; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-76767676 */ HTMLFormElement.prototype.submit = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-76767677 */ HTMLFormElement.prototype.reset = function() {}; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-94282980 */ function HTMLSelectElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-58783172 */ HTMLSelectElement.prototype.type; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-85676760 */ HTMLSelectElement.prototype.selectedIndex; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-59351919 */ HTMLSelectElement.prototype.value; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-5933486 */ HTMLSelectElement.prototype.length; /** * @type {HTMLFormElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-20489458 */ HTMLSelectElement.prototype.form; /** * @type {HTMLOptionsCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-30606413 */ HTMLSelectElement.prototype.options; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-79102918 */ HTMLSelectElement.prototype.disabled; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-13246613 */ HTMLSelectElement.prototype.multiple; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-41636323 */ HTMLSelectElement.prototype.name; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-18293826 */ HTMLSelectElement.prototype.size; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-40676705 */ HTMLSelectElement.prototype.tabIndex; /** * @param {HTMLElement} element * @param {HTMLElement} before * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-14493106 */ HTMLSelectElement.prototype.add = function(element, before) {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-28216144 * @override */ HTMLSelectElement.prototype.blur = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-32130014 * @override */ HTMLSelectElement.prototype.focus = function() {}; /** * @param {number} index * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-33404570 */ HTMLSelectElement.prototype.remove = function(index) {}; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-38450247 */ function HTMLOptGroupElement() {} /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-15518803 */ HTMLOptGroupElement.prototype.disabled; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-95806054 */ HTMLOptGroupElement.prototype.label; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-70901257 */ function HTMLOptionElement() {} /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-37770574 */ HTMLOptionElement.prototype.defaultSelected; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-23482473 */ HTMLOptionElement.prototype.disabled; /** * @type {HTMLFormElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-17116503 */ HTMLOptionElement.prototype.form; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-14038413 */ HTMLOptionElement.prototype.index; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-40736115 */ HTMLOptionElement.prototype.label; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-70874476 */ HTMLOptionElement.prototype.selected; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-48154426 */ HTMLOptionElement.prototype.text; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-6185554 */ HTMLOptionElement.prototype.value; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-6043025 */ function HTMLInputElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-15328520 */ HTMLInputElement.prototype.accept; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-59914154 */ HTMLInputElement.prototype.accessKey; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-96991182 */ HTMLInputElement.prototype.align; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-92701314 */ HTMLInputElement.prototype.alt; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-30233917 */ HTMLInputElement.prototype.checked; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-20509171 */ HTMLInputElement.prototype.defaultChecked; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-26091157 */ HTMLInputElement.prototype.defaultValue; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-50886781 */ HTMLInputElement.prototype.disabled; /** * @type {HTMLFormElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-63239895 */ HTMLInputElement.prototype.form; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-54719353 */ HTMLInputElement.prototype.maxLength; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-89658498 */ HTMLInputElement.prototype.name; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-88461592 */ HTMLInputElement.prototype.readOnly; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-79659438 */ HTMLInputElement.prototype.size; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-97320704 */ HTMLInputElement.prototype.src; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-62176355 */ HTMLInputElement.prototype.tabIndex; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-62883744 */ HTMLInputElement.prototype.type; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-32463706 */ HTMLInputElement.prototype.useMap; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-49531485 */ HTMLInputElement.prototype.value; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-26838235 * @override */ HTMLInputElement.prototype.blur = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-2651361 * @override */ HTMLInputElement.prototype.click = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-65996295 * @override */ HTMLInputElement.prototype.focus = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-34677168 */ HTMLInputElement.prototype.select = function() {}; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-24874179 */ function HTMLTextAreaElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-93102991 */ HTMLTextAreaElement.prototype.accessKey; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-51387225 */ HTMLTextAreaElement.prototype.cols; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-36152213 */ HTMLTextAreaElement.prototype.defaultValue; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-98725443 */ HTMLTextAreaElement.prototype.disabled; /** * @type {HTMLFormElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-18911464 */ HTMLTextAreaElement.prototype.form; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-70715578 */ HTMLTextAreaElement.prototype.name; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-39131423 */ HTMLTextAreaElement.prototype.readOnly; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-46975887 */ HTMLTextAreaElement.prototype.rows; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-60363303 */ HTMLTextAreaElement.prototype.tabIndex; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#HTML-HTMLTextAreaElement-type */ HTMLTextAreaElement.prototype.type; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-70715579 */ HTMLTextAreaElement.prototype.value; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-6750689 * @override */ HTMLTextAreaElement.prototype.blur = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-39055426 * @override */ HTMLTextAreaElement.prototype.focus = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-48880622 */ HTMLTextAreaElement.prototype.select = function() {}; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-34812697 */ function HTMLButtonElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-73169431 */ HTMLButtonElement.prototype.accessKey; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-92757155 */ HTMLButtonElement.prototype.disabled; /** * @type {HTMLFormElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-71254493 */ HTMLButtonElement.prototype.form; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-11029910 */ HTMLButtonElement.prototype.name; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-39190908 */ HTMLButtonElement.prototype.tabIndex; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-27430092 */ HTMLButtonElement.prototype.type; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-72856782 */ HTMLButtonElement.prototype.value; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-13691394 */ function HTMLLabelElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-43589892 */ HTMLLabelElement.prototype.accessKey; /** * @type {HTMLFormElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-32480901 */ HTMLLabelElement.prototype.form; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-96509813 */ HTMLLabelElement.prototype.htmlFor; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-7365882 */ function HTMLFieldSetElement() {} /** * @type {HTMLFormElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-75392630 */ HTMLFieldSetElement.prototype.form; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-21482039 */ function HTMLLegendElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-11297832 */ HTMLLegendElement.prototype.accessKey; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-79538067 */ HTMLLegendElement.prototype.align; /** * @type {HTMLFormElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-29594519 */ HTMLLegendElement.prototype.form; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-86834457 */ function HTMLUListElement() {} /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-39864178 */ HTMLUListElement.prototype.compact; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-96874670 */ HTMLUListElement.prototype.type; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-58056027 */ function HTMLOListElement() {} /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-76448506 */ HTMLOListElement.prototype.compact; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-14793325 */ HTMLOListElement.prototype.start; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-40971103 */ HTMLOListElement.prototype.type; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-52368974 */ function HTMLDListElement() {} /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-21738539 */ HTMLDListElement.prototype.compact; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-71600284 */ function HTMLDirectoryElement() {} /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-75317739 */ HTMLDirectoryElement.prototype.compact; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-72509186 */ function HTMLMenuElement() {} /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-68436464 */ HTMLMenuElement.prototype.compact; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-74680021 */ function HTMLLIElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-52387668 */ HTMLLIElement.prototype.type; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-45496263 */ HTMLLIElement.prototype.value; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-22445964 */ function HTMLDivElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-70908791 */ HTMLDivElement.prototype.align; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-84675076 */ function HTMLParagraphElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-53465507 */ HTMLParagraphElement.prototype.align; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-43345119 */ function HTMLHeadingElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-6796462 */ HTMLHeadingElement.prototype.align; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-70319763 */ function HTMLQuoteElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-53895598 */ HTMLQuoteElement.prototype.cite; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-11383425 */ function HTMLPreElement() {} /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-13894083 */ HTMLPreElement.prototype.width; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-56836063 */ function HTMLBRElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-82703081 */ HTMLBRElement.prototype.clear; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-32774408 */ function HTMLBaseFontElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-87502302 */ HTMLBaseFontElement.prototype.color; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-88128969 */ HTMLBaseFontElement.prototype.face; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-38930424 */ HTMLBaseFontElement.prototype.size; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-43943847 */ function HTMLFontElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-53532975 */ HTMLFontElement.prototype.color; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-55715655 */ HTMLFontElement.prototype.face; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-90127284 */ HTMLFontElement.prototype.size; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-68228811 */ function HTMLHRElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-15235012 */ HTMLHRElement.prototype.align; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-79813978 */ HTMLHRElement.prototype.noShade; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-77612587 */ HTMLHRElement.prototype.size; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-87744198 */ HTMLHRElement.prototype.width; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-79359609 */ function HTMLModElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-75101708 */ HTMLModElement.prototype.cite; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-88432678 */ HTMLModElement.prototype.dateTime; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-48250443 */ function HTMLAnchorElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-89647724 */ HTMLAnchorElement.prototype.accessKey; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-67619266 */ HTMLAnchorElement.prototype.charset; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-92079539 */ HTMLAnchorElement.prototype.coords; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-88517319 */ HTMLAnchorElement.prototype.href; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-87358513 */ HTMLAnchorElement.prototype.hreflang; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-32783304 */ HTMLAnchorElement.prototype.name; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-3815891 */ HTMLAnchorElement.prototype.rel; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-58259771 */ HTMLAnchorElement.prototype.rev; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-49899808 */ HTMLAnchorElement.prototype.shape; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-41586466 */ HTMLAnchorElement.prototype.tabIndex; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-6414197 */ HTMLAnchorElement.prototype.target; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-63938221 */ HTMLAnchorElement.prototype.type; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-65068939 * @override */ HTMLAnchorElement.prototype.blur = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-47150313 * @override */ HTMLAnchorElement.prototype.focus = function() {}; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-17701901 */ function HTMLImageElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-3211094 */ HTMLImageElement.prototype.align; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-95636861 */ HTMLImageElement.prototype.alt; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-136671 */ HTMLImageElement.prototype.border; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-91561496 */ HTMLImageElement.prototype.height; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-53675471 */ HTMLImageElement.prototype.hspace; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-58983880 */ HTMLImageElement.prototype.isMap; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-77376969 */ HTMLImageElement.prototype.longDesc; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-91256910 */ HTMLImageElement.prototype.lowSrc; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-47534097 */ HTMLImageElement.prototype.name; /** * @type {string} * @implicitCast * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-87762984 */ HTMLImageElement.prototype.src; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-35981181 */ HTMLImageElement.prototype.useMap; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-85374897 */ HTMLImageElement.prototype.vspace; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-13839076 */ HTMLImageElement.prototype.width; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-9893177 */ function HTMLObjectElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-16962097 */ HTMLObjectElement.prototype.align; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-47783837 */ HTMLObjectElement.prototype.archive; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-82818419 */ HTMLObjectElement.prototype.border; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-75241146 */ HTMLObjectElement.prototype.code; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-25709136 */ HTMLObjectElement.prototype.codeBase; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-19945008 */ HTMLObjectElement.prototype.codeType; /** * @type {Document} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-38538621 */ HTMLObjectElement.prototype.contentDocument; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-81766986 */ HTMLObjectElement.prototype.data; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-942770 */ HTMLObjectElement.prototype.declare; /** * @type {HTMLFormElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-46094773 */ HTMLObjectElement.prototype.form; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-88925838 */ HTMLObjectElement.prototype.height; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-17085376 */ HTMLObjectElement.prototype.hspace; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-20110362 */ HTMLObjectElement.prototype.name; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-25039673 */ HTMLObjectElement.prototype.standby; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-27083787 */ HTMLObjectElement.prototype.tabIndex; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-91665621 */ HTMLObjectElement.prototype.type; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-6649772 */ HTMLObjectElement.prototype.useMap; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-8682483 */ HTMLObjectElement.prototype.vspace; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-38538620 */ HTMLObjectElement.prototype.width; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-64077273 */ function HTMLParamElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-59871447 */ HTMLParamElement.prototype.name; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-18179888 */ HTMLParamElement.prototype.type; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-77971357 */ HTMLParamElement.prototype.value; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-23931872 */ HTMLParamElement.prototype.valueType; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-31006348 */ function HTMLAppletElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-8049912 */ HTMLAppletElement.prototype.align; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-58610064 */ HTMLAppletElement.prototype.alt; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-14476360 */ HTMLAppletElement.prototype.archive; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-61509645 */ HTMLAppletElement.prototype.code; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-6581160 */ HTMLAppletElement.prototype.codeBase; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-90184867 */ HTMLAppletElement.prototype.height; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-1567197 */ HTMLAppletElement.prototype.hspace; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-39843695 */ HTMLAppletElement.prototype.name; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-93681523 */ HTMLAppletElement.prototype.object; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-22637173 */ HTMLAppletElement.prototype.vspace; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-16526327 */ HTMLAppletElement.prototype.width; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-94109203 */ function HTMLMapElement() {} /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-71838730 */ HTMLMapElement.prototype.areas; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-52696514 */ HTMLMapElement.prototype.name; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-26019118 */ function HTMLAreaElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-57944457 */ HTMLAreaElement.prototype.accessKey; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-39775416 */ HTMLAreaElement.prototype.alt; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-66021476 */ HTMLAreaElement.prototype.coords; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-34672936 */ HTMLAreaElement.prototype.href; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-61826871 */ HTMLAreaElement.prototype.noHref; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-85683271 */ HTMLAreaElement.prototype.shape; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-8722121 */ HTMLAreaElement.prototype.tabIndex; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-46054682 */ HTMLAreaElement.prototype.target; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-81598695 */ function HTMLScriptElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-35305677 */ HTMLScriptElement.prototype.charset; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-93788534 */ HTMLScriptElement.prototype.defer; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-56700403 */ HTMLScriptElement.prototype.event; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-66979266 */ HTMLScriptElement.prototype.htmlFor; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-75147231 */ HTMLScriptElement.prototype.src; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-46872999 */ HTMLScriptElement.prototype.text; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-30534818 */ HTMLScriptElement.prototype.type; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-64060425 */ function HTMLTableElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-23180977 */ HTMLTableElement.prototype.align; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-83532985 */ HTMLTableElement.prototype.bgColor; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-50969400 */ HTMLTableElement.prototype.border; /** * @type {HTMLTableCaptionElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-14594520 */ HTMLTableElement.prototype.caption; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-59162158 */ HTMLTableElement.prototype.cellPadding; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-68907883 */ HTMLTableElement.prototype.cellSpacing; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-64808476 */ HTMLTableElement.prototype.frame; /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-6156016 */ HTMLTableElement.prototype.rows; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-26347553 */ HTMLTableElement.prototype.rules; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-44998528 */ HTMLTableElement.prototype.summary; /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-63206416 */ HTMLTableElement.prototype.tBodies; /** * @type {HTMLTableSectionElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-64197097 */ HTMLTableElement.prototype.tFoot; /** * @type {HTMLTableSectionElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-9530944 */ HTMLTableElement.prototype.tHead; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-77447361 */ HTMLTableElement.prototype.width; /** * @return {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-96920263 */ HTMLTableElement.prototype.createCaption = function() {}; /** * @return {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-8453710 */ HTMLTableElement.prototype.createTFoot = function() {}; /** * @return {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-70313345 */ HTMLTableElement.prototype.createTHead = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-22930071 */ HTMLTableElement.prototype.deleteCaption = function() {}; /** * @param {number} index * @return {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-13114938 */ HTMLTableElement.prototype.deleteRow = function(index) {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-78363258 */ HTMLTableElement.prototype.deleteTFoot = function() {}; /** * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-38310198 */ HTMLTableElement.prototype.deleteTHead = function() {}; /** * @param {number} index * @return {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-39872903 */ HTMLTableElement.prototype.insertRow = function(index) {}; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-12035137 */ function HTMLTableCaptionElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-79875068 */ HTMLTableCaptionElement.prototype.align; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-84150186 */ function HTMLTableColElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-31128447 */ HTMLTableColElement.prototype.align; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-9447412 */ HTMLTableColElement.prototype.ch; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-57779225 */ HTMLTableColElement.prototype.chOff; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-96511335 */ HTMLTableColElement.prototype.span; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-83291710 */ HTMLTableColElement.prototype.vAlign; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-25196799 */ HTMLTableColElement.prototype.width; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-67417573 */ function HTMLTableSectionElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-40530119 */ HTMLTableSectionElement.prototype.align; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-83470012 */ HTMLTableSectionElement.prototype.ch; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-53459732 */ HTMLTableSectionElement.prototype.chOff; /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-52092650 */ HTMLTableSectionElement.prototype.rows; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-4379116 */ HTMLTableSectionElement.prototype.vAlign; /** * @param {number} index * @return {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-5625626 */ HTMLTableSectionElement.prototype.deleteRow = function(index) {}; /** * @param {number} index * @return {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-93995626 */ HTMLTableSectionElement.prototype.insertRow = function(index) {}; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-6986576 */ function HTMLTableRowElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-74098257 */ HTMLTableRowElement.prototype.align; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-18161327 */ HTMLTableRowElement.prototype.bgColor; /** * @type {HTMLCollection} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-67349879 */ HTMLTableRowElement.prototype.cells; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-16230502 */ HTMLTableRowElement.prototype.ch; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-68207461 */ HTMLTableRowElement.prototype.chOff; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-67347567 */ HTMLTableRowElement.prototype.rowIndex; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-79105901 */ HTMLTableRowElement.prototype.sectionRowIndex; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-90000058 */ HTMLTableRowElement.prototype.vAlign; /** * @param {number} index * @return {undefined} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-11738598 */ HTMLTableRowElement.prototype.deleteCell = function(index) {}; /** * @param {number} index * @return {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-68927016 */ HTMLTableRowElement.prototype.insertCell = function(index) {}; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-82915075 */ function HTMLTableCellElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-74444037 */ HTMLTableCellElement.prototype.abbr; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-98433879 */ HTMLTableCellElement.prototype.align; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-76554418 */ HTMLTableCellElement.prototype.axis; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-88135431 */ HTMLTableCellElement.prototype.bgColor; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-80748363 */ HTMLTableCellElement.prototype.cellIndex; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-30914780 */ HTMLTableCellElement.prototype.ch; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-20144310 */ HTMLTableCellElement.prototype.chOff; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-84645244 */ HTMLTableCellElement.prototype.colSpan; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-89104817 */ HTMLTableCellElement.prototype.headers; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-83679212 */ HTMLTableCellElement.prototype.height; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-62922045 */ HTMLTableCellElement.prototype.noWrap; /** * @type {number} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-48237625 */ HTMLTableCellElement.prototype.rowSpan; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-36139952 */ HTMLTableCellElement.prototype.scope; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-58284221 */ HTMLTableCellElement.prototype.vAlign; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-27480795 */ HTMLTableCellElement.prototype.width; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-43829095 */ function HTMLFrameSetElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-98869594 */ HTMLFrameSetElement.prototype.cols; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-19739247 */ HTMLFrameSetElement.prototype.rows; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-97790553 */ function HTMLFrameElement() {} /** * @type {Document} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-78799536 */ HTMLFrameElement.prototype.contentDocument; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-11858633 */ HTMLFrameElement.prototype.frameBorder; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-7836998 */ HTMLFrameElement.prototype.longDesc; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-55569778 */ HTMLFrameElement.prototype.marginHeight; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-8369969 */ HTMLFrameElement.prototype.marginWidth; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-91128709 */ HTMLFrameElement.prototype.name; /** * @type {boolean} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-80766578 */ HTMLFrameElement.prototype.noResize; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-45411424 */ HTMLFrameElement.prototype.scrolling; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-78799535 */ HTMLFrameElement.prototype.src; /** * @constructor * @extends {HTMLElement} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-50708718 */ function HTMLIFrameElement() {} /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-11309947 */ HTMLIFrameElement.prototype.align; /** * @type {Document} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-67133006 */ HTMLIFrameElement.prototype.contentDocument; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-22463410 */ HTMLIFrameElement.prototype.frameBorder; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-1678118 */ HTMLIFrameElement.prototype.height; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-70472105 */ HTMLIFrameElement.prototype.longDesc; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-91371294 */ HTMLIFrameElement.prototype.marginHeight; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-66486595 */ HTMLIFrameElement.prototype.marginWidth; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-96819659 */ HTMLIFrameElement.prototype.name; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-36369822 */ HTMLIFrameElement.prototype.scrolling; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-43933957 */ HTMLIFrameElement.prototype.src; /** * @type {string} * @see http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-67133005 */ HTMLIFrameElement.prototype.width; /** * @type {number} * @see http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-258A00AF */ DOMException.INVALID_STATE_ERR = 11; /** * @type {number} * @see http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-258A00AF */ DOMException.SYNTAX_ERR = 12; /** * @type {number} * @see http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-258A00AF */ DOMException.INVALID_MODIFICATION_ERR = 13; /** * @type {number} * @see http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-258A00AF */ DOMException.NAMESPACE_ERR = 14; /** * @type {number} * @see http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-258A00AF */ DOMException.INVALID_ACCESS_ERR = 15;
blackoutjack/jamweaver
src/externs/w3c_dom2.js
JavaScript
bsd-3-clause
59,368
<?php /** * This file is part of the SVN-Buddy library. * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. * * @copyright Alexander Obuhovich <aik.bold@gmail.com> * @link https://github.com/console-helpers/svn-buddy */ namespace ConsoleHelpers\SVNBuddy\Process; use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; use Symfony\Component\Process\ProcessBuilder; class ProcessFactory implements IProcessFactory { /** * Creates new Symfony process with given arguments. * * @param string $commandline The command line to run. * @param integer|null $idle_timeout Idle timeout. * * @return Process */ public function createProcess( $commandline, $idle_timeout = null ) { $process = new Process($commandline); $process->setTimeout(null); $process->setIdleTimeout($idle_timeout); return $process; } /** * Creates new Symfony PHP process with given arguments. * * @param string $command Command. * @param array $arguments Arguments. * * @return Process * @throws \RuntimeException When PHP executable can't be found. */ public function createCommandProcess($command, array $arguments = array()) { $php_executable_finder = new PhpExecutableFinder(); $php_executable = $php_executable_finder->find(); if ( !$php_executable ) { throw new \RuntimeException('The PHP executable cannot be found.'); } array_unshift($arguments, $php_executable, $_SERVER['argv'][0], $command); return ProcessBuilder::create($arguments)->getProcess(); } }
console-helpers/svn-buddy
src/SVNBuddy/Process/ProcessFactory.php
PHP
bsd-3-clause
1,632
<?php namespace elisdn\gii\fixture; use yii\web\AssetBundle; class GeneratorAsset extends AssetBundle { public $sourcePath = '@elisdn/gii/fixture/assets'; public $js = [ 'generator.js', ]; public $depends = [ 'yii\web\JqueryAsset', ]; }
ElisDN/yii2-gii-fixture-generator
src/GeneratorAsset.php
PHP
bsd-3-clause
275
/* Font Awesome the iconic font designed for use with Twitter Bootstrap ------------------------------------------------------- The full suite of pictographic icons, examples, and documentation can be found at: http://fortawesome.github.com/Font-Awesome/ License ------------------------------------------------------- The Font Awesome webfont, CSS, and LESS files are licensed under CC BY 3.0: http://creativecommons.org/licenses/by/3.0/ A mention of 'Font Awesome - http://fortawesome.github.com/Font-Awesome' in human-readable source code is considered acceptable attribution (most common on the web). If human readable source code is not available to the end user, a mention in an 'About' or 'Credits' screen is considered acceptable (most common in desktop or mobile software). Contact ------------------------------------------------------- Email: dave@davegandy.com Twitter: http://twitter.com/fortaweso_me Work: http://lemonwi.se co-founder */ @font-face { font-family: "FontAwesome"; src: url('../font/fontawesome-webfont.eot'); src: url('../font/fontawesome-webfont.eot?#iefix') format('eot'), url('../font/fontawesome-webfont.woff') format('woff'), url('../font/fontawesome-webfont.ttf') format('truetype'), url('../font/fontawesome-webfont.svg#FontAwesome') format('svg'); font-weight: normal; font-style: normal; } /* Font Awesome styles ------------------------------------------------------- */ [class^="icon-"]:before, [class*=" icon-"]:before { font-family: FontAwesome; font-weight: normal; font-style: normal; display: inline-block; text-decoration: inherit; } a [class^="icon-"], a [class*=" icon-"] { display: inline-block; text-decoration: inherit; } /* makes the font 33% larger relative to the icon container */ .icon-large:before { vertical-align: top; font-size: 1.3333333333333333em; } .btn [class^="icon-"], .btn [class*=" icon-"] { /* keeps button heights with and without icons the same */ line-height: .9em; } li [class^="icon-"], li [class*=" icon-"] { display: inline-block; width: 1.25em; text-align: center; } li .icon-large[class^="icon-"], li .icon-large[class*=" icon-"] { /* 1.5 increased font size for icon-large * 1.25 width */ width: 1.875em; } li[class^="icon-"], li[class*=" icon-"] { margin-left: 0; list-style-type: none; } li[class^="icon-"]:before, li[class*=" icon-"]:before { text-indent: -2em; text-align: center; } li[class^="icon-"].icon-large:before, li[class*=" icon-"].icon-large:before { text-indent: -1.3333333333333333em; } /* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen readers do not read off random characters that represent icons */ .icon-glass:before { content: "\f000"; } .icon-music:before { content: "\f001"; } .icon-search:before { content: "\f002"; } .icon-envelope:before { content: "\f003"; } .icon-heart:before { content: "\f004"; } .icon-star:before { content: "\f005"; } .icon-star-empty:before { content: "\f006"; } .icon-user:before { content: "\f007"; } .icon-film:before { content: "\f008"; } .icon-th-large:before { content: "\f009"; } .icon-th:before { content: "\f00a"; } .icon-th-list:before { content: "\f00b"; } .icon-ok:before { content: "\f00c"; } .icon-remove:before { content: "\f00d"; } .icon-zoom-in:before { content: "\f00e"; } .icon-zoom-out:before { content: "\f010"; } .icon-off:before { content: "\f011"; } .icon-signal:before { content: "\f012"; } .icon-cog:before { content: "\f013"; } .icon-trash:before { content: "\f014"; } .icon-home:before { content: "\f015"; } .icon-file:before { content: "\f016"; } .icon-time:before { content: "\f017"; } .icon-road:before { content: "\f018"; } .icon-download-alt:before { content: "\f019"; } .icon-download:before { content: "\f01a"; } .icon-upload:before { content: "\f01b"; } .icon-inbox:before { content: "\f01c"; } .icon-play-circle:before { content: "\f01d"; } .icon-repeat:before { content: "\f01e"; } /* \f020 doesn't work in Safari. all shifted one down */ .icon-refresh:before { content: "\f021"; } .icon-list-alt:before { content: "\f022"; } .icon-lock:before { content: "\f023"; } .icon-flag:before { content: "\f024"; } .icon-headphones:before { content: "\f025"; } .icon-volume-off:before { content: "\f026"; } .icon-volume-down:before { content: "\f027"; } .icon-volume-up:before { content: "\f028"; } .icon-qrcode:before { content: "\f029"; } .icon-barcode:before { content: "\f02a"; } .icon-tag:before { content: "\f02b"; } .icon-tags:before { content: "\f02c"; } .icon-book:before { content: "\f02d"; } .icon-bookmark:before { content: "\f02e"; } .icon-print:before { content: "\f02f"; } .icon-camera:before { content: "\f030"; } .icon-font:before { content: "\f031"; } .icon-bold:before { content: "\f032"; } .icon-italic:before { content: "\f033"; } .icon-text-height:before { content: "\f034"; } .icon-text-width:before { content: "\f035"; } .icon-align-left:before { content: "\f036"; } .icon-align-center:before { content: "\f037"; } .icon-align-right:before { content: "\f038"; } .icon-align-justify:before { content: "\f039"; } .icon-list:before { content: "\f03a"; } .icon-indent-left:before { content: "\f03b"; } .icon-indent-right:before { content: "\f03c"; } .icon-facetime-video:before { content: "\f03d"; } .icon-picture:before { content: "\f03e"; } .icon-pencil:before { content: "\f040"; } .icon-map-marker:before { content: "\f041"; } .icon-adjust:before { content: "\f042"; } .icon-tint:before { content: "\f043"; } .icon-edit:before { content: "\f044"; } .icon-share:before { content: "\f045"; } .icon-check:before { content: "\f046"; } .icon-move:before { content: "\f047"; } .icon-step-backward:before { content: "\f048"; } .icon-fast-backward:before { content: "\f049"; } .icon-backward:before { content: "\f04a"; } .icon-play:before { content: "\f04b"; } .icon-pause:before { content: "\f04c"; } .icon-stop:before { content: "\f04d"; } .icon-forward:before { content: "\f04e"; } .icon-fast-forward:before { content: "\f050"; } .icon-step-forward:before { content: "\f051"; } .icon-eject:before { content: "\f052"; } .icon-chevron-left:before { content: "\f053"; } .icon-chevron-right:before { content: "\f054"; } .icon-plus-sign:before { content: "\f055"; } .icon-minus-sign:before { content: "\f056"; } .icon-remove-sign:before { content: "\f057"; } .icon-ok-sign:before { content: "\f058"; } .icon-question-sign:before { content: "\f059"; } .icon-info-sign:before { content: "\f05a"; } .icon-screenshot:before { content: "\f05b"; } .icon-remove-circle:before { content: "\f05c"; } .icon-ok-circle:before { content: "\f05d"; } .icon-ban-circle:before { content: "\f05e"; } .icon-arrow-left:before { content: "\f060"; } .icon-arrow-right:before { content: "\f061"; } .icon-arrow-up:before { content: "\f062"; } .icon-arrow-down:before { content: "\f063"; } .icon-share-alt:before { content: "\f064"; } .icon-resize-full:before { content: "\f065"; } .icon-resize-small:before { content: "\f066"; } .icon-plus:before { content: "\f067"; } .icon-minus:before { content: "\f068"; } .icon-asterisk:before { content: "\f069"; } .icon-exclamation-sign:before { content: "\f06a"; } .icon-gift:before { content: "\f06b"; } .icon-leaf:before { content: "\f06c"; } .icon-fire:before { content: "\f06d"; } .icon-eye-open:before { content: "\f06e"; } .icon-eye-close:before { content: "\f070"; } .icon-warning-sign:before { content: "\f071"; } .icon-plane:before { content: "\f072"; } .icon-calendar:before { content: "\f073"; } .icon-random:before { content: "\f074"; } .icon-comment:before { content: "\f075"; } .icon-magnet:before { content: "\f076"; } .icon-chevron-up:before { content: "\f077"; } .icon-chevron-down:before { content: "\f078"; } .icon-retweet:before { content: "\f079"; } .icon-shopping-cart:before { content: "\f07a"; } .icon-folder-close:before { content: "\f07b"; } .icon-folder-open:before { content: "\f07c"; } .icon-resize-vertical:before { content: "\f07d"; } .icon-resize-horizontal:before { content: "\f07e"; } .icon-bar-chart:before { content: "\f080"; } .icon-twitter-sign:before { content: "\f081"; } .icon-facebook-sign:before { content: "\f082"; } .icon-camera-retro:before { content: "\f083"; } .icon-key:before { content: "\f084"; } .icon-cogs:before { content: "\f085"; } .icon-comments:before { content: "\f086"; } .icon-thumbs-up:before { content: "\f087"; } .icon-thumbs-down:before { content: "\f088"; } .icon-star-half:before { content: "\f089"; } .icon-heart-empty:before { content: "\f08a"; } .icon-signout:before { content: "\f08b"; } .icon-linkedin-sign:before { content: "\f08c"; } .icon-pushpin:before { content: "\f08d"; } .icon-external-link:before { content: "\f08e"; } .icon-signin:before { content: "\f090"; } .icon-trophy:before { content: "\f091"; } .icon-github-sign:before { content: "\f092"; } .icon-upload-alt:before { content: "\f093"; } .icon-lemon:before { content: "\f094"; } .icon-phone:before { content: "\f095"; } .icon-check-empty:before { content: "\f096"; } .icon-bookmark-empty:before { content: "\f097"; } .icon-phone-sign:before { content: "\f098"; } .icon-twitter:before { content: "\f099"; } .icon-facebook:before { content: "\f09a"; } .icon-github:before { content: "\f09b"; } .icon-unlock:before { content: "\f09c"; } .icon-credit-card:before { content: "\f09d"; } .icon-rss:before { content: "\f09e"; } .icon-hdd:before { content: "\f0a0"; } .icon-bullhorn:before { content: "\f0a1"; } .icon-bell:before { content: "\f0a2"; } .icon-certificate:before { content: "\f0a3"; } .icon-hand-right:before { content: "\f0a4"; } .icon-hand-left:before { content: "\f0a5"; } .icon-hand-up:before { content: "\f0a6"; } .icon-hand-down:before { content: "\f0a7"; } .icon-circle-arrow-left:before { content: "\f0a8"; } .icon-circle-arrow-right:before { content: "\f0a9"; } .icon-circle-arrow-up:before { content: "\f0aa"; } .icon-circle-arrow-down:before { content: "\f0ab"; } .icon-globe:before { content: "\f0ac"; } .icon-wrench:before { content: "\f0ad"; } .icon-tasks:before { content: "\f0ae"; } .icon-filter:before { content: "\f0b0"; } .icon-briefcase:before { content: "\f0b1"; } .icon-fullscreen:before { content: "\f0b2"; } .icon-group:before { content: "\f0c0"; } .icon-link:before { content: "\f0c1"; } .icon-cloud:before { content: "\f0c2"; } .icon-beaker:before { content: "\f0c3"; } .icon-cut:before { content: "\f0c4"; } .icon-copy:before { content: "\f0c5"; } .icon-paper-clip:before { content: "\f0c6"; } .icon-save:before { content: "\f0c7"; } .icon-sign-blank:before { content: "\f0c8"; } .icon-reorder:before { content: "\f0c9"; } .icon-list-ul:before { content: "\f0ca"; } .icon-list-ol:before { content: "\f0cb"; } .icon-strikethrough:before { content: "\f0cc"; } .icon-underline:before { content: "\f0cd"; } .icon-table:before { content: "\f0ce"; } .icon-magic:before { content: "\f0d0"; } .icon-truck:before { content: "\f0d1"; } .icon-pinterest:before { content: "\f0d2"; } .icon-pinterest-sign:before { content: "\f0d3"; } .icon-google-plus-sign:before { content: "\f0d4"; } .icon-google-plus:before { content: "\f0d5"; } .icon-money:before { content: "\f0d6"; } .icon-caret-down:before { content: "\f0d7"; } .icon-caret-up:before { content: "\f0d8"; } .icon-caret-left:before { content: "\f0d9"; } .icon-caret-right:before { content: "\f0da"; } .icon-columns:before { content: "\f0db"; } .icon-sort:before { content: "\f0dc"; } .icon-sort-down:before { content: "\f0dd"; } .icon-sort-up:before { content: "\f0de"; } .icon-envelope-alt:before { content: "\f0e0"; } .icon-linkedin:before { content: "\f0e1"; } .icon-undo:before { content: "\f0e2"; } .icon-legal:before { content: "\f0e3"; } .icon-dashboard:before { content: "\f0e4"; } .icon-comment-alt:before { content: "\f0e5"; } .icon-comments-alt:before { content: "\f0e6"; } .icon-bolt:before { content: "\f0e7"; } .icon-sitemap:before { content: "\f0e8"; } .icon-umbrella:before { content: "\f0e9"; } .icon-paste:before { content: "\f0ea"; } .icon-user-md:before { content: "\f200"; }
professorwaldir/zf2.front
public/template/css/font-awesome.css
CSS
bsd-3-clause
14,598
/* base64.h -- routines for converting to base64 * * This code is Copyright (c) 2017, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. */ int writeBase64aux(FILE *, FILE *, int); int writeBase64(const unsigned char *, size_t, unsigned char *); int writeBase64raw(const unsigned char *, size_t, unsigned char *); int decodeBase64(const char *, unsigned char **, size_t *, int); void hexify(const unsigned char *, size_t, char **); /* Includes trailing NUL. */ #define BASE64SIZE(x) ((((x + 2) / 3) * 4) + 1)
mcr/nmh
sbr/base64.h
C
bsd-3-clause
598
#!/usr/bin/env bash # This sets iptables rules that facilitate targeted dropping of connections for # the reconnect tests. iptables-restore <<RULES # Generated by iptables-save v1.4.21 on Fri Sep 29 15:37:54 2017 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m tcp --dport 3891 -j ACCEPT -A INPUT -p tcp -m tcp --dport 3890 --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT -A INPUT -p tcp -m tcp --dport 6360 --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -j REJECT --reject-with tcp-reset -A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT -A OUTPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset COMMIT # Completed on Fri Sep 29 15:37:54 2017 RULES
zendframework/zend-ldap
.ci/config_iptables.sh
Shell
bsd-3-clause
910
#include "compiler.h" #include "strres.h" #include "dosio.h" #include "cpucore.h" #include "pccore.h" #include "iocore.h" #include "debugsub.h" void debugwriteseg(const OEMCHAR *fname, const descriptor_t *sd, UINT32 addr, UINT32 size); void debugpageptr(UINT32 addr); #if defined(MACOS) #define CRLITERAL "\r" #define CRCONST str_cr #elif defined(X11) || defined(SLZAURUS) #define CRLITERAL "\n" #define CRCONST str_lf #else #define CRLITERAL "\r\n" #define CRCONST str_crlf #endif static const OEMCHAR s_nv[] = OEMTEXT("NV"); static const OEMCHAR s_ov[] = OEMTEXT("OV"); static const OEMCHAR s_dn[] = OEMTEXT("DN"); static const OEMCHAR s_up[] = OEMTEXT("UP"); static const OEMCHAR s_di[] = OEMTEXT("DI"); static const OEMCHAR s_ei[] = OEMTEXT("EI"); static const OEMCHAR s_pl[] = OEMTEXT("PL"); static const OEMCHAR s_ng[] = OEMTEXT("NG"); static const OEMCHAR s_nz[] = OEMTEXT("NZ"); static const OEMCHAR s_zr[] = OEMTEXT("ZR"); static const OEMCHAR s_na[] = OEMTEXT("NA"); static const OEMCHAR s_ac[] = OEMTEXT("AC"); static const OEMCHAR s_po[] = OEMTEXT("PO"); static const OEMCHAR s_pe[] = OEMTEXT("PE"); static const OEMCHAR s_nc[] = OEMTEXT("NC"); static const OEMCHAR s_cy[] = OEMTEXT("CY"); static const OEMCHAR *flagstr[16][2] = { {NULL, NULL}, // 0x8000 {NULL, NULL}, // 0x4000 {NULL, NULL}, // 0x2000 {NULL, NULL}, // 0x1000 {s_nv, s_ov}, // 0x0800 {s_dn, s_up}, // 0x0400 {s_di, s_ei}, // 0x0200 {NULL, NULL}, // 0x0100 {s_pl, s_ng}, // 0x0080 {s_nz, s_zr}, // 0x0040 {NULL, NULL}, // 0x0020 {s_na, s_ac}, // 0x0010 {NULL, NULL}, // 0x0008 {s_po, s_pe}, // 0x0004 {NULL, NULL}, // 0x0002 {s_nc, s_cy}}; // 0x0001 static const OEMCHAR file_i386reg[] = OEMTEXT("i386reg.%.3u"); static const OEMCHAR file_i386cs[] = OEMTEXT("i386_cs.%.3u"); static const OEMCHAR file_i386ds[] = OEMTEXT("i386_ds.%.3u"); static const OEMCHAR file_i386es[] = OEMTEXT("i386_es.%.3u"); static const OEMCHAR file_i386ss[] = OEMTEXT("i386_ss.%.3u"); static const OEMCHAR file_memorybin[] = OEMTEXT("memory.bin"); static const OEMCHAR str_register[] = \ OEMTEXT("EAX=%.8x EBX=%.8x ECX=%.8x EDX=%.8x") \ OEMTEXT(CRLITERAL) \ OEMTEXT("ESP=%.8x EBP=%.8x ESI=%.8x EDI=%.8x") \ OEMTEXT(CRLITERAL) \ OEMTEXT("DS=%.4x ES=%.4x SS=%.4x CS=%.4x ") \ OEMTEXT("EIP=%.8x ") \ OEMTEXT(CRLITERAL); static const OEMCHAR str_picstat[] = \ OEMTEXT("PIC0=%.2x:%.2x:%.2x") \ OEMTEXT(CRLITERAL) \ OEMTEXT("PIC1=%.2x:%.2x:%.2x") \ OEMTEXT(CRLITERAL) \ OEMTEXT("8255PORTC = %.2x / system-port = %.2x") \ OEMTEXT(CRLITERAL); const OEMCHAR *debugsub_flags(UINT16 flag) { static OEMCHAR work[128]; int i; UINT16 bit; work[0] = 0; for (i=0, bit=0x8000; bit; i++, bit>>=1) { if (flagstr[i][0]) { if (flag & bit) { milstr_ncat(work, flagstr[i][1], NELEMENTS(work)); } else { milstr_ncat(work, flagstr[i][0], NELEMENTS(work)); } if (bit != 1) { milstr_ncat(work, str_space, NELEMENTS(work)); } } } return(work); } const OEMCHAR *debugsub_regs(void) { static OEMCHAR work[256]; OEMSPRINTF(work, str_register, CPU_EAX, CPU_EBX, CPU_ECX, CPU_EDX, CPU_ESP, CPU_EBP, CPU_ESI, CPU_EDI, CPU_DS, CPU_ES, CPU_SS, CPU_CS, CPU_EIP); milstr_ncat(work, debugsub_flags(CPU_FLAG), NELEMENTS(work)); milstr_ncat(work, CRCONST, NELEMENTS(work)); return(work); } void debugwriteseg(const OEMCHAR *fname, const descriptor_t *sd, UINT32 addr, UINT32 size) { FILEH fh; UINT8 buf[0x1000]; UINT32 limit; limit = sd->u.seg.limit; if (limit <= addr) { return; } size = min(limit - addr, size - 1) + 1; fh = file_create_c(fname); if (fh == FILEH_INVALID) { return; } addr += sd->u.seg.segbase; while(size) { limit = min(size, sizeof(buf)); MEML_READS(addr, buf, limit); file_write(fh, buf, limit); addr += limit; size -= limit; } file_close(fh); } void debugsub_status(void) { static int filenum = 0; FILEH fh; OEMCHAR work[512]; const OEMCHAR *p; OEMSPRINTF(work, file_i386reg, filenum); fh = file_create_c(work); if (fh != FILEH_INVALID) { p = debugsub_regs(); file_write(fh, p, OEMSTRLEN(p) * sizeof(OEMCHAR)); OEMSPRINTF(work, str_picstat, pic.pi[0].imr, pic.pi[0].irr, pic.pi[0].isr, pic.pi[1].imr, pic.pi[1].irr, pic.pi[1].isr, mouseif.upd8255.portc, sysport.c); file_write(fh, work, OEMSTRLEN(work) * sizeof(OEMCHAR)); OEMSPRINTF(work, OEMTEXT("CS = %.8x:%.8x") OEMTEXT(CRLITERAL), CPU_STAT_SREGBASE(CPU_CS_INDEX), CPU_STAT_SREGLIMIT(CPU_CS_INDEX)); file_write(fh, work, OEMSTRLEN(work) * sizeof(OEMCHAR)); file_close(fh); } OEMSPRINTF(work, file_i386cs, filenum); debugwriteseg(work, &CPU_STAT_SREG(CPU_CS_INDEX), CPU_EIP & 0xffff0000, 0x10000); OEMSPRINTF(work, file_i386ds, filenum); debugwriteseg(work, &CPU_STAT_SREG(CPU_DS_INDEX), 0, 0x10000); OEMSPRINTF(work, file_i386es, filenum); debugwriteseg(work, &CPU_STAT_SREG(CPU_ES_INDEX), 0, 0x10000); OEMSPRINTF(work, file_i386ss, filenum); debugwriteseg(work, &CPU_STAT_SREG(CPU_SS_INDEX), CPU_ESP & 0xffff0000, 0x10000); filenum++; } void debugsub_memorydump(void) { FILEH fh; int i; fh = file_create_c(file_memorybin); if (fh != FILEH_INVALID) { for (i=0; i<34; i++) { file_write(fh, mem + i*0x8000, 0x8000); } file_close(fh); } } void debugsub_memorydumpall(void) { FILEH fh; fh = file_create_c(file_memorybin); if (fh != FILEH_INVALID) { file_write(fh, mem, 0x110000); if (CPU_EXTMEMSIZE > 0x10000) { file_write(fh, CPU_EXTMEM + 0x10000, CPU_EXTMEMSIZE - 0x10000); } file_close(fh); } } #if 0 // ‰´—pƒfƒoƒO void debugpageptr(UINT32 addr) { FILEH fh; char buf[256]; UINT32 pde; UINT32 pte; UINT i; UINT32 a; fh = file_create("page.txt"); SPRINTF(buf, "CR3=%.8x\r\n", CPU_CR3); file_write(fh, buf, strlen(buf)); for (i=0; i<1024; i++) { a = CPU_STAT_PDE_BASE + (i * 4); pde = cpu_memoryread_d(a); SPRINTF(buf, "%.8x=>%.8x [%.8x]\r\n", (i << 22), pde, a); file_write(fh, buf, strlen(buf)); } addr >>= 22; pde = cpu_memoryread_d(CPU_STAT_PDE_BASE + (addr * 4)); for (i=0; i<1024; i++) { a = (pde & CPU_PDE_BASEADDR_MASK) + (i * 4); pte = cpu_memoryread_d(a); SPRINTF(buf, "%.8x=>%.8x [%.8x]\r\n", (addr << 22) + (i << 12), pte, a); file_write(fh, buf, strlen(buf)); } file_close(fh); } #endif
histat/dc-np2
debugsub386.c
C
bsd-3-clause
6,495
/*================================================== * Exhibit Utility Functions *================================================== */ Exhibit.Util = {}; /** * Round a number n to the nearest multiple of precision (any positive value), * such as 5000, 0.1 (one decimal), 1e-12 (twelve decimals), or 1024 (if you'd * want "to the nearest kilobyte" -- so round(66000, 1024) == "65536"). You are * also guaranteed to get the precision you ask for, so round(0, 0.1) == "0.0". */ Exhibit.Util.round = function(n, precision) { precision = precision || 1; var lg = Math.floor( Math.log(precision) / Math.log(10) ); n = (Math.round(n / precision) * precision).toString(); var d = n.split("."); if (lg >= 0) { return d[0]; } lg = -lg; d[1] = (d[1]||"").substring(0, lg); while (d[1].length < lg) { d[1] += "0"; } return d.join("."); } //============================================================================= // Javascript 1.6 Array extensions // from Mozilla's compatibility implementations //============================================================================= if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt /*, from*/) { var len = this.length; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } if (!Array.prototype.filter) { Array.prototype.filter = function(fun /*, thisp*/) { var len = this.length; if (typeof fun != "function") throw new TypeError(); var res = new Array(); var thisp = arguments[1]; for (var i = 0; i < len; i++) { if (i in this) { var val = this[i]; // in case fun mutates this if (fun.call(thisp, val, i, this)) res.push(val); } } return res; }; } if (!Array.prototype.map) { Array.prototype.map = function(f, thisp) { if (typeof f != "function") throw new TypeError(); if (typeof thisp == "undefined") { thisp = this; } var res = [], length = this.length; for (var i = 0; i < length; i++) { if (this.hasOwnProperty(i)) res[i] = f.call(thisp, this[i], i, this); } return res; }; } if (!Array.prototype.forEach) { Array.prototype.forEach = function(fun /*, thisp*/) { var len = this.length; if (typeof fun != "function") throw new TypeError(); var thisp = arguments[1]; for (var i = 0; i < len; i++) { if (i in this) fun.call(thisp, this[i], i, this); } }; }
myGrid/methodbox
public/javascripts/exhibit/webapp/api/scripts/util/util.js
JavaScript
bsd-3-clause
2,813
import logging from django.http import HttpResponse from receiver.submitresponse import SubmitResponse def duplicate_attachment(way_handled, additional_params): '''Return a custom http response associated the handling of the xform. In this case, telling the sender that they submitted a duplicate ''' try: # NOTE: this possibly shouldn't be a "200" code, but it is for # now because it's not clear how JavaRosa will handle 202. # see: http://code.dimagi.com/JavaRosa/wiki/ServerResponseFormat response = SubmitResponse(status_code=200, or_status_code=2020, or_status="Duplicate Submission.", submit_id=way_handled.submission.id, **additional_params) return response.to_response() except Exception, e: logging.error("Problem in properly responding to instance data handling of %s" % way_handled)
icomms/wqmanager
apps/receiver/__init__.py
Python
bsd-3-clause
1,031
// Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef FWL_TARGETIMP_H_ #define FWL_TARGETIMP_H_ #include "core/include/fxcrt/fx_basic.h" #include "xfa/include/fwl/core/fwl_target.h" class CFWL_TargetImp { public: virtual ~CFWL_TargetImp(); virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; virtual FX_DWORD GetClassID() const; virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; virtual FWL_ERR Initialize(); virtual FWL_ERR Finalize(); protected: CFWL_TargetImp(); }; #endif // FWL_TARGETIMP_H_
andoma/pdfium
xfa/src/fwl/src/core/include/fwl_targetimp.h
C
bsd-3-clause
739
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core.exceptions import ValidationError from django.test import TestCase from models import Student, StudyGroup, Task, Lab, Subject, GroupSubject class PortalTest(TestCase): def setUp(self): self.study_group1 = StudyGroup.objects.create(name="10А") self.study_group2 = StudyGroup.objects.create(name="11Б") self.subject1 = Subject.objects.create(name="Оптика") self.subject2 = Subject.objects.create(name="Механика") self.group_subject11 = GroupSubject.objects.create( study_group=self.study_group1, subject=self.subject1 ) self.group_subject22 = GroupSubject.objects.create( study_group=self.study_group2, subject=self.subject2 ) self.student1 = Student.objects.create_user( username="ivan", email=None, password="123456", study_group=self.study_group1 ) self.student2 = Student.objects.create_user( username="pavel", email=None, password="123456", study_group=self.study_group2 ) self.lab1 = Lab.objects.create(name="Кольца ньютона", subject=self.subject1) self.lab2 = Lab.objects.create(name="Атвуд", subject=self.subject2) def test_task_create(self): has_error = False try: task = Task(student=self.student1, lab=self.lab1) task.clean() task.save() except ValidationError: has_error = True self.assertFalse(has_error) def test_task_create_double(self): """ Должна выскочить ошибка валидации - пытаемся создать 2 одинаковых задания :return: """ has_error = False try: task = Task(student=self.student1, lab=self.lab1) task.clean() task.save() task = Task(student=self.student1, lab=self.lab1) task.clean() task.save() except ValidationError: has_error = True self.assertTrue(has_error) # Проверяем что по данной учебной группе есть только одно задание subject = self.group_subject11.subject study_group = self.group_subject11.study_group task_count = Task.objects.filter( lab__subject__pk=subject.id, student__study_group__pk=study_group.id ).count() self.assertTrue(task_count, 1)
vinneyto/lab-portal
portal/test_models.py
Python
bsd-3-clause
2,587
<!DOCTYPE html><!-- @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE The complete set of authors may be found at http://polymer.github.io/AUTHORS The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS --><html><head> <meta charset="UTF-8"> <title>iron-list test</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <script src="../../webcomponentsjs/webcomponents-lite.js"></script> <script src="../../web-component-tester/browser.js"></script> <script src="../../test-fixture/test-fixture-mocha.js"></script> <link rel="import" href="../../test-fixture/test-fixture.html"> <link rel="import" href="helpers.html"> <link rel="import" href="x-list.html"> </head> <body> <test-fixture id="trivialList"> <template> <x-list></x-list> </template> </test-fixture> <script src="basic.html.0.js"></script> </body></html>
fuzzdota/chromeapp-native-messaging-sample
app/bower_components/iron-list/test/basic.html
HTML
bsd-3-clause
1,206
<!-- ------------------------------ NUEVA DE INTER CONSULTAS --------------------------------- --> {% extends 'inter_consultas/_interconsultas_base.html' %} {% load crispy_forms_tags %} {% block ic_volver %} <!-- link Volver --> <a href="{% url 'inter_consultas:list' historia.id %}"><i class="fa fa-reply"> Volver</i></a> <!-- / link Volver --> {% endblock ic_volver %} {% block ic_titulo %} {% if form.instance.id %} Editar {% else %} Nueva {% endif %} Inter Consulta {% endblock ic_titulo %} {% block ic_contenido %} <form class="form-horizontal" method="post"> {% csrf_token %} {{ form|crispy }} <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary"><i class="fa fa-check"></i> Confirmar</button> <a href="{% url 'inter_consultas:list' historia.id %}">Cancelar</a> </div> </div> </form> {% endblock ic_contenido %}
btenaglia/hpc-historias-clinicas
hpc-historias-clinicas/templates/inter_consultas/interconsultas_form.html
HTML
bsd-3-clause
1,008
package net.humandoing.jarindexer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.lang.reflect.Method; import java.sql.*; import java.util.ArrayList; /** * User: danwin * Date: Jun 22, 2005 * Time: 9:25:25 AM */ public class Database { public static final String DRIVER = "org.hsqldb.jdbcDriver"; public static final String CONNECTION_STRING = "jdbc:hsqldb:file:" + System.getProperty("user.home") + System.getProperty("file.separator") + ".JarIndexer" + System.getProperty("file.separator") + "data"; public static final String USER = "sa"; public static final String PASSWORD = ""; /** * HSQLDB error code for Table Already Exists */ public static final int TABLE_ALREADY_EXISTS = -21; /** * Our instance of ourself */ private static Database self; /** * Constructor */ private Database() { } /** * Get Instance */ public synchronized static Database getInstance() { if (self == null) { SimpleLogger.debug(CONNECTION_STRING); self = new Database(); } return self; } /** * Shutdown method */ public void shutdown() throws Exception { try { Connection conn = getConnection(); Statement stmt = conn.createStatement(); stmt.executeQuery("SHUTDOWN"); } catch (Exception e) { e.printStackTrace(); } } /** * Search for Jar entries * * @param searchText */ public ArrayList search(String searchText) throws SQLException { SimpleLogger.debug("Searching for: " + searchText); Connection conn = null; PreparedStatement stmt = null; ResultSet results = null; ArrayList out = new ArrayList(); try { conn = getConnection(); stmt = conn.prepareStatement("SELECT * FROM JAR_FILE_ENTRY WHERE ABSOLUTE_PATH LIKE ? ORDER BY ABSOLUTE_PATH ASC"); searchText = searchText + "%%"; if (searchText.startsWith("*")) { searchText = "%%" + searchText.substring(1, searchText.length()); } SimpleLogger.debug("Really Searching for: " + searchText); stmt.setString(1, searchText); results = stmt.executeQuery(); while (results.next()) { int jarFileId = results.getInt(1); String absolutePath = results.getString(2); String className = results.getString(3); JarFileEntry entry = new JarFileEntry(jarFileId, absolutePath, className); out.add(entry); } return out; } finally { close(results); close(stmt); close(conn); } } /** * Check to see if a certain directory has already been indexed. * * @param directoryName */ public boolean isAlreadyIndexed(String directoryName) throws SQLException { Connection conn = null; PreparedStatement stmt = null; ResultSet results = null; try { conn = getConnection(); stmt = conn.prepareStatement("SELECT * FROM JAR_FILE WHERE DIRECTORY LIKE ?"); stmt.setString(1, directoryName + "%%"); results = stmt.executeQuery(); if (results.next()) { return true; } else { return false; } } finally { close(results); close(stmt); close(conn); } } /** * Look up a jar file * * @param jarFileId */ public JarFile getJarFile(int jarFileId) throws SQLException { Connection conn = null; PreparedStatement stmt = null; ResultSet results = null; try { conn = getConnection(); stmt = conn.prepareStatement("SELECT * FROM JAR_FILE WHERE JAR_FILE_ID = ?"); stmt.setInt(1, jarFileId); results = stmt.executeQuery(); if (results.next()) { String fileName = results.getString(2); String absolutePath = results.getString(3); String directory = results.getString(4); String libraryName = results.getString(5); String libraryVersion = results.getString(6); return new JarFile(jarFileId, fileName, absolutePath, directory, libraryName, libraryVersion); } } finally { close(results); close(stmt); close(conn); } return null; } /** * Returns the number of jar files we have indexed */ public int getJarsIndexedCount() { Connection conn = null; ResultSet results = null; Statement stmt = null; try { conn = getConnection(); stmt = conn.createStatement(); results = stmt.executeQuery("SELECT COUNT(*) FROM JAR_FILE"); results.next(); return results.getInt(1); } catch (SQLException sqle) { sqle.printStackTrace(); return -1; } finally { close(results); close(stmt); close(conn); } } /** * Returns the number of classes we have indexed. * */ public int getClassesIndexedCount() { Connection conn = null; ResultSet results = null; Statement stmt = null; try { conn = getConnection(); stmt = conn.createStatement(); results = stmt.executeQuery("SELECT COUNT(*) FROM JAR_FILE_ENTRY"); results.next(); return results.getInt(1); } catch (SQLException sqle) { sqle.printStackTrace(); return -1; } finally { close(results); close(stmt); close(conn); } } /** * Insert a jar file row. Return the primary key of the inserted row. */ public int insertJarFileRow(String filename, String absolutePath, String directory, String libraryName, String libraryVersion) throws SQLException { //FILENAME VARCHAR(128) //ABSOLUTE_PATH VARCHAR(512) //DIRECTORY VARCHAR(512) //LIBRARY_NAME VARCHAR(128) //LIBRARY_VERSION VARCHAR(32) Connection conn = null; PreparedStatement preparedStmt = null; Statement stmt = null; ResultSet results = null; try { conn = getConnection(); preparedStmt = conn.prepareStatement("INSERT INTO JAR_FILE ( FILENAME, ABSOLUTE_PATH, DIRECTORY, LIBRARY_NAME, LIBRARY_VERSION ) VALUES (?,?,?,?,?)"); preparedStmt.setString(1, filename); preparedStmt.setString(2, absolutePath); preparedStmt.setString(3, directory); preparedStmt.setString(4, libraryName); preparedStmt.setString(5, libraryVersion); preparedStmt.executeUpdate(); stmt = conn.createStatement(); results = stmt.executeQuery("SELECT MAX(JAR_FILE_ID) FROM JAR_FILE"); results.next(); return results.getInt(1); } finally { close(results); close(preparedStmt); close(stmt); close(conn); } } /** * Insert a jar file entry row */ public void insertJarFileEntryRow(int jarFileId, String absolutePath, String className) throws SQLException { //JAR_FILE_ID INT NOT NULL //ABSOLUTE_PATH VARCHAR(512) //CLASS_NAME VARCHAR(128) Connection conn = null; PreparedStatement preparedStmt = null; Statement stmt = null; try { conn = getConnection(); preparedStmt = conn.prepareStatement("INSERT INTO JAR_FILE_ENTRY ( JAR_FILE_ID, ABSOLUTE_PATH, CLASS_NAME ) VALUES (?,?,?)"); preparedStmt.setInt(1, jarFileId); preparedStmt.setString(2, absolutePath); preparedStmt.setString(3, className); preparedStmt.executeUpdate(); } finally { close(preparedStmt); close(stmt); close(conn); } } /** * Insert a jar file entry row */ public void deleteIndexes() throws SQLException { Connection conn = null; Statement stmt = null; try { conn = getConnection(); stmt = conn.createStatement(); stmt.executeUpdate("DELETE FROM JAR_FILE_ENTRY"); stmt.executeUpdate("DELETE FROM JAR_FILE"); } finally { close(stmt); close(conn); } } /** * Initialization method * * @throws Exception */ public void init() throws Exception { System.out.println("Indexes will be saved to: " + System.getProperty("user.home") + System.getProperty("file.separator") + ".JarIndexer" + System.getProperty("file.separator") + "data"); Connection conn = null; try { conn = getConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/resources/jar_indexer.sql"))); StringBuffer sql = new StringBuffer(); String currentLine = null; while ((currentLine = reader.readLine()) != null) { sql.append(currentLine); } Statement stmt = conn.createStatement(); stmt.executeUpdate(sql.toString()); } catch (SQLException e) { if (e.getErrorCode() != TABLE_ALREADY_EXISTS) { e.printStackTrace(); } else { SimpleLogger.debug("Tables have already been created."); } } catch (Exception e) { e.printStackTrace(); } finally { close(conn); } } /** * Close a database connection, prepared statement, result set, etc. * * @param obj */ private void close(Object obj) { try { if (obj != null) { Method closeMethod = obj.getClass().getMethod("close", null); closeMethod.invoke(null, null); } } catch (Exception ignored) { } } /** * Get a databse connection */ private Connection getConnection() { try { Class.forName(DRIVER); return DriverManager.getConnection(CONNECTION_STRING, USER, PASSWORD); } catch (Exception sqle) { SimpleLogger.log("Could not get connection to database."); sqle.printStackTrace(); return null; } } }
humandoing/JarIndexer
src/net/humandoing/jarindexer/Database.java
Java
bsd-3-clause
11,146
import { fireEvent, render, screen } from "@testing-library/angular" import { Store } from "../../state/store/store" import { sortingOrderAscendingSelector } from "../../state/store/appSettings/sortingOrderAscending/sortingOrderAscending.selector" import { SortingButtonComponent } from "./sortingButton.component" import { setSortingOrderAscending } from "../../state/store/appSettings/sortingOrderAscending/sortingOrderAscending.actions" describe("SortingButtonComponent", () => { beforeEach(() => { Store["initialize"]() }) it("should toggle SortingOrderAscending on click", async () => { await render(SortingButtonComponent) const initialSortingOrder = sortingOrderAscendingSelector(Store.store.getState()) const button = screen.getByRole("button") fireEvent.click(button) expect(sortingOrderAscendingSelector(Store.store.getState())).toBe(!initialSortingOrder) }) it("should set title of button according to current sorting order", async () => { const { detectChanges } = await render(SortingButtonComponent) expect(screen.getByTitle("Toggle sort order (currently ascending)")).toBeTruthy() Store.store.dispatch(setSortingOrderAscending(false)) detectChanges() expect(screen.getByTitle("Toggle sort order (currently descending)")).toBeTruthy() }) })
MaibornWolff/codecharta
visualization/app/codeCharta/ui/sortingButton/sortingButton.component.spec.ts
TypeScript
bsd-3-clause
1,291
/*! * Copyright (c) 2016 by Contributors * \file input_split_shuffle.h * \brief base class to construct input split with global shuffling * \author Yifeng Geng */ // dmlc-core/include/dmlc/input_split_shuffle.h #ifndef BUBBLEFS_UTILS_DMLC_INPUT_SPLIT_SHUFFLE_H_ #define BUBBLEFS_UTILS_DMLC_INPUT_SPLIT_SHUFFLE_H_ #include <cstdio> #include <cstring> #include <memory> #include <vector> #include <string> #include <algorithm> #include "utils/dmlc_io.h" namespace bubblefs { namespace mydmlc { /*! \brief class to construct input split with global shuffling */ class InputSplitShuffle : public InputSplit { public: // destructor virtual ~InputSplitShuffle(void) { source_.reset(); } // implement BeforeFirst virtual void BeforeFirst(void) { if (num_shuffle_parts_ > 1) { std::shuffle(shuffle_indexes_.begin(), shuffle_indexes_.end(), trnd_); int idx = shuffle_indexes_[0] + part_index_ * num_shuffle_parts_; source_->ResetPartition(idx, num_parts_ * num_shuffle_parts_); cur_shuffle_idx_ = 0; } else { source_->BeforeFirst(); } } virtual void HintChunkSize(size_t chunk_size) { source_->HintChunkSize(chunk_size); } virtual size_t GetTotalSize(void) { return source_->GetTotalSize(); } // implement next record virtual bool NextRecord(Blob *out_rec) { if (num_shuffle_parts_ > 1) { if (!source_->NextRecord(out_rec)) { if (cur_shuffle_idx_ == num_shuffle_parts_ - 1) { return false; } ++cur_shuffle_idx_; int idx = shuffle_indexes_[cur_shuffle_idx_] + part_index_ * num_shuffle_parts_; source_->ResetPartition(idx, num_parts_ * num_shuffle_parts_); return NextRecord(out_rec); } else { return true; } } else { return source_->NextRecord(out_rec); } } // implement next chunk virtual bool NextChunk(Blob* out_chunk) { if (num_shuffle_parts_ > 1) { if (!source_->NextChunk(out_chunk)) { if (cur_shuffle_idx_ == num_shuffle_parts_ - 1) { return false; } ++cur_shuffle_idx_; int idx = shuffle_indexes_[cur_shuffle_idx_] + part_index_ * num_shuffle_parts_; source_->ResetPartition(idx, num_parts_ * num_shuffle_parts_); return NextChunk(out_chunk); } else { return true; } } else { return source_->NextChunk(out_chunk); } } // implement ResetPartition. virtual void ResetPartition(unsigned rank, unsigned nsplit) { PANIC_ENFORCE(nsplit == num_parts_, "num_parts is not consistent!"); int idx = shuffle_indexes_[0] + rank * num_shuffle_parts_; source_->ResetPartition(idx, nsplit * num_shuffle_parts_); cur_shuffle_idx_ = 0; } /*! * \brief constructor * \param uri the uri of the input, can contain hdfs prefix * \param part_index the part id of current input * \param num_parts total number of splits * \param type type of record * List of possible types: "text", "recordio" * - "text": * text file, each line is treated as a record * input split will split on '\\n' or '\\r' * - "recordio": * binary recordio file, see recordio.h * \param num_shuffle_parts number of shuffle chunks for each split * \param shuffle_seed shuffle seed for chunk shuffling */ InputSplitShuffle(const char* uri, unsigned part_index, unsigned num_parts, const char* type, unsigned num_shuffle_parts, int shuffle_seed) : part_index_(part_index), num_parts_(num_parts), num_shuffle_parts_(num_shuffle_parts), cur_shuffle_idx_(0) { for (unsigned i = 0; i < num_shuffle_parts_; i++) { shuffle_indexes_.push_back(i); } trnd_.seed(kRandMagic_ + part_index_ + num_parts_ + num_shuffle_parts_ + shuffle_seed); std::shuffle(shuffle_indexes_.begin(), shuffle_indexes_.end(), trnd_); int idx = shuffle_indexes_[cur_shuffle_idx_] + part_index_ * num_shuffle_parts_; source_.reset( InputSplit::Create(uri, idx , num_parts_ * num_shuffle_parts_, type)); } /*! * \brief factory function: * create input split with chunk shuffling given a uri * \param uri the uri of the input, can contain hdfs prefix * \param part_index the part id of current input * \param num_parts total number of splits * \param type type of record * List of possible types: "text", "recordio" * - "text": * text file, each line is treated as a record * input split will split on '\\n' or '\\r' * - "recordio": * binary recordio file, see recordio.h * \param num_shuffle_parts number of shuffle chunks for each split * \param shuffle_seed shuffle seed for chunk shuffling * \return a new input split * \sa InputSplit::Type */ static InputSplit* Create(const char* uri, unsigned part_index, unsigned num_parts, const char* type, unsigned num_shuffle_parts, int shuffle_seed) { PANIC_ENFORCE(num_shuffle_parts > 0, "number of shuffle parts should be greater than zero!"); return new InputSplitShuffle( uri, part_index, num_parts, type, num_shuffle_parts, shuffle_seed); } private: // magic nyumber for seed static const int kRandMagic_ = 666; /*! \brief random engine */ std::mt19937 trnd_; /*! \brief inner inputsplit */ std::unique_ptr<InputSplit> source_; /*! \brief part index */ unsigned part_index_; /*! \brief number of parts */ unsigned num_parts_; /*! \brief the number of block for shuffling*/ unsigned num_shuffle_parts_; /*! \brief current shuffle block index */ unsigned cur_shuffle_idx_; /*! \brief shuffled indexes */ std::vector<int> shuffle_indexes_; }; } // namespace mydmlc } // namespace bubblefs #endif // BUBBLEFS_UTILS_DMLC_INPUT_SPLIT_SHUFFLE_H_
mengjiahao/bubblefs
src/utils/dmlc_input_split_shuffle.h
C
bsd-3-clause
6,088
// Copyright 2015-present 650 Industries. All rights reserved. package host.exp.exponent.utils; import android.support.test.espresso.matcher.BoundedMatcher; import android.view.View; import org.hamcrest.Description; import org.hamcrest.Matcher; import static org.hamcrest.Matchers.is; public class ExponentMatchers { public static String getTestId(View view) { return view.getTag() instanceof String ? (String) view.getTag() : null; } public static Matcher<View> withTestId(String text) { return withTestId(is(text)); } public static Matcher<View> withTestId(final Matcher<String> stringMatcher) { return new BoundedMatcher<View, View>(View.class) { @Override public void describeTo(Description description) { description.appendText("with test id: "); stringMatcher.describeTo(description); } @Override public boolean matchesSafely(View view) { String testId = getTestId(view); if (testId == null) { return false; } else { return stringMatcher.matches(testId); } } }; } }
jolicloud/exponent
android/app/src/androidTest/java/host/exp/exponent/utils/ExponentMatchers.java
Java
bsd-3-clause
1,113
package abi39_0_0.expo.modules.medialibrary; import android.content.Context; import android.database.Cursor; import android.media.MediaScannerConnection; import android.net.Uri; import android.os.AsyncTask; import android.provider.MediaStore; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import abi39_0_0.org.unimodules.core.Promise; import static abi39_0_0.expo.modules.medialibrary.MediaLibraryConstants.ERROR_IO_EXCEPTION; import static abi39_0_0.expo.modules.medialibrary.MediaLibraryConstants.ERROR_MEDIA_LIBRARY_CORRUPTED; import static abi39_0_0.expo.modules.medialibrary.MediaLibraryConstants.ERROR_NO_ALBUM; import static abi39_0_0.expo.modules.medialibrary.MediaLibraryConstants.ERROR_UNABLE_TO_LOAD; import static abi39_0_0.expo.modules.medialibrary.MediaLibraryConstants.ERROR_UNABLE_TO_SAVE_PERMISSION; import static abi39_0_0.expo.modules.medialibrary.MediaLibraryConstants.EXTERNAL_CONTENT; import static abi39_0_0.expo.modules.medialibrary.MediaLibraryUtils.FileStrategy; import static abi39_0_0.expo.modules.medialibrary.MediaLibraryUtils.copyStrategy; import static abi39_0_0.expo.modules.medialibrary.MediaLibraryUtils.getAssetsById; import static abi39_0_0.expo.modules.medialibrary.MediaLibraryUtils.moveStrategy; class AddAssetsToAlbum extends AsyncTask<Void, Void, Void> { private final Context mContext; private final String[] mAssetsId; private final String mAlbumId; private final FileStrategy mStrategy; private final Promise mPromise; AddAssetsToAlbum(Context context, String[] assetsId, String albumId, boolean copyToAlbum, Promise promise) { mContext = context; mAssetsId = assetsId; mAlbumId = albumId; mStrategy = copyToAlbum ? copyStrategy : moveStrategy; mPromise = promise; } private File getAlbum() { final String[] path = {MediaStore.Images.Media.DATA}; final String selection = MediaStore.Images.Media.BUCKET_ID + "=?"; final String[] id = {mAlbumId}; final String limit = "1 LIMIT 1"; try (Cursor album = mContext.getContentResolver().query( EXTERNAL_CONTENT, path, selection, id, limit)) { if (album == null) { mPromise.reject(ERROR_UNABLE_TO_LOAD, "Could not get album. Query returns null."); return null; } else if (album.getCount() == 0) { mPromise.reject(ERROR_NO_ALBUM, "No album with id: " + mAlbumId); return null; } album.moveToNext(); File fileInAlbum = new File(album.getString(album.getColumnIndex(MediaStore.Images.Media.DATA))); // Media store table can be corrupted. Extra check won't harm anyone. if (!fileInAlbum.isFile()) { mPromise.reject(ERROR_MEDIA_LIBRARY_CORRUPTED, "Media library is corrupted"); return null; } return new File(fileInAlbum.getParent()); } } @Override protected Void doInBackground(Void... params) { try { File album = getAlbum(); if (album == null) { return null; } List<File> assets = getAssetsById(mContext, mPromise, mAssetsId); if (assets == null) { return null; } List<String> paths = new ArrayList<>(); for (File asset : assets) { File newAsset = mStrategy.apply(asset, album, mContext); paths.add(newAsset.getPath()); } final AtomicInteger atomicInteger = new AtomicInteger(paths.size()); MediaScannerConnection.scanFile(mContext, paths.toArray(new String[0]), null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(String path, Uri uri) { if (atomicInteger.decrementAndGet() == 0) { mPromise.resolve(true); } } }); } catch (SecurityException e) { mPromise.reject(ERROR_UNABLE_TO_SAVE_PERMISSION, "Could not get albums: need WRITE_EXTERNAL_STORAGE permission.", e); } catch (IOException e) { mPromise.reject(ERROR_IO_EXCEPTION, "Unable to read or save data", e); } return null; } }
exponent/exponent
android/versioned-abis/expoview-abi39_0_0/src/main/java/abi39_0_0/expo/modules/medialibrary/AddAssetsToAlbum.java
Java
bsd-3-clause
4,133
import Test.Hspec import Control.Comonad.Cofree.Cofreer.Spec import Control.Monad.Free.Freer.Spec import GL.Shader.Spec import UI.Layout.Spec main :: IO () main = hspec . parallel $ do describe "Control.Comonad.Cofree.Cofreer.Spec" Control.Comonad.Cofree.Cofreer.Spec.spec describe "Control.Monad.Free.Freer.Spec" Control.Monad.Free.Freer.Spec.spec describe "GL.Shader.Spec" GL.Shader.Spec.spec describe "UI.Layout.Spec" UI.Layout.Spec.spec
robrix/ui-effects
test/Spec.hs
Haskell
bsd-3-clause
450
package org.infernus.idea.checkstyle.checker; import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.api.Configuration; /** * Key for checker cache. */ class CachedChecker { /** * We cache purely to ignore repeated requests in a multi-file scan. Hence we'll treat the cached * value as valid for time in ms. */ private static final int CACHE_VALID_TIME = 60000; private Checker checker; private long timeStamp; private Configuration config; /** * Create a new checker value. * * @param checker the checker instance. * @param config the checker configuration. */ public CachedChecker(final Checker checker, final Configuration config) { if (checker == null) { throw new IllegalArgumentException( "Checker may not be null"); } this.checker = checker; this.timeStamp = System.currentTimeMillis(); this.config = config; } /** * Get the checker. * * @return the checker. */ public Checker getChecker() { this.timeStamp = System.currentTimeMillis(); return checker; } /** * Get the config. * * @return the config. */ public Configuration getConfig() { return config; } /** * Get the timestamp of the config file. * * @return the timestamp of the config file. */ public long getTimeStamp() { return timeStamp; } public boolean isValid() { return (getTimeStamp() + CACHE_VALID_TIME) >= System.currentTimeMillis(); } }
CedricGatay/Checkstyle-IDEA-no-logger-dependency
src/main/java/org/infernus/idea/checkstyle/checker/CachedChecker.java
Java
bsd-3-clause
1,642
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2007 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # * Neither the name of the pyglet nor the names of its # contributors may be used to endorse or promote products # derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # ---------------------------------------------------------------------------- '''Windowing and user-interface events. This module allows applications to create and display windows with an OpenGL context. Windows can be created with a variety of border styles or set fullscreen. You can register event handlers for keyboard, mouse and window events. For games and kiosks you can also restrict the input to your windows, for example disabling users from switching away from the application with certain key combinations or capturing and hiding the mouse. Getting started --------------- Call the Window constructor to create a new window:: from pyglet.window import Window win = Window(width=640, height=480) Attach your own event handlers:: @win.event def on_key_press(symbol, modifiers): # ... handle this event ... Within your main run loop, you must call `Window.dispatch_events` regularly. Windows are double-buffered by default, so you must call `Window.flip` to update the display:: while not win.has_exit: win.dispatch_events() # ... drawing commands ... win.flip() Creating a game window ---------------------- Use `Window.set_exclusive_mouse` to hide the mouse cursor and receive relative mouse movement events. Specify ``fullscreen=True`` as a keyword argument to the `Window` constructor to render to the entire screen rather than opening a window:: win = Window(fullscreen=True) win.set_mouse_exclusive() Working with multiple windows ----------------------------- You can open any number of windows and render to them individually. Each window must have the event handlers set on it that you are interested in (i.e., each window will have its own mouse event handler). You must call `Window.dispatch_events` for each window. Before rendering to a window, you must call `Window.switch_to` to set the active GL context. Here is an example run loop for a list of windows:: windows = # list of Window instances while windows: for win in windows: win.dispatch_events() if win.has_exit: win.close() windows = [w for w in windows if not w.has_exit] for win in windows: win.switch_to() # ... drawing commands for this window ... win.flip() Working with multiple screens ----------------------------- By default, fullscreen windows are opened on the primary display (typically set by the user in their operating system settings). You can retrieve a list of attached screens and select one manually if you prefer. This is useful for opening a fullscreen window on each screen:: display = window.get_platform().get_default_display() screens = display.get_screens() windows = [] for screen in screens: windows.append(window.Window(fullscreen=True, screen=screen)) Specifying a screen has no effect if the window is not fullscreen. Specifying the OpenGL context properties ---------------------------------------- Each window has its own context which is created when the window is created. You can specify the properties of the context before it is created by creating a "template" configuration:: from pyglet import gl # Create template config config = gl.Config() config.stencil_size = 8 config.aux_buffers = 4 # Create a window using this config win = window.Window(config=config) To determine if a given configuration is supported, query the screen (see above, "Working with multiple screens"):: configs = screen.get_matching_configs(config) if not configs: # ... config is not supported else: win = window.Window(config=configs[0]) ''' __docformat__ = 'restructuredtext' __version__ = '$Id: __init__.py 1195 2007-08-24 09:38:40Z Alex.Holkner $' import pprint import sys from pyglet import gl from pyglet.gl import gl_info from pyglet.event import EventDispatcher from pyglet.window.event import WindowExitHandler import pyglet.window.key class WindowException(Exception): '''The root exception for all window-related errors.''' pass class NoSuchDisplayException(WindowException): '''An exception indicating the requested display is not available.''' pass class NoSuchConfigException(WindowException): '''An exception indicating the requested configuration is not available.''' pass class MouseCursorException(WindowException): '''The root exception for all mouse cursor-related errors.''' pass class Platform(object): '''Operating-system-level functionality. The platform instance can only be obtained with `get_platform`. Use the platform to obtain a `Display` instance. ''' def get_display(self, name): '''Get a display device by name. This is meaningful only under X11, where the `name` is a string including the host name and display number; for example ``"localhost:1"``. On platforms other than X11, `name` is ignored and the default display is returned. pyglet does not support multiple multiple video devices on Windows or OS X. If more than one device is attached, they will appear as a single virtual device comprising all the attached screens. :Parameters: `name` : str The name of the display to connect to. :rtype: `Display` ''' return get_default_display() def get_default_display(self): '''Get the default display device. :rtype: `Display` ''' raise NotImplementedError('abstract') class Display(object): '''A display device supporting one or more screens. Use `Platform.get_display` or `Platform.get_default_display` to obtain an instance of this class. Use a display to obtain `Screen` instances. ''' def __init__(self): self._windows = [] def get_screens(self): '''Get the available screens. A typical multi-monitor workstation comprises one `Display` with multiple `Screen` s. This method returns a list of screens which can be enumerated to select one for full-screen display. For the purposes of creating an OpenGL config, the default screen will suffice. :rtype: list of `Screen` ''' raise NotImplementedError('abstract') def get_default_screen(self): '''Get the default screen as specified by the user's operating system preferences. :rtype: `Screen` ''' return self.get_screens()[0] def get_windows(self): '''Get the windows currently attached to this display. :rtype: sequence of `Window` ''' return self._windows class Screen(object): '''A virtual monitor that supports fullscreen windows. Screens typically map onto a physical display such as a monitor, television or projector. Selecting a screen for a window has no effect unless the window is made fullscreen, in which case the window will fill only that particular virtual screen. The `width` and `height` attributes of a screen give the current resolution of the screen. The `x` and `y` attributes give the global location of the top-left corner of the screen. This is useful for determining if screens arranged above or next to one another. You cannot always rely on the origin to give the placement of monitors. For example, an X server with two displays without Xinerama enabled will present two logically separate screens with no relation to each other. Use `Display.get_screens` or `Display.get_default_screen` to obtain an instance of this class. :Ivariables: `x` : int Left edge of the screen on the virtual desktop. `y` : int Top edge of the screen on the virtual desktop. `width` : int Width of the screen, in pixels. `height` : int Height of the screen, in pixels. ''' def __init__(self, x, y, width, height): self.x = x self.y = y self.width = width self.height = height def __repr__(self): return '%s(x=%d, y=%d, width=%d, height=%d)' % \ (self.__class__.__name__, self.x, self.y, self.width, self.height) def get_best_config(self, template=None): '''Get the best available GL config. Any required attributes can be specified in `template`. If no configuration matches the template, `NoSuchConfigException` will be raised. :Parameters: `template` : `pyglet.gl.Config` A configuration with desired attributes filled in. :rtype: `pyglet.gl.Config` :return: A configuration supported by the platform that best fulfils the needs described by the template. ''' if template is None: template = gl.Config() configs = self.get_matching_configs(template) if not configs: raise NoSuchConfigException() return configs[0] def get_matching_configs(self, template): '''Get a list of configs that match a specification. Any attributes specified in `template` will have values equal to or greater in each returned config. If no configs satisfy the template, an empty list is returned. :Parameters: `template` : `pyglet.gl.Config` A configuration with desired attributes filled in. :rtype: list of `pyglet.gl.Config` :return: A list of matching configs. ''' raise NotImplementedError('abstract') class MouseCursor(object): '''An abstract mouse cursor.''' #: Indicates if the cursor is drawn using OpenGL. This is True #: for all mouse cursors except system cursors. drawable = True def draw(self, x, y): '''Abstract render method. The cursor should be drawn with the "hot" spot at the given coordinates. The projection is set to the pyglet default (i.e., orthographic in window-space), however no other aspects of the state can be assumed. :Parameters: `x` : int X coordinate of the mouse pointer's hot spot. `y` : int Y coordinate of the mouse pointer's hot spot. ''' raise NotImplementedError('abstract') class DefaultMouseCursor(MouseCursor): '''The default mouse cursor used by the operating system.''' drawable = False class ImageMouseCursor(MouseCursor): '''A user-defined mouse cursor created from an image. Use this class to create your own mouse cursors and assign them to windows. There are no constraints on the image size or format. ''' drawable = True def __init__(self, image, hot_x, hot_y): '''Create a mouse cursor from an image. :Parameters: `image` : `pyglet.image.AbstractImage` Image to use for the mouse cursor. It must have a valid `texture` attribute. `hot_x` : int X coordinate of the "hot" spot in the image. `hot_y` : int Y coordinate of the "hot" spot in the image, measured from the bottom. ''' self.texture = image.texture self.hot_x = hot_x self.hot_y = hot_y def draw(self, x, y): gl.glPushAttrib(gl.GL_ENABLE_BIT) gl.glEnable(gl.GL_BLEND) gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA) self.texture.blit(x - self.hot_x, y - self.hot_y, 0) gl.glPopAttrib() class BaseWindow(EventDispatcher, WindowExitHandler): '''Platform-independent application window. A window is a "heavyweight" object occupying operating system resources. The "client" or "content" area of a window is filled entirely with an OpenGL viewport. Applications have no access to operating system widgets or controls; all rendering must be done via OpenGL. Windows may appear as floating regions or can be set to fill an entire screen (fullscreen). When floating, windows may appear borderless or decorated with a platform-specific frame (including, for example, the title bar, minimize and close buttons, resize handles, and so on). While it is possible to set the location of a window, it is recommended that applications allow the platform to place it according to local conventions. This will ensure it is not obscured by other windows, and appears on an appropriate screen for the user. To render into a window, you must first call `switch_to`, to make it the current OpenGL context. If you use only one window in the application, there is no need to do this. ''' #: The default window style. WINDOW_STYLE_DEFAULT = None #: The window style for pop-up dialogs. WINDOW_STYLE_DIALOG = 'dialog' #: The window style for tool windows. WINDOW_STYLE_TOOL = 'tool' #: A window style without any decoration. WINDOW_STYLE_BORDERLESS = 'borderless' #: The default mouse cursor. CURSOR_DEFAULT = None #: A crosshair mouse cursor. CURSOR_CROSSHAIR = 'crosshair' #: A pointing hand mouse cursor. CURSOR_HAND = 'hand' #: A "help" mouse cursor; typically a question mark and an arrow. CURSOR_HELP = 'help' #: A mouse cursor indicating that the selected operation is not permitted. CURSOR_NO = 'no' #: A mouse cursor indicating the element can be resized. CURSOR_SIZE = 'size' #: A mouse cursor indicating the element can be resized from the top #: border. CURSOR_SIZE_UP = 'size_up' #: A mouse cursor indicating the element can be resized from the #: upper-right corner. CURSOR_SIZE_UP_RIGHT = 'size_up_right' #: A mouse cursor indicating the element can be resized from the right #: border. CURSOR_SIZE_RIGHT = 'size_right' #: A mouse cursor indicating the element can be resized from the lower-right #: corner. CURSOR_SIZE_DOWN_RIGHT = 'size_down_right' #: A mouse cursor indicating the element can be resized from the bottom #: border. CURSOR_SIZE_DOWN = 'size_down' #: A mouse cursor indicating the element can be resized from the lower-left #: corner. CURSOR_SIZE_DOWN_LEFT = 'size_down_left' #: A mouse cursor indicating the element can be resized from the left #: border. CURSOR_SIZE_LEFT = 'size_left' #: A mouse cursor indicating the element can be resized from the upper-left #: corner. CURSOR_SIZE_UP_LEFT = 'size_up_left' #: A mouse cursor indicating the element can be resized vertically. CURSOR_SIZE_UP_DOWN = 'size_up_down' #: A mouse cursor indicating the element can be resized horizontally. CURSOR_SIZE_LEFT_RIGHT = 'size_left_right' #: A text input mouse cursor (I-beam). CURSOR_TEXT = 'text' #: A "wait" mouse cursor; typically an hourglass or watch. CURSOR_WAIT = 'wait' #: The "wait" mouse cursor combined with an arrow. CURSOR_WAIT_ARROW = 'wait_arrow' # Instance variables accessible only via properties _width = None _height = None _caption = None _resizable = False _style = WINDOW_STYLE_DEFAULT _fullscreen = False _visible = False _vsync = False _screen = None _config = None _context = None # Used to restore window size and position after fullscreen _windowed_size = None _windowed_location = None # Subclasses should update these after relevant events _mouse_cursor = DefaultMouseCursor() _mouse_x = 0 _mouse_y = 0 _mouse_visible = True _mouse_exclusive = False _mouse_in_window = True _event_queue = None _allow_dispatch_event = False # controlled by dispatch_events stack frame def __init__(self, width=640, height=480, caption=None, resizable=False, style=WINDOW_STYLE_DEFAULT, fullscreen=False, visible=True, vsync=True, display=None, screen=None, config=None, context=None): '''Create a window. All parameters are optional, and reasonable defaults are assumed where they are not specified. The `display`, `screen`, `config` and `context` parameters form a hierarchy of control: there is no need to specify more than one of these. For example, if you specify `screen` the `display` will be inferred, and a default `config` and `context` will be created. `config` is a special case; it can be a template created by the user specifying the attributes desired, or it can be a complete `config` as returned from `Screen.get_matching_configs` or similar. The context will be active as soon as the window is created, as if `switch_to` was just called. :Parameters: `width` : int Width of the window, in pixels. Ignored if `fullscreen` is True. Defaults to 640. `height` : int Height of the window, in pixels. Ignored if `fullscreen` is True. Defaults to 480. `caption` : str or unicode Initial caption (title) of the window. Defaults to ``sys.argv[0]``. `resizable` : bool If True, the window will be resizable. Defaults to False. `style` : int One of the ``WINDOW_STYLE_*`` constants specifying the border style of the window. `fullscreen` : bool If True, the window will cover the entire screen rather than floating. Defaults to False. `visible` : bool Determines if the window is visible immediately after creation. Defaults to True. Set this to False if you would like to change attributes of the window before having it appear to the user. `vsync` : bool If True, buffer flips are synchronised to the primary screen's vertical retrace, eliminating flicker. `display` : `Display` The display device to use. Useful only under X11. `screen` : `Screen` The screen to use, if in fullscreen. `config` : `pyglet.gl.Config` Either a template from which to create a complete config, or a complete config. `context` : `pyglet.gl.Context` The context to attach to this window. The context must not already be attached to another window. ''' EventDispatcher.__init__(self) self._event_queue = [] if not display: display = get_platform().get_default_display() if not screen: screen = display.get_default_screen() if not config: for template_config in [ gl.Config(double_buffer=True, depth_size=24), gl.Config(double_buffer=True, depth_size=16)]: try: config = screen.get_best_config(template_config) break except NoSuchConfigException: pass if not config: raise NoSuchConfigException('No standard config is available.') if not config.is_complete(): config = screen.get_best_config(config) if not context: context = config.create_context(gl.get_current_context()) if fullscreen: self._windowed_size = width, height width = screen.width height = screen.height self._width = width self._height = height self._resizable = resizable self._fullscreen = fullscreen self._style = style self._vsync = vsync # Set these in reverse order to above, to ensure we get user # preference self._context = context self._config = self._context.config self._screen = self._config.screen self._display = self._screen.display if caption is None: caption = sys.argv[0] self._caption = caption display._windows.append(self) self._create() self.switch_to() if visible: self.set_visible(True) self.activate() def _create(self): raise NotImplementedError('abstract') def _recreate(self, changes): '''Recreate the window with current attributes. :Parameters: `changes` : list of str List of attribute names that were changed since the last `_create` or `_recreate`. For example, ``['fullscreen']`` is given if the window is to be toggled to or from fullscreen. ''' raise NotImplementedError('abstract') def set_fullscreen(self, fullscreen=True, screen=None): '''Toggle to or from fullscreen. After toggling fullscreen, the GL context should have retained its state and objects, however the buffers will need to be cleared and redrawn. :Parameters: `fullscreen` : bool True if the window should be made fullscreen, False if it should be windowed. `screen` : Screen If not None and fullscreen is True, the window is moved to the given screen. The screen must belong to the same display as the window. ''' if fullscreen == self._fullscreen and screen is None: return if not self._fullscreen: # Save windowed size self._windowed_size = self.get_size() self._windowed_location = self.get_location() if fullscreen and screen is not None: assert screen.display is self.display self._screen = screen self._fullscreen = fullscreen if self._fullscreen: self._width = self.screen.width self._height = self.screen.height else: self._width, self._height = self._windowed_size self._recreate(['fullscreen']) if not self._fullscreen and self._windowed_location: # Restore windowed location -- no effect on OS X because of # deferred recreate. Move into platform _create? XXX self.set_location(*self._windowed_location) def on_resize(self, width, height): '''A default resize event handler. This default handler updates the GL viewport to cover the entire window and sets the ``GL_PROJECTION`` matrix to be orthagonal in window space. The bottom-left corner is (0, 0) and the top-right corner is the width and height of the window in pixels. Override this event handler with your own to create another projection, for example in perspective. ''' self.switch_to() gl.glViewport(0, 0, width, height) gl.glMatrixMode(gl.GL_PROJECTION) gl.glLoadIdentity() gl.glOrtho(0, width, 0, height, -1, 1) gl.glMatrixMode(gl.GL_MODELVIEW) def close(self): '''Close the window. Windows are closed automatically when the process exits, so this method need only be called when multiple windows or console input are being used. After closing the window, the GL context will be invalid. The window instance cannot be reused once closed (see also `set_visible`). ''' self._display._windows.remove(self) self._context.destroy() self._config = None self._context = None def draw_mouse_cursor(self): '''Draw the custom mouse cursor. If the current mouse cursor has ``drawable`` set, this method is called before the buffers are flipped to render it. This method always leaves the ``GL_MODELVIEW`` matrix as current, regardless of what it was set to previously. No other GL state is affected. There is little need to override this method; instead, subclass ``MouseCursor`` and provide your own ``draw`` method. ''' # Draw mouse cursor if set and visible. # XXX leaves state in modelview regardless of starting state if (self._mouse_cursor.drawable and self._mouse_visible and self._mouse_in_window): gl.glMatrixMode(gl.GL_PROJECTION) gl.glPushMatrix() gl.glLoadIdentity() gl.glOrtho(0, self.width, 0, self.height, -1, 1) gl.glMatrixMode(gl.GL_MODELVIEW) gl.glPushMatrix() gl.glLoadIdentity() self._mouse_cursor.draw(self._mouse_x, self._mouse_y) gl.glMatrixMode(gl.GL_PROJECTION) gl.glPopMatrix() gl.glMatrixMode(gl.GL_MODELVIEW) gl.glPopMatrix() # Properties provide read-only access to instance variables. Use # set_* methods to change them if applicable. caption = property(lambda self: self._caption, doc='''The window caption (title). Read-only. :type: str ''') resizable = property(lambda self: self._resizable, doc='''True if the window is resizeable. Read-only. :type: bool ''') style = property(lambda self: self._style, doc='''The window style; one of the ``WINDOW_STYLE_*`` constants. Read-only. :type: int ''') fullscreen = property(lambda self: self._fullscreen, doc='''True if the window is currently fullscreen. Read-only. :type: bool ''') visible = property(lambda self: self._visible, doc='''True if the window is currently visible. Read-only. :type: bool ''') vsync = property(lambda self: self._vsync, doc='''True if buffer flips are synchronised to the screen's vertical retrace. Read-only. :type: bool ''') display = property(lambda self: self._display, doc='''The display this window belongs to. Read-only. :type: `Display` ''') screen = property(lambda self: self._screen, doc='''The screen this window is fullscreen in. Read-only. :type: `Screen` ''') config = property(lambda self: self._config, doc='''A GL config describing the context of this window. Read-only. :type: `pyglet.gl.Config` ''') context = property(lambda self: self._context, doc='''The OpenGL context attached to this window. Read-only. :type: `pyglet.gl.Context` ''') # These are the only properties that can be set width = property(lambda self: self.get_size()[0], lambda self, width: self.set_size(width, self.height), doc='''The width of the window, in pixels. Read-write. :type: int ''') height = property(lambda self: self.get_size()[1], lambda self, height: self.set_size(self.width, height), doc='''The height of the window, in pixels. Read-write. :type: int ''') def set_caption(self, caption): '''Set the window's caption. The caption appears in the titlebar of the window, if it has one, and in the taskbar on Windows and many X11 window managers. :Parameters: `caption` : str or unicode The caption to set. ''' raise NotImplementedError('abstract') def set_minimum_size(self, width, height): '''Set the minimum size of the window. Once set, the user will not be able to resize the window smaller than the given dimensions. There is no way to remove the minimum size constraint on a window (but you could set it to 0,0). The behaviour is undefined if the minimum size is set larger than the current size of the window. The window size does not include the border or title bar. :Parameters: `width` : int Minimum width of the window, in pixels. `height` : int Minimum height of the window, in pixels. ''' raise NotImplementedError('abstract') def set_maximum_size(self, width, height): '''Set the maximum size of the window. Once set, the user will not be able to resize the window larger than the given dimensions. There is no way to remove the maximum size constraint on a window (but you could set it to a large value). The behaviour is undefined if the maximum size is set smaller than the current size of the window. The window size does not include the border or title bar. :Parameters: `width` : int Maximum width of the window, in pixels. `height` : int Maximum height of the window, in pixels. ''' raise NotImplementedError('abstract') def set_size(self, width, height): '''Resize the window. The behaviour is undefined if the window is not resizable, or if it is currently fullscreen. The window size does not include the border or title bar. :Parameters: `width` : int New width of the window, in pixels. `height` : int New height of the window, in pixels. ''' raise NotImplementedError('abstract') def get_size(self): '''Return the current size of the window. The window size does not include the border or title bar. :rtype: (int, int) :return: The width and height of the window, in pixels. ''' raise NotImplementedError('abstract') def set_location(self, x, y): '''Set the position of the window. :Parameters: `x` : int Distance of the left edge of the window from the left edge of the virtual desktop, in pixels. `y` : int Distance of the top edge of the window from the top edge of the virtual desktop, in pixels. ''' raise NotImplementedError('abstract') def get_location(self): '''Return the current position of the window. :rtype: (int, int) :return: The distances of the left and top edges from their respective edges on the virtual desktop, in pixels. ''' raise NotImplementedError('abstract') def activate(self): '''Attempt to restore keyboard focus to the window. Depending on the window manager or operating system, this may not be successful. For example, on Windows XP an application is not allowed to "steal" focus from another application. Instead, the window's taskbar icon will flash, indicating it requires attention. ''' raise NotImplementedError('abstract') def set_visible(self, visible=True): '''Show or hide the window. :Parameters: `visible` : bool If True, the window will be shown; otherwise it will be hidden. ''' raise NotImplementedError('abstract') def minimize(self): '''Minimize the window. ''' raise NotImplementedError('abstract') def maximize(self): '''Maximize the window. The behaviour of this method is somewhat dependent on the user's display setup. On a multi-monitor system, the window may maximize to either a single screen or the entire virtual desktop. ''' raise NotImplementedError('abstract') def set_vsync(self, vsync): '''Enable or disable vertical sync control. When enabled, this option ensures flips from the back to the front buffer are performed only during the vertical retrace period of the primary display. This can prevent "tearing" or flickering when the buffer is updated in the middle of a video scan. Note that LCD monitors have an analagous time in which they are not reading from the video buffer; while it does not correspond to a vertical retrace it has the same effect. With multi-monitor systems the secondary monitor cannot be synchronised to, so tearing and flicker cannot be avoided when the window is positioned outside of the primary display. In this case it may be advisable to forcibly reduce the framerate (for example, using `pyglet.clock.set_fps_limit`). :Parameters: `vsync` : bool If True, vsync is enabled, otherwise it is disabled. ''' raise NotImplementedError('abstract') def set_mouse_visible(self, visible=True): '''Show or hide the mouse cursor. The mouse cursor will only be hidden while it is positioned within this window. Mouse events will still be processed as usual. :Parameters: `visible` : bool If True, the mouse cursor will be visible, otherwise it will be hidden. ''' self._mouse_visible = visible self.set_mouse_platform_visible() def set_mouse_platform_visible(self, platform_visible=None): '''Set the platform-drawn mouse cursor visibility. This is called automatically after changing the mouse cursor or exclusive mode. Applications should not normally need to call this method, see `set_mouse_visible` instead. :Parameters: `platform_visible` : bool or None If None, sets platform visibility to the required visibility for the current exclusive mode and cursor type. Otherwise, a bool value will override and force a visibility. ''' raise NotImplementedError() def set_mouse_cursor(self, cursor=None): '''Change the appearance of the mouse cursor. The appearance of the mouse cursor is only changed while it is within this window. :Parameters: `cursor` : `MouseCursor` The cursor to set, or None to restore the default cursor. ''' if cursor is None: cursor = DefaultMouseCursor() self._mouse_cursor = cursor self.set_mouse_platform_visible() def set_exclusive_mouse(self, exclusive=True): '''Hide the mouse cursor and direct all mouse events to this window. When enabled, this feature prevents the mouse leaving the window. It is useful for certain styles of games that require complete control of the mouse. The position of the mouse as reported in subsequent events is meaningless when exclusive mouse is enabled; you should only use the relative motion parameters ``dx`` and ``dy``. :Parameters: `exclusive` : bool If True, exclusive mouse is enabled, otherwise it is disabled. ''' raise NotImplementedError('abstract') def set_exclusive_keyboard(self, exclusive=True): '''Prevent the user from switching away from this window using keyboard accelerators. When enabled, this feature disables certain operating-system specific key combinations such as Alt+Tab (Command+Tab on OS X). This can be useful in certain kiosk applications, it should be avoided in general applications or games. :Parameters: `exclusive` : bool If True, exclusive keyboard is enabled, otherwise it is disabled. ''' raise NotImplementedError('abstract') def get_system_mouse_cursor(self, name): '''Obtain a system mouse cursor. Use `set_mouse_cursor` to make the cursor returned by this method active. The names accepted by this method are the ``CURSOR_*`` constants defined on this class. :Parameters: `name` : str Name describing the mouse cursor to return. For example, ``CURSOR_WAIT``, ``CURSOR_HELP``, etc. :rtype: `MouseCursor` :return: A mouse cursor which can be used with `set_mouse_cursor`. ''' raise NotImplementedError() def set_icon(self, *images): '''Set the window icon. If multiple images are provided, one with an appropriate size will be selected (if the correct size is not provided, the image will be scaled). Useful sizes to provide are 16x16, 32x32, 64x64 (Mac only) and 128x128 (Mac only). :Parameters: `images` : sequence of `pyglet.image.AbstractImage` List of images to use for the window icon. ''' pass def clear(self): '''Clear the window. This is a convenience method for clearing the color and depth buffer. The window must be the active context (see `switch_to`). ''' gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT) def dispatch_event(self, *args): if self._allow_dispatch_event: EventDispatcher.dispatch_event(self, *args) else: self._event_queue.append(args) def dispatch_events(self): '''Process the operating system event queue and call attached event handlers. ''' raise NotImplementedError('abstract') # If documenting, show the event methods. Otherwise, leave them out # as they are not really methods. if hasattr(sys, 'is_epydoc') and sys.is_epydoc: def on_key_press(symbol, modifiers): '''A key on the keyboard was pressed (and held down). :Parameters: `symbol` : int The key symbol pressed. `modifiers` : int Bitwise combination of the key modifiers active. :event: ''' def on_key_release(symbol, modifiers): '''A key on the keyboard was released. :Parameters: `symbol` : int The key symbol pressed. `modifiers` : int Bitwise combination of the key modifiers active. :event: ''' def on_text(text): '''The user input some text. Typically this is called after `on_key_press` and before `on_key_release`, but may also be called multiple times if the key is held down (key repeating); or called without key presses if another input method was used (e.g., a pen input). You should always use this method for interpreting text, as the key symbols often have complex mappings to their unicode representation which this event takes care of. :Parameters: `text` : unicode The text entered by the user. :event: ''' def on_text_motion(motion): '''The user moved the text input cursor. Typically this is called after `on_key_press` and before `on_key_release`, but may also be called multiple times if the key is help down (key repeating). You should always use this method for moving the text input cursor (caret), as different platforms have different default keyboard mappings, and key repeats are handled correctly. The values that `motion` can take are defined in `pyglet.window.key`: * MOTION_UP * MOTION_RIGHT * MOTION_DOWN * MOTION_LEFT * MOTION_NEXT_WORD * MOTION_PREVIOUS_WORD * MOTION_BEGINNING_OF_LINE * MOTION_END_OF_LINE * MOTION_NEXT_PAGE * MOTION_PREVIOUS_PAGE * MOTION_BEGINNING_OF_FILE * MOTION_END_OF_FILE * MOTION_BACKSPACE * MOTION_DELETE :Parameters: `motion` : int The direction of motion; see remarks. :event: ''' def on_text_motion_select(motion): '''The user moved the text input cursor while extending the selection. Typically this is called after `on_key_press` and before `on_key_release`, but may also be called multiple times if the key is help down (key repeating). You should always use this method for responding to text selection events rather than the raw `on_key_press`, as different platforms have different default keyboard mappings, and key repeats are handled correctly. The values that `motion` can take are defined in `pyglet.window.key`: * MOTION_UP * MOTION_RIGHT * MOTION_DOWN * MOTION_LEFT * MOTION_NEXT_WORD * MOTION_PREVIOUS_WORD * MOTION_BEGINNING_OF_LINE * MOTION_END_OF_LINE * MOTION_NEXT_PAGE * MOTION_PREVIOUS_PAGE * MOTION_BEGINNING_OF_FILE * MOTION_END_OF_FILE :Parameters: `motion` : int The direction of selection motion; see remarks. :event: ''' def on_mouse_motion(x, y, dx, dy): '''The mouse was moved with no buttons held down. :Parameters: `x` : float Distance in pixels from the left edge of the window. `y` : float Distance in pixels from the bottom edge of the window. `dx` : float Relative X position from the previous mouse position. `dy` : float Relative Y position from the previous mouse position. :event: ''' def on_mouse_drag(x, y, dx, dy, buttons, modifiers): '''The mouse was moved with one or more mouse buttons pressed. This event will continue to be fired even if the mouse leaves the window, so long as the drag buttons are continuously held down. :Parameters: `x` : float Distance in pixels from the left edge of the window. `y` : float Distance in pixels from the bottom edge of the window. `dx` : float Relative X position from the previous mouse position. `dy` : float Relative Y position from the previous mouse position. `buttons` : int Bitwise combination of the mouse buttons currently pressed. `modifiers` : int Bitwise combination of any keyboard modifiers currently active. :event: ''' def on_mouse_press(x, y, button, modifiers): '''A mouse button was pressed (and held down). :Parameters: `x` : float Distance in pixels from the left edge of the window. `y` : float Distance in pixels from the bottom edge of the window. `button` : int The mouse button that was pressed. `modifiers` : int Bitwise combination of any keyboard modifiers currently active. :event: ''' def on_mouse_release(x, y, button, modifiers): '''A mouse button was released. :Parameters: `x` : float Distance in pixels from the left edge of the window. `y` : float Distance in pixels from the bottom edge of the window. `button` : int The mouse button that was released. `modifiers` : int Bitwise combination of any keyboard modifiers currently active. :event: ''' def on_mouse_scroll(x, y, scroll_x, scroll_y): '''The mouse wheel was scrolled. Note that most mice have only a vertical scroll wheel, so `scroll_x` is usually 0. An exception to this is the Apple Mighty Mouse, which has a mouse ball in place of the wheel which allows both `scroll_x` and `scroll_y` movement. :Parameters: `x` : float Distance in pixels from the left edge of the window. `y` : float Distance in pixels from the bottom edge of the window. `scroll_x` : int Number of "clicks" towards the right (left if negative). `scroll_y` : int Number of "clicks" upwards (downards if negative). :event: ''' def on_close(): '''The user attempted to close the window. This event can be triggered by clicking on the "X" control box in the window title bar, or by some other platform-dependent manner. :event: ''' def on_mouse_enter(x, y): '''The mouse was moved into the window. This event will not be trigged if the mouse is currently being dragged. :Parameters: `x` : float Distance in pixels from the left edge of the window. `y` : float Distance in pixels from the bottom edge of the window. :event: ''' def on_mouse_leave(x, y): '''The mouse was moved outside of the window. This event will not be trigged if the mouse is currently being dragged. Note that the coordinates of the mouse pointer will be outside of the window rectangle. :Parameters: `x` : float Distance in pixels from the left edge of the window. `y` : float Distance in pixels from the bottom edge of the window. :event: ''' def on_expose(): '''A portion of the window needs to be redrawn. This event is triggered when the window first appears, and any time the contents of the window is invalidated due to another window obscuring it. There is no way to determine which portion of the window needs redrawing. Note that the use of this method is becoming increasingly uncommon, as newer window managers composite windows automatically and keep a backing store of the window contents. :event: ''' def on_resize(width, height): '''The window was resized. :Parameters: `width` : int The new width of the window, in pixels. `height` : int The new height of the window, in pixels. :event: ''' def on_move(x, y): '''The window was moved. :Parameters: `x` : int Distance from the left edge of the screen to the left edge of the window. `y` : int Distance from the top edge of the screen to the top edge of the window. Note that this is one of few methods in pyglet which use a Y-down coordinate system. :event: ''' def on_activate(): '''The window was activated. This event can be triggered by clicking on the title bar, bringing it to the foreground; or by some platform-specific method. When a window is "active" it has the keyboard focus. :event: ''' def on_deactivate(): '''The window was deactivated. This event can be triggered by clicking on another application window. When a window is deactivated it no longer has the keyboard focus. :event: ''' def on_show(): '''The window was shown. This event is triggered when a window is restored after being minimised, or after being displayed for the first time. :event: ''' def on_hide(): '''The window was hidden. This event is triggered when a window is minimised or (on Mac OS X) hidden by the user. :event: ''' def on_context_lost(): '''The window's GL context was lost. When the context is lost no more GL methods can be called until it is recreated. This is a rare event, triggered perhaps by the user switching to an incompatible video mode. When it occurs, an application will need to reload all objects (display lists, texture objects, shaders) as well as restore the GL state. :event: ''' def on_context_state_lost(): '''The state of the window's GL context was lost. pyglet may sometimes need to recreate the window's GL context if the window is moved to another video device, or between fullscreen or windowed mode. In this case it will try to share the objects (display lists, texture objects, shaders) between the old and new contexts. If this is possible, only the current state of the GL context is lost, and the application should simply restore state. :event: ''' BaseWindow.register_event_type('on_key_press') BaseWindow.register_event_type('on_key_release') BaseWindow.register_event_type('on_text') BaseWindow.register_event_type('on_text_motion') BaseWindow.register_event_type('on_text_motion_select') BaseWindow.register_event_type('on_mouse_motion') BaseWindow.register_event_type('on_mouse_drag') BaseWindow.register_event_type('on_mouse_press') BaseWindow.register_event_type('on_mouse_release') BaseWindow.register_event_type('on_mouse_scroll') BaseWindow.register_event_type('on_mouse_enter') BaseWindow.register_event_type('on_mouse_leave') BaseWindow.register_event_type('on_close') BaseWindow.register_event_type('on_expose') BaseWindow.register_event_type('on_resize') BaseWindow.register_event_type('on_move') BaseWindow.register_event_type('on_activate') BaseWindow.register_event_type('on_deactivate') BaseWindow.register_event_type('on_show') BaseWindow.register_event_type('on_hide') BaseWindow.register_event_type('on_context_lost') BaseWindow.register_event_type('on_context_state_lost') def get_platform(): '''Get an instance of the Platform most appropriate for this system. :rtype: `Platform` :return: The platform instance. ''' return _platform if hasattr(sys, 'is_epydoc') and sys.is_epydoc: # We are building documentation Window = BaseWindow Window.__name__ = 'Window' del BaseWindow else: # Try to determine which platform to use. if sys.platform == 'darwin': from pyglet.window.carbon import CarbonPlatform, CarbonWindow _platform = CarbonPlatform() Window = CarbonWindow elif sys.platform in ('win32', 'cygwin'): from pyglet.window.win32 import Win32Platform, Win32Window _platform = Win32Platform() Window = Win32Window else: from pyglet.window.xlib import XlibPlatform, XlibWindow _platform = XlibPlatform() Window = XlibWindow
certik/sympy-oldcore
sympy/plotting/pyglet/window/__init__.py
Python
bsd-3-clause
54,133
from .working_gif import working_encoded from .splash import SplashScreen, Spinner, CheckProcessor from .multilistbox import MultiListbox from .utils import set_widget_state, set_binding, set_button_action, set_tab_order from .tooltip import ToolTip
rutherford/tikitiki
tikitiki/__init__.py
Python
bsd-3-clause
255
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """The freesurfer module provides basic functions for interfacing with freesurfer tools. Change directory to provide relative paths for doctests >>> import os >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) >>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data')) >>> os.chdir(datadir) """ __docformat__ = 'restructuredtext' import os from nipype.utils.filemanip import fname_presuffix, split_filename from nipype.interfaces.freesurfer.base import FSCommand, FSTraitedSpec from nipype.interfaces.base import (TraitedSpec, File, traits, InputMultiPath, OutputMultiPath, Directory, isdefined) class MRISPreprocInputSpec(FSTraitedSpec): out_file = File(argstr='--out %s', genfile=True, desc='output filename') target = traits.Str(argstr='--target %s', mandatory=True, desc='target subject name') hemi = traits.Enum('lh', 'rh', argstr='--hemi %s', mandatory=True, desc='hemisphere for source and target') surf_measure = traits.Str(argstr='--meas %s', xor=('surf_measure', 'surf_measure_file', 'surf_area'), desc='Use subject/surf/hemi.surf_measure as input') surf_area = traits.Str(argstr='--area %s', xor=('surf_measure', 'surf_measure_file', 'surf_area'), desc='Extract vertex area from subject/surf/hemi.surfname to use as input.') subjects = traits.List(argstr='--s %s...', xor=('subjects', 'fsgd_file', 'subject_file'), desc='subjects from who measures are calculated') fsgd_file = File(exists=True, argstr='--fsgd %s', xor=('subjects', 'fsgd_file', 'subject_file'), desc='specify subjects using fsgd file') subject_file = File(exists=True, argstr='--f %s', xor=('subjects', 'fsgd_file', 'subject_file'), desc='file specifying subjects separated by white space') surf_measure_file = InputMultiPath(File(exists=True), argstr='--is %s...', xor=('surf_measure', 'surf_measure_file', 'surf_area'), desc='file alternative to surfmeas, still requires list of subjects') source_format = traits.Str(argstr='--srcfmt %s', desc='source format') surf_dir = traits.Str(argstr='--surfdir %s', desc='alternative directory (instead of surf)') vol_measure_file = InputMultiPath(traits.Tuple(File(exists=True), File(exists=True)), argstr='--iv %s %s...', desc='list of volume measure and reg file tuples') proj_frac = traits.Float(argstr='--projfrac %s', desc='projection fraction for vol2surf') fwhm = traits.Float(argstr='--fwhm %f', xor=['num_iters'], desc='smooth by fwhm mm on the target surface') num_iters = traits.Int(argstr='--niters %d', xor=['fwhm'], desc='niters : smooth by niters on the target surface') fwhm_source = traits.Float(argstr='--fwhm-src %f', xor=['num_iters_source'], desc='smooth by fwhm mm on the source surface') num_iters_source = traits.Int(argstr='--niterssrc %d', xor=['fwhm_source'], desc='niters : smooth by niters on the source surface') smooth_cortex_only = traits.Bool(argstr='--smooth-cortex-only', desc='only smooth cortex (ie, exclude medial wall)') class MRISPreprocOutputSpec(TraitedSpec): out_file = File(exists=True, desc='preprocessed output file') class MRISPreproc(FSCommand): """Use FreeSurfer mris_preproc to prepare a group of contrasts for a second level analysis Examples -------- >>> preproc = MRISPreproc() >>> preproc.inputs.target = 'fsaverage' >>> preproc.inputs.hemi = 'lh' >>> preproc.inputs.vol_measure_file = [('cont1.nii', 'register.dat'), \ ('cont1a.nii', 'register.dat')] >>> preproc.inputs.out_file = 'concatenated_file.mgz' >>> preproc.cmdline 'mris_preproc --hemi lh --out concatenated_file.mgz --target fsaverage --iv cont1.nii register.dat --iv cont1a.nii register.dat' """ _cmd = 'mris_preproc' input_spec = MRISPreprocInputSpec output_spec = MRISPreprocOutputSpec def _list_outputs(self): outputs = self.output_spec().get() outfile = self.inputs.out_file outputs['out_file'] = outfile if not isdefined(outfile): outputs['out_file'] = os.path.join(os.getcwd(), 'concat_%s_%s.mgz' % (self.inputs.hemi, self.inputs.target)) return outputs def _gen_filename(self, name): if name == 'out_file': return self._list_outputs()[name] return None class GLMFitInputSpec(FSTraitedSpec): glm_dir = traits.Str(argstr='--glmdir %s', desc='save outputs to dir', genfile=True) in_file = File(desc='input 4D file', argstr='--y %s', mandatory=True, copyfile=False) _design_xor = ('fsgd', 'design', 'one_sample') fsgd = traits.Tuple(File(exists=True), traits.Enum('doss', 'dods'), argstr='--fsgd %s %s', xor=_design_xor, desc='freesurfer descriptor file') design = File(exists=True, argstr='--X %s', xor=_design_xor, desc='design matrix file') contrast = InputMultiPath(File(exists=True), argstr='--C %s...', desc='contrast file') one_sample = traits.Bool(argstr='--osgm', xor=('one_sample', 'fsgd', 'design', 'contrast'), desc='construct X and C as a one-sample group mean') no_contrast_sok = traits.Bool(argstr='--no-contrasts-ok', desc='do not fail if no contrasts specified') per_voxel_reg = InputMultiPath(File(exists=True), argstr='--pvr %s...', desc='per-voxel regressors') self_reg = traits.Tuple(traits.Int, traits.Int, traits.Int, argstr='--selfreg %d %d %d', desc='self-regressor from index col row slice') weighted_ls = File(exists=True, argstr='--wls %s', xor=('weight_file', 'weight_inv', 'weight_sqrt'), desc='weighted least squares') fixed_fx_var = File(exists=True, argstr='--yffxvar %s', desc='for fixed effects analysis') fixed_fx_dof = traits.Int(argstr='--ffxdof %d', xor=['fixed_fx_dof_file'], desc='dof for fixed effects analysis') fixed_fx_dof_file = File(argstr='--ffxdofdat %d', xor=['fixed_fx_dof'], desc='text file with dof for fixed effects analysis') weight_file = File(exists=True, xor=['weighted_ls'], desc='weight for each input at each voxel') weight_inv = traits.Bool(argstr='--w-inv', desc='invert weights', xor=['weighted_ls']) weight_sqrt = traits.Bool(argstr='--w-sqrt', desc='sqrt of weights', xor=['weighted_ls']) fwhm = traits.Range(low=0.0, argstr='--fwhm %f', desc='smooth input by fwhm') var_fwhm = traits.Range(low=0.0, argstr='--var-fwhm %f', desc='smooth variance by fwhm') no_mask_smooth = traits.Bool(argstr='--no-mask-smooth', desc='do not mask when smoothing') no_est_fwhm = traits.Bool(argstr='--no-est-fwhm', desc='turn off FWHM output estimation') mask_file = File(exists=True, argstr='--mask %s', desc='binary mask') label_file = File(exists=True, argstr='--label %s', xor=['cortex'], desc='use label as mask, surfaces only') cortex = traits.Bool(argstr='--cortex', xor=['label_file'], desc='use subjects ?h.cortex.label as label') invert_mask = traits.Bool(argstr='--mask-inv', desc='invert mask') prune = traits.Bool(argstr='--prune', desc='remove voxels that do not have a non-zero value at each frame (def)') no_prune = traits.Bool(argstr='--no-prune', xor=['prunethresh'], desc='do not prune') prune_thresh = traits.Float(argstr='--prune_thr %f', xor=['noprune'], desc='prune threshold. Default is FLT_MIN') compute_log_y = traits.Bool(argstr='--logy', desc='compute natural log of y prior to analysis') save_estimate = traits.Bool(argstr='--yhat-save', desc='save signal estimate (yhat)') save_residual = traits.Bool(argstr='--eres-save', desc='save residual error (eres)') save_res_corr_mtx = traits.Bool(argstr='--eres-scm', desc='save residual error spatial correlation matrix (eres.scm). Big!') surf = traits.Bool(argstr="--surf %s %s %s", requires=["subject_id", "hemi"], desc="analysis is on a surface mesh") subject_id = traits.Str(desc="subject id for surface geometry") hemi = traits.Enum("lh", "rh", desc="surface hemisphere") surf_geo = traits.Str("white", usedefault=True, desc="surface geometry name (e.g. white, pial)") simulation = traits.Tuple(traits.Enum('perm', 'mc-full', 'mc-z'), traits.Int(min=1), traits.Float, traits.Str, argstr='--sim %s %d %f %s', desc='nulltype nsim thresh csdbasename') sim_sign = traits.Enum('abs', 'pos', 'neg', argstr='--sim-sign %s', desc='abs, pos, or neg') uniform = traits.Tuple(traits.Float, traits.Float, argstr='--uniform %f %f', desc='use uniform distribution instead of gaussian') pca = traits.Bool(argstr='--pca', desc='perform pca/svd analysis on residual') calc_AR1 = traits.Bool(argstr='--tar1', desc='compute and save temporal AR1 of residual') save_cond = traits.Bool(argstr='--save-cond', desc='flag to save design matrix condition at each voxel') vox_dump = traits.Tuple(traits.Int, traits.Int, traits.Int, argstr='--voxdump %d %d %d', desc='dump voxel GLM and exit') seed = traits.Int(argstr='--seed %d', desc='used for synthesizing noise') synth = traits.Bool(argstr='--synth', desc='replace input with gaussian') resynth_test = traits.Int(argstr='--resynthtest %d', desc='test GLM by resynthsis') profile = traits.Int(argstr='--profile %d', desc='niters : test speed') force_perm = traits.Bool(argstr='--perm-force', desc='force perumtation test, even when design matrix is not orthog') diag = traits.Int('--diag %d', desc='Gdiag_no : set diagnositc level') diag_cluster = traits.Bool(argstr='--diag-cluster', desc='save sig volume and exit from first sim loop') debug = traits.Bool(argstr='--debug', desc='turn on debugging') check_opts = traits.Bool(argstr='--checkopts', desc="don't run anything, just check options and exit") allow_repeated_subjects = traits.Bool(argstr='--allowsubjrep', desc='allow subject names to repeat in the fsgd file (must appear before --fsgd') allow_ill_cond = traits.Bool(argstr='--illcond', desc='allow ill-conditioned design matrices') sim_done_file = File(argstr='--sim-done %s', desc='create file when simulation finished') class GLMFitOutputSpec(TraitedSpec): glm_dir = Directory(exists=True, desc="output directory") beta_file = File(exists=True, desc="map of regression coefficients") error_file = File(desc="map of residual error") error_var_file = File(desc="map of residual error variance") error_stddev_file = File(desc="map of residual error standard deviation") estimate_file = File(desc="map of the estimated Y values") mask_file = File(desc="map of the mask used in the analysis") fwhm_file = File(desc="text file with estimated smoothness") dof_file = File(desc="text file with effective degrees-of-freedom for the analysis") gamma_file = OutputMultiPath(desc="map of contrast of regression coefficients") gamma_var_file = OutputMultiPath(desc="map of regression contrast variance") sig_file = OutputMultiPath(desc="map of F-test significance (in -log10p)") ftest_file = OutputMultiPath(desc="map of test statistic values") spatial_eigenvectors = File(desc="map of spatial eigenvectors from residual PCA") frame_eigenvectors = File(desc="matrix of frame eigenvectors from residual PCA") singular_values = File(desc="matrix singular values from residual PCA") svd_stats_file = File(desc="text file summarizing the residual PCA") class GLMFit(FSCommand): """Use FreeSurfer's mri_glmfit to specify and estimate a general linear model. Examples -------- >>> glmfit = GLMFit() >>> glmfit.inputs.in_file = 'functional.nii' >>> glmfit.inputs.one_sample = True >>> glmfit.cmdline == 'mri_glmfit --glmdir %s --y functional.nii --osgm'%os.getcwd() True """ _cmd = 'mri_glmfit' input_spec = GLMFitInputSpec output_spec = GLMFitOutputSpec def _format_arg(self, name, spec, value): if name == "surf": _si = self.inputs return spec.argstr % (_si.subject_id, _si.hemi, _si.surf_geo) return super(GLMFit, self)._format_arg(name, spec, value) def _list_outputs(self): outputs = self.output_spec().get() # Get the top-level output directory if not isdefined(self.inputs.glm_dir): glmdir = os.getcwd() else: glmdir = os.path.abspath(self.inputs.glm_dir) outputs["glm_dir"] = glmdir # Assign the output files that always get created outputs["beta_file"] = os.path.join(glmdir, "beta.mgh") outputs["error_var_file"] = os.path.join(glmdir, "rvar.mgh") outputs["error_stddev_file"] = os.path.join(glmdir, "rstd.mgh") outputs["mask_file"] = os.path.join(glmdir, "mask.mgh") outputs["fwhm_file"] = os.path.join(glmdir, "fwhm.dat") outputs["dof_file"] = os.path.join(glmdir, "dof.dat") # Assign the conditional outputs if isdefined(self.inputs.save_residual) and self.inputs.save_residual: outputs["error_file"] = os.path.join(glmdir, "eres.mgh") if isdefined(self.inputs.save_estimate) and self.inputs.save_estimate: outputs["estimate_file"] = os.path.join(glmdir, "yhat.mgh") # Get the contrast directory name(s) if isdefined(self.inputs.contrast): contrasts = [] for c in self.inputs.contrast: if split_filename(c)[2] in [".mat", ".dat", ".mtx", ".con"]: contrasts.append(split_filename(c)[1]) else: contrasts.append(os.path.split(c)[1]) elif isdefined(self.inputs.one_sample) and self.inputs.one_sample: contrasts = ["osgm"] # Add in the contrast images outputs["sig_file"] = [os.path.join(glmdir, c, "sig.mgh") for c in contrasts] outputs["ftest_file"] = [os.path.join(glmdir, c, "F.mgh") for c in contrasts] outputs["gamma_file"] = [os.path.join(glmdir, c, "gamma.mgh") for c in contrasts] outputs["gamma_var_file"] = [os.path.join(glmdir, c, "gammavar.mgh") for c in contrasts] # Add in the PCA results, if relevant if isdefined(self.inputs.pca) and self.inputs.pca: pcadir = os.path.join(glmdir, "pca-eres") outputs["spatial_eigenvectors"] = os.path.join(pcadir, "v.mgh") outputs["frame_eigenvectors"] = os.path.join(pcadir, "u.mtx") outputs["singluar_values"] = os.path.join(pcadir, "sdiag.mat") outputs["svd_stats_file"] = os.path.join(pcadir, "stats.dat") return outputs def _gen_filename(self, name): if name == 'glm_dir': return os.getcwd() return None class OneSampleTTest(GLMFit): def __init__(self, **kwargs): super(OneSampleTTest, self).__init__(**kwargs) self.inputs.one_sample = True class BinarizeInputSpec(FSTraitedSpec): in_file = File(exists=True, argstr='--i %s', mandatory=True, copyfile=False, desc='input volume') min = traits.Float(argstr='--min %f', xor=['wm_ven_csf'], desc='min thresh') max = traits.Float(argstr='--max %f', xor=['wm_ven_csf'], desc='max thresh') rmin = traits.Float(argstr='--rmin %f', desc='compute min based on rmin*globalmean') rmax = traits.Float(argstr='--rmax %f', desc='compute max based on rmax*globalmean') match = traits.List(traits.Int, argstr='--match %d...', desc='match instead of threshold') wm = traits.Bool(argstr='--wm', desc='set match vals to 2 and 41 (aseg for cerebral WM)') ventricles = traits.Bool(argstr='--ventricles', desc='set match vals those for aseg ventricles+choroid (not 4th)') wm_ven_csf = traits.Bool(argstr='--wm+vcsf', xor=['min', 'max'], desc='WM and ventricular CSF, including choroid (not 4th)') binary_file = File(argstr='--o %s', genfile=True, desc='binary output volume') out_type = traits.Enum('nii', 'nii.gz', 'mgz', argstr='', desc='output file type') count_file = traits.Either(traits.Bool, File, argstr='--count %s', desc='save number of hits in ascii file (hits, ntotvox, pct)') bin_val = traits.Int(argstr='--binval %d', desc='set vox within thresh to val (default is 1)') bin_val_not = traits.Int(argstr='--binvalnot %d', desc='set vox outside range to val (default is 0)') invert = traits.Bool(argstr='--inv', desc='set binval=0, binvalnot=1') frame_no = traits.Int(argstr='--frame %s', desc='use 0-based frame of input (default is 0)') merge_file = File(exists=True, argstr='--merge %s', desc='merge with mergevol') mask_file = File(exists=True, argstr='--mask maskvol', desc='must be within mask') mask_thresh = traits.Float(argstr='--mask-thresh %f', desc='set thresh for mask') abs = traits.Bool(argstr='--abs', desc='take abs of invol first (ie, make unsigned)') bin_col_num = traits.Bool(argstr='--bincol', desc='set binarized voxel value to its column number') zero_edges = traits.Bool(argstr='--zero-edges', desc='zero the edge voxels') zero_slice_edge = traits.Bool(argstr='--zero-slice-edges', desc='zero the edge slice voxels') dilate = traits.Int(argstr='--dilate %d', desc='niters: dilate binarization in 3D') erode = traits.Int(argstr='--erode %d', desc='nerode: erode binarization in 3D (after any dilation)') erode2d = traits.Int(argstr='--erode2d %d', desc='nerode2d: erode binarization in 2D (after any 3D erosion)') class BinarizeOutputSpec(TraitedSpec): binary_file = File(exists=True, desc='binarized output volume') count_file = File(desc='ascii file containing number of hits') class Binarize(FSCommand): """Use FreeSurfer mri_binarize to threshold an input volume Examples -------- >>> binvol = Binarize(in_file='structural.nii', min=10, binary_file='foo_out.nii') >>> binvol.cmdline 'mri_binarize --o foo_out.nii --i structural.nii --min 10.000000' """ _cmd = 'mri_binarize' input_spec = BinarizeInputSpec output_spec = BinarizeOutputSpec def _list_outputs(self): outputs = self.output_spec().get() outfile = self.inputs.binary_file if not isdefined(outfile): if isdefined(self.inputs.out_type): outfile = fname_presuffix(self.inputs.in_file, newpath=os.getcwd(), suffix='.'.join(('_thresh', self.inputs.out_type)), use_ext=False) else: outfile = fname_presuffix(self.inputs.in_file, newpath=os.getcwd(), suffix='_thresh') outputs['binary_file'] = os.path.abspath(outfile) value = self.inputs.count_file if isdefined(value): if isinstance(value, bool): if value: outputs['count_file'] = fname_presuffix(self.inputs.in_file, suffix='_count.txt', newpath=os.getcwd(), use_ext=False) else: outputs['count_file'] = value return outputs def _format_arg(self, name, spec, value): if name == 'count_file': if isinstance(value, bool): fname = self._list_outputs()[name] else: fname = value return spec.argstr % fname if name == 'out_type': return '' return super(Binarize, self)._format_arg(name, spec, value) def _gen_filename(self, name): if name == 'binary_file': return self._list_outputs()[name] return None class ConcatenateInputSpec(FSTraitedSpec): in_files = InputMultiPath(File(exists=True), desc='Individual volumes to be concatenated', argstr='--i %s...', mandatory=True) concatenated_file = File(desc='Output volume', argstr='--o %s', genfile=True) sign = traits.Enum('abs', 'pos', 'neg', argstr='--%s', desc='Take only pos or neg voxles from input, or take abs') stats = traits.Enum('sum', 'var', 'std', 'max', 'min', 'mean', argstr='--%s', desc='Compute the sum, var, std, max, min or mean of the input volumes') paired_stats = traits.Enum('sum', 'avg', 'diff', 'diff-norm', 'diff-norm1', 'diff-norm2', argstr='--paired-%s', desc='Compute paired sum, avg, or diff') gmean = traits.Int(argstr='--gmean %d', desc='create matrix to average Ng groups, Nper=Ntot/Ng') mean_div_n = traits.Bool(argstr='--mean-div-n', desc='compute mean/nframes (good for var)') multiply_by = traits.Float(argstr='--mul %f', desc='Multiply input volume by some amount') add_val = traits.Float(argstr='--add %f', desc='Add some amount to the input volume') multiply_matrix_file = File(exists=True, argstr='--mtx %s', desc='Multiply input by an ascii matrix in file') combine = traits.Bool(argstr='--combine', desc='Combine non-zero values into single frame volume') keep_dtype = traits.Bool(argstr='--keep-datatype', desc='Keep voxelwise precision type (default is float') max_bonfcor = traits.Bool(argstr='--max-bonfcor', desc='Compute max and bonferroni correct (assumes -log10(ps))') max_index = traits.Bool(argstr='--max-index', desc='Compute the index of max voxel in concatenated volumes') mask_file = File(exists=True, argstr='--mask %s', desc='Mask input with a volume') vote = traits.Bool(argstr='--vote', desc='Most frequent value at each voxel and fraction of occurances') sort = traits.Bool(argstr='--sort', desc='Sort each voxel by ascending frame value') class ConcatenateOutputSpec(TraitedSpec): concatenated_file = File(exists=True, desc='Path/name of the output volume') class Concatenate(FSCommand): """Use Freesurfer mri_concat to combine several input volumes into one output volume. Can concatenate by frames, or compute a variety of statistics on the input volumes. Examples -------- Combine two input volumes into one volume with two frames >>> concat = Concatenate() >>> concat.inputs.in_files = ['cont1.nii', 'cont2.nii'] >>> concat.inputs.concatenated_file = 'bar.nii' >>> concat.cmdline 'mri_concat --o bar.nii --i cont1.nii --i cont2.nii' """ _cmd = 'mri_concat' input_spec = ConcatenateInputSpec output_spec = ConcatenateOutputSpec def _list_outputs(self): outputs = self.output_spec().get() if not isdefined(self.inputs.concatenated_file): outputs['concatenated_file'] = os.path.join(os.getcwd(), 'concat_output.nii.gz') else: outputs['concatenated_file'] = self.inputs.concatenated_file return outputs def _gen_filename(self, name): if name == 'concatenated_file': return self._list_outputs()[name] return None class SegStatsInputSpec(FSTraitedSpec): _xor_inputs = ('segmentation_file', 'annot', 'surf_label') segmentation_file = File(exists=True, argstr='--seg %s', xor=_xor_inputs, mandatory=True, desc='segmentation volume path') annot = traits.Tuple(traits.Str, traits.Enum('lh', 'rh'), traits.Str, argstr='--annot %s %s %s', xor=_xor_inputs, mandatory=True, desc='subject hemi parc : use surface parcellation') surf_label = traits.Tuple(traits.Str, traits.Enum('lh', 'rh'), traits.Str, argstr='--slabel %s %s %s', xor=_xor_inputs, mandatory=True, desc='subject hemi label : use surface label') summary_file = File(argstr='--sum %s', genfile=True, desc='Segmentation stats summary table file') partial_volume_file = File(exists=True, argstr='--pv %f', desc='Compensate for partial voluming') in_file = File(exists=True, argstr='--i %s', desc='Use the segmentation to report stats on this volume') frame = traits.Int(argstr='--frame %d', desc='Report stats on nth frame of input volume') multiply = traits.Float(argstr='--mul %f', desc='multiply input by val') calc_snr = traits.Bool(argstr='--snr', desc='save mean/std as extra column in output table') calc_power = traits.Enum('sqr', 'sqrt', argstr='--%s', desc='Compute either the sqr or the sqrt of the input') _ctab_inputs = ('color_table_file', 'default_color_table', 'gca_color_table') color_table_file = File(exists=True, argstr='--ctab %s', xor=_ctab_inputs, desc='color table file with seg id names') default_color_table = traits.Bool(argstr='--ctab-default', xor=_ctab_inputs, desc='use $FREESURFER_HOME/FreeSurferColorLUT.txt') gca_color_table = File(exists=True, argstr='--ctab-gca %s', xor=_ctab_inputs, desc='get color table from GCA (CMA)') segment_id = traits.List(argstr='--id %s...', desc='Manually specify segmentation ids') exclude_id = traits.Int(argstr='--excludeid %d', desc='Exclude seg id from report') exclude_ctx_gm_wm = traits.Bool(argstr='--excl-ctxgmwm', desc='exclude cortical gray and white matter') wm_vol_from_surf = traits.Bool(argstr='--surf-wm-vol', desc='Compute wm volume from surf') cortex_vol_from_surf = traits.Bool(argstr='--surf-ctx-vol', desc='Compute cortex volume from surf') non_empty_only = traits.Bool(argstr='--nonempty', desc='Only report nonempty segmentations') mask_file = File(exists=True, argstr='--mask %s', desc='Mask volume (same size as seg') mask_thresh = traits.Float(argstr='--maskthresh %f', desc='binarize mask with this threshold <0.5>') mask_sign = traits.Enum('abs', 'pos', 'neg', '--masksign %s', desc='Sign for mask threshold: pos, neg, or abs') mask_frame = traits.Int('--maskframe %d', requires=['mask_file'], desc='Mask with this (0 based) frame of the mask volume') mask_invert = traits.Bool(argstr='--maskinvert', desc='Invert binarized mask volume') mask_erode = traits.Int(argstr='--maskerode %d', desc='Erode mask by some amount') brain_vol = traits.Enum('brain-vol-from-seg', 'brainmask', '--%s', desc='Compute brain volume either with ``brainmask`` or ``brain-vol-from-seg``') etiv = traits.Bool(argstr='--etiv', desc='Compute ICV from talairach transform') etiv_only = traits.Enum('etiv', 'old-etiv', '--%s-only', desc='Compute etiv and exit. Use ``etiv`` or ``old-etiv``') avgwf_txt_file = traits.Either(traits.Bool, File, argstr='--avgwf %s', desc='Save average waveform into file (bool or filename)') avgwf_file = traits.Either(traits.Bool, File, argstr='--avgwfvol %s', desc='Save as binary volume (bool or filename)') sf_avg_file = traits.Either(traits.Bool, File, argstr='--sfavg %s', desc='Save mean across space and time') vox = traits.List(traits.Int, argstr='--vox %s', desc='Replace seg with all 0s except at C R S (three int inputs)') class SegStatsOutputSpec(TraitedSpec): summary_file = File(exists=True, desc='Segmentation summary statistics table') avgwf_txt_file = File(desc='Text file with functional statistics averaged over segs') avgwf_file = File(desc='Volume with functional statistics averaged over segs') sf_avg_file = File(desc='Text file with func statistics averaged over segs and framss') class SegStats(FSCommand): """Use FreeSurfer mri_segstats for ROI analysis Examples -------- >>> import nipype.interfaces.freesurfer as fs >>> ss = fs.SegStats() >>> ss.inputs.annot = ('PWS04', 'lh', 'aparc') >>> ss.inputs.in_file = 'functional.nii' >>> ss.inputs.subjects_dir = '.' >>> ss.inputs.avgwf_txt_file = './avgwf.txt' >>> ss.inputs.summary_file = './summary.stats' >>> ss.cmdline 'mri_segstats --annot PWS04 lh aparc --avgwf ./avgwf.txt --i functional.nii --sum ./summary.stats' """ _cmd = 'mri_segstats' input_spec = SegStatsInputSpec output_spec = SegStatsOutputSpec def _list_outputs(self): outputs = self.output_spec().get() outputs['summary_file'] = os.path.abspath(self.inputs.summary_file) if not isdefined(outputs['summary_file']): outputs['summary_file'] = os.path.join(os.getcwd(), 'summary.stats') suffices = dict(avgwf_txt_file='_avgwf.txt', avgwf_file='_avgwf.nii.gz', sf_avg_file='sfavg.txt') if isdefined(self.inputs.segmentation_file): _, src = os.path.split(self.inputs.segmentation_file) if isdefined(self.inputs.annot): src = '_'.join(self.inputs.annot) if isdefined(self.inputs.surf_label): src = '_'.join(self.inputs.surf_label) for name, suffix in suffices.items(): value = getattr(self.inputs, name) if isdefined(value): if isinstance(value, bool): outputs[name] = fname_presuffix(src, suffix=suffix, newpath=os.getcwd(), use_ext=False) else: outputs[name] = os.path.abspath(value) return outputs def _format_arg(self, name, spec, value): if name in ['avgwf_txt_file', 'avgwf_file', 'sf_avg_file']: if isinstance(value, bool): fname = self._list_outputs()[name] else: fname = value return spec.argstr % fname return super(SegStats, self)._format_arg(name, spec, value) def _gen_filename(self, name): if name == 'summary_file': return self._list_outputs()[name] return None class Label2VolInputSpec(FSTraitedSpec): label_file = InputMultiPath(File(exists=True), argstr='--label %s...', xor=('label_file', 'annot_file', 'seg_file', 'aparc_aseg'), copyfile=False, mandatory=True, desc='list of label files') annot_file = File(exists=True, argstr='--annot %s', xor=('label_file', 'annot_file', 'seg_file', 'aparc_aseg'), requires=('subject_id', 'hemi'), mandatory=True, copyfile=False, desc='surface annotation file') seg_file = File(exists=True, argstr='--seg %s', xor=('label_file', 'annot_file', 'seg_file', 'aparc_aseg'), mandatory=True, copyfile=False, desc='segmentation file') aparc_aseg = traits.Bool(argstr='--aparc+aseg', xor=('label_file', 'annot_file', 'seg_file', 'aparc_aseg'), mandatory=True, desc='use aparc+aseg.mgz in subjectdir as seg') template_file = File(exists=True, argstr='--temp %s', mandatory=True, desc='output template volume') reg_file = File(exists=True, argstr='--reg %s', xor=('reg_file', 'reg_header', 'identity'), desc='tkregister style matrix VolXYZ = R*LabelXYZ') reg_header = File(exists=True, argstr='--regheader %s', xor=('reg_file', 'reg_header', 'identity'), desc='label template volume') identity = traits.Bool(argstr='--identity', xor=('reg_file', 'reg_header', 'identity'), desc='set R=I') invert_mtx = traits.Bool(argstr='--invertmtx', desc='Invert the registration matrix') fill_thresh = traits.Range(0., 1., argstr='--fillthresh %.f', desc='thresh : between 0 and 1') label_voxel_volume = traits.Float(argstr='--labvoxvol %f', desc='volume of each label point (def 1mm3)') proj = traits.Tuple(traits.Enum('abs', 'frac'), traits.Float, traits.Float, traits.Float, argstr='--proj %s %f %f %f', requires=('subject_id', 'hemi'), desc='project along surface normal') subject_id = traits.Str(argstr='--subject %s', desc='subject id') hemi = traits.Enum('lh', 'rh', argstr='--hemi %s', desc='hemisphere to use lh or rh') surface = traits.Str(argstr='--surf %s', desc='use surface instead of white') vol_label_file = File(argstr='--o %s', genfile=True, desc='output volume') label_hit_file = File(argstr='--hits %s', desc='file with each frame is nhits for a label') map_label_stat = File(argstr='--label-stat %s', desc='map the label stats field into the vol') native_vox2ras = traits.Bool(argstr='--native-vox2ras', desc='use native vox2ras xform instead of tkregister-style') class Label2VolOutputSpec(TraitedSpec): vol_label_file = File(exists=True, desc='output volume') class Label2Vol(FSCommand): """Make a binary volume from a Freesurfer label Examples -------- >>> binvol = Label2Vol(label_file='cortex.label', template_file='structural.nii', reg_file='register.dat', fill_thresh=0.5, vol_label_file='foo_out.nii') >>> binvol.cmdline 'mri_label2vol --fillthresh 0 --label cortex.label --reg register.dat --temp structural.nii --o foo_out.nii' """ _cmd = 'mri_label2vol' input_spec = Label2VolInputSpec output_spec = Label2VolOutputSpec def _list_outputs(self): outputs = self.output_spec().get() outfile = self.inputs.vol_label_file if not isdefined(outfile): for key in ['label_file', 'annot_file', 'seg_file']: if isdefined(getattr(self.inputs,key)): path = getattr(self.inputs, key) if isinstance(path,list): path = path[0] _, src = os.path.split(path) if isdefined(self.inputs.aparc_aseg): src = 'aparc+aseg.mgz' outfile = fname_presuffix(src, suffix='_vol.nii.gz', newpath=os.getcwd(), use_ext=False) outputs['vol_label_file'] = outfile return outputs def _gen_filename(self, name): if name == 'vol_label_file': return self._list_outputs()[name] return None class MS_LDAInputSpec(FSTraitedSpec): lda_labels = traits.List(traits.Int(), argstr='-lda %s', mandatory=True, minlen=2, maxlen=2, sep=' ', desc='pair of class labels to optimize') weight_file = traits.File(argstr='-weight %s', mandatory=True, desc='filename for the LDA weights (input or output)') vol_synth_file = traits.File(exists=False, argstr='-synth %s', mandatory=True, desc=('filename for the synthesized output ' 'volume')) label_file = traits.File(exists=True, argstr='-label %s', desc='filename of the label volume') mask_file = traits.File(exists=True, argstr='-mask %s', desc='filename of the brain mask volume') shift = traits.Int(argstr='-shift %d', desc='shift all values equal to the given value to zero') conform = traits.Bool(argstr='-conform', desc=('Conform the input volumes (brain mask ' 'typically already conformed)')) use_weights = traits.Bool(argstr='-W', desc=('Use the weights from a previously ' 'generated weight file')) images = InputMultiPath(File(exists=True), argstr='%s', mandatory=True, copyfile=False, desc='list of input FLASH images', position=-1) class MS_LDAOutputSpec(TraitedSpec): weight_file = File(exists=True, desc='') vol_synth_file = File(exists=True, desc='') class MS_LDA(FSCommand): """Perform LDA reduction on the intensity space of an arbitrary # of FLASH images Examples -------- >>> grey_label = 2 >>> white_label = 3 >>> zero_value = 1 >>> optimalWeights = MS_LDA(lda_labels=[grey_label, white_label], \ label_file='label.mgz', weight_file='weights.txt', \ shift=zero_value, vol_synth_file='synth_out.mgz', \ conform=True, use_weights=True, \ images=['FLASH1.mgz', 'FLASH2.mgz', 'FLASH3.mgz']) >>> optimalWeights.cmdline 'mri_ms_LDA -conform -label label.mgz -lda 2 3 -shift 1 -W -synth synth_out.mgz -weight weights.txt FLASH1.mgz FLASH2.mgz FLASH3.mgz' """ _cmd = 'mri_ms_LDA' input_spec = MS_LDAInputSpec output_spec = MS_LDAOutputSpec def _list_outputs(self): outputs = self._outputs().get() if isdefined(self.inputs.output_synth): outputs['vol_synth_file'] = os.path.abspath(self.inputs.output_synth) else: outputs['vol_synth_file'] = os.path.abspath(self.inputs.vol_synth_file) if not isdefined(self.inputs.use_weights) or self.inputs.use_weights is False: outputs['weight_file'] = os.path.abspath(self.inputs.weight_file) return outputs def _verify_weights_file_exists(self): if not os.path.exists(os.path.abspath(self.inputs.weight_file)): raise traits.TraitError("MS_LDA: use_weights must accompany an existing weights file") def _format_arg(self, name, spec, value): if name is 'use_weights': if self.inputs.use_weights is True: self._verify_weights_file_exists() else: return '' # TODO: Fix bug when boolean values are set explicitly to false return super(MS_LDA, self)._format_arg(name, spec, value) def _gen_filename(self, name): pass
fprados/nipype
nipype/interfaces/freesurfer/model.py
Python
bsd-3-clause
41,958
--- status: publish tags: - fredericiana - image - meme - search - web - websights published: true title: Image Search Meme type: post meta: _edit_last: "2" layout: post --- This is a <a href="http://marshmallowfreya.blogspot.com/2008/08/image-search-meme.html">meme</a> I borrowed from <a href="http://marshmallowfreya.blogspot.com/">Freya</a>. It's a Google image search meme. Search for your answer for each one, and pick your favorite from the first 3 pages. Feel free to pick it up if you like, and don't forget to trackback! While Freya got a bunch of "naked chicks" in her search results (and neglected to include them, much to the dismay of her male readership), I got a bunch of muscular models that share my first name--who I conveniently chose not to display here either (sorry female readership :) ). Here we go: Your first name: <a href="http://commons.wikimedia.org/wiki/Image:Stamp_Fr%C3%A9d%C3%A9ric_Joliot-Curie.jpg"><img src="/media/wp/2008/08/stamp_frederic_joliot-curie.jpg" alt="" title="Frédéric Joliot-Curie" width="500" height="312" class="alignnone size-full wp-image-1478" /></a> <!--more--> Your middle name: <div style="width:500px;height:40px;background:white;border:1px solid black;">&nbsp;</div> Your last name: <a href="http://www.billwenzel.pinupcartoongallery.com/"><img src="/media/wp/2008/08/bill-wenzel-art.jpg" alt="" title="Bill Wenzel Art" width="382" height="198" class="alignnone size-full wp-image-1481" /></a> Your age: <a href="http://www.fox.com/24/profiles/"><img src="/media/wp/2008/08/24-wallpaper.jpg" alt="" title="24: Wallpaper" width="500" height="516" class="alignnone size-full wp-image-1482" /></a> A place you would like to visit: <a href="http://blogs.theage.com.au/schembri/archives/2007/11/"><img src="/media/wp/2008/08/oz.jpg" alt="" title="Oz" width="400" height="291" class="alignnone size-full wp-image-1483" /></a> Your favorite place to be: <a href="http://www.monasterystays.com/?show=localities&#038;id=12"><img src="/media/wp/2008/08/rome.jpg" alt="" title="Rome" width="500" height="365" class="alignnone size-full wp-image-1484" /></a> The name of a past love: <div style="width:500px;min-height:40px;background:white;border:1px solid black;font-size:.7em;padding:.5em;">(uhm, when you search for women's names, Google turns up a various number of women with very little clothes on, so I leave this one as an exercise to the reader.)</div> Your college degree or concentration: <a href="https://www-eng.llnl.gov/info_eng/home.html"><img src="/media/wp/2008/08/information-engineering-and-management.png" alt="" title="Information Engineering and Management" width="286" height="153" class="alignnone size-full wp-image-1490" /></a> Your grandmother's first name: <a href="http://commons.wikimedia.org/wiki/Image:Auguste_maria_louise_bayern_1875_1964_erzherzogin.jpg"><img src="/media/wp/2008/08/auguste-maria-louise-bayern.jpg" alt="" title="Auguste Maria Louise von Bayern" class="alignnone size-full wp-image-1491" /></a> Where you grew up: <a href="http://commons.wikimedia.org/wiki/Image:Wappen_Waldbronn.png"><img src="/media/wp/2008/08/wappen_waldbronn.png" alt="" title="Wappen Waldbronn" width="242" height="254" class="alignnone size-full wp-image-1492" /></a> Your childhood pet's name: <div style="width:500px;height:40px;background:white;border:1px solid black;">&nbsp;</div> Your best friend's nickname: <a href="http://neumannfamily.de/Chrissi/chrissi.html"><img src="/media/wp/2008/08/chrissi_bear.jpg" alt="" title="Chrissi&#039;s Bear" width="500" height="288" class="alignnone size-full wp-image-1493" /></a> Your first job: <a href="http://commons.wikimedia.org/wiki/Image:Flyers_sobe_2.jpg"><img src="/media/wp/2008/08/flyers.jpg" alt="" title="Flyers" width="444" height="599" class="alignnone size-full wp-image-1494" /></a> Your favorite food: <a href="http://www.hc-sc.gc.ca/fn-an/securit/ill-intox/info/poultry-volaille-eng.php"><img src="/media/wp/2008/08/roasted_chicken.jpg" alt="" title="Roasted Chicken" width="150" height="200" class="alignnone size-full wp-image-1501" /></a> Your favorite color: <a href="http://explore.toshiba.com/innovation-lab/green"><img src="/media/wp/2008/08/green-recycle-img.jpg" alt="" title="Green Recycling Image" width="302" height="349" class="alignnone size-full wp-image-1502" /></a> What you're doing right now: <a href="http://s-kumaran.blogspot.com/"><img src="/media/wp/2008/08/lazy-bear.jpg" alt="" title="Lazy Bear" width="398" height="294" class="alignnone size-full wp-image-1503" /></a> One of your bad habits: <a href="http://www.geekzone.co.nz/forums.asp?ForumId=64&#038;TopicId=11994"><img src="/media/wp/2008/08/tomorrow-procrastinate.jpg" alt="" title="Tomorrow, I will vow to never procrastinate again." width="471" height="281" class="alignnone size-full wp-image-1504" /></a>
fwenzel/fredericiana
site/_posts/2008-08-29-image-search-meme.md
Markdown
bsd-3-clause
4,911
# Overview `lcobucci/jwt` is a framework-agnostic PHP library that allows you to issue, parse, and validate JSON Web Tokens based on the [RFC 7519]. ## Support If you're having any issue to use the library, please [create a GH issue]. You can also reach us and other users of this library via our [Gitter channel]. ## License The project is licensed under the MIT license, see [LICENSE file]. [RFC 7519]: https://tools.ietf.org/html/rfc7519 [create a GH issue]: https://github.com/lcobucci/jwt/issues/new [Gitter channel]: https://gitter.im/lcobucci/jwt [LICENSE file]: https://github.com/lcobucci/jwt/blob/master/LICENSE
lcobucci/jwt
docs/index.md
Markdown
bsd-3-clause
628
package org.wquery.update.parsers import org.wquery.model.Relation import org.wquery.query.parsers.WQueryParsers import org.wquery.update._ import org.wquery.update.exprs._ trait WUpdateParsers extends WQueryParsers { override def statement = ( update | merge | super.statement ) def update = "update" ~> ( rel_spec ~ update_op ~ multipath_expr ^^ { case spec~op~expr => UpdateExpr(None, spec, op, expr) } | multipath_expr ~ rel_spec ~ update_op ~ multipath_expr ^^ { case lexpr~spec~op~rexpr => UpdateExpr(Some(lexpr), spec, op, rexpr) } ) def rel_spec = ( "^" ~> rel_spec_arg ^^ { spec => RelationSpecification(ConstantRelationSpecificationArgument(Relation.Dst)::spec::ConstantRelationSpecificationArgument(Relation.Src)::Nil) } | rep1sep(rel_spec_arg, "^") ^^ { RelationSpecification(_) } ) def rel_spec_arg = ( var_decl ^^ { VariableRelationSpecificationArgument(_) } | notQuotedString ^^ { ConstantRelationSpecificationArgument(_) } ) def update_op = ("+="|"-="|":=") def merge = "merge" ~> expr ^^ { expr => MergeExpr(expr) } }
marekkubis/wquery
src/main/scala/org/wquery/update/WUpdateParsers.scala
Scala
bsd-3-clause
1,111
/* $KAME: altq.h,v 1.10 2003/07/10 12:07:47 kjc Exp $ */ /* * Copyright (C) 1998-2003 * Sony Computer Science Laboratories Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _ALTQ_ALTQ_H_ #define _ALTQ_ALTQ_H_ #if 1 /* * allow altq-3 (altqd(8) and /dev/altq) to coexist with the new pf-based altq. * altq3 is mainly for research experiments. pf-based altq is for daily use. */ #define ALTQ3_COMPAT /* for compatibility with altq-3 */ #define ALTQ3_CLFIER_COMPAT /* for compatibility with altq-3 classifier */ #endif #ifdef ALTQ3_COMPAT #include <sys/param.h> #include <sys/ioccom.h> #include <sys/queue.h> #include <netinet/in.h> #ifndef IFNAMSIZ #define IFNAMSIZ 16 #endif #endif /* ALTQ3_COMPAT */ /* altq discipline type */ #define ALTQT_NONE 0 /* reserved */ #define ALTQT_CBQ 1 /* cbq */ #define ALTQT_WFQ 2 /* wfq */ #define ALTQT_AFMAP 3 /* afmap */ #define ALTQT_FIFOQ 4 /* fifoq */ #define ALTQT_RED 5 /* red */ #define ALTQT_RIO 6 /* rio */ #define ALTQT_LOCALQ 7 /* local use */ #define ALTQT_HFSC 8 /* hfsc */ #define ALTQT_CDNR 9 /* traffic conditioner */ #define ALTQT_BLUE 10 /* blue */ #define ALTQT_PRIQ 11 /* priority queue */ #define ALTQT_JOBS 12 /* JoBS */ #define ALTQT_MAX 13 /* should be max discipline type + 1 */ #ifdef ALTQ3_COMPAT struct altqreq { char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */ u_long arg; /* request-specific argument */ }; #endif /* simple token backet meter profile */ struct tb_profile { u_int rate; /* rate in bit-per-sec */ u_int depth; /* depth in bytes */ }; #ifdef ALTQ3_COMPAT struct tbrreq { char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */ struct tb_profile tb_prof; /* token bucket profile */ }; #ifdef ALTQ3_CLFIER_COMPAT /* * common network flow info structure */ struct flowinfo { u_char fi_len; /* total length */ u_char fi_family; /* address family */ u_int8_t fi_data[46]; /* actually longer; address family specific flow info. */ }; /* * flow info structure for internet protocol family. * (currently this is the only protocol family supported) */ struct flowinfo_in { u_char fi_len; /* sizeof(struct flowinfo_in) */ u_char fi_family; /* AF_INET */ u_int8_t fi_proto; /* IPPROTO_XXX */ u_int8_t fi_tos; /* type-of-service */ struct in_addr fi_dst; /* dest address */ struct in_addr fi_src; /* src address */ u_int16_t fi_dport; /* dest port */ u_int16_t fi_sport; /* src port */ u_int32_t fi_gpi; /* generalized port id for ipsec */ u_int8_t _pad[28]; /* make the size equal to flowinfo_in6 */ }; #ifdef SIN6_LEN struct flowinfo_in6 { u_char fi6_len; /* sizeof(struct flowinfo_in6) */ u_char fi6_family; /* AF_INET6 */ u_int8_t fi6_proto; /* IPPROTO_XXX */ u_int8_t fi6_tclass; /* traffic class */ u_int32_t fi6_flowlabel; /* ipv6 flowlabel */ u_int16_t fi6_dport; /* dest port */ u_int16_t fi6_sport; /* src port */ u_int32_t fi6_gpi; /* generalized port id */ struct in6_addr fi6_dst; /* dest address */ struct in6_addr fi6_src; /* src address */ }; #endif /* INET6 */ /* * flow filters for AF_INET and AF_INET6 */ struct flow_filter { int ff_ruleno; struct flowinfo_in ff_flow; struct { struct in_addr mask_dst; struct in_addr mask_src; u_int8_t mask_tos; u_int8_t _pad[3]; } ff_mask; u_int8_t _pad2[24]; /* make the size equal to flow_filter6 */ }; #ifdef SIN6_LEN struct flow_filter6 { int ff_ruleno; struct flowinfo_in6 ff_flow6; struct { struct in6_addr mask6_dst; struct in6_addr mask6_src; u_int8_t mask6_tclass; u_int8_t _pad[3]; } ff_mask6; }; #endif /* INET6 */ #endif /* ALTQ3_CLFIER_COMPAT */ #endif /* ALTQ3_COMPAT */ /* * generic packet counter */ struct pktcntr { u_int64_t packets; u_int64_t bytes; }; #define PKTCNTR_ADD(cntr, len) \ do { (cntr)->packets++; (cntr)->bytes += len; } while (/*CONSTCOND*/ 0) #ifdef ALTQ3_COMPAT /* * altq related ioctls */ #define ALTQGTYPE _IOWR('q', 0, struct altqreq) /* get queue type */ #if 0 /* * these ioctls are currently discipline-specific but could be shared * in the future. */ #define ALTQATTACH _IOW('q', 1, struct altqreq) /* attach discipline */ #define ALTQDETACH _IOW('q', 2, struct altqreq) /* detach discipline */ #define ALTQENABLE _IOW('q', 3, struct altqreq) /* enable discipline */ #define ALTQDISABLE _IOW('q', 4, struct altqreq) /* disable discipline*/ #define ALTQCLEAR _IOW('q', 5, struct altqreq) /* (re)initialize */ #define ALTQCONFIG _IOWR('q', 6, struct altqreq) /* set config params */ #define ALTQADDCLASS _IOWR('q', 7, struct altqreq) /* add a class */ #define ALTQMODCLASS _IOWR('q', 8, struct altqreq) /* modify a class */ #define ALTQDELCLASS _IOWR('q', 9, struct altqreq) /* delete a class */ #define ALTQADDFILTER _IOWR('q', 10, struct altqreq) /* add a filter */ #define ALTQDELFILTER _IOWR('q', 11, struct altqreq) /* delete a filter */ #define ALTQGETSTATS _IOWR('q', 12, struct altqreq) /* get statistics */ #define ALTQGETCNTR _IOWR('q', 13, struct altqreq) /* get a pkt counter */ #endif /* 0 */ #define ALTQTBRSET _IOW('q', 14, struct tbrreq) /* set tb regulator */ #define ALTQTBRGET _IOWR('q', 15, struct tbrreq) /* get tb regulator */ #endif /* ALTQ3_COMPAT */ #ifdef _KERNEL #include <altq/altq_var.h> #endif #endif /* _ALTQ_ALTQ_H_ */
MarginC/kame
kame/sys/altq/altq.h
C
bsd-3-clause
6,519
<?php namespace CodeEmailMKT\Infrastructure\View\Twig; use Twig_Environment as TwigEnvironment; use \Zend\Expressive\Twig\TwigRenderer as ZendTwigRenderer; /** * Template implementation bridging league/plates */ class TwigRenderer extends ZendTwigRenderer { /** * @return TwigEnvironment */ public function getTemplate(): TwigEnvironment { return $this->template; } }
yuri-calabrez/code-education-php7
src/CodeEmailMKT/Infrastructure/View/Twig/TwigRenderer.php
PHP
bsd-3-clause
407
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model app\models\LocationSearch */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseOne"> Search </a> </h4> </div> <div id="collapseOne" class="panel-collapse collapse"> <div class="panel-body"> <div class="location-search col-sm-4 col-md-4 col-lg-4"> <?php $form = ActiveForm::begin([ 'action' => ['index'], 'method' => 'get', ]); ?> <?= $form->field($model, 'title') ?> <?= $form->field($model, 'status')->dropDownList(['' => '', $model::STATUS_ACTIVE => 'Active', $model::STATUS_INACTIVE => 'Inactive']) ?> <div class="form-group"> <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> <?= Html::a('Reset', '/admin/locations', ['class' => 'btn btn-default']) ?> </div> <?php ActiveForm::end(); ?> </div> </div> </div> </div> </div>
shahid80/EWay
modules/admin/views/locations/_search.php
PHP
bsd-3-clause
1,482
class DocSearchInterface extends ReactSingleAjax { constructor(props) { super(props); let urlP = getURLParams(); this.state = { termKind: urlP.termKind || "lemmas", query: urlP.query || "", operation: urlP.operation || "OR" }; this.init(); } componentDidMount() { if(this.state.query) { this.onFind(null); } } onFind(evt) { // one request at a time... if(this.waiting()) return; let request = {}; request.termKind = this.state.termKind; request.query = this.state.query; request.operation = this.state.operation; pushURLParams(request); this.send("/api/MatchDocuments", request); } render() { let results = ""; if(this.error()) { results = this.errorMessage(); } if(this.response()) { results = <pre key="json">{JSON.stringify(this.response())}</pre>; } return <div> <div>Document Search</div> <textarea value={this.state.query} onChange={(x) => this.setState({query: x.target.value}) } /> <SelectWidget opts={TermKindOpts} selected={this.state.termKind} onChange={(x) => this.setState({termKind: x})} /> <SelectWidget opts={OperationKinds} selected={this.state.operation} onChange={(x) => this.setState({operation: x})} /> <Button label="Find!" onClick={(evt) => this.onFind(evt)}/> <DocumentResults response={this.state.response} /> </div> } } class DocumentResults extends React.Component { render() { let resp = this.props.response; if(resp == null) { return <span />; } let results = _(resp.results).map(function(obj) { return <li key={obj.id}><DocumentLink id={obj.id} name={obj.name} /></li> }).value(); return <div> <label>Query Terms: <i>{strjoin(resp.queryTerms)}</i></label> <ul>{results}</ul> </div>; } }
jjfiv/coop
front_html/src/docSearch.js
JavaScript
bsd-3-clause
2,090
/* * * malloc_wrappers.c * * Author: Markku Rossi <mtr@iki.fi> * * Copyright (c) 2005-2016 Markku Rossi. * * See the LICENSE file for the details on licensing. * * Wrappers for system's memory allocation routines. * */ #include "piincludes.h" #include "pimalloc.h" #include <dlfcn.h> #include <signal.h> /***************************** Global variables *****************************/ /* Allocation and free functions. These point to some functions that are capable to allocate and release memory (malloc and free are nice). */ extern void *(*pi_malloc_ptr)(size_t); extern void (*pi_free_ptr)(void *); /********************** Bootstrap allocation routines ***********************/ static unsigned char bootstrap_heap[100 * 1024]; static size_t bootstrap_allocated = 0; /* Align `number' to `align'. The `number' and `align' must be integer numbers. */ #define PI_ALIGN(number, align) \ ((((number) + ((align) - 1)) / (align)) * (align)) static void * bootstrap_malloc(size_t size) { void *ptr; size = PI_ALIGN(size, 8); if (bootstrap_allocated + size > sizeof(bootstrap_heap)) { fprintf(stderr, "pimalloc: bootstrap heap out of space: size=%zu\n", size); return NULL; } ptr = bootstrap_heap + bootstrap_allocated; bootstrap_allocated += size; fprintf(stderr, "pimalloc: bootstrap_malloc(%zu) => %p\n", size, ptr); return ptr; } static void bootstrap_free(void *ptr) { fprintf(stderr, "pimalloc: bootstrap_free(%p)\n", ptr); } /************************** Interface to the libc ***************************/ static int initialized = 0; static void *libc; /*************** Wrapping system's memory allocation routines ***************/ static void init(void); void * malloc(size_t size) { if (!initialized) init(); return pi_malloc(size); } void free(void *ptr) { if (!initialized) init(); if (ptr == (void *) 1) { pi_malloc_dump_statistics(); pi_malloc_dump_blocks(); return; } pi_free(ptr); } void * realloc(void *ptr, size_t size) { if (!initialized) init(); return pi_realloc(ptr, 0, size); } void * calloc(size_t number, size_t size) { if (!initialized) init(); return pi_calloc(number, size); } static void dump_blocks(int sig) { pi_malloc_dump_statistics(); fprintf(stderr, "pimalloc: dumping blocks...\n"); pi_malloc_dump_blocks(); fprintf(stderr, "pimalloc: done\n"); } static void init(void) { char buf[256]; ssize_t ret; const char *signal_path = "/tmp/mallocdebug"; int sig = -1; int i; int at_exit = 1; char *endp; initialized = 1; pi_malloc_ptr = bootstrap_malloc; pi_free_ptr = bootstrap_free; fprintf(stderr, "pimalloc: init...\n"); libc = dlopen("libc.so.6", RTLD_LAZY | RTLD_GLOBAL); if (libc == NULL) libc = dlopen("libc.so", RTLD_LAZY | RTLD_GLOBAL); if (libc == NULL) { perror("Could not open libc.so"); exit(1); } pi_malloc_ptr = dlsym(libc, "malloc"); if (pi_malloc_ptr == NULL) { perror("Could not fetch malloc"); exit(1); } pi_free_ptr = dlsym(libc, "free"); if (pi_free_ptr == NULL) { perror("Could not fetch free"); exit(1); } ret = readlink(signal_path, buf, sizeof(buf)); if (ret != -1) { for (i = 0; buf[i]; i++) { switch (buf[i]) { case 'e': at_exit = 0; break; default: sig = strtol(buf + i, &endp, 10); i = endp - buf - 1; break; } } if (sig >= 0 && signal(sig, dump_blocks) == SIG_ERR) sig = -2; fprintf(stderr, "pimalloc: options: signal=%d, pid=%d, atexit=%s\n", sig, getpid(), at_exit ? "true" : "false"); } else { fprintf(stderr, "pimalloc: no options defined (ln -s FLAGSSIGNAL %s)\n" "pimalloc: FLAGS: e=no atexit dump\n" "pimalloc: SIGNAL: dump signal (SIGUSR1=%d, SIGUSR2=%d)\n", signal_path, SIGUSR1, SIGUSR2); } fprintf(stderr, "pimalloc: malloc=%p[%p], free=%p[%p]\n", pi_malloc_ptr, malloc, pi_free_ptr, free); if (at_exit) atexit(pi_malloc_dump_blocks); }
markkurossi/stacktrace
malloc_wrappers.c
C
bsd-3-clause
4,274
-- | A name binding context, or environment. module Hpp.Env where import Hpp.Types (Macro) -- | A macro binding environment. type Env = [(String, Macro)] -- | Delete an entry from an association list. deleteKey :: Eq a => a -> [(a,b)] -> [(a,b)] deleteKey k = go where go [] = [] go (h@(x,_) : xs) = if x == k then xs else h : go xs -- | Looks up a value in an association list. If the key is found, the -- value is returned along with an updated association list with that -- key at the front. lookupKey :: Eq a => a -> [(a,b)] -> Maybe (b, [(a,b)]) lookupKey k = go id where go _ [] = Nothing go acc (h@(x,v) : xs) | k == x = Just (v, h : acc [] ++ xs) | otherwise = go (acc . (h:)) xs
bitemyapp/hpp
src/Hpp/Env.hs
Haskell
bsd-3-clause
731
// FUSE service loop, for servers that wish to use it. package fs // import "bazil.org/fuse/fs" import ( "encoding/binary" "fmt" "hash/fnv" "io" "log" "reflect" "runtime" "strings" "sync" "time" "golang.org/x/net/context" ) import ( "bytes" "bazil.org/fuse" "bazil.org/fuse/fuseutil" ) const ( attrValidTime = 1 * time.Minute entryValidTime = 1 * time.Minute ) // CtxTagKey is the type used for unique context keys. type CtxTagKey int const ( // CtxHeaderUIDKey is the context key for header UIDs. CtxHeaderUIDKey CtxTagKey = iota ) // TODO: FINISH DOCS // An FS is the interface required of a file system. // // Other FUSE requests can be handled by implementing methods from the // FS* interfaces, for example FSStatfser. type FS interface { // Root is called to obtain the Node for the file system root. Root() (Node, error) } type FSStatfser interface { // Statfs is called to obtain file system metadata. // It should write that data to resp. Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error } type FSDestroyer interface { // Destroy is called when the file system is shutting down. // // Linux only sends this request for block device backed (fuseblk) // filesystems, to allow them to flush writes to disk before the // unmount completes. Destroy() } type FSInodeGenerator interface { // GenerateInode is called to pick a dynamic inode number when it // would otherwise be 0. // // Not all filesystems bother tracking inodes, but FUSE requires // the inode to be set, and fewer duplicates in general makes UNIX // tools work better. // // Operations where the nodes may return 0 inodes include Getattr, // Setattr and ReadDir. // // If FS does not implement FSInodeGenerator, GenerateDynamicInode // is used. // // Implementing this is useful to e.g. constrain the range of // inode values used for dynamic inodes. GenerateInode(parentInode uint64, name string) uint64 } // A Node is the interface required of a file or directory. // See the documentation for type FS for general information // pertaining to all methods. // // A Node must be usable as a map key, that is, it cannot be a // function, map or slice. // // Other FUSE requests can be handled by implementing methods from the // Node* interfaces, for example NodeOpener. // // Methods returning Node should take care to return the same Node // when the result is logically the same instance. Without this, each // Node will get a new NodeID, causing spurious cache invalidations, // extra lookups and aliasing anomalies. This may not matter for a // simple, read-only filesystem. type Node interface { // Attr fills attr with the standard metadata for the node. // // Fields with reasonable defaults are prepopulated. For example, // all times are set to a fixed moment when the program started. // // If Inode is left as 0, a dynamic inode number is chosen. // // The result may be cached for the duration set in Valid. Attr(ctx context.Context, attr *fuse.Attr) error } type NodeGetattrer interface { // Getattr obtains the standard metadata for the receiver. // It should store that metadata in resp. // // If this method is not implemented, the attributes will be // generated based on Attr(), with zero values filled in. Getattr(ctx context.Context, req *fuse.GetattrRequest, resp *fuse.GetattrResponse) error } type NodeSetattrer interface { // Setattr sets the standard metadata for the receiver. // // Note, this is also used to communicate changes in the size of // the file, outside of Writes. // // req.Valid is a bitmask of what fields are actually being set. // For example, the method should not change the mode of the file // unless req.Valid.Mode() is true. Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error } type NodeSymlinker interface { // Symlink creates a new symbolic link in the receiver, which must be a directory. // // TODO is the above true about directories? Symlink(ctx context.Context, req *fuse.SymlinkRequest) (Node, error) } // This optional request will be called only for symbolic link nodes. type NodeReadlinker interface { // Readlink reads a symbolic link. Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error) } type NodeLinker interface { // Link creates a new directory entry in the receiver based on an // existing Node. Receiver must be a directory. Link(ctx context.Context, req *fuse.LinkRequest, old Node) (Node, error) } type NodeRemover interface { // Remove removes the entry with the given name from // the receiver, which must be a directory. The entry to be removed // may correspond to a file (unlink) or to a directory (rmdir). Remove(ctx context.Context, req *fuse.RemoveRequest) error } type NodeAccesser interface { // Access checks whether the calling context has permission for // the given operations on the receiver. If so, Access should // return nil. If not, Access should return EPERM. // // Note that this call affects the result of the access(2) system // call but not the open(2) system call. If Access is not // implemented, the Node behaves as if it always returns nil // (permission granted), relying on checks in Open instead. Access(ctx context.Context, req *fuse.AccessRequest) error } type NodeStringLookuper interface { // Lookup looks up a specific entry in the receiver, // which must be a directory. Lookup should return a Node // corresponding to the entry. If the name does not exist in // the directory, Lookup should return ENOENT. // // Lookup need not to handle the names "." and "..". Lookup(ctx context.Context, name string) (Node, error) } type NodeRequestLookuper interface { // Lookup looks up a specific entry in the receiver. // See NodeStringLookuper for more. Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (Node, error) } type NodeMkdirer interface { Mkdir(ctx context.Context, req *fuse.MkdirRequest) (Node, error) } type NodeOpener interface { // Open opens the receiver. After a successful open, a client // process has a file descriptor referring to this Handle. // // Open can also be also called on non-files. For example, // directories are Opened for ReadDir or fchdir(2). // // If this method is not implemented, the open will always // succeed, and the Node itself will be used as the Handle. // // XXX note about access. XXX OpenFlags. Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (Handle, error) } type NodeCreater interface { // Create creates a new directory entry in the receiver, which // must be a directory. Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (Node, Handle, error) } type NodeForgetter interface { // Forget about this node. This node will not receive further // method calls. // // Forget is not necessarily seen on unmount, as all nodes are // implicitly forgotten as part part of the unmount. Forget() } type NodeRenamer interface { Rename(ctx context.Context, req *fuse.RenameRequest, newDir Node) error } type NodeMknoder interface { Mknod(ctx context.Context, req *fuse.MknodRequest) (Node, error) } // TODO this should be on Handle not Node type NodeFsyncer interface { Fsync(ctx context.Context, req *fuse.FsyncRequest) error } type NodeGetxattrer interface { // Getxattr gets an extended attribute by the given name from the // node. // // If there is no xattr by that name, returns fuse.ErrNoXattr. Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error } type NodeListxattrer interface { // Listxattr lists the extended attributes recorded for the node. Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error } type NodeSetxattrer interface { // Setxattr sets an extended attribute with the given name and // value for the node. Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error } type NodeRemovexattrer interface { // Removexattr removes an extended attribute for the name. // // If there is no xattr by that name, returns fuse.ErrNoXattr. Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error } var startTime = time.Now() func nodeAttr(ctx context.Context, n Node, attr *fuse.Attr) error { attr.Valid = attrValidTime attr.Nlink = 1 attr.Atime = startTime attr.Mtime = startTime attr.Ctime = startTime attr.Crtime = startTime if err := n.Attr(ctx, attr); err != nil { return err } return nil } // A Handle is the interface required of an opened file or directory. // See the documentation for type FS for general information // pertaining to all methods. // // Other FUSE requests can be handled by implementing methods from the // Handle* interfaces. The most common to implement are HandleReader, // HandleReadDirer, and HandleWriter. // // TODO implement methods: Getlk, Setlk, Setlkw type Handle interface { } type HandleFlusher interface { // Flush is called each time the file or directory is closed. // Because there can be multiple file descriptors referring to a // single opened file, Flush can be called multiple times. Flush(ctx context.Context, req *fuse.FlushRequest) error } type HandleReadAller interface { ReadAll(ctx context.Context) ([]byte, error) } type HandleReadDirAller interface { ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) } type HandleReader interface { // Read requests to read data from the handle. // // There is a page cache in the kernel that normally submits only // page-aligned reads spanning one or more pages. However, you // should not rely on this. To see individual requests as // submitted by the file system clients, set OpenDirectIO. // // Note that reads beyond the size of the file as reported by Attr // are not even attempted (except in OpenDirectIO mode). Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error } type HandleWriter interface { // Write requests to write data into the handle at the given offset. // Store the amount of data written in resp.Size. // // There is a writeback page cache in the kernel that normally submits // only page-aligned writes spanning one or more pages. However, // you should not rely on this. To see individual requests as // submitted by the file system clients, set OpenDirectIO. // // Writes that grow the file are expected to update the file size // (as seen through Attr). Note that file size changes are // communicated also through Setattr. Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error } type HandleReleaser interface { Release(ctx context.Context, req *fuse.ReleaseRequest) error } type Config struct { // Function to send debug log messages to. If nil, use fuse.Debug. // Note that changing this or fuse.Debug may not affect existing // calls to Serve. // // See fuse.Debug for the rules that log functions must follow. Debug func(msg interface{}) // Function to put things into context for processing the request. // The returned context must have ctx as its parent. // // Note that changing this may not affect existing calls to Serve. // // Must not retain req. WithContext func(ctx context.Context, req fuse.Request) context.Context } // New returns a new FUSE server ready to serve this kernel FUSE // connection. // // Config may be nil. func New(conn *fuse.Conn, config *Config) *Server { s := &Server{ conn: conn, req: map[fuse.RequestID]*serveRequest{}, nodeRef: map[Node]fuse.NodeID{}, dynamicInode: GenerateDynamicInode, } if config != nil { s.debug = config.Debug s.context = config.WithContext } if s.debug == nil { s.debug = fuse.Debug } return s } type Server struct { // set in New conn *fuse.Conn debug func(msg interface{}) context func(ctx context.Context, req fuse.Request) context.Context // set once at Serve time fs FS dynamicInode func(parent uint64, name string) uint64 // state, protected by meta meta sync.Mutex req map[fuse.RequestID]*serveRequest node []*serveNode nodeRef map[Node]fuse.NodeID handle []*serveHandle freeNode []fuse.NodeID freeHandle []fuse.HandleID nodeGen uint64 // Used to ensure worker goroutines finish before Serve returns wg sync.WaitGroup } // Serve serves the FUSE connection by making calls to the methods // of fs and the Nodes and Handles it makes available. It returns only // when the connection has been closed or an unexpected error occurs. func (s *Server) Serve(fs FS) error { defer s.wg.Wait() // Wait for worker goroutines to complete before return s.fs = fs if dyn, ok := fs.(FSInodeGenerator); ok { s.dynamicInode = dyn.GenerateInode } root, err := fs.Root() if err != nil { return fmt.Errorf("cannot obtain root node: %v", err) } // Recognize the root node if it's ever returned from Lookup, // passed to Invalidate, etc. s.nodeRef[root] = 1 s.node = append(s.node, nil, &serveNode{ inode: 1, generation: s.nodeGen, node: root, refs: 1, }) s.handle = append(s.handle, nil) for { req, err := s.conn.ReadRequest() if err != nil { if err == io.EOF { break } return err } s.wg.Add(1) go func() { defer s.wg.Done() s.serve(req) }() } return nil } // Serve serves a FUSE connection with the default settings. See // Server.Serve. func Serve(c *fuse.Conn, fs FS) error { server := New(c, nil) return server.Serve(fs) } type nothing struct{} type serveRequest struct { Request fuse.Request cancel func() } type serveNode struct { inode uint64 generation uint64 node Node refs uint64 // Delay freeing the NodeID until waitgroup is done. This allows // using the NodeID for short periods of time without holding the // Server.meta lock. // // Rules: // // - hold Server.meta while calling wg.Add, then unlock // - do NOT try to reacquire Server.meta wg sync.WaitGroup } func (sn *serveNode) attr(ctx context.Context, attr *fuse.Attr) error { err := nodeAttr(ctx, sn.node, attr) if attr.Inode == 0 { attr.Inode = sn.inode } return err } type serveHandle struct { handle Handle readData []byte nodeID fuse.NodeID } // NodeRef is deprecated. It remains here to decrease code churn on // FUSE library users. You may remove it from your program now; // returning the same Node values are now recognized automatically, // without needing NodeRef. type NodeRef struct{} func (c *Server) saveNode(inode uint64, node Node) (id fuse.NodeID, gen uint64) { c.meta.Lock() defer c.meta.Unlock() if id, ok := c.nodeRef[node]; ok { sn := c.node[id] sn.refs++ return id, sn.generation } sn := &serveNode{inode: inode, node: node, refs: 1} if n := len(c.freeNode); n > 0 { id = c.freeNode[n-1] c.freeNode = c.freeNode[:n-1] c.node[id] = sn c.nodeGen++ } else { id = fuse.NodeID(len(c.node)) c.node = append(c.node, sn) } sn.generation = c.nodeGen c.nodeRef[node] = id return id, sn.generation } func (c *Server) saveHandle(handle Handle, nodeID fuse.NodeID) (id fuse.HandleID) { c.meta.Lock() shandle := &serveHandle{handle: handle, nodeID: nodeID} if n := len(c.freeHandle); n > 0 { id = c.freeHandle[n-1] c.freeHandle = c.freeHandle[:n-1] c.handle[id] = shandle } else { id = fuse.HandleID(len(c.handle)) c.handle = append(c.handle, shandle) } c.meta.Unlock() return } type nodeRefcountDropBug struct { N uint64 Refs uint64 Node fuse.NodeID } func (n *nodeRefcountDropBug) String() string { return fmt.Sprintf("bug: trying to drop %d of %d references to %v", n.N, n.Refs, n.Node) } func (c *Server) dropNode(id fuse.NodeID, n uint64) (forget bool) { c.meta.Lock() defer c.meta.Unlock() snode := c.node[id] if snode == nil { // this should only happen if refcounts kernel<->us disagree // *and* two ForgetRequests for the same node race each other; // this indicates a bug somewhere c.debug(nodeRefcountDropBug{N: n, Node: id}) // we may end up triggering Forget twice, but that's better // than not even once, and that's the best we can do return true } if n > snode.refs { c.debug(nodeRefcountDropBug{N: n, Refs: snode.refs, Node: id}) n = snode.refs } snode.refs -= n if snode.refs == 0 { snode.wg.Wait() c.node[id] = nil delete(c.nodeRef, snode.node) c.freeNode = append(c.freeNode, id) return true } return false } func (c *Server) dropHandle(id fuse.HandleID) { c.meta.Lock() c.handle[id] = nil c.freeHandle = append(c.freeHandle, id) c.meta.Unlock() } type missingHandle struct { Handle fuse.HandleID MaxHandle fuse.HandleID } func (m missingHandle) String() string { return fmt.Sprint("missing handle: ", m.Handle, m.MaxHandle) } // Returns nil for invalid handles. func (c *Server) getHandle(id fuse.HandleID) (shandle *serveHandle) { c.meta.Lock() defer c.meta.Unlock() if id < fuse.HandleID(len(c.handle)) { shandle = c.handle[uint(id)] } if shandle == nil { c.debug(missingHandle{ Handle: id, MaxHandle: fuse.HandleID(len(c.handle)), }) } return } type request struct { Op string Request *fuse.Header In interface{} `json:",omitempty"` } func (r request) String() string { return fmt.Sprintf("<- %s", r.In) } type logResponseHeader struct { ID fuse.RequestID } func (m logResponseHeader) String() string { return fmt.Sprintf("ID=%v", m.ID) } type response struct { Op string Request logResponseHeader Out interface{} `json:",omitempty"` // Errno contains the errno value as a string, for example "EPERM". Errno string `json:",omitempty"` // Error may contain a free form error message. Error string `json:",omitempty"` } func (r response) errstr() string { s := r.Errno if r.Error != "" { // prefix the errno constant to the long form message s = s + ": " + r.Error } return s } func (r response) String() string { switch { case r.Errno != "" && r.Out != nil: return fmt.Sprintf("-> [%v] %v error=%s", r.Request, r.Out, r.errstr()) case r.Errno != "": return fmt.Sprintf("-> [%v] %s error=%s", r.Request, r.Op, r.errstr()) case r.Out != nil: // make sure (seemingly) empty values are readable switch r.Out.(type) { case string: return fmt.Sprintf("-> [%v] %s %q", r.Request, r.Op, r.Out) case []byte: return fmt.Sprintf("-> [%v] %s [% x]", r.Request, r.Op, r.Out) default: return fmt.Sprintf("-> [%v] %v", r.Request, r.Out) } default: return fmt.Sprintf("-> [%v] %s", r.Request, r.Op) } } type notification struct { Op string Node fuse.NodeID Out interface{} `json:",omitempty"` Err string `json:",omitempty"` } func (n notification) String() string { var buf bytes.Buffer fmt.Fprintf(&buf, "=> %s %v", n.Op, n.Node) if n.Out != nil { // make sure (seemingly) empty values are readable switch n.Out.(type) { case string: fmt.Fprintf(&buf, " %q", n.Out) case []byte: fmt.Fprintf(&buf, " [% x]", n.Out) default: fmt.Fprintf(&buf, " %s", n.Out) } } if n.Err != "" { fmt.Fprintf(&buf, " Err:%v", n.Err) } return buf.String() } type logMissingNode struct { MaxNode fuse.NodeID } func opName(req fuse.Request) string { t := reflect.Indirect(reflect.ValueOf(req)).Type() s := t.Name() s = strings.TrimSuffix(s, "Request") return s } type logLinkRequestOldNodeNotFound struct { Request *fuse.Header In *fuse.LinkRequest } func (m *logLinkRequestOldNodeNotFound) String() string { return fmt.Sprintf("In LinkRequest (request %v), node %d not found", m.Request.Hdr().ID, m.In.OldNode) } type renameNewDirNodeNotFound struct { Request *fuse.Header In *fuse.RenameRequest } func (m *renameNewDirNodeNotFound) String() string { return fmt.Sprintf("In RenameRequest (request %v), node %d not found", m.Request.Hdr().ID, m.In.NewDir) } type handlerPanickedError struct { Request interface{} Err interface{} } var _ error = handlerPanickedError{} func (h handlerPanickedError) Error() string { return fmt.Sprintf("handler panicked: %v", h.Err) } var _ fuse.ErrorNumber = handlerPanickedError{} func (h handlerPanickedError) Errno() fuse.Errno { if err, ok := h.Err.(fuse.ErrorNumber); ok { return err.Errno() } return fuse.DefaultErrno } // handlerTerminatedError happens when a handler terminates itself // with runtime.Goexit. This is most commonly because of incorrect use // of testing.TB.FailNow, typically via t.Fatal. type handlerTerminatedError struct { Request interface{} } var _ error = handlerTerminatedError{} func (h handlerTerminatedError) Error() string { return fmt.Sprintf("handler terminated (called runtime.Goexit)") } var _ fuse.ErrorNumber = handlerTerminatedError{} func (h handlerTerminatedError) Errno() fuse.Errno { return fuse.DefaultErrno } type handleNotReaderError struct { handle Handle } var _ error = handleNotReaderError{} func (e handleNotReaderError) Error() string { return fmt.Sprintf("handle has no Read: %T", e.handle) } var _ fuse.ErrorNumber = handleNotReaderError{} func (e handleNotReaderError) Errno() fuse.Errno { return fuse.ENOTSUP } func initLookupResponse(s *fuse.LookupResponse) { s.EntryValid = entryValidTime } func (c *Server) serve(r fuse.Request) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() parentCtx := ctx if c.context != nil { ctx = c.context(ctx, r) } req := &serveRequest{Request: r, cancel: cancel} c.debug(request{ Op: opName(r), Request: r.Hdr(), In: r, }) var node Node var snode *serveNode c.meta.Lock() hdr := r.Hdr() if id := hdr.Node; id != 0 { if id < fuse.NodeID(len(c.node)) { snode = c.node[uint(id)] } if snode == nil { c.meta.Unlock() c.debug(response{ Op: opName(r), Request: logResponseHeader{ID: hdr.ID}, Error: fuse.ESTALE.ErrnoName(), // this is the only place that sets both Error and // Out; not sure if i want to do that; might get rid // of len(c.node) things altogether Out: logMissingNode{ MaxNode: fuse.NodeID(len(c.node)), }, }) r.RespondError(fuse.ESTALE) return } node = snode.node } if c.req[hdr.ID] != nil { // This happens with OSXFUSE. Assume it's okay and // that we'll never see an interrupt for this one. // Otherwise everything wedges. TODO: Report to OSXFUSE? // // TODO this might have been because of missing done() calls } else { c.req[hdr.ID] = req } c.meta.Unlock() // Call this before responding. // After responding is too late: we might get another request // with the same ID and be very confused. done := func(resp interface{}) { msg := response{ Op: opName(r), Request: logResponseHeader{ID: hdr.ID}, } if err, ok := resp.(error); ok { msg.Error = err.Error() if ferr, ok := err.(fuse.ErrorNumber); ok { errno := ferr.Errno() msg.Errno = errno.ErrnoName() if errno == err { // it's just a fuse.Errno with no extra detail; // skip the textual message for log readability msg.Error = "" } } else { msg.Errno = fuse.DefaultErrno.ErrnoName() } } else { msg.Out = resp } c.debug(msg) c.meta.Lock() delete(c.req, hdr.ID) c.meta.Unlock() } var responded bool defer func() { if rec := recover(); rec != nil { const size = 1 << 16 buf := make([]byte, size) n := runtime.Stack(buf, false) buf = buf[:n] log.Printf("fuse: panic in handler for %v: %v\n%s", r, rec, buf) err := handlerPanickedError{ Request: r, Err: rec, } done(err) r.RespondError(err) return } if !responded { err := handlerTerminatedError{ Request: r, } done(err) r.RespondError(err) } }() if err := c.handleRequest(ctx, node, snode, r, done); err != nil { if err == context.Canceled { select { case <-parentCtx.Done(): // We canceled the parent context because of an // incoming interrupt request, so return EINTR // to trigger the right behavior in the client app. // // Only do this when it's the parent context that was // canceled, not a context controlled by the program // using this library, so we don't return EINTR too // eagerly -- it might cause busy loops. // // Decent write-up on role of EINTR: // http://250bpm.com/blog:12 err = fuse.EINTR default: // nothing } } done(err) r.RespondError(err) } // disarm runtime.Goexit protection responded = true } // handleRequest will either a) call done(s) and r.Respond(s) OR b) return an error. func (c *Server) handleRequest(ctx context.Context, node Node, snode *serveNode, r fuse.Request, done func(resp interface{})) error { ctx = context.WithValue(ctx, CtxHeaderUIDKey, r.Hdr().Uid) switch r := r.(type) { default: // Note: To FUSE, ENOSYS means "this server never implements this request." // It would be inappropriate to return ENOSYS for other operations in this // switch that might only be unavailable in some contexts, not all. return fuse.ENOSYS case *fuse.StatfsRequest: s := &fuse.StatfsResponse{} if fs, ok := c.fs.(FSStatfser); ok { if err := fs.Statfs(ctx, r, s); err != nil { return err } } done(s) r.Respond(s) return nil // Node operations. case *fuse.GetattrRequest: s := &fuse.GetattrResponse{} if n, ok := node.(NodeGetattrer); ok { if err := n.Getattr(ctx, r, s); err != nil { return err } } else { if err := snode.attr(ctx, &s.Attr); err != nil { return err } } done(s) r.Respond(s) return nil case *fuse.SetattrRequest: s := &fuse.SetattrResponse{} if n, ok := node.(NodeSetattrer); ok { if err := n.Setattr(ctx, r, s); err != nil { return err } } if err := snode.attr(ctx, &s.Attr); err != nil { return err } done(s) r.Respond(s) return nil case *fuse.SymlinkRequest: s := &fuse.SymlinkResponse{} initLookupResponse(&s.LookupResponse) n, ok := node.(NodeSymlinker) if !ok { return fuse.EIO // XXX or EPERM like Mkdir? } n2, err := n.Symlink(ctx, r) if err != nil { return err } if err := c.saveLookup(ctx, &s.LookupResponse, snode, r.NewName, n2); err != nil { return err } done(s) r.Respond(s) return nil case *fuse.ReadlinkRequest: n, ok := node.(NodeReadlinker) if !ok { return fuse.EIO /// XXX or EPERM? } target, err := n.Readlink(ctx, r) if err != nil { return err } done(target) r.Respond(target) return nil case *fuse.LinkRequest: n, ok := node.(NodeLinker) if !ok { return fuse.EIO /// XXX or EPERM? } c.meta.Lock() var oldNode *serveNode if int(r.OldNode) < len(c.node) { oldNode = c.node[r.OldNode] } c.meta.Unlock() if oldNode == nil { c.debug(logLinkRequestOldNodeNotFound{ Request: r.Hdr(), In: r, }) return fuse.EIO } n2, err := n.Link(ctx, r, oldNode.node) if err != nil { return err } s := &fuse.LookupResponse{} initLookupResponse(s) if err := c.saveLookup(ctx, s, snode, r.NewName, n2); err != nil { return err } done(s) r.Respond(s) return nil case *fuse.RemoveRequest: n, ok := node.(NodeRemover) if !ok { return fuse.EIO /// XXX or EPERM? } err := n.Remove(ctx, r) if err != nil { return err } done(nil) r.Respond() return nil case *fuse.AccessRequest: if n, ok := node.(NodeAccesser); ok { if err := n.Access(ctx, r); err != nil { return err } } done(nil) r.Respond() return nil case *fuse.LookupRequest: var n2 Node var err error s := &fuse.LookupResponse{} initLookupResponse(s) if n, ok := node.(NodeStringLookuper); ok { n2, err = n.Lookup(ctx, r.Name) } else if n, ok := node.(NodeRequestLookuper); ok { n2, err = n.Lookup(ctx, r, s) } else { return fuse.ENOENT } if err != nil { return err } if err := c.saveLookup(ctx, s, snode, r.Name, n2); err != nil { return err } done(s) r.Respond(s) return nil case *fuse.MkdirRequest: s := &fuse.MkdirResponse{} initLookupResponse(&s.LookupResponse) n, ok := node.(NodeMkdirer) if !ok { return fuse.EPERM } n2, err := n.Mkdir(ctx, r) if err != nil { return err } if err := c.saveLookup(ctx, &s.LookupResponse, snode, r.Name, n2); err != nil { return err } done(s) r.Respond(s) return nil case *fuse.OpenRequest: s := &fuse.OpenResponse{} var h2 Handle if n, ok := node.(NodeOpener); ok { hh, err := n.Open(ctx, r, s) if err != nil { return err } h2 = hh } else { h2 = node } s.Handle = c.saveHandle(h2, r.Hdr().Node) done(s) r.Respond(s) return nil case *fuse.CreateRequest: n, ok := node.(NodeCreater) if !ok { // If we send back ENOSYS, FUSE will try mknod+open. return fuse.EPERM } s := &fuse.CreateResponse{OpenResponse: fuse.OpenResponse{}} initLookupResponse(&s.LookupResponse) n2, h2, err := n.Create(ctx, r, s) if err != nil { return err } if err := c.saveLookup(ctx, &s.LookupResponse, snode, r.Name, n2); err != nil { return err } s.Handle = c.saveHandle(h2, r.Hdr().Node) done(s) r.Respond(s) return nil case *fuse.GetxattrRequest: n, ok := node.(NodeGetxattrer) if !ok { return fuse.ENOTSUP } s := &fuse.GetxattrResponse{} err := n.Getxattr(ctx, r, s) if err != nil { return err } if r.Size != 0 && uint64(len(s.Xattr)) > uint64(r.Size) { return fuse.ERANGE } done(s) r.Respond(s) return nil case *fuse.ListxattrRequest: n, ok := node.(NodeListxattrer) if !ok { return fuse.ENOTSUP } s := &fuse.ListxattrResponse{} err := n.Listxattr(ctx, r, s) if err != nil { return err } if r.Size != 0 && uint64(len(s.Xattr)) > uint64(r.Size) { return fuse.ERANGE } done(s) r.Respond(s) return nil case *fuse.SetxattrRequest: n, ok := node.(NodeSetxattrer) if !ok { return fuse.ENOTSUP } err := n.Setxattr(ctx, r) if err != nil { return err } done(nil) r.Respond() return nil case *fuse.RemovexattrRequest: n, ok := node.(NodeRemovexattrer) if !ok { return fuse.ENOTSUP } err := n.Removexattr(ctx, r) if err != nil { return err } done(nil) r.Respond() return nil case *fuse.ForgetRequest: forget := c.dropNode(r.Hdr().Node, r.N) if forget { n, ok := node.(NodeForgetter) if ok { n.Forget() } } done(nil) r.Respond() return nil // Handle operations. case *fuse.ReadRequest: shandle := c.getHandle(r.Handle) if shandle == nil { return fuse.ESTALE } handle := shandle.handle s := &fuse.ReadResponse{Data: make([]byte, 0, r.Size)} if r.Dir { if h, ok := handle.(HandleReadDirAller); ok { // detect rewinddir(3) or similar seek and refresh // contents if r.Offset == 0 { shandle.readData = nil } if shandle.readData == nil { dirs, err := h.ReadDirAll(ctx) if err != nil { return err } var data []byte for _, dir := range dirs { if dir.Inode == 0 { dir.Inode = c.dynamicInode(snode.inode, dir.Name) } data = fuse.AppendDirent(data, dir) } shandle.readData = data } fuseutil.HandleRead(r, s, shandle.readData) done(s) r.Respond(s) return nil } } else { if h, ok := handle.(HandleReadAller); ok { if shandle.readData == nil { data, err := h.ReadAll(ctx) if err != nil { return err } if data == nil { data = []byte{} } shandle.readData = data } fuseutil.HandleRead(r, s, shandle.readData) done(s) r.Respond(s) return nil } h, ok := handle.(HandleReader) if !ok { err := handleNotReaderError{handle: handle} return err } if err := h.Read(ctx, r, s); err != nil { return err } } done(s) r.Respond(s) return nil case *fuse.WriteRequest: shandle := c.getHandle(r.Handle) if shandle == nil { return fuse.ESTALE } s := &fuse.WriteResponse{} if h, ok := shandle.handle.(HandleWriter); ok { if err := h.Write(ctx, r, s); err != nil { return err } done(s) r.Respond(s) return nil } return fuse.EIO case *fuse.FlushRequest: shandle := c.getHandle(r.Handle) if shandle == nil { return fuse.ESTALE } handle := shandle.handle if h, ok := handle.(HandleFlusher); ok { if err := h.Flush(ctx, r); err != nil { return err } } done(nil) r.Respond() return nil case *fuse.ReleaseRequest: shandle := c.getHandle(r.Handle) if shandle == nil { return fuse.ESTALE } handle := shandle.handle // No matter what, release the handle. c.dropHandle(r.Handle) if h, ok := handle.(HandleReleaser); ok { if err := h.Release(ctx, r); err != nil { return err } } done(nil) r.Respond() return nil case *fuse.DestroyRequest: if fs, ok := c.fs.(FSDestroyer); ok { fs.Destroy() } done(nil) r.Respond() return nil case *fuse.RenameRequest: c.meta.Lock() var newDirNode *serveNode if int(r.NewDir) < len(c.node) { newDirNode = c.node[r.NewDir] } c.meta.Unlock() if newDirNode == nil { c.debug(renameNewDirNodeNotFound{ Request: r.Hdr(), In: r, }) return fuse.EIO } n, ok := node.(NodeRenamer) if !ok { return fuse.EIO // XXX or EPERM like Mkdir? } err := n.Rename(ctx, r, newDirNode.node) if err != nil { return err } done(nil) r.Respond() return nil case *fuse.MknodRequest: n, ok := node.(NodeMknoder) if !ok { return fuse.EIO } n2, err := n.Mknod(ctx, r) if err != nil { return err } s := &fuse.LookupResponse{} initLookupResponse(s) if err := c.saveLookup(ctx, s, snode, r.Name, n2); err != nil { return err } done(s) r.Respond(s) return nil case *fuse.FsyncRequest: n, ok := node.(NodeFsyncer) if !ok { return fuse.EIO } err := n.Fsync(ctx, r) if err != nil { return err } done(nil) r.Respond() return nil case *fuse.InterruptRequest: c.meta.Lock() ireq := c.req[r.IntrID] if ireq != nil && ireq.cancel != nil { ireq.cancel() ireq.cancel = nil } c.meta.Unlock() done(nil) r.Respond() return nil /* case *FsyncdirRequest: return ENOSYS case *GetlkRequest, *SetlkRequest, *SetlkwRequest: return ENOSYS case *BmapRequest: return ENOSYS case *SetvolnameRequest, *GetxtimesRequest, *ExchangeRequest: return ENOSYS */ } panic("not reached") } func (c *Server) saveLookup(ctx context.Context, s *fuse.LookupResponse, snode *serveNode, elem string, n2 Node) error { if err := nodeAttr(ctx, n2, &s.Attr); err != nil { return err } if s.Attr.Inode == 0 { s.Attr.Inode = c.dynamicInode(snode.inode, elem) } s.Node, s.Generation = c.saveNode(s.Attr.Inode, n2) return nil } type invalidateNodeDetail struct { Off int64 Size int64 } func (i invalidateNodeDetail) String() string { return fmt.Sprintf("Off:%d Size:%d", i.Off, i.Size) } func errstr(err error) string { if err == nil { return "" } return err.Error() } func (s *Server) invalidateNode(node Node, off int64, size int64) error { s.meta.Lock() id, ok := s.nodeRef[node] if ok { snode := s.node[id] snode.wg.Add(1) defer snode.wg.Done() } s.meta.Unlock() if !ok { // This is what the kernel would have said, if we had been // able to send this message; it's not cached. return fuse.ErrNotCached } // Delay logging until after we can record the error too. We // consider a /dev/fuse write to be instantaneous enough to not // need separate before and after messages. err := s.conn.InvalidateNode(id, off, size) s.debug(notification{ Op: "InvalidateNode", Node: id, Out: invalidateNodeDetail{ Off: off, Size: size, }, Err: errstr(err), }) return err } // InvalidateNodeAttr invalidates the kernel cache of the attributes // of node. // // Returns fuse.ErrNotCached if the kernel is not currently caching // the node. func (s *Server) InvalidateNodeAttr(node Node) error { return s.invalidateNode(node, 0, 0) } // InvalidateNodeData invalidates the kernel cache of the attributes // and data of node. // // Returns fuse.ErrNotCached if the kernel is not currently caching // the node. func (s *Server) InvalidateNodeData(node Node) error { return s.invalidateNode(node, 0, -1) } // InvalidateNodeDataRange invalidates the kernel cache of the // attributes and a range of the data of node. // // Returns fuse.ErrNotCached if the kernel is not currently caching // the node. func (s *Server) InvalidateNodeDataRange(node Node, off int64, size int64) error { return s.invalidateNode(node, off, size) } type invalidateEntryDetail struct { Name string } func (i invalidateEntryDetail) String() string { return fmt.Sprintf("%q", i.Name) } // InvalidateEntry invalidates the kernel cache of the directory entry // identified by parent node and entry basename. // // Kernel may or may not cache directory listings. To invalidate // those, use InvalidateNode to invalidate all of the data for a // directory. (As of 2015-06, Linux FUSE does not cache directory // listings.) // // Returns ErrNotCached if the kernel is not currently caching the // node. func (s *Server) InvalidateEntry(parent Node, name string) error { s.meta.Lock() id, ok := s.nodeRef[parent] if ok { snode := s.node[id] snode.wg.Add(1) defer snode.wg.Done() } s.meta.Unlock() if !ok { // This is what the kernel would have said, if we had been // able to send this message; it's not cached. return fuse.ErrNotCached } err := s.conn.InvalidateEntry(id, name) s.debug(notification{ Op: "InvalidateEntry", Node: id, Out: invalidateEntryDetail{ Name: name, }, Err: errstr(err), }) return err } // DataHandle returns a read-only Handle that satisfies reads // using the given data. func DataHandle(data []byte) Handle { return &dataHandle{data} } type dataHandle struct { data []byte } func (d *dataHandle) ReadAll(ctx context.Context) ([]byte, error) { return d.data, nil } // GenerateDynamicInode returns a dynamic inode. // // The parent inode and current entry name are used as the criteria // for choosing a pseudorandom inode. This makes it likely the same // entry will get the same inode on multiple runs. func GenerateDynamicInode(parent uint64, name string) uint64 { h := fnv.New64a() var buf [8]byte binary.LittleEndian.PutUint64(buf[:], parent) _, _ = h.Write(buf[:]) _, _ = h.Write([]byte(name)) var inode uint64 for { inode = h.Sum64() if inode != 0 { break } // there's a tiny probability that result is zero; change the // input a little and try again _, _ = h.Write([]byte{'x'}) } return inode }
keybase/kbfs
vendor/bazil.org/fuse/fs/serve.go
GO
bsd-3-clause
38,731
<?php /** * This file is part of the Nette Framework (http://nette.org) * * Copyright (c) 2004 David Grudl (http://davidgrudl.com) * * For the full copyright and license information, please view * the file license.txt that was distributed with this source code. * @package Nette\Security */ /** * Access control list (ACL) functionality and privileges management. * * This solution is mostly based on Zend_Acl (c) Zend Technologies USA Inc. (http://www.zend.com), new BSD license * * @copyright Copyright (c) 2005, 2007 Zend Technologies USA Inc. * @author David Grudl * * @property-read array $roles * @property-read array $resources * @property-read mixed $queriedRole * @property-read mixed $queriedResource * @package Nette\Security */ class NPermission extends NObject implements IAuthorizator { /** @var array Role storage */ private $roles = array(); /** @var array Resource storage */ private $resources = array(); /** @var array Access Control List rules; whitelist (deny everything to all) by default */ private $rules = array( 'allResources' => array( 'allRoles' => array( 'allPrivileges' => array( 'type' => self::DENY, 'assert' => NULL, ), 'byPrivilege' => array(), ), 'byRole' => array(), ), 'byResource' => array(), ); /** @var mixed */ private $queriedRole, $queriedResource; /********************* roles ****************d*g**/ /** * Adds a Role to the list. The most recently added parent * takes precedence over parents that were previously added. * @param string * @param string|array * @throws InvalidArgumentException * @throws InvalidStateException * @return NPermission provides a fluent interface */ public function addRole($role, $parents = NULL) { $this->checkRole($role, FALSE); if (isset($this->roles[$role])) { throw new InvalidStateException("Role '$role' already exists in the list."); } $roleParents = array(); if ($parents !== NULL) { if (!is_array($parents)) { $parents = array($parents); } foreach ($parents as $parent) { $this->checkRole($parent); $roleParents[$parent] = TRUE; $this->roles[$parent]['children'][$role] = TRUE; } } $this->roles[$role] = array( 'parents' => $roleParents, 'children' => array(), ); return $this; } /** * Returns TRUE if the Role exists in the list. * @param string * @return bool */ public function hasRole($role) { $this->checkRole($role, FALSE); return isset($this->roles[$role]); } /** * Checks whether Role is valid and exists in the list. * @param string * @param bool * @throws InvalidStateException * @return void */ private function checkRole($role, $need = TRUE) { if (!is_string($role) || $role === '') { throw new InvalidArgumentException("Role must be a non-empty string."); } elseif ($need && !isset($this->roles[$role])) { throw new InvalidStateException("Role '$role' does not exist."); } } /** * Returns all Roles. * @return array */ public function getRoles() { return array_keys($this->roles); } /** * Returns existing Role's parents ordered by ascending priority. * @param string * @return array */ public function getRoleParents($role) { $this->checkRole($role); return array_keys($this->roles[$role]['parents']); } /** * Returns TRUE if $role inherits from $inherit. If $onlyParents is TRUE, * then $role must inherit directly from $inherit. * @param string * @param string * @param bool * @throws InvalidStateException * @return bool */ public function roleInheritsFrom($role, $inherit, $onlyParents = FALSE) { $this->checkRole($role); $this->checkRole($inherit); $inherits = isset($this->roles[$role]['parents'][$inherit]); if ($inherits || $onlyParents) { return $inherits; } foreach ($this->roles[$role]['parents'] as $parent => $foo) { if ($this->roleInheritsFrom($parent, $inherit)) { return TRUE; } } return FALSE; } /** * Removes the Role from the list. * * @param string * @throws InvalidStateException * @return NPermission provides a fluent interface */ public function removeRole($role) { $this->checkRole($role); foreach ($this->roles[$role]['children'] as $child => $foo) { unset($this->roles[$child]['parents'][$role]); } foreach ($this->roles[$role]['parents'] as $parent => $foo) { unset($this->roles[$parent]['children'][$role]); } unset($this->roles[$role]); foreach ($this->rules['allResources']['byRole'] as $roleCurrent => $rules) { if ($role === $roleCurrent) { unset($this->rules['allResources']['byRole'][$roleCurrent]); } } foreach ($this->rules['byResource'] as $resourceCurrent => $visitor) { if (isset($visitor['byRole'])) { foreach ($visitor['byRole'] as $roleCurrent => $rules) { if ($role === $roleCurrent) { unset($this->rules['byResource'][$resourceCurrent]['byRole'][$roleCurrent]); } } } } return $this; } /** * Removes all Roles from the list. * * @return NPermission provides a fluent interface */ public function removeAllRoles() { $this->roles = array(); foreach ($this->rules['allResources']['byRole'] as $roleCurrent => $rules) { unset($this->rules['allResources']['byRole'][$roleCurrent]); } foreach ($this->rules['byResource'] as $resourceCurrent => $visitor) { foreach ($visitor['byRole'] as $roleCurrent => $rules) { unset($this->rules['byResource'][$resourceCurrent]['byRole'][$roleCurrent]); } } return $this; } /********************* resources ****************d*g**/ /** * Adds a Resource having an identifier unique to the list. * * @param string * @param string * @throws InvalidArgumentException * @throws InvalidStateException * @return NPermission provides a fluent interface */ public function addResource($resource, $parent = NULL) { $this->checkResource($resource, FALSE); if (isset($this->resources[$resource])) { throw new InvalidStateException("Resource '$resource' already exists in the list."); } if ($parent !== NULL) { $this->checkResource($parent); $this->resources[$parent]['children'][$resource] = TRUE; } $this->resources[$resource] = array( 'parent' => $parent, 'children' => array() ); return $this; } /** * Returns TRUE if the Resource exists in the list. * @param string * @return bool */ public function hasResource($resource) { $this->checkResource($resource, FALSE); return isset($this->resources[$resource]); } /** * Checks whether Resource is valid and exists in the list. * @param string * @param bool * @throws InvalidStateException * @return void */ private function checkResource($resource, $need = TRUE) { if (!is_string($resource) || $resource === '') { throw new InvalidArgumentException("Resource must be a non-empty string."); } elseif ($need && !isset($this->resources[$resource])) { throw new InvalidStateException("Resource '$resource' does not exist."); } } /** * Returns all Resources. * @return array */ public function getResources() { return array_keys($this->resources); } /** * Returns TRUE if $resource inherits from $inherit. If $onlyParents is TRUE, * then $resource must inherit directly from $inherit. * * @param string * @param string * @param bool * @throws InvalidStateException * @return bool */ public function resourceInheritsFrom($resource, $inherit, $onlyParent = FALSE) { $this->checkResource($resource); $this->checkResource($inherit); if ($this->resources[$resource]['parent'] === NULL) { return FALSE; } $parent = $this->resources[$resource]['parent']; if ($inherit === $parent) { return TRUE; } elseif ($onlyParent) { return FALSE; } while ($this->resources[$parent]['parent'] !== NULL) { $parent = $this->resources[$parent]['parent']; if ($inherit === $parent) { return TRUE; } } return FALSE; } /** * Removes a Resource and all of its children. * * @param string * @throws InvalidStateException * @return NPermission provides a fluent interface */ public function removeResource($resource) { $this->checkResource($resource); $parent = $this->resources[$resource]['parent']; if ($parent !== NULL) { unset($this->resources[$parent]['children'][$resource]); } $removed = array($resource); foreach ($this->resources[$resource]['children'] as $child => $foo) { $this->removeResource($child); $removed[] = $child; } foreach ($removed as $resourceRemoved) { foreach ($this->rules['byResource'] as $resourceCurrent => $rules) { if ($resourceRemoved === $resourceCurrent) { unset($this->rules['byResource'][$resourceCurrent]); } } } unset($this->resources[$resource]); return $this; } /** * Removes all Resources. * @return NPermission provides a fluent interface */ public function removeAllResources() { foreach ($this->resources as $resource => $foo) { foreach ($this->rules['byResource'] as $resourceCurrent => $rules) { if ($resource === $resourceCurrent) { unset($this->rules['byResource'][$resourceCurrent]); } } } $this->resources = array(); return $this; } /********************* defining rules ****************d*g**/ /** * Allows one or more Roles access to [certain $privileges upon] the specified Resource(s). * If $assertion is provided, then it must return TRUE in order for rule to apply. * * @param string|array|NPermission::ALL roles * @param string|array|NPermission::ALL resources * @param string|array|NPermission::ALL privileges * @param callback assertion * @return NPermission provides a fluent interface */ public function allow($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL, $assertion = NULL) { $this->setRule(TRUE, self::ALLOW, $roles, $resources, $privileges, $assertion); return $this; } /** * Denies one or more Roles access to [certain $privileges upon] the specified Resource(s). * If $assertion is provided, then it must return TRUE in order for rule to apply. * * @param string|array|NPermission::ALL roles * @param string|array|NPermission::ALL resources * @param string|array|NPermission::ALL privileges * @param callback assertion * @return NPermission provides a fluent interface */ public function deny($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL, $assertion = NULL) { $this->setRule(TRUE, self::DENY, $roles, $resources, $privileges, $assertion); return $this; } /** * Removes "allow" permissions from the list in the context of the given Roles, Resources, and privileges. * * @param string|array|NPermission::ALL roles * @param string|array|NPermission::ALL resources * @param string|array|NPermission::ALL privileges * @return NPermission provides a fluent interface */ public function removeAllow($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL) { $this->setRule(FALSE, self::ALLOW, $roles, $resources, $privileges); return $this; } /** * Removes "deny" restrictions from the list in the context of the given Roles, Resources, and privileges. * * @param string|array|NPermission::ALL roles * @param string|array|NPermission::ALL resources * @param string|array|NPermission::ALL privileges * @return NPermission provides a fluent interface */ public function removeDeny($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL) { $this->setRule(FALSE, self::DENY, $roles, $resources, $privileges); return $this; } /** * Performs operations on Access Control List rules. * @param bool operation add? * @param bool type * @param string|array|NPermission::ALL roles * @param string|array|NPermission::ALL resources * @param string|array|NPermission::ALL privileges * @param callback assertion * @throws InvalidStateException * @return NPermission provides a fluent interface */ protected function setRule($toAdd, $type, $roles, $resources, $privileges, $assertion = NULL) { // ensure that all specified Roles exist; normalize input to array of Roles or NULL if ($roles === self::ALL) { $roles = array(self::ALL); } else { if (!is_array($roles)) { $roles = array($roles); } foreach ($roles as $role) { $this->checkRole($role); } } // ensure that all specified Resources exist; normalize input to array of Resources or NULL if ($resources === self::ALL) { $resources = array(self::ALL); } else { if (!is_array($resources)) { $resources = array($resources); } foreach ($resources as $resource) { $this->checkResource($resource); } } // normalize privileges to array if ($privileges === self::ALL) { $privileges = array(); } elseif (!is_array($privileges)) { $privileges = array($privileges); } $assertion = $assertion ? callback($assertion) : NULL; if ($toAdd) { // add to the rules foreach ($resources as $resource) { foreach ($roles as $role) { $rules = & $this->getRules($resource, $role, TRUE); if (count($privileges) === 0) { $rules['allPrivileges']['type'] = $type; $rules['allPrivileges']['assert'] = $assertion; if (!isset($rules['byPrivilege'])) { $rules['byPrivilege'] = array(); } } else { foreach ($privileges as $privilege) { $rules['byPrivilege'][$privilege]['type'] = $type; $rules['byPrivilege'][$privilege]['assert'] = $assertion; } } } } } else { // remove from the rules foreach ($resources as $resource) { foreach ($roles as $role) { $rules = & $this->getRules($resource, $role); if ($rules === NULL) { continue; } if (count($privileges) === 0) { if ($resource === self::ALL && $role === self::ALL) { if ($type === $rules['allPrivileges']['type']) { $rules = array( 'allPrivileges' => array( 'type' => self::DENY, 'assert' => NULL ), 'byPrivilege' => array() ); } continue; } if ($type === $rules['allPrivileges']['type']) { unset($rules['allPrivileges']); } } else { foreach ($privileges as $privilege) { if (isset($rules['byPrivilege'][$privilege]) && $type === $rules['byPrivilege'][$privilege]['type']) { unset($rules['byPrivilege'][$privilege]); } } } } } } return $this; } /********************* querying the ACL ****************d*g**/ /** * Returns TRUE if and only if the Role has access to [certain $privileges upon] the Resource. * * This method checks Role inheritance using a depth-first traversal of the Role list. * The highest priority parent (i.e., the parent most recently added) is checked first, * and its respective parents are checked similarly before the lower-priority parents of * the Role are checked. * * @param string|NPermission::ALL|IRole role * @param string|NPermission::ALL|IResource resource * @param string|NPermission::ALL privilege * @throws InvalidStateException * @return bool */ public function isAllowed($role = self::ALL, $resource = self::ALL, $privilege = self::ALL) { $this->queriedRole = $role; if ($role !== self::ALL) { if ($role instanceof IRole) { $role = $role->getRoleId(); } $this->checkRole($role); } $this->queriedResource = $resource; if ($resource !== self::ALL) { if ($resource instanceof IResource) { $resource = $resource->getResourceId(); } $this->checkResource($resource); } do { // depth-first search on $role if it is not 'allRoles' pseudo-parent if ($role !== NULL && NULL !== ($result = $this->searchRolePrivileges($privilege === self::ALL, $role, $resource, $privilege))) { break; } if ($privilege === self::ALL) { if ($rules = $this->getRules($resource, self::ALL)) { // look for rule on 'allRoles' psuedo-parent foreach ($rules['byPrivilege'] as $privilege => $rule) { if (self::DENY === ($result = $this->getRuleType($resource, NULL, $privilege))) { break 2; } } if (NULL !== ($result = $this->getRuleType($resource, NULL, NULL))) { break; } } } else { if (NULL !== ($result = $this->getRuleType($resource, NULL, $privilege))) { // look for rule on 'allRoles' pseudo-parent break; } elseif (NULL !== ($result = $this->getRuleType($resource, NULL, NULL))) { break; } } $resource = $this->resources[$resource]['parent']; // try next Resource } while (TRUE); $this->queriedRole = $this->queriedResource = NULL; return $result; } /** * Returns real currently queried Role. Use by assertion. * @return mixed */ public function getQueriedRole() { return $this->queriedRole; } /** * Returns real currently queried Resource. Use by assertion. * @return mixed */ public function getQueriedResource() { return $this->queriedResource; } /********************* internals ****************d*g**/ /** * Performs a depth-first search of the Role DAG, starting at $role, in order to find a rule * allowing/denying $role access to a/all $privilege upon $resource. * @param bool all (true) or one? * @param string * @param string * @param string only for one * @return mixed NULL if no applicable rule is found, otherwise returns ALLOW or DENY */ private function searchRolePrivileges($all, $role, $resource, $privilege) { $dfs = array( 'visited' => array(), 'stack' => array($role), ); while (NULL !== ($role = array_pop($dfs['stack']))) { if (isset($dfs['visited'][$role])) { continue; } if ($all) { if ($rules = $this->getRules($resource, $role)) { foreach ($rules['byPrivilege'] as $privilege2 => $rule) { if (self::DENY === $this->getRuleType($resource, $role, $privilege2)) { return self::DENY; } } if (NULL !== ($type = $this->getRuleType($resource, $role, NULL))) { return $type; } } } else { if (NULL !== ($type = $this->getRuleType($resource, $role, $privilege))) { return $type; } elseif (NULL !== ($type = $this->getRuleType($resource, $role, NULL))) { return $type; } } $dfs['visited'][$role] = TRUE; foreach ($this->roles[$role]['parents'] as $roleParent => $foo) { $dfs['stack'][] = $roleParent; } } return NULL; } /** * Returns the rule type associated with the specified Resource, Role, and privilege. * @param string|NPermission::ALL * @param string|NPermission::ALL * @param string|NPermission::ALL * @return mixed NULL if a rule does not exist or assertion fails, otherwise returns ALLOW or DENY */ private function getRuleType($resource, $role, $privilege) { if (!$rules = $this->getRules($resource, $role)) { return NULL; } if ($privilege === self::ALL) { if (isset($rules['allPrivileges'])) { $rule = $rules['allPrivileges']; } else { return NULL; } } elseif (!isset($rules['byPrivilege'][$privilege])) { return NULL; } else { $rule = $rules['byPrivilege'][$privilege]; } if ($rule['assert'] === NULL || $rule['assert']->__invoke($this, $role, $resource, $privilege)) { return $rule['type']; } elseif ($resource !== self::ALL || $role !== self::ALL || $privilege !== self::ALL) { return NULL; } elseif (self::ALLOW === $rule['type']) { return self::DENY; } else { return self::ALLOW; } } /** * Returns the rules associated with a Resource and a Role, or NULL if no such rules exist. * If the $create parameter is TRUE, then a rule set is first created and then returned to the caller. * @param string|NPermission::ALL * @param string|NPermission::ALL * @param bool * @return array|NULL */ private function & getRules($resource, $role, $create = FALSE) { $null = NULL; if ($resource === self::ALL) { $visitor = & $this->rules['allResources']; } else { if (!isset($this->rules['byResource'][$resource])) { if (!$create) { return $null; } $this->rules['byResource'][$resource] = array(); } $visitor = & $this->rules['byResource'][$resource]; } if ($role === self::ALL) { if (!isset($visitor['allRoles'])) { if (!$create) { return $null; } $visitor['allRoles']['byPrivilege'] = array(); } return $visitor['allRoles']; } if (!isset($visitor['byRole'][$role])) { if (!$create) { return $null; } $visitor['byRole'][$role]['byPrivilege'] = array(); } return $visitor['byRole'][$role]; } }
xlcteam/scoreBoard-php
libs/Nette/Security/Permission.php
PHP
bsd-3-clause
21,685
/* Blue Button */ .btn-blue{ background:#80a9da; background:-webkit-gradient(linear,left top,left bottom,color-stop(#80a9da,0),color-stop(#96c56f,1)); background:-webkit-linear-gradient(top, #80a9da 0%, #6f97c5 100%); background:-moz-linear-gradient(top, #80a9da 0%, #6f97c5 100%); background:-o-linear-gradient(top, #80a9da 0%, #6f97c5 100%); background:linear-gradient(top, #80a9da 0%, #6f97c5 100%); filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#80a9da', endColorstr='#6f97c5',GradientType=0 ); padding-left:90px; padding-right:105px; height:90px; width: 150px; display:inline-block; position:relative; border:1px solid #5d81ab; -webkit-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2); -moz-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2); box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2); -webkit-border-radius:4px; -moz-border-radius:4px; border-radius:4px; float:left; clear:both; margin:10px 0px; overflow:hidden; -webkit-transition:box-shadow 0.3s ease-in-out; -moz-transition:box-shadow 0.3s ease-in-out; -o-transition:box-shadow 0.3s ease-in-out; transition:box-shadow 0.3s ease-in-out; text-decoration: none; color: White; } .btn-blue img{ position:absolute; left:15px; top:13px; border:none; -webkit-transition:all 0.3s ease-in-out; -moz-transition:all 0.3s ease-in-out; -o-transition:all 0.3s ease-in-out; transition:all 0.3s ease-in-out; } .btn-blue .btn-blue-slide-text{ position:absolute; font-size:36px; top:35px; left:18px; color:#bde086; opacity:0; text-shadow:0px 1px 1px rgba(255,255,255,0.4); -webkit-transition:opacity 0.2s ease-in-out; -moz-transition:opacity 0.2s ease-in-out; -o-transition:opacity 0.2s ease-in-out; transition:opacity 0.2s ease-in-out; } .btn-blue-text{ padding-top:13px; padding-left: 13px; display:block; font-size:30px; text-shadow:0px -1px 1px #5d81ab; } .btn-blue-text small{ display:block; font-size:11px; letter-spacing:1px; } .btn-blue-icon-right{ position:absolute; right:0px; top:0px; height:100%; width:80px; border-left:1px solid #5d81ab; -webkit-box-shadow:1px 0px 1px rgba(255,255,255,0.4) inset; -moz-box-shadow:1px 0px 1px rgba(255,255,255,0.4) inset; box-shadow:1px 0px 1px rgba(255,255,255,0.4) inset; } .btn-blue-icon-right span{ width:38px; height:38px; opacity:0.7; -webkit-border-radius:20px; -moz-border-radius:20px; border-radius:20px; position:absolute; left:50%; top:50%; margin:-20px 0px 0px -20px; border:1px solid rgba(0,0,0,0.5); background:#4e5c50 url("../content/arrow_right.png") no-repeat center center; -webkit-box-shadow:0px 1px 1px rgba(255,255,255,0.3) inset, 0px 1px 2px rgba(255,255,255,0.5); -moz-box-shadow:0px 1px 1px rgba(255,255,255,0.3) inset, 0px 1px 2px rgba(255,255,255,0.5); box-shadow:0px 1px 1px rgba(255,255,255,0.3) inset, 0px 1px 2px rgba(255,255,255,0.5); -webkit-transition:all 0.3s ease-in-out; -moz-transition:all 0.3s ease-in-out; -o-transition:all 0.3s ease-in-out; transition:all 0.3s ease-in-out; } .btn-blue:hover{ -webkit-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 5px rgba(0,0,0,0.4); -moz-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 5px rgba(0,0,0,0.4); box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 5px rgba(0,0,0,0.4); text-decoration: none; } .btn-blue:hover img{ -webkit-transform:scale(10); -moz-transform:scale(10); -ms-transform:scale(10); -o-transform:scale(10); transform:scale(10); opacity:0; } .btn-blue:hover .btn-blue-slide-text, .btn-blue:hover .btn-blue-icon-right span{ opacity:1; } .btn-blue:active{ position:relative; top:1px; background:#5d81ab; -webkit-box-shadow:1px 1px 2px rgba(0,0,0,0.4) inset; -moz-box-shadow:1px 1px 2px rgba(0,0,0,0.4) inset; box-shadow:1px 1px 2px rgba(0,0,0,0.4) inset; border-color:#80a9da; } .btn-blue:active .btn-blue-icon-right span{ -webkit-transform:scale(1.4); -moz-transform:scale(1.4); -ms-transform:scale(1.4); -o-transform:scale(1.4); transform:scale(1.4); } /* Green Button */ .btn-green{ background:#a9db80; background:-webkit-gradient(linear,left top,left bottom,color-stop(#a9db80,0),color-stop(#96c56f,1)); background:-webkit-linear-gradient(top, #a9db80 0%, #96c56f 100%); background:-moz-linear-gradient(top, #a9db80 0%, #96c56f 100%); background:-o-linear-gradient(top, #a9db80 0%, #96c56f 100%); background:linear-gradient(top, #a9db80 0%, #96c56f 100%); filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#a9db80', endColorstr='#96c56f',GradientType=0 ); padding-left:90px; padding-right:105px; height:90px; width: 150px; display:inline-block; position:relative; border:1px solid #80ab5d; -webkit-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2); -moz-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2); box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2); -webkit-border-radius:4px; -moz-border-radius:4px; border-radius:4px; float:left; clear:both; margin:10px 0px; overflow:hidden; -webkit-transition:box-shadow 0.3s ease-in-out; -moz-transition:box-shadow 0.3s ease-in-out; -o-transition:box-shadow 0.3s ease-in-out; transition:box-shadow 0.3s ease-in-out; text-decoration: none; color: White; } .btn-green img{ position:absolute; left:15px; top:13px; border:none; -webkit-transition:all 0.3s ease-in-out; -moz-transition:all 0.3s ease-in-out; -o-transition:all 0.3s ease-in-out; transition:all 0.3s ease-in-out; } .btn-green .btn-green-slide-text{ position:absolute; font-size:36px; top:35px; left:18px; color:#6d954e; opacity:0; text-shadow:0px 1px 1px rgba(255,255,255,0.4); -webkit-transition:opacity 0.2s ease-in-out; -moz-transition:opacity 0.2s ease-in-out; -o-transition:opacity 0.2s ease-in-out; transition:opacity 0.2s ease-in-out; } .btn-green-text{ padding-top:13px; padding-left: 13px; display:block; font-size:30px; text-shadow:0px -1px 1px #80ab5d; } .btn-green-text small{ display:block; font-size:11px; letter-spacing:1px; } .btn-green-icon-right{ position:absolute; right:0px; top:0px; height:100%; width:80px; border-left:1px solid #80ab5d; -webkit-box-shadow:1px 0px 1px rgba(255,255,255,0.4) inset; -moz-box-shadow:1px 0px 1px rgba(255,255,255,0.4) inset; box-shadow:1px 0px 1px rgba(255,255,255,0.4) inset; } .btn-green-icon-right span{ width:38px; height:38px; opacity:0.7; -webkit-border-radius:20px; -moz-border-radius:20px; border-radius:20px; position:absolute; left:50%; top:50%; margin:-20px 0px 0px -20px; border:1px solid rgba(0,0,0,0.5); background:#4e5c50 url("../content/arrow_right.png") no-repeat center center; -webkit-box-shadow:0px 1px 1px rgba(255,255,255,0.3) inset, 0px 1px 2px rgba(255,255,255,0.5); -moz-box-shadow:0px 1px 1px rgba(255,255,255,0.3) inset, 0px 1px 2px rgba(255,255,255,0.5); box-shadow:0px 1px 1px rgba(255,255,255,0.3) inset, 0px 1px 2px rgba(255,255,255,0.5); -webkit-transition:all 0.3s ease-in-out; -moz-transition:all 0.3s ease-in-out; -o-transition:all 0.3s ease-in-out; transition:all 0.3s ease-in-out; } .btn-green:hover{ -webkit-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 5px rgba(0,0,0,0.4); -moz-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 5px rgba(0,0,0,0.4); box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 5px rgba(0,0,0,0.4); text-decoration: none; } .btn-green:hover img{ -webkit-transform:scale(10); -moz-transform:scale(10); -ms-transform:scale(10); -o-transform:scale(10); transform:scale(10); opacity:0; } .btn-green:hover .btn-green-slide-text, .btn-green:hover .btn-green-icon-right span{ opacity:1; } .btn-green:active{ position:relative; top:1px; background:#80ab5d; -webkit-box-shadow:1px 1px 2px rgba(0,0,0,0.4) inset; -moz-box-shadow:1px 1px 2px rgba(0,0,0,0.4) inset; box-shadow:1px 1px 2px rgba(0,0,0,0.4) inset; border-color:#a9db80; } .btn-green:active .btn-green-icon-right span{ -webkit-transform:scale(1.4); -moz-transform:scale(1.4); -ms-transform:scale(1.4); -o-transform:scale(1.4); transform:scale(1.4); } /* Long Blue Button */ .btn-long-blue{ background:#80a9da; background:-webkit-gradient(linear,left top,left bottom,color-stop(#80a9da,0),color-stop(#6f97c5,1)); background:-webkit-linear-gradient(top, #80a9da 0%, #6f97c5 100%); background:-moz-linear-gradient(top, #80a9da 0%, #6f97c5 100%); background:-o-linear-gradient(top, #80a9da 0%, #6f97c5 100%); background:linear-gradient(top, #80a9da 0%, #6f97c5 100%); filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#80a9da', endColorstr='#6f97c5',GradientType=0 ); padding-left:20px; padding-right:80px; height:38px; display:inline-block; position:relative; border:1px solid #5d81ab; -webkit-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2), 0px 0px 0px 4px rgba(188,188,188,0.5); -moz-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2), 0px 0px 0px 4px rgba(188,188,188,0.5); box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2), 0px 0px 0px 4px rgba(188,188,188,0.5); -webkit-border-radius:20px; -moz-border-radius:20px; border-radius:20px; float:left; clear:both; margin:10px 0px; overflow:hidden; -webkit-transition:all 0.3s linear; -moz-transition:all 0.3s linear; -o-transition:all 0.3s linear; transition:all 0.3s linear; } .btn-long-blue-text{ padding-top:5px; display:block; font-size:18px; white-space:nowrap; text-shadow:0px 1px 1px rgba(255,255,255,0.3); color:#446388; -webkit-transition:all 0.2s linear; -moz-transition:all 0.2s linear; -o-transition:all 0.2s linear; transition:all 0.2s linear; } .btn-long-blue-slide-text{ position:absolute; height:100%; top:0px; right:52px; width:0px; background:#63707e; text-shadow:0px -1px 1px #363f49; color:#fff; font-size:18px; white-space:nowrap; text-transform:uppercase; text-align:left; text-indent:10px; overflow:hidden; line-height:38px; -webkit-box-shadow:-1px 0px 1px rgba(255,255,255,0.4), 1px 1px 2px rgba(0,0,0,0.2) inset; -moz-box-shadow:-1px 0px 1px rgba(255,255,255,0.4), 1px 1px 2px rgba(0,0,0,0.2) inset; box-shadow:-1px 0px 1px rgba(255,255,255,0.4), 1px 1px 2px rgba(0,0,0,0.2) inset; -webkit-transition:width 0.3s linear; -moz-transition:width 0.3s linear; -o-transition:width 0.3s linear; transition:width 0.3s linear; } .btn-long-blue-icon-right{ position:absolute; right:0px; top:0px; height:100%; width:52px; border-left:1px solid #5d81ab; -webkit-box-shadow:1px 0px 1px rgba(255,255,255,0.4) inset; -moz-box-shadow:1px 0px 1px rgba(255,255,255,0.4) inset; box-shadow:1px 0px 1px rgba(255,255,255,0.4) inset; } .btn-long-blue-icon-right span{ width:38px; height:38px; opacity:0.7; position:absolute; left:50%; top:50%; margin:-20px 0px 0px -20px; background:transparent url(../content/arrow_right.png) no-repeat 50% 55%; -webkit-transition:all 0.3s linear; -moz-transition:all 0.3s linear; -o-transition:all 0.3s linear; transition:all 0.3s linear; } .btn-long-blue:hover{ padding-right:180px; -webkit-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2); -moz-box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2); box-shadow:0px 1px 1px rgba(255,255,255,0.8) inset, 1px 1px 3px rgba(0,0,0,0.2); } .btn-long-blue:hover .btn-long-blue-text{ text-shadow:0px 1px 1px #5d81ab; color:#fff; } .btn-long-blue:hover .btn-long-blue-slide-text{ width:100px; } .btn-long-blue:hover .btn-long-blue-icon-right span{ opacity:1; } .btn-long-blue:active{ position:relative; top:1px; background:#5d81ab; -webkit-box-shadow:1px 1px 2px rgba(0,0,0,0.4) inset; -moz-box-shadow:1px 1px 2px rgba(0,0,0,0.4) inset; box-shadow:1px 1px 2px rgba(0,0,0,0.4) inset; border-color:#80a9da; }
ryankeeter/Orchard-Theme
Themes/AdvancedSimplicity/Styles/Buttons.css
CSS
bsd-3-clause
12,893
#pragma once #include "cutlass/cutlass.h" #include "cutlass/conv/convolution.h" #include "cutlass/conv/conv2d_problem_size.h" #include "cutlass/conv/conv3d_problem_size.h" #include "cutlass/layout/tensor.h" #include "cutlass/layout/matrix.h" #include "cutlass/tensor_ref.h" namespace cutlass { namespace epilogue { namespace threadblock { template< typename TensorLayout_, ///! The original output tensor layout typename OutputIteratorLayout_, ///! Layout used by epilogue output iterator typename TensorRef_, ///! Input tensor to epilogue output iterator conv::Operator ConvOperator, ///! Convolutional operator (Fprop, Dgrad, Wgrad) typename ConvProblemSize_ ///! Convolutional operator on 2D or 3D problem > struct ConvOutputIteratorParameter { using TensorLayout = TensorLayout_; using OutputIteratorLayout = OutputIteratorLayout_; using OutputTensorCoord = typename OutputIteratorLayout::TensorCoord; using TensorRef = TensorRef_; static conv::Operator const kConvolutionalOperator = ConvOperator; using ConvProblemSize = ConvProblemSize_; /// Wgrad stride idx for implicit gemm algorithm // Conv2d row-major matrix (KxRSC) // Conv3d row-major matrix (KxTRSC) static int const kWgradStrideIdx = platform::is_same<TensorLayout, layout::TensorNHWC>::value ? 2 : 3; /// This chooses the appropriate stride element of the C tensor. static int const kTensorStrideIdx = (kConvolutionalOperator == conv::Operator::kWgrad ? kWgradStrideIdx : 0); CUTLASS_HOST_DEVICE static OutputIteratorLayout layout(const TensorRef & ref) { return ref.stride(kTensorStrideIdx); } CUTLASS_HOST_DEVICE static OutputTensorCoord extent(ConvProblemSize problem_size) { return conv::implicit_gemm_problem_size(kConvolutionalOperator, problem_size).mn(); } }; template < int InterleavedK, typename TensorRef_, conv::Operator ConvOperator, typename ConvProblemSize_ > struct ConvOutputIteratorParameter< layout::TensorNCxHWx<InterleavedK>, layout::TensorNCxHWx<InterleavedK>, TensorRef_, ConvOperator, ConvProblemSize_> { using TensorLayout = typename layout::TensorNCxHWx<InterleavedK>; using OutputIteratorLayout = typename layout::TensorNCxHWx<InterleavedK>; using OutputTensorCoord = typename OutputIteratorLayout::TensorCoord; using TensorRef = TensorRef_; static conv::Operator const kConvolutionalOperator = ConvOperator; using ConvProblemSize = ConvProblemSize_; CUTLASS_HOST_DEVICE static OutputIteratorLayout layout(const TensorRef & ref) { return ref.stride(); } CUTLASS_HOST_DEVICE static OutputTensorCoord extent(ConvProblemSize problem_size) { return problem_size.output_extent(); } }; } // namespace threadblock } // namespace epilogue } // namespace cutlass
NVIDIA/cutlass
include/cutlass/epilogue/threadblock/output_iterator_parameter.h
C
bsd-3-clause
2,912
<div class="" > <div class="card blue-grey darken-1"> <div class="card-content white-text"> <a href="post/{{post.slug}}"><span class="card-title">{{post.title}}</span></a> <div ng-bind-html="post.content | trustHtmlExample"></div> </div> <div class="card-action"> <a href="post/{{post.slug}}">{{post.date | date}}</a> </div> </div> </div>
bhargav175/materialhtml5
assets/js/angularTemplates/post.html
HTML
bsd-3-clause
396
/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 3.7.3 build: 3.7.3 */ YUI.add("lang/console_en",function(e){e.Intl.add("console","en",{title:"Log Console",pause:"Pause",clear:"Clear",collapse:"Collapse",expand:"Expand"})},"3.7.3");
giros/alloy-ui
build/console/lang/console_en.js
JavaScript
bsd-3-clause
330
/* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkCanvas.h" #include "SkDrawLooper.h" #include "SkTypes.h" #include "Test.h" /* * Subclass of looper that just draws once, with an offset in X. */ class TestLooper : public SkDrawLooper { public: SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVERRIDE { return SkNEW_PLACEMENT(storage, TestDrawLooperContext); } size_t contextSize() const SK_OVERRIDE { return sizeof(TestDrawLooperContext); } #ifndef SK_IGNORE_TO_STRING void toString(SkString* str) const SK_OVERRIDE { str->append("TestLooper:"); } #endif SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestLooper); private: class TestDrawLooperContext : public SkDrawLooper::Context { public: TestDrawLooperContext() : fOnce(true) {} virtual ~TestDrawLooperContext() {} bool next(SkCanvas* canvas, SkPaint*) SK_OVERRIDE { if (fOnce) { fOnce = false; canvas->translate(SkIntToScalar(10), 0); return true; } return false; } private: bool fOnce; }; }; SkFlattenable* TestLooper::CreateProc(SkReadBuffer&) { return SkNEW(TestLooper); } static void test_drawBitmap(skiatest::Reporter* reporter) { SkBitmap src; src.allocN32Pixels(10, 10); src.eraseColor(SK_ColorWHITE); SkBitmap dst; dst.allocN32Pixels(10, 10); dst.eraseColor(SK_ColorTRANSPARENT); SkCanvas canvas(dst); SkPaint paint; // we are initially transparent REPORTER_ASSERT(reporter, 0 == *dst.getAddr32(5, 5)); // we see the bitmap drawn canvas.drawBitmap(src, 0, 0, &paint); REPORTER_ASSERT(reporter, 0xFFFFFFFF == *dst.getAddr32(5, 5)); // reverify we are clear again dst.eraseColor(SK_ColorTRANSPARENT); REPORTER_ASSERT(reporter, 0 == *dst.getAddr32(5, 5)); // if the bitmap is clipped out, we don't draw it canvas.drawBitmap(src, SkIntToScalar(-10), 0, &paint); REPORTER_ASSERT(reporter, 0 == *dst.getAddr32(5, 5)); // now install our looper, which will draw, since it internally translates // to the left. The test is to ensure that canvas' quickReject machinary // allows us through, even though sans-looper we would look like we should // be clipped out. paint.setLooper(new TestLooper)->unref(); canvas.drawBitmap(src, SkIntToScalar(-10), 0, &paint); REPORTER_ASSERT(reporter, 0xFFFFFFFF == *dst.getAddr32(5, 5)); } static void test_layers(skiatest::Reporter* reporter) { SkCanvas canvas(100, 100); SkRect r = SkRect::MakeWH(10, 10); REPORTER_ASSERT(reporter, false == canvas.quickReject(r)); r.offset(300, 300); REPORTER_ASSERT(reporter, true == canvas.quickReject(r)); // Test that saveLayer updates quickReject SkRect bounds = SkRect::MakeLTRB(50, 50, 70, 70); canvas.saveLayer(&bounds, NULL); REPORTER_ASSERT(reporter, true == canvas.quickReject(SkRect::MakeWH(10, 10))); REPORTER_ASSERT(reporter, false == canvas.quickReject(SkRect::MakeWH(60, 60))); } DEF_TEST(QuickReject, reporter) { test_drawBitmap(reporter); test_layers(reporter); }
sgraham/nope
third_party/skia/tests/QuickRejectTest.cpp
C++
bsd-3-clause
3,302
// // Copyright 2016 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // Context11: // D3D11-specific functionality associated with a GL Context. // #include "libANGLE/renderer/d3d/d3d11/Context11.h" #include "common/string_utils.h" #include "libANGLE/Context.h" #include "libANGLE/MemoryProgramCache.h" #include "libANGLE/renderer/OverlayImpl.h" #include "libANGLE/renderer/d3d/CompilerD3D.h" #include "libANGLE/renderer/d3d/RenderbufferD3D.h" #include "libANGLE/renderer/d3d/SamplerD3D.h" #include "libANGLE/renderer/d3d/ShaderD3D.h" #include "libANGLE/renderer/d3d/TextureD3D.h" #include "libANGLE/renderer/d3d/d3d11/Buffer11.h" #include "libANGLE/renderer/d3d/d3d11/Fence11.h" #include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h" #include "libANGLE/renderer/d3d/d3d11/IndexBuffer11.h" #include "libANGLE/renderer/d3d/d3d11/Program11.h" #include "libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/StateManager11.h" #include "libANGLE/renderer/d3d/d3d11/TransformFeedback11.h" #include "libANGLE/renderer/d3d/d3d11/VertexArray11.h" #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" namespace rx { namespace { ANGLE_INLINE bool DrawCallHasDynamicAttribs(const gl::Context *context) { VertexArray11 *vertexArray11 = GetImplAs<VertexArray11>(context->getState().getVertexArray()); return vertexArray11->hasActiveDynamicAttrib(context); } bool DrawCallHasStreamingVertexArrays(const gl::Context *context, gl::PrimitiveMode mode) { // Direct drawing doesn't support dynamic attribute storage since it needs the first and count // to translate when applyVertexBuffer. GL_LINE_LOOP and GL_TRIANGLE_FAN are not supported // either since we need to simulate them in D3D. if (DrawCallHasDynamicAttribs(context) || mode == gl::PrimitiveMode::LineLoop || mode == gl::PrimitiveMode::TriangleFan) { return true; } ProgramD3D *programD3D = GetImplAs<ProgramD3D>(context->getState().getProgram()); if (InstancedPointSpritesActive(programD3D, mode)) { return true; } return false; } bool DrawCallHasStreamingElementArray(const gl::Context *context, gl::DrawElementsType srcType) { const gl::State &glState = context->getState(); gl::Buffer *elementArrayBuffer = glState.getVertexArray()->getElementArrayBuffer(); bool primitiveRestartWorkaround = UsePrimitiveRestartWorkaround(glState.isPrimitiveRestartEnabled(), srcType); const gl::DrawElementsType dstType = (srcType == gl::DrawElementsType::UnsignedInt || primitiveRestartWorkaround) ? gl::DrawElementsType::UnsignedInt : gl::DrawElementsType::UnsignedShort; // Not clear where the offset comes from here. switch (ClassifyIndexStorage(glState, elementArrayBuffer, srcType, dstType, 0)) { case IndexStorageType::Dynamic: return true; case IndexStorageType::Direct: return false; case IndexStorageType::Static: { BufferD3D *bufferD3D = GetImplAs<BufferD3D>(elementArrayBuffer); StaticIndexBufferInterface *staticBuffer = bufferD3D->getStaticIndexBuffer(); return (staticBuffer->getBufferSize() == 0 || staticBuffer->getIndexType() != dstType); } default: UNREACHABLE(); return true; } } template <typename IndirectBufferT> angle::Result ReadbackIndirectBuffer(const gl::Context *context, const void *indirect, const IndirectBufferT **bufferPtrOut) { const gl::State &glState = context->getState(); gl::Buffer *drawIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DrawIndirect); ASSERT(drawIndirectBuffer); Buffer11 *storage = GetImplAs<Buffer11>(drawIndirectBuffer); uintptr_t offset = reinterpret_cast<uintptr_t>(indirect); const uint8_t *bufferData = nullptr; ANGLE_TRY(storage->getData(context, &bufferData)); ASSERT(bufferData); *bufferPtrOut = reinterpret_cast<const IndirectBufferT *>(bufferData + offset); return angle::Result::Continue; } } // anonymous namespace Context11::Context11(const gl::State &state, gl::ErrorSet *errorSet, Renderer11 *renderer) : ContextD3D(state, errorSet), mRenderer(renderer) {} Context11::~Context11() {} angle::Result Context11::initialize() { return angle::Result::Continue; } void Context11::onDestroy(const gl::Context *context) { mIncompleteTextures.onDestroy(context); } CompilerImpl *Context11::createCompiler() { if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3) { return new CompilerD3D(SH_HLSL_4_0_FL9_3_OUTPUT); } else { return new CompilerD3D(SH_HLSL_4_1_OUTPUT); } } ShaderImpl *Context11::createShader(const gl::ShaderState &data) { return new ShaderD3D(data, mRenderer->getFeatures(), mRenderer->getNativeExtensions()); } ProgramImpl *Context11::createProgram(const gl::ProgramState &data) { return new Program11(data, mRenderer); } FramebufferImpl *Context11::createFramebuffer(const gl::FramebufferState &data) { return new Framebuffer11(data, mRenderer); } TextureImpl *Context11::createTexture(const gl::TextureState &state) { switch (state.getType()) { case gl::TextureType::_2D: // GL_TEXTURE_VIDEO_IMAGE_WEBGL maps to native 2D texture on Windows platform case gl::TextureType::VideoImage: return new TextureD3D_2D(state, mRenderer); case gl::TextureType::CubeMap: return new TextureD3D_Cube(state, mRenderer); case gl::TextureType::_3D: return new TextureD3D_3D(state, mRenderer); case gl::TextureType::_2DArray: return new TextureD3D_2DArray(state, mRenderer); case gl::TextureType::External: return new TextureD3D_External(state, mRenderer); case gl::TextureType::_2DMultisample: return new TextureD3D_2DMultisample(state, mRenderer); case gl::TextureType::_2DMultisampleArray: return new TextureD3D_2DMultisampleArray(state, mRenderer); default: UNREACHABLE(); } return nullptr; } RenderbufferImpl *Context11::createRenderbuffer(const gl::RenderbufferState &state) { return new RenderbufferD3D(state, mRenderer); } BufferImpl *Context11::createBuffer(const gl::BufferState &state) { Buffer11 *buffer = new Buffer11(state, mRenderer); mRenderer->onBufferCreate(buffer); return buffer; } VertexArrayImpl *Context11::createVertexArray(const gl::VertexArrayState &data) { return new VertexArray11(data); } QueryImpl *Context11::createQuery(gl::QueryType type) { return new Query11(mRenderer, type); } FenceNVImpl *Context11::createFenceNV() { return new FenceNV11(mRenderer); } SyncImpl *Context11::createSync() { return new Sync11(mRenderer); } TransformFeedbackImpl *Context11::createTransformFeedback(const gl::TransformFeedbackState &state) { return new TransformFeedback11(state, mRenderer); } SamplerImpl *Context11::createSampler(const gl::SamplerState &state) { return new SamplerD3D(state); } ProgramPipelineImpl *Context11::createProgramPipeline(const gl::ProgramPipelineState &data) { return new ProgramPipeline11(data); } MemoryObjectImpl *Context11::createMemoryObject() { UNREACHABLE(); return nullptr; } SemaphoreImpl *Context11::createSemaphore() { UNREACHABLE(); return nullptr; } OverlayImpl *Context11::createOverlay(const gl::OverlayState &state) { // Not implemented. return new OverlayImpl(state); } angle::Result Context11::flush(const gl::Context *context) { return mRenderer->flush(this); } angle::Result Context11::finish(const gl::Context *context) { return mRenderer->finish(this); } angle::Result Context11::drawArrays(const gl::Context *context, gl::PrimitiveMode mode, GLint first, GLsizei count) { ASSERT(count > 0); ANGLE_TRY(mRenderer->getStateManager()->updateState( context, mode, first, count, gl::DrawElementsType::InvalidEnum, nullptr, 0, 0)); return mRenderer->drawArrays(context, mode, first, count, 0, 0); } angle::Result Context11::drawArraysInstanced(const gl::Context *context, gl::PrimitiveMode mode, GLint first, GLsizei count, GLsizei instanceCount) { ASSERT(count > 0); ANGLE_TRY(mRenderer->getStateManager()->updateState( context, mode, first, count, gl::DrawElementsType::InvalidEnum, nullptr, instanceCount, 0)); return mRenderer->drawArrays(context, mode, first, count, instanceCount, 0); } angle::Result Context11::drawArraysInstancedBaseInstance(const gl::Context *context, gl::PrimitiveMode mode, GLint first, GLsizei count, GLsizei instanceCount, GLuint baseInstance) { ASSERT(count > 0); ANGLE_TRY(mRenderer->getStateManager()->updateState( context, mode, first, count, gl::DrawElementsType::InvalidEnum, nullptr, instanceCount, 0)); return mRenderer->drawArrays(context, mode, first, count, instanceCount, baseInstance); } ANGLE_INLINE angle::Result Context11::drawElementsImpl(const gl::Context *context, gl::PrimitiveMode mode, GLsizei indexCount, gl::DrawElementsType indexType, const void *indices, GLsizei instanceCount, GLint baseVertex, GLuint baseInstance) { ASSERT(indexCount > 0); if (DrawCallHasDynamicAttribs(context)) { gl::IndexRange indexRange; ANGLE_TRY(context->getState().getVertexArray()->getIndexRange( context, indexType, indexCount, indices, &indexRange)); GLint startVertex; ANGLE_TRY(ComputeStartVertex(GetImplAs<Context11>(context), indexRange, baseVertex, &startVertex)); ANGLE_TRY(mRenderer->getStateManager()->updateState( context, mode, startVertex, indexCount, indexType, indices, instanceCount, baseVertex)); return mRenderer->drawElements(context, mode, startVertex, indexCount, indexType, indices, instanceCount, baseVertex, baseInstance); } else { ANGLE_TRY(mRenderer->getStateManager()->updateState(context, mode, 0, indexCount, indexType, indices, instanceCount, baseVertex)); return mRenderer->drawElements(context, mode, 0, indexCount, indexType, indices, instanceCount, baseVertex, baseInstance); } } angle::Result Context11::drawElements(const gl::Context *context, gl::PrimitiveMode mode, GLsizei count, gl::DrawElementsType type, const void *indices) { return drawElementsImpl(context, mode, count, type, indices, 0, 0, 0); } angle::Result Context11::drawElementsBaseVertex(const gl::Context *context, gl::PrimitiveMode mode, GLsizei count, gl::DrawElementsType type, const void *indices, GLint baseVertex) { return drawElementsImpl(context, mode, count, type, indices, 0, baseVertex, 0); } angle::Result Context11::drawElementsInstanced(const gl::Context *context, gl::PrimitiveMode mode, GLsizei count, gl::DrawElementsType type, const void *indices, GLsizei instances) { return drawElementsImpl(context, mode, count, type, indices, instances, 0, 0); } angle::Result Context11::drawElementsInstancedBaseVertex(const gl::Context *context, gl::PrimitiveMode mode, GLsizei count, gl::DrawElementsType type, const void *indices, GLsizei instances, GLint baseVertex) { return drawElementsImpl(context, mode, count, type, indices, instances, baseVertex, 0); } angle::Result Context11::drawElementsInstancedBaseVertexBaseInstance(const gl::Context *context, gl::PrimitiveMode mode, GLsizei count, gl::DrawElementsType type, const void *indices, GLsizei instances, GLint baseVertex, GLuint baseInstance) { return drawElementsImpl(context, mode, count, type, indices, instances, baseVertex, baseInstance); } angle::Result Context11::drawRangeElements(const gl::Context *context, gl::PrimitiveMode mode, GLuint start, GLuint end, GLsizei count, gl::DrawElementsType type, const void *indices) { return drawElementsImpl(context, mode, count, type, indices, 0, 0, 0); } angle::Result Context11::drawRangeElementsBaseVertex(const gl::Context *context, gl::PrimitiveMode mode, GLuint start, GLuint end, GLsizei count, gl::DrawElementsType type, const void *indices, GLint baseVertex) { return drawElementsImpl(context, mode, count, type, indices, 0, baseVertex, 0); } angle::Result Context11::drawArraysIndirect(const gl::Context *context, gl::PrimitiveMode mode, const void *indirect) { if (DrawCallHasStreamingVertexArrays(context, mode)) { const gl::DrawArraysIndirectCommand *cmd = nullptr; ANGLE_TRY(ReadbackIndirectBuffer(context, indirect, &cmd)); ANGLE_TRY(mRenderer->getStateManager()->updateState(context, mode, cmd->first, cmd->count, gl::DrawElementsType::InvalidEnum, nullptr, cmd->instanceCount, 0)); return mRenderer->drawArrays(context, mode, cmd->first, cmd->count, cmd->instanceCount, cmd->baseInstance); } else { ANGLE_TRY(mRenderer->getStateManager()->updateState( context, mode, 0, 0, gl::DrawElementsType::InvalidEnum, nullptr, 0, 0)); return mRenderer->drawArraysIndirect(context, indirect); } } angle::Result Context11::drawElementsIndirect(const gl::Context *context, gl::PrimitiveMode mode, gl::DrawElementsType type, const void *indirect) { if (DrawCallHasStreamingVertexArrays(context, mode) || DrawCallHasStreamingElementArray(context, type)) { const gl::DrawElementsIndirectCommand *cmd = nullptr; ANGLE_TRY(ReadbackIndirectBuffer(context, indirect, &cmd)); const GLuint typeBytes = gl::GetDrawElementsTypeSize(type); const void *indices = reinterpret_cast<const void *>(static_cast<uintptr_t>(cmd->firstIndex * typeBytes)); // We must explicitly resolve the index range for the slow-path indirect drawElements to // make sure we are using the correct 'baseVertex'. This parameter does not exist for the // direct drawElements. gl::IndexRange indexRange; ANGLE_TRY(context->getState().getVertexArray()->getIndexRange(context, type, cmd->count, indices, &indexRange)); GLint startVertex; ANGLE_TRY(ComputeStartVertex(GetImplAs<Context11>(context), indexRange, cmd->baseVertex, &startVertex)); ANGLE_TRY(mRenderer->getStateManager()->updateState(context, mode, startVertex, cmd->count, type, indices, cmd->primCount, cmd->baseVertex)); return mRenderer->drawElements(context, mode, static_cast<GLint>(indexRange.start), cmd->count, type, indices, cmd->primCount, 0, 0); } else { ANGLE_TRY( mRenderer->getStateManager()->updateState(context, mode, 0, 0, type, nullptr, 0, 0)); return mRenderer->drawElementsIndirect(context, indirect); } } gl::GraphicsResetStatus Context11::getResetStatus() { return mRenderer->getResetStatus(); } std::string Context11::getVendorString() const { return mRenderer->getVendorString(); } std::string Context11::getRendererDescription() const { return mRenderer->getRendererDescription(); } angle::Result Context11::insertEventMarker(GLsizei length, const char *marker) { mRenderer->getAnnotator()->setMarker(marker); return angle::Result::Continue; } angle::Result Context11::pushGroupMarker(GLsizei length, const char *marker) { mRenderer->getAnnotator()->beginEvent(marker, marker); mMarkerStack.push(std::string(marker)); return angle::Result::Continue; } angle::Result Context11::popGroupMarker() { const char *marker = nullptr; if (!mMarkerStack.empty()) { marker = mMarkerStack.top().c_str(); mMarkerStack.pop(); mRenderer->getAnnotator()->endEvent(marker); } return angle::Result::Continue; } angle::Result Context11::pushDebugGroup(const gl::Context *context, GLenum source, GLuint id, const std::string &message) { // Fall through to the EXT_debug_marker functions return pushGroupMarker(static_cast<GLsizei>(message.size()), message.c_str()); } angle::Result Context11::popDebugGroup(const gl::Context *context) { // Fall through to the EXT_debug_marker functions return popGroupMarker(); } angle::Result Context11::syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits, const gl::State::DirtyBits &bitMask) { mRenderer->getStateManager()->syncState(context, dirtyBits); return angle::Result::Continue; } GLint Context11::getGPUDisjoint() { return mRenderer->getGPUDisjoint(); } GLint64 Context11::getTimestamp() { return mRenderer->getTimestamp(); } angle::Result Context11::onMakeCurrent(const gl::Context *context) { return mRenderer->getStateManager()->onMakeCurrent(context); } gl::Caps Context11::getNativeCaps() const { gl::Caps caps = mRenderer->getNativeCaps(); // For pixel shaders, the render targets and unordered access views share the same resource // slots, so the maximum number of fragment shader outputs depends on the current context // version: // - If current context is ES 3.0 and below, we use D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT(8) // as the value of max draw buffers because UAVs are not used. // - If current context is ES 3.1 and the feature level is 11_0, the RTVs and UAVs share 8 // slots. As ES 3.1 requires at least 1 atomic counter buffer in compute shaders, the value // of max combined shader output resources is limited to 7, thus only 7 RTV slots can be // used simultaneously. // - If current context is ES 3.1 and the feature level is 11_1, the RTVs and UAVs share 64 // slots. Currently we allocate 60 slots for combined shader output resources, so we can use // at most D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT(8) RTVs simultaneously. if (mState.getClientVersion() >= gl::ES_3_1 && mRenderer->getRenderer11DeviceCaps().featureLevel == D3D_FEATURE_LEVEL_11_0) { caps.maxDrawBuffers = caps.maxCombinedShaderOutputResources; caps.maxColorAttachments = caps.maxCombinedShaderOutputResources; } return caps; } const gl::TextureCapsMap &Context11::getNativeTextureCaps() const { return mRenderer->getNativeTextureCaps(); } const gl::Extensions &Context11::getNativeExtensions() const { return mRenderer->getNativeExtensions(); } const gl::Limitations &Context11::getNativeLimitations() const { return mRenderer->getNativeLimitations(); } angle::Result Context11::dispatchCompute(const gl::Context *context, GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ) { return mRenderer->dispatchCompute(context, numGroupsX, numGroupsY, numGroupsZ); } angle::Result Context11::dispatchComputeIndirect(const gl::Context *context, GLintptr indirect) { return mRenderer->dispatchComputeIndirect(context, indirect); } angle::Result Context11::triggerDrawCallProgramRecompilation(const gl::Context *context, gl::PrimitiveMode drawMode) { const auto &glState = context->getState(); const auto *va11 = GetImplAs<VertexArray11>(glState.getVertexArray()); const auto *drawFBO = glState.getDrawFramebuffer(); gl::Program *program = glState.getProgram(); ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program); programD3D->updateCachedInputLayout(va11->getCurrentStateSerial(), glState); programD3D->updateCachedOutputLayout(context, drawFBO); bool recompileVS = !programD3D->hasVertexExecutableForCachedInputLayout(); bool recompileGS = !programD3D->hasGeometryExecutableForPrimitiveType(glState, drawMode); bool recompilePS = !programD3D->hasPixelExecutableForCachedOutputLayout(); if (!recompileVS && !recompileGS && !recompilePS) { return angle::Result::Continue; } // Load the compiler if necessary and recompile the programs. ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized(this)); gl::InfoLog infoLog; if (recompileVS) { ShaderExecutableD3D *vertexExe = nullptr; ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(this, &vertexExe, &infoLog)); if (!programD3D->hasVertexExecutableForCachedInputLayout()) { ASSERT(infoLog.getLength() > 0); ERR() << "Error compiling dynamic vertex executable: " << infoLog.str(); ANGLE_TRY_HR(this, E_FAIL, "Error compiling dynamic vertex executable"); } } if (recompileGS) { ShaderExecutableD3D *geometryExe = nullptr; ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(this, glState, drawMode, &geometryExe, &infoLog)); if (!programD3D->hasGeometryExecutableForPrimitiveType(glState, drawMode)) { ASSERT(infoLog.getLength() > 0); ERR() << "Error compiling dynamic geometry executable: " << infoLog.str(); ANGLE_TRY_HR(this, E_FAIL, "Error compiling dynamic geometry executable"); } } if (recompilePS) { ShaderExecutableD3D *pixelExe = nullptr; ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(this, &pixelExe, &infoLog)); if (!programD3D->hasPixelExecutableForCachedOutputLayout()) { ASSERT(infoLog.getLength() > 0); ERR() << "Error compiling dynamic pixel executable: " << infoLog.str(); ANGLE_TRY_HR(this, E_FAIL, "Error compiling dynamic pixel executable"); } } // Refresh the program cache entry. if (mMemoryProgramCache) { ANGLE_TRY(mMemoryProgramCache->updateProgram(context, program)); } return angle::Result::Continue; } angle::Result Context11::triggerDispatchCallProgramRecompilation(const gl::Context *context) { const auto &glState = context->getState(); gl::Program *program = glState.getProgram(); ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program); programD3D->updateCachedComputeImage2DBindLayout(context); bool recompileCS = !programD3D->hasComputeExecutableForCachedImage2DBindLayout(); if (!recompileCS) { return angle::Result::Continue; } // Load the compiler if necessary and recompile the programs. ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized(this)); gl::InfoLog infoLog; ShaderExecutableD3D *computeExe = nullptr; ANGLE_TRY(programD3D->getComputeExecutableForImage2DBindLayout(this, &computeExe, &infoLog)); if (!programD3D->hasComputeExecutableForCachedImage2DBindLayout()) { ASSERT(infoLog.getLength() > 0); ERR() << "Dynamic recompilation error log: " << infoLog.str(); ANGLE_TRY_HR(this, E_FAIL, "Error compiling dynamic compute executable"); } // Refresh the program cache entry. if (mMemoryProgramCache) { ANGLE_TRY(mMemoryProgramCache->updateProgram(context, program)); } return angle::Result::Continue; } angle::Result Context11::memoryBarrier(const gl::Context *context, GLbitfield barriers) { return angle::Result::Continue; } angle::Result Context11::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) { return angle::Result::Continue; } angle::Result Context11::getIncompleteTexture(const gl::Context *context, gl::TextureType type, gl::Texture **textureOut) { return mIncompleteTextures.getIncompleteTexture(context, type, this, textureOut); } angle::Result Context11::initializeMultisampleTextureToBlack(const gl::Context *context, gl::Texture *glTexture) { ASSERT(glTexture->getType() == gl::TextureType::_2DMultisample); TextureD3D *textureD3D = GetImplAs<TextureD3D>(glTexture); gl::ImageIndex index = gl::ImageIndex::Make2DMultisample(); RenderTargetD3D *renderTarget = nullptr; GLsizei texSamples = textureD3D->getRenderToTextureSamples(); ANGLE_TRY(textureD3D->getRenderTarget(context, index, texSamples, &renderTarget)); return mRenderer->clearRenderTarget(context, renderTarget, gl::ColorF(0.0f, 0.0f, 0.0f, 1.0f), 1.0f, 0); } void Context11::handleResult(HRESULT hr, const char *message, const char *file, const char *function, unsigned int line) { ASSERT(FAILED(hr)); if (d3d11::isDeviceLostError(hr)) { mRenderer->notifyDeviceLost(); } GLenum glErrorCode = DefaultGLErrorCode(hr); std::stringstream errorStream; errorStream << "Internal D3D11 error: " << gl::FmtHR(hr) << ": " << message; mErrors->handleError(glErrorCode, errorStream.str().c_str(), file, function, line); } } // namespace rx
endlessm/chromium-browser
third_party/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
C++
bsd-3-clause
29,325
<?php namespace CaseStoreBundle\Command; use CaseStoreBundle\Action\CaseStudyPurgeAction; use CaseStoreBundle\Entity\CaseStudy; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** * @license 3-clause BSD * @link https://github.com/CaseStore/CaseStore-Core */ class PurgeCaseStudyCommand extends ContainerAwareCommand { protected function configure() { $this ->setName('casestore:purge-case-study') ->setDescription('Purge Case Study') ->addArgument( 'project', InputArgument::REQUIRED, 'Public ID of Project (from URL)' ) ->addArgument( 'casestudy', InputArgument::REQUIRED, 'Public ID of Case Study (from URL)' ) ; } protected function execute(InputInterface $input, OutputInterface $output) { $doctrine = $this->getContainer()->get('doctrine'); ######################## Find $projectRepository = $doctrine->getRepository('CaseStoreBundle:Project'); $caseStudyRepo = $doctrine->getRepository('CaseStoreBundle:CaseStudy'); $project = $projectRepository->findOneBy(array('publicId' => $input->getArgument('project'))); if (!$project) { $output->writeln('Project Not Found'); return; } $caseStudy = $caseStudyRepo->findOneBy(array('project'=>$project, 'publicId'=>$input->getArgument('casestudy'))); if (!$caseStudy) { $output->writeln('Case Study Not Found'); return; } ######################### User confirm $output->writeln('Project: '. $project->getTitle()); $output->writeln('Case Study: '. $caseStudy->getPublicId()); ######################### Work! $purgeAction = new CaseStudyPurgeAction($this->getContainer()); $purgeAction->purge($caseStudy); $output->writeln('Done'); } }
CaseStore/CaseStore-Core
src/CaseStoreBundle/Command/PurgeCaseStudyCommand.php
PHP
bsd-3-clause
2,217
/** * @file * @copyright This code is licensed under the 3-clause BSD license.\n * Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.\n * See LICENSE.txt for details. */ #ifndef SPARROW_DFTB_REPULSIONPARAMETERS_H #define SPARROW_DFTB_REPULSIONPARAMETERS_H #include <vector> namespace Scine { namespace Sparrow { namespace dftb { /*! * DFTB parameters for the repulsion of an element pair. */ struct RepulsionParameters { int nSplineInts; double cutoff; double a1, a2, a3; // Coefficients for exponential part of repulsion std::vector<double> splineStart, splineEnd; std::vector<double> c0, c1, c2, c3; double c4, c5; // For last spline }; } // namespace dftb } // namespace Sparrow } // namespace Scine #endif // SPARROW_DFTB_REPULSIONPARAMETERS_H
qcscine/sparrow
src/Sparrow/Sparrow/Implementations/Dftb/Utils/RepulsionParameters.h
C
bsd-3-clause
815
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_ #define BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_ #include <memory> #include "base/threading/thread_checker.h" #include "blimp/client/core/session/assignment_source.h" #include "blimp/client/core/session/network_event_observer.h" #include "blimp/net/blimp_connection.h" #include "blimp/net/blimp_connection_statistics.h" #include "blimp/net/browser_connection_handler.h" #include "blimp/net/client_connection_manager.h" namespace blimp { namespace client { // This class's functions and destruction must all be invoked on the IO thread // by the owner. It is OK to construct the object on the main thread. The // ThreadChecker is initialized in the call to Initialize. class ClientNetworkComponents : public ConnectionHandler, public ConnectionErrorObserver { public: // Can be created on any thread. ClientNetworkComponents( std::unique_ptr<NetworkEventObserver> observer, std::unique_ptr<BlimpConnectionStatistics> blimp_connection_statistics); ~ClientNetworkComponents() override; // Sets up network components. void Initialize(); // Starts the connection to the engine using the given |assignment|. // It is required to first call Initialize. void ConnectWithAssignment(const Assignment& assignment); BrowserConnectionHandler* GetBrowserConnectionHandler(); private: // ConnectionHandler implementation. void HandleConnection(std::unique_ptr<BlimpConnection> connection) override; // ConnectionErrorObserver implementation. void OnConnectionError(int error) override; // The ThreadChecker is reset during the call to Initialize. base::ThreadChecker io_thread_checker_; BrowserConnectionHandler connection_handler_; std::unique_ptr<ClientConnectionManager> connection_manager_; std::unique_ptr<NetworkEventObserver> network_observer_; std::unique_ptr<BlimpConnectionStatistics> connection_statistics_; DISALLOW_COPY_AND_ASSIGN(ClientNetworkComponents); }; } // namespace client } // namespace blimp #endif // BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_
danakj/chromium
blimp/client/core/session/client_network_components.h
C
bsd-3-clause
2,312
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_ARC_TEST_FAKE_NOTIFICATIONS_INSTANCE_H_ #define COMPONENTS_ARC_TEST_FAKE_NOTIFICATIONS_INSTANCE_H_ #include <string> #include <utility> #include <vector> #include "components/arc/mojom/notifications.mojom.h" namespace arc { class FakeNotificationsInstance : public mojom::NotificationsInstance { public: FakeNotificationsInstance(); ~FakeNotificationsInstance() override; // mojom::NotificationsInstance overrides: void InitDeprecated(mojom::NotificationsHostPtr host_ptr) override; void Init(mojom::NotificationsHostPtr host_ptr, InitCallback callback) override; void SendNotificationEventToAndroid( const std::string& key, mojom::ArcNotificationEvent event) override; void CreateNotificationWindow(const std::string& key) override; void CloseNotificationWindow(const std::string& key) override; void OpenNotificationSettings(const std::string& key) override; void OpenNotificationSnoozeSettings(const std::string& key) override; void SetDoNotDisturbStatusOnAndroid( mojom::ArcDoNotDisturbStatusPtr status) override; void CancelPress(const std::string& key) override; void PerformDeferredUserAction(uint32_t action_id) override; void CancelDeferredUserAction(uint32_t action_id) override; void SetLockScreenSettingOnAndroid( mojom::ArcLockScreenNotificationSettingPtr setting) override; void SetNotificationConfiguration( mojom::NotificationConfigurationPtr configuration) override; const std::vector<std::pair<std::string, mojom::ArcNotificationEvent>>& events() const; const mojom::ArcDoNotDisturbStatusPtr& latest_do_not_disturb_status() const; private: std::vector<std::pair<std::string, mojom::ArcNotificationEvent>> events_; mojom::ArcDoNotDisturbStatusPtr latest_do_not_disturb_status_; DISALLOW_COPY_AND_ASSIGN(FakeNotificationsInstance); }; } // namespace arc #endif // COMPONENTS_ARC_TEST_FAKE_NOTIFICATIONS_INSTANCE_H_
endlessm/chromium-browser
components/arc/test/fake_notifications_instance.h
C
bsd-3-clause
2,117
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/TestScript) on 2017-03-22. # 2017, SMART Health IT. from . import domainresource class TestScript(domainresource.DomainResource): """ Describes a set of tests. A structured set of tests against a FHIR server implementation to determine compliance against the FHIR specification. """ resource_type = "TestScript" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.contact = None """ Contact details for the publisher. List of `ContactDetail` items (represented as `dict` in JSON). """ self.copyright = None """ Use and/or publishing restrictions. Type `str`. """ self.date = None """ Date this was last changed. Type `FHIRDate` (represented as `str` in JSON). """ self.description = None """ Natural language description of the test script. Type `str`. """ self.destination = None """ An abstract server representing a destination or receiver in a message exchange. List of `TestScriptDestination` items (represented as `dict` in JSON). """ self.experimental = None """ For testing purposes, not real usage. Type `bool`. """ self.fixture = None """ Fixture in the test script - by reference (uri). List of `TestScriptFixture` items (represented as `dict` in JSON). """ self.identifier = None """ Additional identifier for the test script. Type `Identifier` (represented as `dict` in JSON). """ self.jurisdiction = None """ Intended jurisdiction for test script (if applicable). List of `CodeableConcept` items (represented as `dict` in JSON). """ self.metadata = None """ Required capability that is assumed to function correctly on the FHIR server being tested. Type `TestScriptMetadata` (represented as `dict` in JSON). """ self.name = None """ Name for this test script (computer friendly). Type `str`. """ self.origin = None """ An abstract server representing a client or sender in a message exchange. List of `TestScriptOrigin` items (represented as `dict` in JSON). """ self.profile = None """ Reference of the validation profile. List of `FHIRReference` items referencing `Resource` (represented as `dict` in JSON). """ self.publisher = None """ Name of the publisher (organization or individual). Type `str`. """ self.purpose = None """ Why this test script is defined. Type `str`. """ self.rule = None """ Assert rule used within the test script. List of `TestScriptRule` items (represented as `dict` in JSON). """ self.ruleset = None """ Assert ruleset used within the test script. List of `TestScriptRuleset` items (represented as `dict` in JSON). """ self.setup = None """ A series of required setup operations before tests are executed. Type `TestScriptSetup` (represented as `dict` in JSON). """ self.status = None """ draft | active | retired | unknown. Type `str`. """ self.teardown = None """ A series of required clean up steps. Type `TestScriptTeardown` (represented as `dict` in JSON). """ self.test = None """ A test in this script. List of `TestScriptTest` items (represented as `dict` in JSON). """ self.title = None """ Name for this test script (human friendly). Type `str`. """ self.url = None """ Logical URI to reference this test script (globally unique). Type `str`. """ self.useContext = None """ Context the content is intended to support. List of `UsageContext` items (represented as `dict` in JSON). """ self.variable = None """ Placeholder for evaluated elements. List of `TestScriptVariable` items (represented as `dict` in JSON). """ self.version = None """ Business version of the test script. Type `str`. """ super(TestScript, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScript, self).elementProperties() js.extend([ ("contact", "contact", contactdetail.ContactDetail, True, None, False), ("copyright", "copyright", str, False, None, False), ("date", "date", fhirdate.FHIRDate, False, None, False), ("description", "description", str, False, None, False), ("destination", "destination", TestScriptDestination, True, None, False), ("experimental", "experimental", bool, False, None, False), ("fixture", "fixture", TestScriptFixture, True, None, False), ("identifier", "identifier", identifier.Identifier, False, None, False), ("jurisdiction", "jurisdiction", codeableconcept.CodeableConcept, True, None, False), ("metadata", "metadata", TestScriptMetadata, False, None, False), ("name", "name", str, False, None, True), ("origin", "origin", TestScriptOrigin, True, None, False), ("profile", "profile", fhirreference.FHIRReference, True, None, False), ("publisher", "publisher", str, False, None, False), ("purpose", "purpose", str, False, None, False), ("rule", "rule", TestScriptRule, True, None, False), ("ruleset", "ruleset", TestScriptRuleset, True, None, False), ("setup", "setup", TestScriptSetup, False, None, False), ("status", "status", str, False, None, True), ("teardown", "teardown", TestScriptTeardown, False, None, False), ("test", "test", TestScriptTest, True, None, False), ("title", "title", str, False, None, False), ("url", "url", str, False, None, True), ("useContext", "useContext", usagecontext.UsageContext, True, None, False), ("variable", "variable", TestScriptVariable, True, None, False), ("version", "version", str, False, None, False), ]) return js from . import backboneelement class TestScriptDestination(backboneelement.BackboneElement): """ An abstract server representing a destination or receiver in a message exchange. An abstract server used in operations within this test script in the destination element. """ resource_type = "TestScriptDestination" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.index = None """ The index of the abstract destination server starting at 1. Type `int`. """ self.profile = None """ FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR- SDC-FormProcessor. Type `Coding` (represented as `dict` in JSON). """ super(TestScriptDestination, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptDestination, self).elementProperties() js.extend([ ("index", "index", int, False, None, True), ("profile", "profile", coding.Coding, False, None, True), ]) return js class TestScriptFixture(backboneelement.BackboneElement): """ Fixture in the test script - by reference (uri). Fixture in the test script - by reference (uri). All fixtures are required for the test script to execute. """ resource_type = "TestScriptFixture" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.autocreate = None """ Whether or not to implicitly create the fixture during setup. Type `bool`. """ self.autodelete = None """ Whether or not to implicitly delete the fixture during teardown. Type `bool`. """ self.resource = None """ Reference of the resource. Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ super(TestScriptFixture, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptFixture, self).elementProperties() js.extend([ ("autocreate", "autocreate", bool, False, None, False), ("autodelete", "autodelete", bool, False, None, False), ("resource", "resource", fhirreference.FHIRReference, False, None, False), ]) return js class TestScriptMetadata(backboneelement.BackboneElement): """ Required capability that is assumed to function correctly on the FHIR server being tested. The required capability must exist and are assumed to function correctly on the FHIR server being tested. """ resource_type = "TestScriptMetadata" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.capability = None """ Capabilities that are assumed to function correctly on the FHIR server being tested. List of `TestScriptMetadataCapability` items (represented as `dict` in JSON). """ self.link = None """ Links to the FHIR specification. List of `TestScriptMetadataLink` items (represented as `dict` in JSON). """ super(TestScriptMetadata, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptMetadata, self).elementProperties() js.extend([ ("capability", "capability", TestScriptMetadataCapability, True, None, True), ("link", "link", TestScriptMetadataLink, True, None, False), ]) return js class TestScriptMetadataCapability(backboneelement.BackboneElement): """ Capabilities that are assumed to function correctly on the FHIR server being tested. Capabilities that must exist and are assumed to function correctly on the FHIR server being tested. """ resource_type = "TestScriptMetadataCapability" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.capabilities = None """ Required Capability Statement. Type `FHIRReference` referencing `CapabilityStatement` (represented as `dict` in JSON). """ self.description = None """ The expected capabilities of the server. Type `str`. """ self.destination = None """ Which server these requirements apply to. Type `int`. """ self.link = None """ Links to the FHIR specification. List of `str` items. """ self.origin = None """ Which origin server these requirements apply to. List of `int` items. """ self.required = None """ Are the capabilities required?. Type `bool`. """ self.validated = None """ Are the capabilities validated?. Type `bool`. """ super(TestScriptMetadataCapability, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptMetadataCapability, self).elementProperties() js.extend([ ("capabilities", "capabilities", fhirreference.FHIRReference, False, None, True), ("description", "description", str, False, None, False), ("destination", "destination", int, False, None, False), ("link", "link", str, True, None, False), ("origin", "origin", int, True, None, False), ("required", "required", bool, False, None, False), ("validated", "validated", bool, False, None, False), ]) return js class TestScriptMetadataLink(backboneelement.BackboneElement): """ Links to the FHIR specification. A link to the FHIR specification that this test is covering. """ resource_type = "TestScriptMetadataLink" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.description = None """ Short description. Type `str`. """ self.url = None """ URL to the specification. Type `str`. """ super(TestScriptMetadataLink, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptMetadataLink, self).elementProperties() js.extend([ ("description", "description", str, False, None, False), ("url", "url", str, False, None, True), ]) return js class TestScriptOrigin(backboneelement.BackboneElement): """ An abstract server representing a client or sender in a message exchange. An abstract server used in operations within this test script in the origin element. """ resource_type = "TestScriptOrigin" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.index = None """ The index of the abstract origin server starting at 1. Type `int`. """ self.profile = None """ FHIR-Client | FHIR-SDC-FormFiller. Type `Coding` (represented as `dict` in JSON). """ super(TestScriptOrigin, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptOrigin, self).elementProperties() js.extend([ ("index", "index", int, False, None, True), ("profile", "profile", coding.Coding, False, None, True), ]) return js class TestScriptRule(backboneelement.BackboneElement): """ Assert rule used within the test script. Assert rule to be used in one or more asserts within the test script. """ resource_type = "TestScriptRule" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.param = None """ Rule parameter template. List of `TestScriptRuleParam` items (represented as `dict` in JSON). """ self.resource = None """ Assert rule resource reference. Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ super(TestScriptRule, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptRule, self).elementProperties() js.extend([ ("param", "param", TestScriptRuleParam, True, None, False), ("resource", "resource", fhirreference.FHIRReference, False, None, True), ]) return js class TestScriptRuleParam(backboneelement.BackboneElement): """ Rule parameter template. Each rule template can take one or more parameters for rule evaluation. """ resource_type = "TestScriptRuleParam" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.name = None """ Parameter name matching external assert rule parameter. Type `str`. """ self.value = None """ Parameter value defined either explicitly or dynamically. Type `str`. """ super(TestScriptRuleParam, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptRuleParam, self).elementProperties() js.extend([ ("name", "name", str, False, None, True), ("value", "value", str, False, None, False), ]) return js class TestScriptRuleset(backboneelement.BackboneElement): """ Assert ruleset used within the test script. Contains one or more rules. Offers a way to group rules so assertions could reference the group of rules and have them all applied. """ resource_type = "TestScriptRuleset" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.resource = None """ Assert ruleset resource reference. Type `FHIRReference` referencing `Resource` (represented as `dict` in JSON). """ self.rule = None """ The referenced rule within the ruleset. List of `TestScriptRulesetRule` items (represented as `dict` in JSON). """ super(TestScriptRuleset, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptRuleset, self).elementProperties() js.extend([ ("resource", "resource", fhirreference.FHIRReference, False, None, True), ("rule", "rule", TestScriptRulesetRule, True, None, True), ]) return js class TestScriptRulesetRule(backboneelement.BackboneElement): """ The referenced rule within the ruleset. The referenced rule within the external ruleset template. """ resource_type = "TestScriptRulesetRule" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.param = None """ Ruleset rule parameter template. List of `TestScriptRulesetRuleParam` items (represented as `dict` in JSON). """ self.ruleId = None """ Id of referenced rule within the ruleset. Type `str`. """ super(TestScriptRulesetRule, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptRulesetRule, self).elementProperties() js.extend([ ("param", "param", TestScriptRulesetRuleParam, True, None, False), ("ruleId", "ruleId", str, False, None, True), ]) return js class TestScriptRulesetRuleParam(backboneelement.BackboneElement): """ Ruleset rule parameter template. Each rule template can take one or more parameters for rule evaluation. """ resource_type = "TestScriptRulesetRuleParam" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.name = None """ Parameter name matching external assert ruleset rule parameter. Type `str`. """ self.value = None """ Parameter value defined either explicitly or dynamically. Type `str`. """ super(TestScriptRulesetRuleParam, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptRulesetRuleParam, self).elementProperties() js.extend([ ("name", "name", str, False, None, True), ("value", "value", str, False, None, False), ]) return js class TestScriptSetup(backboneelement.BackboneElement): """ A series of required setup operations before tests are executed. """ resource_type = "TestScriptSetup" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.action = None """ A setup operation or assert to perform. List of `TestScriptSetupAction` items (represented as `dict` in JSON). """ super(TestScriptSetup, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptSetup, self).elementProperties() js.extend([ ("action", "action", TestScriptSetupAction, True, None, True), ]) return js class TestScriptSetupAction(backboneelement.BackboneElement): """ A setup operation or assert to perform. Action would contain either an operation or an assertion. """ resource_type = "TestScriptSetupAction" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.assert_fhir = None """ The assertion to perform. Type `TestScriptSetupActionAssert` (represented as `dict` in JSON). """ self.operation = None """ The setup operation to perform. Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ super(TestScriptSetupAction, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptSetupAction, self).elementProperties() js.extend([ ("assert_fhir", "assert", TestScriptSetupActionAssert, False, None, False), ("operation", "operation", TestScriptSetupActionOperation, False, None, False), ]) return js class TestScriptSetupActionAssert(backboneelement.BackboneElement): """ The assertion to perform. Evaluates the results of previous operations to determine if the server under test behaves appropriately. """ resource_type = "TestScriptSetupActionAssert" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.compareToSourceExpression = None """ The fluentpath expression to evaluate against the source fixture. Type `str`. """ self.compareToSourceId = None """ Id of the source fixture to be evaluated. Type `str`. """ self.compareToSourcePath = None """ XPath or JSONPath expression to evaluate against the source fixture. Type `str`. """ self.contentType = None """ xml | json | ttl | none. Type `str`. """ self.description = None """ Tracking/reporting assertion description. Type `str`. """ self.direction = None """ response | request. Type `str`. """ self.expression = None """ The fluentpath expression to be evaluated. Type `str`. """ self.headerField = None """ HTTP header field name. Type `str`. """ self.label = None """ Tracking/logging assertion label. Type `str`. """ self.minimumId = None """ Fixture Id of minimum content resource. Type `str`. """ self.navigationLinks = None """ Perform validation on navigation links?. Type `bool`. """ self.operator = None """ equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval. Type `str`. """ self.path = None """ XPath or JSONPath expression. Type `str`. """ self.requestMethod = None """ delete | get | options | patch | post | put. Type `str`. """ self.requestURL = None """ Request URL comparison value. Type `str`. """ self.resource = None """ Resource type. Type `str`. """ self.response = None """ okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable. Type `str`. """ self.responseCode = None """ HTTP response code to test. Type `str`. """ self.rule = None """ The reference to a TestScript.rule. Type `TestScriptSetupActionAssertRule` (represented as `dict` in JSON). """ self.ruleset = None """ The reference to a TestScript.ruleset. Type `TestScriptSetupActionAssertRuleset` (represented as `dict` in JSON). """ self.sourceId = None """ Fixture Id of source expression or headerField. Type `str`. """ self.validateProfileId = None """ Profile Id of validation profile reference. Type `str`. """ self.value = None """ The value to compare to. Type `str`. """ self.warningOnly = None """ Will this assert produce a warning only on error?. Type `bool`. """ super(TestScriptSetupActionAssert, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptSetupActionAssert, self).elementProperties() js.extend([ ("compareToSourceExpression", "compareToSourceExpression", str, False, None, False), ("compareToSourceId", "compareToSourceId", str, False, None, False), ("compareToSourcePath", "compareToSourcePath", str, False, None, False), ("contentType", "contentType", str, False, None, False), ("description", "description", str, False, None, False), ("direction", "direction", str, False, None, False), ("expression", "expression", str, False, None, False), ("headerField", "headerField", str, False, None, False), ("label", "label", str, False, None, False), ("minimumId", "minimumId", str, False, None, False), ("navigationLinks", "navigationLinks", bool, False, None, False), ("operator", "operator", str, False, None, False), ("path", "path", str, False, None, False), ("requestMethod", "requestMethod", str, False, None, False), ("requestURL", "requestURL", str, False, None, False), ("resource", "resource", str, False, None, False), ("response", "response", str, False, None, False), ("responseCode", "responseCode", str, False, None, False), ("rule", "rule", TestScriptSetupActionAssertRule, False, None, False), ("ruleset", "ruleset", TestScriptSetupActionAssertRuleset, False, None, False), ("sourceId", "sourceId", str, False, None, False), ("validateProfileId", "validateProfileId", str, False, None, False), ("value", "value", str, False, None, False), ("warningOnly", "warningOnly", bool, False, None, False), ]) return js class TestScriptSetupActionAssertRule(backboneelement.BackboneElement): """ The reference to a TestScript.rule. The TestScript.rule this assert will evaluate. """ resource_type = "TestScriptSetupActionAssertRule" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.param = None """ Rule parameter template. List of `TestScriptSetupActionAssertRuleParam` items (represented as `dict` in JSON). """ self.ruleId = None """ Id of the TestScript.rule. Type `str`. """ super(TestScriptSetupActionAssertRule, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptSetupActionAssertRule, self).elementProperties() js.extend([ ("param", "param", TestScriptSetupActionAssertRuleParam, True, None, False), ("ruleId", "ruleId", str, False, None, True), ]) return js class TestScriptSetupActionAssertRuleParam(backboneelement.BackboneElement): """ Rule parameter template. Each rule template can take one or more parameters for rule evaluation. """ resource_type = "TestScriptSetupActionAssertRuleParam" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.name = None """ Parameter name matching external assert rule parameter. Type `str`. """ self.value = None """ Parameter value defined either explicitly or dynamically. Type `str`. """ super(TestScriptSetupActionAssertRuleParam, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptSetupActionAssertRuleParam, self).elementProperties() js.extend([ ("name", "name", str, False, None, True), ("value", "value", str, False, None, True), ]) return js class TestScriptSetupActionAssertRuleset(backboneelement.BackboneElement): """ The reference to a TestScript.ruleset. The TestScript.ruleset this assert will evaluate. """ resource_type = "TestScriptSetupActionAssertRuleset" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.rule = None """ The referenced rule within the ruleset. List of `TestScriptSetupActionAssertRulesetRule` items (represented as `dict` in JSON). """ self.rulesetId = None """ Id of the TestScript.ruleset. Type `str`. """ super(TestScriptSetupActionAssertRuleset, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptSetupActionAssertRuleset, self).elementProperties() js.extend([ ("rule", "rule", TestScriptSetupActionAssertRulesetRule, True, None, False), ("rulesetId", "rulesetId", str, False, None, True), ]) return js class TestScriptSetupActionAssertRulesetRule(backboneelement.BackboneElement): """ The referenced rule within the ruleset. The referenced rule within the external ruleset template. """ resource_type = "TestScriptSetupActionAssertRulesetRule" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.param = None """ Rule parameter template. List of `TestScriptSetupActionAssertRulesetRuleParam` items (represented as `dict` in JSON). """ self.ruleId = None """ Id of referenced rule within the ruleset. Type `str`. """ super(TestScriptSetupActionAssertRulesetRule, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptSetupActionAssertRulesetRule, self).elementProperties() js.extend([ ("param", "param", TestScriptSetupActionAssertRulesetRuleParam, True, None, False), ("ruleId", "ruleId", str, False, None, True), ]) return js class TestScriptSetupActionAssertRulesetRuleParam(backboneelement.BackboneElement): """ Rule parameter template. Each rule template can take one or more parameters for rule evaluation. """ resource_type = "TestScriptSetupActionAssertRulesetRuleParam" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.name = None """ Parameter name matching external assert ruleset rule parameter. Type `str`. """ self.value = None """ Parameter value defined either explicitly or dynamically. Type `str`. """ super(TestScriptSetupActionAssertRulesetRuleParam, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptSetupActionAssertRulesetRuleParam, self).elementProperties() js.extend([ ("name", "name", str, False, None, True), ("value", "value", str, False, None, True), ]) return js class TestScriptSetupActionOperation(backboneelement.BackboneElement): """ The setup operation to perform. The operation to perform. """ resource_type = "TestScriptSetupActionOperation" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.accept = None """ xml | json | ttl | none. Type `str`. """ self.contentType = None """ xml | json | ttl | none. Type `str`. """ self.description = None """ Tracking/reporting operation description. Type `str`. """ self.destination = None """ Server responding to the request. Type `int`. """ self.encodeRequestUrl = None """ Whether or not to send the request url in encoded format. Type `bool`. """ self.label = None """ Tracking/logging operation label. Type `str`. """ self.origin = None """ Server initiating the request. Type `int`. """ self.params = None """ Explicitly defined path parameters. Type `str`. """ self.requestHeader = None """ Each operation can have one or more header elements. List of `TestScriptSetupActionOperationRequestHeader` items (represented as `dict` in JSON). """ self.requestId = None """ Fixture Id of mapped request. Type `str`. """ self.resource = None """ Resource type. Type `str`. """ self.responseId = None """ Fixture Id of mapped response. Type `str`. """ self.sourceId = None """ Fixture Id of body for PUT and POST requests. Type `str`. """ self.targetId = None """ Id of fixture used for extracting the [id], [type], and [vid] for GET requests. Type `str`. """ self.type = None """ The operation code type that will be executed. Type `Coding` (represented as `dict` in JSON). """ self.url = None """ Request URL. Type `str`. """ super(TestScriptSetupActionOperation, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptSetupActionOperation, self).elementProperties() js.extend([ ("accept", "accept", str, False, None, False), ("contentType", "contentType", str, False, None, False), ("description", "description", str, False, None, False), ("destination", "destination", int, False, None, False), ("encodeRequestUrl", "encodeRequestUrl", bool, False, None, False), ("label", "label", str, False, None, False), ("origin", "origin", int, False, None, False), ("params", "params", str, False, None, False), ("requestHeader", "requestHeader", TestScriptSetupActionOperationRequestHeader, True, None, False), ("requestId", "requestId", str, False, None, False), ("resource", "resource", str, False, None, False), ("responseId", "responseId", str, False, None, False), ("sourceId", "sourceId", str, False, None, False), ("targetId", "targetId", str, False, None, False), ("type", "type", coding.Coding, False, None, False), ("url", "url", str, False, None, False), ]) return js class TestScriptSetupActionOperationRequestHeader(backboneelement.BackboneElement): """ Each operation can have one or more header elements. Header elements would be used to set HTTP headers. """ resource_type = "TestScriptSetupActionOperationRequestHeader" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.field = None """ HTTP header field name. Type `str`. """ self.value = None """ HTTP headerfield value. Type `str`. """ super(TestScriptSetupActionOperationRequestHeader, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptSetupActionOperationRequestHeader, self).elementProperties() js.extend([ ("field", "field", str, False, None, True), ("value", "value", str, False, None, True), ]) return js class TestScriptTeardown(backboneelement.BackboneElement): """ A series of required clean up steps. A series of operations required to clean up after the all the tests are executed (successfully or otherwise). """ resource_type = "TestScriptTeardown" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.action = None """ One or more teardown operations to perform. List of `TestScriptTeardownAction` items (represented as `dict` in JSON). """ super(TestScriptTeardown, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptTeardown, self).elementProperties() js.extend([ ("action", "action", TestScriptTeardownAction, True, None, True), ]) return js class TestScriptTeardownAction(backboneelement.BackboneElement): """ One or more teardown operations to perform. The teardown action will only contain an operation. """ resource_type = "TestScriptTeardownAction" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.operation = None """ The teardown operation to perform. Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ super(TestScriptTeardownAction, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptTeardownAction, self).elementProperties() js.extend([ ("operation", "operation", TestScriptSetupActionOperation, False, None, True), ]) return js class TestScriptTest(backboneelement.BackboneElement): """ A test in this script. """ resource_type = "TestScriptTest" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.action = None """ A test operation or assert to perform. List of `TestScriptTestAction` items (represented as `dict` in JSON). """ self.description = None """ Tracking/reporting short description of the test. Type `str`. """ self.name = None """ Tracking/logging name of this test. Type `str`. """ super(TestScriptTest, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptTest, self).elementProperties() js.extend([ ("action", "action", TestScriptTestAction, True, None, True), ("description", "description", str, False, None, False), ("name", "name", str, False, None, False), ]) return js class TestScriptTestAction(backboneelement.BackboneElement): """ A test operation or assert to perform. Action would contain either an operation or an assertion. """ resource_type = "TestScriptTestAction" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.assert_fhir = None """ The setup assertion to perform. Type `TestScriptSetupActionAssert` (represented as `dict` in JSON). """ self.operation = None """ The setup operation to perform. Type `TestScriptSetupActionOperation` (represented as `dict` in JSON). """ super(TestScriptTestAction, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptTestAction, self).elementProperties() js.extend([ ("assert_fhir", "assert", TestScriptSetupActionAssert, False, None, False), ("operation", "operation", TestScriptSetupActionOperation, False, None, False), ]) return js class TestScriptVariable(backboneelement.BackboneElement): """ Placeholder for evaluated elements. Variable is set based either on element value in response body or on header field value in the response headers. """ resource_type = "TestScriptVariable" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises: FHIRValidationError on validation errors, unless strict is False :param dict jsondict: A JSON dictionary to use for initialization :param bool strict: If True (the default), invalid variables will raise a TypeError """ self.defaultValue = None """ Default, hard-coded, or user-defined value for this variable. Type `str`. """ self.description = None """ Natural language description of the variable. Type `str`. """ self.expression = None """ The fluentpath expression against the fixture body. Type `str`. """ self.headerField = None """ HTTP header field name for source. Type `str`. """ self.hint = None """ Hint help text for default value to enter. Type `str`. """ self.name = None """ Descriptive name for this variable. Type `str`. """ self.path = None """ XPath or JSONPath against the fixture body. Type `str`. """ self.sourceId = None """ Fixture Id of source expression or headerField within this variable. Type `str`. """ super(TestScriptVariable, self).__init__(jsondict=jsondict, strict=strict) def elementProperties(self): js = super(TestScriptVariable, self).elementProperties() js.extend([ ("defaultValue", "defaultValue", str, False, None, False), ("description", "description", str, False, None, False), ("expression", "expression", str, False, None, False), ("headerField", "headerField", str, False, None, False), ("hint", "hint", str, False, None, False), ("name", "name", str, False, None, True), ("path", "path", str, False, None, False), ("sourceId", "sourceId", str, False, None, False), ]) return js import sys try: from . import codeableconcept except ImportError: codeableconcept = sys.modules[__package__ + '.codeableconcept'] try: from . import coding except ImportError: coding = sys.modules[__package__ + '.coding'] try: from . import contactdetail except ImportError: contactdetail = sys.modules[__package__ + '.contactdetail'] try: from . import fhirdate except ImportError: fhirdate = sys.modules[__package__ + '.fhirdate'] try: from . import fhirreference except ImportError: fhirreference = sys.modules[__package__ + '.fhirreference'] try: from . import identifier except ImportError: identifier = sys.modules[__package__ + '.identifier'] try: from . import usagecontext except ImportError: usagecontext = sys.modules[__package__ + '.usagecontext']
all-of-us/raw-data-repository
rdr_service/lib_fhir/fhirclient_3_0_0/models/testscript.py
Python
bsd-3-clause
50,708
<?php use yii\helpers\Html; use kartik\detail\DetailView; /* @var $this yii\web\View */ /* @var $model backend\models\TrainingClassStudentAttendance */ $this->title = $model->id; $this->params['breadcrumbs'][] = ['label' => 'Training Class Student Attendances', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $controller = $this->context; $menus = $controller->module->getMenuItems(); $this->params['sideMenu'][$controller->module->uniqueId]=$menus; ?> <div class="training-class-student-attendance-view"> <?= DetailView::widget([ 'model' => $model, 'mode'=>DetailView::MODE_VIEW, 'panel'=>[ 'heading'=>'<i class="fa fa-fw fa-globe"></i> '.'Training Class Student Attendances # ' . $model->id, 'type'=>DetailView::TYPE_DEFAULT, ], 'buttons1'=> Html::a('<i class="fa fa-fw fa-arrow-left"></i>',['index'], ['class'=>'btn btn-xs btn-primary', 'title'=>'Back to Index', ]).' '. Html::a('<i class="fa fa-fw fa-trash-o"></i>',['#'], ['class'=>'btn btn-xs btn-danger kv-btn-delete', 'title'=>'Delete', 'data-method'=>'post', 'data-confirm'=>'Are you sure you want to delete this item?']), 'attributes' => [ 'id', [ 'attribute' => 'tb_training_schedule_id', 'value' => $model->trainingSchedule->name, ], 'tb_training_schedule_id', [ 'attribute' => 'tb_training_class_student_id', 'value' => $model->trainingClassStudent->name, ], 'tb_training_class_student_id', 'hours', 'reason', 'status', 'created', 'createdBy', 'modified', 'modifiedBy', 'deleted', 'deletedBy', ], ]) ?> </div>
hscstudio/osyawwal
backend/modules/pusdiklat/execution/views/buff/training-class-student-attendance/view.php
PHP
bsd-3-clause
1,773
import shelve, time, random def main(connection, info) : """This is the old plugin""" #"""Run every time a message is seen""" if info["message"].startswith("\x01ACTION") and info["message"].endswith("\x01") : on_ACTION(connection, info) return None # if info["sender"] == "OperServ" : # words = info["message"].split(" ") # if words[0] == "REGISTER:" : # newchannel = words[1].replace("\002", "") # registeree = words[3].replace("\002", "") # connection.rawsend("JOIN %s\n" % (newchannel)) # connection.rawsend("MODE %s +o %s\n" % (newchannel, conf.nick)) # connection.msg(newchannel, "Hello %s, I am sonicbot and I am here to help you with IRC." % (registeree)) seendb = shelve.open("seen.db", writeback=True) if not seendb.has_key("users") : seendb["users"] = {} seendb.sync() seendb["users"][info["sender"].lower()] = [time.time(), info["message"]] seendb.sync() seendb.close() badwords = shelve.open("badwords.db", writeback=True) if badwords.has_key(connection.host) : if badwords[connection.host].has_key(info["channel"]) : nosay = badwords[connection.host][info["channel"]]["badwords"] for word in nosay : if word in [message.replace(".", "").replace("!","").replace("?", "") for message in info["message"].lower().split(" ")] : if info["sender"] not in badwords[connection.host][info["channel"]]["users"] : badwords[connection.host][info["channel"]]["users"][info["sender"]] = 0 badwords.sync() # if badwords[connection.host][info["channel"]]["users"][info["sender"]] > 0 : # if info["sender"] in connection.hostnames.keys() : # target = "*!*@%s" % (connection.hostnames[info["sender"]]) # else : target = "%s*!*@*" % (info["sender"]) # connection.rawsend("MODE %s +b %s\n" % (info["channel"], target)) connection.rawsend("KICK %s %s :%s (%s)\n" % (info["channel"], info["sender"], "Don't use that word!", word)) badwords[connection.host][info["channel"]]["users"][info["sender"]] += 1 badwords.sync() badwords.close() if info["sender"] not in connection.ignorelist : if info["message"].lower().startswith("hi") or info["message"].lower().startswith("hello") or info["message"].lower().startswith("hey") : if connection.nick.lower() in info["message"].lower() : connection.msg(info["channel"], _("Hello %(sender)s!") % dict(sender=info["sender"])) contextdb = shelve.open("context.db", writeback=True) if not contextdb.has_key(info["channel"]) and info["channel"].startswith("#") : contextdb[info["channel"]] = ["<%s> %s" % (info["sender"], info["message"])] contextdb.sync() elif contextdb.has_key(info["channel"]) : contextdb[info["channel"]].append("<%s> %s" % (info["sender"], info["message"])) contextdb.sync() if len(contextdb[info["channel"]]) > 10 : contextdb[info["channel"]].pop(0) contextdb.sync() contextdb.close() memos = shelve.open("memos.db", writeback=True) if memos.has_key(info["sender"].lower()) : for memo in memos[info["sender"].lower()] : connection.ircsend(info["channel"], "%(sender)s: %(memoer)s sent you a memo! '%(memo)s'" % {"sender":info["sender"], "memoer":memo["sender"], "memo":memo["message"]}) memos[info["sender"].lower()] = [] memos.sync() memos.close() # if info["sender"] not in conf.ignorelist and info["hostname"] not in conf.hostignores : # combos = shelve.open("combos.db", writeback=True) # if info["channel"] not in combos.keys() : # combos[info["channel"]] = [] # combos.sync() # combos[info["channel"]].append(info["message"]) # combos.sync() # if len(combos[info["channel"]]) > 3 : # combos[info["channel"]].pop(0) # combos.sync() # if len(combos[info["channel"]]) == 3 : # temp = combos[info["channel"]] # if temp[1].lower().startswith(temp[0].lower()) and temp[2].lower().startswith(temp[0].lower()) : # connection.msg(info["channel"], temp[0]) # del combos[info["channel"]] # combos.sync() # combos.close() if info["message"].startswith("PING") : connection.notice(info["sender"], info["message"]) mail = shelve.open("mail.db", writeback=True) if info["sender"].replace("[", "").replace("]", "") in mail.keys() : if info["hostname"] in mail[info["sender"].replace("[", "").replace("]", "")]["hostname"] : if mail[info["sender"].replace("[", "").replace("]", "")]["notify"] : connection.msg(info["sender"], _("You have new mail.")) mail[info["sender"].replace("[", "").replace("]", "")]["notify"] = False mail.sync() mail.close() emotions = shelve.open("emotions.db", writeback=True) info["sender"] = info["sender"].lower() if info["sender"].lower() not in emotions.keys() and happiness_detect(info) : emotions[info["sender"].lower()] = {} emotions.sync() emotions[info["sender"].lower()]["happy"] = 0 emotions.sync() emotions[info["sender"].lower()]["sad"] = 0 emotions.sync() if info["sender"].lower() in emotions.keys() : for emotion in [":)", ":D", "C:", "=D", ";p", "=)", "C=", "(=", "(:" "xD", "=p", ":p"] : if emotion in info["message"] : emotions[info["sender"].lower()]["happy"] += 1 emotions.sync() break for emotion in [":(", "D:", "=(", "D=", "):", ")=", "=C", ":C"] : if emotion in info["message"] : emotions[info["sender"].lower()]["sad"] += 1 emotions.sync() break if ":P" in info["message"] : emotions[info["sender"].lower()]["happy"] += .5 emotions.sync() emotions.close() notify = shelve.open("notify.db", writeback=True) if info["sender"] in notify.keys() : temp = notify[info["sender"]] for user in temp : connection.msg(user, _("%(nick)s has just said something in %(channel)s") % dict(nick=info["sender"], channel=info["channel"])) notify[info["sender"]].remove(user) notify.sync() if notify[info["sender"]] == [] : del notify[info["sender"]] notify.sync() notify.close() def happiness_detect(info) : """Checks to see if a smiley is in the message""" for emotion in [":)", ":D", "C:", "=D", "=)", "C=", "(=", "(:" "xD", ":p", ";p", "=p", ":(", "D:", "=(", "D=", "):", ")=", "=C", ":C", ":P"] : if emotion in info["message"] : return True return False def on_ACTION(connection, info) : """Runs every time somebody does an action (/me)""" badwords = shelve.open("badwords.db", writeback=True) if badwords.has_key(connection.host) : if badwords[connection.host].has_key(info["channel"]) : nosay = badwords[connection.host][info["channel"]]["badwords"] for word in nosay : if word in [message.replace(".", "").replace("!","").replace("?", "") for message in info["message"].lower().split(" ")] : if info["sender"] not in badwords[connection.host][info["channel"]]["users"] : badwords[connection.host][info["channel"]]["users"][info["sender"]] = 0 badwords.sync() # if badwords[connection.host][info["channel"]]["users"][info["sender"]] > 0 : # if info["sender"] in connection.hostnames.keys() : # target = "*!*@%s" % (connection.hostnames[info["sender"]]) # else : target = "%s*!*@*" % (info["sender"]) # connection.rawsend("MODE %s +b %s\n" % (info["channel"], target)) connection.rawsend("KICK %s %s :%s (%s)\n" % (info["channel"], info["sender"], "Don't use that word!", word)) badwords[connection.host][info["channel"]]["users"][info["sender"]] += 1 badwords.sync() badwords.close() memos = shelve.open("memos.db", writeback=True) if memos.has_key(info["sender"].lower()) : for memo in memos[info["sender"].lower()] : connection.ircsend(info["channel"], "%(sender)s: %(memoer)s sent you a memo! '%(memo)s'" % {"sender":info["sender"], "memoer":memo["sender"], "memo":memo["message"]}) memos[info["sender"].lower()] = [] memos.sync() memos.close() args = info["message"].replace("\x01", "").split(" ")[1:] contextdb = shelve.open("context.db", writeback=True) if not contextdb.has_key(info["channel"]) and info["channel"].startswith("#") : contextdb[info["channel"]] = ["<%s> %s" % (info["sender"], info["message"])] contextdb.sync() elif contextdb.has_key(info["channel"]) : contextdb[info["channel"]].append("*%s %s" % (info["sender"], " ".join(args).replace("", ""))) contextdb.sync() if len(contextdb[info["channel"]]) > 10 : contextdb[info["channel"]].pop(0) contextdb.sync() contextdb.close() seendb = shelve.open("seen.db", writeback=True) if not seendb.has_key("users") : seendb["users"] = {} seendb.sync() seendb["users"][info["sender"].lower()] = [time.time(), "*%s %s" % (info["sender"], " ".join(args).replace("", ""))] seendb.close() if len(args) > 1 : if args[0] in ["slaps", "punches", "stomps", "hurts", "rapes", "hits", "fucks", "smacks", "crunches", "kicks", "barfs", "forces", "force", "squishes", "bodyslams", "shoots", "compresses", "tackles", "stabs"] : if args[1] == connection.nick or args[-1] == connection.nick : connection.msg(info["channel"], random.choice(["Oww!", "Ouch, that hurt!", "\x01ACTION curls up in fetal position\x01", "\x01ACTION slaps %s\x01" % (info["sender"]), "\x01ACTION smacks %s\x01" % (info["sender"]), "\x01ACTION kicks %s\x01" % (info["sender"]), "\x01ACTION explodes\x01"])) if len(args) > 1 : if args[0].lower() == "hugs" and args[1] == connection.nick : connection.msg(info["channel"], "\x01ACTION hugs %(sender)s\x01" % dict(sender=info["sender"]))
sonicrules1234/sonicbot
oldplugins/on_PRIVMSG.py
Python
bsd-3-clause
10,821
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_loop_44.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE805.label.xml Template File: sources-sink-44.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate using malloc() and set data pointer to a small buffer * GoodSource: Allocate using malloc() and set data pointer to a large buffer * Sinks: loop * BadSink : Copy int64_t array to data using a loop * Flow Variant: 44 Data/control flow: data passed as an argument from one function to a function in the same source file called via a function pointer * * */ #include "std_testcase.h" #ifndef OMITBAD static void badSink(int64_t * data) { { int64_t source[100] = {0}; /* fill with 0's */ { size_t i; /* POTENTIAL FLAW: Possible buffer overflow if data < 100 */ for (i = 0; i < 100; i++) { data[i] = source[i]; } printLongLongLine(data[0]); free(data); } } } void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_loop_44_bad() { int64_t * data; /* define a function pointer */ void (*funcPtr) (int64_t *) = badSink; data = NULL; /* FLAW: Allocate and point data to a small buffer that is smaller than the large buffer used in the sinks */ data = (int64_t *)malloc(50*sizeof(int64_t)); if (data == NULL) {exit(-1);} /* use the function pointer */ funcPtr(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2BSink(int64_t * data) { { int64_t source[100] = {0}; /* fill with 0's */ { size_t i; /* POTENTIAL FLAW: Possible buffer overflow if data < 100 */ for (i = 0; i < 100; i++) { data[i] = source[i]; } printLongLongLine(data[0]); free(data); } } } static void goodG2B() { int64_t * data; void (*funcPtr) (int64_t *) = goodG2BSink; data = NULL; /* FIX: Allocate and point data to a large buffer that is at least as large as the large buffer used in the sink */ data = (int64_t *)malloc(100*sizeof(int64_t)); if (data == NULL) {exit(-1);} funcPtr(data); } void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_loop_44_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_loop_44_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_loop_44_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
JianpingZeng/xcc
xcc/test/juliet/testcases/CWE122_Heap_Based_Buffer_Overflow/s08/CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_loop_44.c
C
bsd-3-clause
3,389
<?php namespace backend\controllers\property; use Yii; use common\models\property\LandAllowanceType; use yii\data\ActiveDataProvider; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; /** * LandAllowanceController implements the CRUD actions for LandAllowanceType model. */ class LandAllowanceController extends Controller { public function behaviors() { return [ 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'delete' => ['post'], ], ], ]; } /** * Lists all LandAllowanceType models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider([ 'query' => LandAllowanceType::find(), ]); return $this->render('index', [ 'dataProvider' => $dataProvider, ]); } /** * Displays a single LandAllowanceType model. * @param integer $id * @return mixed */ public function actionView($id) { return $this->render('view', [ 'model' => $this->findModel($id), ]); } /** * Creates a new LandAllowanceType model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new LandAllowanceType(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', [ 'model' => $model, ]); } } /** * Updates an existing LandAllowanceType model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', [ 'model' => $model, ]); } } /** * Deletes an existing LandAllowanceType model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $this->findModel($id)->delete(); return $this->redirect(['index']); } /** * Finds the LandAllowanceType model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return LandAllowanceType the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = LandAllowanceType::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } } }
hurduring/smolyakoff
backend/controllers/property/LandAllowanceController.php
PHP
bsd-3-clause
3,189
<?php $config = [ 'id' => 'app', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'aliases' => [ '@admin-views' => '@app/modules/admin/views' ], 'components' => [ 'assetManager' => [ 'forceCopy' => false, // Note: May degrade performance with Docker or VMs 'linkAssets' => false, // Note: May also publish files, which are excluded in an asset bundle 'dirMode' => YII_ENV_PROD ? 0777 : null, // Note: For using mounted volumes or shared folders 'bundles' => YII_ENV_PROD ? require(__DIR__ . '/assets-prod.php') : null, ], 'cache' => [ 'class' => 'yii\caching\FileCache', ], 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => getenv('DATABASE_DSN'), 'username' => getenv('DATABASE_USER'), 'password' => getenv('DATABASE_PASSWORD'), 'charset' => 'utf8', 'tablePrefix' => getenv('DATABASE_TABLE_PREFIX'), ], 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', //'viewPath' => '@common/mail', // send all mails to a file by default. You have to set // 'useFileTransport' to false and configure a transport // for the mailer to send real emails. 'useFileTransport' => YII_ENV_PROD ? false : true, ], 'urlManager' => [ 'enablePrettyUrl' => getenv('APP_PRETTY_URLS') ? true : false, 'showScriptName' => getenv('YII_ENV_TEST') ? true : false, 'rules' => [ 'docs/<file:[a-zA-Z0-9_\-\.]*>' => 'docs', ], ], 'view' => [ 'theme' => [ 'pathMap' => [ '@vendor/dektrium/yii2-user/views' => '@app/views/user', '@yii/gii/views/layouts' => '@admin-views/layouts', ], ], ], ], 'modules' => [ 'admin' => [ 'class' => 'app\modules\admin\Module', 'layout' => '@admin-views/layouts/main', ], 'post' => [ 'layout' => '@admin-views/layouts/main', 'class' => 'app\modules\post\Post', ], /*'docs' => [ 'class' => \schmunk42\markdocs\Module::className(), 'layout' => '@app/views/layouts/container', ],*/ /*'packaii' => [ 'class' => \schmunk42\packaii\Module::className(), 'layout' => '@admin-views/layouts/main', ],*/ 'user' => [ 'class' => 'dektrium\user\Module', 'layout' => '@admin-views/layouts/main', 'defaultRoute' => 'profile', 'admins' => ['admin'] ], // 'crud' => [ // 'class' => 'app\modules\crud\Module', // 'layout' => '@admin-views/layouts/main', // ], ], 'params' => [ 'appName' => getenv('APP_NAME'), 'adminEmail' => getenv('APP_ADMIN_EMAIL'), 'supportEmail' => getenv('APP_SUPPORT_EMAIL'), 'yii.migrations' => [ '@dektrium/user/migrations', ] ] ]; $web = [ 'components' => [ // Logging 'log' => [ 'targets' => [ // writes to php-fpm output stream // writes to php-fpm output stream [ 'class' => 'codemix\streamlog\Target', 'url' => 'php://stdout', 'levels' => ['info', 'trace'], 'logVars' => [], ], [ 'class' => 'codemix\streamlog\Target', 'url' => 'php://stderr', 'levels' => ['error', 'warning'], 'logVars' => [], ], ], ], 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => getenv('APP_COOKIE_VALIDATION_KEY'), ], 'user' => [ 'identityClass' => 'dektrium\user\models\User', ], ] ]; $console = [ 'controllerNamespace' => 'app\commands', 'controllerMap' => [ 'migrate' => 'dmstr\console\controllers\MigrateController' ], 'components' => [ ] ]; $allowedIPs = [ '127.0.0.1', '::1', '192.168.*', '172.17.*' ]; if (php_sapi_name() == 'cli') { // Console application $config = \yii\helpers\ArrayHelper::merge($config, $console); } else { // Web application if (YII_ENV_DEV) { // configuration adjustments for web 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', 'allowedIPs' => $allowedIPs ]; } $config = \yii\helpers\ArrayHelper::merge($config, $web); } if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', 'allowedIPs' => $allowedIPs ]; } if (file_exists(__DIR__ . '/local.php')) { // Local configuration, if available $local = require(__DIR__ . '/local.php'); $config = \yii\helpers\ArrayHelper::merge($config, $local); } return $config;
myorb/pmyapp
config/main.php
PHP
bsd-3-clause
5,608
/* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var MushCodeRules = require("./mushcode_highlight_rules").MushCodeRules; var PythonFoldMode = require("./folding/pythonic").FoldMode; var Range = require("../range").Range; var Mode = function() { this.HighlightRules = MushCodeRules; this.foldingRules = new PythonFoldMode("\\:"); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } if (state == "start") { var match = line.match(/^.*[\{\(\[\:]\s*$/); if (match) { indent += tab; } } return indent; }; var outdents = { "pass": 1, "return": 1, "raise": 1, "break": 1, "continue": 1 }; this.checkOutdent = function(state, line, input) { if (input !== "\r\n" && input !== "\r" && input !== "\n") return false; var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; if (!tokens) return false; // ignore trailing comments do { var last = tokens.pop(); } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/)))); if (!last) return false; return (last.type == "keyword" && outdents[last.value]); }; this.autoOutdent = function(state, doc, row) { // outdenting in python is slightly different because it always applies // to the next line and only of a new line is inserted row += 1; var indent = this.$getIndent(doc.getLine(row)); var tab = doc.getTabString(); if (indent.slice(-tab.length) == tab) doc.remove(new Range(row, indent.length-tab.length, row, indent.length)); }; this.$id = "ace/mode/mushcode"; }).call(Mode.prototype); exports.Mode = Mode; });
sxyseo/openbiz
ui/vendor/ace/ace/mode/mushcode.js
JavaScript
bsd-3-clause
4,091
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <windows.h> #include <wincrypt.h> #include <string> #include <vector> #include "base/bind.h" #include "base/bind_helpers.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/prefs/pref_service.h" #include "base/stl_util.h" #include "base/synchronization/waitable_event.h" #include "base/time.h" #include "chrome/browser/password_manager/ie7_password.h" #include "chrome/browser/password_manager/password_form_data.h" #include "chrome/browser/password_manager/password_store_consumer.h" #include "chrome/browser/password_manager/password_store_win.h" #include "chrome/browser/webdata/logins_table.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" #include "components/webdata/common/web_database_service.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" using base::WaitableEvent; using content::BrowserThread; using testing::_; using testing::DoAll; using testing::WithArg; using content::PasswordForm; namespace { class MockPasswordStoreConsumer : public PasswordStoreConsumer { public: MOCK_METHOD2(OnPasswordStoreRequestDone, void(CancelableRequestProvider::Handle, const std::vector<content::PasswordForm*>&)); MOCK_METHOD1(OnGetPasswordStoreResults, void(const std::vector<content::PasswordForm*>&)); }; class MockWebDataServiceConsumer : public WebDataServiceConsumer { public: MOCK_METHOD2(OnWebDataServiceRequestDone, void(WebDataService::Handle, const WDTypedResult*)); }; } // anonymous namespace typedef std::vector<PasswordForm*> VectorOfForms; class PasswordStoreWinTest : public testing::Test { protected: PasswordStoreWinTest() : ui_thread_(BrowserThread::UI, &message_loop_), db_thread_(BrowserThread::DB) { } bool CreateIE7PasswordInfo(const std::wstring& url, const base::Time& created, IE7PasswordInfo* info) { // Copied from chrome/browser/importer/importer_unittest.cc // The username is "abcdefgh" and the password "abcdefghijkl". unsigned char data[] = "\x0c\x00\x00\x00\x38\x00\x00\x00\x2c\x00\x00\x00" "\x57\x49\x43\x4b\x18\x00\x00\x00\x02\x00\x00\x00" "\x67\x00\x72\x00\x01\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x4e\xfa\x67\x76\x22\x94\xc8\x01" "\x08\x00\x00\x00\x12\x00\x00\x00\x4e\xfa\x67\x76" "\x22\x94\xc8\x01\x0c\x00\x00\x00\x61\x00\x62\x00" "\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00" "\x00\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00" "\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00" "\x6c\x00\x00\x00"; DATA_BLOB input = {0}; DATA_BLOB url_key = {0}; DATA_BLOB output = {0}; input.pbData = data; input.cbData = sizeof(data); url_key.pbData = reinterpret_cast<unsigned char*>( const_cast<wchar_t*>(url.data())); url_key.cbData = static_cast<DWORD>((url.size() + 1) * sizeof(std::wstring::value_type)); if (!CryptProtectData(&input, NULL, &url_key, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &output)) return false; std::vector<unsigned char> encrypted_data; encrypted_data.resize(output.cbData); memcpy(&encrypted_data.front(), output.pbData, output.cbData); LocalFree(output.pbData); info->url_hash = ie7_password::GetUrlHash(url); info->encrypted_data = encrypted_data; info->date_created = created; return true; } virtual void SetUp() { ASSERT_TRUE(db_thread_.Start()); ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); profile_.reset(new TestingProfile()); login_db_.reset(new LoginDatabase()); ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append( FILE_PATH_LITERAL("login_test")))); base::FilePath path = temp_dir_.path().AppendASCII("web_data_test"); wdbs_ = new WebDatabaseService(path); // Need to add at least one table so the database gets created. wdbs_->AddTable(scoped_ptr<WebDatabaseTable>(new LoginsTable())); wdbs_->LoadDatabase(WebDatabaseService::InitCallback()); wds_ = new WebDataService(wdbs_, WebDataServiceBase::ProfileErrorCallback()); wds_->Init(); } virtual void TearDown() { if (store_.get()) store_->ShutdownOnUIThread(); wds_->ShutdownOnUIThread(); wdbs_->ShutdownDatabase(); wds_ = NULL; wdbs_ = NULL; base::WaitableEvent done(false, false); BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); done.Wait(); MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); MessageLoop::current()->Run(); db_thread_.Stop(); } MessageLoopForUI message_loop_; content::TestBrowserThread ui_thread_; // PasswordStore, WDS schedule work on this thread. content::TestBrowserThread db_thread_; scoped_ptr<LoginDatabase> login_db_; scoped_ptr<TestingProfile> profile_; scoped_refptr<WebDataService> wds_; scoped_refptr<WebDatabaseService> wdbs_; scoped_refptr<PasswordStore> store_; base::ScopedTempDir temp_dir_; }; ACTION(STLDeleteElements0) { STLDeleteContainerPointers(arg0.begin(), arg0.end()); } ACTION(QuitUIMessageLoop) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); MessageLoop::current()->Quit(); } MATCHER(EmptyWDResult, "") { return static_cast<const WDResult<std::vector<PasswordForm*> >*>( arg)->GetValue().empty(); } // Hangs flakily, http://crbug.com/71385. TEST_F(PasswordStoreWinTest, DISABLED_ConvertIE7Login) { IE7PasswordInfo password_info; ASSERT_TRUE(CreateIE7PasswordInfo(L"http://example.com/origin", base::Time::FromDoubleT(1), &password_info)); // Verify the URL hash ASSERT_EQ(L"39471418FF5453FEEB3731E382DEB5D53E14FAF9B5", password_info.url_hash); // This IE7 password will be retrieved by the GetLogins call. wds_->AddIE7Login(password_info); // The WDS schedules tasks to run on the DB thread so we schedule yet another // task to notify us that it's safe to carry on with the test. WaitableEvent done(false, false); BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); done.Wait(); store_ = new PasswordStoreWin(login_db_.release(), profile_.get(), wds_.get()); EXPECT_TRUE(store_->Init()); MockPasswordStoreConsumer consumer; // Make sure we quit the MessageLoop even if the test fails. ON_CALL(consumer, OnGetPasswordStoreResults(_)) .WillByDefault(QuitUIMessageLoop()); PasswordFormData form_data = { PasswordForm::SCHEME_HTML, "http://example.com/", "http://example.com/origin", "http://example.com/action", L"submit_element", L"username_element", L"password_element", L"", L"", true, false, 1, }; scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); PasswordFormData expected_form_data = { PasswordForm::SCHEME_HTML, "http://example.com/", "http://example.com/origin", "http://example.com/action", L"submit_element", L"username_element", L"password_element", L"abcdefgh", L"abcdefghijkl", true, false, 1, }; std::vector<PasswordForm*> forms; forms.push_back(CreatePasswordFormFromData(expected_form_data)); // The IE7 password should be returned. EXPECT_CALL(consumer, OnGetPasswordStoreResults(ContainsAllPasswordForms(forms))) .WillOnce(QuitUIMessageLoop()); store_->GetLogins(*form, &consumer); MessageLoop::current()->Run(); STLDeleteElements(&forms); } // Crashy. http://crbug.com/86558 TEST_F(PasswordStoreWinTest, DISABLED_OutstandingWDSQueries) { store_ = new PasswordStoreWin(login_db_.release(), profile_.get(), wds_.get()); EXPECT_TRUE(store_->Init()); PasswordFormData form_data = { PasswordForm::SCHEME_HTML, "http://example.com/", "http://example.com/origin", "http://example.com/action", L"submit_element", L"username_element", L"password_element", L"", L"", true, false, 1, }; scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); MockPasswordStoreConsumer consumer; store_->GetLogins(*form, &consumer); // Release the PSW and the WDS before the query can return. store_->ShutdownOnUIThread(); store_ = NULL; wds_ = NULL; MessageLoop::current()->RunUntilIdle(); } // Hangs flakily, see http://crbug.com/43836. TEST_F(PasswordStoreWinTest, DISABLED_MultipleWDSQueriesOnDifferentThreads) { IE7PasswordInfo password_info; ASSERT_TRUE(CreateIE7PasswordInfo(L"http://example.com/origin", base::Time::FromDoubleT(1), &password_info)); wds_->AddIE7Login(password_info); // The WDS schedules tasks to run on the DB thread so we schedule yet another // task to notify us that it's safe to carry on with the test. WaitableEvent done(false, false); BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind(&WaitableEvent::Signal, base::Unretained(&done))); done.Wait(); store_ = new PasswordStoreWin(login_db_.release(), profile_.get(), wds_.get()); EXPECT_TRUE(store_->Init()); MockPasswordStoreConsumer password_consumer; // Make sure we quit the MessageLoop even if the test fails. ON_CALL(password_consumer, OnGetPasswordStoreResults(_)) .WillByDefault(QuitUIMessageLoop()); PasswordFormData form_data = { PasswordForm::SCHEME_HTML, "http://example.com/", "http://example.com/origin", "http://example.com/action", L"submit_element", L"username_element", L"password_element", L"", L"", true, false, 1, }; scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); PasswordFormData expected_form_data = { PasswordForm::SCHEME_HTML, "http://example.com/", "http://example.com/origin", "http://example.com/action", L"submit_element", L"username_element", L"password_element", L"abcdefgh", L"abcdefghijkl", true, false, 1, }; std::vector<PasswordForm*> forms; forms.push_back(CreatePasswordFormFromData(expected_form_data)); // The IE7 password should be returned. EXPECT_CALL(password_consumer, OnGetPasswordStoreResults(ContainsAllPasswordForms(forms))) .WillOnce(QuitUIMessageLoop()); store_->GetLogins(*form, &password_consumer); MockWebDataServiceConsumer wds_consumer; EXPECT_CALL(wds_consumer, OnWebDataServiceRequestDone(_, _)) .WillOnce(QuitUIMessageLoop()); wds_->GetIE7Login(password_info, &wds_consumer); // Run the MessageLoop twice: once for the GetIE7Login that PasswordStoreWin // schedules on the DB thread and once for the one we just scheduled on the UI // thread. MessageLoop::current()->Run(); MessageLoop::current()->Run(); STLDeleteElements(&forms); } TEST_F(PasswordStoreWinTest, EmptyLogins) { store_ = new PasswordStoreWin(login_db_.release(), profile_.get(), wds_.get()); store_->Init(); PasswordFormData form_data = { PasswordForm::SCHEME_HTML, "http://example.com/", "http://example.com/origin", "http://example.com/action", L"submit_element", L"username_element", L"password_element", L"", L"", true, false, 1, }; scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); MockPasswordStoreConsumer consumer; // Make sure we quit the MessageLoop even if the test fails. ON_CALL(consumer, OnGetPasswordStoreResults(_)) .WillByDefault(QuitUIMessageLoop()); VectorOfForms expect_none; // expect that we get no results; EXPECT_CALL(consumer, OnGetPasswordStoreResults(ContainsAllPasswordForms(expect_none))) .WillOnce(DoAll(WithArg<0>(STLDeleteElements0()), QuitUIMessageLoop())); store_->GetLogins(*form, &consumer); MessageLoop::current()->Run(); } TEST_F(PasswordStoreWinTest, EmptyBlacklistLogins) { store_ = new PasswordStoreWin(login_db_.release(), profile_.get(), wds_.get()); store_->Init(); MockPasswordStoreConsumer consumer; // Make sure we quit the MessageLoop even if the test fails. ON_CALL(consumer, OnPasswordStoreRequestDone(_, _)) .WillByDefault(QuitUIMessageLoop()); VectorOfForms expect_none; // expect that we get no results; EXPECT_CALL( consumer, OnPasswordStoreRequestDone(_, ContainsAllPasswordForms(expect_none))) .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); store_->GetBlacklistLogins(&consumer); MessageLoop::current()->Run(); } TEST_F(PasswordStoreWinTest, EmptyAutofillableLogins) { store_ = new PasswordStoreWin(login_db_.release(), profile_.get(), wds_.get()); store_->Init(); MockPasswordStoreConsumer consumer; // Make sure we quit the MessageLoop even if the test fails. ON_CALL(consumer, OnPasswordStoreRequestDone(_, _)) .WillByDefault(QuitUIMessageLoop()); VectorOfForms expect_none; // expect that we get no results; EXPECT_CALL( consumer, OnPasswordStoreRequestDone(_, ContainsAllPasswordForms(expect_none))) .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); store_->GetAutofillableLogins(&consumer); MessageLoop::current()->Run(); }
codenote/chromium-test
chrome/browser/password_manager/password_store_win_unittest.cc
C++
bsd-3-clause
14,148
package client const walletAPIDoc = `"keybase wallet api" provides a JSON API to the Keybase wallet. EXAMPLES: List the balances in all your accounts: {"method": "balances"} See payment history in an account: {"method": "history", "params": {"options": {"account-id": "GDUKZH6Q3U5WQD4PDGZXYLJE3P76BDRDWPSALN4OUFEESI2QL5UZHCK4"}}} Get details about a single transaction: {"method": "details", "params": {"options": {"txid": "e5334601b9dc2a24e031ffeec2fce37bb6a8b4b51fc711d16dec04d3e64976c4"}}} Lookup the primary Stellar account ID for a user: {"method": "lookup", "params": {"options": {"name": "patrick"}}} Get the inflation destination for an account: {"method": "get-inflation", "params": {"options": {"account-id": "GDUKZH6Q3U5WQD4PDGZXYLJE3P76BDRDWPSALN4OUFEESI2QL5UZHCK4"}}} Set the inflation destination for an account to the Lumenaut pool: {"method": "set-inflation", "params": {"options": {"account-id": "GDUKZH6Q3U5WQD4PDGZXYLJE3P76BDRDWPSALN4OUFEESI2QL5UZHCK4", "destination": "lumenaut"}}} Set the inflation destination for an account to some other account: {"method": "set-inflation", "params": {"options": {"account-id": "GDUKZH6Q3U5WQD4PDGZXYLJE3P76BDRDWPSALN4OUFEESI2QL5UZHCK4", "destination": "GD5CR6MG5R3BADYP2RUVAGC5PKCZGS4CFSAK3FYKD7WEUTRW25UH6C2J"}}} Set the inflation destination for an account to itself: {"method": "set-inflation", "params": {"options": {"account-id": "GDUKZH6Q3U5WQD4PDGZXYLJE3P76BDRDWPSALN4OUFEESI2QL5UZHCK4", "destination": "self"}}} Send XLM to a Keybase user (there is no confirmation so be careful): {"method": "send", "params": {"options": {"recipient": "patrick", "amount": "1"}}} Send $10 USD worth of XLM to a Keybase user: {"method": "send", "params": {"options": {"recipient": "patrick", "amount": "10", "currency": "USD", "message": "here's the money I owe you"}}} Find a payment path to a Keybase user between two assets: {"method": "find-payment-path", "params": {"options": {"recipient": "patrick", "amount": "10", "source-asset": "native", "destination-asset": "USD/GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX"}}} Send 10 AnchorUSD to a Keybase user as a path payment by converting at most 120 XLM (there is no confirmation so be careful): {"method": "send-path-payment", "params": {"options": {"recipient": "patrick", "amount": "10", "source-max-amount": "120", "source-asset": "native", "destination-asset": "USD/GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX"}}} If you send XLM to a Keybase user who has not established a wallet yet, you can cancel the payment before the recipient claims it and the XLM will be returned to your account: {"method": "cancel", "params": {"options": {"txid": "e5334601b9dc2a24e031ffeec2fce37bb6a8b4b51fc711d16dec04d3e64976c4"}}} Initialize the wallet for an account: {"method": "setup-wallet"} `
keybase/client
go/client/wallet_api_doc.go
GO
bsd-3-clause
2,884
# $FreeBSD: src/sys/modules/asr/Makefile,v 1.1.2.1 2000/09/21 20:33:53 msmith Exp $ .PATH: ${.CURDIR}/../../dev/asr KMOD = asr SRCS = asr.c SRCS += opt_scsi.h opt_cam.h opt_asr.h SRCS += device_if.h bus_if.h pci_if.h .include <bsd.kmod.mk>
MarginC/kame
freebsd4/sys/modules/asr/Makefile
Makefile
bsd-3-clause
249
/** * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> */ package akka.pattern import java.util.concurrent.atomic.{ AtomicInteger, AtomicLong, AtomicBoolean } import akka.AkkaException import akka.actor.Scheduler import akka.util.Unsafe import scala.util.control.NoStackTrace import java.util.concurrent.{ Callable, CopyOnWriteArrayList } import scala.concurrent.{ ExecutionContext, Future, Promise, Await } import scala.concurrent.duration._ import scala.concurrent.TimeoutException import scala.util.control.NonFatal import scala.util.Success import akka.dispatch.ExecutionContexts.sameThreadExecutionContext /** * Companion object providing factory methods for Circuit Breaker which runs callbacks in caller's thread */ object CircuitBreaker { /** * Create a new CircuitBreaker. * * Callbacks run in caller's thread when using withSyncCircuitBreaker, and in same ExecutionContext as the passed * in Future when using withCircuitBreaker. To use another ExecutionContext for the callbacks you can specify the * executor in the constructor. * * @param scheduler Reference to Akka scheduler * @param maxFailures Maximum number of failures before opening the circuit * @param callTimeout [[scala.concurrent.duration.FiniteDuration]] of time after which to consider a call a failure * @param resetTimeout [[scala.concurrent.duration.FiniteDuration]] of time after which to attempt to close the circuit */ def apply(scheduler: Scheduler, maxFailures: Int, callTimeout: FiniteDuration, resetTimeout: FiniteDuration): CircuitBreaker = new CircuitBreaker(scheduler, maxFailures, callTimeout, resetTimeout)(sameThreadExecutionContext) /** * Java API: Create a new CircuitBreaker. * * Callbacks run in caller's thread when using withSyncCircuitBreaker, and in same ExecutionContext as the passed * in Future when using withCircuitBreaker. To use another ExecutionContext for the callbacks you can specify the * executor in the constructor. * * @param scheduler Reference to Akka scheduler * @param maxFailures Maximum number of failures before opening the circuit * @param callTimeout [[scala.concurrent.duration.FiniteDuration]] of time after which to consider a call a failure * @param resetTimeout [[scala.concurrent.duration.FiniteDuration]] of time after which to attempt to close the circuit */ def create(scheduler: Scheduler, maxFailures: Int, callTimeout: FiniteDuration, resetTimeout: FiniteDuration): CircuitBreaker = apply(scheduler, maxFailures, callTimeout, resetTimeout) } /** * Provides circuit breaker functionality to provide stability when working with "dangerous" operations, e.g. calls to * remote systems * * Transitions through three states: * - In *Closed* state, calls pass through until the `maxFailures` count is reached. This causes the circuit breaker * to open. Both exceptions and calls exceeding `callTimeout` are considered failures. * - In *Open* state, calls fail-fast with an exception. After `resetTimeout`, circuit breaker transitions to * half-open state. * - In *Half-Open* state, the first call will be allowed through, if it succeeds the circuit breaker will reset to * closed state. If it fails, the circuit breaker will re-open to open state. All calls beyond the first that * execute while the first is running will fail-fast with an exception. * * * @param scheduler Reference to Akka scheduler * @param maxFailures Maximum number of failures before opening the circuit * @param callTimeout [[scala.concurrent.duration.FiniteDuration]] of time after which to consider a call a failure * @param resetTimeout [[scala.concurrent.duration.FiniteDuration]] of time after which to attempt to close the circuit * @param executor [[scala.concurrent.ExecutionContext]] used for execution of state transition listeners */ class CircuitBreaker(scheduler: Scheduler, maxFailures: Int, callTimeout: FiniteDuration, resetTimeout: FiniteDuration)(implicit executor: ExecutionContext) extends AbstractCircuitBreaker { def this(executor: ExecutionContext, scheduler: Scheduler, maxFailures: Int, callTimeout: FiniteDuration, resetTimeout: FiniteDuration) = { this(scheduler, maxFailures, callTimeout, resetTimeout)(executor) } /** * Holds reference to current state of CircuitBreaker - *access only via helper methods* */ @volatile private[this] var _currentStateDoNotCallMeDirectly: State = Closed /** * Helper method for access to underlying state via Unsafe * * @param oldState Previous state on transition * @param newState Next state on transition * @return Whether the previous state matched correctly */ @inline private[this] def swapState(oldState: State, newState: State): Boolean = Unsafe.instance.compareAndSwapObject(this, AbstractCircuitBreaker.stateOffset, oldState, newState) /** * Helper method for accessing underlying state via Unsafe * * @return Reference to current state */ @inline private[this] def currentState: State = Unsafe.instance.getObjectVolatile(this, AbstractCircuitBreaker.stateOffset).asInstanceOf[State] /** * Wraps invocations of asynchronous calls that need to be protected * * @param body Call needing protected * @return [[scala.concurrent.Future]] containing the call result or a * `scala.concurrent.TimeoutException` if the call timed out * */ def withCircuitBreaker[T](body: ⇒ Future[T]): Future[T] = currentState.invoke(body) /** * Java API for [[#withCircuitBreaker]] * * @param body Call needing protected * @return [[scala.concurrent.Future]] containing the call result or a * `scala.concurrent.TimeoutException` if the call timed out */ def callWithCircuitBreaker[T](body: Callable[Future[T]]): Future[T] = withCircuitBreaker(body.call) /** * Wraps invocations of synchronous calls that need to be protected * * Calls are run in caller's thread. Because of the synchronous nature of * this call the `scala.concurrent.TimeoutException` will only be thrown * after the body has completed. * * Throws java.util.concurrent.TimeoutException if the call timed out. * * @param body Call needing protected * @return The result of the call */ def withSyncCircuitBreaker[T](body: ⇒ T): T = Await.result( withCircuitBreaker(try Future.successful(body) catch { case NonFatal(t) ⇒ Future.failed(t) }), callTimeout) /** * Java API for [[#withSyncCircuitBreaker]]. Throws [[java.util.concurrent.TimeoutException]] if the call timed out. * * @param body Call needing protected * @return The result of the call */ def callWithSyncCircuitBreaker[T](body: Callable[T]): T = withSyncCircuitBreaker(body.call) /** * Adds a callback to execute when circuit breaker opens * * The callback is run in the [[scala.concurrent.ExecutionContext]] supplied in the constructor. * * @param callback Handler to be invoked on state change * @return CircuitBreaker for fluent usage */ def onOpen(callback: ⇒ Unit): CircuitBreaker = onOpen(new Runnable { def run = callback }) /** * Java API for onOpen * * @param callback Handler to be invoked on state change * @return CircuitBreaker for fluent usage */ def onOpen(callback: Runnable): CircuitBreaker = { Open addListener callback this } /** * Adds a callback to execute when circuit breaker transitions to half-open * * The callback is run in the [[scala.concurrent.ExecutionContext]] supplied in the constructor. * * @param callback Handler to be invoked on state change * @return CircuitBreaker for fluent usage */ def onHalfOpen(callback: ⇒ Unit): CircuitBreaker = onHalfOpen(new Runnable { def run = callback }) /** * JavaAPI for onHalfOpen * * @param callback Handler to be invoked on state change * @return CircuitBreaker for fluent usage */ def onHalfOpen(callback: Runnable): CircuitBreaker = { HalfOpen addListener callback this } /** * Adds a callback to execute when circuit breaker state closes * * The callback is run in the [[scala.concurrent.ExecutionContext]] supplied in the constructor. * * @param callback Handler to be invoked on state change * @return CircuitBreaker for fluent usage */ def onClose(callback: ⇒ Unit): CircuitBreaker = onClose(new Runnable { def run = callback }) /** * JavaAPI for onClose * * @param callback Handler to be invoked on state change * @return CircuitBreaker for fluent usage */ def onClose(callback: Runnable): CircuitBreaker = { Closed addListener callback this } /** * Retrieves current failure count. * * @return count */ private[akka] def currentFailureCount: Int = Closed.get /** * Implements consistent transition between states. Throws IllegalStateException if an invalid transition is attempted. * * @param fromState State being transitioning from * @param toState State being transitioning from */ private def transition(fromState: State, toState: State): Unit = { if (swapState(fromState, toState)) toState.enter() // else some other thread already swapped state } /** * Trips breaker to an open state. This is valid from Closed or Half-Open states. * * @param fromState State we're coming from (Closed or Half-Open) */ private def tripBreaker(fromState: State): Unit = transition(fromState, Open) /** * Resets breaker to a closed state. This is valid from an Half-Open state only. * */ private def resetBreaker(): Unit = transition(HalfOpen, Closed) /** * Attempts to reset breaker by transitioning to a half-open state. This is valid from an Open state only. * */ private def attemptReset(): Unit = transition(Open, HalfOpen) private val timeoutFuture = Future.failed(new TimeoutException("Circuit Breaker Timed out.") with NoStackTrace) /** * Internal state abstraction */ private sealed trait State { private val listeners = new CopyOnWriteArrayList[Runnable] /** * Add a listener function which is invoked on state entry * * @param listener listener implementation */ def addListener(listener: Runnable): Unit = listeners add listener /** * Test for whether listeners exist * * @return whether listeners exist */ private def hasListeners: Boolean = !listeners.isEmpty /** * Notifies the listeners of the transition event via a Future executed in implicit parameter ExecutionContext * * @return Promise which executes listener in supplied [[scala.concurrent.ExecutionContext]] */ protected def notifyTransitionListeners() { if (hasListeners) { val iterator = listeners.iterator while (iterator.hasNext) { val listener = iterator.next executor.execute(listener) } } } /** * Shared implementation of call across all states. Thrown exception or execution of the call beyond the allowed * call timeout is counted as a failed call, otherwise a successful call * * @param body Implementation of the call * @return Future containing the result of the call */ def callThrough[T](body: ⇒ Future[T]): Future[T] = { def materialize[U](value: ⇒ Future[U]): Future[U] = try value catch { case NonFatal(t) ⇒ Future.failed(t) } if (callTimeout == Duration.Zero) { materialize(body) } else { val p = Promise[T]() implicit val ec = sameThreadExecutionContext p.future.onComplete { case s: Success[_] ⇒ callSucceeds() case _ ⇒ callFails() } val timeout = scheduler.scheduleOnce(callTimeout) { p tryCompleteWith timeoutFuture } materialize(body).onComplete { result ⇒ p tryComplete result timeout.cancel } p.future } } /** * Abstract entry point for all states * * @param body Implementation of the call that needs protected * @return Future containing result of protected call */ def invoke[T](body: ⇒ Future[T]): Future[T] /** * Invoked when call succeeds * */ def callSucceeds(): Unit /** * Invoked when call fails * */ def callFails(): Unit /** * Invoked on the transitioned-to state during transition. Notifies listeners after invoking subclass template * method _enter * */ final def enter(): Unit = { _enter() notifyTransitionListeners() } /** * Template method for concrete traits * */ def _enter(): Unit } /** * Concrete implementation of Closed state */ private object Closed extends AtomicInteger with State { /** * Implementation of invoke, which simply attempts the call * * @param body Implementation of the call that needs protected * @return Future containing result of protected call */ override def invoke[T](body: ⇒ Future[T]): Future[T] = callThrough(body) /** * On successful call, the failure count is reset to 0 * * @return */ override def callSucceeds(): Unit = set(0) /** * On failed call, the failure count is incremented. The count is checked against the configured maxFailures, and * the breaker is tripped if we have reached maxFailures. * * @return */ override def callFails(): Unit = if (incrementAndGet() == maxFailures) tripBreaker(Closed) /** * On entry of this state, failure count is reset. * * @return */ override def _enter(): Unit = set(0) /** * Override for more descriptive toString * * @return */ override def toString: String = "Closed with failure count = " + get() } /** * Concrete implementation of half-open state */ private object HalfOpen extends AtomicBoolean(true) with State { /** * Allows a single call through, during which all other callers fail-fast. If the call fails, the breaker reopens. * If the call succeeds the breaker closes. * * @param body Implementation of the call that needs protected * @return Future containing result of protected call */ override def invoke[T](body: ⇒ Future[T]): Future[T] = if (compareAndSet(true, false)) callThrough(body) else Promise.failed[T](new CircuitBreakerOpenException(0.seconds)).future /** * Reset breaker on successful call. * * @return */ override def callSucceeds(): Unit = resetBreaker() /** * Reopen breaker on failed call. * * @return */ override def callFails(): Unit = tripBreaker(HalfOpen) /** * On entry, guard should be reset for that first call to get in * * @return */ override def _enter(): Unit = set(true) /** * Override for more descriptive toString * * @return */ override def toString: String = "Half-Open currently testing call for success = " + get() } /** * Concrete implementation of Open state */ private object Open extends AtomicLong with State { /** * Fail-fast on any invocation * * @param body Implementation of the call that needs protected * @return Future containing result of protected call */ override def invoke[T](body: ⇒ Future[T]): Future[T] = Promise.failed[T](new CircuitBreakerOpenException(remainingDuration())).future /** * Calculate remaining duration until reset to inform the caller in case a backoff algorithm is useful * * @return duration to when the breaker will attempt a reset by transitioning to half-open */ private def remainingDuration(): FiniteDuration = { val diff = System.nanoTime() - get if (diff <= 0L) Duration.Zero else diff.nanos } /** * No-op for open, calls are never executed so cannot succeed or fail * * @return */ override def callSucceeds(): Unit = () /** * No-op for open, calls are never executed so cannot succeed or fail * * @return */ override def callFails(): Unit = () /** * On entering this state, schedule an attempted reset via [[akka.actor.Scheduler]] and store the entry time to * calculate remaining time before attempted reset. * * @return */ override def _enter(): Unit = { set(System.nanoTime()) scheduler.scheduleOnce(resetTimeout) { attemptReset() } } /** * Override for more descriptive toString * * @return */ override def toString: String = "Open" } } /** * Exception thrown when Circuit Breaker is open. * * @param remainingDuration Stores remaining time before attempting a reset. Zero duration means the breaker is * currently in half-open state. * @param message Defaults to "Circuit Breaker is open; calls are failing fast" */ class CircuitBreakerOpenException( val remainingDuration: FiniteDuration, message: String = "Circuit Breaker is open; calls are failing fast") extends AkkaException(message) with NoStackTrace
jmnarloch/akka.js
akka-js-actor/jvm/src/main/scala/akka/pattern/CircuitBreaker.scala
Scala
bsd-3-clause
17,357
package usb // DO NOT EDIT THIS FILE. GENERATED BY xgen. import ( "bits" "mmio" "unsafe" "stm32/o/f411xe/mmap" ) type USB_OTG_Device_Periph struct { DCFG RDCFG DCTL RDCTL DSTS RDSTS _ uint32 DIEPMSK RDIEPMSK DOEPMSK RDOEPMSK DAINT RDAINT DAINTMSK RDAINTMSK _ [2]uint32 DVBUSDIS RDVBUSDIS DVBUSPULSE RDVBUSPULSE DTHRCTL RDTHRCTL DIEPEMPMSK RDIEPEMPMSK DEACHINT RDEACHINT DEACHMSK RDEACHMSK _ uint32 DINEP1MSK RDINEP1MSK _ [15]uint32 DOUTEP1MSK RDOUTEP1MSK } func (p *USB_OTG_Device_Periph) BaseAddr() uintptr { return uintptr(unsafe.Pointer(p)) } type DCFG uint32 func (b DCFG) Field(mask DCFG) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DCFG) J(v int) DCFG { return DCFG(bits.MakeField32(v, uint32(mask))) } type RDCFG struct{ mmio.U32 } func (r *RDCFG) Bits(mask DCFG) DCFG { return DCFG(r.U32.Bits(uint32(mask))) } func (r *RDCFG) StoreBits(mask, b DCFG) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDCFG) SetBits(mask DCFG) { r.U32.SetBits(uint32(mask)) } func (r *RDCFG) ClearBits(mask DCFG) { r.U32.ClearBits(uint32(mask)) } func (r *RDCFG) Load() DCFG { return DCFG(r.U32.Load()) } func (r *RDCFG) Store(b DCFG) { r.U32.Store(uint32(b)) } func (r *RDCFG) AtomicStoreBits(mask, b DCFG) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDCFG) AtomicSetBits(mask DCFG) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDCFG) AtomicClearBits(mask DCFG) { r.U32.AtomicClearBits(uint32(mask)) } type RMDCFG struct{ mmio.UM32 } func (rm RMDCFG) Load() DCFG { return DCFG(rm.UM32.Load()) } func (rm RMDCFG) Store(b DCFG) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) DSPD() RMDCFG { return RMDCFG{mmio.UM32{&p.DCFG.U32, uint32(DSPD)}} } func (p *USB_OTG_Device_Periph) NZLSOHSK() RMDCFG { return RMDCFG{mmio.UM32{&p.DCFG.U32, uint32(NZLSOHSK)}} } func (p *USB_OTG_Device_Periph) DAD() RMDCFG { return RMDCFG{mmio.UM32{&p.DCFG.U32, uint32(DAD)}} } func (p *USB_OTG_Device_Periph) PFIVL() RMDCFG { return RMDCFG{mmio.UM32{&p.DCFG.U32, uint32(PFIVL)}} } func (p *USB_OTG_Device_Periph) PERSCHIVL() RMDCFG { return RMDCFG{mmio.UM32{&p.DCFG.U32, uint32(PERSCHIVL)}} } type DCTL uint32 func (b DCTL) Field(mask DCTL) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DCTL) J(v int) DCTL { return DCTL(bits.MakeField32(v, uint32(mask))) } type RDCTL struct{ mmio.U32 } func (r *RDCTL) Bits(mask DCTL) DCTL { return DCTL(r.U32.Bits(uint32(mask))) } func (r *RDCTL) StoreBits(mask, b DCTL) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDCTL) SetBits(mask DCTL) { r.U32.SetBits(uint32(mask)) } func (r *RDCTL) ClearBits(mask DCTL) { r.U32.ClearBits(uint32(mask)) } func (r *RDCTL) Load() DCTL { return DCTL(r.U32.Load()) } func (r *RDCTL) Store(b DCTL) { r.U32.Store(uint32(b)) } func (r *RDCTL) AtomicStoreBits(mask, b DCTL) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDCTL) AtomicSetBits(mask DCTL) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDCTL) AtomicClearBits(mask DCTL) { r.U32.AtomicClearBits(uint32(mask)) } type RMDCTL struct{ mmio.UM32 } func (rm RMDCTL) Load() DCTL { return DCTL(rm.UM32.Load()) } func (rm RMDCTL) Store(b DCTL) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) RWUSIG() RMDCTL { return RMDCTL{mmio.UM32{&p.DCTL.U32, uint32(RWUSIG)}} } func (p *USB_OTG_Device_Periph) SDIS() RMDCTL { return RMDCTL{mmio.UM32{&p.DCTL.U32, uint32(SDIS)}} } func (p *USB_OTG_Device_Periph) GINSTS() RMDCTL { return RMDCTL{mmio.UM32{&p.DCTL.U32, uint32(GINSTS)}} } func (p *USB_OTG_Device_Periph) GONSTS() RMDCTL { return RMDCTL{mmio.UM32{&p.DCTL.U32, uint32(GONSTS)}} } func (p *USB_OTG_Device_Periph) TCTL() RMDCTL { return RMDCTL{mmio.UM32{&p.DCTL.U32, uint32(TCTL)}} } func (p *USB_OTG_Device_Periph) SGINAK() RMDCTL { return RMDCTL{mmio.UM32{&p.DCTL.U32, uint32(SGINAK)}} } func (p *USB_OTG_Device_Periph) CGINAK() RMDCTL { return RMDCTL{mmio.UM32{&p.DCTL.U32, uint32(CGINAK)}} } func (p *USB_OTG_Device_Periph) SGONAK() RMDCTL { return RMDCTL{mmio.UM32{&p.DCTL.U32, uint32(SGONAK)}} } func (p *USB_OTG_Device_Periph) CGONAK() RMDCTL { return RMDCTL{mmio.UM32{&p.DCTL.U32, uint32(CGONAK)}} } func (p *USB_OTG_Device_Periph) POPRGDNE() RMDCTL { return RMDCTL{mmio.UM32{&p.DCTL.U32, uint32(POPRGDNE)}} } type DSTS uint32 func (b DSTS) Field(mask DSTS) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DSTS) J(v int) DSTS { return DSTS(bits.MakeField32(v, uint32(mask))) } type RDSTS struct{ mmio.U32 } func (r *RDSTS) Bits(mask DSTS) DSTS { return DSTS(r.U32.Bits(uint32(mask))) } func (r *RDSTS) StoreBits(mask, b DSTS) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDSTS) SetBits(mask DSTS) { r.U32.SetBits(uint32(mask)) } func (r *RDSTS) ClearBits(mask DSTS) { r.U32.ClearBits(uint32(mask)) } func (r *RDSTS) Load() DSTS { return DSTS(r.U32.Load()) } func (r *RDSTS) Store(b DSTS) { r.U32.Store(uint32(b)) } func (r *RDSTS) AtomicStoreBits(mask, b DSTS) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDSTS) AtomicSetBits(mask DSTS) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDSTS) AtomicClearBits(mask DSTS) { r.U32.AtomicClearBits(uint32(mask)) } type RMDSTS struct{ mmio.UM32 } func (rm RMDSTS) Load() DSTS { return DSTS(rm.UM32.Load()) } func (rm RMDSTS) Store(b DSTS) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) SUSPSTS() RMDSTS { return RMDSTS{mmio.UM32{&p.DSTS.U32, uint32(SUSPSTS)}} } func (p *USB_OTG_Device_Periph) ENUMSPD() RMDSTS { return RMDSTS{mmio.UM32{&p.DSTS.U32, uint32(ENUMSPD)}} } func (p *USB_OTG_Device_Periph) EERR() RMDSTS { return RMDSTS{mmio.UM32{&p.DSTS.U32, uint32(EERR)}} } func (p *USB_OTG_Device_Periph) FNSOF() RMDSTS { return RMDSTS{mmio.UM32{&p.DSTS.U32, uint32(FNSOF)}} } type DIEPMSK uint32 func (b DIEPMSK) Field(mask DIEPMSK) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DIEPMSK) J(v int) DIEPMSK { return DIEPMSK(bits.MakeField32(v, uint32(mask))) } type RDIEPMSK struct{ mmio.U32 } func (r *RDIEPMSK) Bits(mask DIEPMSK) DIEPMSK { return DIEPMSK(r.U32.Bits(uint32(mask))) } func (r *RDIEPMSK) StoreBits(mask, b DIEPMSK) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDIEPMSK) SetBits(mask DIEPMSK) { r.U32.SetBits(uint32(mask)) } func (r *RDIEPMSK) ClearBits(mask DIEPMSK) { r.U32.ClearBits(uint32(mask)) } func (r *RDIEPMSK) Load() DIEPMSK { return DIEPMSK(r.U32.Load()) } func (r *RDIEPMSK) Store(b DIEPMSK) { r.U32.Store(uint32(b)) } func (r *RDIEPMSK) AtomicStoreBits(mask, b DIEPMSK) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDIEPMSK) AtomicSetBits(mask DIEPMSK) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDIEPMSK) AtomicClearBits(mask DIEPMSK) { r.U32.AtomicClearBits(uint32(mask)) } type RMDIEPMSK struct{ mmio.UM32 } func (rm RMDIEPMSK) Load() DIEPMSK { return DIEPMSK(rm.UM32.Load()) } func (rm RMDIEPMSK) Store(b DIEPMSK) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) XFRCM() RMDIEPMSK { return RMDIEPMSK{mmio.UM32{&p.DIEPMSK.U32, uint32(XFRCM)}} } func (p *USB_OTG_Device_Periph) EPDM() RMDIEPMSK { return RMDIEPMSK{mmio.UM32{&p.DIEPMSK.U32, uint32(EPDM)}} } func (p *USB_OTG_Device_Periph) TOM() RMDIEPMSK { return RMDIEPMSK{mmio.UM32{&p.DIEPMSK.U32, uint32(TOM)}} } func (p *USB_OTG_Device_Periph) ITTXFEMSK() RMDIEPMSK { return RMDIEPMSK{mmio.UM32{&p.DIEPMSK.U32, uint32(ITTXFEMSK)}} } func (p *USB_OTG_Device_Periph) INEPNMM() RMDIEPMSK { return RMDIEPMSK{mmio.UM32{&p.DIEPMSK.U32, uint32(INEPNMM)}} } func (p *USB_OTG_Device_Periph) INEPNEM() RMDIEPMSK { return RMDIEPMSK{mmio.UM32{&p.DIEPMSK.U32, uint32(INEPNEM)}} } func (p *USB_OTG_Device_Periph) TXFURM() RMDIEPMSK { return RMDIEPMSK{mmio.UM32{&p.DIEPMSK.U32, uint32(TXFURM)}} } func (p *USB_OTG_Device_Periph) BIM() RMDIEPMSK { return RMDIEPMSK{mmio.UM32{&p.DIEPMSK.U32, uint32(BIM)}} } type DOEPMSK uint32 func (b DOEPMSK) Field(mask DOEPMSK) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DOEPMSK) J(v int) DOEPMSK { return DOEPMSK(bits.MakeField32(v, uint32(mask))) } type RDOEPMSK struct{ mmio.U32 } func (r *RDOEPMSK) Bits(mask DOEPMSK) DOEPMSK { return DOEPMSK(r.U32.Bits(uint32(mask))) } func (r *RDOEPMSK) StoreBits(mask, b DOEPMSK) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDOEPMSK) SetBits(mask DOEPMSK) { r.U32.SetBits(uint32(mask)) } func (r *RDOEPMSK) ClearBits(mask DOEPMSK) { r.U32.ClearBits(uint32(mask)) } func (r *RDOEPMSK) Load() DOEPMSK { return DOEPMSK(r.U32.Load()) } func (r *RDOEPMSK) Store(b DOEPMSK) { r.U32.Store(uint32(b)) } func (r *RDOEPMSK) AtomicStoreBits(mask, b DOEPMSK) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDOEPMSK) AtomicSetBits(mask DOEPMSK) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDOEPMSK) AtomicClearBits(mask DOEPMSK) { r.U32.AtomicClearBits(uint32(mask)) } type RMDOEPMSK struct{ mmio.UM32 } func (rm RMDOEPMSK) Load() DOEPMSK { return DOEPMSK(rm.UM32.Load()) } func (rm RMDOEPMSK) Store(b DOEPMSK) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) XFRCM() RMDOEPMSK { return RMDOEPMSK{mmio.UM32{&p.DOEPMSK.U32, uint32(XFRCM)}} } func (p *USB_OTG_Device_Periph) EPDM() RMDOEPMSK { return RMDOEPMSK{mmio.UM32{&p.DOEPMSK.U32, uint32(EPDM)}} } func (p *USB_OTG_Device_Periph) STUPM() RMDOEPMSK { return RMDOEPMSK{mmio.UM32{&p.DOEPMSK.U32, uint32(STUPM)}} } func (p *USB_OTG_Device_Periph) OTEPDM() RMDOEPMSK { return RMDOEPMSK{mmio.UM32{&p.DOEPMSK.U32, uint32(OTEPDM)}} } func (p *USB_OTG_Device_Periph) B2BSTUP() RMDOEPMSK { return RMDOEPMSK{mmio.UM32{&p.DOEPMSK.U32, uint32(B2BSTUP)}} } func (p *USB_OTG_Device_Periph) OPEM() RMDOEPMSK { return RMDOEPMSK{mmio.UM32{&p.DOEPMSK.U32, uint32(OPEM)}} } func (p *USB_OTG_Device_Periph) BOIM() RMDOEPMSK { return RMDOEPMSK{mmio.UM32{&p.DOEPMSK.U32, uint32(BOIM)}} } type DAINT uint32 func (b DAINT) Field(mask DAINT) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DAINT) J(v int) DAINT { return DAINT(bits.MakeField32(v, uint32(mask))) } type RDAINT struct{ mmio.U32 } func (r *RDAINT) Bits(mask DAINT) DAINT { return DAINT(r.U32.Bits(uint32(mask))) } func (r *RDAINT) StoreBits(mask, b DAINT) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDAINT) SetBits(mask DAINT) { r.U32.SetBits(uint32(mask)) } func (r *RDAINT) ClearBits(mask DAINT) { r.U32.ClearBits(uint32(mask)) } func (r *RDAINT) Load() DAINT { return DAINT(r.U32.Load()) } func (r *RDAINT) Store(b DAINT) { r.U32.Store(uint32(b)) } func (r *RDAINT) AtomicStoreBits(mask, b DAINT) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDAINT) AtomicSetBits(mask DAINT) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDAINT) AtomicClearBits(mask DAINT) { r.U32.AtomicClearBits(uint32(mask)) } type RMDAINT struct{ mmio.UM32 } func (rm RMDAINT) Load() DAINT { return DAINT(rm.UM32.Load()) } func (rm RMDAINT) Store(b DAINT) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) IEPINT() RMDAINT { return RMDAINT{mmio.UM32{&p.DAINT.U32, uint32(IEPINT)}} } func (p *USB_OTG_Device_Periph) OEPINT() RMDAINT { return RMDAINT{mmio.UM32{&p.DAINT.U32, uint32(OEPINT)}} } type DAINTMSK uint32 func (b DAINTMSK) Field(mask DAINTMSK) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DAINTMSK) J(v int) DAINTMSK { return DAINTMSK(bits.MakeField32(v, uint32(mask))) } type RDAINTMSK struct{ mmio.U32 } func (r *RDAINTMSK) Bits(mask DAINTMSK) DAINTMSK { return DAINTMSK(r.U32.Bits(uint32(mask))) } func (r *RDAINTMSK) StoreBits(mask, b DAINTMSK) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDAINTMSK) SetBits(mask DAINTMSK) { r.U32.SetBits(uint32(mask)) } func (r *RDAINTMSK) ClearBits(mask DAINTMSK) { r.U32.ClearBits(uint32(mask)) } func (r *RDAINTMSK) Load() DAINTMSK { return DAINTMSK(r.U32.Load()) } func (r *RDAINTMSK) Store(b DAINTMSK) { r.U32.Store(uint32(b)) } func (r *RDAINTMSK) AtomicStoreBits(mask, b DAINTMSK) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDAINTMSK) AtomicSetBits(mask DAINTMSK) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDAINTMSK) AtomicClearBits(mask DAINTMSK) { r.U32.AtomicClearBits(uint32(mask)) } type RMDAINTMSK struct{ mmio.UM32 } func (rm RMDAINTMSK) Load() DAINTMSK { return DAINTMSK(rm.UM32.Load()) } func (rm RMDAINTMSK) Store(b DAINTMSK) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) IEPM() RMDAINTMSK { return RMDAINTMSK{mmio.UM32{&p.DAINTMSK.U32, uint32(IEPM)}} } func (p *USB_OTG_Device_Periph) OEPM() RMDAINTMSK { return RMDAINTMSK{mmio.UM32{&p.DAINTMSK.U32, uint32(OEPM)}} } type DVBUSDIS uint32 func (b DVBUSDIS) Field(mask DVBUSDIS) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DVBUSDIS) J(v int) DVBUSDIS { return DVBUSDIS(bits.MakeField32(v, uint32(mask))) } type RDVBUSDIS struct{ mmio.U32 } func (r *RDVBUSDIS) Bits(mask DVBUSDIS) DVBUSDIS { return DVBUSDIS(r.U32.Bits(uint32(mask))) } func (r *RDVBUSDIS) StoreBits(mask, b DVBUSDIS) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDVBUSDIS) SetBits(mask DVBUSDIS) { r.U32.SetBits(uint32(mask)) } func (r *RDVBUSDIS) ClearBits(mask DVBUSDIS) { r.U32.ClearBits(uint32(mask)) } func (r *RDVBUSDIS) Load() DVBUSDIS { return DVBUSDIS(r.U32.Load()) } func (r *RDVBUSDIS) Store(b DVBUSDIS) { r.U32.Store(uint32(b)) } func (r *RDVBUSDIS) AtomicStoreBits(mask, b DVBUSDIS) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDVBUSDIS) AtomicSetBits(mask DVBUSDIS) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDVBUSDIS) AtomicClearBits(mask DVBUSDIS) { r.U32.AtomicClearBits(uint32(mask)) } type RMDVBUSDIS struct{ mmio.UM32 } func (rm RMDVBUSDIS) Load() DVBUSDIS { return DVBUSDIS(rm.UM32.Load()) } func (rm RMDVBUSDIS) Store(b DVBUSDIS) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) VBUSDT() RMDVBUSDIS { return RMDVBUSDIS{mmio.UM32{&p.DVBUSDIS.U32, uint32(VBUSDT)}} } type DVBUSPULSE uint32 func (b DVBUSPULSE) Field(mask DVBUSPULSE) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DVBUSPULSE) J(v int) DVBUSPULSE { return DVBUSPULSE(bits.MakeField32(v, uint32(mask))) } type RDVBUSPULSE struct{ mmio.U32 } func (r *RDVBUSPULSE) Bits(mask DVBUSPULSE) DVBUSPULSE { return DVBUSPULSE(r.U32.Bits(uint32(mask))) } func (r *RDVBUSPULSE) StoreBits(mask, b DVBUSPULSE) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDVBUSPULSE) SetBits(mask DVBUSPULSE) { r.U32.SetBits(uint32(mask)) } func (r *RDVBUSPULSE) ClearBits(mask DVBUSPULSE) { r.U32.ClearBits(uint32(mask)) } func (r *RDVBUSPULSE) Load() DVBUSPULSE { return DVBUSPULSE(r.U32.Load()) } func (r *RDVBUSPULSE) Store(b DVBUSPULSE) { r.U32.Store(uint32(b)) } func (r *RDVBUSPULSE) AtomicStoreBits(mask, b DVBUSPULSE) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDVBUSPULSE) AtomicSetBits(mask DVBUSPULSE) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDVBUSPULSE) AtomicClearBits(mask DVBUSPULSE) { r.U32.AtomicClearBits(uint32(mask)) } type RMDVBUSPULSE struct{ mmio.UM32 } func (rm RMDVBUSPULSE) Load() DVBUSPULSE { return DVBUSPULSE(rm.UM32.Load()) } func (rm RMDVBUSPULSE) Store(b DVBUSPULSE) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) DVBUSP() RMDVBUSPULSE { return RMDVBUSPULSE{mmio.UM32{&p.DVBUSPULSE.U32, uint32(DVBUSP)}} } type DTHRCTL uint32 func (b DTHRCTL) Field(mask DTHRCTL) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DTHRCTL) J(v int) DTHRCTL { return DTHRCTL(bits.MakeField32(v, uint32(mask))) } type RDTHRCTL struct{ mmio.U32 } func (r *RDTHRCTL) Bits(mask DTHRCTL) DTHRCTL { return DTHRCTL(r.U32.Bits(uint32(mask))) } func (r *RDTHRCTL) StoreBits(mask, b DTHRCTL) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDTHRCTL) SetBits(mask DTHRCTL) { r.U32.SetBits(uint32(mask)) } func (r *RDTHRCTL) ClearBits(mask DTHRCTL) { r.U32.ClearBits(uint32(mask)) } func (r *RDTHRCTL) Load() DTHRCTL { return DTHRCTL(r.U32.Load()) } func (r *RDTHRCTL) Store(b DTHRCTL) { r.U32.Store(uint32(b)) } func (r *RDTHRCTL) AtomicStoreBits(mask, b DTHRCTL) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDTHRCTL) AtomicSetBits(mask DTHRCTL) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDTHRCTL) AtomicClearBits(mask DTHRCTL) { r.U32.AtomicClearBits(uint32(mask)) } type RMDTHRCTL struct{ mmio.UM32 } func (rm RMDTHRCTL) Load() DTHRCTL { return DTHRCTL(rm.UM32.Load()) } func (rm RMDTHRCTL) Store(b DTHRCTL) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) NONISOTHREN() RMDTHRCTL { return RMDTHRCTL{mmio.UM32{&p.DTHRCTL.U32, uint32(NONISOTHREN)}} } func (p *USB_OTG_Device_Periph) ISOTHREN() RMDTHRCTL { return RMDTHRCTL{mmio.UM32{&p.DTHRCTL.U32, uint32(ISOTHREN)}} } func (p *USB_OTG_Device_Periph) TXTHRLEN() RMDTHRCTL { return RMDTHRCTL{mmio.UM32{&p.DTHRCTL.U32, uint32(TXTHRLEN)}} } func (p *USB_OTG_Device_Periph) RXTHREN() RMDTHRCTL { return RMDTHRCTL{mmio.UM32{&p.DTHRCTL.U32, uint32(RXTHREN)}} } func (p *USB_OTG_Device_Periph) RXTHRLEN() RMDTHRCTL { return RMDTHRCTL{mmio.UM32{&p.DTHRCTL.U32, uint32(RXTHRLEN)}} } func (p *USB_OTG_Device_Periph) ARPEN() RMDTHRCTL { return RMDTHRCTL{mmio.UM32{&p.DTHRCTL.U32, uint32(ARPEN)}} } type DIEPEMPMSK uint32 func (b DIEPEMPMSK) Field(mask DIEPEMPMSK) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DIEPEMPMSK) J(v int) DIEPEMPMSK { return DIEPEMPMSK(bits.MakeField32(v, uint32(mask))) } type RDIEPEMPMSK struct{ mmio.U32 } func (r *RDIEPEMPMSK) Bits(mask DIEPEMPMSK) DIEPEMPMSK { return DIEPEMPMSK(r.U32.Bits(uint32(mask))) } func (r *RDIEPEMPMSK) StoreBits(mask, b DIEPEMPMSK) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDIEPEMPMSK) SetBits(mask DIEPEMPMSK) { r.U32.SetBits(uint32(mask)) } func (r *RDIEPEMPMSK) ClearBits(mask DIEPEMPMSK) { r.U32.ClearBits(uint32(mask)) } func (r *RDIEPEMPMSK) Load() DIEPEMPMSK { return DIEPEMPMSK(r.U32.Load()) } func (r *RDIEPEMPMSK) Store(b DIEPEMPMSK) { r.U32.Store(uint32(b)) } func (r *RDIEPEMPMSK) AtomicStoreBits(mask, b DIEPEMPMSK) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDIEPEMPMSK) AtomicSetBits(mask DIEPEMPMSK) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDIEPEMPMSK) AtomicClearBits(mask DIEPEMPMSK) { r.U32.AtomicClearBits(uint32(mask)) } type RMDIEPEMPMSK struct{ mmio.UM32 } func (rm RMDIEPEMPMSK) Load() DIEPEMPMSK { return DIEPEMPMSK(rm.UM32.Load()) } func (rm RMDIEPEMPMSK) Store(b DIEPEMPMSK) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) INEPTXFEM() RMDIEPEMPMSK { return RMDIEPEMPMSK{mmio.UM32{&p.DIEPEMPMSK.U32, uint32(INEPTXFEM)}} } type DEACHINT uint32 func (b DEACHINT) Field(mask DEACHINT) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DEACHINT) J(v int) DEACHINT { return DEACHINT(bits.MakeField32(v, uint32(mask))) } type RDEACHINT struct{ mmio.U32 } func (r *RDEACHINT) Bits(mask DEACHINT) DEACHINT { return DEACHINT(r.U32.Bits(uint32(mask))) } func (r *RDEACHINT) StoreBits(mask, b DEACHINT) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDEACHINT) SetBits(mask DEACHINT) { r.U32.SetBits(uint32(mask)) } func (r *RDEACHINT) ClearBits(mask DEACHINT) { r.U32.ClearBits(uint32(mask)) } func (r *RDEACHINT) Load() DEACHINT { return DEACHINT(r.U32.Load()) } func (r *RDEACHINT) Store(b DEACHINT) { r.U32.Store(uint32(b)) } func (r *RDEACHINT) AtomicStoreBits(mask, b DEACHINT) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDEACHINT) AtomicSetBits(mask DEACHINT) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDEACHINT) AtomicClearBits(mask DEACHINT) { r.U32.AtomicClearBits(uint32(mask)) } type RMDEACHINT struct{ mmio.UM32 } func (rm RMDEACHINT) Load() DEACHINT { return DEACHINT(rm.UM32.Load()) } func (rm RMDEACHINT) Store(b DEACHINT) { rm.UM32.Store(uint32(b)) } func (p *USB_OTG_Device_Periph) IEP1INT() RMDEACHINT { return RMDEACHINT{mmio.UM32{&p.DEACHINT.U32, uint32(IEP1INT)}} } func (p *USB_OTG_Device_Periph) OEP1INT() RMDEACHINT { return RMDEACHINT{mmio.UM32{&p.DEACHINT.U32, uint32(OEP1INT)}} } type DEACHMSK uint32 func (b DEACHMSK) Field(mask DEACHMSK) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DEACHMSK) J(v int) DEACHMSK { return DEACHMSK(bits.MakeField32(v, uint32(mask))) } type RDEACHMSK struct{ mmio.U32 } func (r *RDEACHMSK) Bits(mask DEACHMSK) DEACHMSK { return DEACHMSK(r.U32.Bits(uint32(mask))) } func (r *RDEACHMSK) StoreBits(mask, b DEACHMSK) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDEACHMSK) SetBits(mask DEACHMSK) { r.U32.SetBits(uint32(mask)) } func (r *RDEACHMSK) ClearBits(mask DEACHMSK) { r.U32.ClearBits(uint32(mask)) } func (r *RDEACHMSK) Load() DEACHMSK { return DEACHMSK(r.U32.Load()) } func (r *RDEACHMSK) Store(b DEACHMSK) { r.U32.Store(uint32(b)) } func (r *RDEACHMSK) AtomicStoreBits(mask, b DEACHMSK) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDEACHMSK) AtomicSetBits(mask DEACHMSK) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDEACHMSK) AtomicClearBits(mask DEACHMSK) { r.U32.AtomicClearBits(uint32(mask)) } type RMDEACHMSK struct{ mmio.UM32 } func (rm RMDEACHMSK) Load() DEACHMSK { return DEACHMSK(rm.UM32.Load()) } func (rm RMDEACHMSK) Store(b DEACHMSK) { rm.UM32.Store(uint32(b)) } type DINEP1MSK uint32 func (b DINEP1MSK) Field(mask DINEP1MSK) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DINEP1MSK) J(v int) DINEP1MSK { return DINEP1MSK(bits.MakeField32(v, uint32(mask))) } type RDINEP1MSK struct{ mmio.U32 } func (r *RDINEP1MSK) Bits(mask DINEP1MSK) DINEP1MSK { return DINEP1MSK(r.U32.Bits(uint32(mask))) } func (r *RDINEP1MSK) StoreBits(mask, b DINEP1MSK) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDINEP1MSK) SetBits(mask DINEP1MSK) { r.U32.SetBits(uint32(mask)) } func (r *RDINEP1MSK) ClearBits(mask DINEP1MSK) { r.U32.ClearBits(uint32(mask)) } func (r *RDINEP1MSK) Load() DINEP1MSK { return DINEP1MSK(r.U32.Load()) } func (r *RDINEP1MSK) Store(b DINEP1MSK) { r.U32.Store(uint32(b)) } func (r *RDINEP1MSK) AtomicStoreBits(mask, b DINEP1MSK) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDINEP1MSK) AtomicSetBits(mask DINEP1MSK) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDINEP1MSK) AtomicClearBits(mask DINEP1MSK) { r.U32.AtomicClearBits(uint32(mask)) } type RMDINEP1MSK struct{ mmio.UM32 } func (rm RMDINEP1MSK) Load() DINEP1MSK { return DINEP1MSK(rm.UM32.Load()) } func (rm RMDINEP1MSK) Store(b DINEP1MSK) { rm.UM32.Store(uint32(b)) } type DOUTEP1MSK uint32 func (b DOUTEP1MSK) Field(mask DOUTEP1MSK) int { return bits.Field32(uint32(b), uint32(mask)) } func (mask DOUTEP1MSK) J(v int) DOUTEP1MSK { return DOUTEP1MSK(bits.MakeField32(v, uint32(mask))) } type RDOUTEP1MSK struct{ mmio.U32 } func (r *RDOUTEP1MSK) Bits(mask DOUTEP1MSK) DOUTEP1MSK { return DOUTEP1MSK(r.U32.Bits(uint32(mask))) } func (r *RDOUTEP1MSK) StoreBits(mask, b DOUTEP1MSK) { r.U32.StoreBits(uint32(mask), uint32(b)) } func (r *RDOUTEP1MSK) SetBits(mask DOUTEP1MSK) { r.U32.SetBits(uint32(mask)) } func (r *RDOUTEP1MSK) ClearBits(mask DOUTEP1MSK) { r.U32.ClearBits(uint32(mask)) } func (r *RDOUTEP1MSK) Load() DOUTEP1MSK { return DOUTEP1MSK(r.U32.Load()) } func (r *RDOUTEP1MSK) Store(b DOUTEP1MSK) { r.U32.Store(uint32(b)) } func (r *RDOUTEP1MSK) AtomicStoreBits(mask, b DOUTEP1MSK) { r.U32.AtomicStoreBits(uint32(mask), uint32(b)) } func (r *RDOUTEP1MSK) AtomicSetBits(mask DOUTEP1MSK) { r.U32.AtomicSetBits(uint32(mask)) } func (r *RDOUTEP1MSK) AtomicClearBits(mask DOUTEP1MSK) { r.U32.AtomicClearBits(uint32(mask)) } type RMDOUTEP1MSK struct{ mmio.UM32 } func (rm RMDOUTEP1MSK) Load() DOUTEP1MSK { return DOUTEP1MSK(rm.UM32.Load()) } func (rm RMDOUTEP1MSK) Store(b DOUTEP1MSK) { rm.UM32.Store(uint32(b)) }
ziutek/emgo
egpath/src/stm32/o/f411xe/usb/xgen_usb_otg_device.go
GO
bsd-3-clause
24,326
<!DOCTYPE html> <html lang="en"> <head> <title>web-conv</title> <meta charset="utf-8"> <link rel="stylesheet" href="../../weblinks/apg-lib-min.css"> </head> <body onload="onload()"> <h1>Test the bundled apg API</h1> <p>Have a look at "apg-api.html" & "apg-api.js" to see how it is used.</p> <p>Click on "generate" to generate a grammar object from the SABNF grammar.<br> (Errors are not reported in detail.)</p> <p> Then click the "parse" button to use the generated grammar object to parse the input string.</p> <p class="title"> <b>SABNF grammar:</b> </p> <textarea id="grammar" rows="20" cols="75" style="float: left;"></textarea> <p>&nbsp;&nbsp;<input type="button" value="generate" style="width: 100px;" onclick="generate()"></p> <p class="title" style="clear: left;"> <br> <b>SABNF input string:</b> </p> <textarea id="input" rows="20" cols="75" style="float: left;"></textarea> <p>&nbsp;&nbsp;<input type="button" value="parse" style="width: 100px;" onclick="parse()"></p> <p class="title" style="clear: left;"> <br><b>output:</b> </p> <div id="output">Translation will appear here.</div> <script src="../../weblinks/apg-lib-min.js"></script> <script src="../../weblinks/apg-api-min.js"></script> <script src="./apg-api.js" charset="utf-8"></script> </body> </html>
ldthomas/apg-js2-examples
apg-api/webpage/apg-api.html
HTML
bsd-3-clause
1,315
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Class template bulirsch_stoer_dense_out</title> <link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="../../../index.html" title="Chapter 1. Boost.Numeric.Odeint"> <link rel="up" href="../../../header/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp&gt;"> <link rel="prev" href="../../../header/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp&gt;"> <link rel="next" href="../../../header/boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton.hpp&gt;"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../logo.jpg"></td> <td align="center"><a href="../../../../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="../../../header/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out_hpp.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../header/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out_hpp.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../header/boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton_hpp.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="refentry"> <a name="boost.numeric.odeint.bulirsch_stoer_dense_out"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Class template bulirsch_stoer_dense_out</span></h2> <p>boost::numeric::odeint::bulirsch_stoer_dense_out — The Bulirsch-Stoer algorithm. </p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../header/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out_hpp.html" title="Header &lt;boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp&gt;">boost/numeric/odeint/stepper/bulirsch_stoer_dense_out.hpp</a>&gt; </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> State<span class="special">,</span> <span class="keyword">typename</span> Value <span class="special">=</span> <span class="keyword">double</span><span class="special">,</span> <span class="keyword">typename</span> Deriv <span class="special">=</span> <span class="identifier">State</span><span class="special">,</span> <span class="keyword">typename</span> Time <span class="special">=</span> <span class="identifier">Value</span><span class="special">,</span> <span class="keyword">typename</span> Algebra <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">algebra_dispatcher</span><span class="special">&lt;</span> <span class="identifier">State</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">algebra_type</span><span class="special">,</span> <span class="keyword">typename</span> Operations <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">operations_dispatcher</span><span class="special">&lt;</span> <span class="identifier">State</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">operations_type</span><span class="special">,</span> <span class="keyword">typename</span> Resizer <span class="special">=</span> <span class="identifier">initially_resizer</span><span class="special">&gt;</span> <span class="keyword">class</span> <a class="link" href="bulirsch_stoer_dense_out.html" title="Class template bulirsch_stoer_dense_out">bulirsch_stoer_dense_out</a> <span class="special">{</span> <span class="keyword">public</span><span class="special">:</span> <span class="comment">// types</span> <span class="keyword">typedef</span> <span class="identifier">State</span> <a name="boost.numeric.odeint.bulirsch_stoer_dense_out.state_type"></a><span class="identifier">state_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">Value</span> <a name="boost.numeric.odeint.bulirsch_stoer_dense_out.value_type"></a><span class="identifier">value_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">Deriv</span> <a name="boost.numeric.odeint.bulirsch_stoer_dense_out.deriv_type"></a><span class="identifier">deriv_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">Time</span> <a name="boost.numeric.odeint.bulirsch_stoer_dense_out.time_type"></a><span class="identifier">time_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">Algebra</span> <a name="boost.numeric.odeint.bulirsch_stoer_dense_out.algebra_type"></a><span class="identifier">algebra_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">Operations</span> <a name="boost.numeric.odeint.bulirsch_stoer_dense_out.operations_type"></a><span class="identifier">operations_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">Resizer</span> <a name="boost.numeric.odeint.bulirsch_stoer_dense_out.resizer_type"></a><span class="identifier">resizer_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">dense_output_stepper_tag</span> <a name="boost.numeric.odeint.bulirsch_stoer_dense_out.stepper_category"></a><span class="identifier">stepper_category</span><span class="special">;</span> <span class="comment">// <a class="link" href="bulirsch_stoer_dense_out.html#boost.numeric.odeint.bulirsch_stoer_dense_outconstruct-copy-destruct">construct/copy/destruct</a></span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037268144-bb"><span class="identifier">bulirsch_stoer_dense_out</span></a><span class="special">(</span><span class="identifier">value_type</span> <span class="special">=</span> <span class="number">1E</span><span class="special">-</span><span class="number">6</span><span class="special">,</span> <span class="identifier">value_type</span> <span class="special">=</span> <span class="number">1E</span><span class="special">-</span><span class="number">6</span><span class="special">,</span> <span class="identifier">value_type</span> <span class="special">=</span> <span class="number">1</span><span class="special">.</span><span class="number">0</span><span class="special">,</span> <span class="identifier">value_type</span> <span class="special">=</span> <span class="number">1</span><span class="special">.</span><span class="number">0</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">=</span> <span class="keyword">static_cast</span><span class="special">&lt;</span> <span class="identifier">time_type</span> <span class="special">&gt;</span><span class="special">(</span><span class="number">0</span><span class="special">)</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span><span class="special">;</span> <span class="comment">// <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037318560-bb">public member functions</a></span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span> <span class="keyword">typename</span> StateOut<span class="special">,</span> <span class="keyword">typename</span> DerivOut<span class="special">&gt;</span> <span class="identifier">controlled_step_result</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037318000-bb"><span class="identifier">try_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">DerivOut</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateType<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037304512-bb"><span class="identifier">initialize</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> System<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">&gt;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037298784-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateOut<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037293792-bb"><span class="identifier">calc_state</span></a><span class="special">(</span><span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">const</span> <span class="identifier">state_type</span> <span class="special">&amp;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037288752-bb"><span class="identifier">current_state</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">time_type</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037285600-bb"><span class="identifier">current_time</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">const</span> <span class="identifier">state_type</span> <span class="special">&amp;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037282464-bb"><span class="identifier">previous_state</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">time_type</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037279312-bb"><span class="identifier">previous_time</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">time_type</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037276192-bb"><span class="identifier">current_time_step</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">void</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037273088-bb"><span class="identifier">reset</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateIn<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037271920-bb"><span class="identifier">adjust_size</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="comment">// <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037258304-bb">private member functions</a></span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> StateVector<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037257728-bb"><span class="identifier">extrapolate</span></a><span class="special">(</span><span class="identifier">size_t</span><span class="special">,</span> <span class="identifier">StateVector</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">value_matrix</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateVector<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037251744-bb"><span class="identifier">extrapolate_dense_out</span></a><span class="special">(</span><span class="identifier">size_t</span><span class="special">,</span> <span class="identifier">StateVector</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">value_matrix</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span> <span class="identifier">time_type</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037247008-bb"><span class="identifier">calc_h_opt</span></a><span class="special">(</span><span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">value_type</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">bool</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037243824-bb"><span class="identifier">in_convergence_window</span></a><span class="special">(</span><span class="identifier">size_t</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">bool</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037242016-bb"><span class="identifier">should_reject</span></a><span class="special">(</span><span class="identifier">value_type</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateIn1<span class="special">,</span> <span class="keyword">typename</span> DerivIn1<span class="special">,</span> <span class="keyword">typename</span> StateIn2<span class="special">,</span> <span class="keyword">typename</span> DerivIn2<span class="special">&gt;</span> <span class="identifier">value_type</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037239520-bb"><span class="identifier">prepare_dense_output</span></a><span class="special">(</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn1</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn1</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn2</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn2</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> DerivIn<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037232016-bb"><span class="identifier">calculate_finite_difference</span></a><span class="special">(</span><span class="identifier">size_t</span><span class="special">,</span> <span class="identifier">size_t</span><span class="special">,</span> <span class="identifier">value_type</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateOut<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037227552-bb"><span class="identifier">do_interpolation</span></a><span class="special">(</span><span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateIn<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037224208-bb"><span class="identifier">resize_impl</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="identifier">state_type</span> <span class="special">&amp;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037221824-bb"><span class="identifier">get_current_state</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span> <span class="keyword">const</span> <span class="identifier">state_type</span> <span class="special">&amp;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037220288-bb"><span class="identifier">get_current_state</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">state_type</span> <span class="special">&amp;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037218480-bb"><span class="identifier">get_old_state</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span> <span class="keyword">const</span> <span class="identifier">state_type</span> <span class="special">&amp;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037216944-bb"><span class="identifier">get_old_state</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">deriv_type</span> <span class="special">&amp;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037215136-bb"><span class="identifier">get_current_deriv</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span> <span class="keyword">const</span> <span class="identifier">deriv_type</span> <span class="special">&amp;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037213600-bb"><span class="identifier">get_current_deriv</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">deriv_type</span> <span class="special">&amp;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037211792-bb"><span class="identifier">get_old_deriv</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span> <span class="keyword">const</span> <span class="identifier">deriv_type</span> <span class="special">&amp;</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037210256-bb"><span class="identifier">get_old_deriv</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">void</span> <a class="link" href="bulirsch_stoer_dense_out.html#idm45543037208448-bb"><span class="identifier">toggle_current_state</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span> <span class="comment">// public data members</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">size_t</span> <span class="identifier">m_k_max</span><span class="special">;</span> <span class="special">}</span><span class="special">;</span></pre></div> <div class="refsect1"> <a name="idm45603640523168"></a><h2>Description</h2> <p>The Bulirsch-Stoer is a controlled stepper that adjusts both step size and order of the method. The algorithm uses the modified midpoint and a polynomial extrapolation compute the solution. This class also provides dense output facility.</p> <p> </p> <div class="refsect2"> <a name="idm45603640521984"></a><h3>Template Parameters</h3> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"> <pre class="literallayout"><span class="keyword">typename</span> State</pre> <p>The state type. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">typename</span> Value <span class="special">=</span> <span class="keyword">double</span></pre> <p>The value type. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">typename</span> Deriv <span class="special">=</span> <span class="identifier">State</span></pre> <p>The type representing the time derivative of the state. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">typename</span> Time <span class="special">=</span> <span class="identifier">Value</span></pre> <p>The time representing the independent variable - the time. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">typename</span> Algebra <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">algebra_dispatcher</span><span class="special">&lt;</span> <span class="identifier">State</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">algebra_type</span></pre> <p>The algebra type. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">typename</span> Operations <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">operations_dispatcher</span><span class="special">&lt;</span> <span class="identifier">State</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">operations_type</span></pre> <p>The operations type. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">typename</span> Resizer <span class="special">=</span> <span class="identifier">initially_resizer</span></pre> <p>The resizer policy type. </p> </li> </ol></div> </div> <div class="refsect2"> <a name="idm45603640491616"></a><h3> <a name="boost.numeric.odeint.bulirsch_stoer_dense_outconstruct-copy-destruct"></a><code class="computeroutput">bulirsch_stoer_dense_out</code> public construct/copy/destruct</h3> <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"> <pre class="literallayout"><a name="idm45543037268144-bb"></a><span class="identifier">bulirsch_stoer_dense_out</span><span class="special">(</span><span class="identifier">value_type</span> eps_abs <span class="special">=</span> <span class="number">1E</span><span class="special">-</span><span class="number">6</span><span class="special">,</span> <span class="identifier">value_type</span> eps_rel <span class="special">=</span> <span class="number">1E</span><span class="special">-</span><span class="number">6</span><span class="special">,</span> <span class="identifier">value_type</span> factor_x <span class="special">=</span> <span class="number">1</span><span class="special">.</span><span class="number">0</span><span class="special">,</span> <span class="identifier">value_type</span> factor_dxdt <span class="special">=</span> <span class="number">1</span><span class="special">.</span><span class="number">0</span><span class="special">,</span> <span class="identifier">time_type</span> max_dt <span class="special">=</span> <span class="keyword">static_cast</span><span class="special">&lt;</span> <span class="identifier">time_type</span> <span class="special">&gt;</span><span class="special">(</span><span class="number">0</span><span class="special">)</span><span class="special">,</span> <span class="keyword">bool</span> control_interpolation <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span><span class="special">;</span></pre>Constructs the <code class="computeroutput"><a class="link" href="bulirsch_stoer.html" title="Class template bulirsch_stoer">bulirsch_stoer</a></code> class, including initialization of the error bounds. <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term">Parameters:</span></p></td> <td><div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><code class="computeroutput">control_interpolation</code></span></p></td> <td><p>Set true to additionally control the error of the interpolation. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">eps_abs</code></span></p></td> <td><p>Absolute tolerance level. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">eps_rel</code></span></p></td> <td><p>Relative tolerance level. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">factor_dxdt</code></span></p></td> <td><p>Factor for the weight of the derivative. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">factor_x</code></span></p></td> <td><p>Factor for the weight of the state. </p></td> </tr> </tbody> </table></div></td> </tr></tbody> </table></div> </li></ol></div> </div> <div class="refsect2"> <a name="idm45603640453392"></a><h3> <a name="idm45543037318560-bb"></a><code class="computeroutput">bulirsch_stoer_dense_out</code> public member functions</h3> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span> <span class="keyword">typename</span> StateOut<span class="special">,</span> <span class="keyword">typename</span> DerivOut<span class="special">&gt;</span> <span class="identifier">controlled_step_result</span> <a name="idm45543037318000-bb"></a><span class="identifier">try_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span> in<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&amp;</span> dxdt<span class="special">,</span> <span class="identifier">time_type</span> <span class="special">&amp;</span> t<span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&amp;</span> out<span class="special">,</span> <span class="identifier">DerivOut</span> <span class="special">&amp;</span> dxdt_new<span class="special">,</span> <span class="identifier">time_type</span> <span class="special">&amp;</span> dt<span class="special">)</span><span class="special">;</span></pre>Tries to perform one step. <p>This method tries to do one step with step size dt. If the error estimate is to large, the step is rejected and the method returns fail and the step size dt is reduced. If the error estimate is acceptably small, the step is performed, success is returned and dt might be increased to make the steps as large as possible. This method also updates t if a step is performed. Also, the internal order of the stepper is adjusted if required.</p> <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term">Parameters:</span></p></td> <td><div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><code class="computeroutput">dt</code></span></p></td> <td><p>The step size. Updated. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">dxdt</code></span></p></td> <td><p>The derivative of state. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">in</code></span></p></td> <td><p>The state of the ODE which should be solved. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">out</code></span></p></td> <td><p>Used to store the result of the step. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">system</code></span></p></td> <td><p>The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">t</code></span></p></td> <td><p>The value of the time. Updated if the step is successful. </p></td> </tr> </tbody> </table></div></td> </tr> <tr> <td><p><span class="term">Returns:</span></p></td> <td><p>success if the step was accepted, fail otherwise. </p></td> </tr> </tbody> </table></div> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateType<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45543037304512-bb"></a><span class="identifier">initialize</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateType</span> <span class="special">&amp;</span> x0<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_type</span> <span class="special">&amp;</span> t0<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">time_type</span> <span class="special">&amp;</span> dt0<span class="special">)</span><span class="special">;</span></pre>Initializes the dense output stepper. <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term">Parameters:</span></p></td> <td><div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><code class="computeroutput">dt0</code></span></p></td> <td><p>The initial time step. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">t0</code></span></p></td> <td><p>The initial time. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">x0</code></span></p></td> <td><p>The initial state. </p></td> </tr> </tbody> </table></div></td> </tr></tbody> </table></div> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> System<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">&gt;</span> <a name="idm45543037298784-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">)</span><span class="special">;</span></pre>Does one time step. This is the main method that should be used to integrate an ODE with this stepper. <div class="note"><table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td> <th align="left">Note</th> </tr> <tr><td align="left" valign="top"><p>initialize has to be called before using this method to set the initial conditions x,t and the stepsize. </p></td></tr> </table></div> <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term">Parameters:</span></p></td> <td><div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term"><code class="computeroutput">system</code></span></p></td> <td><p>The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the Simple System concept. </p></td> </tr></tbody> </table></div></td> </tr> <tr> <td><p><span class="term">Returns:</span></p></td> <td><p>Pair with start and end time of the integration step. </p></td> </tr> </tbody> </table></div> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateOut<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45543037293792-bb"></a><span class="identifier">calc_state</span><span class="special">(</span><span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&amp;</span> x<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Calculates the solution at an intermediate point within the last step. <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term">Parameters:</span></p></td> <td><div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><code class="computeroutput">t</code></span></p></td> <td><p>The time at which the solution should be calculated, has to be in the current time interval. </p></td> </tr> <tr> <td><p><span class="term"><code class="computeroutput">x</code></span></p></td> <td><p>The output variable where the result is written into. </p></td> </tr> </tbody> </table></div></td> </tr></tbody> </table></div> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">const</span> <span class="identifier">state_type</span> <span class="special">&amp;</span> <a name="idm45543037288752-bb"></a><span class="identifier">current_state</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns the current state of the solution. <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term">Returns:</span></p></td> <td><p>The current state of the solution x(t). </p></td> </tr></tbody> </table></div> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">time_type</span> <a name="idm45543037285600-bb"></a><span class="identifier">current_time</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns the current time of the solution. <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term">Returns:</span></p></td> <td><p>The current time of the solution t. </p></td> </tr></tbody> </table></div> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">const</span> <span class="identifier">state_type</span> <span class="special">&amp;</span> <a name="idm45543037282464-bb"></a><span class="identifier">previous_state</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns the last state of the solution. <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term">Returns:</span></p></td> <td><p>The last state of the solution x(t-dt). </p></td> </tr></tbody> </table></div> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">time_type</span> <a name="idm45543037279312-bb"></a><span class="identifier">previous_time</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns the last time of the solution. <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term">Returns:</span></p></td> <td><p>The last time of the solution t-dt. </p></td> </tr></tbody> </table></div> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">time_type</span> <a name="idm45543037276192-bb"></a><span class="identifier">current_time_step</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns the current step size. <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term">Returns:</span></p></td> <td><p>The current step size. </p></td> </tr></tbody> </table></div> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">void</span> <a name="idm45543037273088-bb"></a><span class="identifier">reset</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Resets the internal state of the stepper. </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateIn<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45543037271920-bb"></a><span class="identifier">adjust_size</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span> x<span class="special">)</span><span class="special">;</span></pre>Adjust the size of all temporaries in the stepper manually. <p> </p> <div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term">Parameters:</span></p></td> <td><div class="variablelist"><table border="0" class="variablelist compact"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term"><code class="computeroutput">x</code></span></p></td> <td><p>A state from which the size of the temporaries to be resized is deduced. </p></td> </tr></tbody> </table></div></td> </tr></tbody> </table></div> </li> </ol></div> </div> <div class="refsect2"> <a name="idm45603640304656"></a><h3> <a name="idm45543037258304-bb"></a><code class="computeroutput">bulirsch_stoer_dense_out</code> private member functions</h3> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> StateVector<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45543037257728-bb"></a><span class="identifier">extrapolate</span><span class="special">(</span><span class="identifier">size_t</span> k<span class="special">,</span> <span class="identifier">StateVector</span> <span class="special">&amp;</span> table<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">value_matrix</span> <span class="special">&amp;</span> coeff<span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&amp;</span> xest<span class="special">,</span> <span class="identifier">size_t</span> order_start_index <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateVector<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45543037251744-bb"></a><span class="identifier">extrapolate_dense_out</span><span class="special">(</span><span class="identifier">size_t</span> k<span class="special">,</span> <span class="identifier">StateVector</span> <span class="special">&amp;</span> table<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">value_matrix</span> <span class="special">&amp;</span> coeff<span class="special">,</span> <span class="identifier">size_t</span> order_start_index <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="identifier">time_type</span> <a name="idm45543037247008-bb"></a><span class="identifier">calc_h_opt</span><span class="special">(</span><span class="identifier">time_type</span> h<span class="special">,</span> <span class="identifier">value_type</span> error<span class="special">,</span> <span class="identifier">size_t</span> k<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">bool</span> <a name="idm45543037243824-bb"></a><span class="identifier">in_convergence_window</span><span class="special">(</span><span class="identifier">size_t</span> k<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">bool</span> <a name="idm45543037242016-bb"></a><span class="identifier">should_reject</span><span class="special">(</span><span class="identifier">value_type</span> error<span class="special">,</span> <span class="identifier">size_t</span> k<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateIn1<span class="special">,</span> <span class="keyword">typename</span> DerivIn1<span class="special">,</span> <span class="keyword">typename</span> StateIn2<span class="special">,</span> <span class="keyword">typename</span> DerivIn2<span class="special">&gt;</span> <span class="identifier">value_type</span> <a name="idm45543037239520-bb"></a><span class="identifier">prepare_dense_output</span><span class="special">(</span><span class="keyword">int</span> k<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn1</span> <span class="special">&amp;</span> x_start<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn1</span> <span class="special">&amp;</span> dxdt_start<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn2</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn2</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">)</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> DerivIn<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45543037232016-bb"></a><span class="identifier">calculate_finite_difference</span><span class="special">(</span><span class="identifier">size_t</span> j<span class="special">,</span> <span class="identifier">size_t</span> kappa<span class="special">,</span> <span class="identifier">value_type</span> fac<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&amp;</span> dxdt<span class="special">)</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateOut<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45543037227552-bb"></a><span class="identifier">do_interpolation</span><span class="special">(</span><span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&amp;</span> out<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> StateIn<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="idm45543037224208-bb"></a><span class="identifier">resize_impl</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&amp;</span> x<span class="special">)</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="identifier">state_type</span> <span class="special">&amp;</span> <a name="idm45543037221824-bb"></a><span class="identifier">get_current_state</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">const</span> <span class="identifier">state_type</span> <span class="special">&amp;</span> <a name="idm45543037220288-bb"></a><span class="identifier">get_current_state</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="identifier">state_type</span> <span class="special">&amp;</span> <a name="idm45543037218480-bb"></a><span class="identifier">get_old_state</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">const</span> <span class="identifier">state_type</span> <span class="special">&amp;</span> <a name="idm45543037216944-bb"></a><span class="identifier">get_old_state</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="identifier">deriv_type</span> <span class="special">&amp;</span> <a name="idm45543037215136-bb"></a><span class="identifier">get_current_deriv</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">const</span> <span class="identifier">deriv_type</span> <span class="special">&amp;</span> <a name="idm45543037213600-bb"></a><span class="identifier">get_current_deriv</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="identifier">deriv_type</span> <span class="special">&amp;</span> <a name="idm45543037211792-bb"></a><span class="identifier">get_old_deriv</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">const</span> <span class="identifier">deriv_type</span> <span class="special">&amp;</span> <a name="idm45543037210256-bb"></a><span class="identifier">get_old_deriv</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li> <li class="listitem"><pre class="literallayout"><span class="keyword">void</span> <a name="idm45543037208448-bb"></a><span class="identifier">toggle_current_state</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span></pre></li> </ol></div> </div> </div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright © 2009-2015 Karsten Ahnert and Mario Mulansky<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="../../../header/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out_hpp.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../header/boost/numeric/odeint/stepper/bulirsch_stoer_dense_out_hpp.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../../header/boost/numeric/odeint/stepper/controlled_adams_bashforth_moulton_hpp.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
stan-dev/math
lib/boost_1.75.0/libs/numeric/odeint/doc/html/boost/numeric/odeint/bulirsch_stoer_dense_out.html
HTML
bsd-3-clause
56,058
Whitehole Commons ================= Whitehole Commons consist in a set of descriptions of binary format, expressed in a neutral way. They are typically meant to be used as input of generators, for decoding or encoding corresponding binary streams. The following binary formats are described: - x86/64 assembly - Portable Executable
BenoitPerrot/whitehole-commons
README.md
Markdown
bsd-3-clause
346
<?php namespace backend\models\search; use Yii; use yii\base\Model; use yii\data\ActiveDataProvider; use common\models\TipoInmueble; /** * TipoInmuebleSearch represents the model behind the search form about `common\models\TipoInmueble`. */ class TipoInmuebleSearch extends TipoInmueble { /** * @inheritdoc */ public function rules() { return [ [['id'], 'integer'], [['nombre'], 'safe'], ]; } /** * @inheritdoc */ public function scenarios() { // bypass scenarios() implementation in the parent class return Model::scenarios(); } /** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = TipoInmueble::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere([ 'id' => $this->id, ]); $query->andFilterWhere(['like', 'nombre', $this->nombre]); return $dataProvider; } }
plemosb7/tallerphp2016
backend/models/search/TipoInmuebleSearch.php
PHP
bsd-3-clause
1,507
<?php defined('SYSPATH') OR die('No direct access allowed.'); /** * Codebench — Squeeze every millisecond out of those regexes! * * @author Geert De Deckere <geert@idoe.be> * @license BSD License */ abstract class Codebench_Core { /** * Some optional explanatory comments about the benchmark file. * HTML allowed. URLs will be converted to links automatically. */ public $description = ''; /** * How many times to execute each method per subject. */ public $loops = 1000; /** * The subjects to supply iteratively to your benchmark methods. */ public $subjects = array(); /** * Grade letters with their maximum scores. Used to color the graphs. */ public $grades = array ( 125 => 'A', 150 => 'B', 200 => 'C', 300 => 'D', 500 => 'E', 'default' => 'F', ); /** * Constructor. * * @return void */ public function __construct() { // Set the maximum execution time set_time_limit(Kohana::config('codebench.max_execution_time')); } /** * Runs Codebench on the extending class. * * @return array benchmark output */ public function run() { // Array of all methods to loop over $methods = array_filter(get_class_methods($this), array($this, 'method_filter')); // Make sure the benchmark runs at least once, // also if no subject data has been provided. if (empty($this->subjects)) { $this->subjects = array('NULL' => NULL); } // Initialize benchmark output $codebench = array ( 'class' => get_class($this), 'description' => $this->description, 'loops' => array ( 'base' => (int) $this->loops, 'total' => (int) $this->loops * count($this->subjects) * count($methods), ), 'subjects' => $this->subjects, 'benchmarks' => array(), ); // Benchmark each method foreach ($methods as $method) { // Initialize benchmark output for this method $codebench['benchmarks'][$method] = array('time' => 0, 'memory' => 0); // Using Reflection because simply calling $this->$method($subject) in the loop below // results in buggy benchmark times correlating to the length of the method name. $reflection = new ReflectionMethod(get_class($this), $method); // Benchmark each subject on each method foreach ($this->subjects as $subject_key => $subject) { // Prerun each method/subject combo before the actual benchmark loop. // This way relatively expensive initial processes won't be benchmarked, e.g. autoloading. // At the same time we capture the return here so we don't have to do that in the loop anymore. $return = $reflection->invoke($this, $subject); // Start the timer for one subject Benchmark::start($method.$subject_key); // The heavy work for ($i = 0; $i < $this->loops; ++$i) { $reflection->invoke($this, $subject); } // Stop and read the timer $benchmark = Benchmark::get($method.$subject_key, 20); // Benchmark output specific to the current method and subject $codebench['benchmarks'][$method]['subjects'][$subject_key] = array ( 'return' => $return, 'time' => $benchmark['time'], 'memory' => $benchmark['memory'], ); // Update method totals $codebench['benchmarks'][$method]['time'] += $benchmark['time']; $codebench['benchmarks'][$method]['memory'] += $benchmark['memory']; } } // Initialize the fastest and slowest benchmarks for both methods and subjects, time and memory, // these values will be overwritten using min() and max() later on. // The 999999999 values look like a hack, I know, but they work, // unless your method runs for more than 31 years or consumes over 1GB of memory. $fastest_method = $fastest_subject = array('time' => 999999999, 'memory' => 999999999); $slowest_method = $slowest_subject = array('time' => 0, 'memory' => 0); // Find the fastest and slowest benchmarks, needed for the percentage calculations foreach ($methods as $method) { // Update the fastest and slowest method benchmarks $fastest_method['time'] = min($fastest_method['time'], $codebench['benchmarks'][$method]['time']); $fastest_method['memory'] = min($fastest_method['memory'], $codebench['benchmarks'][$method]['memory']); $slowest_method['time'] = max($slowest_method['time'], $codebench['benchmarks'][$method]['time']); $slowest_method['memory'] = max($slowest_method['memory'], $codebench['benchmarks'][$method]['memory']); foreach ($this->subjects as $subject_key => $subject) { // Update the fastest and slowest subject benchmarks $fastest_subject['time'] = min($fastest_subject['time'], $codebench['benchmarks'][$method]['subjects'][$subject_key]['time']); $fastest_subject['memory'] = min($fastest_subject['memory'], $codebench['benchmarks'][$method]['subjects'][$subject_key]['memory']); $slowest_subject['time'] = max($slowest_subject['time'], $codebench['benchmarks'][$method]['subjects'][$subject_key]['time']); $slowest_subject['memory'] = max($slowest_subject['memory'], $codebench['benchmarks'][$method]['subjects'][$subject_key]['memory']); } } // Percentage calculations for methods foreach ($codebench['benchmarks'] as & $method) { // Calculate percentage difference relative to fastest and slowest methods $method['percent']['fastest']['time'] = $method['time'] / $fastest_method['time'] * 100; $method['percent']['fastest']['memory'] = $method['memory'] / $fastest_method['memory'] * 100; $method['percent']['slowest']['time'] = $method['time'] / $slowest_method['time'] * 100; $method['percent']['slowest']['memory'] = $method['memory'] / $slowest_method['memory'] * 100; // Assign a grade for time and memory to each method $method['grade']['time'] = $this->grade($method['percent']['fastest']['time']); $method['grade']['memory'] = $this->grade($method['percent']['fastest']['memory']); // Percentage calculations for subjects foreach ($method['subjects'] as & $subject) { // Calculate percentage difference relative to fastest and slowest subjects for this method $subject['percent']['fastest']['time'] = $subject['time'] / $fastest_subject['time'] * 100; $subject['percent']['fastest']['memory'] = $subject['memory'] / $fastest_subject['memory'] * 100; $subject['percent']['slowest']['time'] = $subject['time'] / $slowest_subject['time'] * 100; $subject['percent']['slowest']['memory'] = $subject['memory'] / $slowest_subject['memory'] * 100; // Assign a grade letter for time and memory to each subject $subject['grade']['time'] = $this->grade($subject['percent']['fastest']['time']); $subject['grade']['memory'] = $this->grade($subject['percent']['fastest']['memory']); } } return $codebench; } /** * Callback for array_filter(). * Filters out all methods not to benchmark. * * @param string method name * @return boolean */ protected function method_filter($method) { return (substr($method, 0, 5) === 'bench'); } /** * Returns the applicable grade letter for a score. * * @param integer|double score * @return string grade letter */ protected function grade($score) { foreach ($this->grades as $max => $grade) { if ($max === 'default') continue; if ($score <= $max) return $grade; } return $this->grades['default']; } }
isaiahdw/codebench
libraries/Codebench.php
PHP
bsd-3-clause
7,406
import math import random import onmt from torch.autograd import Variable class Dataset(object): def __init__(self, srcData, tgtData, batchSize, cuda, volatile=False): self.src = srcData if tgtData: self.tgt = tgtData assert(len(self.src) == len(self.tgt)) else: self.tgt = None self.cuda = cuda self.batchSize = batchSize self.numBatches = math.ceil(len(self.src)/batchSize) self.volatile = volatile def _batchify(self, data, align_right=False): max_length = max(x.size(0) for x in data) out = data[0].new(len(data), max_length).fill_(onmt.Constants.PAD) for i in range(len(data)): data_length = data[i].size(0) offset = max_length - data_length if align_right else 0 out[i].narrow(0, offset, data_length).copy_(data[i]) out = out.t().contiguous() if self.cuda: out = out.cuda() v = Variable(out, volatile=self.volatile) return v def __getitem__(self, index): assert index < self.numBatches, "%d > %d" % (index, self.numBatches) srcBatch = self._batchify( self.src[index*self.batchSize:(index+1)*self.batchSize], align_right=True) if self.tgt: tgtBatch = self._batchify( self.tgt[index*self.batchSize:(index+1)*self.batchSize]) else: tgtBatch = None return srcBatch, tgtBatch def __len__(self): return self.numBatches def shuffle(self): zipped = list(zip(self.src, self.tgt)) random.shuffle(zipped) self.src, self.tgt = [x[0] for x in zipped], [x[1] for x in zipped]
bmccann/examples
OpenNMT/onmt/Dataset.py
Python
bsd-3-clause
1,722
Engine.Route = { to: function(path){ return Engine.Config.url + path; } };
AppSharing/casa-outlet
src/engine/route.js
JavaScript
bsd-3-clause
82
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_QUERY_H_ #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_QUERY_H_ #include <map> #include <string> #include <vector> #include "base/callback_forward.h" #include "content/public/browser/download_item.h" namespace base { class Value; } // Filter and sort a vector of DownloadItem*s. // // The following example copies from |all_items| to |results| those // DownloadItem*s whose start time is 0 and whose id is odd, sorts primarily by // bytes received ascending and secondarily by url descending, and limits the // results to 20 items. Any number of filters or sorters is allowed. If all // sorters compare two DownloadItems equivalently, then they are sorted by their // id ascending. // // DownloadQuery query; // base::FundamentalValue start_time(0); // CHECK(query.AddFilter(FILTER_START_TIME, start_time)); // bool FilterOutOddDownloads(const DownloadItem& item) { // return 0 == (item.GetId() % 2); // } // CHECK(query.AddFilter(base::Bind(&FilterOutOddDownloads))); // query.AddSorter(SORT_BYTES_RECEIVED, ASCENDING); // query.AddSorter(SORT_URL, DESCENDING); // query.Limit(20); // query.Skip(5); // DownloadVector all_items, results; // query.Search(all_items.begin(), all_items.end(), &results); class DownloadQuery { public: typedef std::vector<content::DownloadItem*> DownloadVector; // FilterCallback is a Callback that takes a DownloadItem and returns true if // the item matches the filter and false otherwise. // query.AddFilter(base::Bind(&YourFilterFunction)); typedef base::Callback<bool(const content::DownloadItem&)> FilterCallback; // All times are ISO 8601 strings. enum FilterType { FILTER_BYTES_RECEIVED, // int FILTER_DANGER_ACCEPTED, // bool FILTER_ENDED_AFTER, // string FILTER_ENDED_BEFORE, // string FILTER_END_TIME, // string FILTER_EXISTS, // bool FILTER_FILENAME, // string FILTER_FILENAME_REGEX, // string FILTER_MIME, // string FILTER_PAUSED, // bool FILTER_QUERY, // vector<base::string16> FILTER_STARTED_AFTER, // string FILTER_STARTED_BEFORE, // string FILTER_START_TIME, // string FILTER_TOTAL_BYTES, // int FILTER_TOTAL_BYTES_GREATER, // int FILTER_TOTAL_BYTES_LESS, // int FILTER_URL, // string FILTER_URL_REGEX, // string }; enum SortType { SORT_BYTES_RECEIVED, SORT_DANGER, SORT_DANGER_ACCEPTED, SORT_END_TIME, SORT_EXISTS, SORT_FILENAME, SORT_MIME, SORT_PAUSED, SORT_START_TIME, SORT_STATE, SORT_TOTAL_BYTES, SORT_URL, }; enum SortDirection { ASCENDING, DESCENDING, }; DownloadQuery(); ~DownloadQuery(); // Adds a new filter of type |type| with value |value| and returns true if // |type| is valid and |value| is the correct Value-type and well-formed. // Returns false if |type| is invalid or |value| is the incorrect Value-type // or malformed. Search() will filter out all DownloadItem*s that do not // match all filters. Multiple instances of the same FilterType are allowed, // so you can pass two regexes to AddFilter(URL_REGEX,...) in order to // Search() for items whose url matches both regexes. You can also pass two // different DownloadStates to AddFilter(), which will cause Search() to // filter out all items. bool AddFilter(const FilterCallback& filter); bool AddFilter(FilterType type, const base::Value& value); void AddFilter(content::DownloadDangerType danger); void AddFilter(content::DownloadItem::DownloadState state); // Adds a new sorter of type |type| with direction |direction|. After // filtering DownloadItem*s, Search() will sort the results primarily by the // sorter from the first call to Sort(), secondarily by the sorter from the // second call to Sort(), and so on. For example, if the InputIterator passed // to Search() yields four DownloadItems {id:0, error:0, start_time:0}, {id:1, // error:0, start_time:1}, {id:2, error:1, start_time:0}, {id:3, error:1, // start_time:1}, and Sort is called twice, once with (SORT_ERROR, ASCENDING) // then with (SORT_START_TIME, DESCENDING), then Search() will return items // ordered 1,0,3,2. void AddSorter(SortType type, SortDirection direction); // Limit the size of search results to |limit|. void Limit(size_t limit) { limit_ = limit; } // Ignore |skip| items. Note: which items are skipped are not guaranteed to // always be the same. If you rely on this, you should probably be using // AddSorter() in conjunction with this method. void Skip(size_t skip) { skip_ = skip; } // Filters DownloadItem*s from |iter| to |last| into |results|, sorts // |results|, and limits the size of |results|. |results| must be non-NULL. template <typename InputIterator> void Search(InputIterator iter, const InputIterator last, DownloadVector* results) const { results->clear(); for (; iter != last; ++iter) { if (Matches(**iter)) results->push_back(*iter); } FinishSearch(results); } private: struct Sorter; class DownloadComparator; typedef std::vector<FilterCallback> FilterCallbackVector; typedef std::vector<Sorter> SorterVector; bool FilterRegex(const std::string& regex_str, const base::Callback<std::string( const content::DownloadItem&)>& accessor); bool Matches(const content::DownloadItem& item) const; void FinishSearch(DownloadVector* results) const; FilterCallbackVector filters_; SorterVector sorters_; size_t limit_; size_t skip_; DISALLOW_COPY_AND_ASSIGN(DownloadQuery); }; #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_QUERY_H_
Bysmyyr/chromium-crosswalk
chrome/browser/download/download_query.h
C
bsd-3-clause
5,995
#import <UIKit/UIKit.h> @interface ViewController : UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate> @end
Ushio/MetalFluidDemo
FluidDemo/FluidDemo/ViewController.h
C
bsd-3-clause
142
package main import ( "crypto/md5" "flag" "fmt" "log" "os" "runtime/pprof" "strconv" "sync" ) var prefix = []byte{0x6f, 0x6a, 0x76, 0x74, 0x70, 0x75, 0x76, 0x67} var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") func find(l int) { cg := gen(1000000000) c1 := hash(cg) c2 := hash(cg) c3 := hash(cg) c4 := hash(cg) c5 := hash(cg) c6 := hash(cg) c7 := hash(cg) c8 := hash(cg) c := merge(c1, c2, c3, c4, c5, c6, c7, c8) var p1 uint32 var p2 uint32 var p1s uint32 var p2m uint32 p1s = 32 p2m = 0xff for hash := range c { six := uint32(hash[2] & 0xf) seven := uint32(hash[3] >> 4) if p1s != 0 { p1s -= 4 p1 |= six << p1s } if p2m&(1<<six) != 0x00 { p2m ^= 1 << six p2 |= seven << ((7 - six) << 2) } fmt.Printf("part one: %08x part two: %08x\r", p1, p2) if p1s == 0 && p2m == 0 { break } } fmt.Printf("part one: %08x part two: %08x\n", p1, p2) } func gen(max int64) <-chan int64 { out := make(chan int64) go func() { var i int64 for i = 0; i < max; i++ { out <- i } close(out) }() return out } func hash(in <-chan int64) <-chan []byte { out := make(chan []byte) go func() { for i := range in { m := md5.Sum(strconv.AppendInt(prefix, i, 10)) if m[0] == 0x00 && m[1] == 0x00 && (m[2]&0xf0 == 0x00) { out <- m[:] } } close(out) }() return out } func main() { flag.Parse() if *cpuprofile != "" { f, err := os.Create(*cpuprofile) if err != nil { log.Fatal(err) } pprof.StartCPUProfile(f) defer pprof.StopCPUProfile() } find(5) } func merge(cs ...<-chan []byte) <-chan []byte { var wg sync.WaitGroup out := make(chan []byte, 2) // Start an output goroutine for each input channel in cs. output // copies values from c to out until c is closed, then calls wg.Done. output := func(c <-chan []byte) { for n := range c { out <- n } wg.Done() } wg.Add(len(cs)) for _, c := range cs { go output(c) } // Start a goroutine to close out once all the output goroutines are // done. This must start after the wg.Add call. go func() { wg.Wait() close(out) }() return out }
Aneurysm9/advent
2016/day5/day5.go
GO
bsd-3-clause
2,151
<?php /** * Copyright (c) 2011, Jeremy Brown * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * - Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @category App * @package Engine * @subpackage Helper * @copyright Copyright (c) 2011 Jeremy Brown (http://www.notmessenger.com/) */ /** * Return of JSONP PUT request * * @since 1.0 * @category App * @package Api * @subpackage Helper * @author Jeremy Brown <jeremy@notmessenger.com> * @copyright Copyright (c) 2011 Jeremy Brown (http://www.notmessenger.com/) */ class App_Engine_View_Helper_PutJs extends Zend_View_Helper_Abstract { /** * Builds response to JSONP PUT request * * $data is the data that should be represented in the response. In this case, it is the primary key * of the updated entity. * * @param object $data * @param string $node * @param object App\System\Service\* $service * @param string $uri */ public function putJs($callback, $data = null, $node, $service = null, $uri = null) { // Error checking $exception = null; if ( empty( $node ) ) { $exception = "Was expecting node - none provided."; } if ( null != $exception ) { throw new \App\Engine\Exception($exception, 500); } // Header response container $headers = new stdClass(); /** @var Zend_Controller_Front */ $fc = Zend_Controller_Front::getInstance(); // 204 No Content if ( null == $data && null == $service && null == $uri ) { $headers->ResponseCode = 204; } // 303 See Other else { // Error checking $exception = null; if ( empty( $data ) ) { $exception = "Was expecting data - none provided."; } elseif ( empty( $service ) ) { $exception = "Was expecting node - none provided."; } elseif ( empty( $uri ) ) { $exception = "Was expecting uri - none provided."; } if ( null != $exception ) { throw new \App\Engine\Exception($exception, 500); } // Construct API url $protocol = 'http'; if ( ! empty($_SERVER['HTTPS']) ) { $protocol .= 's'; } $_303url = $protocol . '://' . rtrim( $fc->getBaseUrl(), '/' ) . '/' . $uri . '/' . $data; $headers->ResponseCode = 303; $headers->{'Content-Location'} = $_303url; $headers->Location = $_303url; } // BEGIN: Set response headers $fc->getResponse()->setHttpResponseCode($headers->ResponseCode); // 303 See Other if ( 303 == $headers->ResponseCode ) { $fc->getResponse()->setHeader('Content-Location', $_303url); $fc->getResponse()->setHeader('Location', $_303url); } // END: Set response headers if ( 204 != $headers->ResponseCode ) { // BEGIN: Build JSON payload // Get representation of newly created resource $createdResource = $service->distillAsObject( $service->getById($data) ); // Construct 'self' uri $link_self = new stdClass(); $link_self->href = $_303url; $link_self->rel = 'self'; $createdResource->{'resource_link'} = $link_self; $response = new stdClass(); $response->headers = $headers; $response->$node = $createdResource; $payload = new stdClass(); $payload->response = $response; // END: Build JSON payload return $callback . '(' . Zend_Json::encode($payload) . ')'; } } }
notmessenger/ZF-REST-API
library/App/Engine/View/Helper/PutJs.php
PHP
bsd-3-clause
4,667
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from __future__ import unicode_literals from ..utils import AffineInitializer def test_AffineInitializer_inputs(): input_map = dict(args=dict(argstr='%s', ), dimension=dict(argstr='%s', position=0, usedefault=True, ), environ=dict(nohash=True, usedefault=True, ), fixed_image=dict(argstr='%s', mandatory=True, position=1, ), ignore_exception=dict(nohash=True, usedefault=True, ), local_search=dict(argstr='%d', position=7, usedefault=True, ), moving_image=dict(argstr='%s', mandatory=True, position=2, ), num_threads=dict(nohash=True, usedefault=True, ), out_file=dict(argstr='%s', position=3, usedefault=True, ), principal_axes=dict(argstr='%d', position=6, usedefault=True, ), radian_fraction=dict(argstr='%f', position=5, usedefault=True, ), search_factor=dict(argstr='%f', position=4, usedefault=True, ), terminal_output=dict(deprecated='1.0.0', nohash=True, ), ) inputs = AffineInitializer.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value def test_AffineInitializer_outputs(): output_map = dict(out_file=dict(), ) outputs = AffineInitializer.output_spec() for key, metadata in list(output_map.items()): for metakey, value in list(metadata.items()): assert getattr(outputs.traits()[key], metakey) == value
mick-d/nipype
nipype/interfaces/ants/tests/test_auto_AffineInitializer.py
Python
bsd-3-clause
1,633
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>ESAPI for PHP Core: Data Fields</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.html"><span>Main&nbsp;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li> <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li> <li class="current"><a href="functions.html"><span>Data&nbsp;Fields</span></a></li> </ul> </div> <div class="tabs"> <ul> <li class="current"><a href="functions.html"><span>All</span></a></li> <li><a href="functions_func.html"><span>Functions</span></a></li> <li><a href="functions_vars.html"><span>Variables</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="functions.html#index_$"><span>$</span></a></li> <li><a href="functions_0x5f.html#index__"><span>_</span></a></li> <li><a href="functions_0x61.html#index_a"><span>a</span></a></li> <li><a href="functions_0x63.html#index_c"><span>c</span></a></li> <li><a href="functions_0x64.html#index_d"><span>d</span></a></li> <li><a href="functions_0x65.html#index_e"><span>e</span></a></li> <li><a href="functions_0x66.html#index_f"><span>f</span></a></li> <li><a href="functions_0x67.html#index_g"><span>g</span></a></li> <li><a href="functions_0x68.html#index_h"><span>h</span></a></li> <li><a href="functions_0x69.html#index_i"><span>i</span></a></li> <li><a href="functions_0x6b.html#index_k"><span>k</span></a></li> <li class="current"><a href="functions_0x6c.html#index_l"><span>l</span></a></li> <li><a href="functions_0x6e.html#index_n"><span>n</span></a></li> <li><a href="functions_0x72.html#index_r"><span>r</span></a></li> <li><a href="functions_0x73.html#index_s"><span>s</span></a></li> <li><a href="functions_0x74.html#index_t"><span>t</span></a></li> <li><a href="functions_0x75.html#index_u"><span>u</span></a></li> <li><a href="functions_0x76.html#index_v"><span>v</span></a></li> <li><a href="functions_0x77.html#index_w"><span>w</span></a></li> </ul> </div> </div> <div class="contents"> Here is a list of all documented struct and union fields with links to the struct/union documentation for each field: <h3><a class="anchor" id="index_l">- l -</a></h3><ul> <li>load() : <a class="el" href="interface_encrypted_properties.html#a73c9870b1d7d0f8e4355710fea26b72a">EncryptedProperties</a> , <a class="el" href="class_default_encrypted_properties.html#a73c9870b1d7d0f8e4355710fea26b72a">DefaultEncryptedProperties</a> </li> <li>lock() : <a class="el" href="class_default_user.html#a0bdd8976d36e7d04dc19d04ec064c8c0">DefaultUser</a> </li> <li>log() : <a class="el" href="class_e_s_a_p_i.html#a70a626b5aaad52cef507d5624ffc22cb">ESAPI</a> </li> <li>logHTTPRequest() : <a class="el" href="interface_h_t_t_p_utilities.html#ae3c1b71f4e6a6e9f2edf15039f89b126">HTTPUtilities</a> , <a class="el" href="class_default_h_t_t_p_utilities.html#ae3c1b71f4e6a6e9f2edf15039f89b126">DefaultHTTPUtilities</a> </li> <li>login() : <a class="el" href="class_file_based_authenticator.html#a726f8f7dc66f0d6bc60b97e92322d799">FileBasedAuthenticator</a> , <a class="el" href="interface_authenticator.html#a726f8f7dc66f0d6bc60b97e92322d799">Authenticator</a> </li> <li>loginWithPassword() : <a class="el" href="class_default_user.html#a03470476469e8153ff14b8eba51724fc">DefaultUser</a> </li> <li>logout() : <a class="el" href="class_file_based_authenticator.html#a082405d89acd6835c3a7c7a08a7adbab">FileBasedAuthenticator</a> , <a class="el" href="class_default_user.html#a082405d89acd6835c3a7c7a08a7adbab">DefaultUser</a> , <a class="el" href="interface_authenticator.html#a082405d89acd6835c3a7c7a08a7adbab">Authenticator</a> </li> </ul> </div> <hr size="1"/><address style="text-align: right;"><small>Generated on Wed Nov 18 15:13:37 2009 for ESAPI for PHP Core by&nbsp; <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> </body> </html>
convisoappsec/swingset-php
documentation/esapi4php-core-1.0a-html/functions_0x6c.html
HTML
bsd-3-clause
4,693
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.11"/> <title>CUTLASS: 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="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"], }); </script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.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 id="projectlogo"><img alt="Logo" src="cutlass-logo-small.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">CUTLASS </div> <div id="projectbrief">CUDA Templates for Linear Algebra Subroutines and Solvers</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</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> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacecutlass.html">cutlass</a></li><li class="navelem"><a class="el" href="namespacecutlass_1_1gemm.html">gemm</a></li><li class="navelem"><a class="el" href="namespacecutlass_1_1gemm_1_1device.html">device</a></li><li class="navelem"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html">DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt;</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">cutlass::gemm::device::DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt; Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html">cutlass::gemm::device::DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt;</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html#a2bdcad5fb78d4920309f2eb0acf8cda4">EpilogueOutputOp</a> typedef</td><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html">cutlass::gemm::device::DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html#a656bedbde76370f3ccead9eb39899373">InstructionShape</a> typedef</td><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html">cutlass::gemm::device::DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html#ad3c7885d5d5d68f86791ae020c2eeb34">kAlignmentA</a></td><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html">cutlass::gemm::device::DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt;</a></td><td class="entry"><span class="mlabel">static</span></td></tr> <tr><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html#a0142242cdec713b072b43a5b0e20a033">kAlignmentB</a></td><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html">cutlass::gemm::device::DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt;</a></td><td class="entry"><span class="mlabel">static</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html#a0792c0d1d0c2b68348cb1a5c6f8c2ff5">kStages</a></td><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html">cutlass::gemm::device::DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt;</a></td><td class="entry"><span class="mlabel">static</span></td></tr> <tr><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html#a2484d95e3ce36c73af17038a0933c6c5">Operator</a> typedef</td><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html">cutlass::gemm::device::DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt;</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html#af11e9c28425c136d2809af1e8b638e47">ThreadblockShape</a> typedef</td><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html">cutlass::gemm::device::DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt;</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html#a6b9f61d5e2260e8664d5ad239a68b0fc">WarpShape</a> typedef</td><td class="entry"><a class="el" href="structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc8e2604a56dff3a7595da9ee0604ae55e.html">cutlass::gemm::device::DefaultGemmConfiguration&lt; arch::OpClassTensorOp, arch::Sm75, int4b_t, uint4b_t, ElementC, int32_t &gt;</a></td><td class="entry"></td></tr> </table></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>
NVIDIA/cutlass
docs/structcutlass_1_1gemm_1_1device_1_1DefaultGemmConfiguration_3_01arch_1_1OpClassTensorOp_00_01arc7291f9c01fb5d713dd4b081092756e21.html
HTML
bsd-3-clause
10,229
#include <stdbool.h> #include <stdio.h> #include <letmecreate/click/fan.h> #include <letmecreate/core/i2c.h> /* I2C address of EMC2301 */ #define EMC2301_ADDRESS (0x2F) /* Register addresses */ #define EMC2301_PRODUCT_ID_REG (0xFD) #define EMC2301_MANUFACTURER_ID_REG (0xFE) #define EMC2301_FAN_CONFIG_1_REG (0x32) #define EMC2301_TACH_TARGET_LOW (0x3C) #define EMC2301_TACH_TARGET_HIGH (0x3D) #define EMC2301_INT_REG (0x29) #define EMC2301_FAN_STATUS_REG (0x24) /* Register values */ #define EMC2301_PRODUCT_ID (0x37) #define EMC2301_MANUFACTURER_ID (0x5D) #define EMC2301_ENABLE_FSC_ALGO (0x80) #define EMC2301_MIN_RPM (0) /* min 500 rpm */ #define EMC2301_MIN_EDGE (0x08) /* min 5 edges */ #define EMC2301_UPDATE (0) /* 400ms */ #define FAN_CLICK_MIN_RPM (600) #define FAN_CLICK_MAX_RPM (2500) static bool check_device(void) { uint8_t product_id = 0, manufacturer_id = 0; if (i2c_read_register(EMC2301_ADDRESS, EMC2301_PRODUCT_ID_REG, &product_id) < 0) return false; if (product_id != EMC2301_PRODUCT_ID) return false; if (i2c_read_register(EMC2301_ADDRESS, EMC2301_MANUFACTURER_ID_REG, &manufacturer_id) < 0) return false; return manufacturer_id == EMC2301_MANUFACTURER_ID; } int fan_click_init(void) { if (check_device() == false) { fprintf(stderr, "fan: Failed to find device emc2301.\n"); return -1; } if (i2c_write_register(EMC2301_ADDRESS, EMC2301_FAN_CONFIG_1_REG, EMC2301_ENABLE_FSC_ALGO | EMC2301_MIN_RPM | EMC2301_MIN_EDGE | EMC2301_UPDATE) < 0) { fprintf(stderr, "fan: Failed to configure device.\n"); return -1; } return 0; } int fan_click_set_speed(uint16_t rpm) { uint16_t tach = 0; if (rpm < FAN_CLICK_MIN_RPM || rpm > FAN_CLICK_MAX_RPM) { fprintf(stderr, "fan: rpm out of range 600-2500.\n"); return -1; } /* Using equation 3 from emc2301 5.18 section of the datasheet. * Datasheet available at http://ww1.microchip.com/downloads/en/DeviceDoc/2301.pdf */ tach = 3932160 / rpm; tach &= 0x1FFF; if (i2c_write_register(EMC2301_ADDRESS, EMC2301_TACH_TARGET_LOW, tach << 3) < 0 || i2c_write_register(EMC2301_ADDRESS, EMC2301_TACH_TARGET_HIGH, tach >> 5) < 0) { fprintf(stderr, "fan: Failed to update tach register.\n"); return -1; } return 0; }
francois-berder/LetMeCreate
src/click/fan.c
C
bsd-3-clause
2,622
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "sky/engine/config.h" #include "sky/engine/tonic/dart_gc_controller.h" #include "base/trace_event/trace_event.h" #include "dart/runtime/include/dart_api.h" #include "sky/engine/tonic/dart_gc_context.h" #include "sky/engine/tonic/dart_gc_visitor.h" #include "sky/engine/tonic/dart_wrappable.h" namespace blink { namespace { DartGCContext* g_gc_context = nullptr; DartWrappable* GetWrappable(intptr_t* fields) { return reinterpret_cast<DartWrappable*>(fields[DartWrappable::kPeerIndex]); } void Visit(void* isolate_callback_data, Dart_WeakPersistentHandle handle, intptr_t native_field_count, intptr_t* native_fields) { if (!native_field_count) return; DCHECK(native_field_count == DartWrappable::kNumberOfNativeFields); DartGCVisitor visitor(g_gc_context); GetWrappable(native_fields)->AcceptDartGCVisitor(visitor); } } // namespace void DartGCPrologue() { TRACE_EVENT_ASYNC_BEGIN0("sky", "DartGC", 0); Dart_EnterScope(); DCHECK(!g_gc_context); g_gc_context = new DartGCContext(); Dart_VisitPrologueWeakHandles(Visit); } void DartGCEpilogue() { delete g_gc_context; g_gc_context = nullptr; Dart_ExitScope(); TRACE_EVENT_ASYNC_END0("sky", "DartGC", 0); } } // namespace blink
collinjackson/mojo
sky/engine/tonic/dart_gc_controller.cc
C++
bsd-3-clause
1,427
name = "neurogenesis"
juliusf/Neurogenesis
neurogenesis/__init__.py
Python
bsd-3-clause
22
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.coderedrobotics.libs; /** * * @author laptop */ public class DerivativeCalculator { private double derivative; private double oldValue; private long oldTime; public double calculate(double val) { long time = System.currentTimeMillis(); if (time != oldTime) { derivative = (val - oldValue)/((double)(time - oldTime)); oldTime = time; oldValue = val; } return derivative; } }
CodeRed2771/Sally
src/com/coderedrobotics/libs/DerivativeCalculator.java
Java
bsd-3-clause
580
from binding import * from src.namespace import llvm from src.Value import MDNode from src.Instruction import Instruction, TerminatorInst llvm.includes.add('llvm/Transforms/Utils/BasicBlockUtils.h') SplitBlockAndInsertIfThen = llvm.Function('SplitBlockAndInsertIfThen', ptr(TerminatorInst), ptr(Instruction), # cmp cast(bool, Bool), # unreachable ptr(MDNode)) # branchweights ReplaceInstWithInst = llvm.Function('ReplaceInstWithInst', Void, ptr(Instruction), # from ptr(Instruction)) # to
llvmpy/llvmpy
llvmpy/src/Transforms/Utils/BasicBlockUtils.py
Python
bsd-3-clause
767
from __future__ import absolute_import import mock import os from django.conf import settings from sentry_sdk import Hub TEST_ROOT = os.path.normpath( os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir, "tests") ) def pytest_configure(config): # HACK: Only needed for testing! os.environ.setdefault("_SENTRY_SKIP_CONFIGURATION", "1") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sentry.conf.server") # override docs which are typically synchronized from an upstream server # to ensure tests are consistent os.environ.setdefault( "INTEGRATION_DOC_FOLDER", os.path.join(TEST_ROOT, "fixtures", "integration-docs") ) from sentry.utils import integrationdocs integrationdocs.DOC_FOLDER = os.environ["INTEGRATION_DOC_FOLDER"] if not settings.configured: # only configure the db if its not already done test_db = os.environ.get("DB", "postgres") if test_db == "postgres": settings.DATABASES["default"].update( { "ENGINE": "sentry.db.postgres", "USER": "postgres", "NAME": "sentry", "HOST": "127.0.0.1", } ) # postgres requires running full migration all the time # since it has to install stored functions which come from # an actual migration. else: raise RuntimeError("oops, wrong database: %r" % test_db) settings.TEMPLATE_DEBUG = True # Disable static compiling in tests settings.STATIC_BUNDLES = {} # override a few things with our test specifics settings.INSTALLED_APPS = tuple(settings.INSTALLED_APPS) + ("tests",) # Need a predictable key for tests that involve checking signatures settings.SENTRY_PUBLIC = False if not settings.SENTRY_CACHE: settings.SENTRY_CACHE = "sentry.cache.django.DjangoCache" settings.SENTRY_CACHE_OPTIONS = {} # This speeds up the tests considerably, pbkdf2 is by design, slow. settings.PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] settings.AUTH_PASSWORD_VALIDATORS = [] # Replace real sudo middleware with our mock sudo middleware # to assert that the user is always in sudo mode middleware = list(settings.MIDDLEWARE_CLASSES) sudo = middleware.index("sentry.middleware.sudo.SudoMiddleware") middleware[sudo] = "sentry.testutils.middleware.SudoMiddleware" settings.MIDDLEWARE_CLASSES = tuple(middleware) settings.SENTRY_OPTIONS["cloudflare.secret-key"] = "cloudflare-secret-key" # enable draft features settings.SENTRY_OPTIONS["mail.enable-replies"] = True settings.SENTRY_ALLOW_ORIGIN = "*" settings.SENTRY_TSDB = "sentry.tsdb.inmemory.InMemoryTSDB" settings.SENTRY_TSDB_OPTIONS = {} if settings.SENTRY_NEWSLETTER == "sentry.newsletter.base.Newsletter": settings.SENTRY_NEWSLETTER = "sentry.newsletter.dummy.DummyNewsletter" settings.SENTRY_NEWSLETTER_OPTIONS = {} settings.BROKER_BACKEND = "memory" settings.BROKER_URL = None settings.CELERY_ALWAYS_EAGER = False settings.CELERY_EAGER_PROPAGATES_EXCEPTIONS = True settings.DEBUG_VIEWS = True settings.SENTRY_ENCRYPTION_SCHEMES = () settings.DISABLE_RAVEN = True settings.CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}} if os.environ.get("USE_SNUBA", False): settings.SENTRY_SEARCH = "sentry.search.snuba.SnubaSearchBackend" settings.SENTRY_TAGSTORE = "sentry.tagstore.snuba.SnubaCompatibilityTagStorage" settings.SENTRY_TSDB = "sentry.tsdb.redissnuba.RedisSnubaTSDB" settings.SENTRY_EVENTSTREAM = "sentry.eventstream.snuba.SnubaEventStream" if not hasattr(settings, "SENTRY_OPTIONS"): settings.SENTRY_OPTIONS = {} settings.SENTRY_OPTIONS.update( { "redis.clusters": {"default": {"hosts": {0: {"db": 9}}}}, "mail.backend": "django.core.mail.backends.locmem.EmailBackend", "system.url-prefix": "http://testserver", "slack.client-id": "slack-client-id", "slack.client-secret": "slack-client-secret", "slack.verification-token": "slack-verification-token", "github-app.name": "sentry-test-app", "github-app.client-id": "github-client-id", "github-app.client-secret": "github-client-secret", "vsts.client-id": "vsts-client-id", "vsts.client-secret": "vsts-client-secret", } ) # django mail uses socket.getfqdn which doesn't play nice if our # networking isn't stable patcher = mock.patch("socket.getfqdn", return_value="localhost") patcher.start() if not settings.SOUTH_TESTS_MIGRATE: settings.INSTALLED_APPS = tuple(i for i in settings.INSTALLED_APPS if i != "south") from sentry.runner.initializer import ( bootstrap_options, configure_structlog, initialize_receivers, fix_south, bind_cache_to_option_store, setup_services, ) bootstrap_options(settings) configure_structlog() fix_south(settings) import django if hasattr(django, "setup"): django.setup() bind_cache_to_option_store() initialize_receivers() setup_services() register_extensions() from sentry.utils.redis import clusters with clusters.get("default").all() as client: client.flushdb() # force celery registration from sentry.celery import app # NOQA # disable DISALLOWED_IPS from sentry import http http.DISALLOWED_IPS = set() def register_extensions(): from sentry.plugins import plugins from sentry.plugins.utils import TestIssuePlugin2 plugins.register(TestIssuePlugin2) from sentry import integrations from sentry.integrations.bitbucket import BitbucketIntegrationProvider from sentry.integrations.example import ( ExampleIntegrationProvider, AliasedIntegrationProvider, ExampleRepositoryProvider, ) from sentry.integrations.github import GitHubIntegrationProvider from sentry.integrations.github_enterprise import GitHubEnterpriseIntegrationProvider from sentry.integrations.gitlab import GitlabIntegrationProvider from sentry.integrations.jira import JiraIntegrationProvider from sentry.integrations.jira_server import JiraServerIntegrationProvider from sentry.integrations.slack import SlackIntegrationProvider from sentry.integrations.vsts import VstsIntegrationProvider from sentry.integrations.vsts_extension import VstsExtensionIntegrationProvider integrations.register(BitbucketIntegrationProvider) integrations.register(ExampleIntegrationProvider) integrations.register(AliasedIntegrationProvider) integrations.register(GitHubIntegrationProvider) integrations.register(GitHubEnterpriseIntegrationProvider) integrations.register(GitlabIntegrationProvider) integrations.register(JiraIntegrationProvider) integrations.register(JiraServerIntegrationProvider) integrations.register(SlackIntegrationProvider) integrations.register(VstsIntegrationProvider) integrations.register(VstsExtensionIntegrationProvider) from sentry.plugins import bindings from sentry.plugins.providers.dummy import DummyRepositoryProvider bindings.add("repository.provider", DummyRepositoryProvider, id="dummy") bindings.add( "integration-repository.provider", ExampleRepositoryProvider, id="integrations:example" ) def pytest_runtest_teardown(item): if not os.environ.get("USE_SNUBA", False): from sentry import tsdb # TODO(dcramer): this only works if this is the correct tsdb backend tsdb.flush() # XXX(dcramer): only works with DummyNewsletter from sentry import newsletter if hasattr(newsletter.backend, "clear"): newsletter.backend.clear() from sentry.utils.redis import clusters with clusters.get("default").all() as client: client.flushdb() from celery.task.control import discard_all discard_all() from sentry.models import OrganizationOption, ProjectOption, UserOption for model in (OrganizationOption, ProjectOption, UserOption): model.objects.clear_local_cache() Hub.main.bind_client(None)
mvaled/sentry
src/sentry/utils/pytest/sentry.py
Python
bsd-3-clause
8,427
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_40) on Sun Mar 22 12:12:00 PDT 2015 --> <title>Qpstest.StreamingOutputCallRequest.Builder (grpc-benchmarks 0.1.0-SNAPSHOT API)</title> <meta name="date" content="2015-03-22"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Qpstest.StreamingOutputCallRequest.Builder (grpc-benchmarks 0.1.0-SNAPSHOT API)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":9,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":10,"i37":10,"i38":10,"i39":10,"i40":10}; var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-all.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../index.html?grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" target="_top">Frames</a></li> <li><a href="Qpstest.StreamingOutputCallRequest.Builder.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">grpc.testing</div> <h2 title="Class Qpstest.StreamingOutputCallRequest.Builder" class="title">Class Qpstest.StreamingOutputCallRequest.Builder</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>com.google.protobuf.AbstractMessageLite.Builder&lt;BuilderType&gt;</li> <li> <ul class="inheritance"> <li>com.google.protobuf.AbstractMessage.Builder&lt;BuilderType&gt;</li> <li> <ul class="inheritance"> <li>com.google.protobuf.GeneratedMessage.Builder&lt;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&gt;</li> <li> <ul class="inheritance"> <li>grpc.testing.Qpstest.StreamingOutputCallRequest.Builder</li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd>com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, <a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a>, java.lang.Cloneable</dd> </dl> <dl> <dt>Enclosing class:</dt> <dd><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest</a></dd> </dl> <hr> <br> <pre>public static final class <span class="typeNameLabel">Qpstest.StreamingOutputCallRequest.Builder</span> extends com.google.protobuf.GeneratedMessage.Builder&lt;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&gt; implements <a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></pre> <div class="block">Protobuf type <code>grpc.testing.StreamingOutputCallRequest</code></div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#addAllResponseParameters-java.lang.Iterable-">addAllResponseParameters</a></span>(java.lang.Iterable&lt;? extends <a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&gt;&nbsp;values)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#addResponseParameters-int-grpc.testing.Qpstest.ResponseParameters.Builder-">addResponseParameters</a></span>(int&nbsp;index, <a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&nbsp;builderForValue)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#addResponseParameters-int-grpc.testing.Qpstest.ResponseParameters-">addResponseParameters</a></span>(int&nbsp;index, <a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&nbsp;value)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#addResponseParameters-grpc.testing.Qpstest.ResponseParameters.Builder-">addResponseParameters</a></span>(<a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&nbsp;builderForValue)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i4" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#addResponseParameters-grpc.testing.Qpstest.ResponseParameters-">addResponseParameters</a></span>(<a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&nbsp;value)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i5" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#addResponseParametersBuilder--">addResponseParametersBuilder</a></span>()</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i6" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#addResponseParametersBuilder-int-">addResponseParametersBuilder</a></span>(int&nbsp;index)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i7" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#build--">build</a></span>()</code>&nbsp;</td> </tr> <tr id="i8" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#buildPartial--">buildPartial</a></span>()</code>&nbsp;</td> </tr> <tr id="i9" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#clear--">clear</a></span>()</code>&nbsp;</td> </tr> <tr id="i10" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#clearPayload--">clearPayload</a></span>()</code> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code></div> </td> </tr> <tr id="i11" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#clearResponseParameters--">clearResponseParameters</a></span>()</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i12" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#clearResponseType--">clearResponseType</a></span>()</code> <div class="block"><code>optional .grpc.testing.PayloadType response_type = 1 [default = COMPRESSABLE];</code></div> </td> </tr> <tr id="i13" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getDefaultInstanceForType--">getDefaultInstanceForType</a></span>()</code>&nbsp;</td> </tr> <tr id="i14" class="altColor"> <td class="colFirst"><code>static com.google.protobuf.Descriptors.Descriptor</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getDescriptor--">getDescriptor</a></span>()</code>&nbsp;</td> </tr> <tr id="i15" class="rowColor"> <td class="colFirst"><code>com.google.protobuf.Descriptors.Descriptor</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getDescriptorForType--">getDescriptorForType</a></span>()</code>&nbsp;</td> </tr> <tr id="i16" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.Payload.html" title="class in grpc.testing">Qpstest.Payload</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getPayload--">getPayload</a></span>()</code> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code></div> </td> </tr> <tr id="i17" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.Payload.Builder.html" title="class in grpc.testing">Qpstest.Payload.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getPayloadBuilder--">getPayloadBuilder</a></span>()</code> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code></div> </td> </tr> <tr id="i18" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.PayloadOrBuilder.html" title="interface in grpc.testing">Qpstest.PayloadOrBuilder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getPayloadOrBuilder--">getPayloadOrBuilder</a></span>()</code> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code></div> </td> </tr> <tr id="i19" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getResponseParameters-int-">getResponseParameters</a></span>(int&nbsp;index)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i20" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getResponseParametersBuilder-int-">getResponseParametersBuilder</a></span>(int&nbsp;index)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i21" class="rowColor"> <td class="colFirst"><code>java.util.List&lt;<a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getResponseParametersBuilderList--">getResponseParametersBuilderList</a></span>()</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i22" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getResponseParametersCount--">getResponseParametersCount</a></span>()</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i23" class="rowColor"> <td class="colFirst"><code>java.util.List&lt;<a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getResponseParametersList--">getResponseParametersList</a></span>()</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i24" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.ResponseParametersOrBuilder.html" title="interface in grpc.testing">Qpstest.ResponseParametersOrBuilder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getResponseParametersOrBuilder-int-">getResponseParametersOrBuilder</a></span>(int&nbsp;index)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i25" class="rowColor"> <td class="colFirst"><code>java.util.List&lt;? extends <a href="../../grpc/testing/Qpstest.ResponseParametersOrBuilder.html" title="interface in grpc.testing">Qpstest.ResponseParametersOrBuilder</a>&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getResponseParametersOrBuilderList--">getResponseParametersOrBuilderList</a></span>()</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i26" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.PayloadType.html" title="enum in grpc.testing">Qpstest.PayloadType</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#getResponseType--">getResponseType</a></span>()</code> <div class="block"><code>optional .grpc.testing.PayloadType response_type = 1 [default = COMPRESSABLE];</code></div> </td> </tr> <tr id="i27" class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#hasPayload--">hasPayload</a></span>()</code> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code></div> </td> </tr> <tr id="i28" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#hasResponseType--">hasResponseType</a></span>()</code> <div class="block"><code>optional .grpc.testing.PayloadType response_type = 1 [default = COMPRESSABLE];</code></div> </td> </tr> <tr id="i29" class="rowColor"> <td class="colFirst"><code>protected com.google.protobuf.GeneratedMessage.FieldAccessorTable</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#internalGetFieldAccessorTable--">internalGetFieldAccessorTable</a></span>()</code>&nbsp;</td> </tr> <tr id="i30" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#isInitialized--">isInitialized</a></span>()</code>&nbsp;</td> </tr> <tr id="i31" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#mergeFrom-com.google.protobuf.CodedInputStream-com.google.protobuf.ExtensionRegistryLite-">mergeFrom</a></span>(com.google.protobuf.CodedInputStream&nbsp;input, com.google.protobuf.ExtensionRegistryLite&nbsp;extensionRegistry)</code>&nbsp;</td> </tr> <tr id="i32" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#mergeFrom-com.google.protobuf.Message-">mergeFrom</a></span>(com.google.protobuf.Message&nbsp;other)</code>&nbsp;</td> </tr> <tr id="i33" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#mergeFrom-grpc.testing.Qpstest.StreamingOutputCallRequest-">mergeFrom</a></span>(<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest</a>&nbsp;other)</code>&nbsp;</td> </tr> <tr id="i34" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#mergePayload-grpc.testing.Qpstest.Payload-">mergePayload</a></span>(<a href="../../grpc/testing/Qpstest.Payload.html" title="class in grpc.testing">Qpstest.Payload</a>&nbsp;value)</code> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code></div> </td> </tr> <tr id="i35" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#removeResponseParameters-int-">removeResponseParameters</a></span>(int&nbsp;index)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i36" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#setPayload-grpc.testing.Qpstest.Payload.Builder-">setPayload</a></span>(<a href="../../grpc/testing/Qpstest.Payload.Builder.html" title="class in grpc.testing">Qpstest.Payload.Builder</a>&nbsp;builderForValue)</code> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code></div> </td> </tr> <tr id="i37" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#setPayload-grpc.testing.Qpstest.Payload-">setPayload</a></span>(<a href="../../grpc/testing/Qpstest.Payload.html" title="class in grpc.testing">Qpstest.Payload</a>&nbsp;value)</code> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code></div> </td> </tr> <tr id="i38" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#setResponseParameters-int-grpc.testing.Qpstest.ResponseParameters.Builder-">setResponseParameters</a></span>(int&nbsp;index, <a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&nbsp;builderForValue)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i39" class="rowColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#setResponseParameters-int-grpc.testing.Qpstest.ResponseParameters-">setResponseParameters</a></span>(int&nbsp;index, <a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&nbsp;value)</code> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </td> </tr> <tr id="i40" class="altColor"> <td class="colFirst"><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html#setResponseType-grpc.testing.Qpstest.PayloadType-">setResponseType</a></span>(<a href="../../grpc/testing/Qpstest.PayloadType.html" title="enum in grpc.testing">Qpstest.PayloadType</a>&nbsp;value)</code> <div class="block"><code>optional .grpc.testing.PayloadType response_type = 1 [default = COMPRESSABLE];</code></div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.com.google.protobuf.GeneratedMessage.Builder"> <!-- --> </a> <h3>Methods inherited from class&nbsp;com.google.protobuf.GeneratedMessage.Builder</h3> <code>addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, isClean, markClean, mergeUnknownFields, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields</code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.com.google.protobuf.AbstractMessage.Builder"> <!-- --> </a> <h3>Methods inherited from class&nbsp;com.google.protobuf.AbstractMessage.Builder</h3> <code>findInitializationErrors, getInitializationErrorString, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString</code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.com.google.protobuf.AbstractMessageLite.Builder"> <!-- --> </a> <h3>Methods inherited from class&nbsp;com.google.protobuf.AbstractMessageLite.Builder</h3> <code>addAll, newUninitializedMessageException</code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.com.google.protobuf.MessageOrBuilder"> <!-- --> </a> <h3>Methods inherited from interface&nbsp;com.google.protobuf.MessageOrBuilder</h3> <code>findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getDescriptor--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getDescriptor</h4> <pre>public static final&nbsp;com.google.protobuf.Descriptors.Descriptor&nbsp;getDescriptor()</pre> </li> </ul> <a name="internalGetFieldAccessorTable--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>internalGetFieldAccessorTable</h4> <pre>protected&nbsp;com.google.protobuf.GeneratedMessage.FieldAccessorTable&nbsp;internalGetFieldAccessorTable()</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>internalGetFieldAccessorTable</code>&nbsp;in class&nbsp;<code>com.google.protobuf.GeneratedMessage.Builder&lt;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&gt;</code></dd> </dl> </li> </ul> <a name="clear--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>clear</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;clear()</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>clear</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.Message.Builder</code></dd> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>clear</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.MessageLite.Builder</code></dd> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>clear</code>&nbsp;in class&nbsp;<code>com.google.protobuf.GeneratedMessage.Builder&lt;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&gt;</code></dd> </dl> </li> </ul> <a name="getDescriptorForType--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getDescriptorForType</h4> <pre>public&nbsp;com.google.protobuf.Descriptors.Descriptor&nbsp;getDescriptorForType()</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>getDescriptorForType</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.Message.Builder</code></dd> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>getDescriptorForType</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.MessageOrBuilder</code></dd> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>getDescriptorForType</code>&nbsp;in class&nbsp;<code>com.google.protobuf.GeneratedMessage.Builder&lt;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&gt;</code></dd> </dl> </li> </ul> <a name="getDefaultInstanceForType--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getDefaultInstanceForType</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest</a>&nbsp;getDefaultInstanceForType()</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>getDefaultInstanceForType</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.MessageLiteOrBuilder</code></dd> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>getDefaultInstanceForType</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.MessageOrBuilder</code></dd> </dl> </li> </ul> <a name="build--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>build</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest</a>&nbsp;build()</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>build</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.Message.Builder</code></dd> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>build</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.MessageLite.Builder</code></dd> </dl> </li> </ul> <a name="buildPartial--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>buildPartial</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest</a>&nbsp;buildPartial()</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>buildPartial</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.Message.Builder</code></dd> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>buildPartial</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.MessageLite.Builder</code></dd> </dl> </li> </ul> <a name="mergeFrom-com.google.protobuf.Message-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>mergeFrom</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;mergeFrom(com.google.protobuf.Message&nbsp;other)</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>mergeFrom</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.Message.Builder</code></dd> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>mergeFrom</code>&nbsp;in class&nbsp;<code>com.google.protobuf.AbstractMessage.Builder&lt;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&gt;</code></dd> </dl> </li> </ul> <a name="mergeFrom-grpc.testing.Qpstest.StreamingOutputCallRequest-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>mergeFrom</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;mergeFrom(<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest</a>&nbsp;other)</pre> </li> </ul> <a name="isInitialized--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isInitialized</h4> <pre>public final&nbsp;boolean&nbsp;isInitialized()</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>isInitialized</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.MessageLiteOrBuilder</code></dd> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>isInitialized</code>&nbsp;in class&nbsp;<code>com.google.protobuf.GeneratedMessage.Builder&lt;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&gt;</code></dd> </dl> </li> </ul> <a name="mergeFrom-com.google.protobuf.CodedInputStream-com.google.protobuf.ExtensionRegistryLite-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>mergeFrom</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;mergeFrom(com.google.protobuf.CodedInputStream&nbsp;input, com.google.protobuf.ExtensionRegistryLite&nbsp;extensionRegistry) throws java.io.IOException</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>mergeFrom</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.Message.Builder</code></dd> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>mergeFrom</code>&nbsp;in interface&nbsp;<code>com.google.protobuf.MessageLite.Builder</code></dd> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code>mergeFrom</code>&nbsp;in class&nbsp;<code>com.google.protobuf.AbstractMessage.Builder&lt;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&gt;</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code>java.io.IOException</code></dd> </dl> </li> </ul> <a name="hasResponseType--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>hasResponseType</h4> <pre>public&nbsp;boolean&nbsp;hasResponseType()</pre> <div class="block"><code>optional .grpc.testing.PayloadType response_type = 1 [default = COMPRESSABLE];</code> <pre> Desired payload type in the response from the server. If response_type is RANDOM, the payload from each response in the stream might be of different types. This is to simulate a mixed type of payload stream. </pre></div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html#hasResponseType--">hasResponseType</a></code>&nbsp;in interface&nbsp;<code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></code></dd> </dl> </li> </ul> <a name="getResponseType--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getResponseType</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.PayloadType.html" title="enum in grpc.testing">Qpstest.PayloadType</a>&nbsp;getResponseType()</pre> <div class="block"><code>optional .grpc.testing.PayloadType response_type = 1 [default = COMPRESSABLE];</code> <pre> Desired payload type in the response from the server. If response_type is RANDOM, the payload from each response in the stream might be of different types. This is to simulate a mixed type of payload stream. </pre></div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html#getResponseType--">getResponseType</a></code>&nbsp;in interface&nbsp;<code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></code></dd> </dl> </li> </ul> <a name="setResponseType-grpc.testing.Qpstest.PayloadType-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setResponseType</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;setResponseType(<a href="../../grpc/testing/Qpstest.PayloadType.html" title="enum in grpc.testing">Qpstest.PayloadType</a>&nbsp;value)</pre> <div class="block"><code>optional .grpc.testing.PayloadType response_type = 1 [default = COMPRESSABLE];</code> <pre> Desired payload type in the response from the server. If response_type is RANDOM, the payload from each response in the stream might be of different types. This is to simulate a mixed type of payload stream. </pre></div> </li> </ul> <a name="clearResponseType--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>clearResponseType</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;clearResponseType()</pre> <div class="block"><code>optional .grpc.testing.PayloadType response_type = 1 [default = COMPRESSABLE];</code> <pre> Desired payload type in the response from the server. If response_type is RANDOM, the payload from each response in the stream might be of different types. This is to simulate a mixed type of payload stream. </pre></div> </li> </ul> <a name="getResponseParametersList--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getResponseParametersList</h4> <pre>public&nbsp;java.util.List&lt;<a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&gt;&nbsp;getResponseParametersList()</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html#getResponseParametersList--">getResponseParametersList</a></code>&nbsp;in interface&nbsp;<code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></code></dd> </dl> </li> </ul> <a name="getResponseParametersCount--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getResponseParametersCount</h4> <pre>public&nbsp;int&nbsp;getResponseParametersCount()</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html#getResponseParametersCount--">getResponseParametersCount</a></code>&nbsp;in interface&nbsp;<code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></code></dd> </dl> </li> </ul> <a name="getResponseParameters-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getResponseParameters</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&nbsp;getResponseParameters(int&nbsp;index)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html#getResponseParameters-int-">getResponseParameters</a></code>&nbsp;in interface&nbsp;<code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></code></dd> </dl> </li> </ul> <a name="setResponseParameters-int-grpc.testing.Qpstest.ResponseParameters-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setResponseParameters</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;setResponseParameters(int&nbsp;index, <a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&nbsp;value)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="setResponseParameters-int-grpc.testing.Qpstest.ResponseParameters.Builder-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setResponseParameters</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;setResponseParameters(int&nbsp;index, <a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&nbsp;builderForValue)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="addResponseParameters-grpc.testing.Qpstest.ResponseParameters-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>addResponseParameters</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;addResponseParameters(<a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&nbsp;value)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="addResponseParameters-int-grpc.testing.Qpstest.ResponseParameters-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>addResponseParameters</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;addResponseParameters(int&nbsp;index, <a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&nbsp;value)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="addResponseParameters-grpc.testing.Qpstest.ResponseParameters.Builder-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>addResponseParameters</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;addResponseParameters(<a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&nbsp;builderForValue)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="addResponseParameters-int-grpc.testing.Qpstest.ResponseParameters.Builder-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>addResponseParameters</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;addResponseParameters(int&nbsp;index, <a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&nbsp;builderForValue)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="addAllResponseParameters-java.lang.Iterable-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>addAllResponseParameters</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;addAllResponseParameters(java.lang.Iterable&lt;? extends <a href="../../grpc/testing/Qpstest.ResponseParameters.html" title="class in grpc.testing">Qpstest.ResponseParameters</a>&gt;&nbsp;values)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="clearResponseParameters--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>clearResponseParameters</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;clearResponseParameters()</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="removeResponseParameters-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>removeResponseParameters</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;removeResponseParameters(int&nbsp;index)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="getResponseParametersBuilder-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getResponseParametersBuilder</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&nbsp;getResponseParametersBuilder(int&nbsp;index)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="getResponseParametersOrBuilder-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getResponseParametersOrBuilder</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.ResponseParametersOrBuilder.html" title="interface in grpc.testing">Qpstest.ResponseParametersOrBuilder</a>&nbsp;getResponseParametersOrBuilder(int&nbsp;index)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html#getResponseParametersOrBuilder-int-">getResponseParametersOrBuilder</a></code>&nbsp;in interface&nbsp;<code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></code></dd> </dl> </li> </ul> <a name="getResponseParametersOrBuilderList--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getResponseParametersOrBuilderList</h4> <pre>public&nbsp;java.util.List&lt;? extends <a href="../../grpc/testing/Qpstest.ResponseParametersOrBuilder.html" title="interface in grpc.testing">Qpstest.ResponseParametersOrBuilder</a>&gt;&nbsp;getResponseParametersOrBuilderList()</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html#getResponseParametersOrBuilderList--">getResponseParametersOrBuilderList</a></code>&nbsp;in interface&nbsp;<code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></code></dd> </dl> </li> </ul> <a name="addResponseParametersBuilder--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>addResponseParametersBuilder</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&nbsp;addResponseParametersBuilder()</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="addResponseParametersBuilder-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>addResponseParametersBuilder</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&nbsp;addResponseParametersBuilder(int&nbsp;index)</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="getResponseParametersBuilderList--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getResponseParametersBuilderList</h4> <pre>public&nbsp;java.util.List&lt;<a href="../../grpc/testing/Qpstest.ResponseParameters.Builder.html" title="class in grpc.testing">Qpstest.ResponseParameters.Builder</a>&gt;&nbsp;getResponseParametersBuilderList()</pre> <div class="block"><code>repeated .grpc.testing.ResponseParameters response_parameters = 2;</code></div> </li> </ul> <a name="hasPayload--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>hasPayload</h4> <pre>public&nbsp;boolean&nbsp;hasPayload()</pre> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code> <pre> Optional input payload sent along with the request. </pre></div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html#hasPayload--">hasPayload</a></code>&nbsp;in interface&nbsp;<code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></code></dd> </dl> </li> </ul> <a name="getPayload--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getPayload</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.Payload.html" title="class in grpc.testing">Qpstest.Payload</a>&nbsp;getPayload()</pre> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code> <pre> Optional input payload sent along with the request. </pre></div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html#getPayload--">getPayload</a></code>&nbsp;in interface&nbsp;<code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></code></dd> </dl> </li> </ul> <a name="setPayload-grpc.testing.Qpstest.Payload-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setPayload</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;setPayload(<a href="../../grpc/testing/Qpstest.Payload.html" title="class in grpc.testing">Qpstest.Payload</a>&nbsp;value)</pre> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code> <pre> Optional input payload sent along with the request. </pre></div> </li> </ul> <a name="setPayload-grpc.testing.Qpstest.Payload.Builder-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setPayload</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;setPayload(<a href="../../grpc/testing/Qpstest.Payload.Builder.html" title="class in grpc.testing">Qpstest.Payload.Builder</a>&nbsp;builderForValue)</pre> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code> <pre> Optional input payload sent along with the request. </pre></div> </li> </ul> <a name="mergePayload-grpc.testing.Qpstest.Payload-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>mergePayload</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;mergePayload(<a href="../../grpc/testing/Qpstest.Payload.html" title="class in grpc.testing">Qpstest.Payload</a>&nbsp;value)</pre> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code> <pre> Optional input payload sent along with the request. </pre></div> </li> </ul> <a name="clearPayload--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>clearPayload</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" title="class in grpc.testing">Qpstest.StreamingOutputCallRequest.Builder</a>&nbsp;clearPayload()</pre> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code> <pre> Optional input payload sent along with the request. </pre></div> </li> </ul> <a name="getPayloadBuilder--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getPayloadBuilder</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.Payload.Builder.html" title="class in grpc.testing">Qpstest.Payload.Builder</a>&nbsp;getPayloadBuilder()</pre> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code> <pre> Optional input payload sent along with the request. </pre></div> </li> </ul> <a name="getPayloadOrBuilder--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>getPayloadOrBuilder</h4> <pre>public&nbsp;<a href="../../grpc/testing/Qpstest.PayloadOrBuilder.html" title="interface in grpc.testing">Qpstest.PayloadOrBuilder</a>&nbsp;getPayloadOrBuilder()</pre> <div class="block"><code>optional .grpc.testing.Payload payload = 3;</code> <pre> Optional input payload sent along with the request. </pre></div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html#getPayloadOrBuilder--">getPayloadOrBuilder</a></code>&nbsp;in interface&nbsp;<code><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing">Qpstest.StreamingOutputCallRequestOrBuilder</a></code></dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-all.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequest.html" title="class in grpc.testing"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../grpc/testing/Qpstest.StreamingOutputCallRequestOrBuilder.html" title="interface in grpc.testing"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../index.html?grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html" target="_top">Frames</a></li> <li><a href="Qpstest.StreamingOutputCallRequest.Builder.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
ashishbende/Lab2
benchmarks/build/docs/javadoc/grpc/testing/Qpstest.StreamingOutputCallRequest.Builder.html
HTML
bsd-3-clause
62,643
/* Sirikata Network Utilities * StreamListener.hpp * * Copyright (c) 2009, Daniel Reiter Horn * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Sirikata nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef SIRIKATA_StreamListener_HPP__ #define SIRIKATA_StreamListener_HPP__ namespace Sirikata { namespace Network { /** * This class waits on a service and listens for incoming connections * It calls the callback whenever such connections are encountered */ class SIRIKATA_EXPORT StreamListener { protected: StreamListener(){} public: ///subclasses will expose these methods with similar arguments + protocol specific args virtual bool listen( const Address&addy, const Stream::SubstreamCallback&newStreamCallback)=0; ///returns thea name of the computer followed by a colon and then the service being listened on virtual String listenAddressName()const=0; ///returns thea name of the computer followed by a colon and then the service being listened on virtual Address listenAddress()const=0; ///stops listening virtual void close()=0; virtual ~StreamListener(){}; }; } } #endif
robertkhamilton/sirikata
libcore/src/network/StreamListener.hpp
C++
bsd-3-clause
2,576
<?php /** * KumbiaPHP web & app Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE. * * @category KumbiaPHP * @package Helpers * * @copyright Copyright (c) 2005 - 2020 KumbiaPHP Team (http://www.kumbiaphp.com) * @license https://github.com/KumbiaPHP/KumbiaPHP/blob/master/LICENSE New BSD License */ /** * Helper para crear Formularios de un modelo automáticamente. * * @category KumbiaPHP * @package Helpers */ class ModelForm { /** * Genera un form de un modelo (objeto) automáticamente. * * @param object $model * @param string $action */ public static function create($model, $action = '') { $model_name = get_class($model); if (!$action) { $action = ltrim(Router::get('route'), '/'); } echo '<form action="', PUBLIC_PATH.$action, '" method="post" id="', $model_name, '" class="scaffold">' , PHP_EOL; $pk = $model->primary_key[0]; echo '<input id="', $model_name, '_', $pk, '" name="', $model_name, '[', $pk, ']" class="id" value="', $model->$pk , '" type="hidden">' , PHP_EOL; $fields = array_diff($model->fields, $model->_at, $model->_in, $model->primary_key); foreach ($fields as $field) { $tipo = trim(preg_replace('/(\(.*\))/', '', $model->_data_type[$field])); //TODO: recoger tamaño y otros valores $alias = $model->get_alias($field); $formId = $model_name.'_'.$field; $formName = $model_name.'['.$field.']'; if (in_array($field, $model->not_null)) { echo "<label for=\"$formId\" class=\"required\">$alias *</label>" , PHP_EOL; } else { echo "<label for=\"$formId\">$alias</label>" , PHP_EOL; } switch ($tipo) { case 'tinyint': case 'smallint': case 'mediumint': case 'integer': case 'int': case 'bigint': case 'float': case 'double': case 'precision': case 'real': case 'decimal': case 'numeric': case 'year': case 'day': case 'int unsigned': // Números if (strripos($field, '_id', -3)) { echo Form::dbSelect($model_name.'.'.$field, null, null, 'Seleccione', '', $model->$field); break; } echo "<input id=\"$formId\" type=\"number\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL; break; case 'date': // Usar el js de datetime echo "<input id=\"$formId\" type=\"date\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL; break; case 'datetime': case 'timestamp': echo "<input id=\"$formId\" type=\"datetime\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL; break; case 'enum': case 'set': case 'bool': $enumList = explode(',', str_replace("'", '', substr($model->_data_type[$field], 5, (strlen($model->_data_type[$field]) - 6)))); echo "<select id=\"$formId\" class=\"select\" name=\"$formName\" >", PHP_EOL; foreach ($enumList as $value) { echo "<option value=\"{$value}\">$value</option>", PHP_EOL; } echo '</select>', PHP_EOL; break; case 'text': case 'mediumtext': case 'longtext': // Usar textarea case 'blob': case 'mediumblob': case 'longblob': echo "<textarea id=\"$formId\" name=\"$formName\">{$model->$field}</textarea>" , PHP_EOL; break; default: //text,tinytext,varchar, char,etc se comprobara su tamaño echo "<input id=\"$formId\" type=\"text\" name=\"$formName\" value=\"{$model->$field}\">" , PHP_EOL; } } echo '<input type="submit" value="Enviar" />' , PHP_EOL; echo '</form>' , PHP_EOL; } }
KumbiaPHP/KumbiaPHP
core/extensions/helpers/model_form.php
PHP
bsd-3-clause
4,151