text
stringlengths
2
99k
meta
dict
## Postgres-XL you can only see databases with CREATE privilege ### 作者 digoal ### 日期 2014-07-25 ### 标签 PostgreSQL , Postgres-XL , 权限管理 ---- ## 背景 Postgres-XL改写了SQL parser, 并新增了storm_catalog这个catalog. 目的可能是提高安全性, 例如pg_database这个表, 在storm_catalog中创建一个同名视图, 正常情况下会先访问pg_catalog.pg_database, 但是因为改了parser代码, 所以直接访问的是storm_catalog.pg_database. 这个视图的定义说明了这个问题 : ``` postgres=# \dn *.* List of schemas Name | Owner --------------------+---------- information_schema | postgres pg_catalog | postgres pg_temp_1 | postgres pg_toast | postgres pg_toast_temp_1 | postgres public | postgres storm_catalog | postgres (7 rows) postgres=# \d pg_database View "storm_catalog.pg_database" Column | Type | Modifiers ---------------+-----------+----------- tableoid | oid | oid | oid | datname | name | datdba | oid | encoding | integer | datcollate | name | datctype | name | datistemplate | boolean | datallowconn | boolean | datconnlimit | integer | datlastsysoid | oid | datfrozenxid | xid | dattablespace | oid | datacl | aclitem[] | postgres=# \d+ pg_database View "storm_catalog.pg_database" Column | Type | Modifiers | Storage | Description ---------------+-----------+-----------+----------+------------- tableoid | oid | | plain | oid | oid | | plain | datname | name | | plain | datdba | oid | | plain | encoding | integer | | plain | datcollate | name | | plain | datctype | name | | plain | datistemplate | boolean | | plain | datallowconn | boolean | | plain | datconnlimit | integer | | plain | datlastsysoid | oid | | plain | datfrozenxid | xid | | plain | dattablespace | oid | | plain | datacl | aclitem[] | | extended | View definition: SELECT pg_database.tableoid, pg_database.oid, pg_database.datname, pg_database.datdba, pg_database.encoding, pg_database.datcollate, pg_database.datctype, pg_database.datistemplate, pg_database.datallowconn, pg_database.datconnlimit, pg_database.datlastsysoid, pg_database.datfrozenxid, pg_database.dattablespace, pg_database.datacl FROM pg_catalog.pg_database WHERE pg_database.datallowconn AND (has_database_privilege(pg_database.datname::text, 'CREATE'::text) OR split_part("current_user"()::text, '@'::text, 2) = pg_database.datname::text); ``` 这个视图只允许你查看拥有CREATE权限的数据库, 所以一个普通用户可能只能看到部分数据库. ``` postgres=# \c postgres digoal You are now connected to database "postgres" as user "digoal". postgres=> \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ------+--------+----------+---------+-------+------------------- test | digoal | UTF8 | C | C | =Tc/digoal + | | | | | digoal=CTc/digoal (1 row) ``` 连接到超级用户, 可以查看到全部的数据库. ``` postgres=> \c postgres postgres You are now connected to database "postgres" as user "postgres". postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+---------+-------+----------------------- postgres | postgres | UTF8 | C | C | =Tc/postgres + | | | | | postgres=CTc/postgres template0 | postgres | UTF8 | C | C | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | C | C | =c/postgres + | | | | | postgres=CTc/postgres test | digoal | UTF8 | C | C | =Tc/digoal + | | | | | digoal=CTc/digoal (4 rows) ``` 不仅如此, Postgres-XL还改了pg_catalog.pg_database_size函数的权限, 普通用户没有执行权限. 而且会先执行storm_catalog.pg_databas_size() , 这个函数返回的是当前连接的数据库的SIZE, 当前没有连接的数据库显示SIZE=0. 具体看它的代码. ``` postgres=> \df+ pg_database_size List of functions -[ RECORD 1 ]-------+-------------------------------------------- Schema | storm_catalog Name | pg_database_size Result data type | bigint Argument data types | name Type | normal Volatility | volatile Owner | postgres Language | plpgsql Source code | | BEGIN | IF $1 = current_database() THEN | return pg_catalog.pg_database_size($1); | END IF; | | return 0; | END | Description | -[ RECORD 2 ]-------+-------------------------------------------- Schema | storm_catalog Name | pg_database_size Result data type | bigint Argument data types | oid Type | normal Volatility | volatile Owner | postgres Language | plpgsql Source code | | DECLARE | is_current_db boolean; | BEGIN | SELECT $1 = oid | INTO is_current_db | FROM pg_catalog.pg_database | WHERE datname = current_database(); | | IF is_current_db THEN | return pg_catalog.pg_database_size($1); | END IF; | | return 0; | END | Description | ``` 要查看真实的SIZE, 建议使用超级用户查询pg_catalog.pg_database_size(oid)或者(name). 也可以将权限赋予给普通用户. ``` postgres=# \c postgres postgres grant execute on funciton pg_catalog.pg_database_size(oid) to digoal; grant execute on funciton pg_catalog.pg_database_size(name) to digoal; ``` 而且这个权限需要每个数据库赋予. ``` postgres=# \c postgres digoal You are now connected to database "postgres" as user "digoal". postgres=> select * from pg_catalog.pg_database_size('postgres'); pg_database_size ------------------ 61245920 (1 row) postgres=> select * from pg_catalog.pg_database_size('test'); pg_database_size ------------------ 0 (1 row) postgres=> \c test digoal You are now connected to database "test" as user "digoal". test=> select * from pg_catalog.pg_database_size('test'); ERROR: permission denied for function pg_database_size CONTEXT: PL/pgSQL function pg_database_size(name) line 4 at RETURN ``` test库又需要重新赋予权限才行, ``` test=> \c test postgres You are now connected to database "test" as user "postgres". test=# grant execute on function pg_catalog.pg_database_size(oid) to digoal; GRANT test=# grant execute on function pg_catalog.pg_database_size(name) to digoal; GRANT test=# \c test digoal You are now connected to database "test" as user "digoal". test=> select * from pg_catalog.pg_database_size('test'); pg_database_size ------------------ 59181536 (1 row) ``` 如果普通用户经常要查询这个的话, 建议在模板库(template0, template1)赋予权限, 以后新建的库就不需要赋予了. ## 参考 1\. src/backend/parser/parse_relation.c 2\. src/backend/parser/analyze.c #### [PostgreSQL 许愿链接](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216") 您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。[开不开森](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216"). #### [9.9元购买3个月阿里云RDS PostgreSQL实例](https://www.aliyun.com/database/postgresqlactivity "57258f76c37864c6e6d23383d05714ea") #### [PostgreSQL 解决方案集合](https://yq.aliyun.com/topic/118 "40cff096e9ed7122c512b35d8561d9c8") #### [德哥 / digoal's github - 公益是一辈子的事.](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae") ![digoal's wechat](../pic/digoal_weixin.jpg "f7ad92eeba24523fd47a6e1a0e691b59")
{ "pile_set_name": "Github" }
/***************************************************************************** * * * OpenNI 1.x Alpha * * Copyright (C) 2012 PrimeSense Ltd. * * * * This file is part of OpenNI. * * * * 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 __XN_DUMP_H__ #define __XN_DUMP_H__ //--------------------------------------------------------------------------- // Includes //--------------------------------------------------------------------------- #include "XnPlatform.h" #include "XnStatus.h" //--------------------------------------------------------------------------- // Types //--------------------------------------------------------------------------- struct XnDumpFile; typedef struct XnDumpFile XnDumpFile; //--------------------------------------------------------------------------- // Functions //--------------------------------------------------------------------------- /** * Configures if a specific dump mask is enabled. * * @param strMask [in] The mask to set. * @param bEnabled [in] TRUE to enable this dump, FALSE otherwise. */ XN_C_API XnStatus XN_C_DECL xnDumpSetMaskState(const XnChar* strMask, XnBool bEnabled); /** * This function checks if a dump mask is enabled * * @param strDumpMask [in] The mask that should be checked. */ XN_C_API XnBool XN_C_DECL xnLogIsDumpMaskEnabled(const XnChar* strDumpMask); /** * Opens a file for writing dump. * * @param strDumpName [in] Name of the dump mask this file belongs to. * @param strNameFormat [in] A format string for the name of the file. * * @returns a file handle for writing data. The file should be closed using @ref xnDumpFileClose(). */ XN_C_API XnDumpFile* XN_C_DECL xnDumpFileOpen(const XnChar* strDumpName, const XnChar* strNameFormat, ...); /** * Opens a file for writing dump using some advanced options. * * You would usually prefer to use @ref xnDumpFileOpen(). * * @param strDumpName [in] Name of the dump mask this file belongs to. * @param bForce [in] When TRUE, file will be created even if dump is currently off. * @param bSessionDump [in] When TRUE, file will be created with current session timestamp as a prefix to its name. * @param strNameFormat [in] A format string for the name of the file. * * @returns a file handle for writing data. The file should be closed using @ref xnDumpFileClose(). */ XN_C_API XnDumpFile* XN_C_DECL xnDumpFileOpenEx(const XnChar* strDumpName, XnBool bForce, XnBool bSessionDump, const XnChar* strNameFormat, ...); /** * Writes a buffer to a dump file. * * @param pFile [in] Dump file to write to. A pointer retrieved from @ref xnDumpFileOpen. * @param pBuffer [in] Data to be written to file. * @param nBufferSize [in] Size of the buffer. */ XN_C_API void XN_C_DECL _xnDumpFileWriteBuffer(XnDumpFile* pFile, const void* pBuffer, XnUInt32 nBufferSize); /** * Writes a formatted string to a dump file. * * @param pFile [in] Dump file to write to. A pointer retrieved from @ref xnDumpFileOpen. * @param strFormat [in] Format string. * * NOTE: the total length of the string must not exceed 8 KB. If it does, it will be truncated. */ XN_C_API void XN_C_DECL _xnDumpFileWriteString(XnDumpFile* pFile, const XnChar* strFormat, ...); /** * Closes a dump file. * * @param hFile [in] Dump file to close. A pointer retrieved from @ref xnDumpFileOpen. */ XN_C_API void XN_C_DECL _xnDumpFileClose(XnDumpFile* pFile); #define xnDumpFileWriteBuffer(pFile, pBuffer, nBufferSize) \ if ((pFile) != NULL) \ { \ _xnDumpFileWriteBuffer(pFile, pBuffer, nBufferSize); \ } \ #define xnDumpFileClose(pFile) \ if ((pFile) != NULL) \ { \ _xnDumpFileClose(pFile); \ pFile = NULL; \ } \ #if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE #define xnDumpFileWriteString(pFile, strFormat, ...) \ if ((pFile) != NULL) \ { \ _xnDumpFileWriteString(pFile, strFormat, __VA_ARGS__); \ } #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE #define xnDumpFileWriteString(pFile, strFormat, ...) \ if ((pFile) != NULL) \ { \ _xnDumpFileWriteString(pFile, strFormat, ##__VA_ARGS__);\ } #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE #define xnDumpFileWriteString(pFile, strFormat, ...) \ if ((pFile) != NULL) \ { \ _xnDumpFileWriteString(pFile, strFormat); \ } #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS #define xnDumpFileWriteString(pFile, strFormat, arg) \ if ((pFile) != NULL) \ { \ _xnDumpFileWriteString(pFile, strFormat,arg); \ } #else #error Xiron Log - Unknown VAARGS type! #endif //--------------------------------------------------------------------------- // Backwards Compatibility Stuff //--------------------------------------------------------------------------- #ifndef __XN_NO_BC__ #include "XnOS.h" typedef struct XnDump { XN_FILE_HANDLE hFile; } XnDump; const XnDump XN_DUMP_CLOSED = { XN_INVALID_FILE_HANDLE }; XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpInit(XnDump* pDump, const XnChar* csDumpMask, const XnChar* csHeader, const XnChar* csFileNameFormat, ...); XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpForceInit(XnDump* pDump, const XnChar* csHeader, const XnChar* csFileNameFormat, ...); XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpClose(XnDump* pDump); XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpWriteBufferImpl(XnDump dump, const void* pBuffer, XnUInt32 nBufferSize); XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpWriteStringImpl(XnDump dump, const XnChar* csFormat, ...); XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpFlush(XnDump dump); #define xnDumpWriteBuffer(dump, pBuffer, nBufferSize) \ if (dump.hFile != XN_INVALID_FILE_HANDLE) \ { \ xnDumpWriteBufferImpl(dump, pBuffer, nBufferSize); \ } #if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE #define xnDumpWriteString(dump, csFormat, ...) \ if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \ xnDumpWriteStringImpl((dump), csFormat, __VA_ARGS__); \ } #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE #define xnDumpWriteString(dump, csFormat, ...) \ if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \ xnDumpWriteStringImpl((dump), csFormat, ##__VA_ARGS__); \ } #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE #define xnDumpWriteString(dump, csFormat...) \ if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \ xnDumpWriteStringImpl((dump), csFormat); \ } #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS #define xnDumpWriteString(dump, csFormat, arg) \ if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \ xnDumpWriteStringImpl((dump), csFormat, arg); \ } #else #error Xiron Log - Unknown VAARGS type! #endif #endif // #ifndef __XN_NO_BC__ #endif // __XN_DUMP_H__
{ "pile_set_name": "Github" }
File: noAmbiguityMemberVsExtension.kt - d6944906c9be28dea6eefde2bf9ed229 NL("\n") NL("\n") packageHeader importList importHeader IMPORT("import") identifier simpleIdentifier Identifier("kotlin") DOT(".") simpleIdentifier Identifier("reflect") DOT(".") simpleIdentifier Identifier("KFunction1") semi NL("\n") NL("\n") topLevelObject declaration classDeclaration CLASS("class") simpleIdentifier Identifier("A") classBody LCURL("{") NL("\n") classMemberDeclarations classMemberDeclaration declaration functionDeclaration FUN("fun") simpleIdentifier Identifier("foo") functionValueParameters LPAREN("(") RPAREN(")") functionBody ASSIGNMENT("=") expression disjunction conjunction equality comparison genericCallLikeComparison infixOperation elvisExpression infixFunctionCall rangeExpression additiveExpression multiplicativeExpression asExpression prefixUnaryExpression postfixUnaryExpression primaryExpression literalConstant IntegerLiteral("42") semis NL("\n") RCURL("}") semis NL("\n") NL("\n") topLevelObject declaration functionDeclaration FUN("fun") receiverType typeReference userType simpleUserType simpleIdentifier Identifier("A") DOT(".") simpleIdentifier Identifier("foo") functionValueParameters LPAREN("(") RPAREN(")") functionBody block LCURL("{") statements RCURL("}") semis NL("\n") NL("\n") topLevelObject declaration functionDeclaration FUN("fun") simpleIdentifier Identifier("main") functionValueParameters LPAREN("(") RPAREN(")") functionBody block LCURL("{") NL("\n") statements statement declaration propertyDeclaration VAL("val") variableDeclaration simpleIdentifier Identifier("x") ASSIGNMENT("=") expression disjunction conjunction equality comparison genericCallLikeComparison infixOperation elvisExpression infixFunctionCall rangeExpression additiveExpression multiplicativeExpression asExpression prefixUnaryExpression postfixUnaryExpression primaryExpression callableReference receiverType typeReference userType simpleUserType simpleIdentifier Identifier("A") COLONCOLON("::") simpleIdentifier Identifier("foo") NL("\n") semis NL("\n") statement expression disjunction conjunction equality comparison genericCallLikeComparison infixOperation elvisExpression infixFunctionCall rangeExpression additiveExpression multiplicativeExpression asExpression prefixUnaryExpression postfixUnaryExpression primaryExpression simpleIdentifier Identifier("checkSubtype") callSuffix typeArguments LANGLE("<") typeProjection type typeReference userType simpleUserType simpleIdentifier Identifier("KFunction1") typeArguments LANGLE("<") typeProjection type typeReference userType simpleUserType simpleIdentifier Identifier("A") COMMA(",") typeProjection type typeReference userType simpleUserType simpleIdentifier Identifier("Int") RANGLE(">") RANGLE(">") valueArguments LPAREN("(") valueArgument expression disjunction conjunction equality comparison genericCallLikeComparison infixOperation elvisExpression infixFunctionCall rangeExpression additiveExpression multiplicativeExpression asExpression prefixUnaryExpression postfixUnaryExpression primaryExpression simpleIdentifier Identifier("x") RPAREN(")") semis NL("\n") RCURL("}") semis NL("\n") EOF("<EOF>")
{ "pile_set_name": "Github" }
class Kumogata::Utils class << self def camelize(str) str.to_s.split(/[-_]/).map {|i| i[0, 1].upcase + i[1..-1].downcase }.join end def get_user_host user = `whoami`.strip rescue '' host = `hostname`.strip rescue '' user_host = [user, host].select {|i| not i.empty? }.join('-') user_host.empty? ? nil : user_host end def random_param_name(n) a_zA_Z0_9 = (('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a) a_zA_Z0_9.sample(n).join end def filter_backtrace(backtrace) filter_path = ['(eval)'] if defined?(Gem) filter_path.concat(Gem.path) filter_path << Gem.bindir end RbConfig::CONFIG.select {|k, v| k.to_s =~ /libdir/ }.each {|k, v| filter_path << v } filter_path = filter_path.map {|i| /\A#{Regexp.escape(i)}/ } backtrace.select do |path| path = path.split(':', 2).first not filter_path.any? {|i| i =~ path } end end def stringify(obj) case obj when Array obj.map {|i| stringify(i) } when Hash hash = {} obj.each {|k, v| hash[stringify(k)] = stringify(v) } hash else obj.to_s end end end # of class methods end module Kumogata ENCRYPTION_PASSWORD = Kumogata::Utils.random_param_name(16) end
{ "pile_set_name": "Github" }
module github.com/jackc/pgio go 1.12
{ "pile_set_name": "Github" }
package(default_visibility = ["//visibility:public"]) load( "@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", ) go_test( name = "go_default_test", srcs = [ "expiring_test.go", "lruexpirecache_test.go", ], embed = [":go_default_library"], deps = [ "//staging/src/k8s.io/apimachinery/pkg/util/clock:go_default_library", "//vendor/github.com/golang/groupcache/lru:go_default_library", "//vendor/github.com/google/uuid:go_default_library", ], ) go_library( name = "go_default_library", srcs = [ "expiring.go", "lruexpirecache.go", ], importmap = "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/cache", importpath = "k8s.io/apimachinery/pkg/util/cache", deps = [ "//staging/src/k8s.io/apimachinery/pkg/util/clock:go_default_library", "//vendor/github.com/hashicorp/golang-lru:go_default_library", ], ) filegroup( name = "package-srcs", srcs = glob(["**"]), tags = ["automanaged"], visibility = ["//visibility:private"], ) filegroup( name = "all-srcs", srcs = [":package-srcs"], tags = ["automanaged"], )
{ "pile_set_name": "Github" }
#include "Python.h" #include <list> #include <boost/process.hpp> #include <boost/optional.hpp> #include "connection/Config.h" #include "log.h" namespace Gadgetron::Server::Connection::Stream { boost::process::child start_python_module(const Config::Execute &execute, unsigned short port, const Gadgetron::Core::Context &context) { auto python_path = (context.paths.gadgetron_home / "share" / "gadgetron" / "python").string(); std::list<std::string> args{ "-m", "gadgetron", std::to_string(port), execute.name }; if(execute.target) args.push_back(execute.target.value()); boost::process::child module( boost::process::search_path("python3"), boost::process::args=args, boost::process::env["PYTHONPATH"]+={python_path} ); GINFO_STREAM("Started external Python module (pid: " << module.id() << ")."); return std::move(module); } bool python_available() noexcept { try { return !boost::process::system( boost::process::search_path("python3"), boost::process::args={"-m", "gadgetron"}, boost::process::std_out > boost::process::null, boost::process::std_err > boost::process::null ); } catch (...) { return false; } } }
{ "pile_set_name": "Github" }
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.ui.codereview.timeline import com.intellij.openapi.editor.EditorFactory import com.intellij.openapi.editor.EditorKind import com.intellij.openapi.editor.ex.EditorEx import com.intellij.openapi.project.Project import com.intellij.util.ui.JBUI import javax.swing.JComponent class TimelineDiffComponentFactory(private val project: Project, private val editorFactory: EditorFactory) { fun createDiffComponent(text: CharSequence, modifyEditor: (EditorEx) -> Unit): JComponent = EditorHandlerPanel.create(editorFactory) { factory -> val editor = createSimpleDiffEditor(project, factory, text) modifyEditor(editor) editor } private fun createSimpleDiffEditor(project: Project, editorFactory: EditorFactory, text: CharSequence): EditorEx { return (editorFactory.createViewer(editorFactory.createDocument(text), project, EditorKind.DIFF) as EditorEx).apply { gutterComponentEx.setPaintBackground(false) setHorizontalScrollbarVisible(true) setVerticalScrollbarVisible(false) setCaretEnabled(false) setBorder(JBUI.Borders.empty()) settings.apply { isCaretRowShown = false additionalLinesCount = 0 additionalColumnsCount = 0 isRightMarginShown = false setRightMargin(-1) isFoldingOutlineShown = false isIndentGuidesShown = false isVirtualSpace = false isWheelFontChangeEnabled = false isAdditionalPageAtBottom = false lineCursorWidth = 1 } } } }
{ "pile_set_name": "Github" }
if bitrate == 24 then if stereo then ignore(output_stereo(%aac(bitrate = 24, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 24, channels = 1), mean(!source))) end elsif bitrate == 32 then if stereo then ignore(output_stereo(%aac(bitrate = 32, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 32, channels = 1), mean(!source))) end elsif bitrate == 48 then if stereo then ignore(output_stereo(%aac(bitrate = 48, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 48, channels = 1), mean(!source))) end elsif bitrate == 64 then if stereo then ignore(output_stereo(%aac(bitrate = 64, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 64, channels = 1), mean(!source))) end elsif bitrate == 96 then if stereo then ignore(output_stereo(%aac(bitrate = 96, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 96, channels = 1), mean(!source))) end elsif bitrate == 128 then if stereo then ignore(output_stereo(%aac(bitrate = 128, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 128, channels = 1), mean(!source))) end elsif bitrate == 160 then if stereo then ignore(output_stereo(%aac(bitrate = 160, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 160, channels = 1), mean(!source))) end elsif bitrate == 192 then if stereo then ignore(output_stereo(%aac(bitrate = 192, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 192, channels = 1), mean(!source))) end elsif bitrate == 224 then if stereo then ignore(output_stereo(%aac(bitrate = 224, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 224, channels = 1), mean(!source))) end elsif bitrate == 256 then if stereo then ignore(output_stereo(%aac(bitrate = 256, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 256, channels = 1), mean(!source))) end elsif bitrate == 320 then if stereo then ignore(output_stereo(%aac(bitrate = 320, channels = 2), !source)) else ignore(output_mono(%aac(bitrate = 320, channels = 1), mean(!source))) end end
{ "pile_set_name": "Github" }
// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 50; objects = { /* Begin PBXBuildFile section */ 815EC4AA24CB6B4900ADA502 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 815EC4A924CB6B4900ADA502 /* AppDelegate.swift */; }; 815EC4AC24CB6B4900ADA502 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 815EC4AB24CB6B4900ADA502 /* SceneDelegate.swift */; }; 815EC4AE24CB6B4900ADA502 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 815EC4AD24CB6B4900ADA502 /* ViewController.swift */; }; 815EC4B124CB6B4900ADA502 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 815EC4AF24CB6B4900ADA502 /* Main.storyboard */; }; 815EC4B324CB6B4C00ADA502 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 815EC4B224CB6B4C00ADA502 /* Assets.xcassets */; }; 815EC4B624CB6B4C00ADA502 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 815EC4B424CB6B4C00ADA502 /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 815EC4A624CB6B4900ADA502 /* SearchControllerMinimal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SearchControllerMinimal.app; sourceTree = BUILT_PRODUCTS_DIR; }; 815EC4A924CB6B4900ADA502 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 815EC4AB24CB6B4900ADA502 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; 815EC4AD24CB6B4900ADA502 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; 815EC4B024CB6B4900ADA502 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; 815EC4B224CB6B4C00ADA502 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 815EC4B524CB6B4C00ADA502 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 815EC4B724CB6B4C00ADA502 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 815EC4A324CB6B4900ADA502 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 815EC49D24CB6B4900ADA502 = { isa = PBXGroup; children = ( 815EC4A824CB6B4900ADA502 /* SearchControllerMinimal */, 815EC4A724CB6B4900ADA502 /* Products */, ); sourceTree = "<group>"; }; 815EC4A724CB6B4900ADA502 /* Products */ = { isa = PBXGroup; children = ( 815EC4A624CB6B4900ADA502 /* SearchControllerMinimal.app */, ); name = Products; sourceTree = "<group>"; }; 815EC4A824CB6B4900ADA502 /* SearchControllerMinimal */ = { isa = PBXGroup; children = ( 815EC4A924CB6B4900ADA502 /* AppDelegate.swift */, 815EC4AB24CB6B4900ADA502 /* SceneDelegate.swift */, 815EC4AD24CB6B4900ADA502 /* ViewController.swift */, 815EC4AF24CB6B4900ADA502 /* Main.storyboard */, 815EC4B224CB6B4C00ADA502 /* Assets.xcassets */, 815EC4B424CB6B4C00ADA502 /* LaunchScreen.storyboard */, 815EC4B724CB6B4C00ADA502 /* Info.plist */, ); path = SearchControllerMinimal; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 815EC4A524CB6B4900ADA502 /* SearchControllerMinimal */ = { isa = PBXNativeTarget; buildConfigurationList = 815EC4BA24CB6B4C00ADA502 /* Build configuration list for PBXNativeTarget "SearchControllerMinimal" */; buildPhases = ( 815EC4A224CB6B4900ADA502 /* Sources */, 815EC4A324CB6B4900ADA502 /* Frameworks */, 815EC4A424CB6B4900ADA502 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = SearchControllerMinimal; productName = SearchControllerMinimal; productReference = 815EC4A624CB6B4900ADA502 /* SearchControllerMinimal.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 815EC49E24CB6B4900ADA502 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1200; LastUpgradeCheck = 1200; TargetAttributes = { 815EC4A524CB6B4900ADA502 = { CreatedOnToolsVersion = 12.0; }; }; }; buildConfigurationList = 815EC4A124CB6B4900ADA502 /* Build configuration list for PBXProject "SearchControllerMinimal" */; compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 815EC49D24CB6B4900ADA502; productRefGroup = 815EC4A724CB6B4900ADA502 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 815EC4A524CB6B4900ADA502 /* SearchControllerMinimal */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 815EC4A424CB6B4900ADA502 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 815EC4B624CB6B4C00ADA502 /* LaunchScreen.storyboard in Resources */, 815EC4B324CB6B4C00ADA502 /* Assets.xcassets in Resources */, 815EC4B124CB6B4900ADA502 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 815EC4A224CB6B4900ADA502 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 815EC4AE24CB6B4900ADA502 /* ViewController.swift in Sources */, 815EC4AA24CB6B4900ADA502 /* AppDelegate.swift in Sources */, 815EC4AC24CB6B4900ADA502 /* SceneDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 815EC4AF24CB6B4900ADA502 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( 815EC4B024CB6B4900ADA502 /* Base */, ); name = Main.storyboard; sourceTree = "<group>"; }; 815EC4B424CB6B4C00ADA502 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( 815EC4B524CB6B4C00ADA502 /* Base */, ); name = LaunchScreen.storyboard; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 815EC4B824CB6B4C00ADA502 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 14.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; 815EC4B924CB6B4C00ADA502 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 14.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; }; name = Release; }; 815EC4BB24CB6B4C00ADA502 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = W3LHX5RGV2; INFOPLIST_FILE = SearchControllerMinimal/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = com.neuburg.matt.SearchControllerMinimal; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; 815EC4BC24CB6B4C00ADA502 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = W3LHX5RGV2; INFOPLIST_FILE = SearchControllerMinimal/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = com.neuburg.matt.SearchControllerMinimal; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 815EC4A124CB6B4900ADA502 /* Build configuration list for PBXProject "SearchControllerMinimal" */ = { isa = XCConfigurationList; buildConfigurations = ( 815EC4B824CB6B4C00ADA502 /* Debug */, 815EC4B924CB6B4C00ADA502 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 815EC4BA24CB6B4C00ADA502 /* Build configuration list for PBXNativeTarget "SearchControllerMinimal" */ = { isa = XCConfigurationList; buildConfigurations = ( 815EC4BB24CB6B4C00ADA502 /* Debug */, 815EC4BC24CB6B4C00ADA502 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 815EC49E24CB6B4900ADA502 /* Project object */; }
{ "pile_set_name": "Github" }
import { SageMakerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../SageMakerClient"; import { DescribeModelInput, DescribeModelOutput } from "../models/models_1"; import { deserializeAws_json1_1DescribeModelCommand, serializeAws_json1_1DescribeModelCommand, } from "../protocols/Aws_json1_1"; import { getSerdePlugin } from "@aws-sdk/middleware-serde"; import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http"; import { Command as $Command } from "@aws-sdk/smithy-client"; import { FinalizeHandlerArguments, Handler, HandlerExecutionContext, MiddlewareStack, HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; export type DescribeModelCommandInput = DescribeModelInput; export type DescribeModelCommandOutput = DescribeModelOutput & __MetadataBearer; export class DescribeModelCommand extends $Command< DescribeModelCommandInput, DescribeModelCommandOutput, SageMakerClientResolvedConfig > { // Start section: command_properties // End section: command_properties constructor(readonly input: DescribeModelCommandInput) { // Start section: command_constructor super(); // End section: command_constructor } resolveMiddleware( clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: SageMakerClientResolvedConfig, options?: __HttpHandlerOptions ): Handler<DescribeModelCommandInput, DescribeModelCommandOutput> { this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); const stack = clientStack.concat(this.middlewareStack); const { logger } = configuration; const handlerExecutionContext: HandlerExecutionContext = { logger, inputFilterSensitiveLog: DescribeModelInput.filterSensitiveLog, outputFilterSensitiveLog: DescribeModelOutput.filterSensitiveLog, }; const { requestHandler } = configuration; return stack.resolve( (request: FinalizeHandlerArguments<any>) => requestHandler.handle(request.request as __HttpRequest, options || {}), handlerExecutionContext ); } private serialize(input: DescribeModelCommandInput, context: __SerdeContext): Promise<__HttpRequest> { return serializeAws_json1_1DescribeModelCommand(input, context); } private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DescribeModelCommandOutput> { return deserializeAws_json1_1DescribeModelCommand(output, context); } // Start section: command_body_extra // End section: command_body_extra }
{ "pile_set_name": "Github" }
/* * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * * Copyright (c) 2002-2017 Eric Lafortune @ GuardSquare * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package proguard.classfile.attribute.preverification; import proguard.classfile.*; import proguard.classfile.attribute.CodeAttribute; import proguard.classfile.attribute.preverification.visitor.VerificationTypeVisitor; /** * This VerificationType represents a Uninitialized type. * * @author Eric Lafortune */ public class UninitializedType extends VerificationType { public int u2newInstructionOffset; /** * Creates an uninitialized UninitializedType. */ public UninitializedType() { } /** * Creates an UninitializedType pointing to the given 'new' instruction. */ public UninitializedType(int u2newInstructionOffset) { this.u2newInstructionOffset = u2newInstructionOffset; } // Implementations for VerificationType. public int getTag() { return UNINITIALIZED_TYPE; } public void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int instructionOffset, VerificationTypeVisitor verificationTypeVisitor) { verificationTypeVisitor.visitUninitializedType(clazz, method, codeAttribute, instructionOffset, this); } public void stackAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, int instructionOffset, int stackIndex, VerificationTypeVisitor verificationTypeVisitor) { verificationTypeVisitor.visitStackUninitializedType(clazz, method, codeAttribute, instructionOffset, stackIndex, this); } public void variablesAccept(Clazz clazz, Method method, CodeAttribute codeAttribute, int instructionOffset, int variableIndex, VerificationTypeVisitor verificationTypeVisitor) { verificationTypeVisitor.visitVariablesUninitializedType(clazz, method, codeAttribute, instructionOffset, variableIndex, this); } // Implementations for Object. public boolean equals(Object object) { if (!super.equals(object)) { return false; } UninitializedType other = (UninitializedType)object; return this.u2newInstructionOffset == other.u2newInstructionOffset; } public int hashCode() { return super.hashCode() ^ u2newInstructionOffset; } public String toString() { return "u:" + u2newInstructionOffset; } }
{ "pile_set_name": "Github" }
var getMapData = require('./_getMapData'); /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } module.exports = mapCacheGet;
{ "pile_set_name": "Github" }
#JAVA_HOME=/usr/local/jdk1.8.0_91 #export JAVA_HOME function fatal { echo "$1" exit 1 } JAR_DIR=target/dependency which vertx &> /dev/null if [ $? = 1 ]; then fatal "Please install vertx or add the vertx bin dir to your path" fi if [ ! -d $JAR_DIR ]; then echo "Attempting to download jar dependencies for this example via mvn:" mvn clean dependency:copy-dependencies if [ $? = 1 ]; then fatal "mvn clean dependency:copy-dependencies failed" fi fi if [ $# = 0 ]; then fatal "syntax: $0 <java verticle source file>" fi export CLASSPATH="$JAR_DIR/*:." vertx run $1 -cp "$CP"
{ "pile_set_name": "Github" }
![Soundbounce](http://soundbounce.org/images/soundbounce-white-bg.png) TODO: More information about the Soundbounce server.
{ "pile_set_name": "Github" }
using System.Web; using System.Web.Mvc; namespace SenparcClass { public class FilterConfig { public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); } } }
{ "pile_set_name": "Github" }
/* -*- mode: c; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; coding: utf-8 -*- */ /************************************************************************************ ** ** ** mcHF QRP Transceiver ** ** K Atanassov - M0NKA 2014 ** ** ** **---------------------------------------------------------------------------------** ** ** ** File name: ** ** Description: ** ** Last Modified: ** ** Licence: GNU GPLv3 ** ************************************************************************************/ // Common #include <stdio.h> #include <stdlib.h> #include "uhsdr_board.h" #include "uhsdr_board_config.h" #include "ui_lcd_hy28_fonts.h" #include "ui_lcd_hy28.h" #define hspiDisplay hspi2 #define SPI_DISPLAY SPI2 #ifndef STM32H7 // FIXME: H7 Port, re-enable DMA once SPI display is working #define USE_SPI_DMA #endif #if defined(STM32F7) || defined(STM32H7) #define USE_SPI_HAL #endif #define USE_SPI_DISPLAY #define USE_DISPLAY_PAR #if !defined(USE_DISPLAY_PAR) && !defined(USE_SPI_DISPLAY) #warning Both USE_DISPLAY_PAR and USE_SPI_DISPLAY are disabled, no display driver will be available! #endif #include "spi.h" #ifdef USE_DISPLAY_PAR #ifdef UI_BRD_OVI40 #include "fmc.h" #define MEM_Init() MX_FMC_Init() #else #include "fsmc.h" #define MEM_Init() MX_FSMC_Init() #endif #define LCD_REG_RA8875 (*((volatile unsigned short *) 0x60004000)) #define LCD_RAM_RA8875 (*((volatile unsigned short *) 0x60000000)) #define LCD_REG (*((volatile unsigned short *) 0x60000000)) #if defined(UI_BRD_MCHF) #define LCD_RAM (*((volatile unsigned short *) 0x60020000)) #elif defined(UI_BRD_OVI40) #define LCD_RAM (*((volatile unsigned short *) 0x60004000)) #endif #endif #ifdef TimeDebug #define MARKER LCD_D0 #define MARKER_PIO LCD_D0_PIO #define Marker_ON MARKER_PIO->BSRR=MARKER; #define Marker_OFF MARKER_PIO->BSRR=MARKER<<16; #endif #define SPI_START (0x70) /* Start byte for SPI transfer */ #define SPI_RD (0x01) /* WR bit 1 within start */ #define SPI_WR (0x00) /* WR bit 0 within start */ #define SPI_DATA (0x02) /* RS bit 1 within start byte */ #define SPI_INDEX (0x00) /* RS bit 0 within start byte */ #define SPI_TIMEOUT 100 mchf_display_t mchf_display; extern const uhsdr_display_info_t display_infos[]; const uhsdr_display_info_t* UiLcdHy28_DisplayInfoGet(mchf_display_types_t display_type) { const uhsdr_display_info_t* retval = NULL; for (int i=DISPLAY_NUM-1; i && retval == NULL; i--) { if (display_type == display_infos[i].display_type) { retval = &display_infos[i]; } } return retval; } #ifndef BOOTLOADER_BUILD // Saved fonts extern sFONT GL_Font8x8; extern sFONT GL_Font8x12; extern sFONT GL_Font8x12_bold; extern sFONT GL_Font12x12; extern sFONT GL_Font16x24; #ifdef USE_8bit_FONT extern sFONT GL_Font16x24_8b_Square; #endif static sFONT *fontList[] = { &GL_Font8x12_bold, &GL_Font16x24, &GL_Font12x12, &GL_Font8x12, &GL_Font8x8, #ifdef USE_8bit_FONT &GL_Font16x24_8b_Square, #endif }; #else extern sFONT GL_Font8x12_bold_short; static sFONT *fontList[] = { &GL_Font8x12_bold_short, }; #endif // we can do this here since fontList is an array variable not just a pointer! static const uint8_t fontCount = sizeof(fontList)/sizeof(fontList[0]); #ifdef USE_GFX_ILI932x static const RegisterValue_t ili9320[] = { { 0xE5, 0x8000}, // Set the internal vcore voltage { REGVAL_DELAY, 0x0001}, // Start internal OSC. // Direction related { 0x01, 0x0100}, // set SS and SM bit { 0x02, 0x0700}, // set 1 line inversionc { 0x03, 0x1038}, // set GRAM write direction and BGR=1 and ORG = 1. { 0x04, 0x0000}, // Resize register { 0x08, 0x0202}, // set the back porch and front porch { 0x09, 0x0000}, // set non-display area refresh cycle ISC[3:0] { 0x0A, 0x0000}, // FMARK function { 0x0C, 0x0000}, // RGB interface setting { 0x0D, 0x0000}, // Frame marker Position { 0x0F, 0x0000}, // RGB interface polarity // Power On sequence { 0x10, 0x0000}, // SAP, BT[3:0], AP, DSTB, SLP, STB { 0x11, 0x0000}, // DC1[2:0], DC0[2:0], VC[2:0] { 0x12, 0x0000}, // VREG1OUT voltage { 0x13, 0x0000}, // VDV[4:0] for VCOM amplitude { REGVAL_DELAY, 300}, // Dis-charge capacitor power voltage (300ms) { 0x10, 0x17B0}, // SAP, BT[3:0], AP, DSTB, SLP, STB { 0x11, 0x0137}, // DC1[2:0], DC0[2:0], VC[2:0] { REGVAL_DELAY, 100}, // Delay 100 ms { 0x12, 0x0139}, // VREG1OUT voltage { REGVAL_DELAY, 100}, // Delay 100 ms { 0x13, 0x1d00}, // VDV[4:0] for VCOM amplitude { 0x29, 0x0013}, // VCM[4:0] for VCOMH { REGVAL_DELAY, 100}, // Delay 100 ms { 0x20, 0x0000}, // GRAM horizontal Address { 0x21, 0x0000}, // GRAM Vertical Address // Adjust the Gamma Curve { 0x30, 0x0007}, { 0x31, 0x0007}, { 0x32, 0x0007}, { 0x35, 0x0007}, { 0x36, 0x0007}, { 0x37, 0x0700}, { 0x38, 0x0700}, { 0x39, 0x0700}, { 0x3C, 0x0700}, { 0x3D, 0x1F00}, // Set GRAM area { 0x50, 0x0000}, // Horizontal GRAM Start Address { 0x51, 0x00EF}, // Horizontal GRAM End Address { 0x52, 0x0000}, // Vertical GRAM Start Address { 0x53, 0x013F}, // Vertical GRAM End Address // Direction related { 0x60, 0xA700}, // Gate Scan Line { 0x61, 0x0001}, // NDL,VLE, REV { 0x6A, 0x0000}, // set scrolling line // Partial Display Control { 0x80, 0x0000}, { 0x81, 0x0000}, { 0x82, 0x0000}, { 0x83, 0x0000}, { 0x84, 0x0000}, { 0x85, 0x0000}, // Panel Control { 0x90, 0x0010}, { 0x92, 0x0000}, { 0x93, 0x0003}, { 0x95, 0x0110}, { 0x97, 0x0000}, { 0x98, 0x0000}, // Set GRAM write direction { 0x03, 0x1038}, // 262K color and display ON { 0x07, 0x0173}, // delay 50 ms { REGVAL_DELAY, 50}, }; static const RegisterValueSetInfo_t ili9320_regs = { ili9320, sizeof(ili9320)/sizeof(RegisterValue_t) }; static const RegisterValue_t spdfd5408b[] = { { 0x01, 0x0000}, // (SS bit 8) - 0x0100 will flip 180 degree { 0x02, 0x0700}, // LCD Driving Waveform Contral { 0x03, 0x1038}, // Entry Mode (AM bit 3) { 0x04, 0x0000}, // Scaling Control register { 0x08, 0x0207}, // Display Control 2 { 0x09, 0x0000}, // Display Control 3 { 0x0A, 0x0000}, // Frame Cycle Control { 0x0C, 0x0000}, // External Display Interface Control 1 { 0x0D, 0x0000}, // Frame Maker Position { 0x0F, 0x0000}, // External Display Interface Control 2 { REGVAL_DELAY, 50}, { 0x07, 0x0101}, // Display Control { REGVAL_DELAY, 50}, { 0x10, 0x16B0}, // Power Control 1 { 0x11, 0x0001}, // Power Control 2 { 0x17, 0x0001}, // Power Control 3 { 0x12, 0x0138}, // Power Control 4 { 0x13, 0x0800}, // Power Control 5 { 0x29, 0x0009}, // NVM read data 2 { 0x2a, 0x0009}, // NVM read data 3 { 0xa4, 0x0000}, { 0x50, 0x0000}, { 0x51, 0x00EF}, { 0x52, 0x0000}, { 0x53, 0x013F}, { 0x60, 0x2700}, // Driver Output Control (GS bit 15) { 0x61, 0x0003}, // Driver Output Control { 0x6A, 0x0000}, // Vertical Scroll Control { 0x80, 0x0000}, // Display Position ?C Partial Display 1 { 0x81, 0x0000}, // RAM Address Start ?C Partial Display 1 { 0x82, 0x0000}, // RAM address End - Partial Display 1 { 0x83, 0x0000}, // Display Position ?C Partial Display 2 { 0x84, 0x0000}, // RAM Address Start ?C Partial Display 2 { 0x85, 0x0000}, // RAM address End ?C Partail Display2 { 0x90, 0x0013}, // Frame Cycle Control { 0x92, 0x0000}, // Panel Interface Control 2 { 0x93, 0x0003}, // Panel Interface control 3 { 0x95, 0x0110}, // Frame Cycle Control { 0x07, 0x0173}, }; static const RegisterValueSetInfo_t spdfd5408b_regs = { spdfd5408b, sizeof(spdfd5408b)/sizeof(RegisterValue_t) }; #ifdef USE_GFX_SSD1289 static const RegisterValue_t ssd1289[] = { {0x00,0x0001}, {0x03,0xA8A4}, {0x0C,0x0000}, {0x0D,0x080C}, {0x0E,0x2B00}, {0x1E,0x00B7}, {0x01,0x2B3F}, {0x02,0x0600}, {0x10,0x0000}, {0x11,0x6070}, {0x05,0x0000}, {0x06,0x0000}, {0x16,0xEF1C}, {0x17,0x0003}, {0x07,0x0233}, {0x0B,0x0000}, {0x0F,0x0000}, {0x41,0x0000}, {0x42,0x0000}, {0x48,0x0000}, {0x49,0x013F}, {0x4A,0x0000}, {0x4B,0x0000}, {0x44,0xEF00}, {0x45,0x0000}, {0x46,0x013F}, {0x30,0x0707}, {0x31,0x0204}, {0x32,0x0204}, {0x33,0x0502}, {0x34,0x0507}, {0x35,0x0204}, {0x36,0x0204}, {0x37,0x0502}, {0x3A,0x0302}, {0x3B,0x0302}, {0x23,0x0000}, {0x24,0x0000}, {0x25,0x8000}, {0x4f,0x0000}, {0x4e,0x0000}, }; static const RegisterValueSetInfo_t ssd1289_regs = { ssd1289, sizeof(ssd1289)/sizeof(RegisterValue_t) }; #endif static const RegisterValue_t ili932x[] = { // NPI: { 0xE5, 0x78F0}, // set SRAM internal timing I guess this is the relevant line for getting LCDs to work which are "out-of-specs"... { 0x01, 0x0000}, // set SS and SM bit { 0x02, 0x0700}, // set 1 line inversion { 0x03, 0x1038}, // set GRAM write direction and BGR=1 and ORG = 1 { 0x04, 0x0000}, // resize register { 0x08, 0x0207}, // set the back porch and front porch { 0x09, 0x0000}, // set non-display area refresh cycle { 0x0a, 0x0000}, // FMARK function { 0x0c, 0x0001}, // RGB interface setting // NPI: { 0x0c, 0x0000}, // RGB interface setting { 0x0d, 0x0000}, // frame marker position { 0x0f, 0x0000}, // RGB interface polarity // Power On sequence { 0x10, 0x0000}, // SAP, BT[3:0], AP, DSTB, SLP, STB { 0x11, 0x0007}, // DC1[2:0], DC0[2:0], VC[2:0] { 0x12, 0x0000}, // VREG1OUT voltage { 0x13, 0x0000}, // VDV[4:0] for VCOM amplitude // NPI: { 0x0c, 0x0001}, // RGB interface setting { REGVAL_DELAY, 200}, // delay 200 ms { 0x10, 0x1590}, // SAP, BT[3:0], AP, DSTB, SLP, STB // NPI: { 0x10, 0x1090}, // SAP, BT[3:0], AP, DSTB, SLP, STB { 0x11, 0x0227}, // set DC1[2:0], DC0[2:0], VC[2:0] { REGVAL_DELAY, 50}, // delay 50 ms { 0x12, 0x009c}, // internal reference voltage init // NPI: { 0x12, 0x001F}, { REGVAL_DELAY, 50}, // delay 50 ms { 0x13, 0x1900}, // set VDV[4:0] for VCOM amplitude // NPI: { 0x13, 0x1500}, { 0x29, 0x0023}, // VCM[5:0] for VCOMH // NPI: { 0x29, 0x0027}, // VCM[5:0] for VCOMH { 0x2b, 0x000d}, // set frame rate: changed from 0e to 0d on 03/28/2016 { REGVAL_DELAY, 50}, // delay 50 ms { 0x20, 0x0000}, // GRAM horizontal address { 0x21, 0x0000}, // GRAM vertical address // /* NPI: // ----------- Adjust the Gamma Curve ---------- { 0x30, 0x0000}, { 0x31, 0x0707}, { 0x32, 0x0307}, { 0x35, 0x0200}, { 0x36, 0x0008}, { 0x37, 0x0004}, { 0x38, 0x0000}, { 0x39, 0x0707}, { 0x3C, 0x0002}, { 0x3D, 0x1D04}, // */ { 0x50, 0x0000}, // horizontal GRAM start address { 0x51, 0x00ef}, // horizontal GRAM end address { 0x52, 0x0000}, // vertical GRAM start address { 0x53, 0x013f}, // vertical GRAM end address { 0x60, 0xa700}, // gate scan line { 0x61, 0x0001}, // NDL, VLE, REV { 0x6a, 0x0000}, // set scrolling line // partial display control { 0x80, 0x0000}, { 0x81, 0x0000}, { 0x82, 0x0000}, { 0x83, 0x0000}, { 0x84, 0x0000}, { 0x85, 0x0000}, // panel control { 0x90, 0x0010}, { 0x92, 0x0000}, // NPI: { 0x92, 0x0600}, // activate display using 262k colours { 0x07, 0x0133}, }; static const RegisterValueSetInfo_t ili932x_regs = { ili932x, sizeof(ili932x)/sizeof(RegisterValue_t) }; #endif #ifdef USE_GFX_RA8875 static const RegisterValue_t ra8875[] = { { 0x01, 0x01}, // Software reset the LCD { REGVAL_DELAY, 100}, // delay 100 ms { 0x01, 0x00}, { REGVAL_DELAY, 100}, // delay 100 ms { 0x88, 0x0a}, { REGVAL_DELAY, 100}, // delay 100 ms { 0x89, 0x02}, { REGVAL_DELAY, 100}, // delay 100 ms { 0x10, 0x0F}, // 65K 16 bit 8080 mpu interface { 0x04, 0x80}, // 00b: PCLK period = System Clock period. { REGVAL_DELAY, 100}, // delay 100 ms //Horizontal set { 0x14, 0x63}, //Horizontal display width(pixels) = (HDWR + 1)*8 { 0x15, 0x00}, //Horizontal Non-Display Period Fine Tuning(HNDFT) [3:0] { 0x16, 0x03}, //Horizontal Non-Display Period (pixels) = (HNDR + 1)*8 { 0x17, 0x03}, //HSYNC Start Position(PCLK) = (HSTR + 1)*8 { 0x18, 0x0B}, //HSYNC Width [4:0] HSYNC Pulse width(PCLK) = (HPWR + 1)*8 //Vertical set { 0x19, 0xdf}, //Vertical pixels = VDHR + 1 { 0x1a, 0x01}, //Vertical pixels = VDHR + 1 { 0x1b, 0x20}, //Vertical Non-Display area = (VNDR + 1) { 0x1c, 0x00}, //Vertical Non-Display area = (VNDR + 1) { 0x1d, 0x16}, //VSYNC Start Position(PCLK) = (VSTR + 1) { 0x1e, 0x00}, //VSYNC Start Position(PCLK) = (VSTR + 1) { 0x1f, 0x01}, //VSYNC Pulse Width(PCLK) = (VPWR + 1) // setting active window 0,799,0,479 { 0x30, 0x00}, { 0x31, 0x00}, { 0x34, 0x1f}, { 0x35, 0x03}, { 0x32, 0x00}, { 0x33, 0x00}, { 0x36, 0xDF}, { 0x37, 0x01}, { 0x8a, 0x80}, { 0x8a, 0x81}, //open PWM { 0x8b, 0x1f}, //Brightness parameter 0xff-0x00 { 0x01, 0x80}, //display on //UiLcdHy28_WriteReg(LCD_DPCR,0b00001111}, // rotacion 180º { 0x60, 0x00}, /* ra8875_red */ { 0x61, 0x00}, /* ra8875_green */ { 0x62, 0x00}, /* ra8875_blue */ { 0x8E, 0x80}, }; static const RegisterValueSetInfo_t ra8875_regs = { ra8875, sizeof(ra8875)/sizeof(RegisterValue_t) }; #endif #ifdef USE_GFX_ILI9486 static const RegisterValue_t ili9486[] = { { 0xB0,0}, { 0x11,0}, { REGVAL_DELAY, 250}, { 0x3A, 0x55}, // COLMOD_PIXEL_FORMAT_SET 16 bit pixel { 0xC0, 0x0f}, { REGVAL_DATA, 0x0f}, { 0xC1, 0x42}, { 0xC2, 0x22}, { 0xC5, 0x01}, { REGVAL_DATA, 0x29}, //4D { REGVAL_DATA, 0x80}, { 0xB6, 0x00}, { REGVAL_DATA, 0x02}, //42 { REGVAL_DATA, 0x3b}, { 0xB1, 0xB0}, { REGVAL_DATA, 0x11}, { 0xB4, 0x02}, { 0xE0, 0x0f}, { REGVAL_DATA, 0x1F}, { REGVAL_DATA, 0x1C}, { REGVAL_DATA, 0x0C}, { REGVAL_DATA, 0x0F}, { REGVAL_DATA, 0x08}, { REGVAL_DATA, 0x48}, { REGVAL_DATA, 0x98}, { REGVAL_DATA, 0x37}, { REGVAL_DATA, 0x0a}, { REGVAL_DATA, 0x13}, { REGVAL_DATA, 0x04}, { REGVAL_DATA, 0x11}, { REGVAL_DATA, 0x0d}, { REGVAL_DATA, 0x00}, { 0xE1, 0x0f}, { REGVAL_DATA, 0x32}, { REGVAL_DATA, 0x2e}, { REGVAL_DATA, 0x0b}, { REGVAL_DATA, 0x0d}, { REGVAL_DATA, 0x05}, { REGVAL_DATA, 0x47}, { REGVAL_DATA, 0x75}, { REGVAL_DATA, 0x37}, { REGVAL_DATA, 0x06}, { REGVAL_DATA, 0x10}, { REGVAL_DATA, 0x03}, { REGVAL_DATA, 0x24}, { REGVAL_DATA, 0x20}, { REGVAL_DATA, 0x00}, { 0xE2, 0x0f}, { REGVAL_DATA, 0x32}, { REGVAL_DATA, 0x2e}, { REGVAL_DATA, 0x0b}, { REGVAL_DATA, 0x0d}, { REGVAL_DATA, 0x05}, { REGVAL_DATA, 0x47}, { REGVAL_DATA, 0x75}, { REGVAL_DATA, 0x37}, { REGVAL_DATA, 0x06}, { REGVAL_DATA, 0x10}, { REGVAL_DATA, 0x03}, { REGVAL_DATA, 0x24}, { REGVAL_DATA, 0x20}, { REGVAL_DATA, 0x00}, { 0x13, 0x00}, //normal display mode ON { 0x20, 0x00}, //display inversion off { 0x36, 0x028}, { 0x11, 0x00}, { REGVAL_DELAY, 250}, { 0x29, 0x00}, { REGVAL_DELAY, 250}, }; static const RegisterValueSetInfo_t ili9486_regs = { ili9486, sizeof(ili9486)/sizeof(RegisterValue_t) }; #endif typedef struct { uint16_t x; uint16_t width; uint16_t y; uint16_t height; } lcd_bulk_transfer_header_t; #ifdef USE_GFX_RA8875 void UiLcdHy28_RA8875_WaitReady(); void UiLcdRA8875_SetForegroundColor(uint16_t Color); void UiLcdRa8875_WriteReg_8bit(uint16_t LCD_Reg, uint8_t LCD_RegValue); void UiLcdRa8875_WriteReg_16bit(uint16_t LCD_Reg, uint16_t LCD_RegValue); #endif static void UiLcdHy28_BulkWriteColor(uint16_t Color, uint32_t len); static inline bool UiLcdHy28_SpiDisplayUsed() { bool retval = false; #ifdef USE_SPI_DISPLAY retval = mchf_display.use_spi; #endif return retval; } void UiLcdHy28_BacklightInit() { GPIO_InitTypeDef GPIO_InitStructure; // Set as output GPIO_InitStructure.Pin = LCD_BACKLIGHT; GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(LCD_BACKLIGHT_PIO, &GPIO_InitStructure); // Backlight off GPIO_ResetBits(LCD_BACKLIGHT_PIO, LCD_BACKLIGHT); } void UiLcdHy28_BacklightEnable(bool on) { if (on) { GPIO_SetBits(LCD_BACKLIGHT_PIO, LCD_BACKLIGHT); } else { GPIO_ResetBits(LCD_BACKLIGHT_PIO, LCD_BACKLIGHT); } } #ifdef STM32F4 #define SPI_PRESCALE_LCD_DEFAULT (SPI_BAUDRATEPRESCALER_4) #define SPI_PRESCALE_LCD_HIGH (SPI_BAUDRATEPRESCALER_2) #define SPI_PRESCALE_TS_DEFAULT (SPI_BAUDRATEPRESCALER_64) #endif #ifdef STM32F7 #define SPI_PRESCALE_LCD_DEFAULT (SPI_BAUDRATEPRESCALER_8) #define SPI_PRESCALE_LCD_HIGH (SPI_BAUDRATEPRESCALER_4) #define SPI_PRESCALE_TS_DEFAULT (SPI_BAUDRATEPRESCALER_128) #endif #ifdef STM32H7 #define SPI_PRESCALE_LCD_DEFAULT (SPI_BAUDRATEPRESCALER_8) #define SPI_PRESCALE_LCD_HIGH (SPI_BAUDRATEPRESCALER_4) #define SPI_PRESCALE_TS_DEFAULT (SPI_BAUDRATEPRESCALER_32) // 16 may be a little bit high for some displays but works with the 480x320 display #endif static uint32_t lcd_spi_prescaler = SPI_PRESCALE_LCD_DEFAULT; // static SPI_HandleTypeDef SPI_Handle; void UiLcdHy28_SpiInit(bool hispeed, mchf_display_types_t display_type) { lcd_spi_prescaler = hispeed?SPI_PRESCALE_LCD_HIGH:SPI_PRESCALE_LCD_DEFAULT; #ifdef USE_GFX_ILI9486 if (display_type == DISPLAY_RPI_SPI) { hspiDisplay.Init.CLKPolarity = SPI_POLARITY_LOW; hspiDisplay.Init.CLKPhase = SPI_PHASE_1EDGE; hspiDisplay.Init.NSS = SPI_NSS_SOFT; hspiDisplay.Init.BaudRatePrescaler = lcd_spi_prescaler; if (HAL_SPI_Init(&hspiDisplay) != HAL_OK) { Error_Handler(); } } #endif // Enable the SPI periph // the main init is already done earlier, we need this if we want to use our own code to access SPI __HAL_SPI_ENABLE(&hspiDisplay); } void UiLcdHy28_GpioInit(mchf_display_types_t display_type) { GPIO_InitTypeDef GPIO_InitStructure; // Common misc pins settings GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStructure.Pull = GPIO_NOPULL; if (mchf_display.lcd_cs_pio != NULL) { // Configure GPIO PIN for Chip select GPIO_InitStructure.Pin = mchf_display.lcd_cs; HAL_GPIO_Init(mchf_display.lcd_cs_pio, &GPIO_InitStructure); // Deselect : Chip Select high GPIO_SetBits(mchf_display.lcd_cs_pio, mchf_display.lcd_cs); } // Configure GPIO PIN for Reset GPIO_InitStructure.Pin = LCD_RESET; HAL_GPIO_Init(LCD_RESET_PIO, &GPIO_InitStructure); // TODO: Function Gets Display Type (!) not controller as parameter #ifdef USE_GFX_ILI9486 if (display_type == DISPLAY_RPI_SPI) { // Configure GPIO PIN for RS GPIO_InitStructure.Pin = LCD_RS; HAL_GPIO_Init(LCD_RS_PIO, &GPIO_InitStructure); } #endif #ifdef TimeDebug //Configure GPIO pin for routine time optimization (for scope probe) GPIO_InitStructure.Pin = MARKER; HAL_GPIO_Init(MARKER_PIO, &GPIO_InitStructure); #endif } DMA_HandleTypeDef DMA_Handle; static inline void UiLcdHy28_SpiDmaStop() { while (DMA1_Stream4->CR & DMA_SxCR_EN) { asm(""); } } void UiLcdHy28_SpiDmaStart(uint8_t* buffer, uint32_t size) { // do busy waiting here. This is just for testing if everything goes according to plan // if this works okay, we can let SPI DMA running while doing something else // and just check before next transfer if DMA is being done. // and finally we can move that into an interrupt, of course. if (size > 0) { UiLcdHy28_SpiDmaStop(); HAL_SPI_Transmit_DMA(&hspiDisplay,buffer,size); } } void UiLcdHy28_SpiDeInit() { // __HAL_SPI_DISABLE(&hspiDisplay); // HAL_SPI_DeInit(&hspiDisplay); GPIO_InitTypeDef GPIO_InitStructure; // Set as inputs GPIO_InitStructure.Mode = GPIO_MODE_INPUT; GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStructure.Pull = GPIO_NOPULL; if (mchf_display.lcd_cs_pio != NULL) { // Deconfigure GPIO PIN for Chip select GPIO_InitStructure.Pin = mchf_display.lcd_cs; HAL_GPIO_Init(mchf_display.lcd_cs_pio, &GPIO_InitStructure); } } inline void UiLcdHy28_SpiLcdCsDisable() { GPIO_SetBits(mchf_display.lcd_cs_pio, mchf_display.lcd_cs); } static inline void UiLcdHy28_SpiLcdCsEnable() { GPIO_ResetBits(mchf_display.lcd_cs_pio, mchf_display.lcd_cs); } #ifdef USE_DISPLAY_PAR static void UiLcdHy28_ParallelInit() { MEM_Init(); } static void UiLcdHy28_ParallelDeInit() { HAL_SRAM_DeInit(&hsram1); } #endif static void UiLcdHy28_Reset() { // Reset GPIO_SetBits(LCD_RESET_PIO, LCD_RESET); HAL_Delay(1); GPIO_ResetBits(LCD_RESET_PIO, LCD_RESET); HAL_Delay(1); GPIO_SetBits(LCD_RESET_PIO, LCD_RESET); HAL_Delay(300); } static inline void UiLcdHy28_SpiSendByte(uint8_t byte) { #ifdef USE_SPI_HAL uint8_t dummy; HAL_SPI_TransmitReceive(&hspi2, &byte, &dummy,1,SPI_TIMEOUT); #else while ((SPI_DISPLAY->SR & (SPI_FLAG_TXE)) == (uint16_t)RESET) {} SPI_DISPLAY->DR = byte; while ((SPI_DISPLAY->SR & (SPI_FLAG_RXNE)) == (uint16_t)RESET) {} byte = SPI_DISPLAY->DR; #endif } /* static inline void UiLcdHy28_SpiSendByteFast(uint8_t byte) { while ((SPI_DISPLAY->SR & (SPI_FLAG_TXE)) == (uint16_t)RESET) {} SPI_DISPLAY->DR = byte; while ((SPI_DISPLAY->SR & (SPI_FLAG_RXNE)) == (uint16_t)RESET) {} byte = SPI_DISPLAY->DR; }*/ uint8_t spi_dr_dummy; // used to make sure that DR is being read static inline void UiLcdHy28_SpiFinishTransfer() { #ifdef STM32H7 #ifndef USE_SPI_HAL // we cannot use this with HAL, the "normal" HAL Transmit does check the flags AND resets them (ARGH) while (__HAL_SPI_GET_FLAG(&hspiDisplay, SPI_SR_EOT) == 0 || __HAL_SPI_GET_FLAG(&hspiDisplay, SPI_SR_EOT) == 0 ) { asm("nop"); } while (__HAL_SPI_GET_FLAG(&hspiDisplay, SPI_FLAG_RXWNE) != 0 || __HAL_SPI_GET_FLAG(&hspiDisplay, SPI_SR_RXPLVL) != 0 ) { spi_dr_dummy = SPI_DISPLAY->RXDR; } #endif #else while ((SPI_DISPLAY->SR & (SPI_FLAG_TXE)) == (uint16_t)RESET) {} while (SPI_DISPLAY->SR & SPI_FLAG_BSY) {} if (SPI_DISPLAY->SR & SPI_FLAG_RXNE) { spi_dr_dummy = SPI_DISPLAY->DR; } #endif } static void UiLcdHy28_LcdSpiFinishTransfer() { UiLcdHy28_SpiFinishTransfer(); GPIO_SetBits(mchf_display.lcd_cs_pio, mchf_display.lcd_cs); } uint8_t UiLcdHy28_SpiReadByte() { uint8_t dummy = 0; uint8_t retval = 0; /* Send a Transmit a dummy byte and Receive Byte through the SPI peripheral */ HAL_SPI_TransmitReceive(&hspi2, &dummy,&retval,1,SPI_TIMEOUT); return retval; } uint8_t UiLcdHy28_SpiReadByteFast() { uint8_t retval = 0; #ifdef USE_SPI_HAL uint8_t dummy = 0; HAL_SPI_TransmitReceive(&hspi2, &dummy, &retval,1,SPI_TIMEOUT); #else /* Send a Transmit a dummy byte and Receive Byte through the SPI peripheral */ while ((SPI_DISPLAY->SR & (SPI_FLAG_TXE)) == (uint16_t)RESET) {} SPI_DISPLAY->DR = 0; while ((SPI_DISPLAY->SR & (SPI_FLAG_RXNE)) == (uint16_t)RESET) {} retval = SPI_DISPLAY->DR; #endif return retval; } // TODO: Function Per Controller Group void UiLcdHy28_WriteIndexSpi(unsigned char index) { UiLcdHy28_SpiLcdCsEnable(); mchf_display.WriteIndexSpi_Prepare(); UiLcdHy28_SpiSendByte(0); UiLcdHy28_SpiSendByte(index); UiLcdHy28_LcdSpiFinishTransfer(); } // TODO: Function Per Controller Group static inline void UiLcdHy28_WriteDataSpiStart() { UiLcdHy28_SpiLcdCsEnable(); mchf_display.WriteDataSpiStart_Prepare(); } void UiLcdHy28_WriteDataSpi( unsigned short data) { UiLcdHy28_WriteDataSpiStart(); UiLcdHy28_SpiSendByte((data >> 8)); /* Write D8..D15 */ UiLcdHy28_SpiSendByte((data & 0xFF)); /* Write D0..D7 */ UiLcdHy28_LcdSpiFinishTransfer(); } static inline void UiLcdHy28_WriteDataOnly( unsigned short data) { if(UiLcdHy28_SpiDisplayUsed()) { UiLcdHy28_SpiSendByte((data >> 8)); /* Write D8..D15 */ UiLcdHy28_SpiSendByte((data & 0xFF)); /* Write D0..D7 */ } else { #ifdef USE_DISPLAY_PAR LCD_RAM = data; __DMB(); #endif } } #ifdef USE_GFX_RA8875 static inline void UiLcdHy28_WriteDataOnlyRA8875( unsigned short data) { LCD_RAM_RA8875 = data; __DMB(); } #endif static inline void UiLcdHy28_WriteData( unsigned short data) { if(mchf_display.DeviceCode==0x8875) { LCD_RAM_RA8875 = data; __DMB(); } else if(UiLcdHy28_SpiDisplayUsed()) { UiLcdHy28_WriteDataSpiStart(); UiLcdHy28_SpiSendByte((data >> 8)); /* Write D8..D15 */ UiLcdHy28_SpiSendByte((data & 0xFF)); /* Write D0..D7 */ UiLcdHy28_LcdSpiFinishTransfer(); } else { #ifdef USE_DISPLAY_PAR LCD_RAM = data; __DMB(); #endif } } unsigned short UiLcdHy28_LcdReadDataSpi() { unsigned short value = 0; uchar y,z; UiLcdHy28_SpiLcdCsEnable(); UiLcdHy28_SpiSendByte(SPI_START | SPI_RD | SPI_DATA); /* Read: RS = 1, RW = 1 */ UiLcdHy28_SpiReadByte(); /* Dummy read 1 */ y = UiLcdHy28_SpiReadByte(); /* Read D8..D15 */ value = y; value <<= 8; z = UiLcdHy28_SpiReadByte(); /* Read D0..D7 */ value |= z; UiLcdHy28_LcdSpiFinishTransfer(); return value; } /** * @brief writes a controller register in its native width 16 bit or 8bit * width is controller dependent (RA8875 uses 8bit, all other 16bit) */ void UiLcdHy28_WriteReg(unsigned short LCD_Reg, unsigned short LCD_RegValue) { mchf_display.WriteReg(LCD_Reg,LCD_RegValue); } void UiLcdHy28_WriteReg_ILI(unsigned short LCD_Reg, unsigned short LCD_RegValue) { if(UiLcdHy28_SpiDisplayUsed()) { UiLcdHy28_WriteIndexSpi(LCD_Reg); UiLcdHy28_WriteDataSpi(LCD_RegValue); } else { #ifdef USE_DISPLAY_PAR LCD_REG = LCD_Reg; __DMB(); LCD_RAM = LCD_RegValue; __DMB(); #endif } } uint16_t UiLcdHy28_ReadReg(uint16_t LCD_Reg) { return mchf_display.ReadReg(LCD_Reg); } #ifdef USE_GFX_RA8875 void UiLcdHy28_WriteRegRA8875(unsigned short LCD_Reg, unsigned short LCD_RegValue) { UiLcdHy28_RA8875_WaitReady(); LCD_REG_RA8875 = LCD_Reg; __DMB(); LCD_RAM_RA8875 = LCD_RegValue; __DMB(); } uint16_t UiLcdHy28_ReadRegRA8875(uint16_t LCD_Reg) { uint16_t retval; // Write 16-bit Index (then Read Reg) LCD_REG_RA8875 = LCD_Reg; // Read 16-bit Reg __DMB(); retval = LCD_RAM_RA8875; return retval; } #endif unsigned short UiLcdHy28_ReadRegILI(uint16_t LCD_Reg) { uint16_t retval; if(UiLcdHy28_SpiDisplayUsed()) { // Write 16-bit Index (then Read Reg) UiLcdHy28_WriteIndexSpi(LCD_Reg); // Read 16-bit Reg retval = UiLcdHy28_LcdReadDataSpi(); } else { #ifdef USE_DISPLAY_PAR // Write 16-bit Index (then Read Reg) LCD_REG = LCD_Reg; // Read 16-bit Reg __DMB(); retval = LCD_RAM; #else retval = 0; #endif } return retval; } static void UiLcdHy28_SetCursorA( unsigned short Xpos, unsigned short Ypos ) { mchf_display.SetCursorA(Xpos, Ypos); } static void UiLcdHy28_WriteRAM_Prepare_Index(uint16_t wr_prep_reg) { if(mchf_display.DeviceCode==0x8875) { LCD_REG_RA8875 = wr_prep_reg; __DMB(); } else if(UiLcdHy28_SpiDisplayUsed()) { UiLcdHy28_WriteIndexSpi(wr_prep_reg); UiLcdHy28_WriteDataSpiStart(); } else { #ifdef USE_DISPLAY_PAR LCD_REG = wr_prep_reg; __DMB(); #endif } } static void UiLcdHy28_WriteRAM_Prepare() { mchf_display.WriteRAM_Prepare(); } static void UiLcdHy28_SetActiveWindow(uint16_t XLeft, uint16_t XRight, uint16_t YTop, uint16_t YBottom) { mchf_display.SetActiveWindow(XLeft, XRight, YTop, YBottom); } static void UiLcdHy28_BulkWrite(uint16_t* pixel, uint32_t len) { // if we are not using SPI DMA, we send the data as it comes // if we are using SPI DMA, we do this only if we are NOT using SPI #ifdef USE_SPI_DMA if(UiLcdHy28_SpiDisplayUsed() == false) #endif { #ifdef USE_GFX_RA8875 if(mchf_display.DeviceCode==0x8875) { for (uint32_t i = len; i; i--) { UiLcdHy28_WriteDataOnlyRA8875(*(pixel++)); } } else #endif { for (uint32_t i = len; i; i--) { UiLcdHy28_WriteDataOnly(*(pixel++)); } } } #ifdef USE_SPI_DMA else { for (uint32_t i = 0; i < len; i++) { pixel[i] = __REV16(pixel[i]); // reverse byte order; } UiLcdHy28_SpiDmaStart((uint8_t*)pixel,len*2); } #endif } static void UiLcdHy28_FinishWaitBulkWrite() { if(UiLcdHy28_SpiDisplayUsed()) // SPI enabled? { #ifdef USE_SPI_DMA UiLcdHy28_SpiDmaStop(); #endif UiLcdHy28_LcdSpiFinishTransfer(); } } static void UiLcdHy28_OpenBulkWrite(ushort x, ushort width, ushort y, ushort height) { UiLcdHy28_FinishWaitBulkWrite(); UiLcdHy28_SetActiveWindow(x, x + width - 1, y, y + height - 1); UiLcdHy28_SetCursorA(x, y); UiLcdHy28_WriteRAM_Prepare(); } static void UiLcdHy28_CloseBulkWrite() { #ifdef USE_GFX_RA8875 if(mchf_display.DeviceCode==0x8875) { uint16_t MAX_X=mchf_display.MAX_X; uint16_t MAX_Y=mchf_display.MAX_Y; UiLcdHy28_SetActiveWindow(0, MAX_X - 1, 0, MAX_Y - 1); UiLcdHy28_WriteReg(0x40, 0); } #endif } #define PIXELBUFFERSIZE 512 #define PIXELBUFFERCOUNT 2 static __UHSDR_DMAMEM uint16_t pixelbuffer[PIXELBUFFERCOUNT][PIXELBUFFERSIZE]; static uint16_t pixelcount = 0; static uint16_t pixelbufidx = 0; static inline void UiLcdHy28_BulkPixel_BufferInit() { pixelbufidx= (pixelbufidx+1)%PIXELBUFFERCOUNT; pixelcount = 0; } inline void UiLcdHy28_BulkPixel_BufferFlush() { UiLcdHy28_BulkWrite(pixelbuffer[pixelbufidx],pixelcount); UiLcdHy28_BulkPixel_BufferInit(); } inline void UiLcdHy28_BulkPixel_Put(uint16_t pixel) { pixelbuffer[pixelbufidx][pixelcount++] = pixel; if (pixelcount == PIXELBUFFERSIZE) { UiLcdHy28_BulkPixel_BufferFlush(); } } // TODO: Not most efficient way, we could use remaining buffer size to judge // if it will fit without flush and fill accordingly. inline void UiLcdHy28_BulkPixel_PutBuffer(uint16_t* pixel_buffer, uint32_t len) { // We bypass the buffering if in parallel mode // since as for now, it will not benefit from it. // this can be changed if someone write DMA code for the parallel // interface (memory to memory DMA) if(UiLcdHy28_SpiDisplayUsed()) // SPI enabled? { for (uint32_t idx = 0; idx < len; idx++) { UiLcdHy28_BulkPixel_Put(pixel_buffer[idx]); } } else { UiLcdHy28_BulkWrite(pixel_buffer, len); } } inline void UiLcdHy28_BulkPixel_OpenWrite(ushort x, ushort width, ushort y, ushort height) { UiLcdHy28_OpenBulkWrite(x, width,y,height); UiLcdHy28_BulkPixel_BufferInit(); } inline void UiLcdHy28_BulkPixel_CloseWrite() { UiLcdHy28_BulkPixel_BufferFlush(); UiLcdHy28_CloseBulkWrite(); } void UiLcdHy28_LcdClear(ushort Color) { uint32_t MAX_X=mchf_display.MAX_X; uint32_t MAX_Y=mchf_display.MAX_Y; UiLcdHy28_OpenBulkWrite(0,MAX_X,0,MAX_Y); #ifdef USE_SPI_DMA if(UiLcdHy28_SpiDisplayUsed()) { int idx; UiLcdHy28_BulkPixel_BufferInit(); for (idx = 0; idx < MAX_X * MAX_Y; idx++) { UiLcdHy28_BulkPixel_Put(Color); } UiLcdHy28_BulkPixel_BufferFlush(); } else #endif { UiLcdHy28_BulkWriteColor(Color,MAX_X * MAX_Y); } UiLcdHy28_CloseBulkWrite(); } #if 1 void UiLcdHy28_DrawColorPoint(uint16_t Xpos,uint16_t Ypos,uint16_t point) { mchf_display.DrawColorPoint(Xpos,Ypos,point); } void UiLcdHy28_DrawColorPoint_ILI(uint16_t Xpos,uint16_t Ypos,uint16_t point) { uint16_t MAX_X=mchf_display.MAX_X; uint16_t MAX_Y=mchf_display.MAX_Y; if( Xpos < MAX_X && Ypos < MAX_Y ) { UiLcdHy28_OpenBulkWrite(Xpos,1,Ypos,1); UiLcdHy28_WriteDataOnly(point); UiLcdHy28_CloseBulkWrite(); } } #endif void UiLcdHy28_DrawFullRect(uint16_t Xpos, uint16_t Ypos, uint16_t Height, uint16_t Width ,uint16_t color) { mchf_display.DrawFullRect(Xpos,Ypos,Height,Width,color); } void UiLcdHy28_DrawFullRect_ILI(uint16_t Xpos, uint16_t Ypos, uint16_t Height, uint16_t Width ,uint16_t color) { UiLcdHy28_OpenBulkWrite(Xpos, Width, Ypos, Height); UiLcdHy28_BulkWriteColor(color,(uint32_t)Height * (uint32_t)Width); UiLcdHy28_CloseBulkWrite(); } #ifdef USE_GFX_RA8875 void UiLcdHy28_DrawFullRect_RA8875(uint16_t Xpos, uint16_t Ypos, uint16_t Height, uint16_t Width ,uint16_t color) { UiLcdRA8875_SetForegroundColor(color); UiLcdRa8875_WriteReg_16bit(0x91, Xpos); //Horizontal start UiLcdRa8875_WriteReg_16bit(0x95, Xpos + Width-1); //Horizontal end UiLcdRa8875_WriteReg_16bit(0x93, Ypos); //Vertical start UiLcdRa8875_WriteReg_16bit(0x97, Ypos + Height-1); //Vertical end UiLcdHy28_WriteRegRA8875(0x90, 0xB0); // Fill rectangle } void UiLcdHy28_DrawColorPoint_RA8875(uint16_t Xpos,uint16_t Ypos,uint16_t point) { uint16_t MAX_X=mchf_display.MAX_X; uint16_t MAX_Y=mchf_display.MAX_Y; if( Xpos < MAX_X && Ypos < MAX_Y ) { UiLcdHy28_SetCursorA(Xpos, Ypos); UiLcdHy28_WriteRegRA8875(0x02, point); } } void UiLcdHy28_RA8875_WaitReady() { uint16_t temp; do { temp = LCD_REG_RA8875; } while ((temp & 0x80) == 0x80); } void UiLcdRa8875_WriteReg_8bit(uint16_t LCD_Reg, uint8_t LCD_RegValue) { UiLcdHy28_WriteRegRA8875(LCD_Reg, LCD_RegValue); } void UiLcdRa8875_WriteReg_16bit(uint16_t LCD_Reg, uint16_t LCD_RegValue) { UiLcdHy28_WriteRegRA8875(LCD_Reg,LCD_RegValue & 0xff); UiLcdHy28_WriteRegRA8875(LCD_Reg+1,(LCD_RegValue >> 8) & 0xff); } /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + SCROLL STUFF + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ /**************************************************************************/ /*! Sets the scroll mode. This is controlled by bits 6 and 7 of REG[52h] Layer Transparency Register0 (LTPR0) Author: The Experimentalist */ /**************************************************************************/ void UiLcdRA8875_setScrollMode(uint8_t mode) { #define RA8875_LTPR0 0x52//Layer Transparency Register 0 uint8_t temp = UiLcdHy28_ReadReg(RA8875_LTPR0); temp &= 0x3F; // Clear bits 6 and 7 to zero switch(mode){ // bit 7,6 of LTPR0 case 0: // 00b : Layer 1/2 scroll simultaneously. // Do nothing break; case 1: // 01b : Only Layer 1 scroll. temp |= 0x40; break; case 2: // 10b : Only Layer 2 scroll. temp |= 0x80; break; case 3: // 11b: Buffer scroll (using Layer 2 as scroll buffer) temp |= 0xC0; break; default: return; //do nothing } LCD_RAM=temp; __DMB(); } /**************************************************************************/ /*! Define a window for perform scroll Parameters: XL: x window start left XR: x window end right YT: y window start top YB: y window end bottom */ /**************************************************************************/ void UiLcdRA8875_setScrollWindow(int16_t XL,int16_t XR ,int16_t YT ,int16_t YB) { #define RA8875_HSSW0 0x38//Horizontal Start Point 0 of Scroll Window //#define RA8875_HSSW1 0x39//Horizontal Start Point 1 of Scroll Window #define RA8875_VSSW0 0x3A//Vertical Start Point 0 of Scroll Window //#define RA8875_VSSW1 0x3B//Vertical Start Point 1 of Scroll Window #define RA8875_HESW0 0x3C//Horizontal End Point 0 of Scroll Window //#define RA8875_HESW1 0x3D//Horizontal End Point 1 of Scroll Window #define RA8875_VESW0 0x3E//Vertical End Point 0 of Scroll Window //#define RA8875_VESW1 0x3F//Vertical End Point 1 of Scroll Window UiLcdRa8875_WriteReg_16bit(RA8875_HSSW0,XL); UiLcdRa8875_WriteReg_16bit(RA8875_HESW0,XR); UiLcdRa8875_WriteReg_16bit(RA8875_VSSW0,YT); UiLcdRa8875_WriteReg_16bit(RA8875_VESW0,YB); } /**************************************************************************/ /*! Perform the scroll */ /**************************************************************************/ void UiLcdRA8875_scroll(int16_t x,int16_t y) { #define RA8875_HOFS0 0x24//Horizontal Scroll Offset Register 0 #define RA8875_HOFS1 0x25//Horizontal Scroll Offset Register 1 #define RA8875_VOFS0 0x26//Vertical Scroll Offset Register 0 #define RA8875_VOFS1 0x27//Vertical Scroll Offset Register 1 UiLcdRa8875_WriteReg_16bit(RA8875_HOFS0,x); UiLcdRa8875_WriteReg_16bit(RA8875_VOFS0,y); } void UiLcdHy28_DrawStraightLine_RA8875(uint16_t x, uint16_t y, uint16_t Length, uint8_t Direction,uint16_t color) { /* Drawing Control Registers */ #define LCD_DCR (0x90) /* Draw Line/Circle/Square Control Register */ #define LCD_DLHSR0 (0x91) /* Draw Line/Square Horizontal Start Address Register0 */ #define LCD_DLHSR1 (0x92) /* Draw Line/Square Horizontal Start Address Register1 */ #define LCD_DLVSR0 (0x93) /* Draw Line/Square Vertical Start Address Register0 */ #define LCD_DLVSR1 (0x94) /* Draw Line/Square Vertical Start Address Register1 */ #define LCD_DLHER0 (0x95) /* Draw Line/Square Horizontal End Address Register0 */ #define LCD_DLHER1 (0x96) /* Draw Line/Square Horizontal End Address Register1 */ #define LCD_DLVER0 (0x97) /* Draw Line/Square Vertical End Address Register0 */ #define LCD_DLVER1 (0x98) /* Draw Line/Square Vertical End Address Register1 */ if(Length>0) { UiLcdRA8875_SetForegroundColor(color); uint16_t x_end, y_end; if (Direction == LCD_DIR_VERTICAL) { x_end = x; y_end = y + Length-1; } else { x_end = x + Length-1; y_end = y; } if(x_end==x && y_end==y) UiLcdHy28_DrawColorPoint_RA8875(x,y,color); else { /* Horizontal + vertical start */ UiLcdRa8875_WriteReg_16bit(LCD_DLHSR0, x); UiLcdRa8875_WriteReg_16bit(LCD_DLVSR0, y); UiLcdRa8875_WriteReg_16bit(LCD_DLHER0, x_end); UiLcdRa8875_WriteReg_16bit(LCD_DLVER0, y_end); UiLcdHy28_WriteRegRA8875(LCD_DCR, 0x80); } } } #endif void UiLcdHy28_DrawStraightLineWidth(ushort x, ushort y, ushort Length, uint16_t Width, uchar Direction,ushort color) { if(Direction == LCD_DIR_VERTICAL) { UiLcdHy28_DrawFullRect(x,y,Length,Width,color); } else { UiLcdHy28_DrawFullRect(x,y,Width,Length,color); } } void UiLcdHy28_DrawStraightLine(uint16_t x, uint16_t y, uint16_t Length, uint8_t Direction,uint16_t color) { mchf_display.DrawStraightLine(x,y,Length,Direction,color); } void UiLcdHy28_DrawStraightLine_ILI(uint16_t x, uint16_t y, uint16_t Length, uint8_t Direction,uint16_t color) { UiLcdHy28_DrawStraightLineWidth(x, y, Length, 1, Direction, color); } void UiLcdHy28_DrawStraightLineDouble(ushort x, ushort y, ushort Length, uchar Direction,ushort color) { UiLcdHy28_DrawStraightLineWidth(x, y, Length, 2, Direction, color); } void UiLcdHy28_DrawStraightLineTriple(ushort x, ushort y, ushort Length, uchar Direction,ushort color) { UiLcdHy28_DrawStraightLineWidth(x, y, Length, 3, Direction, color); } void UiLcdHy28_DrawHorizLineWithGrad(ushort x, ushort y, ushort Length,ushort gradient_start) { uint32_t i = 0,j = 0; ushort k = gradient_start; UiLcdHy28_OpenBulkWrite(x,Length,y,1); UiLcdHy28_BulkPixel_BufferInit(); for(i = 0; i < Length; i++) { UiLcdHy28_BulkPixel_Put(RGB(k,k,k)); j++; if(j == GRADIENT_STEP) { if(i < (Length/2)) k += (GRADIENT_STEP/2); else k -= (GRADIENT_STEP/2); j = 0; } } UiLcdHy28_BulkPixel_BufferFlush(); UiLcdHy28_CloseBulkWrite(); } void UiLcdHy28_DrawEmptyRect(ushort Xpos, ushort Ypos, ushort Height, ushort Width,ushort color) { UiLcdHy28_DrawStraightLine(Xpos, (Ypos), Width, LCD_DIR_HORIZONTAL,color); UiLcdHy28_DrawStraightLine(Xpos, Ypos, Height, LCD_DIR_VERTICAL,color); UiLcdHy28_DrawStraightLine((Xpos + Width), Ypos, (Height + 1), LCD_DIR_VERTICAL,color); UiLcdHy28_DrawStraightLine(Xpos, (Ypos + Height), Width, LCD_DIR_HORIZONTAL,color); } void UiLcdHy28_DrawBottomButton(ushort Xpos, ushort Ypos, ushort Height, ushort Width,ushort color) { UiLcdHy28_DrawStraightLine(Xpos, (Ypos), Width, LCD_DIR_HORIZONTAL,color); UiLcdHy28_DrawStraightLine(Xpos, Ypos, Height,LCD_DIR_VERTICAL, color); UiLcdHy28_DrawStraightLine((Xpos + Width), Ypos,Height,LCD_DIR_VERTICAL, color); } static void UiLcdHy28_BulkWriteColor(uint16_t Color, uint32_t len) { #ifdef USE_SPI_DMA if(UiLcdHy28_SpiDisplayUsed()) { int idx; UiLcdHy28_BulkPixel_BufferInit(); for (idx = 0; idx < len; idx++) { UiLcdHy28_BulkPixel_Put(Color); } UiLcdHy28_BulkPixel_BufferFlush(); } else #endif { uint32_t i = len; #ifdef USE_GFX_RA8875 if(mchf_display.DeviceCode==0x8875) { for (uint32_t i = len; i; i--) { UiLcdHy28_WriteDataOnlyRA8875(Color); } } else #endif { for (; i; i--) { UiLcdHy28_WriteDataOnly(Color); } } } } #ifdef USE_8bit_FONT static void UiLcdHy28_DrawChar_8bit(ushort x, ushort y, char symb,ushort Color, ushort bkColor,const sFONT *cf) { const uint16_t charIdx = (symb >= 0x20 && symb < cf->maxCode)? cf->offsetTable[symb - cf->firstCode] : 0xFFFF; const uint8_t Font_H = cf->Height; symbolData_t* sym_ptr = charIdx == 0xFFFF? NULL:((symbolData_t*)cf->table)+charIdx; const uint8_t Font_W = sym_ptr == NULL? cf->Width:sym_ptr->width; const uint16_t charSpacing = cf->Spacing; UiLcdHy28_BulkPixel_OpenWrite(x, Font_W+charSpacing, y, Font_H); if(sym_ptr == NULL) // NON EXISTING SYMBOL { for(int cntrY=0;cntrY < Font_H; cntrY++) { for(int cntrX=0; cntrX < Font_W; cntrX++) { UiLcdHy28_BulkPixel_Put(Color); } for(int cntrX=0; cntrX < charSpacing; cntrX++) { UiLcdHy28_BulkPixel_Put(bkColor); } } } else { //gray shaded font type const int32_t ColBG_R=(bkColor>>11)&0x1f; const int32_t ColBG_G=(bkColor>>5)&0x3f; const int32_t ColBG_B=bkColor&0x1f; const int32_t ColFG_R=((Color>>11)&0x1f) - ColBG_R; //decomposition of 16 bit color data into channels const int32_t ColFG_G=((Color>>5)&0x3f) - ColBG_G; const int32_t ColFG_B=(Color&0x1f) - ColBG_B; uint8_t *FontData=(uint8_t*)sym_ptr->data; for(uint8_t cntrY=0;cntrY<Font_H;cntrY++) { for(uint8_t cntrX=0;cntrX<Font_W;cntrX++) { uint32_t pixel; uint8_t FontD; if(cntrY<Font_H) { FontD=*FontData++; //get one point from bitmap } else { FontD=0; } if(FontD==0) { pixel=bkColor; } else { //shading the foreground colour int32_t ColFG_Ro=(ColFG_R*FontD)>>8; int32_t ColFG_Go=(ColFG_G*FontD)>>8; int32_t ColFG_Bo=(ColFG_B*FontD)>>8; ColFG_Ro+=ColBG_R; ColFG_Go+=ColBG_G; ColFG_Bo+=ColBG_B; pixel=(ColFG_Ro<<11)|(ColFG_Go<<5)|ColFG_Bo; //assembly of destination colour } UiLcdHy28_BulkPixel_Put(pixel); } // add spacing behind the character data for(int n=Font_W; n < Font_W + charSpacing ; n++) { UiLcdHy28_BulkPixel_Put(bkColor); } } } UiLcdHy28_BulkPixel_BufferFlush(); // flush all not yet transferred pixel to display. UiLcdHy28_CloseBulkWrite(); } #endif static void UiLcdHy28_DrawChar_1bit(ushort x, ushort y, char symb,ushort Color, ushort bkColor,const sFONT *cf) { uint8_t *ch = (uint8_t *)cf->table; // we get the address of the begin of the character table // we support one or two byte long character definitions // anything wider than 8 pixels uses two bytes ch+=(symb - 32) * cf->Height* ((cf->Width>8) ? 2 : 1 ); UiLcdHy28_OpenBulkWrite(x,cf->Width,y,cf->Height); UiLcdHy28_BulkPixel_BufferInit(); // we now get the pixel information line by line for(uint32_t i = 0; i < cf->Height; i++) { uint32_t line_data; // stores pixel data for a character line, left most pixel is MSB // we read the current pixel line data (1 or 2 bytes) if(cf->Width>8) { if (cf->Width <= 12) { // small fonts <= 12 pixel width have left most pixel as MSB // we have to reverse that line_data = ch[i*2+1]<<24; line_data |= ch[i*2] << 16; } else { uint32_t interim; interim = ch[i*2+1]<<8; interim |= ch[i*2]; line_data = __RBIT(interim); // rbit reverses a 32bit value bitwise } } else { // small fonts have left most pixel as MSB // we have to reverse that line_data = ch[i] << 24; // rbit reverses a 32bit value bitwise } // now go through the data pixel by pixel // and find out if it is background or foreground // then place pixel color in buffer uint32_t mask = 0x80000000U; // left most pixel aka MSB 32 bit mask for(uint32_t j = 0; j < cf->Width; mask>>=1, j++) { UiLcdHy28_BulkPixel_Put((line_data & mask) != 0 ? Color : bkColor); // we shift the mask in the for loop to the right one by one } } UiLcdHy28_BulkPixel_BufferFlush(); // flush all not yet transferred pixel to display. UiLcdHy28_CloseBulkWrite(); } void UiLcdHy28_DrawChar(ushort x, ushort y, char symb,ushort Color, ushort bkColor,const sFONT *cf) { #ifdef USE_8bit_FONT switch(cf->BitCount) { case 1: //1 bit font (basic type) #endif UiLcdHy28_DrawChar_1bit(x, y, symb, Color, bkColor, cf); #ifdef USE_8bit_FONT break; case 8: //8 bit grayscaled font UiLcdHy28_DrawChar_8bit(x, y, symb, Color, bkColor, cf); break; } #endif } const sFONT *UiLcdHy28_Font(uint8_t font) { // if we have an illegal font number, we return the first font return fontList[font < fontCount ? font : 0]; } static void UiLcdHy28_PrintTextLen(uint16_t XposStart, uint16_t YposStart, const char *str, const uint16_t len, const uint32_t clr_fg, const uint32_t clr_bg,uchar font) { uint32_t MAX_X=mchf_display.MAX_X; uint32_t MAX_Y=mchf_display.MAX_Y; const sFONT *cf = UiLcdHy28_Font(font); int8_t Xshift = cf->Width - ((cf->Width == 8 && cf->Height == 8)?1:0); // Mod the 8x8 font - the shift is too big uint16_t XposCurrent = XposStart; uint16_t YposCurrent = YposStart; if (str != NULL) { for (uint16_t idx = 0; idx < len; idx++) { uint8_t TempChar = *str++; UiLcdHy28_DrawChar(XposCurrent, YposCurrent, TempChar,clr_fg,clr_bg,cf); if(XposCurrent < (MAX_X - Xshift)) { XposCurrent += Xshift; } else if (YposCurrent < (MAX_Y - cf->Height)) { XposCurrent = XposStart; YposCurrent += cf->Height; } else { XposCurrent = XposStart; YposCurrent = XposStart; } } } } /** * @returns pointer to next end of line or next end of string character */ static const char * UiLcdHy28_StringGetLine(const char* str) { const char* retval; for (retval = str; *retval != '\0' && *retval != '\n'; retval++ ); return retval; } /** * @brief Print multi-line text. New lines start right at XposStart * @returns next unused Y line (i.e. the Y coordinate just below the last printed text line). */ uint16_t UiLcdHy28_PrintText(uint16_t XposStart, uint16_t YposStart, const char *str,const uint32_t clr_fg, const uint32_t clr_bg,uchar font) { const sFONT *cf = UiLcdHy28_Font(font); int8_t Yshift = cf->Height; uint16_t YposCurrent = YposStart; if (str != NULL) { const char* str_start = str; for (const char* str_end = UiLcdHy28_StringGetLine(str_start); str_start != str_end; str_end = UiLcdHy28_StringGetLine(str_start)) { UiLcdHy28_PrintTextLen(XposStart, YposCurrent, str_start, str_end - str_start, clr_fg, clr_bg, font); YposCurrent += Yshift; if (*str_end == '\n') { // next character after line break str_start = str_end + 1; } else { // last character in string //str_start = str_end; break; //this line was added to prevent a kind of race condition causing random newline print of characters (for example in CW decoder). It needs testing. //Feb 2018 SP9BSL } } } return YposCurrent; } uint16_t UiLcdHy28_TextHeight(uint8_t font) { const sFONT *cf = UiLcdHy28_Font(font); return cf->Height; } #if 0 /** * @returns pixel width of a given char (only used pixel!) */ uint16_t UiLcdHy28_CharWidth(const char c, uint8_t font) { const sFONT *cf = UiLcdHy28_Font(font); uint16_t retval; #ifdef USE_8bit_FONT switch(cf->BitCount) { case 1: //1 bit font (basic type) #endif retval = UiLcdHy28_CharWidth_1bit(c, cf); #ifdef USE_8bit_FONT break; case 8: //8 bit grayscaled font retval = UiLcdHy28_CharWidth_8bit(c, cf); break; } #endif return retval; } #endif /** * @returns pixelwidth of a text of given length */ static uint16_t UiLcdHy28_TextWidthLen(const char *str_start, uint16_t len, uint8_t font) { const sFONT *cf = UiLcdHy28_Font(font); int8_t char_width = (cf->Width + cf->Spacing) - ((cf->Width == 8 && cf->Height == 8)?1:0); return (str_start != NULL) ? (len * char_width) : 0; } /** * @returns pixelwidth of a text of given length or 0 for NULLPTR */ uint16_t UiLcdHy28_TextWidth(const char *str_start, uchar font) { return (str_start != NULL) ? UiLcdHy28_TextWidthLen(str_start,strlen(str_start), font) : 0; } static void UiLcdHy28_PrintTextRightLen(uint16_t Xpos, uint16_t Ypos, const char *str, uint16_t len, const uint32_t clr_fg, const uint32_t clr_bg,uint8_t font) { uint16_t Xwidth = UiLcdHy28_TextWidthLen(str, len, font); if (Xpos < Xwidth ) { Xpos = 0; // TODO: Overflow is not handled too well, just start at beginning of line and draw over the end. } else { Xpos -= Xwidth; } UiLcdHy28_PrintTextLen(Xpos, Ypos, str, len, clr_fg, clr_bg, font); } /** * @brief Print multi-line text right aligned. New lines start right at XposStart * @returns next unused Y line (i.e. the Y coordinate just below the last printed text line). */ uint16_t UiLcdHy28_PrintTextRight(uint16_t XposStart, uint16_t YposStart, const char *str,const uint32_t clr_fg, const uint32_t clr_bg,uint8_t font) { // this code is a full clone of the PrintText function, with exception of the function call to PrintTextRightLen const sFONT *cf = UiLcdHy28_Font(font); int8_t Yshift = cf->Height; uint16_t YposCurrent = YposStart; if (str != NULL) { const char* str_start = str; for (const char* str_end = UiLcdHy28_StringGetLine(str_start); str_start != str_end; str_end = UiLcdHy28_StringGetLine(str_start)) { UiLcdHy28_PrintTextRightLen(XposStart, YposCurrent, str_start, str_end - str_start, clr_fg, clr_bg, font); YposCurrent += Yshift; if (*str_end == '\n') { // next character after line break str_start = str_end + 1; } else { // last character in string str_start = str_end; } } } return YposCurrent; } static void UiLcdHy28_PrintTextCenteredLen(const uint16_t XposStart,const uint16_t YposStart,const uint16_t bbW,const char* str, uint16_t len ,uint32_t clr_fg,uint32_t clr_bg,uint8_t font) { const uint16_t bbH = UiLcdHy28_TextHeight(font); const uint16_t txtW = UiLcdHy28_TextWidthLen(str, len, font); const uint16_t bbOffset = txtW>bbW?0:((bbW - txtW)+1)/2; // we draw the part of the box not used by text. if (bbOffset) { UiLcdHy28_DrawFullRect(XposStart,YposStart,bbH,bbOffset,clr_bg); } UiLcdHy28_PrintTextLen((XposStart + bbOffset),YposStart,str, len, clr_fg,clr_bg,font); // if the text is smaller than the box, we need to draw the end part of the // box if (txtW<bbW) { UiLcdHy28_DrawFullRect(XposStart+txtW+bbOffset,YposStart,bbH,bbW-(bbOffset+txtW),clr_bg); } } /* * Print text centered inside the bounding box. Using '\n' to print multline text */ uint16_t UiLcdHy28_PrintTextCentered(const uint16_t XposStart,const uint16_t YposStart,const uint16_t bbW,const char* str,uint32_t clr_fg,uint32_t clr_bg,uint8_t font) { // this code is a full clone of the PrintText function, with exception of the function call to PrintTextCenteredLen const sFONT *cf = UiLcdHy28_Font(font); int8_t Yshift = cf->Height; uint16_t YposCurrent = YposStart; if (str != NULL) { const char* str_start = str; for (const char* str_end = UiLcdHy28_StringGetLine(str_start); str_start != str_end; str_end = UiLcdHy28_StringGetLine(str_start)) { UiLcdHy28_PrintTextCenteredLen(XposStart, YposCurrent, bbW, str_start, str_end - str_start, clr_fg, clr_bg, font); YposCurrent += Yshift; if (*str_end == '\n') { // next character after line break str_start = str_end + 1; } else { // last character in string str_start = str_end; } } } return YposCurrent; } /********************************************************************* * * Controller Specific Functions Go Here ( * These functions are used via mchf_display.func(...) * Each controller gets one single section here, guarded with USE_GFX_... * * *******************************************************************/ #ifdef USE_GFX_RA8875 static void UiLcdHy28_SetCursorA_RA8875( unsigned short Xpos, unsigned short Ypos ) { UiLcdRa8875_WriteReg_16bit(0x46, Xpos); UiLcdRa8875_WriteReg_16bit(0x48, Ypos); } static void UiLcdHy28_WriteRAM_Prepare_RA8875() { UiLcdHy28_WriteRAM_Prepare_Index(0x02); } void UiLcdRA8875_SetForegroundColor(uint16_t Color) { UiLcdRa8875_WriteReg_8bit(0x63, (uint16_t) (Color >> 11)); /* ra8875_red */ UiLcdRa8875_WriteReg_8bit(0x64, (uint16_t) (Color >> 5)); /* ra8875_green */ UiLcdRa8875_WriteReg_8bit(0x65, (uint16_t) (Color)); /* ra8875_blue */ } static void UiLcdHy28_SetActiveWindow_RA8875(uint16_t XLeft, uint16_t XRight, uint16_t YTop, uint16_t YBottom) { /* setting active window X */ UiLcdRa8875_WriteReg_16bit(0x30, XLeft); UiLcdRa8875_WriteReg_16bit(0x34, XRight); /* setting active window Y */ UiLcdRa8875_WriteReg_16bit(0x32, YTop); UiLcdRa8875_WriteReg_16bit(0x36, YBottom); } static uint16_t UiLcdHy28_ReadDisplayId_RA8875() { uint16_t retval =0; uint16_t reg_63_val=UiLcdHy28_ReadReg(0x63); uint16_t reg_64_val=UiLcdHy28_ReadReg(0x64); uint16_t reg_65_val=UiLcdHy28_ReadReg(0x65); uint16_t reg_88_val=UiLcdHy28_ReadReg(0x88); uint16_t reg_89_val=UiLcdHy28_ReadReg(0x89); if((reg_63_val==0x1f)&& (reg_64_val==0x3f)&& (reg_65_val==0x1f)&& (reg_88_val==0x07)&& (reg_89_val==0x03)) { retval=0x8875; mchf_display.reg_info = &ra8875_regs; } return retval; } #endif #ifdef USE_GFX_ILI9486 static uint16_t UiLcdHy28_ReadDisplayId_ILI9486() { uint16_t retval = 0x9486; #ifdef USE_DISPLAY_PAR // we can't read the id from SPI if it is the dumb RPi SPI if (mchf_display.use_spi == false) { retval = UiLcdHy28_ReadReg(0xd3); retval = LCD_RAM; //first dummy read retval = (LCD_RAM&0xff)<<8; retval |=LCD_RAM&0xff; } #endif switch (retval) { case 0x9486: case 0x9488: // ILI9486 - Parallel & Serial interface mchf_display.reg_info = &ili9486_regs; break; default: retval = 0; } return retval; } static inline void UiLcdHy28_WriteDataSpiStart_Prepare_ILI9486() { GPIO_SetBits(LCD_RS_PIO, LCD_RS); } void UiLcdHy28_WriteIndexSpi_Prepare_ILI9486() { GPIO_ResetBits(LCD_RS_PIO, LCD_RS); } static void UiLcdHy28_SetCursorA_ILI9486( unsigned short Xpos, unsigned short Ypos ) { } static void UiLcdHy28_WriteRAM_Prepare_ILI9486() { UiLcdHy28_WriteRAM_Prepare_Index(0x2c); } static void UiLcdHy28_SetActiveWindow_ILI9486(uint16_t XLeft, uint16_t XRight, uint16_t YTop, uint16_t YBottom) { UiLcdHy28_WriteReg(0x2a,XLeft>>8); UiLcdHy28_WriteData(XLeft&0xff); UiLcdHy28_WriteData((XRight)>>8); UiLcdHy28_WriteData((XRight)&0xff); UiLcdHy28_WriteReg(0x2b,YTop>>8); UiLcdHy28_WriteData(YTop&0xff); UiLcdHy28_WriteData((YBottom)>>8); UiLcdHy28_WriteData((YBottom)&0xff); } #endif #ifdef USE_GFX_ILI932x static uint16_t UiLcdHy28_ReadDisplayId_ILI932x() { uint16_t retval = UiLcdHy28_ReadReg(0x00); switch (retval) { case 0x9320: // HY28A - SPI interface only (ILI9320 controller) mchf_display.reg_info = &ili9320_regs; break; case 0x5408: // HY28A - Parallel interface only (SPFD5408B controller) mchf_display.reg_info = &spdfd5408b_regs; break; case 0x9325: case 0x9328: // HY28B - Parallel & Serial interface - latest model (ILI9325 & ILI9328 controller) mchf_display.reg_info = &ili932x_regs; break; default: retval = 0; } return retval; } static inline void UiLcdHy28_WriteDataSpiStart_Prepare_ILI932x() { UiLcdHy28_SpiSendByte(SPI_START | SPI_WR | SPI_DATA); /* Write : RS = 1, RW = 0 */ } void UiLcdHy28_WriteIndexSpi_Prepare_ILI932x() { UiLcdHy28_SpiSendByte(SPI_START | SPI_WR | SPI_INDEX); /* Write : RS = 0, RW = 0 */ } static void UiLcdHy28_SetCursorA_ILI932x( unsigned short Xpos, unsigned short Ypos ) { UiLcdHy28_WriteReg(0x20, Ypos ); UiLcdHy28_WriteReg(0x21, Xpos ); } static void UiLcdHy28_WriteRAM_Prepare_ILI932x() { UiLcdHy28_WriteRAM_Prepare_Index(0x22); } static void UiLcdHy28_SetActiveWindow_ILI932x(uint16_t XLeft, uint16_t XRight, uint16_t YTop, uint16_t YBottom) { UiLcdHy28_WriteReg(0x52, XLeft); // Horizontal GRAM Start Address UiLcdHy28_WriteReg(0x53, XRight); // Horizontal GRAM End Address -1 UiLcdHy28_WriteReg(0x50, YTop); // Vertical GRAM Start Address UiLcdHy28_WriteReg(0x51, YBottom); // Vertical GRAM End Address -1 } #endif static void UiLcdHy28_SendRegisters(const RegisterValueSetInfo_t* reg_info) { for (uint16_t idx = 0; idx < reg_info->size; idx++) { switch(reg_info->addr[idx].reg) { case REGVAL_DELAY: HAL_Delay(reg_info->addr[idx].val); break; case REGVAL_DATA: UiLcdHy28_WriteData(reg_info->addr[idx].val); break; default: // TODO: Decide how we handle 16 vs. 8 bit writes here // I would propose either per register setting or per register set setting UiLcdHy28_WriteReg(reg_info->addr[idx].reg, reg_info->addr[idx].val); } } } #ifdef USE_GFX_SSD1289 static uint16_t UiLcdHy28_ReadDisplayId_SSD1289() { uint16_t retval = UiLcdHy28_ReadReg(0x00); switch (retval) { case 0x8989: // HY28A - SPI interface only (ILI9320 controller) mchf_display.reg_info = &ssd1289_regs; break; default: retval = 0; } return retval; } static void UiLcdHy28_SetActiveWindow_SSD1289(uint16_t XLeft, uint16_t XRight, uint16_t YTop, uint16_t YBottom) { UiLcdHy28_WriteReg(0x44, XRight << 8 | XLeft); // Horizontal GRAM Start Address UiLcdHy28_WriteReg(0x45, YTop); // Horizontal GRAM End Address -1 UiLcdHy28_WriteReg(0x45, YTop); // Vertical GRAM Start Address UiLcdHy28_WriteReg(0x46, YBottom); // Vertical GRAM End Address -1 } static void UiLcdHy28_SetCursorA_SSD1289( unsigned short Xpos, unsigned short Ypos ) { UiLcdHy28_WriteReg(0x4e, Ypos ); UiLcdHy28_WriteReg(0x4f, Xpos ); } #endif // ATTENTION: THIS LIST NEEDS TO HAVE A SPECIFIC ORDER: // FIRST ALL DETECTABLE DISPLAYS THEN AT MOST ONE SINGLE UNDETECTABLE DISPLAY // // IF A DISPLAY DOES NOT HAVE A REAL DETECTION ROUTINE // ALL DISPLAYS BEHIND THIS ONE IN THIS LIST WILL NEVER BE TESTED! // // Please note that the CubeMX generated code for FSMC/FMC init // no multiple on/off cycles permits. Small change in fmc.c/fsmc.c fixes that // so if during a new STM controller port the second or third enabled parallel display // in the list below is not working, check if the code in these files // and see if Initialized and DeInitialized variables are BOTH (!) set accordingly. // When one is set, the other has to be cleared. // const uhsdr_display_info_t display_infos[] = { { DISPLAY_NONE, "No Display", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0 }, #ifdef USE_DISPLAY_PAR #ifdef USE_GFX_ILI9486 { DISPLAY_ILI9486_PARALLEL, "ILI9486 Para.", .ReadDisplayId = UiLcdHy28_ReadDisplayId_ILI9486, .SetActiveWindow = UiLcdHy28_SetActiveWindow_ILI9486, .SetCursorA = UiLcdHy28_SetCursorA_ILI9486, .WriteRAM_Prepare = UiLcdHy28_WriteRAM_Prepare_ILI9486, .WriteReg = UiLcdHy28_WriteReg_ILI, .ReadReg = UiLcdHy28_ReadRegILI, .DrawStraightLine = UiLcdHy28_DrawStraightLine_ILI, .DrawFullRect = UiLcdHy28_DrawFullRect_ILI, .DrawColorPoint = UiLcdHy28_DrawColorPoint_ILI, }, #endif #ifdef USE_GFX_ILI932x { DISPLAY_HY28B_PARALLEL, "HY28A/B Para.", .ReadDisplayId = UiLcdHy28_ReadDisplayId_ILI932x, .SetActiveWindow = UiLcdHy28_SetActiveWindow_ILI932x, .SetCursorA = UiLcdHy28_SetCursorA_ILI932x, .WriteRAM_Prepare = UiLcdHy28_WriteRAM_Prepare_ILI932x, .WriteReg = UiLcdHy28_WriteReg_ILI, .ReadReg = UiLcdHy28_ReadRegILI, .DrawStraightLine = UiLcdHy28_DrawStraightLine_ILI, .DrawFullRect = UiLcdHy28_DrawFullRect_ILI, .DrawColorPoint = UiLcdHy28_DrawColorPoint_ILI, }, #ifdef USE_GFX_SSD1289 { DISPLAY_HY32D_PARALLEL_SSD1289, "HY32D Para. SSD1289", .ReadDisplayId = UiLcdHy28_ReadDisplayId_SSD1289, .SetActiveWindow = UiLcdHy28_SetActiveWindow_SSD1289, .SetCursorA = UiLcdHy28_SetCursorA_SSD1289, .WriteRAM_Prepare = UiLcdHy28_WriteRAM_Prepare_ILI932x, .WriteReg = UiLcdHy28_WriteReg_ILI, .ReadReg = UiLcdHy28_ReadRegILI, .DrawStraightLine = UiLcdHy28_DrawStraightLine_ILI, .DrawFullRect = UiLcdHy28_DrawFullRect_ILI, .DrawColorPoint = UiLcdHy28_DrawColorPoint_ILI, }, #endif #endif #ifdef USE_GFX_RA8875 { DISPLAY_RA8875_PARALLEL, "RA8875 Para.", .ReadDisplayId = UiLcdHy28_ReadDisplayId_RA8875, .SetActiveWindow = UiLcdHy28_SetActiveWindow_RA8875, .SetCursorA = UiLcdHy28_SetCursorA_RA8875, .WriteRAM_Prepare = UiLcdHy28_WriteRAM_Prepare_RA8875, .WriteReg = UiLcdHy28_WriteRegRA8875, .ReadReg = UiLcdHy28_ReadRegRA8875, .DrawStraightLine = UiLcdHy28_DrawStraightLine_RA8875, .DrawFullRect = UiLcdHy28_DrawFullRect_RA8875, .DrawColorPoint = UiLcdHy28_DrawColorPoint_RA8875, }, #endif #endif #if defined(USE_SPI_DISPLAY) // we support HY28A SPI only on the UI_BRD_MCHF #if defined(USE_GFX_ILI932x) && defined(UI_BRD_MCHF) { DISPLAY_HY28A_SPI, "HY28A SPI", .ReadDisplayId = UiLcdHy28_ReadDisplayId_ILI932x, .SetActiveWindow = UiLcdHy28_SetActiveWindow_ILI932x, .SetCursorA = UiLcdHy28_SetCursorA_ILI932x, .WriteRAM_Prepare = UiLcdHy28_WriteRAM_Prepare_ILI932x, .WriteDataSpiStart_Prepare = UiLcdHy28_WriteDataSpiStart_Prepare_ILI932x, .WriteIndexSpi_Prepare = UiLcdHy28_WriteIndexSpi_Prepare_ILI932x, .WriteReg = UiLcdHy28_WriteReg_ILI, .ReadReg = UiLcdHy28_ReadRegILI, .DrawStraightLine = UiLcdHy28_DrawStraightLine_ILI, .DrawFullRect = UiLcdHy28_DrawFullRect_ILI, .DrawColorPoint = UiLcdHy28_DrawColorPoint_ILI, LCD_D11_PIO, LCD_D11, .is_spi = true, .spi_speed=false }, #endif #if defined(USE_GFX_ILI932x) { DISPLAY_HY28B_SPI, "HY28B SPI", .ReadDisplayId = UiLcdHy28_ReadDisplayId_ILI932x, .SetActiveWindow = UiLcdHy28_SetActiveWindow_ILI932x, .SetCursorA = UiLcdHy28_SetCursorA_ILI932x, .WriteRAM_Prepare = UiLcdHy28_WriteRAM_Prepare_ILI932x, .WriteDataSpiStart_Prepare = UiLcdHy28_WriteDataSpiStart_Prepare_ILI932x, .WriteIndexSpi_Prepare = UiLcdHy28_WriteIndexSpi_Prepare_ILI932x, .spi_cs_port = LCD_CSA_PIO, .spi_cs_pin = LCD_CSA, .WriteReg = UiLcdHy28_WriteReg_ILI, .ReadReg = UiLcdHy28_ReadRegILI, .DrawStraightLine = UiLcdHy28_DrawStraightLine_ILI, .DrawFullRect = UiLcdHy28_DrawFullRect_ILI, .DrawColorPoint = UiLcdHy28_DrawColorPoint_ILI, .is_spi = true, .spi_speed=false }, #endif #ifdef USE_GFX_RA8875 //currently RA8875 parallel interface supported only /* { DISPLAY_RA8875_SPI, "RA8875 SPI", .SetActiveWindow = UiLcdHy28_SetActiveWindow_RA8875, .SetCursorA = UiLcdHy28_SetCursorA_RA8875, .WriteRAM_Prepare = UiLcdHy28_WriteRAM_Prepare_RA8875, .WriteDataSpiStart_Prepare = UiLcdHy28_WriteDataSpiStart_Prepare_RA8875, .WriteIndexSpi_Prepare = UiLcdHy28_WriteIndexSpi_Prepare_RA8875, .WriteReg = UiLcdHy28_WriteRegRA8875, .ReadReg = UiLcdHy28_ReadRegRA8875, .DrawStraightLine = UiLcdHy28_DrawStraightLine_RA8875, .DrawFullRect = UiLcdHy28_DrawFullRect_RA8875, .DrawColorPoint = UiLcdHy28_DrawColorPoint_RA8875, .spi_cs_port = LCD_CSA_PIO, .spi_cs_pin = LCD_CSA, true, false },*/ #endif #if defined(USE_GFX_ILI9486) { DISPLAY_RPI_SPI, "RPi 3.5 SPI", .ReadDisplayId = UiLcdHy28_ReadDisplayId_ILI9486, .SetActiveWindow = UiLcdHy28_SetActiveWindow_ILI9486, .SetCursorA = UiLcdHy28_SetCursorA_ILI9486, .WriteRAM_Prepare = UiLcdHy28_WriteRAM_Prepare_ILI9486, .WriteDataSpiStart_Prepare = UiLcdHy28_WriteDataSpiStart_Prepare_ILI9486, .WriteIndexSpi_Prepare = UiLcdHy28_WriteIndexSpi_Prepare_ILI9486, .WriteReg = UiLcdHy28_WriteReg_ILI, .ReadReg = UiLcdHy28_ReadRegILI, .DrawStraightLine = UiLcdHy28_DrawStraightLine_ILI, .DrawFullRect = UiLcdHy28_DrawFullRect_ILI, .DrawColorPoint = UiLcdHy28_DrawColorPoint_ILI, .spi_cs_port = LCD_CSA_PIO, .spi_cs_pin = LCD_CSA, .is_spi = true, .spi_speed=true }, // RPI_SPI NEEDS TO BE LAST IN LIST!!! #endif #endif { DISPLAY_NUM, "Unknown", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0 } }; /* Controller Specific Functions End *********************************/ static uint16_t UiLcdHy28_DetectController(const uhsdr_display_info_t* disp_info_ptr) { uint16_t retval = 0; if (disp_info_ptr != NULL) { mchf_display.use_spi = disp_info_ptr->is_spi; mchf_display.lcd_cs = disp_info_ptr->spi_cs_pin; mchf_display.lcd_cs_pio = disp_info_ptr->spi_cs_port; mchf_display.SetActiveWindow = disp_info_ptr->SetActiveWindow; mchf_display.SetCursorA = disp_info_ptr->SetCursorA; mchf_display.WriteRAM_Prepare = disp_info_ptr->WriteRAM_Prepare; mchf_display.WriteDataSpiStart_Prepare = disp_info_ptr->WriteDataSpiStart_Prepare; mchf_display.WriteIndexSpi_Prepare = disp_info_ptr->WriteIndexSpi_Prepare; mchf_display.WriteReg = disp_info_ptr->WriteReg; mchf_display.ReadReg = disp_info_ptr->ReadReg; mchf_display.DrawStraightLine = disp_info_ptr->DrawStraightLine; mchf_display.DrawFullRect = disp_info_ptr->DrawFullRect; mchf_display.DrawColorPoint = disp_info_ptr->DrawColorPoint; mchf_display.reg_info = NULL; UiLcdHy28_GpioInit(disp_info_ptr->display_type); if (mchf_display.use_spi == true) { #ifdef USE_SPI_DISPLAY UiLcdHy28_SpiInit(disp_info_ptr->spi_speed, disp_info_ptr->display_type); #endif } else { #ifdef USE_DISPLAY_PAR UiLcdHy28_ParallelInit(); #endif } UiLcdHy28_Reset(); // if we have an identifier function, call it // WITHOUT function the display will never be used! if (disp_info_ptr->ReadDisplayId) { retval = disp_info_ptr->ReadDisplayId(); } // if the identification set a register data set for initialization, // we send it to the display controller if (mchf_display.reg_info != NULL) { UiLcdHy28_SendRegisters(mchf_display.reg_info); } // okay, this display was not detected, // cleanup data structures and prepare // for next try if (retval == 0) { mchf_display.SetActiveWindow = NULL; mchf_display.SetCursorA = NULL; mchf_display.WriteRAM_Prepare = NULL; mchf_display.WriteDataSpiStart_Prepare = NULL; mchf_display.WriteIndexSpi_Prepare = NULL; mchf_display.lcd_cs = 0; mchf_display.lcd_cs_pio = NULL; if (mchf_display.use_spi == true) { #ifdef USE_SPI_DISPLAY UiLcdHy28_SpiDeInit(); #endif } else { #ifdef USE_DISPLAY_PAR UiLcdHy28_ParallelDeInit(); #endif } } } return retval; } /* * brief Identifies and initializes to HY28x display family * * @param devicecode_ptr pointer to a variable to store the device code of the controller in * @returns 0 if no display detected, DISPLAY_HY28x_xxx otherwise, see header */ uint8_t UiLcdHy28_Init() { uint8_t retval = DISPLAY_NONE; mchf_display.DeviceCode = 0x0000; UiLcdHy28_BacklightInit(); for (uint16_t disp_idx = 1; retval == DISPLAY_NONE && display_infos[disp_idx].display_type != DISPLAY_NUM; disp_idx++) { mchf_display.DeviceCode = UiLcdHy28_DetectController(&display_infos[disp_idx]); if(mchf_display.DeviceCode != 0x0000) { retval = display_infos[disp_idx].display_type; } } mchf_display.display_type = retval; #ifndef BOOTLOADER_BUILD switch(mchf_display.DeviceCode) { case 0x8875: ts.Layout=&LcdLayouts[LcdLayout_800x480]; disp_resolution=RESOLUTION_800_480; break; case 0x9486: case 0x9488: ts.Layout=&LcdLayouts[LcdLayout_480x320]; disp_resolution=RESOLUTION_480_320; break; default: ts.Layout=&LcdLayouts[LcdLayout_320x240]; disp_resolution=RESOLUTION_320_240; break; } mchf_display.MAX_X=ts.Layout->Size.x; mchf_display.MAX_Y=ts.Layout->Size.y; #else switch(mchf_display.DeviceCode) { case 0x8875: mchf_display.MAX_X=800; mchf_display.MAX_Y=480; break; case 0x9486: case 0x9488: mchf_display.MAX_X=480; mchf_display.MAX_Y=320; break; default: mchf_display.MAX_X=320; mchf_display.MAX_Y=240; break; } #endif return retval; } static inline void UiLcdHy28_SetSpiPrescaler(uint32_t baudrate_prescaler) { /*---------------------------- SPIx CR1 Configuration ------------------------*/ // the baud rate register differs across the different processors #if defined(STM32H7) #define SPI_BR_REG CFG1 #elif defined(STM32F4) || defined(STM32F7) #define SPI_BR_REG CR1 #endif /* Get the SPIx SPI_BR_REG value */ uint32_t tmpreg = SPI_DISPLAY->SPI_BR_REG; tmpreg &= ~SPI_BAUDRATEPRESCALER_256; tmpreg |= baudrate_prescaler; /* Write to SPIx CR1 */ SPI_DISPLAY->SPI_BR_REG = tmpreg; } mchf_touchscreen_t mchf_touchscreen; /* * @brief Called to run the touch detection state machine, results are stored in ts structure */ void UiLcdHy28_TouchscreenDetectPress() { if (mchf_touchscreen.present) { if(!HAL_GPIO_ReadPin(TP_IRQ_PIO,TP_IRQ) && mchf_touchscreen.state != TP_DATASETS_PROCESSED) // fetch touchscreen data if not already processed UiLcdHy28_TouchscreenReadCoordinates(); if(HAL_GPIO_ReadPin(TP_IRQ_PIO,TP_IRQ) && mchf_touchscreen.state == TP_DATASETS_PROCESSED) // clear statemachine when data is processed { mchf_touchscreen.state = TP_DATASETS_NONE; mchf_touchscreen.hr_x = mchf_touchscreen.hr_y = 0x7fff; } } } /* * @brief tells you that touchscreen coordinates are ready for processing and marks them as processed * @returns true if coordinates for processing are available and have been marked as processed, false otherwise */ bool UiLcdHy28_TouchscreenHasProcessableCoordinates() { bool retval = false; UiLcdHy28_TouchscreenReadCoordinates(); if(mchf_touchscreen.state >= TP_DATASETS_VALID && mchf_touchscreen.state != TP_DATASETS_PROCESSED) //if(mchf_touchscreen.state >= TP_DATASETS_WAIT && mchf_touchscreen.state != TP_DATASETS_PROCESSED) { mchf_touchscreen.state = TP_DATASETS_NONE; // tp data processed retval = true; } return retval; } static inline void UiLcdHy28_TouchscreenStartSpiTransfer() { // we only have to care about other transfers if the SPI is // use by the display as well if (UiLcdHy28_SpiDisplayUsed()) { UiLcdHy28_FinishWaitBulkWrite(); } UiLcdHy28_SetSpiPrescaler(SPI_PRESCALE_TS_DEFAULT); GPIO_ResetBits(TP_CS_PIO, TP_CS); } static inline void UiLcdHy28_TouchscreenFinishSpiTransfer() { UiLcdHy28_SpiFinishTransfer(); GPIO_SetBits(TP_CS_PIO, TP_CS); // we only have to care about other transfers if the SPI is // use by the display as well if (UiLcdHy28_SpiDisplayUsed()) { UiLcdHy28_SetSpiPrescaler(lcd_spi_prescaler); } } /* * @brief Extracts touchscreen touch coordinates, counts how often same position is being read consecutively * @param do_translate false -> raw coordinates, true -> mapped coordinates according to calibration data */ #define XPT2046_PD_FULL 0x00 #define XPT2046_PD_REF 0x01 #define XPT2046_PD_ADC 0x02 #define XPT2046_PD_NONE 0x03 #define XPT2046_MODE_12BIT 0x00 #define XPT2046_MODE_8BIT 0x08 #define XPT2046_CH_DFR_Y 0x50 #define XPT2046_CH_DFR_X 0x10 #define XPT2046_CONV_START 0x80 #define XPT2046_COMMAND_LEN 7 static void UiLcdHy28_TouchscreenReadData(uint16_t* x_p,uint16_t* y_p) { static const uint8_t xpt2046_command[XPT2046_COMMAND_LEN] = { XPT2046_CONV_START|XPT2046_CH_DFR_X|XPT2046_MODE_12BIT|XPT2046_PD_REF, 0, XPT2046_CONV_START|XPT2046_CH_DFR_Y|XPT2046_MODE_12BIT|XPT2046_PD_REF, // the measurement for first command is here, we discard this 0, XPT2046_CONV_START|XPT2046_CH_DFR_X|XPT2046_MODE_12BIT|XPT2046_PD_FULL, // y measurement from previous command, next command turns off power 0, 0 // x measurement from previous command }; uint8_t xpt_response[XPT2046_COMMAND_LEN]; UiLcdHy28_TouchscreenStartSpiTransfer(); HAL_SPI_TransmitReceive(&hspi2, (uint8_t*)xpt2046_command, xpt_response,XPT2046_COMMAND_LEN,SPI_TIMEOUT); UiLcdHy28_TouchscreenFinishSpiTransfer(); *x_p = (xpt_response[5] << 8 | xpt_response[6]) >> 3; *y_p = (xpt_response[3] << 8 | xpt_response[4]) >> 3; } #define HIRES_TOUCH_MaxDelta 2 #define HIRES_TOUCH_MaxFocus 4 void UiLcdHy28_TouchscreenReadCoordinates() { /* statemachine stati: TP_DATASETS_NONE = no touchscreen action detected TP_DATASETS_WAIT 1 = first touchscreen press >1 = x times valid data available TP_DATASETS_PROCESSED 0xff = data was already processed by calling function */ if(mchf_touchscreen.state < TP_DATASETS_VALID) // no valid data ready or data ready to process { if(mchf_touchscreen.state > TP_DATASETS_NONE && mchf_touchscreen.state < TP_DATASETS_VALID) // first pass finished, get data { UiLcdHy28_TouchscreenReadData(&mchf_touchscreen.xraw,&mchf_touchscreen.yraw); //delta/focus algorithm for filtering the noise from touch panel data //based on LM8300/LM8500 datasheet //first calculating the delta algorithm int16_t TS_dx,TS_dy, TS_predicted_x, TS_predicted_y, NewDeltaX, NewDeltaY; TS_dx=mchf_touchscreen.xraw_m1-mchf_touchscreen.xraw_m2; TS_dy=mchf_touchscreen.yraw_m1-mchf_touchscreen.yraw_m2; TS_predicted_x=mchf_touchscreen.yraw_m1+TS_dx; TS_predicted_y=mchf_touchscreen.yraw_m1+TS_dy; NewDeltaX=TS_predicted_x-mchf_touchscreen.xraw; NewDeltaY=TS_predicted_y-mchf_touchscreen.yraw; if(NewDeltaX<0) NewDeltaX=-NewDeltaX; if(NewDeltaY<0) NewDeltaX=-NewDeltaY; if((NewDeltaX<=HIRES_TOUCH_MaxDelta) && (NewDeltaY<=HIRES_TOUCH_MaxDelta)) { //ok, the delta algorithm filtered out spikes and the bigger noise //now we perform focus algorithm NewDeltaX=mchf_touchscreen.focus_xprev-mchf_touchscreen.xraw; NewDeltaY=mchf_touchscreen.focus_yprev-mchf_touchscreen.yraw; if(NewDeltaX<0) NewDeltaX=-NewDeltaX; if(NewDeltaY<0) NewDeltaX=-NewDeltaY; if((NewDeltaX<=HIRES_TOUCH_MaxFocus) && (NewDeltaY<=HIRES_TOUCH_MaxFocus)) { mchf_touchscreen.xraw=mchf_touchscreen.focus_xprev; mchf_touchscreen.yraw=mchf_touchscreen.focus_yprev; } else { mchf_touchscreen.focus_xprev=mchf_touchscreen.xraw; mchf_touchscreen.focus_yprev=mchf_touchscreen.yraw; } mchf_touchscreen.state=TP_DATASETS_VALID; int32_t x,y; x=mchf_touchscreen.xraw; y=mchf_touchscreen.yraw; int32_t xn,yn; //transforming the coordinates by calibration coefficients calculated in touchscreen calibration //see the UiDriver_TouchscreenCalibration //xn=Ax+By+C //yn=Dx+Ey+F //all coefficients are in format 16.16 xn=mchf_touchscreen.cal[0]*x+mchf_touchscreen.cal[1]*y+mchf_touchscreen.cal[2]; yn=mchf_touchscreen.cal[3]*x+mchf_touchscreen.cal[4]*y+mchf_touchscreen.cal[5]; xn>>=16; yn>>=16; mchf_touchscreen.hr_x=(int16_t)xn; mchf_touchscreen.hr_y=(int16_t)yn; } else { mchf_touchscreen.xraw_m2=mchf_touchscreen.xraw_m1; mchf_touchscreen.yraw_m2=mchf_touchscreen.yraw_m1; mchf_touchscreen.xraw_m1=mchf_touchscreen.xraw; mchf_touchscreen.yraw_m1=mchf_touchscreen.yraw; mchf_touchscreen.state = TP_DATASETS_WAIT; } } else { mchf_touchscreen.state = TP_DATASETS_WAIT; // restart machine } } } bool UiLcdHy28_TouchscreenPresenceDetection() { bool retval = false; uint16_t x = 0xffff, y = 0xffff; UiLcdHy28_TouchscreenReadData(&x,&y); UiLcdHy28_TouchscreenReadData(&x,&y); mchf_touchscreen.state = TP_DATASETS_PROCESSED; if(x != 0xffff && y != 0xffff && x != 0 && y != 0) {// touchscreen data valid? retval = true; // yes - touchscreen present! } return retval; } void UiLcdHy28_TouchscreenInit(uint8_t mirror) { mchf_touchscreen.xraw = 0; mchf_touchscreen.yraw = 0; mchf_touchscreen.hr_x = 0x7FFF; // invalid position mchf_touchscreen.hr_y = 0x7FFF; // invalid position mchf_touchscreen.present = UiLcdHy28_TouchscreenPresenceDetection(); }
{ "pile_set_name": "Github" }
package client.net.sf.saxon.ce.expr.instruct; import client.net.sf.saxon.ce.expr.*; import client.net.sf.saxon.ce.trans.XPathException; import client.net.sf.saxon.ce.type.ItemType; import java.util.Iterator; /** * An abstract class to act as a common parent for instructions that create element nodes * and document nodes. */ public abstract class ParentNodeConstructor extends Instruction { protected Expression content; private String baseURI; /** * Create a document or element node constructor instruction */ public ParentNodeConstructor() {} /** * Set the static base URI of the instruction * @param uri the static base URI */ public void setBaseURI(String uri) { baseURI = uri; } /** * Get the static base URI of the instruction * @return the static base URI */ public String getBaseURI() { return baseURI; } /** * Set the expression that constructs the content of the element * @param content the content expression */ public void setContentExpression(Expression content) { this.content = content; adoptChildExpression(content); } /** * Get the cardinality of the sequence returned by evaluating this instruction * @return the static cardinality */ public int computeCardinality() { return StaticProperty.EXACTLY_ONE; } /** * Simplify an expression. This performs any static optimization (by rewriting the expression * as a different expression). The default implementation does nothing. * @return the simplified expression * @throws client.net.sf.saxon.ce.trans.XPathException * if an error is discovered during expression rewriting * @param visitor an expression visitor */ public Expression simplify(ExpressionVisitor visitor) throws XPathException { content = visitor.simplify(content); return this; } public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException { content = visitor.typeCheck(content, contextItemType); adoptChildExpression(content); return this; } public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException { content = visitor.optimize(content, contextItemType); if (content instanceof Block) { content = ((Block)content).mergeAdjacentTextInstructions(); } adoptChildExpression(content); return this; } /** * Handle promotion offers, that is, non-local tree rewrites. * @param offer The type of rewrite being offered * @throws client.net.sf.saxon.ce.trans.XPathException */ protected void promoteInst(PromotionOffer offer) throws XPathException { if (offer.action != PromotionOffer.UNORDERED) { content = doPromotion(content, offer); } } /** * Get the immediate sub-expressions of this expression. * @return an iterator containing the sub-expressions of this expression */ public Iterator<Expression> iterateSubExpressions() { return monoIterator(content); } /** * Replace one subexpression by a replacement subexpression * @param original the original subexpression * @param replacement the replacement subexpression * @return true if the original subexpression is found */ public boolean replaceSubExpression(Expression original, Expression replacement) { boolean found = false; if (content == original) { content = replacement; found = true; } return found; } /** * Determine whether this instruction creates new nodes. * This implementation returns true. */ public final boolean createsNewNodes() { return true; } public int getCardinality() { return StaticProperty.EXACTLY_ONE; } } // 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/. // This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0.
{ "pile_set_name": "Github" }
// this include must remain at the top of every CPP file #include "common_headers.h" #include "GenericParser2.h" #define MAX_TOKEN_SIZE 1024 static char token[MAX_TOKEN_SIZE]; static char *GetToken(char **text, bool allowLineBreaks, bool readUntilEOL = false) { char *pointer = *text; int length = 0; int c = 0; bool foundLineBreak; token[0] = 0; if (!pointer) { return token; } while(1) { foundLineBreak = false; while(1) { c = *pointer; if (c > ' ') { break; } if (!c) { *text = 0; return token; } if (c == '\n') { foundLineBreak = true; } pointer++; } if (foundLineBreak && !allowLineBreaks) { *text = pointer; return token; } c = *pointer; // skip single line comment if (c == '/' && pointer[1] == '/') { pointer += 2; while (*pointer && *pointer != '\n') { pointer++; } } // skip multi line comments else if (c == '/' && pointer[1] == '*') { pointer += 2; while (*pointer && (*pointer != '*' || pointer[1] != '/')) { pointer++; } if (*pointer) { pointer += 2; } } else { // found the start of a token break; } } if (c == '\"') { // handle a string pointer++; while (1) { c = *pointer++; if (c == '\"') { // token[length++] = c; break; } else if (!c) { break; } else if (length < MAX_TOKEN_SIZE) { token[length++] = c; } } } else if (readUntilEOL) { // absorb all characters until EOL while(c != '\n' && c != '\r') { if (c == '/' && ((*(pointer+1)) == '/' || (*(pointer+1)) == '*')) { break; } if (length < MAX_TOKEN_SIZE) { token[length++] = c; } pointer++; c = *pointer; } // remove trailing white space while(length && token[length-1] < ' ') { length--; } } else { while(c > ' ') { if (length < MAX_TOKEN_SIZE) { token[length++] = c; } pointer++; c = *pointer; } } if (token[0] == '\"') { // remove start quote length--; memmove(token, token+1, length); if (length && token[length-1] == '\"') { // remove end quote length--; } } if (length >= MAX_TOKEN_SIZE) { length = 0; } token[length] = 0; *text = (char *)pointer; return token; } CTextPool::CTextPool(int initSize) : mNext(0), mSize(initSize), mUsed(0) { #ifdef _EXE mPool = (char *)Z_Malloc(mSize, TAG_GP2); // mPool = (char *)Z_Malloc(mSize, TAG_TEXTPOOL, qtrue); #else mPool = (char *)trap_Z_Malloc(mSize, TAG_GP2); #endif } CTextPool::~CTextPool(void) { #ifdef _EXE Z_Free(mPool); #else trap_Z_Free(mPool); #endif } char *CTextPool::AllocText(char *text, bool addNULL, CTextPool **poolPtr) { int length = strlen(text) + (addNULL ? 1 : 0); if (mUsed + length + 1> mSize) { // extra 1 to put a null on the end if (poolPtr) { (*poolPtr)->SetNext(new CTextPool(mSize)); *poolPtr = (*poolPtr)->GetNext(); return (*poolPtr)->AllocText(text, addNULL); } return 0; } strcpy(mPool + mUsed, text); mUsed += length; mPool[mUsed] = 0; return mPool + mUsed - length; } void CleanTextPool(CTextPool *pool) { CTextPool *next; while(pool) { next = pool->GetNext(); delete pool; pool = next; } } CGPObject::CGPObject(const char *initName) : mName(initName), mNext(0), mInOrderNext(0), mInOrderPrevious(0) { } bool CGPObject::WriteText(CTextPool **textPool, const char *text) { if (strchr(text, ' ') || !text[0]) { (*textPool)->AllocText("\"", false, textPool); (*textPool)->AllocText((char *)text, false, textPool); (*textPool)->AllocText("\"", false, textPool); } else { (*textPool)->AllocText((char *)text, false, textPool); } return true; } CGPValue::CGPValue(const char *initName, const char *initValue) : CGPObject(initName), mList(0) { if (initValue) { AddValue(initValue); } } CGPValue::~CGPValue(void) { CGPObject *next; while(mList) { next = mList->GetNext(); delete mList; mList = next; } } CGPValue *CGPValue::Duplicate(CTextPool **textPool) { CGPValue *newValue; CGPObject *iterator; char *name; if (textPool) { name = (*textPool)->AllocText((char *)mName, true, textPool); } else { name = (char *)mName; } newValue = new CGPValue(name); iterator = mList; while(iterator) { if (textPool) { name = (*textPool)->AllocText((char *)iterator->GetName(), true, textPool); } else { name = (char *)iterator->GetName(); } newValue->AddValue(name); iterator = iterator->GetNext(); } return newValue; } bool CGPValue::IsList(void) { if (!mList || !mList->GetNext()) { return false; } return true; } const char *CGPValue::GetTopValue(void) { if (mList) { return mList->GetName(); } return 0; } void CGPValue::AddValue(const char *newValue, CTextPool **textPool) { if (textPool) { newValue = (*textPool)->AllocText((char *)newValue, true, textPool); } if (mList == 0) { mList = new CGPObject(newValue); mList->SetInOrderNext(mList); } else { mList->GetInOrderNext()->SetNext(new CGPObject(newValue)); mList->SetInOrderNext(mList->GetInOrderNext()->GetNext()); } } bool CGPValue::Parse(char **dataPtr, CTextPool **textPool) { char *token; char *value; while(1) { token = GetToken(dataPtr, true, true); if (!token[0]) { // end of data - error! return false; } else if (strcmpi(token, "]") == 0) { // ending brace for this list break; } value = (*textPool)->AllocText(token, true, textPool); AddValue(value); } return true; } bool CGPValue::Write(CTextPool **textPool, int depth) { int i; CGPObject *next; if (!mList) { return true; } for(i=0;i<depth;i++) { (*textPool)->AllocText("\t", false, textPool); } WriteText(textPool, mName); if (!mList->GetNext()) { (*textPool)->AllocText("\t\t", false, textPool); mList->WriteText(textPool, mList->GetName()); (*textPool)->AllocText("\r\n", false, textPool); } else { (*textPool)->AllocText("\r\n", false, textPool); for(i=0;i<depth;i++) { (*textPool)->AllocText("\t", false, textPool); } (*textPool)->AllocText("[\r\n", false, textPool); next = mList; while(next) { for(i=0;i<depth+1;i++) { (*textPool)->AllocText("\t", false, textPool); } mList->WriteText(textPool, next->GetName()); (*textPool)->AllocText("\r\n", false, textPool); next = next->GetNext(); } for(i=0;i<depth;i++) { (*textPool)->AllocText("\t", false, textPool); } (*textPool)->AllocText("]\r\n", false, textPool); } return true; } CGPGroup::CGPGroup(const char *initName, CGPGroup *initParent) : CGPObject(initName), mPairs(0), mInOrderPairs(0), mCurrentPair(0), mSubGroups(0), mInOrderSubGroups(0), mCurrentSubGroup(0), mParent(initParent), mWriteable(false) { } CGPGroup::~CGPGroup(void) { Clean(); } int CGPGroup::GetNumSubGroups(void) { int count; CGPGroup *group; count = 0; group = mSubGroups; do { count++; group = (CGPGroup *)group->GetNext(); } while(group); return(count); } int CGPGroup::GetNumPairs(void) { int count; CGPValue *pair; count = 0; pair = mPairs; do { count++; pair = (CGPValue *)pair->GetNext(); } while(pair); return(count); } void CGPGroup::Clean(void) { while(mPairs) { mCurrentPair = (CGPValue *)mPairs->GetNext(); delete mPairs; mPairs = mCurrentPair; } while(mSubGroups) { mCurrentSubGroup = (CGPGroup *)mSubGroups->GetNext(); delete mSubGroups; mSubGroups = mCurrentSubGroup; } mPairs = mInOrderPairs = mCurrentPair = 0; mSubGroups = mInOrderSubGroups = mCurrentSubGroup = 0; mParent = 0; mWriteable = false; } CGPGroup *CGPGroup::Duplicate(CTextPool **textPool, CGPGroup *initParent) { CGPGroup *newGroup, *subSub, *newSub; CGPValue *newPair, *subPair; char *name; if (textPool) { name = (*textPool)->AllocText((char *)mName, true, textPool); } else { name = (char *)mName; } newGroup = new CGPGroup(name); subSub = mSubGroups; while(subSub) { newSub = subSub->Duplicate(textPool, newGroup); newGroup->AddGroup(newSub); subSub = (CGPGroup *)subSub->GetNext(); } subPair = mPairs; while(subPair) { newPair = subPair->Duplicate(textPool); newGroup->AddPair(newPair); subPair = (CGPValue *)subPair->GetNext(); } return newGroup; } void CGPGroup::SortObject(CGPObject *object, CGPObject **unsortedList, CGPObject **sortedList, CGPObject **lastObject) { CGPObject *test, *last; if (!*unsortedList) { *unsortedList = *sortedList = object; } else { (*lastObject)->SetNext(object); test = *sortedList; last = 0; while(test) { if (strcmpi(object->GetName(), test->GetName()) < 0) { break; } last = test; test = test->GetInOrderNext(); } if (test) { test->SetInOrderPrevious(object); object->SetInOrderNext(test); } if (last) { last->SetInOrderNext(object); object->SetInOrderPrevious(last); } else { *sortedList = object; } } *lastObject = object; } CGPValue *CGPGroup::AddPair(const char *name, const char *value, CTextPool **textPool) { CGPValue *newPair; if (textPool) { name = (*textPool)->AllocText((char *)name, true, textPool); if (value) { value = (*textPool)->AllocText((char *)value, true, textPool); } } newPair = new CGPValue(name, value); AddPair(newPair); return newPair; } void CGPGroup::AddPair(CGPValue *NewPair) { SortObject(NewPair, (CGPObject **)&mPairs, (CGPObject **)&mInOrderPairs, (CGPObject **)&mCurrentPair); } CGPGroup *CGPGroup::AddGroup(const char *name, CTextPool **textPool) { CGPGroup *newGroup; if (textPool) { name = (*textPool)->AllocText((char *)name, true, textPool); } newGroup = new CGPGroup(name); AddGroup(newGroup); return newGroup; } void CGPGroup::AddGroup(CGPGroup *NewGroup) { SortObject(NewGroup, (CGPObject **)&mSubGroups, (CGPObject **)&mInOrderSubGroups, (CGPObject **)&mCurrentSubGroup); } CGPGroup *CGPGroup::FindSubGroup(const char *name) { CGPGroup *group; group = mSubGroups; while(group) { if(!stricmp(name, group->GetName())) { return(group); } group = (CGPGroup *)group->GetNext(); } return(NULL); } bool CGPGroup::Parse(char **dataPtr, CTextPool **textPool) { char *token; char lastToken[MAX_TOKEN_SIZE]; CGPGroup *newSubGroup; CGPValue *newPair; while(1) { token = GetToken(dataPtr, true); if (!token[0]) { // end of data - error! if (mParent) { return false; } else { break; } } else if (strcmpi(token, "}") == 0) { // ending brace for this group break; } strcpy(lastToken, token); // read ahead to see what we are doing token = GetToken(dataPtr, true, true); if (strcmpi(token, "{") == 0) { // new sub group newSubGroup = AddGroup(lastToken, textPool); newSubGroup->SetWriteable(mWriteable); if (!newSubGroup->Parse(dataPtr, textPool)) { return false; } } else if (strcmpi(token, "[") == 0) { // new pair list newPair = AddPair(lastToken, 0, textPool); if (!newPair->Parse(dataPtr, textPool)) { return false; } } else { // new pair AddPair(lastToken, token, textPool); } } return true; } bool CGPGroup::Write(CTextPool **textPool, int depth) { int i; CGPValue *mPair = mPairs; CGPGroup *mSubGroup = mSubGroups; if (depth >= 0) { for(i=0;i<depth;i++) { (*textPool)->AllocText("\t", false, textPool); } WriteText(textPool, mName); (*textPool)->AllocText("\r\n", false, textPool); for(i=0;i<depth;i++) { (*textPool)->AllocText("\t", false, textPool); } (*textPool)->AllocText("{\r\n", false, textPool); } while(mPair) { mPair->Write(textPool, depth+1); mPair = (CGPValue *)mPair->GetNext(); } while(mSubGroup) { mSubGroup->Write(textPool, depth+1); mSubGroup = (CGPGroup *)mSubGroup->GetNext(); } if (depth >= 0) { for(i=0;i<depth;i++) { (*textPool)->AllocText("\t", false, textPool); } (*textPool)->AllocText("}\r\n", false, textPool); } return true; } const char *CGPGroup::FindPairValue(const char *key, const char *defaultVal) { CGPValue *mPair = mPairs; while(mPair) { if (strcmpi(mPair->GetName(), key) == 0) { return mPair->GetTopValue(); } mPair = (CGPValue *)mPair->GetNext(); } return defaultVal; } CGenericParser2::CGenericParser2(void) : mTextPool(0), mWriteable(false) { } CGenericParser2::~CGenericParser2(void) { Clean(); } bool CGenericParser2::Parse(char **dataPtr, bool cleanFirst, bool writeable) { CTextPool *topPool; if (cleanFirst) { Clean(); } if (!mTextPool) { mTextPool = new CTextPool; } SetWriteable(writeable); mTopLevel.SetWriteable(writeable); topPool = mTextPool; return mTopLevel.Parse(dataPtr, &topPool); } void CGenericParser2::Clean(void) { mTopLevel.Clean(); CleanTextPool(mTextPool); mTextPool = 0; } bool CGenericParser2::Write(CTextPool *textPool) { return mTopLevel.Write(&textPool, -1); } // The following groups of routines are used for a C interface into GP2. // C++ users should just use the objects as normally and not call these routines below // // CGenericParser2 (void *) routines void *GP_Parse(char **dataPtr, bool cleanFirst, bool writeable) { CGenericParser2 *parse; parse = new CGenericParser2; if (parse->Parse(dataPtr, cleanFirst, writeable)) { return parse; } delete parse; return 0; } void GP_Clean(void *GP2) { if (!GP2) { return; } ((CGenericParser2 *)GP2)->Clean(); } void GP_Delete(void **GP2) { if (!GP2 || !(*GP2)) { return; } delete ((CGenericParser2 *)(*GP2)); (*GP2) = 0; } void *GP_GetBaseParseGroup(void *GP2) { if (!GP2) { return 0; } return ((CGenericParser2 *)GP2)->GetBaseParseGroup(); } // CGPGroup (void *) routines const char *GPG_GetName(void *GPG) { if (!GPG) { return ""; } return ((CGPGroup *)GPG)->GetName(); } void *GPG_GetNext(void *GPG) { if (!GPG) { return 0; } return ((CGPGroup *)GPG)->GetNext(); } void *GPG_GetInOrderNext(void *GPG) { if (!GPG) { return 0; } return ((CGPGroup *)GPG)->GetInOrderNext(); } void *GPG_GetInOrderPrevious(void *GPG) { if (!GPG) { return 0; } return ((CGPGroup *)GPG)->GetInOrderPrevious(); } void *GPG_GetPairs(void *GPG) { if (!GPG) { return 0; } return ((CGPGroup *)GPG)->GetPairs(); } void *GPG_GetInOrderPairs(void *GPG) { if (!GPG) { return 0; } return ((CGPGroup *)GPG)->GetInOrderPairs(); } void *GPG_GetSubGroups(void *GPG) { if (!GPG) { return 0; } return ((CGPGroup *)GPG)->GetSubGroups(); } void *GPG_GetInOrderSubGroups(void *GPG) { if (!GPG) { return 0; } return ((CGPGroup *)GPG)->GetInOrderSubGroups(); } void *GPG_FindSubGroup(void *GPG, const char *name) { if (!GPG) { return 0; } return ((CGPGroup *)GPG)->FindSubGroup(name); } const char *GPG_FindPairValue(void *GPG, const char *key, const char *defaultVal) { if (!GPG) { return defaultVal; } return ((CGPGroup *)GPG)->FindPairValue(key, defaultVal); } // CGPValue (void *) routines const char *GPV_GetName(void *GPV) { if (!GPV) { return ""; } return ((CGPValue *)GPV)->GetName(); } void *GPV_GetNext(void *GPV) { if (!GPV) { return 0; } return ((CGPValue *)GPV)->GetNext(); } void *GPV_GetInOrderNext(void *GPV) { if (!GPV) { return 0; } return ((CGPValue *)GPV)->GetInOrderNext(); } void *GPV_GetInOrderPrevious(void *GPV) { if (!GPV) { return 0; } return ((CGPValue *)GPV)->GetInOrderPrevious(); } bool GPV_IsList(void *GPV) { if (!GPV) { return 0; } return ((CGPValue *)GPV)->IsList(); } const char *GPV_GetTopValue(void *GPV) { if (!GPV) { return ""; } return ((CGPValue *)GPV)->GetTopValue(); } void *GPV_GetList(void *GPV) { if (!GPV) { return 0; } return ((CGPValue *)GPV)->GetList(); }
{ "pile_set_name": "Github" }
<?js var data = obj; var self = this; ?> <hr> <dt> <h4 class="name" id="<?js= id ?>"><?js= data.attribs + (kind === 'class' ? 'new ' : '') + name + (kind !== 'event' ? data.signature : '') ?></h4> <?js if (data.summary) { ?> <p class="summary"><?js= summary ?></p> <?js } ?> </dt> <dd> <?js if (data && data.description) { ?> <div class="description"> <?js= data.description ?> </div> <?js } ?> <?js if (data.augments && data.alias && data.alias.indexOf('module:') === 0) { ?> <h5>Extends:</h5> <?js= self.partial('augments.tmpl', data) ?> <?js } ?> <?js if (kind === 'event' && data && data.type && data.type.names) {?> <h5>Type: <?js= self.partial('type.tmpl', data.type.names) ?></h5> <?js } ?> <?js if (data['this']) { ?> <h5>This:</h5> <ul><li><?js= this.linkto(data['this'], data['this']) ?></li></ul> <?js } ?> <?js if (data.params && data.params.length) { ?> <h5>Parameters:</h5> <?js= this.partial('params.tmpl', params) ?> <?js } ?> <?js= this.partial('details.tmpl', data) ?> <?js if (data.kind !== 'module' && data.requires && data.requires.length) { ?> <h5>Requires:</h5> <ul><?js data.requires.forEach(function(r) { ?> <li><?js= self.linkto(r) ?></li> <?js }); ?></ul> <?js } ?> <?js if (data.fires && fires.length) { ?> <h5>Fires:</h5> <ul><?js fires.forEach(function(f) { ?> <li><?js= self.linkto(f) ?></li> <?js }); ?></ul> <?js } ?> <?js if (data.listens && listens.length) { ?> <h5>Listens to Events:</h5> <ul><?js listens.forEach(function(f) { ?> <li><?js= self.linkto(f) ?></li> <?js }); ?></ul> <?js } ?> <?js if (data.listeners && listeners.length) { ?> <h5>Listeners of This Event:</h5> <ul><?js listeners.forEach(function(f) { ?> <li><?js= self.linkto(f) ?></li> <?js }); ?></ul> <?js } ?> <?js if (data.exceptions && exceptions.length) { ?> <h5>Throws:</h5> <?js if (exceptions.length > 1) { ?><ul><?js exceptions.forEach(function(r) { ?> <li><?js= self.partial('exceptions.tmpl', r) ?></li> <?js }); ?></ul><?js } else { exceptions.forEach(function(r) { ?> <?js= self.partial('exceptions.tmpl', r) ?> <?js }); } } ?> <?js if (data.returns && returns.length) { ?> <h5>Returns:</h5> <?js if (returns.length > 1) { ?><ul><?js returns.forEach(function(r) { ?> <li><?js= self.partial('returns.tmpl', r) ?></li> <?js }); ?></ul><?js } else { returns.forEach(function(r) { ?> <?js= self.partial('returns.tmpl', r) ?> <?js }); } } ?> <?js if (data.examples && examples.length) { ?> <h5>Example<?js= examples.length > 1? 's':'' ?></h5> <?js= this.partial('examples.tmpl', examples) ?> <?js } ?> </dd>
{ "pile_set_name": "Github" }
export default function(s) { return s.match(/.{6}/g).map(function(x) { return "#" + x; }); }
{ "pile_set_name": "Github" }
<component name="libraryTable"> <library name="Maven: org.springframework:spring-aspects:4.3.13.RELEASE"> <CLASSES> <root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aspects/4.3.13.RELEASE/spring-aspects-4.3.13.RELEASE.jar!/" /> </CLASSES> <JAVADOC> <root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aspects/4.3.13.RELEASE/spring-aspects-4.3.13.RELEASE-javadoc.jar!/" /> </JAVADOC> <SOURCES> <root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-aspects/4.3.13.RELEASE/spring-aspects-4.3.13.RELEASE-sources.jar!/" /> </SOURCES> </library> </component>
{ "pile_set_name": "Github" }
--- title: "Create networkIPv4ConfigurationManagementCondition" description: "Create a new networkIPv4ConfigurationManagementCondition object." author: "dougeby" localization_priority: Normal ms.prod: "intune" doc_type: apiPageType --- # Create networkIPv4ConfigurationManagementCondition Namespace: microsoft.graph > **Important:** Microsoft Graph APIs under the /beta version are subject to change; production use is not supported. > **Note:** The Microsoft Graph API for Intune requires an [active Intune license](https://go.microsoft.com/fwlink/?linkid=839381) for the tenant. Create a new [networkIPv4ConfigurationManagementCondition](../resources/intune-fencing-networkipv4configurationmanagementcondition.md) object. ## Prerequisites One of the following permissions is required to call this API. To learn more, including how to choose permissions, see [Permissions](/graph/permissions-reference). |Permission type|Permissions (from most to least privileged)| |:---|:---| |Delegated (work or school account)|DeviceManagementConfiguration.ReadWrite.All| |Delegated (personal Microsoft account)|Not supported.| |Application|DeviceManagementConfiguration.ReadWrite.All| ## HTTP Request <!-- { "blockType": "ignored" } --> ``` http POST /deviceManagement/managementConditions POST /deviceManagement/managementConditions/{managementConditionId}/managementConditionStatements/{managementConditionStatementId}/managementConditions ``` ## Request headers |Header|Value| |:---|:---| |Authorization|Bearer &lt;token&gt; Required.| |Accept|application/json| ## Request body In the request body, supply a JSON representation for the networkIPv4ConfigurationManagementCondition object. The following table shows the properties that are required when you create the networkIPv4ConfigurationManagementCondition. |Property|Type|Description| |:---|:---|:---| |id|String|Unique identifier for the management condition. System generated value assigned when created. Inherited from [managementCondition](../resources/intune-fencing-managementcondition.md)| |uniqueName|String|Unique name for the management condition. Used in management condition expressions. Inherited from [managementCondition](../resources/intune-fencing-managementcondition.md)| |displayName|String|The admin defined name of the management condition. Inherited from [managementCondition](../resources/intune-fencing-managementcondition.md)| |description|String|The admin defined description of the management condition. Inherited from [managementCondition](../resources/intune-fencing-managementcondition.md)| |createdDateTime|DateTimeOffset|The time the management condition was created. Generated service side. Inherited from [managementCondition](../resources/intune-fencing-managementcondition.md)| |modifiedDateTime|DateTimeOffset|The time the management condition was last modified. Updated service side. Inherited from [managementCondition](../resources/intune-fencing-managementcondition.md)| |eTag|String|ETag of the management condition. Updated service side. Inherited from [managementCondition](../resources/intune-fencing-managementcondition.md)| |applicablePlatforms|[devicePlatformType](../resources/intune-shared-deviceplatformtype.md) collection|The applicable platforms for this management condition. Inherited from [managementCondition](../resources/intune-fencing-managementcondition.md). Possible values are: `android`, `androidForWork`, `iOS`, `macOS`, `windowsPhone81`, `windows81AndLater`, `windows10AndLater`, `androidWorkProfile`, `unknown`.| |ipV4Prefix|String|The IPv4 subnet to be connected to. e.g. 10.0.0.0/8| |ipV4Gateway|String|The IPv4 gateway address. e.g. 10.0.0.0| |ipV4DHCPServer|String|The IPv4 address of the DHCP server for the adapter.| |ipV4DNSServerList|String collection|The IPv4 DNS servers configured for the adapter.| |dnsSuffixList|String collection|Valid DNS suffixes for the current network. e.g. seattle.contoso.com| ## Response If successful, this method returns a `201 Created` response code and a [networkIPv4ConfigurationManagementCondition](../resources/intune-fencing-networkipv4configurationmanagementcondition.md) object in the response body. ## Example ### Request Here is an example of the request. ``` http POST https://graph.microsoft.com/beta/deviceManagement/managementConditions Content-type: application/json Content-length: 529 { "@odata.type": "#microsoft.graph.networkIPv4ConfigurationManagementCondition", "uniqueName": "Unique Name value", "displayName": "Display Name value", "description": "Description value", "eTag": "ETag value", "applicablePlatforms": [ "androidForWork" ], "ipV4Prefix": "Ip V4Prefix value", "ipV4Gateway": "Ip V4Gateway value", "ipV4DHCPServer": "Ip V4DHCPServer value", "ipV4DNSServerList": [ "Ip V4DNSServer List value" ], "dnsSuffixList": [ "Dns Suffix List value" ] } ``` ### Response Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call. ``` http HTTP/1.1 201 Created Content-Type: application/json Content-Length: 697 { "@odata.type": "#microsoft.graph.networkIPv4ConfigurationManagementCondition", "id": "5e4a8284-8284-5e4a-8482-4a5e84824a5e", "uniqueName": "Unique Name value", "displayName": "Display Name value", "description": "Description value", "createdDateTime": "2017-01-01T00:02:43.5775965-08:00", "modifiedDateTime": "2017-01-01T00:00:22.8983556-08:00", "eTag": "ETag value", "applicablePlatforms": [ "androidForWork" ], "ipV4Prefix": "Ip V4Prefix value", "ipV4Gateway": "Ip V4Gateway value", "ipV4DHCPServer": "Ip V4DHCPServer value", "ipV4DNSServerList": [ "Ip V4DNSServer List value" ], "dnsSuffixList": [ "Dns Suffix List value" ] } ```
{ "pile_set_name": "Github" }
using Nitra.Internal; using Nitra.ProjectSystem; using Nemerle; using Nemerle.Collections; using Nemerle.Text; using Nemerle.Utility; using System; using System.Collections.Generic; using System.Linq; namespace Nitra.Declarations { public interface IAstOption[+T] : IAst where T : IAst { HasValue : bool { get; } Value : T { get; } } public class AstOption[T] : AstBase, IAstOption[T] where T : IAst { protected _value : T; public HasValue : bool { get; } public Value : T { get { unless (HasValue) throw InvalidOperationException("Value not set"); _value; } } public this(loc : ILocated) { this(loc.Location) } public this(loc : Location) { Source = loc.Source; Span = loc.Span; } public this(loc : ILocated, value : T) { this(loc.Location, value) } public this(loc : Location, value : T) { this(loc); _value = value; def valueLoc = value.Location; when (valueLoc.Source : object == Source) Span += valueLoc.Span; HasValue = true; } public override EvalProperties(context : DependentPropertyEvalContext) : void { when (HasValue) _value.EvalProperties(context); } public override ToXaml() : string { if (HasValue) _value.ToString() else "<Span Foreground = 'gray'>None</Span>" } public override Accept(visitor : IAstVisitor) : void { when (HasValue) match (_value) { | x is Reference => visitor.Visit(x); | x is Name => visitor.Visit(x); | x => visitor.Visit(x); } } } public class AmbiguousAstOption[T] : IAstOption[T], IAmbiguousAst where T : IAst { public this(ambiguities : array[IAstOption[T]]) { Ambiguities = ambiguities } public Ambiguities : array[IAstOption[T]] { get; } public Location : Location { get { Ambiguities[0].Location } } public Source : SourceSnapshot { get { Ambiguities[0].Source } } public Span : NSpan { get { Ambiguities[0].Span } } public IsAmbiguous : bool { get { true } } public IsMissing : bool { get { false } } public HasValue : bool { get { Ambiguities[0].HasValue } } public Value : T { get { Ambiguities[0].Value } } private AmbiguitiesImpl : array[IAst] implements IAmbiguousAst.Ambiguities { get { Ambiguities :> array[IAst] } } public EvalProperties(context : DependentPropertyEvalContext) : void { AstUtils.EvalAmbiguitiesProperties(context, this) } public PropertiesEvalState : int { get { Ambiguities[0].PropertiesEvalState } } public ResetProperties() : void { AstUtils.ResetAmbiguitiesProperties(this) } public IsAllPropertiesEvaluated : bool { get { Ambiguities[0].IsAllPropertiesEvaluated } } public ToXaml() : string { "AmbiguousOption Count: " + Ambiguities.Length } public Accept(visitor : IAstVisitor) : void { foreach (item in Ambiguities) item.Accept(visitor); } } }
{ "pile_set_name": "Github" }
## PostgreSQL tid range scan - 行号范围扫描 ### 作者 digoal ### 日期 2019-09-01 ### 标签 PostgreSQL , tid scan , tid range scan ---- ## 背景 这个功能用于返回指定行号范围的内容,例如,如下SQL返回heap page block_id 0到99号数据块的内容。 ``` select ctid,* from t1 where ctid >= '(0,0)' and ctid <'(100,0)'; ``` 不需要进行全表扫描,只会扫描对应的数据块。 https://www.postgresql.org/message-id/flat/CAMyN-kB-nFTkF=VA_JPwFNo08S0d-Yk0F741S2B7LDmYAi8eyA@mail.gmail.com 在此之前,会执行全表扫描 ``` postgres=# explain select count(*) from a where ctid >= '(0,0)' and ctid <'(100,0)';e QUERY PLAN ---------------------------------------------------------------------- Aggregate (cost=41676.39..41676.40 rows=1 width=8) -> Seq Scan on a (cost=0.00..41667.01 rows=3749 width=0) Filter: ((ctid >= '(0,0)'::tid) AND (ctid < '(100,0)'::tid)) (3 rows) ``` ## 参考 https://www.postgresql.org/message-id/flat/CAMyN-kB-nFTkF=VA_JPwFNo08S0d-Yk0F741S2B7LDmYAi8eyA@mail.gmail.com #### [PostgreSQL 许愿链接](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216") 您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。[开不开森](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216"). #### [9.9元购买3个月阿里云RDS PostgreSQL实例](https://www.aliyun.com/database/postgresqlactivity "57258f76c37864c6e6d23383d05714ea") #### [PostgreSQL 解决方案集合](https://yq.aliyun.com/topic/118 "40cff096e9ed7122c512b35d8561d9c8") #### [德哥 / digoal's github - 公益是一辈子的事.](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae") ![digoal's wechat](../pic/digoal_weixin.jpg "f7ad92eeba24523fd47a6e1a0e691b59")
{ "pile_set_name": "Github" }
<footer> {% if (theme_prev_next_buttons_location == 'bottom' or theme_prev_next_buttons_location == 'both') and (next or prev) %} <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> {% if next %} <a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n" rel="next">{{ _('Next') }} <span class="fa fa-arrow-circle-right"></span></a> {% endif %} {% if prev %} <a href="{{ prev.link|e }}" class="btn btn-neutral float-left" title="{{ prev.title|striptags|e }}" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> {{ _('Previous') }}</a> {% endif %} </div> {% endif %} <hr/> <div role="contentinfo" class="copyright"> <p> {%- if show_copyright %} {%- if hasdoc('copyright') %} {% set path = pathto('copyright') %} {% set copyright = copyright|e %} &copy; <a href="{{ path }}">{% trans %}Copyright{% endtrans %}</a> {{ copyright }} {%- else %} {% set copyright = copyright|e %} &copy; {% trans %}Copyright{% endtrans %} {{ copyright }} {%- endif %} {%- endif %} {%- if build_id and build_url %} <span class="build"> {# Translators: Build is a noun, not a verb #} {% trans %}Build{% endtrans %} <a href="{{ build_url }}">{{ build_id }}</a>. </span> {%- elif commit %} <span class="commit"> {% trans %}Revision{% endtrans %} <code>{{ commit }}</code>. </span> {%- elif last_updated %} <span class="lastupdated"> {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %} </span> {%- endif %} </p> </div> <!-- {%- if show_sphinx %} {% set sphinx_web = '<a href="http://sphinx-doc.org/">Sphinx</a>' %} {% set readthedocs_web = '<a href="https://readthedocs.org">Read the Docs</a>' %} {% trans sphinx_web=sphinx_web, readthedocs_web=readthedocs_web %}Built with {{ sphinx_web }} using a{% endtrans %} <a href="https://github.com/rtfd/sphinx_rtd_theme">{% trans %}theme{% endtrans %}</a> {% trans %}provided by {{ readthedocs_web }}{% endtrans %}. {%- endif %} {%- block extrafooter %} {% endblock %} --> </footer>
{ "pile_set_name": "Github" }
//--------------------------------------------------------------------- // <copyright file="TableCollection.cs" company="Microsoft Corporation"> // Copyright (c) 1999, Microsoft Corporation. All rights reserved. // </copyright> // <summary> // Part of the Deployment Tools Foundation project. // </summary> //--------------------------------------------------------------------- namespace Microsoft.PackageManagement.Msi.Internal.Deployment.WindowsInstaller { using System; using System.Collections.Generic; /// <summary> /// Contains information about all the tables in a Windows Installer database. /// </summary> internal class TableCollection : ICollection<TableInfo> { private Database db; internal TableCollection(Database db) { this.db = db; } /// <summary> /// Gets the number of tables in the database. /// </summary> public int Count { get { return this.GetTables().Count; } } /// <summary> /// Gets a boolean value indicating whether the collection is read-only. /// A TableCollection is read-only when the database is read-only. /// </summary> /// <value>read-only status of the collection</value> public bool IsReadOnly { get { return this.db.IsReadOnly; } } /// <summary> /// Gets information about a given table. /// </summary> /// <param name="table">case-sensitive name of the table</param> /// <returns>information about the requested table, or null if the table does not exist in the database</returns> public TableInfo this[string table] { get { if (string.IsNullOrWhiteSpace(table)) { throw new ArgumentNullException("table"); } if (!this.Contains(table)) { return null; } return new TableInfo(this.db, table); } } /// <summary> /// Adds a new table to the database. /// </summary> /// <param name="item">information about the table to be added</param> /// <exception cref="InvalidOperationException">a table with the same name already exists in the database</exception> public void Add(TableInfo item) { if (item == null) { throw new ArgumentNullException("item"); } if (this.Contains(item.Name)) { throw new InvalidOperationException(); } this.db.Execute(item.SqlCreateString); } /// <summary> /// Removes all tables (and all data) from the database. /// </summary> public void Clear() { foreach (string table in this.GetTables()) { this.Remove(table); } } /// <summary> /// Checks if the database contains a table with the given name. /// </summary> /// <param name="item">case-sensitive name of the table to search for</param> /// <returns>True if the table exists, false otherwise.</returns> public bool Contains(string item) { if (string.IsNullOrWhiteSpace(item)) { throw new ArgumentNullException("item"); } uint ret = RemotableNativeMethods.MsiDatabaseIsTablePersistent((int) this.db.Handle, item); if (ret == 3) // MSICONDITION_ERROR { throw new InstallerException(); } return ret != 2; // MSICONDITION_NONE } bool ICollection<TableInfo>.Contains(TableInfo item) { return this.Contains(item.Name); } /// <summary> /// Copies the table information from this collection into an array. /// </summary> /// <param name="array">destination array to be filed</param> /// <param name="arrayIndex">offset into the destination array where copying begins</param> public void CopyTo(TableInfo[] array, int arrayIndex) { if (array == null) { throw new ArgumentNullException("array"); } foreach (string table in this.GetTables()) { array[arrayIndex++] = new TableInfo(this.db, table); } } /// <summary> /// Removes a table from the database. /// </summary> /// <param name="item">case-sensitive name of the table to be removed</param> /// <returns>true if the table was removed, false if the table did not exist</returns> public bool Remove(string item) { if (string.IsNullOrWhiteSpace(item)) { throw new ArgumentNullException("item"); } if (!this.Contains(item)) { return false; } this.db.Execute("DROP TABLE `{0}`", item); return true; } bool ICollection<TableInfo>.Remove(TableInfo item) { if (item == null) { throw new ArgumentNullException("item"); } return this.Remove(item.Name); } /// <summary> /// Enumerates the tables in the database. /// </summary> public IEnumerator<TableInfo> GetEnumerator() { foreach (string table in this.GetTables()) { yield return new TableInfo(this.db, table); } } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return this.GetEnumerator(); } private IList<string> GetTables() { return this.db.ExecuteStringQuery("SELECT `Name` FROM `_Tables`"); } } }
{ "pile_set_name": "Github" }
void setup() { size(100, 100); noStroke(); } void draw() { float x = mouseX; float y = mouseY; float ix = width - mouseX; // Inverse X float iy = height - mouseY; // Inverse Y background(126); fill(255, 150); ellipse(x, height/2, y, y); fill(0, 159); ellipse(ix, height/2, iy, iy); }
{ "pile_set_name": "Github" }
exports.bdd = require('./bdd'); exports.tdd = require('./tdd'); exports.qunit = require('./qunit'); exports.exports = require('./exports');
{ "pile_set_name": "Github" }
// Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // *Preprocessed* version of the main "not_equal_to.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { template< typename Tag1 , typename Tag2 > struct not_equal_to_impl : if_c< ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) ) , aux::cast2nd_impl< not_equal_to_impl< Tag1,Tag1 >,Tag1, Tag2 > , aux::cast1st_impl< not_equal_to_impl< Tag2,Tag2 >,Tag1, Tag2 > >::type { }; /// for Digital Mars C++/compilers with no CTPS/TTP support template<> struct not_equal_to_impl< na,na > { template< typename U1, typename U2 > struct apply { typedef apply type; BOOST_STATIC_CONSTANT(int, value = 0); }; }; template< typename Tag > struct not_equal_to_impl< na,Tag > { template< typename U1, typename U2 > struct apply { typedef apply type; BOOST_STATIC_CONSTANT(int, value = 0); }; }; template< typename Tag > struct not_equal_to_impl< Tag,na > { template< typename U1, typename U2 > struct apply { typedef apply type; BOOST_STATIC_CONSTANT(int, value = 0); }; }; template< typename T > struct not_equal_to_tag { typedef typename T::tag type; }; template< typename BOOST_MPL_AUX_NA_PARAM(N1) , typename BOOST_MPL_AUX_NA_PARAM(N2) > struct not_equal_to : not_equal_to_impl< typename not_equal_to_tag<N1>::type , typename not_equal_to_tag<N2>::type >::template apply< N1,N2 >::type { BOOST_MPL_AUX_LAMBDA_SUPPORT(2, not_equal_to, (N1, N2)) }; BOOST_MPL_AUX_NA_SPEC2(2, 2, not_equal_to) }} namespace boost { namespace mpl { template<> struct not_equal_to_impl< integral_c_tag,integral_c_tag > { template< typename N1, typename N2 > struct apply : bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value != BOOST_MPL_AUX_VALUE_WKND(N2)::value ) > { }; }; }}
{ "pile_set_name": "Github" }
.path { fill: none; stroke: #a5afba; stroke-width: 2px; transition: all .2s ease-in-out; &:hover { stroke-width: 3px; } &.error { stroke: #ca2621; } &.active { stroke: #329dce; } &.tcpActive { stroke: #479e88; } &.selected { stroke-width: 4px; } } .marker { fill: #a5afba; &.error { fill: #ca2621; } &.active { fill: #329dce; } &.tcpActive { fill: #479e88; } }
{ "pile_set_name": "Github" }
package org.hive2hive.core.network.data; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.hive2hive.core.H2HConstants; import org.hive2hive.core.exceptions.PutFailedException; class PutQueueEntry extends QueueEntry { private final String pid; private final AtomicBoolean readyToPut = new AtomicBoolean(false); private final AtomicBoolean abort = new AtomicBoolean(false); private final CountDownLatch putWaiter = new CountDownLatch(1); private PutFailedException putFailedException; public PutQueueEntry(String pid) { this.pid = pid; } public String getPid() { return pid; } public boolean isReadyToPut() { return readyToPut.get(); } public void readyToPut() { readyToPut.set(true); } public boolean isAborted() { return abort.get(); } public void abort() { abort.set(true); } public void notifyPut() { putWaiter.countDown(); } public void waitForPut() throws PutFailedException { if (putFailedException != null) { throw putFailedException; } try { boolean success = putWaiter.await(H2HConstants.AWAIT_NETWORK_OPERATION_MS * H2HConstants.PUT_RETRIES, TimeUnit.MILLISECONDS); if (!success) { putFailedException = new PutFailedException("Timeout while putting occurred"); } } catch (InterruptedException e) { putFailedException = new PutFailedException("Could not wait to put the user profile"); } if (putFailedException != null) { throw putFailedException; } } public void setPutError(PutFailedException error) { this.putFailedException = error; } @Override public int hashCode() { return getPid().hashCode(); } @Override public boolean equals(Object otherPid) { if (otherPid == null) { return false; } else if (otherPid instanceof String) { String pidString = (String) otherPid; return getPid().equals(pidString); } else if (otherPid instanceof PutQueueEntry) { PutQueueEntry otherEntry = (PutQueueEntry) otherPid; return getPid().equals(otherEntry.getPid()); } return false; } }
{ "pile_set_name": "Github" }
/* * Copyright 2017 Banco Bilbao Vizcaya Argentaria, S.A. * * 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. */ export class MockConfigService { private config = { 'MIRRORGATE_API_URL': '' }; getConfig(key: string) { return this.config[key]; } loadConfig() { // Do nothing } }
{ "pile_set_name": "Github" }
# # This Cargo.toml file is used by the simple-trybuild module. # When adding a new file, please name the [[bin]] name to match the file # it is used to produce an error message # [package] name = "macros-tests" version = "0.0.0" edition = "2018" publish = false [dependencies.macros] path = "../../" default-features = false [[bin]] name = "comma-sep-rs" path = "comma-sep.rs" [[bin]] name = "double-commas-rs" path = "double-commas.rs" [[bin]] name = "only-arrow-rs" path = "only-arrow.rs" [[bin]] name = "only-comma-rs" path = "only-comma.rs" [[bin]] name = "single-argument-rs" path = "single-argument.rs" [[bin]] name = "triple-arguments-rs" path = "triple-arguments.rs" [[bin]] name = "two-arrows-rs" path = "two-arrows.rs" [[bin]] name = "leading-comma-rs" path = "leading-comma.rs"
{ "pile_set_name": "Github" }
#ifndef WebCore_FWD_JSLock_h #define WebCore_FWD_JSLock_h #include <JavaScriptCore/JSLock.h> #endif
{ "pile_set_name": "Github" }
# Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
{ "pile_set_name": "Github" }
{ "id": "68764b55-1726-4b6d-8e62-4c0d46e3e214", "modelName": "GMSound", "mvc": "1.0", "name": "sfx_precision_kill1", "audioGroupGuid": "93d5cf40-ad10-40e0-a3e4-474f9342b4a1", "bitDepth": 1, "bitRate": 128, "kind": 0, "preload": true, "sampleRate": 44100, "type": 0, "volume": 1 }
{ "pile_set_name": "Github" }
#ifndef QTSCRIPTSHELL_QWIDGETITEM_H #define QTSCRIPTSHELL_QWIDGETITEM_H #include <qlayoutitem.h> #include <QtScript/qscriptvalue.h> class QtScriptShell_QWidgetItem : public QWidgetItem { public: QtScriptShell_QWidgetItem(QWidget* w); ~QtScriptShell_QWidgetItem(); Qt::Orientations expandingDirections() const; QRect geometry() const; bool hasHeightForWidth() const; int heightForWidth(int arg__1) const; void invalidate(); bool isEmpty() const; QLayout* layout(); QSize maximumSize() const; int minimumHeightForWidth(int arg__1) const; QSize minimumSize() const; void setGeometry(const QRect& arg__1); QSize sizeHint() const; QSpacerItem* spacerItem(); QWidget* widget(); QScriptValue __qtscript_self; }; #endif // QTSCRIPTSHELL_QWIDGETITEM_H
{ "pile_set_name": "Github" }
/* * JBoss, Home of Professional Open Source. * Copyright 2013, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.domain.management.security.adduser; import static org.jboss.as.domain.management.security.adduser.AddUser.NEW_LINE; import org.jboss.as.domain.management.logging.DomainManagementLogger; /** * State to prompt the user to choose the name of the realm. * * For most users the realm should not be modified as it is dependent on being in sync with the core configuration. At a later * point it may be possible to split the realm name definition out of the core configuration. * * This state is only expected to be called when running in interactive mode. * * @author <a href="mailto:darran.lofthouse@jboss.com">Darran Lofthouse</a> */ public class PromptRealmState implements State { private final StateValues stateValues; private ConsoleWrapper theConsole; public PromptRealmState(ConsoleWrapper theConsole, final StateValues stateValues) { this.theConsole = theConsole; this.stateValues = stateValues; } @Override public State execute() { theConsole.printf(NEW_LINE); theConsole.printf(DomainManagementLogger.ROOT_LOGGER.enterNewUserDetails()); theConsole.printf(NEW_LINE); /* * Prompt for realm. */ String existingRealm = stateValues.getRealm(); if (existingRealm == null) { existingRealm = ""; } switch (stateValues.getRealmMode()) { case DISCOVERED: theConsole.printf(DomainManagementLogger.ROOT_LOGGER.discoveredRealm(existingRealm)); theConsole.printf(NEW_LINE); return new PromptNewUserState(theConsole, stateValues); case USER_SUPPLIED: theConsole.printf(DomainManagementLogger.ROOT_LOGGER.userSuppliedRealm(existingRealm)); theConsole.printf(NEW_LINE); return new PromptNewUserState(theConsole, stateValues); default: theConsole.printf(DomainManagementLogger.ROOT_LOGGER.realmPrompt(existingRealm)); String temp = theConsole.readLine(" : "); if (temp == null) { /* * This will return user to the command prompt so add a new line to ensure the command prompt is on the next * line. */ theConsole.printf(NEW_LINE); return null; } if (temp.length() > 0 || stateValues.getRealm() == null) { stateValues.setRealm(temp); } return new ValidateRealmState(theConsole, stateValues); } } }
{ "pile_set_name": "Github" }
exists /system/lib/libhardware_legacy.so missing /system/lib/modules/wlan.ko missing /system/etc/wifi/fw_wlan1271.bin missing /system/etc/wifi/bcm4329_sta.bin experimental nowirelessextensions nl80211 capability Adhoc generic.adhoc.edify generic.off.edify iw.adhoc.edify
{ "pile_set_name": "Github" }
/* * mm/rmap.c - physical to virtual reverse mappings * * Copyright 2001, Rik van Riel <riel@conectiva.com.br> * Released under the General Public License (GPL). * * Simple, low overhead reverse mapping scheme. * Please try to keep this thing as modular as possible. * * Provides methods for unmapping each kind of mapped page: * the anon methods track anonymous pages, and * the file methods track pages belonging to an inode. * * Original design by Rik van Riel <riel@conectiva.com.br> 2001 * File methods by Dave McCracken <dmccr@us.ibm.com> 2003, 2004 * Anonymous methods by Andrea Arcangeli <andrea@suse.de> 2004 * Contributions by Hugh Dickins 2003, 2004 */ /* * Lock ordering in mm: * * inode->i_mutex (while writing or truncating, not reading or faulting) * mm->mmap_sem * page->flags PG_locked (lock_page) * hugetlbfs_i_mmap_rwsem_key (in huge_pmd_share) * mapping->i_mmap_rwsem * anon_vma->rwsem * mm->page_table_lock or pte_lock * zone_lru_lock (in mark_page_accessed, isolate_lru_page) * swap_lock (in swap_duplicate, swap_info_get) * mmlist_lock (in mmput, drain_mmlist and others) * mapping->private_lock (in __set_page_dirty_buffers) * mem_cgroup_{begin,end}_page_stat (memcg->move_lock) * i_pages lock (widely used) * inode->i_lock (in set_page_dirty's __mark_inode_dirty) * bdi.wb->list_lock (in set_page_dirty's __mark_inode_dirty) * sb_lock (within inode_lock in fs/fs-writeback.c) * i_pages lock (widely used, in set_page_dirty, * in arch-dependent flush_dcache_mmap_lock, * within bdi.wb->list_lock in __sync_single_inode) * * anon_vma->rwsem,mapping->i_mutex (memory_failure, collect_procs_anon) * ->tasklist_lock * pte map lock */ #include <linux/mm.h> #include <linux/sched/mm.h> #include <linux/sched/task.h> #include <linux/pagemap.h> #include <linux/swap.h> #include <linux/swapops.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/ksm.h> #include <linux/rmap.h> #include <linux/rcupdate.h> #include <linux/export.h> #include <linux/memcontrol.h> #include <linux/mmu_notifier.h> #include <linux/migrate.h> #include <linux/hugetlb.h> #include <linux/backing-dev.h> #include <linux/page_idle.h> #include <linux/memremap.h> #include <linux/userfaultfd_k.h> #include <asm/tlbflush.h> #include <trace/events/tlb.h> #include "internal.h" static struct kmem_cache *anon_vma_cachep; static struct kmem_cache *anon_vma_chain_cachep; static inline struct anon_vma *anon_vma_alloc(void) { struct anon_vma *anon_vma; anon_vma = kmem_cache_alloc(anon_vma_cachep, GFP_KERNEL); if (anon_vma) { atomic_set(&anon_vma->refcount, 1); anon_vma->degree = 1; /* Reference for first vma */ anon_vma->parent = anon_vma; /* * Initialise the anon_vma root to point to itself. If called * from fork, the root will be reset to the parents anon_vma. */ anon_vma->root = anon_vma; } return anon_vma; } static inline void anon_vma_free(struct anon_vma *anon_vma) { VM_BUG_ON(atomic_read(&anon_vma->refcount)); /* * Synchronize against page_lock_anon_vma_read() such that * we can safely hold the lock without the anon_vma getting * freed. * * Relies on the full mb implied by the atomic_dec_and_test() from * put_anon_vma() against the acquire barrier implied by * down_read_trylock() from page_lock_anon_vma_read(). This orders: * * page_lock_anon_vma_read() VS put_anon_vma() * down_read_trylock() atomic_dec_and_test() * LOCK MB * atomic_read() rwsem_is_locked() * * LOCK should suffice since the actual taking of the lock must * happen _before_ what follows. */ might_sleep(); if (rwsem_is_locked(&anon_vma->root->rwsem)) { anon_vma_lock_write(anon_vma); anon_vma_unlock_write(anon_vma); } kmem_cache_free(anon_vma_cachep, anon_vma); } static inline struct anon_vma_chain *anon_vma_chain_alloc(gfp_t gfp) { return kmem_cache_alloc(anon_vma_chain_cachep, gfp); } static void anon_vma_chain_free(struct anon_vma_chain *anon_vma_chain) { kmem_cache_free(anon_vma_chain_cachep, anon_vma_chain); } static void anon_vma_chain_link(struct vm_area_struct *vma, struct anon_vma_chain *avc, struct anon_vma *anon_vma) { avc->vma = vma; avc->anon_vma = anon_vma; list_add(&avc->same_vma, &vma->anon_vma_chain); anon_vma_interval_tree_insert(avc, &anon_vma->rb_root); } /** * __anon_vma_prepare - attach an anon_vma to a memory region * @vma: the memory region in question * * This makes sure the memory mapping described by 'vma' has * an 'anon_vma' attached to it, so that we can associate the * anonymous pages mapped into it with that anon_vma. * * The common case will be that we already have one, which * is handled inline by anon_vma_prepare(). But if * not we either need to find an adjacent mapping that we * can re-use the anon_vma from (very common when the only * reason for splitting a vma has been mprotect()), or we * allocate a new one. * * Anon-vma allocations are very subtle, because we may have * optimistically looked up an anon_vma in page_lock_anon_vma_read() * and that may actually touch the spinlock even in the newly * allocated vma (it depends on RCU to make sure that the * anon_vma isn't actually destroyed). * * As a result, we need to do proper anon_vma locking even * for the new allocation. At the same time, we do not want * to do any locking for the common case of already having * an anon_vma. * * This must be called with the mmap_sem held for reading. */ int __anon_vma_prepare(struct vm_area_struct *vma) { struct mm_struct *mm = vma->vm_mm; struct anon_vma *anon_vma, *allocated; struct anon_vma_chain *avc; might_sleep(); avc = anon_vma_chain_alloc(GFP_KERNEL); if (!avc) goto out_enomem; anon_vma = find_mergeable_anon_vma(vma); allocated = NULL; if (!anon_vma) { anon_vma = anon_vma_alloc(); if (unlikely(!anon_vma)) goto out_enomem_free_avc; allocated = anon_vma; } anon_vma_lock_write(anon_vma); /* page_table_lock to protect against threads */ spin_lock(&mm->page_table_lock); if (likely(!vma->anon_vma)) { vma->anon_vma = anon_vma; anon_vma_chain_link(vma, avc, anon_vma); /* vma reference or self-parent link for new root */ anon_vma->degree++; allocated = NULL; avc = NULL; } spin_unlock(&mm->page_table_lock); anon_vma_unlock_write(anon_vma); if (unlikely(allocated)) put_anon_vma(allocated); if (unlikely(avc)) anon_vma_chain_free(avc); return 0; out_enomem_free_avc: anon_vma_chain_free(avc); out_enomem: return -ENOMEM; } /* * This is a useful helper function for locking the anon_vma root as * we traverse the vma->anon_vma_chain, looping over anon_vma's that * have the same vma. * * Such anon_vma's should have the same root, so you'd expect to see * just a single mutex_lock for the whole traversal. */ static inline struct anon_vma *lock_anon_vma_root(struct anon_vma *root, struct anon_vma *anon_vma) { struct anon_vma *new_root = anon_vma->root; if (new_root != root) { if (WARN_ON_ONCE(root)) up_write(&root->rwsem); root = new_root; down_write(&root->rwsem); } return root; } static inline void unlock_anon_vma_root(struct anon_vma *root) { if (root) up_write(&root->rwsem); } /* * Attach the anon_vmas from src to dst. * Returns 0 on success, -ENOMEM on failure. * * If dst->anon_vma is NULL this function tries to find and reuse existing * anon_vma which has no vmas and only one child anon_vma. This prevents * degradation of anon_vma hierarchy to endless linear chain in case of * constantly forking task. On the other hand, an anon_vma with more than one * child isn't reused even if there was no alive vma, thus rmap walker has a * good chance of avoiding scanning the whole hierarchy when it searches where * page is mapped. */ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src) { struct anon_vma_chain *avc, *pavc; struct anon_vma *root = NULL; list_for_each_entry_reverse(pavc, &src->anon_vma_chain, same_vma) { struct anon_vma *anon_vma; avc = anon_vma_chain_alloc(GFP_NOWAIT | __GFP_NOWARN); if (unlikely(!avc)) { unlock_anon_vma_root(root); root = NULL; avc = anon_vma_chain_alloc(GFP_KERNEL); if (!avc) goto enomem_failure; } anon_vma = pavc->anon_vma; root = lock_anon_vma_root(root, anon_vma); anon_vma_chain_link(dst, avc, anon_vma); /* * Reuse existing anon_vma if its degree lower than two, * that means it has no vma and only one anon_vma child. * * Do not chose parent anon_vma, otherwise first child * will always reuse it. Root anon_vma is never reused: * it has self-parent reference and at least one child. */ if (!dst->anon_vma && anon_vma != src->anon_vma && anon_vma->degree < 2) dst->anon_vma = anon_vma; } if (dst->anon_vma) dst->anon_vma->degree++; unlock_anon_vma_root(root); return 0; enomem_failure: /* * dst->anon_vma is dropped here otherwise its degree can be incorrectly * decremented in unlink_anon_vmas(). * We can safely do this because callers of anon_vma_clone() don't care * about dst->anon_vma if anon_vma_clone() failed. */ dst->anon_vma = NULL; unlink_anon_vmas(dst); return -ENOMEM; } /* * Attach vma to its own anon_vma, as well as to the anon_vmas that * the corresponding VMA in the parent process is attached to. * Returns 0 on success, non-zero on failure. */ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma) { struct anon_vma_chain *avc; struct anon_vma *anon_vma; int error; /* Don't bother if the parent process has no anon_vma here. */ if (!pvma->anon_vma) return 0; /* Drop inherited anon_vma, we'll reuse existing or allocate new. */ vma->anon_vma = NULL; /* * First, attach the new VMA to the parent VMA's anon_vmas, * so rmap can find non-COWed pages in child processes. */ error = anon_vma_clone(vma, pvma); if (error) return error; /* An existing anon_vma has been reused, all done then. */ if (vma->anon_vma) return 0; /* Then add our own anon_vma. */ anon_vma = anon_vma_alloc(); if (!anon_vma) goto out_error; avc = anon_vma_chain_alloc(GFP_KERNEL); if (!avc) goto out_error_free_anon_vma; /* * The root anon_vma's spinlock is the lock actually used when we * lock any of the anon_vmas in this anon_vma tree. */ anon_vma->root = pvma->anon_vma->root; anon_vma->parent = pvma->anon_vma; /* * With refcounts, an anon_vma can stay around longer than the * process it belongs to. The root anon_vma needs to be pinned until * this anon_vma is freed, because the lock lives in the root. */ get_anon_vma(anon_vma->root); /* Mark this anon_vma as the one where our new (COWed) pages go. */ vma->anon_vma = anon_vma; anon_vma_lock_write(anon_vma); anon_vma_chain_link(vma, avc, anon_vma); anon_vma->parent->degree++; anon_vma_unlock_write(anon_vma); return 0; out_error_free_anon_vma: put_anon_vma(anon_vma); out_error: unlink_anon_vmas(vma); return -ENOMEM; } void unlink_anon_vmas(struct vm_area_struct *vma) { struct anon_vma_chain *avc, *next; struct anon_vma *root = NULL; /* * Unlink each anon_vma chained to the VMA. This list is ordered * from newest to oldest, ensuring the root anon_vma gets freed last. */ list_for_each_entry_safe(avc, next, &vma->anon_vma_chain, same_vma) { struct anon_vma *anon_vma = avc->anon_vma; root = lock_anon_vma_root(root, anon_vma); anon_vma_interval_tree_remove(avc, &anon_vma->rb_root); /* * Leave empty anon_vmas on the list - we'll need * to free them outside the lock. */ if (RB_EMPTY_ROOT(&anon_vma->rb_root.rb_root)) { anon_vma->parent->degree--; continue; } list_del(&avc->same_vma); anon_vma_chain_free(avc); } if (vma->anon_vma) vma->anon_vma->degree--; unlock_anon_vma_root(root); /* * Iterate the list once more, it now only contains empty and unlinked * anon_vmas, destroy them. Could not do before due to __put_anon_vma() * needing to write-acquire the anon_vma->root->rwsem. */ list_for_each_entry_safe(avc, next, &vma->anon_vma_chain, same_vma) { struct anon_vma *anon_vma = avc->anon_vma; VM_WARN_ON(anon_vma->degree); put_anon_vma(anon_vma); list_del(&avc->same_vma); anon_vma_chain_free(avc); } } static void anon_vma_ctor(void *data) { struct anon_vma *anon_vma = data; init_rwsem(&anon_vma->rwsem); atomic_set(&anon_vma->refcount, 0); anon_vma->rb_root = RB_ROOT_CACHED; } void __init anon_vma_init(void) { anon_vma_cachep = kmem_cache_create("anon_vma", sizeof(struct anon_vma), 0, SLAB_TYPESAFE_BY_RCU|SLAB_PANIC|SLAB_ACCOUNT, anon_vma_ctor); anon_vma_chain_cachep = KMEM_CACHE(anon_vma_chain, SLAB_PANIC|SLAB_ACCOUNT); } /* * Getting a lock on a stable anon_vma from a page off the LRU is tricky! * * Since there is no serialization what so ever against page_remove_rmap() * the best this function can do is return a locked anon_vma that might * have been relevant to this page. * * The page might have been remapped to a different anon_vma or the anon_vma * returned may already be freed (and even reused). * * In case it was remapped to a different anon_vma, the new anon_vma will be a * child of the old anon_vma, and the anon_vma lifetime rules will therefore * ensure that any anon_vma obtained from the page will still be valid for as * long as we observe page_mapped() [ hence all those page_mapped() tests ]. * * All users of this function must be very careful when walking the anon_vma * chain and verify that the page in question is indeed mapped in it * [ something equivalent to page_mapped_in_vma() ]. * * Since anon_vma's slab is DESTROY_BY_RCU and we know from page_remove_rmap() * that the anon_vma pointer from page->mapping is valid if there is a * mapcount, we can dereference the anon_vma after observing those. */ struct anon_vma *page_get_anon_vma(struct page *page) { struct anon_vma *anon_vma = NULL; unsigned long anon_mapping; rcu_read_lock(); anon_mapping = (unsigned long)READ_ONCE(page->mapping); if ((anon_mapping & PAGE_MAPPING_FLAGS) != PAGE_MAPPING_ANON) goto out; if (!page_mapped(page)) goto out; anon_vma = (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON); if (!atomic_inc_not_zero(&anon_vma->refcount)) { anon_vma = NULL; goto out; } /* * If this page is still mapped, then its anon_vma cannot have been * freed. But if it has been unmapped, we have no security against the * anon_vma structure being freed and reused (for another anon_vma: * SLAB_TYPESAFE_BY_RCU guarantees that - so the atomic_inc_not_zero() * above cannot corrupt). */ if (!page_mapped(page)) { rcu_read_unlock(); put_anon_vma(anon_vma); return NULL; } out: rcu_read_unlock(); return anon_vma; } /* * Similar to page_get_anon_vma() except it locks the anon_vma. * * Its a little more complex as it tries to keep the fast path to a single * atomic op -- the trylock. If we fail the trylock, we fall back to getting a * reference like with page_get_anon_vma() and then block on the mutex. */ struct anon_vma *page_lock_anon_vma_read(struct page *page) { struct anon_vma *anon_vma = NULL; struct anon_vma *root_anon_vma; unsigned long anon_mapping; rcu_read_lock(); anon_mapping = (unsigned long)READ_ONCE(page->mapping); if ((anon_mapping & PAGE_MAPPING_FLAGS) != PAGE_MAPPING_ANON) goto out; if (!page_mapped(page)) goto out; anon_vma = (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON); root_anon_vma = READ_ONCE(anon_vma->root); if (down_read_trylock(&root_anon_vma->rwsem)) { /* * If the page is still mapped, then this anon_vma is still * its anon_vma, and holding the mutex ensures that it will * not go away, see anon_vma_free(). */ if (!page_mapped(page)) { up_read(&root_anon_vma->rwsem); anon_vma = NULL; } goto out; } /* trylock failed, we got to sleep */ if (!atomic_inc_not_zero(&anon_vma->refcount)) { anon_vma = NULL; goto out; } if (!page_mapped(page)) { rcu_read_unlock(); put_anon_vma(anon_vma); return NULL; } /* we pinned the anon_vma, its safe to sleep */ rcu_read_unlock(); anon_vma_lock_read(anon_vma); if (atomic_dec_and_test(&anon_vma->refcount)) { /* * Oops, we held the last refcount, release the lock * and bail -- can't simply use put_anon_vma() because * we'll deadlock on the anon_vma_lock_write() recursion. */ anon_vma_unlock_read(anon_vma); __put_anon_vma(anon_vma); anon_vma = NULL; } return anon_vma; out: rcu_read_unlock(); return anon_vma; } void page_unlock_anon_vma_read(struct anon_vma *anon_vma) { anon_vma_unlock_read(anon_vma); } #ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH /* * Flush TLB entries for recently unmapped pages from remote CPUs. It is * important if a PTE was dirty when it was unmapped that it's flushed * before any IO is initiated on the page to prevent lost writes. Similarly, * it must be flushed before freeing to prevent data leakage. */ void try_to_unmap_flush(void) { struct tlbflush_unmap_batch *tlb_ubc = &current->tlb_ubc; if (!tlb_ubc->flush_required) return; arch_tlbbatch_flush(&tlb_ubc->arch); tlb_ubc->flush_required = false; tlb_ubc->writable = false; } /* Flush iff there are potentially writable TLB entries that can race with IO */ void try_to_unmap_flush_dirty(void) { struct tlbflush_unmap_batch *tlb_ubc = &current->tlb_ubc; if (tlb_ubc->writable) try_to_unmap_flush(); } static void set_tlb_ubc_flush_pending(struct mm_struct *mm, bool writable) { struct tlbflush_unmap_batch *tlb_ubc = &current->tlb_ubc; arch_tlbbatch_add_mm(&tlb_ubc->arch, mm); tlb_ubc->flush_required = true; /* * Ensure compiler does not re-order the setting of tlb_flush_batched * before the PTE is cleared. */ barrier(); mm->tlb_flush_batched = true; /* * If the PTE was dirty then it's best to assume it's writable. The * caller must use try_to_unmap_flush_dirty() or try_to_unmap_flush() * before the page is queued for IO. */ if (writable) tlb_ubc->writable = true; } /* * Returns true if the TLB flush should be deferred to the end of a batch of * unmap operations to reduce IPIs. */ static bool should_defer_flush(struct mm_struct *mm, enum ttu_flags flags) { bool should_defer = false; if (!(flags & TTU_BATCH_FLUSH)) return false; /* If remote CPUs need to be flushed then defer batch the flush */ if (cpumask_any_but(mm_cpumask(mm), get_cpu()) < nr_cpu_ids) should_defer = true; put_cpu(); return should_defer; } /* * Reclaim unmaps pages under the PTL but do not flush the TLB prior to * releasing the PTL if TLB flushes are batched. It's possible for a parallel * operation such as mprotect or munmap to race between reclaim unmapping * the page and flushing the page. If this race occurs, it potentially allows * access to data via a stale TLB entry. Tracking all mm's that have TLB * batching in flight would be expensive during reclaim so instead track * whether TLB batching occurred in the past and if so then do a flush here * if required. This will cost one additional flush per reclaim cycle paid * by the first operation at risk such as mprotect and mumap. * * This must be called under the PTL so that an access to tlb_flush_batched * that is potentially a "reclaim vs mprotect/munmap/etc" race will synchronise * via the PTL. */ void flush_tlb_batched_pending(struct mm_struct *mm) { if (mm->tlb_flush_batched) { flush_tlb_mm(mm); /* * Do not allow the compiler to re-order the clearing of * tlb_flush_batched before the tlb is flushed. */ barrier(); mm->tlb_flush_batched = false; } } #else static void set_tlb_ubc_flush_pending(struct mm_struct *mm, bool writable) { } static bool should_defer_flush(struct mm_struct *mm, enum ttu_flags flags) { return false; } #endif /* CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH */ /* * At what user virtual address is page expected in vma? * Caller should check the page is actually part of the vma. */ unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma) { unsigned long address; if (PageAnon(page)) { struct anon_vma *page__anon_vma = page_anon_vma(page); /* * Note: swapoff's unuse_vma() is more efficient with this * check, and needs it to match anon_vma when KSM is active. */ if (!vma->anon_vma || !page__anon_vma || vma->anon_vma->root != page__anon_vma->root) return -EFAULT; } else if (page->mapping) { if (!vma->vm_file || vma->vm_file->f_mapping != page->mapping) return -EFAULT; } else return -EFAULT; address = __vma_address(page, vma); if (unlikely(address < vma->vm_start || address >= vma->vm_end)) return -EFAULT; return address; } pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address) { pgd_t *pgd; p4d_t *p4d; pud_t *pud; pmd_t *pmd = NULL; pmd_t pmde; pgd = pgd_offset(mm, address); if (!pgd_present(*pgd)) goto out; p4d = p4d_offset(pgd, address); if (!p4d_present(*p4d)) goto out; pud = pud_offset(p4d, address); if (!pud_present(*pud)) goto out; pmd = pmd_offset(pud, address); /* * Some THP functions use the sequence pmdp_huge_clear_flush(), set_pmd_at() * without holding anon_vma lock for write. So when looking for a * genuine pmde (in which to find pte), test present and !THP together. */ pmde = *pmd; barrier(); if (!pmd_present(pmde) || pmd_trans_huge(pmde)) pmd = NULL; out: return pmd; } struct page_referenced_arg { int mapcount; int referenced; unsigned long vm_flags; struct mem_cgroup *memcg; }; /* * arg: page_referenced_arg will be passed */ static bool page_referenced_one(struct page *page, struct vm_area_struct *vma, unsigned long address, void *arg) { struct page_referenced_arg *pra = arg; struct page_vma_mapped_walk pvmw = { .page = page, .vma = vma, .address = address, }; int referenced = 0; while (page_vma_mapped_walk(&pvmw)) { address = pvmw.address; if (vma->vm_flags & VM_LOCKED) { page_vma_mapped_walk_done(&pvmw); pra->vm_flags |= VM_LOCKED; return false; /* To break the loop */ } if (pvmw.pte) { if (ptep_clear_flush_young_notify(vma, address, pvmw.pte)) { /* * Don't treat a reference through * a sequentially read mapping as such. * If the page has been used in another mapping, * we will catch it; if this other mapping is * already gone, the unmap path will have set * PG_referenced or activated the page. */ if (likely(!(vma->vm_flags & VM_SEQ_READ))) referenced++; } } else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) { if (pmdp_clear_flush_young_notify(vma, address, pvmw.pmd)) referenced++; } else { /* unexpected pmd-mapped page? */ WARN_ON_ONCE(1); } pra->mapcount--; } if (referenced) clear_page_idle(page); if (test_and_clear_page_young(page)) referenced++; if (referenced) { pra->referenced++; pra->vm_flags |= vma->vm_flags; } if (!pra->mapcount) return false; /* To break the loop */ return true; } static bool invalid_page_referenced_vma(struct vm_area_struct *vma, void *arg) { struct page_referenced_arg *pra = arg; struct mem_cgroup *memcg = pra->memcg; if (!mm_match_cgroup(vma->vm_mm, memcg)) return true; return false; } /** * page_referenced - test if the page was referenced * @page: the page to test * @is_locked: caller holds lock on the page * @memcg: target memory cgroup * @vm_flags: collect encountered vma->vm_flags who actually referenced the page * * Quick test_and_clear_referenced for all mappings to a page, * returns the number of ptes which referenced the page. */ int page_referenced(struct page *page, int is_locked, struct mem_cgroup *memcg, unsigned long *vm_flags) { int we_locked = 0; struct page_referenced_arg pra = { .mapcount = total_mapcount(page), .memcg = memcg, }; struct rmap_walk_control rwc = { .rmap_one = page_referenced_one, .arg = (void *)&pra, .anon_lock = page_lock_anon_vma_read, }; *vm_flags = 0; if (!page_mapped(page)) return 0; if (!page_rmapping(page)) return 0; if (!is_locked && (!PageAnon(page) || PageKsm(page))) { we_locked = trylock_page(page); if (!we_locked) return 1; } /* * If we are reclaiming on behalf of a cgroup, skip * counting on behalf of references from different * cgroups */ if (memcg) { rwc.invalid_vma = invalid_page_referenced_vma; } rmap_walk(page, &rwc); *vm_flags = pra.vm_flags; if (we_locked) unlock_page(page); return pra.referenced; } static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma, unsigned long address, void *arg) { struct page_vma_mapped_walk pvmw = { .page = page, .vma = vma, .address = address, .flags = PVMW_SYNC, }; unsigned long start = address, end; int *cleaned = arg; /* * We have to assume the worse case ie pmd for invalidation. Note that * the page can not be free from this function. */ end = min(vma->vm_end, start + (PAGE_SIZE << compound_order(page))); mmu_notifier_invalidate_range_start(vma->vm_mm, start, end); while (page_vma_mapped_walk(&pvmw)) { unsigned long cstart; int ret = 0; cstart = address = pvmw.address; if (pvmw.pte) { pte_t entry; pte_t *pte = pvmw.pte; if (!pte_dirty(*pte) && !pte_write(*pte)) continue; flush_cache_page(vma, address, pte_pfn(*pte)); entry = ptep_clear_flush(vma, address, pte); entry = pte_wrprotect(entry); entry = pte_mkclean(entry); set_pte_at(vma->vm_mm, address, pte, entry); ret = 1; } else { #ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE pmd_t *pmd = pvmw.pmd; pmd_t entry; if (!pmd_dirty(*pmd) && !pmd_write(*pmd)) continue; flush_cache_page(vma, address, page_to_pfn(page)); entry = pmdp_invalidate(vma, address, pmd); entry = pmd_wrprotect(entry); entry = pmd_mkclean(entry); set_pmd_at(vma->vm_mm, address, pmd, entry); cstart &= PMD_MASK; ret = 1; #else /* unexpected pmd-mapped page? */ WARN_ON_ONCE(1); #endif } /* * No need to call mmu_notifier_invalidate_range() as we are * downgrading page table protection not changing it to point * to a new page. * * See Documentation/vm/mmu_notifier.rst */ if (ret) (*cleaned)++; } mmu_notifier_invalidate_range_end(vma->vm_mm, start, end); return true; } static bool invalid_mkclean_vma(struct vm_area_struct *vma, void *arg) { if (vma->vm_flags & VM_SHARED) return false; return true; } int page_mkclean(struct page *page) { int cleaned = 0; struct address_space *mapping; struct rmap_walk_control rwc = { .arg = (void *)&cleaned, .rmap_one = page_mkclean_one, .invalid_vma = invalid_mkclean_vma, }; BUG_ON(!PageLocked(page)); if (!page_mapped(page)) return 0; mapping = page_mapping(page); if (!mapping) return 0; rmap_walk(page, &rwc); return cleaned; } EXPORT_SYMBOL_GPL(page_mkclean); /** * page_move_anon_rmap - move a page to our anon_vma * @page: the page to move to our anon_vma * @vma: the vma the page belongs to * * When a page belongs exclusively to one process after a COW event, * that page can be moved into the anon_vma that belongs to just that * process, so the rmap code will not search the parent or sibling * processes. */ void page_move_anon_rmap(struct page *page, struct vm_area_struct *vma) { struct anon_vma *anon_vma = vma->anon_vma; page = compound_head(page); VM_BUG_ON_PAGE(!PageLocked(page), page); VM_BUG_ON_VMA(!anon_vma, vma); anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; /* * Ensure that anon_vma and the PAGE_MAPPING_ANON bit are written * simultaneously, so a concurrent reader (eg page_referenced()'s * PageAnon()) will not see one without the other. */ WRITE_ONCE(page->mapping, (struct address_space *) anon_vma); } /** * __page_set_anon_rmap - set up new anonymous rmap * @page: Page to add to rmap * @vma: VM area to add page to. * @address: User virtual address of the mapping * @exclusive: the page is exclusively owned by the current process */ static void __page_set_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address, int exclusive) { struct anon_vma *anon_vma = vma->anon_vma; BUG_ON(!anon_vma); if (PageAnon(page)) return; /* * If the page isn't exclusively mapped into this vma, * we must use the _oldest_ possible anon_vma for the * page mapping! */ if (!exclusive) anon_vma = anon_vma->root; anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; page->mapping = (struct address_space *) anon_vma; page->index = linear_page_index(vma, address); } /** * __page_check_anon_rmap - sanity check anonymous rmap addition * @page: the page to add the mapping to * @vma: the vm area in which the mapping is added * @address: the user virtual address mapped */ static void __page_check_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address) { #ifdef CONFIG_DEBUG_VM /* * The page's anon-rmap details (mapping and index) are guaranteed to * be set up correctly at this point. * * We have exclusion against page_add_anon_rmap because the caller * always holds the page locked, except if called from page_dup_rmap, * in which case the page is already known to be setup. * * We have exclusion against page_add_new_anon_rmap because those pages * are initially only visible via the pagetables, and the pte is locked * over the call to page_add_new_anon_rmap. */ BUG_ON(page_anon_vma(page)->root != vma->anon_vma->root); BUG_ON(page_to_pgoff(page) != linear_page_index(vma, address)); #endif } /** * page_add_anon_rmap - add pte mapping to an anonymous page * @page: the page to add the mapping to * @vma: the vm area in which the mapping is added * @address: the user virtual address mapped * @compound: charge the page as compound or small page * * The caller needs to hold the pte lock, and the page must be locked in * the anon_vma case: to serialize mapping,index checking after setting, * and to ensure that PageAnon is not being upgraded racily to PageKsm * (but PageKsm is never downgraded to PageAnon). */ void page_add_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address, bool compound) { do_page_add_anon_rmap(page, vma, address, compound ? RMAP_COMPOUND : 0); } /* * Special version of the above for do_swap_page, which often runs * into pages that are exclusively owned by the current process. * Everybody else should continue to use page_add_anon_rmap above. */ void do_page_add_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address, int flags) { bool compound = flags & RMAP_COMPOUND; bool first; if (compound) { atomic_t *mapcount; VM_BUG_ON_PAGE(!PageLocked(page), page); VM_BUG_ON_PAGE(!PageTransHuge(page), page); mapcount = compound_mapcount_ptr(page); first = atomic_inc_and_test(mapcount); } else { first = atomic_inc_and_test(&page->_mapcount); } if (first) { int nr = compound ? hpage_nr_pages(page) : 1; /* * We use the irq-unsafe __{inc|mod}_zone_page_stat because * these counters are not modified in interrupt context, and * pte lock(a spinlock) is held, which implies preemption * disabled. */ if (compound) __inc_node_page_state(page, NR_ANON_THPS); __mod_node_page_state(page_pgdat(page), NR_ANON_MAPPED, nr); } if (unlikely(PageKsm(page))) return; VM_BUG_ON_PAGE(!PageLocked(page), page); /* address might be in next vma when migration races vma_adjust */ if (first) __page_set_anon_rmap(page, vma, address, flags & RMAP_EXCLUSIVE); else __page_check_anon_rmap(page, vma, address); } /** * page_add_new_anon_rmap - add pte mapping to a new anonymous page * @page: the page to add the mapping to * @vma: the vm area in which the mapping is added * @address: the user virtual address mapped * @compound: charge the page as compound or small page * * Same as page_add_anon_rmap but must only be called on *new* pages. * This means the inc-and-test can be bypassed. * Page does not have to be locked. */ void page_add_new_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address, bool compound) { int nr = compound ? hpage_nr_pages(page) : 1; VM_BUG_ON_VMA(address < vma->vm_start || address >= vma->vm_end, vma); __SetPageSwapBacked(page); if (compound) { VM_BUG_ON_PAGE(!PageTransHuge(page), page); /* increment count (starts at -1) */ atomic_set(compound_mapcount_ptr(page), 0); __inc_node_page_state(page, NR_ANON_THPS); } else { /* Anon THP always mapped first with PMD */ VM_BUG_ON_PAGE(PageTransCompound(page), page); /* increment count (starts at -1) */ atomic_set(&page->_mapcount, 0); } __mod_node_page_state(page_pgdat(page), NR_ANON_MAPPED, nr); __page_set_anon_rmap(page, vma, address, 1); } /** * page_add_file_rmap - add pte mapping to a file page * @page: the page to add the mapping to * @compound: charge the page as compound or small page * * The caller needs to hold the pte lock. */ void page_add_file_rmap(struct page *page, bool compound) { int i, nr = 1; VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page); lock_page_memcg(page); if (compound && PageTransHuge(page)) { for (i = 0, nr = 0; i < HPAGE_PMD_NR; i++) { if (atomic_inc_and_test(&page[i]._mapcount)) nr++; } if (!atomic_inc_and_test(compound_mapcount_ptr(page))) goto out; VM_BUG_ON_PAGE(!PageSwapBacked(page), page); __inc_node_page_state(page, NR_SHMEM_PMDMAPPED); } else { if (PageTransCompound(page) && page_mapping(page)) { VM_WARN_ON_ONCE(!PageLocked(page)); SetPageDoubleMap(compound_head(page)); if (PageMlocked(page)) clear_page_mlock(compound_head(page)); } if (!atomic_inc_and_test(&page->_mapcount)) goto out; } __mod_lruvec_page_state(page, NR_FILE_MAPPED, nr); out: unlock_page_memcg(page); } static void page_remove_file_rmap(struct page *page, bool compound) { int i, nr = 1; VM_BUG_ON_PAGE(compound && !PageHead(page), page); lock_page_memcg(page); /* Hugepages are not counted in NR_FILE_MAPPED for now. */ if (unlikely(PageHuge(page))) { /* hugetlb pages are always mapped with pmds */ atomic_dec(compound_mapcount_ptr(page)); goto out; } /* page still mapped by someone else? */ if (compound && PageTransHuge(page)) { for (i = 0, nr = 0; i < HPAGE_PMD_NR; i++) { if (atomic_add_negative(-1, &page[i]._mapcount)) nr++; } if (!atomic_add_negative(-1, compound_mapcount_ptr(page))) goto out; VM_BUG_ON_PAGE(!PageSwapBacked(page), page); __dec_node_page_state(page, NR_SHMEM_PMDMAPPED); } else { if (!atomic_add_negative(-1, &page->_mapcount)) goto out; } /* * We use the irq-unsafe __{inc|mod}_lruvec_page_state because * these counters are not modified in interrupt context, and * pte lock(a spinlock) is held, which implies preemption disabled. */ __mod_lruvec_page_state(page, NR_FILE_MAPPED, -nr); if (unlikely(PageMlocked(page))) clear_page_mlock(page); out: unlock_page_memcg(page); } static void page_remove_anon_compound_rmap(struct page *page) { int i, nr; if (!atomic_add_negative(-1, compound_mapcount_ptr(page))) return; /* Hugepages are not counted in NR_ANON_PAGES for now. */ if (unlikely(PageHuge(page))) return; if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) return; __dec_node_page_state(page, NR_ANON_THPS); if (TestClearPageDoubleMap(page)) { /* * Subpages can be mapped with PTEs too. Check how many of * themi are still mapped. */ for (i = 0, nr = 0; i < HPAGE_PMD_NR; i++) { if (atomic_add_negative(-1, &page[i]._mapcount)) nr++; } } else { nr = HPAGE_PMD_NR; } if (unlikely(PageMlocked(page))) clear_page_mlock(page); if (nr) { __mod_node_page_state(page_pgdat(page), NR_ANON_MAPPED, -nr); deferred_split_huge_page(page); } } /** * page_remove_rmap - take down pte mapping from a page * @page: page to remove mapping from * @compound: uncharge the page as compound or small page * * The caller needs to hold the pte lock. */ void page_remove_rmap(struct page *page, bool compound) { if (!PageAnon(page)) return page_remove_file_rmap(page, compound); if (compound) return page_remove_anon_compound_rmap(page); /* page still mapped by someone else? */ if (!atomic_add_negative(-1, &page->_mapcount)) return; /* * We use the irq-unsafe __{inc|mod}_zone_page_stat because * these counters are not modified in interrupt context, and * pte lock(a spinlock) is held, which implies preemption disabled. */ __dec_node_page_state(page, NR_ANON_MAPPED); if (unlikely(PageMlocked(page))) clear_page_mlock(page); if (PageTransCompound(page)) deferred_split_huge_page(compound_head(page)); /* * It would be tidy to reset the PageAnon mapping here, * but that might overwrite a racing page_add_anon_rmap * which increments mapcount after us but sets mapping * before us: so leave the reset to free_unref_page, * and remember that it's only reliable while mapped. * Leaving it set also helps swapoff to reinstate ptes * faster for those pages still in swapcache. */ } /* * @arg: enum ttu_flags will be passed to this argument */ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, unsigned long address, void *arg) { struct mm_struct *mm = vma->vm_mm; struct page_vma_mapped_walk pvmw = { .page = page, .vma = vma, .address = address, }; pte_t pteval; struct page *subpage; bool ret = true; unsigned long start = address, end; enum ttu_flags flags = (enum ttu_flags)arg; /* munlock has nothing to gain from examining un-locked vmas */ if ((flags & TTU_MUNLOCK) && !(vma->vm_flags & VM_LOCKED)) return true; if (IS_ENABLED(CONFIG_MIGRATION) && (flags & TTU_MIGRATION) && is_zone_device_page(page) && !is_device_private_page(page)) return true; if (flags & TTU_SPLIT_HUGE_PMD) { split_huge_pmd_address(vma, address, flags & TTU_SPLIT_FREEZE, page); } /* * For THP, we have to assume the worse case ie pmd for invalidation. * For hugetlb, it could be much worse if we need to do pud * invalidation in the case of pmd sharing. * * Note that the page can not be free in this function as call of * try_to_unmap() must hold a reference on the page. */ end = min(vma->vm_end, start + (PAGE_SIZE << compound_order(page))); if (PageHuge(page)) { /* * If sharing is possible, start and end will be adjusted * accordingly. */ adjust_range_if_pmd_sharing_possible(vma, &start, &end); } mmu_notifier_invalidate_range_start(vma->vm_mm, start, end); while (page_vma_mapped_walk(&pvmw)) { #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION /* PMD-mapped THP migration entry */ if (!pvmw.pte && (flags & TTU_MIGRATION)) { VM_BUG_ON_PAGE(PageHuge(page) || !PageTransCompound(page), page); set_pmd_migration_entry(&pvmw, page); continue; } #endif /* * If the page is mlock()d, we cannot swap it out. * If it's recently referenced (perhaps page_referenced * skipped over this mm) then we should reactivate it. */ if (!(flags & TTU_IGNORE_MLOCK)) { if (vma->vm_flags & VM_LOCKED) { /* PTE-mapped THP are never mlocked */ if (!PageTransCompound(page)) { /* * Holding pte lock, we do *not* need * mmap_sem here */ mlock_vma_page(page); } ret = false; page_vma_mapped_walk_done(&pvmw); break; } if (flags & TTU_MUNLOCK) continue; } /* Unexpected PMD-mapped THP? */ VM_BUG_ON_PAGE(!pvmw.pte, page); subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte); address = pvmw.address; if (PageHuge(page)) { if (huge_pmd_unshare(mm, &address, pvmw.pte)) { /* * huge_pmd_unshare unmapped an entire PMD * page. There is no way of knowing exactly * which PMDs may be cached for this mm, so * we must flush them all. start/end were * already adjusted above to cover this range. */ flush_cache_range(vma, start, end); flush_tlb_range(vma, start, end); mmu_notifier_invalidate_range(mm, start, end); /* * The ref count of the PMD page was dropped * which is part of the way map counting * is done for shared PMDs. Return 'true' * here. When there is no other sharing, * huge_pmd_unshare returns false and we will * unmap the actual page and drop map count * to zero. */ page_vma_mapped_walk_done(&pvmw); break; } } if (IS_ENABLED(CONFIG_MIGRATION) && (flags & TTU_MIGRATION) && is_zone_device_page(page)) { swp_entry_t entry; pte_t swp_pte; pteval = ptep_get_and_clear(mm, pvmw.address, pvmw.pte); /* * Store the pfn of the page in a special migration * pte. do_swap_page() will wait until the migration * pte is removed and then restart fault handling. */ entry = make_migration_entry(page, 0); swp_pte = swp_entry_to_pte(entry); if (pte_soft_dirty(pteval)) swp_pte = pte_swp_mksoft_dirty(swp_pte); set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte); /* * No need to invalidate here it will synchronize on * against the special swap migration pte. * * The assignment to subpage above was computed from a * swap PTE which results in an invalid pointer. * Since only PAGE_SIZE pages can currently be * migrated, just set it to page. This will need to be * changed when hugepage migrations to device private * memory are supported. */ subpage = page; goto discard; } if (!(flags & TTU_IGNORE_ACCESS)) { if (ptep_clear_flush_young_notify(vma, address, pvmw.pte)) { ret = false; page_vma_mapped_walk_done(&pvmw); break; } } /* Nuke the page table entry. */ flush_cache_page(vma, address, pte_pfn(*pvmw.pte)); if (should_defer_flush(mm, flags)) { /* * We clear the PTE but do not flush so potentially * a remote CPU could still be writing to the page. * If the entry was previously clean then the * architecture must guarantee that a clear->dirty * transition on a cached TLB entry is written through * and traps if the PTE is unmapped. */ pteval = ptep_get_and_clear(mm, address, pvmw.pte); set_tlb_ubc_flush_pending(mm, pte_dirty(pteval)); } else { pteval = ptep_clear_flush(vma, address, pvmw.pte); } /* Move the dirty bit to the page. Now the pte is gone. */ if (pte_dirty(pteval)) set_page_dirty(page); /* Update high watermark before we lower rss */ update_hiwater_rss(mm); if (PageHWPoison(page) && !(flags & TTU_IGNORE_HWPOISON)) { pteval = swp_entry_to_pte(make_hwpoison_entry(subpage)); if (PageHuge(page)) { int nr = 1 << compound_order(page); hugetlb_count_sub(nr, mm); set_huge_swap_pte_at(mm, address, pvmw.pte, pteval, vma_mmu_pagesize(vma)); } else { dec_mm_counter(mm, mm_counter(page)); set_pte_at(mm, address, pvmw.pte, pteval); } } else if (pte_unused(pteval) && !userfaultfd_armed(vma)) { /* * The guest indicated that the page content is of no * interest anymore. Simply discard the pte, vmscan * will take care of the rest. * A future reference will then fault in a new zero * page. When userfaultfd is active, we must not drop * this page though, as its main user (postcopy * migration) will not expect userfaults on already * copied pages. */ dec_mm_counter(mm, mm_counter(page)); /* We have to invalidate as we cleared the pte */ mmu_notifier_invalidate_range(mm, address, address + PAGE_SIZE); } else if (IS_ENABLED(CONFIG_MIGRATION) && (flags & (TTU_MIGRATION|TTU_SPLIT_FREEZE))) { swp_entry_t entry; pte_t swp_pte; if (arch_unmap_one(mm, vma, address, pteval) < 0) { set_pte_at(mm, address, pvmw.pte, pteval); ret = false; page_vma_mapped_walk_done(&pvmw); break; } /* * Store the pfn of the page in a special migration * pte. do_swap_page() will wait until the migration * pte is removed and then restart fault handling. */ entry = make_migration_entry(subpage, pte_write(pteval)); swp_pte = swp_entry_to_pte(entry); if (pte_soft_dirty(pteval)) swp_pte = pte_swp_mksoft_dirty(swp_pte); set_pte_at(mm, address, pvmw.pte, swp_pte); /* * No need to invalidate here it will synchronize on * against the special swap migration pte. */ } else if (PageAnon(page)) { swp_entry_t entry = { .val = page_private(subpage) }; pte_t swp_pte; /* * Store the swap location in the pte. * See handle_pte_fault() ... */ if (unlikely(PageSwapBacked(page) != PageSwapCache(page))) { WARN_ON_ONCE(1); ret = false; /* We have to invalidate as we cleared the pte */ mmu_notifier_invalidate_range(mm, address, address + PAGE_SIZE); page_vma_mapped_walk_done(&pvmw); break; } /* MADV_FREE page check */ if (!PageSwapBacked(page)) { if (!PageDirty(page)) { /* Invalidate as we cleared the pte */ mmu_notifier_invalidate_range(mm, address, address + PAGE_SIZE); dec_mm_counter(mm, MM_ANONPAGES); goto discard; } /* * If the page was redirtied, it cannot be * discarded. Remap the page to page table. */ set_pte_at(mm, address, pvmw.pte, pteval); SetPageSwapBacked(page); ret = false; page_vma_mapped_walk_done(&pvmw); break; } if (swap_duplicate(entry) < 0) { set_pte_at(mm, address, pvmw.pte, pteval); ret = false; page_vma_mapped_walk_done(&pvmw); break; } if (arch_unmap_one(mm, vma, address, pteval) < 0) { set_pte_at(mm, address, pvmw.pte, pteval); ret = false; page_vma_mapped_walk_done(&pvmw); break; } if (list_empty(&mm->mmlist)) { spin_lock(&mmlist_lock); if (list_empty(&mm->mmlist)) list_add(&mm->mmlist, &init_mm.mmlist); spin_unlock(&mmlist_lock); } dec_mm_counter(mm, MM_ANONPAGES); inc_mm_counter(mm, MM_SWAPENTS); swp_pte = swp_entry_to_pte(entry); if (pte_soft_dirty(pteval)) swp_pte = pte_swp_mksoft_dirty(swp_pte); set_pte_at(mm, address, pvmw.pte, swp_pte); /* Invalidate as we cleared the pte */ mmu_notifier_invalidate_range(mm, address, address + PAGE_SIZE); } else { /* * This is a locked file-backed page, thus it cannot * be removed from the page cache and replaced by a new * page before mmu_notifier_invalidate_range_end, so no * concurrent thread might update its page table to * point at new page while a device still is using this * page. * * See Documentation/vm/mmu_notifier.rst */ dec_mm_counter(mm, mm_counter_file(page)); } discard: /* * No need to call mmu_notifier_invalidate_range() it has be * done above for all cases requiring it to happen under page * table lock before mmu_notifier_invalidate_range_end() * * See Documentation/vm/mmu_notifier.rst */ page_remove_rmap(subpage, PageHuge(page)); put_page(page); } mmu_notifier_invalidate_range_end(vma->vm_mm, start, end); return ret; } bool is_vma_temporary_stack(struct vm_area_struct *vma) { int maybe_stack = vma->vm_flags & (VM_GROWSDOWN | VM_GROWSUP); if (!maybe_stack) return false; if ((vma->vm_flags & VM_STACK_INCOMPLETE_SETUP) == VM_STACK_INCOMPLETE_SETUP) return true; return false; } static bool invalid_migration_vma(struct vm_area_struct *vma, void *arg) { return is_vma_temporary_stack(vma); } static int page_mapcount_is_zero(struct page *page) { return !total_mapcount(page); } /** * try_to_unmap - try to remove all page table mappings to a page * @page: the page to get unmapped * @flags: action and flags * * Tries to remove all the page table entries which are mapping this * page, used in the pageout path. Caller must hold the page lock. * * If unmap is successful, return true. Otherwise, false. */ bool try_to_unmap(struct page *page, enum ttu_flags flags) { struct rmap_walk_control rwc = { .rmap_one = try_to_unmap_one, .arg = (void *)flags, .done = page_mapcount_is_zero, .anon_lock = page_lock_anon_vma_read, }; /* * During exec, a temporary VMA is setup and later moved. * The VMA is moved under the anon_vma lock but not the * page tables leading to a race where migration cannot * find the migration ptes. Rather than increasing the * locking requirements of exec(), migration skips * temporary VMAs until after exec() completes. */ if ((flags & (TTU_MIGRATION|TTU_SPLIT_FREEZE)) && !PageKsm(page) && PageAnon(page)) rwc.invalid_vma = invalid_migration_vma; if (flags & TTU_RMAP_LOCKED) rmap_walk_locked(page, &rwc); else rmap_walk(page, &rwc); return !page_mapcount(page) ? true : false; } static int page_not_mapped(struct page *page) { return !page_mapped(page); }; /** * try_to_munlock - try to munlock a page * @page: the page to be munlocked * * Called from munlock code. Checks all of the VMAs mapping the page * to make sure nobody else has this page mlocked. The page will be * returned with PG_mlocked cleared if no other vmas have it mlocked. */ void try_to_munlock(struct page *page) { struct rmap_walk_control rwc = { .rmap_one = try_to_unmap_one, .arg = (void *)TTU_MUNLOCK, .done = page_not_mapped, .anon_lock = page_lock_anon_vma_read, }; VM_BUG_ON_PAGE(!PageLocked(page) || PageLRU(page), page); VM_BUG_ON_PAGE(PageCompound(page) && PageDoubleMap(page), page); rmap_walk(page, &rwc); } void __put_anon_vma(struct anon_vma *anon_vma) { struct anon_vma *root = anon_vma->root; anon_vma_free(anon_vma); if (root != anon_vma && atomic_dec_and_test(&root->refcount)) anon_vma_free(root); } static struct anon_vma *rmap_walk_anon_lock(struct page *page, struct rmap_walk_control *rwc) { struct anon_vma *anon_vma; if (rwc->anon_lock) return rwc->anon_lock(page); /* * Note: remove_migration_ptes() cannot use page_lock_anon_vma_read() * because that depends on page_mapped(); but not all its usages * are holding mmap_sem. Users without mmap_sem are required to * take a reference count to prevent the anon_vma disappearing */ anon_vma = page_anon_vma(page); if (!anon_vma) return NULL; anon_vma_lock_read(anon_vma); return anon_vma; } /* * rmap_walk_anon - do something to anonymous page using the object-based * rmap method * @page: the page to be handled * @rwc: control variable according to each walk type * * Find all the mappings of a page using the mapping pointer and the vma chains * contained in the anon_vma struct it points to. * * When called from try_to_munlock(), the mmap_sem of the mm containing the vma * where the page was found will be held for write. So, we won't recheck * vm_flags for that VMA. That should be OK, because that vma shouldn't be * LOCKED. */ static void rmap_walk_anon(struct page *page, struct rmap_walk_control *rwc, bool locked) { struct anon_vma *anon_vma; pgoff_t pgoff_start, pgoff_end; struct anon_vma_chain *avc; if (locked) { anon_vma = page_anon_vma(page); /* anon_vma disappear under us? */ VM_BUG_ON_PAGE(!anon_vma, page); } else { anon_vma = rmap_walk_anon_lock(page, rwc); } if (!anon_vma) return; pgoff_start = page_to_pgoff(page); pgoff_end = pgoff_start + hpage_nr_pages(page) - 1; anon_vma_interval_tree_foreach(avc, &anon_vma->rb_root, pgoff_start, pgoff_end) { struct vm_area_struct *vma = avc->vma; unsigned long address = vma_address(page, vma); cond_resched(); if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg)) continue; if (!rwc->rmap_one(page, vma, address, rwc->arg)) break; if (rwc->done && rwc->done(page)) break; } if (!locked) anon_vma_unlock_read(anon_vma); } /* * rmap_walk_file - do something to file page using the object-based rmap method * @page: the page to be handled * @rwc: control variable according to each walk type * * Find all the mappings of a page using the mapping pointer and the vma chains * contained in the address_space struct it points to. * * When called from try_to_munlock(), the mmap_sem of the mm containing the vma * where the page was found will be held for write. So, we won't recheck * vm_flags for that VMA. That should be OK, because that vma shouldn't be * LOCKED. */ static void rmap_walk_file(struct page *page, struct rmap_walk_control *rwc, bool locked) { struct address_space *mapping = page_mapping(page); pgoff_t pgoff_start, pgoff_end; struct vm_area_struct *vma; /* * The page lock not only makes sure that page->mapping cannot * suddenly be NULLified by truncation, it makes sure that the * structure at mapping cannot be freed and reused yet, * so we can safely take mapping->i_mmap_rwsem. */ VM_BUG_ON_PAGE(!PageLocked(page), page); if (!mapping) return; pgoff_start = page_to_pgoff(page); pgoff_end = pgoff_start + hpage_nr_pages(page) - 1; if (!locked) i_mmap_lock_read(mapping); vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff_start, pgoff_end) { unsigned long address = vma_address(page, vma); cond_resched(); if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg)) continue; if (!rwc->rmap_one(page, vma, address, rwc->arg)) goto done; if (rwc->done && rwc->done(page)) goto done; } done: if (!locked) i_mmap_unlock_read(mapping); } void rmap_walk(struct page *page, struct rmap_walk_control *rwc) { if (unlikely(PageKsm(page))) rmap_walk_ksm(page, rwc); else if (PageAnon(page)) rmap_walk_anon(page, rwc, false); else rmap_walk_file(page, rwc, false); } /* Like rmap_walk, but caller holds relevant rmap lock */ void rmap_walk_locked(struct page *page, struct rmap_walk_control *rwc) { /* no ksm support for now */ VM_BUG_ON_PAGE(PageKsm(page), page); if (PageAnon(page)) rmap_walk_anon(page, rwc, true); else rmap_walk_file(page, rwc, true); } #ifdef CONFIG_HUGETLB_PAGE /* * The following three functions are for anonymous (private mapped) hugepages. * Unlike common anonymous pages, anonymous hugepages have no accounting code * and no lru code, because we handle hugepages differently from common pages. */ static void __hugepage_set_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address, int exclusive) { struct anon_vma *anon_vma = vma->anon_vma; BUG_ON(!anon_vma); if (PageAnon(page)) return; if (!exclusive) anon_vma = anon_vma->root; anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; page->mapping = (struct address_space *) anon_vma; page->index = linear_page_index(vma, address); } void hugepage_add_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address) { struct anon_vma *anon_vma = vma->anon_vma; int first; BUG_ON(!PageLocked(page)); BUG_ON(!anon_vma); /* address might be in next vma when migration races vma_adjust */ first = atomic_inc_and_test(compound_mapcount_ptr(page)); if (first) __hugepage_set_anon_rmap(page, vma, address, 0); } void hugepage_add_new_anon_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address) { BUG_ON(address < vma->vm_start || address >= vma->vm_end); atomic_set(compound_mapcount_ptr(page), 0); __hugepage_set_anon_rmap(page, vma, address, 1); } #endif /* CONFIG_HUGETLB_PAGE */
{ "pile_set_name": "Github" }
# Codebase for the blog post [Up- and download files with React and Spring Boot](https://rieckpil.de/howto-up-and-download-files-with-react-and-spring-boot/) Steps to run this project: 1. Clone this Git repository 2. Navigate to the folder `spring-boot-uploading-and-downloading-files-with-react` 3. Make sure you use Java 11 `java -version` 3. Start the application with `mvn spring-boot:run` 4. Visit `http://localhost:8080` and upload some files and then download them randomly
{ "pile_set_name": "Github" }
package com.oim.ui.fx.classics.setting; import javafx.geometry.Side; import javafx.scene.Node; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.scene.layout.BorderPane; import javafx.scene.layout.StackPane; /** * @author XiaHui * @date 2017-12-08 20:34:10 */ public class SettingPane extends StackPane { private final BorderPane borderPane = new BorderPane(); private final TabPane tabPane = new TabPane(); public SettingPane() { initComponent(); initEvent(); } private void initComponent() { this.getChildren().add(borderPane); borderPane.setCenter(tabPane); tabPane.setSide(Side.LEFT); } private void initEvent() { } public void addTab(String text, Node node) { Tab tab = new Tab(); tab.setText(text); tab.setContent(node); tab.setClosable(false); tabPane.getTabs().add(tab); } }
{ "pile_set_name": "Github" }
[tox] envlist = py35, py36, py37, py38, docs, flake8 [gh-actions] python = 2.7: py27 3.6: py36 3.7: py37 3.8: py38 [testenv] deps = nose jaconv coverage scripttest mock pytest!=3.2.0,!=3.3.0 pytest-cov pytest-mock hypothesis>4 python-barcode commands = pytest --cov escpos passenv = ESCPOS_CAPABILITIES_PICKLE_DIR ESCPOS_CAPABILITIES_FILE CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_* [testenv:docs] basepython = python changedir = doc deps = sphinx>=1.5.1 setuptools_scm python-barcode sphinxcontrib-spelling>=5 commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html [testenv:flake8] basepython = python # TODO add flake8-future # TODO add flake8-docstrings deps = flake8 commands = flake8
{ "pile_set_name": "Github" }
// Copyright (C) 2017-2019 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // 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 library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. // { dg-do compile } #include <math.h> namespace gnu { using ::acos; using ::asin; using ::atan; using ::atan2; using ::ceil; using ::cos; using ::cosh; using ::exp; using ::fabs; using ::floor; using ::fmod; using ::frexp; using ::ldexp; using ::log; using ::log10; using ::modf; using ::pow; using ::sin; using ::sinh; using ::sqrt; using ::tan; using ::tanh; }
{ "pile_set_name": "Github" }
/* * Copyright 2017 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. */ #import "FTupleObjectNode.h" @implementation FTupleObjectNode @synthesize obj; @synthesize node; - (id)initWithObject:(id)aObj andNode:(id<FNode>)aNode { self = [super init]; if (self) { self.obj = aObj; self.node = aNode; } return self; } @end
{ "pile_set_name": "Github" }
/* * Copyright 2019-2029 geekidea(https://github.com/geekidea) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.geekidea.springbootplus.framework.ip.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import io.geekidea.springbootplus.framework.common.entity.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** * IP地址 * * @author geekidea * @since 2020-03-25 */ @Data @Accessors(chain = true) @EqualsAndHashCode(callSuper = true) @ApiModel(value = "IpAddress对象") public class IpAddress extends BaseEntity { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Long id; private String ipStart; private String ipEnd; @ApiModelProperty("区域") private String area; @ApiModelProperty("运营商") private String operator; private Long ipStartNum; private Long ipEndNum; }
{ "pile_set_name": "Github" }
package com.airbnb.epoxy.processor import com.airbnb.epoxy.AfterPropsSet import com.airbnb.epoxy.CallbackProp import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass import com.airbnb.epoxy.ModelProp import com.airbnb.epoxy.ModelView import com.airbnb.epoxy.OnViewRecycled import com.airbnb.epoxy.OnVisibilityChanged import com.airbnb.epoxy.OnVisibilityStateChanged import com.airbnb.epoxy.TextProp import com.airbnb.epoxy.processor.GeneratedModelInfo.Companion.RESET_METHOD import com.airbnb.epoxy.processor.GeneratedModelInfo.Companion.buildParamSpecs import com.airbnb.epoxy.processor.Utils.isSubtype import javax.lang.model.element.Element import javax.lang.model.element.ElementKind import javax.lang.model.element.ExecutableElement import javax.lang.model.element.Modifier import javax.lang.model.element.Name import javax.lang.model.element.Parameterizable import javax.lang.model.element.TypeElement import javax.lang.model.element.VariableElement import javax.lang.model.type.ExecutableType import javax.lang.model.type.TypeKind import javax.lang.model.type.TypeMirror import javax.lang.model.util.Elements import javax.lang.model.util.Types class Memoizer( val types: Types, val elements: Elements, val logger: Logger ) { val epoxyModelClassAnnotation by lazy { EpoxyModelClass::class.className() } val epoxyDataBindingModelBaseClass: TypeElement by lazy { Utils.getElementByName( ClassNames.EPOXY_DATA_BINDING_MODEL, elements, types ) } val parisStyleType by lazy { getTypeMirror(ClassNames.PARIS_STYLE, elements, types) } val epoxyModelClassElementUntyped by lazy { Utils.getElementByName( ClassNames.EPOXY_MODEL_UNTYPED, elements, types ) } val viewType: TypeMirror by lazy { getTypeMirror(ClassNames.ANDROID_VIEW, elements, types) } private val methodsReturningClassType = mutableMapOf<Name, Set<MethodInfo>>() fun getMethodsReturningClassType(classType: TypeMirror): Set<MethodInfo> = synchronized(methodsReturningClassType) { val classElement = types.asElement(classType) as TypeElement methodsReturningClassType.getOrPut(classElement.qualifiedName) { classType.ensureLoaded() val superClassType = classElement.superclass superClassType.ensureLoaded() // Check for base Object class if (superClassType.kind == TypeKind.NONE) return@getOrPut emptySet() val methodInfos: List<MethodInfo> = classElement.enclosedElementsThreadSafe.mapNotNull { subElement -> val modifiers: Set<Modifier> = subElement.modifiers if (subElement.kind !== ElementKind.METHOD || modifiers.contains(Modifier.PRIVATE) || modifiers.contains(Modifier.FINAL) || modifiers.contains(Modifier.STATIC) ) { return@mapNotNull null } val methodReturnType = (subElement.asType() as ExecutableType).returnType if (methodReturnType != classType && !isSubtype( classType, methodReturnType, types ) ) { return@mapNotNull null } val castedSubElement = subElement as ExecutableElement val params: List<VariableElement> = castedSubElement.parametersThreadSafe val methodName = subElement.getSimpleName().toString() if (methodName == RESET_METHOD && params.isEmpty()) { return@mapNotNull null } val isEpoxyAttribute = castedSubElement.getAnnotation<EpoxyAttribute>() != null MethodInfo( methodName, modifiers, buildParamSpecs(params), castedSubElement.isVarArgsThreadSafe, isEpoxyAttribute, castedSubElement ) } // Note: Adding super type methods second preserves any overloads in the base // type that may have changes (ie, a new return type or annotation), since // Set.plus only adds items that don't already exist. methodInfos.toSet() + getMethodsReturningClassType(superClassType) } } private val classConstructors = mutableMapOf<Name, List<GeneratedModelInfo.ConstructorInfo>>() /** * Get information about constructors of the original class so we can duplicate them in the * generated class and call through to super with the proper parameters */ fun getClassConstructors(classElement: TypeElement): List<GeneratedModelInfo.ConstructorInfo> = synchronized(classConstructors) { classConstructors.getOrPut(classElement.qualifiedName) { classElement .enclosedElementsThreadSafe .filter { subElement -> subElement.kind == ElementKind.CONSTRUCTOR && !subElement.modifiersThreadSafe.contains(Modifier.PRIVATE) } .map { subElement -> val constructor = subElement as ExecutableElement val params: List<VariableElement> = constructor.parametersThreadSafe GeneratedModelInfo.ConstructorInfo( subElement.modifiersThreadSafe, buildParamSpecs(params), constructor.isVarArgsThreadSafe ) } } } private val validatedViewModelBaseElements = mutableMapOf<Name, TypeElement?>() fun validateViewModelBaseClass( baseModelType: TypeMirror, logger: Logger, viewName: Name ): TypeElement? = synchronized(validatedViewModelBaseElements) { val baseModelElement = types.asElement(baseModelType) as TypeElement validatedViewModelBaseElements.getOrPut(baseModelElement.qualifiedName) { baseModelType.ensureLoaded() if (!Utils.isEpoxyModel(baseModelType)) { logger.logError( "The base model provided to an %s must extend EpoxyModel, but was %s (%s).", ModelView::class.java.simpleName, baseModelType, viewName ) null } else if (!validateSuperClassIsTypedCorrectly(baseModelElement)) { logger.logError( "The base model provided to an %s must have View as its type (%s).", ModelView::class.java.simpleName, viewName ) null } else { baseModelElement } } } /** The super class that our generated model extends from must have View as its only type. */ private fun validateSuperClassIsTypedCorrectly(classType: TypeElement): Boolean { val classElement = classType as? Parameterizable ?: return false val typeParameters = classElement.typeParametersThreadSafe if (typeParameters.size != 1) { // TODO: (eli_hart 6/15/17) It should be valid to have multiple or no types as long as they // are correct, but that should be a rare case return false } val typeParam = typeParameters[0] val bounds = typeParam.bounds if (bounds.isEmpty()) { // Any type is allowed, so View wil work return true } val typeMirror = bounds[0] return Utils.isAssignable(viewType, typeMirror, types) || types.isSubtype( typeMirror, viewType ) } /** * Looks up all of the declared EpoxyAttribute fields on superclasses and returns * attribute info for them. */ fun getInheritedEpoxyAttributes( originatingSuperClassType: TypeMirror, modelPackage: String, logger: Logger, includeSuperClass: (TypeElement) -> Boolean = { true } ): List<AttributeInfo> { val result = mutableListOf<AttributeInfo>() var currentSuperClassElement: TypeElement? = (types.asElement(originatingSuperClassType) as TypeElement).ensureLoaded() while (currentSuperClassElement != null) { val superClassAttributes = getEpoxyAttributesOnElement( currentSuperClassElement, logger ) val attributes = superClassAttributes?.superClassAttributes if (attributes?.isNotEmpty() == true) { attributes.takeIf { includeSuperClass(currentSuperClassElement!!) }?.filterTo(result) { // We can't inherit a package private attribute if we're not in the same package !it.isPackagePrivate || modelPackage == superClassAttributes.superClassPackage } } currentSuperClassElement = currentSuperClassElement.superClassElement(types) } return result } data class SuperClassAttributes( val superClassPackage: String, val superClassAttributes: List<AttributeInfo> ) private val inheritedEpoxyAttributes = mutableMapOf<Name, SuperClassAttributes?>() private fun getEpoxyAttributesOnElement( classElement: TypeElement, logger: Logger ): SuperClassAttributes? { return synchronized(inheritedEpoxyAttributes) { inheritedEpoxyAttributes.getOrPut(classElement.qualifiedName) { if (!Utils.isEpoxyModel(classElement.asType())) { null } else { val attributes = classElement .enclosedElementsThreadSafe .filter { it.getAnnotationThreadSafe(EpoxyAttribute::class.java) != null } .map { EpoxyProcessor.buildAttributeInfo( it, logger, types, elements, memoizer = this ) } SuperClassAttributes( superClassPackage = elements.getPackageOf( classElement ).qualifiedName.toString(), superClassAttributes = attributes ) } } } } class SuperViewAnnotations( val viewPackageName: Name, val annotatedElements: Map<Class<out Annotation>, List<ViewElement>> ) class ViewElement( val element: Element, val isPackagePrivate: Boolean, val attributeInfo: Lazy<ViewAttributeInfo> ) { val simpleName: String by lazy { element.simpleName.toString() } } private val annotationsOnSuperView = mutableMapOf<Name, SuperViewAnnotations>() fun getAnnotationsOnViewSuperClass( superViewElement: TypeElement, logger: Logger, resourceProcessor: ResourceProcessor ): SuperViewAnnotations { return synchronized(annotationsOnSuperView) { annotationsOnSuperView.getOrPut(superViewElement.qualifiedName) { val viewPackageName = elements.getPackageOf(superViewElement).qualifiedName val annotatedElements = mutableMapOf<Class<out Annotation>, MutableList<ViewElement>>() superViewElement.enclosedElementsThreadSafe.forEach { element -> val isPackagePrivate by lazy { Utils.isFieldPackagePrivate(element) } viewModelAnnotations.forEach { annotation -> if (element.getAnnotationThreadSafe(annotation) != null) { annotatedElements .getOrPut(annotation) { mutableListOf() } .add( ViewElement( element = element, isPackagePrivate = isPackagePrivate, attributeInfo = lazy { ViewAttributeInfo( viewElement = superViewElement, viewPackage = viewPackageName.toString(), hasDefaultKotlinValue = false, viewAttributeElement = element, types = types, elements = elements, logger = logger, resourceProcessor = resourceProcessor, memoizer = this ) } ) ) } } } SuperViewAnnotations( viewPackageName, annotatedElements ) } } } private val typeMap = mutableMapOf<String, Type>() fun getType(typeMirror: TypeMirror): Type { return synchronized(typeMap) { val typeMirrorAsString = typeMirror.ensureLoaded().toString() typeMap.getOrPut(typeMirrorAsString) { Type(typeMirror, typeMirrorAsString) } } } private val implementsModelCollectorMap = mutableMapOf<Name, Boolean>() fun implementsModelCollector(classElement: TypeElement): Boolean { return synchronized(typeMap) { implementsModelCollectorMap.getOrPut(classElement.qualifiedName) { classElement.interfaces.any { it.toString() == ClassNames.MODEL_COLLECTOR.toString() } || classElement.superClassElement(types)?.let { superClassElement -> // Also check the class hierarchy implementsModelCollector(superClassElement) } ?: false } } } } private val viewModelAnnotations = listOf( ModelProp::class.java, TextProp::class.java, CallbackProp::class.java, AfterPropsSet::class.java, OnVisibilityChanged::class.java, OnVisibilityStateChanged::class.java, OnViewRecycled::class.java )
{ "pile_set_name": "Github" }
#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED #define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif // detail/sp_counted_base_sync.hpp - g++ 4.1+ __sync intrinsics // // Copyright (c) 2007 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt #include <boost/detail/sp_typeinfo.hpp> #include <limits.h> #if defined( __ia64__ ) && defined( __INTEL_COMPILER ) # include <ia64intrin.h> #endif namespace boost { namespace detail { #if INT_MAX >= 2147483647 typedef int sp_int32_t; #else typedef long sp_int32_t; #endif inline void atomic_increment( sp_int32_t * pw ) { __sync_fetch_and_add( pw, 1 ); } inline sp_int32_t atomic_decrement( sp_int32_t * pw ) { return __sync_fetch_and_add( pw, -1 ); } inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw ) { // long r = *pw; // if( r != 0 ) ++*pw; // return r; sp_int32_t r = *pw; for( ;; ) { if( r == 0 ) { return r; } sp_int32_t r2 = __sync_val_compare_and_swap( pw, r, r + 1 ); if( r2 == r ) { return r; } else { r = r2; } } } class sp_counted_base { private: sp_counted_base( sp_counted_base const & ); sp_counted_base & operator= ( sp_counted_base const & ); sp_int32_t use_count_; // #shared sp_int32_t weak_count_; // #weak + (#shared != 0) public: sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) { } virtual ~sp_counted_base() // nothrow { } // dispose() is called when use_count_ drops to zero, to release // the resources managed by *this. virtual void dispose() = 0; // nothrow // destroy() is called when weak_count_ drops to zero. virtual void destroy() // nothrow { delete this; } virtual void * get_deleter( sp_typeinfo const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() { atomic_increment( &use_count_ ); } bool add_ref_lock() // true on success { return atomic_conditional_increment( &use_count_ ) != 0; } void release() // nothrow { if( atomic_decrement( &use_count_ ) == 1 ) { dispose(); weak_release(); } } void weak_add_ref() // nothrow { atomic_increment( &weak_count_ ); } void weak_release() // nothrow { if( atomic_decrement( &weak_count_ ) == 1 ) { destroy(); } } long use_count() const // nothrow { return const_cast< sp_int32_t const volatile & >( use_count_ ); } }; } // namespace detail } // namespace boost #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED
{ "pile_set_name": "Github" }
import AppKit import Foundation // MARK: - PublishNeedsAuth public class PublishNeedsAuth: NSBox { // MARK: Lifecycle public init(_ parameters: Parameters) { self.parameters = parameters super.init(frame: .zero) setUpViews() setUpConstraints() update() } public convenience init(workspaceName: String) { self.init(Parameters(workspaceName: workspaceName)) } public convenience init() { self.init(Parameters()) } public required init?(coder aDecoder: NSCoder) { self.parameters = Parameters() super.init(coder: aDecoder) setUpViews() setUpConstraints() update() } // MARK: Public public var workspaceName: String { get { return parameters.workspaceName } set { if parameters.workspaceName != newValue { parameters.workspaceName = newValue } } } public var onClickGithubButton: (() -> Void)? { get { return parameters.onClickGithubButton } set { parameters.onClickGithubButton = newValue } } public var onClickGoogleButton: (() -> Void)? { get { return parameters.onClickGoogleButton } set { parameters.onClickGoogleButton = newValue } } public var parameters: Parameters { didSet { if parameters != oldValue { update() } } } // MARK: Private private var titleContainerView = NSBox() private var publishTextView = LNATextField(labelWithString: "") private var workspaceTitleView = LNATextField(labelWithString: "") private var vSpacerView = NSBox() private var bodyTextView = LNATextField(labelWithString: "") private var vSpacer1View = NSBox() private var viewView = NSBox() private var gitHubButtonView = PrimaryButton() private var vSpacer2View = NSBox() private var googleButtonView = PrimaryButton() private var publishTextViewTextStyle = TextStyles.titleLight private var workspaceTitleViewTextStyle = TextStyles.title private var bodyTextViewTextStyle = TextStyles.body private func setUpViews() { boxType = .custom borderType = .noBorder contentViewMargins = .zero titleContainerView.boxType = .custom titleContainerView.borderType = .noBorder titleContainerView.contentViewMargins = .zero vSpacerView.boxType = .custom vSpacerView.borderType = .noBorder vSpacerView.contentViewMargins = .zero bodyTextView.lineBreakMode = .byWordWrapping vSpacer1View.boxType = .custom vSpacer1View.borderType = .noBorder vSpacer1View.contentViewMargins = .zero viewView.boxType = .custom viewView.borderType = .noBorder viewView.contentViewMargins = .zero publishTextView.lineBreakMode = .byWordWrapping workspaceTitleView.lineBreakMode = .byWordWrapping vSpacer2View.boxType = .custom vSpacer2View.borderType = .noBorder vSpacer2View.contentViewMargins = .zero addSubview(titleContainerView) addSubview(vSpacerView) addSubview(bodyTextView) addSubview(vSpacer1View) addSubview(viewView) titleContainerView.addSubview(publishTextView) titleContainerView.addSubview(workspaceTitleView) viewView.addSubview(gitHubButtonView) viewView.addSubview(vSpacer2View) viewView.addSubview(googleButtonView) publishTextView.attributedStringValue = publishTextViewTextStyle.apply(to: "Publish ") publishTextViewTextStyle = TextStyles.titleLight publishTextView.attributedStringValue = publishTextViewTextStyle.apply(to: publishTextView.attributedStringValue) workspaceTitleViewTextStyle = TextStyles.title workspaceTitleView.attributedStringValue = workspaceTitleViewTextStyle.apply(to: workspaceTitleView.attributedStringValue) vSpacerView.fillColor = #colorLiteral(red: 0.847058823529, green: 0.847058823529, blue: 0.847058823529, alpha: 1) bodyTextView.attributedStringValue = bodyTextViewTextStyle .apply(to: "Lona can automatically generate a website and design/code libraries from your workspace. In order to do this, you’ll need to connect a GitHub or Google account.") bodyTextViewTextStyle = TextStyles.body bodyTextView.attributedStringValue = bodyTextViewTextStyle.apply(to: bodyTextView.attributedStringValue) vSpacer1View.fillColor = #colorLiteral(red: 0.847058823529, green: 0.847058823529, blue: 0.847058823529, alpha: 1) gitHubButtonView.titleText = "Sign in with GitHub" vSpacer2View.fillColor = #colorLiteral(red: 0.847058823529, green: 0.847058823529, blue: 0.847058823529, alpha: 1) googleButtonView.titleText = "Sign in with Google" } private func setUpConstraints() { translatesAutoresizingMaskIntoConstraints = false titleContainerView.translatesAutoresizingMaskIntoConstraints = false vSpacerView.translatesAutoresizingMaskIntoConstraints = false bodyTextView.translatesAutoresizingMaskIntoConstraints = false vSpacer1View.translatesAutoresizingMaskIntoConstraints = false viewView.translatesAutoresizingMaskIntoConstraints = false publishTextView.translatesAutoresizingMaskIntoConstraints = false workspaceTitleView.translatesAutoresizingMaskIntoConstraints = false gitHubButtonView.translatesAutoresizingMaskIntoConstraints = false vSpacer2View.translatesAutoresizingMaskIntoConstraints = false googleButtonView.translatesAutoresizingMaskIntoConstraints = false let titleContainerViewTopAnchorConstraint = titleContainerView.topAnchor.constraint(equalTo: topAnchor) let titleContainerViewLeadingAnchorConstraint = titleContainerView.leadingAnchor.constraint(equalTo: leadingAnchor) let titleContainerViewTrailingAnchorConstraint = titleContainerView .trailingAnchor .constraint(equalTo: trailingAnchor) let vSpacerViewTopAnchorConstraint = vSpacerView.topAnchor.constraint(equalTo: titleContainerView.bottomAnchor) let vSpacerViewLeadingAnchorConstraint = vSpacerView.leadingAnchor.constraint(equalTo: leadingAnchor) let bodyTextViewTopAnchorConstraint = bodyTextView.topAnchor.constraint(equalTo: vSpacerView.bottomAnchor) let bodyTextViewLeadingAnchorConstraint = bodyTextView.leadingAnchor.constraint(equalTo: leadingAnchor) let bodyTextViewTrailingAnchorConstraint = bodyTextView.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor) let vSpacer1ViewTopAnchorConstraint = vSpacer1View.topAnchor.constraint(equalTo: bodyTextView.bottomAnchor) let vSpacer1ViewLeadingAnchorConstraint = vSpacer1View.leadingAnchor.constraint(equalTo: leadingAnchor) let viewViewBottomAnchorConstraint = viewView.bottomAnchor.constraint(equalTo: bottomAnchor) let viewViewTopAnchorConstraint = viewView.topAnchor.constraint(equalTo: vSpacer1View.bottomAnchor) let viewViewLeadingAnchorConstraint = viewView.leadingAnchor.constraint(equalTo: leadingAnchor) let publishTextViewHeightAnchorParentConstraint = publishTextView .heightAnchor .constraint(lessThanOrEqualTo: titleContainerView.heightAnchor) let workspaceTitleViewHeightAnchorParentConstraint = workspaceTitleView .heightAnchor .constraint(lessThanOrEqualTo: titleContainerView.heightAnchor) let publishTextViewLeadingAnchorConstraint = publishTextView .leadingAnchor .constraint(equalTo: titleContainerView.leadingAnchor) let publishTextViewTopAnchorConstraint = publishTextView.topAnchor.constraint(equalTo: titleContainerView.topAnchor) let publishTextViewBottomAnchorConstraint = publishTextView .bottomAnchor .constraint(equalTo: titleContainerView.bottomAnchor) let workspaceTitleViewLeadingAnchorConstraint = workspaceTitleView .leadingAnchor .constraint(equalTo: publishTextView.trailingAnchor) let workspaceTitleViewTopAnchorConstraint = workspaceTitleView .topAnchor .constraint(equalTo: titleContainerView.topAnchor) let workspaceTitleViewBottomAnchorConstraint = workspaceTitleView .bottomAnchor .constraint(equalTo: titleContainerView.bottomAnchor) let vSpacerViewHeightAnchorConstraint = vSpacerView.heightAnchor.constraint(equalToConstant: 32) let vSpacerViewWidthAnchorConstraint = vSpacerView.widthAnchor.constraint(equalToConstant: 0) let vSpacer1ViewHeightAnchorConstraint = vSpacer1View.heightAnchor.constraint(equalToConstant: 72) let vSpacer1ViewWidthAnchorConstraint = vSpacer1View.widthAnchor.constraint(equalToConstant: 0) let viewViewWidthAnchorConstraint = viewView.widthAnchor.constraint(equalToConstant: 250) let gitHubButtonViewTopAnchorConstraint = gitHubButtonView.topAnchor.constraint(equalTo: viewView.topAnchor) let gitHubButtonViewLeadingAnchorConstraint = gitHubButtonView .leadingAnchor .constraint(equalTo: viewView.leadingAnchor) let gitHubButtonViewTrailingAnchorConstraint = gitHubButtonView .trailingAnchor .constraint(equalTo: viewView.trailingAnchor) let vSpacer2ViewTopAnchorConstraint = vSpacer2View.topAnchor.constraint(equalTo: gitHubButtonView.bottomAnchor) let vSpacer2ViewLeadingAnchorConstraint = vSpacer2View.leadingAnchor.constraint(equalTo: viewView.leadingAnchor) let googleButtonViewBottomAnchorConstraint = googleButtonView .bottomAnchor .constraint(equalTo: viewView.bottomAnchor) let googleButtonViewTopAnchorConstraint = googleButtonView.topAnchor.constraint(equalTo: vSpacer2View.bottomAnchor) let googleButtonViewLeadingAnchorConstraint = googleButtonView .leadingAnchor .constraint(equalTo: viewView.leadingAnchor) let googleButtonViewTrailingAnchorConstraint = googleButtonView .trailingAnchor .constraint(equalTo: viewView.trailingAnchor) let vSpacer2ViewHeightAnchorConstraint = vSpacer2View.heightAnchor.constraint(equalToConstant: 8) let vSpacer2ViewWidthAnchorConstraint = vSpacer2View.widthAnchor.constraint(equalToConstant: 0) publishTextViewHeightAnchorParentConstraint.priority = NSLayoutConstraint.Priority.defaultLow workspaceTitleViewHeightAnchorParentConstraint.priority = NSLayoutConstraint.Priority.defaultLow NSLayoutConstraint.activate([ titleContainerViewTopAnchorConstraint, titleContainerViewLeadingAnchorConstraint, titleContainerViewTrailingAnchorConstraint, vSpacerViewTopAnchorConstraint, vSpacerViewLeadingAnchorConstraint, bodyTextViewTopAnchorConstraint, bodyTextViewLeadingAnchorConstraint, bodyTextViewTrailingAnchorConstraint, vSpacer1ViewTopAnchorConstraint, vSpacer1ViewLeadingAnchorConstraint, viewViewBottomAnchorConstraint, viewViewTopAnchorConstraint, viewViewLeadingAnchorConstraint, publishTextViewHeightAnchorParentConstraint, workspaceTitleViewHeightAnchorParentConstraint, publishTextViewLeadingAnchorConstraint, publishTextViewTopAnchorConstraint, publishTextViewBottomAnchorConstraint, workspaceTitleViewLeadingAnchorConstraint, workspaceTitleViewTopAnchorConstraint, workspaceTitleViewBottomAnchorConstraint, vSpacerViewHeightAnchorConstraint, vSpacerViewWidthAnchorConstraint, vSpacer1ViewHeightAnchorConstraint, vSpacer1ViewWidthAnchorConstraint, viewViewWidthAnchorConstraint, gitHubButtonViewTopAnchorConstraint, gitHubButtonViewLeadingAnchorConstraint, gitHubButtonViewTrailingAnchorConstraint, vSpacer2ViewTopAnchorConstraint, vSpacer2ViewLeadingAnchorConstraint, googleButtonViewBottomAnchorConstraint, googleButtonViewTopAnchorConstraint, googleButtonViewLeadingAnchorConstraint, googleButtonViewTrailingAnchorConstraint, vSpacer2ViewHeightAnchorConstraint, vSpacer2ViewWidthAnchorConstraint ]) } private func update() { workspaceTitleView.attributedStringValue = workspaceTitleViewTextStyle.apply(to: workspaceName) gitHubButtonView.onClick = handleOnClickGithubButton googleButtonView.onClick = handleOnClickGoogleButton } private func handleOnClickGithubButton() { onClickGithubButton?() } private func handleOnClickGoogleButton() { onClickGoogleButton?() } } // MARK: - Parameters extension PublishNeedsAuth { public struct Parameters: Equatable { public var workspaceName: String public var onClickGithubButton: (() -> Void)? public var onClickGoogleButton: (() -> Void)? public init( workspaceName: String, onClickGithubButton: (() -> Void)? = nil, onClickGoogleButton: (() -> Void)? = nil) { self.workspaceName = workspaceName self.onClickGithubButton = onClickGithubButton self.onClickGoogleButton = onClickGoogleButton } public init() { self.init(workspaceName: "") } public static func ==(lhs: Parameters, rhs: Parameters) -> Bool { return lhs.workspaceName == rhs.workspaceName } } } // MARK: - Model extension PublishNeedsAuth { public struct Model: LonaViewModel, Equatable { public var id: String? public var parameters: Parameters public var type: String { return "PublishNeedsAuth" } public init(id: String? = nil, parameters: Parameters) { self.id = id self.parameters = parameters } public init(_ parameters: Parameters) { self.parameters = parameters } public init( workspaceName: String, onClickGithubButton: (() -> Void)? = nil, onClickGoogleButton: (() -> Void)? = nil) { self .init( Parameters( workspaceName: workspaceName, onClickGithubButton: onClickGithubButton, onClickGoogleButton: onClickGoogleButton)) } public init() { self.init(workspaceName: "") } } }
{ "pile_set_name": "Github" }
/* Generated by RuntimeBrowser Image: /System/Library/PrivateFrameworks/SAObjects.framework/SAObjects */ @interface SASettingSetBrightness : SASettingSetFloat + (id)setBrightness; + (id)setBrightnessWithDictionary:(id)arg1 context:(id)arg2; - (id)encodedClassName; - (id)groupIdentifier; - (bool)requiresResponse; @end
{ "pile_set_name": "Github" }
{ "private": true, "dependencies": { "@types/jest": "24.0.13", "@types/node": "12.0.2", "@types/react": "16.8.17", "@types/react-dom": "16.8.4", "jqwidgets-scripts": "^7.2.0", "react": "^16.8.6", "react-dom": "^16.8.6", "react-scripts": "3.0.1", "typescript": "3.4.5" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }
{ "pile_set_name": "Github" }
// // UIXTextEntry.m // Viewer v1.0.0 // // Created by Julius Oklamcak on 2012-09-01. // Copyright © 2011-2013 Julius Oklamcak. All rights reserved. // // 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. // #import "UIXTextEntry.h" #import <QuartzCore/QuartzCore.h> @interface UIXTextEntry () <UITextFieldDelegate> @end @implementation UIXTextEntry { UIView *theDialogView; UIView *theContentView; UIToolbar *theToolbar; UILabel *theTitleLabel; UITextField *theTextField; UIBarButtonItem *theDoneButton; UILabel *theStatusLabel; NSInteger visibleCenterY; NSInteger hiddenCenterY; } #pragma mark Constants #define TITLE_X 80.0f #define TITLE_Y 12.0f #define TITLE_HEIGHT 20.0f #define CONTENT_X 16.0f #define TEXT_FIELD_Y 80.0f #define TEXT_FIELD_HEIGHT 27.0f #define STATUS_LABEL_Y 118.0f #define STATUS_LABEL_HEIGHT 20.0f #define TOOLBAR_HEIGHT 44.0f #define DIALOG_WIDTH_LARGE 448.0f #define DIALOG_WIDTH_SMALL 304.0f #define DIALOG_HEIGHT 152.0f #define TEXT_LENGTH_LIMIT 128 #define DEFAULT_DURATION 0.3 #pragma mark Properties @synthesize delegate; #pragma mark UIXTextEntry instance methods - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { self.autoresizesSubviews = YES; self.userInteractionEnabled = NO; self.contentMode = UIViewContentModeRedraw; self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.36f]; // View tint self.hidden = YES; self.alpha = 0.0f; // Start hidden BOOL large = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad); visibleCenterY = (large ? (DIALOG_HEIGHT * 1.25f) : (DIALOG_HEIGHT - (TOOLBAR_HEIGHT / 2.0f))); CGFloat dialogWidth = (large ? DIALOG_WIDTH_LARGE : DIALOG_WIDTH_SMALL); // Dialog width CGFloat dialogY = (0.0f - DIALOG_HEIGHT); // Start off screen CGFloat dialogX = ((self.bounds.size.width - dialogWidth) / 2.0f); CGRect dialogRect = CGRectMake(dialogX, dialogY, dialogWidth, DIALOG_HEIGHT); theDialogView = [[UIView alloc] initWithFrame:dialogRect]; hiddenCenterY = theDialogView.center.y; theDialogView.autoresizesSubviews = NO; theDialogView.contentMode = UIViewContentModeRedraw; theDialogView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; theDialogView.backgroundColor = [UIColor clearColor]; theDialogView.layer.shadowRadius = 3.0f; theDialogView.layer.shadowOpacity = 1.0f; theDialogView.layer.shadowOffset = CGSizeMake(0.0f, 2.0f); theDialogView.layer.shadowPath = [UIBezierPath bezierPathWithRect:theDialogView.bounds].CGPath; theContentView = [[UIView alloc] initWithFrame:theDialogView.bounds]; theContentView.autoresizesSubviews = NO; theContentView.contentMode = UIViewContentModeRedraw; theContentView.autoresizingMask = UIViewAutoresizingNone; theContentView.backgroundColor = [UIColor whiteColor]; CGRect toolbarRect = theContentView.bounds; toolbarRect.size.height = TOOLBAR_HEIGHT; theToolbar = [[UIToolbar alloc] initWithFrame:toolbarRect]; theToolbar.autoresizingMask = UIViewAutoresizingNone; theToolbar.barStyle = UIBarStyleBlack; theToolbar.translucent = YES; UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done", @"button") style:UIBarButtonItemStyleDone target:self action:@selector(doneButtonTapped:)]; theDoneButton = doneButton; doneButton.enabled = NO; // Disable button UIBarButtonItem *exitButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel", @"button") style:UIBarButtonItemStyleBordered target:self action:@selector(cancelButtonTapped:)]; UIBarButtonItem *flexiSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL]; theToolbar.items = [NSArray arrayWithObjects:exitButton, flexiSpace, doneButton, nil]; [theContentView addSubview:theToolbar]; // Add toolbar to view CGFloat titleWidth = (theToolbar.bounds.size.width - (TITLE_X + TITLE_X)); CGRect titleRect = CGRectMake(TITLE_X, TITLE_Y, titleWidth, TITLE_HEIGHT); theTitleLabel = [[UILabel alloc] initWithFrame:titleRect]; theTitleLabel.textAlignment = NSTextAlignmentCenter; theTitleLabel.backgroundColor = [UIColor clearColor]; theTitleLabel.font = [UIFont systemFontOfSize:17.0f]; theTitleLabel.textColor = [UIColor whiteColor]; theTitleLabel.adjustsFontSizeToFitWidth = YES; theTitleLabel.minimumScaleFactor = 15.0f/17.f; [theContentView addSubview:theTitleLabel]; // Add label to view CGFloat contentWidth = (theContentView.bounds.size.width - (CONTENT_X + CONTENT_X)); CGRect fieldRect = CGRectMake(CONTENT_X, TEXT_FIELD_Y, contentWidth, TEXT_FIELD_HEIGHT); theTextField = [[UITextField alloc] initWithFrame:fieldRect]; theTextField.returnKeyType = UIReturnKeyDone; theTextField.enablesReturnKeyAutomatically = YES; theTextField.autocorrectionType = UITextAutocorrectionTypeNo; theTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; theTextField.clearButtonMode = UITextFieldViewModeWhileEditing; theTextField.borderStyle = UITextBorderStyleRoundedRect; theTextField.font = [UIFont systemFontOfSize:17.0f]; theTextField.delegate = self; [theContentView addSubview:theTextField]; // Add text field to view CGRect statusRect = CGRectMake(CONTENT_X, STATUS_LABEL_Y, contentWidth, STATUS_LABEL_HEIGHT); theStatusLabel = [[UILabel alloc] initWithFrame:statusRect]; theStatusLabel.textAlignment = NSTextAlignmentCenter; theStatusLabel.backgroundColor = [UIColor clearColor]; theStatusLabel.font = [UIFont systemFontOfSize:16.0f]; theStatusLabel.textColor = [UIColor grayColor]; theStatusLabel.adjustsFontSizeToFitWidth = YES; theStatusLabel.minimumScaleFactor = 14.0f/16.f; [theContentView addSubview:theStatusLabel]; [theDialogView addSubview:theContentView]; [self addSubview:theDialogView]; } return self; } - (void)setStatus:(NSString *)text { theStatusLabel.text = text; // Update status text } - (void)setTextField:(NSString *)text { theDoneButton.enabled = ((text.length > 0) ? YES : NO); theTextField.text = text; // Update text field text } - (void)setTitle:(NSString *)text withType:(UIXTextEntryType)type { theTitleLabel.text = text; // Update title text [self setStatus:nil]; [self setTextField:nil]; // Clear switch (type) // UIXTextEntry keyboard type settings { case UIXTextEntryTypeURL: // URL input settings { theTextField.keyboardType = UIKeyboardTypeURL; theTextField.autocorrectionType = UITextAutocorrectionTypeNo; theTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; theTextField.secureTextEntry = NO; break; } case UIXTextEntryTypeText: // Text input settings { theTextField.keyboardType = UIKeyboardTypeDefault; theTextField.autocorrectionType = UITextAutocorrectionTypeDefault; theTextField.autocapitalizationType = UITextAutocapitalizationTypeWords; theTextField.secureTextEntry = NO; break; } case UIXTextEntryTypeSecure: // Secure input settings { theTextField.keyboardType = UIKeyboardTypeDefault; theTextField.autocorrectionType = UITextAutocorrectionTypeNo; theTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; theTextField.secureTextEntry = YES; break; } } } - (void)animateHide { if (self.hidden == NO) // Visible { self.userInteractionEnabled = NO; [theTextField resignFirstResponder]; // Hide keyboard [UIView animateWithDuration:DEFAULT_DURATION delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^(void) { self.alpha = 0.0f; // Fade out CGPoint location = theDialogView.center; location.y = hiddenCenterY; // Off screen Y theDialogView.center = location; } completion:^(BOOL finished) { self.hidden = YES; } ]; } } - (void)animateShow { if (self.hidden == YES) // Hidden { self.hidden = NO; // Show hidden views [UIView animateWithDuration:DEFAULT_DURATION delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^(void) { self.alpha = 1.0f; // Fade in CGPoint location = theDialogView.center; location.y = visibleCenterY; // On screen Y theDialogView.center = location; } completion:^(BOOL finished) { self.userInteractionEnabled = YES; } ]; [theTextField becomeFirstResponder]; // Show keyboard } } #pragma mark UITextFieldDelegate methods - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { NSInteger insertDelta = (string.length - range.length); NSInteger editedLength = (textField.text.length + insertDelta); theDoneButton.enabled = ((editedLength > 0) ? YES : NO); // Button state if (editedLength > TEXT_LENGTH_LIMIT) // Limit input text field to length { if (string.length == 1) // Check for return as the final character { NSCharacterSet *newLines = [NSCharacterSet newlineCharacterSet]; NSRange rangeOfCharacterSet = [string rangeOfCharacterFromSet:newLines]; if (rangeOfCharacterSet.location != NSNotFound) return TRUE; } return FALSE; } else return TRUE; } - (BOOL)textFieldShouldReturn:(UITextField *)textField { NSCharacterSet *trimSet = [NSCharacterSet whitespaceAndNewlineCharacterSet]; theTextField.text = [theTextField.text stringByTrimmingCharactersInSet:trimSet]; BOOL should = [delegate textEntryShouldReturn:self text:theTextField.text]; // Check if (should == YES) [delegate doneButtonTappedInTextEntry:self text:theTextField.text]; return should; } - (BOOL)textFieldShouldClear:(UITextField *)textField { theDoneButton.enabled = NO; // Disable button return YES; } #pragma mark UIBarButtonItem action methods - (void)doneButtonTapped:(id)sender { NSCharacterSet *trimSet = [NSCharacterSet whitespaceAndNewlineCharacterSet]; theTextField.text = [theTextField.text stringByTrimmingCharactersInSet:trimSet]; BOOL should = [delegate textEntryShouldReturn:self text:theTextField.text]; // Check if (should == YES) [delegate doneButtonTappedInTextEntry:self text:theTextField.text]; } - (void)cancelButtonTapped:(id)sender { theTextField.text = nil; theStatusLabel.text = nil; [delegate cancelButtonTappedInTextEntry:self]; } @end
{ "pile_set_name": "Github" }
/* global LeafletWidget, L, Shiny, HTMLWidgets, $ */ function getLocationFilterBounds(locationFilter) { if(locationFilter && locationFilter.getBounds) { var bounds = locationFilter.getBounds(); var boundsJSON = { "sw_lat" : bounds.getSouth(), "sw_lng" : bounds.getWest(), "ne_lat" : bounds.getNorth(), "ne_lng" : bounds.getEast() }; return boundsJSON; } else { return null; } } LeafletWidget.methods.addLocationFilter = function(options) { (function() { var map = this; if(map.locationFilter) { map.locationFilter.remove(); map.locationFilter = null; } if(!$.isEmptyObject(options.bounds)) { options.bounds = L.latLngBounds(options.bounds); } map.locationFilter = new L.LocationFilter(options); map.locationFilter.on("change", function(e) { if (!HTMLWidgets.shinyMode) return; Shiny.onInputChange(map.id+"_location_filter_changed", getLocationFilterBounds(map.locationFilter)); }); map.locationFilter.on("enabled", function(e) { if (!HTMLWidgets.shinyMode) return; Shiny.onInputChange(map.id+"_location_filter_enabled", getLocationFilterBounds(map.locationFilter)); }); map.locationFilter.on("disabled", function(e) { if (!HTMLWidgets.shinyMode) return; Shiny.onInputChange(map.id+"_location_filter_disabled", getLocationFilterBounds(map.locationFilter)); }); map.locationFilter.addTo(map); }).call(this); }; LeafletWidget.methods.removeLocationFilter = function() { (function() { var map = this; if(map.locationFilter) { map.locationFilter.remove(); map.locationFilter = null; } }).call(this); };
{ "pile_set_name": "Github" }
// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package websocket import ( "bufio" "errors" "net" "net/http" "net/url" "strings" "time" ) // HandshakeError describes an error with the handshake from the peer. type HandshakeError struct { message string } func (e HandshakeError) Error() string { return e.message } // Upgrader specifies parameters for upgrading an HTTP connection to a // WebSocket connection. type Upgrader struct { // HandshakeTimeout specifies the duration for the handshake to complete. HandshakeTimeout time.Duration // ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer // size is zero, then a default value of 4096 is used. The I/O buffer sizes // do not limit the size of the messages that can be sent or received. ReadBufferSize, WriteBufferSize int // Subprotocols specifies the server's supported protocols in order of // preference. If this field is set, then the Upgrade method negotiates a // subprotocol by selecting the first match in this list with a protocol // requested by the client. Subprotocols []string // Error specifies the function for generating HTTP error responses. If Error // is nil, then http.Error is used to generate the HTTP response. Error func(w http.ResponseWriter, r *http.Request, status int, reason error) // CheckOrigin returns true if the request Origin header is acceptable. If // CheckOrigin is nil, the host in the Origin header must not be set or // must match the host of the request. CheckOrigin func(r *http.Request) bool } func (u *Upgrader) returnError(w http.ResponseWriter, r *http.Request, status int, reason string) (*Conn, error) { err := HandshakeError{reason} if u.Error != nil { u.Error(w, r, status, err) } else { w.Header().Set("Sec-Websocket-Version", "13") http.Error(w, http.StatusText(status), status) } return nil, err } // checkSameOrigin returns true if the origin is not set or is equal to the request host. func checkSameOrigin(r *http.Request) bool { origin := r.Header["Origin"] if len(origin) == 0 { return true } u, err := url.Parse(origin[0]) if err != nil { return false } return u.Host == r.Host } func (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header) string { if u.Subprotocols != nil { clientProtocols := Subprotocols(r) for _, serverProtocol := range u.Subprotocols { for _, clientProtocol := range clientProtocols { if clientProtocol == serverProtocol { return clientProtocol } } } } else if responseHeader != nil { return responseHeader.Get("Sec-Websocket-Protocol") } return "" } // Upgrade upgrades the HTTP server connection to the WebSocket protocol. // // The responseHeader is included in the response to the client's upgrade // request. Use the responseHeader to specify cookies (Set-Cookie) and the // application negotiated subprotocol (Sec-Websocket-Protocol). // // If the upgrade fails, then Upgrade replies to the client with an HTTP error // response. func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (*Conn, error) { if r.Method != "GET" { return u.returnError(w, r, http.StatusMethodNotAllowed, "websocket: method not GET") } if !tokenListContainsValue(r.Header, "Sec-Websocket-Version", "13") { return u.returnError(w, r, http.StatusBadRequest, "websocket: version != 13") } if !tokenListContainsValue(r.Header, "Connection", "upgrade") { return u.returnError(w, r, http.StatusBadRequest, "websocket: could not find connection header with token 'upgrade'") } if !tokenListContainsValue(r.Header, "Upgrade", "websocket") { return u.returnError(w, r, http.StatusBadRequest, "websocket: could not find upgrade header with token 'websocket'") } checkOrigin := u.CheckOrigin if checkOrigin == nil { checkOrigin = checkSameOrigin } if !checkOrigin(r) { return u.returnError(w, r, http.StatusForbidden, "websocket: origin not allowed") } challengeKey := r.Header.Get("Sec-Websocket-Key") if challengeKey == "" { return u.returnError(w, r, http.StatusBadRequest, "websocket: key missing or blank") } subprotocol := u.selectSubprotocol(r, responseHeader) var ( netConn net.Conn br *bufio.Reader err error ) h, ok := w.(http.Hijacker) if !ok { return u.returnError(w, r, http.StatusInternalServerError, "websocket: response does not implement http.Hijacker") } var rw *bufio.ReadWriter netConn, rw, err = h.Hijack() if err != nil { return u.returnError(w, r, http.StatusInternalServerError, err.Error()) } br = rw.Reader if br.Buffered() > 0 { netConn.Close() return nil, errors.New("websocket: client sent data before handshake is complete") } c := newConn(netConn, true, u.ReadBufferSize, u.WriteBufferSize) c.subprotocol = subprotocol p := c.writeBuf[:0] p = append(p, "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: "...) p = append(p, computeAcceptKey(challengeKey)...) p = append(p, "\r\n"...) if c.subprotocol != "" { p = append(p, "Sec-Websocket-Protocol: "...) p = append(p, c.subprotocol...) p = append(p, "\r\n"...) } for k, vs := range responseHeader { if k == "Sec-Websocket-Protocol" { continue } for _, v := range vs { p = append(p, k...) p = append(p, ": "...) for i := 0; i < len(v); i++ { b := v[i] if b <= 31 { // prevent response splitting. b = ' ' } p = append(p, b) } p = append(p, "\r\n"...) } } p = append(p, "\r\n"...) // Clear deadlines set by HTTP server. netConn.SetDeadline(time.Time{}) if u.HandshakeTimeout > 0 { netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout)) } if _, err = netConn.Write(p); err != nil { netConn.Close() return nil, err } if u.HandshakeTimeout > 0 { netConn.SetWriteDeadline(time.Time{}) } return c, nil } // Upgrade upgrades the HTTP server connection to the WebSocket protocol. // // This function is deprecated, use websocket.Upgrader instead. // // The application is responsible for checking the request origin before // calling Upgrade. An example implementation of the same origin policy is: // // if req.Header.Get("Origin") != "http://"+req.Host { // http.Error(w, "Origin not allowed", 403) // return // } // // If the endpoint supports subprotocols, then the application is responsible // for negotiating the protocol used on the connection. Use the Subprotocols() // function to get the subprotocols requested by the client. Use the // Sec-Websocket-Protocol response header to specify the subprotocol selected // by the application. // // The responseHeader is included in the response to the client's upgrade // request. Use the responseHeader to specify cookies (Set-Cookie) and the // negotiated subprotocol (Sec-Websocket-Protocol). // // The connection buffers IO to the underlying network connection. The // readBufSize and writeBufSize parameters specify the size of the buffers to // use. Messages can be larger than the buffers. // // If the request is not a valid WebSocket handshake, then Upgrade returns an // error of type HandshakeError. Applications should handle this error by // replying to the client with an HTTP error response. func Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header, readBufSize, writeBufSize int) (*Conn, error) { u := Upgrader{ReadBufferSize: readBufSize, WriteBufferSize: writeBufSize} u.Error = func(w http.ResponseWriter, r *http.Request, status int, reason error) { // don't return errors to maintain backwards compatibility } u.CheckOrigin = func(r *http.Request) bool { // allow all connections by default return true } return u.Upgrade(w, r, responseHeader) } // Subprotocols returns the subprotocols requested by the client in the // Sec-Websocket-Protocol header. func Subprotocols(r *http.Request) []string { h := strings.TrimSpace(r.Header.Get("Sec-Websocket-Protocol")) if h == "" { return nil } protocols := strings.Split(h, ",") for i := range protocols { protocols[i] = strings.TrimSpace(protocols[i]) } return protocols } // IsWebSocketUpgrade returns true if the client requested upgrade to the // WebSocket protocol. func IsWebSocketUpgrade(r *http.Request) bool { return tokenListContainsValue(r.Header, "Connection", "upgrade") && tokenListContainsValue(r.Header, "Upgrade", "websocket") }
{ "pile_set_name": "Github" }
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. namespace Microsoft.Intune.PowerShellGraphSDK.PowerShellCmdlets { using System.Management.Automation; /// <summary> /// <para type="synopsis">Creates a new object which represents a &quot;microsoft.graph.edgeSearchEngineBase&quot; (or one of its derived types).</para> /// <para type="description">Creates a new object which represents a &quot;microsoft.graph.edgeSearchEngineBase&quot; (or one of its derived types).</para> /// </summary> [Cmdlet("New", "EdgeSearchEngineBaseObject", DefaultParameterSetName = @"microsoft.graph.edgeSearchEngineBase")] [ODataType("microsoft.graph.edgeSearchEngineBase")] public class New_EdgeSearchEngineBaseObject : ObjectFactoryCmdletBase { /// <summary> /// <para type="description">A switch parameter for selecting the parameter set which corresponds to the &quot;microsoft.graph.edgeSearchEngine&quot; type.</para> /// </summary> [Selectable] [Expandable] [ParameterSetSelector(@"microsoft.graph.edgeSearchEngine")] [Parameter(ParameterSetName = @"microsoft.graph.edgeSearchEngine", Mandatory = true, HelpMessage = @"A switch parameter for selecting the parameter set which corresponds to the &quot;microsoft.graph.edgeSearchEngine&quot; type.")] public System.Management.Automation.SwitchParameter edgeSearchEngine { get; set; } /// <summary> /// <para type="description">The &quot;edgeSearchEngineType&quot; property, of type &quot;microsoft.graph.edgeSearchEngineType&quot;.</para> /// <para type="description">This property is on the &quot;microsoft.graph.edgeSearchEngine&quot; type.</para> /// <para type="description">Allows IT admins to set a predefined default search engine for MDM-Controlled devices.</para> /// <para type="description"> /// Valid values: &apos;default&apos;, &apos;bing&apos; /// </para> /// </summary> [ODataType("microsoft.graph.edgeSearchEngineType")] [Selectable] [ValidateSet(@"default", @"bing")] [Parameter(ParameterSetName = @"microsoft.graph.edgeSearchEngine", HelpMessage = @"The &quot;edgeSearchEngineType&quot; property, of type &quot;microsoft.graph.edgeSearchEngineType&quot;.")] public System.String edgeSearchEngineType { get; set; } /// <summary> /// <para type="description">A switch parameter for selecting the parameter set which corresponds to the &quot;microsoft.graph.edgeSearchEngineCustom&quot; type.</para> /// </summary> [Selectable] [Expandable] [ParameterSetSelector(@"microsoft.graph.edgeSearchEngineCustom")] [Parameter(ParameterSetName = @"microsoft.graph.edgeSearchEngineCustom", Mandatory = true, HelpMessage = @"A switch parameter for selecting the parameter set which corresponds to the &quot;microsoft.graph.edgeSearchEngineCustom&quot; type.")] public System.Management.Automation.SwitchParameter edgeSearchEngineCustom { get; set; } /// <summary> /// <para type="description">The &quot;edgeSearchEngineOpenSearchXmlUrl&quot; property, of type &quot;Edm.String&quot;.</para> /// <para type="description">This property is on the &quot;microsoft.graph.edgeSearchEngineCustom&quot; type.</para> /// <para type="description">Points to a https link containing the OpenSearch xml file that contains, at minimum, the short name and the URL to the search Engine.</para> /// </summary> [ODataType("Edm.String")] [Selectable] [Parameter(ParameterSetName = @"microsoft.graph.edgeSearchEngineCustom", HelpMessage = @"The &quot;edgeSearchEngineOpenSearchXmlUrl&quot; property, of type &quot;Edm.String&quot;.")] public System.String edgeSearchEngineOpenSearchXmlUrl { get; set; } } }
{ "pile_set_name": "Github" }
#!/data/data/com.termux/files/usr/bin/sh set -u PARAM_LIMIT=10 PARAM_OFFSET=0 PARAM_TYPE=inbox PARAMS="" SCRIPTNAME=termux-sms-list SUPPORTED_TYPES="all|inbox|sent|draft|outbox" show_usage () { echo "Usage: $SCRIPTNAME [-d] [-l limit] [-n] [-o offset] [-t type]" echo "List SMS messages." echo " -d show dates when messages were created" echo " -l limit offset in sms list (default: $PARAM_LIMIT)" echo " -n show phone numbers" echo " -o offset offset in sms list (default: $PARAM_OFFSET)" echo " -t type the type of messages to list (default: $PARAM_TYPE):" echo " $SUPPORTED_TYPES" exit 0 } while getopts :hdl:t:no: option do case "$option" in h) show_usage;; d) PARAMS="$PARAMS --ez show-dates true";; l) PARAM_LIMIT=$OPTARG;; n) PARAMS="$PARAMS --ez show-phone-numbers true";; o) PARAM_OFFSET=$OPTARG;; t) PARAM_TYPE=$OPTARG;; ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1; esac done shift $((OPTIND-1)) if [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi case "$PARAM_TYPE" in all) PARAM_TYPE=0 ;; inbox) PARAM_TYPE=1 ;; sent) PARAM_TYPE=2 ;; draft) PARAM_TYPE=3 ;; outbox) PARAM_TYPE=4 ;; *) echo "$SCRIPTNAME: Unsupported type '$PARAM_TYPE'. Use one of: $SUPPORTED_TYPES"; exit 1 ;; esac PARAMS="$PARAMS --ei offset $PARAM_OFFSET --ei limit $PARAM_LIMIT --ei type $PARAM_TYPE" /data/data/com.termux/files/usr/libexec/termux-api SmsInbox $PARAMS
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #pragma mark Blocks typedef void (^CDUnknownBlockType)(void); // return type and parameters are unknown
{ "pile_set_name": "Github" }
/* This is a compiled file, you should be editing the file in the templates directory */ .pace { width: 140px; height: 300px; position: fixed; top: -90px; right: -20px; z-index: 2000; -webkit-transform: scale(0); -moz-transform: scale(0); -ms-transform: scale(0); -o-transform: scale(0); transform: scale(0); opacity: 0; -webkit-transition: all 2s linear 0s; -moz-transition: all 2s linear 0s; transition: all 2s linear 0s; } .pace.pace-active { -webkit-transform: scale(.25); -moz-transform: scale(.25); -ms-transform: scale(.25); -o-transform: scale(.25); transform: scale(.25); opacity: 1; } .pace .pace-activity { width: 140px; height: 140px; border-radius: 70px; background: #e90f92; position: absolute; top: 0; z-index: 1911; -webkit-animation: pace-bounce 1s infinite; -moz-animation: pace-bounce 1s infinite; -o-animation: pace-bounce 1s infinite; -ms-animation: pace-bounce 1s infinite; animation: pace-bounce 1s infinite; } .pace .pace-progress { position: absolute; display: block; left: 50%; bottom: 0; z-index: 1910; margin-left: -30px; width: 60px; height: 75px; background: rgba(20, 20, 20, .1); box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1); border-radius: 30px / 40px; -webkit-transform: scaleY(.3) !important; -moz-transform: scaleY(.3) !important; -ms-transform: scaleY(.3) !important; -o-transform: scaleY(.3) !important; transform: scaleY(.3) !important; -webkit-animation: pace-compress .5s infinite alternate; -moz-animation: pace-compress .5s infinite alternate; -o-animation: pace-compress .5s infinite alternate; -ms-animation: pace-compress .5s infinite alternate; animation: pace-compress .5s infinite alternate; } @-webkit-keyframes pace-bounce { 0% { top: 0; -webkit-animation-timing-function: ease-in; } 40% {} 50% { top: 140px; height: 140px; -webkit-animation-timing-function: ease-out; } 55% { top: 160px; height: 120px; border-radius: 70px / 60px; -webkit-animation-timing-function: ease-in; } 65% { top: 120px; height: 140px; border-radius: 70px; -webkit-animation-timing-function: ease-out; } 95% { top: 0; -webkit-animation-timing-function: ease-in; } 100% { top: 0; -webkit-animation-timing-function: ease-in; } } @-moz-keyframes pace-bounce { 0% { top: 0; -moz-animation-timing-function: ease-in; } 40% {} 50% { top: 140px; height: 140px; -moz-animation-timing-function: ease-out; } 55% { top: 160px; height: 120px; border-radius: 70px / 60px; -moz-animation-timing-function: ease-in; } 65% { top: 120px; height: 140px; border-radius: 70px; -moz-animation-timing-function: ease-out;} 95% { top: 0; -moz-animation-timing-function: ease-in; } 100% {top: 0; -moz-animation-timing-function: ease-in; } } @keyframes pace-bounce { 0% { top: 0; animation-timing-function: ease-in; } 50% { top: 140px; height: 140px; animation-timing-function: ease-out; } 55% { top: 160px; height: 120px; border-radius: 70px / 60px; animation-timing-function: ease-in; } 65% { top: 120px; height: 140px; border-radius: 70px; animation-timing-function: ease-out; } 95% { top: 0; animation-timing-function: ease-in; } 100% { top: 0; animation-timing-function: ease-in; } } @-webkit-keyframes pace-compress { 0% { bottom: 0; margin-left: -30px; width: 60px; height: 75px; background: rgba(20, 20, 20, .1); box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1); border-radius: 30px / 40px; -webkit-animation-timing-function: ease-in; } 100% { bottom: 30px; margin-left: -10px; width: 20px; height: 5px; background: rgba(20, 20, 20, .3); box-shadow: 0 0 20px 35px rgba(20, 20, 20, .3); border-radius: 20px / 20px; -webkit-animation-timing-function: ease-out; } } @-moz-keyframes pace-compress { 0% { bottom: 0; margin-left: -30px; width: 60px; height: 75px; background: rgba(20, 20, 20, .1); box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1); border-radius: 30px / 40px; -moz-animation-timing-function: ease-in; } 100% { bottom: 30px; margin-left: -10px; width: 20px; height: 5px; background: rgba(20, 20, 20, .3); box-shadow: 0 0 20px 35px rgba(20, 20, 20, .3); border-radius: 20px / 20px; -moz-animation-timing-function: ease-out; } } @keyframes pace-compress { 0% { bottom: 0; margin-left: -30px; width: 60px; height: 75px; background: rgba(20, 20, 20, .1); box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1); border-radius: 30px / 40px; animation-timing-function: ease-in; } 100% { bottom: 30px; margin-left: -10px; width: 20px; height: 5px; background: rgba(20, 20, 20, .3); box-shadow: 0 0 20px 35px rgba(20, 20, 20, .3); border-radius: 20px / 20px; animation-timing-function: ease-out; } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2014, salesforce.com, inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided * that the following conditions are met: * * 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 salesforce.com, inc. 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.sforce.dataset.loader; import java.io.PrintStream; import java.util.List; import java.util.concurrent.BlockingQueue; import java.util.concurrent.atomic.AtomicBoolean; import com.sforce.dataset.DatasetUtilConstants; import com.sforce.dataset.flow.monitor.Session; public class WriterThread implements Runnable { private static final int max_error_threshhold = 10000; private final BlockingQueue<List<String>> queue; @SuppressWarnings("deprecation") private final EbinFormatWriter ebinWriter; private final ErrorWriter errorwriter; private final PrintStream logger; private volatile AtomicBoolean done = new AtomicBoolean(false); private volatile AtomicBoolean aborted = new AtomicBoolean(false); private volatile int errorRowCount = 0; private volatile int totalRowCount = 0; Session session = null; @SuppressWarnings("deprecation") WriterThread(BlockingQueue<List<String>> q,EbinFormatWriter w,ErrorWriter ew, PrintStream logger, Session session) { if(q==null || w == null || ew == null || session == null) { throw new IllegalArgumentException("Constructor input cannot be null"); } queue = q; this.ebinWriter = w; this.errorwriter = ew; this.logger = logger; this.session = session; } @SuppressWarnings("deprecation") public void run() { logger.println("Start: " + Thread.currentThread().getName()); try { List<String> row = queue.take(); while (row != null && row.size()!=0) { if(session.isDone()) { throw new DatasetLoaderException("Operation terminated on user request"); } try { totalRowCount++; ebinWriter.addrow(row); }catch(Exception t) { if(errorRowCount==0) { logger.println(); } logger.println("Row {"+totalRowCount+"} has error {"+t+"}"); if(row!=null) { errorRowCount++; if(DatasetUtilConstants.debug) t.printStackTrace(); errorwriter.addError(row, t.getMessage()!=null?t.getMessage():t.toString()); if(errorRowCount>=max_error_threshhold) { logger.println("Max error threshold reached. Aborting processing"); aborted.set(true); queue.clear(); break; } } //t.printStackTrace(); }finally { if(session!=null) { session.setTargetTotalRowCount(totalRowCount); session.setTargetErrorCount(errorRowCount); } } row = queue.take(); } }catch (Throwable t) { logger.println (Thread.currentThread().getName() + " " + t.toString()); aborted.set(true); queue.clear(); }finally { try { ebinWriter.finish(); } catch (Throwable e) { e.printStackTrace(logger); } try { errorwriter.finish(); } catch (Throwable e) { e.printStackTrace(logger); } } logger.println("END: " + Thread.currentThread().getName()); done.set(true); queue.clear(); } public boolean isDone() { return done.get(); } public boolean isAborted() { return aborted.get(); } public int getErrorRowCount() { return errorRowCount; } public int getTotalRowCount() { return totalRowCount; } }
{ "pile_set_name": "Github" }
config guest-wifi option enable '0' option wifi_name 'Guest-WiFi' option interface_name 'guest' option encryption 'psk2' option passwd 'guestnetwork' option interface_ip '192.168.4.1' option isolate '1' option start '50' option limit '200' option leasetime '1h' option device 'radio0' option create '0'
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2015 * Kamil Lulko, <kamil.lulko@gmail.com> */ #include <common.h> #include <status_led.h> #include <asm-generic/gpio.h> void coloured_LED_init(void) { gpio_request(CONFIG_RED_LED, "red led"); gpio_direction_output(CONFIG_RED_LED, 0); gpio_request(CONFIG_GREEN_LED, "green led"); gpio_direction_output(CONFIG_GREEN_LED, 0); } void red_led_off(void) { gpio_set_value(CONFIG_RED_LED, 0); } void green_led_off(void) { gpio_set_value(CONFIG_GREEN_LED, 0); } void red_led_on(void) { gpio_set_value(CONFIG_RED_LED, 1); } void green_led_on(void) { gpio_set_value(CONFIG_GREEN_LED, 1); }
{ "pile_set_name": "Github" }
#include "Lexer.h" #include "Token.h" %token-prefix=T_ %toupper %no-enums %namespace=Lexer %% __asm __asm__ __attribute __attribute__ __const __const__ __inline __inline__ __typeof __typeof__ __volatile __volatile__ asm auto bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename typeof union unsigned using virtual void volatile wchar_t while
{ "pile_set_name": "Github" }
## API Report File for "@bentley/analytical-backend" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts import { ElementRefersToElements } from '@bentley/imodeljs-backend'; import { GeometricElement3d } from '@bentley/imodeljs-backend'; import { GeometricElement3dProps } from '@bentley/imodeljs-common'; import { GeometricModel3d } from '@bentley/imodeljs-backend'; import { IModelDb } from '@bentley/imodeljs-backend'; import { InformationPartitionElement } from '@bentley/imodeljs-backend'; import { Schema } from '@bentley/imodeljs-backend'; import { TypeDefinitionElement } from '@bentley/imodeljs-backend'; import { TypeDefinitionElementProps } from '@bentley/imodeljs-common'; // @beta export abstract class AnalyticalElement extends GeometricElement3d { // @internal constructor(props: GeometricElement3dProps, iModel: IModelDb); // @internal (undocumented) static get className(): string; } // @beta export abstract class AnalyticalModel extends GeometricModel3d { // @internal (undocumented) static get className(): string; } // @beta export class AnalyticalPartition extends InformationPartitionElement { // @internal (undocumented) static get className(): string; } // @beta export class AnalyticalSchema extends Schema { // (undocumented) static registerSchema(): void; // (undocumented) static get schemaFilePath(): string; // (undocumented) static get schemaName(): string; } // @beta export class AnalyticalSimulatesSpatialElement extends ElementRefersToElements { // @internal (undocumented) static get className(): string; } // @beta export abstract class AnalyticalType extends TypeDefinitionElement { // @internal constructor(props: TypeDefinitionElementProps, iModel: IModelDb); // @internal (undocumented) static get className(): string; } // (No @packageDocumentation comment for this package) ```
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Web.Helpers')" > </dependentAssembly> <dependentAssembly xdt:Transform="Remove" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/@name='System.Web.WebPages')" > </dependentAssembly> </assemblyBinding> </runtime> </configuration>
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alipay.sofa.rpc.event; import com.alipay.sofa.rpc.core.request.SofaRequest; /** * ClientStartInvokeEvent * * @author <a href="mailto:zhanggeng.zg@antfin.com">GengZhang</a> */ public class ClientStartInvokeEvent implements Event { private final SofaRequest request; public ClientStartInvokeEvent(SofaRequest request) { this.request = request; } public SofaRequest getRequest() { return request; } }
{ "pile_set_name": "Github" }
import React, { Component, Fragment } from 'react'; import { Card, Row, Col } from 'antd'; import PropTypes from 'prop-types'; import { Line } from './../../component/AntV'; class PieCharts extends Component { constructor(props) { super(props); } componentDidMount() { } render() { var data = [{ year: '1991', value: 3 }, { year: '1992', value: 4 }, { year: '1993', value: 3.5 }, { year: '1994', value: 5 }, { year: '1995', value: 4.9 }, { year: '1996', value: 6 }, { year: '1997', value: 7 }, { year: '1998', value: 9 }, { year: '1999', value: 13 }]; var data2 = [ {country:'china',year:'1999',value:12}, {country:'china',year:'2000',value:18}, {country:'china',year:'2001',value:24}, {country:'china',year:'2002',value:45}, {country:'china',year:'2003',value:55}, {country:'USA',year:'1999',value:16}, {country:'USA',year:'2000',value:18}, {country:'USA',year:'2001',value:38}, {country:'USA',year:'2002',value:66}, {country:'USA',year:'2003',value:88}, {country:'japan',year:'1999',value:7}, {country:'japan',year:'2000',value:14}, {country:'japan',year:'2001',value:22}, {country:'japan',year:'2002',value:35}, {country:'japan',year:'2003',value:56}, ]; return ( <Fragment> <Card style={{ margin: 30 }}> <h1 style={{ textAlign: 'center' }}>Antv 折线图</h1> </Card> <Row style={{ margin: 30 }}> <Col span={12}> <Card> <Line title={'基础折线图'} id={'baseLine'} height={400} data={data} axis={{title:'year',value:'value'}} type={'base'} /> </Card> </Col> </Row> <Row style={{ margin: 30 }}> <Col span={12}> <Card> <Line title={'多条折现图'} id={'multipleLine'} height={400} data={data2} axis={{title:'country',value:'value',Yaxis:'year'}} type={'multiple'} /> </Card> </Col> </Row> </Fragment> ); } } PieCharts.propTypes = {}; export default PieCharts;
{ "pile_set_name": "Github" }
/*============================================================================= Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Hartmut Kaiser http://spirit.sourceforge.net/ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef BOOST_SPIRIT_INCLUDE_QI_REPOSITORY_ITER_POS #define BOOST_SPIRIT_INCLUDE_QI_REPOSITORY_ITER_POS #if defined(_MSC_VER) #pragma once #endif #include <boost/spirit/repository/home/qi/primitive/iter_pos.hpp> #endif
{ "pile_set_name": "Github" }
// ============================== // File: TLog.cp // Project: Einstein // // Copyright 2003-2007 by Paul Guyot (pguyot@kallisys.net). // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // ============================== // $Id$ // ============================== #include "TLog.h" // POSIX & ANSI #include <stdio.h> #include <stdlib.h> #include <stdarg.h> // K #include <K/Threads/TMutex.h> // -------------------------------------------------------------------------- // // Constantes // -------------------------------------------------------------------------- // // -------------------------------------------------------------------------- // // * TLog( void ) // -------------------------------------------------------------------------- // TLog::TLog( void ) : mMutex( NULL ), mEnabled( true ) { mMutex = new TMutex(); } // -------------------------------------------------------------------------- // // * ~TLog( void ) // -------------------------------------------------------------------------- // TLog::~TLog( void ) { if (mMutex) { delete mMutex; } } // -------------------------------------------------------------------------- // // * LogLine( const char* ) // -------------------------------------------------------------------------- // void TLog::LogLine( const char* inLine ) { if (mEnabled) { LockMutex(); DoLogLine( inLine ); UnlockMutex(); } } // -------------------------------------------------------------------------- // // * FLogLine( const char*, ... ) // -------------------------------------------------------------------------- // void TLog::FLogLine( const char* inFormat, ... ) { if (mEnabled) { char bufferLine[512]; va_list argList; va_start(argList, inFormat); (void) ::vsnprintf( bufferLine, sizeof(bufferLine), inFormat, argList ); va_end(argList); LogLine( bufferLine ); } } // ============================================================== // // Unix will self-destruct in five seconds... 4... 3... 2... 1... // // ============================================================== //
{ "pile_set_name": "Github" }
module.exports = require('./isMatch');
{ "pile_set_name": "Github" }
package org.javacord.core.event.message; import org.javacord.api.entity.channel.TextChannel; import org.javacord.api.event.message.ChannelPinsUpdateEvent; import org.javacord.core.event.EventImpl; import java.time.Instant; import java.util.Optional; /** * The implementation of {@link ChannelPinsUpdateEvent}. */ public class ChannelPinsUpdateEventImpl extends EventImpl implements ChannelPinsUpdateEvent { /** * The channel of the event. */ private final TextChannel channel; /** * The time at which the most recent pinned message was pinned. */ private final Instant lastPinTimestamp; /** * Creates a new channel pins update event. * * @param channel The channel of the event. * @param lastPinTimestamp The time at which the most recent pinned message was pinned. */ public ChannelPinsUpdateEventImpl(TextChannel channel, Instant lastPinTimestamp) { super(channel.getApi()); this.channel = channel; this.lastPinTimestamp = lastPinTimestamp; } @Override public TextChannel getChannel() { return channel; } @Override public Optional<Instant> getLastPinTimestamp() { return Optional.ofNullable(lastPinTimestamp); } }
{ "pile_set_name": "Github" }
/* * * Copyright (c) 2013 - 2020 Lijun Liao * * 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 org.xipki.common.test; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import org.xipki.util.IoUtil; import org.xipki.util.StringUtil; /** * Canonicalize the text files. * * @author Lijun Liao * @since 2.0.0 */ public class CanonicalizeCode { private static final List<byte[]> headerLines = new ArrayList<>(20); private static final Set<String> textFileExtensions = new HashSet<>( Arrays.asList("txt", "xml", "xsd", "cfg", "properties", "script", "jxb", "info")); private static final Set<String> excludeTextFiles = new HashSet<>(Arrays.asList("draft-gutmann-scep-00.txt")); private static Throwable initializationError; private final String baseDir; private final int baseDirLen; static { try { BufferedReader reader = Files.newBufferedReader(Paths.get("src/test/resources/HEADER.txt")); String line; while ((line = reader.readLine()) != null) { headerLines.add(StringUtil.toUtf8Bytes(line)); } reader.close(); } catch (Throwable th) { initializationError = th; } } private CanonicalizeCode(String baseDir) { baseDir = IoUtil.expandFilepath(baseDir); this.baseDir = baseDir.endsWith(File.separator) ? baseDir : baseDir + File.separator; this.baseDirLen = this.baseDir.length(); } public static void main(String[] args) { if (initializationError != null) { initializationError.printStackTrace(); return; } for (String arg : args) { try { String baseDir = arg; System.out.println("Canonicalize dir " + baseDir); CanonicalizeCode canonicalizer = new CanonicalizeCode(baseDir); canonicalizer.canonicalize(); canonicalizer.checkWarnings(); } catch (Exception ex) { ex.printStackTrace(); } } } private void canonicalize() throws Exception { canonicalizeDir(new File(baseDir), true); } private void canonicalizeDir(File dir, boolean root) throws Exception { if (!root) { // skip git submodules if (new File(dir, ".git").exists()) { return; } } File[] files = dir.listFiles(); if (files == null) { return; } for (File file : files) { String filename = file.getName(); if (file.isDirectory()) { if (!"target".equals(filename) && !"tbd".equals(filename)) { canonicalizeDir(file, false); } } else { int idx = filename.lastIndexOf('.'); String extension = (idx == -1) ? filename : filename.substring(idx + 1); extension = extension.toLowerCase(); if ("java".equals(extension)) { canonicalizeFile(file); } else if (textFileExtensions.contains(extension) && !excludeTextFiles.contains(filename)) { try { canonicalizeTextFile(file); } catch (Exception ex) { System.err.println("could not canonicalize file " + file); ex.printStackTrace(); } } } } } // method canonicalizeDir private void canonicalizeFile(File file) throws Exception { byte[] newLine = detectNewline(file); BufferedReader reader = Files.newBufferedReader(file.toPath()); ByteArrayOutputStream writer = new ByteArrayOutputStream(); try { String line; boolean skip = true; boolean lastLineEmpty = false; boolean licenseTextAdded = false; boolean thirdparty = false; int lineNumber = 0; while ((line = reader.readLine()) != null) { if (lineNumber == 0 && line.startsWith("// #THIRDPARTY#")) { thirdparty = true; skip = false; } lineNumber++; if (line.trim().startsWith("package ") || line.trim().startsWith("import ")) { if (!licenseTextAdded) { if (!thirdparty) { writeLicenseHeader(writer, newLine); } licenseTextAdded = true; } skip = false; } if (skip) { continue; } String canonicalizedLine = canonicalizeLine(line); boolean addThisLine = true; if (canonicalizedLine.isEmpty()) { if (!lastLineEmpty) { lastLineEmpty = true; } else { addThisLine = false; } } else { lastLineEmpty = false; } if (addThisLine) { writeLine(writer, newLine, canonicalizedLine); } } // end while } finally { writer.close(); reader.close(); } byte[] oldBytes = IoUtil.read(file); byte[] newBytes = writer.toByteArray(); if (!Arrays.equals(oldBytes, newBytes)) { File newFile = new File(file.getPath() + "-new"); IoUtil.save(file, newBytes); newFile.renameTo(file); System.out.println(file.getPath().substring(baseDirLen)); } } // method canonicalizeFile private void canonicalizeTextFile(File file) throws Exception { byte[] newLine = new byte[]{'\n'}; BufferedReader reader = Files.newBufferedReader(file.toPath()); ByteArrayOutputStream writer = new ByteArrayOutputStream(); try { String line; while ((line = reader.readLine()) != null) { String canonicalizedLine = canonicalizeTextLine(line); writeLine(writer, newLine, canonicalizedLine); } // end while } finally { writer.close(); reader.close(); } byte[] oldBytes = IoUtil.read(file); byte[] newBytes = writer.toByteArray(); if (!Arrays.equals(oldBytes, newBytes)) { File newFile = new File(file.getPath() + "-new"); IoUtil.save(file, newBytes); newFile.renameTo(file); System.out.println(file.getPath().substring(baseDirLen)); } } // method canonicalizeTextFile private void checkWarnings() throws Exception { checkWarningsInDir(new File(baseDir), true); } private void checkWarningsInDir(File dir, boolean root) throws Exception { if (!root) { // skip git submodules if (new File(dir, ".git").exists()) { return; } } File[] files = dir.listFiles(); if (files == null) { return; } for (File file : files) { if (file.isDirectory()) { if (!file.getName().equals("target") && !file.getName().equals("tbd")) { checkWarningsInDir(file, false); } continue; } else { String filename = file.getName(); int idx = filename.lastIndexOf('.'); String extension = (idx == -1) ? filename : filename.substring(idx + 1); extension = extension.toLowerCase(); if ("java".equals(extension)) { checkWarningsInFile(file); } } } } // method checkWarningsInDir private void checkWarningsInFile(File file) throws Exception { if (file.getName().equals("package-info.java")) { return; } BufferedReader reader = Files.newBufferedReader(file.toPath()); boolean authorsLineAvailable = false; boolean thirdparty = false; List<Integer> lineNumbers = new LinkedList<>(); int lineNumber = 0; try { String line; while ((line = reader.readLine()) != null) { lineNumber++; if (lineNumber == 1 && line.startsWith("// #THIRDPARTY")) { return; } if (!authorsLineAvailable && line.contains("* @author")) { authorsLineAvailable = true; } if (line.length() > 100 && !line.contains("http")) { lineNumbers.add(lineNumber); } } // end while } finally { reader.close(); } if (!lineNumbers.isEmpty()) { System.out.println("Please check file " + file.getPath().substring(baseDirLen) + ": lines " + Arrays.toString(lineNumbers.toArray(new Integer[0]))); } if (!authorsLineAvailable && !thirdparty) { System.out.println("Please check file " + file.getPath().substring(baseDirLen) + ": no authors line"); } } // method checkWarningsInFile /** * replace tab by 4 spaces, delete white spaces at the end. */ private static String canonicalizeLine(String line) { if (line.trim().startsWith("//")) { // comments String nline = line.replace("\t", " "); return removeTrailingSpaces(nline); } StringBuilder sb = new StringBuilder(); int len = line.length(); int lastNonSpaceCharIndex = 0; int index = 0; for (int i = 0; i < len; i++) { char ch = line.charAt(i); if (ch == '\t') { sb.append(" "); index += 4; } else if (ch == ' ') { sb.append(ch); index++; } else { sb.append(ch); index++; lastNonSpaceCharIndex = index; } } int numSpacesAtEnd = sb.length() - lastNonSpaceCharIndex; if (numSpacesAtEnd > 0) { sb.delete(lastNonSpaceCharIndex, sb.length()); } return sb.toString(); } // end canonicalizeLine /** * replace tab by 4 spaces, delete white spaces at the end. */ private static String canonicalizeTextLine(String line) { return removeTrailingSpaces(line).replaceAll("\t", " "); } // end canonicalizeTextLine private static String removeTrailingSpaces(String line) { final int n = line.length(); int idx; for (idx = n - 1; idx >= 0; idx--) { char ch = line.charAt(idx); if (ch != ' ') { break; } } return (idx == n - 1) ? line : line.substring(0, idx + 1); } // method removeTrailingSpaces private static byte[] detectNewline(File file) throws IOException { InputStream is = Files.newInputStream(file.toPath()); byte[] bytes = new byte[200]; int size; try { size = is.read(bytes); } finally { is.close(); } for (int i = 0; i < size - 1; i++) { byte bb = bytes[i]; if (bb == '\n') { return new byte[]{'\n'}; } else if (bb == '\r') { if (bytes[i + 1] == '\n') { return new byte[]{'\r', '\n'}; } else { return new byte[]{'\r'}; } } } return new byte[]{'\n'}; } private static void writeLicenseHeader(OutputStream out, byte[] newLine) throws IOException { for (byte[] line : headerLines) { if (line.length > 0) { out.write(line); } out.write(newLine); } out.write(newLine); } private static void writeLine(OutputStream out, byte[] newLine, String line) throws IOException { if (StringUtil.isNotBlank(line)) { out.write(StringUtil.toUtf8Bytes(line)); } out.write(newLine); } }
{ "pile_set_name": "Github" }
## commons-math: 1a15d5f4c13eca0435b0ed7e6a624064e7f7e07f ## --- org.apache.commons.math.optimization.direct.BOBYQAOptimizerTest::testAckley junit.framework.AssertionFailedError: expected:<0.0> but was:<1.047765607609108E-8> at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.failNotEquals(Assert.java:743) at org.junit.Assert.assertEquals(Assert.java:494) at org.apache.commons.math.optimization.direct.BOBYQAOptimizerTest.doTest(BOBYQAOptimizerTest.java:326) at org.apache.commons.math.optimization.direct.BOBYQAOptimizerTest.doTest(BOBYQAOptimizerTest.java:276) at org.apache.commons.math.optimization.direct.BOBYQAOptimizerTest.testAckley(BOBYQAOptimizerTest.java:205) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:520) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:1478) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:860) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1964) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute1(JUnitTask.java:812) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:2364) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:392) at org.apache.tools.ant.Target.performTasks(Target.java:413) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:811) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) --- org.apache.commons.math.optimization.direct.BOBYQAOptimizerTest::testDiffPow org.apache.commons.math.exception.TooManyEvaluationsException: illegal state: maximal count (12,000) exceeded: evaluations at org.apache.commons.math.optimization.direct.BaseAbstractMultivariateOptimizer.computeObjectiveValue(BaseAbstractMultivariateOptimizer.java:96) at org.apache.commons.math.optimization.direct.BOBYQAOptimizer.bobyqb(BOBYQAOptimizer.java:826) at org.apache.commons.math.optimization.direct.BOBYQAOptimizer.bobyqa(BOBYQAOptimizer.java:332) at org.apache.commons.math.optimization.direct.BOBYQAOptimizer.doOptimize(BOBYQAOptimizer.java:244) at org.apache.commons.math.optimization.direct.BaseAbstractMultivariateOptimizer.optimize(BaseAbstractMultivariateOptimizer.java:125) at org.apache.commons.math.optimization.direct.BaseAbstractMultivariateSimpleBoundsOptimizer.optimize(BaseAbstractMultivariateSimpleBoundsOptimizer.java:138) at org.apache.commons.math.optimization.direct.BOBYQAOptimizerTest.doTest(BOBYQAOptimizerTest.java:321) at org.apache.commons.math.optimization.direct.BOBYQAOptimizerTest.doTest(BOBYQAOptimizerTest.java:276) at org.apache.commons.math.optimization.direct.BOBYQAOptimizerTest.testDiffPow(BOBYQAOptimizerTest.java:183) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:520) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:1478) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:860) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1964) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute1(JUnitTask.java:812) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:2364) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:392) at org.apache.tools.ant.Target.performTasks(Target.java:413) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:811) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) --- org.apache.commons.math.util.FastMathTest::checkMissingFastMathClasses junit.framework.AssertionFailedError: FastMath should implement all StrictMath methods at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.assertTrue(Assert.java:41) at org.apache.commons.math.util.FastMathTest.checkMissingFastMathClasses(FastMathTest.java:1055) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:520) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:1484) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:872) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1972) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute1(JUnitTask.java:824) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:2277) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:392) at org.apache.tools.ant.Target.performTasks(Target.java:413) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.apache.tools.ant.Main.runBuild(Main.java:811) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
{ "pile_set_name": "Github" }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_DNS_DNS_TEST_UTIL_H_ #define NET_DNS_DNS_TEST_UTIL_H_ #include <stddef.h> #include <stdint.h> #include <memory> #include <string> #include <vector> #include "net/dns/dns_client.h" #include "net/dns/dns_config_service.h" #include "net/dns/dns_protocol.h" namespace net { //----------------------------------------------------------------------------- // Query/response set for www.google.com, ID is fixed to 0. static const char kT0HostName[] = "www.google.com"; static const uint16_t kT0Qtype = dns_protocol::kTypeA; static const char kT0DnsName[] = { 0x03, 'w', 'w', 'w', 0x06, 'g', 'o', 'o', 'g', 'l', 'e', 0x03, 'c', 'o', 'm', 0x00 }; static const size_t kT0QuerySize = 32; static const uint8_t kT0ResponseDatagram[] = { // response contains one CNAME for www.l.google.com and the following // IP addresses: 74.125.226.{179,180,176,177,178} 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x4d, 0x13, 0x00, 0x08, 0x03, 0x77, 0x77, 0x77, 0x01, 0x6c, 0xc0, 0x10, 0xc0, 0x2c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb3, 0xc0, 0x2c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb4, 0xc0, 0x2c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb0, 0xc0, 0x2c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb1, 0xc0, 0x2c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb2}; static const char* const kT0IpAddresses[] = { "74.125.226.179", "74.125.226.180", "74.125.226.176", "74.125.226.177", "74.125.226.178" }; static const char kT0CanonName[] = "www.l.google.com"; static const int kT0TTL = 0x000000e4; // +1 for the CNAME record. static const unsigned kT0RecordCount = arraysize(kT0IpAddresses) + 1; //----------------------------------------------------------------------------- // Query/response set for codereview.chromium.org, ID is fixed to 1. static const char kT1HostName[] = "codereview.chromium.org"; static const uint16_t kT1Qtype = dns_protocol::kTypeA; static const char kT1DnsName[] = { 0x0a, 'c', 'o', 'd', 'e', 'r', 'e', 'v', 'i', 'e', 'w', 0x08, 'c', 'h', 'r', 'o', 'm', 'i', 'u', 'm', 0x03, 'o', 'r', 'g', 0x00 }; static const size_t kT1QuerySize = 41; static const uint8_t kT1ResponseDatagram[] = { // response contains one CNAME for ghs.l.google.com and the following // IP address: 64.233.169.121 0x00, 0x01, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x08, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, 0x03, 0x6f, 0x72, 0x67, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x41, 0x75, 0x00, 0x12, 0x03, 0x67, 0x68, 0x73, 0x01, 0x6c, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0xc0, 0x35, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x0b, 0x00, 0x04, 0x40, 0xe9, 0xa9, 0x79}; static const char* const kT1IpAddresses[] = { "64.233.169.121" }; static const char kT1CanonName[] = "ghs.l.google.com"; static const int kT1TTL = 0x0000010b; // +1 for the CNAME record. static const unsigned kT1RecordCount = arraysize(kT1IpAddresses) + 1; //----------------------------------------------------------------------------- // Query/response set for www.ccs.neu.edu, ID is fixed to 2. static const char kT2HostName[] = "www.ccs.neu.edu"; static const uint16_t kT2Qtype = dns_protocol::kTypeA; static const char kT2DnsName[] = { 0x03, 'w', 'w', 'w', 0x03, 'c', 'c', 's', 0x03, 'n', 'e', 'u', 0x03, 'e', 'd', 'u', 0x00 }; static const size_t kT2QuerySize = 33; static const uint8_t kT2ResponseDatagram[] = { // response contains one CNAME for vulcan.ccs.neu.edu and the following // IP address: 129.10.116.81 0x00, 0x02, 0x81, 0x80, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, 0x03, 0x63, 0x63, 0x73, 0x03, 0x6e, 0x65, 0x75, 0x03, 0x65, 0x64, 0x75, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x01, 0x2c, 0x00, 0x09, 0x06, 0x76, 0x75, 0x6c, 0x63, 0x61, 0x6e, 0xc0, 0x10, 0xc0, 0x2d, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x2c, 0x00, 0x04, 0x81, 0x0a, 0x74, 0x51}; static const char* const kT2IpAddresses[] = { "129.10.116.81" }; static const char kT2CanonName[] = "vulcan.ccs.neu.edu"; static const int kT2TTL = 0x0000012c; // +1 for the CNAME record. static const unsigned kT2RecordCount = arraysize(kT2IpAddresses) + 1; //----------------------------------------------------------------------------- // Query/response set for www.google.az, ID is fixed to 3. static const char kT3HostName[] = "www.google.az"; static const uint16_t kT3Qtype = dns_protocol::kTypeA; static const char kT3DnsName[] = { 0x03, 'w', 'w', 'w', 0x06, 'g', 'o', 'o', 'g', 'l', 'e', 0x02, 'a', 'z', 0x00 }; static const size_t kT3QuerySize = 31; static const uint8_t kT3ResponseDatagram[] = { // response contains www.google.com as CNAME for www.google.az and // www.l.google.com as CNAME for www.google.com and the following // IP addresses: 74.125.226.{178,179,180,176,177} // The TTLs on the records are: 0x00015099, 0x00025099, 0x00000415, // 0x00003015, 0x00002015, 0x00000015, 0x00001015. // The last record is an imaginary TXT record for t.google.com. 0x00, 0x03, 0x81, 0x80, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x02, 0x61, 0x7a, 0x00, 0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x50, 0x99, 0x00, 0x10, 0x03, 0x77, 0x77, 0x77, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0xc0, 0x2b, 0x00, 0x05, 0x00, 0x01, 0x00, 0x02, 0x50, 0x99, 0x00, 0x08, 0x03, 0x77, 0x77, 0x77, 0x01, 0x6c, 0xc0, 0x2f, 0xc0, 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x04, 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb2, 0xc0, 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x30, 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb3, 0xc0, 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x20, 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb4, 0xc0, 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb0, 0xc0, 0x47, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x10, 0x15, 0x00, 0x04, 0x4a, 0x7d, 0xe2, 0xb1, 0x01, 0x74, 0xc0, 0x2f, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0xde, 0xad, 0xfe, 0xed}; static const char* const kT3IpAddresses[] = { "74.125.226.178", "74.125.226.179", "74.125.226.180", "74.125.226.176", "74.125.226.177" }; static const char kT3CanonName[] = "www.l.google.com"; static const int kT3TTL = 0x00000015; // +2 for the CNAME records, +1 for TXT record. static const unsigned kT3RecordCount = arraysize(kT3IpAddresses) + 3; class AddressSorter; class DnsClient; class MockTransactionFactory; struct MockDnsClientRule { enum Result { FAIL, // Fail asynchronously with ERR_NAME_NOT_RESOLVED. TIMEOUT, // Fail asynchronously with ERR_DNS_TIMEOUT. EMPTY, // Return an empty response. OK, // Return a response with loopback address. }; // If |delay| is true, matching transactions will be delayed until triggered // by the consumer. MockDnsClientRule(const std::string& prefix_arg, uint16_t qtype_arg, Result result_arg, bool delay) : result(result_arg), prefix(prefix_arg), qtype(qtype_arg), delay(delay) {} Result result; std::string prefix; uint16_t qtype; bool delay; }; typedef std::vector<MockDnsClientRule> MockDnsClientRuleList; // MockDnsClient provides MockTransactionFactory. class MockDnsClient : public DnsClient { public: MockDnsClient(const DnsConfig& config, const MockDnsClientRuleList& rules); ~MockDnsClient() override; // DnsClient interface: void SetConfig(const DnsConfig& config) override; const DnsConfig* GetConfig() const override; DnsTransactionFactory* GetTransactionFactory() override; AddressSorter* GetAddressSorter() override; void ApplyPersistentData(const base::Value& data) override; std::unique_ptr<const base::Value> GetPersistentData() const override; // Completes all DnsTransactions that were delayed by a rule. void CompleteDelayedTransactions(); private: DnsConfig config_; std::unique_ptr<MockTransactionFactory> factory_; std::unique_ptr<AddressSorter> address_sorter_; }; } // namespace net #endif // NET_DNS_DNS_TEST_UTIL_H_
{ "pile_set_name": "Github" }
module.exports = {};
{ "pile_set_name": "Github" }
with Ada.Unchecked_Conversion; package body Test is type Record_A is record A : Boolean; B : Boolean; C : Boolean; end record; type Record_A2 is record X, Y, Z : Boolean; end record; function To_A2 is new Ada.Unchecked_Conversion (Source => Record_A, Target => Record_A2); type Array_T is array (Natural) of Record_A; type Record_B is record A : Array_T; B : Integer; C : Boolean; D : Record_A; end record; procedure Op_R5 (X : in out Record_A; Y : Record_A2) with Global => null is begin X.A := Y.Y; end Op_R5; procedure UCC_01 (A : in out Record_A) is begin Op_R5 (A, To_A2 (A)); -- illegal end UCC_01; end Test;
{ "pile_set_name": "Github" }
import Oy from 'oy-vey' import React from 'react' import {headCSS} from '../styles' import UpcomingInvoiceEmail, {UpcomingInvoiceEmailProps} from './UpcomingInvoiceEmail' const subject = 'Your monthly summary' export const makeBody = (props: UpcomingInvoiceEmailProps) => { const {periodEndStr, newUsers, memberUrl} = props const newUserBullets = newUsers.reduce( (str, newUser) => str + `* ${newUser.name} (${newUser.email})\n`, '' ) return ` Hello, Your teams have added the following users to your organization for the billing cycle ending on ${periodEndStr}: ${newUserBullets} If any of these users were added by mistake, simply remove them under Organization Settings: ${memberUrl} Your friends, The Parabol Product Team ` } export default (props: UpcomingInvoiceEmailProps) => ({ subject, body: makeBody(props), html: Oy.renderTemplate(<UpcomingInvoiceEmail {...props} />, { headCSS, title: subject, previewText: subject }) })
{ "pile_set_name": "Github" }
/** Copyright 2017 Google Inc. 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 <cmath> #include <cstring> #include <functional> #include <memory> #include <string> #include <vector> #include "ion/base/invalid.h" #include "ion/base/logging.h" #include "ion/base/setting.h" #include "ion/base/settingmanager.h" #include "ion/base/stringutils.h" #include "ion/base/zipassetmanager.h" #include "ion/base/zipassetmanagermacros.h" #include "ion/demos/utils.h" #include "ion/demos/viewerdemobase.h" #include "ion/gfx/attributearray.h" #include "ion/gfx/bufferobject.h" #include "ion/gfx/node.h" #include "ion/gfx/shaderinputregistry.h" #include "ion/gfx/shape.h" #include "ion/gfx/statetable.h" #include "ion/gfx/uniform.h" #include "ion/gfxutils/buffertoattributebinder.h" #include "ion/gfxutils/shadersourcecomposer.h" #include "ion/math/angle.h" #include "ion/math/matrix.h" #include "ion/math/range.h" #include "ion/math/transformutils.h" #include "ion/math/utils.h" #include "ion/math/vector.h" #include "ion/math/vectorutils.h" #include "ion/text/basicbuilder.h" #include "ion/text/builder.h" #include "ion/text/font.h" #include "ion/text/fontimage.h" #include "ion/text/fontmanager.h" #include "ion/text/layout.h" #include "ion/text/outlinebuilder.h" using ion::math::Point2i; using ion::math::Range2i; using ion::math::Vector2i; using ion::math::Vector3f; using ion::math::Vector4f; // Resources for the demo. ION_REGISTER_ASSETS(IonGearsResources); namespace { // Per-instance information for gears. struct GearInfo { Vector3f position; // Translation of the gear from origin. float rotation; // Angle of rotation about the Y axis. }; } // end anonymous namespace //----------------------------------------------------------------------------- // // GearsDemo class. // //----------------------------------------------------------------------------- class IonGearsDemo : public ViewerDemoBase { public: IonGearsDemo(int width, int height); ~IonGearsDemo() override {} void Resize(int width, int height) override; void Update() override {} void RenderFrame() override; void Keyboard(int key, int x, int y, bool is_press) override {} std::string GetDemoClassName() const override { return "GearsDemo"; } private: void UpdateGearUniforms(uint64 frame_count); ion::gfx::NodePtr root_; ion::gfx::NodePtr gear_; ion::gfx::ShapePtr gear_shape_; std::vector<GearInfo> gear_infos_; ion::gfx::BufferObjectPtr gear_info_buffer_; size_t gear_count_index_; ion::base::Setting<bool> check_errors_; ion::base::Setting<int> gear_rows_; ion::base::Setting<int> gear_columns_; }; IonGearsDemo::IonGearsDemo(int width, int height) : ViewerDemoBase(width, height), root_(new ion::gfx::Node), gear_(new ion::gfx::Node), gear_info_buffer_(new ion::gfx::BufferObject), check_errors_("gearsdemo/check_errors", false, "Enable OpenGL error checking"), gear_rows_("gearsdemo/gear_rows", 4, "Number of gear rows"), gear_columns_("gearsdemo/gear_columns", 4, "Number of gear columns") { if (!IonGearsResources::RegisterAssets()) { LOG(FATAL) << "Could not register demo assets"; } if (!GetGraphicsManager()->IsFeatureAvailable( ion::gfx::GraphicsManager::kInstancedArrays)) { LOG(FATAL) << "IonGearsDemo requires instanced drawing functions, " << "but the OpenGL implementation does not support them"; } // Set up global state. ion::gfx::StateTablePtr state_table(new ion::gfx::StateTable(width, height)); state_table->SetViewport(Range2i::BuildWithSize(Point2i(0, 0), Vector2i(width, height))); state_table->SetClearColor(Vector4f(0.3f, 0.3f, 0.5f, 1.0f)); state_table->SetClearDepthValue(1.f); state_table->Enable(ion::gfx::StateTable::kDepthTest, true); state_table->Enable(ion::gfx::StateTable::kCullFace, true); root_->SetStateTable(state_table); ion::gfx::ShaderInputRegistryPtr reg(new ion::gfx::ShaderInputRegistry); reg->IncludeGlobalRegistry(); // Gears ion::gfxutils::ExternalShapeSpec gear_spec; gear_spec.vertex_type = ion::gfxutils::ShapeSpec::kPositionNormal; gear_shape_ = demoutils::LoadShapeAsset("gear.obj", gear_spec); const ion::gfx::GraphicsManagerPtr& gm = GetGraphicsManager(); ion::gfxutils::FilterComposer::StringFilter vertex_program_filter = std::bind(&RewriteShader, std::placeholders::_1, gm->GetGlFlavor(), gm->GetGlVersion(), false); ion::gfxutils::FilterComposer::StringFilter fragment_program_filter = std::bind(&RewriteShader, std::placeholders::_1, gm->GetGlFlavor(), gm->GetGlVersion(), true); gear_->AddShape(gear_shape_); gear_->SetLabel("Gear Shape"); gear_->SetShaderProgram(GetShaderManager()->CreateShaderProgram( "Instanced gears", reg, ion::gfxutils::ShaderSourceComposerPtr( new ion::gfxutils::FilterComposer( ion::gfxutils::ShaderSourceComposerPtr( new ion::gfxutils::ZipAssetComposer("gears.vp", false)), vertex_program_filter)), ion::gfxutils::ShaderSourceComposerPtr( new ion::gfxutils::FilterComposer( ion::gfxutils::ShaderSourceComposerPtr( new ion::gfxutils::ZipAssetComposer("gears.fp", false)), fragment_program_filter)))); // gear_info_buffer_ will be filled with GearInfo structures. To bind their // fields to attributes in the shader, BufferToAttributeBinder uses the dummy // structure below to simplify specifying instance offsets. After specifying // the binding, we apply it to a buffer object. Note that the buffer doesn't // need to be filled with valid data at the time of binding. We can fill it // later, as long as it contains valid data when the draw function is called. GearInfo gi; ion::gfxutils::BufferToAttributeBinder<GearInfo>(gi) .Bind(gi.position, "aInstancePosition", 1) .Bind(gi.rotation, "aInstanceRotation", 1) .Apply(reg, gear_shape_->GetAttributeArray(), gear_info_buffer_); gear_count_index_ = gear_->AddUniform(reg->Create<ion::gfx::Uniform, uint32>( "uGearCount", gear_rows_ * gear_columns_)); root_->AddChild(gear_); check_errors_.RegisterListener("check errors listener", [this](ion::base::SettingBase*) { GetGraphicsManager()->EnableErrorChecking(check_errors_); }); UpdateGearUniforms(0); // Set up viewing. SetTrackballRadius(6.0f); SetNodeWithViewUniforms(root_); InitRemoteHandlers(std::vector<ion::gfx::NodePtr>(1, root_)); // Initialize the uniforms and matrices in the graph. UpdateViewUniforms(); } void IonGearsDemo::Resize(int width, int height) { ViewerDemoBase::Resize(width, height); DCHECK(root_->GetStateTable().Get()); root_->GetStateTable()->SetViewport( Range2i::BuildWithSize(Point2i(0, 0), Vector2i(width, height))); } void IonGearsDemo::RenderFrame() { UpdateGearUniforms(GetFrame()->GetCounter()); GetRenderer()->DrawScene(root_); } // Set the uniforms that specify the placement of gear instances. void IonGearsDemo::UpdateGearUniforms(uint64 frame_count) { const int gear_count = gear_rows_ * gear_columns_; gear_infos_.resize(gear_count); const uint64 frames_per_rev = 240; const float angle = static_cast<float>(frame_count % frames_per_rev) / frames_per_rev * static_cast<float>(2*M_PI); const float spacing = 0.9f; // Offsets for zeroth gear in units of spacing. const float column_offset = static_cast<float>(gear_columns_ - 1) / 2.f; const float row_offset = static_cast<float>(gear_rows_ - 1) / 2.f; gear_shape_->SetInstanceCount(gear_count); gear_->SetUniformValue<uint32>(gear_count_index_, gear_count); // Lay out the gears in a square grid. for (int i = 0; i < gear_columns_; ++i) { for (int j = 0; j < gear_rows_; ++j) { size_t index = gear_rows_ * i + j; gear_infos_[index].position = Vector3f(spacing * (-row_offset + static_cast<float>(j)), 0.f, spacing * (-column_offset + static_cast<float>(i))); float rotation = 0; if (i % 2 == j % 2) { rotation = angle; } else { rotation = -angle + static_cast<float>(M_PI/12); } gear_infos_[index].rotation = rotation; } } gear_info_buffer_->SetData(ion::base::DataContainer::Create( gear_infos_.data(), nullptr, false, ion::base::AllocatorPtr()), sizeof(GearInfo), gear_count, ion::gfx::BufferObject::kDynamicDraw); } std::unique_ptr<DemoBase> CreateDemo(int width, int height) { return std::unique_ptr<DemoBase>(new IonGearsDemo(width, height)); }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef WKActionMenuItemTypes_h #define WKActionMenuItemTypes_h #include <stdint.h> #ifdef __cplusplus extern "C" { #endif // Deprecated; remove when there are no more clients. enum { kWKContextActionItemTagNoAction = 0, kWKContextActionItemTagOpenLinkInDefaultBrowser, kWKContextActionItemTagPreviewLink, kWKContextActionItemTagAddLinkToSafariReadingList, kWKContextActionItemTagCopyImage, kWKContextActionItemTagAddImageToPhotos, kWKContextActionItemTagSaveImageToDownloads, kWKContextActionItemTagShareImage, kWKContextActionItemTagCopyText, kWKContextActionItemTagLookupText, kWKContextActionItemTagPaste, kWKContextActionItemTagTextSuggestions, kWKContextActionItemTagCopyVideoURL, kWKContextActionItemTagSaveVideoToDownloads, kWKContextActionItemTagShareVideo, kWKContextActionItemTagShareLink }; #ifdef __cplusplus } #endif #endif /* WKActionMenuItemTypes_h */
{ "pile_set_name": "Github" }
/*================================================================================ code generated by: java2cpp author: Zoran Angelov, mailto://baldzar@gmail.com class: org.apache.http.impl.auth.DigestSchemeFactory ================================================================================*/ #ifndef J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_ORG_APACHE_HTTP_IMPL_AUTH_DIGESTSCHEMEFACTORY_HPP_DECL #define J2CPP_ORG_APACHE_HTTP_IMPL_AUTH_DIGESTSCHEMEFACTORY_HPP_DECL namespace j2cpp { namespace org { namespace apache { namespace http { namespace auth { class AuthScheme; } } } } } namespace j2cpp { namespace org { namespace apache { namespace http { namespace auth { class AuthSchemeFactory; } } } } } namespace j2cpp { namespace org { namespace apache { namespace http { namespace params { class HttpParams; } } } } } namespace j2cpp { namespace java { namespace lang { class Object; } } } #include <java/lang/Object.hpp> #include <org/apache/http/auth/AuthScheme.hpp> #include <org/apache/http/auth/AuthSchemeFactory.hpp> #include <org/apache/http/params/HttpParams.hpp> namespace j2cpp { namespace org { namespace apache { namespace http { namespace impl { namespace auth { class DigestSchemeFactory; class DigestSchemeFactory : public object<DigestSchemeFactory> { public: J2CPP_DECLARE_CLASS J2CPP_DECLARE_METHOD(0) J2CPP_DECLARE_METHOD(1) explicit DigestSchemeFactory(jobject jobj) : object<DigestSchemeFactory>(jobj) { } operator local_ref<org::apache::http::auth::AuthSchemeFactory>() const; operator local_ref<java::lang::Object>() const; DigestSchemeFactory(); local_ref< org::apache::http::auth::AuthScheme > newInstance(local_ref< org::apache::http::params::HttpParams > const&); }; //class DigestSchemeFactory } //namespace auth } //namespace impl } //namespace http } //namespace apache } //namespace org } //namespace j2cpp #endif //J2CPP_ORG_APACHE_HTTP_IMPL_AUTH_DIGESTSCHEMEFACTORY_HPP_DECL #else //J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_ORG_APACHE_HTTP_IMPL_AUTH_DIGESTSCHEMEFACTORY_HPP_IMPL #define J2CPP_ORG_APACHE_HTTP_IMPL_AUTH_DIGESTSCHEMEFACTORY_HPP_IMPL namespace j2cpp { org::apache::http::impl::auth::DigestSchemeFactory::operator local_ref<org::apache::http::auth::AuthSchemeFactory>() const { return local_ref<org::apache::http::auth::AuthSchemeFactory>(get_jobject()); } org::apache::http::impl::auth::DigestSchemeFactory::operator local_ref<java::lang::Object>() const { return local_ref<java::lang::Object>(get_jobject()); } org::apache::http::impl::auth::DigestSchemeFactory::DigestSchemeFactory() : object<org::apache::http::impl::auth::DigestSchemeFactory>( call_new_object< org::apache::http::impl::auth::DigestSchemeFactory::J2CPP_CLASS_NAME, org::apache::http::impl::auth::DigestSchemeFactory::J2CPP_METHOD_NAME(0), org::apache::http::impl::auth::DigestSchemeFactory::J2CPP_METHOD_SIGNATURE(0) >() ) { } local_ref< org::apache::http::auth::AuthScheme > org::apache::http::impl::auth::DigestSchemeFactory::newInstance(local_ref< org::apache::http::params::HttpParams > const &a0) { return call_method< org::apache::http::impl::auth::DigestSchemeFactory::J2CPP_CLASS_NAME, org::apache::http::impl::auth::DigestSchemeFactory::J2CPP_METHOD_NAME(1), org::apache::http::impl::auth::DigestSchemeFactory::J2CPP_METHOD_SIGNATURE(1), local_ref< org::apache::http::auth::AuthScheme > >(get_jobject(), a0); } J2CPP_DEFINE_CLASS(org::apache::http::impl::auth::DigestSchemeFactory,"org/apache/http/impl/auth/DigestSchemeFactory") J2CPP_DEFINE_METHOD(org::apache::http::impl::auth::DigestSchemeFactory,0,"<init>","()V") J2CPP_DEFINE_METHOD(org::apache::http::impl::auth::DigestSchemeFactory,1,"newInstance","(Lorg/apache/http/params/HttpParams;)Lorg/apache/http/auth/AuthScheme;") } //namespace j2cpp #endif //J2CPP_ORG_APACHE_HTTP_IMPL_AUTH_DIGESTSCHEMEFACTORY_HPP_IMPL #endif //J2CPP_INCLUDE_IMPLEMENTATION
{ "pile_set_name": "Github" }
try: from django.conf.urls.defaults import patterns, url except ImportError: from django.conf.urls import patterns, url from yarr.constants import ENTRY_UNREAD, ENTRY_READ, ENTRY_SAVED urlpatterns = patterns('yarr.views', url(r'^$', 'home', name="yarr-home" ), url(r'^all/$', 'list_entries', name="yarr-list_all", ), url(r'^unread/$', 'list_entries', {'state': ENTRY_UNREAD}, name="yarr-list_unread", ), url(r'^saved/$', 'list_entries', {'state': ENTRY_SAVED}, name="yarr-list_saved", ), # Feed views url(r'^all/(?P<feed_pk>\d+)/$', 'list_entries', name="yarr-list_all", ), url(r'^unread/(?P<feed_pk>\d+)/$', 'list_entries', {'state': ENTRY_UNREAD}, name="yarr-list_unread" ), url(r'^saved/(?P<feed_pk>\d+)/$', 'list_entries', {'state': ENTRY_SAVED}, name="yarr-list_saved", ), # Feed management url(r'^feeds/$', 'feeds', name="yarr-feeds" ), url(r'^feeds/add/$', 'feed_form', name="yarr-feed_add", ), url(r'^feeds/(?P<feed_pk>\d+)/$', 'feed_form', name="yarr-feed_edit", ), url(r'^feeds/(?P<feed_pk>\d+)/delete/$', 'feed_delete', name="yarr-feed_delete", ), url(r'^feeds/export/$', 'feeds_export', name="yarr-feeds_export", ), # Flag management without javascript url(r'^state/read/all/$', 'entry_state', {'state': ENTRY_READ, 'if_state': ENTRY_UNREAD}, name="yarr-mark_all_read", ), url(r'^state/read/feed/(?P<feed_pk>\d+)/$', 'entry_state', {'state': ENTRY_READ}, name="yarr-mark_feed_read" ), url(r'^state/read/entry/(?P<entry_pk>\d+)/$', 'entry_state', {'state': ENTRY_READ}, name="yarr-mark_read" ), url(r'^state/unread/entry/(?P<entry_pk>\d+)/$', 'entry_state', {'state': ENTRY_UNREAD}, name="yarr-mark_unread", ), url(r'^state/save/entry/(?P<entry_pk>\d+)/$', 'entry_state', {'state': ENTRY_SAVED}, name="yarr-mark_saved" ), # # JSON API # url(r'^api/$', 'api_base', name='yarr-api_base'), url(r'^api/feed/get/$', 'api_feed_get', name='yarr-api_feed_get'), url(r'^api/feed/pks/$', 'api_feed_pks_get', name='yarr-api_feed_pks_get'), url(r'^api/entry/get/$', 'api_entry_get', name='yarr-api_entry_get'), url(r'^api/entry/set/$', 'api_entry_set', name='yarr-api_entry_set'), )
{ "pile_set_name": "Github" }
using Microsoft.EntityFrameworkCore; using NoEntityFrameworkExample.Models; namespace NoEntityFrameworkExample.Data { public sealed class AppDbContext : DbContext { public DbSet<WorkItem> WorkItems { get; set; } public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { } } }
{ "pile_set_name": "Github" }
// rdl input parameters input rdl { resolve_reg_category = true // if register category is unspecified, try to determine from rdl } // systemverilog output parameters output systemverilog { leaf_address_size = 40 // leaf address bits base_addr_is_parameter = false // base address parameter will be added to top module use_gated_logic_clock = false // use separate gated clock for registers always_generate_iwrap = false // create int wrapper mod even if none specified in rdl suppress_no_reset_warnings = true // inhibit field no reset messages include_default_coverage = false // include default cover points in rtl } // jspec output parameters output jspec { root_regset_is_instanced = true // instance the root or make it a typedef? } // reglist output parameters output reglist { display_external_regs = true // include external regs in output? show_reg_type = false // show int/ext type for each reg? show_fields = false // show field info for each reg } // uvmregs output parameters output uvmregs { suppress_no_category_warnings = true // inhibit reg no category messages include_address_coverage = false // include address coverage in model reuse_uvm_classes = false // allow reuse of classes in model }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- /* ** Copyright 2016, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You my 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. */ --> <!-- These resources are around just to allow their values to be customized for different hardware and product builds. --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="wfcOperatorErrorAlertMessages"> <item msgid="8435554129271297367">"வைஃபை மூலம் அழைக்க மற்றும் செய்திகள் அனுப்ப, முதலில் மொபைல் நிறுவனத்திடம் இந்தச் சேவையை அமைக்குமாறு கேட்கவும். பிறகு அமைப்புகளில் மீண்டும் வைஃபை அழைப்பை இயக்கவும்."</item> </string-array> <string-array name="wfcOperatorErrorNotificationMessages"> <item msgid="8993797655078232716">"உங்கள் மொபைல் நிறுவனத்தில் பதிவுசெய்யவும்"</item> </string-array> <string name="wfcSpnFormat" msgid="8604078859021657352">"%s வைஃபை அழைப்பு"</string> </resources>
{ "pile_set_name": "Github" }
require(['gitbook', 'jquery'], function(gitbook, $) { var SITES = { 'facebook': { 'label': 'Facebook', 'icon': 'fa fa-facebook', 'onClick': function(e) { e.preventDefault(); window.open('http://www.facebook.com/sharer/sharer.php?s=100&p[url]='+encodeURIComponent(location.href)); } }, 'twitter': { 'label': 'Twitter', 'icon': 'fa fa-twitter', 'onClick': function(e) { e.preventDefault(); window.open('http://twitter.com/home?status='+encodeURIComponent(document.title+' '+location.href)); } }, 'google': { 'label': 'Google+', 'icon': 'fa fa-google-plus', 'onClick': function(e) { e.preventDefault(); window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href)); } }, 'weibo': { 'label': 'Weibo', 'icon': 'fa fa-weibo', 'onClick': function(e) { e.preventDefault(); window.open('http://service.weibo.com/share/share.php?content=utf-8&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)); } }, 'instapaper': { 'label': 'Instapaper', 'icon': 'fa fa-instapaper', 'onClick': function(e) { e.preventDefault(); window.open('http://www.instapaper.com/text?u='+encodeURIComponent(location.href)); } }, 'vk': { 'label': 'VK', 'icon': 'fa fa-vk', 'onClick': function(e) { e.preventDefault(); window.open('http://vkontakte.ru/share.php?url='+encodeURIComponent(location.href)); } } }; gitbook.events.bind('start', function(e, config) { var opts = config.sharing; // Create dropdown menu var menu = $.map(opts.all, function(id) { var site = SITES[id]; return { text: site.label, onClick: site.onClick }; }); // Create main button with dropdown if (menu.length > 0) { gitbook.toolbar.createButton({ icon: 'fa fa-share-alt', label: 'Share', position: 'right', dropdown: [menu] }); } // Direct actions to share $.each(SITES, function(sideId, site) { if (!opts[sideId]) return; gitbook.toolbar.createButton({ icon: site.icon, label: site.text, position: 'right', onClick: site.onClick }); }); }); });
{ "pile_set_name": "Github" }
{ "type": "bubble", "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "image", "url": "https://scdn.line-apps.com/n/channel_devcenter/img/flexsnapshot/clip/clip3.jpg", "size": "full", "aspectMode": "cover", "aspectRatio": "1:1", "gravity": "center" }, { "type": "image", "url": "https://scdn.line-apps.com/n/channel_devcenter/img/flexsnapshot/clip/clip15.png", "position": "absolute", "aspectMode": "fit", "aspectRatio": "1:1", "offsetTop": "0px", "offsetBottom": "0px", "offsetStart": "0px", "offsetEnd": "0px", "size": "full" }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "box", "layout": "vertical", "contents": [ { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "Brown Grand Hotel", "size": "xl", "color": "#ffffff" } ] }, { "type": "box", "layout": "baseline", "contents": [ { "type": "icon", "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png" }, { "type": "icon", "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png" }, { "type": "icon", "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png" }, { "type": "icon", "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png" }, { "type": "icon", "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png" }, { "type": "text", "text": "4.0", "color": "#a9a9a9" } ], "spacing": "xs" }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "box", "layout": "baseline", "contents": [ { "type": "text", "text": "¥62,000", "color": "#ffffff", "size": "md", "flex": 0, "align": "end" }, { "type": "text", "text": "¥82,000", "color": "#a9a9a9", "decoration": "line-through", "size": "sm", "align": "end" } ], "flex": 0, "spacing": "lg" } ] } ], "spacing": "xs" } ], "position": "absolute", "offsetBottom": "0px", "offsetStart": "0px", "offsetEnd": "0px", "paddingAll": "20px" } ], "paddingAll": "0px" } }
{ "pile_set_name": "Github" }
// mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -m64 _const.go package unix import "syscall" const ( AF_APPLETALK = 0x10 AF_CCITT = 0xa AF_CHAOS = 0x5 AF_CNT = 0x15 AF_COIP = 0x14 AF_DATAKIT = 0x9 AF_DECnet = 0xc AF_DLI = 0xd AF_E164 = 0x1c AF_ECMA = 0x8 AF_HYLINK = 0xf AF_IEEE80211 = 0x25 AF_IMPLINK = 0x3 AF_INET = 0x2 AF_INET6 = 0x1e AF_IPX = 0x17 AF_ISDN = 0x1c AF_ISO = 0x7 AF_LAT = 0xe AF_LINK = 0x12 AF_LOCAL = 0x1 AF_MAX = 0x28 AF_NATM = 0x1f AF_NDRV = 0x1b AF_NETBIOS = 0x21 AF_NS = 0x6 AF_OSI = 0x7 AF_PPP = 0x22 AF_PUP = 0x4 AF_RESERVED_36 = 0x24 AF_ROUTE = 0x11 AF_SIP = 0x18 AF_SNA = 0xb AF_SYSTEM = 0x20 AF_UNIX = 0x1 AF_UNSPEC = 0x0 AF_UTUN = 0x26 ALTWERASE = 0x200 ATTR_BIT_MAP_COUNT = 0x5 ATTR_CMN_ACCESSMASK = 0x20000 ATTR_CMN_ACCTIME = 0x1000 ATTR_CMN_ADDEDTIME = 0x10000000 ATTR_CMN_BKUPTIME = 0x2000 ATTR_CMN_CHGTIME = 0x800 ATTR_CMN_CRTIME = 0x200 ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 ATTR_CMN_DEVID = 0x2 ATTR_CMN_DOCUMENT_ID = 0x100000 ATTR_CMN_ERROR = 0x20000000 ATTR_CMN_EXTENDED_SECURITY = 0x400000 ATTR_CMN_FILEID = 0x2000000 ATTR_CMN_FLAGS = 0x40000 ATTR_CMN_FNDRINFO = 0x4000 ATTR_CMN_FSID = 0x4 ATTR_CMN_FULLPATH = 0x8000000 ATTR_CMN_GEN_COUNT = 0x80000 ATTR_CMN_GRPID = 0x10000 ATTR_CMN_GRPUUID = 0x1000000 ATTR_CMN_MODTIME = 0x400 ATTR_CMN_NAME = 0x1 ATTR_CMN_NAMEDATTRCOUNT = 0x80000 ATTR_CMN_NAMEDATTRLIST = 0x100000 ATTR_CMN_OBJID = 0x20 ATTR_CMN_OBJPERMANENTID = 0x40 ATTR_CMN_OBJTAG = 0x10 ATTR_CMN_OBJTYPE = 0x8 ATTR_CMN_OWNERID = 0x8000 ATTR_CMN_PARENTID = 0x4000000 ATTR_CMN_PAROBJID = 0x80 ATTR_CMN_RETURNED_ATTRS = 0x80000000 ATTR_CMN_SCRIPT = 0x100 ATTR_CMN_SETMASK = 0x41c7ff00 ATTR_CMN_USERACCESS = 0x200000 ATTR_CMN_UUID = 0x800000 ATTR_CMN_VALIDMASK = 0xffffffff ATTR_CMN_VOLSETMASK = 0x6700 ATTR_FILE_ALLOCSIZE = 0x4 ATTR_FILE_CLUMPSIZE = 0x10 ATTR_FILE_DATAALLOCSIZE = 0x400 ATTR_FILE_DATAEXTENTS = 0x800 ATTR_FILE_DATALENGTH = 0x200 ATTR_FILE_DEVTYPE = 0x20 ATTR_FILE_FILETYPE = 0x40 ATTR_FILE_FORKCOUNT = 0x80 ATTR_FILE_FORKLIST = 0x100 ATTR_FILE_IOBLOCKSIZE = 0x8 ATTR_FILE_LINKCOUNT = 0x1 ATTR_FILE_RSRCALLOCSIZE = 0x2000 ATTR_FILE_RSRCEXTENTS = 0x4000 ATTR_FILE_RSRCLENGTH = 0x1000 ATTR_FILE_SETMASK = 0x20 ATTR_FILE_TOTALSIZE = 0x2 ATTR_FILE_VALIDMASK = 0x37ff ATTR_VOL_ALLOCATIONCLUMP = 0x40 ATTR_VOL_ATTRIBUTES = 0x40000000 ATTR_VOL_CAPABILITIES = 0x20000 ATTR_VOL_DIRCOUNT = 0x400 ATTR_VOL_ENCODINGSUSED = 0x10000 ATTR_VOL_FILECOUNT = 0x200 ATTR_VOL_FSTYPE = 0x1 ATTR_VOL_INFO = 0x80000000 ATTR_VOL_IOBLOCKSIZE = 0x80 ATTR_VOL_MAXOBJCOUNT = 0x800 ATTR_VOL_MINALLOCATION = 0x20 ATTR_VOL_MOUNTEDDEVICE = 0x8000 ATTR_VOL_MOUNTFLAGS = 0x4000 ATTR_VOL_MOUNTPOINT = 0x1000 ATTR_VOL_NAME = 0x2000 ATTR_VOL_OBJCOUNT = 0x100 ATTR_VOL_QUOTA_SIZE = 0x10000000 ATTR_VOL_RESERVED_SIZE = 0x20000000 ATTR_VOL_SETMASK = 0x80002000 ATTR_VOL_SIGNATURE = 0x2 ATTR_VOL_SIZE = 0x4 ATTR_VOL_SPACEAVAIL = 0x10 ATTR_VOL_SPACEFREE = 0x8 ATTR_VOL_UUID = 0x40000 ATTR_VOL_VALIDMASK = 0xf007ffff B0 = 0x0 B110 = 0x6e B115200 = 0x1c200 B1200 = 0x4b0 B134 = 0x86 B14400 = 0x3840 B150 = 0x96 B1800 = 0x708 B19200 = 0x4b00 B200 = 0xc8 B230400 = 0x38400 B2400 = 0x960 B28800 = 0x7080 B300 = 0x12c B38400 = 0x9600 B4800 = 0x12c0 B50 = 0x32 B57600 = 0xe100 B600 = 0x258 B7200 = 0x1c20 B75 = 0x4b B76800 = 0x12c00 B9600 = 0x2580 BIOCFLUSH = 0x20004268 BIOCGBLEN = 0x40044266 BIOCGDLT = 0x4004426a BIOCGDLTLIST = 0xc00c4279 BIOCGETIF = 0x4020426b BIOCGHDRCMPLT = 0x40044274 BIOCGRSIG = 0x40044272 BIOCGRTIMEOUT = 0x4010426e BIOCGSEESENT = 0x40044276 BIOCGSTATS = 0x4008426f BIOCIMMEDIATE = 0x80044270 BIOCPROMISC = 0x20004269 BIOCSBLEN = 0xc0044266 BIOCSDLT = 0x80044278 BIOCSETF = 0x80104267 BIOCSETFNR = 0x8010427e BIOCSETIF = 0x8020426c BIOCSHDRCMPLT = 0x80044275 BIOCSRSIG = 0x80044273 BIOCSRTIMEOUT = 0x8010426d BIOCSSEESENT = 0x80044277 BIOCVERSION = 0x40044271 BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALIGNMENT = 0x4 BPF_ALU = 0x4 BPF_AND = 0x50 BPF_B = 0x10 BPF_DIV = 0x30 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 BPF_JA = 0x0 BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 BPF_JMP = 0x5 BPF_JSET = 0x40 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 BPF_LEN = 0x80 BPF_LSH = 0x60 BPF_MAJOR_VERSION = 0x1 BPF_MAXBUFSIZE = 0x80000 BPF_MAXINSNS = 0x200 BPF_MEM = 0x60 BPF_MEMWORDS = 0x10 BPF_MINBUFSIZE = 0x20 BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_OR = 0x40 BPF_RELEASE = 0x30bb6 BPF_RET = 0x6 BPF_RSH = 0x70 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 BPF_TAX = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 BRKINT = 0x2 BS0 = 0x0 BS1 = 0x8000 BSDLY = 0x8000 CFLUSH = 0xf CLOCAL = 0x8000 CLOCK_MONOTONIC = 0x6 CLOCK_MONOTONIC_RAW = 0x4 CLOCK_MONOTONIC_RAW_APPROX = 0x5 CLOCK_PROCESS_CPUTIME_ID = 0xc CLOCK_REALTIME = 0x0 CLOCK_THREAD_CPUTIME_ID = 0x10 CLOCK_UPTIME_RAW = 0x8 CLOCK_UPTIME_RAW_APPROX = 0x9 CR0 = 0x0 CR1 = 0x1000 CR2 = 0x2000 CR3 = 0x3000 CRDLY = 0x3000 CREAD = 0x800 CRTSCTS = 0x30000 CS5 = 0x0 CS6 = 0x100 CS7 = 0x200 CS8 = 0x300 CSIZE = 0x300 CSTART = 0x11 CSTATUS = 0x14 CSTOP = 0x13 CSTOPB = 0x400 CSUSP = 0x1a CTL_HW = 0x6 CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 DLT_A429 = 0xb8 DLT_A653_ICM = 0xb9 DLT_AIRONET_HEADER = 0x78 DLT_AOS = 0xde DLT_APPLE_IP_OVER_IEEE1394 = 0x8a DLT_ARCNET = 0x7 DLT_ARCNET_LINUX = 0x81 DLT_ATM_CLIP = 0x13 DLT_ATM_RFC1483 = 0xb DLT_AURORA = 0x7e DLT_AX25 = 0x3 DLT_AX25_KISS = 0xca DLT_BACNET_MS_TP = 0xa5 DLT_BLUETOOTH_HCI_H4 = 0xbb DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 DLT_CAN20B = 0xbe DLT_CAN_SOCKETCAN = 0xe3 DLT_CHAOS = 0x5 DLT_CHDLC = 0x68 DLT_CISCO_IOS = 0x76 DLT_C_HDLC = 0x68 DLT_C_HDLC_WITH_DIR = 0xcd DLT_DBUS = 0xe7 DLT_DECT = 0xdd DLT_DOCSIS = 0x8f DLT_DVB_CI = 0xeb DLT_ECONET = 0x73 DLT_EN10MB = 0x1 DLT_EN3MB = 0x2 DLT_ENC = 0x6d DLT_ERF = 0xc5 DLT_ERF_ETH = 0xaf DLT_ERF_POS = 0xb0 DLT_FC_2 = 0xe0 DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 DLT_FDDI = 0xa DLT_FLEXRAY = 0xd2 DLT_FRELAY = 0x6b DLT_FRELAY_WITH_DIR = 0xce DLT_GCOM_SERIAL = 0xad DLT_GCOM_T1E1 = 0xac DLT_GPF_F = 0xab DLT_GPF_T = 0xaa DLT_GPRS_LLC = 0xa9 DLT_GSMTAP_ABIS = 0xda DLT_GSMTAP_UM = 0xd9 DLT_HHDLC = 0x79 DLT_IBM_SN = 0x92 DLT_IBM_SP = 0x91 DLT_IEEE802 = 0x6 DLT_IEEE802_11 = 0x69 DLT_IEEE802_11_RADIO = 0x7f DLT_IEEE802_11_RADIO_AVS = 0xa3 DLT_IEEE802_15_4 = 0xc3 DLT_IEEE802_15_4_LINUX = 0xbf DLT_IEEE802_15_4_NOFCS = 0xe6 DLT_IEEE802_15_4_NONASK_PHY = 0xd7 DLT_IEEE802_16_MAC_CPS = 0xbc DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 DLT_IPFILTER = 0x74 DLT_IPMB = 0xc7 DLT_IPMB_LINUX = 0xd1 DLT_IPNET = 0xe2 DLT_IPOIB = 0xf2 DLT_IPV4 = 0xe4 DLT_IPV6 = 0xe5 DLT_IP_OVER_FC = 0x7a DLT_JUNIPER_ATM1 = 0x89 DLT_JUNIPER_ATM2 = 0x87 DLT_JUNIPER_ATM_CEMIC = 0xee DLT_JUNIPER_CHDLC = 0xb5 DLT_JUNIPER_ES = 0x84 DLT_JUNIPER_ETHER = 0xb2 DLT_JUNIPER_FIBRECHANNEL = 0xea DLT_JUNIPER_FRELAY = 0xb4 DLT_JUNIPER_GGSN = 0x85 DLT_JUNIPER_ISM = 0xc2 DLT_JUNIPER_MFR = 0x86 DLT_JUNIPER_MLFR = 0x83 DLT_JUNIPER_MLPPP = 0x82 DLT_JUNIPER_MONITOR = 0xa4 DLT_JUNIPER_PIC_PEER = 0xae DLT_JUNIPER_PPP = 0xb3 DLT_JUNIPER_PPPOE = 0xa7 DLT_JUNIPER_PPPOE_ATM = 0xa8 DLT_JUNIPER_SERVICES = 0x88 DLT_JUNIPER_SRX_E2E = 0xe9 DLT_JUNIPER_ST = 0xc8 DLT_JUNIPER_VP = 0xb7 DLT_JUNIPER_VS = 0xe8 DLT_LAPB_WITH_DIR = 0xcf DLT_LAPD = 0xcb DLT_LIN = 0xd4 DLT_LINUX_EVDEV = 0xd8 DLT_LINUX_IRDA = 0x90 DLT_LINUX_LAPD = 0xb1 DLT_LINUX_PPP_WITHDIRECTION = 0xa6 DLT_LINUX_SLL = 0x71 DLT_LOOP = 0x6c DLT_LTALK = 0x72 DLT_MATCHING_MAX = 0xf5 DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 DLT_MPEG_2_TS = 0xf3 DLT_MPLS = 0xdb DLT_MTP2 = 0x8c DLT_MTP2_WITH_PHDR = 0x8b DLT_MTP3 = 0x8d DLT_MUX27010 = 0xec DLT_NETANALYZER = 0xf0 DLT_NETANALYZER_TRANSPARENT = 0xf1 DLT_NFC_LLCP = 0xf5 DLT_NFLOG = 0xef DLT_NG40 = 0xf4 DLT_NULL = 0x0 DLT_PCI_EXP = 0x7d DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 DLT_PPI = 0xc0 DLT_PPP = 0x9 DLT_PPP_BSDOS = 0x10 DLT_PPP_ETHER = 0x33 DLT_PPP_PPPD = 0xa6 DLT_PPP_SERIAL = 0x32 DLT_PPP_WITH_DIR = 0xcc DLT_PPP_WITH_DIRECTION = 0xa6 DLT_PRISM_HEADER = 0x77 DLT_PRONET = 0x4 DLT_RAIF1 = 0xc6 DLT_RAW = 0xc DLT_RIO = 0x7c DLT_SCCP = 0x8e DLT_SITA = 0xc4 DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xf DLT_STANAG_5066_D_PDU = 0xed DLT_SUNATM = 0x7b DLT_SYMANTEC_FIREWALL = 0x63 DLT_TZSP = 0x80 DLT_USB = 0xba DLT_USB_LINUX = 0xbd DLT_USB_LINUX_MMAPPED = 0xdc DLT_USER0 = 0x93 DLT_USER1 = 0x94 DLT_USER10 = 0x9d DLT_USER11 = 0x9e DLT_USER12 = 0x9f DLT_USER13 = 0xa0 DLT_USER14 = 0xa1 DLT_USER15 = 0xa2 DLT_USER2 = 0x95 DLT_USER3 = 0x96 DLT_USER4 = 0x97 DLT_USER5 = 0x98 DLT_USER6 = 0x99 DLT_USER7 = 0x9a DLT_USER8 = 0x9b DLT_USER9 = 0x9c DLT_WIHART = 0xdf DLT_X2E_SERIAL = 0xd5 DLT_X2E_XORAYA = 0xd6 DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 DT_FIFO = 0x1 DT_LNK = 0xa DT_REG = 0x8 DT_SOCK = 0xc DT_UNKNOWN = 0x0 DT_WHT = 0xe ECHO = 0x8 ECHOCTL = 0x40 ECHOE = 0x2 ECHOK = 0x4 ECHOKE = 0x1 ECHONL = 0x10 ECHOPRT = 0x20 EVFILT_AIO = -0x3 EVFILT_EXCEPT = -0xf EVFILT_FS = -0x9 EVFILT_MACHPORT = -0x8 EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 EVFILT_SYSCOUNT = 0xf EVFILT_THREADMARKER = 0xf EVFILT_TIMER = -0x7 EVFILT_USER = -0xa EVFILT_VM = -0xc EVFILT_VNODE = -0x4 EVFILT_WRITE = -0x2 EV_ADD = 0x1 EV_CLEAR = 0x20 EV_DELETE = 0x2 EV_DISABLE = 0x8 EV_DISPATCH = 0x80 EV_DISPATCH2 = 0x180 EV_ENABLE = 0x4 EV_EOF = 0x8000 EV_ERROR = 0x4000 EV_FLAG0 = 0x1000 EV_FLAG1 = 0x2000 EV_ONESHOT = 0x10 EV_OOBAND = 0x2000 EV_POLL = 0x1000 EV_RECEIPT = 0x40 EV_SYSFLAGS = 0xf000 EV_UDATA_SPECIFIC = 0x100 EV_VANISHED = 0x200 EXTA = 0x4b00 EXTB = 0x9600 EXTPROC = 0x800 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x4000 FFDLY = 0x4000 FLUSHO = 0x800000 FSOPT_ATTR_CMN_EXTENDED = 0x20 FSOPT_NOFOLLOW = 0x1 FSOPT_NOINMEMUPDATE = 0x2 FSOPT_PACK_INVAL_ATTRS = 0x8 FSOPT_REPORT_FULLSIZE = 0x4 F_ADDFILESIGS = 0x3d F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 F_ADDFILESIGS_RETURN = 0x61 F_ADDSIGS = 0x3b F_ALLOCATEALL = 0x4 F_ALLOCATECONTIG = 0x2 F_BARRIERFSYNC = 0x55 F_CHECK_LV = 0x62 F_CHKCLEAN = 0x29 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x43 F_FINDSIGS = 0x4e F_FLUSH_DATA = 0x28 F_FREEZE_FS = 0x35 F_FULLFSYNC = 0x33 F_GETCODEDIR = 0x48 F_GETFD = 0x1 F_GETFL = 0x3 F_GETLK = 0x7 F_GETLKPID = 0x42 F_GETNOSIGPIPE = 0x4a F_GETOWN = 0x5 F_GETPATH = 0x32 F_GETPATH_MTMINFO = 0x47 F_GETPROTECTIONCLASS = 0x3f F_GETPROTECTIONLEVEL = 0x4d F_GLOBAL_NOCACHE = 0x37 F_LOG2PHYS = 0x31 F_LOG2PHYS_EXT = 0x41 F_NOCACHE = 0x30 F_NODIRECT = 0x3e F_OK = 0x0 F_PATHPKG_CHECK = 0x34 F_PEOFPOSMODE = 0x3 F_PREALLOCATE = 0x2a F_PUNCHHOLE = 0x63 F_RDADVISE = 0x2c F_RDAHEAD = 0x2d F_RDLCK = 0x1 F_SETBACKINGSTORE = 0x46 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLK = 0x8 F_SETLKW = 0x9 F_SETLKWTIMEOUT = 0xa F_SETNOSIGPIPE = 0x49 F_SETOWN = 0x6 F_SETPROTECTIONCLASS = 0x40 F_SETSIZE = 0x2b F_SINGLE_WRITER = 0x4c F_THAW_FS = 0x36 F_TRANSCODEKEY = 0x4b F_TRIM_ACTIVE_FILE = 0x64 F_UNLCK = 0x2 F_VOLPOSMODE = 0x4 F_WRLCK = 0x3 HUPCL = 0x4000 HW_MACHINE = 0x1 ICANON = 0x100 ICMP6_FILTER = 0x12 ICRNL = 0x100 IEXTEN = 0x400 IFF_ALLMULTI = 0x200 IFF_ALTPHYS = 0x4000 IFF_BROADCAST = 0x2 IFF_DEBUG = 0x4 IFF_LINK0 = 0x1000 IFF_LINK1 = 0x2000 IFF_LINK2 = 0x4000 IFF_LOOPBACK = 0x8 IFF_MULTICAST = 0x8000 IFF_NOARP = 0x80 IFF_NOTRAILERS = 0x20 IFF_OACTIVE = 0x400 IFF_POINTOPOINT = 0x10 IFF_PROMISC = 0x100 IFF_RUNNING = 0x40 IFF_SIMPLEX = 0x800 IFF_UP = 0x1 IFNAMSIZ = 0x10 IFT_1822 = 0x2 IFT_AAL5 = 0x31 IFT_ARCNET = 0x23 IFT_ARCNETPLUS = 0x24 IFT_ATM = 0x25 IFT_BRIDGE = 0xd1 IFT_CARP = 0xf8 IFT_CELLULAR = 0xff IFT_CEPT = 0x13 IFT_DS3 = 0x1e IFT_ENC = 0xf4 IFT_EON = 0x19 IFT_ETHER = 0x6 IFT_FAITH = 0x38 IFT_FDDI = 0xf IFT_FRELAY = 0x20 IFT_FRELAYDCE = 0x2c IFT_GIF = 0x37 IFT_HDH1822 = 0x3 IFT_HIPPI = 0x2f IFT_HSSI = 0x2e IFT_HY = 0xe IFT_IEEE1394 = 0x90 IFT_IEEE8023ADLAG = 0x88 IFT_ISDNBASIC = 0x14 IFT_ISDNPRIMARY = 0x15 IFT_ISO88022LLC = 0x29 IFT_ISO88023 = 0x7 IFT_ISO88024 = 0x8 IFT_ISO88025 = 0x9 IFT_ISO88026 = 0xa IFT_L2VLAN = 0x87 IFT_LAPB = 0x10 IFT_LOCALTALK = 0x2a IFT_LOOP = 0x18 IFT_MIOX25 = 0x26 IFT_MODEM = 0x30 IFT_NSIP = 0x1b IFT_OTHER = 0x1 IFT_P10 = 0xc IFT_P80 = 0xd IFT_PARA = 0x22 IFT_PDP = 0xff IFT_PFLOG = 0xf5 IFT_PFSYNC = 0xf6 IFT_PKTAP = 0xfe IFT_PPP = 0x17 IFT_PROPMUX = 0x36 IFT_PROPVIRTUAL = 0x35 IFT_PTPSERIAL = 0x16 IFT_RS232 = 0x21 IFT_SDLC = 0x11 IFT_SIP = 0x1f IFT_SLIP = 0x1c IFT_SMDSDXI = 0x2b IFT_SMDSICIP = 0x34 IFT_SONET = 0x27 IFT_SONETPATH = 0x32 IFT_SONETVT = 0x33 IFT_STARLAN = 0xb IFT_STF = 0x39 IFT_T1 = 0x12 IFT_ULTRA = 0x1d IFT_V35 = 0x2d IFT_X25 = 0x5 IFT_X25DDN = 0x4 IFT_X25PLE = 0x28 IFT_XETHER = 0x1a IGNBRK = 0x1 IGNCR = 0x80 IGNPAR = 0x4 IMAXBEL = 0x2000 INLCR = 0x40 INPCK = 0x10 IN_CLASSA_HOST = 0xffffff IN_CLASSA_MAX = 0x80 IN_CLASSA_NET = 0xff000000 IN_CLASSA_NSHIFT = 0x18 IN_CLASSB_HOST = 0xffff IN_CLASSB_MAX = 0x10000 IN_CLASSB_NET = 0xffff0000 IN_CLASSB_NSHIFT = 0x10 IN_CLASSC_HOST = 0xff IN_CLASSC_NET = 0xffffff00 IN_CLASSC_NSHIFT = 0x8 IN_CLASSD_HOST = 0xfffffff IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 0x1c IN_LINKLOCALNETNUM = 0xa9fe0000 IN_LOOPBACKNET = 0x7f IPPROTO_3PC = 0x22 IPPROTO_ADFS = 0x44 IPPROTO_AH = 0x33 IPPROTO_AHIP = 0x3d IPPROTO_APES = 0x63 IPPROTO_ARGUS = 0xd IPPROTO_AX25 = 0x5d IPPROTO_BHA = 0x31 IPPROTO_BLT = 0x1e IPPROTO_BRSATMON = 0x4c IPPROTO_CFTP = 0x3e IPPROTO_CHAOS = 0x10 IPPROTO_CMTP = 0x26 IPPROTO_CPHB = 0x49 IPPROTO_CPNX = 0x48 IPPROTO_DDP = 0x25 IPPROTO_DGP = 0x56 IPPROTO_DIVERT = 0xfe IPPROTO_DONE = 0x101 IPPROTO_DSTOPTS = 0x3c IPPROTO_EGP = 0x8 IPPROTO_EMCON = 0xe IPPROTO_ENCAP = 0x62 IPPROTO_EON = 0x50 IPPROTO_ESP = 0x32 IPPROTO_ETHERIP = 0x61 IPPROTO_FRAGMENT = 0x2c IPPROTO_GGP = 0x3 IPPROTO_GMTP = 0x64 IPPROTO_GRE = 0x2f IPPROTO_HELLO = 0x3f IPPROTO_HMP = 0x14 IPPROTO_HOPOPTS = 0x0 IPPROTO_ICMP = 0x1 IPPROTO_ICMPV6 = 0x3a IPPROTO_IDP = 0x16 IPPROTO_IDPR = 0x23 IPPROTO_IDRP = 0x2d IPPROTO_IGMP = 0x2 IPPROTO_IGP = 0x55 IPPROTO_IGRP = 0x58 IPPROTO_IL = 0x28 IPPROTO_INLSP = 0x34 IPPROTO_INP = 0x20 IPPROTO_IP = 0x0 IPPROTO_IPCOMP = 0x6c IPPROTO_IPCV = 0x47 IPPROTO_IPEIP = 0x5e IPPROTO_IPIP = 0x4 IPPROTO_IPPC = 0x43 IPPROTO_IPV4 = 0x4 IPPROTO_IPV6 = 0x29 IPPROTO_IRTP = 0x1c IPPROTO_KRYPTOLAN = 0x41 IPPROTO_LARP = 0x5b IPPROTO_LEAF1 = 0x19 IPPROTO_LEAF2 = 0x1a IPPROTO_MAX = 0x100 IPPROTO_MAXID = 0x34 IPPROTO_MEAS = 0x13 IPPROTO_MHRP = 0x30 IPPROTO_MICP = 0x5f IPPROTO_MTP = 0x5c IPPROTO_MUX = 0x12 IPPROTO_ND = 0x4d IPPROTO_NHRP = 0x36 IPPROTO_NONE = 0x3b IPPROTO_NSP = 0x1f IPPROTO_NVPII = 0xb IPPROTO_OSPFIGP = 0x59 IPPROTO_PGM = 0x71 IPPROTO_PIGP = 0x9 IPPROTO_PIM = 0x67 IPPROTO_PRM = 0x15 IPPROTO_PUP = 0xc IPPROTO_PVP = 0x4b IPPROTO_RAW = 0xff IPPROTO_RCCMON = 0xa IPPROTO_RDP = 0x1b IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e IPPROTO_RVD = 0x42 IPPROTO_SATEXPAK = 0x40 IPPROTO_SATMON = 0x45 IPPROTO_SCCSP = 0x60 IPPROTO_SCTP = 0x84 IPPROTO_SDRP = 0x2a IPPROTO_SEP = 0x21 IPPROTO_SRPC = 0x5a IPPROTO_ST = 0x7 IPPROTO_SVMTP = 0x52 IPPROTO_SWIPE = 0x35 IPPROTO_TCF = 0x57 IPPROTO_TCP = 0x6 IPPROTO_TP = 0x1d IPPROTO_TPXX = 0x27 IPPROTO_TRUNK1 = 0x17 IPPROTO_TRUNK2 = 0x18 IPPROTO_TTP = 0x54 IPPROTO_UDP = 0x11 IPPROTO_VINES = 0x53 IPPROTO_VISA = 0x46 IPPROTO_VMTP = 0x51 IPPROTO_WBEXPAK = 0x4f IPPROTO_WBMON = 0x4e IPPROTO_WSN = 0x4a IPPROTO_XNET = 0xf IPPROTO_XTP = 0x24 IPV6_2292DSTOPTS = 0x17 IPV6_2292HOPLIMIT = 0x14 IPV6_2292HOPOPTS = 0x16 IPV6_2292NEXTHOP = 0x15 IPV6_2292PKTINFO = 0x13 IPV6_2292PKTOPTIONS = 0x19 IPV6_2292RTHDR = 0x18 IPV6_BINDV6ONLY = 0x1b IPV6_BOUND_IF = 0x7d IPV6_CHECKSUM = 0x1a IPV6_DEFAULT_MULTICAST_HOPS = 0x1 IPV6_DEFAULT_MULTICAST_LOOP = 0x1 IPV6_DEFHLIM = 0x40 IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FLOW_ECN_MASK = 0x300 IPV6_FRAGTTL = 0x3c IPV6_FW_ADD = 0x1e IPV6_FW_DEL = 0x1f IPV6_FW_FLUSH = 0x20 IPV6_FW_GET = 0x22 IPV6_FW_ZERO = 0x21 IPV6_HLIMDEC = 0x1 IPV6_IPSEC_POLICY = 0x1c IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd IPV6_MAXHLIM = 0xff IPV6_MAXOPTHDR = 0x800 IPV6_MAXPACKET = 0xffff IPV6_MAX_GROUP_SRC_FILTER = 0x200 IPV6_MAX_MEMBERSHIPS = 0xfff IPV6_MAX_SOCK_SRC_FILTER = 0x80 IPV6_MIN_MEMBERSHIPS = 0x1f IPV6_MMTU = 0x500 IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 IPV6_MULTICAST_LOOP = 0xb IPV6_PORTRANGE = 0xe IPV6_PORTRANGE_DEFAULT = 0x0 IPV6_PORTRANGE_HIGH = 0x1 IPV6_PORTRANGE_LOW = 0x2 IPV6_RECVTCLASS = 0x23 IPV6_RTHDR_LOOSE = 0x0 IPV6_RTHDR_STRICT = 0x1 IPV6_RTHDR_TYPE_0 = 0x0 IPV6_SOCKOPT_RESERVED1 = 0x3 IPV6_TCLASS = 0x24 IPV6_UNICAST_HOPS = 0x4 IPV6_V6ONLY = 0x1b IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 IP_ADD_MEMBERSHIP = 0xc IP_ADD_SOURCE_MEMBERSHIP = 0x46 IP_BLOCK_SOURCE = 0x48 IP_BOUND_IF = 0x19 IP_DEFAULT_MULTICAST_LOOP = 0x1 IP_DEFAULT_MULTICAST_TTL = 0x1 IP_DF = 0x4000 IP_DROP_MEMBERSHIP = 0xd IP_DROP_SOURCE_MEMBERSHIP = 0x47 IP_DUMMYNET_CONFIGURE = 0x3c IP_DUMMYNET_DEL = 0x3d IP_DUMMYNET_FLUSH = 0x3e IP_DUMMYNET_GET = 0x40 IP_FAITH = 0x16 IP_FW_ADD = 0x28 IP_FW_DEL = 0x29 IP_FW_FLUSH = 0x2a IP_FW_GET = 0x2c IP_FW_RESETLOG = 0x2d IP_FW_ZERO = 0x2b IP_HDRINCL = 0x2 IP_IPSEC_POLICY = 0x15 IP_MAXPACKET = 0xffff IP_MAX_GROUP_SRC_FILTER = 0x200 IP_MAX_MEMBERSHIPS = 0xfff IP_MAX_SOCK_MUTE_FILTER = 0x80 IP_MAX_SOCK_SRC_FILTER = 0x80 IP_MF = 0x2000 IP_MIN_MEMBERSHIPS = 0x1f IP_MSFILTER = 0x4a IP_MSS = 0x240 IP_MULTICAST_IF = 0x9 IP_MULTICAST_IFINDEX = 0x42 IP_MULTICAST_LOOP = 0xb IP_MULTICAST_TTL = 0xa IP_MULTICAST_VIF = 0xe IP_NAT__XXX = 0x37 IP_OFFMASK = 0x1fff IP_OLD_FW_ADD = 0x32 IP_OLD_FW_DEL = 0x33 IP_OLD_FW_FLUSH = 0x34 IP_OLD_FW_GET = 0x36 IP_OLD_FW_RESETLOG = 0x38 IP_OLD_FW_ZERO = 0x35 IP_OPTIONS = 0x1 IP_PKTINFO = 0x1a IP_PORTRANGE = 0x13 IP_PORTRANGE_DEFAULT = 0x0 IP_PORTRANGE_HIGH = 0x1 IP_PORTRANGE_LOW = 0x2 IP_RECVDSTADDR = 0x7 IP_RECVIF = 0x14 IP_RECVOPTS = 0x5 IP_RECVPKTINFO = 0x1a IP_RECVRETOPTS = 0x6 IP_RECVTOS = 0x1b IP_RECVTTL = 0x18 IP_RETOPTS = 0x8 IP_RF = 0x8000 IP_RSVP_OFF = 0x10 IP_RSVP_ON = 0xf IP_RSVP_VIF_OFF = 0x12 IP_RSVP_VIF_ON = 0x11 IP_STRIPHDR = 0x17 IP_TOS = 0x3 IP_TRAFFIC_MGT_BACKGROUND = 0x41 IP_TTL = 0x4 IP_UNBLOCK_SOURCE = 0x49 ISIG = 0x80 ISTRIP = 0x20 IUTF8 = 0x4000 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 KERN_HOSTNAME = 0xa KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 MADV_CAN_REUSE = 0x9 MADV_DONTNEED = 0x4 MADV_FREE = 0x5 MADV_FREE_REUSABLE = 0x7 MADV_FREE_REUSE = 0x8 MADV_NORMAL = 0x0 MADV_PAGEOUT = 0xa MADV_RANDOM = 0x1 MADV_SEQUENTIAL = 0x2 MADV_WILLNEED = 0x3 MADV_ZERO_WIRED_PAGES = 0x6 MAP_ANON = 0x1000 MAP_ANONYMOUS = 0x1000 MAP_COPY = 0x2 MAP_FILE = 0x0 MAP_FIXED = 0x10 MAP_HASSEMAPHORE = 0x200 MAP_JIT = 0x800 MAP_NOCACHE = 0x400 MAP_NOEXTEND = 0x100 MAP_NORESERVE = 0x40 MAP_PRIVATE = 0x2 MAP_RENAME = 0x20 MAP_RESERVED0080 = 0x80 MAP_RESILIENT_CODESIGN = 0x2000 MAP_RESILIENT_MEDIA = 0x4000 MAP_SHARED = 0x1 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MNT_ASYNC = 0x40 MNT_AUTOMOUNTED = 0x400000 MNT_CMDFLAGS = 0xf0000 MNT_CPROTECT = 0x80 MNT_DEFWRITE = 0x2000000 MNT_DONTBROWSE = 0x100000 MNT_DOVOLFS = 0x8000 MNT_DWAIT = 0x4 MNT_EXPORTED = 0x100 MNT_FORCE = 0x80000 MNT_IGNORE_OWNERSHIP = 0x200000 MNT_JOURNALED = 0x800000 MNT_LOCAL = 0x1000 MNT_MULTILABEL = 0x4000000 MNT_NOATIME = 0x10000000 MNT_NOBLOCK = 0x20000 MNT_NODEV = 0x10 MNT_NOEXEC = 0x4 MNT_NOSUID = 0x8 MNT_NOUSERXATTR = 0x1000000 MNT_NOWAIT = 0x2 MNT_QUARANTINE = 0x400 MNT_QUOTA = 0x2000 MNT_RDONLY = 0x1 MNT_RELOAD = 0x40000 MNT_ROOTFS = 0x4000 MNT_SYNCHRONOUS = 0x2 MNT_UNION = 0x20 MNT_UNKNOWNPERMISSIONS = 0x200000 MNT_UPDATE = 0x10000 MNT_VISFLAGMASK = 0x17f0f5ff MNT_WAIT = 0x1 MSG_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 MSG_DONTWAIT = 0x80 MSG_EOF = 0x100 MSG_EOR = 0x8 MSG_FLUSH = 0x400 MSG_HAVEMORE = 0x2000 MSG_HOLD = 0x800 MSG_NEEDSA = 0x10000 MSG_OOB = 0x1 MSG_PEEK = 0x2 MSG_RCVMORE = 0x4000 MSG_SEND = 0x1000 MSG_TRUNC = 0x10 MSG_WAITALL = 0x40 MSG_WAITSTREAM = 0x200 MS_ASYNC = 0x1 MS_DEACTIVATE = 0x8 MS_INVALIDATE = 0x2 MS_KILLPAGES = 0x4 MS_SYNC = 0x10 NAME_MAX = 0xff NET_RT_DUMP = 0x1 NET_RT_DUMP2 = 0x7 NET_RT_FLAGS = 0x2 NET_RT_IFLIST = 0x3 NET_RT_IFLIST2 = 0x6 NET_RT_MAXID = 0xa NET_RT_STAT = 0x4 NET_RT_TRASH = 0x5 NFDBITS = 0x20 NL0 = 0x0 NL1 = 0x100 NL2 = 0x200 NL3 = 0x300 NLDLY = 0x300 NOFLSH = 0x80000000 NOKERNINFO = 0x2000000 NOTE_ABSOLUTE = 0x8 NOTE_ATTRIB = 0x8 NOTE_BACKGROUND = 0x40 NOTE_CHILD = 0x4 NOTE_CRITICAL = 0x20 NOTE_DELETE = 0x1 NOTE_EXEC = 0x20000000 NOTE_EXIT = 0x80000000 NOTE_EXITSTATUS = 0x4000000 NOTE_EXIT_CSERROR = 0x40000 NOTE_EXIT_DECRYPTFAIL = 0x10000 NOTE_EXIT_DETAIL = 0x2000000 NOTE_EXIT_DETAIL_MASK = 0x70000 NOTE_EXIT_MEMORY = 0x20000 NOTE_EXIT_REPARENTED = 0x80000 NOTE_EXTEND = 0x4 NOTE_FFAND = 0x40000000 NOTE_FFCOPY = 0xc0000000 NOTE_FFCTRLMASK = 0xc0000000 NOTE_FFLAGSMASK = 0xffffff NOTE_FFNOP = 0x0 NOTE_FFOR = 0x80000000 NOTE_FORK = 0x40000000 NOTE_FUNLOCK = 0x100 NOTE_LEEWAY = 0x10 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 NOTE_MACH_CONTINUOUS_TIME = 0x80 NOTE_NONE = 0x80 NOTE_NSECONDS = 0x4 NOTE_OOB = 0x2 NOTE_PCTRLMASK = -0x100000 NOTE_PDATAMASK = 0xfffff NOTE_REAP = 0x10000000 NOTE_RENAME = 0x20 NOTE_REVOKE = 0x40 NOTE_SECONDS = 0x1 NOTE_SIGNAL = 0x8000000 NOTE_TRACK = 0x1 NOTE_TRACKERR = 0x2 NOTE_TRIGGER = 0x1000000 NOTE_USECONDS = 0x2 NOTE_VM_ERROR = 0x10000000 NOTE_VM_PRESSURE = 0x80000000 NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 NOTE_VM_PRESSURE_TERMINATE = 0x40000000 NOTE_WRITE = 0x2 OCRNL = 0x10 OFDEL = 0x20000 OFILL = 0x80 ONLCR = 0x2 ONLRET = 0x40 ONOCR = 0x20 ONOEOT = 0x8 OPOST = 0x1 OXTABS = 0x4 O_ACCMODE = 0x3 O_ALERT = 0x20000000 O_APPEND = 0x8 O_ASYNC = 0x40 O_CLOEXEC = 0x1000000 O_CREAT = 0x200 O_DIRECTORY = 0x100000 O_DP_GETRAWENCRYPTED = 0x1 O_DP_GETRAWUNENCRYPTED = 0x2 O_DSYNC = 0x400000 O_EVTONLY = 0x8000 O_EXCL = 0x800 O_EXLOCK = 0x20 O_FSYNC = 0x80 O_NDELAY = 0x4 O_NOCTTY = 0x20000 O_NOFOLLOW = 0x100 O_NONBLOCK = 0x4 O_POPUP = 0x80000000 O_RDONLY = 0x0 O_RDWR = 0x2 O_SHLOCK = 0x10 O_SYMLINK = 0x200000 O_SYNC = 0x80 O_TRUNC = 0x400 O_WRONLY = 0x1 PARENB = 0x1000 PARMRK = 0x8 PARODD = 0x2000 PENDIN = 0x20000000 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 PROT_EXEC = 0x4 PROT_NONE = 0x0 PROT_READ = 0x1 PROT_WRITE = 0x2 PT_ATTACH = 0xa PT_ATTACHEXC = 0xe PT_CONTINUE = 0x7 PT_DENY_ATTACH = 0x1f PT_DETACH = 0xb PT_FIRSTMACH = 0x20 PT_FORCEQUOTA = 0x1e PT_KILL = 0x8 PT_READ_D = 0x2 PT_READ_I = 0x1 PT_READ_U = 0x3 PT_SIGEXC = 0xc PT_STEP = 0x9 PT_THUPDATE = 0xd PT_TRACE_ME = 0x0 PT_WRITE_D = 0x5 PT_WRITE_I = 0x4 PT_WRITE_U = 0x6 RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 RLIMIT_CPU_USAGE_MONITOR = 0x2 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 RLIMIT_NPROC = 0x7 RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 RTAX_BRD = 0x7 RTAX_DST = 0x0 RTAX_GATEWAY = 0x1 RTAX_GENMASK = 0x3 RTAX_IFA = 0x5 RTAX_IFP = 0x4 RTAX_MAX = 0x8 RTAX_NETMASK = 0x2 RTA_AUTHOR = 0x40 RTA_BRD = 0x80 RTA_DST = 0x1 RTA_GATEWAY = 0x2 RTA_GENMASK = 0x8 RTA_IFA = 0x20 RTA_IFP = 0x10 RTA_NETMASK = 0x4 RTF_BLACKHOLE = 0x1000 RTF_BROADCAST = 0x400000 RTF_CLONING = 0x100 RTF_CONDEMNED = 0x2000000 RTF_DELCLONE = 0x80 RTF_DONE = 0x40 RTF_DYNAMIC = 0x10 RTF_GATEWAY = 0x2 RTF_HOST = 0x4 RTF_IFREF = 0x4000000 RTF_IFSCOPE = 0x1000000 RTF_LLINFO = 0x400 RTF_LOCAL = 0x200000 RTF_MODIFIED = 0x20 RTF_MULTICAST = 0x800000 RTF_NOIFREF = 0x2000 RTF_PINNED = 0x100000 RTF_PRCLONING = 0x10000 RTF_PROTO1 = 0x8000 RTF_PROTO2 = 0x4000 RTF_PROTO3 = 0x40000 RTF_PROXY = 0x8000000 RTF_REJECT = 0x8 RTF_ROUTER = 0x10000000 RTF_STATIC = 0x800 RTF_UP = 0x1 RTF_WASCLONED = 0x20000 RTF_XRESOLVE = 0x200 RTM_ADD = 0x1 RTM_CHANGE = 0x3 RTM_DELADDR = 0xd RTM_DELETE = 0x2 RTM_DELMADDR = 0x10 RTM_GET = 0x4 RTM_GET2 = 0x14 RTM_IFINFO = 0xe RTM_IFINFO2 = 0x12 RTM_LOCK = 0x8 RTM_LOSING = 0x5 RTM_MISS = 0x7 RTM_NEWADDR = 0xc RTM_NEWMADDR = 0xf RTM_NEWMADDR2 = 0x13 RTM_OLDADD = 0x9 RTM_OLDDEL = 0xa RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb RTM_RTTUNIT = 0xf4240 RTM_VERSION = 0x5 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 RTV_MTU = 0x1 RTV_RPIPE = 0x8 RTV_RTT = 0x40 RTV_RTTVAR = 0x80 RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 SCM_CREDS = 0x3 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIMESTAMP_MONOTONIC = 0x4 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 SIOCADDMULTI = 0x80206931 SIOCAIFADDR = 0x8040691a SIOCARPIPLL = 0xc0206928 SIOCATMARK = 0x40047307 SIOCAUTOADDR = 0xc0206926 SIOCAUTONETMASK = 0x80206927 SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 SIOCDIFPHYADDR = 0x80206941 SIOCGDRVSPEC = 0xc028697b SIOCGETVLAN = 0xc020697f SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0206921 SIOCGIFALTMTU = 0xc0206948 SIOCGIFASYNCMAP = 0xc020697c SIOCGIFBOND = 0xc0206947 SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCAP = 0xc020695b SIOCGIFCONF = 0xc00c6924 SIOCGIFDEVMTU = 0xc0206944 SIOCGIFDSTADDR = 0xc0206922 SIOCGIFFLAGS = 0xc0206911 SIOCGIFGENERIC = 0xc020693a SIOCGIFKPI = 0xc0206987 SIOCGIFMAC = 0xc0206982 SIOCGIFMEDIA = 0xc02c6938 SIOCGIFMETRIC = 0xc0206917 SIOCGIFMTU = 0xc0206933 SIOCGIFNETMASK = 0xc0206925 SIOCGIFPDSTADDR = 0xc0206940 SIOCGIFPHYS = 0xc0206935 SIOCGIFPSRCADDR = 0xc020693f SIOCGIFSTATUS = 0xc331693d SIOCGIFVLAN = 0xc020697f SIOCGIFWAKEFLAGS = 0xc0206988 SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 SIOCIFCREATE = 0xc0206978 SIOCIFCREATE2 = 0xc020697a SIOCIFDESTROY = 0x80206979 SIOCIFGCLONERS = 0xc0106981 SIOCRSLVMULTI = 0xc010693b SIOCSDRVSPEC = 0x8028697b SIOCSETVLAN = 0x8020697e SIOCSHIWAT = 0x80047300 SIOCSIFADDR = 0x8020690c SIOCSIFALTMTU = 0x80206945 SIOCSIFASYNCMAP = 0x8020697d SIOCSIFBOND = 0x80206946 SIOCSIFBRDADDR = 0x80206913 SIOCSIFCAP = 0x8020695a SIOCSIFDSTADDR = 0x8020690e SIOCSIFFLAGS = 0x80206910 SIOCSIFGENERIC = 0x80206939 SIOCSIFKPI = 0x80206986 SIOCSIFLLADDR = 0x8020693c SIOCSIFMAC = 0x80206983 SIOCSIFMEDIA = 0xc0206937 SIOCSIFMETRIC = 0x80206918 SIOCSIFMTU = 0x80206934 SIOCSIFNETMASK = 0x80206916 SIOCSIFPHYADDR = 0x8040693e SIOCSIFPHYS = 0x80206936 SIOCSIFVLAN = 0x8020697e SIOCSLOWAT = 0x80047302 SIOCSPGRP = 0x80047308 SOCK_DGRAM = 0x2 SOCK_MAXADDRLEN = 0xff SOCK_RAW = 0x3 SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 SO_BROADCAST = 0x20 SO_DEBUG = 0x1 SO_DONTROUTE = 0x10 SO_DONTTRUNC = 0x2000 SO_ERROR = 0x1007 SO_KEEPALIVE = 0x8 SO_LABEL = 0x1010 SO_LINGER = 0x80 SO_LINGER_SEC = 0x1080 SO_NETSVC_MARKING_LEVEL = 0x1119 SO_NET_SERVICE_TYPE = 0x1116 SO_NKE = 0x1021 SO_NOADDRERR = 0x1023 SO_NOSIGPIPE = 0x1022 SO_NOTIFYCONFLICT = 0x1026 SO_NP_EXTENSIONS = 0x1083 SO_NREAD = 0x1020 SO_NUMRCVPKT = 0x1112 SO_NWRITE = 0x1024 SO_OOBINLINE = 0x100 SO_PEERLABEL = 0x1011 SO_RANDOMPORT = 0x1082 SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_REUSESHAREUID = 0x1025 SO_SNDBUF = 0x1001 SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 SO_TIMESTAMP = 0x400 SO_TIMESTAMP_MONOTONIC = 0x800 SO_TYPE = 0x1008 SO_UPCALLCLOSEWAIT = 0x1027 SO_USELOOPBACK = 0x40 SO_WANTMORE = 0x4000 SO_WANTOOBFLAG = 0x8000 S_IEXEC = 0x40 S_IFBLK = 0x6000 S_IFCHR = 0x2000 S_IFDIR = 0x4000 S_IFIFO = 0x1000 S_IFLNK = 0xa000 S_IFMT = 0xf000 S_IFREG = 0x8000 S_IFSOCK = 0xc000 S_IFWHT = 0xe000 S_IREAD = 0x100 S_IRGRP = 0x20 S_IROTH = 0x4 S_IRUSR = 0x100 S_IRWXG = 0x38 S_IRWXO = 0x7 S_IRWXU = 0x1c0 S_ISGID = 0x400 S_ISTXT = 0x200 S_ISUID = 0x800 S_ISVTX = 0x200 S_IWGRP = 0x10 S_IWOTH = 0x2 S_IWRITE = 0x80 S_IWUSR = 0x80 S_IXGRP = 0x8 S_IXOTH = 0x1 S_IXUSR = 0x40 TAB0 = 0x0 TAB1 = 0x400 TAB2 = 0x800 TAB3 = 0x4 TABDLY = 0xc04 TCIFLUSH = 0x1 TCIOFF = 0x3 TCIOFLUSH = 0x3 TCION = 0x4 TCOFLUSH = 0x2 TCOOFF = 0x1 TCOON = 0x2 TCP_CONNECTIONTIMEOUT = 0x20 TCP_CONNECTION_INFO = 0x106 TCP_ENABLE_ECN = 0x104 TCP_FASTOPEN = 0x105 TCP_KEEPALIVE = 0x10 TCP_KEEPCNT = 0x102 TCP_KEEPINTVL = 0x101 TCP_MAXHLEN = 0x3c TCP_MAXOLEN = 0x28 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff TCP_MAX_SACK = 0x4 TCP_MAX_WINSHIFT = 0xe TCP_MINMSS = 0xd8 TCP_MSS = 0x200 TCP_NODELAY = 0x1 TCP_NOOPT = 0x8 TCP_NOPUSH = 0x4 TCP_NOTSENT_LOWAT = 0x201 TCP_RXT_CONNDROPTIME = 0x80 TCP_RXT_FINDROP = 0x100 TCP_SENDMOREACKS = 0x103 TCSAFLUSH = 0x2 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 TIOCCONS = 0x80047462 TIOCDCDTIMESTAMP = 0x40107458 TIOCDRAIN = 0x2000745e TIOCDSIMICROCODE = 0x20007455 TIOCEXCL = 0x2000740d TIOCEXT = 0x80047460 TIOCFLUSH = 0x80047410 TIOCGDRAINWAIT = 0x40047456 TIOCGETA = 0x40487413 TIOCGETD = 0x4004741a TIOCGPGRP = 0x40047477 TIOCGWINSZ = 0x40087468 TIOCIXOFF = 0x20007480 TIOCIXON = 0x20007481 TIOCMBIC = 0x8004746b TIOCMBIS = 0x8004746c TIOCMGDTRWAIT = 0x4004745a TIOCMGET = 0x4004746a TIOCMODG = 0x40047403 TIOCMODS = 0x80047404 TIOCMSDTRWAIT = 0x8004745b TIOCMSET = 0x8004746d TIOCM_CAR = 0x40 TIOCM_CD = 0x40 TIOCM_CTS = 0x20 TIOCM_DSR = 0x100 TIOCM_DTR = 0x2 TIOCM_LE = 0x1 TIOCM_RI = 0x80 TIOCM_RNG = 0x80 TIOCM_RTS = 0x4 TIOCM_SR = 0x10 TIOCM_ST = 0x8 TIOCNOTTY = 0x20007471 TIOCNXCL = 0x2000740e TIOCOUTQ = 0x40047473 TIOCPKT = 0x80047470 TIOCPKT_DATA = 0x0 TIOCPKT_DOSTOP = 0x20 TIOCPKT_FLUSHREAD = 0x1 TIOCPKT_FLUSHWRITE = 0x2 TIOCPKT_IOCTL = 0x40 TIOCPKT_NOSTOP = 0x10 TIOCPKT_START = 0x8 TIOCPKT_STOP = 0x4 TIOCPTYGNAME = 0x40807453 TIOCPTYGRANT = 0x20007454 TIOCPTYUNLK = 0x20007452 TIOCREMOTE = 0x80047469 TIOCSBRK = 0x2000747b TIOCSCONS = 0x20007463 TIOCSCTTY = 0x20007461 TIOCSDRAINWAIT = 0x80047457 TIOCSDTR = 0x20007479 TIOCSETA = 0x80487414 TIOCSETAF = 0x80487416 TIOCSETAW = 0x80487415 TIOCSETD = 0x8004741b TIOCSIG = 0x2000745f TIOCSPGRP = 0x80047476 TIOCSTART = 0x2000746e TIOCSTAT = 0x20007465 TIOCSTI = 0x80017472 TIOCSTOP = 0x2000746f TIOCSWINSZ = 0x80087467 TIOCTIMESTAMP = 0x40107459 TIOCUCNTL = 0x80047466 TOSTOP = 0x400000 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 VEOL = 0x1 VEOL2 = 0x2 VERASE = 0x3 VINTR = 0x8 VKILL = 0x5 VLNEXT = 0xe VMIN = 0x10 VM_LOADAVG = 0x2 VM_MACHFACTOR = 0x4 VM_MAXID = 0x6 VM_METER = 0x1 VM_SWAPUSAGE = 0x5 VQUIT = 0x9 VREPRINT = 0x6 VSTART = 0xc VSTATUS = 0x12 VSTOP = 0xd VSUSP = 0xa VT0 = 0x0 VT1 = 0x10000 VTDLY = 0x10000 VTIME = 0x11 VWERASE = 0x4 WCONTINUED = 0x10 WCOREFLAG = 0x80 WEXITED = 0x4 WNOHANG = 0x1 WNOWAIT = 0x20 WORDSIZE = 0x40 WSTOPPED = 0x8 WUNTRACED = 0x2 XATTR_CREATE = 0x2 XATTR_NODEFAULT = 0x10 XATTR_NOFOLLOW = 0x1 XATTR_NOSECURITY = 0x8 XATTR_REPLACE = 0x4 XATTR_SHOWCOMPRESSION = 0x20 ) // Errors const ( E2BIG = syscall.Errno(0x7) EACCES = syscall.Errno(0xd) EADDRINUSE = syscall.Errno(0x30) EADDRNOTAVAIL = syscall.Errno(0x31) EAFNOSUPPORT = syscall.Errno(0x2f) EAGAIN = syscall.Errno(0x23) EALREADY = syscall.Errno(0x25) EAUTH = syscall.Errno(0x50) EBADARCH = syscall.Errno(0x56) EBADEXEC = syscall.Errno(0x55) EBADF = syscall.Errno(0x9) EBADMACHO = syscall.Errno(0x58) EBADMSG = syscall.Errno(0x5e) EBADRPC = syscall.Errno(0x48) EBUSY = syscall.Errno(0x10) ECANCELED = syscall.Errno(0x59) ECHILD = syscall.Errno(0xa) ECONNABORTED = syscall.Errno(0x35) ECONNREFUSED = syscall.Errno(0x3d) ECONNRESET = syscall.Errno(0x36) EDEADLK = syscall.Errno(0xb) EDESTADDRREQ = syscall.Errno(0x27) EDEVERR = syscall.Errno(0x53) EDOM = syscall.Errno(0x21) EDQUOT = syscall.Errno(0x45) EEXIST = syscall.Errno(0x11) EFAULT = syscall.Errno(0xe) EFBIG = syscall.Errno(0x1b) EFTYPE = syscall.Errno(0x4f) EHOSTDOWN = syscall.Errno(0x40) EHOSTUNREACH = syscall.Errno(0x41) EIDRM = syscall.Errno(0x5a) EILSEQ = syscall.Errno(0x5c) EINPROGRESS = syscall.Errno(0x24) EINTR = syscall.Errno(0x4) EINVAL = syscall.Errno(0x16) EIO = syscall.Errno(0x5) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) ELAST = syscall.Errno(0x6a) ELOOP = syscall.Errno(0x3e) EMFILE = syscall.Errno(0x18) EMLINK = syscall.Errno(0x1f) EMSGSIZE = syscall.Errno(0x28) EMULTIHOP = syscall.Errno(0x5f) ENAMETOOLONG = syscall.Errno(0x3f) ENEEDAUTH = syscall.Errno(0x51) ENETDOWN = syscall.Errno(0x32) ENETRESET = syscall.Errno(0x34) ENETUNREACH = syscall.Errno(0x33) ENFILE = syscall.Errno(0x17) ENOATTR = syscall.Errno(0x5d) ENOBUFS = syscall.Errno(0x37) ENODATA = syscall.Errno(0x60) ENODEV = syscall.Errno(0x13) ENOENT = syscall.Errno(0x2) ENOEXEC = syscall.Errno(0x8) ENOLCK = syscall.Errno(0x4d) ENOLINK = syscall.Errno(0x61) ENOMEM = syscall.Errno(0xc) ENOMSG = syscall.Errno(0x5b) ENOPOLICY = syscall.Errno(0x67) ENOPROTOOPT = syscall.Errno(0x2a) ENOSPC = syscall.Errno(0x1c) ENOSR = syscall.Errno(0x62) ENOSTR = syscall.Errno(0x63) ENOSYS = syscall.Errno(0x4e) ENOTBLK = syscall.Errno(0xf) ENOTCONN = syscall.Errno(0x39) ENOTDIR = syscall.Errno(0x14) ENOTEMPTY = syscall.Errno(0x42) ENOTRECOVERABLE = syscall.Errno(0x68) ENOTSOCK = syscall.Errno(0x26) ENOTSUP = syscall.Errno(0x2d) ENOTTY = syscall.Errno(0x19) ENXIO = syscall.Errno(0x6) EOPNOTSUPP = syscall.Errno(0x66) EOVERFLOW = syscall.Errno(0x54) EOWNERDEAD = syscall.Errno(0x69) EPERM = syscall.Errno(0x1) EPFNOSUPPORT = syscall.Errno(0x2e) EPIPE = syscall.Errno(0x20) EPROCLIM = syscall.Errno(0x43) EPROCUNAVAIL = syscall.Errno(0x4c) EPROGMISMATCH = syscall.Errno(0x4b) EPROGUNAVAIL = syscall.Errno(0x4a) EPROTO = syscall.Errno(0x64) EPROTONOSUPPORT = syscall.Errno(0x2b) EPROTOTYPE = syscall.Errno(0x29) EPWROFF = syscall.Errno(0x52) EQFULL = syscall.Errno(0x6a) ERANGE = syscall.Errno(0x22) EREMOTE = syscall.Errno(0x47) EROFS = syscall.Errno(0x1e) ERPCMISMATCH = syscall.Errno(0x49) ESHLIBVERS = syscall.Errno(0x57) ESHUTDOWN = syscall.Errno(0x3a) ESOCKTNOSUPPORT = syscall.Errno(0x2c) ESPIPE = syscall.Errno(0x1d) ESRCH = syscall.Errno(0x3) ESTALE = syscall.Errno(0x46) ETIME = syscall.Errno(0x65) ETIMEDOUT = syscall.Errno(0x3c) ETOOMANYREFS = syscall.Errno(0x3b) ETXTBSY = syscall.Errno(0x1a) EUSERS = syscall.Errno(0x44) EWOULDBLOCK = syscall.Errno(0x23) EXDEV = syscall.Errno(0x12) ) // Signals const ( SIGABRT = syscall.Signal(0x6) SIGALRM = syscall.Signal(0xe) SIGBUS = syscall.Signal(0xa) SIGCHLD = syscall.Signal(0x14) SIGCONT = syscall.Signal(0x13) SIGEMT = syscall.Signal(0x7) SIGFPE = syscall.Signal(0x8) SIGHUP = syscall.Signal(0x1) SIGILL = syscall.Signal(0x4) SIGINFO = syscall.Signal(0x1d) SIGINT = syscall.Signal(0x2) SIGIO = syscall.Signal(0x17) SIGIOT = syscall.Signal(0x6) SIGKILL = syscall.Signal(0x9) SIGPIPE = syscall.Signal(0xd) SIGPROF = syscall.Signal(0x1b) SIGQUIT = syscall.Signal(0x3) SIGSEGV = syscall.Signal(0xb) SIGSTOP = syscall.Signal(0x11) SIGSYS = syscall.Signal(0xc) SIGTERM = syscall.Signal(0xf) SIGTRAP = syscall.Signal(0x5) SIGTSTP = syscall.Signal(0x12) SIGTTIN = syscall.Signal(0x15) SIGTTOU = syscall.Signal(0x16) SIGURG = syscall.Signal(0x10) SIGUSR1 = syscall.Signal(0x1e) SIGUSR2 = syscall.Signal(0x1f) SIGVTALRM = syscall.Signal(0x1a) SIGWINCH = syscall.Signal(0x1c) SIGXCPU = syscall.Signal(0x18) SIGXFSZ = syscall.Signal(0x19) ) // Error table var errorList = [...]struct { num syscall.Errno name string desc string }{ {1, "EPERM", "operation not permitted"}, {2, "ENOENT", "no such file or directory"}, {3, "ESRCH", "no such process"}, {4, "EINTR", "interrupted system call"}, {5, "EIO", "input/output error"}, {6, "ENXIO", "device not configured"}, {7, "E2BIG", "argument list too long"}, {8, "ENOEXEC", "exec format error"}, {9, "EBADF", "bad file descriptor"}, {10, "ECHILD", "no child processes"}, {11, "EDEADLK", "resource deadlock avoided"}, {12, "ENOMEM", "cannot allocate memory"}, {13, "EACCES", "permission denied"}, {14, "EFAULT", "bad address"}, {15, "ENOTBLK", "block device required"}, {16, "EBUSY", "resource busy"}, {17, "EEXIST", "file exists"}, {18, "EXDEV", "cross-device link"}, {19, "ENODEV", "operation not supported by device"}, {20, "ENOTDIR", "not a directory"}, {21, "EISDIR", "is a directory"}, {22, "EINVAL", "invalid argument"}, {23, "ENFILE", "too many open files in system"}, {24, "EMFILE", "too many open files"}, {25, "ENOTTY", "inappropriate ioctl for device"}, {26, "ETXTBSY", "text file busy"}, {27, "EFBIG", "file too large"}, {28, "ENOSPC", "no space left on device"}, {29, "ESPIPE", "illegal seek"}, {30, "EROFS", "read-only file system"}, {31, "EMLINK", "too many links"}, {32, "EPIPE", "broken pipe"}, {33, "EDOM", "numerical argument out of domain"}, {34, "ERANGE", "result too large"}, {35, "EAGAIN", "resource temporarily unavailable"}, {36, "EINPROGRESS", "operation now in progress"}, {37, "EALREADY", "operation already in progress"}, {38, "ENOTSOCK", "socket operation on non-socket"}, {39, "EDESTADDRREQ", "destination address required"}, {40, "EMSGSIZE", "message too long"}, {41, "EPROTOTYPE", "protocol wrong type for socket"}, {42, "ENOPROTOOPT", "protocol not available"}, {43, "EPROTONOSUPPORT", "protocol not supported"}, {44, "ESOCKTNOSUPPORT", "socket type not supported"}, {45, "ENOTSUP", "operation not supported"}, {46, "EPFNOSUPPORT", "protocol family not supported"}, {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, {48, "EADDRINUSE", "address already in use"}, {49, "EADDRNOTAVAIL", "can't assign requested address"}, {50, "ENETDOWN", "network is down"}, {51, "ENETUNREACH", "network is unreachable"}, {52, "ENETRESET", "network dropped connection on reset"}, {53, "ECONNABORTED", "software caused connection abort"}, {54, "ECONNRESET", "connection reset by peer"}, {55, "ENOBUFS", "no buffer space available"}, {56, "EISCONN", "socket is already connected"}, {57, "ENOTCONN", "socket is not connected"}, {58, "ESHUTDOWN", "can't send after socket shutdown"}, {59, "ETOOMANYREFS", "too many references: can't splice"}, {60, "ETIMEDOUT", "operation timed out"}, {61, "ECONNREFUSED", "connection refused"}, {62, "ELOOP", "too many levels of symbolic links"}, {63, "ENAMETOOLONG", "file name too long"}, {64, "EHOSTDOWN", "host is down"}, {65, "EHOSTUNREACH", "no route to host"}, {66, "ENOTEMPTY", "directory not empty"}, {67, "EPROCLIM", "too many processes"}, {68, "EUSERS", "too many users"}, {69, "EDQUOT", "disc quota exceeded"}, {70, "ESTALE", "stale NFS file handle"}, {71, "EREMOTE", "too many levels of remote in path"}, {72, "EBADRPC", "RPC struct is bad"}, {73, "ERPCMISMATCH", "RPC version wrong"}, {74, "EPROGUNAVAIL", "RPC prog. not avail"}, {75, "EPROGMISMATCH", "program version wrong"}, {76, "EPROCUNAVAIL", "bad procedure for program"}, {77, "ENOLCK", "no locks available"}, {78, "ENOSYS", "function not implemented"}, {79, "EFTYPE", "inappropriate file type or format"}, {80, "EAUTH", "authentication error"}, {81, "ENEEDAUTH", "need authenticator"}, {82, "EPWROFF", "device power is off"}, {83, "EDEVERR", "device error"}, {84, "EOVERFLOW", "value too large to be stored in data type"}, {85, "EBADEXEC", "bad executable (or shared library)"}, {86, "EBADARCH", "bad CPU type in executable"}, {87, "ESHLIBVERS", "shared library version mismatch"}, {88, "EBADMACHO", "malformed Mach-o file"}, {89, "ECANCELED", "operation canceled"}, {90, "EIDRM", "identifier removed"}, {91, "ENOMSG", "no message of desired type"}, {92, "EILSEQ", "illegal byte sequence"}, {93, "ENOATTR", "attribute not found"}, {94, "EBADMSG", "bad message"}, {95, "EMULTIHOP", "EMULTIHOP (Reserved)"}, {96, "ENODATA", "no message available on STREAM"}, {97, "ENOLINK", "ENOLINK (Reserved)"}, {98, "ENOSR", "no STREAM resources"}, {99, "ENOSTR", "not a STREAM"}, {100, "EPROTO", "protocol error"}, {101, "ETIME", "STREAM ioctl timeout"}, {102, "EOPNOTSUPP", "operation not supported on socket"}, {103, "ENOPOLICY", "policy not found"}, {104, "ENOTRECOVERABLE", "state not recoverable"}, {105, "EOWNERDEAD", "previous owner died"}, {106, "EQFULL", "interface output queue is full"}, } // Signal table var signalList = [...]struct { num syscall.Signal name string desc string }{ {1, "SIGHUP", "hangup"}, {2, "SIGINT", "interrupt"}, {3, "SIGQUIT", "quit"}, {4, "SIGILL", "illegal instruction"}, {5, "SIGTRAP", "trace/BPT trap"}, {6, "SIGABRT", "abort trap"}, {7, "SIGEMT", "EMT trap"}, {8, "SIGFPE", "floating point exception"}, {9, "SIGKILL", "killed"}, {10, "SIGBUS", "bus error"}, {11, "SIGSEGV", "segmentation fault"}, {12, "SIGSYS", "bad system call"}, {13, "SIGPIPE", "broken pipe"}, {14, "SIGALRM", "alarm clock"}, {15, "SIGTERM", "terminated"}, {16, "SIGURG", "urgent I/O condition"}, {17, "SIGSTOP", "suspended (signal)"}, {18, "SIGTSTP", "suspended"}, {19, "SIGCONT", "continued"}, {20, "SIGCHLD", "child exited"}, {21, "SIGTTIN", "stopped (tty input)"}, {22, "SIGTTOU", "stopped (tty output)"}, {23, "SIGIO", "I/O possible"}, {24, "SIGXCPU", "cputime limit exceeded"}, {25, "SIGXFSZ", "filesize limit exceeded"}, {26, "SIGVTALRM", "virtual timer expired"}, {27, "SIGPROF", "profiling timer expired"}, {28, "SIGWINCH", "window size changes"}, {29, "SIGINFO", "information request"}, {30, "SIGUSR1", "user defined signal 1"}, {31, "SIGUSR2", "user defined signal 2"}, }
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <objc/NSObject.h> __attribute__((visibility("hidden"))) @interface NWInterfaceSource : NSObject { unsigned int _ifIndex; unsigned long long _srcRef; unsigned long long _threshold; } @property unsigned int ifIndex; // @synthesize ifIndex=_ifIndex; @property unsigned long long threshold; // @synthesize threshold=_threshold; @property unsigned long long srcRef; // @synthesize srcRef=_srcRef; @end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2659" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="POl-nr-gpe"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> <dependencies> <deployment identifier="iOS"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--Item 2--> <scene sceneID="39c-GB-COE"> <objects> <viewController id="Rsr-Uq-8bf" customClass="KYWheelTabController" customModule="KYWheelTabController" sceneMemberID="viewController"> <layoutGuides> <viewControllerLayoutGuide type="top" id="dmi-rj-ZTn"/> <viewControllerLayoutGuide type="bottom" id="yNp-aN-AHJ"/> </layoutGuides> <view key="view" contentMode="scaleToFill" id="mld-4C-KH6"> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </view> <tabBarItem key="tabBarItem" title="Item 2" id="zbC-Xg-v2D"/> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="kSm-OQ-j9t" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="954" y="409"/> </scene> <!--Item 1--> <scene sceneID="CbX-dl-fwv"> <objects> <viewController id="lcy-BN-LGc" customClass="KYWheelTabController" customModule="KYWheelTabController" sceneMemberID="viewController"> <layoutGuides> <viewControllerLayoutGuide type="top" id="hxq-Mg-4EB"/> <viewControllerLayoutGuide type="bottom" id="hSr-cx-KMi"/> </layoutGuides> <view key="view" contentMode="scaleToFill" id="z3p-r1-hwv"> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </view> <tabBarItem key="tabBarItem" title="Item 1" id="e7c-NZ-CAk"/> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="Yvj-E5-TRY" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="954" y="-251"/> </scene> <!--Wheel Tab Controller--> <scene sceneID="xBx-ai-L2A"> <objects> <tabBarController id="POl-nr-gpe" customClass="KYWheelTabController" customModule="KYWheelTabController" sceneMemberID="viewController"> <tabBar key="tabBar" contentMode="scaleToFill" id="MDo-Cl-87r"> <rect key="frame" x="0.0" y="0.0" width="320" height="49"/> <autoresizingMask key="autoresizingMask"/> <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> </tabBar> <connections> <segue destination="lcy-BN-LGc" kind="relationship" relationship="viewControllers" id="f8r-TZ-CN4"/> <segue destination="Rsr-Uq-8bf" kind="relationship" relationship="viewControllers" id="afe-pg-GeQ"/> </connections> </tabBarController> <placeholder placeholderIdentifier="IBFirstResponder" id="KkX-iJ-BzS" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="134" y="77"/> </scene> </scenes> </document>
{ "pile_set_name": "Github" }
/* * Copyright 2002-2009 the original author or 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 * * https://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.springframework.oxm.mime; import java.io.IOException; import javax.xml.transform.Source; import org.springframework.lang.Nullable; import org.springframework.oxm.Unmarshaller; import org.springframework.oxm.XmlMappingException; /** * Subinterface of {@link org.springframework.oxm.Unmarshaller} that can use MIME attachments * to optimize storage of binary data. Attachments can be added as MTOM, XOP, or SwA. * * @author Arjen Poutsma * @since 3.0 * @see <a href="https://www.w3.org/TR/2004/WD-soap12-mtom-20040608/">SOAP Message Transmission Optimization Mechanism</a> * @see <a href="https://www.w3.org/TR/2005/REC-xop10-20050125/">XML-binary Optimized Packaging</a> */ public interface MimeUnmarshaller extends Unmarshaller { /** * Unmarshals the given provided {@link Source} into an object graph, * reading binary attachments from a {@link MimeContainer}. * @param source the source to marshal from * @param mimeContainer the MIME container to read extracted binary content from * @return the object graph * @throws XmlMappingException if the given source cannot be mapped to an object * @throws IOException if an I/O Exception occurs */ Object unmarshal(Source source, @Nullable MimeContainer mimeContainer) throws XmlMappingException, IOException; }
{ "pile_set_name": "Github" }
using GMap.NET; using log4net; using OSGeo.GDAL; using OSGeo.OGR; using OSGeo.OSR; using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Reflection; using System.Runtime.InteropServices; namespace GDAL { public static class GDAL { private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); static List<GeoBitmap> _cache = new List<GeoBitmap>(); static GDAL() { log.InfoFormat("GDAL static ctor"); GdalConfiguration.ConfigureGdal(); } public delegate void Progress(double percent, string message); public static event Progress OnProgress; public static void ScanDirectory(string path) { if (!Directory.Exists(path)) return; var files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories); int i = 0; foreach (var file in files) { i++; try { // 1kb file check if (new FileInfo(file).Length < 1024 * 1) continue; if (OnProgress != null) OnProgress((i - 1) / (double)files.Length, file); var info = GDAL.LoadImageInfo(file); _cache.Add(info); } catch (Exception ex) { log.Error(ex); } } // lowest res first _cache.Sort((a, b) => { return b.Resolution.CompareTo(a.Resolution); }); } public static GeoBitmap LoadImageInfo(string file) { using (var ds = OSGeo.GDAL.Gdal.Open(file, OSGeo.GDAL.Access.GA_ReadOnly)) { log.InfoFormat("Raster dataset parameters:"); log.InfoFormat(" Projection: " + ds.GetProjectionRef()); log.InfoFormat(" RasterCount: " + ds.RasterCount); log.InfoFormat(" RasterSize (" + ds.RasterXSize + "," + ds.RasterYSize + ")"); OSGeo.GDAL.Driver drv = ds.GetDriver(); log.InfoFormat("Using driver " + drv.LongName); string[] metadata = ds.GetMetadata(""); if (metadata.Length > 0) { log.InfoFormat(" Metadata:"); for (int iMeta = 0; iMeta < metadata.Length; iMeta++) { log.InfoFormat(" " + iMeta + ": " + metadata[iMeta]); } log.InfoFormat(""); } metadata = ds.GetMetadata("IMAGE_STRUCTURE"); if (metadata.Length > 0) { log.InfoFormat(" Image Structure Metadata:"); for (int iMeta = 0; iMeta < metadata.Length; iMeta++) { log.InfoFormat(" " + iMeta + ": " + metadata[iMeta]); } log.InfoFormat(""); } metadata = ds.GetMetadata("SUBDATASETS"); if (metadata.Length > 0) { log.InfoFormat(" Subdatasets:"); for (int iMeta = 0; iMeta < metadata.Length; iMeta++) { log.InfoFormat(" " + iMeta + ": " + metadata[iMeta]); } log.InfoFormat(""); } metadata = ds.GetMetadata("GEOLOCATION"); if (metadata.Length > 0) { log.InfoFormat(" Geolocation:"); for (int iMeta = 0; iMeta < metadata.Length; iMeta++) { log.InfoFormat(" " + iMeta + ": " + metadata[iMeta]); } log.InfoFormat(""); } log.InfoFormat("Corner Coordinates:"); log.InfoFormat(" Upper Left (" + GDALInfoGetPosition(ds, 0.0, 0.0) + ")"); log.InfoFormat(" Lower Left (" + GDALInfoGetPosition(ds, 0.0, ds.RasterYSize) + ")"); log.InfoFormat(" Upper Right (" + GDALInfoGetPosition(ds, ds.RasterXSize, 0.0) + ")"); log.InfoFormat(" Lower Right (" + GDALInfoGetPosition(ds, ds.RasterXSize, ds.RasterYSize) + ")"); log.InfoFormat(" Center (" + GDALInfoGetPosition(ds, ds.RasterXSize / 2, ds.RasterYSize / 2) + ")"); log.InfoFormat(""); string projection = ds.GetProjectionRef(); if (projection != null) { SpatialReference srs = new SpatialReference(null); if (srs.ImportFromWkt(ref projection) == 0) { string wkt; srs.ExportToPrettyWkt(out wkt, 0); log.InfoFormat("Coordinate System is:"); log.InfoFormat(wkt); } else { log.InfoFormat("Coordinate System is:"); log.InfoFormat(projection); } } if (ds.GetGCPCount() > 0) { log.InfoFormat("GCP Projection: ", ds.GetGCPProjection()); GCP[] GCPs = ds.GetGCPs(); for (int i = 0; i < ds.GetGCPCount(); i++) { log.InfoFormat("GCP[" + i + "]: Id=" + GCPs[i].Id + ", Info=" + GCPs[i].Info); log.InfoFormat(" (" + GCPs[i].GCPPixel + "," + GCPs[i].GCPLine + ") -> (" + GCPs[i].GCPX + "," + GCPs[i].GCPY + "," + GCPs[i].GCPZ + ")"); log.InfoFormat(""); } log.InfoFormat(""); double[] transform = new double[6]; Gdal.GCPsToGeoTransform(GCPs, transform, 0); log.InfoFormat("GCP Equivalent geotransformation parameters: ", ds.GetGCPProjection()); for (int i = 0; i < 6; i++) log.InfoFormat("t[" + i + "] = " + transform[i].ToString()); log.InfoFormat(""); } var TL = GDALInfoGetPositionDouble(ds, 0.0, 0.0); var BR = GDALInfoGetPositionDouble(ds, ds.RasterXSize, ds.RasterYSize); var resolution = Math.Abs(BR[0] - TL[0]) / ds.RasterXSize; if (resolution == 1) throw new Exception("Invalid coords"); return new GeoBitmap(file, resolution, ds.RasterXSize, ds.RasterYSize, TL[0], TL[1], BR[0], BR[1]); } } static object locker = new object(); public static Bitmap GetBitmap(double lng1, double lat1, double lng2, double lat2, long width, long height) { if (_cache.Count == 0) return null; Bitmap output = new Bitmap((int)width, (int)height, PixelFormat.Format32bppArgb); int a = 0; using (Graphics g = Graphics.FromImage(output)) { g.Clear(Color.Transparent); RectLatLng request = new RectLatLng(lat1, lng1, lng2 - lng1, lat2 - lat1); //g.DrawString(request.ToString(), Control.DefaultFont, Brushes.Wheat, 0, 0); bool cleared = false; foreach (var image in _cache) { // calc the pixel coord within the image rect var ImageTop = (float)map(request.Top, image.Rect.Top, image.Rect.Bottom, 0, image.RasterYSize); var ImageLeft = (float)map(request.Left, image.Rect.Left, image.Rect.Right, 0, image.RasterXSize); var ImageBottom = (float)map(request.Bottom, image.Rect.Top, image.Rect.Bottom, 0, image.RasterYSize); var ImageRight = (float)map(request.Right, image.Rect.Left, image.Rect.Right, 0, image.RasterXSize); RectangleF rect = new RectangleF(ImageLeft, ImageTop, ImageRight - ImageLeft, ImageBottom - ImageTop); var res = (request.Right - request.Left) / width; if (rect.Left <= image.RasterXSize && rect.Top <= image.RasterYSize && rect.Right >= 0 && rect.Bottom >= 0) { if (!cleared) { //g.Clear(Color.Red); cleared = true; } //if (image.Resolution < (res / 3)) //continue; //Console.WriteLine("{0} <= {1} && {2} <= {3} || {4} >= {5} && {6} >= {7} ", rect.Left, image.RasterXSize, rect.Top, image.RasterYSize, rect.Right, 0, rect.Bottom, 0); try { lock (locker) { if (image.Bitmap == null) continue; // this is wrong g.DrawImage(image.Bitmap, new RectangleF(0, 0, width, height), rect, GraphicsUnit.Pixel); } a++; if (a >= 50) return output; } catch (Exception ex) { log.Error(ex); //throw new Exception("Bad Image "+image.File); } } } if (a == 0) { return null; } return output; } } private static double map(double x, double in_min, double in_max, double out_min, double out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } public static Bitmap LoadImage(string file) { lock (locker) { using (var ds = OSGeo.GDAL.Gdal.Open(file, OSGeo.GDAL.Access.GA_ReadOnly)) { // 8bit geotiff - single band if (ds.RasterCount == 1) { Band band = ds.GetRasterBand(1); if (band == null) return null; ColorTable ct = band.GetRasterColorTable(); PixelFormat format = PixelFormat.Format8bppIndexed; // Create a Bitmap to store the GDAL image in Bitmap bitmap = new Bitmap(ds.RasterXSize, ds.RasterYSize, format); // Obtaining the bitmap buffer BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, ds.RasterXSize, ds.RasterYSize), ImageLockMode.ReadWrite, format); try { if (ct != null) { int iCol = ct.GetCount(); ColorPalette pal = bitmap.Palette; for (int i = 0; i < iCol; i++) { ColorEntry ce = ct.GetColorEntry(i); pal.Entries[i] = Color.FromArgb(ce.c4, ce.c1, ce.c2, ce.c3); } bitmap.Palette = pal; } else { } int stride = bitmapData.Stride; IntPtr buf = bitmapData.Scan0; band.ReadRaster(0, 0, ds.RasterXSize, ds.RasterYSize, buf, ds.RasterXSize, ds.RasterYSize, DataType.GDT_Byte, 1, stride); } finally { bitmap.UnlockBits(bitmapData); } return bitmap; } { Bitmap bitmap = new Bitmap(ds.RasterXSize, ds.RasterYSize, PixelFormat.Format32bppArgb); for (int a = 1; a <= ds.RasterCount; a++) { // Get the GDAL Band objects from the Dataset Band band = ds.GetRasterBand(a); if (band == null) return null; var cint = band.GetColorInterpretation(); // Obtaining the bitmap buffer BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, ds.RasterXSize, ds.RasterYSize), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); try { int stride = bitmapData.Stride; IntPtr buf = bitmapData.Scan0; var buffer = new byte[ds.RasterXSize * ds.RasterYSize]; band.ReadRaster(0, 0, ds.RasterXSize, ds.RasterYSize, buffer, ds.RasterXSize, ds.RasterYSize, 1, ds.RasterXSize); int c = 0; if (cint == ColorInterp.GCI_AlphaBand) foreach (var b in buffer) { Marshal.WriteByte(buf, 3 + c * 4, (byte)b); c++; } else if (cint == ColorInterp.GCI_RedBand) foreach (var b in buffer) { Marshal.WriteByte(buf, 2 + c * 4, (byte)b); c++; } else if (cint == ColorInterp.GCI_GreenBand) foreach (var b in buffer) { Marshal.WriteByte(buf, 1 + c * 4, (byte)b); c++; } else if (cint == ColorInterp.GCI_BlueBand) foreach (var b in buffer) { Marshal.WriteByte(buf, 0 + c * 4, (byte)b); c++; } else { } } finally { bitmap.UnlockBits(bitmapData); } } //bitmap.Save("gdal.bmp", ImageFormat.Bmp); return bitmap; } } } return null; } private static string GDALInfoGetPosition(Dataset ds, double x, double y) { double[] adfGeoTransform = new double[6]; double dfGeoX, dfGeoY; ds.GetGeoTransform(adfGeoTransform); dfGeoX = adfGeoTransform[0] + adfGeoTransform[1] * x + adfGeoTransform[2] * y; dfGeoY = adfGeoTransform[3] + adfGeoTransform[4] * x + adfGeoTransform[5] * y; return dfGeoX.ToString() + ", " + dfGeoY.ToString(); } private static double[] GDALInfoGetPositionDouble(Dataset ds, double x, double y) { double[] adfGeoTransform = new double[6]; double dfGeoX, dfGeoY; ds.GetGeoTransform(adfGeoTransform); dfGeoX = adfGeoTransform[0] + adfGeoTransform[1] * x + adfGeoTransform[2] * y; dfGeoY = adfGeoTransform[3] + adfGeoTransform[4] * x + adfGeoTransform[5] * y; return new double[] { dfGeoX, dfGeoY }; } public class GeoBitmap { Bitmap _bitmap = null; // load on demand public Bitmap Bitmap { get { lock (this) { if (_bitmap == null) _bitmap = LoadImage(File); return _bitmap; } } } public GMap.NET.RectLatLng Rect; public string File; public int RasterXSize; public int RasterYSize; public double Resolution; public GeoBitmap(string file, double resolution, int rasterXSize, int rasterYSize, double Left, double Top, double Right, double Bottom) { this.File = file; this.Resolution = resolution; this.RasterXSize = rasterXSize; this.RasterYSize = rasterYSize; Rect = new GMap.NET.RectLatLng(Top, Left, Right - Left, Top - Bottom); } } //http://www.gisremotesensing.com/2015/09/vector-to-raster-conversion-using-gdal-c.html public static void Rasterize(string inputFeature, string outRaster, string fieldName, int cellSize) { // Define pixel_size and NoData value of new raster int rasterCellSize = cellSize; const double noDataValue = -9999; string outputRasterFile = outRaster; //Register the vector drivers Ogr.RegisterAll(); //Reading the vector data DataSource dataSource = Ogr.Open(inputFeature, 0); var count = dataSource.GetLayerCount(); Layer layer = dataSource.GetLayerByIndex(0); var litems = layer.GetFeatureCount(0); var lname = layer.GetName(); Envelope envelope = new Envelope(); layer.GetExtent(envelope, 0); //Compute the out raster cell resolutions int x_res = Convert.ToInt32((envelope.MaxX - envelope.MinX) / rasterCellSize); int y_res = Convert.ToInt32((envelope.MaxY - envelope.MinY) / rasterCellSize); Console.WriteLine("Extent: " + envelope.MaxX + " " + envelope.MinX + " " + envelope.MaxY + " " + envelope.MinY); Console.WriteLine("X resolution: " + x_res); Console.WriteLine("X resolution: " + y_res); //Register the raster drivers Gdal.AllRegister(); //Check if output raster exists & delete (optional) if (File.Exists(outputRasterFile)) { File.Delete(outputRasterFile); } //Create new tiff OSGeo.GDAL.Driver outputDriver = Gdal.GetDriverByName("GTiff"); Dataset outputDataset = outputDriver.Create(outputRasterFile, x_res, y_res, 1, DataType.GDT_Float64, null); //Extrac srs from input feature string inputShapeSrs; SpatialReference spatialRefrence = layer.GetSpatialRef(); spatialRefrence.ExportToWkt(out inputShapeSrs); //Assign input feature srs to outpur raster outputDataset.SetProjection(inputShapeSrs); //Geotransform double[] argin = new double[] { envelope.MinX, rasterCellSize, 0, envelope.MaxY, 0, -rasterCellSize }; outputDataset.SetGeoTransform(argin); //Set no data Band band = outputDataset.GetRasterBand(1); band.SetNoDataValue(noDataValue); //close tiff outputDataset.FlushCache(); outputDataset.Dispose(); //Feature to raster rasterize layer options //No of bands (1) int[] bandlist = new int[] { 1 }; //Values to be burn on raster (10.0) double[] burnValues = new double[] { 10.0 }; Dataset myDataset = Gdal.Open(outputRasterFile, Access.GA_Update); //additional options string[] rasterizeOptions; //rasterizeOptions = new string[] { "ALL_TOUCHED=TRUE", "ATTRIBUTE=" + fieldName }; //To set all touched pixels into raster pixel rasterizeOptions = new string[] { "ATTRIBUTE=" + fieldName }; //Rasterize layer //Gdal.RasterizeLayer(myDataset, 1, bandlist, layer, IntPtr.Zero, IntPtr.Zero, 1, burnValues, null, null, null); // To burn the given burn values instead of feature attributes Gdal.RasterizeLayer(myDataset, 1, bandlist, layer, IntPtr.Zero, IntPtr.Zero, 1, burnValues, rasterizeOptions, new Gdal.GDALProgressFuncDelegate(ProgressFunc), "Raster conversion"); } private static int ProgressFunc(double complete, IntPtr message, IntPtr data) { Console.Write("Processing ... " + complete * 100 + "% Completed."); if (message != IntPtr.Zero) { Console.Write(" Message:" + System.Runtime.InteropServices.Marshal.PtrToStringAnsi(message)); } if (data != IntPtr.Zero) { Console.Write(" Data:" + System.Runtime.InteropServices.Marshal.PtrToStringAnsi(data)); } Console.WriteLine(""); return 1; } } }
{ "pile_set_name": "Github" }
/* mbed Microcontroller Library ******************************************************************************* * Copyright (c) 2014, STMicroelectronics * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************* */ #ifndef MBED_DEVICE_H #define MBED_DEVICE_H #define DEVICE_PORTIN 1 #define DEVICE_PORTOUT 1 #define DEVICE_PORTINOUT 1 #define DEVICE_INTERRUPTIN 1 #define DEVICE_ANALOGIN 1 #define DEVICE_ANALOGOUT 1 #define DEVICE_SERIAL 1 #define DEVICE_I2C 1 #define DEVICE_I2CSLAVE 1 #define DEVICE_SPI 1 #define DEVICE_SPISLAVE 1 #define DEVICE_RTC 1 #define DEVICE_PWMOUT 1 #define DEVICE_SLEEP 1 //======================================= #define DEVICE_SEMIHOST 0 #define DEVICE_LOCALFILESYSTEM 0 #define DEVICE_ID_LENGTH 24 #define DEVICE_DEBUG_AWARENESS 0 #define DEVICE_STDIO_MESSAGES 1 #define DEVICE_ERROR_RED 0 #include "objects.h" #endif
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <manifest package="com.firebase.example.internal"> </manifest>
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <ZopeData> <record id="1" aka="AAAAAAAAAAE="> <pickle> <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/> </pickle> <pickle> <dictionary> <item> <key> <string>action</string> </key> <value> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> </value> </item> <item> <key> <string>categories</string> </key> <value> <tuple> <string>action_type/object_onlyxhtml_view</string> </tuple> </value> </item> <item> <key> <string>category</string> </key> <value> <string>object_onlyxhtml_view</string> </value> </item> <item> <key> <string>condition</string> </key> <value> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> </value> </item> <item> <key> <string>description</string> </key> <value> <none/> </value> </item> <item> <key> <string>icon</string> </key> <value> <string></string> </value> </item> <item> <key> <string>id</string> </key> <value> <string>transactions</string> </value> </item> <item> <key> <string>permissions</string> </key> <value> <tuple> <string>View</string> </tuple> </value> </item> <item> <key> <string>priority</string> </key> <value> <float>9.0</float> </value> </item> <item> <key> <string>title</string> </key> <value> <string>Transactions</string> </value> </item> <item> <key> <string>visible</string> </key> <value> <int>1</int> </value> </item> </dictionary> </pickle> </record> <record id="2" aka="AAAAAAAAAAI="> <pickle> <global name="Expression" module="Products.CMFCore.Expression"/> </pickle> <pickle> <dictionary> <item> <key> <string>text</string> </key> <value> <string>string:${object_url}/Entity_viewAccountingTransactionList</string> </value> </item> </dictionary> </pickle> </record> <record id="3" aka="AAAAAAAAAAM="> <pickle> <global name="Expression" module="Products.CMFCore.Expression"/> </pickle> <pickle> <dictionary> <item> <key> <string>text</string> </key> <value> <string>python:portal.Base_checkPermission(\'accounting_module\', \'View\')</string> </value> </item> </dictionary> </pickle> </record> </ZopeData>
{ "pile_set_name": "Github" }
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * 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/. * * This file incorporates work covered by the following license notice: * * 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 . */ #include <TableConnection.hxx> #include <ConnectionLine.hxx> #include <TableConnectionData.hxx> #include <JoinTableView.hxx> using namespace dbaui; using namespace comphelper; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::accessibility; namespace dbaui { OTableConnection::OTableConnection( OJoinTableView* _pContainer,const TTableConnectionData::value_type& _pTabConnData ) :Window(_pContainer) ,m_pData( _pTabConnData ) ,m_pParent( _pContainer ) ,m_bSelected( false ) { Init(); Show(); } OTableConnection::OTableConnection( const OTableConnection& _rConn ) : VclReferenceBase() ,Window(_rConn.m_pParent.get()) ,m_pData(_rConn.GetData()->NewInstance()) ,m_pParent(nullptr) { *this = _rConn; } void OTableConnection::Init() { // initialise linelist with defaults OConnectionLineDataVec& rLineData = GetData()->GetConnLineDataList(); m_vConnLine.reserve(rLineData.size()); for (auto const& elem : rLineData) m_vConnLine.emplace_back( new OConnectionLine(this, elem) ); } void OTableConnection::clearLineData() { m_vConnLine.clear(); } void OTableConnection::UpdateLineList() { // delete linelist clearLineData(); Init(); } OTableConnection& OTableConnection::operator=( const OTableConnection& rConn ) { if( &rConn == this ) return *this; // delete linelist clearLineData(); // copy linelist if(! rConn.GetConnLineList().empty() ) { const std::vector<std::unique_ptr<OConnectionLine>>& rLine = rConn.GetConnLineList(); m_vConnLine.reserve(rLine.size()); for (auto const& elem : rLine) m_vConnLine.emplace_back( new OConnectionLine(*elem)); } // as the data are not mine, I also do not delete the old m_pData->CopyFrom(*rConn.GetData()); // CopyFrom is virtual, therefore it is not a problem if m_pData is a derived type of OTableConnectionData m_bSelected = rConn.m_bSelected; m_pParent = rConn.m_pParent; return *this; } void OTableConnection::RecalcLines() { // call RecalcLines on each line for( const auto& pLine : m_vConnLine ) pLine->RecalcLine(); } OTableWindow* OTableConnection::GetSourceWin() const { TTableWindowData::value_type pRef = GetData()->getReferencingTable(); OTableWindow* pRet = m_pParent->GetTabWindow( pRef->GetWinName() ); if ( !pRet ) { pRet = m_pParent->GetTabWindow( pRef->GetComposedName() ); } return pRet; } OTableWindow* OTableConnection::GetDestWin() const { TTableWindowData::value_type pRef = GetData()->getReferencedTable(); OTableWindow* pRet = m_pParent->GetTabWindow( pRef->GetWinName() ); if ( !pRet ) { pRet = m_pParent->GetTabWindow( pRef->GetComposedName() ); } return pRet; } void OTableConnection::Select() { m_bSelected = true; m_pParent->Invalidate( GetBoundingRect(), InvalidateFlags::NoChildren); } void OTableConnection::Deselect() { m_bSelected = false; InvalidateConnection(); } bool OTableConnection::CheckHit( const Point& rMousePos ) const { // check if the point hit our line return std::any_of(m_vConnLine.begin(), m_vConnLine.end(), [&rMousePos] ( const std::unique_ptr<OConnectionLine> & pLine ) { return pLine->CheckHit( rMousePos ); } ); } void OTableConnection::InvalidateConnection() { tools::Rectangle rcBounding = GetBoundingRect(); rcBounding.AdjustBottom(1 ); rcBounding.AdjustRight(1 ); // I believe Invalidate and Draw(Rectangle) do not behave consistent: in any case it // could explain, why without the fake here when deleting a connection a dash remains at the lower end: // Invalidate records obviously one pixel line less as Draw. // Or everything works differently... in any case it works... m_pParent->Invalidate( rcBounding, InvalidateFlags::NoChildren ); } tools::Rectangle OTableConnection::GetBoundingRect() const { // determine all lines of the surrounding rectangle tools::Rectangle aBoundingRect( Point(0,0), Point(0,0) ); tools::Rectangle aTempRect; for (auto const& elem : m_vConnLine) { aTempRect = elem->GetBoundingRect(); // is the BoundingRect of this line valid? if( (aTempRect.GetWidth()!=1) && (aTempRect.GetHeight()!=1) ) { if( (aBoundingRect.GetWidth()==1) && (aBoundingRect.GetHeight()==1) ) aBoundingRect = aTempRect; else aBoundingRect.Union( aTempRect ); } } return aBoundingRect; } void OTableConnection::Draw(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) { // Draw line for( const auto& pLine : m_vConnLine ) pLine->Draw( &rRenderContext ); } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
{ "pile_set_name": "Github" }
<system> <name>KOI-2222</name> <rightascension>19 40 59</rightascension> <declination>+45 45 26</declination> <distance>1226.90</distance> <star> <magJ errorminus="0.022" errorplus="0.022">12.049</magJ> <magH errorminus="0.020" errorplus="0.020">11.948</magH> <magK errorminus="0.019" errorplus="0.019">11.909</magK> <name>KOI-2222</name> <temperature>7644.00</temperature> <radius>1.5890</radius> <mass>1.7720</mass> <planet> <name>KOI-2222 b</name> <name>KOI-2222 01</name> <radius>0.39459</radius> <period errorminus="3.4000000e-03" errorplus="3.4000000e-03">34.132300000000</period> <transittime errorminus="0.0360000" errorplus="0.0360000">2454990.8130000</transittime> <semimajoraxis>0.2490000</semimajoraxis> <temperature>852.0</temperature> <list>Kepler Objects of Interest</list> <description>This is a Kepler Object of Interest from the Q1-Q12 dataset. It has been flagged as a possible transit event but has not been confirmed to be a planet yet.</description> <istransiting>1</istransiting> </planet> </star> </system>
{ "pile_set_name": "Github" }
#ifndef BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP #define BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP // MS compatible compilers support #pragma once #if defined(_MSC_VER) # pragma once #endif /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // basic_xml_grammar.hpp // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for updates, documentation, and revision history. // this module is derived from simplexml.cpp - an example shipped as part of // the spirit parser. This example contains the following notice: /*============================================================================= simplexml.cpp Spirit V1.3 URL: http://spirit.sourceforge.net/ Copyright (c) 2001, Daniel C. Nuffer This software is provided 'as-is', without any express or implied warranty. In no event will the copyright holder 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, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. =============================================================================*/ #include <string> #include <boost/config.hpp> #include <boost/detail/workaround.hpp> #include <boost/spirit/include/classic_rule.hpp> #include <boost/spirit/include/classic_chset.hpp> #include <boost/archive/basic_archive.hpp> #include <boost/serialization/tracking.hpp> #include <boost/serialization/version.hpp> namespace boost { namespace archive { /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // XML grammar parsing template<class CharType> class basic_xml_grammar { public: // The following is not necessary according to DR45, but at least // one compiler (Compaq C++ 6.5 in strict_ansi mode) chokes otherwise. struct return_values; friend struct return_values; private: typedef BOOST_DEDUCED_TYPENAME std::basic_istream<CharType> IStream; typedef BOOST_DEDUCED_TYPENAME std::basic_string<CharType> StringType; typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::chset<CharType> chset_t; typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::chlit<CharType> chlit_t; typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::scanner< BOOST_DEDUCED_TYPENAME std::basic_string<CharType>::iterator > scanner_t; typedef BOOST_DEDUCED_TYPENAME boost::spirit::classic::rule<scanner_t> rule_t; // Start grammar definition rule_t Reference, Eq, STag, ETag, LetterOrUnderscoreOrColon, AttValue, CharRef1, CharRef2, CharRef, AmpRef, LTRef, GTRef, AposRef, QuoteRef, CharData, CharDataChars, content, AmpName, LTName, GTName, ClassNameChar, ClassName, Name, XMLDecl, XMLDeclChars, DocTypeDecl, DocTypeDeclChars, ClassIDAttribute, ObjectIDAttribute, ClassNameAttribute, TrackingAttribute, VersionAttribute, UnusedAttribute, Attribute, SignatureAttribute, SerializationWrapper, NameHead, NameTail, AttributeList, S; // XML Character classes chset_t BaseChar, Ideographic, Char, Letter, Digit, CombiningChar, Extender, Sch, NameChar; void init_chset(); bool my_parse( IStream & is, const rule_t &rule_, const CharType delimiter = L'>' ) const ; public: struct return_values { StringType object_name; StringType contents; //class_id_type class_id; int_least16_t class_id; //object_id_type object_id; uint_least32_t object_id; //version_type version; unsigned int version; tracking_type tracking_level; StringType class_name; return_values() : version(0), tracking_level(false) {} } rv; bool parse_start_tag(IStream & is) /*const*/; bool parse_end_tag(IStream & is) const; bool parse_string(IStream & is, StringType & s) /*const*/; void init(IStream & is); void windup(IStream & is); basic_xml_grammar(); }; } // namespace archive } // namespace boost #endif // BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP
{ "pile_set_name": "Github" }
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_Form * @subpackage Element * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ /** Zend_Form_Element_Xhtml */ #require_once 'Zend/Form/Element/Xhtml.php'; /** * Checkbox form element * * @category Zend * @package Zend_Form * @subpackage Element * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ class Zend_Form_Element_Checkbox extends Zend_Form_Element_Xhtml { /** * Is the checkbox checked? * @var bool */ public $checked = false; /** * Use formCheckbox view helper by default * @var string */ public $helper = 'formCheckbox'; /** * Options that will be passed to the view helper * @var array */ public $options = array( 'checkedValue' => '1', 'uncheckedValue' => '0', ); /** * Value when checked * @var string */ protected $_checkedValue = '1'; /** * Value when not checked * @var string */ protected $_uncheckedValue = '0'; /** * Current value * @var string 0 or 1 */ protected $_value = '0'; /** * Set options * * Intercept checked and unchecked values and set them early; test stored * value against checked and unchecked values after configuration. * * @param array $options * @return Zend_Form_Element_Checkbox */ public function setOptions(array $options) { if (array_key_exists('checkedValue', $options)) { $this->setCheckedValue($options['checkedValue']); unset($options['checkedValue']); } if (array_key_exists('uncheckedValue', $options)) { $this->setUncheckedValue($options['uncheckedValue']); unset($options['uncheckedValue']); } parent::setOptions($options); $curValue = $this->getValue(); $test = array($this->getCheckedValue(), $this->getUncheckedValue()); if (!in_array($curValue, $test)) { $this->setValue($curValue); } return $this; } /** * Set value * * If value matches checked value, sets to that value, and sets the checked * flag to true. * * Any other value causes the unchecked value to be set as the current * value, and the checked flag to be set as false. * * * @param mixed $value * @return Zend_Form_Element_Checkbox */ public function setValue($value) { if ($value == $this->getCheckedValue()) { parent::setValue($value); $this->checked = true; } else { parent::setValue($this->getUncheckedValue()); $this->checked = false; } return $this; } /** * Set checked value * * @param string $value * @return Zend_Form_Element_Checkbox */ public function setCheckedValue($value) { $this->_checkedValue = (string) $value; $this->options['checkedValue'] = $value; return $this; } /** * Get value when checked * * @return string */ public function getCheckedValue() { return $this->_checkedValue; } /** * Set unchecked value * * @param string $value * @return Zend_Form_Element_Checkbox */ public function setUncheckedValue($value) { $this->_uncheckedValue = (string) $value; $this->options['uncheckedValue'] = $value; return $this; } /** * Get value when not checked * * @return string */ public function getUncheckedValue() { return $this->_uncheckedValue; } /** * Set checked flag * * @param bool $flag * @return Zend_Form_Element_Checkbox */ public function setChecked($flag) { $this->checked = (bool) $flag; if ($this->checked) { $this->setValue($this->getCheckedValue()); } else { $this->setValue($this->getUncheckedValue()); } return $this; } /** * Get checked flag * * @return bool */ public function isChecked() { return $this->checked; } }
{ "pile_set_name": "Github" }
有哪些 100 元以下,很少见但高大上的物件? 作者: 酒衣 赞同: 1611 把下面提到的东西都放在一起做了一个豆列, 100元以下的高大上(豆瓣) 方便大家去找自己想要的东西哦。 我顺便多加了一些类似的东西,大家随意~ 申明: 下面标的价格可能和实际有差距,因为时间久了,店家价格有些浮动, 也有可能以前的店铺不卖了,我找了另外类似的代替。 所以提供的店家只是供大家参考,大家完全可以通过东西的关键字再自行搜索相同或类似的东西哦~~(如果有的地址失效也同样请大家搜关键字) 另外也不知道大家有没有用过豆列,点开你要的东西直接按“去购买”就到了东西链接了哦~~ 祝大家愉快~~~~~ ---------------------------------------------------------------------------------- 1.水果工具套装 19.9 宜家或者淘宝都有,灰常好用,最爱挖球的那个,挖西瓜什么的很爽~中间那个去苹果核神速,最后那个是柠檬刨丝的 2.好看的胶带纸 10元以内 有很多种很好看的胶带纸啊~~配一个好看的胶带座放在桌上美死了~ 3.纸模,3d贺卡 10元以内 自己动手diy一下,超美啊~~ 4.木质拼装小屋 100左右 各种中外建筑都有,可以搜一下,拼完有闲情逸致的还可以自己上个色 5.别致的长尾夹 2元左右 现在有很多种别致的长尾夹,简单干净,拿来夹文件心情都好了~ 6. The 1000 Dot-to-Dot Book 点对点连线 名人肖像绘图本 46 很神奇的一本绘图本,有很多点组成,你要做的就是耐心把点连起来,完成一幅幅名人肖像 7.集线器 29 一款实用美貌的集线器绝对好看又有用~~ 8.茶杯 79 现在好看的杯子很多啊,比如下面图是镂空陶瓷杯,超神奇的~ 9.卡祖笛 65 很小只,没啥技巧,随便吹都能出声,通过人哼唱发生,吉他好伴侣~ (鉴于好多人吐槽声音奇怪,所以大家慎重啊。虽然我觉得即使买来不吹放着就挺高大上了) 10.领夹 80 白衬衫+领夹~美貌值↑ 11.秀丽笔,书法笔 5-15左右 软笔头类似毛笔质感,适合签字之类的,很好写。很多牌子、大小可选,但不太推荐斑马的,性价比太低 12.人体模型 65 geek的感觉就上来了~~也可以弄个脱氧核糖核酸模型什么的,嘿嘿~ 13.留言夹 6.5 复古的留言夹~~放在家里、办公室都心情舒畅 14.铅活字定制 1元/个 简直文艺到一种境界~我也想来一套,比如弄套古诗什么的,字数也不会太多是吧~ 15.印一本自己的书 0.15元/页 我就不放图了,想印成什么样就印成什么样,印自己的文字也好,自己整理的文集也好,还可以印家谱,哈哈~ ----------------------------------------------------------------------------- 更新 16.隐形墨水 99 黑暗中可以看见字的墨水,好神奇!! 17.星球棒棒糖 30左右,单只 一套太贵,买几只吧,不要吃,放着,哈哈~~~ 还有这种~~ 18.复古的八音盒 100左右 超美超复古~~ 19.纸吸管 10元/25支 各种颜色,派对必备~~ 20.太阳能户外灯 59 好美,纯装饰也无所谓~ 21.铁艺门铃 70 类似的造型,还有时钟,都挺欧式复古的,放在家里很漂亮 22.各种衣挂 60左右 有很多别具一格的款,都是又实用又好看的~ ----更新————————————————————————----------------------- 23.奥斯卡小金人 58 只要58,小金人搬回家~~~嘿嘿 24.民国办公桌灯 30 我一直觉得这个灯超好看啊!! 25.别致的水果叉 各种各样有很多选择,价格也有高有低,不过一般不超过100 26.发烧级钢笔墨水 20+ 颜色都很美,用来写字简直是享受啊!!! 27.寿司机 12 究竟是谁发明出的,快懒死了。。。 28.印章 50左右 这个和前面的签字差不多,不过质感绝对不一样啊,买块自己喜欢的石头或者木头刻名字吧!! 29.冰淇淋机、棉花糖机、糖果机 100以下 这算是一个系列吧,买全了家里就是游乐场小卖部啊。。。还有酸奶机什么的,我就不放图了。。 -----6.23.-更新--------------------------------------------------------------------------------------------- 30.书立 47 书立实在是很有用啊~~~~中间夹一些名著神马的真的很高大上, 当然,注意挑一些别致的! (这一款实木的好看不贵啦~基本在10元左右) 31.回形针 6.8/12枚 这款樱花的回形针应该还蛮有名的,很嫩很美~~ 当然各式各样的回形针很多的啦 32.仿古锁 超爱这个~~图案也有很多的。钥匙也很别致,基本都是装饰为主啦。哦,还有带密码的 33.镇纸 98 我觉得黄铜的质感比较好,苗银的也很多,价格会便宜不少 34.花边修正带 10.8 装饰用,好看~~~ 35.伸缩网线 3.5左右 能伸缩简直好用到不行~~性能方面的话,也有20rmb左右的,会好一点 ------更新-------------------------------------------------------------------------- 36.音乐台灯 58 可充电USB节能灯,触摸式开关,还是迷你音箱,外接音源就可以了~~关键还很好看 37.无印良品手动式便携碎纸机 56 其实用来碎快递单什么的话,直接撕一撕还比较快。。。 但主要是这东西价格不贵,逼格也很高的感觉,平时用来裁纸条倒是不错,哈哈哈~ 38.笔式圆筒便携订书机 63 可以放进文具盒里~~~造型别致又方便快捷!! 39.无印良品圆角切割机 55 一直在烦恼剪圆角这种事,这个真的是神器啊~~~照片卡片什么的都可以切割啦~ 40.笔形剪刀 46 致力于将一切文具工具全装进笔盒里!!! 41.LED随心贴橱柜灯 25 里面放电池的,贴在衣橱或者厨房柜子里都是不错的选择, 好像还有很多不同式样的,下面这个比较简洁,大家可以自己去搜一搜其他的~ 42.自制冰沙杯 35 这个就是图新鲜而已,就是一个冰杯自带搅拌棒,随便用用还是挺有意思的 43.餐具 100左右 餐具这种东西其实和前面杯子一样,每天都要用的,别致的东西用起来心情都会变好对吧~ 不过确实略贵,单只价百元左右,我看有人说每个月省钱买一只,哈哈,好像靠谱~ 44.3D立体拼图金属模型 36 这种拼图也很不错~~ 45.香插 50左右 买一些线香,一个好看的香插,点起来,整个人都宁静了~~ ----------番外--------------------------------------------------------------------------------------------------------- 篆刻 既然前面推荐了铅印,木质印章什么的,我觉得应该再和大家分享一下自己刻印章~~ 因为自己刻印章真的感觉超级高大上的诶~~ 而且也算符合主题,买点工具用不到100哒~~~还能买块自己喜欢的石头~~ 以前有个学长的项链就是一块小小的自己刻字的石头~感觉很好的样子,特别羡慕。。 可惜我技术渣啊。。。。 我是刻章菜鸟,所以就给大家简略讲讲,大家可以再找一些详细的教程。 首先准备材料: 1.石头,买两块普通的青田石,就是一般练习的就好,很便宜的 下面是我自己用的,其实也很好看是吧~ 2.刻刀 3.砂皮纸,可以买稍微细一点的,用来磨石头,每次刻完字,可以磨平,下次接着刻 4.印谱,买也成,自己在网上下载打印也行 5.硫酸纸或者连史纸,用来转印。先用它描印谱(用铅笔或者毛笔),然后翻过来(千万别刻正的字,一定要翻过来啊,这样印出来才是正的),对照描在石头上。我有的时候把描过的那一面蒙在石头刻面上压紧,让铅笔石墨印到石头上,这样就可以根据印子来刻字~~~不过印子比较浅。水印法比较复杂,我没用过,大家可以参照别的资料看看。 6.印泥 (以上是必需材料,印床什么的反正我没用过) 知乎上相关问答好像比较少,可以看看这个:如何入门篆刻? 给大家来一个图文教程:篆刻入门详解【图文】 还有一个相册,内容差不多:原习习的相册-简易篆刻教程 刻法什么的,网上有视频可以看看~ 也贴一个图文教程:篆刻基本刀法(图文)_篆刻吧 最后来一个相册欣赏:傅朝阳的相册-朝阳橅古 另外推荐去篆刻贴吧去看看 贴两个我初学时第一次刻的印章,给大家增添自信心~~ 千万不要笑我!!!虽然刻的比较烂,但好歹是字对吧~~~ 大家刚开始一定能刻的比我好~~~ 我就是刻着玩儿的,也就是入门水平,因为觉得有意思和大家聊聊,说的有错误什么的还请指正~~~ 另外我挺喜欢买石头,买几十块的就挺好看, 特别喜欢冻石,摸上去质感也很好,颜色很像玉~~ 我们这儿有一家卖文房四宝的店,里面就卖石头,我一般都在那儿买,可以慢慢挑, 大家可以去这种店看看应该会有篆刻材料,当然在网上买也可以。 ----------------------------------------------------------------------------------------------------------- 作为知乎新人,赞同过1000都要泪流了~~挥挥小手绢~~~ 感谢大家!!!! 贴了豆列在最前面,需要的童鞋请去前面哦~~ 大家可以自己搜索关键字,网上都有很多的~~ 原链接: http://www.zhihu.com/question/23054572/answer/23902562
{ "pile_set_name": "Github" }
// // NUnitTestSuite.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2005 Novell, Inc (http://www.novell.com) // // 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. // using MonoDevelop.UnitTesting.NUnit.External; namespace MonoDevelop.UnitTesting.NUnit { public class NUnitTestSuite: UnitTestGroup { NunitTestInfo testInfo; NUnitAssemblyTestSuite rootSuite; string fullName; UnitTestCollection childNamespaces; public NUnitTestSuite (NUnitAssemblyTestSuite rootSuite, NunitTestInfo tinfo): base (tinfo.Name) { fullName = !string.IsNullOrEmpty (tinfo.PathName) ? tinfo.PathName + "." + tinfo.Name : tinfo.Name; this.testInfo = tinfo; this.rootSuite = rootSuite; this.TestSourceCodeDocumentId = this.TestId = tinfo.TestId; this.childNamespaces = new UnitTestCollection (); } public override bool HasTests { get { return true; } } public UnitTestCollection ChildNamespaces { get { return childNamespaces; } } public string ClassName { get { return fullName; } } protected override UnitTestResult OnRun (TestContext testContext) { return rootSuite.RunUnitTest (this, fullName, fullName, null, testContext); } protected override bool OnCanRun (MonoDevelop.Core.Execution.IExecutionHandler executionContext) { return rootSuite.CanRun (executionContext); } protected override void OnCreateTests () { if (testInfo.Tests == null) return; foreach (NunitTestInfo test in testInfo.Tests) { if (test.Tests != null) { var newTest = new NUnitTestSuite (rootSuite, test); newTest.FixtureTypeName = test.FixtureTypeName; newTest.FixtureTypeNamespace = test.FixtureTypeNamespace; ChildStatus (test, out bool isNamespace, out bool hasClassAsChild); if (isNamespace) { var forceLoad = newTest.Tests; foreach (var child in newTest.ChildNamespaces) { child.Title = newTest.Title + "." + child.Title; childNamespaces.Add (child); } if (hasClassAsChild) { childNamespaces.Add (newTest); } } else { Tests.Add (newTest); } } else { var newTest = new NUnitTestCase (rootSuite, test, ClassName); newTest.FixtureTypeName = test.FixtureTypeName; newTest.FixtureTypeNamespace = test.FixtureTypeNamespace; Tests.Add (newTest); } } } public void ChildStatus (NunitTestInfo test, out bool isNamespace, out bool hasClassAsChild) { isNamespace = false; hasClassAsChild = false; foreach (NunitTestInfo child in test.Tests) { if (child.Tests != null) { isNamespace = true; if (child.Tests [0].Tests == null) hasClassAsChild = true; } } } public override SourceCodeLocation SourceCodeLocation { get { UnitTest p = Parent; while (p != null) { NUnitAssemblyTestSuite root = p as NUnitAssemblyTestSuite; if (root != null) return root.GetSourceCodeLocation (this); p = p.Parent; } return null; } } } }
{ "pile_set_name": "Github" }