repo_name
stringlengths
6
101
path
stringlengths
4
300
text
stringlengths
7
1.31M
xterminal86/nrogue
src/behaviour-tree/tasks/task-mine.cpp
#include "task-mine.h" #include "game-object.h" #include "map.h" #include "blackboard.h" BTResult TaskMine::Run() { //DebugLog("[TaskMine]\n"); int x = _objectToControl->PosX; int y = _objectToControl->PosY; int lx = _objectToControl->PosX - 1; int ly = _objectToControl->PosY - 1; int hx = _objectToControl->PosX + 1; int hy = _objectToControl->PosY + 1; std::vector<Position> toCheck = { { lx, y }, { hx, y }, { x, ly }, { x, hy } }; // Searching for any kind of // // ## // .# <- // ## // // Meaning number of walls around actor should be 3 // and number of walls around the wall to tunnel into // should be at least 2. // int countActor = Map::Instance().CountWallsOrthogonal(x, y); if (countActor < 3) { return BTResult::Failure; } // // Find that empty spot behide the character facing the wall // we need to tunnel into // // .## // ->.X# // .## // Position found = { -1, -1 }; for (auto& p : toCheck) { if (Map::Instance().CurrentLevel->StaticMapObjects[p.X][p.Y] == nullptr) { found = p; break; } } if (found.X == -1) { return BTResult::Failure; } // // Wall should be 2 units in the corresponding direction // if (found.X > x) found.X -= 2; else if (found.X < x) found.X += 2; else if (found.Y > y) found.Y -= 2; else if (found.Y < y) found.Y += 2; auto& so = Map::Instance().CurrentLevel->StaticMapObjects[found.X][found.Y]; if (!Util::IsInsideMap(found, Map::Instance().CurrentLevel->MapSize) || so == nullptr) { return BTResult::Failure; } if (so->Type != GameObjectType::PICKAXEABLE) { return BTResult::Failure; } Map::Instance().CurrentLevel->StaticMapObjects[found.X][found.Y]->Attrs.HP.SetMin(0); Map::Instance().CurrentLevel->StaticMapObjects[found.X][found.Y]->IsDestroyed = true; _objectToControl->FinishTurn(); Blackboard::Instance().Set(_objectToControl->ObjectId(), { Strings::BlackboardKeyLastMinedPosX, std::to_string(found.X) }); Blackboard::Instance().Set(_objectToControl->ObjectId(), { Strings::BlackboardKeyLastMinedPosY, std::to_string(found.Y) }); return BTResult::Success; }
mark-dawn/stytra
stytra/examples/looming_experiment.py
<reponame>mark-dawn/stytra import numpy as np import pandas as pd from stytra import Stytra from stytra.stimulation import Protocol from stytra.stimulation.stimuli import InterpolatedStimulus, CircleStimulus # Let's define a simple protocol consisting of looms at random locations, # of random durations and maximal sizes # First, we inherit from the Protocol class class LoomingProtocol(Protocol): # We specify the name for the dropdown in the GUI name = "Looming" def __init__(self): super().__init__() # It is nice for a protocol to be parametrized, so # we name the parameters we might want to change, # along with specifying the the default values. # This automatically creates a GUI to change them # (more elaborate ways of adding parameters are supported, # see the documentation of HasPyQtGraphParams) # TODO figure out how to integrate this with Sphinx self.add_params(n_looms=10, max_loom_size=40, max_loom_duration=5) # This is the only function we need to define for a custom protocol def get_stim_sequence(self): stimuli = [] # A looming stimulus is an expanding circle. Stimuli which contain # some kind of parameter change inherit from InterpolatedStimulus # which allows for specifying the values of parameters of the # stimulus at certain time points, with the intermediate # values interpolated # Use the 3-argument version of the Python type function to # make a temporary class combining two classes LoomingStimulus = type( "LoomingStimulus", (InterpolatedStimulus, CircleStimulus), {} ) for i in range(self.params["n_looms"]): # The radius is only specified at the beginning and at the # end of expansion. More elaborate functional relationships # than linear can be implemented by specifying a more # detailed interpolation table radius_df = pd.DataFrame( dict( t=[0, np.random.rand() * self.params["max_loom_duration"]], radius=[0, np.random.rand() * self.params["max_loom_size"]], ) ) # We construct looming stimuli with the radius change specification # and a random point of origin within the projection area # (specified in fractions from 0 to 1 for each dimension) stimuli.append(LoomingStimulus(df_param=radius_df, origin=(30, 30))) return stimuli if __name__ == "__main__": # We make a new instance of Stytra with this protocol as the only option s = Stytra(protocols=[LoomingProtocol])
ncodeitbharath/gradle
src/main/java/com/dotmarketing/business/LoginAsAPIImpl.java
<gh_stars>0 package com.dotmarketing.business; import com.dotcms.system.AppContext; import com.dotcms.repackage.com.google.common.annotations.VisibleForTesting; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException; import com.liferay.portal.model.User; import com.liferay.portal.util.WebKeys; import jnr.ffi.Runtime; /** * Default implementation of {@link LoginAsAPI} */ public class LoginAsAPIImpl implements LoginAsAPI { private UserAPI userAPI; private LoginAsAPIImpl() { this(APILocator.getUserAPI()); } @VisibleForTesting private LoginAsAPIImpl(UserAPI userAPI) { this.userAPI = userAPI; } private static class SingletonHolder { private static final LoginAsAPIImpl INSTANCE = new LoginAsAPIImpl(); } public static LoginAsAPIImpl getInstance() { return LoginAsAPIImpl.SingletonHolder.INSTANCE; } /** * Return the LoginAs user * * @param appContext * @return if a user is LoginAs then return it, in otherwise return null * @throws if one is thrown when the user is search */ public User getPrincipalUser(AppContext appContext) { try { String principalUserId = appContext.getAttribute(WebKeys.PRINCIPAL_USER_ID); User loginAsUser = null; if (principalUserId != null) { loginAsUser = userAPI.loadUserById(principalUserId); } return loginAsUser; }catch(DotSecurityException|DotDataException e){ throw new LoginAsRuntimeException(e); } } public boolean isLoginAsUser(AppContext appContext){ return appContext.getAttribute(WebKeys.PRINCIPAL_USER_ID) != null; } }
Testiduk/gitlabhq
app/services/system_notes/base_service.rb
<gh_stars>1000+ # frozen_string_literal: true module SystemNotes class BaseService attr_reader :noteable, :project, :author def initialize(noteable: nil, author: nil, project: nil) @noteable = noteable @project = project @author = author end protected def create_note(note_summary) note_params = note_summary.note.merge(system: true) note_params[:system_note_metadata] = SystemNoteMetadata.new(note_summary.metadata) if note_summary.metadata? Note.create(note_params) end def content_tag(*args) ActionController::Base.helpers.content_tag(*args) end def url_helpers @url_helpers ||= Gitlab::Routing.url_helpers end end end
asavaritayal/bundles
example-voting-app-sqlserver/cnab/app/result-app/node_modules/@azure/cosmos/lib/src/test/unit/rangePartitionResolver.spec.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const assert_1 = tslib_1.__importDefault(require("assert")); const range_1 = require("../../range"); describe("RangePartitionResolver", function () { describe("constructor", function () { // TODO: should split these up into individual tests it("missing partitionKeyExtractor throws", function () { const expetcedError = /Error: partitionKeyExtractor cannot be null or undefined/; assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver(undefined, undefined); }, expetcedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver(undefined, undefined); }, expetcedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver(null, undefined); }, expetcedError); }); it("invalid partitionKeyExtractor throws", function () { const expetcedError = /partitionKeyExtractor must be either a 'string' or a 'function'/; assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver(0, undefined); }, expetcedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver(true, undefined); }, expetcedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver(NaN, undefined); }, expetcedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver([], undefined); }, expetcedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver({}, undefined); }, expetcedError); }); it("missing partitionKeyMap throws", function () { const expectedError = /Error: partitionKeyMap cannot be null or undefined/; assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver("", undefined); }, expectedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver(function () { /* no op */ }, undefined); }, expectedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver("", null); }, expectedError); }); it("invalid partitionKeyMap throws", function () { const expectedError = /Error: partitionKeyMap has to be an Array/; assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver("", 0); }, expectedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver("", ""); }, expectedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver("", true); }, expectedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver("", NaN); }, expectedError); assert_1.default.throws(function () { const r = new range_1.RangePartitionResolver("", {}); }, expectedError); const rpr = new range_1.RangePartitionResolver("", new Array()); }); it("valid RangePartitionResolver", function (done) { const resolver = new range_1.RangePartitionResolver("", []); assert_1.default(resolver); assert_1.default.strictEqual(resolver.partitionKeyExtractor, ""); assert_1.default.deepEqual(resolver.partitionKeyMap, []); done(); }); }); describe("getFirstContainingMapEntryOrNull", function () { it("getFirstContainingMapEntryOrNull - empty map returns null", function (done) { const ranges = [undefined, null, 0, "", true, [], {}, NaN, new range_1.Range()]; const resolver = new range_1.RangePartitionResolver("", []); ranges.forEach(function (r) { const result = resolver.getFirstContainingMapEntryOrNull(r); assert_1.default.equal(result, null); }); done(); }); it("_tryGetContainingRange - map with no containing entry returns null", function (done) { const mapEntry = { range: new range_1.Range({ low: "A" }), link: "link1" }; const resolver = new range_1.RangePartitionResolver("key", [mapEntry]); const result = resolver.getFirstContainingMapEntryOrNull(new range_1.Range({ low: "B" })); assert_1.default.equal(result, null); done(); }); it("_tryGetContainingRange - map with single containing entry returns entry", function (done) { const mapEntry = { range: new range_1.Range(), link: "link1" }; const resolver = new range_1.RangePartitionResolver("key", [mapEntry]); const result = resolver.getFirstContainingMapEntryOrNull(new range_1.Range()); assert_1.default.deepEqual(result, { range: new range_1.Range(), link: "link1" }); done(); }); it("_tryGetContainingRange - map with more multiple containing entries returns first entry", function (done) { const map1 = [ { range: new range_1.Range({ low: "A", high: "B" }), link: "link1" }, { range: new range_1.Range({ low: "A" }), link: "link2" } ]; const resolver1 = new range_1.RangePartitionResolver("key", map1); const result1 = resolver1.getFirstContainingMapEntryOrNull(new range_1.Range({ low: "A" })); assert_1.default.strictEqual(result1.link, "link1"); const map2 = [ { range: new range_1.Range({ low: "A" }), link: "link2" }, { range: new range_1.Range({ low: "A", high: "Z" }), link: "link1" } ]; const resolver2 = new range_1.RangePartitionResolver("key", map2); const result2 = resolver2.getFirstContainingMapEntryOrNull(new range_1.Range({ low: "A" })); assert_1.default.strictEqual(result2.link, "link2"); done(); }); }); describe("resolveForCreate", function () { it("_tryGetContainingRange - map containing parition key returns corresponding link", function (done) { const resolver = new range_1.RangePartitionResolver("key", [ { range: new range_1.Range({ low: "A", high: "M" }), link: "link1" }, { range: new range_1.Range({ low: "N", high: "Z" }), link: "link2" } ]); const result = resolver.resolveForCreate("X"); assert_1.default.strictEqual(result, "link2"); done(); }); it("_tryGetContainingRange - map not containing parition key throws", function (done) { const resolver = new range_1.RangePartitionResolver("key", [ { range: new range_1.Range({ low: "A", high: "M" }), link: "link1" } ]); assert_1.default.throws(function () { const result = resolver.resolveForCreate("X"); }, /Error: Invalid operation: A containing range for 'X,X' doesn't exist in the partition map./); done(); }); }); const resolveForReadTest = function (resolver, partitionKey, expectedLinks) { const result = resolver.resolveForRead(partitionKey); assert_1.default.deepEqual(expectedLinks, result); }; describe("resolveForRead", function () { const resolver = new range_1.RangePartitionResolver(function (doc) { // TODO: any return doc.key; }, [ { range: new range_1.Range({ low: "A", high: "M" }), link: "link1" }, { range: new range_1.Range({ low: "N", high: "Z" }), link: "link2" } ]); it("undefined", function (done) { const partitionKey = undefined; const expectedLinks = ["link1", "link2"]; resolveForReadTest(resolver, partitionKey, expectedLinks); done(); }); it("null", function (done) { const partitionKey = null; const expectedLinks = ["link1", "link2"]; resolveForReadTest(resolver, partitionKey, expectedLinks); done(); }); }); describe("resolveForRead string", function () { const resolver = new range_1.RangePartitionResolver(function (doc) { // TODO: any return doc.key; }, [ { range: new range_1.Range({ low: "A", high: "M" }), link: "link1" }, { range: new range_1.Range({ low: "N", high: "Z" }), link: "link2" } ]); it("point", function (done) { const partitionKey = new range_1.Range({ low: "D" }); const expectedLinks = ["link1"]; resolveForReadTest(resolver, partitionKey, expectedLinks); const partitionKey2 = new range_1.Range({ low: "Q" }); const expectedLinks2 = ["link2"]; resolveForReadTest(resolver, partitionKey2, expectedLinks2); done(); }); it("range", function (done) { const partitionKey = new range_1.Range({ low: "D", high: "Q" }); const expectedLinks = ["link1", "link2"]; resolveForReadTest(resolver, partitionKey, expectedLinks); done(); }); it("array of ranges", function (done) { const partitionKey = [new range_1.Range({ low: "A", high: "B" }), new range_1.Range({ low: "Q" })]; const expectedLinks = ["link1", "link2"]; resolveForReadTest(resolver, partitionKey, expectedLinks); done(); }); }); describe("resolveForRead number", function () { const partitionKeyExtractor = function (doc) { return doc.key; }; const partitionKeyMap = [ { range: new range_1.Range({ low: 1, high: 15 }), link: "link1" }, { range: new range_1.Range({ low: 16, high: 30 }), link: "link2" } ]; it("point, default compareFunction", function (done) { const resolver = new range_1.RangePartitionResolver(partitionKeyExtractor, partitionKeyMap); const partitionKey = new range_1.Range({ low: 2 }); const expectedLinks = ["link2"]; resolveForReadTest(resolver, partitionKey, expectedLinks); done(); }); it("point, custom compareFunction", function (done) { const resolver = new range_1.RangePartitionResolver(partitionKeyExtractor, partitionKeyMap, function (a, b) { return a - b; }); const partitionKey = new range_1.Range({ low: 2 }); const expectedLinks = ["link1"]; resolveForReadTest(resolver, partitionKey, expectedLinks); done(); }); }); describe("compareFunction", function () { const invalidCompareFunctionTest = function (compareFunction) { assert_1.default.throws(function () { const resolver = new range_1.RangePartitionResolver("key", [{ range: new range_1.Range({ low: "A" }), link: "link1" }], compareFunction); }, /Invalid argument: 'compareFunction' is not a function/); }; it("invalid compareFunction - null", function () { const compareFunction = null; invalidCompareFunctionTest(compareFunction); }); it("invalid compareFunction - string", function () { const compareFunction = ""; invalidCompareFunctionTest(compareFunction); }); it("invalid compareFunction - number", function () { const compareFunction = 0; invalidCompareFunctionTest(compareFunction); }); it("invalid compareFunction - boolean", function () { const compareFunction = false; invalidCompareFunctionTest(compareFunction); }); it("invalid compareFunction - object", function () { const compareFunction = {}; invalidCompareFunctionTest(compareFunction); }); it("compareFunction throws", function () { const resolver = new range_1.RangePartitionResolver("key", [{ range: new range_1.Range({ low: "A" }), link: "link1" }], function (a, b) { throw new Error("Compare error"); }); assert_1.default.throws(function () { const result = resolver.resolveForRead("A", ["link1"]); // TODO: any }, /Error: Compare error/); }); }); }); //# sourceMappingURL=rangePartitionResolver.spec.js.map
ghandalf/Logscape
vs-log/test/com/liquidlabs/log/AgentLogServiceSEARCHTest.java
package com.liquidlabs.log; import com.liquidlabs.common.collection.Arrays; import com.liquidlabs.common.file.FileUtil; import com.liquidlabs.log.index.Indexer; import com.liquidlabs.log.indexer.krati.KratiIndexer; import com.liquidlabs.log.reader.LogReaderFactoryForIngester; import com.liquidlabs.log.search.Bucket; import com.liquidlabs.log.search.ReplayEvent; import com.liquidlabs.log.space.*; import com.liquidlabs.orm.ORMapperFactory; import com.liquidlabs.space.VSpaceProperties; import com.liquidlabs.vso.SpaceServiceImpl; import com.liquidlabs.vso.VSOProperties; import com.liquidlabs.vso.lookup.LookupSpace; import com.liquidlabs.vso.lookup.ServiceInfo; import com.liquidlabs.vso.resource.ResourceSpace; import org.jmock.Expectations; import org.jmock.Mockery; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** */ //@RunWith(LogscapeTestRunner.class) public class AgentLogServiceSEARCHTest { private final String DB_DIR = "build/" + this.getClass().getSimpleName(); Mockery context = new Mockery(); private LookupSpace lookupSpace; private ORMapperFactory ormFactory; private LogSpace logSpace; private MyEventListener myEventListener; private FileOutputStream out; private ScheduledExecutorService executor = Executors.newScheduledThreadPool(5); String format = "yyyy-MM-dd HH:mm:ss"; DateTimeFormatter formatter = DateTimeFormat.forPattern(format); private Indexer indexer; private File myLog; private AggSpaceImpl aggSpace; List<Bucket> events = new ArrayList<Bucket>(); private AgentLogServiceImpl agentLogService; private long fromTimeMs; private long toTimeMs2; private String hosts; private LogReaderFactoryForIngester logReaderFactory; private ResourceSpace resourceSpace; private int maxAgeDays = 9999; private String fileIncludes; @Before public void setUp() throws Exception { System.setProperty("test.mode", "true"); LogProperties.setAddWatchFileDelay(1); System.setProperty("log.sync.data.delay.secs", "1"); setupSoLogSpaceCanRunProperly(); FileUtil.deleteDir(new File(DB_DIR)); // need to tell LogSpcae to add data VSOProperties.setResourceType("Management"); lookupSpace = context.mock(LookupSpace.class); context.checking(new Expectations(){{ atLeast(1).of(lookupSpace).registerService(with(any(ServiceInfo.class)), with(any(long.class))); will(returnValue("lease")); atLeast(1).of(lookupSpace).unregisterService(with(any(ServiceInfo.class))); will(returnValue(true)); atLeast(1).of(lookupSpace).renewLease(with(any(String.class)), with(any(int.class))); }} ); ormFactory = new ORMapperFactory(); setupAggSpace(); logReaderFactory = new LogReaderFactoryForIngester(aggSpace, ormFactory.getProxyFactory()); createLogSpace(); myEventListener = new MyEventListener(); aggSpace.registerEventListener(myEventListener, myEventListener.getId(), null, -1); myLog = new File("build/AGENT_LOG_SEARCH_my.log"); out = new FileOutputStream(myLog); indexer = new KratiIndexer(DB_DIR); fromTimeMs = new DateTime().minusHours(1).getMillis(); toTimeMs2 = new DateTime().plusMinutes(1).getMillis(); logSpace.addWatch("", "build", ".*AGENT_LOG_SEARCH_my.log", format, "", hosts, maxAgeDays, "", false, "", null, false, true); } private void createLogSpace() { SpaceServiceImpl config = new SpaceServiceImpl(lookupSpace,ormFactory, "CONFIG", ormFactory.getScheduler(), false, false, false); SpaceServiceImpl log = new SpaceServiceImpl(lookupSpace,ormFactory, LogSpace.NAME, ormFactory.getScheduler(), false, false, true); logSpace = new LogSpaceImpl(config, log, null, aggSpace, null, new String[] { ".*filter1.*", ".*filter2.*"}, new String[0], resourceSpace, lookupSpace); logSpace.start(); } private void setupAggSpace() { SpaceServiceImpl bucketService = new SpaceServiceImpl(lookupSpace,ormFactory, "AGGSPACE", ormFactory.getScheduler(), false, false, false); SpaceServiceImpl replayService = new SpaceServiceImpl(lookupSpace,ormFactory, "AGGSPACE", ormFactory.getScheduler(), false, false, false); SpaceServiceImpl logEventSpaceService = new SpaceServiceImpl(lookupSpace,ormFactory, "AGGSPACE", ormFactory.getScheduler(), false, false, true); aggSpace = new AggSpaceImpl("providerId", bucketService, replayService, logEventSpaceService, ormFactory.getScheduler()); aggSpace.start(); } @After public void tearDown() throws Exception { try { System.out.println("============================================ TEARDOWN >>>>>>>>>>>>>"); executor.shutdown(); logSpace.stop(); ormFactory.stop(); out.close(); myLog.delete(); indexer.close(); if (agentLogService != null) agentLogService.stop(); System.out.println("============================================ TEARDOWN <<<<<<<<<<<<<<<<"); } catch(Throwable t) { t.printStackTrace(); } finally { FileUtil.deleteDir(new File(DB_DIR)); } // sleep cause shutdown hooks will fire... Thread.sleep(3 * 1000); } @Test public void test_FIELDBASED_ShouldReplaySecondAndThirdLine() throws Exception { LogProperties.setTestDebugMode(); startLogService(); writeStuffToOutFile(); //TestFieldSet.fieldName = 'data' is used in by contains(); LogRequest request = new LogRequestBuilder().getLogRequest("SUB-111111111", Arrays.asList("type='basic' | data.contains(second,third)"), "", fromTimeMs, toTimeMs2); request.setReplay(new Replay(ReplayType.START, 10)); request.setSearch(true); request.setVerbose(true); System.out.println("\n\n========================= SEARCH 1 =====================================\n\n"); MyReplayHandler replayHandler = new MyReplayHandler(); aggSpace.search(request, replayHandler.getId(), replayHandler); logSpace.executeRequest(request); assertEquals("expected 2 replays" , 2, replayHandler.waitForReplayEvents(2)); pause(); assertEquals("expected 2 bucket hits", 2, replayHandler.bucketHits); System.out.println(replayHandler.replayEventsData); System.out.println("\n\n========================= SEARCH 2 =====================================\n\n"); replayHandler.reset(); LogRequest request2 = new LogRequestBuilder().getLogRequest("SUB-22222222", Arrays.asList("type='*' | data.contains(third, second)"), "", fromTimeMs, toTimeMs2); request2.setReplay(new Replay(ReplayType.START, 10)); request2.setSearch(true); request2.setVerbose(true); aggSpace.replay(request2, replayHandler.getId(), replayHandler); logSpace.executeRequest(request2); pause(); assertEquals(2, replayHandler.replayEvents); replayHandler.reset(); } @Test public void test_HYBRID_ShouldReplaySecondAndThirdLine() throws Exception { startLogService(); writeStuffToOutFile(); pause(); //TestFieldSet.fieldName = 'data' is used in by contains(); LogRequest request = new LogRequestBuilder().getLogRequest("SUB-111111111", Arrays.asList("This | data.count()"), "", fromTimeMs, toTimeMs2); request.setReplay(new Replay(ReplayType.START, 10)); request.setSearch(true); request.setVerbose(true); MyReplayHandler replayHandler = new MyReplayHandler(); aggSpace.search(request, replayHandler.getId(), replayHandler); logSpace.executeRequest(request); pause(); printHisto(replayHandler.histoBuckets); assertTrue(replayHandler.bucketHits > 4); System.out.println(replayHandler.replayEventsData); System.out.println("\n\n==================================================="); replayHandler.reset(); LogRequest request2 = new LogRequestBuilder().getLogRequest("SUB-22222222", Arrays.asList("This | data.contains(third, second)"), "", fromTimeMs, toTimeMs2); request2.setReplay(new Replay(ReplayType.START, 10)); request2.setSearch(true); request2.setVerbose(true); aggSpace.replay(request2, replayHandler.getId(), replayHandler); logSpace.executeRequest(request2); pause(); assertEquals("expected 2 replays" , 2, replayHandler.waitForReplayEvents(2)); System.out.println(replayHandler.replayEventsData); System.out.println("\n\n==================================================="); replayHandler.reset(); } private void printHisto(List<Bucket> histo) { for (Bucket bucket : histo) { System.out.println("B:" + bucket); } } @Test public void test_OLDSCHOOL_ShouldReplaySecondAndThirdLine() throws Exception { startLogService(); writeStuffToOutFile(); pause(); LogRequest request = new LogRequestBuilder().getLogRequest("OLD-111111111", Arrays.asList("* | contains(second,third)"), "", fromTimeMs, toTimeMs2); request.setReplay(new Replay(ReplayType.START, 10)); request.setSearch(true); request.setVerbose(true); MyReplayHandler replayHandler = new MyReplayHandler(2); aggSpace.search(request, replayHandler.getId(), replayHandler); logSpace.executeRequest(request); pause(); assertEquals(2, replayHandler.replayEvents); assertEquals(2, replayHandler.bucketHits); replayHandler.reset(); LogRequest request2 = new LogRequestBuilder().getLogRequest("OLD-22222222", Arrays.asList("* | contains(third, second)"), "", fromTimeMs, toTimeMs2); request2.setReplay(new Replay(ReplayType.START, 10)); request2.setSearch(true); request2.setVerbose(true); aggSpace.replay(request2, replayHandler.getId(), replayHandler); logSpace.executeRequest(request2); pause(); assertEquals("expected 2 replays" , 2, replayHandler.waitForReplayEvents(2)); replayHandler.reset(); } private void startLogService() { Thread.UncaughtExceptionHandler exceptionHandler = new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread thread, Throwable throwable) { } }; agentLogService = new AgentLogServiceImpl(logSpace, aggSpace, executor, ormFactory.getProxyFactory(), indexer, "resourceId", logReaderFactory, exceptionHandler, lookupSpace); agentLogService.start(); } private void writeStuffToOutFile() throws Exception { out.write("This is the first line\n".getBytes()); out.write("This is the second line\n".getBytes()); out.write("This is the third line\n".getBytes()); out.write("This is the fourth line\n".getBytes()); out.write("This is the fifth line\n".getBytes()); out.flush(); int waitCount = 0; while (!indexer.isIndexed(myLog.getAbsolutePath())&& waitCount++ < 100) { Thread.sleep(500); } } private void pause() throws InterruptedException { Thread.sleep(2000); } public static class MyEventListener implements LogEventListener { int events; public String getId() { return "my-listener"; } public void handle(LogEvent event) { System.out.println("MyEventListener:" + event.getFilename() + ":" + event.getMessage()); events++; } } public static class MyReplayHandler implements LogReplayHandler { volatile int events; volatile int bucketHits; volatile int replayEvents; List<String> replayEventsData = new ArrayList<String>(); int id =0; private int linenumber; List<Bucket> histoBuckets = new ArrayList<Bucket>(); private List<Map<String, Bucket>> histo; private CountDownLatch replayLatch; public MyReplayHandler() {} public int waitForReplayEvents(int waitCount) { System.out.println("Waiting for Replays:" + waitCount); replayLatch = new CountDownLatch(waitCount); try { boolean awaitGood = replayLatch.await(10, TimeUnit.SECONDS); if (awaitGood) System.out.println("Got all ReplayEvents!"); else System.out.println("Failed to get all ReplayEvents"); } catch (InterruptedException e) { } return this.replayEvents; } public MyReplayHandler(int i) { id = i; } public String getId() { return "my-TEST-Handler"+id; } public void handle(ReplayEvent replayEvent) { try { if (replayLatch != null) replayLatch.countDown(); events++; replayEvents++; linenumber = replayEvent.getLineNumber(); replayEventsData.add(replayEvent.getLineNumber() + " " + replayEvent.getRawData() + "\n"); } catch (Throwable t) { t.printStackTrace(); } } public void reset() { replayEvents = 0; replayEventsData.clear(); } public void handle(Bucket event) { events++; bucketHits+= event.hits(); histoBuckets.add(event); } public int handle(String providerId, String subscriber, int size, Map<String, Object> map) { List<Map<String, Bucket>> histo = (List<Map<String, Bucket>>) map.get("histo"); events++; for (Map<String, Bucket> map2 : histo) { Collection<Bucket> values = map2.values(); for (Bucket bucket : values) { bucketHits += bucket.hits(); } } return 1; } public int handle(List<ReplayEvent> events) { for (ReplayEvent replayEvent : events) { handle(replayEvent); } return 100; } public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("[MyReplayHandler:"); buffer.append(" events:"); buffer.append(events); buffer.append(" bucketHits:"); buffer.append(bucketHits); buffer.append(" replayEvents:"); buffer.append(replayEvents); buffer.append(" id:"); buffer.append(id); buffer.append(" linenumber:"); buffer.append(linenumber); buffer.append(" histo:"); buffer.append(histo); buffer.append("]"); return buffer.toString(); } public int status(String provider, String subscriber, String msg) { return 1; } public void handleSummary(Bucket bucketToSend) { } } private void setupSoLogSpaceCanRunProperly() { VSOProperties.setResourceType("Management"); new File(VSpaceProperties.baseSpaceDir(), "touch.file").delete(); } }
hoho20000000/gem5-fy
util/tlm/sc_port.cc
/* * Copyright (c) 2015, University of Kaiserslautern * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Authors: <NAME> * <NAME> */ #include <cctype> #include <iomanip> #include <sstream> #include "debug/ExternalPort.hh" #include "sc_ext.hh" #include "sc_mm.hh" #include "sc_port.hh" namespace Gem5SystemC { /** * Instantiate a tlm memory manager that takes care about all the * tlm transactions in the system */ MemoryManager mm; /** * Convert a gem5 packet to a TLM payload by copying all the relevant * information to a previously allocated tlm payload */ void packet2payload(PacketPtr packet, tlm::tlm_generic_payload &trans) { trans.set_address(packet->getAddr()); /* Check if this transaction was allocated by mm */ sc_assert(trans.has_mm()); unsigned int size = packet->getSize(); unsigned char *data = packet->getPtr<unsigned char>(); trans.set_data_length(size); trans.set_streaming_width(size); trans.set_data_ptr(data); if (packet->isRead()) { trans.set_command(tlm::TLM_READ_COMMAND); } else if (packet->isInvalidate()) { /* Do nothing */ } else if (packet->isWrite()) { trans.set_command(tlm::TLM_WRITE_COMMAND); } else { SC_REPORT_FATAL("transactor", "No R/W packet"); } } /** * Similar to TLM's blocking transport (LT) */ Tick sc_transactor::recvAtomic(PacketPtr packet) { CAUGHT_UP; SC_REPORT_INFO("transactor", "recvAtomic hasn't been tested much"); sc_core::sc_time delay = sc_core::SC_ZERO_TIME; /* Prepare the transaction */ tlm::tlm_generic_payload * trans = mm.allocate(); trans->acquire(); packet2payload(packet, *trans); /* Attach the packet pointer to the TLM transaction to keep track */ gem5Extension* extension = new gem5Extension(packet); trans->set_auto_extension(extension); /* Execute b_transport: */ if (packet->cmd == MemCmd::SwapReq) { SC_REPORT_FATAL("transactor", "SwapReq not supported"); } else if (packet->isRead()) { iSocket->b_transport(*trans, delay); } else if (packet->isInvalidate()) { // do nothing } else if (packet->isWrite()) { iSocket->b_transport(*trans, delay); } else { SC_REPORT_FATAL("transactor", "Typo of request not supported"); } if (packet->needsResponse()) { packet->makeResponse(); } trans->release(); return delay.value(); } /** * Similar to TLM's debug transport */ void sc_transactor::recvFunctional(PacketPtr packet) { /* Prepare the transaction */ tlm::tlm_generic_payload * trans = mm.allocate(); trans->acquire(); packet2payload(packet, *trans); /* Attach the packet pointer to the TLM transaction to keep track */ gem5Extension* extension = new gem5Extension(packet); trans->set_auto_extension(extension); /* Execute Debug Transport: */ unsigned int bytes = iSocket->transport_dbg(*trans); if (bytes != trans->get_data_length()) { SC_REPORT_FATAL("transactor","debug transport was not completed"); } trans->release(); } bool sc_transactor::recvTimingSnoopResp(PacketPtr packet) { /* Snooping should be implemented with tlm_dbg_transport */ SC_REPORT_FATAL("transactor","unimplemented func.: recvTimingSnoopResp"); return false; } void sc_transactor::recvFunctionalSnoop(PacketPtr packet) { /* Snooping should be implemented with tlm_dbg_transport */ SC_REPORT_FATAL("transactor","unimplemented func.: recvFunctionalSnoop"); } /** * Similar to TLM's non-blocking transport (AT) */ bool sc_transactor::recvTimingReq(PacketPtr packet) { CAUGHT_UP; /* We should never get a second request after noting that a retry is * required */ sc_assert(!needToSendRequestRetry); // simply drop inhibited packets and clean evictions if (packet->memInhibitAsserted() || packet->cmd == MemCmd::CleanEvict) return true; /* Remember if a request comes in while we're blocked so that a retry * can be sent to gem5 */ if (blockingRequest) { needToSendRequestRetry = true; return false; } /* NOTE: normal tlm is blocking here. But in our case we return false * and tell gem5 when a retry can be done. This is the main difference * in the protocol: * if (requestInProgress) * { * wait(endRequestEvent); * } * requestInProgress = trans; */ /* Prepare the transaction */ tlm::tlm_generic_payload * trans = mm.allocate(); trans->acquire(); packet2payload(packet, *trans); /* Attach the packet pointer to the TLM transaction to keep track */ gem5Extension* extension = new gem5Extension(packet); trans->set_auto_extension(extension); /* Starting TLM non-blocking sequence (AT) Refer to IEEE1666-2011 SystemC * Standard Page 507 for a visualisation of the procedure */ sc_core::sc_time delay = sc_core::SC_ZERO_TIME; tlm::tlm_phase phase = tlm::BEGIN_REQ; tlm::tlm_sync_enum status; status = iSocket->nb_transport_fw(*trans, phase, delay); /* Check returned value: */ if (status == tlm::TLM_ACCEPTED) { sc_assert(phase == tlm::BEGIN_REQ); /* Accepted but is now blocking until END_REQ (exclusion rule)*/ blockingRequest = trans; } else if (status == tlm::TLM_UPDATED) { /* The Timing annotation must be honored: */ sc_assert(phase == tlm::END_REQ || phase == tlm::BEGIN_RESP); payloadEvent<sc_transactor> * pe; pe = new payloadEvent<sc_transactor>(*this, &sc_transactor::pec, "PEQ"); pe->notify(*trans, phase, delay); } else if (status == tlm::TLM_COMPLETED) { /* Transaction is over nothing has do be done. */ sc_assert(phase == tlm::END_RESP); trans->release(); } return true; } void sc_transactor::pec( sc_transactor::payloadEvent<sc_transactor> * pe, tlm::tlm_generic_payload& trans, const tlm::tlm_phase& phase) { sc_time delay; if (phase == tlm::END_REQ || &trans == blockingRequest && phase == tlm::BEGIN_RESP) { sc_assert(&trans == blockingRequest); blockingRequest = NULL; /* Did another request arrive while blocked, schedule a retry */ if (needToSendRequestRetry) { needToSendRequestRetry = false; iSocket.sendRetryReq(); } } else if (phase == tlm::BEGIN_RESP) { CAUGHT_UP; PacketPtr packet = gem5Extension::getExtension(trans).getPacket(); sc_assert(!blockingResponse); bool need_retry; if (packet->needsResponse()) { packet->makeResponse(); need_retry = !iSocket.sendTimingResp(packet); } else { need_retry = false; } if (need_retry) { blockingResponse = &trans; } else { if (phase == tlm::BEGIN_RESP) { /* Send END_RESP and we're finished: */ tlm::tlm_phase fw_phase = tlm::END_RESP; sc_time delay = SC_ZERO_TIME; iSocket->nb_transport_fw(trans, fw_phase, delay); /* Release the transaction with all the extensions */ trans.release(); } } } else { SC_REPORT_FATAL("transactor", "Invalid protocol phase in pec"); } delete pe; } void sc_transactor::recvRespRetry() { CAUGHT_UP; /* Retry a response */ sc_assert(blockingResponse); tlm::tlm_generic_payload *trans = blockingResponse; blockingResponse = NULL; PacketPtr packet = gem5Extension::getExtension(trans).getPacket(); bool need_retry = !iSocket.sendTimingResp(packet); sc_assert(!need_retry); sc_core::sc_time delay = sc_core::SC_ZERO_TIME; tlm::tlm_phase phase = tlm::END_RESP; iSocket->nb_transport_fw(*trans, phase, delay); // Release transaction with all the extensions trans->release(); } tlm::tlm_sync_enum sc_transactor::nb_transport_bw(tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase, sc_core::sc_time& delay) { payloadEvent<sc_transactor> * pe; pe = new payloadEvent<sc_transactor>(*this, &sc_transactor::pec, "PE"); pe->notify(trans, phase, delay); return tlm::TLM_ACCEPTED; } void sc_transactor::invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range) { SC_REPORT_FATAL("transactor", "unimpl. func: invalidate_direct_mem_ptr"); } sc_transactor::sc_transactor(const std::string &name_, const std::string &systemc_name, ExternalSlave &owner_) : tlm::tlm_initiator_socket<>(systemc_name.c_str()), ExternalSlave::Port(name_, owner_), iSocket(*this), blockingRequest(NULL), needToSendRequestRetry(false), blockingResponse(NULL) { m_export.bind(*this); } class sc_transactorHandler : public ExternalSlave::Handler { public: ExternalSlave::Port *getExternalPort(const std::string &name, ExternalSlave &owner, const std::string &port_data) { // This will make a new initiatiator port return new sc_transactor(name, port_data, owner); } }; void registerSCPorts() { ExternalSlave::registerHandler("tlm", new sc_transactorHandler); } }
bqqbarbhg/cold
cold/cold/input/mouse.cpp
#include "mouse.h" #include <cold/input/io.h> namespace cold { glm::vec2 Mouse::pos; bool Mouse::lock_updated = false, Mouse::locked = false, Mouse::active = true; unsigned int Mouse::buttons = 0; int Mouse::center_x, Mouse::center_y; void Mouse::set_lock_position(int x, int y) { center_x = x; center_y = y; } void Mouse::set_active(bool a) { active = a; } void Mouse::_update_position() { int x, y; buttons = SDL_GetMouseState(&x, &y); pos = glm::vec2(x, y); } void Mouse::update() { if (locked) { _update_position(); if (lock_updated && active) { pos -= glm::vec2(center_x, center_y); SDL_WarpMouse(center_x, center_y); } else { pos = glm::vec2(0.0f, 0.0f); lock_updated = true; } } else { _update_position(); } } void Mouse::lock() { if (locked) return; lock_updated = false; locked = true; } void Mouse::unlock() { locked = false; } void Mouse::set_visible(bool visible) { SDL_ShowCursor(visible); } bool Mouse::get_button(int button) { return (SDL_BUTTON(button) & buttons) != 0; } }
FruitsBerriesMelons123/CommonLibSSE
src/RE/BGSKeywordForm.cpp
#include "RE/BGSKeywordForm.h" #include "RE/BGSKeyword.h" namespace RE { bool BGSKeywordForm::HasKeyword(FormID a_formID) const { if (keywords) { for (UInt32 idx = 0; idx < numKeywords; ++idx) { if (keywords[idx] && keywords[idx]->formID == a_formID) { return true; } } } return false; } std::optional<BGSKeyword*> BGSKeywordForm::GetKeywordAt(UInt32 a_idx) const { if (a_idx < numKeywords) { return std::make_optional(keywords[a_idx]); } else { return std::nullopt; } } UInt32 BGSKeywordForm::GetNumKeywords() const { return numKeywords; } }
soundasleep/railswiki
app/controllers/railswiki/users_controller.rb
<reponame>soundasleep/railswiki require_dependency "railswiki/application_controller" module Railswiki class UsersController < ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] before_action :require_users_list_permission, only: [:index] before_action :require_user_edit_permission, only: [:edit, :update] before_action :require_user_delete_permission, only: [:destroy] # GET /users def index @users = User.all end # GET /users/1 def show respond_to do |format| format.html format.json { render json: @user.expose_json } end end # GET /users/1/edit def edit end # PATCH/PUT /users/1 def update if @user.update(user_params) redirect_to @user, notice: 'User was successfully updated.' else render :edit end end # DELETE /pages/1 def destroy @user.destroy redirect_to users_url, notice: 'User was successfully destroyed.' end private # Use callbacks to share common setup or constraints between actions. def set_user @user = User.find(params[:id]) end # Only allow a trusted parameter "white list" through. def user_params params.require(:user).permit(:name, :email, :role) end end end
AmrARaouf/algorithm-detection
graph-source-code/29-C/9367425.cpp
//Language: GNU C++ #include <map> #include <cstdio> #include <vector> #include <iterator> using namespace std; map< int, vector<int> >adj; void dfs(int node, int prev){ printf("%d ", node); for (int i = 0; i < adj[node].size(); i++){ if (adj[node][i] == prev) continue; dfs(adj[node][i], node); } } int main(){ int n, C = 0; scanf("%d", &n); for (int i = 0; i < n; i++){ int a, b; scanf("%d%d", &a, &b); adj[a].push_back(b); adj[b].push_back(a); } for (map< int, vector<int> >::iterator it = adj.begin(); it != adj.end(); it++){ if (it->second.size() == 1){ C = it->first; break; } } dfs(C, -1); //system("pause"); }
macor003/desarrollosAndroid
ProyectosCajaRegistrador/CRSaleServices/src/main/java/com/grid/ventas/cr/refundrestserver/controller/WaitingSaleController.java
package com.grid.ventas.cr.refundrestserver.controller; import java.util.Arrays; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.becoblohm.cr.models.Article; import com.becoblohm.cr.models.Session; import com.becoblohm.cr.models.Transaction; import com.becoblohm.cr.models.User; import com.becoblohm.cr.net.response.RMIServerResponse; import com.becoblohm.cr.response.FindWaitingSaleResponse; import com.grid.ventas.cr.refundrestclient.client.dao.HoldWaitingSaleDao; import com.grid.ventas.cr.refundrestserver.service.WaitingSaleService; /** * Created by eve0017280 on 15/02/16. */ @RestController @RequestMapping("/waitingSale") public class WaitingSaleController { final static Logger logger = LoggerFactory.getLogger(SpecialOrderController.class); @Autowired private WaitingSaleService waitingSaleService; private static boolean enable = true; @RequestMapping("/toggleService") public RMIServerResponse toggleService() { enable = !enable; return new RMIServerResponse("", enable, HttpServletResponse.SC_OK); } @RequestMapping("/findWaitingSale") public FindWaitingSaleResponse findWaitingSale() { FindWaitingSaleResponse response = new FindWaitingSaleResponse(); if (enable) { response = waitingSaleService.findWaitingSale(); } else { response.setMsg(""); response.setData(null); response.setCode(HttpServletResponse.SC_FORBIDDEN); } return response; } @RequestMapping("/releaseWaitingSale") public RMIServerResponse releaseWaitingSale(@RequestBody Transaction tr) { RMIServerResponse response = new RMIServerResponse("", null); if (enable) { response = waitingSaleService.releaseWaitingSale(tr); } else { response.setCode(HttpServletResponse.SC_FORBIDDEN); } return response; } @RequestMapping("/holdWaitingSale") public RMIServerResponse holdWaitingSale(@RequestBody HoldWaitingSaleDao holdWaitingSaleDao) { RMIServerResponse response = new RMIServerResponse("", null); if (enable) { Transaction transaction = holdWaitingSaleDao.getData(); Session session = holdWaitingSaleDao.getSession(); response = waitingSaleService.holdWaitingSale(transaction, session); } else { response.setCode(HttpServletResponse.SC_FORBIDDEN); } return response; } @RequestMapping("/getTransactionAudit") public RMIServerResponse getTransactionAudit(Long tr) { RMIServerResponse response = new RMIServerResponse("", null); if (enable) { response = waitingSaleService.getTransactionAudit(tr); } else { response.setCode(HttpServletResponse.SC_FORBIDDEN); } return response; } @RequestMapping("/testwaitingsale") public FindWaitingSaleResponse testWaitingSale() { return waitingSaleService.findWaitingSale(); } @RequestMapping("/p") public HoldWaitingSaleDao holdWaitingSale() { Transaction data = new Transaction(); data.setSaleOrigin(Transaction.Source.Pos); Article article = new Article(); article.setCode("202000"); article.setId(1090112l); data.setArticles(Arrays.asList(article)); data.setPrinterSerial("21"); Session session = new Session(); User cashier = new User(); cashier.setId(202l); session.setPosId("90"); session.setCashier(cashier); return new HoldWaitingSaleDao(data, session); } @RequestMapping("/p2") public HoldWaitingSaleDao holdWaitingSale2(@RequestBody HoldWaitingSaleDao holdWaitingSaleDao) { HoldWaitingSaleDao holdWaitingSaleDao1 = holdWaitingSaleDao; return holdWaitingSaleDao1; } }
Kineolyan/Catane
client/js/components/parts/StartInterface/StartInterface.react.js
'use strict'; /* React component containing the whole game interface */ import Player from './Player.react'; import Lobby from './Lobby.react'; import React from 'react'; import Globals from '../../libs/globals'; import Room from './Room.react'; import reactBoostrap from 'react-bootstrap'; var Jumbotron = reactBoostrap.Jumbotron; var Grid = reactBoostrap.Grid; var Row = reactBoostrap.Row; var Col = reactBoostrap.Col; export default class StartInterface extends React.Component { constructor(props) { super(props); this.state = { step: Globals.step.init, game: {} }; } /** * Change the minamal step where the game should be * @param {Globals.step} the minamal step */ setMinimalStep(step) { if(this.state.step <= step) { this.setState({step: step}); } } /** * Start the game with the selected game * @param {Int} the game id */ chooseGame(game) { this.setMinimalStep(Globals.step.inLobby); this.setState({game: game}); } /** * Start the game with the selected game */ startGame(board, players) { this.setMinimalStep(Globals.step.started); this.props.onStart(board, players); } /** * Start the game with the selected game */ leaveRoom() { this.setState({step: Globals.step.chooseLobby, game: {}}); } /** * Render the interface of the selection of game * @return {React.Element} the rendered element */ render() { return ( <div className={'start-interface'}> <Grid> <Row> <Col md={4} mdOffset={4}> <Jumbotron> <Player ref="player" onChange={this.setMinimalStep.bind(this)} initialName={this.props.init.name} id={parseInt(this.props.init.id, 10)} canChangeName={Globals.step.inStep(this.state.step, Globals.step.inLobby, Globals.step.init)} game={this.state.game} /> {this.renderChooseLobby()} {this.renderInLobby()} </Jumbotron> </Col> </Row> </Grid> </div> ); } /** * Render the lobby to choose and create a game * @return {React.Element} the rendered element */ renderChooseLobby() { if(Globals.step.inStep(this.state.step, Globals.step.chooseLobby, Globals.step.init)) { return (<Lobby onGameChosen={this.chooseGame.bind(this)} />); } } /** * Render the inLobby to wait before launching the game * @return {React.Element} the rendered element */ renderInLobby() { if(Globals.step.inStep(this.state.step, Globals.step.inLobby, Globals.step.inLobby)) { return (<Room game={this.state.game} player={this.refs.player} onStart={this.startGame.bind(this)} onLeave={this.leaveRoom.bind(this)}/>); } } } StartInterface.propTypes = { init: React.PropTypes.shape({ id: React.PropTypes.string.isRequired, name: React.PropTypes.string.isRequired }), onStart: React.PropTypes.func.isRequired }; StartInterface.displayName = 'StartInterface';
SIIS-cloud/pileus
libvirt/pileus-libvirt-1.2.12/src/util/virkeycode.c
<filename>libvirt/pileus-libvirt-1.2.12/src/util/virkeycode.c /* * Copyright (c) 2011 <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.1 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, see * <http://www.gnu.org/licenses/>. * */ #include <config.h> #include "virkeycode.h" #include <string.h> #include <stddef.h> #define VIRT_KEY_INTERNAL #include "virkeymaps.h" static const char **virKeymapNames[] = { [VIR_KEYCODE_SET_LINUX] = virKeymapNames_linux, [VIR_KEYCODE_SET_XT] = NULL, [VIR_KEYCODE_SET_ATSET1] = NULL, [VIR_KEYCODE_SET_ATSET2] = NULL, [VIR_KEYCODE_SET_ATSET3] = NULL, [VIR_KEYCODE_SET_OSX] = virKeymapNames_os_x, [VIR_KEYCODE_SET_XT_KBD] = NULL, [VIR_KEYCODE_SET_USB] = NULL, [VIR_KEYCODE_SET_WIN32] = virKeymapNames_win32, [VIR_KEYCODE_SET_RFB] = NULL, }; verify(ARRAY_CARDINALITY(virKeymapNames) == VIR_KEYCODE_SET_LAST); static int *virKeymapValues[] = { [VIR_KEYCODE_SET_LINUX] = virKeymapValues_linux, [VIR_KEYCODE_SET_XT] = virKeymapValues_xt, [VIR_KEYCODE_SET_ATSET1] = virKeymapValues_atset1, [VIR_KEYCODE_SET_ATSET2] = virKeymapValues_atset2, [VIR_KEYCODE_SET_ATSET3] = virKeymapValues_atset3, [VIR_KEYCODE_SET_OSX] = virKeymapValues_os_x, [VIR_KEYCODE_SET_XT_KBD] = virKeymapValues_xt_kbd, [VIR_KEYCODE_SET_USB] = virKeymapValues_usb, [VIR_KEYCODE_SET_WIN32] = virKeymapValues_win32, [VIR_KEYCODE_SET_RFB] = virKeymapValues_rfb, }; verify(ARRAY_CARDINALITY(virKeymapValues) == VIR_KEYCODE_SET_LAST); VIR_ENUM_IMPL(virKeycodeSet, VIR_KEYCODE_SET_LAST, "linux", "xt", "atset1", "atset2", "atset3", "os_x", "xt_kbd", "usb", "win32", "rfb", ); int virKeycodeValueFromString(virKeycodeSet codeset, const char *keyname) { size_t i; for (i = 0; i < VIR_KEYMAP_ENTRY_MAX; i++) { if (!virKeymapNames[codeset] || !virKeymapValues[codeset]) continue; const char *name = virKeymapNames[codeset][i]; if (name && STREQ_NULLABLE(name, keyname)) return virKeymapValues[codeset][i]; } return -1; } int virKeycodeValueTranslate(virKeycodeSet from_codeset, virKeycodeSet to_codeset, int key_value) { size_t i; if (key_value < 0) return -1; for (i = 0; i < VIR_KEYMAP_ENTRY_MAX; i++) { if (virKeymapValues[from_codeset][i] == key_value) return virKeymapValues[to_codeset][i]; } return -1; }
schloepke/gamemachine
server/lib/game_machine/commands/chat_commands.rb
<gh_stars>100-1000 module GameMachine module Commands class ChatCommands include MessageHelper def send_private_message(text,player_id) message = chat_message('private',text,player_id,player_id) entity = entity_with_player(player_id,player_id). set_chat_message(message.chat_message) GameSystems::ChatManager.find.tell(entity) end def send_group_message(topic,text,player_id) message = chat_message('group',text,topic,player_id) entity = entity_with_player(player_id,player_id). set_chat_message(message.chat_message) GameSystems::ChatManager.find.tell(entity) end def register(chat_id,register_as) message = entity(chat_id).set_chat_register( MessageLib::ChatRegister.new.set_chat_id(chat_id). set_register_as(register_as) ) GameSystems::ChatManager.find.tell(message) end def join(topic,player_id,invite_id=nil) GameSystems::ChatManager.find.tell(join_message(topic,player_id,invite_id)) end def leave(topic,player_id) GameSystems::ChatManager.find.tell(leave_message(topic,player_id)) end def invite(topic,inviter,invitee) GameSystems::ChatManager.find.tell(invite_message(inviter,invitee,topic)) end def subscribers(topic,game_id) GameMachine::GameSystems::Chat.subscribers_for_topic(topic,game_id) end def invite_message(inviter,invitee,topic) entity_with_player(inviter,inviter).set_chat_invite( MessageLib::ChatInvite.new.set_inviter(inviter). set_invitee(invitee).set_channel_name(topic) ) end def join_message(topic,player_id,invite_id=nil) join_msg = MessageLib::JoinChat.new chat_channel = chat_channel(topic) if invite_id chat_channel.set_invite_id(invite_id) end join_msg.add_chat_channel(chat_channel) entity_with_player(player_id,player_id).set_join_chat(join_msg) end def leave_message(topic,player_id) entity_with_player(player_id,player_id).set_leave_chat( MessageLib::LeaveChat.new.add_chat_channel(chat_channel(topic)) ) end def chat_message(type,message_text,topic,sender_id=nil) chat_message = MessageLib::ChatMessage.new.set_chat_channel( chat_channel(topic) ).set_message(message_text).set_type(type) if sender_id chat_message.set_sender_id(sender_id) end entity(entity_id).set_chat_message(chat_message) end def entity_id '0' end def chat_channel(topic) MessageLib::ChatChannel.new.set_name(topic) end end end end
korylprince/tcea-inventory-server
httpapi/device_handler.go
package httpapi import ( "encoding/json" "errors" "fmt" "net/http" "strconv" "github.com/gorilla/mux" "github.com/korylprince/tcea-inventory-server/api" ) //POST /devices func handleCreateDevice(w http.ResponseWriter, r *http.Request) *handlerResponse { var req *CreateDeviceRequest d := json.NewDecoder(r.Body) err := d.Decode(&req) if err != nil || req == nil || req.Device == nil { return handleError(http.StatusBadRequest, fmt.Errorf("Could not decode JSON: %v", err)) } id, err := api.CreateDevice(r.Context(), req.Device) if resp := checkAPIError(err); resp != nil { return resp } if req.Note != "" { _, err = api.CreateNoteEvent(r.Context(), id, api.DeviceEventLocation, req.Note) if resp := checkAPIError(err); resp != nil { return resp } } device, err := api.ReadDevice(r.Context(), id, true) if resp := checkAPIError(err); resp != nil { return resp } if device == nil { return handleError(http.StatusInternalServerError, errors.New("Could not find device, but just created")) } return &handlerResponse{Code: http.StatusOK, Body: device} } //GET /devices/:id func handleReadDevice(w http.ResponseWriter, r *http.Request) *handlerResponse { id, err := strconv.ParseInt(mux.Vars(r)["id"], 10, 64) if err != nil { return handleError(http.StatusBadRequest, fmt.Errorf("Could not decode id: %v", err)) } includeEvents := false if v := r.URL.Query().Get("events"); v == eventsTrue { includeEvents = true } device, err := api.ReadDevice(r.Context(), id, includeEvents) if resp := checkAPIError(err); resp != nil { return resp } if device == nil { return handleError(http.StatusNotFound, errors.New("Could not find device")) } return &handlerResponse{Code: http.StatusOK, Body: device} } //POST /devices/:id func handleUpdateDevice(w http.ResponseWriter, r *http.Request) *handlerResponse { id, err := strconv.ParseInt(mux.Vars(r)["id"], 10, 64) if err != nil { return handleError(http.StatusBadRequest, fmt.Errorf("Could not decode id: %v", err)) } var device *api.Device d := json.NewDecoder(r.Body) err = d.Decode(&device) if err != nil || device == nil { return handleError(http.StatusBadRequest, fmt.Errorf("Could not decode JSON: %v", err)) } if device.ID != id { return handleError(http.StatusBadRequest, fmt.Errorf("device id mismatch: URL: %d, Body: %d", id, device.ID)) } err = api.UpdateDevice(r.Context(), device) if resp := checkAPIError(err); resp != nil { return resp } device, err = api.ReadDevice(r.Context(), device.ID, true) if resp := checkAPIError(err); resp != nil { return resp } if device == nil { return handleError(http.StatusNotFound, errors.New("Could not find device, but just updated")) } return &handlerResponse{Code: http.StatusOK, Body: device} } //POST /devices/:id/notes/ func handleCreateDeviceNoteEvent(w http.ResponseWriter, r *http.Request) *handlerResponse { id, err := strconv.ParseInt(mux.Vars(r)["id"], 10, 64) if err != nil { return handleError(http.StatusBadRequest, fmt.Errorf("Could not decode id: %v", err)) } var note *NoteRequest d := json.NewDecoder(r.Body) err = d.Decode(&note) if err != nil || note == nil { return handleError(http.StatusBadRequest, fmt.Errorf("Could not decode JSON: %v", err)) } _, err = api.CreateNoteEvent(r.Context(), id, api.DeviceEventLocation, note.Note) if resp := checkAPIError(err); resp != nil { return resp } device, err := api.ReadDevice(r.Context(), id, true) if resp := checkAPIError(err); resp != nil { return resp } if device == nil { return handleError(http.StatusNotFound, errors.New("Could not find device, but just updated")) } return &handlerResponse{Code: http.StatusOK, Body: device} } //GET /devices/ func handleQueryDevice(w http.ResponseWriter, r *http.Request) *handlerResponse { if r.URL.Query().Get("search") != "" { return handleSimpleQueryDevice(w, r) } devices, err := api.QueryDevice(r.Context(), r.URL.Query().Get("serial_number"), r.URL.Query().Get("manufacturer"), r.URL.Query().Get("model"), r.URL.Query().Get("status"), r.URL.Query().Get("location"), ) if resp := checkAPIError(err); resp != nil { return resp } return &handlerResponse{Code: http.StatusOK, Body: &QueryDeviceResponse{Devices: devices}} } //GET /devices/ func handleSimpleQueryDevice(w http.ResponseWriter, r *http.Request) *handlerResponse { devices, err := api.SimpleQueryDevice(r.Context(), r.URL.Query().Get("search")) if resp := checkAPIError(err); resp != nil { return resp } return &handlerResponse{Code: http.StatusOK, Body: &QueryDeviceResponse{Devices: devices}} }
Radomiej/JavityEngine-plugins
javity-canvas/src/main/java/pl/silver/canvas/libgdx/triangulation/primitives/Point.java
package pl.silver.canvas.libgdx.triangulation.primitives; /** * Represents a point in two dimensional space. * * @author <NAME> */ public class Point { /** * Initializes a point by its coordinates. * * @param x The X coordinate. * @param y The Y coordinate. */ public Point(double x, double y) { this.x = x; this.y = y; } /** * Attaches a segment to the point. * * @param segment The attached segment */ public void setSegment(Segment segment) { this.segment = segment; } /** * Returns the X coordinate of the point. * * @return The X coordinate */ public double getX() { return x; } /** * Returns the Y coordinate of the point. * * @return The Y coordinate */ public double getY() { return y; } /** * Returns the segment attached to the point. * @return The attached segment */ public Segment getSegment() { return segment; } /** * Calculates the cross product * of two vectors (p0, p1) and (p0, p2) * defined by three points p0, p1 and p2. * * @param p0 The first point * @param p1 The second point * @param p2 The third point * @return The cross product */ private static double crossProduct(Point p0, Point p1, Point p2) { return (p1.getX() - p0.getX()) * (p2.getY() - p0.getY()) - (p2.getX() - p0.getX()) * (p1.getY() - p0.getY()); } /** * Calculates the remoteness of another point. * * @param p0 The point * @return The distance between the current point and the given point */ public double dist(Point p0) { return Math.sqrt((this.getX() - p0.getX()) * (this.getX() - p0.getX()) + (this.getY() - p0.getY()) * (this.getY() - p0.getY())); } /** * Determines whether two vectors (p0, p1) and (p1, p2) * defined by three points p0, p1 and p2 make a left turn. * * @param p0 The first point * @param p1 The second point * @param p2 The third point * @return true, if the turn is left, false otherwise */ public static boolean isLeftTurn(Point p0, Point p1, Point p2) { return (crossProduct(p0, p1, p2) > 0); } /** * Determines whether two vectors (p0, p1) and (p1, p2) * defined by three points p0, p1 and p2 make a right turn. * * @param p0 The first point * @param p1 The second point * @param p2 The third point * @return true, if the turn is right, false otherwise */ public static boolean isRightTurn(Point p0, Point p1, Point p2) { return (crossProduct(p0, p1, p2) < 0); } @Override public boolean equals(Object o2) { if (! (o2 instanceof Point)) { return false; } Point p2 = (Point) o2; return (this.getX() == p2.getX() && this.getY() == p2.getY()); } @Override public String toString() { return ("(" + this.getX() + ", " + this.getY() + ")"); } /** * Determines whether the point is the left vertex of the attached segment. * * @return true, if the point is the left vertex, false otherwise */ public boolean isLeft() { return (segment != null && this.equals(segment.getLeft())); } /** * Determines whether the point is the right vertex of the attached segment. * * @return true, if the point is the right vertex, false otherwise */ public boolean isRight() { return (segment != null && this.equals(segment.getRight())); } /** * Determines whether the point is equal to Point.NaP (not a point). * * @return true, if the point is NaP, false otherwise */ public boolean isNaP() { return x == Double.NaN || y == Double.NaN; } /** * The "not a point" object. */ public final static Point NaP = new Point(Double.NaN, Double.NaN); final private double x; final private double y; private Segment segment; }
tarczynskitomek/jvm-bloggers
src/main/java/com/jvm_bloggers/entities/top_posts_summary/BasePopularBlogPost.java
package com.jvm_bloggers.entities.top_posts_summary; import com.jvm_bloggers.entities.blog_post.BlogPost; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.Column; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.MappedSuperclass; import static lombok.AccessLevel.PROTECTED; @MappedSuperclass @Getter @NoArgsConstructor(access = PROTECTED) public abstract class BasePopularBlogPost { @Column(name = "position", nullable = false) private Long position; @ManyToOne(optional = false) @JoinColumn(name = "blog_post_id", nullable = false) private BlogPost blogPost; @Setter @ManyToOne(optional = false) @JoinColumn(name = "top_posts_summary_id", nullable = false) private TopPostsSummary topPostsSummary; @Column(name = "number_of_clicks", nullable = false) private Long numberOfClicks; public BasePopularBlogPost(BlogPost blogPost, Long position, Long numberOfClicks) { this.position = position; this.blogPost = blogPost; this.numberOfClicks = numberOfClicks; } }
scop/pymarkdown
test/test_markdown_emphasis_rule_2.py
<filename>test/test_markdown_emphasis_rule_2.py """ https://github.github.com/gfm/#emphasis-and-strong-emphasis """ import pytest from .utils import act_and_assert @pytest.mark.gfm def test_emphasis_366(): """ Test case 366: Rule 2: """ # Arrange source_markdown = """_foo bar_""" expected_tokens = [ "[para(1,1):]", "[emphasis(1,1):1:_]", "[text(1,2):foo bar:]", "[end-emphasis(1,9)::]", "[end-para:::True]", ] expected_gfm = """<p><em>foo bar</em></p>""" # Act & Assert act_and_assert(source_markdown, expected_gfm, expected_tokens) @pytest.mark.gfm def test_emphasis_367(): """ Test case 367: This is not emphasis, because the opening _ is followed by whitespace: """ # Arrange source_markdown = """_ foo bar_""" expected_tokens = [ "[para(1,1):]", "[text(1,1):_:]", "[text(1,2): foo bar:]", "[text(1,10):_:]", "[end-para:::True]", ] expected_gfm = """<p>_ foo bar_</p>""" # Act & Assert act_and_assert(source_markdown, expected_gfm, expected_tokens) @pytest.mark.gfm def test_emphasis_368(): """ Test case 368: This is not emphasis, because the opening _ is preceded by an alphanumeric and followed by punctuation: """ # Arrange source_markdown = """a_"foo"_""" expected_tokens = [ "[para(1,1):]", "[text(1,1):a:]", "[text(1,2):_:]", '[text(1,3):\a"\a&quot;\afoo\a"\a&quot;\a:]', "[text(1,8):_:]", "[end-para:::True]", ] expected_gfm = """<p>a_&quot;foo&quot;_</p>""" # Act & Assert act_and_assert(source_markdown, expected_gfm, expected_tokens) @pytest.mark.gfm def test_emphasis_369(): """ Test case 369: (part 1) Emphasis with _ is not allowed inside words: """ # Arrange source_markdown = """foo_bar_""" expected_tokens = [ "[para(1,1):]", "[text(1,1):foo:]", "[text(1,4):_:]", "[text(1,5):bar:]", "[text(1,8):_:]", "[end-para:::True]", ] expected_gfm = """<p>foo_bar_</p>""" # Act & Assert act_and_assert(source_markdown, expected_gfm, expected_tokens) @pytest.mark.gfm def test_emphasis_370(): """ Test case 370: (part 2) Emphasis with _ is not allowed inside words: """ # Arrange source_markdown = """5_6_78""" expected_tokens = [ "[para(1,1):]", "[text(1,1):5:]", "[text(1,2):_:]", "[text(1,3):6:]", "[text(1,4):_:]", "[text(1,5):78:]", "[end-para:::True]", ] expected_gfm = """<p>5_6_78</p>""" # Act & Assert act_and_assert(source_markdown, expected_gfm, expected_tokens) @pytest.mark.gfm def test_emphasis_371(): """ Test case 371: (part 3) Emphasis with _ is not allowed inside words: """ # Arrange source_markdown = """пристаням_стремятся_""" expected_tokens = [ "[para(1,1):]", "[text(1,1):пристаням:]", "[text(1,10):_:]", "[text(1,11):стремятся:]", "[text(1,20):_:]", "[end-para:::True]", ] expected_gfm = """<p>пристаням_стремятся_</p>""" # Act & Assert act_and_assert(source_markdown, expected_gfm, expected_tokens) @pytest.mark.gfm def test_emphasis_372(): """ Test case 372: Here _ does not generate emphasis, because the first delimiter run is right-flanking and the second left-flanking: """ # Arrange source_markdown = """aa_"bb"_cc""" expected_tokens = [ "[para(1,1):]", "[text(1,1):aa:]", "[text(1,3):_:]", '[text(1,4):\a"\a&quot;\abb\a"\a&quot;\a:]', "[text(1,8):_:]", "[text(1,9):cc:]", "[end-para:::True]", ] expected_gfm = """<p>aa_&quot;bb&quot;_cc</p>""" # Act & Assert act_and_assert(source_markdown, expected_gfm, expected_tokens) @pytest.mark.gfm def test_emphasis_373(): """ Test case 373: This is emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation: """ # Arrange source_markdown = """foo-_(bar)_""" expected_tokens = [ "[para(1,1):]", "[text(1,1):foo-:]", "[emphasis(1,5):1:_]", "[text(1,6):(bar):]", "[end-emphasis(1,11)::]", "[end-para:::True]", ] expected_gfm = """<p>foo-<em>(bar)</em></p>""" # Act & Assert act_and_assert(source_markdown, expected_gfm, expected_tokens)
voiser/functional-toy-language
src/main/java/ast2/GrammarListener.java
// Generated from src/main/antlr/Grammar.g4 by ANTLR 4.5.1 package ast2; import org.antlr.v4.runtime.tree.ParseTreeListener; /** * This interface defines a complete listener for a parse tree produced by * {@link GrammarParser}. */ public interface GrammarListener extends ParseTreeListener { /** * Enter a parse tree produced by {@link GrammarParser#file}. * @param ctx the parse tree */ void enterFile(GrammarParser.FileContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#file}. * @param ctx the parse tree */ void exitFile(GrammarParser.FileContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#imp}. * @param ctx the parse tree */ void enterImp(GrammarParser.ImpContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#imp}. * @param ctx the parse tree */ void exitImp(GrammarParser.ImpContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#block}. * @param ctx the parse tree */ void enterBlock(GrammarParser.BlockContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#block}. * @param ctx the parse tree */ void exitBlock(GrammarParser.BlockContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#expression}. * @param ctx the parse tree */ void enterExpression(GrammarParser.ExpressionContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#expression}. * @param ctx the parse tree */ void exitExpression(GrammarParser.ExpressionContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#value}. * @param ctx the parse tree */ void enterValue(GrammarParser.ValueContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#value}. * @param ctx the parse tree */ void exitValue(GrammarParser.ValueContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#fn}. * @param ctx the parse tree */ void enterFn(GrammarParser.FnContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#fn}. * @param ctx the parse tree */ void exitFn(GrammarParser.FnContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#fnargpair}. * @param ctx the parse tree */ void enterFnargpair(GrammarParser.FnargpairContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#fnargpair}. * @param ctx the parse tree */ void exitFnargpair(GrammarParser.FnargpairContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#apply}. * @param ctx the parse tree */ void enterApply(GrammarParser.ApplyContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#apply}. * @param ctx the parse tree */ void exitApply(GrammarParser.ApplyContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#anonapply}. * @param ctx the parse tree */ void enterAnonapply(GrammarParser.AnonapplyContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#anonapply}. * @param ctx the parse tree */ void exitAnonapply(GrammarParser.AnonapplyContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#ref}. * @param ctx the parse tree */ void enterRef(GrammarParser.RefContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#ref}. * @param ctx the parse tree */ void exitRef(GrammarParser.RefContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#cond}. * @param ctx the parse tree */ void enterCond(GrammarParser.CondContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#cond}. * @param ctx the parse tree */ void exitCond(GrammarParser.CondContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#forward}. * @param ctx the parse tree */ void enterForward(GrammarParser.ForwardContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#forward}. * @param ctx the parse tree */ void exitForward(GrammarParser.ForwardContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#tydef}. * @param ctx the parse tree */ void enterTydef(GrammarParser.TydefContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#tydef}. * @param ctx the parse tree */ void exitTydef(GrammarParser.TydefContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#list}. * @param ctx the parse tree */ void enterList(GrammarParser.ListContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#list}. * @param ctx the parse tree */ void exitList(GrammarParser.ListContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#map}. * @param ctx the parse tree */ void enterMap(GrammarParser.MapContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#map}. * @param ctx the parse tree */ void exitMap(GrammarParser.MapContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#mappair}. * @param ctx the parse tree */ void enterMappair(GrammarParser.MappairContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#mappair}. * @param ctx the parse tree */ void exitMappair(GrammarParser.MappairContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#klass}. * @param ctx the parse tree */ void enterKlass(GrammarParser.KlassContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#klass}. * @param ctx the parse tree */ void exitKlass(GrammarParser.KlassContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#klassvar}. * @param ctx the parse tree */ void enterKlassvar(GrammarParser.KlassvarContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#klassvar}. * @param ctx the parse tree */ void exitKlassvar(GrammarParser.KlassvarContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#klassparent}. * @param ctx the parse tree */ void enterKlassparent(GrammarParser.KlassparentContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#klassparent}. * @param ctx the parse tree */ void exitKlassparent(GrammarParser.KlassparentContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#instantiation}. * @param ctx the parse tree */ void enterInstantiation(GrammarParser.InstantiationContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#instantiation}. * @param ctx the parse tree */ void exitInstantiation(GrammarParser.InstantiationContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#interf}. * @param ctx the parse tree */ void enterInterf(GrammarParser.InterfContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#interf}. * @param ctx the parse tree */ void exitInterf(GrammarParser.InterfContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#match}. * @param ctx the parse tree */ void enterMatch(GrammarParser.MatchContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#match}. * @param ctx the parse tree */ void exitMatch(GrammarParser.MatchContext ctx); /** * Enter a parse tree produced by {@link GrammarParser#matchexp}. * @param ctx the parse tree */ void enterMatchexp(GrammarParser.MatchexpContext ctx); /** * Exit a parse tree produced by {@link GrammarParser#matchexp}. * @param ctx the parse tree */ void exitMatchexp(GrammarParser.MatchexpContext ctx); }
lananh265/social-network
node_modules/react-icons-kit/md/ic_no_drinks_twotone.js
<filename>node_modules/react-icons-kit/md/ic_no_drinks_twotone.js "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ic_no_drinks_twotone = void 0; var ic_no_drinks_twotone = { "viewBox": "0 0 24 24", "children": [{ "name": "g", "attribs": {}, "children": [{ "name": "rect", "attribs": { "fill": "none", "height": "24", "width": "24" }, "children": [{ "name": "rect", "attribs": { "fill": "none", "height": "24", "width": "24" }, "children": [] }] }, { "name": "polygon", "attribs": { "opacity": ".3", "points": "14.77,9 11.83,9 13.38,10.56" }, "children": [{ "name": "polygon", "attribs": { "opacity": ".3", "points": "14.77,9 11.83,9 13.38,10.56" }, "children": [] }] }, { "name": "path", "attribs": { "d": "M21.19,21.19L2.81,2.81L1.39,4.22l8.23,8.23L11,14v5H6v2h12v-0.17l1.78,1.78L21.19,21.19z M13,19v-3.17L16.17,19H13z M7.83,5l-2-2H21v2l-6.2,6.97l-1.42-1.42L14.77,9h-2.94l-2-2h6.74l1.78-2H7.83z" }, "children": [{ "name": "path", "attribs": { "d": "M21.19,21.19L2.81,2.81L1.39,4.22l8.23,8.23L11,14v5H6v2h12v-0.17l1.78,1.78L21.19,21.19z M13,19v-3.17L16.17,19H13z M7.83,5l-2-2H21v2l-6.2,6.97l-1.42-1.42L14.77,9h-2.94l-2-2h6.74l1.78-2H7.83z" }, "children": [] }] }] }] }; exports.ic_no_drinks_twotone = ic_no_drinks_twotone;
ipc-sim/ipc-toolk
src/ipc.hpp
<filename>src/ipc.hpp<gh_stars>10-100 #pragma once #include <Eigen/Core> #include <Eigen/Sparse> #include <ipc/collision_constraint.hpp> // NOTE: Include this so the user can just include ipc.hpp #include <ipc/friction/friction.hpp> #include <ipc/broad_phase/broad_phase.hpp> /// Incremental Potential Contact functions namespace ipc { /// @brief Construct a set of constraints used to compute the barrier potential. /// /// All vertices in V will be considered for collisions, so V should be only the /// surface vertices. The edges and face should be only for the surface /// elements. /// /// @param[in] V Vertex positions as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] dhat The activation distance of the barrier. /// @param[out] constraint_set /// The constructed set of constraints (any existing constraints will be /// cleared). /// @param[in] F2E Map from F edges to rows of E. /// @param[in] dmin Minimum distance. /// @param[in] method Broad-phase method to use. /// @param[in] can_collide /// A function that takes two vertex IDs (row numbers in V) and returns true /// if the vertices (and faces or edges containing the vertices) can /// collide. By default all primitives can collide with all other /// primitives. void construct_constraint_set( const Eigen::MatrixXd& V_rest, const Eigen::MatrixXd& V, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const double dhat, Constraints& constraint_set, const Eigen::MatrixXi& F2E = Eigen::MatrixXi(), const double dmin = 0, const BroadPhaseMethod& method = BroadPhaseMethod::HASH_GRID, const std::function<bool(size_t, size_t)>& can_collide = [](size_t, size_t) { return true; }); /// @brief Construct a set of constraints used to compute the barrier potential. /// /// V can either be the surface vertices or the entire mesh vertices. The edges /// and face should be only for the surface elements. /// /// @param[in] V Vertex positions as rows of a matrix. /// @param[in] codim_V /// Vertex indices of codimensional points. Pass `Eigen::VectorXi()` to /// ignore all codimensional vertices (vertices not connected to an edge). /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] dhat The activation distance of the barrier. /// @param[out] constraint_set /// The constructed set of constraints (any existing constraints will be /// cleared). /// @param[in] F2E Map from F edges to rows of E. /// @param[in] dmin Minimum distance. /// @param[in] method Broad-phase method to use. /// @param[in] can_collide /// A function that takes two vertex IDs (row numbers in V) and returns true /// if the vertices (and faces or edges containing the vertices) can /// collide. By default all primitives can collide with all other /// primitives. void construct_constraint_set( const Eigen::MatrixXd& V_rest, const Eigen::MatrixXd& V, const Eigen::VectorXi& codim_V, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const double dhat, Constraints& constraint_set, const Eigen::MatrixXi& F2E = Eigen::MatrixXi(), const double dmin = 0, const BroadPhaseMethod& method = BroadPhaseMethod::HASH_GRID, const std::function<bool(size_t, size_t)>& can_collide = [](size_t, size_t) { return true; }); /// @brief Construct a set of constraints used to compute the barrier potential. /// /// V can either be the surface vertices or the entire mesh vertices. The edges /// and face should be only for the surface elements. /// /// @param[in] candidates Distance candidates from which the constraint set is /// built. /// @param[in] V Vertex positions as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] dhat The activation distance of the barrier. /// @param[out] constraint_set /// The constructed set of constraints (any existing constraints will be /// cleared). /// @param[in] F2E Map from F edges to rows of E. /// @param[in] dmin Minimum distance. void construct_constraint_set( const Candidates& candidates, const Eigen::MatrixXd& V_rest, const Eigen::MatrixXd& V, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const double dhat, Constraints& constraint_set, const Eigen::MatrixXi& F2E = Eigen::MatrixXi(), const double dmin = 0); /// @brief Compute the barrier potential for a given constraint set. /// /// @param[in] V Vertex positions as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] constraint_set The set of constraints. /// @param[in] dhat The activation distance of the barrier. /// @returns The sum of all barrier potentials (not scaled by the barrier /// stiffness). double compute_barrier_potential( const Eigen::MatrixXd& V, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const Constraints& constraint_set, const double dhat); /// @brief Compute the gradient of the barrier potential. /// /// @param[in] V Vertex positions as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] constraint_set The set of constraints. /// @param[in] dhat The activation distance of the barrier. /// @returns The gradient of all barrier potentials (not scaled by the barrier /// stiffness). Eigen::VectorXd compute_barrier_potential_gradient( const Eigen::MatrixXd& V, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const Constraints& constraint_set, const double dhat); /// @brief Compute the hessian of the barrier potential. /// /// @param[in] V Vertex positions as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] constraint_set The set of constraints. /// @param[in] dhat The activation distance of the barrier. /// @param[in] project_hessian_to_psd Make sure the hessian is positive /// semi-definite. /// @returns The hessian of all barrier potentials (not scaled by the barrier /// stiffness). Eigen::SparseMatrix<double> compute_barrier_potential_hessian( const Eigen::MatrixXd& V, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const Constraints& constraint_set, const double dhat, const bool project_hessian_to_psd = true); /////////////////////////////////////////////////////////////////////////////// // Collision detection /// @brief Determine if the step is collision free. /// /// All vertices in V0 and V1 will be considered for collisions, so V0 and /// V1 should be only the surface vertices. The edges and face should be only /// for the surface elements. /// /// @note Assumes the trajectory is linear. /// /// @param[in] V0 Vertex positions at start as rows of a matrix. /// @param[in] V1 Vertex positions at end as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] can_collide /// A function that takes two vertex IDs (row numbers in F) and returns true /// if the vertices (and faces or edges containing the vertices) can /// collide. By default all primitives can collide with all other primiti /// @returns True if <b>any</b> collisions occur. bool is_step_collision_free( const Eigen::MatrixXd& V0, const Eigen::MatrixXd& V1, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const BroadPhaseMethod& method = BroadPhaseMethod::HASH_GRID, const double tolerance = 1e-6, const long max_iterations = 1e7, const std::function<bool(size_t, size_t)>& can_collide = [](size_t, size_t) { return true; }); /// @brief Determine if the step is collision free. /// /// V can either be the surface vertices or the entire mesh vertices. The edges /// and face should be only for the surface elements. /// /// @note Assumes the trajectory is linear. /// /// @param[in] V0 Vertex positions at start as rows of a matrix. /// @param[in] V1 Vertex positions at end as rows of a matrix. /// @param[in] codim_V Vertex indices of codimensional points. Pass /// Eigen::VectorXi() to ignore all codimensional vertices (vertices not /// connected to an edge). /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] can_collide /// A function that takes two vertex IDs (row numbers in F) and returns true /// if the vertices (and faces or edges containing the vertices) can /// collide. By default all primitives can collide with all other primiti /// @returns True if <b>any</b> collisions occur. bool is_step_collision_free( const Eigen::MatrixXd& V0, const Eigen::MatrixXd& V1, const Eigen::VectorXi& codim_V, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const BroadPhaseMethod& method = BroadPhaseMethod::HASH_GRID, const double tolerance = 1e-6, const long max_iterations = 1e7, const std::function<bool(size_t, size_t)>& can_collide = [](size_t, size_t) { return true; }); /// @brief Determine if the step is collision free from a set of candidates. /// /// V can either be the surface vertices or the entire mesh vertices. The edges /// and face should be only for the surface elements. /// /// @note Assumes the trajectory is linear. /// /// @param[in] candidates Set of candidates to check for collisions. /// @param[in] V0 Vertex positions at start as rows of a matrix. /// @param[in] V1 Vertex positions at end as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// /// @returns True if <b>any</b> collisions occur. bool is_step_collision_free( const Candidates& candidates, const Eigen::MatrixXd& V0, const Eigen::MatrixXd& V1, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const double tolerance = 1e-6, const long max_iterations = 1e7); /// @brief Computes a maximal step size that is collision free. /// /// All vertices in V0 and V1 will be considered for collisions, so V0 and /// V1 should be only the surface vertices. The edges and face should be only /// for the surface elements. /// /// @note Assumes the trajectory is linear. /// /// @param[in] V0 /// Vertex positions at start as rows of a matrix. Assumes V0 is /// intersection free. /// @param[in] V1 Vertex positions at end as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] can_collide /// A function that takes two vertex IDs (row numbers in F) and returns true /// if the vertices (and faces or edges containing the vertices) can /// collide. By default all primitives can collide with all other /// primitives. /// @returns A step-size \f$\in [0, 1]\f$ that is collision free. A value of 1.0 /// if a full step and 0.0 is no step. double compute_collision_free_stepsize( const Eigen::MatrixXd& V0, const Eigen::MatrixXd& V1, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const BroadPhaseMethod& method = BroadPhaseMethod::HASH_GRID, const double tolerance = 1e-6, const long max_iterations = 1e7, const std::function<bool(size_t, size_t)>& can_collide = [](size_t, size_t) { return true; }); /// @brief Computes a maximal step size that is collision free. /// /// @note Assumes the trajectory is linear. /// /// @param[in] V0 /// Vertex positions at start as rows of a matrix. Assumes V0 is /// intersection free. /// @param[in] V1 Vertex positions at end as rows of a matrix. /// @param[in] codim_V Vertex indices of codimensional points. Pass /// Eigen::VectorXi() to ignore all codimensional vertices (vertices not /// connected to an edge). /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] can_collide /// A function that takes two vertex IDs (row numbers in F) and returns true /// if the vertices (and faces or edges containing the vertices) can /// collide. By default all primitives can collide with all other /// primitives. /// @returns A step-size \f$\in [0, 1]\f$ that is collision free. A value of 1.0 /// if a full step and 0.0 is no step. double compute_collision_free_stepsize( const Eigen::MatrixXd& V0, const Eigen::MatrixXd& V1, const Eigen::VectorXi& codim_V, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const BroadPhaseMethod& method = BroadPhaseMethod::HASH_GRID, const double tolerance = 1e-6, const long max_iterations = 1e7, const std::function<bool(size_t, size_t)>& can_collide = [](size_t, size_t) { return true; }); /// @brief Computes a maximal step size that is collision free using a set of /// collision candidates. /// /// @note Assumes the trajectory is linear. /// /// @param[in] candidates Set of candidates to check for collisions. /// @param[in] V0 /// Vertex positions at start as rows of a matrix. Assumes V0 is /// intersection free. /// @param[in] V1 Vertex positions at end as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. //// /// @returns A step-size \f$\in [0, 1]\f$ that is collision free. A value of 1.0 /// if a full step and 0.0 is no step. double compute_collision_free_stepsize( const Candidates& candidates, const Eigen::MatrixXd& V0, const Eigen::MatrixXd& V1, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const double tolerance = 1e-6, const long max_iterations = 1e7); /////////////////////////////////////////////////////////////////////////////// // Utilities /// @brief Computes the minimum distance between any non-adjacent elements. /// /// @param[in] V Vertex positions as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @returns The minimum distance between any non-adjacent elements. double compute_minimum_distance( const Eigen::MatrixXd& V, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const Constraints& constraint_set); /// @brief Determine if the mesh has self intersections. /// /// @param[in] V Vertex positions as rows of a matrix. /// @param[in] E Edges as rows of indicies into V. /// @param[in] F Triangular faces as rows of indicies into V. /// @param[in] can_collide /// A function that takes two vertex IDs (row numbers in F) and returns true /// if the vertices (and faces or edges containing the vertices) can /// collide. By default all primitives can collide with all other /// primitives. bool has_intersections( const Eigen::MatrixXd& V, const Eigen::MatrixXi& E, const Eigen::MatrixXi& F, const std::function<bool(size_t, size_t)>& can_collide = [](size_t, size_t) { return true; }); } // namespace ipc
entur/chouette
mobi.chouette.service/src/main/java/mobi/chouette/scheduler/LocalReferentialLockManager.java
<gh_stars>1-10 package mobi.chouette.scheduler; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import javax.ejb.Singleton; import javax.inject.Named; import lombok.extern.log4j.Log4j; import static mobi.chouette.scheduler.LocalReferentialLockManager.BEAN_NAME; @Singleton(name = BEAN_NAME) @Named @Log4j public class LocalReferentialLockManager implements ReferentialLockManager { public static final String BEAN_NAME = "localReferentialLockManager"; private Map<String, Object> referentialRegistry = new ConcurrentHashMap<>(); private Map<Long, Object> jobRegistry = new ConcurrentHashMap<>(); public boolean attemptAcquireLocks(Set<String> referentials) { synchronized (referentialRegistry) { boolean allFree = referentials.stream().allMatch(referential -> !referentialRegistry.containsKey(referential)); if (allFree) { referentials.stream().forEach(referential -> referentialRegistry.put(referential, new Object())); log.info("Acquired locks: " + referentials); return true; } } return false; } public void releaseLocks(Set<String> referentials) { if (referentials.stream().allMatch(referential -> referentialRegistry.remove(referential) != null)) { log.info("Released locks: " + referentials); } else { log.warn("Attempted to release already free locks (probably cancelled job): " + referentials); } } @Override public boolean attemptAcquireJobLock(Long jobId) { boolean acquired = false; if (!jobRegistry.containsKey(jobId)) { synchronized (jobRegistry) { if (!jobRegistry.containsKey(jobId)) { jobRegistry.put(jobId, new Object()); acquired = true; } } } return acquired; } @Override public void releaseJobLock(Long jobId) { jobRegistry.remove(jobId); } @Override public String lockStatus() { return "Local lock manager. Locks: " + referentialRegistry.keySet(); } }
zhcet19/NeoAlgo-1
C/cp/cp_sets_question.c
/* There is an array of n integers. There are also 2 disjoint sets, A and B, each containing m integers. You like all the integers in set A and dislike all the integers in set B. Your initial happiness is 0. For each i integer in the array, if i e A , you add 1 to your happiness. If i e B, you add -1 to your happiness. Otherwise, your happiness does not change. Output your final happiness at the end. Input Format The first line contains integers n and m separated by a space. The second line contains n integers, the elements of the array. The third and fourth lines contain m integers, A and B, respectively. Output Format Output a single integer, your total happiness. Problem Link: https://www.hackerrank.com/challenges/no-idea/problem */ #include<stdio.h> int countHappiness(int arr[], int n, int m, int A[], int B[]) { int happiness = 0, i, j; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { if (A[j] == arr[i]) { happiness += 1; break; } if (B[j] == arr[i]) { happiness -= 1; break; } } } return happiness; } int main() { int i, n, m, arr[100000], A[100000], B[100000], totalHappy; printf("Enter the value of n and m: "); scanf("%d%d", & n, & m); printf("Enter the elements of array: "); for (i = 0; i < n; i++) scanf("%d", & arr[i]); printf("Enter the elements of set A: "); for (i = 0; i < m; i++) scanf("%d", & A[i]); printf("Enter the elements of set B: "); for (i = 0; i < m; i++) scanf("%d", & B[i]); totalHappy = countHappiness(arr, n, m, A, B); printf("Total happiness= %d", totalHappy); return 0; } /* Sample input/output Enter the value of n and m: 3 2 Enter the elements of array: 1 5 3 Enter the elements of set A: 3 1 Enter the elements of set B: 5 7 Total happiness= 1 Time Complexity= O(n^2) Space Complexity= O(1) */
particle-iot/moped
spec/moped/cluster_spec.rb
<reponame>particle-iot/moped<filename>spec/moped/cluster_spec.rb require "spec_helper" describe Moped::Cluster, replica_set: true do describe "#disconnect" do let(:cluster) do described_class.new(seeds, max_retries: 1, down_interval: 1) end let!(:disconnected) do cluster.disconnect end it "disconnects from all the nodes in the cluster" do cluster.nodes.each do |node| node.should_not be_connected end end it "returns true" do disconnected.should be_true end end context "when no nodes are available" do let(:cluster) do described_class.new(seeds, max_retries: 1, down_interval: 1) end before do @replica_set.nodes.each(&:stop) end describe "#with_primary" do it "raises a connection error" do lambda do cluster.with_primary do |node| node.command("admin", ping: 1) end end.should raise_exception(Moped::Errors::ConnectionFailure) end end describe "#with_secondary" do it "raises a connection error" do lambda do cluster.with_secondary do |node| node.command("admin", ping: 1) end end.should raise_exception(Moped::Errors::ConnectionFailure) end end end context "when the replica set hasn't connected yet" do let(:cluster) do described_class.new(seeds, max_retries: 1, down_interval: 1) end describe "#with_primary" do it "connects and yields the primary node" do cluster.with_primary do |node| node.address.original.should eq @primary.address end end end describe "#with_secondary" do it "connects and yields a secondary node" do cluster.with_secondary do |node| @secondaries.map(&:address).should include node.address.original end end end context "and the primary is down" do before do @primary.stop end describe "#with_primary" do it "raises a connection error" do lambda do cluster.with_primary do |node| node.command "admin", ping: 1 end end.should raise_exception(Moped::Errors::ConnectionFailure) end end describe "#with_secondary" do it "connects and yields a secondary node" do cluster.with_secondary do |node| @secondaries.map(&:address).should include node.address.original end end end end [ Moped::Errors::ReplicaSetReconfigured.new({}, {}), Moped::Errors::ConnectionFailure.new ].each do |ex| context "and a secondary raises an #{ex.class} error" do let(:first_node) { @secondaries.first } let(:second_node_address) { @secondaries[1].address } before :each do # We need to effectively stub out the shuffle! so we can deterministically check that we get the second node cluster.stub(:available_secondary_nodes).and_return(@secondaries.dup) first_node.stub(:kill_cursors).and_raise(ex) end it "connects and yields a secondary node" do cluster.with_secondary do |node| node.kill_cursors([123]) node.address.should eq second_node_address end end end end context "and a single secondary is down" do before do @secondaries.first.stop end describe "#with_primary" do it "connects and yields the primary node" do cluster.with_primary do |node| node.address.original.should eq @primary.address end end end describe "#with_secondary" do it "connects and yields a secondary node" do cluster.with_secondary do |node| node.address.original.should eq @secondaries.last.address end end end end context "and all secondaries are down" do before do @secondaries.each(&:stop) end describe "#with_primary" do it "connects and yields the primary node" do cluster.with_primary do |node| node.address.original.should eq @primary.address end end end describe "#with_secondary" do it "raises a connection faiure" do expect { cluster.with_secondary {} }.to raise_error(Moped::Errors::ConnectionFailure) end end end end context "when the replica set is connected" do let(:cluster) do described_class.new(seeds, max_retries: 1, down_interval: 1) end before do cluster.refresh end describe "#with_primary" do it "connects and yields the primary node" do cluster.with_primary do |node| node.address.original.should eq @primary.address end end end describe "#with_secondary" do it "connects and yields a secondary node" do cluster.with_secondary do |node| @secondaries.map(&:address).should include node.address.original end end end context "and the primary is down" do before do @primary.stop end describe "#with_primary" do it "raises a connection error" do lambda do cluster.with_primary do |node| node.command "admin", ping: 1 end end.should raise_exception(Moped::Errors::ConnectionFailure) end end describe "#with_secondary" do it "connects and yields a secondary node" do cluster.with_secondary do |node| @secondaries.map(&:address).should include node.address.original end end end end context "and a single secondary is down" do before do @secondaries.first.stop end describe "#with_primary" do it "connects and yields the primary node" do cluster.with_primary do |node| node.address.original.should eq @primary.address end end end describe "#with_secondary" do it "connects and yields a secondary node" do cluster.with_secondary do |node| node.command "admin", ping: 1 node.address.original.should eq @secondaries.last.address end end end end context "and all secondaries are down" do before do @secondaries.each(&:stop) end describe "#with_primary" do it "connects and yields the primary node" do cluster.with_primary do |node| node.address.original.should eq @primary.address end end end describe "#with_secondary" do it "raises a connection failure" do expect { cluster.with_secondary do |node| node.command("admin", ping: 1) end }.to raise_error(Moped::Errors::ConnectionFailure) end end end end context "with down interval" do let(:cluster) do Moped::Cluster.new(seeds, { down_interval: 5, pool_size: 1 }) end context "and all secondaries are down" do before do cluster.refresh @secondaries.each(&:stop) cluster.refresh end describe "#with_secondary" do it "raises a connection failure" do expect { cluster.with_secondary do |node| node.command("admin", ping: 1) end }.to raise_error(Moped::Errors::ConnectionFailure) end end context "when a secondary node comes back up" do before do @secondaries.each(&:restart) end describe "#with_secondary" do it "raises an error" do expect { cluster.with_secondary do |node| node.command "admin", ping: 1 end }.to raise_error(Moped::Errors::ConnectionFailure) end end context "and the node is ready to be retried" do it "connects and yields the secondary node" do Time.stub(:new).and_return(Time.now + 10) cluster.with_secondary do |node| node.command "admin", ping: 1 @secondaries.map(&:address).should include node.address.original end end end end end end context "with only primary provided as a seed" do let(:cluster) do Moped::Cluster.new([@primary.address], {}) end describe "#with_primary" do it "connects and yields the primary node" do cluster.with_primary do |node| node.address.original.should eq @primary.address end end end describe "#with_secondary" do it "connects and yields a secondary node" do cluster.with_secondary do |node| @secondaries.map(&:address).should include node.address.original end end end end context "with only a secondary provided as a seed" do let(:cluster) do Moped::Cluster.new([@secondaries[0].address], {}) end describe "#with_primary" do it "connects and yields the primary node" do cluster.with_primary do |node| node.address.original.should eq @primary.address end end end describe "#with_secondary" do it "connects and yields a secondary node" do cluster.with_secondary do |node| @secondaries.map(&:address).should include node.address.original end end end end describe "#refresh" do let(:cluster) do described_class.new(seeds, max_retries: 1, down_interval: 1) end context "when old nodes are removed from the set" do before do @secondaries.delete(@replica_set.remove_node) cluster.refresh end it "gets removed from the available nodes and configured nodes" do cluster.nodes.size.should eq(2) cluster.seeds.size.should eq(2) end end end describe "#refreshable?" do let(:cluster) do described_class.new(seeds, {}) end context "when the node is an arbiter" do let(:node) do cluster.nodes.first end before do node.instance_variable_set(:@arbiter, true) node.instance_variable_set(:@down_at, Time.new - 60) end it "returns false" do expect(cluster.send(:refreshable?, node)).to be_false end end end end describe Moped::Cluster, "authentication", mongohq: :auth do shared_examples_for "authenticable session" do context "when logging in with valid credentials" do it "logs in and processes commands" do session.login(*Support::MongoHQ.auth_credentials) session.command(ping: 1).should eq("ok" => 1) end end context "when logging in with invalid credentials" do it "raises an AuthenticationFailure exception" do session.login "invalid-user", "invalid-password" lambda do session.command(ping: 1) end.should raise_exception(Moped::Errors::AuthenticationFailure) end end context "when logging in with valid credentials and then logging out" do before do session.login(*Support::MongoHQ.auth_credentials) session.command(ping: 1).should eq("ok" => 1) end it "logs out" do lambda do session.command dbStats: 1 end.should_not raise_exception session.logout lambda do session.command dbStats: 1 end.should raise_exception(Moped::Errors::OperationFailure) end end end context "when there are multiple connections on the pool" do let(:session) do Support::MongoHQ.auth_session(false) end it_behaves_like "authenticable session" end context "when there is one connections on the pool" do let(:session) do Support::MongoHQ.auth_session(false, pool_size: 1) end it_behaves_like "authenticable session" context "when disconnecting the session" do before do session.login(*Support::MongoHQ.auth_credentials) session.disconnect end it "reconnects" do session.command(ping: 1).should eq("ok" => 1) end it "authenticates" do session[:users].find.entries.should eq([]) end end context "when creating multiple sessions" do before do session.login(*Support::MongoHQ.auth_credentials) end let(:session_two) do Support::MongoHQ.auth_session(true, pool_size: 1) end let(:connection) do conn = nil session.cluster.seeds.first.connection { |c| conn = c } conn end it "logs in only once" do connection.should_receive(:login).once.and_call_original session.command(ping: 1).should eq("ok" => 1) session_two.command(ping: 1).should eq("ok" => 1) end it "does not logout" do connection.should_receive(:logout).never session.command(ping: 1).should eq("ok" => 1) session_two.command(ping: 1).should eq("ok" => 1) end end end end describe Moped::Cluster, "after a reconfiguration" do let(:options) do { max_retries: 30, retry_interval: 1, timeout: 5, database: 'test_db', read: :primary, write: {w: 'majority'} } end let(:replica_set_name) { 'dev' } let(:session) do Moped::Session.new([ "127.0.0.1:31100", "127.0.0.1:31101", "127.0.0.1:31102" ], options) end def step_down_servers step_down_file = File.join(Dir.tmpdir, with_authentication? ? "step_down_with_authentication.js" : "step_down_without_authentication.js") unless File.exists?(step_down_file) File.open(step_down_file, "w") do |file| user_data = with_authentication? ? ", 'admin', 'admin_pwd'" : "" file.puts %{ function stepDown(dbs) { for (i in dbs) { dbs[i].adminCommand({replSetFreeze:5}); try { dbs[i].adminCommand({replSetStepDown:5}); } catch(e) { print(e) }; } }; var db1 = connect('localhost:31100/admin'#{user_data}); var db2 = connect('localhost:31101/admin'#{user_data}); var db3 = connect('localhost:31102/admin'#{user_data}); var dbs = [db1, db2, db3]; stepDown(dbs); while (db1.adminCommand({ismaster:1}).ismaster || db2.adminCommand({ismaster:1}).ismaster || db2.adminCommand({ismaster:1}).ismaster) { stepDown(dbs); } } end end system "mongo --nodb #{step_down_file} 2>&1 > /dev/null" end shared_examples_for "recover the session" do it "should execute commands normally before the stepDown" do time = Benchmark.realtime do session[:foo].find().remove_all() session[:foo].find().to_a.count.should eql(0) session[:foo].insert({ name: "bar 1" }) session[:foo].find().to_a.count.should eql(1) expect { session[:foo].insert({ name: "bar 1" }) }.to raise_exception(Moped::Errors::OperationFailure, /duplicate/) end time.should be < 2 end it "should recover and execute a find" do session[:foo].find().remove_all() session[:foo].insert({ name: "bar 1" }) step_down_servers time = Benchmark.realtime do session[:foo].find().to_a.count.should eql(1) end session.cluster.nodes.map(&:refresh) expect{ session.cluster.nodes.any?{ |node| node.primary? } }.to be_true time.should be > 5 time.should be < 29 end it "should recover and execute an insert" do session[:foo].find().remove_all() session[:foo].insert({ name: "bar 1" }) step_down_servers time = Benchmark.realtime do session[:foo].insert({ name: "bar 2" }) session[:foo].find().to_a.count.should eql(2) end time.should be > 5 time.should be < 29 session[:foo].insert({ name: "bar 3" }) session[:foo].find().to_a.count.should eql(3) end it "should recover and try an insert which hit a constraint" do session[:foo].find().remove_all() session[:foo].insert({ name: "bar 1" }) step_down_servers time = Benchmark.realtime do expect { session[:foo].insert({ name: "bar 1" }) }.to raise_exception(Moped::Errors::OperationFailure, /duplicate/) end session.cluster.nodes.map(&:refresh) expect{ session.cluster.nodes.any?{ |node| node.primary? } }.to be_true time.should be > 5 time.should be < 29 session[:foo].find().to_a.count.should eql(1) session[:foo].insert({ name: "bar 2" }) session[:foo].find().to_a.count.should eql(2) end it "should recover and execute an update" do session[:foo].find().remove_all() session[:foo].insert({ name: "bar 1" }) cursor = session[:foo].find({ name: "bar 1" }) step_down_servers time = Benchmark.realtime do cursor.update({ name: "bar 2" }) end time.should be > 5 time.should be < 29 session[:foo].find().to_a.count.should eql(1) session[:foo].find({ name: "bar 1" }).to_a.count.should eql(0) session[:foo].find({ name: "bar 2" }).to_a.count.should eql(1) end it "should recover and execute a remove" do session[:foo].find().remove_all() session[:foo].insert({ name: "bar 1", type: "some" }) session[:foo].insert({ name: "bar 2", type: "some" }) cursor = session[:foo].find({ type: "some" }) step_down_servers time = Benchmark.realtime do cursor.remove() end time.should be > 5 time.should be < 29 session[:foo].find().to_a.count.should eql(1) session[:foo].find({ name: "bar 1" }).to_a.count.should eql(0) session[:foo].find({ name: "bar 2" }).to_a.count.should eql(1) end it "should recover and execute a remove_all" do session[:foo].find().remove_all() session[:foo].insert({ name: "bar 1", type: "some" }) session[:foo].insert({ name: "bar 2", type: "some" }) cursor = session[:foo].find({ type: "some" }) step_down_servers time = Benchmark.realtime do cursor.remove_all() end time.should be > 5 time.should be < 29 session[:foo].find().to_a.count.should eql(0) session[:foo].find({ name: "bar 1" }).to_a.count.should eql(0) session[:foo].find({ name: "bar 2" }).to_a.count.should eql(0) end it "should recover and execute an operation using the basic command method" do session[:foo].find().remove_all() session[:foo].insert({ name: "bar 1", type: "some" }) session[:foo].insert({ name: "bar 2", type: "some" }) cursor = session[:foo].find({ type: "some" }) step_down_servers time = Benchmark.realtime do cursor.count.should eql(2) end time.should be > 5 time.should be < 29 end end describe "with authentication off" do before do setup_replicaset_environment(with_authentication?) end let(:with_authentication?) { false } it_should_behave_like "recover the session" end describe "with authentication on" do before do setup_replicaset_environment(with_authentication?) session.login('common', 'common_pwd') end let(:with_authentication?) { true } it_should_behave_like "recover the session" end end
so931/poseidonos
test/unit-tests/array/service/io_recover/i_recover_test.cpp
<reponame>so931/poseidonos #include "src/array/service/io_recover/i_recover.h" #include <gtest/gtest.h> namespace pos { TEST(IRecover, GetRecoverMethod_) { } } // namespace pos
ZoroRe/Kitetsu
src/main/java/me/zoro/kitetsu/net/MergeRequestRestService.java
<gh_stars>1-10 package me.zoro.kitetsu.net; import lombok.extern.slf4j.Slf4j; import me.zoro.kitetsu.exception.GlobalException; import me.zoro.kitetsu.model.ApiResponseDTO; import me.zoro.kitetsu.model.IDEntity; import me.zoro.kitetsu.model.IDSEntity; import me.zoro.kitetsu.model.UserDO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.PostConstruct; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; /** * @author luguanquan * @date 2020-05-09 13:03 * <p> * 这里展示一个请求合并的方式,假设这是服务A,并发量非常高,同时它会调用服务B(B可能是一个微服务,也可能是真正去数据库的服务)去真正查询, * 如果A都每次直接调B,必然导致AB并发量一致,负荷达到double,加入A在调用B时能经过一个请求合并,比如几百个请求合在一起一次请求B,就能在B上 * 大大减少并发量,从而提高性能 * <p> * <p> * 提高性能的方式,包括缓存(redis)、缓冲(kafka、mq)、请求合并 * <p> * 这里也类似以下博客展示的一种手写合并请求的方式 * <p> * 手写方式参见:https://blog.csdn.net/u014395955/article/details/103628633 * 使用 Hystrix 方式: https://www.cnblogs.com/hellxz/p/9071163.html */ @RestController @Slf4j public class MergeRequestRestService { @Autowired private UserRestService userRestService; private LinkedBlockingQueue<RealRequest> requestQueue = new LinkedBlockingQueue<>(2000); private ExecutorService executorService; @PostConstruct private void init() { executorService = Executors.newCachedThreadPool(); } @Scheduled(initialDelay = 10, fixedRate = 20) public void mergeRun() { synchronized (requestQueue) { if (requestQueue.size() == 0) { return; } List<RealRequest> currentRequestList = new ArrayList<>(); IDSEntity idsEntity = new IDSEntity(); List<Long> ids = new ArrayList<>(); idsEntity.setIds(ids); while (requestQueue.size() > 0) { RealRequest item = requestQueue.poll(); ids.add(item.id); currentRequestList.add(item); } // 这里提交到线程池避免一次合并就得等他请求结束,提交的话释放锁,队列重新接受数据 executorService.execute(() -> { log.info("合并了{}个请求,现在开始批处理", currentRequestList.size()); ResponseEntity<List<ApiResponseDTO<UserDO>>> all = userRestService.queryUsersBatch(idsEntity); HashMap<Long, ApiResponseDTO<UserDO>> response = new HashMap<>(); if (all.getStatusCode().is2xxSuccessful()) { for (ApiResponseDTO<UserDO> item : all.getBody()) { response.put(item.getData().getId(), item); } for (RealRequest item : currentRequestList) { item.future.complete(ResponseEntity.ok(response.get(item.id))); } } else { //全部请求都返回出错,这里简单粗暴实现了,真实研发需要更好处理 ApiResponseDTO error = new ApiResponseDTO(); error.setCode(-1); error.setMessage("Not Found."); for (RealRequest item : currentRequestList) { item.future.complete(ResponseEntity.ok(error)); } } }); } } @GetMapping("kitetsu/user/merge/get") public ResponseEntity<ApiResponseDTO<UserDO>> queryUser(IDEntity idEntity) { RealRequest realRequest = new RealRequest(); realRequest.id = idEntity.getId(); realRequest.future = new CompletableFuture<>(); requestQueue.add(realRequest); try { return realRequest.future.get(); } catch (Exception e) { log.error("请求异常了"); throw new GlobalException(); } } /** * 封装请求的类 */ static class RealRequest { public long id; public CompletableFuture<ResponseEntity<ApiResponseDTO<UserDO>>> future; } }
woohoou/ember-paper
app/components/paper-autocomplete/highlight.js
export { default } from 'ember-paper/components/paper-autocomplete/highlight/component';
LazarJovic/literary-association
Literary-Association-Application/src/main/java/goveed20/LiteraryAssociationApplication/services/PlagiarismService.java
<filename>Literary-Association-Application/src/main/java/goveed20/LiteraryAssociationApplication/services/PlagiarismService.java package goveed20.LiteraryAssociationApplication.services; import goveed20.LiteraryAssociationApplication.dtos.PlagiarismResultDTO; import goveed20.LiteraryAssociationApplication.utils.PlagiatorClient; import org.apache.pdfbox.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import java.io.FileInputStream; import java.io.IOException; @Service public class PlagiarismService { @Autowired private PlagiatorClient plagiatorClient; public PlagiarismResultDTO uploadPaper(String title, String path, Boolean isNew) throws IOException { MultipartFile file = new MockMultipartFile(title, title + ".pdf", "text/plain", IOUtils.toByteArray(new FileInputStream(path))); if (isNew) { return plagiatorClient.uploadNewPaper(file); } return plagiatorClient.uploadExistingPaper(file); } public void deletePaper(Long id) { try { plagiatorClient.deletePaper(id); } catch (Exception e) { e.printStackTrace(); } } }
js-lib-com/js-widgets
script/js/widget/paging.js
$package("js.widget"); /** * Paging control. A paging control offer means to break large amount of data into pages of fixed size, every page * possessing an index. This paging control is rather simple: it has a number of buttons with the page index as label * and another two for previous and next page. The number of page index buttons visible is limited by component layout * to 5. * <p> * This widget is designed to be used together with a list control. Paging control generates <code>change</code> * events with currently selected page index and external logic is used to load data page from server and update * attached list. * * <pre> * &lt;div class="list-view"&gt; * &lt;div class="list" data-ref="lib/list-ctrl"&gt;&lt;/div&gt; * &lt;ul class="paging" data-ref="lib/paging"&gt;&lt;/ul&gt; * &lt;/div&gt; * </pre> * * Into script, get paging control instance, set its page size and register change event listener. When paging changes a * request for a new page is made and on server response updates list control and paging items count. * * <pre> * this._list = WinMain.doc.getByCss(".list"); * this._paging = WinMain.doc.getByCss(".paging"); * this._paging.setPageSize(PAGE_SIZE).on("change", this._onPagingChange, this); * . . . * _onPagingChange : function (pageIndex) { * var request = { * pageIndex: pageIndex, * pageSize: PAGE_SIZE * }; * js.widget.Controller.loadListPage(request, this._onPagingResponse, this); * }, * . . . * _onPagingResponse : function (response) { * this._list.setObject(response.items); * this._paging.setItemsCount(response.total); * } * </pre> * * @author <NAME> * @since 1.0 * * @constructor Construct this paging control instance. * @param js.dom.Document ownerDoc owner document, * @param Node node built-in {@link Node} instance. */ js.widget.Paging = function (ownerDoc, node) { this.$super(ownerDoc, node); /** * Page size. This is the maximum number of items a page may have. If widget configuration does not specify a value * uses {@link #_DEF_PAGE_SIZE}. * * @type Number */ this._pageSize = this._config.pageSize || this._DEF_PAGE_SIZE; /** * Index of currently active page. * * @type Number */ this._pageIndex = 0; /** * Pages count. * * @type Number */ this._pagesCount = 0; /** * Total items count. * * @type Number */ this._itemsCount = 0; /** * Custom events. Current implementation supports only <code>change</code> event fired after user interface * updated, with current page index as argument. * * @type js.event.CustomEvents */ this._events = this.getCustomEvents(); this._events.register(this._CHANGE_EVENT); // by default auto hide is active if (typeof this._config.autoHide === "undefined") { this._config.autoHide = true; } /** * Previous page button. * * @type js.dom.Element */ this._previousButton = this.getByCssClass(this._CSS_PREVIOUS_BUTTON); $assert(this._previousButton !== null, "js.widget.Paging#Paging", "Invalid paging layout. Missing previous page button."); this._previousButton.on("click", this._onPreviousButtonClick, this); /** * Next page button. * * @type js.dom.Element */ this._nextButton = this.getByCssClass(this._CSS_NEXT_BUTTON); $assert(this._nextButton !== null, "js.widget.Paging#Paging", "Invalid paging layout. Missing next page button."); this._nextButton.on("click", this._onNextButtonClick, this); /** * Index elements list. These are the elements used for page index interaction. * * @type js.dom.EList */ this._indexElements = this.findByCssClass(this._CSS_PAGE_INDEX); this._indexElements.on("click", this._onIndexElementClick, this); /** * Callback for animation frame request. This constant is in fact {@link #_render} method bound to this instance. * * @type Function */ this._FRAME_REQUEST_CALLBACK = this._render.bind(this); }; js.widget.Paging.prototype = { /** * Default page size. * * @type Number */ _DEF_PAGE_SIZE : 8, /** * Page index element CSS mark class. * * @type String */ _CSS_PAGE_INDEX : "page-index", /** * Previous page button CSS mark class. * * @type String */ _CSS_PREVIOUS_BUTTON : "previous-page", /** * Next page button CSS mark class. * * @type String */ _CSS_NEXT_BUTTON : "next-page", /** * Disabled element CSS mark class. * * @type String */ _CSS_DISABLED : "disabled", /** * Active element CSS mark class. * * @type String */ _CSS_ACTIVE : "active", /** * Pagination change event name. * * @type String */ _CHANGE_EVENT : "change", /** * Set page size. * * @param Number pageSize page size. * @return js.widget.Paging this object. * @assert page size argument is a strict positive number. */ setPageSize : function (pageSize) { $assert(js.lang.Types.isNumber(pageSize) && pageSize > 0, "js.widget.Paging#setPageSize", "Page size is not a positive number."); this._pageSize = pageSize; return this; }, /** * Set total items count. * * @param Number itemsCount total items count. * @return js.widget.Paging this object. * @assert total items count argument is a number positive or zero. */ setItemsCount : function (itemsCount) { $assert(js.lang.Types.isNumber(itemsCount) && itemsCount >= 0, "js.widget.Paging#setItemsCount", "Items count is not a positive number."); this._itemsCount = itemsCount; this._pagesCount = Math.ceil(itemsCount / this._pageSize); // if auto hide active display paging control only if there are more than a single page // otherwise display paging if there are some items, i.e. more than 0 if (this._config.autoHide) { this.show(this._pagesCount > 1); } else { this.show(itemsCount > 0); } this._update(); return this; }, /** * Get current selected page index. * * @return Number current selected page index. */ getPageIndex : function () { return this._pageIndex; }, /** * Reset this paging control. */ reset : function () { this._pageIndex = 0; this._pagesCount = 0; this._itemsCount = 0; }, /** * Update this paging control graphical elements. This method delegates {@link #_render()} via animation frame * request. */ _update : function () { window.requestAnimationFrame(this._FRAME_REQUEST_CALLBACK); }, /** * Perform the actual graphical elements update. Change paging buttons active state accordingly internal state * stored into {@link #_pageIndex}, {@link #_pagesCount} and {@link #_itemsCount}. */ _render : function () { var indexElementsCount; // alias for index elements elist size var startPage; // page index displayed into first index element var visibleIndexElements; // if pages count is less than index elements count not all are visible var activeElement; // index element that contains current page index and is marked as active var indexValue; // page index value as displayed to user, 1 based var i; indexElementsCount = this._indexElements.size(); startPage = 0; visibleIndexElements = this._pagesCount; if (this._pagesCount > indexElementsCount) { startPage = this._pageIndex - Math.floor(indexElementsCount / 2); if (startPage < 0) { startPage = 0; } if (startPage + indexElementsCount >= this._pagesCount) { startPage = this._pagesCount - indexElementsCount; } visibleIndexElements = indexElementsCount; } i = 0; // start page is a zero based index but index values is displayed to user and starts with 1 for (indexValue = startPage + 1; i < visibleIndexElements; i++, indexValue++) { this._indexElements.item(i).setText(indexValue.toString()).show().removeCssClass(this._CSS_ACTIVE); } for (; i < this._indexElements.size(); i++) { this._indexElements.item(i).hide().removeCssClass(this._CSS_ACTIVE); } // mark index element that is active page and disable button if active page is on extreme activeElement = this._pageIndex - startPage; this._indexElements.item(activeElement).addCssClass(this._CSS_ACTIVE); this._enable(this._previousButton, activeElement > 0); this._enable(this._nextButton, activeElement < (visibleIndexElements - 1)); }, /** * Previous page button handler. If {@link #_pageIndex} is not zero decrease it and fire change event. * * @param js.event.Event ev mouse click event. */ _onPreviousButtonClick : function (ev) { if (this._pageIndex > 0) { this._pageIndex--; this._fireChangeEvent(); } }, /** * Previous page button handler. If {@link #_pageIndex} is less than pages count increase it and fire change event. * * @param js.event.Event ev mouse click event. */ _onNextButtonClick : function (ev) { if (this._pageIndex < (this._pagesCount - 1)) { this._pageIndex++; this._fireChangeEvent(); } }, /** * Previous page button handler. Fire change event with clicked element related page index. * * @param js.event.Event ev mouse click event. */ _onIndexElementClick : function (ev) { this._pageIndex = Number(ev.target.getText()) - 1; this._fireChangeEvent(); }, _fireChangeEvent : function () { this._events.fire(this._CHANGE_EVENT, this._pageIndex); }, _enable : function (el, condition) { el[(condition ? "remove" : "add") + "CssClass"](this._CSS_DISABLED); }, /** * Returns a string representation of the object. * * @return String object string representation. */ toString : function () { return "js.widget.Paging"; } }; $extends(js.widget.Paging, js.dom.Element); $legacy(typeof window.requestAnimationFrame === "undefined", function () { js.widget.Paging.prototype._update = function () { this._render(); } });
F7YYY/IT178
APK/flappybirds/sources/android/support/v4/view/o.java
package android.support.v4.view; interface o { int a(int i, int i2); }
magic-lantern-studio/mle-parts
Parts/actors/common/src/3danima.cxx
<reponame>magic-lantern-studio/mle-parts /** @defgroup MleParts Magic Lantern Parts */ /** * @file 3danima.cxx * @ingroup MleParts * * This file defines the class for a 3D Camera Actor. * * @author <NAME> * @date May 1, 2003 */ // COPYRIGHT_BEGIN // // Copyright (C) 2000-2007 Wizzer Works // // Wizzer Works makes available all content in this file ("Content"). // Unless otherwise indicated below, the Content is provided to you // under the terms and conditions of the Common Public License Version 1.0 // ("CPL"). A copy of the CPL is available at // // http://opensource.org/licenses/cpl1.0.php // // For purposes of the CPL, "Program" will mean the Content. // // For information concerning this Makefile, contact <NAME>, // of Wizzer Works at <EMAIL>. // // More information concerning Wizzer Works may be found at // // http://www.wizzerworks.com // // COPYRIGHT_END // Include Magic Lantern header files. #include "mle/MleScheduler.h" #include "mle/MleDirector.h" #include "math/3dmath.h" #include "mle/3danima.h" #include "mle/3dtranrc.h" MLE_ACTOR_SOURCE(Mle3dAnimationActor,MleActor); Mle3dAnimationActor::Mle3dAnimationActor() { // This will be done in the frame animation package animationPlayMode = TRUE; animationSpeed = 1; animationFirstFrame = 0; animationLastFrame = -1; animationNumber = 0; animationAutoUpdateFlag = 0; animationAutoUpdateParent = 0; animationAutoUpdateTransform.makeIdentity(); sceneGraphSize = 0; animationTransformList = NULL; } #ifdef MLE_REHEARSAL void Mle3dAnimationActor::initClass() { //Register parent actor's Members mleRegisterActorClass(Mle3dAnimationActor, MleActor); //Expose these Property Members to the tools mlRegisterActorMember(Mle3dAnimationActor, nodeType, int); mlRegisterActorMember(Mle3dAnimationActor, render.style, int); mlRegisterActorMember(Mle3dAnimationActor, render.shading, int); mlRegisterActorMember(Mle3dAnimationActor, render.texturing, int); mlRegisterActorMember(Mle3dAnimationActor, render.textureBlending, int); mlRegisterActorMember(Mle3dAnimationActor, render.boundingBox, int); mlRegisterActorMember(Mle3dAnimationActor, render.facesDoubleSided, int); mlRegisterActorMember(Mle3dAnimationActor, render.facesAlwaysInFront, int); mlRegisterActorMember(Mle3dAnimationActor, animationPlayMode, int); mlRegisterActorMember(Mle3dAnimationActor, animationSpeed, int); mlRegisterActorMember(Mle3dAnimationActor, animationFirstFrame, int); mlRegisterActorMember(Mle3dAnimationActor, animationLastFrame, int); mlRegisterActorMember(Mle3dAnimationActor, animationNumber, int); mlRegisterActorMember(Mle3dAnimationActor, animationAutoUpdateFlag, int); mlRegisterActorMember(Mle3dAnimationActor, animationAutoUpdateParent, int); mlRegisterActorMember(Mle3dAnimationActor, animationAutoUpdateTransform, MlTransform); mlRegisterActorMember(Mle3dAnimationActor, position, MlVector3); mlRegisterActorMember(Mle3dAnimationActor, orientation, MlRotation); mlRegisterActorMember(Mle3dAnimationActor, scale, MlVector3); mlRegisterActorMember(Mle3dAnimationActor, sceneGraph, MlMediaRef); mlRegisterActorMember(Mle3dAnimationActor, animationRegistry, MlMediaRef); // // Mark all the properties that belongs to the "transform" property // data set. // mlRegisterActorMemberDataset(Mle3dAnimationActor, position, MLE_PROP_DATASET_TRANSFORM); mlRegisterActorMemberDataset(Mle3dAnimationActor, orientation, MLE_PROP_DATASET_TRANSFORM); mlRegisterActorMemberDataset(Mle3dAnimationActor, scale, MLE_PROP_DATASET_TRANSFORM); } void Mle3dAnimationActor::resolveEdit(const char* property) { if (property) { if ( !strcmp("nodeType",property)) { nodeType.push(this); } else if (! strcmp("render.texturing",property)) { resolveEdit("sceneGraph"); //This is needed to update texture flags render.push(this); } else if (! strncmp("render.",property,7)) { render.push(this); } else if (! strcmp("position",property)) { position.push(this); } else if (! strcmp("orientation",property)) { orientation.push(this); } else if (! strcmp("animationAutoUpdateParent",property)) { if (animationAutoUpdateFlag) { animationAutoUpdateTransform=computeAnimationAutoUpdateTransform (animationAutoUpdateParent); } } else if (! strcmp("animationNumber",property)) { setupAnimation(animationNumber); } else if (! strcmp("scale",property)) { scale.push(this); } else if (! strcmp("sceneGraph",property) || ! strcmp("animationRegistry",property)) { if (animation) delete animation; theTitle->scheduler->remove(this); int lastFrame = frame; init(); // Must initialize all media at once frame = lastFrame; } } else { // Update position properties only update(); } } #endif /* MLE_REHEARSAL */ Mle3dAnimationActor::~Mle3dAnimationActor() { // Unschedule the behave() function g_theTitle->m_theScheduler->remove(this); } MlTransform Mle3dAnimationActor::computeAnimationAutoUpdateTransform(int parent) { MlTransform result; Mle3dSequence* sequence = Mle3dAnimation::getSequence(animation,(unsigned int)parent); if (sequence) { MlTransform initial,final; if (animationFirstFrame >= 0) initial = sequence->m_frame[animationFirstFrame]; else initial.makeIdentity(); if (animationLastFrame <= animation->m_numFrames) final = sequence->m_frame[animationLastFrame]; else final.makeIdentity(); result = initial.inverse()*final; } return result; } int Mle3dAnimationActor::setupAnimation(int newAnimationNumber) { int result = FALSE; if (animationRegistry.m_animationRegistry) { if (newAnimationNumber >= animationRegistry.m_animationRegistry->m_numAnimations) newAnimationNumber = animationRegistry.m_animationRegistry->m_numAnimations - 1; else if (newAnimationNumber < 0) newAnimationNumber = 0; Mle3dAnimation* newAnimation = NULL; newAnimation = Mle3dAnimationRegistry::getAnimation(animationRegistry.m_animationRegistry, newAnimationNumber); if (newAnimation) { animation = newAnimation; if ((animationFirstFrame < 0) || (animationFirstFrame >= animation->m_numFrames)) animationFirstFrame = 0; if ((animationLastFrame == -1) || (animationLastFrame >= animation->m_numFrames)) animationLastFrame = animation->m_numFrames - 1; if (animationTransformList) delete [] animationTransformList; animationTransformList = new MlTransform*[animation->m_numSequences + 1]; animationTransformList[animation->m_numSequences] = NULL; frame=animationFirstFrame; if (animationAutoUpdateFlag) { animationAutoUpdateTransform = computeAnimationAutoUpdateTransform (animationAutoUpdateParent); } result = TRUE; } else newAnimationNumber = animationNumber; animationNumber = newAnimationNumber; } else animationNumber=0; return result; } void Mle3dAnimationActor::init() { // XXX Push this property on init only (for now) if (sceneGraphSize = sceneGraph.push(this)) { animationObjectNameList=sceneGraph.getNameList(); if ((animationRegistry.push(this)) && setupAnimation(animationNumber)) { g_theTitle->m_theScheduler->insertFunc(PHASE_ACTOR,behave,this,this,1,1); behave(this); // Apply the animation for the first frame } } update(); } void Mle3dAnimationActor::update() { // Push the values of the properties that can be set from the workprint nodeType.push(this); render.push(this); position.push(this); orientation.push(this); scale.push(this); } void Mle3dAnimationActor::behave(void* client) { // Do the actor's behavior Mle3dAnimationActor* a = (Mle3dAnimationActor*)client; if (a->animationPlayMode) { // Cycle through the available animations in the registry after each one plays all frames // Restarts at the first frame at the beginning of each cycle if (a->frame>a->animationLastFrame) { a->animationNumber++; if (a->animationNumber >= a->animationRegistry.m_animationRegistry->m_numAnimations) a->animationNumber=0; a->setupAnimation(a->animationNumber); // Start the actor out in the position it was in at the last frame if (a->animationAutoUpdateFlag) { MlTransform transform; Mle3dTransformCarrier::get(a->getRole(),transform); transform *= a->animationAutoUpdateTransform; Mle3dTransformCarrier::set(a->getRole(),transform); } a->frame = a->animationFirstFrame; } if ((a->frame>=0) && (a->frame<a->animation->m_numFrames)) { // Update the transform list to reference the list of transforms from // the current frame of the animation sequence Mle3dSequence* sequence=NULL; for (unsigned int i=0;i<a->sceneGraphSize;i++) { if (a->animationObjectNameList && a->animationObjectNameList[i] && (sequence=Mle3dAnimation::getSequence(a->animation, a->animationObjectNameList[i]))) a->animationTransformList[i] = &(sequence->m_frame[a->frame]); else a->animationTransformList[i] = NULL; } // Apply the updated transforms to the scene graph Mle3dTransformRegistryCarrier::set(a->sceneGraph.getTransformList(), a->animationTransformList); // Increment the frame counter // XXX The frame animation package will eventually take care of this a->frame += a->animationSpeed; } else a->frame = 0; } }
sebarys/gaze-web
gazeWebsite-service/src/main/java/com/sebarys/gazeWebsite/service/mappers/AttachmentMapper.java
package com.sebarys.gazeWebsite.service.mappers; import com.sebarys.gazeWebsite.model.AttachmentType; import com.sebarys.gazeWebsite.model.dbo.Attachment; import com.sebarys.gazeWebsite.model.dbo.Stimul; import com.sebarys.gazeWebsite.model.dto.DtoAttachment; import com.sebarys.gazeWebsite.repo.StimulRepo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; @Component public class AttachmentMapper implements MapperInterface<Attachment, DtoAttachment> { @Autowired StimulRepo stimulRepo; @Override public Attachment convertToDBO(final DtoAttachment dtoAttachment) { final Attachment attachment = new Attachment(); //attachment.setId(dtoAttachment.getId()); attachment.setName(dtoAttachment.getName()); attachment.setAttachmentType(AttachmentType.valueOf(dtoAttachment.getAttachmentType())); if(dtoAttachment.getStimulId() != null) { Stimul stimul = stimulRepo.findOne(dtoAttachment.getStimulId()); if(stimul != null) { attachment.setStimul(stimul); } } return attachment; } @Override public DtoAttachment convertToDTO(final Attachment attachment) { final DtoAttachment dtoAttachment = new DtoAttachment(); dtoAttachment.setId(attachment.getId()); dtoAttachment.setName(dtoAttachment.getName()); dtoAttachment.setAttachmentType(attachment.getAttachmentType().toString()); if(attachment.getStimul() != null) { dtoAttachment.setStimulId(attachment.getStimul().getId()); } return dtoAttachment; } @Override public Iterable<Attachment> convertToDBO(final Iterable<DtoAttachment> dtos) { final List<Attachment> attachments = new ArrayList<>(); dtos.forEach(dtoAttachment -> attachments.add(convertToDBO(dtoAttachment))); return attachments; } @Override public Iterable<DtoAttachment> convertToDTO(final Iterable<Attachment> dbos) { final List<DtoAttachment> dtoAttachments = new ArrayList<>(); dbos.forEach(attachment -> dtoAttachments.add(convertToDTO(attachment))); return dtoAttachments; } }
dymurray/cpma
pkg/transform/project/project_test.go
<gh_stars>1-10 package project import ( "encoding/json" "testing" "github.com/konveyor/cpma/pkg/io" configv1 "github.com/openshift/api/config/v1" legacyconfigv1 "github.com/openshift/api/legacyconfig/v1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestTranslate(t *testing.T) { projectConfig := legacyconfigv1.ProjectConfig{ DefaultNodeSelector: "node-role.kubernetes.io/compute=true", ProjectRequestMessage: "To provision Projects you must request access in https://labs.opentlc.com or https://rhpds.redhat.com", ProjectRequestTemplate: "default/project-request", SecurityAllocator: &legacyconfigv1.SecurityAllocator{ UIDAllocatorRange: "1000000000-1999999999/10000", MCSAllocatorRange: "s0:/2", MCSLabelsPerProject: 5, }, } f := "testdata/expected-project.json" content, err := io.ReadFile(f) if err != nil { t.Fatalf("Cannot read file: %s", f) } expected := &configv1.Project{} if err := json.Unmarshal(content, &expected); err != nil { t.Fatalf("Error Unmarshalling %s", f) } t.Run("Translate ProjectConfig", func(t *testing.T) { projectConfig, err := Translate(projectConfig) require.NoError(t, err) assert.Equal(t, projectConfig, expected) }) }
jessesanford/kconnect
pkg/defaults/defaults.go
/* Copyright 2020 The kconnect Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package defaults import ( "os" "path" ) const ( RootFolderName = ".kconnect" MaxHistoryItems = 100 // DefaultUIPageSize specifies the default number of items to display to a user DefaultUIPageSize = 10 UsernameConfigItem = "username" PasswordConfigItem = "password" ) func AppDirectory() string { dir, err := os.UserHomeDir() if err != nil { return "" } return path.Join(dir, RootFolderName) } func HistoryPath() string { appDir := AppDirectory() return path.Join(appDir, "history.yaml") } func ConfigPath() string { appDir := AppDirectory() return path.Join(appDir, "config.yaml") }
Mindjolt2406/Competitive-Programming
GoogleCodeJam/GCJ19/Round1A/A.cpp
/* <NAME> IIIT Bangalore */ #include<bits/stdc++.h> #define mt make_tuple #define mp make_pair #define pu push_back #define INF 1000000001 #define MOD 1000000007 #define ll long long int #define ld long double #define vi vector<int> #define vll vector<long long int> #define fi first #define se second #define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;} #define t1(x) cerr<<#x<<" : "<<x<<endl #define t2(x, y) cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl #define t3(x, y, z) cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl #define t4(a,b,c,d) cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl #define t5(a,b,c,d,e) cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl #define t6(a,b,c,d,e,f) cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl #define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME #define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__) #define _ cerr<<"here"<<endl; #define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);} using namespace std; vector<int> v25 = {0,8,1,9,2,5,3,6,4,7}; vector<int> v34 = {0,6,8,1,7,9,2,4,10,3,5,11}; vector<int> v35 = {0,7,14,3,6,13,4,11,9,2,5,12,1,10,8}; vector<int> v44 = {0,13,2,4,10,3,5,11,12,7,9,15,6,8,14,1}; bool flag = false; void f25(int k = 0) { for(int i=0;i<v25.size();i++) { int a = v25[i] + k;; int b = a/5; int c = a%5; b++;c++; // t(a,b,c); if(flag) swap(b,c); cout<<b<<" "<<c<<endl; } } void f34(int k = 0) { for(int i=0;i<v34.size();i++) { int a = v34[i]+k; int b = a/4; int c = a%4; b++;c++; if(flag) swap(b,c); // t(a,b,c); cout<<b<<" "<<c<<endl; } } void f35(int k = 0) { for(int i=0;i<v35.size();i++) { int a = v35[i]+k; int b = a/5; int c = a%5; b++;c++; if(flag) swap(b,c); cout<<b<<" "<<c<<endl; } } void f44(int k = 0) { for(int i=0;i<v44.size();i++) { int a = v44[i]+k; int b = a/4; int c = a%4; b++;c++; if(flag) swap(b,c); cout<<b<<" "<<c<<endl; } } void f3(int m, int k1=0) { vector<int> ans; vector<vector<int> > v(3,vector<int>(m)); v[0][0] = 1; pair<int,int> start = mp(0,0); // ans.pu(0); int j = 3; for(int i=0;i<m;i++) { j%=m; ans.pu(i); ans.pu(j+m); ans.pu(i+2*m); j++; } for(int i=0;i<ans.size();i++) { int a = ans[i]+k1; int b = a/m; int c = a%m; b++;c++; if(flag) swap(b,c); cout<<b<<" "<<c<<endl; } } void f2(int m,int k = 0) { vector<int> ans; vector<pair<int,int> > v; int up = 0, down = up+3; while(up<m) { down%=m; // v.pu(mp(up,down)); ans.pu(up); ans.pu(down+m); up++; down++; } for(int i=0;i<ans.size();i++) { int a = ans[i]+k; int b = a/m; int c = a%m; b++;c++; if(flag) swap(b,c); cout<<b<<" "<<c<<endl; } } int main() { __; int t; cin>>t; for(int h=1;h<=t;h++) { flag = false; int n,m; cin>>n>>m; if(n>m) {swap(n,m); flag = true;} if(n==2) { if(m<=4) cout<<"Case #"<<h<<": IMPOSSIBLE"<<endl; else { cout<<"Case #"<<h<<": POSSIBLE"<<endl; f2(m,0); } } else if(n==3) { if(m<=3) cout<<"Case #"<<h<<": IMPOSSIBLE"<<endl; else { cout<<"Case #"<<h<<": POSSIBLE"<<endl; if(m==4) { f34(); } else { f3(m,0); } } } else if(n==4) { cout<<"Case #"<<h<<": POSSIBLE"<<endl; if(m==4) { f44(); } else { f2(m,0); f2(m,2*m); } } else { cout<<"Case #"<<h<<": POSSIBLE"<<endl; if(n%2==0) { for(int i=0;i<n/2;i++) { f2(m,i*2*m); } } else { n-=3; for(int i=0;i<n/2;i++) { f2(m,i*2*m); } f3(m,n*m); } } } return 0; }
iychoi/iRODS-FUSE-Mod-v3.2
lib/api/src/rcDataObjGet.c
/** * @file rcDataObjGet.c * */ /*** Copyright (c), The Regents of the University of California *** *** For more information please refer to files in the COPYRIGHT directory ***/ /* This is script-generated code. */ /* See dataObjGet.h for a description of this API call.*/ #include "dataObjGet.h" #include "rcPortalOpr.h" #include "apiHeaderAll.h" /** * \fn rcDataObjGet (rcComm_t *conn, dataObjInp_t *dataObjInp, * char *locFilePath) * * \brief Get (download) a data object from iRODS. * * \user client * * \category data object operations * * \since 1.0 * * \author <NAME> * \date 2007 * * \remark none * * \note none * * \usage * Get (download) the data object /myZone/home/john/myfile: * \n dataObjInp_t dataObjInp; * \n char locFilePath[MAX_NAME_LEN]; * \n bzero (&dataObjInp, sizeof (dataObjInp)); * \n rstrcpy (dataObjInp.objPath, "/myZone/home/john/myfile", MAX_NAME_LEN); * \n rstrcpy (locFilePath, "./mylocalfile", MAX_NAME_LEN); * \n dataObjInp.dataSize = 0; * \n status = rcDataObjGet (conn, &dataObjInp, locFilePath); * \n if (status < 0) { * \n .... handle the error * \n } * * \param[in] conn - A rcComm_t connection handle to the server. * \param[in] dataObjInp - Elements of dataObjInp_t used : * \li char \b objPath[MAX_NAME_LEN] - full path of the data object. * \li rodsLong_t \b dataSize - the size of the data object. * Input 0 if not known. * \li int \b numThreads - the number of threads to use. Valid values are: * \n NO_THREADING (-1) - no multi-thread * \n 0 - the server will decide the number of threads. * (recommanded setting). * \n A positive integer - specifies the number of threads. * \li keyValPair_t \b condInput - keyword/value pair input. Valid keywords: * \n RESC_NAME_KW - The resource of the data object to open. * \n REPL_NUM_KW - the replica number of the copy to open. * \n FORCE_FLAG_KW - overwrite existing local copy. This keyWd has no value. * \n VERIFY_CHKSUM_KW - verify the checksum value of the local file after * the download. This keyWd has no value. * \n RBUDP_TRANSFER_KW - use RBUDP for data transfer. This keyWd has no * value * \n RBUDP_SEND_RATE_KW - the number of RBUDP packet to send per second * The default is 600000. * \n RBUDP_PACK_SIZE_KW - the size of RBUDP packet. The default is 8192. * \n LOCK_TYPE_KW - set advisory lock type. valid value - WRITE_LOCK_TYPE. * \param[in] locFilePath - the path of the local file to download. This path * can be a relative path. * * \return integer * \retval 0 on success * \sideeffect none * \pre none * \post none * \sa none * \bug no known bugs **/ int rcDataObjGet (rcComm_t *conn, dataObjInp_t *dataObjInp, char *locFilePath) { int status; portalOprOut_t *portalOprOut = NULL; bytesBuf_t dataObjOutBBuf; #ifndef windows_platform struct stat statbuf; #else struct irodsntstat statbuf; #endif if (strcmp (locFilePath, STDOUT_FILE_NAME) == 0) { /* no parallel I/O if pipe to stdout */ dataObjInp->numThreads = NO_THREADING; } #ifndef windows_platform else if (stat (locFilePath, &statbuf) >= 0) #else else if(iRODSNt_stat(locFilePath, &statbuf) >= 0) #endif { /* local file exists */ if (getValByKey (&dataObjInp->condInput, FORCE_FLAG_KW) == NULL) { return (OVERWRITE_WITHOUT_FORCE_FLAG); } } status = _rcDataObjGet (conn, dataObjInp, &portalOprOut, &dataObjOutBBuf); if (status < 0) { if (portalOprOut != NULL) free (portalOprOut); return (status); } if (status == 0 || dataObjOutBBuf.len > 0) { /* data included */ /**** Removed by Raja as this can cause problems when the data sizes are different - say when post processing is done....Dec 2 2010 if (dataObjInp->dataSize > 0 && dataObjInp->dataSize != dataObjOutBBuf.len) { rodsLog (LOG_NOTICE, "putFile: totalWritten %lld dataSize %lld mismatch", dataObjOutBBuf.len, dataObjInp->dataSize); return (SYS_COPY_LEN_ERR); } ****/ status = getIncludeFile (conn, &dataObjOutBBuf, locFilePath); free (dataObjOutBBuf.buf); #ifdef RBUDP_TRANSFER } else if (getUdpPortFromPortList (&portalOprOut->portList) != 0) { int veryVerbose; /* rbudp transfer */ /* some sanity check */ if (portalOprOut->numThreads != 1) { rcOprComplete (conn, SYS_INVALID_PORTAL_OPR); free (portalOprOut); return (SYS_INVALID_PORTAL_OPR); } conn->transStat.numThreads = portalOprOut->numThreads; if (getValByKey (&dataObjInp->condInput, VERY_VERBOSE_KW) != NULL) { printf ("From server: NumThreads=%d, addr:%s, port:%d, cookie=%d\n", portalOprOut->numThreads, portalOprOut->portList.hostAddr, portalOprOut->portList.portNum, portalOprOut->portList.cookie); veryVerbose = 2; } else { veryVerbose = 0; } status = getFileToPortalRbudp (portalOprOut, locFilePath, 0, dataObjInp->dataSize, veryVerbose, 0); /* just send a complete msg */ if (status < 0) { rcOprComplete (conn, status); } else { status = rcOprComplete (conn, portalOprOut->l1descInx); } #endif /* RBUDP_TRANSFER */ } else { if (portalOprOut->numThreads <= 0) { status = getFile (conn, portalOprOut->l1descInx, locFilePath, dataObjInp->objPath, dataObjInp->dataSize); } else { if (getValByKey (&dataObjInp->condInput, VERY_VERBOSE_KW) != NULL) { printf ("From server: NumThreads=%d, addr:%s, port:%d, cookie=%d\n", portalOprOut->numThreads, portalOprOut->portList.hostAddr, portalOprOut->portList.portNum, portalOprOut->portList.cookie); } /* some sanity check */ if (portalOprOut->numThreads >= 20 * DEF_NUM_TRAN_THR) { rcOprComplete (conn, SYS_INVALID_PORTAL_OPR); free (portalOprOut); return (SYS_INVALID_PORTAL_OPR); } conn->transStat.numThreads = portalOprOut->numThreads; status = getFileFromPortal (conn, portalOprOut, locFilePath, dataObjInp->objPath, dataObjInp->dataSize); } /* just send a complete msg */ if (status < 0) { rcOprComplete (conn, status); } else { status = rcOprComplete (conn, portalOprOut->l1descInx); } } if (status >= 0 && conn->fileRestart.info.numSeg > 0) { /* file restart */ clearLfRestartFile (&conn->fileRestart); } if (getValByKey (&dataObjInp->condInput, VERIFY_CHKSUM_KW) != NULL) { if (portalOprOut == NULL || strlen (portalOprOut->chksum) == 0) { rodsLog (LOG_ERROR, "rcDataObjGet: VERIFY_CHKSUM_KW set but no chksum from server"); } else { char chksumStr[NAME_LEN]; status = chksumLocFile (locFilePath, chksumStr); if (status < 0) { rodsLogError (LOG_ERROR, status, "rcDataObjGet: chksumLocFile error for %s, status = %d", locFilePath, status); if (portalOprOut != NULL) free (portalOprOut); return (status); } if (strcmp (portalOprOut->chksum, chksumStr) != 0) { status = USER_CHKSUM_MISMATCH; rodsLogError (LOG_ERROR, status, "rcDataObjGet: chksum mismatch error for %s, status = %d", locFilePath, status); if (portalOprOut != NULL) free (portalOprOut); return (status); } } } if (portalOprOut != NULL) { free (portalOprOut); } return (status); } int _rcDataObjGet (rcComm_t *conn, dataObjInp_t *dataObjInp, portalOprOut_t **portalOprOut, bytesBuf_t *dataObjOutBBuf) { int status; *portalOprOut = NULL; memset (&conn->transStat, 0, sizeof (transStat_t)); memset (dataObjOutBBuf, 0, sizeof (bytesBuf_t)); dataObjInp->oprType = GET_OPR; #ifndef PARA_OPR addKeyVal (&dataObjInp->condInput, NO_PARA_OP_KW, ""); #endif status = procApiRequest (conn, DATA_OBJ_GET_AN, dataObjInp, NULL, (void **) portalOprOut, dataObjOutBBuf); if (*portalOprOut != NULL && (*portalOprOut)->l1descInx < 0) { status = (*portalOprOut)->l1descInx; } return (status); }
seguijoaquin/taller2
Documentacion/html/classRespuestaEliminacion.js
<gh_stars>1-10 var classRespuestaEliminacion = [ [ "RespuestaEliminacion", "classRespuestaEliminacion.html#af8db7666b04839f718f73d2c4da3f51a", null ], [ "~RespuestaEliminacion", "classRespuestaEliminacion.html#abdc07cc3ed2975723f15a0efa13d557e", null ], [ "setRespuestaEliminacionCorrecta", "classRespuestaEliminacion.html#a325283366c4fa4aeb1cf754a69c13276", null ], [ "setRespuestaEliminacionIncorrecta", "classRespuestaEliminacion.html#a50e939dbaf3e9be150319fc9a0581aa3", null ] ];
lighting-perspectives/jams
client/src/components/Dashboard.js
import React from "react" import { Container } from "semantic-ui-react" const Dashboard = () => ( <Container style={{ marginTop: "7em" }}> <h1>Dashboard</h1> </Container> ) export default Dashboard
frmdstryr/enamlx
enamlx/widgets/abstract_item_view.py
<filename>enamlx/widgets/abstract_item_view.py<gh_stars>10-100 # -*- coding: utf-8 -*- """ Copyright (c) 2015, <NAME>. Distributed under the terms of the MIT License. The full license is in the file COPYING.txt, distributed with this software. Created on Aug 23, 2015 """ from atom.api import ( ContainerList, Int, Enum, Bool, Property, ForwardInstance, observe, set_default, ) from enaml.core.declarative import d_ from enaml.widgets.control import Control, ProxyControl from .abstract_item import AbstractWidgetItemGroup class ProxyAbstractItemView(ProxyControl): #: Reference to the declaration declaration = ForwardInstance(lambda: AbstractItemView) def set_items(self, items): pass def set_selection_mode(self, mode): pass def set_selection_behavior(self, behavior): pass def set_selection(self, items): pass def set_scroll_to_bottom(self, scroll_to_bottom): pass def set_alternating_row_colors(self, alternate): pass def set_cell_padding(self, padding): pass def set_auto_resize(self, enabled): pass def set_resize_mode(self, mode): pass def set_word_wrap(self, enabled): pass def set_show_vertical_header(self, visible): pass def set_vertical_headers(self, headers): pass def set_vertical_stretch(self, stretch): pass def set_vertical_minimum_section_size(self, size): pass def set_show_horizontal_header(self, visible): pass def set_horizontal_headers(self, headers): pass def set_horizontal_stretch(self, stretch): pass def set_horizontal_minimum_section_size(self, size): pass def set_sortable(self, sortable): pass def set_visible_row(self, row): pass def set_visible_column(self, column): pass class AbstractItemView(Control): #: Table should expand by default hug_width = set_default("ignore") #: Table should expand by default hug_height = set_default("ignore") #: The items to display in the view items = d_(ContainerList(default=[])) #: Selection mode of the view selection_mode = d_(Enum("extended", "none", "multi", "single", "contiguous")) #: Selection behavior of the view selection_behavior = d_(Enum("items", "rows", "columns")) #: Selection selection = d_(ContainerList(default=[])) #: Automatically scroll to bottm when new items are added scroll_to_bottom = d_(Bool(False)) #: Set alternating row colors alternating_row_colors = d_(Bool(False)) #: Cell padding cell_padding = d_(Int(0)) #: Automatically resize columns to fit contents auto_resize = d_(Bool(True)) #: Resize mode of columns and rows resize_mode = d_( Enum("interactive", "fixed", "stretch", "resize_to_contents", "custom") ) #: Word wrap word_wrap = d_(Bool(False)) #: Show vertical header bar show_vertical_header = d_(Bool(True)) #: Row headers vertical_headers = d_(ContainerList()) #: Stretch last row vertical_stretch = d_(Bool(False)) #: Minimum row size vertical_minimum_section_size = d_(Int(0)) #: Show horizontal hearder bar show_horizontal_header = d_(Bool(True)) #: Column headers horizontal_headers = d_(ContainerList()) #: Stretch last column horizontal_stretch = d_(Bool(False)) #: Minimum column size horizontal_minimum_section_size = d_(Int(0)) #: Table is sortable sortable = d_(Bool(True)) #: Current row index current_row = d_(Int(0)) #: Current column index current_column = d_(Int(0)) #: First visible row visible_row = d_(Int(0)) #: Number of rows visible visible_rows = d_(Int(100)) #: First visible column visible_column = d_(Int(0)) #: Number of columns visible visible_columns = d_(Int(1)) def _get_items(self): return [c for c in self.children if isinstance(c, AbstractWidgetItemGroup)] #: Cached property listing the row or columns of the table _items = Property(_get_items, cached=True) @observe( "items", "scroll_to_bottom", "alternating_row_colors", "selection_mode", "selection_behavior", "selection", "cell_padding", "auto_resize", "resize_mode", "word_wrap", "show_horizontal_header", "horizontal_headers", "horizontal_stretch", "show_vertical_header", "vertical_header", "vertical_stretch", "visible_row", "visible_column", ) def _update_proxy(self, change): """An observer which sends state change to the proxy.""" # The superclass handler implementation is sufficient. super(AbstractItemView, self)._update_proxy(change) def child_added(self, child): """Reset the item cache when a child is added""" super(AbstractItemView, self).child_added(child) self.get_member("_items").reset(self) def child_removed(self, child): """Reset the item cache when a child is removed""" super(AbstractItemView, self).child_removed(child) self.get_member("_items").reset(self)
lhartung/paradrop-test
paradrop/daemon/paradrop/backend/paradrop_log_ws.py
<filename>paradrop/daemon/paradrop/backend/paradrop_log_ws.py from autobahn.twisted.websocket import WebSocketServerProtocol from autobahn.twisted.websocket import WebSocketServerFactory import smokesignal from paradrop.base.output import out class ParadropLogWsProtocol(WebSocketServerProtocol): def __init__(self, factory): WebSocketServerProtocol.__init__(self) self.factory = factory def onOpen(self): out.info('ws /paradrop_logs connected') self.factory.addParadropLogObserver(self) def onParadropLog(self, logDict): self.sendMessage(logDict['message']) def onClose(self, wasClean, code, reason): out.info('ws /paradrop_logs disconnected: {}'.format(reason)) self.factory.removeParadropLogObserver(self) class ParadropLogWsFactory(WebSocketServerFactory): def __init__(self, *args, **kwargs): WebSocketServerFactory.__init__(self, *args, **kwargs) self.observers = [] def buildProtocol(self, addr): return ParadropLogWsProtocol(self) def addParadropLogObserver(self, observer): if (self.observers.count(observer) == 0): self.observers.append(observer) if len(self.observers) == 1: smokesignal.on('logs', self.onParadropLog) def removeParadropLogObserver(self, observer): if (self.observers.count(observer) == 1): self.observers.remove(observer) if len(self.observers) == 0: smokesignal.disconnect(self.onParadropLog) def onParadropLog(self, logDict): for observer in self.observers: observer.onParadropLog(logDict)
anh-honcharuk/Metaprogramming
mod_1/q/2.py
def sum_dec(func): def wrapper(*args): wrapper.money += args[1] return func(*args) wrapper.money = 0 return wrapper class Wallet: def __init__(self, money=float()): self._money = money @property def money(self): return self._money @money.setter @sum_dec def money(self, money=float()): if type(money) == float: self._money += money
kylerichardson/metron
metron-interface/metron-rest/src/test/java/org/apache/metron/rest/mock/MockPcapToPdmlScriptWrapper.java
/* * 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 org.apache.metron.rest.mock; import org.adrianwalker.multilinestring.Multiline; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.metron.rest.service.impl.PcapToPdmlScriptWrapper; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; public class MockPcapToPdmlScriptWrapper extends PcapToPdmlScriptWrapper { /** *<?xml version="1.0" encoding="utf-8"?> *<?xml-stylesheet type="text/xsl" href="pdml2html.xsl"?> *<pdml version="0" creator="wireshark/2.6.1" time="Thu Jun 28 14:14:38 2018" capture_file="/tmp/pcap-data-201806272004-289365c53112438ca55ea047e13a12a5+0001.pcap"> *<packet> *<proto name="geninfo" pos="0" showname="General information" size="722" hide="no"> *<field name="num" pos="0" show="1" showname="Number" value="1" size="722"/> *</proto> *<proto name="ip" showname="Internet Protocol Version 4, Src: 192.168.66.1, Dst: 192.168.66.121" size="20" pos="14" hide="yes"> *<field name="ip.addr" showname="Source or Destination Address: 192.168.66.121" hide="yes" size="4" pos="30" show="192.168.66.121" value="c0a84279"/> *<field name="ip.flags" showname="Flags: 0x4000, Don&#x27;t fragment" size="2" pos="20" show="0x00004000" value="4000"> *<field name="ip.flags.mf" showname="..0. .... .... .... = More fragments: Not set" size="2" pos="20" show="0" value="0" unmaskedvalue="4000"/> *</field> *</proto> *</packet> *</pdml> */ @Multiline private String pdmlXml; @Override public InputStream execute(String scriptPath, FileSystem fileSystem, Path pcapPath) throws IOException { return new ByteArrayInputStream(pdmlXml.getBytes()); } }
PascalJedi/teamsnap-SDK-iOS
TeamSnapSDK/SDK/DataTypes/TSDKDivision.h
<filename>TeamSnapSDK/SDK/DataTypes/TSDKDivision.h<gh_stars>1-10 // Copyright (c) 2015 TeamSnap. All rights reserved. // #import <Foundation/Foundation.h> #import "TSDKCollectionObject.h" #import "TSDKObjectsRequest.h" @interface TSDKDivision : TSDKCollectionObject @property (nonatomic, strong) NSString *_Nullable sportId; //Example: 7 @property (nonatomic, strong) NSString *_Nullable leagueUrl; //Example: @property (nonatomic, assign) BOOL isArchived; //Example: <null> @property (nonatomic, strong) NSString *_Nullable postalCode; //Example: 75233 @property (nonatomic, strong) NSString *_Nullable timeZoneOffset; //Example: -06:00 @property (nonatomic, strong) NSString *_Nullable country; //Example: United States @property (nonatomic, strong) NSDate *_Nullable updatedAt; //Example: 2016-08-12T21:38:13Z @property (nonatomic, assign) NSInteger leftBoundary; //Example: 1 @property (nonatomic, assign) NSInteger rightBoundary; //Example: 6 @property (nonatomic, strong) NSString *_Nullable parentId; //Example: <null> @property (nonatomic, assign) BOOL isDeletable; //Example: 0 @property (nonatomic, strong) NSString *_Nullable rootId; //Example: 60360 @property (nonatomic, strong) NSString *_Nullable timeZoneIanaName; //Example: America/Chicago @property (nonatomic, assign) BOOL isDisabled; //Example: 0 @property (nonatomic, strong) NSString *_Nullable name; //Example: Test League @property (nonatomic, strong) NSString *_Nullable planId; //Example: 33 @property (nonatomic, strong) NSString *_Nullable leagueName; //Example: **NULL** @property (nonatomic, strong) NSString *_Nullable timeZoneDescription; //Example: Central Time (US & Canada) @property (nonatomic, strong) NSString *_Nullable seasonName; //Example: @property (nonatomic, strong) NSString *_Nullable locationCountry; //Example: United States @property (nonatomic, strong) NSString *_Nullable timeZone; //Example: Central Time (US & Canada) @property (nonatomic, assign) BOOL isAncestorArchived; //Example: 0 @property (nonatomic, strong) NSDate *_Nullable createdAt; //Example: 2016-01-05T22:59:32Z @property (nonatomic, strong) NSString *_Nullable parentDivisionName; //Example: @property (nonatomic, strong) NSString *_Nullable billingAddress; //Example: @property (nonatomic, assign) NSInteger allTeamsCount; //Example: 17 @property (nonatomic, assign) NSInteger activeTeamsCount; //Example: 17 @property (nonatomic, assign) NSInteger allChildrenCount; //Example: 2 @property (nonatomic, assign) NSInteger activeChildrenCount; //Example: 2 @property (nonatomic, assign) NSInteger activeDescendantsCount; //Example: 0 @property (nonatomic, strong) NSURL *_Nullable linkParent; @property (nonatomic, strong) NSURL *_Nullable linkChildren; @property (nonatomic, strong) NSURL *_Nullable linkActiveChildren; @property (nonatomic, strong) NSURL *_Nullable linkAncestors; @property (nonatomic, strong) NSURL *_Nullable linkDescendants; @property (nonatomic, strong) NSURL *_Nullable linkRegistrationForms; @property (nonatomic, strong) NSURL *_Nullable linkPlan; @property (nonatomic, strong) NSURL *_Nullable linkTeams; @property (nonatomic, strong) NSURL *_Nullable linkActiveTeams; @property (nonatomic, strong) NSURL *_Nullable linkDivisionEvents; @property (nonatomic, strong) NSURL *_Nullable linkDivisionPreferences; @property (nonatomic, strong) NSURL *_Nullable linkDivisionLogoPhotoFile; - (NSURL * _Nullable)divisionLogoURLForWidth:(NSInteger)width height:(NSInteger)height; // not autogenerated //Create root divisions, this is an internal command only accessible to internal TeamSnap services. //+(void)actionCreateRootPostalcode:(NSString *_Nonnull)postalCode country:(NSString *_Nonnull)country timeZone:(NSString *_Nonnull)timeZone name:(NSString *_Nonnull)name teamsInPlan:(NSString *_Nonnull)teamsInPlan sportId:(NSString *_Nonnull)sportId WithCompletion:(TSDKCompletionBlock _Nullable)completion; //Update the root division plan. This is an internal command only accessible to internal TeamSnap services. //+(void)actionUpdatePlanPlanid:(NSString *_Nonnull)planId divisionId:(NSString *_Nonnull)divisionId WithCompletion:(TSDKCompletionBlock _Nullable)completion; //Finds all active trial divisions for a given user. Excludes archived and disabled divisions. //+(void)queryActiveTrialsUserid:(NSString *_Nonnull)userId WithCompletion:(TSDKCompletionBlock _Nullable)completion; //+(void)querySearchIsroot:(NSString *_Nonnull)isRoot pageNumber:(NSString *_Nonnull)pageNumber id:(NSString *_Nonnull)id isTrial:(NSString *_Nonnull)isTrial parentId:(NSString *_Nonnull)parentId userId:(NSString *_Nonnull)userId pageSize:(NSString *_Nonnull)pageSize WithCompletion:(TSDKCompletionBlock _Nullable)completion; //Beta: (This endpoint subject to change) Returns all the nested set descendants of the given division. //+(void)queryDescendantsId:(NSString *_Nonnull)id WithCompletion:(TSDKCompletionBlock _Nullable)completion; //Beta: (This endpoint subject to change) Returns all the nested set ancestors of the given division. //+(void)queryAncestorsId:(NSString *_Nonnull)id WithCompletion:(TSDKCompletionBlock _Nullable)completion; //Beta: (This endpoint subject to change) Returns all the nested set children of the given division. //+(void)queryChildrenId:(NSString *_Nonnull)id WithCompletion:(TSDKCompletionBlock _Nullable)completion; //Beta: (This endpoint subject to change) Returns all the nested set leaves of the given division. A leaf is a division that has no child divisions. //+(void)queryLeavesId:(NSString *_Nonnull)id WithCompletion:(TSDKCompletionBlock _Nullable)completion; @end @interface TSDKDivision (ForwardedMethods) -(void)getParentWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKArrayCompletionBlock _Nonnull)completion; -(void)getChildrenWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKArrayCompletionBlock _Nonnull)completion; -(void)getAncestorsWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKArrayCompletionBlock _Nonnull)completion; -(void)getDescendantsWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKArrayCompletionBlock _Nonnull)completion; -(void)getRegistrationFormsWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKArrayCompletionBlock _Nonnull)completion; -(void)getPlanWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKPlanArrayCompletionBlock _Nonnull)completion; -(void)getTeamsWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKTeamArrayCompletionBlock _Nonnull)completion; -(void)getDivisionEventsWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKArrayCompletionBlock _Nonnull)completion; -(void)getDivisionPreferencesWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKArrayCompletionBlock _Nonnull)completion; -(void)getDivisionLogoPhotoFileWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKArrayCompletionBlock _Nonnull)completion; -(void)getActiveChildrenWithConfiguration:(TSDKRequestConfiguration *_Nullable)configuration completion:(TSDKArrayCompletionBlock _Nonnull)completion; @end
timmyusa/tennis-crystal-ball
tennis-stats/src/main/java/org/strangeforest/tcb/stats/model/SurfaceTimelineItem.java
package org.strangeforest.tcb.stats.model; import static java.lang.Math.*; import static java.lang.String.*; import static org.strangeforest.tcb.stats.util.PercentageUtil.*; public class SurfaceTimelineItem { private final int season; private double hardPct; private double clayPct; private double grassPct; private double carpetPct; private double hardOutdoorPct; private double hardIndoorPct; private double clayOutdoorPct; private double clayIndoorPct; private final int speed; public SurfaceTimelineItem(int season, int matchCount, int hardMatchCount, int clayMatchCount, int grassMatchCount, int carpetMatchCount, int speed) { this.season = season; hardPct = roundedPct(hardMatchCount, matchCount); clayPct = roundedPct(clayMatchCount, matchCount); grassPct = roundedPct(grassMatchCount, matchCount); carpetPct = roundedPct(carpetMatchCount, matchCount); if (hardPct + clayPct + grassPct + carpetPct > 100.0) { if (carpetPct > 0.0) carpetPct = 100.0 - hardPct - clayPct - grassPct; else if (grassPct > 0.0) grassPct = 100.0 - hardPct - clayPct; else if (clayPct > 0.0) clayPct = 100.0 - hardPct; else hardPct = 100.0; } this.speed = speed; } public SurfaceTimelineItem(int season, int matchCount, int hardMatchCount, int clayMatchCount, int grassMatchCount, int carpetMatchCount, int hardIndoorMatchCount, int clayIndoorMatchCount, int speed) { this(season, matchCount, hardMatchCount, clayMatchCount, grassMatchCount, carpetMatchCount, speed); hardOutdoorPct = roundedPct(hardMatchCount - hardIndoorMatchCount, matchCount); hardIndoorPct = hardPct - hardOutdoorPct; clayOutdoorPct = roundedPct(clayMatchCount - clayIndoorMatchCount, matchCount); clayIndoorPct = clayPct - clayOutdoorPct; } public int getSeason() { return season; } public String getHardPct() { return formatPct(hardPct); } public String getClayPct() { return formatPct(clayPct); } public String getGrassPct() { return formatPct(grassPct); } public String getCarpetPct() { return formatPct(carpetPct); } public String getHardOutdoorPct() { return formatPct(hardOutdoorPct); } public String getHardIndoorPct() { return formatPct(hardIndoorPct); } public String getClayOutdoorPct() { return formatPct(clayOutdoorPct); } public String getClayIndoorPct() { return formatPct(clayIndoorPct); } private static double roundedPct(int value, int from) { return round(pct(value, from) * 10.0) / 10.0; } private static String formatPct(double pct) { return format("%1$.1f%%", pct); } public int getSpeed() { return speed; } }
drkalpana/memcode
backend/api/AuthApi/test/nock/github.js
<reponame>drkalpana/memcode import nock from 'nock'; nock('https://github.com') .post('/login/oauth/access_token') .reply(200, { access_token: <PASSWORD> }); nock('https://api.github.com') .get('/user') .reply(200, { login: "octocat", id: 1, avatar_url: "https://github.com/images/error/octocat_happy.gif", gravatar_id: "", url: "https://api.github.com/users/octocat", html_url: "https://github.com/octocat", followers_url: "https://api.github.com/users/octocat/followers", following_url: "https://api.github.com/users/octocat/following{/other_user}", gists_url: "https://api.github.com/users/octocat/gists{/gist_id}", starred_url: "https://api.github.com/users/octocat/starred{/owner}{/repo}", subscriptions_url: "https://api.github.com/users/octocat/subscriptions", organizations_url: "https://api.github.com/users/octocat/orgs", repos_url: "https://api.github.com/users/octocat/repos", events_url: "https://api.github.com/users/octocat/events{/privacy}", received_events_url: "https://api.github.com/users/octocat/received_events", type: "User", site_admin: false, name: "<NAME>", company: "GitHub", blog: "https://github.com/blog", location: "San Francisco", email: "<EMAIL>", hireable: false, bio: "There once was...", public_repos: 2, public_gists: 1, followers: 20, following: 0, created_at: "2008-01-14T04:33:35Z", updated_at: "2008-01-14T04:33:35Z", total_private_repos: 100, owned_private_repos: 100, private_gists: 81, disk_usage: 10000, collaborators: 8, two_factor_authentication: true, plan: { name: "Medium", space: 400, private_repos: 20, collaborators: 0 } });
lcscim/python-demo
Machine-Learning-master/SVM/svm-svc.py
<gh_stars>0 # -*- coding: UTF-8 -*- import numpy as np import operator from os import listdir from sklearn.svm import SVC """ Author: <NAME> Blog: http://blog.csdn.net/c406495762 Zhihu: https://www.zhihu.com/people/Jack--Cui/ Modify: 2017-10-04 """ def img2vector(filename): """ 将32x32的二进制图像转换为1x1024向量。 Parameters: filename - 文件名 Returns: returnVect - 返回的二进制图像的1x1024向量 """ #创建1x1024零向量 returnVect = np.zeros((1, 1024)) #打开文件 fr = open(filename) #按行读取 for i in range(32): #读一行数据 lineStr = fr.readline() #每一行的前32个元素依次添加到returnVect中 for j in range(32): returnVect[0, 32*i+j] = int(lineStr[j]) #返回转换后的1x1024向量 return returnVect def handwritingClassTest(): """ 手写数字分类测试 Parameters: 无 Returns: 无 """ #测试集的Labels hwLabels = [] #返回trainingDigits目录下的文件名 trainingFileList = listdir('trainingDigits') #返回文件夹下文件的个数 m = len(trainingFileList) #初始化训练的Mat矩阵,测试集 trainingMat = np.zeros((m, 1024)) #从文件名中解析出训练集的类别 for i in range(m): #获得文件的名字 fileNameStr = trainingFileList[i] #获得分类的数字 classNumber = int(fileNameStr.split('_')[0]) #将获得的类别添加到hwLabels中 hwLabels.append(classNumber) #将每一个文件的1x1024数据存储到trainingMat矩阵中 trainingMat[i,:] = img2vector('trainingDigits/%s' % (fileNameStr)) clf = SVC(C=200,kernel='rbf') clf.fit(trainingMat,hwLabels) #返回testDigits目录下的文件列表 testFileList = listdir('testDigits') #错误检测计数 errorCount = 0.0 #测试数据的数量 mTest = len(testFileList) #从文件中解析出测试集的类别并进行分类测试 for i in range(mTest): #获得文件的名字 fileNameStr = testFileList[i] #获得分类的数字 classNumber = int(fileNameStr.split('_')[0]) #获得测试集的1x1024向量,用于训练 vectorUnderTest = img2vector('testDigits/%s' % (fileNameStr)) #获得预测结果 # classifierResult = classify0(vectorUnderTest, trainingMat, hwLabels, 3) classifierResult = clf.predict(vectorUnderTest) print("分类返回结果为%d\t真实结果为%d" % (classifierResult, classNumber)) if(classifierResult != classNumber): errorCount += 1.0 print("总共错了%d个数据\n错误率为%f%%" % (errorCount, errorCount/mTest * 100)) if __name__ == '__main__': handwritingClassTest()
broquaint/reindeer
spec/reindeer/construction_spec.rb
<reponame>broquaint/reindeer<filename>spec/reindeer/construction_spec.rb require 'reindeer' describe 'Reindeer construction' do it 'should call all build methods' do class FifteenthOne < Reindeer def build(args) things << :super end end class SixteenthOne < FifteenthOne has :things, default: [] def build(args) things << :neat end end obj = SixteenthOne.new expect(obj.things).to eq([:super, :neat]) end end
Joaopaulojhon31/mostra
Diretor.java
<gh_stars>0 package model; import java.util.Date; public class Diretor { private int masp_diretor; private String nome_diretor; private int telefone_diretor; private String Depto_diretor; private String Email_diretor; private Utramig utramig; private Date Data_alt_cadas_direttor; private Utramig cnpj; private int status; public int getStatus() { return status; } public int setStatus(int status) { return this.status = status; } public Date getData_alt_cadas_direttor() { return Data_alt_cadas_direttor; } public void setData_alt_cadas_direttor(Date data_alt_cadas_direttor) { Data_alt_cadas_direttor = data_alt_cadas_direttor; } public Utramig getCnpj() { return cnpj; } public void setCnpj(Utramig cnpj) { this.cnpj = cnpj; } public int getMasp_diretor() { return masp_diretor; } public void setMasp_diretor(int masp_diretor) { this.masp_diretor = masp_diretor; } public String getNome_diretor() { return nome_diretor; } public void setNome_diretor(String nome_diretor) { this.nome_diretor = nome_diretor; } public int getTelefone_diretor() { return telefone_diretor; } public void setTelefone_diretor(int telefone_diretor) { this.telefone_diretor = telefone_diretor; } public String getDepto_diretor() { return Depto_diretor; } public void setDepto_diretor(String depto_diretor) { Depto_diretor = depto_diretor; } public String getEmail_diretor() { return Email_diretor; } public void setEmail_diretor(String email_diretor) { Email_diretor = email_diretor; } public Utramig getUtramig() { return utramig; } public void setUtramig(Utramig utramig) { this.utramig = utramig; } public Date getDataAltCadas() { return Data_alt_cadas_direttor; } public Date setDataAltCadas(Date dataAltCadas) { return this.Data_alt_cadas_direttor = dataAltCadas; } }
spencercjh/codeLife
exam/src/exam/liulishuo2019/Test1.java
package exam.liulishuo2019; import java.util.ArrayList; import java.util.List; import java.util.Scanner; /** * @author : SpencerCJH * @date : 2019/9/11 21:25 */ public class Test1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), aAmount = in.nextInt(), bAmount = in.nextInt(); List<Node> goods = new ArrayList<>(n); for (int i = 0; i < n; i++) { Node temp = new Node(in.nextInt(), in.nextInt()); goods.add(temp); } boolean aMore = false, bMore = false; if (bAmount > aAmount) { goods.sort((o1, o2) -> myCompare(o2.bCost, o1.bCost)); bMore = true; } else { goods.sort((o1, o2) -> myCompare(o2.aCost, o1.aCost)); aMore = true; } // goods.forEach(good -> System.out.println(good.aCost + "\t" + good.bCost)); int sum = 0; for (int i = 0; i < goods.size(); i++) { if (aMore && i < aAmount) { sum += goods.get(i).aCost; } else if (bMore && i < bAmount) { sum += goods.get(i).bCost; } else if (aMore) { sum += goods.get(i).bCost; } else if (bMore) { sum += goods.get(i).aCost; } } System.out.println(sum); } private static int myCompare(int x, int y) { return Integer.compare(y, x); } static class Node { int aCost; int bCost; Node(int aCost, int bCost) { this.aCost = aCost; this.bCost = bCost; } } }
Peerapat132/gitlabhq
spec/helpers/users_helper_spec.rb
require 'rails_helper' describe UsersHelper do include TermsHelper let(:user) { create(:user) } describe '#user_link' do subject { helper.user_link(user) } it "links to the user's profile" do is_expected.to include("href=\"#{user_path(user)}\"") end it "has the user's email as title" do is_expected.to include("title=\"#{user.email}\"") end end describe '#profile_tabs' do subject(:tabs) { helper.profile_tabs } before do allow(helper).to receive(:current_user).and_return(user) allow(helper).to receive(:can?).and_return(true) end context 'with public profile' do it 'includes all the expected tabs' do expect(tabs).to include(:activity, :groups, :contributed, :projects, :snippets) end end context 'with private profile' do before do allow(helper).to receive(:can?).with(user, :read_user_profile, nil).and_return(false) end it 'is empty' do expect(tabs).to be_empty end end end describe '#user_internal_regex_data' do using RSpec::Parameterized::TableSyntax where(:user_default_external, :user_default_internal_regex, :result) do false | nil | { user_internal_regex_pattern: nil, user_internal_regex_options: nil } false | '' | { user_internal_regex_pattern: nil, user_internal_regex_options: nil } false | 'mockRegexPattern' | { user_internal_regex_pattern: nil, user_internal_regex_options: nil } true | nil | { user_internal_regex_pattern: nil, user_internal_regex_options: nil } true | '' | { user_internal_regex_pattern: nil, user_internal_regex_options: nil } true | 'mockRegexPattern' | { user_internal_regex_pattern: 'mockRegexPattern', user_internal_regex_options: 'gi' } end with_them do before do stub_application_setting(user_default_external: user_default_external) stub_application_setting(user_default_internal_regex: user_default_internal_regex) end subject { helper.user_internal_regex_data } it { is_expected.to eq(result) } end end describe '#current_user_menu_items' do subject(:items) { helper.current_user_menu_items } before do allow(helper).to receive(:current_user).and_return(user) allow(helper).to receive(:can?).and_return(false) end it 'includes all default items' do expect(items).to include(:help, :sign_out) end it 'includes the profile tab if the user can read themself' do expect(helper).to receive(:can?).with(user, :read_user, user) { true } expect(items).to include(:profile) end it 'includes the settings tab if the user can update themself' do expect(helper).to receive(:can?).with(user, :read_user, user) { true } expect(items).to include(:profile) end context 'when terms are enforced' do before do enforce_terms end it 'hides the profile and the settings tab' do expect(items).not_to include(:settings, :profile, :help) end end end end
minuk8932/Algorithm_BaekJoon
src/brute_force/Boj3085.java
package brute_force; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; /** * * @author minchoba * 백준 3085번: 사탕 게임 * * @see https://www.acmicpc.net/problem/3085/ * */ public class Boj3085 { private static ArrayList<Pair> set = new ArrayList<>(); private static final int[][] DIRECTIONS = {{0, 1}, {1, 0}}; private static final int ROW = 0, COL = 1; private static boolean[][] isVisited; private static char[][] fix; private static class Point{ int row, col; public Point(int row, int col) { this.row = row; this.col = col; } } private static class Pair{ Point p1, p2; public Pair(Point p1, Point p2) { this.p1 = p1; this.p2 = p2; } } public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); char[][] candy = new char[N][N]; fix = new char[N][N]; for(int i = 0; i < N; i++) { String line = br.readLine(); for(int j = 0; j < N; j++) { candy[i][j] = line.charAt(j); fix[i][j] = candy[i][j]; } } init(N, candy); // 인접 배열끼리 리스트에 저장 System.out.println(getMax(N, candy)); } private static void init(int n, char[][] arr) { for(int row = 0; row < n; row++) { for(int col = 0; col < n; col++) { for(final int[] DIRECTION: DIRECTIONS) { int nextRow = row + DIRECTION[ROW]; int nextCol = col + DIRECTION[COL]; if(nextRow >= n || nextCol >= n || arr[row][col] == arr[nextRow][nextCol]) continue; set.add(new Pair(new Point(row, col), new Point(nextRow, nextCol))); } } } } private static int getMax(int n, char[][] arr) { int max = 0; for(Pair p: set) { int value = process(n, arr, p); if(value > max) max = value; // 최대 사탕 갯수 } return max; } private static int process(int n, char[][] arr, Pair p) { isVisited = new boolean[n][n]; int max = 0; Point p1 = p.p1; Point p2 = p.p2; char tmp = arr[p1.row][p1.col]; // 사탕 위치 바꾸기 arr[p1.row][p1.col] = arr[p2.row][p2.col]; arr[p2.row][p2.col] = tmp; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(isVisited[i][j]) continue; isVisited[i][j] = true; int cost = search(n, arr, new Point(i, j), true); // 행을 기준으로 같은 사탕의 갯수 if(cost > max) max = cost; cost = search(n, arr, new Point(i, j), false); // 열을 기준으로 같은 사탕의 갯수 if(cost > max) max = cost; } } for(int i = 0; i < n; i++) { // 탐색 완료 후 배열 초기화 for(int j = 0; j < n; j++) { arr[i][j] = fix[i][j]; } } return max; } private static int search(int n, char[][] arr, Point current, boolean d) { Point move = new Point(d ? current.row + 1 : current.row, d ? current.col: current.col + 1); int count = 1; while(move.row < n && move.col < n && arr[move.row][move.col] == arr[current.row][current.col]) { isVisited[move.row][move.col] = true; count++; if(d) move.row++; else move.col++; } move = new Point(d ? current.row - 1 : current.row, d ? current.col: current.col - 1); while(move.row >= 0 && move.col >= 0 && arr[move.row][move.col] == arr[current.row][current.col]) { isVisited[move.row][move.col] = true; count++; if(d) move.row--; else move.col--; } return count; } }
michaelbnd/react-native-ionicons-5
src/Icons/paper-plane.js
import * as React from "react"; import Svg, { Path } from "react-native-svg"; function SvgPaperPlane(props) { return <Svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512" {...props}><Path d="M473 39.05a24 24 0 00-25.5-5.46L47.47 185h-.08a24 24 0 001 45.16l.41.13 137.3 58.63a16 16 0 0015.54-3.59L422 80a7.07 7.07 0 0110 10L226.66 310.26a16 16 0 00-3.59 15.54l58.65 137.38c.06.2.12.38.19.57 3.2 9.27 11.3 15.81 21.09 16.25h1a24.63 24.63 0 0023-15.46L478.39 64.62A24 24 0 00473 39.05z" /></Svg>; } export default SvgPaperPlane;
consulo/incubating-consulo-ruby
testSrc/org/jetbrains/plugins/ruby/ruby/resolve/data/localvars/localvar_multiassign.rb
<gh_stars>0 # Test when local variable is in multiassignment aaa,bbb,ccc = "Hello", "Beatiful", "World" a#caret#aa
FanchenBao/Rokku
src/raspberry_pi_ui/tests/test_button.py
import json from time import sleep def empty_queues(out_msg_q, in_msg_q): """ Utility function for these tests to make sure message queues are empty before test begins """ while not out_msg_q.empty(): out_msg_q.get() while not in_msg_q.empty(): in_msg_q.get() def test_button_publish(mqtt_out, button): """Test message sent from in to out.""" out_pub, out_msg_q, out_listen_proc = mqtt_out empty_queues(out_msg_q, button.msg_q) button.pub.publish(json.dumps(["test_4", True])) while out_msg_q.empty(): sleep(1) out_received_msg = out_msg_q.get() out_received_list = json.loads(out_received_msg) assert out_received_list[0] == "test_4" and out_received_list[1] def test_button_set_color(button): """Test button base class's set_color method""" button.set_color("pink") assert button._color == "pink" def test_button_get_color(button): """Test button base class's get_color method""" button._color = "pink" assert button.get_color() == "pink" def test_button_set_get_label(button): """Test button base class's set_label and ge_label methods""" button.set_label("testing") assert button.get_label() == "testing"
ikus060/jface
src/test/java/com/patrikdufresne/ui/ActionComboExampleViewPart.java
<reponame>ikus060/jface /** * Copyright(C) 2013 <NAME> Service Logiciel <<EMAIL>> * * 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.patrikdufresne.ui; import java.util.Arrays; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import com.patrikdufresne.jface.action.ActionCombo; import com.patrikdufresne.jface.databinding.util.JFaceProperties; public class ActionComboExampleViewPart extends AbstractViewPart { private ActionCombo actionDropDown; ActionComboExampleViewPart(String id) { super(id); setTitle("My Title"); setTitleToolTip("My Tooltip text"); this.setTitleImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO)); } Label label; @Override public void activate(Composite parent) { label = new Label(parent, SWT.BORDER); label.setText("item1"); label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); IToolBarManager toolbar = getSite().getToolBarManager(); this.actionDropDown = new ActionCombo(); this.actionDropDown.setDefaultMessage("Select an item"); ActionContributionItem aci = new ActionContributionItem(this.actionDropDown); aci.setMode(ActionContributionItem.MODE_FORCE_TEXT); toolbar.add(aci); bind(); } @Override protected void bindValues() { super.bindValues(); WritableList input = new WritableList(Arrays.asList("item1", "item2", "item3", "item4"), String.class); // Bind items. getDbc().bindList(JFaceProperties.list(ActionCombo.class, ActionCombo.ITEMS, ActionCombo.ITEMS).observe(this.actionDropDown), input); // Bind the selection getDbc().bindValue( JFaceProperties.value(ActionCombo.class, ActionCombo.SELECTION, ActionCombo.SELECTION).observe(this.actionDropDown), WidgetProperties.text().observe(label)); } }
Tavi3h/LeetCode
src/pers/tavish/solution/medium/CombinationSum.java
<gh_stars>1-10 package pers.tavish.solution.medium; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.junit.Test; /* Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target. The same repeated number may be chosen from candidates unlimited number of times. Note: - All numbers (including target) will be positive integers. - The solution set must not contain duplicate combinations. Example 1: Input: candidates = [2,3,6,7], target = 7, A solution set is: [ [7], [2,2,3] ] Example 2: Input: candidates = [2,3,5], target = 8, A solution set is: [ [2,2,2,2], [2,3,3], [3,5] ] for more information: https://leetcode.com/problems/combination-sum/description/ */ public class CombinationSum { // backtracking public List<List<Integer>> combinationSum(int[] candidates, int target) { List<List<Integer>> ans = new ArrayList<>(); List<Integer> tmp = new ArrayList<>(); if (candidates == null || candidates.length == 0) { return ans; } Arrays.sort(candidates); combinationSum(candidates, target, 0, tmp, ans); return ans; } private boolean combinationSum(int[] candidates, int target, int start, List<Integer> tmp, List<List<Integer>> ans) { if (target < 0) { return false; } if (target == 0) { ans.add(new ArrayList<>(tmp)); return false; } for (int i = start; i < candidates.length; i++) { tmp.add(candidates[i]); int newtarget = target - candidates[i]; boolean flag = combinationSum(candidates, newtarget, i, tmp, ans); tmp.remove(tmp.size() - 1); if (!flag) { break; } } return true; } @Test public void testCase() { int[] candidates = { 2, 3, 6, 7 }; int target = 7; combinationSum(candidates, target); } }
sshardool/presto-1
presto-main/src/test/java/io/prestosql/execution/warnings/TestTestingWarningCollector.java
<filename>presto-main/src/test/java/io/prestosql/execution/warnings/TestTestingWarningCollector.java<gh_stars>100-1000 /* * 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 io.prestosql.execution.warnings; import com.google.common.collect.ImmutableList; import io.prestosql.spi.PrestoWarning; import io.prestosql.testing.TestingWarningCollector; import io.prestosql.testing.TestingWarningCollectorConfig; import org.testng.annotations.Test; import static io.prestosql.testing.TestingWarningCollector.createTestWarning; import static org.testng.Assert.assertEquals; public class TestTestingWarningCollector { @Test public void testAddWarnings() { TestingWarningCollector collector = new TestingWarningCollector(new WarningCollectorConfig(), new TestingWarningCollectorConfig().setAddWarnings(true)); ImmutableList.Builder<PrestoWarning> expectedWarningsBuilder = ImmutableList.builder(); expectedWarningsBuilder.add(createTestWarning(1)); assertEquals(collector.getWarnings(), expectedWarningsBuilder.build()); } }
YourFavFlurry/Warbs-Salhack
src/main/java/me/ionar/salhack/gui/SalGuiScreen.java
<reponame>YourFavFlurry/Warbs-Salhack package me.ionar.salhack.gui; import java.io.IOException; import org.lwjgl.input.Keyboard; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; public class SalGuiScreen extends GuiScreen { // private NoSlowModule NoSlow = null; private boolean InventoryMoveEnabled() { /*if (NoSlow == null) NoSlow = (NoSlowModule)SalHack.INSTANCE.getModuleManager().find(NoSlowModule.class); return NoSlow != null && NoSlow.InventoryMove.getValue();*/ return true; } public static void UpdateRotationPitch(float p_Amount) { final Minecraft mc = Minecraft.getMinecraft(); float l_NewRotation = mc.player.rotationPitch + p_Amount; l_NewRotation = Math.max(l_NewRotation, -90.0f); l_NewRotation = Math.min(l_NewRotation, 90.0f); mc.player.rotationPitch = l_NewRotation; } public static void UpdateRotationYaw(float p_Amount) { final Minecraft mc = Minecraft.getMinecraft(); float l_NewRotation = mc.player.rotationYaw + p_Amount; // l_NewRotation = Math.min(l_NewRotation, -360.0f); // l_NewRotation = Math.max(l_NewRotation, 360.0f); mc.player.rotationYaw = l_NewRotation; } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { super.drawScreen(mouseX, mouseY, partialTicks); if (!InventoryMoveEnabled()) return; if (Keyboard.isKeyDown(200)) { UpdateRotationPitch(-2.5f); } if (Keyboard.isKeyDown(208)) { UpdateRotationPitch(2.5f); } if (Keyboard.isKeyDown(205)) { UpdateRotationYaw(2.5f); } if (Keyboard.isKeyDown(203)) { UpdateRotationYaw(-2.5f); } } @Override public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); } @Override public void mouseReleased(int mouseX, int mouseY, int state) { super.mouseReleased(mouseX, mouseY, state); } @Override public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick); } }
NullDev/Advent-of-Code
2021/Day_02/part_1.js
<reponame>NullDev/Advent-of-Code<gh_stars>1-10 "use strict"; // ========================= // // = Copyright (c) NullDev = // // ========================= // /* eslint-disable no-return-assign, no-nested-ternary */ let fs = require("fs"); let path = require("path"); let { performance } = require("perf_hooks"); const INPUT = String(fs.readFileSync(path.join(__dirname, "input.txt"))).split(require("os").EOL).map(e => e.split(" ")); const pStart = performance.now(); let x = 0; let y = 0; INPUT.forEach(e => e[0][0] === "f" ? x += Number(e[1]) : e[0] === "down" ? y += Number(e[1]) : e[0] === "up" && (y -= Number(e[1])) ); const res = x * y; /* // Array only approach. (Way slower) let res = INPUT.map(e => { let r = [0,0]; e[0][0] === "f" ? r[0] += Number(e[1]) : e[0][0] === "d" ? r[1] += Number(e[1]) : e[0][0] === "u" && (r[1] -= Number(e[1])); return r; }).reduce((a, b) => [a[0] + b[0], a[1] + b[1]]).reduce((a, b) => a * b); */ const pEnd = performance.now(); console.log("PRODUCT OF X-POSITION AND DEPTH: " + res); console.log(pEnd - pStart);
go-zero-boilerplate/gensql
schema/field_types.go
<gh_stars>1-10 package schema var ( INTEGER = &IntegerFieldType{} BIGINT = &BigIntFieldType{} VARCHAR = &VarcharFieldType{} BOOLEAN = &BooleanFieldType{} REAL = &RealFieldType{} BLOB = &BlobFieldType{} DATETIME = &DateTimeFieldType{} TIMESTAMP = &TimeStampFieldType{} CREATED = &CreatedFieldType{} UPDATED = &UpdatedFieldType{} ) type FieldType interface { Accept(FieldTypeVisitor) } type FieldTypeVisitor interface { VisitInteger(*IntegerFieldType) VisitBigInt(*BigIntFieldType) VisitVarchar(*VarcharFieldType) VisitBoolean(*BooleanFieldType) VisitReal(*RealFieldType) VisitBlob(*BlobFieldType) VisitDateTime(*DateTimeFieldType) VisitTimeStamp(*TimeStampFieldType) VisitCreated(*CreatedFieldType) VisitUpdated(*UpdatedFieldType) } type IntegerFieldType struct{} type BigIntFieldType struct{} type VarcharFieldType struct{} type BooleanFieldType struct{} type RealFieldType struct{} type BlobFieldType struct{} type DateTimeFieldType struct{} type TimeStampFieldType struct{} type CreatedFieldType struct{} type UpdatedFieldType struct{} func (i *IntegerFieldType) Accept(visitor FieldTypeVisitor) { visitor.VisitInteger(i) } func (b *BigIntFieldType) Accept(visitor FieldTypeVisitor) { visitor.VisitBigInt(b) } func (v *VarcharFieldType) Accept(visitor FieldTypeVisitor) { visitor.VisitVarchar(v) } func (b *BooleanFieldType) Accept(visitor FieldTypeVisitor) { visitor.VisitBoolean(b) } func (r *RealFieldType) Accept(visitor FieldTypeVisitor) { visitor.VisitReal(r) } func (b *BlobFieldType) Accept(visitor FieldTypeVisitor) { visitor.VisitBlob(b) } func (d *DateTimeFieldType) Accept(visitor FieldTypeVisitor) { visitor.VisitDateTime(d) } func (t *TimeStampFieldType) Accept(visitor FieldTypeVisitor) { visitor.VisitTimeStamp(t) } func (c *CreatedFieldType) Accept(visitor FieldTypeVisitor) { visitor.VisitCreated(c) } func (u *UpdatedFieldType) Accept(visitor FieldTypeVisitor) { visitor.VisitUpdated(u) }
arfcodes/frontend-toolkit
components/react/demo/pages/Layout/Grid.js
<reponame>arfcodes/frontend-toolkit /** * Demo Layout Grid */ import React from 'react'; // import { Short } from '@demo/includes/SampleContent'; import { Container } from '@components/Layout'; const LayoutGrid = () => ( <div className="p-layout-grid"> <Container size="md"> <h1>Grid Demo</h1> <br /> <br /> <div className="row gap--md"> <div className="col--1"> <div className="d-block bg--primary text--white">.col--1</div> </div> <div className="col--11"> <div className="d-block bg--primary text--white">.col--11</div> </div> </div> <br /> <div className="row gap--md"> <div className="col--2"> <div className="d-block bg--primary text--white">.col--2</div> </div> <div className="col--10"> <div className="d-block bg--primary text--white">.col--10</div> </div> </div> <br /> <div className="row gap--md"> <div className="col--3"> <div className="d-block bg--primary text--white">.col--3</div> </div> <div className="col--9"> <div className="d-block bg--primary text--white">.col--9</div> </div> </div> <br /> <div className="row gap--md"> <div className="col--4"> <div className="d-block bg--primary text--white">.col--4</div> </div> <div className="col--8"> <div className="d-block bg--primary text--white">.col--8</div> </div> </div> <br /> <div className="row gap--md"> <div className="col--5"> <div className="d-block bg--primary text--white">.col--5</div> </div> <div className="col--7"> <div className="d-block bg--primary text--white">.col--7</div> </div> </div> <br /> <div className="row gap--md"> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> </div> <br /> <br /> <br /> <h2>.gap--xs</h2> <br /> <div className="row gap--xs"> <div className="col--4"> <div className="d-block bg--primary text--white">.col--4</div> </div> <div className="col--8"> <div className="d-block bg--primary text--white">.col--8</div> </div> </div> <br /> <div className="row gap--xs"> <div className="col--5"> <div className="d-block bg--primary text--white">.col--5</div> </div> <div className="col--7"> <div className="d-block bg--primary text--white">.col--7</div> </div> </div> <br /> <div className="row gap--xs"> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> </div> <br /> <br /> <h2>.gap--sm</h2> <br /> <div className="row gap--sm"> <div className="col--4"> <div className="d-block bg--primary text--white">.col--4</div> </div> <div className="col--8"> <div className="d-block bg--primary text--white">.col--8</div> </div> </div> <br /> <div className="row gap--sm"> <div className="col--5"> <div className="d-block bg--primary text--white">.col--5</div> </div> <div className="col--7"> <div className="d-block bg--primary text--white">.col--7</div> </div> </div> <br /> <div className="row gap--sm"> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> </div> <br /> <br /> <h2>.gap--lg</h2> <br /> <div className="row gap--lg"> <div className="col--4"> <div className="d-block bg--primary text--white">.col--4</div> </div> <div className="col--8"> <div className="d-block bg--primary text--white">.col--8</div> </div> </div> <br /> <div className="row gap--lg"> <div className="col--5"> <div className="d-block bg--primary text--white">.col--5</div> </div> <div className="col--7"> <div className="d-block bg--primary text--white">.col--7</div> </div> </div> <br /> <div className="row gap--lg"> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> </div> <br /> <br /> <h2>.gap--xl</h2> <br /> <div className="row gap--xl"> <div className="col--4"> <div className="d-block bg--primary text--white">.col--4</div> </div> <div className="col--8"> <div className="d-block bg--primary text--white">.col--8</div> </div> </div> <br /> <div className="row gap--xl"> <div className="col--5"> <div className="d-block bg--primary text--white">.col--5</div> </div> <div className="col--7"> <div className="d-block bg--primary text--white">.col--7</div> </div> </div> <br /> <div className="row gap--xl"> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> </div> <br /> <br /> <h2>.gap--2xl</h2> <br /> <div className="row gap--2xl"> <div className="col--4"> <div className="d-block bg--primary text--white">.col--4</div> </div> <div className="col--8"> <div className="d-block bg--primary text--white">.col--8</div> </div> </div> <br /> <div className="row gap--2xl"> <div className="col--5"> <div className="d-block bg--primary text--white">.col--5</div> </div> <div className="col--7"> <div className="d-block bg--primary text--white">.col--7</div> </div> </div> <br /> <div className="row gap--2xl"> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> </div> <br /> <br /> <h2>.gap--3xl</h2> <br /> <div className="row gap--3xl"> <div className="col--4"> <div className="d-block bg--primary text--white">.col--4</div> </div> <div className="col--8"> <div className="d-block bg--primary text--white">.col--8</div> </div> </div> <br /> <div className="row gap--3xl"> <div className="col--5"> <div className="d-block bg--primary text--white">.col--5</div> </div> <div className="col--7"> <div className="d-block bg--primary text--white">.col--7</div> </div> </div> <br /> <div className="row gap--3xl"> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> <div className="col--6"> <div className="d-block bg--primary text--white">.col--6</div> </div> </div> </Container> <br /> <br /> <br /> </div> ); export default LayoutGrid;
rasael/jwrap
src/main/java/net/bervini/rasael/jwrap/util/Arrays.java
<reponame>rasael/jwrap<gh_stars>1-10 /* * Copyright 2022-2022 <NAME> * * 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 net.bervini.rasael.jwrap.util; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.Contract; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNullableByDefault; import java.lang.reflect.Array; import java.security.SecureRandom; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.function.Predicate; import java.util.stream.Stream; @ParametersAreNullableByDefault public class Arrays { private static final SecureRandom SECURE_RANDOM = new SecureRandom(); // ------------------------------------------------------------------------------------------------------------------- private Arrays(){} // ------------------------------------------------------------------------------------------------------------------- public static <ELEMENT> void sort(ELEMENT[] value) { sort(value, null); } public static <ELEMENT> void sort(ELEMENT[] value, Comparator<? super ELEMENT> comparator) { if (value==null) return; if (value.length<2) return; java.util.Arrays.sort(value, comparator); } @SafeVarargs public static <T> T[] array(T... values) { return values; } @SuppressWarnings("unchecked") @Nullable public static <T> T[] array(AtomicReferenceArray<T> atomicReferenceArray) { if (atomicReferenceArray == null) { return null; } else { int length = atomicReferenceArray.length(); if (length == 0) { return array(); } else { List<T> list = new ArrayList<>(); for(int i = 0; i < length; ++i) { list.add(atomicReferenceArray.get(i)); } return (T[]) list.toArray((Object[]) Array.newInstance(Object.class, length)); } } } public static String toString(Object[] value, boolean deep) { if (deep) { return java.util.Arrays.deepToString(value); } else { return java.util.Arrays.toString(value); } } @SuppressWarnings("unchecked") public static <T> Class<T> componentType(Object array) { if (array==null) return null; return (Class<T>) array.getClass().getComponentType(); } public static <E> E[] clear(E[] array) { if (isEmpty(array)) return array; return java.util.Arrays.copyOf(array, 0); } public static <E> void fill(E[] array, E element) { if (array==null) return; java.util.Arrays.fill(array, element); } public static void shuffle(Object[] array) { if (array==null || array.length<2) return; ArrayUtils.shuffle(array, SECURE_RANDOM); } @SafeVarargs @Nonnull public static <T> List<T> asList(T...elements) { if (elements==null || elements.length==0) return Collections.emptyList(); return java.util.Arrays.asList(elements); } @SafeVarargs @Nonnull public static <T> List<T> newList(T...elements) { if (elements==null || elements.length==0) return Collections.newList(); return Lists.newList(elements); } @Contract(value = "null -> true", pure = true) public static boolean isEmpty(Object[] values) { return size(values)==0; } public static int size(Object[] array) { return array!=null ? array.length : 0; } @Nonnull public static <T> Stream<T> stream(T[] array) { return Streams.stream(array); } public static <E> E get(E[] value, int index) { return ArrayUtils.get(value, index); } public static <E> E set(E[] array, int index, E element) { if (array==null || isEmpty(array)) { return null; } if (!ArrayUtils.isArrayIndexValid(array, index)) { return null; } E prevValue = array[index]; array[index] = element; return prevValue; } public static <E> E at(E[] array, int index) { if (array==null || isEmpty(array)) return null; if (index<0) index = array.length + index; if (!ArrayUtils.isArrayIndexValid(array, index)) { return null; } return get(array, index); } @SafeVarargs public static <E> E[] push(E[] array, E... elements) { if (isEmpty(elements)) { return array; } return ArrayUtils.addAll(array, elements); } public static <E> E[] addAll(E[] array, Iterable<E> elements) { if (array==null || Iterables.isEmpty(elements)) { return array; } return ArrayUtils.addAll(array, Iterables.toArray(elements, i -> newArrayLike(array, i))); } public static <E> E peek(E[] array) { if (array==null || isEmpty(array)) return null; return array[array.length-1]; } public static <E> E[] pop(E[] array) { if (array==null || isEmpty(array)) return array; return ArrayUtils.remove(array, size(array)-1); } public static <E> E[] remove(E[] array, int index) { if (array==null || isEmpty(array)) return array; return ArrayUtils.remove(array, index); } public static <E> E[] subarray(E[] array, int startIndexInclusive, int endIndexExclusive) { return ArrayUtils.subarray(array, startIndexInclusive, endIndexExclusive); } public static <E> E[] remove(E[] array, int startIndexInclusive, int endIndexExclusive) { return removeImpl(array, startIndexInclusive, endIndexExclusive, null); } static <E> E[] removeImpl(E[] array, int startIndexInclusive, int endIndexExclusive, E[] insert) { if (array==null || isEmpty(array)) return array; // ensure 'toIndex' is not out of bounds endIndexExclusive = Math.min(array.length, endIndexExclusive); // check bounds for from/toIndex if (!ArrayUtils.isArrayIndexValid(array, startIndexInclusive) || !ArrayUtils.isArrayIndexValid(array, endIndexExclusive)) { return array; } // Simple case, we subarray [0..from] if (endIndexExclusive>=array.length) { return ArrayUtils.subarray(array, 0, startIndexInclusive); } var elementsBeforeStart = startIndexInclusive; var elementsAfterEnd = array.length - endIndexExclusive; var insertsCount = size(insert); var elementsToCopy = elementsBeforeStart + elementsAfterEnd + insertsCount; var result = newArrayLike(array, elementsToCopy); // [0...from] System.arraycopy(array, 0, result, 0, startIndexInclusive); if (insertsCount>0) { System.arraycopy(insert, 0, result, startIndexInclusive, insertsCount); } // [toIndex+1...array.length] System.arraycopy(array, endIndexExclusive, result, startIndexInclusive + insertsCount, array.length - endIndexExclusive); return result; } public static <E> E[] newArrayLike(E[] array) { return newArrayLike(array, 0); } public static <E> E[] newArrayLike(E[] array, int newSize) { if (array==null) return null; Class<?> type = array.getClass().getComponentType(); @SuppressWarnings("unchecked") // OK, because array is of type E final E[] emptyArray = (E[]) Array.newInstance(type, Math.max(0, newSize)); return emptyArray; } public static <E> E[] insert(int index, E[] array, E element) { return ArrayUtils.insert(index, array, element); } public static <E> E[] filter(E[] array, Predicate<? super E> predicate) { var size = size(array); if (size==0 || predicate==null) return array; if (size==1) return predicate.test(array[0]) ? array : newArrayLike(array); var list = Lists.<E>newList(size); for (E e : array) { if (predicate.test(e)) { list.add(e); } } return list.toArray(i -> newArrayLike(array, i)); } public static <E> E[] clone(E[] array) { if (array==null) return null; return array.clone(); } // ------------------------------------------------------------------------------------------------------------------- public static <E> int indexOf(E[] array, E element) { return ArrayUtils.indexOf(array, element); } @SafeVarargs public static <E> E[] concat(E[] array, E[]... items) { if (isEmpty(items)) return clone(array); for (E[] item : items) { array = concat(array, item); } return array; } @SafeVarargs public static <E> E[] concat(E[] array, E... items) { if (isEmpty(items)) return clone(array); if (isEmpty(array)) return clone(items); return ArrayUtils.addAll(array, items); } @SafeVarargs public static <E> List<E> asListOrNull(E...values) { if (values==null) return null; return asList(values); } public static String toString(Object array) { return ArrayUtils.toString(array); } @SafeVarargs public static <E> List<E> toList(E...elements) { return Lists.newList(asList(elements)); } @SafeVarargs public static <E> Iterable<E> toSet(E...elements) { return Sets.newOrderedSet(asList(elements)); } }
BoniLindsley/pymap
pymap/backend/redis/background.py
from __future__ import annotations import asyncio import logging import uuid from abc import abstractmethod from asyncio import Task, CancelledError from contextlib import AsyncExitStack from typing import ClassVar, Protocol from aioredis import Redis, ConnectionError from pymap.context import connection_exit from pymap.health import HealthStatus __all__ = ['BackgroundAction', 'BackgroundTask', 'NoopAction'] _log = logging.getLogger(__name__) class BackgroundAction(Protocol): """An action to perform with the connection.""" @abstractmethod async def __call__(self, conn: Redis, duration: float) -> None: ... class NoopAction(BackgroundAction): """A background action that calls :meth:`~aioredis.client.Redis.blpop` on a randomly-generated key. """ async def __call__(self, conn: Redis, duration: float) -> None: key = b'invalid-' + uuid.uuid4().bytes + uuid.uuid4().bytes duration2: int = duration # type: ignore await conn.blpop(key, timeout=duration2) class BackgroundTask: """Maintains a :class:`CleanupThread` for the duration of the process lifetime, restarting on failure. Args: address: The redis server address for mail data. status: The system health status. root: The root redis key. """ #: The delay between redis reconnect attempts, on connection failure. connection_delay: ClassVar[float] = 5.0 #: The duration to hold an active connection before reconnecting, to detect #: silent failures. reconnect_duration: ClassVar[float] = 30.0 def __init__(self, redis: Redis, status: HealthStatus, action: BackgroundAction) -> None: super().__init__() self._redis = redis self._status = status self._action = action async def _run_forever(self) -> None: while True: try: async with AsyncExitStack() as stack: connection_exit.set(stack) conn = await stack.enter_async_context( self._redis.client()) self._status.set_healthy() await self._action(conn, self.reconnect_duration) except (ConnectionError, OSError): self._status.set_unhealthy() except CancelledError: break await asyncio.sleep(self.connection_delay) def start(self) -> Task[None]: """Return a task running the cleanup loop indefinitely.""" return asyncio.create_task(self._run_forever())
SiminBadri/Wolf.Engine
engine/src/wolf.render/directX/w_framework/w_debug/w_debugger.h
/* Project : Wolf Engine (http://WolfStudio.co). Copyright(c) <NAME> (http://PooyaEimandar.com) . All rights reserved. Source : https://github.com/PooyaEimandar/WolfEngine - Please direct any bug to <EMAIL> or tweet @Wolf_Engine on twitter Name : W_DebugState.h Description : The change color of debug Comment : */ #pragma once #include <d2d1_1.h> #include <W_GraphicsDeviceManager.h> namespace Wolf { namespace Graphics { class W_Debugger : public System::W_Object { public: //Constructor of W_Debugger W_Debugger(const std::shared_ptr<W_GraphicsDevice>& gDevice); //Destructor of W_Debugger virtual ~W_Debugger(); //Release all resources ULONG Release() override; #pragma region Getters //Get color state - Normal = Lime, Warning = Yellow, Critical = Red ID2D1SolidColorBrush* GetColorState(); #pragma endregion protected: enum State { Normal, Warning, Error }; State state; Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> RedSolidBrushColor; Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> YellowSolidBrushColor; Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> LimeSolidBrushColor; }; } }
Milanzor/homey-mock
includes/Managers/ManagerNFC.js
<filename>includes/Managers/ManagerNFC.js /** * */ class ManagerNFC { } module.exports = ManagerNFC;
Wmbat/UVE
libmannele/libmannele/algorithm.hpp
<reponame>Wmbat/UVE #ifndef LIBMANNELE_ALGORITHM_HPP_ #define LIBMANNELE_ALGORITHM_HPP_ #include <libmannele/algorithm/binary_search.hpp> #endif // LIBMANNELE_ALGORITHM_HPP_
pro-gen/progen
progen/src/main/java/progen/kernel/grammar/validations/GrammarNonTerminalSymbolProduction.java
package progen.kernel.grammar.validations; import progen.kernel.grammar.GrammarNonTerminalSymbol; import progen.kernel.grammar.Grammar; import progen.kernel.grammar.GrammarNotValidException; /** * Check if the grammar have any production like Ax :: = xxx * * @author jirsis * */ public class GrammarNonTerminalSymbolProduction implements Validation { public void validate(Grammar gram) { boolean grammarOK = true; for (GrammarNonTerminalSymbol nonTerminal : gram.getGrammarNonTerminalSymbols()) { grammarOK &= gram.getProductions(nonTerminal).size() > 0; } if (!grammarOK) { throw new GrammarNotValidException(GrammarNotValidExceptionEnum.NON_TERMINAL_SYMBOLS_IN_PRODUCTIONS_ERROR); } } }
umstek/SwimmingCompetitionSimulator
src/swimmingcompetition/ux/DialogCreateSwimmer.java
<filename>src/swimmingcompetition/ux/DialogCreateSwimmer.java /* * DialogCreateSwimmer.java * Provides GUI to create a new swimmer object. * */ package swimmingcompetition.ux; import swimmingcompetition.simulator.Swimmer; import swimmingcompetition.ux.viewmodels.ModelCreateSwimmer; import swimmingcompetition.ux.viewmodels.UIUpdater; /** * * @author Wickramaranga */ public class DialogCreateSwimmer extends javax.swing.JDialog { private final ModelCreateSwimmer swimmerModel; private boolean okay; /** * Creates new form DialogCreateSwimmer * * @param parent parent of this frame. * @param modal whether this frame is a modal. */ public DialogCreateSwimmer(java.awt.Frame parent, boolean modal) { super(parent, modal); swimmerModel = new ModelCreateSwimmer(); swimmerModel.setName(""); swimmerModel.setGender("Male"); okay = false; initComponents(); swimmerModel.setUpdater(new UIUpdater() { @Override public void updateUI(String partToUpdate) { switch (partToUpdate) { case "Message": jLabelMsg.setText(swimmerModel.getMessage()); break; default: assert false; break; } } }); jButtonOk.setEnabled(swimmerModel.isValid()); } /** * * @return */ public Swimmer getSwimmer() { return swimmerModel.getObject(); } /** * * @return */ public boolean isOkay() { return okay; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabelName = new javax.swing.JLabel(); jTextName = new javax.swing.JTextField(); jComboGender = new javax.swing.JComboBox(); jLabelGender = new javax.swing.JLabel(); jButtonCancel = new javax.swing.JButton(); jButtonOk = new javax.swing.JButton(); jLabelMsg = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Add new swimmer"); setModal(true); setResizable(false); setType(java.awt.Window.Type.POPUP); jLabelName.setText("Name"); jTextName.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextNameActionPerformed(evt); } }); jTextName.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { jTextNameKeyReleased(evt); } }); jComboGender.setBackground(new java.awt.Color(0, 204, 204)); jComboGender.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Male", "Female" })); jComboGender.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboGenderActionPerformed(evt); } }); jLabelGender.setText("Gender"); jButtonCancel.setBackground(new java.awt.Color(0, 204, 204)); jButtonCancel.setText("Cancel"); jButtonCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonCancelActionPerformed(evt); } }); jButtonOk.setBackground(new java.awt.Color(0, 204, 204)); jButtonOk.setText("Okay"); jButtonOk.setEnabled(false); jButtonOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonOkActionPerformed(evt); } }); jLabelMsg.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N jLabelMsg.setForeground(new java.awt.Color(255, 0, 51)); jLabelMsg.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabelMsg.setText("Message"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabelGender) .addComponent(jLabelName)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextName) .addComponent(jComboGender, 0, 147, Short.MAX_VALUE))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 102, Short.MAX_VALUE) .addComponent(jButtonOk) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButtonCancel)) .addComponent(jLabelMsg, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabelName)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboGender, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabelGender)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE) .addComponent(jLabelMsg, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButtonCancel) .addComponent(jButtonOk)) .addContainerGap()) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void jTextNameKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextNameKeyReleased swimmerModel.setName(jTextName.getText()); jButtonOk.setEnabled(swimmerModel.isValid()); }//GEN-LAST:event_jTextNameKeyReleased private void jButtonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOkActionPerformed okay = true; this.setVisible(false); this.dispose(); }//GEN-LAST:event_jButtonOkActionPerformed private void jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed this.setVisible(false); this.dispose(); }//GEN-LAST:event_jButtonCancelActionPerformed private void jComboGenderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboGenderActionPerformed swimmerModel.setGender(jComboGender.getSelectedItem().toString()); jButtonOk.setEnabled(swimmerModel.isValid()); }//GEN-LAST:event_jComboGenderActionPerformed private void jTextNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextNameActionPerformed if (swimmerModel.isValid()) { okay = true; this.setVisible(false); this.dispose(); } }//GEN-LAST:event_jTextNameActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButtonCancel; private javax.swing.JButton jButtonOk; private javax.swing.JComboBox jComboGender; private javax.swing.JLabel jLabelGender; private javax.swing.JLabel jLabelMsg; private javax.swing.JLabel jLabelName; private javax.swing.JTextField jTextName; // End of variables declaration//GEN-END:variables }
hoanghai1803/CP_Training
Atcoder/Dynamic_Programming/Educational_DP_Contest/dp_c.cpp
// Author: __BruteForce__ #include <bits/stdc++.h> using namespace std; int n, dp[3], a, b, c; int main() { cin.tie(0)->sync_with_stdio(false); for (cin >> n; n--;) { cin >> a >> b >> c; int dp_0 = max(dp[1] + a, dp[2] + a); int dp_1 = max(dp[0] + b, dp[2] + b); int dp_2 = max(dp[0] + c, dp[1] + c); dp[0] = dp_0, dp[1] = dp_1, dp[2] = dp_2; } cout << max(dp[0], max(dp[1], dp[2])) << "\n"; }
dynamesxy/jeesite-cms-mydemo
web/src/main/java/com/jeesite/modules/configure/I18nFunction.java
<gh_stars>0 package com.jeesite.modules.configure; import javax.servlet.http.HttpServletRequest; import org.beetl.core.Context; import org.beetl.core.Function; import org.beetl.ext.web.WebVariable; import org.springframework.web.servlet.support.RequestContext; public class I18nFunction implements Function { @Override public Object call(Object[] obj, Context context) { HttpServletRequest request = (HttpServletRequest) context.getGlobal(WebVariable.REQUEST); RequestContext requestContext = new RequestContext(request); String message = requestContext.getMessage((String) obj[0]); return message; } }
strubell/factorie
src/main/scala/cc/factorie/app/uschema/tac/LoadTacData.scala
/* Copyright (C) 2008-2016 University of Massachusetts Amherst. This file is part of "FACTORIE" (Factor graphs, Imperative, Extensible) http://factorie.cs.umass.edu, http://github.com/factorie 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 cc.factorie.app.uschema.tac import com.mongodb.{DB, MongoClient} import cc.factorie.app.uschema._ /** * Created by beroth on 2/11/15. */ class LoadTacDataOptions extends cc.factorie.util.DefaultCmdOptions { val tacData = new CmdOption("tac-data", "", "FILE", "tab separated file with TAC training data") val mongoHost = new CmdOption("mongo-host","localhost","STRING","host with running mongo db") val mongoPort = new CmdOption("mongo-port", 27017, "INT", "port mongo db is running on") val dbname = new CmdOption("db-name", "tac", "STRING", "name of mongo db to write data into") } object LoadTacDataIntoMongo { val opts = new LoadTacDataOptions def main(args: Array[String]) : Unit = { opts.parse(args) val tReadStart = System.currentTimeMillis val kb = EntityRelationKBMatrix.fromTsv(opts.tacData.value) val tRead = (System.currentTimeMillis - tReadStart)/1000.0 println(f"Reading from file took $tRead%.2f s") println("Stats:") println("Num Rows:" + kb.numRows()) println("Num Cols:" + kb.numCols()) println("Num cells:" + kb.nnz()) val tWriteStart = System.currentTimeMillis val mongoClient = new MongoClient( opts.mongoHost.value , opts.mongoPort.value ) val db:DB = mongoClient.getDB( opts.dbname.value ) //kb.writeToMongoCellBased(db) kb.writeToMongo(db) val tWrite = (System.currentTimeMillis - tWriteStart)/1000.0 println(f"Writing to mongo took $tWrite%.2f s") val tReadMongoStart = System.currentTimeMillis //val kb2 = KBMatrix.fromMongoCellBased(db) val kb2 = new EntityRelationKBMatrix kb2.populateFromMongo(db) val tReadMongo = (System.currentTimeMillis - tReadMongoStart)/1000.0 println(f"Reading from mongo took $tReadMongo%.2f s") val tCompareStart = System.currentTimeMillis val haveSameContent = kb.hasSameContent(kb2) val tCompare = (System.currentTimeMillis - tCompareStart)/1000.0 println(f"Comparison of kbs took $tCompare%.2f s") if (haveSameContent) { println("OK: matrix in mongo has same content as matrix on disk") } else { println("FAILURE: matrix in mongo has different content as matrix on disk") println("Stats for mongo matrix:") println("Num Rows:" + kb2.numRows()) println("Num Cols:" + kb2.numCols()) println("Num cells:" + kb2.nnz()) } val tPrune0Start = System.currentTimeMillis val prunedMatrix0 = kb.prune(0,0) val tPrune0 = (System.currentTimeMillis - tPrune0Start)/1000.0 println(f"pruning with threshold 0,0 took $tPrune0%.2f s") println("Stats of pruned matrix:") println("Num Rows:" + prunedMatrix0.numRows()) println("Num Cols:" + prunedMatrix0.numCols()) println("Num cells:" + prunedMatrix0.nnz()) val tPrune1Start = System.currentTimeMillis val prunedMatrix1 = kb.prune(1,1) val tPrune1 = (System.currentTimeMillis - tPrune1Start)/1000.0 println(f"pruning with threshold 1,1 took $tPrune1%.2f s") println("Stats of pruned matrix:") println("Num Rows:" + prunedMatrix1.numRows()) println("Num Cols:" + prunedMatrix1.numCols()) println("Num cells:" + prunedMatrix1.nnz()) val tPrune2Start = System.currentTimeMillis val prunedMatrix2 = kb.prune(2,2) val tPrune2 = (System.currentTimeMillis - tPrune2Start)/1000.0 println(f"pruning with threshold 2,2 took $tPrune2%.2f s") println("Stats of pruned matrix:") println("Num Rows:" + prunedMatrix2.numRows()) println("Num Cols:" + prunedMatrix2.numCols()) println("Num cells:" + prunedMatrix2.nnz()) val tPrune3Start = System.currentTimeMillis val prunedMatrix3 = kb.prune(2,1) val tPrune3 = (System.currentTimeMillis - tPrune3Start)/1000.0 println(f"pruning with threshold 2,1 took $tPrune3%.2f s") println("Stats of pruned matrix:") println("Num Rows:" + prunedMatrix3.numRows()) println("Num Cols:" + prunedMatrix3.numCols()) println("Num cells:" + prunedMatrix3.nnz()) } }
pl8787/textnet-release
src/layer/input/list_textdata_layer-inl.hpp
#ifndef TEXTNET_LAYER_LIST_TEXTDATA_LAYER_INL_HPP_ #define TEXTNET_LAYER_LIST_TEXTDATA_LAYER_INL_HPP_ #include <iostream> #include <fstream> #include <sstream> #include <utility> #include <vector> #include <algorithm> #include "stdlib.h" #include <mshadow/tensor.h> #include "../layer.h" #include "../op.h" namespace textnet { namespace layer { template<typename xpu> class ListTextDataLayer : public Layer<xpu>{ public: ListTextDataLayer(LayerType type) { this->layer_type = type; } virtual ~ListTextDataLayer(void) {} virtual int BottomNodeNum() { return 0; } virtual int TopNodeNum() { return 2; } virtual int ParamNodeNum() { return 0; } virtual void Require() { // default value, just set the value you want this->defaults["batch_size"] = SettingV(1); this->defaults["min_doc_len"] = SettingV(1); this->defaults["speedup_list"] = SettingV(false); this->defaults["reverse"] = SettingV(false); // require value, set to SettingV(), // it will force custom to set in config this->defaults["data_file"] = SettingV(); this->defaults["max_doc_len"] = SettingV(); Layer<xpu>::Require(); } virtual void SetupLayer(std::map<std::string, SettingV> &setting, const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top, mshadow::Random<xpu> *prnd) { Layer<xpu>::SetupLayer(setting, bottom, top, prnd); utils::Check(bottom.size() == BottomNodeNum(), "TextDataLayer:bottom size problem."); utils::Check(top.size() == TopNodeNum(), "TextDataLayer:top size problem."); batch_size = setting["batch_size"].iVal(); data_file = setting["data_file"].sVal(); max_doc_len = setting["max_doc_len"].iVal(); min_doc_len = setting["min_doc_len"].iVal(); speedup_list = setting["speedup_list"].bVal(); reverse = setting["reverse"].bVal(); ReadTextData(); line_ptr = 0; } static bool list_size_cmp(const vector<int> &x1, const vector<int> &x2) { return x1.size() < x2.size(); // sort increase } int ReadLabel(string &line) { std::istringstream iss; int label = -1; iss.clear(); iss.seekg(0, iss.beg); iss.str(line); iss >> label; return label; } void ReadLine(int idx, string &line) { std::istringstream iss; int len_s1 = 0; int len_s2 = 0; int label = -1; iss.clear(); iss.seekg(0, iss.beg); iss.str(line); iss >> label >> len_s1 >> len_s2; label_set.push_back(label); vector<int> q(len_s1); for (int j = 0; j < len_s1; ++j) { iss >> q[j]; } q_data_set.push_back(q); vector<int> a(len_s2); for (int j = 0; j < len_s2; ++j) { iss >> a[j]; } a_data_set.push_back(a); } void ReadTextData() { utils::Printf("Open data file: %s\n", data_file.c_str()); std::vector<std::string> lines; std::ifstream fin(data_file.c_str()); std::string s; utils::Check(fin.is_open(), "Open data file problem."); while (!fin.eof()) { std::getline(fin, s); if (s.empty()) break; lines.push_back(s); } fin.close(); line_count = lines.size(); for (int i = 0; i < line_count; ++i) { ReadLine(i, lines[i]); } MakeLists(label_set, list_set); utils::Printf("Line count in file: %d\n", line_count); utils::Printf("Max list length: %d\n", max_list); utils::Printf("List count: %d\n", list_set.size()); // for (int i = 0; i < list_set.size(); ++i) { // utils::Printf("list: %d\n", list_set[i].size()); //} } void MakeLists(vector<int> &label_set, vector<vector<int> > &list_set) { vector<int> list; max_list = 0; int cur_class = -1; for (int i = 0; i < line_count; ++i) { if (label_set[i] > cur_class && list.size() != 0) { list_set.push_back(list); max_list = std::max(max_list, (int)list.size()); list = vector<int>(); } cur_class = label_set[i]; if (cur_class >=0) list.push_back(i); } list_set.push_back(list); max_list = std::max(max_list, (int)list.size()); // for speed up we can sort list by list.size() if (speedup_list) sort(list_set.begin(), list_set.end(), list_size_cmp); } virtual void Reshape(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top, bool show_info = false) { utils::Check(bottom.size() == BottomNodeNum(), "TextDataLayer:bottom size problem."); utils::Check(top.size() == TopNodeNum(), "TextDataLayer:top size problem."); utils::Check(max_doc_len > 0, "max_doc_len <= 0"); top[0]->Resize(max_list * batch_size, 2, 1, max_doc_len, true); top[1]->Resize(max_list * batch_size, 1, 1, 1, true); if (show_info) { top[0]->PrintShape("top0"); top[1]->PrintShape("top1"); } } virtual void CheckReshape(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top) { // Check for reshape bool need_reshape = false; if (max_list != list_set[line_ptr].size()) { need_reshape = true; max_list = list_set[line_ptr].size(); } // Do reshape if (need_reshape) { this->Reshape(bottom, top); } } virtual void Forward(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top) { using namespace mshadow::expr; mshadow::Tensor<xpu, 3> top0_data = top[0]->data_d3(); mshadow::Tensor<xpu, 2> top0_length = top[0]->length; mshadow::Tensor<xpu, 1> top1_data = top[1]->data_d1(); top0_data = -1; top0_length = 0; top1_data = -1; for (int s = 0; s < batch_size; ++s) { for (int i = 0; i < list_set[line_ptr].size(); ++i) { int idx = list_set[line_ptr][i]; int out_idx = s * list_set[line_ptr].size() + i; if (!reverse) { for (int j = 0; j < min(max_doc_len, (int)q_data_set[idx].size()); ++j) { top0_data[out_idx][0][j] = q_data_set[idx][j]; } for (int j = 0; j < min(max_doc_len, (int)a_data_set[idx].size()); ++j) { top0_data[out_idx][1][j] = a_data_set[idx][j]; } } else { for (int j = 0; j < min(max_doc_len, (int)q_data_set[idx].size()); ++j) { top0_data[out_idx][0][j] = q_data_set[idx][(int)q_data_set[idx].size() - j - 1]; } for (int j = 0; j < min(max_doc_len, (int)a_data_set[idx].size()); ++j) { top0_data[out_idx][1][j] = a_data_set[idx][(int)a_data_set[idx].size() - j - 1]; } } top0_length[out_idx][0] = min(max_doc_len, (int)q_data_set[idx].size()); top0_length[out_idx][1] = min(max_doc_len, (int)a_data_set[idx].size()); top1_data[out_idx] = label_set[idx]; } line_ptr = (line_ptr + 1) % list_set.size(); } } virtual void Backprop(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top) { using namespace mshadow::expr; } protected: std::string data_file; int batch_size; int max_doc_len; int min_doc_len; bool shuffle; bool speedup_list; bool reverse; vector<vector<int> > q_data_set; vector<vector<int> > a_data_set; vector<int> label_set; int line_count; int max_list; int line_ptr; vector<vector<int> > list_set; }; } // namespace layer } // namespace textnet #endif // LAYER_LIST_TEXTDATA_LAYER_INL_HPP_
zhangkn/iOS14Header
System/Library/PrivateFrameworks/ReminderKitInternal.framework/TTRNLTextStructuredEvent.h
/* * This header is generated by classdump-dyld 1.0 * on Sunday, September 27, 2020 at 11:42:27 AM Mountain Standard Time * Operating System: Version 14.0 (Build 18A373) * Image Source: /System/Library/PrivateFrameworks/ReminderKitInternal.framework/ReminderKitInternal * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by <NAME>. */ @class TTRNLTextStructuredEventRecurrentEvent, NSArray; @interface TTRNLTextStructuredEvent : NSObject { void* _structuredEvent; } @property (assign,nonatomic) void* structuredEvent; //@synthesize structuredEvent=_structuredEvent - In the implementation block @property (nonatomic,readonly) TTRNLTextStructuredEventRecurrentEvent * recurrentEvent; @property (nonatomic,readonly) NSArray * locations; -(NSArray *)locations; -(void)dealloc; -(id)initWithStructuredEvent:(void*)arg1 ; -(void*)structuredEvent; -(TTRNLTextStructuredEventRecurrentEvent *)recurrentEvent; -(void)setStructuredEvent:(void*)arg1 ; @end
ngocnguyen/sdcct
sdcct-core/src/main/java/gov/hhs/onc/sdcct/rfd/RfdForm.java
package gov.hhs.onc.sdcct.rfd; import gov.hhs.onc.sdcct.form.SdcctForm; import gov.hhs.onc.sdcct.sdc.FormDesignType; public interface RfdForm extends SdcctForm<FormDesignType> { }
1and1/Troilus
troilus-core-java7/src/main/java/net/oneandone/troilus/BatchMutationQuery.java
/* * Copyright 1&1 Internet AG, https://github.com/1and1/ * * 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 net.oneandone.troilus; import net.oneandone.troilus.java7.BatchMutation; import net.oneandone.troilus.java7.Batchable; import com.datastax.driver.core.BatchStatement.Type; import com.datastax.driver.core.Statement; import com.google.common.base.Function; import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.ListenableFuture; /** * Batch mutation query */ class BatchMutationQuery extends MutationQuery<BatchMutation> implements BatchMutation { private final ImmutableList<Batchable<?>> batchables; private final Type type; BatchMutationQuery(Context ctx, Batchable<?> mutation1, Batchable<?> mutation2) { this(ctx, Type.LOGGED, join(mutation1, mutation2)); } private static ImmutableList<Batchable<?>> join(Batchable<?> mutation1, Batchable<?> mutation2) { if ((mutation1 != null) && (mutation2 != null)) { return ImmutableList.<Batchable<?>>of(mutation1, mutation2); } else if ((mutation1 != null) && (mutation2 == null)) { return ImmutableList.<Batchable<?>>of(mutation1); } else if ((mutation1 == null) && (mutation2 != null)) { return ImmutableList.<Batchable<?>>of(mutation2); } else { return null; } } private BatchMutationQuery(Context ctx, Type type, ImmutableList<Batchable<?>> batchables) { super(ctx); this.type = type; this.batchables = batchables; } //////////////////// // factory methods @Override protected BatchMutationQuery newQuery(Context newContext) { return new BatchMutationQuery(newContext, type, batchables); } private BatchMutationQuery newQuery(Type type, ImmutableList<Batchable<?>> batchables) { return new BatchMutationQuery(getContext(), type, batchables); } // /////////////////// @Override public BatchMutationQuery withWriteAheadLog() { return newQuery(Type.LOGGED, batchables); } @Override public BatchMutationQuery withoutWriteAheadLog() { return newQuery(Type.UNLOGGED, batchables); } @Override public BatchMutationQuery combinedWith(Batchable<?> other) { if (other == null) { return this; } else { return newQuery(type, Immutables.join(batchables, other)); } } @Override public ListenableFuture<Statement> getStatementAsync(final DBSession dbSession) { Function<Batchable<?>, ListenableFuture<Statement>> statementFetcher = new Function<Batchable<?>, ListenableFuture<Statement>>() { public ListenableFuture<Statement> apply(Batchable<?> batchable) { return batchable.getStatementAsync(dbSession); }; }; return mergeToBatch(type, batchables.iterator(), statementFetcher); } }
Tenderize/audius-protocol
identity-service/src/announcements.js
const axios = require('axios') const moment = require('moment') const config = require('./config.js') module.exports.fetchAnnouncements = async () => { const audiusNotificationUrl = config.get('audiusNotificationUrl') const response = await axios.get(`${audiusNotificationUrl}/index.json`) if (response.data && Array.isArray(response.data.notifications)) { const announcementsResponse = await Promise.all(response.data.notifications.map(async notification => { const notificationResponse = await axios.get(`${audiusNotificationUrl}/${notification.id}.json`) return notificationResponse.data })) const announcements = announcementsResponse.filter(a => !!a.entityId).map(a => ({ ...a, type: 'Announcement' })) announcements.sort((a, b) => { let aDate = moment(a.datePublished) let bDate = moment(b.datePublished) return bDate - aDate }) const announcementMap = announcements.reduce((acc, a) => { acc[a.entityId] = a return acc }, {}) return { announcements, announcementMap } } }
dineshtoon/UdemyJavaCourse
Section8/src/main/java/challenge/arraylist/Mobile.java
<reponame>dineshtoon/UdemyJavaCourse package challenge.arraylist; import java.util.ArrayList; public class Mobile { private ArrayList<Contact> contacts = new ArrayList<>(); private Contact self; public Mobile(String name, String phoneNumber) { self = new Contact(name, phoneNumber); } public void addContact(Contact contact) { if (findContact(contact.getName()) != null) { System.out.println("Contact " + contact.toString() + " already exist"); } else { contacts.add(contact); System.out.println("New contact added : " + contact.toString()); } } public void modifyContact(String currentName, String newName) { Contact contact = findContact(currentName); if (contact == null) { System.out.println("Contact with name " + currentName + " doesn't exist"); } else { System.out.println("Updating Contact " + contact.toString()); contact.updateName(newName); System.out.println("New contact is " + contact.toString()); } } public void removeContact(String name) { Contact contact = findContact(name); if (contact == null) { System.out.println("Contact with name " + name + " doesn't exist"); } else { removeContact(contact); } } private void removeContact(Contact contact) { contacts.remove(contact); } public String getContact(String name) { Contact contact = findContact(name); if (contact == null) { System.out.println("Contact with name " + name + " not found"); return null; } else { return contact.toString(); } } private Contact findContact(String name) { for (int i = 0; i < contacts.size(); i++) { Contact contact = contacts.get(i); if (contact.getName().equals(name)) { return contact; } } return null; } public void printAllContacts() { System.out.println("---------------------------------------"); System.out.println("My contact list"); System.out.println(self.toString()); for (int i = 0; i < contacts.size(); i++) { System.out.println(contacts.get(i).toString()); } } }
paige-ingram/nwhacks2022
node_modules/@fluentui/react-northstar/dist/commonjs/components/Portal/PortalInner.js
<reponame>paige-ingram/nwhacks2022 "use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.PortalInner = void 0; var _invoke2 = _interopRequireDefault(require("lodash/invoke")); var PropTypes = _interopRequireWildcard(require("prop-types")); var React = _interopRequireWildcard(require("react")); var ReactDOM = _interopRequireWildcard(require("react-dom")); var _utils = require("../../utils"); var _usePortalBox = require("../Provider/usePortalBox"); var customPropTypes = _interopRequireWildcard(require("@fluentui/react-proptypes")); var _reactBindings = require("@fluentui/react-bindings"); /** * A PortalInner is a container for Portal's content. */ var PortalInner = function PortalInner(props) { var context = React.useContext(_usePortalBox.PortalBoxContext); var children = props.children, mountNode = props.mountNode; // PortalInner should render elements even without a context // eslint-disable-next-line var target = (0, _utils.isBrowser)() ? context || document.body : null; var container = mountNode || target; (0, _reactBindings.useIsomorphicLayoutEffect)(function () { (0, _invoke2.default)(props, 'onMount', props); return function () { return (0, _invoke2.default)(props, 'onUnmount', props); }; }, []); return container && /*#__PURE__*/ReactDOM.createPortal(children, container); }; exports.PortalInner = PortalInner; PortalInner.propTypes = Object.assign({}, _utils.commonPropTypes.createCommon({ accessibility: false, as: false, className: false, content: false, styled: false }), { mountNode: customPropTypes.domNode, onMount: PropTypes.func, onUnmount: PropTypes.func }); //# sourceMappingURL=PortalInner.js.map
omegaes/Oction
app/src/main/java/com/mega4tech/oction/mvp/account/view/AccountView.java
<gh_stars>1-10 package com.mega4tech.oction.mvp.account.view; import android.support.annotation.UiThread; @UiThread public interface AccountView { }
lechium/iPhoneOS_12.1.1_Headers
Applications/MobileSafari/CloudTabItemView.h
<filename>Applications/MobileSafari/CloudTabItemView.h<gh_stars>10-100 // // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // #import "UIButton.h" #import "UIGestureRecognizerDelegate.h" @class CloudTabItemDeleteConfirmationView, NSString, UIPanGestureRecognizer, UIView, WBSCloudTab; @interface CloudTabItemView : UIButton <UIGestureRecognizerDelegate> { UIView *_separatorView; // 8 = 0x8 UIView *_highlightView; // 16 = 0x10 _Bool _editing; // 24 = 0x18 double _startingSwipeOffset; // 32 = 0x20 double _swipeOffset; // 40 = 0x28 UIPanGestureRecognizer *_panGestureRecognizer; // 48 = 0x30 CloudTabItemDeleteConfirmationView *_deleteConfirmationView; // 56 = 0x38 double _leftEdgeInset; // 64 = 0x40 _Bool _editable; // 72 = 0x48 long long _style; // 80 = 0x50 id <CloudTabItemViewDelegate> _delegate; // 88 = 0x58 WBSCloudTab *_cloudTab; // 96 = 0x60 } + (long long)_numberOfLinesForTraitCollection:(id)arg1; // IMP=0x000000010008eb9c + (double)_defaultItemHeightForTraitCollection:(id)arg1; // IMP=0x000000010008eb38 + (double)defaultHeightForTraitCollection:(id)arg1; // IMP=0x000000010008ea78 @property(nonatomic, getter=isEditable) _Bool editable; // @synthesize editable=_editable; @property(retain, nonatomic) WBSCloudTab *cloudTab; // @synthesize cloudTab=_cloudTab; @property(nonatomic) __weak id <CloudTabItemViewDelegate> delegate; // @synthesize delegate=_delegate; @property(nonatomic) long long style; // @synthesize style=_style; - (void).cxx_destruct; // IMP=0x000000010008fb94 - (void)_deleteButtonTapped:(id)arg1; // IMP=0x000000010008faec - (_Bool)gestureRecognizer:(id)arg1 shouldReceiveTouch:(id)arg2; // IMP=0x000000010008fa40 - (void)touchesCancelled:(id)arg1 withEvent:(id)arg2; // IMP=0x000000010008f9c8 - (void)touchesEnded:(id)arg1 withEvent:(id)arg2; // IMP=0x000000010008f950 - (void)touchesMoved:(id)arg1 withEvent:(id)arg2; // IMP=0x000000010008f8d8 - (void)touchesBegan:(id)arg1 withEvent:(id)arg2; // IMP=0x000000010008f7a0 - (void)_panRecognized:(id)arg1; // IMP=0x000000010008f5e0 - (double)_swipeOffsetFromPanGestureRecognizer; // IMP=0x000000010008f50c - (void)_setEditing:(_Bool)arg1 animated:(_Bool)arg2; // IMP=0x000000010008f384 - (void)_setUpDeleteConfirmationViewIfNecessary; // IMP=0x000000010008f2c0 - (void)setHighlighted:(_Bool)arg1; // IMP=0x000000010008f2b0 - (void)setHighlighted:(_Bool)arg1 animated:(_Bool)arg2; // IMP=0x000000010008f138 @property(nonatomic) _Bool showsSeparator; - (void)traitCollectionDidChange:(id)arg1; // IMP=0x000000010008ee90 - (void)layoutSubviews; // IMP=0x000000010008ece4 - (void)_updateStyle; // IMP=0x000000010008ecb8 - (struct CGRect)titleRectForContentRect:(struct CGRect)arg1; // IMP=0x000000010008ebec - (struct CGSize)sizeThatFits:(struct CGSize)arg1; // IMP=0x000000010008e9fc - (void)dealloc; // IMP=0x000000010008e95c - (id)initWithFrame:(struct CGRect)arg1; // IMP=0x000000010008e3f0 // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
GunterMueller/ST_STX_Fork
build/stx/support/tools/splint-3.1.2/test/manual/annotglobs.c
<gh_stars>1-10 int globnum; struct { char *firstname, *lastname; int id; } globname; void initialize (/*@only@*/ char *name) /*@globals undef globnum, undef globname @*/ { globname.id = globnum; globname.lastname = name; } void finalize (void) /*@globals killed globname@*/ { free (globname.lastname); }
Everpoint/everpoint-site
src/components/HowWeAreWorking/Principle/Principle.js
import React from "react"; import PropTypes from "prop-types"; import { Container, Item, Badge, Content, Title, Description } from "./styles"; export const Principle = ({ items, longread = false }) => ( <Container longread={longread}> {items && items.map(({ icon, iconGreen, title, description }) => ( <Item key={title} longread={longread}> <Badge style={{ backgroundImage: `url(${longread ? iconGreen : icon})` }} longread={longread} /> <Content> <Title longread={longread}>{title}</Title> {longread && <Description>{description}</Description>} </Content> </Item> ))} </Container> ); Principle.propTypes = { itemClassName: PropTypes.string, items: PropTypes.arrayOf(PropTypes.object), };
cisco-ie/cisco-proto
codegen/go/xr/63x/cisco_ios_xr_invmgr_oper/inventory/racks/rack/fantray/slot/tsi1s/tsi1/attributes/inv_eeprom_info/invmgr_eeprom_opaque_data.pb.go
/* Copyright 2019 Cisco Systems 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. */ // Code generated by protoc-gen-go. DO NOT EDIT. // source: invmgr_eeprom_opaque_data.proto package cisco_ios_xr_invmgr_oper_inventory_racks_rack_fantray_slot_tsi1s_tsi1_attributes_inv_eeprom_info import ( fmt "fmt" proto "github.com/golang/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.ProtoPackageIsVersion3 // please upgrade the proto package type InvmgrEepromOpaqueData_KEYS struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name_1 string `protobuf:"bytes,2,opt,name=name_1,json=name1,proto3" json:"name_1,omitempty"` Name_2 string `protobuf:"bytes,3,opt,name=name_2,json=name2,proto3" json:"name_2,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *InvmgrEepromOpaqueData_KEYS) Reset() { *m = InvmgrEepromOpaqueData_KEYS{} } func (m *InvmgrEepromOpaqueData_KEYS) String() string { return proto.CompactTextString(m) } func (*InvmgrEepromOpaqueData_KEYS) ProtoMessage() {} func (*InvmgrEepromOpaqueData_KEYS) Descriptor() ([]byte, []int) { return fileDescriptor_6030716c6d5948f0, []int{0} } func (m *InvmgrEepromOpaqueData_KEYS) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InvmgrEepromOpaqueData_KEYS.Unmarshal(m, b) } func (m *InvmgrEepromOpaqueData_KEYS) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_InvmgrEepromOpaqueData_KEYS.Marshal(b, m, deterministic) } func (m *InvmgrEepromOpaqueData_KEYS) XXX_Merge(src proto.Message) { xxx_messageInfo_InvmgrEepromOpaqueData_KEYS.Merge(m, src) } func (m *InvmgrEepromOpaqueData_KEYS) XXX_Size() int { return xxx_messageInfo_InvmgrEepromOpaqueData_KEYS.Size(m) } func (m *InvmgrEepromOpaqueData_KEYS) XXX_DiscardUnknown() { xxx_messageInfo_InvmgrEepromOpaqueData_KEYS.DiscardUnknown(m) } var xxx_messageInfo_InvmgrEepromOpaqueData_KEYS proto.InternalMessageInfo func (m *InvmgrEepromOpaqueData_KEYS) GetName() string { if m != nil { return m.Name } return "" } func (m *InvmgrEepromOpaqueData_KEYS) GetName_1() string { if m != nil { return m.Name_1 } return "" } func (m *InvmgrEepromOpaqueData_KEYS) GetName_2() string { if m != nil { return m.Name_2 } return "" } type RmaDetail struct { TestHistory string `protobuf:"bytes,1,opt,name=test_history,json=testHistory,proto3" json:"test_history,omitempty"` RmaNumber string `protobuf:"bytes,2,opt,name=rma_number,json=rmaNumber,proto3" json:"rma_number,omitempty"` RmaHistory string `protobuf:"bytes,3,opt,name=rma_history,json=rmaHistory,proto3" json:"rma_history,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *RmaDetail) Reset() { *m = RmaDetail{} } func (m *RmaDetail) String() string { return proto.CompactTextString(m) } func (*RmaDetail) ProtoMessage() {} func (*RmaDetail) Descriptor() ([]byte, []int) { return fileDescriptor_6030716c6d5948f0, []int{1} } func (m *RmaDetail) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RmaDetail.Unmarshal(m, b) } func (m *RmaDetail) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_RmaDetail.Marshal(b, m, deterministic) } func (m *RmaDetail) XXX_Merge(src proto.Message) { xxx_messageInfo_RmaDetail.Merge(m, src) } func (m *RmaDetail) XXX_Size() int { return xxx_messageInfo_RmaDetail.Size(m) } func (m *RmaDetail) XXX_DiscardUnknown() { xxx_messageInfo_RmaDetail.DiscardUnknown(m) } var xxx_messageInfo_RmaDetail proto.InternalMessageInfo func (m *RmaDetail) GetTestHistory() string { if m != nil { return m.TestHistory } return "" } func (m *RmaDetail) GetRmaNumber() string { if m != nil { return m.RmaNumber } return "" } func (m *RmaDetail) GetRmaHistory() string { if m != nil { return m.RmaHistory } return "" } type DiagEeprom struct { Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` IdpromFormatRev string `protobuf:"bytes,2,opt,name=idprom_format_rev,json=idpromFormatRev,proto3" json:"idprom_format_rev,omitempty"` ControllerFamily string `protobuf:"bytes,3,opt,name=controller_family,json=controllerFamily,proto3" json:"controller_family,omitempty"` ControllerType string `protobuf:"bytes,4,opt,name=controller_type,json=controllerType,proto3" json:"controller_type,omitempty"` Vid string `protobuf:"bytes,5,opt,name=vid,proto3" json:"vid,omitempty"` Hwid string `protobuf:"bytes,6,opt,name=hwid,proto3" json:"hwid,omitempty"` Pid string `protobuf:"bytes,7,opt,name=pid,proto3" json:"pid,omitempty"` UdiDescription string `protobuf:"bytes,8,opt,name=udi_description,json=udiDescription,proto3" json:"udi_description,omitempty"` UdiName string `protobuf:"bytes,9,opt,name=udi_name,json=udiName,proto3" json:"udi_name,omitempty"` Clei string `protobuf:"bytes,10,opt,name=clei,proto3" json:"clei,omitempty"` Eci string `protobuf:"bytes,11,opt,name=eci,proto3" json:"eci,omitempty"` TopAssemPartNum string `protobuf:"bytes,12,opt,name=top_assem_part_num,json=topAssemPartNum,proto3" json:"top_assem_part_num,omitempty"` TopAssemVid string `protobuf:"bytes,13,opt,name=top_assem_vid,json=topAssemVid,proto3" json:"top_assem_vid,omitempty"` PcaNum string `protobuf:"bytes,14,opt,name=pca_num,json=pcaNum,proto3" json:"pca_num,omitempty"` Pcavid string `protobuf:"bytes,15,opt,name=pcavid,proto3" json:"pcavid,omitempty"` ChassisSid string `protobuf:"bytes,16,opt,name=chassis_sid,json=chassisSid,proto3" json:"chassis_sid,omitempty"` DevNum1 string `protobuf:"bytes,17,opt,name=dev_num1,json=devNum1,proto3" json:"dev_num1,omitempty"` DevNum2 string `protobuf:"bytes,18,opt,name=dev_num2,json=devNum2,proto3" json:"dev_num2,omitempty"` DevNum3 string `protobuf:"bytes,19,opt,name=dev_num3,json=devNum3,proto3" json:"dev_num3,omitempty"` DevNum4 string `protobuf:"bytes,20,opt,name=dev_num4,json=devNum4,proto3" json:"dev_num4,omitempty"` DevNum5 string `protobuf:"bytes,21,opt,name=dev_num5,json=devNum5,proto3" json:"dev_num5,omitempty"` DevNum6 string `protobuf:"bytes,22,opt,name=dev_num6,json=devNum6,proto3" json:"dev_num6,omitempty"` DevNum7 string `protobuf:"bytes,23,opt,name=dev_num7,json=devNum7,proto3" json:"dev_num7,omitempty"` ManuTestData string `protobuf:"bytes,24,opt,name=manu_test_data,json=manuTestData,proto3" json:"manu_test_data,omitempty"` Rma *RmaDetail `protobuf:"bytes,25,opt,name=rma,proto3" json:"rma,omitempty"` AssetId string `protobuf:"bytes,26,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` AssetAlias string `protobuf:"bytes,27,opt,name=asset_alias,json=assetAlias,proto3" json:"asset_alias,omitempty"` BaseMacAddress1 string `protobuf:"bytes,28,opt,name=base_mac_address1,json=baseMacAddress1,proto3" json:"base_mac_address1,omitempty"` MacAddBlkSize1 string `protobuf:"bytes,29,opt,name=mac_add_blk_size1,json=macAddBlkSize1,proto3" json:"mac_add_blk_size1,omitempty"` BaseMacAddress2 string `protobuf:"bytes,30,opt,name=base_mac_address2,json=baseMacAddress2,proto3" json:"base_mac_address2,omitempty"` MacAddBlkSize2 string `protobuf:"bytes,31,opt,name=mac_add_blk_size2,json=macAddBlkSize2,proto3" json:"mac_add_blk_size2,omitempty"` BaseMacAddress3 string `protobuf:"bytes,32,opt,name=base_mac_address3,json=baseMacAddress3,proto3" json:"base_mac_address3,omitempty"` MacAddBlkSize3 string `protobuf:"bytes,33,opt,name=mac_add_blk_size3,json=macAddBlkSize3,proto3" json:"mac_add_blk_size3,omitempty"` BaseMacAddress4 string `protobuf:"bytes,34,opt,name=base_mac_address4,json=baseMacAddress4,proto3" json:"base_mac_address4,omitempty"` MacAddBlkSize4 string `protobuf:"bytes,35,opt,name=mac_add_blk_size4,json=macAddBlkSize4,proto3" json:"mac_add_blk_size4,omitempty"` PcbSerialNum string `protobuf:"bytes,36,opt,name=pcb_serial_num,json=pcbSerialNum,proto3" json:"pcb_serial_num,omitempty"` PowerSupplyType string `protobuf:"bytes,37,opt,name=power_supply_type,json=powerSupplyType,proto3" json:"power_supply_type,omitempty"` PowerConsumption string `protobuf:"bytes,38,opt,name=power_consumption,json=powerConsumption,proto3" json:"power_consumption,omitempty"` BlockSignature string `protobuf:"bytes,39,opt,name=block_signature,json=blockSignature,proto3" json:"block_signature,omitempty"` BlockVersion string `protobuf:"bytes,40,opt,name=block_version,json=blockVersion,proto3" json:"block_version,omitempty"` BlockLength string `protobuf:"bytes,41,opt,name=block_length,json=blockLength,proto3" json:"block_length,omitempty"` BlockChecksum string `protobuf:"bytes,42,opt,name=block_checksum,json=blockChecksum,proto3" json:"block_checksum,omitempty"` EepromSize string `protobuf:"bytes,43,opt,name=eeprom_size,json=eepromSize,proto3" json:"eeprom_size,omitempty"` BlockCount string `protobuf:"bytes,44,opt,name=block_count,json=blockCount,proto3" json:"block_count,omitempty"` FruMajorType string `protobuf:"bytes,45,opt,name=fru_major_type,json=fruMajorType,proto3" json:"fru_major_type,omitempty"` FruMinorType string `protobuf:"bytes,46,opt,name=fru_minor_type,json=fruMinorType,proto3" json:"fru_minor_type,omitempty"` OemString string `protobuf:"bytes,47,opt,name=oem_string,json=oemString,proto3" json:"oem_string,omitempty"` ProductId string `protobuf:"bytes,48,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"` SerialNumber string `protobuf:"bytes,49,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"` PartNumber string `protobuf:"bytes,50,opt,name=part_number,json=partNumber,proto3" json:"part_number,omitempty"` PartRevision string `protobuf:"bytes,51,opt,name=part_revision,json=partRevision,proto3" json:"part_revision,omitempty"` MfgDeviation string `protobuf:"bytes,52,opt,name=mfg_deviation,json=mfgDeviation,proto3" json:"mfg_deviation,omitempty"` HwVersion string `protobuf:"bytes,53,opt,name=hw_version,json=hwVersion,proto3" json:"hw_version,omitempty"` MfgBits string `protobuf:"bytes,54,opt,name=mfg_bits,json=mfgBits,proto3" json:"mfg_bits,omitempty"` EngineerUse string `protobuf:"bytes,55,opt,name=engineer_use,json=engineerUse,proto3" json:"engineer_use,omitempty"` Snmpoid string `protobuf:"bytes,56,opt,name=snmpoid,proto3" json:"snmpoid,omitempty"` RmaCode string `protobuf:"bytes,57,opt,name=rma_code,json=rmaCode,proto3" json:"rma_code,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *DiagEeprom) Reset() { *m = DiagEeprom{} } func (m *DiagEeprom) String() string { return proto.CompactTextString(m) } func (*DiagEeprom) ProtoMessage() {} func (*DiagEeprom) Descriptor() ([]byte, []int) { return fileDescriptor_6030716c6d5948f0, []int{2} } func (m *DiagEeprom) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DiagEeprom.Unmarshal(m, b) } func (m *DiagEeprom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_DiagEeprom.Marshal(b, m, deterministic) } func (m *DiagEeprom) XXX_Merge(src proto.Message) { xxx_messageInfo_DiagEeprom.Merge(m, src) } func (m *DiagEeprom) XXX_Size() int { return xxx_messageInfo_DiagEeprom.Size(m) } func (m *DiagEeprom) XXX_DiscardUnknown() { xxx_messageInfo_DiagEeprom.DiscardUnknown(m) } var xxx_messageInfo_DiagEeprom proto.InternalMessageInfo func (m *DiagEeprom) GetDescription() string { if m != nil { return m.Description } return "" } func (m *DiagEeprom) GetIdpromFormatRev() string { if m != nil { return m.IdpromFormatRev } return "" } func (m *DiagEeprom) GetControllerFamily() string { if m != nil { return m.ControllerFamily } return "" } func (m *DiagEeprom) GetControllerType() string { if m != nil { return m.ControllerType } return "" } func (m *DiagEeprom) GetVid() string { if m != nil { return m.Vid } return "" } func (m *DiagEeprom) GetHwid() string { if m != nil { return m.Hwid } return "" } func (m *DiagEeprom) GetPid() string { if m != nil { return m.Pid } return "" } func (m *DiagEeprom) GetUdiDescription() string { if m != nil { return m.UdiDescription } return "" } func (m *DiagEeprom) GetUdiName() string { if m != nil { return m.UdiName } return "" } func (m *DiagEeprom) GetClei() string { if m != nil { return m.Clei } return "" } func (m *DiagEeprom) GetEci() string { if m != nil { return m.Eci } return "" } func (m *DiagEeprom) GetTopAssemPartNum() string { if m != nil { return m.TopAssemPartNum } return "" } func (m *DiagEeprom) GetTopAssemVid() string { if m != nil { return m.TopAssemVid } return "" } func (m *DiagEeprom) GetPcaNum() string { if m != nil { return m.PcaNum } return "" } func (m *DiagEeprom) GetPcavid() string { if m != nil { return m.Pcavid } return "" } func (m *DiagEeprom) GetChassisSid() string { if m != nil { return m.ChassisSid } return "" } func (m *DiagEeprom) GetDevNum1() string { if m != nil { return m.DevNum1 } return "" } func (m *DiagEeprom) GetDevNum2() string { if m != nil { return m.DevNum2 } return "" } func (m *DiagEeprom) GetDevNum3() string { if m != nil { return m.DevNum3 } return "" } func (m *DiagEeprom) GetDevNum4() string { if m != nil { return m.DevNum4 } return "" } func (m *DiagEeprom) GetDevNum5() string { if m != nil { return m.DevNum5 } return "" } func (m *DiagEeprom) GetDevNum6() string { if m != nil { return m.DevNum6 } return "" } func (m *DiagEeprom) GetDevNum7() string { if m != nil { return m.DevNum7 } return "" } func (m *DiagEeprom) GetManuTestData() string { if m != nil { return m.ManuTestData } return "" } func (m *DiagEeprom) GetRma() *RmaDetail { if m != nil { return m.Rma } return nil } func (m *DiagEeprom) GetAssetId() string { if m != nil { return m.AssetId } return "" } func (m *DiagEeprom) GetAssetAlias() string { if m != nil { return m.AssetAlias } return "" } func (m *DiagEeprom) GetBaseMacAddress1() string { if m != nil { return m.BaseMacAddress1 } return "" } func (m *DiagEeprom) GetMacAddBlkSize1() string { if m != nil { return m.MacAddBlkSize1 } return "" } func (m *DiagEeprom) GetBaseMacAddress2() string { if m != nil { return m.BaseMacAddress2 } return "" } func (m *DiagEeprom) GetMacAddBlkSize2() string { if m != nil { return m.MacAddBlkSize2 } return "" } func (m *DiagEeprom) GetBaseMacAddress3() string { if m != nil { return m.BaseMacAddress3 } return "" } func (m *DiagEeprom) GetMacAddBlkSize3() string { if m != nil { return m.MacAddBlkSize3 } return "" } func (m *DiagEeprom) GetBaseMacAddress4() string { if m != nil { return m.BaseMacAddress4 } return "" } func (m *DiagEeprom) GetMacAddBlkSize4() string { if m != nil { return m.MacAddBlkSize4 } return "" } func (m *DiagEeprom) GetPcbSerialNum() string { if m != nil { return m.PcbSerialNum } return "" } func (m *DiagEeprom) GetPowerSupplyType() string { if m != nil { return m.PowerSupplyType } return "" } func (m *DiagEeprom) GetPowerConsumption() string { if m != nil { return m.PowerConsumption } return "" } func (m *DiagEeprom) GetBlockSignature() string { if m != nil { return m.BlockSignature } return "" } func (m *DiagEeprom) GetBlockVersion() string { if m != nil { return m.BlockVersion } return "" } func (m *DiagEeprom) GetBlockLength() string { if m != nil { return m.BlockLength } return "" } func (m *DiagEeprom) GetBlockChecksum() string { if m != nil { return m.BlockChecksum } return "" } func (m *DiagEeprom) GetEepromSize() string { if m != nil { return m.EepromSize } return "" } func (m *DiagEeprom) GetBlockCount() string { if m != nil { return m.BlockCount } return "" } func (m *DiagEeprom) GetFruMajorType() string { if m != nil { return m.FruMajorType } return "" } func (m *DiagEeprom) GetFruMinorType() string { if m != nil { return m.FruMinorType } return "" } func (m *DiagEeprom) GetOemString() string { if m != nil { return m.OemString } return "" } func (m *DiagEeprom) GetProductId() string { if m != nil { return m.ProductId } return "" } func (m *DiagEeprom) GetSerialNumber() string { if m != nil { return m.SerialNumber } return "" } func (m *DiagEeprom) GetPartNumber() string { if m != nil { return m.PartNumber } return "" } func (m *DiagEeprom) GetPartRevision() string { if m != nil { return m.PartRevision } return "" } func (m *DiagEeprom) GetMfgDeviation() string { if m != nil { return m.MfgDeviation } return "" } func (m *DiagEeprom) GetHwVersion() string { if m != nil { return m.HwVersion } return "" } func (m *DiagEeprom) GetMfgBits() string { if m != nil { return m.MfgBits } return "" } func (m *DiagEeprom) GetEngineerUse() string { if m != nil { return m.EngineerUse } return "" } func (m *DiagEeprom) GetSnmpoid() string { if m != nil { return m.Snmpoid } return "" } func (m *DiagEeprom) GetRmaCode() string { if m != nil { return m.RmaCode } return "" } type InvmgrEepromOpaqueData struct { InvCardType uint32 `protobuf:"varint,50,opt,name=inv_card_type,json=invCardType,proto3" json:"inv_card_type,omitempty"` OpaqueData []uint32 `protobuf:"varint,51,rep,packed,name=opaque_data,json=opaqueData,proto3" json:"opaque_data,omitempty"` OpaqueDataSize uint32 `protobuf:"varint,52,opt,name=opaque_data_size,json=opaqueDataSize,proto3" json:"opaque_data_size,omitempty"` HasEeprom uint32 `protobuf:"varint,53,opt,name=has_eeprom,json=hasEeprom,proto3" json:"has_eeprom,omitempty"` Eeprom *DiagEeprom `protobuf:"bytes,54,opt,name=eeprom,proto3" json:"eeprom,omitempty"` Description string `protobuf:"bytes,55,opt,name=description,proto3" json:"description,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } func (m *InvmgrEepromOpaqueData) Reset() { *m = InvmgrEepromOpaqueData{} } func (m *InvmgrEepromOpaqueData) String() string { return proto.CompactTextString(m) } func (*InvmgrEepromOpaqueData) ProtoMessage() {} func (*InvmgrEepromOpaqueData) Descriptor() ([]byte, []int) { return fileDescriptor_6030716c6d5948f0, []int{3} } func (m *InvmgrEepromOpaqueData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InvmgrEepromOpaqueData.Unmarshal(m, b) } func (m *InvmgrEepromOpaqueData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_InvmgrEepromOpaqueData.Marshal(b, m, deterministic) } func (m *InvmgrEepromOpaqueData) XXX_Merge(src proto.Message) { xxx_messageInfo_InvmgrEepromOpaqueData.Merge(m, src) } func (m *InvmgrEepromOpaqueData) XXX_Size() int { return xxx_messageInfo_InvmgrEepromOpaqueData.Size(m) } func (m *InvmgrEepromOpaqueData) XXX_DiscardUnknown() { xxx_messageInfo_InvmgrEepromOpaqueData.DiscardUnknown(m) } var xxx_messageInfo_InvmgrEepromOpaqueData proto.InternalMessageInfo func (m *InvmgrEepromOpaqueData) GetInvCardType() uint32 { if m != nil { return m.InvCardType } return 0 } func (m *InvmgrEepromOpaqueData) GetOpaqueData() []uint32 { if m != nil { return m.OpaqueData } return nil } func (m *InvmgrEepromOpaqueData) GetOpaqueDataSize() uint32 { if m != nil { return m.OpaqueDataSize } return 0 } func (m *InvmgrEepromOpaqueData) GetHasEeprom() uint32 { if m != nil { return m.HasEeprom } return 0 } func (m *InvmgrEepromOpaqueData) GetEeprom() *DiagEeprom { if m != nil { return m.Eeprom } return nil } func (m *InvmgrEepromOpaqueData) GetDescription() string { if m != nil { return m.Description } return "" } func init() { proto.RegisterType((*InvmgrEepromOpaqueData_KEYS)(nil), "cisco_ios_xr_invmgr_oper.inventory.racks.rack.fantray.slot.tsi1s.tsi1.attributes.inv_eeprom_info.invmgr_eeprom_opaque_data_KEYS") proto.RegisterType((*RmaDetail)(nil), "cisco_ios_xr_invmgr_oper.inventory.racks.rack.fantray.slot.tsi1s.tsi1.attributes.inv_eeprom_info.rma_detail") proto.RegisterType((*DiagEeprom)(nil), "cisco_ios_xr_invmgr_oper.inventory.racks.rack.fantray.slot.tsi1s.tsi1.attributes.inv_eeprom_info.diag_eeprom") proto.RegisterType((*InvmgrEepromOpaqueData)(nil), "cisco_ios_xr_invmgr_oper.inventory.racks.rack.fantray.slot.tsi1s.tsi1.attributes.inv_eeprom_info.invmgr_eeprom_opaque_data") } func init() { proto.RegisterFile("invmgr_eeprom_opaque_data.proto", fileDescriptor_6030716c6d5948f0) } var fileDescriptor_6030716c6d5948f0 = []byte{ // 1192 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x5f, 0x73, 0x13, 0xb7, 0x17, 0x9d, 0x10, 0x70, 0x88, 0x8c, 0xf3, 0x47, 0xbf, 0x1f, 0xa0, 0xb4, 0x85, 0x04, 0x03, 0x25, 0x90, 0xd6, 0xad, 0xff, 0x90, 0xb4, 0x8f, 0x10, 0x60, 0xca, 0xb4, 0x64, 0x3a, 0x36, 0x65, 0xa6, 0x4f, 0xaa, 0xbc, 0x92, 0x6d, 0x35, 0xab, 0xd5, 0x56, 0xd2, 0x3a, 0x4d, 0x1f, 0xfa, 0xd6, 0x4f, 0xd8, 0xef, 0xd2, 0xe7, 0xce, 0xd5, 0xdd, 0xc5, 0x3b, 0xd3, 0xe5, 0x91, 0x97, 0x64, 0x7d, 0xce, 0xd1, 0xb9, 0xd2, 0xbd, 0xd2, 0x95, 0xc8, 0xbe, 0xce, 0x96, 0x66, 0xee, 0xb8, 0x52, 0xb9, 0xb3, 0x86, 0xdb, 0x5c, 0xfc, 0x56, 0x28, 0x2e, 0x45, 0x10, 0xbd, 0xdc, 0xd9, 0x60, 0xe9, 0x2f, 0x89, 0xf6, 0x89, 0xe5, 0xda, 0x7a, 0xfe, 0xbb, 0xe3, 0xa5, 0xda, 0xe6, 0xca, 0xf5, 0x74, 0xb6, 0x54, 0x59, 0xb0, 0xee, 0xb2, 0xe7, 0x44, 0x72, 0xee, 0xe3, 0xdf, 0xde, 0x4c, 0x64, 0xc1, 0x89, 0xcb, 0x9e, 0x4f, 0x6d, 0xe8, 0x05, 0xaf, 0xfb, 0x3e, 0xfe, 0xed, 0x89, 0x10, 0x9c, 0x9e, 0x16, 0x41, 0x79, 0x18, 0x57, 0x85, 0xd3, 0xd9, 0xcc, 0x76, 0xa7, 0xe4, 0xee, 0x07, 0x27, 0xc1, 0xbf, 0x7f, 0xf9, 0xf3, 0x84, 0x52, 0x72, 0x35, 0x13, 0x46, 0xb1, 0xb5, 0x83, 0xb5, 0xc3, 0xcd, 0x71, 0xfc, 0xa6, 0x37, 0x49, 0x0b, 0xfe, 0xf3, 0x3e, 0xbb, 0x12, 0xd1, 0x6b, 0xf0, 0xab, 0xff, 0x1e, 0x1e, 0xb0, 0xf5, 0x15, 0x3c, 0xe8, 0x5a, 0x42, 0x9c, 0x11, 0x5c, 0xaa, 0x20, 0x74, 0x4a, 0xef, 0x91, 0x1b, 0x41, 0xf9, 0xc0, 0x17, 0xda, 0xc3, 0xfc, 0x4b, 0xdf, 0x36, 0x60, 0xdf, 0x21, 0x44, 0xef, 0xe0, 0x80, 0xac, 0x30, 0x53, 0xe5, 0xca, 0x10, 0x9b, 0xce, 0x88, 0xb3, 0x08, 0xd0, 0x7d, 0xd2, 0x06, 0xba, 0x32, 0xc0, 0x58, 0x30, 0xa2, 0x1c, 0xdf, 0xfd, 0x67, 0x9b, 0xb4, 0xa5, 0x16, 0xf3, 0x72, 0x4d, 0xf4, 0x80, 0xb4, 0xa5, 0xf2, 0x89, 0xd3, 0x79, 0xd0, 0x36, 0xab, 0x22, 0xd6, 0x20, 0xfa, 0x84, 0xec, 0x6a, 0x19, 0xd7, 0x3f, 0xb3, 0xce, 0x88, 0xc0, 0x9d, 0x5a, 0x96, 0x81, 0xb7, 0x91, 0x78, 0x15, 0xf1, 0xb1, 0x5a, 0xd2, 0x23, 0xb2, 0x9b, 0xd8, 0x2c, 0x38, 0x9b, 0xa6, 0xca, 0xf1, 0x99, 0x30, 0x3a, 0xad, 0x26, 0xb1, 0xb3, 0x22, 0x5e, 0x45, 0x9c, 0x3e, 0x22, 0xdb, 0x35, 0x71, 0xb8, 0xcc, 0x15, 0xbb, 0x1a, 0xa5, 0x5b, 0x2b, 0xf8, 0xed, 0x65, 0xae, 0xe8, 0x0e, 0x59, 0x5f, 0x6a, 0xc9, 0xae, 0x45, 0x12, 0x3e, 0x21, 0xf1, 0x8b, 0x0b, 0x2d, 0x59, 0x0b, 0x13, 0x0f, 0xdf, 0xa0, 0xca, 0xb5, 0x64, 0x1b, 0xa8, 0xca, 0xb5, 0x84, 0x00, 0x85, 0xd4, 0xbc, 0xbe, 0xbe, 0xeb, 0x18, 0xa0, 0x90, 0xfa, 0x45, 0x6d, 0x89, 0x7b, 0xe4, 0x3a, 0x08, 0x63, 0x2d, 0x37, 0xa3, 0x62, 0xa3, 0x90, 0xfa, 0x0c, 0xca, 0x49, 0xc9, 0xd5, 0x24, 0x55, 0x9a, 0x11, 0x8c, 0x04, 0xdf, 0x10, 0x49, 0x25, 0x9a, 0xb5, 0x31, 0x92, 0x4a, 0x34, 0x3d, 0x22, 0x34, 0xd8, 0x9c, 0x0b, 0xef, 0x95, 0xe1, 0xb9, 0x70, 0x01, 0x0a, 0xc4, 0x6e, 0x60, 0x92, 0x82, 0xcd, 0x9f, 0x01, 0xf1, 0xa3, 0x70, 0xe1, 0xac, 0x30, 0xb4, 0x4b, 0x3a, 0x2b, 0x31, 0x2c, 0xac, 0x53, 0x96, 0xb9, 0xd4, 0xbd, 0xd3, 0x92, 0xde, 0x26, 0x1b, 0x79, 0x12, 0xcb, 0xcc, 0xb6, 0x22, 0xdb, 0xca, 0x13, 0xa8, 0x31, 0xbd, 0x45, 0xe0, 0x0b, 0x46, 0x6d, 0xbf, 0xc7, 0x21, 0x23, 0xfb, 0xa4, 0x9d, 0x2c, 0x84, 0xf7, 0xda, 0x73, 0xaf, 0x25, 0xdb, 0xc1, 0xc2, 0x97, 0xd0, 0x44, 0x4b, 0x58, 0xa3, 0x54, 0x4b, 0x70, 0xec, 0xb3, 0x5d, 0x5c, 0xa3, 0x54, 0xcb, 0xb3, 0xc2, 0xf4, 0x6b, 0xd4, 0x80, 0xd1, 0x3a, 0x35, 0xa8, 0x51, 0x43, 0xf6, 0xbf, 0x3a, 0x35, 0xac, 0x51, 0x23, 0xf6, 0xff, 0x3a, 0x35, 0xaa, 0x51, 0x4f, 0xd9, 0xcd, 0x3a, 0xf5, 0xb4, 0x46, 0x1d, 0xb3, 0x5b, 0x75, 0xea, 0xb8, 0x46, 0x9d, 0xb0, 0xdb, 0x75, 0xea, 0x84, 0x3e, 0x20, 0x5b, 0x46, 0x64, 0x05, 0x8f, 0xa7, 0x03, 0xce, 0x1f, 0x63, 0x51, 0x70, 0x03, 0xd0, 0xb7, 0xca, 0x87, 0x17, 0x22, 0x08, 0xfa, 0x27, 0x59, 0x77, 0x46, 0xb0, 0xbd, 0x83, 0xb5, 0xc3, 0xf6, 0x20, 0xed, 0x7d, 0xec, 0x06, 0xd1, 0x5b, 0x9d, 0xdc, 0x31, 0x04, 0x86, 0x05, 0x40, 0x51, 0x03, 0xd7, 0x92, 0x7d, 0x82, 0x0b, 0x88, 0xbf, 0x5f, 0xc7, 0xf2, 0x20, 0x25, 0x52, 0x2d, 0x3c, 0xfb, 0x14, 0xcb, 0x13, 0xa1, 0x67, 0x80, 0xc0, 0x29, 0x9b, 0x0a, 0xaf, 0xb8, 0x11, 0x09, 0x17, 0x52, 0x3a, 0xe5, 0x7d, 0x9f, 0x7d, 0x86, 0x1b, 0x08, 0x88, 0x37, 0x22, 0x79, 0x56, 0xc2, 0xf4, 0x31, 0xd9, 0x2d, 0x65, 0x7c, 0x9a, 0x9e, 0x73, 0xaf, 0xff, 0x50, 0x7d, 0x76, 0x07, 0x77, 0xb6, 0x89, 0xba, 0xe7, 0xe9, 0xf9, 0x04, 0xd0, 0x26, 0xdb, 0x01, 0xbb, 0xdb, 0x64, 0x3b, 0x68, 0xb2, 0x1d, 0xb0, 0xfd, 0x06, 0xdb, 0x41, 0x93, 0xed, 0x90, 0x1d, 0x34, 0xd9, 0x0e, 0x9b, 0x6c, 0x87, 0xec, 0x5e, 0x83, 0xed, 0xb0, 0xc9, 0x76, 0xc4, 0xba, 0x4d, 0xb6, 0xa3, 0x26, 0xdb, 0x11, 0xbb, 0xdf, 0x60, 0x3b, 0x82, 0xdd, 0x93, 0x27, 0x53, 0xee, 0x95, 0xd3, 0x22, 0x8d, 0x67, 0xea, 0x01, 0xee, 0x9e, 0x3c, 0x99, 0x4e, 0x22, 0x08, 0x27, 0xeb, 0x09, 0xd9, 0xcd, 0xed, 0x85, 0x72, 0xdc, 0x17, 0x79, 0x9e, 0x5e, 0x62, 0x43, 0x7a, 0x88, 0xc1, 0x23, 0x31, 0x89, 0x78, 0xec, 0x48, 0x47, 0x95, 0x36, 0xb1, 0x99, 0x2f, 0x0c, 0xf6, 0x96, 0xcf, 0xb1, 0xcf, 0x45, 0xe2, 0x74, 0x85, 0x43, 0x1b, 0x9a, 0xa6, 0x36, 0x81, 0x39, 0xce, 0x33, 0x11, 0x0a, 0xa7, 0xd8, 0x23, 0x9c, 0x67, 0x84, 0x27, 0x15, 0x4a, 0xef, 0x93, 0x0e, 0x0a, 0x97, 0xca, 0x79, 0x70, 0x3c, 0xc4, 0x69, 0x46, 0xf0, 0x1d, 0x62, 0x70, 0x47, 0xa0, 0x28, 0x55, 0xd9, 0x3c, 0x2c, 0xd8, 0x63, 0x6c, 0x1e, 0x11, 0xfb, 0x21, 0x42, 0xf4, 0x21, 0x41, 0x67, 0x9e, 0x2c, 0x54, 0x72, 0xee, 0x0b, 0xc3, 0x9e, 0x44, 0x11, 0xba, 0x9f, 0x96, 0x20, 0xec, 0xc9, 0x72, 0x37, 0x43, 0xf2, 0xd8, 0x11, 0xee, 0x49, 0x84, 0x20, 0x71, 0x20, 0x28, 0x7d, 0x6c, 0x91, 0x05, 0xf6, 0x05, 0x0a, 0xd0, 0x04, 0x10, 0x48, 0xec, 0xcc, 0x15, 0xdc, 0x88, 0x5f, 0x6d, 0xd9, 0xc0, 0xbf, 0xc4, 0x19, 0xcf, 0x5c, 0xf1, 0x06, 0xc0, 0x98, 0xac, 0x4a, 0xa5, 0xb3, 0x4a, 0xd5, 0x5b, 0xa9, 0x00, 0x8c, 0xaa, 0x3b, 0x84, 0x58, 0x65, 0xb8, 0x0f, 0x4e, 0x67, 0x73, 0xf6, 0x15, 0x5e, 0x6c, 0x56, 0x99, 0x49, 0x04, 0x80, 0xce, 0x9d, 0x95, 0x45, 0x12, 0x4f, 0xd7, 0xd7, 0x48, 0x97, 0xc8, 0x6b, 0x09, 0xa9, 0x5b, 0x95, 0x17, 0x6e, 0xc6, 0x3e, 0x86, 0xf0, 0x55, 0x79, 0xcb, 0xcb, 0xb1, 0xea, 0xcd, 0x20, 0x19, 0xe0, 0x7a, 0x72, 0x6c, 0xcb, 0x20, 0xb8, 0x4f, 0x3a, 0x51, 0xe0, 0xd4, 0x52, 0xc7, 0x02, 0x0c, 0xcb, 0x7d, 0x22, 0x1c, 0x5c, 0x6f, 0x11, 0x03, 0x91, 0x99, 0xcd, 0xb9, 0x54, 0x4b, 0x2d, 0x62, 0xdd, 0x47, 0x65, 0x2b, 0x9a, 0xcd, 0x5f, 0x54, 0x18, 0x4c, 0x77, 0x71, 0xf1, 0xbe, 0x8e, 0x4f, 0x71, 0xba, 0x8b, 0x8b, 0xaa, 0x88, 0x7b, 0xe4, 0x3a, 0x78, 0x4c, 0x75, 0xf0, 0xec, 0x18, 0x3b, 0x85, 0x99, 0xcd, 0x9f, 0xeb, 0xe0, 0xa1, 0xbe, 0x2a, 0x9b, 0xeb, 0x4c, 0x29, 0xc7, 0x0b, 0xaf, 0xd8, 0x09, 0xd6, 0xb7, 0xc2, 0x7e, 0xf2, 0x8a, 0x32, 0xb2, 0xe1, 0x33, 0x93, 0x5b, 0x2d, 0xd9, 0x37, 0x38, 0xb8, 0xfc, 0x09, 0xbe, 0xd0, 0x94, 0x12, 0x2b, 0x15, 0xfb, 0x16, 0x29, 0x67, 0xc4, 0xa9, 0x95, 0xaa, 0xfb, 0xf7, 0x15, 0xb2, 0xf7, 0xc1, 0xe7, 0x0c, 0xdc, 0x49, 0xd0, 0xdd, 0x12, 0xe1, 0x24, 0x96, 0x08, 0x92, 0xd3, 0x19, 0xb7, 0x75, 0xb6, 0x3c, 0x15, 0x4e, 0xc6, 0x0a, 0xed, 0x93, 0x76, 0x6d, 0x08, 0x1b, 0x1e, 0xac, 0x1f, 0x76, 0xc6, 0x04, 0xa1, 0xd8, 0x7f, 0x0f, 0xc9, 0x4e, 0xfd, 0x89, 0x14, 0x77, 0xd5, 0x28, 0xfa, 0x6c, 0xad, 0x54, 0x71, 0x67, 0x41, 0x7a, 0x84, 0x2f, 0x27, 0x12, 0xd3, 0xd3, 0x19, 0x6f, 0x2e, 0x84, 0x7f, 0x89, 0x8f, 0x92, 0xbf, 0xd6, 0x48, 0xab, 0xe4, 0x8e, 0x63, 0x33, 0x37, 0x1f, 0xbf, 0x99, 0xd7, 0x1e, 0x45, 0xe3, 0x56, 0xf3, 0xe3, 0xe8, 0xe4, 0x3f, 0x8f, 0xa3, 0x69, 0x2b, 0x3e, 0x46, 0x87, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x4b, 0xcd, 0xd1, 0x1c, 0xaf, 0x0a, 0x00, 0x00, }
Bloodb0ne/bolt
src/commands/versions.js
<gh_stars>1000+ // @flow import * as options from '../utils/options'; import { BoltError } from '../utils/errors'; export type VersionsOptions = {}; export function toVersionsOptions( args: options.Args, flags: options.Flags ): VersionsOptions { return {}; } export async function versions(opts: VersionsOptions) { throw new BoltError('Unimplemented command "versions"'); }
adesutherland/crexx
re2c/bootstrap/src/parse/lex.cc
/* Generated by re2c 2.1.1 on Fri May 28 10:53:19 2021 */ #line 1 "../src/parse/lex.re" #include <ctype.h> #include "src/util/c99_stdint.h" #include <algorithm> #include <limits> #include <string> #include <utility> #include <vector> #include "src/codegen/code.h" #include "src/encoding/enc.h" #include "src/msg/location.h" #include "src/msg/msg.h" #include "src/msg/warn.h" #include "src/options/opt.h" #include "src/parse/ast.h" #include "src/parse/input.h" #include "src/parse/lex.h" #include "src/parse/scanner.h" #include "src/parse/parse.h" // needed by "parser.h" #include "src/parse/unescape.h" #include "src/regexp/rule.h" #include "src/util/s_to_n32_unsafe.h" #include "src/util/string_utils.h" #include "parser.h" extern YYSTYPE yylval; namespace re2c { #define YYCTYPE unsigned char #define YYCURSOR cur #define YYLIMIT lim #define YYMARKER mar #define YYFILL(n) do { if (!fill(n)) { error("unexpected end of input"); exit(1); }} while(0) #line 62 "../src/parse/lex.re" #line 121 "../src/parse/lex.re" static inline void save_string(std::string &str, const char *s, const char *e) { if (s == NULL) { str.clear(); } else { str.assign(s, e); } } void Scanner::error_block_start(const char *block) const { msg.error(cur_loc(), "ill-formed start of a block: expected `/*!%s`" " followed by a space, a newline or the end of block `*/`", block); } void Scanner::error_named_block_start(const char *block) const { msg.error(cur_loc(), "ill-formed start of a block: expected `/*!%s`" ", optionally followed by a name of the form `:[a-zA-Z_][a-zA-Z0-9_]*`" ", followed by a space, a newline or the end of block `*/`", block); } void Scanner::error_include_directive() const { msg.error(cur_loc(), "ill-formed include directive: expected `/*" // split string to prevent re2c from lexing this as a real directive "!include:re2c \"<file>\" */`"); } void Scanner::error_header_directive() const { msg.error(cur_loc(), "ill-formed header directive: expected `/*" // split string to prevent re2c from lexing this as a real directive "!header:re2c:<on|off>`" " followed by a space, a newline or the end of block `*/`"); } Scanner::ParseMode Scanner::echo(Output &out) { const opt_t *opts = out.block().opts; code_alc_t &alc = out.allocator; const char *x, *y; if (is_eof()) return Stop; next: tok = cur; loop: location = cur_loc(); ptr = cur; #line 96 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; static const unsigned char yybm[] = { 0, 64, 64, 64, 64, 64, 64, 64, 64, 80, 0, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 80, 64, 0, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 64, 64, 64, 64, 64, 64, 64, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 64, 0, 64, 64, 192, 64, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, }; if ((YYLIMIT - YYCURSOR) < 20) YYFILL(20); yych = (YYCTYPE)*YYCURSOR; if (yych <= '\r') { if (yych <= '\t') { if (yych >= 0x01) goto yy4; } else { if (yych <= '\n') goto yy6; if (yych <= '\f') goto yy4; goto yy8; } } else { if (yych <= '%') { if (yych <= '$') goto yy4; goto yy9; } else { if (yych == '/') goto yy10; goto yy4; } } ++YYCURSOR; #line 286 "../src/parse/lex.re" { if (is_eof()) { out.wraw(tok, ptr); return Stop; } goto loop; } #line 162 "src/parse/lex.cc" yy4: ++YYCURSOR; yy5: #line 306 "../src/parse/lex.re" { goto loop; } #line 168 "src/parse/lex.cc" yy6: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 16) { goto yy11; } if (yych == '#') goto yy14; yy7: #line 301 "../src/parse/lex.re" { next_line(); goto loop; } #line 182 "src/parse/lex.cc" yy8: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy6; goto yy5; yy9: yych = (YYCTYPE)*++YYCURSOR; if (yych == '{') goto yy16; goto yy5; yy10: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '*') goto yy18; goto yy5; yy11: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 16) { goto yy11; } if (yych == '#') goto yy14; yy13: YYCURSOR = YYMARKER; if (yyaccept <= 6) { if (yyaccept <= 3) { if (yyaccept <= 1) { if (yyaccept == 0) { goto yy7; } else { goto yy5; } } else { if (yyaccept == 2) { goto yy64; } else { goto yy121; } } } else { if (yyaccept <= 5) { if (yyaccept == 4) { goto yy128; } else { goto yy151; } } else { goto yy153; } } } else { if (yyaccept <= 10) { if (yyaccept <= 8) { if (yyaccept == 7) { goto yy155; } else { goto yy157; } } else { if (yyaccept == 9) { goto yy162; } else { goto yy164; } } } else { if (yyaccept <= 12) { if (yyaccept == 11) { goto yy186; } else { goto yy191; } } else { goto yy204; } } } yy14: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') goto yy14; goto yy13; } else { if (yych <= ' ') goto yy14; if (yych == 'l') goto yy19; goto yy13; } yy16: ++YYCURSOR; #line 173 "../src/parse/lex.re" { out.wraw(tok, ptr); return Parse; } #line 278 "src/parse/lex.cc" yy18: yych = (YYCTYPE)*++YYCURSOR; if (yych == '!') goto yy20; goto yy13; yy19: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy21; goto yy13; yy20: yych = (YYCTYPE)*++YYCURSOR; switch (yych) { case 'g': goto yy22; case 'h': goto yy23; case 'i': goto yy24; case 'm': goto yy25; case 'r': goto yy26; case 's': goto yy27; case 't': goto yy28; case 'u': goto yy29; default: goto yy13; } yy21: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy30; goto yy13; yy22: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy31; goto yy13; yy23: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy32; goto yy13; yy24: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'g') goto yy33; if (yych == 'n') goto yy34; goto yy13; yy25: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy35; if (yych == 't') goto yy36; goto yy13; yy26: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy37; if (yych == 'u') goto yy38; goto yy13; yy27: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy39; goto yy13; yy28: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'y') goto yy40; goto yy13; yy29: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy41; goto yy13; yy30: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy42; goto yy13; yy31: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy43; goto yy13; yy32: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy44; goto yy13; yy33: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy45; goto yy13; yy34: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy46; goto yy13; yy35: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'x') goto yy47; goto yy13; yy36: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy48; goto yy13; yy37: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy49; goto yy13; yy38: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'l') goto yy50; goto yy13; yy39: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy51; goto yy13; yy40: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'p') goto yy52; goto yy13; yy41: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy53; goto yy13; yy42: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '0') goto yy55; if (yych <= '9') goto yy13; goto yy55; yy43: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy56; goto yy13; yy44: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'd') goto yy57; goto yy13; yy45: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'o') goto yy58; goto yy13; yy46: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'l') goto yy59; goto yy13; yy47: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy60; if (yych == 'n') goto yy61; goto yy13; yy48: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'g') goto yy62; goto yy13; yy49: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy63; goto yy13; yy50: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy65; goto yy13; yy51: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'g') goto yy66; goto yy13; yy52: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy67; goto yy13; yy53: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy68; goto yy13; yy54: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; yy55: if (yych <= 0x1F) { if (yych == '\t') goto yy54; goto yy13; } else { if (yych <= ' ') goto yy54; if (yych <= '0') goto yy13; if (yych <= '9') { yyt1 = YYCURSOR; goto yy69; } goto yy13; } yy56: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy71; goto yy13; yy57: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy72; goto yy13; yy58: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy73; goto yy13; yy59: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'u') goto yy74; goto yy13; yy60: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy75; goto yy13; yy61: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'm') goto yy76; goto yy13; yy62: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy77; goto yy13; yy63: yyaccept = 2; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '\r') { if (yych <= 0x08) goto yy64; if (yych <= '\n') { yyt1 = YYCURSOR; goto yy78; } if (yych >= '\r') { yyt1 = YYCURSOR; goto yy78; } } else { if (yych <= ' ') { if (yych >= ' ') { yyt1 = YYCURSOR; goto yy78; } } else { if (yych == '*') { yyt1 = YYCURSOR; goto yy80; } } } yy64: #line 273 "../src/parse/lex.re" { error_block_start("re2c"); exit(1); } #line 511 "src/parse/lex.cc" yy65: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy81; goto yy13; yy66: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy82; goto yy13; yy67: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy83; goto yy13; yy68: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy84; goto yy13; yy69: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 32) { goto yy69; } if (yych <= '\f') { if (yych <= 0x08) goto yy13; if (yych <= '\t') goto yy85; if (yych <= '\n') goto yy87; goto yy13; } else { if (yych <= '\r') goto yy89; if (yych == ' ') goto yy85; goto yy13; } yy71: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy90; goto yy13; yy72: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy91; goto yy13; yy73: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy92; goto yy13; yy74: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'd') goto yy93; goto yy13; yy75: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy94; goto yy13; yy76: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy95; goto yy13; yy77: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy96; goto yy13; yy78: ++YYCURSOR; YYCURSOR = yyt1; #line 178 "../src/parse/lex.re" { out.wraw(tok, ptr); return Parse; } #line 581 "src/parse/lex.cc" yy80: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy78; goto yy13; yy81: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy97; goto yy13; yy82: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy98; goto yy13; yy83: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy99; goto yy13; yy84: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy100; goto yy13; yy85: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') goto yy85; goto yy13; } else { if (yych <= ' ') goto yy85; if (yych == '"') goto yy101; goto yy13; } yy87: ++YYCURSOR; YYCURSOR = yyt1; #line 294 "../src/parse/lex.re" { out.wraw(tok, ptr); out.wdelay_stmt(0, code_newline(alc)); set_sourceline(); goto next; } #line 624 "src/parse/lex.cc" yy89: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy87; goto yy13; yy90: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy103; goto yy13; yy91: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy104; goto yy13; yy92: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy105; goto yy13; yy93: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy106; goto yy13; yy94: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy107; goto yy13; yy95: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy108; goto yy13; yy96: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy109; goto yy13; yy97: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy110; goto yy13; yy98: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy111; goto yy13; yy99: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy112; goto yy13; yy100: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy113; goto yy13; yy101: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 64) { goto yy101; } if (yych <= '\n') goto yy13; if (yych <= '"') goto yy114; goto yy115; yy103: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy116; goto yy13; yy104: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy117; goto yy13; yy105: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy118; goto yy13; yy106: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy119; goto yy13; yy107: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy120; goto yy13; yy108: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy122; goto yy13; yy109: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy123; goto yy13; yy110: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy124; goto yy13; yy111: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy125; goto yy13; yy112: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy126; goto yy13; yy113: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy127; goto yy13; yy114: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy87; if (yych == '\r') goto yy89; goto yy13; yy115: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x00) goto yy13; if (yych == '\n') goto yy13; goto yy101; yy116: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy129; goto yy13; yy117: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy130; goto yy13; yy118: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy131; goto yy13; yy119: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy132; goto yy13; yy120: yyaccept = 3; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '\r') { if (yych <= 0x08) goto yy121; if (yych <= '\n') { yyt1 = YYCURSOR; goto yy133; } if (yych >= '\r') { yyt1 = YYCURSOR; goto yy133; } } else { if (yych <= ' ') { if (yych >= ' ') { yyt1 = YYCURSOR; goto yy133; } } else { if (yych == '*') { yyt1 = YYCURSOR; goto yy135; } } } yy121: #line 275 "../src/parse/lex.re" { error_block_start("max:re2c"); exit(1); } #line 784 "src/parse/lex.cc" yy122: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'h') goto yy136; goto yy13; yy123: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy137; goto yy13; yy124: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy138; goto yy13; yy125: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy139; goto yy13; yy126: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy140; goto yy13; yy127: yyaccept = 4; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x1F) { if (yych <= '\n') { if (yych >= '\t') { yyt1 = yyt3 = NULL; yyt2 = YYCURSOR; goto yy141; } } else { if (yych == '\r') { yyt1 = yyt3 = NULL; yyt2 = YYCURSOR; goto yy141; } } } else { if (yych <= '*') { if (yych <= ' ') { yyt1 = yyt3 = NULL; yyt2 = YYCURSOR; goto yy141; } if (yych >= '*') { yyt1 = yyt3 = NULL; yyt2 = YYCURSOR; goto yy143; } } else { if (yych == ':') goto yy144; } } yy128: #line 282 "../src/parse/lex.re" { error_named_block_start("use:re2c"); exit(1); } #line 841 "src/parse/lex.cc" yy129: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy145; goto yy13; yy130: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy146; goto yy13; yy131: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy147; goto yy13; yy132: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy148; goto yy13; yy133: ++YYCURSOR; YYCURSOR = yyt1; #line 202 "../src/parse/lex.re" { out.wraw(tok, ptr); out.wdelay_stmt(0, code_yymaxfill(alc)); // historically allows garbage before the end of the comment lex_end_of_comment(out, true); goto next; } #line 869 "src/parse/lex.cc" yy135: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy133; goto yy13; yy136: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy149; goto yy13; yy137: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy150; goto yy13; yy138: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy152; goto yy13; yy139: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy154; goto yy13; yy140: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy156; goto yy13; yy141: ++YYCURSOR; x = yyt3; y = yyt1; YYCURSOR = yyt2; #line 189 "../src/parse/lex.re" { out.wraw(tok, ptr); save_string(out.rules_block_name, x, y); return Reuse; } #line 905 "src/parse/lex.cc" yy143: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy141; goto yy13; yy144: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '^') { if (yych <= '@') goto yy13; if (yych <= 'Z') { yyt3 = YYCURSOR; goto yy158; } goto yy13; } else { if (yych == '`') goto yy13; if (yych <= 'z') { yyt3 = YYCURSOR; goto yy158; } goto yy13; } yy145: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy160; goto yy13; yy146: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy161; goto yy13; yy147: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy163; goto yy13; yy148: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy165; goto yy13; yy149: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy166; goto yy13; yy150: yyaccept = 5; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '\r') { if (yych <= 0x08) goto yy151; if (yych <= '\n') { yyt1 = YYCURSOR; goto yy167; } if (yych >= '\r') { yyt1 = YYCURSOR; goto yy167; } } else { if (yych <= ' ') { if (yych >= ' ') { yyt1 = YYCURSOR; goto yy167; } } else { if (yych == '*') { yyt1 = YYCURSOR; goto yy169; } } } yy151: #line 280 "../src/parse/lex.re" { error_block_start("mtags:re2c"); exit(1); } #line 976 "src/parse/lex.cc" yy152: yyaccept = 6; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x1F) { if (yych <= '\n') { if (yych >= '\t') { yyt1 = yyt3 = NULL; yyt2 = YYCURSOR; goto yy170; } } else { if (yych == '\r') { yyt1 = yyt3 = NULL; yyt2 = YYCURSOR; goto yy170; } } } else { if (yych <= '*') { if (yych <= ' ') { yyt1 = yyt3 = NULL; yyt2 = YYCURSOR; goto yy170; } if (yych >= '*') { yyt1 = yyt3 = NULL; yyt2 = YYCURSOR; goto yy172; } } else { if (yych == ':') goto yy173; } } yy153: #line 281 "../src/parse/lex.re" { error_named_block_start("rules:re2c"); exit(1); } #line 1013 "src/parse/lex.cc" yy154: yyaccept = 7; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '\r') { if (yych <= 0x08) goto yy155; if (yych <= '\n') { yyt1 = YYCURSOR; goto yy174; } if (yych >= '\r') { yyt1 = YYCURSOR; goto yy174; } } else { if (yych <= ' ') { if (yych >= ' ') { yyt1 = YYCURSOR; goto yy174; } } else { if (yych == '*') { yyt1 = YYCURSOR; goto yy176; } } } yy155: #line 279 "../src/parse/lex.re" { error_block_start("stags:re2c"); exit(1); } #line 1043 "src/parse/lex.cc" yy156: yyaccept = 8; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '\r') { if (yych <= 0x08) goto yy157; if (yych <= '\n') { yyt1 = YYCURSOR; goto yy177; } if (yych >= '\r') { yyt1 = YYCURSOR; goto yy177; } } else { if (yych <= ' ') { if (yych >= ' ') { yyt1 = YYCURSOR; goto yy177; } } else { if (yych == '*') { yyt1 = YYCURSOR; goto yy179; } } } yy157: #line 278 "../src/parse/lex.re" { error_block_start("types:re2c"); exit(1); } #line 1073 "src/parse/lex.cc" yy158: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { goto yy158; } if (yych <= '\r') { if (yych <= 0x08) goto yy13; if (yych <= '\n') { yyt1 = yyt2 = YYCURSOR; goto yy141; } if (yych <= '\f') goto yy13; yyt1 = yyt2 = YYCURSOR; goto yy141; } else { if (yych <= ' ') { if (yych <= 0x1F) goto yy13; yyt1 = yyt2 = YYCURSOR; goto yy141; } else { if (yych == '*') { yyt1 = yyt2 = YYCURSOR; goto yy143; } goto yy13; } } yy160: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy180; goto yy13; yy161: yyaccept = 9; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == ':') goto yy181; yy162: #line 284 "../src/parse/lex.re" { error_header_directive(); exit(1); } #line 1114 "src/parse/lex.cc" yy163: yyaccept = 10; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '\r') { if (yych <= 0x08) goto yy164; if (yych <= '\n') { yyt1 = YYCURSOR; goto yy182; } if (yych >= '\r') { yyt1 = YYCURSOR; goto yy182; } } else { if (yych <= ' ') { if (yych >= ' ') { yyt1 = YYCURSOR; goto yy182; } } else { if (yych == '*') { yyt1 = YYCURSOR; goto yy184; } } } yy164: #line 274 "../src/parse/lex.re" { error_block_start("ignore:re2c"); exit(1); } #line 1144 "src/parse/lex.cc" yy165: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy185; goto yy13; yy166: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy187; goto yy13; yy167: ++YYCURSOR; YYCURSOR = yyt1; #line 244 "../src/parse/lex.re" { out.wraw(tok, ptr); lex_tags(out, true); goto next; } #line 1162 "src/parse/lex.cc" yy169: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy167; goto yy13; yy170: ++YYCURSOR; x = yyt3; y = yyt1; YYCURSOR = yyt2; #line 183 "../src/parse/lex.re" { out.wraw(tok, ptr); save_string(out.rules_block_name, x, y); return Rules; } #line 1178 "src/parse/lex.cc" yy172: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy170; goto yy13; yy173: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '^') { if (yych <= '@') goto yy13; if (yych <= 'Z') { yyt3 = YYCURSOR; goto yy188; } goto yy13; } else { if (yych == '`') goto yy13; if (yych <= 'z') { yyt3 = YYCURSOR; goto yy188; } goto yy13; } yy174: ++YYCURSOR; YYCURSOR = yyt1; #line 238 "../src/parse/lex.re" { out.wraw(tok, ptr); lex_tags(out, false); goto next; } #line 1209 "src/parse/lex.cc" yy176: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy174; goto yy13; yy177: ++YYCURSOR; YYCURSOR = yyt1; #line 227 "../src/parse/lex.re" { out.wraw(tok, ptr); out.wdelay_stmt(0, code_line_info_output(alc)); out.wdelay_stmt(opts->topIndent, code_cond_enum(alc)); out.cond_enum_in_hdr = out.in_header(); out.warn_condition_order = false; // see note [condition order] out.wdelay_stmt(0, code_line_info_input(alc, cur_loc())); lex_end_of_comment(out); goto next; } #line 1228 "src/parse/lex.cc" yy179: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy177; goto yy13; yy180: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy190; goto yy13; yy181: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'o') goto yy192; goto yy13; yy182: ++YYCURSOR; YYCURSOR = yyt1; #line 195 "../src/parse/lex.re" { out.wraw(tok, ptr); // allows arbitrary garbage before the end of the comment lex_end_of_comment(out, true); goto next; } #line 1251 "src/parse/lex.cc" yy184: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy182; goto yy13; yy185: yyaccept = 11; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '\t') goto yy193; if (yych == ' ') goto yy193; yy186: #line 283 "../src/parse/lex.re" { error_include_directive(); exit(1); } #line 1264 "src/parse/lex.cc" yy187: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy195; goto yy13; yy188: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= '*') { if (yych <= '\r') { if (yych <= 0x08) goto yy13; if (yych <= '\n') { yyt1 = yyt2 = YYCURSOR; goto yy170; } if (yych <= '\f') goto yy13; yyt1 = yyt2 = YYCURSOR; goto yy170; } else { if (yych == ' ') { yyt1 = yyt2 = YYCURSOR; goto yy170; } if (yych <= ')') goto yy13; yyt1 = yyt2 = YYCURSOR; goto yy172; } } else { if (yych <= 'Z') { if (yych <= '/') goto yy13; if (yych <= '9') goto yy188; if (yych <= '@') goto yy13; goto yy188; } else { if (yych <= '_') { if (yych <= '^') goto yy13; goto yy188; } else { if (yych <= '`') goto yy13; if (yych <= 'z') goto yy188; goto yy13; } } } yy190: yyaccept = 12; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '\r') { if (yych <= 0x08) goto yy191; if (yych <= '\n') { yyt1 = YYCURSOR; goto yy196; } if (yych >= '\r') { yyt1 = YYCURSOR; goto yy196; } } else { if (yych <= ' ') { if (yych >= ' ') { yyt1 = YYCURSOR; goto yy196; } } else { if (yych == '*') { yyt1 = YYCURSOR; goto yy198; } } } yy191: #line 277 "../src/parse/lex.re" { error_block_start("getstate:re2c"); exit(1); } #line 1338 "src/parse/lex.cc" yy192: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'f') goto yy199; if (yych == 'n') goto yy200; goto yy13; yy193: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') goto yy193; goto yy13; } else { if (yych <= ' ') goto yy193; if (yych == '"') { yyt1 = YYCURSOR; goto yy201; } goto yy13; } yy195: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy203; goto yy13; yy196: ++YYCURSOR; YYCURSOR = yyt1; #line 217 "../src/parse/lex.re" { out.wraw(tok, ptr); if (opts->fFlag && opts->target == TARGET_CODE && !out.state_goto) { out.wdelay_stmt(opts->topIndent, code_state_goto(alc)); out.state_goto = true; } lex_end_of_comment(out); goto next; } #line 1376 "src/parse/lex.cc" yy198: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy196; goto yy13; yy199: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'f') goto yy205; goto yy13; yy200: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '\r') { if (yych <= 0x08) goto yy13; if (yych <= '\n') { yyt1 = YYCURSOR; goto yy206; } if (yych <= '\f') goto yy13; yyt1 = YYCURSOR; goto yy206; } else { if (yych <= ' ') { if (yych <= 0x1F) goto yy13; yyt1 = YYCURSOR; goto yy206; } else { if (yych == '*') { yyt1 = YYCURSOR; goto yy208; } goto yy13; } } yy201: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yych <= '!') { if (yych <= 0x00) goto yy13; if (yych == '\n') goto yy13; goto yy201; } else { if (yych <= '"') goto yy209; if (yych == '\\') goto yy210; goto yy201; } yy203: yyaccept = 13; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '\r') { if (yych <= 0x08) goto yy204; if (yych <= '\n') { yyt1 = YYCURSOR; goto yy211; } if (yych >= '\r') { yyt1 = YYCURSOR; goto yy211; } } else { if (yych <= ' ') { if (yych >= ' ') { yyt1 = YYCURSOR; goto yy211; } } else { if (yych == '*') { yyt1 = YYCURSOR; goto yy213; } } } yy204: #line 276 "../src/parse/lex.re" { error_block_start("maxnmatch:re2c"); exit(1); } #line 1451 "src/parse/lex.cc" yy205: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '\r') { if (yych <= 0x08) goto yy13; if (yych <= '\n') { yyt1 = YYCURSOR; goto yy214; } if (yych <= '\f') goto yy13; yyt1 = YYCURSOR; goto yy214; } else { if (yych <= ' ') { if (yych <= 0x1F) goto yy13; yyt1 = YYCURSOR; goto yy214; } else { if (yych == '*') { yyt1 = YYCURSOR; goto yy216; } goto yy13; } } yy206: ++YYCURSOR; YYCURSOR = yyt1; #line 250 "../src/parse/lex.re" { out.wraw(tok, ptr); out.header_mode(true); out.need_header = opts->target == TARGET_CODE; lex_end_of_comment(out); goto next; } #line 1487 "src/parse/lex.cc" yy208: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy206; goto yy13; yy209: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '\r') { if (yych <= 0x08) goto yy13; if (yych <= '\n') { yyt2 = YYCURSOR; goto yy217; } if (yych <= '\f') goto yy13; yyt2 = YYCURSOR; goto yy217; } else { if (yych <= ' ') { if (yych <= 0x1F) goto yy13; yyt2 = YYCURSOR; goto yy217; } else { if (yych == '*') { yyt2 = YYCURSOR; goto yy219; } goto yy13; } } yy210: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x00) goto yy13; if (yych == '\n') goto yy13; goto yy201; yy211: ++YYCURSOR; YYCURSOR = yyt1; #line 210 "../src/parse/lex.re" { out.wraw(tok, ptr); out.wdelay_stmt(0, code_yymaxnmatch(alc)); lex_end_of_comment(out); goto next; } #line 1533 "src/parse/lex.cc" yy213: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy211; goto yy13; yy214: ++YYCURSOR; YYCURSOR = yyt1; #line 258 "../src/parse/lex.re" { out.wraw(tok, ptr); out.header_mode(false); out.wdelay_stmt(0, code_line_info_input(alc, cur_loc())); lex_end_of_comment(out); goto next; } #line 1549 "src/parse/lex.cc" yy216: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy214; goto yy13; yy217: ++YYCURSOR; x = yyt1; YYCURSOR = yyt2; y = yyt2; #line 266 "../src/parse/lex.re" { out.wraw(tok, ptr); lex_end_of_comment(out); include(getstr(x + 1, y - 1)); goto next; } #line 1566 "src/parse/lex.cc" yy219: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy217; goto yy13; } #line 307 "../src/parse/lex.re" } void Scanner::lex_end_of_comment(Output &out, bool allow_garbage) { bool multiline = false; loop: #line 1581 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= '\r') { if (yych <= '\t') { if (yych >= '\t') goto yy224; } else { if (yych <= '\n') goto yy226; if (yych >= '\r') goto yy228; } } else { if (yych <= ' ') { if (yych >= ' ') goto yy224; } else { if (yych == '*') goto yy229; } } ++YYCURSOR; yy223: #line 315 "../src/parse/lex.re" { if (allow_garbage && !is_eof()) goto loop; msg.error(cur_loc(), "expected end of block"); exit(1); } #line 1608 "src/parse/lex.cc" yy224: ++YYCURSOR; #line 320 "../src/parse/lex.re" { goto loop; } #line 1613 "src/parse/lex.cc" yy226: ++YYCURSOR; #line 321 "../src/parse/lex.re" { next_line(); multiline = true; goto loop; } #line 1622 "src/parse/lex.cc" yy228: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy226; goto yy223; yy229: yych = (YYCTYPE)*++YYCURSOR; if (yych != '/') goto yy223; ++YYCURSOR; #line 326 "../src/parse/lex.re" { if (multiline) { out.wdelay_stmt(0, code_line_info_input(out.allocator, cur_loc())); } return; } #line 1638 "src/parse/lex.cc" } #line 332 "../src/parse/lex.re" } void Scanner::lex_tags(Output &out, bool mtags) { const opt_t *opts = out.block().opts; std::string fmt, sep; loop: #line 1650 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; if ((YYLIMIT - YYCURSOR) < 9) YYFILL(9); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { goto yy236; } if (yych <= ')') { if (yych <= '\n') { if (yych >= '\t') goto yy239; } else { if (yych == '\r') goto yy241; } } else { if (yych <= 'f') { if (yych <= '*') goto yy242; if (yych >= 'f') goto yy243; } else { if (yych == 's') goto yy244; } } ++YYCURSOR; yy235: #line 341 "../src/parse/lex.re" { msg.error(cur_loc(), "unrecognized configuration"); exit(1); } #line 1713 "src/parse/lex.cc" yy236: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { goto yy236; } #line 353 "../src/parse/lex.re" { goto loop; } #line 1725 "src/parse/lex.cc" yy239: ++YYCURSOR; #line 356 "../src/parse/lex.re" { next_line(); goto loop; } #line 1733 "src/parse/lex.cc" yy241: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy239; goto yy235; yy242: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy245; goto yy235; yy243: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'o') goto yy247; goto yy235; yy244: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'e') goto yy249; goto yy235; yy245: ++YYCURSOR; #line 360 "../src/parse/lex.re" { if (opts->target == TARGET_CODE) { out.wdelay_stmt(opts->topIndent, code_tags(out.allocator, fmt, sep, mtags)); } return; } #line 1759 "src/parse/lex.cc" yy247: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy250; yy248: YYCURSOR = YYMARKER; goto yy235; yy249: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'p') goto yy251; goto yy248; yy250: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'm') goto yy252; goto yy248; yy251: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy253; goto yy248; yy252: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy254; goto yy248; yy253: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy255; goto yy248; yy254: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy256; goto yy248; yy255: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy258; goto yy248; yy256: ++YYCURSOR; #line 345 "../src/parse/lex.re" { fmt = lex_conf_string(); goto loop; } #line 1801 "src/parse/lex.cc" yy258: yych = (YYCTYPE)*++YYCURSOR; if (yych != 't') goto yy248; yych = (YYCTYPE)*++YYCURSOR; if (yych != 'o') goto yy248; yych = (YYCTYPE)*++YYCURSOR; if (yych != 'r') goto yy248; ++YYCURSOR; #line 349 "../src/parse/lex.re" { sep = lex_conf_string(); goto loop; } #line 1815 "src/parse/lex.cc" } #line 366 "../src/parse/lex.re" } int Scanner::scan() { const char *p, *x, *y; scan: tok = cur; location = cur_loc(); #line 1828 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; static const unsigned char yybm[] = { 0, 128, 128, 128, 128, 128, 128, 128, 128, 144, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 144, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 128, 128, 128, 128, 128, 128, 128, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 128, 0, 128, 128, 160, 128, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; if ((YYLIMIT - YYCURSOR) < 9) YYFILL(9); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 16) { goto yy267; } if (yych <= '9') { if (yych <= '$') { if (yych <= '\r') { if (yych <= 0x08) goto yy265; if (yych <= '\n') goto yy270; if (yych >= '\r') goto yy272; } else { if (yych <= '!') { if (yych >= ' ') goto yy273; } else { if (yych <= '"') goto yy274; if (yych <= '#') goto yy276; goto yy277; } } } else { if (yych <= '*') { if (yych <= '&') { if (yych <= '%') goto yy279; } else { if (yych <= '\'') goto yy280; if (yych <= ')') goto yy277; goto yy282; } } else { if (yych <= '-') { if (yych <= '+') goto yy277; } else { if (yych <= '.') goto yy283; if (yych <= '/') goto yy285; } } } } else { if (yych <= '[') { if (yych <= '=') { if (yych <= ':') goto yy286; if (yych <= ';') goto yy277; if (yych <= '<') goto yy287; goto yy289; } else { if (yych <= '?') { if (yych >= '?') goto yy277; } else { if (yych <= '@') goto yy276; if (yych <= 'Z') goto yy290; goto yy293; } } } else { if (yych <= 'q') { if (yych <= '^') { if (yych <= '\\') goto yy277; } else { if (yych != '`') goto yy290; } } else { if (yych <= 'z') { if (yych <= 'r') goto yy295; goto yy290; } else { if (yych <= '{') goto yy296; if (yych <= '|') goto yy277; } } } } yy265: ++YYCURSOR; yy266: #line 518 "../src/parse/lex.re" { msg.error(tok_loc(), "unexpected character: '%c'", *tok); exit(1); } #line 1946 "src/parse/lex.cc" yy267: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 16) { goto yy267; } #line 500 "../src/parse/lex.re" { goto scan; } #line 1956 "src/parse/lex.cc" yy270: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x1F) { if (yych == '\t') goto yy298; } else { if (yych <= ' ') goto yy298; if (yych == '#') goto yy301; } yy271: #line 507 "../src/parse/lex.re" { next_line(); if (lexer_state == LEX_FLEX_NAME) { lexer_state = LEX_NORMAL; return TOKEN_FID_END; } else { goto scan; } } #line 1978 "src/parse/lex.cc" yy272: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy270; goto yy266; yy273: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'i') goto yy303; if (yych == 'u') goto yy304; goto yy266; yy274: ++YYCURSOR; #line 392 "../src/parse/lex.re" { yylval.regexp = lex_str('"'); return TOKEN_REGEXP; } #line 1993 "src/parse/lex.cc" yy276: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '^') { if (yych <= '@') goto yy266; if (yych <= 'Z') goto yy305; goto yy266; } else { if (yych == '`') goto yy266; if (yych <= 'z') goto yy305; goto yy266; } yy277: ++YYCURSOR; yy278: #line 401 "../src/parse/lex.re" { return *tok; } #line 2010 "src/parse/lex.cc" yy279: yych = (YYCTYPE)*++YYCURSOR; if (yych == '}') goto yy308; goto yy266; yy280: ++YYCURSOR; #line 391 "../src/parse/lex.re" { yylval.regexp = lex_str('\''); return TOKEN_REGEXP; } #line 2019 "src/parse/lex.cc" yy282: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy308; goto yy278; yy283: ++YYCURSOR; #line 495 "../src/parse/lex.re" { yylval.regexp = ast_dot(tok_loc()); return TOKEN_REGEXP; } #line 2031 "src/parse/lex.cc" yy285: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy310; if (yych == '/') goto yy312; goto yy278; yy286: yych = (YYCTYPE)*++YYCURSOR; if (yych == '=') goto yy314; goto yy266; yy287: ++YYCURSOR; #line 384 "../src/parse/lex.re" { return lex_clist(); } #line 2045 "src/parse/lex.cc" yy289: yyaccept = 2; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '>') goto yy316; goto yy278; yy290: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; yy291: if (yybm[0+yych] & 32) { goto yy290; } #line 450 "../src/parse/lex.re" { if (!globopts->FFlag || lex_namedef_context_re2c()) { yylval.str = newstr(tok, cur); return TOKEN_ID; } else if (lex_namedef_context_flex()) { yylval.str = newstr(tok, cur); lexer_state = LEX_FLEX_NAME; return TOKEN_FID; } else { // consume one character, otherwise we risk breaking operator // precedence in cases like ab*: it should be a(b)*, not (ab)* cur = tok + 1; ASTChar c = {static_cast<uint8_t>(tok[0]), tok_loc()}; std::vector<ASTChar> *str = new std::vector<ASTChar>; str->push_back(c); yylval.regexp = ast_str(tok_loc(), str, false); return TOKEN_REGEXP; } } #line 2082 "src/parse/lex.cc" yy293: yych = (YYCTYPE)*++YYCURSOR; if (yych == '^') goto yy318; #line 393 "../src/parse/lex.re" { yylval.regexp = lex_cls(false); return TOKEN_REGEXP; } #line 2088 "src/parse/lex.cc" yy295: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy320; goto yy291; yy296: yyaccept = 3; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 64) { goto yy323; } if (yych <= 'Z') { if (yych == ',') goto yy321; if (yych >= 'A') goto yy325; } else { if (yych <= '_') { if (yych >= '_') goto yy325; } else { if (yych <= '`') goto yy297; if (yych <= 'z') goto yy325; } } yy297: #line 376 "../src/parse/lex.re" { lex_code_in_braces(); return TOKEN_CODE; } #line 2113 "src/parse/lex.cc" yy298: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') goto yy298; } else { if (yych <= ' ') goto yy298; if (yych == '#') goto yy301; } yy300: YYCURSOR = YYMARKER; if (yyaccept <= 3) { if (yyaccept <= 1) { if (yyaccept == 0) { goto yy271; } else { goto yy266; } } else { if (yyaccept == 2) { goto yy278; } else { goto yy297; } } } else { if (yyaccept <= 5) { if (yyaccept == 4) { goto yy315; } else { goto yy322; } } else { if (yyaccept == 6) { goto yy342; } else { goto yy366; } } } yy301: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') goto yy301; goto yy300; } else { if (yych <= ' ') goto yy301; if (yych == 'l') goto yy327; goto yy300; } yy303: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy328; goto yy300; yy304: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy329; goto yy300; yy305: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 'Z') { if (yych <= '/') goto yy307; if (yych <= '9') goto yy305; if (yych >= 'A') goto yy305; } else { if (yych <= '_') { if (yych >= '_') goto yy305; } else { if (yych <= '`') goto yy307; if (yych <= 'z') goto yy305; } } yy307: #line 396 "../src/parse/lex.re" { yylval.regexp = ast_tag(tok_loc(), newstr(tok + 1, cur), tok[0] == '#'); return TOKEN_REGEXP; } #line 2197 "src/parse/lex.cc" yy308: ++YYCURSOR; #line 389 "../src/parse/lex.re" { tok = cur; return 0; } #line 2202 "src/parse/lex.cc" yy310: ++YYCURSOR; #line 387 "../src/parse/lex.re" { lex_c_comment(); goto scan; } #line 2207 "src/parse/lex.cc" yy312: ++YYCURSOR; #line 386 "../src/parse/lex.re" { lex_cpp_comment(); goto scan; } #line 2212 "src/parse/lex.cc" yy314: yyaccept = 4; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '>') goto yy316; yy315: #line 377 "../src/parse/lex.re" { lex_code_indented(); return TOKEN_CODE; } #line 2220 "src/parse/lex.cc" yy316: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= '@') { if (yych <= '\t') { if (yych <= 0x08) goto yy300; goto yy316; } else { if (yych == ' ') goto yy316; goto yy300; } } else { if (yych <= '_') { if (yych <= 'Z') { yyt1 = YYCURSOR; goto yy330; } if (yych <= '^') goto yy300; yyt1 = YYCURSOR; goto yy330; } else { if (yych <= '`') goto yy300; if (yych <= 'z') { yyt1 = YYCURSOR; goto yy330; } goto yy300; } } yy318: ++YYCURSOR; #line 394 "../src/parse/lex.re" { yylval.regexp = lex_cls(true); return TOKEN_REGEXP; } #line 2255 "src/parse/lex.cc" yy320: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy333; goto yy291; yy321: ++YYCURSOR; yy322: #line 433 "../src/parse/lex.re" { msg.error(tok_loc(), "illegal closure form, use '{n}', '{n,}', '{n,m}' " "where n and m are numbers"); exit(1); } #line 2269 "src/parse/lex.cc" yy323: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 64) { goto yy323; } if (yych == ',') { yyt1 = YYCURSOR; goto yy334; } if (yych == '}') goto yy335; goto yy300; yy325: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= '^') { if (yych <= '9') { if (yych <= '/') goto yy300; goto yy325; } else { if (yych <= '@') goto yy300; if (yych <= 'Z') goto yy325; goto yy300; } } else { if (yych <= 'z') { if (yych == '`') goto yy300; goto yy325; } else { if (yych == '}') goto yy337; goto yy300; } } yy327: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy339; goto yy300; yy328: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy340; goto yy300; yy329: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy341; goto yy300; yy330: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 'Z') { if (yych <= '/') goto yy332; if (yych <= '9') goto yy330; if (yych >= 'A') goto yy330; } else { if (yych <= '_') { if (yych >= '_') goto yy330; } else { if (yych <= '`') goto yy332; if (yych <= 'z') goto yy330; } } yy332: p = yyt1; #line 379 "../src/parse/lex.re" { yylval.str = newstr(p, cur); return tok[0] == ':' ? TOKEN_CJUMP : TOKEN_CNEXT; } #line 2340 "src/parse/lex.cc" yy333: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy343; goto yy291; yy334: yyaccept = 5; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy322; if (yych <= '9') goto yy344; if (yych == '}') goto yy346; goto yy322; yy335: ++YYCURSOR; #line 403 "../src/parse/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.bounds.min)) { msg.error(tok_loc(), "repetition count overflow"); exit(1); } yylval.bounds.max = yylval.bounds.min; return TOKEN_CLOSESIZE; } #line 2363 "src/parse/lex.cc" yy337: ++YYCURSOR; #line 439 "../src/parse/lex.re" { if (!globopts->FFlag) { msg.error(tok_loc(), "curly braces for names only allowed with -F switch"); exit(1); } yylval.str = newstr(tok + 1, cur - 1); return TOKEN_ID; } #line 2375 "src/parse/lex.cc" yy339: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy348; goto yy300; yy340: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'l') goto yy349; goto yy300; yy341: yyaccept = 6; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == ':') goto yy350; yy342: #line 489 "../src/parse/lex.re" { msg.error(tok_loc(), "ill-formed use directive" ", expected format: `!use:<block-name> ; <newline>`"); exit(1); } #line 2395 "src/parse/lex.cc" yy343: yych = (YYCTYPE)*++YYCURSOR; if (yych == ':') goto yy351; goto yy291; yy344: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= '/') goto yy300; if (yych <= '9') goto yy344; if (yych == '}') goto yy353; goto yy300; yy346: ++YYCURSOR; #line 424 "../src/parse/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.bounds.min)) { msg.error(tok_loc(), "repetition lower bound overflow"); exit(1); } yylval.bounds.max = std::numeric_limits<uint32_t>::max(); return TOKEN_CLOSESIZE; } #line 2419 "src/parse/lex.cc" yy348: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy355; goto yy300; yy349: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'u') goto yy356; goto yy300; yy350: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '^') { if (yych <= '@') goto yy300; if (yych <= 'Z') { yyt1 = YYCURSOR; goto yy357; } goto yy300; } else { if (yych == '`') goto yy300; if (yych <= 'z') { yyt1 = YYCURSOR; goto yy357; } goto yy300; } yy351: ++YYCURSOR; #line 448 "../src/parse/lex.re" { return TOKEN_CONF; } #line 2449 "src/parse/lex.cc" yy353: ++YYCURSOR; p = yyt1; #line 412 "../src/parse/lex.re" { if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min)) { msg.error(tok_loc(), "repetition lower bound overflow"); exit(1); } if (!s_to_u32_unsafe (p + 1, cur - 1, yylval.bounds.max)) { msg.error(tok_loc(), "repetition upper bound overflow"); exit(1); } return TOKEN_CLOSESIZE; } #line 2465 "src/parse/lex.cc" yy355: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '0') goto yy360; if (yych <= '9') goto yy300; goto yy360; yy356: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'd') goto yy361; goto yy300; yy357: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yych <= '@') { if (yych <= '9') { if (yych <= '/') goto yy300; goto yy357; } else { if (yych == ';') { yyt2 = YYCURSOR; goto yy362; } goto yy300; } } else { if (yych <= '_') { if (yych <= 'Z') goto yy357; if (yych <= '^') goto yy300; goto yy357; } else { if (yych <= '`') goto yy300; if (yych <= 'z') goto yy357; goto yy300; } } yy359: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; yy360: if (yych <= 0x1F) { if (yych == '\t') goto yy359; goto yy300; } else { if (yych <= ' ') goto yy359; if (yych <= '0') goto yy300; if (yych <= '9') { yyt1 = YYCURSOR; goto yy363; } goto yy300; } yy361: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy365; goto yy300; yy362: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy367; if (yych == '\r') goto yy369; goto yy300; yy363: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= '\r') { if (yych <= '\t') { if (yych <= 0x08) goto yy300; goto yy370; } else { if (yych <= '\n') goto yy372; if (yych <= '\f') goto yy300; goto yy374; } } else { if (yych <= ' ') { if (yych <= 0x1F) goto yy300; goto yy370; } else { if (yych <= '/') goto yy300; if (yych <= '9') goto yy363; goto yy300; } } yy365: yyaccept = 7; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '\t') goto yy375; if (yych == ' ') goto yy375; yy366: #line 478 "../src/parse/lex.re" { msg.error(tok_loc(), "ill-formed include directive" ", expected format: `!include \"<file>\" ; <newline>`"); exit(1); } #line 2562 "src/parse/lex.cc" yy367: ++YYCURSOR; x = yyt1; y = yyt2; #line 484 "../src/parse/lex.re" { next_line(); yylval.str = newstr(x, y); // save the name of the used block return TOKEN_BLOCK; } #line 2573 "src/parse/lex.cc" yy369: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy367; goto yy300; yy370: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') goto yy370; goto yy300; } else { if (yych <= ' ') goto yy370; if (yych == '"') goto yy377; goto yy300; } yy372: ++YYCURSOR; YYCURSOR = yyt1; #line 502 "../src/parse/lex.re" { set_sourceline (); return TOKEN_LINE_INFO; } #line 2598 "src/parse/lex.cc" yy374: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy372; goto yy300; yy375: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') goto yy375; goto yy300; } else { if (yych <= ' ') goto yy375; if (yych == '"') { yyt1 = YYCURSOR; goto yy379; } goto yy300; } yy377: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { goto yy377; } if (yych <= '\n') goto yy300; if (yych <= '"') goto yy381; goto yy382; yy379: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = (YYCTYPE)*YYCURSOR; if (yych <= '!') { if (yych <= 0x00) goto yy300; if (yych == '\n') goto yy300; goto yy379; } else { if (yych <= '"') goto yy383; if (yych == '\\') goto yy384; goto yy379; } yy381: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy372; if (yych == '\r') goto yy374; goto yy300; yy382: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x00) goto yy300; if (yych == '\n') goto yy300; goto yy377; yy383: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') { yyt2 = YYCURSOR; goto yy385; } goto yy300; } else { if (yych <= ' ') { yyt2 = YYCURSOR; goto yy385; } if (yych == ';') { yyt2 = YYCURSOR; goto yy387; } goto yy300; } yy384: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x00) goto yy300; if (yych == '\n') goto yy300; goto yy379; yy385: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') goto yy385; goto yy300; } else { if (yych <= ' ') goto yy385; if (yych != ';') goto yy300; } yy387: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy388; if (yych == '\r') goto yy390; goto yy300; yy388: ++YYCURSOR; x = yyt1; y = yyt2; #line 473 "../src/parse/lex.re" { next_line(); include(getstr(x + 1, y - 1)); goto scan; } #line 2705 "src/parse/lex.cc" yy390: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy388; goto yy300; } #line 522 "../src/parse/lex.re" } bool Scanner::lex_namedef_context_re2c() { #line 2718 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*(YYMARKER = YYCURSOR); if (yych <= 0x1F) { if (yych == '\t') { yyt1 = YYCURSOR; goto yy394; } } else { if (yych <= ' ') { yyt1 = YYCURSOR; goto yy394; } if (yych == '=') { yyt1 = YYCURSOR; goto yy397; } } yy393: #line 529 "../src/parse/lex.re" { return false; } #line 2775 "src/parse/lex.cc" yy394: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { goto yy394; } if (yych == '=') goto yy397; yy396: YYCURSOR = YYMARKER; goto yy393; yy397: yych = (YYCTYPE)*++YYCURSOR; if (yych == '>') goto yy396; ++YYCURSOR; YYCURSOR = yyt1; #line 528 "../src/parse/lex.re" { return true; } #line 2794 "src/parse/lex.cc" } #line 530 "../src/parse/lex.re" } bool Scanner::lex_namedef_context_flex() { #line 2803 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == '\t') { yyt1 = YYCURSOR; goto yy403; } if (yych == ' ') { yyt1 = YYCURSOR; goto yy403; } #line 538 "../src/parse/lex.re" { return false; } #line 2852 "src/parse/lex.cc" yy403: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { goto yy403; } if (yych <= '<') { if (yych == ':') goto yy406; } else { if (yych <= '=') goto yy406; if (yych == '{') goto yy406; } YYCURSOR = yyt1; #line 537 "../src/parse/lex.re" { return true; } #line 2869 "src/parse/lex.cc" yy406: ++YYCURSOR; YYCURSOR = yyt1; #line 536 "../src/parse/lex.re" { return false; } #line 2875 "src/parse/lex.cc" } #line 539 "../src/parse/lex.re" } int Scanner::lex_clist() { int kind = TOKEN_CLIST; CondList *cl = new CondList; #line 2886 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; goto yy408; yy409: ++YYCURSOR; yy408: if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { goto yy409; } if (yych <= 0x1F) goto yy411; if (yych <= '!') goto yy412; if (yych == '>') goto yy415; yy411: #line 549 "../src/parse/lex.re" { goto cond; } #line 2938 "src/parse/lex.cc" yy412: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == '\t') goto yy412; if (yych == ' ') goto yy412; #line 547 "../src/parse/lex.re" { kind = TOKEN_CSETUP; goto cond; } #line 2947 "src/parse/lex.cc" yy415: ++YYCURSOR; #line 548 "../src/parse/lex.re" { kind = TOKEN_CZERO; goto end; } #line 2952 "src/parse/lex.cc" } #line 550 "../src/parse/lex.re" cond: tok = cur; #line 2959 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 'Z') { if (yych == '*') goto yy421; if (yych >= 'A') goto yy423; } else { if (yych <= '_') { if (yych >= '_') goto yy423; } else { if (yych <= '`') goto yy419; if (yych <= 'z') goto yy423; } } yy419: ++YYCURSOR; #line 556 "../src/parse/lex.re" { goto error; } #line 3013 "src/parse/lex.cc" yy421: ++YYCURSOR; #line 555 "../src/parse/lex.re" { if (!cl->empty()) goto error; cl->insert("*"); goto next; } #line 3018 "src/parse/lex.cc" yy423: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { goto yy423; } #line 554 "../src/parse/lex.re" { cl->insert(getstr(tok, cur)); goto next; } #line 3028 "src/parse/lex.cc" } #line 557 "../src/parse/lex.re" next: #line 3034 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= ' ') { if (yych == '\t') goto yy430; if (yych >= ' ') goto yy430; } else { if (yych <= ',') { if (yych >= ',') goto yy431; } else { if (yych == '>') goto yy434; } } ++YYCURSOR; yy429: #line 562 "../src/parse/lex.re" { goto error; } #line 3087 "src/parse/lex.cc" yy430: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= ' ') { if (yych == '\t') goto yy436; if (yych <= 0x1F) goto yy429; goto yy436; } else { if (yych <= ',') { if (yych <= '+') goto yy429; } else { if (yych == '>') goto yy434; goto yy429; } } yy431: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { goto yy431; } #line 560 "../src/parse/lex.re" { goto cond; } #line 3111 "src/parse/lex.cc" yy434: ++YYCURSOR; #line 561 "../src/parse/lex.re" { goto end; } #line 3116 "src/parse/lex.cc" yy436: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= ' ') { if (yych == '\t') goto yy436; if (yych >= ' ') goto yy436; } else { if (yych <= ',') { if (yych >= ',') goto yy431; } else { if (yych == '>') goto yy434; } } YYCURSOR = YYMARKER; goto yy429; } #line 563 "../src/parse/lex.re" end: yylval.clist = cl; return kind; error: delete cl; msg.error(cur_loc(), "syntax error in condition list"); exit(1); } void Scanner::lex_code_indented() { const loc_t &loc = tok_loc(); tok = cur; code: #line 3151 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yych <= '&') { if (yych <= '\f') { if (yych <= 0x00) goto yy441; if (yych == '\n') goto yy445; goto yy443; } else { if (yych <= '\r') goto yy447; if (yych == '"') goto yy448; goto yy443; } } else { if (yych <= 'z') { if (yych <= '\'') goto yy448; if (yych == '/') goto yy450; goto yy443; } else { if (yych == '|') goto yy443; if (yych <= '}') goto yy451; goto yy443; } } yy441: ++YYCURSOR; #line 589 "../src/parse/lex.re" { fail_if_eof(); goto code; } #line 3181 "src/parse/lex.cc" yy443: ++YYCURSOR; yy444: #line 597 "../src/parse/lex.re" { goto code; } #line 3187 "src/parse/lex.cc" yy445: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '\f') { if (yych <= 0x08) goto yy446; if (yych <= '\n') goto yy453; } else { if (yych <= '\r') goto yy453; if (yych == ' ') goto yy453; } yy446: #line 580 "../src/parse/lex.re" { next_line(); while (isspace(tok[0])) ++tok; char *p = cur; while (p > tok && isspace(p[-1])) --p; yylval.semact = new SemAct(loc, getstr(tok, p)); return; } #line 3207 "src/parse/lex.cc" yy447: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy445; goto yy444; yy448: ++YYCURSOR; #line 596 "../src/parse/lex.re" { lex_string(cur[-1]); goto code; } #line 3216 "src/parse/lex.cc" yy450: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy455; if (yych == '/') goto yy457; goto yy444; yy451: ++YYCURSOR; #line 590 "../src/parse/lex.re" { msg.error(cur_loc(), "Curly braces are not allowed after ':='"); exit(1); } #line 3229 "src/parse/lex.cc" yy453: ++YYCURSOR; YYCURSOR -= 1; #line 579 "../src/parse/lex.re" { next_line(); goto code; } #line 3235 "src/parse/lex.cc" yy455: ++YYCURSOR; #line 594 "../src/parse/lex.re" { lex_c_comment(); goto code; } #line 3240 "src/parse/lex.cc" yy457: ++YYCURSOR; #line 595 "../src/parse/lex.re" { lex_cpp_comment(); goto code; } #line 3245 "src/parse/lex.cc" } #line 598 "../src/parse/lex.re" } void Scanner::lex_code_in_braces() { const loc_t &loc = tok_loc(); uint32_t depth = 1; code: #line 3257 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { 0, 128, 128, 128, 128, 128, 128, 128, 128, 160, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 160, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yych <= '&') { if (yych <= '\f') { if (yych <= 0x00) goto yy461; if (yych == '\n') goto yy465; goto yy463; } else { if (yych <= '\r') goto yy467; if (yych == '"') goto yy468; goto yy463; } } else { if (yych <= 'z') { if (yych <= '\'') goto yy468; if (yych == '/') goto yy470; goto yy463; } else { if (yych <= '{') goto yy471; if (yych == '}') goto yy473; goto yy463; } } yy461: ++YYCURSOR; #line 618 "../src/parse/lex.re" { fail_if_eof(); goto code; } #line 3321 "src/parse/lex.cc" yy463: ++YYCURSOR; yy464: #line 622 "../src/parse/lex.re" { goto code; } #line 3327 "src/parse/lex.cc" yy465: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 32) { goto yy475; } if (yych == '#') goto yy478; yy466: #line 617 "../src/parse/lex.re" { next_line(); goto code; } #line 3337 "src/parse/lex.cc" yy467: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy465; goto yy464; yy468: ++YYCURSOR; #line 621 "../src/parse/lex.re" { lex_string(cur[-1]); goto code; } #line 3346 "src/parse/lex.cc" yy470: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy480; if (yych == '/') goto yy482; goto yy464; yy471: ++YYCURSOR; #line 615 "../src/parse/lex.re" { ++depth; goto code; } #line 3356 "src/parse/lex.cc" yy473: ++YYCURSOR; #line 607 "../src/parse/lex.re" { if (--depth == 0) { yylval.semact = new SemAct(loc, getstr(tok, cur)); return; } goto code; } #line 3367 "src/parse/lex.cc" yy475: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 32) { goto yy475; } if (yych == '#') goto yy478; yy477: YYCURSOR = YYMARKER; goto yy466; yy478: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') goto yy478; goto yy477; } else { if (yych <= ' ') goto yy478; if (yych == 'l') goto yy484; goto yy477; } yy480: ++YYCURSOR; #line 619 "../src/parse/lex.re" { lex_c_comment(); goto code; } #line 3395 "src/parse/lex.cc" yy482: ++YYCURSOR; #line 620 "../src/parse/lex.re" { lex_cpp_comment(); goto code; } #line 3400 "src/parse/lex.cc" yy484: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'i') goto yy477; yych = (YYCTYPE)*++YYCURSOR; if (yych != 'n') goto yy477; yych = (YYCTYPE)*++YYCURSOR; if (yych != 'e') goto yy477; yych = (YYCTYPE)*++YYCURSOR; if (yych <= '0') goto yy489; if (yych <= '9') goto yy477; goto yy489; yy488: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; yy489: if (yych <= 0x1F) { if (yych == '\t') goto yy488; goto yy477; } else { if (yych <= ' ') goto yy488; if (yych <= '0') goto yy477; if (yych >= ':') goto yy477; yyt1 = YYCURSOR; } yy490: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 64) { goto yy490; } if (yych <= '\f') { if (yych <= 0x08) goto yy477; if (yych <= '\t') goto yy492; if (yych <= '\n') goto yy494; goto yy477; } else { if (yych <= '\r') goto yy496; if (yych != ' ') goto yy477; } yy492: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { if (yych == '\t') goto yy492; goto yy477; } else { if (yych <= ' ') goto yy492; if (yych == '"') goto yy497; goto yy477; } yy494: ++YYCURSOR; YYCURSOR = yyt1; #line 616 "../src/parse/lex.re" { set_sourceline (); goto code; } #line 3459 "src/parse/lex.cc" yy496: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy494; goto yy477; yy497: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { goto yy497; } if (yych <= '\n') goto yy477; if (yych >= '#') goto yy500; yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy494; if (yych == '\r') goto yy496; goto yy477; yy500: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x00) goto yy477; if (yych == '\n') goto yy477; goto yy497; } #line 623 "../src/parse/lex.re" } void Scanner::lex_string(char delim) { loop: #line 3493 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= '!') { if (yych <= '\n') { if (yych <= 0x00) goto yy503; if (yych <= '\t') goto yy505; goto yy507; } else { if (yych == '\r') goto yy509; goto yy505; } } else { if (yych <= '\'') { if (yych <= '"') goto yy510; if (yych <= '&') goto yy505; goto yy510; } else { if (yych == '\\') goto yy512; goto yy505; } } yy503: ++YYCURSOR; #line 633 "../src/parse/lex.re" { fail_if_eof(); goto loop; } #line 3521 "src/parse/lex.cc" yy505: ++YYCURSOR; yy506: #line 634 "../src/parse/lex.re" { goto loop; } #line 3527 "src/parse/lex.cc" yy507: ++YYCURSOR; #line 632 "../src/parse/lex.re" { next_line(); goto loop; } #line 3532 "src/parse/lex.cc" yy509: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy507; goto yy506; yy510: ++YYCURSOR; #line 630 "../src/parse/lex.re" { if (cur[-1] == delim) return; else goto loop; } #line 3541 "src/parse/lex.cc" yy512: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '&') { if (yych != '"') goto yy506; } else { if (yych <= '\'') goto yy513; if (yych != '\\') goto yy506; } yy513: ++YYCURSOR; #line 631 "../src/parse/lex.re" { goto loop; } #line 3554 "src/parse/lex.cc" } #line 635 "../src/parse/lex.re" } void Scanner::lex_c_comment() { loop: #line 3564 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= '\f') { if (yych <= 0x00) goto yy517; if (yych == '\n') goto yy521; goto yy519; } else { if (yych <= '\r') goto yy523; if (yych == '*') goto yy524; goto yy519; } yy517: ++YYCURSOR; #line 644 "../src/parse/lex.re" { fail_if_eof(); goto loop; } #line 3582 "src/parse/lex.cc" yy519: ++YYCURSOR; yy520: #line 645 "../src/parse/lex.re" { goto loop; } #line 3588 "src/parse/lex.cc" yy521: ++YYCURSOR; #line 643 "../src/parse/lex.re" { next_line(); goto loop; } #line 3593 "src/parse/lex.cc" yy523: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy521; goto yy520; yy524: yych = (YYCTYPE)*++YYCURSOR; if (yych != '/') goto yy520; ++YYCURSOR; #line 642 "../src/parse/lex.re" { return; } #line 3604 "src/parse/lex.cc" } #line 646 "../src/parse/lex.re" } void Scanner::lex_cpp_comment() { loop: #line 3614 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= '\n') { if (yych <= 0x00) goto yy529; if (yych <= '\t') goto yy531; goto yy533; } else { if (yych == '\r') goto yy535; goto yy531; } yy529: ++YYCURSOR; #line 654 "../src/parse/lex.re" { fail_if_eof(); goto loop; } #line 3631 "src/parse/lex.cc" yy531: ++YYCURSOR; yy532: #line 655 "../src/parse/lex.re" { goto loop; } #line 3637 "src/parse/lex.cc" yy533: ++YYCURSOR; #line 653 "../src/parse/lex.re" { next_line(); return; } #line 3642 "src/parse/lex.cc" yy535: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy533; goto yy532; } #line 656 "../src/parse/lex.re" } const AST *Scanner::lex_cls(bool neg) { std::vector<ASTRange> *cls = new std::vector<ASTRange>; uint32_t u, l; const loc_t &loc0 = tok_loc(); loc_t loc = cur_loc(); fst: tok = cur; #line 3661 "src/parse/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == ']') goto yy539; #line 669 "../src/parse/lex.re" { l = lex_cls_chr(); goto snd; } #line 3669 "src/parse/lex.cc" yy539: ++YYCURSOR; #line 668 "../src/parse/lex.re" { return ast_cls(loc0, cls, neg); } #line 3674 "src/parse/lex.cc" } #line 670 "../src/parse/lex.re" snd: #line 3680 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*(YYMARKER = YYCURSOR); if (yych == '-') goto yy544; yy543: #line 673 "../src/parse/lex.re" { u = l; goto add; } #line 3689 "src/parse/lex.cc" yy544: yych = (YYCTYPE)*++YYCURSOR; if (yych != ']') goto yy546; YYCURSOR = YYMARKER; goto yy543; yy546: ++YYCURSOR; YYCURSOR -= 1; #line 674 "../src/parse/lex.re" { u = lex_cls_chr(); if (l > u) { msg.warn.swapped_range(loc, l, u); std::swap(l, u); } goto add; } #line 3707 "src/parse/lex.cc" } #line 682 "../src/parse/lex.re" add: cls->push_back(ASTRange(l, u, loc)); loc = cur_loc(); goto fst; } uint32_t Scanner::lex_cls_chr() { tok = cur; const loc_t &loc = cur_loc(); #line 719 "../src/parse/lex.re" if (globopts->input_encoding == Enc::ASCII) { #line 3725 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; if ((YYLIMIT - YYCURSOR) < 10) YYFILL(10); yych = (YYCTYPE)*YYCURSOR; if (yych <= '\f') { if (yych <= 0x00) goto yy550; if (yych == '\n') goto yy554; goto yy552; } else { if (yych <= '\r') goto yy556; if (yych == '\\') goto yy557; goto yy552; } yy550: ++YYCURSOR; #line 700 "../src/parse/lex.re" { fail_if_eof(); return 0; } #line 3744 "src/parse/lex.cc" yy552: ++YYCURSOR; yy553: #line 702 "../src/parse/lex.re" { return decode(tok); } #line 3750 "src/parse/lex.cc" yy554: ++YYCURSOR; #line 694 "../src/parse/lex.re" { msg.error(loc, "newline in character class"); exit(1); } #line 3755 "src/parse/lex.cc" yy556: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy554; goto yy553; yy557: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '\\') { if (yych <= '/') { if (yych <= '\f') { if (yych <= 0x00) goto yy558; if (yych == '\n') goto yy554; goto yy559; } else { if (yych <= '\r') goto yy561; if (yych == '-') goto yy562; goto yy559; } } else { if (yych <= 'U') { if (yych <= '3') goto yy564; if (yych <= '7') goto yy566; if (yych <= 'T') goto yy559; goto yy567; } else { if (yych == 'X') goto yy569; if (yych <= '[') goto yy559; goto yy570; } } } else { if (yych <= 'n') { if (yych <= 'b') { if (yych <= ']') goto yy572; if (yych <= '`') goto yy559; if (yych <= 'a') goto yy574; goto yy576; } else { if (yych == 'f') goto yy578; if (yych <= 'm') goto yy559; goto yy580; } } else { if (yych <= 't') { if (yych == 'r') goto yy582; if (yych <= 's') goto yy559; goto yy584; } else { if (yych <= 'v') { if (yych <= 'u') goto yy569; goto yy586; } else { if (yych == 'x') goto yy588; goto yy559; } } } } yy558: #line 697 "../src/parse/lex.re" { msg.error(loc, "syntax error in escape sequence"); exit(1); } #line 3816 "src/parse/lex.cc" yy559: ++YYCURSOR; yy560: #line 715 "../src/parse/lex.re" { msg.warn.useless_escape(loc, tok, cur); return decode(tok + 1); } #line 3825 "src/parse/lex.cc" yy561: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy554; goto yy560; yy562: ++YYCURSOR; #line 713 "../src/parse/lex.re" { return static_cast<uint8_t>('-'); } #line 3834 "src/parse/lex.cc" yy564: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy565; if (yych <= '7') goto yy589; yy565: #line 696 "../src/parse/lex.re" { msg.error(loc, "syntax error in octal escape sequence"); exit(1); } #line 3843 "src/parse/lex.cc" yy566: ++YYCURSOR; goto yy565; yy567: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy568; if (yych <= '9') goto yy591; } else { if (yych <= 'F') goto yy591; if (yych <= '`') goto yy568; if (yych <= 'f') goto yy591; } yy568: #line 695 "../src/parse/lex.re" { msg.error(loc, "syntax error in hexadecimal escape sequence"); exit(1); } #line 3861 "src/parse/lex.cc" yy569: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy568; if (yych <= '9') goto yy592; goto yy568; } else { if (yych <= 'F') goto yy592; if (yych <= '`') goto yy568; if (yych <= 'f') goto yy592; goto yy568; } yy570: ++YYCURSOR; #line 712 "../src/parse/lex.re" { return static_cast<uint8_t>('\\'); } #line 3879 "src/parse/lex.cc" yy572: ++YYCURSOR; #line 714 "../src/parse/lex.re" { return static_cast<uint8_t>(']'); } #line 3884 "src/parse/lex.cc" yy574: ++YYCURSOR; #line 705 "../src/parse/lex.re" { return static_cast<uint8_t>('\a'); } #line 3889 "src/parse/lex.cc" yy576: ++YYCURSOR; #line 706 "../src/parse/lex.re" { return static_cast<uint8_t>('\b'); } #line 3894 "src/parse/lex.cc" yy578: ++YYCURSOR; #line 707 "../src/parse/lex.re" { return static_cast<uint8_t>('\f'); } #line 3899 "src/parse/lex.cc" yy580: ++YYCURSOR; #line 708 "../src/parse/lex.re" { return static_cast<uint8_t>('\n'); } #line 3904 "src/parse/lex.cc" yy582: ++YYCURSOR; #line 709 "../src/parse/lex.re" { return static_cast<uint8_t>('\r'); } #line 3909 "src/parse/lex.cc" yy584: ++YYCURSOR; #line 710 "../src/parse/lex.re" { return static_cast<uint8_t>('\t'); } #line 3914 "src/parse/lex.cc" yy586: ++YYCURSOR; #line 711 "../src/parse/lex.re" { return static_cast<uint8_t>('\v'); } #line 3919 "src/parse/lex.cc" yy588: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy568; if (yych <= '9') goto yy593; goto yy568; } else { if (yych <= 'F') goto yy593; if (yych <= '`') goto yy568; if (yych <= 'f') goto yy593; goto yy568; } yy589: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '/') goto yy590; if (yych <= '7') goto yy594; yy590: YYCURSOR = YYMARKER; if (yyaccept == 0) { goto yy565; } else { goto yy568; } yy591: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy590; if (yych <= '9') goto yy596; goto yy590; } else { if (yych <= 'F') goto yy596; if (yych <= '`') goto yy590; if (yych <= 'f') goto yy596; goto yy590; } yy592: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy590; if (yych <= '9') goto yy597; goto yy590; } else { if (yych <= 'F') goto yy597; if (yych <= '`') goto yy590; if (yych <= 'f') goto yy597; goto yy590; } yy593: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy590; if (yych <= '9') goto yy598; goto yy590; } else { if (yych <= 'F') goto yy598; if (yych <= '`') goto yy590; if (yych <= 'f') goto yy598; goto yy590; } yy594: ++YYCURSOR; #line 704 "../src/parse/lex.re" { return unesc_oct(tok, cur); } #line 3984 "src/parse/lex.cc" yy596: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy590; if (yych <= '9') goto yy600; goto yy590; } else { if (yych <= 'F') goto yy600; if (yych <= '`') goto yy590; if (yych <= 'f') goto yy600; goto yy590; } yy597: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy590; if (yych <= '9') goto yy593; goto yy590; } else { if (yych <= 'F') goto yy593; if (yych <= '`') goto yy590; if (yych <= 'f') goto yy593; goto yy590; } yy598: ++YYCURSOR; #line 703 "../src/parse/lex.re" { return unesc_hex(tok, cur); } #line 4013 "src/parse/lex.cc" yy600: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy590; if (yych >= ':') goto yy590; } else { if (yych <= 'F') goto yy601; if (yych <= '`') goto yy590; if (yych >= 'g') goto yy590; } yy601: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy590; if (yych <= '9') goto yy592; goto yy590; } else { if (yych <= 'F') goto yy592; if (yych <= '`') goto yy590; if (yych <= 'f') goto yy592; goto yy590; } } #line 721 "../src/parse/lex.re" } else { #line 4042 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; if ((YYLIMIT - YYCURSOR) < 10) YYFILL(10); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x7F) { if (yych <= '\f') { if (yych <= 0x00) goto yy604; if (yych == '\n') goto yy608; goto yy606; } else { if (yych <= '\r') goto yy610; if (yych == '\\') goto yy611; goto yy606; } } else { if (yych <= 0xEF) { if (yych <= 0xC1) goto yy613; if (yych <= 0xDF) goto yy615; if (yych <= 0xE0) goto yy616; goto yy617; } else { if (yych <= 0xF0) goto yy618; if (yych <= 0xF3) goto yy619; if (yych <= 0xF4) goto yy620; goto yy613; } } yy604: ++YYCURSOR; #line 700 "../src/parse/lex.re" { fail_if_eof(); return 0; } #line 4075 "src/parse/lex.cc" yy606: ++YYCURSOR; yy607: #line 702 "../src/parse/lex.re" { return decode(tok); } #line 4081 "src/parse/lex.cc" yy608: ++YYCURSOR; #line 694 "../src/parse/lex.re" { msg.error(loc, "newline in character class"); exit(1); } #line 4086 "src/parse/lex.cc" yy610: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy608; goto yy607; yy611: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 'b') { if (yych <= '7') { if (yych <= '\r') { if (yych <= '\t') { if (yych >= 0x01) goto yy621; } else { if (yych <= '\n') goto yy608; if (yych <= '\f') goto yy621; goto yy623; } } else { if (yych <= '-') { if (yych <= ',') goto yy621; goto yy624; } else { if (yych <= '/') goto yy621; if (yych <= '3') goto yy626; goto yy628; } } } else { if (yych <= '[') { if (yych <= 'U') { if (yych <= 'T') goto yy621; goto yy629; } else { if (yych == 'X') goto yy631; goto yy621; } } else { if (yych <= ']') { if (yych <= '\\') goto yy632; goto yy634; } else { if (yych <= '`') goto yy621; if (yych <= 'a') goto yy636; goto yy638; } } } } else { if (yych <= 'v') { if (yych <= 'q') { if (yych <= 'f') { if (yych <= 'e') goto yy621; goto yy640; } else { if (yych == 'n') goto yy642; goto yy621; } } else { if (yych <= 's') { if (yych <= 'r') goto yy644; goto yy621; } else { if (yych <= 't') goto yy646; if (yych <= 'u') goto yy631; goto yy648; } } } else { if (yych <= 0xDF) { if (yych <= 'x') { if (yych <= 'w') goto yy621; goto yy650; } else { if (yych <= 0x7F) goto yy621; if (yych >= 0xC2) goto yy651; } } else { if (yych <= 0xF0) { if (yych <= 0xE0) goto yy653; if (yych <= 0xEF) goto yy654; goto yy655; } else { if (yych <= 0xF3) goto yy656; if (yych <= 0xF4) goto yy657; } } } } yy612: #line 697 "../src/parse/lex.re" { msg.error(loc, "syntax error in escape sequence"); exit(1); } #line 4178 "src/parse/lex.cc" yy613: ++YYCURSOR; yy614: #line 698 "../src/parse/lex.re" { msg.error(loc, "syntax error"); exit(1); } #line 4184 "src/parse/lex.cc" yy615: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy614; if (yych <= 0xBF) goto yy606; goto yy614; yy616: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x9F) goto yy614; if (yych <= 0xBF) goto yy658; goto yy614; yy617: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x7F) goto yy614; if (yych <= 0xBF) goto yy658; goto yy614; yy618: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x8F) goto yy614; if (yych <= 0xBF) goto yy659; goto yy614; yy619: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x7F) goto yy614; if (yych <= 0xBF) goto yy659; goto yy614; yy620: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x7F) goto yy614; if (yych <= 0x8F) goto yy659; goto yy614; yy621: ++YYCURSOR; yy622: #line 715 "../src/parse/lex.re" { msg.warn.useless_escape(loc, tok, cur); return decode(tok + 1); } #line 4228 "src/parse/lex.cc" yy623: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy608; goto yy622; yy624: ++YYCURSOR; #line 713 "../src/parse/lex.re" { return static_cast<uint8_t>('-'); } #line 4237 "src/parse/lex.cc" yy626: yyaccept = 2; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy627; if (yych <= '7') goto yy660; yy627: #line 696 "../src/parse/lex.re" { msg.error(loc, "syntax error in octal escape sequence"); exit(1); } #line 4246 "src/parse/lex.cc" yy628: ++YYCURSOR; goto yy627; yy629: yyaccept = 3; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy630; if (yych <= '9') goto yy661; } else { if (yych <= 'F') goto yy661; if (yych <= '`') goto yy630; if (yych <= 'f') goto yy661; } yy630: #line 695 "../src/parse/lex.re" { msg.error(loc, "syntax error in hexadecimal escape sequence"); exit(1); } #line 4264 "src/parse/lex.cc" yy631: yyaccept = 3; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy630; if (yych <= '9') goto yy662; goto yy630; } else { if (yych <= 'F') goto yy662; if (yych <= '`') goto yy630; if (yych <= 'f') goto yy662; goto yy630; } yy632: ++YYCURSOR; #line 712 "../src/parse/lex.re" { return static_cast<uint8_t>('\\'); } #line 4282 "src/parse/lex.cc" yy634: ++YYCURSOR; #line 714 "../src/parse/lex.re" { return static_cast<uint8_t>(']'); } #line 4287 "src/parse/lex.cc" yy636: ++YYCURSOR; #line 705 "../src/parse/lex.re" { return static_cast<uint8_t>('\a'); } #line 4292 "src/parse/lex.cc" yy638: ++YYCURSOR; #line 706 "../src/parse/lex.re" { return static_cast<uint8_t>('\b'); } #line 4297 "src/parse/lex.cc" yy640: ++YYCURSOR; #line 707 "../src/parse/lex.re" { return static_cast<uint8_t>('\f'); } #line 4302 "src/parse/lex.cc" yy642: ++YYCURSOR; #line 708 "../src/parse/lex.re" { return static_cast<uint8_t>('\n'); } #line 4307 "src/parse/lex.cc" yy644: ++YYCURSOR; #line 709 "../src/parse/lex.re" { return static_cast<uint8_t>('\r'); } #line 4312 "src/parse/lex.cc" yy646: ++YYCURSOR; #line 710 "../src/parse/lex.re" { return static_cast<uint8_t>('\t'); } #line 4317 "src/parse/lex.cc" yy648: ++YYCURSOR; #line 711 "../src/parse/lex.re" { return static_cast<uint8_t>('\v'); } #line 4322 "src/parse/lex.cc" yy650: yyaccept = 3; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy630; if (yych <= '9') goto yy663; goto yy630; } else { if (yych <= 'F') goto yy663; if (yych <= '`') goto yy630; if (yych <= 'f') goto yy663; goto yy630; } yy651: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy652; if (yych <= 0xBF) goto yy621; yy652: YYCURSOR = YYMARKER; if (yyaccept <= 1) { if (yyaccept == 0) { goto yy612; } else { goto yy614; } } else { if (yyaccept == 2) { goto yy627; } else { goto yy630; } } yy653: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x9F) goto yy652; if (yych <= 0xBF) goto yy651; goto yy652; yy654: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy652; if (yych <= 0xBF) goto yy651; goto yy652; yy655: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x8F) goto yy652; if (yych <= 0xBF) goto yy654; goto yy652; yy656: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy652; if (yych <= 0xBF) goto yy654; goto yy652; yy657: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy652; if (yych <= 0x8F) goto yy654; goto yy652; yy658: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy652; if (yych <= 0xBF) goto yy606; goto yy652; yy659: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy652; if (yych <= 0xBF) goto yy658; goto yy652; yy660: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '/') goto yy652; if (yych <= '7') goto yy664; goto yy652; yy661: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy652; if (yych <= '9') goto yy666; goto yy652; } else { if (yych <= 'F') goto yy666; if (yych <= '`') goto yy652; if (yych <= 'f') goto yy666; goto yy652; } yy662: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy652; if (yych <= '9') goto yy667; goto yy652; } else { if (yych <= 'F') goto yy667; if (yych <= '`') goto yy652; if (yych <= 'f') goto yy667; goto yy652; } yy663: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy652; if (yych <= '9') goto yy668; goto yy652; } else { if (yych <= 'F') goto yy668; if (yych <= '`') goto yy652; if (yych <= 'f') goto yy668; goto yy652; } yy664: ++YYCURSOR; #line 704 "../src/parse/lex.re" { return unesc_oct(tok, cur); } #line 4435 "src/parse/lex.cc" yy666: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy652; if (yych <= '9') goto yy670; goto yy652; } else { if (yych <= 'F') goto yy670; if (yych <= '`') goto yy652; if (yych <= 'f') goto yy670; goto yy652; } yy667: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy652; if (yych <= '9') goto yy663; goto yy652; } else { if (yych <= 'F') goto yy663; if (yych <= '`') goto yy652; if (yych <= 'f') goto yy663; goto yy652; } yy668: ++YYCURSOR; #line 703 "../src/parse/lex.re" { return unesc_hex(tok, cur); } #line 4464 "src/parse/lex.cc" yy670: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy652; if (yych >= ':') goto yy652; } else { if (yych <= 'F') goto yy671; if (yych <= '`') goto yy652; if (yych >= 'g') goto yy652; } yy671: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy652; if (yych <= '9') goto yy662; goto yy652; } else { if (yych <= 'F') goto yy662; if (yych <= '`') goto yy652; if (yych <= 'f') goto yy662; goto yy652; } } #line 724 "../src/parse/lex.re" #line 724 "../src/parse/lex.re" } } bool Scanner::lex_str_chr(char quote, ASTChar &ast) { tok = cur; ast.loc = cur_loc(); #line 758 "../src/parse/lex.re" if (globopts->input_encoding == Enc::ASCII) { #line 4503 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; if ((YYLIMIT - YYCURSOR) < 10) YYFILL(10); yych = (YYCTYPE)*YYCURSOR; if (yych <= '\f') { if (yych <= 0x00) goto yy674; if (yych == '\n') goto yy678; goto yy676; } else { if (yych <= '\r') goto yy680; if (yych == '\\') goto yy681; goto yy676; } yy674: ++YYCURSOR; #line 740 "../src/parse/lex.re" { fail_if_eof(); ast.chr = 0; return true; } #line 4522 "src/parse/lex.cc" yy676: ++YYCURSOR; yy677: #line 742 "../src/parse/lex.re" { ast.chr = decode(tok); return tok[0] != quote; } #line 4528 "src/parse/lex.cc" yy678: ++YYCURSOR; #line 734 "../src/parse/lex.re" { msg.error(ast.loc, "newline in character string"); exit(1); } #line 4533 "src/parse/lex.cc" yy680: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy678; goto yy677; yy681: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '`') { if (yych <= '3') { if (yych <= '\n') { if (yych <= 0x00) goto yy682; if (yych <= '\t') goto yy683; goto yy678; } else { if (yych == '\r') goto yy685; if (yych <= '/') goto yy683; goto yy686; } } else { if (yych <= 'W') { if (yych <= '7') goto yy688; if (yych == 'U') goto yy689; goto yy683; } else { if (yych <= 'X') goto yy691; if (yych == '\\') goto yy692; goto yy683; } } } else { if (yych <= 'q') { if (yych <= 'e') { if (yych <= 'a') goto yy694; if (yych <= 'b') goto yy696; goto yy683; } else { if (yych <= 'f') goto yy698; if (yych == 'n') goto yy700; goto yy683; } } else { if (yych <= 'u') { if (yych <= 'r') goto yy702; if (yych <= 's') goto yy683; if (yych <= 't') goto yy704; goto yy691; } else { if (yych <= 'v') goto yy706; if (yych == 'x') goto yy708; goto yy683; } } } yy682: #line 737 "../src/parse/lex.re" { msg.error(ast.loc, "syntax error in escape sequence"); exit(1); } #line 4589 "src/parse/lex.cc" yy683: ++YYCURSOR; yy684: #line 753 "../src/parse/lex.re" { ast.chr = decode(tok + 1); if (tok[1] != quote) msg.warn.useless_escape(ast.loc, tok, cur); return true; } #line 4599 "src/parse/lex.cc" yy685: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy678; goto yy684; yy686: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy687; if (yych <= '7') goto yy709; yy687: #line 736 "../src/parse/lex.re" { msg.error(ast.loc, "syntax error in octal escape sequence"); exit(1); } #line 4612 "src/parse/lex.cc" yy688: ++YYCURSOR; goto yy687; yy689: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy690; if (yych <= '9') goto yy711; } else { if (yych <= 'F') goto yy711; if (yych <= '`') goto yy690; if (yych <= 'f') goto yy711; } yy690: #line 735 "../src/parse/lex.re" { msg.error(ast.loc, "syntax error in hexadecimal escape sequence"); exit(1); } #line 4630 "src/parse/lex.cc" yy691: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy690; if (yych <= '9') goto yy712; goto yy690; } else { if (yych <= 'F') goto yy712; if (yych <= '`') goto yy690; if (yych <= 'f') goto yy712; goto yy690; } yy692: ++YYCURSOR; #line 752 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\\'); return true; } #line 4648 "src/parse/lex.cc" yy694: ++YYCURSOR; #line 745 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\a'); return true; } #line 4653 "src/parse/lex.cc" yy696: ++YYCURSOR; #line 746 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\b'); return true; } #line 4658 "src/parse/lex.cc" yy698: ++YYCURSOR; #line 747 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\f'); return true; } #line 4663 "src/parse/lex.cc" yy700: ++YYCURSOR; #line 748 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\n'); return true; } #line 4668 "src/parse/lex.cc" yy702: ++YYCURSOR; #line 749 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\r'); return true; } #line 4673 "src/parse/lex.cc" yy704: ++YYCURSOR; #line 750 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\t'); return true; } #line 4678 "src/parse/lex.cc" yy706: ++YYCURSOR; #line 751 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\v'); return true; } #line 4683 "src/parse/lex.cc" yy708: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy690; if (yych <= '9') goto yy713; goto yy690; } else { if (yych <= 'F') goto yy713; if (yych <= '`') goto yy690; if (yych <= 'f') goto yy713; goto yy690; } yy709: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '/') goto yy710; if (yych <= '7') goto yy714; yy710: YYCURSOR = YYMARKER; if (yyaccept == 0) { goto yy687; } else { goto yy690; } yy711: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy710; if (yych <= '9') goto yy716; goto yy710; } else { if (yych <= 'F') goto yy716; if (yych <= '`') goto yy710; if (yych <= 'f') goto yy716; goto yy710; } yy712: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy710; if (yych <= '9') goto yy717; goto yy710; } else { if (yych <= 'F') goto yy717; if (yych <= '`') goto yy710; if (yych <= 'f') goto yy717; goto yy710; } yy713: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy710; if (yych <= '9') goto yy718; goto yy710; } else { if (yych <= 'F') goto yy718; if (yych <= '`') goto yy710; if (yych <= 'f') goto yy718; goto yy710; } yy714: ++YYCURSOR; #line 744 "../src/parse/lex.re" { ast.chr = unesc_oct(tok, cur); return true; } #line 4748 "src/parse/lex.cc" yy716: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy710; if (yych <= '9') goto yy720; goto yy710; } else { if (yych <= 'F') goto yy720; if (yych <= '`') goto yy710; if (yych <= 'f') goto yy720; goto yy710; } yy717: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy710; if (yych <= '9') goto yy713; goto yy710; } else { if (yych <= 'F') goto yy713; if (yych <= '`') goto yy710; if (yych <= 'f') goto yy713; goto yy710; } yy718: ++YYCURSOR; #line 743 "../src/parse/lex.re" { ast.chr = unesc_hex(tok, cur); return true; } #line 4777 "src/parse/lex.cc" yy720: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy710; if (yych >= ':') goto yy710; } else { if (yych <= 'F') goto yy721; if (yych <= '`') goto yy710; if (yych >= 'g') goto yy710; } yy721: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy710; if (yych <= '9') goto yy712; goto yy710; } else { if (yych <= 'F') goto yy712; if (yych <= '`') goto yy710; if (yych <= 'f') goto yy712; goto yy710; } } #line 760 "../src/parse/lex.re" } else { #line 4806 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; if ((YYLIMIT - YYCURSOR) < 10) YYFILL(10); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x7F) { if (yych <= '\f') { if (yych <= 0x00) goto yy724; if (yych == '\n') goto yy728; goto yy726; } else { if (yych <= '\r') goto yy730; if (yych == '\\') goto yy731; goto yy726; } } else { if (yych <= 0xEF) { if (yych <= 0xC1) goto yy733; if (yych <= 0xDF) goto yy735; if (yych <= 0xE0) goto yy736; goto yy737; } else { if (yych <= 0xF0) goto yy738; if (yych <= 0xF3) goto yy739; if (yych <= 0xF4) goto yy740; goto yy733; } } yy724: ++YYCURSOR; #line 740 "../src/parse/lex.re" { fail_if_eof(); ast.chr = 0; return true; } #line 4839 "src/parse/lex.cc" yy726: ++YYCURSOR; yy727: #line 742 "../src/parse/lex.re" { ast.chr = decode(tok); return tok[0] != quote; } #line 4845 "src/parse/lex.cc" yy728: ++YYCURSOR; #line 734 "../src/parse/lex.re" { msg.error(ast.loc, "newline in character string"); exit(1); } #line 4850 "src/parse/lex.cc" yy730: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy728; goto yy727; yy731: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 'f') { if (yych <= 'T') { if (yych <= '\f') { if (yych <= 0x00) goto yy732; if (yych == '\n') goto yy728; goto yy741; } else { if (yych <= '/') { if (yych <= '\r') goto yy743; goto yy741; } else { if (yych <= '3') goto yy744; if (yych <= '7') goto yy746; goto yy741; } } } else { if (yych <= '\\') { if (yych <= 'W') { if (yych <= 'U') goto yy747; goto yy741; } else { if (yych <= 'X') goto yy749; if (yych <= '[') goto yy741; goto yy750; } } else { if (yych <= 'a') { if (yych <= '`') goto yy741; goto yy752; } else { if (yych <= 'b') goto yy754; if (yych <= 'e') goto yy741; goto yy756; } } } } else { if (yych <= 'w') { if (yych <= 'r') { if (yych == 'n') goto yy758; if (yych <= 'q') goto yy741; goto yy760; } else { if (yych <= 't') { if (yych <= 's') goto yy741; goto yy762; } else { if (yych <= 'u') goto yy749; if (yych <= 'v') goto yy764; goto yy741; } } } else { if (yych <= 0xE0) { if (yych <= 0x7F) { if (yych <= 'x') goto yy766; goto yy741; } else { if (yych <= 0xC1) goto yy732; if (yych <= 0xDF) goto yy767; goto yy769; } } else { if (yych <= 0xF0) { if (yych <= 0xEF) goto yy770; goto yy771; } else { if (yych <= 0xF3) goto yy772; if (yych <= 0xF4) goto yy773; } } } } yy732: #line 737 "../src/parse/lex.re" { msg.error(ast.loc, "syntax error in escape sequence"); exit(1); } #line 4935 "src/parse/lex.cc" yy733: ++YYCURSOR; yy734: #line 738 "../src/parse/lex.re" { msg.error(ast.loc, "syntax error"); exit(1); } #line 4941 "src/parse/lex.cc" yy735: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy734; if (yych <= 0xBF) goto yy726; goto yy734; yy736: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x9F) goto yy734; if (yych <= 0xBF) goto yy774; goto yy734; yy737: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x7F) goto yy734; if (yych <= 0xBF) goto yy774; goto yy734; yy738: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x8F) goto yy734; if (yych <= 0xBF) goto yy775; goto yy734; yy739: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x7F) goto yy734; if (yych <= 0xBF) goto yy775; goto yy734; yy740: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x7F) goto yy734; if (yych <= 0x8F) goto yy775; goto yy734; yy741: ++YYCURSOR; yy742: #line 753 "../src/parse/lex.re" { ast.chr = decode(tok + 1); if (tok[1] != quote) msg.warn.useless_escape(ast.loc, tok, cur); return true; } #line 4986 "src/parse/lex.cc" yy743: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy728; goto yy742; yy744: yyaccept = 2; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy745; if (yych <= '7') goto yy776; yy745: #line 736 "../src/parse/lex.re" { msg.error(ast.loc, "syntax error in octal escape sequence"); exit(1); } #line 4999 "src/parse/lex.cc" yy746: ++YYCURSOR; goto yy745; yy747: yyaccept = 3; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy748; if (yych <= '9') goto yy777; } else { if (yych <= 'F') goto yy777; if (yych <= '`') goto yy748; if (yych <= 'f') goto yy777; } yy748: #line 735 "../src/parse/lex.re" { msg.error(ast.loc, "syntax error in hexadecimal escape sequence"); exit(1); } #line 5017 "src/parse/lex.cc" yy749: yyaccept = 3; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy748; if (yych <= '9') goto yy778; goto yy748; } else { if (yych <= 'F') goto yy778; if (yych <= '`') goto yy748; if (yych <= 'f') goto yy778; goto yy748; } yy750: ++YYCURSOR; #line 752 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\\'); return true; } #line 5035 "src/parse/lex.cc" yy752: ++YYCURSOR; #line 745 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\a'); return true; } #line 5040 "src/parse/lex.cc" yy754: ++YYCURSOR; #line 746 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\b'); return true; } #line 5045 "src/parse/lex.cc" yy756: ++YYCURSOR; #line 747 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\f'); return true; } #line 5050 "src/parse/lex.cc" yy758: ++YYCURSOR; #line 748 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\n'); return true; } #line 5055 "src/parse/lex.cc" yy760: ++YYCURSOR; #line 749 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\r'); return true; } #line 5060 "src/parse/lex.cc" yy762: ++YYCURSOR; #line 750 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\t'); return true; } #line 5065 "src/parse/lex.cc" yy764: ++YYCURSOR; #line 751 "../src/parse/lex.re" { ast.chr = static_cast<uint8_t>('\v'); return true; } #line 5070 "src/parse/lex.cc" yy766: yyaccept = 3; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { if (yych <= '/') goto yy748; if (yych <= '9') goto yy779; goto yy748; } else { if (yych <= 'F') goto yy779; if (yych <= '`') goto yy748; if (yych <= 'f') goto yy779; goto yy748; } yy767: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy768; if (yych <= 0xBF) goto yy741; yy768: YYCURSOR = YYMARKER; if (yyaccept <= 1) { if (yyaccept == 0) { goto yy732; } else { goto yy734; } } else { if (yyaccept == 2) { goto yy745; } else { goto yy748; } } yy769: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x9F) goto yy768; if (yych <= 0xBF) goto yy767; goto yy768; yy770: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy768; if (yych <= 0xBF) goto yy767; goto yy768; yy771: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x8F) goto yy768; if (yych <= 0xBF) goto yy770; goto yy768; yy772: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy768; if (yych <= 0xBF) goto yy770; goto yy768; yy773: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy768; if (yych <= 0x8F) goto yy770; goto yy768; yy774: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy768; if (yych <= 0xBF) goto yy726; goto yy768; yy775: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x7F) goto yy768; if (yych <= 0xBF) goto yy774; goto yy768; yy776: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '/') goto yy768; if (yych <= '7') goto yy780; goto yy768; yy777: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy768; if (yych <= '9') goto yy782; goto yy768; } else { if (yych <= 'F') goto yy782; if (yych <= '`') goto yy768; if (yych <= 'f') goto yy782; goto yy768; } yy778: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy768; if (yych <= '9') goto yy783; goto yy768; } else { if (yych <= 'F') goto yy783; if (yych <= '`') goto yy768; if (yych <= 'f') goto yy783; goto yy768; } yy779: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy768; if (yych <= '9') goto yy784; goto yy768; } else { if (yych <= 'F') goto yy784; if (yych <= '`') goto yy768; if (yych <= 'f') goto yy784; goto yy768; } yy780: ++YYCURSOR; #line 744 "../src/parse/lex.re" { ast.chr = unesc_oct(tok, cur); return true; } #line 5183 "src/parse/lex.cc" yy782: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy768; if (yych <= '9') goto yy786; goto yy768; } else { if (yych <= 'F') goto yy786; if (yych <= '`') goto yy768; if (yych <= 'f') goto yy786; goto yy768; } yy783: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy768; if (yych <= '9') goto yy779; goto yy768; } else { if (yych <= 'F') goto yy779; if (yych <= '`') goto yy768; if (yych <= 'f') goto yy779; goto yy768; } yy784: ++YYCURSOR; #line 743 "../src/parse/lex.re" { ast.chr = unesc_hex(tok, cur); return true; } #line 5212 "src/parse/lex.cc" yy786: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy768; if (yych >= ':') goto yy768; } else { if (yych <= 'F') goto yy787; if (yych <= '`') goto yy768; if (yych >= 'g') goto yy768; } yy787: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { if (yych <= '/') goto yy768; if (yych <= '9') goto yy778; goto yy768; } else { if (yych <= 'F') goto yy778; if (yych <= '`') goto yy768; if (yych <= 'f') goto yy778; goto yy768; } } #line 763 "../src/parse/lex.re" #line 763 "../src/parse/lex.re" } } const AST *Scanner::lex_str(char quote) { const loc_t &loc = tok_loc(); std::vector<ASTChar> *str = new std::vector<ASTChar>; ASTChar c; for (;;) { if (!lex_str_chr(quote, c)) { return ast_str(loc, str, quote == '\''); } str->push_back(c); } } void Scanner::set_sourceline () { sourceline: tok = cur; #line 5260 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= '\r') { if (yych <= '\t') { if (yych >= 0x01) goto yy792; } else { if (yych <= '\n') goto yy794; if (yych <= '\f') goto yy792; goto yy796; } } else { if (yych <= '"') { if (yych <= '!') goto yy792; goto yy797; } else { if (yych <= '0') goto yy792; if (yych <= '9') goto yy798; goto yy792; } } ++YYCURSOR; #line 806 "../src/parse/lex.re" { --cur; return; } #line 5320 "src/parse/lex.cc" yy792: ++YYCURSOR; yy793: #line 807 "../src/parse/lex.re" { goto sourceline; } #line 5326 "src/parse/lex.cc" yy794: ++YYCURSOR; #line 805 "../src/parse/lex.re" { pos = tok = cur; return; } #line 5331 "src/parse/lex.cc" yy796: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy794; goto yy793; yy797: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x00) goto yy793; if (yych == '\n') goto yy793; goto yy802; yy798: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 64) { goto yy798; } #line 785 "../src/parse/lex.re" { uint32_t l; if (!s_to_u32_unsafe(tok, cur, l)) { msg.error(tok_loc(), "line number overflow"); exit(1); } set_line(l); goto sourceline; } #line 5358 "src/parse/lex.cc" yy801: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; yy802: if (yybm[0+yych] & 128) { goto yy801; } if (yych <= '\n') goto yy803; if (yych <= '"') goto yy804; goto yy806; yy803: YYCURSOR = YYMARKER; goto yy793; yy804: ++YYCURSOR; #line 795 "../src/parse/lex.re" { Input &in = get_input(); std::string &name = in.escaped_name; name = getstr(tok + 1, cur - 1); strrreplace(name, "\\", "\\\\"); in.fidx = static_cast<uint32_t>(msg.filenames.size()); msg.filenames.push_back(name); goto sourceline; } #line 5385 "src/parse/lex.cc" yy806: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x00) goto yy803; if (yych == '\n') goto yy803; goto yy801; } #line 808 "../src/parse/lex.re" } void Scanner::fail_if_eof() const { if (is_eof()) { msg.error(cur_loc(), "unexpected end of input"); exit(1); } } #undef YYCTYPE #undef YYCURSOR #undef YYLIMIT #undef YYMARKER #undef YYFILL } // end namespace re2c
Stivvo/qt-ts-csv
qt-ts-csv/main/Version.hpp
#pragma once #include <string> static const std::string version = "2.2.0"; class Version { public: explicit Version(std::string &&version); static Version current() noexcept; bool operator==(const Version &other) const; bool operator>(const Version &other) const; bool operator<(const Version &other) const; bool operator<=(const Version &other) const; std::string as_string() const noexcept; private: const std::string actual{ version }; std::tuple<int, int, int> get_maj_min_rev(const std::string &v) const; };
fantj2016/internet-plus
ip-user-server/src/main/java/com/tyut/user/vo/GroupVo.java
package com.tyut.user.vo; import lombok.Data; import java.io.Serializable; /** * 根据key 查到某个队伍 * Created by Fant.J. * 2018/5/26 23:14 */ @Data public class GroupVo implements Serializable { /** * 队伍 id */ private Integer groupId; /** * 队伍名字 */ private String groupName; /** * 竞赛名字 */ private String cptName; /** * 加队口令 */ private String groupKey; /** * 队伍地址 */ private String groupAddress; /** * 联系方式 */ private String groupPhone; /** * 竞赛id */ private Integer cptId; }
yuyueqty/longmarch-web
src/api/DouyinAccount.js
<reponame>yuyueqty/longmarch-web import request from '@/utils/request' export function fetchList() { return request({ url: '/douyin/list', method: 'get' }) } export function oauth() { return request({ url: '/douyin/loginUrl', method: 'get' }) } export function refreshToken(openId) { return request({ url: '/douyin/refreshToken/' + openId, method: 'get' }) } export function setDefault(openId) { return request({ url: '/douyin/setDefault/' + openId, method: 'post' }) }
KM3NeT/km3io
km3io/_definitions/w2list_gseagen.py
<reponame>KM3NeT/km3io<gh_stars>1-10 # -*- coding: utf-8 -*- """ KM3NeT Data Definitions v2.0.0-9-gbae3720 https://git.km3net.de/common/km3net-dataformat """ # w2list_gseagen data = dict( W2LIST_GSEAGEN_PS=0, W2LIST_GSEAGEN_EG=1, W2LIST_GSEAGEN_XSEC_MEAN=2, W2LIST_GSEAGEN_COLUMN_DEPTH=3, W2LIST_GSEAGEN_P_EARTH=4, W2LIST_GSEAGEN_WATER_INT_LEN=5, W2LIST_GSEAGEN_P_SCALE=6, W2LIST_GSEAGEN_BX=7, W2LIST_GSEAGEN_BY=8, W2LIST_GSEAGEN_ICHAN=9, W2LIST_GSEAGEN_CC=10, W2LIST_GSEAGEN_DISTAMAX=11, W2LIST_GSEAGEN_WATERXSEC=12, W2LIST_GSEAGEN_XSEC=13, W2LIST_GSEAGEN_DXSEC=14, W2LIST_GSEAGEN_TARGETA=15, W2LIST_GSEAGEN_TARGETZ=16, W2LIST_GSEAGEN_VERINCAN=17, W2LIST_GSEAGEN_LEPINCAN=18, W2LIST_GSEAGEN_N_RETRIES=19, W2LIST_GSEAGEN_CUSTOM_YAW=20, W2LIST_GSEAGEN_CUSTOM_PITCH=21, W2LIST_GSEAGEN_CUSTOM_ROLL=22, )
katemihalikova/test262
test/built-ins/JSON/stringify/value-array-abrupt.js
// Copyright (C) 2019 <NAME>. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-serializejsonarray description: > Abrupt completion from Get. info: | JSON.stringify ( value [ , replacer [ , space ] ] ) [...] 12. Return ? SerializeJSONProperty(the empty String, wrapper). SerializeJSONProperty ( key, holder ) [...] 10. If Type(value) is Object and IsCallable(value) is false, then a. Let isArray be ? IsArray(value). b. If isArray is true, return ? SerializeJSONArray(value). SerializeJSONArray ( value ) [...] 6. Let len be ? LengthOfArrayLike(value). features: [Proxy] ---*/ var abruptLength = new Proxy([], { get: function(_target, key) { if (key === 'length') { throw new Test262Error(); } }, }); assert.throws(Test262Error, function() { JSON.stringify(abruptLength); }); var abruptToPrimitive = { valueOf: function() { throw new Test262Error(); }, }; var abruptToLength = new Proxy([], { get: function(_target, key) { if (key === 'length') { return abruptToPrimitive; } }, }); assert.throws(Test262Error, function() { JSON.stringify([abruptToLength]); }); var abruptIndex = new Array(1); Object.defineProperty(abruptIndex, '0', { get: function() { throw new Test262Error(); }, }); assert.throws(Test262Error, function() { JSON.stringify({key: abruptIndex}); });
amiashraf/loopback-datatest
bin/instance-introspection.js
var path = require('path'); var app = require(path.resolve(__dirname, '../server/server')); var ds = app.datasources.accountDS; var account = { email: '<EMAIL>', createdAt: new Date(), lastModifiedAt: new Date() }; var opts = { idInjection: true }; var Account = ds.buildModelFromInstance('Account', account, opts); var instance = new Account(account); console.log(instance); // //Account.create(instance, function(err, model) { // if (err) throw err; // // console.log('Created:', model); // // ds.disconnect(); //});
maciejg-git/vue-bootstrap-icons
dist-mdi/mdi/bus-stop-covered.js
import { h } from 'vue' export default { name: "BusStopCovered", vendor: "Mdi", type: "", tags: ["bus","stop","covered"], render() { return h( "svg", {"xmlns":"http://www.w3.org/2000/svg","width":"24","height":"24","viewBox":"0 0 24 24","class":"v-icon","fill":"currentColor","data-name":"mdi-bus-stop-covered","innerHTML":"<path d='M20 3H7V2H6A1.78 1.78 0 0 0 4.59 3H2V5H3.73C2 10.58 2 22 2 22H7V5H20M22 8.5A2.5 2.5 0 1 0 19 11V22H20V11A2.5 2.5 0 0 0 22 8.5M15 11.5V16H14V22H12.5V17H11.5V22H10V16H9V11.5A1.5 1.5 0 0 1 10.5 10H13.5A1.5 1.5 0 0 1 15 11.5M12 6.5A1.5 1.5 0 1 0 13.5 8A1.5 1.5 0 0 0 12 6.5Z' />"}, ) } }
LaurensMakel1/iaf
core/src/main/java/nl/nn/adapterframework/configuration/classloaders/BasePathClassLoader.java
<filename>core/src/main/java/nl/nn/adapterframework/configuration/classloaders/BasePathClassLoader.java /* Copyright 2016, 2018 Nationale-Nederlanden 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 nl.nn.adapterframework.configuration.classloaders; import java.io.IOException; import java.net.URL; import java.util.Collections; import java.util.Enumeration; import java.util.Vector; import nl.nn.adapterframework.configuration.ConfigurationException; public class BasePathClassLoader extends ClassLoader implements ReloadAware { private String basePath; public BasePathClassLoader(ClassLoader parent, String basePath) { super(parent); this.basePath = basePath; } @Override public URL getResource(String name) { return getResource(name, true); } public URL getResource(String name, boolean useWithoutBasePath) { URL url = getParent().getResource(basePath + name); if (url != null) { return url; } else { if(useWithoutBasePath) return getParent().getResource(name); else return null; } } @Override public Enumeration<URL> getResources(String name) throws IOException { Vector<URL> urls = new Vector<URL>(); URL basePathUrl = getResource(name, false); if (basePathUrl != null) urls.add(basePathUrl); urls.addAll(Collections.list(getParent().getResources(name))); return urls.elements(); } public void reload() throws ConfigurationException { if (getParent() instanceof ReloadAware) { ((ReloadAware)getParent()).reload(); } } @Override public String toString() { return getParent().toString() +" wrapped in "+ super.toString(); } }
DamieFC/chromium
remoting/host/mojo_ipc_server.h
<filename>remoting/host/mojo_ipc_server.h // Copyright 2021 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef REMOTING_HOST_MOJO_IPC_SERVER_H_ #define REMOTING_HOST_MOJO_IPC_SERVER_H_ #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "base/sequenced_task_runner.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h" #include "mojo/public/cpp/platform/named_platform_channel.h" #include "mojo/public/cpp/system/message_pipe.h" #include "mojo/public/cpp/system/simple_watcher.h" namespace remoting { // Template-less base class to keep implementations in the .cc file. For usage, // see MojoIpcServer. class MojoIpcServerBase { public: // Starts sending out mojo invitations and accepting IPCs. No-op if the server // is already started. void StartServer(); // Stops sending out mojo invitations and accepting IPCs. No-op if the server // is already stopped. void StopServer(); protected: explicit MojoIpcServerBase( const mojo::NamedPlatformChannel::ServerName& server_name, uint64_t message_pipe_id); virtual ~MojoIpcServerBase(); void SendInvitation(); virtual void CloseAllConnections() = 0; virtual void OnInvitationAccepted( mojo::ScopedMessagePipeHandle message_pipe) = 0; SEQUENCE_CHECKER(sequence_checker_); private: void OnInvitationSent(mojo::ScopedMessagePipeHandle message_pipe); void OnMessagePipeReady(MojoResult result, const mojo::HandleSignalsState& state); mojo::NamedPlatformChannel::ServerName server_name_; uint64_t message_pipe_id_; bool server_started_ = false; // A task runner to run blocking jobs. scoped_refptr<base::SequencedTaskRunner> io_sequence_; // The message pipe will be "pending" until a client accepts the invitation. mojo::SimpleWatcher pending_message_pipe_watcher_; mojo::ScopedMessagePipeHandle pending_message_pipe_; base::WeakPtrFactory<MojoIpcServerBase> weak_factory_{this}; }; // A helper that uses a NamedPlatformChannel to send out mojo invitations and // maintains multiple concurrent IPCs. It keeps one outgoing invitation at a // time and will send a new invitation whenever the previous one has been // accepted by the client. // // Example usage: // // class MyInterfaceImpl: public mojom::MyInterface { // void Start() { // server_.set_disconnect_handler( // base::BindRepeating(&MyInterfaceImpl::OnDisconnected, this)); // server_.StartServer(); // } // void OnDisconnected() { // LOG(INFO) << "Receiver disconnected: " << server_.current_receiver(); // } // // mojom::MyInterface Implementation. // void DoWork() override { // // Do something... // // If you want to close the connection: // server_.Close(server_.current_receiver()); // } // MojoIpcServer<mojom::MyInterface> server_{"my_server_name", 0, this}; // }; template <typename Interface> class MojoIpcServer final : public MojoIpcServerBase { public: // server_name: The server name to start the NamedPlatformChannel. // message_pipe_id: The message pipe ID. The client must call // ExtractMessagePipe() with the same ID. MojoIpcServer(const mojo::NamedPlatformChannel::ServerName& server_name, uint64_t message_pipe_id, Interface* interface_impl) : MojoIpcServerBase(server_name, message_pipe_id), interface_impl_(interface_impl) {} ~MojoIpcServer() override { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // StopServer() calls CloseAllConnections(), which is not implemented in // the base class, so this method can't be called in ~MojoIpcServerBase(). StopServer(); } MojoIpcServer(const MojoIpcServer&) = delete; MojoIpcServer& operator=(const MojoIpcServer&) = delete; // Close the receiver identified by |id| and disconnects the remote. No-op if // |id| doesn't exist or the receiver is already closed. // // Returns a boolean that indicates whether a receiver has be closed. bool Close(mojo::ReceiverId id) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return receiver_set_.Remove(id); } // Sets a callback to be invoked any time a receiver is disconnected. You may // find out which receiver is being disconnected by calling // |current_receiver()|. void set_disconnect_handler(base::RepeatingClosure handler) { receiver_set_.set_disconnect_handler(handler); } // Call this method to learn which receiver has received the incoming IPC or // which receiver is being disconnected. mojo::ReceiverId current_receiver() const { return receiver_set_.current_receiver(); } private: // MojoIpcServerBase implementation. void CloseAllConnections() override { receiver_set_.Clear(); } void OnInvitationAccepted( mojo::ScopedMessagePipeHandle message_pipe) override { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); receiver_set_.Add(interface_impl_, mojo::PendingReceiver<Interface>( std::move(message_pipe))); SendInvitation(); } Interface* interface_impl_; mojo::ReceiverSet<Interface> receiver_set_; }; } // namespace remoting #endif // REMOTING_HOST_MOJO_IPC_SERVER_H_
kostyrko/small_eod
backend-project/small_eod/features/admin.py
from django.contrib import admin from .models import Feature, FeatureOption admin.site.register(Feature) admin.site.register(FeatureOption)
openharmony/xts_acts
aafwk/aafwk_standard/serviceability/stserviceabilityserversecond/entry/src/main/js/default/pages/index/index.js
/* * Copyright (c) 2021 Huawei Device Co., 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. */ import rpc from "@ohos.rpc"; let mMyStub; import particleAbility from '@ohos.ability.particleability' import featureAbility from '@ohos.ability.featureAbility' import commonEvent from '@ohos.commonevent' var server_bundleName = "com.amsst.stserviceabilityserver"; var server_abilityName = "com.amsst.stserviceabilityserver.MainAbility"; var mConnIdJs; export default { data: { title: "" }, onInit() { this.title = this.$t('strings.world'); }, onShow() { console.debug('ACTS_SerivceAbilityServer ====<onShow') }, onReady() { console.debug('ACTS_SerivceAbilityServerSecond ====<onReady'); }, onReconnect(want) { console.debug('ACTS_SerivceAbilityServerSecond ====>onReconnect=' + want + " , JSON." + JSON.stringify(want)); }, onActive() { console.debug('ACTS_SerivceAbilityServerSecond ====<onActive'); commonEvent.publish("ACTS_SerivceAbilityServerSecond_onActive", (err) => { }); }, onCommand(want, restart, startId) { console.debug('ACTS_SerivceAbilityServerSecond ====>onCommand=' + "JSON(want)=" + JSON.stringify(want) + " ,restart=" + restart + " ,startId=" + startId); commonEvent.publish("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action, (err) => { }); featureAbility.terminateSelf(); }, onStart(want) { console.debug('ACTS_SerivceAbilityServerSecond ====>onStart=' + want + " , JSON." + JSON.stringify(want)); commonEvent.publish("ACTS_SerivceAbilityServerSecond_onStart", (err) => { }); class MyStub extends rpc.RemoteObject { constructor(des) { super(des); } } console.debug("ACTS_SerivceAbilityServerSecond ====< RPCTestServer"); mMyStub = new MyStub("ServiceAbility-test"); console.debug("ACTS_SerivceAbilityServerSecond RPCTestServer: mMyStub:" + mMyStub + " ,JSON. " + JSON.stringify(mMyStub)) }, onStop() { console.debug('ACTS_SerivceAbilityServerSecond ====<onStop'); commonEvent.publish("ACTS_SerivceAbilityServerSecond_onStop", (err) => { }); featureAbility.terminateSelf(); }, onConnect(want) { console.debug('ACTS_SerivceAbilityServerSecond ====>onConnect=' + want + " , JSON." + JSON.stringify(want)); function onConnectCallback(element, remote) { console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> want.action=' + JSON.stringify(want.action) + " , " + want.action); console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> element=' + JSON.stringify(element) + " , " + element); console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> remote=' + JSON.stringify(remote) + " , " + remote); if(want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600'){ commonEvent.publish("ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action, (err) => { console.debug("publish = ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action); }); } } function onDisconnectCallback(element) { console.debug('ACTS_SerivceAbilityServerSecond_onDisconnectCallback ====> element=' + JSON.stringify(element) + " , " + element); } function onFailedCallback(code) { console.debug('ACTS_SerivceAbilityServerSecond_onFailedCallback ====> code=' + JSON.stringify(code) + " , " + code) } if (want.action == 'ServiceConnectService_1500') { mConnIdJs = particleAbility.connectAbility( { bundleName: server_bundleName, abilityName: server_abilityName, action: "ServiceConnectService_1501", }, { onConnect: onConnectCallback, onDisconnect: onDisconnectCallback, onFailed: onFailedCallback, }, ) } else if (want.action == 'ServiceConnectService_1600') { mConnIdJs = particleAbility.connectAbility( { bundleName: server_bundleName, abilityName: server_abilityName, action: "ServiceConnectService_1601", }, { onConnect: onConnectCallback, onDisconnect: onDisconnectCallback, onFailed: onFailedCallback, }, ) } else if (want.action == 'ServiceConnectService_1590') { mConnIdJs = particleAbility.connectAbility( { bundleName: server_bundleName, abilityName: server_abilityName, action: "ServiceConnectService_1591", }, { onConnect: onConnectCallback, onDisconnect: onDisconnectCallback, onFailed: onFailedCallback, }, ) } else { commonEvent.publish("ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action, (err) => { }); } return mMyStub; }, OnAbilityConnectDone(element, remoteObject, resultCode) { console.debug('ACTS_SerivceAbilityServerSecond ====>OnAbilityConnectDone=' + element + " , JSON." + JSON.stringify(element) + remoteObject + " , JSON." + JSON.stringify(remoteObject) + resultCode + " , JSON." + JSON.stringify(resultCode) ); commonEvent.publish("ACTS_SerivceAbilityServerSecond_OnAbilityConnectDone", (err) => { }); }, onDisconnect(want) { console.debug('ACTS_SerivceAbilityServerSecond ====>onDisConnect=' + want + " , JSON." + JSON.stringify(want)); commonEvent.publish("ACTS_SerivceAbilityServerSecond_onDisConnect", (err) => { if (err.code) { console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect publish err=====>' + err); } else { console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect featureAbility.terminateSelf()=====<' + want.action); if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501' || want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601' || want.action == 'ServiceConnectService_1590') { particleAbility.disconnectAbility(mConnIdJs, (err) => { console.debug("=ACTS_SerivceAbilityServerSecond_onDisConnect err====>" + ("json err=") + JSON.stringify(err) + " , " + want.action); }) } featureAbility.terminateSelf(); } }); }, }
knivey/gitbot
repository.go
<gh_stars>1-10 package gitbot // Repository is the general repository object in the github API type Repository struct { Owner *User `json:"owner"` ID int `json:"id"` Name string `json:"name"` FullName string `json:"full_name"` Description string `json:"description"` Private bool `json:"private"` Fork bool `json:"fork"` URL string `json:"url"` HTMLURL string `json:"html_url"` CloneURL string `json:"clone_url"` GitURL string `json:"git_url"` SSHURL string `json:"ssh_url"` SVNURL string `json:"svn_url"` MirrorURL string `json:"mirror_url"` Homepage string `json:"homepage"` Language string `json:"language"` ForksCount int `json:"forks_count"` StargazersCount int `json:"stargazers_count"` WatchersCount int `json:"watchers_count"` Size int `json:"size"` DefaultBranch string `json:"default_branch"` OpenIssuesCount int `json:"open_issues_count"` HasIssues bool `json:"has_issues"` HasWiki bool `json:"has_wiki"` HasDownloads bool `json:"has_downloads"` //PushedAt NullTime `json:"pushed_at"` //CreatedAt NullTime `json:"created_at"` //UpdatedAt NullTime `json:"updated_at"` } func (s Repository) String() string { return s.FullName }
reinra/dynaform
src/main/java/org/dynaform/xml/form/impl/FormAllImpl.java
<filename>src/main/java/org/dynaform/xml/form/impl/FormAllImpl.java package org.dynaform.xml.form.impl; import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormAll; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.ToggleFormVisitor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; /** * @author <NAME> */ public class FormAllImpl extends BaseForm implements FormAll, FormAll.OnChangeListener { private String id; private final List<Form> children; private final boolean allChildrenRequired; private final int[] indexes; private int[] selectedIndexes; private int[] unselectedIndexes; private final Collection<OnChangeListener> listeners = new ArrayList<OnChangeListener>(); public FormAllImpl(List<Form> children, boolean allChildrenRequired) { if (children == null || children.size() <= 1) throw new IllegalArgumentException("Children: " + children); this.children = Collections.unmodifiableList(children); this.allChildrenRequired = allChildrenRequired; this.indexes = getAllIndexes(children.size()); this.selectedIndexes = indexes; this.unselectedIndexes = new int[0]; // Register myself as parent of all the children for (Form child : children) child._setParent(this); } public void _setParent(Form parent) { super._setParent(parent); id = OPERATOR_ALL + INDEX_START + parent.nextCounterValue() + INDEX_END; } public String getHighLevelId() { return null; } public String getLowLevelId() { return id; } public boolean areAllChildrenRequired() { return allChildrenRequired; } public List<Form> getChildren() { return children; } public int[] getIndexes() { return indexes; } public synchronized int[] getSelectedIndexes() { return selectedIndexes; } public synchronized int[] getUnselectedIndexes() { return unselectedIndexes; } public synchronized List<Form> getSelectedChildren() { return get(children, getSelectedIndexes()); } public synchronized List<Form> getUnselectedChildren() { return get(children, getUnselectedIndexes()); } public synchronized void setSelectedIndexes(int[] indexes) { int[] unselectedIndexes = validateAndFindUnselectedIndexes(indexes); // Enable last unselected child elements for (Form child : getUnselectedChildren()) child.accept(ToggleFormVisitor.ENABLER); this.selectedIndexes = indexes; this.unselectedIndexes = unselectedIndexes; // Disable new unselected child elements for (Form child : getUnselectedChildren()) child.accept(ToggleFormVisitor.DISABLER); // Invoke listeners onSetSelectedIndexes(indexes); } private int[] validateAndFindUnselectedIndexes(int[] indexes) { int size = children.size(); if (indexes.length > size) throw new IllegalArgumentException("Too many indexes provided"); // Cannot read XML with this validation // if (areAllChildrenRequired() && selectedIndexes.length < size) // throw new IllegalArgumentException("Not enough selectedIndexes provided (" + selectedIndexes.length + " instead of " + size + ")"); boolean[] selected = new boolean[size]; for (int i = 0; i < indexes.length; i++) { int index = indexes[i]; if (index < 0 || index >= size) throw new IndexOutOfBoundsException("" + index); if (selected[index]) throw new IllegalArgumentException("Index " + index + " occured more than once"); selected[index] = true; } int[] disabledIndexes = new int[size - indexes.length]; int counter = 0; for (int i = 0; i < size; i++) if (!selected[i]) disabledIndexes[counter++] = i; return disabledIndexes; } public void accept(FormVisitor visitor) { visitor.all(this); } public <T> T apply(FormFunction<T> function) { return function.all(this); } // Listeners public void addListener(OnChangeListener listener) { listeners.add(listener); } public void removeListener(OnChangeListener listener) { listeners.remove(listener); } public void onSetSelectedIndexes(int[] indexes) { for (FormAll.OnChangeListener listener : listeners) listener.onSetSelectedIndexes(indexes); } @Override public String toString() { return getFullSelector() + " all"; } // Static helper methods private static int[] getAllIndexes(int size) { int[] result = new int[size]; for (int i = 0; i < result.length; i++) result[i] = i; return result; } private static <E> List<E> get(List<E> list, int[] indexes) { List<E> result = new ArrayList<E>(); for (int i = 0; i < indexes.length; i++) { int index = indexes[i]; result.add(list.get(index)); } return result; } }
fisuda/ngsi-go
internal/ngsilib/helper_test.go
<gh_stars>10-100 /* MIT License Copyright (c) 2020-2021 <NAME> This file is part of NGSI Go https://github.com/lets-fiware/ngsi-go 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. */ package ngsilib import ( "bufio" "bytes" "encoding/json" "errors" "io" "io/ioutil" "net/http" "net/url" "os" "path/filepath" "reflect" "strings" "time" "github.com/lets-fiware/ngsi-go/internal/ngsierr" ) // // testNgsiLibInit // func testNgsiLibInit() *NGSI { gNGSI = nil ngsi := NewNGSI() ngsi.FileReader = &MockFileLib{} return ngsi } // // MockTimeLib // type MockTimeLib struct { dateTime string unixTime int64 format *string tTime *time.Time } func (t *MockTimeLib) Now() time.Time { layout := "2006-01-02T15:04:05.000Z" tm, _ := time.Parse(layout, t.dateTime) return tm } func (t *MockTimeLib) NowUnix() int64 { return t.unixTime } func (t *MockTimeLib) Unix(sec int64, nsec int64) time.Time { if t.tTime != nil { return *t.tTime } tt := time.Unix(sec, nsec) t.tTime = &tt return tt } func (t *MockTimeLib) Format(layout string) string { if t.format != nil { return *t.format } return t.tTime.Format(layout) } // // MockJSONLib // type MockJSONLib struct { IndentErr error ValidErr *bool Jsonlib JSONLib DecodeErr [5]error EncodeErr [5]error dp int ep int } func (j *MockJSONLib) Decode(r io.Reader, v interface{}) error { err := j.DecodeErr[j.dp] j.dp++ if err == nil { return j.Jsonlib.Decode(r, v) } return err } func (j *MockJSONLib) Encode(w io.Writer, v interface{}) error { err := j.EncodeErr[j.ep] j.ep++ if err == nil { return j.Jsonlib.Encode(w, v) } return err } func SetJSONDecodeErr(ngsi *NGSI, p int) { j := ngsi.JSONConverter mockj := &MockJSONLib{Jsonlib: j} mockj.DecodeErr[p] = errors.New("json error") ngsi.JSONConverter = mockj } func SetJSONEncodeErr(ngsi *NGSI, p int) { j := ngsi.JSONConverter mockj := &MockJSONLib{Jsonlib: j} mockj.EncodeErr[p] = errors.New("json error") ngsi.JSONConverter = mockj } func (j *MockJSONLib) Indent(dst *bytes.Buffer, src []byte, prefix, indent string) error { if j.IndentErr == nil { return j.Jsonlib.Indent(dst, src, prefix, indent) } return j.IndentErr } func SetJSONIndentError(ngsi *NGSI) { j := ngsi.JSONConverter ngsi.JSONConverter = &MockJSONLib{IndentErr: errors.New("json error"), Jsonlib: j} } func (j *MockJSONLib) Valid(data []byte) bool { if j.ValidErr != nil { return *j.ValidErr } return j.Jsonlib.Valid(data) } // MockIoLib // type MockIoLib struct { OpenErr error CloseErr error TruncateErr error EncodeErr error filename *string HomeDir string HomeDirErr error PathAbsErr error ConfigDir string ConfigDirErr error StatErr error MkdirErr error DecodeErr error Env string Data *string } func (io *MockIoLib) Open() (err error) { return io.OpenErr } func (io *MockIoLib) OpenFile(flag int, perm os.FileMode) (err error) { return io.OpenErr } func (io *MockIoLib) Truncate(size int64) error { return io.TruncateErr } func (io *MockIoLib) Close() error { return io.CloseErr } func (io *MockIoLib) Decode(v interface{}) error { if io.Data != nil { return json.Unmarshal([]byte(*io.Data), v) } return io.DecodeErr } func (io *MockIoLib) Encode(v interface{}) error { return io.EncodeErr } func (io *MockIoLib) UserHomeDir() (string, error) { return io.HomeDir, io.HomeDirErr } func (io *MockIoLib) UserConfigDir() (string, error) { return io.ConfigDir, io.ConfigDirErr } func (io *MockIoLib) MkdirAll(path string, perm os.FileMode) error { return io.MkdirErr } func (io *MockIoLib) Stat(filename string) (os.FileInfo, error) { return nil, io.StatErr } func (io *MockIoLib) SetFileName(filename *string) { io.filename = filename } func (io *MockIoLib) FileName() *string { return io.filename } func (io *MockIoLib) Getenv(key string) string { return io.Env } func (io *MockIoLib) FilePathAbs(path string) (string, error) { return path, io.PathAbsErr } func (io *MockIoLib) FilePathJoin(elem ...string) string { return strings.Join(elem, "/") } func NewMockHTTP() *MockHTTP { m := MockHTTP{} return &m } // MockHTTPReqRes is ... type MockHTTP struct { index int ReqRes []MockHTTPReqRes } type MockHTTPReqRes struct { Res http.Response ResBody []byte ResHeader http.Header Err error StatusCode int ReqData []byte Path string } // Request is ... func (h *MockHTTP) Request(method string, url *url.URL, headers map[string]string, body interface{}) (*http.Response, []byte, error) { const funcName = "Request" r := h.ReqRes[h.index] h.index++ if r.Err != nil { return nil, nil, r.Err } var data []byte switch method { case http.MethodPost, http.MethodPut, http.MethodPatch: switch body := body.(type) { case []byte: data = body case string: data = []byte(body) default: return nil, nil, ngsierr.New(funcName, 0, "Unsupported type", nil) } } if data != nil && r.ReqData != nil { if !reflect.DeepEqual(r.ReqData, data) { return nil, nil, ngsierr.New(funcName, 1, "body data error", nil) } } if r.Path != "" && r.Path != url.Path { return nil, nil, ngsierr.New(funcName, 3, "url error", nil) } if r.ResHeader != nil { r.Res.Header = r.ResHeader } return &r.Res, r.ResBody, r.Err } // // MockFileLib // type MockFileLib struct { Name string OpenError error CloseError error ReadallError error ReadallData []byte FilePathAbsString string FilePathAbsError [5]error ab int ReadFileData []byte ReadFileError [5]error rf int FileError *bufio.Reader FileError2 *bufio.Reader IoReader *bufio.Reader } func (f *MockFileLib) Open(path string) (err error) { return f.OpenError } func (f *MockFileLib) Close() error { return f.CloseError } func (f *MockFileLib) FilePathAbs(path string) (string, error) { err := f.FilePathAbsError[f.ab] f.ab++ if err == nil { return f.FilePathAbsString, nil } return "", err } func setFilePatAbsError(ngsi *NGSI, p int) { f := ngsi.FileReader.(*MockFileLib) f.FilePathAbsError[p] = errors.New("filepathabs error") ngsi.FileReader = f } func (f *MockFileLib) ReadAll(r io.Reader) ([]byte, error) { if f.ReadallData == nil { return nil, f.ReadallError } return f.ReadallData, nil } func (f *MockFileLib) ReadFile(filename string) ([]byte, error) { err := f.ReadFileError[f.rf] f.rf++ if err == nil { return f.ReadFileData, nil } return nil, err } func setReadFileError(ngsi *NGSI, p int) { f := ngsi.FileReader.(*MockFileLib) f.ReadFileError[p] = errors.New("readfile error") ngsi.FileReader = f } func (f *MockFileLib) SetReader(r io.Reader) { f.IoReader = bufio.NewReader(r) } func (f *MockFileLib) File() bufio.Reader { err := f.FileError f.FileError = f.FileError2 if err == nil { return *f.IoReader } return *err } // // MockIoutilLib // type MockIoutilLib struct { CopyErr error WriteFileErr error ReadFileErr error } func (i *MockIoutilLib) Copy(dst io.Writer, src io.Reader) (int64, error) { if i.CopyErr != nil { return 0, i.CopyErr } return io.Copy(dst, src) } func (i *MockIoutilLib) WriteFile(filename string, data []byte, perm os.FileMode) error { if i.WriteFileErr != nil { return i.WriteFileErr } return ioutil.WriteFile(filename, data, perm) } func (i *MockIoutilLib) ReadFile(filename string) ([]byte, error) { if i.ReadFileErr != nil { return nil, i.ReadFileErr } return ioutil.ReadFile(filename) } // // MockFilePathLib // type MockFilePathLib struct { PathAbsErr error } func (i *MockFilePathLib) FilePathAbs(path string) (string, error) { return path, i.PathAbsErr } func (i *MockFilePathLib) FilePathJoin(elem ...string) string { return strings.Join(elem, "/") } func (i *MockFilePathLib) FilePathBase(path string) string { return filepath.Base(path) }