repo_name
stringlengths
6
101
path
stringlengths
4
300
text
stringlengths
7
1.31M
conjurinc/conjur-service-broker
spec/lib/conjur_client_spec.rb
require 'spec_helper' require 'conjur_client' describe ConjurClient do describe "#api" do let(:master_url) { "master" } let(:follower_url) { "follower" } before do allow(ENV).to receive(:[]).and_call_original allow(ENV).to receive(:[]).with('CONJUR_APPLIANCE_URL').and_return(master_url) allow(ENV).to receive(:[]).with('CONJUR_FOLLOWER_URL').and_return(follower_url) end it "returns a Conjur API object" do expect(ConjurClient.api).to be_instance_of(Conjur::API) end it "uses the Conjur Master URL" do ConjurClient.api expect(Conjur.configuration.appliance_url).to equal(master_url) end end describe "#readonly_api" do let(:master_url) { "master" } let(:follower_url) { nil } before do allow(ENV).to receive(:[]).and_call_original allow(ENV).to receive(:[]).with('CONJUR_APPLIANCE_URL').and_return(master_url) allow(ENV).to receive(:[]).with('CONJUR_FOLLOWER_URL').and_return(follower_url) end it "returns a Conjur API object" do expect(ConjurClient.readonly_api).to be_instance_of(Conjur::API) end it "uses the Conjur Master URL" do ConjurClient.readonly_api expect(Conjur.configuration.appliance_url).to equal(master_url) end context "when the follower URL is configured" do let(:follower_url) { "follower" } it "uses the Conjur Follower URL" do ConjurClient.readonly_api expect(Conjur.configuration.appliance_url).to equal(follower_url) end end end describe "login_host_id" do context "login is a host" do before do allow(ENV). to receive(:[]). with('CONJUR_AUTHN_LOGIN'). and_return('host/some_host') end it "returns login without 'host/' prefix" do expect(ConjurClient.login_host_id).to eq('some_host') end end context "login is not a host" do before do allow(ENV). to receive(:[]). with('CONJUR_AUTHN_LOGIN'). and_return('some_user') end it "returns nil if login is not a host" do expect(ConjurClient.login_host_id).to be_nil end end end describe 'application_conjur_url' do let(:appliance_url) { 'http://conjur-master' } before do allow(ENV). to receive(:[]). with('CONJUR_FOLLOWER_URL'). and_return(nil) allow(ENV). to receive(:[]). with('CONJUR_APPLIANCE_URL'). and_return(appliance_url) end context "no follower url is specified" do it "returns appliance url" do expect(ConjurClient.application_conjur_url).to eq(appliance_url) end end context "follower url is specified" do let(:follower_url) { 'http://conjur-follower' } before do allow(ENV). to receive(:[]). with('CONJUR_FOLLOWER_URL'). and_return(follower_url) end it "returns follower url" do expect(ConjurClient.application_conjur_url).to eq(follower_url) end context "follower url is empty string" do let(:follower_url) { '' } it "returns follower url" do expect(ConjurClient.application_conjur_url).to eq(appliance_url) end end end end describe "version" do before do allow(ENV).to receive(:[]).and_call_original end it "uses the default version (5) when the input is an empty string" do allow(ENV).to receive(:[]).with('CONJUR_VERSION').and_return("") expect(ConjurClient.version).to eq(5) end it "uses the default version (5) when the input is `nil`" do allow(ENV).to receive(:[]).with('CONJUR_VERSION') expect(ConjurClient.version).to eq(5) end it "throws an error when the input is invalid" do allow(ENV).to receive(:[]).with('CONJUR_VERSION').and_return("foobar") expect { ConjurClient.version }.to raise_error(RuntimeError) end it "throws an error when given a deprecated version" do allow(ENV).to receive(:[]).with('CONJUR_VERSION').and_return("4") expect { ConjurClient.version }.to raise_error(RuntimeError) end it "uses the given version" do allow(ENV).to receive(:[]).with('CONJUR_VERSION').and_return("5") expect(ConjurClient.version).to eq(5) end end end
Remag/ReversedLibrary
Inc/BitmapShape.h
<reponame>Remag/ReversedLibrary #pragma once #include <DynamicBitset.h> namespace Relib { ////////////////////////////////////////////////////////////////////////// // Shape that is defined by a bitset, where each set bit represents a 1x1 unit of flagged hitbox space. template <class T> class CBitmapShape : public CShape<T> { public: CBitmapShape() = default; CBitmapShape( CDynamicBitSet<> _bitmap, CVector2<int> _cellCount ) : bitmap( move( _bitmap ) ), cellCount( _cellCount ) {} // CShape. virtual THitboxShapeType GetType() const override final { return HST_Bitmap; } CAARect<T> GetBaseBoundRect() const; virtual CAARect<T> GetBoundRect( CMatrix3<T> transformation ) const override final; void SetBitmap( CDynamicBitSet<> newValue, CVector2<int> newCellCount ) { bitmap = move( newValue ); cellCount = newCellCount; } const CDynamicBitSet<>& GetBitmap() const { return bitmap; } CVector2<int> GetCellCount() const { return cellCount; } private: CVector2<int> cellCount; CDynamicBitSet<> bitmap; }; ////////////////////////////////////////////////////////////////////////// template <class T> CAARect<T> CBitmapShape<T>::GetBaseBoundRect() const { return CAARect<T>{ CVector2<T>{}, T( cellCount.X() ), T( cellCount.Y() ) }; } template <class T> CAARect<T> CBitmapShape<T>::GetBoundRect( CMatrix3<T> transformation ) const { const auto boundRect = GetBaseBoundRect(); // Find transformed bound rectangle points. const CVector2<T> widthVec = TVector2( boundRect.Width(), T( 0 ) ); const CVector2<T> heightVec = TVector2( T( 0 ), boundRect.Height() ); const CVector2<T> widthOffset = VecTransform( transformation, widthVec ); const CVector2<T> heightOffset = VecTransform( transformation, heightVec ); CStackArray<CVector2<T>, 4> points; points[0] = PointTransform( transformation, boundRect.BottomLeft() ); points[1] = points[0] + widthOffset; points[2] = points[1] + heightOffset; points[3] = points[0] + heightOffset; // Get the bounding rectangle of the transformed points. const auto minmaxX = minmax( points[0].X(), points[1].X(), points[2].X(), points[3].X() ); const auto minmaxY = minmax( points[0].Y(), points[1].Y(), points[2].Y(), points[3].Y() ); return TAARect( minmaxX.GetLower(), minmaxY.GetUpper(), minmaxX.GetUpper(), minmaxY.GetLower() ); } ////////////////////////////////////////////////////////////////////////// } // namespace Relib.
ligson/ejbca
modules/ejbca-common/src/org/ejbca/core/ejb/config/AvailableExtendedKeyUsagesConfigurationCache.java
/************************************************************************* * * * EJBCA Community: The OpenSource Certificate Authority * * * * This software is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or any later version. * * * * See terms of license at gnu.org. * * * *************************************************************************/ package org.ejbca.core.ejb.config; import java.util.HashMap; import java.util.Properties; import org.cesecore.config.AvailableExtendedKeyUsagesConfiguration; import org.cesecore.config.CesecoreConfiguration; import org.cesecore.configuration.ConfigurationBase; import org.cesecore.configuration.ConfigurationCache; /** * Class Holding cache variable for available extended key usages configuration. * * Needed because EJB spec does not allow volatile, non-final fields in session beans. * * @version $Id: AvailableExtendedKeyUsagesConfigurationCache.java 22740 2016-02-05 13:28:45Z mikekushner $ */ public class AvailableExtendedKeyUsagesConfigurationCache implements ConfigurationCache { /** * Cache variable containing the available extended key usages configuration. This cache may be * unsynchronized between multiple instances of EJBCA, but is common to all * threads in the same VM. Set volatile to make it thread friendly. */ private volatile ConfigurationBase cache = null; /** help variable used to control that updates are not performed to often. */ private volatile long lastUpdateTime = -1; @Override public boolean needsUpdate() { return cache==null || lastUpdateTime + CesecoreConfiguration.getCacheGlobalConfigurationTime() < System.currentTimeMillis(); } @Override public void clearCache() { cache = null; } @Override public String getConfigId() { if (cache==null) { return getNewConfiguration().getConfigurationId(); } return cache.getConfigurationId(); } @Override public void saveData() { cache.saveData(); } @Override public ConfigurationBase getConfiguration() { return cache; } @SuppressWarnings("rawtypes") @Override public ConfigurationBase getConfiguration(final HashMap data) { final ConfigurationBase returnval = new AvailableExtendedKeyUsagesConfiguration(false); returnval.loadData(data); return returnval; } @Override public void updateConfiguration(final ConfigurationBase configuration) { cache = configuration; lastUpdateTime = System.currentTimeMillis(); } @Override public ConfigurationBase getNewConfiguration() { return new AvailableExtendedKeyUsagesConfiguration(); } @Override public Properties getAllProperties() { return ((AvailableExtendedKeyUsagesConfiguration)cache).getAsProperties(); } }
Bizzarrus/CloakEngine
CloakCompiler/ConvexHull.cpp
#include "stdafx.h" #include "Engine/ConvexHull.h" #include <set> #include <vector> #include <unordered_map> #include <utility> #include <assert.h> #include <random> namespace CloakCompiler { namespace Engine { namespace ConvexHull { constexpr float EPSILON_F = 1e-4f; constexpr float EPSILON_FS = 1e-6f; const CloakEngine::Global::Math::Vector HULL_DIRECTIONS[] = { { -1,-1,-1, 1 }, { 1, 0, 0, 1 }, { 0, 1, 0, 1 }, { 0, 0, 1, 1 }, { 1, 1, 0, 1 }, { 1, 0, 1, 1 }, { 0, 1, 1, 1 }, { 1,-1, 0, 1 }, { 1, 0,-1, 1 }, { 0, 1,-1, 1 }, { 1, 1, 1, 1 }, { -1, 1, 1, 1 }, { 1,-1, 1, 1 }, { 1, 1,-1, 1 }, }; class Edge { private: std::pair<size_t, size_t> m_pair; public: CLOAK_CALL Edge(In size_t a, In size_t b) : m_pair(std::make_pair(a, b)) { } size_t CLOAK_CALL_THIS first() const { return m_pair.first; } size_t CLOAK_CALL_THIS second() const { return m_pair.second; } Edge& CLOAK_CALL_THIS operator=(In const Edge& b) { m_pair = std::make_pair(b.m_pair.first, b.m_pair.second); return *this; } bool CLOAK_CALL_THIS operator==(In const Edge& b) const { return m_pair.first == b.m_pair.first && m_pair.second == b.m_pair.second; } }; struct EdgeToFace { bool Enabled = true; size_t Face = 0; CLOAK_CALL EdgeToFace() {} CLOAK_CALL EdgeToFace(In size_t a) { Enabled = true; Face = a; } }; struct EdgeHash { size_t CLOAK_CALL operator()(In const Edge& p) const { return (p.first() << (sizeof(size_t) << 2)) ^ p.second(); } }; //Set of unique points class PointSet { private: #ifdef _DEBUG CE::List<CE::Global::Math::Vector> m_points; #else const CE::Global::Math::Vector* m_points; #endif CE::List<size_t> m_set; public: #ifdef _DEBUG CLOAK_CALL PointSet(In const CloakEngine::Global::Math::Vector* points, In size_t size) : m_points(&points[0],&points[size]) #else CLOAK_CALL PointSet(In const CloakEngine::Global::Math::Vector* points, In size_t size) : m_points(points) #endif { m_set.reserve(size); for (size_t a = 0; a < size; a++) { for (size_t b = 0; b < m_set.size(); b++) { if (points[a] == points[m_set[b]]) { goto point_in_set; } } m_set.push_back(a); point_in_set: continue; } } #ifdef _DEBUG CLOAK_CALL PointSet(In const PointSet& p) : m_points(p.m_points), m_set(p.m_set) #else CLOAK_CALL PointSet(In const PointSet& p) : m_points(p.m_points), m_set(p.m_set) #endif { } CLOAK_CALL ~PointSet() { } void CLOAK_CALL_THIS swap(In size_t a, In size_t b) { std::swap(m_set[a], m_set[b]); } size_t CLOAK_CALL_THIS size() const { return m_set.size(); } const CloakEngine::Global::Math::Vector& CLOAK_CALL_THIS at(In size_t p) const { return m_points[m_set[p]]; } const CloakEngine::Global::Math::Vector& CLOAK_CALL_THIS operator[](In size_t p) const { return at(p); } }; class Face { private: const PointSet* const m_set; CloakEngine::Global::Math::Plane m_plane; size_t m_points[3]; bool m_enabled; public: CLOAK_CALL Face(In const Face& f) : m_set(f.m_set) { operator=(f); } CLOAK_CALL Face(In const PointSet& set, In size_t p1, In size_t p2, In size_t p3) : m_set(&set) { m_points[0] = p1; m_points[1] = p2; m_points[2] = p3; m_plane = CloakEngine::Global::Math::Plane(set[p1], set[p2], set[p3]); m_enabled = true; } bool CLOAK_CALL_THIS UsesSameSet(In const Face& f) const { return m_set == f.m_set; } Face& CLOAK_CALL_THIS operator=(In const Face& f) { for (size_t a = 0; a < 3; a++) { m_points[a] = f.m_points[a]; } m_plane = f.m_plane; m_enabled = f.m_enabled; return *this; } const CloakEngine::Global::Math::Vector& CLOAK_CALL_THIS GetPoint(In size_t a) const { return m_set->at(m_points[a]); } size_t CLOAK_CALL_THIS GetPointIndex(In size_t a) const { return m_points[a]; } const CloakEngine::Global::Math::Vector& CLOAK_CALL_THIS GetNormal() const { return m_plane.GetNormal(); } void CLOAK_CALL_THIS SetPoints(In size_t p1, In size_t p2, In size_t p3) { m_points[0] = p1; m_points[1] = p2; m_points[2] = p3; m_plane = CloakEngine::Global::Math::Plane(m_set->at(p1), m_set->at(p2), m_set->at(p3)); } void CLOAK_CALL_THIS CheckWinding(In const CloakEngine::Global::Math::Vector& target) { if (m_plane.SignedDistance(target) > 0) { SetPoints(m_points[2], m_points[1], m_points[0]); } } float CLOAK_CALL_THIS SignedDistance(In const CloakEngine::Global::Math::Vector& point) const { return m_plane.SignedDistance(point); } bool CLOAK_CALL_THIS IsEnabled() const { return m_enabled; } void CLOAK_CALL_THIS Disable() { m_enabled = false; } }; inline void CLOAK_CALL BuildHullFromFaces(In const CloakEngine::List<Face>& faces, Out Hull* hull) { CE::List<CE::Global::Math::Vector> points; CE::HashMap<size_t, size_t> pToP; for (size_t a = 0; a < faces.size(); a++) { CLOAK_ASSUME(a == 0 || faces[a - 1].UsesSameSet(faces[a])); if (faces[a].IsEnabled()) { for (size_t b = 0; b < 3; b++) { if (pToP.find(faces[a].GetPointIndex(b)) == pToP.end()) { points.push_back(faces[a].GetPoint(b)); pToP[faces[a].GetPointIndex(b)] = points.size() - 1; } } } } HullPolygon* polygons = NewArray(HullPolygon,faces.size()); size_t polyCount = 0; for (size_t a = 0; a < faces.size(); a++) { if (faces[a].IsEnabled()) { for (size_t b = 0; b < 3; b++) { polygons[polyCount].Vertex[b] = pToP[faces[a].GetPointIndex(b)]; } polyCount++; } } hull->Recreate(points, polygons, polyCount); DeleteArray(polygons); } inline float CLOAK_CALL PerfDot(In const Point2D& o, In const Point2D& a, In const Point2D& b) { const std::pair<double, double> od = std::make_pair(static_cast<double>(o.X), static_cast<double>(o.Y)); const std::pair<double, double> ad = std::make_pair(static_cast<double>(a.X), static_cast<double>(a.Y)); const std::pair<double, double> bd = std::make_pair(static_cast<double>(b.X), static_cast<double>(b.Y)); return static_cast<float>(((ad.first - od.first) * (bd.second - od.second)) - ((ad.second - od.second) * (bd.first - od.first))); } inline float CLOAK_CALL DistSq(In const Point2D& a, In const Point2D& b) { const float dx = a.X - b.X; const float dy = a.Y - b.Y; return (dx*dx) + (dy*dy); } bool CLOAK_CALL IsClockwiseOriented(In const Point2D& a, In const Point2D& b, In const Point2D& c) { return PerfDot(a, b, c) <= 0.0f; } bool CLOAK_CALL IsCounterClockwiseOriented(In const Point2D& a, In const Point2D& b, In const Point2D& c) { return PerfDot(a, b, c) >= 0.0f; } void CLOAK_CALL CalculateConvexHull2D(In const CloakEngine::Global::Math::Vector* points, In size_t size, Out Hull* hull) { //Common face normal: CE::Global::Math::Vector cn = CE::Global::Math::Vector::Zero; for (size_t a = 2; a < size; a++) { CE::Global::Math::Vector n = (points[a] - points[a - 2]).Cross(points[a] - points[a - 1]); if (n.Length() > 0) { n = n.Normalize(); if (cn.Dot(n) >= 0) { cn += n; } else { cn -= n; } cn = cn.Normalize(); } } //Transform all 3D points to 2D points in that basis: const std::pair<CE::Global::Math::Vector, CE::Global::Math::Vector> basis = cn.GetOrthographicBasis(); CE::List<Point2D> pts2D(size); for (size_t a = 0; a < size; a++) { pts2D[a] = Point2D(basis.first.Dot(points[a]), basis.second.Dot(points[a]), a); } const size_t h = CalculateConvexHull2DInPlace(pts2D.data(), pts2D.size()); //Build hull: CE::List<HullPolygon> polygons; CE::List<CE::Global::Math::Vector> p(h + 1); for (size_t a = 0; a < h + 1; a++) { p[a] = points[pts2D[a].Vertex]; } size_t i[2]; HullPolygon cp; cp.Vertex[0] = 0; cp.Vertex[1] = 1; i[0] = 2; i[1] = h; do { cp.Vertex[2] = i[0]++; polygons.push_back(cp); std::swap(cp.Vertex[1], cp.Vertex[2]); polygons.push_back(cp); if (i[0] != i[1]) { cp.Vertex[2] = i[1]--; polygons.push_back(cp); std::swap(cp.Vertex[0], cp.Vertex[2]); polygons.push_back(cp); } } while (i[0] != i[1]); hull->Recreate(p, polygons.data(), polygons.size()); } size_t CLOAK_CALL CalculateConvexHull2DInPlace(In Point2D* points, In size_t size) { // See https://github.com/juj/MathGeoLib/blob/master/src/Math/float2.inl CE::List<Point2D> hullPts(2 * size); //Sort and filter points: std::sort(&points[0], &points[size], [](In const Point2D& a, In const Point2D& b) {return a.X < b.X || (a.X == b.X && a.Y < b.Y); }); hullPts[0] = points[0]; hullPts[1] = points[1]; size_t k = 2; //Construct upper hull part: for (size_t a = 2; a < size; a++) { while (k >= 2 && IsCounterClockwiseOriented(hullPts[k - 2], hullPts[k - 1], points[a]) == false) { k--; } hullPts[k++] = points[a]; } //Construct lower hull part: const size_t start = k; for (size_t a = size - 2; a > 0; a--) { while (k > start && IsCounterClockwiseOriented(hullPts[k - 2], hullPts[k - 1], points[a]) == false) { k--; } hullPts[k++] = points[a]; } //The first point is allways part of the convex hull, but we don't want it twice in the array. Since we still need //to filter with the last (=first) point, we do this outside of the above loop: while (k > start && IsCounterClockwiseOriented(hullPts[k - 2], hullPts[k - 1], points[0]) == false) { k--; } //Remove duplicate entries: size_t h = 0; points[0] = hullPts[0]; for (size_t a = 1; a < k; a++) { if (DistSq(hullPts[a], points[h]) > EPSILON_FS) { points[++h] = hullPts[a]; } } while (DistSq(points[h], points[0]) < EPSILON_FS && h > 0) { h--; } //The first 'h+1' points in pts2D are now the vertices of the convex hull in counter-clockwise order return h + 1; } //See https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polyhedron.cpp void CLOAK_CALL CalculateSingleConvexHull(In const CloakEngine::Global::Math::Vector* points, In size_t size, Out Hull* hull) { CLOAK_ASSUME(size >= 3); hull->Recreate(); PointSet set(points, size); CLOAK_ASSUME(set.size() >= 3); CE::List<Face> faces; CE::FlatSet<size_t> extremes; CE::HashMap<Edge, EdgeToFace, EdgeHash> edgesToFaces; //Find most extremest points in all given directions: for (size_t a = 0; a < ARRAYSIZE(HULL_DIRECTIONS); a++) { size_t i = 0; float md = -std::numeric_limits<float>::infinity(); for (size_t b = 0; b < set.size(); b++) { const float d = HULL_DIRECTIONS[a].Dot(set[b]); if (d >= md) { md = d; i = b; } } extremes.insert(i); } if (extremes.size() < 3) { return; } //some points are NaN or duplicates //Degenerate case (volume in given directions is zero): if (extremes.size() == 3) { size_t v[3]; size_t vi = 0; for (auto i : extremes) { v[vi++] = i; } CLOAK_ASSUME(vi == 3); CE::Global::Math::Plane p(set[v[0]], set[v[1]], set[v[2]]); for (size_t a = 0; a < set.size(); a++) { if (CE::Global::Math::abs(p.SignedDistance(set[a])) > EPSILON_F) { extremes.insert(a); if (extremes.size() >= 4) { break; } } } //Input is truely planar: if (extremes.size() == 3) { faces.push_back(Face(set, v[0], v[1], v[2])); faces.push_back(Face(set, v[2], v[1], v[0])); BuildHullFromFaces(faces, hull); return; } } //Swap the four extrem points to the start of the set: size_t vi = 0; for (auto i : extremes) { set.swap(vi++, i); } //As we may got more then 4 extremes, choose the one that build the largest volume as start points: float maxVolume = 0; size_t bestStart[4]; for (size_t a = 0; a + 3 < vi;a++) { const CE::Global::Math::Vector pa = set[a]; for (size_t b = a + 1; b + 2 < vi; b++) { const CE::Global::Math::Vector pb = set[b]; for (size_t c = b + 1; c + 1 < vi; c++) { const CE::Global::Math::Vector pc = set[c]; for (size_t d = c + 1; d < vi; d++) { const CE::Global::Math::Vector pd = set[d]; const float volume = CE::Global::Math::abs((pa - pd).Dot((pb - pd).Cross(pc - pd))); if (volume > maxVolume) { maxVolume = volume; bestStart[0] = a; bestStart[1] = b; bestStart[2] = c; bestStart[3] = d; } } } } } if (maxVolume < 1e-6f)// Set is planar: { CalculateConvexHull2D(points, size, hull); return; } //Swap the four choosen start points to the start of the set: for (size_t a = 0; a < ARRAYSIZE(bestStart); a++) { set.swap(a, bestStart[a]); } //Create tetrahedon (simplex): faces.push_back(Face(set, 0, 1, 2)); faces.push_back(Face(set, 3, 1, 0)); faces.push_back(Face(set, 0, 2, 3)); faces.push_back(Face(set, 3, 2, 1)); for (size_t a = 0; a < faces.size(); a++) { faces[a].CheckWinding(set[3 - a]); } //Calculate Half-Edges' face relation: for (size_t a = 0; a < faces.size(); a++) { const Face& f = faces[a]; size_t vl = f.GetPointIndex(2); for (size_t b = 0; b < 3; b++) { const size_t vn = f.GetPointIndex(b); edgesToFaces[Edge(vl, vn)] = a; vl = vn; } } //For each face, maintain a list of conflicting vertices. A vertex conflicts with a face if that vertex is on the positive side of that face, //so that this face cannot be part of the final convex hull CE::List<CE::List<size_t>> faceConflicts(faces.size()); //For each vertex, maintain a list of conflicting faces. This is the inverse of the fanceConflicts lists CE::List<CE::Set<size_t>> vertexConflicts(set.size()); //Assign all remaining vertices to the conflict lists: for (size_t a = 0; a < faces.size(); a++) { for (size_t b = 0; b < set.size(); b++) { if (faces[a].SignedDistance(set[b]) > EPSILON_F) { faceConflicts[a].push_back(b); vertexConflicts[b].insert(a); } } } CE::List<size_t> stack; //Stack of conflicting faces. We are dequeuing in random order, so can't be an actual stack data structure for (size_t a = 0; a < faceConflicts.size(); a++) { if (faceConflicts[a].empty() == false) { stack.push_back(a); } } CE::Set<size_t> conflicting; //Set of conflicting vertices CE::List<Edge> boundary; //Boundary edges of "hole" that's created by removing conflicting faces CE::Stack<size_t> visitFaceStack; CE::List<bool> hullVertices(4, true); CE::List<uint64_t> floodFillVisited(faces.size(), 0); uint64_t floodFillCounter = 1; std::random_device rd; std::default_random_engine re(rd()); while (stack.empty() == false) { //Choose random plane to prevent worst case scenarios: std::uniform_int_distribution<size_t> dist(0, stack.size() - 1); size_t rfid = dist(re); const size_t f = stack[rfid]; stack[rfid] = stack.back(); stack.pop_back(); auto& fcon = faceConflicts.at(f); //List of all vertices that conflicts with face 'f' if (fcon.empty()) { continue; } const Face& face = faces[f]; //Find most extreme conflicting vertex of that face: float ed = -std::numeric_limits<float>::infinity(); size_t eci = fcon.size(); // Index in fcon list size_t ei = set.size(); // index in point set for (size_t a = 0; a < fcon.size(); a++) { const size_t vt = fcon[a]; if (vt < hullVertices.size() && hullVertices[vt] == true) { continue; } //Vertex is already on hull const float d = face.SignedDistance(set[vt]); if (d > EPSILON_F) { ed = d; eci = a; ei = vt; } } //No point found, so nothing is in conflict: if (eci == fcon.size()) { fcon.clear(); continue; } CLOAK_ASSUME(ei < set.size()); CLOAK_ASSUME(eci < fcon.size()); //Remove most extreme conflicting vertex, as that vertex will become part of the hull: fcon[eci] = fcon.back(); fcon.pop_back(); if (ed <= EPSILON_F) { continue; } //Point is on face. Shouldn't ever happen auto& vcon = vertexConflicts[ei]; //List of all faces that conflicts with vertex 'ei' floodFillVisited[f] = floodFillCounter; visitFaceStack.push(f); for (auto a : vcon) { if (a != f) { visitFaceStack.push(a); floodFillVisited[a] = floodFillCounter; } } //Resolve all conflicting faces: while (visitFaceStack.empty() == false) { const size_t fi = visitFaceStack.top(); visitFaceStack.pop(); //Move list of conflicting vertices of that face into conflicting set: conflicting.insert(faceConflicts[fi].begin(), faceConflicts[fi].end()); faceConflicts[fi].clear(); Face& pf = faces[fi]; if (pf.IsEnabled() == false) { continue; } size_t vl = pf.GetPointIndex(2); for (size_t a = 0; a < 3; a++) { const size_t vn = pf.GetPointIndex(a); const EdgeToFace etf = edgesToFaces[Edge(vn, vl)]; if (etf.Enabled == false || faces[etf.Face].IsEnabled() == false || floodFillVisited[etf.Face] == floodFillCounter) { //Face has already been processed in some way vl = vn; continue; } if (vcon.find(etf.Face) != vcon.end() || faces[etf.Face].SignedDistance(set[ei]) > EPSILON_F) { if (floodFillVisited[etf.Face] != floodFillCounter) { visitFaceStack.push(etf.Face); floodFillVisited[etf.Face] = floodFillCounter; } } else { boundary.push_back(Edge(vl, vn)); } edgesToFaces[Edge(vl, vn)].Enabled = false; //Mark face as deleted vl = vn; } pf.Disable(); } CLOAK_ASSUME(boundary.size() >= 3); floodFillCounter++; //Clean up removed faces: for (auto a : conflicting) { if (a != ei) { for (auto b : vcon) { auto i = vertexConflicts[a].find(b); if (i != vertexConflicts[a].end()) { vertexConflicts[a].erase(i); } } } } vcon.clear(); //Fix boundary order: for (size_t a = 0; a < boundary.size(); a++) { for (size_t b = a + 1; b < boundary.size(); b++) { if (boundary[a].second() == boundary[b].first()) { std::swap(boundary[a + 1], boundary[b]); break; } } } #ifdef _DEBUG //Check boundary: { Edge el = boundary.back(); for (size_t a = 0; a < boundary.size(); a++) { if (el.second() != boundary[a].first()) { CLOAK_ASSUME(false); return; } el = boundary[a]; } } #endif //Add new faces to hull: const size_t ofc = faces.size(); for (size_t a = 0; a < boundary.size(); a++) { const Edge& e = boundary[a]; faces.push_back(Face(set, e.first(), e.second(), ei)); edgesToFaces[e] = faces.size() - 1; edgesToFaces[Edge(e.second(), ei)] = faces.size() - 1; edgesToFaces[Edge(ei, e.first())] = faces.size() - 1; } boundary.clear(); //Flag new vertex (with index 'ei') as part of the hull: if (hullVertices.size() <= ei) { //Add missing entries: hullVertices.insert(hullVertices.end(), ei + 1 - hullVertices.size(), false); } hullVertices[ei] = true; //Redistribute conflicting points to new faces: faceConflicts.insert(faceConflicts.end(), faces.size() - ofc, CE::List<size_t>()); floodFillVisited.insert(floodFillVisited.end(), faces.size() - ofc, 0); for (auto a : conflicting) { for (size_t b = ofc; b < faces.size(); b++) { if (faces[b].SignedDistance(set[a]) > EPSILON_F) { faceConflicts[b].push_back(a); vertexConflicts[a].insert(b); } } } conflicting.clear(); //Add new faces with conflicts to working stack: for (size_t b = ofc; b < faces.size(); b++) { if (faceConflicts[b].empty() == false) { stack.push_back(b); } } } //Finish hull: BuildHullFromFaces(faces, hull); #ifdef _DEBUG //Check if hull is truely convex: for (size_t a = 0; a < size; a++) { for (size_t b = 0; b < hull->GetFaceCount(); b++) { CLOAK_ASSUME(hull->GetPlane(b).SignedDistance(points[a]) <= EPSILON_F); } } #endif } CLOAK_CALL Hull::Hull() { m_flat = false; } CLOAK_CALL Hull::~Hull() { } void CLOAK_CALL_THIS Hull::Recreate(In const CloakEngine::List<CloakEngine::Global::Math::Vector>& points, In_reads(faceCount) const HullPolygon* faces, In size_t faceCount) { m_flat = false; m_vertices = points; m_faces.resize(faceCount); for (size_t a = 0; a < faceCount; a++) { m_faces[a] = faces[a]; } if (m_faces.size() > 0) { m_flat = true; const CloakEngine::Global::Math::Vector n = GetPlane(0).GetNormal(); for (size_t a = 1; a < m_faces.size() && m_flat == true; a++) { const CloakEngine::Global::Math::Vector m = GetPlane(a).GetNormal(); const float d = n.Dot(m); if (abs(d) < 1 - EPSILON_F) { m_flat = false; } } } } void CLOAK_CALL_THIS Hull::Recreate() { m_faces.clear(); m_vertices.clear(); m_flat = false; } size_t CLOAK_CALL_THIS Hull::GetFaceCount() const { return m_faces.size(); } size_t CLOAK_CALL_THIS Hull::GetVertexCount() const { return m_vertices.size(); } size_t CLOAK_CALL_THIS Hull::GetVertexID(In size_t polygon, In In_range(0, 2) size_t vertex) const { CLOAK_ASSUME(polygon < m_faces.size()); CLOAK_ASSUME(vertex < 3); return m_faces[polygon].Vertex[vertex]; } const CloakEngine::Global::Math::Vector& CLOAK_CALL_THIS Hull::GetVertex(In size_t v) const { CLOAK_ASSUME(v < m_vertices.size()); return m_vertices[v]; } const CloakEngine::Global::Math::Vector& CLOAK_CALL_THIS Hull::GetVertex(In size_t polygon, In In_range(0, 2) size_t vertex) const { return GetVertex(GetVertexID(polygon, vertex)); } const CloakEngine::Global::Math::Vector* CLOAK_CALL_THIS Hull::GetVertexData() const { return m_vertices.data(); } const HullPolygon& CLOAK_CALL_THIS Hull::GetFace(In size_t polygon) const { CLOAK_ASSUME(polygon < m_faces.size()); return m_faces[polygon]; } CloakEngine::Global::Math::Plane CLOAK_CALL_THIS Hull::GetPlane(In size_t polygon) const { return CloakEngine::Global::Math::Plane(GetVertex(polygon, 0), GetVertex(polygon, 1), GetVertex(polygon, 2)); } bool CLOAK_CALL_THIS Hull::IsFlat() const { return m_flat; } } } }
lechium/iPhoneOS_12.1.1_Headers
System/Library/PrivateFrameworks/UserNotificationsUIKit.framework/NCNotificationListLegibilityLabelCache.h
<gh_stars>10-100 /* * This header is generated by classdump-dyld 1.0 * on Saturday, June 1, 2019 at 6:52:02 PM Mountain Standard Time * Operating System: Version 12.1.1 (Build 16C5050a) * Image Source: /System/Library/PrivateFrameworks/UserNotificationsUIKit.framework/UserNotificationsUIKit * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by <NAME>. */ @class NSMutableDictionary; @interface NCNotificationListLegibilityLabelCache : NSObject { NSMutableDictionary* _sectionHeaderViewLegibilityLabelDictionary; } @property (nonatomic,retain) NSMutableDictionary * sectionHeaderViewLegibilityLabelDictionary; //@synthesize sectionHeaderViewLegibilityLabelDictionary=_sectionHeaderViewLegibilityLabelDictionary - In the implementation block +(id)sharedInstance; -(void)clearAll; -(NSMutableDictionary *)sectionHeaderViewLegibilityLabelDictionary; -(id)_stringDescriptorForFont:(id)arg1 ; -(id)_createLegibilityLabelWithTitle:(id)arg1 font:(id)arg2 ; -(id)legibilityLabelForTitle:(id)arg1 forSuperview:(id)arg2 font:(id)arg3 ; -(void)setSectionHeaderViewLegibilityLabelDictionary:(NSMutableDictionary *)arg1 ; -(id)init; @end
Freak-Lew/Freak-Lew.github.io
bundler-v0.4-source/lib/cminpack/minpack.h
/* minpack.h * * This is a C version of the minpack minimization package. * It has been derived from the fortran code using f2c. * See http://www.netlib.org/minpack/ for more information. * Minpack was developed by <NAME>', <NAME>, and * <NAME> at Argonne National Laboratory * Converted to C by <NAME>, July 2002 * */ #ifndef __MINPACK_H #define __MINPACK_H #define __CMINPACK_VERSION "1.0" #include <f2c.h> #ifdef __cplusplus extern "C" { #endif /* automatically generated declarations using cproto */ /* chkder.c */ int chkder_(integer *m, integer *n, doublereal *x, doublereal *fvec, doublereal *fjac, integer *ldfjac, doublereal *xp, doublereal *fvecp, integer *mode, doublereal *err); /* dogleg.c */ int dogleg_(integer *n, doublereal *r__, integer *lr, doublereal *diag, doublereal *qtb, doublereal *delta, doublereal *x, doublereal *wa1, doublereal *wa2); /* dpmpar.c */ doublereal dpmpar_(integer *i__); /* enorm.c */ doublereal enorm_(integer *n, doublereal *x); /* fdjac1.c */ int fdjac1_(S_fp fcn, integer *n, doublereal *x, doublereal *fvec, doublereal *fjac, integer *ldfjac, integer *iflag, integer *ml, integer *mu, doublereal *epsfcn, doublereal *wa1, doublereal *wa2); /* fdjac2.c */ int fdjac2_(S_fp fcn, integer *m, integer *n, doublereal *x, doublereal *fvec, doublereal *fjac, integer *ldfjac, integer *iflag, doublereal *epsfcn, doublereal *wa); /* hybrd1.c */ int hybrd1_(U_fp fcn, integer *n, doublereal *x, doublereal *fvec, doublereal *tol, integer *info, doublereal *wa, integer *lwa); /* hybrd.c */ int hybrd_(S_fp fcn, integer *n, doublereal *x, doublereal *fvec, doublereal *xtol, integer *maxfev, integer *ml, integer *mu, doublereal *epsfcn, doublereal *diag, integer *mode, doublereal *factor, integer *nprint, integer *info, integer *nfev, doublereal *fjac, integer *ldfjac, doublereal *r__, integer *lr, doublereal *qtf, doublereal *wa1, doublereal *wa2, doublereal *wa3, doublereal *wa4); /* hybrj1.c */ int hybrj1_(U_fp fcn, integer *n, doublereal *x, doublereal *fvec, doublereal *fjac, integer *ldfjac, doublereal *tol, integer *info, doublereal *wa, integer *lwa); /* hybrj.c */ int hybrj_(S_fp fcn, integer *n, doublereal *x, doublereal *fvec, doublereal *fjac, integer *ldfjac, doublereal *xtol, integer *maxfev, doublereal *diag, integer *mode, doublereal *factor, integer *nprint, integer *info, integer *nfev, integer *njev, doublereal *r__, integer *lr, doublereal *qtf, doublereal *wa1, doublereal *wa2, doublereal *wa3, doublereal *wa4); /* lmder1.c */ int lmder1_(U_fp fcn, integer *m, integer *n, doublereal *x, doublereal *fvec, doublereal *fjac, integer *ldfjac, doublereal *tol, integer *info, integer *ipvt, doublereal *wa, integer *lwa); /* lmder.c */ int lmder_(S_fp fcn, integer *m, integer *n, doublereal *x, doublereal *fvec, doublereal *fjac, integer *ldfjac, doublereal *ftol, doublereal *xtol, doublereal *gtol, integer *maxfev, doublereal *diag, integer *mode, doublereal *factor, integer *nprint, integer *info, integer *nfev, integer *njev, integer *ipvt, doublereal *qtf, doublereal *wa1, doublereal *wa2, doublereal *wa3, doublereal *wa4); /* lmdif1.c */ int lmdif1_(U_fp fcn, integer *m, integer *n, doublereal *x, doublereal *fvec, doublereal *tol, integer *info, integer *iwa, doublereal *wa, integer *lwa); /* lmdif.c */ int lmdif_(S_fp fcn, integer *m, integer *n, doublereal *x, doublereal *fvec, doublereal *ftol, doublereal *xtol, doublereal *gtol, integer *maxfev, doublereal *epsfcn, doublereal *diag, integer *mode, doublereal *factor, integer *nprint, integer *info, integer *nfev, doublereal *fjac, integer *ldfjac, integer *ipvt, doublereal *qtf, doublereal *wa1, doublereal *wa2, doublereal *wa3, doublereal *wa4); /* lmpar.c */ int lmpar_(integer *n, doublereal *r__, integer *ldr, integer *ipvt, doublereal *diag, doublereal *qtb, doublereal *delta, doublereal *par, doublereal *x, doublereal *sdiag, doublereal *wa1, doublereal *wa2); /* lmstr1.c */ int lmstr1_(U_fp fcn, integer *m, integer *n, doublereal *x, doublereal *fvec, doublereal *fjac, integer *ldfjac, doublereal *tol, integer *info, integer *ipvt, doublereal *wa, integer *lwa); /* lmstr.c */ int lmstr_(S_fp fcn, integer *m, integer *n, doublereal *x, doublereal *fvec, doublereal *fjac, integer *ldfjac, doublereal *ftol, doublereal *xtol, doublereal *gtol, integer *maxfev, doublereal *diag, integer *mode, doublereal *factor, integer *nprint, integer *info, integer *nfev, integer *njev, integer *ipvt, doublereal *qtf, doublereal *wa1, doublereal *wa2, doublereal *wa3, doublereal *wa4); /* qform.c */ int qform_(integer *m, integer *n, doublereal *q, integer *ldq, doublereal *wa); /* qrfac.c */ int qrfac_(integer *m, integer *n, doublereal *a, integer *lda, logical *pivot, integer *ipvt, integer *lipvt, doublereal *rdiag, doublereal *acnorm, doublereal *wa); /* qrsolv.c */ int qrsolv_(integer *n, doublereal *r__, integer *ldr, integer *ipvt, doublereal *diag, doublereal *qtb, doublereal *x, doublereal *sdiag, doublereal *wa); /* r1mpyq.c */ int r1mpyq_(integer *m, integer *n, doublereal *a, integer *lda, doublereal *v, doublereal *w); /* r1updt.c */ int r1updt_(integer *m, integer *n, doublereal *s, integer *ls, doublereal *u, doublereal *v, doublereal *w, logical *sing); /* rwupdt.c */ int rwupdt_(integer *n, doublereal *r__, integer *ldr, doublereal *w, doublereal *b, doublereal *alpha, doublereal *cos__, doublereal *sin__); #ifdef __cplusplus }; /* end of extern "C" */ #endif #endif /* __MINPACK_H */
Googulator/TextClassification
src/main/java/com/digitalpebble/classification/MultiFieldDocument.java
/** * Copyright 2009 DigitalPebble Ltd * * 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. */ package com.digitalpebble.classification; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; import java.util.Map.Entry; import java.util.regex.Pattern; import com.digitalpebble.classification.Parameters.WeightingMethod; public class MultiFieldDocument implements Document { int label = 0; int[] indices; int[] freqs; // keep a link between a field index and its field num int[] indexToField; double[] tokensPerField; private static final Pattern SPACE_PATTERN = Pattern.compile("\\s+"); private MultiFieldDocument() { } /*************************************************************************** * A document is built from an array of Fields, with a reference to a * lexicon **************************************************************************/ MultiFieldDocument(Field[] fields, Lexicon lexicon, boolean create) { // missing a know field? int maxFieldLength = Math .max(lexicon.getFields().length, fields.length); tokensPerField = new double[maxFieldLength]; // create a vector for this document // from the individual tokens TreeMap<TokenField, int[]> tokens = new TreeMap<TokenField, int[]>(); for (Field f : fields) { // get the field num from the lexicon final int fieldNum = lexicon.getFieldID(f._name, create); // field does not exist if (fieldNum == -1) continue; for (int token = 0; token < f._tokens.length; token++) { // remove null strings or empty strings if (f._tokens[token] == null) continue; if (f._tokens[token].length() < 1) continue; String normToken = simpleNormalisationTokenString(f._tokens[token]); // add a new instance to the count tokensPerField[fieldNum]++; String label = f._name + "_" + normToken; TokenField tf = new TokenField(label, fieldNum); int[] count = (int[]) tokens.get(tf); if (count == null) { count = new int[] { 0 }; tokens.put(tf, count); } count[0]++; } } indices = new int[tokens.size()]; freqs = new int[tokens.size()]; indexToField = new int[tokens.size()]; int lastused = 0; // iterates on the internal vector Iterator<Entry<TokenField, int[]>> iter = tokens.entrySet().iterator(); while (iter.hasNext()) { Entry<TokenField, int[]> entry = iter.next(); TokenField key = entry.getKey(); int[] localFreq = entry.getValue(); // gets the index from the lexicon int index = -1; if (create) { index = lexicon.createIndex(key.value); } else { index = lexicon.getIndex(key.value); } // if not found in the lexicon // we'll just put a conventional value // which will help filtering it later if (index == -1) { index = Integer.MAX_VALUE; } // add it to the list indices[lastused] = index; freqs[lastused] = localFreq[0]; indexToField[lastused] = key.field; lastused++; } // at this stage all the tokens are linked // to their indices in the lexicon // and we have their raw frequency in the document // sort the content of the vector quicksort(indices, freqs, indexToField, 0, indices.length - 1); } /** * Returns the label of the document. The String value of the label can be * accessed via the Lexicon object.* */ public int getLabel() { return label; } // the label is now set by the lexicon // and not directly by the user code void setLabel(int lab) { label = lab; } public String getStringSerialization() { StringBuffer buffer = new StringBuffer(); buffer.append(this.getClass().getSimpleName()).append("\t"); buffer.append(this.label); buffer.append("\t").append(tokensPerField.length); for (double tokperf : tokensPerField) { buffer.append("\t").append(tokperf); } for (int i = 0; i < indices.length; i++) { buffer.append("\t").append(indices[i]).append(":").append(freqs[i]) .append(":").append(this.indexToField[i]); } buffer.append("\n"); return buffer.toString(); } // get a String representation of the document // but limiting it to a subset of its fields public String getStringSerialization(int[] fieldToKeep) { if (fieldToKeep == null || fieldToKeep.length == 0) return getStringSerialization(); StringBuffer buffer = new StringBuffer(); buffer.append(this.getClass().getSimpleName()).append("\t"); buffer.append(this.label); buffer.append("\t").append(tokensPerField.length); for (int fieldNum = 0; fieldNum < tokensPerField.length; fieldNum++) { double tokperf = tokensPerField[fieldNum]; if (java.util.Arrays.binarySearch(fieldToKeep, fieldNum) != -1) buffer.append("\t").append(tokperf); else buffer.append("\t").append("0.0"); } for (int i = 0; i < indices.length; i++) { int fieldNum = this.indexToField[i]; if (java.util.Arrays.binarySearch(fieldToKeep, fieldNum) != -1) buffer.append("\t").append(indices[i]).append(":").append( freqs[i]).append(":").append(this.indexToField[i]); } buffer.append("\n"); return buffer.toString(); } public static Document parse(String line) { String[] splits = line.split("\t"); if (splits.length < 4) return null; // ignore first part MultiFieldDocument newdoc = new MultiFieldDocument(); try { newdoc.label = Integer.parseInt(splits[1]); int numFields = Integer.parseInt(splits[2]); newdoc.tokensPerField = new double[numFields]; int currentPos = 3; for (int i = 0; i < numFields; i++) { String sizeField = splits[currentPos]; newdoc.tokensPerField[i] = Double.parseDouble(sizeField); currentPos++; } // num features int numfeatures = splits.length - currentPos; newdoc.freqs = new int[numfeatures]; newdoc.indices = new int[numfeatures]; newdoc.indexToField = new int[numfeatures]; int lastPos = 0; for (; currentPos < splits.length; currentPos++) { // x:y:z String[] subsplits = splits[currentPos].split(":"); newdoc.indices[lastPos] = Integer.parseInt(subsplits[0]); newdoc.freqs[lastPos] = Integer.parseInt(subsplits[1]); newdoc.indexToField[lastPos] = Integer.parseInt(subsplits[2]); lastPos++; } } catch (Exception e) { return null; } return newdoc; } /** * Returns a Vector representation of the document. This Vector object is * weighted and used by the instances of Learner or TextClassifier */ public Vector getFeatureVector(Lexicon lexicon) { Parameters.WeightingMethod method = lexicon.getMethod(); return getFeatureVector(lexicon, method, null); } public Vector getFeatureVector(Lexicon lexicon, Parameters.WeightingMethod method) { return getFeatureVector(lexicon, method, null); } public Vector getFeatureVector(Lexicon lexicon, Map<Integer, Integer> equiv) { Parameters.WeightingMethod method = lexicon.getMethod(); return getFeatureVector(lexicon, method, equiv); } public Vector getFeatureVector(Lexicon lexicon, Parameters.WeightingMethod method, Map<Integer, Integer> equiv) { // we need to iterate on the features // of this document and compute a score double numDocs = (double) lexicon.getDocNum(); // have the attribute numbers been changed in // the meantime? if (equiv != null) { for (int pos = 0; pos < indices.length; pos++) { Integer newPos = equiv.get(indices[pos]); // filtered if (newPos == null) indices[pos] = Integer.MAX_VALUE; else indices[pos] = newPos.intValue(); } // resort the indices quicksort(indices, freqs, indexToField, 0, indices.length - 1); } int kept = 0; double[] copyvalues = new double[indices.length]; for (int pos = 0; pos < indices.length; pos++) { // need to check that a given term has not // been filtered since the creation of the corpus // the indices are sorted so we know there is no point // in going further // Integer.MAX_VALUE == unknown in model if (indices[pos] == Integer.MAX_VALUE) { break; } if (lexicon.getDocFreq(indices[pos]) <= 0) continue; double score = getScore(pos, lexicon, numDocs); // removed in meantime? if (score == 0) continue; copyvalues[pos] = score; kept++; } // trim to size int[] trimmedindices = new int[kept]; double[] trimmedvalues = new double[kept]; // normalize the values? if (lexicon.isNormalizeVector()) normalizeL2(trimmedvalues); System.arraycopy(indices, 0, trimmedindices, 0, kept); System.arraycopy(copyvalues, 0, trimmedvalues, 0, kept); return new Vector(trimmedindices, trimmedvalues); } /** * Returns the score of an attribute given the weighting scheme specified in * the lexicon or for a specific field **/ private double getScore(int pos, Lexicon lexicon, double numdocs) { double score = 0; int indexTerm = this.indices[pos]; double occurences = (double) this.freqs[pos]; int fieldNum = this.indexToField[pos]; double frequency = occurences / tokensPerField[fieldNum]; // is there a custom weight for this field? String fieldName = lexicon.getFields()[fieldNum]; WeightingMethod method = lexicon.getMethod(fieldName); if (method.equals(Parameters.WeightingMethod.BOOLEAN)) { score = 1; } else if (method.equals(Parameters.WeightingMethod.OCCURRENCES)) { score = occurences; } else if (method.equals(Parameters.WeightingMethod.FREQUENCY)) { score = frequency; } else if (method.equals(Parameters.WeightingMethod.TFIDF)) { int df = lexicon.getDocFreq(indexTerm); double idf = numdocs / (double) df; score = frequency * Math.log(idf); if (idf == 1) score = frequency; } return score; } /** * Returns the L2 norm factor of this vector's values. */ private void normalizeL2(double[] scores) { double square_sum = 0.0; for (int i = 0; i < scores.length; i++) { square_sum += (scores[i] * scores[i]); } double norm = Math.sqrt(square_sum); if (norm != 0) for (int i = 0; i < scores.length; i++) { scores[i] = scores[i] / norm; } } private int partition(int[] dims, int[] vals, int[] vals2, int low, int high) { double pivotprim = 0; int i = low - 1; int j = high + 1; pivotprim = dims[(low + high) / 2]; while (i < j) { i++; while (dims[i] < pivotprim) i++; j--; while (dims[j] > pivotprim) j--; if (i < j) { int tmp = dims[i]; dims[i] = dims[j]; dims[j] = tmp; int tmpd = vals[i]; vals[i] = vals[j]; vals[j] = tmpd; int t2mpd = vals2[i]; vals2[i] = vals2[j]; vals2[j] = t2mpd; } } return j; } private void quicksort(int[] dims, int[] vals, int[] vals2, int low, int high) { if (low >= high) return; int p = partition(dims, vals, vals2, low, high); quicksort(dims, vals, vals2, low, p); quicksort(dims, vals, vals2, p + 1, high); } class TokenField implements Comparable<TokenField> { int field; String value; TokenField(String val, int fieldNum) { field = fieldNum; value = val; } public int compareTo(TokenField tf) { return value.compareTo(tf.value); } } /** * this is done to make sure that the lexicon file will be read properly and * won't contain any characters that would break it **/ private static String simpleNormalisationTokenString(String token) { return SPACE_PATTERN.matcher(token).replaceAll("_"); } }
kawakicchi/developer-tools
src/main/java/com/github/kawakicchi/developer/tools/rakrak/analyze/entity/MSGEntity.java
package com.github.kawakicchi.developer.tools.rakrak.analyze.entity; public class MSGEntity { private String id; private String mode; private String lang; private String value; public void setId(final String id) { this.id = id; } public String getId() { return id; } public void setMode(final String mode) { this.mode = mode; } public String getMode() { return mode; } public void setLang(final String lang) { this.lang = lang; } public String getLang() { return lang; } public void setValue(final String value) { this.value = value; } public String getValue() { return value; } public String toString() { String ls = "\n"; try { ls = System.getProperty("line.separator"); } catch (SecurityException e) { } StringBuilder s = new StringBuilder(); s.append(String.format("MSG : %s", value)).append(ls); s.append(String.format(" ID : %s", id)).append(ls); s.append(String.format(" MODE : %s", mode)).append(ls); s.append(String.format(" LANG : %s", lang)).append(ls); return s.toString(); } }
knu-3-velychko/DistributedComputing
Lab3/Lab3_a/src/main/java/Main.java
public class Main { public static void main(String[] args) { final int potCapacity = 30; final int beesNumber = 3; Pot pot = new Pot(potCapacity); Bear bear = new Bear(pot); new Thread(bear).start(); for (int i = 0; i < beesNumber; i++) { new Thread(new Bee(i, pot, bear)).start(); } } }
weldingham/hmda-platform
common/src/main/scala/hmda/model/filing/EditDescriptionLookup.scala
<reponame>weldingham/hmda-platform package hmda.model.filing import com.typesafe.config.ConfigFactory import hmda.model.ResourceUtils._ import hmda.utils.YearUtils.Period object EditDescriptionLookup { case class EditDescription(editName: String, description: String, affectedFields: List[String]) val config = ConfigFactory.load() val editDescriptionFileName2018 = config.getString("hmda.filing.2018.edits.descriptions.filename") val editDescriptionFileName2019 = config.getString("hmda.filing.2019.edits.descriptions.filename") val editDescriptionFileName2020Quarter = config.getString("hmda.filing.2020Quarter.edits.descriptions.filename") def editDescriptionList(file: Iterable[String]): Iterable[EditDescription] = file .drop(1) .map { s => val values = s.split("\\|", -1).map(_.trim).toList val editName = values(0) val editDetails = values(1) val affectedDataFields = values(2).split(";").map(_.trim) EditDescription(editName, editDetails, affectedDataFields.toList) } def editDescriptionMap(file: Iterable[String]): Map[String, EditDescription] = editDescriptionList(file).map(e => (e.editName, e)).toMap val editDescriptionLines2018 = fileLines(s"/$editDescriptionFileName2018") val editDescriptionLines2019 = fileLines(s"/$editDescriptionFileName2019") val editDescriptionLines2020Quarter = fileLines(s"/$editDescriptionFileName2020Quarter") val editDescriptionMap2018 = editDescriptionMap(editDescriptionLines2018) val editDescriptionMap2019 = editDescriptionMap(editDescriptionLines2019) val editDescriptionMap2020Quarter = editDescriptionMap(editDescriptionLines2020Quarter) def mapForPeriod(period: Period): Map[String, EditDescription] = period match { case Period(2018, None) => editDescriptionMap2018 case Period(2019, None) => editDescriptionMap2019 case Period(2020, Some(_)) => editDescriptionMap2020Quarter case _ => editDescriptionMap2019 } def lookupDescription(editName: String, period: Period = Period(2018, None)): String = mapForPeriod(period) .getOrElse(editName, EditDescription("", "", List())) .description def lookupFields(editName: String, period: Period = Period(2018, None)): List[String] = mapForPeriod(period) .getOrElse(editName, EditDescription("", "", List())) .affectedFields }
lechium/tvOS145Headers
usr/libexec/assistantd/SAIntentGroupProcessIntent-DeviceRouting.h
// // Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20). // // Copyright (C) 1997-2019 <NAME>. // #import <SAObjects/SAIntentGroupProcessIntent.h> @interface SAIntentGroupProcessIntent (DeviceRouting) - (id)ad_executionDeviceForDeviceContexts:(id)arg1 executionContext:(id)arg2 proximityMap:(id)arg3 localDeviceIsFollower:(_Bool)arg4; // IMP=0x000000010005fa58 - (_Bool)ad_requiresProximityInformation; // IMP=0x000000010005f734 @end
KoizumiSinya/DemoProject
Widgets/Launcher/src/main/java/com/sinya/draglauncher/simple/MyApplication.java
package com.sinya.draglauncher.simple; import android.app.Application; import net.tsz.afinal.FinalBitmap; public class MyApplication extends Application { private static MyApplication instacne = null; public FinalBitmap fb; @Override public void onCreate() { super.onCreate(); fb = FinalBitmap.create(getApplicationContext()); instacne = this; } public static MyApplication getInstance() { return instacne; } }
x2v0/MC
MC/MC.Tests/mcTransportLinearChainTest.cpp
<filename>MC/MC.Tests/mcTransportLinearChainTest.cpp // Radiation Oncology Monte Carlo open source project // // Author: [2017] <NAME> (<EMAIL>) //--------------------------------------------------------------------------- #include "stdafx.h" #include "CppUnitTest.h" #include "../MC/mcMedia.h" #include "../MC/mcThread.h" #include "../MC/mcSourceSimpleMono.h" #include "../MC/mcScoreSphereFluence.h" #include "../MC/mcTransportLinearChain.h" #include "../MC/mcTransportCylinder.h" #include "../MC/mcETransportTrap.h" #include <memory> using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace MCTests { TEST_CLASS(mcTransportLinearChainTest) { public: TEST_METHOD(beginTransportInside) { mcMedia media; media.addName("AIR700ICRU"); //media.initXEFromFile("../data/AcceleratorSimulator.pegs4dat"); media.initXEFromFile( "C:/Users/GennadyGorlachev/Documents/GitHub/RoissVS/MC/data/AcceleratorSimulator.pegs4dat"); mcThread thread; thread.setId(0); mcParticle p; std::wstring err(L"mcTransportLinearChainTest::beginTransportInside failed"); // Сцена mcSourceSimpleMono source("MonoSource", 1, MCP_PHOTON, 1.0, geomVector3D(0, 0, -60.), geomVector3D(0, 0, 1.0)); auto score = new mcScoreSphereFluence("Trap", 1); // скоринг удаляется транспортом mcTransportLinearChain t_chain(geomVector3D(0, 0, 0), geomVector3D(0, 0, 1), geomVector3D(1, 0, 0)); t_chain.setName("Chain"); mcTransportCylinder t_cglobal(geomVector3D(0, 0, -50.0), geomVector3D(0, 0, 1), geomVector3D(1, 0, 0), 15.0, 100); t_cglobal.setName("CylinderGlobal"); t_cglobal.setMediaRef(&media); t_cglobal.setMediumMono("AIR700ICRU"); auto t_c1 = new mcTransportCylinder(geomVector3D(0, 0, -20.0), geomVector3D(0, 0, 1), geomVector3D(1, 0, 0), 5.0, 10); t_c1->setName("C1"); t_c1->setMediaRef(&media); t_c1->setMediumMono("AIR700ICRU"); auto t_c2 = new mcTransportCylinder(geomVector3D(0, 0, 10.0), geomVector3D(0, 0, 1), geomVector3D(1, 0, 0), 5.0, 10); t_c2->setName("C2"); t_c2->setMediaRef(&media); t_c2->setMediumMono("AIR700ICRU"); mcETransportTrap t_trap(geomVector3D(0, 0, 50), geomVector3D(0, 0, 1), geomVector3D(1, 0, 0)); t_trap.setName("Trap"); t_trap.setScore(score); // Иерархия объектов t_c1->setPreviousTransport(&t_chain); t_c1->setNextTransport(t_c2); t_c2->setPreviousTransport(t_c1); t_c2->setNextTransport(&t_chain); t_chain.setPreviousTransport(nullptr); t_chain.addTransport(t_c1); t_chain.addTransport(t_c2); t_cglobal.setNextTransport(&t_trap); t_cglobal.setPreviousTransport(&t_trap); t_chain.setExternalTransport(&t_cglobal); // Симуляции int i; source.sample(p, &thread); // 1 for (i = 0; i < 10; i++) t_cglobal.beginTransport(p); // 2 p.p.set(-30, 0, 0); for (i = 0; i < 10; i++) t_cglobal.beginTransportInside(p); // 3 for (i = 0; i < 10; i++) t_c1->beginTransport(p); // 4 p.p.set(0, 0, 0); for (i = 0; i < 10; i++) t_c2->beginTransport(p); // 5 p.p.set(0, 0, 15); p.u.set(0, 0, -1); for (i = 0; i < 10; i++) t_c2->beginTransportInside(p); // 6 p.p.set(-20, 0, -15); p.u.set(1, 0, 0); for (i = 0; i < 10; i++) t_cglobal.beginTransport(p); // 7 p.p.set(20, 0, 15); p.u.set(-1, 0, 0); for (i = 0; i < 10; i++) t_cglobal.beginTransport(p); // Поскольку транспорт реальный частицы могут достичь детектора с потерей энергии Assert::AreEqual(70., score->etotal(), 1.0, err.c_str(), LINE_INFO()); } }; }
Stoefff/Object-Oriented-Programming-FMI-2017
Week03/MagicTheGathering/ID.h
<reponame>Stoefff/Object-Oriented-Programming-FMI-2017 #ifndef __ID__HEADER__DEFINED__ #define __ID__HEADER__DEFINED__ typedef unsigned short ushort; static ushort currentID; void getCurrentID(const char * fileName); void setCurrentID(const char * fileName); void itterateCurrentID(); #endif
Jiffer/socket-patching
node_modules/stack-mapper/test/twofiles/main.js
<reponame>Jiffer/socket-patching 'use strict'; var barbar = require('./barbar'); module.exports = function main() { var a = 1; function bar() { return barbar(); } return bar(); }
zsluedem/MonkTrader
monkq/runner.py
# # MIT License # # Copyright (c) 2018 WillQ # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # from asyncio import get_event_loop from logbook import Logger from monkq.config import Setting from monkq.context import Context from monkq.ticker import FrequencyTicker from .log import core_log_group logger = Logger('runner') core_log_group.add_logger(logger) class Runner(): def __init__(self, settings: Setting) -> None: self.setting = settings self.context = Context(settings) self.context.setup_context() self.start_datetime = settings.START_TIME # type: ignore self.end_datetime = settings.END_TIME # type: ignore self.ticker = FrequencyTicker(self.start_datetime, self.end_datetime, '1m') self.stat = self.context.stat async def _run(self) -> None: await self.context.strategy.setup() self.stat.freq_collect_account() for current_time in self.ticker.timer(): self.context.now = current_time logger.debug("Handler time {}".format(current_time)) await self.context.strategy.handle_bar() logger.debug("Finish handle bar to {}".format(current_time)) for key, exchange in self.context.exchanges.items(): exchange.match_open_orders() # type:ignore self.stat.freq_collect_account() self.stat.collect_account_info() self.lastly() def lastly(self) -> None: self.stat.report() def run(self) -> None: loop = get_event_loop() loop.run_until_complete(self._run())
CamilliCerutti/Exercicios-de-Python-curso-em-video
Curso em Video/ex001.py
# Faça com que apareça "Ola, Mundo!" No terminal print('Olá, mundo!')
jashburn8020/mypy
ch16/tagged_unions.py
<filename>ch16/tagged_unions.py """Tagged unions.""" from typing import Literal, TypedDict, Union, TypeVar, Generic class NewJobEvent(TypedDict): tag: Literal["new-job"] job_name: str config_file_path: str class CancelJobEvent(TypedDict): tag: Literal["cancel-job"] job_id: int Event = Union[NewJobEvent, CancelJobEvent] def process_event(event: Event) -> None: # Since we made sure both TypedDicts have a key named 'tag', it's safe to do # 'event["tag"]'. This expression normally has the type Literal["new-job", # "cancel-job"], but the check below will narrow the type to either # Literal["new-job"] or Literal["cancel-job"]. # # This in turns narrows the type of 'event' to either NewJobEvent or CancelJobEvent. if event["tag"] == "new-job": print(event["job_name"]) else: print(event["job_id"]) T = TypeVar("T") class Wrapper(Generic[T]): def __init__(self, inner: T) -> None: self.inner = inner def process(w: Union[Wrapper[int], Wrapper[str]]) -> None: # Doing `if isinstance(w, Wrapper[int])` does not work: isinstance requires that # the second argument always be an *erased* type, with no generics. This is because # generics are a typing-only concept and do not exist at runtime in a way # `isinstance` can always check. # # However, we can side-step this by checking the type of `w.inner` to narrow `w` # itself: if isinstance(w.inner, int): reveal_type(w) # Revealed type is 'Wrapper[int]' else: reveal_type(w) # Revealed type is 'Wrapper[str]'
isuru-c/LeakHawk
leakhawk-core/src/main/java/classifier/Content/EOClassifier.java
<gh_stars>1-10 /* * Copyright 2017 SWIS * * 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. */ package classifier.Content; import exception.LeakHawkClassifierLoadingException; import exception.LeakHawkDataStreamException; import util.LeakHawkConstant; import weka.classifiers.misc.SerializedClassifier; import weka.classifiers.trees.RandomForest; import weka.core.Instances; import java.io.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author <NAME> */ @SuppressWarnings("ALL") @ContentPattern(patternName = "Email only", filePath = "EO.model") //@ContentPattern(patternName = "Email only", filePath = "EO.model") public class EOClassifier extends ContentClassifier { private Pattern relatedPattern1; private Pattern relatedPattern2; private Pattern emailPattern; private SerializedClassifier tclassifier; private String headingEO = "@relation train\n" + "\n" + "@attribute $EO1 numeric\n" + "@attribute $EO2 numeric\n" + "@attribute $EO3 numeric\n" + "@attribute $EO4 numeric\n" + "@attribute $EO5 numeric\n" + "@attribute @@class@@ {pos,neg}\n" + "\n" + "@data\n"; public EOClassifier(String model, String name) { super(model, name); try { tclassifier = new SerializedClassifier(); tclassifier.setModelFile(new File(LeakHawkConstant.RESOURCE_FOLDER_FILE_PATH + "/" + model)); // tclassifier = (RandomForest) weka.core.SerializationHelper.read("/home/neo/Desktop/MyFYP/Project/LeakHawk2.0/LeakHawk/leakhawk-core/src/main/resources/EO.model"); } catch (Exception e) { throw new LeakHawkClassifierLoadingException("EO.model file loading error.", e); } relatedPattern1 = Pattern.compile("email_hacked|emails_hacked|email|emails_leak|email_dump|emails_dump|email_dumps|email-list|leaked_email|email_hack", Pattern.CASE_INSENSITIVE); relatedPattern2 = Pattern.compile("leaked by|emails leaked|domains hacked|leaked email list|email list leaked|leaked emails|leak of|email_hacked|emails_hacked|email|emails_leak|email_dump|emails_dump|email_dumps|email-list|leaked_email|email_hack", Pattern.CASE_INSENSITIVE); emailPattern = Pattern.compile("(([a-zA-Z]|[0-9])|([-]|[_]|[.]))+[@](([a-zA-Z0-9])|([-])){2,63}([.]((([a-zA-Z0-9])|([-])){2,63})){1,4}"); } public String createARFF(String text, String title) { String feature_list = ""; Matcher matcherEO = relatedPattern1.matcher(title); feature_list += getMatchingCount(matcherEO) + ","; matcherEO = relatedPattern1.matcher(text); feature_list += getMatchingCount(matcherEO) + ","; matcherEO = emailPattern.matcher(text); int emailCount = getMatchingCount(matcherEO); feature_list += emailCount + ","; int wordCount = text.replace('[', ' ').replace('*', ' ').replace(']', ' ').replace(',', ' ').replace('/', ' ').replace(':', ' ').split("\\s+").length; feature_list += wordCount + ","; double rate = ((double) emailCount / wordCount) * 100; if (rate > 89) { feature_list += 1 + ","; } else { feature_list += 0 + ","; } feature_list += "?"; return headingEO + feature_list; } @Override public boolean classify(String text, String title) { try { // convert String into InputStream String result = createARFF(text, title); InputStream is = new ByteArrayInputStream(result.getBytes()); // read it with BufferedReader BufferedReader reader = new BufferedReader(new InputStreamReader(is)); // BufferedReader reader = new BufferedReader Instances unlabeled = new Instances(reader); reader.close(); unlabeled.setClassIndex(unlabeled.numAttributes() - 1); // create copy Instances labeled = new Instances(unlabeled); String[] options = new String[2]; options[0] = "-P"; options[1] = "0"; tclassifier.setOptions(options); double pred = tclassifier.classifyInstance(unlabeled.instance(0)); String classLabel = unlabeled.classAttribute().value((int) pred); if ("pos".equals(classLabel)) { return true; } } catch (IOException e) { throw new LeakHawkDataStreamException("Post text error occured.", e); } catch (StackOverflowError e) { } catch (Exception e) { throw new LeakHawkClassifierLoadingException("EO.model classification error.", e); } return false; } public int getSensivityLevel(String post) { int email_count = EOCounter(post); if (email_count < 50) { return 1; } return 2; } public int EOCounter(String post) { Pattern emailPattern = Pattern.compile("(([a-zA-Z]|[0-9])|([-]|[_]|[.]))+[@](([a-zA-Z0-9])|([-])){2,63}([.]((([a-zA-Z0-9])|([-])){2,63})){1,4}"); Matcher matcherEO = emailPattern.matcher(post); int EO_Count = getMatchingCount(matcherEO); return EO_Count; } }
bencevans/sciencefair
app/client/views/speed.js
<reponame>bencevans/sciencefair<filename>app/client/views/speed.js<gh_stars>100-1000 const html = require('choo/html') const css = require('csjs-inject') const C = require('../../constants') const bytes = require('bytes') const icon = require('./icon') const style = css` .speed { flex-direction: column; width: 100%; align-items: center; } .rate { font-size: 1.3em; flex-direction: row; flex-wrap: nowrap; } .ratepart { width: 110px; } .down { justify-content: flex-end; } .up { justify-content: flex-start; } .icon { justify-content: center; align-items: center; margin-left: 10px; margin-right: 10px; } .zero { opacity: 0.8; } ` const byteopts = { decimalPlaces: 0 } const transfericon = { name: 'xfer', backgroundColor: C.YELLOWFADE, width: 20, height: 20 } module.exports = data => { const down = bytes(data.down, byteopts) const up = bytes(data.up, byteopts) const zero = data.down === 0 && data.up === 0 const opacity = zero ? style.zero : '' const top = zero ? html`<div class="${style.rate}">0</div>` : html` <div class="${style.rate}"> <div class="${style.ratepart} ${style.down}">${down}/s</div> <div class="${style.icon}">${icon(transfericon)}</div> <div class="${style.ratepart} ${style.up}">${up}/s</div> </div> ` return html` <div class="${style.speed} ${opacity}"> ${top} <div>speed</div> </div> ` }
luckiday/ndnrtc
cpp/tools/networked-storage/main.cpp
// // main.cpp // // Created by <NAME> on 9 October 2018. // Copyright 2013-2018 Regents of the University of California // #include <iostream> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <execinfo.h> #include <boost/asio.hpp> #include <boost/asio/deadline_timer.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread.hpp> #include <ndn-cpp/threadsafe-face.hpp> #include <ndn-cpp/security/key-chain.hpp> #include <ndn-cpp/security/certificate/identity-certificate.hpp> #include <ndn-cpp/util/memory-content-cache.hpp> #include <ndn-cpp/security/pib/pib-memory.hpp> #include <ndn-cpp/security/tpm/tpm-back-end-memory.hpp> #include <ndn-cpp/security/policy/no-verify-policy-manager.hpp> #include "../../contrib/docopt/docopt.h" #include "../../include/name-components.hpp" #include "../../include/simple-log.hpp" #include "../../include/storage-engine.hpp" static const char USAGE[] = R"(Networked Storage. Usage: networked-storage <db_path> [--verbose] Arguments: <db_path> Path to persistent storage DB Options: -v --verbose Verbose output )"; using namespace std; using namespace ndn; using namespace ndnrtc; static bool mustExit = false; void registerPrefix(boost::shared_ptr<Face> &face, const Name &prefix, boost::shared_ptr<StorageEngine> storage); void handler(int sig) { void *array[10]; size_t size; if (sig == SIGABRT || sig == SIGSEGV) { fprintf(stderr, "Received signal %d:\n", sig); // get void*'s for all entries on the stack size = backtrace(array, 10); // print out all the frames to stderr backtrace_symbols_fd(array, size, STDERR_FILENO); exit(1); } else mustExit = true; } int main(int argc, char **argv) { signal(SIGABRT, handler); signal(SIGSEGV, handler); signal(SIGINT, &handler); signal(SIGUSR1, &handler); ndnlog::new_api::Logger::initAsyncLogging(); map<string, docopt::value> args = docopt::docopt(USAGE, { argv + 1, argv + argc }, true, // show help if requested (string("Netowkred Storage ")+string(PACKAGE_VERSION)).c_str()); // version string // for(auto const& arg : args) { // cout << arg.first << " " << arg.second << endl; // } ndnlog::new_api::Logger::getLogger("").setLogLevel(args["--verbose"].asBool() ? ndnlog::NdnLoggerDetailLevelAll : ndnlog::NdnLoggerDetailLevelDefault); int err = 0; boost::asio::io_service io; boost::shared_ptr<boost::asio::io_service::work> work(boost::make_shared<boost::asio::io_service::work>(io)); boost::thread t([&io, &err]() { try { io.run(); } catch (exception &e) { LogError("") << "Caught exception while running: " << e.what() << endl; err = 1; } }); // setup storage boost::shared_ptr<StorageEngine> storage = boost::make_shared<StorageEngine>(args["<db_path>"].asString(), true); // setup face and keychain boost::shared_ptr<Face> face = boost::make_shared<ThreadsafeFace>(io); boost::shared_ptr<KeyChain> keyChain = boost::make_shared<KeyChain>(); face->setCommandSigningInfo(*keyChain, keyChain->getDefaultCertificateName()); LogInfo("") << "Scanning available prefixes..." << std::endl; storage->scanForLongestPrefixes(io, [&face, storage](const vector<Name>& pp){ LogInfo("") << "Scan completed. total keys: " << storage->getKeysNum() << ", payload size ~ " << storage->getPayloadSize()/1024/1024 << "MB, number of longest prefixes: " << pp.size() << endl; for (auto n:pp) LogInfo("") << "\t" << n << endl; for (auto n:pp) registerPrefix(face, n, storage); }); { while (!(err || mustExit)) { usleep(10); } } LogInfo("") << "Shutting down gracefully..." << endl; keyChain.reset(); face->shutdown(); face.reset(); work.reset(); t.join(); io.stop(); LogInfo("") << "done" << endl; } void registerPrefix(boost::shared_ptr<Face> &face, const Name &prefix, boost::shared_ptr<StorageEngine> storage) { LogInfo("") << "Registering prefix " << prefix << std::endl; face->registerPrefix(prefix, [storage](const boost::shared_ptr<const Name> &prefix, const boost::shared_ptr<const Interest> &interest, Face &face, uint64_t, const boost::shared_ptr<const InterestFilter> &) { LogTrace("") << "Incoming interest " << interest->getName() << std::endl; boost::shared_ptr<Data> d = storage->read(*interest); if (d) { LogTrace("") << "Retrieved data of size " << d->getContent().size() << ": " << d->getName() << std::endl; face.putData(*d); } else LogTrace("") << "no data for " << interest->getName() << std::endl; }, [](const boost::shared_ptr<const Name> &prefix) { LogError("") << "Prefix registration failure (" << prefix << ")" << std::endl; }, [](const boost::shared_ptr<const Name> &p, uint64_t) { LogInfo("") << "Successfully registered prefix " << *p << std::endl; }); }
ysbing/voo
src/base/utils/JsonUtils.h
#ifndef JsonUtils_H #define JsonUtils_H #include <QAbstractItemModel> #include <QJsonDocument> #include <QMetaObject> #include <QMetaProperty> #include <QJsonObject> class JsonUtils { public: QObject *fromJson(const QMetaObject &meta, QString &json); QObject *fromJson(const QMetaObject *meta, QJsonObject &jsonObject); QVariant jsonValueToProperty(QObject *object, QMetaProperty &property, QJsonValue value); static QJsonDocument jsonObjectFromFile(const QString path); }; #endif
kmannnish/vespa-watch
vespawatch/migrations/0019_auto_20190524_0906.py
# Generated by Django 2.2.1 on 2019-05-24 07:06 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('vespawatch', '0018_auto_20190522_1200'), ] operations = [ migrations.AddField( model_name='individual', name='created_at', field=models.DateTimeField(default=django.utils.timezone.now), ), migrations.AddField( model_name='nest', name='created_at', field=models.DateTimeField(default=django.utils.timezone.now), ), ]
billwert/azure-sdk-for-java
sdk/synapse/azure-analytics-synapse-artifacts/src/main/java/com/azure/analytics/synapse/artifacts/models/AzureMLBatchExecutionActivity.java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.analytics.synapse.artifacts.models; import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import java.util.List; import java.util.Map; /** Azure ML Batch Execution activity. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeName("AzureMLBatchExecution") @JsonFlatten @Fluent public class AzureMLBatchExecutionActivity extends ExecutionActivity { /* * Key,Value pairs to be passed to the Azure ML Batch Execution Service * endpoint. Keys must match the names of web service parameters defined in * the published Azure ML web service. Values will be passed in the * GlobalParameters property of the Azure ML batch execution request. */ @JsonProperty(value = "typeProperties.globalParameters") private Map<String, Object> globalParameters; /* * Key,Value pairs, mapping the names of Azure ML endpoint's Web Service * Outputs to AzureMLWebServiceFile objects specifying the output Blob * locations. This information will be passed in the WebServiceOutputs * property of the Azure ML batch execution request. */ @JsonProperty(value = "typeProperties.webServiceOutputs") private Map<String, AzureMLWebServiceFile> webServiceOutputs; /* * Key,Value pairs, mapping the names of Azure ML endpoint's Web Service * Inputs to AzureMLWebServiceFile objects specifying the input Blob * locations.. This information will be passed in the WebServiceInputs * property of the Azure ML batch execution request. */ @JsonProperty(value = "typeProperties.webServiceInputs") private Map<String, AzureMLWebServiceFile> webServiceInputs; /** * Get the globalParameters property: Key,Value pairs to be passed to the Azure ML Batch Execution Service endpoint. * Keys must match the names of web service parameters defined in the published Azure ML web service. Values will be * passed in the GlobalParameters property of the Azure ML batch execution request. * * @return the globalParameters value. */ public Map<String, Object> getGlobalParameters() { return this.globalParameters; } /** * Set the globalParameters property: Key,Value pairs to be passed to the Azure ML Batch Execution Service endpoint. * Keys must match the names of web service parameters defined in the published Azure ML web service. Values will be * passed in the GlobalParameters property of the Azure ML batch execution request. * * @param globalParameters the globalParameters value to set. * @return the AzureMLBatchExecutionActivity object itself. */ public AzureMLBatchExecutionActivity setGlobalParameters(Map<String, Object> globalParameters) { this.globalParameters = globalParameters; return this; } /** * Get the webServiceOutputs property: Key,Value pairs, mapping the names of Azure ML endpoint's Web Service Outputs * to AzureMLWebServiceFile objects specifying the output Blob locations. This information will be passed in the * WebServiceOutputs property of the Azure ML batch execution request. * * @return the webServiceOutputs value. */ public Map<String, AzureMLWebServiceFile> getWebServiceOutputs() { return this.webServiceOutputs; } /** * Set the webServiceOutputs property: Key,Value pairs, mapping the names of Azure ML endpoint's Web Service Outputs * to AzureMLWebServiceFile objects specifying the output Blob locations. This information will be passed in the * WebServiceOutputs property of the Azure ML batch execution request. * * @param webServiceOutputs the webServiceOutputs value to set. * @return the AzureMLBatchExecutionActivity object itself. */ public AzureMLBatchExecutionActivity setWebServiceOutputs(Map<String, AzureMLWebServiceFile> webServiceOutputs) { this.webServiceOutputs = webServiceOutputs; return this; } /** * Get the webServiceInputs property: Key,Value pairs, mapping the names of Azure ML endpoint's Web Service Inputs * to AzureMLWebServiceFile objects specifying the input Blob locations.. This information will be passed in the * WebServiceInputs property of the Azure ML batch execution request. * * @return the webServiceInputs value. */ public Map<String, AzureMLWebServiceFile> getWebServiceInputs() { return this.webServiceInputs; } /** * Set the webServiceInputs property: Key,Value pairs, mapping the names of Azure ML endpoint's Web Service Inputs * to AzureMLWebServiceFile objects specifying the input Blob locations.. This information will be passed in the * WebServiceInputs property of the Azure ML batch execution request. * * @param webServiceInputs the webServiceInputs value to set. * @return the AzureMLBatchExecutionActivity object itself. */ public AzureMLBatchExecutionActivity setWebServiceInputs(Map<String, AzureMLWebServiceFile> webServiceInputs) { this.webServiceInputs = webServiceInputs; return this; } /** {@inheritDoc} */ @Override public AzureMLBatchExecutionActivity setLinkedServiceName(LinkedServiceReference linkedServiceName) { super.setLinkedServiceName(linkedServiceName); return this; } /** {@inheritDoc} */ @Override public AzureMLBatchExecutionActivity setPolicy(ActivityPolicy policy) { super.setPolicy(policy); return this; } /** {@inheritDoc} */ @Override public AzureMLBatchExecutionActivity setName(String name) { super.setName(name); return this; } /** {@inheritDoc} */ @Override public AzureMLBatchExecutionActivity setDescription(String description) { super.setDescription(description); return this; } /** {@inheritDoc} */ @Override public AzureMLBatchExecutionActivity setDependsOn(List<ActivityDependency> dependsOn) { super.setDependsOn(dependsOn); return this; } /** {@inheritDoc} */ @Override public AzureMLBatchExecutionActivity setUserProperties(List<UserProperty> userProperties) { super.setUserProperties(userProperties); return this; } }
bitigchi/MuditaOS
products/PurePhone/services/desktop/endpoints/calllog/CalllogHelper.cpp
<gh_stars>100-1000 // Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include <endpoints/calllog/CalllogHelper.hpp> #include <endpoints/message/Sender.hpp> #include <BaseInterface.hpp> #include <Common/Query.hpp> #include <module-db/queries/calllog/QueryCalllogGet.hpp> #include <module-db/queries/calllog/QueryCalllogGetByContactID.hpp> #include <module-db/queries/calllog/QueryCalllogGetCount.hpp> #include <module-db/queries/calllog/QueryCalllogRemove.hpp> #include <service-db/DBServiceAPI.hpp> #include <memory> #include <utility> #include <vector> namespace sdesktop::endpoints { using sender::putToSendQueue; auto CalllogHelper::createDBEntry(Context &context) -> sys::ReturnCodes { return sys::ReturnCodes::Unresolved; } auto CalllogHelper::requestDataFromDB(Context &context) -> sys::ReturnCodes { if (context.getBody()[json::calllog::count] == true) { return getCalllogCount(context); } if (context.getBody()[json::calllog::contactId].int_value() != 0) { return getCalllogByContactID(context); } else { auto limit = context.getBody()[json::calllog::limit].int_value(); auto offset = context.getBody()[json::calllog::offset].int_value(); auto query = std::make_unique<db::query::CalllogGet>(limit, offset); auto listener = std::make_unique<db::EndpointListener>( [](db::QueryResult *result, Context context) { if (auto contactResult = dynamic_cast<db::query::CalllogGetResult *>(result)) { auto recordsPtr = std::make_unique<std::vector<CalllogRecord>>(contactResult->getRecords()); json11::Json::array calllogArray; for (const auto &record : *recordsPtr) { calllogArray.emplace_back(CalllogHelper::to_json(record)); } context.setResponseBody(calllogArray); putToSendQueue(context.createSimpleResponse()); return true; } else { return false; } }, context); query->setQueryListener(std::move(listener)); DBServiceAPI::GetQuery(ownerServicePtr, db::Interface::Name::Calllog, std::move(query)); return sys::ReturnCodes::Success; } } auto CalllogHelper::getCalllogCount(Context &context) -> sys::ReturnCodes { auto query = std::make_unique<db::query::CalllogGetCount>(EntryState::ALL); auto listener = std::make_unique<db::EndpointListener>( [](db::QueryResult *result, Context context) { if (auto calllogResult = dynamic_cast<db::query::CalllogGetCountResult *>(result)) { auto count = calllogResult->getCount(); context.setResponseBody(json11::Json::object({{json::calllog::count, static_cast<int>(count)}})); putToSendQueue(context.createSimpleResponse()); return true; } else { return false; } }, context); query->setQueryListener(std::move(listener)); DBServiceAPI::GetQuery(ownerServicePtr, db::Interface::Name::Calllog, std::move(query)); return sys::ReturnCodes::Success; } auto CalllogHelper::getCalllogByContactID(Context &context) -> sys::ReturnCodes { auto query = std::make_unique<db::query::CalllogGetByContactID>(context.getBody()[json::calllog::contactId].int_value()); auto listener = std::make_unique<db::EndpointListener>( [](db::QueryResult *result, Context context) { if (auto calllogResult = dynamic_cast<db::query::CalllogGetByContactIDResult *>(result)) { auto records = calllogResult->getResults(); json11::Json::array calllogArray; for (const auto &record : records) { calllogArray.emplace_back(CalllogHelper::to_json(record)); } context.setResponseBody(calllogArray); putToSendQueue(context.createSimpleResponse()); return true; } else { return false; } }, context); query->setQueryListener(std::move(listener)); DBServiceAPI::GetQuery(ownerServicePtr, db::Interface::Name::Calllog, std::move(query)); return sys::ReturnCodes::Success; } auto CalllogHelper::updateDBEntry(Context &context) -> sys::ReturnCodes { return sys::ReturnCodes::Unresolved; } auto CalllogHelper::deleteDBEntry(Context &context) -> sys::ReturnCodes { auto query = std::make_unique<db::query::CalllogRemove>(context.getBody()[json::calllog::id].int_value()); auto listener = std::make_unique<db::EndpointListener>( [](db::QueryResult *result, Context context) { if (auto calllogResult = dynamic_cast<db::query::CalllogRemoveResult *>(result)) { context.setResponseStatus(calllogResult->getResults() ? http::Code::NoContent : http::Code::InternalServerError); putToSendQueue(context.createSimpleResponse()); return true; } else { return false; } }, context); query->setQueryListener(std::move(listener)); DBServiceAPI::GetQuery(ownerServicePtr, db::Interface::Name::Calllog, std::move(query)); return sys::ReturnCodes::Success; } auto CalllogHelper::requestCount(Context &context) -> sys::ReturnCodes { return sys::ReturnCodes::Unresolved; } auto CalllogHelper::to_json(CalllogRecord record) -> json11::Json { std::unique_ptr<std::stringstream> ss = std::make_unique<std::stringstream>(); (*ss) << record.date; std::string date = ss->str(); ss->clear(); ss->str(std::string{}); (*ss) << record.duration; std::string duration = ss->str(); auto recordEntry = json11::Json::object{{json::calllog::presentation, static_cast<int>(record.presentation)}, {json::calllog::date, date}, {json::calllog::duration, duration}, {json::calllog::id, static_cast<int>(record.ID)}, {json::calllog::type, static_cast<int>(record.type)}, {json::calllog::phoneNumber, record.phoneNumber.getEntered()}, {json::calllog::isRead, record.isRead}}; return recordEntry; } } // namespace sdesktop::endpoints
ung-org/lib-c
src/curses/qiflush.c
#include <curses.h> void qiflush(void) { } /* XOPEN(400) LINK(curses) */
shanqiang-sq/jstream
jstream/src/main/java/io/github/shanqiang/ArrayUtil.java
package io.github.shanqiang; import io.github.shanqiang.offheap.InternalUnsafe; import java.nio.ByteBuffer; import static io.github.shanqiang.offheap.InternalUnsafe.getInt; import static io.github.shanqiang.offheap.InternalUnsafe.putInt; import static java.lang.String.format; import static sun.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET; public class ArrayUtil { //DEFAULT_CAPACITY and INIT_CAPACITY too small will grow too many times to generate more garbage which will increment the GC pressure // but too large will waste more memory space. 64 is a suitable choice. public static final int DEFAULT_CAPACITY = 64; private static final int INIT_CAPACITY = 64; // See java.util.ArrayList for an explanation static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8; public static long calculateNewSize(long currentSize) { // grow array by 50% long newSize = currentSize + (currentSize >> 1); // verify new size is within reasonable bounds if (newSize < INIT_CAPACITY) { newSize = INIT_CAPACITY; } else if (newSize > MAX_ARRAY_SIZE) { newSize = MAX_ARRAY_SIZE; if (newSize == currentSize) { throw new IllegalArgumentException(format("Can not grow array beyond '%s'", MAX_ARRAY_SIZE)); } } return newSize; } public static byte[] intToBytes(final int data) { byte[] ret = new byte[Integer.BYTES]; InternalUnsafe.putInt(ret, ARRAY_BYTE_BASE_OFFSET, data); return ret; } public static int bytesToInt(final byte[] data) { return InternalUnsafe.getInt(data, ARRAY_BYTE_BASE_OFFSET); } public static byte[] toArr(ByteBuffer byteBuffer) { byte[] arr = new byte[byteBuffer.remaining()]; byteBuffer.get(arr); return arr; } }
ehwjh2010/cobra
verror/multi.go
package verror import "strings" type MultiErr struct { Errs []error } func NewMultiErr() *MultiErr { return &MultiErr{} } func (m *MultiErr) Error() string { if m.IsEmpty() { return "" } var tmp []string for _, err := range m.Errs { tmp = append(tmp, err.Error()) } result := strings.Join(tmp, "\n") return result } // AddErr 添加错误 func (m *MultiErr) AddErr(args ...error) { for _, err := range args { if err == nil { continue } m.Errs = append(m.Errs, err) } } // IsEmpty 是否为空 func (m *MultiErr) IsEmpty() bool { if m == nil || len(m.Errs) == 0 { return true } return false } // IsNotEmpty 是否为空 func (m *MultiErr) IsNotEmpty() bool { return !m.IsNotEmpty() } // AsStdErr 转换为标准库错误 func (m *MultiErr) AsStdErr() error { if m.IsEmpty() { return nil } return m }
umerkhan95/teaching-python
Sliding-Window/Permutation-In-A-String.py
def find_permutation(str, pattern): window_start, matched = 0, 0 char_frequency = {} for char in pattern: if char not in char_frequency: char_frequency[char] = 0 char_frequency[char] += 1 # Our goal is to match all the characters from the 'char_frequency' with the current window. Let's extend the range [window_start, window_end] for window_end in range(len(str)): right_char = str[window_end] if right_char in char_frequency: # Decrement the frequency of matched character char_frequency[right_char] -= 1 if char_frequency[right_char] == 0: matched += 1 if matched == len(char_frequency): return True # Shrink the window by one character if window_end >= len(pattern) - 1: left_char = str[window_start] window_start += 1 if left_char in char_frequency: if char_frequency[left_char] == 0: matched -= 1 char_frequency[left_char] += 1 return False
junorz/travel-book-api
src/main/java/com/junorz/travelbook/config/DbConfig.java
<gh_stars>0 package com.junorz.travelbook.config; import java.util.HashMap; import java.util.Map; import javax.sql.DataSource; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.PlatformTransactionManager; import com.junorz.travelbook.config.DbConfig.DbInfo; import com.junorz.travelbook.context.orm.DefaultRepository; import com.junorz.travelbook.context.orm.Repository; import com.zaxxer.hikari.HikariDataSource; import lombok.Data; /** * Configuration of Database */ @Configuration @EnableConfigurationProperties(DbInfo.class) public class DbConfig { @ConfigurationProperties("travelbook.datasource") @Data class DbInfo { private String jdbcUrl; private String username; private String password; private String ddl; private boolean showSql; private boolean createSchemeDdlScript; public JpaVendorAdapter getJpaVendorAdapter() { HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter(); jpaVendorAdapter.setShowSql(showSql); return jpaVendorAdapter; } public Map<String, String> getJpaProperties() { Map<String, String> jpaProperties = new HashMap<>(); jpaProperties.put("hibernate.hbm2ddl.auto", ddl); if (createSchemeDdlScript) { jpaProperties.put("javax.persistence.schema-generation.create-source", "metadata"); jpaProperties.put("javax.persistence.schema-generation.scripts.action", "create"); jpaProperties.put("javax.persistence.schema-generation.scripts.create-target", "ddl.sql"); } return jpaProperties; } } @Bean public DataSource dataSource(DbInfo dbInfo) { HikariDataSource dataSource = new HikariDataSource(); dataSource.setJdbcUrl(dbInfo.getJdbcUrl()); dataSource.setUsername(dbInfo.getUsername()); dataSource.setPassword(dbInfo.getPassword()); return dataSource; } @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory(DbInfo dbInfo, DataSource dataSource) { EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(dbInfo.getJpaVendorAdapter(), dbInfo.getJpaProperties(), null); return builder .dataSource(dataSource) .jta(false) .persistenceUnit("travelbook") .packages("com.junorz.travelbook.domain") .build(); } @Bean public PlatformTransactionManager transactionManager(LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean) { return new JpaTransactionManager(localContainerEntityManagerFactoryBean.getObject()); } @Bean public Repository repository() { return new DefaultRepository(); } }
Ikhbar-Kebaa/LogDevice
logdevice/common/configuration/nodes/NodesConfigurationManager.h
/** * Copyright (c) 2018-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include "logdevice/common/NodeID.h" #include "logdevice/common/configuration/nodes/NodesConfigurationAPI.h" #include "logdevice/common/configuration/nodes/NodesConfigurationManagerDependencies.h" #include "logdevice/common/configuration/nodes/NodesConfigurationStore.h" #include "logdevice/common/configuration/nodes/ServiceDiscoveryConfig.h" #include "logdevice/common/membership/StorageMembership.h" namespace facebook { namespace logdevice { namespace configuration { namespace nodes { // NodesConfigurationManager is the singleton state machine that persists and // manages the service discovery info as well as storage membership. It also // provides a public API for our tools. class NodesConfigurationManager : public NodesConfigurationAPI, public folly::enable_shared_from_this<NodesConfigurationManager> { private: struct NCMTag {}; public: class OperationMode { public: static OperationMode forClient(); static OperationMode forTooling(); static OperationMode forNodeRoles(NodeServiceDiscovery::RoleSet roles); // self roles bool isClient() const; bool isTooling() const; bool isStorageMember() const; bool isSequencer() const; // protocol modes // By default, everyone is an observer. bool isProposer() const; bool isCoordinator() const; bool isValid() const; protected: static OperationMode upgradeToProposer(OperationMode current_mode); private: using Flags = uint16_t; constexpr static const Flags kIsProposer = static_cast<Flags>(1 << 0); constexpr static const Flags kIsCoordinator = static_cast<Flags>(1 << 1); constexpr static const Flags kIsClient = static_cast<Flags>(1 << 2); constexpr static const Flags kIsTooling = static_cast<Flags>(1 << 3); constexpr static const Flags kIsStorageMember = static_cast<Flags>(1 << 4); constexpr static const Flags kIsSequencer = static_cast<Flags>(1 << 5); // Only use the static methods to construct OperationMode explicit OperationMode() : mode_{0} {} void setFlags(Flags flags); bool hasFlags(Flags flags) const; bool onlyHasFlags(Flags flags) const; Flags mode_{0}; }; // OperationMode template <typename... Args> static auto create(Args&&... args) { return std::make_shared<NodesConfigurationManager>( NCMTag{}, std::forward<Args>(args)...); } explicit NodesConfigurationManager(NCMTag, OperationMode mode, std::unique_ptr<ncm::Dependencies> deps); NodesConfigurationManager(const NodesConfigurationManager&) = delete; NodesConfigurationManager& operator=(const NodesConfigurationManager&) = delete; NodesConfigurationManager(NodesConfigurationManager&&) = delete; NodesConfigurationManager& operator=(NodesConfigurationManager&&) = delete; ~NodesConfigurationManager() override {} void init(); //////// PROPOSER //////// int update(NodesConfiguration::Update, CompletionCb) override { throw std::runtime_error("unimplemented."); } int overwrite(std::shared_ptr<const NodesConfiguration>, CompletionCb) override { throw std::runtime_error("unimplemented."); } //////// OBSERVER //////// std::shared_ptr<const NodesConfiguration> getConfig() const override { return local_nodes_config_.get(); } ncm::Dependencies* deps() const { return deps_.get(); } private: void initOnNCM(); void startPollingFromStore(); // onNewConfig should only be called by NewConfigRequest. // TODO: implement overwrite (the blind write option) for emergency tooling. void onNewConfig(std::shared_ptr<const NodesConfiguration>); void onNewConfig(std::string); // A new version of the config goes through the following phases: // S: staged, to be processed by the NCM // | // | maybeProcessStagedConfig() // v // P: pending, currently being processed by the NCM (e.g., propagated to // each Worker, waiting to hear back) // | // | onProcessingFinished() // v // L: locally processed, all Workers have acknowledged and processed this // version. // // For simplicity, we maintain the following invariants: // (1) NCM only keeps the highest-versioned staged config, since later configs // include the effects of previous configs, skipping config versions is // acceptable. (2) NCM only allows one pending config at any given time. // Hence, maybeProcessStagedConfig() only starts processing a staged config if // there isn't an existing pending config. // // TODO: storage nodes need to persist the config after processing finished // and before marking the config as locally processed, i.e., there is a // separate phase between P and L. // // Must be called from the NCM context. void maybeProcessStagedConfig(); // Must be called from the NCM context. void onProcessingFinished(std::shared_ptr<const NodesConfiguration>); // The following helper functions should only be called from the NCM context. bool shouldStageVersion(membership::MembershipVersion::Type); bool hasProcessedVersion(membership::MembershipVersion::Type); OperationMode mode_; std::unique_ptr<ncm::Dependencies> deps_{nullptr}; // The nodes config that is staged to be processed. Among all the staged nodes // configs, we only keep the highest versioned one. All accesses happen in the // NCM context. std::shared_ptr<const NodesConfiguration> staged_nodes_config_{nullptr}; // The nodes config that the NCM is currently processing (propagating to every // worker). All accesses happen in the NCM context. std::shared_ptr<const NodesConfiguration> pending_nodes_config_{nullptr}; // The locally processed and committed version of the NodesConfiguration, the // version of which _strictly_ increases. All writes are done in the state // machine context, but reads may be from different threads. UpdateableSharedPtr<const NodesConfiguration, NCMTag> local_nodes_config_{ nullptr}; friend class ncm::NCMRequest; friend class ncm::Dependencies::InitRequest; friend class ncm::NewConfigRequest; friend class ncm::ProcessingFinishedRequest; }; }}}} // namespace facebook::logdevice::configuration::nodes
KATO-Hiro/AtCoder
ABC/abc151-abc200/abc156/d.py
# -*- coding: utf-8 -*- def main(): n, a, b = map(int, input().split()) value_max = 2 * (10 ** 5) com = [0 for _ in range(value_max + 1)] com[1] = n mod = 10 ** 9 + 7 mod_inverse = [pow(i, mod - 2, mod) for i in range(1, value_max + 1)] ans = pow(2, n, mod) # KeyInsight: # 全体 - 条件を満たす場合 # modの世界では割り算の代わりに逆元を使う # See: # https://www.youtube.com/watch?v=lzAMKPMLdtU&feature=youtu.be for i in range(2, min(n, value_max) + 1): if (n - i + 1) == 0: break com[i] = com[i - 1] * (n - i + 1) com[i] *= mod_inverse[i - 1] com[i] %= mod diff = (com[a] + com[b] + 1) % mod print((ans - diff) % mod) if __name__ == '__main__': main()
onmyway133/Runtime-Headers
macOS/10.13/Navigation.framework/MNLocation.h
/* Generated by RuntimeBrowser Image: /System/Library/PrivateFrameworks/Navigation.framework/Versions/A/Navigation */ @interface MNLocation : CLLocation { GEONavigationMatchInfo * _detailedMatchInfo; NSDate * _expirationDate; BOOL _isDirectional; BOOL _isLeeched; BOOL _locationUnreliable; NSDate * _originalDate; int _rampType; CLLocation * _rawLocation; struct CLLocationCoordinate2D { double latitude; double longitude; } _rawShiftedCoordinate; unsigned int _roadLineType; GEORoadMatch * _roadMatch; NSString * _roadName; GEORouteMatch * _routeMatch; NSString * _shieldText; long long _shieldType; unsigned long long _speedLimit; BOOL _speedLimitIsMPH; long long _speedLimitShieldType; unsigned long long _state; } @property (nonatomic, readonly) int _nav_source; @property (nonatomic, readwrite, retain) GEONavigationMatchInfo *detailedMatchInfo; @property (nonatomic, readwrite, retain) NSDate *expirationDate; @property (nonatomic, readwrite) BOOL isDirectional; @property (nonatomic, readwrite) BOOL isLeeched; @property (nonatomic, readonly) BOOL isProjected; @property (nonatomic, readwrite) BOOL locationUnreliable; @property (nonatomic, readwrite, retain) NSDate *originalDate; @property (nonatomic, readwrite) int rampType; @property (nonatomic, readwrite, retain) CLLocation *rawLocation; @property (nonatomic, readwrite) struct CLLocationCoordinate2D { double x1; double x2; } rawShiftedCoordinate; @property (nonatomic, readwrite) unsigned int roadLineType; @property (nonatomic, readwrite, retain) GEORoadMatch *roadMatch; @property (nonatomic, readwrite, retain) NSString *roadName; @property (nonatomic, readwrite, retain) GEORouteMatch *routeMatch; @property (nonatomic, readwrite, retain) NSString *shieldText; @property (nonatomic, readwrite) long long shieldType; @property (nonatomic, readwrite) unsigned long long speedLimit; @property (nonatomic, readwrite) BOOL speedLimitIsMPH; @property (nonatomic, readwrite) long long speedLimitShieldType; @property (nonatomic, readwrite) unsigned long long state; @property (nonatomic, readonly) unsigned long long stepIndex; - (void).cxx_destruct; - (id)_navigation_detailedMatchInfo; - (BOOL)_navigation_hasValidCourse; - (BOOL)_navigation_isStale; - (struct CLLocationCoordinate2D { double x1; double x2; })_navigation_rawShiftedCoordinate; - (id)_navigation_routeMatch; - (struct { struct { id x_1_1_1; unsigned long long x_1_1_2; unsigned long long x_1_1_3; unsigned long long x_1_1_4; unsigned long long x_1_1_5; unsigned int x_1_1_6; unsigned long long x_1_1_7; BOOL x_1_1_8; unsigned long long x_1_1_9; float x_1_1_10; unsigned long long x_1_1_11; id x_1_1_12; } x1; unsigned long long x2; unsigned long long x3; int x4; int x5; int x6; unsigned long long x7; unsigned long long x8; union { struct { struct { float x_1_3_1; float x_1_3_2; } x_1_2_1; struct { float x_2_3_1; float x_2_3_2; } x_1_2_2; } x_9_1_1; struct { float x_2_2_1; float x_2_2_2; float x_2_2_3; float x_2_2_4; } x_9_1_2; } x9; struct { /* ? */ } *x10; struct { unsigned short x_11_1_1[2]; unsigned short x_11_1_2[2]; } x11; unsigned char x12; BOOL x13; unsigned char x14; BOOL x15; BOOL x16; unsigned char x17; BOOL x18; unsigned char x19; struct _NSRange { unsigned long long x_20_1_1; unsigned long long x_20_1_2; } x20; BOOL x21; unsigned int x22; }*)_roadFeature; - (id)description; - (id)detailedMatchInfo; - (id)expirationDate; - (id)initWithClientLocation:(struct { int x1; struct { double x_2_1_1; double x_2_1_2; } x2; double x3; double x4; double x5; double x6; double x7; double x8; double x9; double x10; int x11; double x12; int x13; struct { double x_14_1_1; double x_14_1_2; } x14; double x15; int x16; unsigned int x17; int x18; int x19; })arg1; - (id)initWithLocationDetails:(id)arg1; - (id)initWithLocationDetails:(id)arg1 route:(id)arg2; - (id)initWithRawLocation:(id)arg1; - (id)initWithRawLocation:(id)arg1 useMatchLocation:(BOOL)arg2; - (id)initWithRoadMatch:(id)arg1 rawLocation:(id)arg2 useMatchLocation:(BOOL)arg3; - (id)initWithRouteMatch:(id)arg1 rawLocation:(id)arg2 useMatchLocation:(BOOL)arg3; - (BOOL)isDirectional; - (BOOL)isLeeched; - (BOOL)isProjected; - (BOOL)locationUnreliable; - (id)originalDate; - (id)propagatedLocationForTimeInterval:(double)arg1 shouldProjectAlongRoute:(BOOL)arg2; - (int)rampType; - (id)rawLocation; - (struct CLLocationCoordinate2D { double x1; double x2; })rawShiftedCoordinate; - (unsigned int)roadLineType; - (id)roadMatch; - (id)roadName; - (id)routeMatch; - (void)setDetailedMatchInfo:(id)arg1; - (void)setExpirationDate:(id)arg1; - (void)setIsDirectional:(BOOL)arg1; - (void)setIsLeeched:(BOOL)arg1; - (void)setLocationUnreliable:(BOOL)arg1; - (void)setOriginalDate:(id)arg1; - (void)setRampType:(int)arg1; - (void)setRawLocation:(id)arg1; - (void)setRawShiftedCoordinate:(struct CLLocationCoordinate2D { double x1; double x2; })arg1; - (void)setRoadLineType:(unsigned int)arg1; - (void)setRoadMatch:(id)arg1; - (void)setRoadName:(id)arg1; - (void)setRouteMatch:(id)arg1; - (void)setShieldText:(id)arg1; - (void)setShieldType:(long long)arg1; - (void)setSpeedLimit:(unsigned long long)arg1; - (void)setSpeedLimitIsMPH:(BOOL)arg1; - (void)setSpeedLimitShieldType:(long long)arg1; - (void)setState:(unsigned long long)arg1; - (id)shieldText; - (long long)shieldType; - (unsigned long long)speedLimit; - (BOOL)speedLimitIsMPH; - (long long)speedLimitShieldType; - (unsigned long long)state; - (unsigned long long)stepIndex; // MNLocation (MNLocationManagerExtras) - (int)_nav_source; // MNLocation (MNTraceRouteSimulator) - (id)initWithGEOLocation:(id)arg1; @end
debjyoti0891/map
sparta/src/EventNode.cpp
// <Counter> -*- C++ -*- /*! * \file EventNode.cpp * \brief Implements methods for EventNode class */ #include "sparta/events/EventNode.hpp" #include <memory> #include "sparta/events/EventSet.hpp" #include "sparta/utils/SpartaException.hpp" constexpr char sparta::EventSet::NODE_NAME[]; // Statistic Set void sparta::EventNode::ensureParentIsEventSet_(sparta::TreeNode* parent){ if(dynamic_cast<sparta::EventSet*>(parent) == nullptr){ throw SpartaException("EventNode ") << getLocation() << " parent node is not a EventSet. Events can only be " << "added as children of a EventSet"; } }
zhangkn/iOS14Header
System/Library/PrivateFrameworks/HomeUI.framework/HUWheelControlPopUpButton.h
<filename>System/Library/PrivateFrameworks/HomeUI.framework/HUWheelControlPopUpButton.h<gh_stars>1-10 /* * This header is generated by classdump-dyld 1.0 * on Sunday, September 27, 2020 at 11:42:59 AM Mountain Standard Time * Operating System: Version 14.0 (Build 18A373) * Image Source: /System/Library/PrivateFrameworks/HomeUI.framework/HomeUI * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by <NAME>. */ #import <UIKitCore/UIButton.h> #import <libobjc.A.dylib/HUControlView.h> @protocol HUControlViewDelegate; @class NSString, NSArray, NSFormatter; @interface HUWheelControlPopUpButton : UIButton <HUControlView> { NSString* _identifier; id<HUControlViewDelegate> _delegate; id _value; NSArray* _values; NSFormatter* _valueFormatter; } @property (nonatomic,retain) NSArray * values; //@synthesize values=_values - In the implementation block @property (nonatomic,retain) NSFormatter * valueFormatter; //@synthesize valueFormatter=_valueFormatter - In the implementation block @property (nonatomic,copy) NSString * identifier; //@synthesize identifier=_identifier - In the implementation block @property (assign,nonatomic,__weak) id<HUControlViewDelegate> delegate; //@synthesize delegate=_delegate - In the implementation block @property (nonatomic,retain) id value; //@synthesize value=_value - In the implementation block @property (assign,getter=isDisabled,nonatomic) BOOL disabled; @property (assign,nonatomic) BOOL canBeHighlighted; @property (readonly) unsigned long long hash; @property (readonly) Class superclass; @property (copy,readonly) NSString * description; @property (copy,readonly) NSString * debugDescription; +(Class)valueClass; -(void)setDisabled:(BOOL)arg1 ; -(NSString *)identifier; -(NSArray *)values; -(void)setValues:(NSArray *)arg1 ; -(BOOL)isDisabled; -(void)setValue:(id)arg1 ; -(void)setIdentifier:(NSString *)arg1 ; -(void)setDelegate:(id<HUControlViewDelegate>)arg1 ; -(id)value; -(NSFormatter *)valueFormatter; -(void)setValueFormatter:(NSFormatter *)arg1 ; -(id<HUControlViewDelegate>)delegate; -(id)_createMenu; @end
allansrc/fuchsia
tools/debug/symbolize/dump.go
// Copyright 2018 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package symbolize import ( "encoding/json" "io" ) type DumpEntry struct { Modules []Module `json:"modules"` Segments []Segment `json:"segments"` Type string `json:"type"` Name string `json:"name"` } type DumpHandler struct { dumps []DumpEntry } func (d *DumpHandler) HandleDump(dump *DumpfileElement) { triggerCtx := dump.Context() d.dumps = append(d.dumps, DumpEntry{ Modules: triggerCtx.Mods, Segments: triggerCtx.Segs, Type: dump.SinkType(), Name: dump.Name(), }) } func (d *DumpHandler) Write(buf io.Writer) error { enc := json.NewEncoder(buf) enc.SetIndent("", " ") err := enc.Encode(d.dumps) if err != nil { return err } return nil }
egraba/vbox_openbsd
VirtualBox-5.0.0/src/VBox/Devices/PC/DevApic.h
<gh_stars>1-10 /* $Id: DevApic.h $ */ /** @file * Advanced Programmable Interrupt Controller (APIC) Device Definitions. */ /* * Copyright (C) 2006-2015 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. * -------------------------------------------------------------------- * * This code is based on: * * apic.c revision 1.5 @@OSETODO * * APIC support * * Copyright (c) 2004-2005 <NAME> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ___PC_DevApic_h #define ___PC_DevApic_h /* APIC Local Vector Table */ #define APIC_LVT_TIMER 0 #define APIC_LVT_THERMAL 1 #define APIC_LVT_PERFORM 2 #define APIC_LVT_LINT0 3 #define APIC_LVT_LINT1 4 #define APIC_LVT_ERROR 5 #define APIC_LVT_NB 6 /* APIC delivery modes */ #define APIC_DM_FIXED 0 #define APIC_DM_LOWPRI 1 #define APIC_DM_SMI 2 #define APIC_DM_NMI 4 #define APIC_DM_INIT 5 #define APIC_DM_SIPI 6 #define APIC_DM_EXTINT 7 /* APIC destination mode */ #define APIC_DESTMODE_FLAT 0xf #define APIC_DESTMODE_CLUSTER 0x0 #define APIC_TRIGGER_EDGE 0 #define APIC_TRIGGER_LEVEL 1 #define APIC_LVT_TIMER_PERIODIC (1 << 17) #define APIC_LVT_MASKED (1 << 16) #define APIC_LVT_LEVEL_TRIGGER (1 << 15) #define APIC_LVT_REMOTE_IRR (1 << 14) #define APIC_INPUT_POLARITY (1 << 13) #define APIC_SEND_PENDING (1 << 12) #endif /* !___PC_DevApic_h */
azavea/ashlar-schema-editor
test/spec/views/record/details-controller.spec.js
'use strict'; describe('ase.views.record: DetailsController', function () { beforeEach(module('ase.mock.resources')); beforeEach(module('ase.views.record')); var $controller; var $httpBackend; var $rootScope; var $scope; var $stateParams; var Controller; var ResourcesMock; // Initialize the controller and a mock scope beforeEach(inject(function (_$controller_, _$httpBackend_, _$rootScope_, _$stateParams_, _ResourcesMock_) { $controller = _$controller_; $httpBackend = _$httpBackend_; $rootScope = _$rootScope_; $scope = $rootScope.$new(); $stateParams = _$stateParams_; ResourcesMock = _ResourcesMock_; })); it('should load the record', function () { var recordId = ResourcesMock.RecordResponse.results[0].uuid; $stateParams.recorduuid = recordId; var recordSchema = ResourcesMock.RecordSchema; var recordUrl = new RegExp('api/records/' + recordId + '/\\?archived=False'); var recordTypeUrl = new RegExp('api/recordtypes/.*record=' + recordId); var recordSchemaIdUrl = new RegExp('api/recordschemas/' + recordSchema.uuid); $httpBackend.expectGET(recordUrl).respond(200, ResourcesMock.RecordResponse); $httpBackend.expectGET(recordTypeUrl).respond(200, ResourcesMock.RecordTypeResponse); $httpBackend.expectGET(recordSchemaIdUrl).respond(200, recordSchema); Controller = $controller('RecordDetailsController', { $scope: $scope }); $scope.$apply(); $httpBackend.flush(); $httpBackend.verifyNoOutstandingRequest(); }); });
KitTeamSe/se_auth_server
src/main/java/com/se/authserver/v1/app/infra/repository/AppJpaRepository.java
package com.se.authserver.v1.app.infra.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.se.authserver.v1.app.domain.model.App; public interface AppJpaRepository extends JpaRepository<App, Long> { public App findByClientId(String clientId); }
Rouncer27/nose-creek-valley-museum
src/components/styles/Theme.js
<filename>src/components/styles/Theme.js<gh_stars>0 const theme = { deepSea: "#063044", neptune: "#8bc0ba", grape: "#26163b", deco: "#c4ce64", kenyanCopper: "#600002", granySmith: "#d4df67", rawSienna: "#d6685b", manatee: "#9a9b9f", frenchGrey: "#ceced0", white: "#fff", grey: "#797e83", paraGrey: "#696969;", greyLight: "#eee", black: "#000", strongred: "#f00", maxWidth: "1000px", baseLineHeight: "1.5", bpTablet: "768px", bpDesksm: "1025px", bpDeskmd: "1200px", bpDesklg: "1600px", bpMax: "1900px", fontPrim: "Open Sans", fontSec: "Libre Baskerville", fontTer: "Josefin Sans", fontAwesome: "FontAwesome", } export default theme
bpo/view_component
test/sandbox/app/components/content_areas_predicate_component.rb
<reponame>bpo/view_component<filename>test/sandbox/app/components/content_areas_predicate_component.rb # frozen_string_literal: true class ContentAreasPredicateComponent < ViewComponent::Base with_content_areas :title def initialize(title: nil, footer: nil) @title = title @footer = footer end def render? title.present? end def call content_tag :div do content_tag :h1, title end end end
BRIKEV/openapi-validator-utils
utils/existValue.js
/** @module Utils/existValue */ /** * This function validates if the value exists. We also validate possible 'undefined' value. * to use a valid one so the Ajv validator works * @param {object} value object to validate * @param {string} key object key * @returns {boolean} */ const existValue = (value, key) => { if (!value) return false; return !(value[key] === 'undefined' || !value[key]); }; module.exports = existValue;
releng-tool/releng-tool
releng_tool/tool/tar.py
# -*- coding: utf-8 -*- # Copyright 2018-2021 releng-tool from releng_tool.tool import RelengTool #: executable used to run tar commands TAR_COMMAND = 'tar' #: list of environment keys to filter from a environment dictionary TAR_SANITIZE_ENV_KEYS = [ 'TAR_OPTIONS', ] #: tar host tool helper TAR = RelengTool(TAR_COMMAND, env_sanitize=TAR_SANITIZE_ENV_KEYS)
VHAINNOVATIONS/Telepathology
Source/Java/ImagingCommon/main/src/java/gov/va/med/CoreURNProvider.java
/** * Package: MAG - VistA Imaging WARNING: Per VHA Directive 2004-038, this routine should not be modified. Date Created: Jun 30, 2011 Site Name: Washington OI Field Office, Silver Spring, MD Developer: VHAISWWERFEJ Description: ;; +--------------------------------------------------------------------+ ;; Property of the US Government. ;; No permission to copy or redistribute this software is given. ;; Use of unreleased versions of this software requires the user ;; to execute a written test agreement with the VistA Imaging ;; Development Office of the Department of Veterans Affairs, ;; telephone (301) 734-0100. ;; ;; The Food and Drug Administration classifies this software as ;; a Class II medical device. As such, it may not be changed ;; in any way. Modifications to this software may result in an ;; adulterated medical device under 21CFR820, the use of which ;; is considered to be a violation of US Federal Statutes. ;; +--------------------------------------------------------------------+ */ package gov.va.med; import gov.va.med.imaging.BhieImageURN; import gov.va.med.imaging.BhieStudyURN; import gov.va.med.imaging.DocumentSetURN; import gov.va.med.imaging.DocumentURN; import gov.va.med.imaging.ImageURN; import gov.va.med.imaging.StudyURN; /** * Registers "core" URN classes for VISA implementations * @author VHAISWWERFEJ * */ public class CoreURNProvider extends URNProvider { public CoreURNProvider() { super(); } @SuppressWarnings("unchecked") @Override protected Class<? extends URN>[] getUrnClasses() { return new Class [] { StudyURN.class, DocumentSetURN.class, ImageURN.class, DocumentURN.class, BhieImageURN.class, BhieStudyURN.class, PatientArtifactIdentifierImpl.class, GlobalArtifactIdentifierImpl.class, HealthSummaryURN.class }; } }
sandrew1945/bury
bury-core/src/test/java/com/sandrew/bury/model/TtTest.java
<reponame>sandrew1945/bury /** * 自动生成的PO,不要手动修改 * */ package com.sandrew.bury.model; import com.sandrew.bury.annotations.TableName; import com.sandrew.bury.annotations.ColumnName; import com.sandrew.bury.bean.PO; import com.sandrew.bury.bean.Pack; import com.sandrew.bury.bean.EqualPack; @TableName("tt_test") public class TtTest extends PO { public TtTest() { } public TtTest(Integer id) { if (null == this.id) { this.id = new EqualPack<Integer>(); } this.id.setValue(id); } @ColumnName(value = "id", isPK = true, autoIncrement = true) private Pack<Integer> id; @ColumnName(value = "sd", isPK = false, autoIncrement = false) private Pack<Integer> sd; @ColumnName(value = "has_info", isPK = false, autoIncrement = false) private Pack<Boolean> hasInfo; @ColumnName(value = "file", isPK = false, autoIncrement = false) private Pack<byte[]> file; public void setId(Integer id) { if (null == this.id) { this.id = new EqualPack<Integer>(); } this.id.setValue(id); } public void setId(Pack<Integer> id) { this.id = id; } public Integer getId() { return this.id == null ? null : this.id.getValue(); } public void setSd(Integer sd) { if (null == this.sd) { this.sd = new EqualPack<Integer>(); } this.sd.setValue(sd); } public void setSd(Pack<Integer> sd) { this.sd = sd; } public Integer getSd() { return this.sd == null ? null : this.sd.getValue(); } public void setHasInfo(Boolean hasInfo) { if (null == this.hasInfo) { this.hasInfo = new EqualPack<Boolean>(); } this.hasInfo.setValue(hasInfo); } public void setHasInfo(Pack<Boolean> hasInfo) { this.hasInfo = hasInfo; } public Boolean getHasInfo() { return this.hasInfo == null ? null : this.hasInfo.getValue(); } public void setFile(byte[] file) { if (null == this.file) { this.file = new EqualPack<byte[]>(); } this.file.setValue(file); } public void setFile(Pack<byte[]> file) { this.file = file; } public byte[] getFile() { return this.file == null ? null : this.file.getValue(); } }
foxostro/CheeseTesseract
src/ComponentDeathBehavior.h
#ifndef COMPONENT_DEATH_BEHAVIOR_H #define COMPONENT_DEATH_BEHAVIOR_H #include "PropertyBag.h" #include "Component.h" #include "DeathBehavior.h" #include "EventCharacterRevived.h" #include "EventDeathBehaviorUpdate.h" /** Contains actor settings pertaining to character behavior on death */ class ComponentDeathBehavior : public Component { public: virtual string getTypeString() const { return "DeathBehavior"; } ComponentDeathBehavior(UID uid, ScopedEventHandler *blackBoard); /** Resets all object members to defaults */ virtual void resetMembers(); /** Loads component data from the pool of all object data */ virtual void load(const PropertyBag &data); /** Updates component each tick @param milliseconds Time since the last tick */ virtual void update(float) { /* Do Nothing */ } /** Gets character death behavior */ DeathBehavior getDeathBehavior() const { return deathBehavior; } private: void handleEventCharacterRevived(const EventCharacterRevived *message); void handleEventDeathBehaviorUpdate(const EventDeathBehaviorUpdate *message); static DeathBehavior deathBehaviorFromString(const string &_s); /** Sends death behavior to other components when value is updated */ void broadcastDeathBehavior() { EventDeathBehaviorUpdate m(deathBehavior); sendEvent(&m); } private: DeathBehavior deathBehavior; }; #endif
isabella232/stdcxx
tests/utilities/20.operators.cpp
/*************************************************************************** * * 20.operators.cpp - test exercising [lib.operators] * * $Id$ * *************************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you 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. * * Copyright 1994-2006 Rogue Wave Software. * **************************************************************************/ // The test exercises the ability to specialize various components of // the library (algorithms and containers in particular) on user-defined // iterator types in the presence of using directives. #include <rw/_config.h> #if defined (__IBMCPP__) && !defined (_RWSTD_NO_IMPLICIT_INCLUSION) // Disable implicit inclusion to work around // a limitation in IBM's VisualAge 5.0.2.0 (see PR#26959) # define _RWSTD_NO_IMPLICIT_INCLUSION #endif #if 0 // def _MSC_VER // disabled (warnings may be meaningful) # pragma warning (disable: 4800) # pragma warning (disable: 4805) #endif // _MSC_VER #include <algorithm> #include <deque> #include <functional> #include <iterator> #include <list> #include <map> #include <set> #include <string> #include <vector> #include <utility> #include <cstddef> // for std::size_t #include <rw_driver.h> /**************************************************************************/ _USING (namespace std); _USING (namespace std::rel_ops); #ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION // explicitly instantiate containers template class std::deque<int, std::allocator<int> >; template class std::list<int,std::allocator<int> >; template class std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int> > >; template class std::set<int>; template class std::basic_string<int, std::char_traits<int>, std::allocator<int> >; template class std::vector<int, std::allocator<int> >; #endif // _RWSTD_NO_EXPLICIT_INSTANTIATION /**************************************************************************/ #if !defined (__SUNPRO_CC) || __SUNPRO_CC > 0x530 # define FUN(ignore, result, name, arg_list) do { \ result (*pf) arg_list = &name; \ _RWSTD_UNUSED (pf); \ } while (0) #else // working around a SunPro 5.3 bug (see PR #25972) that prevents it // from taking the address of a function template in template code # define FUN(T, result, name, arg_list) do { \ typedef typename T::iterator Iterator; \ typedef typename T::const_iterator ConstIterator; \ const Iterator *pi = 0; \ const ConstIterator *pci = 0; \ name (pi, pi); \ name (pci, pci); \ } while (0) #endif // SunPro 5.3 #define TEST_INEQUALITY(T) \ FUN (T, bool, std::rel_ops::operator!=, \ (const T::iterator&, const T::iterator&)); \ FUN (T, bool, std::rel_ops::operator!=, \ (const T::const_iterator&, const T::const_iterator&)) #define TEST_OPERATORS(T) \ TEST_INEQUALITY (T); \ FUN (T, bool, std::rel_ops::operator>, \ (const T::iterator&, const T::iterator&)); \ FUN (T, bool, std::rel_ops::operator<=, \ (const T::iterator&, const T::iterator&)); \ FUN (T, bool, std::rel_ops::operator>=, \ (const T::iterator&, const T::iterator&)); \ FUN (T, bool, std::rel_ops::operator>, \ (const T::const_iterator&, const T::const_iterator&)); \ FUN (T, bool, std::rel_ops::operator<=, \ (const T::const_iterator&, const T::const_iterator&)); \ FUN (T, bool, std::rel_ops::operator>=, \ (const T::const_iterator&, const T::const_iterator&)) template <class Container, class RandomAccessIterator> void test_iterator (Container, RandomAccessIterator) { TEST_OPERATORS (typename Container); } template <class Container> void test_iterator (Container, int*) { // cannot specialize std::rel_ops::operators on native types // or pointers to such things } /**************************************************************************/ template <class T> struct UnaryPredicate { bool operator() (const T&) const { return true; } }; template <class T> struct BinaryPredicate { bool operator() (const T&, const T&) const { return true; } }; template <class T> struct RandomNumberGenerator { T operator() (T) const { return T (); } }; template <class T> struct Generator { T operator() () const { return T (); } }; template <class T> struct UnaryFunction { T operator() (const T &t) const { return t; } }; template <class T> struct BinaryFunction { T operator() (const T &t, const T&) const { return t; } }; /**************************************************************************/ template <class T, class InputIterator> void test_input_iterators (T, InputIterator) { // do not run (compile only), prevent warnings about unreachable code static int count = 0; if (++count) return; typedef InputIterator I; std::for_each (I (), I (), UnaryFunction<T>()); std::find (I (), I (), T ()); std::find_if (I (), I (), UnaryPredicate<T>()); #ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC std::count (I (), I (), T ()); std::count_if (I (), I (), UnaryPredicate<T>()); #else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) std::size_t n = 0; std::count (I (), I (), T (), n); std::count_if (I (), I (), UnaryPredicate<T>(), n); #endif // _RWSTD_NO_CLASS_PARTIAL_SPEC std::mismatch (I (), I (), I ()); std::mismatch (I (), I (), I (), BinaryPredicate<T>()); std::equal (I (), I (), I ()); std::equal (I (), I (), I (), BinaryPredicate<T>()); std::includes (I (), I (), I (), I ()); std::includes (I (), I (), I (), I (), BinaryPredicate<T>()); std::lexicographical_compare (I (), I (), I (), I ()); std::lexicographical_compare (I (), I (), I (), I (), BinaryPredicate<T>()); } /**************************************************************************/ template <class T, class OutputIterator> void test_output_iterators (T, OutputIterator) { // do not run (compile only), prevent warnings about unreachable code static int count = 0; if (++count) return; typedef OutputIterator I; std::copy (I (), I (), I ()); std::copy_backward (I (), I (), I ()); std::transform (I (), I (), I (), UnaryFunction<T>()); std::transform (I (), I (), I (), I (), BinaryFunction<T>()); std::replace_copy (I (), I (), I (), T (), T ()); std::replace_copy_if (I (), I (), I (), UnaryPredicate<T>(), T ()); std::merge (I (), I (), I (), I (), I ()); std::merge (I (), I (), I (), I (), I (), BinaryPredicate<T>()); std::set_union (I (), I (), I (), I (), I ()); std::set_union (I (), I (), I (), I (), I (), BinaryPredicate<T>()); std::set_intersection (I (), I (), I (), I (), I ()); std::set_intersection (I (), I (), I (), I (), I (), BinaryPredicate<T>()); std::set_difference (I (), I (), I (), I (), I ()); std::set_difference (I (), I (), I (), I (), I (), BinaryPredicate<T>()); std::set_symmetric_difference (I (), I (), I (), I (), I ()); std::set_symmetric_difference (I (), I (), I (), I (), I (), BinaryPredicate<T>()); std::fill_n (I (), 0, T ()); std::generate_n (I (), 0, Generator<T>()); std::remove_copy (I (), I (), I (), T ()); std::remove_copy_if (I (), I (), I (), UnaryPredicate<T>()); std::unique_copy (I (), I (), I ()); std::unique_copy (I (), I (), I (), BinaryPredicate<T>()); std::reverse_copy (I (), I (), I ()); std::rotate_copy (I (), I (), I (), I ()); } /**************************************************************************/ template <class T, class ForwardIterator> void test_forward_iterators (T, ForwardIterator) { // do not run (compile only), prevent warnings about unreachable code static int count = 0; if (++count) return; typedef ForwardIterator I; std::find_end (I (), I (), I (), I ()); std::find_end (I (), I (), I (), I (), BinaryPredicate<T>()); std::find_first_of (I (), I (), I (), I ()); std::find_first_of (I (), I (), I (), I (), BinaryPredicate<T>()); std::adjacent_find (I (), I ()); std::adjacent_find (I (), I (), BinaryPredicate<T>()); std::search (I (), I (), I (), I ()); std::search (I (), I (), I (), I (), BinaryPredicate<T>()); std::search_n (I (), I (), 0, T ()); std::search_n (I (), I (), 0, T (), BinaryPredicate<T>()); std::swap_ranges (I (), I (), I ()); std::iter_swap (I (), I ()); std::replace (I (), I (), T (), T ()); std::replace_if (I (), I (), UnaryPredicate<T>(), T ()); std::equal_range (I (), I (), T ()); std::equal_range (I (), I (), T (), BinaryPredicate<T>()); std::binary_search (I (), I (), T ()); std::binary_search (I (), I (), T (), BinaryPredicate<T>()); std::min_element (I (), I ()); std::min_element (I (), I (), BinaryPredicate<T>()); std::max_element (I (), I ()); std::max_element (I (), I (), BinaryPredicate<T>()); std::fill (I (), I (), T ()); std::generate (I (), I (), Generator<T>()); std::remove (I (), I (), T ()); std::remove_if (I (), I (), UnaryPredicate<T>()); std::unique (I (), I ()); std::unique (I (), I (), BinaryPredicate<T>()); std::reverse (I (), I ()); std::rotate (I (), I (), I ()); } /**************************************************************************/ template <class T, class BidirectionalIterator> void test_bidirectional_iterators (T, BidirectionalIterator) { // do not run (compile only), prevent warnings about unreachable code static int count = 0; if (++count) return; typedef BidirectionalIterator I; std::partition (I (), I (), UnaryPredicate<T>()); std::stable_partition (I (), I (), UnaryPredicate<T>()); std::lower_bound (I (), I (), T ()); std::lower_bound (I (), I (), T (), BinaryPredicate<T>()); std::upper_bound (I (), I (), T ()); std::upper_bound (I (), I (), T (), BinaryPredicate<T>()); std::inplace_merge (I (), I (), I ()); std::inplace_merge (I (), I (), I (), BinaryPredicate<T>()); std::next_permutation (I (), I ()); std::next_permutation (I (), I (), BinaryPredicate<T>()); std::prev_permutation (I (), I ()); std::prev_permutation (I (), I (), BinaryPredicate<T>()); } /**************************************************************************/ template <class T, class RandomAccessIterator> void test_random_access_iterators (T, RandomAccessIterator) { // do not run (compile only), prevent warnings about unreachable code static int count = 0; if (++count) return; typedef RandomAccessIterator I; #if !defined _RWSTD_NO_DEBUG_ITER RandomNumberGenerator<typename I::difference_type> rndgen; #else RandomNumberGenerator<T> rndgen; #endif std::random_shuffle (I (), I ()); std::random_shuffle (I (), I (), rndgen); std::sort (I (), I ()); std::sort (I (), I (), BinaryPredicate<T>()); std::stable_sort (I (), I ()); std::stable_sort (I (), I (), BinaryPredicate<T>()); std::partial_sort (I (), I (), I ()); std::partial_sort (I (), I (), I (), BinaryPredicate<T>()); std::partial_sort_copy (I (), I (), I (), I ()); std::partial_sort_copy (I (), I (), I (), I (), BinaryPredicate<T>()); std::nth_element (I (), I (), I ()); std::nth_element (I (), I (), I (), BinaryPredicate<T>()); std::push_heap (I (), I (), BinaryPredicate<T>()); std::pop_heap (I (), I (), BinaryPredicate<T>()); std::make_heap (I (), I (), BinaryPredicate<T>()); std::sort_heap (I (), I (), BinaryPredicate<T>()); } /**************************************************************************/ static int run_test (int, char**) { typedef std::map<int, int> Map; typedef std::multimap<int, int> MultiMap; // verify that rel_ops operators can be instantiated // on iterators of the containers below TEST_OPERATORS (std::deque<int>); TEST_INEQUALITY (std::list<int>); TEST_INEQUALITY (Map); TEST_INEQUALITY (MultiMap); TEST_INEQUALITY (std::set<int>); TEST_INEQUALITY (std::multiset<int>); #if !defined (_MSC_VER) || _MSC_VER > 1300 // prevent from testing with the braindead MSVC 6 and 7 // as a workaround for compiler bugs (PR #16828, 22268) // prevent attempts to specialize rel_ops operators on // native types (or pointers to such things) test_iterator (std::basic_string<int>(), std::basic_string<int>::iterator ()); test_iterator (std::vector<int>(), std::vector<int>::iterator ()); #endif // MSVC > 7.0 TEST_OPERATORS (std::vector<bool>); #define TEST_INPUT_ITERATORS(T) \ test_input_iterators (T (), std::deque<T>::iterator ()); \ test_input_iterators (T (), std::list<T>::iterator ()); \ test_input_iterators (std::map<T, T>::value_type (), \ std::map<T, T>::iterator ()); \ test_input_iterators (std::multimap<T, T>::value_type (), \ std::multimap<T, T>::iterator ()); \ test_input_iterators (T (), std::set<T>::iterator ()); \ test_input_iterators (T (), std::multiset<T, T>::iterator ()); \ test_input_iterators (T (), std::basic_string<T>::iterator ()); \ test_input_iterators (T (), std::vector<T>::iterator ()) #define TEST_OUTPUT_ITERATORS(T) \ test_output_iterators (T (), std::deque<T>::iterator ()); \ test_output_iterators (T (), std::list<T>::iterator ()); \ test_output_iterators (T (), std::basic_string<T>::iterator ()); \ test_output_iterators (T (), std::vector<T>::iterator ()) #define TEST_FORWARD_ITERATORS(T) \ test_forward_iterators (T (), std::deque<T>::iterator ()); \ test_forward_iterators (T (), std::list<T>::iterator ()); \ test_forward_iterators (T (), std::basic_string<T>::iterator ()); \ test_forward_iterators (T (), std::vector<T>::iterator ()) #define TEST_BIDIRECTIONAL_ITERATORS(T) \ test_bidirectional_iterators (T (), std::deque<T>::iterator ()); \ test_bidirectional_iterators (T (), std::list<T>::iterator ()); \ test_bidirectional_iterators (T (), std::basic_string<T>::iterator ()); \ test_bidirectional_iterators (T (), std::vector<T>::iterator ()) #define TEST_RANDOM_ACCESS_ITERATORS(T) \ test_random_access_iterators (T (), std::deque<T>::iterator ()); \ test_random_access_iterators (T (), std::basic_string<T>::iterator ()); \ test_random_access_iterators (T (), std::vector<T>::iterator ()); \ // verify that algorithms can be specialized on container // iterators without causing ambiguities with rel_ops TEST_INPUT_ITERATORS (int); TEST_OUTPUT_ITERATORS (int); TEST_FORWARD_ITERATORS (int); TEST_BIDIRECTIONAL_ITERATORS (int); TEST_RANDOM_ACCESS_ITERATORS (int); #if !defined (__HP_aCC) || _RWSTD_HP_aCC_MINOR > 3600 // working around an HP aCC bug (PR #28331) TEST_INPUT_ITERATORS (bool); TEST_OUTPUT_ITERATORS (bool); TEST_FORWARD_ITERATORS (bool); TEST_BIDIRECTIONAL_ITERATORS (bool); TEST_RANDOM_ACCESS_ITERATORS (bool); #endif // HP aCC > x.36 return 0; } /**************************************************************************/ int main (int argc, char *argv[]) { return rw_test (argc, argv, __FILE__, "lib.operators", "interactions with the rest of the implementation", run_test, 0 /* no command line options */); }
jjfiv/chai
src/main/java/ciir/jfoley/chai/io/inputs/InputFinder.java
package ciir.jfoley.chai.io.inputs; import ciir.jfoley.chai.fn.SinkFn; import ciir.jfoley.chai.io.Directory; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Vector; import java.util.logging.Logger; /** * @author jfoley */ public class InputFinder { public static final Logger logger = Logger.getLogger(InputFinder.class.getName()); public final List<FileHandler> handlers; public static List<FileHandler> defaultHandlers = new Vector<>(); static { defaultHandlers.add(new ZipInputHandler()); defaultHandlers.add(new TarInputHandler()); } public static InputFinder Default() { return new InputFinder(defaultHandlers); } public InputFinder(List<FileHandler> handlers) { this.handlers = handlers; } public interface FileHandler { boolean matches(File input); InputContainer getContainer(File input) throws IOException; } public List<? extends InputContainer> findAllInputs(List<String> paths) throws IOException { ArrayList<InputContainer> output = new ArrayList<>(); for (String path : paths) { output.addAll(findAllInputs(path)); } return output; } public List<? extends InputContainer> findAllInputs(String path) throws IOException { File fp = new File(path); if(fp.isDirectory()) { return findAllInputs(Directory.Read(path)); } else { return Collections.singletonList(asInputContainer(fp)); } } public List<? extends InputContainer> findAllInputs(Directory dir) throws IOException { ArrayList<InputContainer> output = new ArrayList<>(); for (File child : dir.recursiveChildren()) { output.add(asInputContainer(child)); } return output; } public void forEachPath(List<String> inputs, SinkFn<InputStreamable> output) throws IOException { forEach(findAllInputs(inputs), output); } public void forEach(List<? extends InputContainer> inputs, SinkFn<InputStreamable> output) throws IOException { for (InputContainer inputContainer : inputs) { for (InputStreamable inputStreamable : inputContainer.getInputs()) { output.process(inputStreamable); } } } public InputContainer asInputContainer(File child) throws IOException { for (FileHandler handler : this.handlers) { if(handler.matches(child)) { return handler.getContainer(child); } } return new SingletonInputContainer(child.getName(), new FileInput(child)); } }
GoFly-wenxue/TiebaLite
app/src/main/java/com/huanchengfly/tieba/post/utils/UploadHelper.java
<reponame>GoFly-wenxue/TiebaLite<gh_stars>1-10 package com.huanchengfly.tieba.post.utils; import android.content.Context; import com.huanchengfly.tieba.api.TiebaApi; import com.huanchengfly.tieba.api.models.WebUploadPicBean; import com.huanchengfly.tieba.post.interfaces.UploadCallback; import com.huanchengfly.tieba.post.models.PhotoInfoBean; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class UploadHelper { public static final String TAG = UploadHelper.class.getSimpleName(); private Context mContext; private List<PhotoInfoBean> fileList; private List<PhotoInfoBean> uploadList; private UploadCallback callback; private int now; private UploadHelper(Context context) { this.mContext = context; this.now = 0; } public static UploadHelper with(Context context) { return new UploadHelper(context); } private void upload() { if (callback == null) return; if (now >= uploadList.size()) { callback.onSuccess(fileList); return; } PhotoInfoBean photoInfoBean = uploadList.get(now); if (photoInfoBean.getFileUri() == null) { callback.onFailure("文件对象为空"); return; } if (photoInfoBean.getWebUploadPicBean() != null) { callback.onProgress(this.now + 1, uploadList.size()); next(); return; } TiebaApi.getInstance() .webUploadPic(photoInfoBean) .enqueue(new Callback<WebUploadPicBean>() { @Override public void onResponse(@NotNull Call<WebUploadPicBean> call, @NotNull Response<WebUploadPicBean> response) { photoInfoBean.setWebUploadPicBean(response.body()); callback.onProgress(now + 1, uploadList.size()); next(); } @Override public void onFailure(@NotNull Call<WebUploadPicBean> call, @NotNull Throwable t) { callback.onFailure(t.getMessage()); } }); } public void start() { if (callback == null) return; if (fileList.isEmpty()) { callback.onFailure("文件列表为空"); return; } uploadList = new ArrayList<>(); for (PhotoInfoBean photoInfoBean : fileList) { if (photoInfoBean.getFile() != null && /*photoInfoBean.getUploadResult() == null*/ photoInfoBean.getWebUploadPicBean() == null) { uploadList.add(photoInfoBean); } } if (!uploadList.isEmpty()) { this.now = 0; callback.onStart(uploadList.size()); upload(); } else { callback.onSuccess(fileList); } } private void next() { this.now += 1; upload(); } public UploadHelper setFileList(List<PhotoInfoBean> fileList) { this.fileList = fileList; return this; } public UploadHelper setCallback(UploadCallback callback) { this.callback = callback; return this; } }
TRON-US/protobuf
proto/test_proto/test.pb.go
<gh_stars>0 // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: test.proto package test_proto import ( fmt "fmt" proto "github.com/tron-us/protobuf/proto" math "math" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type FOO int32 const ( FOO_FOO1 FOO = 1 ) var FOO_name = map[int32]string{ 1: "FOO1", } var FOO_value = map[string]int32{ "FOO1": 1, } func (x FOO) Enum() *FOO { p := new(FOO) *p = x return p } func (x FOO) String() string { return proto.EnumName(FOO_name, int32(x)) } func (x *FOO) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(FOO_value, data, "FOO") if err != nil { return err } *x = FOO(value) return nil } func (FOO) EnumDescriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{0} } // An enum, for completeness. type GoTest_KIND int32 const ( GoTest_VOID GoTest_KIND = 0 // Basic types GoTest_BOOL GoTest_KIND = 1 GoTest_BYTES GoTest_KIND = 2 GoTest_FINGERPRINT GoTest_KIND = 3 GoTest_FLOAT GoTest_KIND = 4 GoTest_INT GoTest_KIND = 5 GoTest_STRING GoTest_KIND = 6 GoTest_TIME GoTest_KIND = 7 // Groupings GoTest_TUPLE GoTest_KIND = 8 GoTest_ARRAY GoTest_KIND = 9 GoTest_MAP GoTest_KIND = 10 // Table types GoTest_TABLE GoTest_KIND = 11 // Functions GoTest_FUNCTION GoTest_KIND = 12 ) var GoTest_KIND_name = map[int32]string{ 0: "VOID", 1: "BOOL", 2: "BYTES", 3: "FINGERPRINT", 4: "FLOAT", 5: "INT", 6: "STRING", 7: "TIME", 8: "TUPLE", 9: "ARRAY", 10: "MAP", 11: "TABLE", 12: "FUNCTION", } var GoTest_KIND_value = map[string]int32{ "VOID": 0, "BOOL": 1, "BYTES": 2, "FINGERPRINT": 3, "FLOAT": 4, "INT": 5, "STRING": 6, "TIME": 7, "TUPLE": 8, "ARRAY": 9, "MAP": 10, "TABLE": 11, "FUNCTION": 12, } func (x GoTest_KIND) Enum() *GoTest_KIND { p := new(GoTest_KIND) *p = x return p } func (x GoTest_KIND) String() string { return proto.EnumName(GoTest_KIND_name, int32(x)) } func (x *GoTest_KIND) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(GoTest_KIND_value, data, "GoTest_KIND") if err != nil { return err } *x = GoTest_KIND(value) return nil } func (GoTest_KIND) EnumDescriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{2, 0} } type MyMessage_Color int32 const ( MyMessage_RED MyMessage_Color = 0 MyMessage_GREEN MyMessage_Color = 1 MyMessage_BLUE MyMessage_Color = 2 ) var MyMessage_Color_name = map[int32]string{ 0: "RED", 1: "GREEN", 2: "BLUE", } var MyMessage_Color_value = map[string]int32{ "RED": 0, "GREEN": 1, "BLUE": 2, } func (x MyMessage_Color) Enum() *MyMessage_Color { p := new(MyMessage_Color) *p = x return p } func (x MyMessage_Color) String() string { return proto.EnumName(MyMessage_Color_name, int32(x)) } func (x *MyMessage_Color) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(MyMessage_Color_value, data, "MyMessage_Color") if err != nil { return err } *x = MyMessage_Color(value) return nil } func (MyMessage_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{13, 0} } type DefaultsMessage_DefaultsEnum int32 const ( DefaultsMessage_ZERO DefaultsMessage_DefaultsEnum = 0 DefaultsMessage_ONE DefaultsMessage_DefaultsEnum = 1 DefaultsMessage_TWO DefaultsMessage_DefaultsEnum = 2 ) var DefaultsMessage_DefaultsEnum_name = map[int32]string{ 0: "ZERO", 1: "ONE", 2: "TWO", } var DefaultsMessage_DefaultsEnum_value = map[string]int32{ "ZERO": 0, "ONE": 1, "TWO": 2, } func (x DefaultsMessage_DefaultsEnum) Enum() *DefaultsMessage_DefaultsEnum { p := new(DefaultsMessage_DefaultsEnum) *p = x return p } func (x DefaultsMessage_DefaultsEnum) String() string { return proto.EnumName(DefaultsMessage_DefaultsEnum_name, int32(x)) } func (x *DefaultsMessage_DefaultsEnum) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(DefaultsMessage_DefaultsEnum_value, data, "DefaultsMessage_DefaultsEnum") if err != nil { return err } *x = DefaultsMessage_DefaultsEnum(value) return nil } func (DefaultsMessage_DefaultsEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{16, 0} } type Defaults_Color int32 const ( Defaults_RED Defaults_Color = 0 Defaults_GREEN Defaults_Color = 1 Defaults_BLUE Defaults_Color = 2 ) var Defaults_Color_name = map[int32]string{ 0: "RED", 1: "GREEN", 2: "BLUE", } var Defaults_Color_value = map[string]int32{ "RED": 0, "GREEN": 1, "BLUE": 2, } func (x Defaults_Color) Enum() *Defaults_Color { p := new(Defaults_Color) *p = x return p } func (x Defaults_Color) String() string { return proto.EnumName(Defaults_Color_name, int32(x)) } func (x *Defaults_Color) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(Defaults_Color_value, data, "Defaults_Color") if err != nil { return err } *x = Defaults_Color(value) return nil } func (Defaults_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{21, 0} } type RepeatedEnum_Color int32 const ( RepeatedEnum_RED RepeatedEnum_Color = 1 ) var RepeatedEnum_Color_name = map[int32]string{ 1: "RED", } var RepeatedEnum_Color_value = map[string]int32{ "RED": 1, } func (x RepeatedEnum_Color) Enum() *RepeatedEnum_Color { p := new(RepeatedEnum_Color) *p = x return p } func (x RepeatedEnum_Color) String() string { return proto.EnumName(RepeatedEnum_Color_name, int32(x)) } func (x *RepeatedEnum_Color) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(RepeatedEnum_Color_value, data, "RepeatedEnum_Color") if err != nil { return err } *x = RepeatedEnum_Color(value) return nil } func (RepeatedEnum_Color) EnumDescriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{23, 0} } type GoEnum struct { Foo *FOO `protobuf:"varint,1,req,name=foo,enum=test_proto.FOO" json:"foo,omitempty" pg:"foo"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GoEnum) Reset() { *m = GoEnum{} } func (m *GoEnum) String() string { return proto.CompactTextString(m) } func (*GoEnum) ProtoMessage() {} func (*GoEnum) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{0} } func (m *GoEnum) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GoEnum.Unmarshal(m, b) } func (m *GoEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GoEnum.Marshal(b, m, deterministic) } func (m *GoEnum) XXX_Merge(src proto.Message) { xxx_messageInfo_GoEnum.Merge(m, src) } func (m *GoEnum) XXX_Size() int { return xxx_messageInfo_GoEnum.Size(m) } func (m *GoEnum) XXX_DiscardUnknown() { xxx_messageInfo_GoEnum.DiscardUnknown(m) } var xxx_messageInfo_GoEnum proto.InternalMessageInfo func (m *GoEnum) GetFoo() FOO { if m != nil && m.Foo != nil { return *m.Foo } return FOO_FOO1 } type GoTestField struct { Label *string `protobuf:"bytes,1,req,name=Label" json:"Label,omitempty" pg:"Label"` Type *string `protobuf:"bytes,2,req,name=Type" json:"Type,omitempty" pg:"Type"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GoTestField) Reset() { *m = GoTestField{} } func (m *GoTestField) String() string { return proto.CompactTextString(m) } func (*GoTestField) ProtoMessage() {} func (*GoTestField) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{1} } func (m *GoTestField) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GoTestField.Unmarshal(m, b) } func (m *GoTestField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GoTestField.Marshal(b, m, deterministic) } func (m *GoTestField) XXX_Merge(src proto.Message) { xxx_messageInfo_GoTestField.Merge(m, src) } func (m *GoTestField) XXX_Size() int { return xxx_messageInfo_GoTestField.Size(m) } func (m *GoTestField) XXX_DiscardUnknown() { xxx_messageInfo_GoTestField.DiscardUnknown(m) } var xxx_messageInfo_GoTestField proto.InternalMessageInfo func (m *GoTestField) GetLabel() string { if m != nil && m.Label != nil { return *m.Label } return "" } func (m *GoTestField) GetType() string { if m != nil && m.Type != nil { return *m.Type } return "" } type GoTest struct { // Some typical parameters Kind *GoTest_KIND `protobuf:"varint,1,req,name=Kind,enum=test_proto.GoTest_KIND" json:"Kind,omitempty" pg:"Kind"` Table *string `protobuf:"bytes,2,opt,name=Table" json:"Table,omitempty" pg:"Table"` Param *int32 `protobuf:"varint,3,opt,name=Param" json:"Param,omitempty" pg:"Param"` // Required, repeated and optional foreign fields. RequiredField *GoTestField `protobuf:"bytes,4,req,name=RequiredField" json:"RequiredField,omitempty" pg:"RequiredField"` RepeatedField []*GoTestField `protobuf:"bytes,5,rep,name=RepeatedField" json:"RepeatedField,omitempty" pg:"RepeatedField"` OptionalField *GoTestField `protobuf:"bytes,6,opt,name=OptionalField" json:"OptionalField,omitempty" pg:"OptionalField"` // Required fields of all basic types F_BoolRequired *bool `protobuf:"varint,10,req,name=F_Bool_required,json=FBoolRequired" json:"F_Bool_required,omitempty" pg:"F_Bool_required"` F_Int32Required *int32 `protobuf:"varint,11,req,name=F_Int32_required,json=FInt32Required" json:"F_Int32_required,omitempty" pg:"F_Int32_required"` F_Int64Required *int64 `protobuf:"varint,12,req,name=F_Int64_required,json=FInt64Required" json:"F_Int64_required,omitempty" pg:"F_Int64_required"` F_Fixed32Required *uint32 `protobuf:"fixed32,13,req,name=F_Fixed32_required,json=FFixed32Required" json:"F_Fixed32_required,omitempty" pg:"F_Fixed32_required"` F_Fixed64Required *uint64 `protobuf:"fixed64,14,req,name=F_Fixed64_required,json=FFixed64Required" json:"F_Fixed64_required,omitempty" pg:"F_Fixed64_required"` F_Uint32Required *uint32 `protobuf:"varint,15,req,name=F_Uint32_required,json=FUint32Required" json:"F_Uint32_required,omitempty" pg:"F_Uint32_required"` F_Uint64Required *uint64 `protobuf:"varint,16,req,name=F_Uint64_required,json=FUint64Required" json:"F_Uint64_required,omitempty" pg:"F_Uint64_required"` F_FloatRequired *float32 `protobuf:"fixed32,17,req,name=F_Float_required,json=FFloatRequired" json:"F_Float_required,omitempty" pg:"F_Float_required"` F_DoubleRequired *float64 `protobuf:"fixed64,18,req,name=F_Double_required,json=FDoubleRequired" json:"F_Double_required,omitempty" pg:"F_Double_required"` F_StringRequired *string `protobuf:"bytes,19,req,name=F_String_required,json=FStringRequired" json:"F_String_required,omitempty" pg:"F_String_required"` F_BytesRequired []byte `protobuf:"bytes,101,req,name=F_Bytes_required,json=FBytesRequired" json:"F_Bytes_required,omitempty" pg:"F_Bytes_required"` F_Sint32Required *int32 `protobuf:"zigzag32,102,req,name=F_Sint32_required,json=FSint32Required" json:"F_Sint32_required,omitempty" pg:"F_Sint32_required"` F_Sint64Required *int64 `protobuf:"zigzag64,103,req,name=F_Sint64_required,json=FSint64Required" json:"F_Sint64_required,omitempty" pg:"F_Sint64_required"` F_Sfixed32Required *int32 `protobuf:"fixed32,104,req,name=F_Sfixed32_required,json=FSfixed32Required" json:"F_Sfixed32_required,omitempty" pg:"F_Sfixed32_required"` F_Sfixed64Required *int64 `protobuf:"fixed64,105,req,name=F_Sfixed64_required,json=FSfixed64Required" json:"F_Sfixed64_required,omitempty" pg:"F_Sfixed64_required"` // Repeated fields of all basic types F_BoolRepeated []bool `protobuf:"varint,20,rep,name=F_Bool_repeated,json=FBoolRepeated" json:"F_Bool_repeated,omitempty" pg:"F_Bool_repeated"` F_Int32Repeated []int32 `protobuf:"varint,21,rep,name=F_Int32_repeated,json=FInt32Repeated" json:"F_Int32_repeated,omitempty" pg:"F_Int32_repeated"` F_Int64Repeated []int64 `protobuf:"varint,22,rep,name=F_Int64_repeated,json=FInt64Repeated" json:"F_Int64_repeated,omitempty" pg:"F_Int64_repeated"` F_Fixed32Repeated []uint32 `protobuf:"fixed32,23,rep,name=F_Fixed32_repeated,json=FFixed32Repeated" json:"F_Fixed32_repeated,omitempty" pg:"F_Fixed32_repeated"` F_Fixed64Repeated []uint64 `protobuf:"fixed64,24,rep,name=F_Fixed64_repeated,json=FFixed64Repeated" json:"F_Fixed64_repeated,omitempty" pg:"F_Fixed64_repeated"` F_Uint32Repeated []uint32 `protobuf:"varint,25,rep,name=F_Uint32_repeated,json=FUint32Repeated" json:"F_Uint32_repeated,omitempty" pg:"F_Uint32_repeated"` F_Uint64Repeated []uint64 `protobuf:"varint,26,rep,name=F_Uint64_repeated,json=FUint64Repeated" json:"F_Uint64_repeated,omitempty" pg:"F_Uint64_repeated"` F_FloatRepeated []float32 `protobuf:"fixed32,27,rep,name=F_Float_repeated,json=FFloatRepeated" json:"F_Float_repeated,omitempty" pg:"F_Float_repeated"` F_DoubleRepeated []float64 `protobuf:"fixed64,28,rep,name=F_Double_repeated,json=FDoubleRepeated" json:"F_Double_repeated,omitempty" pg:"F_Double_repeated"` F_StringRepeated []string `protobuf:"bytes,29,rep,name=F_String_repeated,json=FStringRepeated" json:"F_String_repeated,omitempty" pg:"F_String_repeated"` F_BytesRepeated [][]byte `protobuf:"bytes,201,rep,name=F_Bytes_repeated,json=FBytesRepeated" json:"F_Bytes_repeated,omitempty" pg:"F_Bytes_repeated"` F_Sint32Repeated []int32 `protobuf:"zigzag32,202,rep,name=F_Sint32_repeated,json=FSint32Repeated" json:"F_Sint32_repeated,omitempty" pg:"F_Sint32_repeated"` F_Sint64Repeated []int64 `protobuf:"zigzag64,203,rep,name=F_Sint64_repeated,json=FSint64Repeated" json:"F_Sint64_repeated,omitempty" pg:"F_Sint64_repeated"` F_Sfixed32Repeated []int32 `protobuf:"fixed32,204,rep,name=F_Sfixed32_repeated,json=FSfixed32Repeated" json:"F_Sfixed32_repeated,omitempty" pg:"F_Sfixed32_repeated"` F_Sfixed64Repeated []int64 `protobuf:"fixed64,205,rep,name=F_Sfixed64_repeated,json=FSfixed64Repeated" json:"F_Sfixed64_repeated,omitempty" pg:"F_Sfixed64_repeated"` // Optional fields of all basic types F_BoolOptional *bool `protobuf:"varint,30,opt,name=F_Bool_optional,json=FBoolOptional" json:"F_Bool_optional,omitempty" pg:"F_Bool_optional"` F_Int32Optional *int32 `protobuf:"varint,31,opt,name=F_Int32_optional,json=FInt32Optional" json:"F_Int32_optional,omitempty" pg:"F_Int32_optional"` F_Int64Optional *int64 `protobuf:"varint,32,opt,name=F_Int64_optional,json=FInt64Optional" json:"F_Int64_optional,omitempty" pg:"F_Int64_optional"` F_Fixed32Optional *uint32 `protobuf:"fixed32,33,opt,name=F_Fixed32_optional,json=FFixed32Optional" json:"F_Fixed32_optional,omitempty" pg:"F_Fixed32_optional"` F_Fixed64Optional *uint64 `protobuf:"fixed64,34,opt,name=F_Fixed64_optional,json=FFixed64Optional" json:"F_Fixed64_optional,omitempty" pg:"F_Fixed64_optional"` F_Uint32Optional *uint32 `protobuf:"varint,35,opt,name=F_Uint32_optional,json=FUint32Optional" json:"F_Uint32_optional,omitempty" pg:"F_Uint32_optional"` F_Uint64Optional *uint64 `protobuf:"varint,36,opt,name=F_Uint64_optional,json=FUint64Optional" json:"F_Uint64_optional,omitempty" pg:"F_Uint64_optional"` F_FloatOptional *float32 `protobuf:"fixed32,37,opt,name=F_Float_optional,json=FFloatOptional" json:"F_Float_optional,omitempty" pg:"F_Float_optional"` F_DoubleOptional *float64 `protobuf:"fixed64,38,opt,name=F_Double_optional,json=FDoubleOptional" json:"F_Double_optional,omitempty" pg:"F_Double_optional"` F_StringOptional *string `protobuf:"bytes,39,opt,name=F_String_optional,json=FStringOptional" json:"F_String_optional,omitempty" pg:"F_String_optional"` F_BytesOptional []byte `protobuf:"bytes,301,opt,name=F_Bytes_optional,json=FBytesOptional" json:"F_Bytes_optional,omitempty" pg:"F_Bytes_optional"` F_Sint32Optional *int32 `protobuf:"zigzag32,302,opt,name=F_Sint32_optional,json=FSint32Optional" json:"F_Sint32_optional,omitempty" pg:"F_Sint32_optional"` F_Sint64Optional *int64 `protobuf:"zigzag64,303,opt,name=F_Sint64_optional,json=FSint64Optional" json:"F_Sint64_optional,omitempty" pg:"F_Sint64_optional"` F_Sfixed32Optional *int32 `protobuf:"fixed32,304,opt,name=F_Sfixed32_optional,json=FSfixed32Optional" json:"F_Sfixed32_optional,omitempty" pg:"F_Sfixed32_optional"` F_Sfixed64Optional *int64 `protobuf:"fixed64,305,opt,name=F_Sfixed64_optional,json=FSfixed64Optional" json:"F_Sfixed64_optional,omitempty" pg:"F_Sfixed64_optional"` // Default-valued fields of all basic types F_BoolDefaulted *bool `protobuf:"varint,40,opt,name=F_Bool_defaulted,json=FBoolDefaulted,def=1" json:"F_Bool_defaulted,omitempty" pg:"F_Bool_defaulted"` F_Int32Defaulted *int32 `protobuf:"varint,41,opt,name=F_Int32_defaulted,json=FInt32Defaulted,def=32" json:"F_Int32_defaulted,omitempty" pg:"F_Int32_defaulted"` F_Int64Defaulted *int64 `protobuf:"varint,42,opt,name=F_Int64_defaulted,json=FInt64Defaulted,def=64" json:"F_Int64_defaulted,omitempty" pg:"F_Int64_defaulted"` F_Fixed32Defaulted *uint32 `protobuf:"fixed32,43,opt,name=F_Fixed32_defaulted,json=FFixed32Defaulted,def=320" json:"F_Fixed32_defaulted,omitempty" pg:"F_Fixed32_defaulted"` F_Fixed64Defaulted *uint64 `protobuf:"fixed64,44,opt,name=F_Fixed64_defaulted,json=FFixed64Defaulted,def=640" json:"F_Fixed64_defaulted,omitempty" pg:"F_Fixed64_defaulted"` F_Uint32Defaulted *uint32 `protobuf:"varint,45,opt,name=F_Uint32_defaulted,json=FUint32Defaulted,def=3200" json:"F_Uint32_defaulted,omitempty" pg:"F_Uint32_defaulted"` F_Uint64Defaulted *uint64 `protobuf:"varint,46,opt,name=F_Uint64_defaulted,json=FUint64Defaulted,def=6400" json:"F_Uint64_defaulted,omitempty" pg:"F_Uint64_defaulted"` F_FloatDefaulted *float32 `protobuf:"fixed32,47,opt,name=F_Float_defaulted,json=FFloatDefaulted,def=314159" json:"F_Float_defaulted,omitempty" pg:"F_Float_defaulted"` F_DoubleDefaulted *float64 `protobuf:"fixed64,48,opt,name=F_Double_defaulted,json=FDoubleDefaulted,def=271828" json:"F_Double_defaulted,omitempty" pg:"F_Double_defaulted"` F_StringDefaulted *string `protobuf:"bytes,49,opt,name=F_String_defaulted,json=FStringDefaulted,def=hello, \"world!\"\n" json:"F_String_defaulted,omitempty" pg:"F_String_defaulted"` F_BytesDefaulted []byte `protobuf:"bytes,401,opt,name=F_Bytes_defaulted,json=FBytesDefaulted,def=Bignose" json:"F_Bytes_defaulted,omitempty" pg:"F_Bytes_defaulted"` F_Sint32Defaulted *int32 `protobuf:"zigzag32,402,opt,name=F_Sint32_defaulted,json=FSint32Defaulted,def=-32" json:"F_Sint32_defaulted,omitempty" pg:"F_Sint32_defaulted"` F_Sint64Defaulted *int64 `protobuf:"zigzag64,403,opt,name=F_Sint64_defaulted,json=FSint64Defaulted,def=-64" json:"F_Sint64_defaulted,omitempty" pg:"F_Sint64_defaulted"` F_Sfixed32Defaulted *int32 `protobuf:"fixed32,404,opt,name=F_Sfixed32_defaulted,json=FSfixed32Defaulted,def=-32" json:"F_Sfixed32_defaulted,omitempty" pg:"F_Sfixed32_defaulted"` F_Sfixed64Defaulted *int64 `protobuf:"fixed64,405,opt,name=F_Sfixed64_defaulted,json=FSfixed64Defaulted,def=-64" json:"F_Sfixed64_defaulted,omitempty" pg:"F_Sfixed64_defaulted"` // Packed repeated fields (no string or bytes). F_BoolRepeatedPacked []bool `protobuf:"varint,50,rep,packed,name=F_Bool_repeated_packed,json=FBoolRepeatedPacked" json:"F_Bool_repeated_packed,omitempty" pg:"F_Bool_repeated_packed"` F_Int32RepeatedPacked []int32 `protobuf:"varint,51,rep,packed,name=F_Int32_repeated_packed,json=FInt32RepeatedPacked" json:"F_Int32_repeated_packed,omitempty" pg:"F_Int32_repeated_packed"` F_Int64RepeatedPacked []int64 `protobuf:"varint,52,rep,packed,name=F_Int64_repeated_packed,json=FInt64RepeatedPacked" json:"F_Int64_repeated_packed,omitempty" pg:"F_Int64_repeated_packed"` F_Fixed32RepeatedPacked []uint32 `protobuf:"fixed32,53,rep,packed,name=F_Fixed32_repeated_packed,json=FFixed32RepeatedPacked" json:"F_Fixed32_repeated_packed,omitempty" pg:"F_Fixed32_repeated_packed"` F_Fixed64RepeatedPacked []uint64 `protobuf:"fixed64,54,rep,packed,name=F_Fixed64_repeated_packed,json=FFixed64RepeatedPacked" json:"F_Fixed64_repeated_packed,omitempty" pg:"F_Fixed64_repeated_packed"` F_Uint32RepeatedPacked []uint32 `protobuf:"varint,55,rep,packed,name=F_Uint32_repeated_packed,json=FUint32RepeatedPacked" json:"F_Uint32_repeated_packed,omitempty" pg:"F_Uint32_repeated_packed"` F_Uint64RepeatedPacked []uint64 `protobuf:"varint,56,rep,packed,name=F_Uint64_repeated_packed,json=FUint64RepeatedPacked" json:"F_Uint64_repeated_packed,omitempty" pg:"F_Uint64_repeated_packed"` F_FloatRepeatedPacked []float32 `protobuf:"fixed32,57,rep,packed,name=F_Float_repeated_packed,json=FFloatRepeatedPacked" json:"F_Float_repeated_packed,omitempty" pg:"F_Float_repeated_packed"` F_DoubleRepeatedPacked []float64 `protobuf:"fixed64,58,rep,packed,name=F_Double_repeated_packed,json=FDoubleRepeatedPacked" json:"F_Double_repeated_packed,omitempty" pg:"F_Double_repeated_packed"` F_Sint32RepeatedPacked []int32 `protobuf:"zigzag32,502,rep,packed,name=F_Sint32_repeated_packed,json=FSint32RepeatedPacked" json:"F_Sint32_repeated_packed,omitempty" pg:"F_Sint32_repeated_packed"` F_Sint64RepeatedPacked []int64 `protobuf:"zigzag64,503,rep,packed,name=F_Sint64_repeated_packed,json=FSint64RepeatedPacked" json:"F_Sint64_repeated_packed,omitempty" pg:"F_Sint64_repeated_packed"` F_Sfixed32RepeatedPacked []int32 `protobuf:"fixed32,504,rep,packed,name=F_Sfixed32_repeated_packed,json=FSfixed32RepeatedPacked" json:"F_Sfixed32_repeated_packed,omitempty" pg:"F_Sfixed32_repeated_packed"` F_Sfixed64RepeatedPacked []int64 `protobuf:"fixed64,505,rep,packed,name=F_Sfixed64_repeated_packed,json=FSfixed64RepeatedPacked" json:"F_Sfixed64_repeated_packed,omitempty" pg:"F_Sfixed64_repeated_packed"` Requiredgroup *GoTest_RequiredGroup `protobuf:"group,70,req,name=RequiredGroup,json=requiredgroup" json:"requiredgroup,omitempty" pg:"requiredgroup"` Repeatedgroup []*GoTest_RepeatedGroup `protobuf:"group,80,rep,name=RepeatedGroup,json=repeatedgroup" json:"repeatedgroup,omitempty" pg:"repeatedgroup"` Optionalgroup *GoTest_OptionalGroup `protobuf:"group,90,opt,name=OptionalGroup,json=optionalgroup" json:"optionalgroup,omitempty" pg:"optionalgroup"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GoTest) Reset() { *m = GoTest{} } func (m *GoTest) String() string { return proto.CompactTextString(m) } func (*GoTest) ProtoMessage() {} func (*GoTest) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{2} } func (m *GoTest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GoTest.Unmarshal(m, b) } func (m *GoTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GoTest.Marshal(b, m, deterministic) } func (m *GoTest) XXX_Merge(src proto.Message) { xxx_messageInfo_GoTest.Merge(m, src) } func (m *GoTest) XXX_Size() int { return xxx_messageInfo_GoTest.Size(m) } func (m *GoTest) XXX_DiscardUnknown() { xxx_messageInfo_GoTest.DiscardUnknown(m) } var xxx_messageInfo_GoTest proto.InternalMessageInfo const Default_GoTest_F_BoolDefaulted bool = true const Default_GoTest_F_Int32Defaulted int32 = 32 const Default_GoTest_F_Int64Defaulted int64 = 64 const Default_GoTest_F_Fixed32Defaulted uint32 = 320 const Default_GoTest_F_Fixed64Defaulted uint64 = 640 const Default_GoTest_F_Uint32Defaulted uint32 = 3200 const Default_GoTest_F_Uint64Defaulted uint64 = 6400 const Default_GoTest_F_FloatDefaulted float32 = 314159 const Default_GoTest_F_DoubleDefaulted float64 = 271828 const Default_GoTest_F_StringDefaulted string = "hello, \"world!\"\n" var Default_GoTest_F_BytesDefaulted []byte = []byte("Bignose") const Default_GoTest_F_Sint32Defaulted int32 = -32 const Default_GoTest_F_Sint64Defaulted int64 = -64 const Default_GoTest_F_Sfixed32Defaulted int32 = -32 const Default_GoTest_F_Sfixed64Defaulted int64 = -64 func (m *GoTest) GetKind() GoTest_KIND { if m != nil && m.Kind != nil { return *m.Kind } return GoTest_VOID } func (m *GoTest) GetTable() string { if m != nil && m.Table != nil { return *m.Table } return "" } func (m *GoTest) GetParam() int32 { if m != nil && m.Param != nil { return *m.Param } return 0 } func (m *GoTest) GetRequiredField() *GoTestField { if m != nil { return m.RequiredField } return nil } func (m *GoTest) GetRepeatedField() []*GoTestField { if m != nil { return m.RepeatedField } return nil } func (m *GoTest) GetOptionalField() *GoTestField { if m != nil { return m.OptionalField } return nil } func (m *GoTest) GetF_BoolRequired() bool { if m != nil && m.F_BoolRequired != nil { return *m.F_BoolRequired } return false } func (m *GoTest) GetF_Int32Required() int32 { if m != nil && m.F_Int32Required != nil { return *m.F_Int32Required } return 0 } func (m *GoTest) GetF_Int64Required() int64 { if m != nil && m.F_Int64Required != nil { return *m.F_Int64Required } return 0 } func (m *GoTest) GetF_Fixed32Required() uint32 { if m != nil && m.F_Fixed32Required != nil { return *m.F_Fixed32Required } return 0 } func (m *GoTest) GetF_Fixed64Required() uint64 { if m != nil && m.F_Fixed64Required != nil { return *m.F_Fixed64Required } return 0 } func (m *GoTest) GetF_Uint32Required() uint32 { if m != nil && m.F_Uint32Required != nil { return *m.F_Uint32Required } return 0 } func (m *GoTest) GetF_Uint64Required() uint64 { if m != nil && m.F_Uint64Required != nil { return *m.F_Uint64Required } return 0 } func (m *GoTest) GetF_FloatRequired() float32 { if m != nil && m.F_FloatRequired != nil { return *m.F_FloatRequired } return 0 } func (m *GoTest) GetF_DoubleRequired() float64 { if m != nil && m.F_DoubleRequired != nil { return *m.F_DoubleRequired } return 0 } func (m *GoTest) GetF_StringRequired() string { if m != nil && m.F_StringRequired != nil { return *m.F_StringRequired } return "" } func (m *GoTest) GetF_BytesRequired() []byte { if m != nil { return m.F_BytesRequired } return nil } func (m *GoTest) GetF_Sint32Required() int32 { if m != nil && m.F_Sint32Required != nil { return *m.F_Sint32Required } return 0 } func (m *GoTest) GetF_Sint64Required() int64 { if m != nil && m.F_Sint64Required != nil { return *m.F_Sint64Required } return 0 } func (m *GoTest) GetF_Sfixed32Required() int32 { if m != nil && m.F_Sfixed32Required != nil { return *m.F_Sfixed32Required } return 0 } func (m *GoTest) GetF_Sfixed64Required() int64 { if m != nil && m.F_Sfixed64Required != nil { return *m.F_Sfixed64Required } return 0 } func (m *GoTest) GetF_BoolRepeated() []bool { if m != nil { return m.F_BoolRepeated } return nil } func (m *GoTest) GetF_Int32Repeated() []int32 { if m != nil { return m.F_Int32Repeated } return nil } func (m *GoTest) GetF_Int64Repeated() []int64 { if m != nil { return m.F_Int64Repeated } return nil } func (m *GoTest) GetF_Fixed32Repeated() []uint32 { if m != nil { return m.F_Fixed32Repeated } return nil } func (m *GoTest) GetF_Fixed64Repeated() []uint64 { if m != nil { return m.F_Fixed64Repeated } return nil } func (m *GoTest) GetF_Uint32Repeated() []uint32 { if m != nil { return m.F_Uint32Repeated } return nil } func (m *GoTest) GetF_Uint64Repeated() []uint64 { if m != nil { return m.F_Uint64Repeated } return nil } func (m *GoTest) GetF_FloatRepeated() []float32 { if m != nil { return m.F_FloatRepeated } return nil } func (m *GoTest) GetF_DoubleRepeated() []float64 { if m != nil { return m.F_DoubleRepeated } return nil } func (m *GoTest) GetF_StringRepeated() []string { if m != nil { return m.F_StringRepeated } return nil } func (m *GoTest) GetF_BytesRepeated() [][]byte { if m != nil { return m.F_BytesRepeated } return nil } func (m *GoTest) GetF_Sint32Repeated() []int32 { if m != nil { return m.F_Sint32Repeated } return nil } func (m *GoTest) GetF_Sint64Repeated() []int64 { if m != nil { return m.F_Sint64Repeated } return nil } func (m *GoTest) GetF_Sfixed32Repeated() []int32 { if m != nil { return m.F_Sfixed32Repeated } return nil } func (m *GoTest) GetF_Sfixed64Repeated() []int64 { if m != nil { return m.F_Sfixed64Repeated } return nil } func (m *GoTest) GetF_BoolOptional() bool { if m != nil && m.F_BoolOptional != nil { return *m.F_BoolOptional } return false } func (m *GoTest) GetF_Int32Optional() int32 { if m != nil && m.F_Int32Optional != nil { return *m.F_Int32Optional } return 0 } func (m *GoTest) GetF_Int64Optional() int64 { if m != nil && m.F_Int64Optional != nil { return *m.F_Int64Optional } return 0 } func (m *GoTest) GetF_Fixed32Optional() uint32 { if m != nil && m.F_Fixed32Optional != nil { return *m.F_Fixed32Optional } return 0 } func (m *GoTest) GetF_Fixed64Optional() uint64 { if m != nil && m.F_Fixed64Optional != nil { return *m.F_Fixed64Optional } return 0 } func (m *GoTest) GetF_Uint32Optional() uint32 { if m != nil && m.F_Uint32Optional != nil { return *m.F_Uint32Optional } return 0 } func (m *GoTest) GetF_Uint64Optional() uint64 { if m != nil && m.F_Uint64Optional != nil { return *m.F_Uint64Optional } return 0 } func (m *GoTest) GetF_FloatOptional() float32 { if m != nil && m.F_FloatOptional != nil { return *m.F_FloatOptional } return 0 } func (m *GoTest) GetF_DoubleOptional() float64 { if m != nil && m.F_DoubleOptional != nil { return *m.F_DoubleOptional } return 0 } func (m *GoTest) GetF_StringOptional() string { if m != nil && m.F_StringOptional != nil { return *m.F_StringOptional } return "" } func (m *GoTest) GetF_BytesOptional() []byte { if m != nil { return m.F_BytesOptional } return nil } func (m *GoTest) GetF_Sint32Optional() int32 { if m != nil && m.F_Sint32Optional != nil { return *m.F_Sint32Optional } return 0 } func (m *GoTest) GetF_Sint64Optional() int64 { if m != nil && m.F_Sint64Optional != nil { return *m.F_Sint64Optional } return 0 } func (m *GoTest) GetF_Sfixed32Optional() int32 { if m != nil && m.F_Sfixed32Optional != nil { return *m.F_Sfixed32Optional } return 0 } func (m *GoTest) GetF_Sfixed64Optional() int64 { if m != nil && m.F_Sfixed64Optional != nil { return *m.F_Sfixed64Optional } return 0 } func (m *GoTest) GetF_BoolDefaulted() bool { if m != nil && m.F_BoolDefaulted != nil { return *m.F_BoolDefaulted } return Default_GoTest_F_BoolDefaulted } func (m *GoTest) GetF_Int32Defaulted() int32 { if m != nil && m.F_Int32Defaulted != nil { return *m.F_Int32Defaulted } return Default_GoTest_F_Int32Defaulted } func (m *GoTest) GetF_Int64Defaulted() int64 { if m != nil && m.F_Int64Defaulted != nil { return *m.F_Int64Defaulted } return Default_GoTest_F_Int64Defaulted } func (m *GoTest) GetF_Fixed32Defaulted() uint32 { if m != nil && m.F_Fixed32Defaulted != nil { return *m.F_Fixed32Defaulted } return Default_GoTest_F_Fixed32Defaulted } func (m *GoTest) GetF_Fixed64Defaulted() uint64 { if m != nil && m.F_Fixed64Defaulted != nil { return *m.F_Fixed64Defaulted } return Default_GoTest_F_Fixed64Defaulted } func (m *GoTest) GetF_Uint32Defaulted() uint32 { if m != nil && m.F_Uint32Defaulted != nil { return *m.F_Uint32Defaulted } return Default_GoTest_F_Uint32Defaulted } func (m *GoTest) GetF_Uint64Defaulted() uint64 { if m != nil && m.F_Uint64Defaulted != nil { return *m.F_Uint64Defaulted } return Default_GoTest_F_Uint64Defaulted } func (m *GoTest) GetF_FloatDefaulted() float32 { if m != nil && m.F_FloatDefaulted != nil { return *m.F_FloatDefaulted } return Default_GoTest_F_FloatDefaulted } func (m *GoTest) GetF_DoubleDefaulted() float64 { if m != nil && m.F_DoubleDefaulted != nil { return *m.F_DoubleDefaulted } return Default_GoTest_F_DoubleDefaulted } func (m *GoTest) GetF_StringDefaulted() string { if m != nil && m.F_StringDefaulted != nil { return *m.F_StringDefaulted } return Default_GoTest_F_StringDefaulted } func (m *GoTest) GetF_BytesDefaulted() []byte { if m != nil && m.F_BytesDefaulted != nil { return m.F_BytesDefaulted } return append([]byte(nil), Default_GoTest_F_BytesDefaulted...) } func (m *GoTest) GetF_Sint32Defaulted() int32 { if m != nil && m.F_Sint32Defaulted != nil { return *m.F_Sint32Defaulted } return Default_GoTest_F_Sint32Defaulted } func (m *GoTest) GetF_Sint64Defaulted() int64 { if m != nil && m.F_Sint64Defaulted != nil { return *m.F_Sint64Defaulted } return Default_GoTest_F_Sint64Defaulted } func (m *GoTest) GetF_Sfixed32Defaulted() int32 { if m != nil && m.F_Sfixed32Defaulted != nil { return *m.F_Sfixed32Defaulted } return Default_GoTest_F_Sfixed32Defaulted } func (m *GoTest) GetF_Sfixed64Defaulted() int64 { if m != nil && m.F_Sfixed64Defaulted != nil { return *m.F_Sfixed64Defaulted } return Default_GoTest_F_Sfixed64Defaulted } func (m *GoTest) GetF_BoolRepeatedPacked() []bool { if m != nil { return m.F_BoolRepeatedPacked } return nil } func (m *GoTest) GetF_Int32RepeatedPacked() []int32 { if m != nil { return m.F_Int32RepeatedPacked } return nil } func (m *GoTest) GetF_Int64RepeatedPacked() []int64 { if m != nil { return m.F_Int64RepeatedPacked } return nil } func (m *GoTest) GetF_Fixed32RepeatedPacked() []uint32 { if m != nil { return m.F_Fixed32RepeatedPacked } return nil } func (m *GoTest) GetF_Fixed64RepeatedPacked() []uint64 { if m != nil { return m.F_Fixed64RepeatedPacked } return nil } func (m *GoTest) GetF_Uint32RepeatedPacked() []uint32 { if m != nil { return m.F_Uint32RepeatedPacked } return nil } func (m *GoTest) GetF_Uint64RepeatedPacked() []uint64 { if m != nil { return m.F_Uint64RepeatedPacked } return nil } func (m *GoTest) GetF_FloatRepeatedPacked() []float32 { if m != nil { return m.F_FloatRepeatedPacked } return nil } func (m *GoTest) GetF_DoubleRepeatedPacked() []float64 { if m != nil { return m.F_DoubleRepeatedPacked } return nil } func (m *GoTest) GetF_Sint32RepeatedPacked() []int32 { if m != nil { return m.F_Sint32RepeatedPacked } return nil } func (m *GoTest) GetF_Sint64RepeatedPacked() []int64 { if m != nil { return m.F_Sint64RepeatedPacked } return nil } func (m *GoTest) GetF_Sfixed32RepeatedPacked() []int32 { if m != nil { return m.F_Sfixed32RepeatedPacked } return nil } func (m *GoTest) GetF_Sfixed64RepeatedPacked() []int64 { if m != nil { return m.F_Sfixed64RepeatedPacked } return nil } func (m *GoTest) GetRequiredgroup() *GoTest_RequiredGroup { if m != nil { return m.Requiredgroup } return nil } func (m *GoTest) GetRepeatedgroup() []*GoTest_RepeatedGroup { if m != nil { return m.Repeatedgroup } return nil } func (m *GoTest) GetOptionalgroup() *GoTest_OptionalGroup { if m != nil { return m.Optionalgroup } return nil } // Required, repeated, and optional groups. type GoTest_RequiredGroup struct { RequiredField *string `protobuf:"bytes,71,req,name=RequiredField" json:"RequiredField,omitempty" pg:"RequiredField"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} } func (m *GoTest_RequiredGroup) String() string { return proto.CompactTextString(m) } func (*GoTest_RequiredGroup) ProtoMessage() {} func (*GoTest_RequiredGroup) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{2, 0} } func (m *GoTest_RequiredGroup) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GoTest_RequiredGroup.Unmarshal(m, b) } func (m *GoTest_RequiredGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GoTest_RequiredGroup.Marshal(b, m, deterministic) } func (m *GoTest_RequiredGroup) XXX_Merge(src proto.Message) { xxx_messageInfo_GoTest_RequiredGroup.Merge(m, src) } func (m *GoTest_RequiredGroup) XXX_Size() int { return xxx_messageInfo_GoTest_RequiredGroup.Size(m) } func (m *GoTest_RequiredGroup) XXX_DiscardUnknown() { xxx_messageInfo_GoTest_RequiredGroup.DiscardUnknown(m) } var xxx_messageInfo_GoTest_RequiredGroup proto.InternalMessageInfo func (m *GoTest_RequiredGroup) GetRequiredField() string { if m != nil && m.RequiredField != nil { return *m.RequiredField } return "" } type GoTest_RepeatedGroup struct { RequiredField *string `protobuf:"bytes,81,req,name=RequiredField" json:"RequiredField,omitempty" pg:"RequiredField"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} } func (m *GoTest_RepeatedGroup) String() string { return proto.CompactTextString(m) } func (*GoTest_RepeatedGroup) ProtoMessage() {} func (*GoTest_RepeatedGroup) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{2, 1} } func (m *GoTest_RepeatedGroup) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GoTest_RepeatedGroup.Unmarshal(m, b) } func (m *GoTest_RepeatedGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GoTest_RepeatedGroup.Marshal(b, m, deterministic) } func (m *GoTest_RepeatedGroup) XXX_Merge(src proto.Message) { xxx_messageInfo_GoTest_RepeatedGroup.Merge(m, src) } func (m *GoTest_RepeatedGroup) XXX_Size() int { return xxx_messageInfo_GoTest_RepeatedGroup.Size(m) } func (m *GoTest_RepeatedGroup) XXX_DiscardUnknown() { xxx_messageInfo_GoTest_RepeatedGroup.DiscardUnknown(m) } var xxx_messageInfo_GoTest_RepeatedGroup proto.InternalMessageInfo func (m *GoTest_RepeatedGroup) GetRequiredField() string { if m != nil && m.RequiredField != nil { return *m.RequiredField } return "" } type GoTest_OptionalGroup struct { RequiredField *string `protobuf:"bytes,91,req,name=RequiredField" json:"RequiredField,omitempty" pg:"RequiredField"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} } func (m *GoTest_OptionalGroup) String() string { return proto.CompactTextString(m) } func (*GoTest_OptionalGroup) ProtoMessage() {} func (*GoTest_OptionalGroup) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{2, 2} } func (m *GoTest_OptionalGroup) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GoTest_OptionalGroup.Unmarshal(m, b) } func (m *GoTest_OptionalGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GoTest_OptionalGroup.Marshal(b, m, deterministic) } func (m *GoTest_OptionalGroup) XXX_Merge(src proto.Message) { xxx_messageInfo_GoTest_OptionalGroup.Merge(m, src) } func (m *GoTest_OptionalGroup) XXX_Size() int { return xxx_messageInfo_GoTest_OptionalGroup.Size(m) } func (m *GoTest_OptionalGroup) XXX_DiscardUnknown() { xxx_messageInfo_GoTest_OptionalGroup.DiscardUnknown(m) } var xxx_messageInfo_GoTest_OptionalGroup proto.InternalMessageInfo func (m *GoTest_OptionalGroup) GetRequiredField() string { if m != nil && m.RequiredField != nil { return *m.RequiredField } return "" } // For testing a group containing a required field. type GoTestRequiredGroupField struct { Group *GoTestRequiredGroupField_Group `protobuf:"group,1,req,name=Group,json=group" json:"group,omitempty" pg:"group"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GoTestRequiredGroupField) Reset() { *m = GoTestRequiredGroupField{} } func (m *GoTestRequiredGroupField) String() string { return proto.CompactTextString(m) } func (*GoTestRequiredGroupField) ProtoMessage() {} func (*GoTestRequiredGroupField) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{3} } func (m *GoTestRequiredGroupField) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GoTestRequiredGroupField.Unmarshal(m, b) } func (m *GoTestRequiredGroupField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GoTestRequiredGroupField.Marshal(b, m, deterministic) } func (m *GoTestRequiredGroupField) XXX_Merge(src proto.Message) { xxx_messageInfo_GoTestRequiredGroupField.Merge(m, src) } func (m *GoTestRequiredGroupField) XXX_Size() int { return xxx_messageInfo_GoTestRequiredGroupField.Size(m) } func (m *GoTestRequiredGroupField) XXX_DiscardUnknown() { xxx_messageInfo_GoTestRequiredGroupField.DiscardUnknown(m) } var xxx_messageInfo_GoTestRequiredGroupField proto.InternalMessageInfo func (m *GoTestRequiredGroupField) GetGroup() *GoTestRequiredGroupField_Group { if m != nil { return m.Group } return nil } type GoTestRequiredGroupField_Group struct { Field *int32 `protobuf:"varint,2,req,name=Field" json:"Field,omitempty" pg:"Field"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GoTestRequiredGroupField_Group) Reset() { *m = GoTestRequiredGroupField_Group{} } func (m *GoTestRequiredGroupField_Group) String() string { return proto.CompactTextString(m) } func (*GoTestRequiredGroupField_Group) ProtoMessage() {} func (*GoTestRequiredGroupField_Group) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{3, 0} } func (m *GoTestRequiredGroupField_Group) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GoTestRequiredGroupField_Group.Unmarshal(m, b) } func (m *GoTestRequiredGroupField_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GoTestRequiredGroupField_Group.Marshal(b, m, deterministic) } func (m *GoTestRequiredGroupField_Group) XXX_Merge(src proto.Message) { xxx_messageInfo_GoTestRequiredGroupField_Group.Merge(m, src) } func (m *GoTestRequiredGroupField_Group) XXX_Size() int { return xxx_messageInfo_GoTestRequiredGroupField_Group.Size(m) } func (m *GoTestRequiredGroupField_Group) XXX_DiscardUnknown() { xxx_messageInfo_GoTestRequiredGroupField_Group.DiscardUnknown(m) } var xxx_messageInfo_GoTestRequiredGroupField_Group proto.InternalMessageInfo func (m *GoTestRequiredGroupField_Group) GetField() int32 { if m != nil && m.Field != nil { return *m.Field } return 0 } // For testing skipping of unrecognized fields. // Numbers are all big, larger than tag numbers in GoTestField, // the message used in the corresponding test. type GoSkipTest struct { SkipInt32 *int32 `protobuf:"varint,11,req,name=skip_int32,json=skipInt32" json:"skip_int32,omitempty" pg:"skip_int32"` SkipFixed32 *uint32 `protobuf:"fixed32,12,req,name=skip_fixed32,json=skipFixed32" json:"skip_fixed32,omitempty" pg:"skip_fixed32"` SkipFixed64 *uint64 `protobuf:"fixed64,13,req,name=skip_fixed64,json=skipFixed64" json:"skip_fixed64,omitempty" pg:"skip_fixed64"` SkipString *string `protobuf:"bytes,14,req,name=skip_string,json=skipString" json:"skip_string,omitempty" pg:"skip_string"` Skipgroup *GoSkipTest_SkipGroup `protobuf:"group,15,req,name=SkipGroup,json=skipgroup" json:"skipgroup,omitempty" pg:"skipgroup"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GoSkipTest) Reset() { *m = GoSkipTest{} } func (m *GoSkipTest) String() string { return proto.CompactTextString(m) } func (*GoSkipTest) ProtoMessage() {} func (*GoSkipTest) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{4} } func (m *GoSkipTest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GoSkipTest.Unmarshal(m, b) } func (m *GoSkipTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GoSkipTest.Marshal(b, m, deterministic) } func (m *GoSkipTest) XXX_Merge(src proto.Message) { xxx_messageInfo_GoSkipTest.Merge(m, src) } func (m *GoSkipTest) XXX_Size() int { return xxx_messageInfo_GoSkipTest.Size(m) } func (m *GoSkipTest) XXX_DiscardUnknown() { xxx_messageInfo_GoSkipTest.DiscardUnknown(m) } var xxx_messageInfo_GoSkipTest proto.InternalMessageInfo func (m *GoSkipTest) GetSkipInt32() int32 { if m != nil && m.SkipInt32 != nil { return *m.SkipInt32 } return 0 } func (m *GoSkipTest) GetSkipFixed32() uint32 { if m != nil && m.SkipFixed32 != nil { return *m.SkipFixed32 } return 0 } func (m *GoSkipTest) GetSkipFixed64() uint64 { if m != nil && m.SkipFixed64 != nil { return *m.SkipFixed64 } return 0 } func (m *GoSkipTest) GetSkipString() string { if m != nil && m.SkipString != nil { return *m.SkipString } return "" } func (m *GoSkipTest) GetSkipgroup() *GoSkipTest_SkipGroup { if m != nil { return m.Skipgroup } return nil } type GoSkipTest_SkipGroup struct { GroupInt32 *int32 `protobuf:"varint,16,req,name=group_int32,json=groupInt32" json:"group_int32,omitempty" pg:"group_int32"` GroupString *string `protobuf:"bytes,17,req,name=group_string,json=groupString" json:"group_string,omitempty" pg:"group_string"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} } func (m *GoSkipTest_SkipGroup) String() string { return proto.CompactTextString(m) } func (*GoSkipTest_SkipGroup) ProtoMessage() {} func (*GoSkipTest_SkipGroup) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{4, 0} } func (m *GoSkipTest_SkipGroup) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GoSkipTest_SkipGroup.Unmarshal(m, b) } func (m *GoSkipTest_SkipGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GoSkipTest_SkipGroup.Marshal(b, m, deterministic) } func (m *GoSkipTest_SkipGroup) XXX_Merge(src proto.Message) { xxx_messageInfo_GoSkipTest_SkipGroup.Merge(m, src) } func (m *GoSkipTest_SkipGroup) XXX_Size() int { return xxx_messageInfo_GoSkipTest_SkipGroup.Size(m) } func (m *GoSkipTest_SkipGroup) XXX_DiscardUnknown() { xxx_messageInfo_GoSkipTest_SkipGroup.DiscardUnknown(m) } var xxx_messageInfo_GoSkipTest_SkipGroup proto.InternalMessageInfo func (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 { if m != nil && m.GroupInt32 != nil { return *m.GroupInt32 } return 0 } func (m *GoSkipTest_SkipGroup) GetGroupString() string { if m != nil && m.GroupString != nil { return *m.GroupString } return "" } // For testing packed/non-packed decoder switching. // A serialized instance of one should be deserializable as the other. type NonPackedTest struct { A []int32 `protobuf:"varint,1,rep,name=a" json:"a,omitempty" pg:"a"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *NonPackedTest) Reset() { *m = NonPackedTest{} } func (m *NonPackedTest) String() string { return proto.CompactTextString(m) } func (*NonPackedTest) ProtoMessage() {} func (*NonPackedTest) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{5} } func (m *NonPackedTest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NonPackedTest.Unmarshal(m, b) } func (m *NonPackedTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NonPackedTest.Marshal(b, m, deterministic) } func (m *NonPackedTest) XXX_Merge(src proto.Message) { xxx_messageInfo_NonPackedTest.Merge(m, src) } func (m *NonPackedTest) XXX_Size() int { return xxx_messageInfo_NonPackedTest.Size(m) } func (m *NonPackedTest) XXX_DiscardUnknown() { xxx_messageInfo_NonPackedTest.DiscardUnknown(m) } var xxx_messageInfo_NonPackedTest proto.InternalMessageInfo func (m *NonPackedTest) GetA() []int32 { if m != nil { return m.A } return nil } type PackedTest struct { B []int32 `protobuf:"varint,1,rep,packed,name=b" json:"b,omitempty" pg:"b"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *PackedTest) Reset() { *m = PackedTest{} } func (m *PackedTest) String() string { return proto.CompactTextString(m) } func (*PackedTest) ProtoMessage() {} func (*PackedTest) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{6} } func (m *PackedTest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PackedTest.Unmarshal(m, b) } func (m *PackedTest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_PackedTest.Marshal(b, m, deterministic) } func (m *PackedTest) XXX_Merge(src proto.Message) { xxx_messageInfo_PackedTest.Merge(m, src) } func (m *PackedTest) XXX_Size() int { return xxx_messageInfo_PackedTest.Size(m) } func (m *PackedTest) XXX_DiscardUnknown() { xxx_messageInfo_PackedTest.DiscardUnknown(m) } var xxx_messageInfo_PackedTest proto.InternalMessageInfo func (m *PackedTest) GetB() []int32 { if m != nil { return m.B } return nil } type MaxTag struct { // Maximum possible tag number. LastField *string `protobuf:"bytes,536870911,opt,name=last_field,json=lastField" json:"last_field,omitempty" pg:"last_field"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *MaxTag) Reset() { *m = MaxTag{} } func (m *MaxTag) String() string { return proto.CompactTextString(m) } func (*MaxTag) ProtoMessage() {} func (*MaxTag) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{7} } func (m *MaxTag) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MaxTag.Unmarshal(m, b) } func (m *MaxTag) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MaxTag.Marshal(b, m, deterministic) } func (m *MaxTag) XXX_Merge(src proto.Message) { xxx_messageInfo_MaxTag.Merge(m, src) } func (m *MaxTag) XXX_Size() int { return xxx_messageInfo_MaxTag.Size(m) } func (m *MaxTag) XXX_DiscardUnknown() { xxx_messageInfo_MaxTag.DiscardUnknown(m) } var xxx_messageInfo_MaxTag proto.InternalMessageInfo func (m *MaxTag) GetLastField() string { if m != nil && m.LastField != nil { return *m.LastField } return "" } type OldMessage struct { Nested *OldMessage_Nested `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty" pg:"nested"` Num *int32 `protobuf:"varint,2,opt,name=num" json:"num,omitempty" pg:"num"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *OldMessage) Reset() { *m = OldMessage{} } func (m *OldMessage) String() string { return proto.CompactTextString(m) } func (*OldMessage) ProtoMessage() {} func (*OldMessage) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{8} } func (m *OldMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OldMessage.Unmarshal(m, b) } func (m *OldMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_OldMessage.Marshal(b, m, deterministic) } func (m *OldMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_OldMessage.Merge(m, src) } func (m *OldMessage) XXX_Size() int { return xxx_messageInfo_OldMessage.Size(m) } func (m *OldMessage) XXX_DiscardUnknown() { xxx_messageInfo_OldMessage.DiscardUnknown(m) } var xxx_messageInfo_OldMessage proto.InternalMessageInfo func (m *OldMessage) GetNested() *OldMessage_Nested { if m != nil { return m.Nested } return nil } func (m *OldMessage) GetNum() int32 { if m != nil && m.Num != nil { return *m.Num } return 0 } type OldMessage_Nested struct { Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty" pg:"name"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} } func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) } func (*OldMessage_Nested) ProtoMessage() {} func (*OldMessage_Nested) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{8, 0} } func (m *OldMessage_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OldMessage_Nested.Unmarshal(m, b) } func (m *OldMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_OldMessage_Nested.Marshal(b, m, deterministic) } func (m *OldMessage_Nested) XXX_Merge(src proto.Message) { xxx_messageInfo_OldMessage_Nested.Merge(m, src) } func (m *OldMessage_Nested) XXX_Size() int { return xxx_messageInfo_OldMessage_Nested.Size(m) } func (m *OldMessage_Nested) XXX_DiscardUnknown() { xxx_messageInfo_OldMessage_Nested.DiscardUnknown(m) } var xxx_messageInfo_OldMessage_Nested proto.InternalMessageInfo func (m *OldMessage_Nested) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } // NewMessage is wire compatible with OldMessage; // imagine it as a future version. type NewMessage struct { Nested *NewMessage_Nested `protobuf:"bytes,1,opt,name=nested" json:"nested,omitempty" pg:"nested"` // This is an int32 in OldMessage. Num *int64 `protobuf:"varint,2,opt,name=num" json:"num,omitempty" pg:"num"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *NewMessage) Reset() { *m = NewMessage{} } func (m *NewMessage) String() string { return proto.CompactTextString(m) } func (*NewMessage) ProtoMessage() {} func (*NewMessage) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{9} } func (m *NewMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NewMessage.Unmarshal(m, b) } func (m *NewMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NewMessage.Marshal(b, m, deterministic) } func (m *NewMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_NewMessage.Merge(m, src) } func (m *NewMessage) XXX_Size() int { return xxx_messageInfo_NewMessage.Size(m) } func (m *NewMessage) XXX_DiscardUnknown() { xxx_messageInfo_NewMessage.DiscardUnknown(m) } var xxx_messageInfo_NewMessage proto.InternalMessageInfo func (m *NewMessage) GetNested() *NewMessage_Nested { if m != nil { return m.Nested } return nil } func (m *NewMessage) GetNum() int64 { if m != nil && m.Num != nil { return *m.Num } return 0 } type NewMessage_Nested struct { Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty" pg:"name"` FoodGroup *string `protobuf:"bytes,2,opt,name=food_group,json=foodGroup" json:"food_group,omitempty" pg:"food_group"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} } func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) } func (*NewMessage_Nested) ProtoMessage() {} func (*NewMessage_Nested) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{9, 0} } func (m *NewMessage_Nested) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_NewMessage_Nested.Unmarshal(m, b) } func (m *NewMessage_Nested) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_NewMessage_Nested.Marshal(b, m, deterministic) } func (m *NewMessage_Nested) XXX_Merge(src proto.Message) { xxx_messageInfo_NewMessage_Nested.Merge(m, src) } func (m *NewMessage_Nested) XXX_Size() int { return xxx_messageInfo_NewMessage_Nested.Size(m) } func (m *NewMessage_Nested) XXX_DiscardUnknown() { xxx_messageInfo_NewMessage_Nested.DiscardUnknown(m) } var xxx_messageInfo_NewMessage_Nested proto.InternalMessageInfo func (m *NewMessage_Nested) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *NewMessage_Nested) GetFoodGroup() string { if m != nil && m.FoodGroup != nil { return *m.FoodGroup } return "" } type InnerMessage struct { Host *string `protobuf:"bytes,1,req,name=host" json:"host,omitempty" pg:"host"` Port *int32 `protobuf:"varint,2,opt,name=port,def=4000" json:"port,omitempty" pg:"port"` Connected *bool `protobuf:"varint,3,opt,name=connected" json:"connected,omitempty" pg:"connected"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *InnerMessage) Reset() { *m = InnerMessage{} } func (m *InnerMessage) String() string { return proto.CompactTextString(m) } func (*InnerMessage) ProtoMessage() {} func (*InnerMessage) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{10} } func (m *InnerMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InnerMessage.Unmarshal(m, b) } func (m *InnerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_InnerMessage.Marshal(b, m, deterministic) } func (m *InnerMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_InnerMessage.Merge(m, src) } func (m *InnerMessage) XXX_Size() int { return xxx_messageInfo_InnerMessage.Size(m) } func (m *InnerMessage) XXX_DiscardUnknown() { xxx_messageInfo_InnerMessage.DiscardUnknown(m) } var xxx_messageInfo_InnerMessage proto.InternalMessageInfo const Default_InnerMessage_Port int32 = 4000 func (m *InnerMessage) GetHost() string { if m != nil && m.Host != nil { return *m.Host } return "" } func (m *InnerMessage) GetPort() int32 { if m != nil && m.Port != nil { return *m.Port } return Default_InnerMessage_Port } func (m *InnerMessage) GetConnected() bool { if m != nil && m.Connected != nil { return *m.Connected } return false } type OtherMessage struct { Key *int64 `protobuf:"varint,1,opt,name=key" json:"key,omitempty" pg:"key"` Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty" pg:"value"` Weight *float32 `protobuf:"fixed32,3,opt,name=weight" json:"weight,omitempty" pg:"weight"` Inner *InnerMessage `protobuf:"bytes,4,opt,name=inner" json:"inner,omitempty" pg:"inner"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` proto.XXX_InternalExtensions `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *OtherMessage) Reset() { *m = OtherMessage{} } func (m *OtherMessage) String() string { return proto.CompactTextString(m) } func (*OtherMessage) ProtoMessage() {} func (*OtherMessage) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{11} } var extRange_OtherMessage = []proto.ExtensionRange{ {Start: 100, End: 536870911}, } func (*OtherMessage) ExtensionRangeArray() []proto.ExtensionRange { return extRange_OtherMessage } func (m *OtherMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OtherMessage.Unmarshal(m, b) } func (m *OtherMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_OtherMessage.Marshal(b, m, deterministic) } func (m *OtherMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_OtherMessage.Merge(m, src) } func (m *OtherMessage) XXX_Size() int { return xxx_messageInfo_OtherMessage.Size(m) } func (m *OtherMessage) XXX_DiscardUnknown() { xxx_messageInfo_OtherMessage.DiscardUnknown(m) } var xxx_messageInfo_OtherMessage proto.InternalMessageInfo func (m *OtherMessage) GetKey() int64 { if m != nil && m.Key != nil { return *m.Key } return 0 } func (m *OtherMessage) GetValue() []byte { if m != nil { return m.Value } return nil } func (m *OtherMessage) GetWeight() float32 { if m != nil && m.Weight != nil { return *m.Weight } return 0 } func (m *OtherMessage) GetInner() *InnerMessage { if m != nil { return m.Inner } return nil } type RequiredInnerMessage struct { LeoFinallyWonAnOscar *InnerMessage `protobuf:"bytes,1,req,name=leo_finally_won_an_oscar,json=leoFinallyWonAnOscar" json:"leo_finally_won_an_oscar,omitempty" pg:"leo_finally_won_an_oscar"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *RequiredInnerMessage) Reset() { *m = RequiredInnerMessage{} } func (m *RequiredInnerMessage) String() string { return proto.CompactTextString(m) } func (*RequiredInnerMessage) ProtoMessage() {} func (*RequiredInnerMessage) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{12} } func (m *RequiredInnerMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequiredInnerMessage.Unmarshal(m, b) } func (m *RequiredInnerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RequiredInnerMessage.Marshal(b, m, deterministic) } func (m *RequiredInnerMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_RequiredInnerMessage.Merge(m, src) } func (m *RequiredInnerMessage) XXX_Size() int { return xxx_messageInfo_RequiredInnerMessage.Size(m) } func (m *RequiredInnerMessage) XXX_DiscardUnknown() { xxx_messageInfo_RequiredInnerMessage.DiscardUnknown(m) } var xxx_messageInfo_RequiredInnerMessage proto.InternalMessageInfo func (m *RequiredInnerMessage) GetLeoFinallyWonAnOscar() *InnerMessage { if m != nil { return m.LeoFinallyWonAnOscar } return nil } type MyMessage struct { Count *int32 `protobuf:"varint,1,req,name=count" json:"count,omitempty" pg:"count"` Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty" pg:"name"` Quote *string `protobuf:"bytes,3,opt,name=quote" json:"quote,omitempty" pg:"quote"` Pet []string `protobuf:"bytes,4,rep,name=pet" json:"pet,omitempty" pg:"pet"` Inner *InnerMessage `protobuf:"bytes,5,opt,name=inner" json:"inner,omitempty" pg:"inner"` Others []*OtherMessage `protobuf:"bytes,6,rep,name=others" json:"others,omitempty" pg:"others"` WeMustGoDeeper *RequiredInnerMessage `protobuf:"bytes,13,opt,name=we_must_go_deeper,json=weMustGoDeeper" json:"we_must_go_deeper,omitempty" pg:"we_must_go_deeper"` RepInner []*InnerMessage `protobuf:"bytes,12,rep,name=rep_inner,json=repInner" json:"rep_inner,omitempty" pg:"rep_inner"` Bikeshed *MyMessage_Color `protobuf:"varint,7,opt,name=bikeshed,enum=test_proto.MyMessage_Color" json:"bikeshed,omitempty" pg:"bikeshed"` Somegroup *MyMessage_SomeGroup `protobuf:"group,8,opt,name=SomeGroup,json=somegroup" json:"somegroup,omitempty" pg:"somegroup"` // This field becomes [][]byte in the generated code. RepBytes [][]byte `protobuf:"bytes,10,rep,name=rep_bytes,json=repBytes" json:"rep_bytes,omitempty" pg:"rep_bytes"` Bigfloat *float64 `protobuf:"fixed64,11,opt,name=bigfloat" json:"bigfloat,omitempty" pg:"bigfloat"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` proto.XXX_InternalExtensions `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *MyMessage) Reset() { *m = MyMessage{} } func (m *MyMessage) String() string { return proto.CompactTextString(m) } func (*MyMessage) ProtoMessage() {} func (*MyMessage) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{13} } var extRange_MyMessage = []proto.ExtensionRange{ {Start: 100, End: 536870911}, } func (*MyMessage) ExtensionRangeArray() []proto.ExtensionRange { return extRange_MyMessage } func (m *MyMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MyMessage.Unmarshal(m, b) } func (m *MyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MyMessage.Marshal(b, m, deterministic) } func (m *MyMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_MyMessage.Merge(m, src) } func (m *MyMessage) XXX_Size() int { return xxx_messageInfo_MyMessage.Size(m) } func (m *MyMessage) XXX_DiscardUnknown() { xxx_messageInfo_MyMessage.DiscardUnknown(m) } var xxx_messageInfo_MyMessage proto.InternalMessageInfo func (m *MyMessage) GetCount() int32 { if m != nil && m.Count != nil { return *m.Count } return 0 } func (m *MyMessage) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *MyMessage) GetQuote() string { if m != nil && m.Quote != nil { return *m.Quote } return "" } func (m *MyMessage) GetPet() []string { if m != nil { return m.Pet } return nil } func (m *MyMessage) GetInner() *InnerMessage { if m != nil { return m.Inner } return nil } func (m *MyMessage) GetOthers() []*OtherMessage { if m != nil { return m.Others } return nil } func (m *MyMessage) GetWeMustGoDeeper() *RequiredInnerMessage { if m != nil { return m.WeMustGoDeeper } return nil } func (m *MyMessage) GetRepInner() []*InnerMessage { if m != nil { return m.RepInner } return nil } func (m *MyMessage) GetBikeshed() MyMessage_Color { if m != nil && m.Bikeshed != nil { return *m.Bikeshed } return MyMessage_RED } func (m *MyMessage) GetSomegroup() *MyMessage_SomeGroup { if m != nil { return m.Somegroup } return nil } func (m *MyMessage) GetRepBytes() [][]byte { if m != nil { return m.RepBytes } return nil } func (m *MyMessage) GetBigfloat() float64 { if m != nil && m.Bigfloat != nil { return *m.Bigfloat } return 0 } type MyMessage_SomeGroup struct { GroupField *int32 `protobuf:"varint,9,opt,name=group_field,json=groupField" json:"group_field,omitempty" pg:"group_field"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} } func (m *MyMessage_SomeGroup) String() string { return proto.CompactTextString(m) } func (*MyMessage_SomeGroup) ProtoMessage() {} func (*MyMessage_SomeGroup) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{13, 0} } func (m *MyMessage_SomeGroup) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MyMessage_SomeGroup.Unmarshal(m, b) } func (m *MyMessage_SomeGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MyMessage_SomeGroup.Marshal(b, m, deterministic) } func (m *MyMessage_SomeGroup) XXX_Merge(src proto.Message) { xxx_messageInfo_MyMessage_SomeGroup.Merge(m, src) } func (m *MyMessage_SomeGroup) XXX_Size() int { return xxx_messageInfo_MyMessage_SomeGroup.Size(m) } func (m *MyMessage_SomeGroup) XXX_DiscardUnknown() { xxx_messageInfo_MyMessage_SomeGroup.DiscardUnknown(m) } var xxx_messageInfo_MyMessage_SomeGroup proto.InternalMessageInfo func (m *MyMessage_SomeGroup) GetGroupField() int32 { if m != nil && m.GroupField != nil { return *m.GroupField } return 0 } type Ext struct { Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty" pg:"data"` MapField map[int32]int32 `protobuf:"bytes,2,rep,name=map_field,json=mapField" json:"map_field,omitempty" pg:"map_field" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *Ext) Reset() { *m = Ext{} } func (m *Ext) String() string { return proto.CompactTextString(m) } func (*Ext) ProtoMessage() {} func (*Ext) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{14} } func (m *Ext) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Ext.Unmarshal(m, b) } func (m *Ext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Ext.Marshal(b, m, deterministic) } func (m *Ext) XXX_Merge(src proto.Message) { xxx_messageInfo_Ext.Merge(m, src) } func (m *Ext) XXX_Size() int { return xxx_messageInfo_Ext.Size(m) } func (m *Ext) XXX_DiscardUnknown() { xxx_messageInfo_Ext.DiscardUnknown(m) } var xxx_messageInfo_Ext proto.InternalMessageInfo func (m *Ext) GetData() string { if m != nil && m.Data != nil { return *m.Data } return "" } func (m *Ext) GetMapField() map[int32]int32 { if m != nil { return m.MapField } return nil } var E_Ext_More = &proto.ExtensionDesc{ ExtendedType: (*MyMessage)(nil), ExtensionType: (*Ext)(nil), Field: 103, Name: "test_proto.Ext.more", Tag: "bytes,103,opt,name=more", Filename: "test.proto", } var E_Ext_Text = &proto.ExtensionDesc{ ExtendedType: (*MyMessage)(nil), ExtensionType: (*string)(nil), Field: 104, Name: "test_proto.Ext.text", Tag: "bytes,104,opt,name=text", Filename: "test.proto", } var E_Ext_Number = &proto.ExtensionDesc{ ExtendedType: (*MyMessage)(nil), ExtensionType: (*int32)(nil), Field: 105, Name: "test_proto.Ext.number", Tag: "varint,105,opt,name=number", Filename: "test.proto", } type ComplexExtension struct { First *int32 `protobuf:"varint,1,opt,name=first" json:"first,omitempty" pg:"first"` Second *int32 `protobuf:"varint,2,opt,name=second" json:"second,omitempty" pg:"second"` Third []int32 `protobuf:"varint,3,rep,name=third" json:"third,omitempty" pg:"third"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *ComplexExtension) Reset() { *m = ComplexExtension{} } func (m *ComplexExtension) String() string { return proto.CompactTextString(m) } func (*ComplexExtension) ProtoMessage() {} func (*ComplexExtension) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{15} } func (m *ComplexExtension) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ComplexExtension.Unmarshal(m, b) } func (m *ComplexExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ComplexExtension.Marshal(b, m, deterministic) } func (m *ComplexExtension) XXX_Merge(src proto.Message) { xxx_messageInfo_ComplexExtension.Merge(m, src) } func (m *ComplexExtension) XXX_Size() int { return xxx_messageInfo_ComplexExtension.Size(m) } func (m *ComplexExtension) XXX_DiscardUnknown() { xxx_messageInfo_ComplexExtension.DiscardUnknown(m) } var xxx_messageInfo_ComplexExtension proto.InternalMessageInfo func (m *ComplexExtension) GetFirst() int32 { if m != nil && m.First != nil { return *m.First } return 0 } func (m *ComplexExtension) GetSecond() int32 { if m != nil && m.Second != nil { return *m.Second } return 0 } func (m *ComplexExtension) GetThird() []int32 { if m != nil { return m.Third } return nil } type DefaultsMessage struct { XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` proto.XXX_InternalExtensions `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *DefaultsMessage) Reset() { *m = DefaultsMessage{} } func (m *DefaultsMessage) String() string { return proto.CompactTextString(m) } func (*DefaultsMessage) ProtoMessage() {} func (*DefaultsMessage) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{16} } var extRange_DefaultsMessage = []proto.ExtensionRange{ {Start: 100, End: 536870911}, } func (*DefaultsMessage) ExtensionRangeArray() []proto.ExtensionRange { return extRange_DefaultsMessage } func (m *DefaultsMessage) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DefaultsMessage.Unmarshal(m, b) } func (m *DefaultsMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_DefaultsMessage.Marshal(b, m, deterministic) } func (m *DefaultsMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_DefaultsMessage.Merge(m, src) } func (m *DefaultsMessage) XXX_Size() int { return xxx_messageInfo_DefaultsMessage.Size(m) } func (m *DefaultsMessage) XXX_DiscardUnknown() { xxx_messageInfo_DefaultsMessage.DiscardUnknown(m) } var xxx_messageInfo_DefaultsMessage proto.InternalMessageInfo type MyMessageSet struct { XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *MyMessageSet) Reset() { *m = MyMessageSet{} } func (m *MyMessageSet) String() string { return proto.CompactTextString(m) } func (*MyMessageSet) ProtoMessage() {} func (*MyMessageSet) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{17} } var extRange_MyMessageSet = []proto.ExtensionRange{ {Start: 100, End: 2147483646}, } func (*MyMessageSet) ExtensionRangeArray() []proto.ExtensionRange { return extRange_MyMessageSet } func (m *MyMessageSet) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MyMessageSet.Unmarshal(m, b) } func (m *MyMessageSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MyMessageSet.Marshal(b, m, deterministic) } func (m *MyMessageSet) XXX_Merge(src proto.Message) { xxx_messageInfo_MyMessageSet.Merge(m, src) } func (m *MyMessageSet) XXX_Size() int { return xxx_messageInfo_MyMessageSet.Size(m) } func (m *MyMessageSet) XXX_DiscardUnknown() { xxx_messageInfo_MyMessageSet.DiscardUnknown(m) } var xxx_messageInfo_MyMessageSet proto.InternalMessageInfo type Empty struct { XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{18} } func (m *Empty) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Empty.Unmarshal(m, b) } func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Empty.Marshal(b, m, deterministic) } func (m *Empty) XXX_Merge(src proto.Message) { xxx_messageInfo_Empty.Merge(m, src) } func (m *Empty) XXX_Size() int { return xxx_messageInfo_Empty.Size(m) } func (m *Empty) XXX_DiscardUnknown() { xxx_messageInfo_Empty.DiscardUnknown(m) } var xxx_messageInfo_Empty proto.InternalMessageInfo type MessageList struct { Message []*MessageList_Message `protobuf:"group,1,rep,name=Message,json=message" json:"message,omitempty" pg:"message"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *MessageList) Reset() { *m = MessageList{} } func (m *MessageList) String() string { return proto.CompactTextString(m) } func (*MessageList) ProtoMessage() {} func (*MessageList) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{19} } func (m *MessageList) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageList.Unmarshal(m, b) } func (m *MessageList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MessageList.Marshal(b, m, deterministic) } func (m *MessageList) XXX_Merge(src proto.Message) { xxx_messageInfo_MessageList.Merge(m, src) } func (m *MessageList) XXX_Size() int { return xxx_messageInfo_MessageList.Size(m) } func (m *MessageList) XXX_DiscardUnknown() { xxx_messageInfo_MessageList.DiscardUnknown(m) } var xxx_messageInfo_MessageList proto.InternalMessageInfo func (m *MessageList) GetMessage() []*MessageList_Message { if m != nil { return m.Message } return nil } type MessageList_Message struct { Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty" pg:"name"` Count *int32 `protobuf:"varint,3,req,name=count" json:"count,omitempty" pg:"count"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *MessageList_Message) Reset() { *m = MessageList_Message{} } func (m *MessageList_Message) String() string { return proto.CompactTextString(m) } func (*MessageList_Message) ProtoMessage() {} func (*MessageList_Message) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{19, 0} } func (m *MessageList_Message) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageList_Message.Unmarshal(m, b) } func (m *MessageList_Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MessageList_Message.Marshal(b, m, deterministic) } func (m *MessageList_Message) XXX_Merge(src proto.Message) { xxx_messageInfo_MessageList_Message.Merge(m, src) } func (m *MessageList_Message) XXX_Size() int { return xxx_messageInfo_MessageList_Message.Size(m) } func (m *MessageList_Message) XXX_DiscardUnknown() { xxx_messageInfo_MessageList_Message.DiscardUnknown(m) } var xxx_messageInfo_MessageList_Message proto.InternalMessageInfo func (m *MessageList_Message) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func (m *MessageList_Message) GetCount() int32 { if m != nil && m.Count != nil { return *m.Count } return 0 } type Strings struct { StringField *string `protobuf:"bytes,1,opt,name=string_field,json=stringField" json:"string_field,omitempty" pg:"string_field"` BytesField []byte `protobuf:"bytes,2,opt,name=bytes_field,json=bytesField" json:"bytes_field,omitempty" pg:"bytes_field"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *Strings) Reset() { *m = Strings{} } func (m *Strings) String() string { return proto.CompactTextString(m) } func (*Strings) ProtoMessage() {} func (*Strings) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{20} } func (m *Strings) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Strings.Unmarshal(m, b) } func (m *Strings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Strings.Marshal(b, m, deterministic) } func (m *Strings) XXX_Merge(src proto.Message) { xxx_messageInfo_Strings.Merge(m, src) } func (m *Strings) XXX_Size() int { return xxx_messageInfo_Strings.Size(m) } func (m *Strings) XXX_DiscardUnknown() { xxx_messageInfo_Strings.DiscardUnknown(m) } var xxx_messageInfo_Strings proto.InternalMessageInfo func (m *Strings) GetStringField() string { if m != nil && m.StringField != nil { return *m.StringField } return "" } func (m *Strings) GetBytesField() []byte { if m != nil { return m.BytesField } return nil } type Defaults struct { // Default-valued fields of all basic types. // Same as GoTest, but copied here to make testing easier. F_Bool *bool `protobuf:"varint,1,opt,name=F_Bool,json=FBool,def=1" json:"F_Bool,omitempty" pg:"F_Bool"` F_Int32 *int32 `protobuf:"varint,2,opt,name=F_Int32,json=FInt32,def=32" json:"F_Int32,omitempty" pg:"F_Int32"` F_Int64 *int64 `protobuf:"varint,3,opt,name=F_Int64,json=FInt64,def=64" json:"F_Int64,omitempty" pg:"F_Int64"` F_Fixed32 *uint32 `protobuf:"fixed32,4,opt,name=F_Fixed32,json=FFixed32,def=320" json:"F_Fixed32,omitempty" pg:"F_Fixed32"` F_Fixed64 *uint64 `protobuf:"fixed64,5,opt,name=F_Fixed64,json=FFixed64,def=640" json:"F_Fixed64,omitempty" pg:"F_Fixed64"` F_Uint32 *uint32 `protobuf:"varint,6,opt,name=F_Uint32,json=FUint32,def=3200" json:"F_Uint32,omitempty" pg:"F_Uint32"` F_Uint64 *uint64 `protobuf:"varint,7,opt,name=F_Uint64,json=FUint64,def=6400" json:"F_Uint64,omitempty" pg:"F_Uint64"` F_Float *float32 `protobuf:"fixed32,8,opt,name=F_Float,json=FFloat,def=314159" json:"F_Float,omitempty" pg:"F_Float"` F_Double *float64 `protobuf:"fixed64,9,opt,name=F_Double,json=FDouble,def=271828" json:"F_Double,omitempty" pg:"F_Double"` F_String *string `protobuf:"bytes,10,opt,name=F_String,json=FString,def=hello, \"world!\"\n" json:"F_String,omitempty" pg:"F_String"` F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=FBytes,def=Bignose" json:"F_Bytes,omitempty" pg:"F_Bytes"` F_Sint32 *int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=FSint32,def=-32" json:"F_Sint32,omitempty" pg:"F_Sint32"` F_Sint64 *int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=FSint64,def=-64" json:"F_Sint64,omitempty" pg:"F_Sint64"` F_Enum *Defaults_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=test_proto.Defaults_Color,def=1" json:"F_Enum,omitempty" pg:"F_Enum"` // More fields with crazy defaults. F_Pinf *float32 `protobuf:"fixed32,15,opt,name=F_Pinf,json=FPinf,def=inf" json:"F_Pinf,omitempty" pg:"F_Pinf"` F_Ninf *float32 `protobuf:"fixed32,16,opt,name=F_Ninf,json=FNinf,def=-inf" json:"F_Ninf,omitempty" pg:"F_Ninf"` F_Nan *float32 `protobuf:"fixed32,17,opt,name=F_Nan,json=FNan,def=nan" json:"F_Nan,omitempty" pg:"F_Nan"` // Sub-message. Sub *SubDefaults `protobuf:"bytes,18,opt,name=sub" json:"sub,omitempty" pg:"sub"` // Redundant but explicit defaults. StrZero *string `protobuf:"bytes,19,opt,name=str_zero,json=strZero,def=" json:"str_zero,omitempty" pg:"str_zero"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *Defaults) Reset() { *m = Defaults{} } func (m *Defaults) String() string { return proto.CompactTextString(m) } func (*Defaults) ProtoMessage() {} func (*Defaults) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{21} } func (m *Defaults) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Defaults.Unmarshal(m, b) } func (m *Defaults) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Defaults.Marshal(b, m, deterministic) } func (m *Defaults) XXX_Merge(src proto.Message) { xxx_messageInfo_Defaults.Merge(m, src) } func (m *Defaults) XXX_Size() int { return xxx_messageInfo_Defaults.Size(m) } func (m *Defaults) XXX_DiscardUnknown() { xxx_messageInfo_Defaults.DiscardUnknown(m) } var xxx_messageInfo_Defaults proto.InternalMessageInfo const Default_Defaults_F_Bool bool = true const Default_Defaults_F_Int32 int32 = 32 const Default_Defaults_F_Int64 int64 = 64 const Default_Defaults_F_Fixed32 uint32 = 320 const Default_Defaults_F_Fixed64 uint64 = 640 const Default_Defaults_F_Uint32 uint32 = 3200 const Default_Defaults_F_Uint64 uint64 = 6400 const Default_Defaults_F_Float float32 = 314159 const Default_Defaults_F_Double float64 = 271828 const Default_Defaults_F_String string = "hello, \"world!\"\n" var Default_Defaults_F_Bytes []byte = []byte("Bignose") const Default_Defaults_F_Sint32 int32 = -32 const Default_Defaults_F_Sint64 int64 = -64 const Default_Defaults_F_Enum Defaults_Color = Defaults_GREEN var Default_Defaults_F_Pinf float32 = float32(math.Inf(1)) var Default_Defaults_F_Ninf float32 = float32(math.Inf(-1)) var Default_Defaults_F_Nan float32 = float32(math.NaN()) func (m *Defaults) GetF_Bool() bool { if m != nil && m.F_Bool != nil { return *m.F_Bool } return Default_Defaults_F_Bool } func (m *Defaults) GetF_Int32() int32 { if m != nil && m.F_Int32 != nil { return *m.F_Int32 } return Default_Defaults_F_Int32 } func (m *Defaults) GetF_Int64() int64 { if m != nil && m.F_Int64 != nil { return *m.F_Int64 } return Default_Defaults_F_Int64 } func (m *Defaults) GetF_Fixed32() uint32 { if m != nil && m.F_Fixed32 != nil { return *m.F_Fixed32 } return Default_Defaults_F_Fixed32 } func (m *Defaults) GetF_Fixed64() uint64 { if m != nil && m.F_Fixed64 != nil { return *m.F_Fixed64 } return Default_Defaults_F_Fixed64 } func (m *Defaults) GetF_Uint32() uint32 { if m != nil && m.F_Uint32 != nil { return *m.F_Uint32 } return Default_Defaults_F_Uint32 } func (m *Defaults) GetF_Uint64() uint64 { if m != nil && m.F_Uint64 != nil { return *m.F_Uint64 } return Default_Defaults_F_Uint64 } func (m *Defaults) GetF_Float() float32 { if m != nil && m.F_Float != nil { return *m.F_Float } return Default_Defaults_F_Float } func (m *Defaults) GetF_Double() float64 { if m != nil && m.F_Double != nil { return *m.F_Double } return Default_Defaults_F_Double } func (m *Defaults) GetF_String() string { if m != nil && m.F_String != nil { return *m.F_String } return Default_Defaults_F_String } func (m *Defaults) GetF_Bytes() []byte { if m != nil && m.F_Bytes != nil { return m.F_Bytes } return append([]byte(nil), Default_Defaults_F_Bytes...) } func (m *Defaults) GetF_Sint32() int32 { if m != nil && m.F_Sint32 != nil { return *m.F_Sint32 } return Default_Defaults_F_Sint32 } func (m *Defaults) GetF_Sint64() int64 { if m != nil && m.F_Sint64 != nil { return *m.F_Sint64 } return Default_Defaults_F_Sint64 } func (m *Defaults) GetF_Enum() Defaults_Color { if m != nil && m.F_Enum != nil { return *m.F_Enum } return Default_Defaults_F_Enum } func (m *Defaults) GetF_Pinf() float32 { if m != nil && m.F_Pinf != nil { return *m.F_Pinf } return Default_Defaults_F_Pinf } func (m *Defaults) GetF_Ninf() float32 { if m != nil && m.F_Ninf != nil { return *m.F_Ninf } return Default_Defaults_F_Ninf } func (m *Defaults) GetF_Nan() float32 { if m != nil && m.F_Nan != nil { return *m.F_Nan } return Default_Defaults_F_Nan } func (m *Defaults) GetSub() *SubDefaults { if m != nil { return m.Sub } return nil } func (m *Defaults) GetStrZero() string { if m != nil && m.StrZero != nil { return *m.StrZero } return "" } type SubDefaults struct { N *int64 `protobuf:"varint,1,opt,name=n,def=7" json:"n,omitempty" pg:"n"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *SubDefaults) Reset() { *m = SubDefaults{} } func (m *SubDefaults) String() string { return proto.CompactTextString(m) } func (*SubDefaults) ProtoMessage() {} func (*SubDefaults) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{22} } func (m *SubDefaults) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SubDefaults.Unmarshal(m, b) } func (m *SubDefaults) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SubDefaults.Marshal(b, m, deterministic) } func (m *SubDefaults) XXX_Merge(src proto.Message) { xxx_messageInfo_SubDefaults.Merge(m, src) } func (m *SubDefaults) XXX_Size() int { return xxx_messageInfo_SubDefaults.Size(m) } func (m *SubDefaults) XXX_DiscardUnknown() { xxx_messageInfo_SubDefaults.DiscardUnknown(m) } var xxx_messageInfo_SubDefaults proto.InternalMessageInfo const Default_SubDefaults_N int64 = 7 func (m *SubDefaults) GetN() int64 { if m != nil && m.N != nil { return *m.N } return Default_SubDefaults_N } type RepeatedEnum struct { Color []RepeatedEnum_Color `protobuf:"varint,1,rep,name=color,enum=test_proto.RepeatedEnum_Color" json:"color,omitempty" pg:"color"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *RepeatedEnum) Reset() { *m = RepeatedEnum{} } func (m *RepeatedEnum) String() string { return proto.CompactTextString(m) } func (*RepeatedEnum) ProtoMessage() {} func (*RepeatedEnum) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{23} } func (m *RepeatedEnum) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RepeatedEnum.Unmarshal(m, b) } func (m *RepeatedEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RepeatedEnum.Marshal(b, m, deterministic) } func (m *RepeatedEnum) XXX_Merge(src proto.Message) { xxx_messageInfo_RepeatedEnum.Merge(m, src) } func (m *RepeatedEnum) XXX_Size() int { return xxx_messageInfo_RepeatedEnum.Size(m) } func (m *RepeatedEnum) XXX_DiscardUnknown() { xxx_messageInfo_RepeatedEnum.DiscardUnknown(m) } var xxx_messageInfo_RepeatedEnum proto.InternalMessageInfo func (m *RepeatedEnum) GetColor() []RepeatedEnum_Color { if m != nil { return m.Color } return nil } type MoreRepeated struct { Bools []bool `protobuf:"varint,1,rep,name=bools" json:"bools,omitempty" pg:"bools"` BoolsPacked []bool `protobuf:"varint,2,rep,packed,name=bools_packed,json=boolsPacked" json:"bools_packed,omitempty" pg:"bools_packed"` Ints []int32 `protobuf:"varint,3,rep,name=ints" json:"ints,omitempty" pg:"ints"` IntsPacked []int32 `protobuf:"varint,4,rep,packed,name=ints_packed,json=intsPacked" json:"ints_packed,omitempty" pg:"ints_packed"` Int64SPacked []int64 `protobuf:"varint,7,rep,packed,name=int64s_packed,json=int64sPacked" json:"int64s_packed,omitempty" pg:"int64s_packed"` Strings []string `protobuf:"bytes,5,rep,name=strings" json:"strings,omitempty" pg:"strings"` Fixeds []uint32 `protobuf:"fixed32,6,rep,name=fixeds" json:"fixeds,omitempty" pg:"fixeds"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *MoreRepeated) Reset() { *m = MoreRepeated{} } func (m *MoreRepeated) String() string { return proto.CompactTextString(m) } func (*MoreRepeated) ProtoMessage() {} func (*MoreRepeated) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{24} } func (m *MoreRepeated) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MoreRepeated.Unmarshal(m, b) } func (m *MoreRepeated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MoreRepeated.Marshal(b, m, deterministic) } func (m *MoreRepeated) XXX_Merge(src proto.Message) { xxx_messageInfo_MoreRepeated.Merge(m, src) } func (m *MoreRepeated) XXX_Size() int { return xxx_messageInfo_MoreRepeated.Size(m) } func (m *MoreRepeated) XXX_DiscardUnknown() { xxx_messageInfo_MoreRepeated.DiscardUnknown(m) } var xxx_messageInfo_MoreRepeated proto.InternalMessageInfo func (m *MoreRepeated) GetBools() []bool { if m != nil { return m.Bools } return nil } func (m *MoreRepeated) GetBoolsPacked() []bool { if m != nil { return m.BoolsPacked } return nil } func (m *MoreRepeated) GetInts() []int32 { if m != nil { return m.Ints } return nil } func (m *MoreRepeated) GetIntsPacked() []int32 { if m != nil { return m.IntsPacked } return nil } func (m *MoreRepeated) GetInt64SPacked() []int64 { if m != nil { return m.Int64SPacked } return nil } func (m *MoreRepeated) GetStrings() []string { if m != nil { return m.Strings } return nil } func (m *MoreRepeated) GetFixeds() []uint32 { if m != nil { return m.Fixeds } return nil } type GroupOld struct { G *GroupOld_G `protobuf:"group,101,opt,name=G,json=g" json:"g,omitempty" pg:"g"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GroupOld) Reset() { *m = GroupOld{} } func (m *GroupOld) String() string { return proto.CompactTextString(m) } func (*GroupOld) ProtoMessage() {} func (*GroupOld) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{25} } func (m *GroupOld) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupOld.Unmarshal(m, b) } func (m *GroupOld) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GroupOld.Marshal(b, m, deterministic) } func (m *GroupOld) XXX_Merge(src proto.Message) { xxx_messageInfo_GroupOld.Merge(m, src) } func (m *GroupOld) XXX_Size() int { return xxx_messageInfo_GroupOld.Size(m) } func (m *GroupOld) XXX_DiscardUnknown() { xxx_messageInfo_GroupOld.DiscardUnknown(m) } var xxx_messageInfo_GroupOld proto.InternalMessageInfo func (m *GroupOld) GetG() *GroupOld_G { if m != nil { return m.G } return nil } type GroupOld_G struct { X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty" pg:"x"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GroupOld_G) Reset() { *m = GroupOld_G{} } func (m *GroupOld_G) String() string { return proto.CompactTextString(m) } func (*GroupOld_G) ProtoMessage() {} func (*GroupOld_G) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{25, 0} } func (m *GroupOld_G) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupOld_G.Unmarshal(m, b) } func (m *GroupOld_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GroupOld_G.Marshal(b, m, deterministic) } func (m *GroupOld_G) XXX_Merge(src proto.Message) { xxx_messageInfo_GroupOld_G.Merge(m, src) } func (m *GroupOld_G) XXX_Size() int { return xxx_messageInfo_GroupOld_G.Size(m) } func (m *GroupOld_G) XXX_DiscardUnknown() { xxx_messageInfo_GroupOld_G.DiscardUnknown(m) } var xxx_messageInfo_GroupOld_G proto.InternalMessageInfo func (m *GroupOld_G) GetX() int32 { if m != nil && m.X != nil { return *m.X } return 0 } type GroupNew struct { G *GroupNew_G `protobuf:"group,101,opt,name=G,json=g" json:"g,omitempty" pg:"g"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GroupNew) Reset() { *m = GroupNew{} } func (m *GroupNew) String() string { return proto.CompactTextString(m) } func (*GroupNew) ProtoMessage() {} func (*GroupNew) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{26} } func (m *GroupNew) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupNew.Unmarshal(m, b) } func (m *GroupNew) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GroupNew.Marshal(b, m, deterministic) } func (m *GroupNew) XXX_Merge(src proto.Message) { xxx_messageInfo_GroupNew.Merge(m, src) } func (m *GroupNew) XXX_Size() int { return xxx_messageInfo_GroupNew.Size(m) } func (m *GroupNew) XXX_DiscardUnknown() { xxx_messageInfo_GroupNew.DiscardUnknown(m) } var xxx_messageInfo_GroupNew proto.InternalMessageInfo func (m *GroupNew) GetG() *GroupNew_G { if m != nil { return m.G } return nil } type GroupNew_G struct { X *int32 `protobuf:"varint,2,opt,name=x" json:"x,omitempty" pg:"x"` Y *int32 `protobuf:"varint,3,opt,name=y" json:"y,omitempty" pg:"y"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *GroupNew_G) Reset() { *m = GroupNew_G{} } func (m *GroupNew_G) String() string { return proto.CompactTextString(m) } func (*GroupNew_G) ProtoMessage() {} func (*GroupNew_G) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{26, 0} } func (m *GroupNew_G) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupNew_G.Unmarshal(m, b) } func (m *GroupNew_G) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GroupNew_G.Marshal(b, m, deterministic) } func (m *GroupNew_G) XXX_Merge(src proto.Message) { xxx_messageInfo_GroupNew_G.Merge(m, src) } func (m *GroupNew_G) XXX_Size() int { return xxx_messageInfo_GroupNew_G.Size(m) } func (m *GroupNew_G) XXX_DiscardUnknown() { xxx_messageInfo_GroupNew_G.DiscardUnknown(m) } var xxx_messageInfo_GroupNew_G proto.InternalMessageInfo func (m *GroupNew_G) GetX() int32 { if m != nil && m.X != nil { return *m.X } return 0 } func (m *GroupNew_G) GetY() int32 { if m != nil && m.Y != nil { return *m.Y } return 0 } type FloatingPoint struct { F *float64 `protobuf:"fixed64,1,req,name=f" json:"f,omitempty" pg:"f"` Exact *bool `protobuf:"varint,2,opt,name=exact" json:"exact,omitempty" pg:"exact"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *FloatingPoint) Reset() { *m = FloatingPoint{} } func (m *FloatingPoint) String() string { return proto.CompactTextString(m) } func (*FloatingPoint) ProtoMessage() {} func (*FloatingPoint) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{27} } func (m *FloatingPoint) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FloatingPoint.Unmarshal(m, b) } func (m *FloatingPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_FloatingPoint.Marshal(b, m, deterministic) } func (m *FloatingPoint) XXX_Merge(src proto.Message) { xxx_messageInfo_FloatingPoint.Merge(m, src) } func (m *FloatingPoint) XXX_Size() int { return xxx_messageInfo_FloatingPoint.Size(m) } func (m *FloatingPoint) XXX_DiscardUnknown() { xxx_messageInfo_FloatingPoint.DiscardUnknown(m) } var xxx_messageInfo_FloatingPoint proto.InternalMessageInfo func (m *FloatingPoint) GetF() float64 { if m != nil && m.F != nil { return *m.F } return 0 } func (m *FloatingPoint) GetExact() bool { if m != nil && m.Exact != nil { return *m.Exact } return false } type MessageWithMap struct { NameMapping map[int32]string `protobuf:"bytes,1,rep,name=name_mapping,json=nameMapping" json:"name_mapping,omitempty" pg:"name_mapping" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` MsgMapping map[int64]*FloatingPoint `protobuf:"bytes,2,rep,name=msg_mapping,json=msgMapping" json:"msg_mapping,omitempty" pg:"msg_mapping" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` ByteMapping map[bool][]byte `protobuf:"bytes,3,rep,name=byte_mapping,json=byteMapping" json:"byte_mapping,omitempty" pg:"byte_mapping" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` StrToStr map[string]string `protobuf:"bytes,4,rep,name=str_to_str,json=strToStr" json:"str_to_str,omitempty" pg:"str_to_str" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *MessageWithMap) Reset() { *m = MessageWithMap{} } func (m *MessageWithMap) String() string { return proto.CompactTextString(m) } func (*MessageWithMap) ProtoMessage() {} func (*MessageWithMap) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{28} } func (m *MessageWithMap) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MessageWithMap.Unmarshal(m, b) } func (m *MessageWithMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_MessageWithMap.Marshal(b, m, deterministic) } func (m *MessageWithMap) XXX_Merge(src proto.Message) { xxx_messageInfo_MessageWithMap.Merge(m, src) } func (m *MessageWithMap) XXX_Size() int { return xxx_messageInfo_MessageWithMap.Size(m) } func (m *MessageWithMap) XXX_DiscardUnknown() { xxx_messageInfo_MessageWithMap.DiscardUnknown(m) } var xxx_messageInfo_MessageWithMap proto.InternalMessageInfo func (m *MessageWithMap) GetNameMapping() map[int32]string { if m != nil { return m.NameMapping } return nil } func (m *MessageWithMap) GetMsgMapping() map[int64]*FloatingPoint { if m != nil { return m.MsgMapping } return nil } func (m *MessageWithMap) GetByteMapping() map[bool][]byte { if m != nil { return m.ByteMapping } return nil } func (m *MessageWithMap) GetStrToStr() map[string]string { if m != nil { return m.StrToStr } return nil } type Oneof struct { // Types that are valid to be assigned to Union: // *Oneof_F_Bool // *Oneof_F_Int32 // *Oneof_F_Int64 // *Oneof_F_Fixed32 // *Oneof_F_Fixed64 // *Oneof_F_Uint32 // *Oneof_F_Uint64 // *Oneof_F_Float // *Oneof_F_Double // *Oneof_F_String // *Oneof_F_Bytes // *Oneof_F_Sint32 // *Oneof_F_Sint64 // *Oneof_F_Enum // *Oneof_F_Message // *Oneof_FGroup // *Oneof_F_Largest_Tag Union isOneof_Union `protobuf_oneof:"union"` // Types that are valid to be assigned to Tormato: // *Oneof_Value Tormato isOneof_Tormato `protobuf_oneof:"tormato"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *Oneof) Reset() { *m = Oneof{} } func (m *Oneof) String() string { return proto.CompactTextString(m) } func (*Oneof) ProtoMessage() {} func (*Oneof) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{29} } func (m *Oneof) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Oneof.Unmarshal(m, b) } func (m *Oneof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Oneof.Marshal(b, m, deterministic) } func (m *Oneof) XXX_Merge(src proto.Message) { xxx_messageInfo_Oneof.Merge(m, src) } func (m *Oneof) XXX_Size() int { return xxx_messageInfo_Oneof.Size(m) } func (m *Oneof) XXX_DiscardUnknown() { xxx_messageInfo_Oneof.DiscardUnknown(m) } var xxx_messageInfo_Oneof proto.InternalMessageInfo type isOneof_Union interface { isOneof_Union() } type isOneof_Tormato interface { isOneof_Tormato() } type Oneof_F_Bool struct { F_Bool bool `protobuf:"varint,1,opt,name=F_Bool,json=FBool,oneof" json:"F_Bool,omitempty" pg:"F_Bool"` } type Oneof_F_Int32 struct { F_Int32 int32 `protobuf:"varint,2,opt,name=F_Int32,json=FInt32,oneof" json:"F_Int32,omitempty" pg:"F_Int32"` } type Oneof_F_Int64 struct { F_Int64 int64 `protobuf:"varint,3,opt,name=F_Int64,json=FInt64,oneof" json:"F_Int64,omitempty" pg:"F_Int64"` } type Oneof_F_Fixed32 struct { F_Fixed32 uint32 `protobuf:"fixed32,4,opt,name=F_Fixed32,json=FFixed32,oneof" json:"F_Fixed32,omitempty" pg:"F_Fixed32"` } type Oneof_F_Fixed64 struct { F_Fixed64 uint64 `protobuf:"fixed64,5,opt,name=F_Fixed64,json=FFixed64,oneof" json:"F_Fixed64,omitempty" pg:"F_Fixed64"` } type Oneof_F_Uint32 struct { F_Uint32 uint32 `protobuf:"varint,6,opt,name=F_Uint32,json=FUint32,oneof" json:"F_Uint32,omitempty" pg:"F_Uint32"` } type Oneof_F_Uint64 struct { F_Uint64 uint64 `protobuf:"varint,7,opt,name=F_Uint64,json=FUint64,oneof" json:"F_Uint64,omitempty" pg:"F_Uint64"` } type Oneof_F_Float struct { F_Float float32 `protobuf:"fixed32,8,opt,name=F_Float,json=FFloat,oneof" json:"F_Float,omitempty" pg:"F_Float"` } type Oneof_F_Double struct { F_Double float64 `protobuf:"fixed64,9,opt,name=F_Double,json=FDouble,oneof" json:"F_Double,omitempty" pg:"F_Double"` } type Oneof_F_String struct { F_String string `protobuf:"bytes,10,opt,name=F_String,json=FString,oneof" json:"F_String,omitempty" pg:"F_String"` } type Oneof_F_Bytes struct { F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=FBytes,oneof" json:"F_Bytes,omitempty" pg:"F_Bytes"` } type Oneof_F_Sint32 struct { F_Sint32 int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=FSint32,oneof" json:"F_Sint32,omitempty" pg:"F_Sint32"` } type Oneof_F_Sint64 struct { F_Sint64 int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=FSint64,oneof" json:"F_Sint64,omitempty" pg:"F_Sint64"` } type Oneof_F_Enum struct { F_Enum MyMessage_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=test_proto.MyMessage_Color,oneof" json:"F_Enum,omitempty" pg:"F_Enum"` } type Oneof_F_Message struct { F_Message *GoTestField `protobuf:"bytes,15,opt,name=F_Message,json=FMessage,oneof" json:"F_Message,omitempty" pg:"F_Message"` } type Oneof_FGroup struct { FGroup *Oneof_F_Group `protobuf:"group,16,opt,name=F_Group,json=fGroup,oneof" json:"f_group,omitempty" pg:"f_group"` } type Oneof_F_Largest_Tag struct { F_Largest_Tag int32 `protobuf:"varint,536870911,opt,name=F_Largest_Tag,json=FLargestTag,oneof" json:"F_Largest_Tag,omitempty" pg:"F_Largest_Tag"` } type Oneof_Value struct { Value int32 `protobuf:"varint,100,opt,name=value,oneof" json:"value,omitempty" pg:"value"` } func (*Oneof_F_Bool) isOneof_Union() {} func (*Oneof_F_Int32) isOneof_Union() {} func (*Oneof_F_Int64) isOneof_Union() {} func (*Oneof_F_Fixed32) isOneof_Union() {} func (*Oneof_F_Fixed64) isOneof_Union() {} func (*Oneof_F_Uint32) isOneof_Union() {} func (*Oneof_F_Uint64) isOneof_Union() {} func (*Oneof_F_Float) isOneof_Union() {} func (*Oneof_F_Double) isOneof_Union() {} func (*Oneof_F_String) isOneof_Union() {} func (*Oneof_F_Bytes) isOneof_Union() {} func (*Oneof_F_Sint32) isOneof_Union() {} func (*Oneof_F_Sint64) isOneof_Union() {} func (*Oneof_F_Enum) isOneof_Union() {} func (*Oneof_F_Message) isOneof_Union() {} func (*Oneof_FGroup) isOneof_Union() {} func (*Oneof_F_Largest_Tag) isOneof_Union() {} func (*Oneof_Value) isOneof_Tormato() {} func (m *Oneof) GetUnion() isOneof_Union { if m != nil { return m.Union } return nil } func (m *Oneof) GetTormato() isOneof_Tormato { if m != nil { return m.Tormato } return nil } func (m *Oneof) GetF_Bool() bool { if x, ok := m.GetUnion().(*Oneof_F_Bool); ok { return x.F_Bool } return false } func (m *Oneof) GetF_Int32() int32 { if x, ok := m.GetUnion().(*Oneof_F_Int32); ok { return x.F_Int32 } return 0 } func (m *Oneof) GetF_Int64() int64 { if x, ok := m.GetUnion().(*Oneof_F_Int64); ok { return x.F_Int64 } return 0 } func (m *Oneof) GetF_Fixed32() uint32 { if x, ok := m.GetUnion().(*Oneof_F_Fixed32); ok { return x.F_Fixed32 } return 0 } func (m *Oneof) GetF_Fixed64() uint64 { if x, ok := m.GetUnion().(*Oneof_F_Fixed64); ok { return x.F_Fixed64 } return 0 } func (m *Oneof) GetF_Uint32() uint32 { if x, ok := m.GetUnion().(*Oneof_F_Uint32); ok { return x.F_Uint32 } return 0 } func (m *Oneof) GetF_Uint64() uint64 { if x, ok := m.GetUnion().(*Oneof_F_Uint64); ok { return x.F_Uint64 } return 0 } func (m *Oneof) GetF_Float() float32 { if x, ok := m.GetUnion().(*Oneof_F_Float); ok { return x.F_Float } return 0 } func (m *Oneof) GetF_Double() float64 { if x, ok := m.GetUnion().(*Oneof_F_Double); ok { return x.F_Double } return 0 } func (m *Oneof) GetF_String() string { if x, ok := m.GetUnion().(*Oneof_F_String); ok { return x.F_String } return "" } func (m *Oneof) GetF_Bytes() []byte { if x, ok := m.GetUnion().(*Oneof_F_Bytes); ok { return x.F_Bytes } return nil } func (m *Oneof) GetF_Sint32() int32 { if x, ok := m.GetUnion().(*Oneof_F_Sint32); ok { return x.F_Sint32 } return 0 } func (m *Oneof) GetF_Sint64() int64 { if x, ok := m.GetUnion().(*Oneof_F_Sint64); ok { return x.F_Sint64 } return 0 } func (m *Oneof) GetF_Enum() MyMessage_Color { if x, ok := m.GetUnion().(*Oneof_F_Enum); ok { return x.F_Enum } return MyMessage_RED } func (m *Oneof) GetF_Message() *GoTestField { if x, ok := m.GetUnion().(*Oneof_F_Message); ok { return x.F_Message } return nil } func (m *Oneof) GetFGroup() *Oneof_F_Group { if x, ok := m.GetUnion().(*Oneof_FGroup); ok { return x.FGroup } return nil } func (m *Oneof) GetF_Largest_Tag() int32 { if x, ok := m.GetUnion().(*Oneof_F_Largest_Tag); ok { return x.F_Largest_Tag } return 0 } func (m *Oneof) GetValue() int32 { if x, ok := m.GetTormato().(*Oneof_Value); ok { return x.Value } return 0 } // XXX_OneofWrappers is for the internal use of the proto package. func (*Oneof) XXX_OneofWrappers() []interface{} { return []interface{}{ (*Oneof_F_Bool)(nil), (*Oneof_F_Int32)(nil), (*Oneof_F_Int64)(nil), (*Oneof_F_Fixed32)(nil), (*Oneof_F_Fixed64)(nil), (*Oneof_F_Uint32)(nil), (*Oneof_F_Uint64)(nil), (*Oneof_F_Float)(nil), (*Oneof_F_Double)(nil), (*Oneof_F_String)(nil), (*Oneof_F_Bytes)(nil), (*Oneof_F_Sint32)(nil), (*Oneof_F_Sint64)(nil), (*Oneof_F_Enum)(nil), (*Oneof_F_Message)(nil), (*Oneof_FGroup)(nil), (*Oneof_F_Largest_Tag)(nil), (*Oneof_Value)(nil), } } type Oneof_F_Group struct { X *int32 `protobuf:"varint,17,opt,name=x" json:"x,omitempty" pg:"x"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *Oneof_F_Group) Reset() { *m = Oneof_F_Group{} } func (m *Oneof_F_Group) String() string { return proto.CompactTextString(m) } func (*Oneof_F_Group) ProtoMessage() {} func (*Oneof_F_Group) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{29, 0} } func (m *Oneof_F_Group) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Oneof_F_Group.Unmarshal(m, b) } func (m *Oneof_F_Group) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Oneof_F_Group.Marshal(b, m, deterministic) } func (m *Oneof_F_Group) XXX_Merge(src proto.Message) { xxx_messageInfo_Oneof_F_Group.Merge(m, src) } func (m *Oneof_F_Group) XXX_Size() int { return xxx_messageInfo_Oneof_F_Group.Size(m) } func (m *Oneof_F_Group) XXX_DiscardUnknown() { xxx_messageInfo_Oneof_F_Group.DiscardUnknown(m) } var xxx_messageInfo_Oneof_F_Group proto.InternalMessageInfo func (m *Oneof_F_Group) GetX() int32 { if m != nil && m.X != nil { return *m.X } return 0 } type Communique struct { MakeMeCry *bool `protobuf:"varint,1,opt,name=make_me_cry,json=makeMeCry" json:"make_me_cry,omitempty" pg:"make_me_cry"` // This is a oneof, called "union". // // Types that are valid to be assigned to Union: // *Communique_Number // *Communique_Name // *Communique_Data // *Communique_TempC // *Communique_Col // *Communique_Msg Union isCommunique_Union `protobuf_oneof:"union"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *Communique) Reset() { *m = Communique{} } func (m *Communique) String() string { return proto.CompactTextString(m) } func (*Communique) ProtoMessage() {} func (*Communique) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{30} } func (m *Communique) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Communique.Unmarshal(m, b) } func (m *Communique) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Communique.Marshal(b, m, deterministic) } func (m *Communique) XXX_Merge(src proto.Message) { xxx_messageInfo_Communique.Merge(m, src) } func (m *Communique) XXX_Size() int { return xxx_messageInfo_Communique.Size(m) } func (m *Communique) XXX_DiscardUnknown() { xxx_messageInfo_Communique.DiscardUnknown(m) } var xxx_messageInfo_Communique proto.InternalMessageInfo type isCommunique_Union interface { isCommunique_Union() } type Communique_Number struct { Number int32 `protobuf:"varint,5,opt,name=number,oneof" json:"number,omitempty" pg:"number"` } type Communique_Name struct { Name string `protobuf:"bytes,6,opt,name=name,oneof" json:"name,omitempty" pg:"name"` } type Communique_Data struct { Data []byte `protobuf:"bytes,7,opt,name=data,oneof" json:"data,omitempty" pg:"data"` } type Communique_TempC struct { TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof" json:"temp_c,omitempty" pg:"temp_c"` } type Communique_Col struct { Col MyMessage_Color `protobuf:"varint,9,opt,name=col,enum=test_proto.MyMessage_Color,oneof" json:"col,omitempty" pg:"col"` } type Communique_Msg struct { Msg *Strings `protobuf:"bytes,10,opt,name=msg,oneof" json:"msg,omitempty" pg:"msg"` } func (*Communique_Number) isCommunique_Union() {} func (*Communique_Name) isCommunique_Union() {} func (*Communique_Data) isCommunique_Union() {} func (*Communique_TempC) isCommunique_Union() {} func (*Communique_Col) isCommunique_Union() {} func (*Communique_Msg) isCommunique_Union() {} func (m *Communique) GetUnion() isCommunique_Union { if m != nil { return m.Union } return nil } func (m *Communique) GetMakeMeCry() bool { if m != nil && m.MakeMeCry != nil { return *m.MakeMeCry } return false } func (m *Communique) GetNumber() int32 { if x, ok := m.GetUnion().(*Communique_Number); ok { return x.Number } return 0 } func (m *Communique) GetName() string { if x, ok := m.GetUnion().(*Communique_Name); ok { return x.Name } return "" } func (m *Communique) GetData() []byte { if x, ok := m.GetUnion().(*Communique_Data); ok { return x.Data } return nil } func (m *Communique) GetTempC() float64 { if x, ok := m.GetUnion().(*Communique_TempC); ok { return x.TempC } return 0 } func (m *Communique) GetCol() MyMessage_Color { if x, ok := m.GetUnion().(*Communique_Col); ok { return x.Col } return MyMessage_RED } func (m *Communique) GetMsg() *Strings { if x, ok := m.GetUnion().(*Communique_Msg); ok { return x.Msg } return nil } // XXX_OneofWrappers is for the internal use of the proto package. func (*Communique) XXX_OneofWrappers() []interface{} { return []interface{}{ (*Communique_Number)(nil), (*Communique_Name)(nil), (*Communique_Data)(nil), (*Communique_TempC)(nil), (*Communique_Col)(nil), (*Communique_Msg)(nil), } } type TestUTF8 struct { Scalar *string `protobuf:"bytes,1,opt,name=scalar" json:"scalar,omitempty" pg:"scalar"` Vector []string `protobuf:"bytes,2,rep,name=vector" json:"vector,omitempty" pg:"vector"` // Types that are valid to be assigned to Oneof: // *TestUTF8_Field Oneof isTestUTF8_Oneof `protobuf_oneof:"oneof"` MapKey map[string]int64 `protobuf:"bytes,4,rep,name=map_key,json=mapKey" json:"map_key,omitempty" pg:"map_key" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` MapValue map[int64]string `protobuf:"bytes,5,rep,name=map_value,json=mapValue" json:"map_value,omitempty" pg:"map_value" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` XXX_NoUnkeyedLiteral struct{} `json:"-" pg:"-"` XXX_unrecognized []byte `json:"-" pg:"-"` XXX_sizecache int32 `json:"-" pg:"-"` } func (m *TestUTF8) Reset() { *m = TestUTF8{} } func (m *TestUTF8) String() string { return proto.CompactTextString(m) } func (*TestUTF8) ProtoMessage() {} func (*TestUTF8) Descriptor() ([]byte, []int) { return fileDescriptor_c161fcfdc0c3ff1e, []int{31} } func (m *TestUTF8) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TestUTF8.Unmarshal(m, b) } func (m *TestUTF8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_TestUTF8.Marshal(b, m, deterministic) } func (m *TestUTF8) XXX_Merge(src proto.Message) { xxx_messageInfo_TestUTF8.Merge(m, src) } func (m *TestUTF8) XXX_Size() int { return xxx_messageInfo_TestUTF8.Size(m) } func (m *TestUTF8) XXX_DiscardUnknown() { xxx_messageInfo_TestUTF8.DiscardUnknown(m) } var xxx_messageInfo_TestUTF8 proto.InternalMessageInfo type isTestUTF8_Oneof interface { isTestUTF8_Oneof() } type TestUTF8_Field struct { Field string `protobuf:"bytes,3,opt,name=field,oneof" json:"field,omitempty" pg:"field"` } func (*TestUTF8_Field) isTestUTF8_Oneof() {} func (m *TestUTF8) GetOneof() isTestUTF8_Oneof { if m != nil { return m.Oneof } return nil } func (m *TestUTF8) GetScalar() string { if m != nil && m.Scalar != nil { return *m.Scalar } return "" } func (m *TestUTF8) GetVector() []string { if m != nil { return m.Vector } return nil } func (m *TestUTF8) GetField() string { if x, ok := m.GetOneof().(*TestUTF8_Field); ok { return x.Field } return "" } func (m *TestUTF8) GetMapKey() map[string]int64 { if m != nil { return m.MapKey } return nil } func (m *TestUTF8) GetMapValue() map[int64]string { if m != nil { return m.MapValue } return nil } // XXX_OneofWrappers is for the internal use of the proto package. func (*TestUTF8) XXX_OneofWrappers() []interface{} { return []interface{}{ (*TestUTF8_Field)(nil), } } var E_Greeting = &proto.ExtensionDesc{ ExtendedType: (*MyMessage)(nil), ExtensionType: ([]string)(nil), Field: 106, Name: "test_proto.greeting", Tag: "bytes,106,rep,name=greeting", Filename: "test.proto", } var E_Complex = &proto.ExtensionDesc{ ExtendedType: (*OtherMessage)(nil), ExtensionType: (*ComplexExtension)(nil), Field: 200, Name: "test_proto.complex", Tag: "bytes,200,opt,name=complex", Filename: "test.proto", } var E_RComplex = &proto.ExtensionDesc{ ExtendedType: (*OtherMessage)(nil), ExtensionType: ([]*ComplexExtension)(nil), Field: 201, Name: "test_proto.r_complex", Tag: "bytes,201,rep,name=r_complex", Filename: "test.proto", } var E_NoDefaultDouble = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*float64)(nil), Field: 101, Name: "test_proto.no_default_double", Tag: "fixed64,101,opt,name=no_default_double", Filename: "test.proto", } var E_NoDefaultFloat = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*float32)(nil), Field: 102, Name: "test_proto.no_default_float", Tag: "fixed32,102,opt,name=no_default_float", Filename: "test.proto", } var E_NoDefaultInt32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 103, Name: "test_proto.no_default_int32", Tag: "varint,103,opt,name=no_default_int32", Filename: "test.proto", } var E_NoDefaultInt64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 104, Name: "test_proto.no_default_int64", Tag: "varint,104,opt,name=no_default_int64", Filename: "test.proto", } var E_NoDefaultUint32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint32)(nil), Field: 105, Name: "test_proto.no_default_uint32", Tag: "varint,105,opt,name=no_default_uint32", Filename: "test.proto", } var E_NoDefaultUint64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint64)(nil), Field: 106, Name: "test_proto.no_default_uint64", Tag: "varint,106,opt,name=no_default_uint64", Filename: "test.proto", } var E_NoDefaultSint32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 107, Name: "test_proto.no_default_sint32", Tag: "zigzag32,107,opt,name=no_default_sint32", Filename: "test.proto", } var E_NoDefaultSint64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 108, Name: "test_proto.no_default_sint64", Tag: "zigzag64,108,opt,name=no_default_sint64", Filename: "test.proto", } var E_NoDefaultFixed32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint32)(nil), Field: 109, Name: "test_proto.no_default_fixed32", Tag: "fixed32,109,opt,name=no_default_fixed32", Filename: "test.proto", } var E_NoDefaultFixed64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint64)(nil), Field: 110, Name: "test_proto.no_default_fixed64", Tag: "fixed64,110,opt,name=no_default_fixed64", Filename: "test.proto", } var E_NoDefaultSfixed32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 111, Name: "test_proto.no_default_sfixed32", Tag: "fixed32,111,opt,name=no_default_sfixed32", Filename: "test.proto", } var E_NoDefaultSfixed64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 112, Name: "test_proto.no_default_sfixed64", Tag: "fixed64,112,opt,name=no_default_sfixed64", Filename: "test.proto", } var E_NoDefaultBool = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*bool)(nil), Field: 113, Name: "test_proto.no_default_bool", Tag: "varint,113,opt,name=no_default_bool", Filename: "test.proto", } var E_NoDefaultString = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*string)(nil), Field: 114, Name: "test_proto.no_default_string", Tag: "bytes,114,opt,name=no_default_string", Filename: "test.proto", } var E_NoDefaultBytes = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: ([]byte)(nil), Field: 115, Name: "test_proto.no_default_bytes", Tag: "bytes,115,opt,name=no_default_bytes", Filename: "test.proto", } var E_NoDefaultEnum = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*DefaultsMessage_DefaultsEnum)(nil), Field: 116, Name: "test_proto.no_default_enum", Tag: "varint,116,opt,name=no_default_enum,enum=test_proto.DefaultsMessage_DefaultsEnum", Filename: "test.proto", } var E_DefaultDouble = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*float64)(nil), Field: 201, Name: "test_proto.default_double", Tag: "fixed64,201,opt,name=default_double,def=3.1415", Filename: "test.proto", } var E_DefaultFloat = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*float32)(nil), Field: 202, Name: "test_proto.default_float", Tag: "fixed32,202,opt,name=default_float,def=3.14", Filename: "test.proto", } var E_DefaultInt32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 203, Name: "test_proto.default_int32", Tag: "varint,203,opt,name=default_int32,def=42", Filename: "test.proto", } var E_DefaultInt64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 204, Name: "test_proto.default_int64", Tag: "varint,204,opt,name=default_int64,def=43", Filename: "test.proto", } var E_DefaultUint32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint32)(nil), Field: 205, Name: "test_proto.default_uint32", Tag: "varint,205,opt,name=default_uint32,def=44", Filename: "test.proto", } var E_DefaultUint64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint64)(nil), Field: 206, Name: "test_proto.default_uint64", Tag: "varint,206,opt,name=default_uint64,def=45", Filename: "test.proto", } var E_DefaultSint32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 207, Name: "test_proto.default_sint32", Tag: "zigzag32,207,opt,name=default_sint32,def=46", Filename: "test.proto", } var E_DefaultSint64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 208, Name: "test_proto.default_sint64", Tag: "zigzag64,208,opt,name=default_sint64,def=47", Filename: "test.proto", } var E_DefaultFixed32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint32)(nil), Field: 209, Name: "test_proto.default_fixed32", Tag: "fixed32,209,opt,name=default_fixed32,def=48", Filename: "test.proto", } var E_DefaultFixed64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*uint64)(nil), Field: 210, Name: "test_proto.default_fixed64", Tag: "fixed64,210,opt,name=default_fixed64,def=49", Filename: "test.proto", } var E_DefaultSfixed32 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int32)(nil), Field: 211, Name: "test_proto.default_sfixed32", Tag: "fixed32,211,opt,name=default_sfixed32,def=50", Filename: "test.proto", } var E_DefaultSfixed64 = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*int64)(nil), Field: 212, Name: "test_proto.default_sfixed64", Tag: "fixed64,212,opt,name=default_sfixed64,def=51", Filename: "test.proto", } var E_DefaultBool = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*bool)(nil), Field: 213, Name: "test_proto.default_bool", Tag: "varint,213,opt,name=default_bool,def=1", Filename: "test.proto", } var E_DefaultString = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*string)(nil), Field: 214, Name: "test_proto.default_string", Tag: "bytes,214,opt,name=default_string,def=Hello, string,def=foo", Filename: "test.proto", } var E_DefaultBytes = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: ([]byte)(nil), Field: 215, Name: "test_proto.default_bytes", Tag: "bytes,215,opt,name=default_bytes,def=Hello, bytes", Filename: "test.proto", } var E_DefaultEnum = &proto.ExtensionDesc{ ExtendedType: (*DefaultsMessage)(nil), ExtensionType: (*DefaultsMessage_DefaultsEnum)(nil), Field: 216, Name: "test_proto.default_enum", Tag: "varint,216,opt,name=default_enum,enum=test_proto.DefaultsMessage_DefaultsEnum,def=1", Filename: "test.proto", } var E_X201 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 201, Name: "test_proto.x201", Tag: "bytes,201,opt,name=x201", Filename: "test.proto", } var E_X202 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 202, Name: "test_proto.x202", Tag: "bytes,202,opt,name=x202", Filename: "test.proto", } var E_X203 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 203, Name: "test_proto.x203", Tag: "bytes,203,opt,name=x203", Filename: "test.proto", } var E_X204 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 204, Name: "test_proto.x204", Tag: "bytes,204,opt,name=x204", Filename: "test.proto", } var E_X205 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 205, Name: "test_proto.x205", Tag: "bytes,205,opt,name=x205", Filename: "test.proto", } var E_X206 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 206, Name: "test_proto.x206", Tag: "bytes,206,opt,name=x206", Filename: "test.proto", } var E_X207 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 207, Name: "test_proto.x207", Tag: "bytes,207,opt,name=x207", Filename: "test.proto", } var E_X208 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 208, Name: "test_proto.x208", Tag: "bytes,208,opt,name=x208", Filename: "test.proto", } var E_X209 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 209, Name: "test_proto.x209", Tag: "bytes,209,opt,name=x209", Filename: "test.proto", } var E_X210 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 210, Name: "test_proto.x210", Tag: "bytes,210,opt,name=x210", Filename: "test.proto", } var E_X211 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 211, Name: "test_proto.x211", Tag: "bytes,211,opt,name=x211", Filename: "test.proto", } var E_X212 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 212, Name: "test_proto.x212", Tag: "bytes,212,opt,name=x212", Filename: "test.proto", } var E_X213 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 213, Name: "test_proto.x213", Tag: "bytes,213,opt,name=x213", Filename: "test.proto", } var E_X214 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 214, Name: "test_proto.x214", Tag: "bytes,214,opt,name=x214", Filename: "test.proto", } var E_X215 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 215, Name: "test_proto.x215", Tag: "bytes,215,opt,name=x215", Filename: "test.proto", } var E_X216 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 216, Name: "test_proto.x216", Tag: "bytes,216,opt,name=x216", Filename: "test.proto", } var E_X217 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 217, Name: "test_proto.x217", Tag: "bytes,217,opt,name=x217", Filename: "test.proto", } var E_X218 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 218, Name: "test_proto.x218", Tag: "bytes,218,opt,name=x218", Filename: "test.proto", } var E_X219 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 219, Name: "test_proto.x219", Tag: "bytes,219,opt,name=x219", Filename: "test.proto", } var E_X220 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 220, Name: "test_proto.x220", Tag: "bytes,220,opt,name=x220", Filename: "test.proto", } var E_X221 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 221, Name: "test_proto.x221", Tag: "bytes,221,opt,name=x221", Filename: "test.proto", } var E_X222 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 222, Name: "test_proto.x222", Tag: "bytes,222,opt,name=x222", Filename: "test.proto", } var E_X223 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 223, Name: "test_proto.x223", Tag: "bytes,223,opt,name=x223", Filename: "test.proto", } var E_X224 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 224, Name: "test_proto.x224", Tag: "bytes,224,opt,name=x224", Filename: "test.proto", } var E_X225 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 225, Name: "test_proto.x225", Tag: "bytes,225,opt,name=x225", Filename: "test.proto", } var E_X226 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 226, Name: "test_proto.x226", Tag: "bytes,226,opt,name=x226", Filename: "test.proto", } var E_X227 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 227, Name: "test_proto.x227", Tag: "bytes,227,opt,name=x227", Filename: "test.proto", } var E_X228 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 228, Name: "test_proto.x228", Tag: "bytes,228,opt,name=x228", Filename: "test.proto", } var E_X229 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 229, Name: "test_proto.x229", Tag: "bytes,229,opt,name=x229", Filename: "test.proto", } var E_X230 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 230, Name: "test_proto.x230", Tag: "bytes,230,opt,name=x230", Filename: "test.proto", } var E_X231 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 231, Name: "test_proto.x231", Tag: "bytes,231,opt,name=x231", Filename: "test.proto", } var E_X232 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 232, Name: "test_proto.x232", Tag: "bytes,232,opt,name=x232", Filename: "test.proto", } var E_X233 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 233, Name: "test_proto.x233", Tag: "bytes,233,opt,name=x233", Filename: "test.proto", } var E_X234 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 234, Name: "test_proto.x234", Tag: "bytes,234,opt,name=x234", Filename: "test.proto", } var E_X235 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 235, Name: "test_proto.x235", Tag: "bytes,235,opt,name=x235", Filename: "test.proto", } var E_X236 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 236, Name: "test_proto.x236", Tag: "bytes,236,opt,name=x236", Filename: "test.proto", } var E_X237 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 237, Name: "test_proto.x237", Tag: "bytes,237,opt,name=x237", Filename: "test.proto", } var E_X238 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 238, Name: "test_proto.x238", Tag: "bytes,238,opt,name=x238", Filename: "test.proto", } var E_X239 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 239, Name: "test_proto.x239", Tag: "bytes,239,opt,name=x239", Filename: "test.proto", } var E_X240 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 240, Name: "test_proto.x240", Tag: "bytes,240,opt,name=x240", Filename: "test.proto", } var E_X241 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 241, Name: "test_proto.x241", Tag: "bytes,241,opt,name=x241", Filename: "test.proto", } var E_X242 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 242, Name: "test_proto.x242", Tag: "bytes,242,opt,name=x242", Filename: "test.proto", } var E_X243 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 243, Name: "test_proto.x243", Tag: "bytes,243,opt,name=x243", Filename: "test.proto", } var E_X244 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 244, Name: "test_proto.x244", Tag: "bytes,244,opt,name=x244", Filename: "test.proto", } var E_X245 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 245, Name: "test_proto.x245", Tag: "bytes,245,opt,name=x245", Filename: "test.proto", } var E_X246 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 246, Name: "test_proto.x246", Tag: "bytes,246,opt,name=x246", Filename: "test.proto", } var E_X247 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 247, Name: "test_proto.x247", Tag: "bytes,247,opt,name=x247", Filename: "test.proto", } var E_X248 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 248, Name: "test_proto.x248", Tag: "bytes,248,opt,name=x248", Filename: "test.proto", } var E_X249 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 249, Name: "test_proto.x249", Tag: "bytes,249,opt,name=x249", Filename: "test.proto", } var E_X250 = &proto.ExtensionDesc{ ExtendedType: (*MyMessageSet)(nil), ExtensionType: (*Empty)(nil), Field: 250, Name: "test_proto.x250", Tag: "bytes,250,opt,name=x250", Filename: "test.proto", } func init() { proto.RegisterEnum("test_proto.FOO", FOO_name, FOO_value) proto.RegisterEnum("test_proto.GoTest_KIND", GoTest_KIND_name, GoTest_KIND_value) proto.RegisterEnum("test_proto.MyMessage_Color", MyMessage_Color_name, MyMessage_Color_value) proto.RegisterEnum("test_proto.DefaultsMessage_DefaultsEnum", DefaultsMessage_DefaultsEnum_name, DefaultsMessage_DefaultsEnum_value) proto.RegisterEnum("test_proto.Defaults_Color", Defaults_Color_name, Defaults_Color_value) proto.RegisterEnum("test_proto.RepeatedEnum_Color", RepeatedEnum_Color_name, RepeatedEnum_Color_value) proto.RegisterType((*GoEnum)(nil), "test_proto.GoEnum") proto.RegisterType((*GoTestField)(nil), "test_proto.GoTestField") proto.RegisterType((*GoTest)(nil), "test_proto.GoTest") proto.RegisterType((*GoTest_RequiredGroup)(nil), "test_proto.GoTest.RequiredGroup") proto.RegisterType((*GoTest_RepeatedGroup)(nil), "test_proto.GoTest.RepeatedGroup") proto.RegisterType((*GoTest_OptionalGroup)(nil), "test_proto.GoTest.OptionalGroup") proto.RegisterType((*GoTestRequiredGroupField)(nil), "test_proto.GoTestRequiredGroupField") proto.RegisterType((*GoTestRequiredGroupField_Group)(nil), "test_proto.GoTestRequiredGroupField.Group") proto.RegisterType((*GoSkipTest)(nil), "test_proto.GoSkipTest") proto.RegisterType((*GoSkipTest_SkipGroup)(nil), "test_proto.GoSkipTest.SkipGroup") proto.RegisterType((*NonPackedTest)(nil), "test_proto.NonPackedTest") proto.RegisterType((*PackedTest)(nil), "test_proto.PackedTest") proto.RegisterType((*MaxTag)(nil), "test_proto.MaxTag") proto.RegisterType((*OldMessage)(nil), "test_proto.OldMessage") proto.RegisterType((*OldMessage_Nested)(nil), "test_proto.OldMessage.Nested") proto.RegisterType((*NewMessage)(nil), "test_proto.NewMessage") proto.RegisterType((*NewMessage_Nested)(nil), "test_proto.NewMessage.Nested") proto.RegisterType((*InnerMessage)(nil), "test_proto.InnerMessage") proto.RegisterType((*OtherMessage)(nil), "test_proto.OtherMessage") proto.RegisterType((*RequiredInnerMessage)(nil), "test_proto.RequiredInnerMessage") proto.RegisterType((*MyMessage)(nil), "test_proto.MyMessage") proto.RegisterType((*MyMessage_SomeGroup)(nil), "test_proto.MyMessage.SomeGroup") proto.RegisterExtension(E_Ext_More) proto.RegisterExtension(E_Ext_Text) proto.RegisterExtension(E_Ext_Number) proto.RegisterType((*Ext)(nil), "test_proto.Ext") proto.RegisterMapType((map[int32]int32)(nil), "test_proto.Ext.MapFieldEntry") proto.RegisterType((*ComplexExtension)(nil), "test_proto.ComplexExtension") proto.RegisterType((*DefaultsMessage)(nil), "test_proto.DefaultsMessage") proto.RegisterType((*MyMessageSet)(nil), "test_proto.MyMessageSet") proto.RegisterType((*Empty)(nil), "test_proto.Empty") proto.RegisterType((*MessageList)(nil), "test_proto.MessageList") proto.RegisterType((*MessageList_Message)(nil), "test_proto.MessageList.Message") proto.RegisterType((*Strings)(nil), "test_proto.Strings") proto.RegisterType((*Defaults)(nil), "test_proto.Defaults") proto.RegisterType((*SubDefaults)(nil), "test_proto.SubDefaults") proto.RegisterType((*RepeatedEnum)(nil), "test_proto.RepeatedEnum") proto.RegisterType((*MoreRepeated)(nil), "test_proto.MoreRepeated") proto.RegisterType((*GroupOld)(nil), "test_proto.GroupOld") proto.RegisterType((*GroupOld_G)(nil), "test_proto.GroupOld.G") proto.RegisterType((*GroupNew)(nil), "test_proto.GroupNew") proto.RegisterType((*GroupNew_G)(nil), "test_proto.GroupNew.G") proto.RegisterType((*FloatingPoint)(nil), "test_proto.FloatingPoint") proto.RegisterType((*MessageWithMap)(nil), "test_proto.MessageWithMap") proto.RegisterMapType((map[bool][]byte)(nil), "test_proto.MessageWithMap.ByteMappingEntry") proto.RegisterMapType((map[int64]*FloatingPoint)(nil), "test_proto.MessageWithMap.MsgMappingEntry") proto.RegisterMapType((map[int32]string)(nil), "test_proto.MessageWithMap.NameMappingEntry") proto.RegisterMapType((map[string]string)(nil), "test_proto.MessageWithMap.StrToStrEntry") proto.RegisterType((*Oneof)(nil), "test_proto.Oneof") proto.RegisterType((*Oneof_F_Group)(nil), "test_proto.Oneof.F_Group") proto.RegisterType((*Communique)(nil), "test_proto.Communique") proto.RegisterType((*TestUTF8)(nil), "test_proto.TestUTF8") proto.RegisterMapType((map[string]int64)(nil), "test_proto.TestUTF8.MapKeyEntry") proto.RegisterMapType((map[int64]string)(nil), "test_proto.TestUTF8.MapValueEntry") proto.RegisterExtension(E_Greeting) proto.RegisterExtension(E_Complex) proto.RegisterExtension(E_RComplex) proto.RegisterExtension(E_NoDefaultDouble) proto.RegisterExtension(E_NoDefaultFloat) proto.RegisterExtension(E_NoDefaultInt32) proto.RegisterExtension(E_NoDefaultInt64) proto.RegisterExtension(E_NoDefaultUint32) proto.RegisterExtension(E_NoDefaultUint64) proto.RegisterExtension(E_NoDefaultSint32) proto.RegisterExtension(E_NoDefaultSint64) proto.RegisterExtension(E_NoDefaultFixed32) proto.RegisterExtension(E_NoDefaultFixed64) proto.RegisterExtension(E_NoDefaultSfixed32) proto.RegisterExtension(E_NoDefaultSfixed64) proto.RegisterExtension(E_NoDefaultBool) proto.RegisterExtension(E_NoDefaultString) proto.RegisterExtension(E_NoDefaultBytes) proto.RegisterExtension(E_NoDefaultEnum) proto.RegisterExtension(E_DefaultDouble) proto.RegisterExtension(E_DefaultFloat) proto.RegisterExtension(E_DefaultInt32) proto.RegisterExtension(E_DefaultInt64) proto.RegisterExtension(E_DefaultUint32) proto.RegisterExtension(E_DefaultUint64) proto.RegisterExtension(E_DefaultSint32) proto.RegisterExtension(E_DefaultSint64) proto.RegisterExtension(E_DefaultFixed32) proto.RegisterExtension(E_DefaultFixed64) proto.RegisterExtension(E_DefaultSfixed32) proto.RegisterExtension(E_DefaultSfixed64) proto.RegisterExtension(E_DefaultBool) proto.RegisterExtension(E_DefaultString) proto.RegisterExtension(E_DefaultBytes) proto.RegisterExtension(E_DefaultEnum) proto.RegisterExtension(E_X201) proto.RegisterExtension(E_X202) proto.RegisterExtension(E_X203) proto.RegisterExtension(E_X204) proto.RegisterExtension(E_X205) proto.RegisterExtension(E_X206) proto.RegisterExtension(E_X207) proto.RegisterExtension(E_X208) proto.RegisterExtension(E_X209) proto.RegisterExtension(E_X210) proto.RegisterExtension(E_X211) proto.RegisterExtension(E_X212) proto.RegisterExtension(E_X213) proto.RegisterExtension(E_X214) proto.RegisterExtension(E_X215) proto.RegisterExtension(E_X216) proto.RegisterExtension(E_X217) proto.RegisterExtension(E_X218) proto.RegisterExtension(E_X219) proto.RegisterExtension(E_X220) proto.RegisterExtension(E_X221) proto.RegisterExtension(E_X222) proto.RegisterExtension(E_X223) proto.RegisterExtension(E_X224) proto.RegisterExtension(E_X225) proto.RegisterExtension(E_X226) proto.RegisterExtension(E_X227) proto.RegisterExtension(E_X228) proto.RegisterExtension(E_X229) proto.RegisterExtension(E_X230) proto.RegisterExtension(E_X231) proto.RegisterExtension(E_X232) proto.RegisterExtension(E_X233) proto.RegisterExtension(E_X234) proto.RegisterExtension(E_X235) proto.RegisterExtension(E_X236) proto.RegisterExtension(E_X237) proto.RegisterExtension(E_X238) proto.RegisterExtension(E_X239) proto.RegisterExtension(E_X240) proto.RegisterExtension(E_X241) proto.RegisterExtension(E_X242) proto.RegisterExtension(E_X243) proto.RegisterExtension(E_X244) proto.RegisterExtension(E_X245) proto.RegisterExtension(E_X246) proto.RegisterExtension(E_X247) proto.RegisterExtension(E_X248) proto.RegisterExtension(E_X249) proto.RegisterExtension(E_X250) } func init() { proto.RegisterFile("test.proto", fileDescriptor_c161fcfdc0c3ff1e) } var fileDescriptor_c161fcfdc0c3ff1e = []byte{ // 4789 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x5a, 0xd9, 0x73, 0x1b, 0x47, 0x7a, 0xd7, 0x0c, 0xee, 0x0f, 0x20, 0x31, 0x6c, 0xd1, 0x12, 0x44, 0x59, 0xd2, 0x08, 0x6b, 0xaf, 0x61, 0x1d, 0x10, 0x09, 0x0c, 0x21, 0x09, 0x8e, 0x1d, 0xeb, 0x20, 0x68, 0x96, 0x44, 0x42, 0x1e, 0x52, 0x76, 0x56, 0x79, 0x40, 0x81, 0xc4, 0x00, 0xc4, 0x0a, 0x98, 0x81, 0x81, 0xc1, 0x8a, 0x4c, 0x2a, 0x55, 0x7e, 0x4c, 0x55, 0x9e, 0xb2, 0x49, 0xaa, 0xf2, 0x9e, 0x97, 0xbc, 0xe4, 0x7a, 0x48, 0xfe, 0x86, 0xf8, 0x5a, 0xef, 0xae, 0xf7, 0x4a, 0xb2, 0xc9, 0xe6, 0xbe, 0xb3, 0xb9, 0xf7, 0xc8, 0x8b, 0x53, 0xfd, 0x75, 0xcf, 0x4c, 0x0f, 0x00, 0x35, 0xc9, 0x27, 0x4c, 0x77, 0xff, 0xbe, 0x5f, 0x5f, 0xbf, 0xf9, 0xbe, 0xaf, 0x1b, 0x03, 0xe0, 0x5a, 0x23, 0xb7, 0x38, 0x18, 0x3a, 0xae, 0x43, 0xf0, 0xb9, 0x81, 0xcf, 0xf9, 0xab, 0x10, 0x5f, 0x77, 0xd6, 0xec, 0x71, 0x9f, 0x5c, 0x86, 0x48, 0xdb, 0x71, 0x72, 0x8a, 0xae, 0x16, 0xe6, 0x4b, 0xd9, 0x62, 0x80, 0x29, 0xd6, 0xea, 0x75, 0x93, 0xb6, 0xe5, 0x6f, 0x42, 0x7a, 0xdd, 0xd9, 0xb1, 0x46, 0x6e, 0xad, 0x6b, 0xf5, 0x5a, 0x64, 0x11, 0x62, 0x0f, 0x9b, 0xbb, 0x56, 0x0f, 0x6d, 0x52, 0x26, 0x2b, 0x10, 0x02, 0xd1, 0x9d, 0xc3, 0x81, 0x95, 0x53, 0xb1, 0x12, 0x9f, 0xf3, 0x7f, 0x98, 0xa7, 0xdd, 0x50, 0x4b, 0x72, 0x15, 0xa2, 0x0f, 0xba, 0x76, 0x8b, 0xf7, 0x73, 0x56, 0xec, 0x87, 0x21, 0x8a, 0x0f, 0x36, 0xb6, 0xee, 0x9b, 0x08, 0xa2, 0x3d, 0xec, 0x34, 0x77, 0x7b, 0x94, 0x4c, 0xa1, 0x3d, 0x60, 0x81, 0xd6, 0x3e, 0x6a, 0x0e, 0x9b, 0xfd, 0x5c, 0x44, 0x57, 0x0a, 0x31, 0x93, 0x15, 0xc8, 0xeb, 0x30, 0x67, 0x5a, 0xef, 0x8d, 0xbb, 0x43, 0xab, 0x85, 0xc3, 0xcb, 0x45, 0x75, 0xb5, 0x90, 0x9e, 0xd5, 0x03, 0x36, 0x9b, 0x61, 0x34, 0x33, 0x1f, 0x58, 0x4d, 0xd7, 0x33, 0x8f, 0xe9, 0x91, 0x23, 0xcc, 0x05, 0x34, 0x35, 0xaf, 0x0f, 0xdc, 0xae, 0x63, 0x37, 0x7b, 0xcc, 0x3c, 0xae, 0x2b, 0x52, 0xf3, 0x10, 0x9a, 0x7c, 0x11, 0xb2, 0xb5, 0xc6, 0x5d, 0xc7, 0xe9, 0x35, 0x86, 0x7c, 0x54, 0x39, 0xd0, 0xd5, 0x42, 0xd2, 0x9c, 0xab, 0xd1, 0x5a, 0x6f, 0xa8, 0xa4, 0x00, 0x5a, 0xad, 0xb1, 0x61, 0xbb, 0xe5, 0x52, 0x00, 0x4c, 0xeb, 0x6a, 0x21, 0x66, 0xce, 0xd7, 0xb0, 0x7a, 0x0a, 0x59, 0x31, 0x02, 0x64, 0x46, 0x57, 0x0b, 0x11, 0x86, 0xac, 0x18, 0x3e, 0xf2, 0x1a, 0x90, 0x5a, 0xa3, 0xd6, 0x3d, 0xb0, 0x5a, 0x22, 0xeb, 0x9c, 0xae, 0x16, 0x12, 0xa6, 0x56, 0xe3, 0x0d, 0x33, 0xd0, 0x22, 0xf3, 0xbc, 0xae, 0x16, 0xe2, 0x1e, 0x5a, 0xe0, 0xbe, 0x02, 0x0b, 0xb5, 0xc6, 0xe3, 0x6e, 0x78, 0xc0, 0x59, 0x5d, 0x2d, 0xcc, 0x99, 0xd9, 0x1a, 0xab, 0x9f, 0xc6, 0x8a, 0xc4, 0x9a, 0xae, 0x16, 0xa2, 0x1c, 0x2b, 0xf0, 0xe2, 0xec, 0x6a, 0x3d, 0xa7, 0xe9, 0x06, 0xd0, 0x05, 0x5d, 0x2d, 0xa8, 0xe6, 0x7c, 0x0d, 0xab, 0xc3, 0xac, 0xf7, 0x9d, 0xf1, 0x6e, 0xcf, 0x0a, 0xa0, 0x44, 0x57, 0x0b, 0x8a, 0x99, 0xad, 0xb1, 0xfa, 0x30, 0x76, 0xdb, 0x1d, 0x76, 0xed, 0x4e, 0x80, 0x3d, 0x8d, 0x3a, 0xce, 0xd6, 0x58, 0x7d, 0x78, 0x04, 0x77, 0x0f, 0x5d, 0x6b, 0x14, 0x40, 0x2d, 0x5d, 0x2d, 0x64, 0xcc, 0xf9, 0x1a, 0x56, 0x4f, 0xb0, 0x4e, 0xac, 0x41, 0x5b, 0x57, 0x0b, 0x0b, 0x94, 0x75, 0xc6, 0x1a, 0x6c, 0x4f, 0xac, 0x41, 0x47, 0x57, 0x0b, 0x84, 0x63, 0x85, 0x35, 0x28, 0xc2, 0xe9, 0x5a, 0x63, 0xbb, 0x3d, 0xb9, 0x71, 0xfb, 0xba, 0x5a, 0xc8, 0x9a, 0x0b, 0x35, 0xaf, 0x65, 0x16, 0x5e, 0x64, 0xef, 0xea, 0x6a, 0x41, 0xf3, 0xf1, 0x02, 0xbf, 0xa8, 0x49, 0x26, 0xf5, 0xdc, 0xa2, 0x1e, 0x11, 0x34, 0xc9, 0x2a, 0xc3, 0x9a, 0xe4, 0xc0, 0x17, 0xf4, 0x88, 0xa8, 0xc9, 0x09, 0x24, 0x76, 0xcf, 0x91, 0x67, 0xf4, 0x88, 0xa8, 0x49, 0x8e, 0x9c, 0xd0, 0x24, 0xc7, 0x9e, 0xd5, 0x23, 0x61, 0x4d, 0x4e, 0xa1, 0x45, 0xe6, 0x9c, 0x1e, 0x09, 0x6b, 0x92, 0xa3, 0xc3, 0x9a, 0xe4, 0xe0, 0x73, 0x7a, 0x24, 0xa4, 0xc9, 0x49, 0xac, 0x48, 0xbc, 0xa4, 0x47, 0x42, 0x9a, 0x14, 0x67, 0xe7, 0x69, 0x92, 0x43, 0xcf, 0xeb, 0x11, 0x51, 0x93, 0x22, 0xab, 0xaf, 0x49, 0x0e, 0x7d, 0x51, 0x8f, 0x84, 0x34, 0x29, 0x62, 0x7d, 0x4d, 0x72, 0xec, 0x05, 0x3d, 0x12, 0xd2, 0x24, 0xc7, 0xbe, 0x2a, 0x6a, 0x92, 0x43, 0x3f, 0x50, 0xf4, 0x88, 0x28, 0x4a, 0x0e, 0xbd, 0x1a, 0x12, 0x25, 0xc7, 0x7e, 0x48, 0xb1, 0xa2, 0x2a, 0x27, 0xc1, 0xe2, 0x2a, 0x7c, 0x44, 0xc1, 0xa2, 0x2c, 0x39, 0xf8, 0xc6, 0x84, 0x2c, 0x39, 0xfc, 0x63, 0x0a, 0x0f, 0xeb, 0x72, 0xda, 0x40, 0xe4, 0xff, 0x84, 0x1a, 0x84, 0x85, 0xc9, 0x0d, 0x02, 0x61, 0x3a, 0xdc, 0x89, 0xe6, 0x2e, 0xea, 0x8a, 0x2f, 0x4c, 0xcf, 0xb3, 0x8a, 0xc2, 0xf4, 0x81, 0x97, 0x30, 0x64, 0x70, 0x61, 0x4e, 0x21, 0x2b, 0x46, 0x80, 0xd4, 0x75, 0x25, 0x10, 0xa6, 0x8f, 0x0c, 0x09, 0xd3, 0xc7, 0x5e, 0xd6, 0x15, 0x51, 0x98, 0x33, 0xd0, 0x22, 0x73, 0x5e, 0x57, 0x44, 0x61, 0xfa, 0x68, 0x51, 0x98, 0x3e, 0xf8, 0x0b, 0xba, 0x22, 0x08, 0x73, 0x1a, 0x2b, 0x12, 0xbf, 0xa4, 0x2b, 0x82, 0x30, 0xc3, 0xb3, 0x63, 0xc2, 0xf4, 0xa1, 0x2f, 0xeb, 0x4a, 0x20, 0xcc, 0x30, 0x2b, 0x17, 0xa6, 0x0f, 0xfd, 0xa2, 0xae, 0x08, 0xc2, 0x0c, 0x63, 0xb9, 0x30, 0x7d, 0xec, 0x2b, 0x18, 0xa7, 0x3d, 0x61, 0xfa, 0x58, 0x41, 0x98, 0x3e, 0xf4, 0x77, 0x68, 0x4c, 0xf7, 0x85, 0xe9, 0x43, 0x45, 0x61, 0xfa, 0xd8, 0xdf, 0xa5, 0xd8, 0x40, 0x98, 0xd3, 0x60, 0x71, 0x15, 0x7e, 0x8f, 0x82, 0x03, 0x61, 0xfa, 0xe0, 0xb0, 0x30, 0x7d, 0xf8, 0xef, 0x53, 0xb8, 0x28, 0xcc, 0x59, 0x06, 0x22, 0xff, 0x1f, 0x50, 0x03, 0x51, 0x98, 0xbe, 0x41, 0x11, 0xa7, 0x49, 0x85, 0xd9, 0xb2, 0xda, 0xcd, 0x71, 0x8f, 0xca, 0xb8, 0x40, 0x95, 0x59, 0x8d, 0xba, 0xc3, 0xb1, 0x45, 0xe7, 0xea, 0x38, 0xbd, 0xfb, 0x5e, 0x1b, 0x29, 0xd2, 0xe1, 0x33, 0x81, 0x06, 0x06, 0xaf, 0x52, 0x85, 0x56, 0xd5, 0x72, 0xc9, 0xcc, 0x32, 0x95, 0x4e, 0xe3, 0x2b, 0x86, 0x80, 0xbf, 0x42, 0x75, 0x5a, 0x55, 0x2b, 0x06, 0xc3, 0x57, 0x8c, 0x00, 0x5f, 0xa6, 0x13, 0xf0, 0xc4, 0x1a, 0x58, 0x5c, 0xa5, 0x6a, 0xad, 0x46, 0xca, 0xa5, 0x65, 0x73, 0xc1, 0x93, 0xec, 0x2c, 0xa3, 0x50, 0x37, 0xd7, 0xa8, 0x68, 0xab, 0x91, 0x8a, 0xe1, 0x1b, 0x89, 0x3d, 0x95, 0xa8, 0xd0, 0xb9, 0x74, 0x03, 0x9b, 0xeb, 0x54, 0xbb, 0xd5, 0x68, 0xb9, 0xb4, 0xbc, 0x6c, 0x6a, 0x5c, 0xc1, 0x33, 0x6c, 0x42, 0xfd, 0x14, 0xa9, 0x86, 0xab, 0xd1, 0x8a, 0xe1, 0xdb, 0x84, 0xfb, 0x59, 0xf0, 0xa4, 0x1c, 0x98, 0xdc, 0xa0, 0x5a, 0xae, 0xc6, 0xcb, 0x2b, 0xc6, 0xca, 0xea, 0x6d, 0x33, 0xcb, 0x34, 0x1d, 0xd8, 0x18, 0xb4, 0x1f, 0x2e, 0xea, 0xc0, 0x68, 0x99, 0xaa, 0xba, 0x1a, 0x2f, 0xdd, 0x5c, 0xb9, 0x55, 0xba, 0x65, 0x6a, 0x5c, 0xdd, 0x81, 0xd5, 0x1b, 0xd4, 0x8a, 0xcb, 0x3b, 0xb0, 0x5a, 0xa1, 0xfa, 0xae, 0x6a, 0xfb, 0x56, 0xaf, 0xe7, 0x5c, 0xd3, 0xf3, 0xcf, 0x9c, 0x61, 0xaf, 0x75, 0x39, 0x0f, 0xa6, 0xc6, 0x15, 0x2f, 0xf6, 0xba, 0xe0, 0x49, 0x3e, 0x30, 0xff, 0x55, 0x9a, 0xb1, 0x66, 0xaa, 0x89, 0xbb, 0xdd, 0x8e, 0xed, 0x8c, 0x2c, 0x33, 0xcb, 0xc4, 0x3f, 0xb1, 0x26, 0xdb, 0x93, 0xeb, 0xf8, 0x55, 0x6a, 0xb6, 0x50, 0x8d, 0x5c, 0x2f, 0x97, 0x68, 0x4f, 0xb3, 0xd6, 0x71, 0x7b, 0x72, 0x1d, 0x7f, 0x8d, 0xda, 0x90, 0x6a, 0xe4, 0x7a, 0xc5, 0xe0, 0x36, 0xe2, 0x3a, 0x56, 0x60, 0x51, 0x78, 0x17, 0x02, 0xab, 0x5f, 0xa7, 0x56, 0x59, 0xd6, 0x13, 0xf1, 0xdf, 0x88, 0x99, 0x76, 0xa1, 0xde, 0x7e, 0x83, 0xda, 0x69, 0xac, 0x37, 0xe2, 0xbf, 0x18, 0x81, 0xdd, 0x4d, 0x38, 0x33, 0x91, 0x4b, 0x34, 0x06, 0xcd, 0xbd, 0xa7, 0x56, 0x2b, 0x57, 0xa2, 0x29, 0xc5, 0x5d, 0x55, 0x53, 0xcc, 0xd3, 0xa1, 0xb4, 0xe2, 0x11, 0x36, 0x93, 0xdb, 0x70, 0x76, 0x32, 0xb9, 0xf0, 0x2c, 0xcb, 0x34, 0xc7, 0x40, 0xcb, 0xc5, 0x70, 0x9e, 0x31, 0x61, 0x2a, 0x04, 0x15, 0xcf, 0xd4, 0xa0, 0x49, 0x47, 0x60, 0x1a, 0xc4, 0x16, 0x6e, 0xfa, 0x3a, 0x9c, 0x9b, 0x4e, 0x3f, 0x3c, 0xe3, 0x55, 0x9a, 0x85, 0xa0, 0xf1, 0x99, 0xc9, 0x4c, 0x64, 0xca, 0x7c, 0x46, 0xdf, 0x15, 0x9a, 0x96, 0x88, 0xe6, 0x53, 0xbd, 0xbf, 0x06, 0xb9, 0xa9, 0x04, 0xc5, 0xb3, 0xbe, 0x49, 0xf3, 0x14, 0xb4, 0x7e, 0x61, 0x22, 0x57, 0x99, 0x34, 0x9e, 0xd1, 0xf5, 0x2d, 0x9a, 0xb8, 0x08, 0xc6, 0x53, 0x3d, 0xe3, 0x92, 0x85, 0x53, 0x18, 0xcf, 0xf6, 0x36, 0xcd, 0x64, 0xf8, 0x92, 0x85, 0xb2, 0x19, 0xb1, 0xdf, 0x89, 0x9c, 0xc6, 0xb3, 0xad, 0xd2, 0xd4, 0x86, 0xf7, 0x1b, 0x4e, 0x6f, 0xb8, 0xf1, 0xcf, 0x50, 0xe3, 0xed, 0xd9, 0x33, 0xfe, 0x51, 0x84, 0x26, 0x25, 0xdc, 0x7a, 0x7b, 0xd6, 0x94, 0x7d, 0xeb, 0x19, 0x53, 0xfe, 0x31, 0xb5, 0x26, 0x82, 0xf5, 0xd4, 0x9c, 0xdf, 0x84, 0xa5, 0x19, 0xf9, 0x8a, 0x67, 0xff, 0x13, 0x6a, 0x9f, 0x45, 0xfb, 0xb3, 0x53, 0xa9, 0xcb, 0x34, 0xc3, 0x8c, 0x11, 0xfc, 0x94, 0x32, 0x68, 0x21, 0x86, 0xa9, 0x31, 0xd4, 0x60, 0xce, 0xcb, 0xc7, 0x3b, 0x43, 0x67, 0x3c, 0xc8, 0xd5, 0x74, 0xb5, 0x00, 0x25, 0x7d, 0xc6, 0xe9, 0xd8, 0x4b, 0xcf, 0xd7, 0x29, 0xce, 0x0c, 0x9b, 0x31, 0x1e, 0xc6, 0xcc, 0x78, 0x1e, 0xe9, 0x91, 0xe7, 0xf2, 0x30, 0x9c, 0xcf, 0x23, 0x98, 0x51, 0x1e, 0x2f, 0xdc, 0x31, 0x9e, 0x27, 0xba, 0xf2, 0x1c, 0x1e, 0x2f, 0xf8, 0x71, 0x9e, 0x90, 0xd9, 0xd2, 0x6a, 0x70, 0x26, 0xc7, 0x76, 0xf2, 0xd2, 0xe4, 0x21, 0x7d, 0x1d, 0x4f, 0x57, 0xe1, 0x4a, 0x66, 0x26, 0x0c, 0x6f, 0xda, 0xec, 0xed, 0xe7, 0x98, 0x85, 0x46, 0x33, 0x6d, 0xf6, 0xf3, 0x33, 0xcc, 0xf2, 0xbf, 0xa9, 0x40, 0xf4, 0xc1, 0xc6, 0xd6, 0x7d, 0x92, 0x84, 0xe8, 0x3b, 0xf5, 0x8d, 0xfb, 0xda, 0x29, 0xfa, 0x74, 0xb7, 0x5e, 0x7f, 0xa8, 0x29, 0x24, 0x05, 0xb1, 0xbb, 0x5f, 0xda, 0x59, 0xdb, 0xd6, 0x54, 0x92, 0x85, 0x74, 0x6d, 0x63, 0x6b, 0x7d, 0xcd, 0x7c, 0x64, 0x6e, 0x6c, 0xed, 0x68, 0x11, 0xda, 0x56, 0x7b, 0x58, 0xbf, 0xb3, 0xa3, 0x45, 0x49, 0x02, 0x22, 0xb4, 0x2e, 0x46, 0x00, 0xe2, 0xdb, 0x3b, 0xe6, 0xc6, 0xd6, 0xba, 0x16, 0xa7, 0x2c, 0x3b, 0x1b, 0x9b, 0x6b, 0x5a, 0x82, 0x22, 0x77, 0x1e, 0x3f, 0x7a, 0xb8, 0xa6, 0x25, 0xe9, 0xe3, 0x1d, 0xd3, 0xbc, 0xf3, 0x25, 0x2d, 0x45, 0x8d, 0x36, 0xef, 0x3c, 0xd2, 0x00, 0x9b, 0xef, 0xdc, 0x7d, 0xb8, 0xa6, 0xa5, 0x49, 0x06, 0x92, 0xb5, 0xc7, 0x5b, 0xf7, 0x76, 0x36, 0xea, 0x5b, 0x5a, 0x26, 0xff, 0x8b, 0x90, 0x63, 0xcb, 0x1c, 0x5a, 0x45, 0x76, 0x65, 0xf0, 0x26, 0xc4, 0xd8, 0xde, 0x28, 0xa8, 0x95, 0x2b, 0xd3, 0x7b, 0x33, 0x6d, 0x54, 0x64, 0xbb, 0xc4, 0x0c, 0x97, 0x2e, 0x40, 0x8c, 0xad, 0xd3, 0x22, 0xc4, 0xd8, 0xfa, 0xa8, 0x78, 0x95, 0xc0, 0x0a, 0xf9, 0xdf, 0x52, 0x01, 0xd6, 0x9d, 0xed, 0xa7, 0xdd, 0x01, 0x5e, 0xdc, 0x5c, 0x00, 0x18, 0x3d, 0xed, 0x0e, 0x1a, 0xf8, 0x06, 0xf2, 0x4b, 0x87, 0x14, 0xad, 0x41, 0xdf, 0x4b, 0x2e, 0x43, 0x06, 0x9b, 0xf9, 0x2b, 0x82, 0x77, 0x0d, 0x09, 0x33, 0x4d, 0xeb, 0xb8, 0x93, 0x0c, 0x43, 0x2a, 0x06, 0x5e, 0x31, 0xc4, 0x05, 0x48, 0xc5, 0x20, 0x97, 0x00, 0x8b, 0x8d, 0x11, 0x46, 0x53, 0xbc, 0x56, 0x48, 0x99, 0xd8, 0x2f, 0x8b, 0xaf, 0xe4, 0x0d, 0xc0, 0x3e, 0xd9, 0xcc, 0xb3, 0xb3, 0xde, 0x12, 0x6f, 0xc0, 0x45, 0xfa, 0xc0, 0xe6, 0x1b, 0x98, 0x2c, 0xd5, 0x21, 0xe5, 0xd7, 0xd3, 0xde, 0xb0, 0x96, 0xcf, 0x49, 0xc3, 0x39, 0x01, 0x56, 0xf9, 0x93, 0x62, 0x00, 0x3e, 0x9e, 0x05, 0x1c, 0x0f, 0x33, 0x62, 0x03, 0xca, 0x5f, 0x80, 0xb9, 0x2d, 0xc7, 0x66, 0xef, 0x31, 0xae, 0x53, 0x06, 0x94, 0x66, 0x4e, 0xc1, 0xf3, 0xaf, 0xd2, 0xcc, 0x5f, 0x04, 0x10, 0xda, 0x34, 0x50, 0x76, 0x59, 0x1b, 0xfa, 0x03, 0x65, 0x37, 0x7f, 0x15, 0xe2, 0x9b, 0xcd, 0x83, 0x9d, 0x66, 0x87, 0x5c, 0x06, 0xe8, 0x35, 0x47, 0x6e, 0xa3, 0x8d, 0x3b, 0xf1, 0xf9, 0xe7, 0x9f, 0x7f, 0xae, 0x60, 0x32, 0x9d, 0xa2, 0xb5, 0x6c, 0x47, 0x46, 0x00, 0xf5, 0x5e, 0x6b, 0xd3, 0x1a, 0x8d, 0x9a, 0x1d, 0x8b, 0xac, 0x42, 0xdc, 0xb6, 0x46, 0x34, 0xfa, 0x2a, 0x78, 0xd7, 0x74, 0x41, 0x5c, 0x87, 0x00, 0x57, 0xdc, 0x42, 0x90, 0xc9, 0xc1, 0x44, 0x83, 0x88, 0x3d, 0xee, 0xe3, 0x8d, 0x5a, 0xcc, 0xa4, 0x8f, 0x4b, 0x2f, 0x42, 0x9c, 0x61, 0x08, 0x81, 0xa8, 0xdd, 0xec, 0x5b, 0x39, 0xd6, 0x33, 0x3e, 0xe7, 0xbf, 0xaa, 0x00, 0x6c, 0x59, 0xcf, 0x8e, 0xd5, 0x6b, 0x80, 0x93, 0xf4, 0x1a, 0x61, 0xbd, 0xbe, 0x26, 0xeb, 0x95, 0xaa, 0xad, 0xed, 0x38, 0xad, 0x06, 0xdb, 0x68, 0x76, 0xfd, 0x97, 0xa2, 0x35, 0xb8, 0x73, 0xf9, 0x27, 0x90, 0xd9, 0xb0, 0x6d, 0x6b, 0xe8, 0x8d, 0x8a, 0x40, 0x74, 0xdf, 0x19, 0xb9, 0xfc, 0x26, 0x12, 0x9f, 0x49, 0x0e, 0xa2, 0x03, 0x67, 0xe8, 0xb2, 0x99, 0x56, 0xa3, 0xc6, 0xf2, 0xf2, 0xb2, 0x89, 0x35, 0xe4, 0x45, 0x48, 0xed, 0x39, 0xb6, 0x6d, 0xed, 0xd1, 0x69, 0x44, 0xf0, 0xe8, 0x18, 0x54, 0xe4, 0x7f, 0x59, 0x81, 0x4c, 0xdd, 0xdd, 0x0f, 0xc8, 0x35, 0x88, 0x3c, 0xb5, 0x0e, 0x71, 0x78, 0x11, 0x93, 0x3e, 0xd2, 0x17, 0xe6, 0x2b, 0xcd, 0xde, 0x98, 0xdd, 0x4b, 0x66, 0x4c, 0x56, 0x20, 0x67, 0x20, 0xfe, 0xcc, 0xea, 0x76, 0xf6, 0x5d, 0xe4, 0x54, 0x4d, 0x5e, 0x22, 0x45, 0x88, 0x75, 0xe9, 0x60, 0x73, 0x51, 0x5c, 0xb1, 0x9c, 0xb8, 0x62, 0xe2, 0x2c, 0x4c, 0x06, 0xbb, 0x92, 0x4c, 0xb6, 0xb4, 0xf7, 0xdf, 0x7f, 0xff, 0x7d, 0x35, 0xbf, 0x0f, 0x8b, 0xde, 0x4b, 0x1c, 0x9a, 0xee, 0x23, 0xc8, 0xf5, 0x2c, 0xa7, 0xd1, 0xee, 0xda, 0xcd, 0x5e, 0xef, 0xb0, 0xf1, 0xcc, 0xb1, 0x1b, 0x4d, 0xbb, 0xe1, 0x8c, 0xf6, 0x9a, 0x43, 0x5c, 0x02, 0x59, 0x27, 0x8b, 0x3d, 0xcb, 0xa9, 0x31, 0xc3, 0x77, 0x1d, 0xfb, 0x8e, 0x5d, 0xa7, 0x56, 0xf9, 0xcf, 0xa2, 0x90, 0xda, 0x3c, 0xf4, 0xf8, 0x17, 0x21, 0xb6, 0xe7, 0x8c, 0x6d, 0xb6, 0x9e, 0x31, 0x93, 0x15, 0xfc, 0x7d, 0x52, 0x85, 0x7d, 0x5a, 0x84, 0xd8, 0x7b, 0x63, 0xc7, 0xb5, 0x70, 0xca, 0x29, 0x93, 0x15, 0xe8, 0x8a, 0x0d, 0x2c, 0x37, 0x17, 0xc5, 0x6b, 0x0a, 0xfa, 0x18, 0xac, 0x41, 0xec, 0x58, 0x6b, 0x40, 0x96, 0x21, 0xee, 0xd0, 0x3d, 0x18, 0xe5, 0xe2, 0x78, 0x0f, 0x1b, 0x32, 0x10, 0x77, 0xc7, 0xe4, 0x38, 0xf2, 0x00, 0x16, 0x9e, 0x59, 0x8d, 0xfe, 0x78, 0xe4, 0x36, 0x3a, 0x4e, 0xa3, 0x65, 0x59, 0x03, 0x6b, 0x98, 0x9b, 0xc3, 0xde, 0x42, 0x1e, 0x62, 0xd6, 0x82, 0x9a, 0xf3, 0xcf, 0xac, 0xcd, 0xf1, 0xc8, 0x5d, 0x77, 0xee, 0xa3, 0x1d, 0x59, 0x85, 0xd4, 0xd0, 0xa2, 0x7e, 0x81, 0x0e, 0x39, 0x33, 0x3d, 0x82, 0x90, 0x71, 0x72, 0x68, 0x0d, 0xb0, 0x82, 0xdc, 0x84, 0xe4, 0x6e, 0xf7, 0xa9, 0x35, 0xda, 0xb7, 0x5a, 0xb9, 0x84, 0xae, 0x14, 0xe6, 0x4b, 0xe7, 0x45, 0x2b, 0x7f, 0x81, 0x8b, 0xf7, 0x9c, 0x9e, 0x33, 0x34, 0x7d, 0x30, 0x79, 0x1d, 0x52, 0x23, 0xa7, 0x6f, 0x31, 0xb5, 0x27, 0x31, 0xd8, 0x5e, 0x9a, 0x6d, 0xb9, 0xed, 0xf4, 0x2d, 0xcf, 0xab, 0x79, 0x16, 0xe4, 0x3c, 0x1b, 0xee, 0x2e, 0x3d, 0x4c, 0xe4, 0x00, 0x2f, 0x7c, 0xe8, 0xa0, 0xf0, 0x70, 0x41, 0x96, 0xe8, 0xa0, 0x3a, 0x6d, 0x9a, 0xb3, 0xe5, 0xd2, 0x78, 0x96, 0xf7, 0xcb, 0x4b, 0xd7, 0x20, 0xe5, 0x13, 0x06, 0xee, 0x90, 0xb9, 0xa0, 0x14, 0x7a, 0x08, 0xe6, 0x0e, 0x99, 0xff, 0x79, 0x19, 0x62, 0x38, 0x70, 0x1a, 0xb9, 0xcc, 0x35, 0x1a, 0x28, 0x53, 0x10, 0x5b, 0x37, 0xd7, 0xd6, 0xb6, 0x34, 0x05, 0x63, 0xe6, 0xc3, 0xc7, 0x6b, 0x9a, 0x2a, 0xe8, 0xf7, 0xb7, 0x55, 0x88, 0xac, 0x1d, 0xa0, 0x72, 0x5a, 0x4d, 0xb7, 0xe9, 0xbd, 0xe1, 0xf4, 0x99, 0x54, 0x21, 0xd5, 0x6f, 0x7a, 0x7d, 0xa9, 0xb8, 0xc4, 0x21, 0x5f, 0xb2, 0x76, 0xe0, 0x16, 0x37, 0x9b, 0xac, 0xe7, 0x35, 0xdb, 0x1d, 0x1e, 0x9a, 0xc9, 0x3e, 0x2f, 0x2e, 0xbd, 0x06, 0x73, 0xa1, 0x26, 0xf1, 0x15, 0x8d, 0xcd, 0x78, 0x45, 0x63, 0xfc, 0x15, 0xad, 0xaa, 0xb7, 0x94, 0x52, 0x15, 0xa2, 0x7d, 0x67, 0x68, 0x91, 0x17, 0x66, 0x2e, 0x70, 0xae, 0x83, 0x92, 0xc9, 0x4e, 0x0c, 0xc5, 0x44, 0x9b, 0xd2, 0xab, 0x10, 0x75, 0xad, 0x03, 0xf7, 0x79, 0xb6, 0xfb, 0x6c, 0x7e, 0x14, 0x52, 0xba, 0x0e, 0x71, 0x7b, 0xdc, 0xdf, 0xb5, 0x86, 0xcf, 0x03, 0x77, 0x71, 0x60, 0x1c, 0x94, 0x7f, 0x07, 0xb4, 0x7b, 0x4e, 0x7f, 0xd0, 0xb3, 0x0e, 0xd6, 0x0e, 0x5c, 0xcb, 0x1e, 0x75, 0x1d, 0x9b, 0xce, 0xa1, 0xdd, 0x1d, 0xa2, 0x5b, 0xc3, 0x39, 0x60, 0x81, 0xba, 0x99, 0x91, 0xb5, 0xe7, 0xd8, 0x2d, 0x3e, 0x35, 0x5e, 0xa2, 0x68, 0x77, 0xbf, 0x3b, 0xa4, 0x1e, 0x8d, 0x06, 0x1f, 0x56, 0xc8, 0xaf, 0x43, 0x96, 0x1f, 0xc3, 0x46, 0xbc, 0xe3, 0xfc, 0x15, 0xc8, 0x78, 0x55, 0xf8, 0xcf, 0x4f, 0x12, 0xa2, 0x4f, 0xd6, 0xcc, 0xba, 0x76, 0x8a, 0xee, 0x6b, 0x7d, 0x6b, 0x4d, 0x53, 0xe8, 0xc3, 0xce, 0xbb, 0xf5, 0xd0, 0x5e, 0xbe, 0x08, 0x19, 0x7f, 0xec, 0xdb, 0x96, 0x8b, 0x2d, 0x34, 0x4a, 0x25, 0xaa, 0x6a, 0x52, 0xc9, 0x27, 0x20, 0xb6, 0xd6, 0x1f, 0xb8, 0x87, 0xf9, 0x5f, 0x82, 0x34, 0x07, 0x3d, 0xec, 0x8e, 0x5c, 0x72, 0x1b, 0x12, 0x7d, 0x3e, 0x5f, 0x05, 0x73, 0xd1, 0xb0, 0xac, 0x03, 0xa4, 0xf7, 0x6c, 0x7a, 0xf8, 0xa5, 0x32, 0x24, 0x04, 0xf7, 0xce, 0x3d, 0x8f, 0x2a, 0x7a, 0x1e, 0xe6, 0xa3, 0x22, 0x82, 0x8f, 0xca, 0x6f, 0x42, 0x82, 0x05, 0xe6, 0x11, 0xa6, 0x1b, 0xec, 0xfc, 0xce, 0x34, 0xc6, 0xc4, 0x97, 0x66, 0x75, 0x2c, 0x87, 0xba, 0x04, 0x69, 0x7c, 0x67, 0x7c, 0x15, 0x52, 0x6f, 0x0e, 0x58, 0xc5, 0x14, 0xff, 0x47, 0x31, 0x48, 0x7a, 0x6b, 0x45, 0xce, 0x43, 0x9c, 0x1d, 0x62, 0x91, 0xca, 0xbb, 0xd4, 0x89, 0xe1, 0xb1, 0x95, 0x9c, 0x87, 0x04, 0x3f, 0xa8, 0xf2, 0x80, 0xa3, 0x96, 0x4b, 0x66, 0x9c, 0x1d, 0x4c, 0xfd, 0xc6, 0x8a, 0x81, 0x7e, 0x92, 0x5d, 0xd7, 0xc4, 0xd9, 0xd1, 0x93, 0xe8, 0x90, 0xf2, 0x0f, 0x9b, 0x18, 0x22, 0xf8, 0xdd, 0x4c, 0xd2, 0x3b, 0x5d, 0x0a, 0x88, 0x8a, 0x81, 0x0e, 0x94, 0x5f, 0xc4, 0x24, 0x6b, 0x41, 0xde, 0x94, 0xf4, 0x8e, 0x8c, 0xf8, 0xcf, 0x93, 0x77, 0xeb, 0x92, 0xe0, 0x87, 0xc4, 0x00, 0x50, 0x31, 0xd0, 0x33, 0x79, 0x57, 0x2c, 0x09, 0x7e, 0x10, 0x24, 0x97, 0xe8, 0x10, 0xf1, 0x60, 0x87, 0xfe, 0x27, 0xb8, 0x4f, 0x89, 0xb3, 0xe3, 0x1e, 0xb9, 0x4c, 0x19, 0xd8, 0xe9, 0x0d, 0x5d, 0x43, 0x70, 0x79, 0x92, 0xe0, 0x87, 0x3a, 0x72, 0x95, 0x42, 0xd8, 0xf2, 0xe7, 0xe0, 0x39, 0x37, 0x25, 0x09, 0x7e, 0x53, 0x42, 0x74, 0xda, 0x21, 0x7a, 0x28, 0xf4, 0x4a, 0xc2, 0xad, 0x48, 0x9c, 0xdd, 0x8a, 0x90, 0x8b, 0x48, 0xc7, 0x26, 0x95, 0x09, 0x6e, 0x40, 0x12, 0xfc, 0x14, 0x18, 0xb4, 0x63, 0x2e, 0xe9, 0xdf, 0x76, 0x24, 0xf8, 0x39, 0x8f, 0xdc, 0xa2, 0xfb, 0x45, 0x15, 0x9e, 0x9b, 0x47, 0x5f, 0xbc, 0x24, 0x4a, 0xcf, 0xdb, 0x55, 0xe6, 0x8a, 0xab, 0xcc, 0x8d, 0x99, 0xb1, 0x1a, 0xbe, 0x11, 0x4b, 0xd4, 0xf2, 0x51, 0xd7, 0x6e, 0xe7, 0xb2, 0xb8, 0x16, 0x91, 0xae, 0xdd, 0x36, 0x63, 0x35, 0x5a, 0xc3, 0x54, 0xb0, 0x45, 0xdb, 0x34, 0x6c, 0x8b, 0x5e, 0x67, 0x8d, 0xb4, 0x8a, 0xe4, 0x20, 0x56, 0x6b, 0x6c, 0x35, 0xed, 0xdc, 0x02, 0xb3, 0xb3, 0x9b, 0xb6, 0x19, 0xad, 0x6d, 0x35, 0x6d, 0xf2, 0x2a, 0x44, 0x46, 0xe3, 0xdd, 0x1c, 0x99, 0xfe, 0x5b, 0x70, 0x7b, 0xbc, 0xeb, 0x0d, 0xc6, 0xa4, 0x18, 0x72, 0x1e, 0x92, 0x23, 0x77, 0xd8, 0xf8, 0x05, 0x6b, 0xe8, 0xe4, 0x4e, 0xe3, 0x32, 0x9e, 0x32, 0x13, 0x23, 0x77, 0xf8, 0xc4, 0x1a, 0x3a, 0xc7, 0xf4, 0xc1, 0xf9, 0x8b, 0x90, 0x16, 0x78, 0x49, 0x16, 0x14, 0x9b, 0x25, 0x30, 0x55, 0xe5, 0xa6, 0xa9, 0xd8, 0xf9, 0x77, 0x20, 0xe3, 0x1d, 0xb1, 0x70, 0xc6, 0x06, 0x7d, 0x9b, 0x7a, 0xce, 0x10, 0xdf, 0xd2, 0xf9, 0xd2, 0xc5, 0x70, 0xc4, 0x0c, 0x80, 0x3c, 0x72, 0x31, 0x70, 0x5e, 0x9b, 0x18, 0x8c, 0x92, 0xff, 0x81, 0x02, 0x99, 0x4d, 0x67, 0x18, 0xfc, 0x7f, 0xb1, 0x08, 0xb1, 0x5d, 0xc7, 0xe9, 0x8d, 0x90, 0x38, 0x69, 0xb2, 0x02, 0x79, 0x19, 0x32, 0xf8, 0xe0, 0x1d, 0x92, 0x55, 0xff, 0x16, 0x28, 0x8d, 0xf5, 0xfc, 0x5c, 0x4c, 0x20, 0xda, 0xb5, 0xdd, 0x11, 0xf7, 0x68, 0xf8, 0x4c, 0xbe, 0x00, 0x69, 0xfa, 0xeb, 0x59, 0x46, 0xfd, 0x6c, 0x1a, 0x68, 0x35, 0x37, 0x7c, 0x05, 0xe6, 0x50, 0x03, 0x3e, 0x2c, 0xe1, 0xdf, 0xf8, 0x64, 0x58, 0x03, 0x07, 0xe6, 0x20, 0xc1, 0x1c, 0xc2, 0x08, 0xff, 0xf0, 0x4d, 0x99, 0x5e, 0x91, 0xba, 0x59, 0x3c, 0xa8, 0xb0, 0x0c, 0x24, 0x61, 0xf2, 0x52, 0xfe, 0x1e, 0x24, 0x31, 0x5c, 0xd6, 0x7b, 0x2d, 0xf2, 0x12, 0x28, 0x9d, 0x9c, 0x85, 0xe1, 0xfa, 0x4c, 0xe8, 0x14, 0xc2, 0x01, 0xc5, 0x75, 0x53, 0xe9, 0x2c, 0x2d, 0x80, 0xb2, 0x4e, 0x8f, 0x05, 0x07, 0xdc, 0x61, 0x2b, 0x07, 0xf9, 0xb7, 0x39, 0xc9, 0x96, 0xf5, 0x4c, 0x4e, 0xb2, 0x65, 0x3d, 0x63, 0x24, 0x97, 0xa6, 0x48, 0x68, 0xe9, 0x90, 0xff, 0x07, 0xae, 0x1c, 0xe6, 0xcb, 0x30, 0x87, 0x2f, 0x6a, 0xd7, 0xee, 0x3c, 0x72, 0xba, 0x36, 0x1e, 0x44, 0xda, 0x98, 0xc0, 0x29, 0xa6, 0xd2, 0xa6, 0xfb, 0x60, 0x1d, 0x34, 0xf7, 0x58, 0x3a, 0x9c, 0x34, 0x59, 0x21, 0xff, 0xfd, 0x28, 0xcc, 0x73, 0x27, 0xfb, 0x6e, 0xd7, 0xdd, 0xdf, 0x6c, 0x0e, 0xc8, 0x16, 0x64, 0xa8, 0x7f, 0x6d, 0xf4, 0x9b, 0x83, 0x01, 0x7d, 0x91, 0x15, 0x0c, 0xcd, 0x57, 0x67, 0xb8, 0x6d, 0x6e, 0x51, 0xdc, 0x6a, 0xf6, 0xad, 0x4d, 0x86, 0x66, 0x81, 0x3a, 0x6d, 0x07, 0x35, 0xe4, 0x01, 0xa4, 0xfb, 0xa3, 0x8e, 0x4f, 0xc7, 0x22, 0xfd, 0x15, 0x09, 0xdd, 0xe6, 0xa8, 0x13, 0x62, 0x83, 0xbe, 0x5f, 0x41, 0x07, 0x47, 0xbd, 0xb3, 0xcf, 0x16, 0x39, 0x72, 0x70, 0xd4, 0x95, 0x84, 0x07, 0xb7, 0x1b, 0xd4, 0x90, 0x1a, 0x00, 0x7d, 0xd5, 0x5c, 0x87, 0x9e, 0xf0, 0x50, 0x4b, 0xe9, 0x52, 0x41, 0xc2, 0xb6, 0xed, 0x0e, 0x77, 0x9c, 0x6d, 0x77, 0xc8, 0x13, 0x92, 0x11, 0x2f, 0x2e, 0xbd, 0x01, 0xda, 0xe4, 0x2a, 0x1c, 0x95, 0x93, 0xa4, 0x84, 0x9c, 0x64, 0xe9, 0xe7, 0x20, 0x3b, 0x31, 0x6d, 0xd1, 0x9c, 0x30, 0xf3, 0x1b, 0xa2, 0x79, 0xba, 0x74, 0x2e, 0xf4, 0x8d, 0x86, 0xb8, 0xf5, 0x22, 0xf3, 0x1b, 0xa0, 0x4d, 0x2e, 0x81, 0x48, 0x9d, 0x94, 0x1c, 0x68, 0xd0, 0xfe, 0x35, 0x98, 0x0b, 0x4d, 0x5a, 0x34, 0x4e, 0x1d, 0x31, 0xad, 0xfc, 0xaf, 0xc4, 0x20, 0x56, 0xb7, 0x2d, 0xa7, 0x4d, 0xce, 0x86, 0x63, 0xe7, 0x5b, 0xa7, 0xbc, 0xb8, 0x79, 0x6e, 0x22, 0x6e, 0xbe, 0x75, 0xca, 0x8f, 0x9a, 0xe7, 0x26, 0xa2, 0xa6, 0xd7, 0x54, 0x31, 0xc8, 0x85, 0xa9, 0x98, 0xf9, 0xd6, 0x29, 0x21, 0x60, 0x5e, 0x98, 0x0a, 0x98, 0x41, 0x73, 0xc5, 0xa0, 0x0e, 0x36, 0x1c, 0x2d, 0xdf, 0x3a, 0x15, 0x44, 0xca, 0xf3, 0x93, 0x91, 0xd2, 0x6f, 0xac, 0x18, 0x6c, 0x48, 0x42, 0x94, 0xc4, 0x21, 0xb1, 0xf8, 0x78, 0x7e, 0x32, 0x3e, 0xa2, 0x1d, 0x8f, 0x8c, 0xe7, 0x27, 0x23, 0x23, 0x36, 0xf2, 0x48, 0x78, 0x6e, 0x22, 0x12, 0x22, 0x29, 0x0b, 0x81, 0xe7, 0x27, 0x43, 0x20, 0xb3, 0x13, 0x46, 0x2a, 0xc6, 0x3f, 0xbf, 0xb1, 0x62, 0x10, 0x63, 0x22, 0xf8, 0xc9, 0x0e, 0x22, 0xb8, 0x1b, 0x18, 0x06, 0x2a, 0x74, 0xe1, 0xbc, 0x04, 0x35, 0x2b, 0xfd, 0x84, 0x05, 0x57, 0xd4, 0x4b, 0xd0, 0x0c, 0x48, 0xb4, 0xf9, 0x59, 0x5d, 0x43, 0x4f, 0x16, 0x12, 0x27, 0x4a, 0xa0, 0x58, 0x6b, 0xa0, 0x47, 0xa3, 0xb3, 0x6b, 0xb3, 0x03, 0x47, 0x01, 0xe6, 0x6a, 0x8d, 0x87, 0xcd, 0x61, 0x87, 0x42, 0x77, 0x9a, 0x1d, 0xff, 0xd6, 0x83, 0xaa, 0x20, 0x5d, 0xe3, 0x2d, 0x3b, 0xcd, 0x0e, 0x39, 0xe3, 0x49, 0xac, 0x85, 0xad, 0x0a, 0x17, 0xd9, 0xd2, 0x59, 0xba, 0x74, 0x8c, 0x0c, 0x7d, 0xe3, 0x02, 0xf7, 0x8d, 0x77, 0x13, 0x10, 0x1b, 0xdb, 0x5d, 0xc7, 0xbe, 0x9b, 0x82, 0x84, 0xeb, 0x0c, 0xfb, 0x4d, 0xd7, 0xc9, 0xff, 0x50, 0x01, 0xb8, 0xe7, 0xf4, 0xfb, 0x63, 0xbb, 0xfb, 0xde, 0xd8, 0x22, 0x17, 0x21, 0xdd, 0x6f, 0x3e, 0xb5, 0x1a, 0x7d, 0xab, 0xb1, 0x37, 0xf4, 0xde, 0x86, 0x14, 0xad, 0xda, 0xb4, 0xee, 0x0d, 0x0f, 0x49, 0xce, 0x4b, 0xe0, 0x51, 0x41, 0x28, 0x4c, 0x9e, 0xd0, 0x2f, 0xf2, 0x74, 0x34, 0xce, 0x77, 0xd2, 0x4b, 0x48, 0xd9, 0x21, 0x27, 0xc1, 0xf7, 0x90, 0x1d, 0x73, 0xce, 0x42, 0xdc, 0xb5, 0xfa, 0x83, 0xc6, 0x1e, 0x0a, 0x86, 0x8a, 0x22, 0x46, 0xcb, 0xf7, 0xc8, 0x0d, 0x88, 0xec, 0x39, 0x3d, 0x94, 0xca, 0x91, 0xbb, 0x43, 0x91, 0xe4, 0x15, 0x88, 0xf4, 0x47, 0x4c, 0x3e, 0xe9, 0xd2, 0xe9, 0x50, 0x06, 0xc1, 0x42, 0x16, 0x05, 0xf6, 0x47, 0x1d, 0x7f, 0xee, 0xf9, 0x4f, 0x55, 0x48, 0xd2, 0xfd, 0x7a, 0xbc, 0x53, 0xbb, 0x85, 0xc7, 0x86, 0xbd, 0x66, 0x0f, 0x6f, 0x08, 0xe8, 0x6b, 0xca, 0x4b, 0xb4, 0xfe, 0x2b, 0xd6, 0x9e, 0xeb, 0x0c, 0xd1, 0x35, 0xa7, 0x4c, 0x5e, 0xa2, 0x4b, 0xce, 0xb2, 0xe2, 0x08, 0x9f, 0x25, 0x2b, 0x62, 0x46, 0xdf, 0x1c, 0x34, 0xa8, 0x0f, 0x60, 0xfe, 0x32, 0x74, 0xba, 0xf6, 0xba, 0xa3, 0x47, 0xb7, 0x07, 0xd6, 0x21, 0xf3, 0x93, 0xf1, 0x3e, 0x16, 0xc8, 0xcf, 0xb2, 0x23, 0x1f, 0xdb, 0x49, 0xf6, 0x7d, 0x55, 0xfe, 0x79, 0xc6, 0xef, 0x50, 0x50, 0x70, 0xee, 0xc3, 0xe2, 0xd2, 0x6d, 0x48, 0x0b, 0xbc, 0x47, 0xb9, 0xa2, 0xc8, 0x84, 0x1f, 0x0b, 0xb1, 0x1e, 0x75, 0xab, 0x23, 0xfa, 0x31, 0xba, 0xa2, 0x0e, 0xd5, 0xf0, 0x95, 0x2c, 0x44, 0x6a, 0xf5, 0x3a, 0xcd, 0xb3, 0x6a, 0xf5, 0xfa, 0x8a, 0xa6, 0x54, 0x57, 0x20, 0xd9, 0x19, 0x5a, 0x16, 0x75, 0xbd, 0xcf, 0x3b, 0xe7, 0x7d, 0x19, 0x97, 0xd5, 0x87, 0x55, 0xdf, 0x86, 0xc4, 0x1e, 0x3b, 0xe9, 0x91, 0xe7, 0xde, 0x6a, 0xe4, 0xfe, 0x98, 0xdd, 0xae, 0xbd, 0x28, 0x02, 0x26, 0xcf, 0x87, 0xa6, 0xc7, 0x53, 0xdd, 0x81, 0xd4, 0xb0, 0x71, 0x34, 0xe9, 0x07, 0x2c, 0x96, 0xcb, 0x49, 0x93, 0x43, 0x5e, 0x55, 0x5d, 0x87, 0x05, 0xdb, 0xf1, 0xfe, 0xe4, 0x6b, 0xb4, 0xb8, 0x27, 0x9b, 0x95, 0x44, 0x7b, 0x1d, 0x58, 0xec, 0x53, 0x01, 0xdb, 0xe1, 0x0d, 0xcc, 0xfb, 0x55, 0xd7, 0x40, 0x13, 0x88, 0xda, 0xcc, 0x5d, 0xca, 0x78, 0xda, 0xec, 0xeb, 0x04, 0x9f, 0x07, 0x3d, 0xec, 0x04, 0x0d, 0xf7, 0x81, 0x32, 0x9a, 0x0e, 0xfb, 0xd8, 0xc3, 0xa7, 0xc1, 0xb0, 0x32, 0x4d, 0x43, 0x23, 0x82, 0x8c, 0x66, 0x9f, 0x7d, 0x09, 0x22, 0xd2, 0x54, 0x8c, 0x89, 0xd5, 0x19, 0x1f, 0x63, 0x38, 0x5d, 0xf6, 0x29, 0x87, 0xcf, 0xc3, 0x02, 0xce, 0x0c, 0xa2, 0xa3, 0x06, 0xf4, 0x65, 0xf6, 0x9d, 0x47, 0x88, 0x68, 0x6a, 0x44, 0xa3, 0x63, 0x8c, 0xe8, 0x29, 0xfb, 0xac, 0xc2, 0x27, 0xda, 0x9e, 0x35, 0xa2, 0xd1, 0x31, 0x46, 0xd4, 0x63, 0x9f, 0x5c, 0x84, 0x88, 0x2a, 0x46, 0x75, 0x03, 0x88, 0xb8, 0xf1, 0x3c, 0x3a, 0x4b, 0x99, 0xfa, 0xec, 0x53, 0x9a, 0x60, 0xeb, 0x99, 0xd1, 0x2c, 0xaa, 0xa3, 0x06, 0x65, 0xb3, 0xef, 0x6c, 0xc2, 0x54, 0x15, 0xa3, 0xfa, 0x00, 0x4e, 0x8b, 0xd3, 0x3b, 0xd6, 0xb0, 0x1c, 0xf6, 0x91, 0x48, 0x30, 0x41, 0x6e, 0x35, 0x93, 0xec, 0xa8, 0x81, 0x0d, 0xd8, 0x07, 0x24, 0x13, 0x64, 0x15, 0xa3, 0x7a, 0x0f, 0xb2, 0x02, 0xd9, 0x2e, 0xde, 0x2b, 0xc8, 0x88, 0xde, 0x63, 0x9f, 0x3d, 0xf9, 0x44, 0x34, 0xa3, 0x9a, 0xdc, 0x3d, 0x96, 0x63, 0x48, 0x69, 0x86, 0xec, 0xab, 0x9d, 0x60, 0x3c, 0x68, 0x33, 0xf1, 0xa2, 0xec, 0xb2, 0x84, 0x44, 0xc6, 0x33, 0x62, 0x5f, 0xf4, 0x04, 0xc3, 0xa1, 0x26, 0xd5, 0x7e, 0x68, 0x52, 0x16, 0x4d, 0x33, 0xa4, 0x2c, 0x2e, 0x46, 0xc4, 0x82, 0x04, 0x52, 0x14, 0xaf, 0xaf, 0x84, 0xe9, 0xd3, 0x62, 0xf5, 0x01, 0xcc, 0x9f, 0xc4, 0x65, 0x7d, 0xa0, 0xb0, 0xbb, 0x8c, 0x72, 0x71, 0xc5, 0x58, 0x59, 0x35, 0xe7, 0x5a, 0x21, 0xcf, 0xb5, 0x0e, 0x73, 0x27, 0x70, 0x5b, 0x1f, 0x2a, 0xec, 0x46, 0x80, 0x72, 0x99, 0x99, 0x56, 0xd8, 0x77, 0xcd, 0x9d, 0xc0, 0x71, 0x7d, 0xa4, 0xb0, 0x2b, 0x24, 0xa3, 0xe4, 0xd3, 0x78, 0xbe, 0x6b, 0xee, 0x04, 0x8e, 0xeb, 0x63, 0x76, 0xe2, 0x57, 0x8d, 0xb2, 0x48, 0x83, 0x9e, 0x62, 0xfe, 0x24, 0x8e, 0xeb, 0x13, 0x05, 0xaf, 0x94, 0x54, 0xc3, 0xf0, 0xd7, 0xc7, 0xf7, 0x5d, 0xf3, 0x27, 0x71, 0x5c, 0x5f, 0x53, 0xf0, 0xea, 0x49, 0x35, 0x56, 0x43, 0x44, 0xe1, 0x11, 0x1d, 0xc7, 0x71, 0x7d, 0xaa, 0xe0, 0x7d, 0x90, 0x6a, 0x54, 0x7c, 0xa2, 0xed, 0xa9, 0x11, 0x1d, 0xc7, 0x71, 0x7d, 0x1d, 0xcf, 0x57, 0x55, 0xd5, 0xb8, 0x19, 0x22, 0x42, 0xdf, 0x95, 0x3d, 0x91, 0xe3, 0xfa, 0x86, 0x82, 0x57, 0x77, 0xaa, 0x71, 0xcb, 0xf4, 0x46, 0x10, 0xf8, 0xae, 0xec, 0x89, 0x1c, 0xd7, 0x37, 0x15, 0xbc, 0xe3, 0x53, 0x8d, 0xdb, 0x61, 0x2a, 0xf4, 0x5d, 0xda, 0xc9, 0x1c, 0xd7, 0x67, 0x0a, 0x7e, 0xd1, 0xa3, 0xae, 0x2e, 0x9b, 0xde, 0x20, 0x04, 0xdf, 0xa5, 0x9d, 0xcc, 0x71, 0x7d, 0x4b, 0xc1, 0xcf, 0x7c, 0xd4, 0xd5, 0x95, 0x09, 0xb2, 0x8a, 0x51, 0x5d, 0x83, 0xcc, 0xf1, 0x1d, 0xd7, 0xb7, 0xc5, 0x1b, 0xd4, 0x74, 0x4b, 0xf0, 0x5e, 0x4f, 0x84, 0xfd, 0x3b, 0x86, 0xeb, 0xfa, 0x0e, 0x26, 0x7f, 0xd5, 0x17, 0xde, 0x62, 0xf7, 0x8c, 0xcc, 0xe4, 0x5a, 0xcb, 0x6a, 0xbf, 0xde, 0x76, 0x9c, 0x60, 0x4b, 0x99, 0x43, 0xab, 0x07, 0x6f, 0xcf, 0x31, 0xbc, 0xd9, 0x77, 0x15, 0xbc, 0x96, 0xcc, 0x70, 0x6a, 0xb4, 0xf0, 0xdf, 0x23, 0xe6, 0xda, 0xec, 0x60, 0xce, 0x47, 0xfb, 0xb5, 0xef, 0x29, 0x27, 0x73, 0x6c, 0xd5, 0x48, 0x7d, 0x6b, 0xcd, 0x5f, 0x1c, 0xac, 0x79, 0x13, 0xa2, 0x07, 0xa5, 0xe5, 0x95, 0x70, 0x8a, 0x27, 0xde, 0xca, 0x33, 0x77, 0x96, 0x2e, 0x2d, 0x84, 0xfe, 0xbe, 0xe8, 0x0f, 0xdc, 0x43, 0x13, 0x2d, 0x39, 0x43, 0x49, 0xc2, 0xf0, 0xa1, 0x94, 0xa1, 0xc4, 0x19, 0xca, 0x12, 0x86, 0x8f, 0xa4, 0x0c, 0x65, 0xce, 0x60, 0x48, 0x18, 0x3e, 0x96, 0x32, 0x18, 0x9c, 0x61, 0x55, 0xc2, 0xf0, 0x89, 0x94, 0x61, 0x95, 0x33, 0x54, 0x24, 0x0c, 0x5f, 0x93, 0x32, 0x54, 0x38, 0xc3, 0x4d, 0x09, 0xc3, 0xa7, 0x52, 0x86, 0x9b, 0x9c, 0xe1, 0x96, 0x84, 0xe1, 0xeb, 0x52, 0x86, 0x5b, 0x9c, 0xe1, 0xb6, 0x84, 0xe1, 0x1b, 0x52, 0x86, 0xdb, 0x8c, 0x61, 0x65, 0x59, 0xc2, 0xf0, 0x4d, 0x19, 0xc3, 0xca, 0x32, 0x67, 0x90, 0x69, 0xf2, 0x33, 0x29, 0x03, 0xd7, 0xe4, 0x8a, 0x4c, 0x93, 0xdf, 0x92, 0x32, 0x70, 0x4d, 0xae, 0xc8, 0x34, 0xf9, 0x6d, 0x29, 0x03, 0xd7, 0xe4, 0x8a, 0x4c, 0x93, 0xdf, 0x91, 0x32, 0x70, 0x4d, 0xae, 0xc8, 0x34, 0xf9, 0x5d, 0x29, 0x03, 0xd7, 0xe4, 0x8a, 0x4c, 0x93, 0xdf, 0x93, 0x32, 0x70, 0x4d, 0xae, 0xc8, 0x34, 0xf9, 0x27, 0x52, 0x06, 0xae, 0xc9, 0x15, 0x99, 0x26, 0xff, 0x54, 0xca, 0xc0, 0x35, 0xb9, 0x22, 0xd3, 0xe4, 0x9f, 0x49, 0x19, 0xb8, 0x26, 0x4b, 0x32, 0x4d, 0x7e, 0x5f, 0xc6, 0x50, 0xe2, 0x9a, 0x2c, 0xc9, 0x34, 0xf9, 0xe7, 0x52, 0x06, 0xae, 0xc9, 0x92, 0x4c, 0x93, 0x7f, 0x21, 0x65, 0xe0, 0x9a, 0x2c, 0xc9, 0x34, 0xf9, 0x03, 0x29, 0x03, 0xd7, 0x64, 0x49, 0xa6, 0xc9, 0xbf, 0x94, 0x32, 0x70, 0x4d, 0x96, 0x64, 0x9a, 0xfc, 0x2b, 0x29, 0x03, 0xd7, 0x64, 0x49, 0xa6, 0xc9, 0xbf, 0x96, 0x32, 0x70, 0x4d, 0x96, 0x64, 0x9a, 0xfc, 0x1b, 0x29, 0x03, 0xd7, 0x64, 0x49, 0xa6, 0xc9, 0xbf, 0x95, 0x32, 0x70, 0x4d, 0x96, 0x64, 0x9a, 0xfc, 0x3b, 0x29, 0x03, 0xd7, 0x64, 0x59, 0xa6, 0xc9, 0xbf, 0x97, 0x31, 0x94, 0xb9, 0x26, 0xcb, 0x32, 0x4d, 0xfe, 0x83, 0x94, 0x81, 0x6b, 0xb2, 0x2c, 0xd3, 0xe4, 0x3f, 0x4a, 0x19, 0xb8, 0x26, 0xcb, 0x32, 0x4d, 0xfe, 0x93, 0x94, 0x81, 0x6b, 0xb2, 0x2c, 0xd3, 0xe4, 0x3f, 0x4b, 0x19, 0xb8, 0x26, 0xcb, 0x32, 0x4d, 0xfe, 0x8b, 0x94, 0x81, 0x6b, 0xb2, 0x2c, 0xd3, 0xe4, 0xbf, 0x4a, 0x19, 0xb8, 0x26, 0xcb, 0x32, 0x4d, 0xfe, 0x9b, 0x94, 0x81, 0x6b, 0xb2, 0x2c, 0xd3, 0xe4, 0x0f, 0xa5, 0x0c, 0x5c, 0x93, 0x65, 0x99, 0x26, 0xff, 0x5d, 0xca, 0xc0, 0x35, 0x69, 0xc8, 0x34, 0xf9, 0x1f, 0x32, 0x06, 0x83, 0x6b, 0xd2, 0x90, 0x69, 0xf2, 0x3f, 0xa5, 0x0c, 0x5c, 0x93, 0x86, 0x4c, 0x93, 0xff, 0x25, 0x65, 0xe0, 0x9a, 0x34, 0x64, 0x9a, 0xfc, 0x6f, 0x29, 0x03, 0xd7, 0xa4, 0x21, 0xd3, 0xe4, 0xff, 0x48, 0x19, 0xb8, 0x26, 0x0d, 0x99, 0x26, 0xff, 0x57, 0xca, 0xc0, 0x35, 0x69, 0xc8, 0x34, 0xf9, 0x23, 0x29, 0x03, 0xd7, 0xa4, 0x21, 0xd3, 0xe4, 0x8f, 0xa5, 0x0c, 0x5c, 0x93, 0x86, 0x4c, 0x93, 0x3f, 0x91, 0x32, 0x70, 0x4d, 0x1a, 0x32, 0x4d, 0xfe, 0x54, 0xca, 0xc0, 0x35, 0xb9, 0x2a, 0xd3, 0xe4, 0xff, 0xc9, 0x18, 0x56, 0x97, 0xef, 0x16, 0x9f, 0x5c, 0xeb, 0x74, 0xdd, 0xfd, 0xf1, 0x6e, 0x71, 0xcf, 0xe9, 0xdf, 0x70, 0x87, 0x8e, 0x7d, 0x7d, 0x3c, 0xba, 0x81, 0xb8, 0xdd, 0x71, 0x9b, 0x3d, 0xdc, 0x08, 0x6c, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xbd, 0xf5, 0xc7, 0xda, 0x3e, 0x00, 0x00, }
Hydrorastaman/PDFOut-SDK
kernel/include/object/ObjectStream.h
#pragma once #include <memory> #include <object/Object.h> #include <stream/MemoryOStream.h> #include <object/ObjectDictionary.h> namespace pdfout{ class InputStream; class OutputStream; class MemoryIStream; } namespace kernel{ enum StreamDictionaryKey{ StreamDictionaryKeyFilter, // Optional StreamDictionaryKeyDecodeParms, // Optional StreamDictionaryKeyF, // Optional; PDF 1.2 StreamDictionaryKeyFFilter, // Optional; PDF 1.2 StreamDictionaryKeyFDecodeParms, // Optional; PDF 1.2 StreamDictionaryKeyDL // Optional; PDF 1.5 }; class ObjectStream : public Object{ private: static std::size_t const chunkSize = 4096; public: explicit ObjectStream(IndirectType indirectable = IndirectTypeIndirectable); explicit ObjectStream(std::unique_ptr<pdfout::MemoryOStream> stream, IndirectType indirectable = IndirectTypeIndirectable); explicit ObjectStream(pdfout::InputStream const *stream, IndirectType indirectable = IndirectTypeIndirectable); explicit ObjectStream(char const *stream, IndirectType indirectable = IndirectTypeIndirectable); ~ObjectStream(void) {} void insert(std::string const &key, std::unique_ptr<Object> value) {mStreamDictionary->insert(key, std::move(value));} void insert(ObjectName *key, std::unique_ptr<Object> value) {mStreamDictionary->insert(key, std::move(value));} uint64_t write(void const *data, uint32_t sizeOfElements, uint64_t numOfElements); uint64_t write(char const *str); void addKey(StreamDictionaryKey key, std::unique_ptr<Object> value); void removeKey(StreamDictionaryKey key); void serialize(pdfout::OutputStream *stream, SerializeParams *params) const; ObjectStream *clone(void) const; pdfout::MemoryOStream *getStream(void); void writeEOL(void); template <typename T> void addKey(std::unordered_map<T, std::pair<std::string, uint32_t>> const &map, T key, std::unique_ptr<Object> value){ auto iter = map.find(key); if (iter != std::end(map) && (value->getType() & (iter->second.second | ObjectTypeIndirectReference))){ mStreamDictionary->insert(iter->second.first, std::move(value)); return; } RUNTIME_EXCEPTION("Unsupported object type"); } protected: ObjectStream(ObjectStream const &obj); virtual void beforeSerialize(void) const {} private: static std::unordered_map<StreamDictionaryKey, std::pair<std::string, uint32_t>> mObjectStreamMap; private: ObjectStream &operator=(ObjectStream const &) = delete; protected: std::unique_ptr<ObjectDictionary> mStreamDictionary; mutable std::unique_ptr<pdfout::MemoryOStream> mStreamData; /**< for beforeSerialize() method in derived classes */ }; }
Limmen/WebServicesScenarios
hw1/src/main/java/limmen/kth/se/id2208/hw1/parsing/jaxb/JAXBParser.java
<reponame>Limmen/WebServicesScenarios package limmen.kth.se.id2208.hw1.parsing.jaxb; import limmen.kth.se.id2208.hw1.java_mappings.generated_pojos.application_profile.ApplicationProfile; import limmen.kth.se.id2208.hw1.java_mappings.generated_pojos.short_cv.ShortCV; import limmen.kth.se.id2208.hw1.java_mappings.generated_pojos.transcript.Transcript; import limmen.kth.se.id2208.hw1.parsing.jaxb.application_profile.ApplicationProfileParser; import limmen.kth.se.id2208.hw1.parsing.jaxb.short_cv.ShortCVJAXBParser; import limmen.kth.se.id2208.hw1.parsing.jaxb.transcript.TranscriptJAXBParser; import org.xml.sax.SAXException; import javax.xml.XMLConstants; import javax.xml.bind.JAXBException; import javax.xml.validation.SchemaFactory; /** * JAXBParser * * @author <NAME> on 2017-01-26. */ public class JAXBParser { private static final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); /** * Parses transcript.xml into POJO representation * * @return Transcript object * @throws JAXBException * @throws SAXException */ public Transcript parseTranscript() throws JAXBException, SAXException { TranscriptJAXBParser transcriptJAXBParser = new TranscriptJAXBParser(schemaFactory); transcriptJAXBParser.init(); return transcriptJAXBParser.createPOJO(); } /** * Parses short_cv into POJO representation * * @return ShortCV object * @throws JAXBException * @throws SAXException */ public ShortCV parseShortCV() throws JAXBException, SAXException { ShortCVJAXBParser shortCVJAXBParser = new ShortCVJAXBParser(schemaFactory); shortCVJAXBParser.init(); return shortCVJAXBParser.createPOJO(); } /** * Uses generated POJO to create application_profile.xml * * @param applicationProfile ApplicationProfile Object * @throws JAXBException * @throws SAXException */ public void generateApplicationProfileDocument(ApplicationProfile applicationProfile) throws JAXBException, SAXException { ApplicationProfileParser applicationProfileParser = new ApplicationProfileParser(schemaFactory); applicationProfileParser.init(); applicationProfileParser.generateApplicationProfileDocument(applicationProfile); } }
S-117-John/sofa-dashboard
sofa-dashboard-backend/sofa-dashboard-arkmng/src/main/java/com/alipay/sofa/dashboard/impl/ZkCommandPushManager.java
<reponame>S-117-John/sofa-dashboard /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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. */ package com.alipay.sofa.dashboard.impl; import com.alipay.sofa.dashboard.constants.SofaDashboardConstants; import com.alipay.sofa.dashboard.dao.ArkDao; import com.alipay.sofa.dashboard.model.ArkModuleVersionDO; import com.alipay.sofa.dashboard.model.ArkPluginDO; import com.alipay.sofa.dashboard.model.CommandRequest; import com.alipay.sofa.dashboard.spi.CommandPushManager; import com.alipay.sofa.dashboard.zookeeper.ZkCommandClient; import org.apache.curator.framework.CuratorFramework; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.data.Stat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; /** * @author: guolei.sgl (<EMAIL>) 2019/2/12 5:21 PM * @since: **/ @Service public class ZkCommandPushManager implements CommandPushManager { private static final Logger LOGGER = LoggerFactory .getLogger(ZkCommandPushManager.class); private volatile AtomicBoolean isSyncAppState = new AtomicBoolean(false); @Autowired private ZkCommandClient zkCommandClient; @Autowired private ArkDao arkDao; @Override public void pushCommand(CommandRequest commandRequest) { checkRoot(); // 如果是按照应用维度推送命令,则直接放在 /appName 节点数据中 if (commandRequest.getDimension().equals(SofaDashboardConstants.APP)) { String path = SofaDashboardConstants.SOFA_ARK_ROOT + SofaDashboardConstants.SEPARATOR + commandRequest.getAppName(); ArkOperation data = getData(commandRequest); try { Stat stat = getClient().checkExists().forPath(path); if (stat == null) { getClient().create().creatingParentContainersIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(path, convertConfig(data, "").getBytes()); } else { String oldData = new String(getClient().getData().forPath(path)); getClient().setData().forPath(path, convertConfig(data, oldData).getBytes()); } } catch (Exception e) { LOGGER.error("Failed to install biz module via app dimension.", e); throw new RuntimeException(e); } } else { // 如果是按照IP维度推送,则放在 /ip 节点数据中 List<String> targetHosts = commandRequest.getTargetHost(); targetHosts.forEach(targetHost -> { String path = SofaDashboardConstants.SOFA_ARK_ROOT + SofaDashboardConstants.SEPARATOR + commandRequest.getAppName() + SofaDashboardConstants.SEPARATOR + targetHost; ArkOperation data = getData(commandRequest); try { if (getClient().checkExists().forPath(path) == null) { getClient().create().creatingParentContainersIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(path, convertConfig(data, "").getBytes()); } else { // 这里应该ark在首次从应用维度初始化之后向自己的节点写入状态数据 // 为了保持兼容,这里先从应用维度解析然后进行 merge if (isSyncAppState.compareAndSet(false, true)) { String appPath = SofaDashboardConstants.SOFA_ARK_ROOT + SofaDashboardConstants.SEPARATOR + commandRequest.getAppName(); String appOldData = new String(getClient().getData().forPath(appPath)); getClient().setData().forPath(path, convertConfig(data, appOldData).getBytes()); } else { String oldData = new String(getClient().getData().forPath(path)); getClient().setData().forPath(path, convertConfig(data, oldData).getBytes()); } } } catch (Exception e) { LOGGER.error("Failed to install biz module via ip dimension.", e); throw new RuntimeException(e); } }); } } private String convertConfig(ArkOperation operation, String oldData) { List<ArkOperation> arkOperations = new ArrayList<>(); String[] stateInfo = oldData.split(SofaDashboardConstants.SEMICOLON); for (String info : stateInfo) { if (StringUtils.isEmpty(info)) { continue; } arkOperations.add(convertArkOperation(info)); } if (SofaDashboardConstants.INSTALL.equals(operation.getCommand())) { return handleInstall(operation.getBizName(), operation.getBizVersion(), operation.getParameters(), arkOperations); } else if (SofaDashboardConstants.SWITCH.equals(operation.getCommand())) { return handleSwitch(operation.getBizName(), operation.getBizVersion(), arkOperations); } else { return handleUninstall(operation.getBizName(), operation.getBizVersion(), arkOperations); } } private String handleInstall(String bizName, String bizVersion, String parameters, List<ArkOperation> current) { String state = SofaDashboardConstants.ACTIVATED; boolean isExist = false; for (ArkOperation arkOperation : current) { if (arkOperation.getBizName().equals(bizName) && arkOperation.getBizVersion().equals(bizVersion)) { isExist = true; } else if (arkOperation.getBizName().equals(bizName) && arkOperation.getState().equals(SofaDashboardConstants.ACTIVATED)) { state = SofaDashboardConstants.DEACTIVATED; } } if (!isExist) { ArkOperation operation = new ArkOperation(); operation.setBizName(bizName); operation.setBizVersion(bizVersion); operation.setState(state); operation.setParameters(parameters); current.add(operation); } return covertToConfig(current); } private String handleUninstall(String bizName, String bizVersion, List<ArkOperation> current) { for (ArkOperation arkOperation : current) { if (arkOperation.getBizName().equals(bizName) && arkOperation.getBizVersion().equals(bizVersion)) { current.remove(arkOperation); break; } } return covertToConfig(current); } private String handleSwitch(String bizName, String bizVersion, List<ArkOperation> current) { for (ArkOperation arkOperation : current) { if (arkOperation.getBizName().equals(bizName) && arkOperation.getBizVersion().equals(bizVersion)) { arkOperation.setState(SofaDashboardConstants.ACTIVATED); } else if (arkOperation.getBizName().equals(bizName)) { arkOperation.setState(SofaDashboardConstants.DEACTIVATED); } } return covertToConfig(current); } private String covertToConfig(List<ArkOperation> arkOperations) { StringBuilder sb = new StringBuilder(); for (ArkOperation arkOperation : arkOperations) { sb.append(arkOperation.getBizName()).append(SofaDashboardConstants.COLON) .append(arkOperation.getBizVersion()).append(SofaDashboardConstants.COLON) .append(arkOperation.getState()); if (!StringUtils.isEmpty(arkOperation.getParameters())) { sb.append(SofaDashboardConstants.Q_MARK).append(arkOperation.getParameters()); } sb.append(SofaDashboardConstants.SEMICOLON); } String ret = sb.toString(); if (ret.endsWith(SofaDashboardConstants.SEMICOLON)) { ret = ret.substring(0, ret.length() - 1); } return ret; } private CuratorFramework getClient() { return zkCommandClient.getCuratorClient(); } private ArkOperation getData(CommandRequest commandRequest) { ArkOperation arkOperation = new ArkOperation(); arkOperation.setCommand(commandRequest.getCommand()); arkOperation.setBizName(commandRequest.getPluginName()); arkOperation.setBizVersion(commandRequest.getPluginVersion()); arkOperation.setParameters("bizUrl=" + getBizPluginFileUrl(commandRequest)); return arkOperation; } private String getBizPluginFileUrl(CommandRequest commandRequest) { List<ArkPluginDO> arkPluginList = arkDao.queryModuleInfoByNameStrict(commandRequest .getPluginName()); if (arkPluginList.size() > 1) { throw new RuntimeException("Multiple modules with the same name coexist."); } if (arkPluginList.size() == 1) { ArkPluginDO arkPlugin = arkPluginList.get(0); ArkModuleVersionDO arkModuleVersion = arkDao.queryByModuleIdAndModuleVersion( arkPlugin.getId(), commandRequest.getPluginVersion()); return arkModuleVersion.getSourcePath(); } return null; } private void checkRoot() { try { if (getClient().checkExists().forPath(SofaDashboardConstants.SOFA_ARK_ROOT) == null) { getClient().create().creatingParentContainersIfNeeded() .withMode(CreateMode.PERSISTENT) .forPath(SofaDashboardConstants.SOFA_ARK_ROOT, null); } } catch (Exception e) { LOGGER.error("Failed to check zookeeper root path.", e); } } private ArkOperation convertArkOperation(String config) { int idx = config.indexOf(SofaDashboardConstants.Q_MARK); String parameter = (idx == -1) ? "" : config.substring(idx + 1); String[] meta = (idx == -1) ? config.split(SofaDashboardConstants.COLON) : config .substring(0, idx).split(SofaDashboardConstants.COLON); ArkOperation arkOperation = new ArkOperation(); arkOperation.setParameters(parameter); arkOperation.setBizName(meta[0]); arkOperation.setBizVersion(meta[1]); arkOperation.setState(meta[2]); return arkOperation; } class ArkOperation { String command; String bizName; String bizVersion; String parameters; String state; private String getState() { return state; } private void setState(String state) { this.state = state; } private String getCommand() { return command; } private void setCommand(String command) { this.command = command; } private String getBizName() { return bizName; } private void setBizName(String bizName) { this.bizName = bizName; } private String getBizVersion() { return bizVersion; } private void setBizVersion(String bizVersion) { this.bizVersion = bizVersion; } private String getParameters() { return parameters; } private void setParameters(String parameters) { this.parameters = parameters; } } }
wundery/wundery-ui-react
src/components/Modal/index.js
export Modal from './Modal'; export ModalContent from './ModalContent'; export ModalHeader from './ModalHeader'; export ModalFooter from './ModalFooter';
gitter-badger/mlmodels
mlmodels/model_tch/cnn_classifier.py
<filename>mlmodels/model_tch/cnn_classifier.py<gh_stars>1-10 # -*- coding: utf-8 -*- """ # Trains an MNIST digit recognizer using PyTorch, # NOTE: This example requires you to first install PyTorch (using the instructions at pytorch.org) # and tensorboardX (using pip install tensorboardX). # # Code based on https://github.com/lanpa/tensorboard-pytorch-examples/blob/master/mnist/main.py. """ from __future__ import print_function import argparse import os import tempfile import mlflow import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.autograd import Variable from tensorboardX import SummaryWriter #################################################################################################### ########Model definiton and Generic method ######################################################### class Model(nn.Module): def __init__(self): super(Model, self).__init__() self.conv1 = nn.Conv2d(1, 10, kernel_size=5) self.conv2 = nn.Conv2d(10, 20, kernel_size=5) self.conv2_drop = nn.Dropout2d() self.fc1 = nn.Linear(320, 50) self.fc2 = nn.Linear(50, 10) def forward(self, x): x = F.relu(F.max_pool2d(self.conv1(x), 2)) x = F.relu(F.max_pool2d(self.conv2_drop(self.conv2(x)), 2)) x = x.view(-1, 320) x = F.relu(self.fc1(x)) x = F.dropout(x, training=self.training) x = self.fc2(x) return F.log_softmax(x, dim=0) def log_weights(self, step): writer.add_histogram('weights/conv1/weight', model.conv1.weight.data, step) writer.add_histogram('weights/conv1/bias', model.conv1.bias.data, step) writer.add_histogram('weights/conv2/weight', model.conv2.weight.data, step) writer.add_histogram('weights/conv2/bias', model.conv2.bias.data, step) writer.add_histogram('weights/fc1/weight', model.fc1.weight.data, step) writer.add_histogram('weights/fc1/bias', model.fc1.bias.data, step) writer.add_histogram('weights/fc2/weight', model.fc2.weight.data, step) writer.add_histogram('weights/fc2/bias', model.fc2.bias.data, step) ######## Generic methods ########################################################################### def get_pars(choice="test", **kwargs): # output parms sample # print(kwargs) if choice=="test": p= { "learning_rate": 0.001, "num_layers": 1, "size": None, "size_layer": 128, "output_size": None, "timestep": 4, "epoch": 2, } ### Overwrite by manual input for k,x in kwargs.items() : p[k] = x return p def get_dataset(data_params) : #### Get dataset train_loader = torch.utils.data.DataLoader( datasets.MNIST('../data', train=True, download=True, transform=transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.1307,), (0.3081,)) ])), batch_size=args.batch_size, shuffle=True, **kwargs) test_loader = torch.utils.data.DataLoader( datasets.MNIST('../data', train=False, transform=transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.1307,), (0.3081,)) ])), batch_size=args.test_batch_size, shuffle=True, **kwargs) return train_loader, test_loader def fit(model, data_pars, compute_pars={}, out_pars=None, **kwargs): train_loader, test_loader = get_dataset(data_params) args = to_namepace(compute_params) enable_cuda_flag = True if args.enable_cuda == 'True' else False args.cuda = enable_cuda_flag and torch.cuda.is_available() torch.manual_seed(args.seed) if args.cuda: torch.cuda.manual_seed(args.seed) kwargs = {'num_workers': 1, 'pin_memory': True} if args.cuda else {} model = model.cuda() if args.cuda else model optimizer = optim.SGD(model.parameters(), lr=args.lr, momentum=args.momentum) # writer = None # Will be used to write TensorBoard events model = train(model, epoch, train_loader) # Perform the training for epoch in range(1, args.epochs + 1): model = train(epoch) test(epoch) return model, None def predict(model,sess=None, compute_params=None, data_params=None) : # prediction train_loader, test_loader = get_dataset(data_params) return res def predict_proba(model, sess=None, compute_params=None, data_params=None) : # compute probability, ie softmax train_loader, test_loader = get_dataset(data_params) return res def metrics(model, sess=None, data_params={}, compute_params={}) : # compute some metrics pass def test(arg) : # some test runs # Create a SummaryWriter to write TensorBoard events locally writer = tfboard_writer_create() #### Add MLFlow args mlflow_add(args) check_data = get_dataset() model = Model() fit(model,module=None, sess=None, compute_params=None, data_params=None) # Upload the TensorBoard event logs as a run artifact print("Uploading TensorBoard events as a run artifact...") mlflow.log_artifacts(output_dir, artifact_path="events") print("\nLaunch TensorBoard with:\n\ntensorboard --logdir=%s" % os.path.join(mlflow.get_artifact_uri(), "events")) ############################################################################################################ ########### Local code, helper code ####################################################################### def _train(epoch, model, train_loader): model.train() for batch_idx, (data, target) in enumerate(train_loader): if args.cuda: data, target = data.cuda(), target.cuda() data, target = Variable(data), Variable(target) optimizer.zero_grad() output = model(data) loss = F.nll_loss(output, target) loss.backward() optimizer.step() if batch_idx % args.log_interval == 0: print( f'Train Epoch: {epoch} [{batch_idx}/{} ({:.0f}%)]\tLoss: {:.6f}'.format( epoch, batch_idx * c, len(train_loader.dataset), 100. * batch_idx / len(train_loader), loss.data.item())) step = epoch * len(train_loader) + batch_idx log_scalar('train_loss', loss.data.item(), step) model.log_weights(step) return model def _eval_metrics(model, epoch, test_loader): model.eval() test_loss = 0 correct = 0 with torch.no_grad(): for data, target in test_loader: if args.cuda: data, target = data.cuda(), target.cuda() data, target = Variable(data), Variable(target) output = model(data) test_loss += F.nll_loss(output, target, reduction='sum').data.item() # sum up batch loss pred = output.data.max(1)[1] # get the index of the max log-probability correct += pred.eq(target.data).cpu().sum().item() test_loss /= len(test_loader.dataset) test_accuracy = 100.0 * correct / len(test_loader.dataset) print('\nTest set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n'.format( test_loss, correct, len(test_loader.dataset), test_accuracy)) step = (epoch + 1) * len(train_loader) log_scalar('test_loss', test_loss, step) log_scalar('test_accuracy', test_accuracy, step) def _log_scalar(name, value, step): """Log a scalar value to both MLflow and TensorBoard""" writer.add_scalar(name, value, step) mlflow.log_metric(name, value) ####################################################################################### ########### CLI ####################################################################### def cli_load_arguments(): def to(*arg, **kwarg) : p.add_argument(*arg, **kwarg) p = argparse.ArgumentParser(description='PyTorch CNN') to('--do', type=str, default="test", help='input batch size for training (default: 64)') to('--batch-size', type=int, default=64, metavar='N', help='input batch size for training (default: 64)') to('--test-batch-size', type=int, default=1000, metavar='N', help='input batch size for testing (default: 1000)') to('--epochs', type=int, default=10, metavar='N', help='number of epochs to train (default: 10)') to('--lr', type=float, default=0.01, metavar='LR', help='learning rate (default: 0.01)') to('--momentum', type=float, default=0.5, metavar='M', help='SGD momentum (default: 0.5)') to('--enable-cuda', type=str, choices=['True', 'False'], default='True', help='enables or disables CUDA training') to('--seed', type=int, default=1, metavar='S', help='random seed (default: 1)') to('--log-interval', type=int, default=100, metavar='N', help='how many batches to wait before logging training status') args = p.parse_args() return args #################################################################################################### if __name__ == "main" : arg = load_arguments() if arg.do =="test" : test()
CrBatista/starfish
src/main/java/com/starfish/starfish/service/impl/CardStatusServiceImpl.java
package com.starfish.starfish.service.impl; import com.starfish.starfish.service.CardStatusService; import org.springframework.stereotype.Component; @Component public class CardStatusServiceImpl implements CardStatusService { }
yifanyou/devops-service
src/main/java/io/choerodon/devops/domain/application/repository/DevopsEnvCommandRepository.java
package io.choerodon.devops.domain.application.repository; import java.util.List; import io.choerodon.devops.domain.application.entity.DevopsEnvCommandE; public interface DevopsEnvCommandRepository { DevopsEnvCommandE create(DevopsEnvCommandE devopsEnvCommandE); DevopsEnvCommandE queryByObject(String objectType, Long objectId); DevopsEnvCommandE update(DevopsEnvCommandE devopsEnvCommandE); DevopsEnvCommandE query(Long id); List<DevopsEnvCommandE> listByEnvId(Long envId); List<DevopsEnvCommandE> queryInstanceCommand(String objectType, Long objectId); }
wcharczuk/advent
pkg/intcode/op_halt.go
package intcode var ( _ Instruction = (*Halt)(nil) ) // Halt is an instruction. type Halt struct{} // Name returns the name. It is part of Instruction. func (op Halt) Name() string { return "halt" } // OpCode returns the op code. It is part of Instruction. func (op Halt) OpCode() int { return OpHalt } // Width returns the number of words. It is part of Instruction. func (op Halt) Width() int { return 1 } // Action implements the body of the instruction. It is part of Instruction. func (op Halt) Action(c *Computer) (err error) { return ErrHalt }
maksym-taranukhin/lightning-transformers
lightning_transformers/core/callback.py
# Copyright The PyTorch Lightning team. # # 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. import time import torch from pytorch_lightning import Callback from pytorch_lightning.utilities import rank_zero_info class CUDACallback(Callback): def on_train_epoch_start(self, trainer, pl_module): # Reset the memory use counter torch.cuda.reset_peak_memory_stats(trainer.root_gpu) torch.cuda.synchronize(trainer.root_gpu) self.start_time = time.time() def on_train_epoch_end(self, trainer, pl_module, outputs): torch.cuda.synchronize(trainer.root_gpu) max_memory = torch.cuda.max_memory_allocated(trainer.root_gpu) / 2**20 epoch_time = time.time() - self.start_time max_memory = trainer.training_type_plugin.reduce(max_memory) epoch_time = trainer.training_type_plugin.reduce(epoch_time) rank_zero_info(f"Average Epoch time: {epoch_time:.2f} seconds") rank_zero_info(f"Average Peak memory {max_memory:.2f}MiB")
Petramuthoni/E-Funeral-Admin
app/src/main/java/com/freddygenicho/sample/mpesa/Model/Bookings.java
<filename>app/src/main/java/com/freddygenicho/sample/mpesa/Model/Bookings.java<gh_stars>1-10 package com.freddygenicho.sample.mpesa.Model; public class Bookings { private String bookingdate,date,hearsedescription,hearsename,name,phone,pid,time; public Bookings() { } @Override public String toString() { return "Bookings{" + "bookingdate='" + bookingdate + '\'' + ", date='" + date + '\'' + ", hearsedescription='" + hearsedescription + '\'' + ", hearsename='" + hearsename + '\'' + ", name='" + name + '\'' + ", phone='" + phone + '\'' + ", pid='" + pid + '\'' + ", time='" + time + '\'' + '}'; } public Bookings(String bookingdate, String date, String hearsedescription, String hearsename, String name, String phone, String pid, String time) { this.bookingdate = bookingdate; this.date = date; this.hearsedescription = hearsedescription; this.hearsename = hearsename; this.name = name; this.phone = phone; this.pid = pid; this.time = time; } public String getBookingdate() { return bookingdate; } public void setBookingdate(String bookingdate) { this.bookingdate = bookingdate; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getHearsedescription() { return hearsedescription; } public void setHearsedescription(String hearsedescription) { this.hearsedescription = hearsedescription; } public String getHearsename() { return hearsename; } public void setHearsename(String hearsename) { this.hearsename = hearsename; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPid() { return pid; } public void setPid(String pid) { this.pid = pid; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } }
nabtodaemon/unabto
src/modules/log/android/unabto_logging_android.c
/* * Copyright (C) 2008-2013 Nabto - All Rights Reserved. */ #include <stdio.h> #include <string.h> #include <modules/log/unabto_basename.h> #include <unabto_logging_defines.h> #include "unabto_logging_android.h" #define ANDROID_LOG_BUFFER_SIZE 256 char log_buffer_temp[ANDROID_LOG_BUFFER_SIZE]; uint16_t log_buffer_level; uint16_t unabto_android_map_log_level(uint16_t loglevel) { switch (loglevel) { case NABTO_LOG_SEVERITY_FATAL: return ANDROID_LOG_FATAL; case NABTO_LOG_SEVERITY_ERROR: return ANDROID_LOG_ERROR; case NABTO_LOG_SEVERITY_WARN: return ANDROID_LOG_WARN; case NABTO_LOG_SEVERITY_INFO: return ANDROID_LOG_INFO; case NABTO_LOG_SEVERITY_DEBUG: return ANDROID_LOG_DEBUG; default: return ANDROID_LOG_VERBOSE; } } void unabto_android_log_start(uint16_t loglevel, const char *file, unsigned int line) { log_buffer_level = unabto_android_map_log_level(loglevel); snprintf(log_buffer_temp, ANDROID_LOG_BUFFER_SIZE, "%s(%u):", unabto_basename(file), (line)); } void unabto_android_log_end(const char* format, ...) { char buffer[ANDROID_LOG_BUFFER_SIZE]; va_list args; va_start(args, format); vsnprintf(buffer, ANDROID_LOG_BUFFER_SIZE, format, args); va_end(args); __android_log_print(log_buffer_level, UNABTO_TAG, "%s %s", log_buffer_temp, buffer); } void log_buffer(const uint8_t *buf, size_t buflen) { size_t i, j; size_t linenums = (buflen + 15) / 16; for (i = 0; i < linenums; i++) { size_t len = 0; memset(log_buffer_temp, 0, sizeof(log_buffer_temp)); len += snprintf(log_buffer_temp + len, ANDROID_LOG_BUFFER_SIZE, "%02x ", (unsigned int)i * 16); for (j = 0; j < 16 && i * 16 + j < buflen; j++) { len += snprintf(log_buffer_temp + len, ANDROID_LOG_BUFFER_SIZE, "%02x", buf[i * 16 + j]); if (j < 15) { len += snprintf(log_buffer_temp + len, ANDROID_LOG_BUFFER_SIZE, " "); } } __android_log_print(ANDROID_LOG_INFO, UNABTO_TAG, "%s", log_buffer_temp); } }
JimmyBeldone/reapt
src/views/features/UserRegister/components/RegisterForm/index.js
import React, { Component } from "react"; import PropTypes from "prop-types"; import { connect } from "react-redux"; import { Link } from "react-router-dom"; import { Trans, NamespacesConsumer } from "react-i18next"; import isEmpty from "validator/lib/isEmpty"; import isEmail from "validator/lib/isEmail"; import equals from "validator/lib/equals"; import { configRegister } from "../../config"; import InputGroup from "../../../../components/default/InputGroup/InputGroup"; import { registerUser } from "../../actions"; const mapStateToProps = state => ({ registerError: state.errors }); const mapDispatchToProps = dispatch => ({ registerUser: UserData => dispatch(registerUser(UserData)) }); class RegisterForm extends Component { static propTypes = { registerUser: PropTypes.func.isRequired, registerError: PropTypes.object.isRequired }; state = { hasError: false, errorField: "", errorMessage: "" }; handleSubmit(e) { e.preventDefault(); const { registerUser } = this.props; // eslint-disable-next-line react/no-string-refs const fields = this.refs; const errors = []; const name = fields["input-username"].input; const email = fields["input-email"].input; const password = fields["input-password"].input; const passwordConfirm = fields["input-passwordConfirm"].input; Object.values(fields).filter(field => { const { value } = field.input; if (isEmpty(value)) { errors.push({ hasError: true, errorField: field.input.getAttribute("lib"), errorMessage: "errors.emptyField" }); } }); if (!isEmail(email.value)) { errors.push({ hasError: true, errorField: email.getAttribute("lib"), errorMessage: "errors.invalidEmail" }); } if (!equals(password.value, passwordConfirm.value)) { errors.push({ hasError: true, errorField: passwordConfirm.getAttribute("lib"), errorMessage: "errors.notIdentical" }); } if (errors.length !== 0) { this.setState(errors[0]); } else { this.setState({ hasError: false, errorField: "", errorMessage: "" }); const UserData = { name: name.value.trim(), email: email.value.trim(), password: password.value.<PASSWORD>() }; registerUser(UserData); } } renderFields() { const { errorField } = this.state; return configRegister.fields.map(field => ( <InputGroup key={`register-input-${field.name}`} ref={`input-${field.name}`} name={field.name} type={field.type} label={field.lib} errorField={errorField} withIntl /> )); } render() { const { hasError, errorField, errorMessage } = this.state; const { registerError } = this.props; return ( <form noValidate onSubmit={this.handleSubmit.bind(this)}> {this.renderFields()} <div className="error-message"> {registerError || hasError ? ( <NamespacesConsumer> {t => ( <Trans i18nKey={errorMessage} values={{ field: t(errorField) }} /> )} </NamespacesConsumer> ) : null} </div> <button className="btn" type="submit"> <Trans i18nKey={configRegister.formBtn} /> </button> <div className="login-link"> <Trans i18nKey={configRegister.link.text} /> <br /> <Link to={configRegister.loginPath}> <Trans i18nKey={configRegister.link.button} /> </Link> </div> </form> ); } } export default connect( mapStateToProps, mapDispatchToProps )(RegisterForm);
evenmarbles/rlpy
rlpy/agent/mdp/action.py
import weakref import numpy as np from ...framework.observer import Observable, Listener from .primitive import Primitive, MDPPrimitive __all__ = ['MDPAction'] class MDPAction(MDPPrimitive): """ """ class StateActionData(object): """ """ def __init__(self): self.count = 0 self.cumulative_reward = 0 self.effect_counts = {} """:type: dict[Primitive, int]""" self.observers = weakref.WeakSet() """:type: set[StateActionModel]""" class StateActionModel(Observable, Listener): """ """ _instance = object() @property def state(self): return self._approx.state @property def reward(self): return self._parent._maxval if self._sum < self._parent._threshold else self._reward @property def effects_map(self): """ Returns ------- dict[Primitive, double] """ return {} if self._sum < self._parent._threshold else self._effects_map def __init__(self, token, parent, approx): if token is not self._instance: raise ValueError("Use 'create' to construct {0}".format(self.__class__.__name__)) super(MDPAction.StateActionModel, self).__init__() self._parent = parent """:type: MDPAction""" self._approx = approx """:type: Approximation""" self._sum = 0.0 self._reward = 0.0 self._translation = {} """:type: dict[MDPState, StateActionData]""" self._effects_map = {} """:type: dict[Primitive, double]""" def __repr__(self): return self._mid @classmethod def create(cls, parent, approx): result = cls(cls._instance, parent, approx) parent._models[approx.state] = result result._approx.subscribe(result, 'average_change') result.compute_model() return result def notify(self, event): if event.name == 'average_change': self._parent._inbox.add(self) def compute_model(self): self._sum = 0.0 self._reward = 0.0 self._effects_map = {} instances = self._approx.basis_weights sum_ = 0.0 # remove erstwhile instances for s, sad in self._translation.items(): if s not in instances.keys(): sad.observers.discard(self) del self._translation[s] for s, (w, proba) in instances.iteritems(): try: data = self._translation[s] except KeyError: data = self._parent._get_data(s) data.observers.add(self) self._translation[s] = data self._sum += w * data.count sum_ += proba * data.count self._reward += proba * data.cumulative_reward for delta_s, cnt in data.effect_counts.iteritems(): self._effects_map[delta_s] = self._effects_map.get(delta_s, 0.0) + (proba * cnt) # normalize try: self._reward /= sum_ except ZeroDivisionError: self._reward = np.NaN for delta_s in self._effects_map.iterkeys(): self._effects_map[delta_s] /= sum_ if self._sum > self._parent._threshold: self.dispatch('model_change') # ----------------------------- # MDPAction # ----------------------------- @property def approximator(self): return self._approximator def __init__(self, token, features, threshold, maxval, approximator, name=None): super(MDPAction, self).__init__(token, features, name) self._threshold = threshold self._maxval = maxval self._approximator = approximator """:type: Approximator""" self._precondition = None self._data = {} """:type: dict[MDPState, StateActionData]""" self._models = weakref.WeakValueDictionary() """:type: dict[MDPState, StateActionModel]""" self._inbox = weakref.WeakSet() """:type: set[StateActionModel]""" # noinspection PyMethodOverriding @classmethod def create(cls, features, threshold, maxval, modelapproximator, name=None, feature_limits=None): features = cls._process_parameters(features, feature_limits) return cls(cls._instance, features, threshold, maxval, modelapproximator, name) def available(self, state): return True def terminal(self, state): return True def policy(self, state): return None def model(self, state): """ Parameters ---------- state Returns ------- StateActionModel """ approx = self._approximator.approximate(state, self) try: m = self._models[approx.state] except KeyError: m = MDPAction.StateActionModel.create(self, approx) assert state in self._models assert m == self._models[state] return m def propagate_changes(self): for i in self._inbox: i.compute_model() self._inbox.clear() def initialize(self): self._approximator.initialize() def update(self, state, reward, succ=None): """Incorporate an experience to update the model Parameters ---------- state : MDPState The state at which the MDP action was executed reward : float The immediate reward obtained succ : MDPState, optional The successor state observed """ dat = self._get_data(self._approximator.add_basis(state, self, succ)) if succ is not None: effect = Primitive(succ - state) dat.effect_counts[effect] = dat.effect_counts.get(effect, 0) + 1 dat.count += 1 dat.cumulative_reward += reward for o in dat.observers: self._inbox.add(o) def _get_data(self, state): """Fetches or creates a data structure for recording the observed data for a given state (with this MDP action). Parameters ---------- state : MDPState A state whose data to fetch. Returns ------- StateActionData : A StateActionData that contains all known data at the given state for this MDP action. """ return self._data.setdefault(state, MDPAction.StateActionData())
benbrunton/pusoy-dos-ui
src/game_utils.js
<gh_stars>1-10 export function getHandDescription(move) { const type = move.type; const hand = move.cards; let joker = false; switch (type) { case 'single': joker = hand.is_joker; return `${hand.rank} of ${hand.suit}${joker ? ' (Joker)' : ''}`; break; case 'pair': case 'prial': joker = hand.some(card => card.is_joker); return `${type} of ${hand[0].rank}${hand[0].rank === 'six' ? 'es' : 's'}${joker ? ' (Joker)' : ''}`; break; case 'fivecardtrick': switch (hand.trick_type) { case 'flush': joker = hand.cards.some(card => card.is_joker); return `${hand.cards[0].suit} flush${joker ? ' (Joker)' : ''}`; break; case 'fullhouse': joker = hand.cards.some(card => card.is_joker); return `Full House${joker ? ' (Joker)' : ''}`; break; case 'fourofakind': joker = hand.cards.some(card => card.is_joker); return `Four of a Kind${joker ? ' (Joker)' : ''}`; break; default: joker = hand.cards.some(card => card.is_joker); return `${type}${joker ? ' (Joker)' : ''}`; break; } break; default: return type; } }
dkudriavtsev/Cheddar
test/tests/Expression/Cast.js
var TestCheddarFrom = require('../globals').TestCheddarFrom; var chai = require('chai'); chai.should(); describe('Casts', function() { describe('String', function() { describe('Number', function() { it('should not error', TestCheddarFrom.Code( `String::123`, '' )) }) describe('Array', function() { it('should not error', TestCheddarFrom.Code( `String::[1, 2, 3]`, '' )) }) }) describe('Number', function() { describe('String', function() { it('should not error', TestCheddarFrom.Code( `Number::"123"`, '' )) }) describe('Boolean', function() { it('true should not error', TestCheddarFrom.Code( `Number::true`, '' )) it('false should not error', TestCheddarFrom.Code( `Number::false`, '' )) }) }) describe('as', function() { it('should work', TestCheddarFrom.Code( `print 123 as String`, '123' )) }); });
anchorimageanalysis/anchor
anchor-spatial/src/test/java/org/anchoranalysis/spatial/point/PointTest.java
<gh_stars>0 /*- * #%L * anchor-core * %% * Copyright (C) 2010 - 2020 <NAME>, ETH Zurich, University of Zurich, Hoffmann-La Roche * %% * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * #L% */ package org.anchoranalysis.spatial.point; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; /** * Tests different types of {@code Point} classes, and particularly their interaction. * * @author <NAME> */ class PointTest { /** Is a point equal to another object of <b><i>same type</i> with same values</b>? */ @Test void testEqualsSameType() { assertEquals(create2d(), create2d()); assertEquals(create2f(), create2f()); assertEquals(create3d(), create3d()); assertEquals(create3f(), create3f()); assertEquals(create3i(), create3i()); assertEquals(create2i(), create2i()); } /** Is a point equal to another object of <b><i>different</i> type with same values</b>? */ @Test void testEqualsDifferentType() { // At present, different types are not allowed be equal assertNotEquals(create2d(), create2f()); assertNotEquals(create3d(), create3f()); assertEquals(PointConverter.floatFromDouble(create2d()), create2f()); assertEquals(PointConverter.floatFromDouble(create3d()), create3f()); } private static Point2f create2f() { return new Point2f(-3.1f, 4.2f); } private static Point2d create2d() { return new Point2d(-3.1, 4.2); } private static Point2i create2i() { return new Point2i(-3, 4); } private static Point3d create3d() { return new Point3d(-3.1, 4.2, 6.3); } private static Point3i create3i() { return new Point3i(-3, 4, 6); } private static Point3f create3f() { return new Point3f(-3.1f, 4.2f, 6.3f); } }
silentghoul-spec/Fuzzing-ext4
fs/ext4/e2fsprogs/lib/ext2fs/symlink.c
/* * symlink.c --- make a symlink in the filesystem, based on mkdir.c * * Copyright (c) 2012, Intel Corporation. * All Rights Reserved. * * %Begin-Header% * This file may be redistributed under the terms of the GNU Library * General Public License, version 2. * %End-Header% */ #include "config.h" #include <stdio.h> #include <string.h> #if HAVE_UNISTD_H #include <unistd.h> #endif #include <fcntl.h> #include <time.h> #if HAVE_SYS_STAT_H #include <sys/stat.h> #endif #if HAVE_SYS_TYPES_H #include <sys/types.h> #endif #include "ext2_fs.h" #include "ext2fs.h" #ifndef HAVE_STRNLEN /* * Incredibly, libc5 doesn't appear to have strnlen. So we have to * provide our own. */ static int my_strnlen(const char * s, int count) { const char *cp = s; while (count-- && *cp) cp++; return cp - s; } #define strnlen(str, x) my_strnlen((str),(x)) #endif errcode_t ext2fs_symlink(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t ino, const char *name, const char *target) { errcode_t retval; struct ext2_inode inode; ext2_ino_t scratch_ino; blk64_t blk; int fastlink, inlinelink; unsigned int target_len; char *block_buf = 0; EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); /* * The Linux kernel doesn't allow for links longer than a block * (counting the NUL terminator) */ target_len = strnlen(target, fs->blocksize + 1); if (target_len >= fs->blocksize) { retval = EXT2_ET_INVALID_ARGUMENT; goto cleanup; } /* * Allocate a data block for slow links */ retval = ext2fs_get_mem(fs->blocksize, &block_buf); if (retval) goto cleanup; memset(block_buf, 0, fs->blocksize); strncpy(block_buf, target, fs->blocksize); memset(&inode, 0, sizeof(struct ext2_inode)); fastlink = (target_len < sizeof(inode.i_block)); if (!fastlink) { retval = ext2fs_new_block2(fs, ext2fs_find_inode_goal(fs, ino, &inode, 0), NULL, &blk); if (retval) goto cleanup; } /* * Allocate an inode, if necessary */ if (!ino) { retval = ext2fs_new_inode(fs, parent, LINUX_S_IFLNK | 0755, 0, &ino); if (retval) goto cleanup; } /* * Create the inode structure.... */ inode.i_mode = LINUX_S_IFLNK | 0777; inode.i_uid = inode.i_gid = 0; inode.i_links_count = 1; ext2fs_inode_size_set(fs, &inode, target_len); /* The time fields are set by ext2fs_write_new_inode() */ inlinelink = !fastlink && ext2fs_has_feature_inline_data(fs->super); if (fastlink) { /* Fast symlinks, target stored in inode */ strcpy((char *)&inode.i_block, target); } else if (inlinelink) { /* Try inserting an inline data symlink */ inode.i_flags |= EXT4_INLINE_DATA_FL; retval = ext2fs_write_new_inode(fs, ino, &inode); if (retval) goto cleanup; retval = ext2fs_inline_data_set(fs, ino, &inode, block_buf, target_len); if (retval) { inode.i_flags &= ~EXT4_INLINE_DATA_FL; inlinelink = 0; goto need_block; } retval = ext2fs_read_inode(fs, ino, &inode); if (retval) goto cleanup; } else { need_block: /* Slow symlinks, target stored in the first block */ ext2fs_iblk_set(fs, &inode, 1); if (ext2fs_has_feature_extents(fs->super)) { /* * The extent bmap is setup after the inode and block * have been written out below. */ inode.i_flags |= EXT4_EXTENTS_FL; } } /* * Write out the inode and inode data block. The inode generation * number is assigned by write_new_inode, which means that the * operations using ino must come after it. */ if (inlinelink) retval = ext2fs_write_inode(fs, ino, &inode); else retval = ext2fs_write_new_inode(fs, ino, &inode); if (retval) goto cleanup; if (!fastlink && !inlinelink) { retval = ext2fs_bmap2(fs, ino, &inode, NULL, BMAP_SET, 0, NULL, &blk); if (retval) goto cleanup; retval = io_channel_write_blk64(fs->io, blk, 1, block_buf); if (retval) goto cleanup; } /* * Link the symlink into the filesystem hierarchy */ if (name) { retval = ext2fs_lookup(fs, parent, name, strlen(name), 0, &scratch_ino); if (!retval) { retval = EXT2_ET_FILE_EXISTS; goto cleanup; } if (retval != EXT2_ET_FILE_NOT_FOUND) goto cleanup; retval = ext2fs_link(fs, parent, name, ino, EXT2_FT_SYMLINK); if (retval) goto cleanup; } /* * Update accounting.... */ if (!fastlink && !inlinelink) ext2fs_block_alloc_stats2(fs, blk, +1); ext2fs_inode_alloc_stats2(fs, ino, +1, 0); cleanup: if (block_buf) ext2fs_free_mem(&block_buf); return retval; } /* * Test whether an inode is a fast symlink. * * A fast symlink has its symlink data stored in inode->i_block. */ int ext2fs_is_fast_symlink(struct ext2_inode *inode) { return LINUX_S_ISLNK(inode->i_mode) && EXT2_I_SIZE(inode) && EXT2_I_SIZE(inode) < sizeof(inode->i_block); }
rubedos/l4t_R32.5.1_viper
kernel/kernel-4.9/drivers/media/dvb-frontends/drxk_hard.c
/* * drxk_hard: DRX-K DVB-C/T demodulator driver * * Copyright (C) 2010-2011 Digital Devices GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 only, as published by the Free Software Foundation. * * * 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., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA * Or, point your browser to http://www.gnu.org/copyleft/gpl.html */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/kernel.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/firmware.h> #include <linux/i2c.h> #include <linux/hardirq.h> #include <asm/div64.h> #include "dvb_frontend.h" #include "drxk.h" #include "drxk_hard.h" #include "dvb_math.h" static int power_down_dvbt(struct drxk_state *state, bool set_power_mode); static int power_down_qam(struct drxk_state *state); static int set_dvbt_standard(struct drxk_state *state, enum operation_mode o_mode); static int set_qam_standard(struct drxk_state *state, enum operation_mode o_mode); static int set_qam(struct drxk_state *state, u16 intermediate_freqk_hz, s32 tuner_freq_offset); static int set_dvbt_standard(struct drxk_state *state, enum operation_mode o_mode); static int dvbt_start(struct drxk_state *state); static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz, s32 tuner_freq_offset); static int get_qam_lock_status(struct drxk_state *state, u32 *p_lock_status); static int get_dvbt_lock_status(struct drxk_state *state, u32 *p_lock_status); static int switch_antenna_to_qam(struct drxk_state *state); static int switch_antenna_to_dvbt(struct drxk_state *state); static bool is_dvbt(struct drxk_state *state) { return state->m_operation_mode == OM_DVBT; } static bool is_qam(struct drxk_state *state) { return state->m_operation_mode == OM_QAM_ITU_A || state->m_operation_mode == OM_QAM_ITU_B || state->m_operation_mode == OM_QAM_ITU_C; } #define NOA1ROM 0 #define DRXDAP_FASI_SHORT_FORMAT(addr) (((addr) & 0xFC30FF80) == 0) #define DRXDAP_FASI_LONG_FORMAT(addr) (((addr) & 0xFC30FF80) != 0) #define DEFAULT_MER_83 165 #define DEFAULT_MER_93 250 #ifndef DRXK_MPEG_SERIAL_OUTPUT_PIN_DRIVE_STRENGTH #define DRXK_MPEG_SERIAL_OUTPUT_PIN_DRIVE_STRENGTH (0x02) #endif #ifndef DRXK_MPEG_PARALLEL_OUTPUT_PIN_DRIVE_STRENGTH #define DRXK_MPEG_PARALLEL_OUTPUT_PIN_DRIVE_STRENGTH (0x03) #endif #define DEFAULT_DRXK_MPEG_LOCK_TIMEOUT 700 #define DEFAULT_DRXK_DEMOD_LOCK_TIMEOUT 500 #ifndef DRXK_KI_RAGC_ATV #define DRXK_KI_RAGC_ATV 4 #endif #ifndef DRXK_KI_IAGC_ATV #define DRXK_KI_IAGC_ATV 6 #endif #ifndef DRXK_KI_DAGC_ATV #define DRXK_KI_DAGC_ATV 7 #endif #ifndef DRXK_KI_RAGC_QAM #define DRXK_KI_RAGC_QAM 3 #endif #ifndef DRXK_KI_IAGC_QAM #define DRXK_KI_IAGC_QAM 4 #endif #ifndef DRXK_KI_DAGC_QAM #define DRXK_KI_DAGC_QAM 7 #endif #ifndef DRXK_KI_RAGC_DVBT #define DRXK_KI_RAGC_DVBT (IsA1WithPatchCode(state) ? 3 : 2) #endif #ifndef DRXK_KI_IAGC_DVBT #define DRXK_KI_IAGC_DVBT (IsA1WithPatchCode(state) ? 4 : 2) #endif #ifndef DRXK_KI_DAGC_DVBT #define DRXK_KI_DAGC_DVBT (IsA1WithPatchCode(state) ? 10 : 7) #endif #ifndef DRXK_AGC_DAC_OFFSET #define DRXK_AGC_DAC_OFFSET (0x800) #endif #ifndef DRXK_BANDWIDTH_8MHZ_IN_HZ #define DRXK_BANDWIDTH_8MHZ_IN_HZ (0x8B8249L) #endif #ifndef DRXK_BANDWIDTH_7MHZ_IN_HZ #define DRXK_BANDWIDTH_7MHZ_IN_HZ (0x7A1200L) #endif #ifndef DRXK_BANDWIDTH_6MHZ_IN_HZ #define DRXK_BANDWIDTH_6MHZ_IN_HZ (0x68A1B6L) #endif #ifndef DRXK_QAM_SYMBOLRATE_MAX #define DRXK_QAM_SYMBOLRATE_MAX (7233000) #endif #define DRXK_BL_ROM_OFFSET_TAPS_DVBT 56 #define DRXK_BL_ROM_OFFSET_TAPS_ITU_A 64 #define DRXK_BL_ROM_OFFSET_TAPS_ITU_C 0x5FE0 #define DRXK_BL_ROM_OFFSET_TAPS_BG 24 #define DRXK_BL_ROM_OFFSET_TAPS_DKILLP 32 #define DRXK_BL_ROM_OFFSET_TAPS_NTSC 40 #define DRXK_BL_ROM_OFFSET_TAPS_FM 48 #define DRXK_BL_ROM_OFFSET_UCODE 0 #define DRXK_BLC_TIMEOUT 100 #define DRXK_BLCC_NR_ELEMENTS_TAPS 2 #define DRXK_BLCC_NR_ELEMENTS_UCODE 6 #define DRXK_BLDC_NR_ELEMENTS_TAPS 28 #ifndef DRXK_OFDM_NE_NOTCH_WIDTH #define DRXK_OFDM_NE_NOTCH_WIDTH (4) #endif #define DRXK_QAM_SL_SIG_POWER_QAM16 (40960) #define DRXK_QAM_SL_SIG_POWER_QAM32 (20480) #define DRXK_QAM_SL_SIG_POWER_QAM64 (43008) #define DRXK_QAM_SL_SIG_POWER_QAM128 (20992) #define DRXK_QAM_SL_SIG_POWER_QAM256 (43520) static unsigned int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "enable debug messages"); #define dprintk(level, fmt, arg...) do { \ if (debug >= level) \ printk(KERN_DEBUG KBUILD_MODNAME ": %s " fmt, __func__, ##arg); \ } while (0) static inline u32 MulDiv32(u32 a, u32 b, u32 c) { u64 tmp64; tmp64 = (u64) a * (u64) b; do_div(tmp64, c); return (u32) tmp64; } static inline u32 Frac28a(u32 a, u32 c) { int i = 0; u32 Q1 = 0; u32 R0 = 0; R0 = (a % c) << 4; /* 32-28 == 4 shifts possible at max */ Q1 = a / c; /* * integer part, only the 4 least significant * bits will be visible in the result */ /* division using radix 16, 7 nibbles in the result */ for (i = 0; i < 7; i++) { Q1 = (Q1 << 4) | (R0 / c); R0 = (R0 % c) << 4; } /* rounding */ if ((R0 >> 3) >= c) Q1++; return Q1; } static inline u32 log10times100(u32 value) { return (100L * intlog10(value)) >> 24; } /****************************************************************************/ /* I2C **********************************************************************/ /****************************************************************************/ static int drxk_i2c_lock(struct drxk_state *state) { i2c_lock_adapter(state->i2c); state->drxk_i2c_exclusive_lock = true; return 0; } static void drxk_i2c_unlock(struct drxk_state *state) { if (!state->drxk_i2c_exclusive_lock) return; i2c_unlock_adapter(state->i2c); state->drxk_i2c_exclusive_lock = false; } static int drxk_i2c_transfer(struct drxk_state *state, struct i2c_msg *msgs, unsigned len) { if (state->drxk_i2c_exclusive_lock) return __i2c_transfer(state->i2c, msgs, len); else return i2c_transfer(state->i2c, msgs, len); } static int i2c_read1(struct drxk_state *state, u8 adr, u8 *val) { struct i2c_msg msgs[1] = { {.addr = adr, .flags = I2C_M_RD, .buf = val, .len = 1} }; return drxk_i2c_transfer(state, msgs, 1); } static int i2c_write(struct drxk_state *state, u8 adr, u8 *data, int len) { int status; struct i2c_msg msg = { .addr = adr, .flags = 0, .buf = data, .len = len }; dprintk(3, ":"); if (debug > 2) { int i; for (i = 0; i < len; i++) pr_cont(" %02x", data[i]); pr_cont("\n"); } status = drxk_i2c_transfer(state, &msg, 1); if (status >= 0 && status != 1) status = -EIO; if (status < 0) pr_err("i2c write error at addr 0x%02x\n", adr); return status; } static int i2c_read(struct drxk_state *state, u8 adr, u8 *msg, int len, u8 *answ, int alen) { int status; struct i2c_msg msgs[2] = { {.addr = adr, .flags = 0, .buf = msg, .len = len}, {.addr = adr, .flags = I2C_M_RD, .buf = answ, .len = alen} }; status = drxk_i2c_transfer(state, msgs, 2); if (status != 2) { if (debug > 2) pr_cont(": ERROR!\n"); if (status >= 0) status = -EIO; pr_err("i2c read error at addr 0x%02x\n", adr); return status; } if (debug > 2) { int i; dprintk(2, ": read from"); for (i = 0; i < len; i++) pr_cont(" %02x", msg[i]); pr_cont(", value = "); for (i = 0; i < alen; i++) pr_cont(" %02x", answ[i]); pr_cont("\n"); } return 0; } static int read16_flags(struct drxk_state *state, u32 reg, u16 *data, u8 flags) { int status; u8 adr = state->demod_address, mm1[4], mm2[2], len; if (state->single_master) flags |= 0xC0; if (DRXDAP_FASI_LONG_FORMAT(reg) || (flags != 0)) { mm1[0] = (((reg << 1) & 0xFF) | 0x01); mm1[1] = ((reg >> 16) & 0xFF); mm1[2] = ((reg >> 24) & 0xFF) | flags; mm1[3] = ((reg >> 7) & 0xFF); len = 4; } else { mm1[0] = ((reg << 1) & 0xFF); mm1[1] = (((reg >> 16) & 0x0F) | ((reg >> 18) & 0xF0)); len = 2; } dprintk(2, "(0x%08x, 0x%02x)\n", reg, flags); status = i2c_read(state, adr, mm1, len, mm2, 2); if (status < 0) return status; if (data) *data = mm2[0] | (mm2[1] << 8); return 0; } static int read16(struct drxk_state *state, u32 reg, u16 *data) { return read16_flags(state, reg, data, 0); } static int read32_flags(struct drxk_state *state, u32 reg, u32 *data, u8 flags) { int status; u8 adr = state->demod_address, mm1[4], mm2[4], len; if (state->single_master) flags |= 0xC0; if (DRXDAP_FASI_LONG_FORMAT(reg) || (flags != 0)) { mm1[0] = (((reg << 1) & 0xFF) | 0x01); mm1[1] = ((reg >> 16) & 0xFF); mm1[2] = ((reg >> 24) & 0xFF) | flags; mm1[3] = ((reg >> 7) & 0xFF); len = 4; } else { mm1[0] = ((reg << 1) & 0xFF); mm1[1] = (((reg >> 16) & 0x0F) | ((reg >> 18) & 0xF0)); len = 2; } dprintk(2, "(0x%08x, 0x%02x)\n", reg, flags); status = i2c_read(state, adr, mm1, len, mm2, 4); if (status < 0) return status; if (data) *data = mm2[0] | (mm2[1] << 8) | (mm2[2] << 16) | (mm2[3] << 24); return 0; } static int read32(struct drxk_state *state, u32 reg, u32 *data) { return read32_flags(state, reg, data, 0); } static int write16_flags(struct drxk_state *state, u32 reg, u16 data, u8 flags) { u8 adr = state->demod_address, mm[6], len; if (state->single_master) flags |= 0xC0; if (DRXDAP_FASI_LONG_FORMAT(reg) || (flags != 0)) { mm[0] = (((reg << 1) & 0xFF) | 0x01); mm[1] = ((reg >> 16) & 0xFF); mm[2] = ((reg >> 24) & 0xFF) | flags; mm[3] = ((reg >> 7) & 0xFF); len = 4; } else { mm[0] = ((reg << 1) & 0xFF); mm[1] = (((reg >> 16) & 0x0F) | ((reg >> 18) & 0xF0)); len = 2; } mm[len] = data & 0xff; mm[len + 1] = (data >> 8) & 0xff; dprintk(2, "(0x%08x, 0x%04x, 0x%02x)\n", reg, data, flags); return i2c_write(state, adr, mm, len + 2); } static int write16(struct drxk_state *state, u32 reg, u16 data) { return write16_flags(state, reg, data, 0); } static int write32_flags(struct drxk_state *state, u32 reg, u32 data, u8 flags) { u8 adr = state->demod_address, mm[8], len; if (state->single_master) flags |= 0xC0; if (DRXDAP_FASI_LONG_FORMAT(reg) || (flags != 0)) { mm[0] = (((reg << 1) & 0xFF) | 0x01); mm[1] = ((reg >> 16) & 0xFF); mm[2] = ((reg >> 24) & 0xFF) | flags; mm[3] = ((reg >> 7) & 0xFF); len = 4; } else { mm[0] = ((reg << 1) & 0xFF); mm[1] = (((reg >> 16) & 0x0F) | ((reg >> 18) & 0xF0)); len = 2; } mm[len] = data & 0xff; mm[len + 1] = (data >> 8) & 0xff; mm[len + 2] = (data >> 16) & 0xff; mm[len + 3] = (data >> 24) & 0xff; dprintk(2, "(0x%08x, 0x%08x, 0x%02x)\n", reg, data, flags); return i2c_write(state, adr, mm, len + 4); } static int write32(struct drxk_state *state, u32 reg, u32 data) { return write32_flags(state, reg, data, 0); } static int write_block(struct drxk_state *state, u32 address, const int block_size, const u8 p_block[]) { int status = 0, blk_size = block_size; u8 flags = 0; if (state->single_master) flags |= 0xC0; while (blk_size > 0) { int chunk = blk_size > state->m_chunk_size ? state->m_chunk_size : blk_size; u8 *adr_buf = &state->chunk[0]; u32 adr_length = 0; if (DRXDAP_FASI_LONG_FORMAT(address) || (flags != 0)) { adr_buf[0] = (((address << 1) & 0xFF) | 0x01); adr_buf[1] = ((address >> 16) & 0xFF); adr_buf[2] = ((address >> 24) & 0xFF); adr_buf[3] = ((address >> 7) & 0xFF); adr_buf[2] |= flags; adr_length = 4; if (chunk == state->m_chunk_size) chunk -= 2; } else { adr_buf[0] = ((address << 1) & 0xFF); adr_buf[1] = (((address >> 16) & 0x0F) | ((address >> 18) & 0xF0)); adr_length = 2; } memcpy(&state->chunk[adr_length], p_block, chunk); dprintk(2, "(0x%08x, 0x%02x)\n", address, flags); if (debug > 1) { int i; if (p_block) for (i = 0; i < chunk; i++) pr_cont(" %02x", p_block[i]); pr_cont("\n"); } status = i2c_write(state, state->demod_address, &state->chunk[0], chunk + adr_length); if (status < 0) { pr_err("%s: i2c write error at addr 0x%02x\n", __func__, address); break; } p_block += chunk; address += (chunk >> 1); blk_size -= chunk; } return status; } #ifndef DRXK_MAX_RETRIES_POWERUP #define DRXK_MAX_RETRIES_POWERUP 20 #endif static int power_up_device(struct drxk_state *state) { int status; u8 data = 0; u16 retry_count = 0; dprintk(1, "\n"); status = i2c_read1(state, state->demod_address, &data); if (status < 0) { do { data = 0; status = i2c_write(state, state->demod_address, &data, 1); usleep_range(10000, 11000); retry_count++; if (status < 0) continue; status = i2c_read1(state, state->demod_address, &data); } while (status < 0 && (retry_count < DRXK_MAX_RETRIES_POWERUP)); if (status < 0 && retry_count >= DRXK_MAX_RETRIES_POWERUP) goto error; } /* Make sure all clk domains are active */ status = write16(state, SIO_CC_PWD_MODE__A, SIO_CC_PWD_MODE_LEVEL_NONE); if (status < 0) goto error; status = write16(state, SIO_CC_UPDATE__A, SIO_CC_UPDATE_KEY); if (status < 0) goto error; /* Enable pll lock tests */ status = write16(state, SIO_CC_PLL_LOCK__A, 1); if (status < 0) goto error; state->m_current_power_mode = DRX_POWER_UP; error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int init_state(struct drxk_state *state) { /* * FIXME: most (all?) of the values below should be moved into * struct drxk_config, as they are probably board-specific */ u32 ul_vsb_if_agc_mode = DRXK_AGC_CTRL_AUTO; u32 ul_vsb_if_agc_output_level = 0; u32 ul_vsb_if_agc_min_level = 0; u32 ul_vsb_if_agc_max_level = 0x7FFF; u32 ul_vsb_if_agc_speed = 3; u32 ul_vsb_rf_agc_mode = DRXK_AGC_CTRL_AUTO; u32 ul_vsb_rf_agc_output_level = 0; u32 ul_vsb_rf_agc_min_level = 0; u32 ul_vsb_rf_agc_max_level = 0x7FFF; u32 ul_vsb_rf_agc_speed = 3; u32 ul_vsb_rf_agc_top = 9500; u32 ul_vsb_rf_agc_cut_off_current = 4000; u32 ul_atv_if_agc_mode = DRXK_AGC_CTRL_AUTO; u32 ul_atv_if_agc_output_level = 0; u32 ul_atv_if_agc_min_level = 0; u32 ul_atv_if_agc_max_level = 0; u32 ul_atv_if_agc_speed = 3; u32 ul_atv_rf_agc_mode = DRXK_AGC_CTRL_OFF; u32 ul_atv_rf_agc_output_level = 0; u32 ul_atv_rf_agc_min_level = 0; u32 ul_atv_rf_agc_max_level = 0; u32 ul_atv_rf_agc_top = 9500; u32 ul_atv_rf_agc_cut_off_current = 4000; u32 ul_atv_rf_agc_speed = 3; u32 ulQual83 = DEFAULT_MER_83; u32 ulQual93 = DEFAULT_MER_93; u32 ul_mpeg_lock_time_out = DEFAULT_DRXK_MPEG_LOCK_TIMEOUT; u32 ul_demod_lock_time_out = DEFAULT_DRXK_DEMOD_LOCK_TIMEOUT; /* io_pad_cfg register (8 bit reg.) MSB bit is 1 (default value) */ /* io_pad_cfg_mode output mode is drive always */ /* io_pad_cfg_drive is set to power 2 (23 mA) */ u32 ul_gpio_cfg = 0x0113; u32 ul_invert_ts_clock = 0; u32 ul_ts_data_strength = DRXK_MPEG_SERIAL_OUTPUT_PIN_DRIVE_STRENGTH; u32 ul_dvbt_bitrate = 50000000; u32 ul_dvbc_bitrate = DRXK_QAM_SYMBOLRATE_MAX * 8; u32 ul_insert_rs_byte = 0; u32 ul_rf_mirror = 1; u32 ul_power_down = 0; dprintk(1, "\n"); state->m_has_lna = false; state->m_has_dvbt = false; state->m_has_dvbc = false; state->m_has_atv = false; state->m_has_oob = false; state->m_has_audio = false; if (!state->m_chunk_size) state->m_chunk_size = 124; state->m_osc_clock_freq = 0; state->m_smart_ant_inverted = false; state->m_b_p_down_open_bridge = false; /* real system clock frequency in kHz */ state->m_sys_clock_freq = 151875; /* Timing div, 250ns/Psys */ /* Timing div, = (delay (nano seconds) * sysclk (kHz))/ 1000 */ state->m_hi_cfg_timing_div = ((state->m_sys_clock_freq / 1000) * HI_I2C_DELAY) / 1000; /* Clipping */ if (state->m_hi_cfg_timing_div > SIO_HI_RA_RAM_PAR_2_CFG_DIV__M) state->m_hi_cfg_timing_div = SIO_HI_RA_RAM_PAR_2_CFG_DIV__M; state->m_hi_cfg_wake_up_key = (state->demod_address << 1); /* port/bridge/power down ctrl */ state->m_hi_cfg_ctrl = SIO_HI_RA_RAM_PAR_5_CFG_SLV0_SLAVE; state->m_b_power_down = (ul_power_down != 0); state->m_drxk_a3_patch_code = false; /* Init AGC and PGA parameters */ /* VSB IF */ state->m_vsb_if_agc_cfg.ctrl_mode = ul_vsb_if_agc_mode; state->m_vsb_if_agc_cfg.output_level = ul_vsb_if_agc_output_level; state->m_vsb_if_agc_cfg.min_output_level = ul_vsb_if_agc_min_level; state->m_vsb_if_agc_cfg.max_output_level = ul_vsb_if_agc_max_level; state->m_vsb_if_agc_cfg.speed = ul_vsb_if_agc_speed; state->m_vsb_pga_cfg = 140; /* VSB RF */ state->m_vsb_rf_agc_cfg.ctrl_mode = ul_vsb_rf_agc_mode; state->m_vsb_rf_agc_cfg.output_level = ul_vsb_rf_agc_output_level; state->m_vsb_rf_agc_cfg.min_output_level = ul_vsb_rf_agc_min_level; state->m_vsb_rf_agc_cfg.max_output_level = ul_vsb_rf_agc_max_level; state->m_vsb_rf_agc_cfg.speed = ul_vsb_rf_agc_speed; state->m_vsb_rf_agc_cfg.top = ul_vsb_rf_agc_top; state->m_vsb_rf_agc_cfg.cut_off_current = ul_vsb_rf_agc_cut_off_current; state->m_vsb_pre_saw_cfg.reference = 0x07; state->m_vsb_pre_saw_cfg.use_pre_saw = true; state->m_Quality83percent = DEFAULT_MER_83; state->m_Quality93percent = DEFAULT_MER_93; if (ulQual93 <= 500 && ulQual83 < ulQual93) { state->m_Quality83percent = ulQual83; state->m_Quality93percent = ulQual93; } /* ATV IF */ state->m_atv_if_agc_cfg.ctrl_mode = ul_atv_if_agc_mode; state->m_atv_if_agc_cfg.output_level = ul_atv_if_agc_output_level; state->m_atv_if_agc_cfg.min_output_level = ul_atv_if_agc_min_level; state->m_atv_if_agc_cfg.max_output_level = ul_atv_if_agc_max_level; state->m_atv_if_agc_cfg.speed = ul_atv_if_agc_speed; /* ATV RF */ state->m_atv_rf_agc_cfg.ctrl_mode = ul_atv_rf_agc_mode; state->m_atv_rf_agc_cfg.output_level = ul_atv_rf_agc_output_level; state->m_atv_rf_agc_cfg.min_output_level = ul_atv_rf_agc_min_level; state->m_atv_rf_agc_cfg.max_output_level = ul_atv_rf_agc_max_level; state->m_atv_rf_agc_cfg.speed = ul_atv_rf_agc_speed; state->m_atv_rf_agc_cfg.top = ul_atv_rf_agc_top; state->m_atv_rf_agc_cfg.cut_off_current = ul_atv_rf_agc_cut_off_current; state->m_atv_pre_saw_cfg.reference = 0x04; state->m_atv_pre_saw_cfg.use_pre_saw = true; /* DVBT RF */ state->m_dvbt_rf_agc_cfg.ctrl_mode = DRXK_AGC_CTRL_OFF; state->m_dvbt_rf_agc_cfg.output_level = 0; state->m_dvbt_rf_agc_cfg.min_output_level = 0; state->m_dvbt_rf_agc_cfg.max_output_level = 0xFFFF; state->m_dvbt_rf_agc_cfg.top = 0x2100; state->m_dvbt_rf_agc_cfg.cut_off_current = 4000; state->m_dvbt_rf_agc_cfg.speed = 1; /* DVBT IF */ state->m_dvbt_if_agc_cfg.ctrl_mode = DRXK_AGC_CTRL_AUTO; state->m_dvbt_if_agc_cfg.output_level = 0; state->m_dvbt_if_agc_cfg.min_output_level = 0; state->m_dvbt_if_agc_cfg.max_output_level = 9000; state->m_dvbt_if_agc_cfg.top = 13424; state->m_dvbt_if_agc_cfg.cut_off_current = 0; state->m_dvbt_if_agc_cfg.speed = 3; state->m_dvbt_if_agc_cfg.fast_clip_ctrl_delay = 30; state->m_dvbt_if_agc_cfg.ingain_tgt_max = 30000; /* state->m_dvbtPgaCfg = 140; */ state->m_dvbt_pre_saw_cfg.reference = 4; state->m_dvbt_pre_saw_cfg.use_pre_saw = false; /* QAM RF */ state->m_qam_rf_agc_cfg.ctrl_mode = DRXK_AGC_CTRL_OFF; state->m_qam_rf_agc_cfg.output_level = 0; state->m_qam_rf_agc_cfg.min_output_level = 6023; state->m_qam_rf_agc_cfg.max_output_level = 27000; state->m_qam_rf_agc_cfg.top = 0x2380; state->m_qam_rf_agc_cfg.cut_off_current = 4000; state->m_qam_rf_agc_cfg.speed = 3; /* QAM IF */ state->m_qam_if_agc_cfg.ctrl_mode = DRXK_AGC_CTRL_AUTO; state->m_qam_if_agc_cfg.output_level = 0; state->m_qam_if_agc_cfg.min_output_level = 0; state->m_qam_if_agc_cfg.max_output_level = 9000; state->m_qam_if_agc_cfg.top = 0x0511; state->m_qam_if_agc_cfg.cut_off_current = 0; state->m_qam_if_agc_cfg.speed = 3; state->m_qam_if_agc_cfg.ingain_tgt_max = 5119; state->m_qam_if_agc_cfg.fast_clip_ctrl_delay = 50; state->m_qam_pga_cfg = 140; state->m_qam_pre_saw_cfg.reference = 4; state->m_qam_pre_saw_cfg.use_pre_saw = false; state->m_operation_mode = OM_NONE; state->m_drxk_state = DRXK_UNINITIALIZED; /* MPEG output configuration */ state->m_enable_mpeg_output = true; /* If TRUE; enable MPEG ouput */ state->m_insert_rs_byte = false; /* If TRUE; insert RS byte */ state->m_invert_data = false; /* If TRUE; invert DATA signals */ state->m_invert_err = false; /* If TRUE; invert ERR signal */ state->m_invert_str = false; /* If TRUE; invert STR signals */ state->m_invert_val = false; /* If TRUE; invert VAL signals */ state->m_invert_clk = (ul_invert_ts_clock != 0); /* If TRUE; invert CLK signals */ /* If TRUE; static MPEG clockrate will be used; otherwise clockrate will adapt to the bitrate of the TS */ state->m_dvbt_bitrate = ul_dvbt_bitrate; state->m_dvbc_bitrate = ul_dvbc_bitrate; state->m_ts_data_strength = (ul_ts_data_strength & 0x07); /* Maximum bitrate in b/s in case static clockrate is selected */ state->m_mpeg_ts_static_bitrate = 19392658; state->m_disable_te_ihandling = false; if (ul_insert_rs_byte) state->m_insert_rs_byte = true; state->m_mpeg_lock_time_out = DEFAULT_DRXK_MPEG_LOCK_TIMEOUT; if (ul_mpeg_lock_time_out < 10000) state->m_mpeg_lock_time_out = ul_mpeg_lock_time_out; state->m_demod_lock_time_out = DEFAULT_DRXK_DEMOD_LOCK_TIMEOUT; if (ul_demod_lock_time_out < 10000) state->m_demod_lock_time_out = ul_demod_lock_time_out; /* QAM defaults */ state->m_constellation = DRX_CONSTELLATION_AUTO; state->m_qam_interleave_mode = DRXK_QAM_I12_J17; state->m_fec_rs_plen = 204 * 8; /* fecRsPlen annex A */ state->m_fec_rs_prescale = 1; state->m_sqi_speed = DRXK_DVBT_SQI_SPEED_MEDIUM; state->m_agcfast_clip_ctrl_delay = 0; state->m_gpio_cfg = ul_gpio_cfg; state->m_b_power_down = false; state->m_current_power_mode = DRX_POWER_DOWN; state->m_rfmirror = (ul_rf_mirror == 0); state->m_if_agc_pol = false; return 0; } static int drxx_open(struct drxk_state *state) { int status = 0; u32 jtag = 0; u16 bid = 0; u16 key = 0; dprintk(1, "\n"); /* stop lock indicator process */ status = write16(state, SCU_RAM_GPIO__A, SCU_RAM_GPIO_HW_LOCK_IND_DISABLE); if (status < 0) goto error; /* Check device id */ status = read16(state, SIO_TOP_COMM_KEY__A, &key); if (status < 0) goto error; status = write16(state, SIO_TOP_COMM_KEY__A, SIO_TOP_COMM_KEY_KEY); if (status < 0) goto error; status = read32(state, SIO_TOP_JTAGID_LO__A, &jtag); if (status < 0) goto error; status = read16(state, SIO_PDR_UIO_IN_HI__A, &bid); if (status < 0) goto error; status = write16(state, SIO_TOP_COMM_KEY__A, key); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int get_device_capabilities(struct drxk_state *state) { u16 sio_pdr_ohw_cfg = 0; u32 sio_top_jtagid_lo = 0; int status; const char *spin = ""; dprintk(1, "\n"); /* driver 0.9.0 */ /* stop lock indicator process */ status = write16(state, SCU_RAM_GPIO__A, SCU_RAM_GPIO_HW_LOCK_IND_DISABLE); if (status < 0) goto error; status = write16(state, SIO_TOP_COMM_KEY__A, SIO_TOP_COMM_KEY_KEY); if (status < 0) goto error; status = read16(state, SIO_PDR_OHW_CFG__A, &sio_pdr_ohw_cfg); if (status < 0) goto error; status = write16(state, SIO_TOP_COMM_KEY__A, 0x0000); if (status < 0) goto error; switch ((sio_pdr_ohw_cfg & SIO_PDR_OHW_CFG_FREF_SEL__M)) { case 0: /* ignore (bypass ?) */ break; case 1: /* 27 MHz */ state->m_osc_clock_freq = 27000; break; case 2: /* 20.25 MHz */ state->m_osc_clock_freq = 20250; break; case 3: /* 4 MHz */ state->m_osc_clock_freq = 20250; break; default: pr_err("Clock Frequency is unknown\n"); return -EINVAL; } /* Determine device capabilities Based on pinning v14 */ status = read32(state, SIO_TOP_JTAGID_LO__A, &sio_top_jtagid_lo); if (status < 0) goto error; pr_info("status = 0x%08x\n", sio_top_jtagid_lo); /* driver 0.9.0 */ switch ((sio_top_jtagid_lo >> 29) & 0xF) { case 0: state->m_device_spin = DRXK_SPIN_A1; spin = "A1"; break; case 2: state->m_device_spin = DRXK_SPIN_A2; spin = "A2"; break; case 3: state->m_device_spin = DRXK_SPIN_A3; spin = "A3"; break; default: state->m_device_spin = DRXK_SPIN_UNKNOWN; status = -EINVAL; pr_err("Spin %d unknown\n", (sio_top_jtagid_lo >> 29) & 0xF); goto error2; } switch ((sio_top_jtagid_lo >> 12) & 0xFF) { case 0x13: /* typeId = DRX3913K_TYPE_ID */ state->m_has_lna = false; state->m_has_oob = false; state->m_has_atv = false; state->m_has_audio = false; state->m_has_dvbt = true; state->m_has_dvbc = true; state->m_has_sawsw = true; state->m_has_gpio2 = false; state->m_has_gpio1 = false; state->m_has_irqn = false; break; case 0x15: /* typeId = DRX3915K_TYPE_ID */ state->m_has_lna = false; state->m_has_oob = false; state->m_has_atv = true; state->m_has_audio = false; state->m_has_dvbt = true; state->m_has_dvbc = false; state->m_has_sawsw = true; state->m_has_gpio2 = true; state->m_has_gpio1 = true; state->m_has_irqn = false; break; case 0x16: /* typeId = DRX3916K_TYPE_ID */ state->m_has_lna = false; state->m_has_oob = false; state->m_has_atv = true; state->m_has_audio = false; state->m_has_dvbt = true; state->m_has_dvbc = false; state->m_has_sawsw = true; state->m_has_gpio2 = true; state->m_has_gpio1 = true; state->m_has_irqn = false; break; case 0x18: /* typeId = DRX3918K_TYPE_ID */ state->m_has_lna = false; state->m_has_oob = false; state->m_has_atv = true; state->m_has_audio = true; state->m_has_dvbt = true; state->m_has_dvbc = false; state->m_has_sawsw = true; state->m_has_gpio2 = true; state->m_has_gpio1 = true; state->m_has_irqn = false; break; case 0x21: /* typeId = DRX3921K_TYPE_ID */ state->m_has_lna = false; state->m_has_oob = false; state->m_has_atv = true; state->m_has_audio = true; state->m_has_dvbt = true; state->m_has_dvbc = true; state->m_has_sawsw = true; state->m_has_gpio2 = true; state->m_has_gpio1 = true; state->m_has_irqn = false; break; case 0x23: /* typeId = DRX3923K_TYPE_ID */ state->m_has_lna = false; state->m_has_oob = false; state->m_has_atv = true; state->m_has_audio = true; state->m_has_dvbt = true; state->m_has_dvbc = true; state->m_has_sawsw = true; state->m_has_gpio2 = true; state->m_has_gpio1 = true; state->m_has_irqn = false; break; case 0x25: /* typeId = DRX3925K_TYPE_ID */ state->m_has_lna = false; state->m_has_oob = false; state->m_has_atv = true; state->m_has_audio = true; state->m_has_dvbt = true; state->m_has_dvbc = true; state->m_has_sawsw = true; state->m_has_gpio2 = true; state->m_has_gpio1 = true; state->m_has_irqn = false; break; case 0x26: /* typeId = DRX3926K_TYPE_ID */ state->m_has_lna = false; state->m_has_oob = false; state->m_has_atv = true; state->m_has_audio = false; state->m_has_dvbt = true; state->m_has_dvbc = true; state->m_has_sawsw = true; state->m_has_gpio2 = true; state->m_has_gpio1 = true; state->m_has_irqn = false; break; default: pr_err("DeviceID 0x%02x not supported\n", ((sio_top_jtagid_lo >> 12) & 0xFF)); status = -EINVAL; goto error2; } pr_info("detected a drx-39%02xk, spin %s, xtal %d.%03d MHz\n", ((sio_top_jtagid_lo >> 12) & 0xFF), spin, state->m_osc_clock_freq / 1000, state->m_osc_clock_freq % 1000); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); error2: return status; } static int hi_command(struct drxk_state *state, u16 cmd, u16 *p_result) { int status; bool powerdown_cmd; dprintk(1, "\n"); /* Write command */ status = write16(state, SIO_HI_RA_RAM_CMD__A, cmd); if (status < 0) goto error; if (cmd == SIO_HI_RA_RAM_CMD_RESET) usleep_range(1000, 2000); powerdown_cmd = (bool) ((cmd == SIO_HI_RA_RAM_CMD_CONFIG) && ((state->m_hi_cfg_ctrl) & SIO_HI_RA_RAM_PAR_5_CFG_SLEEP__M) == SIO_HI_RA_RAM_PAR_5_CFG_SLEEP_ZZZ); if (!powerdown_cmd) { /* Wait until command rdy */ u32 retry_count = 0; u16 wait_cmd; do { usleep_range(1000, 2000); retry_count += 1; status = read16(state, SIO_HI_RA_RAM_CMD__A, &wait_cmd); } while ((status < 0) && (retry_count < DRXK_MAX_RETRIES) && (wait_cmd != 0)); if (status < 0) goto error; status = read16(state, SIO_HI_RA_RAM_RES__A, p_result); } error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int hi_cfg_command(struct drxk_state *state) { int status; dprintk(1, "\n"); mutex_lock(&state->mutex); status = write16(state, SIO_HI_RA_RAM_PAR_6__A, state->m_hi_cfg_timeout); if (status < 0) goto error; status = write16(state, SIO_HI_RA_RAM_PAR_5__A, state->m_hi_cfg_ctrl); if (status < 0) goto error; status = write16(state, SIO_HI_RA_RAM_PAR_4__A, state->m_hi_cfg_wake_up_key); if (status < 0) goto error; status = write16(state, SIO_HI_RA_RAM_PAR_3__A, state->m_hi_cfg_bridge_delay); if (status < 0) goto error; status = write16(state, SIO_HI_RA_RAM_PAR_2__A, state->m_hi_cfg_timing_div); if (status < 0) goto error; status = write16(state, SIO_HI_RA_RAM_PAR_1__A, SIO_HI_RA_RAM_PAR_1_PAR1_SEC_KEY); if (status < 0) goto error; status = hi_command(state, SIO_HI_RA_RAM_CMD_CONFIG, NULL); if (status < 0) goto error; state->m_hi_cfg_ctrl &= ~SIO_HI_RA_RAM_PAR_5_CFG_SLEEP_ZZZ; error: mutex_unlock(&state->mutex); if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int init_hi(struct drxk_state *state) { dprintk(1, "\n"); state->m_hi_cfg_wake_up_key = (state->demod_address << 1); state->m_hi_cfg_timeout = 0x96FF; /* port/bridge/power down ctrl */ state->m_hi_cfg_ctrl = SIO_HI_RA_RAM_PAR_5_CFG_SLV0_SLAVE; return hi_cfg_command(state); } static int mpegts_configure_pins(struct drxk_state *state, bool mpeg_enable) { int status = -1; u16 sio_pdr_mclk_cfg = 0; u16 sio_pdr_mdx_cfg = 0; u16 err_cfg = 0; dprintk(1, ": mpeg %s, %s mode\n", mpeg_enable ? "enable" : "disable", state->m_enable_parallel ? "parallel" : "serial"); /* stop lock indicator process */ status = write16(state, SCU_RAM_GPIO__A, SCU_RAM_GPIO_HW_LOCK_IND_DISABLE); if (status < 0) goto error; /* MPEG TS pad configuration */ status = write16(state, SIO_TOP_COMM_KEY__A, SIO_TOP_COMM_KEY_KEY); if (status < 0) goto error; if (!mpeg_enable) { /* Set MPEG TS pads to inputmode */ status = write16(state, SIO_PDR_MSTRT_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MERR_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MCLK_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MVAL_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD0_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD1_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD2_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD3_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD4_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD5_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD6_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD7_CFG__A, 0x0000); if (status < 0) goto error; } else { /* Enable MPEG output */ sio_pdr_mdx_cfg = ((state->m_ts_data_strength << SIO_PDR_MD0_CFG_DRIVE__B) | 0x0003); sio_pdr_mclk_cfg = ((state->m_ts_clockk_strength << SIO_PDR_MCLK_CFG_DRIVE__B) | 0x0003); status = write16(state, SIO_PDR_MSTRT_CFG__A, sio_pdr_mdx_cfg); if (status < 0) goto error; if (state->enable_merr_cfg) err_cfg = sio_pdr_mdx_cfg; status = write16(state, SIO_PDR_MERR_CFG__A, err_cfg); if (status < 0) goto error; status = write16(state, SIO_PDR_MVAL_CFG__A, err_cfg); if (status < 0) goto error; if (state->m_enable_parallel) { /* parallel -> enable MD1 to MD7 */ status = write16(state, SIO_PDR_MD1_CFG__A, sio_pdr_mdx_cfg); if (status < 0) goto error; status = write16(state, SIO_PDR_MD2_CFG__A, sio_pdr_mdx_cfg); if (status < 0) goto error; status = write16(state, SIO_PDR_MD3_CFG__A, sio_pdr_mdx_cfg); if (status < 0) goto error; status = write16(state, SIO_PDR_MD4_CFG__A, sio_pdr_mdx_cfg); if (status < 0) goto error; status = write16(state, SIO_PDR_MD5_CFG__A, sio_pdr_mdx_cfg); if (status < 0) goto error; status = write16(state, SIO_PDR_MD6_CFG__A, sio_pdr_mdx_cfg); if (status < 0) goto error; status = write16(state, SIO_PDR_MD7_CFG__A, sio_pdr_mdx_cfg); if (status < 0) goto error; } else { sio_pdr_mdx_cfg = ((state->m_ts_data_strength << SIO_PDR_MD0_CFG_DRIVE__B) | 0x0003); /* serial -> disable MD1 to MD7 */ status = write16(state, SIO_PDR_MD1_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD2_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD3_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD4_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD5_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD6_CFG__A, 0x0000); if (status < 0) goto error; status = write16(state, SIO_PDR_MD7_CFG__A, 0x0000); if (status < 0) goto error; } status = write16(state, SIO_PDR_MCLK_CFG__A, sio_pdr_mclk_cfg); if (status < 0) goto error; status = write16(state, SIO_PDR_MD0_CFG__A, sio_pdr_mdx_cfg); if (status < 0) goto error; } /* Enable MB output over MPEG pads and ctl input */ status = write16(state, SIO_PDR_MON_CFG__A, 0x0000); if (status < 0) goto error; /* Write nomagic word to enable pdr reg write */ status = write16(state, SIO_TOP_COMM_KEY__A, 0x0000); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int mpegts_disable(struct drxk_state *state) { dprintk(1, "\n"); return mpegts_configure_pins(state, false); } static int bl_chain_cmd(struct drxk_state *state, u16 rom_offset, u16 nr_of_elements, u32 time_out) { u16 bl_status = 0; int status; unsigned long end; dprintk(1, "\n"); mutex_lock(&state->mutex); status = write16(state, SIO_BL_MODE__A, SIO_BL_MODE_CHAIN); if (status < 0) goto error; status = write16(state, SIO_BL_CHAIN_ADDR__A, rom_offset); if (status < 0) goto error; status = write16(state, SIO_BL_CHAIN_LEN__A, nr_of_elements); if (status < 0) goto error; status = write16(state, SIO_BL_ENABLE__A, SIO_BL_ENABLE_ON); if (status < 0) goto error; end = jiffies + msecs_to_jiffies(time_out); do { usleep_range(1000, 2000); status = read16(state, SIO_BL_STATUS__A, &bl_status); if (status < 0) goto error; } while ((bl_status == 0x1) && ((time_is_after_jiffies(end)))); if (bl_status == 0x1) { pr_err("SIO not ready\n"); status = -EINVAL; goto error2; } error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); error2: mutex_unlock(&state->mutex); return status; } static int download_microcode(struct drxk_state *state, const u8 p_mc_image[], u32 length) { const u8 *p_src = p_mc_image; u32 address; u16 n_blocks; u16 block_size; u32 offset = 0; u32 i; int status = 0; dprintk(1, "\n"); /* down the drain (we don't care about MAGIC_WORD) */ #if 0 /* For future reference */ drain = (p_src[0] << 8) | p_src[1]; #endif p_src += sizeof(u16); offset += sizeof(u16); n_blocks = (p_src[0] << 8) | p_src[1]; p_src += sizeof(u16); offset += sizeof(u16); for (i = 0; i < n_blocks; i += 1) { address = (p_src[0] << 24) | (p_src[1] << 16) | (p_src[2] << 8) | p_src[3]; p_src += sizeof(u32); offset += sizeof(u32); block_size = ((p_src[0] << 8) | p_src[1]) * sizeof(u16); p_src += sizeof(u16); offset += sizeof(u16); #if 0 /* For future reference */ flags = (p_src[0] << 8) | p_src[1]; #endif p_src += sizeof(u16); offset += sizeof(u16); #if 0 /* For future reference */ block_crc = (p_src[0] << 8) | p_src[1]; #endif p_src += sizeof(u16); offset += sizeof(u16); if (offset + block_size > length) { pr_err("Firmware is corrupted.\n"); return -EINVAL; } status = write_block(state, address, block_size, p_src); if (status < 0) { pr_err("Error %d while loading firmware\n", status); break; } p_src += block_size; offset += block_size; } return status; } static int dvbt_enable_ofdm_token_ring(struct drxk_state *state, bool enable) { int status; u16 data = 0; u16 desired_ctrl = SIO_OFDM_SH_OFDM_RING_ENABLE_ON; u16 desired_status = SIO_OFDM_SH_OFDM_RING_STATUS_ENABLED; unsigned long end; dprintk(1, "\n"); if (!enable) { desired_ctrl = SIO_OFDM_SH_OFDM_RING_ENABLE_OFF; desired_status = SIO_OFDM_SH_OFDM_RING_STATUS_DOWN; } status = read16(state, SIO_OFDM_SH_OFDM_RING_STATUS__A, &data); if (status >= 0 && data == desired_status) { /* tokenring already has correct status */ return status; } /* Disable/enable dvbt tokenring bridge */ status = write16(state, SIO_OFDM_SH_OFDM_RING_ENABLE__A, desired_ctrl); end = jiffies + msecs_to_jiffies(DRXK_OFDM_TR_SHUTDOWN_TIMEOUT); do { status = read16(state, SIO_OFDM_SH_OFDM_RING_STATUS__A, &data); if ((status >= 0 && data == desired_status) || time_is_after_jiffies(end)) break; usleep_range(1000, 2000); } while (1); if (data != desired_status) { pr_err("SIO not ready\n"); return -EINVAL; } return status; } static int mpegts_stop(struct drxk_state *state) { int status = 0; u16 fec_oc_snc_mode = 0; u16 fec_oc_ipr_mode = 0; dprintk(1, "\n"); /* Graceful shutdown (byte boundaries) */ status = read16(state, FEC_OC_SNC_MODE__A, &fec_oc_snc_mode); if (status < 0) goto error; fec_oc_snc_mode |= FEC_OC_SNC_MODE_SHUTDOWN__M; status = write16(state, FEC_OC_SNC_MODE__A, fec_oc_snc_mode); if (status < 0) goto error; /* Suppress MCLK during absence of data */ status = read16(state, FEC_OC_IPR_MODE__A, &fec_oc_ipr_mode); if (status < 0) goto error; fec_oc_ipr_mode |= FEC_OC_IPR_MODE_MCLK_DIS_DAT_ABS__M; status = write16(state, FEC_OC_IPR_MODE__A, fec_oc_ipr_mode); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int scu_command(struct drxk_state *state, u16 cmd, u8 parameter_len, u16 *parameter, u8 result_len, u16 *result) { #if (SCU_RAM_PARAM_0__A - SCU_RAM_PARAM_15__A) != 15 #error DRXK register mapping no longer compatible with this routine! #endif u16 cur_cmd = 0; int status = -EINVAL; unsigned long end; u8 buffer[34]; int cnt = 0, ii; const char *p; char errname[30]; dprintk(1, "\n"); if ((cmd == 0) || ((parameter_len > 0) && (parameter == NULL)) || ((result_len > 0) && (result == NULL))) { pr_err("Error %d on %s\n", status, __func__); return status; } mutex_lock(&state->mutex); /* assume that the command register is ready since it is checked afterwards */ for (ii = parameter_len - 1; ii >= 0; ii -= 1) { buffer[cnt++] = (parameter[ii] & 0xFF); buffer[cnt++] = ((parameter[ii] >> 8) & 0xFF); } buffer[cnt++] = (cmd & 0xFF); buffer[cnt++] = ((cmd >> 8) & 0xFF); write_block(state, SCU_RAM_PARAM_0__A - (parameter_len - 1), cnt, buffer); /* Wait until SCU has processed command */ end = jiffies + msecs_to_jiffies(DRXK_MAX_WAITTIME); do { usleep_range(1000, 2000); status = read16(state, SCU_RAM_COMMAND__A, &cur_cmd); if (status < 0) goto error; } while (!(cur_cmd == DRX_SCU_READY) && (time_is_after_jiffies(end))); if (cur_cmd != DRX_SCU_READY) { pr_err("SCU not ready\n"); status = -EIO; goto error2; } /* read results */ if ((result_len > 0) && (result != NULL)) { s16 err; int ii; for (ii = result_len - 1; ii >= 0; ii -= 1) { status = read16(state, SCU_RAM_PARAM_0__A - ii, &result[ii]); if (status < 0) goto error; } /* Check if an error was reported by SCU */ err = (s16)result[0]; if (err >= 0) goto error; /* check for the known error codes */ switch (err) { case SCU_RESULT_UNKCMD: p = "SCU_RESULT_UNKCMD"; break; case SCU_RESULT_UNKSTD: p = "SCU_RESULT_UNKSTD"; break; case SCU_RESULT_SIZE: p = "SCU_RESULT_SIZE"; break; case SCU_RESULT_INVPAR: p = "SCU_RESULT_INVPAR"; break; default: /* Other negative values are errors */ sprintf(errname, "ERROR: %d\n", err); p = errname; } pr_err("%s while sending cmd 0x%04x with params:", p, cmd); print_hex_dump_bytes("drxk: ", DUMP_PREFIX_NONE, buffer, cnt); status = -EINVAL; goto error2; } error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); error2: mutex_unlock(&state->mutex); return status; } static int set_iqm_af(struct drxk_state *state, bool active) { u16 data = 0; int status; dprintk(1, "\n"); /* Configure IQM */ status = read16(state, IQM_AF_STDBY__A, &data); if (status < 0) goto error; if (!active) { data |= (IQM_AF_STDBY_STDBY_ADC_STANDBY | IQM_AF_STDBY_STDBY_AMP_STANDBY | IQM_AF_STDBY_STDBY_PD_STANDBY | IQM_AF_STDBY_STDBY_TAGC_IF_STANDBY | IQM_AF_STDBY_STDBY_TAGC_RF_STANDBY); } else { data &= ((~IQM_AF_STDBY_STDBY_ADC_STANDBY) & (~IQM_AF_STDBY_STDBY_AMP_STANDBY) & (~IQM_AF_STDBY_STDBY_PD_STANDBY) & (~IQM_AF_STDBY_STDBY_TAGC_IF_STANDBY) & (~IQM_AF_STDBY_STDBY_TAGC_RF_STANDBY) ); } status = write16(state, IQM_AF_STDBY__A, data); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int ctrl_power_mode(struct drxk_state *state, enum drx_power_mode *mode) { int status = 0; u16 sio_cc_pwd_mode = 0; dprintk(1, "\n"); /* Check arguments */ if (mode == NULL) return -EINVAL; switch (*mode) { case DRX_POWER_UP: sio_cc_pwd_mode = SIO_CC_PWD_MODE_LEVEL_NONE; break; case DRXK_POWER_DOWN_OFDM: sio_cc_pwd_mode = SIO_CC_PWD_MODE_LEVEL_OFDM; break; case DRXK_POWER_DOWN_CORE: sio_cc_pwd_mode = SIO_CC_PWD_MODE_LEVEL_CLOCK; break; case DRXK_POWER_DOWN_PLL: sio_cc_pwd_mode = SIO_CC_PWD_MODE_LEVEL_PLL; break; case DRX_POWER_DOWN: sio_cc_pwd_mode = SIO_CC_PWD_MODE_LEVEL_OSC; break; default: /* Unknow sleep mode */ return -EINVAL; } /* If already in requested power mode, do nothing */ if (state->m_current_power_mode == *mode) return 0; /* For next steps make sure to start from DRX_POWER_UP mode */ if (state->m_current_power_mode != DRX_POWER_UP) { status = power_up_device(state); if (status < 0) goto error; status = dvbt_enable_ofdm_token_ring(state, true); if (status < 0) goto error; } if (*mode == DRX_POWER_UP) { /* Restore analog & pin configuartion */ } else { /* Power down to requested mode */ /* Backup some register settings */ /* Set pins with possible pull-ups connected to them in input mode */ /* Analog power down */ /* ADC power down */ /* Power down device */ /* stop all comm_exec */ /* Stop and power down previous standard */ switch (state->m_operation_mode) { case OM_DVBT: status = mpegts_stop(state); if (status < 0) goto error; status = power_down_dvbt(state, false); if (status < 0) goto error; break; case OM_QAM_ITU_A: case OM_QAM_ITU_C: status = mpegts_stop(state); if (status < 0) goto error; status = power_down_qam(state); if (status < 0) goto error; break; default: break; } status = dvbt_enable_ofdm_token_ring(state, false); if (status < 0) goto error; status = write16(state, SIO_CC_PWD_MODE__A, sio_cc_pwd_mode); if (status < 0) goto error; status = write16(state, SIO_CC_UPDATE__A, SIO_CC_UPDATE_KEY); if (status < 0) goto error; if (*mode != DRXK_POWER_DOWN_OFDM) { state->m_hi_cfg_ctrl |= SIO_HI_RA_RAM_PAR_5_CFG_SLEEP_ZZZ; status = hi_cfg_command(state); if (status < 0) goto error; } } state->m_current_power_mode = *mode; error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int power_down_dvbt(struct drxk_state *state, bool set_power_mode) { enum drx_power_mode power_mode = DRXK_POWER_DOWN_OFDM; u16 cmd_result = 0; u16 data = 0; int status; dprintk(1, "\n"); status = read16(state, SCU_COMM_EXEC__A, &data); if (status < 0) goto error; if (data == SCU_COMM_EXEC_ACTIVE) { /* Send OFDM stop command */ status = scu_command(state, SCU_RAM_COMMAND_STANDARD_OFDM | SCU_RAM_COMMAND_CMD_DEMOD_STOP, 0, NULL, 1, &cmd_result); if (status < 0) goto error; /* Send OFDM reset command */ status = scu_command(state, SCU_RAM_COMMAND_STANDARD_OFDM | SCU_RAM_COMMAND_CMD_DEMOD_RESET, 0, NULL, 1, &cmd_result); if (status < 0) goto error; } /* Reset datapath for OFDM, processors first */ status = write16(state, OFDM_SC_COMM_EXEC__A, OFDM_SC_COMM_EXEC_STOP); if (status < 0) goto error; status = write16(state, OFDM_LC_COMM_EXEC__A, OFDM_LC_COMM_EXEC_STOP); if (status < 0) goto error; status = write16(state, IQM_COMM_EXEC__A, IQM_COMM_EXEC_B_STOP); if (status < 0) goto error; /* powerdown AFE */ status = set_iqm_af(state, false); if (status < 0) goto error; /* powerdown to OFDM mode */ if (set_power_mode) { status = ctrl_power_mode(state, &power_mode); if (status < 0) goto error; } error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int setoperation_mode(struct drxk_state *state, enum operation_mode o_mode) { int status = 0; dprintk(1, "\n"); /* Stop and power down previous standard TODO investigate total power down instead of partial power down depending on "previous" standard. */ /* disable HW lock indicator */ status = write16(state, SCU_RAM_GPIO__A, SCU_RAM_GPIO_HW_LOCK_IND_DISABLE); if (status < 0) goto error; /* Device is already at the required mode */ if (state->m_operation_mode == o_mode) return 0; switch (state->m_operation_mode) { /* OM_NONE was added for start up */ case OM_NONE: break; case OM_DVBT: status = mpegts_stop(state); if (status < 0) goto error; status = power_down_dvbt(state, true); if (status < 0) goto error; state->m_operation_mode = OM_NONE; break; case OM_QAM_ITU_A: /* fallthrough */ case OM_QAM_ITU_C: status = mpegts_stop(state); if (status < 0) goto error; status = power_down_qam(state); if (status < 0) goto error; state->m_operation_mode = OM_NONE; break; case OM_QAM_ITU_B: default: status = -EINVAL; goto error; } /* Power up new standard */ switch (o_mode) { case OM_DVBT: dprintk(1, ": DVB-T\n"); state->m_operation_mode = o_mode; status = set_dvbt_standard(state, o_mode); if (status < 0) goto error; break; case OM_QAM_ITU_A: /* fallthrough */ case OM_QAM_ITU_C: dprintk(1, ": DVB-C Annex %c\n", (state->m_operation_mode == OM_QAM_ITU_A) ? 'A' : 'C'); state->m_operation_mode = o_mode; status = set_qam_standard(state, o_mode); if (status < 0) goto error; break; case OM_QAM_ITU_B: default: status = -EINVAL; } error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int start(struct drxk_state *state, s32 offset_freq, s32 intermediate_frequency) { int status = -EINVAL; u16 i_freqk_hz; s32 offsetk_hz = offset_freq / 1000; dprintk(1, "\n"); if (state->m_drxk_state != DRXK_STOPPED && state->m_drxk_state != DRXK_DTV_STARTED) goto error; state->m_b_mirror_freq_spect = (state->props.inversion == INVERSION_ON); if (intermediate_frequency < 0) { state->m_b_mirror_freq_spect = !state->m_b_mirror_freq_spect; intermediate_frequency = -intermediate_frequency; } switch (state->m_operation_mode) { case OM_QAM_ITU_A: case OM_QAM_ITU_C: i_freqk_hz = (intermediate_frequency / 1000); status = set_qam(state, i_freqk_hz, offsetk_hz); if (status < 0) goto error; state->m_drxk_state = DRXK_DTV_STARTED; break; case OM_DVBT: i_freqk_hz = (intermediate_frequency / 1000); status = mpegts_stop(state); if (status < 0) goto error; status = set_dvbt(state, i_freqk_hz, offsetk_hz); if (status < 0) goto error; status = dvbt_start(state); if (status < 0) goto error; state->m_drxk_state = DRXK_DTV_STARTED; break; default: break; } error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int shut_down(struct drxk_state *state) { dprintk(1, "\n"); mpegts_stop(state); return 0; } static int get_lock_status(struct drxk_state *state, u32 *p_lock_status) { int status = -EINVAL; dprintk(1, "\n"); if (p_lock_status == NULL) goto error; *p_lock_status = NOT_LOCKED; /* define the SCU command code */ switch (state->m_operation_mode) { case OM_QAM_ITU_A: case OM_QAM_ITU_B: case OM_QAM_ITU_C: status = get_qam_lock_status(state, p_lock_status); break; case OM_DVBT: status = get_dvbt_lock_status(state, p_lock_status); break; default: break; } error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int mpegts_start(struct drxk_state *state) { int status; u16 fec_oc_snc_mode = 0; /* Allow OC to sync again */ status = read16(state, FEC_OC_SNC_MODE__A, &fec_oc_snc_mode); if (status < 0) goto error; fec_oc_snc_mode &= ~FEC_OC_SNC_MODE_SHUTDOWN__M; status = write16(state, FEC_OC_SNC_MODE__A, fec_oc_snc_mode); if (status < 0) goto error; status = write16(state, FEC_OC_SNC_UNLOCK__A, 1); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int mpegts_dto_init(struct drxk_state *state) { int status; dprintk(1, "\n"); /* Rate integration settings */ status = write16(state, FEC_OC_RCN_CTL_STEP_LO__A, 0x0000); if (status < 0) goto error; status = write16(state, FEC_OC_RCN_CTL_STEP_HI__A, 0x000C); if (status < 0) goto error; status = write16(state, FEC_OC_RCN_GAIN__A, 0x000A); if (status < 0) goto error; status = write16(state, FEC_OC_AVR_PARM_A__A, 0x0008); if (status < 0) goto error; status = write16(state, FEC_OC_AVR_PARM_B__A, 0x0006); if (status < 0) goto error; status = write16(state, FEC_OC_TMD_HI_MARGIN__A, 0x0680); if (status < 0) goto error; status = write16(state, FEC_OC_TMD_LO_MARGIN__A, 0x0080); if (status < 0) goto error; status = write16(state, FEC_OC_TMD_COUNT__A, 0x03F4); if (status < 0) goto error; /* Additional configuration */ status = write16(state, FEC_OC_OCR_INVERT__A, 0); if (status < 0) goto error; status = write16(state, FEC_OC_SNC_LWM__A, 2); if (status < 0) goto error; status = write16(state, FEC_OC_SNC_HWM__A, 12); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int mpegts_dto_setup(struct drxk_state *state, enum operation_mode o_mode) { int status; u16 fec_oc_reg_mode = 0; /* FEC_OC_MODE register value */ u16 fec_oc_reg_ipr_mode = 0; /* FEC_OC_IPR_MODE register value */ u16 fec_oc_dto_mode = 0; /* FEC_OC_IPR_INVERT register value */ u16 fec_oc_fct_mode = 0; /* FEC_OC_IPR_INVERT register value */ u16 fec_oc_dto_period = 2; /* FEC_OC_IPR_INVERT register value */ u16 fec_oc_dto_burst_len = 188; /* FEC_OC_IPR_INVERT register value */ u32 fec_oc_rcn_ctl_rate = 0; /* FEC_OC_IPR_INVERT register value */ u16 fec_oc_tmd_mode = 0; u16 fec_oc_tmd_int_upd_rate = 0; u32 max_bit_rate = 0; bool static_clk = false; dprintk(1, "\n"); /* Check insertion of the Reed-Solomon parity bytes */ status = read16(state, FEC_OC_MODE__A, &fec_oc_reg_mode); if (status < 0) goto error; status = read16(state, FEC_OC_IPR_MODE__A, &fec_oc_reg_ipr_mode); if (status < 0) goto error; fec_oc_reg_mode &= (~FEC_OC_MODE_PARITY__M); fec_oc_reg_ipr_mode &= (~FEC_OC_IPR_MODE_MVAL_DIS_PAR__M); if (state->m_insert_rs_byte) { /* enable parity symbol forward */ fec_oc_reg_mode |= FEC_OC_MODE_PARITY__M; /* MVAL disable during parity bytes */ fec_oc_reg_ipr_mode |= FEC_OC_IPR_MODE_MVAL_DIS_PAR__M; /* TS burst length to 204 */ fec_oc_dto_burst_len = 204; } /* Check serial or parallel output */ fec_oc_reg_ipr_mode &= (~(FEC_OC_IPR_MODE_SERIAL__M)); if (!state->m_enable_parallel) { /* MPEG data output is serial -> set ipr_mode[0] */ fec_oc_reg_ipr_mode |= FEC_OC_IPR_MODE_SERIAL__M; } switch (o_mode) { case OM_DVBT: max_bit_rate = state->m_dvbt_bitrate; fec_oc_tmd_mode = 3; fec_oc_rcn_ctl_rate = 0xC00000; static_clk = state->m_dvbt_static_clk; break; case OM_QAM_ITU_A: /* fallthrough */ case OM_QAM_ITU_C: fec_oc_tmd_mode = 0x0004; fec_oc_rcn_ctl_rate = 0xD2B4EE; /* good for >63 Mb/s */ max_bit_rate = state->m_dvbc_bitrate; static_clk = state->m_dvbc_static_clk; break; default: status = -EINVAL; } /* switch (standard) */ if (status < 0) goto error; /* Configure DTO's */ if (static_clk) { u32 bit_rate = 0; /* Rational DTO for MCLK source (static MCLK rate), Dynamic DTO for optimal grouping (avoid intra-packet gaps), DTO offset enable to sync TS burst with MSTRT */ fec_oc_dto_mode = (FEC_OC_DTO_MODE_DYNAMIC__M | FEC_OC_DTO_MODE_OFFSET_ENABLE__M); fec_oc_fct_mode = (FEC_OC_FCT_MODE_RAT_ENA__M | FEC_OC_FCT_MODE_VIRT_ENA__M); /* Check user defined bitrate */ bit_rate = max_bit_rate; if (bit_rate > 75900000UL) { /* max is 75.9 Mb/s */ bit_rate = 75900000UL; } /* Rational DTO period: dto_period = (Fsys / bitrate) - 2 result should be floored, to make sure >= requested bitrate */ fec_oc_dto_period = (u16) (((state->m_sys_clock_freq) * 1000) / bit_rate); if (fec_oc_dto_period <= 2) fec_oc_dto_period = 0; else fec_oc_dto_period -= 2; fec_oc_tmd_int_upd_rate = 8; } else { /* (commonAttr->static_clk == false) => dynamic mode */ fec_oc_dto_mode = FEC_OC_DTO_MODE_DYNAMIC__M; fec_oc_fct_mode = FEC_OC_FCT_MODE__PRE; fec_oc_tmd_int_upd_rate = 5; } /* Write appropriate registers with requested configuration */ status = write16(state, FEC_OC_DTO_BURST_LEN__A, fec_oc_dto_burst_len); if (status < 0) goto error; status = write16(state, FEC_OC_DTO_PERIOD__A, fec_oc_dto_period); if (status < 0) goto error; status = write16(state, FEC_OC_DTO_MODE__A, fec_oc_dto_mode); if (status < 0) goto error; status = write16(state, FEC_OC_FCT_MODE__A, fec_oc_fct_mode); if (status < 0) goto error; status = write16(state, FEC_OC_MODE__A, fec_oc_reg_mode); if (status < 0) goto error; status = write16(state, FEC_OC_IPR_MODE__A, fec_oc_reg_ipr_mode); if (status < 0) goto error; /* Rate integration settings */ status = write32(state, FEC_OC_RCN_CTL_RATE_LO__A, fec_oc_rcn_ctl_rate); if (status < 0) goto error; status = write16(state, FEC_OC_TMD_INT_UPD_RATE__A, fec_oc_tmd_int_upd_rate); if (status < 0) goto error; status = write16(state, FEC_OC_TMD_MODE__A, fec_oc_tmd_mode); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int mpegts_configure_polarity(struct drxk_state *state) { u16 fec_oc_reg_ipr_invert = 0; /* Data mask for the output data byte */ u16 invert_data_mask = FEC_OC_IPR_INVERT_MD7__M | FEC_OC_IPR_INVERT_MD6__M | FEC_OC_IPR_INVERT_MD5__M | FEC_OC_IPR_INVERT_MD4__M | FEC_OC_IPR_INVERT_MD3__M | FEC_OC_IPR_INVERT_MD2__M | FEC_OC_IPR_INVERT_MD1__M | FEC_OC_IPR_INVERT_MD0__M; dprintk(1, "\n"); /* Control selective inversion of output bits */ fec_oc_reg_ipr_invert &= (~(invert_data_mask)); if (state->m_invert_data) fec_oc_reg_ipr_invert |= invert_data_mask; fec_oc_reg_ipr_invert &= (~(FEC_OC_IPR_INVERT_MERR__M)); if (state->m_invert_err) fec_oc_reg_ipr_invert |= FEC_OC_IPR_INVERT_MERR__M; fec_oc_reg_ipr_invert &= (~(FEC_OC_IPR_INVERT_MSTRT__M)); if (state->m_invert_str) fec_oc_reg_ipr_invert |= FEC_OC_IPR_INVERT_MSTRT__M; fec_oc_reg_ipr_invert &= (~(FEC_OC_IPR_INVERT_MVAL__M)); if (state->m_invert_val) fec_oc_reg_ipr_invert |= FEC_OC_IPR_INVERT_MVAL__M; fec_oc_reg_ipr_invert &= (~(FEC_OC_IPR_INVERT_MCLK__M)); if (state->m_invert_clk) fec_oc_reg_ipr_invert |= FEC_OC_IPR_INVERT_MCLK__M; return write16(state, FEC_OC_IPR_INVERT__A, fec_oc_reg_ipr_invert); } #define SCU_RAM_AGC_KI_INV_RF_POL__M 0x4000 static int set_agc_rf(struct drxk_state *state, struct s_cfg_agc *p_agc_cfg, bool is_dtv) { int status = -EINVAL; u16 data = 0; struct s_cfg_agc *p_if_agc_settings; dprintk(1, "\n"); if (p_agc_cfg == NULL) goto error; switch (p_agc_cfg->ctrl_mode) { case DRXK_AGC_CTRL_AUTO: /* Enable RF AGC DAC */ status = read16(state, IQM_AF_STDBY__A, &data); if (status < 0) goto error; data &= ~IQM_AF_STDBY_STDBY_TAGC_RF_STANDBY; status = write16(state, IQM_AF_STDBY__A, data); if (status < 0) goto error; status = read16(state, SCU_RAM_AGC_CONFIG__A, &data); if (status < 0) goto error; /* Enable SCU RF AGC loop */ data &= ~SCU_RAM_AGC_CONFIG_DISABLE_RF_AGC__M; /* Polarity */ if (state->m_rf_agc_pol) data |= SCU_RAM_AGC_CONFIG_INV_RF_POL__M; else data &= ~SCU_RAM_AGC_CONFIG_INV_RF_POL__M; status = write16(state, SCU_RAM_AGC_CONFIG__A, data); if (status < 0) goto error; /* Set speed (using complementary reduction value) */ status = read16(state, SCU_RAM_AGC_KI_RED__A, &data); if (status < 0) goto error; data &= ~SCU_RAM_AGC_KI_RED_RAGC_RED__M; data |= (~(p_agc_cfg->speed << SCU_RAM_AGC_KI_RED_RAGC_RED__B) & SCU_RAM_AGC_KI_RED_RAGC_RED__M); status = write16(state, SCU_RAM_AGC_KI_RED__A, data); if (status < 0) goto error; if (is_dvbt(state)) p_if_agc_settings = &state->m_dvbt_if_agc_cfg; else if (is_qam(state)) p_if_agc_settings = &state->m_qam_if_agc_cfg; else p_if_agc_settings = &state->m_atv_if_agc_cfg; if (p_if_agc_settings == NULL) { status = -EINVAL; goto error; } /* Set TOP, only if IF-AGC is in AUTO mode */ if (p_if_agc_settings->ctrl_mode == DRXK_AGC_CTRL_AUTO) { status = write16(state, SCU_RAM_AGC_IF_IACCU_HI_TGT_MAX__A, p_agc_cfg->top); if (status < 0) goto error; } /* Cut-Off current */ status = write16(state, SCU_RAM_AGC_RF_IACCU_HI_CO__A, p_agc_cfg->cut_off_current); if (status < 0) goto error; /* Max. output level */ status = write16(state, SCU_RAM_AGC_RF_MAX__A, p_agc_cfg->max_output_level); if (status < 0) goto error; break; case DRXK_AGC_CTRL_USER: /* Enable RF AGC DAC */ status = read16(state, IQM_AF_STDBY__A, &data); if (status < 0) goto error; data &= ~IQM_AF_STDBY_STDBY_TAGC_RF_STANDBY; status = write16(state, IQM_AF_STDBY__A, data); if (status < 0) goto error; /* Disable SCU RF AGC loop */ status = read16(state, SCU_RAM_AGC_CONFIG__A, &data); if (status < 0) goto error; data |= SCU_RAM_AGC_CONFIG_DISABLE_RF_AGC__M; if (state->m_rf_agc_pol) data |= SCU_RAM_AGC_CONFIG_INV_RF_POL__M; else data &= ~SCU_RAM_AGC_CONFIG_INV_RF_POL__M; status = write16(state, SCU_RAM_AGC_CONFIG__A, data); if (status < 0) goto error; /* SCU c.o.c. to 0, enabling full control range */ status = write16(state, SCU_RAM_AGC_RF_IACCU_HI_CO__A, 0); if (status < 0) goto error; /* Write value to output pin */ status = write16(state, SCU_RAM_AGC_RF_IACCU_HI__A, p_agc_cfg->output_level); if (status < 0) goto error; break; case DRXK_AGC_CTRL_OFF: /* Disable RF AGC DAC */ status = read16(state, IQM_AF_STDBY__A, &data); if (status < 0) goto error; data |= IQM_AF_STDBY_STDBY_TAGC_RF_STANDBY; status = write16(state, IQM_AF_STDBY__A, data); if (status < 0) goto error; /* Disable SCU RF AGC loop */ status = read16(state, SCU_RAM_AGC_CONFIG__A, &data); if (status < 0) goto error; data |= SCU_RAM_AGC_CONFIG_DISABLE_RF_AGC__M; status = write16(state, SCU_RAM_AGC_CONFIG__A, data); if (status < 0) goto error; break; default: status = -EINVAL; } error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } #define SCU_RAM_AGC_KI_INV_IF_POL__M 0x2000 static int set_agc_if(struct drxk_state *state, struct s_cfg_agc *p_agc_cfg, bool is_dtv) { u16 data = 0; int status = 0; struct s_cfg_agc *p_rf_agc_settings; dprintk(1, "\n"); switch (p_agc_cfg->ctrl_mode) { case DRXK_AGC_CTRL_AUTO: /* Enable IF AGC DAC */ status = read16(state, IQM_AF_STDBY__A, &data); if (status < 0) goto error; data &= ~IQM_AF_STDBY_STDBY_TAGC_IF_STANDBY; status = write16(state, IQM_AF_STDBY__A, data); if (status < 0) goto error; status = read16(state, SCU_RAM_AGC_CONFIG__A, &data); if (status < 0) goto error; /* Enable SCU IF AGC loop */ data &= ~SCU_RAM_AGC_CONFIG_DISABLE_IF_AGC__M; /* Polarity */ if (state->m_if_agc_pol) data |= SCU_RAM_AGC_CONFIG_INV_IF_POL__M; else data &= ~SCU_RAM_AGC_CONFIG_INV_IF_POL__M; status = write16(state, SCU_RAM_AGC_CONFIG__A, data); if (status < 0) goto error; /* Set speed (using complementary reduction value) */ status = read16(state, SCU_RAM_AGC_KI_RED__A, &data); if (status < 0) goto error; data &= ~SCU_RAM_AGC_KI_RED_IAGC_RED__M; data |= (~(p_agc_cfg->speed << SCU_RAM_AGC_KI_RED_IAGC_RED__B) & SCU_RAM_AGC_KI_RED_IAGC_RED__M); status = write16(state, SCU_RAM_AGC_KI_RED__A, data); if (status < 0) goto error; if (is_qam(state)) p_rf_agc_settings = &state->m_qam_rf_agc_cfg; else p_rf_agc_settings = &state->m_atv_rf_agc_cfg; if (p_rf_agc_settings == NULL) return -1; /* Restore TOP */ status = write16(state, SCU_RAM_AGC_IF_IACCU_HI_TGT_MAX__A, p_rf_agc_settings->top); if (status < 0) goto error; break; case DRXK_AGC_CTRL_USER: /* Enable IF AGC DAC */ status = read16(state, IQM_AF_STDBY__A, &data); if (status < 0) goto error; data &= ~IQM_AF_STDBY_STDBY_TAGC_IF_STANDBY; status = write16(state, IQM_AF_STDBY__A, data); if (status < 0) goto error; status = read16(state, SCU_RAM_AGC_CONFIG__A, &data); if (status < 0) goto error; /* Disable SCU IF AGC loop */ data |= SCU_RAM_AGC_CONFIG_DISABLE_IF_AGC__M; /* Polarity */ if (state->m_if_agc_pol) data |= SCU_RAM_AGC_CONFIG_INV_IF_POL__M; else data &= ~SCU_RAM_AGC_CONFIG_INV_IF_POL__M; status = write16(state, SCU_RAM_AGC_CONFIG__A, data); if (status < 0) goto error; /* Write value to output pin */ status = write16(state, SCU_RAM_AGC_IF_IACCU_HI_TGT_MAX__A, p_agc_cfg->output_level); if (status < 0) goto error; break; case DRXK_AGC_CTRL_OFF: /* Disable If AGC DAC */ status = read16(state, IQM_AF_STDBY__A, &data); if (status < 0) goto error; data |= IQM_AF_STDBY_STDBY_TAGC_IF_STANDBY; status = write16(state, IQM_AF_STDBY__A, data); if (status < 0) goto error; /* Disable SCU IF AGC loop */ status = read16(state, SCU_RAM_AGC_CONFIG__A, &data); if (status < 0) goto error; data |= SCU_RAM_AGC_CONFIG_DISABLE_IF_AGC__M; status = write16(state, SCU_RAM_AGC_CONFIG__A, data); if (status < 0) goto error; break; } /* switch (agcSettingsIf->ctrl_mode) */ /* always set the top to support configurations without if-loop */ status = write16(state, SCU_RAM_AGC_INGAIN_TGT_MIN__A, p_agc_cfg->top); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int get_qam_signal_to_noise(struct drxk_state *state, s32 *p_signal_to_noise) { int status = 0; u16 qam_sl_err_power = 0; /* accum. error between raw and sliced symbols */ u32 qam_sl_sig_power = 0; /* used for MER, depends of QAM modulation */ u32 qam_sl_mer = 0; /* QAM MER */ dprintk(1, "\n"); /* MER calculation */ /* get the register value needed for MER */ status = read16(state, QAM_SL_ERR_POWER__A, &qam_sl_err_power); if (status < 0) { pr_err("Error %d on %s\n", status, __func__); return -EINVAL; } switch (state->props.modulation) { case QAM_16: qam_sl_sig_power = DRXK_QAM_SL_SIG_POWER_QAM16 << 2; break; case QAM_32: qam_sl_sig_power = DRXK_QAM_SL_SIG_POWER_QAM32 << 2; break; case QAM_64: qam_sl_sig_power = DRXK_QAM_SL_SIG_POWER_QAM64 << 2; break; case QAM_128: qam_sl_sig_power = DRXK_QAM_SL_SIG_POWER_QAM128 << 2; break; default: case QAM_256: qam_sl_sig_power = DRXK_QAM_SL_SIG_POWER_QAM256 << 2; break; } if (qam_sl_err_power > 0) { qam_sl_mer = log10times100(qam_sl_sig_power) - log10times100((u32) qam_sl_err_power); } *p_signal_to_noise = qam_sl_mer; return status; } static int get_dvbt_signal_to_noise(struct drxk_state *state, s32 *p_signal_to_noise) { int status; u16 reg_data = 0; u32 eq_reg_td_sqr_err_i = 0; u32 eq_reg_td_sqr_err_q = 0; u16 eq_reg_td_sqr_err_exp = 0; u16 eq_reg_td_tps_pwr_ofs = 0; u16 eq_reg_td_req_smb_cnt = 0; u32 tps_cnt = 0; u32 sqr_err_iq = 0; u32 a = 0; u32 b = 0; u32 c = 0; u32 i_mer = 0; u16 transmission_params = 0; dprintk(1, "\n"); status = read16(state, OFDM_EQ_TOP_TD_TPS_PWR_OFS__A, &eq_reg_td_tps_pwr_ofs); if (status < 0) goto error; status = read16(state, OFDM_EQ_TOP_TD_REQ_SMB_CNT__A, &eq_reg_td_req_smb_cnt); if (status < 0) goto error; status = read16(state, OFDM_EQ_TOP_TD_SQR_ERR_EXP__A, &eq_reg_td_sqr_err_exp); if (status < 0) goto error; status = read16(state, OFDM_EQ_TOP_TD_SQR_ERR_I__A, &reg_data); if (status < 0) goto error; /* Extend SQR_ERR_I operational range */ eq_reg_td_sqr_err_i = (u32) reg_data; if ((eq_reg_td_sqr_err_exp > 11) && (eq_reg_td_sqr_err_i < 0x00000FFFUL)) { eq_reg_td_sqr_err_i += 0x00010000UL; } status = read16(state, OFDM_EQ_TOP_TD_SQR_ERR_Q__A, &reg_data); if (status < 0) goto error; /* Extend SQR_ERR_Q operational range */ eq_reg_td_sqr_err_q = (u32) reg_data; if ((eq_reg_td_sqr_err_exp > 11) && (eq_reg_td_sqr_err_q < 0x00000FFFUL)) eq_reg_td_sqr_err_q += 0x00010000UL; status = read16(state, OFDM_SC_RA_RAM_OP_PARAM__A, &transmission_params); if (status < 0) goto error; /* Check input data for MER */ /* MER calculation (in 0.1 dB) without math.h */ if ((eq_reg_td_tps_pwr_ofs == 0) || (eq_reg_td_req_smb_cnt == 0)) i_mer = 0; else if ((eq_reg_td_sqr_err_i + eq_reg_td_sqr_err_q) == 0) { /* No error at all, this must be the HW reset value * Apparently no first measurement yet * Set MER to 0.0 */ i_mer = 0; } else { sqr_err_iq = (eq_reg_td_sqr_err_i + eq_reg_td_sqr_err_q) << eq_reg_td_sqr_err_exp; if ((transmission_params & OFDM_SC_RA_RAM_OP_PARAM_MODE__M) == OFDM_SC_RA_RAM_OP_PARAM_MODE_2K) tps_cnt = 17; else tps_cnt = 68; /* IMER = 100 * log10 (x) where x = (eq_reg_td_tps_pwr_ofs^2 * eq_reg_td_req_smb_cnt * tps_cnt)/sqr_err_iq => IMER = a + b -c where a = 100 * log10 (eq_reg_td_tps_pwr_ofs^2) b = 100 * log10 (eq_reg_td_req_smb_cnt * tps_cnt) c = 100 * log10 (sqr_err_iq) */ /* log(x) x = 9bits * 9bits->18 bits */ a = log10times100(eq_reg_td_tps_pwr_ofs * eq_reg_td_tps_pwr_ofs); /* log(x) x = 16bits * 7bits->23 bits */ b = log10times100(eq_reg_td_req_smb_cnt * tps_cnt); /* log(x) x = (16bits + 16bits) << 15 ->32 bits */ c = log10times100(sqr_err_iq); i_mer = a + b - c; } *p_signal_to_noise = i_mer; error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int get_signal_to_noise(struct drxk_state *state, s32 *p_signal_to_noise) { dprintk(1, "\n"); *p_signal_to_noise = 0; switch (state->m_operation_mode) { case OM_DVBT: return get_dvbt_signal_to_noise(state, p_signal_to_noise); case OM_QAM_ITU_A: case OM_QAM_ITU_C: return get_qam_signal_to_noise(state, p_signal_to_noise); default: break; } return 0; } #if 0 static int get_dvbt_quality(struct drxk_state *state, s32 *p_quality) { /* SNR Values for quasi errorfree reception rom Nordig 2.2 */ int status = 0; dprintk(1, "\n"); static s32 QE_SN[] = { 51, /* QPSK 1/2 */ 69, /* QPSK 2/3 */ 79, /* QPSK 3/4 */ 89, /* QPSK 5/6 */ 97, /* QPSK 7/8 */ 108, /* 16-QAM 1/2 */ 131, /* 16-QAM 2/3 */ 146, /* 16-QAM 3/4 */ 156, /* 16-QAM 5/6 */ 160, /* 16-QAM 7/8 */ 165, /* 64-QAM 1/2 */ 187, /* 64-QAM 2/3 */ 202, /* 64-QAM 3/4 */ 216, /* 64-QAM 5/6 */ 225, /* 64-QAM 7/8 */ }; *p_quality = 0; do { s32 signal_to_noise = 0; u16 constellation = 0; u16 code_rate = 0; u32 signal_to_noise_rel; u32 ber_quality; status = get_dvbt_signal_to_noise(state, &signal_to_noise); if (status < 0) break; status = read16(state, OFDM_EQ_TOP_TD_TPS_CONST__A, &constellation); if (status < 0) break; constellation &= OFDM_EQ_TOP_TD_TPS_CONST__M; status = read16(state, OFDM_EQ_TOP_TD_TPS_CODE_HP__A, &code_rate); if (status < 0) break; code_rate &= OFDM_EQ_TOP_TD_TPS_CODE_HP__M; if (constellation > OFDM_EQ_TOP_TD_TPS_CONST_64QAM || code_rate > OFDM_EQ_TOP_TD_TPS_CODE_LP_7_8) break; signal_to_noise_rel = signal_to_noise - QE_SN[constellation * 5 + code_rate]; ber_quality = 100; if (signal_to_noise_rel < -70) *p_quality = 0; else if (signal_to_noise_rel < 30) *p_quality = ((signal_to_noise_rel + 70) * ber_quality) / 100; else *p_quality = ber_quality; } while (0); return 0; }; static int get_dvbc_quality(struct drxk_state *state, s32 *p_quality) { int status = 0; *p_quality = 0; dprintk(1, "\n"); do { u32 signal_to_noise = 0; u32 ber_quality = 100; u32 signal_to_noise_rel = 0; status = get_qam_signal_to_noise(state, &signal_to_noise); if (status < 0) break; switch (state->props.modulation) { case QAM_16: signal_to_noise_rel = signal_to_noise - 200; break; case QAM_32: signal_to_noise_rel = signal_to_noise - 230; break; /* Not in NorDig */ case QAM_64: signal_to_noise_rel = signal_to_noise - 260; break; case QAM_128: signal_to_noise_rel = signal_to_noise - 290; break; default: case QAM_256: signal_to_noise_rel = signal_to_noise - 320; break; } if (signal_to_noise_rel < -70) *p_quality = 0; else if (signal_to_noise_rel < 30) *p_quality = ((signal_to_noise_rel + 70) * ber_quality) / 100; else *p_quality = ber_quality; } while (0); return status; } static int get_quality(struct drxk_state *state, s32 *p_quality) { dprintk(1, "\n"); switch (state->m_operation_mode) { case OM_DVBT: return get_dvbt_quality(state, p_quality); case OM_QAM_ITU_A: return get_dvbc_quality(state, p_quality); default: break; } return 0; } #endif /* Free data ram in SIO HI */ #define SIO_HI_RA_RAM_USR_BEGIN__A 0x420040 #define SIO_HI_RA_RAM_USR_END__A 0x420060 #define DRXK_HI_ATOMIC_BUF_START (SIO_HI_RA_RAM_USR_BEGIN__A) #define DRXK_HI_ATOMIC_BUF_END (SIO_HI_RA_RAM_USR_BEGIN__A + 7) #define DRXK_HI_ATOMIC_READ SIO_HI_RA_RAM_PAR_3_ACP_RW_READ #define DRXK_HI_ATOMIC_WRITE SIO_HI_RA_RAM_PAR_3_ACP_RW_WRITE #define DRXDAP_FASI_ADDR2BLOCK(addr) (((addr) >> 22) & 0x3F) #define DRXDAP_FASI_ADDR2BANK(addr) (((addr) >> 16) & 0x3F) #define DRXDAP_FASI_ADDR2OFFSET(addr) ((addr) & 0x7FFF) static int ConfigureI2CBridge(struct drxk_state *state, bool b_enable_bridge) { int status = -EINVAL; dprintk(1, "\n"); if (state->m_drxk_state == DRXK_UNINITIALIZED) return 0; if (state->m_drxk_state == DRXK_POWERED_DOWN) goto error; if (state->no_i2c_bridge) return 0; status = write16(state, SIO_HI_RA_RAM_PAR_1__A, SIO_HI_RA_RAM_PAR_1_PAR1_SEC_KEY); if (status < 0) goto error; if (b_enable_bridge) { status = write16(state, SIO_HI_RA_RAM_PAR_2__A, SIO_HI_RA_RAM_PAR_2_BRD_CFG_CLOSED); if (status < 0) goto error; } else { status = write16(state, SIO_HI_RA_RAM_PAR_2__A, SIO_HI_RA_RAM_PAR_2_BRD_CFG_OPEN); if (status < 0) goto error; } status = hi_command(state, SIO_HI_RA_RAM_CMD_BRDCTRL, NULL); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int set_pre_saw(struct drxk_state *state, struct s_cfg_pre_saw *p_pre_saw_cfg) { int status = -EINVAL; dprintk(1, "\n"); if ((p_pre_saw_cfg == NULL) || (p_pre_saw_cfg->reference > IQM_AF_PDREF__M)) goto error; status = write16(state, IQM_AF_PDREF__A, p_pre_saw_cfg->reference); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int bl_direct_cmd(struct drxk_state *state, u32 target_addr, u16 rom_offset, u16 nr_of_elements, u32 time_out) { u16 bl_status = 0; u16 offset = (u16) ((target_addr >> 0) & 0x00FFFF); u16 blockbank = (u16) ((target_addr >> 16) & 0x000FFF); int status; unsigned long end; dprintk(1, "\n"); mutex_lock(&state->mutex); status = write16(state, SIO_BL_MODE__A, SIO_BL_MODE_DIRECT); if (status < 0) goto error; status = write16(state, SIO_BL_TGT_HDR__A, blockbank); if (status < 0) goto error; status = write16(state, SIO_BL_TGT_ADDR__A, offset); if (status < 0) goto error; status = write16(state, SIO_BL_SRC_ADDR__A, rom_offset); if (status < 0) goto error; status = write16(state, SIO_BL_SRC_LEN__A, nr_of_elements); if (status < 0) goto error; status = write16(state, SIO_BL_ENABLE__A, SIO_BL_ENABLE_ON); if (status < 0) goto error; end = jiffies + msecs_to_jiffies(time_out); do { status = read16(state, SIO_BL_STATUS__A, &bl_status); if (status < 0) goto error; } while ((bl_status == 0x1) && time_is_after_jiffies(end)); if (bl_status == 0x1) { pr_err("SIO not ready\n"); status = -EINVAL; goto error2; } error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); error2: mutex_unlock(&state->mutex); return status; } static int adc_sync_measurement(struct drxk_state *state, u16 *count) { u16 data = 0; int status; dprintk(1, "\n"); /* start measurement */ status = write16(state, IQM_AF_COMM_EXEC__A, IQM_AF_COMM_EXEC_ACTIVE); if (status < 0) goto error; status = write16(state, IQM_AF_START_LOCK__A, 1); if (status < 0) goto error; *count = 0; status = read16(state, IQM_AF_PHASE0__A, &data); if (status < 0) goto error; if (data == 127) *count = *count + 1; status = read16(state, IQM_AF_PHASE1__A, &data); if (status < 0) goto error; if (data == 127) *count = *count + 1; status = read16(state, IQM_AF_PHASE2__A, &data); if (status < 0) goto error; if (data == 127) *count = *count + 1; error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int adc_synchronization(struct drxk_state *state) { u16 count = 0; int status; dprintk(1, "\n"); status = adc_sync_measurement(state, &count); if (status < 0) goto error; if (count == 1) { /* Try sampling on a different edge */ u16 clk_neg = 0; status = read16(state, IQM_AF_CLKNEG__A, &clk_neg); if (status < 0) goto error; if ((clk_neg & IQM_AF_CLKNEG_CLKNEGDATA__M) == IQM_AF_CLKNEG_CLKNEGDATA_CLK_ADC_DATA_POS) { clk_neg &= (~(IQM_AF_CLKNEG_CLKNEGDATA__M)); clk_neg |= IQM_AF_CLKNEG_CLKNEGDATA_CLK_ADC_DATA_NEG; } else { clk_neg &= (~(IQM_AF_CLKNEG_CLKNEGDATA__M)); clk_neg |= IQM_AF_CLKNEG_CLKNEGDATA_CLK_ADC_DATA_POS; } status = write16(state, IQM_AF_CLKNEG__A, clk_neg); if (status < 0) goto error; status = adc_sync_measurement(state, &count); if (status < 0) goto error; } if (count < 2) status = -EINVAL; error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int set_frequency_shifter(struct drxk_state *state, u16 intermediate_freqk_hz, s32 tuner_freq_offset, bool is_dtv) { bool select_pos_image = false; u32 rf_freq_residual = tuner_freq_offset; u32 fm_frequency_shift = 0; bool tuner_mirror = !state->m_b_mirror_freq_spect; u32 adc_freq; bool adc_flip; int status; u32 if_freq_actual; u32 sampling_frequency = (u32) (state->m_sys_clock_freq / 3); u32 frequency_shift; bool image_to_select; dprintk(1, "\n"); /* Program frequency shifter No need to account for mirroring on RF */ if (is_dtv) { if ((state->m_operation_mode == OM_QAM_ITU_A) || (state->m_operation_mode == OM_QAM_ITU_C) || (state->m_operation_mode == OM_DVBT)) select_pos_image = true; else select_pos_image = false; } if (tuner_mirror) /* tuner doesn't mirror */ if_freq_actual = intermediate_freqk_hz + rf_freq_residual + fm_frequency_shift; else /* tuner mirrors */ if_freq_actual = intermediate_freqk_hz - rf_freq_residual - fm_frequency_shift; if (if_freq_actual > sampling_frequency / 2) { /* adc mirrors */ adc_freq = sampling_frequency - if_freq_actual; adc_flip = true; } else { /* adc doesn't mirror */ adc_freq = if_freq_actual; adc_flip = false; } frequency_shift = adc_freq; image_to_select = state->m_rfmirror ^ tuner_mirror ^ adc_flip ^ select_pos_image; state->m_iqm_fs_rate_ofs = Frac28a((frequency_shift), sampling_frequency); if (image_to_select) state->m_iqm_fs_rate_ofs = ~state->m_iqm_fs_rate_ofs + 1; /* Program frequency shifter with tuner offset compensation */ /* frequency_shift += tuner_freq_offset; TODO */ status = write32(state, IQM_FS_RATE_OFS_LO__A, state->m_iqm_fs_rate_ofs); if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int init_agc(struct drxk_state *state, bool is_dtv) { u16 ingain_tgt = 0; u16 ingain_tgt_min = 0; u16 ingain_tgt_max = 0; u16 clp_cyclen = 0; u16 clp_sum_min = 0; u16 clp_dir_to = 0; u16 sns_sum_min = 0; u16 sns_sum_max = 0; u16 clp_sum_max = 0; u16 sns_dir_to = 0; u16 ki_innergain_min = 0; u16 if_iaccu_hi_tgt = 0; u16 if_iaccu_hi_tgt_min = 0; u16 if_iaccu_hi_tgt_max = 0; u16 data = 0; u16 fast_clp_ctrl_delay = 0; u16 clp_ctrl_mode = 0; int status = 0; dprintk(1, "\n"); /* Common settings */ sns_sum_max = 1023; if_iaccu_hi_tgt_min = 2047; clp_cyclen = 500; clp_sum_max = 1023; /* AGCInit() not available for DVBT; init done in microcode */ if (!is_qam(state)) { pr_err("%s: mode %d is not DVB-C\n", __func__, state->m_operation_mode); return -EINVAL; } /* FIXME: Analog TV AGC require different settings */ /* Standard specific settings */ clp_sum_min = 8; clp_dir_to = (u16) -9; clp_ctrl_mode = 0; sns_sum_min = 8; sns_dir_to = (u16) -9; ki_innergain_min = (u16) -1030; if_iaccu_hi_tgt_max = 0x2380; if_iaccu_hi_tgt = 0x2380; ingain_tgt_min = 0x0511; ingain_tgt = 0x0511; ingain_tgt_max = 5119; fast_clp_ctrl_delay = state->m_qam_if_agc_cfg.fast_clip_ctrl_delay; status = write16(state, SCU_RAM_AGC_FAST_CLP_CTRL_DELAY__A, fast_clp_ctrl_delay); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_CLP_CTRL_MODE__A, clp_ctrl_mode); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_INGAIN_TGT__A, ingain_tgt); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_INGAIN_TGT_MIN__A, ingain_tgt_min); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_INGAIN_TGT_MAX__A, ingain_tgt_max); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_IF_IACCU_HI_TGT_MIN__A, if_iaccu_hi_tgt_min); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_IF_IACCU_HI_TGT_MAX__A, if_iaccu_hi_tgt_max); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_IF_IACCU_HI__A, 0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_IF_IACCU_LO__A, 0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_RF_IACCU_HI__A, 0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_RF_IACCU_LO__A, 0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_CLP_SUM_MAX__A, clp_sum_max); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_SNS_SUM_MAX__A, sns_sum_max); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_KI_INNERGAIN_MIN__A, ki_innergain_min); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_IF_IACCU_HI_TGT__A, if_iaccu_hi_tgt); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_CLP_CYCLEN__A, clp_cyclen); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_RF_SNS_DEV_MAX__A, 1023); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_RF_SNS_DEV_MIN__A, (u16) -1023); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_FAST_SNS_CTRL_DELAY__A, 50); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_KI_MAXMINGAIN_TH__A, 20); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_CLP_SUM_MIN__A, clp_sum_min); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_SNS_SUM_MIN__A, sns_sum_min); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_CLP_DIR_TO__A, clp_dir_to); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_SNS_DIR_TO__A, sns_dir_to); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_KI_MINGAIN__A, 0x7fff); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_KI_MAXGAIN__A, 0x0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_KI_MIN__A, 0x0117); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_KI_MAX__A, 0x0657); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_CLP_SUM__A, 0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_CLP_CYCCNT__A, 0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_CLP_DIR_WD__A, 0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_CLP_DIR_STP__A, 1); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_SNS_SUM__A, 0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_SNS_CYCCNT__A, 0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_SNS_DIR_WD__A, 0); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_SNS_DIR_STP__A, 1); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_SNS_CYCLEN__A, 500); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_KI_CYCLEN__A, 500); if (status < 0) goto error; /* Initialize inner-loop KI gain factors */ status = read16(state, SCU_RAM_AGC_KI__A, &data); if (status < 0) goto error; data = 0x0657; data &= ~SCU_RAM_AGC_KI_RF__M; data |= (DRXK_KI_RAGC_QAM << SCU_RAM_AGC_KI_RF__B); data &= ~SCU_RAM_AGC_KI_IF__M; data |= (DRXK_KI_IAGC_QAM << SCU_RAM_AGC_KI_IF__B); status = write16(state, SCU_RAM_AGC_KI__A, data); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int dvbtqam_get_acc_pkt_err(struct drxk_state *state, u16 *packet_err) { int status; dprintk(1, "\n"); if (packet_err == NULL) status = write16(state, SCU_RAM_FEC_ACCUM_PKT_FAILURES__A, 0); else status = read16(state, SCU_RAM_FEC_ACCUM_PKT_FAILURES__A, packet_err); if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int dvbt_sc_command(struct drxk_state *state, u16 cmd, u16 subcmd, u16 param0, u16 param1, u16 param2, u16 param3, u16 param4) { u16 cur_cmd = 0; u16 err_code = 0; u16 retry_cnt = 0; u16 sc_exec = 0; int status; dprintk(1, "\n"); status = read16(state, OFDM_SC_COMM_EXEC__A, &sc_exec); if (sc_exec != 1) { /* SC is not running */ status = -EINVAL; } if (status < 0) goto error; /* Wait until sc is ready to receive command */ retry_cnt = 0; do { usleep_range(1000, 2000); status = read16(state, OFDM_SC_RA_RAM_CMD__A, &cur_cmd); retry_cnt++; } while ((cur_cmd != 0) && (retry_cnt < DRXK_MAX_RETRIES)); if (retry_cnt >= DRXK_MAX_RETRIES && (status < 0)) goto error; /* Write sub-command */ switch (cmd) { /* All commands using sub-cmd */ case OFDM_SC_RA_RAM_CMD_PROC_START: case OFDM_SC_RA_RAM_CMD_SET_PREF_PARAM: case OFDM_SC_RA_RAM_CMD_PROGRAM_PARAM: status = write16(state, OFDM_SC_RA_RAM_CMD_ADDR__A, subcmd); if (status < 0) goto error; break; default: /* Do nothing */ break; } /* Write needed parameters and the command */ status = 0; switch (cmd) { /* All commands using 5 parameters */ /* All commands using 4 parameters */ /* All commands using 3 parameters */ /* All commands using 2 parameters */ case OFDM_SC_RA_RAM_CMD_PROC_START: case OFDM_SC_RA_RAM_CMD_SET_PREF_PARAM: case OFDM_SC_RA_RAM_CMD_PROGRAM_PARAM: status |= write16(state, OFDM_SC_RA_RAM_PARAM1__A, param1); /* All commands using 1 parameters */ case OFDM_SC_RA_RAM_CMD_SET_ECHO_TIMING: case OFDM_SC_RA_RAM_CMD_USER_IO: status |= write16(state, OFDM_SC_RA_RAM_PARAM0__A, param0); /* All commands using 0 parameters */ case OFDM_SC_RA_RAM_CMD_GET_OP_PARAM: case OFDM_SC_RA_RAM_CMD_NULL: /* Write command */ status |= write16(state, OFDM_SC_RA_RAM_CMD__A, cmd); break; default: /* Unknown command */ status = -EINVAL; } if (status < 0) goto error; /* Wait until sc is ready processing command */ retry_cnt = 0; do { usleep_range(1000, 2000); status = read16(state, OFDM_SC_RA_RAM_CMD__A, &cur_cmd); retry_cnt++; } while ((cur_cmd != 0) && (retry_cnt < DRXK_MAX_RETRIES)); if (retry_cnt >= DRXK_MAX_RETRIES && (status < 0)) goto error; /* Check for illegal cmd */ status = read16(state, OFDM_SC_RA_RAM_CMD_ADDR__A, &err_code); if (err_code == 0xFFFF) { /* illegal command */ status = -EINVAL; } if (status < 0) goto error; /* Retrieve results parameters from SC */ switch (cmd) { /* All commands yielding 5 results */ /* All commands yielding 4 results */ /* All commands yielding 3 results */ /* All commands yielding 2 results */ /* All commands yielding 1 result */ case OFDM_SC_RA_RAM_CMD_USER_IO: case OFDM_SC_RA_RAM_CMD_GET_OP_PARAM: status = read16(state, OFDM_SC_RA_RAM_PARAM0__A, &(param0)); /* All commands yielding 0 results */ case OFDM_SC_RA_RAM_CMD_SET_ECHO_TIMING: case OFDM_SC_RA_RAM_CMD_SET_TIMER: case OFDM_SC_RA_RAM_CMD_PROC_START: case OFDM_SC_RA_RAM_CMD_SET_PREF_PARAM: case OFDM_SC_RA_RAM_CMD_PROGRAM_PARAM: case OFDM_SC_RA_RAM_CMD_NULL: break; default: /* Unknown command */ status = -EINVAL; break; } /* switch (cmd->cmd) */ error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int power_up_dvbt(struct drxk_state *state) { enum drx_power_mode power_mode = DRX_POWER_UP; int status; dprintk(1, "\n"); status = ctrl_power_mode(state, &power_mode); if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int dvbt_ctrl_set_inc_enable(struct drxk_state *state, bool *enabled) { int status; dprintk(1, "\n"); if (*enabled) status = write16(state, IQM_CF_BYPASSDET__A, 0); else status = write16(state, IQM_CF_BYPASSDET__A, 1); if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } #define DEFAULT_FR_THRES_8K 4000 static int dvbt_ctrl_set_fr_enable(struct drxk_state *state, bool *enabled) { int status; dprintk(1, "\n"); if (*enabled) { /* write mask to 1 */ status = write16(state, OFDM_SC_RA_RAM_FR_THRES_8K__A, DEFAULT_FR_THRES_8K); } else { /* write mask to 0 */ status = write16(state, OFDM_SC_RA_RAM_FR_THRES_8K__A, 0); } if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int dvbt_ctrl_set_echo_threshold(struct drxk_state *state, struct drxk_cfg_dvbt_echo_thres_t *echo_thres) { u16 data = 0; int status; dprintk(1, "\n"); status = read16(state, OFDM_SC_RA_RAM_ECHO_THRES__A, &data); if (status < 0) goto error; switch (echo_thres->fft_mode) { case DRX_FFTMODE_2K: data &= ~OFDM_SC_RA_RAM_ECHO_THRES_2K__M; data |= ((echo_thres->threshold << OFDM_SC_RA_RAM_ECHO_THRES_2K__B) & (OFDM_SC_RA_RAM_ECHO_THRES_2K__M)); break; case DRX_FFTMODE_8K: data &= ~OFDM_SC_RA_RAM_ECHO_THRES_8K__M; data |= ((echo_thres->threshold << OFDM_SC_RA_RAM_ECHO_THRES_8K__B) & (OFDM_SC_RA_RAM_ECHO_THRES_8K__M)); break; default: return -EINVAL; } status = write16(state, OFDM_SC_RA_RAM_ECHO_THRES__A, data); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int dvbt_ctrl_set_sqi_speed(struct drxk_state *state, enum drxk_cfg_dvbt_sqi_speed *speed) { int status = -EINVAL; dprintk(1, "\n"); switch (*speed) { case DRXK_DVBT_SQI_SPEED_FAST: case DRXK_DVBT_SQI_SPEED_MEDIUM: case DRXK_DVBT_SQI_SPEED_SLOW: break; default: goto error; } status = write16(state, SCU_RAM_FEC_PRE_RS_BER_FILTER_SH__A, (u16) *speed); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief Activate DVBT specific presets * \param demod instance of demodulator. * \return DRXStatus_t. * * Called in DVBTSetStandard * */ static int dvbt_activate_presets(struct drxk_state *state) { int status; bool setincenable = false; bool setfrenable = true; struct drxk_cfg_dvbt_echo_thres_t echo_thres2k = { 0, DRX_FFTMODE_2K }; struct drxk_cfg_dvbt_echo_thres_t echo_thres8k = { 0, DRX_FFTMODE_8K }; dprintk(1, "\n"); status = dvbt_ctrl_set_inc_enable(state, &setincenable); if (status < 0) goto error; status = dvbt_ctrl_set_fr_enable(state, &setfrenable); if (status < 0) goto error; status = dvbt_ctrl_set_echo_threshold(state, &echo_thres2k); if (status < 0) goto error; status = dvbt_ctrl_set_echo_threshold(state, &echo_thres8k); if (status < 0) goto error; status = write16(state, SCU_RAM_AGC_INGAIN_TGT_MAX__A, state->m_dvbt_if_agc_cfg.ingain_tgt_max); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief Initialize channelswitch-independent settings for DVBT. * \param demod instance of demodulator. * \return DRXStatus_t. * * For ROM code channel filter taps are loaded from the bootloader. For microcode * the DVB-T taps from the drxk_filters.h are used. */ static int set_dvbt_standard(struct drxk_state *state, enum operation_mode o_mode) { u16 cmd_result = 0; u16 data = 0; int status; dprintk(1, "\n"); power_up_dvbt(state); /* added antenna switch */ switch_antenna_to_dvbt(state); /* send OFDM reset command */ status = scu_command(state, SCU_RAM_COMMAND_STANDARD_OFDM | SCU_RAM_COMMAND_CMD_DEMOD_RESET, 0, NULL, 1, &cmd_result); if (status < 0) goto error; /* send OFDM setenv command */ status = scu_command(state, SCU_RAM_COMMAND_STANDARD_OFDM | SCU_RAM_COMMAND_CMD_DEMOD_SET_ENV, 0, NULL, 1, &cmd_result); if (status < 0) goto error; /* reset datapath for OFDM, processors first */ status = write16(state, OFDM_SC_COMM_EXEC__A, OFDM_SC_COMM_EXEC_STOP); if (status < 0) goto error; status = write16(state, OFDM_LC_COMM_EXEC__A, OFDM_LC_COMM_EXEC_STOP); if (status < 0) goto error; status = write16(state, IQM_COMM_EXEC__A, IQM_COMM_EXEC_B_STOP); if (status < 0) goto error; /* IQM setup */ /* synchronize on ofdstate->m_festart */ status = write16(state, IQM_AF_UPD_SEL__A, 1); if (status < 0) goto error; /* window size for clipping ADC detection */ status = write16(state, IQM_AF_CLP_LEN__A, 0); if (status < 0) goto error; /* window size for for sense pre-SAW detection */ status = write16(state, IQM_AF_SNS_LEN__A, 0); if (status < 0) goto error; /* sense threshold for sense pre-SAW detection */ status = write16(state, IQM_AF_AMUX__A, IQM_AF_AMUX_SIGNAL2ADC); if (status < 0) goto error; status = set_iqm_af(state, true); if (status < 0) goto error; status = write16(state, IQM_AF_AGC_RF__A, 0); if (status < 0) goto error; /* Impulse noise cruncher setup */ status = write16(state, IQM_AF_INC_LCT__A, 0); /* crunch in IQM_CF */ if (status < 0) goto error; status = write16(state, IQM_CF_DET_LCT__A, 0); /* detect in IQM_CF */ if (status < 0) goto error; status = write16(state, IQM_CF_WND_LEN__A, 3); /* peak detector window length */ if (status < 0) goto error; status = write16(state, IQM_RC_STRETCH__A, 16); if (status < 0) goto error; status = write16(state, IQM_CF_OUT_ENA__A, 0x4); /* enable output 2 */ if (status < 0) goto error; status = write16(state, IQM_CF_DS_ENA__A, 0x4); /* decimate output 2 */ if (status < 0) goto error; status = write16(state, IQM_CF_SCALE__A, 1600); if (status < 0) goto error; status = write16(state, IQM_CF_SCALE_SH__A, 0); if (status < 0) goto error; /* virtual clipping threshold for clipping ADC detection */ status = write16(state, IQM_AF_CLP_TH__A, 448); if (status < 0) goto error; status = write16(state, IQM_CF_DATATH__A, 495); /* crunching threshold */ if (status < 0) goto error; status = bl_chain_cmd(state, DRXK_BL_ROM_OFFSET_TAPS_DVBT, DRXK_BLCC_NR_ELEMENTS_TAPS, DRXK_BLC_TIMEOUT); if (status < 0) goto error; status = write16(state, IQM_CF_PKDTH__A, 2); /* peak detector threshold */ if (status < 0) goto error; status = write16(state, IQM_CF_POW_MEAS_LEN__A, 2); if (status < 0) goto error; /* enable power measurement interrupt */ status = write16(state, IQM_CF_COMM_INT_MSK__A, 1); if (status < 0) goto error; status = write16(state, IQM_COMM_EXEC__A, IQM_COMM_EXEC_B_ACTIVE); if (status < 0) goto error; /* IQM will not be reset from here, sync ADC and update/init AGC */ status = adc_synchronization(state); if (status < 0) goto error; status = set_pre_saw(state, &state->m_dvbt_pre_saw_cfg); if (status < 0) goto error; /* Halt SCU to enable safe non-atomic accesses */ status = write16(state, SCU_COMM_EXEC__A, SCU_COMM_EXEC_HOLD); if (status < 0) goto error; status = set_agc_rf(state, &state->m_dvbt_rf_agc_cfg, true); if (status < 0) goto error; status = set_agc_if(state, &state->m_dvbt_if_agc_cfg, true); if (status < 0) goto error; /* Set Noise Estimation notch width and enable DC fix */ status = read16(state, OFDM_SC_RA_RAM_CONFIG__A, &data); if (status < 0) goto error; data |= OFDM_SC_RA_RAM_CONFIG_NE_FIX_ENABLE__M; status = write16(state, OFDM_SC_RA_RAM_CONFIG__A, data); if (status < 0) goto error; /* Activate SCU to enable SCU commands */ status = write16(state, SCU_COMM_EXEC__A, SCU_COMM_EXEC_ACTIVE); if (status < 0) goto error; if (!state->m_drxk_a3_rom_code) { /* AGCInit() is not done for DVBT, so set agcfast_clip_ctrl_delay */ status = write16(state, SCU_RAM_AGC_FAST_CLP_CTRL_DELAY__A, state->m_dvbt_if_agc_cfg.fast_clip_ctrl_delay); if (status < 0) goto error; } /* OFDM_SC setup */ #ifdef COMPILE_FOR_NONRT status = write16(state, OFDM_SC_RA_RAM_BE_OPT_DELAY__A, 1); if (status < 0) goto error; status = write16(state, OFDM_SC_RA_RAM_BE_OPT_INIT_DELAY__A, 2); if (status < 0) goto error; #endif /* FEC setup */ status = write16(state, FEC_DI_INPUT_CTL__A, 1); /* OFDM input */ if (status < 0) goto error; #ifdef COMPILE_FOR_NONRT status = write16(state, FEC_RS_MEASUREMENT_PERIOD__A, 0x400); if (status < 0) goto error; #else status = write16(state, FEC_RS_MEASUREMENT_PERIOD__A, 0x1000); if (status < 0) goto error; #endif status = write16(state, FEC_RS_MEASUREMENT_PRESCALE__A, 0x0001); if (status < 0) goto error; /* Setup MPEG bus */ status = mpegts_dto_setup(state, OM_DVBT); if (status < 0) goto error; /* Set DVBT Presets */ status = dvbt_activate_presets(state); if (status < 0) goto error; error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief start dvbt demodulating for channel. * \param demod instance of demodulator. * \return DRXStatus_t. */ static int dvbt_start(struct drxk_state *state) { u16 param1; int status; /* drxk_ofdm_sc_cmd_t scCmd; */ dprintk(1, "\n"); /* start correct processes to get in lock */ /* DRXK: OFDM_SC_RA_RAM_PROC_LOCKTRACK is no longer in mapfile! */ param1 = OFDM_SC_RA_RAM_LOCKTRACK_MIN; status = dvbt_sc_command(state, OFDM_SC_RA_RAM_CMD_PROC_START, 0, OFDM_SC_RA_RAM_SW_EVENT_RUN_NMASK__M, param1, 0, 0, 0); if (status < 0) goto error; /* start FEC OC */ status = mpegts_start(state); if (status < 0) goto error; status = write16(state, FEC_COMM_EXEC__A, FEC_COMM_EXEC_ACTIVE); if (status < 0) goto error; error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief Set up dvbt demodulator for channel. * \param demod instance of demodulator. * \return DRXStatus_t. * // original DVBTSetChannel() */ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz, s32 tuner_freq_offset) { u16 cmd_result = 0; u16 transmission_params = 0; u16 operation_mode = 0; u32 iqm_rc_rate_ofs = 0; u32 bandwidth = 0; u16 param1; int status; dprintk(1, "IF =%d, TFO = %d\n", intermediate_freqk_hz, tuner_freq_offset); status = scu_command(state, SCU_RAM_COMMAND_STANDARD_OFDM | SCU_RAM_COMMAND_CMD_DEMOD_STOP, 0, NULL, 1, &cmd_result); if (status < 0) goto error; /* Halt SCU to enable safe non-atomic accesses */ status = write16(state, SCU_COMM_EXEC__A, SCU_COMM_EXEC_HOLD); if (status < 0) goto error; /* Stop processors */ status = write16(state, OFDM_SC_COMM_EXEC__A, OFDM_SC_COMM_EXEC_STOP); if (status < 0) goto error; status = write16(state, OFDM_LC_COMM_EXEC__A, OFDM_LC_COMM_EXEC_STOP); if (status < 0) goto error; /* Mandatory fix, always stop CP, required to set spl offset back to hardware default (is set to 0 by ucode during pilot detection */ status = write16(state, OFDM_CP_COMM_EXEC__A, OFDM_CP_COMM_EXEC_STOP); if (status < 0) goto error; /*== Write channel settings to device ================================*/ /* mode */ switch (state->props.transmission_mode) { case TRANSMISSION_MODE_AUTO: default: operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_MODE__M; /* fall through , try first guess DRX_FFTMODE_8K */ case TRANSMISSION_MODE_8K: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_MODE_8K; break; case TRANSMISSION_MODE_2K: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_MODE_2K; break; } /* guard */ switch (state->props.guard_interval) { default: case GUARD_INTERVAL_AUTO: operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_GUARD__M; /* fall through , try first guess DRX_GUARD_1DIV4 */ case GUARD_INTERVAL_1_4: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_GUARD_4; break; case GUARD_INTERVAL_1_32: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_GUARD_32; break; case GUARD_INTERVAL_1_16: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_GUARD_16; break; case GUARD_INTERVAL_1_8: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_GUARD_8; break; } /* hierarchy */ switch (state->props.hierarchy) { case HIERARCHY_AUTO: case HIERARCHY_NONE: default: operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_HIER__M; /* fall through , try first guess SC_RA_RAM_OP_PARAM_HIER_NO */ /* transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_NO; */ /* break; */ case HIERARCHY_1: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_A1; break; case HIERARCHY_2: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_A2; break; case HIERARCHY_4: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_HIER_A4; break; } /* modulation */ switch (state->props.modulation) { case QAM_AUTO: default: operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_CONST__M; /* fall through , try first guess DRX_CONSTELLATION_QAM64 */ case QAM_64: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_CONST_QAM64; break; case QPSK: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_CONST_QPSK; break; case QAM_16: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_CONST_QAM16; break; } #if 0 /* No hierarchical channels support in BDA */ /* Priority (only for hierarchical channels) */ switch (channel->priority) { case DRX_PRIORITY_LOW: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_PRIO_LO; WR16(dev_addr, OFDM_EC_SB_PRIOR__A, OFDM_EC_SB_PRIOR_LO); break; case DRX_PRIORITY_HIGH: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_PRIO_HI; WR16(dev_addr, OFDM_EC_SB_PRIOR__A, OFDM_EC_SB_PRIOR_HI)); break; case DRX_PRIORITY_UNKNOWN: /* fall through */ default: status = -EINVAL; goto error; } #else /* Set Priorty high */ transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_PRIO_HI; status = write16(state, OFDM_EC_SB_PRIOR__A, OFDM_EC_SB_PRIOR_HI); if (status < 0) goto error; #endif /* coderate */ switch (state->props.code_rate_HP) { case FEC_AUTO: default: operation_mode |= OFDM_SC_RA_RAM_OP_AUTO_RATE__M; /* fall through , try first guess DRX_CODERATE_2DIV3 */ case FEC_2_3: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_RATE_2_3; break; case FEC_1_2: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_RATE_1_2; break; case FEC_3_4: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_RATE_3_4; break; case FEC_5_6: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_RATE_5_6; break; case FEC_7_8: transmission_params |= OFDM_SC_RA_RAM_OP_PARAM_RATE_7_8; break; } /* * SAW filter selection: normaly not necesarry, but if wanted * the application can select a SAW filter via the driver by * using UIOs */ /* First determine real bandwidth (Hz) */ /* Also set delay for impulse noise cruncher */ /* * Also set parameters for EC_OC fix, note EC_OC_REG_TMD_HIL_MAR is * changed by SC for fix for some 8K,1/8 guard but is restored by * InitEC and ResetEC functions */ switch (state->props.bandwidth_hz) { case 0: state->props.bandwidth_hz = 8000000; /* fall though */ case 8000000: bandwidth = DRXK_BANDWIDTH_8MHZ_IN_HZ; status = write16(state, OFDM_SC_RA_RAM_SRMM_FIX_FACT_8K__A, 3052); if (status < 0) goto error; /* cochannel protection for PAL 8 MHz */ status = write16(state, OFDM_SC_RA_RAM_NI_INIT_8K_PER_LEFT__A, 7); if (status < 0) goto error; status = write16(state, OFDM_SC_RA_RAM_NI_INIT_8K_PER_RIGHT__A, 7); if (status < 0) goto error; status = write16(state, OFDM_SC_RA_RAM_NI_INIT_2K_PER_LEFT__A, 7); if (status < 0) goto error; status = write16(state, OFDM_SC_RA_RAM_NI_INIT_2K_PER_RIGHT__A, 1); if (status < 0) goto error; break; case 7000000: bandwidth = DRXK_BANDWIDTH_7MHZ_IN_HZ; status = write16(state, OFDM_SC_RA_RAM_SRMM_FIX_FACT_8K__A, 3491); if (status < 0) goto error; /* cochannel protection for PAL 7 MHz */ status = write16(state, OFDM_SC_RA_RAM_NI_INIT_8K_PER_LEFT__A, 8); if (status < 0) goto error; status = write16(state, OFDM_SC_RA_RAM_NI_INIT_8K_PER_RIGHT__A, 8); if (status < 0) goto error; status = write16(state, OFDM_SC_RA_RAM_NI_INIT_2K_PER_LEFT__A, 4); if (status < 0) goto error; status = write16(state, OFDM_SC_RA_RAM_NI_INIT_2K_PER_RIGHT__A, 1); if (status < 0) goto error; break; case 6000000: bandwidth = DRXK_BANDWIDTH_6MHZ_IN_HZ; status = write16(state, OFDM_SC_RA_RAM_SRMM_FIX_FACT_8K__A, 4073); if (status < 0) goto error; /* cochannel protection for NTSC 6 MHz */ status = write16(state, OFDM_SC_RA_RAM_NI_INIT_8K_PER_LEFT__A, 19); if (status < 0) goto error; status = write16(state, OFDM_SC_RA_RAM_NI_INIT_8K_PER_RIGHT__A, 19); if (status < 0) goto error; status = write16(state, OFDM_SC_RA_RAM_NI_INIT_2K_PER_LEFT__A, 14); if (status < 0) goto error; status = write16(state, OFDM_SC_RA_RAM_NI_INIT_2K_PER_RIGHT__A, 1); if (status < 0) goto error; break; default: status = -EINVAL; goto error; } if (iqm_rc_rate_ofs == 0) { /* Now compute IQM_RC_RATE_OFS (((SysFreq/BandWidth)/2)/2) -1) * 2^23) => ((SysFreq / BandWidth) * (2^21)) - (2^23) */ /* (SysFreq / BandWidth) * (2^28) */ /* * assert (MAX(sysClk)/MIN(bandwidth) < 16) * => assert(MAX(sysClk) < 16*MIN(bandwidth)) * => assert(109714272 > 48000000) = true * so Frac 28 can be used */ iqm_rc_rate_ofs = Frac28a((u32) ((state->m_sys_clock_freq * 1000) / 3), bandwidth); /* (SysFreq / BandWidth) * (2^21), rounding before truncating */ if ((iqm_rc_rate_ofs & 0x7fL) >= 0x40) iqm_rc_rate_ofs += 0x80L; iqm_rc_rate_ofs = iqm_rc_rate_ofs >> 7; /* ((SysFreq / BandWidth) * (2^21)) - (2^23) */ iqm_rc_rate_ofs = iqm_rc_rate_ofs - (1 << 23); } iqm_rc_rate_ofs &= ((((u32) IQM_RC_RATE_OFS_HI__M) << IQM_RC_RATE_OFS_LO__W) | IQM_RC_RATE_OFS_LO__M); status = write32(state, IQM_RC_RATE_OFS_LO__A, iqm_rc_rate_ofs); if (status < 0) goto error; /* Bandwidth setting done */ #if 0 status = dvbt_set_frequency_shift(demod, channel, tuner_offset); if (status < 0) goto error; #endif status = set_frequency_shifter(state, intermediate_freqk_hz, tuner_freq_offset, true); if (status < 0) goto error; /*== start SC, write channel settings to SC ==========================*/ /* Activate SCU to enable SCU commands */ status = write16(state, SCU_COMM_EXEC__A, SCU_COMM_EXEC_ACTIVE); if (status < 0) goto error; /* Enable SC after setting all other parameters */ status = write16(state, OFDM_SC_COMM_STATE__A, 0); if (status < 0) goto error; status = write16(state, OFDM_SC_COMM_EXEC__A, 1); if (status < 0) goto error; status = scu_command(state, SCU_RAM_COMMAND_STANDARD_OFDM | SCU_RAM_COMMAND_CMD_DEMOD_START, 0, NULL, 1, &cmd_result); if (status < 0) goto error; /* Write SC parameter registers, set all AUTO flags in operation mode */ param1 = (OFDM_SC_RA_RAM_OP_AUTO_MODE__M | OFDM_SC_RA_RAM_OP_AUTO_GUARD__M | OFDM_SC_RA_RAM_OP_AUTO_CONST__M | OFDM_SC_RA_RAM_OP_AUTO_HIER__M | OFDM_SC_RA_RAM_OP_AUTO_RATE__M); status = dvbt_sc_command(state, OFDM_SC_RA_RAM_CMD_SET_PREF_PARAM, 0, transmission_params, param1, 0, 0, 0); if (status < 0) goto error; if (!state->m_drxk_a3_rom_code) status = dvbt_ctrl_set_sqi_speed(state, &state->m_sqi_speed); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief Retrieve lock status . * \param demod Pointer to demodulator instance. * \param lockStat Pointer to lock status structure. * \return DRXStatus_t. * */ static int get_dvbt_lock_status(struct drxk_state *state, u32 *p_lock_status) { int status; const u16 mpeg_lock_mask = (OFDM_SC_RA_RAM_LOCK_MPEG__M | OFDM_SC_RA_RAM_LOCK_FEC__M); const u16 fec_lock_mask = (OFDM_SC_RA_RAM_LOCK_FEC__M); const u16 demod_lock_mask = OFDM_SC_RA_RAM_LOCK_DEMOD__M; u16 sc_ra_ram_lock = 0; u16 sc_comm_exec = 0; dprintk(1, "\n"); *p_lock_status = NOT_LOCKED; /* driver 0.9.0 */ /* Check if SC is running */ status = read16(state, OFDM_SC_COMM_EXEC__A, &sc_comm_exec); if (status < 0) goto end; if (sc_comm_exec == OFDM_SC_COMM_EXEC_STOP) goto end; status = read16(state, OFDM_SC_RA_RAM_LOCK__A, &sc_ra_ram_lock); if (status < 0) goto end; if ((sc_ra_ram_lock & mpeg_lock_mask) == mpeg_lock_mask) *p_lock_status = MPEG_LOCK; else if ((sc_ra_ram_lock & fec_lock_mask) == fec_lock_mask) *p_lock_status = FEC_LOCK; else if ((sc_ra_ram_lock & demod_lock_mask) == demod_lock_mask) *p_lock_status = DEMOD_LOCK; else if (sc_ra_ram_lock & OFDM_SC_RA_RAM_LOCK_NODVBT__M) *p_lock_status = NEVER_LOCK; end: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int power_up_qam(struct drxk_state *state) { enum drx_power_mode power_mode = DRXK_POWER_DOWN_OFDM; int status; dprintk(1, "\n"); status = ctrl_power_mode(state, &power_mode); if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /** Power Down QAM */ static int power_down_qam(struct drxk_state *state) { u16 data = 0; u16 cmd_result; int status = 0; dprintk(1, "\n"); status = read16(state, SCU_COMM_EXEC__A, &data); if (status < 0) goto error; if (data == SCU_COMM_EXEC_ACTIVE) { /* STOP demodulator QAM and HW blocks */ /* stop all comstate->m_exec */ status = write16(state, QAM_COMM_EXEC__A, QAM_COMM_EXEC_STOP); if (status < 0) goto error; status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | SCU_RAM_COMMAND_CMD_DEMOD_STOP, 0, NULL, 1, &cmd_result); if (status < 0) goto error; } /* powerdown AFE */ status = set_iqm_af(state, false); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief Setup of the QAM Measurement intervals for signal quality * \param demod instance of demod. * \param modulation current modulation. * \return DRXStatus_t. * * NOTE: * Take into account that for certain settings the errorcounters can overflow. * The implementation does not check this. * */ static int set_qam_measurement(struct drxk_state *state, enum e_drxk_constellation modulation, u32 symbol_rate) { u32 fec_bits_desired = 0; /* BER accounting period */ u32 fec_rs_period_total = 0; /* Total period */ u16 fec_rs_prescale = 0; /* ReedSolomon Measurement Prescale */ u16 fec_rs_period = 0; /* Value for corresponding I2C register */ int status = 0; dprintk(1, "\n"); fec_rs_prescale = 1; /* fec_bits_desired = symbol_rate [kHz] * FrameLenght [ms] * (modulation + 1) * SyncLoss (== 1) * ViterbiLoss (==1) */ switch (modulation) { case DRX_CONSTELLATION_QAM16: fec_bits_desired = 4 * symbol_rate; break; case DRX_CONSTELLATION_QAM32: fec_bits_desired = 5 * symbol_rate; break; case DRX_CONSTELLATION_QAM64: fec_bits_desired = 6 * symbol_rate; break; case DRX_CONSTELLATION_QAM128: fec_bits_desired = 7 * symbol_rate; break; case DRX_CONSTELLATION_QAM256: fec_bits_desired = 8 * symbol_rate; break; default: status = -EINVAL; } if (status < 0) goto error; fec_bits_desired /= 1000; /* symbol_rate [Hz] -> symbol_rate [kHz] */ fec_bits_desired *= 500; /* meas. period [ms] */ /* Annex A/C: bits/RsPeriod = 204 * 8 = 1632 */ /* fec_rs_period_total = fec_bits_desired / 1632 */ fec_rs_period_total = (fec_bits_desired / 1632UL) + 1; /* roughly ceil */ /* fec_rs_period_total = fec_rs_prescale * fec_rs_period */ fec_rs_prescale = 1 + (u16) (fec_rs_period_total >> 16); if (fec_rs_prescale == 0) { /* Divide by zero (though impossible) */ status = -EINVAL; if (status < 0) goto error; } fec_rs_period = ((u16) fec_rs_period_total + (fec_rs_prescale >> 1)) / fec_rs_prescale; /* write corresponding registers */ status = write16(state, FEC_RS_MEASUREMENT_PERIOD__A, fec_rs_period); if (status < 0) goto error; status = write16(state, FEC_RS_MEASUREMENT_PRESCALE__A, fec_rs_prescale); if (status < 0) goto error; status = write16(state, FEC_OC_SNC_FAIL_PERIOD__A, fec_rs_period); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int set_qam16(struct drxk_state *state) { int status = 0; dprintk(1, "\n"); /* QAM Equalizer Setup */ /* Equalizer */ status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD0__A, 13517); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD1__A, 13517); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD2__A, 13517); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD3__A, 13517); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD4__A, 13517); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD5__A, 13517); if (status < 0) goto error; /* Decision Feedback Equalizer */ status = write16(state, QAM_DQ_QUAL_FUN0__A, 2); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN1__A, 2); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN2__A, 2); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN3__A, 2); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN4__A, 2); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN5__A, 0); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_HWM__A, 5); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_AWM__A, 4); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_LWM__A, 3); if (status < 0) goto error; /* QAM Slicer Settings */ status = write16(state, SCU_RAM_QAM_SL_SIG_POWER__A, DRXK_QAM_SL_SIG_POWER_QAM16); if (status < 0) goto error; /* QAM Loop Controller Coeficients */ status = write16(state, SCU_RAM_QAM_LC_CA_FINE__A, 15); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CA_COARSE__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_FINE__A, 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_MEDIUM__A, 24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_COARSE__A, 24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_FINE__A, 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_MEDIUM__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_COARSE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_MEDIUM__A, 20); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_COARSE__A, 80); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_MEDIUM__A, 20); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_COARSE__A, 50); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_FINE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_MEDIUM__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_COARSE__A, 32); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_MEDIUM__A, 10); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_COARSE__A, 10); if (status < 0) goto error; /* QAM State Machine (FSM) Thresholds */ status = write16(state, SCU_RAM_QAM_FSM_RTH__A, 140); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_FTH__A, 50); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_CTH__A, 95); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_PTH__A, 120); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_QTH__A, 230); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_MTH__A, 105); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_RATE_LIM__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_COUNT_LIM__A, 4); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_FREQ_LIM__A, 24); if (status < 0) goto error; /* QAM FSM Tracking Parameters */ status = write16(state, SCU_RAM_QAM_FSM_MEDIAN_AV_MULT__A, (u16) 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_RADIUS_AV_LIMIT__A, (u16) 220); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET1__A, (u16) 25); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET2__A, (u16) 6); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET3__A, (u16) -24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET4__A, (u16) -65); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET5__A, (u16) -127); if (status < 0) goto error; error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief QAM32 specific setup * \param demod instance of demod. * \return DRXStatus_t. */ static int set_qam32(struct drxk_state *state) { int status = 0; dprintk(1, "\n"); /* QAM Equalizer Setup */ /* Equalizer */ status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD0__A, 6707); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD1__A, 6707); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD2__A, 6707); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD3__A, 6707); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD4__A, 6707); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD5__A, 6707); if (status < 0) goto error; /* Decision Feedback Equalizer */ status = write16(state, QAM_DQ_QUAL_FUN0__A, 3); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN1__A, 3); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN2__A, 3); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN3__A, 3); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN4__A, 3); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN5__A, 0); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_HWM__A, 6); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_AWM__A, 5); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_LWM__A, 3); if (status < 0) goto error; /* QAM Slicer Settings */ status = write16(state, SCU_RAM_QAM_SL_SIG_POWER__A, DRXK_QAM_SL_SIG_POWER_QAM32); if (status < 0) goto error; /* QAM Loop Controller Coeficients */ status = write16(state, SCU_RAM_QAM_LC_CA_FINE__A, 15); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CA_COARSE__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_FINE__A, 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_MEDIUM__A, 24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_COARSE__A, 24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_FINE__A, 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_MEDIUM__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_COARSE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_MEDIUM__A, 20); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_COARSE__A, 80); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_MEDIUM__A, 20); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_COARSE__A, 50); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_FINE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_MEDIUM__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_COARSE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_MEDIUM__A, 10); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_COARSE__A, 0); if (status < 0) goto error; /* QAM State Machine (FSM) Thresholds */ status = write16(state, SCU_RAM_QAM_FSM_RTH__A, 90); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_FTH__A, 50); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_CTH__A, 80); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_PTH__A, 100); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_QTH__A, 170); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_MTH__A, 100); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_RATE_LIM__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_COUNT_LIM__A, 4); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_FREQ_LIM__A, 10); if (status < 0) goto error; /* QAM FSM Tracking Parameters */ status = write16(state, SCU_RAM_QAM_FSM_MEDIAN_AV_MULT__A, (u16) 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_RADIUS_AV_LIMIT__A, (u16) 140); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET1__A, (u16) -8); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET2__A, (u16) -16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET3__A, (u16) -26); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET4__A, (u16) -56); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET5__A, (u16) -86); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief QAM64 specific setup * \param demod instance of demod. * \return DRXStatus_t. */ static int set_qam64(struct drxk_state *state) { int status = 0; dprintk(1, "\n"); /* QAM Equalizer Setup */ /* Equalizer */ status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD0__A, 13336); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD1__A, 12618); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD2__A, 11988); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD3__A, 13809); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD4__A, 13809); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD5__A, 15609); if (status < 0) goto error; /* Decision Feedback Equalizer */ status = write16(state, QAM_DQ_QUAL_FUN0__A, 4); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN1__A, 4); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN2__A, 4); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN3__A, 4); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN4__A, 3); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN5__A, 0); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_HWM__A, 5); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_AWM__A, 4); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_LWM__A, 3); if (status < 0) goto error; /* QAM Slicer Settings */ status = write16(state, SCU_RAM_QAM_SL_SIG_POWER__A, DRXK_QAM_SL_SIG_POWER_QAM64); if (status < 0) goto error; /* QAM Loop Controller Coeficients */ status = write16(state, SCU_RAM_QAM_LC_CA_FINE__A, 15); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CA_COARSE__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_FINE__A, 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_MEDIUM__A, 24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_COARSE__A, 24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_FINE__A, 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_MEDIUM__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_COARSE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_MEDIUM__A, 30); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_COARSE__A, 100); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_MEDIUM__A, 30); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_COARSE__A, 50); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_FINE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_MEDIUM__A, 25); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_COARSE__A, 48); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_MEDIUM__A, 10); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_COARSE__A, 10); if (status < 0) goto error; /* QAM State Machine (FSM) Thresholds */ status = write16(state, SCU_RAM_QAM_FSM_RTH__A, 100); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_FTH__A, 60); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_CTH__A, 80); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_PTH__A, 110); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_QTH__A, 200); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_MTH__A, 95); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_RATE_LIM__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_COUNT_LIM__A, 4); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_FREQ_LIM__A, 15); if (status < 0) goto error; /* QAM FSM Tracking Parameters */ status = write16(state, SCU_RAM_QAM_FSM_MEDIAN_AV_MULT__A, (u16) 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_RADIUS_AV_LIMIT__A, (u16) 141); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET1__A, (u16) 7); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET2__A, (u16) 0); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET3__A, (u16) -15); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET4__A, (u16) -45); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET5__A, (u16) -80); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief QAM128 specific setup * \param demod: instance of demod. * \return DRXStatus_t. */ static int set_qam128(struct drxk_state *state) { int status = 0; dprintk(1, "\n"); /* QAM Equalizer Setup */ /* Equalizer */ status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD0__A, 6564); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD1__A, 6598); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD2__A, 6394); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD3__A, 6409); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD4__A, 6656); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD5__A, 7238); if (status < 0) goto error; /* Decision Feedback Equalizer */ status = write16(state, QAM_DQ_QUAL_FUN0__A, 6); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN1__A, 6); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN2__A, 6); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN3__A, 6); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN4__A, 5); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN5__A, 0); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_HWM__A, 6); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_AWM__A, 5); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_LWM__A, 3); if (status < 0) goto error; /* QAM Slicer Settings */ status = write16(state, SCU_RAM_QAM_SL_SIG_POWER__A, DRXK_QAM_SL_SIG_POWER_QAM128); if (status < 0) goto error; /* QAM Loop Controller Coeficients */ status = write16(state, SCU_RAM_QAM_LC_CA_FINE__A, 15); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CA_COARSE__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_FINE__A, 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_MEDIUM__A, 24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_COARSE__A, 24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_FINE__A, 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_MEDIUM__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_COARSE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_MEDIUM__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_COARSE__A, 120); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_MEDIUM__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_COARSE__A, 60); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_FINE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_MEDIUM__A, 25); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_COARSE__A, 64); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_MEDIUM__A, 10); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_COARSE__A, 0); if (status < 0) goto error; /* QAM State Machine (FSM) Thresholds */ status = write16(state, SCU_RAM_QAM_FSM_RTH__A, 50); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_FTH__A, 60); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_CTH__A, 80); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_PTH__A, 100); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_QTH__A, 140); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_MTH__A, 100); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_RATE_LIM__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_COUNT_LIM__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_FREQ_LIM__A, 12); if (status < 0) goto error; /* QAM FSM Tracking Parameters */ status = write16(state, SCU_RAM_QAM_FSM_MEDIAN_AV_MULT__A, (u16) 8); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_RADIUS_AV_LIMIT__A, (u16) 65); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET1__A, (u16) 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET2__A, (u16) 3); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET3__A, (u16) -1); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET4__A, (u16) -12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET5__A, (u16) -23); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief QAM256 specific setup * \param demod: instance of demod. * \return DRXStatus_t. */ static int set_qam256(struct drxk_state *state) { int status = 0; dprintk(1, "\n"); /* QAM Equalizer Setup */ /* Equalizer */ status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD0__A, 11502); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD1__A, 12084); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD2__A, 12543); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD3__A, 12931); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD4__A, 13629); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_EQ_CMA_RAD5__A, 15385); if (status < 0) goto error; /* Decision Feedback Equalizer */ status = write16(state, QAM_DQ_QUAL_FUN0__A, 8); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN1__A, 8); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN2__A, 8); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN3__A, 8); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN4__A, 6); if (status < 0) goto error; status = write16(state, QAM_DQ_QUAL_FUN5__A, 0); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_HWM__A, 5); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_AWM__A, 4); if (status < 0) goto error; status = write16(state, QAM_SY_SYNC_LWM__A, 3); if (status < 0) goto error; /* QAM Slicer Settings */ status = write16(state, SCU_RAM_QAM_SL_SIG_POWER__A, DRXK_QAM_SL_SIG_POWER_QAM256); if (status < 0) goto error; /* QAM Loop Controller Coeficients */ status = write16(state, SCU_RAM_QAM_LC_CA_FINE__A, 15); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CA_COARSE__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_FINE__A, 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_MEDIUM__A, 24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EP_COARSE__A, 24); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_FINE__A, 12); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_MEDIUM__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_EI_COARSE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_MEDIUM__A, 50); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CP_COARSE__A, 250); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_MEDIUM__A, 50); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CI_COARSE__A, 125); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_FINE__A, 16); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_MEDIUM__A, 25); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF_COARSE__A, 48); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_FINE__A, 5); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_MEDIUM__A, 10); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_LC_CF1_COARSE__A, 10); if (status < 0) goto error; /* QAM State Machine (FSM) Thresholds */ status = write16(state, SCU_RAM_QAM_FSM_RTH__A, 50); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_FTH__A, 60); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_CTH__A, 80); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_PTH__A, 100); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_QTH__A, 150); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_MTH__A, 110); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_RATE_LIM__A, 40); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_COUNT_LIM__A, 4); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_FREQ_LIM__A, 12); if (status < 0) goto error; /* QAM FSM Tracking Parameters */ status = write16(state, SCU_RAM_QAM_FSM_MEDIAN_AV_MULT__A, (u16) 8); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_RADIUS_AV_LIMIT__A, (u16) 74); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET1__A, (u16) 18); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET2__A, (u16) 13); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET3__A, (u16) 7); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET4__A, (u16) 0); if (status < 0) goto error; status = write16(state, SCU_RAM_QAM_FSM_LCAVG_OFFSET5__A, (u16) -8); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief Reset QAM block. * \param demod: instance of demod. * \param channel: pointer to channel data. * \return DRXStatus_t. */ static int qam_reset_qam(struct drxk_state *state) { int status; u16 cmd_result; dprintk(1, "\n"); /* Stop QAM comstate->m_exec */ status = write16(state, QAM_COMM_EXEC__A, QAM_COMM_EXEC_STOP); if (status < 0) goto error; status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | SCU_RAM_COMMAND_CMD_DEMOD_RESET, 0, NULL, 1, &cmd_result); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief Set QAM symbolrate. * \param demod: instance of demod. * \param channel: pointer to channel data. * \return DRXStatus_t. */ static int qam_set_symbolrate(struct drxk_state *state) { u32 adc_frequency = 0; u32 symb_freq = 0; u32 iqm_rc_rate = 0; u16 ratesel = 0; u32 lc_symb_rate = 0; int status; dprintk(1, "\n"); /* Select & calculate correct IQM rate */ adc_frequency = (state->m_sys_clock_freq * 1000) / 3; ratesel = 0; /* printk(KERN_DEBUG "drxk: SR %d\n", state->props.symbol_rate); */ if (state->props.symbol_rate <= 1188750) ratesel = 3; else if (state->props.symbol_rate <= 2377500) ratesel = 2; else if (state->props.symbol_rate <= 4755000) ratesel = 1; status = write16(state, IQM_FD_RATESEL__A, ratesel); if (status < 0) goto error; /* IqmRcRate = ((Fadc / (symbolrate * (4<<ratesel))) - 1) * (1<<23) */ symb_freq = state->props.symbol_rate * (1 << ratesel); if (symb_freq == 0) { /* Divide by zero */ status = -EINVAL; goto error; } iqm_rc_rate = (adc_frequency / symb_freq) * (1 << 21) + (Frac28a((adc_frequency % symb_freq), symb_freq) >> 7) - (1 << 23); status = write32(state, IQM_RC_RATE_OFS_LO__A, iqm_rc_rate); if (status < 0) goto error; state->m_iqm_rc_rate = iqm_rc_rate; /* LcSymbFreq = round (.125 * symbolrate / adc_freq * (1<<15)) */ symb_freq = state->props.symbol_rate; if (adc_frequency == 0) { /* Divide by zero */ status = -EINVAL; goto error; } lc_symb_rate = (symb_freq / adc_frequency) * (1 << 12) + (Frac28a((symb_freq % adc_frequency), adc_frequency) >> 16); if (lc_symb_rate > 511) lc_symb_rate = 511; status = write16(state, QAM_LC_SYMBOL_FREQ__A, (u16) lc_symb_rate); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } /*============================================================================*/ /** * \brief Get QAM lock status. * \param demod: instance of demod. * \param channel: pointer to channel data. * \return DRXStatus_t. */ static int get_qam_lock_status(struct drxk_state *state, u32 *p_lock_status) { int status; u16 result[2] = { 0, 0 }; dprintk(1, "\n"); *p_lock_status = NOT_LOCKED; status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | SCU_RAM_COMMAND_CMD_DEMOD_GET_LOCK, 0, NULL, 2, result); if (status < 0) pr_err("Error %d on %s\n", status, __func__); if (result[1] < SCU_RAM_QAM_LOCKED_LOCKED_DEMOD_LOCKED) { /* 0x0000 NOT LOCKED */ } else if (result[1] < SCU_RAM_QAM_LOCKED_LOCKED_LOCKED) { /* 0x4000 DEMOD LOCKED */ *p_lock_status = DEMOD_LOCK; } else if (result[1] < SCU_RAM_QAM_LOCKED_LOCKED_NEVER_LOCK) { /* 0x8000 DEMOD + FEC LOCKED (system lock) */ *p_lock_status = MPEG_LOCK; } else { /* 0xC000 NEVER LOCKED */ /* (system will never be able to lock to the signal) */ /* * TODO: check this, intermediate & standard specific lock * states are not taken into account here */ *p_lock_status = NEVER_LOCK; } return status; } #define QAM_MIRROR__M 0x03 #define QAM_MIRROR_NORMAL 0x00 #define QAM_MIRRORED 0x01 #define QAM_MIRROR_AUTO_ON 0x02 #define QAM_LOCKRANGE__M 0x10 #define QAM_LOCKRANGE_NORMAL 0x10 static int qam_demodulator_command(struct drxk_state *state, int number_of_parameters) { int status; u16 cmd_result; u16 set_param_parameters[4] = { 0, 0, 0, 0 }; set_param_parameters[0] = state->m_constellation; /* modulation */ set_param_parameters[1] = DRXK_QAM_I12_J17; /* interleave mode */ if (number_of_parameters == 2) { u16 set_env_parameters[1] = { 0 }; if (state->m_operation_mode == OM_QAM_ITU_C) set_env_parameters[0] = QAM_TOP_ANNEX_C; else set_env_parameters[0] = QAM_TOP_ANNEX_A; status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | SCU_RAM_COMMAND_CMD_DEMOD_SET_ENV, 1, set_env_parameters, 1, &cmd_result); if (status < 0) goto error; status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | SCU_RAM_COMMAND_CMD_DEMOD_SET_PARAM, number_of_parameters, set_param_parameters, 1, &cmd_result); } else if (number_of_parameters == 4) { if (state->m_operation_mode == OM_QAM_ITU_C) set_param_parameters[2] = QAM_TOP_ANNEX_C; else set_param_parameters[2] = QAM_TOP_ANNEX_A; set_param_parameters[3] |= (QAM_MIRROR_AUTO_ON); /* Env parameters */ /* check for LOCKRANGE Extented */ /* set_param_parameters[3] |= QAM_LOCKRANGE_NORMAL; */ status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | SCU_RAM_COMMAND_CMD_DEMOD_SET_PARAM, number_of_parameters, set_param_parameters, 1, &cmd_result); } else { pr_warn("Unknown QAM demodulator parameter count %d\n", number_of_parameters); status = -EINVAL; } error: if (status < 0) pr_warn("Warning %d on %s\n", status, __func__); return status; } static int set_qam(struct drxk_state *state, u16 intermediate_freqk_hz, s32 tuner_freq_offset) { int status; u16 cmd_result; int qam_demod_param_count = state->qam_demod_parameter_count; dprintk(1, "\n"); /* * STEP 1: reset demodulator * resets FEC DI and FEC RS * resets QAM block * resets SCU variables */ status = write16(state, FEC_DI_COMM_EXEC__A, FEC_DI_COMM_EXEC_STOP); if (status < 0) goto error; status = write16(state, FEC_RS_COMM_EXEC__A, FEC_RS_COMM_EXEC_STOP); if (status < 0) goto error; status = qam_reset_qam(state); if (status < 0) goto error; /* * STEP 2: configure demodulator * -set params; resets IQM,QAM,FEC HW; initializes some * SCU variables */ status = qam_set_symbolrate(state); if (status < 0) goto error; /* Set params */ switch (state->props.modulation) { case QAM_256: state->m_constellation = DRX_CONSTELLATION_QAM256; break; case QAM_AUTO: case QAM_64: state->m_constellation = DRX_CONSTELLATION_QAM64; break; case QAM_16: state->m_constellation = DRX_CONSTELLATION_QAM16; break; case QAM_32: state->m_constellation = DRX_CONSTELLATION_QAM32; break; case QAM_128: state->m_constellation = DRX_CONSTELLATION_QAM128; break; default: status = -EINVAL; break; } if (status < 0) goto error; /* Use the 4-parameter if it's requested or we're probing for * the correct command. */ if (state->qam_demod_parameter_count == 4 || !state->qam_demod_parameter_count) { qam_demod_param_count = 4; status = qam_demodulator_command(state, qam_demod_param_count); } /* Use the 2-parameter command if it was requested or if we're * probing for the correct command and the 4-parameter command * failed. */ if (state->qam_demod_parameter_count == 2 || (!state->qam_demod_parameter_count && status < 0)) { qam_demod_param_count = 2; status = qam_demodulator_command(state, qam_demod_param_count); } if (status < 0) { dprintk(1, "Could not set demodulator parameters.\n"); dprintk(1, "Make sure qam_demod_parameter_count (%d) is correct for your firmware (%s).\n", state->qam_demod_parameter_count, state->microcode_name); goto error; } else if (!state->qam_demod_parameter_count) { dprintk(1, "Auto-probing the QAM command parameters was successful - using %d parameters.\n", qam_demod_param_count); /* * One of our commands was successful. We don't need to * auto-probe anymore, now that we got the correct command. */ state->qam_demod_parameter_count = qam_demod_param_count; } /* * STEP 3: enable the system in a mode where the ADC provides valid * signal setup modulation independent registers */ #if 0 status = set_frequency(channel, tuner_freq_offset)); if (status < 0) goto error; #endif status = set_frequency_shifter(state, intermediate_freqk_hz, tuner_freq_offset, true); if (status < 0) goto error; /* Setup BER measurement */ status = set_qam_measurement(state, state->m_constellation, state->props.symbol_rate); if (status < 0) goto error; /* Reset default values */ status = write16(state, IQM_CF_SCALE_SH__A, IQM_CF_SCALE_SH__PRE); if (status < 0) goto error; status = write16(state, QAM_SY_TIMEOUT__A, QAM_SY_TIMEOUT__PRE); if (status < 0) goto error; /* Reset default LC values */ status = write16(state, QAM_LC_RATE_LIMIT__A, 3); if (status < 0) goto error; status = write16(state, QAM_LC_LPF_FACTORP__A, 4); if (status < 0) goto error; status = write16(state, QAM_LC_LPF_FACTORI__A, 4); if (status < 0) goto error; status = write16(state, QAM_LC_MODE__A, 7); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB0__A, 1); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB1__A, 1); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB2__A, 1); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB3__A, 1); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB4__A, 2); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB5__A, 2); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB6__A, 2); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB8__A, 2); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB9__A, 2); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB10__A, 2); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB12__A, 2); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB15__A, 3); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB16__A, 3); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB20__A, 4); if (status < 0) goto error; status = write16(state, QAM_LC_QUAL_TAB25__A, 4); if (status < 0) goto error; /* Mirroring, QAM-block starting point not inverted */ status = write16(state, QAM_SY_SP_INV__A, QAM_SY_SP_INV_SPECTRUM_INV_DIS); if (status < 0) goto error; /* Halt SCU to enable safe non-atomic accesses */ status = write16(state, SCU_COMM_EXEC__A, SCU_COMM_EXEC_HOLD); if (status < 0) goto error; /* STEP 4: modulation specific setup */ switch (state->props.modulation) { case QAM_16: status = set_qam16(state); break; case QAM_32: status = set_qam32(state); break; case QAM_AUTO: case QAM_64: status = set_qam64(state); break; case QAM_128: status = set_qam128(state); break; case QAM_256: status = set_qam256(state); break; default: status = -EINVAL; break; } if (status < 0) goto error; /* Activate SCU to enable SCU commands */ status = write16(state, SCU_COMM_EXEC__A, SCU_COMM_EXEC_ACTIVE); if (status < 0) goto error; /* Re-configure MPEG output, requires knowledge of channel bitrate */ /* extAttr->currentChannel.modulation = channel->modulation; */ /* extAttr->currentChannel.symbolrate = channel->symbolrate; */ status = mpegts_dto_setup(state, state->m_operation_mode); if (status < 0) goto error; /* start processes */ status = mpegts_start(state); if (status < 0) goto error; status = write16(state, FEC_COMM_EXEC__A, FEC_COMM_EXEC_ACTIVE); if (status < 0) goto error; status = write16(state, QAM_COMM_EXEC__A, QAM_COMM_EXEC_ACTIVE); if (status < 0) goto error; status = write16(state, IQM_COMM_EXEC__A, IQM_COMM_EXEC_B_ACTIVE); if (status < 0) goto error; /* STEP 5: start QAM demodulator (starts FEC, QAM and IQM HW) */ status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | SCU_RAM_COMMAND_CMD_DEMOD_START, 0, NULL, 1, &cmd_result); if (status < 0) goto error; /* update global DRXK data container */ /*? extAttr->qamInterleaveMode = DRXK_QAM_I12_J17; */ error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int set_qam_standard(struct drxk_state *state, enum operation_mode o_mode) { int status; #ifdef DRXK_QAM_TAPS #define DRXK_QAMA_TAPS_SELECT #include "drxk_filters.h" #undef DRXK_QAMA_TAPS_SELECT #endif dprintk(1, "\n"); /* added antenna switch */ switch_antenna_to_qam(state); /* Ensure correct power-up mode */ status = power_up_qam(state); if (status < 0) goto error; /* Reset QAM block */ status = qam_reset_qam(state); if (status < 0) goto error; /* Setup IQM */ status = write16(state, IQM_COMM_EXEC__A, IQM_COMM_EXEC_B_STOP); if (status < 0) goto error; status = write16(state, IQM_AF_AMUX__A, IQM_AF_AMUX_SIGNAL2ADC); if (status < 0) goto error; /* Upload IQM Channel Filter settings by boot loader from ROM table */ switch (o_mode) { case OM_QAM_ITU_A: status = bl_chain_cmd(state, DRXK_BL_ROM_OFFSET_TAPS_ITU_A, DRXK_BLCC_NR_ELEMENTS_TAPS, DRXK_BLC_TIMEOUT); break; case OM_QAM_ITU_C: status = bl_direct_cmd(state, IQM_CF_TAP_RE0__A, DRXK_BL_ROM_OFFSET_TAPS_ITU_C, DRXK_BLDC_NR_ELEMENTS_TAPS, DRXK_BLC_TIMEOUT); if (status < 0) goto error; status = bl_direct_cmd(state, IQM_CF_TAP_IM0__A, DRXK_BL_ROM_OFFSET_TAPS_ITU_C, DRXK_BLDC_NR_ELEMENTS_TAPS, DRXK_BLC_TIMEOUT); break; default: status = -EINVAL; } if (status < 0) goto error; status = write16(state, IQM_CF_OUT_ENA__A, 1 << IQM_CF_OUT_ENA_QAM__B); if (status < 0) goto error; status = write16(state, IQM_CF_SYMMETRIC__A, 0); if (status < 0) goto error; status = write16(state, IQM_CF_MIDTAP__A, ((1 << IQM_CF_MIDTAP_RE__B) | (1 << IQM_CF_MIDTAP_IM__B))); if (status < 0) goto error; status = write16(state, IQM_RC_STRETCH__A, 21); if (status < 0) goto error; status = write16(state, IQM_AF_CLP_LEN__A, 0); if (status < 0) goto error; status = write16(state, IQM_AF_CLP_TH__A, 448); if (status < 0) goto error; status = write16(state, IQM_AF_SNS_LEN__A, 0); if (status < 0) goto error; status = write16(state, IQM_CF_POW_MEAS_LEN__A, 0); if (status < 0) goto error; status = write16(state, IQM_FS_ADJ_SEL__A, 1); if (status < 0) goto error; status = write16(state, IQM_RC_ADJ_SEL__A, 1); if (status < 0) goto error; status = write16(state, IQM_CF_ADJ_SEL__A, 1); if (status < 0) goto error; status = write16(state, IQM_AF_UPD_SEL__A, 0); if (status < 0) goto error; /* IQM Impulse Noise Processing Unit */ status = write16(state, IQM_CF_CLP_VAL__A, 500); if (status < 0) goto error; status = write16(state, IQM_CF_DATATH__A, 1000); if (status < 0) goto error; status = write16(state, IQM_CF_BYPASSDET__A, 1); if (status < 0) goto error; status = write16(state, IQM_CF_DET_LCT__A, 0); if (status < 0) goto error; status = write16(state, IQM_CF_WND_LEN__A, 1); if (status < 0) goto error; status = write16(state, IQM_CF_PKDTH__A, 1); if (status < 0) goto error; status = write16(state, IQM_AF_INC_BYPASS__A, 1); if (status < 0) goto error; /* turn on IQMAF. Must be done before setAgc**() */ status = set_iqm_af(state, true); if (status < 0) goto error; status = write16(state, IQM_AF_START_LOCK__A, 0x01); if (status < 0) goto error; /* IQM will not be reset from here, sync ADC and update/init AGC */ status = adc_synchronization(state); if (status < 0) goto error; /* Set the FSM step period */ status = write16(state, SCU_RAM_QAM_FSM_STEP_PERIOD__A, 2000); if (status < 0) goto error; /* Halt SCU to enable safe non-atomic accesses */ status = write16(state, SCU_COMM_EXEC__A, SCU_COMM_EXEC_HOLD); if (status < 0) goto error; /* No more resets of the IQM, current standard correctly set => now AGCs can be configured. */ status = init_agc(state, true); if (status < 0) goto error; status = set_pre_saw(state, &(state->m_qam_pre_saw_cfg)); if (status < 0) goto error; /* Configure AGC's */ status = set_agc_rf(state, &(state->m_qam_rf_agc_cfg), true); if (status < 0) goto error; status = set_agc_if(state, &(state->m_qam_if_agc_cfg), true); if (status < 0) goto error; /* Activate SCU to enable SCU commands */ status = write16(state, SCU_COMM_EXEC__A, SCU_COMM_EXEC_ACTIVE); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int write_gpio(struct drxk_state *state) { int status; u16 value = 0; dprintk(1, "\n"); /* stop lock indicator process */ status = write16(state, SCU_RAM_GPIO__A, SCU_RAM_GPIO_HW_LOCK_IND_DISABLE); if (status < 0) goto error; /* Write magic word to enable pdr reg write */ status = write16(state, SIO_TOP_COMM_KEY__A, SIO_TOP_COMM_KEY_KEY); if (status < 0) goto error; if (state->m_has_sawsw) { if (state->uio_mask & 0x0001) { /* UIO-1 */ /* write to io pad configuration register - output mode */ status = write16(state, SIO_PDR_SMA_TX_CFG__A, state->m_gpio_cfg); if (status < 0) goto error; /* use corresponding bit in io data output registar */ status = read16(state, SIO_PDR_UIO_OUT_LO__A, &value); if (status < 0) goto error; if ((state->m_gpio & 0x0001) == 0) value &= 0x7FFF; /* write zero to 15th bit - 1st UIO */ else value |= 0x8000; /* write one to 15th bit - 1st UIO */ /* write back to io data output register */ status = write16(state, SIO_PDR_UIO_OUT_LO__A, value); if (status < 0) goto error; } if (state->uio_mask & 0x0002) { /* UIO-2 */ /* write to io pad configuration register - output mode */ status = write16(state, SIO_PDR_SMA_RX_CFG__A, state->m_gpio_cfg); if (status < 0) goto error; /* use corresponding bit in io data output registar */ status = read16(state, SIO_PDR_UIO_OUT_LO__A, &value); if (status < 0) goto error; if ((state->m_gpio & 0x0002) == 0) value &= 0xBFFF; /* write zero to 14th bit - 2st UIO */ else value |= 0x4000; /* write one to 14th bit - 2st UIO */ /* write back to io data output register */ status = write16(state, SIO_PDR_UIO_OUT_LO__A, value); if (status < 0) goto error; } if (state->uio_mask & 0x0004) { /* UIO-3 */ /* write to io pad configuration register - output mode */ status = write16(state, SIO_PDR_GPIO_CFG__A, state->m_gpio_cfg); if (status < 0) goto error; /* use corresponding bit in io data output registar */ status = read16(state, SIO_PDR_UIO_OUT_LO__A, &value); if (status < 0) goto error; if ((state->m_gpio & 0x0004) == 0) value &= 0xFFFB; /* write zero to 2nd bit - 3rd UIO */ else value |= 0x0004; /* write one to 2nd bit - 3rd UIO */ /* write back to io data output register */ status = write16(state, SIO_PDR_UIO_OUT_LO__A, value); if (status < 0) goto error; } } /* Write magic word to disable pdr reg write */ status = write16(state, SIO_TOP_COMM_KEY__A, 0x0000); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int switch_antenna_to_qam(struct drxk_state *state) { int status = 0; bool gpio_state; dprintk(1, "\n"); if (!state->antenna_gpio) return 0; gpio_state = state->m_gpio & state->antenna_gpio; if (state->antenna_dvbt ^ gpio_state) { /* Antenna is on DVB-T mode. Switch */ if (state->antenna_dvbt) state->m_gpio &= ~state->antenna_gpio; else state->m_gpio |= state->antenna_gpio; status = write_gpio(state); } if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int switch_antenna_to_dvbt(struct drxk_state *state) { int status = 0; bool gpio_state; dprintk(1, "\n"); if (!state->antenna_gpio) return 0; gpio_state = state->m_gpio & state->antenna_gpio; if (!(state->antenna_dvbt ^ gpio_state)) { /* Antenna is on DVB-C mode. Switch */ if (state->antenna_dvbt) state->m_gpio |= state->antenna_gpio; else state->m_gpio &= ~state->antenna_gpio; status = write_gpio(state); } if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int power_down_device(struct drxk_state *state) { /* Power down to requested mode */ /* Backup some register settings */ /* Set pins with possible pull-ups connected to them in input mode */ /* Analog power down */ /* ADC power down */ /* Power down device */ int status; dprintk(1, "\n"); if (state->m_b_p_down_open_bridge) { /* Open I2C bridge before power down of DRXK */ status = ConfigureI2CBridge(state, true); if (status < 0) goto error; } /* driver 0.9.0 */ status = dvbt_enable_ofdm_token_ring(state, false); if (status < 0) goto error; status = write16(state, SIO_CC_PWD_MODE__A, SIO_CC_PWD_MODE_LEVEL_CLOCK); if (status < 0) goto error; status = write16(state, SIO_CC_UPDATE__A, SIO_CC_UPDATE_KEY); if (status < 0) goto error; state->m_hi_cfg_ctrl |= SIO_HI_RA_RAM_PAR_5_CFG_SLEEP_ZZZ; status = hi_cfg_command(state); error: if (status < 0) pr_err("Error %d on %s\n", status, __func__); return status; } static int init_drxk(struct drxk_state *state) { int status = 0, n = 0; enum drx_power_mode power_mode = DRXK_POWER_DOWN_OFDM; u16 driver_version; dprintk(1, "\n"); if ((state->m_drxk_state == DRXK_UNINITIALIZED)) { drxk_i2c_lock(state); status = power_up_device(state); if (status < 0) goto error; status = drxx_open(state); if (status < 0) goto error; /* Soft reset of OFDM-, sys- and osc-clockdomain */ status = write16(state, SIO_CC_SOFT_RST__A, SIO_CC_SOFT_RST_OFDM__M | SIO_CC_SOFT_RST_SYS__M | SIO_CC_SOFT_RST_OSC__M); if (status < 0) goto error; status = write16(state, SIO_CC_UPDATE__A, SIO_CC_UPDATE_KEY); if (status < 0) goto error; /* * TODO is this needed? If yes, how much delay in * worst case scenario */ usleep_range(1000, 2000); state->m_drxk_a3_patch_code = true; status = get_device_capabilities(state); if (status < 0) goto error; /* Bridge delay, uses oscilator clock */ /* Delay = (delay (nano seconds) * oscclk (kHz))/ 1000 */ /* SDA brdige delay */ state->m_hi_cfg_bridge_delay = (u16) ((state->m_osc_clock_freq / 1000) * HI_I2C_BRIDGE_DELAY) / 1000; /* Clipping */ if (state->m_hi_cfg_bridge_delay > SIO_HI_RA_RAM_PAR_3_CFG_DBL_SDA__M) { state->m_hi_cfg_bridge_delay = SIO_HI_RA_RAM_PAR_3_CFG_DBL_SDA__M; } /* SCL bridge delay, same as SDA for now */ state->m_hi_cfg_bridge_delay += state->m_hi_cfg_bridge_delay << SIO_HI_RA_RAM_PAR_3_CFG_DBL_SCL__B; status = init_hi(state); if (status < 0) goto error; /* disable various processes */ #if NOA1ROM if (!(state->m_DRXK_A1_ROM_CODE) && !(state->m_DRXK_A2_ROM_CODE)) #endif { status = write16(state, SCU_RAM_GPIO__A, SCU_RAM_GPIO_HW_LOCK_IND_DISABLE); if (status < 0) goto error; } /* disable MPEG port */ status = mpegts_disable(state); if (status < 0) goto error; /* Stop AUD and SCU */ status = write16(state, AUD_COMM_EXEC__A, AUD_COMM_EXEC_STOP); if (status < 0) goto error; status = write16(state, SCU_COMM_EXEC__A, SCU_COMM_EXEC_STOP); if (status < 0) goto error; /* enable token-ring bus through OFDM block for possible ucode upload */ status = write16(state, SIO_OFDM_SH_OFDM_RING_ENABLE__A, SIO_OFDM_SH_OFDM_RING_ENABLE_ON); if (status < 0) goto error; /* include boot loader section */ status = write16(state, SIO_BL_COMM_EXEC__A, SIO_BL_COMM_EXEC_ACTIVE); if (status < 0) goto error; status = bl_chain_cmd(state, 0, 6, 100); if (status < 0) goto error; if (state->fw) { status = download_microcode(state, state->fw->data, state->fw->size); if (status < 0) goto error; } /* disable token-ring bus through OFDM block for possible ucode upload */ status = write16(state, SIO_OFDM_SH_OFDM_RING_ENABLE__A, SIO_OFDM_SH_OFDM_RING_ENABLE_OFF); if (status < 0) goto error; /* Run SCU for a little while to initialize microcode version numbers */ status = write16(state, SCU_COMM_EXEC__A, SCU_COMM_EXEC_ACTIVE); if (status < 0) goto error; status = drxx_open(state); if (status < 0) goto error; /* added for test */ msleep(30); power_mode = DRXK_POWER_DOWN_OFDM; status = ctrl_power_mode(state, &power_mode); if (status < 0) goto error; /* Stamp driver version number in SCU data RAM in BCD code Done to enable field application engineers to retrieve drxdriver version via I2C from SCU RAM. Not using SCU command interface for SCU register access since no microcode may be present. */ driver_version = (((DRXK_VERSION_MAJOR / 100) % 10) << 12) + (((DRXK_VERSION_MAJOR / 10) % 10) << 8) + ((DRXK_VERSION_MAJOR % 10) << 4) + (DRXK_VERSION_MINOR % 10); status = write16(state, SCU_RAM_DRIVER_VER_HI__A, driver_version); if (status < 0) goto error; driver_version = (((DRXK_VERSION_PATCH / 1000) % 10) << 12) + (((DRXK_VERSION_PATCH / 100) % 10) << 8) + (((DRXK_VERSION_PATCH / 10) % 10) << 4) + (DRXK_VERSION_PATCH % 10); status = write16(state, SCU_RAM_DRIVER_VER_LO__A, driver_version); if (status < 0) goto error; pr_info("DRXK driver version %d.%d.%d\n", DRXK_VERSION_MAJOR, DRXK_VERSION_MINOR, DRXK_VERSION_PATCH); /* * Dirty fix of default values for ROM/PATCH microcode * Dirty because this fix makes it impossible to setup * suitable values before calling DRX_Open. This solution * requires changes to RF AGC speed to be done via the CTRL * function after calling DRX_Open */ /* m_dvbt_rf_agc_cfg.speed = 3; */ /* Reset driver debug flags to 0 */ status = write16(state, SCU_RAM_DRIVER_DEBUG__A, 0); if (status < 0) goto error; /* driver 0.9.0 */ /* Setup FEC OC: NOTE: No more full FEC resets allowed afterwards!! */ status = write16(state, FEC_COMM_EXEC__A, FEC_COMM_EXEC_STOP); if (status < 0) goto error; /* MPEGTS functions are still the same */ status = mpegts_dto_init(state); if (status < 0) goto error; status = mpegts_stop(state); if (status < 0) goto error; status = mpegts_configure_polarity(state); if (status < 0) goto error; status = mpegts_configure_pins(state, state->m_enable_mpeg_output); if (status < 0) goto error; /* added: configure GPIO */ status = write_gpio(state); if (status < 0) goto error; state->m_drxk_state = DRXK_STOPPED; if (state->m_b_power_down) { status = power_down_device(state); if (status < 0) goto error; state->m_drxk_state = DRXK_POWERED_DOWN; } else state->m_drxk_state = DRXK_STOPPED; /* Initialize the supported delivery systems */ n = 0; if (state->m_has_dvbc) { state->frontend.ops.delsys[n++] = SYS_DVBC_ANNEX_A; state->frontend.ops.delsys[n++] = SYS_DVBC_ANNEX_C; strlcat(state->frontend.ops.info.name, " DVB-C", sizeof(state->frontend.ops.info.name)); } if (state->m_has_dvbt) { state->frontend.ops.delsys[n++] = SYS_DVBT; strlcat(state->frontend.ops.info.name, " DVB-T", sizeof(state->frontend.ops.info.name)); } drxk_i2c_unlock(state); } error: if (status < 0) { state->m_drxk_state = DRXK_NO_DEV; drxk_i2c_unlock(state); pr_err("Error %d on %s\n", status, __func__); } return status; } static void load_firmware_cb(const struct firmware *fw, void *context) { struct drxk_state *state = context; dprintk(1, ": %s\n", fw ? "firmware loaded" : "firmware not loaded"); if (!fw) { pr_err("Could not load firmware file %s.\n", state->microcode_name); pr_info("Copy %s to your hotplug directory!\n", state->microcode_name); state->microcode_name = NULL; /* * As firmware is now load asynchronous, it is not possible * anymore to fail at frontend attach. We might silently * return here, and hope that the driver won't crash. * We might also change all DVB callbacks to return -ENODEV * if the device is not initialized. * As the DRX-K devices have their own internal firmware, * let's just hope that it will match a firmware revision * compatible with this driver and proceed. */ } state->fw = fw; init_drxk(state); } static void drxk_release(struct dvb_frontend *fe) { struct drxk_state *state = fe->demodulator_priv; dprintk(1, "\n"); release_firmware(state->fw); kfree(state); } static int drxk_sleep(struct dvb_frontend *fe) { struct drxk_state *state = fe->demodulator_priv; dprintk(1, "\n"); if (state->m_drxk_state == DRXK_NO_DEV) return -ENODEV; if (state->m_drxk_state == DRXK_UNINITIALIZED) return 0; shut_down(state); return 0; } static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable) { struct drxk_state *state = fe->demodulator_priv; dprintk(1, ": %s\n", enable ? "enable" : "disable"); if (state->m_drxk_state == DRXK_NO_DEV) return -ENODEV; return ConfigureI2CBridge(state, enable ? true : false); } static int drxk_set_parameters(struct dvb_frontend *fe) { struct dtv_frontend_properties *p = &fe->dtv_property_cache; u32 delsys = p->delivery_system, old_delsys; struct drxk_state *state = fe->demodulator_priv; u32 IF; dprintk(1, "\n"); if (state->m_drxk_state == DRXK_NO_DEV) return -ENODEV; if (state->m_drxk_state == DRXK_UNINITIALIZED) return -EAGAIN; if (!fe->ops.tuner_ops.get_if_frequency) { pr_err("Error: get_if_frequency() not defined at tuner. Can't work without it!\n"); return -EINVAL; } if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); if (fe->ops.tuner_ops.set_params) fe->ops.tuner_ops.set_params(fe); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); old_delsys = state->props.delivery_system; state->props = *p; if (old_delsys != delsys) { shut_down(state); switch (delsys) { case SYS_DVBC_ANNEX_A: case SYS_DVBC_ANNEX_C: if (!state->m_has_dvbc) return -EINVAL; state->m_itut_annex_c = (delsys == SYS_DVBC_ANNEX_C) ? true : false; if (state->m_itut_annex_c) setoperation_mode(state, OM_QAM_ITU_C); else setoperation_mode(state, OM_QAM_ITU_A); break; case SYS_DVBT: if (!state->m_has_dvbt) return -EINVAL; setoperation_mode(state, OM_DVBT); break; default: return -EINVAL; } } fe->ops.tuner_ops.get_if_frequency(fe, &IF); start(state, 0, IF); /* After set_frontend, stats aren't available */ p->strength.stat[0].scale = FE_SCALE_RELATIVE; p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->pre_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; /* printk(KERN_DEBUG "drxk: %s IF=%d done\n", __func__, IF); */ return 0; } static int get_strength(struct drxk_state *state, u64 *strength) { int status; struct s_cfg_agc rf_agc, if_agc; u32 total_gain = 0; u32 atten = 0; u32 agc_range = 0; u16 scu_lvl = 0; u16 scu_coc = 0; /* FIXME: those are part of the tuner presets */ u16 tuner_rf_gain = 50; /* Default value on az6007 driver */ u16 tuner_if_gain = 40; /* Default value on az6007 driver */ *strength = 0; if (is_dvbt(state)) { rf_agc = state->m_dvbt_rf_agc_cfg; if_agc = state->m_dvbt_if_agc_cfg; } else if (is_qam(state)) { rf_agc = state->m_qam_rf_agc_cfg; if_agc = state->m_qam_if_agc_cfg; } else { rf_agc = state->m_atv_rf_agc_cfg; if_agc = state->m_atv_if_agc_cfg; } if (rf_agc.ctrl_mode == DRXK_AGC_CTRL_AUTO) { /* SCU output_level */ status = read16(state, SCU_RAM_AGC_RF_IACCU_HI__A, &scu_lvl); if (status < 0) return status; /* SCU c.o.c. */ status = read16(state, SCU_RAM_AGC_RF_IACCU_HI_CO__A, &scu_coc); if (status < 0) return status; if (((u32) scu_lvl + (u32) scu_coc) < 0xffff) rf_agc.output_level = scu_lvl + scu_coc; else rf_agc.output_level = 0xffff; /* Take RF gain into account */ total_gain += tuner_rf_gain; /* clip output value */ if (rf_agc.output_level < rf_agc.min_output_level) rf_agc.output_level = rf_agc.min_output_level; if (rf_agc.output_level > rf_agc.max_output_level) rf_agc.output_level = rf_agc.max_output_level; agc_range = (u32) (rf_agc.max_output_level - rf_agc.min_output_level); if (agc_range > 0) { atten += 100UL * ((u32)(tuner_rf_gain)) * ((u32)(rf_agc.output_level - rf_agc.min_output_level)) / agc_range; } } if (if_agc.ctrl_mode == DRXK_AGC_CTRL_AUTO) { status = read16(state, SCU_RAM_AGC_IF_IACCU_HI__A, &if_agc.output_level); if (status < 0) return status; status = read16(state, SCU_RAM_AGC_INGAIN_TGT_MIN__A, &if_agc.top); if (status < 0) return status; /* Take IF gain into account */ total_gain += (u32) tuner_if_gain; /* clip output value */ if (if_agc.output_level < if_agc.min_output_level) if_agc.output_level = if_agc.min_output_level; if (if_agc.output_level > if_agc.max_output_level) if_agc.output_level = if_agc.max_output_level; agc_range = (u32)(if_agc.max_output_level - if_agc.min_output_level); if (agc_range > 0) { atten += 100UL * ((u32)(tuner_if_gain)) * ((u32)(if_agc.output_level - if_agc.min_output_level)) / agc_range; } } /* * Convert to 0..65535 scale. * If it can't be measured (AGC is disabled), just show 100%. */ if (total_gain > 0) *strength = (65535UL * atten / total_gain / 100); else *strength = 65535; return 0; } static int drxk_get_stats(struct dvb_frontend *fe) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct drxk_state *state = fe->demodulator_priv; int status; u32 stat; u16 reg16; u32 post_bit_count; u32 post_bit_err_count; u32 post_bit_error_scale; u32 pre_bit_err_count; u32 pre_bit_count; u32 pkt_count; u32 pkt_error_count; s32 cnr; if (state->m_drxk_state == DRXK_NO_DEV) return -ENODEV; if (state->m_drxk_state == DRXK_UNINITIALIZED) return -EAGAIN; /* get status */ state->fe_status = 0; get_lock_status(state, &stat); if (stat == MPEG_LOCK) state->fe_status |= 0x1f; if (stat == FEC_LOCK) state->fe_status |= 0x0f; if (stat == DEMOD_LOCK) state->fe_status |= 0x07; /* * Estimate signal strength from AGC */ get_strength(state, &c->strength.stat[0].uvalue); c->strength.stat[0].scale = FE_SCALE_RELATIVE; if (stat >= DEMOD_LOCK) { get_signal_to_noise(state, &cnr); c->cnr.stat[0].svalue = cnr * 100; c->cnr.stat[0].scale = FE_SCALE_DECIBEL; } else { c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; } if (stat < FEC_LOCK) { c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; c->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; c->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; c->pre_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; return 0; } /* Get post BER */ /* BER measurement is valid if at least FEC lock is achieved */ /* * OFDM_EC_VD_REQ_SMB_CNT__A and/or OFDM_EC_VD_REQ_BIT_CNT can be * written to set nr of symbols or bits over which to measure * EC_VD_REG_ERR_BIT_CNT__A . See CtrlSetCfg(). */ /* Read registers for post/preViterbi BER calculation */ status = read16(state, OFDM_EC_VD_ERR_BIT_CNT__A, &reg16); if (status < 0) goto error; pre_bit_err_count = reg16; status = read16(state, OFDM_EC_VD_IN_BIT_CNT__A , &reg16); if (status < 0) goto error; pre_bit_count = reg16; /* Number of bit-errors */ status = read16(state, FEC_RS_NR_BIT_ERRORS__A, &reg16); if (status < 0) goto error; post_bit_err_count = reg16; status = read16(state, FEC_RS_MEASUREMENT_PRESCALE__A, &reg16); if (status < 0) goto error; post_bit_error_scale = reg16; status = read16(state, FEC_RS_MEASUREMENT_PERIOD__A, &reg16); if (status < 0) goto error; pkt_count = reg16; status = read16(state, SCU_RAM_FEC_ACCUM_PKT_FAILURES__A, &reg16); if (status < 0) goto error; pkt_error_count = reg16; write16(state, SCU_RAM_FEC_ACCUM_PKT_FAILURES__A, 0); post_bit_err_count *= post_bit_error_scale; post_bit_count = pkt_count * 204 * 8; /* Store the results */ c->block_error.stat[0].scale = FE_SCALE_COUNTER; c->block_error.stat[0].uvalue += pkt_error_count; c->block_count.stat[0].scale = FE_SCALE_COUNTER; c->block_count.stat[0].uvalue += pkt_count; c->pre_bit_error.stat[0].scale = FE_SCALE_COUNTER; c->pre_bit_error.stat[0].uvalue += pre_bit_err_count; c->pre_bit_count.stat[0].scale = FE_SCALE_COUNTER; c->pre_bit_count.stat[0].uvalue += pre_bit_count; c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; c->post_bit_error.stat[0].uvalue += post_bit_err_count; c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; c->post_bit_count.stat[0].uvalue += post_bit_count; error: return status; } static int drxk_read_status(struct dvb_frontend *fe, enum fe_status *status) { struct drxk_state *state = fe->demodulator_priv; int rc; dprintk(1, "\n"); rc = drxk_get_stats(fe); if (rc < 0) return rc; *status = state->fe_status; return 0; } static int drxk_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct drxk_state *state = fe->demodulator_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; dprintk(1, "\n"); if (state->m_drxk_state == DRXK_NO_DEV) return -ENODEV; if (state->m_drxk_state == DRXK_UNINITIALIZED) return -EAGAIN; *strength = c->strength.stat[0].uvalue; return 0; } static int drxk_read_snr(struct dvb_frontend *fe, u16 *snr) { struct drxk_state *state = fe->demodulator_priv; s32 snr2; dprintk(1, "\n"); if (state->m_drxk_state == DRXK_NO_DEV) return -ENODEV; if (state->m_drxk_state == DRXK_UNINITIALIZED) return -EAGAIN; get_signal_to_noise(state, &snr2); /* No negative SNR, clip to zero */ if (snr2 < 0) snr2 = 0; *snr = snr2 & 0xffff; return 0; } static int drxk_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { struct drxk_state *state = fe->demodulator_priv; u16 err; dprintk(1, "\n"); if (state->m_drxk_state == DRXK_NO_DEV) return -ENODEV; if (state->m_drxk_state == DRXK_UNINITIALIZED) return -EAGAIN; dvbtqam_get_acc_pkt_err(state, &err); *ucblocks = (u32) err; return 0; } static int drxk_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *sets) { struct drxk_state *state = fe->demodulator_priv; struct dtv_frontend_properties *p = &fe->dtv_property_cache; dprintk(1, "\n"); if (state->m_drxk_state == DRXK_NO_DEV) return -ENODEV; if (state->m_drxk_state == DRXK_UNINITIALIZED) return -EAGAIN; switch (p->delivery_system) { case SYS_DVBC_ANNEX_A: case SYS_DVBC_ANNEX_C: case SYS_DVBT: sets->min_delay_ms = 3000; sets->max_drift = 0; sets->step_size = 0; return 0; default: return -EINVAL; } } static struct dvb_frontend_ops drxk_ops = { /* .delsys will be filled dynamically */ .info = { .name = "DRXK", .frequency_min = 47000000, .frequency_max = 865000000, /* For DVB-C */ .symbol_rate_min = 870000, .symbol_rate_max = 11700000, /* For DVB-T */ .frequency_stepsize = 166667, .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 | FE_CAN_QAM_128 | FE_CAN_QAM_256 | FE_CAN_FEC_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_MUTE_TS | FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_RECOVER | FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO }, .release = drxk_release, .sleep = drxk_sleep, .i2c_gate_ctrl = drxk_gate_ctrl, .set_frontend = drxk_set_parameters, .get_tune_settings = drxk_get_tune_settings, .read_status = drxk_read_status, .read_signal_strength = drxk_read_signal_strength, .read_snr = drxk_read_snr, .read_ucblocks = drxk_read_ucblocks, }; struct dvb_frontend *drxk_attach(const struct drxk_config *config, struct i2c_adapter *i2c) { struct dtv_frontend_properties *p; struct drxk_state *state = NULL; u8 adr = config->adr; int status; dprintk(1, "\n"); state = kzalloc(sizeof(struct drxk_state), GFP_KERNEL); if (!state) return NULL; state->i2c = i2c; state->demod_address = adr; state->single_master = config->single_master; state->microcode_name = config->microcode_name; state->qam_demod_parameter_count = config->qam_demod_parameter_count; state->no_i2c_bridge = config->no_i2c_bridge; state->antenna_gpio = config->antenna_gpio; state->antenna_dvbt = config->antenna_dvbt; state->m_chunk_size = config->chunk_size; state->enable_merr_cfg = config->enable_merr_cfg; if (config->dynamic_clk) { state->m_dvbt_static_clk = false; state->m_dvbc_static_clk = false; } else { state->m_dvbt_static_clk = true; state->m_dvbc_static_clk = true; } if (config->mpeg_out_clk_strength) state->m_ts_clockk_strength = config->mpeg_out_clk_strength & 0x07; else state->m_ts_clockk_strength = 0x06; if (config->parallel_ts) state->m_enable_parallel = true; else state->m_enable_parallel = false; /* NOTE: as more UIO bits will be used, add them to the mask */ state->uio_mask = config->antenna_gpio; /* Default gpio to DVB-C */ if (!state->antenna_dvbt && state->antenna_gpio) state->m_gpio |= state->antenna_gpio; else state->m_gpio &= ~state->antenna_gpio; mutex_init(&state->mutex); memcpy(&state->frontend.ops, &drxk_ops, sizeof(drxk_ops)); state->frontend.demodulator_priv = state; init_state(state); /* Load firmware and initialize DRX-K */ if (state->microcode_name) { const struct firmware *fw = NULL; status = request_firmware(&fw, state->microcode_name, state->i2c->dev.parent); if (status < 0) fw = NULL; load_firmware_cb(fw, state); } else if (init_drxk(state) < 0) goto error; /* Initialize stats */ p = &state->frontend.dtv_property_cache; p->strength.len = 1; p->cnr.len = 1; p->block_error.len = 1; p->block_count.len = 1; p->pre_bit_error.len = 1; p->pre_bit_count.len = 1; p->post_bit_error.len = 1; p->post_bit_count.len = 1; p->strength.stat[0].scale = FE_SCALE_RELATIVE; p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->pre_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; pr_info("frontend initialized.\n"); return &state->frontend; error: pr_err("not found\n"); kfree(state); return NULL; } EXPORT_SYMBOL(drxk_attach); MODULE_DESCRIPTION("DRX-K driver"); MODULE_AUTHOR("<NAME>"); MODULE_LICENSE("GPL");
heroku/shh
conntrack_poller.go
package shh import ( "bytes" "io/ioutil" "time" "github.com/heroku/slog" ) const ( CONNTRACK_DATA = "/proc/sys/net/netfilter/nf_conntrack_count" ) type Conntrack struct { measurements chan<- Measurement } func NewConntrackPoller(measurements chan<- Measurement) Conntrack { return Conntrack{measurements: measurements} } func (poller Conntrack) Poll(tick time.Time) { ctx := slog.Context{"poller": poller.Name(), "fn": "Poll", "tick": tick} count, err := ioutil.ReadFile(CONNTRACK_DATA) if err != nil { LogError(ctx, err, "reading"+CONNTRACK_DATA) return } poller.measurements <- GaugeMeasurement{tick, poller.Name(), []string{"count"}, Atouint64(string(bytes.TrimSpace(count))), Connections} } func (poller Conntrack) Name() string { return "conntrack" } func (poller Conntrack) Exit() {}
uit-plus/vspehere-jdk
src/main/java/com/vmware/vim25/ArrayOfVirtualMachineProfileDetailsDiskProfileDetails.java
package com.vmware.vim25; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ArrayOfVirtualMachineProfileDetailsDiskProfileDetails complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ArrayOfVirtualMachineProfileDetailsDiskProfileDetails"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="VirtualMachineProfileDetailsDiskProfileDetails" type="{urn:vim25}VirtualMachineProfileDetailsDiskProfileDetails" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ArrayOfVirtualMachineProfileDetailsDiskProfileDetails", propOrder = { "virtualMachineProfileDetailsDiskProfileDetails" }) public class ArrayOfVirtualMachineProfileDetailsDiskProfileDetails { @XmlElement(name = "VirtualMachineProfileDetailsDiskProfileDetails") protected List<VirtualMachineProfileDetailsDiskProfileDetails> virtualMachineProfileDetailsDiskProfileDetails; /** * Gets the value of the virtualMachineProfileDetailsDiskProfileDetails property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the virtualMachineProfileDetailsDiskProfileDetails property. * * <p> * For example, to add a new item, do as follows: * <pre> * getVirtualMachineProfileDetailsDiskProfileDetails().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link VirtualMachineProfileDetailsDiskProfileDetails } * * */ public List<VirtualMachineProfileDetailsDiskProfileDetails> getVirtualMachineProfileDetailsDiskProfileDetails() { if (virtualMachineProfileDetailsDiskProfileDetails == null) { virtualMachineProfileDetailsDiskProfileDetails = new ArrayList<VirtualMachineProfileDetailsDiskProfileDetails>(); } return this.virtualMachineProfileDetailsDiskProfileDetails; } }
stefan-jurco/scala
test/tasty/run/src-3/tastytest/opaques/package.scala
<gh_stars>1000+ package tastytest package object opaques { opaque type Offset = Long object Offset: def apply(o: Long): Offset = o }
lidiapopescu/JuliaDT
plugins/com.juliacomputing.jldt.eclipse.ui.editor/src/main/java/com/juliacomputing/jldt/eclipse/ui/editor/internal/JuliaPartitionScanner.java
package com.juliacomputing.jldt.eclipse.ui.editor.internal; import com.juliacomputing.jldt.eclipse.core.JuliaPartition; import org.eclipse.jface.text.rules.*; import java.util.ArrayList; import java.util.List; public class JuliaPartitionScanner extends RuleBasedPartitionScanner { public JuliaPartitionScanner() { IToken string = new Token(JuliaPartition.STRING); IToken comment = new Token(JuliaPartition.COMMENT); List<IRule> rules = new ArrayList<>(); rules.add(new EndOfLineRule("#", comment)); rules.add(new MultiLineRule("\"\"\"", "\"\"\"", string, '\\')); rules.add(new MultiLineRule("\'\'\'", "\'\'\'", string, '\\')); rules.add(new MultiLineRule("\'", "\'", string, '\\')); rules.add(new MultiLineRule("\"", "\"", string, '\\')); IPredicateRule[] result = new IPredicateRule[rules.size()]; rules.toArray(result); setPredicateRules(result); } }
vvv1559/algorytms_and_data_structures
leetcode/src/test/java/com/github/vvv1559/algorithms/leetcode/trees/SymmetricTreeTest.java
package com.github.vvv1559.algorithms.leetcode.trees; import com.github.vvv1559.algorithms.structures.TreeNode; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; public class SymmetricTreeTest { @Test public void isSymmetric() { SymmetricTree symmetricTree = new SymmetricTree(); assertTrue(symmetricTree.isSymmetric(TreeNode.fromArray())); assertTrue(symmetricTree.isSymmetric(TreeNode.fromArray(1))); assertTrue(symmetricTree.isSymmetric(TreeNode.fromArray(1, 2, 2, 3, 4, 4, 3))); assertFalse(symmetricTree.isSymmetric(TreeNode.fromArray(1, 2, 2, null, 3, null, 3))); } }
ju851zel/rummy
src/test/scala/de/htwg/se/rummy/model/TileSpec.scala
package de.htwg.se.rummy.model import de.htwg.se.rummy.model.deskComp.deskBaseImpl.deskImpl.{Color, Tile} import org.scalatest.{Matchers, WordSpec} class TileSpec extends WordSpec with Matchers { "A tile" when { val tile = Tile(5, Color.RED, 0) "created with value 1 and color red" should { "have value 1" in { tile.value should be(5) } "have color red" in { tile.color should be(Color.RED) } "have ident 0" in { tile.ident should be(0) } } "compared to other tile" should { "be 0 if same value" in { tile.compare(Tile(5, Color.BLUE, 1)) should be(0) } "be greater 0 if higher value" in { tile.compare(Tile(6, Color.BLUE, 1)) should be < 0 } "be less 0 if lower value" in { tile.compare(Tile(4, Color.BLUE, 1)) should be > 0 } } "toString" should { "be '5RO'" in { tile.toString should be("5R0") } } } "A string" when { "formatted" should { val tileCorrect0 = Tile.stringToTile("1R0") val tileCorrect1 = Tile.stringToTile("10R1") val tileCorrect2 = Tile.stringToTile("2B0") val tileCorrect3 = Tile.stringToTile("11B1") val tileCorrect4 = Tile.stringToTile("3Y0") val tileCorrect5 = Tile.stringToTile("12Y1") val tileCorrect6 = Tile.stringToTile("4G0") val tileCorrect7 = Tile.stringToTile("13G1") val tileWrong7 = Tile.stringToTile("xG1") val tileWrong8 = Tile.stringToTile("4g1") val tileWrong9 = Tile.stringToTile("5G2") "give a correct instance" in { tileCorrect0.get should be(Tile(1, Color.RED, 0)) tileCorrect1.get should be(Tile(10, Color.RED, 1)) tileCorrect2.get should be(Tile(2, Color.BLUE, 0)) tileCorrect3.get should be(Tile(11, Color.BLUE, 1)) tileCorrect4.get should be(Tile(3, Color.YELLOW, 0)) tileCorrect5.get should be(Tile(12, Color.YELLOW, 1)) tileCorrect6.get should be(Tile(4, Color.GREEN, 0)) tileCorrect7.get should be(Tile(13, Color.GREEN, 1)) } "give a None" in { tileWrong7 should be(None) tileWrong8 should be(None) tileWrong9 should be(None) } } "parsing a value" should { val valueCorrect1 = "1R0" val valueCorrect2 = "5R0" val valueCorrect3 = "13R0" val valueWrong1 = "0R0" val valueWrong2 = "-1R0" val valueWrong3 = "14R0" val valueWrong4 = "xR0" "give a correct instance" in { Tile.parseValue(valueCorrect1).get should be(1) Tile.parseValue(valueCorrect2).get should be(5) Tile.parseValue(valueCorrect3).get should be(13) } "give a None" in { Tile.parseValue(valueWrong1) should be(None) Tile.parseValue(valueWrong2) should be(None) Tile.parseValue(valueWrong3) should be(None) Tile.parseValue(valueWrong4) should be(None) } } "parsing a color" should { val valueCorrect1 = "1R0" val valueCorrect2 = "5G0" val valueWrong1 = "0X0" val valueWrong2 = "-150" val valueWrong3 = "14P0" "give a correct instance" in { Tile.parseColor(valueCorrect1).get should be(Color.RED) Tile.parseColor(valueCorrect2).get should be(Color.GREEN) } "give a None" in { Tile.parseColor(valueWrong1) should be(None) Tile.parseColor(valueWrong2) should be(None) Tile.parseColor(valueWrong3) should be(None) } } "parsing a identifier" should { val valueCorrect1 = "1R0" val valueCorrect2 = "5G1" val valueWrong1 = "0X-4" val valueWrong2 = "12R2" val valueWrong3 = "14PX" "give a correct instance" in { Tile.parseIdent(valueCorrect1).get should be(0) Tile.parseIdent(valueCorrect2).get should be(1) } "give a None" in { Tile.parseIdent(valueWrong1) should be(None) Tile.parseIdent(valueWrong2) should be(None) Tile.parseIdent(valueWrong3) should be(None) } } } }
ThomasHornschuh/elua
src/platform/riscv32spike/host.h
<reponame>ThomasHornschuh/elua // host.h -- Defines syscall wrappers to access host OS. #ifndef _HOST_H #define _HOST_H #include <stddef.h> #include <sys/types.h> #include <sys/time.h> extern int host_errno; ssize_t host_read(int file, void* ptr, size_t len); ssize_t host_write(int file, const void* ptr, size_t len); int host_open(const char* name, int flags, int mode); int host_close(int file); int host_lseek(int file, long ptr, int dir); #define PROT_READ 0x1 /* Page can be read. */ #define PROT_WRITE 0x2 /* Page can be written. */ #define PROT_EXEC 0x4 /* Page can be executed. */ #define PROT_NONE 0x0 /* Page can not be accessed. */ #define MAP_SHARED 0x01 /* Share changes. */ #define MAP_PRIVATE 0x02 /* Changes are private. */ #define MAP_FIXED 0x10 /* Interpret addr exactly. */ #define MAP_ANONYMOUS 0x20 /* Don't use a file. */ // Flags for "open" #define O_RDONLY 00 #define O_WRONLY 01 #define MAP_FAILED (void *)(-1) void* host_sbrk(ptrdiff_t incr); int host_gettimeofday(struct timeval* tp, void* tzp); void host_exit(int status); #endif // _HOST_H
Pyverilog/PyCoRAM
pycoram/controlthread/maketree.py
<gh_stars>10-100 #------------------------------------------------------------------------------- # maketree.py # # AST tree <-> Dataflow Tree converter # # Copyright (C) 2013, <NAME> # License: Apache 2.0 #------------------------------------------------------------------------------- from __future__ import absolute_import from __future__ import print_function import sys import os from pyverilog.vparser.ast import * from pyverilog.dataflow.dataflow import * from pyverilog.utils.scope import * import pyverilog.dataflow.reorder as reorder import pyverilog.utils.op2mark def getDFTree(node): expr = node.var if isinstance(node, Rvalue) else node return makeDFTree(expr) def makeDFTree(node): if isinstance(node, str): name = ScopeChain((ScopeLabel(node),)) return DFTerminal(name) if isinstance(node, Identifier): name = ScopeChain((ScopeLabel(node.name),)) return DFTerminal(name) if isinstance(node, IntConst): return DFIntConst(node.value) if isinstance(node, FloatConst): return DFFloatConst(node.value) if isinstance(node, StringConst): return DFStringConst(node.value) if isinstance(node, Cond): true_df = makeDFTree(node.true_value) false_df = makeDFTree(node.false_value) cond_df = makeDFTree(node.cond) if isinstance(cond_df, DFBranch): return reorder.insertCond(cond_df, true_df, false_df) return DFBranch(cond_df, true_df, false_df) if isinstance(node, UnaryOperator): right_df = makeDFTree(node.right) if isinstance(right_df, DFBranch): return reorder.insertUnaryOp(right_df, node.__class__.__name__) return DFOperator((right_df,), node.__class__.__name__) if isinstance(node, Operator): left_df = makeDFTree(node.left) right_df = makeDFTree(node.right) if isinstance(left_df, DFBranch) or isinstance(right_df, DFBranch): return reorder.insertOp(left_df, right_df, node.__class__.__name__) return DFOperator((left_df, right_df,), node.__class__.__name__) if isinstance(node, SystemCall): #if node.syscall == 'unsigned': # return makeDFTree(node.args[0]) #if node.syscall == 'signed': # return makeDFTree(node.args[0]) #return DFIntConst('0') return DFSyscall(node.syscall, tuple([ makeDFTree(n) for n in node.args ])) raise TypeError("unsupported AST node type: %s %s" % (str(type(node)), str(node))) operators = { 'Plus' : Plus, 'Minus' : Minus, 'Times' : Times, 'Divide' : Divide, 'Mod' : Mod, 'Power' : Power, 'Sll' : Sll, 'Srl' : Srl, 'Sra' : Sra, 'Or' : Or, 'Xor' : Xor, 'And' : And, 'Divide' : Divide, 'Land' : Land, 'Lor' : Lor, 'Unot' : Unot, 'Ulnot' : Ulnot, 'Uplus' : Uplus, 'Uminus' : Uminus, 'Eq' : Eq, 'NotEq' : NotEq, 'LessThan' : LessThan, 'LessEq' : LessEq, 'GreaterThan' : GreaterThan, 'GreaterEq' : GreaterEq, 'Eq' : Eq, 'NotEq' : NotEq, } def getOp(op): return operators[op] def makeASTTree(node): if isinstance(node, DFBranch): return Cond(makeASTTree(node.condnode), makeASTTree(node.truenode), makeASTTree(node.falsenode)) if isinstance(node, DFIntConst): return IntConst(str(node.value)) if isinstance(node, DFFloatConst): return FloatConst(str(node.value)) if isinstance(node, DFStringConst): return StringConst(str(node.value)) if isinstance(node, DFEvalValue): if isinstance(node.value, int): return IntConst(str(node.value)) if isinstance(node.value, float): return FloatConst(str(node.value)) if isinstance(node.value, DFStringConst): return StringConst(str(node.value)) return Constant(str(node.value)) if isinstance(node, DFTerminal): name = node.name[0].scopename return Identifier(name) if isinstance(node, DFUndefined): return IntConst('x') if isinstance(node, DFHighImpedance): return IntConst('z') if isinstance(node, DFOperator): if len(node.nextnodes) == 1: return getOp(node.operator)(makeASTTree(node.nextnodes[0])) return getOp(node.operator)(makeASTTree(node.nextnodes[0]), makeASTTree(node.nextnodes[1])) if isinstance(node, DFSyscall): return SystemCall(node.syscall, tuple([makeASTTree(n) for n in node.nextnodes]) ) raise TypeError("Unsupported DFNode %s" % type(node))
int-tt/aws-sdk-go-v2
service/cloud9/api_op_CreateEnvironmentEC2.go
<reponame>int-tt/aws-sdk-go-v2<gh_stars>1-10 // Code generated by smithy-go-codegen DO NOT EDIT. package cloud9 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/cloud9/types" "github.com/awslabs/smithy-go/middleware" smithyhttp "github.com/awslabs/smithy-go/transport/http" ) // Creates an AWS Cloud9 development environment, launches an Amazon Elastic // Compute Cloud (Amazon EC2) instance, and then connects from the instance to the // environment. func (c *Client) CreateEnvironmentEC2(ctx context.Context, params *CreateEnvironmentEC2Input, optFns ...func(*Options)) (*CreateEnvironmentEC2Output, error) { if params == nil { params = &CreateEnvironmentEC2Input{} } result, metadata, err := c.invokeOperation(ctx, "CreateEnvironmentEC2", params, optFns, addOperationCreateEnvironmentEC2Middlewares) if err != nil { return nil, err } out := result.(*CreateEnvironmentEC2Output) out.ResultMetadata = metadata return out, nil } type CreateEnvironmentEC2Input struct { // The type of instance to connect to the environment (for example, t2.micro). // // This member is required. InstanceType *string // The name of the environment to create. This name is visible to other AWS IAM // users in the same AWS account. // // This member is required. Name *string // The number of minutes until the running instance is shut down after the // environment has last been used. AutomaticStopTimeMinutes *int32 // A unique, case-sensitive string that helps AWS Cloud9 to ensure this operation // completes no more than one time. For more information, see Client Tokens // (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html) // in the Amazon EC2 API Reference. ClientRequestToken *string // The connection type used for connecting to an Amazon EC2 environment. ConnectionType types.ConnectionType // The description of the environment to create. Description *string // The Amazon Resource Name (ARN) of the environment owner. This ARN can be the ARN // of any AWS IAM principal. If this value is not specified, the ARN defaults to // this environment's creator. OwnerArn *string // The ID of the subnet in Amazon VPC that AWS Cloud9 will use to communicate with // the Amazon EC2 instance. SubnetId *string // An array of key-value pairs that will be associated with the new AWS Cloud9 // development environment. Tags []*types.Tag } type CreateEnvironmentEC2Output struct { // The ID of the environment that was created. EnvironmentId *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata } func addOperationCreateEnvironmentEC2Middlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateEnvironmentEC2{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateEnvironmentEC2{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddAttemptClockSkewMiddleware(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpCreateEnvironmentEC2ValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateEnvironmentEC2(options.Region), middleware.Before); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opCreateEnvironmentEC2(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "cloud9", OperationName: "CreateEnvironmentEC2", } }
DamieFC/chromium
ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector.js
// 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. /** * @fileoverview 'cr-profile-avatar-selector' is an element that displays * profile avatar icons and allows an avatar to be selected. */ /** * @typedef {{url: string, * label: string, * index: (number), * isGaiaAvatar: (boolean), * selected: (boolean)}} */ export let AvatarIcon; import {Polymer, html} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import '../cr_button/cr_button.m.js'; import '../shared_vars_css.m.js'; import '../shared_style_css.m.js'; import {getImage} from '../../js/icon.m.js'; import '//resources/polymer/v3_0/paper-styles/color.js'; import '//resources/polymer/v3_0/paper-tooltip/paper-tooltip.js'; import './cr_profile_avatar_selector_grid.js'; Polymer({ is: 'cr-profile-avatar-selector', _template: html`{__html_template__}`, properties: { /** * The list of profile avatar URLs and labels. * @type {!Array<!AvatarIcon>} */ avatars: { type: Array, value() { return []; } }, /** * The currently selected profile avatar icon, if any. * @type {?AvatarIcon} */ selectedAvatar: { type: Object, notify: true, }, ignoreModifiedKeyEvents: { type: Boolean, value: false, }, /** * The currently selected profile avatar icon index, or '-1' if none is * selected. * @type {number} */ tabFocusableAvatar_: { type: Number, computed: 'computeTabFocusableAvatar_(avatars, selectedAvatar)', }, }, /** * @param {number} index * @return {string} * @private */ getAvatarId_(index) { return 'avatarId' + index; }, /** * @param {number} index * @param {!AvatarIcon} item * @return {string} * @private */ getTabIndex_(index, item) { if (item.index === this.tabFocusableAvatar_) { return '0'; } // If no avatar is selected, focus the first element of the grid on 'tab'. if (this.tabFocusableAvatar_ === -1 && index === 0) { return '0'; } return '-1'; }, /** * @return {number} * @private */ computeTabFocusableAvatar_() { const selectedAvatar = this.avatars.find(avatar => this.isAvatarSelected(avatar)); return selectedAvatar ? selectedAvatar.index : -1; }, /** @private */ getSelectedClass_(avatarItem) { // TODO(dpapad): Rename 'iron-selected' to 'selected' now that this CSS // class is not assigned by any iron-* behavior. return this.isAvatarSelected(avatarItem) ? 'iron-selected' : ''; }, /** * @param {AvatarIcon} avatarItem * @return {string} * @private */ getCheckedAttribute_(avatarItem) { return this.isAvatarSelected(avatarItem) ? 'true' : 'false'; }, /** * @param {AvatarIcon} avatarItem * @return {boolean} * @private */ isAvatarSelected(avatarItem) { return !!avatarItem && (avatarItem.selected || (!!this.selectedAvatar && this.selectedAvatar.index === avatarItem.index)); }, /** * @param {string} iconUrl * @return {string} A CSS image-set for multiple scale factors. * @private */ getIconImageSet_(iconUrl) { return getImage(iconUrl); }, /** * @param {!Event} e * @private */ onAvatarTap_(e) { // |selectedAvatar| is set to pass back selection to the owner of this // component. this.selectedAvatar = /** @type {!{model: {item: !AvatarIcon}}} */ (e).model.item; }, });
raphaelmue/financer
backend/org.financer.shared/src/main/java/org/financer/shared/domain/model/api/user/UpdatePasswordDTO.java
package org.financer.shared.domain.model.api.user; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.experimental.Accessors; import org.financer.shared.domain.model.api.DataTransferObject; import org.financer.shared.domain.model.value.objects.HashedPassword; @Data @Accessors(chain = true) @Schema(name = "UpdatePassword", description = "Schema for updating password") public class UpdatePasswordDTO implements DataTransferObject { @Schema(description = "Password of the current user", required = true) private String password; @Schema(description = "Updated password for user", required = true) private HashedPassword updatedPassword; }
ToddlerToddy/ToddlerPlayGround
Playground Code/tests/mocha/workspace_svg_test.js
/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: Apache-2.0 */ suite('WorkspaceSvg', function() { setup(function() { sharedTestSetup.call(this); var toolbox = document.getElementById('toolbox-categories'); this.workspace = Blockly.inject('blocklyDiv', {toolbox: toolbox}); Blockly.defineBlocksWithJsonArray([{ 'type': 'simple_test_block', 'message0': 'simple test block', 'output': null }, { 'type': 'test_val_in', 'message0': 'test in %1', 'args0': [ { 'type': 'input_value', 'name': 'NAME' } ] }]); }); teardown(function() { sharedTestTeardown.call(this); }); test('dispose of WorkspaceSvg without dom throws no error', function() { var ws = new Blockly.WorkspaceSvg(new Blockly.Options({})); ws.dispose(); }); test('appendDomToWorkspace alignment', function() { var dom = Blockly.Xml.textToDom( '<xml xmlns="https://developers.google.com/blockly/xml">' + ' <block type="math_random_float" inline="true" x="21" y="23">' + ' </block>' + '</xml>'); Blockly.Xml.appendDomToWorkspace(dom, this.workspace); chai.assert.equal(this.workspace.getAllBlocks(false).length, 1, 'Block count'); Blockly.Xml.appendDomToWorkspace(dom, this.workspace); chai.assert.equal(this.workspace.getAllBlocks(false).length, 2, 'Block count'); var blocks = this.workspace.getAllBlocks(false); chai.assert.equal(blocks[0].getRelativeToSurfaceXY().x, 21, 'Block 1 position x'); chai.assert.equal(blocks[0].getRelativeToSurfaceXY().y, 23, 'Block 1 position y'); chai.assert.equal(blocks[1].getRelativeToSurfaceXY().x, 21, 'Block 2 position x'); // Y separation value defined in appendDomToWorkspace as 10 chai.assert.equal(blocks[1].getRelativeToSurfaceXY().y, 23 + blocks[0].getHeightWidth().height + 10, 'Block 2 position y'); }); test('Replacing shadow disposes svg', function() { var dom = Blockly.Xml.textToDom( '<xml xmlns="https://developers.google.com/blockly/xml">' + '<block type="test_val_in">' + '<value name="NAME">' + '<shadow type="simple_test_block"></shadow>' + '</value>' + '</block>' + '</xml>'); Blockly.Xml.appendDomToWorkspace(dom, this.workspace); var blocks = this.workspace.getAllBlocks(false); chai.assert.equal(blocks.length, 2,'Block count'); var shadowBlock = blocks[1]; chai.assert.exists(shadowBlock.getSvgRoot()); var block = this.workspace.newBlock('simple_test_block'); block.initSvg(); var inputConnection = this.workspace.getTopBlocks()[0].getInput('NAME').connection; inputConnection.connect(block.outputConnection); chai.assert.exists(block.getSvgRoot()); chai.assert.notExists(shadowBlock.getSvgRoot()); }); suite('updateToolbox', function() { test('Passes in null when toolbox exists', function() { chai.assert.throws(function() { this.workspace.updateToolbox(null); }.bind(this), 'Can\'t nullify an existing toolbox.'); }); test('Passes in toolbox def when current toolbox is null', function() { this.workspace.options.languageTree = null; chai.assert.throws(function() { this.workspace.updateToolbox({'contents': []}); }.bind(this), 'Existing toolbox is null. Can\'t create new toolbox.'); }); test('Existing toolbox has no categories', function() { sinon.stub(Blockly.utils.toolbox, 'hasCategories').returns(true); this.workspace.toolbox_ = null; chai.assert.throws(function() { this.workspace.updateToolbox({'contents': []}); }.bind(this), 'Existing toolbox has no categories. Can\'t change mode.'); }); test('Existing toolbox has categories', function() { sinon.stub(Blockly.utils.toolbox, 'hasCategories').returns(false); this.workspace.flyout_ = null; chai.assert.throws(function() { this.workspace.updateToolbox({'contents': []}); }.bind(this), 'Existing toolbox has categories. Can\'t change mode.'); }); test('Passing in string as toolboxdef', function() { var parseToolboxFake = sinon.spy(Blockly.utils.toolbox, 'parseToolboxTree'); this.workspace.updateToolbox('<xml><category name="something"></category></xml>'); sinon.assert.calledOnce(parseToolboxFake); }); }); suite('addTopBlock', function() { setup(function() { this.targetWorkspace = new Blockly.Workspace(); this.workspace.isFlyout = true; this.workspace.targetWorkspace = this.targetWorkspace; Blockly.defineBlocksWithJsonArray([{ "type": "get_var_block", "message0": "%1", "args0": [ { "type": "field_variable", "name": "VAR", "variableTypes": ["", "type1", "type2"] } ] }]); }); teardown(function() { // Have to dispose of the main workspace after the flyout workspace // because it holds the variable map. // Normally the main workspace disposes of the flyout workspace. workspaceTeardown.call(this, this.targetWorkspace); }); test('Trivial Flyout is True', function() { this.targetWorkspace.createVariable('name1', '', '1'); // Flyout.init usually does this binding. this.workspace.variableMap_ = this.targetWorkspace.getVariableMap(); Blockly.Events.disable(); var block = new Blockly.Block(this.workspace, 'get_var_block'); block.inputList[0].fieldRow[0].setValue('1'); Blockly.Events.enable(); this.workspace.removeTopBlock(block); this.workspace.addTopBlock(block); assertVariableValues(this.workspace, 'name1', '', '1'); }); }); suite('Viewport change events', function() { function resetEventHistory(eventsFireStub, changeListenerSpy) { eventsFireStub.resetHistory(); changeListenerSpy.resetHistory(); } function assertSpyFiredViewportEvent(spy, workspace, expectedProperties) { assertEventFired( spy, Blockly.Events.ViewportChange, expectedProperties, workspace.id); assertEventFired(spy, Blockly.Events.ViewportChange, expectedProperties, workspace.id); } function assertViewportEventFired(eventsFireStub, changeListenerSpy, workspace, expectedEventCount = 1) { var metrics = workspace.getMetrics(); var expectedProperties = { scale: workspace.scale, oldScale: 1, viewTop: metrics.viewTop, viewLeft: metrics.viewLeft }; assertSpyFiredViewportEvent( eventsFireStub, workspace, expectedProperties); assertSpyFiredViewportEvent( changeListenerSpy, workspace,expectedProperties); sinon.assert.callCount(changeListenerSpy, expectedEventCount); sinon.assert.callCount(eventsFireStub, expectedEventCount); } function runViewportEventTest(eventTriggerFunc, eventsFireStub, changeListenerSpy, workspace, clock, expectedEventCount = 1) { clock.runAll(); resetEventHistory(eventsFireStub, changeListenerSpy); eventTriggerFunc(); assertViewportEventFired( eventsFireStub, changeListenerSpy, workspace, expectedEventCount); } setup(function() { defineStackBlock(); this.changeListenerSpy = createFireChangeListenerSpy(this.workspace); }); teardown(function() { delete Blockly.Blocks['stack_block']; }); suite('zoom', function() { test('setScale', function() { runViewportEventTest(() => this.workspace.setScale(2), this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock); }); test('zoom(50, 50, 1)', function() { runViewportEventTest(() => this.workspace.zoom(50, 50, 1), this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock); }); test('zoom(50, 50, -1)', function() { runViewportEventTest(() => this.workspace.zoom(50, 50, -1), this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock); }); test('zoomCenter(1)', function() { runViewportEventTest(() => this.workspace.zoomCenter(1), this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock); }); test('zoomCenter(-1)', function() { runViewportEventTest(() => this.workspace.zoomCenter(-1), this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock); }); test('zoomToFit', function() { var block = this.workspace.newBlock('stack_block'); block.initSvg(); block.render(); runViewportEventTest(() => this.workspace.zoomToFit(), this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock); }); }); suite('scroll', function() { test('centerOnBlock', function() { var block = this.workspace.newBlock('stack_block'); block.initSvg(); block.render(); runViewportEventTest(() => this.workspace.zoomToFit(block.id), this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock); }); test('scroll', function() { runViewportEventTest(() => this.workspace.scroll(50, 50), this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock); }); test('scrollCenter', function() { runViewportEventTest(() => this.workspace.scrollCenter(), this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock); }); }); suite('Blocks triggering viewport changes', function() { test('block move that triggers scroll', function() { var block = this.workspace.newBlock('stack_block'); block.initSvg(); block.render(); this.clock.runAll(); resetEventHistory(this.eventsFireStub, this.changeListenerSpy); // Expect 2 events, 1 move, 1 viewport runViewportEventTest(() => { block.moveBy(1000, 1000); }, this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock, 2); }); test('domToWorkspace that doesn\'t trigger scroll' , function() { // 4 blocks with space in center. Blockly.Xml.domToWorkspace( Blockly.Xml.textToDom( '<xml xmlns="https://developers.google.com/blockly/xml">' + '<block type="controls_if" x="88" y="88"></block>' + '<block type="controls_if" x="288" y="88"></block>' + '<block type="controls_if" x="88" y="238"></block>' + '<block type="controls_if" x="288" y="238"></block>' + '</xml>'), this.workspace); var xmlDom = Blockly.Xml.textToDom( '<block type="controls_if" x="188" y="163"></block>'); this.clock.runAll(); resetEventHistory(this.eventsFireStub, this.changeListenerSpy); // Add block in center of other blocks, not triggering scroll. Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom( '<block type="controls_if" x="188" y="163"></block>'), this.workspace); this.clock.runAll(); assertEventNotFired( this.eventsFireStub, Blockly.Events.ViewportChange, {}); assertEventNotFired( this.changeListenerSpy, Blockly.Events.ViewportChange, {}); }); test('domToWorkspace at 0,0 that doesn\'t trigger scroll' , function() { // 4 blocks with space in center. Blockly.Xml.domToWorkspace( Blockly.Xml.textToDom( '<xml xmlns="https://developers.google.com/blockly/xml">' + '<block type="controls_if" x="-75" y="-72"></block>' + '<block type="controls_if" x="75" y="-72"></block>' + '<block type="controls_if" x="-75" y="75"></block>' + '<block type="controls_if" x="75" y="75"></block>' + '</xml>'), this.workspace); var xmlDom = Blockly.Xml.textToDom( '<block type="controls_if" x="0" y="0"></block>'); this.clock.runAll(); resetEventHistory(this.eventsFireStub, this.changeListenerSpy); // Add block in center of other blocks, not triggering scroll. Blockly.Xml.domToWorkspace(xmlDom, this.workspace); this.clock.runAll(); assertEventNotFired( this.eventsFireStub, Blockly.Events.ViewportChange, {}); assertEventNotFired( this.changeListenerSpy, Blockly.Events.ViewportChange, {}); }); test.skip('domToWorkspace multiple blocks triggers one viewport event', function() { // TODO: Un-skip after adding filtering for consecutive viewport events. var addingMultipleBlocks = () => { Blockly.Xml.domToWorkspace( Blockly.Xml.textToDom( '<xml xmlns="https://developers.google.com/blockly/xml">' + '<block type="controls_if" x="88" y="88"></block>' + '<block type="controls_if" x="288" y="88"></block>' + '<block type="controls_if" x="88" y="238"></block>' + '<block type="controls_if" x="288" y="238"></block>' + '</xml>'), this.workspace); }; // Expect 10 events, 4 create, 4 move, 1 viewport, 1 finished loading runViewportEventTest(addingMultipleBlocks, this.eventsFireStub, this.changeListenerSpy, this.workspace, this.clock, 10); }); }); }); suite('Workspace Base class', function() { testAWorkspace(); }); });
bisakhmondal/Bstore---A-springboot-react-webapp
apis/src/main/java/com/example/apis/product/ProductService.java
package com.example.apis.product; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; @Service @AllArgsConstructor public class ProductService { private final ProductRepository productRepository; public Optional<Product> findProductById(Long id){ return productRepository.findById(id); } public List<Product> fetchAll() { return productRepository.findAll(); } public List<Product> fetchByGender(ProductType productType) { return productRepository.findAllByProductType(productType); } public List<Product> fetchByArrival(Arrival arrival) { return productRepository.findAllByArrival(arrival); } public List<Product> fetchByGenderAndArrival(String sex, String arrivalStr) { ProductType productType = (sex.equals("male") || sex.equals("MALE")) ? ProductType.MALE : ProductType.FEMALE; Arrival arrival = (arrivalStr.equals("new") || arrivalStr.equals("NEW")) ? Arrival.NEW :Arrival.CHEAP; return productRepository.findAllByArrivalAndSex(productType, arrival); } }
andrejadd/HBR-net-inf
GCGP/GPstuff-4.4/SuiteSparse/CHOLMOD/Cholesky/cholmod_spsolve.c
<reponame>andrejadd/HBR-net-inf<filename>GCGP/GPstuff-4.4/SuiteSparse/CHOLMOD/Cholesky/cholmod_spsolve.c /* ========================================================================== */ /* === Cholesky/cholmod_spsolve ============================================= */ /* ========================================================================== */ /* ----------------------------------------------------------------------------- * CHOLMOD/Cholesky Module. Copyright (C) 2005-2006, <NAME> * The CHOLMOD/Cholesky Module is licensed under Version 2.1 of the GNU * Lesser General Public License. See lesser.txt for a text of the license. * CHOLMOD is also available under other licenses; contact authors for details. * http://www.cise.ufl.edu/research/sparse * -------------------------------------------------------------------------- */ /* Given an LL' or LDL' factorization of A, solve one of the following systems: * * Ax=b 0: CHOLMOD_A also applies the permutation L->Perm * LDL'x=b 1: CHOLMOD_LDLt does not apply L->Perm * LDx=b 2: CHOLMOD_LD * DL'x=b 3: CHOLMOD_DLt * Lx=b 4: CHOLMOD_L * L'x=b 5: CHOLMOD_Lt * Dx=b 6: CHOLMOD_D * x=Pb 7: CHOLMOD_P apply a permutation (P is L->Perm) * x=P'b 8: CHOLMOD_Pt apply an inverse permutation * * where b and x are sparse. If L and b are real, then x is real. Otherwise, * x is complex or zomplex, depending on the Common->prefer_zomplex parameter. * All xtypes of x and b are supported (real, complex, and zomplex). */ #ifndef NCHOLESKY #include "cholmod_internal.h" #include "cholmod_cholesky.h" /* ========================================================================== */ /* === EXPAND_AS_NEEDED ===================================================== */ /* ========================================================================== */ /* Double the size of the sparse matrix X, if we have run out of space. */ #define EXPAND_AS_NEEDED \ if (xnz >= nzmax) \ { \ nzmax *= 2 ; \ CHOLMOD(reallocate_sparse) (nzmax, X, Common) ; \ if (Common->status < CHOLMOD_OK) \ { \ CHOLMOD(free_sparse) (&X, Common) ; \ CHOLMOD(free_dense) (&X4, Common) ; \ CHOLMOD(free_dense) (&B4, Common) ; \ return (NULL) ; \ } \ Xi = X->i ; \ Xx = X->x ; \ Xz = X->z ; \ } /* ========================================================================== */ /* === cholmod_spolve ======================================================= */ /* ========================================================================== */ cholmod_sparse *CHOLMOD(spsolve) /* returns the sparse solution X */ ( /* ---- input ---- */ int sys, /* system to solve */ cholmod_factor *L, /* factorization to use */ cholmod_sparse *B, /* right-hand-side */ /* --------------- */ cholmod_common *Common ) { double x, z ; cholmod_dense *X4, *B4 ; cholmod_sparse *X ; double *Bx, *Bz, *Xx, *Xz, *B4x, *B4z, *X4x, *X4z ; Int *Bi, *Bp, *Xp, *Xi, *Bnz ; Int n, nrhs, q, p, i, j, jfirst, jlast, packed, block, pend, j_n, xtype ; size_t xnz, nzmax ; /* ---------------------------------------------------------------------- */ /* check inputs */ /* ---------------------------------------------------------------------- */ RETURN_IF_NULL_COMMON (NULL) ; RETURN_IF_NULL (L, NULL) ; RETURN_IF_NULL (B, NULL) ; RETURN_IF_XTYPE_INVALID (L, CHOLMOD_REAL, CHOLMOD_ZOMPLEX, NULL) ; RETURN_IF_XTYPE_INVALID (B, CHOLMOD_REAL, CHOLMOD_ZOMPLEX, NULL) ; if (L->n != B->nrow) { ERROR (CHOLMOD_INVALID, "dimensions of L and B do not match") ; return (NULL) ; } if (B->stype) { ERROR (CHOLMOD_INVALID, "B cannot be stored in symmetric mode") ; return (NULL) ; } Common->status = CHOLMOD_OK ; /* ---------------------------------------------------------------------- */ /* allocate workspace B4 and initial result X */ /* ---------------------------------------------------------------------- */ n = L->n ; nrhs = B->ncol ; /* X is real if both L and B are real, complex/zomplex otherwise */ xtype = (L->xtype == CHOLMOD_REAL && B->xtype == CHOLMOD_REAL) ? CHOLMOD_REAL : (Common->prefer_zomplex ? CHOLMOD_ZOMPLEX : CHOLMOD_COMPLEX) ; /* solve up to 4 columns at a time */ block = MIN (nrhs, 4) ; /* initial size of X is at most 4*n */ nzmax = n*block ; X = CHOLMOD(spzeros) (n, nrhs, nzmax, xtype, Common) ; B4 = CHOLMOD(zeros) (n, block, B->xtype, Common) ; if (Common->status < CHOLMOD_OK) { CHOLMOD(free_sparse) (&X, Common) ; CHOLMOD(free_dense) (&B4, Common) ; return (NULL) ; } Bp = B->p ; Bi = B->i ; Bx = B->x ; Bz = B->z ; Bnz = B->nz ; packed = B->packed ; Xp = X->p ; Xi = X->i ; Xx = X->x ; Xz = X->z ; xnz = 0 ; B4x = B4->x ; B4z = B4->z ; /* ---------------------------------------------------------------------- */ /* solve in chunks of 4 columns at a time */ /* ---------------------------------------------------------------------- */ for (jfirst = 0 ; jfirst < nrhs ; jfirst += block) { /* ------------------------------------------------------------------ */ /* adjust the number of columns of B4 */ /* ------------------------------------------------------------------ */ jlast = MIN (nrhs, jfirst + block) ; B4->ncol = jlast - jfirst ; /* ------------------------------------------------------------------ */ /* scatter B(jfirst:jlast-1) into B4 */ /* ------------------------------------------------------------------ */ for (j = jfirst ; j < jlast ; j++) { p = Bp [j] ; pend = (packed) ? (Bp [j+1]) : (p + Bnz [j]) ; j_n = (j-jfirst)*n ; switch (B->xtype) { case CHOLMOD_REAL: for ( ; p < pend ; p++) { B4x [Bi [p] + j_n] = Bx [p] ; } break ; case CHOLMOD_COMPLEX: for ( ; p < pend ; p++) { q = Bi [p] + j_n ; B4x [2*q ] = Bx [2*p ] ; B4x [2*q+1] = Bx [2*p+1] ; } break ; case CHOLMOD_ZOMPLEX: for ( ; p < pend ; p++) { q = Bi [p] + j_n ; B4x [q] = Bx [p] ; B4z [q] = Bz [p] ; } break ; } } /* ------------------------------------------------------------------ */ /* solve the system (X4 = A\B4 or other system) */ /* ------------------------------------------------------------------ */ X4 = CHOLMOD(solve) (sys, L, B4, Common) ; if (Common->status < CHOLMOD_OK) { CHOLMOD(free_sparse) (&X, Common) ; CHOLMOD(free_dense) (&B4, Common) ; CHOLMOD(free_dense) (&X4, Common) ; return (NULL) ; } ASSERT (X4->xtype == xtype) ; X4x = X4->x ; X4z = X4->z ; /* ------------------------------------------------------------------ */ /* append the solution onto X */ /* ------------------------------------------------------------------ */ for (j = jfirst ; j < jlast ; j++) { Xp [j] = xnz ; j_n = (j-jfirst)*n ; if ( xnz + n <= nzmax) { /* ---------------------------------------------------------- */ /* X is guaranteed to be large enough */ /* ---------------------------------------------------------- */ switch (xtype) { case CHOLMOD_REAL: for (i = 0 ; i < n ; i++) { x = X4x [i + j_n] ; if (IS_NONZERO (x)) { Xi [xnz] = i ; Xx [xnz] = x ; xnz++ ; } } break ; case CHOLMOD_COMPLEX: for (i = 0 ; i < n ; i++) { x = X4x [2*(i + j_n) ] ; z = X4x [2*(i + j_n)+1] ; if (IS_NONZERO (x) || IS_NONZERO (z)) { Xi [xnz] = i ; Xx [2*xnz ] = x ; Xx [2*xnz+1] = z ; xnz++ ; } } break ; case CHOLMOD_ZOMPLEX: for (i = 0 ; i < n ; i++) { x = X4x [i + j_n] ; z = X4z [i + j_n] ; if (IS_NONZERO (x) || IS_NONZERO (z)) { Xi [xnz] = i ; Xx [xnz] = x ; Xz [xnz] = z ; xnz++ ; } } break ; } } else { /* ---------------------------------------------------------- */ /* X may need to increase in size */ /* ---------------------------------------------------------- */ switch (xtype) { case CHOLMOD_REAL: for (i = 0 ; i < n ; i++) { x = X4x [i + j_n] ; if (IS_NONZERO (x)) { EXPAND_AS_NEEDED ; Xi [xnz] = i ; Xx [xnz] = x ; xnz++ ; } } break ; case CHOLMOD_COMPLEX: for (i = 0 ; i < n ; i++) { x = X4x [2*(i + j_n) ] ; z = X4x [2*(i + j_n)+1] ; if (IS_NONZERO (x) || IS_NONZERO (z)) { EXPAND_AS_NEEDED ; Xi [xnz] = i ; Xx [2*xnz ] = x ; Xx [2*xnz+1] = z ; xnz++ ; } } break ; case CHOLMOD_ZOMPLEX: for (i = 0 ; i < n ; i++) { x = X4x [i + j_n] ; z = X4z [i + j_n] ; if (IS_NONZERO (x) || IS_NONZERO (z)) { EXPAND_AS_NEEDED ; Xi [xnz] = i ; Xx [xnz] = x ; Xz [xnz] = z ; xnz++ ; } } break ; } } } CHOLMOD(free_dense) (&X4, Common) ; /* ------------------------------------------------------------------ */ /* clear B4 for next iteration */ /* ------------------------------------------------------------------ */ if (jlast < nrhs) { for (j = jfirst ; j < jlast ; j++) { p = Bp [j] ; pend = (packed) ? (Bp [j+1]) : (p + Bnz [j]) ; j_n = (j-jfirst)*n ; switch (B->xtype) { case CHOLMOD_REAL: for ( ; p < pend ; p++) { B4x [Bi [p] + j_n] = 0 ; } break ; case CHOLMOD_COMPLEX: for ( ; p < pend ; p++) { q = Bi [p] + j_n ; B4x [2*q ] = 0 ; B4x [2*q+1] = 0 ; } break ; case CHOLMOD_ZOMPLEX: for ( ; p < pend ; p++) { q = Bi [p] + j_n ; B4x [q] = 0 ; B4z [q] = 0 ; } break ; } } } } Xp [nrhs] = xnz ; /* ---------------------------------------------------------------------- */ /* reduce X in size, free workspace, and return result */ /* ---------------------------------------------------------------------- */ ASSERT (xnz <= X->nzmax) ; CHOLMOD(reallocate_sparse) (xnz, X, Common) ; ASSERT (Common->status == CHOLMOD_OK) ; CHOLMOD(free_dense) (&B4, Common) ; return (X) ; } #endif
chessbyte/ansible_tower_client
lib/ansible_tower_client/base_models/schedule.rb
module AnsibleTowerClient class Schedule < BaseModel end end
TU-Berlin-DIMA/babelfish
benchmark/src/main/java/de/tub/dima/babelfish/benchmark/datasources/queries/DataSourceQuery6.java
<gh_stars>1-10 package de.tub.dima.babelfish.benchmark.datasources.queries; import de.tub.dima.babelfish.ir.lqp.LogicalOperator; import de.tub.dima.babelfish.ir.lqp.Sink; import de.tub.dima.babelfish.ir.lqp.relational.*; import de.tub.dima.babelfish.ir.lqp.schema.FieldConstant; import de.tub.dima.babelfish.ir.lqp.schema.FieldReference; import de.tub.dima.babelfish.typesytem.record.SchemaExtractionException; import de.tub.dima.babelfish.typesytem.udt.Date; import de.tub.dima.babelfish.typesytem.valueTypes.number.numeric.EagerNumeric; import de.tub.dima.babelfish.typesytem.valueTypes.number.numeric.Numeric; import java.io.IOException; public class DataSourceQuery6 { public static Sink relationalQueryTCPH6_csv(LogicalOperator scan) throws IOException, SchemaExtractionException, InterruptedException { Selection selection = new Selection( new Predicate.And( new Predicate.GreaterEquals<>( new FieldReference<>("l_shipdate", Date.class), new FieldConstant<>(new Date("1994-01-01"))), new Predicate.And( new Predicate.LessThen<>( new FieldReference<>("l_shipdate", Date.class), new FieldConstant<>(new Date("1995-01-01"))), new Predicate.And( new Predicate.LessEquals<>( new FieldReference<>("l_discount", Numeric.class, 2), new FieldConstant<>(new EagerNumeric(7, 2))), new Predicate.And( new Predicate.LessThen<>( new FieldReference<>("l_quantity", Numeric.class, 2), new FieldConstant<>(new EagerNumeric(24, 0))), new Predicate.GreaterEquals<>( new FieldReference<>("l_discount", Numeric.class, 2), new FieldConstant<>(new EagerNumeric(5, 2))) ) ) ) )); scan.addChild(selection); Function<?> function = new Function<>( new Function.BinaryExpression( new Function.ValueExpression(new FieldReference<>("l_extendedprice", Numeric.class, 2)), new Function.ValueExpression(new FieldReference<>("l_discount", Numeric.class, 2)), Function.FunctionType.Mul ), "revenue"); selection.addChild(function); GroupBy groupBy = new GroupBy(new Aggregation.Sum(new FieldReference<>("revenue", Numeric.class, 2))); function.addChild(groupBy); Sink sink = new Sink.MemorySink(); groupBy.addChild(sink); return sink; } public static Sink relationalQueryTCPH6_Arrow(LogicalOperator scan) throws IOException, SchemaExtractionException, InterruptedException { Selection selection = new Selection( new Predicate.And( new Predicate.GreaterEquals<>( new FieldReference<>("l_shipdate", Date.class), new FieldConstant<>(new Date("1994-01-01"))), new Predicate.And( new Predicate.LessThen<>( new FieldReference<>("l_shipdate", Date.class), new FieldConstant<>(new Date("1995-01-01"))), new Predicate.And( new Predicate.LessEquals<>( new FieldReference<>("l_discount", Numeric.class, 2), new FieldConstant<>(new EagerNumeric(7, 2))), new Predicate.And( new Predicate.LessThen<>( new FieldReference<>("l_quantity", Numeric.class, 2), new FieldConstant<>(new EagerNumeric(2400, 2))), new Predicate.GreaterEquals<>( new FieldReference<>("l_discount", Numeric.class, 2), new FieldConstant<>(new EagerNumeric(5, 2))) ) ) ) )); scan.addChild(selection); Function<?> function = new Function<>( new Function.BinaryExpression( new Function.ValueExpression(new FieldReference<>("l_extendedprice", Numeric.class, 2)), new Function.ValueExpression(new FieldReference<>("l_discount", Numeric.class, 2)), Function.FunctionType.Mul ), "revenue"); selection.addChild(function); GroupBy groupBy = new GroupBy(new Aggregation.Sum(new FieldReference<>("revenue", Numeric.class, 2))); function.addChild(groupBy); Sink sink = new Sink.MemorySink(); groupBy.addChild(sink); return sink; } }
rrwt/daily-coding-challenge
ctci/ch1/string_compression.py
""" Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2b1c5a3. If the "compressed" string would not become smaller than the original string, your method should return the original string. You can assume the string has only uppercase and lowercase letters (a - z). """ # O(n) def compress(str_in): l = len(str_in) i = 0 res = [] while i < l: count = 1 cur = str_in[i] i += 1 while i < l: if str_in[i] != cur: break count += 1 i += 1 res.extend([cur, count]) res = "".join(res) return res if len(res) < l else str_in if __name__ == "__main__": assert compress("aabcccccaaa") == "a2b1c5a3" test()
JordanMcManus/OpenSidescan
src/OpenSidescan/refactorme/boolwithmutex.h
<gh_stars>1-10 /* * Copyright 2019 © Centre Interdisciplinaire de développement en Cartographie des Océans (CIDCO), Tous droits réservés */ /* * \author <NAME> */ #ifndef BOOLWITHMUTEX_H #define BOOLWITHMUTEX_H #include <QMutex> #include <QMutexLocker> // Based on https://stackoverflow.com/questions/8971168/how-to-use-qmutex class BoolWithMutex { public: BoolWithMutex( bool value ) : value( value ) { } bool getValue() { QMutexLocker ml(&mutex); return value; } bool setValue( bool valueIn ) { QMutexLocker ml(&mutex); value = valueIn; return value; } private: QMutex mutex; bool value; }; #endif // BOOLWITHMUTEX_H
yuanfangtardis/vscode_project
Externals/micromegas_4.3.5/include/microPath.h
#define micrO "/home/yuanfang/Desktop/multinest_latest/Externals/micromegas_4.3.5"
iliyaST/TelericAcademy
JavaScript-Fundamentals/11-Exams/07-June-2016-1800-SecondAttempt/01.Pockets.js
function solve(args) { let heights = args[0].split(' ').map(Number), peaks = [], pocketsSum = 0; for (let i = 1; i < heights.length - 1; i += 1) { if (heights[i] > heights[i - 1] && heights[i] > heights[i + 1]) { peaks.push(i); } } for (let i = 0; i < peaks.length; i += 1) { if (peaks[i] + 2 == peaks[i + 1]) { if (heights[peaks[i] + 1] != undefined) { pocketsSum += heights[peaks[i] + 1]; } } } console.log(pocketsSum); } solve( [ "53 20 1 30 2 40 3 3 10 1" ] );
kkucherenkov/FxCameraApp
src/com/af/experiments/FxCameraApp/shaders/GlColorMatrixShader.java
<gh_stars>10-100 package com.af.experiments.FxCameraApp.shaders; import static android.opengl.GLES20.glUniform1f; import static android.opengl.GLES20.glUniformMatrix4fv; public class GlColorMatrixShader extends GlShader { private static final String FRAGMENT_SHADER = "precision mediump float;" + "varying highp vec2 vTextureCoord;" + "uniform lowp sampler2D sTexture;" + "uniform lowp mat4 colorMatrix;" + "uniform lowp float intensity;" + "void main() {" + "lowp vec4 color = texture2D(sTexture, vTextureCoord);" + "lowp vec4 outputColor = color * colorMatrix;" + "gl_FragColor = (intensity * outputColor) + ((1.0 - intensity) * color);" + "}"; private float[] mColorMatrix = new float[]{ 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f }; private float mIntensity = 1.0f; public GlColorMatrixShader() { super(DEFAULT_VERTEX_SHADER, FRAGMENT_SHADER); } public float[] getColorMatrix() { return mColorMatrix; } public void setColorMatrix(float[] colorMatrix) { mColorMatrix = colorMatrix; } public float getIntensity() { return mIntensity; } public void setIntensity(float intensity) { mIntensity = intensity; } @Override public void onDraw() { glUniformMatrix4fv(getHandle("colorMatrix"), 0, false, mColorMatrix, 0); glUniform1f(getHandle("intensity"), mIntensity); } }
BakaErii/ACM_Collection
CodeForces/1015A/18389540_AC_31ms_12kB.cpp
/** * @author Moe_Sakiya <EMAIL> * @date 2018-07-31 22:09:20 * */ #include <iostream> #include <string> #include <algorithm> #include <set> #include <map> #include <vector> #include <stack> #include <queue> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> using namespace std; int n, m; bool vis[105]; int cnt; int main(void) { ios::sync_with_stdio(false); cin.tie(NULL); int l, r; memset(vis, 0, sizeof(vis)); scanf("%d %d", &n, &m); cnt = m; for (int i = 0; i < n; i++) { scanf("%d %d", &l, &r); for (int j = l; j <= r; j++) { if (vis[j] == false) cnt--; vis[j] = true; } } printf("%d\n", cnt ); bool isFirst = true; for (int i = 1; i <= m; i++) if (vis[i] == false) { if (isFirst == false) putchar(' '); isFirst = false; printf("%d", i); } putchar('\n'); return 0; }
lofunz/mieme
MAME4all/trunk/src/cpuintrf.h
#ifndef CPUINTRF_H #define CPUINTRF_H #include "osd_cpu.h" #include "memory.h" #include "timer.h" /* The old system is obsolete and no longer supported by the core */ #define NEW_INTERRUPT_SYSTEM 1 #define MAX_IRQ_LINES 8 /* maximum number of IRQ lines per CPU */ #define CLEAR_LINE 0 /* clear (a fired, held or pulsed) line */ #define ASSERT_LINE 1 /* assert an interrupt immediately */ #define HOLD_LINE 2 /* hold interrupt line until enable is true */ #define PULSE_LINE 3 /* pulse interrupt line for one instruction */ #define MAX_REGS 128 /* maximum number of register of any CPU */ /* Values passed to the cpu_info function of a core to retrieve information */ enum { CPU_INFO_REG, CPU_INFO_FLAGS=MAX_REGS, CPU_INFO_NAME, CPU_INFO_FAMILY, CPU_INFO_VERSION, CPU_INFO_FILE, CPU_INFO_CREDITS, CPU_INFO_REG_LAYOUT, CPU_INFO_WIN_LAYOUT }; #define CPU_IS_LE 0 /* emulated CPU is little endian */ #define CPU_IS_BE 1 /* emulated CPU is big endian */ /* * This value is passed to cpu_get_reg to retrieve the previous * program counter value, ie. before a CPU emulation started * to fetch opcodes and arguments for the current instrution. */ #define REG_PREVIOUSPC -1 /* * This value is passed to cpu_get_reg/cpu_set_reg, instead of one of * the names from the enum a CPU core defines for it's registers, * to get or set the contents of the memory pointed to by a stack pointer. * You can specify the n'th element on the stack by (REG_SP_CONTENTS-n), * ie. lower negative values. The actual element size (UINT16 or UINT32) * depends on the CPU core. * This is also used to replace the cpu_geturnpc() function. */ #define REG_SP_CONTENTS -2 /* * These flags can be defined in the makefile (or project) to * exclude (zero) or include (non zero) specific CPU cores */ #ifndef HAS_GENSYNC #define HAS_GENSYNC 0 #endif #ifndef HAS_Z80 #define HAS_Z80 0 #endif #ifndef HAS_Z80_VM #define HAS_Z80_VM 0 #endif #ifndef HAS_8080 #define HAS_8080 0 #endif #ifndef HAS_8085A #define HAS_8085A 0 #endif #ifndef HAS_M6502 #define HAS_M6502 0 #endif #ifndef HAS_M65C02 #define HAS_M65C02 0 #endif #ifndef HAS_M65SC02 #define HAS_M65SC02 0 #endif #ifndef HAS_M65CE02 #define HAS_M65CE02 0 #endif #ifndef HAS_M6509 #define HAS_M6509 0 #endif #ifndef HAS_M6510 #define HAS_M6510 0 #endif #ifndef HAS_M6510T #define HAS_M6510T 0 #endif #ifndef HAS_M7501 #define HAS_M7501 0 #endif #ifndef HAS_M8502 #define HAS_M8502 0 #endif #ifndef HAS_N2A03 #define HAS_N2A03 0 #endif #ifndef HAS_M4510 #define HAS_M4510 0 #endif #ifndef HAS_H6280 #define HAS_H6280 0 #endif #ifndef HAS_I86 #define HAS_I86 0 #endif #ifndef HAS_I88 #define HAS_I88 0 #endif #ifndef HAS_I186 #define HAS_I186 0 #endif #ifndef HAS_I188 #define HAS_I188 0 #endif #ifndef HAS_I286 #define HAS_I286 0 #endif #ifndef HAS_V20 #define HAS_V20 0 #endif #ifndef HAS_V30 #define HAS_V30 0 #endif #ifndef HAS_V33 #define HAS_V33 0 #endif #ifndef HAS_ARMNEC #define HAS_ARMNEC 0 #endif #ifndef HAS_I8035 #define HAS_I8035 0 #endif #ifndef HAS_I8039 #define HAS_I8039 0 #endif #ifndef HAS_I8048 #define HAS_I8048 0 #endif #ifndef HAS_N7751 #define HAS_N7751 0 #endif #ifndef HAS_M6800 #define HAS_M6800 0 #endif #ifndef HAS_M6801 #define HAS_M6801 0 #endif #ifndef HAS_M6802 #define HAS_M6802 0 #endif #ifndef HAS_M6803 #define HAS_M6803 0 #endif #ifndef HAS_M6808 #define HAS_M6808 0 #endif #ifndef HAS_HD63701 #define HAS_HD63701 0 #endif #ifndef HAS_M6805 #define HAS_M6805 0 #endif #ifndef HAS_M68705 #define HAS_M68705 0 #endif #ifndef HAS_HD63705 #define HAS_HD63705 0 #endif #ifndef HAS_HD6309 #define HAS_HD6309 0 #endif #ifndef HAS_M6809 #define HAS_M6809 0 #endif #ifndef HAS_KONAMI #define HAS_KONAMI 0 #endif #ifndef HAS_M68000 #define HAS_M68000 0 #endif #ifndef HAS_M68010 #define HAS_M68010 0 #endif #ifndef HAS_M68EC020 #define HAS_M68EC020 0 #endif #ifndef HAS_M68020 #define HAS_M68020 0 #endif #ifndef HAS_T11 #define HAS_T11 0 #endif #ifndef HAS_S2650 #define HAS_S2650 0 #endif #ifndef HAS_TMS34010 #define HAS_TMS34010 0 #endif #ifndef HAS_TMS9900 #define HAS_TMS9900 0 #endif #ifndef HAS_TMS9940 #define HAS_TMS9940 0 #endif #ifndef HAS_TMS9980 #define HAS_TMS9980 0 #endif #ifndef HAS_TMS9985 #define HAS_TMS9985 0 #endif #ifndef HAS_TMS9989 #define HAS_TMS9989 0 #endif #ifndef HAS_TMS9995 #define HAS_TMS9995 0 #endif #ifndef HAS_TMS99105A #define HAS_TMS99105A 0 #endif #ifndef HAS_TMS99110A #define HAS_TMS99110A 0 #endif #ifndef HAS_Z8000 #define HAS_Z8000 0 #endif #ifndef HAS_TMS320C10 #define HAS_TMS320C10 0 #endif #ifndef HAS_CCPU #define HAS_CCPU 0 #endif #ifndef HAS_PDP1 #define HAS_PDP1 0 #endif #ifndef HAS_ADSP2100 #define HAS_ADSP2100 0 #endif #ifndef HAS_ADSP2105 #define HAS_ADSP2105 0 #endif #ifndef HAS_MIPS #define HAS_MIPS 0 #endif #ifndef HAS_SC61860 #define HAS_SC61860 0 #endif #ifndef HAS_ARM #define HAS_ARM 0 #endif /* ASG 971222 -- added this generic structure */ struct cpu_interface { unsigned cpu_num; void (*reset)(void *param); void (*exit)(void); int (*execute)(int cycles); void (*burn)(int cycles); unsigned (*get_context)(void *reg); void (*set_context)(void *reg); void *(*get_cycle_table)(int which); void (*set_cycle_table)(int which, void *new_table); unsigned (*get_pc)(void); void (*set_pc)(unsigned val); unsigned (*get_sp)(void); void (*set_sp)(unsigned val); unsigned (*get_reg)(int regnum); void (*set_reg)(int regnum, unsigned val); void (*set_nmi_line)(int linestate); void (*set_irq_line)(int irqline, int linestate); void (*set_irq_callback)(int(*callback)(int irqline)); void (*internal_interrupt)(int type); void (*cpu_state_save)(void *file); void (*cpu_state_load)(void *file); const char* (*cpu_info)(void *context,int regnum); unsigned (*cpu_dasm)(char *buffer,unsigned pc); unsigned num_irqs; int default_vector; int *icount; float overclock; int no_int, irq_int, nmi_int; mem_read_handler memory_read; mem_write_handler memory_write; void (*set_op_base)(int pc); int address_shift; unsigned address_bits, endianess, align_unit, max_inst_len; unsigned abits1, abits2, abitsmin; } __attribute__ ((__aligned__ (32))); extern struct cpu_interface cpuintf[]; void cpu_init(void); void cpu_run(void); /* optional watchdog */ WRITE_HANDLER( watchdog_reset_w ); READ_HANDLER( watchdog_reset_r ); /* Use this function to reset the machine */ void machine_reset(void); /* Use this function to reset a single CPU */ void cpu_set_reset_line(int cpu,int state); /* Use this function to halt a single CPU */ void cpu_set_halt_line(int cpu,int state); /* This function returns CPUNUM current status (running or halted) */ int cpu_getstatus(int cpunum); int cpu_gettotalcpu(void); int cpu_getactivecpu(void); void cpu_setactivecpu(int cpunum); /* Returns the current program counter */ unsigned cpu_get_pc(void); /* Set the current program counter */ void cpu_set_pc(unsigned val); /* Returns the current stack pointer */ unsigned cpu_get_sp(void); /* Set the current stack pointer */ void cpu_set_sp(unsigned val); /* Get the active CPUs context and return it's size */ unsigned cpu_get_context(void *context); /* Set the active CPUs context */ void cpu_set_context(void *context); /* Get a pointer to the active CPUs cycle count lookup table */ void *cpu_get_cycle_table(int which); /* Override a pointer to the active CPUs cycle count lookup table */ void cpu_set_cycle_tbl(int which, void *new_table); /* Returns a specific register value (mamedbg) */ unsigned cpu_get_reg(int regnum); /* Sets a specific register value (mamedbg) */ void cpu_set_reg(int regnum, unsigned val); /* Returns previous pc (start of opcode causing read/write) */ /* int cpu_getpreviouspc(void); */ #define cpu_getpreviouspc() cpu_get_reg(REG_PREVIOUSPC) /* Returns the return address from the top of the stack (Z80 only) */ /* int cpu_getreturnpc(void); */ /* This can now be handled with a generic function */ #define cpu_geturnpc() cpu_get_reg(REG_SP_CONTENTS) int cycles_currently_ran(void); int cycles_left_to_run(void); /* Returns the number of CPU cycles which take place in one video frame */ int cpu_gettotalcycles(void); /* Returns the number of CPU cycles before the next interrupt handler call */ int cpu_geticount(void); /* Returns the number of CPU cycles before the end of the current video frame */ int cpu_getfcount(void); /* Returns the number of CPU cycles in one video frame */ int cpu_getfperiod(void); /* Scales a given value by the ratio of fcount / fperiod */ int cpu_scalebyfcount(int value); /* Returns the current scanline number */ int cpu_getscanline(void); /* Returns the amount of time until a given scanline */ timer_tm cpu_getscanlinetime(int scanline); /* Returns the duration of a single scanline */ timer_tm cpu_getscanlineperiod(void); /* Returns the duration of a single scanline in cycles */ int cpu_getscanlinecycles(void); /* Returns the number of cycles since the beginning of this frame */ int cpu_getcurrentcycles(void); /* Returns the current horizontal beam position in pixels */ int cpu_gethorzbeampos(void); /* Returns the number of times the interrupt handler will be called before the end of the current video frame. This is can be useful to interrupt handlers to synchronize their operation. If you call this from outside an interrupt handler, add 1 to the result, i.e. if it returns 0, it means that the interrupt handler will be called once. */ int cpu_getiloops(void); /* Returns the current VBLANK state */ int cpu_getvblank(void); /* Returns the number of the video frame we are currently playing */ int cpu_getcurrentframe(void); /* generate a trigger after a specific period of time */ void cpu_triggertime (timer_tm duration, int trigger); /* generate a trigger now */ void cpu_trigger (int trigger); /* burn CPU cycles until a timer trigger */ void cpu_spinuntil_trigger (int trigger); /* burn CPU cycles until the next interrupt */ void cpu_spinuntil_int (void); /* burn CPU cycles until our timeslice is up */ void cpu_spin (void); /* burn CPU cycles for a specific period of time */ void cpu_spinuntil_time (timer_tm duration); /* yield our timeslice for a specific period of time */ void cpu_yielduntil_trigger (int trigger); /* yield our timeslice until the next interrupt */ void cpu_yielduntil_int (void); /* yield our current timeslice */ void cpu_yield (void); /* yield our timeslice for a specific period of time */ void cpu_yielduntil_time (timer_tm duration); /* set the NMI line state for a CPU, normally use PULSE_LINE */ void cpu_set_nmi_line(int cpunum, int state); /* set the IRQ line state for a specific irq line of a CPU */ /* normally use state HOLD_LINE, irqline 0 for first IRQ type of a cpu */ void cpu_set_irq_line(int cpunum, int irqline, int state); /* this is to be called by CPU cores only! */ void cpu_generate_internal_interrupt(int cpunum, int type); /* set the vector to be returned during a CPU's interrupt acknowledge cycle */ void cpu_irq_line_vector_w(int cpunum, int irqline, int vector); /* use this function to install a driver callback for IRQ acknowledge */ void cpu_set_irq_callback(int cpunum, int (*callback)(int)); /* use these in your write memory/port handles to set an IRQ vector */ /* offset corresponds to the irq line number here */ WRITE_HANDLER( cpu_0_irq_line_vector_w ); WRITE_HANDLER( cpu_1_irq_line_vector_w ); WRITE_HANDLER( cpu_2_irq_line_vector_w ); WRITE_HANDLER( cpu_3_irq_line_vector_w ); WRITE_HANDLER( cpu_4_irq_line_vector_w ); WRITE_HANDLER( cpu_5_irq_line_vector_w ); WRITE_HANDLER( cpu_6_irq_line_vector_w ); WRITE_HANDLER( cpu_7_irq_line_vector_w ); /* Obsolete functions: avoid to use them in new drivers if possible. */ /* cause an interrupt on a CPU */ void cpu_cause_interrupt(int cpu,int type); void cpu_clear_pending_interrupts(int cpu); WRITE_HANDLER( interrupt_enable_w ); WRITE_HANDLER( interrupt_vector_w ); int interrupt(void); int nmi_interrupt(void); int m68_level1_irq(void); int m68_level2_irq(void); int m68_level3_irq(void); int m68_level4_irq(void); int m68_level5_irq(void); int m68_level6_irq(void); int m68_level7_irq(void); int ignore_interrupt(void); /* CPU context access */ void* cpu_getcontext (int _activecpu); int cpu_is_saving_context(int _activecpu); /*************************************************************************** * Get information for the currently active CPU * cputype is a value from the CPU enum in driver.h ***************************************************************************/ /* Return number of address bits */ unsigned cpu_address_bits(void); /* Return address mask */ unsigned cpu_address_mask(void); /* Return address shift factor (TMS34010 bit addressing mode) */ int cpu_address_shift(void); /* Return endianess of the emulated CPU (CPU_IS_LE or CPU_IS_BE) */ unsigned cpu_endianess(void); /* Return opcode align unit (1 byte, 2 word, 4 dword) */ unsigned cpu_align_unit(void); /* Return maximum instruction length */ unsigned cpu_max_inst_len(void); /* Return name of the active CPU */ const char *cpu_name(void); /* Return family name of the active CPU */ const char *cpu_core_family(void); /* Return core version of the active CPU */ const char *cpu_core_version(void); /* Return core filename of the active CPU */ const char *cpu_core_file(void); /* Return credits info for of the active CPU */ const char *cpu_core_credits(void); /* Disassemble an instruction at PC into the given buffer */ unsigned cpu_dasm(char *buffer, unsigned pc); /* Return a string describing the currently set flag (status) bits of the active CPU */ const char *cpu_flags(void); /*************************************************************************** * Get information for a specific CPU type * cputype is a value from the CPU enum in driver.h ***************************************************************************/ /* Return address shift factor */ /* TMS320C10 -1: word addressing mode, TMS34010 3: bit addressing mode */ int cputype_address_shift(int cputype); /* Return number of address bits */ unsigned cputype_address_bits(int cputype); /* Return address mask */ unsigned cputype_address_mask(int cputype); /* Return endianess of the emulated CPU (CPU_IS_LE or CPU_IS_BE) */ unsigned cputype_endianess(int cputype); /* Return opcode align unit (1 byte, 2 word, 4 dword) */ unsigned cputype_align_unit(int cputype); /* Return maximum instruction length */ unsigned cputype_max_inst_len(int cputype); /* Return name of the CPU */ const char *cputype_name(int cputype); /* Return family name of the CPU */ const char *cputype_core_family(int cputype); /* Return core version number of the CPU */ const char *cputype_core_version(int cputype); /* Return core filename of the CPU */ const char *cputype_core_file(int cputype); /* Return credits for the CPU core */ const char *cputype_core_credits(int cputype); /*************************************************************************** * Get (or set) information for a numbered CPU of the running machine * cpunum is a value between 0 and cpu_gettotalcpu() - 1 ***************************************************************************/ /* Return number of address bits */ unsigned cpunum_address_bits(int cputype); /* Return address mask */ unsigned cpunum_address_mask(int cputype); /* Return endianess of the emulated CPU (CPU_LSB_FIRST or CPU_MSB_FIRST) */ unsigned cpunum_endianess(int cputype); /* Return opcode align unit (1 byte, 2 word, 4 dword) */ unsigned cpunum_align_unit(int cputype); /* Return maximum instruction length */ unsigned cpunum_max_inst_len(int cputype); /* Get a register value for the specified CPU number of the running machine */ unsigned cpunum_get_reg(int cpunum, int regnum); /* Set a register value for the specified CPU number of the running machine */ void cpunum_set_reg(int cpunum, int regnum, unsigned val); unsigned cpunum_dasm(int cpunum,char *buffer,unsigned pc); /* Return a string describing the currently set flag (status) bits of the CPU */ const char *cpunum_flags(int cpunum); /* Return a name for the specified cpu number */ const char *cpunum_name(int cpunum); /* Return a family name for the specified cpu number */ const char *cpunum_core_family(int cpunum); /* Return a version for the specified cpu number */ const char *cpunum_core_version(int cpunum); /* Return a the source filename for the specified cpu number */ const char *cpunum_core_file(int cpunum); /* Return a the credits for the specified cpu number */ const char *cpunum_core_credits(int cpunum); /* daisy-chain link */ typedef struct { void (*reset)(int); /* reset callback */ int (*interrupt_entry)(int); /* entry callback */ void (*interrupt_reti)(int); /* reti callback */ int irq_param; /* callback paramater */ } Z80_DaisyChain; #define Z80_MAXDAISY 4 /* maximum of daisy chan device */ #define Z80_INT_REQ 0x01 /* interrupt request mask */ #define Z80_INT_IEO 0x02 /* interrupt disable mask(IEO) */ #define Z80_VECTOR(device,state) (((device)<<8)|(state)) #endif /* CPUINTRF_H */
ye32007/adzuki-sequence
adzuki-sequence-client/src/main/java/com/adzuki/sequence/service/SequenceGeneratorShort.java
<reponame>ye32007/adzuki-sequence<filename>adzuki-sequence-client/src/main/java/com/adzuki/sequence/service/SequenceGeneratorShort.java package com.adzuki.sequence.service; public interface SequenceGeneratorShort { /** * 短序列,8位长度,日百万级,生成规则:2位实例+6位序列) * @param seqName 业务名称 * @return */ String getNextUUID(String seqName); }
Dannyzen/python-kemptech-api
python_kemptech_api/client.py
# flake8: noqa # pylint: skip-file # This module is present purely for backwards compatibility purposes. from .generic import ( HttpClient, BaseKempObject) from .models import ( BaseKempAppliance, Geo, LoadMaster) from .objects import ( VirtualService, RealServer, Template, Rule, Sso, CipherSet, Certificate, Fqdn, Site, Cluster, Range, CustomLocation) from .api_xml import ( get_data) from .exceptions import *
yubo1993/GGNNSmartVulDetector
data/infinite_loop/graph_data/nodes/function_call44444.c
<gh_stars>1-10 FUN1 uint16 NULL 1 0 NULL NULL FUN2 void FUN1 1 4 CALL NULL VAR0 FUN2 3 INNFUN ASSIGN
WiLLiAM111333/coinflipbot
src/client/events/channelUpdate.js
module.exports = (client, oldChannel, newChannel) => { client.moderationLogger.handleChannelUpdate(oldChannel, newChannel); }
pawREP/GlacierFormats
GlacierFormats/src/RPKG.h
<filename>GlacierFormats/src/RPKG.h #pragma once #include <cstdint> #include <filesystem> #include <unordered_map> #include "BinaryWriter.hpp" #include "BinaryReader.hpp" #include "GlacierResource.h" #include "GlacierTypes.h" #include "ResourceReference.h" namespace GlacierFormats { enum class RPKG_TYPE { BASE, PATCH }; class PkgFile { public: struct Dependency { //The flags are poorly understood but they seem to indicate how the references are aquired/loaded. (streamed, install time acquired, sync, async ...) uint8_t flags; uint64_t runtimeID; }; private: struct EntryInfo { uint64_t runtimeID; uint64_t data_offset; uint32_t compressed_size; bool is_encrypted; bool is_compressed; void read(BinaryReader& br); void write(BinaryWriter& bw) const; }; struct EntryDescriptor { std::string type; uint32_t dependency_descriptor_size; uint32_t chunk_size; uint32_t size; uint32_t mem_size; uint32_t video_mem_size; uint32_t dependency_count; uint32_t dependency_table_ordering; std::vector<ResourceReference> references; void read(BinaryReader& br); void write(BinaryWriter& bw) const; }; public: EntryInfo entry_info; EntryDescriptor entry_descriptor; std::unique_ptr<std::vector<char>> data; }; class RPKG { //TODO: Needs major refactor since the requirements for this class changed significantly since ResouceRespository was factored out private: std::unique_ptr<BinaryReader> br; RPKG_TYPE guessArchiveType(BinaryReader& br); size_t getEntryInfoSectionOffset() const; size_t getDataSectionOffset() const; size_t getEntryInfoSectionSize() const; size_t getEntryDescriptorSectionSize() const; void rebuildFileDataOffsets(); public: std::string name; RPKG_TYPE archive_type; std::vector<RuntimeId> deletion_list; std::vector<PkgFile> files; std::unordered_map<RuntimeId, PkgFile*> runtime_id_map; RPKG(const std::filesystem::path& path); RPKG(); bool operator<(const RPKG& rpkg) const; const PkgFile* getFileByRuntimeId(RuntimeId runtime_id); void write(std::filesystem::path dst_path); void insertFile(RuntimeId runtime_id, const std::string& type, const std::vector<char>& data, const std::vector<ResourceReference>* references = nullptr); void insertFile(RuntimeId runtime_id, const std::string& type, const char* data, size_t data_size, const std::vector<ResourceReference>* references = nullptr); /*Allocates memory at *dst_buf, fills it with decytped/decompressed data and returns the size of allocated memory. Freeing the allocated memory is responsibility of the called. */ size_t getFileData(const PkgFile& file, char** dst_buf); size_t getFileData(RuntimeId id, char** dst_buf); }; }
sdmiller/gtsam_pcl
gtsam/base/cholesky.h
/* ---------------------------------------------------------------------------- * GTSAM Copyright 2010, Georgia Tech Research Corporation, * Atlanta, Georgia 30332-0415 * All Rights Reserved * Authors: <NAME>, et al. (see THANKS for the full author list) * See LICENSE for the license information * -------------------------------------------------------------------------- */ /** * @file cholesky.h * @brief Efficient incomplete Cholesky on rank-deficient matrices, todo: constrained Cholesky * @author <NAME> * @date Nov 5, 2010 */ #pragma once #include <gtsam/base/Matrix.h> #include <boost/shared_ptr.hpp> namespace gtsam { /** * "Careful" Cholesky computes the positive square-root of a positive symmetric * semi-definite matrix (i.e. that may be rank-deficient). Unlike standard * Cholesky, the square-root factor may have all-zero rows for free variables. * * Additionally, this function returns the index of the row after the last * non-zero row in the computed factor, so that it may be truncated to an * upper-trapazoidal matrix. * * The second element of the return value is \c true if the matrix was factored * successfully, or \c false if it was non-positive-semidefinite (i.e. * indefinite or negative-(semi-)definite. * * Note that this returned index is the rank of the matrix if and only if all * of the zero-rows of the factor occur after any non-zero rows. This is * (always?) the case during elimination of a fully-constrained least-squares * problem. * * The optional order argument specifies the size of the square upper-left * submatrix to operate on, ignoring the rest of the matrix. * * */ std::pair<size_t,bool> choleskyCareful(Matrix& ATA, int order = -1); /** * Partial Cholesky computes a factor [R S such that [R' 0 [R S = [A B * 0 L] S' I] 0 L] B' C]. * The input to this function is the matrix ABC = [A B], and the parameter * [B' C] * nFrontal determines the split between A, B, and C, with A being of size * nFrontal x nFrontal. * * @return \c true if the decomposition is successful, \c false if \c A was * not positive-definite. */ bool choleskyPartial(Matrix& ABC, size_t nFrontal); }
leemingeer/mygopractice
slice/basic.go
<reponame>leemingeer/mygopractice<gh_stars>0 package main import "fmt" func main() { var s1 []int fmt.Printf("s1: %v, %p\n", s1, &s1) // [], 0xc00000c060 fmt.Println(s1 == nil) // true, nil表示没有引用内存 fmt.Println(len(s1) == 0) //true s2 := make([]int, 0) fmt.Printf("s2: %v, %p\n", s2, &s2) // [], 0xc00000c080 fmt.Println(s2 == nil) // false fmt.Println(len(s2) == 0) //true s1 = append(s1, 1) fmt.Printf("%v\n", s1) //[1] }
vlsi/pru-emulator
src/main/java/com/github/vlsi/pru/plc110/LdiInstruction.java
package com.github.vlsi.pru.plc110; import java.util.Arrays; import java.util.List; public class LdiInstruction extends Format2Instruction { public final Register dstRegister; public final short value; public LdiInstruction( Register dstRegister, short value) { super(Operation.LDI, ((value & 0xffff) << 8) | dstRegister.mask()); this.dstRegister = dstRegister; this.value = value; } public LdiInstruction(int code) { this( // dstRegister Register.ofMask(code & 0xff), (short) ((code >> 8) & 0xffff) ); } @Override public String toString() { return op + " " + dstRegister + ", " + value + commentToString(); } }
guidosalva/REScala
Code/Extensions/Kofre/src/main/scala/kofre/datatypes/ObserveRemoveMap.scala
package kofre.datatypes import kofre.base.{Bottom, DecomposeLattice, Defs} import kofre.datatypes.GrowMap import kofre.decompose.* import kofre.decompose.interfaces.MVRegisterInterface.MVRegister import kofre.datatypes.ObserveRemoveMap import kofre.dotted.{DotMap, Dotted, DottedDecompose, DottedLattice, HasDots} import kofre.syntax.{ArdtOpsContains, DottedName, OpsSyntaxHelper} import kofre.time.{Dot, Dots} case class ObserveRemoveMap[K, V](inner: DotMap[K, V]) /** An ObserveRemoveMap (Observed-Remove Map) is a Delta CRDT that models a map from an arbitrary key type to nested causal Delta CRDTs. * In contrast to [[GrowMap]], ObserveRemoveMap allows the removal of key/value pairs from the map. * * The nested CRDTs can be queried/mutated by calling the queryKey/mutateKey methods with a DeltaQuery/DeltaMutator generated * by a CRDT Interface method of the nested CRDT. For example, to enable a nested EWFlag, one would pass `EWFlagInterface.enable()` * as the DeltaMutator to mutateKey. */ object ObserveRemoveMap { def empty[K, V]: ObserveRemoveMap[K, V] = ObserveRemoveMap(DotMap.empty) given bottom[K, V]: Bottom[ObserveRemoveMap[K, V]] = Bottom.derived given contextDecompose[K, V: DottedDecompose: HasDots: Bottom]: DottedDecompose[ObserveRemoveMap[K, V]] = import DotMap.contextDecompose DottedDecompose.derived def make[K, V]( dm: DotMap[K, V] = DotMap.empty[K, V], cc: Dots = Dots.empty ): Dotted[ObserveRemoveMap[K, V]] = Dotted(ObserveRemoveMap(dm), cc) implicit class ORMapSyntax[C, K, V](container: C)(using ArdtOpsContains[C, ObserveRemoveMap[K, V]]) extends OpsSyntaxHelper[C, ObserveRemoveMap[K, V]](container) { def contains(k: K)(using QueryP): Boolean = current.contains(k) def queryKey[A](k: K)(using QueryP, CausalP, Bottom[V]): Dotted[V] = { Dotted(current.inner.getOrElse(k, Bottom[V].empty), context) } def queryAllEntries(using QueryP): Iterable[V] = current.inner.values def mutateKey(k: K, m: (Defs.Id, Dotted[V]) => Dotted[V])(using CausalMutationP, IdentifierP, Bottom[V] ): C = { val v = current.inner.getOrElse(k, Bottom[V].empty) m(replicaID, context.wrap(v)) match { case Dotted(stateDelta, ccDelta) => make[K, V]( dm = DotMap(Map(k -> stateDelta)), cc = ccDelta ).mutator } } def mutateKeyNamedCtx(k: K)(m: DottedName[V] => DottedName[V])(using CausalMutationP, IdentifierP, Bottom[V] ): C = { val v = current.inner.getOrElse(k, Bottom[V].empty) val Dotted(stateDelta, ccDelta) = m(DottedName(replicaID, Dotted(v, context))).anon make[K, V]( dm = DotMap(Map(k -> stateDelta)), cc = ccDelta ).mutator } def remove(k: K)(using CausalMutationP, Bottom[V], HasDots[V]): C = { val v = current.inner.getOrElse(k, Bottom[V].empty) make[K, V]( cc = HasDots[V].dots(v) ).mutator } def removeAll(keys: Iterable[K])(using CausalMutationP, Bottom[V], HasDots[V]): C = { val values = keys.map(k => current.inner.getOrElse(k, Bottom[V].empty)) val dots = values.foldLeft(Dots.empty) { case (set, v) => set union HasDots[V].dots(v) } make( cc = dots ).mutator } def removeByValue(cond: Dotted[V] => Boolean)(using CausalMutationP, DottedDecompose[V], HasDots[V]): C = { val toRemove = current.inner.values.collect { case v if cond(Dotted(v, context)) => HasDots[V].dots(v) }.fold(Dots.empty)(_ union _) make( cc = toRemove ).mutator } def clear()(using CausalMutationP, DottedDecompose[V], HasDots[V]): C = { make( cc = current.inner.dots ).mutator } } }