max_stars_count
int64
301
224k
text
stringlengths
6
1.05M
token_count
int64
3
727k
16,989
// Copyright 2021 The Bazel Authors. All rights reserved. // // 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.google.devtools.build.lib.concurrent; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.atomic.AtomicReference; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Tests for {@link com.google.devtools.build.lib.concurrent.ForkJoinQuiescingExecutor}. */ @RunWith(JUnit4.class) public class ForkJoinQuiescingExecutorTest { @Test public void testExecuteFromTaskForksInSamePool() throws Exception { // Spy as an easy way to track calls to #execute. ForkJoinPool forkJoinPool = spy(new ForkJoinPool()); try { ForkJoinQuiescingExecutor underTest = ForkJoinQuiescingExecutor.newBuilder().withOwnershipOf(forkJoinPool).build(); AtomicReference<ForkJoinPool> subtaskRanIn = new AtomicReference<>(); Runnable subTask = () -> subtaskRanIn.set(ForkJoinTask.getPool()); AtomicReference<ForkJoinPool> taskRanIn = new AtomicReference<>(); underTest.execute( () -> { taskRanIn.set(ForkJoinTask.getPool()); underTest.execute(subTask); }); underTest.awaitQuiescence(/*interruptWorkers=*/ false); assertThat(taskRanIn.get()).isSameInstanceAs(forkJoinPool); assertThat(subtaskRanIn.get()).isSameInstanceAs(forkJoinPool); // Confirm only one thing (the first task) was submitted via execute, the other should have // gone through the ForkJoinTask#fork() machinery. verify(forkJoinPool, times(1)).execute(any(Runnable.class)); } finally { // Avoid leaving dangling threads. forkJoinPool.shutdownNow(); } } /** Confirm our fork-new-work-if-in-forkjoinpool logic works as expected. */ @Test public void testExecuteFromTaskInDifferentPoolRunsInRightPool() throws Exception { ForkJoinPool forkJoinPool = new ForkJoinPool(); ForkJoinPool otherForkJoinPool = new ForkJoinPool(); try { ForkJoinQuiescingExecutor originalExecutor = ForkJoinQuiescingExecutor.newBuilder().withOwnershipOf(forkJoinPool).build(); ForkJoinQuiescingExecutor otherExecutor = ForkJoinQuiescingExecutor.newBuilder().withOwnershipOf(otherForkJoinPool).build(); AtomicReference<ForkJoinPool> subtaskRanIn = new AtomicReference<>(); Runnable subTask = () -> subtaskRanIn.set(ForkJoinTask.getPool()); AtomicReference<ForkJoinPool> taskRanIn = new AtomicReference<>(); originalExecutor.execute( () -> { taskRanIn.set(ForkJoinTask.getPool()); otherExecutor.execute(subTask); }); originalExecutor.awaitQuiescence(/*interruptWorkers=*/ false); otherExecutor.awaitQuiescence(/*interruptWorkers=*/ false); assertThat(taskRanIn.get()).isSameInstanceAs(forkJoinPool); assertThat(subtaskRanIn.get()).isSameInstanceAs(otherForkJoinPool); } finally { // Avoid leaving dangling threads. forkJoinPool.shutdownNow(); otherForkJoinPool.shutdownNow(); } } @Test public void testAwaitTerminationShutsDownPool() throws Exception { ForkJoinPool forkJoinPool = new ForkJoinPool(); try { ForkJoinQuiescingExecutor underTest = ForkJoinQuiescingExecutor.newBuilder().withOwnershipOf(forkJoinPool).build(); underTest.awaitTermination(/*interruptWorkers=*/ false); assertThat(forkJoinPool.isTerminated()).isTrue(); } finally { // Avoid leaving dangling threads. forkJoinPool.shutdownNow(); } } }
1,540
1,052
<reponame>mdimjasevic/sms-backup-plus<gh_stars>1000+ package com.zegoggles.smssync.auth; import android.util.Log; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import java.io.IOException; import static com.zegoggles.smssync.App.TAG; public class OAuth2Token { public final String accessToken; public final String tokenType; public final String refreshToken; public final int expiresIn; public final String userName; OAuth2Token(String accessToken, String tokenType, String refreshToken, int expiresIn, String userName) { this.accessToken = accessToken; this.tokenType = tokenType; this.refreshToken = refreshToken; this.expiresIn = expiresIn; this.userName = userName; } public static OAuth2Token fromJSON(String string) throws IOException { try { Object value = new JSONTokener(string).nextValue(); if (value instanceof JSONObject) { return fromJSON((JSONObject) value); } else { throw new IOException("Invalid JSON data: "+value); } } catch (JSONException e) { Log.w(TAG, "JSON parse error", e); throw new IOException("Error parsing data: "+e.getMessage()); } } private static OAuth2Token fromJSON(JSONObject object) throws IOException { try { return new OAuth2Token( object.getString("access_token"), object.optString("token_type", null), object.optString("refresh_token", null), object.optInt("expires_in", -1), null); } catch (JSONException e) { Log.w(TAG, "JSON parse error", e); throw new IOException("parse error"); } } @Override public String toString() { return getTokenForLogging(); } @SuppressWarnings("ReplaceAllDot") public String getTokenForLogging() { return "Token{" + "accessToken='" + (accessToken != null ? accessToken.replaceAll(".", "X") : null) + '\'' + ", tokenType='" + tokenType + '\'' + ", refreshToken='" + (refreshToken != null ? refreshToken.replaceAll(".", "X") : null) + '\'' + ", expiresIn=" + expiresIn + ", userName='" + userName + '\'' + '}'; } }
1,052
1,391
#include <u.h> #include <libc.h> #include <plumb.h> #include <thread.h> #include <9pclient.h> char *plumbfile = nil; Plumbmsg m; void usage(void) { fprint(2, "usage: plumb [-p plumbfile] [-a 'attr=value ...'] [-s src] [-d dst] [-t type] [-w wdir] -i | data1\n"); threadexitsall("usage"); } void gather(void) { char buf[8192]; int n; m.ndata = 0; m.data = nil; while((n = read(0, buf, sizeof buf)) > 0){ m.data = realloc(m.data, m.ndata+n); if(m.data == nil){ fprint(2, "plumb: alloc failed: %r\n"); threadexitsall("alloc"); } memmove(m.data+m.ndata, buf, n); m.ndata += n; } if(n < 0){ fprint(2, "plumb: i/o error on input: %r\n"); threadexitsall("read"); } } void threadmain(int argc, char *argv[]) { char buf[1024], *p; int fd, i, input; input = 0; m.src = "plumb"; m.dst = nil; m.wdir = getwd(buf, sizeof buf); m.type = "text"; m.attr = nil; ARGBEGIN{ case '9': chatty9pclient = 1; break; case 'a': p = ARGF(); if(p == nil) usage(); m.attr = plumbaddattr(m.attr, plumbunpackattr(p)); break; case 'd': m.dst = ARGF(); if(m.dst == nil) usage(); break; case 'i': input++; break; case 't': case 'k': /* for backwards compatibility */ m.type = ARGF(); if(m.type == nil) usage(); break; case 'p': plumbfile = ARGF(); if(plumbfile == nil) usage(); break; case 's': m.src = ARGF(); if(m.src == nil) usage(); break; case 'w': m.wdir = ARGF(); if(m.wdir == nil) usage(); break; }ARGEND if((input && argc>0) || (!input && argc<1)) usage(); if(plumbfile != nil) fd = open(plumbfile, OWRITE); else fd = plumbopen("send", OWRITE); if(fd < 0){ fprint(2, "plumb: can't open plumb file: %r\n"); threadexitsall("open"); } if(input){ gather(); if(plumblookup(m.attr, "action") == nil) m.attr = plumbaddattr(m.attr, plumbunpackattr("action=showdata")); if(plumbsend(fd, &m) < 0){ fprint(2, "plumb: can't send message: %r\n"); threadexitsall("error"); } threadexitsall(nil); } for(i=0; i<argc; i++){ if(input == 0){ m.data = argv[i]; m.ndata = -1; } if(plumbsend(fd, &m) < 0){ fprint(2, "plumb: can't send message: %r\n"); threadexitsall("error"); } } threadexitsall(nil); }
1,129
2,137
<gh_stars>1000+ package org.hibernate.tool.internal.util; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.sql.Types; import java.util.HashMap; import java.util.Map; import org.hibernate.MappingException; /** * Utility class for mapping between sqltypes and hibernate type names. * * @author max (based on parts from Sql2Java from Middlegen) * */ public final class JdbcToHibernateTypeHelper { private JdbcToHibernateTypeHelper() { } /** The Map containing the preferred conversion type values. */ private static final Map<Integer, String[]> PREFERRED_HIBERNATETYPE_FOR_SQLTYPE = new HashMap<Integer, String[]>(); static { PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.TINYINT), new String[] { "byte", Byte.class.getName()} ); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.SMALLINT), new String[] { "short", Short.class.getName()} ); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.INTEGER), new String[] { "int", Integer.class.getName()} ); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.BIGINT), new String[] { "long", Long.class.getName()} ); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.REAL), new String[] { "float", Float.class.getName()} ); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.FLOAT), new String[] { "double", Double.class.getName()} ); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.DOUBLE), new String[] { "double", Double.class.getName()}); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.DECIMAL), new String[] { "big_decimal", "big_decimal" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.NUMERIC), new String[] { "big_decimal", "big_decimal" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.BIT), new String[] { "boolean", Boolean.class.getName()}); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.BOOLEAN), new String[] { "boolean", Boolean.class.getName()}); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.CHAR), new String[] { "char", Character.class.getName()}); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.VARCHAR), new String[] { "string", "string" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.LONGVARCHAR), new String[] { "string", "string" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.BINARY), new String[] { "binary", "binary" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.VARBINARY), new String[] { "binary", "binary" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.LONGVARBINARY), new String[] { "binary", "binary" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.DATE), new String[] { "date", "date" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.TIME), new String[] { "time", "time" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.TIMESTAMP), new String[] { "timestamp", "timestamp" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.CLOB), new String[] { "clob", "clob" }); PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.put(Integer.valueOf(Types.BLOB), new String[] { "blob", "blob" }); //Hibernate does not have any built-in Type for these: //preferredJavaTypeForSqlType.put(new Integer(Types.ARRAY), "java.sql.Array"); //preferredJavaTypeForSqlType.put(new Integer(Types.REF), "java.sql.Ref"); //preferredJavaTypeForSqlType.put(new Integer(Types.STRUCT), "java.lang.Object"); //preferredJavaTypeForSqlType.put(new Integer(Types.JAVA_OBJECT), "java.lang.Object"); } /* (non-Javadoc) * @see org.hibernate.cfg.JDBCTypeToHibernateTypesStrategy#getPreferredHibernateType(int, int, int, int) */ public static String getPreferredHibernateType(int sqlType, int size, int precision, int scale, boolean nullable, boolean generatedIdentifier) { boolean returnNullable = nullable || generatedIdentifier; if ( (sqlType == Types.DECIMAL || sqlType == Types.NUMERIC) && scale <= 0) { // <= if (precision == 1) { // NUMERIC(1) is a often used idiom for storing boolean thus providing it out of the box. return returnNullable?Boolean.class.getName():"boolean"; } else if (precision < 3) { return returnNullable?Byte.class.getName():"byte"; } else if (precision < 5) { return returnNullable?Short.class.getName():"short"; } else if (precision < 10) { return returnNullable?Integer.class.getName():"int"; } else if (precision < 19) { return returnNullable?Long.class.getName():"long"; } else { return "big_integer"; } } if ( sqlType == Types.CHAR && size>1 ) { return "string"; } String[] result = (String[]) PREFERRED_HIBERNATETYPE_FOR_SQLTYPE.get(Integer.valueOf(sqlType) ); if(result==null) { return null; } else if(returnNullable) { return result[1]; } else { return result[0]; } } static Map<String, Integer> jdbcTypes; // Name to value static Map<Integer, String> jdbcTypeValues; // value to Name public static String[] getJDBCTypes() { checkTypes(); return (String[]) jdbcTypes.keySet().toArray(new String[jdbcTypes.size()]); } public static int getJDBCType(String value) { checkTypes(); Integer number = (Integer) jdbcTypes.get(value); if(number==null) { try { return Integer.parseInt(value); } catch (NumberFormatException nfe) { throw new MappingException("jdbc-type: " + value + " is not a known JDBC Type nor a valid number"); } } else { return number.intValue(); } } private static void checkTypes() { if(jdbcTypes==null) { jdbcTypes = new HashMap<String, Integer>(); Field[] fields = Types.class.getFields(); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; if(Modifier.isStatic(field.getModifiers() ) ) { try { jdbcTypes.put(field.getName(), (Integer)field.get(Types.class) ); } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } } } public static String getJDBCTypeName(int value) { if(jdbcTypeValues==null) { jdbcTypeValues = new HashMap<Integer, String>(); Field[] fields = Types.class.getFields(); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; if(Modifier.isStatic(field.getModifiers() ) ) { try { jdbcTypeValues.put((Integer)field.get(Types.class), field.getName() ); } catch (IllegalArgumentException e) { // ignore } catch (IllegalAccessException e) { // ignore } } } } String name = (String) jdbcTypeValues.get(Integer.valueOf(value) ); if(name!=null) { return name; } else { return ""+value; } } // scale and precision have numeric column public static boolean typeHasScaleAndPrecision(int sqlType) { return (sqlType == Types.DECIMAL || sqlType == Types.NUMERIC || sqlType == Types.REAL || sqlType == Types.FLOAT || sqlType == Types.DOUBLE); } // length is for string column public static boolean typeHasLength(int sqlType) { return (sqlType == Types.CHAR || sqlType == Types.DATE || sqlType == Types.LONGVARCHAR || sqlType == Types.TIME || sqlType == Types.TIMESTAMP || sqlType == Types.VARCHAR ); } }
3,141
317
<filename>services/docker/webrecorder/recorder_main.py from gevent import monkey; monkey.patch_all() import os from webrecorder.utils import load_wr_config, init_logging, spawn_once, get_bool from webrecorder.rec.webrecrecorder import WebRecRecorder # ============================================================================= def init(): init_logging(debug=get_bool(os.environ.get('WR_DEBUG', 'True'))) config = load_wr_config() wr = WebRecRecorder(config) spawn_once(wr.msg_listen_loop) wr.init_app() wr.app.wr = wr return wr.app
223
3,139
<reponame>supertick/jmonkeyengine /* * Copyright (c) 2009-2021 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'jMonkeyEngine' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.jme3.network.kernel.udp; import com.jme3.network.kernel.Connector; import com.jme3.network.kernel.ConnectorException; import java.io.IOException; import java.net.*; import java.nio.ByteBuffer; import java.util.concurrent.atomic.AtomicBoolean; /** * A straight forward datagram socket-based UDP connector * implementation. * * @version $Revision$ * @author <NAME> */ public class UdpConnector implements Connector { private DatagramSocket sock = new DatagramSocket(); private SocketAddress remoteAddress; private byte[] buffer = new byte[65535]; private AtomicBoolean connected = new AtomicBoolean(false); /** * Creates a new UDP connection that send datagrams to the * specified address and port. */ public UdpConnector( InetAddress remote, int remotePort ) throws IOException { InetSocketAddress localSocketAddress = new InetSocketAddress(0); this.sock = new DatagramSocket( localSocketAddress ); remoteAddress = new InetSocketAddress( remote, remotePort ); // Setup to receive only from the remote address sock.connect( remoteAddress ); connected.set(true); } protected void checkClosed() { if( sock == null ) throw new ConnectorException( "Connection is closed:" + remoteAddress ); } @Override public boolean isConnected() { if( sock == null ) return false; return sock.isConnected(); } @Override public void close() { checkClosed(); DatagramSocket temp = sock; sock = null; connected.set(false); temp.close(); } /** * This always returns false since the simple DatagramSocket usage * cannot be run in a non-blocking way. */ @Override public boolean available() { // It would take a separate thread or an NIO Selector based implementation to get this // to work. If a polling strategy is never employed by callers then it doesn't // seem worth it to implement all of that just for this method. checkClosed(); return false; } @Override public ByteBuffer read() { checkClosed(); try { DatagramPacket packet = new DatagramPacket( buffer, buffer.length ); sock.receive(packet); // Wrap it in a ByteBuffer for the caller return ByteBuffer.wrap( buffer, 0, packet.getLength() ); } catch( IOException e ) { if( !connected.get() ) { // Nothing to see here... just move along return null; } throw new ConnectorException( "Error reading from connection to:" + remoteAddress, e ); } } @Override public void write( ByteBuffer data ) { checkClosed(); try { DatagramPacket p = new DatagramPacket( data.array(), data.position(), data.remaining(), remoteAddress ); sock.send(p); } catch( IOException e ) { throw new ConnectorException( "Error writing to connection:" + remoteAddress, e ); } } }
1,825
841
<filename>security/resteasy-crypto/src/test/resources/decrypt_smime.py from M2Crypto import BIO, SMIME, X509 s = SMIME.SMIME() s.load_key('mycert-private.pem', 'mycert.pem') p7, data = SMIME.smime_load_pkcs7('smime.txt') out = s.decrypt(p7) print out
113
453
<filename>kernel/kernel/syscall/sysfuncs.h<gh_stars>100-1000 #ifndef SYSFUNCS_H #define SYSFUNCS_H #include "syscall.h" #include <kernel/multitasking/tasks/task.h> #include <kernel/util/vfs/fs.h> #include <kernel/util/amc/amc.h> #include <kernel/util/adi/adi.h> //installs common syscalls into syscall table void create_sysfuncs(); /* //Standard terminal driver puts DECL_SYSCALL(output, int, char*); //Standard terminal driver putc DECL_SYSCALL(terminal_putchar, char); //Yields current process's running state to a different process //Typically invoked if process is blocked by I/O, or sleeping DECL_SYSCALL(yield, task_state); //Standard read syscall //reads at most count characters into buf using file descriptor fd DECL_SYSCALL(read, int, void*, size_t); */ DECL_SYSCALL(kill); DECL_SYSCALL(exec, char*, char**, char**); DECL_SYSCALL(open, const char*, int); DECL_SYSCALL(read, int, char*, size_t); DECL_SYSCALL(output, int, char*); DECL_SYSCALL(yield, task_state); DECL_SYSCALL(mmap, void*, int, int, int, int); DECL_SYSCALL(munmap, void*, int); DECL_SYSCALL(sbrk, int); DECL_SYSCALL(lseek, int, int, int); DECL_SYSCALL(write, int, char*, int); DECL_SYSCALL(fork); DECL_SYSCALL(getpid); DECL_SYSCALL(waitpid, int, int*, int); DECL_SYSCALL(task_with_pid, int); DECL_SYSCALL(xserv_win_create, Window*, Rect*); DECL_SYSCALL(xserv_win_present, Window*); DECL_SYSCALL(xserv_win_destroy, Window*); DECL_SYSCALL(xserv_init); DECL_SYSCALL(getdents, unsigned int, struct dirent*, unsigned int); DECL_SYSCALL(shmem_create, uint32_t); DECL_SYSCALL(surface_create, uint32_t, uint32_t); DECL_SYSCALL(aipc_send, char*, uint32_t, uint32_t, char**); DECL_SYSCALL(amc_register_service, const char*); DECL_SYSCALL(amc_message_broadcast, amc_message_t*); DECL_SYSCALL(amc_message_await, const char*, amc_message_t**); DECL_SYSCALL(amc_message_await_from_services, int, const char**, amc_message_t**); DECL_SYSCALL(amc_message_await_any, amc_message_t**); DECL_SYSCALL(amc_shared_memory_create, const char*, uint32_t, uint32_t*, uint32_t*); DECL_SYSCALL(amc_launch_service, const char*); DECL_SYSCALL(amc_service_is_active, const char*); DECL_SYSCALL(adi_register_driver, const char*, uint32_t); DECL_SYSCALL(adi_event_await, uint32_t); DECL_SYSCALL(adi_send_eoi, uint32_t); #endif
938
1,031
<reponame>execomrt/newton-dynamics ///////////////////////////////////////////////////////////////////////////// // Name: pyTextures.h // Purpose: // Author: <NAME> // Modified by: // Created: 22/05/2010 08:02:08 // RCS-ID: // Copyright: Copyright (c) <2010> <Newton Game Dynamics> // License: // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely ///////////////////////////////////////////////////////////////////////////// #include "StdAfx.h" #include "pyScene.h" #include "pyTexture.h" pyTexture::pyTexture(pyScene* scene, void* textureNode) :pyBaseNodeInfo<dTextureNodeInfo>(scene, textureNode) { } pyTexture::~pyTexture(void) { } int pyTexture::GetId() { dTextureNodeInfo* info = GetInfo(); return info->GetId(); } const char* pyTexture::GetImageName() { dTextureNodeInfo* info = GetInfo(); return info->GetPathName(); }
361
764
{"symbol": "ECO","address": "0x081271acDa8Ef14047a35cD5f2A66544E51d431b","overview":{"en": ""},"email": "","website": "https://www.ecocoin.com/","state": "NORMAL","links": {"blog": "https://www.ecocoin.com/news","twitter": "https://twitter.com/TheECOcoin","telegram": "","github": ""}}
112
1,438
<filename>src/FluentMigrator.DotNet.Cli/Properties/launchSettings.json<gh_stars>1000+ { "profiles": { "FluentMigrator.DotNet.Cli": { "commandName": "Project", "commandLineArgs": "migrate -p sql -c conn -a asd -a qwe" } } }
112
12,278
#ifndef LZ4_HELPERS #define LZ4_HELPERS #include "lz4frame.h" LZ4F_frameInfo_t FUZZ_randomFrameInfo(uint32_t* seed); LZ4F_preferences_t FUZZ_randomPreferences(uint32_t* seed); size_t FUZZ_decompressFrame(void* dst, const size_t dstCapacity, const void* src, const size_t srcSize); #endif /* LZ4_HELPERS */
169
669
import numpy as np import onnx from onnx import AttributeProto, GraphProto, OperatorSetIdProto, TensorProto, helper, numpy_helper X = helper.make_tensor_value_info("input", TensorProto.FLOAT, ["batch", "seqlen", 128]) unsqueezed_masked_lm_positions = helper.make_tensor_value_info( "unsqueezed_masked_lm_positions", TensorProto.INT64, ["batch", "dynamic_prediction_count", 1], ) Y = helper.make_tensor_value_info("output", TensorProto.FLOAT, ["batch", "dynamic_prediction_count", 128]) Y2 = helper.make_tensor_value_info("output2", TensorProto.FLOAT, ["batch", "dynamic_prediction_count", 128]) nodes = [] # case 1 bias_np_val = np.random.uniform(0.0, 1.0, (128)).astype(np.float32).reshape((128)) bias_initializer = numpy_helper.from_array(bias_np_val, "bias") add1 = helper.make_node("Add", ["input", "bias"], ["add_1"], name="add_1") nodes.append(add1) gathernd1 = helper.make_node( "GatherND", ["add_1", "unsqueezed_masked_lm_positions"], ["output"], name="gathernd_1", batch_dims=1, ) nodes.append(gathernd1) # case 2 bias2_np_val = np.random.uniform(0.0, 1.0, (128)).astype(np.float32).reshape((128)) bias2_initializer = numpy_helper.from_array(bias2_np_val, "bias2") add2 = helper.make_node("Add", ["bias2", "input"], ["add_2"], name="add_2") nodes.append(add2) gathernd2 = helper.make_node( "GatherND", ["add_2", "unsqueezed_masked_lm_positions"], ["output2"], name="gathernd_2", batch_dims=1, ) nodes.append(gathernd2) graph_def = helper.make_graph( nodes, "test-model", [X, unsqueezed_masked_lm_positions], [Y, Y2], [bias_initializer, bias2_initializer], ) opsets = [] onnxdomain = OperatorSetIdProto() onnxdomain.version = 12 onnxdomain.domain = "" # The empty string ("") or absence of this field implies the operator set that is defined as part of the ONNX specification. opsets.append(onnxdomain) msdomain = OperatorSetIdProto() msdomain.version = 1 msdomain.domain = "com.microsoft" opsets.append(msdomain) kwargs = {} kwargs["opset_imports"] = opsets model_def = helper.make_model(graph_def, producer_name="onnx-example", **kwargs) onnx.save(model_def, "gathernd_add.onnx")
909
477
<filename>goatools/cli/gosubdag_plot.py """Command-line script to create GO term diagrams Usage: go_plot.py [GO ...] [options] go_plot.py [GO ...] [--obo=<file.obo>] [--outfile=<file.png>] [--title=<title>] [--go_file=<file.txt>] [--relationship] [--relationships=<part_of>] [--sections=<sections.txt>] [--gpad=<file.gpad>] [--gaf=<file.gaf>] [--gene2go=<gene2go>] [--taxid=<Taxonomy_number>] [--id2gos=<file.txt>] [--shorten] [--parentcnt] [--childcnt] [--mark_alt_id] [--go_aliases=<go_aliases.txt>] [--draw-children] [--norel] [--go_color_file=<file.txt>] go_plot.py [GO ...] [--obo=<file.obo>] [-o <file.png>] [-t <title>] [--shorten] [-p] [-c] go_plot.py [GO ...] [-o <file.png>] [--draw-children] go_plot.py [GO ...] [-o <file.png>] [--draw-children] [--shorten] go_plot.py [--obo=<file.obo>] go_plot.py [--obo=<file.obo>] [--outfile=<file.png>] go_plot.py [GO ...] go_plot.py [GO ...] [--outfile=<file.png>] [--title=<title>] go_plot.py [GO ...] [--outfile=<file.png>] [--title=<title>] [--shorten] go_plot.py [GO ...] [-o <file.png>] [-t <title>] go_plot.py [GO ...] [-o <file.png>] [-t <title>] [--parentcnt] go_plot.py [GO ...] [-o <file.png>] [-t <title>] [--childcnt] go_plot.py [GO ...] [-o <file.png>] [-t <title>] [--parentcnt] [--childcnt] go_plot.py [GO ...] [-o <file.png>] [-t <title>] [-p] go_plot.py [GO ...] [-o <file.png>] [-t <title>] [-p] [-c] Options: -h --help show this help message and exit -i --go_file=<file.txt> GO IDs in an ASCII file -o <file.png>, --outfile=<file.png> Plot file name [default: go_plot.png] -r --relationship Plot all relationships --relationships=<part_of> Plot user-specified relationships -s <sections.txt> --sections=<sections.txt> Sections file for grouping -S <sections module str> Sections file for grouping --gpad=<file.gpad> Annotations from a gpad file --gaf=<file.gaf> Annotations from a gaf file --id2gos=<file.txt> Annotations from a text file, e.g., data/association --gene2go=<gene2go> Annotations from a gene2go file downloaded from NCBI --taxid=<taxid_num> TaxID for use when reading NCBI's gene2go file --obo=<file.obo> Ontologies in obo file [default: go-basic.obo]. -t <title>, --title=<title> Title string to place in image -p --parentcnt Include parent count in each GO term -c --childcnt Include child count in each GO term --shorten Shorten the GO name on plots --mark_alt_id Add 'a' if GO ID is an alternate ID: GO:0007582a --draw-children Draw children. By default, they are not drawn. --go_aliases=<go_aliases.txt> ASCII file containing letter alias --go_color_file=<file.txt> GO color file. GO and color (eg #cafffb) --norel Don't load relationship from the GO DAG """ from __future__ import print_function __copyright__ = "Copyright (C) 2016-2019, <NAME>, <NAME>. All rights reserved." __author__ = "<NAME>" import re import os import sys from goatools.obo_parser import GODag from goatools.associations import get_tcntobj from goatools.godag.obo_optional_attributes import OboOptionalAttrs from goatools.godag.consts import RELATIONSHIP_SET from goatools.godag.consts import chk_relationships from goatools.anno.annoreader_base import AnnoReaderBase from goatools.cli.docopt_parse import DocOptParse from goatools.cli.gos_get import GetGOs as ClassGetGOs from goatools.gosubdag.plot.gosubdag_plot import GoSubDagPlot from goatools.gosubdag.plot.go2color import Go2Color from goatools.gosubdag.gosubdag import GoSubDag from goatools.gosubdag.go_tasks import get_go2obj_unique from goatools.gosubdag.go_tasks import get_leaf_children from goatools.gosubdag.rpt.wr_xlsx import read_d1_letter from goatools.grouper.read_goids import read_sections from goatools.grouper.grprdflts import GrouperDflts from goatools.grouper.hdrgos import HdrgosSections from goatools.grouper.grprobj import Grouper from goatools.grouper.colors import GrouperColors from goatools.grouper.grprplt import GrouperPlot # pylint: disable=too-few-public-methods class CliGetGOs(object): """Return a list of GO IDs for plotting.""" max_gos = 200 # Maximum number of source GO IDs def __init__(self, go2obj): self.go2obj = go2obj def get_go_color(self, **kws): """Return source GO IDs and GO color, if provided.""" ret = {'GOs':set(), 'go2color':{}} if 'go_color_file' in kws: _, go2color = ClassGetGOs.rdtxt_gos_color(kws['go_color_file']) self._update_ret(ret, None, go2color) if 'GO' in kws: # goids, go2color = self._goargs(ret, kws['GO']) goids, go2color = ClassGetGOs.get_goargs(kws['GO'], prt=sys.stdout) self._update_ret(ret, goids, go2color) if 'go_file' in kws: goids, go2color = ClassGetGOs.rdtxt_gos_color(kws['go_file']) self._update_ret(ret, goids, go2color) if 'draw-children' in kws: ret['GOs'].update(get_leaf_children(ret['GOs'], self.go2obj)) # If there have been no GO IDs explicitly specified by the user if not ret['GOs']: # If the GO-DAG is sufficiently small, print all GO IDs if len(self.go2obj) < self.max_gos: main_gos = set(o.id for go, o in self.go2obj.items() if go != o.id) go_leafs = set(go for go, o in self.go2obj.items() if not o.children) ret['GOs'] = go_leafs.difference(main_gos) go2obj = {go:self.go2obj[go] for go in ret['GOs']} ret['GOs'] = set(get_go2obj_unique(go2obj)) return [ret['GOs'], ret['go2color']] @staticmethod def _update_ret(ret, goids, go2color): """Update 'GOs' and 'go2color' in dict with goids and go2color.""" if goids: ret['GOs'].update(goids) if go2color: for goid, color in go2color.items(): ret['go2color'][goid] = color # pylint: disable=line-too-long class PlotCli(object): """Class for command-line interface for creating GO term diagrams""" kws_dict = set(['GO', 'outfile', 'go_file', 'sections', 'S', 'gpad', 'gaf', 'gene2go', 'taxid', 'id2gos', 'title', 'obo', 'relationships', 'go_color_file', 'go_aliases']) kws_set = set(['relationship', 'parentcnt', 'childcnt', 'mark_alt_id', 'shorten', 'draw-children', 'norel']) dflt_outfile = "go_plot.png" kws_plt = set(['parentcnt', 'childcnt', 'mark_alt_id', 'shorten']) def __init__(self, gosubdag=None, use_doc=True): _doc = __doc__ if use_doc else None self.objdoc = DocOptParse(_doc, self.kws_dict, self.kws_set) self.gosubdag = None if gosubdag is None else gosubdag def cli(self, kws_plt=None): """Command-line interface for go_draw script.""" kws_all = self.get_docargs() if not kws_plt else kws_plt godag_optional_attrs = self._get_optional_attrs(kws_all) godag = GODag(kws_all['obo'], godag_optional_attrs) self.plot(godag, kws_all) def plot(self, godag, kws_plt): """Plot GO DAG subset""" objplt = self.get_gosubdagplot(godag, kws_plt) fout_img = self.get_outfile(kws_plt.get('outfile'), objplt.gosubdag.go_sources) objplt.prt_goids(sys.stdout) objplt.plt_dag(fout_img) #### sys.stdout.write("{N:>6} sections read\n".format( #### N="NO" if sections is None else len(sections))) return fout_img, objplt def get_gosubdagplot(self, godag, kws_plt): """Get GoSubDagPlot""" # GO kws_plt: GO go_file draw-children goids, go2color = CliGetGOs(godag).get_go_color(**kws_plt) assert goids, "GO IDs NEEDED" #### self.gosubdag = GoSubDag(goids, godag, relationships, tcntobj=tcntobj) kws_dag = self._get_kwsdag(goids, godag, **kws_plt) relationships = self._get_relationships(kws_plt, hasattr(next(iter(godag.values())), 'relationship')) ## print('RRRRRRRRRRRRRRRRRRRRRRRRRR relationships', relationships) self.gosubdag = GoSubDag(goids, godag, relationships, **kws_dag) # objplt = self._plt_gogrouped(goids, go2color, **kws_plt) if 'sections' in kws_plt self._plt_gosubdag(goids, go2color, **kws_plt) obj = self._get_objpltg(goids, go2color, **kws_plt) if 'sections' in kws_plt else self._get_objplt(go2color, **kws_plt) # print('############ {N} GO IDs: relationships={Rs}'.format(N=len(obj.gosubdag.go2obj), Rs=obj.gosubdag.relationships)) return obj #### if 'sections' in kws_plt: #### return self._plt_gogrouped(goids, go2color, **kws_plt) #### else: #### return self._plt_gosubdag(goids, go2color, **kws_plt) #### def _plt_gogrouped(self, goids, go2color_usr, **kws): def _get_objpltg(self, goids, go2color_usr, **kws): """Plot grouped GO IDs.""" #### fout_img = self.get_outfile(kws['outfile'], goids) sections = read_sections(kws['sections'], exclude_ungrouped=True) # print ("KWWSSSSSSSS", kws) # kws_plt = {k:v for k, v in kws.items if k in self.kws_plt} grprobj_cur = self._get_grprobj(goids, sections) # GO: purple=hdr-only, green=hdr&usr, yellow=usr-only # BORDER: Black=hdr Blu=hdr&usr grpcolor = GrouperColors(grprobj_cur) # get_bordercolor get_go2color_users grp_go2color = grpcolor.get_go2color_users() grp_go2bordercolor = grpcolor.get_bordercolor() for goid, color in go2color_usr.items(): grp_go2color[goid] = color objcolor = Go2Color(self.gosubdag, objgoea=None, go2color=grp_go2color, go2bordercolor=grp_go2bordercolor) go2txt = GrouperPlot.get_go2txt(grprobj_cur, grp_go2color, grp_go2bordercolor) return GoSubDagPlot(self.gosubdag, Go2Color=objcolor, go2txt=go2txt, **kws) #### objplt = GoSubDagPlot(self.gosubdag, Go2Color=objcolor, go2txt=go2txt, **kws) #### objplt.prt_goids(sys.stdout) #### objplt.plt_dag(fout_img) #### sys.stdout.write("{N:>6} sections read\n".format( #### N="NO" if sections is None else len(sections))) #### return fout_img def _get_grprobj(self, goids, sections): """Get Grouper, given GO IDs and sections.""" grprdflt = GrouperDflts(self.gosubdag, "goslim_generic.obo") hdrobj = HdrgosSections(self.gosubdag, grprdflt.hdrgos_dflt, sections) return Grouper("sections", goids, hdrobj, self.gosubdag) #### def _plt_gosubdag(self, goids, go2color, **kws): #### def _get_objplt(self, goids, go2color, **kws): def _get_objplt(self, go2color, **kws): """Plot GO IDs.""" #### fout_img = self.get_outfile(kws['outfile'], goids) objcolor = Go2Color(self.gosubdag, objgoea=None, go2color=go2color) return GoSubDagPlot(self.gosubdag, Go2Color=objcolor, **kws) #### objplt = GoSubDagPlot(self.gosubdag, Go2Color=objcolor, **kws) #### objplt.prt_goids(sys.stdout) #### objplt.plt_dag(fout_img) #### return fout_img def _get_kwsdag(self, goids, go2obj, **kws_all): """Get keyword args for a GoSubDag.""" kws_dag = {} # Term Counts for GO Term information score tcntobj = self._get_tcntobj(goids, go2obj, **kws_all) # TermCounts or None if tcntobj is not None: kws_dag['tcntobj'] = tcntobj # GO letters specified by the user if 'go_aliases' in kws_all: fin_go_aliases = kws_all['go_aliases'] if os.path.exists(fin_go_aliases): go2letter = read_d1_letter(fin_go_aliases) if go2letter: kws_dag['go2letter'] = go2letter return kws_dag @staticmethod def _get_tcntobj(goids, go2obj, **kws): """Get a TermCounts object if the user provides an annotation file, otherwise None.""" # kws: gaf (gene2go taxid) if not AnnoReaderBase.valid_formats.isdisjoint(kws): # Get a reduced go2obj set for TermCounts _gosubdag = GoSubDag(goids, go2obj, rcntobj=False) kws = dict(kws) kws['godag'] = go2obj return get_tcntobj(go2obj, **kws) # TermCounts def get_docargs(self, args=None, prt=None): """Pare down docopt. Return a minimal dictionary and a set containing runtime arg values.""" docargs = self.objdoc.get_docargs(args, prt) self._chk_docopts(docargs) return docargs def _chk_docopts(self, kws): """Check for common user command-line errors.""" # outfile should contain .png, .png, etc. outfile = kws['outfile'] if len(kws) == 2 and os.path.basename(kws['obo']) == "go-basic.obo" and \ kws['outfile'] == self.dflt_outfile: self._err("NO GO IDS SPECFIED", err=False) if 'obo' in outfile: self._err("BAD outfile({O})".format(O=outfile)) if 'gaf' in kws and 'gene2go' in kws: self._err("SPECIFY ANNOTAIONS FROM ONE FILE") if 'gene2go' in kws: if 'taxid' not in kws: self._err("SPECIFIY taxid WHEN READ NCBI'S gene2go FILE") def _err(self, msg, err=True): """Print useage and error before exiting.""" severity = "FATAL" if err else "NOTE" txt = "".join([self.objdoc.doc, "User's command-line:\n\n", " % go_plot.py {ARGS}\n\n".format(ARGS=" ".join(sys.argv[1:])), "**{SEV}: {MSG}\n".format(SEV=severity, MSG=msg)]) if err: raise RuntimeError(txt) sys.stdout.write(txt) sys.exit(0) def get_outfile(self, outfile, goids=None): """Return output file for GO Term plot.""" # 1. Use the user-specfied output filename for the GO Term plot if outfile is not None and outfile != self.dflt_outfile: return outfile # 2. If only plotting 1 GO term, use GO is in plot name if goids is not None and len(goids) == 1: goid = next(iter(goids)) goobj = self.gosubdag.go2obj[goid] fout = "GO_{NN}_{NM}".format(NN=goid.replace("GO:", ""), NM=goobj.name) return ".".join([re.sub(r"[\s#'()+,-./:<=>\[\]_}]", '_', fout), 'png']) # 3. Return default name return self.dflt_outfile @staticmethod def _get_optional_attrs(kws): """Given keyword args, return optional_attributes to be loaded into the GODag.""" # Ex: def defn synonym relationship xref subset comment vals = OboOptionalAttrs.optional_exp.intersection(kws.keys()) if 'relationships' in kws: vals.add('relationship') if 'sections' in kws: vals.add('relationship') if 'norel' in kws: vals.discard('relationship') return vals @staticmethod def _get_relationships(kws_all, relationship_in_godag): """Return value for GoSubDag arg, relationships.""" if not relationship_in_godag: return None if 'relationship' in kws_all: return RELATIONSHIP_SET if 'relationships' not in kws_all: return None relationships_arg = kws_all['relationships'] if isinstance(relationships_arg, str): relationships = set(kws_all['relationships'].split(',')) chk_relationships(relationships) return relationships if relationships_arg: return True # Copyright (C) 2016-2019, <NAME>, <NAME>. All rights reserved.
7,897
372
<gh_stars>100-1000 #include <stdio.h> #include <syslog.h> int main() { openlog("stress-test", 0, LOG_DAEMON); int i = 0; for(i = 0; i<10000; i++) { syslog(LOG_WARNING, "stress message %d", i); } return 0; }
103
2,542
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #pragma once namespace Data { namespace Utilities { class VarInt { public: static LONG32 GetSerializedSize(__in LONG32 value); static LONG32 GetSerializedSize(__in ULONG32 value); static ULONG32 ReadUInt32(__in BinaryReader & reader); static LONG32 ReadInt32(__in BinaryReader & reader); static void Write(__in BinaryWriter & writer, __in ULONG32 value); static void Write(__in BinaryWriter & writer, __in LONG32 value); private: static const byte ByteMask_ = 0x7F; static const ULONG32 MinFiveByteValue_ = 0x01 << 28; static const ULONG32 MinFourByteValue_ = 0x01 << 21; static const ULONG32 MinThreeByteValue_ = 0x01 << 14; static const ULONG32 MinTwoByteValue_ = 0x01 << 7; static const byte MoreBytesMask_ = 0x80; static const LONG32 Chunks = 5; }; } }
478
482
// License: BSD 3 Clause // Copyright (C) 2010, Google Inc. All rights reserved. // Copyright (C) 2015+, The LabSound Authors. All rights reserved. #ifndef AudioParam_h #define AudioParam_h #include "LabSound/core/AudioContext.h" #include "LabSound/core/AudioParamTimeline.h" #include "LabSound/core/AudioSummingJunction.h" #include <string> #include <sys/types.h> namespace lab { class AudioNodeOutput; class AudioParam : public AudioSummingJunction { public: static const double DefaultSmoothingConstant; static const double SnapThreshold; AudioParam(const std::string & name, const std::string & short_name, double defaultValue, double minValue, double maxValue, unsigned units = 0); virtual ~AudioParam(); // Intrinsic value. float value() const; void setValue(float); // Final value for k-rate parameters, otherwise use calculateSampleAccurateValues() for a-rate. float finalValue(ContextRenderLock &); std::string name() const { return m_name; } std::string shortName() const { return m_shortName; } float minValue() const { return static_cast<float>(m_minValue); } float maxValue() const { return static_cast<float>(m_maxValue); } float defaultValue() const { return static_cast<float>(m_defaultValue); } unsigned units() const { return m_units; } // Value smoothing: // When a new value is set with setValue(), in our internal use of the parameter we don't immediately jump to it. // Instead we smoothly approach this value to avoid glitching. float smoothedValue(); // Smoothly exponentially approaches to (de-zippers) the desired value. // Returns true if smoothed value has already snapped exactly to value. bool smooth(ContextRenderLock &); void resetSmoothedValue() { m_smoothedValue = m_value; } void setSmoothingConstant(double k) { m_smoothingConstant = k; } // Parameter automation. // Time is a double representing the time (in seconds) after the AudioContext was first created that the change in value will happen // Returns a reference for chaining calls. AudioParam & setValueAtTime(float value, float time) { m_timeline.setValueAtTime(value, time); return *this; } AudioParam & linearRampToValueAtTime(float value, float time) { m_timeline.linearRampToValueAtTime(value, time); return *this; } AudioParam & exponentialRampToValueAtTime(float value, float time) { m_timeline.exponentialRampToValueAtTime(value, time); return *this; } AudioParam & setTargetAtTime(float target, float time, float timeConstant) { m_timeline.setTargetAtTime(target, time, timeConstant); return *this; } AudioParam & setValueCurveAtTime(std::vector<float> curve, float time, float duration) { m_timeline.setValueCurveAtTime(curve, time, duration); return *this; } AudioParam & cancelScheduledValues(float startTime) { m_timeline.cancelScheduledValues(startTime); return *this; } bool hasSampleAccurateValues() { return m_timeline.hasValues() || numberOfConnections(); } // Calculates numberOfValues parameter values starting at the context's current time. // Must be called in the context's render thread. void calculateSampleAccurateValues(ContextRenderLock &, float * values, int numberOfValues); AudioBus const* const bus() const; // Connect an audio-rate signal to control this parameter. static void connect(ContextGraphLock & g, std::shared_ptr<AudioParam>, std::shared_ptr<AudioNodeOutput>); static void disconnect(ContextGraphLock & g, std::shared_ptr<AudioParam>, std::shared_ptr<AudioNodeOutput>); static void disconnectAll(ContextGraphLock & g, std::shared_ptr<AudioParam>); private: // sampleAccurate corresponds to a-rate (audio rate) vs. k-rate in the Web Audio specification. void calculateFinalValues(ContextRenderLock & r, float * values, int numberOfValues, bool sampleAccurate); void calculateTimelineValues(ContextRenderLock & r, float * values, int numberOfValues); std::string m_name; std::string m_shortName; double m_value; double m_defaultValue; double m_minValue; double m_maxValue; unsigned m_units; // Smoothing (de-zippering) double m_smoothedValue; double m_smoothingConstant; AudioParamTimeline m_timeline; std::unique_ptr<AudioBus> m_internalSummingBus; }; } // namespace lab #endif // AudioParam_h
1,358
5,937
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. //------------------------------------------------------------------ // // // Abstract: // // The classes is used as the base class for other render targets like // HwndTarget, SurfTarget, PrintTarget //--------------------------------------------------------------------------------- MtExtern(CRenderTarget); //------------------------------------------------------------------ // CRenderTarget //------------------------------------------------------------------ class CRenderTarget : public CMilSlaveResource { friend class CResourceFactory; protected: DECLARE_METERHEAP_CLEAR(ProcessHeap, Mt(CRenderTarget)); CRenderTarget(__in_ecount(1) CComposition *pComposition); virtual ~CRenderTarget(); HRESULT Initialize(__in_ecount(1) CComposition *pDevice); void ReleaseDrawingContext(); HRESULT GetDrawingContext( __deref_out_ecount(1) CDrawingContext **pDrawingContext, bool allowCreation = true ); public: __override virtual bool IsOfType(MIL_RESOURCE_TYPE type) const { return type == TYPE_RENDERTARGET; } virtual HRESULT Render( __out_ecount(1) bool *pfNeedsPresent ) { RIP("Unexpected call to CRenderTarget::Render"); RRETURN(E_NOTIMPL); } virtual HRESULT Present() { RIP("Unexpected call to CRenderTarget::Present"); RRETURN(E_NOTIMPL); } inline virtual HRESULT NotifyDisplaySetChange(bool, int, int) { return S_OK; } inline virtual BOOL PostDisplayAvailabilityMessage(int) { return TRUE; } virtual HRESULT UpdateRenderTargetFlags() { return S_OK; } virtual HRESULT GetBaseRenderTargetInternal( __deref_out_opt IRenderTargetInternal **ppIRT ) = 0; // ------------------------------------------------------------------------ // // Command handlers // // implementation of the following commands is shared by render // targets deriving from this class. // // ------------------------------------------------------------------------ virtual HRESULT ProcessSetRoot( __in_ecount(1) CMilSlaveHandleTable *pHandleTable, __in_ecount(1) const MILCMD_TARGET_SETROOT *pCmd ); /* overriden in wintarget.h */ virtual HRESULT ProcessSetClearColor( __in_ecount(1) CMilSlaveHandleTable *pHandleTable, __in_ecount(1) const MILCMD_TARGET_SETCLEARCOLOR *pCmd ) /* overriden in surftarget.h, hwndtarget.h, wintarget.h */ { RRETURN(E_UNEXPECTED); } virtual HRESULT ProcessInvalidate( __in_ecount(1) CMilSlaveHandleTable *pHandleTable, __in_ecount(1) const MILCMD_TARGET_INVALIDATE *pCmd, __in_bcount_opt(cbPayload) LPCVOID pPayload, UINT cbPayload ) /* overriden in surftarget.h, hwndtarget.h */ { RRETURN(E_UNEXPECTED); } virtual HRESULT ProcessSetFlags( __in_ecount(1) CMilSlaveHandleTable *pHandleTable, __in_ecount(1) const MILCMD_TARGET_SETFLAGS *pCmd ) /* overriden in hwndtarget.h */ { RRETURN(E_UNEXPECTED); } virtual HRESULT ProcessUpdateWindowSettings( __in_ecount(1) CMilSlaveHandleTable *pHandleTable, __in_ecount(1) const MILCMD_TARGET_UPDATEWINDOWSETTINGS *pCmd ) { RRETURN(E_UNEXPECTED); } protected: // // This is the composition partition in which this CDrawingContext is used // It is used to create the CContentBounder and CPreComputeContext and // to get access to the schedule manager // CComposition *m_pComposition; // // Root node of the retained graphics tree. // CMilVisual *m_pRoot; // Root drawing context for this target. CDrawingContext *m_pDrawingContext; };
1,532
311
package datadog.trace.bootstrap.instrumentation.ci; import datadog.trace.bootstrap.instrumentation.ci.git.CommitInfo; import datadog.trace.bootstrap.instrumentation.ci.git.GitInfo; import datadog.trace.bootstrap.instrumentation.ci.git.PersonInfo; class BitriseInfo extends CIProviderInfo { public static final String BITRISE = "BITRISE_BUILD_SLUG"; public static final String BITRISE_PROVIDER_NAME = "bitrise"; public static final String BITRISE_PIPELINE_ID = "BITRISE_BUILD_SLUG"; public static final String BITRISE_PIPELINE_NAME = "BITRISE_TRIGGERED_WORKFLOW_ID"; public static final String BITRISE_PIPELINE_NUMBER = "BITRISE_BUILD_NUMBER"; public static final String BITRISE_PIPELINE_URL = "BITRISE_BUILD_URL"; public static final String BITRISE_WORKSPACE_PATH = "BITRISE_SOURCE_DIR"; public static final String BITRISE_GIT_REPOSITORY_URL = "GIT_REPOSITORY_URL"; public static final String BITRISE_GIT_PR_COMMIT = "BITRISE_GIT_COMMIT"; public static final String BITRISE_GIT_COMMIT = "GIT_CLONE_COMMIT_HASH"; public static final String BITRISE_GIT_BRANCH = "BITRISE_GIT_BRANCH"; public static final String BITRISE_GIT_TAG = "BITRISE_GIT_TAG"; public static final String BITRISE_GIT_MESSAGE = "BITRISE_GIT_MESSAGE"; @Override protected GitInfo buildCIGitInfo() { final String gitTag = normalizeRef(System.getenv(BITRISE_GIT_TAG)); return new GitInfo( filterSensitiveInfo(System.getenv(BITRISE_GIT_REPOSITORY_URL)), buildGitBranch(gitTag), gitTag, new CommitInfo( buildGitCommit(), PersonInfo.NOOP, PersonInfo.NOOP, System.getenv(BITRISE_GIT_MESSAGE))); } @Override protected CIInfo buildCIInfo() { return CIInfo.builder() .ciProviderName(BITRISE_PROVIDER_NAME) .ciPipelineId(System.getenv(BITRISE_PIPELINE_ID)) .ciPipelineName(System.getenv(BITRISE_PIPELINE_NAME)) .ciPipelineNumber(System.getenv(BITRISE_PIPELINE_NUMBER)) .ciPipelineUrl(System.getenv(BITRISE_PIPELINE_URL)) .ciWorkspace(expandTilde(System.getenv(BITRISE_WORKSPACE_PATH))) .build(); } private String buildGitBranch(final String gitTag) { if (gitTag != null) { return null; } return normalizeRef(System.getenv(BITRISE_GIT_BRANCH)); } private String buildGitCommit() { final String fromCommit = System.getenv(BITRISE_GIT_PR_COMMIT); if (fromCommit != null && !fromCommit.isEmpty()) { return fromCommit; } else { return System.getenv(BITRISE_GIT_COMMIT); } } }
1,061
671
<reponame>ztang4/tzqhexapod<filename>texts.py APP_TITLE = "Mithi's Hexapod Robot Simulator" URL_KOFI = "https://ko-fi.com/minimithi" URL_REPO = "https://github.com/mithi/hexapod-robot-simulator" URL_IMG_LANDING = "https://mithi.github.io/robotics-blog/v2-hexapod-1.gif" KINEMATICS_PAGE_PATH = "/kinematics" IK_PAGE_PATH = "/inverse-kinematics" PATTERNS_PAGE_PATH = "/leg-patterns" ROOT_PATH = "/" DIMENSIONS_WIDGETS_HEADER = "robot dimensions".upper() PATTERNS_WIDGETS_HEADER = "leg patterns".upper() IK_WIDGETS_HEADER = "inverse kinematics".upper() KINEMATICS_WIDGETS_HEADER = "kinematics".upper()
266
511
//////////////////////////////////////////////////////////////////// // // Copyright 2019 Samsung Electronics All Rights Reserved. // // 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 smartfs_dump_parser.handlers; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.widgets.Shell; public class AboutHandler { @Execute public void execute(Shell shell) { MessageDialog.openInformation(shell, "About", "SmartFS Dump Visualizer"); } }
274
1,523
// 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. #ifndef IMPALA_EXEC_HBASE_TABLE_SINK_H #define IMPALA_EXEC_HBASE_TABLE_SINK_H #include <vector> #include "common/status.h" #include "runtime/runtime-state.h" #include "runtime/row-batch.h" #include "runtime/descriptors.h" #include "exec/data-sink.h" #include "exec/hbase-table-writer.h" #include "gen-cpp/Data_types.h" #include "gen-cpp/Exprs_types.h" namespace impala { /// Class to take row batches and send them to the HBaseTableWriter to /// eventually be written into an HBase table. class HBaseTableSink : public DataSink { public: HBaseTableSink(TDataSinkId sink_id, const RowDescriptor* row_desc, const TDataSink& tsink, RuntimeState* state); virtual Status Prepare(RuntimeState* state, MemTracker* parent_mem_tracker); virtual Status Send(RuntimeState* state, RowBatch* batch); virtual Status FlushFinal(RuntimeState* state); virtual void Close(RuntimeState* state); private: /// Used to get the HBaseTableDescriptor from the RuntimeState TableId table_id_; /// The description of the table. Used for table name and column mapping. HBaseTableDescriptor* table_desc_; /// The object that this sink uses to write to hbase. /// hbase_table_writer is owned by this sink and should be closed /// when this is Close'd. boost::scoped_ptr<HBaseTableWriter> hbase_table_writer_; }; } // namespace impala #endif // IMPALA_EXEC_HBASE_TABLE_SINK_H
663
1,846
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import numpy as np import unittest from numpy.random import normal, multivariate_normal, binomial from sklearn.exceptions import DataConversionWarning from sklearn.linear_model import LinearRegression from sklearn.pipeline import Pipeline from sklearn.preprocessing import PolynomialFeatures from econml.metalearners import * import econml.tests.utilities # bugfix for assertWarns class TestMetalearners(unittest.TestCase): @classmethod def setUpClass(cls): # Set random seed cls.random_state = np.random.RandomState(12345) # Generate data # DGP constants cls.d = 5 cls.n = 1000 cls.n_test = 200 cls.heterogeneity_index = 1 # Test data cls.X_test = cls.random_state.multivariate_normal( np.zeros(cls.d), np.diag(np.ones(cls.d)), cls.n_test) # Constant treatment effect cls.const_te_data = TestMetalearners._generate_data( cls.n, cls.d, beta=cls.random_state.uniform(0, 1, cls.d), treatment_effect=TestMetalearners._const_te, multi_y=False) # Constant treatment with multi output Y cls.const_te_multiy_data = TestMetalearners._generate_data( cls.n, cls.d, beta=cls.random_state.uniform(0, 1, size=(cls.d, 2)), treatment_effect=TestMetalearners._const_te, multi_y=True) # Heterogeneous treatment cls.heterogeneous_te_data = TestMetalearners._generate_data( cls.n, cls.d, beta=cls.random_state.uniform(0, 1, cls.d), treatment_effect=TestMetalearners._heterogeneous_te, multi_y=False) # Heterogeneous treatment with multi output Y cls.heterogeneous_te_multiy_data = TestMetalearners._generate_data( cls.n, cls.d, beta=cls.random_state.uniform(0, 1, size=(cls.d, 2)), treatment_effect=TestMetalearners._heterogeneous_te, multi_y=True) def test_TLearner(self): """Tests whether the TLearner can accurately estimate constant and heterogeneous treatment effects. """ # TLearner test # Instantiate TLearner T_learner = TLearner(models=LinearRegression()) # Test inputs self._test_inputs(T_learner, T0=3, T1=5) # Test constant and heterogeneous treatment effect, single and multi output y for te_type in ["const", "heterogeneous"]: for multi_y in [False, True]: self._test_te(T_learner, T0=3, T1=5, tol=0.5, te_type=te_type, multi_y=multi_y) def test_SLearner(self): """Tests whether the SLearner can accurately estimate constant and heterogeneous treatment effects. """ # Instantiate SLearner S_learner = SLearner(overall_model=LinearRegression()) # Test inputs self._test_inputs(S_learner, T0=3, T1=5) # Test constant treatment effect self._test_te(S_learner, T0=3, T1=5, tol=0.5, te_type="const", multi_y=False) # Test constant treatment effect with multi output Y self._test_te(S_learner, T0=3, T1=5, tol=0.5, te_type="const", multi_y=True) # Test heterogeneous treatment effect # Need interactions between T and features overall_model = Pipeline([('poly', PolynomialFeatures()), ('model', LinearRegression())]) S_learner = SLearner(overall_model=overall_model) self._test_te(S_learner, T0=3, T1=5, tol=0.5, te_type="heterogeneous", multi_y=False) # Test heterogeneous treatment effect with multi output Y self._test_te(S_learner, T0=3, T1=5, tol=0.5, te_type="heterogeneous", multi_y=True) def test_XLearner(self): """Tests whether the XLearner can accurately estimate constant and heterogeneous treatment effects. """ # Instantiate XLearner X_learner = XLearner(models=LinearRegression()) # Test inputs self._test_inputs(X_learner, T0=3, T1=5) # Test constant and heterogeneous treatment effect, single and multi output y for te_type in ["const", "heterogeneous"]: for multi_y in [False, True]: self._test_te(X_learner, T0=3, T1=5, tol=0.5, te_type=te_type, multi_y=multi_y) def test_DALearner(self): """Tests whether the DomainAdaptationLearner can accurately estimate constant and heterogeneous treatment effects. """ # Instantiate DomainAdaptationLearner DA_learner = DomainAdaptationLearner(models=LinearRegression(), final_models=LinearRegression()) # Test inputs self._test_inputs(DA_learner, T0=3, T1=5) # Test constant and heterogeneous treatment effect, single and multi output y for te_type in ["const", "heterogeneous"]: for multi_y in [False, True]: self._test_te(DA_learner, T0=3, T1=5, tol=0.5, te_type=te_type, multi_y=multi_y) def _test_te(self, learner_instance, T0, T1, tol, te_type="const", multi_y=False): if te_type not in ["const", "heterogeneous"]: raise ValueError("Type of treatment effect must be 'const' or 'heterogeneous'.") te_func = getattr(TestMetalearners, "_{te_type}_te".format(te_type=te_type)) if multi_y: X, T, Y = getattr(TestMetalearners, "{te_type}_te_multiy_data".format(te_type=te_type)) # Get the true treatment effect te = np.repeat((np.apply_along_axis(te_func, 1, TestMetalearners.X_test) * (T1 - T0)).reshape(-1, 1), 2, axis=1) marginal_te = np.repeat(np.apply_along_axis( te_func, 1, TestMetalearners.X_test).reshape(-1, 1) * np.array([2, 4]), 2, axis=0).reshape((-1, 2, 2)) else: X, T, Y = getattr(TestMetalearners, "{te_type}_te_data".format(te_type=te_type)) # Get the true treatment effect te = np.apply_along_axis(te_func, 1, TestMetalearners.X_test) * (T1 - T0) marginal_te = np.apply_along_axis(te_func, 1, TestMetalearners.X_test).reshape(-1, 1) * np.array([2, 4]) # Fit learner and get the effect and marginal effect learner_instance.fit(Y, T, X=X) te_hat = learner_instance.effect(TestMetalearners.X_test, T0=T0, T1=T1) marginal_te_hat = learner_instance.marginal_effect(T1, TestMetalearners.X_test) # Compute treatment effect residuals (absolute) te_res = np.abs(te - te_hat) marginal_te_res = np.abs(marginal_te - marginal_te_hat) # Check that at least 90% of predictions are within tolerance interval self.assertGreaterEqual(np.mean(te_res < tol), 0.90) self.assertGreaterEqual(np.mean(marginal_te_res < tol), 0.90) # Check whether the output shape is right m = TestMetalearners.X_test.shape[0] d_t = 2 d_y = Y.shape[1:] self.assertEqual(te_hat.shape, (m,) + d_y) self.assertEqual(marginal_te_hat.shape, (m, d_t,) + d_y) def _test_inputs(self, learner_instance, T0, T1): X, T, Y = TestMetalearners.const_te_data # Check that one can pass in regular lists learner_instance.fit(list(Y), list(T), X=list(X)) learner_instance.effect(list(TestMetalearners.X_test), T0=T0, T1=T1) # Check that it fails correctly if lists of different shape are passed in self.assertRaises(ValueError, learner_instance.fit, Y, T, X=X[:TestMetalearners.n // 2]) self.assertRaises(ValueError, learner_instance.fit, Y[:TestMetalearners.n // 2], T, X=X) # Check that it works when T, Y have shape (n, 1) self.assertWarns(DataConversionWarning, learner_instance.fit, Y.reshape(-1, 1), T.reshape(-1, 1), X=X ) @classmethod def _const_te(cls, x): return 2 @classmethod def _heterogeneous_te(cls, x): return x[cls.heterogeneity_index] @classmethod def _generate_data(cls, n, d, beta, treatment_effect, multi_y): """Generates population data for given treatment_effect functions. Parameters ---------- n (int): population size d (int): number of covariates untreated_outcome (func): untreated outcome conditional on covariates treatment_effect (func): treatment effect conditional on covariates """ # Generate covariates X = cls.random_state.multivariate_normal(np.zeros(d), np.diag(np.ones(d)), n) # Generate treatment T = cls.random_state.choice([1, 3, 5], size=n, p=[0.2, 0.3, 0.5]) # Calculate outcome Y0 = (np.dot(X, beta) + cls.random_state.normal(0, 1)).reshape(n, -1) treat_effect = np.apply_along_axis(lambda x: treatment_effect(x), 1, X) Y = Y0 + (treat_effect * T).reshape(-1, 1) if not multi_y: Y = Y.flatten() return (X, T, Y)
4,048
1,603
<gh_stars>1000+ package com.linkedin.gms.factory.search; import com.linkedin.gms.factory.common.IndexConventionFactory; import com.linkedin.gms.factory.common.RestHighLevelClientFactory; import com.linkedin.gms.factory.spring.YamlPropertySourceFactory; import com.linkedin.metadata.search.elasticsearch.indexbuilder.ESIndexBuilder; import com.linkedin.metadata.utils.elasticsearch.IndexConvention; import javax.annotation.Nonnull; import lombok.Value; import org.elasticsearch.action.bulk.BulkProcessor; import org.elasticsearch.client.RestHighLevelClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.PropertySource; /** * Factory for components required for any services using elasticsearch */ @Configuration @Import({RestHighLevelClientFactory.class, IndexConventionFactory.class, ElasticSearchBulkProcessorFactory.class, ElasticSearchIndexBuilderFactory.class}) @PropertySource(value = "classpath:/application.yml", factory = YamlPropertySourceFactory.class) public class BaseElasticSearchComponentsFactory { @Value public static class BaseElasticSearchComponents { RestHighLevelClient searchClient; IndexConvention indexConvention; BulkProcessor bulkProcessor; ESIndexBuilder indexBuilder; } @Autowired @Qualifier("elasticSearchRestHighLevelClient") private RestHighLevelClient searchClient; @Autowired @Qualifier(IndexConventionFactory.INDEX_CONVENTION_BEAN) private IndexConvention indexConvention; @Autowired @Qualifier("elasticSearchBulkProcessor") private BulkProcessor bulkProcessor; @Autowired @Qualifier("elasticSearchIndexBuilder") private ESIndexBuilder indexBuilder; @Bean(name = "baseElasticSearchComponents") @Nonnull protected BaseElasticSearchComponents getInstance() { return new BaseElasticSearchComponents(searchClient, indexConvention, bulkProcessor, indexBuilder); } }
625
1,998
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from botbuilder.core import MessageFactory from botbuilder.dialogs import ( WaterfallDialog, DialogTurnResult, WaterfallStepContext, ComponentDialog, ) from botbuilder.dialogs.prompts import PromptOptions, TextPrompt, NumberPrompt from data_models import UserProfile from dialogs.review_selection_dialog import ReviewSelectionDialog class TopLevelDialog(ComponentDialog): def __init__(self, dialog_id: str = None): super(TopLevelDialog, self).__init__(dialog_id or TopLevelDialog.__name__) # Key name to store this dialogs state info in the StepContext self.USER_INFO = "value-userInfo" self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(NumberPrompt(NumberPrompt.__name__)) self.add_dialog(ReviewSelectionDialog(ReviewSelectionDialog.__name__)) self.add_dialog( WaterfallDialog( "WFDialog", [ self.name_step, self.age_step, self.start_selection_step, self.acknowledgement_step, ], ) ) self.initial_dialog_id = "WFDialog" async def name_step(self, step_context: WaterfallStepContext) -> DialogTurnResult: # Create an object in which to collect the user's information within the dialog. step_context.values[self.USER_INFO] = UserProfile() # Ask the user to enter their name. prompt_options = PromptOptions( prompt=MessageFactory.text("Please enter your name.") ) return await step_context.prompt(TextPrompt.__name__, prompt_options) async def age_step(self, step_context: WaterfallStepContext) -> DialogTurnResult: # Set the user's name to what they entered in response to the name prompt. user_profile = step_context.values[self.USER_INFO] user_profile.name = step_context.result # Ask the user to enter their age. prompt_options = PromptOptions( prompt=MessageFactory.text("Please enter your age.") ) return await step_context.prompt(NumberPrompt.__name__, prompt_options) async def start_selection_step( self, step_context: WaterfallStepContext ) -> DialogTurnResult: # Set the user's age to what they entered in response to the age prompt. user_profile: UserProfile = step_context.values[self.USER_INFO] user_profile.age = step_context.result if user_profile.age < 25: # If they are too young, skip the review selection dialog, and pass an empty list to the next step. await step_context.context.send_activity( MessageFactory.text("You must be 25 or older to participate.") ) return await step_context.next([]) # Otherwise, start the review selection dialog. return await step_context.begin_dialog(ReviewSelectionDialog.__name__) async def acknowledgement_step( self, step_context: WaterfallStepContext ) -> DialogTurnResult: # Set the user's company selection to what they entered in the review-selection dialog. user_profile: UserProfile = step_context.values[self.USER_INFO] user_profile.companies_to_review = step_context.result # Thank them for participating. await step_context.context.send_activity( MessageFactory.text(f"Thanks for participating, {user_profile.name}.") ) # Exit the dialog, returning the collected user information. return await step_context.end_dialog(user_profile)
1,431
14,668
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ui/webui/settings/chromeos/device_name_handler.h" #include <memory> #include <string> #include "ash/constants/ash_features.h" #include "base/test/scoped_feature_list.h" #include "chrome/browser/ash/device_name/fake_device_name_store.h" #include "content/public/test/browser_task_environment.h" #include "content/public/test/test_web_ui.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos { namespace settings { class TestDeviceNameHandler : public DeviceNameHandler { public: explicit TestDeviceNameHandler(content::WebUI* web_ui, DeviceNameStore* fake_device_name_store) : DeviceNameHandler(fake_device_name_store) { set_web_ui(web_ui); } // Raise visibility to public. using DeviceNameHandler::HandleAttemptSetDeviceName; using DeviceNameHandler::HandleNotifyReadyForDeviceName; }; class DeviceNameHandlerTest : public testing::Test { public: DeviceNameHandlerTest() = default; void SetUp() override { testing::Test::SetUp(); handler_ = std::make_unique<TestDeviceNameHandler>( web_ui(), &fake_device_name_store_); web_ui()->ClearTrackedCalls(); feature_list_.InitAndEnableFeature(ash::features::kEnableHostnameSetting); } void CallHandleNotifyReadyForDeviceName() { // Need to call HandleNotifyReadyForDeviceName() once for handler to start // listening to changes in device name metadata. base::Value args(base::Value::Type::LIST); args.Append("callback-id"); handler()->HandleNotifyReadyForDeviceName(&base::Value::AsListValue(args)); // On notifying, device name metadata should be received and be equal to the // default values. VerifyDeviceNameMetadata(FakeDeviceNameStore::kDefaultDeviceName, DeviceNameStore::DeviceNameState::kCanBeModified); } void TearDown() override { FakeDeviceNameStore::Shutdown(); } void VerifyDeviceNameMetadata( const std::string& expected_device_name, DeviceNameStore::DeviceNameState expected_device_name_state) { const content::TestWebUI::CallData& call_data = *web_ui()->call_data().back(); EXPECT_EQ("cr.webUIListenerCallback", call_data.function_name()); EXPECT_EQ("settings.updateDeviceNameMetadata", call_data.arg1()->GetString()); const base::DictionaryValue* returned_data; ASSERT_TRUE(call_data.arg2()->GetAsDictionary(&returned_data)); std::string device_name; returned_data->GetString("deviceName", &device_name); EXPECT_EQ(expected_device_name, device_name); absl::optional<int> device_name_state = returned_data->FindIntKey("deviceNameState"); ASSERT_TRUE(device_name_state); EXPECT_EQ(static_cast<int>(expected_device_name_state), *device_name_state); } void VerifySetDeviceNameResult( const std::string& device_name, DeviceNameStore::SetDeviceNameResult expected_result) { base::Value args(base::Value::Type::LIST); args.Append("callback-id"); args.Append(device_name); handler()->HandleAttemptSetDeviceName(&base::Value::AsListValue(args)); const content::TestWebUI::CallData& call_data = *web_ui()->call_data().back(); EXPECT_EQ("cr.webUIResponse", call_data.function_name()); EXPECT_EQ("callback-id", call_data.arg1()->GetString()); EXPECT_TRUE(call_data.arg2()->GetBool()); EXPECT_EQ(static_cast<int>(expected_result), call_data.arg3()->GetInt()); } void VerifyValuesInDeviceNameStore( const std::string& expected_name, DeviceNameStore::DeviceNameState expected_state) { DeviceNameStore::DeviceNameMetadata metadata = fake_device_name_store()->GetDeviceNameMetadata(); EXPECT_EQ(metadata.device_name, expected_name); EXPECT_EQ(metadata.device_name_state, expected_state); } FakeDeviceNameStore* fake_device_name_store() { return &fake_device_name_store_; } TestDeviceNameHandler* handler() { return handler_.get(); } content::TestWebUI* web_ui() { return &web_ui_; } private: // Run on the UI thread. content::BrowserTaskEnvironment task_environment_; FakeDeviceNameStore fake_device_name_store_; content::TestWebUI web_ui_; std::unique_ptr<TestDeviceNameHandler> handler_; base::test::ScopedFeatureList feature_list_; }; TEST_F(DeviceNameHandlerTest, DeviceNameMetadata_ChangeName) { CallHandleNotifyReadyForDeviceName(); EXPECT_EQ(DeviceNameStore::SetDeviceNameResult::kSuccess, fake_device_name_store()->SetDeviceName("TestName")); VerifyDeviceNameMetadata("TestName", DeviceNameStore::DeviceNameState::kCanBeModified); // Verify that we can still provide updates to the device name as long as // handleNotifyReadyForDeviceName() has been called once during setup. EXPECT_EQ(DeviceNameStore::SetDeviceNameResult::kSuccess, fake_device_name_store()->SetDeviceName("TestName1")); VerifyDeviceNameMetadata("TestName1", DeviceNameStore::DeviceNameState::kCanBeModified); } TEST_F(DeviceNameHandlerTest, DeviceNameMetadata_ChangeState) { CallHandleNotifyReadyForDeviceName(); DeviceNameStore::DeviceNameState device_name_state = DeviceNameStore::DeviceNameState::kCannotBeModifiedBecauseOfPolicy; fake_device_name_store()->SetDeviceNameState(device_name_state); VerifyDeviceNameMetadata(FakeDeviceNameStore::kDefaultDeviceName, device_name_state); // Verify that we can still provide updates to the device name state as long // as handleNotifyReadyForDeviceName() has been called once during setup. device_name_state = DeviceNameStore::DeviceNameState::kCannotBeModifiedBecauseNotDeviceOwner; fake_device_name_store()->SetDeviceNameState(device_name_state); VerifyDeviceNameMetadata(FakeDeviceNameStore::kDefaultDeviceName, device_name_state); device_name_state = DeviceNameStore::DeviceNameState::kCanBeModified; fake_device_name_store()->SetDeviceNameState(device_name_state); VerifyDeviceNameMetadata(FakeDeviceNameStore::kDefaultDeviceName, device_name_state); } // Verify that DeviceNameHandler::HandleAttemptSetDeviceName() works for all // possible name update results. TEST_F(DeviceNameHandlerTest, SetDeviceName) { // Verify default values in device name store. VerifyValuesInDeviceNameStore( "ChromeOS", DeviceNameStore::DeviceNameState::kCanBeModified); // Verify that name update is successful and that the name changes in device // name store. VerifySetDeviceNameResult("TestName", DeviceNameStore::SetDeviceNameResult::kSuccess); VerifyValuesInDeviceNameStore( "TestName", DeviceNameStore::DeviceNameState::kCanBeModified); // Verify that name update is unsuccessful because of invalid name and that // the name does not change in device name store. VerifySetDeviceNameResult("Invalid Name", DeviceNameStore::SetDeviceNameResult::kInvalidName); VerifyValuesInDeviceNameStore( "TestName", DeviceNameStore::DeviceNameState::kCanBeModified); // Verify that name update is unsuccessful because of policy and that the // name does not change in device name store. fake_device_name_store()->SetDeviceNameState( DeviceNameStore::DeviceNameState::kCannotBeModifiedBecauseOfPolicy); VerifySetDeviceNameResult( "TestName", DeviceNameStore::SetDeviceNameResult::kProhibitedByPolicy); VerifyValuesInDeviceNameStore( "TestName", DeviceNameStore::DeviceNameState::kCannotBeModifiedBecauseOfPolicy); // Verify that name update is unsuccessful because user is not device owner // and that the name does not change in device name store. fake_device_name_store()->SetDeviceNameState( DeviceNameStore::DeviceNameState::kCannotBeModifiedBecauseNotDeviceOwner); VerifySetDeviceNameResult( "TestName", DeviceNameStore::SetDeviceNameResult::kNotDeviceOwner); VerifyValuesInDeviceNameStore( "TestName", DeviceNameStore::DeviceNameState::kCannotBeModifiedBecauseNotDeviceOwner); } } // namespace settings } // namespace chromeos
2,835
9,953
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.internet._pollingfile}. """ from twisted.python.runtime import platform from twisted.trial.unittest import TestCase if platform.isWindows(): from twisted.internet import _pollingfile else: _pollingfile = None class PollableWritePipeTests(TestCase): """ Tests for L{_pollingfile._PollableWritePipe}. """ def test_writeUnicode(self): """ L{_pollingfile._PollableWritePipe.write} raises a C{TypeError} if an attempt is made to append unicode data to the output buffer. """ p = _pollingfile._PollableWritePipe(1, lambda: None) self.assertRaises(TypeError, p.write, u"test") def test_writeSequenceUnicode(self): """ L{_pollingfile._PollableWritePipe.writeSequence} raises a C{TypeError} if unicode data is part of the data sequence to be appended to the output buffer. """ p = _pollingfile._PollableWritePipe(1, lambda: None) self.assertRaises(TypeError, p.writeSequence, [u"test"]) self.assertRaises(TypeError, p.writeSequence, (u"test", )) if _pollingfile is None: PollableWritePipeTests.skip = "Test will run only on Windows."
495
399
<gh_stars>100-1000 /* * Copyright (C) 2006-2013 Bitronix Software (http://www.bitronix.be) * * 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 bitronix.tm.gui; import bitronix.tm.TransactionManagerServices; import bitronix.tm.resource.ResourceLoader; import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; import java.util.Iterator; /** * * @author <NAME> */ public class ResourcesTreeModel implements TreeModel { private static final String ROOT = "Resource loader"; private final ResourceLoader resourceLoader; public ResourcesTreeModel() { resourceLoader = TransactionManagerServices.getResourceLoader(); } @Override public Object getRoot() { return ROOT; } @Override public int getChildCount(Object parent) { if (parent.equals(ROOT)) return resourceLoader.getResources().size(); return 0; } @Override public boolean isLeaf(Object node) { if (node.equals(ROOT)) return false; return true; } @Override public void addTreeModelListener(TreeModelListener l) { //To change body of implemented methods use File | Settings | File Templates. } @Override public void removeTreeModelListener(TreeModelListener l) { //To change body of implemented methods use File | Settings | File Templates. } @Override public Object getChild(Object parent, int index) { if (index < 0) return ROOT; Iterator it = resourceLoader.getResources().entrySet().iterator(); Object result = null; for(int i= -1; i<index ;i++) { result = it.next(); } return result; } @Override public int getIndexOfChild(Object parent, Object child) { return 0; //To change body of implemented methods use File | Settings | File Templates. } @Override public void valueForPathChanged(TreePath path, Object newValue) { //To change body of implemented methods use File | Settings | File Templates. } }
893
1,194
package ca.uhn.fhir.rest.server.interceptor; /* * #%L * HAPI FHIR - Server Framework * %% * Copyright (C) 2014 - 2022 Smile CDR, Inc. * %% * 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. * #L% */ import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.api.Interceptor; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.api.RestOperationTypeEnum; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.util.OperationOutcomeUtil; import ca.uhn.fhir.validation.FhirValidator; import ca.uhn.fhir.validation.IValidatorModule; import ca.uhn.fhir.validation.ResultSeverityEnum; import ca.uhn.fhir.validation.SingleValidationMessage; import ca.uhn.fhir.validation.ValidationResult; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.text.StrLookup; import org.apache.commons.lang3.text.StrSubstitutor; import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; import static org.apache.commons.lang3.StringUtils.isNotBlank; /** * This interceptor intercepts each incoming request and if it contains a FHIR resource, validates that resource. The * interceptor may be configured to run any validator modules, and will then add headers to the response or fail the * request with an {@link UnprocessableEntityException HTTP 422 Unprocessable Entity}. */ @Interceptor public abstract class BaseValidatingInterceptor<T> extends ValidationResultEnrichingInterceptor { /** * Default value:<br/> * <code> * ${row}:${col} ${severity} ${message} (${location}) * </code> */ public static final String DEFAULT_RESPONSE_HEADER_VALUE = "${row}:${col} ${severity} ${message} (${location})"; private static final Logger ourLog = LoggerFactory.getLogger(BaseValidatingInterceptor.class); private Integer myAddResponseIssueHeaderOnSeverity = null; private Integer myAddResponseOutcomeHeaderOnSeverity = null; private Integer myFailOnSeverity = ResultSeverityEnum.ERROR.ordinal(); private boolean myIgnoreValidatorExceptions; private int myMaximumHeaderLength = 200; private String myResponseIssueHeaderName = provideDefaultResponseHeaderName(); private String myResponseIssueHeaderValue = DEFAULT_RESPONSE_HEADER_VALUE; private String myResponseIssueHeaderValueNoIssues = null; private String myResponseOutcomeHeaderName = provideDefaultResponseHeaderName(); private List<IValidatorModule> myValidatorModules; private FhirValidator myValidator; private void addResponseIssueHeader(RequestDetails theRequestDetails, SingleValidationMessage theNext) { // Perform any string substitutions from the message format StrLookup<?> lookup = new MyLookup(theNext); StrSubstitutor subs = new StrSubstitutor(lookup, "${", "}", '\\'); // Log the header String headerValue = subs.replace(myResponseIssueHeaderValue); ourLog.trace("Adding header to response: {}", headerValue); theRequestDetails.getResponse().addHeader(myResponseIssueHeaderName, headerValue); } /** * Specify a validator module to use. * * @see #setValidator(FhirValidator) */ public BaseValidatingInterceptor<T> addValidatorModule(IValidatorModule theModule) { Validate.notNull(theModule, "theModule must not be null"); Validate.isTrue(myValidator == null, "Can not specify both a validator and validator modules. Only one needs to be supplied."); if (getValidatorModules() == null) { setValidatorModules(new ArrayList<>()); } getValidatorModules().add(theModule); return this; } /** * Provides the validator to use. This can be used as an alternative to {@link #addValidatorModule(IValidatorModule)} * * @see #addValidatorModule(IValidatorModule) * @see #setValidatorModules(List) */ public void setValidator(FhirValidator theValidator) { Validate.isTrue(theValidator == null || getValidatorModules() == null || getValidatorModules().isEmpty(), "Can not specify both a validator and validator modules. Only one needs to be supplied."); myValidator = theValidator; } abstract ValidationResult doValidate(FhirValidator theValidator, T theRequest); /** * Fail the request by throwing an {@link UnprocessableEntityException} as a result of a validation failure. * Subclasses may change this behaviour by providing alternate behaviour. */ protected void fail(RequestDetails theRequestDetails, ValidationResult theValidationResult) { throw new UnprocessableEntityException(Msg.code(330) + theValidationResult.getMessages().get(0).getMessage(), theValidationResult.toOperationOutcome()); } /** * If the validation produces a result with at least the given severity, a header with the name * specified by {@link #setResponseOutcomeHeaderName(String)} will be added containing a JSON encoded * OperationOutcome resource containing the validation results. */ public ResultSeverityEnum getAddResponseOutcomeHeaderOnSeverity() { return myAddResponseOutcomeHeaderOnSeverity != null ? ResultSeverityEnum.values()[myAddResponseOutcomeHeaderOnSeverity] : null; } /** * If the validation produces a result with at least the given severity, a header with the name * specified by {@link #setResponseOutcomeHeaderName(String)} will be added containing a JSON encoded * OperationOutcome resource containing the validation results. */ public void setAddResponseOutcomeHeaderOnSeverity(ResultSeverityEnum theAddResponseOutcomeHeaderOnSeverity) { myAddResponseOutcomeHeaderOnSeverity = theAddResponseOutcomeHeaderOnSeverity != null ? theAddResponseOutcomeHeaderOnSeverity.ordinal() : null; } /** * The maximum length for an individual header. If an individual header would be written exceeding this length, * the header value will be truncated. */ public int getMaximumHeaderLength() { return myMaximumHeaderLength; } /** * The maximum length for an individual header. If an individual header would be written exceeding this length, * the header value will be truncated. Value must be greater than 100. */ public void setMaximumHeaderLength(int theMaximumHeaderLength) { Validate.isTrue(theMaximumHeaderLength >= 100, "theMaximumHeadeerLength must be >= 100"); myMaximumHeaderLength = theMaximumHeaderLength; } /** * The name of the header specified by {@link #setAddResponseOutcomeHeaderOnSeverity(ResultSeverityEnum)} */ public String getResponseOutcomeHeaderName() { return myResponseOutcomeHeaderName; } /** * The name of the header specified by {@link #setAddResponseOutcomeHeaderOnSeverity(ResultSeverityEnum)} */ public void setResponseOutcomeHeaderName(String theResponseOutcomeHeaderName) { Validate.notEmpty(theResponseOutcomeHeaderName, "theResponseOutcomeHeaderName can not be empty or null"); myResponseOutcomeHeaderName = theResponseOutcomeHeaderName; } public List<IValidatorModule> getValidatorModules() { return myValidatorModules; } public void setValidatorModules(List<IValidatorModule> theValidatorModules) { Validate.isTrue(myValidator == null || theValidatorModules == null || theValidatorModules.isEmpty(), "Can not specify both a validator and validator modules. Only one needs to be supplied."); myValidatorModules = theValidatorModules; } /** * If set to <code>true</code> (default is <code>false</code>) this interceptor * will exit immediately and allow processing to continue if the validator throws * any exceptions. * <p> * This setting is mostly useful in testing situations * </p> */ public boolean isIgnoreValidatorExceptions() { return myIgnoreValidatorExceptions; } /** * If set to <code>true</code> (default is <code>false</code>) this interceptor * will exit immediately and allow processing to continue if the validator throws * any exceptions. * <p> * This setting is mostly useful in testing situations * </p> */ public void setIgnoreValidatorExceptions(boolean theIgnoreValidatorExceptions) { myIgnoreValidatorExceptions = theIgnoreValidatorExceptions; } abstract String provideDefaultResponseHeaderName(); /** * Sets the minimum severity at which an issue detected by the validator will result in a header being added to the * response. Default is {@link ResultSeverityEnum#INFORMATION}. Set to <code>null</code> to disable this behaviour. * * @see #setResponseHeaderName(String) * @see #setResponseHeaderValue(String) */ public void setAddResponseHeaderOnSeverity(ResultSeverityEnum theSeverity) { myAddResponseIssueHeaderOnSeverity = theSeverity != null ? theSeverity.ordinal() : null; } /** * Sets the minimum severity at which an issue detected by the validator will fail/reject the request. Default is * {@link ResultSeverityEnum#ERROR}. Set to <code>null</code> to disable this behaviour. */ public void setFailOnSeverity(ResultSeverityEnum theSeverity) { myFailOnSeverity = theSeverity != null ? theSeverity.ordinal() : null; } /** * Sets the name of the response header to add validation failures to * * @see #setAddResponseHeaderOnSeverity(ResultSeverityEnum) */ protected void setResponseHeaderName(String theResponseHeaderName) { Validate.notBlank(theResponseHeaderName, "theResponseHeaderName must not be blank or null"); myResponseIssueHeaderName = theResponseHeaderName; } /** * Sets the value to add to the response header with the name specified by {@link #setResponseHeaderName(String)} * when validation produces a message of severity equal to or greater than * {@link #setAddResponseHeaderOnSeverity(ResultSeverityEnum)} * <p> * This field allows the following substitutions: * </p> * <table> * <tr> * <td>Name</td> * <td>Value</td> * </tr> * <tr> * <td>${line}</td> * <td>The line in the request</td> * </tr> * <tr> * <td>${col}</td> * <td>The column in the request</td> * </tr> * <tr> * <td>${location}</td> * <td>The location in the payload as a string (typically this will be a path)</td> * </tr> * <tr> * <td>${severity}</td> * <td>The severity of the issue</td> * </tr> * <tr> * <td>${message}</td> * <td>The validation message</td> * </tr> * </table> * * @see #DEFAULT_RESPONSE_HEADER_VALUE * @see #setAddResponseHeaderOnSeverity(ResultSeverityEnum) */ public void setResponseHeaderValue(String theResponseHeaderValue) { Validate.notBlank(theResponseHeaderValue, "theResponseHeaderValue must not be blank or null"); myResponseIssueHeaderValue = theResponseHeaderValue; } /** * Sets the header value to add when no issues are found at or exceeding the * threshold specified by {@link #setAddResponseHeaderOnSeverity(ResultSeverityEnum)} */ public void setResponseHeaderValueNoIssues(String theResponseHeaderValueNoIssues) { myResponseIssueHeaderValueNoIssues = theResponseHeaderValueNoIssues; } /** * Hook for subclasses (e.g. add a tag (coding) to an incoming resource when a given severity appears in the * ValidationResult). */ protected void postProcessResult(RequestDetails theRequestDetails, ValidationResult theValidationResult) { } /** * Hook for subclasses on failure (e.g. add a response header to an incoming resource upon rejection). */ protected void postProcessResultOnFailure(RequestDetails theRequestDetails, ValidationResult theValidationResult) { } /** * Note: May return null */ protected ValidationResult validate(T theRequest, RequestDetails theRequestDetails) { if (theRequest == null || theRequestDetails == null) { return null; } RestOperationTypeEnum opType = theRequestDetails.getRestOperationType(); if (opType != null) { switch (opType) { case GRAPHQL_REQUEST: return null; default: break; } } FhirValidator validator; if (myValidator != null) { validator = myValidator; } else { validator = theRequestDetails.getServer().getFhirContext().newValidator(); if (myValidatorModules != null) { for (IValidatorModule next : myValidatorModules) { validator.registerValidatorModule(next); } } } ValidationResult validationResult; try { validationResult = doValidate(validator, theRequest); } catch (Exception e) { if (myIgnoreValidatorExceptions) { ourLog.warn("Validator threw an exception during validation", e); return null; } if (e instanceof BaseServerResponseException) { throw (BaseServerResponseException) e; } throw new InternalErrorException(Msg.code(331) + e); } if (myAddResponseIssueHeaderOnSeverity != null) { boolean found = false; for (SingleValidationMessage next : validationResult.getMessages()) { if (next.getSeverity().ordinal() >= myAddResponseIssueHeaderOnSeverity) { addResponseIssueHeader(theRequestDetails, next); found = true; } } if (!found) { if (isNotBlank(myResponseIssueHeaderValueNoIssues)) { theRequestDetails.getResponse().addHeader(myResponseIssueHeaderName, myResponseIssueHeaderValueNoIssues); } } } if (myFailOnSeverity != null) { for (SingleValidationMessage next : validationResult.getMessages()) { if (next.getSeverity().ordinal() >= myFailOnSeverity) { postProcessResultOnFailure(theRequestDetails, validationResult); fail(theRequestDetails, validationResult); return validationResult; } } } if (myAddResponseOutcomeHeaderOnSeverity != null) { IBaseOperationOutcome outcome = null; for (SingleValidationMessage next : validationResult.getMessages()) { if (next.getSeverity().ordinal() >= myAddResponseOutcomeHeaderOnSeverity) { outcome = validationResult.toOperationOutcome(); break; } } if (outcome == null && myAddResponseOutcomeHeaderOnSeverity != null && myAddResponseOutcomeHeaderOnSeverity == ResultSeverityEnum.INFORMATION.ordinal()) { FhirContext ctx = theRequestDetails.getServer().getFhirContext(); outcome = OperationOutcomeUtil.newInstance(ctx); OperationOutcomeUtil.addIssue(ctx, outcome, "information", "No issues detected", "", "informational"); } if (outcome != null) { IParser parser = theRequestDetails.getServer().getFhirContext().newJsonParser().setPrettyPrint(false); String encoded = parser.encodeResourceToString(outcome); if (encoded.length() > getMaximumHeaderLength()) { encoded = encoded.substring(0, getMaximumHeaderLength() - 3) + "..."; } theRequestDetails.getResponse().addHeader(myResponseOutcomeHeaderName, encoded); } } postProcessResult(theRequestDetails, validationResult); return validationResult; } private static class MyLookup extends StrLookup<String> { private SingleValidationMessage myMessage; public MyLookup(SingleValidationMessage theMessage) { myMessage = theMessage; } @Override public String lookup(String theKey) { if ("line".equals(theKey)) { return toString(myMessage.getLocationLine()); } if ("col".equals(theKey)) { return toString(myMessage.getLocationCol()); } if ("message".equals(theKey)) { return toString(myMessage.getMessage()); } if ("location".equals(theKey)) { return toString(myMessage.getLocationString()); } if ("severity".equals(theKey)) { return myMessage.getSeverity() != null ? myMessage.getSeverity().name() : null; } return ""; } private static String toString(Object theInt) { return theInt != null ? theInt.toString() : ""; } } }
5,151
311
package io.quarkiverse.rabbitmqclient; import java.util.Properties; import org.junit.jupiter.api.Assertions; import com.rabbitmq.client.ConnectionFactoryConfigurator; import io.quarkus.runtime.TlsConfig; public abstract class RabbitMQConfigTest { protected void assertRabbitMQConfig(RabbitMQClientConfig config, TlsConfig tlsConfig, Properties properties) { Assertions.assertEquals(config.username, properties.getProperty(ConnectionFactoryConfigurator.USERNAME)); Assertions.assertEquals(config.password, properties.getProperty(ConnectionFactoryConfigurator.PASSWORD)); Assertions.assertEquals(config.virtualHost, properties.getProperty(ConnectionFactoryConfigurator.VIRTUAL_HOST)); Assertions.assertEquals(config.hostname, properties.getProperty(ConnectionFactoryConfigurator.HOST)); Assertions.assertEquals(asString(config.port), properties.getProperty(ConnectionFactoryConfigurator.PORT)); Assertions.assertEquals(asString(config.requestedChannelMax), properties.getProperty(ConnectionFactoryConfigurator.CONNECTION_CHANNEL_MAX)); Assertions.assertEquals(asString(config.requestedFrameMax), properties.getProperty(ConnectionFactoryConfigurator.CONNECTION_FRAME_MAX)); Assertions.assertEquals(asString(config.requestedHeartbeat), properties.getProperty(ConnectionFactoryConfigurator.CONNECTION_HEARTBEAT)); Assertions.assertEquals(asString(config.connectionTimeout), properties.getProperty(ConnectionFactoryConfigurator.CONNECTION_TIMEOUT)); Assertions.assertEquals(asString(config.handshakeTimeout), properties.getProperty(ConnectionFactoryConfigurator.HANDSHAKE_TIMEOUT)); Assertions.assertEquals(asString(config.shutdownTimeout), properties.getProperty(ConnectionFactoryConfigurator.SHUTDOWN_TIMEOUT)); Assertions.assertEquals(asString(config.connectionRecovery), properties.getProperty(ConnectionFactoryConfigurator.CONNECTION_RECOVERY_ENABLED)); Assertions.assertEquals(asString(config.topologyRecovery), properties.getProperty(ConnectionFactoryConfigurator.TOPOLOGY_RECOVERY_ENABLED)); Assertions.assertEquals(asString(config.networkRecoveryInterval), properties.getProperty(ConnectionFactoryConfigurator.CONNECTION_RECOVERY_INTERVAL)); Assertions.assertEquals(asString(config.channelRpcTimeout), properties.getProperty(ConnectionFactoryConfigurator.CHANNEL_RPC_TIMEOUT)); Assertions.assertEquals(asString(config.channelRpcResponseTypeCheck), properties.getProperty(ConnectionFactoryConfigurator.CHANNEL_SHOULD_CHECK_RPC_RESPONSE_TYPE)); // NIO configuration if (config.nio.enabled) { Assertions.assertEquals(asString(config.nio.threads), properties.getProperty(ConnectionFactoryConfigurator.NIO_NB_IO_THREADS)); Assertions.assertEquals(asString(config.nio.readByteBufferSize), properties.getProperty(ConnectionFactoryConfigurator.NIO_READ_BYTE_BUFFER_SIZE)); Assertions.assertEquals(asString(config.nio.writeByteBufferSize), properties.getProperty(ConnectionFactoryConfigurator.NIO_WRITE_BYTE_BUFFER_SIZE)); Assertions.assertEquals(asString(config.nio.writeQueueCapacity), properties.getProperty(ConnectionFactoryConfigurator.NIO_WRITE_QUEUE_CAPACITY)); Assertions.assertEquals(asString(config.nio.writeEnqueuingTimeout), properties.getProperty(ConnectionFactoryConfigurator.NIO_WRITE_ENQUEUING_TIMEOUT_IN_MS)); } if (config.tls.enabled) { Assertions.assertEquals(config.tls.algorithm, properties.getProperty(ConnectionFactoryConfigurator.SSL_ALGORITHM)); Assertions.assertEquals(asString(config.tls.enabled), properties.getProperty(ConnectionFactoryConfigurator.SSL_ENABLED)); if (tlsConfig.trustAll) { Assertions.assertEquals(Boolean.FALSE.toString(), properties.getProperty(ConnectionFactoryConfigurator.SSL_VALIDATE_SERVER_CERTIFICATE)); Assertions.assertEquals(Boolean.FALSE.toString(), properties.getProperty(ConnectionFactoryConfigurator.SSL_VERIFY_HOSTNAME)); } else { Assertions.assertEquals(asString(config.tls.validateServerCertificate), properties.getProperty(ConnectionFactoryConfigurator.SSL_VALIDATE_SERVER_CERTIFICATE)); Assertions.assertEquals(asString(config.tls.verifyHostname), properties.getProperty(ConnectionFactoryConfigurator.SSL_VERIFY_HOSTNAME)); Assertions.assertEquals(config.tls.keyStoreFile.orElse(null), properties.getProperty(ConnectionFactoryConfigurator.SSL_KEY_STORE)); Assertions.assertEquals(config.tls.keyStorePassword.orElse(null), properties.getProperty(ConnectionFactoryConfigurator.SSL_KEY_STORE_PASSWORD)); Assertions.assertEquals(config.tls.keyStoreType, properties.getProperty(ConnectionFactoryConfigurator.SSL_KEY_STORE_TYPE)); Assertions.assertEquals(config.tls.keyStoreAlgorithm, properties.getProperty(ConnectionFactoryConfigurator.SSL_KEY_STORE_ALGORITHM)); Assertions.assertEquals(config.tls.trustStoreFile.orElse(null), properties.getProperty(ConnectionFactoryConfigurator.SSL_TRUST_STORE)); Assertions.assertEquals(config.tls.trustStorePassword.orElse(null), properties.getProperty(ConnectionFactoryConfigurator.SSL_TRUST_STORE_PASSWORD)); Assertions.assertEquals(config.tls.trustStoreType, properties.getProperty(ConnectionFactoryConfigurator.SSL_TRUST_STORE_TYPE)); Assertions.assertEquals(config.tls.trustStoreAlgorithm, properties.getProperty(ConnectionFactoryConfigurator.SSL_TRUST_STORE_ALGORITHM)); } } // client properties Assertions.assertEquals(RabbitMQHelper.CLIENT_PROPERTY_PREFIX, properties.getProperty(ConnectionFactoryConfigurator.CLIENT_PROPERTIES_PREFIX)); config.properties.forEach((name, value) -> { Assertions.assertEquals(value, properties.getProperty(RabbitMQHelper.CLIENT_PROPERTY_PREFIX + name)); }); } private String asString(int value) { return Integer.toString(value); } private String asString(boolean value) { return Boolean.toString(value); } }
2,823
348
<gh_stars>100-1000 {"nom":"Marcillac-Vallon","circ":"1ère circonscription","dpt":"Aveyron","inscrits":1295,"abs":615,"votants":680,"blancs":51,"nuls":19,"exp":610,"res":[{"nuance":"REM","nom":"<NAME>","voix":418},{"nuance":"LR","nom":"<NAME>","voix":192}]}
101
1,144
package de.metas.handlingunits.inventory; import de.metas.document.DocBaseAndSubType; import de.metas.document.DocTypeId; import de.metas.document.DocTypeQuery; import de.metas.document.IDocTypeDAO; import de.metas.document.engine.IDocument; import de.metas.document.engine.IDocumentBL; import de.metas.handlingunits.HuId; import de.metas.handlingunits.inventory.impl.SyncInventoryQtyToHUsCommand; import de.metas.handlingunits.inventory.internaluse.HUInternalUseInventoryCreateRequest; import de.metas.handlingunits.inventory.internaluse.HUInternalUseInventoryCreateResponse; import de.metas.handlingunits.inventory.internaluse.HUInternalUseInventoryProducer; import de.metas.handlingunits.model.I_M_InventoryLine; import de.metas.handlingunits.sourcehu.SourceHUsService; import de.metas.i18n.AdMessageKey; import de.metas.inventory.AggregationType; import de.metas.inventory.HUAggregationType; import de.metas.inventory.InventoryDocSubType; import de.metas.inventory.InventoryId; import de.metas.organization.OrgId; import de.metas.product.ProductId; import de.metas.quantity.QuantitiesUOMNotMatchingExpection; import de.metas.quantity.Quantity; import de.metas.uom.UomId; import de.metas.util.Services; import de.metas.util.collections.CollectionUtils; import lombok.Getter; import lombok.NonNull; import org.adempiere.exceptions.AdempiereException; import org.adempiere.service.ClientId; import org.adempiere.warehouse.LocatorId; import org.adempiere.warehouse.api.IWarehouseBL; import org.compiere.model.I_M_Inventory; import org.compiere.util.Env; import org.springframework.stereotype.Service; import javax.annotation.Nullable; import java.math.BigDecimal; import java.util.Objects; import java.util.Optional; import java.util.stream.Stream; /* * #%L * de.metas.handlingunits.base * %% * Copyright (C) 2019 metas GmbH * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. * #L% */ @Service public class InventoryService { private final IDocTypeDAO docTypeDAO = Services.get(IDocTypeDAO.class); private final IDocumentBL documentBL = Services.get(IDocumentBL.class); private final IWarehouseBL warehouseBL = Services.get(IWarehouseBL.class); @Getter private final InventoryRepository inventoryRepository; private final SourceHUsService sourceHUsService; private static final AdMessageKey MSG_EXISTING_LINES_WITH_DIFFERENT_HU_AGGREGATION_TYPE = AdMessageKey.of("de.metas.handlingunits.inventory.ExistingLinesWithDifferentHUAggregationType"); public InventoryService(@NonNull final InventoryRepository inventoryRepository, @NonNull final SourceHUsService sourceHUsService) { this.inventoryRepository = inventoryRepository; this.sourceHUsService = sourceHUsService; } public Inventory getById(@NonNull final InventoryId inventoryId) { return inventoryRepository.getById(inventoryId); } public Inventory toInventory(@NonNull final I_M_Inventory inventoryRecord) { return inventoryRepository.toInventory(inventoryRecord); } public DocBaseAndSubType extractDocBaseAndSubTypeOrNull(final I_M_Inventory inventoryRecord) { return inventoryRepository.extractDocBaseAndSubTypeOrNull(inventoryRecord); } public boolean isMaterialDisposal(final I_M_Inventory inventory) { final DocTypeId inventoryDocTypeId = DocTypeId.ofRepoIdOrNull(inventory.getC_DocType_ID()); if(inventoryDocTypeId == null) { return false; } final DocBaseAndSubType inventoryDocBaseAndSubType = docTypeDAO.getDocBaseAndSubTypeById(inventoryDocTypeId); return InventoryDocSubType.InternalUseInventory.toDocBaseAndSubType().equals(inventoryDocBaseAndSubType); } public static HUAggregationType computeHUAggregationType(@NonNull final DocBaseAndSubType baseAndSubType) { return computeHUAggregationType(null, baseAndSubType); } public void updateHUAggregationTypeIfAllowed(@NonNull final I_M_Inventory inventoryRecord) { final Inventory inventory = inventoryRepository.toInventory(inventoryRecord); for (final InventoryLine inventoryLine : inventory.getLines()) { final HUAggregationType huAggregationType = computeHUAggregationType(inventoryLine, inventory.getDocBaseAndSubType()); inventoryLine.setHuAggregationType(huAggregationType); } inventoryRepository.saveInventoryLines(inventory); } @NonNull public DocTypeId getDocTypeIdByAggregationType( @Nullable final HUAggregationType huAggregationType, @NonNull final OrgId orgId) { final DocBaseAndSubType docBaseAndSubType = getDocBaseAndSubType(huAggregationType); return docTypeDAO.getDocTypeId(DocTypeQuery.builder() .docBaseType(docBaseAndSubType.getDocBaseType()) .docSubType(docBaseAndSubType.getDocSubType()) .adClientId(Env.getAD_Client_ID()) .adOrgId(orgId.getRepoId()) .build()); } private static HUAggregationType computeHUAggregationType( @Nullable final InventoryLine inventoryLine, @NonNull final DocBaseAndSubType baseAndSubType) { final HUAggregationType huAggregationTypeToUse = Optional .ofNullable(AggregationType.getByDocTypeOrNull(baseAndSubType)) .map(AggregationType::getHuAggregationType) .orElse(HUAggregationType.SINGLE_HU); // the default if (inventoryLine == null) { return huAggregationTypeToUse; // nothing more to check } final HUAggregationType huAggregationTypeCurrent = inventoryLine.getHuAggregationType(); if (huAggregationTypeCurrent == null) { return huAggregationTypeToUse; } else if (huAggregationTypeCurrent.equals(huAggregationTypeToUse)) { return huAggregationTypeToUse; } else if (inventoryLine.getId() == null) { return huAggregationTypeToUse; } else { // this line already has a different aggregation type throw new AdempiereException(MSG_EXISTING_LINES_WITH_DIFFERENT_HU_AGGREGATION_TYPE) .markAsUserValidationError(); } } public void setQtyBookedFromStorage(@NonNull final I_M_InventoryLine inventoryLine) { inventoryLine.setQtyBook(BigDecimal.ZERO); // mandatory ids might be missing as the I_M_InventoryLine might not be persisted yet final ProductId productId = ProductId.ofRepoIdOrNull(inventoryLine.getM_Product_ID()); final HuId huId = HuId.ofRepoIdOrNull(inventoryLine.getM_HU_ID()); final UomId uomId = UomId.ofRepoIdOrNull(inventoryLine.getC_UOM_ID()); final boolean idsAreMissing = Stream.of(productId, huId, uomId) .anyMatch(Objects::isNull); if (idsAreMissing) { return; } final Optional<Quantity> bookedQty = inventoryRepository.getFreshBookedQtyFromStorage(productId, uomId, huId); if (bookedQty.isPresent()) { if (bookedQty.get().getUomId().getRepoId() != inventoryLine.getC_UOM_ID()) { // this should never happen as InventoryRepository#getFreshBookedQtyFromStorage() returns the qty in the inventory line's uom. throw new QuantitiesUOMNotMatchingExpection("Booked and counted quantities don't have the same UOM!") .appendParametersToMessage() .setParameter("InventoryLineUOMID", inventoryLine.getC_UOM_ID()) .setParameter("BookedQtyUOMID", bookedQty.get().getUomId()); } inventoryLine.setQtyBook(bookedQty.get().toBigDecimal()); } } public void syncToHUs(@NonNull final I_M_Inventory inventoryRecord) { final Inventory inventory = inventoryRepository.toInventory(inventoryRecord); SyncInventoryQtyToHUsCommand.builder() .inventoryRepository(inventoryRepository) .sourceHUsService(sourceHUsService) .inventory(inventory) .build() // .execute(); } /** * Move products from the warehouse to garbage (waste disposal) * After this process an internal use inventory is created. */ public HUInternalUseInventoryCreateResponse moveToGarbage(@NonNull final HUInternalUseInventoryCreateRequest request) { return new HUInternalUseInventoryProducer(request).execute(); } public void completeDocument(@NonNull final InventoryId inventoryId) { final I_M_Inventory inventory = inventoryRepository.getRecordById(inventoryId); documentBL.processEx(inventory, IDocument.ACTION_Complete); } public Inventory createInventoryHeader(@NonNull final InventoryHeaderCreateRequest request) { return inventoryRepository.createInventoryHeader(request); } public void createInventoryLine(@NonNull final InventoryLineCreateRequest request) { inventoryRepository.createInventoryLine(request); } @NonNull public HuId createInventoryForMissingQty(@NonNull final CreateVirtualInventoryWithQtyReq req) { final LocatorId locatorId = warehouseBL.getDefaultLocatorId(req.getWarehouseId()); final InventoryHeaderCreateRequest createHeaderRequest = InventoryHeaderCreateRequest .builder() .orgId(req.getOrgId()) .docTypeId(getVirtualInventoryDocTypeId(req.getClientId(), req.getOrgId())) .movementDate(req.getMovementDate()) .warehouseId(req.getWarehouseId()) .build(); final InventoryId inventoryId = createInventoryHeader(createHeaderRequest).getId(); final InventoryLineCreateRequest createLineRequest = InventoryLineCreateRequest .builder() .inventoryId(inventoryId) .productId(req.getProductId()) .qtyBooked(req.getQty().toZero()) .qtyCount(req.getQty()) .attributeSetId(req.getAttributeSetInstanceId()) .locatorId(locatorId) .build(); createInventoryLine(createLineRequest); completeDocument(inventoryId); final Inventory inventory = getById(inventoryId); return CollectionUtils.singleElement(inventory.getHuIds()); } private DocTypeId getVirtualInventoryDocTypeId(@NonNull final ClientId clientId, @NonNull final OrgId orgId) { return docTypeDAO.getDocTypeId(DocTypeQuery.builder() .docBaseType(InventoryDocSubType.VirtualInventory.getDocBaseType()) .docSubType(InventoryDocSubType.VirtualInventory.getCode()) .adClientId(clientId.getRepoId()) .adOrgId(orgId.getRepoId()) .build()); } private static DocBaseAndSubType getDocBaseAndSubType(@Nullable final HUAggregationType huAggregationType) { if (huAggregationType == null) { // #10656 There is no inventory doctype without a subtype. Consider the AggregatedHUInventory as a default return AggregationType.MULTIPLE_HUS.getDocBaseAndSubType(); } else { return AggregationType.getByHUAggregationType(huAggregationType).getDocBaseAndSubType(); } } }
3,678
402
<filename>research/active_learning/archive/plot_active.py import numpy as np import matplotlib.pyplot as plt names = ['Confidence','Entropy','Informative Diverse','K-center','Margin','Margin Cluster Mean','Random'] colors= ['blue','red','green','yellow','red','purple','black'] data = np.loadtxt("all_processed.data",delimiter=",",skiprows=1) x = np.asarray(range(10,301))*100 plt.xlim(1000,30000) plt.xticks(np.arange(1000, 31000, 1000), [str(int(x/1000))+'K' for x in np.arange(1000, 31000, 1000)], rotation=90) plt.yticks(np.arange(0.78, 0.95, 0.01)) plt.xlabel("Number of Queries",fontweight='bold',fontsize=18) plt.ylabel("Accuracy",fontweight='bold',fontsize=18) for i in range(len(names)): if i!=1: plt.plot(x, data[:,i], color = colors[i], linewidth = 2, label = names[i]) plt.hlines([0.909], 0, 30000, colors=['orange'], linestyles=['dashed'], linewidth=3) plt.text(4000, 0.909 + 0.002, 'Norouzzadeh et al. 2018', fontweight='bold', fontsize=12) plt.grid(True) plt.legend(loc=4) plt.show()
414
730
// // REAppStoreController+Private.h // Retriever // // Created by cyan on 1/29/17. // Copyright © 2017 cyan. All rights reserved. // #import "REAppStoreController.h" @class HOCodeView; @class SFSafariViewController; typedef NS_ENUM(NSInteger, AESegmentType) { AESegmentTypeAffiliate = 0, AESegmentTypeWebsite }; @interface REAppStoreController () @property (nonatomic, copy) NSString *url; @property (nonatomic, copy) NSString *path; @property (nonatomic, copy) NSString *appIdentifier; @property (nonatomic, strong) UISegmentedControl *segmentedControl; @property (nonatomic, strong) UIActivityIndicatorView *indicatorView; @property (nonatomic, strong) HOCodeView *affiliateView; @property (nonatomic, strong) SFSafariViewController *safariViewController; - (void)startLoading; - (void)stopLoading; - (void)handleSegmentedControlValueChanged:(UISegmentedControl *)sender; @end
305
416
package org.simpleflatmapper.map.property; import org.simpleflatmapper.reflect.Setter; import org.simpleflatmapper.util.TypeHelper; import java.lang.reflect.Type; public class SetterProperty { private final Setter<?, ?> setter; private final Type targetType; private final Type propertyType; public SetterProperty(Setter<?, ?> setter) { this(setter, getTargetType(setter), getPropertyType(setter)); } public SetterProperty(Setter<?, ?> setter, Type targetType, Type propertyType) { this.setter = setter; this.targetType = targetType; this.propertyType = propertyType; } public Setter<?, ?> getSetter() { return setter; } public Type getTargetType() { return targetType; } @Override public String toString() { return "Setter{" + setter + "}"; } private static Type getTargetType(Setter<?, ?> setter) { Type[] types = TypeHelper.getGenericParameterForClass(setter.getClass(), Setter.class); return types != null ? types[0] : null; } private static Type getPropertyType(Setter<?, ?> setter) { Type[] types = TypeHelper.getGenericParameterForClass(setter.getClass(), Setter.class); return types != null ? types[1] : null; } public Type getPropertyType() { return propertyType; } }
515
679
<gh_stars>100-1000 /************************************************************** * * 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. * *************************************************************/ #ifndef _CONNECTIVITY_SDBCX_VIEW_HXX_ #define _CONNECTIVITY_SDBCX_VIEW_HXX_ #include <osl/diagnose.h> #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp> #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> #include <comphelper/proparrhlp.hxx> #include <cppuhelper/compbase1.hxx> #include "connectivity/CommonTools.hxx" #include <cppuhelper/interfacecontainer.h> #include <com/sun/star/container/XNamed.hpp> #include "connectivity/sdbcx/VDescriptor.hxx" #include "connectivity/dbtoolsdllapi.hxx" #include <comphelper/IdPropArrayHelper.hxx> #include <cppuhelper/implbase2.hxx> namespace connectivity { namespace sdbcx { typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::container::XNamed> OView_BASE; class OOO_DLLPUBLIC_DBTOOLS OView : public ::comphelper::OMutexAndBroadcastHelper, public OView_BASE, public ::comphelper::OIdPropertyArrayUsageHelper<OView>, public ODescriptor { protected: ::rtl::OUString m_CatalogName; ::rtl::OUString m_SchemaName; ::rtl::OUString m_Command; sal_Int32 m_CheckOption; // need for the getName method ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; // OPropertySetHelper virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); public: DECLARE_SERVICE_INFO(); OView(sal_Bool _bCase,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData); OView( sal_Bool _bCase, const ::rtl::OUString& _rName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData, sal_Int32 _nCheckOption = 0, const ::rtl::OUString& _rCommand = ::rtl::OUString(), const ::rtl::OUString& _rSchemaName = ::rtl::OUString(), const ::rtl::OUString& _rCatalogName = ::rtl::OUString()); virtual ~OView(); // ODescriptor virtual void construct(); // ::cppu::OComponentHelper virtual void SAL_CALL disposing(void); // XInterface virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL acquire() throw(); virtual void SAL_CALL release() throw(); //XTypeProvider virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); // XNamed virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setName( const ::rtl::OUString& ) throw(::com::sun::star::uno::RuntimeException); }; } } #endif // _CONNECTIVITY_SDBCX_VIEW_HXX_
1,508
1,760
<gh_stars>1000+ //if you have any questions, you can pm me on codeforces (username: golions) #include <bits/stdc++.h> using namespace std; #define MAXN 10005 struct State{ int v; //vertex long long w; //current distance }; //custom comparator for State struct CompareState{ bool operator()(State s1, State s2){ return s1.w > s2.w; } }; struct Edge{ int to; //other vertex int w; //weight }; int par[MAXN]; long long c[MAXN]; long long djik[MAXN]; //shortest distance from vertex 1 long long nums[MAXN]; //number of cows that pass through that vertex int main(){ ios::sync_with_stdio(false); cin.tie(0); ifstream fin ("shortcut.in"); ofstream fout ("shortcut.out"); int n,m; long t; fin >> n >> m >> t; for(int k = 1; k <= n; k++){ fin >> c[k]; } //build edge list for every vertex vector<vector<Edge>> adj(n+1); for(int k = 0; k < m; k++){ int a,b; long w; fin >> a >> b >> w; Edge ea {b,w}; Edge eb {a,w}; adj[a].push_back(ea); adj[b].push_back(eb); } //basic djikstra's algorithm while storing parents fill(begin(djik),end(djik),LONG_MAX); djik[1] = 0; fill(begin(par),end(par),-1); priority_queue<State,vector<State>,CompareState> pq; State s {1,0}; pq.push(s); unordered_set<int> seen; seen.insert(1); while(!pq.empty()){ State cur = pq.top(); pq.pop(); int u = cur.v; seen.insert(u); for(Edge e : adj[u]){ int v = e.to; if(seen.find(v) != seen.end()) continue; long long newdis = djik[u] + e.w; if(newdis < djik[v]){ djik[v] = newdis; par[v] = u; State next {v,newdis}; pq.push(next); } else if(newdis == djik[v]){ //ensures lexicographically shortest path if(u < par[v]){ djik[v] = newdis; par[v] = u; State next {v,newdis}; pq.push(next); } } } } for(int k = 1; k <= n; k++){ //backtrack to fill nums int i = k; while(i != -1){ nums[i] += c[k]; i = par[i]; } } long long answer = 0; for(int k = 1; k <= n; k++){ //nums[k] * (djik[k] - t) is the distance saved answer = max(answer,nums[k]*(djik[k]-t)); } cout << answer << endl; fout << answer << endl; return 0; }
1,515
679
<filename>main/cui/source/inc/hlmarkwn.hxx /************************************************************** * * 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. * *************************************************************/ #ifndef _SVX_BKWND_HYPERLINK_HXX #define _SVX_BKWND_HYPERLINK_HXX #include <com/sun/star/container/XNameAccess.hpp> #include <vcl/dialog.hxx> #ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> #endif #include <svtools/svtreebx.hxx> #include "hlmarkwn_def.hxx" //ADD CHINA001 class SvxHyperlinkTabPageBase; //######################################################################## //# # //# Tree-Window # //# # //######################################################################## class SvxHlinkDlgMarkWnd; class SvxHlmarkTreeLBox : public SvTreeListBox { private: SvxHlinkDlgMarkWnd* mpParentWnd; public: SvxHlmarkTreeLBox( Window* pParent, const ResId& rResId ); virtual void Paint( const Rectangle& rRect ); }; //######################################################################## //# # //# Window-Class # //# # //######################################################################## class SvxHlinkDlgMarkWnd : public ModalDialog //FloatingWindow { private: friend class SvxHlmarkTreeLBox; PushButton maBtApply; PushButton maBtClose; //SvTreeListBox maLbTree; SvxHlmarkTreeLBox maLbTree; sal_Bool mbUserMoved; sal_Bool mbFirst; SvxHyperlinkTabPageBase* mpParent; String maStrLastURL; sal_uInt16 mnError; protected: sal_Bool RefreshFromDoc( ::rtl::OUString aURL ); SvLBoxEntry* FindEntry ( String aStrName ); void ClearTree(); int FillTree( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xLinks, SvLBoxEntry* pParentEntry =NULL ); virtual void Move (); DECL_LINK (ClickApplyHdl_Impl, void * ); DECL_LINK (ClickCloseHdl_Impl, void * ); public: SvxHlinkDlgMarkWnd (SvxHyperlinkTabPageBase *pParent); ~SvxHlinkDlgMarkWnd(); sal_Bool MoveTo ( Point aNewPos ); void RefreshTree ( String aStrURL ); void SelectEntry ( String aStrMark ); sal_Bool ConnectToDialog( sal_Bool bDoit = sal_True ); sal_uInt16 SetError( sal_uInt16 nError); }; #endif // _SVX_BKWND_HYPERLINK_HXX
1,270
2,406
<reponame>pazamelin/openvino<gh_stars>1000+ // Copyright (C) 2018-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // #include <ie_blob.h> #include <inference_engine.hpp> #define COUNT_OF(A) (sizeof(A) / sizeof(A[0])) const char kSplitSequence[] = {'F', 'U', 'Z', 'Z', '_', 'N', 'E', 'X', 'T', '_', 'F', 'I', 'E', 'L', 'D'}; extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { size_t split_counter = 0; size_t split[1] = {0}; if (size < sizeof(kSplitSequence)) return 0; // we at least expect one separator for (size_t i = 0; i < size - sizeof(kSplitSequence); i++) if (0 == memcmp(data + i, kSplitSequence, sizeof(kSplitSequence))) { split[split_counter++] = i; if (COUNT_OF(split) <= split_counter) break; } if (COUNT_OF(split) != split_counter) return 0; // not enough splits // isolate xml data size_t net_size = split[0]; std::string net((const char*)data, net_size); size -= net_size + sizeof(kSplitSequence); data += net_size + sizeof(kSplitSequence); // isolate weights data std::vector<uint8_t> weights(data, data + size); auto weights_blob = InferenceEngine::make_shared_blob<uint8_t>(InferenceEngine::TensorDesc(InferenceEngine::Precision::U8, InferenceEngine::C), &weights[0]); size -= weights.size() + sizeof(kSplitSequence); data += weights.size() + sizeof(kSplitSequence); // read xml and set weights try { InferenceEngine::Core ie; InferenceEngine::CNNNetwork network = ie.ReadNetwork(net, weights_blob); } catch (const std::exception&) { return 0; // fail gracefully on expected exceptions } return 0; }
694
746
<gh_stars>100-1000 package org.protege.editor.owl.ui.frame.objectproperty; import org.protege.editor.owl.OWLEditorKit; import org.protege.editor.owl.ui.editor.OWLObjectEditor; import org.protege.editor.owl.ui.frame.AbstractOWLFrameSectionRow; import org.protege.editor.owl.ui.frame.OWLFrameSection; import org.semanticweb.owlapi.model.*; import java.util.Arrays; import java.util.List; /** * Author: <NAME><br> * The University Of Manchester<br> * Bio-Health Informatics Group<br> * Date: 29-Jan-2007<br><br> */ public class OWLObjectPropertyRangeFrameSectionRow extends AbstractOWLFrameSectionRow<OWLObjectProperty, OWLObjectPropertyRangeAxiom, OWLClassExpression> { public OWLObjectPropertyRangeFrameSectionRow(OWLEditorKit editorKit, OWLFrameSection<OWLObjectProperty, OWLObjectPropertyRangeAxiom, OWLClassExpression> section, OWLOntology ontology, OWLObjectProperty rootObject, OWLObjectPropertyRangeAxiom axiom) { super(editorKit, section, ontology, rootObject, axiom); } protected OWLObjectEditor<OWLClassExpression> getObjectEditor() { return getOWLEditorKit().getWorkspace().getOWLComponentFactory().getOWLClassDescriptionEditor(getAxiom().getRange(), AxiomType.OBJECT_PROPERTY_RANGE); } protected OWLObjectPropertyRangeAxiom createAxiom(OWLClassExpression editedObject) { return getOWLDataFactory().getOWLObjectPropertyRangeAxiom(getRoot(), editedObject); } /** * Gets a list of objects contained in this row. These objects * could be placed on the clip board during a copy operation, * or navigated to etc. */ public List<OWLClassExpression> getManipulatableObjects() { return Arrays.asList(getAxiom().getRange()); } }
672
765
#include <vector> int main(int argc, char **argv) { std::vector<int> a = {3, 1, 2}; return 0; // Set break point at this line. }
53
769
<reponame>Thales-RISC-V/pulpino-compliant-debug<gh_stars>100-1000 /* NIST Secure Hash Algorithm */ /* heavily modified by <NAME> <EMAIL> */ /* from <NAME>'s implementation as found in */ /* Applied Cryptography by <NAME> */ /* NIST's proposed modification to SHA of 7/11/94 may be */ /* activated by defining USE_MODIFIED_SHA */ #include "sha.h" #include "common.h" /* SHA f()-functions */ #define f1(x,y,z) ((x & y) | (~x & z)) #define f2(x,y,z) (x ^ y ^ z) #define f3(x,y,z) ((x & y) | (x & z) | (y & z)) #define f4(x,y,z) (x ^ y ^ z) /* SHA constants */ #define CONST1 0x5a827999L #define CONST2 0x6ed9eba1L #define CONST3 0x8f1bbcdcL #define CONST4 0xca62c1d6L /* 32-bit rotate */ #ifdef __LP64__ #define ROTATE_BY 64 #else /* Assume 32 bits */ #define ROTATE_BY 32 #endif #define ROT32(x,n) ((x << n) | (x >> (ROTATE_BY - n))) #define FUNC(n,i) \ temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \ E = D; D = C; C = ROT32(B,30); B = A; A = temp /* do SHA transformation */ static void sha_transform(SHA_INFO *sha_info) { int i; uint32_t temp, A, B, C, D, E, W[80]; for (i = 0; i < 16; ++i) { W[i] = sha_info->data[i]; } for (i = 16; i < 80; ++i) { W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]; } A = sha_info->digest[0]; B = sha_info->digest[1]; C = sha_info->digest[2]; D = sha_info->digest[3]; E = sha_info->digest[4]; for (i = 0; i < 20; ++i) { FUNC(1,i); } for (i = 20; i < 40; ++i) { FUNC(2,i); } for (i = 40; i < 60; ++i) { FUNC(3,i); } for (i = 60; i < 80; ++i) { FUNC(4,i); } sha_info->digest[0] += A; sha_info->digest[1] += B; sha_info->digest[2] += C; sha_info->digest[3] += D; sha_info->digest[4] += E; } #ifdef LITTLE_ENDIAN /* change endianness of data */ static void byte_reverse(uint32_t *buffer, int count) { int i; uint8_t ct[4], *cp; count /= sizeof(uint32_t); cp = (uint8_t *) buffer; for (i = 0; i < count; ++i) { ct[0] = cp[0]; ct[1] = cp[1]; ct[2] = cp[2]; ct[3] = cp[3]; cp[0] = ct[3]; cp[1] = ct[2]; cp[2] = ct[1]; cp[3] = ct[0]; cp += sizeof(uint32_t); } } #endif /* LITTLE_ENDIAN */ /* initialize the SHA digest */ void sha_init(SHA_INFO *sha_info) { sha_info->digest[0] = 0x67452301L; sha_info->digest[1] = 0xefcdab89L; sha_info->digest[2] = 0x98badcfeL; sha_info->digest[3] = 0x10325476L; sha_info->digest[4] = 0xc3d2e1f0L; sha_info->count_lo = 0L; sha_info->count_hi = 0L; for (int i = 0; i < 16; i++) { sha_info->data[i] = 0; } } /* update the SHA digest */ void sha_update(SHA_INFO *sha_info, uint8_t *buffer, int count) { if ((sha_info->count_lo + ((uint32_t) count << 3)) < sha_info->count_lo) { ++sha_info->count_hi; } sha_info->count_lo += (uint32_t) count << 3; sha_info->count_hi += (uint32_t) count >> 29; while (count >= SHA_BLOCKSIZE) { memcpy(sha_info->data, buffer, SHA_BLOCKSIZE); #ifdef LITTLE_ENDIAN byte_reverse(sha_info->data, SHA_BLOCKSIZE); #endif /* LITTLE_ENDIAN */ sha_transform(sha_info); buffer += SHA_BLOCKSIZE; count -= SHA_BLOCKSIZE; } memcpy(sha_info->data, buffer, count); } /* finish computing the SHA digest */ void sha_final(SHA_INFO *sha_info) { int count; uint32_t lo_bit_count, hi_bit_count; lo_bit_count = sha_info->count_lo; hi_bit_count = sha_info->count_hi; count = (int) ((lo_bit_count >> 3) & 0x3f); ((uint8_t *) sha_info->data)[count++] = 0x80; if (count > 56) { memset((uint8_t *) &sha_info->data + count, 0, 64 - count); #ifdef LITTLE_ENDIAN byte_reverse(sha_info->data, SHA_BLOCKSIZE); #endif /* LITTLE_ENDIAN */ sha_transform(sha_info); memset(&sha_info->data, 0, 56); } else { memset((uint8_t *) &sha_info->data + count, 0, 56 - count); } #ifdef LITTLE_ENDIAN byte_reverse(sha_info->data, SHA_BLOCKSIZE); #endif /* LITTLE_ENDIAN */ sha_info->data[14] = hi_bit_count; sha_info->data[15] = lo_bit_count; sha_transform(sha_info); }
2,052
985
package com.taobao.metamorphosis.example.spring; import com.taobao.metamorphosis.client.extension.spring.DefaultMessageListener; import com.taobao.metamorphosis.client.extension.spring.MetaqMessage; import com.taobao.metamorphosis.example.spring.messages.Trade; /** * Process trade messages listener. * * @author dennis * */ public class TradeMessageListener extends DefaultMessageListener<Trade> { @Override public void onReceiveMessages(MetaqMessage<Trade> msg) { Trade trade = msg.getBody(); System.out.println("receive trade message:" + trade); } }
195
3,301
package com.alibaba.alink.operator.common.tree.parallelcart.booster; import com.alibaba.alink.operator.common.linear.unarylossfunc.UnaryLossFunc; import com.alibaba.alink.operator.common.tree.parallelcart.BoostingObjs; import com.alibaba.alink.operator.common.tree.parallelcart.data.Slice; public class HessionBaseBooster implements Booster { final UnaryLossFunc loss; final Slice slice; final double[] gradient; final double[] hession; final double[] weights; public HessionBaseBooster( UnaryLossFunc loss, double[] weights, Slice slice) { this.loss = loss; this.weights = weights; this.slice = slice; this.gradient = new double[slice.end - slice.start]; this.hession = new double[slice.end - slice.start]; } @Override public void boosting( BoostingObjs boostingObjs, double[] label, double[] pred) { for (int i = slice.start; i < slice.end; ++i) { double eta = pred[i]; double y = label[i]; gradient[i] = loss.derivative(eta, y); hession[i] = loss.secondDerivative(eta, y); } } @Override public double[] getWeights() { return weights; } @Override public double[] getGradients() { return gradient; } @Override public double[] getHessions() { return hession; } @Override public double[] getGradientsSqr() { return null; } }
484
8,120
<gh_stars>1000+ import gym import string from gym.spaces import prng from universe.vncdriver import constants from universe.spaces import vnc_event class VNCActionSpace(gym.Space): """The space of VNC actions. You can submit a list of KeyEvents or PointerEvents. KeyEvents correspond to pressing or releasing a key. PointerEvents correspond to moving to a specific pixel, and setting the mouse buttons to some state (buttonmask is a bitmap corresponding to which buttons are down). Note that key releases work differently from click releases: keys are stateful and must be explicitly released, while the state of the mouse buttons is provided at each timestep, so you have to explicitly keep the mouse down. Attributes: keys (list<KeyEvent>): The allowed key presses buttonmasks (list<int>): The allowed buttonmasks (i.e. mouse presses) screen_shape (int, int): The X and Y dimensions of the screen """ def __init__(self, keys=None, buttonmasks=None, screen_shape=(1024, 728)): self.keys = [] if keys is None: keys = [c for c in string.printable] + list(constants.KEYMAP.keys()) for key in (keys or []): down = vnc_event.KeyEvent.by_name(key, down=True) up = vnc_event.KeyEvent.by_name(key, down=False) self.keys.append(down) self.keys.append(up) self._key_set = set(self.keys) self.screen_shape = screen_shape if self.screen_shape is not None: self.buttonmasks = [] if buttonmasks is None: buttonmasks = range(256) for buttonmask in buttonmasks: self.buttonmasks.append(buttonmask) self._buttonmask_set = set(self.buttonmasks) def contains(self, action): if not isinstance(action, list): return False for a in action: if isinstance(a, vnc_event.KeyEvent): if a not in self._key_set: return False elif isinstance(a, vnc_event.PointerEvent): if self.screen_shape is None: return False if a.x < 0 or a.x > self.screen_shape[0]: return False elif a.y < 0 or a.y > self.screen_shape[1]: return False elif a.buttonmask not in self._buttonmask_set: return False return True def sample(self): # Both key and pointer allowed if self.screen_shape is not None: event_type = prng.np_random.randint(2) else: event_type = 0 if event_type == 0: # Let's press a key key = prng.np_random.choice(self.keys) event = [key] else: x = prng.np_random.randint(self.screen_shape[0]) y = prng.np_random.randint(self.screen_shape[1]) buttonmask = prng.np_random.choice(self.buttonmasks) event = [vnc_event.PointerEvent(x, y, buttonmask)] return event
1,391
634
<filename>modules/base/vcs-impl/src/main/java/com/intellij/openapi/vcs/impl/VcsDirectoryMappingStorage.java /* * Copyright 2000-2012 JetBrains s.r.o. * * 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.intellij.openapi.vcs.impl; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; import com.intellij.openapi.vcs.ProjectLevelVcsManager; import jakarta.inject.Singleton; import org.jdom.Element; import jakarta.inject.Inject; /** * @author yole */ @State(name = "VcsDirectoryMappings", storages = @Storage("vcs.xml")) @Singleton public class VcsDirectoryMappingStorage implements PersistentStateComponent<Element> { private final ProjectLevelVcsManager myVcsManager; @Inject public VcsDirectoryMappingStorage(final ProjectLevelVcsManager vcsManager) { myVcsManager = vcsManager; } @Override public Element getState() { final Element e = new Element("state"); ((ProjectLevelVcsManagerImpl)myVcsManager).writeDirectoryMappings(e); return e; } @Override public void loadState(Element state) { ((ProjectLevelVcsManagerImpl)myVcsManager).readDirectoryMappings(state); } }
538
2,080
<filename>src/postgres/src/bin/scripts/common.h<gh_stars>1000+ /* * common.h * Common support routines for bin/scripts/ * * Copyright (c) 2003-2018, PostgreSQL Global Development Group * * src/bin/scripts/common.h */ #ifndef COMMON_H #define COMMON_H #include "common/username.h" #include "libpq-fe.h" #include "getopt_long.h" /* pgrminclude ignore */ #include "pqexpbuffer.h" /* pgrminclude ignore */ enum trivalue { TRI_DEFAULT, TRI_NO, TRI_YES }; extern bool CancelRequested; typedef void (*help_handler) (const char *progname); extern void handle_help_version_opts(int argc, char *argv[], const char *fixed_progname, help_handler hlp); extern PGconn *connectDatabase(const char *dbname, const char *pghost, const char *pgport, const char *pguser, enum trivalue prompt_password, const char *progname, bool echo, bool fail_ok, bool allow_password_reuse); extern PGconn *connectMaintenanceDatabase(const char *maintenance_db, const char *pghost, const char *pgport, const char *pguser, enum trivalue prompt_password, const char *progname, bool echo); extern PGresult *executeQuery(PGconn *conn, const char *query, const char *progname, bool echo); extern void executeCommand(PGconn *conn, const char *query, const char *progname, bool echo); extern bool executeMaintenanceCommand(PGconn *conn, const char *query, bool echo); extern void appendQualifiedRelation(PQExpBuffer buf, const char *name, PGconn *conn, const char *progname, bool echo); extern bool yesno_prompt(const char *question); extern void setup_cancel_handler(void); extern void SetCancelConn(PGconn *conn); extern void ResetCancelConn(void); #endif /* COMMON_H */
646
356
package com.elbbbird.android.socialsdk.model; import java.io.Serializable; /** * 社交平台信息 * Created by zhanghailong-ms on 2015/11/13. */ public class SocialInfo implements Serializable { private boolean debugMode = false; private String wechatAppId = ""; private String weChatAppSecret = ""; private String weChatScope = "snsapi_userinfo"; private String weiboAppKey = ""; private String weiboRedirectrUrl = "http://www.sina.com"; private String weiboScope = "email,direct_messages_read,direct_messages_write," + "friendships_groups_read,friendships_groups_write,statuses_to_me_read," + "follow_app_official_microblog," + "invitation_write"; private String qqAppId = ""; private String qqScope = "all"; public boolean isDebugMode() { return debugMode; } public void setDebugMode(boolean debugMode) { this.debugMode = debugMode; } public String getWechatAppId() { return wechatAppId; } public void setWechatAppId(String wechatAppId) { this.wechatAppId = wechatAppId; } public String getWeChatAppSecret() { return weChatAppSecret; } public void setWeChatAppSecret(String weChatAppSecret) { this.weChatAppSecret = weChatAppSecret; } public String getWeChatScope() { return weChatScope; } public void setWeChatScope(String weChatScope) { this.weChatScope = weChatScope; } public String getWeiboAppKey() { return weiboAppKey; } public void setWeiboAppKey(String weiboAppKey) { this.weiboAppKey = weiboAppKey; } public String getWeiboRedirectrUrl() { return weiboRedirectrUrl; } public void setWeiboRedirectrUrl(String weiboRedirectrUrl) { this.weiboRedirectrUrl = weiboRedirectrUrl; } public String getWeiboScope() { return weiboScope; } public void setWeiboScope(String weiboScope) { this.weiboScope = weiboScope; } public String getQqAppId() { return qqAppId; } public void setQqAppId(String qqAppId) { this.qqAppId = qqAppId; } public String getQqScope() { return qqScope; } public void setQqScope(String qqScope) { this.qqScope = qqScope; } public String getUrlForWeChatToken() { return "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + getWechatAppId() + "&secret=" + getWeChatAppSecret() + "&code=%s&grant_type=authorization_code"; } public String getUrlForWeChatUserInfo() { return "https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s"; } public String getUrlForWeChatRefreshToken() { return "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=" + getWechatAppId() + "&grant_type=refresh_token&refresh_token=%s"; } }
1,287
2,494
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/Assertions.h" #include "mozilla/BloomFilter.h" #include <stddef.h> #include <stdio.h> using mozilla::BloomFilter; class FilterChecker { public: explicit FilterChecker(uint32_t aHash) : mHash(aHash) { } uint32_t hash() const { return mHash; } private: uint32_t mHash; }; int main() { BloomFilter<12, FilterChecker>* filter = new BloomFilter<12, FilterChecker>(); MOZ_RELEASE_ASSERT(filter); FilterChecker one(1); FilterChecker two(0x20000); FilterChecker many(0x10000); FilterChecker multiple(0x20001); filter->add(&one); MOZ_RELEASE_ASSERT(filter->mightContain(&one), "Filter should contain 'one'"); MOZ_RELEASE_ASSERT(!filter->mightContain(&multiple), "Filter claims to contain 'multiple' when it should not"); MOZ_RELEASE_ASSERT(filter->mightContain(&many), "Filter should contain 'many' (false positive)"); filter->add(&two); MOZ_RELEASE_ASSERT(filter->mightContain(&multiple), "Filter should contain 'multiple' (false positive)"); // Test basic removals filter->remove(&two); MOZ_RELEASE_ASSERT(!filter->mightContain(&multiple), "Filter claims to contain 'multiple' when it should not after two " "was removed"); // Test multiple addition/removal const size_t FILTER_SIZE = 255; for (size_t i = 0; i < FILTER_SIZE - 1; ++i) { filter->add(&two); } MOZ_RELEASE_ASSERT(filter->mightContain(&multiple), "Filter should contain 'multiple' after 'two' added lots of times " "(false positive)"); for (size_t i = 0; i < FILTER_SIZE - 1; ++i) { filter->remove(&two); } MOZ_RELEASE_ASSERT(!filter->mightContain(&multiple), "Filter claims to contain 'multiple' when it should not after two " "was removed lots of times"); // Test overflowing the filter buckets for (size_t i = 0; i < FILTER_SIZE + 1; ++i) { filter->add(&two); } MOZ_RELEASE_ASSERT(filter->mightContain(&multiple), "Filter should contain 'multiple' after 'two' added lots more " "times (false positive)"); for (size_t i = 0; i < FILTER_SIZE + 1; ++i) { filter->remove(&two); } MOZ_RELEASE_ASSERT(filter->mightContain(&multiple), "Filter claims to not contain 'multiple' even though we should " "have run out of space in the buckets (false positive)"); MOZ_RELEASE_ASSERT(filter->mightContain(&two), "Filter claims to not contain 'two' even though we should have " "run out of space in the buckets (false positive)"); filter->remove(&one); MOZ_RELEASE_ASSERT(!filter->mightContain(&one), "Filter should not contain 'one', because we didn't overflow its " "bucket"); filter->clear(); MOZ_RELEASE_ASSERT(!filter->mightContain(&multiple), "clear() failed to work"); return 0; }
1,247
23,439
<gh_stars>1000+ /* * Copyright 1999-2020 Alibaba Group Holding Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.nacos.config.server.remote; import com.alibaba.nacos.api.config.remote.request.cluster.ConfigChangeClusterSyncRequest; import com.alibaba.nacos.api.config.remote.response.cluster.ConfigChangeClusterSyncResponse; import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.api.remote.request.RequestMeta; import com.alibaba.nacos.config.server.service.dump.DumpService; import com.alibaba.nacos.core.remote.RequestHandler; import com.alibaba.nacos.core.remote.control.TpsControl; import org.springframework.stereotype.Component; /** * handller to handler config change from other servers. * * @author liuzunfei * @version $Id: ConfigChangeClusterSyncRequestHandler.java, v 0.1 2020年08月11日 4:35 PM liuzunfei Exp $ */ @Component public class ConfigChangeClusterSyncRequestHandler extends RequestHandler<ConfigChangeClusterSyncRequest, ConfigChangeClusterSyncResponse> { private final DumpService dumpService; public ConfigChangeClusterSyncRequestHandler(DumpService dumpService) { this.dumpService = dumpService; } @TpsControl(pointName = "ClusterConfigChangeNotify") @Override public ConfigChangeClusterSyncResponse handle(ConfigChangeClusterSyncRequest configChangeSyncRequest, RequestMeta meta) throws NacosException { if (configChangeSyncRequest.isBeta()) { dumpService.dump(configChangeSyncRequest.getDataId(), configChangeSyncRequest.getGroup(), configChangeSyncRequest.getTenant(), configChangeSyncRequest.getLastModified(), meta.getClientIp(), true); } else { dumpService.dump(configChangeSyncRequest.getDataId(), configChangeSyncRequest.getGroup(), configChangeSyncRequest.getTenant(), configChangeSyncRequest.getLastModified(), meta.getClientIp()); } return new ConfigChangeClusterSyncResponse(); } }
867
349
<filename>ask-sdk-local-debug/src/com/amazon/ask/localdebug/constants/Constants.java package com.amazon.ask.localdebug.constants; /** * Class for constants. */ public final class Constants { /** * Private constructor. */ private Constants() { } // Constants for user provided arguments. /** * Skill entry class argument name. */ public static final String SKILL_ENTRY_CLASS_ARG_NAME = "skillStreamHandlerClass"; /** * Skill id argument name. */ public static final String SKILL_ID_ARG_NAME = "skillId"; /** * LWA client id argument name. */ public static final String ACCESS_TOKEN = "accessToken"; /** * Thread pool size argument name. */ public static final String THREAD_POOL_SIZE = "threadPoolSize"; /**` * Region argument name. */ public static final String REGION = "region"; /** * Web socket connection uri skeleton. */ public static final String CONNECT_CUSTOM_DEBUG_URI_SKELETON = "wss://%1$s/v1/skills/%2$s/stages/development/connectCustomDebugEndpoint"; // Header constants for web socket connection request. /** * Upgrade header value. */ public static final String UPGRADE_HEADER_VALUE = "websocket"; /** * Upgrade header key. */ public static final String UPGRADE_HEADER_NAME = "upgrade"; /** * Connection header value. */ public static final String CONNECTION_HEADER_VALUE = "upgrade"; /** * Authorization header key. */ public static final String AUTHORIZATION_HEADER_NAME = "authorization"; /** * Connection header key. */ public static final String CONNECTION_HEADER_NAME = "connection"; /** * Default debugging region. Defaults to North America. */ public static final String DEFAULT_REGION = "NA"; }
691
940
<reponame>rkazak/formulae.brew.sh { "token": "<PASSWORD>", "full_token": "<PASSWORD>", "tap": "homebrew/cask", "name": [ "Stems" ], "desc": "Split an audio file into individual tracks", "homepage": "https://stems.app/", "url": "https://stems-electron-releases.s3.us-east-1.amazonaws.com/Stems-0.0.1.dmg", "appcast": null, "version": "0.0.1", "versions": { }, "installed": null, "outdated": false, "sha256": "bf967bf26bfc85ff0588cdb7bfa492f6d457e295ab62068d30c22061038d5bf7", "artifacts": [ [ "Stems.app" ], { "trash": [ "~/Library/Application Support/Stems", "~/Library/Preferences/software.sunflower.stems.plist", "~/Library/Saved Application State/software.sunflower.stems.savedState" ], "signal": { } } ], "caveats": null, "depends_on": { }, "conflicts_with": null, "container": null, "auto_updates": null }
435
1,056
<filename>ide/dlight.nativeexecution/test/unit/src/org/netbeans/modules/nativeexecution/test/DummyKeyringProvider.java<gh_stars>1000+ /* * 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.netbeans.modules.nativeexecution.test; import java.util.HashMap; import java.util.Map; import org.netbeans.spi.keyring.KeyringProvider; import org.openide.util.lookup.ServiceProvider; /** * * @author <NAME> */ @ServiceProvider(service=KeyringProvider.class, position=0) public class DummyKeyringProvider implements KeyringProvider { private Map<String,char[]> cache = new HashMap<>(); @Override public boolean enabled() { return true; } @Override public char[] read(String key) { char[] copy = cache.get(key); if (copy == null) { return null; } char[] password = new char[copy.length]; System.arraycopy(copy, 0, password, 0, copy.length); return password; } @Override public void save(String key, char[] password, String description) { char[] copy = new char[password.length]; System.arraycopy(password, 0, copy, 0, password.length); cache.put(key, copy); } @Override public void delete(String key) { cache.remove(key); } }
669
416
<gh_stars>100-1000 // // AUViewController.h // Framework: CoreAudioKit // // Copyright © 2015 Apple Inc. All rights reserved. // #import <AudioUnit/AudioUnit.h> #import <Foundation/NSExtensionRequestHandling.h> #if TARGET_OS_IPHONE #import <UIKit/UIKit.h> typedef UIViewController AUViewControllerBase; #else #import <AppKit/AppKit.h> typedef NSViewController AUViewControllerBase; #endif NS_ASSUME_NONNULL_BEGIN NS_CLASS_AVAILABLE(10_11, 9_0) @interface AUViewController : AUViewControllerBase <NSExtensionRequestHandling> @end @interface AUAudioUnit (AUAudioUnit_ViewController) /*! @method requestViewControllerWithCompletionHandler: @brief Obtains an audio unit's view controller (and thereby a view). @discussion Asynchronously requests the audio unit's view controller. This method will later call the completion handler, in a thread/dispatch queue context internal to the implementation, with a view controller, or nil in the case of an audio unit without a custom view controller. */ - (void)requestViewControllerWithCompletionHandler:(void (^)(AUViewControllerBase * __nullable viewController))completionHandler; @end NS_ASSUME_NONNULL_END
365
2,542
<reponame>gridgentoo/ServiceFabricAzure // ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #include "stdafx.h" using namespace Management; using namespace BackupRestoreAgentComponent; PartitionInfoMessageBody::PartitionInfoMessageBody() { } PartitionInfoMessageBody::PartitionInfoMessageBody( wstring serviceName, Common::Guid partitionId) : serviceName_(serviceName), partitionId_(partitionId) { } PartitionInfoMessageBody::~PartitionInfoMessageBody() { }
184
323
<gh_stars>100-1000 /* * Copyright (c) 2011 <NAME> * * 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 org.xbib.io.compress.bzip2; /** * A CRC32 calculator */ public final class CRC32 { /** * A static CRC lookup table */ private static final int crc32Lookup[] = { 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; /** * The current CRC */ private int crc = 0xffffffff; /** * @return The current CRC */ public int getCRC() { return ~this.crc; } /** * Update the CRC with a single byte * * @param value The value to update the CRC with */ public void updateCRC(final int value) { final int crc = this.crc; this.crc = (crc << 8) ^ crc32Lookup[((crc >> 24) ^ value) & 0xff]; } /** * Update the CRC with a sequence of identical bytes * * @param value The value to update the CRC with * @param count The number of bytes */ public void updateCRC(final int value, int count) { int crc = this.crc; while (count-- > 0) { crc = (crc << 8) ^ crc32Lookup[((crc >> 24) ^ value) & 0xff]; } this.crc = crc; } }
3,179
407
package com.alibaba.tesla.authproxy.service.ao; import com.alibaba.tesla.authproxy.model.RolePermissionRelDO; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @Builder @NoArgsConstructor @AllArgsConstructor public class UserPermissionGetResultAO { private String tenantId; private String serviceCode; private String roleId; private String resourcePath; /** * 根据 RolePermissionRelDO 构造当前返回内容数据 * * @param permission 权限对象 * @return UserPermissionGetResultAO */ public static UserPermissionGetResultAO from(RolePermissionRelDO permission) { return UserPermissionGetResultAO.builder() .tenantId(permission.getTenantId()) .serviceCode(permission.getServiceCode()) .roleId(permission.getRoleId()) .resourcePath(permission.getResourcePath()) .build(); } }
392
364
<filename>hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseComboParamsR4Test.java package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.reindex.ResourceReindexingSvcImpl; import ca.uhn.fhir.jpa.util.SpringObjectCaster; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.mockito.ArgumentMatchers; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; import java.util.List; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public abstract class BaseComboParamsR4Test extends BaseJpaR4Test { private static final Logger ourLog = LoggerFactory.getLogger(BaseComboParamsR4Test.class); @Autowired protected ISearchParamRegistry mySearchParamRegistry; protected List<String> myMessages = new ArrayList<>(); private IInterceptorBroadcaster myInterceptorBroadcaster; @BeforeEach public void before() { myModelConfig.setDefaultSearchParamsCanBeOverridden(true); myDaoConfig.setSchedulingDisabled(true); myDaoConfig.setUniqueIndexesEnabled(true); myInterceptorBroadcaster = mock(IInterceptorBroadcaster.class); when(mySrd.getInterceptorBroadcaster()).thenReturn(myInterceptorBroadcaster); when(mySrd.getServer().getPagingProvider()).thenReturn(new DatabaseBackedPagingProvider()); when(myInterceptorBroadcaster.hasHooks(eq(Pointcut.JPA_PERFTRACE_WARNING))).thenReturn(true); when(myInterceptorBroadcaster.hasHooks(eq(Pointcut.JPA_PERFTRACE_INFO))).thenReturn(true); when(myInterceptorBroadcaster.callHooks(eq(Pointcut.JPA_PERFTRACE_INFO), ArgumentMatchers.any(HookParams.class))).thenAnswer(t -> { HookParams params = t.getArgument(1, HookParams.class); myMessages.add("INFO " + params.get(StorageProcessingMessage.class).getMessage()); return null; }); when(myInterceptorBroadcaster.callHooks(eq(Pointcut.JPA_PERFTRACE_WARNING), ArgumentMatchers.any(HookParams.class))).thenAnswer(t -> { HookParams params = t.getArgument(1, HookParams.class); myMessages.add("WARN " + params.get(StorageProcessingMessage.class).getMessage()); return null; }); when(myInterceptorBroadcaster.callHooks(eq(Pointcut.JPA_PERFTRACE_SEARCH_REUSING_CACHED), ArgumentMatchers.any(HookParams.class))).thenAnswer(t -> { HookParams params = t.getArgument(1, HookParams.class); myMessages.add("REUSING CACHED SEARCH"); return null; }); } @AfterEach public void after() throws Exception { myModelConfig.setDefaultSearchParamsCanBeOverridden(new ModelConfig().isDefaultSearchParamsCanBeOverridden()); myDaoConfig.setUniqueIndexesCheckedBeforeSave(new DaoConfig().isUniqueIndexesCheckedBeforeSave()); myDaoConfig.setSchedulingDisabled(new DaoConfig().isSchedulingDisabled()); myDaoConfig.setUniqueIndexesEnabled(new DaoConfig().isUniqueIndexesEnabled()); myDaoConfig.setReindexThreadCount(new DaoConfig().getReindexThreadCount()); ResourceReindexingSvcImpl svc = SpringObjectCaster.getTargetObject(myResourceReindexingSvc, ResourceReindexingSvcImpl.class); svc.initExecutor(); } protected void logCapturedMessages() { ourLog.info("Messages:\n {}", String.join("\n ", myMessages)); } }
1,347
1,481
<gh_stars>1000+ package apoc.periodic; import org.neo4j.common.DependencyResolver; import org.neo4j.internal.helpers.collection.Iterators; import org.neo4j.kernel.api.exceptions.Status; import org.neo4j.kernel.impl.api.KernelTransactions; import org.neo4j.kernel.internal.GraphDatabaseAPI; import org.neo4j.test.rule.DbmsRule; import java.util.Map; import static apoc.util.TestUtil.testResult; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; public class PeriodicTestUtils { public static void killPeriodicQueryAsync(DbmsRule db) { new Thread(() -> { int retries = 10; try { while (retries-- > 0 && !terminateQuery("apoc.periodic", db)) { Thread.sleep(10); } } catch (InterruptedException e) { // ignore } }).start(); } public static boolean terminateQuery(String pattern, GraphDatabaseAPI db) { DependencyResolver dependencyResolver = db.getDependencyResolver(); KernelTransactions kernelTransactions = dependencyResolver.resolveDependency(KernelTransactions.class); long numberOfKilledTransactions = kernelTransactions.activeTransactions().stream() .filter(kernelTransactionHandle -> kernelTransactionHandle.executingQuery().map(query -> query.rawQueryText().contains(pattern)) .orElse(false) ) .map(kernelTransactionHandle -> kernelTransactionHandle.markForTermination(Status.Transaction.Terminated)) .count(); return numberOfKilledTransactions > 0; } public static void testTerminatePeriodicQuery(DbmsRule db, String periodicQuery) { killPeriodicQueryAsync(db); try { testResult(db, periodicQuery, result -> { Map<String, Object> row = Iterators.single(result); assertEquals( periodicQuery + " result: " + row.toString(), true, row.get("wasTerminated")); }); fail("Should have terminated"); } catch(Exception tfe) { assertEquals(tfe.getMessage(),true, tfe.getMessage().contains("terminated")); } } }
962
854
__________________________________________________________________________________________________ sample 16 ms submission class Solution: def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: if not p and not q: return True if not (p and q): return False if p.val == q.val and self.isSameTree(p.left, q.left) and self.isSameTree(p.right,q.right): return True return False __________________________________________________________________________________________________ sample 13004 kb submission # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: queue = [(p, q)] while queue: node1, node2 = queue.pop(0) if not node1 and not node2: continue elif None in [node1, node2]: return False else: if node1.val != node2.val: return False queue.append((node1.left, node2.left)) queue.append((node1.right, node2.right)) return True __________________________________________________________________________________________________
525
358
<filename>ds_utils/colaboratory_utils.py # Utils for Google Colaboratory (https://colab.research.google.com) # Install the PyDrive wrapper & import libraries. # This only needs to be done once per notebook. #!pip install -U -q PyDrive from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials from googleapiclient.http import MediaFileUpload from googleapiclient.discovery import build def get_authenticated_drive_client(): """ Authenticate and create the PyDrive client. This only needs to be done once per notebook. :return: """ auth.authenticate_user() gauth = GoogleAuth() gauth.credentials = GoogleCredentials.get_application_default() drive_client = GoogleDrive(gauth) return drive_client def get_drive_service(): """ Create in order to export file to Drive :return: """ drive_service = build('drive', 'v3') return drive_service def import_file(drive_client, file_id, filepath): """ Download a file based on its file ID. :param drive_client: :param file_id: :param filepath: :return: """ downloaded = drive_client.CreateFile({'id': file_id}) downloaded.GetContentFile(filepath) # TODO check difference with export_file def upload_file(drive_client, filename, filepath): """ Upload file to Drive. :param drive_client: :return: """ uploaded = drive_client.CreateFile( {'title': filename, 'mimetype': 'text/plain'}) uploaded.SetContentFile(filepath) uploaded.Upload() print('Uploaded file with ID {}'.format(uploaded.get('id'))) def export_file(drive_service, filename, filepath, folder_id=None): """ Export a file to Drive :param folder_id: ID of the Drive folder where to insert the file :param drive_service: :param filepath: :param filename: :return: """ file_metadata = { 'name': filename } if folder_id: file_metadata['parents'] = [folder_id] media = MediaFileUpload(filepath, mimetype='text/plain', resumable=True) created = drive_service.files().create(body=file_metadata, media_body=media, fields='id').execute() print('Exported file with ID {}'.format(created.get('id')))
959
663
<filename>solr/tests/test_check.py # (C) Datadog, Inc. 2020-present # All rights reserved # Licensed under Simplified BSD License (see LICENSE) import pytest from datadog_checks.base.stubs.aggregator import AggregatorStub from datadog_checks.dev.jmx import JVM_E2E_METRICS_NEW from datadog_checks.dev.utils import get_metadata_metrics from .common import SOLR_METRICS @pytest.mark.e2e def test_e2e(dd_agent_check): instance = {} aggregator = dd_agent_check(instance, rate=True) # type: AggregatorStub for metric in SOLR_METRICS + JVM_E2E_METRICS_NEW: aggregator.assert_metric(metric) aggregator.assert_all_metrics_covered() aggregator.assert_metrics_using_metadata(get_metadata_metrics(), exclude=JVM_E2E_METRICS_NEW)
290
475
[ { "outputFile": "handlebars/error.js", "inputFile": "handlebars/error.hbs", "includeInProject": true, "minify": { } } ]
62
1,958
<gh_stars>1000+ package com.freetymekiyan.algorithms.level.medium; import org.testng.Assert; import org.testng.annotations.Test; public class ImplementTrieTest { @Test public void testInsert() { ImplementTrie.Trie trie = new ImplementTrie.Trie(); trie.insert(null); trie.insert("key"); trie.insert("ke"); trie.insert("kevin"); trie.insert("kiyan"); } @Test public void testStartsWith() { ImplementTrie.Trie trie = new ImplementTrie.Trie(); Assert.assertFalse(trie.startsWith(null)); Assert.assertTrue(trie.startsWith("")); trie.insert("key"); Assert.assertTrue(trie.startsWith("")); Assert.assertTrue(trie.startsWith("ke")); Assert.assertFalse(trie.startsWith("ka")); Assert.assertTrue(trie.startsWith("key")); Assert.assertFalse(trie.startsWith("keys")); trie.insert("ke"); Assert.assertTrue(trie.startsWith("ke")); Assert.assertFalse(trie.startsWith("search")); } @Test public void testSearch() { ImplementTrie.Trie trie = new ImplementTrie.Trie(); Assert.assertFalse(trie.search(null)); Assert.assertFalse(trie.search("")); Assert.assertFalse(trie.search("key")); trie.insert("key"); Assert.assertTrue(trie.search("key")); Assert.assertFalse(trie.search("ke")); trie.insert("kevin"); Assert.assertFalse(trie.search("ke")); Assert.assertTrue(trie.search("key")); Assert.assertTrue(trie.search("kevin")); trie.insert("kiyan"); Assert.assertFalse(trie.search("ke")); Assert.assertTrue(trie.search("kiyan")); trie.insert("ke"); Assert.assertTrue(trie.search("ke")); } }
824
376
#pragma once #include <Register/Utility.hpp> namespace Kvasir { //Programmable Peripheral Interconnect namespace PpiChen{ ///<Channel enable register using Addr = Register::Address<0x4001f500,0x00000000,0x00000000,unsigned>; ///Enable or disable channel 0 enum class Ch0Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Ch0Val> ch0{}; namespace Ch0ValC{ constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::enabled> enabled{}; } ///Enable or disable channel 1 enum class Ch1Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Ch1Val> ch1{}; namespace Ch1ValC{ constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::enabled> enabled{}; } ///Enable or disable channel 2 enum class Ch2Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Ch2Val> ch2{}; namespace Ch2ValC{ constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::enabled> enabled{}; } ///Enable or disable channel 3 enum class Ch3Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Ch3Val> ch3{}; namespace Ch3ValC{ constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::enabled> enabled{}; } ///Enable or disable channel 4 enum class Ch4Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Ch4Val> ch4{}; namespace Ch4ValC{ constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::enabled> enabled{}; } ///Enable or disable channel 5 enum class Ch5Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Ch5Val> ch5{}; namespace Ch5ValC{ constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::enabled> enabled{}; } ///Enable or disable channel 6 enum class Ch6Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,Ch6Val> ch6{}; namespace Ch6ValC{ constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::enabled> enabled{}; } ///Enable or disable channel 7 enum class Ch7Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,Ch7Val> ch7{}; namespace Ch7ValC{ constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::enabled> enabled{}; } ///Enable or disable channel 8 enum class Ch8Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,Ch8Val> ch8{}; namespace Ch8ValC{ constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::enabled> enabled{}; } ///Enable or disable channel 9 enum class Ch9Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,Ch9Val> ch9{}; namespace Ch9ValC{ constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::enabled> enabled{}; } ///Enable or disable channel 10 enum class Ch10Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,Ch10Val> ch10{}; namespace Ch10ValC{ constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::enabled> enabled{}; } ///Enable or disable channel 11 enum class Ch11Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,Ch11Val> ch11{}; namespace Ch11ValC{ constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::enabled> enabled{}; } ///Enable or disable channel 12 enum class Ch12Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,Ch12Val> ch12{}; namespace Ch12ValC{ constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::enabled> enabled{}; } ///Enable or disable channel 13 enum class Ch13Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,Ch13Val> ch13{}; namespace Ch13ValC{ constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::enabled> enabled{}; } ///Enable or disable channel 14 enum class Ch14Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,Ch14Val> ch14{}; namespace Ch14ValC{ constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::enabled> enabled{}; } ///Enable or disable channel 15 enum class Ch15Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,Ch15Val> ch15{}; namespace Ch15ValC{ constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::enabled> enabled{}; } ///Enable or disable channel 16 enum class Ch16Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,Ch16Val> ch16{}; namespace Ch16ValC{ constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::enabled> enabled{}; } ///Enable or disable channel 17 enum class Ch17Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,Ch17Val> ch17{}; namespace Ch17ValC{ constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::enabled> enabled{}; } ///Enable or disable channel 18 enum class Ch18Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,Ch18Val> ch18{}; namespace Ch18ValC{ constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::enabled> enabled{}; } ///Enable or disable channel 19 enum class Ch19Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,Ch19Val> ch19{}; namespace Ch19ValC{ constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::enabled> enabled{}; } ///Enable or disable channel 20 enum class Ch20Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,Ch20Val> ch20{}; namespace Ch20ValC{ constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::enabled> enabled{}; } ///Enable or disable channel 21 enum class Ch21Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,Ch21Val> ch21{}; namespace Ch21ValC{ constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::enabled> enabled{}; } ///Enable or disable channel 22 enum class Ch22Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,Ch22Val> ch22{}; namespace Ch22ValC{ constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::enabled> enabled{}; } ///Enable or disable channel 23 enum class Ch23Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,Ch23Val> ch23{}; namespace Ch23ValC{ constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::enabled> enabled{}; } ///Enable or disable channel 24 enum class Ch24Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,Ch24Val> ch24{}; namespace Ch24ValC{ constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::enabled> enabled{}; } ///Enable or disable channel 25 enum class Ch25Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,Ch25Val> ch25{}; namespace Ch25ValC{ constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::enabled> enabled{}; } ///Enable or disable channel 26 enum class Ch26Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,Ch26Val> ch26{}; namespace Ch26ValC{ constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::enabled> enabled{}; } ///Enable or disable channel 27 enum class Ch27Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,Ch27Val> ch27{}; namespace Ch27ValC{ constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::enabled> enabled{}; } ///Enable or disable channel 28 enum class Ch28Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,Ch28Val> ch28{}; namespace Ch28ValC{ constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::enabled> enabled{}; } ///Enable or disable channel 29 enum class Ch29Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,Ch29Val> ch29{}; namespace Ch29ValC{ constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::enabled> enabled{}; } ///Enable or disable channel 30 enum class Ch30Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,Ch30Val> ch30{}; namespace Ch30ValC{ constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::enabled> enabled{}; } ///Enable or disable channel 31 enum class Ch31Val { disabled=0x00000000, ///<Disable channel enabled=0x00000001, ///<Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,Ch31Val> ch31{}; namespace Ch31ValC{ constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::enabled> enabled{}; } } namespace PpiChenset{ ///<Channel enable set register using Addr = Register::Address<0x4001f504,0x00000000,0x00000000,unsigned>; ///Channel 0 enable set register. Writing '0' has no effect enum class Ch0Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Ch0Val> ch0{}; namespace Ch0ValC{ constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::set> set{}; } ///Channel 1 enable set register. Writing '0' has no effect enum class Ch1Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Ch1Val> ch1{}; namespace Ch1ValC{ constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::set> set{}; } ///Channel 2 enable set register. Writing '0' has no effect enum class Ch2Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Ch2Val> ch2{}; namespace Ch2ValC{ constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::set> set{}; } ///Channel 3 enable set register. Writing '0' has no effect enum class Ch3Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Ch3Val> ch3{}; namespace Ch3ValC{ constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::set> set{}; } ///Channel 4 enable set register. Writing '0' has no effect enum class Ch4Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Ch4Val> ch4{}; namespace Ch4ValC{ constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::set> set{}; } ///Channel 5 enable set register. Writing '0' has no effect enum class Ch5Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Ch5Val> ch5{}; namespace Ch5ValC{ constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::set> set{}; } ///Channel 6 enable set register. Writing '0' has no effect enum class Ch6Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,Ch6Val> ch6{}; namespace Ch6ValC{ constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::set> set{}; } ///Channel 7 enable set register. Writing '0' has no effect enum class Ch7Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,Ch7Val> ch7{}; namespace Ch7ValC{ constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::set> set{}; } ///Channel 8 enable set register. Writing '0' has no effect enum class Ch8Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,Ch8Val> ch8{}; namespace Ch8ValC{ constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::set> set{}; } ///Channel 9 enable set register. Writing '0' has no effect enum class Ch9Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,Ch9Val> ch9{}; namespace Ch9ValC{ constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::set> set{}; } ///Channel 10 enable set register. Writing '0' has no effect enum class Ch10Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,Ch10Val> ch10{}; namespace Ch10ValC{ constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::set> set{}; } ///Channel 11 enable set register. Writing '0' has no effect enum class Ch11Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,Ch11Val> ch11{}; namespace Ch11ValC{ constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::set> set{}; } ///Channel 12 enable set register. Writing '0' has no effect enum class Ch12Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,Ch12Val> ch12{}; namespace Ch12ValC{ constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::set> set{}; } ///Channel 13 enable set register. Writing '0' has no effect enum class Ch13Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,Ch13Val> ch13{}; namespace Ch13ValC{ constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::set> set{}; } ///Channel 14 enable set register. Writing '0' has no effect enum class Ch14Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,Ch14Val> ch14{}; namespace Ch14ValC{ constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::set> set{}; } ///Channel 15 enable set register. Writing '0' has no effect enum class Ch15Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,Ch15Val> ch15{}; namespace Ch15ValC{ constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::set> set{}; } ///Channel 16 enable set register. Writing '0' has no effect enum class Ch16Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,Ch16Val> ch16{}; namespace Ch16ValC{ constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::set> set{}; } ///Channel 17 enable set register. Writing '0' has no effect enum class Ch17Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,Ch17Val> ch17{}; namespace Ch17ValC{ constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::set> set{}; } ///Channel 18 enable set register. Writing '0' has no effect enum class Ch18Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,Ch18Val> ch18{}; namespace Ch18ValC{ constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::set> set{}; } ///Channel 19 enable set register. Writing '0' has no effect enum class Ch19Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,Ch19Val> ch19{}; namespace Ch19ValC{ constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::set> set{}; } ///Channel 20 enable set register. Writing '0' has no effect enum class Ch20Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,Ch20Val> ch20{}; namespace Ch20ValC{ constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::set> set{}; } ///Channel 21 enable set register. Writing '0' has no effect enum class Ch21Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,Ch21Val> ch21{}; namespace Ch21ValC{ constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::set> set{}; } ///Channel 22 enable set register. Writing '0' has no effect enum class Ch22Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,Ch22Val> ch22{}; namespace Ch22ValC{ constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::set> set{}; } ///Channel 23 enable set register. Writing '0' has no effect enum class Ch23Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,Ch23Val> ch23{}; namespace Ch23ValC{ constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::set> set{}; } ///Channel 24 enable set register. Writing '0' has no effect enum class Ch24Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,Ch24Val> ch24{}; namespace Ch24ValC{ constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::set> set{}; } ///Channel 25 enable set register. Writing '0' has no effect enum class Ch25Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,Ch25Val> ch25{}; namespace Ch25ValC{ constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::set> set{}; } ///Channel 26 enable set register. Writing '0' has no effect enum class Ch26Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,Ch26Val> ch26{}; namespace Ch26ValC{ constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::set> set{}; } ///Channel 27 enable set register. Writing '0' has no effect enum class Ch27Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,Ch27Val> ch27{}; namespace Ch27ValC{ constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::set> set{}; } ///Channel 28 enable set register. Writing '0' has no effect enum class Ch28Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,Ch28Val> ch28{}; namespace Ch28ValC{ constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::set> set{}; } ///Channel 29 enable set register. Writing '0' has no effect enum class Ch29Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,Ch29Val> ch29{}; namespace Ch29ValC{ constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::set> set{}; } ///Channel 30 enable set register. Writing '0' has no effect enum class Ch30Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,Ch30Val> ch30{}; namespace Ch30ValC{ constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::set> set{}; } ///Channel 31 enable set register. Writing '0' has no effect enum class Ch31Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled set=0x00000001, ///<Write: Enable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,Ch31Val> ch31{}; namespace Ch31ValC{ constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::set> set{}; } } namespace PpiChenclr{ ///<Channel enable clear register using Addr = Register::Address<0x4001f508,0x00000000,0x00000000,unsigned>; ///Channel 0 enable clear register. Writing '0' has no effect enum class Ch0Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Ch0Val> ch0{}; namespace Ch0ValC{ constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::clear> clear{}; } ///Channel 1 enable clear register. Writing '0' has no effect enum class Ch1Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Ch1Val> ch1{}; namespace Ch1ValC{ constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::clear> clear{}; } ///Channel 2 enable clear register. Writing '0' has no effect enum class Ch2Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Ch2Val> ch2{}; namespace Ch2ValC{ constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::clear> clear{}; } ///Channel 3 enable clear register. Writing '0' has no effect enum class Ch3Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Ch3Val> ch3{}; namespace Ch3ValC{ constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::clear> clear{}; } ///Channel 4 enable clear register. Writing '0' has no effect enum class Ch4Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Ch4Val> ch4{}; namespace Ch4ValC{ constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::clear> clear{}; } ///Channel 5 enable clear register. Writing '0' has no effect enum class Ch5Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Ch5Val> ch5{}; namespace Ch5ValC{ constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::clear> clear{}; } ///Channel 6 enable clear register. Writing '0' has no effect enum class Ch6Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,Ch6Val> ch6{}; namespace Ch6ValC{ constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::clear> clear{}; } ///Channel 7 enable clear register. Writing '0' has no effect enum class Ch7Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,Ch7Val> ch7{}; namespace Ch7ValC{ constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::clear> clear{}; } ///Channel 8 enable clear register. Writing '0' has no effect enum class Ch8Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,Ch8Val> ch8{}; namespace Ch8ValC{ constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::clear> clear{}; } ///Channel 9 enable clear register. Writing '0' has no effect enum class Ch9Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,Ch9Val> ch9{}; namespace Ch9ValC{ constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::clear> clear{}; } ///Channel 10 enable clear register. Writing '0' has no effect enum class Ch10Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,Ch10Val> ch10{}; namespace Ch10ValC{ constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::clear> clear{}; } ///Channel 11 enable clear register. Writing '0' has no effect enum class Ch11Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,Ch11Val> ch11{}; namespace Ch11ValC{ constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::clear> clear{}; } ///Channel 12 enable clear register. Writing '0' has no effect enum class Ch12Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,Ch12Val> ch12{}; namespace Ch12ValC{ constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::clear> clear{}; } ///Channel 13 enable clear register. Writing '0' has no effect enum class Ch13Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,Ch13Val> ch13{}; namespace Ch13ValC{ constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::clear> clear{}; } ///Channel 14 enable clear register. Writing '0' has no effect enum class Ch14Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,Ch14Val> ch14{}; namespace Ch14ValC{ constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::clear> clear{}; } ///Channel 15 enable clear register. Writing '0' has no effect enum class Ch15Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,Ch15Val> ch15{}; namespace Ch15ValC{ constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::clear> clear{}; } ///Channel 16 enable clear register. Writing '0' has no effect enum class Ch16Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,Ch16Val> ch16{}; namespace Ch16ValC{ constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::clear> clear{}; } ///Channel 17 enable clear register. Writing '0' has no effect enum class Ch17Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,Ch17Val> ch17{}; namespace Ch17ValC{ constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::clear> clear{}; } ///Channel 18 enable clear register. Writing '0' has no effect enum class Ch18Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,Ch18Val> ch18{}; namespace Ch18ValC{ constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::clear> clear{}; } ///Channel 19 enable clear register. Writing '0' has no effect enum class Ch19Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,Ch19Val> ch19{}; namespace Ch19ValC{ constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::clear> clear{}; } ///Channel 20 enable clear register. Writing '0' has no effect enum class Ch20Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,Ch20Val> ch20{}; namespace Ch20ValC{ constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::clear> clear{}; } ///Channel 21 enable clear register. Writing '0' has no effect enum class Ch21Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,Ch21Val> ch21{}; namespace Ch21ValC{ constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::clear> clear{}; } ///Channel 22 enable clear register. Writing '0' has no effect enum class Ch22Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,Ch22Val> ch22{}; namespace Ch22ValC{ constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::clear> clear{}; } ///Channel 23 enable clear register. Writing '0' has no effect enum class Ch23Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,Ch23Val> ch23{}; namespace Ch23ValC{ constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::clear> clear{}; } ///Channel 24 enable clear register. Writing '0' has no effect enum class Ch24Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,Ch24Val> ch24{}; namespace Ch24ValC{ constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::clear> clear{}; } ///Channel 25 enable clear register. Writing '0' has no effect enum class Ch25Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,Ch25Val> ch25{}; namespace Ch25ValC{ constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::clear> clear{}; } ///Channel 26 enable clear register. Writing '0' has no effect enum class Ch26Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,Ch26Val> ch26{}; namespace Ch26ValC{ constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::clear> clear{}; } ///Channel 27 enable clear register. Writing '0' has no effect enum class Ch27Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,Ch27Val> ch27{}; namespace Ch27ValC{ constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::clear> clear{}; } ///Channel 28 enable clear register. Writing '0' has no effect enum class Ch28Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,Ch28Val> ch28{}; namespace Ch28ValC{ constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::clear> clear{}; } ///Channel 29 enable clear register. Writing '0' has no effect enum class Ch29Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,Ch29Val> ch29{}; namespace Ch29ValC{ constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::clear> clear{}; } ///Channel 30 enable clear register. Writing '0' has no effect enum class Ch30Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,Ch30Val> ch30{}; namespace Ch30ValC{ constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::clear> clear{}; } ///Channel 31 enable clear register. Writing '0' has no effect enum class Ch31Val { disabled=0x00000000, ///<Read: channel disabled enabled=0x00000001, ///<Read: channel enabled clear=0x00000001, ///<Write: disable channel }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,Ch31Val> ch31{}; namespace Ch31ValC{ constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::disabled> disabled{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::enabled> enabled{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::clear> clear{}; } } namespace PpiChg0{ ///<Description collection[0]: Channel group 0 using Addr = Register::Address<0x4001f800,0x00000000,0x00000000,unsigned>; ///Include or exclude channel 0 enum class Ch0Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Ch0Val> ch0{}; namespace Ch0ValC{ constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::included> included{}; } ///Include or exclude channel 1 enum class Ch1Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Ch1Val> ch1{}; namespace Ch1ValC{ constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::included> included{}; } ///Include or exclude channel 2 enum class Ch2Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Ch2Val> ch2{}; namespace Ch2ValC{ constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::included> included{}; } ///Include or exclude channel 3 enum class Ch3Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Ch3Val> ch3{}; namespace Ch3ValC{ constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::included> included{}; } ///Include or exclude channel 4 enum class Ch4Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Ch4Val> ch4{}; namespace Ch4ValC{ constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::included> included{}; } ///Include or exclude channel 5 enum class Ch5Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Ch5Val> ch5{}; namespace Ch5ValC{ constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::included> included{}; } ///Include or exclude channel 6 enum class Ch6Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,Ch6Val> ch6{}; namespace Ch6ValC{ constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::included> included{}; } ///Include or exclude channel 7 enum class Ch7Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,Ch7Val> ch7{}; namespace Ch7ValC{ constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::included> included{}; } ///Include or exclude channel 8 enum class Ch8Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,Ch8Val> ch8{}; namespace Ch8ValC{ constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::included> included{}; } ///Include or exclude channel 9 enum class Ch9Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,Ch9Val> ch9{}; namespace Ch9ValC{ constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::included> included{}; } ///Include or exclude channel 10 enum class Ch10Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,Ch10Val> ch10{}; namespace Ch10ValC{ constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::included> included{}; } ///Include or exclude channel 11 enum class Ch11Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,Ch11Val> ch11{}; namespace Ch11ValC{ constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::included> included{}; } ///Include or exclude channel 12 enum class Ch12Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,Ch12Val> ch12{}; namespace Ch12ValC{ constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::included> included{}; } ///Include or exclude channel 13 enum class Ch13Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,Ch13Val> ch13{}; namespace Ch13ValC{ constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::included> included{}; } ///Include or exclude channel 14 enum class Ch14Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,Ch14Val> ch14{}; namespace Ch14ValC{ constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::included> included{}; } ///Include or exclude channel 15 enum class Ch15Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,Ch15Val> ch15{}; namespace Ch15ValC{ constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::included> included{}; } ///Include or exclude channel 16 enum class Ch16Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,Ch16Val> ch16{}; namespace Ch16ValC{ constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::included> included{}; } ///Include or exclude channel 17 enum class Ch17Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,Ch17Val> ch17{}; namespace Ch17ValC{ constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::included> included{}; } ///Include or exclude channel 18 enum class Ch18Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,Ch18Val> ch18{}; namespace Ch18ValC{ constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::included> included{}; } ///Include or exclude channel 19 enum class Ch19Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,Ch19Val> ch19{}; namespace Ch19ValC{ constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::included> included{}; } ///Include or exclude channel 20 enum class Ch20Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,Ch20Val> ch20{}; namespace Ch20ValC{ constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::included> included{}; } ///Include or exclude channel 21 enum class Ch21Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,Ch21Val> ch21{}; namespace Ch21ValC{ constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::included> included{}; } ///Include or exclude channel 22 enum class Ch22Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,Ch22Val> ch22{}; namespace Ch22ValC{ constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::included> included{}; } ///Include or exclude channel 23 enum class Ch23Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,Ch23Val> ch23{}; namespace Ch23ValC{ constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::included> included{}; } ///Include or exclude channel 24 enum class Ch24Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,Ch24Val> ch24{}; namespace Ch24ValC{ constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::included> included{}; } ///Include or exclude channel 25 enum class Ch25Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,Ch25Val> ch25{}; namespace Ch25ValC{ constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::included> included{}; } ///Include or exclude channel 26 enum class Ch26Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,Ch26Val> ch26{}; namespace Ch26ValC{ constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::included> included{}; } ///Include or exclude channel 27 enum class Ch27Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,Ch27Val> ch27{}; namespace Ch27ValC{ constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::included> included{}; } ///Include or exclude channel 28 enum class Ch28Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,Ch28Val> ch28{}; namespace Ch28ValC{ constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::included> included{}; } ///Include or exclude channel 29 enum class Ch29Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,Ch29Val> ch29{}; namespace Ch29ValC{ constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::included> included{}; } ///Include or exclude channel 30 enum class Ch30Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,Ch30Val> ch30{}; namespace Ch30ValC{ constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::included> included{}; } ///Include or exclude channel 31 enum class Ch31Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,Ch31Val> ch31{}; namespace Ch31ValC{ constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::included> included{}; } } namespace PpiChg1{ ///<Description collection[0]: Channel group 0 using Addr = Register::Address<0x4001f804,0x00000000,0x00000000,unsigned>; ///Include or exclude channel 0 enum class Ch0Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Ch0Val> ch0{}; namespace Ch0ValC{ constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::included> included{}; } ///Include or exclude channel 1 enum class Ch1Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Ch1Val> ch1{}; namespace Ch1ValC{ constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::included> included{}; } ///Include or exclude channel 2 enum class Ch2Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Ch2Val> ch2{}; namespace Ch2ValC{ constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::included> included{}; } ///Include or exclude channel 3 enum class Ch3Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Ch3Val> ch3{}; namespace Ch3ValC{ constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::included> included{}; } ///Include or exclude channel 4 enum class Ch4Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Ch4Val> ch4{}; namespace Ch4ValC{ constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::included> included{}; } ///Include or exclude channel 5 enum class Ch5Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Ch5Val> ch5{}; namespace Ch5ValC{ constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::included> included{}; } ///Include or exclude channel 6 enum class Ch6Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,Ch6Val> ch6{}; namespace Ch6ValC{ constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::included> included{}; } ///Include or exclude channel 7 enum class Ch7Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,Ch7Val> ch7{}; namespace Ch7ValC{ constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::included> included{}; } ///Include or exclude channel 8 enum class Ch8Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,Ch8Val> ch8{}; namespace Ch8ValC{ constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::included> included{}; } ///Include or exclude channel 9 enum class Ch9Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,Ch9Val> ch9{}; namespace Ch9ValC{ constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::included> included{}; } ///Include or exclude channel 10 enum class Ch10Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,Ch10Val> ch10{}; namespace Ch10ValC{ constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::included> included{}; } ///Include or exclude channel 11 enum class Ch11Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,Ch11Val> ch11{}; namespace Ch11ValC{ constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::included> included{}; } ///Include or exclude channel 12 enum class Ch12Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,Ch12Val> ch12{}; namespace Ch12ValC{ constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::included> included{}; } ///Include or exclude channel 13 enum class Ch13Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,Ch13Val> ch13{}; namespace Ch13ValC{ constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::included> included{}; } ///Include or exclude channel 14 enum class Ch14Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,Ch14Val> ch14{}; namespace Ch14ValC{ constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::included> included{}; } ///Include or exclude channel 15 enum class Ch15Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,Ch15Val> ch15{}; namespace Ch15ValC{ constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::included> included{}; } ///Include or exclude channel 16 enum class Ch16Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,Ch16Val> ch16{}; namespace Ch16ValC{ constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::included> included{}; } ///Include or exclude channel 17 enum class Ch17Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,Ch17Val> ch17{}; namespace Ch17ValC{ constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::included> included{}; } ///Include or exclude channel 18 enum class Ch18Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,Ch18Val> ch18{}; namespace Ch18ValC{ constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::included> included{}; } ///Include or exclude channel 19 enum class Ch19Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,Ch19Val> ch19{}; namespace Ch19ValC{ constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::included> included{}; } ///Include or exclude channel 20 enum class Ch20Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,Ch20Val> ch20{}; namespace Ch20ValC{ constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::included> included{}; } ///Include or exclude channel 21 enum class Ch21Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,Ch21Val> ch21{}; namespace Ch21ValC{ constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::included> included{}; } ///Include or exclude channel 22 enum class Ch22Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,Ch22Val> ch22{}; namespace Ch22ValC{ constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::included> included{}; } ///Include or exclude channel 23 enum class Ch23Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,Ch23Val> ch23{}; namespace Ch23ValC{ constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::included> included{}; } ///Include or exclude channel 24 enum class Ch24Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,Ch24Val> ch24{}; namespace Ch24ValC{ constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::included> included{}; } ///Include or exclude channel 25 enum class Ch25Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,Ch25Val> ch25{}; namespace Ch25ValC{ constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::included> included{}; } ///Include or exclude channel 26 enum class Ch26Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,Ch26Val> ch26{}; namespace Ch26ValC{ constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::included> included{}; } ///Include or exclude channel 27 enum class Ch27Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,Ch27Val> ch27{}; namespace Ch27ValC{ constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::included> included{}; } ///Include or exclude channel 28 enum class Ch28Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,Ch28Val> ch28{}; namespace Ch28ValC{ constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::included> included{}; } ///Include or exclude channel 29 enum class Ch29Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,Ch29Val> ch29{}; namespace Ch29ValC{ constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::included> included{}; } ///Include or exclude channel 30 enum class Ch30Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,Ch30Val> ch30{}; namespace Ch30ValC{ constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::included> included{}; } ///Include or exclude channel 31 enum class Ch31Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,Ch31Val> ch31{}; namespace Ch31ValC{ constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::included> included{}; } } namespace PpiChg2{ ///<Description collection[0]: Channel group 0 using Addr = Register::Address<0x4001f808,0x00000000,0x00000000,unsigned>; ///Include or exclude channel 0 enum class Ch0Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Ch0Val> ch0{}; namespace Ch0ValC{ constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::included> included{}; } ///Include or exclude channel 1 enum class Ch1Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Ch1Val> ch1{}; namespace Ch1ValC{ constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::included> included{}; } ///Include or exclude channel 2 enum class Ch2Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Ch2Val> ch2{}; namespace Ch2ValC{ constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::included> included{}; } ///Include or exclude channel 3 enum class Ch3Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Ch3Val> ch3{}; namespace Ch3ValC{ constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::included> included{}; } ///Include or exclude channel 4 enum class Ch4Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Ch4Val> ch4{}; namespace Ch4ValC{ constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::included> included{}; } ///Include or exclude channel 5 enum class Ch5Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Ch5Val> ch5{}; namespace Ch5ValC{ constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::included> included{}; } ///Include or exclude channel 6 enum class Ch6Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,Ch6Val> ch6{}; namespace Ch6ValC{ constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::included> included{}; } ///Include or exclude channel 7 enum class Ch7Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,Ch7Val> ch7{}; namespace Ch7ValC{ constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::included> included{}; } ///Include or exclude channel 8 enum class Ch8Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,Ch8Val> ch8{}; namespace Ch8ValC{ constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::included> included{}; } ///Include or exclude channel 9 enum class Ch9Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,Ch9Val> ch9{}; namespace Ch9ValC{ constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::included> included{}; } ///Include or exclude channel 10 enum class Ch10Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,Ch10Val> ch10{}; namespace Ch10ValC{ constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::included> included{}; } ///Include or exclude channel 11 enum class Ch11Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,Ch11Val> ch11{}; namespace Ch11ValC{ constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::included> included{}; } ///Include or exclude channel 12 enum class Ch12Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,Ch12Val> ch12{}; namespace Ch12ValC{ constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::included> included{}; } ///Include or exclude channel 13 enum class Ch13Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,Ch13Val> ch13{}; namespace Ch13ValC{ constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::included> included{}; } ///Include or exclude channel 14 enum class Ch14Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,Ch14Val> ch14{}; namespace Ch14ValC{ constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::included> included{}; } ///Include or exclude channel 15 enum class Ch15Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,Ch15Val> ch15{}; namespace Ch15ValC{ constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::included> included{}; } ///Include or exclude channel 16 enum class Ch16Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,Ch16Val> ch16{}; namespace Ch16ValC{ constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::included> included{}; } ///Include or exclude channel 17 enum class Ch17Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,Ch17Val> ch17{}; namespace Ch17ValC{ constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::included> included{}; } ///Include or exclude channel 18 enum class Ch18Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,Ch18Val> ch18{}; namespace Ch18ValC{ constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::included> included{}; } ///Include or exclude channel 19 enum class Ch19Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,Ch19Val> ch19{}; namespace Ch19ValC{ constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::included> included{}; } ///Include or exclude channel 20 enum class Ch20Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,Ch20Val> ch20{}; namespace Ch20ValC{ constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::included> included{}; } ///Include or exclude channel 21 enum class Ch21Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,Ch21Val> ch21{}; namespace Ch21ValC{ constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::included> included{}; } ///Include or exclude channel 22 enum class Ch22Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,Ch22Val> ch22{}; namespace Ch22ValC{ constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::included> included{}; } ///Include or exclude channel 23 enum class Ch23Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,Ch23Val> ch23{}; namespace Ch23ValC{ constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::included> included{}; } ///Include or exclude channel 24 enum class Ch24Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,Ch24Val> ch24{}; namespace Ch24ValC{ constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::included> included{}; } ///Include or exclude channel 25 enum class Ch25Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,Ch25Val> ch25{}; namespace Ch25ValC{ constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::included> included{}; } ///Include or exclude channel 26 enum class Ch26Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,Ch26Val> ch26{}; namespace Ch26ValC{ constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::included> included{}; } ///Include or exclude channel 27 enum class Ch27Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,Ch27Val> ch27{}; namespace Ch27ValC{ constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::included> included{}; } ///Include or exclude channel 28 enum class Ch28Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,Ch28Val> ch28{}; namespace Ch28ValC{ constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::included> included{}; } ///Include or exclude channel 29 enum class Ch29Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,Ch29Val> ch29{}; namespace Ch29ValC{ constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::included> included{}; } ///Include or exclude channel 30 enum class Ch30Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,Ch30Val> ch30{}; namespace Ch30ValC{ constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::included> included{}; } ///Include or exclude channel 31 enum class Ch31Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,Ch31Val> ch31{}; namespace Ch31ValC{ constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::included> included{}; } } namespace PpiChg3{ ///<Description collection[0]: Channel group 0 using Addr = Register::Address<0x4001f80c,0x00000000,0x00000000,unsigned>; ///Include or exclude channel 0 enum class Ch0Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Ch0Val> ch0{}; namespace Ch0ValC{ constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::included> included{}; } ///Include or exclude channel 1 enum class Ch1Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Ch1Val> ch1{}; namespace Ch1ValC{ constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::included> included{}; } ///Include or exclude channel 2 enum class Ch2Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Ch2Val> ch2{}; namespace Ch2ValC{ constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::included> included{}; } ///Include or exclude channel 3 enum class Ch3Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Ch3Val> ch3{}; namespace Ch3ValC{ constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::included> included{}; } ///Include or exclude channel 4 enum class Ch4Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Ch4Val> ch4{}; namespace Ch4ValC{ constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::included> included{}; } ///Include or exclude channel 5 enum class Ch5Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Ch5Val> ch5{}; namespace Ch5ValC{ constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::included> included{}; } ///Include or exclude channel 6 enum class Ch6Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,Ch6Val> ch6{}; namespace Ch6ValC{ constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::included> included{}; } ///Include or exclude channel 7 enum class Ch7Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,Ch7Val> ch7{}; namespace Ch7ValC{ constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::included> included{}; } ///Include or exclude channel 8 enum class Ch8Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,Ch8Val> ch8{}; namespace Ch8ValC{ constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::included> included{}; } ///Include or exclude channel 9 enum class Ch9Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,Ch9Val> ch9{}; namespace Ch9ValC{ constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::included> included{}; } ///Include or exclude channel 10 enum class Ch10Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,Ch10Val> ch10{}; namespace Ch10ValC{ constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::included> included{}; } ///Include or exclude channel 11 enum class Ch11Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,Ch11Val> ch11{}; namespace Ch11ValC{ constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::included> included{}; } ///Include or exclude channel 12 enum class Ch12Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,Ch12Val> ch12{}; namespace Ch12ValC{ constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::included> included{}; } ///Include or exclude channel 13 enum class Ch13Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,Ch13Val> ch13{}; namespace Ch13ValC{ constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::included> included{}; } ///Include or exclude channel 14 enum class Ch14Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,Ch14Val> ch14{}; namespace Ch14ValC{ constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::included> included{}; } ///Include or exclude channel 15 enum class Ch15Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,Ch15Val> ch15{}; namespace Ch15ValC{ constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::included> included{}; } ///Include or exclude channel 16 enum class Ch16Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,Ch16Val> ch16{}; namespace Ch16ValC{ constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::included> included{}; } ///Include or exclude channel 17 enum class Ch17Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,Ch17Val> ch17{}; namespace Ch17ValC{ constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::included> included{}; } ///Include or exclude channel 18 enum class Ch18Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,Ch18Val> ch18{}; namespace Ch18ValC{ constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::included> included{}; } ///Include or exclude channel 19 enum class Ch19Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,Ch19Val> ch19{}; namespace Ch19ValC{ constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::included> included{}; } ///Include or exclude channel 20 enum class Ch20Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,Ch20Val> ch20{}; namespace Ch20ValC{ constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::included> included{}; } ///Include or exclude channel 21 enum class Ch21Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,Ch21Val> ch21{}; namespace Ch21ValC{ constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::included> included{}; } ///Include or exclude channel 22 enum class Ch22Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,Ch22Val> ch22{}; namespace Ch22ValC{ constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::included> included{}; } ///Include or exclude channel 23 enum class Ch23Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,Ch23Val> ch23{}; namespace Ch23ValC{ constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::included> included{}; } ///Include or exclude channel 24 enum class Ch24Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,Ch24Val> ch24{}; namespace Ch24ValC{ constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::included> included{}; } ///Include or exclude channel 25 enum class Ch25Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,Ch25Val> ch25{}; namespace Ch25ValC{ constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::included> included{}; } ///Include or exclude channel 26 enum class Ch26Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,Ch26Val> ch26{}; namespace Ch26ValC{ constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::included> included{}; } ///Include or exclude channel 27 enum class Ch27Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,Ch27Val> ch27{}; namespace Ch27ValC{ constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::included> included{}; } ///Include or exclude channel 28 enum class Ch28Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,Ch28Val> ch28{}; namespace Ch28ValC{ constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::included> included{}; } ///Include or exclude channel 29 enum class Ch29Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,Ch29Val> ch29{}; namespace Ch29ValC{ constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::included> included{}; } ///Include or exclude channel 30 enum class Ch30Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,Ch30Val> ch30{}; namespace Ch30ValC{ constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::included> included{}; } ///Include or exclude channel 31 enum class Ch31Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,Ch31Val> ch31{}; namespace Ch31ValC{ constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::included> included{}; } } namespace PpiChg4{ ///<Description collection[0]: Channel group 0 using Addr = Register::Address<0x4001f810,0x00000000,0x00000000,unsigned>; ///Include or exclude channel 0 enum class Ch0Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Ch0Val> ch0{}; namespace Ch0ValC{ constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::included> included{}; } ///Include or exclude channel 1 enum class Ch1Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Ch1Val> ch1{}; namespace Ch1ValC{ constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::included> included{}; } ///Include or exclude channel 2 enum class Ch2Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Ch2Val> ch2{}; namespace Ch2ValC{ constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::included> included{}; } ///Include or exclude channel 3 enum class Ch3Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Ch3Val> ch3{}; namespace Ch3ValC{ constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::included> included{}; } ///Include or exclude channel 4 enum class Ch4Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Ch4Val> ch4{}; namespace Ch4ValC{ constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::included> included{}; } ///Include or exclude channel 5 enum class Ch5Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Ch5Val> ch5{}; namespace Ch5ValC{ constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::included> included{}; } ///Include or exclude channel 6 enum class Ch6Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,Ch6Val> ch6{}; namespace Ch6ValC{ constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::included> included{}; } ///Include or exclude channel 7 enum class Ch7Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,Ch7Val> ch7{}; namespace Ch7ValC{ constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::included> included{}; } ///Include or exclude channel 8 enum class Ch8Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,Ch8Val> ch8{}; namespace Ch8ValC{ constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::included> included{}; } ///Include or exclude channel 9 enum class Ch9Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,Ch9Val> ch9{}; namespace Ch9ValC{ constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::included> included{}; } ///Include or exclude channel 10 enum class Ch10Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,Ch10Val> ch10{}; namespace Ch10ValC{ constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::included> included{}; } ///Include or exclude channel 11 enum class Ch11Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,Ch11Val> ch11{}; namespace Ch11ValC{ constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::included> included{}; } ///Include or exclude channel 12 enum class Ch12Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,Ch12Val> ch12{}; namespace Ch12ValC{ constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::included> included{}; } ///Include or exclude channel 13 enum class Ch13Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,Ch13Val> ch13{}; namespace Ch13ValC{ constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::included> included{}; } ///Include or exclude channel 14 enum class Ch14Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,Ch14Val> ch14{}; namespace Ch14ValC{ constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::included> included{}; } ///Include or exclude channel 15 enum class Ch15Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,Ch15Val> ch15{}; namespace Ch15ValC{ constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::included> included{}; } ///Include or exclude channel 16 enum class Ch16Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,Ch16Val> ch16{}; namespace Ch16ValC{ constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::included> included{}; } ///Include or exclude channel 17 enum class Ch17Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,Ch17Val> ch17{}; namespace Ch17ValC{ constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::included> included{}; } ///Include or exclude channel 18 enum class Ch18Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,Ch18Val> ch18{}; namespace Ch18ValC{ constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::included> included{}; } ///Include or exclude channel 19 enum class Ch19Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,Ch19Val> ch19{}; namespace Ch19ValC{ constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::included> included{}; } ///Include or exclude channel 20 enum class Ch20Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,Ch20Val> ch20{}; namespace Ch20ValC{ constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::included> included{}; } ///Include or exclude channel 21 enum class Ch21Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,Ch21Val> ch21{}; namespace Ch21ValC{ constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::included> included{}; } ///Include or exclude channel 22 enum class Ch22Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,Ch22Val> ch22{}; namespace Ch22ValC{ constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::included> included{}; } ///Include or exclude channel 23 enum class Ch23Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,Ch23Val> ch23{}; namespace Ch23ValC{ constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::included> included{}; } ///Include or exclude channel 24 enum class Ch24Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,Ch24Val> ch24{}; namespace Ch24ValC{ constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::included> included{}; } ///Include or exclude channel 25 enum class Ch25Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,Ch25Val> ch25{}; namespace Ch25ValC{ constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::included> included{}; } ///Include or exclude channel 26 enum class Ch26Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,Ch26Val> ch26{}; namespace Ch26ValC{ constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::included> included{}; } ///Include or exclude channel 27 enum class Ch27Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,Ch27Val> ch27{}; namespace Ch27ValC{ constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::included> included{}; } ///Include or exclude channel 28 enum class Ch28Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,Ch28Val> ch28{}; namespace Ch28ValC{ constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::included> included{}; } ///Include or exclude channel 29 enum class Ch29Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,Ch29Val> ch29{}; namespace Ch29ValC{ constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::included> included{}; } ///Include or exclude channel 30 enum class Ch30Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,Ch30Val> ch30{}; namespace Ch30ValC{ constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::included> included{}; } ///Include or exclude channel 31 enum class Ch31Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,Ch31Val> ch31{}; namespace Ch31ValC{ constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::included> included{}; } } namespace PpiChg5{ ///<Description collection[0]: Channel group 0 using Addr = Register::Address<0x4001f814,0x00000000,0x00000000,unsigned>; ///Include or exclude channel 0 enum class Ch0Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Ch0Val> ch0{}; namespace Ch0ValC{ constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch0)::Type,Ch0Val::included> included{}; } ///Include or exclude channel 1 enum class Ch1Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Ch1Val> ch1{}; namespace Ch1ValC{ constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch1)::Type,Ch1Val::included> included{}; } ///Include or exclude channel 2 enum class Ch2Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Ch2Val> ch2{}; namespace Ch2ValC{ constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch2)::Type,Ch2Val::included> included{}; } ///Include or exclude channel 3 enum class Ch3Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Ch3Val> ch3{}; namespace Ch3ValC{ constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch3)::Type,Ch3Val::included> included{}; } ///Include or exclude channel 4 enum class Ch4Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Ch4Val> ch4{}; namespace Ch4ValC{ constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch4)::Type,Ch4Val::included> included{}; } ///Include or exclude channel 5 enum class Ch5Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Ch5Val> ch5{}; namespace Ch5ValC{ constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch5)::Type,Ch5Val::included> included{}; } ///Include or exclude channel 6 enum class Ch6Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,Ch6Val> ch6{}; namespace Ch6ValC{ constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch6)::Type,Ch6Val::included> included{}; } ///Include or exclude channel 7 enum class Ch7Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,Ch7Val> ch7{}; namespace Ch7ValC{ constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch7)::Type,Ch7Val::included> included{}; } ///Include or exclude channel 8 enum class Ch8Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,Ch8Val> ch8{}; namespace Ch8ValC{ constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch8)::Type,Ch8Val::included> included{}; } ///Include or exclude channel 9 enum class Ch9Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,Ch9Val> ch9{}; namespace Ch9ValC{ constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch9)::Type,Ch9Val::included> included{}; } ///Include or exclude channel 10 enum class Ch10Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,Ch10Val> ch10{}; namespace Ch10ValC{ constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch10)::Type,Ch10Val::included> included{}; } ///Include or exclude channel 11 enum class Ch11Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,Ch11Val> ch11{}; namespace Ch11ValC{ constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch11)::Type,Ch11Val::included> included{}; } ///Include or exclude channel 12 enum class Ch12Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,Ch12Val> ch12{}; namespace Ch12ValC{ constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch12)::Type,Ch12Val::included> included{}; } ///Include or exclude channel 13 enum class Ch13Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,Ch13Val> ch13{}; namespace Ch13ValC{ constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch13)::Type,Ch13Val::included> included{}; } ///Include or exclude channel 14 enum class Ch14Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,Ch14Val> ch14{}; namespace Ch14ValC{ constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch14)::Type,Ch14Val::included> included{}; } ///Include or exclude channel 15 enum class Ch15Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,Ch15Val> ch15{}; namespace Ch15ValC{ constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch15)::Type,Ch15Val::included> included{}; } ///Include or exclude channel 16 enum class Ch16Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,Ch16Val> ch16{}; namespace Ch16ValC{ constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch16)::Type,Ch16Val::included> included{}; } ///Include or exclude channel 17 enum class Ch17Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,Ch17Val> ch17{}; namespace Ch17ValC{ constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch17)::Type,Ch17Val::included> included{}; } ///Include or exclude channel 18 enum class Ch18Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,Ch18Val> ch18{}; namespace Ch18ValC{ constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch18)::Type,Ch18Val::included> included{}; } ///Include or exclude channel 19 enum class Ch19Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,Ch19Val> ch19{}; namespace Ch19ValC{ constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch19)::Type,Ch19Val::included> included{}; } ///Include or exclude channel 20 enum class Ch20Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,Ch20Val> ch20{}; namespace Ch20ValC{ constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch20)::Type,Ch20Val::included> included{}; } ///Include or exclude channel 21 enum class Ch21Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,Ch21Val> ch21{}; namespace Ch21ValC{ constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch21)::Type,Ch21Val::included> included{}; } ///Include or exclude channel 22 enum class Ch22Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,Ch22Val> ch22{}; namespace Ch22ValC{ constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch22)::Type,Ch22Val::included> included{}; } ///Include or exclude channel 23 enum class Ch23Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,Ch23Val> ch23{}; namespace Ch23ValC{ constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch23)::Type,Ch23Val::included> included{}; } ///Include or exclude channel 24 enum class Ch24Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,Ch24Val> ch24{}; namespace Ch24ValC{ constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch24)::Type,Ch24Val::included> included{}; } ///Include or exclude channel 25 enum class Ch25Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,Ch25Val> ch25{}; namespace Ch25ValC{ constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch25)::Type,Ch25Val::included> included{}; } ///Include or exclude channel 26 enum class Ch26Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,Ch26Val> ch26{}; namespace Ch26ValC{ constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch26)::Type,Ch26Val::included> included{}; } ///Include or exclude channel 27 enum class Ch27Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,Ch27Val> ch27{}; namespace Ch27ValC{ constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch27)::Type,Ch27Val::included> included{}; } ///Include or exclude channel 28 enum class Ch28Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,Ch28Val> ch28{}; namespace Ch28ValC{ constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch28)::Type,Ch28Val::included> included{}; } ///Include or exclude channel 29 enum class Ch29Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,Ch29Val> ch29{}; namespace Ch29ValC{ constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch29)::Type,Ch29Val::included> included{}; } ///Include or exclude channel 30 enum class Ch30Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,Ch30Val> ch30{}; namespace Ch30ValC{ constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch30)::Type,Ch30Val::included> included{}; } ///Include or exclude channel 31 enum class Ch31Val { excluded=0x00000000, ///<Exclude included=0x00000001, ///<Include }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,Ch31Val> ch31{}; namespace Ch31ValC{ constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::excluded> excluded{}; constexpr Register::FieldValue<decltype(ch31)::Type,Ch31Val::included> included{}; } } }
72,471
3,182
<filename>test-manual/src/main/java/de/plushnikov/builder/BuilderRename.java<gh_stars>1000+ package de.plushnikov.builder; import lombok.Builder; @Builder public class BuilderRename { private String name; public static void main(String[] args) { BuilderRename test = BuilderRename.builder().name("Test").build(); System.out.println(test.toString()); } }
124
665
<reponame>dsp-testing/isis<filename>core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/mixin/MixinFacetAbstract_Test.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.isis.core.metamodel.facets.object.mixin; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import lombok.SneakyThrows; import lombok.val; class MixinFacetAbstract_Test { public abstract static class Collection_numberOfChildren { public Collection_numberOfChildren(Object contributee) {} public int prop() { return 0; } } public static class SimpleObject {} public static class SimpleObject_numberOfChildren extends Collection_numberOfChildren { public SimpleObject_numberOfChildren(SimpleObject contributee) { super(contributee); } } @Nested class isCandidateForMain { @SneakyThrows @Test public void happy_case() { // given val constructor = Collection_numberOfChildren.class.getConstructor(Object.class); val facet = new MixinFacetAbstract( Collection_numberOfChildren.class, "prop", constructor, null) {}; val propMethodInSubclass = SimpleObject_numberOfChildren.class.getMethod("prop"); // when val candidate = facet.isCandidateForMain(propMethodInSubclass); // then Assertions.assertThat(candidate).isTrue(); } } }
787
2,835
"""Docstring in public module.""" # import unittest import os import sys import mock from mock import Mock, patch from tornado.httpclient import AsyncHTTPClient # from tornado.options import options from tornado.testing import AsyncHTTPTestCase APP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) sys.path.append(os.path.join(APP_ROOT, "..")) class TestMain(AsyncHTTPTestCase): """Docstring in public class.""" def setUp(self): super(TestMain, self).setUp() self.client = AsyncHTTPClient(force_instance=True) def get_app(self): from consoleme import __main__ self.__main__ = __main__ app = self.__main__.main() return app @patch("consoleme.__main__.asyncio.get_event_loop") def test_main(self, mock_ioloop): """Docstring in public method.""" self.__main__.app = Mock() self.__main__.app.listen = Mock() with patch.object(self.__main__, "main", return_value=42): with patch.object(self.__main__, "__name__", "__main__"): self.__main__.config = {} mock_ioloop.run_forever = mock.Mock() mock_ioloop.add_handler = mock.Mock() mock_ioloop.start = mock.Mock() self.__main__.init() class TestHealth(AsyncHTTPTestCase): def get_app(self): from consoleme.routes import make_app return make_app(jwt_validator=lambda x: {}) def test_health(self): """Docstring in public method.""" response = self.fetch("/healthcheck", method="GET", follow_redirects=False) self.assertEqual(b"OK", response.body)
705
2,863
<gh_stars>1000+ # Copyright 2019 The dm_control 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. # ============================================================================ """Walkers based on an actuated jumping ball.""" import enum import os from dm_control.locomotion.walkers import cmu_humanoid import numpy as np _ASSETS_PATH = os.path.join(os.path.dirname(__file__), 'assets', 'humanoid') _MAX_WALKER_ID = 10 _INVALID_WALKER_ID = 'walker_id must be in [0-{}], got: {{}}.'.format( _MAX_WALKER_ID) _INTERIOR_GEOMS = frozenset({ 'lhipjoint', 'rhipjoint', 'lfemur', 'lowerback', 'upperback', 'rclavicle', 'lclavicle', 'thorax', 'lhumerus', 'root_geom', 'lowerneck', 'rhumerus', 'rfemur' }) def _add_visual_only_geoms(mjcf_root): """Introduce visual only geoms to complement the `JERSEY` visual.""" lowerneck = mjcf_root.find('body', 'lowerneck') neck_offset = 0.066 - 0.0452401 lowerneck.add( 'geom', name='halfneck', # shrink neck radius from 0.06 to 0.05 else it pokes through shirt size=(0.05, 0.02279225 - neck_offset), pos=(-0.00165071, 0.0452401 + neck_offset, 0.00534359), quat=(0.66437, 0.746906, 0.027253, 0), mass=0., contype=0, conaffinity=0, rgba=(.7, .5, .3, 1)) lhumerus = mjcf_root.find('body', 'lhumerus') humerus_offset = 0.20 - 0.138421 lhumerus.add( 'geom', name='lelbow', size=(0.035, 0.1245789 - humerus_offset), pos=(0.0, -0.138421 - humerus_offset, 0.0), quat=(0.612372, -0.612372, 0.353553, 0.353553), mass=0., contype=0, conaffinity=0, rgba=(.7, .5, .3, 1)) rhumerus = mjcf_root.find('body', 'rhumerus') humerus_offset = 0.20 - 0.138421 rhumerus.add( 'geom', name='relbow', size=(0.035, 0.1245789 - humerus_offset), pos=(0.0, -0.138421 - humerus_offset, 0.0), quat=(0.612372, -0.612372, -0.353553, -0.353553), mass=0., contype=0, conaffinity=0, rgba=(.7, .5, .3, 1)) lfemur = mjcf_root.find('body', 'lfemur') femur_offset = 0.384 - 0.202473 lfemur.add( 'geom', name='lknee', # shrink knee radius from 0.06 to 0.055 else it pokes through short size=(0.055, 0.1822257 - femur_offset), pos=(-5.0684e-08, -0.202473 - femur_offset, 0), quat=(0.696364, -0.696364, -0.122788, -0.122788), mass=0., contype=0, conaffinity=0, rgba=(.7, .5, .3, 1)) rfemur = mjcf_root.find('body', 'rfemur') femur_offset = 0.384 - 0.202473 rfemur.add( 'geom', name='rknee', # shrink knee radius from 0.06 to 0.055 else it pokes through short size=(0.055, 0.1822257 - femur_offset), pos=(-5.0684e-08, -0.202473 - femur_offset, 0), quat=(0.696364, -0.696364, 0.122788, 0.122788), mass=0., contype=0, conaffinity=0, rgba=(.7, .5, .3, 1)) class Humanoid(cmu_humanoid.CMUHumanoidPositionControlled): """A CMU humanoid walker specialised visually for soccer.""" class Visual(enum.Enum): GEOM = 1 JERSEY = 2 def _build(self, visual, marker_rgba, walker_id=None, initializer=None, name='walker'): """Build a soccer-specific Humanoid walker.""" if not isinstance(visual, Humanoid.Visual): raise ValueError('`visual` must be one of `Humanoid.Visual`.') if len(marker_rgba) != 4: raise ValueError('`marker_rgba` must be a sequence of length 4.') if walker_id is None and visual != Humanoid.Visual.GEOM: raise ValueError( '`walker_id` must be set unless `visual` is set to `Visual.GEOM`.') if walker_id is not None and not 0 <= walker_id <= _MAX_WALKER_ID: raise ValueError(_INVALID_WALKER_ID.format(walker_id)) if visual == Humanoid.Visual.JERSEY: team = 'R' if marker_rgba[0] > marker_rgba[2] else 'B' marker_rgba = None # disable geom coloring for None geom visual. else: marker_rgba[-1] = .7 super(Humanoid, self)._build( marker_rgba=marker_rgba, initializer=initializer, include_face=True) self._mjcf_root.model = name # Changes to humanoid geoms for visual improvements. # Hands: hide hand geoms and add slightly larger visual geoms. for hand_name in ['lhand', 'rhand']: hand = self._mjcf_root.find('body', hand_name) for geom in hand.find_all('geom'): geom.rgba = (0, 0, 0, 0) if geom.name == hand_name: geom_size = geom.size * 1.3 # Palm rescaling. else: geom_size = geom.size * 1.5 # Finger rescaling. geom.parent.add( 'geom', name=geom.name + '_visual', type=geom.type, quat=geom.quat, mass=0, contype=0, conaffinity=0, size=geom_size, pos=geom.pos * 1.5) # Lighting: remove tracking light as we have multiple walkers in the scene. tracking_light = self._mjcf_root.find('light', 'tracking_light') tracking_light.remove() if visual == Humanoid.Visual.JERSEY: shirt_number = walker_id + 1 self._mjcf_root.asset.add( 'texture', name='skin', type='2d', file=os.path.join(_ASSETS_PATH, f'{team}_{walker_id + 1:02d}.png')) self._mjcf_root.asset.add('material', name='skin', texture='skin') self._mjcf_root.asset.add( 'skin', name='skin', file=os.path.join(_ASSETS_PATH, 'jersey.skn'), material='skin') for geom in self._mjcf_root.find_all('geom'): if geom.name in _INTERIOR_GEOMS: geom.rgba = (0.0, 0.0, 0.0, 0.0) _add_visual_only_geoms(self._mjcf_root) # Initialize previous action. self._prev_action = np.zeros(shape=self.action_spec.shape, dtype=self.action_spec.dtype) @property def marker_geoms(self): """Returns a sequence of marker geoms to be colored visually.""" marker_geoms = [] face = self._mjcf_root.find('geom', 'face') if face is not None: marker_geoms.append(face) marker_geoms += self._mjcf_root.find('body', 'rfoot').find_all('geom') marker_geoms += self._mjcf_root.find('body', 'lfoot').find_all('geom') return marker_geoms + [ self._mjcf_root.find('geom', 'lowerneck'), self._mjcf_root.find('geom', 'lclavicle'), self._mjcf_root.find('geom', 'rclavicle'), self._mjcf_root.find('geom', 'thorax'), self._mjcf_root.find('geom', 'upperback'), self._mjcf_root.find('geom', 'lowerback'), self._mjcf_root.find('geom', 'rfemur'), self._mjcf_root.find('geom', 'lfemur'), self._mjcf_root.find('geom', 'root_geom'), ] def initialize_episode(self, physics, random_state): self._prev_action = np.zeros(shape=self.action_spec.shape, dtype=self.action_spec.dtype) def apply_action(self, physics, action, random_state): super().apply_action(physics, action, random_state) # Updates previous action. self._prev_action[:] = action @property def prev_action(self): return self._prev_action
3,549
348
<reponame>chamberone/Leaflet.PixiOverlay {"nom":"<NAME>","circ":"2ème circonscription","dpt":"Charente","inscrits":282,"abs":143,"votants":139,"blancs":16,"nuls":0,"exp":123,"res":[{"nuance":"REM","nom":"<NAME>","voix":67},{"nuance":"LR","nom":"<NAME>","voix":56}]}
108
455
<reponame>amit-git/karyon package netflix.karyon.transport.http.health; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.http.HttpResponseStatus; import io.reactivex.netty.protocol.http.server.HttpServerRequest; import io.reactivex.netty.protocol.http.server.HttpServerResponse; import io.reactivex.netty.protocol.http.server.RequestHandler; import netflix.karyon.health.HealthCheckHandler; import rx.Observable; import javax.inject.Inject; /** * An implementation of {@link RequestHandler} to provide health status over HTTP. * * This endpoint does <b>NOT</b> validate whether the passed request URI is actually of healthcheck or not. It assumes * that it is used by a higher level router that makes appropriate decisions of which handler to call based on the URI. * * @author <NAME> */ public class HealthCheckEndpoint implements RequestHandler<ByteBuf, ByteBuf> { private final HealthCheckHandler healthCheckHandler; @Inject public HealthCheckEndpoint(HealthCheckHandler healthCheckHandler) { this.healthCheckHandler = healthCheckHandler; } @Override public Observable<Void> handle(HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response) { int httpStatus = healthCheckHandler.getStatus(); response.setStatus(HttpResponseStatus.valueOf(httpStatus)); return response.close(); } }
435
2,757
/****************************************************************************** * Copyright 2018 Google * 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. *****************************************************************************/ #pragma once #include "Arduino.h" #include "config.h" #include "display.h" class Bomb { public: using Callback = void (*)(); Bomb() {} void tick(); void set_on_explode(Callback c) { on_explode_ = c; } void set_on_defuse(Callback c) { on_defuse_ = c; } void defuse() { password_state_ = PasswordCheckStatus::Correct; defused_ = true; if (on_defuse_) { on_defuse_(); } } uint32_t time_remaining() { return time_remaining_; } void skip_lightsensor() { skip_lightsensor_ = true; } private: enum class PasswordCheckStatus { None, Incorrect, Correct, Hold, }; void check_password_if_requested(); void wait_for_edge(bool falling); // 6 segments. MM:SS:ms void send_remaining_time(uint32_t time_ms); void on_incorrect_password() { mt_send_mqtt_event("incorrect_password"); Serial.println("Password incorrect"); } void on_correct_password() { mt_send_mqtt_event("correct_password"); Serial.println("Password correct"); for (int i = 0; i < 3; i++) { Display::clear(); Display::strobe(); delay(500); Display::send_7seg(Display::S); Display::send_7seg(Display::E); Display::send_7seg(Display::Y); Display::strobe(); delay(500); } Display::clear(); } Callback on_explode_ = nullptr; Callback on_defuse_ = nullptr; // Start with 20 minutes on the clock. uint32_t time_remaining_ = (20 * 60 + 00) * 1000 + 0; bool skip_lightsensor_ = false; bool defused_ = false; // Password protection check. PasswordCheckStatus password_state_ = PasswordCheckStatus::None; // Clock too slow? (timeout waiting for rising / falling edge). bool tamper_detected_a = false; bool tamper_detected_b = false; bool tamper_reported = false; // Time delta in ms to substract each cycle. // Run slightly faster than 1s per second to avoid overrunning the timeslot at 220nF. // 555 timer will run at 48.1Hz by default (which will be 20.79ms). // -> substracting 22ms per cycle makes one 'bomb second' <=> 0.945s (off by 5%). // After swapping the capacitor: // f = 21.864 => 0.481s per 'bomb second' -> 2.08 times the actual time. static constexpr uint32_t kTimeDeltaPerRound = 22; // Timeout to detect that the clock ticks too slow. I absolutely have the math somewhere // for this, trust me!11. static constexpr uint32_t kClockTimeout = 240 * 1000 * 1000 / (80 * 20) / 2; static constexpr uint32_t kTamperDetectionMultiplicator = 20; };
1,058
416
/* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. * * 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.tencentcloudapi.emr.v20190103.models; import com.tencentcloudapi.common.AbstractModel; import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.Expose; import java.util.HashMap; public class ScaleOutInstanceRequest extends AbstractModel{ /** * 扩容的时间单位。取值范围: <li>s:表示秒。PayMode取值为0时,TimeUnit只能取值为s。</li> <li>m:表示月份。PayMode取值为1时,TimeUnit只能取值为m。</li> */ @SerializedName("TimeUnit") @Expose private String TimeUnit; /** * 扩容的时长。结合TimeUnit一起使用。 <li>TimeUnit为s时,该参数只能填写3600,表示按量计费实例。</li> <li>TimeUnit为m时,该参数填写的数字表示包年包月实例的购买时长,如1表示购买一个月</li> */ @SerializedName("TimeSpan") @Expose private Long TimeSpan; /** * 实例ID。 */ @SerializedName("InstanceId") @Expose private String InstanceId; /** * 实例计费模式。取值范围: <li>0:表示按量计费。</li> <li>1:表示包年包月。</li> */ @SerializedName("PayMode") @Expose private Long PayMode; /** * 客户端Token。 */ @SerializedName("ClientToken") @Expose private String ClientToken; /** * 引导操作脚本设置。 */ @SerializedName("PreExecutedFileSettings") @Expose private PreExecuteFileSettings [] PreExecutedFileSettings; /** * 扩容的Task节点数量。 */ @SerializedName("TaskCount") @Expose private Long TaskCount; /** * 扩容的Core节点数量。 */ @SerializedName("CoreCount") @Expose private Long CoreCount; /** * 扩容时不需要安装的进程。 */ @SerializedName("UnNecessaryNodeList") @Expose private Long [] UnNecessaryNodeList; /** * 扩容的Router节点数量。 */ @SerializedName("RouterCount") @Expose private Long RouterCount; /** * 部署的服务。 <li>SoftDeployInfo和ServiceNodeInfo是同组参数,和UnNecessaryNodeList参数互斥。</li> <li>建议使用SoftDeployInfo和ServiceNodeInfo组合。</li> */ @SerializedName("SoftDeployInfo") @Expose private Long [] SoftDeployInfo; /** * 启动的进程。 */ @SerializedName("ServiceNodeInfo") @Expose private Long [] ServiceNodeInfo; /** * 分散置放群组ID列表,当前仅支持指定一个。 */ @SerializedName("DisasterRecoverGroupIds") @Expose private String [] DisasterRecoverGroupIds; /** * 扩容节点绑定标签列表。 */ @SerializedName("Tags") @Expose private Tag [] Tags; /** * 扩容所选资源类型,可选范围为"host","pod",host为普通的CVM资源,Pod为TKE集群或EKS集群提供的资源 */ @SerializedName("HardwareResourceType") @Expose private String HardwareResourceType; /** * 使用Pod资源扩容时,指定的Pod规格以及来源等信息 */ @SerializedName("PodSpec") @Expose private PodSpec PodSpec; /** * 使用clickhouse集群扩容时,选择的机器分组名称 */ @SerializedName("ClickHouseClusterName") @Expose private String ClickHouseClusterName; /** * 使用clickhouse集群扩容时,选择的机器分组类型。new为新增,old为选择旧分组 */ @SerializedName("ClickHouseClusterType") @Expose private String ClickHouseClusterType; /** * 规则扩容指定 yarn node label */ @SerializedName("YarnNodeLabel") @Expose private String YarnNodeLabel; /** * POD自定义权限和自定义参数 */ @SerializedName("PodParameter") @Expose private PodParameter PodParameter; /** * 扩容的Master节点的数量。 使用clickhouse集群扩容时,该参数不生效。 使用kafka集群扩容时,该参数不生效。 当HardwareResourceType=POD时,该参数不生效。 */ @SerializedName("MasterCount") @Expose private Long MasterCount; /** * 扩容后是否启动服务,true:启动,false:不启动 */ @SerializedName("StartServiceAfterScaleOut") @Expose private String StartServiceAfterScaleOut; /** * Get 扩容的时间单位。取值范围: <li>s:表示秒。PayMode取值为0时,TimeUnit只能取值为s。</li> <li>m:表示月份。PayMode取值为1时,TimeUnit只能取值为m。</li> * @return TimeUnit 扩容的时间单位。取值范围: <li>s:表示秒。PayMode取值为0时,TimeUnit只能取值为s。</li> <li>m:表示月份。PayMode取值为1时,TimeUnit只能取值为m。</li> */ public String getTimeUnit() { return this.TimeUnit; } /** * Set 扩容的时间单位。取值范围: <li>s:表示秒。PayMode取值为0时,TimeUnit只能取值为s。</li> <li>m:表示月份。PayMode取值为1时,TimeUnit只能取值为m。</li> * @param TimeUnit 扩容的时间单位。取值范围: <li>s:表示秒。PayMode取值为0时,TimeUnit只能取值为s。</li> <li>m:表示月份。PayMode取值为1时,TimeUnit只能取值为m。</li> */ public void setTimeUnit(String TimeUnit) { this.TimeUnit = TimeUnit; } /** * Get 扩容的时长。结合TimeUnit一起使用。 <li>TimeUnit为s时,该参数只能填写3600,表示按量计费实例。</li> <li>TimeUnit为m时,该参数填写的数字表示包年包月实例的购买时长,如1表示购买一个月</li> * @return TimeSpan 扩容的时长。结合TimeUnit一起使用。 <li>TimeUnit为s时,该参数只能填写3600,表示按量计费实例。</li> <li>TimeUnit为m时,该参数填写的数字表示包年包月实例的购买时长,如1表示购买一个月</li> */ public Long getTimeSpan() { return this.TimeSpan; } /** * Set 扩容的时长。结合TimeUnit一起使用。 <li>TimeUnit为s时,该参数只能填写3600,表示按量计费实例。</li> <li>TimeUnit为m时,该参数填写的数字表示包年包月实例的购买时长,如1表示购买一个月</li> * @param TimeSpan 扩容的时长。结合TimeUnit一起使用。 <li>TimeUnit为s时,该参数只能填写3600,表示按量计费实例。</li> <li>TimeUnit为m时,该参数填写的数字表示包年包月实例的购买时长,如1表示购买一个月</li> */ public void setTimeSpan(Long TimeSpan) { this.TimeSpan = TimeSpan; } /** * Get 实例ID。 * @return InstanceId 实例ID。 */ public String getInstanceId() { return this.InstanceId; } /** * Set 实例ID。 * @param InstanceId 实例ID。 */ public void setInstanceId(String InstanceId) { this.InstanceId = InstanceId; } /** * Get 实例计费模式。取值范围: <li>0:表示按量计费。</li> <li>1:表示包年包月。</li> * @return PayMode 实例计费模式。取值范围: <li>0:表示按量计费。</li> <li>1:表示包年包月。</li> */ public Long getPayMode() { return this.PayMode; } /** * Set 实例计费模式。取值范围: <li>0:表示按量计费。</li> <li>1:表示包年包月。</li> * @param PayMode 实例计费模式。取值范围: <li>0:表示按量计费。</li> <li>1:表示包年包月。</li> */ public void setPayMode(Long PayMode) { this.PayMode = PayMode; } /** * Get 客户端Token。 * @return ClientToken 客户端Token。 */ public String getClientToken() { return this.ClientToken; } /** * Set 客户端Token。 * @param ClientToken 客户端Token。 */ public void setClientToken(String ClientToken) { this.ClientToken = ClientToken; } /** * Get 引导操作脚本设置。 * @return PreExecutedFileSettings 引导操作脚本设置。 */ public PreExecuteFileSettings [] getPreExecutedFileSettings() { return this.PreExecutedFileSettings; } /** * Set 引导操作脚本设置。 * @param PreExecutedFileSettings 引导操作脚本设置。 */ public void setPreExecutedFileSettings(PreExecuteFileSettings [] PreExecutedFileSettings) { this.PreExecutedFileSettings = PreExecutedFileSettings; } /** * Get 扩容的Task节点数量。 * @return TaskCount 扩容的Task节点数量。 */ public Long getTaskCount() { return this.TaskCount; } /** * Set 扩容的Task节点数量。 * @param TaskCount 扩容的Task节点数量。 */ public void setTaskCount(Long TaskCount) { this.TaskCount = TaskCount; } /** * Get 扩容的Core节点数量。 * @return CoreCount 扩容的Core节点数量。 */ public Long getCoreCount() { return this.CoreCount; } /** * Set 扩容的Core节点数量。 * @param CoreCount 扩容的Core节点数量。 */ public void setCoreCount(Long CoreCount) { this.CoreCount = CoreCount; } /** * Get 扩容时不需要安装的进程。 * @return UnNecessaryNodeList 扩容时不需要安装的进程。 */ public Long [] getUnNecessaryNodeList() { return this.UnNecessaryNodeList; } /** * Set 扩容时不需要安装的进程。 * @param UnNecessaryNodeList 扩容时不需要安装的进程。 */ public void setUnNecessaryNodeList(Long [] UnNecessaryNodeList) { this.UnNecessaryNodeList = UnNecessaryNodeList; } /** * Get 扩容的Router节点数量。 * @return RouterCount 扩容的Router节点数量。 */ public Long getRouterCount() { return this.RouterCount; } /** * Set 扩容的Router节点数量。 * @param RouterCount 扩容的Router节点数量。 */ public void setRouterCount(Long RouterCount) { this.RouterCount = RouterCount; } /** * Get 部署的服务。 <li>SoftDeployInfo和ServiceNodeInfo是同组参数,和UnNecessaryNodeList参数互斥。</li> <li>建议使用SoftDeployInfo和ServiceNodeInfo组合。</li> * @return SoftDeployInfo 部署的服务。 <li>SoftDeployInfo和ServiceNodeInfo是同组参数,和UnNecessaryNodeList参数互斥。</li> <li>建议使用SoftDeployInfo和ServiceNodeInfo组合。</li> */ public Long [] getSoftDeployInfo() { return this.SoftDeployInfo; } /** * Set 部署的服务。 <li>SoftDeployInfo和ServiceNodeInfo是同组参数,和UnNecessaryNodeList参数互斥。</li> <li>建议使用SoftDeployInfo和ServiceNodeInfo组合。</li> * @param SoftDeployInfo 部署的服务。 <li>SoftDeployInfo和ServiceNodeInfo是同组参数,和UnNecessaryNodeList参数互斥。</li> <li>建议使用SoftDeployInfo和ServiceNodeInfo组合。</li> */ public void setSoftDeployInfo(Long [] SoftDeployInfo) { this.SoftDeployInfo = SoftDeployInfo; } /** * Get 启动的进程。 * @return ServiceNodeInfo 启动的进程。 */ public Long [] getServiceNodeInfo() { return this.ServiceNodeInfo; } /** * Set 启动的进程。 * @param ServiceNodeInfo 启动的进程。 */ public void setServiceNodeInfo(Long [] ServiceNodeInfo) { this.ServiceNodeInfo = ServiceNodeInfo; } /** * Get 分散置放群组ID列表,当前仅支持指定一个。 * @return DisasterRecoverGroupIds 分散置放群组ID列表,当前仅支持指定一个。 */ public String [] getDisasterRecoverGroupIds() { return this.DisasterRecoverGroupIds; } /** * Set 分散置放群组ID列表,当前仅支持指定一个。 * @param DisasterRecoverGroupIds 分散置放群组ID列表,当前仅支持指定一个。 */ public void setDisasterRecoverGroupIds(String [] DisasterRecoverGroupIds) { this.DisasterRecoverGroupIds = DisasterRecoverGroupIds; } /** * Get 扩容节点绑定标签列表。 * @return Tags 扩容节点绑定标签列表。 */ public Tag [] getTags() { return this.Tags; } /** * Set 扩容节点绑定标签列表。 * @param Tags 扩容节点绑定标签列表。 */ public void setTags(Tag [] Tags) { this.Tags = Tags; } /** * Get 扩容所选资源类型,可选范围为"host","pod",host为普通的CVM资源,Pod为TKE集群或EKS集群提供的资源 * @return HardwareResourceType 扩容所选资源类型,可选范围为"host","pod",host为普通的CVM资源,Pod为TKE集群或EKS集群提供的资源 */ public String getHardwareResourceType() { return this.HardwareResourceType; } /** * Set 扩容所选资源类型,可选范围为"host","pod",host为普通的CVM资源,Pod为TKE集群或EKS集群提供的资源 * @param HardwareResourceType 扩容所选资源类型,可选范围为"host","pod",host为普通的CVM资源,Pod为TKE集群或EKS集群提供的资源 */ public void setHardwareResourceType(String HardwareResourceType) { this.HardwareResourceType = HardwareResourceType; } /** * Get 使用Pod资源扩容时,指定的Pod规格以及来源等信息 * @return PodSpec 使用Pod资源扩容时,指定的Pod规格以及来源等信息 */ public PodSpec getPodSpec() { return this.PodSpec; } /** * Set 使用Pod资源扩容时,指定的Pod规格以及来源等信息 * @param PodSpec 使用Pod资源扩容时,指定的Pod规格以及来源等信息 */ public void setPodSpec(PodSpec PodSpec) { this.PodSpec = PodSpec; } /** * Get 使用clickhouse集群扩容时,选择的机器分组名称 * @return ClickHouseClusterName 使用clickhouse集群扩容时,选择的机器分组名称 */ public String getClickHouseClusterName() { return this.ClickHouseClusterName; } /** * Set 使用clickhouse集群扩容时,选择的机器分组名称 * @param ClickHouseClusterName 使用clickhouse集群扩容时,选择的机器分组名称 */ public void setClickHouseClusterName(String ClickHouseClusterName) { this.ClickHouseClusterName = ClickHouseClusterName; } /** * Get 使用clickhouse集群扩容时,选择的机器分组类型。new为新增,old为选择旧分组 * @return ClickHouseClusterType 使用clickhouse集群扩容时,选择的机器分组类型。new为新增,old为选择旧分组 */ public String getClickHouseClusterType() { return this.ClickHouseClusterType; } /** * Set 使用clickhouse集群扩容时,选择的机器分组类型。new为新增,old为选择旧分组 * @param ClickHouseClusterType 使用clickhouse集群扩容时,选择的机器分组类型。new为新增,old为选择旧分组 */ public void setClickHouseClusterType(String ClickHouseClusterType) { this.ClickHouseClusterType = ClickHouseClusterType; } /** * Get 规则扩容指定 yarn node label * @return YarnNodeLabel 规则扩容指定 yarn node label */ public String getYarnNodeLabel() { return this.YarnNodeLabel; } /** * Set 规则扩容指定 yarn node label * @param YarnNodeLabel 规则扩容指定 yarn node label */ public void setYarnNodeLabel(String YarnNodeLabel) { this.YarnNodeLabel = YarnNodeLabel; } /** * Get POD自定义权限和自定义参数 * @return PodParameter POD自定义权限和自定义参数 */ public PodParameter getPodParameter() { return this.PodParameter; } /** * Set POD自定义权限和自定义参数 * @param PodParameter POD自定义权限和自定义参数 */ public void setPodParameter(PodParameter PodParameter) { this.PodParameter = PodParameter; } /** * Get 扩容的Master节点的数量。 使用clickhouse集群扩容时,该参数不生效。 使用kafka集群扩容时,该参数不生效。 当HardwareResourceType=POD时,该参数不生效。 * @return MasterCount 扩容的Master节点的数量。 使用clickhouse集群扩容时,该参数不生效。 使用kafka集群扩容时,该参数不生效。 当HardwareResourceType=POD时,该参数不生效。 */ public Long getMasterCount() { return this.MasterCount; } /** * Set 扩容的Master节点的数量。 使用clickhouse集群扩容时,该参数不生效。 使用kafka集群扩容时,该参数不生效。 当HardwareResourceType=POD时,该参数不生效。 * @param MasterCount 扩容的Master节点的数量。 使用clickhouse集群扩容时,该参数不生效。 使用kafka集群扩容时,该参数不生效。 当HardwareResourceType=POD时,该参数不生效。 */ public void setMasterCount(Long MasterCount) { this.MasterCount = MasterCount; } /** * Get 扩容后是否启动服务,true:启动,false:不启动 * @return StartServiceAfterScaleOut 扩容后是否启动服务,true:启动,false:不启动 */ public String getStartServiceAfterScaleOut() { return this.StartServiceAfterScaleOut; } /** * Set 扩容后是否启动服务,true:启动,false:不启动 * @param StartServiceAfterScaleOut 扩容后是否启动服务,true:启动,false:不启动 */ public void setStartServiceAfterScaleOut(String StartServiceAfterScaleOut) { this.StartServiceAfterScaleOut = StartServiceAfterScaleOut; } public ScaleOutInstanceRequest() { } /** * NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy, * and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy. */ public ScaleOutInstanceRequest(ScaleOutInstanceRequest source) { if (source.TimeUnit != null) { this.TimeUnit = new String(source.TimeUnit); } if (source.TimeSpan != null) { this.TimeSpan = new Long(source.TimeSpan); } if (source.InstanceId != null) { this.InstanceId = new String(source.InstanceId); } if (source.PayMode != null) { this.PayMode = new Long(source.PayMode); } if (source.ClientToken != null) { this.ClientToken = new String(source.ClientToken); } if (source.PreExecutedFileSettings != null) { this.PreExecutedFileSettings = new PreExecuteFileSettings[source.PreExecutedFileSettings.length]; for (int i = 0; i < source.PreExecutedFileSettings.length; i++) { this.PreExecutedFileSettings[i] = new PreExecuteFileSettings(source.PreExecutedFileSettings[i]); } } if (source.TaskCount != null) { this.TaskCount = new Long(source.TaskCount); } if (source.CoreCount != null) { this.CoreCount = new Long(source.CoreCount); } if (source.UnNecessaryNodeList != null) { this.UnNecessaryNodeList = new Long[source.UnNecessaryNodeList.length]; for (int i = 0; i < source.UnNecessaryNodeList.length; i++) { this.UnNecessaryNodeList[i] = new Long(source.UnNecessaryNodeList[i]); } } if (source.RouterCount != null) { this.RouterCount = new Long(source.RouterCount); } if (source.SoftDeployInfo != null) { this.SoftDeployInfo = new Long[source.SoftDeployInfo.length]; for (int i = 0; i < source.SoftDeployInfo.length; i++) { this.SoftDeployInfo[i] = new Long(source.SoftDeployInfo[i]); } } if (source.ServiceNodeInfo != null) { this.ServiceNodeInfo = new Long[source.ServiceNodeInfo.length]; for (int i = 0; i < source.ServiceNodeInfo.length; i++) { this.ServiceNodeInfo[i] = new Long(source.ServiceNodeInfo[i]); } } if (source.DisasterRecoverGroupIds != null) { this.DisasterRecoverGroupIds = new String[source.DisasterRecoverGroupIds.length]; for (int i = 0; i < source.DisasterRecoverGroupIds.length; i++) { this.DisasterRecoverGroupIds[i] = new String(source.DisasterRecoverGroupIds[i]); } } if (source.Tags != null) { this.Tags = new Tag[source.Tags.length]; for (int i = 0; i < source.Tags.length; i++) { this.Tags[i] = new Tag(source.Tags[i]); } } if (source.HardwareResourceType != null) { this.HardwareResourceType = new String(source.HardwareResourceType); } if (source.PodSpec != null) { this.PodSpec = new PodSpec(source.PodSpec); } if (source.ClickHouseClusterName != null) { this.ClickHouseClusterName = new String(source.ClickHouseClusterName); } if (source.ClickHouseClusterType != null) { this.ClickHouseClusterType = new String(source.ClickHouseClusterType); } if (source.YarnNodeLabel != null) { this.YarnNodeLabel = new String(source.YarnNodeLabel); } if (source.PodParameter != null) { this.PodParameter = new PodParameter(source.PodParameter); } if (source.MasterCount != null) { this.MasterCount = new Long(source.MasterCount); } if (source.StartServiceAfterScaleOut != null) { this.StartServiceAfterScaleOut = new String(source.StartServiceAfterScaleOut); } } /** * Internal implementation, normal users should not use it. */ public void toMap(HashMap<String, String> map, String prefix) { this.setParamSimple(map, prefix + "TimeUnit", this.TimeUnit); this.setParamSimple(map, prefix + "TimeSpan", this.TimeSpan); this.setParamSimple(map, prefix + "InstanceId", this.InstanceId); this.setParamSimple(map, prefix + "PayMode", this.PayMode); this.setParamSimple(map, prefix + "ClientToken", this.ClientToken); this.setParamArrayObj(map, prefix + "PreExecutedFileSettings.", this.PreExecutedFileSettings); this.setParamSimple(map, prefix + "TaskCount", this.TaskCount); this.setParamSimple(map, prefix + "CoreCount", this.CoreCount); this.setParamArraySimple(map, prefix + "UnNecessaryNodeList.", this.UnNecessaryNodeList); this.setParamSimple(map, prefix + "RouterCount", this.RouterCount); this.setParamArraySimple(map, prefix + "SoftDeployInfo.", this.SoftDeployInfo); this.setParamArraySimple(map, prefix + "ServiceNodeInfo.", this.ServiceNodeInfo); this.setParamArraySimple(map, prefix + "DisasterRecoverGroupIds.", this.DisasterRecoverGroupIds); this.setParamArrayObj(map, prefix + "Tags.", this.Tags); this.setParamSimple(map, prefix + "HardwareResourceType", this.HardwareResourceType); this.setParamObj(map, prefix + "PodSpec.", this.PodSpec); this.setParamSimple(map, prefix + "ClickHouseClusterName", this.ClickHouseClusterName); this.setParamSimple(map, prefix + "ClickHouseClusterType", this.ClickHouseClusterType); this.setParamSimple(map, prefix + "YarnNodeLabel", this.YarnNodeLabel); this.setParamObj(map, prefix + "PodParameter.", this.PodParameter); this.setParamSimple(map, prefix + "MasterCount", this.MasterCount); this.setParamSimple(map, prefix + "StartServiceAfterScaleOut", this.StartServiceAfterScaleOut); } }
12,405
1,085
package org.conscrypt.testing; import javax.net.ssl.SNIMatcher; import javax.net.ssl.SNIServerName; public class FailingSniMatcher extends SNIMatcher { private FailingSniMatcher() { super(0); } @Override public boolean matches(SNIServerName sniServerName) { return false; } public static SNIMatcher create() { return new FailingSniMatcher(); } }
160
416
/* File: AVAudioFormat.h Framework: AVFoundation Copyright (c) 2014-2015 Apple Inc. All Rights Reserved. */ #import <AVFAudio/AVAudioTypes.h> #import <AVFAudio/AVAudioChannelLayout.h> #if __has_include(<CoreMedia/CMFormatDescription.h>) #define AVAUDIOFORMAT_HAVE_CMFORMATDESCRIPTION 1 #import <CoreMedia/CMFormatDescription.h> #endif NS_ASSUME_NONNULL_BEGIN /*! @enum AVAudioCommonFormat @constant AVAudioOtherFormat A format other than one of the common ones below. @constant AVAudioPCMFormatFloat32 Native-endian floats (this is the standard format). @constant AVAudioPCMFormatFloat64 Native-endian doubles. @constant AVAudioPCMFormatInt16 Signed 16-bit native-endian integers. @constant AVAudioPCMFormatInt32 Signed 32-bit native-endian integers. */ typedef NS_ENUM(NSUInteger, AVAudioCommonFormat) { AVAudioOtherFormat = 0, AVAudioPCMFormatFloat32 = 1, AVAudioPCMFormatFloat64 = 2, AVAudioPCMFormatInt16 = 3, AVAudioPCMFormatInt32 = 4 } NS_ENUM_AVAILABLE(10_10, 8_0); /*! @class AVAudioFormat @abstract A representation of an audio format. @discussion AVAudioFormat wraps a Core Audio AudioStreamBasicDescription struct, with convenience initializers and accessors for common formats, including Core Audio's standard deinterleaved 32-bit floating point. Instances of this class are immutable. */ OS_EXPORT API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0)) @interface AVAudioFormat : NSObject <NSSecureCoding> { @private AudioStreamBasicDescription _asbd; AVAudioChannelLayout *_layout; AVAudioCommonFormat _commonFormat; void * _reserved; } /*! @method initWithStreamDescription: @abstract Initialize from an AudioStreamBasicDescription. @param asbd the AudioStreamBasicDescription @discussion If the format specifies more than 2 channels, this method fails (returns nil). */ - (nullable instancetype)initWithStreamDescription:(const AudioStreamBasicDescription *)asbd; /*! @method initWithStreamDescription:channelLayout: @abstract Initialize from an AudioStreamBasicDescription and optional channel layout. @param asbd the AudioStreamBasicDescription @param layout the channel layout. Can be nil only if asbd specifies 1 or 2 channels. @discussion If the format specifies more than 2 channels, this method fails (returns nil) unless layout is non-nil. */ - (nullable instancetype)initWithStreamDescription:(const AudioStreamBasicDescription *)asbd channelLayout:(AVAudioChannelLayout * __nullable)layout; /*! @method initStandardFormatWithSampleRate:channels: @abstract Initialize to deinterleaved float with the specified sample rate and channel count. @param sampleRate the sample rate @param channels the channel count @discussion If the format specifies more than 2 channels, this method fails (returns nil). */ - (nullable instancetype)initStandardFormatWithSampleRate:(double)sampleRate channels:(AVAudioChannelCount)channels; /*! @method initStandardFormatWithSampleRate:channelLayout: @abstract Initialize to deinterleaved float with the specified sample rate and channel layout. @param sampleRate the sample rate @param layout the channel layout. must not be nil. */ - (instancetype)initStandardFormatWithSampleRate:(double)sampleRate channelLayout:(AVAudioChannelLayout *)layout; /*! @method initWithCommonFormat:sampleRate:channels:interleaved: @abstract Initialize to float with the specified sample rate, channel count and interleavedness. @param format the common format type @param sampleRate the sample rate @param channels the channel count @param interleaved true if interleaved @discussion If the format specifies more than 2 channels, this method fails (returns nil). */ - (nullable instancetype)initWithCommonFormat:(AVAudioCommonFormat)format sampleRate:(double)sampleRate channels:(AVAudioChannelCount)channels interleaved:(BOOL)interleaved; /*! @method initWithCommonFormat:sampleRate:interleaved:channelLayout: @abstract Initialize to float with the specified sample rate, channel layout and interleavedness. @param format the common format type @param sampleRate the sample rate @param interleaved true if interleaved @param layout the channel layout. must not be nil. */ - (instancetype)initWithCommonFormat:(AVAudioCommonFormat)format sampleRate:(double)sampleRate interleaved:(BOOL)interleaved channelLayout:(AVAudioChannelLayout *)layout; /*! @method initWithSettings: @abstract Initialize using a settings dictionary. @discussion See AVAudioSettings.h. Note that many settings dictionary elements pertain to encoder settings, not the basic format, and will be ignored. Returns nil if a format cannot be constructed with the provided settings, e.g. when: - AVNumberOfChannelsKey specifies more than 2 channels, but AVChannelLayoutKey hasn't been specified or the layout does not match - AVLinearPCMBitDepthKey for linear PCM format specifies less than 8 or greater than 32 bits - values for the keys are not of the expected types */ - (nullable instancetype)initWithSettings:(NSDictionary<NSString *, id> *)settings; #if AVAUDIOFORMAT_HAVE_CMFORMATDESCRIPTION /*! @method initWithCMAudioFormatDescription: @abstract initialize from a CMAudioFormatDescriptionRef. @param formatDescription the CMAudioFormatDescriptionRef. @discussion If formatDescription is invalid, this method fails (returns nil). */ - (instancetype)initWithCMAudioFormatDescription:(CMAudioFormatDescriptionRef)formatDescription API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)); #endif /*! @method isEqual: @abstract Determine whether another format is functionally equivalent. @param object the format to compare against @discussion For PCM, interleavedness is ignored for mono. Differences in the AudioStreamBasicDescription alignment and packedness are ignored when they are not significant (e.g. with 1 channel, 2 bytes per frame and 16 bits per channel, neither alignment, the format is implicitly packed and can be interpreted as either high- or low-aligned.) For AVAudioChannelLayout, a layout with standard mono/stereo tag is considered to be equivalent to a nil layout. Otherwise, the layouts are compared for equality. */ - (BOOL)isEqual:(id)object; /*! @property standard @abstract Describes whether the format is deinterleaved native-endian float. */ @property (nonatomic, readonly, getter=isStandard) BOOL standard; /*! @property commonFormat @abstract An `AVAudioCommonFormat` identifying the format */ @property (nonatomic, readonly) AVAudioCommonFormat commonFormat; /*! @property channelCount @abstract The number of channels of audio data. */ @property (nonatomic, readonly) AVAudioChannelCount channelCount; /*! @property sampleRate @abstract A sampling rate in Hertz. */ @property (nonatomic, readonly) double sampleRate; /*! @property interleaved @abstract Describes whether the samples are interleaved. @discussion For non-PCM formats, the value is undefined. */ @property (nonatomic, readonly, getter=isInterleaved) BOOL interleaved; /*! @property streamDescription @abstract Returns the AudioStreamBasicDescription, for use with lower-level audio API's. */ @property (nonatomic, readonly) const AudioStreamBasicDescription *streamDescription; /*! @property channelLayout @abstract The underlying AVAudioChannelLayout, if any. @discussion Only formats with more than 2 channels are required to have channel layouts. */ @property (nonatomic, readonly, nullable) AVAudioChannelLayout *channelLayout; /*! @property magicCookie @abstract The underlying magic cookie, if any. @discussion A magic cookie contains metadata associated with encoders and decoders. Encoders produce a magic cookie, and some decoders require a magic cookie to decode properly. */ @property (nonatomic, retain, nullable) NSData *magicCookie API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)); /*! @property settings @abstract Returns the format represented as a dictionary with keys from AVAudioSettings.h. */ @property (nonatomic, readonly) NSDictionary<NSString *, id> *settings; #if AVAUDIOFORMAT_HAVE_CMFORMATDESCRIPTION /*! @property formatDescription @abstract Converts to a CMAudioFormatDescriptionRef, for use with Core Media API's. */ @property (nonatomic, readonly) CMAudioFormatDescriptionRef formatDescription API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)); #endif @end NS_ASSUME_NONNULL_END
2,592
1,262
/* * * Copyright 2017 Netflix, Inc. * * 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.netflix.metacat.connector.s3; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.inject.persist.Transactional; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.Pageable; import com.netflix.metacat.common.dto.Sort; import com.netflix.metacat.common.server.connectors.ConnectorRequestContext; import com.netflix.metacat.common.server.connectors.ConnectorDatabaseService; import com.netflix.metacat.common.server.connectors.model.DatabaseInfo; import com.netflix.metacat.common.server.connectors.exception.ConnectorException; import com.netflix.metacat.common.server.connectors.exception.DatabaseAlreadyExistsException; import com.netflix.metacat.common.server.connectors.exception.DatabaseNotFoundException; import com.netflix.metacat.connector.s3.dao.DatabaseDao; import com.netflix.metacat.connector.s3.dao.SourceDao; import com.netflix.metacat.connector.s3.model.Database; import lombok.extern.slf4j.Slf4j; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Named; import java.util.List; import java.util.stream.Collectors; /** * S3 Connector Database Service implementation. * * @author amajumdar */ @Transactional @Slf4j public class S3ConnectorDatabaseService implements ConnectorDatabaseService { private final SourceDao sourceDao; private final DatabaseDao databaseDao; private final S3ConnectorInfoConverter infoConverter; private final String catalogName; /** * Constructor. * * @param catalogName catalog name * @param databaseDao database DAO impl * @param sourceDao catalog/source DAO impl * @param infoConverter Converter for the S3 resources */ @Inject public S3ConnectorDatabaseService(@Named("catalogName") final String catalogName, final DatabaseDao databaseDao, final SourceDao sourceDao, final S3ConnectorInfoConverter infoConverter) { this.databaseDao = databaseDao; this.sourceDao = sourceDao; this.infoConverter = infoConverter; this.catalogName = catalogName; } @Override public List<QualifiedName> listViewNames(@Nonnull final ConnectorRequestContext context, @Nonnull final QualifiedName databaseName) { return Lists.newArrayList(); } @Override public void create(@Nonnull final ConnectorRequestContext context, @Nonnull final DatabaseInfo databaseInfo) { final String databaseName = databaseInfo.getName().getDatabaseName(); log.debug("Start: Create database {}", databaseInfo.getName()); Preconditions.checkNotNull(databaseName, "Database name is null"); if (databaseDao.getBySourceDatabaseName(catalogName, databaseName) != null) { log.warn("Database {} already exists", databaseName); throw new DatabaseAlreadyExistsException(databaseInfo.getName()); } final Database database = new Database(); database.setName(databaseName); database.setSource(sourceDao.getByName(catalogName)); databaseDao.save(database); log.debug("End: Create database {}", databaseInfo.getName()); } @Override public void update(@Nonnull final ConnectorRequestContext context, @Nonnull final DatabaseInfo databaseInfo) { // no op } @Override public void delete(@Nonnull final ConnectorRequestContext context, @Nonnull final QualifiedName name) { log.debug("Start: Delete database {}", name); final String databaseName = name.getDatabaseName(); Preconditions.checkNotNull(databaseName, "Database name is null"); final Database database = databaseDao.getBySourceDatabaseName(catalogName, databaseName); if (database == null) { throw new DatabaseNotFoundException(name); } else if (database.getTables() != null && !database.getTables().isEmpty()) { throw new ConnectorException("Database " + databaseName + " is not empty. One or more tables exist.", null); } databaseDao.delete(database); log.debug("End: Delete database {}", name); } @Override public DatabaseInfo get(@Nonnull final ConnectorRequestContext context, @Nonnull final QualifiedName name) { final String databaseName = name.getDatabaseName(); Preconditions.checkNotNull(databaseName, "Database name is null"); log.debug("Get database {}", name); final Database database = databaseDao.getBySourceDatabaseName(catalogName, databaseName); if (database == null) { throw new DatabaseNotFoundException(name); } return infoConverter.toDatabaseInfo(QualifiedName.ofCatalog(catalogName), database); } @Override public boolean exists(@Nonnull final ConnectorRequestContext context, @Nonnull final QualifiedName name) { return databaseDao.getBySourceDatabaseName(catalogName, name.getDatabaseName()) != null; } @Override public List<DatabaseInfo> list(@Nonnull final ConnectorRequestContext context, @Nonnull final QualifiedName name, @Nullable final QualifiedName prefix, @Nullable final Sort sort, @Nullable final Pageable pageable) { log.debug("List databases for catalog {} and database with prefix {}", name, prefix); return databaseDao.searchBySourceDatabaseName(catalogName, prefix == null ? "" : prefix.getTableName(), sort, pageable).stream().map(d -> infoConverter.toDatabaseInfo(name, d)).collect( Collectors.toList()); } @Override public List<QualifiedName> listNames(@Nonnull final ConnectorRequestContext context, @Nonnull final QualifiedName name, @Nullable final QualifiedName prefix, @Nullable final Sort sort, @Nullable final Pageable pageable) { log.debug("List database names for catalog {} and database with prefix {}", name, prefix); return databaseDao.searchBySourceDatabaseName(catalogName, prefix == null ? "" : prefix.getTableName(), sort, pageable).stream().map(d -> QualifiedName.ofDatabase(catalogName, d.getName())).collect( Collectors.toList()); } @Override public void rename(@Nonnull final ConnectorRequestContext context, @Nonnull final QualifiedName oldName, @Nonnull final QualifiedName newName) { log.debug("Start: Rename database {} with {}", oldName, newName); final String newDatabaseName = newName.getDatabaseName(); Preconditions.checkNotNull(newDatabaseName, "Database name is null"); final Database oldDatabase = databaseDao.getBySourceDatabaseName(catalogName, oldName.getDatabaseName()); if (oldDatabase == null) { throw new DatabaseNotFoundException(oldName); } if (databaseDao.getBySourceDatabaseName(catalogName, newDatabaseName) != null) { throw new DatabaseAlreadyExistsException(newName); } oldDatabase.setName(newDatabaseName); databaseDao.save(oldDatabase); log.debug("End: Rename database {} with {}", oldName, newName); } }
3,028
777
<reponame>google-ar/chromium // Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_BLIMP_SYNCED_PROPERTY_REMOTE_H_ #define CC_BLIMP_SYNCED_PROPERTY_REMOTE_H_ #include "cc/base/synced_property.h" namespace cc { // This class is heavily inspired from SyncedProperty and is the equivalent of // SyncedProperty for synchronizing state between the engine and client in // remote mode. There are effectively 2 trees on the main thread, the LayerTree // on the main thread on the engine, and the tree on the main thread on the // client. // // The client main thread tree receives deltas from the impl thread, but must // synchronize them with the engine main thread before applying them onto the // the main thread associated state. At the same time there are different sets // of deltas, the value that was received from the impl thread but has not yet // been reported to the engine main thread, and the value that has been sent // to the engine main thread, but a state update with the application of these // deltas has not been received from the engine. The purpose of this class is to // track these deltas for deciding what needs to be reported to the main thread // on the engine, and providing the impl thread with the delta that it should // apply to its associated state since it could not be reflected in the local // BeginMainFrame on the client main thread. // // Instances of this class are held on the client main thread and have a 1:1 // mapping with their corresponding SyncedProperty instances. // Note: This class currently supports only one set of deltas to be in flight to // the engine. template <typename T> class SyncedPropertyRemote { public: SyncedPropertyRemote() = default; SyncedPropertyRemote(SyncedPropertyRemote&& other) = default; SyncedPropertyRemote& operator=(SyncedPropertyRemote&& other) = default; // Push the main thread state from the engine onto the client main thread // associated state. void PushFromEngineMainThread( typename T::ValueType engine_main_thread_value) { engine_main_base_ = T(engine_main_thread_value); } // Called when an update for changes made on the impl thread was received on // the client main thread. // |main_thread_value| holds the updated value on the client main thread. void UpdateDeltaFromImplThread(typename T::ValueType main_thread_value) { T delta_from_impl_thread = T(main_thread_value).InverseCombine(engine_main_base_); unsent_delta_from_impl_thread_ = unsent_delta_from_impl_thread_.Combine(delta_from_impl_thread); } // Pull deltas for changes tracked on the client main thread to be sent to the // engine main thread. // Each call to this must be followed with a call to DidApplySentDeltaOnEngine // before another set of deltas can be pulled. typename T::ValueType PullDeltaForEngineUpdate() { DCHECK(sent_but_unapplied_delta_from_impl_thread_.get() == T::Identity().get()); T delta_to_send = unsent_delta_from_impl_thread_; sent_but_unapplied_delta_from_impl_thread_ = delta_to_send; unsent_delta_from_impl_thread_ = T::Identity(); return delta_to_send.get(); } // Called when deltas sent to the engine were applied to the main thread state // on the engine. void DidApplySentDeltaOnEngine() { // Pre-emptively apply the deltas that were sent. This is necessary since // the engine may not send a frame update if the deltas were simply // reflected back by the engine main thread (equivalent to // BeginMainFrameAborted between the main and impl thread). // If the engine did send a frame, we expect the frame to come with the ack // for the deltas, so the value will be over-written with the engine update // before being pushed to the impl thread. engine_main_base_ = engine_main_base_.Combine(sent_but_unapplied_delta_from_impl_thread_); sent_but_unapplied_delta_from_impl_thread_ = T::Identity(); } // Returns the delta that was reported to the main thread on the client but // has not yet been applied to the main thread on the engine. typename T::ValueType DeltaNotAppliedOnEngine() { T total_delta_on_client = unsent_delta_from_impl_thread_.Combine( sent_but_unapplied_delta_from_impl_thread_); return total_delta_on_client.get(); } typename T::ValueType EngineMain() { return engine_main_base_.get(); } private: // The delta that was applied to the state on the impl thread and received on // the main thread on the client during BeginMainFrame, but has not yet been // reported to the main thread on the engine. T unsent_delta_from_impl_thread_; // The delta that was applied to the state on the impl thread and has been // sent to the main thread on the engine, but has not yet been applied to the // main thread on the engine. T sent_but_unapplied_delta_from_impl_thread_; // The value as last received from the main thread on the engine. The value on // the main thread state on the client should always be set to this value, // outside of the interval when deltas from the impl thread are reported to // the main thread on the client. T engine_main_base_; DISALLOW_COPY_AND_ASSIGN(SyncedPropertyRemote); }; } // namespace cc #endif // CC_BLIMP_SYNCED_PROPERTY_REMOTE_H_
1,610
956
# This file is part of Scapy # Copyright (C) 2007, 2008, 2009 <NAME> # 2015, 2016, 2017 <NAME> # This program is published under a GPLv2 license """ The _TLSAutomaton class provides methods common to both TLS client and server. """ import struct from scapy.automaton import Automaton from scapy.config import conf from scapy.error import log_interactive from scapy.packet import Raw from scapy.layers.tls.basefields import _tls_type from scapy.layers.tls.cert import Cert, PrivKey from scapy.layers.tls.record import TLS from scapy.layers.tls.record_sslv2 import SSLv2 from scapy.layers.tls.record_tls13 import TLS13 class _TLSAutomaton(Automaton): """ SSLv3 and TLS 1.0-1.2 typically need a 2-RTT handshake: Client Server | --------->>> | C1 - ClientHello | <<<--------- | S1 - ServerHello | <<<--------- | S1 - Certificate | <<<--------- | S1 - ServerKeyExchange | <<<--------- | S1 - ServerHelloDone | --------->>> | C2 - ClientKeyExchange | --------->>> | C2 - ChangeCipherSpec | --------->>> | C2 - Finished [encrypted] | <<<--------- | S2 - ChangeCipherSpec | <<<--------- | S2 - Finished [encrypted] We call these successive groups of messages: ClientFlight1, ServerFlight1, ClientFlight2 and ServerFlight2. We want to send our messages from the same flight all at once through the socket. This is achieved by managing a list of records in 'buffer_out'. We may put several messages (i.e. what RFC 5246 calls the record fragments) in the same record when possible, but we may need several records for the same flight, as with ClientFlight2. However, note that the flights from the opposite side may be spread wildly across TLS records and TCP packets. This is why we use a 'get_next_msg' method for feeding a list of received messages, 'buffer_in'. Raw data which has not yet been interpreted as a TLS record is kept in 'remain_in'. """ def parse_args(self, mycert=None, mykey=None, **kargs): super(_TLSAutomaton, self).parse_args(**kargs) self.socket = None self.remain_in = b"" self.buffer_in = [] # these are 'fragments' inside records self.buffer_out = [] # these are records self.cur_session = None self.cur_pkt = None # this is usually the latest parsed packet if mycert: self.mycert = Cert(mycert) else: self.mycert = None if mykey: self.mykey = PrivKey(mykey) else: self.mykey = None self.verbose = kargs.get("verbose", True) def get_next_msg(self, socket_timeout=2, retry=2): """ The purpose of the function is to make next message(s) available in self.buffer_in. If the list is not empty, nothing is done. If not, in order to fill it, the function uses the data already available in self.remain_in from a previous call and waits till there are enough to dissect a TLS packet. Once dissected, the content of the TLS packet (carried messages, or 'fragments') is appended to self.buffer_in. We have to grab enough data to dissect a TLS packet. We start by reading the first 2 bytes. Unless we get anything different from \\x14\\x03, \\x15\\x03, \\x16\\x03 or \\x17\\x03 (which might indicate an SSLv2 record, whose first 2 bytes encode the length), we retrieve 3 more bytes in order to get the length of the TLS record, and finally we can retrieve the remaining of the record. """ if self.buffer_in: # A message is already available. return self.socket.settimeout(socket_timeout) is_sslv2_msg = False still_getting_len = True grablen = 2 while retry and (still_getting_len or len(self.remain_in) < grablen): if not is_sslv2_msg and grablen == 5 and len(self.remain_in) >= 5: grablen = struct.unpack('!H', self.remain_in[3:5])[0] + 5 still_getting_len = False elif grablen == 2 and len(self.remain_in) >= 2: byte0 = struct.unpack("B", self.remain_in[:1])[0] byte1 = struct.unpack("B", self.remain_in[1:2])[0] if (byte0 in _tls_type) and (byte1 == 3): # Retry following TLS scheme. This will cause failure # for SSLv2 packets with length 0x1{4-7}03. grablen = 5 else: # Extract the SSLv2 length. is_sslv2_msg = True still_getting_len = False if byte0 & 0x80: grablen = 2 + 0 + ((byte0 & 0x7f) << 8) + byte1 else: grablen = 2 + 1 + ((byte0 & 0x3f) << 8) + byte1 elif not is_sslv2_msg and grablen == 5 and len(self.remain_in) >= 5: # noqa: E501 grablen = struct.unpack('!H', self.remain_in[3:5])[0] + 5 if grablen == len(self.remain_in): break try: tmp = self.socket.recv(grablen - len(self.remain_in)) if not tmp: retry -= 1 else: self.remain_in += tmp except Exception: self.vprint("Could not join host ! Retrying...") retry -= 1 if len(self.remain_in) < 2 or len(self.remain_in) != grablen: # Remote peer is not willing to respond return p = TLS(self.remain_in, tls_session=self.cur_session) self.cur_session = p.tls_session self.remain_in = b"" if isinstance(p, SSLv2) and not p.msg: p.msg = Raw("") if self.cur_session.tls_version is None or \ self.cur_session.tls_version < 0x0304: self.buffer_in += p.msg else: if isinstance(p, TLS13): self.buffer_in += p.inner.msg else: # should be TLS13ServerHello only self.buffer_in += p.msg while p.payload: if isinstance(p.payload, Raw): self.remain_in += p.payload.load p = p.payload elif isinstance(p.payload, TLS): p = p.payload if self.cur_session.tls_version is None or \ self.cur_session.tls_version < 0x0304: self.buffer_in += p.msg else: self.buffer_in += p.inner.msg def raise_on_packet(self, pkt_cls, state, get_next_msg=True): """ If the next message to be processed has type 'pkt_cls', raise 'state'. If there is no message waiting to be processed, we try to get one with the default 'get_next_msg' parameters. """ # Maybe we already parsed the expected packet, maybe not. if get_next_msg: self.get_next_msg() if (not self.buffer_in or not isinstance(self.buffer_in[0], pkt_cls)): return self.cur_pkt = self.buffer_in[0] self.buffer_in = self.buffer_in[1:] raise state() def add_record(self, is_sslv2=None, is_tls13=None): """ Add a new TLS or SSLv2 or TLS 1.3 record to the packets buffered out. """ if is_sslv2 is None and is_tls13 is None: v = (self.cur_session.tls_version or self.cur_session.advertised_tls_version) if v in [0x0200, 0x0002]: is_sslv2 = True elif v >= 0x0304: is_tls13 = True if is_sslv2: self.buffer_out.append(SSLv2(tls_session=self.cur_session)) elif is_tls13: self.buffer_out.append(TLS13(tls_session=self.cur_session)) else: self.buffer_out.append(TLS(tls_session=self.cur_session)) def add_msg(self, pkt): """ Add a TLS message (e.g. TLSClientHello or TLSApplicationData) inside the latest record to be sent through the socket. We believe a good automaton should not use the first test. """ if not self.buffer_out: self.add_record() r = self.buffer_out[-1] if isinstance(r, TLS13): self.buffer_out[-1].inner.msg.append(pkt) else: self.buffer_out[-1].msg.append(pkt) def flush_records(self): """ Send all buffered records and update the session accordingly. """ s = b"".join(p.raw_stateful() for p in self.buffer_out) self.socket.send(s) self.buffer_out = [] def vprint(self, s=""): if self.verbose: if conf.interactive: log_interactive.info("> %s", s) else: print("> %s" % s)
4,226
6,034
package cn.iocoder.mall.order.api.dto; import lombok.Data; import lombok.experimental.Accessors; import java.io.Serializable; /** * * 订单评论 query * */ @Data @Accessors(chain = true) public class OrderCommentPageDTO implements Serializable { /** * 商品 sku id */ private Integer productSkuId; /** * 页码 */ private Integer pageNo; /** * 每页条数 */ private Integer pageSize; }
204
2,068
package com.base.entity; /** * Created by baixiaokang on 16/5/5. */ public class CreatedResult { public String createdAt; public String objectId; public String url; }
63
3,609
<reponame>peppingdore/tracy<gh_stars>1000+ #ifndef __TRACY__THREADCOMPRESS_HPP__ #define __TRACY__THREADCOMPRESS_HPP__ #include <assert.h> #include <stdint.h> #include "../common/TracyForceInline.hpp" #include "tracy_robin_hood.h" #include "TracyVector.hpp" namespace tracy { class FileRead; class FileWrite; class ThreadCompress { public: ThreadCompress(); void InitZero(); void Load( FileRead& f, int fileVer ); void Save( FileWrite& f ) const; tracy_force_inline uint16_t CompressThread( uint64_t thread ) { if( m_threadLast.first == thread ) return m_threadLast.second; return CompressThreadReal( thread ); } tracy_force_inline uint64_t DecompressThread( uint16_t thread ) const { assert( thread < m_threadExpand.size() ); return m_threadExpand[thread]; } tracy_force_inline uint16_t DecompressMustRaw( uint64_t thread ) const { auto it = m_threadMap.find( thread ); assert( it != m_threadMap.end() ); return it->second; } tracy_force_inline bool Exists( uint64_t thread ) const { return m_threadMap.find( thread ) != m_threadMap.end(); } private: uint16_t CompressThreadReal( uint64_t thread ); uint16_t CompressThreadNew( uint64_t thread ); unordered_flat_map<uint64_t, uint16_t> m_threadMap; Vector<uint64_t> m_threadExpand; std::pair<uint64_t, uint16_t> m_threadLast; }; } #endif
603
376
// Copyright (C) 2020 <NAME> // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp #include <Nazara/Core/ModuleBase.hpp> #include <Nazara/Core/Log.hpp> #include <Nazara/Core/Debug.hpp> namespace Nz { template<typename T> ModuleBase<T>::ModuleBase(std::string moduleName, T* pointer) : ModuleBase(std::move(moduleName), pointer, NoLog{}) { LogInit(); } template<typename T> ModuleBase<T>::ModuleBase(std::string moduleName, T* pointer, NoLog) : m_moduleName(std::move(moduleName)) { NazaraAssert(T::s_instance == nullptr, "only one instance of " + m_moduleName + " must exist at a given time"); T::s_instance = pointer; } template<typename T> ModuleBase<T>::~ModuleBase() { LogUninit(); T::s_instance = nullptr; } template<typename T> T* ModuleBase<T>::Instance() { return T::s_instance; } template<typename T> void ModuleBase<T>::LogInit() { NazaraNotice("Initializing " + m_moduleName + "..."); } template<typename T> void ModuleBase<T>::LogUninit() { if (m_moduleName.empty()) return; NazaraNotice("Uninitialized " + m_moduleName); m_moduleName.clear(); } } #include <Nazara/Core/DebugOff.hpp>
477
4,756
<gh_stars>1000+ // Copyright 2020 The MACE Authors. All Rights Reserved. // // 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. #include "mace/core/flow/base_flow.h" #include <functional> #include "mace/core/mace_tensor_impl.h" #include "mace/core/net_def_adapter.h" #include "mace/core/proto/net_def_helper.h" #include "mace/utils/math.h" #include "mace/utils/stl_util.h" #include "mace/utils/transpose.h" namespace mace { BaseFlow::BaseFlow(FlowContext *flow_context) : net_(nullptr), ws_(make_unique<Workspace>(flow_context->op_delegator_registry, this)), is_quantized_model_(false), op_registry_(flow_context->op_registry), config_impl_(flow_context->config_impl), cpu_runtime_(flow_context->cpu_runtime), main_runtime_(flow_context->main_runtime), thread_pool_(flow_context->thread_pool), parent_engine_(flow_context->parent_engine) {} const std::string &BaseFlow::GetName() const { return name_; } const BaseEngine *BaseFlow::GetMaceEngine() const { return parent_engine_; } MaceStatus BaseFlow::Init(const NetDef *net_def, const unsigned char *model_data, const int64_t model_data_size, bool *model_data_unused) { name_ = net_def->name(); // Mark quantized model flag is_quantized_model_ = NetDefHelper::IsQuantizedModel(*net_def); net_data_type_ = net_def->data_type(); // Get input and output information. for (auto &input_info : net_def->input_info()) { input_info_map_[input_info.name()] = input_info; } for (auto &output_info : net_def->output_info()) { output_info_map_[output_info.name()] = output_info; } MACE_RETURN_IF_ERROR(InitInputTensors()); MACE_RETURN_IF_ERROR(AllocateBufferForInputTensors()); MACE_UNUSED(model_data); MACE_UNUSED(model_data_size); MACE_UNUSED(model_data_unused); return MaceStatus::MACE_SUCCESS; } MaceStatus BaseFlow::Run(const std::map<std::string, MaceTensor> &inputs, std::map<std::string, MaceTensor> *outputs, RunMetadata *run_metadata) { MACE_CHECK_NOTNULL(outputs); TensorMap input_tensors; TensorMap output_tensors; // Create and Transpose input tensors for (auto &input : inputs) { if (input_info_map_.find(input.first) == input_info_map_.end()) { LOG(FATAL) << "'" << input.first << "' does not belong to model's inputs: " << MakeString(MapKeys(input_info_map_)); } Tensor *input_tensor = ws_->GetTensor(input.first); MACE_RETURN_IF_ERROR(TransposeInput(input, input_tensor)); input_tensors[input.first] = input_tensor; } // Create output tensors for (auto &output : *outputs) { if (output_info_map_.find(output.first) == output_info_map_.end()) { LOG(FATAL) << "'" << output.first << "' does not belong to model's outputs: " << MakeString(MapKeys(output_info_map_)); } Tensor *output_tensor = ws_->GetTensor(output.first); output_tensors[output.first] = output_tensor; } // Run Model MACE_RETURN_IF_ERROR(Run(&input_tensors, &output_tensors, run_metadata)); // Transpose output tensors for (auto &output : *outputs) { Tensor *output_tensor = ws_->GetTensor(output.first); // save output MACE_RETURN_IF_ERROR(TransposeOutput(*output_tensor, &output)); } return MaceStatus::MACE_SUCCESS; } MaceStatus BaseFlow::FakeWarmup() { return MaceStatus::MACE_SUCCESS; } MaceStatus BaseFlow::AllocateIntermediateBuffer() { MACE_RETURN_IF_ERROR(AllocateBufferForInputTensors()); if (net_ != nullptr) { MACE_RETURN_IF_ERROR(net_->AllocateIntermediateBuffer()); } return MaceStatus::MACE_SUCCESS; } MaceStatus BaseFlow::TransposeInput( const std::pair<const std::string, MaceTensor> &input, Tensor *input_tensor) { std::vector<int> dst_dims; DataFormat data_format = DataFormat::NONE; MACE_RETURN_IF_ERROR(GetInputTransposeDims( input, input_tensor, &dst_dims, &data_format)); // Resize the input tensor std::vector<index_t> output_shape = input.second.shape(); if (!dst_dims.empty()) { output_shape = TransposeShape<int64_t, index_t>(input.second.shape(), dst_dims); } MACE_RETURN_IF_ERROR(input_tensor->Resize(output_shape)); // Transpose or copy the mace tensor's data to input tensor auto status = TransposeInputByDims(input.second, input_tensor, dst_dims); // Set the data format input_tensor->set_data_format(data_format); return status; } MaceStatus BaseFlow::TransposeOutput( const mace::Tensor &output_tensor, std::pair<const std::string, mace::MaceTensor> *output) { MACE_CHECK(output->second.data() != nullptr); // Get the transpose rule std::vector<int> dst_dims = GetOutputTransposeDims(output_tensor, output); // Set the output's shape std::vector<index_t> shape = output_tensor.shape(); if (!dst_dims.empty()) { shape = TransposeShape<index_t, index_t>(output_tensor.shape(), dst_dims); } int64_t output_size = std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<int64_t>()); VLOG(1) << "output_tensor name: " << output_tensor.name(); MACE_CHECK(output_size <= output->second.impl_->buffer_size) << "Output size exceeds buffer size: shape" << MakeString<int64_t>(shape) << " vs buffer size " << output->second.impl_->buffer_size; output->second.impl_->shape = shape; // Transpose output tensor return TransposeOutputByDims(output_tensor, &(output->second), dst_dims); } std::vector<int> BaseFlow::GetOutputTransposeDims( const mace::Tensor &output_tensor, std::pair<const std::string, mace::MaceTensor> *output) { std::vector<int> dst_dims; if (output_tensor.data_format() != DataFormat::NONE && output->second.data_format() != DataFormat::NONE && output->second.shape().size() == 4 && output->second.data_format() != output_tensor.data_format()) { VLOG(1) << "Transpose output " << output->first << " from " << static_cast<int>(output_tensor.data_format()) << " to " << static_cast<int>(output->second.data_format()); if (output_tensor.data_format() == DataFormat::NCHW && output->second.data_format() == DataFormat::NHWC) { dst_dims = {0, 2, 3, 1}; } else if (output_tensor.data_format() == DataFormat::NHWC && output->second.data_format() == DataFormat::NCHW) { dst_dims = {0, 3, 1, 2}; } else { LOG(FATAL) << "Not supported output data format: " << static_cast<int>(output->second.data_format()) << " vs " << static_cast<int>(output_tensor.data_format()); } } return dst_dims; } MaceStatus BaseFlow::TransposeOutputByDims(const mace::Tensor &output_tensor, MaceTensor *mace_tensor, const std::vector<int> &dst_dims) { auto output_dt = output_tensor.dtype(); if (!dst_dims.empty()) { if (output_dt == DataType::DT_INT32) { Tensor::MappingGuard output_guard(&output_tensor); auto output_data = output_tensor.data<int>(); MACE_RETURN_IF_ERROR(ops::Transpose( thread_pool_, output_data, output_tensor.shape(), dst_dims, mace_tensor->data<int>().get())); } else { LOG(FATAL) << "MACE do not support the output data type: " << output_dt; } } else { if (output_dt == DataType::DT_INT32) { Tensor::MappingGuard output_guard(&output_tensor); std::memcpy(mace_tensor->data<int>().get(), output_tensor.data<int>(), output_tensor.size() * sizeof(int)); } else { LOG(FATAL) << "MACE do not support the output data type: " << output_dt; } } return MaceStatus::MACE_SUCCESS; } Tensor *BaseFlow::CreateInputTensor(const std::string &input_name, DataType input_dt) { const auto mem_type = main_runtime_->GetBaseMemoryType(); const auto runtime_type = main_runtime_->GetRuntimeType(); if (runtime_type == RT_OPENCL && input_dt == DT_FLOAT16) { // For GPU, DT_FLOAT16 is DT_HALF input_dt = DT_HALF; } else if (net_data_type_ != DT_FLOAT16 && runtime_type == RT_CPU && input_dt == DT_FLOAT16) { // For CPU, when it is a fp16_fp16 model, use DT_FLOAT16, // when it is a fp16_fp32 model, use DT_FLOAT input_dt = DT_FLOAT; } return ws_->CreateTensor(input_name, main_runtime_, input_dt, false, mem_type); } MaceStatus BaseFlow::GetInputTransposeDims( const std::pair<const std::string, MaceTensor> &input, const Tensor *input_tensor, std::vector<int> *dst_dims, DataFormat *data_format) { MACE_UNUSED(input_tensor); *dst_dims = {}; *data_format = input.second.data_format(); return MaceStatus::MACE_SUCCESS; } MaceStatus BaseFlow::TransposeInputByDims(const MaceTensor &mace_tensor, Tensor *input_tensor, const std::vector<int> &dst_dims) { DataType input_dt = input_tensor->dtype(); if (!dst_dims.empty()) { if (input_dt == DataType::DT_INT32) { MACE_CHECK(mace_tensor.data_type() == IDT_INT32, "Invalid data type."); Tensor::MappingGuard input_guard(input_tensor); auto input_data = input_tensor->mutable_data<int>(); return ops::Transpose(thread_pool_, mace_tensor.data<int>().get(), mace_tensor.shape(), dst_dims, input_data); } else { LOG(FATAL) << "MACE do not support the input data type: " << input_dt; } } else { if (input_dt == DataType::DT_INT32) { MACE_CHECK(mace_tensor.data_type() == IDT_INT32, "Invalid data type."); Tensor::MappingGuard input_guard(input_tensor); ops::CopyDataBetweenSameType( thread_pool_, mace_tensor.data().get(), input_tensor->mutable_data<int>(), input_tensor->raw_size()); } else { LOG(FATAL) << "MACE do not support the input data type: " << input_dt; } } return MaceStatus::MACE_SUCCESS; } MaceStatus BaseFlow::InitInputTensors() { for (auto &input : input_info_map_) { const auto &input_name = input.first; const auto &input_info = input.second; DataType input_dt = input_info.data_type(); Tensor *input_tensor = CreateInputTensor(input_name, input_dt); // Resize to possible largest shape to avoid resize during running. std::vector<index_t> shape(input_info.dims_size()); for (int i = 0; i < input_info.dims_size(); ++i) { shape[i] = input_info.dims(i); } input_tensor->Reshape(shape); // Set to the default data format input_tensor->set_data_format( static_cast<DataFormat>(input_info.data_format())); } return MaceStatus::MACE_SUCCESS; } MaceStatus BaseFlow::AllocateBufferForInputTensors() { for (auto &input : input_info_map_) { const auto &input_name = input.first; Tensor *input_tensor = ws_->GetTensor(input_name); MACE_RETURN_IF_ERROR(main_runtime_->AllocateBufferForTensor( input_tensor, BufRentType::RENT_SHARE)); } return MaceStatus::MACE_SUCCESS; } MaceStatus BaseFlow::InitOutputTensor() { for (auto &output : output_info_map_) { const auto &output_name = output.first; const auto &output_info = output.second; DataType output_dt = output_info.data_type(); Tensor *output_tensor = ws_->CreateTensor(output_name, main_runtime_, output_dt); output_tensor->set_data_format(DataFormat::NHWC); } return MaceStatus::MACE_SUCCESS; } } // namespace mace
5,196
1,795
#!/usr/bin/python # coding=utf-8 ########################################################################## from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch from diamond.collector import Collector from nfacct import NetfilterAccountingCollector ########################################################################## class TestNetfilterAccountingCollector(CollectorTestCase): def setUp(self): config = get_collector_config('NetfilterAccountingCollector', { 'interval': 10, 'bin': 'true', }) self.collector = NetfilterAccountingCollector(config, None) def test_import(self): self.assertTrue(NetfilterAccountingCollector) @patch.object(Collector, 'publish') def test_no_counters(self, publish_mock): patch_communicate = patch( 'subprocess.Popen.communicate', Mock(return_value=('', ''))) patch_communicate.start() self.collector.collect() patch_communicate.stop() self.assertPublishedMany(publish_mock, {}) @patch.object(Collector, 'publish') def test_counters(self, publish_mock): patch_communicate = patch( 'subprocess.Popen.communicate', Mock(return_value=(self.getFixture('nfacct').getvalue(), ''))) patch_communicate.start() self.collector.collect() patch_communicate.stop() self.assertPublishedMany(publish_mock, { 'Tcp.pkts': 3, 'Tcp.bytes': 300, 'Udp.pkts': 0, 'Udp.bytes': 0, 'Tcp.Incoming.pkts': 1, 'Tcp.Incoming.bytes': 100, 'Tcp.Outgoing.pkts': 2, 'Tcp.Outgoing.bytes': 200, }) ########################################################################## if __name__ == "__main__": unittest.main()
779
703
<reponame>fengjixuchui/libpeconv<gh_stars>100-1000 #include "peconv/imports_loader.h" #include <iostream> using namespace peconv; class FillImportThunks : public ImportThunksCallback { public: FillImportThunks(BYTE* _modulePtr, size_t _moduleSize, t_function_resolver* func_resolver) : ImportThunksCallback(_modulePtr, _moduleSize), funcResolver(func_resolver) { } virtual bool processThunks(LPSTR lib_name, ULONG_PTR origFirstThunkPtr, ULONG_PTR firstThunkPtr) { if (this->is64b) { #ifdef _WIN64 // loader is 64 bit, allow to load imports for 64-bit payload: IMAGE_THUNK_DATA64* desc = reinterpret_cast<IMAGE_THUNK_DATA64*>(origFirstThunkPtr); ULONGLONG* call_via = reinterpret_cast<ULONGLONG*>(firstThunkPtr); return processThunks_tpl<ULONGLONG, IMAGE_THUNK_DATA64>(lib_name, desc, call_via, IMAGE_ORDINAL_FLAG64); #else std::cerr << "[!] Cannot fill imports into 64 bit PE via 32 bit loader!\n"; return false; #endif } else { #ifndef _WIN64 // loader is 32 bit, allow to load imports for 32-bit payload: IMAGE_THUNK_DATA32* desc = reinterpret_cast<IMAGE_THUNK_DATA32*>(origFirstThunkPtr); DWORD* call_via = reinterpret_cast<DWORD*>(firstThunkPtr); return processThunks_tpl<DWORD, IMAGE_THUNK_DATA32>(lib_name, desc, call_via, IMAGE_ORDINAL_FLAG32); #else std::cerr << "[!] Cannot fill imports into 32 bit PE via 64 bit loader!\n"; return false; #endif } } protected: template <typename T_FIELD, typename T_IMAGE_THUNK_DATA> bool processThunks_tpl(LPSTR lib_name, T_IMAGE_THUNK_DATA* desc, T_FIELD* call_via, T_FIELD ordinal_flag) { if (!this->funcResolver) { return false; } bool is_by_ord = (desc->u1.Ordinal & ordinal_flag) != 0; FARPROC hProc = nullptr; if (is_by_ord) { T_FIELD raw_ordinal = desc->u1.Ordinal & (~ordinal_flag); #ifdef _DEBUG std::cout << "raw ordinal: " << std::hex << raw_ordinal << std::endl; #endif hProc = funcResolver->resolve_func(lib_name, MAKEINTRESOURCEA(raw_ordinal)); } else { PIMAGE_IMPORT_BY_NAME by_name = (PIMAGE_IMPORT_BY_NAME)((ULONGLONG)modulePtr + desc->u1.AddressOfData); LPSTR func_name = reinterpret_cast<LPSTR>(by_name->Name); #ifdef _DEBUG std::cout << "name: " << func_name << std::endl; #endif hProc = this->funcResolver->resolve_func(lib_name, func_name); } if (!hProc) { #ifdef _DEBUG std::cerr << "Could not resolve the function!" << std::endl; #endif return false; } (*call_via) = reinterpret_cast<T_FIELD>(hProc); return true; } //fields: t_function_resolver* funcResolver; }; template <typename T_FIELD, typename T_IMAGE_THUNK_DATA> bool process_imp_functions_tpl(BYTE* modulePtr, size_t module_size, LPSTR lib_name, DWORD call_via, DWORD thunk_addr, IN ImportThunksCallback *callback) { bool is_ok = true; T_FIELD *thunks = (T_FIELD*)((ULONGLONG)modulePtr + thunk_addr); T_FIELD *callers = (T_FIELD*)((ULONGLONG)modulePtr + call_via); for (size_t index = 0; true; index++) { if (!validate_ptr(modulePtr, module_size, &callers[index], sizeof(T_FIELD))) { break; } if (!validate_ptr(modulePtr, module_size, &thunks[index], sizeof(T_FIELD))) { break; } if (callers[index] == 0) { //nothing to fill, probably the last record return true; } LPVOID thunk_ptr = &thunks[index]; T_IMAGE_THUNK_DATA* desc = reinterpret_cast<T_IMAGE_THUNK_DATA*>(thunk_ptr); if (!validate_ptr(modulePtr, module_size, desc, sizeof(T_IMAGE_THUNK_DATA))) { break; } if (desc->u1.Function == NULL) { break; } T_FIELD ordinal_flag = (sizeof(T_FIELD) == sizeof(ULONGLONG)) ? IMAGE_ORDINAL_FLAG64 : IMAGE_ORDINAL_FLAG32; bool is_by_ord = (desc->u1.Ordinal & ordinal_flag) != 0; if (!is_by_ord) { PIMAGE_IMPORT_BY_NAME by_name = (PIMAGE_IMPORT_BY_NAME)((ULONGLONG)modulePtr + desc->u1.AddressOfData); if (!validate_ptr(modulePtr, module_size, by_name, sizeof(IMAGE_IMPORT_BY_NAME))) { break; } } //when the callback is called, all the pointers should be already verified if (!callback->processThunks(lib_name, (ULONG_PTR)&thunks[index], (ULONG_PTR)&callers[index])) { is_ok = false; } } return is_ok; } //Walk through the table of imported DLLs (starting from the given descriptor) and execute the callback each time when the new record was found bool process_dlls(BYTE* modulePtr, size_t module_size, IMAGE_IMPORT_DESCRIPTOR *first_desc, IN ImportThunksCallback *callback) { bool isAllFilled = true; #ifdef _DEBUG std::cout << "---IMP---" << std::endl; #endif const bool is64 = is64bit((BYTE*)modulePtr); IMAGE_IMPORT_DESCRIPTOR* lib_desc = nullptr; for (size_t i = 0; true; i++) { lib_desc = &first_desc[i]; if (!validate_ptr(modulePtr, module_size, lib_desc, sizeof(IMAGE_IMPORT_DESCRIPTOR))) { break; } if (lib_desc->OriginalFirstThunk == NULL && lib_desc->FirstThunk == NULL) { break; } LPSTR lib_name = (LPSTR)((ULONGLONG)modulePtr + lib_desc->Name); if (!peconv::is_valid_import_name(modulePtr, module_size, lib_name)) { //invalid name return false; } DWORD call_via = lib_desc->FirstThunk; DWORD thunk_addr = lib_desc->OriginalFirstThunk; if (thunk_addr == NULL) { thunk_addr = lib_desc->FirstThunk; } #ifdef _DEBUG std::cout << "Imported Lib: " << std::hex << lib_desc->FirstThunk << " : " << std::hex << lib_desc->OriginalFirstThunk << " : " << lib_desc->Name << std::endl; #endif size_t all_solved = false; if (is64) { all_solved = process_imp_functions_tpl<ULONGLONG, IMAGE_THUNK_DATA64>(modulePtr, module_size, lib_name, call_via, thunk_addr, callback); } else { all_solved = process_imp_functions_tpl<DWORD, IMAGE_THUNK_DATA32>(modulePtr, module_size, lib_name, call_via, thunk_addr, callback); } if (!all_solved) { isAllFilled = false; } } #ifdef _DEBUG printf("---------\n"); #endif return isAllFilled; } bool peconv::process_import_table(IN BYTE* modulePtr, IN SIZE_T moduleSize, IN ImportThunksCallback *callback) { if (moduleSize == 0) { //if not given, try to fetch moduleSize = peconv::get_image_size((const BYTE*)modulePtr); } if (moduleSize == 0) return false; IMAGE_DATA_DIRECTORY *importsDir = get_directory_entry((BYTE*)modulePtr, IMAGE_DIRECTORY_ENTRY_IMPORT); if (!importsDir) { return true; //no import table } const DWORD impAddr = importsDir->VirtualAddress; IMAGE_IMPORT_DESCRIPTOR *first_desc = (IMAGE_IMPORT_DESCRIPTOR*)(impAddr + (ULONG_PTR)modulePtr); if (!peconv::validate_ptr(modulePtr, moduleSize, first_desc, sizeof(IMAGE_IMPORT_DESCRIPTOR))) { return false; } return process_dlls(modulePtr, moduleSize, first_desc, callback); } bool peconv::load_imports(BYTE* modulePtr, t_function_resolver* func_resolver) { size_t moduleSize = peconv::get_image_size((const BYTE*)modulePtr); if (moduleSize == 0) return false; bool is64 = is64bit((BYTE*)modulePtr); bool is_loader64 = false; #ifdef _WIN64 is_loader64 = true; #endif if (is64 != is_loader64) { std::cerr << "[ERROR] Loader/Payload bitness mismatch.\n"; return false; } default_func_resolver default_res; if (!func_resolver) { func_resolver = (t_function_resolver*)&default_res; } FillImportThunks callback(modulePtr, moduleSize, func_resolver); return peconv::process_import_table(modulePtr, moduleSize, &callback); } // A valid name must contain printable characters. Empty name is also acceptable (may have been erased) bool peconv::is_valid_import_name(const PBYTE modulePtr, const size_t moduleSize, LPSTR lib_name) { while (true) { if (!peconv::validate_ptr(modulePtr, moduleSize, lib_name, sizeof(char))) { return false; } char next_char = *lib_name; if (next_char == '\0') break; if (next_char <= 0x20 || next_char >= 0x7E) { return false; } lib_name++; } return true; } bool peconv::has_valid_import_table(const PBYTE modulePtr, size_t moduleSize) { IMAGE_DATA_DIRECTORY *importsDir = get_directory_entry((BYTE*)modulePtr, IMAGE_DIRECTORY_ENTRY_IMPORT); if (importsDir == NULL) return false; const DWORD impAddr = importsDir->VirtualAddress; IMAGE_IMPORT_DESCRIPTOR* lib_desc = NULL; DWORD parsedSize = 0; size_t valid_records = 0; while (true) { //size of the import table doesn't matter lib_desc = (IMAGE_IMPORT_DESCRIPTOR*)(impAddr + parsedSize + (ULONG_PTR)modulePtr); if (!peconv::validate_ptr(modulePtr, moduleSize, lib_desc, sizeof(IMAGE_IMPORT_DESCRIPTOR))) { return false; } parsedSize += sizeof(IMAGE_IMPORT_DESCRIPTOR); if (lib_desc->OriginalFirstThunk == NULL && lib_desc->FirstThunk == NULL) { break; } LPSTR lib_name = (LPSTR)((ULONGLONG)modulePtr + lib_desc->Name); if (!is_valid_import_name(modulePtr, moduleSize, lib_name)) return false; DWORD call_via = lib_desc->FirstThunk; DWORD thunk_addr = lib_desc->OriginalFirstThunk; if (thunk_addr == NULL) thunk_addr = lib_desc->FirstThunk; DWORD *thunks = (DWORD*)((ULONGLONG)modulePtr + thunk_addr); if (!peconv::validate_ptr(modulePtr, moduleSize, thunks, sizeof(DWORD))) return false; DWORD *callers = (DWORD*)((ULONGLONG)modulePtr + call_via); if (!peconv::validate_ptr(modulePtr, moduleSize, callers, sizeof(DWORD))) return false; valid_records++; } return (valid_records > 0); }
4,532
834
// This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface // (the "Fluent UI") and is provided only as referential material to supplement the // Microsoft Foundation Classes Reference and related electronic documentation // included with the MFC C++ library software. // License terms to copy, use or distribute the Fluent UI are available separately. // To learn more about our Fluent UI licensing program, please visit // http://msdn.microsoft.com/officeui. // // Copyright (C) Microsoft Corporation // All rights reserved. #pragma once ///////////////////////////////////////////////////////////////////////////// // CRibbonTooltipCtrl window class CRibbonTooltipCtrl : public CMFCToolTipCtrl { DECLARE_DYNCREATE(CRibbonTooltipCtrl) // Construction public: CRibbonTooltipCtrl(); // Attributes protected: CMFCRibbonPanelMenuBar* m_pParentMenuBar; CMFCRibbonBar* m_pParentRibbon; UINT m_nID; // Overrides public: virtual CSize GetIconSize(); virtual BOOL OnDrawIcon(CDC* pDC, CRect rectImage); // Implementation public: virtual ~CRibbonTooltipCtrl(); // Generated message map functions protected: //{{AFX_MSG(CRibbonTooltipCtrl) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnShow(NMHDR* pNMHDR, LRESULT* pResult); //}}AFX_MSG DECLARE_MESSAGE_MAP() };
415
1,314
package cn.dreampie.common.http; /** * Created by wangrenhui on 15/1/10. */ public class HttpMethod { public static final String GET = "GET"; public static final String POST = "POST"; public static final String PUT = "PUT"; public static final String DELETE = "DELETE"; //jdk7- not support public static final String PATCH = "PATCH"; //cors public static final String OPTIONS = "OPTIONS"; //not filter public static final String HEAD = "HEAD"; public static boolean support(String httpMethod) { return GET.equals(httpMethod) || POST.equals(httpMethod) || PUT.equals(httpMethod) || DELETE.equals(httpMethod) || PATCH.equals(httpMethod); } }
227
445
<reponame>simnalamburt/ruby-packer /********************************************************************** regexec.c - Onigmo (Oniguruma-mod) (regular expression library) **********************************************************************/ /*- * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp> * Copyright (c) 2011-2016 K.Takata <kentkt AT csc DOT jp> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #include "regint.h" #ifdef RUBY # undef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE #else # define USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE #endif #ifndef USE_TOKEN_THREADED_VM # ifdef __GNUC__ # define USE_TOKEN_THREADED_VM 1 # else # define USE_TOKEN_THREADED_VM 0 # endif #endif #ifdef RUBY # define ENC_DUMMY_FLAG (1<<24) static inline int rb_enc_asciicompat(OnigEncoding enc) { return ONIGENC_MBC_MINLEN(enc)==1 && !((enc)->ruby_encoding_index & ENC_DUMMY_FLAG); } # undef ONIGENC_IS_MBC_ASCII_WORD # define ONIGENC_IS_MBC_ASCII_WORD(enc,s,end) \ (rb_enc_asciicompat(enc) ? (ISALNUM(*s) || *s=='_') : \ onigenc_ascii_is_code_ctype( \ ONIGENC_MBC_TO_CODE(enc,s,end),ONIGENC_CTYPE_WORD,enc)) #endif /* RUBY */ #ifdef USE_CRNL_AS_LINE_TERMINATOR # define ONIGENC_IS_MBC_CRNL(enc,p,end) \ (ONIGENC_MBC_TO_CODE(enc,p,end) == 13 && \ ONIGENC_MBC_TO_CODE(enc,(p+enclen(enc,p,end)),end) == 10) # define ONIGENC_IS_MBC_NEWLINE_EX(enc,p,start,end,option,check_prev) \ is_mbc_newline_ex((enc),(p),(start),(end),(option),(check_prev)) static int is_mbc_newline_ex(OnigEncoding enc, const UChar *p, const UChar *start, const UChar *end, OnigOptionType option, int check_prev) { if (IS_NEWLINE_CRLF(option)) { if (ONIGENC_MBC_TO_CODE(enc, p, end) == 0x0a) { if (check_prev) { const UChar *prev = onigenc_get_prev_char_head(enc, start, p, end); if ((prev != NULL) && ONIGENC_MBC_TO_CODE(enc, prev, end) == 0x0d) return 0; else return 1; } else return 1; } else { const UChar *pnext = p + enclen(enc, p, end); if (pnext < end && ONIGENC_MBC_TO_CODE(enc, p, end) == 0x0d && ONIGENC_MBC_TO_CODE(enc, pnext, end) == 0x0a) return 1; if (ONIGENC_IS_MBC_NEWLINE(enc, p, end)) return 1; return 0; } } else { return ONIGENC_IS_MBC_NEWLINE(enc, p, end); } } #else /* USE_CRNL_AS_LINE_TERMINATOR */ # define ONIGENC_IS_MBC_NEWLINE_EX(enc,p,start,end,option,check_prev) \ ONIGENC_IS_MBC_NEWLINE((enc), (p), (end)) #endif /* USE_CRNL_AS_LINE_TERMINATOR */ #ifdef USE_CAPTURE_HISTORY static void history_tree_free(OnigCaptureTreeNode* node); static void history_tree_clear(OnigCaptureTreeNode* node) { int i; if (IS_NOT_NULL(node)) { for (i = 0; i < node->num_childs; i++) { if (IS_NOT_NULL(node->childs[i])) { history_tree_free(node->childs[i]); } } for (i = 0; i < node->allocated; i++) { node->childs[i] = (OnigCaptureTreeNode* )0; } node->num_childs = 0; node->beg = ONIG_REGION_NOTPOS; node->end = ONIG_REGION_NOTPOS; node->group = -1; xfree(node->childs); node->childs = (OnigCaptureTreeNode** )0; } } static void history_tree_free(OnigCaptureTreeNode* node) { history_tree_clear(node); xfree(node); } static void history_root_free(OnigRegion* r) { if (IS_NOT_NULL(r->history_root)) { history_tree_free(r->history_root); r->history_root = (OnigCaptureTreeNode* )0; } } static OnigCaptureTreeNode* history_node_new(void) { OnigCaptureTreeNode* node; node = (OnigCaptureTreeNode* )xmalloc(sizeof(OnigCaptureTreeNode)); CHECK_NULL_RETURN(node); node->childs = (OnigCaptureTreeNode** )0; node->allocated = 0; node->num_childs = 0; node->group = -1; node->beg = ONIG_REGION_NOTPOS; node->end = ONIG_REGION_NOTPOS; return node; } static int history_tree_add_child(OnigCaptureTreeNode* parent, OnigCaptureTreeNode* child) { # define HISTORY_TREE_INIT_ALLOC_SIZE 8 if (parent->num_childs >= parent->allocated) { int n, i; if (IS_NULL(parent->childs)) { n = HISTORY_TREE_INIT_ALLOC_SIZE; parent->childs = (OnigCaptureTreeNode** )xmalloc(sizeof(OnigCaptureTreeNode*) * n); CHECK_NULL_RETURN_MEMERR(parent->childs); } else { OnigCaptureTreeNode** tmp; n = parent->allocated * 2; tmp = (OnigCaptureTreeNode** )xrealloc(parent->childs, sizeof(OnigCaptureTreeNode*) * n); if (tmp == 0) { history_tree_clear(parent); return ONIGERR_MEMORY; } parent->childs = tmp; } for (i = parent->allocated; i < n; i++) { parent->childs[i] = (OnigCaptureTreeNode* )0; } parent->allocated = n; } parent->childs[parent->num_childs] = child; parent->num_childs++; return 0; } static OnigCaptureTreeNode* history_tree_clone(OnigCaptureTreeNode* node) { int i, r; OnigCaptureTreeNode *clone, *child; clone = history_node_new(); CHECK_NULL_RETURN(clone); clone->beg = node->beg; clone->end = node->end; for (i = 0; i < node->num_childs; i++) { child = history_tree_clone(node->childs[i]); if (IS_NULL(child)) { history_tree_free(clone); return (OnigCaptureTreeNode* )0; } r = history_tree_add_child(clone, child); if (r != 0) { history_tree_free(child); history_tree_free(clone); return (OnigCaptureTreeNode* )0; } } return clone; } extern OnigCaptureTreeNode* onig_get_capture_tree(OnigRegion* region) { return region->history_root; } #endif /* USE_CAPTURE_HISTORY */ extern void onig_region_clear(OnigRegion* region) { int i; for (i = 0; i < region->num_regs; i++) { region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS; } #ifdef USE_CAPTURE_HISTORY history_root_free(region); #endif } extern int onig_region_resize(OnigRegion* region, int n) { region->num_regs = n; if (n < ONIG_NREGION) n = ONIG_NREGION; if (region->allocated == 0) { region->beg = (OnigPosition* )xmalloc(n * sizeof(OnigPosition)); if (region->beg == 0) return ONIGERR_MEMORY; region->end = (OnigPosition* )xmalloc(n * sizeof(OnigPosition)); if (region->end == 0) { xfree(region->beg); return ONIGERR_MEMORY; } region->allocated = n; } else if (region->allocated < n) { OnigPosition *tmp; region->allocated = 0; tmp = (OnigPosition* )xrealloc(region->beg, n * sizeof(OnigPosition)); if (tmp == 0) { xfree(region->beg); xfree(region->end); return ONIGERR_MEMORY; } region->beg = tmp; tmp = (OnigPosition* )xrealloc(region->end, n * sizeof(OnigPosition)); if (tmp == 0) { xfree(region->beg); xfree(region->end); return ONIGERR_MEMORY; } region->end = tmp; region->allocated = n; } return 0; } static int onig_region_resize_clear(OnigRegion* region, int n) { int r; r = onig_region_resize(region, n); if (r != 0) return r; onig_region_clear(region); return 0; } extern int onig_region_set(OnigRegion* region, int at, int beg, int end) { if (at < 0) return ONIGERR_INVALID_ARGUMENT; if (at >= region->allocated) { int r = onig_region_resize(region, at + 1); if (r < 0) return r; } region->beg[at] = beg; region->end[at] = end; return 0; } extern void onig_region_init(OnigRegion* region) { region->num_regs = 0; region->allocated = 0; region->beg = (OnigPosition* )0; region->end = (OnigPosition* )0; region->history_root = (OnigCaptureTreeNode* )0; } extern OnigRegion* onig_region_new(void) { OnigRegion* r; r = (OnigRegion* )xmalloc(sizeof(OnigRegion)); if (r) onig_region_init(r); return r; } extern void onig_region_free(OnigRegion* r, int free_self) { if (r) { if (r->allocated > 0) { if (r->beg) xfree(r->beg); if (r->end) xfree(r->end); r->allocated = 0; } #ifdef USE_CAPTURE_HISTORY history_root_free(r); #endif if (free_self) xfree(r); } } extern void onig_region_copy(OnigRegion* to, const OnigRegion* from) { #define RREGC_SIZE (sizeof(int) * from->num_regs) int i, r; if (to == from) return; r = onig_region_resize(to, from->num_regs); if (r) return; for (i = 0; i < from->num_regs; i++) { to->beg[i] = from->beg[i]; to->end[i] = from->end[i]; } to->num_regs = from->num_regs; #ifdef USE_CAPTURE_HISTORY history_root_free(to); if (IS_NOT_NULL(from->history_root)) { to->history_root = history_tree_clone(from->history_root); } #endif } /** stack **/ #define INVALID_STACK_INDEX -1 /* stack type */ /* used by normal-POP */ #define STK_ALT 0x0001 #define STK_LOOK_BEHIND_NOT 0x0002 #define STK_POS_NOT 0x0003 /* handled by normal-POP */ #define STK_MEM_START 0x0100 #define STK_MEM_END 0x8200 #define STK_REPEAT_INC 0x0300 #define STK_STATE_CHECK_MARK 0x1000 /* avoided by normal-POP */ #define STK_NULL_CHECK_START 0x3000 #define STK_NULL_CHECK_END 0x5000 /* for recursive call */ #define STK_MEM_END_MARK 0x8400 #define STK_POS 0x0500 /* used when POP-POS */ #define STK_STOP_BT 0x0600 /* mark for "(?>...)" */ #define STK_REPEAT 0x0700 #define STK_CALL_FRAME 0x0800 #define STK_RETURN 0x0900 #define STK_VOID 0x0a00 /* for fill a blank */ #define STK_ABSENT_POS 0x0b00 /* for absent */ #define STK_ABSENT 0x0c00 /* absent inner loop marker */ /* stack type check mask */ #define STK_MASK_POP_USED 0x00ff #define STK_MASK_TO_VOID_TARGET 0x10ff #define STK_MASK_MEM_END_OR_MARK 0x8000 /* MEM_END or MEM_END_MARK */ #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE # define MATCH_ARG_INIT(msa, arg_option, arg_region, arg_start, arg_gpos) do {\ (msa).stack_p = (void* )0;\ (msa).options = (arg_option);\ (msa).region = (arg_region);\ (msa).start = (arg_start);\ (msa).gpos = (arg_gpos);\ (msa).best_len = ONIG_MISMATCH;\ } while(0) #else # define MATCH_ARG_INIT(msa, arg_option, arg_region, arg_start, arg_gpos) do {\ (msa).stack_p = (void* )0;\ (msa).options = (arg_option);\ (msa).region = (arg_region);\ (msa).start = (arg_start);\ (msa).gpos = (arg_gpos);\ } while(0) #endif #ifdef USE_COMBINATION_EXPLOSION_CHECK # define STATE_CHECK_BUFF_MALLOC_THRESHOLD_SIZE 16 # define STATE_CHECK_BUFF_INIT(msa, str_len, offset, state_num) do { \ if ((state_num) > 0 && str_len >= STATE_CHECK_STRING_THRESHOLD_LEN) {\ unsigned int size = (unsigned int )(((str_len) + 1) * (state_num) + 7) >> 3;\ offset = ((offset) * (state_num)) >> 3;\ if (size > 0 && offset < size && size < STATE_CHECK_BUFF_MAX_SIZE) {\ if (size >= STATE_CHECK_BUFF_MALLOC_THRESHOLD_SIZE) {\ (msa).state_check_buff = (void* )xmalloc(size);\ CHECK_NULL_RETURN_MEMERR((msa).state_check_buff);\ }\ else \ (msa).state_check_buff = (void* )xalloca(size);\ xmemset(((char* )((msa).state_check_buff)+(offset)), 0, \ (size_t )(size - (offset))); \ (msa).state_check_buff_size = size;\ }\ else {\ (msa).state_check_buff = (void* )0;\ (msa).state_check_buff_size = 0;\ }\ }\ else {\ (msa).state_check_buff = (void* )0;\ (msa).state_check_buff_size = 0;\ }\ } while(0) # define MATCH_ARG_FREE(msa) do {\ if ((msa).stack_p) xfree((msa).stack_p);\ if ((msa).state_check_buff_size >= STATE_CHECK_BUFF_MALLOC_THRESHOLD_SIZE) { \ if ((msa).state_check_buff) xfree((msa).state_check_buff);\ }\ } while(0) #else /* USE_COMBINATION_EXPLOSION_CHECK */ # define MATCH_ARG_FREE(msa) if ((msa).stack_p) xfree((msa).stack_p) #endif /* USE_COMBINATION_EXPLOSION_CHECK */ #define MAX_PTR_NUM 100 #define STACK_INIT(alloc_addr, heap_addr, ptr_num, stack_num) do {\ if (ptr_num > MAX_PTR_NUM) {\ alloc_addr = (char* )xmalloc(sizeof(OnigStackIndex) * (ptr_num));\ heap_addr = alloc_addr;\ if (msa->stack_p) {\ stk_alloc = (OnigStackType* )(msa->stack_p);\ stk_base = stk_alloc;\ stk = stk_base;\ stk_end = stk_base + msa->stack_n;\ } else {\ stk_alloc = (OnigStackType* )xalloca(sizeof(OnigStackType) * (stack_num));\ stk_base = stk_alloc;\ stk = stk_base;\ stk_end = stk_base + (stack_num);\ }\ } else if (msa->stack_p) {\ alloc_addr = (char* )xalloca(sizeof(OnigStackIndex) * (ptr_num));\ heap_addr = NULL;\ stk_alloc = (OnigStackType* )(msa->stack_p);\ stk_base = stk_alloc;\ stk = stk_base;\ stk_end = stk_base + msa->stack_n;\ }\ else {\ alloc_addr = (char* )xalloca(sizeof(OnigStackIndex) * (ptr_num)\ + sizeof(OnigStackType) * (stack_num));\ heap_addr = NULL;\ stk_alloc = (OnigStackType* )(alloc_addr + sizeof(OnigStackIndex) * (ptr_num));\ stk_base = stk_alloc;\ stk = stk_base;\ stk_end = stk_base + (stack_num);\ }\ } while(0) #define STACK_SAVE do{\ if (stk_base != stk_alloc) {\ msa->stack_p = stk_base;\ msa->stack_n = stk_end - stk_base; /* TODO: check overflow */\ };\ } while(0) static unsigned int MatchStackLimitSize = DEFAULT_MATCH_STACK_LIMIT_SIZE; extern unsigned int onig_get_match_stack_limit_size(void) { return MatchStackLimitSize; } extern int onig_set_match_stack_limit_size(unsigned int size) { MatchStackLimitSize = size; return 0; } static int stack_double(OnigStackType** arg_stk_base, OnigStackType** arg_stk_end, OnigStackType** arg_stk, OnigStackType* stk_alloc, OnigMatchArg* msa) { size_t n; OnigStackType *x, *stk_base, *stk_end, *stk; stk_base = *arg_stk_base; stk_end = *arg_stk_end; stk = *arg_stk; n = stk_end - stk_base; if (stk_base == stk_alloc && IS_NULL(msa->stack_p)) { x = (OnigStackType* )xmalloc(sizeof(OnigStackType) * n * 2); if (IS_NULL(x)) { STACK_SAVE; return ONIGERR_MEMORY; } xmemcpy(x, stk_base, n * sizeof(OnigStackType)); n *= 2; } else { unsigned int limit_size = MatchStackLimitSize; n *= 2; if (limit_size != 0 && n > limit_size) { if ((unsigned int )(stk_end - stk_base) == limit_size) return ONIGERR_MATCH_STACK_LIMIT_OVER; else n = limit_size; } x = (OnigStackType* )xrealloc(stk_base, sizeof(OnigStackType) * n); if (IS_NULL(x)) { STACK_SAVE; return ONIGERR_MEMORY; } } *arg_stk = x + (stk - stk_base); *arg_stk_base = x; *arg_stk_end = x + n; return 0; } #define STACK_ENSURE(n) do {\ if (stk_end - stk < (n)) {\ int r = stack_double(&stk_base, &stk_end, &stk, stk_alloc, msa);\ if (r != 0) {\ STACK_SAVE;\ if (xmalloc_base) xfree(xmalloc_base);\ return r;\ }\ }\ } while(0) #define STACK_AT(index) (stk_base + (index)) #define GET_STACK_INDEX(stk) ((stk) - stk_base) #define STACK_PUSH_TYPE(stack_type) do {\ STACK_ENSURE(1);\ stk->type = (stack_type);\ STACK_INC;\ } while(0) #define IS_TO_VOID_TARGET(stk) (((stk)->type & STK_MASK_TO_VOID_TARGET) != 0) #ifdef USE_COMBINATION_EXPLOSION_CHECK # define STATE_CHECK_POS(s,snum) \ (((s) - str) * num_comb_exp_check + ((snum) - 1)) # define STATE_CHECK_VAL(v,snum) do {\ if (state_check_buff != NULL) {\ int x = STATE_CHECK_POS(s,snum);\ (v) = state_check_buff[x/8] & (1<<(x%8));\ }\ else (v) = 0;\ } while(0) # define ELSE_IF_STATE_CHECK_MARK(stk) \ else if ((stk)->type == STK_STATE_CHECK_MARK) { \ int x = STATE_CHECK_POS(stk->u.state.pstr, stk->u.state.state_check);\ state_check_buff[x/8] |= (1<<(x%8)); \ } # define STACK_PUSH(stack_type,pat,s,sprev,keep) do {\ STACK_ENSURE(1);\ stk->type = (stack_type);\ stk->u.state.pcode = (pat);\ stk->u.state.pstr = (s);\ stk->u.state.pstr_prev = (sprev);\ stk->u.state.state_check = 0;\ stk->u.state.pkeep = (keep);\ STACK_INC;\ } while(0) # define STACK_PUSH_ENSURED(stack_type,pat) do {\ stk->type = (stack_type);\ stk->u.state.pcode = (pat);\ stk->u.state.state_check = 0;\ STACK_INC;\ } while(0) # define STACK_PUSH_ALT_WITH_STATE_CHECK(pat,s,sprev,snum,keep) do {\ STACK_ENSURE(1);\ stk->type = STK_ALT;\ stk->u.state.pcode = (pat);\ stk->u.state.pstr = (s);\ stk->u.state.pstr_prev = (sprev);\ stk->u.state.state_check = ((state_check_buff != NULL) ? (snum) : 0);\ stk->u.state.pkeep = (keep);\ STACK_INC;\ } while(0) # define STACK_PUSH_STATE_CHECK(s,snum) do {\ if (state_check_buff != NULL) {\ STACK_ENSURE(1);\ stk->type = STK_STATE_CHECK_MARK;\ stk->u.state.pstr = (s);\ stk->u.state.state_check = (snum);\ STACK_INC;\ }\ } while(0) #else /* USE_COMBINATION_EXPLOSION_CHECK */ # define ELSE_IF_STATE_CHECK_MARK(stk) # define STACK_PUSH(stack_type,pat,s,sprev,keep) do {\ STACK_ENSURE(1);\ stk->type = (stack_type);\ stk->u.state.pcode = (pat);\ stk->u.state.pstr = (s);\ stk->u.state.pstr_prev = (sprev);\ stk->u.state.pkeep = (keep);\ STACK_INC;\ } while(0) # define STACK_PUSH_ENSURED(stack_type,pat) do {\ stk->type = (stack_type);\ stk->u.state.pcode = (pat);\ STACK_INC;\ } while(0) #endif /* USE_COMBINATION_EXPLOSION_CHECK */ #define STACK_PUSH_ALT(pat,s,sprev,keep) STACK_PUSH(STK_ALT,pat,s,sprev,keep) #define STACK_PUSH_POS(s,sprev,keep) STACK_PUSH(STK_POS,NULL_UCHARP,s,sprev,keep) #define STACK_PUSH_POS_NOT(pat,s,sprev,keep) STACK_PUSH(STK_POS_NOT,pat,s,sprev,keep) #define STACK_PUSH_ABSENT STACK_PUSH_TYPE(STK_ABSENT) #define STACK_PUSH_STOP_BT STACK_PUSH_TYPE(STK_STOP_BT) #define STACK_PUSH_LOOK_BEHIND_NOT(pat,s,sprev,keep) \ STACK_PUSH(STK_LOOK_BEHIND_NOT,pat,s,sprev,keep) #define STACK_PUSH_REPEAT(id, pat) do {\ STACK_ENSURE(1);\ stk->type = STK_REPEAT;\ stk->u.repeat.num = (id);\ stk->u.repeat.pcode = (pat);\ stk->u.repeat.count = 0;\ STACK_INC;\ } while(0) #define STACK_PUSH_REPEAT_INC(sindex) do {\ STACK_ENSURE(1);\ stk->type = STK_REPEAT_INC;\ stk->u.repeat_inc.si = (sindex);\ STACK_INC;\ } while(0) #define STACK_PUSH_MEM_START(mnum, s) do {\ STACK_ENSURE(1);\ stk->type = STK_MEM_START;\ stk->u.mem.num = (mnum);\ stk->u.mem.pstr = (s);\ stk->u.mem.start = mem_start_stk[mnum];\ stk->u.mem.end = mem_end_stk[mnum];\ mem_start_stk[mnum] = GET_STACK_INDEX(stk);\ mem_end_stk[mnum] = INVALID_STACK_INDEX;\ STACK_INC;\ } while(0) #define STACK_PUSH_MEM_END(mnum, s) do {\ STACK_ENSURE(1);\ stk->type = STK_MEM_END;\ stk->u.mem.num = (mnum);\ stk->u.mem.pstr = (s);\ stk->u.mem.start = mem_start_stk[mnum];\ stk->u.mem.end = mem_end_stk[mnum];\ mem_end_stk[mnum] = GET_STACK_INDEX(stk);\ STACK_INC;\ } while(0) #define STACK_PUSH_MEM_END_MARK(mnum) do {\ STACK_ENSURE(1);\ stk->type = STK_MEM_END_MARK;\ stk->u.mem.num = (mnum);\ STACK_INC;\ } while(0) #define STACK_GET_MEM_START(mnum, k) do {\ int level = 0;\ k = stk;\ while (k > stk_base) {\ k--;\ if ((k->type & STK_MASK_MEM_END_OR_MARK) != 0 \ && k->u.mem.num == (mnum)) {\ level++;\ }\ else if (k->type == STK_MEM_START && k->u.mem.num == (mnum)) {\ if (level == 0) break;\ level--;\ }\ }\ } while(0) #define STACK_GET_MEM_RANGE(k, mnum, start, end) do {\ int level = 0;\ while (k < stk) {\ if (k->type == STK_MEM_START && k->u.mem.num == (mnum)) {\ if (level == 0) (start) = k->u.mem.pstr;\ level++;\ }\ else if (k->type == STK_MEM_END && k->u.mem.num == (mnum)) {\ level--;\ if (level == 0) {\ (end) = k->u.mem.pstr;\ break;\ }\ }\ k++;\ }\ } while(0) #define STACK_PUSH_NULL_CHECK_START(cnum, s) do {\ STACK_ENSURE(1);\ stk->type = STK_NULL_CHECK_START;\ stk->u.null_check.num = (cnum);\ stk->u.null_check.pstr = (s);\ STACK_INC;\ } while(0) #define STACK_PUSH_NULL_CHECK_END(cnum) do {\ STACK_ENSURE(1);\ stk->type = STK_NULL_CHECK_END;\ stk->u.null_check.num = (cnum);\ STACK_INC;\ } while(0) #define STACK_PUSH_CALL_FRAME(pat) do {\ STACK_ENSURE(1);\ stk->type = STK_CALL_FRAME;\ stk->u.call_frame.ret_addr = (pat);\ STACK_INC;\ } while(0) #define STACK_PUSH_RETURN do {\ STACK_ENSURE(1);\ stk->type = STK_RETURN;\ STACK_INC;\ } while(0) #define STACK_PUSH_ABSENT_POS(start, end) do {\ STACK_ENSURE(1);\ stk->type = STK_ABSENT_POS;\ stk->u.absent_pos.abs_pstr = (start);\ stk->u.absent_pos.end_pstr = (end);\ STACK_INC;\ } while(0) #ifdef ONIG_DEBUG # define STACK_BASE_CHECK(p, at) \ if ((p) < stk_base) {\ fprintf(stderr, "at %s\n", at);\ goto stack_error;\ } #else # define STACK_BASE_CHECK(p, at) #endif #define STACK_POP_ONE do {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP_ONE"); \ } while(0) #define STACK_POP do {\ switch (pop_level) {\ case STACK_POP_LEVEL_FREE:\ while (1) {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP"); \ if ((stk->type & STK_MASK_POP_USED) != 0) break;\ ELSE_IF_STATE_CHECK_MARK(stk);\ }\ break;\ case STACK_POP_LEVEL_MEM_START:\ while (1) {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP 2"); \ if ((stk->type & STK_MASK_POP_USED) != 0) break;\ else if (stk->type == STK_MEM_START) {\ mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ }\ ELSE_IF_STATE_CHECK_MARK(stk);\ }\ break;\ default:\ while (1) {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP 3"); \ if ((stk->type & STK_MASK_POP_USED) != 0) break;\ else if (stk->type == STK_MEM_START) {\ mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ }\ else if (stk->type == STK_REPEAT_INC) {\ STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\ }\ else if (stk->type == STK_MEM_END) {\ mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ }\ ELSE_IF_STATE_CHECK_MARK(stk);\ }\ break;\ }\ } while(0) #define STACK_POP_TIL_POS_NOT do {\ while (1) {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP_TIL_POS_NOT"); \ if (stk->type == STK_POS_NOT) break;\ else if (stk->type == STK_MEM_START) {\ mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ }\ else if (stk->type == STK_REPEAT_INC) {\ STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\ }\ else if (stk->type == STK_MEM_END) {\ mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ }\ ELSE_IF_STATE_CHECK_MARK(stk);\ }\ } while(0) #define STACK_POP_TIL_LOOK_BEHIND_NOT do {\ while (1) {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP_TIL_LOOK_BEHIND_NOT"); \ if (stk->type == STK_LOOK_BEHIND_NOT) break;\ else if (stk->type == STK_MEM_START) {\ mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ }\ else if (stk->type == STK_REPEAT_INC) {\ STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\ }\ else if (stk->type == STK_MEM_END) {\ mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ }\ ELSE_IF_STATE_CHECK_MARK(stk);\ }\ } while(0) #define STACK_POP_TIL_ABSENT do {\ while (1) {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP_TIL_ABSENT"); \ if (stk->type == STK_ABSENT) break;\ else if (stk->type == STK_MEM_START) {\ mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ }\ else if (stk->type == STK_REPEAT_INC) {\ STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\ }\ else if (stk->type == STK_MEM_END) {\ mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\ mem_end_stk[stk->u.mem.num] = stk->u.mem.end;\ }\ ELSE_IF_STATE_CHECK_MARK(stk);\ }\ } while(0) #define STACK_POP_ABSENT_POS(start, end) do {\ stk--;\ STACK_BASE_CHECK(stk, "STACK_POP_ABSENT_POS"); \ (start) = stk->u.absent_pos.abs_pstr;\ (end) = stk->u.absent_pos.end_pstr;\ } while(0) #define STACK_POS_END(k) do {\ k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "STACK_POS_END"); \ if (IS_TO_VOID_TARGET(k)) {\ k->type = STK_VOID;\ }\ else if (k->type == STK_POS) {\ k->type = STK_VOID;\ break;\ }\ }\ } while(0) #define STACK_STOP_BT_END do {\ OnigStackType *k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "STACK_STOP_BT_END"); \ if (IS_TO_VOID_TARGET(k)) {\ k->type = STK_VOID;\ }\ else if (k->type == STK_STOP_BT) {\ k->type = STK_VOID;\ break;\ }\ }\ } while(0) #define STACK_NULL_CHECK(isnull,id,s) do {\ OnigStackType* k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "STACK_NULL_CHECK"); \ if (k->type == STK_NULL_CHECK_START) {\ if (k->u.null_check.num == (id)) {\ (isnull) = (k->u.null_check.pstr == (s));\ break;\ }\ }\ }\ } while(0) #define STACK_NULL_CHECK_REC(isnull,id,s) do {\ int level = 0;\ OnigStackType* k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "STACK_NULL_CHECK_REC"); \ if (k->type == STK_NULL_CHECK_START) {\ if (k->u.null_check.num == (id)) {\ if (level == 0) {\ (isnull) = (k->u.null_check.pstr == (s));\ break;\ }\ else level--;\ }\ }\ else if (k->type == STK_NULL_CHECK_END) {\ level++;\ }\ }\ } while(0) #define STACK_NULL_CHECK_MEMST(isnull,id,s,reg) do {\ OnigStackType* k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "STACK_NULL_CHECK_MEMST"); \ if (k->type == STK_NULL_CHECK_START) {\ if (k->u.null_check.num == (id)) {\ if (k->u.null_check.pstr != (s)) {\ (isnull) = 0;\ break;\ }\ else {\ UChar* endp;\ (isnull) = 1;\ while (k < stk) {\ if (k->type == STK_MEM_START) {\ if (k->u.mem.end == INVALID_STACK_INDEX) {\ (isnull) = 0; break;\ }\ if (BIT_STATUS_AT(reg->bt_mem_end, k->u.mem.num))\ endp = STACK_AT(k->u.mem.end)->u.mem.pstr;\ else\ endp = (UChar* )k->u.mem.end;\ if (STACK_AT(k->u.mem.start)->u.mem.pstr != endp) {\ (isnull) = 0; break;\ }\ else if (endp != s) {\ (isnull) = -1; /* empty, but position changed */ \ }\ }\ k++;\ }\ break;\ }\ }\ }\ }\ } while(0) #define STACK_NULL_CHECK_MEMST_REC(isnull,id,s,reg) do {\ int level = 0;\ OnigStackType* k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "STACK_NULL_CHECK_MEMST_REC"); \ if (k->type == STK_NULL_CHECK_START) {\ if (k->u.null_check.num == (id)) {\ if (level == 0) {\ if (k->u.null_check.pstr != (s)) {\ (isnull) = 0;\ break;\ }\ else {\ UChar* endp;\ (isnull) = 1;\ while (k < stk) {\ if (k->type == STK_MEM_START) {\ if (k->u.mem.end == INVALID_STACK_INDEX) {\ (isnull) = 0; break;\ }\ if (BIT_STATUS_AT(reg->bt_mem_end, k->u.mem.num))\ endp = STACK_AT(k->u.mem.end)->u.mem.pstr;\ else\ endp = (UChar* )k->u.mem.end;\ if (STACK_AT(k->u.mem.start)->u.mem.pstr != endp) {\ (isnull) = 0; break;\ }\ else if (endp != s) {\ (isnull) = -1; /* empty, but position changed */ \ }\ }\ k++;\ }\ break;\ }\ }\ else {\ level--;\ }\ }\ }\ else if (k->type == STK_NULL_CHECK_END) {\ if (k->u.null_check.num == (id)) level++;\ }\ }\ } while(0) #define STACK_GET_REPEAT(id, k) do {\ int level = 0;\ k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "STACK_GET_REPEAT"); \ if (k->type == STK_REPEAT) {\ if (level == 0) {\ if (k->u.repeat.num == (id)) {\ break;\ }\ }\ }\ else if (k->type == STK_CALL_FRAME) level--;\ else if (k->type == STK_RETURN) level++;\ }\ } while(0) #define STACK_RETURN(addr) do {\ int level = 0;\ OnigStackType* k = stk;\ while (1) {\ k--;\ STACK_BASE_CHECK(k, "STACK_RETURN"); \ if (k->type == STK_CALL_FRAME) {\ if (level == 0) {\ (addr) = k->u.call_frame.ret_addr;\ break;\ }\ else level--;\ }\ else if (k->type == STK_RETURN)\ level++;\ }\ } while(0) #define STRING_CMP(s1,s2,len) do {\ while (len-- > 0) {\ if (*s1++ != *s2++) goto fail;\ }\ } while(0) #define STRING_CMP_IC(case_fold_flag,s1,ps2,len,text_end) do {\ if (string_cmp_ic(encode, case_fold_flag, s1, ps2, len, text_end) == 0) \ goto fail; \ } while(0) static int string_cmp_ic(OnigEncoding enc, int case_fold_flag, UChar* s1, UChar** ps2, OnigDistance mblen, const UChar* text_end) { UChar buf1[ONIGENC_MBC_CASE_FOLD_MAXLEN]; UChar buf2[ONIGENC_MBC_CASE_FOLD_MAXLEN]; UChar *p1, *p2, *end1, *s2; int len1, len2; s2 = *ps2; end1 = s1 + mblen; while (s1 < end1) { len1 = ONIGENC_MBC_CASE_FOLD(enc, case_fold_flag, &s1, text_end, buf1); len2 = ONIGENC_MBC_CASE_FOLD(enc, case_fold_flag, &s2, text_end, buf2); if (len1 != len2) return 0; p1 = buf1; p2 = buf2; while (len1-- > 0) { if (*p1 != *p2) return 0; p1++; p2++; } } *ps2 = s2; return 1; } #define STRING_CMP_VALUE(s1,s2,len,is_fail) do {\ is_fail = 0;\ while (len-- > 0) {\ if (*s1++ != *s2++) {\ is_fail = 1; break;\ }\ }\ } while(0) #define STRING_CMP_VALUE_IC(case_fold_flag,s1,ps2,len,text_end,is_fail) do {\ if (string_cmp_ic(encode, case_fold_flag, s1, ps2, len, text_end) == 0) \ is_fail = 1; \ else \ is_fail = 0; \ } while(0) #define IS_EMPTY_STR (str == end) #define ON_STR_BEGIN(s) ((s) == str) #define ON_STR_END(s) ((s) == end) #ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE # define DATA_ENSURE_CHECK1 (s < right_range) # define DATA_ENSURE_CHECK(n) (s + (n) <= right_range) # define DATA_ENSURE(n) if (s + (n) > right_range) goto fail # define ABSENT_END_POS right_range #else # define DATA_ENSURE_CHECK1 (s < end) # define DATA_ENSURE_CHECK(n) (s + (n) <= end) # define DATA_ENSURE(n) if (s + (n) > end) goto fail # define ABSENT_END_POS end #endif /* USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE */ #ifdef USE_CAPTURE_HISTORY static int make_capture_history_tree(OnigCaptureTreeNode* node, OnigStackType** kp, OnigStackType* stk_top, UChar* str, regex_t* reg) { int n, r; OnigCaptureTreeNode* child; OnigStackType* k = *kp; while (k < stk_top) { if (k->type == STK_MEM_START) { n = k->u.mem.num; if (n <= ONIG_MAX_CAPTURE_HISTORY_GROUP && BIT_STATUS_AT(reg->capture_history, n) != 0) { child = history_node_new(); CHECK_NULL_RETURN_MEMERR(child); child->group = n; child->beg = k->u.mem.pstr - str; r = history_tree_add_child(node, child); if (r != 0) { history_tree_free(child); return r; } *kp = (k + 1); r = make_capture_history_tree(child, kp, stk_top, str, reg); if (r != 0) return r; k = *kp; child->end = k->u.mem.pstr - str; } } else if (k->type == STK_MEM_END) { if (k->u.mem.num == node->group) { node->end = k->u.mem.pstr - str; *kp = k; return 0; } } k++; } return 1; /* 1: root node ending. */ } #endif /* USE_CAPTURE_HISTORY */ #ifdef USE_BACKREF_WITH_LEVEL static int mem_is_in_memp(int mem, int num, UChar* memp) { int i; MemNumType m; for (i = 0; i < num; i++) { GET_MEMNUM_INC(m, memp); if (mem == (int )m) return 1; } return 0; } static int backref_match_at_nested_level(regex_t* reg, OnigStackType* top, OnigStackType* stk_base, int ignore_case, int case_fold_flag, int nest, int mem_num, UChar* memp, UChar** s, const UChar* send) { UChar *ss, *p, *pstart, *pend = NULL_UCHARP; int level; OnigStackType* k; level = 0; k = top; k--; while (k >= stk_base) { if (k->type == STK_CALL_FRAME) { level--; } else if (k->type == STK_RETURN) { level++; } else if (level == nest) { if (k->type == STK_MEM_START) { if (mem_is_in_memp(k->u.mem.num, mem_num, memp)) { pstart = k->u.mem.pstr; if (pend != NULL_UCHARP) { if (pend - pstart > send - *s) return 0; /* or goto next_mem; */ p = pstart; ss = *s; if (ignore_case != 0) { if (string_cmp_ic(reg->enc, case_fold_flag, pstart, &ss, pend - pstart, send) == 0) return 0; /* or goto next_mem; */ } else { while (p < pend) { if (*p++ != *ss++) return 0; /* or goto next_mem; */ } } *s = ss; return 1; } } } else if (k->type == STK_MEM_END) { if (mem_is_in_memp(k->u.mem.num, mem_num, memp)) { pend = k->u.mem.pstr; } } } k--; } return 0; } #endif /* USE_BACKREF_WITH_LEVEL */ #ifdef ONIG_DEBUG_STATISTICS # ifdef _WIN32 # include <windows.h> static LARGE_INTEGER ts, te, freq; # define GETTIME(t) QueryPerformanceCounter(&(t)) # define TIMEDIFF(te,ts) (unsigned long )(((te).QuadPart - (ts).QuadPart) \ * 1000000 / freq.QuadPart) # else /* _WIN32 */ # define USE_TIMEOFDAY # ifdef USE_TIMEOFDAY # ifdef HAVE_SYS_TIME_H # include <sys/time.h> # endif # ifdef HAVE_UNISTD_H # include <unistd.h> # endif static struct timeval ts, te; # define GETTIME(t) gettimeofday(&(t), (struct timezone* )0) # define TIMEDIFF(te,ts) (((te).tv_usec - (ts).tv_usec) + \ (((te).tv_sec - (ts).tv_sec)*1000000)) # else /* USE_TIMEOFDAY */ # ifdef HAVE_SYS_TIMES_H # include <sys/times.h> # endif static struct tms ts, te; # define GETTIME(t) times(&(t)) # define TIMEDIFF(te,ts) ((te).tms_utime - (ts).tms_utime) # endif /* USE_TIMEOFDAY */ # endif /* _WIN32 */ static int OpCounter[256]; static int OpPrevCounter[256]; static unsigned long OpTime[256]; static int OpCurr = OP_FINISH; static int OpPrevTarget = OP_FAIL; static int MaxStackDepth = 0; # define MOP_IN(opcode) do {\ if (opcode == OpPrevTarget) OpPrevCounter[OpCurr]++;\ OpCurr = opcode;\ OpCounter[opcode]++;\ GETTIME(ts);\ } while(0) # define MOP_OUT do {\ GETTIME(te);\ OpTime[OpCurr] += TIMEDIFF(te, ts);\ } while(0) extern void onig_statistics_init(void) { int i; for (i = 0; i < 256; i++) { OpCounter[i] = OpPrevCounter[i] = 0; OpTime[i] = 0; } MaxStackDepth = 0; # ifdef _WIN32 QueryPerformanceFrequency(&freq); # endif } extern void onig_print_statistics(FILE* f) { int i; fprintf(f, " count prev time\n"); for (i = 0; OnigOpInfo[i].opcode >= 0; i++) { fprintf(f, "%8d: %8d: %10lu: %s\n", OpCounter[i], OpPrevCounter[i], OpTime[i], OnigOpInfo[i].name); } fprintf(f, "\nmax stack depth: %d\n", MaxStackDepth); } # define STACK_INC do {\ stk++;\ if (stk - stk_base > MaxStackDepth) \ MaxStackDepth = stk - stk_base;\ } while(0) #else /* ONIG_DEBUG_STATISTICS */ # define STACK_INC stk++ # define MOP_IN(opcode) # define MOP_OUT #endif /* ONIG_DEBUG_STATISTICS */ #ifdef ONIG_DEBUG_MATCH static char * stack_type_str(int stack_type) { switch (stack_type) { case STK_ALT: return "Alt "; case STK_LOOK_BEHIND_NOT: return "LBNot "; case STK_POS_NOT: return "PosNot"; case STK_MEM_START: return "MemS "; case STK_MEM_END: return "MemE "; case STK_REPEAT_INC: return "RepInc"; case STK_STATE_CHECK_MARK: return "StChMk"; case STK_NULL_CHECK_START: return "NulChS"; case STK_NULL_CHECK_END: return "NulChE"; case STK_MEM_END_MARK: return "MemEMk"; case STK_POS: return "Pos "; case STK_STOP_BT: return "StopBt"; case STK_REPEAT: return "Rep "; case STK_CALL_FRAME: return "Call "; case STK_RETURN: return "Ret "; case STK_VOID: return "Void "; case STK_ABSENT_POS: return "AbsPos"; case STK_ABSENT: return "Absent"; default: return " "; } } #endif /* match data(str - end) from position (sstart). */ /* if sstart == str then set sprev to NULL. */ static OnigPosition match_at(regex_t* reg, const UChar* str, const UChar* end, #ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE const UChar* right_range, #endif const UChar* sstart, UChar* sprev, OnigMatchArg* msa) { static const UChar FinishCode[] = { OP_FINISH }; int i, num_mem, pop_level; ptrdiff_t n, best_len; LengthType tlen, tlen2; MemNumType mem; RelAddrType addr; OnigOptionType option = reg->options; OnigEncoding encode = reg->enc; OnigCaseFoldType case_fold_flag = reg->case_fold_flag; UChar *s, *q, *sbegin; UChar *p = reg->p; UChar *pkeep; char *alloca_base; char *xmalloc_base = NULL; OnigStackType *stk_alloc, *stk_base, *stk, *stk_end; OnigStackType *stkp; /* used as any purpose. */ OnigStackIndex si; OnigStackIndex *repeat_stk; OnigStackIndex *mem_start_stk, *mem_end_stk; #ifdef USE_COMBINATION_EXPLOSION_CHECK int scv; unsigned char* state_check_buff = msa->state_check_buff; int num_comb_exp_check = reg->num_comb_exp_check; #endif #if USE_TOKEN_THREADED_VM # define OP_OFFSET 1 # define VM_LOOP JUMP; # define VM_LOOP_END # define CASE(x) L_##x: sbegin = s; OPCODE_EXEC_HOOK; # define DEFAULT L_DEFAULT: # define NEXT sprev = sbegin; JUMP # define JUMP goto *oplabels[*p++] static const void *oplabels[] = { &&L_OP_FINISH, /* matching process terminator (no more alternative) */ &&L_OP_END, /* pattern code terminator (success end) */ &&L_OP_EXACT1, /* single byte, N = 1 */ &&L_OP_EXACT2, /* single byte, N = 2 */ &&L_OP_EXACT3, /* single byte, N = 3 */ &&L_OP_EXACT4, /* single byte, N = 4 */ &&L_OP_EXACT5, /* single byte, N = 5 */ &&L_OP_EXACTN, /* single byte */ &&L_OP_EXACTMB2N1, /* mb-length = 2 N = 1 */ &&L_OP_EXACTMB2N2, /* mb-length = 2 N = 2 */ &&L_OP_EXACTMB2N3, /* mb-length = 2 N = 3 */ &&L_OP_EXACTMB2N, /* mb-length = 2 */ &&L_OP_EXACTMB3N, /* mb-length = 3 */ &&L_OP_EXACTMBN, /* other length */ &&L_OP_EXACT1_IC, /* single byte, N = 1, ignore case */ &&L_OP_EXACTN_IC, /* single byte, ignore case */ &&L_OP_CCLASS, &&L_OP_CCLASS_MB, &&L_OP_CCLASS_MIX, &&L_OP_CCLASS_NOT, &&L_OP_CCLASS_MB_NOT, &&L_OP_CCLASS_MIX_NOT, &&L_OP_ANYCHAR, /* "." */ &&L_OP_ANYCHAR_ML, /* "." multi-line */ &&L_OP_ANYCHAR_STAR, /* ".*" */ &&L_OP_ANYCHAR_ML_STAR, /* ".*" multi-line */ &&L_OP_ANYCHAR_STAR_PEEK_NEXT, &&L_OP_ANYCHAR_ML_STAR_PEEK_NEXT, &&L_OP_WORD, &&L_OP_NOT_WORD, &&L_OP_WORD_BOUND, &&L_OP_NOT_WORD_BOUND, # ifdef USE_WORD_BEGIN_END &&L_OP_WORD_BEGIN, &&L_OP_WORD_END, # else &&L_DEFAULT, &&L_DEFAULT, # endif &&L_OP_ASCII_WORD, &&L_OP_NOT_ASCII_WORD, &&L_OP_ASCII_WORD_BOUND, &&L_OP_NOT_ASCII_WORD_BOUND, # ifdef USE_WORD_BEGIN_END &&L_OP_ASCII_WORD_BEGIN, &&L_OP_ASCII_WORD_END, # else &&L_DEFAULT, &&L_DEFAULT, # endif &&L_OP_BEGIN_BUF, &&L_OP_END_BUF, &&L_OP_BEGIN_LINE, &&L_OP_END_LINE, &&L_OP_SEMI_END_BUF, &&L_OP_BEGIN_POSITION, &&L_OP_BACKREF1, &&L_OP_BACKREF2, &&L_OP_BACKREFN, &&L_OP_BACKREFN_IC, &&L_OP_BACKREF_MULTI, &&L_OP_BACKREF_MULTI_IC, # ifdef USE_BACKREF_WITH_LEVEL &&L_OP_BACKREF_WITH_LEVEL, /* \k<xxx+n>, \k<xxx-n> */ # else &&L_DEFAULT, # endif &&L_OP_MEMORY_START, &&L_OP_MEMORY_START_PUSH, /* push back-tracker to stack */ &&L_OP_MEMORY_END_PUSH, /* push back-tracker to stack */ # ifdef USE_SUBEXP_CALL &&L_OP_MEMORY_END_PUSH_REC, /* push back-tracker to stack */ # else &&L_DEFAULT, # endif &&L_OP_MEMORY_END, # ifdef USE_SUBEXP_CALL &&L_OP_MEMORY_END_REC, /* push marker to stack */ # else &&L_DEFAULT, # endif &&L_OP_KEEP, &&L_OP_FAIL, /* pop stack and move */ &&L_OP_JUMP, &&L_OP_PUSH, &&L_OP_POP, # ifdef USE_OP_PUSH_OR_JUMP_EXACT &&L_OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */ # else &&L_DEFAULT, # endif &&L_OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */ &&L_OP_REPEAT, /* {n,m} */ &&L_OP_REPEAT_NG, /* {n,m}? (non greedy) */ &&L_OP_REPEAT_INC, &&L_OP_REPEAT_INC_NG, /* non greedy */ &&L_OP_REPEAT_INC_SG, /* search and get in stack */ &&L_OP_REPEAT_INC_NG_SG, /* search and get in stack (non greedy) */ &&L_OP_NULL_CHECK_START, /* null loop checker start */ &&L_OP_NULL_CHECK_END, /* null loop checker end */ # ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT &&L_OP_NULL_CHECK_END_MEMST, /* null loop checker end (with capture status) */ # else &&L_DEFAULT, # endif # ifdef USE_SUBEXP_CALL &&L_OP_NULL_CHECK_END_MEMST_PUSH, /* with capture status and push check-end */ # else &&L_DEFAULT, # endif &&L_OP_PUSH_POS, /* (?=...) start */ &&L_OP_POP_POS, /* (?=...) end */ &&L_OP_PUSH_POS_NOT, /* (?!...) start */ &&L_OP_FAIL_POS, /* (?!...) end */ &&L_OP_PUSH_STOP_BT, /* (?>...) start */ &&L_OP_POP_STOP_BT, /* (?>...) end */ &&L_OP_LOOK_BEHIND, /* (?<=...) start (no needs end opcode) */ &&L_OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */ &&L_OP_FAIL_LOOK_BEHIND_NOT, /* (?<!...) end */ &&L_OP_PUSH_ABSENT_POS, /* (?~...) start */ &&L_OP_ABSENT, /* (?~...) start of inner loop */ &&L_OP_ABSENT_END, /* (?~...) end */ # ifdef USE_SUBEXP_CALL &&L_OP_CALL, /* \g<name> */ &&L_OP_RETURN, # else &&L_DEFAULT, &&L_DEFAULT, # endif &&L_OP_CONDITION, # ifdef USE_COMBINATION_EXPLOSION_CHECK &&L_OP_STATE_CHECK_PUSH, /* combination explosion check and push */ &&L_OP_STATE_CHECK_PUSH_OR_JUMP, /* check ok -> push, else jump */ &&L_OP_STATE_CHECK, /* check only */ # else &&L_DEFAULT, &&L_DEFAULT, &&L_DEFAULT, # endif # ifdef USE_COMBINATION_EXPLOSION_CHECK &&L_OP_STATE_CHECK_ANYCHAR_STAR, &&L_OP_STATE_CHECK_ANYCHAR_ML_STAR, # else &&L_DEFAULT, &&L_DEFAULT, # endif /* no need: IS_DYNAMIC_OPTION() == 0 */ # if 0 /* no need: IS_DYNAMIC_OPTION() == 0 */ &&L_OP_SET_OPTION_PUSH, /* set option and push recover option */ &&L_OP_SET_OPTION /* set option */ # else &&L_DEFAULT, &&L_DEFAULT # endif }; #else /* USE_TOKEN_THREADED_VM */ # define OP_OFFSET 0 # define VM_LOOP \ while (1) { \ OPCODE_EXEC_HOOK; \ sbegin = s; \ switch (*p++) { # define VM_LOOP_END } sprev = sbegin; } # define CASE(x) case x: # define DEFAULT default: # define NEXT break # define JUMP continue; break #endif /* USE_TOKEN_THREADED_VM */ #ifdef USE_SUBEXP_CALL /* Stack #0 is used to store the pattern itself and used for (?R), \g<0>, etc. Additional space is required. */ # define ADD_NUMMEM 1 #else /* Stack #0 not is used. */ # define ADD_NUMMEM 0 #endif n = reg->num_repeat + (reg->num_mem + ADD_NUMMEM) * 2; STACK_INIT(alloca_base, xmalloc_base, n, INIT_MATCH_STACK_SIZE); pop_level = reg->stack_pop_level; num_mem = reg->num_mem; repeat_stk = (OnigStackIndex* )alloca_base; mem_start_stk = (OnigStackIndex* )(repeat_stk + reg->num_repeat); mem_end_stk = mem_start_stk + (num_mem + ADD_NUMMEM); { OnigStackIndex *pp = mem_start_stk; for (; pp < repeat_stk + n; pp += 2) { pp[0] = INVALID_STACK_INDEX; pp[1] = INVALID_STACK_INDEX; } } #ifndef USE_SUBEXP_CALL mem_start_stk--; /* for index start from 1, mem_start_stk[1]..mem_start_stk[num_mem] */ mem_end_stk--; /* for index start from 1, mem_end_stk[1]..mem_end_stk[num_mem] */ #endif #ifdef ONIG_DEBUG_MATCH fprintf(stderr, "match_at: str: %"PRIuPTR" (%p), end: %"PRIuPTR" (%p), start: %"PRIuPTR" (%p), sprev: %"PRIuPTR" (%p)\n", (uintptr_t )str, str, (uintptr_t )end, end, (uintptr_t )sstart, sstart, (uintptr_t )sprev, sprev); fprintf(stderr, "size: %d, start offset: %d\n", (int )(end - str), (int )(sstart - str)); fprintf(stderr, "\n ofs> str stk:type addr:opcode\n"); #endif STACK_PUSH_ENSURED(STK_ALT, (UChar* )FinishCode); /* bottom stack */ best_len = ONIG_MISMATCH; s = (UChar* )sstart; pkeep = (UChar* )sstart; #ifdef ONIG_DEBUG_MATCH # define OPCODE_EXEC_HOOK \ if (s) { \ UChar *op, *q, *bp, buf[50]; \ int len; \ op = p - OP_OFFSET; \ fprintf(stderr, "%4"PRIdPTR"> \"", (*op == OP_FINISH) ? (ptrdiff_t )-1 : s - str); \ bp = buf; \ q = s; \ if (*op != OP_FINISH) { /* s may not be a valid pointer if OP_FINISH. */ \ for (i = 0; i < 7 && q < end; i++) { \ len = enclen(encode, q, end); \ while (len-- > 0) *bp++ = *q++; \ } \ if (q < end) { xmemcpy(bp, "...", 3); bp += 3; } \ } \ xmemcpy(bp, "\"", 1); bp += 1; \ *bp = 0; \ fputs((char* )buf, stderr); \ for (i = 0; i < 20 - (bp - buf); i++) fputc(' ', stderr); \ fprintf(stderr, "%4"PRIdPTR":%s %4"PRIdPTR":", \ stk - stk_base - 1, \ (stk > stk_base) ? stack_type_str(stk[-1].type) : " ", \ (op == FinishCode) ? (ptrdiff_t )-1 : op - reg->p); \ onig_print_compiled_byte_code(stderr, op, reg->p+reg->used, NULL, encode); \ fprintf(stderr, "\n"); \ } #else # define OPCODE_EXEC_HOOK ((void) 0) #endif VM_LOOP { CASE(OP_END) MOP_IN(OP_END); n = s - sstart; if (n > best_len) { OnigRegion* region; #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if (IS_FIND_LONGEST(option)) { if (n > msa->best_len) { msa->best_len = n; msa->best_s = (UChar* )sstart; } else goto end_best_len; } #endif best_len = n; region = msa->region; if (region) { region->beg[0] = ((pkeep > s) ? s : pkeep) - str; region->end[0] = s - str; for (i = 1; i <= num_mem; i++) { if (mem_end_stk[i] != INVALID_STACK_INDEX) { if (BIT_STATUS_AT(reg->bt_mem_start, i)) region->beg[i] = STACK_AT(mem_start_stk[i])->u.mem.pstr - str; else region->beg[i] = (UChar* )((void* )mem_start_stk[i]) - str; region->end[i] = (BIT_STATUS_AT(reg->bt_mem_end, i) ? STACK_AT(mem_end_stk[i])->u.mem.pstr : (UChar* )((void* )mem_end_stk[i])) - str; } else { region->beg[i] = region->end[i] = ONIG_REGION_NOTPOS; } } #ifdef USE_CAPTURE_HISTORY if (reg->capture_history != 0) { int r; OnigCaptureTreeNode* node; if (IS_NULL(region->history_root)) { region->history_root = node = history_node_new(); CHECK_NULL_RETURN_MEMERR(node); } else { node = region->history_root; history_tree_clear(node); } node->group = 0; node->beg = ((pkeep > s) ? s : pkeep) - str; node->end = s - str; stkp = stk_base; r = make_capture_history_tree(region->history_root, &stkp, stk, (UChar* )str, reg); if (r < 0) { best_len = r; /* error code */ goto finish; } } #endif /* USE_CAPTURE_HISTORY */ } /* if (region) */ } /* n > best_len */ #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE end_best_len: #endif MOP_OUT; if (IS_FIND_CONDITION(option)) { if (IS_FIND_NOT_EMPTY(option) && s == sstart) { best_len = ONIG_MISMATCH; goto fail; /* for retry */ } if (IS_FIND_LONGEST(option) && DATA_ENSURE_CHECK1) { goto fail; /* for retry */ } } /* default behavior: return first-matching result. */ goto finish; NEXT; CASE(OP_EXACT1) MOP_IN(OP_EXACT1); #if 0 DATA_ENSURE(1); if (*p != *s) goto fail; p++; s++; #endif if (*p != *s++) goto fail; DATA_ENSURE(0); p++; MOP_OUT; NEXT; CASE(OP_EXACT1_IC) MOP_IN(OP_EXACT1_IC); { int len; UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN]; DATA_ENSURE(1); len = ONIGENC_MBC_CASE_FOLD(encode, /* DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag), */ case_fold_flag, &s, end, lowbuf); DATA_ENSURE(0); q = lowbuf; while (len-- > 0) { if (*p != *q) { goto fail; } p++; q++; } } MOP_OUT; NEXT; CASE(OP_EXACT2) MOP_IN(OP_EXACT2); DATA_ENSURE(2); if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; sprev = s; p++; s++; MOP_OUT; JUMP; CASE(OP_EXACT3) MOP_IN(OP_EXACT3); DATA_ENSURE(3); if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; sprev = s; p++; s++; MOP_OUT; JUMP; CASE(OP_EXACT4) MOP_IN(OP_EXACT4); DATA_ENSURE(4); if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; sprev = s; p++; s++; MOP_OUT; JUMP; CASE(OP_EXACT5) MOP_IN(OP_EXACT5); DATA_ENSURE(5); if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; sprev = s; p++; s++; MOP_OUT; JUMP; CASE(OP_EXACTN) MOP_IN(OP_EXACTN); GET_LENGTH_INC(tlen, p); DATA_ENSURE(tlen); while (tlen-- > 0) { if (*p++ != *s++) goto fail; } sprev = s - 1; MOP_OUT; JUMP; CASE(OP_EXACTN_IC) MOP_IN(OP_EXACTN_IC); { int len; UChar *q, *endp, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN]; GET_LENGTH_INC(tlen, p); endp = p + tlen; while (p < endp) { sprev = s; DATA_ENSURE(1); len = ONIGENC_MBC_CASE_FOLD(encode, /* DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag), */ case_fold_flag, &s, end, lowbuf); DATA_ENSURE(0); q = lowbuf; while (len-- > 0) { if (*p != *q) goto fail; p++; q++; } } } MOP_OUT; JUMP; CASE(OP_EXACTMB2N1) MOP_IN(OP_EXACTMB2N1); DATA_ENSURE(2); if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; MOP_OUT; NEXT; CASE(OP_EXACTMB2N2) MOP_IN(OP_EXACTMB2N2); DATA_ENSURE(4); if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; sprev = s; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; MOP_OUT; JUMP; CASE(OP_EXACTMB2N3) MOP_IN(OP_EXACTMB2N3); DATA_ENSURE(6); if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; sprev = s; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; MOP_OUT; JUMP; CASE(OP_EXACTMB2N) MOP_IN(OP_EXACTMB2N); GET_LENGTH_INC(tlen, p); DATA_ENSURE(tlen * 2); while (tlen-- > 0) { if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; } sprev = s - 2; MOP_OUT; JUMP; CASE(OP_EXACTMB3N) MOP_IN(OP_EXACTMB3N); GET_LENGTH_INC(tlen, p); DATA_ENSURE(tlen * 3); while (tlen-- > 0) { if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; if (*p != *s) goto fail; p++; s++; } sprev = s - 3; MOP_OUT; JUMP; CASE(OP_EXACTMBN) MOP_IN(OP_EXACTMBN); GET_LENGTH_INC(tlen, p); /* mb-len */ GET_LENGTH_INC(tlen2, p); /* string len */ tlen2 *= tlen; DATA_ENSURE(tlen2); while (tlen2-- > 0) { if (*p != *s) goto fail; p++; s++; } sprev = s - tlen; MOP_OUT; JUMP; CASE(OP_CCLASS) MOP_IN(OP_CCLASS); DATA_ENSURE(1); if (BITSET_AT(((BitSetRef )p), *s) == 0) goto fail; p += SIZE_BITSET; s += enclen(encode, s, end); /* OP_CCLASS can match mb-code. \D, \S */ MOP_OUT; NEXT; CASE(OP_CCLASS_MB) MOP_IN(OP_CCLASS_MB); if (! ONIGENC_IS_MBC_HEAD(encode, s, end)) goto fail; cclass_mb: GET_LENGTH_INC(tlen, p); { OnigCodePoint code; UChar *ss; int mb_len; DATA_ENSURE(1); mb_len = enclen(encode, s, end); DATA_ENSURE(mb_len); ss = s; s += mb_len; code = ONIGENC_MBC_TO_CODE(encode, ss, s); #ifdef PLATFORM_UNALIGNED_WORD_ACCESS if (! onig_is_in_code_range(p, code)) goto fail; #else q = p; ALIGNMENT_RIGHT(q); if (! onig_is_in_code_range(q, code)) goto fail; #endif } p += tlen; MOP_OUT; NEXT; CASE(OP_CCLASS_MIX) MOP_IN(OP_CCLASS_MIX); DATA_ENSURE(1); if (ONIGENC_IS_MBC_HEAD(encode, s, end)) { p += SIZE_BITSET; goto cclass_mb; } else { if (BITSET_AT(((BitSetRef )p), *s) == 0) goto fail; p += SIZE_BITSET; GET_LENGTH_INC(tlen, p); p += tlen; s++; } MOP_OUT; NEXT; CASE(OP_CCLASS_NOT) MOP_IN(OP_CCLASS_NOT); DATA_ENSURE(1); if (BITSET_AT(((BitSetRef )p), *s) != 0) goto fail; p += SIZE_BITSET; s += enclen(encode, s, end); MOP_OUT; NEXT; CASE(OP_CCLASS_MB_NOT) MOP_IN(OP_CCLASS_MB_NOT); DATA_ENSURE(1); if (! ONIGENC_IS_MBC_HEAD(encode, s, end)) { s++; GET_LENGTH_INC(tlen, p); p += tlen; goto cc_mb_not_success; } cclass_mb_not: GET_LENGTH_INC(tlen, p); { OnigCodePoint code; UChar *ss; int mb_len = enclen(encode, s, end); if (! DATA_ENSURE_CHECK(mb_len)) { DATA_ENSURE(1); s = (UChar* )end; p += tlen; goto cc_mb_not_success; } ss = s; s += mb_len; code = ONIGENC_MBC_TO_CODE(encode, ss, s); #ifdef PLATFORM_UNALIGNED_WORD_ACCESS if (onig_is_in_code_range(p, code)) goto fail; #else q = p; ALIGNMENT_RIGHT(q); if (onig_is_in_code_range(q, code)) goto fail; #endif } p += tlen; cc_mb_not_success: MOP_OUT; NEXT; CASE(OP_CCLASS_MIX_NOT) MOP_IN(OP_CCLASS_MIX_NOT); DATA_ENSURE(1); if (ONIGENC_IS_MBC_HEAD(encode, s, end)) { p += SIZE_BITSET; goto cclass_mb_not; } else { if (BITSET_AT(((BitSetRef )p), *s) != 0) goto fail; p += SIZE_BITSET; GET_LENGTH_INC(tlen, p); p += tlen; s++; } MOP_OUT; NEXT; CASE(OP_ANYCHAR) MOP_IN(OP_ANYCHAR); DATA_ENSURE(1); n = enclen(encode, s, end); DATA_ENSURE(n); if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 0)) goto fail; s += n; MOP_OUT; NEXT; CASE(OP_ANYCHAR_ML) MOP_IN(OP_ANYCHAR_ML); DATA_ENSURE(1); n = enclen(encode, s, end); DATA_ENSURE(n); s += n; MOP_OUT; NEXT; CASE(OP_ANYCHAR_STAR) MOP_IN(OP_ANYCHAR_STAR); while (DATA_ENSURE_CHECK1) { STACK_PUSH_ALT(p, s, sprev, pkeep); n = enclen(encode, s, end); DATA_ENSURE(n); if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 0)) goto fail; sprev = s; s += n; } MOP_OUT; NEXT; CASE(OP_ANYCHAR_ML_STAR) MOP_IN(OP_ANYCHAR_ML_STAR); while (DATA_ENSURE_CHECK1) { STACK_PUSH_ALT(p, s, sprev, pkeep); n = enclen(encode, s, end); if (n > 1) { DATA_ENSURE(n); sprev = s; s += n; } else { sprev = s; s++; } } MOP_OUT; NEXT; CASE(OP_ANYCHAR_STAR_PEEK_NEXT) MOP_IN(OP_ANYCHAR_STAR_PEEK_NEXT); while (DATA_ENSURE_CHECK1) { if (*p == *s) { STACK_PUSH_ALT(p + 1, s, sprev, pkeep); } n = enclen(encode, s, end); DATA_ENSURE(n); if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 0)) goto fail; sprev = s; s += n; } p++; MOP_OUT; NEXT; CASE(OP_ANYCHAR_ML_STAR_PEEK_NEXT)MOP_IN(OP_ANYCHAR_ML_STAR_PEEK_NEXT); while (DATA_ENSURE_CHECK1) { if (*p == *s) { STACK_PUSH_ALT(p + 1, s, sprev, pkeep); } n = enclen(encode, s, end); if (n > 1) { DATA_ENSURE(n); sprev = s; s += n; } else { sprev = s; s++; } } p++; MOP_OUT; NEXT; #ifdef USE_COMBINATION_EXPLOSION_CHECK CASE(OP_STATE_CHECK_ANYCHAR_STAR) MOP_IN(OP_STATE_CHECK_ANYCHAR_STAR); GET_STATE_CHECK_NUM_INC(mem, p); while (DATA_ENSURE_CHECK1) { STATE_CHECK_VAL(scv, mem); if (scv) goto fail; STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem, pkeep); n = enclen(encode, s, end); DATA_ENSURE(n); if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 0)) goto fail; sprev = s; s += n; } MOP_OUT; NEXT; CASE(OP_STATE_CHECK_ANYCHAR_ML_STAR) MOP_IN(OP_STATE_CHECK_ANYCHAR_ML_STAR); GET_STATE_CHECK_NUM_INC(mem, p); while (DATA_ENSURE_CHECK1) { STATE_CHECK_VAL(scv, mem); if (scv) goto fail; STACK_PUSH_ALT_WITH_STATE_CHECK(p, s, sprev, mem, pkeep); n = enclen(encode, s, end); if (n > 1) { DATA_ENSURE(n); sprev = s; s += n; } else { sprev = s; s++; } } MOP_OUT; NEXT; #endif /* USE_COMBINATION_EXPLOSION_CHECK */ CASE(OP_WORD) MOP_IN(OP_WORD); DATA_ENSURE(1); if (! ONIGENC_IS_MBC_WORD(encode, s, end)) goto fail; s += enclen(encode, s, end); MOP_OUT; NEXT; CASE(OP_ASCII_WORD) MOP_IN(OP_ASCII_WORD); DATA_ENSURE(1); if (! ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)) goto fail; s += enclen(encode, s, end); MOP_OUT; NEXT; CASE(OP_NOT_WORD) MOP_IN(OP_NOT_WORD); DATA_ENSURE(1); if (ONIGENC_IS_MBC_WORD(encode, s, end)) goto fail; s += enclen(encode, s, end); MOP_OUT; NEXT; CASE(OP_NOT_ASCII_WORD) MOP_IN(OP_NOT_ASCII_WORD); DATA_ENSURE(1); if (ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)) goto fail; s += enclen(encode, s, end); MOP_OUT; NEXT; CASE(OP_WORD_BOUND) MOP_IN(OP_WORD_BOUND); if (ON_STR_BEGIN(s)) { DATA_ENSURE(1); if (! ONIGENC_IS_MBC_WORD(encode, s, end)) goto fail; } else if (ON_STR_END(s)) { if (! ONIGENC_IS_MBC_WORD(encode, sprev, end)) goto fail; } else { if (ONIGENC_IS_MBC_WORD(encode, s, end) == ONIGENC_IS_MBC_WORD(encode, sprev, end)) goto fail; } MOP_OUT; JUMP; CASE(OP_ASCII_WORD_BOUND) MOP_IN(OP_ASCII_WORD_BOUND); if (ON_STR_BEGIN(s)) { DATA_ENSURE(1); if (! ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)) goto fail; } else if (ON_STR_END(s)) { if (! ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end)) goto fail; } else { if (ONIGENC_IS_MBC_ASCII_WORD(encode, s, end) == ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end)) goto fail; } MOP_OUT; JUMP; CASE(OP_NOT_WORD_BOUND) MOP_IN(OP_NOT_WORD_BOUND); if (ON_STR_BEGIN(s)) { if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end)) goto fail; } else if (ON_STR_END(s)) { if (ONIGENC_IS_MBC_WORD(encode, sprev, end)) goto fail; } else { if (ONIGENC_IS_MBC_WORD(encode, s, end) != ONIGENC_IS_MBC_WORD(encode, sprev, end)) goto fail; } MOP_OUT; JUMP; CASE(OP_NOT_ASCII_WORD_BOUND) MOP_IN(OP_NOT_ASCII_WORD_BOUND); if (ON_STR_BEGIN(s)) { if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)) goto fail; } else if (ON_STR_END(s)) { if (ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end)) goto fail; } else { if (ONIGENC_IS_MBC_ASCII_WORD(encode, s, end) != ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end)) goto fail; } MOP_OUT; JUMP; #ifdef USE_WORD_BEGIN_END CASE(OP_WORD_BEGIN) MOP_IN(OP_WORD_BEGIN); if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD(encode, s, end)) { if (ON_STR_BEGIN(s) || !ONIGENC_IS_MBC_WORD(encode, sprev, end)) { MOP_OUT; JUMP; } } goto fail; NEXT; CASE(OP_ASCII_WORD_BEGIN) MOP_IN(OP_ASCII_WORD_BEGIN); if (DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)) { if (ON_STR_BEGIN(s) || !ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end)) { MOP_OUT; JUMP; } } goto fail; NEXT; CASE(OP_WORD_END) MOP_IN(OP_WORD_END); if (!ON_STR_BEGIN(s) && ONIGENC_IS_MBC_WORD(encode, sprev, end)) { if (ON_STR_END(s) || !ONIGENC_IS_MBC_WORD(encode, s, end)) { MOP_OUT; JUMP; } } goto fail; NEXT; CASE(OP_ASCII_WORD_END) MOP_IN(OP_ASCII_WORD_END); if (!ON_STR_BEGIN(s) && ONIGENC_IS_MBC_ASCII_WORD(encode, sprev, end)) { if (ON_STR_END(s) || !ONIGENC_IS_MBC_ASCII_WORD(encode, s, end)) { MOP_OUT; JUMP; } } goto fail; NEXT; #endif CASE(OP_BEGIN_BUF) MOP_IN(OP_BEGIN_BUF); if (! ON_STR_BEGIN(s)) goto fail; if (IS_NOTBOS(msa->options)) goto fail; MOP_OUT; JUMP; CASE(OP_END_BUF) MOP_IN(OP_END_BUF); if (! ON_STR_END(s)) goto fail; if (IS_NOTEOS(msa->options)) goto fail; MOP_OUT; JUMP; CASE(OP_BEGIN_LINE) MOP_IN(OP_BEGIN_LINE); if (ON_STR_BEGIN(s)) { if (IS_NOTBOL(msa->options)) goto fail; MOP_OUT; JUMP; } else if (ONIGENC_IS_MBC_NEWLINE(encode, sprev, end) #ifdef USE_CRNL_AS_LINE_TERMINATOR && !(IS_NEWLINE_CRLF(option) && ONIGENC_IS_MBC_CRNL(encode, sprev, end)) #endif && !ON_STR_END(s)) { MOP_OUT; JUMP; } goto fail; NEXT; CASE(OP_END_LINE) MOP_IN(OP_END_LINE); if (ON_STR_END(s)) { #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE_EX(encode, sprev, str, end, option, 1)) { #endif if (IS_NOTEOL(msa->options)) goto fail; MOP_OUT; JUMP; #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE } #endif } else if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 1)) { MOP_OUT; JUMP; } goto fail; NEXT; CASE(OP_SEMI_END_BUF) MOP_IN(OP_SEMI_END_BUF); if (ON_STR_END(s)) { #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE if (IS_EMPTY_STR || !ONIGENC_IS_MBC_NEWLINE_EX(encode, sprev, str, end, option, 1)) { #endif if (IS_NOTEOL(msa->options)) goto fail; MOP_OUT; JUMP; #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE } #endif } else if (ONIGENC_IS_MBC_NEWLINE_EX(encode, s, str, end, option, 1)) { UChar* ss = s + enclen(encode, s, end); if (ON_STR_END(ss)) { MOP_OUT; JUMP; } #ifdef USE_CRNL_AS_LINE_TERMINATOR else if (IS_NEWLINE_CRLF(option) && ONIGENC_IS_MBC_CRNL(encode, s, end)) { ss += enclen(encode, ss, end); if (ON_STR_END(ss)) { MOP_OUT; JUMP; } } #endif } goto fail; NEXT; CASE(OP_BEGIN_POSITION) MOP_IN(OP_BEGIN_POSITION); if (s != msa->gpos) goto fail; MOP_OUT; JUMP; CASE(OP_MEMORY_START_PUSH) MOP_IN(OP_MEMORY_START_PUSH); GET_MEMNUM_INC(mem, p); STACK_PUSH_MEM_START(mem, s); MOP_OUT; JUMP; CASE(OP_MEMORY_START) MOP_IN(OP_MEMORY_START); GET_MEMNUM_INC(mem, p); mem_start_stk[mem] = (OnigStackIndex )((void* )s); MOP_OUT; JUMP; CASE(OP_MEMORY_END_PUSH) MOP_IN(OP_MEMORY_END_PUSH); GET_MEMNUM_INC(mem, p); STACK_PUSH_MEM_END(mem, s); MOP_OUT; JUMP; CASE(OP_MEMORY_END) MOP_IN(OP_MEMORY_END); GET_MEMNUM_INC(mem, p); mem_end_stk[mem] = (OnigStackIndex )((void* )s); MOP_OUT; JUMP; CASE(OP_KEEP) MOP_IN(OP_KEEP); pkeep = s; MOP_OUT; JUMP; #ifdef USE_SUBEXP_CALL CASE(OP_MEMORY_END_PUSH_REC) MOP_IN(OP_MEMORY_END_PUSH_REC); GET_MEMNUM_INC(mem, p); STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */ STACK_PUSH_MEM_END(mem, s); mem_start_stk[mem] = GET_STACK_INDEX(stkp); MOP_OUT; JUMP; CASE(OP_MEMORY_END_REC) MOP_IN(OP_MEMORY_END_REC); GET_MEMNUM_INC(mem, p); mem_end_stk[mem] = (OnigStackIndex )((void* )s); STACK_GET_MEM_START(mem, stkp); if (BIT_STATUS_AT(reg->bt_mem_start, mem)) mem_start_stk[mem] = GET_STACK_INDEX(stkp); else mem_start_stk[mem] = (OnigStackIndex )((void* )stkp->u.mem.pstr); STACK_PUSH_MEM_END_MARK(mem); MOP_OUT; JUMP; #endif CASE(OP_BACKREF1) MOP_IN(OP_BACKREF1); mem = 1; goto backref; NEXT; CASE(OP_BACKREF2) MOP_IN(OP_BACKREF2); mem = 2; goto backref; NEXT; CASE(OP_BACKREFN) MOP_IN(OP_BACKREFN); GET_MEMNUM_INC(mem, p); backref: { int len; UChar *pstart, *pend; /* if you want to remove following line, you should check in parse and compile time. */ if (mem > num_mem) goto fail; if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail; if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail; if (BIT_STATUS_AT(reg->bt_mem_start, mem)) pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr; else pstart = (UChar* )((void* )mem_start_stk[mem]); pend = (BIT_STATUS_AT(reg->bt_mem_end, mem) ? STACK_AT(mem_end_stk[mem])->u.mem.pstr : (UChar* )((void* )mem_end_stk[mem])); n = pend - pstart; DATA_ENSURE(n); sprev = s; STRING_CMP(pstart, s, n); while (sprev + (len = enclen(encode, sprev, end)) < s) sprev += len; MOP_OUT; JUMP; } CASE(OP_BACKREFN_IC) MOP_IN(OP_BACKREFN_IC); GET_MEMNUM_INC(mem, p); { int len; UChar *pstart, *pend; /* if you want to remove following line, you should check in parse and compile time. */ if (mem > num_mem) goto fail; if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail; if (mem_start_stk[mem] == INVALID_STACK_INDEX) goto fail; if (BIT_STATUS_AT(reg->bt_mem_start, mem)) pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr; else pstart = (UChar* )((void* )mem_start_stk[mem]); pend = (BIT_STATUS_AT(reg->bt_mem_end, mem) ? STACK_AT(mem_end_stk[mem])->u.mem.pstr : (UChar* )((void* )mem_end_stk[mem])); n = pend - pstart; DATA_ENSURE(n); sprev = s; STRING_CMP_IC(case_fold_flag, pstart, &s, (int)n, end); while (sprev + (len = enclen(encode, sprev, end)) < s) sprev += len; MOP_OUT; JUMP; } NEXT; CASE(OP_BACKREF_MULTI) MOP_IN(OP_BACKREF_MULTI); { int len, is_fail; UChar *pstart, *pend, *swork; GET_LENGTH_INC(tlen, p); for (i = 0; i < tlen; i++) { GET_MEMNUM_INC(mem, p); if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue; if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue; if (BIT_STATUS_AT(reg->bt_mem_start, mem)) pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr; else pstart = (UChar* )((void* )mem_start_stk[mem]); pend = (BIT_STATUS_AT(reg->bt_mem_end, mem) ? STACK_AT(mem_end_stk[mem])->u.mem.pstr : (UChar* )((void* )mem_end_stk[mem])); n = pend - pstart; DATA_ENSURE(n); sprev = s; swork = s; STRING_CMP_VALUE(pstart, swork, n, is_fail); if (is_fail) continue; s = swork; while (sprev + (len = enclen(encode, sprev, end)) < s) sprev += len; p += (SIZE_MEMNUM * (tlen - i - 1)); break; /* success */ } if (i == tlen) goto fail; MOP_OUT; JUMP; } NEXT; CASE(OP_BACKREF_MULTI_IC) MOP_IN(OP_BACKREF_MULTI_IC); { int len, is_fail; UChar *pstart, *pend, *swork; GET_LENGTH_INC(tlen, p); for (i = 0; i < tlen; i++) { GET_MEMNUM_INC(mem, p); if (mem_end_stk[mem] == INVALID_STACK_INDEX) continue; if (mem_start_stk[mem] == INVALID_STACK_INDEX) continue; if (BIT_STATUS_AT(reg->bt_mem_start, mem)) pstart = STACK_AT(mem_start_stk[mem])->u.mem.pstr; else pstart = (UChar* )((void* )mem_start_stk[mem]); pend = (BIT_STATUS_AT(reg->bt_mem_end, mem) ? STACK_AT(mem_end_stk[mem])->u.mem.pstr : (UChar* )((void* )mem_end_stk[mem])); n = pend - pstart; DATA_ENSURE(n); sprev = s; swork = s; STRING_CMP_VALUE_IC(case_fold_flag, pstart, &swork, n, end, is_fail); if (is_fail) continue; s = swork; while (sprev + (len = enclen(encode, sprev, end)) < s) sprev += len; p += (SIZE_MEMNUM * (tlen - i - 1)); break; /* success */ } if (i == tlen) goto fail; MOP_OUT; JUMP; } #ifdef USE_BACKREF_WITH_LEVEL CASE(OP_BACKREF_WITH_LEVEL) { int len; OnigOptionType ic; LengthType level; GET_OPTION_INC(ic, p); GET_LENGTH_INC(level, p); GET_LENGTH_INC(tlen, p); sprev = s; if (backref_match_at_nested_level(reg, stk, stk_base, ic, case_fold_flag, (int )level, (int )tlen, p, &s, end)) { while (sprev + (len = enclen(encode, sprev, end)) < s) sprev += len; p += (SIZE_MEMNUM * tlen); } else goto fail; MOP_OUT; JUMP; } #endif #if 0 /* no need: IS_DYNAMIC_OPTION() == 0 */ CASE(OP_SET_OPTION_PUSH) MOP_IN(OP_SET_OPTION_PUSH); GET_OPTION_INC(option, p); STACK_PUSH_ALT(p, s, sprev, pkeep); p += SIZE_OP_SET_OPTION + SIZE_OP_FAIL; MOP_OUT; JUMP; CASE(OP_SET_OPTION) MOP_IN(OP_SET_OPTION); GET_OPTION_INC(option, p); MOP_OUT; JUMP; #endif CASE(OP_NULL_CHECK_START) MOP_IN(OP_NULL_CHECK_START); GET_MEMNUM_INC(mem, p); /* mem: null check id */ STACK_PUSH_NULL_CHECK_START(mem, s); MOP_OUT; JUMP; CASE(OP_NULL_CHECK_END) MOP_IN(OP_NULL_CHECK_END); { int isnull; GET_MEMNUM_INC(mem, p); /* mem: null check id */ STACK_NULL_CHECK(isnull, mem, s); if (isnull) { #ifdef ONIG_DEBUG_MATCH fprintf(stderr, "NULL_CHECK_END: skip id:%d, s:%"PRIuPTR" (%p)\n", (int )mem, (uintptr_t )s, s); #endif null_check_found: /* empty loop founded, skip next instruction */ switch (*p++) { case OP_JUMP: case OP_PUSH: p += SIZE_RELADDR; break; case OP_REPEAT_INC: case OP_REPEAT_INC_NG: case OP_REPEAT_INC_SG: case OP_REPEAT_INC_NG_SG: p += SIZE_MEMNUM; break; default: goto unexpected_bytecode_error; break; } } } MOP_OUT; JUMP; #ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT CASE(OP_NULL_CHECK_END_MEMST) MOP_IN(OP_NULL_CHECK_END_MEMST); { int isnull; GET_MEMNUM_INC(mem, p); /* mem: null check id */ STACK_NULL_CHECK_MEMST(isnull, mem, s, reg); if (isnull) { # ifdef ONIG_DEBUG_MATCH fprintf(stderr, "NULL_CHECK_END_MEMST: skip id:%d, s:%"PRIuPTR" (%p)\n", (int )mem, (uintptr_t )s, s); # endif if (isnull == -1) goto fail; goto null_check_found; } } MOP_OUT; JUMP; #endif #ifdef USE_SUBEXP_CALL CASE(OP_NULL_CHECK_END_MEMST_PUSH) MOP_IN(OP_NULL_CHECK_END_MEMST_PUSH); { int isnull; GET_MEMNUM_INC(mem, p); /* mem: null check id */ # ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT STACK_NULL_CHECK_MEMST_REC(isnull, mem, s, reg); # else STACK_NULL_CHECK_REC(isnull, mem, s); # endif if (isnull) { # ifdef ONIG_DEBUG_MATCH fprintf(stderr, "NULL_CHECK_END_MEMST_PUSH: skip id:%d, s:%"PRIuPTR" (%p)\n", (int )mem, (uintptr_t )s, s); # endif if (isnull == -1) goto fail; goto null_check_found; } else { STACK_PUSH_NULL_CHECK_END(mem); } } MOP_OUT; JUMP; #endif CASE(OP_JUMP) MOP_IN(OP_JUMP); GET_RELADDR_INC(addr, p); p += addr; MOP_OUT; CHECK_INTERRUPT_IN_MATCH_AT; JUMP; CASE(OP_PUSH) MOP_IN(OP_PUSH); GET_RELADDR_INC(addr, p); STACK_PUSH_ALT(p + addr, s, sprev, pkeep); MOP_OUT; JUMP; #ifdef USE_COMBINATION_EXPLOSION_CHECK CASE(OP_STATE_CHECK_PUSH) MOP_IN(OP_STATE_CHECK_PUSH); GET_STATE_CHECK_NUM_INC(mem, p); STATE_CHECK_VAL(scv, mem); if (scv) goto fail; GET_RELADDR_INC(addr, p); STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem, pkeep); MOP_OUT; JUMP; CASE(OP_STATE_CHECK_PUSH_OR_JUMP) MOP_IN(OP_STATE_CHECK_PUSH_OR_JUMP); GET_STATE_CHECK_NUM_INC(mem, p); GET_RELADDR_INC(addr, p); STATE_CHECK_VAL(scv, mem); if (scv) { p += addr; } else { STACK_PUSH_ALT_WITH_STATE_CHECK(p + addr, s, sprev, mem, pkeep); } MOP_OUT; JUMP; CASE(OP_STATE_CHECK) MOP_IN(OP_STATE_CHECK); GET_STATE_CHECK_NUM_INC(mem, p); STATE_CHECK_VAL(scv, mem); if (scv) goto fail; STACK_PUSH_STATE_CHECK(s, mem); MOP_OUT; JUMP; #endif /* USE_COMBINATION_EXPLOSION_CHECK */ CASE(OP_POP) MOP_IN(OP_POP); STACK_POP_ONE; MOP_OUT; JUMP; #ifdef USE_OP_PUSH_OR_JUMP_EXACT CASE(OP_PUSH_OR_JUMP_EXACT1) MOP_IN(OP_PUSH_OR_JUMP_EXACT1); GET_RELADDR_INC(addr, p); if (*p == *s && DATA_ENSURE_CHECK1) { p++; STACK_PUSH_ALT(p + addr, s, sprev, pkeep); MOP_OUT; JUMP; } p += (addr + 1); MOP_OUT; JUMP; #endif CASE(OP_PUSH_IF_PEEK_NEXT) MOP_IN(OP_PUSH_IF_PEEK_NEXT); GET_RELADDR_INC(addr, p); if (*p == *s) { p++; STACK_PUSH_ALT(p + addr, s, sprev, pkeep); MOP_OUT; JUMP; } p++; MOP_OUT; JUMP; CASE(OP_REPEAT) MOP_IN(OP_REPEAT); { GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */ GET_RELADDR_INC(addr, p); STACK_ENSURE(1); repeat_stk[mem] = GET_STACK_INDEX(stk); STACK_PUSH_REPEAT(mem, p); if (reg->repeat_range[mem].lower == 0) { STACK_PUSH_ALT(p + addr, s, sprev, pkeep); } } MOP_OUT; JUMP; CASE(OP_REPEAT_NG) MOP_IN(OP_REPEAT_NG); { GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */ GET_RELADDR_INC(addr, p); STACK_ENSURE(1); repeat_stk[mem] = GET_STACK_INDEX(stk); STACK_PUSH_REPEAT(mem, p); if (reg->repeat_range[mem].lower == 0) { STACK_PUSH_ALT(p, s, sprev, pkeep); p += addr; } } MOP_OUT; JUMP; CASE(OP_REPEAT_INC) MOP_IN(OP_REPEAT_INC); GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */ si = repeat_stk[mem]; stkp = STACK_AT(si); repeat_inc: stkp->u.repeat.count++; if (stkp->u.repeat.count >= reg->repeat_range[mem].upper) { /* end of repeat. Nothing to do. */ } else if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) { STACK_PUSH_ALT(p, s, sprev, pkeep); p = STACK_AT(si)->u.repeat.pcode; /* Don't use stkp after PUSH. */ } else { p = stkp->u.repeat.pcode; } STACK_PUSH_REPEAT_INC(si); MOP_OUT; CHECK_INTERRUPT_IN_MATCH_AT; JUMP; CASE(OP_REPEAT_INC_SG) MOP_IN(OP_REPEAT_INC_SG); GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */ STACK_GET_REPEAT(mem, stkp); si = GET_STACK_INDEX(stkp); goto repeat_inc; NEXT; CASE(OP_REPEAT_INC_NG) MOP_IN(OP_REPEAT_INC_NG); GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */ si = repeat_stk[mem]; stkp = STACK_AT(si); repeat_inc_ng: stkp->u.repeat.count++; if (stkp->u.repeat.count < reg->repeat_range[mem].upper) { if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) { UChar* pcode = stkp->u.repeat.pcode; STACK_PUSH_REPEAT_INC(si); STACK_PUSH_ALT(pcode, s, sprev, pkeep); } else { p = stkp->u.repeat.pcode; STACK_PUSH_REPEAT_INC(si); } } else if (stkp->u.repeat.count == reg->repeat_range[mem].upper) { STACK_PUSH_REPEAT_INC(si); } MOP_OUT; CHECK_INTERRUPT_IN_MATCH_AT; JUMP; CASE(OP_REPEAT_INC_NG_SG) MOP_IN(OP_REPEAT_INC_NG_SG); GET_MEMNUM_INC(mem, p); /* mem: OP_REPEAT ID */ STACK_GET_REPEAT(mem, stkp); si = GET_STACK_INDEX(stkp); goto repeat_inc_ng; NEXT; CASE(OP_PUSH_POS) MOP_IN(OP_PUSH_POS); STACK_PUSH_POS(s, sprev, pkeep); MOP_OUT; JUMP; CASE(OP_POP_POS) MOP_IN(OP_POP_POS); { STACK_POS_END(stkp); s = stkp->u.state.pstr; sprev = stkp->u.state.pstr_prev; } MOP_OUT; JUMP; CASE(OP_PUSH_POS_NOT) MOP_IN(OP_PUSH_POS_NOT); GET_RELADDR_INC(addr, p); STACK_PUSH_POS_NOT(p + addr, s, sprev, pkeep); MOP_OUT; JUMP; CASE(OP_FAIL_POS) MOP_IN(OP_FAIL_POS); STACK_POP_TIL_POS_NOT; goto fail; NEXT; CASE(OP_PUSH_STOP_BT) MOP_IN(OP_PUSH_STOP_BT); STACK_PUSH_STOP_BT; MOP_OUT; JUMP; CASE(OP_POP_STOP_BT) MOP_IN(OP_POP_STOP_BT); STACK_STOP_BT_END; MOP_OUT; JUMP; CASE(OP_LOOK_BEHIND) MOP_IN(OP_LOOK_BEHIND); GET_LENGTH_INC(tlen, p); s = (UChar* )ONIGENC_STEP_BACK(encode, str, s, end, (int )tlen); if (IS_NULL(s)) goto fail; sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s, end); MOP_OUT; JUMP; CASE(OP_PUSH_LOOK_BEHIND_NOT) MOP_IN(OP_PUSH_LOOK_BEHIND_NOT); GET_RELADDR_INC(addr, p); GET_LENGTH_INC(tlen, p); q = (UChar* )ONIGENC_STEP_BACK(encode, str, s, end, (int )tlen); if (IS_NULL(q)) { /* too short case -> success. ex. /(?<!XXX)a/.match("a") If you want to change to fail, replace following line. */ p += addr; /* goto fail; */ } else { STACK_PUSH_LOOK_BEHIND_NOT(p + addr, s, sprev, pkeep); s = q; sprev = (UChar* )onigenc_get_prev_char_head(encode, str, s, end); } MOP_OUT; JUMP; CASE(OP_FAIL_LOOK_BEHIND_NOT) MOP_IN(OP_FAIL_LOOK_BEHIND_NOT); STACK_POP_TIL_LOOK_BEHIND_NOT; goto fail; NEXT; CASE(OP_PUSH_ABSENT_POS) MOP_IN(OP_PUSH_ABSENT_POS); /* Save the absent-start-pos and the original end-pos. */ STACK_PUSH_ABSENT_POS(s, ABSENT_END_POS); MOP_OUT; JUMP; CASE(OP_ABSENT) MOP_IN(OP_ABSENT); { const UChar* aend = ABSENT_END_POS; UChar* absent; UChar* selfp = p - 1; STACK_POP_ABSENT_POS(absent, ABSENT_END_POS); /* Restore end-pos. */ GET_RELADDR_INC(addr, p); #ifdef ONIG_DEBUG_MATCH fprintf(stderr, "ABSENT: s:%p, end:%p, absent:%p, aend:%p\n", s, end, absent, aend); #endif if ((absent > aend) && (s > absent)) { /* An empty match occurred in (?~...) at the start point. * Never match. */ STACK_POP; goto fail; } else if ((s >= aend) && (s > absent)) { if (s > aend) { /* Only one (or less) character matched in the last iteration. * This is not a possible point. */ goto fail; } /* All possible points were found. Try matching after (?~...). */ DATA_ENSURE(0); p += addr; } else { STACK_PUSH_ALT(p + addr, s, sprev, pkeep); /* Push possible point. */ n = enclen(encode, s, end); STACK_PUSH_ABSENT_POS(absent, ABSENT_END_POS); /* Save the original pos. */ STACK_PUSH_ALT(selfp, s + n, s, pkeep); /* Next iteration. */ STACK_PUSH_ABSENT; ABSENT_END_POS = aend; } } MOP_OUT; JUMP; CASE(OP_ABSENT_END) MOP_IN(OP_ABSENT_END); /* The pattern inside (?~...) was matched. * Set the end-pos temporary and go to next iteration. */ if (sprev < ABSENT_END_POS) ABSENT_END_POS = sprev; #ifdef ONIG_DEBUG_MATCH fprintf(stderr, "ABSENT_END: end:%p\n", ABSENT_END_POS); #endif STACK_POP_TIL_ABSENT; goto fail; NEXT; #ifdef USE_SUBEXP_CALL CASE(OP_CALL) MOP_IN(OP_CALL); GET_ABSADDR_INC(addr, p); STACK_PUSH_CALL_FRAME(p); p = reg->p + addr; MOP_OUT; JUMP; CASE(OP_RETURN) MOP_IN(OP_RETURN); STACK_RETURN(p); STACK_PUSH_RETURN; MOP_OUT; JUMP; #endif CASE(OP_CONDITION) MOP_IN(OP_CONDITION); GET_MEMNUM_INC(mem, p); GET_RELADDR_INC(addr, p); if ((mem > num_mem) || (mem_end_stk[mem] == INVALID_STACK_INDEX) || (mem_start_stk[mem] == INVALID_STACK_INDEX)) { p += addr; } MOP_OUT; JUMP; CASE(OP_FINISH) goto finish; NEXT; CASE(OP_FAIL) if (0) { /* fall */ fail: MOP_OUT; } MOP_IN(OP_FAIL); STACK_POP; p = stk->u.state.pcode; s = stk->u.state.pstr; sprev = stk->u.state.pstr_prev; pkeep = stk->u.state.pkeep; #ifdef USE_COMBINATION_EXPLOSION_CHECK if (stk->u.state.state_check != 0) { stk->type = STK_STATE_CHECK_MARK; stk++; } #endif MOP_OUT; JUMP; DEFAULT goto bytecode_error; } VM_LOOP_END finish: STACK_SAVE; if (xmalloc_base) xfree(xmalloc_base); return best_len; #ifdef ONIG_DEBUG stack_error: STACK_SAVE; if (xmalloc_base) xfree(xmalloc_base); return ONIGERR_STACK_BUG; #endif bytecode_error: STACK_SAVE; if (xmalloc_base) xfree(xmalloc_base); return ONIGERR_UNDEFINED_BYTECODE; unexpected_bytecode_error: STACK_SAVE; if (xmalloc_base) xfree(xmalloc_base); return ONIGERR_UNEXPECTED_BYTECODE; } static UChar* slow_search(OnigEncoding enc, UChar* target, UChar* target_end, const UChar* text, const UChar* text_end, UChar* text_range) { UChar *t, *p, *s, *end; end = (UChar* )text_end; end -= target_end - target - 1; if (end > text_range) end = text_range; s = (UChar* )text; if (enc->max_enc_len == enc->min_enc_len) { int n = enc->max_enc_len; while (s < end) { if (*s == *target) { p = s + 1; t = target + 1; if (target_end == t || memcmp(t, p, target_end - t) == 0) return s; } s += n; } return (UChar* )NULL; } while (s < end) { if (*s == *target) { p = s + 1; t = target + 1; if (target_end == t || memcmp(t, p, target_end - t) == 0) return s; } s += enclen(enc, s, text_end); } return (UChar* )NULL; } static int str_lower_case_match(OnigEncoding enc, int case_fold_flag, const UChar* t, const UChar* tend, const UChar* p, const UChar* end) { int lowlen; UChar *q, lowbuf[ONIGENC_MBC_CASE_FOLD_MAXLEN]; while (t < tend) { lowlen = ONIGENC_MBC_CASE_FOLD(enc, case_fold_flag, &p, end, lowbuf); q = lowbuf; while (lowlen > 0) { if (*t++ != *q++) return 0; lowlen--; } } return 1; } static UChar* slow_search_ic(OnigEncoding enc, int case_fold_flag, UChar* target, UChar* target_end, const UChar* text, const UChar* text_end, UChar* text_range) { UChar *s, *end; end = (UChar* )text_end; end -= target_end - target - 1; if (end > text_range) end = text_range; s = (UChar* )text; while (s < end) { if (str_lower_case_match(enc, case_fold_flag, target, target_end, s, text_end)) return s; s += enclen(enc, s, text_end); } return (UChar* )NULL; } static UChar* slow_search_backward(OnigEncoding enc, UChar* target, UChar* target_end, const UChar* text, const UChar* adjust_text, const UChar* text_end, const UChar* text_start) { UChar *t, *p, *s; s = (UChar* )text_end; s -= (target_end - target); if (s > text_start) s = (UChar* )text_start; else s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, adjust_text, s, text_end); while (s >= text) { if (*s == *target) { p = s + 1; t = target + 1; while (t < target_end) { if (*t != *p++) break; t++; } if (t == target_end) return s; } s = (UChar* )onigenc_get_prev_char_head(enc, adjust_text, s, text_end); } return (UChar* )NULL; } static UChar* slow_search_backward_ic(OnigEncoding enc, int case_fold_flag, UChar* target, UChar* target_end, const UChar* text, const UChar* adjust_text, const UChar* text_end, const UChar* text_start) { UChar *s; s = (UChar* )text_end; s -= (target_end - target); if (s > text_start) s = (UChar* )text_start; else s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, adjust_text, s, text_end); while (s >= text) { if (str_lower_case_match(enc, case_fold_flag, target, target_end, s, text_end)) return s; s = (UChar* )onigenc_get_prev_char_head(enc, adjust_text, s, text_end); } return (UChar* )NULL; } #ifndef USE_SUNDAY_QUICK_SEARCH /* Boyer-Moore-Horspool search applied to a multibyte string */ static UChar* bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* text_end, const UChar* text_range) { const UChar *s, *se, *t, *p, *end; const UChar *tail; ptrdiff_t skip, tlen1; # ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "bm_search_notrev: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n", (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range); # endif tail = target_end - 1; tlen1 = tail - target; end = text_range; if (end + tlen1 > text_end) end = text_end - tlen1; s = text; if (IS_NULL(reg->int_map)) { while (s < end) { p = se = s + tlen1; t = tail; while (*p == *t) { if (t == target) return (UChar* )s; p--; t--; } skip = reg->map[*se]; t = s; do { s += enclen(reg->enc, s, end); } while ((s - t) < skip && s < end); } } else { # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE while (s < end) { p = se = s + tlen1; t = tail; while (*p == *t) { if (t == target) return (UChar* )s; p--; t--; } skip = reg->int_map[*se]; t = s; do { s += enclen(reg->enc, s, end); } while ((s - t) < skip && s < end); } # endif } return (UChar* )NULL; } /* Boyer-Moore-Horspool search */ static UChar* bm_search(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* text_end, const UChar* text_range) { const UChar *s, *t, *p, *end; const UChar *tail; # ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "bm_search: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n", (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range); # endif end = text_range + (target_end - target) - 1; if (end > text_end) end = text_end; tail = target_end - 1; s = text + (target_end - target) - 1; if (IS_NULL(reg->int_map)) { while (s < end) { p = s; t = tail; # ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "bm_search_loop: pos: %"PRIdPTR" %s\n", (intptr_t )(s - text), s); # endif while (*p == *t) { if (t == target) return (UChar* )p; p--; t--; } s += reg->map[*s]; } } else { /* see int_map[] */ # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE while (s < end) { p = s; t = tail; while (*p == *t) { if (t == target) return (UChar* )p; p--; t--; } s += reg->int_map[*s]; } # endif } return (UChar* )NULL; } /* Boyer-Moore-Horspool search applied to a multibyte string (ignore case) */ static UChar* bm_search_notrev_ic(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* text_end, const UChar* text_range) { const UChar *s, *se, *t, *end; const UChar *tail; ptrdiff_t skip, tlen1; OnigEncoding enc = reg->enc; int case_fold_flag = reg->case_fold_flag; # ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "bm_search_notrev_ic: text: %d (%p), text_end: %d (%p), text_range: %d (%p)\n", (int )text, text, (int )text_end, text_end, (int )text_range, text_range); # endif tail = target_end - 1; tlen1 = tail - target; end = text_range; if (end + tlen1 > text_end) end = text_end - tlen1; s = text; if (IS_NULL(reg->int_map)) { while (s < end) { se = s + tlen1; if (str_lower_case_match(enc, case_fold_flag, target, target_end, s, se + 1)) return (UChar* )s; skip = reg->map[*se]; t = s; do { s += enclen(reg->enc, s, end); } while ((s - t) < skip && s < end); } } else { # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE while (s < end) { se = s + tlen1; if (str_lower_case_match(enc, case_fold_flag, target, target_end, s, se + 1)) return (UChar* )s; skip = reg->int_map[*se]; t = s; do { s += enclen(reg->enc, s, end); } while ((s - t) < skip && s < end); } # endif } return (UChar* )NULL; } /* Boyer-Moore-Horspool search (ignore case) */ static UChar* bm_search_ic(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* text_end, const UChar* text_range) { const UChar *s, *p, *end; const UChar *tail; OnigEncoding enc = reg->enc; int case_fold_flag = reg->case_fold_flag; # ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "bm_search_ic: text: %d (%p), text_end: %d (%p), text_range: %d (%p)\n", (int )text, text, (int )text_end, text_end, (int )text_range, text_range); # endif end = text_range + (target_end - target) - 1; if (end > text_end) end = text_end; tail = target_end - 1; s = text + (target_end - target) - 1; if (IS_NULL(reg->int_map)) { while (s < end) { p = s - (target_end - target) + 1; if (str_lower_case_match(enc, case_fold_flag, target, target_end, p, s + 1)) return (UChar* )p; s += reg->map[*s]; } } else { /* see int_map[] */ # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE while (s < end) { p = s - (target_end - target) + 1; if (str_lower_case_match(enc, case_fold_flag, target, target_end, p, s + 1)) return (UChar* )p; s += reg->int_map[*s]; } # endif } return (UChar* )NULL; } #else /* USE_SUNDAY_QUICK_SEARCH */ /* Sunday's quick search applied to a multibyte string */ static UChar* bm_search_notrev(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* text_end, const UChar* text_range) { const UChar *s, *se, *t, *p, *end; const UChar *tail; ptrdiff_t skip, tlen1; OnigEncoding enc = reg->enc; # ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "bm_search_notrev: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n", (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range); # endif tail = target_end - 1; tlen1 = tail - target; end = text_range; if (end + tlen1 > text_end) end = text_end - tlen1; s = text; if (IS_NULL(reg->int_map)) { while (s < end) { p = se = s + tlen1; t = tail; while (*p == *t) { if (t == target) return (UChar* )s; p--; t--; } if (s + 1 >= end) break; skip = reg->map[se[1]]; t = s; do { s += enclen(enc, s, end); } while ((s - t) < skip && s < end); } } else { # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE while (s < end) { p = se = s + tlen1; t = tail; while (*p == *t) { if (t == target) return (UChar* )s; p--; t--; } if (s + 1 >= end) break; skip = reg->int_map[se[1]]; t = s; do { s += enclen(enc, s, end); } while ((s - t) < skip && s < end); } # endif } return (UChar* )NULL; } /* Sunday's quick search */ static UChar* bm_search(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* text_end, const UChar* text_range) { const UChar *s, *t, *p, *end; const UChar *tail; ptrdiff_t tlen1; # ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "bm_search: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n", (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range); # endif tail = target_end - 1; tlen1 = tail - target; end = text_range + tlen1; if (end > text_end) end = text_end; s = text + tlen1; if (IS_NULL(reg->int_map)) { while (s < end) { p = s; t = tail; while (*p == *t) { if (t == target) return (UChar* )p; p--; t--; } if (s + 1 >= end) break; s += reg->map[s[1]]; } } else { /* see int_map[] */ # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE while (s < end) { p = s; t = tail; while (*p == *t) { if (t == target) return (UChar* )p; p--; t--; } if (s + 1 >= end) break; s += reg->int_map[s[1]]; } # endif } return (UChar* )NULL; } /* Sunday's quick search applied to a multibyte string (ignore case) */ static UChar* bm_search_notrev_ic(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* text_end, const UChar* text_range) { const UChar *s, *se, *t, *end; const UChar *tail; ptrdiff_t skip, tlen1; OnigEncoding enc = reg->enc; int case_fold_flag = reg->case_fold_flag; # ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "bm_search_notrev_ic: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n", (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range); # endif tail = target_end - 1; tlen1 = tail - target; end = text_range; if (end + tlen1 > text_end) end = text_end - tlen1; s = text; if (IS_NULL(reg->int_map)) { while (s < end) { se = s + tlen1; if (str_lower_case_match(enc, case_fold_flag, target, target_end, s, se + 1)) return (UChar* )s; if (s + 1 >= end) break; skip = reg->map[se[1]]; t = s; do { s += enclen(enc, s, end); } while ((s - t) < skip && s < end); } } else { # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE while (s < end) { se = s + tlen1; if (str_lower_case_match(enc, case_fold_flag, target, target_end, s, se + 1)) return (UChar* )s; if (s + 1 >= end) break; skip = reg->int_map[se[1]]; t = s; do { s += enclen(enc, s, end); } while ((s - t) < skip && s < end); } # endif } return (UChar* )NULL; } /* Sunday's quick search (ignore case) */ static UChar* bm_search_ic(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* text_end, const UChar* text_range) { const UChar *s, *p, *end; const UChar *tail; ptrdiff_t tlen1; OnigEncoding enc = reg->enc; int case_fold_flag = reg->case_fold_flag; # ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "bm_search_ic: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n", (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range); # endif tail = target_end - 1; tlen1 = tail - target; end = text_range + tlen1; if (end > text_end) end = text_end; s = text + tlen1; if (IS_NULL(reg->int_map)) { while (s < end) { p = s - tlen1; if (str_lower_case_match(enc, case_fold_flag, target, target_end, p, s + 1)) return (UChar* )p; if (s + 1 >= end) break; s += reg->map[s[1]]; } } else { /* see int_map[] */ # if OPT_EXACT_MAXLEN >= ONIG_CHAR_TABLE_SIZE while (s < end) { p = s - tlen1; if (str_lower_case_match(enc, case_fold_flag, target, target_end, p, s + 1)) return (UChar* )p; if (s + 1 >= end) break; s += reg->int_map[s[1]]; } # endif } return (UChar* )NULL; } #endif /* USE_SUNDAY_QUICK_SEARCH */ #ifdef USE_INT_MAP_BACKWARD static int set_bm_backward_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED, int** skip) { int i, len; if (IS_NULL(*skip)) { *skip = (int* )xmalloc(sizeof(int) * ONIG_CHAR_TABLE_SIZE); if (IS_NULL(*skip)) return ONIGERR_MEMORY; } len = (int )(end - s); for (i = 0; i < ONIG_CHAR_TABLE_SIZE; i++) (*skip)[i] = len; for (i = len - 1; i > 0; i--) (*skip)[s[i]] = i; return 0; } static UChar* bm_search_backward(regex_t* reg, const UChar* target, const UChar* target_end, const UChar* text, const UChar* adjust_text, const UChar* text_end, const UChar* text_start) { const UChar *s, *t, *p; s = text_end - (target_end - target); if (text_start < s) s = text_start; else s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, adjust_text, s, text_end); while (s >= text) { p = s; t = target; while (t < target_end && *p == *t) { p++; t++; } if (t == target_end) return (UChar* )s; s -= reg->int_map_backward[*s]; s = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, adjust_text, s, text_end); } return (UChar* )NULL; } #endif static UChar* map_search(OnigEncoding enc, UChar map[], const UChar* text, const UChar* text_range, const UChar* text_end) { const UChar *s = text; while (s < text_range) { if (map[*s]) return (UChar* )s; s += enclen(enc, s, text_end); } return (UChar* )NULL; } static UChar* map_search_backward(OnigEncoding enc, UChar map[], const UChar* text, const UChar* adjust_text, const UChar* text_start, const UChar* text_end) { const UChar *s = text_start; while (s >= text) { if (map[*s]) return (UChar* )s; s = onigenc_get_prev_char_head(enc, adjust_text, s, text_end); } return (UChar* )NULL; } extern OnigPosition onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, OnigOptionType option) { ptrdiff_t r; UChar *prev; OnigMatchArg msa; MATCH_ARG_INIT(msa, option, region, at, at); #ifdef USE_COMBINATION_EXPLOSION_CHECK { int offset = at - str; STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check); } #endif if (region) { r = onig_region_resize_clear(region, reg->num_mem + 1); } else r = 0; if (r == 0) { prev = (UChar* )onigenc_get_prev_char_head(reg->enc, str, at, end); r = match_at(reg, str, end, #ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE end, #endif at, prev, &msa); } MATCH_ARG_FREE(msa); return r; } static int forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s, UChar* range, UChar** low, UChar** high, UChar** low_prev) { UChar *p, *pprev = (UChar* )NULL; #ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "forward_search_range: str: %"PRIuPTR" (%p), end: %"PRIuPTR" (%p), s: %"PRIuPTR" (%p), range: %"PRIuPTR" (%p)\n", (uintptr_t )str, str, (uintptr_t )end, end, (uintptr_t )s, s, (uintptr_t )range, range); #endif p = s; if (reg->dmin > 0) { if (ONIGENC_IS_SINGLEBYTE(reg->enc)) { p += reg->dmin; } else { UChar *q = p + reg->dmin; while (p < q) p += enclen(reg->enc, p, end); } } retry: switch (reg->optimize) { case ONIG_OPTIMIZE_EXACT: p = slow_search(reg->enc, reg->exact, reg->exact_end, p, end, range); break; case ONIG_OPTIMIZE_EXACT_IC: p = slow_search_ic(reg->enc, reg->case_fold_flag, reg->exact, reg->exact_end, p, end, range); break; case ONIG_OPTIMIZE_EXACT_BM: p = bm_search(reg, reg->exact, reg->exact_end, p, end, range); break; case ONIG_OPTIMIZE_EXACT_BM_NOT_REV: p = bm_search_notrev(reg, reg->exact, reg->exact_end, p, end, range); break; case ONIG_OPTIMIZE_EXACT_BM_IC: p = bm_search_ic(reg, reg->exact, reg->exact_end, p, end, range); break; case ONIG_OPTIMIZE_EXACT_BM_NOT_REV_IC: p = bm_search_notrev_ic(reg, reg->exact, reg->exact_end, p, end, range); break; case ONIG_OPTIMIZE_MAP: p = map_search(reg->enc, reg->map, p, range, end); break; } if (p && p < range) { if (p - reg->dmin < s) { retry_gate: pprev = p; p += enclen(reg->enc, p, end); goto retry; } if (reg->sub_anchor) { UChar* prev; switch (reg->sub_anchor) { case ANCHOR_BEGIN_LINE: if (!ON_STR_BEGIN(p)) { prev = onigenc_get_prev_char_head(reg->enc, (pprev ? pprev : str), p, end); if (!ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 0)) goto retry_gate; } break; case ANCHOR_END_LINE: if (ON_STR_END(p)) { #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE prev = (UChar* )onigenc_get_prev_char_head(reg->enc, (pprev ? pprev : str), p); if (prev && ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 1)) goto retry_gate; #endif } else if (! ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, p, str, end, reg->options, 1)) goto retry_gate; break; } } if (reg->dmax == 0) { *low = p; if (low_prev) { if (*low > s) *low_prev = onigenc_get_prev_char_head(reg->enc, s, p, end); else *low_prev = onigenc_get_prev_char_head(reg->enc, (pprev ? pprev : str), p, end); } } else { if (reg->dmax != ONIG_INFINITE_DISTANCE) { *low = p - reg->dmax; if (*low > s) { *low = onigenc_get_right_adjust_char_head_with_prev(reg->enc, s, *low, end, (const UChar** )low_prev); if (low_prev && IS_NULL(*low_prev)) *low_prev = onigenc_get_prev_char_head(reg->enc, (pprev ? pprev : s), *low, end); } else { if (low_prev) *low_prev = onigenc_get_prev_char_head(reg->enc, (pprev ? pprev : str), *low, end); } } } /* no needs to adjust *high, *high is used as range check only */ *high = p - reg->dmin; #ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "forward_search_range success: low: %"PRIdPTR", high: %"PRIdPTR", dmin: %"PRIdPTR", dmax: %"PRIdPTR"\n", *low - str, *high - str, reg->dmin, reg->dmax); #endif return 1; /* success */ } return 0; /* fail */ } #define BM_BACKWARD_SEARCH_LENGTH_THRESHOLD 100 static int backward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s, const UChar* range, UChar* adjrange, UChar** low, UChar** high) { UChar *p; range += reg->dmin; p = s; retry: switch (reg->optimize) { case ONIG_OPTIMIZE_EXACT: exact_method: p = slow_search_backward(reg->enc, reg->exact, reg->exact_end, range, adjrange, end, p); break; case ONIG_OPTIMIZE_EXACT_IC: case ONIG_OPTIMIZE_EXACT_BM_IC: case ONIG_OPTIMIZE_EXACT_BM_NOT_REV_IC: p = slow_search_backward_ic(reg->enc, reg->case_fold_flag, reg->exact, reg->exact_end, range, adjrange, end, p); break; case ONIG_OPTIMIZE_EXACT_BM: case ONIG_OPTIMIZE_EXACT_BM_NOT_REV: #ifdef USE_INT_MAP_BACKWARD if (IS_NULL(reg->int_map_backward)) { int r; if (s - range < BM_BACKWARD_SEARCH_LENGTH_THRESHOLD) goto exact_method; r = set_bm_backward_skip(reg->exact, reg->exact_end, reg->enc, &(reg->int_map_backward)); if (r) return r; } p = bm_search_backward(reg, reg->exact, reg->exact_end, range, adjrange, end, p); #else goto exact_method; #endif break; case ONIG_OPTIMIZE_MAP: p = map_search_backward(reg->enc, reg->map, range, adjrange, p, end); break; } if (p) { if (reg->sub_anchor) { UChar* prev; switch (reg->sub_anchor) { case ANCHOR_BEGIN_LINE: if (!ON_STR_BEGIN(p)) { prev = onigenc_get_prev_char_head(reg->enc, str, p, end); if (!ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 0)) { p = prev; goto retry; } } break; case ANCHOR_END_LINE: if (ON_STR_END(p)) { #ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE prev = onigenc_get_prev_char_head(reg->enc, adjrange, p); if (IS_NULL(prev)) goto fail; if (ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 1)) { p = prev; goto retry; } #endif } else if (! ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, p, str, end, reg->options, 1)) { p = onigenc_get_prev_char_head(reg->enc, adjrange, p, end); if (IS_NULL(p)) goto fail; goto retry; } break; } } /* no needs to adjust *high, *high is used as range check only */ if (reg->dmax != ONIG_INFINITE_DISTANCE) { *low = p - reg->dmax; *high = p - reg->dmin; *high = onigenc_get_right_adjust_char_head(reg->enc, adjrange, *high, end); } #ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "backward_search_range: low: %d, high: %d\n", (int )(*low - str), (int )(*high - str)); #endif return 1; /* success */ } fail: #ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "backward_search_range: fail.\n"); #endif return 0; /* fail */ } extern OnigPosition onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option) { return onig_search_gpos(reg, str, end, start, start, range, region, option); } extern OnigPosition onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end, const UChar* global_pos, const UChar* start, const UChar* range, OnigRegion* region, OnigOptionType option) { ptrdiff_t r; UChar *s, *prev; OnigMatchArg msa; #ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE const UChar *orig_start = start; const UChar *orig_range = range; #endif #ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "onig_search (entry point): str: %"PRIuPTR" (%p), end: %"PRIuPTR", start: %"PRIuPTR", range: %"PRIuPTR"\n", (uintptr_t )str, str, end - str, start - str, range - str); #endif if (region) { r = onig_region_resize_clear(region, reg->num_mem + 1); if (r) goto finish_no_msa; } if (start > end || start < str) goto mismatch_no_msa; #ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE # ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE # define MATCH_AND_RETURN_CHECK(upper_range) \ r = match_at(reg, str, end, (upper_range), s, prev, &msa); \ if (r != ONIG_MISMATCH) {\ if (r >= 0) {\ if (! IS_FIND_LONGEST(reg->options)) {\ goto match;\ }\ }\ else goto finish; /* error */ \ } # else # define MATCH_AND_RETURN_CHECK(upper_range) \ r = match_at(reg, str, end, (upper_range), s, prev, &msa); \ if (r != ONIG_MISMATCH) {\ if (r >= 0) {\ goto match;\ }\ else goto finish; /* error */ \ } # endif /* USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE */ #else # ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE # define MATCH_AND_RETURN_CHECK(none) \ r = match_at(reg, str, end, s, prev, &msa);\ if (r != ONIG_MISMATCH) {\ if (r >= 0) {\ if (! IS_FIND_LONGEST(reg->options)) {\ goto match;\ }\ }\ else goto finish; /* error */ \ } # else # define MATCH_AND_RETURN_CHECK(none) \ r = match_at(reg, str, end, s, prev, &msa);\ if (r != ONIG_MISMATCH) {\ if (r >= 0) {\ goto match;\ }\ else goto finish; /* error */ \ } # endif /* USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE */ #endif /* USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE */ /* anchor optimize: resume search range */ if (reg->anchor != 0 && str < end) { UChar *min_semi_end, *max_semi_end; if (reg->anchor & ANCHOR_BEGIN_POSITION) { /* search start-position only */ begin_position: if (range > start) { if (global_pos > start) { if (global_pos < range) range = global_pos + 1; } else range = start + 1; } else range = start; } else if (reg->anchor & ANCHOR_BEGIN_BUF) { /* search str-position only */ if (range > start) { if (start != str) goto mismatch_no_msa; range = str + 1; } else { if (range <= str) { start = str; range = str; } else goto mismatch_no_msa; } } else if (reg->anchor & ANCHOR_END_BUF) { min_semi_end = max_semi_end = (UChar* )end; end_buf: if ((OnigDistance )(max_semi_end - str) < reg->anchor_dmin) goto mismatch_no_msa; if (range > start) { if ((OnigDistance )(min_semi_end - start) > reg->anchor_dmax) { start = min_semi_end - reg->anchor_dmax; if (start < end) start = onigenc_get_right_adjust_char_head(reg->enc, str, start, end); } if ((OnigDistance )(max_semi_end - (range - 1)) < reg->anchor_dmin) { range = max_semi_end - reg->anchor_dmin + 1; } if (start > range) goto mismatch_no_msa; /* If start == range, match with empty at end. Backward search is used. */ } else { if ((OnigDistance )(min_semi_end - range) > reg->anchor_dmax) { range = min_semi_end - reg->anchor_dmax; } if ((OnigDistance )(max_semi_end - start) < reg->anchor_dmin) { start = max_semi_end - reg->anchor_dmin; start = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, str, start, end); } if (range > start) goto mismatch_no_msa; } } else if (reg->anchor & ANCHOR_SEMI_END_BUF) { UChar* pre_end = ONIGENC_STEP_BACK(reg->enc, str, end, end, 1); max_semi_end = (UChar* )end; if (ONIGENC_IS_MBC_NEWLINE(reg->enc, pre_end, end)) { min_semi_end = pre_end; #ifdef USE_CRNL_AS_LINE_TERMINATOR pre_end = ONIGENC_STEP_BACK(reg->enc, str, pre_end, end, 1); if (IS_NOT_NULL(pre_end) && IS_NEWLINE_CRLF(reg->options) && ONIGENC_IS_MBC_CRNL(reg->enc, pre_end, end)) { min_semi_end = pre_end; } #endif if (min_semi_end > str && start <= min_semi_end) { goto end_buf; } } else { min_semi_end = (UChar* )end; goto end_buf; } } else if ((reg->anchor & ANCHOR_ANYCHAR_STAR_ML)) { goto begin_position; } } else if (str == end) { /* empty string */ static const UChar address_for_empty_string[] = ""; #ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "onig_search: empty string.\n"); #endif if (reg->threshold_len == 0) { start = end = str = address_for_empty_string; s = (UChar* )start; prev = (UChar* )NULL; MATCH_ARG_INIT(msa, option, region, start, start); #ifdef USE_COMBINATION_EXPLOSION_CHECK msa.state_check_buff = (void* )0; msa.state_check_buff_size = 0; /* NO NEED, for valgrind */ #endif MATCH_AND_RETURN_CHECK(end); goto mismatch; } goto mismatch_no_msa; } #ifdef ONIG_DEBUG_SEARCH fprintf(stderr, "onig_search(apply anchor): end: %d, start: %d, range: %d\n", (int )(end - str), (int )(start - str), (int )(range - str)); #endif MATCH_ARG_INIT(msa, option, region, start, global_pos); #ifdef USE_COMBINATION_EXPLOSION_CHECK { int offset = (MIN(start, range) - str); STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check); } #endif s = (UChar* )start; if (range > start) { /* forward search */ if (s > str) prev = onigenc_get_prev_char_head(reg->enc, str, s, end); else prev = (UChar* )NULL; if (reg->optimize != ONIG_OPTIMIZE_NONE) { UChar *sch_range, *low, *high, *low_prev; sch_range = (UChar* )range; if (reg->dmax != 0) { if (reg->dmax == ONIG_INFINITE_DISTANCE) sch_range = (UChar* )end; else { sch_range += reg->dmax; if (sch_range > end) sch_range = (UChar* )end; } } if ((end - start) < reg->threshold_len) goto mismatch; if (reg->dmax != ONIG_INFINITE_DISTANCE) { do { if (! forward_search_range(reg, str, end, s, sch_range, &low, &high, &low_prev)) goto mismatch; if (s < low) { s = low; prev = low_prev; } while (s <= high) { MATCH_AND_RETURN_CHECK(orig_range); prev = s; s += enclen(reg->enc, s, end); } } while (s < range); goto mismatch; } else { /* check only. */ if (! forward_search_range(reg, str, end, s, sch_range, &low, &high, (UChar** )NULL)) goto mismatch; if ((reg->anchor & ANCHOR_ANYCHAR_STAR) != 0) { do { MATCH_AND_RETURN_CHECK(orig_range); prev = s; s += enclen(reg->enc, s, end); if ((reg->anchor & (ANCHOR_LOOK_BEHIND | ANCHOR_PREC_READ_NOT)) == 0) { while (!ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 0) && s < range) { prev = s; s += enclen(reg->enc, s, end); } } } while (s < range); goto mismatch; } } } do { MATCH_AND_RETURN_CHECK(orig_range); prev = s; s += enclen(reg->enc, s, end); } while (s < range); if (s == range) { /* because empty match with /$/. */ MATCH_AND_RETURN_CHECK(orig_range); } } else { /* backward search */ if (reg->optimize != ONIG_OPTIMIZE_NONE) { UChar *low, *high, *adjrange, *sch_start; if (range < end) adjrange = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, str, range, end); else adjrange = (UChar* )end; if (reg->dmax != ONIG_INFINITE_DISTANCE && (end - range) >= reg->threshold_len) { do { sch_start = s + reg->dmax; if (sch_start > end) sch_start = (UChar* )end; if (backward_search_range(reg, str, end, sch_start, range, adjrange, &low, &high) <= 0) goto mismatch; if (s > high) s = high; while (s >= low) { prev = onigenc_get_prev_char_head(reg->enc, str, s, end); MATCH_AND_RETURN_CHECK(orig_start); s = prev; } } while (s >= range); goto mismatch; } else { /* check only. */ if ((end - range) < reg->threshold_len) goto mismatch; sch_start = s; if (reg->dmax != 0) { if (reg->dmax == ONIG_INFINITE_DISTANCE) sch_start = (UChar* )end; else { sch_start += reg->dmax; if (sch_start > end) sch_start = (UChar* )end; else sch_start = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, start, sch_start, end); } } if (backward_search_range(reg, str, end, sch_start, range, adjrange, &low, &high) <= 0) goto mismatch; } } do { prev = onigenc_get_prev_char_head(reg->enc, str, s, end); MATCH_AND_RETURN_CHECK(orig_start); s = prev; } while (s >= range); } mismatch: #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if (IS_FIND_LONGEST(reg->options)) { if (msa.best_len >= 0) { s = msa.best_s; goto match; } } #endif r = ONIG_MISMATCH; finish: MATCH_ARG_FREE(msa); /* If result is mismatch and no FIND_NOT_EMPTY option, then the region is not set in match_at(). */ if (IS_FIND_NOT_EMPTY(reg->options) && region) { onig_region_clear(region); } #ifdef ONIG_DEBUG if (r != ONIG_MISMATCH) fprintf(stderr, "onig_search: error %"PRIdPTRDIFF"\n", r); #endif return r; mismatch_no_msa: r = ONIG_MISMATCH; finish_no_msa: #ifdef ONIG_DEBUG if (r != ONIG_MISMATCH) fprintf(stderr, "onig_search: error %"PRIdPTRDIFF"\n", r); #endif return r; match: MATCH_ARG_FREE(msa); return s - str; } extern OnigPosition onig_scan(regex_t* reg, const UChar* str, const UChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(OnigPosition, OnigPosition, OnigRegion*, void*), void* callback_arg) { OnigPosition r; OnigPosition n; int rs; const UChar* start; n = 0; start = str; while (1) { r = onig_search(reg, str, end, start, end, region, option); if (r >= 0) { rs = scan_callback(n, r, region, callback_arg); n++; if (rs != 0) return rs; if (region->end[0] == start - str) start++; else start = str + region->end[0]; if (start > end) break; } else if (r == ONIG_MISMATCH) { break; } else { /* error */ return r; } } return n; } extern OnigEncoding onig_get_encoding(const regex_t* reg) { return reg->enc; } extern OnigOptionType onig_get_options(const regex_t* reg) { return reg->options; } extern OnigCaseFoldType onig_get_case_fold_flag(const regex_t* reg) { return reg->case_fold_flag; } extern const OnigSyntaxType* onig_get_syntax(const regex_t* reg) { return reg->syntax; } extern int onig_number_of_captures(const regex_t* reg) { return reg->num_mem; } extern int onig_number_of_capture_histories(const regex_t* reg) { #ifdef USE_CAPTURE_HISTORY int i, n; n = 0; for (i = 0; i <= ONIG_MAX_CAPTURE_HISTORY_GROUP; i++) { if (BIT_STATUS_AT(reg->capture_history, i) != 0) n++; } return n; #else return 0; #endif } extern void onig_copy_encoding(OnigEncodingType *to, OnigEncoding from) { *to = *from; }
60,132
571
package me.devsaki.hentoid.widget; import androidx.annotation.NonNull; import androidx.recyclerview.widget.PagerSnapHelper; import androidx.recyclerview.widget.RecyclerView; import static java.lang.Math.abs; /** * Manages page snapping for a RecyclerView */ public final class PageSnapWidget { private final SnapHelper snapHelper = new SnapHelper(); private final RecyclerView recyclerView; private float flingSensitivity; private boolean isEnabled; public PageSnapWidget(@NonNull RecyclerView recyclerView) { this.recyclerView = recyclerView; setPageSnapEnabled(true); } public void setPageSnapEnabled(boolean pageSnapEnabled) { if (pageSnapEnabled) { snapHelper.attachToRecyclerView(recyclerView); isEnabled = true; } else { snapHelper.attachToRecyclerView(null); isEnabled = false; } } public boolean isPageSnapEnabled() { return isEnabled; } /** * Sets the sensitivity of a fling. * * @param sensitivity floating point sensitivity where 0 means never fling and 1 means always * fling. Values beyond this range will have undefined behavior. */ public void setFlingSensitivity(float sensitivity) { flingSensitivity = sensitivity; } private final class SnapHelper extends PagerSnapHelper { @Override public boolean onFling(int velocityX, int velocityY) { int min = recyclerView.getMinFlingVelocity(); int max = recyclerView.getMaxFlingVelocity(); int threshold = (int) ((max * (1.0 - flingSensitivity)) + (min * flingSensitivity)); if (abs(velocityX) > threshold) { return false; } return super.onFling(velocityX, velocityY); } } }
727
854
<gh_stars>100-1000 __________________________________________________________________________________________________ sample 4 ms submission class Solution { public: string shortestPalindrome(string s) { int n = s.size(); int i = 0; for (int j = n - 1; j >= 0; j--) { if (s[i] == s[j]) i++; } if (i == n) return s; string remain_rev = s.substr(i, n); reverse(remain_rev.begin(), remain_rev.end()); return remain_rev + shortestPalindrome(s.substr(0, i)) + s.substr(i); } }; __________________________________________________________________________________________________ sample 9184 kb submission class Solution { public: string shortestPalindrome(string s) { string result; if(s.length() <= 1) return s; int left = 0; int right = s.length() -1; int prev = s.length() - 1; int pal_len = 0; while(left <= right) { if(left == right) { pal_len++; break; } if(s[left] == s[right]) { left++; right--; pal_len +=2; } else { left = 0; prev--; right = prev; pal_len = 0; } } result = s; reverse(result.begin(), result.end()); cout << result << " " << pal_len << endl; for(int i = 0 + pal_len; i < s.length(); i++) { result.append(1,s[i]); } return result; } }; __________________________________________________________________________________________________
892
14,668
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/chrome_kiosk_delegate.h" namespace extensions { ChromeKioskDelegate::ChromeKioskDelegate() {} ChromeKioskDelegate::~ChromeKioskDelegate() {} bool ChromeKioskDelegate::IsAutoLaunchedKioskApp(const ExtensionId& id) const { return false; } } // namespace extensions
150
972
<reponame>brianpetro/ai<gh_stars>100-1000 // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/util/internal/testdata/anys.proto #ifndef PROTOBUF_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto__INCLUDED #define PROTOBUF_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto__INCLUDED #include <string> #include <google/protobuf/stubs/common.h> #if GOOGLE_PROTOBUF_VERSION < 3001000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif #if 3001000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. #endif #include <google/protobuf/arena.h> #include <google/protobuf/arenastring.h> #include <google/protobuf/generated_message_util.h> #include <google/protobuf/metadata.h> #include <google/protobuf/message.h> #include <google/protobuf/repeated_field.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/map.h> #include <google/protobuf/map_field_inl.h> #include <google/protobuf/unknown_field_set.h> #include <google/protobuf/any.pb.h> #include <google/protobuf/struct.pb.h> #include <google/protobuf/timestamp.pb.h> #include <google/protobuf/duration.pb.h> #include <google/protobuf/wrappers.pb.h> // @@protoc_insertion_point(includes) namespace google { namespace protobuf { namespace testing { // Internal implementation detail -- do not call these. void protobuf_AddDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); void protobuf_InitDefaults_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); void protobuf_AssignDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); void protobuf_ShutdownFile_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); class AnyIn; class AnyM; class AnyOut; class AnyTestCases; class AnyWrapper; class Data; class Imports; // =================================================================== class AnyTestCases : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.AnyTestCases) */ { public: AnyTestCases(); virtual ~AnyTestCases(); AnyTestCases(const AnyTestCases& from); inline AnyTestCases& operator=(const AnyTestCases& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); static const AnyTestCases& default_instance(); static const AnyTestCases* internal_default_instance(); void Swap(AnyTestCases* other); // implements Message ---------------------------------------------- inline AnyTestCases* New() const { return New(NULL); } AnyTestCases* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); void CopyFrom(const AnyTestCases& from); void MergeFrom(const AnyTestCases& from); void Clear(); bool IsInitialized() const; size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* output) const; ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const { return InternalSerializeWithCachedSizesToArray(false, output); } int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(AnyTestCases* other); void UnsafeMergeFrom(const AnyTestCases& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // optional .google.protobuf.testing.AnyWrapper empty_any = 1; bool has_empty_any() const; void clear_empty_any(); static const int kEmptyAnyFieldNumber = 1; const ::google::protobuf::testing::AnyWrapper& empty_any() const; ::google::protobuf::testing::AnyWrapper* mutable_empty_any(); ::google::protobuf::testing::AnyWrapper* release_empty_any(); void set_allocated_empty_any(::google::protobuf::testing::AnyWrapper* empty_any); // optional .google.protobuf.testing.AnyWrapper type_only_any = 2; bool has_type_only_any() const; void clear_type_only_any(); static const int kTypeOnlyAnyFieldNumber = 2; const ::google::protobuf::testing::AnyWrapper& type_only_any() const; ::google::protobuf::testing::AnyWrapper* mutable_type_only_any(); ::google::protobuf::testing::AnyWrapper* release_type_only_any(); void set_allocated_type_only_any(::google::protobuf::testing::AnyWrapper* type_only_any); // optional .google.protobuf.testing.AnyWrapper wrapper_any = 3; bool has_wrapper_any() const; void clear_wrapper_any(); static const int kWrapperAnyFieldNumber = 3; const ::google::protobuf::testing::AnyWrapper& wrapper_any() const; ::google::protobuf::testing::AnyWrapper* mutable_wrapper_any(); ::google::protobuf::testing::AnyWrapper* release_wrapper_any(); void set_allocated_wrapper_any(::google::protobuf::testing::AnyWrapper* wrapper_any); // optional .google.protobuf.testing.AnyWrapper any_with_timestamp_value = 4; bool has_any_with_timestamp_value() const; void clear_any_with_timestamp_value(); static const int kAnyWithTimestampValueFieldNumber = 4; const ::google::protobuf::testing::AnyWrapper& any_with_timestamp_value() const; ::google::protobuf::testing::AnyWrapper* mutable_any_with_timestamp_value(); ::google::protobuf::testing::AnyWrapper* release_any_with_timestamp_value(); void set_allocated_any_with_timestamp_value(::google::protobuf::testing::AnyWrapper* any_with_timestamp_value); // optional .google.protobuf.testing.AnyWrapper any_with_duration_value = 5; bool has_any_with_duration_value() const; void clear_any_with_duration_value(); static const int kAnyWithDurationValueFieldNumber = 5; const ::google::protobuf::testing::AnyWrapper& any_with_duration_value() const; ::google::protobuf::testing::AnyWrapper* mutable_any_with_duration_value(); ::google::protobuf::testing::AnyWrapper* release_any_with_duration_value(); void set_allocated_any_with_duration_value(::google::protobuf::testing::AnyWrapper* any_with_duration_value); // optional .google.protobuf.testing.AnyWrapper any_with_struct_value = 6; bool has_any_with_struct_value() const; void clear_any_with_struct_value(); static const int kAnyWithStructValueFieldNumber = 6; const ::google::protobuf::testing::AnyWrapper& any_with_struct_value() const; ::google::protobuf::testing::AnyWrapper* mutable_any_with_struct_value(); ::google::protobuf::testing::AnyWrapper* release_any_with_struct_value(); void set_allocated_any_with_struct_value(::google::protobuf::testing::AnyWrapper* any_with_struct_value); // optional .google.protobuf.testing.AnyWrapper recursive_any = 7; bool has_recursive_any() const; void clear_recursive_any(); static const int kRecursiveAnyFieldNumber = 7; const ::google::protobuf::testing::AnyWrapper& recursive_any() const; ::google::protobuf::testing::AnyWrapper* mutable_recursive_any(); ::google::protobuf::testing::AnyWrapper* release_recursive_any(); void set_allocated_recursive_any(::google::protobuf::testing::AnyWrapper* recursive_any); // optional .google.protobuf.testing.AnyWrapper any_with_message_value = 8; bool has_any_with_message_value() const; void clear_any_with_message_value(); static const int kAnyWithMessageValueFieldNumber = 8; const ::google::protobuf::testing::AnyWrapper& any_with_message_value() const; ::google::protobuf::testing::AnyWrapper* mutable_any_with_message_value(); ::google::protobuf::testing::AnyWrapper* release_any_with_message_value(); void set_allocated_any_with_message_value(::google::protobuf::testing::AnyWrapper* any_with_message_value); // optional .google.protobuf.testing.AnyWrapper any_with_nested_message = 9; bool has_any_with_nested_message() const; void clear_any_with_nested_message(); static const int kAnyWithNestedMessageFieldNumber = 9; const ::google::protobuf::testing::AnyWrapper& any_with_nested_message() const; ::google::protobuf::testing::AnyWrapper* mutable_any_with_nested_message(); ::google::protobuf::testing::AnyWrapper* release_any_with_nested_message(); void set_allocated_any_with_nested_message(::google::protobuf::testing::AnyWrapper* any_with_nested_message); // optional .google.protobuf.testing.AnyWrapper any_with_message_with_wrapper_type = 10; bool has_any_with_message_with_wrapper_type() const; void clear_any_with_message_with_wrapper_type(); static const int kAnyWithMessageWithWrapperTypeFieldNumber = 10; const ::google::protobuf::testing::AnyWrapper& any_with_message_with_wrapper_type() const; ::google::protobuf::testing::AnyWrapper* mutable_any_with_message_with_wrapper_type(); ::google::protobuf::testing::AnyWrapper* release_any_with_message_with_wrapper_type(); void set_allocated_any_with_message_with_wrapper_type(::google::protobuf::testing::AnyWrapper* any_with_message_with_wrapper_type); // optional .google.protobuf.testing.AnyWrapper any_with_message_with_timestamp = 11; bool has_any_with_message_with_timestamp() const; void clear_any_with_message_with_timestamp(); static const int kAnyWithMessageWithTimestampFieldNumber = 11; const ::google::protobuf::testing::AnyWrapper& any_with_message_with_timestamp() const; ::google::protobuf::testing::AnyWrapper* mutable_any_with_message_with_timestamp(); ::google::protobuf::testing::AnyWrapper* release_any_with_message_with_timestamp(); void set_allocated_any_with_message_with_timestamp(::google::protobuf::testing::AnyWrapper* any_with_message_with_timestamp); // optional .google.protobuf.testing.AnyWrapper any_with_message_containing_map = 12; bool has_any_with_message_containing_map() const; void clear_any_with_message_containing_map(); static const int kAnyWithMessageContainingMapFieldNumber = 12; const ::google::protobuf::testing::AnyWrapper& any_with_message_containing_map() const; ::google::protobuf::testing::AnyWrapper* mutable_any_with_message_containing_map(); ::google::protobuf::testing::AnyWrapper* release_any_with_message_containing_map(); void set_allocated_any_with_message_containing_map(::google::protobuf::testing::AnyWrapper* any_with_message_containing_map); // optional .google.protobuf.testing.AnyWrapper any_with_message_containing_struct = 13; bool has_any_with_message_containing_struct() const; void clear_any_with_message_containing_struct(); static const int kAnyWithMessageContainingStructFieldNumber = 13; const ::google::protobuf::testing::AnyWrapper& any_with_message_containing_struct() const; ::google::protobuf::testing::AnyWrapper* mutable_any_with_message_containing_struct(); ::google::protobuf::testing::AnyWrapper* release_any_with_message_containing_struct(); void set_allocated_any_with_message_containing_struct(::google::protobuf::testing::AnyWrapper* any_with_message_containing_struct); // optional .google.protobuf.testing.AnyWrapper any_with_message_containing_repeated_message = 14; bool has_any_with_message_containing_repeated_message() const; void clear_any_with_message_containing_repeated_message(); static const int kAnyWithMessageContainingRepeatedMessageFieldNumber = 14; const ::google::protobuf::testing::AnyWrapper& any_with_message_containing_repeated_message() const; ::google::protobuf::testing::AnyWrapper* mutable_any_with_message_containing_repeated_message(); ::google::protobuf::testing::AnyWrapper* release_any_with_message_containing_repeated_message(); void set_allocated_any_with_message_containing_repeated_message(::google::protobuf::testing::AnyWrapper* any_with_message_containing_repeated_message); // optional .google.protobuf.testing.AnyWrapper recursive_any_with_type_field_at_end = 15; bool has_recursive_any_with_type_field_at_end() const; void clear_recursive_any_with_type_field_at_end(); static const int kRecursiveAnyWithTypeFieldAtEndFieldNumber = 15; const ::google::protobuf::testing::AnyWrapper& recursive_any_with_type_field_at_end() const; ::google::protobuf::testing::AnyWrapper* mutable_recursive_any_with_type_field_at_end(); ::google::protobuf::testing::AnyWrapper* release_recursive_any_with_type_field_at_end(); void set_allocated_recursive_any_with_type_field_at_end(::google::protobuf::testing::AnyWrapper* recursive_any_with_type_field_at_end); // optional .google.protobuf.Any top_level_any = 50; bool has_top_level_any() const; void clear_top_level_any(); static const int kTopLevelAnyFieldNumber = 50; const ::google::protobuf::Any& top_level_any() const; ::google::protobuf::Any* mutable_top_level_any(); ::google::protobuf::Any* release_top_level_any(); void set_allocated_top_level_any(::google::protobuf::Any* top_level_any); // optional .google.protobuf.Any top_level_any_with_type_field_at_end = 51; bool has_top_level_any_with_type_field_at_end() const; void clear_top_level_any_with_type_field_at_end(); static const int kTopLevelAnyWithTypeFieldAtEndFieldNumber = 51; const ::google::protobuf::Any& top_level_any_with_type_field_at_end() const; ::google::protobuf::Any* mutable_top_level_any_with_type_field_at_end(); ::google::protobuf::Any* release_top_level_any_with_type_field_at_end(); void set_allocated_top_level_any_with_type_field_at_end(::google::protobuf::Any* top_level_any_with_type_field_at_end); // @@protoc_insertion_point(class_scope:google.protobuf.testing.AnyTestCases) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::testing::AnyWrapper* empty_any_; ::google::protobuf::testing::AnyWrapper* type_only_any_; ::google::protobuf::testing::AnyWrapper* wrapper_any_; ::google::protobuf::testing::AnyWrapper* any_with_timestamp_value_; ::google::protobuf::testing::AnyWrapper* any_with_duration_value_; ::google::protobuf::testing::AnyWrapper* any_with_struct_value_; ::google::protobuf::testing::AnyWrapper* recursive_any_; ::google::protobuf::testing::AnyWrapper* any_with_message_value_; ::google::protobuf::testing::AnyWrapper* any_with_nested_message_; ::google::protobuf::testing::AnyWrapper* any_with_message_with_wrapper_type_; ::google::protobuf::testing::AnyWrapper* any_with_message_with_timestamp_; ::google::protobuf::testing::AnyWrapper* any_with_message_containing_map_; ::google::protobuf::testing::AnyWrapper* any_with_message_containing_struct_; ::google::protobuf::testing::AnyWrapper* any_with_message_containing_repeated_message_; ::google::protobuf::testing::AnyWrapper* recursive_any_with_type_field_at_end_; ::google::protobuf::Any* top_level_any_; ::google::protobuf::Any* top_level_any_with_type_field_at_end_; mutable int _cached_size_; friend void protobuf_InitDefaults_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AddDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AssignDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); void InitAsDefaultInstance(); }; extern ::google::protobuf::internal::ExplicitlyConstructed<AnyTestCases> AnyTestCases_default_instance_; // ------------------------------------------------------------------- class AnyWrapper : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.AnyWrapper) */ { public: AnyWrapper(); virtual ~AnyWrapper(); AnyWrapper(const AnyWrapper& from); inline AnyWrapper& operator=(const AnyWrapper& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); static const AnyWrapper& default_instance(); static const AnyWrapper* internal_default_instance(); void Swap(AnyWrapper* other); // implements Message ---------------------------------------------- inline AnyWrapper* New() const { return New(NULL); } AnyWrapper* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); void CopyFrom(const AnyWrapper& from); void MergeFrom(const AnyWrapper& from); void Clear(); bool IsInitialized() const; size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* output) const; ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const { return InternalSerializeWithCachedSizesToArray(false, output); } int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(AnyWrapper* other); void UnsafeMergeFrom(const AnyWrapper& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // optional .google.protobuf.Any any = 1; bool has_any() const; void clear_any(); static const int kAnyFieldNumber = 1; const ::google::protobuf::Any& any() const; ::google::protobuf::Any* mutable_any(); ::google::protobuf::Any* release_any(); void set_allocated_any(::google::protobuf::Any* any); // @@protoc_insertion_point(class_scope:google.protobuf.testing.AnyWrapper) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::Any* any_; mutable int _cached_size_; friend void protobuf_InitDefaults_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AddDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AssignDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); void InitAsDefaultInstance(); }; extern ::google::protobuf::internal::ExplicitlyConstructed<AnyWrapper> AnyWrapper_default_instance_; // ------------------------------------------------------------------- class Imports : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.Imports) */ { public: Imports(); virtual ~Imports(); Imports(const Imports& from); inline Imports& operator=(const Imports& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); static const Imports& default_instance(); static const Imports* internal_default_instance(); void Swap(Imports* other); // implements Message ---------------------------------------------- inline Imports* New() const { return New(NULL); } Imports* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); void CopyFrom(const Imports& from); void MergeFrom(const Imports& from); void Clear(); bool IsInitialized() const; size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* output) const; ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const { return InternalSerializeWithCachedSizesToArray(false, output); } int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(Imports* other); void UnsafeMergeFrom(const Imports& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // optional .google.protobuf.DoubleValue dbl = 1; bool has_dbl() const; void clear_dbl(); static const int kDblFieldNumber = 1; const ::google::protobuf::DoubleValue& dbl() const; ::google::protobuf::DoubleValue* mutable_dbl(); ::google::protobuf::DoubleValue* release_dbl(); void set_allocated_dbl(::google::protobuf::DoubleValue* dbl); // optional .google.protobuf.Struct struct = 2; bool has_struct_() const; void clear_struct_(); static const int kStructFieldNumber = 2; const ::google::protobuf::Struct& struct_() const; ::google::protobuf::Struct* mutable_struct_(); ::google::protobuf::Struct* release_struct_(); void set_allocated_struct_(::google::protobuf::Struct* struct_); // optional .google.protobuf.Timestamp timestamp = 3; bool has_timestamp() const; void clear_timestamp(); static const int kTimestampFieldNumber = 3; const ::google::protobuf::Timestamp& timestamp() const; ::google::protobuf::Timestamp* mutable_timestamp(); ::google::protobuf::Timestamp* release_timestamp(); void set_allocated_timestamp(::google::protobuf::Timestamp* timestamp); // optional .google.protobuf.Duration duration = 4; bool has_duration() const; void clear_duration(); static const int kDurationFieldNumber = 4; const ::google::protobuf::Duration& duration() const; ::google::protobuf::Duration* mutable_duration(); ::google::protobuf::Duration* release_duration(); void set_allocated_duration(::google::protobuf::Duration* duration); // optional .google.protobuf.Int32Value i32 = 5; bool has_i32() const; void clear_i32(); static const int kI32FieldNumber = 5; const ::google::protobuf::Int32Value& i32() const; ::google::protobuf::Int32Value* mutable_i32(); ::google::protobuf::Int32Value* release_i32(); void set_allocated_i32(::google::protobuf::Int32Value* i32); // optional .google.protobuf.testing.Data data = 100; bool has_data() const; void clear_data(); static const int kDataFieldNumber = 100; const ::google::protobuf::testing::Data& data() const; ::google::protobuf::testing::Data* mutable_data(); ::google::protobuf::testing::Data* release_data(); void set_allocated_data(::google::protobuf::testing::Data* data); // @@protoc_insertion_point(class_scope:google.protobuf.testing.Imports) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::DoubleValue* dbl_; ::google::protobuf::Struct* struct__; ::google::protobuf::Timestamp* timestamp_; ::google::protobuf::Duration* duration_; ::google::protobuf::Int32Value* i32_; ::google::protobuf::testing::Data* data_; mutable int _cached_size_; friend void protobuf_InitDefaults_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AddDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AssignDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); void InitAsDefaultInstance(); }; extern ::google::protobuf::internal::ExplicitlyConstructed<Imports> Imports_default_instance_; // ------------------------------------------------------------------- class Data : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.Data) */ { public: Data(); virtual ~Data(); Data(const Data& from); inline Data& operator=(const Data& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); static const Data& default_instance(); static const Data* internal_default_instance(); void Swap(Data* other); // implements Message ---------------------------------------------- inline Data* New() const { return New(NULL); } Data* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); void CopyFrom(const Data& from); void MergeFrom(const Data& from); void Clear(); bool IsInitialized() const; size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* output) const; ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const { return InternalSerializeWithCachedSizesToArray(false, output); } int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(Data* other); void UnsafeMergeFrom(const Data& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // optional int32 attr = 1; void clear_attr(); static const int kAttrFieldNumber = 1; ::google::protobuf::int32 attr() const; void set_attr(::google::protobuf::int32 value); // optional string str = 2; void clear_str(); static const int kStrFieldNumber = 2; const ::std::string& str() const; void set_str(const ::std::string& value); void set_str(const char* value); void set_str(const char* value, size_t size); ::std::string* mutable_str(); ::std::string* release_str(); void set_allocated_str(::std::string* str); // repeated string msgs = 3; int msgs_size() const; void clear_msgs(); static const int kMsgsFieldNumber = 3; const ::std::string& msgs(int index) const; ::std::string* mutable_msgs(int index); void set_msgs(int index, const ::std::string& value); void set_msgs(int index, const char* value); void set_msgs(int index, const char* value, size_t size); ::std::string* add_msgs(); void add_msgs(const ::std::string& value); void add_msgs(const char* value); void add_msgs(const char* value, size_t size); const ::google::protobuf::RepeatedPtrField< ::std::string>& msgs() const; ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_msgs(); // optional .google.protobuf.testing.Data nested_data = 4; bool has_nested_data() const; void clear_nested_data(); static const int kNestedDataFieldNumber = 4; const ::google::protobuf::testing::Data& nested_data() const; ::google::protobuf::testing::Data* mutable_nested_data(); ::google::protobuf::testing::Data* release_nested_data(); void set_allocated_nested_data(::google::protobuf::testing::Data* nested_data); // optional .google.protobuf.Int32Value int_wrapper = 5; bool has_int_wrapper() const; void clear_int_wrapper(); static const int kIntWrapperFieldNumber = 5; const ::google::protobuf::Int32Value& int_wrapper() const; ::google::protobuf::Int32Value* mutable_int_wrapper(); ::google::protobuf::Int32Value* release_int_wrapper(); void set_allocated_int_wrapper(::google::protobuf::Int32Value* int_wrapper); // optional .google.protobuf.Timestamp time = 6; bool has_time() const; void clear_time(); static const int kTimeFieldNumber = 6; const ::google::protobuf::Timestamp& time() const; ::google::protobuf::Timestamp* mutable_time(); ::google::protobuf::Timestamp* release_time(); void set_allocated_time(::google::protobuf::Timestamp* time); // map<string, string> map_data = 7; int map_data_size() const; void clear_map_data(); static const int kMapDataFieldNumber = 7; const ::google::protobuf::Map< ::std::string, ::std::string >& map_data() const; ::google::protobuf::Map< ::std::string, ::std::string >* mutable_map_data(); // optional .google.protobuf.Struct struct_data = 8; bool has_struct_data() const; void clear_struct_data(); static const int kStructDataFieldNumber = 8; const ::google::protobuf::Struct& struct_data() const; ::google::protobuf::Struct* mutable_struct_data(); ::google::protobuf::Struct* release_struct_data(); void set_allocated_struct_data(::google::protobuf::Struct* struct_data); // repeated .google.protobuf.testing.Data repeated_data = 9; int repeated_data_size() const; void clear_repeated_data(); static const int kRepeatedDataFieldNumber = 9; const ::google::protobuf::testing::Data& repeated_data(int index) const; ::google::protobuf::testing::Data* mutable_repeated_data(int index); ::google::protobuf::testing::Data* add_repeated_data(); ::google::protobuf::RepeatedPtrField< ::google::protobuf::testing::Data >* mutable_repeated_data(); const ::google::protobuf::RepeatedPtrField< ::google::protobuf::testing::Data >& repeated_data() const; // @@protoc_insertion_point(class_scope:google.protobuf.testing.Data) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::RepeatedPtrField< ::std::string> msgs_; typedef ::google::protobuf::internal::MapEntryLite< ::std::string, ::std::string, ::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::google::protobuf::internal::WireFormatLite::TYPE_STRING, 0 > Data_MapDataEntry; ::google::protobuf::internal::MapField< ::std::string, ::std::string, ::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::google::protobuf::internal::WireFormatLite::TYPE_STRING, 0 > map_data_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::testing::Data > repeated_data_; ::google::protobuf::internal::ArenaStringPtr str_; ::google::protobuf::testing::Data* nested_data_; ::google::protobuf::Int32Value* int_wrapper_; ::google::protobuf::Timestamp* time_; ::google::protobuf::Struct* struct_data_; ::google::protobuf::int32 attr_; mutable int _cached_size_; friend void protobuf_InitDefaults_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AddDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AssignDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); void InitAsDefaultInstance(); }; extern ::google::protobuf::internal::ExplicitlyConstructed<Data> Data_default_instance_; // ------------------------------------------------------------------- class AnyIn : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.AnyIn) */ { public: AnyIn(); virtual ~AnyIn(); AnyIn(const AnyIn& from); inline AnyIn& operator=(const AnyIn& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); static const AnyIn& default_instance(); static const AnyIn* internal_default_instance(); void Swap(AnyIn* other); // implements Message ---------------------------------------------- inline AnyIn* New() const { return New(NULL); } AnyIn* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); void CopyFrom(const AnyIn& from); void MergeFrom(const AnyIn& from); void Clear(); bool IsInitialized() const; size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* output) const; ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const { return InternalSerializeWithCachedSizesToArray(false, output); } int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(AnyIn* other); void UnsafeMergeFrom(const AnyIn& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // optional string something = 1; void clear_something(); static const int kSomethingFieldNumber = 1; const ::std::string& something() const; void set_something(const ::std::string& value); void set_something(const char* value); void set_something(const char* value, size_t size); ::std::string* mutable_something(); ::std::string* release_something(); void set_allocated_something(::std::string* something); // optional .google.protobuf.Any any = 2; bool has_any() const; void clear_any(); static const int kAnyFieldNumber = 2; const ::google::protobuf::Any& any() const; ::google::protobuf::Any* mutable_any(); ::google::protobuf::Any* release_any(); void set_allocated_any(::google::protobuf::Any* any); // @@protoc_insertion_point(class_scope:google.protobuf.testing.AnyIn) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::internal::ArenaStringPtr something_; ::google::protobuf::Any* any_; mutable int _cached_size_; friend void protobuf_InitDefaults_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AddDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AssignDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); void InitAsDefaultInstance(); }; extern ::google::protobuf::internal::ExplicitlyConstructed<AnyIn> AnyIn_default_instance_; // ------------------------------------------------------------------- class AnyOut : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.AnyOut) */ { public: AnyOut(); virtual ~AnyOut(); AnyOut(const AnyOut& from); inline AnyOut& operator=(const AnyOut& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); static const AnyOut& default_instance(); static const AnyOut* internal_default_instance(); void Swap(AnyOut* other); // implements Message ---------------------------------------------- inline AnyOut* New() const { return New(NULL); } AnyOut* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); void CopyFrom(const AnyOut& from); void MergeFrom(const AnyOut& from); void Clear(); bool IsInitialized() const; size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* output) const; ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const { return InternalSerializeWithCachedSizesToArray(false, output); } int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(AnyOut* other); void UnsafeMergeFrom(const AnyOut& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // optional .google.protobuf.Any any = 1; bool has_any() const; void clear_any(); static const int kAnyFieldNumber = 1; const ::google::protobuf::Any& any() const; ::google::protobuf::Any* mutable_any(); ::google::protobuf::Any* release_any(); void set_allocated_any(::google::protobuf::Any* any); // @@protoc_insertion_point(class_scope:google.protobuf.testing.AnyOut) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::Any* any_; mutable int _cached_size_; friend void protobuf_InitDefaults_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AddDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AssignDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); void InitAsDefaultInstance(); }; extern ::google::protobuf::internal::ExplicitlyConstructed<AnyOut> AnyOut_default_instance_; // ------------------------------------------------------------------- class AnyM : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.testing.AnyM) */ { public: AnyM(); virtual ~AnyM(); AnyM(const AnyM& from); inline AnyM& operator=(const AnyM& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); static const AnyM& default_instance(); static const AnyM* internal_default_instance(); void Swap(AnyM* other); // implements Message ---------------------------------------------- inline AnyM* New() const { return New(NULL); } AnyM* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); void CopyFrom(const AnyM& from); void MergeFrom(const AnyM& from); void Clear(); bool IsInitialized() const; size_t ByteSizeLong() const; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* output) const; ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const { return InternalSerializeWithCachedSizesToArray(false, output); } int GetCachedSize() const { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(AnyM* other); void UnsafeMergeFrom(const AnyM& from); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // optional string foo = 1; void clear_foo(); static const int kFooFieldNumber = 1; const ::std::string& foo() const; void set_foo(const ::std::string& value); void set_foo(const char* value); void set_foo(const char* value, size_t size); ::std::string* mutable_foo(); ::std::string* release_foo(); void set_allocated_foo(::std::string* foo); // @@protoc_insertion_point(class_scope:google.protobuf.testing.AnyM) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::internal::ArenaStringPtr foo_; mutable int _cached_size_; friend void protobuf_InitDefaults_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AddDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto_impl(); friend void protobuf_AssignDesc_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); friend void protobuf_ShutdownFile_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto(); void InitAsDefaultInstance(); }; extern ::google::protobuf::internal::ExplicitlyConstructed<AnyM> AnyM_default_instance_; // =================================================================== // =================================================================== #if !PROTOBUF_INLINE_NOT_IN_HEADERS // AnyTestCases // optional .google.protobuf.testing.AnyWrapper empty_any = 1; inline bool AnyTestCases::has_empty_any() const { return this != internal_default_instance() && empty_any_ != NULL; } inline void AnyTestCases::clear_empty_any() { if (GetArenaNoVirtual() == NULL && empty_any_ != NULL) delete empty_any_; empty_any_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::empty_any() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.empty_any) return empty_any_ != NULL ? *empty_any_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_empty_any() { if (empty_any_ == NULL) { empty_any_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.empty_any) return empty_any_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_empty_any() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.empty_any) ::google::protobuf::testing::AnyWrapper* temp = empty_any_; empty_any_ = NULL; return temp; } inline void AnyTestCases::set_allocated_empty_any(::google::protobuf::testing::AnyWrapper* empty_any) { delete empty_any_; empty_any_ = empty_any; if (empty_any) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.empty_any) } // optional .google.protobuf.testing.AnyWrapper type_only_any = 2; inline bool AnyTestCases::has_type_only_any() const { return this != internal_default_instance() && type_only_any_ != NULL; } inline void AnyTestCases::clear_type_only_any() { if (GetArenaNoVirtual() == NULL && type_only_any_ != NULL) delete type_only_any_; type_only_any_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::type_only_any() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.type_only_any) return type_only_any_ != NULL ? *type_only_any_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_type_only_any() { if (type_only_any_ == NULL) { type_only_any_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.type_only_any) return type_only_any_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_type_only_any() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.type_only_any) ::google::protobuf::testing::AnyWrapper* temp = type_only_any_; type_only_any_ = NULL; return temp; } inline void AnyTestCases::set_allocated_type_only_any(::google::protobuf::testing::AnyWrapper* type_only_any) { delete type_only_any_; type_only_any_ = type_only_any; if (type_only_any) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.type_only_any) } // optional .google.protobuf.testing.AnyWrapper wrapper_any = 3; inline bool AnyTestCases::has_wrapper_any() const { return this != internal_default_instance() && wrapper_any_ != NULL; } inline void AnyTestCases::clear_wrapper_any() { if (GetArenaNoVirtual() == NULL && wrapper_any_ != NULL) delete wrapper_any_; wrapper_any_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::wrapper_any() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.wrapper_any) return wrapper_any_ != NULL ? *wrapper_any_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_wrapper_any() { if (wrapper_any_ == NULL) { wrapper_any_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.wrapper_any) return wrapper_any_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_wrapper_any() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.wrapper_any) ::google::protobuf::testing::AnyWrapper* temp = wrapper_any_; wrapper_any_ = NULL; return temp; } inline void AnyTestCases::set_allocated_wrapper_any(::google::protobuf::testing::AnyWrapper* wrapper_any) { delete wrapper_any_; wrapper_any_ = wrapper_any; if (wrapper_any) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.wrapper_any) } // optional .google.protobuf.testing.AnyWrapper any_with_timestamp_value = 4; inline bool AnyTestCases::has_any_with_timestamp_value() const { return this != internal_default_instance() && any_with_timestamp_value_ != NULL; } inline void AnyTestCases::clear_any_with_timestamp_value() { if (GetArenaNoVirtual() == NULL && any_with_timestamp_value_ != NULL) delete any_with_timestamp_value_; any_with_timestamp_value_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::any_with_timestamp_value() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.any_with_timestamp_value) return any_with_timestamp_value_ != NULL ? *any_with_timestamp_value_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_any_with_timestamp_value() { if (any_with_timestamp_value_ == NULL) { any_with_timestamp_value_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.any_with_timestamp_value) return any_with_timestamp_value_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_any_with_timestamp_value() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.any_with_timestamp_value) ::google::protobuf::testing::AnyWrapper* temp = any_with_timestamp_value_; any_with_timestamp_value_ = NULL; return temp; } inline void AnyTestCases::set_allocated_any_with_timestamp_value(::google::protobuf::testing::AnyWrapper* any_with_timestamp_value) { delete any_with_timestamp_value_; any_with_timestamp_value_ = any_with_timestamp_value; if (any_with_timestamp_value) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.any_with_timestamp_value) } // optional .google.protobuf.testing.AnyWrapper any_with_duration_value = 5; inline bool AnyTestCases::has_any_with_duration_value() const { return this != internal_default_instance() && any_with_duration_value_ != NULL; } inline void AnyTestCases::clear_any_with_duration_value() { if (GetArenaNoVirtual() == NULL && any_with_duration_value_ != NULL) delete any_with_duration_value_; any_with_duration_value_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::any_with_duration_value() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.any_with_duration_value) return any_with_duration_value_ != NULL ? *any_with_duration_value_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_any_with_duration_value() { if (any_with_duration_value_ == NULL) { any_with_duration_value_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.any_with_duration_value) return any_with_duration_value_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_any_with_duration_value() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.any_with_duration_value) ::google::protobuf::testing::AnyWrapper* temp = any_with_duration_value_; any_with_duration_value_ = NULL; return temp; } inline void AnyTestCases::set_allocated_any_with_duration_value(::google::protobuf::testing::AnyWrapper* any_with_duration_value) { delete any_with_duration_value_; any_with_duration_value_ = any_with_duration_value; if (any_with_duration_value) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.any_with_duration_value) } // optional .google.protobuf.testing.AnyWrapper any_with_struct_value = 6; inline bool AnyTestCases::has_any_with_struct_value() const { return this != internal_default_instance() && any_with_struct_value_ != NULL; } inline void AnyTestCases::clear_any_with_struct_value() { if (GetArenaNoVirtual() == NULL && any_with_struct_value_ != NULL) delete any_with_struct_value_; any_with_struct_value_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::any_with_struct_value() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.any_with_struct_value) return any_with_struct_value_ != NULL ? *any_with_struct_value_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_any_with_struct_value() { if (any_with_struct_value_ == NULL) { any_with_struct_value_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.any_with_struct_value) return any_with_struct_value_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_any_with_struct_value() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.any_with_struct_value) ::google::protobuf::testing::AnyWrapper* temp = any_with_struct_value_; any_with_struct_value_ = NULL; return temp; } inline void AnyTestCases::set_allocated_any_with_struct_value(::google::protobuf::testing::AnyWrapper* any_with_struct_value) { delete any_with_struct_value_; any_with_struct_value_ = any_with_struct_value; if (any_with_struct_value) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.any_with_struct_value) } // optional .google.protobuf.testing.AnyWrapper recursive_any = 7; inline bool AnyTestCases::has_recursive_any() const { return this != internal_default_instance() && recursive_any_ != NULL; } inline void AnyTestCases::clear_recursive_any() { if (GetArenaNoVirtual() == NULL && recursive_any_ != NULL) delete recursive_any_; recursive_any_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::recursive_any() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.recursive_any) return recursive_any_ != NULL ? *recursive_any_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_recursive_any() { if (recursive_any_ == NULL) { recursive_any_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.recursive_any) return recursive_any_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_recursive_any() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.recursive_any) ::google::protobuf::testing::AnyWrapper* temp = recursive_any_; recursive_any_ = NULL; return temp; } inline void AnyTestCases::set_allocated_recursive_any(::google::protobuf::testing::AnyWrapper* recursive_any) { delete recursive_any_; recursive_any_ = recursive_any; if (recursive_any) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.recursive_any) } // optional .google.protobuf.testing.AnyWrapper any_with_message_value = 8; inline bool AnyTestCases::has_any_with_message_value() const { return this != internal_default_instance() && any_with_message_value_ != NULL; } inline void AnyTestCases::clear_any_with_message_value() { if (GetArenaNoVirtual() == NULL && any_with_message_value_ != NULL) delete any_with_message_value_; any_with_message_value_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::any_with_message_value() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.any_with_message_value) return any_with_message_value_ != NULL ? *any_with_message_value_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_any_with_message_value() { if (any_with_message_value_ == NULL) { any_with_message_value_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.any_with_message_value) return any_with_message_value_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_any_with_message_value() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.any_with_message_value) ::google::protobuf::testing::AnyWrapper* temp = any_with_message_value_; any_with_message_value_ = NULL; return temp; } inline void AnyTestCases::set_allocated_any_with_message_value(::google::protobuf::testing::AnyWrapper* any_with_message_value) { delete any_with_message_value_; any_with_message_value_ = any_with_message_value; if (any_with_message_value) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.any_with_message_value) } // optional .google.protobuf.testing.AnyWrapper any_with_nested_message = 9; inline bool AnyTestCases::has_any_with_nested_message() const { return this != internal_default_instance() && any_with_nested_message_ != NULL; } inline void AnyTestCases::clear_any_with_nested_message() { if (GetArenaNoVirtual() == NULL && any_with_nested_message_ != NULL) delete any_with_nested_message_; any_with_nested_message_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::any_with_nested_message() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.any_with_nested_message) return any_with_nested_message_ != NULL ? *any_with_nested_message_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_any_with_nested_message() { if (any_with_nested_message_ == NULL) { any_with_nested_message_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.any_with_nested_message) return any_with_nested_message_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_any_with_nested_message() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.any_with_nested_message) ::google::protobuf::testing::AnyWrapper* temp = any_with_nested_message_; any_with_nested_message_ = NULL; return temp; } inline void AnyTestCases::set_allocated_any_with_nested_message(::google::protobuf::testing::AnyWrapper* any_with_nested_message) { delete any_with_nested_message_; any_with_nested_message_ = any_with_nested_message; if (any_with_nested_message) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.any_with_nested_message) } // optional .google.protobuf.testing.AnyWrapper any_with_message_with_wrapper_type = 10; inline bool AnyTestCases::has_any_with_message_with_wrapper_type() const { return this != internal_default_instance() && any_with_message_with_wrapper_type_ != NULL; } inline void AnyTestCases::clear_any_with_message_with_wrapper_type() { if (GetArenaNoVirtual() == NULL && any_with_message_with_wrapper_type_ != NULL) delete any_with_message_with_wrapper_type_; any_with_message_with_wrapper_type_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::any_with_message_with_wrapper_type() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.any_with_message_with_wrapper_type) return any_with_message_with_wrapper_type_ != NULL ? *any_with_message_with_wrapper_type_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_any_with_message_with_wrapper_type() { if (any_with_message_with_wrapper_type_ == NULL) { any_with_message_with_wrapper_type_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.any_with_message_with_wrapper_type) return any_with_message_with_wrapper_type_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_any_with_message_with_wrapper_type() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.any_with_message_with_wrapper_type) ::google::protobuf::testing::AnyWrapper* temp = any_with_message_with_wrapper_type_; any_with_message_with_wrapper_type_ = NULL; return temp; } inline void AnyTestCases::set_allocated_any_with_message_with_wrapper_type(::google::protobuf::testing::AnyWrapper* any_with_message_with_wrapper_type) { delete any_with_message_with_wrapper_type_; any_with_message_with_wrapper_type_ = any_with_message_with_wrapper_type; if (any_with_message_with_wrapper_type) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.any_with_message_with_wrapper_type) } // optional .google.protobuf.testing.AnyWrapper any_with_message_with_timestamp = 11; inline bool AnyTestCases::has_any_with_message_with_timestamp() const { return this != internal_default_instance() && any_with_message_with_timestamp_ != NULL; } inline void AnyTestCases::clear_any_with_message_with_timestamp() { if (GetArenaNoVirtual() == NULL && any_with_message_with_timestamp_ != NULL) delete any_with_message_with_timestamp_; any_with_message_with_timestamp_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::any_with_message_with_timestamp() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.any_with_message_with_timestamp) return any_with_message_with_timestamp_ != NULL ? *any_with_message_with_timestamp_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_any_with_message_with_timestamp() { if (any_with_message_with_timestamp_ == NULL) { any_with_message_with_timestamp_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.any_with_message_with_timestamp) return any_with_message_with_timestamp_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_any_with_message_with_timestamp() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.any_with_message_with_timestamp) ::google::protobuf::testing::AnyWrapper* temp = any_with_message_with_timestamp_; any_with_message_with_timestamp_ = NULL; return temp; } inline void AnyTestCases::set_allocated_any_with_message_with_timestamp(::google::protobuf::testing::AnyWrapper* any_with_message_with_timestamp) { delete any_with_message_with_timestamp_; any_with_message_with_timestamp_ = any_with_message_with_timestamp; if (any_with_message_with_timestamp) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.any_with_message_with_timestamp) } // optional .google.protobuf.testing.AnyWrapper any_with_message_containing_map = 12; inline bool AnyTestCases::has_any_with_message_containing_map() const { return this != internal_default_instance() && any_with_message_containing_map_ != NULL; } inline void AnyTestCases::clear_any_with_message_containing_map() { if (GetArenaNoVirtual() == NULL && any_with_message_containing_map_ != NULL) delete any_with_message_containing_map_; any_with_message_containing_map_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::any_with_message_containing_map() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.any_with_message_containing_map) return any_with_message_containing_map_ != NULL ? *any_with_message_containing_map_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_any_with_message_containing_map() { if (any_with_message_containing_map_ == NULL) { any_with_message_containing_map_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.any_with_message_containing_map) return any_with_message_containing_map_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_any_with_message_containing_map() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.any_with_message_containing_map) ::google::protobuf::testing::AnyWrapper* temp = any_with_message_containing_map_; any_with_message_containing_map_ = NULL; return temp; } inline void AnyTestCases::set_allocated_any_with_message_containing_map(::google::protobuf::testing::AnyWrapper* any_with_message_containing_map) { delete any_with_message_containing_map_; any_with_message_containing_map_ = any_with_message_containing_map; if (any_with_message_containing_map) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.any_with_message_containing_map) } // optional .google.protobuf.testing.AnyWrapper any_with_message_containing_struct = 13; inline bool AnyTestCases::has_any_with_message_containing_struct() const { return this != internal_default_instance() && any_with_message_containing_struct_ != NULL; } inline void AnyTestCases::clear_any_with_message_containing_struct() { if (GetArenaNoVirtual() == NULL && any_with_message_containing_struct_ != NULL) delete any_with_message_containing_struct_; any_with_message_containing_struct_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::any_with_message_containing_struct() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.any_with_message_containing_struct) return any_with_message_containing_struct_ != NULL ? *any_with_message_containing_struct_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_any_with_message_containing_struct() { if (any_with_message_containing_struct_ == NULL) { any_with_message_containing_struct_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.any_with_message_containing_struct) return any_with_message_containing_struct_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_any_with_message_containing_struct() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.any_with_message_containing_struct) ::google::protobuf::testing::AnyWrapper* temp = any_with_message_containing_struct_; any_with_message_containing_struct_ = NULL; return temp; } inline void AnyTestCases::set_allocated_any_with_message_containing_struct(::google::protobuf::testing::AnyWrapper* any_with_message_containing_struct) { delete any_with_message_containing_struct_; any_with_message_containing_struct_ = any_with_message_containing_struct; if (any_with_message_containing_struct) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.any_with_message_containing_struct) } // optional .google.protobuf.testing.AnyWrapper any_with_message_containing_repeated_message = 14; inline bool AnyTestCases::has_any_with_message_containing_repeated_message() const { return this != internal_default_instance() && any_with_message_containing_repeated_message_ != NULL; } inline void AnyTestCases::clear_any_with_message_containing_repeated_message() { if (GetArenaNoVirtual() == NULL && any_with_message_containing_repeated_message_ != NULL) delete any_with_message_containing_repeated_message_; any_with_message_containing_repeated_message_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::any_with_message_containing_repeated_message() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.any_with_message_containing_repeated_message) return any_with_message_containing_repeated_message_ != NULL ? *any_with_message_containing_repeated_message_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_any_with_message_containing_repeated_message() { if (any_with_message_containing_repeated_message_ == NULL) { any_with_message_containing_repeated_message_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.any_with_message_containing_repeated_message) return any_with_message_containing_repeated_message_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_any_with_message_containing_repeated_message() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.any_with_message_containing_repeated_message) ::google::protobuf::testing::AnyWrapper* temp = any_with_message_containing_repeated_message_; any_with_message_containing_repeated_message_ = NULL; return temp; } inline void AnyTestCases::set_allocated_any_with_message_containing_repeated_message(::google::protobuf::testing::AnyWrapper* any_with_message_containing_repeated_message) { delete any_with_message_containing_repeated_message_; any_with_message_containing_repeated_message_ = any_with_message_containing_repeated_message; if (any_with_message_containing_repeated_message) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.any_with_message_containing_repeated_message) } // optional .google.protobuf.testing.AnyWrapper recursive_any_with_type_field_at_end = 15; inline bool AnyTestCases::has_recursive_any_with_type_field_at_end() const { return this != internal_default_instance() && recursive_any_with_type_field_at_end_ != NULL; } inline void AnyTestCases::clear_recursive_any_with_type_field_at_end() { if (GetArenaNoVirtual() == NULL && recursive_any_with_type_field_at_end_ != NULL) delete recursive_any_with_type_field_at_end_; recursive_any_with_type_field_at_end_ = NULL; } inline const ::google::protobuf::testing::AnyWrapper& AnyTestCases::recursive_any_with_type_field_at_end() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.recursive_any_with_type_field_at_end) return recursive_any_with_type_field_at_end_ != NULL ? *recursive_any_with_type_field_at_end_ : *::google::protobuf::testing::AnyWrapper::internal_default_instance(); } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::mutable_recursive_any_with_type_field_at_end() { if (recursive_any_with_type_field_at_end_ == NULL) { recursive_any_with_type_field_at_end_ = new ::google::protobuf::testing::AnyWrapper; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.recursive_any_with_type_field_at_end) return recursive_any_with_type_field_at_end_; } inline ::google::protobuf::testing::AnyWrapper* AnyTestCases::release_recursive_any_with_type_field_at_end() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.recursive_any_with_type_field_at_end) ::google::protobuf::testing::AnyWrapper* temp = recursive_any_with_type_field_at_end_; recursive_any_with_type_field_at_end_ = NULL; return temp; } inline void AnyTestCases::set_allocated_recursive_any_with_type_field_at_end(::google::protobuf::testing::AnyWrapper* recursive_any_with_type_field_at_end) { delete recursive_any_with_type_field_at_end_; recursive_any_with_type_field_at_end_ = recursive_any_with_type_field_at_end; if (recursive_any_with_type_field_at_end) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.recursive_any_with_type_field_at_end) } // optional .google.protobuf.Any top_level_any = 50; inline bool AnyTestCases::has_top_level_any() const { return this != internal_default_instance() && top_level_any_ != NULL; } inline void AnyTestCases::clear_top_level_any() { if (GetArenaNoVirtual() == NULL && top_level_any_ != NULL) delete top_level_any_; top_level_any_ = NULL; } inline const ::google::protobuf::Any& AnyTestCases::top_level_any() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.top_level_any) return top_level_any_ != NULL ? *top_level_any_ : *::google::protobuf::Any::internal_default_instance(); } inline ::google::protobuf::Any* AnyTestCases::mutable_top_level_any() { if (top_level_any_ == NULL) { top_level_any_ = new ::google::protobuf::Any; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.top_level_any) return top_level_any_; } inline ::google::protobuf::Any* AnyTestCases::release_top_level_any() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.top_level_any) ::google::protobuf::Any* temp = top_level_any_; top_level_any_ = NULL; return temp; } inline void AnyTestCases::set_allocated_top_level_any(::google::protobuf::Any* top_level_any) { delete top_level_any_; top_level_any_ = top_level_any; if (top_level_any) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.top_level_any) } // optional .google.protobuf.Any top_level_any_with_type_field_at_end = 51; inline bool AnyTestCases::has_top_level_any_with_type_field_at_end() const { return this != internal_default_instance() && top_level_any_with_type_field_at_end_ != NULL; } inline void AnyTestCases::clear_top_level_any_with_type_field_at_end() { if (GetArenaNoVirtual() == NULL && top_level_any_with_type_field_at_end_ != NULL) delete top_level_any_with_type_field_at_end_; top_level_any_with_type_field_at_end_ = NULL; } inline const ::google::protobuf::Any& AnyTestCases::top_level_any_with_type_field_at_end() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyTestCases.top_level_any_with_type_field_at_end) return top_level_any_with_type_field_at_end_ != NULL ? *top_level_any_with_type_field_at_end_ : *::google::protobuf::Any::internal_default_instance(); } inline ::google::protobuf::Any* AnyTestCases::mutable_top_level_any_with_type_field_at_end() { if (top_level_any_with_type_field_at_end_ == NULL) { top_level_any_with_type_field_at_end_ = new ::google::protobuf::Any; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyTestCases.top_level_any_with_type_field_at_end) return top_level_any_with_type_field_at_end_; } inline ::google::protobuf::Any* AnyTestCases::release_top_level_any_with_type_field_at_end() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyTestCases.top_level_any_with_type_field_at_end) ::google::protobuf::Any* temp = top_level_any_with_type_field_at_end_; top_level_any_with_type_field_at_end_ = NULL; return temp; } inline void AnyTestCases::set_allocated_top_level_any_with_type_field_at_end(::google::protobuf::Any* top_level_any_with_type_field_at_end) { delete top_level_any_with_type_field_at_end_; top_level_any_with_type_field_at_end_ = top_level_any_with_type_field_at_end; if (top_level_any_with_type_field_at_end) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyTestCases.top_level_any_with_type_field_at_end) } inline const AnyTestCases* AnyTestCases::internal_default_instance() { return &AnyTestCases_default_instance_.get(); } // ------------------------------------------------------------------- // AnyWrapper // optional .google.protobuf.Any any = 1; inline bool AnyWrapper::has_any() const { return this != internal_default_instance() && any_ != NULL; } inline void AnyWrapper::clear_any() { if (GetArenaNoVirtual() == NULL && any_ != NULL) delete any_; any_ = NULL; } inline const ::google::protobuf::Any& AnyWrapper::any() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyWrapper.any) return any_ != NULL ? *any_ : *::google::protobuf::Any::internal_default_instance(); } inline ::google::protobuf::Any* AnyWrapper::mutable_any() { if (any_ == NULL) { any_ = new ::google::protobuf::Any; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyWrapper.any) return any_; } inline ::google::protobuf::Any* AnyWrapper::release_any() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyWrapper.any) ::google::protobuf::Any* temp = any_; any_ = NULL; return temp; } inline void AnyWrapper::set_allocated_any(::google::protobuf::Any* any) { delete any_; any_ = any; if (any) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyWrapper.any) } inline const AnyWrapper* AnyWrapper::internal_default_instance() { return &AnyWrapper_default_instance_.get(); } // ------------------------------------------------------------------- // Imports // optional .google.protobuf.DoubleValue dbl = 1; inline bool Imports::has_dbl() const { return this != internal_default_instance() && dbl_ != NULL; } inline void Imports::clear_dbl() { if (GetArenaNoVirtual() == NULL && dbl_ != NULL) delete dbl_; dbl_ = NULL; } inline const ::google::protobuf::DoubleValue& Imports::dbl() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Imports.dbl) return dbl_ != NULL ? *dbl_ : *::google::protobuf::DoubleValue::internal_default_instance(); } inline ::google::protobuf::DoubleValue* Imports::mutable_dbl() { if (dbl_ == NULL) { dbl_ = new ::google::protobuf::DoubleValue; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Imports.dbl) return dbl_; } inline ::google::protobuf::DoubleValue* Imports::release_dbl() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Imports.dbl) ::google::protobuf::DoubleValue* temp = dbl_; dbl_ = NULL; return temp; } inline void Imports::set_allocated_dbl(::google::protobuf::DoubleValue* dbl) { delete dbl_; if (dbl != NULL && dbl->GetArena() != NULL) { ::google::protobuf::DoubleValue* new_dbl = new ::google::protobuf::DoubleValue; new_dbl->CopyFrom(*dbl); dbl = new_dbl; } dbl_ = dbl; if (dbl) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Imports.dbl) } // optional .google.protobuf.Struct struct = 2; inline bool Imports::has_struct_() const { return this != internal_default_instance() && struct__ != NULL; } inline void Imports::clear_struct_() { if (GetArenaNoVirtual() == NULL && struct__ != NULL) delete struct__; struct__ = NULL; } inline const ::google::protobuf::Struct& Imports::struct_() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Imports.struct) return struct__ != NULL ? *struct__ : *::google::protobuf::Struct::internal_default_instance(); } inline ::google::protobuf::Struct* Imports::mutable_struct_() { if (struct__ == NULL) { struct__ = new ::google::protobuf::Struct; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Imports.struct) return struct__; } inline ::google::protobuf::Struct* Imports::release_struct_() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Imports.struct) ::google::protobuf::Struct* temp = struct__; struct__ = NULL; return temp; } inline void Imports::set_allocated_struct_(::google::protobuf::Struct* struct_) { delete struct__; if (struct_ != NULL && struct_->GetArena() != NULL) { ::google::protobuf::Struct* new_struct_ = new ::google::protobuf::Struct; new_struct_->CopyFrom(*struct_); struct_ = new_struct_; } struct__ = struct_; if (struct_) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Imports.struct) } // optional .google.protobuf.Timestamp timestamp = 3; inline bool Imports::has_timestamp() const { return this != internal_default_instance() && timestamp_ != NULL; } inline void Imports::clear_timestamp() { if (GetArenaNoVirtual() == NULL && timestamp_ != NULL) delete timestamp_; timestamp_ = NULL; } inline const ::google::protobuf::Timestamp& Imports::timestamp() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Imports.timestamp) return timestamp_ != NULL ? *timestamp_ : *::google::protobuf::Timestamp::internal_default_instance(); } inline ::google::protobuf::Timestamp* Imports::mutable_timestamp() { if (timestamp_ == NULL) { timestamp_ = new ::google::protobuf::Timestamp; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Imports.timestamp) return timestamp_; } inline ::google::protobuf::Timestamp* Imports::release_timestamp() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Imports.timestamp) ::google::protobuf::Timestamp* temp = timestamp_; timestamp_ = NULL; return temp; } inline void Imports::set_allocated_timestamp(::google::protobuf::Timestamp* timestamp) { delete timestamp_; if (timestamp != NULL && timestamp->GetArena() != NULL) { ::google::protobuf::Timestamp* new_timestamp = new ::google::protobuf::Timestamp; new_timestamp->CopyFrom(*timestamp); timestamp = new_timestamp; } timestamp_ = timestamp; if (timestamp) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Imports.timestamp) } // optional .google.protobuf.Duration duration = 4; inline bool Imports::has_duration() const { return this != internal_default_instance() && duration_ != NULL; } inline void Imports::clear_duration() { if (GetArenaNoVirtual() == NULL && duration_ != NULL) delete duration_; duration_ = NULL; } inline const ::google::protobuf::Duration& Imports::duration() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Imports.duration) return duration_ != NULL ? *duration_ : *::google::protobuf::Duration::internal_default_instance(); } inline ::google::protobuf::Duration* Imports::mutable_duration() { if (duration_ == NULL) { duration_ = new ::google::protobuf::Duration; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Imports.duration) return duration_; } inline ::google::protobuf::Duration* Imports::release_duration() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Imports.duration) ::google::protobuf::Duration* temp = duration_; duration_ = NULL; return temp; } inline void Imports::set_allocated_duration(::google::protobuf::Duration* duration) { delete duration_; if (duration != NULL && duration->GetArena() != NULL) { ::google::protobuf::Duration* new_duration = new ::google::protobuf::Duration; new_duration->CopyFrom(*duration); duration = new_duration; } duration_ = duration; if (duration) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Imports.duration) } // optional .google.protobuf.Int32Value i32 = 5; inline bool Imports::has_i32() const { return this != internal_default_instance() && i32_ != NULL; } inline void Imports::clear_i32() { if (GetArenaNoVirtual() == NULL && i32_ != NULL) delete i32_; i32_ = NULL; } inline const ::google::protobuf::Int32Value& Imports::i32() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Imports.i32) return i32_ != NULL ? *i32_ : *::google::protobuf::Int32Value::internal_default_instance(); } inline ::google::protobuf::Int32Value* Imports::mutable_i32() { if (i32_ == NULL) { i32_ = new ::google::protobuf::Int32Value; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Imports.i32) return i32_; } inline ::google::protobuf::Int32Value* Imports::release_i32() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Imports.i32) ::google::protobuf::Int32Value* temp = i32_; i32_ = NULL; return temp; } inline void Imports::set_allocated_i32(::google::protobuf::Int32Value* i32) { delete i32_; if (i32 != NULL && i32->GetArena() != NULL) { ::google::protobuf::Int32Value* new_i32 = new ::google::protobuf::Int32Value; new_i32->CopyFrom(*i32); i32 = new_i32; } i32_ = i32; if (i32) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Imports.i32) } // optional .google.protobuf.testing.Data data = 100; inline bool Imports::has_data() const { return this != internal_default_instance() && data_ != NULL; } inline void Imports::clear_data() { if (GetArenaNoVirtual() == NULL && data_ != NULL) delete data_; data_ = NULL; } inline const ::google::protobuf::testing::Data& Imports::data() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Imports.data) return data_ != NULL ? *data_ : *::google::protobuf::testing::Data::internal_default_instance(); } inline ::google::protobuf::testing::Data* Imports::mutable_data() { if (data_ == NULL) { data_ = new ::google::protobuf::testing::Data; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Imports.data) return data_; } inline ::google::protobuf::testing::Data* Imports::release_data() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Imports.data) ::google::protobuf::testing::Data* temp = data_; data_ = NULL; return temp; } inline void Imports::set_allocated_data(::google::protobuf::testing::Data* data) { delete data_; data_ = data; if (data) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Imports.data) } inline const Imports* Imports::internal_default_instance() { return &Imports_default_instance_.get(); } // ------------------------------------------------------------------- // Data // optional int32 attr = 1; inline void Data::clear_attr() { attr_ = 0; } inline ::google::protobuf::int32 Data::attr() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Data.attr) return attr_; } inline void Data::set_attr(::google::protobuf::int32 value) { attr_ = value; // @@protoc_insertion_point(field_set:google.protobuf.testing.Data.attr) } // optional string str = 2; inline void Data::clear_str() { str_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& Data::str() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Data.str) return str_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void Data::set_str(const ::std::string& value) { str_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:google.protobuf.testing.Data.str) } inline void Data::set_str(const char* value) { str_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:google.protobuf.testing.Data.str) } inline void Data::set_str(const char* value, size_t size) { str_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:google.protobuf.testing.Data.str) } inline ::std::string* Data::mutable_str() { // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Data.str) return str_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* Data::release_str() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Data.str) return str_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void Data::set_allocated_str(::std::string* str) { if (str != NULL) { } else { } str_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), str); // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Data.str) } // repeated string msgs = 3; inline int Data::msgs_size() const { return msgs_.size(); } inline void Data::clear_msgs() { msgs_.Clear(); } inline const ::std::string& Data::msgs(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Data.msgs) return msgs_.Get(index); } inline ::std::string* Data::mutable_msgs(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Data.msgs) return msgs_.Mutable(index); } inline void Data::set_msgs(int index, const ::std::string& value) { // @@protoc_insertion_point(field_set:google.protobuf.testing.Data.msgs) msgs_.Mutable(index)->assign(value); } inline void Data::set_msgs(int index, const char* value) { msgs_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set_char:google.protobuf.testing.Data.msgs) } inline void Data::set_msgs(int index, const char* value, size_t size) { msgs_.Mutable(index)->assign( reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:google.protobuf.testing.Data.msgs) } inline ::std::string* Data::add_msgs() { // @@protoc_insertion_point(field_add_mutable:google.protobuf.testing.Data.msgs) return msgs_.Add(); } inline void Data::add_msgs(const ::std::string& value) { msgs_.Add()->assign(value); // @@protoc_insertion_point(field_add:google.protobuf.testing.Data.msgs) } inline void Data::add_msgs(const char* value) { msgs_.Add()->assign(value); // @@protoc_insertion_point(field_add_char:google.protobuf.testing.Data.msgs) } inline void Data::add_msgs(const char* value, size_t size) { msgs_.Add()->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_add_pointer:google.protobuf.testing.Data.msgs) } inline const ::google::protobuf::RepeatedPtrField< ::std::string>& Data::msgs() const { // @@protoc_insertion_point(field_list:google.protobuf.testing.Data.msgs) return msgs_; } inline ::google::protobuf::RepeatedPtrField< ::std::string>* Data::mutable_msgs() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.testing.Data.msgs) return &msgs_; } // optional .google.protobuf.testing.Data nested_data = 4; inline bool Data::has_nested_data() const { return this != internal_default_instance() && nested_data_ != NULL; } inline void Data::clear_nested_data() { if (GetArenaNoVirtual() == NULL && nested_data_ != NULL) delete nested_data_; nested_data_ = NULL; } inline const ::google::protobuf::testing::Data& Data::nested_data() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Data.nested_data) return nested_data_ != NULL ? *nested_data_ : *::google::protobuf::testing::Data::internal_default_instance(); } inline ::google::protobuf::testing::Data* Data::mutable_nested_data() { if (nested_data_ == NULL) { nested_data_ = new ::google::protobuf::testing::Data; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Data.nested_data) return nested_data_; } inline ::google::protobuf::testing::Data* Data::release_nested_data() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Data.nested_data) ::google::protobuf::testing::Data* temp = nested_data_; nested_data_ = NULL; return temp; } inline void Data::set_allocated_nested_data(::google::protobuf::testing::Data* nested_data) { delete nested_data_; nested_data_ = nested_data; if (nested_data) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Data.nested_data) } // optional .google.protobuf.Int32Value int_wrapper = 5; inline bool Data::has_int_wrapper() const { return this != internal_default_instance() && int_wrapper_ != NULL; } inline void Data::clear_int_wrapper() { if (GetArenaNoVirtual() == NULL && int_wrapper_ != NULL) delete int_wrapper_; int_wrapper_ = NULL; } inline const ::google::protobuf::Int32Value& Data::int_wrapper() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Data.int_wrapper) return int_wrapper_ != NULL ? *int_wrapper_ : *::google::protobuf::Int32Value::internal_default_instance(); } inline ::google::protobuf::Int32Value* Data::mutable_int_wrapper() { if (int_wrapper_ == NULL) { int_wrapper_ = new ::google::protobuf::Int32Value; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Data.int_wrapper) return int_wrapper_; } inline ::google::protobuf::Int32Value* Data::release_int_wrapper() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Data.int_wrapper) ::google::protobuf::Int32Value* temp = int_wrapper_; int_wrapper_ = NULL; return temp; } inline void Data::set_allocated_int_wrapper(::google::protobuf::Int32Value* int_wrapper) { delete int_wrapper_; if (int_wrapper != NULL && int_wrapper->GetArena() != NULL) { ::google::protobuf::Int32Value* new_int_wrapper = new ::google::protobuf::Int32Value; new_int_wrapper->CopyFrom(*int_wrapper); int_wrapper = new_int_wrapper; } int_wrapper_ = int_wrapper; if (int_wrapper) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Data.int_wrapper) } // optional .google.protobuf.Timestamp time = 6; inline bool Data::has_time() const { return this != internal_default_instance() && time_ != NULL; } inline void Data::clear_time() { if (GetArenaNoVirtual() == NULL && time_ != NULL) delete time_; time_ = NULL; } inline const ::google::protobuf::Timestamp& Data::time() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Data.time) return time_ != NULL ? *time_ : *::google::protobuf::Timestamp::internal_default_instance(); } inline ::google::protobuf::Timestamp* Data::mutable_time() { if (time_ == NULL) { time_ = new ::google::protobuf::Timestamp; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Data.time) return time_; } inline ::google::protobuf::Timestamp* Data::release_time() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Data.time) ::google::protobuf::Timestamp* temp = time_; time_ = NULL; return temp; } inline void Data::set_allocated_time(::google::protobuf::Timestamp* time) { delete time_; if (time != NULL && time->GetArena() != NULL) { ::google::protobuf::Timestamp* new_time = new ::google::protobuf::Timestamp; new_time->CopyFrom(*time); time = new_time; } time_ = time; if (time) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Data.time) } // map<string, string> map_data = 7; inline int Data::map_data_size() const { return map_data_.size(); } inline void Data::clear_map_data() { map_data_.Clear(); } inline const ::google::protobuf::Map< ::std::string, ::std::string >& Data::map_data() const { // @@protoc_insertion_point(field_map:google.protobuf.testing.Data.map_data) return map_data_.GetMap(); } inline ::google::protobuf::Map< ::std::string, ::std::string >* Data::mutable_map_data() { // @@protoc_insertion_point(field_mutable_map:google.protobuf.testing.Data.map_data) return map_data_.MutableMap(); } // optional .google.protobuf.Struct struct_data = 8; inline bool Data::has_struct_data() const { return this != internal_default_instance() && struct_data_ != NULL; } inline void Data::clear_struct_data() { if (GetArenaNoVirtual() == NULL && struct_data_ != NULL) delete struct_data_; struct_data_ = NULL; } inline const ::google::protobuf::Struct& Data::struct_data() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Data.struct_data) return struct_data_ != NULL ? *struct_data_ : *::google::protobuf::Struct::internal_default_instance(); } inline ::google::protobuf::Struct* Data::mutable_struct_data() { if (struct_data_ == NULL) { struct_data_ = new ::google::protobuf::Struct; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Data.struct_data) return struct_data_; } inline ::google::protobuf::Struct* Data::release_struct_data() { // @@protoc_insertion_point(field_release:google.protobuf.testing.Data.struct_data) ::google::protobuf::Struct* temp = struct_data_; struct_data_ = NULL; return temp; } inline void Data::set_allocated_struct_data(::google::protobuf::Struct* struct_data) { delete struct_data_; if (struct_data != NULL && struct_data->GetArena() != NULL) { ::google::protobuf::Struct* new_struct_data = new ::google::protobuf::Struct; new_struct_data->CopyFrom(*struct_data); struct_data = new_struct_data; } struct_data_ = struct_data; if (struct_data) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.Data.struct_data) } // repeated .google.protobuf.testing.Data repeated_data = 9; inline int Data::repeated_data_size() const { return repeated_data_.size(); } inline void Data::clear_repeated_data() { repeated_data_.Clear(); } inline const ::google::protobuf::testing::Data& Data::repeated_data(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.testing.Data.repeated_data) return repeated_data_.Get(index); } inline ::google::protobuf::testing::Data* Data::mutable_repeated_data(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.testing.Data.repeated_data) return repeated_data_.Mutable(index); } inline ::google::protobuf::testing::Data* Data::add_repeated_data() { // @@protoc_insertion_point(field_add:google.protobuf.testing.Data.repeated_data) return repeated_data_.Add(); } inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::testing::Data >* Data::mutable_repeated_data() { // @@protoc_insertion_point(field_mutable_list:google.protobuf.testing.Data.repeated_data) return &repeated_data_; } inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::testing::Data >& Data::repeated_data() const { // @@protoc_insertion_point(field_list:google.protobuf.testing.Data.repeated_data) return repeated_data_; } inline const Data* Data::internal_default_instance() { return &Data_default_instance_.get(); } // ------------------------------------------------------------------- // AnyIn // optional string something = 1; inline void AnyIn::clear_something() { something_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& AnyIn::something() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyIn.something) return something_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void AnyIn::set_something(const ::std::string& value) { something_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:google.protobuf.testing.AnyIn.something) } inline void AnyIn::set_something(const char* value) { something_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:google.protobuf.testing.AnyIn.something) } inline void AnyIn::set_something(const char* value, size_t size) { something_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:google.protobuf.testing.AnyIn.something) } inline ::std::string* AnyIn::mutable_something() { // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyIn.something) return something_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* AnyIn::release_something() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyIn.something) return something_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void AnyIn::set_allocated_something(::std::string* something) { if (something != NULL) { } else { } something_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), something); // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyIn.something) } // optional .google.protobuf.Any any = 2; inline bool AnyIn::has_any() const { return this != internal_default_instance() && any_ != NULL; } inline void AnyIn::clear_any() { if (GetArenaNoVirtual() == NULL && any_ != NULL) delete any_; any_ = NULL; } inline const ::google::protobuf::Any& AnyIn::any() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyIn.any) return any_ != NULL ? *any_ : *::google::protobuf::Any::internal_default_instance(); } inline ::google::protobuf::Any* AnyIn::mutable_any() { if (any_ == NULL) { any_ = new ::google::protobuf::Any; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyIn.any) return any_; } inline ::google::protobuf::Any* AnyIn::release_any() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyIn.any) ::google::protobuf::Any* temp = any_; any_ = NULL; return temp; } inline void AnyIn::set_allocated_any(::google::protobuf::Any* any) { delete any_; any_ = any; if (any) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyIn.any) } inline const AnyIn* AnyIn::internal_default_instance() { return &AnyIn_default_instance_.get(); } // ------------------------------------------------------------------- // AnyOut // optional .google.protobuf.Any any = 1; inline bool AnyOut::has_any() const { return this != internal_default_instance() && any_ != NULL; } inline void AnyOut::clear_any() { if (GetArenaNoVirtual() == NULL && any_ != NULL) delete any_; any_ = NULL; } inline const ::google::protobuf::Any& AnyOut::any() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyOut.any) return any_ != NULL ? *any_ : *::google::protobuf::Any::internal_default_instance(); } inline ::google::protobuf::Any* AnyOut::mutable_any() { if (any_ == NULL) { any_ = new ::google::protobuf::Any; } // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyOut.any) return any_; } inline ::google::protobuf::Any* AnyOut::release_any() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyOut.any) ::google::protobuf::Any* temp = any_; any_ = NULL; return temp; } inline void AnyOut::set_allocated_any(::google::protobuf::Any* any) { delete any_; any_ = any; if (any) { } else { } // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyOut.any) } inline const AnyOut* AnyOut::internal_default_instance() { return &AnyOut_default_instance_.get(); } // ------------------------------------------------------------------- // AnyM // optional string foo = 1; inline void AnyM::clear_foo() { foo_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& AnyM::foo() const { // @@protoc_insertion_point(field_get:google.protobuf.testing.AnyM.foo) return foo_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void AnyM::set_foo(const ::std::string& value) { foo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:google.protobuf.testing.AnyM.foo) } inline void AnyM::set_foo(const char* value) { foo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:google.protobuf.testing.AnyM.foo) } inline void AnyM::set_foo(const char* value, size_t size) { foo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast<const char*>(value), size)); // @@protoc_insertion_point(field_set_pointer:google.protobuf.testing.AnyM.foo) } inline ::std::string* AnyM::mutable_foo() { // @@protoc_insertion_point(field_mutable:google.protobuf.testing.AnyM.foo) return foo_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* AnyM::release_foo() { // @@protoc_insertion_point(field_release:google.protobuf.testing.AnyM.foo) return foo_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void AnyM::set_allocated_foo(::std::string* foo) { if (foo != NULL) { } else { } foo_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), foo); // @@protoc_insertion_point(field_set_allocated:google.protobuf.testing.AnyM.foo) } inline const AnyM* AnyM::internal_default_instance() { return &AnyM_default_instance_.get(); } #endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // @@protoc_insertion_point(namespace_scope) } // namespace testing } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) #endif // PROTOBUF_google_2fprotobuf_2futil_2finternal_2ftestdata_2fanys_2eproto__INCLUDED
36,851
634
/* * Copyright 2000-2013 JetBrains s.r.o. * * 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.intellij.openapi.progress.util; import com.intellij.openapi.progress.ProgressIndicator; import consulo.util.dataholder.Key; import consulo.util.dataholder.UserDataHolder; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; public class TooManyUsagesStatus { private static final Key<TooManyUsagesStatus> KEY = Key.create("TooManyUsagesStatus"); private static final Null NULL = new Null(); @Nonnull public static TooManyUsagesStatus getFrom(@Nullable ProgressIndicator indicator) { TooManyUsagesStatus data = null; if (indicator instanceof UserDataHolder) { data = ((UserDataHolder)indicator).getUserData(KEY); } if (data == null) data = NULL; return data; } public static TooManyUsagesStatus createFor(@Nonnull ProgressIndicator indicator) { TooManyUsagesStatus data = null; if (indicator instanceof UserDataHolder) { data = new TooManyUsagesStatus(); ((UserDataHolder)indicator).putUserData(KEY, data); } return data; } // return true if dialog needs to be shown public boolean switchTooManyUsagesStatus() { return tooManyUsagesStatus.get() == Status.FEW_USAGES && tooManyUsagesStatus.compareAndSet(Status.FEW_USAGES, Status.WARNING_DIALOG_SHOWN); } public void userResponded() { waitWhileUserClick.countDown(); tooManyUsagesStatus.set(Status.USER_RESPONDED); } public enum Status { FEW_USAGES, WARNING_DIALOG_SHOWN, USER_RESPONDED } private final AtomicReference<Status> tooManyUsagesStatus = new AtomicReference<Status>(Status.FEW_USAGES); private final CountDownLatch waitWhileUserClick = new CountDownLatch(1); public void pauseProcessingIfTooManyUsages() { if (tooManyUsagesStatus.get() == Status.WARNING_DIALOG_SHOWN) { //assert ApplicationManager.getApplication().isDispatchThread() || !ApplicationManager.getApplication().isReadAccessAllowed(); try { waitWhileUserClick.await(1, TimeUnit.SECONDS); } catch (InterruptedException ignored) { } } } private static class Null extends TooManyUsagesStatus { @Override public boolean switchTooManyUsagesStatus() { return false; } @Override public void userResponded() { } @Override public void pauseProcessingIfTooManyUsages() { } } }
1,005
2,512
<filename>tests/test_meter_build.py # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import unittest from parameterized import parameterized from utils import ROOT_LOSS_CONFIGS, SSLHydraConfig from vissl.trainer.train_task import SelfSupervisionTask from vissl.utils.hydra_config import convert_to_attrdict logger = logging.getLogger("__name__") class TestRootConfigsMeterBuild(unittest.TestCase): @parameterized.expand(ROOT_LOSS_CONFIGS) def test_meter_build(self, filepath): logger.info(f"Loading {filepath}") cfg = SSLHydraConfig.from_configs([filepath]) _, config = convert_to_attrdict(cfg.default_cfg) meters = SelfSupervisionTask.from_config(config)._build_meters() self.assertGreaterEqual(len(meters), 0, "Failed to build meters")
327
348
<filename>docs/data/leg-t2/061/06101463.json {"nom":"<NAME>","circ":"1ère circonscription","dpt":"Orne","inscrits":1262,"abs":714,"votants":548,"blancs":30,"nuls":11,"exp":507,"res":[{"nuance":"SOC","nom":"<NAME>","voix":286},{"nuance":"DVD","nom":"<NAME>","voix":221}]}
110
852
<reponame>ckamtsikis/cmssw<filename>Alignment/CocoaFit/interface/MatrixMeschach.h // COCOA class header file //Id: MatrixMeschach.h //CAT: Model // // Class for matrices // // History: v1.0 // <NAME> #ifndef _ALIMATRIX_HH #define _ALIMATRIX_HH #include "Alignment/CocoaUtilities/interface/CocoaGlobals.h" #include <vector> #include <iostream> extern "C" { #include <matrix.h> #include <matrix2.h> } // Meschach external (matrix.h) defines C++-incompatible macros // which break other code (e.g. standard <limits>). // Since these are not used here, undef them. #undef max #undef min #undef catch #undef Real class MatrixMeschach { public: MatrixMeschach(); MatrixMeschach(ALIint NoCol, ALIint NoLin); MatrixMeschach(const MatrixMeschach& mat); ~MatrixMeschach(); void AddData(ALIuint col, ALIuint lin, ALIdouble data); void transpose(); void inverse(); void Dump(const ALIstring& mtext); void ostrDump(std::ostream& fout, const ALIstring& mtext); void EliminateLines(ALIint lin_first, ALIint lin_last); void EliminateColumns(ALIint lin_first, ALIint lin_last); void SetCorrelation(ALIint i1, ALIint i2, ALIdouble corr); MatrixMeschach& operator=(const MatrixMeschach& mat); void operator*=(const MatrixMeschach& mat); void operator+=(const MatrixMeschach& mat); void operator*=(const ALIdouble num); ALIdouble operator()(int i, int j) const; //ACCESS PRIVATE DATA MEMBERS ALIint NoLines() const { return _NoLines; } ALIint NoColumns() const { return _NoColumns; } void setNoColumns(ALIint ncol) { _NoColumns = ncol; } void setNoLines(ALIint nlin) { _NoLines = nlin; } const MAT* Mat() const { return _Mat; } void setMat(MAT* mat) { _Mat = mat; } MAT* MatNonConst() const { return _Mat; } private: // private data members ALIint _NoLines; ALIint _NoColumns; // vector< ALIdouble> _data; MAT* _Mat; void copy(const MatrixMeschach& mat); }; MatrixMeschach operator*(const MatrixMeschach& mat1, const MatrixMeschach& mat2); MatrixMeschach operator+(const MatrixMeschach& mat1, const MatrixMeschach& mat2); MatrixMeschach operator-(const MatrixMeschach& mat1, const MatrixMeschach& mat2); MatrixMeschach operator*(const ALIdouble doub, const MatrixMeschach& mat); MatrixMeschach operator*(const MatrixMeschach& mat, const ALIdouble doub); MatrixMeschach* MatrixByMatrix(const MatrixMeschach& mat1, const MatrixMeschach& mat2); typedef MatrixMeschach ALIMatrix; #endif
1,011
2,270
<reponame>kzantow-audio/JUCE /* ============================================================================== This file is part of the JUCE library. Copyright (c) 2020 - Raw Material Software Limited JUCE is an open source library subject to commercial or open-source licensing. By using JUCE, you agree to the terms of both the JUCE 6 End-User License Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020). End User License Agreement: www.juce.com/juce-6-licence Privacy Policy: www.juce.com/juce-privacy-policy Or: You may also use this code under the terms of the GPL v3 (see www.gnu.org/licenses). JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE DISCLAIMED. ============================================================================== */ #pragma once //============================================================================== class ToggleButtonHandler : public ButtonHandler { public: ToggleButtonHandler() : ButtonHandler ("Toggle Button", "juce::ToggleButton", typeid (ToggleButton), 150, 24) { registerColour (juce::ToggleButton::textColourId, "text colour", "txtcol"); } Component* createNewComponent (JucerDocument*) override { return new ToggleButton ("new toggle button"); } void getEditableProperties (Component* component, JucerDocument& document, Array<PropertyComponent*>& props, bool multipleSelected) override { ButtonHandler::getEditableProperties (component, document, props, multipleSelected); if (multipleSelected) return; if (auto* tb = dynamic_cast<ToggleButton*> (component)) props.add (new ToggleButtonStateProperty (tb, document)); addColourProperties (component, document, props); } XmlElement* createXmlFor (Component* comp, const ComponentLayout* layout) override { ToggleButton* tb = (ToggleButton*) comp; XmlElement* e = ButtonHandler::createXmlFor (comp, layout); e->setAttribute ("state", tb->getToggleState()); return e; } bool restoreFromXml (const XmlElement& xml, Component* comp, const ComponentLayout* layout) override { ToggleButton* const tb = (ToggleButton*) comp; if (! ButtonHandler::restoreFromXml (xml, comp, layout)) return false; tb->setToggleState (xml.getBoolAttribute ("state", false), dontSendNotification); return true; } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) override { ButtonHandler::fillInCreationCode (code, component, memberVariableName); ToggleButton* const tb = dynamic_cast<ToggleButton*> (component); String s; if (tb->getToggleState()) s << memberVariableName << "->setToggleState (true, juce::dontSendNotification);\n"; s << getColourIntialisationCode (component, memberVariableName) << '\n'; code.constructorCode += s; } private: class ToggleButtonStateProperty : public ComponentBooleanProperty <ToggleButton> { public: ToggleButtonStateProperty (ToggleButton* button_, JucerDocument& doc) : ComponentBooleanProperty <ToggleButton> ("initial state", "on", "off", button_, doc) { } void setState (bool newState) { document.perform (new ToggleStateChangeAction (component, *document.getComponentLayout(), newState), "Change ToggleButton state"); } bool getState() const { return component->getToggleState(); } private: class ToggleStateChangeAction : public ComponentUndoableAction <ToggleButton> { public: ToggleStateChangeAction (ToggleButton* const comp, ComponentLayout& l, const bool newState_) : ComponentUndoableAction <ToggleButton> (comp, l), newState (newState_) { oldState = comp->getToggleState(); } bool perform() { showCorrectTab(); getComponent()->setToggleState (newState, dontSendNotification); changed(); return true; } bool undo() { showCorrectTab(); getComponent()->setToggleState (oldState, dontSendNotification); changed(); return true; } bool newState, oldState; }; }; };
2,035
5,169
{ "name": "TaurusXAd_Mobrain_AdMob", "version": "7.67.0.0", "summary": "Mobrain-AdMob Adapters for mediating through TaurusX Ads.", "homepage": "https://github.com/webeyemob/TaurusXAds_iOS_Pub", "license": { "type": "MIT", "file": "TaurusXAd_Mobrain_AdMob_7.67.0.0/LICENSE" }, "authors": "TaurusXAds", "platforms": { "ios": "9.0" }, "source": { "http": "https://github.com/webeyemob/TaurusXAds_iOS_Pub/raw/master/Networks/TaurusXAd_Mobrain_AdMob/TaurusXAd_Mobrain_AdMob_7.67.0.0.zip" }, "vendored_frameworks": "TaurusXAd_Mobrain_AdMob_7.67.0.0/ABUAdAdmobAdapter.framework" }
285
491
<filename>modules/rtp_rtcp/source/fec_private_tables_bursty.h /* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef MODULES_RTP_RTCP_SOURCE_FEC_PRIVATE_TABLES_BURSTY_H_ #define MODULES_RTP_RTCP_SOURCE_FEC_PRIVATE_TABLES_BURSTY_H_ // This file contains a set of packets masks for the FEC code. The masks in // this table are specifically designed to favor recovery of bursty/consecutive // loss network conditions. The tradeoff is worse recovery for random losses. // These packet masks are currently defined to protect up to 12 media packets. // They have the following property: for any packet mask defined by the // parameters (k,m), where k = number of media packets, m = number of FEC // packets, all "consecutive" losses of size <= m are completely recoverable. // By consecutive losses we mean consecutive with respect to the sequence // number ordering of the list (media and FEC) of packets. The difference // between these masks (|kFecMaskBursty|) and |kFecMaskRandom| type, defined // in fec_private_tables.h, is more significant for longer codes // (i.e., more packets/symbols in the code, so larger (k,m), i.e., k > 4, // m > 3). #include "typedefs.h" // NOLINT(build/include) namespace webrtc { namespace fec_private_tables { const uint8_t kMaskBursty1_1[2] = { 0x80, 0x00 }; const uint8_t kMaskBursty2_1[2] = { 0xc0, 0x00 }; const uint8_t kMaskBursty2_2[4] = { 0x80, 0x00, 0xc0, 0x00 }; const uint8_t kMaskBursty3_1[2] = { 0xe0, 0x00 }; const uint8_t kMaskBursty3_2[4] = { 0xc0, 0x00, 0xa0, 0x00 }; const uint8_t kMaskBursty3_3[6] = { 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00 }; const uint8_t kMaskBursty4_1[2] = { 0xf0, 0x00 }; const uint8_t kMaskBursty4_2[4] = { 0xa0, 0x00, 0xd0, 0x00 }; const uint8_t kMaskBursty4_3[6] = { 0xc0, 0x00, 0x60, 0x00, 0x90, 0x00 }; const uint8_t kMaskBursty4_4[8] = { 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00 }; const uint8_t kMaskBursty5_1[2] = { 0xf8, 0x00 }; const uint8_t kMaskBursty5_2[4] = { 0xd0, 0x00, 0xa8, 0x00 }; const uint8_t kMaskBursty5_3[6] = { 0x70, 0x00, 0x90, 0x00, 0xc8, 0x00 }; const uint8_t kMaskBursty5_4[8] = { 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x88, 0x00 }; const uint8_t kMaskBursty5_5[10] = { 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00 }; const uint8_t kMaskBursty6_1[2] = { 0xfc, 0x00 }; const uint8_t kMaskBursty6_2[4] = { 0xa8, 0x00, 0xd4, 0x00 }; const uint8_t kMaskBursty6_3[6] = { 0x94, 0x00, 0xc8, 0x00, 0x64, 0x00 }; const uint8_t kMaskBursty6_4[8] = { 0x60, 0x00, 0x38, 0x00, 0x88, 0x00, 0xc4, 0x00 }; const uint8_t kMaskBursty6_5[10] = { 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x84, 0x00 }; const uint8_t kMaskBursty6_6[12] = { 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00 }; const uint8_t kMaskBursty7_1[2] = { 0xfe, 0x00 }; const uint8_t kMaskBursty7_2[4] = { 0xd4, 0x00, 0xaa, 0x00 }; const uint8_t kMaskBursty7_3[6] = { 0xc8, 0x00, 0x74, 0x00, 0x92, 0x00 }; const uint8_t kMaskBursty7_4[8] = { 0x38, 0x00, 0x8a, 0x00, 0xc4, 0x00, 0x62, 0x00 }; const uint8_t kMaskBursty7_5[10] = { 0x60, 0x00, 0x30, 0x00, 0x1c, 0x00, 0x84, 0x00, 0xc2, 0x00 }; const uint8_t kMaskBursty7_6[12] = { 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x82, 0x00 }; const uint8_t kMaskBursty7_7[14] = { 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00 }; const uint8_t kMaskBursty8_1[2] = { 0xff, 0x00 }; const uint8_t kMaskBursty8_2[4] = { 0xaa, 0x00, 0xd5, 0x00 }; const uint8_t kMaskBursty8_3[6] = { 0x74, 0x00, 0x92, 0x00, 0xc9, 0x00 }; const uint8_t kMaskBursty8_4[8] = { 0x8a, 0x00, 0xc5, 0x00, 0x62, 0x00, 0x31, 0x00 }; const uint8_t kMaskBursty8_5[10] = { 0x30, 0x00, 0x1c, 0x00, 0x85, 0x00, 0xc2, 0x00, 0x61, 0x00 }; const uint8_t kMaskBursty8_6[12] = { 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0e, 0x00, 0x82, 0x00, 0xc1, 0x00 }; const uint8_t kMaskBursty8_7[14] = { 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x81, 0x00 }; const uint8_t kMaskBursty8_8[16] = { 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00 }; const uint8_t kMaskBursty9_1[2] = { 0xff, 0x80 }; const uint8_t kMaskBursty9_2[4] = { 0xd5, 0x00, 0xaa, 0x80 }; const uint8_t kMaskBursty9_3[6] = { 0x92, 0x00, 0xc9, 0x00, 0x74, 0x80 }; const uint8_t kMaskBursty9_4[8] = { 0xc5, 0x00, 0x62, 0x00, 0x39, 0x00, 0x8a, 0x80 }; const uint8_t kMaskBursty9_5[10] = { 0x1c, 0x00, 0x85, 0x00, 0xc2, 0x80, 0x61, 0x00, 0x30, 0x80 }; const uint8_t kMaskBursty9_6[12] = { 0x30, 0x00, 0x18, 0x00, 0x0e, 0x00, 0x82, 0x80, 0xc1, 0x00, 0x60, 0x80 }; const uint8_t kMaskBursty9_7[14] = { 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x81, 0x00, 0xc0, 0x80 }; const uint8_t kMaskBursty9_8[16] = { 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x80, 0x80 }; const uint8_t kMaskBursty9_9[18] = { 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x80 }; const uint8_t kMaskBursty10_1[2] = { 0xff, 0xc0 }; const uint8_t kMaskBursty10_2[4] = { 0xaa, 0x80, 0xd5, 0x40 }; const uint8_t kMaskBursty10_3[6] = { 0xc9, 0x00, 0x74, 0x80, 0x92, 0x40 }; const uint8_t kMaskBursty10_4[8] = { 0x62, 0x00, 0x39, 0x00, 0x8a, 0x80, 0xc5, 0x40 }; const uint8_t kMaskBursty10_5[10] = { 0x85, 0x00, 0xc2, 0x80, 0x61, 0x40, 0x30, 0x80, 0x18, 0x40 }; const uint8_t kMaskBursty10_6[12] = { 0x18, 0x00, 0x0e, 0x00, 0x82, 0x80, 0xc1, 0x40, 0x60, 0x80, 0x30, 0x40 }; const uint8_t kMaskBursty10_7[14] = { 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x81, 0x40, 0xc0, 0x80, 0x60, 0x40 }; const uint8_t kMaskBursty10_8[16] = { 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x80, 0x80, 0xc0, 0x40 }; const uint8_t kMaskBursty10_9[18] = { 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x80, 0x80, 0x40 }; const uint8_t kMaskBursty10_10[20] = { 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x80, 0x00, 0xc0 }; const uint8_t kMaskBursty11_1[2] = { 0xff, 0xe0 }; const uint8_t kMaskBursty11_2[4] = { 0xd5, 0x40, 0xaa, 0xa0 }; const uint8_t kMaskBursty11_3[6] = { 0x74, 0x80, 0x92, 0x40, 0xc9, 0x20 }; const uint8_t kMaskBursty11_4[8] = { 0x39, 0x00, 0x8a, 0x80, 0xc5, 0x40, 0x62, 0x20 }; const uint8_t kMaskBursty11_5[10] = { 0xc2, 0xc0, 0x61, 0x00, 0x30, 0xa0, 0x1c, 0x40, 0x85, 0x20 }; const uint8_t kMaskBursty11_6[12] = { 0x0e, 0x00, 0x82, 0x80, 0xc1, 0x40, 0x60, 0xa0, 0x30, 0x40, 0x18, 0x20 }; const uint8_t kMaskBursty11_7[14] = { 0x18, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x81, 0x40, 0xc0, 0xa0, 0x60, 0x40, 0x30, 0x20 }; const uint8_t kMaskBursty11_8[16] = { 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x40, 0x80, 0xa0, 0xc0, 0x40, 0x60, 0x20 }; const uint8_t kMaskBursty11_9[18] = { 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x80, 0x80, 0x40, 0xc0, 0x20 }; const uint8_t kMaskBursty11_10[20] = { 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x80, 0x00, 0xc0, 0x80, 0x20 }; const uint8_t kMaskBursty11_11[22] = { 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x80, 0x00, 0xc0, 0x00, 0x60 }; const uint8_t kMaskBursty12_1[2] = { 0xff, 0xf0 }; const uint8_t kMaskBursty12_2[4] = { 0xaa, 0xa0, 0xd5, 0x50 }; const uint8_t kMaskBursty12_3[6] = { 0x92, 0x40, 0xc9, 0x20, 0x74, 0x90 }; const uint8_t kMaskBursty12_4[8] = { 0x8a, 0x80, 0xc5, 0x40, 0x62, 0x20, 0x39, 0x10 }; const uint8_t kMaskBursty12_5[10] = { 0x61, 0x00, 0x30, 0xa0, 0x1c, 0x50, 0x85, 0x20, 0xc2, 0x90 }; const uint8_t kMaskBursty12_6[12] = { 0x82, 0x90, 0xc1, 0x40, 0x60, 0xa0, 0x30, 0x50, 0x18, 0x20, 0x0c, 0x10 }; const uint8_t kMaskBursty12_7[14] = { 0x0c, 0x00, 0x07, 0x00, 0x81, 0x40, 0xc0, 0xa0, 0x60, 0x50, 0x30, 0x20, 0x18, 0x10 }; const uint8_t kMaskBursty12_8[16] = { 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x80, 0xa0, 0xc0, 0x50, 0x60, 0x20, 0x30, 0x10 }; const uint8_t kMaskBursty12_9[18] = { 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x80, 0x80, 0x50, 0xc0, 0x20, 0x60, 0x10 }; const uint8_t kMaskBursty12_10[20] = { 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x80, 0x00, 0xc0, 0x80, 0x20, 0xc0, 0x10 }; const uint8_t kMaskBursty12_11[22] = { 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x80, 0x00, 0xc0, 0x00, 0x60, 0x80, 0x10 }; const uint8_t kMaskBursty12_12[24] = { 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03, 0x00, 0x01, 0x80, 0x00, 0xc0, 0x00, 0x60, 0x00, 0x30 }; const uint8_t* const kPacketMaskBursty1[1] = { kMaskBursty1_1 }; const uint8_t* const kPacketMaskBursty2[2] = { kMaskBursty2_1, kMaskBursty2_2 }; const uint8_t* const kPacketMaskBursty3[3] = { kMaskBursty3_1, kMaskBursty3_2, kMaskBursty3_3 }; const uint8_t* const kPacketMaskBursty4[4] = { kMaskBursty4_1, kMaskBursty4_2, kMaskBursty4_3, kMaskBursty4_4 }; const uint8_t* const kPacketMaskBursty5[5] = { kMaskBursty5_1, kMaskBursty5_2, kMaskBursty5_3, kMaskBursty5_4, kMaskBursty5_5 }; const uint8_t* const kPacketMaskBursty6[6] = { kMaskBursty6_1, kMaskBursty6_2, kMaskBursty6_3, kMaskBursty6_4, kMaskBursty6_5, kMaskBursty6_6 }; const uint8_t* const kPacketMaskBursty7[7] = { kMaskBursty7_1, kMaskBursty7_2, kMaskBursty7_3, kMaskBursty7_4, kMaskBursty7_5, kMaskBursty7_6, kMaskBursty7_7 }; const uint8_t* const kPacketMaskBursty8[8] = { kMaskBursty8_1, kMaskBursty8_2, kMaskBursty8_3, kMaskBursty8_4, kMaskBursty8_5, kMaskBursty8_6, kMaskBursty8_7, kMaskBursty8_8 }; const uint8_t* const kPacketMaskBursty9[9] = { kMaskBursty9_1, kMaskBursty9_2, kMaskBursty9_3, kMaskBursty9_4, kMaskBursty9_5, kMaskBursty9_6, kMaskBursty9_7, kMaskBursty9_8, kMaskBursty9_9 }; const uint8_t* const kPacketMaskBursty10[10] = { kMaskBursty10_1, kMaskBursty10_2, kMaskBursty10_3, kMaskBursty10_4, kMaskBursty10_5, kMaskBursty10_6, kMaskBursty10_7, kMaskBursty10_8, kMaskBursty10_9, kMaskBursty10_10 }; const uint8_t* const kPacketMaskBursty11[11] = { kMaskBursty11_1, kMaskBursty11_2, kMaskBursty11_3, kMaskBursty11_4, kMaskBursty11_5, kMaskBursty11_6, kMaskBursty11_7, kMaskBursty11_8, kMaskBursty11_9, kMaskBursty11_10, kMaskBursty11_11 }; const uint8_t* const kPacketMaskBursty12[12] = { kMaskBursty12_1, kMaskBursty12_2, kMaskBursty12_3, kMaskBursty12_4, kMaskBursty12_5, kMaskBursty12_6, kMaskBursty12_7, kMaskBursty12_8, kMaskBursty12_9, kMaskBursty12_10, kMaskBursty12_11, kMaskBursty12_12 }; const uint8_t* const* const kPacketMaskBurstyTbl[12] = { kPacketMaskBursty1, kPacketMaskBursty2, kPacketMaskBursty3, kPacketMaskBursty4, kPacketMaskBursty5, kPacketMaskBursty6, kPacketMaskBursty7, kPacketMaskBursty8, kPacketMaskBursty9, kPacketMaskBursty10, kPacketMaskBursty11, kPacketMaskBursty12 }; } // namespace fec_private_tables } // namespace webrtc #endif // MODULES_RTP_RTCP_SOURCE_FEC_PRIVATE_TABLES_BURSTY_H_
6,957
680
<reponame>AlexChrisF/udacity /* Copyright 2015 The TensorFlow Authors. All Rights Reserved. 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. ==============================================================================*/ #ifndef TENSORFLOW_FRAMEWORK_MEMORY_TYPES_H_ #define TENSORFLOW_FRAMEWORK_MEMORY_TYPES_H_ #include "tensorflow/core/framework/graph.pb.h" #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/types.h" namespace tensorflow { // Returns into *{input,output}_memory_types the memory type of each // {input,output} tensor. // // REQUIRES: * '*_memory_types' is not nullptr. // * def has all attrs specified (e.g. using AddDefaultsToNodeDef()). Status MemoryTypesForNode(const OpRegistryInterface* op_registry, DeviceType device_type, const NodeDef& ndef, MemoryTypeVector* input_memory_types, MemoryTypeVector* output_memory_types); } // namespace tensorflow #endif // TENSORFLOW_FRAMEWORK_MEMORY_TYPES_H_
524