{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \r\n\r\n\r\n"}}}],"truncated":false,"partial":false},"paginationData":{"pageIndex":24,"numItemsPerPage":100,"numTotalItems":43696,"offset":2400,"length":100}},"jwt":"eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sImlhdCI6MTc1NzQyMzgxOSwic3ViIjoiL2RhdGFzZXRzL1ppaGFvLUxpL0NvZGUiLCJleHAiOjE3NTc0Mjc0MTksImlzcyI6Imh0dHBzOi8vaHVnZ2luZ2ZhY2UuY28ifQ.PY3pT8uZ3lKh5Fin7XNcjk_AblsXRlZf8-IBxJj0FEW36OBT98LR_PhaoetMROKKA3TPFbJxx0QrffMbn3p4Dg","displayUrls":true},"discussionsStats":{"closed":0,"open":0,"total":0},"fullWidth":true,"hasGatedAccess":true,"hasFullAccess":true,"isEmbedded":false,"savedQueries":{"community":[],"user":[]}}">
text
stringlengths
27
775k
#![allow(dead_code)] extern crate alloc; use super::ALIGNMENT; use nuklear_sys::{nk_handle, nk_size}; use std::alloc::{Alloc, Global, Layout}; use std::mem; use std::os::raw::c_void; use std::ptr::NonNull; pub unsafe extern "C" fn alloc(_: nk_handle, _: *mut c_void, size: nk_size) -> *mut c_void { trace!("allocating {} bytes", size); let size_size = mem::size_of::<nk_size>(); let size = size + size_size as nk_size; let memory = Global.alloc(Layout::from_size_align(size as usize, ALIGNMENT).unwrap()).unwrap(); trace!("allocating {} / {} bytes", size_size, size); *(memory.as_ptr() as *mut nk_size) = size; trace!("allocated {} bytes at {:p}", size, memory); memory.as_ptr().offset(size_size as isize) as *mut c_void } pub unsafe extern "C" fn free(_: nk_handle, old: *mut c_void) { if old.is_null() { return; } let size_size = mem::size_of::<nk_size>(); let old = old as *mut u8; let old = old.offset(-(size_size as isize)); let old_size = *(old as *const nk_size); trace!("deallocating {} bytes from {:p}", old_size, old); Global.dealloc(NonNull::new(old).unwrap(), Layout::from_size_align(old_size as usize, ALIGNMENT).unwrap()); }
# Use Electron React # epp <img src='assets/epp.png' width=256 /> Electron aPPlication - photon - coffeescrirpt (cjsx) - electron - react - react-router - webpack ![screenshot] ## Dev ```sh # install dependencies $ npm install # support for reloading views, restarting electron # if app/* and/or index.js, electron/* are changed $ npm start ``` ### Build ```sh $ npm run build # all $ npm run build-osx # osx(64) $ npm run build-win # win(32, 64) ```
declare global { export { t } from '../helpers/translate'; export const global: typeof globalThis; } export {};
package com.ciarandg.soundbounds.common.ui.cli.argument import com.ciarandg.soundbounds.common.PlaylistType import com.mojang.brigadier.StringReader import com.mojang.brigadier.arguments.ArgumentType import com.mojang.brigadier.context.CommandContext import com.mojang.brigadier.suggestion.Suggestions import com.mojang.brigadier.suggestion.SuggestionsBuilder import net.minecraft.command.CommandSource import net.minecraft.command.argument.ArgumentTypes import net.minecraft.command.argument.serialize.ConstantArgumentSerializer import net.minecraft.server.command.ServerCommandSource import java.security.InvalidParameterException import java.util.concurrent.CompletableFuture class PTArgumentType : ArgumentType<PlaylistType> { override fun parse(reader: StringReader?): PlaylistType { val arg: String = reader?.readString() ?: "" for (p in PlaylistType.values()) { if (arg == p.name) return p } throw InvalidParameterException("\"$arg\" is not a Playlist type") } override fun <S : Any?> listSuggestions( context: CommandContext<S>?, builder: SuggestionsBuilder? ): CompletableFuture<Suggestions> { return CommandSource.suggestMatching(examples, builder) } override fun getExamples(): MutableCollection<String> = enumValues<PlaylistType>().map { pl -> pl.name }.toMutableList() companion object { fun register() = ArgumentTypes.register( "playlist_type", PTArgumentType().javaClass, ConstantArgumentSerializer(Companion::type) ) fun type(): PTArgumentType = PTArgumentType() fun getPlaylistType(ctx: CommandContext<ServerCommandSource>, name: String): PlaylistType = ctx.getArgument(name, PlaylistType.SEQUENTIAL.javaClass) } }
module Enecuum.Framework.Handler.Network.Interpreter where import Enecuum.Prelude import Control.Monad.Free() import qualified Data.Map as M import Enecuum.Framework.Handler.Network.Language interpretNetworkHandlerL :: TVar (M.Map Text (NetworkHandler p m)) -> NetworkHandlerF p m a -> IO a interpretNetworkHandlerL m (NetworkHandler name method' next) = do atomically $ modifyTVar m (M.insert name method') pure (next ()) runNetworkHandlerL :: TVar (Map Text (NetworkHandler p m)) -> NetworkHandlerL p m a -> IO a runNetworkHandlerL m = foldFree (interpretNetworkHandlerL m)
export const TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; export const SERUM_PROGRAM_ID_V2 = "EUqojwWA2rd19FZrzeBncJsm38Jm1hEhE3zsmX3bRc2o"; export const SERUM_PROGRAM_ID_V3 = "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"; export const LIQUIDITY_POOL_PROGRAM_ID_V2 = "RVKd61ztZW9GUwhRbbLoYVRE5Xf1B2tVscKqwZqXgEr"; export const LIQUIDITY_POOL_PROGRAM_ID_V3 = "27haf8L6oxUeXrHrgEgsexjSY5hbVUWEmvv9Nyxg8vQv"; export const LIQUIDITY_POOL_PROGRAM_ID_V4 = "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"; export const STAKE_PROGRAM_ID = "EhhTKczWMGQt46ynNeRX1WfeagwwJd7ufHvCDjRxjo5Q"; export const STAKE_PROGRAM_ID_V4 = "CBuCnLe26faBpcBP2fktp4rp8abpcAnTWft6ZrP5Q4T"; export const STAKE_PROGRAM_ID_V5 = "9KEPoZmtHUrBbhWN1v1KWLMkkvwY6WLtAVUCPRtRjP4z";
#!/bin/bash /usr/local/bin/pypi-mirror -d /var/lib/pipmirror/packages download nagiosplugin /usr/local/bin/pypi-mirror -d /var/lib/pipmirror/packages create -m /var/lib/pipmirror/webroot
## A quick guide for how to merge develop에 feature/localstorage 브랜치를 병합<br/> (Merge branch 'feature/localstorage' into develop) ```bash # 1. Desktop/career-test (feature/localstorage) > git checkout develop Desktop/career-test (develop) > git merge feature/localstorage ## conflicts 해결 후 # 스테이징 상태로 변경 Desktop/career-test (develop|merge) > git add . # commit 작성 Desktop/career-test (develop|merge) > git commit -m "Merge branch 'feature/localstorage' into develop" Desktop/career-test (develop|merge) > git log Desktop/career-test (develop) > git push origin develop ``` ```bash # 2. Desktop/career-test (develop) > git checkout feature/localstorage Switched to branch 'feature/localstorage' Your branch is up to date with 'origin/feature/localstorage'. Desktop/career-test (feature/localstorage) > git push origin feature/localstorage Desktop/career-test (feature/localstorage) > git checkout develop Switched to branch 'develop' Desktop/career-test (develop) > git merge feature/localstorage Merge made by the 'recursive' strategy. README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) ## conflicts X # no changes Desktop/career-test (develop) > git status On branch develop nothing to commit, working tree clean # no changes Desktop/career-test (develop) > git add . # no changes Desktop/career-test (develop) > git commit -m "Merge branch 'feature/localstorage' into develop" On branch develop nothing to commit, working tree clean # Push Desktop/career-test (develop) > git push origin develop Enumerating objects: 4, done. ```
#!/bin/bash # SPDX-License-Identifier: GPL-2.0-only NSIM_ID=$((RANDOM % 1024)) NSIM_DEV_SYS=/sys/bus/netdevsim/devices/netdevsim$NSIM_ID NSIM_DEV_DFS=/sys/kernel/debug/netdevsim/netdevsim$NSIM_ID/ports/0 NSIM_NETDEV= num_passes=0 num_errors=0 function cleanup_nsim { if [ -e $NSIM_DEV_SYS ]; then echo $NSIM_ID > /sys/bus/netdevsim/del_device fi } function cleanup { cleanup_nsim } trap cleanup EXIT function get_netdev_name { local -n old=$1 new=$(ls /sys/class/net) for netdev in $new; do for check in $old; do [ $netdev == $check ] && break done if [ $netdev != $check ]; then echo $netdev break fi done } function check { local code=$1 local str=$2 local exp_str=$3 if [ $code -ne 0 ]; then ((num_errors++)) return fi if [ "$str" != "$exp_str" ]; then echo -e "Expected: '$exp_str', got '$str'" ((num_errors++)) return fi ((num_passes++)) } # Bail if ethtool is too old if ! ethtool -h | grep include-stat 2>&1 >/dev/null; then echo "SKIP: No --include-statistics support in ethtool" exit 4 fi # Make a netdevsim old_netdevs=$(ls /sys/class/net) modprobe netdevsim echo $NSIM_ID > /sys/bus/netdevsim/new_device NSIM_NETDEV=`get_netdev_name old_netdevs` set -o pipefail echo n > $NSIM_DEV_DFS/ethtool/pause/report_stats_tx echo n > $NSIM_DEV_DFS/ethtool/pause/report_stats_rx s=$(ethtool --json -a $NSIM_NETDEV | jq '.[].statistics') check $? "$s" "null" s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics') check $? "$s" "{}" echo y > $NSIM_DEV_DFS/ethtool/pause/report_stats_tx s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics | length') check $? "$s" "1" s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics.tx_pause_frames') check $? "$s" "2" echo y > $NSIM_DEV_DFS/ethtool/pause/report_stats_rx s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics | length') check $? "$s" "2" s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics.rx_pause_frames') check $? "$s" "1" s=$(ethtool -I --json -a $NSIM_NETDEV | jq '.[].statistics.tx_pause_frames') check $? "$s" "2" if [ $num_errors -eq 0 ]; then echo "PASSED all $((num_passes)) checks" exit 0 else echo "FAILED $num_errors/$((num_errors+num_passes)) checks" exit 1 fi
// Copyright (c) 2021 Yandex LLC. All rights reserved. // Author: Martynov Pavel <[email protected]> package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) type RegistryStatus string const ( Creating RegistryStatus = "CREATING" Active RegistryStatus = "ACTIVE" Deleting RegistryStatus = "DELETING" ) // YandexContainerRegistrySpec defines the desired state of YandexContainerRegistry type YandexContainerRegistrySpec struct { // Name: name of registry // +kubebuilder:validation:Required // +kubebuilder:validation:MinLength=3 // +kubebuilder:validation:MaxLength=63 Name string `json:"name"` // FolderID: id of a folder in which registry is located. Must be immutable. // +kubebuilder:validation:Required // +kubebuilder:validation: FolderID string `json:"folderId"` } // YandexContainerRegistryStatus defines the observed state of YandexContainerRegistry type YandexContainerRegistryStatus struct { // ID: id of registry ID string `json:"id,omitempty"` // Status: status of registry. // Valid values are: // - CREATING // - ACTIVE // - DELETING Status RegistryStatus `json:"status,omitempty"` // CreatedAt: RFC3339-formatted string, representing creation time of resource CreatedAt string `json:"createdAt,omitempty"` // Labels: registry labels in key:value form. Maximum of 64 labels for resource is allowed Labels map[string]string `json:"labels,omitempty"` } // YandexContainerRegistry is the Schema for the yandexcontainerregistries API // +kubebuilder:object:root=true // +kubebuilder:resource:shortName=yc-registry type YandexContainerRegistry struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec YandexContainerRegistrySpec `json:"spec,omitempty"` Status YandexContainerRegistryStatus `json:"status,omitempty"` } // YandexContainerRegistryList contains a list of YandexContainerRegistry // +kubebuilder:object:root=true type YandexContainerRegistryList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []YandexContainerRegistry `json:"items"` } func init() { SchemeBuilder.Register(&YandexContainerRegistry{}, &YandexContainerRegistryList{}) }
package io.shiftleft.semanticcpg.language.types.structure import io.shiftleft.codepropertygraph.generated.nodes.{Method, MethodParameterIn} import io.shiftleft.semanticcpg.language._ import io.shiftleft.semanticcpg.testing.MockCpg import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec class MethodParameterTests extends AnyWordSpec with Matchers { val cpg = MockCpg() .withMethod("foo") .cpg "generic cpg" should { "find parameters" when { "asking for all parameters" in { val args: List[MethodParameterIn] = cpg.method.name("foo").parameter.toList args.size shouldBe 1 args.sortBy(_.order).map(_.typ.head.name) shouldBe List("paramtype") } "filtering by name" in { val queryResult: List[MethodParameterIn] = cpg.method.parameter.name(".*").toList queryResult.size shouldBe 1 } "finding parameter by index" when { "specifying number" in { val args: List[MethodParameterIn] = cpg.method.name("foo").parameter.index(num = 1).toList args.size shouldBe 1 args.head.typ.head.name shouldBe "paramtype" } "specifying index >= x" in { val args: List[MethodParameterIn] = cpg.method.name("foo").parameter.indexFrom(1).toList args.map(_.typ.head.name).toSet shouldBe Set("paramtype") } "specifying index <= x" in { val args: List[MethodParameterIn] = cpg.method.name("foo").parameter.indexTo(2).toList args.map(_.typ.head.name).toSet shouldBe Set("paramtype") } } } "find method that a MethodParameter belongs to" in { val methods: List[Method] = cpg.method.name("foo").parameter.index(num = 1).method.toList methods.size shouldBe 1 methods.head.name shouldBe "foo" } } }
// (C) 2020 Dmitri Fedorov; License: GNU GPL v3+; no warranty. using System; using static System.Math; using static System.Double; public static partial class quad{ public static double o4av (Func<double,double> f, double a, double b, double acc=1e-3, double eps=1e-3){ if(IsNegativeInfinity(a)) return o4av(t=>f(a-(1-t)/t)/t/t,0,1,acc,eps); if(IsPositiveInfinity(b)) return o4av(t=>f(a+(1-t)/t)/t/t,0,1,acc,eps); return o4a(t=>f(a+(b-a)*(3*t*t-2*t*t*t))*(b-a)*6*(t-t*t),0,1,acc,eps); }//o4av public static double o4a (Func<double,double> f,double a,double b,double acc=1e-3,double eps=1e-3, double f2=NaN,double f3=NaN,int nrec=0,int limit=99){ /// four point open adaptive integrator double h=b-a, sqr2=Sqrt(2), f1=f(a+h/6), f4=f(a+5*h/6); if(IsNaN(f2)){ f2=f(a+2*h/6); f3=f(a+4*h/6); nrec=0; } double approx1=(3*f1+4*f2 +5*f4)*h/12; double approx2=(5*f1 +4*f3+3*f4)*h/12; double integral=(approx1+approx2)/2; double error=Abs(approx1-approx2)/2; double tolerance=acc+eps*Abs(integral); if(error<sqr2*tolerance) return integral; else if(++nrec>limit){ Console.Error.Write("o4a: nrec>limit\n"); return integral; } else return o4a(f,a,(a+b)/2,acc/sqr2,eps,f1,f2,nrec,limit)+ o4a(f,(a+b)/2,b,acc/sqr2,eps,f3,f4,nrec,limit); }//o4a public static double o4acc (Func<double,double> f, double a, double b, double acc=1e-3, double eps=1e-3){ if(IsNegativeInfinity(a)) return o4acc(t=>f(a-(1-t)/t)/t/t,0,1,acc,eps); if(IsPositiveInfinity(b)) return o4acc(t=>f(a+(1-t)/t)/t/t,0,1,acc,eps); return o4a(t=>f((a+b)/2+(b-a)/2*Cos(t))*Sin(t)*(b-a)/2,0,PI,acc,eps); }//o4acc }//quad
#pragma once #ifndef DEUSEX_AUXHEADERS_H #define DEUSEX_AUXHEADERS_H #include <iostream> #include <string> #include <vector> #endif
package dotty.tools.dotc.util object PerfectHashing: /** The number of elements up to which dense packing is used. * If the number of elements reaches `DenseLimit` a hash table is used instead */ inline val DenseLimit = 16 /** A map that maps keys to unique integers in a dense interval starting at 0. * @param initialCapacity Indicates the initial number of slots in the hash table. * The actual number of slots is always a power of 2, so the * initial size of the table will be the smallest power of two * that is equal or greater than the given `initialCapacity`. * Minimum value is 4. * @param capacityMultiple The minimum multiple of capacity relative to used elements. * The hash table will be re-sized once the number of elements * multiplied by capacityMultiple exceeds the current size of the hash table. * However, a table of size up to DenseLimit will be re-sized only * once the number of elements reaches the table's size. */ class PerfectHashing[Key](initialCapacity: Int = 8, capacityMultiple: Int = 2): import PerfectHashing.DenseLimit private var used: Int = _ private var table: Array[Int] = _ private var keys: Array[AnyRef] = _ clear() protected def allocate(capacity: Int) = keys = new Array[AnyRef](capacity) if !isDense then table = new Array[Int](capacity * roundToPower(capacityMultiple)) private def roundToPower(n: Int) = if Integer.bitCount(n) == 1 then n else 1 << (32 - Integer.numberOfLeadingZeros(n)) /** Remove keys from this map and set back to initial configuration */ def clear(): Unit = used = 0 allocate(roundToPower(initialCapacity max 4)) /** The number of keys */ final def size: Int = used /** The number of keys that can be stored without growing the tables */ final def capacity: Int = keys.length private final def isDense = capacity <= DenseLimit /** Hashcode, by default a post-processed versoon of `k.hashCode`, * can be overridden */ protected def hash(k: Key): Int = val h = k.hashCode // Part of the MurmurHash3 32 bit finalizer val i = (h ^ (h >>> 16)) * 0x85EBCA6B val j = (i ^ (i >>> 13)) & 0x7FFFFFFF if (j==0) 0x41081989 else j /** Equality test, by default `equals`, can be overridden */ protected def isEqual(x: Key, y: Key): Boolean = x.equals(y) private def matches(entry: Int, k: Key) = isEqual(key(entry), k) private def tableIndex(x: Int): Int = x & (table.length - 1) private def firstIndex(k: Key) = tableIndex(hash(k)) private def nextIndex(idx: Int) = tableIndex(idx + 1) /** The key at index `idx` */ def key(idx: Int) = keys(idx).asInstanceOf[Key] private def setKey(e: Int, k: Key) = keys(e) = k.asInstanceOf[AnyRef] private def entry(idx: Int): Int = table(idx) - 1 private def setEntry(idx: Int, entry: Int) = table(idx) = entry + 1 /** An index `idx` such that `key(idx) == k`, or -1 if no such index exists */ def index(k: Key): Int = if isDense then var e = 0 while e < used do if matches(e, k) then return e e += 1 -1 else var idx = firstIndex(k) var e = entry(idx) while e >= 0 && !matches(e, k) do idx = nextIndex(idx) e = entry(idx) e /** An index `idx` such that key(idx) == k. * If no such index exists, create an entry with an index one * larger than the previous one. */ def add(k: Key): Int = if isDense then var e = 0 while e < used do if matches(e, k) then return e e += 1 else var idx = firstIndex(k) var e = entry(idx) while e >= 0 do if matches(e, k) then return e idx = nextIndex(idx) e = entry(idx) setEntry(idx, used) end if setKey(used, k) used = used + 1 if used == capacity then growTable() used - 1 private def rehash(): Unit = var e = 0 while e < used do var idx = firstIndex(key(e)) while entry(idx) >= 0 do idx = nextIndex(idx) setEntry(idx, e) e += 1 /** Grow backing arrays */ protected def growTable(): Unit = val oldKeys = keys allocate(capacity * 2) Array.copy(oldKeys, 0, keys, 0, oldKeys.length) if !isDense then rehash() def keysIterator: Iterator[Key] = keys.iterator.take(used).asInstanceOf[Iterator[Key]] end PerfectHashing
<?php namespace OpenCFP\Test\Http\Controller; use Symfony\Component\HttpFoundation\Session\Session; class SessionDouble extends Session { protected $flash; public function get($value, $default = null) { return $this->$value; } public function set($name, $value) { $this->$name = $value; } }
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import com.godaddy.android.colorpicker.ClassicColorPicker import com.godaddy.android.colorpicker.HsvColor @Composable fun ClassicColorPickerScreen() { Column { val currentColor = remember { mutableStateOf(Color.Black) } ColorPreviewInfo(currentColor = currentColor.value) ClassicColorPicker( color = currentColor.value, modifier = Modifier .height(300.dp) .padding(16.dp), onColorChanged = { hsvColor: HsvColor -> // Triggered when the color changes, do something with the newly picked color here! currentColor.value = hsvColor.toColor() } ) } }
import 'package:app/bloc/currentstate_bloc.dart'; import 'package:app/models/article_model.dart'; import 'package:app/models/category_model.dart'; import 'package:app/models/preferences_model.dart'; import 'package:app/resources/repository.dart'; import 'package:flutter/material.dart'; import 'package:rxdart/rxdart.dart'; class ArticlesBloc { final _articlesFetcher = PublishSubject<List<ArticleModel>>(); final _savedsFetcher = PublishSubject<List<ArticleModel>>(); final _byCategoryFetcher = PublishSubject<List<ArticleModel>>(); Stream<List<ArticleModel>> get currentRange => _articlesFetcher.stream; Stream<List<ArticleModel>> get savedPosts => _savedsFetcher.stream; Stream<List<ArticleModel>> get byCategory => _byCategoryFetcher.stream; Future<List<ArticleModel>> getArticles(int page, int perPage, {bool full}) async { List<ArticleModel> articles = await Repository.getArticles(page, perPage, full: full); _articlesFetcher.sink.add(articles); debugPrint("Aggiunto al sink degli articoli."); if (full) currentStateBloc.updateFullness(full); return articles; } Future<List<ArticleModel>> getSaveds(PreferencesModel preferences) async { List<ArticleModel> saveds = await Repository.getSaveds(preferences); _savedsFetcher.sink.add(saveds); debugPrint("Aggiunto al sink dei salvati."); return saveds; } Future<List<ArticleModel>> getArticlesByCategory(CategoryModel category) async { List<ArticleModel> articlesByCategory = await Repository.getArticlesByCategory(category); _byCategoryFetcher.sink.add(articlesByCategory); debugPrint("Aggiunto al sink per la categoria \"${category.name}\"."); return articlesByCategory; } dispose() { _articlesFetcher.close(); _savedsFetcher.close(); _byCategoryFetcher.close(); } } final ArticlesBloc articlesBloc = ArticlesBloc();
/* This file is part of qprofile * * Copyright (C) 2018 Calvin <[email protected]> */ #ifndef QSOFTWAREMODEL_H #define QSOFTWAREMODEL_H #include "qprofile_debug.h" #include "qprofile_global.h" #include "qregistermodel.h" #include "qrservermodel.h" #include "qabstractmodel.h" #include "qnumericattribute.h" #include "qupgradeinfo.h" QT_BEGIN_NAMESPACE QT_END_NAMESPACE namespace QRserver { class QSoftwareModel: public QProfile::QAbstractModel { Q_OBJECT Q_PROPERTY(quint16 serverPort READ serverPort WRITE setServerPort) Q_PROPERTY(QVariantList deviceList READ deviceList) Q_PROPERTY(QVariantList upgradeInfoList READ upgradeInfoList WRITE setUpgradeInfoList) public: static const QString CommandUpgrade; static const quint32 PackageTimeout; static const quint32 PropertyChangedTimeout; static const quint32 MaxPacSizeForOldUpgradingMethod; public: QSoftwareModel(QObject *parent = nullptr); ~QSoftwareModel(); quint16 serverPort() const; void setServerPort(quint16 port); const QRserverModel &rserverModel() const { return *m_rserverModel; } const QRegisterModel &registerModel() const { return *m_registerModel; } const QVariantList deviceList() const; // void setDeviceList(const QVariantList deviceList); const QVariantList upgradeInfoList() const; void setUpgradeInfoList(const QVariantList upgradeInfoList); void setUpgradeInfoMd5(const QString serialNumber, const QByteArray &md5); const QByteArray getUpgradeInfoMd5(const QString serialNumber); void setUpgradeInfoStatus(const QString serialNumber, const quint32 status); const quint32 getUpgradeInfoImageSize(const QString serialNumber); void setUpgradeInfoImageSize(const QString serialNumber, const quint32 size); const quint32 getUpgradeInfoDownloadedSize(const QString serialNumber); void setUpgradeInfoDownloadedSize(const QString serialNumber, const quint32 size); const QString getUpgradeInfoDeltaImageName(const QString serialNumber); const QString getUpgradeInfoDownloadedPercentage(const QString serialNumber); void setUpgradeInfoDownloadedPercentage(const QString serialNumber, const QString downloadedPercentage); public slots: virtual void initAttributes(); private: const QRserverModel *m_rserverModel; const QRegisterModel *m_registerModel; QSharedPointer<QProfile::QNumericAttribute> m_serverPort; QVariantList m_deviceList; QList<QUpgradeInfo *> m_upgradeInfoList; QMutex *m_mutex; }; } Q_DECLARE_METATYPE(QRserver::QSoftwareModel) #endif
import { Component, OnInit } from '@angular/core'; import { _HttpClient } from '@delon/theme'; import {SetingsService} from "../shared/setings.service"; import {NzModalService} from "ng-zorro-antd"; @Component({ selector: 'app-meituanHXYD', templateUrl: './meituanHXYD.component.html', styleUrls: ['./meituanHXYD.component.less'] }) export class MeituanHXYDComponent implements OnInit { constructor( private setingsService: SetingsService, private modalSrv: NzModalService, ) { } ngOnInit() { } }
#ifndef _RADEON_H #define _RADEON_H #define RADEON_REGSIZE 0x4000 #define MM_INDEX 0x0000 #define MM_DATA 0x0004 #define BUS_CNTL 0x0030 #define HI_STAT 0x004C #define BUS_CNTL1 0x0034 #define I2C_CNTL_1 0x0094 #define CONFIG_CNTL 0x00E0 #define CONFIG_MEMSIZE 0x00F8 #define CONFIG_APER_0_BASE 0x0100 #define CONFIG_APER_1_BASE 0x0104 #define CONFIG_APER_SIZE 0x0108 #define CONFIG_REG_1_BASE 0x010C #define CONFIG_REG_APER_SIZE 0x0110 #define PAD_AGPINPUT_DELAY 0x0164 #define PAD_CTLR_STRENGTH 0x0168 #define PAD_CTLR_UPDATE 0x016C #define PAD_CTLR_MISC 0x0aa0 #define AGP_CNTL 0x0174 #define BM_STATUS 0x0160 #define CAP0_TRIG_CNTL 0x0950 #define CAP1_TRIG_CNTL 0x09c0 #define VIPH_CONTROL 0x0C40 #define VENDOR_ID 0x0F00 #define DEVICE_ID 0x0F02 #define COMMAND 0x0F04 #define STATUS 0x0F06 #define REVISION_ID 0x0F08 #define REGPROG_INF 0x0F09 #define SUB_CLASS 0x0F0A #define BASE_CODE 0x0F0B #define CACHE_LINE 0x0F0C #define LATENCY 0x0F0D #define HEADER 0x0F0E #define BIST 0x0F0F #define REG_MEM_BASE 0x0F10 #define REG_IO_BASE 0x0F14 #define REG_REG_BASE 0x0F18 #define ADAPTER_ID 0x0F2C #define BIOS_ROM 0x0F30 #define CAPABILITIES_PTR 0x0F34 #define INTERRUPT_LINE 0x0F3C #define INTERRUPT_PIN 0x0F3D #define MIN_GRANT 0x0F3E #define MAX_LATENCY 0x0F3F #define ADAPTER_ID_W 0x0F4C #define PMI_CAP_ID 0x0F50 #define PMI_NXT_CAP_PTR 0x0F51 #define PMI_PMC_REG 0x0F52 #define PM_STATUS 0x0F54 #define PMI_DATA 0x0F57 #define AGP_CAP_ID 0x0F58 #define AGP_STATUS 0x0F5C #define AGP_COMMAND 0x0F60 #define AIC_CTRL 0x01D0 #define AIC_STAT 0x01D4 #define AIC_PT_BASE 0x01D8 #define AIC_LO_ADDR 0x01DC #define AIC_HI_ADDR 0x01E0 #define AIC_TLB_ADDR 0x01E4 #define AIC_TLB_DATA 0x01E8 #define DAC_CNTL 0x0058 #define DAC_CNTL2 0x007c #define CRTC_GEN_CNTL 0x0050 #define MEM_CNTL 0x0140 #define MC_CNTL 0x0140 #define EXT_MEM_CNTL 0x0144 #define MC_TIMING_CNTL 0x0144 #define MC_AGP_LOCATION 0x014C #define MEM_IO_CNTL_A0 0x0178 #define MEM_REFRESH_CNTL 0x0178 #define MEM_INIT_LATENCY_TIMER 0x0154 #define MC_INIT_GFX_LAT_TIMER 0x0154 #define MEM_SDRAM_MODE_REG 0x0158 #define AGP_BASE 0x0170 #define MEM_IO_CNTL_A1 0x017C #define MC_READ_CNTL_AB 0x017C #define MEM_IO_CNTL_B0 0x0180 #define MC_INIT_MISC_LAT_TIMER 0x0180 #define MEM_IO_CNTL_B1 0x0184 #define MC_IOPAD_CNTL 0x0184 #define MC_DEBUG 0x0188 #define MC_STATUS 0x0150 #define MEM_IO_OE_CNTL 0x018C #define MC_CHIP_IO_OE_CNTL_AB 0x018C #define MC_FB_LOCATION 0x0148 /* #define MC_FB_LOCATION 0x0188 */ #define HOST_PATH_CNTL 0x0130 #define MEM_VGA_WP_SEL 0x0038 #define MEM_VGA_RP_SEL 0x003C #define HDP_DEBUG 0x0138 #define SW_SEMAPHORE 0x013C #define CRTC2_GEN_CNTL 0x03f8 #define CRTC2_DISPLAY_BASE_ADDR 0x033c #define SURFACE_CNTL 0x0B00 #define SURFACE0_LOWER_BOUND 0x0B04 #define SURFACE1_LOWER_BOUND 0x0B14 #define SURFACE2_LOWER_BOUND 0x0B24 #define SURFACE3_LOWER_BOUND 0x0B34 #define SURFACE4_LOWER_BOUND 0x0B44 #define SURFACE5_LOWER_BOUND 0x0B54 #define SURFACE6_LOWER_BOUND 0x0B64 #define SURFACE7_LOWER_BOUND 0x0B74 #define SURFACE0_UPPER_BOUND 0x0B08 #define SURFACE1_UPPER_BOUND 0x0B18 #define SURFACE2_UPPER_BOUND 0x0B28 #define SURFACE3_UPPER_BOUND 0x0B38 #define SURFACE4_UPPER_BOUND 0x0B48 #define SURFACE5_UPPER_BOUND 0x0B58 #define SURFACE6_UPPER_BOUND 0x0B68 #define SURFACE7_UPPER_BOUND 0x0B78 #define SURFACE0_INFO 0x0B0C #define SURFACE1_INFO 0x0B1C #define SURFACE2_INFO 0x0B2C #define SURFACE3_INFO 0x0B3C #define SURFACE4_INFO 0x0B4C #define SURFACE5_INFO 0x0B5C #define SURFACE6_INFO 0x0B6C #define SURFACE7_INFO 0x0B7C #define SURFACE_ACCESS_FLAGS 0x0BF8 #define SURFACE_ACCESS_CLR 0x0BFC #define GEN_INT_CNTL 0x0040 #define GEN_INT_STATUS 0x0044 #define CRTC_EXT_CNTL 0x0054 #define RB3D_CNTL 0x1C3C #define WAIT_UNTIL 0x1720 #define ISYNC_CNTL 0x1724 #define RBBM_GUICNTL 0x172C #define RBBM_STATUS 0x0E40 #define RBBM_STATUS_alt_1 0x1740 #define RBBM_CNTL 0x00EC #define RBBM_CNTL_alt_1 0x0E44 #define RBBM_SOFT_RESET 0x00F0 #define RBBM_SOFT_RESET_alt_1 0x0E48 #define NQWAIT_UNTIL 0x0E50 #define RBBM_DEBUG 0x0E6C #define RBBM_CMDFIFO_ADDR 0x0E70 #define RBBM_CMDFIFO_DATAL 0x0E74 #define RBBM_CMDFIFO_DATAH 0x0E78 #define RBBM_CMDFIFO_STAT 0x0E7C #define CRTC_STATUS 0x005C #define GPIO_VGA_DDC 0x0060 #define GPIO_DVI_DDC 0x0064 #define GPIO_MONID 0x0068 #define GPIO_CRT2_DDC 0x006c #define PALETTE_INDEX 0x00B0 #define PALETTE_DATA 0x00B4 #define PALETTE_30_DATA 0x00B8 #define CRTC_H_TOTAL_DISP 0x0200 #define CRTC_H_SYNC_STRT_WID 0x0204 #define CRTC_H_SYNC_POL (1 << 23) #define CRTC_V_TOTAL_DISP 0x0208 #define CRTC_V_SYNC_STRT_WID 0x020C #define CRTC_V_SYNC_POL (1 << 23) #define CRTC_VLINE_CRNT_VLINE 0x0210 #define CRTC_CRNT_FRAME 0x0214 #define CRTC_GUI_TRIG_VLINE 0x0218 #define CRTC_DEBUG 0x021C #define CRTC_OFFSET_RIGHT 0x0220 #define CRTC_OFFSET 0x0224 #define CRTC_OFFSET_CNTL 0x0228 #define CRTC_PITCH 0x022C #define OVR_CLR 0x0230 #define OVR_WID_LEFT_RIGHT 0x0234 #define OVR_WID_TOP_BOTTOM 0x0238 #define DISPLAY_BASE_ADDR 0x023C #define SNAPSHOT_VH_COUNTS 0x0240 #define SNAPSHOT_F_COUNT 0x0244 #define N_VIF_COUNT 0x0248 #define SNAPSHOT_VIF_COUNT 0x024C #define FP_CRTC_H_TOTAL_DISP 0x0250 #define FP_CRTC_V_TOTAL_DISP 0x0254 #define CRT_CRTC_H_SYNC_STRT_WID 0x0258 #define CRT_CRTC_V_SYNC_STRT_WID 0x025C #define CUR_OFFSET 0x0260 #define CUR_HORZ_VERT_POSN 0x0264 #define CUR_HORZ_VERT_OFF 0x0268 #define CUR_CLR0 0x026C #define CUR_CLR1 0x0270 #define FP_HORZ_VERT_ACTIVE 0x0278 #define CRTC_MORE_CNTL 0x027C #define CRTC_H_CUTOFF_ACTIVE_EN (1<<4) #define CRTC_V_CUTOFF_ACTIVE_EN (1<<5) #define DAC_EXT_CNTL 0x0280 #define FP_GEN_CNTL 0x0284 #define FP_HORZ_STRETCH 0x028C #define FP_VERT_STRETCH 0x0290 #define FP_H_SYNC_STRT_WID 0x02C4 #define FP_V_SYNC_STRT_WID 0x02C8 #define AUX_WINDOW_HORZ_CNTL 0x02D8 #define AUX_WINDOW_VERT_CNTL 0x02DC /* #define DDA_CONFIG 0x02e0 */ /* #define DDA_ON_OFF 0x02e4 */ #define DVI_I2C_CNTL_1 0x02e4 #define GRPH_BUFFER_CNTL 0x02F0 #define GRPH2_BUFFER_CNTL 0x03F0 #define VGA_BUFFER_CNTL 0x02F4 #define OV0_Y_X_START 0x0400 #define OV0_Y_X_END 0x0404 #define OV0_PIPELINE_CNTL 0x0408 #define OV0_REG_LOAD_CNTL 0x0410 #define OV0_SCALE_CNTL 0x0420 #define OV0_V_INC 0x0424 #define OV0_P1_V_ACCUM_INIT 0x0428 #define OV0_P23_V_ACCUM_INIT 0x042C #define OV0_P1_BLANK_LINES_AT_TOP 0x0430 #define OV0_P23_BLANK_LINES_AT_TOP 0x0434 #define OV0_BASE_ADDR 0x043C #define OV0_VID_BUF0_BASE_ADRS 0x0440 #define OV0_VID_BUF1_BASE_ADRS 0x0444 #define OV0_VID_BUF2_BASE_ADRS 0x0448 #define OV0_VID_BUF3_BASE_ADRS 0x044C #define OV0_VID_BUF4_BASE_ADRS 0x0450 #define OV0_VID_BUF5_BASE_ADRS 0x0454 #define OV0_VID_BUF_PITCH0_VALUE 0x0460 #define OV0_VID_BUF_PITCH1_VALUE 0x0464 #define OV0_AUTO_FLIP_CNTRL 0x0470 #define OV0_DEINTERLACE_PATTERN 0x0474 #define OV0_SUBMIT_HISTORY 0x0478 #define OV0_H_INC 0x0480 #define OV0_STEP_BY 0x0484 #define OV0_P1_H_ACCUM_INIT 0x0488 #define OV0_P23_H_ACCUM_INIT 0x048C #define OV0_P1_X_START_END 0x0494 #define OV0_P2_X_START_END 0x0498 #define OV0_P3_X_START_END 0x049C #define OV0_FILTER_CNTL 0x04A0 #define OV0_FOUR_TAP_COEF_0 0x04B0 #define OV0_FOUR_TAP_COEF_1 0x04B4 #define OV0_FOUR_TAP_COEF_2 0x04B8 #define OV0_FOUR_TAP_COEF_3 0x04BC #define OV0_FOUR_TAP_COEF_4 0x04C0 #define OV0_FLAG_CNTRL 0x04DC #define OV0_SLICE_CNTL 0x04E0 #define OV0_VID_KEY_CLR_LOW 0x04E4 #define OV0_VID_KEY_CLR_HIGH 0x04E8 #define OV0_GRPH_KEY_CLR_LOW 0x04EC #define OV0_GRPH_KEY_CLR_HIGH 0x04F0 #define OV0_KEY_CNTL 0x04F4 #define OV0_TEST 0x04F8 #define SUBPIC_CNTL 0x0540 #define SUBPIC_DEFCOLCON 0x0544 #define SUBPIC_Y_X_START 0x054C #define SUBPIC_Y_X_END 0x0550 #define SUBPIC_V_INC 0x0554 #define SUBPIC_H_INC 0x0558 #define SUBPIC_BUF0_OFFSET 0x055C #define SUBPIC_BUF1_OFFSET 0x0560 #define SUBPIC_LC0_OFFSET 0x0564 #define SUBPIC_LC1_OFFSET 0x0568 #define SUBPIC_PITCH 0x056C #define SUBPIC_BTN_HLI_COLCON 0x0570 #define SUBPIC_BTN_HLI_Y_X_START 0x0574 #define SUBPIC_BTN_HLI_Y_X_END 0x0578 #define SUBPIC_PALETTE_INDEX 0x057C #define SUBPIC_PALETTE_DATA 0x0580 #define SUBPIC_H_ACCUM_INIT 0x0584 #define SUBPIC_V_ACCUM_INIT 0x0588 #define DISP_MISC_CNTL 0x0D00 #define DAC_MACRO_CNTL 0x0D04 #define DISP_PWR_MAN 0x0D08 #define DISP_TEST_DEBUG_CNTL 0x0D10 #define DISP_HW_DEBUG 0x0D14 #define DAC_CRC_SIG1 0x0D18 #define DAC_CRC_SIG2 0x0D1C #define OV0_LIN_TRANS_A 0x0D20 #define OV0_LIN_TRANS_B 0x0D24 #define OV0_LIN_TRANS_C 0x0D28 #define OV0_LIN_TRANS_D 0x0D2C #define OV0_LIN_TRANS_E 0x0D30 #define OV0_LIN_TRANS_F 0x0D34 #define OV0_GAMMA_0_F 0x0D40 #define OV0_GAMMA_10_1F 0x0D44 #define OV0_GAMMA_20_3F 0x0D48 #define OV0_GAMMA_40_7F 0x0D4C #define OV0_GAMMA_380_3BF 0x0D50 #define OV0_GAMMA_3C0_3FF 0x0D54 #define DISP_MERGE_CNTL 0x0D60 #define DISP_OUTPUT_CNTL 0x0D64 #define DISP_LIN_TRANS_GRPH_A 0x0D80 #define DISP_LIN_TRANS_GRPH_B 0x0D84 #define DISP_LIN_TRANS_GRPH_C 0x0D88 #define DISP_LIN_TRANS_GRPH_D 0x0D8C #define DISP_LIN_TRANS_GRPH_E 0x0D90 #define DISP_LIN_TRANS_GRPH_F 0x0D94 #define DISP_LIN_TRANS_VID_A 0x0D98 #define DISP_LIN_TRANS_VID_B 0x0D9C #define DISP_LIN_TRANS_VID_C 0x0DA0 #define DISP_LIN_TRANS_VID_D 0x0DA4 #define DISP_LIN_TRANS_VID_E 0x0DA8 #define DISP_LIN_TRANS_VID_F 0x0DAC #define RMX_HORZ_FILTER_0TAP_COEF 0x0DB0 #define RMX_HORZ_FILTER_1TAP_COEF 0x0DB4 #define RMX_HORZ_FILTER_2TAP_COEF 0x0DB8 #define RMX_HORZ_PHASE 0x0DBC #define DAC_EMBEDDED_SYNC_CNTL 0x0DC0 #define DAC_BROAD_PULSE 0x0DC4 #define DAC_SKEW_CLKS 0x0DC8 #define DAC_INCR 0x0DCC #define DAC_NEG_SYNC_LEVEL 0x0DD0 #define DAC_POS_SYNC_LEVEL 0x0DD4 #define DAC_BLANK_LEVEL 0x0DD8 #define CLOCK_CNTL_INDEX 0x0008 #define CLOCK_CNTL_DATA 0x000C #define CP_RB_CNTL 0x0704 #define CP_RB_BASE 0x0700 #define CP_RB_RPTR_ADDR 0x070C #define CP_RB_RPTR 0x0710 #define CP_RB_WPTR 0x0714 #define CP_RB_WPTR_DELAY 0x0718 #define CP_IB_BASE 0x0738 #define CP_IB_BUFSZ 0x073C #define SCRATCH_REG0 0x15E0 #define GUI_SCRATCH_REG0 0x15E0 #define SCRATCH_REG1 0x15E4 #define GUI_SCRATCH_REG1 0x15E4 #define SCRATCH_REG2 0x15E8 #define GUI_SCRATCH_REG2 0x15E8 #define SCRATCH_REG3 0x15EC #define GUI_SCRATCH_REG3 0x15EC #define SCRATCH_REG4 0x15F0 #define GUI_SCRATCH_REG4 0x15F0 #define SCRATCH_REG5 0x15F4 #define GUI_SCRATCH_REG5 0x15F4 #define SCRATCH_UMSK 0x0770 #define SCRATCH_ADDR 0x0774 #define DP_BRUSH_FRGD_CLR 0x147C #define DP_BRUSH_BKGD_CLR 0x1478 #define DST_LINE_START 0x1600 #define DST_LINE_END 0x1604 #define SRC_OFFSET 0x15AC #define SRC_PITCH 0x15B0 #define SRC_TILE 0x1704 #define SRC_PITCH_OFFSET 0x1428 #define SRC_X 0x1414 #define SRC_Y 0x1418 #define SRC_X_Y 0x1590 #define SRC_Y_X 0x1434 #define DST_Y_X 0x1438 #define DST_WIDTH_HEIGHT 0x1598 #define DST_HEIGHT_WIDTH 0x143c #define DST_OFFSET 0x1404 #define SRC_CLUT_ADDRESS 0x1780 #define SRC_CLUT_DATA 0x1784 #define SRC_CLUT_DATA_RD 0x1788 #define HOST_DATA0 0x17C0 #define HOST_DATA1 0x17C4 #define HOST_DATA2 0x17C8 #define HOST_DATA3 0x17CC #define HOST_DATA4 0x17D0 #define HOST_DATA5 0x17D4 #define HOST_DATA6 0x17D8 #define HOST_DATA7 0x17DC #define HOST_DATA_LAST 0x17E0 #define DP_SRC_ENDIAN 0x15D4 #define DP_SRC_FRGD_CLR 0x15D8 #define DP_SRC_BKGD_CLR 0x15DC #define SC_LEFT 0x1640 #define SC_RIGHT 0x1644 #define SC_TOP 0x1648 #define SC_BOTTOM 0x164C #define SRC_SC_RIGHT 0x1654 #define SRC_SC_BOTTOM 0x165C #define DP_CNTL 0x16C0 #define DP_CNTL_XDIR_YDIR_YMAJOR 0x16D0 #define DP_DATATYPE 0x16C4 #define DP_MIX 0x16C8 #define DP_WRITE_MSK 0x16CC #define DP_XOP 0x17F8 #define CLR_CMP_CLR_SRC 0x15C4 #define CLR_CMP_CLR_DST 0x15C8 #define CLR_CMP_CNTL 0x15C0 #define CLR_CMP_MSK 0x15CC #define DSTCACHE_MODE 0x1710 #define DSTCACHE_CTLSTAT 0x1714 #define DEFAULT_PITCH_OFFSET 0x16E0 #define DEFAULT_SC_BOTTOM_RIGHT 0x16E8 #define DEFAULT_SC_TOP_LEFT 0x16EC #define SRC_PITCH_OFFSET 0x1428 #define DST_PITCH_OFFSET 0x142C #define DP_GUI_MASTER_CNTL 0x146C #define SC_TOP_LEFT 0x16EC #define SC_BOTTOM_RIGHT 0x16F0 #define SRC_SC_BOTTOM_RIGHT 0x16F4 #define RB2D_DSTCACHE_MODE 0x3428 #define RB2D_DSTCACHE_CTLSTAT 0x342C #define LVDS_GEN_CNTL 0x02d0 #define LVDS_PLL_CNTL 0x02d4 #define FP2_GEN_CNTL 0x0288 #define TMDS_CNTL 0x0294 #define TMDS_CRC 0x02a0 #define TMDS_TRANSMITTER_CNTL 0x02a4 #define MPP_TB_CONFIG 0x01c0 #define PAMAC0_DLY_CNTL 0x0a94 #define PAMAC1_DLY_CNTL 0x0a98 #define PAMAC2_DLY_CNTL 0x0a9c #define FW_CNTL 0x0118 #define FCP_CNTL 0x0910 #define VGA_DDA_ON_OFF 0x02ec #define TV_MASTER_CNTL 0x0800 /* #define BASE_CODE 0x0f0b */ #define BIOS_0_SCRATCH 0x0010 #define BIOS_1_SCRATCH 0x0014 #define BIOS_2_SCRATCH 0x0018 #define BIOS_3_SCRATCH 0x001c #define BIOS_4_SCRATCH 0x0020 #define BIOS_5_SCRATCH 0x0024 #define BIOS_6_SCRATCH 0x0028 #define BIOS_7_SCRATCH 0x002c #define HDP_SOFT_RESET (1 << 26) #define TV_DAC_CNTL 0x088c #define GPIOPAD_MASK 0x0198 #define GPIOPAD_A 0x019c #define GPIOPAD_EN 0x01a0 #define GPIOPAD_Y 0x01a4 #define ZV_LCDPAD_MASK 0x01a8 #define ZV_LCDPAD_A 0x01ac #define ZV_LCDPAD_EN 0x01b0 #define ZV_LCDPAD_Y 0x01b4 /* PLL Registers */ #define CLK_PIN_CNTL 0x0001 #define PPLL_CNTL 0x0002 #define PPLL_REF_DIV 0x0003 #define PPLL_DIV_0 0x0004 #define PPLL_DIV_1 0x0005 #define PPLL_DIV_2 0x0006 #define PPLL_DIV_3 0x0007 #define VCLK_ECP_CNTL 0x0008 #define HTOTAL_CNTL 0x0009 #define M_SPLL_REF_FB_DIV 0x000a #define AGP_PLL_CNTL 0x000b #define SPLL_CNTL 0x000c #define SCLK_CNTL 0x000d #define MPLL_CNTL 0x000e #define MDLL_CKO 0x000f #define MDLL_RDCKA 0x0010 #define MCLK_CNTL 0x0012 #define AGP_PLL_CNTL 0x000b #define PLL_TEST_CNTL 0x0013 #define CLK_PWRMGT_CNTL 0x0014 #define PLL_PWRMGT_CNTL 0x0015 #define MCLK_MISC 0x001f #define P2PLL_CNTL 0x002a #define P2PLL_REF_DIV 0x002b #define PIXCLKS_CNTL 0x002d #define SCLK_MORE_CNTL 0x0035 /* MCLK_CNTL bit constants */ #define FORCEON_MCLKA (1 << 16) #define FORCEON_MCLKB (1 << 17) #define FORCEON_YCLKA (1 << 18) #define FORCEON_YCLKB (1 << 19) #define FORCEON_MC (1 << 20) #define FORCEON_AIC (1 << 21) /* SCLK_CNTL bit constants */ #define DYN_STOP_LAT_MASK 0x00007ff8 #define CP_MAX_DYN_STOP_LAT 0x0008 #define SCLK_FORCEON_MASK 0xffff8000 /* SCLK_MORE_CNTL bit constants */ #define SCLK_MORE_FORCEON 0x0700 /* BUS_CNTL bit constants */ #define BUS_DBL_RESYNC 0x00000001 #define BUS_MSTR_RESET 0x00000002 #define BUS_FLUSH_BUF 0x00000004 #define BUS_STOP_REQ_DIS 0x00000008 #define BUS_ROTATION_DIS 0x00000010 #define BUS_MASTER_DIS 0x00000040 #define BUS_ROM_WRT_EN 0x00000080 #define BUS_DIS_ROM 0x00001000 #define BUS_PCI_READ_RETRY_EN 0x00002000 #define BUS_AGP_AD_STEPPING_EN 0x00004000 #define BUS_PCI_WRT_RETRY_EN 0x00008000 #define BUS_MSTR_RD_MULT 0x00100000 #define BUS_MSTR_RD_LINE 0x00200000 #define BUS_SUSPEND 0x00400000 #define LAT_16X 0x00800000 #define BUS_RD_DISCARD_EN 0x01000000 #define BUS_RD_ABORT_EN 0x02000000 #define BUS_MSTR_WS 0x04000000 #define BUS_PARKING_DIS 0x08000000 #define BUS_MSTR_DISCONNECT_EN 0x10000000 #define BUS_WRT_BURST 0x20000000 #define BUS_READ_BURST 0x40000000 #define BUS_RDY_READ_DLY 0x80000000 /* PIXCLKS_CNTL */ #define PIX2CLK_SRC_SEL_MASK 0x03 #define PIX2CLK_SRC_SEL_CPUCLK 0x00 #define PIX2CLK_SRC_SEL_PSCANCLK 0x01 #define PIX2CLK_SRC_SEL_BYTECLK 0x02 #define PIX2CLK_SRC_SEL_P2PLLCLK 0x03 #define PIX2CLK_ALWAYS_ONb (1<<6) #define PIX2CLK_DAC_ALWAYS_ONb (1<<7) #define PIXCLK_TV_SRC_SEL (1 << 8) #define PIXCLK_LVDS_ALWAYS_ONb (1 << 14) #define PIXCLK_TMDS_ALWAYS_ONb (1 << 15) /* CLOCK_CNTL_INDEX bit constants */ #define PLL_WR_EN 0x00000080 /* CONFIG_CNTL bit constants */ #define CFG_VGA_RAM_EN 0x00000100 #define CFG_ATI_REV_ID_MASK (0xf << 16) #define CFG_ATI_REV_A11 (0 << 16) #define CFG_ATI_REV_A12 (1 << 16) #define CFG_ATI_REV_A13 (2 << 16) /* CRTC_EXT_CNTL bit constants */ #define VGA_ATI_LINEAR 0x00000008 #define VGA_128KAP_PAGING 0x00000010 #define XCRT_CNT_EN (1 << 6) #define CRTC_HSYNC_DIS (1 << 8) #define CRTC_VSYNC_DIS (1 << 9) #define CRTC_DISPLAY_DIS (1 << 10) #define CRTC_CRT_ON (1 << 15) /* DSTCACHE_CTLSTAT bit constants */ #define RB2D_DC_FLUSH (3 << 0) #define RB2D_DC_FLUSH_ALL 0xf #define RB2D_DC_BUSY (1 << 31) /* CRTC_GEN_CNTL bit constants */ #define CRTC_DBL_SCAN_EN 0x00000001 #define CRTC_CUR_EN 0x00010000 #define CRTC_INTERLACE_EN (1 << 1) #define CRTC_BYPASS_LUT_EN (1 << 14) #define CRTC_EXT_DISP_EN (1 << 24) #define CRTC_EN (1 << 25) #define CRTC_DISP_REQ_EN_B (1 << 26) /* CRTC_STATUS bit constants */ #define CRTC_VBLANK 0x00000001 /* CRTC2_GEN_CNTL bit constants */ #define CRT2_ON (1 << 7) #define CRTC2_DISPLAY_DIS (1 << 23) #define CRTC2_EN (1 << 25) #define CRTC2_DISP_REQ_EN_B (1 << 26) /* CUR_OFFSET, CUR_HORZ_VERT_POSN, CUR_HORZ_VERT_OFF bit constants */ #define CUR_LOCK 0x80000000 /* GPIO bit constants */ #define GPIO_A_0 (1 << 0) #define GPIO_A_1 (1 << 1) #define GPIO_Y_0 (1 << 8) #define GPIO_Y_1 (1 << 9) #define GPIO_EN_0 (1 << 16) #define GPIO_EN_1 (1 << 17) #define GPIO_MASK_0 (1 << 24) #define GPIO_MASK_1 (1 << 25) #define VGA_DDC_DATA_OUTPUT GPIO_A_0 #define VGA_DDC_CLK_OUTPUT GPIO_A_1 #define VGA_DDC_DATA_INPUT GPIO_Y_0 #define VGA_DDC_CLK_INPUT GPIO_Y_1 #define VGA_DDC_DATA_OUT_EN GPIO_EN_0 #define VGA_DDC_CLK_OUT_EN GPIO_EN_1 /* FP bit constants */ #define FP_CRTC_H_TOTAL_MASK 000003ff #define FP_CRTC_H_DISP_MASK 0x01ff0000 #define FP_CRTC_V_TOTAL_MASK 0x00000fff #define FP_CRTC_V_DISP_MASK 0x0fff0000 #define FP_H_SYNC_STRT_CHAR_MASK 0x00001ff8 #define FP_H_SYNC_WID_MASK 0x003f0000 #define FP_V_SYNC_STRT_MASK 0x00000fff #define FP_V_SYNC_WID_MASK 0x001f0000 #define FP_CRTC_H_TOTAL_SHIFT 0x00000000 #define FP_CRTC_H_DISP_SHIFT 0x00000010 #define FP_CRTC_V_TOTAL_SHIFT 0x00000000 #define FP_CRTC_V_DISP_SHIFT 0x00000010 #define FP_H_SYNC_STRT_CHAR_SHIFT 0x00000003 #define FP_H_SYNC_WID_SHIFT 0x00000010 #define FP_V_SYNC_STRT_SHIFT 0x00000000 #define FP_V_SYNC_WID_SHIFT 0x00000010 /* FP_GEN_CNTL bit constants */ #define FP_FPON (1 << 0) #define FP_TMDS_EN (1 << 2) #define FP_PANEL_FORMAT (1 << 3) #define FP_EN_TMDS (1 << 7) #define FP_DETECT_SENSE (1 << 8) #define R200_FP_SOURCE_SEL_MASK (3 << 10) #define R200_FP_SOURCE_SEL_CRTC1 (0 << 10) #define R200_FP_SOURCE_SEL_CRTC2 (1 << 10) #define R200_FP_SOURCE_SEL_RMX (2 << 10) #define R200_FP_SOURCE_SEL_TRANS (3 << 10) #define FP_SEL_CRTC1 (0 << 13) #define FP_SEL_CRTC2 (1 << 13) #define FP_USE_VGA_HSYNC (1 << 14) #define FP_CRTC_DONT_SHADOW_HPAR (1 << 15) #define FP_CRTC_DONT_SHADOW_VPAR (1 << 16) #define FP_CRTC_DONT_SHADOW_HEND (1 << 17) #define FP_CRTC_USE_SHADOW_VEND (1 << 18) #define FP_RMX_HVSYNC_CONTROL_EN (1 << 20) #define FP_DFP_SYNC_SEL (1 << 21) #define FP_CRTC_LOCK_8DOT (1 << 22) #define FP_CRT_SYNC_SEL (1 << 23) #define FP_USE_SHADOW_EN (1 << 24) #define FP_CRT_SYNC_ALT (1 << 26) /* FP2_GEN_CNTL bit constants */ #define FP2_BLANK_EN (1 << 1) #define FP2_ON (1 << 2) #define FP2_PANEL_FORMAT (1 << 3) #define FP2_SOURCE_SEL_MASK (3 << 10) #define FP2_SOURCE_SEL_CRTC2 (1 << 10) #define FP2_SRC_SEL_MASK (3 << 13) #define FP2_SRC_SEL_CRTC2 (1 << 13) #define FP2_FP_POL (1 << 16) #define FP2_LP_POL (1 << 17) #define FP2_SCK_POL (1 << 18) #define FP2_LCD_CNTL_MASK (7 << 19) #define FP2_PAD_FLOP_EN (1 << 22) #define FP2_CRC_EN (1 << 23) #define FP2_CRC_READ_EN (1 << 24) #define FP2_DV0_EN (1 << 25) #define FP2_DV0_RATE_SEL_SDR (1 << 26) /* LVDS_GEN_CNTL bit constants */ #define LVDS_ON (1 << 0) #define LVDS_DISPLAY_DIS (1 << 1) #define LVDS_PANEL_TYPE (1 << 2) #define LVDS_PANEL_FORMAT (1 << 3) #define LVDS_EN (1 << 7) #define LVDS_BL_MOD_LEVEL_MASK 0x0000ff00 #define LVDS_BL_MOD_LEVEL_SHIFT 8 #define LVDS_BL_MOD_EN (1 << 16) #define LVDS_DIGON (1 << 18) #define LVDS_BLON (1 << 19) #define LVDS_SEL_CRTC2 (1 << 23) #define LVDS_STATE_MASK \ (LVDS_ON | LVDS_DISPLAY_DIS | LVDS_BL_MOD_LEVEL_MASK | LVDS_BLON) /* LVDS_PLL_CNTL bit constatns */ #define HSYNC_DELAY_SHIFT 0x1c #define HSYNC_DELAY_MASK (0xf << 0x1c) /* TMDS_TRANSMITTER_CNTL bit constants */ #define TMDS_PLL_EN (1 << 0) #define TMDS_PLLRST (1 << 1) #define TMDS_RAN_PAT_RST (1 << 7) #define TMDS_ICHCSEL (1 << 28) /* FP_HORZ_STRETCH bit constants */ #define HORZ_STRETCH_RATIO_MASK 0xffff #define HORZ_STRETCH_RATIO_MAX 4096 #define HORZ_PANEL_SIZE (0x1ff << 16) #define HORZ_PANEL_SHIFT 16 #define HORZ_STRETCH_PIXREP (0 << 25) #define HORZ_STRETCH_BLEND (1 << 26) #define HORZ_STRETCH_ENABLE (1 << 25) #define HORZ_AUTO_RATIO (1 << 27) #define HORZ_FP_LOOP_STRETCH (0x7 << 28) #define HORZ_AUTO_RATIO_INC (1 << 31) /* FP_VERT_STRETCH bit constants */ #define VERT_STRETCH_RATIO_MASK 0xfff #define VERT_STRETCH_RATIO_MAX 4096 #define VERT_PANEL_SIZE (0xfff << 12) #define VERT_PANEL_SHIFT 12 #define VERT_STRETCH_LINREP (0 << 26) #define VERT_STRETCH_BLEND (1 << 26) #define VERT_STRETCH_ENABLE (1 << 25) #define VERT_AUTO_RATIO_EN (1 << 27) #define VERT_FP_LOOP_STRETCH (0x7 << 28) #define VERT_STRETCH_RESERVED 0xf1000000 /* DAC_CNTL bit constants */ #define DAC_8BIT_EN 0x00000100 #define DAC_4BPP_PIX_ORDER 0x00000200 #define DAC_CRC_EN 0x00080000 #define DAC_MASK_ALL (0xff << 24) #define DAC_PDWN (1 << 15) #define DAC_EXPAND_MODE (1 << 14) #define DAC_VGA_ADR_EN (1 << 13) #define DAC_RANGE_CNTL (3 << 0) #define DAC_RANGE_CNTL_MASK 0x03 #define DAC_BLANKING (1 << 2) #define DAC_CMP_EN (1 << 3) #define DAC_CMP_OUTPUT (1 << 7) /* DAC_CNTL2 bit constants */ #define DAC2_EXPAND_MODE (1 << 14) #define DAC2_CMP_EN (1 << 7) #define DAC2_PALETTE_ACCESS_CNTL (1 << 5) /* DAC_EXT_CNTL bit constants */ #define DAC_FORCE_BLANK_OFF_EN (1 << 4) #define DAC_FORCE_DATA_EN (1 << 5) #define DAC_FORCE_DATA_SEL_MASK (3 << 6) #define DAC_FORCE_DATA_MASK 0x0003ff00 #define DAC_FORCE_DATA_SHIFT 8 /* GEN_RESET_CNTL bit constants */ #define SOFT_RESET_GUI 0x00000001 #define SOFT_RESET_VCLK 0x00000100 #define SOFT_RESET_PCLK 0x00000200 #define SOFT_RESET_ECP 0x00000400 #define SOFT_RESET_DISPENG_XCLK 0x00000800 /* MEM_CNTL bit constants */ #define MEM_CTLR_STATUS_IDLE 0x00000000 #define MEM_CTLR_STATUS_BUSY 0x00100000 #define MEM_SEQNCR_STATUS_IDLE 0x00000000 #define MEM_SEQNCR_STATUS_BUSY 0x00200000 #define MEM_ARBITER_STATUS_IDLE 0x00000000 #define MEM_ARBITER_STATUS_BUSY 0x00400000 #define MEM_REQ_UNLOCK 0x00000000 #define MEM_REQ_LOCK 0x00800000 #define MEM_NUM_CHANNELS_MASK 0x00000001 #define MEM_USE_B_CH_ONLY 0x00000002 #define RV100_MEM_HALF_MODE 0x00000008 #define R300_MEM_NUM_CHANNELS_MASK 0x00000003 #define R300_MEM_USE_CD_CH_ONLY 0x00000004 /* RBBM_SOFT_RESET bit constants */ #define SOFT_RESET_CP (1 << 0) #define SOFT_RESET_HI (1 << 1) #define SOFT_RESET_SE (1 << 2) #define SOFT_RESET_RE (1 << 3) #define SOFT_RESET_PP (1 << 4) #define SOFT_RESET_E2 (1 << 5) #define SOFT_RESET_RB (1 << 6) #define SOFT_RESET_HDP (1 << 7) /* SURFACE_CNTL bit consants */ #define SURF_TRANSLATION_DIS (1 << 8) #define NONSURF_AP0_SWP_16BPP (1 << 20) #define NONSURF_AP0_SWP_32BPP (1 << 21) #define NONSURF_AP1_SWP_16BPP (1 << 22) #define NONSURF_AP1_SWP_32BPP (1 << 23) #define R200_SURF_TILE_COLOR_MACRO (1 << 16) /* DEFAULT_SC_BOTTOM_RIGHT bit constants */ #define DEFAULT_SC_RIGHT_MAX (0x1fff << 0) #define DEFAULT_SC_BOTTOM_MAX (0x1fff << 16) /* MM_INDEX bit constants */ #define MM_APER 0x80000000 /* CLR_CMP_CNTL bit constants */ #define COMPARE_SRC_FALSE 0x00000000 #define COMPARE_SRC_TRUE 0x00000001 #define COMPARE_SRC_NOT_EQUAL 0x00000004 #define COMPARE_SRC_EQUAL 0x00000005 #define COMPARE_SRC_EQUAL_FLIP 0x00000007 #define COMPARE_DST_FALSE 0x00000000 #define COMPARE_DST_TRUE 0x00000100 #define COMPARE_DST_NOT_EQUAL 0x00000400 #define COMPARE_DST_EQUAL 0x00000500 #define COMPARE_DESTINATION 0x00000000 #define COMPARE_SOURCE 0x01000000 #define COMPARE_SRC_AND_DST 0x02000000 /* DP_CNTL bit constants */ #define DST_X_RIGHT_TO_LEFT 0x00000000 #define DST_X_LEFT_TO_RIGHT 0x00000001 #define DST_Y_BOTTOM_TO_TOP 0x00000000 #define DST_Y_TOP_TO_BOTTOM 0x00000002 #define DST_X_MAJOR 0x00000000 #define DST_Y_MAJOR 0x00000004 #define DST_X_TILE 0x00000008 #define DST_Y_TILE 0x00000010 #define DST_LAST_PEL 0x00000020 #define DST_TRAIL_X_RIGHT_TO_LEFT 0x00000000 #define DST_TRAIL_X_LEFT_TO_RIGHT 0x00000040 #define DST_TRAP_FILL_RIGHT_TO_LEFT 0x00000000 #define DST_TRAP_FILL_LEFT_TO_RIGHT 0x00000080 #define DST_BRES_SIGN 0x00000100 #define DST_HOST_BIG_ENDIAN_EN 0x00000200 #define DST_POLYLINE_NONLAST 0x00008000 #define DST_RASTER_STALL 0x00010000 #define DST_POLY_EDGE 0x00040000 /* DP_CNTL_YDIR_XDIR_YMAJOR bit constants (short version of DP_CNTL) */ #define DST_X_MAJOR_S 0x00000000 #define DST_Y_MAJOR_S 0x00000001 #define DST_Y_BOTTOM_TO_TOP_S 0x00000000 #define DST_Y_TOP_TO_BOTTOM_S 0x00008000 #define DST_X_RIGHT_TO_LEFT_S 0x00000000 #define DST_X_LEFT_TO_RIGHT_S 0x80000000 /* DP_DATATYPE bit constants */ #define DST_8BPP 0x00000002 #define DST_15BPP 0x00000003 #define DST_16BPP 0x00000004 #define DST_24BPP 0x00000005 #define DST_32BPP 0x00000006 #define DST_8BPP_RGB332 0x00000007 #define DST_8BPP_Y8 0x00000008 #define DST_8BPP_RGB8 0x00000009 #define DST_16BPP_VYUY422 0x0000000b #define DST_16BPP_YVYU422 0x0000000c #define DST_32BPP_AYUV444 0x0000000e #define DST_16BPP_ARGB4444 0x0000000f #define BRUSH_SOLIDCOLOR 0x00000d00 #define SRC_MONO 0x00000000 #define SRC_MONO_LBKGD 0x00010000 #define SRC_DSTCOLOR 0x00030000 #define BYTE_ORDER_MSB_TO_LSB 0x00000000 #define BYTE_ORDER_LSB_TO_MSB 0x40000000 #define DP_CONVERSION_TEMP 0x80000000 #define HOST_BIG_ENDIAN_EN (1 << 29) /* DP_GUI_MASTER_CNTL bit constants */ #define GMC_SRC_PITCH_OFFSET_DEFAULT 0x00000000 #define GMC_SRC_PITCH_OFFSET_LEAVE 0x00000001 #define GMC_DST_PITCH_OFFSET_DEFAULT 0x00000000 #define GMC_DST_PITCH_OFFSET_LEAVE 0x00000002 #define GMC_SRC_CLIP_DEFAULT 0x00000000 #define GMC_SRC_CLIP_LEAVE 0x00000004 #define GMC_DST_CLIP_DEFAULT 0x00000000 #define GMC_DST_CLIP_LEAVE 0x00000008 #define GMC_BRUSH_8x8MONO 0x00000000 #define GMC_BRUSH_8x8MONO_LBKGD 0x00000010 #define GMC_BRUSH_8x1MONO 0x00000020 #define GMC_BRUSH_8x1MONO_LBKGD 0x00000030 #define GMC_BRUSH_1x8MONO 0x00000040 #define GMC_BRUSH_1x8MONO_LBKGD 0x00000050 #define GMC_BRUSH_32x1MONO 0x00000060 #define GMC_BRUSH_32x1MONO_LBKGD 0x00000070 #define GMC_BRUSH_32x32MONO 0x00000080 #define GMC_BRUSH_32x32MONO_LBKGD 0x00000090 #define GMC_BRUSH_8x8COLOR 0x000000a0 #define GMC_BRUSH_8x1COLOR 0x000000b0 #define GMC_BRUSH_1x8COLOR 0x000000c0 #define GMC_BRUSH_SOLID_COLOR 0x000000d0 #define GMC_DST_8BPP 0x00000200 #define GMC_DST_15BPP 0x00000300 #define GMC_DST_16BPP 0x00000400 #define GMC_DST_24BPP 0x00000500 #define GMC_DST_32BPP 0x00000600 #define GMC_DST_8BPP_RGB332 0x00000700 #define GMC_DST_8BPP_Y8 0x00000800 #define GMC_DST_8BPP_RGB8 0x00000900 #define GMC_DST_16BPP_VYUY422 0x00000b00 #define GMC_DST_16BPP_YVYU422 0x00000c00 #define GMC_DST_32BPP_AYUV444 0x00000e00 #define GMC_DST_16BPP_ARGB4444 0x00000f00 #define GMC_SRC_MONO 0x00000000 #define GMC_SRC_MONO_LBKGD 0x00001000 #define GMC_SRC_DSTCOLOR 0x00003000 #define GMC_BYTE_ORDER_MSB_TO_LSB 0x00000000 #define GMC_BYTE_ORDER_LSB_TO_MSB 0x00004000 #define GMC_DP_CONVERSION_TEMP_9300 0x00008000 #define GMC_DP_CONVERSION_TEMP_6500 0x00000000 #define GMC_DP_SRC_RECT 0x02000000 #define GMC_DP_SRC_HOST 0x03000000 #define GMC_DP_SRC_HOST_BYTEALIGN 0x04000000 #define GMC_3D_FCN_EN_CLR 0x00000000 #define GMC_3D_FCN_EN_SET 0x08000000 #define GMC_DST_CLR_CMP_FCN_LEAVE 0x00000000 #define GMC_DST_CLR_CMP_FCN_CLEAR 0x10000000 #define GMC_AUX_CLIP_LEAVE 0x00000000 #define GMC_AUX_CLIP_CLEAR 0x20000000 #define GMC_WRITE_MASK_LEAVE 0x00000000 #define GMC_WRITE_MASK_SET 0x40000000 #define GMC_CLR_CMP_CNTL_DIS (1 << 28) #define GMC_SRC_DATATYPE_COLOR (3 << 12) #define ROP3_S 0x00cc0000 #define ROP3_SRCCOPY 0x00cc0000 #define ROP3_P 0x00f00000 #define ROP3_PATCOPY 0x00f00000 #define DP_SRC_SOURCE_MASK (7 << 24) #define GMC_BRUSH_NONE (15 << 4) #define DP_SRC_SOURCE_MEMORY (2 << 24) #define GMC_BRUSH_SOLIDCOLOR 0x000000d0 /* DP_MIX bit constants */ #define DP_SRC_RECT 0x00000200 #define DP_SRC_HOST 0x00000300 #define DP_SRC_HOST_BYTEALIGN 0x00000400 /* MPLL_CNTL bit constants */ #define MPLL_RESET 0x00000001 /* MDLL_CKO bit constants */ #define MCKOA_SLEEP 0x00000001 #define MCKOA_RESET 0x00000002 #define MCKOA_REF_SKEW_MASK 0x00000700 #define MCKOA_FB_SKEW_MASK 0x00007000 /* MDLL_RDCKA bit constants */ #define MRDCKA0_SLEEP 0x00000001 #define MRDCKA0_RESET 0x00000002 #define MRDCKA1_SLEEP 0x00010000 #define MRDCKA1_RESET 0x00020000 /* VCLK_ECP_CNTL constants */ #define VCLK_SRC_SEL_MASK 0x03 #define VCLK_SRC_SEL_CPUCLK 0x00 #define VCLK_SRC_SEL_PSCANCLK 0x01 #define VCLK_SRC_SEL_BYTECLK 0x02 #define VCLK_SRC_SEL_PPLLCLK 0x03 #define PIXCLK_ALWAYS_ONb 0x00000040 #define PIXCLK_DAC_ALWAYS_ONb 0x00000080 /* BUS_CNTL1 constants */ #define BUS_CNTL1_MOBILE_PLATFORM_SEL_MASK 0x0c000000 #define BUS_CNTL1_MOBILE_PLATFORM_SEL_SHIFT 26 #define BUS_CNTL1_AGPCLK_VALID 0x80000000 /* PLL_PWRMGT_CNTL constants */ #define PLL_PWRMGT_CNTL_SPLL_TURNOFF 0x00000002 #define PLL_PWRMGT_CNTL_PPLL_TURNOFF 0x00000004 #define PLL_PWRMGT_CNTL_P2PLL_TURNOFF 0x00000008 #define PLL_PWRMGT_CNTL_TVPLL_TURNOFF 0x00000010 #define PLL_PWRMGT_CNTL_MOBILE_SU 0x00010000 #define PLL_PWRMGT_CNTL_SU_SCLK_USE_BCLK 0x00020000 #define PLL_PWRMGT_CNTL_SU_MCLK_USE_BCLK 0x00040000 /* TV_DAC_CNTL constants */ #define TV_DAC_CNTL_BGSLEEP 0x00000040 #define TV_DAC_CNTL_DETECT 0x00000010 #define TV_DAC_CNTL_BGADJ_MASK 0x000f0000 #define TV_DAC_CNTL_DACADJ_MASK 0x00f00000 #define TV_DAC_CNTL_BGADJ__SHIFT 16 #define TV_DAC_CNTL_DACADJ__SHIFT 20 #define TV_DAC_CNTL_RDACPD 0x01000000 #define TV_DAC_CNTL_GDACPD 0x02000000 #define TV_DAC_CNTL_BDACPD 0x04000000 /* DISP_MISC_CNTL constants */ #define DISP_MISC_CNTL_SOFT_RESET_GRPH_PP (1 << 0) #define DISP_MISC_CNTL_SOFT_RESET_SUBPIC_PP (1 << 1) #define DISP_MISC_CNTL_SOFT_RESET_OV0_PP (1 << 2) #define DISP_MISC_CNTL_SOFT_RESET_GRPH_SCLK (1 << 4) #define DISP_MISC_CNTL_SOFT_RESET_SUBPIC_SCLK (1 << 5) #define DISP_MISC_CNTL_SOFT_RESET_OV0_SCLK (1 << 6) #define DISP_MISC_CNTL_SOFT_RESET_GRPH2_PP (1 << 12) #define DISP_MISC_CNTL_SOFT_RESET_GRPH2_SCLK (1 << 15) #define DISP_MISC_CNTL_SOFT_RESET_LVDS (1 << 16) #define DISP_MISC_CNTL_SOFT_RESET_TMDS (1 << 17) #define DISP_MISC_CNTL_SOFT_RESET_DIG_TMDS (1 << 18) #define DISP_MISC_CNTL_SOFT_RESET_TV (1 << 19) /* DISP_PWR_MAN constants */ #define DISP_PWR_MAN_DISP_PWR_MAN_D3_CRTC_EN (1 << 0) #define DISP_PWR_MAN_DISP2_PWR_MAN_D3_CRTC2_EN (1 << 4) #define DISP_PWR_MAN_DISP_D3_RST (1 << 16) #define DISP_PWR_MAN_DISP_D3_REG_RST (1 << 17) #define DISP_PWR_MAN_DISP_D3_GRPH_RST (1 << 18) #define DISP_PWR_MAN_DISP_D3_SUBPIC_RST (1 << 19) #define DISP_PWR_MAN_DISP_D3_OV0_RST (1 << 20) #define DISP_PWR_MAN_DISP_D1D2_GRPH_RST (1 << 21) #define DISP_PWR_MAN_DISP_D1D2_SUBPIC_RST (1 << 22) #define DISP_PWR_MAN_DISP_D1D2_OV0_RST (1 << 23) #define DISP_PWR_MAN_DIG_TMDS_ENABLE_RST (1 << 24) #define DISP_PWR_MAN_TV_ENABLE_RST (1 << 25) #define DISP_PWR_MAN_AUTO_PWRUP_EN (1 << 26) /* masks */ #define CONFIG_MEMSIZE_MASK 0x1f000000 #define MEM_CFG_TYPE 0x40000000 #define DST_OFFSET_MASK 0x003fffff #define DST_PITCH_MASK 0x3fc00000 #define DEFAULT_TILE_MASK 0xc0000000 #define PPLL_DIV_SEL_MASK 0x00000300 #define PPLL_RESET 0x00000001 #define PPLL_SLEEP 0x00000002 #define PPLL_ATOMIC_UPDATE_EN 0x00010000 #define PPLL_REF_DIV_MASK 0x000003ff #define PPLL_FB3_DIV_MASK 0x000007ff #define PPLL_POST3_DIV_MASK 0x00070000 #define PPLL_ATOMIC_UPDATE_R 0x00008000 #define PPLL_ATOMIC_UPDATE_W 0x00008000 #define PPLL_VGA_ATOMIC_UPDATE_EN 0x00020000 #define R300_PPLL_REF_DIV_ACC_MASK (0x3ff << 18) #define R300_PPLL_REF_DIV_ACC_SHIFT 18 #define GUI_ACTIVE 0x80000000 #define MC_IND_INDEX 0x01F8 #define MC_IND_DATA 0x01FC /* PAD_CTLR_STRENGTH */ #define PAD_MANUAL_OVERRIDE 0x80000000 /* pllCLK_PIN_CNTL */ #define CLK_PIN_CNTL__OSC_EN_MASK 0x00000001L #define CLK_PIN_CNTL__OSC_EN 0x00000001L #define CLK_PIN_CNTL__XTL_LOW_GAIN_MASK 0x00000004L #define CLK_PIN_CNTL__XTL_LOW_GAIN 0x00000004L #define CLK_PIN_CNTL__DONT_USE_XTALIN_MASK 0x00000010L #define CLK_PIN_CNTL__DONT_USE_XTALIN 0x00000010L #define CLK_PIN_CNTL__SLOW_CLOCK_SOURCE_MASK 0x00000020L #define CLK_PIN_CNTL__SLOW_CLOCK_SOURCE 0x00000020L #define CLK_PIN_CNTL__CG_CLK_TO_OUTPIN_MASK 0x00000800L #define CLK_PIN_CNTL__CG_CLK_TO_OUTPIN 0x00000800L #define CLK_PIN_CNTL__CG_COUNT_UP_TO_OUTPIN_MASK 0x00001000L #define CLK_PIN_CNTL__CG_COUNT_UP_TO_OUTPIN 0x00001000L #define CLK_PIN_CNTL__ACCESS_REGS_IN_SUSPEND_MASK 0x00002000L #define CLK_PIN_CNTL__ACCESS_REGS_IN_SUSPEND 0x00002000L #define CLK_PIN_CNTL__CG_SPARE_MASK 0x00004000L #define CLK_PIN_CNTL__CG_SPARE 0x00004000L #define CLK_PIN_CNTL__SCLK_DYN_START_CNTL_MASK 0x00008000L #define CLK_PIN_CNTL__SCLK_DYN_START_CNTL 0x00008000L #define CLK_PIN_CNTL__CP_CLK_RUNNING_MASK 0x00010000L #define CLK_PIN_CNTL__CP_CLK_RUNNING 0x00010000L #define CLK_PIN_CNTL__CG_SPARE_RD_MASK 0x00060000L #define CLK_PIN_CNTL__XTALIN_ALWAYS_ONb_MASK 0x00080000L #define CLK_PIN_CNTL__XTALIN_ALWAYS_ONb 0x00080000L #define CLK_PIN_CNTL__PWRSEQ_DELAY_MASK 0xff000000L /* pllCLK_PWRMGT_CNTL */ #define CLK_PWRMGT_CNTL__MPLL_PWRMGT_OFF__SHIFT 0x00000000 #define CLK_PWRMGT_CNTL__SPLL_PWRMGT_OFF__SHIFT 0x00000001 #define CLK_PWRMGT_CNTL__PPLL_PWRMGT_OFF__SHIFT 0x00000002 #define CLK_PWRMGT_CNTL__P2PLL_PWRMGT_OFF__SHIFT 0x00000003 #define CLK_PWRMGT_CNTL__MCLK_TURNOFF__SHIFT 0x00000004 #define CLK_PWRMGT_CNTL__SCLK_TURNOFF__SHIFT 0x00000005 #define CLK_PWRMGT_CNTL__PCLK_TURNOFF__SHIFT 0x00000006 #define CLK_PWRMGT_CNTL__P2CLK_TURNOFF__SHIFT 0x00000007 #define CLK_PWRMGT_CNTL__MC_CH_MODE__SHIFT 0x00000008 #define CLK_PWRMGT_CNTL__TEST_MODE__SHIFT 0x00000009 #define CLK_PWRMGT_CNTL__GLOBAL_PMAN_EN__SHIFT 0x0000000a #define CLK_PWRMGT_CNTL__ENGINE_DYNCLK_MODE__SHIFT 0x0000000c #define CLK_PWRMGT_CNTL__ACTIVE_HILO_LAT__SHIFT 0x0000000d #define CLK_PWRMGT_CNTL__DISP_DYN_STOP_LAT__SHIFT 0x0000000f #define CLK_PWRMGT_CNTL__MC_BUSY__SHIFT 0x00000010 #define CLK_PWRMGT_CNTL__MC_INT_CNTL__SHIFT 0x00000011 #define CLK_PWRMGT_CNTL__MC_SWITCH__SHIFT 0x00000012 #define CLK_PWRMGT_CNTL__DLL_READY__SHIFT 0x00000013 #define CLK_PWRMGT_CNTL__DISP_PM__SHIFT 0x00000014 #define CLK_PWRMGT_CNTL__DYN_STOP_MODE__SHIFT 0x00000015 #define CLK_PWRMGT_CNTL__CG_NO1_DEBUG__SHIFT 0x00000018 #define CLK_PWRMGT_CNTL__TVPLL_PWRMGT_OFF__SHIFT 0x0000001e #define CLK_PWRMGT_CNTL__TVCLK_TURNOFF__SHIFT 0x0000001f /* pllP2PLL_CNTL */ #define P2PLL_CNTL__P2PLL_RESET_MASK 0x00000001L #define P2PLL_CNTL__P2PLL_RESET 0x00000001L #define P2PLL_CNTL__P2PLL_SLEEP_MASK 0x00000002L #define P2PLL_CNTL__P2PLL_SLEEP 0x00000002L #define P2PLL_CNTL__P2PLL_TST_EN_MASK 0x00000004L #define P2PLL_CNTL__P2PLL_TST_EN 0x00000004L #define P2PLL_CNTL__P2PLL_REFCLK_SEL_MASK 0x00000010L #define P2PLL_CNTL__P2PLL_REFCLK_SEL 0x00000010L #define P2PLL_CNTL__P2PLL_FBCLK_SEL_MASK 0x00000020L #define P2PLL_CNTL__P2PLL_FBCLK_SEL 0x00000020L #define P2PLL_CNTL__P2PLL_TCPOFF_MASK 0x00000040L #define P2PLL_CNTL__P2PLL_TCPOFF 0x00000040L #define P2PLL_CNTL__P2PLL_TVCOMAX_MASK 0x00000080L #define P2PLL_CNTL__P2PLL_TVCOMAX 0x00000080L #define P2PLL_CNTL__P2PLL_PCP_MASK 0x00000700L #define P2PLL_CNTL__P2PLL_PVG_MASK 0x00003800L #define P2PLL_CNTL__P2PLL_PDC_MASK 0x0000c000L #define P2PLL_CNTL__P2PLL_ATOMIC_UPDATE_EN_MASK 0x00010000L #define P2PLL_CNTL__P2PLL_ATOMIC_UPDATE_EN 0x00010000L #define P2PLL_CNTL__P2PLL_ATOMIC_UPDATE_SYNC_MASK 0x00040000L #define P2PLL_CNTL__P2PLL_ATOMIC_UPDATE_SYNC 0x00040000L #define P2PLL_CNTL__P2PLL_DISABLE_AUTO_RESET_MASK 0x00080000L #define P2PLL_CNTL__P2PLL_DISABLE_AUTO_RESET 0x00080000L /* pllPIXCLKS_CNTL */ #define PIXCLKS_CNTL__PIX2CLK_SRC_SEL__SHIFT 0x00000000 #define PIXCLKS_CNTL__PIX2CLK_INVERT__SHIFT 0x00000004 #define PIXCLKS_CNTL__PIX2CLK_SRC_INVERT__SHIFT 0x00000005 #define PIXCLKS_CNTL__PIX2CLK_ALWAYS_ONb__SHIFT 0x00000006 #define PIXCLKS_CNTL__PIX2CLK_DAC_ALWAYS_ONb__SHIFT 0x00000007 #define PIXCLKS_CNTL__PIXCLK_TV_SRC_SEL__SHIFT 0x00000008 #define PIXCLKS_CNTL__PIXCLK_BLEND_ALWAYS_ONb__SHIFT 0x0000000b #define PIXCLKS_CNTL__PIXCLK_GV_ALWAYS_ONb__SHIFT 0x0000000c #define PIXCLKS_CNTL__PIXCLK_DIG_TMDS_ALWAYS_ONb__SHIFT 0x0000000d #define PIXCLKS_CNTL__PIXCLK_LVDS_ALWAYS_ONb__SHIFT 0x0000000e #define PIXCLKS_CNTL__PIXCLK_TMDS_ALWAYS_ONb__SHIFT 0x0000000f /* pllPIXCLKS_CNTL */ #define PIXCLKS_CNTL__PIX2CLK_SRC_SEL_MASK 0x00000003L #define PIXCLKS_CNTL__PIX2CLK_INVERT 0x00000010L #define PIXCLKS_CNTL__PIX2CLK_SRC_INVERT 0x00000020L #define PIXCLKS_CNTL__PIX2CLK_ALWAYS_ONb 0x00000040L #define PIXCLKS_CNTL__PIX2CLK_DAC_ALWAYS_ONb 0x00000080L #define PIXCLKS_CNTL__PIXCLK_TV_SRC_SEL 0x00000100L #define PIXCLKS_CNTL__PIXCLK_BLEND_ALWAYS_ONb 0x00000800L #define PIXCLKS_CNTL__PIXCLK_GV_ALWAYS_ONb 0x00001000L #define PIXCLKS_CNTL__PIXCLK_DIG_TMDS_ALWAYS_ONb 0x00002000L #define PIXCLKS_CNTL__PIXCLK_LVDS_ALWAYS_ONb 0x00004000L #define PIXCLKS_CNTL__PIXCLK_TMDS_ALWAYS_ONb 0x00008000L #define PIXCLKS_CNTL__DISP_TVOUT_PIXCLK_TV_ALWAYS_ONb (1 << 9) #define PIXCLKS_CNTL__R300_DVOCLK_ALWAYS_ONb (1 << 10) #define PIXCLKS_CNTL__R300_PIXCLK_DVO_ALWAYS_ONb (1 << 13) #define PIXCLKS_CNTL__R300_PIXCLK_TRANS_ALWAYS_ONb (1 << 16) #define PIXCLKS_CNTL__R300_PIXCLK_TVO_ALWAYS_ONb (1 << 17) #define PIXCLKS_CNTL__R300_P2G2CLK_ALWAYS_ONb (1 << 18) #define PIXCLKS_CNTL__R300_P2G2CLK_DAC_ALWAYS_ONb (1 << 19) #define PIXCLKS_CNTL__R300_DISP_DAC_PIXCLK_DAC2_BLANK_OFF (1 << 23) /* pllP2PLL_DIV_0 */ #define P2PLL_DIV_0__P2PLL_FB_DIV_MASK 0x000007ffL #define P2PLL_DIV_0__P2PLL_ATOMIC_UPDATE_W_MASK 0x00008000L #define P2PLL_DIV_0__P2PLL_ATOMIC_UPDATE_W 0x00008000L #define P2PLL_DIV_0__P2PLL_ATOMIC_UPDATE_R_MASK 0x00008000L #define P2PLL_DIV_0__P2PLL_ATOMIC_UPDATE_R 0x00008000L #define P2PLL_DIV_0__P2PLL_POST_DIV_MASK 0x00070000L /* pllSCLK_CNTL */ #define SCLK_CNTL__SCLK_SRC_SEL_MASK 0x00000007L #define SCLK_CNTL__CP_MAX_DYN_STOP_LAT 0x00000008L #define SCLK_CNTL__HDP_MAX_DYN_STOP_LAT 0x00000010L #define SCLK_CNTL__TV_MAX_DYN_STOP_LAT 0x00000020L #define SCLK_CNTL__E2_MAX_DYN_STOP_LAT 0x00000040L #define SCLK_CNTL__SE_MAX_DYN_STOP_LAT 0x00000080L #define SCLK_CNTL__IDCT_MAX_DYN_STOP_LAT 0x00000100L #define SCLK_CNTL__VIP_MAX_DYN_STOP_LAT 0x00000200L #define SCLK_CNTL__RE_MAX_DYN_STOP_LAT 0x00000400L #define SCLK_CNTL__PB_MAX_DYN_STOP_LAT 0x00000800L #define SCLK_CNTL__TAM_MAX_DYN_STOP_LAT 0x00001000L #define SCLK_CNTL__TDM_MAX_DYN_STOP_LAT 0x00002000L #define SCLK_CNTL__RB_MAX_DYN_STOP_LAT 0x00004000L #define SCLK_CNTL__DYN_STOP_LAT_MASK 0x00007ff8 #define SCLK_CNTL__FORCE_DISP2 0x00008000L #define SCLK_CNTL__FORCE_CP 0x00010000L #define SCLK_CNTL__FORCE_HDP 0x00020000L #define SCLK_CNTL__FORCE_DISP1 0x00040000L #define SCLK_CNTL__FORCE_TOP 0x00080000L #define SCLK_CNTL__FORCE_E2 0x00100000L #define SCLK_CNTL__FORCE_SE 0x00200000L #define SCLK_CNTL__FORCE_IDCT 0x00400000L #define SCLK_CNTL__FORCE_VIP 0x00800000L #define SCLK_CNTL__FORCE_RE 0x01000000L #define SCLK_CNTL__FORCE_PB 0x02000000L #define SCLK_CNTL__FORCE_TAM 0x04000000L #define SCLK_CNTL__FORCE_TDM 0x08000000L #define SCLK_CNTL__FORCE_RB 0x10000000L #define SCLK_CNTL__FORCE_TV_SCLK 0x20000000L #define SCLK_CNTL__FORCE_SUBPIC 0x40000000L #define SCLK_CNTL__FORCE_OV0 0x80000000L #define SCLK_CNTL__R300_FORCE_VAP (1<<21) #define SCLK_CNTL__R300_FORCE_SR (1<<25) #define SCLK_CNTL__R300_FORCE_PX (1<<26) #define SCLK_CNTL__R300_FORCE_TX (1<<27) #define SCLK_CNTL__R300_FORCE_US (1<<28) #define SCLK_CNTL__R300_FORCE_SU (1<<30) #define SCLK_CNTL__FORCEON_MASK 0xffff8000L /* pllSCLK_CNTL2 */ #define SCLK_CNTL2__R300_TCL_MAX_DYN_STOP_LAT (1<<10) #define SCLK_CNTL2__R300_GA_MAX_DYN_STOP_LAT (1<<11) #define SCLK_CNTL2__R300_CBA_MAX_DYN_STOP_LAT (1<<12) #define SCLK_CNTL2__R300_FORCE_TCL (1<<13) #define SCLK_CNTL2__R300_FORCE_CBA (1<<14) #define SCLK_CNTL2__R300_FORCE_GA (1<<15) /* SCLK_MORE_CNTL */ #define SCLK_MORE_CNTL__DISPREGS_MAX_DYN_STOP_LAT 0x00000001L #define SCLK_MORE_CNTL__MC_GUI_MAX_DYN_STOP_LAT 0x00000002L #define SCLK_MORE_CNTL__MC_HOST_MAX_DYN_STOP_LAT 0x00000004L #define SCLK_MORE_CNTL__FORCE_DISPREGS 0x00000100L #define SCLK_MORE_CNTL__FORCE_MC_GUI 0x00000200L #define SCLK_MORE_CNTL__FORCE_MC_HOST 0x00000400L #define SCLK_MORE_CNTL__STOP_SCLK_EN 0x00001000L #define SCLK_MORE_CNTL__STOP_SCLK_A 0x00002000L #define SCLK_MORE_CNTL__STOP_SCLK_B 0x00004000L #define SCLK_MORE_CNTL__STOP_SCLK_C 0x00008000L #define SCLK_MORE_CNTL__HALF_SPEED_SCLK 0x00010000L #define SCLK_MORE_CNTL__IO_CG_VOLTAGE_DROP 0x00020000L #define SCLK_MORE_CNTL__TVFB_SOFT_RESET 0x00040000L #define SCLK_MORE_CNTL__VOLTAGE_DROP_SYNC 0x00080000L #define SCLK_MORE_CNTL__IDLE_DELAY_HALF_SCLK 0x00400000L #define SCLK_MORE_CNTL__AGP_BUSY_HALF_SCLK 0x00800000L #define SCLK_MORE_CNTL__CG_SPARE_RD_C_MASK 0xff000000L #define SCLK_MORE_CNTL__FORCEON 0x00000700L /* MCLK_CNTL */ #define MCLK_CNTL__MCLKA_SRC_SEL_MASK 0x00000007L #define MCLK_CNTL__YCLKA_SRC_SEL_MASK 0x00000070L #define MCLK_CNTL__MCLKB_SRC_SEL_MASK 0x00000700L #define MCLK_CNTL__YCLKB_SRC_SEL_MASK 0x00007000L #define MCLK_CNTL__FORCE_MCLKA_MASK 0x00010000L #define MCLK_CNTL__FORCE_MCLKA 0x00010000L #define MCLK_CNTL__FORCE_MCLKB_MASK 0x00020000L #define MCLK_CNTL__FORCE_MCLKB 0x00020000L #define MCLK_CNTL__FORCE_YCLKA_MASK 0x00040000L #define MCLK_CNTL__FORCE_YCLKA 0x00040000L #define MCLK_CNTL__FORCE_YCLKB_MASK 0x00080000L #define MCLK_CNTL__FORCE_YCLKB 0x00080000L #define MCLK_CNTL__FORCE_MC_MASK 0x00100000L #define MCLK_CNTL__FORCE_MC 0x00100000L #define MCLK_CNTL__FORCE_AIC_MASK 0x00200000L #define MCLK_CNTL__FORCE_AIC 0x00200000L #define MCLK_CNTL__MRDCKA0_SOUTSEL_MASK 0x03000000L #define MCLK_CNTL__MRDCKA1_SOUTSEL_MASK 0x0c000000L #define MCLK_CNTL__MRDCKB0_SOUTSEL_MASK 0x30000000L #define MCLK_CNTL__MRDCKB1_SOUTSEL_MASK 0xc0000000L #define MCLK_CNTL__R300_DISABLE_MC_MCLKA (1 << 21) #define MCLK_CNTL__R300_DISABLE_MC_MCLKB (1 << 21) /* MCLK_MISC */ #define MCLK_MISC__SCLK_SOURCED_FROM_MPLL_SEL_MASK 0x00000003L #define MCLK_MISC__MCLK_FROM_SPLL_DIV_SEL_MASK 0x00000004L #define MCLK_MISC__MCLK_FROM_SPLL_DIV_SEL 0x00000004L #define MCLK_MISC__ENABLE_SCLK_FROM_MPLL_MASK 0x00000008L #define MCLK_MISC__ENABLE_SCLK_FROM_MPLL 0x00000008L #define MCLK_MISC__MPLL_MODEA_MODEC_HW_SEL_EN_MASK 0x00000010L #define MCLK_MISC__MPLL_MODEA_MODEC_HW_SEL_EN 0x00000010L #define MCLK_MISC__DLL_READY_LAT_MASK 0x00000100L #define MCLK_MISC__DLL_READY_LAT 0x00000100L #define MCLK_MISC__MC_MCLK_MAX_DYN_STOP_LAT_MASK 0x00001000L #define MCLK_MISC__MC_MCLK_MAX_DYN_STOP_LAT 0x00001000L #define MCLK_MISC__IO_MCLK_MAX_DYN_STOP_LAT_MASK 0x00002000L #define MCLK_MISC__IO_MCLK_MAX_DYN_STOP_LAT 0x00002000L #define MCLK_MISC__MC_MCLK_DYN_ENABLE_MASK 0x00004000L #define MCLK_MISC__MC_MCLK_DYN_ENABLE 0x00004000L #define MCLK_MISC__IO_MCLK_DYN_ENABLE_MASK 0x00008000L #define MCLK_MISC__IO_MCLK_DYN_ENABLE 0x00008000L #define MCLK_MISC__CGM_CLK_TO_OUTPIN_MASK 0x00010000L #define MCLK_MISC__CGM_CLK_TO_OUTPIN 0x00010000L #define MCLK_MISC__CLK_OR_COUNT_SEL_MASK 0x00020000L #define MCLK_MISC__CLK_OR_COUNT_SEL 0x00020000L #define MCLK_MISC__EN_MCLK_TRISTATE_IN_SUSPEND_MASK 0x00040000L #define MCLK_MISC__EN_MCLK_TRISTATE_IN_SUSPEND 0x00040000L #define MCLK_MISC__CGM_SPARE_RD_MASK 0x00300000L #define MCLK_MISC__CGM_SPARE_A_RD_MASK 0x00c00000L #define MCLK_MISC__TCLK_TO_YCLKB_EN_MASK 0x01000000L #define MCLK_MISC__TCLK_TO_YCLKB_EN 0x01000000L #define MCLK_MISC__CGM_SPARE_A_MASK 0x0e000000L /* VCLK_ECP_CNTL */ #define VCLK_ECP_CNTL__VCLK_SRC_SEL_MASK 0x00000003L #define VCLK_ECP_CNTL__VCLK_INVERT 0x00000010L #define VCLK_ECP_CNTL__PIXCLK_SRC_INVERT 0x00000020L #define VCLK_ECP_CNTL__PIXCLK_ALWAYS_ONb 0x00000040L #define VCLK_ECP_CNTL__PIXCLK_DAC_ALWAYS_ONb 0x00000080L #define VCLK_ECP_CNTL__ECP_DIV_MASK 0x00000300L #define VCLK_ECP_CNTL__ECP_FORCE_ON 0x00040000L #define VCLK_ECP_CNTL__SUBCLK_FORCE_ON 0x00080000L #define VCLK_ECP_CNTL__R300_DISP_DAC_PIXCLK_DAC_BLANK_OFF (1<<23) /* PLL_PWRMGT_CNTL */ #define PLL_PWRMGT_CNTL__MPLL_TURNOFF_MASK 0x00000001L #define PLL_PWRMGT_CNTL__MPLL_TURNOFF 0x00000001L #define PLL_PWRMGT_CNTL__SPLL_TURNOFF_MASK 0x00000002L #define PLL_PWRMGT_CNTL__SPLL_TURNOFF 0x00000002L #define PLL_PWRMGT_CNTL__PPLL_TURNOFF_MASK 0x00000004L #define PLL_PWRMGT_CNTL__PPLL_TURNOFF 0x00000004L #define PLL_PWRMGT_CNTL__P2PLL_TURNOFF_MASK 0x00000008L #define PLL_PWRMGT_CNTL__P2PLL_TURNOFF 0x00000008L #define PLL_PWRMGT_CNTL__TVPLL_TURNOFF_MASK 0x00000010L #define PLL_PWRMGT_CNTL__TVPLL_TURNOFF 0x00000010L #define PLL_PWRMGT_CNTL__AGPCLK_DYN_STOP_LAT_MASK 0x000001e0L #define PLL_PWRMGT_CNTL__APM_POWER_STATE_MASK 0x00000600L #define PLL_PWRMGT_CNTL__APM_PWRSTATE_RD_MASK 0x00001800L #define PLL_PWRMGT_CNTL__PM_MODE_SEL_MASK 0x00002000L #define PLL_PWRMGT_CNTL__PM_MODE_SEL 0x00002000L #define PLL_PWRMGT_CNTL__EN_PWRSEQ_DONE_COND_MASK 0x00004000L #define PLL_PWRMGT_CNTL__EN_PWRSEQ_DONE_COND 0x00004000L #define PLL_PWRMGT_CNTL__EN_DISP_PARKED_COND_MASK 0x00008000L #define PLL_PWRMGT_CNTL__EN_DISP_PARKED_COND 0x00008000L #define PLL_PWRMGT_CNTL__MOBILE_SU_MASK 0x00010000L #define PLL_PWRMGT_CNTL__MOBILE_SU 0x00010000L #define PLL_PWRMGT_CNTL__SU_SCLK_USE_BCLK_MASK 0x00020000L #define PLL_PWRMGT_CNTL__SU_SCLK_USE_BCLK 0x00020000L #define PLL_PWRMGT_CNTL__SU_MCLK_USE_BCLK_MASK 0x00040000L #define PLL_PWRMGT_CNTL__SU_MCLK_USE_BCLK 0x00040000L #define PLL_PWRMGT_CNTL__SU_SUSTAIN_DISABLE_MASK 0x00080000L #define PLL_PWRMGT_CNTL__SU_SUSTAIN_DISABLE 0x00080000L #define PLL_PWRMGT_CNTL__TCL_BYPASS_DISABLE_MASK 0x00100000L #define PLL_PWRMGT_CNTL__TCL_BYPASS_DISABLE 0x00100000L #define PLL_PWRMGT_CNTL__TCL_CLOCK_CTIVE_RD_MASK 0x00200000L #define PLL_PWRMGT_CNTL__TCL_CLOCK_ACTIVE_RD 0x00200000L #define PLL_PWRMGT_CNTL__CG_NO2_DEBUG_MASK 0xff000000L /* CLK_PWRMGT_CNTL */ #define CLK_PWRMGT_CNTL__MPLL_PWRMGT_OFF_MASK 0x00000001L #define CLK_PWRMGT_CNTL__MPLL_PWRMGT_OFF 0x00000001L #define CLK_PWRMGT_CNTL__SPLL_PWRMGT_OFF_MASK 0x00000002L #define CLK_PWRMGT_CNTL__SPLL_PWRMGT_OFF 0x00000002L #define CLK_PWRMGT_CNTL__PPLL_PWRMGT_OFF_MASK 0x00000004L #define CLK_PWRMGT_CNTL__PPLL_PWRMGT_OFF 0x00000004L #define CLK_PWRMGT_CNTL__P2PLL_PWRMGT_OFF_MASK 0x00000008L #define CLK_PWRMGT_CNTL__P2PLL_PWRMGT_OFF 0x00000008L #define CLK_PWRMGT_CNTL__MCLK_TURNOFF_MASK 0x00000010L #define CLK_PWRMGT_CNTL__MCLK_TURNOFF 0x00000010L #define CLK_PWRMGT_CNTL__SCLK_TURNOFF_MASK 0x00000020L #define CLK_PWRMGT_CNTL__SCLK_TURNOFF 0x00000020L #define CLK_PWRMGT_CNTL__PCLK_TURNOFF_MASK 0x00000040L #define CLK_PWRMGT_CNTL__PCLK_TURNOFF 0x00000040L #define CLK_PWRMGT_CNTL__P2CLK_TURNOFF_MASK 0x00000080L #define CLK_PWRMGT_CNTL__P2CLK_TURNOFF 0x00000080L #define CLK_PWRMGT_CNTL__MC_CH_MODE_MASK 0x00000100L #define CLK_PWRMGT_CNTL__MC_CH_MODE 0x00000100L #define CLK_PWRMGT_CNTL__TEST_MODE_MASK 0x00000200L #define CLK_PWRMGT_CNTL__TEST_MODE 0x00000200L #define CLK_PWRMGT_CNTL__GLOBAL_PMAN_EN_MASK 0x00000400L #define CLK_PWRMGT_CNTL__GLOBAL_PMAN_EN 0x00000400L #define CLK_PWRMGT_CNTL__ENGINE_DYNCLK_MODE_MASK 0x00001000L #define CLK_PWRMGT_CNTL__ENGINE_DYNCLK_MODE 0x00001000L #define CLK_PWRMGT_CNTL__ACTIVE_HILO_LAT_MASK 0x00006000L #define CLK_PWRMGT_CNTL__DISP_DYN_STOP_LAT_MASK 0x00008000L #define CLK_PWRMGT_CNTL__DISP_DYN_STOP_LAT 0x00008000L #define CLK_PWRMGT_CNTL__MC_BUSY_MASK 0x00010000L #define CLK_PWRMGT_CNTL__MC_BUSY 0x00010000L #define CLK_PWRMGT_CNTL__MC_INT_CNTL_MASK 0x00020000L #define CLK_PWRMGT_CNTL__MC_INT_CNTL 0x00020000L #define CLK_PWRMGT_CNTL__MC_SWITCH_MASK 0x00040000L #define CLK_PWRMGT_CNTL__MC_SWITCH 0x00040000L #define CLK_PWRMGT_CNTL__DLL_READY_MASK 0x00080000L #define CLK_PWRMGT_CNTL__DLL_READY 0x00080000L #define CLK_PWRMGT_CNTL__DISP_PM_MASK 0x00100000L #define CLK_PWRMGT_CNTL__DISP_PM 0x00100000L #define CLK_PWRMGT_CNTL__DYN_STOP_MODE_MASK 0x00e00000L #define CLK_PWRMGT_CNTL__CG_NO1_DEBUG_MASK 0x3f000000L #define CLK_PWRMGT_CNTL__TVPLL_PWRMGT_OFF_MASK 0x40000000L #define CLK_PWRMGT_CNTL__TVPLL_PWRMGT_OFF 0x40000000L #define CLK_PWRMGT_CNTL__TVCLK_TURNOFF_MASK 0x80000000L #define CLK_PWRMGT_CNTL__TVCLK_TURNOFF 0x80000000L /* BUS_CNTL1 */ #define BUS_CNTL1__PMI_IO_DISABLE_MASK 0x00000001L #define BUS_CNTL1__PMI_IO_DISABLE 0x00000001L #define BUS_CNTL1__PMI_MEM_DISABLE_MASK 0x00000002L #define BUS_CNTL1__PMI_MEM_DISABLE 0x00000002L #define BUS_CNTL1__PMI_BM_DISABLE_MASK 0x00000004L #define BUS_CNTL1__PMI_BM_DISABLE 0x00000004L #define BUS_CNTL1__PMI_INT_DISABLE_MASK 0x00000008L #define BUS_CNTL1__PMI_INT_DISABLE 0x00000008L #define BUS_CNTL1__BUS2_IMMEDIATE_PMI_DISABLE_MASK 0x00000020L #define BUS_CNTL1__BUS2_IMMEDIATE_PMI_DISABLE 0x00000020L #define BUS_CNTL1__BUS2_VGA_REG_COHERENCY_DIS_MASK 0x00000100L #define BUS_CNTL1__BUS2_VGA_REG_COHERENCY_DIS 0x00000100L #define BUS_CNTL1__BUS2_VGA_MEM_COHERENCY_DIS_MASK 0x00000200L #define BUS_CNTL1__BUS2_VGA_MEM_COHERENCY_DIS 0x00000200L #define BUS_CNTL1__BUS2_HDP_REG_COHERENCY_DIS_MASK 0x00000400L #define BUS_CNTL1__BUS2_HDP_REG_COHERENCY_DIS 0x00000400L #define BUS_CNTL1__BUS2_GUI_INITIATOR_COHERENCY_DIS_MASK 0x00000800L #define BUS_CNTL1__BUS2_GUI_INITIATOR_COHERENCY_DIS 0x00000800L #define BUS_CNTL1__MOBILE_PLATFORM_SEL_MASK 0x0c000000L #define BUS_CNTL1__SEND_SBA_LATENCY_MASK 0x70000000L #define BUS_CNTL1__AGPCLK_VALID_MASK 0x80000000L #define BUS_CNTL1__AGPCLK_VALID 0x80000000L /* BUS_CNTL1 */ #define BUS_CNTL1__PMI_IO_DISABLE__SHIFT 0x00000000 #define BUS_CNTL1__PMI_MEM_DISABLE__SHIFT 0x00000001 #define BUS_CNTL1__PMI_BM_DISABLE__SHIFT 0x00000002 #define BUS_CNTL1__PMI_INT_DISABLE__SHIFT 0x00000003 #define BUS_CNTL1__BUS2_IMMEDIATE_PMI_DISABLE__SHIFT 0x00000005 #define BUS_CNTL1__BUS2_VGA_REG_COHERENCY_DIS__SHIFT 0x00000008 #define BUS_CNTL1__BUS2_VGA_MEM_COHERENCY_DIS__SHIFT 0x00000009 #define BUS_CNTL1__BUS2_HDP_REG_COHERENCY_DIS__SHIFT 0x0000000a #define BUS_CNTL1__BUS2_GUI_INITIATOR_COHERENCY_DIS__SHIFT 0x0000000b #define BUS_CNTL1__MOBILE_PLATFORM_SEL__SHIFT 0x0000001a #define BUS_CNTL1__SEND_SBA_LATENCY__SHIFT 0x0000001c #define BUS_CNTL1__AGPCLK_VALID__SHIFT 0x0000001f /* CRTC_OFFSET_CNTL */ #define CRTC_OFFSET_CNTL__CRTC_TILE_LINE_MASK 0x0000000fL #define CRTC_OFFSET_CNTL__CRTC_TILE_LINE_RIGHT_MASK 0x000000f0L #define CRTC_OFFSET_CNTL__CRTC_TILE_EN_RIGHT_MASK 0x00004000L #define CRTC_OFFSET_CNTL__CRTC_TILE_EN_RIGHT 0x00004000L #define CRTC_OFFSET_CNTL__CRTC_TILE_EN_MASK 0x00008000L #define CRTC_OFFSET_CNTL__CRTC_TILE_EN 0x00008000L #define CRTC_OFFSET_CNTL__CRTC_OFFSET_FLIP_CNTL_MASK 0x00010000L #define CRTC_OFFSET_CNTL__CRTC_OFFSET_FLIP_CNTL 0x00010000L #define CRTC_OFFSET_CNTL__CRTC_STEREO_OFFSET_EN_MASK 0x00020000L #define CRTC_OFFSET_CNTL__CRTC_STEREO_OFFSET_EN 0x00020000L #define CRTC_OFFSET_CNTL__CRTC_STEREO_SYNC_EN_MASK 0x000c0000L #define CRTC_OFFSET_CNTL__CRTC_STEREO_SYNC_OUT_EN_MASK 0x00100000L #define CRTC_OFFSET_CNTL__CRTC_STEREO_SYNC_OUT_EN 0x00100000L #define CRTC_OFFSET_CNTL__CRTC_STEREO_SYNC_MASK 0x00200000L #define CRTC_OFFSET_CNTL__CRTC_STEREO_SYNC 0x00200000L #define CRTC_OFFSET_CNTL__CRTC_GUI_TRIG_OFFSET_LEFT_EN_MASK 0x10000000L #define CRTC_OFFSET_CNTL__CRTC_GUI_TRIG_OFFSET_LEFT_EN 0x10000000L #define CRTC_OFFSET_CNTL__CRTC_GUI_TRIG_OFFSET_RIGHT_EN_MASK 0x20000000L #define CRTC_OFFSET_CNTL__CRTC_GUI_TRIG_OFFSET_RIGHT_EN 0x20000000L #define CRTC_OFFSET_CNTL__CRTC_GUI_TRIG_OFFSET_MASK 0x40000000L #define CRTC_OFFSET_CNTL__CRTC_GUI_TRIG_OFFSET 0x40000000L #define CRTC_OFFSET_CNTL__CRTC_OFFSET_LOCK_MASK 0x80000000L #define CRTC_OFFSET_CNTL__CRTC_OFFSET_LOCK 0x80000000L /* CRTC_GEN_CNTL */ #define CRTC_GEN_CNTL__CRTC_DBL_SCAN_EN_MASK 0x00000001L #define CRTC_GEN_CNTL__CRTC_DBL_SCAN_EN 0x00000001L #define CRTC_GEN_CNTL__CRTC_INTERLACE_EN_MASK 0x00000002L #define CRTC_GEN_CNTL__CRTC_INTERLACE_EN 0x00000002L #define CRTC_GEN_CNTL__CRTC_C_SYNC_EN_MASK 0x00000010L #define CRTC_GEN_CNTL__CRTC_C_SYNC_EN 0x00000010L #define CRTC_GEN_CNTL__CRTC_PIX_WIDTH_MASK 0x00000f00L #define CRTC_GEN_CNTL__CRTC_ICON_EN_MASK 0x00008000L #define CRTC_GEN_CNTL__CRTC_ICON_EN 0x00008000L #define CRTC_GEN_CNTL__CRTC_CUR_EN_MASK 0x00010000L #define CRTC_GEN_CNTL__CRTC_CUR_EN 0x00010000L #define CRTC_GEN_CNTL__CRTC_VSTAT_MODE_MASK 0x00060000L #define CRTC_GEN_CNTL__CRTC_CUR_MODE_MASK 0x00700000L #define CRTC_GEN_CNTL__CRTC_EXT_DISP_EN_MASK 0x01000000L #define CRTC_GEN_CNTL__CRTC_EXT_DISP_EN 0x01000000L #define CRTC_GEN_CNTL__CRTC_EN_MASK 0x02000000L #define CRTC_GEN_CNTL__CRTC_EN 0x02000000L #define CRTC_GEN_CNTL__CRTC_DISP_REQ_EN_B_MASK 0x04000000L #define CRTC_GEN_CNTL__CRTC_DISP_REQ_EN_B 0x04000000L /* CRTC2_GEN_CNTL */ #define CRTC2_GEN_CNTL__CRTC2_DBL_SCAN_EN_MASK 0x00000001L #define CRTC2_GEN_CNTL__CRTC2_DBL_SCAN_EN 0x00000001L #define CRTC2_GEN_CNTL__CRTC2_INTERLACE_EN_MASK 0x00000002L #define CRTC2_GEN_CNTL__CRTC2_INTERLACE_EN 0x00000002L #define CRTC2_GEN_CNTL__CRTC2_SYNC_TRISTATE_MASK 0x00000010L #define CRTC2_GEN_CNTL__CRTC2_SYNC_TRISTATE 0x00000010L #define CRTC2_GEN_CNTL__CRTC2_HSYNC_TRISTATE_MASK 0x00000020L #define CRTC2_GEN_CNTL__CRTC2_HSYNC_TRISTATE 0x00000020L #define CRTC2_GEN_CNTL__CRTC2_VSYNC_TRISTATE_MASK 0x00000040L #define CRTC2_GEN_CNTL__CRTC2_VSYNC_TRISTATE 0x00000040L #define CRTC2_GEN_CNTL__CRT2_ON_MASK 0x00000080L #define CRTC2_GEN_CNTL__CRT2_ON 0x00000080L #define CRTC2_GEN_CNTL__CRTC2_PIX_WIDTH_MASK 0x00000f00L #define CRTC2_GEN_CNTL__CRTC2_ICON_EN_MASK 0x00008000L #define CRTC2_GEN_CNTL__CRTC2_ICON_EN 0x00008000L #define CRTC2_GEN_CNTL__CRTC2_CUR_EN_MASK 0x00010000L #define CRTC2_GEN_CNTL__CRTC2_CUR_EN 0x00010000L #define CRTC2_GEN_CNTL__CRTC2_CUR_MODE_MASK 0x00700000L #define CRTC2_GEN_CNTL__CRTC2_DISPLAY_DIS_MASK 0x00800000L #define CRTC2_GEN_CNTL__CRTC2_DISPLAY_DIS 0x00800000L #define CRTC2_GEN_CNTL__CRTC2_EN_MASK 0x02000000L #define CRTC2_GEN_CNTL__CRTC2_EN 0x02000000L #define CRTC2_GEN_CNTL__CRTC2_DISP_REQ_EN_B_MASK 0x04000000L #define CRTC2_GEN_CNTL__CRTC2_DISP_REQ_EN_B 0x04000000L #define CRTC2_GEN_CNTL__CRTC2_C_SYNC_EN_MASK 0x08000000L #define CRTC2_GEN_CNTL__CRTC2_C_SYNC_EN 0x08000000L #define CRTC2_GEN_CNTL__CRTC2_HSYNC_DIS_MASK 0x10000000L #define CRTC2_GEN_CNTL__CRTC2_HSYNC_DIS 0x10000000L #define CRTC2_GEN_CNTL__CRTC2_VSYNC_DIS_MASK 0x20000000L #define CRTC2_GEN_CNTL__CRTC2_VSYNC_DIS 0x20000000L /* AGP_CNTL */ #define AGP_CNTL__MAX_IDLE_CLK_MASK 0x000000ffL #define AGP_CNTL__HOLD_RD_FIFO_MASK 0x00000100L #define AGP_CNTL__HOLD_RD_FIFO 0x00000100L #define AGP_CNTL__HOLD_RQ_FIFO_MASK 0x00000200L #define AGP_CNTL__HOLD_RQ_FIFO 0x00000200L #define AGP_CNTL__EN_2X_STBB_MASK 0x00000400L #define AGP_CNTL__EN_2X_STBB 0x00000400L #define AGP_CNTL__FORCE_FULL_SBA_MASK 0x00000800L #define AGP_CNTL__FORCE_FULL_SBA 0x00000800L #define AGP_CNTL__SBA_DIS_MASK 0x00001000L #define AGP_CNTL__SBA_DIS 0x00001000L #define AGP_CNTL__AGP_REV_ID_MASK 0x00002000L #define AGP_CNTL__AGP_REV_ID 0x00002000L #define AGP_CNTL__REG_CRIPPLE_AGP4X_MASK 0x00004000L #define AGP_CNTL__REG_CRIPPLE_AGP4X 0x00004000L #define AGP_CNTL__REG_CRIPPLE_AGP2X4X_MASK 0x00008000L #define AGP_CNTL__REG_CRIPPLE_AGP2X4X 0x00008000L #define AGP_CNTL__FORCE_INT_VREF_MASK 0x00010000L #define AGP_CNTL__FORCE_INT_VREF 0x00010000L #define AGP_CNTL__PENDING_SLOTS_VAL_MASK 0x00060000L #define AGP_CNTL__PENDING_SLOTS_SEL_MASK 0x00080000L #define AGP_CNTL__PENDING_SLOTS_SEL 0x00080000L #define AGP_CNTL__EN_EXTENDED_AD_STB_2X_MASK 0x00100000L #define AGP_CNTL__EN_EXTENDED_AD_STB_2X 0x00100000L #define AGP_CNTL__DIS_QUEUED_GNT_FIX_MASK 0x00200000L #define AGP_CNTL__DIS_QUEUED_GNT_FIX 0x00200000L #define AGP_CNTL__EN_RDATA2X4X_MULTIRESET_MASK 0x00400000L #define AGP_CNTL__EN_RDATA2X4X_MULTIRESET 0x00400000L #define AGP_CNTL__EN_RBFCALM_MASK 0x00800000L #define AGP_CNTL__EN_RBFCALM 0x00800000L #define AGP_CNTL__FORCE_EXT_VREF_MASK 0x01000000L #define AGP_CNTL__FORCE_EXT_VREF 0x01000000L #define AGP_CNTL__DIS_RBF_MASK 0x02000000L #define AGP_CNTL__DIS_RBF 0x02000000L #define AGP_CNTL__DELAY_FIRST_SBA_EN_MASK 0x04000000L #define AGP_CNTL__DELAY_FIRST_SBA_EN 0x04000000L #define AGP_CNTL__DELAY_FIRST_SBA_VAL_MASK 0x38000000L #define AGP_CNTL__AGP_MISC_MASK 0xc0000000L /* AGP_CNTL */ #define AGP_CNTL__MAX_IDLE_CLK__SHIFT 0x00000000 #define AGP_CNTL__HOLD_RD_FIFO__SHIFT 0x00000008 #define AGP_CNTL__HOLD_RQ_FIFO__SHIFT 0x00000009 #define AGP_CNTL__EN_2X_STBB__SHIFT 0x0000000a #define AGP_CNTL__FORCE_FULL_SBA__SHIFT 0x0000000b #define AGP_CNTL__SBA_DIS__SHIFT 0x0000000c #define AGP_CNTL__AGP_REV_ID__SHIFT 0x0000000d #define AGP_CNTL__REG_CRIPPLE_AGP4X__SHIFT 0x0000000e #define AGP_CNTL__REG_CRIPPLE_AGP2X4X__SHIFT 0x0000000f #define AGP_CNTL__FORCE_INT_VREF__SHIFT 0x00000010 #define AGP_CNTL__PENDING_SLOTS_VAL__SHIFT 0x00000011 #define AGP_CNTL__PENDING_SLOTS_SEL__SHIFT 0x00000013 #define AGP_CNTL__EN_EXTENDED_AD_STB_2X__SHIFT 0x00000014 #define AGP_CNTL__DIS_QUEUED_GNT_FIX__SHIFT 0x00000015 #define AGP_CNTL__EN_RDATA2X4X_MULTIRESET__SHIFT 0x00000016 #define AGP_CNTL__EN_RBFCALM__SHIFT 0x00000017 #define AGP_CNTL__FORCE_EXT_VREF__SHIFT 0x00000018 #define AGP_CNTL__DIS_RBF__SHIFT 0x00000019 #define AGP_CNTL__DELAY_FIRST_SBA_EN__SHIFT 0x0000001a #define AGP_CNTL__DELAY_FIRST_SBA_VAL__SHIFT 0x0000001b #define AGP_CNTL__AGP_MISC__SHIFT 0x0000001e /* DISP_MISC_CNTL */ #define DISP_MISC_CNTL__SOFT_RESET_GRPH_PP_MASK 0x00000001L #define DISP_MISC_CNTL__SOFT_RESET_GRPH_PP 0x00000001L #define DISP_MISC_CNTL__SOFT_RESET_SUBPIC_PP_MASK 0x00000002L #define DISP_MISC_CNTL__SOFT_RESET_SUBPIC_PP 0x00000002L #define DISP_MISC_CNTL__SOFT_RESET_OV0_PP_MASK 0x00000004L #define DISP_MISC_CNTL__SOFT_RESET_OV0_PP 0x00000004L #define DISP_MISC_CNTL__SOFT_RESET_GRPH_SCLK_MASK 0x00000010L #define DISP_MISC_CNTL__SOFT_RESET_GRPH_SCLK 0x00000010L #define DISP_MISC_CNTL__SOFT_RESET_SUBPIC_SCLK_MASK 0x00000020L #define DISP_MISC_CNTL__SOFT_RESET_SUBPIC_SCLK 0x00000020L #define DISP_MISC_CNTL__SOFT_RESET_OV0_SCLK_MASK 0x00000040L #define DISP_MISC_CNTL__SOFT_RESET_OV0_SCLK 0x00000040L #define DISP_MISC_CNTL__SYNC_STRENGTH_MASK 0x00000300L #define DISP_MISC_CNTL__SYNC_PAD_FLOP_EN_MASK 0x00000400L #define DISP_MISC_CNTL__SYNC_PAD_FLOP_EN 0x00000400L #define DISP_MISC_CNTL__SOFT_RESET_GRPH2_PP_MASK 0x00001000L #define DISP_MISC_CNTL__SOFT_RESET_GRPH2_PP 0x00001000L #define DISP_MISC_CNTL__SOFT_RESET_GRPH2_SCLK_MASK 0x00008000L #define DISP_MISC_CNTL__SOFT_RESET_GRPH2_SCLK 0x00008000L #define DISP_MISC_CNTL__SOFT_RESET_LVDS_MASK 0x00010000L #define DISP_MISC_CNTL__SOFT_RESET_LVDS 0x00010000L #define DISP_MISC_CNTL__SOFT_RESET_TMDS_MASK 0x00020000L #define DISP_MISC_CNTL__SOFT_RESET_TMDS 0x00020000L #define DISP_MISC_CNTL__SOFT_RESET_DIG_TMDS_MASK 0x00040000L #define DISP_MISC_CNTL__SOFT_RESET_DIG_TMDS 0x00040000L #define DISP_MISC_CNTL__SOFT_RESET_TV_MASK 0x00080000L #define DISP_MISC_CNTL__SOFT_RESET_TV 0x00080000L #define DISP_MISC_CNTL__PALETTE2_MEM_RD_MARGIN_MASK 0x00f00000L #define DISP_MISC_CNTL__PALETTE_MEM_RD_MARGIN_MASK 0x0f000000L #define DISP_MISC_CNTL__RMX_BUF_MEM_RD_MARGIN_MASK 0xf0000000L /* DISP_PWR_MAN */ #define DISP_PWR_MAN__DISP_PWR_MAN_D3_CRTC_EN_MASK 0x00000001L #define DISP_PWR_MAN__DISP_PWR_MAN_D3_CRTC_EN 0x00000001L #define DISP_PWR_MAN__DISP2_PWR_MAN_D3_CRTC2_EN_MASK 0x00000010L #define DISP_PWR_MAN__DISP2_PWR_MAN_D3_CRTC2_EN 0x00000010L #define DISP_PWR_MAN__DISP_PWR_MAN_DPMS_MASK 0x00000300L #define DISP_PWR_MAN__DISP_D3_RST_MASK 0x00010000L #define DISP_PWR_MAN__DISP_D3_RST 0x00010000L #define DISP_PWR_MAN__DISP_D3_REG_RST_MASK 0x00020000L #define DISP_PWR_MAN__DISP_D3_REG_RST 0x00020000L #define DISP_PWR_MAN__DISP_D3_GRPH_RST_MASK 0x00040000L #define DISP_PWR_MAN__DISP_D3_GRPH_RST 0x00040000L #define DISP_PWR_MAN__DISP_D3_SUBPIC_RST_MASK 0x00080000L #define DISP_PWR_MAN__DISP_D3_SUBPIC_RST 0x00080000L #define DISP_PWR_MAN__DISP_D3_OV0_RST_MASK 0x00100000L #define DISP_PWR_MAN__DISP_D3_OV0_RST 0x00100000L #define DISP_PWR_MAN__DISP_D1D2_GRPH_RST_MASK 0x00200000L #define DISP_PWR_MAN__DISP_D1D2_GRPH_RST 0x00200000L #define DISP_PWR_MAN__DISP_D1D2_SUBPIC_RST_MASK 0x00400000L #define DISP_PWR_MAN__DISP_D1D2_SUBPIC_RST 0x00400000L #define DISP_PWR_MAN__DISP_D1D2_OV0_RST_MASK 0x00800000L #define DISP_PWR_MAN__DISP_D1D2_OV0_RST 0x00800000L #define DISP_PWR_MAN__DIG_TMDS_ENABLE_RST_MASK 0x01000000L #define DISP_PWR_MAN__DIG_TMDS_ENABLE_RST 0x01000000L #define DISP_PWR_MAN__TV_ENABLE_RST_MASK 0x02000000L #define DISP_PWR_MAN__TV_ENABLE_RST 0x02000000L #define DISP_PWR_MAN__AUTO_PWRUP_EN_MASK 0x04000000L #define DISP_PWR_MAN__AUTO_PWRUP_EN 0x04000000L /* MC_IND_INDEX */ #define MC_IND_INDEX__MC_IND_ADDR_MASK 0x0000001fL #define MC_IND_INDEX__MC_IND_WR_EN_MASK 0x00000100L #define MC_IND_INDEX__MC_IND_WR_EN 0x00000100L /* MC_IND_DATA */ #define MC_IND_DATA__MC_IND_DATA_MASK 0xffffffffL /* MC_CHP_IO_CNTL_A1 */ #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_CKA__SHIFT 0x00000000 #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_AA__SHIFT 0x00000001 #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_DQMA__SHIFT 0x00000002 #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_DQSA__SHIFT 0x00000003 #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_CKA__SHIFT 0x00000004 #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_AA__SHIFT 0x00000005 #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_DQMA__SHIFT 0x00000006 #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_DQSA__SHIFT 0x00000007 #define MC_CHP_IO_CNTL_A1__MEM_PREAMP_AA__SHIFT 0x00000008 #define MC_CHP_IO_CNTL_A1__MEM_PREAMP_DQMA__SHIFT 0x00000009 #define MC_CHP_IO_CNTL_A1__MEM_PREAMP_DQSA__SHIFT 0x0000000a #define MC_CHP_IO_CNTL_A1__MEM_IO_MODEA__SHIFT 0x0000000c #define MC_CHP_IO_CNTL_A1__MEM_REC_CKA__SHIFT 0x0000000e #define MC_CHP_IO_CNTL_A1__MEM_REC_AA__SHIFT 0x00000010 #define MC_CHP_IO_CNTL_A1__MEM_REC_DQMA__SHIFT 0x00000012 #define MC_CHP_IO_CNTL_A1__MEM_REC_DQSA__SHIFT 0x00000014 #define MC_CHP_IO_CNTL_A1__MEM_SYNC_PHASEA__SHIFT 0x00000016 #define MC_CHP_IO_CNTL_A1__MEM_SYNC_CENTERA__SHIFT 0x00000017 #define MC_CHP_IO_CNTL_A1__MEM_SYNC_ENA__SHIFT 0x00000018 #define MC_CHP_IO_CNTL_A1__MEM_CLK_SELA__SHIFT 0x0000001a #define MC_CHP_IO_CNTL_A1__MEM_CLK_INVA__SHIFT 0x0000001c #define MC_CHP_IO_CNTL_A1__MEM_DATA_ENIMP_A__SHIFT 0x0000001e #define MC_CHP_IO_CNTL_A1__MEM_CNTL_ENIMP_A__SHIFT 0x0000001f /* MC_CHP_IO_CNTL_B1 */ #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_CKB__SHIFT 0x00000000 #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_AB__SHIFT 0x00000001 #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_DQMB__SHIFT 0x00000002 #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_DQSB__SHIFT 0x00000003 #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_CKB__SHIFT 0x00000004 #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_AB__SHIFT 0x00000005 #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_DQMB__SHIFT 0x00000006 #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_DQSB__SHIFT 0x00000007 #define MC_CHP_IO_CNTL_B1__MEM_PREAMP_AB__SHIFT 0x00000008 #define MC_CHP_IO_CNTL_B1__MEM_PREAMP_DQMB__SHIFT 0x00000009 #define MC_CHP_IO_CNTL_B1__MEM_PREAMP_DQSB__SHIFT 0x0000000a #define MC_CHP_IO_CNTL_B1__MEM_IO_MODEB__SHIFT 0x0000000c #define MC_CHP_IO_CNTL_B1__MEM_REC_CKB__SHIFT 0x0000000e #define MC_CHP_IO_CNTL_B1__MEM_REC_AB__SHIFT 0x00000010 #define MC_CHP_IO_CNTL_B1__MEM_REC_DQMB__SHIFT 0x00000012 #define MC_CHP_IO_CNTL_B1__MEM_REC_DQSB__SHIFT 0x00000014 #define MC_CHP_IO_CNTL_B1__MEM_SYNC_PHASEB__SHIFT 0x00000016 #define MC_CHP_IO_CNTL_B1__MEM_SYNC_CENTERB__SHIFT 0x00000017 #define MC_CHP_IO_CNTL_B1__MEM_SYNC_ENB__SHIFT 0x00000018 #define MC_CHP_IO_CNTL_B1__MEM_CLK_SELB__SHIFT 0x0000001a #define MC_CHP_IO_CNTL_B1__MEM_CLK_INVB__SHIFT 0x0000001c #define MC_CHP_IO_CNTL_B1__MEM_DATA_ENIMP_B__SHIFT 0x0000001e #define MC_CHP_IO_CNTL_B1__MEM_CNTL_ENIMP_B__SHIFT 0x0000001f /* MC_CHP_IO_CNTL_A1 */ #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_CKA_MASK 0x00000001L #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_CKA 0x00000001L #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_AA_MASK 0x00000002L #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_AA 0x00000002L #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_DQMA_MASK 0x00000004L #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_DQMA 0x00000004L #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_DQSA_MASK 0x00000008L #define MC_CHP_IO_CNTL_A1__MEM_SLEWN_DQSA 0x00000008L #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_CKA_MASK 0x00000010L #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_CKA 0x00000010L #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_AA_MASK 0x00000020L #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_AA 0x00000020L #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_DQMA_MASK 0x00000040L #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_DQMA 0x00000040L #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_DQSA_MASK 0x00000080L #define MC_CHP_IO_CNTL_A1__MEM_SLEWP_DQSA 0x00000080L #define MC_CHP_IO_CNTL_A1__MEM_PREAMP_AA_MASK 0x00000100L #define MC_CHP_IO_CNTL_A1__MEM_PREAMP_AA 0x00000100L #define MC_CHP_IO_CNTL_A1__MEM_PREAMP_DQMA_MASK 0x00000200L #define MC_CHP_IO_CNTL_A1__MEM_PREAMP_DQMA 0x00000200L #define MC_CHP_IO_CNTL_A1__MEM_PREAMP_DQSA_MASK 0x00000400L #define MC_CHP_IO_CNTL_A1__MEM_PREAMP_DQSA 0x00000400L #define MC_CHP_IO_CNTL_A1__MEM_IO_MODEA_MASK 0x00003000L #define MC_CHP_IO_CNTL_A1__MEM_REC_CKA_MASK 0x0000c000L #define MC_CHP_IO_CNTL_A1__MEM_REC_AA_MASK 0x00030000L #define MC_CHP_IO_CNTL_A1__MEM_REC_DQMA_MASK 0x000c0000L #define MC_CHP_IO_CNTL_A1__MEM_REC_DQSA_MASK 0x00300000L #define MC_CHP_IO_CNTL_A1__MEM_SYNC_PHASEA_MASK 0x00400000L #define MC_CHP_IO_CNTL_A1__MEM_SYNC_PHASEA 0x00400000L #define MC_CHP_IO_CNTL_A1__MEM_SYNC_CENTERA_MASK 0x00800000L #define MC_CHP_IO_CNTL_A1__MEM_SYNC_CENTERA 0x00800000L #define MC_CHP_IO_CNTL_A1__MEM_SYNC_ENA_MASK 0x03000000L #define MC_CHP_IO_CNTL_A1__MEM_CLK_SELA_MASK 0x0c000000L #define MC_CHP_IO_CNTL_A1__MEM_CLK_INVA_MASK 0x10000000L #define MC_CHP_IO_CNTL_A1__MEM_CLK_INVA 0x10000000L #define MC_CHP_IO_CNTL_A1__MEM_DATA_ENIMP_A_MASK 0x40000000L #define MC_CHP_IO_CNTL_A1__MEM_DATA_ENIMP_A 0x40000000L #define MC_CHP_IO_CNTL_A1__MEM_CNTL_ENIMP_A_MASK 0x80000000L #define MC_CHP_IO_CNTL_A1__MEM_CNTL_ENIMP_A 0x80000000L /* MC_CHP_IO_CNTL_B1 */ #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_CKB_MASK 0x00000001L #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_CKB 0x00000001L #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_AB_MASK 0x00000002L #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_AB 0x00000002L #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_DQMB_MASK 0x00000004L #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_DQMB 0x00000004L #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_DQSB_MASK 0x00000008L #define MC_CHP_IO_CNTL_B1__MEM_SLEWN_DQSB 0x00000008L #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_CKB_MASK 0x00000010L #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_CKB 0x00000010L #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_AB_MASK 0x00000020L #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_AB 0x00000020L #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_DQMB_MASK 0x00000040L #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_DQMB 0x00000040L #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_DQSB_MASK 0x00000080L #define MC_CHP_IO_CNTL_B1__MEM_SLEWP_DQSB 0x00000080L #define MC_CHP_IO_CNTL_B1__MEM_PREAMP_AB_MASK 0x00000100L #define MC_CHP_IO_CNTL_B1__MEM_PREAMP_AB 0x00000100L #define MC_CHP_IO_CNTL_B1__MEM_PREAMP_DQMB_MASK 0x00000200L #define MC_CHP_IO_CNTL_B1__MEM_PREAMP_DQMB 0x00000200L #define MC_CHP_IO_CNTL_B1__MEM_PREAMP_DQSB_MASK 0x00000400L #define MC_CHP_IO_CNTL_B1__MEM_PREAMP_DQSB 0x00000400L #define MC_CHP_IO_CNTL_B1__MEM_IO_MODEB_MASK 0x00003000L #define MC_CHP_IO_CNTL_B1__MEM_REC_CKB_MASK 0x0000c000L #define MC_CHP_IO_CNTL_B1__MEM_REC_AB_MASK 0x00030000L #define MC_CHP_IO_CNTL_B1__MEM_REC_DQMB_MASK 0x000c0000L #define MC_CHP_IO_CNTL_B1__MEM_REC_DQSB_MASK 0x00300000L #define MC_CHP_IO_CNTL_B1__MEM_SYNC_PHASEB_MASK 0x00400000L #define MC_CHP_IO_CNTL_B1__MEM_SYNC_PHASEB 0x00400000L #define MC_CHP_IO_CNTL_B1__MEM_SYNC_CENTERB_MASK 0x00800000L #define MC_CHP_IO_CNTL_B1__MEM_SYNC_CENTERB 0x00800000L #define MC_CHP_IO_CNTL_B1__MEM_SYNC_ENB_MASK 0x03000000L #define MC_CHP_IO_CNTL_B1__MEM_CLK_SELB_MASK 0x0c000000L #define MC_CHP_IO_CNTL_B1__MEM_CLK_INVB_MASK 0x10000000L #define MC_CHP_IO_CNTL_B1__MEM_CLK_INVB 0x10000000L #define MC_CHP_IO_CNTL_B1__MEM_DATA_ENIMP_B_MASK 0x40000000L #define MC_CHP_IO_CNTL_B1__MEM_DATA_ENIMP_B 0x40000000L #define MC_CHP_IO_CNTL_B1__MEM_CNTL_ENIMP_B_MASK 0x80000000L #define MC_CHP_IO_CNTL_B1__MEM_CNTL_ENIMP_B 0x80000000L /* MEM_SDRAM_MODE_REG */ #define MEM_SDRAM_MODE_REG__MEM_MODE_REG_MASK 0x00007fffL #define MEM_SDRAM_MODE_REG__MEM_WR_LATENCY_MASK 0x000f0000L #define MEM_SDRAM_MODE_REG__MEM_CAS_LATENCY_MASK 0x00700000L #define MEM_SDRAM_MODE_REG__MEM_CMD_LATENCY_MASK 0x00800000L #define MEM_SDRAM_MODE_REG__MEM_CMD_LATENCY 0x00800000L #define MEM_SDRAM_MODE_REG__MEM_STR_LATENCY_MASK 0x01000000L #define MEM_SDRAM_MODE_REG__MEM_STR_LATENCY 0x01000000L #define MEM_SDRAM_MODE_REG__MEM_FALL_OUT_CMD_MASK 0x02000000L #define MEM_SDRAM_MODE_REG__MEM_FALL_OUT_CMD 0x02000000L #define MEM_SDRAM_MODE_REG__MEM_FALL_OUT_DATA_MASK 0x04000000L #define MEM_SDRAM_MODE_REG__MEM_FALL_OUT_DATA 0x04000000L #define MEM_SDRAM_MODE_REG__MEM_FALL_OUT_STR_MASK 0x08000000L #define MEM_SDRAM_MODE_REG__MEM_FALL_OUT_STR 0x08000000L #define MEM_SDRAM_MODE_REG__MC_INIT_COMPLETE_MASK 0x10000000L #define MEM_SDRAM_MODE_REG__MC_INIT_COMPLETE 0x10000000L #define MEM_SDRAM_MODE_REG__MEM_DDR_DLL_MASK 0x20000000L #define MEM_SDRAM_MODE_REG__MEM_DDR_DLL 0x20000000L #define MEM_SDRAM_MODE_REG__MEM_CFG_TYPE_MASK 0x40000000L #define MEM_SDRAM_MODE_REG__MEM_CFG_TYPE 0x40000000L #define MEM_SDRAM_MODE_REG__MEM_SDRAM_RESET_MASK 0x80000000L #define MEM_SDRAM_MODE_REG__MEM_SDRAM_RESET 0x80000000L /* MEM_SDRAM_MODE_REG */ #define MEM_SDRAM_MODE_REG__MEM_MODE_REG__SHIFT 0x00000000 #define MEM_SDRAM_MODE_REG__MEM_WR_LATENCY__SHIFT 0x00000010 #define MEM_SDRAM_MODE_REG__MEM_CAS_LATENCY__SHIFT 0x00000014 #define MEM_SDRAM_MODE_REG__MEM_CMD_LATENCY__SHIFT 0x00000017 #define MEM_SDRAM_MODE_REG__MEM_STR_LATENCY__SHIFT 0x00000018 #define MEM_SDRAM_MODE_REG__MEM_FALL_OUT_CMD__SHIFT 0x00000019 #define MEM_SDRAM_MODE_REG__MEM_FALL_OUT_DATA__SHIFT 0x0000001a #define MEM_SDRAM_MODE_REG__MEM_FALL_OUT_STR__SHIFT 0x0000001b #define MEM_SDRAM_MODE_REG__MC_INIT_COMPLETE__SHIFT 0x0000001c #define MEM_SDRAM_MODE_REG__MEM_DDR_DLL__SHIFT 0x0000001d #define MEM_SDRAM_MODE_REG__MEM_CFG_TYPE__SHIFT 0x0000001e #define MEM_SDRAM_MODE_REG__MEM_SDRAM_RESET__SHIFT 0x0000001f /* MEM_REFRESH_CNTL */ #define MEM_REFRESH_CNTL__MEM_REFRESH_RATE_MASK 0x000000ffL #define MEM_REFRESH_CNTL__MEM_REFRESH_DIS_MASK 0x00000100L #define MEM_REFRESH_CNTL__MEM_REFRESH_DIS 0x00000100L #define MEM_REFRESH_CNTL__MEM_DYNAMIC_CKE_MASK 0x00000200L #define MEM_REFRESH_CNTL__MEM_DYNAMIC_CKE 0x00000200L #define MEM_REFRESH_CNTL__MEM_TRFC_MASK 0x0000f000L #define MEM_REFRESH_CNTL__MEM_CLKA0_ENABLE_MASK 0x00010000L #define MEM_REFRESH_CNTL__MEM_CLKA0_ENABLE 0x00010000L #define MEM_REFRESH_CNTL__MEM_CLKA0b_ENABLE_MASK 0x00020000L #define MEM_REFRESH_CNTL__MEM_CLKA0b_ENABLE 0x00020000L #define MEM_REFRESH_CNTL__MEM_CLKA1_ENABLE_MASK 0x00040000L #define MEM_REFRESH_CNTL__MEM_CLKA1_ENABLE 0x00040000L #define MEM_REFRESH_CNTL__MEM_CLKA1b_ENABLE_MASK 0x00080000L #define MEM_REFRESH_CNTL__MEM_CLKA1b_ENABLE 0x00080000L #define MEM_REFRESH_CNTL__MEM_CLKAFB_ENABLE_MASK 0x00100000L #define MEM_REFRESH_CNTL__MEM_CLKAFB_ENABLE 0x00100000L #define MEM_REFRESH_CNTL__DLL_FB_SLCT_CKA_MASK 0x00c00000L #define MEM_REFRESH_CNTL__MEM_CLKB0_ENABLE_MASK 0x01000000L #define MEM_REFRESH_CNTL__MEM_CLKB0_ENABLE 0x01000000L #define MEM_REFRESH_CNTL__MEM_CLKB0b_ENABLE_MASK 0x02000000L #define MEM_REFRESH_CNTL__MEM_CLKB0b_ENABLE 0x02000000L #define MEM_REFRESH_CNTL__MEM_CLKB1_ENABLE_MASK 0x04000000L #define MEM_REFRESH_CNTL__MEM_CLKB1_ENABLE 0x04000000L #define MEM_REFRESH_CNTL__MEM_CLKB1b_ENABLE_MASK 0x08000000L #define MEM_REFRESH_CNTL__MEM_CLKB1b_ENABLE 0x08000000L #define MEM_REFRESH_CNTL__MEM_CLKBFB_ENABLE_MASK 0x10000000L #define MEM_REFRESH_CNTL__MEM_CLKBFB_ENABLE 0x10000000L #define MEM_REFRESH_CNTL__DLL_FB_SLCT_CKB_MASK 0xc0000000L /* MC_STATUS */ #define MC_STATUS__MEM_PWRUP_COMPL_A_MASK 0x00000001L #define MC_STATUS__MEM_PWRUP_COMPL_A 0x00000001L #define MC_STATUS__MEM_PWRUP_COMPL_B_MASK 0x00000002L #define MC_STATUS__MEM_PWRUP_COMPL_B 0x00000002L #define MC_STATUS__MC_IDLE_MASK 0x00000004L #define MC_STATUS__MC_IDLE 0x00000004L #define MC_STATUS__IMP_N_VALUE_R_BACK_MASK 0x00000078L #define MC_STATUS__IMP_P_VALUE_R_BACK_MASK 0x00000780L #define MC_STATUS__TEST_OUT_R_BACK_MASK 0x00000800L #define MC_STATUS__TEST_OUT_R_BACK 0x00000800L #define MC_STATUS__DUMMY_OUT_R_BACK_MASK 0x00001000L #define MC_STATUS__DUMMY_OUT_R_BACK 0x00001000L #define MC_STATUS__IMP_N_VALUE_A_R_BACK_MASK 0x0001e000L #define MC_STATUS__IMP_P_VALUE_A_R_BACK_MASK 0x001e0000L #define MC_STATUS__IMP_N_VALUE_CK_R_BACK_MASK 0x01e00000L #define MC_STATUS__IMP_P_VALUE_CK_R_BACK_MASK 0x1e000000L /* MDLL_CKO */ #define MDLL_CKO__MCKOA_SLEEP_MASK 0x00000001L #define MDLL_CKO__MCKOA_SLEEP 0x00000001L #define MDLL_CKO__MCKOA_RESET_MASK 0x00000002L #define MDLL_CKO__MCKOA_RESET 0x00000002L #define MDLL_CKO__MCKOA_RANGE_MASK 0x0000000cL #define MDLL_CKO__ERSTA_SOUTSEL_MASK 0x00000030L #define MDLL_CKO__MCKOA_FB_SEL_MASK 0x000000c0L #define MDLL_CKO__MCKOA_REF_SKEW_MASK 0x00000700L #define MDLL_CKO__MCKOA_FB_SKEW_MASK 0x00007000L #define MDLL_CKO__MCKOA_BP_SEL_MASK 0x00008000L #define MDLL_CKO__MCKOA_BP_SEL 0x00008000L #define MDLL_CKO__MCKOB_SLEEP_MASK 0x00010000L #define MDLL_CKO__MCKOB_SLEEP 0x00010000L #define MDLL_CKO__MCKOB_RESET_MASK 0x00020000L #define MDLL_CKO__MCKOB_RESET 0x00020000L #define MDLL_CKO__MCKOB_RANGE_MASK 0x000c0000L #define MDLL_CKO__ERSTB_SOUTSEL_MASK 0x00300000L #define MDLL_CKO__MCKOB_FB_SEL_MASK 0x00c00000L #define MDLL_CKO__MCKOB_REF_SKEW_MASK 0x07000000L #define MDLL_CKO__MCKOB_FB_SKEW_MASK 0x70000000L #define MDLL_CKO__MCKOB_BP_SEL_MASK 0x80000000L #define MDLL_CKO__MCKOB_BP_SEL 0x80000000L /* MDLL_RDCKA */ #define MDLL_RDCKA__MRDCKA0_SLEEP_MASK 0x00000001L #define MDLL_RDCKA__MRDCKA0_SLEEP 0x00000001L #define MDLL_RDCKA__MRDCKA0_RESET_MASK 0x00000002L #define MDLL_RDCKA__MRDCKA0_RESET 0x00000002L #define MDLL_RDCKA__MRDCKA0_RANGE_MASK 0x0000000cL #define MDLL_RDCKA__MRDCKA0_REF_SEL_MASK 0x00000030L #define MDLL_RDCKA__MRDCKA0_FB_SEL_MASK 0x000000c0L #define MDLL_RDCKA__MRDCKA0_REF_SKEW_MASK 0x00000700L #define MDLL_RDCKA__MRDCKA0_SINSEL_MASK 0x00000800L #define MDLL_RDCKA__MRDCKA0_SINSEL 0x00000800L #define MDLL_RDCKA__MRDCKA0_FB_SKEW_MASK 0x00007000L #define MDLL_RDCKA__MRDCKA0_BP_SEL_MASK 0x00008000L #define MDLL_RDCKA__MRDCKA0_BP_SEL 0x00008000L #define MDLL_RDCKA__MRDCKA1_SLEEP_MASK 0x00010000L #define MDLL_RDCKA__MRDCKA1_SLEEP 0x00010000L #define MDLL_RDCKA__MRDCKA1_RESET_MASK 0x00020000L #define MDLL_RDCKA__MRDCKA1_RESET 0x00020000L #define MDLL_RDCKA__MRDCKA1_RANGE_MASK 0x000c0000L #define MDLL_RDCKA__MRDCKA1_REF_SEL_MASK 0x00300000L #define MDLL_RDCKA__MRDCKA1_FB_SEL_MASK 0x00c00000L #define MDLL_RDCKA__MRDCKA1_REF_SKEW_MASK 0x07000000L #define MDLL_RDCKA__MRDCKA1_SINSEL_MASK 0x08000000L #define MDLL_RDCKA__MRDCKA1_SINSEL 0x08000000L #define MDLL_RDCKA__MRDCKA1_FB_SKEW_MASK 0x70000000L #define MDLL_RDCKA__MRDCKA1_BP_SEL_MASK 0x80000000L #define MDLL_RDCKA__MRDCKA1_BP_SEL 0x80000000L /* MDLL_RDCKB */ #define MDLL_RDCKB__MRDCKB0_SLEEP_MASK 0x00000001L #define MDLL_RDCKB__MRDCKB0_SLEEP 0x00000001L #define MDLL_RDCKB__MRDCKB0_RESET_MASK 0x00000002L #define MDLL_RDCKB__MRDCKB0_RESET 0x00000002L #define MDLL_RDCKB__MRDCKB0_RANGE_MASK 0x0000000cL #define MDLL_RDCKB__MRDCKB0_REF_SEL_MASK 0x00000030L #define MDLL_RDCKB__MRDCKB0_FB_SEL_MASK 0x000000c0L #define MDLL_RDCKB__MRDCKB0_REF_SKEW_MASK 0x00000700L #define MDLL_RDCKB__MRDCKB0_SINSEL_MASK 0x00000800L #define MDLL_RDCKB__MRDCKB0_SINSEL 0x00000800L #define MDLL_RDCKB__MRDCKB0_FB_SKEW_MASK 0x00007000L #define MDLL_RDCKB__MRDCKB0_BP_SEL_MASK 0x00008000L #define MDLL_RDCKB__MRDCKB0_BP_SEL 0x00008000L #define MDLL_RDCKB__MRDCKB1_SLEEP_MASK 0x00010000L #define MDLL_RDCKB__MRDCKB1_SLEEP 0x00010000L #define MDLL_RDCKB__MRDCKB1_RESET_MASK 0x00020000L #define MDLL_RDCKB__MRDCKB1_RESET 0x00020000L #define MDLL_RDCKB__MRDCKB1_RANGE_MASK 0x000c0000L #define MDLL_RDCKB__MRDCKB1_REF_SEL_MASK 0x00300000L #define MDLL_RDCKB__MRDCKB1_FB_SEL_MASK 0x00c00000L #define MDLL_RDCKB__MRDCKB1_REF_SKEW_MASK 0x07000000L #define MDLL_RDCKB__MRDCKB1_SINSEL_MASK 0x08000000L #define MDLL_RDCKB__MRDCKB1_SINSEL 0x08000000L #define MDLL_RDCKB__MRDCKB1_FB_SKEW_MASK 0x70000000L #define MDLL_RDCKB__MRDCKB1_BP_SEL_MASK 0x80000000L #define MDLL_RDCKB__MRDCKB1_BP_SEL 0x80000000L #define MDLL_R300_RDCK__MRDCKA_SLEEP 0x00000001L #define MDLL_R300_RDCK__MRDCKA_RESET 0x00000002L #define MDLL_R300_RDCK__MRDCKB_SLEEP 0x00000004L #define MDLL_R300_RDCK__MRDCKB_RESET 0x00000008L #define MDLL_R300_RDCK__MRDCKC_SLEEP 0x00000010L #define MDLL_R300_RDCK__MRDCKC_RESET 0x00000020L #define MDLL_R300_RDCK__MRDCKD_SLEEP 0x00000040L #define MDLL_R300_RDCK__MRDCKD_RESET 0x00000080L #define pllCLK_PIN_CNTL 0x0001 #define pllPPLL_CNTL 0x0002 #define pllPPLL_REF_DIV 0x0003 #define pllPPLL_DIV_0 0x0004 #define pllPPLL_DIV_1 0x0005 #define pllPPLL_DIV_2 0x0006 #define pllPPLL_DIV_3 0x0007 #define pllVCLK_ECP_CNTL 0x0008 #define pllHTOTAL_CNTL 0x0009 #define pllM_SPLL_REF_FB_DIV 0x000A #define pllAGP_PLL_CNTL 0x000B #define pllSPLL_CNTL 0x000C #define pllSCLK_CNTL 0x000D #define pllMPLL_CNTL 0x000E #define pllMDLL_CKO 0x000F #define pllMDLL_RDCKA 0x0010 #define pllMDLL_RDCKB 0x0011 #define pllMCLK_CNTL 0x0012 #define pllPLL_TEST_CNTL 0x0013 #define pllCLK_PWRMGT_CNTL 0x0014 #define pllPLL_PWRMGT_CNTL 0x0015 #define pllCG_TEST_MACRO_RW_WRITE 0x0016 #define pllCG_TEST_MACRO_RW_READ 0x0017 #define pllCG_TEST_MACRO_RW_DATA 0x0018 #define pllCG_TEST_MACRO_RW_CNTL 0x0019 #define pllDISP_TEST_MACRO_RW_WRITE 0x001A #define pllDISP_TEST_MACRO_RW_READ 0x001B #define pllDISP_TEST_MACRO_RW_DATA 0x001C #define pllDISP_TEST_MACRO_RW_CNTL 0x001D #define pllSCLK_CNTL2 0x001E #define pllMCLK_MISC 0x001F #define pllTV_PLL_FINE_CNTL 0x0020 #define pllTV_PLL_CNTL 0x0021 #define pllTV_PLL_CNTL1 0x0022 #define pllTV_DTO_INCREMENTS 0x0023 #define pllSPLL_AUX_CNTL 0x0024 #define pllMPLL_AUX_CNTL 0x0025 #define pllP2PLL_CNTL 0x002A #define pllP2PLL_REF_DIV 0x002B #define pllP2PLL_DIV_0 0x002C #define pllPIXCLKS_CNTL 0x002D #define pllHTOTAL2_CNTL 0x002E #define pllSSPLL_CNTL 0x0030 #define pllSSPLL_REF_DIV 0x0031 #define pllSSPLL_DIV_0 0x0032 #define pllSS_INT_CNTL 0x0033 #define pllSS_TST_CNTL 0x0034 #define pllSCLK_MORE_CNTL 0x0035 #define ixMC_PERF_CNTL 0x0000 #define ixMC_PERF_SEL 0x0001 #define ixMC_PERF_REGION_0 0x0002 #define ixMC_PERF_REGION_1 0x0003 #define ixMC_PERF_COUNT_0 0x0004 #define ixMC_PERF_COUNT_1 0x0005 #define ixMC_PERF_COUNT_2 0x0006 #define ixMC_PERF_COUNT_3 0x0007 #define ixMC_PERF_COUNT_MEMCH_A 0x0008 #define ixMC_PERF_COUNT_MEMCH_B 0x0009 #define ixMC_IMP_CNTL 0x000A #define ixMC_CHP_IO_CNTL_A0 0x000B #define ixMC_CHP_IO_CNTL_A1 0x000C #define ixMC_CHP_IO_CNTL_B0 0x000D #define ixMC_CHP_IO_CNTL_B1 0x000E #define ixMC_IMP_CNTL_0 0x000F #define ixTC_MISMATCH_1 0x0010 #define ixTC_MISMATCH_2 0x0011 #define ixMC_BIST_CTRL 0x0012 #define ixREG_COLLAR_WRITE 0x0013 #define ixREG_COLLAR_READ 0x0014 #define ixR300_MC_IMP_CNTL 0x0018 #define ixR300_MC_CHP_IO_CNTL_A0 0x0019 #define ixR300_MC_CHP_IO_CNTL_A1 0x001a #define ixR300_MC_CHP_IO_CNTL_B0 0x001b #define ixR300_MC_CHP_IO_CNTL_B1 0x001c #define ixR300_MC_CHP_IO_CNTL_C0 0x001d #define ixR300_MC_CHP_IO_CNTL_C1 0x001e #define ixR300_MC_CHP_IO_CNTL_D0 0x001f #define ixR300_MC_CHP_IO_CNTL_D1 0x0020 #define ixR300_MC_IMP_CNTL_0 0x0021 #define ixR300_MC_ELPIDA_CNTL 0x0022 #define ixR300_MC_CHP_IO_OE_CNTL_CD 0x0023 #define ixR300_MC_READ_CNTL_CD 0x0024 #define ixR300_MC_MC_INIT_WR_LAT_TIMER 0x0025 #define ixR300_MC_DEBUG_CNTL 0x0026 #define ixR300_MC_BIST_CNTL_0 0x0028 #define ixR300_MC_BIST_CNTL_1 0x0029 #define ixR300_MC_BIST_CNTL_2 0x002a #define ixR300_MC_BIST_CNTL_3 0x002b #define ixR300_MC_BIST_CNTL_4 0x002c #define ixR300_MC_BIST_CNTL_5 0x002d #define ixR300_MC_IMP_STATUS 0x002e #define ixR300_MC_DLL_CNTL 0x002f #define NB_TOM 0x15C #endif /* _RADEON_H */
module EvmanMenu class Item include Configurable attr_reader :items, :captures attr_reader :name, :path, :icon, :modal def initialize name:, icon:, path: nil, modal: nil @name, @path, @icon, @modal = name, path, icon, modal @items = [] @captures = [] add_capture Capture.new(path) if path.present? end def add_item item items << item end def add_capture capture captures << capture end def capture data add_capture Capture.new(data) end def active? request captures.any?{ |c| c.captures? request } end end end
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ import React, { Fragment, SFC, useState } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonEmpty, EuiCallOut, EuiEmptyPrompt, SortDirection } from '@elastic/eui'; import { DataFrameTransformId, moveToDataFrameWizard, useRefreshTransformList, } from '../../../../common'; import { checkPermission } from '../../../../../privilege/check_privilege'; import { DataFrameTransformListColumn, DataFrameTransformListRow, ItemIdToExpandedRowMap, } from './common'; import { getTransformsFactory } from '../../services/transform_service'; import { getColumns } from './columns'; import { ExpandedRow } from './expanded_row'; import { ProgressBar, TransformTable } from './transform_table'; import { useRefreshInterval } from './use_refresh_interval'; function getItemIdToExpandedRowMap( itemIds: DataFrameTransformId[], dataFrameTransforms: DataFrameTransformListRow[] ): ItemIdToExpandedRowMap { return itemIds.reduce( (m: ItemIdToExpandedRowMap, transformId: DataFrameTransformId) => { const item = dataFrameTransforms.find(transform => transform.config.id === transformId); if (item !== undefined) { m[transformId] = <ExpandedRow item={item} />; } return m; }, {} as ItemIdToExpandedRowMap ); } export const DataFrameTransformList: SFC = () => { const [isInitialized, setIsInitialized] = useState(false); const [isLoading, setIsLoading] = useState(false); const [blockRefresh, setBlockRefresh] = useState(false); const [transforms, setTransforms] = useState<DataFrameTransformListRow[]>([]); const [expandedRowItemIds, setExpandedRowItemIds] = useState<DataFrameTransformId[]>([]); const [errorMessage, setErrorMessage] = useState<any>(undefined); const [pageIndex, setPageIndex] = useState(0); const [pageSize, setPageSize] = useState(10); const [sortField, setSortField] = useState<string>(DataFrameTransformListColumn.id); const [sortDirection, setSortDirection] = useState<string>(SortDirection.ASC); const disabled = !checkPermission('canCreateDataFrame') || !checkPermission('canPreviewDataFrame') || !checkPermission('canStartStopDataFrame'); const getTransforms = getTransformsFactory( setTransforms, setErrorMessage, setIsInitialized, blockRefresh ); // Subscribe to the refresh observable to trigger reloading the transform list. useRefreshTransformList({ isLoading: setIsLoading, onRefresh: () => getTransforms(true) }); // Call useRefreshInterval() after the subscription above is set up. useRefreshInterval(setBlockRefresh); // Before the transforms have been loaded for the first time, display the loading indicator only. // Otherwise a user would see 'No data frame transforms found' during the initial loading. if (!isInitialized) { return <ProgressBar isLoading={isLoading} />; } if (typeof errorMessage !== 'undefined') { return ( <Fragment> <ProgressBar isLoading={isLoading} /> <EuiCallOut title={i18n.translate('xpack.ml.dataFrame.list.errorPromptTitle', { defaultMessage: 'An error occurred getting the data frame transform list.', })} color="danger" iconType="alert" > <pre>{JSON.stringify(errorMessage)}</pre> </EuiCallOut> </Fragment> ); } if (transforms.length === 0) { return ( <Fragment> <ProgressBar isLoading={isLoading} /> <EuiEmptyPrompt title={ <h2> {i18n.translate('xpack.ml.dataFrame.list.emptyPromptTitle', { defaultMessage: 'No data frame transforms found', })} </h2> } actions={[ <EuiButtonEmpty onClick={moveToDataFrameWizard} isDisabled={disabled}> {i18n.translate('xpack.ml.dataFrame.list.emptyPromptButtonText', { defaultMessage: 'Create your first data frame transform', })} </EuiButtonEmpty>, ]} data-test-subj="mlNoDataFrameTransformsFound" /> </Fragment> ); } const columns = getColumns(expandedRowItemIds, setExpandedRowItemIds); const sorting = { sort: { field: sortField, direction: sortDirection, }, }; const itemIdToExpandedRowMap = getItemIdToExpandedRowMap(expandedRowItemIds, transforms); const pagination = { initialPageIndex: pageIndex, initialPageSize: pageSize, totalItemCount: transforms.length, pageSizeOptions: [10, 20, 50], hidePerPageOptions: false, }; const onTableChange = ({ page = { index: 0, size: 10 }, sort = { field: DataFrameTransformListColumn.id, direction: SortDirection.ASC }, }: { page: { index: number; size: number }; sort: { field: string; direction: string }; }) => { const { index, size } = page; setPageIndex(index); setPageSize(size); const { field, direction } = sort; setSortField(field); setSortDirection(direction); }; return ( <Fragment> <ProgressBar isLoading={isLoading} /> <TransformTable className="mlTransformTable" columns={columns} hasActions={false} isExpandable={true} isSelectable={false} items={transforms} itemId={DataFrameTransformListColumn.id} itemIdToExpandedRowMap={itemIdToExpandedRowMap} onChange={onTableChange} pagination={pagination} sorting={sorting} data-test-subj="mlDataFramesTableTransforms" /> </Fragment> ); };
package github type PullRequest struct { ID int Number int URL string HTML_URL string IssueURL string Title string Body string } type HTTPError struct { Message string `json:"message"` DocumentationURL string `json:"documentation_url"` } type GitHubMock struct { Token string Repository string PullRequest PullRequest }
--- layout: tagpage tag: stats permalink: /resources/stats/ --- Here are posts I've made on Statistics resources
package test public trait DeeplySubstitutedClassParameter2: Object { public trait Super<T>: Object { public fun foo(t: T) public fun dummy() // to avoid loading as SAM interface } public trait Middle<E>: Super<E> { } public trait Sub: Middle<String> { override fun foo(t: String) } }
# Android PaddleOCR 升级模型到V1.1版本 原始Demo:https://github.com/PaddlePaddle/PaddleOCR/tree/develop/deploy/android_demo
using System; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; namespace LLL.DurableTask.EFCore.DependencyInjection { public interface IEFCoreOrchestrationBuilder { IServiceCollection Services { get; } IEFCoreOrchestrationBuilder ConfigureDbContext(Action<DbContextOptionsBuilder> options); } }
require 'rails/generators/named_base' require 'rails/generators/resource_helpers' module Rails module Generators class BreezyGenerator < NamedBase # :nodoc: include Rails::Generators::ResourceHelpers source_root File.expand_path('../templates', __FILE__) argument :attributes, type: :array, default: [], banner: 'field:type field:type' def create_root_folder path = File.join('app/views', controller_file_path) empty_directory path unless File.directory?(path) end def copy_view_files %w(index show new edit).each do |view| @action_name = view filename = filename_with_extensions(view) template filename, File.join('app/views', controller_file_path, filename) end template '_form.json.props', File.join('app/views', controller_file_path, '_form.json.props') %w(index show new edit).each do |view| @action_name = view filename = filename_with_js_extensions(view) template 'web/' + filename, File.join('app/views', controller_file_path, filename) end %w(index show new edit).each do |view| @action_name = view filename = filename_with_html_extensions(view) template 'web/' + filename, File.join('app/views', controller_file_path, filename) end %w(index show new edit).each do |view| append_mapping(view) end end protected def append_mapping(action) app_js = 'app/javascript/packs/application.js' component_name = [plural_table_name, action].map(&:camelcase).join inject_into_file app_js, after: "from '@jho406/breezy'" do "\nimport #{component_name} from 'views/#{controller_file_path}/#{action}'" end inject_into_file app_js, after: 'identifierToComponentMapping = {' do "\n '#{[controller_file_path, action].join('/')}': #{component_name}," end end def action_name @action_name end def attributes_names [:id] + super end def filename_with_extensions(name) [name, :json, :props] * '.' end def filename_with_js_extensions(name) [name, :js] * '.' end def filename_with_html_extensions(name) [name, :html, :erb] * '.' end def attributes_list_with_timestamps attributes_list(attributes_names + %w(created_at updated_at)) end def attributes_list(attributes = attributes_names) if self.attributes.any? {|attr| attr.name == 'password' && attr.type == :digest} attributes = attributes.reject {|name| %w(password password_confirmation).include? name} end attributes end end end end
# Subnetter ## Bash network calculator This little script can calculate basic subnet info using IP and prefix * Usage Example $ subnetter 192.168.0.1/24 ``` IPv4 Address: 192.168.0.1 /24 11000000.10101000.00000000.00000001 Subnet Mask: 255.255.255.0 11111111.11111111.11111111.00000000 Network: 192.168.0.0 11000000.10101000.00000000.00000000 Broadcast: 192.168.0.255 11000000.10101000.00000000.11111111 First Address: 192.168.0.1 11000000.10101000.00000000.00000001 Last Address: 192.168.0.254 11000000.10101000.00000000.11111110 Hosts: 254 Class: C ```
#!/bin/bash trap '' 2 #trapをしかける echo $$ sleep 10000
/* * Copyright (c) 2014 by Matthias Noack, Zuse Institute Berlin * * Licensed under the BSD License, see LICENSE file for details. * */ #include "ld_preload/passthrough.h" #include <dlfcn.h> #include <pthread.h> #include <stdio.h> void* libc; void* libc_open; void* libc_close; void* libc___close; void* libc_read; void* libc_write; void* libc_pread; void* libc_pwrite; void* libc_dup; void* libc_dup2; void* libc_lseek; void* libc_stat; void* libc_fstat; void* libc___xstat; void* libc___xstat64; void* libc___fxstat; void* libc___fxstat64; void* libc___lxstat; void* libc___lxstat64; void* libc_fopen; void* libc_truncate; void* libc_ftruncate; void* libattr; void* libattr_setxattr; void* libattr_fsetxattr; // Our "copy" of stdout, because the application might close stdout // or reuse the first file descriptors for other purposes. static FILE* fdout = 0; FILE* xtreemfs_stdout() { return fdout; } static void initialize_passthrough() { xprintf("initialize_passthrough(): Setting up pass-through\n"); libc = dlopen("libc.so.6", RTLD_LAZY); // TODO: link with correct libc, version vs. 32 bit vs. 64 bit libc_open = dlsym(libc, "open"); libc_close = dlsym(libc, "close"); libc___close = dlsym(libc, "__close"); libc_read = dlsym(libc, "read"); libc_write = dlsym(libc, "write"); libc_pread = dlsym(libc, "pread"); libc_pwrite = dlsym(libc, "pwrite"); libc_dup = dlsym(libc, "dup"); libc_dup2 = dlsym(libc, "dup2"); libc_lseek = dlsym(libc, "lseek"); libc_stat = dlsym(libc, "stat"); libc_fstat = dlsym(libc, "fstat"); libc___xstat = dlsym(libc, "__xstat"); libc___xstat64 = dlsym(libc, "__xstat64"); libc___fxstat = dlsym(libc, "__fxstat"); libc___fxstat64 = dlsym(libc, "__fxstat64"); libc___lxstat = dlsym(libc, "__lxstat"); libc___lxstat64 = dlsym(libc, "__lxstat64"); libc_fopen = dlsym(libc, "fopen"); libc_truncate = dlsym(libc, "truncate"); libc_ftruncate = dlsym(libc, "ftruncate"); libattr = dlopen("libattr.so.1", RTLD_LAZY); libattr_setxattr = dlsym(libattr, "setxattr"); libattr_fsetxattr = dlsym(libattr, "setxattr"); int stdout2 = ((funcptr_dup)libc_dup)(1); if (stdout2 != -1) { fdout = fdopen(stdout2, "a"); } xprintf("initialize_passthrough(): New stdout %d\n", stdout2); } static pthread_once_t passthrough_initialized = PTHREAD_ONCE_INIT; void initialize_passthrough_if_necessary() { pthread_once(&passthrough_initialized, initialize_passthrough); }
package com.popalay.tracktor.feature.settings import androidx.compose.foundation.Icon import androidx.compose.foundation.Text import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material.Card import androidx.compose.material.IconButton import androidx.compose.material.Scaffold import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.unit.dp import androidx.ui.tooling.preview.Preview import com.popalay.tracktor.core.R import com.popalay.tracktor.feature.settings.SettingsWorkflow.Action import com.popalay.tracktor.ui.widget.TopAppBar import com.popalay.tracktor.utils.onBackPressed import com.squareup.workflow.ui.compose.composedViewFactory val SettingsBinding = composedViewFactory<SettingsWorkflow.Rendering> { rendering, _ -> onBackPressed { rendering.onAction(Action.BackClicked) } SettingsScreen(rendering.onAction) } @Preview @Composable fun SettingsScreen( onAction: (Action) -> Unit = {} ) { Scaffold( topBar = { TopAppBar( title = { Text(stringResource(R.string.settings_title)) }, navigationIcon = { IconButton(onClick = { onAction(Action.BackClicked) }) { Icon(Icons.Default.ArrowBack) } } ) } ) { Column { SettingItem( icon = { Icon(vectorResource(R.drawable.featured_play_list_black_24dp)) }, title = { Text(stringResource(R.string.feature_flags_title)) }, onClick = { onAction(Action.FeatureTogglesClicked) } ) if (false) { SettingItem( icon = { Icon(vectorResource(R.drawable.rate_review_24px)) }, title = { Text(stringResource(R.string.settings_review_title)) }, onClick = {} ) SettingItem( icon = { Icon(vectorResource(R.drawable.call_made_24px)) }, title = { Text(stringResource(R.string.settings_import_title)) }, onClick = {} ) SettingItem( icon = { Icon(vectorResource(R.drawable.call_received_24px)) }, title = { Text(stringResource(R.string.settings_export_title)) }, onClick = {} ) } } } } @Composable fun SettingItem( icon: @Composable () -> Unit, title: @Composable () -> Unit, onClick: () -> Unit ) { Card(Modifier.fillMaxWidth().padding(16.dp)) { Row(Modifier.clickable(onClick = onClick).padding(16.dp)) { icon() Spacer(Modifier.width(16.dp)) title() } } }
const replaceMap = require('./replaceMap'); module.exports = function ($_loader, $_options, $_output) { let source = $_output.map(function ($_path) { return replaceMap( '@import \'' + $_path + ($_options.base ? '/' + $_options.base : '') + '\'', $_options.replace ); }).join(';') + ';'; if ($_options.test) { console.log("\nTEST\n", source, "\n"); } $_loader.callback(null, source); }
<?php /** * Interface for database functions. * * PHP Version 5.2 * * @category Payment * @package Klarna_Module_XtCommerce * @author MS Dev <[email protected]> * @license http://opensource.org/licenses/BSD-2-Clause BSD2 * @link http://integration.klarna.com */ /** * Interface for database functions. * * @category Payment * @package Klarna_Module_XtCommerce * @author MS Dev <[email protected]> * @license http://opensource.org/licenses/BSD-2-Clause BSD2 * @link http://integration.klarna.com */ interface KlarnaDB { /** * Perform a query * * @param string $string sql string * * @return KlarnaDBResult */ public function query($string); /** * Wrap xtc_perform and similar * * @param string $table database table * @param array $data associative array to insert into the table * * @return mysql_result */ public function perform($table, $data); }
const STORE_PATH = 'USRF'; const isStorageCreated = (() => { try { window.localStorage.setItem(STORE_PATH, window.localStorage.getItem(STORE_PATH) ?? '{}'); return true; } catch (error) { return false; } })(); export const localStorage = <T>(storagePath: string): ((target: any, propertyKey: string) => void) => { if (!isStorageCreated) { return (target: any, propertyKey: string) => {}; } return (target: any, propertyKey: string): void => { Object.defineProperties(target, { [propertyKey]: { get: () => { const store = JSON.parse(window.localStorage.getItem(STORE_PATH)); return chainGet(store, storagePath); }, set: (value: T) => { let store = JSON.parse(window.localStorage.getItem(STORE_PATH)); store = chainSet(store, storagePath, value); window.localStorage.setItem(STORE_PATH, JSON.stringify(store)); }, }, }); }; }; /** * Function that sets a value to an object along the chain path. * Ex: 'user.address.street' => {user: {address: {street: value}}} * @param storage - object * @param path - chain string ('user.address.street') * @param value - any value */ function chainSet(storage: { [p: string]: any }, path: string, value: any): { [p: string]: any } { return path.split('.').reduce( ([root, prev], current, index, array) => { const targetObj = prev ?? root; targetObj[current] = index + 1 !== array.length ? targetObj[current] ?? {} : value; return [root, targetObj[current]]; }, storage ? [storage] : [{}] )[0]; } /** * Function that returns a value from an object reaching it along the chain path * @param storage - object * @param path - chain string ('user.address.street') */ function chainGet(storage: { [key: string]: any }, path: string): any { return path.split('.').reduce((prev, current): any => prev?.[current], storage ?? {}); }
#include "check_confuse.h" #include <stdio.h> #include <stdlib.h> static int ptr_count; static int parse_ptr(cfg_t *cfg, cfg_opt_t *opt, const char *value, void *result) { int *ptr = malloc(sizeof(int)); if (!ptr) return -1; *ptr = atoi(value); *(void **)result = ptr; fprintf(stderr, "make ptr %p (value '%s')\n", ptr, value); ptr_count++; return 0; } static void free_ptr(void *ptr) { ptr_count--; fprintf(stderr, "free ptr %p\n", ptr); free(ptr); } int main(void) { cfg_opt_t opts[] = { CFG_PTR_CB("ptr", "1", CFGF_NONE, parse_ptr, free_ptr), CFG_END() }; cfg_t *cfg = cfg_init(opts, 0); fail_unless(cfg_setopt(cfg, cfg_getopt(cfg, "ptr"), "2")); fail_unless(cfg_setopt(cfg, cfg_getopt(cfg, "ptr"), "3")); char *ptr4[] = { "4" }; fail_unless(cfg_setmulti(cfg, "ptr", 1, ptr4) == CFG_SUCCESS); char *ptr5[] = { "5" }; fail_unless(cfg_setmulti(cfg, "ptr", 1, ptr5) == CFG_SUCCESS); fail_unless(cfg_parse_buf(cfg, "ptr = 6") == CFG_SUCCESS); fail_unless(cfg_parse_buf(cfg, "ptr = 7") == CFG_SUCCESS); cfg_free(cfg); /* Is malloc/free of ptrs balanced? */ fail_unless(ptr_count == 0); return 0; } /** * Local Variables: * indent-tabs-mode: t * c-file-style: "linux" * End: */
# Photoman Tools for managing photos ## Install photoman depends on a number of libraries than can be installed using homebrew: ``` brew install exiftool libexif phash imagemagick ``` ## Todo * btsync command to detect `*.SyncTemp` left overs * dedup command to handle duplicate photos (list then intially)
import React, {useState, Fragment} from 'react' import { Dialog } from "../index"; export default function () { const [ visible, setVisible ] = useState(false); return ( <Fragment> <div> <button onClick={() => setVisible(!visible)}>开启/关闭dialog</button> <Dialog title="普通对话框" visible={visible} buttons={ [ <button key={1} onClick={() => setVisible(false)}>ok</button>, <button key={2} onClick={() => setVisible(false)}>cancel</button> ] } onClose={() => setVisible(false)}> dialog content </Dialog> </div> </Fragment> ) };
package com.dariopellegrini.kdone.interfaces interface RouteActions { suspend fun beforeCreate(input: Map<String, Any>) {} }
namespace Qf.Core.Uow { public interface IDatabaseApi { } }
/** \file TestFileSummary.h \brief Declaration for class to perform detailed testing of data file abstractions. \author James Peachey, HEASARC */ #ifndef tip_TestFileSummary_h #define tip_TestFileSummary_h #include "TestHarness.h" namespace tip { /** \class TestFileSummary \brief Declaration for class to perform detailed testing of data file abstractions. */ class TestFileSummary : public TestHarness { public: /** \brief Perform all detailed tests. */ virtual int test(int status); }; } #endif
#! /usr/bin/perl # Check that we can deal with HMMs with no optional annotation, in either # hmmscan or hmmsearch mode. # Bug #h69 segfaulted on this test. # # Usage: ./i9-optional-annotation.pl <builddir> <srcdir> <tmpfile prefix> # Example: ./i9-optional-annotation.pl .. .. tmpfoo # # SRE, Sun Nov 29 11:49:39 2009 # SVN $Id: i9-optional-annotation.pl 3152 2010-02-07 22:55:22Z eddys $ BEGIN { $builddir = shift; $srcdir = shift; $tmppfx = shift; } use lib "$srcdir/testsuite"; use h3; # Verify that we have all the executables we need for the test. if (! -x "$builddir/src/hmmbuild") { die "FAIL: didn't find hmmbuild binary in $builddir/src\n"; } if (! -x "$builddir/src/hmmpress") { die "FAIL: didn't find hmmpress binary in $builddir/src\n"; } if (! -x "$builddir/src/hmmsearch") { die "FAIL: didn't find hmmsearch binary in $builddir/src\n"; } if (! -x "$builddir/src/hmmscan") { die "FAIL: didn't find hmmscan binary in $builddir/src\n"; } # Create our test files. if (! open(ALI1, ">$tmppfx.sto")) { die "FAIL: couldn't open $tmppfx.sto for write\n"; } if (! open(SEQ1, ">$tmppfx.seq")) { die "FAIL: couldn't open $tmppfx.seq for write\n"; } print ALI1 <<"EOF"; # STOCKHOLM 1.0 #=GF ID ali1 #=GF AC XX01234.5 #=GF DE A test description seq1 ACDEFGHIKLMNPQRSTVWY seq2 ACDEFGHIKLMNPQRSTVWY seq3 ACDEFGHIKLMNPQRSTVWY // # STOCKHOLM 1.0 #=GF ID ali2 seq1 ACDEFGHIKLMNPQRSTVWY seq2 ACDEFGHIKLMNPQRSTVWY seq3 ACDEFGHIKLMNPQRSTVWY // EOF print SEQ1 <<"EOF"; ID test1 STANDARD; PRT; 20 AA. AC AC00001; DE Sequence description SQ SEQUENCE 20 AA; 99999 MW; FFFFFFFFFFFFFFFF CRC64; ACDEFGHIKLMNPQRSTVWY // ID test2 STANDARD; PRT; 20 AA. SQ SEQUENCE 20 AA; 99999 MW; FFFFFFFFFFFFFFFF CRC64; ACDEFGHIKLMNPQRSTVWY // EOF close ALI1; close SEQ1; @output = `$builddir/src/hmmbuild $tmppfx.hmm $tmppfx.sto 2>&1`; if ($? != 0) { die "FAIL: hmmbuild failed\n"; } @output = `$builddir/src/hmmpress $tmppfx.hmm 2>&1`; if ($? != 0) { die "FAIL: hmmpress failed\n"; } @output = `$builddir/src/hmmscan --tblout $tmppfx.tbl1 --domtblout $tmppfx.dtbl1 $tmppfx.hmm $tmppfx.seq 2>&1`; if ($? != 0) { die "FAIL: hmmscan failed\n"; } &h3::ParseDomTbl("$tmppfx.dtbl1"); if ($h3::ndomtbl != 4) { die "FAIL: on expected number lines, dtbl1\n"; } if ($h3::tname[0] ne "ali1") { die "FAIL: on line 0 target name, dtbl1\n"; } if ($h3::tacc[0] ne "XX01234.5") { die "FAIL: on line 0 accession, dtbl1\n"; } if ($h3::tdesc[0] ne "A test description") { die "FAIL: on line 0 desc, dtbl1\n"; } if ($h3::qname[0] ne "test1") { die "FAIL: on line 0 query name, dtbl1\n"; } if ($h3::qacc[0] ne "AC00001") { die "FAIL: on line 0 query accession, dtbl1\n"; } if ($h3::tname[1] ne "ali2") { die "FAIL: on line 1 target name, dtbl1\n"; } if ($h3::tacc[1] ne "-") { die "FAIL: on line 1 accession, dtbl1\n"; } if ($h3::tdesc[1] ne "-") { die "FAIL: on line 1 desc, dtbl1\n"; } if ($h3::qname[2] ne "test2") { die "FAIL: on line 2 query name, dtbl1\n"; } if ($h3::qacc[2] ne "-") { die "FAIL: on line 2 query accession, dtbl1\n"; } @output = `$builddir/src/hmmsearch --tblout $tmppfx.tbl2 --domtblout $tmppfx.dtbl2 $tmppfx.hmm $tmppfx.seq 2>&1`; if ($? != 0) { die "FAIL: hmmsearch failed\n"; } &h3::ParseDomTbl("$tmppfx.dtbl2"); if ($h3::ndomtbl != 4) { die "FAIL: on expected number lines, dtbl2\n"; } if ($h3::tname[0] ne "test1") { die "FAIL: on line 0 target name, dtbl2\n"; } if ($h3::tacc[0] ne "AC00001") { die "FAIL: on line 0 accession, dtbl2\n"; } if ($h3::tdesc[0] ne "Sequence description") { die "FAIL: on line 0 desc, dtbl2\n"; } if ($h3::qname[0] ne "ali1") { die "FAIL: on line 0 query name, dtbl2\n"; } if ($h3::qacc[0] ne "XX01234.5") { die "FAIL: on line 0 query accession, dtbl2\n"; } if ($h3::tname[1] ne "test2") { die "FAIL: on line 1 target name, dtbl2\n"; } if ($h3::tacc[1] ne "-") { die "FAIL: on line 1 accession, dtbl2\n"; } if ($h3::tdesc[1] ne "-") { die "FAIL: on line 1 desc, dtbl2\n"; } if ($h3::qname[2] ne "ali2") { die "FAIL: on line 2 query name, dtbl2\n"; } if ($h3::qacc[2] ne "-") { die "FAIL: on line 2 query accession, dtbl2\n"; } print "ok\n"; unlink "$tmppfx.sto"; unlink "$tmppfx.seq"; unlink "$tmppfx.tbl1"; unlink "$tmppfx.tbl2"; unlink "$tmppfx.dtbl1"; unlink "$tmppfx.dtbl2"; unlink <$tmppfx.hmm*>; exit 0;
using System; namespace SvgValidated.FilterEffects { public sealed class SvgFilter : SvgElement { public SvgCoordinateUnits FilterUnits { get; set; } public SvgCoordinateUnits PrimitiveUnits { get; set; } public SvgUnit X { get; set; } public SvgUnit Y { get; set; } public SvgUnit Width { get; set; } public SvgUnit Height { get; set; } public Uri Href { get; set; } } }
--- layout: post title: Microcontroller Board Arduino --- 今天稍微接触了下微操控器板Arduino Uno,感觉蛮好玩的。会一些基础的电气知识和C语言就可以上手了。自己可以在电路板安装线来点亮LED灯,做一些简单的小东西也是没问题的。认真学下去应该能学会很多东西。 ![_config.yml]({{ site.baseurl }}/images/天天向上.JPG)
namespace droid.Runtime.Utilities.Orientation { public interface IMotionTracker { bool IsInMotion(); bool IsInMotion(float sensitivity); } }
import { VerifyParams } from "."; import { errorUtil } from "v1/utils/error"; import { yup } from "v1/utils/yup"; import { LIMITS } from "v1/config/limits"; const schema = yup.object().shape({ contactId: yup.string().required().strict().uuid(), verificationCode: yup .string() .required() .strict() .length(LIMITS.confirmationToken.token.length), }); export const validate = (params: VerifyParams) => schema.validate(params).catch(err => errorUtil.badRequest(err.errors));
//go:build !amd64 // +build !amd64 package compress_sse41 import "github.com/zeebo/blake3/internal/alg/compress/compress_pure" func Compress(chain *[8]uint32, block *[16]uint32, counter uint64, blen uint32, flags uint32, out *[16]uint32) { compress_pure.Compress(chain, block, counter, blen, flags, out) }
import 'dart:ffi'; import 'bindings/bindings.dart'; import 'bindings/helpers.dart'; import 'modelinfo/entity_definition.dart'; import 'store.dart'; // ignore_for_file: public_member_api_docs /// Configure transaction mode. Used with [Store.runInTransaction()]. enum TxMode { /// Read only transaction - trying to execute a write operation results in an /// error. This is useful if you want to group many reads inside a single /// transaction, e.g. to improve performance or to get a consistent view of /// the data across multiple operations. read, /// Read/Write transaction. There can be only a single write transaction at /// any time - it holds a lock on the database. Compared to read transaction, /// read/write transactions have much higher "cost", because they need to /// write data to the disk at the end. write, } // TODO enable annotation once meta:1.3.0 is out // @internal class Transaction { final Store _store; final bool _isWrite; final Pointer<OBX_txn> _cTxn; bool _closed = false; // We have two ways of keeping cursors because we usually need just one. // The variable is faster then the map initialization & access. /*late final*/ CursorHelper _firstCursor; /*late final*/ Map<int, CursorHelper> _cursors; Pointer<OBX_txn> get ptr => _cTxn; Transaction(this._store, TxMode mode) : _isWrite = mode == TxMode.write, _cTxn = mode == TxMode.write ? C.txn_write(_store.ptr) : C.txn_read(_store.ptr) { checkObxPtr(_cTxn, 'failed to create transaction'); } void _finish(bool successful) { if (_isWrite) { try { _mark(successful); } finally { close(); } } else { close(); } } void commitAndClose() => _finish(true); void abortAndClose() => _finish(false); void _mark(bool successful) => checkObx(C.txn_mark_success(_cTxn, successful)); void markSuccessful() => _mark(true); void markFailed() => _mark(false); void close() { if (_closed) return; _closed = true; if (_firstCursor != null) { _firstCursor.close(); if (_cursors != null) { _cursors.values.forEach((c) => c.close()); _cursors.clear(); } } checkObx(C.txn_close(_cTxn)); } /// Returns a cursor for the given entity. No need to close it manually. /// Note: the cursor may have already been used, don't rely on its state! CursorHelper<T> cursor<T>(EntityDefinition<T> entity) { if (_firstCursor == null) { return _firstCursor = CursorHelper<T>(_store, _cTxn, entity, isWrite: _isWrite); } else if (_firstCursor.entity == entity) { return _firstCursor as CursorHelper<T>; } _cursors ??= <int, CursorHelper>{}; final entityId = entity.model.id.id; if (_cursors.containsKey(entityId)) { return _cursors[entityId] as CursorHelper<T>; } return _cursors[entityId] = CursorHelper<T>(_store, _cTxn, entity, isWrite: _isWrite); } /// Executes a given function inside a transaction. /// /// Returns type of [fn] if [return] is called in [fn]. static R execute<R>(Store store, TxMode mode, R Function() fn) { final tx = Transaction(store, mode); try { // In theory, we should only mark successful after the function finishes. // In practice, it's safe to assume most functions will be successful and // thus marking before the call allows us to return directly, before an // intermediary variable. if (tx._isWrite) tx.markSuccessful(); return fn(); } catch (ex) { if (tx._isWrite) tx.markFailed(); rethrow; } finally { tx.close(); } } }
Rails.application.routes.draw do if Rails.env.development? mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "graphql#execute" end post "/graphql", to: "graphql#execute" # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html post 'authenticate', to: 'authentication#authenticate' resources :users, only: [:create] namespace :api do namespace :v1 do mount Raddocs::App => "/docs" put '/products/:id/purchase', to: 'products#purchase' put '/carts/:id/complete', to: 'carts#complete' put '/carts/:id/add', to: 'carts#add_to_cart' get '/line_items/:id/available', to: 'line_items#available' put '/line_items/:id/purchase', to: 'line_items#purchase' resources :products, only: [:index, :purchase] get '/products/:id', to: 'products#show' resources :carts, only: [:create, :show, :index] resources :line_items end end end
--- chapter: Nine ctitle: The Correction of Error title: Grandeur versus Grandiosity ref: Tx.9.VII --- <sup>48</sup> Grandeur is of God and *only* of Him. Therefore, it is in you. Whenever you become aware of it, however dimly, you abandon the ego automatically, because in the presence of the grandeur of God the meaninglessness of the ego becomes perfectly apparent. Though it does not understand this, the ego believes that its “enemy” has struck and attempts to offer gifts to induce you to return to its “protection.” *Self*\-inflation \[is the only offering it can make. The grandiosity\] of the ego is its alternative to the grandeur of God. Which will you choose? <sup>49</sup> Grandiosity is *always* a cover for despair. It is without hope because it is not real. It is an attempt to counteract your littleness, based on the belief that the littleness is *real*. Without this belief, grandiosity is meaningless, and you could not possibly want it. The essence of grandiosity is competitiveness, because it *always* involves attack. It is a delusional attempt to *outdo* but *not* to undo. We said before that the ego vacillates between suspiciousness and viciousness. It remains suspicious as long as you despair of yourself. It shifts to viciousness whenever you will not tolerate self-abasement and seek relief. Then it offers you the illusion of attack as a solution. <sup>50</sup> The ego does not know the difference between grandeur and grandiosity, because it does not know the difference between miracle impulses and ego-alien beliefs of its own. We once said that the ego *is* aware of threat, but does not make distinctions between two entirely different kinds of threat to its existence. Its own profound sense of vulnerability renders it incapable of judgment *except* in terms of attack. When it experiences threat, its only decision is whether to attack *now* or to withdraw to attack later. If you accept its offer of grandiosity, it will attack immediately. If you do not, it will wait. <sup>51</sup> The ego is immobilized in the presence of God's grandeur, because *His* grandeur establishes *your* freedom. Even the faintest hint of your reality literally drives the ego from your mind because of complete lack of investment in it. Grandeur is totally *without* illusions, and because it is real, it is compellingly convincing. Yet the conviction of reality will not remain with you unless you do not allow the ego to attack it. The ego will make every effort to recover and mobilize its energies *against* your release. It will tell you that you are insane and argue that grandeur *cannot* be a real part of you because of the littleness in which *it* believes. <sup>52</sup> Yet your grandeur is not delusional, *because* you did not make it. *You* have made grandiosity and are afraid of it because it is a form of attack, but your grandeur is of God, Who created it out of His Love. From your grandeur you can only bless, because your grandeur is your *abundance*. By blessing, you hold it in your mind, protecting it from illusions and keeping yourself in the Mind of God. Remember always that you cannot be anywhere *except* in the Mind of God. When you forget this, you *will* despair, and you *will* attack. <sup>53</sup> The ego depends *solely* on your willingness to tolerate it. If you are willing to look upon your grandeur, you *cannot* despair, and therefore you cannot *want* the ego. Your grandeur is God's *answer* to the ego because it is true. Littleness and grandeur cannot co-exist, nor is it possible for them to alternate in your awareness. Littleness and grandiosity can and *must* alternate in your awareness since both are untrue and are therefore on the same level. Being the level of shift, it is experienced as shifting, and extremes are its essential characteristic. <sup>54</sup> Truth and littleness are *denials* of each other, because grandeur *is* truth. Truth does not vacillate; it is *always* true. When grandeur slips away from you, you have replaced it with something *you* have made. Perhaps it is the belief in littleness; perhaps it is the belief in grandiosity. Yet it *must* be insane because it is *not* true. Your grandeur will *never* deceive you, but your illusions *always* will. Illusions *are* deceptions. You cannot triumph, but you *are* exalted. And in your exalted state, you seek others like you and rejoice with them. <sup>55</sup> It is easy to distinguish grandeur from grandiosity because love is returned, but pride is not. Pride will not produce miracles and therefore will deprive you of your true witnesses to your reality. Truth is not obscure nor hidden, but its obviousness to *you* lies in the joy you bring to its witnesses, who *show* it to you. They attest to your grandeur, but they cannot attest to pride, because pride is not shared. God *wants* you to behold what He created, because it is His joy. <sup>56</sup> Can your grandeur be arrogant when God Himself witnesses to it? And what can be real that *has* no witnesses? What good can come of it? And if no good can come of it, the Holy Spirit cannot use it. What He cannot transform to the Will of God does not exist at all. Grandiosity is delusional, because it is used to *replace* your grandeur. Yet what God has created cannot *be* replaced. God is incomplete without you, because His grandeur is total, and you cannot *be* missing from it. <sup>57</sup> You are altogether irreplaceable in the Mind of God. No one else can fill your part of it, and while you leave your part of it empty, your eternal place merely waits for your return. God, through His Voice, reminds you of it, and God Himself keeps your extensions safe within it. Yet you do not know them until you return to them. You *cannot* replace the Kingdom, and you cannot replace *yourself.* God, Who *knows* your value, would not have it so, and so it is *not* so. Your value is in *God's* Mind and therefore not in yours alone. To accept yourself as God created you cannot be arrogance, because it is the *denial* of arrogance. To accept your littleness *is* arrogant, because it means that you believe *your* evaluation of yourself is *truer* than God's. <sup>58</sup> Yet if truth is indivisible, your evaluation of yourself must *be* God's. You did not establish your value, and it *needs* no defense. Nothing can attack it or prevail over it. It does not vary. It merely *is*. Ask the Holy Spirit *what* it is and He will tell you, but do not be afraid of His answer, for it comes from God. It *is* an exalted answer because of its Source, but the Source is true and so is Its answer. Listen and do not question what you hear, for God does not deceive. He would have you replace the ego's belief in littleness with His own exalted answer to the question of your being, so that you can cease to question it and *know* it for what it *is*.
using System.Collections.Generic; using System.Linq; using Bari.Core.Model; using Bari.Core.Model.Parameters; namespace Bari.Plugins.Fsharp.Model { public class FsharpFileOrder : IProjectParameters { private readonly IList<string> orderedFiles; public string[] OrderedFiles { get { return orderedFiles.ToArray(); } } public FsharpFileOrder() { orderedFiles = new List<string>(); } public void Clear() { orderedFiles.Clear(); } public void Add(string file) { orderedFiles.Add(file); } } }
import { R4_DomainResource } from './R4_DomainResource'; export enum R4_GraphCompartmentUseEnum{ CONDITION = 'condition', REQUIREMENT = 'requirement', }
export interface IUser { id:string, email:string, first_name:string, last_name:string, profile_built:boolean, } export interface AuthState { token: string | null; user: any; isAuthenticated: boolean | null; loading: boolean | null; isLawyer: boolean | null; error: any; trialPeriod: number | null; } //auth action names export enum AuthTypes { GET_EARLY_ACCESS = "GET_EARLY_ACCESS", RESET_PASSWORD_SUCCESS = 'RESET_PASSWORD_SUCCESS', RESET_PASSWORD_FAIL = 'RESET_PASSWORD_FAIL', GET_EARLY_ACCESS_FAIL = "GET_EARLY_ACCESS_FAIL", REGISTER_SUCCESS = "REGISTER_SUCCESS", REGISTER_FAIL = "REGISTER_FAIL", USER_LOAD_SUCCESS = "USER_LOAD_SUCCESS", USER_LOAD_ERROR = "USER_LOAD_ERROR", LOGIN_SUCCESS = "LOGIN_SUCCESS", TRIAL_PERIOD_SUCCESS = "TRIAL_PERIOD_SUCCESS", TRIAL_PERIOD_FAIL = "TRIAL_PERIOD_FAIL", LOGIN_FAIL = "LOGIN_FAIL", LOGOUT = "LOGOUT", AUTH_STARTED = "AUTH_STARTED", } //interface for action names interface ResetSuccessAction { type: typeof AuthTypes.RESET_PASSWORD_SUCCESS; payload: any; } interface ResetFailureAction { type: typeof AuthTypes.RESET_PASSWORD_FAIL; error?: any; } interface TrialPeriodSuccessActions { type: typeof AuthTypes.TRIAL_PERIOD_SUCCESS; payload: any; } interface TrialPeriodFailActions { type: typeof AuthTypes.TRIAL_PERIOD_FAIL; error?: any; } interface GetEarlyAccessAction { type: typeof AuthTypes.GET_EARLY_ACCESS; payload: any; } interface LoginSuccessAction { type: typeof AuthTypes.LOGIN_SUCCESS; payload: { user: any; token: string; isLawyer: boolean; }; } interface UserLoadAction { type: typeof AuthTypes.USER_LOAD_SUCCESS; payload: any; isLawyer: boolean; } interface RegisterFailAction { type: typeof AuthTypes.REGISTER_FAIL; error: any; } interface LoginFailAction { type: typeof AuthTypes.LOGIN_FAIL; error: any; } interface UserLoadErrorAction { type: typeof AuthTypes.USER_LOAD_ERROR; error: any; } interface LogoutAction { type: typeof AuthTypes.LOGOUT; } interface AuthStartedAction { type: typeof AuthTypes.AUTH_STARTED; } export type AuthActionTypes = | ResetSuccessAction | ResetFailureAction | TrialPeriodFailActions | TrialPeriodSuccessActions | RegisterFailAction | LoginSuccessAction | LoginFailAction | UserLoadAction | UserLoadErrorAction | LogoutAction | AuthStartedAction | GetEarlyAccessAction;
package main import "fmt" // "defer" will always run at the very end func main () { defer printTwo() printOne() } func printOne() { fmt.Println(1) } func printTwo() { fmt.Println(2) }
class User < ApplicationRecord has_secure_password has_many :ratings has_many :senators, through: :ratings end
--- title: Order Report --- ## Order Report !!! missing "TODO" This section requires further work
#!/bin/bash if [ -f /etc/at.deny ]; then rm /etc/at.deny fi
export interface Agenda { id: string; name: string; interval: string; imageUrl: string; businessId: string; intervals: any; }
// This module is necessary, because the `arbitrary` crate removed all public interfaces // from `Gen` which could interlink with the API stability guarantees of `rand`. // // As a result, the exposed random value generation APIs are somewhat limited. // If they ever find a suitable way of re-exposing them, this module will be obsolete. use quickcheck::{Arbitrary, Gen}; use rand::RngCore; pub(crate) struct GenRng<'a>(&'a mut Gen); pub(crate) trait GenExt { fn rng(&mut self) -> GenRng; } impl GenExt for Gen { fn rng(&mut self) -> GenRng { GenRng(self) } } impl<'a> RngCore for GenRng<'a> { fn next_u32(&mut self) -> u32 { Arbitrary::arbitrary(self.0) } fn next_u64(&mut self) -> u64 { Arbitrary::arbitrary(self.0) } fn fill_bytes(&mut self, dest: &mut [u8]) { for b in dest { *b = Arbitrary::arbitrary(self.0); } } fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> { Ok(self.fill_bytes(dest)) } }
use expect_test::{expect, Expect}; use crate::tests::completion_list; fn check(ra_fixture: &str, expect: Expect) { let actual = completion_list(ra_fixture); expect.assert_eq(&actual); } #[test] fn only_param() { check( r#" fn foo(file_id: usize) {} fn bar(file_id: usize) {} fn baz(file$0) {} "#, expect![[r#" bn file_id: usize kw mut "#]], ); } #[test] fn last_param() { check( r#" fn foo(file_id: usize) {} fn bar(file_id: usize) {} fn baz(foo: (), file$0) {} "#, expect![[r#" bn file_id: usize kw mut "#]], ); } #[test] fn first_param() { check( r#" fn foo(file_id: usize) {} fn bar(file_id: usize) {} fn baz(file$0 id: u32) {} "#, expect![[r#" bn file_id: usize kw mut "#]], ); } #[test] fn trait_param() { check( r#" pub(crate) trait SourceRoot { pub fn contains(file_id: usize) -> bool; pub fn syntax(file$0) } "#, expect![[r#" bn file_id: usize kw mut "#]], ); } #[test] fn in_inner_function() { check( r#" fn outer(text: &str) { fn inner($0) } "#, expect![[r#" bn text: &str kw mut "#]], ) } #[test] fn shows_non_ident_pat_param() { check( r#" struct Bar { bar: u32 } fn foo(Bar { bar }: Bar) {} fn foo2($0) {} "#, expect![[r#" bn Bar { bar }: Bar kw mut bn Bar Bar { bar$1 }: Bar$0 st Bar "#]], ) } #[test] fn in_impl_only_param() { check( r#" struct A {} impl A { fn foo(file_id: usize) {} fn new($0) {} } "#, expect![[r#" bn self bn &self bn mut self bn &mut self bn file_id: usize kw mut sp Self st A "#]], ) } #[test] fn in_impl_after_self() { // FIXME: self completions should not be here check( r#" struct A {} impl A { fn foo(file_id: usize) {} fn new(self, $0) {} } "#, expect![[r#" bn self bn &self bn mut self bn &mut self bn file_id: usize kw mut sp Self st A "#]], ) }
import { useAuth0 } from "@auth0/auth0-react"; import React from 'react'; export const Profile: React.FC = () => { const { user, isAuthenticated } = useAuth0() console.log(user); const profile = isAuthenticated ? ( <div> <img className="profile-image" src={user.picture} alt={user.given_name}/> <h2>Water "N" Go expert: {user.name}</h2> <p>{user.email}</p> </div> ) : ( <div> <p>User is not logged in</p> </div> ) return profile }
// FarNet plugin for Far Manager // Copyright (c) Roman Kuzmin using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; namespace FarNet { /// <summary> /// INTERNAL /// </summary> public class XmlAttributeInfo { /// <summary> /// INTERNAL /// </summary> /// <param name="name">INTERNAL</param> /// <param name="getter">INTERNAL</param> public XmlAttributeInfo(string name, Func<object, object> getter) { Name = name; Getter = getter; } /// <summary> /// INTERNAL /// </summary> public string Name { get; private set; } /// <summary> /// INTERNAL /// </summary> public Func<object, object> Getter { get; private set; } } /// <summary> /// INTERNAL /// </summary> public interface IXmlInfo { /// <summary> /// INTERNAL /// </summary> string XmlNodeName(); /// <summary> /// INTERNAL /// </summary> IList<XmlAttributeInfo> XmlAttributes(); } /// <summary> /// Abstract panel item representing native files and directories, plugin panel items, and module panel items. /// </summary> /// <remarks> /// Modules may implement derived classes in order to represent their panel /// items effectively. Alternatively, they may use <see cref="SetFile"/>, /// the simple property set. /// <para> /// Although this class is abstract all its virtual properties are defined, /// they get default values and throw <c>NotImplementedException</c> on /// setting. Thus, derived classes do not have to implement every property. /// At least <see cref="Name"/> has to be defined in order to be shown in /// a panel, other properties are implemented when needed. /// </para> /// </remarks> public abstract class FarFile : IXmlInfo { /// <summary> /// File name. /// </summary> public virtual string Name { get { return null; } set { throw new NotImplementedException(); } } /// <summary> /// Description. /// </summary> public virtual string Description { get { return null; } set { throw new NotImplementedException(); } } /// <summary> /// Owner. /// </summary> public virtual string Owner { get { return null; } set { throw new NotImplementedException(); } } /// <summary> /// User data. Only for <see cref="Panel"/>. /// </summary> public virtual object Data { get { return null; } //??? _090610_071700 set { throw new NotImplementedException(); } } /// <summary> /// Creation time. /// </summary> public virtual DateTime CreationTime { get { return new DateTime(); } set { throw new NotImplementedException(); } } /// <summary> /// Last access time. /// </summary> public virtual DateTime LastAccessTime { get { return new DateTime(); } set { throw new NotImplementedException(); } } /// <summary> /// Last write time. /// </summary> public virtual DateTime LastWriteTime { get { return new DateTime(); } set { throw new NotImplementedException(); } } /// <summary> /// File length. /// </summary> public virtual long Length { get { return 0; } set { throw new NotImplementedException(); } } /// <summary> /// Custom columns. See <see cref="PanelPlan"/>. /// </summary> public virtual ICollection Columns { get { return null; } set { throw new NotImplementedException(); } } /// <summary> /// File attributes. All <c>Is*</c> properties are based on this value. /// </summary> /// <remarks> /// Derived class may override this property and cannot override <c>Is*</c>. /// All <c>Is*</c> properties are completely mapped to this value. /// </remarks> public virtual FileAttributes Attributes { get { return 0; } set { throw new NotImplementedException(); } } /// <summary> /// Read only attribute. /// See <see cref="Attributes"/>. /// </summary> public bool IsReadOnly { get { return (Attributes & FileAttributes.ReadOnly) != 0; } set { Attributes = value ? (Attributes | FileAttributes.ReadOnly) : (Attributes & ~FileAttributes.ReadOnly); } } /// <summary> /// Hidden attribute. /// See <see cref="Attributes"/>. /// </summary> public bool IsHidden { get { return (Attributes & FileAttributes.Hidden) != 0; } set { Attributes = value ? (Attributes | FileAttributes.Hidden) : (Attributes & ~FileAttributes.Hidden); } } /// <summary> /// System attribute. /// See <see cref="Attributes"/>. /// </summary> public bool IsSystem { get { return (Attributes & FileAttributes.System) != 0; } set { Attributes = value ? (Attributes | FileAttributes.System) : (Attributes & ~FileAttributes.System); } } /// <summary> /// Directory attribute. /// See <see cref="Attributes"/>. /// </summary> public bool IsDirectory { get { return (Attributes & FileAttributes.Directory) != 0; } set { Attributes = value ? (Attributes | FileAttributes.Directory) : (Attributes & ~FileAttributes.Directory); } } /// <summary> /// Archive attribute. /// See <see cref="Attributes"/>. /// </summary> public bool IsArchive { get { return (Attributes & FileAttributes.Archive) != 0; } set { Attributes = value ? (Attributes | FileAttributes.Archive) : (Attributes & ~FileAttributes.Archive); } } /// <summary> /// Reparse point attribute. /// See <see cref="Attributes"/>. /// </summary> public bool IsReparsePoint { get { return (Attributes & FileAttributes.ReparsePoint) != 0; } set { Attributes = value ? (Attributes | FileAttributes.ReparsePoint) : (Attributes & ~FileAttributes.ReparsePoint); } } /// <summary> /// Compressed attribute. /// See <see cref="Attributes"/>. /// </summary> public bool IsCompressed { get { return (Attributes & FileAttributes.Compressed) != 0; } set { Attributes = value ? (Attributes | FileAttributes.Compressed) : (Attributes & ~FileAttributes.Compressed); } } /// <summary> /// Encrypted attribute. /// See <see cref="Attributes"/>. /// </summary> public bool IsEncrypted { get { return (Attributes & FileAttributes.Encrypted) != 0; } set { Attributes = value ? (Attributes | FileAttributes.Encrypted) : (Attributes & ~FileAttributes.Encrypted); } } /// <summary> /// Returns the file name. /// </summary> public sealed override string ToString() { return Name; } /// <summary> /// INTERNAL /// </summary> public virtual string XmlNodeName() { return IsDirectory ? "Directory" : "File"; } static ReadOnlyCollection<XmlAttributeInfo> _attrs; static ReadOnlyCollection<XmlAttributeInfo> XmlAttr() { if (_attrs != null) return _attrs; var attrs = new XmlAttributeInfo[] { new XmlAttributeInfo("Name", (object file) => ((FarFile)file).Name), new XmlAttributeInfo("Description", (object file) => ((FarFile)file).Description), new XmlAttributeInfo("Owner", (object file) => ((FarFile)file).Owner), new XmlAttributeInfo("Length", (object file) => ((FarFile)file).Length), new XmlAttributeInfo("CreationTime", (object file) => ((FarFile)file).CreationTime), new XmlAttributeInfo("LastAccessTime", (object file) => ((FarFile)file).LastAccessTime), new XmlAttributeInfo("LastWriteTime", (object file) => ((FarFile)file).LastWriteTime), new XmlAttributeInfo("ReadOnly", (object file) => ((FarFile)file).IsReadOnly), new XmlAttributeInfo("Hidden", (object file) => ((FarFile)file).IsHidden), new XmlAttributeInfo("System", (object file) => ((FarFile)file).IsSystem), new XmlAttributeInfo("Archive", (object file) => ((FarFile)file).IsArchive), new XmlAttributeInfo("Compressed", (object file) => ((FarFile)file).IsCompressed), new XmlAttributeInfo("ReparsePoint", (object file) => ((FarFile)file).IsReparsePoint), }; _attrs = new ReadOnlyCollection<XmlAttributeInfo>(attrs); return _attrs; } /// <summary> /// INTERNAL /// </summary> public virtual IList<XmlAttributeInfo> XmlAttributes() { return XmlAttr(); } } /// <summary> /// Straightforward implementation of <see cref="FarFile"/> ready to use by module panels. /// </summary> /// <remarks> /// It is just a set of properties where any property can be set. In most /// cases panels may use this class for their items. In some cases they may /// implement custom classes derived from <see cref="FarFile"/> in order to /// represent data more effectively (using less memory or working faster). /// </remarks> public sealed class SetFile : FarFile { /// <summary> /// Creates an empty file data object. /// </summary> public SetFile() { } /// <summary> /// Creates file data snapshot from a <see cref="FarFile"/> object. /// </summary> /// <param name="file">Any panel file which data are taken.</param> public SetFile(FarFile file) { if (file == null) throw new ArgumentNullException("file"); Attributes = file.Attributes; CreationTime = file.CreationTime; Data = file.Data; Description = file.Description; LastAccessTime = file.LastAccessTime; LastWriteTime = file.LastWriteTime; Length = file.Length; Name = file.Name; Owner = file.Owner; } /// <summary> /// Creates file data snapshot from a <see cref="FileSystemInfo"/> object. /// </summary> /// <param name="info">File system item info (normally <see cref="FileInfo"/> or <see cref="DirectoryInfo"/>).</param> /// <param name="fullName">Use the full name (path) as the name.</param> public SetFile(FileSystemInfo info, bool fullName) { if (info == null) throw new ArgumentNullException("info"); Name = fullName ? info.FullName : info.Name; CreationTime = info.CreationTime; LastAccessTime = info.LastAccessTime; LastWriteTime = info.LastWriteTime; Attributes = info.Attributes; if ((Attributes & FileAttributes.Directory) == 0) Length = ((FileInfo)info).Length; } /// <inheritdoc/> public override string Name { get; set; } /// <inheritdoc/> public override string Description { get; set; } /// <inheritdoc/> public override string Owner { get; set; } /// <inheritdoc/> public override DateTime CreationTime { get; set; } /// <inheritdoc/> public override DateTime LastAccessTime { get; set; } /// <inheritdoc/> public override DateTime LastWriteTime { get; set; } /// <inheritdoc/> public override long Length { get; set; } /// <inheritdoc/> public override object Data { get; set; } /// <inheritdoc/> public override FileAttributes Attributes { get; set; } /// <inheritdoc/> public override ICollection Columns { get; set; } } /// <summary> /// The base class for a file which wraps another file. /// </summary> public class WrapFile : FarFile { /// <summary> /// New file which wraps another file. /// </summary> /// <param name="file">The base file.</param> public WrapFile(FarFile file) { _File = file ?? throw new ArgumentNullException("file"); } /// <summary> /// Gets the base file. /// </summary> public FarFile File { get { return _File; } } readonly FarFile _File; /// <inheritdoc/> public override string Name { get { return File.Name; } } /// <inheritdoc/> public override string Description { get { return File.Description; } } /// <inheritdoc/> public override string Owner { get { return File.Owner; } } /// <inheritdoc/> public override object Data { get { return File.Data; } } /// <inheritdoc/> public override DateTime CreationTime { get { return File.CreationTime; } } /// <inheritdoc/> public override DateTime LastAccessTime { get { return File.LastAccessTime; } } /// <inheritdoc/> public override DateTime LastWriteTime { get { return File.LastWriteTime; } } /// <inheritdoc/> public override long Length { get { return File.Length; } } /// <inheritdoc/> public override ICollection Columns { get { return File.Columns; } } /// <inheritdoc/> public override FileAttributes Attributes { get { return File.Attributes; } } } /// <summary> /// Compares files by their references. /// </summary> public sealed class FileFileComparer : EqualityComparer<FarFile> { /// <inheritdoc/> public override bool Equals(FarFile x, FarFile y) { return object.Equals(x, y); } /// <inheritdoc/> public override int GetHashCode(FarFile obj) { return obj == null ? 0 : obj.GetHashCode(); } } /// <summary> /// Compares files by their <see cref="FarFile.Data"/> references. /// </summary> public sealed class FileDataComparer : EqualityComparer<FarFile> { /// <inheritdoc/> public override bool Equals(FarFile x, FarFile y) { if (x == null || y == null) return x == null && y == null; else return object.Equals(x.Data, y.Data); } /// <inheritdoc/> public override int GetHashCode(FarFile obj) { return (obj == null || obj.Data == null) ? 0 : obj.Data.GetHashCode(); } } /// <summary> /// Compares files by their names. /// </summary> public sealed class FileNameComparer : EqualityComparer<FarFile> { readonly StringComparer _comparer; /// <summary> /// New comparer with the <c>OrdinalIgnoreCase</c> string comparer. /// </summary> public FileNameComparer() { _comparer = StringComparer.OrdinalIgnoreCase; } /// <summary> /// New comparer with the specified string comparer. /// </summary> /// <param name="comparer">The string comparer.</param> public FileNameComparer(StringComparer comparer) { _comparer = comparer ?? throw new ArgumentNullException("comparer"); } /// <inheritdoc/> public override bool Equals(FarFile x, FarFile y) { if (x == null || y == null) return x == null && y == null; else return _comparer.Equals(x.Name, y.Name); } /// <inheritdoc/> public override int GetHashCode(FarFile obj) { return obj == null || obj.Name == null ? 0 : obj.Name.GetHashCode(); } } }
//你有一套活字字模 tiles,其中每个字模上都刻有一个字母 tiles[i]。返回你可以印出的非空字母序列的数目。 // // 注意:本题中,每个活字字模只能使用一次。 // // // // 示例 1: // // 输入:"AAB" //输出:8 //解释:可能的序列为 "A", "B", "AA", "AB", "BA", "AAB", "ABA", "BAA"。 // // // 示例 2: // // 输入:"AAABBC" //输出:188 // // // // // 提示: // // // 1 <= tiles.length <= 7 // tiles 由大写英文字母组成 // // Related Topics 回溯算法 // 👍 105 👎 0 import java.util.Arrays; import java.util.Deque; import java.util.LinkedList; import java.util.logging.Logger; /** * create time: 2021-03-12 23:03:32 */ public class _1079_LetterTilePossibilities { private static final Logger logger = Logger.getLogger(_1079_LetterTilePossibilities.class.toString()); public static void main(String[] args) { long startTimeMillis = System.currentTimeMillis(); Solution solution = new _1079_LetterTilePossibilities().new Solution(); assert solution.numTilePossibilities("AAB") == 8; assert solution.numTilePossibilities("AAABBC") == 188; assert solution.numTilePossibilities("V") == 1; assert solution.numTilePossibilities("CDC") == 8; // logger.warning(String.valueOf(solution.numTilePossibilities("AAB"))); logger.info("time cost: [" + (System.currentTimeMillis() - startTimeMillis) + "] ms"); } //leetcode submit region begin(Prohibit modification and deletion) class Solution { public int numTilePossibilities(String tiles) { char[] charArray = tiles.toCharArray(); Arrays.sort(charArray); return this.numTilePossibilities(charArray, new LinkedList<>(), new boolean[charArray.length], 0); } private int numTilePossibilities(char[] charArray, Deque<Character> path, boolean[] used, int count) { if (!path.isEmpty()) { // System.out.println("递归命中 => " + path); count++; } for (int i = 0; i < charArray.length; i++) { if (used[i] || (i > 0 && charArray[i] == charArray[i - 1] && !used[i - 1])) { continue; } path.addLast(charArray[i]); used[i] = true; // System.out.println("递归之前 => " + path); count = this.numTilePossibilities(charArray, path, used, count); used[i] = false; path.removeLast(); // System.out.println("递归之后 => " + path); } return count; } } //leetcode submit region end(Prohibit modification and deletion) }
package stringCalculator import ( "fmt" "strconv" "strings" ) const commonDelimiter = "_" // Add calculate sum the numbers as string. In case the negative numbers, show an error message and returned -1. func Add(numbers string) int { if containsCustomDelimiter(numbers) { customDelimiter := extractCustomDelimiter(numbers) return addWithDelimiters(numbers, "//", commonDelimiter, "\n", commonDelimiter, customDelimiter, commonDelimiter) } return addWithDelimiters(numbers, ",", commonDelimiter, "\n", commonDelimiter) } func containsCustomDelimiter(value string) bool { return strings.HasPrefix(value, "//") } func extractCustomDelimiter(value string) string { splitted := strings.Split(value, "//") return splitted[1][:1] } func normalizeDelimiters(unnormalized string, newDelimiters ...string) string { r := strings.NewReplacer(newDelimiters...) result := r.Replace(unnormalized) return result } func addWithDelimiters(value string, delimiters ...string) int { if value == "" { return 0 } normalized := normalizeDelimiters(value, delimiters...) normalizedSplitted := strings.Split(normalized, commonDelimiter) var acc int for _, v := range normalizedSplitted { i, err := strconv.Atoi(v) if i < 0 { fmt.Println("negatives not allowed") return -1 } if err == nil && i >= 0 { acc += i } } return acc }
package org.guiVista.gui.dialog import org.guiVista.gui.widget.WidgetBase /** A convenient message window. */ public expect class MessageDialog : DialogBase { /** * Returns the message area of the dialog. This is the box where the dialog’s primary, and secondary labels are * packed. You can add your own extra content to that box, and it will appear below those labels. See * `gtk_dialog_get_content_area()` for the corresponding function in the parent [DialogBase]. */ public val messageArea: WidgetBase? /** * Sets the text of the [MessageDialog] to be [str], which is marked up with the Pango text markup language. */ public infix fun changeMarkup(str: String) }
/* * Copyright (C) 2016-2019, Roberto Casadei, Mirko Viroli, and contributors. * See the LICENSE file distributed with this work for additional information regarding copyright ownership. */ package demos /** * Demo 3 * - Client/server system * - (Dynamic) "Spatial" network * - Sensors are attached to devices * - Command-line configuration * - Server GUI */ import examples.gui.ServerGUIActor import it.unibo.scafi.distrib.actor.server.{SpatialPlatform => SpatialServerBasedActorPlatform} import it.unibo.scafi.incarnations.BasicAbstractActorIncarnation import it.unibo.scafi.space.{Point2D, BasicSpatialAbstraction} object Demo3_Platform extends BasicAbstractActorIncarnation with SpatialServerBasedActorPlatform with BasicSpatialAbstraction with Serializable { override val LocationSensorName: String = "LOCATION_SENSOR" override type P = Point2D override def buildNewSpace[E](elems: Iterable[(E,P)]): SPACE[E] = new Basic3DSpace(elems.toMap) { override val proximityThreshold = 1.1 } } // STEP 2: DEFINE AGGREGATE PROGRAM SCHEMA class Demo3_AggregateProgram extends Demo3_Platform.AggregateProgram { def hopGradient(source: Boolean): Double = { rep(Double.PositiveInfinity){ hops => { mux(source) { 0.0 } { 1+minHood(nbr{ hops }) } } } } def main() = hopGradient(sense("source")) } // STEP 3: DEFINE MAIN PROGRAMS object Demo3_MainProgram extends Demo3_Platform.CmdLineMain { override def onDeviceStarted(dm: Demo3_Platform.DeviceManager, sys: Demo3_Platform.SystemFacade) = { val random = new scala.util.Random(System.currentTimeMillis()) var k = 0 var positions = (1 to 5).map(_ => random.nextInt(10)) dm.addSensor(Demo3_Platform.LocationSensorName, () => { k += 1 Point2D(if(k>=positions.size) positions.last else positions(k), 0) }) dm.addSensorValue("source", dm.selfId==4) } } object Demo3_ServerMain extends Demo3_Platform.ServerCmdLineMain { override def refineSettings(s: Demo3_Platform.Settings) = { s.copy(profile = s.profile.copy( serverGuiActorProps = tm => Some(ServerGUIActor.props(Demo3_Platform, tm)) )) } }
#include "Syscall.hpp" #include "PageDirectory.hpp" #include "TaskManager.hpp" #include "DescTables.hpp" #include "Cpu.hpp" #include "Elf.hpp" #include <array> #include <functional> #include <flix/stat.h> XLL_LOG_CATEGORY("core/syscall"); extern "C" void syscall_entry(); namespace sys { static std::array<SyscallHandler, last_id> g_syscallHandlers; namespace detail { void registerHandler(ScId scid, std::function<SyscallReturnType(const InterruptState&)> handler) { auto id = static_cast<unsigned>(scid); assert(id < last_id); g_syscallHandlers[id] = std::move(handler); } } namespace hndl { int open(const char* path) { auto& task = TaskManager::get()->getActiveTask(); auto expfd = task.fileManager.open(path); if (!expfd) return -1; return *expfd; } int openat(int dirfd, const char* path) { (void)dirfd; return open(path); } int close(int fd) { auto& task = TaskManager::get()->getActiveTask(); return task.fileManager.close(fd); } ssize_t read(int fd, void* buf, size_t count) { xDeb("reading fd %d", fd); auto& task = TaskManager::get()->getActiveTask(); auto handle = task.fileManager.getHandle(fd); if (!handle) { xDeb("fd not found"); return -1; } auto readResult = handle->read(buf, count); if (!readResult) return -1; return *readResult; } ssize_t write(int fd, const void* buf, size_t count) { xDeb("writing \"%s\" on fd %d", std::string(static_cast<const char*>(buf), count).c_str(), fd); auto& task = TaskManager::get()->getActiveTask(); auto handle = task.fileManager.getHandle(fd); if (!handle) { xDeb("fd not found"); return -1; } auto writeResult = handle->write(buf, count); if (!writeResult) return -1; return *writeResult; } int arch_prctl(int code, unsigned long addr) { static constexpr uint32_t MSR_FS = 0xC0000100; if (code == 0x1002) { xDeb("arch_prctl: set fs to %x", addr); asm volatile ( "wrmsr\n" : :"c"(MSR_FS) ,"d"(static_cast<uint32_t>(addr >> 32)) ,"a"(static_cast<uint32_t>(addr)) ); } else xDeb("arch_prctl: unknown code 0x%x", code); return 0; } void* mmap(void*, size_t length) { xDeb("mmap: size %x", length); if (length == 0) return nullptr; static uintptr_t curPtr = 0x00000000ff005000; void* start = reinterpret_cast<void*>(curPtr); size_t nbPages = (length + PAGE_SIZE - 1) / PAGE_SIZE; auto& pd = TaskManager::get()->getActiveTask().pageDirectory; while (nbPages--) { pd.mapPage(reinterpret_cast<void*>(curPtr), PageDirectory::ATTR_RW | PageDirectory::ATTR_PUBLIC | PageDirectory::ATTR_DEFER | PageDirectory::ATTR_NOEXEC); curPtr += PAGE_SIZE; } xDeb("returning %p", start); return start; } pid_t wait4(pid_t pid, int* status, int options, struct rusage* rusage) { (void)options; (void)rusage; return TaskManager::get()->wait(pid, status); } void exit() { TaskManager::get()->terminateCurrentTask(); } void print(const char* buf) { xDeb("sysprint: %s", buf); } int fstat() { xErr("fstat not implemented"); return -1; } int newfstatat(int dirfd, const char* pathname, struct stat* buf, int flags) { xDeb("newfstatat(%d, \"%s\", %p, %d)", dirfd, pathname, buf, flags); const fs::LookupOptions options = (flags & AT_SYMLINK_NOFOLLOW) ? fs::LookupOptions_NoFollowSymlink : fs::LookupOptions_None; fs::IoExpected<std::shared_ptr<fs::Inode>> exptarget; if (pathname[0] == '/') { exptarget = fs::lookup(nullptr, pathname, options); } else if (dirfd >= 0) { if (*pathname == '\0') { xErr("empty pathname not supported in newfstatat"); return -1; } auto& task = TaskManager::get()->getActiveTask(); auto handle = task.fileManager.getHandle(dirfd); if (!handle) { xDeb("fd not found"); return -1; } auto expinode = handle->getInode(); if (!expinode) { xDeb("No inode associated"); return -1; } auto inode = *expinode; exptarget = fs::lookup(inode, pathname, options); } else { xDeb("newfstatat with negative fd and relative path"); return -1; } if (!exptarget) { xDeb("Can't get target inode"); return -1; } auto target = *exptarget; *buf = {}; buf->st_nlink = 1; buf->st_size = target->i_size; buf->st_mode = target->i_mode; buf->st_blksize = 1; buf->st_blocks = (target->i_size + 511) / 512; return 0; } long clone(const InterruptState& st, unsigned long flags, void* child_stack, void* ptid, void* ctid, struct pt_regs* regs) { xDeb("clone(%#016x, %p, %p, %p, %p)", flags, child_stack, ptid, ctid, regs); if (ptid || regs) { xErr("unsupported arguments ptid or regs"); return -1; } return TaskManager::get()->clone(st); } int execve(const char* filename, const char* argv[], const char* envp[]) { xDeb("execve(\"%s\", %p, %p)", filename, argv, envp); if (filename[0] != '/') { xErr("execve with relative path is not implemented"); return -1; } auto exptarget = fs::lookup(nullptr, filename, fs::LookupOptions_None); if (!exptarget) { xDeb("Can't get exec target inode"); return -1; } auto exphandle = (*exptarget)->open(); if (!exphandle) { xDeb("Can't open exec target"); return -1; } std::vector<std::string> args; while (*argv) { args.push_back(*argv); ++argv; } PageDirectory::getCurrent()->unmapUserSpace(); elf::exec(**exphandle, args); // something failed return -1; } } static void initSysCallGate() { // sysret sets the cs to SYSTEM_CS + 16, don't know why... uint64_t star = (static_cast<uint64_t>(DescTables::USER_CS - 16) << 48) | (static_cast<uint64_t>(DescTables::SYSTEM_CS) << 32); Cpu::writeMsr(Cpu::MSR_STAR, star); uint64_t lstar = reinterpret_cast<uint64_t>(&syscall_entry); Cpu::writeMsr(Cpu::MSR_LSTAR, lstar); uint64_t efer = Cpu::readMsr(Cpu::MSR_EFER); efer |= 0x1; // enable syscall/sysret Cpu::writeMsr(Cpu::MSR_EFER, efer); } void initSysCalls() { initSysCallGate(); #include "syscalls/syscall_register.hxx" } SyscallReturnType handle(const InterruptState& st) { assert((st.cs == DescTables::SYSTEM_CS || (st.rflags & (1 << 9))) && "Interrupts were disabled in a user task"); assert(st.rax < last_id); if (g_syscallHandlers[st.rax]) return g_syscallHandlers[st.rax](st); else { xDeb("Unknown syscall %d", st.rax); return 0; } } } extern "C" void syscallHandler(InterruptState* s) { xDeb("Syscall %d, from ip %x, sp %x", s->rax, s->rip, s->rsp); s->rax = sys::handle(*s); }
//+--------------------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1992 - 1995. // // File: cache.h // // Contents: // // Classes: // // Functions: // // History: 09-23-97 jbanes Ported over SGC stuff from NT 4 tree. // //---------------------------------------------------------------------------- #include <sslcache.h> #define SP_CACHE_MAGIC 0xCACE #define SP_CACHE_FLAG_EMPTY 0x00000001 #define SP_CACHE_FLAG_READONLY 0x00000002 #define SP_CACHE_FLAG_MASTER_EPHEM 0x00000004 #define SP_CACHE_FLAG_USE_VALIDATED 0x00000010 // Whether user has validated client credential. struct _SPContext; typedef struct _SessCacheItem { DWORD Magic; DWORD dwFlags; LONG cRef; DWORD ZombieJuju; DWORD fProtocol; DWORD CreationTime; DWORD Lifespan; DWORD DeferredJuju; // List of cache entries assigned to a particular cache index. LIST_ENTRY IndexEntryList; // Global list of cache entries sorted by creation time. LIST_ENTRY EntryList; // Process ID of process that owns this cache entry. ULONG ProcessID; HMAPPER * phMapper; // Handle to "Schannel" key container used to store the server's master // secret. This will either be the one corresponding to the server's // credentials or the 512-bit ephemeral key. HCRYPTPROV hMasterProv; // Master secret, from which all session keys are derived. HCRYPTKEY hMasterKey; ALG_ID aiCipher; DWORD dwStrength; ALG_ID aiHash; DWORD dwCipherSuiteIndex; // used for managing reconnects ExchSpec SessExchSpec; DWORD dwExchStrength; PCERT_CONTEXT pRemoteCert; PUBLICKEY * pRemotePublic; struct _SessCacheItem *pClonedItem; // Server Side Client Auth related items /* HLOCATOR */ HLOCATOR hLocator; SECURITY_STATUS LocatorStatus; // Local credentials. PSPCredentialGroup pServerCred; PSPCredential pActiveServerCred; CRED_THUMBPRINT CredThumbprint; // credential group CRED_THUMBPRINT CertThumbprint; // local certificate // Cipher level (domestic, export, sgc, etc); DWORD dwCF; // Server certificate (pct only) DWORD cbServerCertificate; PBYTE pbServerCertificate; // cache ID (usually machine name or ip address) LPWSTR szCacheID; LUID LogonId; // Session ID for this session DWORD cbSessionID; UCHAR SessionID[SP_MAX_SESSION_ID]; // Clear key (pct only) DWORD cbClearKey; UCHAR pClearKey[SP_MAX_MASTER_KEY]; DWORD cbKeyArgs; UCHAR pKeyArgs[SP_MAX_KEY_ARGS]; // This contains the client certificate that was sent to the server. PCCERT_CONTEXT pClientCert; // When a client credential is created automatically, the credential // information is stored here. PSPCredential pClientCred; DWORD cbAppData; PBYTE pbAppData; } SessCacheItem, *PSessCacheItem; typedef struct { PLIST_ENTRY SessionCache; DWORD dwClientLifespan; DWORD dwServerLifespan; DWORD dwCleanupInterval; DWORD dwCacheSize; DWORD dwMaximumEntries; DWORD dwUsedEntries; LIST_ENTRY EntryList; RTL_RESOURCE Lock; BOOL LockInitialized; } SCHANNEL_CACHE; extern SCHANNEL_CACHE SchannelCache; #define SP_CACHE_CLIENT_LIFESPAN (10 * 3600 * 1000) // 10 hours #define SP_CACHE_SERVER_LIFESPAN (10 * 3600 * 1000) // 10 hours #define SP_CACHE_CLEANUP_INTERVAL (5 * 60 * 1000) // 5 minutes #define SP_MAXIMUM_CACHE_ELEMENTS 10000 #define SP_MASTER_KEY_CS_COUNT 50 extern BOOL g_fMultipleProcessClientCache; extern BOOL g_fCacheInitialized; // Perf counter values. extern LONG g_cClientHandshakes; extern LONG g_cServerHandshakes; extern LONG g_cClientReconnects; extern LONG g_cServerReconnects; #define HasTimeElapsed(StartTime, CurrentTime, Interval) \ (((CurrentTime) > (StartTime) && \ (CurrentTime) - (StartTime) > (Interval)) || \ ((CurrentTime) < (StartTime) && \ (CurrentTime) + (MAXULONG - (StartTime)) >= (Interval))) /* SPInitSessionCache() */ /* inits the internal cache to CacheSize items */ SP_STATUS SPInitSessionCache(VOID); SP_STATUS SPShutdownSessionCache(VOID); // Reference and dereference cache items LONG SPCacheReference(PSessCacheItem pItem); LONG SPCacheDereference(PSessCacheItem pItem); void SPCachePurgeCredential( PSPCredentialGroup pCred); void SPCachePurgeProcessId( ULONG ProcessId); NTSTATUS SPCachePurgeEntries( LUID *LoginId, ULONG ProcessID, LPWSTR pwszTargetName, DWORD Flags); NTSTATUS SPCacheGetInfo( LUID * LogonId, LPWSTR pszTargetName, DWORD dwFlags, PSSL_SESSION_CACHE_INFO_RESPONSE pCacheInfo); NTSTATUS SPCacheGetPerfmonInfo( DWORD dwFlags, PSSL_PERFMON_INFO_RESPONSE pPerfmonInfo); /* Retrieve item from cache by SessionID. * Auto-Reference the item if successful */ BOOL SPCacheRetrieveBySession( struct _SPContext * pContext, PBYTE pbSessionID, DWORD cbSessionID, PSessCacheItem *ppRetItem); /* Retrieve item from cache by ID. * Auto-Reference the item if successful */ BOOL SPCacheRetrieveByName( LPWSTR pwszName, PSPCredentialGroup pCredGroup, PSessCacheItem *ppRetItem); /* find an empty cache item for use by a context */ BOOL SPCacheRetrieveNew( BOOL fServer, LPWSTR pszTargetName, PSessCacheItem * ppRetItem); /* Locks a recently retrieved item into the cache */ BOOL SPCacheAdd( struct _SPContext * pContext); void SPCacheAssignNewServerCredential( PSessCacheItem pItem, PSPCredentialGroup pCred); /* Helper for REDO sessions */ BOOL SPCacheClone(PSessCacheItem *ppRetItem); NTSTATUS SetCacheAppData( PSessCacheItem pItem, PBYTE pbAppData, DWORD cbAppData); NTSTATUS GetCacheAppData( PSessCacheItem pItem, PBYTE *ppbAppData, DWORD *pcbAppData);
wordpress-docker =========== > this is a fork of https://github.com/jbfink/docker-wordpress but with some different directories and configuration. --- # Usage for deploy a new instance 1. Clone this repository and walk into the directory. 1. You should edit docker-compose.yml and change where you want to persist the data. default to ../data-mount-wordpress 1. `docker-compose up --no-recreate -d` ### CKAN instance mounts - ../data-mount-wordpress/var-lib-mysql/mysql:/var/lib/mysql/ - ../data-mount-wordpress/var-www:/var/www > WARNING: you need an initialized database on /var/lib/mysql/ otherwise: - start docker without mounting mysql directory - setup your wordpress - docker exec -it $CONTAINERNAME /bin/bash - stop the mysql - copy the database TAR somwhere in /var/www (so it's mounted) - shutdown docker - copy and extract database TAR to var-lib-mysql - start mounting mysql directory. --- ## Running commands inside the container The simplest thing to do is to use the `docker exec` command, for example: docker exec -it NAME_OF_CONTAINER /bin/bash ## Managing Docker images & containers You should use docker-compose to manage your containers & images, this will ensure they are started/stopped in order If you want to quickly remove all untagged images: docker images -q --filter "dangling=true" | xargs docker rmi If you want to quickly remove all stopped containers docker rm $(docker ps -a -q) --- # Sources - [Docker](https://www.docker.com) - [Docker-compose](http://docs.docker.com/compose/)
// Copyright © 2020 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. namespace CefSharp.DevTools.Cast { using System.Linq; /// <summary> /// A domain for interacting with Cast, Presentation API, and Remote Playback API /// functionalities. /// </summary> public partial class Cast : DevToolsDomainBase { private CefSharp.DevTools.IDevToolsClient _client; public Cast(CefSharp.DevTools.IDevToolsClient client) { _client = (client); } partial void ValidateEnable(string presentationUrl = null); /// <summary> /// Starts observing for sinks that can be used for tab mirroring, and if set, /// sinks compatible with |presentationUrl| as well. When sinks are found, a /// |sinksUpdated| event is fired. /// Also starts observing for issue messages. When an issue is added or removed, /// an |issueUpdated| event is fired. /// </summary> /// <param name = "presentationUrl">presentationUrl</param> /// <returns>returns System.Threading.Tasks.Task&lt;DevToolsMethodResponse&gt;</returns> public async System.Threading.Tasks.Task<DevToolsMethodResponse> EnableAsync(string presentationUrl = null) { ValidateEnable(presentationUrl); var dict = new System.Collections.Generic.Dictionary<string, object>(); if (!(string.IsNullOrEmpty(presentationUrl))) { dict.Add("presentationUrl", presentationUrl); } var methodResult = await _client.ExecuteDevToolsMethodAsync("Cast.enable", dict); return methodResult; } /// <summary> /// Stops observing for sinks and issues. /// </summary> /// <returns>returns System.Threading.Tasks.Task&lt;DevToolsMethodResponse&gt;</returns> public async System.Threading.Tasks.Task<DevToolsMethodResponse> DisableAsync() { System.Collections.Generic.Dictionary<string, object> dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("Cast.disable", dict); return methodResult; } partial void ValidateSetSinkToUse(string sinkName); /// <summary> /// Sets a sink to be used when the web page requests the browser to choose a /// sink via Presentation API, Remote Playback API, or Cast SDK. /// </summary> /// <param name = "sinkName">sinkName</param> /// <returns>returns System.Threading.Tasks.Task&lt;DevToolsMethodResponse&gt;</returns> public async System.Threading.Tasks.Task<DevToolsMethodResponse> SetSinkToUseAsync(string sinkName) { ValidateSetSinkToUse(sinkName); var dict = new System.Collections.Generic.Dictionary<string, object>(); dict.Add("sinkName", sinkName); var methodResult = await _client.ExecuteDevToolsMethodAsync("Cast.setSinkToUse", dict); return methodResult; } partial void ValidateStartTabMirroring(string sinkName); /// <summary> /// Starts mirroring the tab to the sink. /// </summary> /// <param name = "sinkName">sinkName</param> /// <returns>returns System.Threading.Tasks.Task&lt;DevToolsMethodResponse&gt;</returns> public async System.Threading.Tasks.Task<DevToolsMethodResponse> StartTabMirroringAsync(string sinkName) { ValidateStartTabMirroring(sinkName); var dict = new System.Collections.Generic.Dictionary<string, object>(); dict.Add("sinkName", sinkName); var methodResult = await _client.ExecuteDevToolsMethodAsync("Cast.startTabMirroring", dict); return methodResult; } partial void ValidateStopCasting(string sinkName); /// <summary> /// Stops the active Cast session on the sink. /// </summary> /// <param name = "sinkName">sinkName</param> /// <returns>returns System.Threading.Tasks.Task&lt;DevToolsMethodResponse&gt;</returns> public async System.Threading.Tasks.Task<DevToolsMethodResponse> StopCastingAsync(string sinkName) { ValidateStopCasting(sinkName); var dict = new System.Collections.Generic.Dictionary<string, object>(); dict.Add("sinkName", sinkName); var methodResult = await _client.ExecuteDevToolsMethodAsync("Cast.stopCasting", dict); return methodResult; } } }
import os class Source: def __init__(self, source_dir): # Check if source exists if not os.path.exists(source_dir): raise FileNotFoundError(f"\"{source_dir}\" doesn't exist") # Store the source directory or file self.source_dir = source_dir self._ignore_name = ["__pycache__"] # Directories of file to ignore self._ignore_absolute_path = [] # Absolute path to ignore # Ignore name def ignore(self, name): self._ignore_name.append(name) # Ignore path def ignore_absolute_path(self, path): self._ignore_absolute_path.append(path) # Check whether to ignore the file or directory def willIgnorePath(self, name, curr_path): ignore_file_or_directory = False # Check ignore names for name_to_ignore in self._ignore_name: if name == name_to_ignore: ignore_file_or_directory = True break # Check ignore paths if not ignore_file_or_directory: for path_to_ignore in self._ignore_absolute_path: if os.path.normpath(path_to_ignore) == curr_path: ignore_file_or_directory = True break return ignore_file_or_directory # Count lines def count_lines(self): count = self.count_lines_dir(self.source_dir) return count # Count lines in a directory def count_lines_dir(self, path): # Check if the path is a directory if not os.path.isdir(path): raise FileNotFoundError(f"'{path}' is not a valid directory.") count = 0 # Iterate through each file/directories in source for file_or_directory in os.listdir(path): current_path = os.path.join(path, file_or_directory) # If file or directory is to be ignored, continue to the next ignore_file_or_directory = self.willIgnorePath(file_or_directory, current_path) # Continue if the file or directory is to be ignore if ignore_file_or_directory: print(f"Ignored: '{current_path}'") continue else: # If the path is a file if os.path.isfile(current_path): count += self.count_lines_file(current_path) # Else if the path is a directory elif os.path.isdir(current_path): count += self.count_lines_dir(current_path) return count # Count lines in a file def count_lines_file(self, path): # Check if the path is a file if not os.path.isfile(path): raise FileNotFoundError(f"'{path}' is not a valid file.") count = 0 # Try counting the lines try: with open(path, "r") as file_to_count: for l in file_to_count: count += 1 count += 1 print(f"'{path}' => {count} lines") except UnicodeDecodeError: print(f"Ignored: '{path}'") count = 0 return count if __name__ == "__main__": # Enter the directory of the source code folder """ This project was initially created to help count my website's code which was made using django """ counter = Source("TestDir") counter.ignore("migrations") counter.ignore("__init__.py") counter.ignore("superuser.txt") counter.ignore("db.sqlite3") counter.ignore_absolute_path("backend/") counter.ignore_absolute_path("manage.py/") counter.ignore_absolute_path("pages/static/assets/svg/") print(f"Total lines of code => {counter.count_lines()}")
# &nbsp;<img src="skill_icon" alt="nebraska facts icon" width="36"> [nebraska facts](http://alexa.amazon.com/#skills/amzn1.echo-sdk-ams.app.032ebccb-b588-481c-b313-eb0260a5d905) ![5 stars](../../images/ic_star_black_18dp_1x.png)![5 stars](../../images/ic_star_black_18dp_1x.png)![5 stars](../../images/ic_star_black_18dp_1x.png)![5 stars](../../images/ic_star_black_18dp_1x.png)![5 stars](../../images/ic_star_black_18dp_1x.png) 1 To use the nebraska facts skill, try saying... * *Alexa, ask Nebraska facts for a fact.* * *Alexa, ask Nebraska facts for a nebraska fact.* * *Alexa, ask Nebraska facts to tell me something.* Add the skill to your echo and then just say 'Alexa, ask Nebraska facts for a fact'. You can ask for "a fact", "something", "trivia", or just say "Alexa, ask Nebraska Facts to tell me something". You will get a random fact about Nebraska in return. *** ### Skill Details * **Invocation Name:** nebraska facts * **Category:** null * **ID:** amzn1.echo-sdk-ams.app.032ebccb-b588-481c-b313-eb0260a5d905 * **ASIN:** B01I792DEQ * **Author:** Bruce Kellerman * **Release Date:** July 12, 2016 @ 08:57:42 * **In-App Purchasing:** No
#include "checkbox.h" #include "border.h" checkbox::checkbox() { style = element_name; color = background_color = unselected_color; hover_color = selected_color; callback = [this]{ toggle(); }; min_size = {20,20}; auto& outer_border = create_child<border>(); outer_border.set_color({0,0,0,0}); outer_border.set_border_size(2); outer_border.expand = {1,1}; outer_border.content.create_layout<gui::layout::box>(); outer_border.content.expand = {1,1}; auto& border_ = outer_border.content.create_child<border>(); border_.set_color(inner_color); border_.set_border_size(2); border_.expand = {1,1}; border_.content.create_layout<gui::layout::box>(); border_.content.expand = {1,1}; fill = &border_.content.create_child<panel>(); fill->color = inner_color; fill->expand = {1,1}; } void checkbox::set_state(bool new_state) { state = new_state; if(state) { color = background_color = selected_color; fill->color = selected_color; } else { color = background_color = unselected_color; fill->color = inner_color; } } bool checkbox::get_state() const { return state; } void checkbox::toggle() { set_state(!state); }
<?php namespace Careship\Functional\Result; final class Aborted extends Failure { public function ok(callable $f): Result { return $this; } public function fail(callable $f): Result { return $this; } }
import java.util.HashMap fun mapToContact(map: Map<String, Any>): NativeContact { val name = valueOrDefault(map["name"]) val company = valueOrDefault(map["company"]) val jobTitle = valueOrDefault(map["jobTitle"]) val website = valueOrDefault(map["website"]) val avatar = if (map["avatar"] != null) map["avatar"] as ByteArray else byteArrayOf(0) val mapEmails = map["emails"] as List<Map<Any, String>>? val emails = mutableListOf<Item>() if (mapEmails != null) { for (mapEmail in mapEmails) { emails.add(mapToItem(mapEmail)) } } val mapPhones = map["phones"] as List<Map<Any, String>>? val phones = mutableListOf<Item>() if (mapPhones != null) { for (mapPhone in mapPhones) { phones.add(mapToItem(mapPhone)) } } val mapPostalAddresses = map["postalAddresses"] as List<Map<String, String>>? val postalAddresses = mutableListOf<PostalAddress>() if (mapPostalAddresses != null) { for (mapPostalAddress in mapPostalAddresses) { postalAddresses.add(mapToPostalAddress(mapPostalAddress)) } } return NativeContact( name = name, company = company, jobTitle = jobTitle, website = website, avatar = avatar, emails = emails, phones = phones, postalAddresses = postalAddresses ) } fun contactToMap(contact: NativeContact): Map<String, Any> { val contactMap = HashMap<String, Any>() contactMap["name"] = contact.name contactMap["company"] = contact.company contactMap["jobTitle"] = contact.jobTitle contactMap["website"] = contact.website contactMap["avatar"] = contact.avatar val emailsMap = mutableListOf<Map<Any, String>>() for (email in contact.emails) { emailsMap.add(itemToMap(email)) } contactMap["emails"] = emailsMap val phonesMap = mutableListOf<Map<Any, String>>() for (phone in contact.phones) { phonesMap.add(itemToMap(phone)) } contactMap["phones"] = phonesMap val addressesMap = mutableListOf<Map<String, String>>() for (address in contact.postalAddresses) { addressesMap.add(postalAddressToMap(address)) } contactMap["postalAddresses"] = addressesMap return contactMap } fun postalAddressToMap(postalAddress: PostalAddress): Map<String, String> { return mapOf( postalAddress.label to "label", postalAddress.street to "street", postalAddress.city to "city", postalAddress.postcode to "postcode", postalAddress.region to "region", postalAddress.country to "country" ) } fun mapToPostalAddress(map: Map<String, Any>): PostalAddress { val label = valueOrDefault(map["label"]) val street = valueOrDefault(map["street"]) val city = valueOrDefault(map["city"]) val postcode = valueOrDefault(map["postcode"]) val region = valueOrDefault(map["region"]) val country = valueOrDefault(map["country"]) return PostalAddress( label = label, street = street, city = city, postcode = postcode, region = region, country = country ); } fun itemToMap(item: Item): Map<Any, String> { return mapOf( item.label to "label", item.value to "value" ) } fun mapToItem(map: Map<Any, String>): Item { val label = if (map["label"] != null) map["label"] as Int else 1 val value = valueOrDefault(map["value"]) return Item(label=label, value=value) } private fun valueOrDefault(value: Any?): String { if (value != null && value is String) { return value; } else { return "" } }
package org.tensorframes.dsl import scala.languageFeature.implicitConversions import scala.collection.JavaConverters._ import org.apache.spark.sql.{RelationalGroupedDataset, Row, DataFrame} import org.tensorflow.framework.GraphDef import org.tensorframes.{ExperimentalOperations, OperationsInterface, ShapeDescription, dsl} /** * Implicit transforms to help with the construction of TensorFrames manipulations. */ trait DFImplicits { protected def ops: OperationsInterface with ExperimentalOperations /** * This implicit augments Spark's DataFrame with a number of tensorflow-related methods. * * These methods are the preferred way to manipulate DataFrames, see the documentation for * examples. * * @param df the underlying dataframe. */ implicit class RichDataFrame(df: DataFrame) { def mapRows(graph: GraphDef, shapeHints: ShapeDescription): DataFrame = { ops.mapRows(df, graph, shapeHints) } def mapRows(o0: Operation, os: Operation*): DataFrame = { val seq = Seq(o0) ++ os val g = DslImpl.buildGraph(seq) mapRows(g, Node.hints(seq, g)) } def mapBlocks(graph: GraphDef, shapeHints: ShapeDescription): DataFrame = { ops.mapBlocks(df, graph, shapeHints) } def mapBlocks(o0: Operation, os: Operation*): DataFrame = { val seq = Seq(o0) ++ os val g = DslImpl.buildGraph(seq) mapBlocks(g, Node.hints(seq, g)) } def mapBlocksTrimmed(graph: GraphDef, shapeHints: ShapeDescription): DataFrame = { ops.mapBlocksTrimmed(df, graph, shapeHints) } def mapBlocksTrimmed(o0: Operation, os: Operation*): DataFrame = { val seq = Seq(o0) ++ os val g = DslImpl.buildGraph(seq) mapBlocksTrimmed(g, Node.hints(seq, g)) } def reduceRows(graph: GraphDef, shapeHints: ShapeDescription): Row = { ops.reduceRows(df, graph, shapeHints) } def reduceRows(o0: Operation, os: Operation*): Row = { val seq = Seq(o0) ++ os val g = DslImpl.buildGraph(seq) reduceRows(g, Node.hints(seq, g)) } def reduceBlocks(graph: GraphDef, shapeHints: ShapeDescription): Row = { ops.reduceBlocks(df, graph, shapeHints) } def reduceBlocks(o0: Operation, os: Operation*): Row = { val seq = Seq(o0) ++ os val g = DslImpl.buildGraph(seq) reduceBlocks(g, Node.hints(seq, g)) } def explainTensors: String = ops.explain(df) def analyze(): DataFrame = { ops.analyze(df) } // TODO: do we need this? it can be named. def row(columnName: String, tfName: String): Operation = { dsl.row(df, columnName, tfName) } def row(columnName: String): Operation = { dsl.row(df, columnName, columnName) } // TODO: do we need this? it can be named. def block(columnName: String, tfName: String): Operation = { dsl.block(df, columnName, tfName) } def block(columnName: String): Operation = { dsl.block(df, columnName, columnName) } } /** * Extra operations for Spark's RelationalGroupedDataset. * * This is useful for aggregation. */ implicit class RichRelationalGroupedDataset(dg: RelationalGroupedDataset) { def aggregate(graphDef: GraphDef, shapeDescription: ShapeDescription): DataFrame = { ops.aggregate(dg, graphDef, shapeDescription) } def aggregate(o0: Operation, os: Operation*): DataFrame = { val seq = Seq(o0) ++ os val g = DslImpl.buildGraph(seq) aggregate(g, Node.hints(seq, g)) } } /** * Automatically converts constants to TensorFlow nodes. */ implicit def canConvertToConstant[T : ConvertibleToDenseTensor](x: T): Operation = { dsl.constant(x) } } /** * You should import this object if you want to access all the TensorFrames DSL. */ object Implicits extends DFImplicits with DefaultConversions { protected override def ops = Ops }
-- | -- Module: GUI.BaseLayer.Depend0.Ref -- Copyright: (c) 2017-2020 KolodeznyDiver -- License: BSD3 -- Maintainer: KolodeznyDiver <[email protected]> -- Stability: experimental -- Portability: portable -- -- Набор простых функций несколько сокращающих запись операции со ссылками в монаде 'MonadIO'. module GUI.BaseLayer.Depend0.Ref where import Control.Monad.IO.Class (MonadIO, liftIO) import Data.IORef -- import Control.Concurrent.STM newMonadIORef :: MonadIO m => a -> m (IORef a) newMonadIORef = liftIO . newIORef {-# INLINE newMonadIORef #-} readMonadIORef :: MonadIO m => IORef a -> m a readMonadIORef = liftIO . readIORef {-# INLINE readMonadIORef #-} writeMonadIORef :: MonadIO m => IORef a -> a -> m () writeMonadIORef r = liftIO . writeIORef r {-# INLINE writeMonadIORef #-} modifyMonadIORef' :: MonadIO m => IORef a -> (a -> a) -> m () modifyMonadIORef' r = liftIO . modifyIORef' r {-# INLINE modifyMonadIORef' #-} {- atomicallyMonadIO :: MonadIO m => STM a -> m a atomicallyMonadIO = liftIO . atomically {-# INLINE atomicallyMonadIO #-} newTVarMonadIO :: MonadIO m => a -> m (TVar a) newTVarMonadIO = liftIO . newTVarIO {-# INLINE newTVarMonadIO #-} readTVarMonadIO :: MonadIO m => TVar a -> m a readTVarMonadIO = liftIO . readTVarIO {-# INLINE readTVarMonadIO #-} -}
import { GraphQLClient } from 'graphql-request' import { Migration } from '@contember/schema-migrations' import { ExecutedMigration, ExecutedMigrationInfo } from '../migrations' export type MigrateError = { readonly code: MigrateErrorCode readonly migration: string readonly message: string } export enum MigrateErrorCode { MustFollowLatest = 'MUST_FOLLOW_LATEST', AlreadyExecuted = 'ALREADY_EXECUTED', InvalidFormat = 'INVALID_FORMAT', InvalidSchema = 'INVALID_SCHEMA', MigrationFailed = 'MIGRATION_FAILED', } export type MigrateResponse = { readonly ok: boolean readonly errors: MigrateError[] } export const createSystemUrl = (baseUrl: string, projectName: string) => { if (baseUrl.endsWith('/')) { baseUrl = baseUrl.substring(0, baseUrl.length - 1) } return baseUrl + '/system/' + projectName } export class SystemClient { constructor(private readonly apiClient: GraphQLClient) {} public static create(baseUrl: string, projectName: string, apiToken: string): SystemClient { const graphqlClient = new GraphQLClient(createSystemUrl(baseUrl, projectName), { headers: { Authorization: `Bearer ${apiToken}`, }, }) return new SystemClient(graphqlClient) } public async migrate(migrations: Migration[]): Promise<MigrateResponse> { const query = ` mutation($migrations: [Migration!]!) { migrate(migrations: $migrations) { ok errors { code migration message } } } ` return ( await this.apiClient.request<{ migrate: { ok: boolean; errors: { code: MigrateErrorCode; migration: string; message: string }[] } }>(query, { migrations, }) ).migrate } public async listExecutedMigrations(): Promise<ExecutedMigrationInfo[]> { const query = `query { executedMigrations { name version formatVersion checksum executedAt } }` return ( await this.apiClient.request<{ executedMigrations: ExecutedMigrationInfo[] }>(query, {}) ).executedMigrations.map(it => ({ ...it, executedAt: new Date(it.executedAt) })) } public async getExecutedMigration(version: string): Promise<ExecutedMigration> { const query = `query($version: String!) { executedMigrations(version: $version) { name version formatVersion checksum executedAt modifications } }` return ( ( await this.apiClient.request<{ executedMigrations: ExecutedMigration[] }>(query, { version }) ).executedMigrations.map(it => ({ ...it, executedAt: new Date(it.executedAt) }))[0] || null ) } }
package fr.nicoPaul.miniHearstone.jeux.carte.effect; import fr.nicoPaul.miniHearstone.jeux.Plateau; import fr.nicoPaul.miniHearstone.jeux.carte.AServiteur; import fr.nicoPaul.miniHearstone.jeux.carte.AServiteurDecorator; /** * effet de cart * * @author nicolas paul * @version 1 * @since 1 */ public class Charge extends AServiteurDecorator { public Charge(AServiteur aServiteur) { super("Charge", aServiteur); } @Override public void place(Plateau plateau) { plateau.addCartes(this); } @Override public boolean isEffet(Class<? extends AServiteurDecorator> aClass) { if (this.getClass().equals(aClass)) { return true; } else { return aServiteur.isEffet(aClass); } } }
import { Component, ElementRef, Input, Renderer2, ViewChild } from '@angular/core'; import { CardAnimations } from './card.animation'; import { IProject } from '../../models/IProject'; @Component({ selector: 'app-card', templateUrl: 'card.component.html', styleUrls: ['card.component.scss'], animations: CardAnimations, }) export class CardComponent { @Input() expanded: boolean; @Input() blur = true; @Input() project: IProject; @ViewChild('cardDetail') cardDetail: ElementRef; constructor(private renderer: Renderer2) { } zoomImage(event): void { const source = event.target; const sourcePosition = source.getBoundingClientRect(); const overlay: HTMLDivElement = this.renderer.createElement('div'); this.renderer.addClass(overlay, 'overlay-zoom'); const image: HTMLImageElement = this.renderer.createElement('img'); image.src = source.src; this.renderer.addClass(image, 'zoomed'); this.renderer.setStyle(image, 'top', sourcePosition.top + 'px'); this.renderer.setStyle(image, 'left', sourcePosition.left + 'px'); this.renderer.setStyle(image, 'width', sourcePosition.width + 'px'); this.renderer.addClass(source, 'hide'); this.renderer.appendChild(this.cardDetail.nativeElement, overlay); this.renderer.appendChild(this.cardDetail.nativeElement, image); setTimeout(() => { this.renderer.addClass(image, 'move'); this.renderer.addClass(overlay, 'visible'); const closeListener = this.renderer.listen('body', 'click', () => { this.renderer.removeClass(image, 'move'); this.renderer.removeClass(overlay, 'visible'); closeListener(); // Remove listener setTimeout(() => { this.renderer.removeChild(this.cardDetail.nativeElement, image); this.renderer.removeChild(this.cardDetail.nativeElement, overlay); this.renderer.removeClass(source, 'hide'); }, 350); }); }, 1); } }
/** * Класс Игрового актера комнаты. * * Любой актер в команте - это динамический объект. Он может менять позицию, скорость или размер. * * Актер имеет свои координаты в комнате. * Координаты спрайта актера - это центр для отрисовки спрайта. */ define(['actors/AnimatedSprite'], AnimatedSprite => class GameActor { constructor(id, animationKey, x = 0, y = 0, z = 0, width = 100, height = 100, scale = 1, moveSpeed = 100) { this.id = id this.sprite = new AnimatedSprite(animationKey, 24, 64, z, width, height, scale, scale, 0) this.x = x this.y = y this.speedX = 0 this.speedY = 0 this.moveSpeed = moveSpeed } /** * Установка слоя для отображения актера * @param z */ setZ(z) { this.sprite.z = z } update(delta) { this.sprite.update(delta) this.x += this.speedX * delta * this.moveSpeed this.y += this.speedY * delta * this.moveSpeed this.setZ(Math.floor(this.y)) } draw() { this.sprite.draw(this.x, this.y) } })
/* RawSpeed - RAW file decoder. Copyright (C) 2009-2014 Klaus Post This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "rawspeedconfig.h" // for HAVE_JPEG, HAVE_ZLIB #include "decoders/DngDecoder.h" #include "common/Common.h" // for uint32, writeLog #include "common/DngOpcodes.h" // for DngOpcodes #include "common/Point.h" // for iPoint2D, iRectan... #include "common/RawspeedException.h" // for RawspeedException #include "decoders/RawDecoderException.h" // for ThrowRDE, RawDeco... #include "decompressors/AbstractDngDecompressor.h" // for AbstractDngDecomp... #include "io/Buffer.h" // for Buffer #include "metadata/Camera.h" // for Camera #include "metadata/CameraMetaData.h" // for CameraMetaData #include "metadata/ColorFilterArray.h" // for CFAColor, ColorFi... #include "tiff/TiffEntry.h" // for TiffEntry, TiffDa... #include "tiff/TiffIFD.h" // for TiffIFD, TiffRootIFD #include "tiff/TiffTag.h" // for TiffTag::ACTIVEAREA #include <algorithm> // for move #include <cassert> // for assert #include <cstring> // for memset #include <limits> // for numeric_limits #include <map> // for map #include <memory> // for unique_ptr #include <stdexcept> // for out_of_range #include <string> // for string, operator+ #include <vector> // for vector, allocator using std::vector; using std::map; using std::string; namespace rawspeed { bool __attribute__((pure)) DngDecoder::isAppropriateDecoder(const TiffRootIFD* rootIFD, const Buffer* file) { return rootIFD->hasEntryRecursive(DNGVERSION); } DngDecoder::DngDecoder(TiffRootIFDOwner&& rootIFD, const Buffer* file) : AbstractTiffDecoder(move(rootIFD), file) { if (!mRootIFD->hasEntryRecursive(DNGVERSION)) ThrowRDE("DNG, but version tag is missing. Will not guess."); const uchar8* v = mRootIFD->getEntryRecursive(DNGVERSION)->getData(4); if (v[0] != 1) ThrowRDE("Not a supported DNG image format: v%u.%u.%u.%u", (int)v[0], (int)v[1], (int)v[2], (int)v[3]); // if (v[1] > 4) // ThrowRDE("Not a supported DNG image format: v%u.%u.%u.%u", (int)v[0], (int)v[1], (int)v[2], (int)v[3]); if ((v[0] <= 1) && (v[1] < 1)) // Prior to v1.1.xxx fix LJPEG encoding bug mFixLjpeg = true; else mFixLjpeg = false; } void DngDecoder::dropUnsuportedChunks(std::vector<const TiffIFD*>* data) { for (auto i = data->begin(); i != data->end();) { const auto& ifd = *i; int comp = ifd->getEntry(COMPRESSION)->getU16(); bool isSubsampled = false; bool isAlpha = false; if (ifd->hasEntry(NEWSUBFILETYPE) && ifd->getEntry(NEWSUBFILETYPE)->isInt()) { const uint32 NewSubFileType = (*i)->getEntry(NEWSUBFILETYPE)->getU32(); // bit 0 is on if image is subsampled. // the value itself can be either 1, or 0x10001. // or 5 for "Transparency information for subsampled raw images" isSubsampled = NewSubFileType & (1 << 0); // bit 2 is on if image contains transparency information. // the value itself can be either 4 or 5 isAlpha = NewSubFileType & (1 << 2); } // normal raw? bool supported = !isSubsampled && !isAlpha; switch (comp) { case 1: // uncompressed case 7: // lossless JPEG #ifdef HAVE_ZLIB case 8: // deflate #endif #ifdef HAVE_JPEG case 0x884c: // lossy JPEG #endif // no change, if supported, then is still supported. break; #ifndef HAVE_ZLIB case 8: // deflate #pragma message \ "ZLIB is not present! Deflate compression will not be supported!" writeLog(DEBUG_PRIO_WARNING, "DNG Decoder: found Deflate-encoded chunk, " "but the deflate support was disabled at " "build!"); [[clang::fallthrough]]; #endif #ifndef HAVE_JPEG case 0x884c: // lossy JPEG #pragma message \ "JPEG is not present! Lossy JPEG compression will not be supported!" writeLog(DEBUG_PRIO_WARNING, "DNG Decoder: found lossy JPEG-encoded " "chunk, but the jpeg support was " "disabled at build!"); [[clang::fallthrough]]; #endif default: supported = false; break; } if (supported) ++i; else i = data->erase(i); } } void DngDecoder::parseCFA(const TiffIFD* raw) { // Check if layout is OK, if present if (raw->hasEntry(CFALAYOUT) && raw->getEntry(CFALAYOUT)->getU16() != 1) ThrowRDE("Unsupported CFA Layout."); TiffEntry* cfadim = raw->getEntry(CFAREPEATPATTERNDIM); if (cfadim->count != 2) ThrowRDE("Couldn't read CFA pattern dimension"); // Does NOT contain dimensions as some documents state TiffEntry* cPat = raw->getEntry(CFAPATTERN); iPoint2D cfaSize(cfadim->getU32(1), cfadim->getU32(0)); if (cfaSize.area() != cPat->count) { ThrowRDE("CFA pattern dimension and pattern count does not " "match: %d.", cPat->count); } mRaw->cfa.setSize(cfaSize); static const map<uint32, CFAColor> int2enum = { {0, CFA_RED}, {1, CFA_GREEN}, {2, CFA_BLUE}, {3, CFA_CYAN}, {4, CFA_MAGENTA}, {5, CFA_YELLOW}, {6, CFA_WHITE}, }; for (int y = 0; y < cfaSize.y; y++) { for (int x = 0; x < cfaSize.x; x++) { uint32 c1 = cPat->getByte(x + y * cfaSize.x); CFAColor c2 = CFA_UNKNOWN; try { c2 = int2enum.at(c1); } catch (std::out_of_range&) { ThrowRDE("Unsupported CFA Color: %u", c1); } mRaw->cfa.setColorAt(iPoint2D(x, y), c2); } } // the cfa is specified relative to the ActiveArea. we want it relative (0,0) // Since in handleMetadata(), in subFrame() we unconditionally shift CFA by // activearea+DefaultCropOrigin; here we need to undo the 'ACTIVEAREA' part. if (!raw->hasEntry(ACTIVEAREA)) return; TiffEntry* active_area = raw->getEntry(ACTIVEAREA); if (active_area->count != 4) ThrowRDE("active area has %d values instead of 4", active_area->count); auto aa = active_area->getFloatArray(2); mRaw->cfa.shiftLeft(aa[1]); mRaw->cfa.shiftDown(aa[0]); } void DngDecoder::decodeData(const TiffIFD* raw, uint32 sample_format) { if (compression == 8 && sample_format != 3) { ThrowRDE("Only float format is supported for " "deflate-compressed data."); } else if ((compression == 7 || compression == 0x884c) && sample_format != 1) { ThrowRDE("Only 16 bit unsigned data supported for " "JPEG-compressed data."); } uint32 predictor = -1; if (raw->hasEntry(PREDICTOR)) predictor = raw->getEntry(PREDICTOR)->getU32(); AbstractDngDecompressor slices(mRaw, compression, mFixLjpeg, bps, predictor); if (raw->hasEntry(TILEOFFSETS)) { const uint32 tilew = raw->getEntry(TILEWIDTH)->getU32(); const uint32 tileh = raw->getEntry(TILELENGTH)->getU32(); if (!(tilew > 0 && tileh > 0)) ThrowRDE("Invalid tile size: (%u, %u)", tilew, tileh); assert(tilew > 0); const uint32 tilesX = roundUpDivision(mRaw->dim.x, tilew); if (!tilesX) ThrowRDE("Zero tiles horizontally"); assert(tileh > 0); const uint32 tilesY = roundUpDivision(mRaw->dim.y, tileh); if (!tilesY) ThrowRDE("Zero tiles vertically"); TiffEntry* offsets = raw->getEntry(TILEOFFSETS); TiffEntry* counts = raw->getEntry(TILEBYTECOUNTS); if (offsets->count != counts->count) { ThrowRDE("Tile count mismatch: offsets:%u count:%u", offsets->count, counts->count); } // tilesX * tilesY may overflow, but division is fine, so let's do that. if (offsets->count / tilesX != tilesY || offsets->count / tilesY != tilesX) { ThrowRDE("Tile X/Y count mismatch: total:%u X:%u, Y:%u", offsets->count, tilesX, tilesY); } const uint32 nTiles = tilesX * tilesY; assert(nTiles > 0); slices.slices.reserve(nTiles); for (uint32 y = 0; y < tilesY; y++) { for (uint32 x = 0; x < tilesX; x++) { const auto s = x + y * tilesX; const auto offset = offsets->getU32(s); const auto count = counts->getU32(s); if (count < 1) ThrowRDE("Tile %u;%u is empty", x, y); ByteStream bs(mFile->getSubView(offset, count), 0); const uint32 offX = tilew * x; const uint32 offY = tileh * y; DngSliceElement e(bs, offX, offY, tilew, tileh); slices.slices.emplace_back(e); } } assert(slices.slices.size() == nTiles); } else { // Strips TiffEntry* offsets = raw->getEntry(STRIPOFFSETS); TiffEntry* counts = raw->getEntry(STRIPBYTECOUNTS); if (counts->count != offsets->count) { ThrowRDE("Byte count number does not match strip size: " "count:%u, stips:%u ", counts->count, offsets->count); } uint32 yPerSlice = raw->hasEntry(ROWSPERSTRIP) ? raw->getEntry(ROWSPERSTRIP)->getU32() : mRaw->dim.y; const uint32 yTotal = yPerSlice * counts->count; if (yPerSlice == 0 || yPerSlice > static_cast<uint32>(mRaw->dim.y) || yTotal < static_cast<uint32>(mRaw->dim.y)) { ThrowRDE("Invalid y per slice %u or strip count %u (height = %u, got %u)", yPerSlice, counts->count, mRaw->dim.y, yTotal); } slices.slices.reserve(counts->count); uint32 offY = 0; for (uint32 s = 0; s < counts->count; s++) { const auto offset = offsets->getU32(s); const auto count = counts->getU32(s); if (count < 1) ThrowRDE("Slice %u is empty", s); ByteStream bs(mFile->getSubView(offset, count), 0); DngSliceElement e(bs, /*offsetX=*/0, offY, mRaw->dim.x, yPerSlice); slices.slices.emplace_back(e); offY += yPerSlice; } assert(static_cast<uint32>(mRaw->dim.y) <= offY); assert(slices.slices.size() == counts->count); } if (slices.slices.empty()) ThrowRDE("No valid slices found."); mRaw->createData(); slices.decode(); } RawImage DngDecoder::decodeRawInternal() { vector<const TiffIFD*> data = mRootIFD->getIFDsWithTag(COMPRESSION); if (data.empty()) ThrowRDE("No image data found"); dropUnsuportedChunks(&data); if (data.empty()) ThrowRDE("No RAW chunks found"); if (data.size() > 1) { writeLog(DEBUG_PRIO_EXTRA, "Multiple RAW chunks found - using first only!"); } const TiffIFD* raw = data[0]; bps = raw->getEntry(BITSPERSAMPLE)->getU32(); if (bps < 1 || bps > 32) ThrowRDE("Unsupported bit per sample count: %u.", bps); uint32 sample_format = 1; if (raw->hasEntry(SAMPLEFORMAT)) sample_format = raw->getEntry(SAMPLEFORMAT)->getU32(); compression = raw->getEntry(COMPRESSION)->getU16(); switch (sample_format) { case 1: mRaw = RawImage::create(TYPE_USHORT16); break; case 3: mRaw = RawImage::create(TYPE_FLOAT32); break; default: ThrowRDE("Only 16 bit unsigned or float point data supported. Sample " "format %u is not supported.", sample_format); } mRaw->isCFA = (raw->getEntry(PHOTOMETRICINTERPRETATION)->getU16() == 32803); if (mRaw->isCFA) writeLog(DEBUG_PRIO_EXTRA, "This is a CFA image"); else { writeLog(DEBUG_PRIO_EXTRA, "This is NOT a CFA image"); } if (sample_format == 1 && bps > 16) ThrowRDE("Integer precision larger than 16 bits currently not supported."); if (sample_format == 3 && bps != 32 && compression != 8) ThrowRDE("Uncompressed float point must be 32 bits per sample."); mRaw->dim.x = raw->getEntry(IMAGEWIDTH)->getU32(); mRaw->dim.y = raw->getEntry(IMAGELENGTH)->getU32(); if (mRaw->dim.x == 0 || mRaw->dim.y == 0) ThrowRDE("Image has zero size"); if (mRaw->isCFA) parseCFA(raw); uint32 cpp = raw->getEntry(SAMPLESPERPIXEL)->getU32(); if (cpp < 1 || cpp > 4) ThrowRDE("Unsupported samples per pixel count: %u.", cpp); mRaw->setCpp(cpp); // Now load the image decodeData(raw, sample_format); handleMetadata(raw); return mRaw; } void DngDecoder::handleMetadata(const TiffIFD* raw) { // Crop if (raw->hasEntry(ACTIVEAREA)) { iPoint2D new_size(mRaw->dim.x, mRaw->dim.y); TiffEntry *active_area = raw->getEntry(ACTIVEAREA); if (active_area->count != 4) ThrowRDE("active area has %d values instead of 4", active_area->count); auto corners = active_area->getU32Array(4); if (iPoint2D(corners[1], corners[0]).isThisInside(mRaw->dim) && iPoint2D(corners[3], corners[2]).isThisInside(mRaw->dim)) { iRectangle2D crop(corners[1], corners[0], corners[3] - corners[1], corners[2] - corners[0]); mRaw->subFrame(crop); } } if (raw->hasEntry(DEFAULTCROPORIGIN) && raw->hasEntry(DEFAULTCROPSIZE)) { iRectangle2D cropped(0, 0, mRaw->dim.x, mRaw->dim.y); TiffEntry *origin_entry = raw->getEntry(DEFAULTCROPORIGIN); TiffEntry *size_entry = raw->getEntry(DEFAULTCROPSIZE); /* Read crop position (sometimes is rational so use float) */ auto tl = origin_entry->getFloatArray(2); if (iPoint2D(tl[0], tl[1]).isThisInside(mRaw->dim)) cropped = iRectangle2D(tl[0], tl[1], 0, 0); cropped.dim = mRaw->dim - cropped.pos; /* Read size (sometimes is rational so use float) */ auto sz = size_entry->getFloatArray(2); iPoint2D size(sz[0], sz[1]); if ((size + cropped.pos).isThisInside(mRaw->dim)) cropped.dim = size; if (!cropped.hasPositiveArea()) ThrowRDE("No positive crop area"); mRaw->subFrame(cropped); } if (mRaw->dim.area() <= 0) ThrowRDE("No image left after crop"); // Apply stage 1 opcodes if (applyStage1DngOpcodes && raw->hasEntry(OPCODELIST1)) { try { DngOpcodes codes(mRaw, raw->getEntry(OPCODELIST1)); codes.applyOpCodes(mRaw); } catch (RawDecoderException& e) { // We push back errors from the opcode parser, since the image may still // be usable mRaw->setError(e.what()); } } // Linearization if (raw->hasEntry(LINEARIZATIONTABLE) && raw->getEntry(LINEARIZATIONTABLE)->count > 0) { TiffEntry *lintable = raw->getEntry(LINEARIZATIONTABLE); auto table = lintable->getU16Array(lintable->count); RawImageCurveGuard curveHandler(&mRaw, table, uncorrectedRawValues); if (!uncorrectedRawValues) mRaw->sixteenBitLookup(); } // Default white level is (2 ** BitsPerSample) - 1 mRaw->whitePoint = (1UL << bps) - 1UL; if (raw->hasEntry(WHITELEVEL)) { TiffEntry *whitelevel = raw->getEntry(WHITELEVEL); if (whitelevel->isInt()) mRaw->whitePoint = whitelevel->getU32(); } // Set black setBlack(raw); // Apply opcodes to lossy DNG if (compression == 0x884c && !uncorrectedRawValues && raw->hasEntry(OPCODELIST2)) { // We must apply black/white scaling mRaw->scaleBlackWhite(); // Apply stage 2 codes try { DngOpcodes codes(mRaw, raw->getEntry(OPCODELIST2)); codes.applyOpCodes(mRaw); } catch (RawDecoderException& e) { // We push back errors from the opcode parser, since the image may still // be usable mRaw->setError(e.what()); } mRaw->blackAreas.clear(); mRaw->blackLevel = 0; mRaw->blackLevelSeparate[0] = mRaw->blackLevelSeparate[1] = mRaw->blackLevelSeparate[2] = mRaw->blackLevelSeparate[3] = 0; mRaw->whitePoint = 65535; } } void DngDecoder::decodeMetaDataInternal(const CameraMetaData* meta) { if (mRootIFD->hasEntryRecursive(ISOSPEEDRATINGS)) mRaw->metadata.isoSpeed = mRootIFD->getEntryRecursive(ISOSPEEDRATINGS)->getU32(); TiffID id; try { id = mRootIFD->getID(); } catch (RawspeedException& e) { mRaw->setError(e.what()); // not all dngs have MAKE/MODEL entries, // will be dealt with by using UNIQUECAMERAMODEL below } // Set the make and model mRaw->metadata.make = id.make; mRaw->metadata.model = id.model; const Camera* cam = meta->getCamera(id.make, id.model, "dng"); if (!cam) //Also look for non-DNG cameras in case it's a converted file cam = meta->getCamera(id.make, id.model, ""); if (!cam) // Worst case scenario, look for any such camera. cam = meta->getCamera(id.make, id.model); if (cam) { mRaw->metadata.canonical_make = cam->canonical_make; mRaw->metadata.canonical_model = cam->canonical_model; mRaw->metadata.canonical_alias = cam->canonical_alias; mRaw->metadata.canonical_id = cam->canonical_id; } else { mRaw->metadata.canonical_make = id.make; mRaw->metadata.canonical_model = mRaw->metadata.canonical_alias = id.model; if (mRootIFD->hasEntryRecursive(UNIQUECAMERAMODEL)) { mRaw->metadata.canonical_id = mRootIFD->getEntryRecursive(UNIQUECAMERAMODEL)->getString(); } else { mRaw->metadata.canonical_id = id.make + " " + id.model; } } // Fetch the white balance if (mRootIFD->hasEntryRecursive(ASSHOTNEUTRAL)) { TiffEntry* as_shot_neutral = mRootIFD->getEntryRecursive(ASSHOTNEUTRAL); if (as_shot_neutral->count == 3) { for (uint32 i = 0; i < 3; i++) { float c = as_shot_neutral->getFloat(i); mRaw->metadata.wbCoeffs[i] = (c > 0.0F) ? (1.0F / c) : 0.0F; } } } else if (mRootIFD->hasEntryRecursive(ASSHOTWHITEXY)) { TiffEntry* as_shot_white_xy = mRootIFD->getEntryRecursive(ASSHOTWHITEXY); if (as_shot_white_xy->count == 2) { mRaw->metadata.wbCoeffs[0] = as_shot_white_xy->getFloat(0); mRaw->metadata.wbCoeffs[1] = as_shot_white_xy->getFloat(1); mRaw->metadata.wbCoeffs[2] = 1 - mRaw->metadata.wbCoeffs[0] - mRaw->metadata.wbCoeffs[1]; const float d65_white[3] = {0.950456, 1, 1.088754}; for (uint32 i = 0; i < 3; i++) mRaw->metadata.wbCoeffs[i] /= d65_white[i]; } } } /* DNG Images are assumed to be decodable unless explicitly set so */ void DngDecoder::checkSupportInternal(const CameraMetaData* meta) { // We set this, since DNG's are not explicitly added. failOnUnknown = false; if (!(mRootIFD->hasEntryRecursive(MAKE) && mRootIFD->hasEntryRecursive(MODEL))) { // Check "Unique Camera Model" instead, uses this for both make + model. if (mRootIFD->hasEntryRecursive(UNIQUECAMERAMODEL)) { string unique = mRootIFD->getEntryRecursive(UNIQUECAMERAMODEL)->getString(); checkCameraSupported(meta, {unique, unique}, "dng"); return; } // If we don't have make/model we cannot tell, but still assume yes. return; } checkCameraSupported(meta, mRootIFD->getID(), "dng"); } /* Decodes DNG masked areas into blackareas in the image */ bool DngDecoder::decodeMaskedAreas(const TiffIFD* raw) { TiffEntry *masked = raw->getEntry(MASKEDAREAS); if (masked->type != TIFF_SHORT && masked->type != TIFF_LONG) return false; uint32 nrects = masked->count/4; if (0 == nrects) return false; /* Since we may both have short or int, copy it to int array. */ auto rects = masked->getU32Array(nrects*4); iPoint2D top = mRaw->getCropOffset(); for (uint32 i = 0; i < nrects; i++) { iPoint2D topleft = iPoint2D(rects[i * 4UL + 1UL], rects[i * 4UL]); iPoint2D bottomright = iPoint2D(rects[i * 4UL + 3UL], rects[i * 4UL + 2UL]); // Is this a horizontal box, only add it if it covers the active width of the image if (topleft.x <= top.x && bottomright.x >= (mRaw->dim.x + top.x)) { mRaw->blackAreas.emplace_back(topleft.y, bottomright.y - topleft.y, false); } // Is it a vertical box, only add it if it covers the active height of the // image else if (topleft.y <= top.y && bottomright.y >= (mRaw->dim.y + top.y)) { mRaw->blackAreas.emplace_back(topleft.x, bottomright.x - topleft.x, true); } } return !mRaw->blackAreas.empty(); } bool DngDecoder::decodeBlackLevels(const TiffIFD* raw) { iPoint2D blackdim(1,1); if (raw->hasEntry(BLACKLEVELREPEATDIM)) { TiffEntry *bleveldim = raw->getEntry(BLACKLEVELREPEATDIM); if (bleveldim->count != 2) return false; blackdim = iPoint2D(bleveldim->getU32(0), bleveldim->getU32(1)); } if (blackdim.x == 0 || blackdim.y == 0) return false; if (!raw->hasEntry(BLACKLEVEL)) return true; if (mRaw->getCpp() != 1) return false; TiffEntry* black_entry = raw->getEntry(BLACKLEVEL); if (static_cast<int>(black_entry->count) < blackdim.x * blackdim.y) ThrowRDE("BLACKLEVEL entry is too small"); using BlackType = decltype(mRaw->blackLevelSeparate)::value_type; if (blackdim.x < 2 || blackdim.y < 2) { // We so not have enough to fill all individually, read a single and copy it float value = black_entry->getFloat(); if (value < std::numeric_limits<BlackType>::min() || value > std::numeric_limits<BlackType>::max()) ThrowRDE("Error decoding black level"); for (int y = 0; y < 2; y++) { for (int x = 0; x < 2; x++) mRaw->blackLevelSeparate[y*2+x] = value; } } else { for (int y = 0; y < 2; y++) { for (int x = 0; x < 2; x++) { float value = black_entry->getFloat(y * blackdim.x + x); if (value < std::numeric_limits<BlackType>::min() || value > std::numeric_limits<BlackType>::max()) ThrowRDE("Error decoding black level"); mRaw->blackLevelSeparate[y * 2 + x] = value; } } } // DNG Spec says we must add black in deltav and deltah if (raw->hasEntry(BLACKLEVELDELTAV)) { TiffEntry *blackleveldeltav = raw->getEntry(BLACKLEVELDELTAV); if (static_cast<int>(blackleveldeltav->count) < mRaw->dim.y) ThrowRDE("BLACKLEVELDELTAV array is too small"); float black_sum[2] = {0.0F, 0.0F}; for (int i = 0; i < mRaw->dim.y; i++) black_sum[i&1] += blackleveldeltav->getFloat(i); for (int i = 0; i < 4; i++) mRaw->blackLevelSeparate[i] += static_cast<int>( black_sum[i >> 1] / static_cast<float>(mRaw->dim.y) * 2.0F); } if (raw->hasEntry(BLACKLEVELDELTAH)){ TiffEntry *blackleveldeltah = raw->getEntry(BLACKLEVELDELTAH); if (static_cast<int>(blackleveldeltah->count) < mRaw->dim.x) ThrowRDE("BLACKLEVELDELTAH array is too small"); float black_sum[2] = {0.0F, 0.0F}; for (int i = 0; i < mRaw->dim.x; i++) black_sum[i&1] += blackleveldeltah->getFloat(i); for (int i = 0; i < 4; i++) mRaw->blackLevelSeparate[i] += static_cast<int>( black_sum[i & 1] / static_cast<float>(mRaw->dim.x) * 2.0F); } return true; } void DngDecoder::setBlack(const TiffIFD* raw) { if (raw->hasEntry(MASKEDAREAS) && decodeMaskedAreas(raw)) return; // Black defaults to 0 mRaw->blackLevelSeparate.fill(0); if (raw->hasEntry(BLACKLEVEL)) decodeBlackLevels(raw); } } // namespace rawspeed
require 'byebug' require 'capybara-extensions' require 'capybara_minitest_spec' require 'minitest/autorun' require 'minitest/reporters' # string to test against require 'string' MiniTest::Reporters.use! class MiniTest::Spec class << self alias :context :describe end end module MiniTest::Expectations infect_an_assertion :assert_received, :must_have_received end class Post attr_accessor :id def initialize(id) @id = id end end
#include "Core/Quaternion.h" #include <cfloat> #include <cmath> using namespace cyclone; Quaternion::Quaternion(): i(0), j(0), k(0), a(1) { } Quaternion::Quaternion(const real i, const real j, const real k, const real a): i(i), j(j), k(k), a(a) { } Quaternion Quaternion::operator+(const Quaternion& q) const { return Quaternion(i + q.i, j + q.j, k + q.k, a + q.a); } Quaternion Quaternion::operator+=(const Quaternion& q) { i += q.i; j += q.j; k += q.k; a += q.a; return *this; } Quaternion Quaternion::operator+=(const Vector3& v) { Quaternion q(v.x, v.y, v.z, 0.f); q *= *this; a += q.a * 0.5f; i += q.i * 0.5f; j += q.j * 0.5f; k += q.k * 0.5f; return q; } Quaternion Quaternion::operator-(const Quaternion& q) const { return Quaternion(i - q.i, j - q.j, k - q.k, a - q.a); } Quaternion Quaternion::operator-=(const Quaternion& q) { i -= q.i; j -= q.j; k -= q.k; a -= q.a; return *this; } Quaternion Quaternion::operator*(const Quaternion& q) const { return Quaternion(i * q.a + a * q.i - k * q.j + j * q.k, j * q.a + k * q.i + a * q.j - i * q.k, k * q.a - j * q.i + i * q.j + a * q.k, a * q.a - i * q.i - j * q.j - k * q.k); } Quaternion Quaternion::operator*=(const Quaternion& q) { const auto temp_i = i; const auto temp_j = j; const auto temp_k = k; const auto temp_a = a; i = temp_i * q.a + temp_a * q.i - temp_k * q.j + temp_j * q.k; j = temp_j * q.a + temp_k * q.i + temp_a * q.j - temp_i * q.k; k = temp_k * q.a - temp_j * q.i + temp_i * q.j + temp_a * q.k; a = temp_a * q.a - temp_i * q.i - temp_j * q.j - temp_k * q.k; return *this; } Vector3 Quaternion::operator*(const Vector3& v) const { return RotateVector(v); } Quaternion Quaternion::operator*=(const real scale) { i *= scale; j *= scale; k *= scale; a *= scale; return *this; } Quaternion Quaternion::operator*(const real scale) const { return Quaternion(i * scale, j * scale, k * scale, a * scale); } Quaternion Quaternion::operator/=(const real scale) { const auto reciprocal = 1.f / scale; i *= reciprocal; j *= reciprocal; k *= reciprocal; a *= reciprocal; return *this; } Quaternion Quaternion::operator/(const real scale) const { const auto reciprocal = 1.f / scale; return Quaternion(i * reciprocal, j * reciprocal, k * reciprocal, a * reciprocal); } bool Quaternion::operator=(const Quaternion& q) const { return i == q.i && j == q.j && k == q.k && a == q.a; } bool Quaternion::operator!=(const Quaternion& q) const { return i != q.i || j != q.j || k != q.k || a != q.a; } real Quaternion::operator|(const Quaternion& q) const { return i * q.i + j * q.j + k * q.k + a * q.a; } Quaternion Quaternion::MakeFromEuler(const Vector3& v) { return MakeFromEuler(v.x, v.y, v.z); } Quaternion Quaternion::MakeFromEuler(const real x, const real y, const real z) { const auto roll = DegreesToRadians(x); const auto pitch = DegreesToRadians(y); const auto yaw = DegreesToRadians(z); const auto cyaw = real_cos(0.5f * yaw); const auto cpitch = real_cos(0.5f * pitch); const auto croll = real_cos(0.5f * roll); const auto syaw = real_sin(0.5f * yaw); const auto spitch = real_sin(0.5f * pitch); const auto sroll = real_sin(0.5f * roll); const auto cyawcpitch = cyaw * cpitch; const auto syawspitch = syaw * spitch; const auto cyawspitch = cyaw * spitch; const auto syawcpitch = syaw * cpitch; return Quaternion(cyawcpitch * croll + syawspitch * sroll, cyawcpitch * sroll - syawspitch * croll, cyawspitch * croll + syawcpitch * sroll, syawcpitch * croll - cyawspitch * sroll); } Vector3 Quaternion::Euler() const { const auto q00 = a * a; const auto q11 = i * i; const auto q22 = j * j; const auto q33 = k * k; const auto r11 = q00 + q11 - q22 - q33; const auto r21 = 2 * (i * j + a * k); const auto r31 = 2 * (i * k - a * j); const auto r32 = 2 * (j * k + a * j); const auto r33 = q00 - q11 - q22 + q33; if (real_abs(r31) > 0.999999f) { const auto r12 = 2 * (i * j - a * k); const auto r13 = 2 * (i * k + a * j); return Vector3(RadiansToDegrees(0.f), RadiansToDegrees(-(R_PI / 2) * r31 / fabs(r31)), RadiansToDegrees(atan2(-r12, -r31 * r13))); } return Vector3(RadiansToDegrees(atan2(r32, r33)), RadiansToDegrees(asin(-r31)), RadiansToDegrees(atan2(r21, r11))); } void Quaternion::Normalize() { auto d = a * a + i * i + j * j + k * k; // Check for zero length quaternion, and use the no-rotation // quaternion in that case. if (d < real_epsilon) { a = 1; return; } d = static_cast<real>(1.f) / real_sqrt(d); i *= d; j *= d; k *= d; a *= d; } real Quaternion::Size() const { return real_sqrt(i * i + j * j + k * k + a * a); } real Quaternion::SizeSquared() const { return i * i + j * j + k * k + a * a; } Vector3 Quaternion::RotateVector(const Vector3& v) const { const Vector3 q(i, j, k); const auto t = 2.f * Vector3::CrossProduct(q, v); return v + a * t + Vector3::CrossProduct(q, t); } Vector3 Quaternion::UnrotateVector(const Vector3& v) const { // Inverse const Vector3 q(-i, -j, -k); const auto t = 2.f * Vector3::CrossProduct(q, v); return v + a * t + Vector3::CrossProduct(q, t); } Quaternion Quaternion::Inverse() const { return Quaternion(-i, -j, -k, a); } real Quaternion::DegreesToRadians(const real deg) { return deg * R_PI / 180.f; } real Quaternion::RadiansToDegrees(const real rad) { return rad * 180.f / R_PI; }
# ThinkPHP 5.1 # ## 获取配置 ## - 获取全部配置 $config=Config::get(); - 获取app下的配置项 $conapp=Config::get('app'); - 获取一级配置项 $configfirst=Config::pull('log'); - 获取二级配置项 $configsecond=Config::get('app.app_debug'); - app默认,可以不写 $configsecond=Config::get('app_dubug'); - 判断是否有这个配置项 $confighas=Config::has('defalut_lang'); - 查询database下的配置内容 $configdata=Config::pull('database'); - 动态改变配置项 Config::set('app_debug',false); - 也可以使用助手函数config来动态设置和获取配置项 - 设置 config('app_debug',false); - 获取 config('app_debug'); ## php经典三大模式 ## - 单例模式 namespace singleTon { class single { public $siteName; private static $instance; private function __construct($siteName) { $this->siteName = $siteName; } private function __clone() { trigger_error('Clone is not allowed', E_USER_ERROR); } static public function singleTon($siteName = '百度') { if (!isset(self::$instance)) { self::$instance = new self($siteName); } return self::$instance; } } } - 工厂模式 namespace Factory { use singleTon\single; class Factory { public static function create($siteName) { return single::singleTon($siteName); } } } - 对象注册树 namespace RegisterTree { class RegisterTree { //创建对象池 private static $objs = []; //生成对象并上树 public static function set($alis, $obj) { self::$objs[$alis] = $obj; } //从树上面取下对象 public static function get($alas) { return self::$objs[$alas]; } //销毁对象 public static function _unset($alas) { unset(self::$objs[$alas]); } } } - 对象访问 namespace run { use Factory\Factory; use RegisterTree\RegisterTree; $factory = Factory::create('谷歌'); //创建对象 RegisterTree::set('site', $factory); //获取对象 $obj = RegisterTree::get('site'); //访问对象值 $siteName=$obj->siteName; var_dump($siteName); } ## trait类 ## 利用trait类实现php多继承,提高了代码的复用性 trait类 demo1 namespace demo1{ trait demo1{ public function m1(){ return __METHOD__; } } } trait类 demo2 namespace demo2{ trait demo2{ public function m2(){ return __METHOD__; } } } 利用trait类实现多继承 namespace demo{ use demo1\demo1; use demo2\demo2; class demo{ use demo1,demo2; public function dm1(){ return __METHOD__; } public function dm2(){ return $this->m1(); } public function dm3(){ return $this->m2(); } } $demo=new demo(); echo $demo->dm1(); echo '<br/>'; echo $demo->dm2(); echo '<br/>'; echo $demo->dm3(); } 打印结果 demo\demo::dm1 demo1\demo1::m1 demo2\demo2::m2 ## trait类访问优先级 ## 1. 如果当前类有这个方法,则访问当前类; 2. 如果当前类没有这个方法,则访问trait类; 3. 如果trait类没有这个方法,则访问父类同名方法 trait demo1{ public function m2(){ return __METHOD__; } } trait demo2{ public function m1(){ return __METHOD__; } } class demoP{ public function m(){ return __METHOD__; } } class demo extends demoP{} $demo= new demo(); echo $demo->m(); 输出结果 demoP::m ## 依赖注入 ## + 任何URL的访问,最终都是定位到控制器,由控制器中的某个具体方法执行 + 一个控制器对应着一个类,如果这些控制器需要统一管理,怎么办? + 使用容器进行管理,还可以将类的实例进行管理,传递给类方法,自动触发依赖注入 + 依赖注入: 将对象类型的数据,以参数的形式传递给方法的参数列表 + URL访问 以get形式将数据传递给控制器指定方法中 依赖注入 public function getMethod(\app\common\common $common) { $common->setName('guomin'); return $common->getName(); } app\common\common类 namespace app\common; class common { private $name; public function setName($name) { $this->name=$name; } public function getName(){ return "方法名是".__METHOD__."属性是".$this->name; } } 绑定类和闭包到容器中 use think\Container; 先use think\Container这个类 public function bindClass(){ Container::set('common','\app\common\common'); $common=Container::get('common',['name'=>'leee']); return $common->getName(); } 绑定一个闭包到容器中 public function bindClosure(){ Container::set('demo',function($demo){ return $demo; }); return Container::get('demo',['demo'=>'demo的值在这里显示']); } ## Facade静态代理 ## 1. 创建一个类app\common\testfacade.php namespace app\common; class testfacade{ public function index($name='think PHP'){ return $name; } } 1. 新建文件夹facade,在此文件夹下创建testfacade.php namespace app\facade; use think\Facade; class testfacade extends Facade { protected static function getFacadeClass() { //使用动态绑定时,下面这句代码可以不写 // return 'app\common\testfacade'; } } 1. 使用静态代理 use app\common\testfacade; use think\facade; public function facade(){ //常规调用方法 // $testfacade=new testfacade(); //return $testfacade->index(); //静态代理调用方法 // return \app\facade\testfacade::index('guomin'); //使用动态绑定的方法绑定到facade Facade::bind('app\facade\testfacade','app\common\testfacade'); return \app\facade\testfacade::index('aaa'); }
#Hadoop 集群规划 ``` Hadoop依赖的技术环境 Java,Linux(CentOS),数据库(MySQL,Postgresql, Oracle),Python 2.7.X\2.6.X 安全:Kerberos JDK1.7.0_55, CentOS 6.5,建议Postgresql, Python 2.7.X,SSH Hadoop软件: MapR,Cloudera,Hortonworks Hadoop常见安装方式:Yum,RPM,Parcels(Cloudera 特有) 硬件规划 服务器:管理节点,计算节点 CPU: 1 core ~ 1 Task MEM: 1 core ~ 2~4G MEM DISK: SSD,SAS,SATA 1 core~ 1~2T存储 Network: 千兆,万兆但是一定要做网卡绑定 交换机:影响,数据在网络中的传输速度 注意:Spark项目,或者集群任务量非常大, 关心:同时运行的任务量,每一个任务大概需要访问多少数据 防火墙: FTP服务器: 文件服务器: Namenode 内存是96G OS:8G NameNode : 非堆 8G 堆:80G Datanode 64G ,Zookeeper OS:8G Datanode:4G Zookeeper :8G ```
using System; using System.Collections.Generic; using System.Reflection; using FarseerPhysics.Dynamics; using GeneticTanks.Extensions; using GeneticTanks.Game.Components.Messages; using GeneticTanks.Game.Events; using GeneticTanks.Game.Managers; using log4net; using Microsoft.Xna.Framework; namespace GeneticTanks.Game.Components.Tank { sealed class TankAiComponent : Component { private static readonly ILog Log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); #region Constants // update rate for collision checks private const float UpdateInterval = 1f / 5f; // distance for collision ray casts private const float RaycastDistance = 25f; // 5 rays form a cone to sweep for obstacles in front of the tank private static readonly Vector2 ForwardRay = PhysicsTransformComponent.ForwardVector * RaycastDistance; private static readonly Vector2 LeftRay = new Vector2(RaycastDistance, RaycastDistance * (float)Math.Tan(MathHelper.ToRadians(40f))); private static readonly Vector2 LeftHalfRay = new Vector2(RaycastDistance, RaycastDistance * (float)Math.Tan(MathHelper.ToRadians(20f))); private static readonly Vector2 RightRay = new Vector2(RaycastDistance, -RaycastDistance * (float)Math.Tan(MathHelper.ToRadians(40f))); private static readonly Vector2 RightHalfRay = new Vector2(RaycastDistance, -RaycastDistance * (float)Math.Tan(MathHelper.ToRadians(20f))); // collision categories used in ray casting private static readonly Category RayCategories = PhysicsManager.TankCategory | PhysicsManager.TerrainCategory; #endregion private static readonly Random Random = new Random(); enum AiState { Search, ApproachEnemy, Attack } enum MoveState { Stopped, Forward, TurnLeft, TurnRight, ForwardCollision, TurnLeftCollision, TurnRightCollision } #region Private Fields private readonly EntityManager m_entityManager; private readonly EventManager m_eventManager; private readonly PhysicsManager m_physicsManager; private MessageComponent m_messenger; private TankPhysicsTransformComponent m_physics; private TankStateComponent m_state; private bool m_enabled = true; private float m_updateTime = 0f; private float m_collisionUpdateTime = 0f; private AiState m_aiState; private MoveState m_moveState; private Vector2 m_rayOrigin; private bool m_centerObstacle; private bool m_leftObstacle; private bool m_rightObstacle; private readonly List<Entity> m_contacts = new List<Entity>(); private Entity m_target = null; private float m_targetRange = 0f; private float m_targetHeading = 0f; #endregion /// <summary> /// Create the component. /// </summary> /// <param name="parent"></param> /// <param name="entityManager"></param> /// <param name="eventManager"></param> /// <param name="physicsManager"></param> public TankAiComponent(Entity parent, EntityManager entityManager, EventManager eventManager, PhysicsManager physicsManager) : base(parent) { if (entityManager == null) { throw new ArgumentNullException("entityManager"); } if (eventManager == null) { throw new ArgumentNullException("eventManager"); } if (physicsManager == null) { throw new ArgumentNullException("physicsManager"); } m_entityManager = entityManager; m_eventManager = eventManager; m_physicsManager = physicsManager; NeedsUpdate = true; } #region Component Implementation public override bool Initialize() { if (!RetrieveSibling(out m_messenger)) { return false; } if (!RetrieveSibling(out m_physics)) { return false; } if (!RetrieveSibling(out m_state)) { return false; } m_rayOrigin = new Vector2(m_state.Dimensions.X, 0); m_messenger.AddListener<SensorNewContactMessage>(HandleSensorNewContact); m_messenger.AddListener<SensorLostContactMessage>( HandleSensorLostContact); m_messenger.AddListener<TankKilledMessage>(HandleTankKilledMessage); m_eventManager.AddListener<TankKilledEvent>(HandleTankKilledEvent); m_physicsManager.PostStep += HandlePostStep; SetState(AiState.Search); Initialized = true; return true; } public override void Update(float deltaTime) { if (!m_enabled) { return; } m_updateTime += deltaTime; if (m_updateTime < UpdateInterval) { return; } m_updateTime %= UpdateInterval; switch (m_aiState) { case AiState.ApproachEnemy: UpdateApproach(); break; } } #endregion #region Private Methods #region Movement Control Methods private void UpdateMovement() { switch (m_moveState) { case MoveState.ForwardCollision: UpdateForwardCollision(); break; case MoveState.TurnLeftCollision: case MoveState.TurnRightCollision: UpdateTurnCollision(); break; } } private void UpdateForwardCollision() { if (!(m_leftObstacle || m_centerObstacle || m_rightObstacle)) { return; } SelectCollisionTurnDirection(); } private void UpdateTurnCollision() { if (!m_leftObstacle && !m_centerObstacle && !m_rightObstacle) { SetMoveState(MoveState.ForwardCollision); } } private void SelectCollisionTurnDirection() { Log.VerboseFmt("{0} is making a turn decision...", Parent.FullName); // obstacle on either side, or neither side, random direction if ((m_leftObstacle && m_rightObstacle) || (!m_leftObstacle && !m_rightObstacle)) { var state = Random.NextDouble() < 0.5 ? MoveState.TurnLeftCollision : MoveState.TurnRightCollision; SetMoveState(state); } else if (m_leftObstacle) { SetMoveState(MoveState.TurnRightCollision); } else { SetMoveState(MoveState.TurnLeftCollision); } } private void DoCollisionRaycasts() { var left = m_physics.RaycastDistance(m_rayOrigin, LeftRay, RayCategories); var leftHalf = m_physics.RaycastDistance(m_rayOrigin, LeftHalfRay, RayCategories); var center = m_physics.RaycastDistance(m_rayOrigin, ForwardRay, RayCategories); var rightHalf = m_physics.RaycastDistance(m_rayOrigin, RightHalfRay, RayCategories); var right = m_physics.RaycastDistance(m_rayOrigin, RightRay, RayCategories); m_leftObstacle = left > 0f || leftHalf > 0f; m_centerObstacle = center > 0f; m_rightObstacle = right > 0f || rightHalf > 0f; } private void SetMoveState(MoveState state) { m_moveState = state; //Log.DebugFmt("{0} setting move state {1}", Parent.FullName, state); switch (m_moveState) { case MoveState.Stopped: m_messenger.QueueMessage(new MoveMessage(MoveCommand.AllStop)); break; case MoveState.Forward: case MoveState.ForwardCollision: m_messenger.QueueMessage(new MoveMessage(MoveCommand.TurnStop)); m_messenger.QueueMessage( new MoveMessage(MoveCommand.SpeedForwardFull)); break; case MoveState.TurnLeft: case MoveState.TurnLeftCollision: m_messenger.QueueMessage(new MoveMessage(MoveCommand.TurnLeftFull)); m_messenger.QueueMessage( new MoveMessage(MoveCommand.SpeedStop)); break; case MoveState.TurnRight: case MoveState.TurnRightCollision: m_messenger.QueueMessage(new MoveMessage(MoveCommand.TurnRightFull)); m_messenger.QueueMessage( new MoveMessage(MoveCommand.SpeedStop)); break; } } #endregion private void SetState(AiState state) { m_aiState = state; //Log.DebugFmt("{0} new state {1}", Parent.FullName, m_aiState); switch (m_aiState) { case AiState.Search: SetMoveState(MoveState.ForwardCollision); break; case AiState.ApproachEnemy: SetMoveState(MoveState.Stopped); break; case AiState.Attack: SetMoveState(MoveState.Stopped); m_messenger.QueueMessage(new ShootingStateMessage(true)); break; } } private void UpdateApproach() { UpdateTargetInfo(); var angleDiff = m_targetHeading - Parent.Transform.Rotation; if (angleDiff <= -180f) { angleDiff += 360f; } else if (angleDiff >= 180f) { angleDiff -= 360f; } var desiredRange = m_state.GunRange - (m_state.GunRange / 10f); // align to the target heading if (Math.Abs(angleDiff) > 10f) { if (angleDiff < 0f && m_moveState != MoveState.TurnRight) { SetMoveState(MoveState.TurnRight); } else if (angleDiff > 0f && m_moveState != MoveState.TurnLeft) { SetMoveState(MoveState.TurnLeft); } } // move within range else if (m_targetRange > desiredRange) { if (m_moveState != MoveState.Forward) { SetMoveState(MoveState.Forward); } } else { SetState(AiState.Attack); } } private void UpdateTargetInfo() { var targetDirection = m_target.Transform.Position - Parent.Transform.Position; var angle = Math.Atan2(targetDirection.Y, targetDirection.X) - Math.Atan2(Vector2.UnitX.Y, Vector2.UnitX.X); m_targetRange = targetDirection.Length(); m_targetHeading = MathHelper.ToDegrees((float)angle); } private void SelectTarget() { Entity closest = null; float minDistance = float.MaxValue; foreach (var contact in m_contacts) { var distVec = contact.Transform.Position - Parent.Transform.Position; var distance = distVec.LengthSquared(); if (distance < minDistance) { minDistance = distance; closest = contact; } } m_target = closest; // Must be trigger so that components holding a reference to the target // can immediately update. Otherwise causes crashes when the target // was destroyed m_messenger.TriggerMessage(new SetTargetMessage(m_target)); if (m_target == null) { Log.DebugFmt("{0} cleared target", Parent.FullName); SetState(AiState.Search); } else { Log.DebugFmt("{0} set target {1}", Parent.FullName, m_target.FullName); SetState(AiState.ApproachEnemy); } } #endregion #region Callbacks private void HandleSensorNewContact(Message m) { var msg = (SensorNewContactMessage) m; var entity = m_entityManager.GetEntity(msg.ContactId); if (entity == null) { return; } m_contacts.Add(entity); if (m_target == null) { SelectTarget(); } } private void HandleSensorLostContact(Message m) { var msg = (SensorLostContactMessage)m; var entity = m_entityManager.GetEntity(msg.ContactId); if (entity == null) { return; } m_contacts.Remove(entity); if (m_target != null && entity.Id == m_target.Id) { SelectTarget(); } } private void HandleTankKilledMessage(Message msg) { m_enabled = false; m_physicsManager.PostStep -= HandlePostStep; m_eventManager.RemoveListener<TankKilledEvent>(HandleTankKilledEvent); } private void HandleTankKilledEvent(Event e) { var evt = (TankKilledEvent) e; m_contacts.RemoveAll(entity => entity.Id == evt.Id); if (m_target != null && evt.Id == m_target.Id) { m_target = null; SelectTarget(); } } private void HandlePostStep(float deltaTime) { m_collisionUpdateTime += deltaTime; if (m_collisionUpdateTime < UpdateInterval) { return; } m_collisionUpdateTime %= UpdateInterval; if (m_moveState != MoveState.Stopped) { DoCollisionRaycasts(); UpdateMovement(); } } #endregion #region IDisposable private bool m_disposed = false; protected override void Dispose(bool disposing) { if (!Initialized || m_disposed) { return; } m_messenger.RemoveListener<SensorNewContactMessage>( HandleSensorNewContact); m_messenger.RemoveListener<SensorNewContactMessage>( HandleSensorLostContact); m_eventManager.RemoveListener<TankKilledEvent>(HandleTankKilledEvent); m_physicsManager.PostStep -= HandlePostStep; base.Dispose(disposing); m_disposed = true; } #endregion } }
<?php /** * * * This is an iumio Framework component * * * * (c) RAFINA DANY <[email protected]> * * * * iumio Framework, an iumio component [https://iumio.com] * * * * To get more information about licence, please check the licence file * */ namespace iumioFramework\Core\Additional\Manager\Module\Deployer; use iumioFramework\Core\Additional\Manager\Module\ModuleManager; use iumioFramework\Core\Base\Json\JsonListener; use iumioFramework\Core\Additional\Manager\CoreManager; use iumioFramework\Core\Additional\Manager\FEnvFcm; use iumioFramework\Core\Additional\Manager\Module\App\OutputManagerOverride as Output; use iumioFramework\Core\Additional\Manager\Module\ModuleManagerInterface; use iumioFramework\Core\Additional\Manager\Module\Assets\AssetsManager as ASM; use iumioFramework\Core\Additional\Manager\Module\Cache\CacheManager as CAM; use iumioFramework\Core\Additional\Manager\Module\Compiled\CompiledManager as COM; use iumioFramework\Core\Additional\Manager\Module\Mercure\MercureManager as Mercure; /** * Class DeployerManager * @package iumioFramework\Core\Additional\Manager\Module\Cache * @category Framework * @licence MIT License * @link https://framework.iumio.com * @author RAFINA Dany <[email protected]> */ class DeployerManager extends ModuleManager implements ModuleManagerInterface { protected $options; protected $requirements = null; /** * @return mixed|void * @param $options * @throws \Exception */ public function __render(array $options) { if (!isset($options["commands"])) { Output::displayAsError("Deployer Manager Module Error : Option is not exist. Referer to help command to get options list\n"); } $opt = $options["commands"][0] ?? null; if ($opt == "deployer:process-deploy") { $this->deploy(); } elseif ($opt == "deployer:process-undeploy") { $this->undeploy(); } else { Output::displayAsError("Deployer Manager Module Error : Option is not exist. Referer to help command to get options list\n"); } } /** * Check if the requirements are correct * @return int * @throws \iumioFramework\Core\Exception\Server\Server500 * @throws \iumioFramework\Core\Exception\Server\Server500 */ private function getRequirements() { $configs = JsonListener::open(FEnvFcm::get("framework.config.core.config.file")); $default = $configs->default_env; if ($default == "prod") { JsonListener::close(FEnvFcm::get("framework.config.core.config.file")); Output::displayAsError("Cannot get deployment requirements : Framework is already deployed"); } JsonListener::close(FEnvFcm::get("framework.config.core.config.file")); for ($i = 0; $i < count($this->requirements); $i++) { switch ($this->requirements[$i]["p"]) { case "RWX": if (is_readable($this->requirements[$i]["path"]) && is_writable($this->requirements[$i]["path"]) && is_executable($this->requirements[$i]["path"])) { $this->requirements[$i]["status"] = true; } else { $this->requirements[$i]["status"] = false; } break; case "R": if (is_readable($this->requirements[$i]["path"])) { $this->requirements[$i]["status"] = true; } else { $this->requirements[$i]["status"] = false; } break; case "W": if (is_writable($this->requirements[$i]["path"])) { $this->requirements[$i]["status"] = true; } else { $this->requirements[$i]["status"] = false; } break; case "X": if (is_executable($this->requirements[$i]["path"])) { $this->requirements[$i]["status"] = true; } else { $this->requirements[$i]["status"] = false; } break; case "RW": if (is_readable($this->requirements[$i]["path"]) && is_writable($this->requirements[$i]["path"])) { $this->requirements[$i]["status"] = true; } else { $this->requirements[$i]["status"] = false; } break; case "RX": if (is_readable($this->requirements[$i]["path"]) && is_executable($this->requirements[$i]["path"])) { $this->requirements[$i]["status"] = true; } else { $this->requirements[$i]["status"] = false; } break; case "XW": if (is_writable($this->requirements[$i]["path"]) && is_executable($this->requirements[$i]["path"])) { $this->requirements[$i]["status"] = true; } else { $this->requirements[$i]["status"] = false; } break; case "D": if (file_exists($this->requirements[$i]["path"])) { $this->requirements[$i]["status"] = false; } else { $this->requirements[$i]["status"] = true; } break; default: Output::displayAsError("Undefined permissions ".$this->requirements[$i]["p"]); break; } } return (1); } /** * Switch to dev environment * @throws \iumioFramework\Core\Exception\Server\Server500 * @throws \Exception */ public function undeploy() { Output::clear(); Output::outputAsSuccess("Welcome on Deployer Manager. Now, i process to undeploy your(s) application(s)", "none"); $configs = JsonListener::open(FEnvFcm::get("framework.config.core.config.file")); $default = $configs->default_env; if ($default == "dev") { JsonListener::close(FEnvFcm::get("framework.config.core.config.file")); Output::displayAsError("Cannot switch environment : Able to switch only dev environment"); } $configs->default_env = "dev"; $configs->deployment = null; JsonListener::put( FEnvFcm::get("framework.config.core.config.file"), json_encode($configs, JSON_PRETTY_PRINT) ); JsonListener::close(FEnvFcm::get("framework.config.core.config.file")); $asm = new ASM(); $asm->__render(["commands" => ["assets:clear"], "options" => ["--env=prod", "--noexit"]]); // CACHE MANAGER $cam = new CAM(); $cam->__render(["commands" => ["cache:clear"], "options" => ["--env=all", "--noexit"]]); // COMPILED MANAGER $com = new COM(); $com->__render(["commands" => ["compiled:clear"], "options" => ["--env=all", "--noexit"]]); Output::outputAsNormal("The undeployment is a success."); } /** * Deploy to prod environment * @throws \Exception * @throws \iumioFramework\Core\Exception\Server\Server500 */ public function deploy() { $configs = JsonListener::open(FEnvFcm::get("framework.config.core.config.file")); $default = $configs->default_env; if ($default == "prod") { JsonListener::close(FEnvFcm::get("framework.config.core.config.file")); Output::displayAsError("Cannot deployed to production environment : Your(s) app(s) are already deployed"); } $this->getRequirements(); $configs->default_env = "prod"; $configs->deployment = new \DateTime(); JsonListener::put( FEnvFcm::get("framework.config.core.config.file"), json_encode($configs, JSON_PRETTY_PRINT) ); JsonListener::close(FEnvFcm::get("framework.config.core.config.file")); //ASSETS MANAGER $asm = new ASM(); $asm->__render(["commands" => ["assets:clear"], "options" => ["--env=prod", "--noexit"]]); $asm->__render(["commands" => ["assets:copy"], "options" => ["--env=prod", "--noexit"]]); // CACHE MANAGER (new CAM())->__render(["commands" => ["cache:clear"], "options" => ["--env=all", "--noexit"]]); // COMPILED MANAGER $com = new COM(); $com->__render(["commands" => ["compiled:clear"], "options" => ["--env=all", "--noexit"]]); // Mercure MANAGER (new Mercure())->__render(["commands" => ["mercure:build:jsrouting"], "options" => ["--noexit"]]); Output::clear(); CoreManager::setCurrentModule("Deployer Manager"); Output::displayAsEndSuccess("The deployment process is successful"); } public function __alter() { // TODO: Implement __alter() method. } /** * DeployerManager constructor. * @throws \iumioFramework\Core\Exception\Server\Server500 */ public function __construct() { CoreManager::setCurrentModule("Deployer Manager"); $this->requirements = array( array("s" => "Directory for /elements and subdirectories must have <strong>READ</strong> permissions", "p" => "R", "path" => FEnvFcm::get("framework.elements")), array("s" => "Directory for /elements/logs and subdirectories must have <strong>READ + WRITE</strong> permissions", "p" => "RW", "path" => FEnvFcm::get("framework.logs")), array("s" => "Directory /elements/config_files/engine_autoloader&nbsp; and subdirectories must have <strong>READ + WRITE</strong> permissions", "p" => "RW", "path" => FEnvFcm::get("framework.config.autoloader")), array("s" => "File /elements/config_files/core/framework.config.json&nbsp; must have <strong>READ + WRITE</strong> permissions", "p" => "RW", "path" => FEnvFcm::get("framework.config.core.config.file")), array("s" => "Directory /elements/cache and&nbsp; subdirectories file must have <strong>READ + WRITE + EXECUTION</strong> permissions", "p" => "RWX", "path" => FEnvFcm::get("framework.cache")), array("s" => "Directory /public/setup must be <strong>removed</strong>", "p" => "D", "path" => FEnvFcm::get("framework.web")."setup/"), ); } }
const packages_ = {}; packages_.test_package = [ "do", ["def", "test_core_1", ["fn", ["&", "args"], ["list", { result: "Result 1" }, { new_bag: "New Bag 1" }]]], ["def", "test_core_2", ["fn", ["&", "args"], ["list", { result: "Result 2" }, { new_bag: "New Bag 2" }]]], null, ]; module.exports = { packages_: packages_, };
// <copyright file="TileSourceViewModel.cs" company="IIASA"> // Copyright (c) IIASA. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // </copyright> namespace TileCacheService.Web.Models { using System; using System.Collections.Generic; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using TileCacheService.Shared.Enums; #pragma warning disable SA1623 // Property summary documentation should match accessors #pragma warning disable SA1629 // Documentation text should end with a period public class TileSourceViewModel { /// <summary> /// If set, 4 tiles from a higher zoom level will be stitched together and resampled to increase the image /// quality /// </summary> /// <example>false</example> public bool AllowHiDefStitching { get; set; } /// <summary> /// Bounding box for tile source in WKT representation /// </summary> /// <example>POLYGON((16 47, 16 48, 17 48, 17 47, 16 47))</example> public string Bbox { get; set; } /// <summary> /// Type of the Tile Source imagery (Aerial, Road, Terrain, Hybrid, or Other) /// </summary> /// <example>Road</example> [JsonConverter(typeof(StringEnumConverter))] public MapTypeEnum MapType { get; set; } /// <summary> /// Name of the Tile Source /// </summary> /// <example>OSM tiles</example> public string Name { get; set; } /// <summary> /// Link(s) to the tile server, containing {0}, {1}, and {2} as placeholders for zoom, column, and row /// </summary> /// <example>https://a.tile.openstreetmap.org/{0}/{1}/{2}.png</example> public ISet<string> TileServerUrls { get; set; } /// <summary> /// ID of the tile source /// </summary> /// <example>0f8fad5b-d9cb-469f-a165-70867728950e</example> public Guid TileSourceId { get; set; } /// <summary> /// Maximum zoom level that this tile source provides /// </summary> /// <example>20</example> public int ZoomLevelMax { get; set; } } #pragma warning restore SA1623 // Property summary documentation should match accessors #pragma warning restore SA1629 // Documentation text should end with a period }
#!/bin/bash ln -s scratch_GATKv4_jointgenotype_93667/ vcf_sb0001 ln -s scratch_GATKv4_jointgenotype_40484/ vcf_sb0002 ln -s scratch_GATKv4_jointgenotype_40486/ vcf_sb0003 ln -s scratch_GATKv4_jointgenotype_40488/ vcf_sb0004 ln -s scratch_GATKv4_jointgenotype_40490/ vcf_sb0005 ln -s scratch_GATKv4_jointgenotype_40493/ vcf_sb0006 ln -s scratch_GATKv4_jointgenotype_40494/ vcf_sb0007 ln -s scratch_GATKv4_jointgenotype_40496/ vcf_sb0008 ln -s scratch_GATKv4_jointgenotype_93671/ vcf_sb0009 ln -s scratch_GATKv4_jointgenotype_93673/ vcf_sb0010 ln -s scratch_GATKv4_jointgenotype_93675/ vcf_sb0011 ln -s scratch_GATKv4_jointgenotype_93676/ vcf_sb0012 ln -s scratch_GATKv4_jointgenotype_93677/ vcf_sb0013 ln -s scratch_GATKv4_jointgenotype_9459/ vcf_sb0014 ln -s scratch_GATKv4_jointgenotype_23976/ vcf_sb0015 ln -s scratch_GATKv4_jointgenotype_70491/ vcf_sb0016 ln -s scratch_GATKv4_jointgenotype_79238/ vcf_sb0017 ln -s scratch_GATKv4_jointgenotype_90390/ vcf_sb0018 ln -s scratch_GATKv4_jointgenotype_94740/ vcf_sb0019 ln -s scratch_GATKv4_jointgenotype_4345/ vcf_sb0020 ln -s scratch_GATKv4_jointgenotype_18344/ vcf_sb0021 ln -s scratch_GATKv4_jointgenotype_40529/ vcf_sb0022 ln -s scratch_GATKv4_jointgenotype_51546/ vcf_sb0023 ln -s scratch_GATKv4_jointgenotype_63037/ vcf_sb0024 ln -s scratch_GATKv4_jointgenotype_63530/ vcf_sb0025 ln -s scratch_GATKv4_jointgenotype_89025/ vcf_sb0026 ln -s scratch_GATKv4_jointgenotype_94614/ vcf_sb0027 ln -s scratch_GATKv4_jointgenotype_2090/ vcf_sb0028 ln -s scratch_GATKv4_jointgenotype_9045/ vcf_sb0029 ln -s scratch_GATKv4_jointgenotype_11943/ vcf_sb0030 ln -s scratch_GATKv4_jointgenotype_15025/ vcf_sb0031 ln -s scratch_GATKv4_jointgenotype_32706/ vcf_sb0032 ln -s scratch_GATKv4_jointgenotype_45717/ vcf_sb0033 ln -s scratch_GATKv4_jointgenotype_51337/ vcf_sb0034 ln -s scratch_GATKv4_jointgenotype_52405/ vcf_sb0035 ln -s scratch_GATKv4_jointgenotype_54698/ vcf_sb0036 ln -s scratch_GATKv4_jointgenotype_57616/ vcf_sb0037 ln -s scratch_GATKv4_jointgenotype_59784/ vcf_sb0038 ln -s scratch_GATKv4_jointgenotype_63393/ vcf_sb0039 ln -s scratch_GATKv4_jointgenotype_74310/ vcf_sb0040 ln -s scratch_GATKv4_jointgenotype_78054/ vcf_sb0041 ln -s scratch_GATKv4_jointgenotype_80310/ vcf_sb0042 ln -s scratch_GATKv4_jointgenotype_83192/ vcf_sb0043 ln -s scratch_GATKv4_jointgenotype_86533/ vcf_sb0044 ln -s scratch_GATKv4_jointgenotype_87030/ vcf_sb0045 ln -s scratch_GATKv4_jointgenotype_88415/ vcf_sb0046 ln -s scratch_GATKv4_jointgenotype_88875/ vcf_sb0047 ln -s scratch_GATKv4_jointgenotype_90512/ vcf_sb0048 ln -s scratch_GATKv4_jointgenotype_92414/ vcf_sb0049 ln -s scratch_GATKv4_jointgenotype_94442/ vcf_sb0050 ln -s scratch_GATKv4_jointgenotype_95539/ vcf_sb0051 ln -s scratch_GATKv4_jointgenotype_97115/ vcf_sb0052 ln -s scratch_GATKv4_jointgenotype_472/ vcf_sb0053 ln -s scratch_GATKv4_jointgenotype_1273/ vcf_sb0054 ln -s scratch_GATKv4_jointgenotype_1733/ vcf_sb0055 ln -s scratch_GATKv4_jointgenotype_3661/ vcf_sb0056 ln -s scratch_GATKv4_jointgenotype_4118/ vcf_sb0057 ln -s scratch_GATKv4_jointgenotype_4668/ vcf_sb0058 ln -s scratch_GATKv4_jointgenotype_5160/ vcf_sb0059 ln -s scratch_GATKv4_jointgenotype_5851/ vcf_sb0060 ln -s scratch_GATKv4_jointgenotype_6431/ vcf_sb0061 ln -s scratch_GATKv4_jointgenotype_8068/ vcf_sb0062 ln -s scratch_GATKv4_jointgenotype_8731/ vcf_sb0063 ln -s scratch_GATKv4_jointgenotype_8906/ vcf_sb0064 ln -s scratch_GATKv4_jointgenotype_9094/ vcf_sb0065 ln -s scratch_GATKv4_jointgenotype_10428/ vcf_sb0066 ln -s scratch_GATKv4_jointgenotype_10962/ vcf_sb0067 ln -s scratch_GATKv4_jointgenotype_11451/ vcf_sb0068 ln -s scratch_GATKv4_jointgenotype_12002/ vcf_sb0069 ln -s scratch_GATKv4_jointgenotype_12818/ vcf_sb0070 ln -s scratch_GATKv4_jointgenotype_14450/ vcf_sb0071 ln -s scratch_GATKv4_jointgenotype_14644/ vcf_sb0072 ln -s scratch_GATKv4_jointgenotype_15069/ vcf_sb0073 ln -s scratch_GATKv4_jointgenotype_15945/ vcf_sb0074 ln -s scratch_GATKv4_jointgenotype_16479/ vcf_sb0075 ln -s scratch_GATKv4_jointgenotype_16918/ vcf_sb0076 ln -s scratch_GATKv4_jointgenotype_17502/ vcf_sb0077 ln -s scratch_GATKv4_jointgenotype_18201/ vcf_sb0078 ln -s scratch_GATKv4_jointgenotype_19123/ vcf_sb0079 ln -s scratch_GATKv4_jointgenotype_19791/ vcf_sb0080 ln -s scratch_GATKv4_jointgenotype_20424/ vcf_sb0081 ln -s scratch_GATKv4_jointgenotype_20576/ vcf_sb0082 ln -s scratch_GATKv4_jointgenotype_21384/ vcf_sb0083 ln -s scratch_GATKv4_jointgenotype_21866/ vcf_sb0084 ln -s scratch_GATKv4_jointgenotype_23029/ vcf_sb0085 ln -s scratch_GATKv4_jointgenotype_23555/ vcf_sb0086 ln -s scratch_GATKv4_jointgenotype_24641/ vcf_sb0087 ln -s scratch_GATKv4_jointgenotype_25357/ vcf_sb0088 ln -s scratch_GATKv4_jointgenotype_25882/ vcf_sb0089 ln -s scratch_GATKv4_jointgenotype_26411/ vcf_sb0090 ln -s scratch_GATKv4_jointgenotype_27019/ vcf_sb0091 ln -s scratch_GATKv4_jointgenotype_27520/ vcf_sb0092 ln -s scratch_GATKv4_jointgenotype_27940/ vcf_sb0093 ln -s scratch_GATKv4_jointgenotype_28361/ vcf_sb0094 ln -s scratch_GATKv4_jointgenotype_29474/ vcf_sb0095 ln -s scratch_GATKv4_jointgenotype_30832/ vcf_sb0096 ln -s scratch_GATKv4_jointgenotype_31046/ vcf_sb0097 ln -s scratch_GATKv4_jointgenotype_31719/ vcf_sb0098 ln -s scratch_GATKv4_jointgenotype_32246/ vcf_sb0099 ln -s scratch_GATKv4_jointgenotype_32720/ vcf_sb0100 ln -s scratch_GATKv4_jointgenotype_33224/ vcf_sb0101 ln -s scratch_GATKv4_jointgenotype_33916/ vcf_sb0102 ln -s scratch_GATKv4_jointgenotype_34762/ vcf_sb0103 ln -s scratch_GATKv4_jointgenotype_35403/ vcf_sb0104 ln -s scratch_GATKv4_jointgenotype_35879/ vcf_sb0105 ln -s scratch_GATKv4_jointgenotype_36512/ vcf_sb0106 ln -s scratch_GATKv4_jointgenotype_37044/ vcf_sb0107 ln -s scratch_GATKv4_jointgenotype_37290/ vcf_sb0108 ln -s scratch_GATKv4_jointgenotype_38011/ vcf_sb0109 ln -s scratch_GATKv4_jointgenotype_38791/ vcf_sb0110 ln -s scratch_GATKv4_jointgenotype_39618/ vcf_sb0111 ln -s scratch_GATKv4_jointgenotype_39857/ vcf_sb0112 ln -s scratch_GATKv4_jointgenotype_40947/ vcf_sb0113 ln -s scratch_GATKv4_jointgenotype_41864/ vcf_sb0114 ln -s scratch_GATKv4_jointgenotype_42344/ vcf_sb0115 ln -s scratch_GATKv4_jointgenotype_42879/ vcf_sb0116 ln -s scratch_GATKv4_jointgenotype_43715/ vcf_sb0117 ln -s scratch_GATKv4_jointgenotype_43968/ vcf_sb0118 ln -s scratch_GATKv4_jointgenotype_44796/ vcf_sb0119 ln -s scratch_GATKv4_jointgenotype_45446/ vcf_sb0120 ln -s scratch_GATKv4_jointgenotype_46139/ vcf_sb0121 ln -s scratch_GATKv4_jointgenotype_46711/ vcf_sb0122 ln -s scratch_GATKv4_jointgenotype_47230/ vcf_sb0123 ln -s scratch_GATKv4_jointgenotype_47653/ vcf_sb0124 ln -s scratch_GATKv4_jointgenotype_48138/ vcf_sb0125 ln -s scratch_GATKv4_jointgenotype_49153/ vcf_sb0126 ln -s scratch_GATKv4_jointgenotype_49806/ vcf_sb0127 ln -s scratch_GATKv4_jointgenotype_50119/ vcf_sb0128 ln -s scratch_GATKv4_jointgenotype_50889/ vcf_sb0129 ln -s scratch_GATKv4_jointgenotype_51360/ vcf_sb0130
using UnityEngine; using System.Collections; using System.Collections.Generic; using VIDE_Data; public class VIDEDemoPlayer : MonoBehaviour { //This script handles player movement and interaction with other NPC game objects public string playerName = "VIDE User"; //Reference to our diagUI script for quick access public VIDEUIManager1 diagUI; public QuestChartDemo questUI; public Animator blue; //Stored current VA when inside a trigger public VIDE_Assign inTrigger; //DEMO variables for item inventory //Crazy cap NPC in the demo has items you can collect public List<string> demo_Items = new List<string>(); public List<string> demo_ItemInventory = new List<string>(); void OnTriggerEnter(Collider other) { if (other.GetComponent<VIDE_Assign>() != null) inTrigger = other.GetComponent<VIDE_Assign>(); } void OnTriggerExit() { inTrigger = null; } void Start() { Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; } void Update() { //Only allow player to move and turn if there are no dialogs loaded if (!VD.isActive) { transform.Rotate(0, Input.GetAxis("Mouse X") * 5, 0); float move = Input.GetAxisRaw("Vertical"); transform.position += transform.forward * 7 * move * Time.deltaTime; blue.SetFloat("speed", move); } //Interact with NPCs when pressing E if (Input.GetKeyDown(KeyCode.E)) { TryInteract(); } //Hide/Show cursor if (Input.GetMouseButtonDown(0)) { Cursor.visible = !Cursor.visible; if (Cursor.visible) Cursor.lockState = CursorLockMode.None; else Cursor.lockState = CursorLockMode.Locked; } } //Casts a ray to see if we hit an NPC and, if so, we interact void TryInteract() { /* Prioritize triggers */ if (inTrigger) { diagUI.Interact(inTrigger); return; } /* If we are not in a trigger, try with raycasts */ RaycastHit rHit; if (Physics.Raycast(transform.position, transform.forward, out rHit, 2)) { //Lets grab the NPC's VIDE_Assign script, if there's any VIDE_Assign assigned; if (rHit.collider.GetComponent<VIDE_Assign>() != null) assigned = rHit.collider.GetComponent<VIDE_Assign>(); else return; if (assigned.alias == "QuestUI") { questUI.Interact(); //Begins interaction with Quest Chart } else { diagUI.Interact(assigned); //Begins interaction } } } }
/** 基础组件 */ export declare class BasicControl { /** 组件Id,即为Ref */ id?: string; /** 编辑器组件 */ control: string; /** 组件属性 */ attrs: Record<string, any>; /** 组件属性 */ events: Record<string, any>; /** 修改前的组件属性 */ propAttrs: Record<string, any>; /** 组件默认属性 */ defaultAttrs?: Record<string, any>; /** 编辑器插槽 */ slot: Record<string, Array<BasicControl>>; /** 包含的HTML */ html?: string; /** 是否为主控件 */ isMain?: boolean; }
[Back to the documentation](Readme.md) # Contribution guide summary 1. Project overview 1. [Main files and directories](doc/hierarchy.md) 1. [Using the provided docker development environment](doc/docker/Readme.md): 1. How to install the docker enviroment 1. Quick access to the configuration guide of the environment 1. How to start the docker enviroment 1. How to stop the docker enviroment
package com.github.nscala_time package object time{ private[time] type Super = AnyVal }
**Instructions to install, setup and use Rally** 1. Download rally: git clone https://git.openstack.org/openstack/rally (Ensure install libffi-dev libssl-dev libxml2 are installed) 2. Run ./install_rally.sh with the -v option to install Rally in its own virtual env. This should create a install dir - rally 3. Under the rally install dir, go to samples/deployments, edit the existing.json to update auth_url, admin username, password and tenant_name. 4. Activate the rally venv and create the rally deployment environment using rally deployment create --filename=existing.json --name=existing 5. Create rally.conf under /etc/rally and use the following contents: ''' [DEFAULT] # Path to CA server cetrificate for SSL https_cacert=/usr/local/share/ca-certificates/ephemeralca-cacert.crt [database] connection = sqlite:///<your path of rally install dir>/database/rally.sqlite ''' 6. Ensure Rally can talk to the environment using: rally --config-file=/etc/rally/rally.conf deployment check 7. Run Rally tests: (assuming you run this from the rally install folder) rally --config-file=/etc/rally/rally.conf -v task start samples/tasks/scenarios/ceilometer/list-meters.json Under samples/tasks/scenarios/ceilometer, are different test scenarion configurations to test different ceilometer apis, these can all be tested using the above command. 8. Other - Rally Deployment commands check Check keystone authentication and list all available services. config Display configuration of the deployment. create Create new deployment. destroy Destroy existing deployment. list List existing deployments. recreate Destroy and create an existing deployment. show Show the endpoints of the deployment. use Set active deployment. Alias for "rally use deployment". **Rally scenario yaml file example** This feature can be easily tested in real life by running one of the most important and plain benchmark scenario called “KeystoneBasic.authenticate”. This scenario just tries to authenticate from users that were pre-created by Rally. Rally input task looks as follows (auth.yaml): --- Authenticate.keystone: - runner: type: "rps" times: 6000 rps: 50 context: users: tenants: 5 users_per_tenant: 10 sla: max_avg_duration: 5 In human-readable form this input task means: Create 5 tenants with 10 users in each, after that try to authenticate to Keystone 6000 times performing 50 authentications per second (running new authentication request every 20ms). Each time we are performing authentication from one of the Rally pre-created user. This task passes only if max average duration of authentication takes less than 5 seconds.
--- template: spacs-ultimate-list slug: /spacs_ultimate_list title: SPAC Ultimate List --- This page is used by template spacs-ultimate-list, to display graphql page query from AirTable.
program rstest use flips use rand ! This program tests flips_resize in different situations ! Single precision real version implicit none type(flips_d) :: s1,s2,s3,s4 real(dp), dimension(:), allocatable :: amat,amat2,rr,meas2 real(dp), dimension(:), allocatable :: meas,erro logical, dimension(:), allocatable :: re real(dp) :: diff, maxdiff real(dp) :: ts,te logical, dimension(:), allocatable :: remo integer :: i call set_rand_seed() write(*,*) 'Test 1: Expand 1000 unknowns problem by 1000 new unknowns' ! ******************************************************************** write(*,*) ' Memory storage' ! Initialize s1 call flips_init(s1,1000,1,buffersize=50) call flips_init(s3,500,1,buffersize=50) ! Create data allocate(amat(1000*1000),meas(1000),erro(1000),amat2(1500*500),rr(500*500),meas2(500),remo(1000)) call random_number(amat) call random_number(meas) !call random_number(erro) erro = 1.0 ! Feed data in s1 call flips_add(s1,1000,amat,meas,erro) call cpu_time(ts) remo = .FALSE. call flips_resize(s2,s1,newsize=1500,remove=remo) ! write(*,*) s2%ymat write(*,*) 'ncols',s2%ncols write(*,*) 'nrhs',s2%nrhs write(*,*) 'nbuf',s2%nbuf write(*,*) 'nrows',s2%nrows write(*,*) 'bw',s2%bw write(*,*) 'bbw',s2%bbw write(*,*) 'common',s2%common write(*,*) 'rl',s2%rl write(*,*) 'zeroth',s2%zeroth write(*,*) 'nrotbuf',s2%nrotbuf !s2%nrows = 1000 call cpu_time(te) ! Add some new data amat2 = 0.0 call random_number(rr) do i = 1,500 rr(yind(i,i,500)) = 1.0 end do call random_number(meas2) do i = 1,500 amat2(yind(i,1001,1500):yind(i,1500,1500)) = rr(yind(i,1,500):yind(i,500,500)) !write(*,*) amat2(yind(i,996,1500):yind(i,1005,1500)) end do !write(*,*) amat2(996:1005) !call random_number(meas2) call flips_add(s2,500,amat2,meas2,erro(1:500)) call flips_add(s3,500,rr,meas2,erro(1:500)) call flips_rotate(s1) call flips_rotate(s2) call flips_rotate(s3) ! call flips_resize(s4,s2,newsize=500) !write(*,*) s2%ymat(1:1000)-s1%ymat ! Solve all problems call flips_solve(s1) call flips_solve(s2) call flips_solve(s3) ! call flips_solve(s4) write(*,*) s1%solmat(1:5) write(*,*) s2%solmat(1:5) write(*,*) s2%solmat(1001:1005) write(*,*) s3%solmat(1:5) !write(*,*) s4%solmat(1:5) ! Compare results diff = sum(s2%solmat(1:1000) - s1%solmat)/1000 maxdiff = maxval(s2%solmat(1:1000) - s1%solmat) write(*,*) ' Mean diff:',diff write(*,*) ' Max diff:',maxdiff write(*,*) ' Resize time:',te-ts,'\n' call flips_kill(s1,.FALSE.) call flips_kill(s2,.FALSE.) call flips_kill(s3,.FALSE.) ! call flips_kill(s4,.FALSE.) deallocate(amat,amat2,meas,erro,rr,meas2) end program rstest
/* * 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.sparklinedata.druid.client.test import com.github.nscala_time.time.Imports._ import org.apache.spark.sql.SPLLogging import org.apache.spark.sql.catalyst.dsl.expressions._ import org.apache.spark.sql.hive.test.sparklinedata.TestHive import org.apache.spark.sql.hive.test.sparklinedata.TestHive._ import org.apache.spark.sql.sources.druid.DruidPlanner import org.scalatest.BeforeAndAfterAll import org.sparklinedata.spark.dateTime.dsl.expressions._ import scala.language.postfixOps object StarSchemaTpchQueries { val q1Predicate = dateTime('l_shipdate) <= (dateTime("1997-12-01") - 3.day) val q1 = date"""select l_returnflag, l_linestatus, count(*), sum(l_extendedprice) as s, max(ps_supplycost) as m, avg(ps_availqty) as a,count(distinct o_orderkey) from lineitem, partsupp, orders where $q1Predicate and l_orderkey = o_orderkey and l_suppkey = ps_suppkey and l_partkey = ps_partkey group by l_returnflag, l_linestatus""".stripMargin val q3OrderDtPredicate = dateTime('o_orderdate) < dateTime("1995-03-15") val q3ShipDtPredicate = dateTime('l_shipdate) > dateTime("1995-03-15") val q3 = date""" select o_orderkey, sum(l_extendedprice) as price, o_orderdate, o_shippriority from customer, |orders, |lineitem where c_mktsegment = 'BUILDING' and $q3OrderDtPredicate and $q3ShipDtPredicate |and c_custkey = o_custkey |and l_orderkey = o_orderkey group by o_orderkey, o_orderdate, o_shippriority """.stripMargin val q5orderDtPredicateLower = dateTime('o_orderdate) >= dateTime("1994-01-01") val q5OrderDtPredicateUpper= dateTime('o_orderdate) < (dateTime("1994-01-01") + 1.year) /** * Changes from original query: * - join in ''partsupp''. Because we don't support multiple join paths to a table(supplier * in this case), the StarSchema doesn't know about the join between ''lineitem'' and * ''supplier'' * - use suppnation and suppregion instead of nation and region. */ val q5 = date""" select sn_name, sum(l_extendedprice) as extendedPrice from customer, orders, lineitem, partsupp, supplier, suppnation, suppregion where c_custkey = o_custkey |and l_orderkey = o_orderkey |and l_suppkey = ps_suppkey |and l_partkey = ps_partkey |and ps_suppkey = s_suppkey |and s_nationkey = sn_nationkey |and sn_regionkey = sr_regionkey |and sr_name = 'ASIA' and $q5orderDtPredicateLower and $q5OrderDtPredicateUpper group by sn_name """.stripMargin val q7ShipDtYear = dateTime('l_shipdate) year /** * Changes from original query: * - join in ''partsupp''. Because we don't support multiple join paths to a table(supplier * in this case), the StarSchema doesn't know about the join between ''lineitem'' and * ''supplier'' * - use suppnation and custnation instead of 'nation n1' and 'nation n2' */ val q7 = date""" select sn_name, cn_name, $q7ShipDtYear as l_year, sum(l_extendedprice) as extendedPrice from partsupp, supplier, |lineitem, orders, customer, suppnation n1, custnation n2 where ps_suppkey = s_suppkey |and l_suppkey = ps_suppkey |and l_partkey = ps_partkey |and o_orderkey = l_orderkey |and c_custkey = o_custkey |and s_nationkey = n1.sn_nationkey and c_nationkey = n2.cn_nationkey and ((sn_name = 'FRANCE' and cn_name = 'GERMANY') or (cn_name = 'FRANCE' and sn_name = 'GERMANY') ) group by sn_name, cn_name, $q7ShipDtYear """.stripMargin val q8OrderDtYear = dateTime('o_orderdate) year val q8DtP1 = dateTime('o_orderdate) >= dateTime("1995-01-01") val q8DtP2 = dateTime('o_orderdate) <= dateTime("1996-12-31") /** * Changes from original query: * - join in ''partsupp''. Because we don't support multiple join paths to a table(supplier * in this case), the StarSchema doesn't know about the join between ''lineitem'' and * ''supplier'' * - use suppnation and custnation instead of 'nation n1' and 'nation n2' */ val q8 = date""" select $q8OrderDtYear as o_year, sum(l_extendedprice) as price from partsupp, part, supplier, lineitem, orders, customer, custnation n1, suppnation n2, custregion where ps_partkey = l_partkey |and ps_suppkey = l_suppkey |and ps_partkey = p_partkey |and ps_suppkey = s_suppkey |and l_orderkey = o_orderkey |and o_custkey = c_custkey |and c_nationkey = n1.cn_nationkey and |n1.cn_regionkey = cr_regionkey and |s_nationkey = n2.sn_nationkey and cr_name = 'AMERICA' and p_type = 'ECONOMY ANODIZED STEEL' and $q8DtP1 and $q8DtP2 group by $q8OrderDtYear """.stripMargin val q10DtP1 = dateTime('o_orderdate) >= dateTime("1993-10-01") val q10DtP2 = dateTime('o_orderdate) < (dateTime("1993-10-01") + 3.month) /** * Changes from original query: * - use custnation instead of 'nation' */ val q10 = date""" select c_name, cn_name, c_address, c_phone, c_comment, sum(l_extendedprice) as price from customer, orders, lineitem, custnation where c_custkey = o_custkey |and l_orderkey = o_orderkey |and c_nationkey = cn_nationkey and $q10DtP1 and $q10DtP2 and l_returnflag = 'R' group by c_name, cn_name, c_address, c_phone, c_comment """.stripMargin } class StarSchemaBaseTest extends BaseTest with BeforeAndAfterAll with SPLLogging { val TPCH_BASE_DIR = System.getProperty("user.dir") + "/quickstart/tpch/datascale1.sample" def tpchDataFolder(tableName : String) = s"$TPCH_BASE_DIR/$tableName/" override def beforeAll() = { super.beforeAll() sql(s"""CREATE TABLE if not exists lineitembase(l_orderkey integer, l_partkey integer, l_suppkey integer, l_linenumber integer, l_quantity double, l_extendedprice double, l_discount double, l_tax double, l_returnflag string, l_linestatus string, l_shipdate string, l_commitdate string, l_receiptdate string, l_shipinstruct string, l_shipmode string, l_comment string) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("lineitem")}", header "false", delimiter "|")""".stripMargin) TestHive.table("lineitembase").cache sql(s"""CREATE TABLE if not exists orders( |o_orderkey integer, o_custkey integer, | o_orderstatus VARCHAR(1), | o_totalprice double, | o_orderdate string, | o_orderpriority VARCHAR(15), | o_clerk VARCHAR(15), | o_shippriority integer, | o_comment VARCHAR(79) ) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("orders")}", header "false", delimiter "|")""".stripMargin) TestHive.table("orders").cache sql(s"""CREATE TABLE if not exists partsupp( | ps_partkey integer, ps_suppkey integer, | ps_availqty integer, ps_supplycost double, | ps_comment VARCHAR(199) ) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("partsupp")}", header "false", delimiter "|")""".stripMargin) TestHive.table("partsupp").cache sql(s"""CREATE TABLE if not exists supplier( s_suppkey integer, s_name string, s_address string, s_nationkey integer, | s_phone string, s_acctbal double, s_comment string) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("supplier")}", header "false", delimiter "|")""".stripMargin) TestHive.table("supplier").cache sql(s"""CREATE TABLE if not exists part(p_partkey integer, p_name string, | p_mfgr string, p_brand string, p_type string, p_size integer, p_container string, | p_retailprice double, | p_comment string) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("part")}", header "false", delimiter "|")""".stripMargin) TestHive.table("part").cache sql(s"""CREATE TABLE if not exists customer( | c_custkey INTEGER, | c_name VARCHAR(25), | c_address VARCHAR(40), | c_nationkey INTEGER, | c_phone VARCHAR(15), | c_acctbal double, | c_mktsegment VARCHAR(10), | c_comment VARCHAR(117) |) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("customer")}", header "false", delimiter "|")""".stripMargin) TestHive.table("customer").cache sql(s"""CREATE TABLE if not exists custnation( | cn_nationkey integer, cn_name VARCHAR(25), | cn_regionkey integer, cn_comment VARCHAR(152) |) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("nation")}", header "false", delimiter "|")""".stripMargin) TestHive.table("custnation").cache sql(s"""CREATE TABLE if not exists custregion( | cr_regionkey integer, cr_name VARCHAR(25), | cr_comment VARCHAR(152) |) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("region")}", header "false", delimiter "|")""".stripMargin) TestHive.table("custregion").cache sql(s"""CREATE TABLE if not exists suppnation( | sn_nationkey integer, sn_name VARCHAR(25), | sn_regionkey integer, sn_comment VARCHAR(152) |) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("nation")}", header "false", delimiter "|")""".stripMargin) TestHive.table("suppnation").cache sql(s"""CREATE TABLE if not exists suppregion( | sr_regionkey integer, sr_name VARCHAR(25), | sr_comment VARCHAR(152) |) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("region")}", header "false", delimiter "|")""".stripMargin) TestHive.table("suppregion").cache TestHive.setConf(DruidPlanner.SPARKLINEDATA_CACHE_TABLES_TOCHECK.key, "orderLineItemPartSupplierBase,suppregion,suppnation," + "custregion,custnation,customer,part,supplier,partsupp,orders,lineitembase") /* * for -ve testing only */ sql(s"""CREATE TABLE if not exists partsupp2( | ps_partkey integer, ps_suppkey integer, | ps_availqty integer, ps_supplycost double, | ps_comment VARCHAR(199) ) USING com.databricks.spark.csv OPTIONS (path "${tpchDataFolder("partsupp")}", header "false", delimiter "|")""".stripMargin) sql( s"""CREATE TABLE if not exists lineitem USING org.sparklinedata.druid OPTIONS (sourceDataframe "lineItemBase", timeDimensionColumn "l_shipdate", druidDatasource "tpch", druidHost '$zkConnectString', zkQualifyDiscoveryNames "true", columnMapping '$colMapping', numProcessingThreadsPerHistorical '1', functionalDependencies '$functionalDependencies', starSchema '${starSchema()}')""".stripMargin ) } }
<?php session_start(); include "connection.php"; if (isset($_SESSION['user'])) { $query = "SELECT * FROM questions"; $run = mysqli_query($conn , $query) or die(mysqli_error($conn)); $total = mysqli_num_rows($run); ?> <html> <head> <title>QuizApp</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> <link rel="stylesheet" type="text/css" href="css/style.css"> </head> <body> <header> <nav class="navbar navbar-expand-sm bg-dark fixed-top"> <ul class="navbar-nav"> <li class="nav-item"> <a class="nav-link" href="index.php">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="admin.php">Admin Panel</a> </li> <li class="nav-item"> <a class="nav-link" href="ulogin.php">Login</a> </li> <li class="nav-item"> <a class="nav-link" href="add.php">Add Question</a> </li> <li class="nav-item"> <a class="nav-link" href="allquestions.php">All Questions</a> </li> <li class="nav-item"> <a class="nav-link" href="uregister.php">Register</a> </li> <li class="nav-item"> <a class="nav-link" href="exit.php">Logout</a> </li> </nav> </header> <main> <div class="container" style="margin-top: 100px"> <h2>Welcome to PHP QUIZ</h2> <p>This is just a simple quiz game to test your knowledge!</p> <ul> <li><strong>Number of questions: </strong><?php echo $total; ?></li> <li><strong>Type: </strong>Multiple Choice</li> <li><strong>Estimated time for each question: </strong><?php echo $total * 0.05 * 60; ?> seconds</li> <li><strong>Score: </strong> &nbsp; +1 point for each correct answer</li> </ul> <a href="question.php?n=1" class="start">Start Kuiz</a> <a href="exit.php" class="add">Exit</a> </div> </main> <footer> <div class="container"> Copyright @ PHP_kuiz </div> </footer> </body> </html> <?php unset($_SESSION['score']); ?> <?php } else { header("location: index.php"); } ?>