text
stringlengths 27
775k
|
|---|
//! Custom enumerators not specifically based on OpenCL C-style enums.
//!
//!
//!
//
// [TODO]: Evaluate usefulness of `Error` impls and potentially remove.
// [TODO]: Possibly remove custom implementation of `Debug` and derive instead.
//
#![allow(dead_code)]
use std;
// use std::mem;
// use std::error::Error;
// use std::ffi::CString;
// use std::convert::Into;
use libc::{size_t, c_void};
use num::FromPrimitive;
use util;
use ffi::{cl_image_format, cl_context_properties};
use ::{OclPrm, CommandQueueProperties, PlatformId, PlatformInfo, DeviceId, DeviceInfo, ContextInfo,
GlContextInfo, Context, CommandQueue, CommandQueueInfo, CommandType, CommandExecutionStatus,
Mem, MemInfo, MemObjectType, MemFlags, Sampler, SamplerInfo, AddressingMode, FilterMode,
ProgramInfo, ProgramBuildInfo, Program, ProgramBuildStatus, ProgramBinaryType, KernelInfo,
KernelArgInfo, KernelWorkGroupInfo, KernelArgAddressQualifier, KernelArgAccessQualifier,
KernelArgTypeQualifier, ImageInfo, ImageFormat, EventInfo, ProfilingInfo, DeviceType,
DeviceFpConfig, DeviceMemCacheType, DeviceLocalMemType, DeviceExecCapabilities,
DevicePartitionProperty, DeviceAffinityDomain, OpenclVersion, ContextProperties,
ImageFormatParseResult, Status};
use error::{Result as OclResult, Error as OclError};
// use cl_h;
/// `try!` for `***InfoResult` types.
macro_rules! try_ir {
( $ expr : expr ) => {
match $expr {
Ok(val) => val,
Err(err) => return err.into(),
}
};
}
pub enum EmptyInfoResult {
Platform,
Device,
Context,
GlContext,
CommandQueue,
Mem,
Image,
Sampler,
Program,
ProgramBuild,
Kernel,
KernelArg,
KernelWorkGroup,
Event,
Profiling,
}
impl std::fmt::Debug for EmptyInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
use std::error::Error;
f.write_str(self.description())
}
}
impl std::fmt::Display for EmptyInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
use std::error::Error;
f.write_str(self.description())
}
}
impl std::error::Error for EmptyInfoResult {
fn description(&self) -> &str {
match *self {
EmptyInfoResult::Platform => "platform info unavailable",
EmptyInfoResult::Device => "device info unavailable",
EmptyInfoResult::Context => "context info unavailable",
EmptyInfoResult::GlContext => "OpenGL context info unavailable",
EmptyInfoResult::CommandQueue => "command queue info unavailable",
EmptyInfoResult::Mem => "mem info unavailable",
EmptyInfoResult::Image => "image info unavailable",
EmptyInfoResult::Sampler => "sampler info unavailable",
EmptyInfoResult::Program => "program info unavailable",
EmptyInfoResult::ProgramBuild => "program build info unavailable",
EmptyInfoResult::Kernel => "kernel info unavailable",
EmptyInfoResult::KernelArg => "kernel argument info unavailable",
EmptyInfoResult::KernelWorkGroup => "kernel work-group info unavailable",
EmptyInfoResult::Event => "event info unavailable",
EmptyInfoResult::Profiling => "event profiling info unavailable",
}
}
}
/// [UNSAFE] Kernel argument option type.
///
/// The type argument `T` is ignored for `Mem`, `Sampler`, and `UnsafePointer`
/// (just put `usize` or anything).
///
/// ## Safety
///
/// If there was some way for this enum to be marked unsafe it would be.
///
/// The `Mem`, `Sampler`, `Scalar`, and `Local` variants are tested and will
/// work perfectly well.
///
/// * `Vector`: The `Vector` variant is poorly tested and probably a bit
/// platform dependent. Use at your own risk.
/// * `UnsafePointer`: Really know what you're doing when using the
/// `UnsafePointer` variant. Setting its properties, `size` and `value`,
/// incorrectly can cause bugs, crashes, and data integrity issues that are
/// very hard to track down. This is due to the fact that the pointer value
/// is intended to be a pointer to a memory structure in YOUR programs
/// memory, NOT a copy of an OpenCL object pointer (such as a `cl_h::cl_mem`
/// for example, which is itself a `*mut libc::c_void`). This is made more
/// complicated by the fact that the pointer can also be a pointer to a
/// scalar (ex: `*const u32`, etc.). See the [SDK docs] for more details.
///
/// [SDK docs]: https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clSetKernelArg.html
#[derive(Debug)]
pub enum KernelArg<'a, T: 'a + OclPrm> {
/// Type `T` is ignored.
Mem(&'a Mem),
/// Type `T` is ignored.
MemNull,
/// Type `T` is ignored.
Sampler(&'a Sampler),
/// Type `T` is ignored.
SamplerNull,
Scalar(T),
Vector(T),
/// Length in multiples of T (not bytes).
Local(&'a usize),
/// `size`: size in bytes. Type `T` is ignored.
UnsafePointer { size: size_t, value: *const c_void },
}
/// Platform info result.
///
// #[derive(Clone, Copy, Debug, PartialEq)]
pub enum PlatformInfoResult {
Profile(String),
Version(String),
Name(String),
Vendor(String),
Extensions(String),
Error(Box<OclError>),
}
impl PlatformInfoResult {
pub fn from_bytes(request: PlatformInfo, result: OclResult<Vec<u8>>)
-> PlatformInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return PlatformInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Platform)));
}
let string = match util::bytes_into_string(result) {
Ok(s) => s,
Err(err) => return PlatformInfoResult::Error(Box::new(err)),
};
match request {
PlatformInfo::Profile => PlatformInfoResult::Profile(string),
PlatformInfo::Version => PlatformInfoResult::Version(string),
PlatformInfo::Name => PlatformInfoResult::Name(string),
PlatformInfo::Vendor => PlatformInfoResult::Vendor(string),
PlatformInfo::Extensions => PlatformInfoResult::Extensions(string),
}
}
Err(err) => PlatformInfoResult::Error(Box::new(err)),
}
}
/// Parse the `Version` string and get a numeric result as `OpenclVersion`.
pub fn as_opencl_version(&self) -> OclResult<OpenclVersion> {
if let PlatformInfoResult::Version(ref ver) = *self {
OpenclVersion::from_info_str(ver)
} else {
OclError::err_string(format!("PlatformInfoResult::as_opencl_version(): Invalid platform info \
result variant: ({:?}). This function can only be called on a \
'PlatformInfoResult::Version' variant.", self))
}
}
}
impl std::fmt::Debug for PlatformInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self)
}
}
impl std::fmt::Display for PlatformInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
PlatformInfoResult::Profile(ref s) => write!(f, "{}", s),
PlatformInfoResult::Version(ref s) => write!(f, "{}", s),
PlatformInfoResult::Name(ref s) => write!(f, "{}", s),
PlatformInfoResult::Vendor(ref s) => write!(f, "{}", s),
PlatformInfoResult::Extensions(ref s) => write!(f, "{}", s),
PlatformInfoResult::Error(ref err) => write!(f, "{}", err),
}
}
}
impl From<PlatformInfoResult> for String {
fn from(ir: PlatformInfoResult) -> String {
match ir {
PlatformInfoResult::Profile(string)
| PlatformInfoResult::Version(string)
| PlatformInfoResult::Name(string)
| PlatformInfoResult::Vendor(string)
| PlatformInfoResult::Extensions(string) => string,
PlatformInfoResult::Error(err) => err.to_string(),
}
}
}
impl From<OclError> for PlatformInfoResult {
fn from(err: OclError) -> PlatformInfoResult {
PlatformInfoResult::Error(Box::new(err))
}
}
impl From<PlatformInfoResult> for OclError {
fn from(err: PlatformInfoResult) -> OclError {
match err {
PlatformInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<PlatformInfoResult>: Not an error."),
}
}
}
impl From<std::ffi::IntoStringError> for PlatformInfoResult {
fn from(err: std::ffi::IntoStringError) -> PlatformInfoResult {
PlatformInfoResult::Error(Box::new(err.into()))
}
}
impl From<std::ffi::NulError> for PlatformInfoResult {
fn from(err: std::ffi::NulError) -> PlatformInfoResult {
PlatformInfoResult::Error(Box::new(err.into()))
}
}
impl std::error::Error for PlatformInfoResult {
fn description(&self) -> &str {
match *self {
PlatformInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A device info result.
///
// #[derive(Debug)]
pub enum DeviceInfoResult {
// TemporaryPlaceholderVariant(Vec<u8>),
Type(DeviceType), // cl_device_type FLAGS u64
VendorId(u32), // cl_uint
MaxComputeUnits(u32), // cl_uint
MaxWorkItemDimensions(u32), // cl_uint
MaxWorkGroupSize(usize), // usize
MaxWorkItemSizes(Vec<usize>), // [usize; CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS]
PreferredVectorWidthChar(u32), // cl_uint
PreferredVectorWidthShort(u32),// cl_uint
PreferredVectorWidthInt(u32), // cl_uint
PreferredVectorWidthLong(u32), // cl_uint
PreferredVectorWidthFloat(u32),// cl_uint
PreferredVectorWidthDouble(u32),// cl_uint
MaxClockFrequency(u32), // cl_uint
AddressBits(u32), // cl_uint
MaxReadImageArgs(u32), // cl_uint
MaxWriteImageArgs(u32), // cl_uint
MaxMemAllocSize(u64), // cl_ulong
Image2dMaxWidth(usize), // usize
Image2dMaxHeight(usize), // usize
Image3dMaxWidth(usize), // usize
Image3dMaxHeight(usize), // usize
Image3dMaxDepth(usize), // usize
ImageSupport(bool), // cl_bool
MaxParameterSize(usize), // usize
MaxSamplers(u32), // cl_uint
MemBaseAddrAlign(u32), // cl_uint
MinDataTypeAlignSize(u32), // cl_uint
SingleFpConfig(DeviceFpConfig), // cl_device_fp_config FLAGS u64
GlobalMemCacheType(DeviceMemCacheType), // cl_device_mem_cache_type ENUM
GlobalMemCachelineSize(u32), // cl_uint
GlobalMemCacheSize(u64), // cl_ulong
GlobalMemSize(u64), // cl_ulong
MaxConstantBufferSize(u64), // cl_ulong
MaxConstantArgs(u32), // cl_uint
LocalMemType(DeviceLocalMemType), // cl_device_local_mem_type ENUM
LocalMemSize(u64), // cl_ulong
ErrorCorrectionSupport(bool), // cl_bool
ProfilingTimerResolution(usize), // usize
EndianLittle(bool), // cl_bool
Available(bool), // cl_bool
CompilerAvailable(bool), // cl_bool
ExecutionCapabilities(DeviceExecCapabilities), // cl_device_exec_capabilities FLAGS u64
QueueProperties(CommandQueueProperties), // cl_command_queue_properties FLAGS u64
Name(String), // String
Vendor(String), // String
DriverVersion(String), // String
Profile(String), // String
// Version(String), // String
Version(OpenclVersion),
Extensions(String), // String
Platform(PlatformId), // cl_platform_id
DoubleFpConfig(DeviceFpConfig), // cl_device_fp_config FLAGS u64
HalfFpConfig(DeviceFpConfig), // cl_device_fp_config FLAGS u64
PreferredVectorWidthHalf(u32), // cl_uint
HostUnifiedMemory(bool), // cl_bool
NativeVectorWidthChar(u32), // cl_uint
NativeVectorWidthShort(u32), // cl_uint
NativeVectorWidthInt(u32), // cl_uint
NativeVectorWidthLong(u32), // cl_uint
NativeVectorWidthFloat(u32), // cl_uint
NativeVectorWidthDouble(u32), // cl_uint
NativeVectorWidthHalf(u32), // cl_uint
OpenclCVersion(String), // String
LinkerAvailable(bool), // cl_bool
BuiltInKernels(String), // String
ImageMaxBufferSize(usize), // usize
ImageMaxArraySize(usize), // usize
ParentDevice(Option<DeviceId>), // cl_device_id
PartitionMaxSubDevices(u32), // cl_uint
PartitionProperties(Vec<DevicePartitionProperty>), // cl_device_partition_property ENUM
PartitionAffinityDomain(DeviceAffinityDomain), // cl_device_affinity_domain FLAGS u64
PartitionType(Vec<DevicePartitionProperty>), // cl_device_partition_property ENUM
ReferenceCount(u32), // cl_uint
PreferredInteropUserSync(bool), // cl_bool
PrintfBufferSize(usize), // usize
ImagePitchAlignment(u32), // cl_uint
ImageBaseAddressAlignment(u32),// cl_uint
Error(Box<OclError>),
}
impl DeviceInfoResult {
/// Returns a new `DeviceInfoResult::MaxWorkItemSizes` variant.
pub fn from_bytes_max_work_item_sizes(request: DeviceInfo, result: OclResult<Vec<u8>>,
max_wi_dims: u32) -> DeviceInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return DeviceInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Device)));
}
match request {
DeviceInfo::MaxWorkItemSizes => {
match max_wi_dims {
3 => {
// let r = match unsafe { try_ir!(util::bytes_into::<[usize; 3]>(result)) } {
// Ok(r) => r,
// Err(err) => return err.into(),
// };
let r = unsafe { try_ir!(util::bytes_into::<[usize; 3]>(result)) };
let mut v = Vec::with_capacity(3);
v.extend_from_slice(&r);
DeviceInfoResult::MaxWorkItemSizes(v)
},
2 => {
let r = unsafe { try_ir!(util::bytes_into::<[usize; 2]>(result)) };
let mut v = Vec::with_capacity(2);
v.extend_from_slice(&r);
DeviceInfoResult::MaxWorkItemSizes(v)
},
1 => {
let r = unsafe { try_ir!(util::bytes_into::<[usize; 1]>(result)) };
let mut v = Vec::with_capacity(1);
v.extend_from_slice(&r);
DeviceInfoResult::MaxWorkItemSizes(v)
},
_ => DeviceInfoResult::Error(Box::new(OclError::from("Error \
determining number of dimensions for MaxWorkItemSizes."))),
}
},
_ => panic!("DeviceInfoResult::from_bytes_max_work_item_sizes: Called with \
invalid info variant ({:?}). Call '::from_bytes` instead.", request),
} },
Err(err) => DeviceInfoResult::Error(Box::new(err)),
}
}
/// Returns a new `DeviceInfoResult` for all variants except `MaxWorkItemSizes`.
pub fn from_bytes(request: DeviceInfo, result: OclResult<Vec<u8>>)
-> DeviceInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return DeviceInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Device)));
}
match request {
DeviceInfo::Type => {
let r = unsafe { try_ir!(util::bytes_into::<DeviceType>(result)) };
DeviceInfoResult::Type(r)
},
DeviceInfo::VendorId => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::VendorId(r)
},
DeviceInfo::MaxComputeUnits => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::MaxComputeUnits(r)
},
DeviceInfo::MaxWorkItemDimensions => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::MaxWorkItemDimensions(r)
},
DeviceInfo::MaxWorkGroupSize => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::MaxWorkGroupSize(r)
},
DeviceInfo::MaxWorkItemSizes => {
panic!("DeviceInfoResult::from_bytes: Called with invalid info variant ({:?}). \
Call '::from_bytes_max_work_item_sizes` instead.", request);
},
DeviceInfo::PreferredVectorWidthChar => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::PreferredVectorWidthChar(r)
},
DeviceInfo::PreferredVectorWidthShort => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::PreferredVectorWidthShort(r)
},
DeviceInfo::PreferredVectorWidthInt => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::PreferredVectorWidthInt(r)
},
DeviceInfo::PreferredVectorWidthLong => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::PreferredVectorWidthLong(r)
},
DeviceInfo::PreferredVectorWidthFloat => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::PreferredVectorWidthFloat(r)
},
DeviceInfo::PreferredVectorWidthDouble => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::PreferredVectorWidthDouble(r)
},
DeviceInfo::MaxClockFrequency => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::MaxClockFrequency(r)
},
DeviceInfo::AddressBits => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::AddressBits(r)
},
DeviceInfo::MaxReadImageArgs => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::MaxReadImageArgs(r)
},
DeviceInfo::MaxWriteImageArgs => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::MaxWriteImageArgs(r)
},
DeviceInfo::MaxMemAllocSize => {
let r = unsafe { try_ir!(util::bytes_into::<u64>(result)) };
DeviceInfoResult::MaxMemAllocSize(r)
},
DeviceInfo::Image2dMaxWidth => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::Image2dMaxWidth(r)
},
DeviceInfo::Image2dMaxHeight => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::Image2dMaxHeight(r)
},
DeviceInfo::Image3dMaxWidth => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::Image3dMaxWidth(r)
},
DeviceInfo::Image3dMaxHeight => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::Image3dMaxHeight(r)
},
DeviceInfo::Image3dMaxDepth => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::Image3dMaxDepth(r)
},
DeviceInfo::ImageSupport => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::ImageSupport(r != 0)
},
DeviceInfo::MaxParameterSize => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::MaxParameterSize(r)
},
DeviceInfo::MaxSamplers => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::MaxSamplers(r)
},
DeviceInfo::MemBaseAddrAlign => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::MemBaseAddrAlign(r)
},
DeviceInfo::MinDataTypeAlignSize => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::MinDataTypeAlignSize(r)
},
DeviceInfo::SingleFpConfig => {
let r = unsafe { try_ir!(util::bytes_into::<DeviceFpConfig>(result)) };
DeviceInfoResult::SingleFpConfig(r)
},
DeviceInfo::GlobalMemCacheType => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
match DeviceMemCacheType::from_u32(r) {
Some(e) => DeviceInfoResult::GlobalMemCacheType(e),
None => DeviceInfoResult::Error(Box::new(
OclError::from(format!("Error converting '{:X}' to \
DeviceMemCacheType.", r)))),
}
},
DeviceInfo::GlobalMemCachelineSize => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::GlobalMemCachelineSize(r)
},
DeviceInfo::GlobalMemCacheSize => {
let r = unsafe { try_ir!(util::bytes_into::<u64>(result)) };
DeviceInfoResult::GlobalMemCacheSize(r)
},
DeviceInfo::GlobalMemSize => {
let r = unsafe { try_ir!(util::bytes_into::<u64>(result)) };
DeviceInfoResult::GlobalMemSize(r)
},
DeviceInfo::MaxConstantBufferSize => {
let r = unsafe { try_ir!(util::bytes_into::<u64>(result)) };
DeviceInfoResult::MaxConstantBufferSize(r)
},
DeviceInfo::MaxConstantArgs => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::MaxConstantArgs(r)
},
DeviceInfo::LocalMemType => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
match DeviceLocalMemType::from_u32(r) {
Some(e) => DeviceInfoResult::LocalMemType(e),
None => DeviceInfoResult::Error(Box::new(
OclError::from(format!("Error converting '{:X}' to \
DeviceLocalMemType.", r)))),
}
},
DeviceInfo::LocalMemSize => {
let r = unsafe { try_ir!(util::bytes_into::<u64>(result)) };
DeviceInfoResult::LocalMemSize(r)
},
DeviceInfo::ErrorCorrectionSupport => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::ErrorCorrectionSupport(r != 0)
},
DeviceInfo::ProfilingTimerResolution => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::ProfilingTimerResolution(r)
},
DeviceInfo::EndianLittle => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::EndianLittle(r != 0)
},
DeviceInfo::Available => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::Available(r != 0)
},
DeviceInfo::CompilerAvailable => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::CompilerAvailable(r != 0)
},
DeviceInfo::ExecutionCapabilities => {
let r = unsafe { try_ir!(util::bytes_into::<DeviceExecCapabilities>(result)) };
DeviceInfoResult::ExecutionCapabilities(r)
},
DeviceInfo::QueueProperties => {
let r = unsafe { try_ir!(util::bytes_into::<CommandQueueProperties>(result)) };
DeviceInfoResult::QueueProperties(r)
},
DeviceInfo::Name => {
match util::bytes_into_trimmed_string(result) {
Ok(s) => DeviceInfoResult::Name(s),
Err(err) => DeviceInfoResult::Error(Box::new(err)),
}
},
DeviceInfo::Vendor => {
match util::bytes_into_string(result) {
Ok(s) => DeviceInfoResult::Vendor(s),
Err(err) => DeviceInfoResult::Error(Box::new(err)),
}
},
DeviceInfo::DriverVersion => {
match util::bytes_into_string(result) {
Ok(s) => DeviceInfoResult::DriverVersion(s),
Err(err) => DeviceInfoResult::Error(Box::new(err)),
}
},
DeviceInfo::Profile => {
match util::bytes_into_string(result) {
Ok(s) => DeviceInfoResult::Profile(s),
Err(err) => DeviceInfoResult::Error(Box::new(err)),
}
},
DeviceInfo::Version => {
match util::bytes_into_string(result) {
Ok(s) => DeviceInfoResult::Version(try_ir!(OpenclVersion::from_info_str(&s))),
Err(err) => DeviceInfoResult::Error(Box::new(err)),
}
},
DeviceInfo::Extensions => {
match util::bytes_into_string(result) {
Ok(s) => DeviceInfoResult::Extensions(s),
Err(err) => DeviceInfoResult::Error(Box::new(err)),
}
},
DeviceInfo::Platform => {
let r = unsafe { try_ir!(util::bytes_into::<PlatformId>(result)) };
DeviceInfoResult::Platform(r)
},
DeviceInfo::DoubleFpConfig => {
let r = unsafe { try_ir!(util::bytes_into::<DeviceFpConfig>(result)) };
DeviceInfoResult::DoubleFpConfig(r)
},
DeviceInfo::HalfFpConfig => {
let r = unsafe { try_ir!(util::bytes_into::<DeviceFpConfig>(result)) };
DeviceInfoResult::HalfFpConfig(r)
},
DeviceInfo::PreferredVectorWidthHalf => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::PreferredVectorWidthHalf(r)
},
DeviceInfo::HostUnifiedMemory => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::HostUnifiedMemory(r != 0)
},
DeviceInfo::NativeVectorWidthChar => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::NativeVectorWidthChar(r)
},
DeviceInfo::NativeVectorWidthShort => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::NativeVectorWidthShort(r)
},
DeviceInfo::NativeVectorWidthInt => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::NativeVectorWidthInt(r)
},
DeviceInfo::NativeVectorWidthLong => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::NativeVectorWidthLong(r)
},
DeviceInfo::NativeVectorWidthFloat => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::NativeVectorWidthFloat(r)
},
DeviceInfo::NativeVectorWidthDouble => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::NativeVectorWidthDouble(r)
},
DeviceInfo::NativeVectorWidthHalf => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::NativeVectorWidthHalf(r)
},
DeviceInfo::OpenclCVersion => {
match util::bytes_into_string(result) {
Ok(s) => DeviceInfoResult::OpenclCVersion(s),
Err(err) => DeviceInfoResult::Error(Box::new(err)),
}
},
DeviceInfo::LinkerAvailable => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::LinkerAvailable(r != 0)
},
DeviceInfo::BuiltInKernels => {
match util::bytes_into_string(result) {
Ok(s) => DeviceInfoResult::BuiltInKernels(s),
Err(err) => DeviceInfoResult::Error(Box::new(err)),
}
},
DeviceInfo::ImageMaxBufferSize => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::ImageMaxBufferSize(r)
},
DeviceInfo::ImageMaxArraySize => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::ImageMaxArraySize(r)
},
DeviceInfo::ParentDevice => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
if ptr.is_null() {
DeviceInfoResult::ParentDevice(None)
} else {
DeviceInfoResult::ParentDevice(Some(unsafe { DeviceId::from_raw(ptr) }))
}
},
DeviceInfo::PartitionMaxSubDevices => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::PartitionMaxSubDevices(r)
},
DeviceInfo::PartitionProperties => {
// [FIXME]: INCOMPLETE:
//
// let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
// match DevicePartitionProperty::from_u32(r) {
// Some(e) => DeviceInfoResult::PartitionProperties(e),
// None => DeviceInfoResult::Error(Box::new(
// OclError::from(format!("Error converting '{:X}' to \
// DevicePartitionProperty.", r)))),
// }
DeviceInfoResult::PartitionProperties(Vec::with_capacity(0))
},
DeviceInfo::PartitionAffinityDomain => {
let r = unsafe { try_ir!(util::bytes_into::<DeviceAffinityDomain>(result)) };
DeviceInfoResult::PartitionAffinityDomain(r)
},
DeviceInfo::PartitionType => {
// [FIXME]: INCOMPLETE:
//
// let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
// match DevicePartitionProperty::from_u32(r) {
// Some(e) => DeviceInfoResult::PartitionType(e),
// None => DeviceInfoResult::Error(Box::new(
// OclError::from(format!("Error converting '{:X}' to \
// DevicePartitionProperty.", r)))),
// }
DeviceInfoResult::PartitionType(Vec::with_capacity(0))
},
DeviceInfo::ReferenceCount => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::ReferenceCount(r)
},
DeviceInfo::PreferredInteropUserSync => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::PreferredInteropUserSync(r != 0)
},
DeviceInfo::PrintfBufferSize => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
DeviceInfoResult::PrintfBufferSize(r)
},
DeviceInfo::ImagePitchAlignment => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::ImagePitchAlignment(r)
},
DeviceInfo::ImageBaseAddressAlignment => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
DeviceInfoResult::ImageBaseAddressAlignment(r)
},
// _ => DeviceInfoResult::TemporaryPlaceholderVariant(result),
}
},
Err(err) => err.into(),
}
}
/// Parse the `Version` string and get a numeric result as `OpenclVersion`.
pub fn as_opencl_version(&self) -> OclResult<OpenclVersion> {
if let DeviceInfoResult::Version(ver) = *self {
Ok(ver)
} else {
OclError::err_string(format!("DeviceInfoResult::as_opencl_version(): Invalid device info \
result variant: ({:?}). This function can only be called on a \
'DeviceInfoResult::Version' variant.", self))
}
}
}
impl std::fmt::Debug for DeviceInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self)
}
}
impl std::fmt::Display for DeviceInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
// DeviceInfoResult::TemporaryPlaceholderVariant(ref v) => {
// // TEMPORARY (and retarded):
// write!(f, "{}", to_string_retarded(v))
// },
DeviceInfoResult::Type(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::VendorId(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxComputeUnits(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxWorkItemDimensions(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxWorkGroupSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxWorkItemSizes(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::PreferredVectorWidthChar(ref s) => write!(f, "{}", s),
DeviceInfoResult::PreferredVectorWidthShort(ref s) => write!(f, "{}", s),
DeviceInfoResult::PreferredVectorWidthInt(ref s) => write!(f, "{}", s),
DeviceInfoResult::PreferredVectorWidthLong(ref s) => write!(f, "{}", s),
DeviceInfoResult::PreferredVectorWidthFloat(ref s) => write!(f, "{}", s),
DeviceInfoResult::PreferredVectorWidthDouble(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxClockFrequency(ref s) => write!(f, "{}", s),
DeviceInfoResult::AddressBits(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxReadImageArgs(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxWriteImageArgs(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxMemAllocSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::Image2dMaxWidth(ref s) => write!(f, "{}", s),
DeviceInfoResult::Image2dMaxHeight(ref s) => write!(f, "{}", s),
DeviceInfoResult::Image3dMaxWidth(ref s) => write!(f, "{}", s),
DeviceInfoResult::Image3dMaxHeight(ref s) => write!(f, "{}", s),
DeviceInfoResult::Image3dMaxDepth(ref s) => write!(f, "{}", s),
DeviceInfoResult::ImageSupport(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxParameterSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxSamplers(ref s) => write!(f, "{}", s),
DeviceInfoResult::MemBaseAddrAlign(ref s) => write!(f, "{}", s),
DeviceInfoResult::MinDataTypeAlignSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::SingleFpConfig(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::GlobalMemCacheType(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::GlobalMemCachelineSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::GlobalMemCacheSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::GlobalMemSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxConstantBufferSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::MaxConstantArgs(ref s) => write!(f, "{}", s),
DeviceInfoResult::LocalMemType(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::LocalMemSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::ErrorCorrectionSupport(ref s) => write!(f, "{}", s),
DeviceInfoResult::ProfilingTimerResolution(ref s) => write!(f, "{}", s),
DeviceInfoResult::EndianLittle(ref s) => write!(f, "{}", s),
DeviceInfoResult::Available(ref s) => write!(f, "{}", s),
DeviceInfoResult::CompilerAvailable(ref s) => write!(f, "{}", s),
DeviceInfoResult::ExecutionCapabilities(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::QueueProperties(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::Name(ref s) => write!(f, "{}", s),
DeviceInfoResult::Vendor(ref s) => write!(f, "{}", s),
DeviceInfoResult::DriverVersion(ref s) => write!(f, "{}", s),
DeviceInfoResult::Profile(ref s) => write!(f, "{}", s),
DeviceInfoResult::Version(ref s) => write!(f, "{}", s),
DeviceInfoResult::Extensions(ref s) => write!(f, "{}", s),
DeviceInfoResult::Platform(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::DoubleFpConfig(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::HalfFpConfig(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::PreferredVectorWidthHalf(ref s) => write!(f, "{}", s),
DeviceInfoResult::HostUnifiedMemory(ref s) => write!(f, "{}", s),
DeviceInfoResult::NativeVectorWidthChar(ref s) => write!(f, "{}", s),
DeviceInfoResult::NativeVectorWidthShort(ref s) => write!(f, "{}", s),
DeviceInfoResult::NativeVectorWidthInt(ref s) => write!(f, "{}", s),
DeviceInfoResult::NativeVectorWidthLong(ref s) => write!(f, "{}", s),
DeviceInfoResult::NativeVectorWidthFloat(ref s) => write!(f, "{}", s),
DeviceInfoResult::NativeVectorWidthDouble(ref s) => write!(f, "{}", s),
DeviceInfoResult::NativeVectorWidthHalf(ref s) => write!(f, "{}", s),
DeviceInfoResult::OpenclCVersion(ref s) => write!(f, "{}", s),
DeviceInfoResult::LinkerAvailable(ref s) => write!(f, "{}", s),
DeviceInfoResult::BuiltInKernels(ref s) => write!(f, "{}", s),
DeviceInfoResult::ImageMaxBufferSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::ImageMaxArraySize(ref s) => write!(f, "{}", s),
DeviceInfoResult::ParentDevice(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::PartitionMaxSubDevices(ref s) => write!(f, "{}", s),
DeviceInfoResult::PartitionProperties(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::PartitionAffinityDomain(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::PartitionType(ref s) => write!(f, "{:?}", s),
DeviceInfoResult::ReferenceCount(ref s) => write!(f, "{}", s),
DeviceInfoResult::PreferredInteropUserSync(ref s) => write!(f, "{}", s),
DeviceInfoResult::PrintfBufferSize(ref s) => write!(f, "{}", s),
DeviceInfoResult::ImagePitchAlignment(ref s) => write!(f, "{}", s),
DeviceInfoResult::ImageBaseAddressAlignment(ref s) => write!(f, "{}", s),
DeviceInfoResult::Error(ref err) => write!(f, "{}", err),
// r @ _ => panic!("DeviceInfoResult: Converting '{:?}' to string not yet implemented.", r),
}
}
}
impl From<DeviceInfoResult> for OclError {
fn from(err: DeviceInfoResult) -> OclError {
match err {
DeviceInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<DeviceInfoResult>: Not an error."),
}
}
}
impl From<OclError> for DeviceInfoResult {
fn from(err: OclError) -> DeviceInfoResult {
DeviceInfoResult::Error(Box::new(err))
}
}
impl From<DeviceInfoResult> for String {
fn from(ir: DeviceInfoResult) -> String {
ir.to_string()
}
}
impl std::error::Error for DeviceInfoResult {
fn description(&self) -> &str {
match *self {
DeviceInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A context info result.
///
/// [INCOMPLETE][FIXME]: Figure out what to do with the properties variant.
pub enum ContextInfoResult {
ReferenceCount(u32),
Devices(Vec<DeviceId>),
// Properties(Vec<isize>),
Properties(ContextProperties),
NumDevices(u32),
Error(Box<OclError>),
}
impl ContextInfoResult {
pub fn from_bytes(request: ContextInfo, result: OclResult<Vec<u8>>) -> ContextInfoResult {
match result {
Ok(result) => {
if result.is_empty() {
return ContextInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Context)));
}
match request {
ContextInfo::ReferenceCount => {
ContextInfoResult::ReferenceCount(util::bytes_to_u32(&result))
},
ContextInfo::Devices => { unsafe {
ContextInfoResult::Devices(try_ir!(util::bytes_into_vec::<DeviceId>(result)))
} },
ContextInfo::Properties => { unsafe {
let props_raw = try_ir!(util::bytes_into_vec::<cl_context_properties>(result));
let props = try_ir!(ContextProperties::from_raw(props_raw.as_slice()));
ContextInfoResult::Properties(props)
} },
ContextInfo::NumDevices => ContextInfoResult::NumDevices(util::bytes_to_u32(&result)),
}
},
Err(err) => ContextInfoResult::Error(Box::new(err)),
}
}
pub fn platform(&self) -> Option<PlatformId> {
match *self {
ContextInfoResult::Properties(ref props) => {
// match ContextProperties::extract_property_from_raw(ContextProperty::Platform, props) {
// Some(prop) => {
// match prop {
// ContextPropertyValue::Platform(plat) => Some(plat),
// _=> unreachable!(),
// }
// },
// // None => panic!("ContextInfoResult::platform: 'ContextProperty::Platform' \
// // property not found within raw context properties."),
// None => None,
// }
props.get_platform()
}
ContextInfoResult::Error(ref err) => panic!("{}", err),
_ => panic!("ContextInfoResult::platform: Not a 'ContextInfoResult::Properties(...)'"),
}
}
}
impl std::fmt::Debug for ContextInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for ContextInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
ContextInfoResult::ReferenceCount(ref count) => write!(f, "{}", count),
ContextInfoResult::Devices(ref vec) => write!(f, "{:?}", vec),
ContextInfoResult::Properties(ref props) => write!(f, "{:?}", props),
ContextInfoResult::NumDevices(ref num) => write!(f, "{}", num),
ContextInfoResult::Error(ref err) => write!(f, "{}", err),
}
}
}
impl From<ContextInfoResult> for String {
fn from(ir: ContextInfoResult) -> String {
ir.to_string()
}
}
impl From<OclError> for ContextInfoResult {
fn from(err: OclError) -> ContextInfoResult {
ContextInfoResult::Error(Box::new(err))
}
}
impl From<ContextInfoResult> for OclError {
fn from(err: ContextInfoResult) -> OclError {
match err {
ContextInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<ContextInfoResult>: Not an error."),
}
}
}
impl std::error::Error for ContextInfoResult {
fn description(&self) -> &str {
match *self {
ContextInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// An OpenGL context info result.
pub enum GlContextInfoResult {
CurrentDevice(DeviceId),
Devices(Vec<DeviceId>),
Error(Box<OclError>),
}
impl GlContextInfoResult {
pub fn from_bytes(request: GlContextInfo, result: OclResult<Vec<u8>>) -> GlContextInfoResult {
match result {
Ok(result) => {
if result.is_empty() {
return GlContextInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::GlContext)));
}
match request {
GlContextInfo::CurrentDevice => { unsafe {
GlContextInfoResult::CurrentDevice(try_ir!(util::bytes_into::<DeviceId>(result)))
} },
GlContextInfo::Devices => { unsafe {
GlContextInfoResult::Devices(try_ir!(util::bytes_into_vec::<DeviceId>(result)))
} },
}
},
Err(err) => GlContextInfoResult::Error(Box::new(err)),
}
}
/// Returns the device contained within.
pub fn device(self) -> OclResult<DeviceId> {
match self {
GlContextInfoResult::CurrentDevice(d) => Ok(d),
GlContextInfoResult::Error(err) => Err(*err),
_ => Err("GlContextInfoResult::device: Not a 'GlContextInfoResult::Device(...)'.".into()),
}
}
}
impl std::fmt::Debug for GlContextInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for GlContextInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
GlContextInfoResult::CurrentDevice(ref d) => write!(f, "{:?}", d),
GlContextInfoResult::Devices(ref vec) => write!(f, "{:?}", vec),
GlContextInfoResult::Error(ref err) => write!(f, "{}", err),
}
}
}
impl From<GlContextInfoResult> for String {
fn from(ir: GlContextInfoResult) -> String {
ir.to_string()
}
}
impl From<OclError> for GlContextInfoResult {
fn from(err: OclError) -> GlContextInfoResult {
GlContextInfoResult::Error(Box::new(err))
}
}
impl From<GlContextInfoResult> for OclError {
fn from(err: GlContextInfoResult) -> OclError {
match err {
GlContextInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<GlContextInfoResult>: Not an error."),
}
}
}
impl std::error::Error for GlContextInfoResult {
fn description(&self) -> &str {
match *self {
GlContextInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A command queue info result.
pub enum CommandQueueInfoResult {
// TemporaryPlaceholderVariant(Vec<u8>),
Context(Context),
Device(DeviceId),
ReferenceCount(u32),
Properties(CommandQueueProperties),
Error(Box<OclError>),
}
impl CommandQueueInfoResult {
pub fn from_bytes(request: CommandQueueInfo, result: OclResult<Vec<u8>>)
-> CommandQueueInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return CommandQueueInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::CommandQueue)));
}
match request {
CommandQueueInfo::Context => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
CommandQueueInfoResult::Context(unsafe { Context::from_raw_copied_ptr(ptr) })
},
CommandQueueInfo::Device => {
let device = unsafe { try_ir!(util::bytes_into::<DeviceId>(result)) };
CommandQueueInfoResult::Device(device)
},
CommandQueueInfo::ReferenceCount => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
CommandQueueInfoResult::ReferenceCount(r)
}
CommandQueueInfo::Properties => {
let r = unsafe { try_ir!(util::bytes_into::<CommandQueueProperties>(result)) };
CommandQueueInfoResult::Properties(r)
}
// _ => CommandQueueInfoResult::TemporaryPlaceholderVariant(result),
}
},
Err(err) => CommandQueueInfoResult::Error(Box::new(err)),
}
}
}
impl std::fmt::Debug for CommandQueueInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for CommandQueueInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
// CommandQueueInfoResult::TemporaryPlaceholderVariant(ref v) => {
// write!(f, "{}", to_string_retarded(v))
// },
CommandQueueInfoResult::Context(ref s) => write!(f, "{:?}", s),
CommandQueueInfoResult::Device(ref s) => write!(f, "{:?}", s),
CommandQueueInfoResult::ReferenceCount(ref s) => write!(f, "{}", s),
CommandQueueInfoResult::Properties(ref s) => write!(f, "{:?}", s),
CommandQueueInfoResult::Error(ref err) => write!(f, "{}", err),
// _ => panic!("CommandQueueInfoResult: Converting this variant to string not yet implemented."),
}
}
}
// impl Into<String> for CommandQueueInfoResult {
// fn into(self) -> String {
// self.to_string()
// }
// }
impl From<OclError> for CommandQueueInfoResult {
fn from(err: OclError) -> CommandQueueInfoResult {
CommandQueueInfoResult::Error(Box::new(err))
}
}
impl From<CommandQueueInfoResult> for String {
fn from(ir: CommandQueueInfoResult) -> String {
ir.to_string()
}
}
impl From<CommandQueueInfoResult> for OclError {
fn from(err: CommandQueueInfoResult) -> OclError {
match err {
CommandQueueInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<CommandQueueInfoResult>: Not an error."),
}
}
}
impl std::error::Error for CommandQueueInfoResult {
fn description(&self) -> &str {
match *self {
CommandQueueInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A mem info result.
///
/// [UNSTABLE][INCOMPLETE]
///
/// [TODO]: Do something with `HostPtr`. It should not be be a raw pointer.
//
// ### From Docs:
//
// If memobj is created with clCreateBuffer or clCreateImage and
// CL_MEM_USE_HOST_PTR is specified in mem_flags, return the host_ptr argument
// value specified when memobj is created. Otherwise a NULL value is returned.
//
// If memobj is created with clCreateSubBuffer, return the host_ptr + origin
// value specified when memobj is created. host_ptr is the argument value
// specified to clCreateBuffer and CL_MEM_USE_HOST_PTR is specified in
// mem_flags for memory object from which memobj is created. Otherwise a NULL
// value is returned.
//
pub enum MemInfoResult {
Type(MemObjectType),
Flags(MemFlags),
Size(usize),
// Incomplete:
HostPtr(Option<(*mut c_void, Option<usize>)>),
MapCount(u32),
ReferenceCount(u32),
Context(Context),
AssociatedMemobject(Option<Mem>),
Offset(usize),
Error(Box<OclError>),
}
impl MemInfoResult {
pub fn from_bytes(request: MemInfo, result: OclResult<Vec<u8>>)
-> MemInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return MemInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Mem)));
}
match request {
MemInfo::Type => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
match MemObjectType::from_u32(r) {
Some(am) => MemInfoResult::Type(am),
None => MemInfoResult::Error(Box::new(
OclError::from(format!("Error converting '{}' to \
MemObjectType.", r)))),
}
},
MemInfo::Flags => {
let r = unsafe { try_ir!(util::bytes_into::<MemFlags>(result)) };
MemInfoResult::Flags(r)
},
MemInfo::Size => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
MemInfoResult::Size(r)
},
MemInfo::HostPtr => {
// [FIXME]: UNTESTED, INCOMPLETE.
if result.len() == 8 {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
if ptr.is_null() {
MemInfoResult::HostPtr(None)
} else {
MemInfoResult::HostPtr(Some((ptr, None)))
}
} else if result.len() == 16 {
let ptr_and_origin = unsafe {
try_ir!(util::bytes_into::<(*mut c_void, usize)>(result)
)};
if ptr_and_origin.0.is_null() {
MemInfoResult::HostPtr(None)
} else {
MemInfoResult::HostPtr(Some((ptr_and_origin.0,
Some(ptr_and_origin.1))))
}
} else {
MemInfoResult::HostPtr(None)
}
},
MemInfo::MapCount => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
MemInfoResult::MapCount(r)
},
MemInfo::ReferenceCount => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
MemInfoResult::ReferenceCount(r)
},
MemInfo::Context => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
MemInfoResult::Context(unsafe { Context::from_raw_copied_ptr(ptr) })
},
MemInfo::AssociatedMemobject => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
if ptr.is_null() {
MemInfoResult::AssociatedMemobject(None)
} else {
MemInfoResult::AssociatedMemobject(Some(unsafe { Mem::from_raw_copied_ptr(ptr) }))
}
},
MemInfo::Offset => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
MemInfoResult::Offset(r)
},
// _ => MemInfoResult::TemporaryPlaceholderVariant(result),
}
},
Err(err) => MemInfoResult::Error(Box::new(err)),
}
}
}
impl std::fmt::Debug for MemInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for MemInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
// MemInfoResult::TemporaryPlaceholderVariant(ref v) => {
// write!(f, "{}", to_string_retarded(v))
// },
MemInfoResult::Type(ref s) => write!(f, "{:?}", s),
MemInfoResult::Flags(ref s) => write!(f, "{:?}", s),
MemInfoResult::Size(ref s) => write!(f, "{}", s),
MemInfoResult::HostPtr(ref s) => write!(f, "{:?}", s),
MemInfoResult::MapCount(ref s) => write!(f, "{}", s),
MemInfoResult::ReferenceCount(ref s) => write!(f, "{}", s),
MemInfoResult::Context(ref s) => write!(f, "{:?}", s),
MemInfoResult::AssociatedMemobject(ref s) => write!(f, "{:?}", s),
MemInfoResult::Offset(ref s) => write!(f, "{}", s),
MemInfoResult::Error(ref err) => write!(f, "{}", err),
// _ => panic!("MemInfoResult: Converting this variant to string not yet implemented."),
}
}
}
// impl Into<String> for MemInfoResult {
// fn into(self) -> String {
// self.to_string()
// }
// }
impl From<OclError> for MemInfoResult {
fn from(err: OclError) -> MemInfoResult {
MemInfoResult::Error(Box::new(err))
}
}
impl From<MemInfoResult> for String {
fn from(ir: MemInfoResult) -> String {
ir.to_string()
}
}
impl From<MemInfoResult> for OclError {
fn from(err: MemInfoResult) -> OclError {
match err {
MemInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<MemInfoResult>: Not an error."),
}
}
}
impl std::error::Error for MemInfoResult {
fn description(&self) -> &str {
match *self {
MemInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// An image info result.
pub enum ImageInfoResult {
// TemporaryPlaceholderVariant(Vec<u8>),
Format(ImageFormatParseResult),
ElementSize(usize),
RowPitch(usize),
SlicePitch(usize),
Width(usize),
Height(usize),
Depth(usize),
ArraySize(usize),
Buffer(Option<Mem>),
NumMipLevels(u32),
NumSamples(u32),
Error(Box<OclError>),
}
impl ImageInfoResult {
pub fn from_bytes(request: ImageInfo, result: OclResult<Vec<u8>>) -> ImageInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return ImageInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Image)));
}
match request {
ImageInfo::Format => {
let r = unsafe { try_ir!(util::bytes_into::<cl_image_format>(result)) };
// match ImageFormat::from_raw(r) {
// Ok(f) => ImageInfoResult::Format(f),
// Err(err) => ImageInfoResult::Error(Box::new(err)),
// }
ImageInfoResult::Format(ImageFormat::from_raw(r))
},
ImageInfo::ElementSize => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
ImageInfoResult::ElementSize(r)
},
ImageInfo::RowPitch => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
ImageInfoResult::RowPitch(r)
},
ImageInfo::SlicePitch => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
ImageInfoResult::SlicePitch(r)
},
ImageInfo::Width => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
ImageInfoResult::Width(r)
},
ImageInfo::Height => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
ImageInfoResult::Height(r)
},
ImageInfo::Depth => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
ImageInfoResult::Depth(r)
},
ImageInfo::ArraySize => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
ImageInfoResult::ArraySize(r)
},
ImageInfo::Buffer => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
if ptr.is_null() {
ImageInfoResult::Buffer(None)
} else {
ImageInfoResult::Buffer(Some(unsafe { Mem::from_raw_copied_ptr(ptr) }))
}
},
ImageInfo::NumMipLevels => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
ImageInfoResult::NumMipLevels(r)
},
ImageInfo::NumSamples => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
ImageInfoResult::NumSamples(r)
},
// _ => ImageInfoResult::TemporaryPlaceholderVariant(result),
}
}
Err(err) => ImageInfoResult::Error(Box::new(err)),
}
}
}
impl std::fmt::Debug for ImageInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for ImageInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
// ImageInfoResult::TemporaryPlaceholderVariant(ref v) => {
// write!(f, "{}", to_string_retarded(v))
// },
ImageInfoResult::Format(ref s) => write!(f, "{:?}", s),
ImageInfoResult::ElementSize(s) => write!(f, "{}", s),
ImageInfoResult::RowPitch(s) => write!(f, "{}", s),
ImageInfoResult::SlicePitch(s) => write!(f, "{}", s),
ImageInfoResult::Width(s) => write!(f, "{}", s),
ImageInfoResult::Height(s) => write!(f, "{}", s),
ImageInfoResult::Depth(s) => write!(f, "{}", s),
ImageInfoResult::ArraySize(s) => write!(f, "{}", s),
ImageInfoResult::Buffer(ref s) => write!(f, "{:?}", s),
ImageInfoResult::NumMipLevels(s) => write!(f, "{}", s),
ImageInfoResult::NumSamples(s) => write!(f, "{}", s),
ImageInfoResult::Error(ref err) => write!(f, "{}", err),
// _ => panic!("ImageInfoResult: Converting this variant to string not yet implemented."),
}
}
}
// impl Into<String> for ImageInfoResult {
// fn into(self) -> String {
// self.to_string()
// }
// }
impl From<OclError> for ImageInfoResult {
fn from(err: OclError) -> ImageInfoResult {
ImageInfoResult::Error(Box::new(err))
}
}
impl From<ImageInfoResult> for String {
fn from(ir: ImageInfoResult) -> String {
ir.to_string()
}
}
impl From<ImageInfoResult> for OclError {
fn from(err: ImageInfoResult) -> OclError {
match err {
ImageInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<ImageInfoResult>: Not an error."),
}
}
}
impl std::error::Error for ImageInfoResult {
fn description(&self) -> &str {
match *self {
ImageInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A sampler info result.
pub enum SamplerInfoResult {
// TemporaryPlaceholderVariant(Vec<u8>),
ReferenceCount(u32),
Context(Context),
NormalizedCoords(bool),
AddressingMode(AddressingMode),
FilterMode(FilterMode),
Error(Box<OclError>),
}
impl SamplerInfoResult {
pub fn from_bytes(request: SamplerInfo, result: OclResult<Vec<u8>>)
-> SamplerInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return SamplerInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Sampler)));
}
match request {
SamplerInfo::ReferenceCount => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
SamplerInfoResult::ReferenceCount(r)
},
SamplerInfo::Context => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
SamplerInfoResult::Context(unsafe { Context::from_raw_copied_ptr(ptr) })
},
SamplerInfo::NormalizedCoords => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
SamplerInfoResult::NormalizedCoords(r!= 0u32)
},
SamplerInfo::AddressingMode => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
match AddressingMode::from_u32(r) {
Some(am) => SamplerInfoResult::AddressingMode(am),
None => SamplerInfoResult::Error(Box::new(
OclError::from(format!("Error converting '{}' to \
AddressingMode.", r)))),
}
},
SamplerInfo::FilterMode => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
match FilterMode::from_u32(r) {
Some(fm) => SamplerInfoResult::FilterMode(fm),
None => SamplerInfoResult::Error(Box::new(
OclError::from(format!("Error converting '{}' to \
FilterMode.", r)))),
}
},
// _ => SamplerInfoResult::TemporaryPlaceholderVariant(result),
}
}
Err(err) => SamplerInfoResult::Error(Box::new(err)),
}
}
}
impl std::fmt::Debug for SamplerInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for SamplerInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
// SamplerInfoResult::TemporaryPlaceholderVariant(ref v) => {
// write!(f, "{}", to_string_retarded(v))
// },
SamplerInfoResult::ReferenceCount(ref s) => write!(f, "{}", s),
SamplerInfoResult::Context(ref s) => write!(f, "{:?}", s),
SamplerInfoResult::NormalizedCoords(ref s) => write!(f, "{}", s),
SamplerInfoResult::AddressingMode(ref s) => write!(f, "{:?}", s),
SamplerInfoResult::FilterMode(ref s) => write!(f, "{:?}", s),
SamplerInfoResult::Error(ref err) => write!(f, "{}", err),
// _ => panic!("SamplerInfoResult: Converting this variant to string not yet implemented."),
}
}
}
// impl Into<String> for SamplerInfoResult {
// fn into(self) -> String {
// self.to_string()
// }
// }
impl From<OclError> for SamplerInfoResult {
fn from(err: OclError) -> SamplerInfoResult {
SamplerInfoResult::Error(Box::new(err))
}
}
impl From<SamplerInfoResult> for String {
fn from(ir: SamplerInfoResult) -> String {
ir.to_string()
}
}
impl From<SamplerInfoResult> for OclError {
fn from(err: SamplerInfoResult) -> OclError {
match err {
SamplerInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<SamplerInfoResult>: Not an error."),
}
}
}
impl std::error::Error for SamplerInfoResult {
fn description(&self) -> &str {
match *self {
SamplerInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A program info result.
pub enum ProgramInfoResult {
// TemporaryPlaceholderVariant(Vec<u8>),
ReferenceCount(u32),
Context(Context),
NumDevices(u32),
Devices(Vec<DeviceId>),
Source(String),
BinarySizes(Vec<usize>),
Binaries(Vec<Vec<u8>>),
NumKernels(usize),
KernelNames(String),
Error(Box<OclError>),
}
impl ProgramInfoResult {
pub fn from_bytes(request: ProgramInfo, result: OclResult<Vec<u8>>)
-> ProgramInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return ProgramInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Program)));
}
match request {
ProgramInfo::ReferenceCount => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
ProgramInfoResult::ReferenceCount(r)
},
ProgramInfo::Context => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
ProgramInfoResult::Context(unsafe { Context::from_raw_copied_ptr(ptr) })
},
ProgramInfo::NumDevices => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
ProgramInfoResult::NumDevices(r)
},
ProgramInfo::Devices => {
ProgramInfoResult::Devices(
unsafe { try_ir!(util::bytes_into_vec::<DeviceId>(result)) }
)
},
ProgramInfo::Source => {
match util::bytes_into_string(result) {
Ok(s) => ProgramInfoResult::Source(s),
Err(err) => ProgramInfoResult::Error(Box::new(err)),
}
},
ProgramInfo::BinarySizes => { ProgramInfoResult::BinarySizes(
unsafe { try_ir!(util::bytes_into_vec::<usize>(result)) }
) },
ProgramInfo::Binaries => {
// [FIXME]: UNIMPLEMENTED
ProgramInfoResult::Binaries(Vec::with_capacity(0))
},
ProgramInfo::NumKernels => {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
ProgramInfoResult::NumKernels(r)
},
ProgramInfo::KernelNames => {
match util::bytes_into_string(result) {
Ok(s) => ProgramInfoResult::KernelNames(s),
Err(err) => ProgramInfoResult::Error(Box::new(err)),
}
},
// _ => ProgramInfoResult::TemporaryPlaceholderVariant(result),
}
}
Err(err) => ProgramInfoResult::Error(Box::new(err)),
}
}
}
impl std::fmt::Debug for ProgramInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for ProgramInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
// ProgramInfoResult::TemporaryPlaceholderVariant(ref v) => {
// write!(f, "{}", to_string_retarded(v))
// },
ProgramInfoResult::ReferenceCount(ref s) => write!(f, "{}", s),
ProgramInfoResult::Context(ref s) => write!(f, "{:?}", s),
ProgramInfoResult::NumDevices(ref s) => write!(f, "{}", s),
ProgramInfoResult::Devices(ref s) => write!(f, "{:?}", s),
ProgramInfoResult::Source(ref s) => write!(f, "{}", s),
ProgramInfoResult::BinarySizes(ref s) => write!(f, "{:?}", s),
ProgramInfoResult::Binaries(_) => write!(f, "[Unprintable]"),
ProgramInfoResult::NumKernels(ref s) => write!(f, "{}", s),
ProgramInfoResult::KernelNames(ref s) => write!(f, "{}", s),
ProgramInfoResult::Error(ref err) => write!(f, "{}", err),
// _ => panic!("ProgramInfoResult: Converting this variant to string not yet implemented."),
}
}
}
// impl Into<String> for ProgramInfoResult {
// fn into(self) -> String {
// self.to_string()
// }
// }
impl From<OclError> for ProgramInfoResult {
fn from(err: OclError) -> ProgramInfoResult {
ProgramInfoResult::Error(Box::new(err))
}
}
impl From<ProgramInfoResult> for String {
fn from(ir: ProgramInfoResult) -> String {
ir.to_string()
}
}
impl From<ProgramInfoResult> for OclError {
fn from(err: ProgramInfoResult) -> OclError {
match err {
ProgramInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<ProgramInfoResult>: Not an error."),
}
}
}
impl std::error::Error for ProgramInfoResult {
fn description(&self) -> &str {
match *self {
ProgramInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A program build info result.
pub enum ProgramBuildInfoResult {
BuildStatus(ProgramBuildStatus),
BuildOptions(String),
BuildLog(String),
BinaryType(ProgramBinaryType),
Error(Box<OclError>),
}
impl ProgramBuildInfoResult {
pub fn from_bytes(request: ProgramBuildInfo, result: OclResult<Vec<u8>>)
-> ProgramBuildInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return ProgramBuildInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::ProgramBuild)));
}
match request {
ProgramBuildInfo::BuildStatus => {
let r = unsafe { try_ir!(util::bytes_into::<i32>(result)) };
match ProgramBuildStatus::from_i32(r) {
Some(b) => ProgramBuildInfoResult::BuildStatus(b),
None => ProgramBuildInfoResult::Error(Box::new(
OclError::from(format!("Error converting '{}' to \
ProgramBuildStatus.", r)))),
}
},
ProgramBuildInfo::BuildOptions => {
match util::bytes_into_string(result) {
Ok(s) => ProgramBuildInfoResult::BuildOptions(s),
Err(err) => ProgramBuildInfoResult::Error(Box::new(err)),
}
},
ProgramBuildInfo::BuildLog => {
match util::bytes_into_string(result) {
Ok(s) => ProgramBuildInfoResult::BuildLog(s),
Err(err) => ProgramBuildInfoResult::Error(Box::new(err)),
}
},
ProgramBuildInfo::BinaryType => {
let r = unsafe { try_ir!(util::bytes_into::<ProgramBinaryType>(result)) };
ProgramBuildInfoResult::BinaryType(r)
},
}
},
Err(err) => ProgramBuildInfoResult::Error(Box::new(err)),
}
}
}
impl std::fmt::Debug for ProgramBuildInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for ProgramBuildInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
ProgramBuildInfoResult::BuildStatus(ref s) => write!(f, "{:?}", s),
ProgramBuildInfoResult::BuildOptions(ref s) => write!(f, "{}", s),
ProgramBuildInfoResult::BuildLog(ref s) => write!(f, "{}", s),
ProgramBuildInfoResult::BinaryType(ref s) => write!(f, "{:?}", s),
ProgramBuildInfoResult::Error(ref err) => write!(f, "{}", err),
}
}
}
// impl Into<String> for ProgramBuildInfoResult {
// fn into(self) -> String {
// self.to_string()
// }
// }
impl From<OclError> for ProgramBuildInfoResult {
fn from(err: OclError) -> ProgramBuildInfoResult {
ProgramBuildInfoResult::Error(Box::new(err))
}
}
impl From<ProgramBuildInfoResult> for String {
fn from(ir: ProgramBuildInfoResult) -> String {
ir.to_string()
}
}
impl From<ProgramBuildInfoResult> for OclError {
fn from(err: ProgramBuildInfoResult) -> OclError {
match err {
ProgramBuildInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<ProgramBuildInfoResult>: Not an error."),
}
}
}
impl std::error::Error for ProgramBuildInfoResult {
fn description(&self) -> &str {
match *self {
ProgramBuildInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A kernel info result.
pub enum KernelInfoResult {
FunctionName(String),
NumArgs(u32),
ReferenceCount(u32),
Context(Context),
Program(Program),
Attributes(String),
Error(Box<OclError>),
}
impl KernelInfoResult {
pub fn from_bytes(request: KernelInfo, result: OclResult<Vec<u8>>)
-> KernelInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return KernelInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Kernel)));
}
match request {
KernelInfo::FunctionName => {
match util::bytes_into_string(result) {
Ok(s) => KernelInfoResult::FunctionName(s),
Err(err) => KernelInfoResult::Error(Box::new(err)),
}
},
KernelInfo::NumArgs => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
KernelInfoResult::NumArgs(r)
},
KernelInfo::ReferenceCount => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
KernelInfoResult::ReferenceCount(r)
},
KernelInfo::Context => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
KernelInfoResult::Context(unsafe { Context::from_raw_copied_ptr(ptr) })
},
KernelInfo::Program => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
KernelInfoResult::Program(unsafe { Program::from_raw_copied_ptr(ptr) })
},
KernelInfo::Attributes => {
match util::bytes_into_string(result) {
Ok(s) => KernelInfoResult::Attributes(s),
Err(err) => KernelInfoResult::Error(Box::new(err)),
}
},
}
},
Err(err) => KernelInfoResult::Error(Box::new(err)),
}
}
}
impl std::fmt::Debug for KernelInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for KernelInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
KernelInfoResult::FunctionName(ref s) => write!(f, "{}", s),
KernelInfoResult::NumArgs(s) => write!(f, "{}", s),
KernelInfoResult::ReferenceCount(s) => write!(f, "{}", s),
KernelInfoResult::Context(ref s) => write!(f, "{:?}", s),
KernelInfoResult::Program(ref s) => write!(f, "{:?}", s),
KernelInfoResult::Attributes(ref s) => write!(f, "{}", s),
KernelInfoResult::Error(ref err) => write!(f, "{}", err),
}
}
}
// impl Into<String> for KernelInfoResult {
// fn into(self) -> String {
// self.to_string()
// }
// }
impl From<OclError> for KernelInfoResult {
fn from(err: OclError) -> KernelInfoResult {
KernelInfoResult::Error(Box::new(err))
}
}
impl From<KernelInfoResult> for String {
fn from(ir: KernelInfoResult) -> String {
ir.to_string()
}
}
impl From<KernelInfoResult> for OclError {
fn from(err: KernelInfoResult) -> OclError {
match err {
KernelInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<KernelInfoResult>: Not an error."),
}
}
}
impl std::error::Error for KernelInfoResult {
fn description(&self) -> &str {
match *self {
KernelInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A kernel arg info result.
pub enum KernelArgInfoResult {
AddressQualifier(KernelArgAddressQualifier),
AccessQualifier(KernelArgAccessQualifier),
TypeName(String),
TypeQualifier(KernelArgTypeQualifier),
Name(String),
Error(Box<OclError>),
}
impl KernelArgInfoResult {
pub fn from_bytes(request: KernelArgInfo, result: OclResult<Vec<u8>>)
-> KernelArgInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return KernelArgInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::KernelArg)));
}
match request {
KernelArgInfo::AddressQualifier => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
match KernelArgAddressQualifier::from_u32(r) {
Some(kaaq) => KernelArgInfoResult::AddressQualifier(kaaq),
None => KernelArgInfoResult::Error(Box::new(
OclError::from(format!("Error converting '{}' to \
KernelArgAddressQualifier.", r)))),
}
},
KernelArgInfo::AccessQualifier => {
let r = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
match KernelArgAccessQualifier::from_u32(r) {
Some(kaaq) => KernelArgInfoResult::AccessQualifier(kaaq),
None => KernelArgInfoResult::Error(Box::new(
OclError::from(format!("Error converting '{}' to \
KernelArgAccessQualifier.", r)))),
}
},
KernelArgInfo::TypeName => {
match util::bytes_into_string(result) {
Ok(s) => KernelArgInfoResult::TypeName(s),
Err(err) => KernelArgInfoResult::Error(Box::new(err)),
}
},
KernelArgInfo::TypeQualifier => {
let r = unsafe { try_ir!(util::bytes_into::<KernelArgTypeQualifier>(result)) };
KernelArgInfoResult::TypeQualifier(r)
},
KernelArgInfo::Name => {
match util::bytes_into_string(result) {
Ok(s) => KernelArgInfoResult::Name(s),
Err(err) => KernelArgInfoResult::Error(Box::new(err)),
}
},
}
},
Err(err) => KernelArgInfoResult::Error(Box::new(err)),
}
}
}
impl std::fmt::Debug for KernelArgInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for KernelArgInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
KernelArgInfoResult::AddressQualifier(s) => write!(f, "{:?}", s),
KernelArgInfoResult::AccessQualifier(s) => write!(f, "{:?}", s),
KernelArgInfoResult::TypeName(ref s) => write!(f, "{}", s),
KernelArgInfoResult::TypeQualifier(s) => write!(f, "{:?}", s),
KernelArgInfoResult::Name(ref s) => write!(f, "{}", s),
KernelArgInfoResult::Error(ref err) => write!(f, "{}", err),
}
}
}
impl From<OclError> for KernelArgInfoResult {
fn from(err: OclError) -> KernelArgInfoResult {
KernelArgInfoResult::Error(Box::new(err))
}
}
impl From<KernelArgInfoResult> for String {
fn from(ir: KernelArgInfoResult) -> String {
ir.to_string()
}
}
impl From<KernelArgInfoResult> for OclError {
fn from(err: KernelArgInfoResult) -> OclError {
match err {
KernelArgInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<KernelArgInfoResult>: Not an error."),
}
}
}
impl std::error::Error for KernelArgInfoResult {
fn description(&self) -> &str {
match *self {
KernelArgInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A kernel work group info result.
pub enum KernelWorkGroupInfoResult {
WorkGroupSize(usize),
CompileWorkGroupSize([usize; 3]),
LocalMemSize(u64),
PreferredWorkGroupSizeMultiple(usize),
PrivateMemSize(u64),
GlobalWorkSize([usize; 3]),
Empty(EmptyInfoResult),
Unavailable(Status),
CustomBuiltinOnly,
Error(Box<OclError>),
}
impl KernelWorkGroupInfoResult {
pub fn from_bytes(request: KernelWorkGroupInfo, result: OclResult<Vec<u8>>)
-> KernelWorkGroupInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return KernelWorkGroupInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::KernelWorkGroup)));
}
match request {
KernelWorkGroupInfo::WorkGroupSize => {
if result.is_empty() {
KernelWorkGroupInfoResult::WorkGroupSize(0)
} else {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
KernelWorkGroupInfoResult::WorkGroupSize(r)
}
},
KernelWorkGroupInfo::CompileWorkGroupSize => {
if result.is_empty() {
KernelWorkGroupInfoResult::CompileWorkGroupSize([0, 0, 0])
} else {
let r = unsafe { try_ir!(util::bytes_into::<[usize; 3]>(result)) };
KernelWorkGroupInfoResult::CompileWorkGroupSize(r)
}
}
KernelWorkGroupInfo::LocalMemSize => {
if result.is_empty() {
KernelWorkGroupInfoResult::LocalMemSize(0)
} else {
let r = unsafe { try_ir!(util::bytes_into::<u64>(result)) };
KernelWorkGroupInfoResult::LocalMemSize(r)
}
},
KernelWorkGroupInfo::PreferredWorkGroupSizeMultiple => {
if result.is_empty() {
KernelWorkGroupInfoResult::PreferredWorkGroupSizeMultiple(0)
} else {
let r = unsafe { try_ir!(util::bytes_into::<usize>(result)) };
KernelWorkGroupInfoResult::PreferredWorkGroupSizeMultiple(r)
}
},
KernelWorkGroupInfo::PrivateMemSize => {
if result.is_empty() {
KernelWorkGroupInfoResult::PrivateMemSize(0)
} else {
let r = unsafe { try_ir!(util::bytes_into::<u64>(result)) };
KernelWorkGroupInfoResult::PrivateMemSize(r)
}
},
KernelWorkGroupInfo::GlobalWorkSize => {
if result.is_empty() {
KernelWorkGroupInfoResult::GlobalWorkSize([0, 0, 0])
} else {
let r = unsafe { try_ir!(util::bytes_into::<[usize; 3]>(result)) };
KernelWorkGroupInfoResult::GlobalWorkSize(r)
}
},
}
},
Err(err) => KernelWorkGroupInfoResult::from(err),
}
}
}
impl std::fmt::Debug for KernelWorkGroupInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for KernelWorkGroupInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
KernelWorkGroupInfoResult::WorkGroupSize(s) => write!(f, "{}", s),
KernelWorkGroupInfoResult::CompileWorkGroupSize(s) => write!(f, "{:?}", s),
KernelWorkGroupInfoResult::LocalMemSize(s) => write!(f, "{}", s),
KernelWorkGroupInfoResult::PreferredWorkGroupSizeMultiple(s) => write!(f, "{}", s),
KernelWorkGroupInfoResult::PrivateMemSize(s) => write!(f, "{}", s),
KernelWorkGroupInfoResult::GlobalWorkSize(s) => write!(f, "{:?}", s),
KernelWorkGroupInfoResult::Empty(ref r) => write!(f, "{}", r),
KernelWorkGroupInfoResult::Unavailable(ref s) => write!(f, "unavailable ({})", s),
KernelWorkGroupInfoResult::CustomBuiltinOnly => write!(f,
"only available for custom devices or built-in kernels"),
KernelWorkGroupInfoResult::Error(ref err) => write!(f, "{}", err),
}
}
}
impl From<OclError> for KernelWorkGroupInfoResult {
fn from(err: OclError) -> KernelWorkGroupInfoResult {
KernelWorkGroupInfoResult::Error(Box::new(err))
}
}
impl From<KernelWorkGroupInfoResult> for String {
fn from(ir: KernelWorkGroupInfoResult) -> String {
ir.to_string()
}
}
impl From<KernelWorkGroupInfoResult> for OclError {
fn from(err: KernelWorkGroupInfoResult) -> OclError {
match err {
KernelWorkGroupInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<KernelWorkGroupInfoResult>: Not an error."),
}
}
}
impl std::error::Error for KernelWorkGroupInfoResult {
fn description(&self) -> &str {
match *self {
KernelWorkGroupInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// An event info result.
pub enum EventInfoResult {
CommandQueue(CommandQueue),
CommandType(CommandType),
ReferenceCount(u32),
CommandExecutionStatus(CommandExecutionStatus),
Context(Context),
Error(Box<OclError>),
}
impl EventInfoResult {
pub fn from_bytes(request: EventInfo, result: OclResult<Vec<u8>>)
-> EventInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return EventInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Event)));
}
match request {
EventInfo::CommandQueue => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
EventInfoResult::CommandQueue(unsafe { CommandQueue::from_raw_copied_ptr(ptr) })
},
EventInfo::CommandType => {
let code = unsafe { try_ir!(util::bytes_into::<u32>(result)) };
match CommandType::from_u32(code) {
Some(ces) => EventInfoResult::CommandType(ces),
None => EventInfoResult::Error(Box::new(
OclError::from(format!("Error converting '{}' to CommandType.", code)))),
}
},
EventInfo::ReferenceCount => { EventInfoResult::ReferenceCount(
unsafe { try_ir!(util::bytes_into::<u32>(result)) }
) },
EventInfo::CommandExecutionStatus => {
let code = unsafe { try_ir!(util::bytes_into::<i32>(result)) };
match CommandExecutionStatus::from_i32(code) {
Some(ces) => EventInfoResult::CommandExecutionStatus(ces),
None => EventInfoResult::Error(Box::new(
OclError::from(format!("Error converting '{}' to \
CommandExecutionStatus.", code)))),
}
},
EventInfo::Context => {
let ptr = unsafe { try_ir!(util::bytes_into::<*mut c_void>(result)) };
EventInfoResult::Context(unsafe { Context::from_raw_copied_ptr(ptr) })
},
}
},
Err(err) => EventInfoResult::Error(Box::new(err)),
}
}
}
impl std::fmt::Debug for EventInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", &self.to_string())
}
}
impl std::fmt::Display for EventInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
EventInfoResult::CommandQueue(ref s) => write!(f, "{:?}", s),
EventInfoResult::CommandType(ref s) => write!(f, "{:?}", s),
EventInfoResult::ReferenceCount(ref s) => write!(f, "{}", s),
EventInfoResult::CommandExecutionStatus(ref s) => write!(f, "{:?}", s),
EventInfoResult::Context(ref s) => write!(f, "{:?}", s),
EventInfoResult::Error(ref err) => write!(f, "{}", err),
}
}
}
impl From<OclError> for EventInfoResult {
fn from(err: OclError) -> EventInfoResult {
EventInfoResult::Error(Box::new(err))
}
}
impl From<EventInfoResult> for String {
fn from(ir: EventInfoResult) -> String {
ir.to_string()
}
}
impl From<EventInfoResult> for OclError {
fn from(err: EventInfoResult) -> OclError {
match err {
EventInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<EventInfoResult>: Not an error."),
}
}
}
impl std::error::Error for EventInfoResult {
fn description(&self) -> &str {
match *self {
EventInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
/// A profiling info result.
pub enum ProfilingInfoResult {
Queued(u64),
Submit(u64),
Start(u64),
End(u64),
Error(Box<OclError>),
}
impl ProfilingInfoResult {
pub fn from_bytes(request: ProfilingInfo, result: OclResult<Vec<u8>>)
-> ProfilingInfoResult
{
match result {
Ok(result) => {
if result.is_empty() {
return ProfilingInfoResult::Error(Box::new(OclError::from(
EmptyInfoResult::Profiling)));
}
match request {
ProfilingInfo::Queued => ProfilingInfoResult::Queued(
unsafe { try_ir!(util::bytes_into::<u64>(result)) }),
ProfilingInfo::Submit => ProfilingInfoResult::Submit(
unsafe { try_ir!(util::bytes_into::<u64>(result)) }),
ProfilingInfo::Start => ProfilingInfoResult::Start(
unsafe { try_ir!(util::bytes_into::<u64>(result)) }),
ProfilingInfo::End => ProfilingInfoResult::End(
unsafe { try_ir!(util::bytes_into::<u64>(result)) }),
}
},
Err(err) => ProfilingInfoResult::Error(Box::new(err)),
}
}
pub fn time(self) -> OclResult<u64> {
match self {
ProfilingInfoResult::Queued(time_ns) => Ok(time_ns),
ProfilingInfoResult::Submit(time_ns) => Ok(time_ns),
ProfilingInfoResult::Start(time_ns) => Ok(time_ns),
ProfilingInfoResult::End(time_ns) => Ok(time_ns),
ProfilingInfoResult::Error(err) => Err(*err),
}
}
}
impl std::fmt::Debug for ProfilingInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self)
}
}
impl std::fmt::Display for ProfilingInfoResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
ProfilingInfoResult::Queued(ref s) => write!(f, "{}", s),
ProfilingInfoResult::Submit(ref s) => write!(f, "{}", s),
ProfilingInfoResult::Start(ref s) => write!(f, "{}", s),
ProfilingInfoResult::End(ref s) => write!(f, "{}", s),
ProfilingInfoResult::Error(ref err) => write!(f, "{}", err),
}
}
}
impl From<OclError> for ProfilingInfoResult {
fn from(err: OclError) -> ProfilingInfoResult {
ProfilingInfoResult::Error(Box::new(err))
}
}
impl From<ProfilingInfoResult> for String {
fn from(ir: ProfilingInfoResult) -> String {
ir.to_string()
}
}
impl From<ProfilingInfoResult> for OclError {
fn from(err: ProfilingInfoResult) -> OclError {
match err {
ProfilingInfoResult::Error(err) => *err,
_ => panic!("OclError::from::<ProfilingInfoResult>: Not an error."),
}
}
}
impl std::error::Error for ProfilingInfoResult {
fn description(&self) -> &str {
match *self {
ProfilingInfoResult::Error(ref err) => err.description(),
_ => "",
}
}
}
|
# html_table_webpage
A basic webpage made out of html
Download and save all 3 folders inside a one single folder.
Run the 'unit test 3 table web page' inside 'unit test 3 table web page' folder.
|
package net.corda.node.internal.security
import java.util.*
class Password(valueRaw: CharArray) : AutoCloseable {
constructor(value: String) : this(value.toCharArray())
private val internalValue = valueRaw.copyOf()
val value: CharArray
get() = internalValue.copyOf()
val valueAsString: String
get() = internalValue.joinToString("")
override fun close() {
internalValue.indices.forEach { index ->
internalValue[index] = MASK
}
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as Password
if (!Arrays.equals(internalValue, other.internalValue)) return false
return true
}
override fun hashCode(): Int {
return Arrays.hashCode(internalValue)
}
override fun toString(): String = (0..5).map { MASK }.joinToString("")
private companion object {
private const val MASK = '*'
}
}
|
package clear
import (
"fmt"
"github.com/cheneylew/projects/gitStat/git"
"strings"
)
func main() {
clearBranches()
}
func clearBranches() {
dir := "/Users/apple/Desktop/ehsy/opc"
git.CheckoutLocalBranch(dir, "master")
nodes := git.NodesAll(dir)
git.CheckoutLocalBranch(dir, "master-eis")
nodes = append(nodes, git.NodesAll(dir)...)
git.CheckoutLocalBranch(dir, "master-raxwell-eis")
nodes = append(nodes, git.NodesAll(dir)...)
git.CheckoutLocalBranch(dir, "master-raxwell-opc")
nodes = append(nodes, git.NodesAll(dir)...)
heads := git.RemoteHeads(dir)
for i, c := range heads {
for _, node := range nodes {
for _, id := range node.MergeIds {
if strings.HasPrefix(c.Id, id) {
//已合并
git.DeleteRemoteBranch(dir, c.Branch)
fmt.Println("删除 ", c.Branch, " 成功!")
}
}
}
fmt.Println(fmt.Sprintf("已完成%v", float64(i+1)/float64(len(heads))))
}
git.FetchOriginStatus(dir)
}
|
package models
case class Product( Id: String,
Title: String,
Price: BigDecimal,
Cost: BigDecimal)
|
package mhfc.net.common.weapon.range.bow;
import mhfc.net.common.weapon.stats.WeaponStats;
public class BowWeaponStats extends WeaponStats {
public static class BowWeaponStatsBuilder extends WeaponStatsBuilder<BowWeaponStatsBuilder> {
public BowWeaponStatsBuilder() {}
@Override
protected BowWeaponStatsBuilder getThis() {
return this;
}
@Override
public BowWeaponStats build() {
return new BowWeaponStats(this);
}
}
protected BowWeaponStats(BowWeaponStatsBuilder builder) {
super(builder);
// TODO Auto-generated constructor stub
}
}
|
part of flutter_lwp;
/// HUB Transport interface
///
/// {@category backend}
abstract class IHubTransport {
/// transmit places the message on the wire immediately
Future<bool> transmit(Message msg);
/// returns the name of the hub
String get name;
/// returns the id of the hub
String get id;
/// Initiates the connection to the hub.
Future<bool> connect();
/// Disconnect from the hub.
Future<void> disconnect();
/// Broadcast stream of messages coming from the hub hardware.
Stream<Message> get stream;
/// call when done with
void dispose();
}
|
package SMART
import Chisel._
class CreditReg extends Module {
val io = new Bundle {
val inc = Bool(dir = INPUT)
val dec = Bool(dir = INPUT) // if dec == 1, inc
val creditOut = UInt(dir = OUTPUT, width = CREDIT_WIDTH)
}
val credit = Reg(init = UInt(INPUT_BUFFER_DEPTH))
assert(credit <= UInt(INPUT_BUFFER_DEPTH), "credit value must not be greater than INPUT_BUFFER_DEPTH")
when (io.dec) {
when (io.inc) {
io.creditOut := credit
} .otherwise {
assert(credit != UInt(0), "cannot decrement credit when value is 0")
credit := credit - UInt(1)
io.creditOut := credit - UInt(1)
}
} .otherwise {
when (io.inc) {
credit := credit + UInt(1)
io.creditOut := credit + UInt(1)
} .otherwise {
io.creditOut := credit
}
}
io.creditOut := credit
}
class CreditRegTests(c: CreditReg) extends Tester(c) {
peek(c.credit)
poke(c.io.inc, 1)
poke(c.io.dec, 1)
peek(c.io.creditOut)
step(1)
peek(c.credit)
poke(c.io.inc, 0)
poke(c.io.dec, 1)
peek(c.io.creditOut)
step(1)
peek(c.credit)
poke(c.io.inc, 0)
poke(c.io.dec, 1)
peek(c.io.creditOut)
step(1)
peek(c.credit)
poke(c.io.inc, 1)
poke(c.io.dec, 0)
peek(c.io.creditOut)
step(1)
}
|
"""The RoleUserManagerToFile class."""
from RoleUserManagerMixIn import RoleUserManagerMixIn
from UserManagerToFile import UserManagerToFile
class RoleUserManagerToFile(RoleUserManagerMixIn, UserManagerToFile):
"""See the base classes for more information."""
def __init__(self, userClass=None):
UserManagerToFile.__init__(self, userClass)
RoleUserManagerMixIn.__init__(self)
|
require 'pry'
require 'bundler/setup' # for require sidekiq & puma from rails_com
require 'mina/git'
require 'mina/rails'
require 'mina/rvm'
require 'mina/whenever'
require 'mina/sidekiq'
require 'mina/puma'
if ENV['on'].nil?
if ENV['to']
set :branch, ENV['to']
else
set :branch, 'staging'
end
require File.expand_path('deploy/staging.rb', __dir__)
else
require File.expand_path("deploy/#{ENV['on']}.rb", __dir__)
end
set :repository, 'git@github.com:dappore/store.git'
set :forward_agent, true
set :shared_dirs, fetch(:shared_dirs) + [
'tmp',
'storage',
'node_modules',
'public/packs'
]
set :shared_files, [
'config/database.yml',
'config/master.key',
'config/apiclient_cert.p12'
]
task :local_environment do
end
task :remote_environment do
invoke :'rvm:use', 'ruby-2.5.1@default'
end
task :setup do
command %{ mkdir -p #{fetch :shared_path}/log }
command %{ mkdir -p #{fetch :shared_path}/config }
command %{ mkdir -p #{fetch :shared_path}/tmp/sockets }
command %{ mkdir -p #{fetch :shared_path}/tmp/pids }
command %{ mkdir -p #{fetch :shared_path}/storage }
command %{ touch #{fetch :shared_path}/config/database.yml }
command %{ touch #{fetch :shared_path}/config/master.key }
command %{ touch #{fetch :shared_path}/tmp/sockets/puma.state }
comment %{ Be sure to edit #{fetch :shared_path}/config/database.yml and master.key }
end
desc 'Deploys the current version to the server.'
task deploy: :remote_environment do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:assets_precompile'
invoke :'rails:db_migrate'
invoke :'deploy:cleanup'
on :launch do
invoke :'puma:restart'
invoke :'sidekiq:restart'
#invoke :'whenever:update'
end
end
end
desc 'Deploy to multiple hosts'
task :multi_deploy do
['staging'].each do |env|
require File.expand_path("deploy/#{env}.rb", __dir__)
invoke 'deploy'
end
end
|
#!/bin/sh
set -e
brew install zstd gmp mpfr libmpc wget unzip make ninja coreutils gnu-getopt
mkdir gn_bin/
cd gn_bin
wget -q https://chrome-infra-packages.appspot.com/dl/gn/gn/mac-amd64/+/latest -O gn.zip
unzip gn.zip
cd ..
|
1ere etape : git clone https://github.com/maxencelgy/Grenouillere.git
2eme etape : aller dans dossier -> grenouillere -> terminal et marquer composer install
3 eme etape : crée un fichier .env et mettre à l'interieur https://sharemycode.fr/li5
4 eme etape : créer la branch dev -> git branch dev
5 eme etape : php spark serve
|
module EffectiveClassifiedsTestBuilder
def create_user!
build_user.tap { |user| user.save! }
end
def build_user
@user_index ||= 0
@user_index += 1
User.new(
email: "user#{@user_index}@example.com",
password: 'rubicon2020',
password_confirmation: 'rubicon2020',
first_name: 'Test',
last_name: 'User'
)
end
def build_classified(owner: nil)
owner ||= build_user()
Effective::Classified.new(
owner: owner,
title: 'A Classified Ad',
body: '<p>A cool job</p>',
category: EffectiveClassifieds.categories.first,
organization: 'Adams Restaurant',
location: 'California',
email: 'someone@example.com',
phone: '(444) 444-4444',
start_on: Time.zone.now,
end_on: (Time.zone.now + 7.days)
)
end
def build_classified_wizard(classified: nil)
classified ||= build_classified()
Effective::ClassifiedWizard.new(
classified: classified,
owner: classified.owner
)
end
end
|
#!/bin/sh -e
runuser -u plex /plex-entrypoint.sh
exec "$@"
|
package okreplay;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static okreplay.Util.VIA;
/**
* Represents a set of recorded HTTP interactions that can be played back or
* appended to.
*/
abstract class MemoryTape implements Tape {
private String name;
private List<YamlRecordedInteraction> interactions = new ArrayList<>();
private transient TapeMode mode = OkReplayConfig.DEFAULT_MODE;
private transient MatchRule matchRule = OkReplayConfig.DEFAULT_MATCH_RULE;
private transient InteractionsMode interactionsMode = new SingleInteractionsMode(interactions, matchRule);
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public TapeMode getMode() {
return mode;
}
@Override
public void setMode(TapeMode mode) {
this.mode = mode;
}
@Override
public MatchRule getMatchRule() {
return this.matchRule;
}
@Override
public void setMatchRule(MatchRule matchRule) {
this.matchRule = matchRule;
}
@Override
public boolean isReadable() {
return mode.isReadable();
}
@Override
public boolean isWritable() {
return mode.isWritable();
}
@Override
public boolean isSequential() {
return mode.isSequential();
}
@Override
public int size() {
return interactionsMode.size();
}
@Override
public void start() {
if (mode.isSequential()) {
interactionsMode = new SequentialInteractionsMode(interactions, matchRule);
} else if (mode.isQueued()) {
if (mode.isWritable()) {
interactionsMode = new QueueInteractionsWriteMode(interactions);
} else {
interactionsMode = new QueueInteractionsReadMode(interactions, matchRule);
}
} else {
interactionsMode = new SingleInteractionsMode(interactions, matchRule);
}
}
public List<YamlRecordedInteraction> getInteractions() {
return interactionsMode.getInteractions();
}
public void setInteractions(List<YamlRecordedInteraction> interactions) {
interactionsMode.setInteractions(interactions);
}
@Override
public boolean seek(Request request) {
return interactionsMode.seek(request);
}
@Override
public Response play(final Request request) {
if (!mode.isReadable()) {
throw new IllegalStateException("the tape is not readable");
}
return interactionsMode.play(request);
}
@Override
public synchronized void record(Request request, Response response) {
if (!mode.isWritable()) {
throw new IllegalStateException("the tape is not writable");
}
RecordedInteraction interaction = new RecordedInteraction(new Date(), recordRequest(request),
recordResponse(response));
interactionsMode.record(interaction);
}
@Override
public String toString() {
return String.format("Tape[%s]", name);
}
private Request recordRequest(Request request) {
return request.newBuilder()
.removeHeader(VIA)
.build();
}
private Response recordResponse(Response response) {
return response.newBuilder()
.removeHeader(VIA)
.removeHeader(Headers.X_OKREPLAY)
.build();
}
}
|
using System;
using System.Collections.Concurrent;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Spectacles.NET.Rest.Bucket;
using Spectacles.NET.Rest.View;
using Spectacles.NET.Types;
using Spectacles.NET.Util.Extensions;
using Spectacles.NET.Util.Logging;
namespace Spectacles.NET.Rest
{
/// <summary>
/// Client to interact with the Discord REST API.
/// </summary>
public class RestClient
{
/// <summary>
/// Unprefixed token
/// </summary>
private readonly string _token;
/// <summary>
/// Creates a new Instance of RestClient.
/// </summary>
/// <param name="token">The Token of the Bot.</param>
/// <param name="proxy">Optional, Uri of what to use as BaseAddress (useful for a Rest proxy)</param>
public RestClient(string token, Uri proxy = null)
{
_token = token.RemoveTokenPrefix();
SetDefaultHeadersWithBaseUri(proxy);
}
/// <summary>
/// Creates a new Instance of RestClient.
/// </summary>
/// <param name="token">The Token of the Bot.</param>
/// <param name="factory">Factory which creates IBucket to use</param>
public RestClient(string token, IBucketFactory factory) : this(token)
=> BucketFactory = factory;
/// <summary>
/// Creates a new Instance of RestClient.
/// </summary>
/// <param name="token">The Token of the Bot.</param>
/// <param name="proxy">Uri of what to use as BaseAddress (useful for a Rest proxy)</param>
/// <param name="factory">Factory which creates IBucket to use</param>
public RestClient(string token, Uri proxy, IBucketFactory factory) : this(token, proxy)
=> BucketFactory = factory;
/// <summary>
/// The Buckets of this RestClient mapped by Route.
/// </summary>
private ConcurrentDictionary<string, IBucket> Buckets { get; } = new ConcurrentDictionary<string, IBucket>();
/// <summary>
/// The HttpClient of this RestClient.
/// </summary>
public HttpClient HttpClient { get; } = new HttpClient();
/// <summary>
/// The Guilds View.
/// </summary>
public GuildsView Guilds
=> new GuildsView(this);
/// <summary>
/// The Channels View.
/// </summary>
public ChannelsView Channels
=> new ChannelsView(this);
/// <summary>
/// The Users View.
/// </summary>
public UsersView Users
=> new UsersView(this);
/// <summary>
/// The Invites View.
/// </summary>
public InvitesView Invites
=> new InvitesView(this);
/// <summary>
/// The Voice View.
/// </summary>
public VoiceView Voice
=> new VoiceView(this);
/// <summary>
/// The Webhook View.
/// </summary>
public WebhooksView Webhooks
=> new WebhooksView(this);
/// <summary>
/// The Application View.
/// </summary>
public ApplicationView Application
=> new ApplicationView(this);
/// <summary>
/// Task Resolving when the Client isn't Global Ratelimited anymore.
/// </summary>
public Task GlobalTimeout { get; set; }
/// <summary>
/// Factory which creates IBucket instances to use.
/// </summary>
private IBucketFactory BucketFactory { get; } = new InMemoryBucketFactory();
/// <summary>
/// The Token of this RestClient.
/// </summary>
private string Token
=> $"Bot {_token}";
/// <summary>
/// Event emitted when Logs are received.
/// </summary>
public event EventHandler<LogEventArgs> Log;
/// <summary>
/// Enqueues a Request and Creates a Bucket if needed.
/// </summary>
/// <param name="method">The HTTP Method to use.</param>
/// <param name="route">The Path to use.</param>
/// <param name="content">The HttpContent to use.</param>
/// <param name="auditLogReason">Optional AuditLog Reason.</param>
/// <returns></returns>
public Task<object> Request(string route, HttpMethod method, HttpContent content,
string auditLogReason = null)
{
var bucketRoute = MakeRoute(method, route);
if (Buckets.TryGetValue(bucketRoute, out var bucket))
return bucket.Enqueue(method, route, content, auditLogReason);
bucket = BucketFactory.CreateBucket(this, bucketRoute);
Buckets.TryAdd(bucketRoute, bucket);
return bucket.Enqueue(method, route, content, auditLogReason);
}
/// <summary>
/// Enqueues a Request and Creates a Bucket if needed.
/// </summary>
/// <param name="method">The HTTP Method to use.</param>
/// <param name="route">The Path to use.</param>
/// <param name="content">The HttpContent to use.</param>
/// <param name="auditLogReason">Optional AuditLog Reason.</param>
/// <returns></returns>
public Task<T> Request<T>(string route, HttpMethod method, HttpContent content, string auditLogReason = null)
{
var bucketRoute = MakeRoute(method, route);
if (Buckets.TryGetValue(bucketRoute, out var bucket))
return bucket.Enqueue<T>(method, route, content, auditLogReason);
bucket = BucketFactory.CreateBucket(this, bucketRoute);
Buckets.TryAdd(bucketRoute, bucket);
return bucket.Enqueue<T>(method, route, content, auditLogReason);
}
/// <summary>
/// Sets the Default Headers for the HttpClient
/// </summary>
private void SetDefaultHeaders()
{
HttpClient.DefaultRequestHeaders.Add("Authorization", Token);
HttpClient.DefaultRequestHeaders.Add("User-Agent", "DiscordBot (https://github.com/spec-tacles) v1");
CreateLog(LogLevel.DEBUG, "Set HttpClient Default Headers");
}
/// <summary>
/// Sets the Default Headers & BaseAddress for the HttpClient
/// </summary>
/// <param name="uri">The BaseAddress to set</param>
private void SetDefaultHeadersWithBaseUri(Uri uri = null)
{
SetDefaultHeaders();
HttpClient.BaseAddress = uri ?? new Uri(APIEndpoints.APIBaseURL);
CreateLog(LogLevel.DEBUG, "Set HttpClient Base Address");
}
/// <summary>
/// Creates a Route from an url.
/// </summary>
/// <param name="method">The HTTP request method to use.</param>
/// <param name="url">The url to use.</param>
/// <returns></returns>
private static string MakeRoute(HttpMethod method, string url)
{
var defaultRegEx = new Regex(@"\/([a-z-]+)\/(?:[0-9]{17,19})");
var reactionRegEx = new Regex(@"\/reactions\/[^/]+");
var webhookRegEx = new Regex(@"^\/webhooks\/(\d+)\/[A-Za-z0-9-_]{64,}");
var route = defaultRegEx.Replace(url, m =>
{
var val = m.Groups[1].Value;
return val == "channels" || val == "guilds" || val == "webhooks" ? m.Value : $"/{val}/:id";
});
route = reactionRegEx.Replace(route, "/reactions/:id");
route = webhookRegEx.Replace(route, "/webhooks/$1/:token");
if (method == HttpMethod.Delete && route.EndsWith("/messages/:id")) route = $"{method}{route}";
return route;
}
/// <summary>
/// Emits something on the Log event
/// </summary>
/// <param name="level">The LogLevel of this log</param>
/// <param name="message">The message of this log</param>
/// <param name="sender">Optional sender of this Message</param>
public void CreateLog(LogLevel level, string message, string sender = null)
=> Log?.Invoke(this, new LogEventArgs(level, sender ?? "RestClient", message));
}
}
|
---
city: Flora Vista
state: new mexico
stores:
- name: Farmer's Market
address: 816 Highway 516
---
|
// Copyright 2010 Jonas mg
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package user
import (
"bufio"
"bytes"
"errors"
"io"
"os"
"sync"
"github.com/tredoe/osutil/file"
)
// A row represents the structure of a row into a file.
type row interface {
// lookUp is the parser to looking for a value in the field of given line.
lookUp(line string, _field field, value interface{}) interface{}
// filename returns the file name belongs to the file structure.
filename() string
String() string
}
// A field represents a field into a row.
type field interface {
String() string
}
var errSearch = errors.New("no search")
// lookUp is a generic parser to looking for a value.
//
// The count determines the number of fields to return:
// n > 0: at most n fields
// n == 0: the result is nil (zero fields)
// n < 0: all fields
func lookUp(_row row, _field field, value interface{}, n int) (interface{}, error) {
if n == 0 {
return nil, errSearch
}
dbf, err := openDBFile(_row.filename(), os.O_RDONLY)
if err != nil {
return nil, err
}
defer dbf.close()
// Lines where a field is matched.
entries := make([]interface{}, 0, 0)
for {
line, _, err := dbf.rd.ReadLine()
if err == io.EOF {
break
}
entry := _row.lookUp(string(line), _field, value)
if entry != nil {
entries = append(entries, entry)
}
if n < 0 {
continue
} else if n == len(entries) {
break
}
}
if len(entries) != 0 {
return entries, nil
}
return nil, NoFoundError{_row.filename(), _field.String(), value}
}
// == Editing
//
// DO_BACKUP does a backup before of modify the original files.
var DO_BACKUP = true
// A dbfile represents the database file.
type dbfile struct {
sync.Mutex
file *os.File
rd *bufio.Reader
}
// openDBFile opens a file.
func openDBFile(filename string, flag int) (*dbfile, error) {
f, err := os.OpenFile(filename, flag, 0)
if err != nil {
return nil, err
}
db := &dbfile{file: f, rd: bufio.NewReader(f)}
db.Lock()
return db, nil
}
// close closes the file.
func (db *dbfile) close() error {
db.Unlock()
return db.file.Close()
}
// _FILES_BACKUPED are the files that already have been backuped.
var _FILES_BACKUPED = make(map[string]struct{}, 4)
// backup does a backup of a file.
func backup(filename string) error {
if DO_BACKUP {
if _, ok := _FILES_BACKUPED[filename]; !ok {
if err := file.Backup(filename); err != nil {
return err
}
_FILES_BACKUPED[filename] = struct{}{}
}
}
return nil
}
func edit(name string, r row) error { return _edit(name, r, false) }
func del(name string, r row) error { return _edit(name, r, true) }
// _edit is a generic editor for the given user/group name.
// If remove is true, it removes the structure of the user/group name.
//
// TODO: get better performance if start to store since when the file is edited.
// So there is to store the size of all lines read until that point to seek from
// there.
func _edit(name string, _row row, remove bool) (err error) {
filename := _row.filename()
dbf, err := openDBFile(filename, os.O_RDWR)
if err != nil {
return err
}
defer func() {
e := dbf.close()
if e != nil && err == nil {
err = e
}
}()
var buf bytes.Buffer
name_b := []byte(name)
isFound := false
for {
line, err2 := dbf.rd.ReadBytes('\n')
if err2 == io.EOF {
break
}
if !isFound && bytes.HasPrefix(line, name_b) {
isFound = true
if remove { // skip user
continue
}
line = []byte(_row.String())
}
if _, err = buf.Write(line); err != nil {
return err
}
}
if isFound {
if err = backup(filename); err != nil {
return
}
if _, err = dbf.file.Seek(0, os.SEEK_SET); err != nil {
return
}
var n int
n, err = dbf.file.Write(buf.Bytes())
if err != nil {
return
}
err = dbf.file.Truncate(int64(n))
}
return
}
|
import feathers from 'feathers/client';
import socketio from 'feathers-socketio/client';
import io from 'socket.io-client';
import hooks from 'feathers-hooks';
import authentication from 'feathers-authentication-client';
import storage from '~helpers/ssr-storage';
const host = process.env.HOST || 'localhost';
const port = process.env.PORT || '3030';
const socket = io(`http://${host}:${port}`);
const app = feathers()
.configure(socketio(socket))
.configure(hooks())
.configure(authentication({storage}));
export default app;
|
import { html } from 'lit-html';
import '../src/my-button.js';
import { text, withKnobs, withWebComponentsKnobs } from '@open-wc/demoing-storybook';
export default {
title: 'my-button',
component: 'my-button',
decorators: [withKnobs, withWebComponentsKnobs],
parameters: { options: { selectedPanel: 'storybookjs/knobs/panel' } },
};
export const Primary = () =>
html`
<my-button buttonText="Primary"></my-button>
<style>
html {
--my-button-font-color: #fff;
--my-button-font-size: 16px;
--my-button-bg-color: #4caf50;
}
</style>
`;
export const Danger = () =>
html`
<my-button buttonText="Danger"></my-button>
<style>
html {
--my-button-font-color: #fff;
--my-button-font-size: 16px;
--my-button-bg-color: #cd2b2c;
}
</style>
`;
|
(DARGP-OF-LOOKUP-EQUAL-WHEN-ALL-DARGP-OF-STRIP-CDRS
(1175 74 (:REWRITE CONSP-FROM-LEN-CHEAP))
(519 99 (:REWRITE DEFAULT-CAR))
(435 20 (:REWRITE ALL-DARGP-WHEN-NOT-CONSP))
(378 62 (:REWRITE DEFAULT-CDR))
(322 161
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-TERM-ALISTP))
(312 49
(:LINEAR LEN-POSITIVE-WHEN-CONSP-LINEAR-CHEAP))
(289 29 (:REWRITE LEN-OF-CDR))
(176 176
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(167 143 (:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(144 12 (:REWRITE LEN-OF-STRIP-CDRS))
(143 143 (:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(143 143 (:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(143 143
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(125 1
(:REWRITE DARGP-OF-CDR-OF-ASSOC-EQUAL))
(55 6 (:REWRITE ALL-DARGP-OF-CDR))
(46 17 (:REWRITE DARGP-WHEN-NATP-CHEAP))
(40 20
(:REWRITE ALL-DARGP-WHEN-NOT-CONSP-CHEAP))
(40 20
(:REWRITE ALL-DARGP-WHEN-ALL-MYQUOTEP-CHEAP))
(38 36 (:REWRITE DEFAULT-<-2))
(36 36 (:REWRITE USE-ALL-<-2))
(36 36 (:REWRITE USE-ALL-<))
(36 36 (:REWRITE DEFAULT-<-1))
(36 36 (:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(36 36
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(35 17 (:REWRITE USE-ALL-DARGP))
(34 17 (:REWRITE DARGP-WHEN-MYQUOTEP-CHEAP))
(34 1
(:REWRITE MYQUOTEP-OF-CDR-OF-ASSOC-EQUAL))
(31 31
(:REWRITE ASSOC-EQUAL-WHEN-PSEUDO-DAGP-AUX))
(30 30
(:REWRITE EQUAL-OF-NON-NATP-AND-CAAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(30 30
(:REWRITE CAR-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(30 15
(:REWRITE IFF-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(29 29 (:REWRITE DEFAULT-+-2))
(29 29 (:REWRITE DEFAULT-+-1))
(29 17
(:REWRITE DARGP-WHEN-EQUAL-OF-QUOTE-AND-CAR-CHEAP))
(29 17 (:REWRITE DARGP-WHEN-CONSP-CHEAP))
(27 27 (:REWRITE USE-ALL-CONSP-2))
(27 27 (:REWRITE USE-ALL-CONSP))
(27 27 (:REWRITE CONSP-WHEN-LEN-GREATER))
(25 25
(:REWRITE CONSP-OF-CDR-WHEN-LEN-KNOWN))
(20 20 (:TYPE-PRESCRIPTION ALL-MYQUOTEP))
(20 20
(:REWRITE ALL-DARGP-WHEN-ALL-DARGP-LESS-THAN))
(18 18 (:TYPE-PRESCRIPTION MEMBERP))
(18 6 (:REWRITE FOLD-CONSTS-IN-+))
(17 17 (:TYPE-PRESCRIPTION NATP))
(17 17 (:REWRITE USE-ALL-NATP-2))
(17 17 (:REWRITE USE-ALL-NATP))
(17 17 (:REWRITE USE-ALL-DARGP-2))
(17 17 (:REWRITE USE-ALL-<=-2))
(17 17 (:REWRITE USE-ALL-<=))
(17 17
(:REWRITE NONNEG-WHEN-DARGP-LESS-THAN))
(17 17
(:REWRITE NATP-WHEN-ALL-DARGP-LESS-THAN-GEN))
(17 17
(:REWRITE MYQUOTEP-WHEN-DARGP-LESS-THAN))
(17 17
(:REWRITE MYQUOTEP-WHEN-BOUNDED-DAG-EXPRP))
(17 17 (:REWRITE MYQUOTEP-WHEN-AXE-TREEP))
(17 17
(:REWRITE INTEGERP-WHEN-DARGP-LESS-THAN))
(17 17
(:REWRITE DARGP-WHEN-DARGP-LESS-THAN))
(2 2 (:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(2 2
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH)))
(DARGP-LESS-THAN-OF-CAR-WHEN-ALL-DARGP-LESS-THAN
(242 2 (:DEFINITION ALL-DARGP-LESS-THAN))
(200 8
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-ALL-<))
(178 16 (:REWRITE CONSP-FROM-LEN-CHEAP))
(130 10 (:REWRITE ALL-<-WHEN-NOT-CONSP))
(80 4
(:REWRITE USE-ALL-DARGP-LESS-THAN-FOR-CAR))
(34 2 (:REWRITE ALL-DARGP-LESS-THAN-OF-CDR))
(32 4 (:REWRITE DEFAULT-CAR))
(30 8
(:LINEAR LEN-POSITIVE-WHEN-CONSP-LINEAR-CHEAP))
(28 8
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-NOT-CONSP))
(28 2 (:REWRITE LEN-OF-CDR))
(20 20 (:TYPE-PRESCRIPTION ALL-<))
(16 8
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-ALL-MYQUOTEP-CHEAP))
(16 2 (:REWRITE ALL-<-OF-CDR))
(14 14 (:REWRITE USE-ALL-CONSP-2))
(14 14 (:REWRITE USE-ALL-CONSP))
(14 14 (:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(14 14 (:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(14 14 (:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(14 14
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(14 14 (:REWRITE CONSP-WHEN-LEN-GREATER))
(12 6 (:REWRITE DEFAULT-<-2))
(12 4
(:REWRITE DARGP-LESS-THAN-WHEN-EQUAL-OF-CAR-AND-QUOTE))
(10 10
(:REWRITE ALL-<-WHEN-NOT-CONSP-CHEAP))
(10 10 (:REWRITE ALL-<-TRANSITIVE-FREE-2))
(10 10 (:REWRITE ALL-<-TRANSITIVE-FREE))
(10 10 (:REWRITE ALL-<-TRANSITIVE))
(8 8 (:TYPE-PRESCRIPTION ALL-MYQUOTEP))
(8 8
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-NOT-CONSP-CHEAP))
(8 8
(:REWRITE ALL-DARGP-LESS-THAN-MONOTONE))
(8 4
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-TERM-ALISTP))
(8 4 (:REWRITE USE-ALL-DARGP-LESS-THAN))
(8 4
(:REWRITE DARGP-LESS-THAN-WHEN-NATP-CHEAP))
(8 4
(:REWRITE DARGP-LESS-THAN-WHEN-MYQUOTEP-CHEAP))
(6 6 (:REWRITE USE-ALL-<-2))
(6 6 (:REWRITE USE-ALL-<))
(6 6 (:REWRITE DEFAULT-CDR))
(6 6 (:REWRITE DEFAULT-<-1))
(6 6 (:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(6 6
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(4 4
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(4 4 (:TYPE-PRESCRIPTION NATP))
(4 4 (:TYPE-PRESCRIPTION MYQUOTEP))
(4 4 (:TYPE-PRESCRIPTION MEMBERP))
(4 4 (:REWRITE USE-ALL-DARGP-LESS-THAN-2))
(4 4
(:REWRITE DARGP-LESS-THAN-WHEN-QUOTEP-CHEAP))
(4 4
(:REWRITE DARGP-LESS-THAN-WHEN-NOT-CONSP-CHEAP))
(4 4
(:REWRITE DARGP-LESS-THAN-WHEN-EQUAL-OF-NTH-0-AND-QUOTE))
(4 4
(:REWRITE DARGP-LESS-THAN-WHEN-CONSP-CHEAP))
(4 4 (:REWRITE DARGP-LESS-THAN-MONO))
(4 4
(:REWRITE CONSP-OF-CDR-WHEN-LEN-KNOWN))
(4 4 (:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(4 4
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH))
(4 2 (:REWRITE DEFAULT-+-2))
(2 2 (:REWRITE EQUAL-OF-LEN-AND-0))
(2 2 (:REWRITE DEFAULT-+-1)))
(UNIFY-TREE-WITH-DAG-NODE
(6 6
(:TYPE-PRESCRIPTION TYPE-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX)))
(FLAG-UNIFY-TREE-WITH-DAG-NODE
(988 28 (:DEFINITION INTEGER-ABS))
(675 23 (:REWRITE USE-ALL-<-FOR-CAR))
(574 14 (:DEFINITION NAT-LISTP))
(571 30 (:REWRITE CONSP-FROM-LEN-CHEAP))
(331 5 (:REWRITE ALL-<-OF-0-WHEN-NAT-LISTP))
(304 5 (:REWRITE ALL-<-OF-0-WHEN-ALL-NATP))
(282 14 (:REWRITE ALL-NATP-WHEN-NAT-LISTP))
(251 125 (:REWRITE DEFAULT-+-2))
(206 14 (:DEFINITION NATP))
(176 125 (:REWRITE DEFAULT-+-1))
(113 82 (:REWRITE DEFAULT-<-2))
(112 28 (:REWRITE COMMUTATIVITY-OF-+))
(98 14 (:DEFINITION LENGTH))
(96 48
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1))
(90 14 (:REWRITE USE-ALL-NATP-FOR-CAR))
(88 82 (:REWRITE DEFAULT-<-1))
(88 8 (:REWRITE LEN-OF-CDR))
(82 82 (:REWRITE USE-ALL-<-2))
(82 82 (:REWRITE USE-ALL-<))
(82 82 (:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(82 82
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(76 76 (:TYPE-PRESCRIPTION NAT-LISTP))
(66 65 (:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(64 64 (:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(64 64 (:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(64 64
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(52 52 (:REWRITE USE-ALL-<=-2))
(52 52 (:REWRITE USE-ALL-<=))
(51 51
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP-AUX))
(48 48
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(48 48 (:REWRITE DEFAULT-CAR))
(46 46
(:REWRITE NONNEG-WHEN-DARGP-LESS-THAN))
(44 44 (:TYPE-PRESCRIPTION ALL-NATP))
(42 42 (:REWRITE DEFAULT-CDR))
(40 40
(:TYPE-PRESCRIPTION TYPE-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(37 37 (:REWRITE FOLD-CONSTS-IN-+))
(30 30 (:REWRITE USE-ALL-CONSP-2))
(30 30 (:REWRITE USE-ALL-CONSP))
(30 30 (:REWRITE CONSP-WHEN-LEN-GREATER))
(28 28 (:TYPE-PRESCRIPTION ALL-<))
(28 28 (:REWRITE DEFAULT-UNARY-MINUS))
(28 14
(:REWRITE ALL-NATP-WHEN-NAT-LISTP-CHEAP))
(25 5 (:REWRITE USE-ALL-RATIONALP-FOR-CAR))
(25 5 (:REWRITE USE-ALL-CONSP-FOR-CAR))
(23 23
(:REWRITE NOT-<-OF-CAR-WHEN-ALL-DARGP-LESS-THAN-2))
(23 22 (:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(23 22
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH))
(18 18
(:REWRITE INTEGERP-WHEN-DARGP-LESS-THAN))
(18 9
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-NATP-CHEAP))
(18 9
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-INTEGERP-CHEAP))
(18 2 (:REWRITE ALL-NATP-OF-CDR))
(15 5
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP))
(14 14 (:REWRITE USE-ALL-RATIONALP-2))
(14 14 (:REWRITE USE-ALL-RATIONALP))
(14 14 (:REWRITE USE-ALL-NATP-2))
(14 14 (:REWRITE USE-ALL-NATP))
(14 14
(:REWRITE NATP-WHEN-ALL-DARGP-LESS-THAN-GEN))
(14 14 (:REWRITE DEFAULT-REALPART))
(14 14 (:REWRITE DEFAULT-NUMERATOR))
(14 14 (:REWRITE DEFAULT-IMAGPART))
(14 14 (:REWRITE DEFAULT-DENOMINATOR))
(14 14 (:REWRITE DEFAULT-COERCE-2))
(14 14 (:REWRITE DEFAULT-COERCE-1))
(14 14
(:REWRITE ALL-NATP-WHEN-NOT-CONSP-CHEAP))
(14 14 (:REWRITE ALL-NATP-WHEN-NOT-CONSP))
(10 10 (:TYPE-PRESCRIPTION PSEUDO-DAGP))
(10 10 (:TYPE-PRESCRIPTION ALL-RATIONALP))
(10 10 (:TYPE-PRESCRIPTION ALL-CONSP))
(10 5
(:REWRITE CONSP-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(10 2
(:REWRITE LEN-OF-AREF1-WHEN-QUOTEP-AND-PSEUDO-DAG-ARRAYP-AUX))
(9 9 (:TYPE-PRESCRIPTION ALL-INTEGERP))
(9 9
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-DARGP-LESS-THAN))
(8 8
(:REWRITE CONSP-OF-CDR-WHEN-LEN-KNOWN))
(8 2 (:REWRITE AREF1-WHEN-TOO-LARGE-CHEAP))
(5 5
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(5 5
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(5 5
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX-2))
(5 5
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(5 5
(:REWRITE CAR-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(5 5
(:REWRITE ALL-RATIONALP-WHEN-NOT-CONSP-CHEAP))
(5 5
(:REWRITE ALL-RATIONALP-WHEN-NOT-CONSP))
(5 5
(:REWRITE ALL-CONSP-WHEN-NOT-CONSP-CHEAP))
(5 5 (:REWRITE ALL-CONSP-WHEN-NOT-CONSP))
(5 5 (:REWRITE ALL-<-WHEN-NOT-CONSP-CHEAP))
(5 5 (:REWRITE ALL-<-WHEN-NOT-CONSP))
(5 5 (:REWRITE ALL-<-TRANSITIVE-FREE-2))
(5 5 (:REWRITE ALL-<-TRANSITIVE-FREE))
(5 5 (:REWRITE ALL-<-TRANSITIVE))
(4 2 (:TYPE-PRESCRIPTION ALEN1-TYPE))
(4 1
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-WHEN-PSEUDO-DAGP-AUX))
(3 3 (:REWRITE <-OF-+-OF-1-STRENGTHEN))
(2 2
(:TYPE-PRESCRIPTION SYMBOLP-OF-NTH-0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(2 2 (:TYPE-PRESCRIPTION PSEUDO-DAGP-AUX))
(2 2 (:TYPE-PRESCRIPTION POSP-OF-ALEN1))
(2 2 (:TYPE-PRESCRIPTION ARRAY1P))
(1 1
(:REWRITE QUOTE-LEMMA-FOR-ALL-DARGP-LESS-THAN-GEN-ALT))
(1 1
(:REWRITE PSEUDO-DAGP-AUX-WHEN-NOT-CONSP-CHEAP))
(1 1
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-MONOTONE)))
(FLAG::FLAG-EQUIV-LEMMA)
(FLAG-UNIFY-TREE-WITH-DAG-NODE-EQUIVALENCES)
(FLAG-LEMMA-FOR-SYMBOL-ALISTP-OF-MV-NTH-1-OF-UNIFY-TREE-WITH-DAG-NODE
(498 27 (:REWRITE CONSP-FROM-LEN-CHEAP))
(114 57
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1))
(100 44 (:REWRITE DEFAULT-CAR))
(90 90
(:TYPE-PRESCRIPTION TYPE-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(62 62
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP-AUX))
(57 57
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(54 27
(:REWRITE SYMBOL-ALISTP-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(46 43 (:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(46 23 (:REWRITE DEFAULT-<-2))
(43 43 (:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(43 43 (:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(43 43
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(37 37
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(32 11 (:REWRITE DEFAULT-CDR))
(28 7 (:REWRITE AREF1-WHEN-TOO-LARGE-CHEAP))
(26 23 (:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(26 23
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH))
(23 23 (:REWRITE USE-ALL-CONSP-2))
(23 23 (:REWRITE USE-ALL-CONSP))
(23 23 (:REWRITE USE-ALL-<-2))
(23 23 (:REWRITE USE-ALL-<))
(23 23 (:REWRITE DEFAULT-<-1))
(23 23 (:REWRITE CONSP-WHEN-LEN-GREATER))
(23 23 (:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(23 23
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(16 8
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-TERM-ALISTP))
(14 7 (:TYPE-PRESCRIPTION ALEN1-TYPE))
(14 4
(:REWRITE LEN-OF-AREF1-WHEN-QUOTEP-AND-PSEUDO-DAG-ARRAYP-AUX))
(7 7 (:TYPE-PRESCRIPTION POSP-OF-ALEN1))
(7 7 (:TYPE-PRESCRIPTION ARRAY1P))
(6 6
(:TYPE-PRESCRIPTION SYMBOLP-OF-NTH-0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(4 4
(:REWRITE QUOTE-LEMMA-FOR-ALL-DARGP-LESS-THAN-GEN-ALT))
(4 4
(:REWRITE EQUAL-OF-NON-NATP-AND-CAAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(4 4
(:REWRITE CAR-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(4 4
(:REWRITE ASSOC-EQUAL-WHEN-PSEUDO-DAGP-AUX))
(4 2
(:REWRITE IFF-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(4 1
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-WHEN-PSEUDO-DAGP-AUX))
(3 3
(:REWRITE SYMBOLP-WHEN-BOUNDED-DAG-EXPRP))
(2 2 (:TYPE-PRESCRIPTION PSEUDO-DAGP-AUX))
(1 1
(:REWRITE PSEUDO-DAGP-AUX-WHEN-NOT-CONSP-CHEAP))
(1 1
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-MONOTONE)))
(SYMBOL-ALISTP-OF-MV-NTH-1-OF-UNIFY-TREE-WITH-DAG-NODE)
(SYMBOL-ALISTP-OF-MV-NTH-1-OF-UNIFY-TREES-WITH-DAG-NODES)
(UNIFY-TREE-WITH-DAG-NODE
(8436 5 (:DEFINITION ALL-AXE-TREEP))
(7132 25 (:DEFINITION PSEUDO-TERMP))
(5442 6 (:DEFINITION AXE-TREEP))
(5213 22
(:REWRITE AXE-TREEP-WHEN-PSEUDO-TERMP))
(4880 338 (:REWRITE CONSP-FROM-LEN-CHEAP))
(2268 31 (:DEFINITION SYMBOL-LISTP))
(2243 22 (:REWRITE AXE-TREEP-WHEN-DARGP))
(2003 181 (:REWRITE LEN-OF-CDR))
(1527 44 (:DEFINITION NAT-LISTP))
(1364 47 (:REWRITE ALL-NATP-WHEN-NAT-LISTP))
(1256 703 (:TYPE-PRESCRIPTION ALEN1-TYPE))
(1088 56 (:REWRITE USE-ALL-CONSP-FOR-CAR))
(1032 574 (:REWRITE DEFAULT-CAR))
(958 26 (:REWRITE USE-ALL-<-FOR-CAR))
(844 503 (:REWRITE DEFAULT-CDR))
(827 734 (:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(776 49 (:REWRITE USE-ALL-NATP-FOR-CAR))
(774 387
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-TERM-ALISTP))
(774 6 (:REWRITE NATP-OF-NTH-FROM-ALL-NATP))
(769 75 (:DEFINITION LENGTH))
(734 734 (:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(734 734 (:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(734 734
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(703 703 (:TYPE-PRESCRIPTION POSP-OF-ALEN1))
(692 99 (:REWRITE ALL-CONSP-WHEN-NOT-CONSP))
(540 270
(:TYPE-PRESCRIPTION NATP-OF-LARGEST-NON-QUOTEP))
(470 20
(:REWRITE ALL-AXE-TREEP-WHEN-ALL-DARGP))
(456 12
(:REWRITE NATP-OF-NTH-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(449 449
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(428 236 (:REWRITE DEFAULT-<-2))
(402 26 (:REWRITE ALL-<-OF-0-WHEN-ALL-NATP))
(384 20
(:REWRITE ALL-AXE-TREEP-WHEN-PSEUDO-TERM-LISTP))
(342 26 (:REWRITE ALL-<-OF-0-WHEN-NAT-LISTP))
(328 164
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1))
(299 43 (:REWRITE ALL-CONSP-OF-CDR))
(299 39 (:REWRITE ALL-DARGP-WHEN-NOT-CONSP))
(291 291
(:TYPE-PRESCRIPTION TYPE-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(289 289 (:TYPE-PRESCRIPTION NAT-LISTP))
(284 284 (:TYPE-PRESCRIPTION ALL-MYQUOTEP))
(274 18 (:DEFINITION PSEUDO-TERM-LISTP))
(247 20 (:REWRITE DARGP-WHEN-CONSP-CHEAP))
(246 47 (:REWRITE ALL-NATP-WHEN-NOT-CONSP))
(245 245 (:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(241 241
(:REWRITE CAR-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(239 239
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(236 236 (:REWRITE USE-ALL-<-2))
(236 236 (:REWRITE USE-ALL-<))
(236 236 (:REWRITE DEFAULT-<-1))
(212 108 (:REWRITE DEFAULT-+-2))
(204 9
(:LINEAR <-OF-NTH-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-LINEAR))
(198 198 (:TYPE-PRESCRIPTION ALL-CONSP))
(196 196 (:REWRITE USE-ALL-CONSP-2))
(196 196 (:REWRITE USE-ALL-CONSP))
(196 196 (:REWRITE CONSP-WHEN-LEN-GREATER))
(192 192 (:TYPE-PRESCRIPTION SYMBOL-LISTP))
(192 192 (:TYPE-PRESCRIPTION PSEUDO-TERMP))
(174 39
(:REWRITE CAR-OF-DARGS-BECOMES-NTH-0-OF-DARGS))
(169 163
(:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(168 56
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP))
(163 157
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH))
(161 161 (:TYPE-PRESCRIPTION ALL-NATP))
(160 88
(:REWRITE SYMBOLP-OF-CAR-WHEN-AXE-TREEP-CHEAP))
(159 159
(:TYPE-PRESCRIPTION PSEUDO-TERM-LISTP))
(144 12 (:REWRITE INTEGERP-OF-NTH-OF-DARGS))
(138
12
(:REWRITE INTEGERP-OF-NTH-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-SIMPLE))
(138 12
(:REWRITE INTEGERP-OF-NTH-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(138 6 (:REWRITE NATP-OF-NTH-WHEN-ALL-DARGP))
(138 6 (:REWRITE NATP-OF-NTH-OF-DARGS))
(130 94 (:REWRITE NTH-WHEN-NOT-CDDR))
(122 61
(:REWRITE PSEUDO-TERM-LISTP-WHEN-SYMBOL-LISTP-CHEAP))
(112 112 (:TYPE-PRESCRIPTION PSEUDO-DAGP))
(112 56
(:REWRITE CONSP-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(108 108 (:REWRITE DEFAULT-+-1))
(102 51
(:REWRITE SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-ALISTP-CHEAP))
(99 99
(:REWRITE ALL-CONSP-WHEN-NOT-CONSP-CHEAP))
(94 47
(:REWRITE ALL-NATP-WHEN-NAT-LISTP-CHEAP))
(88 11 (:REWRITE USE-ALL-DARGP-FOR-CAR))
(84 21
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-WHEN-PSEUDO-DAGP-AUX))
(84 3 (:REWRITE ALL-NATP-OF-CDR))
(82 41
(:REWRITE ALL-DARGP-WHEN-ALL-MYQUOTEP-CHEAP))
(79 79
(:REWRITE SYMBOLP-WHEN-BOUNDED-DAG-EXPRP))
(79 79
(:REWRITE SYMBOLP-OF-CAR-WHEN-BOUNDED-DAG-EXPRP))
(72 72
(:REWRITE AREF1-WHEN-TOO-LARGE-CHEAP))
(72 9
(:LINEAR NONNEG-OF-NTH-OF-DARGS-OF-AREF1))
(72 9
(:LINEAR <-OF-NTH-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(70 70
(:REWRITE TRUE-LISTP-WHEN-PSEUDO-DAGP-AUX))
(70 70 (:REWRITE EQUAL-OF-LEN-AND-0))
(68 68
(:REWRITE TERMP-IMPLIES-PSEUDO-TERMP))
(61 61
(:REWRITE TERM-LISTP-IMPLIES-PSEUDO-TERM-LISTP))
(61 61
(:REWRITE NATP-WHEN-ALL-DARGP-LESS-THAN-GEN))
(61 2 (:REWRITE ALL-<-OF-CDR))
(57 57 (:REWRITE USE-ALL-NATP-2))
(57 57 (:REWRITE USE-ALL-NATP))
(57 57
(:REWRITE CONSP-OF-CDR-WHEN-LEN-KNOWN))
(56 56
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(56 56
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX-2))
(56 56
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(54 54 (:TYPE-PRESCRIPTION ALL-<))
(54 54
(:REWRITE QUOTE-LEMMA-FOR-ALL-DARGP-LESS-THAN-GEN-ALT))
(53 47
(:REWRITE ALL-NATP-WHEN-NOT-CONSP-CHEAP))
(48 48
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-ALL-DARGP-LESS-THAN))
(48 24
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-NATP-CHEAP))
(48 24
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-INTEGERP-CHEAP))
(48 12
(:REWRITE INTEGERP-OF-NTH-WHEN-ALL-INTEGERP))
(44 22
(:REWRITE AXE-TREEP-WHEN-EQUAL-OF-CAR-AND-QUOTE-CHEAP))
(42 42
(:TYPE-PRESCRIPTION TRUE-LISTP-OF-DIMENSIONS))
(42 42 (:TYPE-PRESCRIPTION PSEUDO-DAGP-AUX))
(41 41
(:REWRITE ALL-DARGP-WHEN-ALL-DARGP-LESS-THAN))
(39 39
(:REWRITE ALL-DARGP-WHEN-NOT-CONSP-CHEAP))
(38 38
(:REWRITE INTEGERP-WHEN-DARGP-LESS-THAN))
(37 37 (:REWRITE USE-ALL-<=-2))
(37 37 (:REWRITE USE-ALL-<=))
(37 37
(:REWRITE LEN-OF-CDDR-WHEN-EQUAL-OF-LEN))
(36 36 (:TYPE-PRESCRIPTION ALL-INTEGERP))
(36 20
(:REWRITE DARGP-WHEN-EQUAL-OF-QUOTE-AND-CAR-CHEAP))
(36 14 (:REWRITE AXE-TREEP-OF-CAR))
(36 9
(:REWRITE LEN-OF-AREF1-WHEN-QUOTEP-AND-PSEUDO-DAG-ARRAYP-AUX))
(32 26 (:REWRITE ALL-<-WHEN-NOT-CONSP))
(32 16
(:REWRITE LARGEST-NON-QUOTEP-WHEN-ALL-MYQUOTEP-CHEAP))
(31 31
(:REWRITE NONNEG-WHEN-DARGP-LESS-THAN))
(28 20 (:REWRITE USE-ALL-DARGP))
(26 26
(:REWRITE NOT-<-OF-CAR-WHEN-ALL-DARGP-LESS-THAN-2))
(26 26
(:REWRITE ALL-<-WHEN-NOT-CONSP-CHEAP))
(26 26 (:REWRITE ALL-<-TRANSITIVE-FREE-2))
(26 26 (:REWRITE ALL-<-TRANSITIVE-FREE))
(26 26 (:REWRITE ALL-<-TRANSITIVE))
(25 25 (:REWRITE DEFAULT-COERCE-2))
(25 25 (:REWRITE DEFAULT-COERCE-1))
(24 24
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-DARGP-LESS-THAN))
(23 23
(:REWRITE EQUAL-OF-NON-NATP-AND-CAAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(22 22
(:REWRITE AXE-TREEP-WHEN-NOT-CONSP-AND-NOT-SYMBOLP-CHEAP))
(21 21
(:REWRITE PSEUDO-DAGP-AUX-WHEN-NOT-CONSP-CHEAP))
(21 21
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-MONOTONE))
(20 20 (:REWRITE USE-ALL-DARGP-2))
(20 20
(:REWRITE MYQUOTEP-WHEN-DARGP-LESS-THAN))
(20 20
(:REWRITE MYQUOTEP-WHEN-BOUNDED-DAG-EXPRP))
(20 20 (:REWRITE MYQUOTEP-WHEN-AXE-TREEP))
(20 20
(:REWRITE DARGP-WHEN-DARGP-LESS-THAN))
(18 18 (:TYPE-PRESCRIPTION DAG-EXPRP0))
(18 9 (:REWRITE DARGP-WHEN-NATP-CHEAP))
(18 9 (:REWRITE DARGP-WHEN-MYQUOTEP-CHEAP))
(12 12
(:TYPE-PRESCRIPTION SYMBOLP-OF-NTH-0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(12 12
(:REWRITE INTEGERP-OF-NTH-WHEN-ALL-DARGP-LESS-THAN))
(12 12
(:REWRITE DAG-EXPRP0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(12 6
(:REWRITE SYMBOL-ALISTP-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(12 6 (:REWRITE LEN-OF-NTH-WHEN-ALL-DARGP))
(12 6 (:REWRITE LEN-OF-NTH-OF-DARGS))
(12 6
(:REWRITE LEN-OF-NTH-0-WHEN-AXE-TREEP-CHEAP))
(12 6
(:REWRITE ALL-NATP-IMPLIES-ALL-INTEGERP-CHEAP))
(12 6
(:REWRITE ALL-INTEGERP-WHEN-NOT-CONSP-CHEAP))
(8 8 (:TYPE-PRESCRIPTION MEMBERP))
(6 6 (:REWRITE ZP-OPEN))
(6 6
(:REWRITE NATP-OF-NTH-WHEN-ALL-DARGP-LESS-THAN-GEN))
(6 6
(:REWRITE LEN-OF-NTH-WHEN-ALL-DARGP-LESS-THAN))
(6 6 (:LINEAR <-OF-LARGEST-NON-QUOTEP))
(3 3 (:REWRITE <-OF-+-OF-1-STRENGTHEN))
(3 1
(:REWRITE RATIONALP-IMPLIES-ACL2-NUMBERP))
(1 1 (:REWRITE USE-ALL-RATIONALP-2))
(1 1 (:REWRITE USE-ALL-RATIONALP)))
(FLAG-LEMMA-FOR-ALISTP-OF-UNIFY-TREE-WITH-DAG-NODE
(5673 304 (:REWRITE CONSP-FROM-LEN-CHEAP))
(568 110 (:REWRITE USE-ALL-CONSP-FOR-CAR))
(504 265 (:REWRITE DEFAULT-<-2))
(461 307 (:REWRITE DEFAULT-CAR))
(450 387 (:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(432 187 (:REWRITE DEFAULT-CDR))
(430 215
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1))
(387 387 (:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(387 387 (:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(387 387
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(306 110
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP))
(298 298
(:TYPE-PRESCRIPTION TYPE-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(288 144
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-TERM-ALISTP))
(286 26 (:REWRITE LEN-OF-CDR))
(280 280
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP-AUX))
(277 277 (:REWRITE USE-ALL-CONSP-2))
(277 277 (:REWRITE USE-ALL-CONSP))
(277 277 (:REWRITE CONSP-WHEN-LEN-GREATER))
(272 239
(:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(272 239
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH))
(265 265 (:REWRITE USE-ALL-<-2))
(265 265 (:REWRITE USE-ALL-<))
(265 265 (:REWRITE DEFAULT-<-1))
(265 265 (:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(265 265
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(257 257
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(220 110
(:REWRITE CONSP-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(215 215
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(196 196 (:TYPE-PRESCRIPTION PSEUDO-DAGP))
(196 196 (:TYPE-PRESCRIPTION ALL-CONSP))
(188 47
(:REWRITE AREF1-WHEN-TOO-LARGE-CHEAP))
(164 98 (:REWRITE ALL-CONSP-WHEN-NOT-CONSP))
(145 145
(:REWRITE ALISTP-WHEN-PSEUDO-DAGP-AUX))
(133 133
(:REWRITE ALISTP-WHEN-BOUNDED-NATP-ALISTP))
(110 110
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(110 110
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX-2))
(110 110
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(98 98
(:REWRITE ALL-CONSP-WHEN-NOT-CONSP-CHEAP))
(98 37
(:REWRITE LEN-OF-AREF1-WHEN-QUOTEP-AND-PSEUDO-DAG-ARRAYP-AUX))
(94 47 (:TYPE-PRESCRIPTION ALEN1-TYPE))
(72 72
(:REWRITE EQUAL-OF-NON-NATP-AND-CAAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(66 66
(:TYPE-PRESCRIPTION SYMBOLP-OF-NTH-0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(54 27
(:REWRITE SYMBOLP-OF-CAR-WHEN-AXE-TREEP-CHEAP))
(48 48
(:REWRITE CAR-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(48 24
(:TYPE-PRESCRIPTION
TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-SIMPLE))
(48 24
(:TYPE-PRESCRIPTION
TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX-SIMPLE))
(47 47 (:TYPE-PRESCRIPTION POSP-OF-ALEN1))
(47 47 (:TYPE-PRESCRIPTION ARRAY1P))
(35 35
(:REWRITE QUOTE-LEMMA-FOR-ALL-DARGP-LESS-THAN-GEN-ALT))
(32 32
(:REWRITE SYMBOLP-WHEN-BOUNDED-DAG-EXPRP))
(30 12
(:REWRITE CAR-OF-DARGS-BECOMES-NTH-0-OF-DARGS))
(27 27 (:TYPE-PRESCRIPTION AXE-TREEP))
(27 27
(:REWRITE SYMBOLP-OF-CAR-WHEN-BOUNDED-DAG-EXPRP))
(26 26 (:REWRITE DEFAULT-+-2))
(26 26 (:REWRITE DEFAULT-+-1))
(26 26
(:REWRITE CONSP-OF-CDR-WHEN-LEN-KNOWN))
(24
24
(:TYPE-PRESCRIPTION TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(24 24
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP))
(18 6 (:DEFINITION NTH))
(16 4
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-WHEN-PSEUDO-DAGP-AUX))
(12 12 (:REWRITE NTH-WHEN-NOT-CDDR))
(8 8 (:TYPE-PRESCRIPTION PSEUDO-DAGP-AUX))
(6 6
(:REWRITE ASSOC-EQUAL-WHEN-PSEUDO-DAGP-AUX))
(6 3
(:REWRITE IFF-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(4 4
(:REWRITE PSEUDO-DAGP-AUX-WHEN-NOT-CONSP-CHEAP))
(4 4
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-MONOTONE)))
(ALISTP-OF-UNIFY-TREE-WITH-DAG-NODE)
(ALISTP-OF-FOR-UNIFY-TREES-WITH-DAG-NODES)
(TREE-VARS (1 1 (:TYPE-PRESCRIPTION TRUE-LISTP)))
(FLAG-LEMMA-FOR-UNIFY-TREE-WITH-DAG-NODE-MONO
(3531 192 (:REWRITE CONSP-FROM-LEN-CHEAP))
(844 214 (:REWRITE DEFAULT-CAR))
(639 18 (:DEFINITION MEMBER-EQUAL))
(333 276 (:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(314 132 (:REWRITE DEFAULT-CDR))
(276 276 (:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(276 276 (:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(276 276
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(253 134 (:REWRITE DEFAULT-<-2))
(165 15 (:REWRITE LEN-OF-CDR))
(156 78
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-TERM-ALISTP))
(156 78
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1))
(135 135
(:TYPE-PRESCRIPTION TYPE-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(134 134 (:REWRITE USE-ALL-CONSP-2))
(134 134 (:REWRITE USE-ALL-CONSP))
(134 134 (:REWRITE USE-ALL-<-2))
(134 134 (:REWRITE USE-ALL-<))
(134 134 (:REWRITE DEFAULT-<-1))
(134 134 (:REWRITE CONSP-WHEN-LEN-GREATER))
(134 134 (:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(134 134
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(133 119
(:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(133 119
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH))
(116 29
(:REWRITE AREF1-WHEN-TOO-LARGE-CHEAP))
(114 114
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP-AUX))
(110 22 (:REWRITE USE-ALL-CONSP-FOR-CAR))
(105 105 (:TYPE-PRESCRIPTION STRIP-CARS))
(102 102
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(78 78
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(66 22
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP))
(58 29 (:TYPE-PRESCRIPTION ALEN1-TYPE))
(56 56
(:REWRITE CAR-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(50 10
(:REWRITE CAR-OF-DARGS-BECOMES-NTH-0-OF-DARGS))
(44 44 (:TYPE-PRESCRIPTION PSEUDO-DAGP))
(44 44 (:TYPE-PRESCRIPTION ALL-CONSP))
(44 22
(:REWRITE CONSP-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(42 21
(:REWRITE SUBSETP-EQUAL-WHEN-SUBSETP-EQUAL-OF-CDR-CHEAP))
(42 21
(:REWRITE SUBSETP-EQUAL-WHEN-NOT-CONSP-ARG1-CHEAP))
(40 20
(:TYPE-PRESCRIPTION
TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-SIMPLE))
(40 20
(:TYPE-PRESCRIPTION
TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX-SIMPLE))
(40 5 (:DEFINITION NTH))
(39 39
(:REWRITE EQUAL-OF-NON-NATP-AND-CAAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(36 36
(:REWRITE MEMBER-EQUAL-WHEN-SUBSETP-EQUAL-1))
(36 15
(:REWRITE LEN-OF-AREF1-WHEN-QUOTEP-AND-PSEUDO-DAG-ARRAYP-AUX))
(33 21
(:REWRITE SUBSETP-EQUAL-WHEN-NOT-CONSP-ARG2-CHEAP))
(31 31
(:REWRITE SUBSETP-EQUAL-TRANSITIVE-ALT))
(31 31
(:REWRITE SUBSETP-EQUAL-TRANSITIVE-2-ALT))
(29 29 (:TYPE-PRESCRIPTION POSP-OF-ALEN1))
(29 29 (:TYPE-PRESCRIPTION ARRAY1P))
(28 28
(:TYPE-PRESCRIPTION SYMBOLP-OF-NTH-0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(22 22
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(22 22
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX-2))
(22 22
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(22 22
(:REWRITE ALL-CONSP-WHEN-NOT-CONSP-CHEAP))
(22 22 (:REWRITE ALL-CONSP-WHEN-NOT-CONSP))
(22 11
(:REWRITE SYMBOLP-OF-CAR-WHEN-AXE-TREEP-CHEAP))
(20
20
(:TYPE-PRESCRIPTION TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(20 20
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP))
(16 16
(:REWRITE QUOTE-LEMMA-FOR-ALL-DARGP-LESS-THAN-GEN-ALT))
(15 15 (:REWRITE NTH-WHEN-NOT-CDDR))
(15 15 (:REWRITE DEFAULT-+-2))
(15 15 (:REWRITE DEFAULT-+-1))
(15 15
(:REWRITE CONSP-OF-CDR-WHEN-LEN-KNOWN))
(14 14
(:REWRITE SYMBOLP-WHEN-BOUNDED-DAG-EXPRP))
(11 11 (:TYPE-PRESCRIPTION AXE-TREEP))
(11 11
(:REWRITE SYMBOLP-OF-CAR-WHEN-BOUNDED-DAG-EXPRP))
(4 4
(:REWRITE ASSOC-EQUAL-WHEN-PSEUDO-DAGP-AUX))
(4 2
(:REWRITE IFF-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(4 1
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-WHEN-PSEUDO-DAGP-AUX))
(2 2 (:TYPE-PRESCRIPTION PSEUDO-DAGP-AUX))
(1 1
(:REWRITE PSEUDO-DAGP-AUX-WHEN-NOT-CONSP-CHEAP))
(1 1
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-MONOTONE)))
(UNIFY-TREE-WITH-DAG-NODE-MONO)
(UNIFY-TREES-WITH-DAG-NODES-MONO)
(FLAG-LEMMA-FOR-UNIFY-TREE-WITH-DAG-NODE-MONO2
(3153 174 (:REWRITE CONSP-FROM-LEN-CHEAP))
(826 196 (:REWRITE DEFAULT-CAR))
(297 258 (:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(296 114 (:REWRITE DEFAULT-CDR))
(258 258 (:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(258 258 (:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(258 258
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(217 116 (:REWRITE DEFAULT-<-2))
(165 15 (:REWRITE LEN-OF-CDR))
(156 78
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-TERM-ALISTP))
(156 78
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1))
(135 135
(:TYPE-PRESCRIPTION TYPE-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(116 116 (:REWRITE USE-ALL-CONSP-2))
(116 116 (:REWRITE USE-ALL-CONSP))
(116 116 (:REWRITE USE-ALL-<-2))
(116 116 (:REWRITE USE-ALL-<))
(116 116 (:REWRITE DEFAULT-<-1))
(116 116 (:REWRITE CONSP-WHEN-LEN-GREATER))
(116 116 (:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(116 116
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(116 29
(:REWRITE AREF1-WHEN-TOO-LARGE-CHEAP))
(115 101
(:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(115 101
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH))
(114 114
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP-AUX))
(110 22 (:REWRITE USE-ALL-CONSP-FOR-CAR))
(102 102
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(84 42
(:REWRITE SUBSETP-EQUAL-WHEN-SUBSETP-EQUAL-OF-CDR-CHEAP))
(78 78
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(71 42
(:REWRITE SUBSETP-EQUAL-WHEN-NOT-CONSP-ARG2-CHEAP))
(66 22
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP))
(64 42
(:REWRITE SUBSETP-EQUAL-WHEN-NOT-CONSP-ARG1-CHEAP))
(58 29 (:TYPE-PRESCRIPTION ALEN1-TYPE))
(56 56
(:REWRITE CAR-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(51 51 (:TYPE-PRESCRIPTION STRIP-CARS))
(50 10
(:REWRITE CAR-OF-DARGS-BECOMES-NTH-0-OF-DARGS))
(44 44 (:TYPE-PRESCRIPTION PSEUDO-DAGP))
(44 44 (:TYPE-PRESCRIPTION ALL-CONSP))
(44 22
(:REWRITE CONSP-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(40 20
(:TYPE-PRESCRIPTION
TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-SIMPLE))
(40 20
(:TYPE-PRESCRIPTION
TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX-SIMPLE))
(40 5 (:DEFINITION NTH))
(39 39
(:REWRITE EQUAL-OF-NON-NATP-AND-CAAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(36 15
(:REWRITE LEN-OF-AREF1-WHEN-QUOTEP-AND-PSEUDO-DAG-ARRAYP-AUX))
(29 29 (:TYPE-PRESCRIPTION POSP-OF-ALEN1))
(29 29 (:TYPE-PRESCRIPTION ARRAY1P))
(28 28
(:TYPE-PRESCRIPTION SYMBOLP-OF-NTH-0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(22 22
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(22 22
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX-2))
(22 22
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(22 22
(:REWRITE ALL-CONSP-WHEN-NOT-CONSP-CHEAP))
(22 22 (:REWRITE ALL-CONSP-WHEN-NOT-CONSP))
(22 11
(:REWRITE SYMBOLP-OF-CAR-WHEN-AXE-TREEP-CHEAP))
(20
20
(:TYPE-PRESCRIPTION TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(20 20
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP))
(16 16
(:REWRITE QUOTE-LEMMA-FOR-ALL-DARGP-LESS-THAN-GEN-ALT))
(15 15 (:REWRITE NTH-WHEN-NOT-CDDR))
(15 15 (:REWRITE DEFAULT-+-2))
(15 15 (:REWRITE DEFAULT-+-1))
(15 15
(:REWRITE CONSP-OF-CDR-WHEN-LEN-KNOWN))
(14 14
(:REWRITE SYMBOLP-WHEN-BOUNDED-DAG-EXPRP))
(11 11 (:TYPE-PRESCRIPTION AXE-TREEP))
(11 11
(:REWRITE SYMBOLP-OF-CAR-WHEN-BOUNDED-DAG-EXPRP))
(4 4
(:REWRITE ASSOC-EQUAL-WHEN-PSEUDO-DAGP-AUX))
(4 2
(:REWRITE IFF-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(4 1
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-WHEN-PSEUDO-DAGP-AUX))
(2 2 (:TYPE-PRESCRIPTION PSEUDO-DAGP-AUX))
(1 1
(:REWRITE PSEUDO-DAGP-AUX-WHEN-NOT-CONSP-CHEAP))
(1 1
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-MONOTONE)))
(UNIFY-TREE-WITH-DAG-NODE-MONO2)
(UNIFY-TREES-WITH-DAG-NODES-MONO2)
(FLAG-LEMMA-FOR-UNIFY-TREE-WITH-DAG-NODE-BINDS-ALL-VARS
(17995 1145 (:REWRITE CONSP-FROM-LEN-CHEAP))
(12012 90
(:REWRITE ALL-AXE-TREEP-WHEN-PSEUDO-TERM-LISTP))
(11531 113 (:DEFINITION PSEUDO-TERM-LISTP))
(10065 64 (:REWRITE AXE-TREEP-WHEN-DARGP))
(8694 22 (:DEFINITION DARGP))
(8412 115 (:DEFINITION SYMBOL-LISTP))
(6692 162 (:DEFINITION NAT-LISTP))
(5160 88 (:REWRITE USE-ALL-<-FOR-CAR))
(5022 178 (:REWRITE ALL-NATP-WHEN-NAT-LISTP))
(4726 230 (:REWRITE USE-ALL-NATP-FOR-CAR))
(4722 2369 (:REWRITE DEFAULT-CAR))
(3991 227 (:REWRITE USE-ALL-CONSP-FOR-CAR))
(3435 1974 (:REWRITE DEFAULT-CDR))
(3153 297 (:DEFINITION LENGTH))
(3010 1505
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-TERM-ALISTP))
(2675 2624
(:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(2624 2624
(:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(2624 2624
(:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(2624 2624
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(2431 390 (:REWRITE ALL-CONSP-WHEN-NOT-CONSP))
(2246 126
(:REWRITE ALL-<-OF-0-WHEN-NAT-LISTP))
(1906 126 (:REWRITE ALL-<-OF-0-WHEN-ALL-NATP))
(1768 1768
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(1380 46 (:REWRITE ALL-NATP-OF-CDR))
(1341 159 (:REWRITE ALL-DARGP-WHEN-NOT-CONSP))
(1120 636 (:REWRITE DEFAULT-<-2))
(1096 38 (:REWRITE ALL-<-OF-CDR))
(1033 163 (:REWRITE ALL-CONSP-OF-CDR))
(978 978
(:REWRITE CAR-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(968 968 (:TYPE-PRESCRIPTION NAT-LISTP))
(780 780 (:TYPE-PRESCRIPTION ALL-CONSP))
(757 757
(:TYPE-PRESCRIPTION PSEUDO-TERM-LISTP))
(719 48 (:REWRITE DARGP-WHEN-CONSP-CHEAP))
(687 403 (:REWRITE DEFAULT-+-2))
(681 227
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP))
(678 678 (:TYPE-PRESCRIPTION ALL-NATP))
(650 325
(:REWRITE PSEUDO-TERM-LISTP-WHEN-SYMBOL-LISTP-CHEAP))
(636 636 (:REWRITE USE-ALL-<-2))
(636 636 (:REWRITE USE-ALL-<))
(636 636 (:REWRITE DEFAULT-<-1))
(636 636 (:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(636 636
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(634 311
(:REWRITE SYMBOLP-OF-CAR-WHEN-AXE-TREEP-CHEAP))
(589 589 (:REWRITE USE-ALL-CONSP-2))
(589 589 (:REWRITE USE-ALL-CONSP))
(589 589 (:REWRITE CONSP-WHEN-LEN-GREATER))
(454 454 (:TYPE-PRESCRIPTION PSEUDO-DAGP))
(454 227
(:REWRITE CONSP-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(428 428 (:TYPE-PRESCRIPTION AXE-TREEP))
(412 62 (:REWRITE ALL-DARGP-OF-CDR))
(403 403 (:REWRITE DEFAULT-+-1))
(390 390
(:REWRITE ALL-CONSP-WHEN-NOT-CONSP-CHEAP))
(380 190
(:REWRITE SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-ALISTP-CHEAP))
(376 7
(:REWRITE UNIFY-TREE-WITH-DAG-NODE-MONO2))
(356 178
(:REWRITE ALL-NATP-WHEN-NAT-LISTP-CHEAP))
(338 324
(:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(338 324
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH))
(325 325
(:REWRITE TERM-LISTP-IMPLIES-PSEUDO-TERM-LISTP))
(324 324 (:TYPE-PRESCRIPTION NATP))
(320 160
(:REWRITE ALL-DARGP-WHEN-ALL-MYQUOTEP-CHEAP))
(316 316
(:REWRITE SYMBOLP-WHEN-BOUNDED-DAG-EXPRP))
(313 313
(:REWRITE TERMP-IMPLIES-PSEUDO-TERMP))
(307 307
(:REWRITE SYMBOLP-OF-CAR-WHEN-BOUNDED-DAG-EXPRP))
(265 265
(:REWRITE CONSP-OF-CDR-WHEN-LEN-KNOWN))
(252 252 (:TYPE-PRESCRIPTION ALL-<))
(231 231 (:REWRITE USE-ALL-NATP-2))
(231 231 (:REWRITE USE-ALL-NATP))
(231 231
(:REWRITE NATP-WHEN-ALL-DARGP-LESS-THAN-GEN))
(227 227
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(227 227
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX-2))
(227 227
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(223 223
(:REWRITE TRUE-LISTP-WHEN-PSEUDO-DAGP-AUX))
(222 25 (:REWRITE USE-ALL-DARGP-FOR-CAR))
(213 53
(:REWRITE SUBSETP-EQUAL-TRANSITIVE-ALT))
(212 106
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-NATP-CHEAP))
(212 106
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-INTEGERP-CHEAP))
(185 185 (:TYPE-PRESCRIPTION TRUE-LISTP))
(178 178
(:REWRITE ALL-NATP-WHEN-NOT-CONSP-CHEAP))
(178 178 (:REWRITE ALL-NATP-WHEN-NOT-CONSP))
(174 6 (:DEFINITION BINARY-APPEND))
(169 169
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-ALL-DARGP-LESS-THAN))
(164 82
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1))
(160 160 (:TYPE-PRESCRIPTION ALL-MYQUOTEP))
(160 160
(:REWRITE ALL-DARGP-WHEN-ALL-DARGP-LESS-THAN))
(157 157
(:REWRITE LEN-OF-CDDR-WHEN-EQUAL-OF-LEN))
(147 147
(:TYPE-PRESCRIPTION TYPE-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(144 144
(:REWRITE QUOTE-LEMMA-FOR-ALL-DARGP-LESS-THAN-GEN-ALT))
(135 135
(:REWRITE EQUAL-OF-NON-NATP-AND-CAAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(126 126
(:REWRITE ALL-<-WHEN-NOT-CONSP-CHEAP))
(126 126 (:REWRITE ALL-<-WHEN-NOT-CONSP))
(126 126 (:REWRITE ALL-<-TRANSITIVE-FREE-2))
(126 126 (:REWRITE ALL-<-TRANSITIVE-FREE))
(126 126 (:REWRITE ALL-<-TRANSITIVE))
(118 118
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP-AUX))
(116 29
(:REWRITE AREF1-WHEN-TOO-LARGE-CHEAP))
(107 107
(:REWRITE INTEGERP-WHEN-DARGP-LESS-THAN))
(106 106 (:TYPE-PRESCRIPTION ALL-INTEGERP))
(106 106
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-DARGP-LESS-THAN))
(99 99 (:REWRITE DEFAULT-COERCE-2))
(99 99 (:REWRITE DEFAULT-COERCE-1))
(94 26 (:REWRITE FOLD-CONSTS-IN-+))
(89 89 (:REWRITE USE-ALL-<=-2))
(89 89 (:REWRITE USE-ALL-<=))
(89 89
(:REWRITE NONNEG-WHEN-DARGP-LESS-THAN))
(88 88
(:REWRITE NOT-<-OF-CAR-WHEN-ALL-DARGP-LESS-THAN-2))
(88 48
(:REWRITE DARGP-WHEN-EQUAL-OF-QUOTE-AND-CAR-CHEAP))
(82 82
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(80 40
(:REWRITE SUBSETP-EQUAL-WHEN-SUBSETP-EQUAL-OF-CDR-CHEAP))
(70 35
(:REWRITE SUBSETP-EQUAL-WHEN-NOT-CONSP-ARG2-CHEAP))
(70 35
(:REWRITE SUBSETP-EQUAL-WHEN-NOT-CONSP-ARG1-CHEAP))
(58 29 (:TYPE-PRESCRIPTION ALEN1-TYPE))
(52 26
(:REWRITE SYMBOL-ALISTP-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(50 10
(:REWRITE CAR-OF-DARGS-BECOMES-NTH-0-OF-DARGS))
(49 49
(:REWRITE MYQUOTEP-WHEN-DARGP-LESS-THAN))
(49 49
(:REWRITE MYQUOTEP-WHEN-BOUNDED-DAG-EXPRP))
(49 49 (:REWRITE MYQUOTEP-WHEN-AXE-TREEP))
(48 48 (:TYPE-PRESCRIPTION DARGP))
(48 48 (:REWRITE USE-ALL-DARGP-2))
(48 48 (:REWRITE USE-ALL-DARGP))
(48 48
(:REWRITE DARGP-WHEN-DARGP-LESS-THAN))
(44 22 (:REWRITE DARGP-WHEN-MYQUOTEP-CHEAP))
(42 22 (:REWRITE DARGP-WHEN-NATP-CHEAP))
(41 41 (:TYPE-PRESCRIPTION TREE-VARS))
(40 20
(:TYPE-PRESCRIPTION
TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-SIMPLE))
(40 20
(:TYPE-PRESCRIPTION
TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX-SIMPLE))
(40 5 (:DEFINITION NTH))
(36 15
(:REWRITE LEN-OF-AREF1-WHEN-QUOTEP-AND-PSEUDO-DAG-ARRAYP-AUX))
(29 29 (:TYPE-PRESCRIPTION POSP-OF-ALEN1))
(29 29 (:TYPE-PRESCRIPTION ARRAY1P))
(28 28
(:TYPE-PRESCRIPTION SYMBOLP-OF-NTH-0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(22 22 (:TYPE-PRESCRIPTION MYQUOTEP))
(20
20
(:TYPE-PRESCRIPTION TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(20 20 (:TYPE-PRESCRIPTION TREE-VARS-LST))
(20 20
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP))
(20 10
(:REWRITE IFF-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(19 19
(:REWRITE ASSOC-EQUAL-WHEN-PSEUDO-DAGP-AUX))
(19 1 (:LINEAR LEN-OF-CDR-LINEAR-STRONG))
(17 1 (:LINEAR LEN-OF-CDR-LINEAR))
(15 15 (:REWRITE NTH-WHEN-NOT-CDDR))
(11 11
(:REWRITE MEMBER-EQUAL-WHEN-SUBSETP-EQUAL-1))
(4 1
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-WHEN-PSEUDO-DAGP-AUX))
(2 2 (:TYPE-PRESCRIPTION PSEUDO-DAGP-AUX))
(2 1
(:REWRITE SUBSETP-EQUAL-OF-REMOVE-EQUAL-ARG2-IRREL-CHEAP))
(1 1
(:REWRITE PSEUDO-DAGP-AUX-WHEN-NOT-CONSP-CHEAP))
(1 1
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-MONOTONE)))
(UNIFY-TREE-WITH-DAG-NODE-BINDS-ALL-VARS)
(UNIFY-TREES-WITH-DAG-NODES-BINDS-ALL-VARS)
(FLAG-LEMMA-FOR-ALL-DARGP-OF-STRIP-CDRS-OF-MV-NTH-1-OF-UNIFY-TREE-WITH-DAG-NODE
(43423 284
(:REWRITE ALL-AXE-TREEP-WHEN-PSEUDO-TERM-LISTP))
(41926 371 (:DEFINITION PSEUDO-TERM-LISTP))
(29736 162 (:REWRITE AXE-TREEP-WHEN-DARGP))
(25020 341 (:DEFINITION SYMBOL-LISTP))
(22709 548 (:DEFINITION NAT-LISTP))
(17863 293 (:REWRITE USE-ALL-<-FOR-CAR))
(17002 610 (:REWRITE ALL-NATP-WHEN-NAT-LISTP))
(15832 763 (:REWRITE USE-ALL-NATP-FOR-CAR))
(12619 6979 (:REWRITE DEFAULT-CAR))
(11759 678 (:REWRITE USE-ALL-CONSP-FOR-CAR))
(10437 6014 (:REWRITE DEFAULT-CDR))
(9612 894 (:DEFINITION LENGTH))
(9154 4577
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-TERM-ALISTP))
(9054 547 (:REWRITE ALL-DARGP-WHEN-NOT-CONSP))
(7852 7693
(:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(7693 7693
(:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(7693 7693
(:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(7693 7693
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(7669 419
(:REWRITE ALL-<-OF-0-WHEN-NAT-LISTP))
(7131 1157
(:REWRITE ALL-CONSP-WHEN-NOT-CONSP))
(6814 419 (:REWRITE ALL-<-OF-0-WHEN-ALL-NATP))
(5257 5257
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(4827 163 (:REWRITE ALL-NATP-OF-CDR))
(3864 132 (:REWRITE ALL-<-OF-CDR))
(3643 1988 (:REWRITE DEFAULT-<-2))
(3295 3295 (:TYPE-PRESCRIPTION NAT-LISTP))
(2982 479 (:REWRITE ALL-CONSP-OF-CDR))
(2909 2909
(:REWRITE CAR-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(2581 1313 (:REWRITE DEFAULT-+-2))
(2388 2388
(:TYPE-PRESCRIPTION PSEUDO-TERM-LISTP))
(2314 2314 (:TYPE-PRESCRIPTION ALL-CONSP))
(2284 2284 (:TYPE-PRESCRIPTION ALL-NATP))
(2080 1040
(:REWRITE PSEUDO-TERM-LISTP-WHEN-SYMBOL-LISTP-CHEAP))
(2034 678
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP))
(1990 1990
(:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(1990 1990
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(1988 1988 (:REWRITE USE-ALL-<-2))
(1988 1988 (:REWRITE USE-ALL-<))
(1988 1988 (:REWRITE DEFAULT-<-1))
(1946 939
(:REWRITE SYMBOLP-OF-CAR-WHEN-AXE-TREEP-CHEAP))
(1788 1788 (:REWRITE USE-ALL-CONSP-2))
(1788 1788 (:REWRITE USE-ALL-CONSP))
(1788 1788 (:REWRITE CONSP-WHEN-LEN-GREATER))
(1356 1356 (:TYPE-PRESCRIPTION PSEUDO-DAGP))
(1356 678
(:REWRITE CONSP-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(1313 1313 (:REWRITE DEFAULT-+-1))
(1254 627 (:TYPE-PRESCRIPTION ALEN1-TYPE))
(1227 1227 (:TYPE-PRESCRIPTION AXE-TREEP))
(1220 610
(:REWRITE ALL-NATP-WHEN-NAT-LISTP-CHEAP))
(1157 1157
(:REWRITE ALL-CONSP-WHEN-NOT-CONSP-CHEAP))
(1150 575
(:REWRITE SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-ALISTP-CHEAP))
(1127 49 (:REWRITE CONSP-OF-STRIP-CDRS))
(1114 557
(:REWRITE ALL-DARGP-WHEN-ALL-MYQUOTEP-CHEAP))
(1068 939
(:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(1068 939
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH))
(1040 1040
(:REWRITE TERM-LISTP-IMPLIES-PSEUDO-TERM-LISTP))
(1021 1021 (:TYPE-PRESCRIPTION ALL-MYQUOTEP))
(969 969
(:REWRITE TERMP-IMPLIES-PSEUDO-TERMP))
(948 474
(:TYPE-PRESCRIPTION NATP-OF-LARGEST-NON-QUOTEP))
(938 938
(:REWRITE SYMBOLP-WHEN-BOUNDED-DAG-EXPRP))
(935 935
(:REWRITE SYMBOLP-OF-CAR-WHEN-BOUNDED-DAG-EXPRP))
(864 864
(:REWRITE CONSP-OF-CDR-WHEN-LEN-KNOWN))
(850 850 (:TYPE-PRESCRIPTION ALL-<))
(794 794
(:REWRITE NATP-WHEN-ALL-DARGP-LESS-THAN-GEN))
(788 788 (:REWRITE USE-ALL-NATP-2))
(788 788 (:REWRITE USE-ALL-NATP))
(778 610 (:REWRITE ALL-NATP-WHEN-NOT-CONSP))
(710 355
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-NATP-CHEAP))
(710 355
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-INTEGERP-CHEAP))
(678 678
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(678 678
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX-2))
(678 678
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(654 654
(:REWRITE TRUE-LISTP-WHEN-PSEUDO-DAGP-AUX))
(627 627 (:TYPE-PRESCRIPTION POSP-OF-ALEN1))
(627 627 (:TYPE-PRESCRIPTION ARRAY1P))
(610 610
(:REWRITE ALL-NATP-WHEN-NOT-CONSP-CHEAP))
(575 575 (:TYPE-PRESCRIPTION SYMBOL-ALISTP))
(557 557
(:REWRITE ALL-DARGP-WHEN-ALL-DARGP-LESS-THAN))
(553 553 (:TYPE-PRESCRIPTION TRUE-LISTP))
(510 255
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1))
(501 422 (:REWRITE ALL-<-WHEN-NOT-CONSP))
(489 489
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-ALL-DARGP-LESS-THAN))
(461 461
(:REWRITE LEN-OF-CDDR-WHEN-EQUAL-OF-LEN))
(455 455
(:REWRITE QUOTE-LEMMA-FOR-ALL-DARGP-LESS-THAN-GEN-ALT))
(436 436
(:TYPE-PRESCRIPTION TYPE-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(427 422
(:REWRITE ALL-<-WHEN-NOT-CONSP-CHEAP))
(425 425
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP-AUX))
(422 422 (:REWRITE ALL-<-TRANSITIVE-FREE-2))
(422 422 (:REWRITE ALL-<-TRANSITIVE-FREE))
(422 422 (:REWRITE ALL-<-TRANSITIVE))
(406 18
(:LINEAR <-OF-NTH-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-LINEAR))
(395 395
(:REWRITE EQUAL-OF-NON-NATP-AND-CAAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(382 148 (:REWRITE USE-ALL-DARGP))
(380 380
(:REWRITE INTEGERP-WHEN-DARGP-LESS-THAN))
(355 355 (:TYPE-PRESCRIPTION ALL-INTEGERP))
(355 355
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-DARGP-LESS-THAN))
(353 164
(:REWRITE AREF1-WHEN-TOO-LARGE-CHEAP))
(328 328 (:REWRITE USE-ALL-<=-2))
(328 328 (:REWRITE USE-ALL-<=))
(320 81 (:REWRITE FOLD-CONSTS-IN-+))
(318 318
(:REWRITE NONNEG-WHEN-DARGP-LESS-THAN))
(298 298 (:REWRITE DEFAULT-COERCE-2))
(298 298 (:REWRITE DEFAULT-COERCE-1))
(293 293
(:REWRITE NOT-<-OF-CAR-WHEN-ALL-DARGP-LESS-THAN-2))
(280 44
(:REWRITE CAR-OF-DARGS-BECOMES-NTH-0-OF-DARGS))
(258 146
(:REWRITE DARGP-WHEN-EQUAL-OF-QUOTE-AND-CAR-CHEAP))
(258 106
(:TYPE-PRESCRIPTION SYMBOLP-OF-NTH-0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(234 234 (:TYPE-PRESCRIPTION MEMBERP))
(185 145 (:REWRITE NTH-WHEN-NOT-CDDR))
(168 42
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-WHEN-PSEUDO-DAGP-AUX))
(152 1
(:REWRITE ALL-DARGP-OF-DARGS-WHEN-DAG-EXPRP0))
(148 148 (:REWRITE USE-ALL-DARGP-2))
(148 148
(:REWRITE DARGP-WHEN-DARGP-LESS-THAN))
(147 147
(:REWRITE MYQUOTEP-WHEN-DARGP-LESS-THAN))
(147 147
(:REWRITE MYQUOTEP-WHEN-BOUNDED-DAG-EXPRP))
(147 147 (:REWRITE MYQUOTEP-WHEN-AXE-TREEP))
(146 58
(:REWRITE LEN-OF-AREF1-WHEN-QUOTEP-AND-PSEUDO-DAG-ARRAYP-AUX))
(144 18
(:LINEAR NONNEG-OF-NTH-OF-DARGS-OF-AREF1))
(144 18
(:LINEAR <-OF-NTH-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(138 69 (:REWRITE DARGP-WHEN-MYQUOTEP-CHEAP))
(136 69 (:REWRITE DARGP-WHEN-NATP-CHEAP))
(133 2
(:REWRITE DAG-EXPRP0-OF-AREF1-WHEN-BOUNDED-DAG-EXPRP-OF-AREF1))
(114 1 (:DEFINITION BOUNDED-DAG-EXPRP))
(84 84 (:TYPE-PRESCRIPTION PSEUDO-DAGP-AUX))
(80 40
(:REWRITE LARGEST-NON-QUOTEP-WHEN-ALL-MYQUOTEP-CHEAP))
(80 3
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-ALL-<))
(70 70 (:TYPE-PRESCRIPTION MYQUOTEP))
(66 33
(:TYPE-PRESCRIPTION
TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX-SIMPLE))
(65
33
(:TYPE-PRESCRIPTION TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(48 12 (:REWRITE ZP-OPEN))
(42 42
(:REWRITE PSEUDO-DAGP-AUX-WHEN-NOT-CONSP-CHEAP))
(42 42
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-MONOTONE))
(26 3
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-NOT-CONSP))
(11 11 (:LINEAR <-OF-LARGEST-NON-QUOTEP))
(9 2
(:REWRITE DAG-EXPRP0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(8 3
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-NOT-CONSP-CHEAP))
(7 2
(:REWRITE DAG-EXPRP0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(6 6 (:REWRITE <-OF-+-OF-1-STRENGTHEN))
(6 3
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-ALL-MYQUOTEP-CHEAP))
(6 1
(:REWRITE BOUNDED-DAG-EXPRP-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(4 4 (:TYPE-PRESCRIPTION DAG-EXPRP0))
(4 4
(:TYPE-PRESCRIPTION BOUNDED-DAG-EXPRP))
(4 4
(:REWRITE ASSOC-EQUAL-WHEN-PSEUDO-DAGP-AUX))
(4 2
(:REWRITE IFF-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(3 3
(:REWRITE ALL-DARGP-LESS-THAN-MONOTONE))
(3 1
(:REWRITE RATIONALP-IMPLIES-ACL2-NUMBERP))
(2 2
(:REWRITE NOT-<-OF-+-1-AND-CAR-WHEN-ALL-<))
(2 2
(:REWRITE DAG-EXPRP0-WHEN-EQUAL-OF-QUOTE-AND-CAR-CHEAP))
(2 2
(:REWRITE DAG-EXPRP0-WHEN-BOUNDED-DAG-EXPRP))
(2 1
(:REWRITE BOUNDED-DAG-EXPRP-WHEN-MYQUOTEP-CHEAP))
(2 1
(:REWRITE ALL-DARGP-LESS-THAN-OF-DARGS-WHEN-BOUNDED-DAG-EXPRP))
(2 1
(:REWRITE ALL-DARGP-LESS-THAN-OF-DARGS-WHEN-<-SIMPLE))
(1 1 (:REWRITE USE-ALL-RATIONALP-2))
(1 1 (:REWRITE USE-ALL-RATIONALP))
(1 1
(:REWRITE BOUNDED-DAG-EXPRP-WHEN-SYMBOLP-CHEAP))
(1 1
(:REWRITE BOUNDED-DAG-EXPRP-WHEN-EQUAL-OF-QUOTE-AND-CAR-CHEAP))
(1 1
(:REWRITE BOUNDED-DAG-EXPRP-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-BETTER))
(1 1
(:REWRITE BOUNDED-DAG-EXPRP-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(1 1 (:REWRITE BOUNDED-DAG-EXPRP-MONOTONE))
(1 1
(:REWRITE ALL-DARGP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(1 1
(:REWRITE ALL-DARGP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(1 1
(:REWRITE ALL-DARGP-LESS-THAN-OF-DARGS-OF-AREF1)))
(ALL-DARGP-OF-STRIP-CDRS-OF-MV-NTH-1-OF-UNIFY-TREE-WITH-DAG-NODE)
(ALL-DARGP-OF-STRIP-CDRS-OF-MV-NTH-1-OF-UNIFY-TREES-WITH-DAG-NODES)
(FLAG-LEMMA-FOR-ALL-DARGP-LESS-THAN-OF-STRIP-CDRS-OF-MV-NTH-1-OF-UNIFY-TREE-WITH-DAG-NODE
(91916 271 (:REWRITE AXE-TREEP-WHEN-DARGP))
(78736 97 (:DEFINITION DARGP))
(69212 735 (:DEFINITION NAT-LISTP))
(56134 417 (:REWRITE USE-ALL-<-FOR-CAR))
(54720 488
(:REWRITE ALL-AXE-TREEP-WHEN-PSEUDO-TERM-LISTP))
(52719 627 (:DEFINITION PSEUDO-TERM-LISTP))
(45607 823 (:REWRITE ALL-NATP-WHEN-NAT-LISTP))
(44549 648
(:REWRITE QUOTE-LEMMA-FOR-ALL-DARGP-LESS-THAN-GEN-ALT))
(41255 12281 (:REWRITE DEFAULT-CDR))
(34466 2838 (:REWRITE CONSP-OF-STRIP-CDRS))
(33198 449 (:DEFINITION SYMBOL-LISTP))
(27356 930 (:REWRITE USE-ALL-NATP-FOR-CAR))
(26260 555
(:REWRITE ALL-<-OF-0-WHEN-NAT-LISTP))
(25697 555 (:REWRITE ALL-<-OF-0-WHEN-ALL-NATP))
(23069 1357 (:REWRITE CAR-OF-STRIP-CDRS))
(19914 12310 (:REWRITE DEFAULT-CAR))
(16416 253 (:REWRITE ALL-NATP-OF-CDR))
(15774 912 (:REWRITE USE-ALL-CONSP-FOR-CAR))
(15476 15233
(:REWRITE LEN-WHEN-NOT-CONSP-CHEAP))
(15252 15232
(:REWRITE LEN-WHEN-DARGP-LESS-THAN))
(15232 15232
(:REWRITE LEN-WHEN-PSEUDO-DAGP-AUX))
(15232 15232
(:REWRITE LEN-WHEN-BOUNDED-DAG-EXPRP-AND-QUOTEP))
(12715 1177 (:DEFINITION LENGTH))
(12604 6302
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-TERM-ALISTP))
(11572 204 (:REWRITE ALL-<-OF-CDR))
(10104 232 (:REWRITE DARGP-WHEN-CONSP-CHEAP))
(9487 1568
(:REWRITE ALL-CONSP-WHEN-NOT-CONSP))
(9012 671 (:REWRITE ALL-<-WHEN-NOT-CONSP))
(8237 4546 (:REWRITE DEFAULT-<-2))
(7810 865 (:REWRITE ALL-DARGP-WHEN-NOT-CONSP))
(7221 7221
(:TYPE-PRESCRIPTION SYMBOL-TERM-ALISTP))
(5368 4550
(:REWRITE <-WHEN-ALL-DARGP-LESS-THAN-GEN))
(5056 89
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-NOT-CONSP))
(4779 4546 (:REWRITE DEFAULT-<-1))
(4550 4550
(:REWRITE <-WHEN-BOUNDED-AXE-TREEP))
(4546 4546 (:REWRITE USE-ALL-<-2))
(4546 4546 (:REWRITE USE-ALL-<))
(4412 4412 (:TYPE-PRESCRIPTION NAT-LISTP))
(4387 4387 (:REWRITE USE-ALL-CONSP-2))
(4387 4387 (:REWRITE USE-ALL-CONSP))
(4387 4387 (:REWRITE CONSP-WHEN-LEN-GREATER))
(4276 4276
(:REWRITE MEMBER-EQUAL-WHEN-SUBSETP-EQUAL-2))
(4276 4276
(:REWRITE MEMBER-EQUAL-WHEN-SUBSETP-EQUAL-1))
(4147 671 (:REWRITE ALL-CONSP-OF-CDR))
(3924 2172 (:REWRITE DEFAULT-+-2))
(3905 3905
(:REWRITE CAR-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(3904 3904
(:TYPE-PRESCRIPTION PSEUDO-TERM-LISTP))
(3386 1693
(:REWRITE PSEUDO-TERM-LISTP-WHEN-SYMBOL-LISTP-CHEAP))
(3136 3136 (:TYPE-PRESCRIPTION ALL-CONSP))
(2902 2778
(:REWRITE <-OF-LEN-WHEN-NTH-NON-NIL))
(2902 2778
(:REWRITE <-OF-LEN-WHEN-INTEGERP-OF-NTH))
(2706 912
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP))
(2681 1195
(:REWRITE SYMBOLP-OF-CAR-WHEN-AXE-TREEP-CHEAP))
(2282 1141 (:TYPE-PRESCRIPTION ALEN1-TYPE))
(2172 2172 (:REWRITE DEFAULT-+-1))
(1852 926
(:TYPE-PRESCRIPTION NATP-OF-LARGEST-NON-QUOTEP))
(1824 912
(:REWRITE CONSP-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(1794 1794 (:TYPE-PRESCRIPTION PSEUDO-DAGP))
(1738 869
(:REWRITE ALL-DARGP-WHEN-ALL-MYQUOTEP-CHEAP))
(1693 1693
(:REWRITE TERM-LISTP-IMPLIES-PSEUDO-TERM-LISTP))
(1646 823
(:REWRITE ALL-NATP-WHEN-NAT-LISTP-CHEAP))
(1568 1568
(:REWRITE ALL-CONSP-WHEN-NOT-CONSP-CHEAP))
(1540 1540
(:REWRITE CONSP-OF-CDR-WHEN-LEN-KNOWN))
(1506 753
(:REWRITE SYMBOLP-OF-CAR-OF-CAR-WHEN-SYMBOL-ALISTP-CHEAP))
(1491 1491
(:REWRITE TERMP-IMPLIES-PSEUDO-TERMP))
(1194 1194
(:REWRITE SYMBOLP-WHEN-BOUNDED-DAG-EXPRP))
(1191 1191
(:REWRITE SYMBOLP-OF-CAR-WHEN-BOUNDED-DAG-EXPRP))
(1141 1141 (:TYPE-PRESCRIPTION POSP-OF-ALEN1))
(1141 1141 (:TYPE-PRESCRIPTION ARRAY1P))
(1080 117 (:REWRITE USE-ALL-DARGP-FOR-CAR))
(1045 1045 (:TYPE-PRESCRIPTION ALL-MYQUOTEP))
(1028 514
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-NATP-CHEAP))
(1028 514
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-INTEGERP-CHEAP))
(980 822 (:REWRITE ALL-NATP-WHEN-NOT-CONSP))
(971 672 (:REWRITE ALL-<-TRANSITIVE-FREE-2))
(959 959 (:REWRITE USE-ALL-NATP-2))
(959 959 (:REWRITE USE-ALL-NATP))
(912 912
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(912 912
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX-2))
(912 912
(:REWRITE CONSP-OF-CAR-WHEN-PSEUDO-DAGP-AUX))
(891 891
(:REWRITE TRUE-LISTP-WHEN-PSEUDO-DAGP-AUX))
(753 753 (:TYPE-PRESCRIPTION SYMBOL-ALISTP))
(672 672 (:REWRITE ALL-<-TRANSITIVE-FREE))
(672 672 (:REWRITE ALL-<-TRANSITIVE))
(653 653
(:REWRITE LEN-OF-CDDR-WHEN-EQUAL-OF-LEN))
(637 637
(:REWRITE TRUE-LISTP-OF-CAR-WHEN-ALL-DARGP-LESS-THAN))
(620 516
(:REWRITE INTEGERP-OF-CAR-WHEN-ALL-DARGP-LESS-THAN))
(596 298
(:TYPE-PRESCRIPTION SYMBOLP-OF-CAR-OF-AREF1))
(577 577
(:REWRITE INTEGERP-WHEN-DARGP-LESS-THAN))
(567 567
(:TYPE-PRESCRIPTION PSEUDO-DAG-ARRAYP-AUX))
(563 150 (:REWRITE FOLD-CONSTS-IN-+))
(530 3 (:REWRITE ALL-<-OF-CONS))
(514 514 (:TYPE-PRESCRIPTION ALL-INTEGERP))
(512 512
(:TYPE-PRESCRIPTION TYPE-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(500 500
(:REWRITE EQUAL-OF-NON-NATP-AND-CAAR-WHEN-WHEN-BOUNDED-NATP-ALISTP))
(494 22
(:LINEAR <-OF-NTH-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-LINEAR))
(478 478 (:REWRITE USE-ALL-<=-2))
(478 478 (:REWRITE USE-ALL-<=))
(452 452
(:REWRITE NONNEG-WHEN-DARGP-LESS-THAN))
(446 4 (:REWRITE <-OF-LARGEST-NON-QUOTEP))
(422 232
(:REWRITE DARGP-WHEN-EQUAL-OF-QUOTE-AND-CAR-CHEAP))
(417 417
(:REWRITE NOT-<-OF-CAR-WHEN-ALL-DARGP-LESS-THAN-2))
(407 197
(:REWRITE AREF1-WHEN-TOO-LARGE-CHEAP))
(391 391 (:REWRITE DEFAULT-COERCE-2))
(391 391 (:REWRITE DEFAULT-COERCE-1))
(310 50
(:REWRITE CAR-OF-DARGS-BECOMES-NTH-0-OF-DARGS))
(280 2 (:DEFINITION BOUNDED-DAG-EXPRP))
(248 128
(:TYPE-PRESCRIPTION SYMBOLP-OF-NTH-0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(235 235
(:REWRITE MYQUOTEP-WHEN-DARGP-LESS-THAN))
(235 235
(:REWRITE MYQUOTEP-WHEN-BOUNDED-DAG-EXPRP))
(235 235 (:REWRITE MYQUOTEP-WHEN-AXE-TREEP))
(232 232 (:REWRITE USE-ALL-DARGP-2))
(232 232 (:REWRITE USE-ALL-DARGP))
(224 176 (:REWRITE NTH-WHEN-NOT-CDDR))
(220 110
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-ALL-MYQUOTEP-CHEAP))
(206 103
(:TYPE-PRESCRIPTION
TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX-SIMPLE))
(204 51
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-WHEN-PSEUDO-DAGP-AUX))
(194 97 (:REWRITE DARGP-WHEN-MYQUOTEP-CHEAP))
(176 22
(:LINEAR NONNEG-OF-NTH-OF-DARGS-OF-AREF1))
(176 22
(:LINEAR <-OF-NTH-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(168 69
(:REWRITE LEN-OF-AREF1-WHEN-QUOTEP-AND-PSEUDO-DAG-ARRAYP-AUX))
(162 89
(:REWRITE ALL-DARGP-LESS-THAN-WHEN-NOT-CONSP-CHEAP))
(155 3
(:REWRITE ALL-DARGP-LESS-THAN-OF-DARGS-WHEN-<-SIMPLE))
(150 3
(:REWRITE ALL-DARGP-LESS-THAN-OF-DARGS-WHEN-BOUNDED-DAG-EXPRP))
(139
103
(:TYPE-PRESCRIPTION TRUE-LISTP-OF-DARGS-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(132 66
(:REWRITE LARGEST-NON-QUOTEP-WHEN-ALL-MYQUOTEP-CHEAP))
(114 114 (:TYPE-PRESCRIPTION MYQUOTEP))
(102 102
(:TYPE-PRESCRIPTION PSEUDO-DAGP-AUX))
(89 13
(:REWRITE RATIONALP-IMPLIES-ACL2-NUMBERP))
(51 51
(:REWRITE PSEUDO-DAGP-AUX-WHEN-NOT-CONSP-CHEAP))
(51 51
(:REWRITE PSEUDO-DAG-ARRAYP-AUX-MONOTONE))
(50 10 (:REWRITE USE-ALL-RATIONALP-FOR-CAR))
(48 12 (:REWRITE ZP-OPEN))
(32 2
(:REWRITE DAG-EXPRP0-OF-AREF1-WHEN-BOUNDED-DAG-EXPRP-OF-AREF1))
(26 13
(:REWRITE DARGP-LESS-THAN-WHEN-MYQUOTEP-CHEAP))
(23 12
(:REWRITE DARGP-LESS-THAN-WHEN-NATP-CHEAP))
(21 13 (:REWRITE USE-ALL-DARGP-LESS-THAN))
(20 20 (:TYPE-PRESCRIPTION ALL-RATIONALP))
(16 2
(:REWRITE DAG-EXPRP0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX))
(14 14
(:REWRITE ASSOC-EQUAL-WHEN-PSEUDO-DAGP-AUX))
(14 7
(:REWRITE IFF-OF-CAR-WHEN-SYMBOL-TERM-ALISTP-CHEAP))
(13 13 (:REWRITE USE-ALL-RATIONALP-2))
(13 13 (:REWRITE USE-ALL-RATIONALP))
(13 13 (:REWRITE USE-ALL-DARGP-LESS-THAN-2))
(13 13
(:REWRITE DARGP-LESS-THAN-WHEN-EQUAL-OF-NTH-0-AND-QUOTE))
(13 13
(:REWRITE DARGP-LESS-THAN-WHEN-EQUAL-OF-CAR-AND-QUOTE))
(12 12
(:TYPE-PRESCRIPTION BOUNDED-DAG-EXPRP))
(12 12
(:REWRITE DARGP-LESS-THAN-WHEN-QUOTEP-CHEAP))
(12 2
(:REWRITE DAG-EXPRP0-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(10 10
(:REWRITE ALL-RATIONALP-WHEN-NOT-CONSP-CHEAP))
(10 10
(:REWRITE ALL-RATIONALP-WHEN-NOT-CONSP))
(9 4
(:REWRITE BOUNDED-DAG-EXPRP-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP))
(8 8 (:TYPE-PRESCRIPTION MEMBERP))
(8 4
(:REWRITE BOUNDED-DAG-EXPRP-WHEN-MYQUOTEP-CHEAP))
(7 7 (:REWRITE <-OF-+-OF-1-STRENGTHEN))
(4 4 (:TYPE-PRESCRIPTION DAG-EXPRP0))
(4 4
(:REWRITE BOUNDED-DAG-EXPRP-WHEN-SYMBOLP-CHEAP))
(4 4
(:REWRITE BOUNDED-DAG-EXPRP-WHEN-EQUAL-OF-QUOTE-AND-CAR-CHEAP))
(4 4 (:REWRITE BOUNDED-DAG-EXPRP-MONOTONE))
(3 3
(:REWRITE ALL-DARGP-LESS-THAN-OF-DARGS-OF-AREF1))
(2 2
(:REWRITE NOT-<-OF-+-1-AND-CAR-WHEN-ALL-<))
(2 2
(:REWRITE DAG-EXPRP0-WHEN-EQUAL-OF-QUOTE-AND-CAR-CHEAP))
(2 2
(:REWRITE DAG-EXPRP0-WHEN-BOUNDED-DAG-EXPRP))
(2 2
(:REWRITE BOUNDED-DAG-EXPRP-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-BETTER))
(2 2
(:REWRITE BOUNDED-DAG-EXPRP-OF-AREF1-WHEN-PSEUDO-DAG-ARRAYP-AUX)))
(ALL-DARGP-LESS-THAN-OF-STRIP-CDRS-OF-MV-NTH-1-OF-UNIFY-TREE-WITH-DAG-NODE)
(ALL-DARGP-LESS-THAN-OF-STRIP-CDRS-OF-MV-NTH-1-OF-UNIFY-TREES-WITH-DAG-NODES)
|
package package1;
import package2.*;
public class B {
private String privateMessage = "This is private";
}
|
; FILE *_fmemopen__callee(void **bufp, size_t *sizep, const char *mode)
SECTION code_clib
SECTION code_stdio
PUBLIC __fmemopen__callee, l0__fmemopen__callee
EXTERN asm__fmemopen
__fmemopen__callee:
pop af
pop hl
pop bc
pop de
push af
l0__fmemopen__callee:
ld a,$0c
push ix
call asm__fmemopen
pop ix
ret
|
#!/bin/bash
set -eo pipefail
CDIR="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
INPUT_DIR=/input
OUTPUT_DIR=/output
#TA1_RUNTIME=/user_opt/ta1-pipeline
TA1_RUNTIME=$CDIR/ta1-pipeline
#BBN_PIPELINE=$(find $CDIR/ | grep -e "pipeline.*json$" | head -1)
if [ "x$BBN_PIPELINE" == "x" ]; then
echo "No pipeline available" > /dev/stderr
exit 1
fi
#clean up the output area
cd $OUTPUT_DIR
rm -rf *
#require directories for submission
PIPELINES=$OUTPUT_DIR/pipelines
EXECUTABLES=$OUTPUT_DIR/executables
SUPPORTING_FILES=$OUTPUT_DIR/supporting_files
PREDICTIONS=$OUTPUT_DIR/predictions
#workdir
WORKDIR=$OUTPUT_DIR/workdir
OUT_PIPELINE_ID="d3m_$(basename $BBN_PIPELINE | sed 's@.json$@@')"
for d in $PIPELINES $EXECUTABLES $SUPPORTING_FILES $PREDICTIONS $WORKDIR; do
mkdir -p $d
done
cat << EOF > $WORKDIR/ta1-pipeline-config.json
{
"train_data":"$INPUT_DIR/TRAIN",
"test_data":"$INPUT_DIR/TEST",
"output_folder":"$PREDICTIONS/$OUT_PIPELINE_ID"
}
EOF
#execute ta1-pipeline code to generate submission product
OUT_D3M_PIPELINE=$PIPELINES/$OUT_PIPELINE_ID.json
python3.6 $TA1_RUNTIME \
--ta1_config $WORKDIR/ta1-pipeline-config.json \
--pipeline $BBN_PIPELINE \
--d3m_pipeline_outfn $OUT_D3M_PIPELINE
D3M_PIPELINE_ID=$(python3.6 $CDIR/parse-json.py $OUT_D3M_PIPELINE 'id')
OUT_D3M_PIPELINE2="$(dirname $OUT_D3M_PIPELINE)/$D3M_PIPELINE_ID.json"
mv $OUT_D3M_PIPELINE $OUT_D3M_PIPELINE2
OUT_PIPELINE_ID=$D3M_PIPELINE_ID
mkdir -p $SUPPORTING_FILES/$OUT_PIPELINE_ID $PREDICTIONS/$OUT_PIPELINE_ID
OUT_SUPPORTING_FILES=$SUPPORTING_FILES/$OUT_PIPELINE_ID
OUT_EXECUTABLE=$EXECUTABLES/$OUT_PIPELINE_ID.sh
cp $TA1_RUNTIME $SUPPORTING_FILES/$OUT_PIPELINE_ID/
cp $BBN_PIPELINE $SUPPORTING_FILES/$OUT_PIPELINE_ID/
cat << EOF > $OUT_EXECUTABLE
#!/bin/bash
CDIR="\$( cd "\$(dirname "\${BASH_SOURCE[0]}" )" && pwd )"
python3.6 \$CDIR/../supporting_files/$OUT_PIPELINE_ID/ta1-pipeline \\
--ta1_config \$1 \\
--pipeline \$CDIR/../supporting_files/$OUT_PIPELINE_ID/$(basename $BBN_PIPELINE) \\
--disable_d3m_pipeline_creation
EOF
chmod a+x $OUT_EXECUTABLE
|
/**
* Clone and Bind context to each object value
*
* @param {Object} obj
* @param {Mixed} ctx
* @return {Object}
*/
module.exports = function bindEach(src, ctx) {
const obj = {};
Object.keys(src).forEach(key => {
obj[key] = src[key].bind(ctx);
});
return obj;
};
|
#!/bin/bash
#
# BASH script to quickly split a YCB object directory tree into a train and validation
# sets.
#
# Arguments: object_dir_YCB target_dir
#
# object_dir_ycb: directory where the YCB object lies. Assumes object directories
# have names in the form xxx_object_name_directory
# target_dir: where to put the extracted files
mkdir $2
mkdir $2/train
mkdir $2/val
for object_dir in ${1%/}/*
do
object_name=${object_dir##*/}
object_name=${object_name:4}
echo "Creating training set for $object_name"
mkdir $2/train/$object_name
for angle in {0..357..9}
do
cp $object_dir/*_"$angle".jpg $2/train/$object_name
cp $object_dir/masks/*_"$angle"_mask.pbm $2/train/$object_name
rename 's/_mask//' $2/train/$object_name/*.pbm
done
echo "Creating validation set for $object_name"
mkdir $2/val/$object_name
for angle in {0..357..30}
do
cp $object_dir/*_"$angle".jpg $2/val/$object_name
cp $object_dir/masks/*_"$angle"_mask.pbm $2/val/$object_name
rename 's/_mask//' $2/val/$object_name/*.pbm
done
done
|
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstore) {
root.SwaggerPetstore = {};
}
root.SwaggerPetstore.EnumClass = factory(root.SwaggerPetstore.ApiClient);
}
}(this, function(ApiClient) {
'use strict';
/**
* Enum class EnumClass.
* @enum {}
* @readonly
*/
var exports = {
/**
* value: "_abc"
* @const
*/
"_abc": "_abc",
/**
* value: "-efg"
* @const
*/
"-efg": "-efg",
/**
* value: "(xyz)"
* @const
*/
"(xyz)": "(xyz)" };
return exports;
}));
|
/*
* Copyright 2007 Hilbrand Bouwkamp, hs@bouwkamp.com
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.emultest.client;
import com.google.gwt.junit.client.GWTTestCase;
import java.sql.Time;
// If class is named TimeTestCase the test fails...
/**
* Unit test for java.sql.Date GWT emulation class
*
*/
@SuppressWarnings("deprecation")
public class TimeTestCase extends GWTTestCase {
/* (non-Javadoc)
* @see com.google.gwt.junit.client.GWTTestCase#getModuleName()
*/
public String getModuleName() {
return "com.google.gwt.emultest.Emul";
}
/**
* test {@link Time#valueOf(String)}
*/
public void testValueOf1() {
final Time t1 = Time.valueOf("23:40:20");
assertEquals(23, t1.getHours());
assertEquals(40, t1.getMinutes());
assertEquals(20, t1.getSeconds());
assertEquals(81620000L, t1.getTime());
}
public void testValueOf2() {
final Time t2 = Time.valueOf("1:2:3");
assertEquals(1, t2.getHours());
assertEquals(2, t2.getMinutes());
assertEquals(3, t2.getSeconds());
assertEquals(123000L, t2.getTime());
}
public void testValueOf2a() {
final Time t2 = Time.valueOf("09:09:09");
assertEquals(9, t2.getHours());
assertEquals(9, t2.getMinutes());
assertEquals(9, t2.getSeconds());
assertEquals(29349000L, t2.getTime());
}
public void testValueOf3() {
try {
final Time t3 = Time.valueOf("23:10x20");
throw new AssertionError("Invalid time: 23:10x20, got:" + t3);
} catch (Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
}
public void testValueOf3a() {
final String[] time = { "09", ":", "09", ":"};
String tst = "";
for (int i = 0; i < time.length; i++) {
tst += time[i];
try {
final Time t3 = Time.valueOf(tst);
throw new AssertionError("Invalid time: " + tst + ", got:" + t3);
} catch (Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
}
}
public void testValueOf4() {
try {
final Time t4 = Time.valueOf("23:xx:20");
throw new AssertionError("Invalid time: 23:xx:20, got:" + t4);
} catch (Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
}
/**
* test {@link Time#Time(long)}
*/
public void testTime1() {
final Time t1 = new Time(1234567890123L);
assertEquals(1234567890123L, t1.getTime());
}
/**
* test {@link Time#Time(int, int, int)}
*/
public void testTime2() {
final Time t2 = new Time(23, 59, 0);
assertEquals("23:59:00", t2.toString());
assertEquals(23, t2.getHours());
assertEquals(59, t2.getMinutes());
assertEquals(0, t2.getSeconds());
assertEquals(82740000L, t2.getTime());
}
/**
* test {@link Time#setTime(long)}
*/
public void testSetTime() {
final Time t1 = new Time(0);
t1.setTime(1234567890123L);
assertEquals(1234567890123L, t1.getTime());
}
/**
* test {@link Time#toString()}
*/
public void testToString1() {
final Time t1 = new Time(23, 40, 20);
assertEquals("23:40:20", t1.toString());
}
public void testToString2() {
final Time t2 = new Time(1, 2, 3);
assertEquals("01:02:03", t2.toString());
}
public void testToString3() {
final Time t3 = new Time(13, 2, 3);
assertEquals("13:02:03", t3.toString());
}
}
|
using System;
using System.Text.Json;
using MediatR;
using Microsoft.AspNetCore.Mvc;
namespace AspNetCoreWorkshop.Api.Jobs.UpdateJob
{
public class UpdateJobRequest : IRequest<Func<ControllerBase, IActionResult>>
{
public UpdateJobRequest(int id, JsonElement data)
{
Id = id;
Data = data;
}
public int Id { get; }
public JsonElement Data { get; }
}
}
|
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Tempo de geração: 10-Jun-2019 às 19:20
-- Versão do servidor: 10.3.15-MariaDB
-- versão do PHP: 7.2.19
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Banco de dados: `ec021_av2_musicfy`
--
DROP DATABASE IF EXISTS `ec021_av2_musicfy`;
CREATE DATABASE IF NOT EXISTS `ec021_av2_musicfy` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `ec021_av2_musicfy`;
-- --------------------------------------------------------
--
-- Estrutura da tabela `genero`
--
DROP TABLE IF EXISTS `genero`;
CREATE TABLE `genero` (
`genero_id` int(11) NOT NULL,
`descricao` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `genero`
--
INSERT INTO `genero` (`genero_id`, `descricao`) VALUES
(1, 'Rock'),
(2, 'Sertanejo'),
(3, 'MPB'),
(4, 'Pop Rock');
-- --------------------------------------------------------
--
-- Estrutura da tabela `musica`
--
DROP TABLE IF EXISTS `musica`;
CREATE TABLE `musica` (
`musica_id` int(11) NOT NULL,
`titulo` text NOT NULL,
`artista` text NOT NULL,
`genero_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `musica`
--
INSERT INTO `musica` (`musica_id`, `titulo`, `artista`, `genero_id`) VALUES
(1, 'Tempo Perdido', 'Legião Urbana', 1),
(2, 'Céu Azul', 'Charlie Brown Jr.', 1),
(3, 'Pais e Filhos', 'Legião Urbana', 1),
(4, 'Só Hoje', 'Jota Quest', 1),
(5, 'Só Os Loucos Sabem', 'Charlie Brown Jr.', 1),
(6, 'Bohemian Rhapsody', 'Queen', 1),
(7, 'Love of My Life', 'Queen', 1),
(8, 'Primeiros Erros', 'Capital Inicial', 1),
(9, 'Sweet Child O\' Mine', 'Guns N\' Roses', 1),
(10, 'Wish You Were Here', 'Pink Floyd', 1),
(11, 'Evidências', 'Chitãozinho & Xororó', 2),
(12, 'Notificação Preferida', 'Zé Neto e Cristiano', 2),
(13, 'Todo Mundo Vai Sofrer', 'Marília Mendonça', 2),
(14, 'Boate Azul', 'Bruno e Marrone', 2),
(15, 'Largado Às Traças', 'Zé Neto e Cristiano', 2),
(16, 'Cem Mil', 'Gusttavo Lima', 2),
(17, 'Cobaia (part. Maiara e Maraisa)', 'Lauana Prado', 2),
(18, 'Estado Decadente', 'Zé Neto e Cristiano', 2),
(19, 'Na Hora de Amar', 'Gusttavo Lima', 2),
(20, 'Solteiro Não Trai', 'Gustavo Mioto', 2),
(21, 'Trem-Bala', 'Ana Vilela', 3),
(22, 'Velha Infância', 'Tribalistas', 3),
(23, 'Sozinho', 'Caetano Veloso', 3),
(24, 'Chão de Giz', 'Zé Ramalho', 3),
(25, 'Anunciação', 'Alceu Valença', 3),
(26, 'Asa Branca', 'Luiz Gonzaga', 3),
(27, 'Gostava Tanto de Você', 'Tim Maia', 3),
(28, 'Eu Te Devoro', 'Djavan', 3),
(29, 'Sinônimo', 'Zé Ramalho', 3),
(30, 'La Belle De Jour', 'Alceu Valença', 3),
(31, 'Zombie', 'The Cranberries', 4),
(32, 'Lost on You', 'LP', 4),
(33, 'Iris', 'Goo Goo Dolls', 4),
(34, 'With Or Without You', 'U2', 4),
(35, 'Counting Stars', 'OneRepublic', 4),
(36, 'La Flaca', 'Jarabe De Palo', 4),
(37, 'Linger', 'The Cranberries', 4),
(38, 'De Musica Ligera', 'Soda Stereo', 4),
(39, 'The Only Exception', 'Paramore', 4),
(40, 'Flaca', 'Andrés Calamaro', 4);
--
-- Índices para tabelas despejadas
--
--
-- Índices para tabela `genero`
--
ALTER TABLE `genero`
ADD PRIMARY KEY (`genero_id`);
--
-- Índices para tabela `musica`
--
ALTER TABLE `musica`
ADD PRIMARY KEY (`musica_id`),
ADD KEY `genero_fk` (`genero_id`);
--
-- AUTO_INCREMENT de tabelas despejadas
--
--
-- AUTO_INCREMENT de tabela `genero`
--
ALTER TABLE `genero`
MODIFY `genero_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de tabela `musica`
--
ALTER TABLE `musica`
MODIFY `musica_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;
--
-- Restrições para despejos de tabelas
--
--
-- Limitadores para a tabela `musica`
--
ALTER TABLE `musica`
ADD CONSTRAINT `genero_fk` FOREIGN KEY (`genero_id`) REFERENCES `genero` (`genero_id`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
val instructions: List<Instruction> by lazy {
readFile("ALU").split("\n").map { l ->
l.split(" ").let { if (it.size == 2) Instruction(it[0], it[1], "") else Instruction(it[0], it[1], it[2]) }
}
}
val mapVarToInd = mapOf(
"w" to 0,
"x" to 1,
"y" to 2,
"z" to 3
)
val variables = IntArray(4)
fun main() {
// https://github.com/dphilipson/advent-of-code-2021/blob/master/src/days/day24.rs
// max = 99999795919456
// min = 45311191516111
val input = "45311191516111".map { it.digitToInt() }
var inputIndex = 0
instructions.forEach { i ->
val varIndex = mapVarToInd[i.arg1]!!
when (i.op) {
"inp" -> {
variables[varIndex] = input[inputIndex]
inputIndex++
}
"add" -> {
variables[varIndex] = calculate(variables[varIndex], i.arg2) { a, b -> a + b }
}
"mul" -> {
variables[varIndex] = calculate(variables[varIndex], i.arg2) { a, b -> a * b }
}
"div" -> {
variables[varIndex] = calculate(variables[varIndex], i.arg2) { a, b -> a / b }
}
"mod" -> {
variables[varIndex] = calculate(variables[varIndex], i.arg2) { a, b -> a % b }
}
"eql" -> {
variables[varIndex] = calculate(variables[varIndex], i.arg2) { a, b -> if (a == b) 1 else 0 }
}
}
}
println(variables.contentToString())
}
fun calculate(arg1: Int, arg2: String, op: (Int, Int) -> Int): Int {
val arg2Value = mapVarToInd[arg2]?.let { variables[it] } ?: arg2.toInt()
return op(arg1, arg2Value)
}
data class Instruction(val op: String, val arg1: String, val arg2: String)
|
# golang + Utilities = goutils
goutils (Golang UTILitieS) is a Golang implementation of some functions and data types to help other libraries.
You can see an extended doc in [godocs](https://godoc.org/github.com/fmorenovr/goutils).
Install it writing in terminal:
go get github.com/fmorenovr/goutils
Example:
If you wan to compare different interfaces with an Integer parse:
```go
var a, b interface{}
a = 2
b = 5
goutils.IntComparator(a, b)
// this should return 1 if a>b
// this should return -1 if a<b
// this should return 0 if a=b
```
Or define your own comparator function:
```go
// supose that this is your struct
type MyDataType struct{
ID int
name string
}
// your comparator, you cna use this function as TypeComparator type function
func MyComparator(a, b interface{}) int {
AaAsserted := a.(MyDataType)
bAsserted := b.(MyDataType)
switch {
case aAsserted.ID > bAsserted.ID:
return 1
case aAsserted.ID < bAsserted.ID:
return -1
default:
return 0
}
}
```
|
import chalk from "chalk";
import checks from "./checks";
import api from "../../../services/api/api";
import spinner from "../../../services/spinner";
async function apply(file: string, application: string, version: string) {
const s = spinner.get();
await validate(file);
s.start("Checking submission status...");
const { url, id } = await api.uploadUrlGet(application, version);
await api.uplaod(url, file);
s.succeed(
`Submitted your observability configurations. id: ${chalk.bold(
chalk.cyan(id),
)}`,
);
}
async function validate(file: string) {
await checks.validate(file);
}
export default {
apply,
validate,
};
|
import * as React from "react";
import {
SyntheticNode,
DependencyGraph,
InspectorNode,
PCVariant,
PCVariable,
ComputedStyleInfo
} from "paperclip";
import { BaseElementStylerProps } from "./view.pc";
import { Dispatch } from "redux";
import { FontFamily, ProjectOptions } from "../../../../../../state";
export type PrettyPaneOuterProps = {
syntheticNodes: SyntheticNode[];
};
export type Props = {
cwd: string;
documentColors: string[];
selectedVariant: PCVariant;
dispatch: Dispatch<any>;
graph: DependencyGraph;
computedStyleInfo: ComputedStyleInfo;
rootInspectorNode: InspectorNode;
selectedInspectorNodes: InspectorNode[];
fontFamilies: FontFamily[];
globalVariables: PCVariable[];
projectOptions: ProjectOptions;
};
export default (Base: React.ComponentClass<BaseElementStylerProps>) =>
class PrettyStylesController extends React.PureComponent<Props> {
render() {
const {
cwd,
dispatch,
selectedVariant,
computedStyleInfo,
globalVariables,
fontFamilies,
documentColors,
projectOptions,
graph,
selectedInspectorNodes,
rootInspectorNode,
...rest
} = this.props;
return (
<Base
{...rest}
layoutPaneProps={{
dispatch,
graph,
selectedVariant,
rootInspectorNode,
computedStyleInfo,
selectedInspectorNodes
}}
typographyPaneProps={{
dispatch,
computedStyleInfo,
fontFamilies,
documentColors,
graph,
globalVariables,
projectOptions
}}
opacityPaneProps={{
dispatch,
computedStyleInfo
}}
bordersPaneProps={{
dispatch,
documentColors,
computedStyleInfo,
globalVariables
}}
outerShadowsPaneProps={{
dispatch,
documentColors,
computedStyleInfo,
globalVariables
}}
spacingPaneProps={{
dispatch,
computedStyleInfo
}}
backgroundsPaneProps={{
dispatch,
documentColors,
computedStyleInfo,
globalVariables,
cwd
}}
innerShadowsPaneProps={{
dispatch,
documentColors,
computedStyleInfo,
globalVariables
}}
/>
);
}
};
|
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Bot.Schema;
namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Testing
{
/// <summary>
/// Middleware that catch "SetTestOptions" event and save into "Conversation.TestOptions".
/// </summary>
public class SetTestOptionsMiddleware : IMiddleware
{
/// <summary>
/// Initializes a new instance of the <see cref="SetTestOptionsMiddleware"/> class.
/// </summary>
public SetTestOptionsMiddleware()
{
}
/// <summary>
/// Processes an incoming event activity.
/// </summary>
/// <param name="turnContext">The context object for this turn.</param>
/// <param name="next">The delegate to call to continue the bot middleware pipeline.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects
/// or threads to receive notice of cancellation.</param>
/// <returns>A task that represents the work queued to execute.</returns>
public async Task OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken = default)
{
if (turnContext.Activity.Type == ActivityTypes.Event)
{
var eventActivity = turnContext.Activity.AsEventActivity();
if (eventActivity.Name == "SetTestOptions")
{
var conversationState = turnContext.TurnState.Get<ConversationState>();
var property = conversationState.CreateProperty<object>("TestOptions");
await property.SetAsync(turnContext, eventActivity.Value).ConfigureAwait(false);
}
}
await next(cancellationToken).ConfigureAwait(false);
}
}
}
|
package koch;
import fractal.*;
public class Koch extends Fractal {
private int length;
/** Creates an object that handles Koch's fractal.
* @param length the length of the triangle side
*/
public Koch(int length) {
super();
this.length = length;
}
/**
* Returns the title.
* @return the title
*/
public String getTitle() {
return "Kochs triangel";
}
/** Draws the fractal.
* @param turtle the turtle graphic object
*/
public void draw(TurtleGraphics turtle) {
turtle.moveTo(turtle.getWidth() / 2.0 - length / 2.0,
turtle.getHeight() / 2.0 + Math.sqrt(3.0) * length / 4.0);
turtle.penDown();
fractalLine(turtle, order,length,0);
fractalLine(turtle, order,length,120);
fractalLine(turtle, order,length,240);
}
/*
* Recursive method: Draws a recursive line of the triangle.
*/
private void fractalLine(TurtleGraphics turtle, int order, double length, int alpha) {
if(order == 0) {
turtle.setDirection(alpha);
turtle.forward(length);
} else {
fractalLine(turtle, order-1, length/3, alpha);
fractalLine(turtle, order-1, length/3, alpha-60);
fractalLine(turtle, order-1, length/3, alpha+60);
fractalLine(turtle, order-1, length/3, alpha);
}
}
}
|
module Util.AnalyzeSamples.ConfigSpecs where
import Util.ParseStuff
dss = DataSpecSheet $ M.fromList
[ ("simple_a",
[ ("soundFileDir", SomeDataTypeString)
, ("soundFileName", SomeDataTypeString)
, ("soundFileFundamental", SomeDataTypeFloat)
, ("pvsDataDir", SomeDataTypeString)
, ("samplingRate", SomeDataTypeFloat)
, ("skip", SomeDataTypeInt)
, ("dur", SomeDataTypeFloat)
, ("channel", SomeDataTypeString)
]
|
using System;
using System.Reflection;
[assembly: AssemblyTitle("CslaContrib.CustomFieldData.UnitTests")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("CslaContrib.CustomFieldData.UnitTests")]
[assembly: AssemblyDescription("An assembly that tests code in CustomFieldData.")]
// Mark the assembly as NOT CLS compliant
[assembly: CLSCompliant(false)]
|
ALTER TABLE WORKCAL_TYPE ADD COLUMN TENANT_ID VARCHAR(64);
ALTER TABLE WORKCAL_RULE ADD COLUMN TENANT_ID VARCHAR(64);
ALTER TABLE WORKCAL_PART ADD COLUMN TENANT_ID VARCHAR(64);
|
from typing import Optional, Callable
from thinc.api import Model
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from .syntax_iterators import SYNTAX_ITERATORS
from .punctuation import TOKENIZER_PREFIXES, TOKENIZER_SUFFIXES, TOKENIZER_INFIXES
from .lemmatizer import GreekLemmatizer
from ...language import Language, BaseDefaults
class GreekDefaults(BaseDefaults):
tokenizer_exceptions = TOKENIZER_EXCEPTIONS
prefixes = TOKENIZER_PREFIXES
suffixes = TOKENIZER_SUFFIXES
infixes = TOKENIZER_INFIXES
lex_attr_getters = LEX_ATTRS
stop_words = STOP_WORDS
syntax_iterators = SYNTAX_ITERATORS
class Greek(Language):
lang = "el"
Defaults = GreekDefaults
@Greek.factory(
"lemmatizer",
assigns=["token.lemma"],
default_config={
"model": None,
"mode": "rule",
"overwrite": False,
"scorer": {"@scorers": "spacy.lemmatizer_scorer.v1"},
},
default_score_weights={"lemma_acc": 1.0},
)
def make_lemmatizer(
nlp: Language,
model: Optional[Model],
name: str,
mode: str,
overwrite: bool,
scorer: Optional[Callable],
):
return GreekLemmatizer(
nlp.vocab, model, name, mode=mode, overwrite=overwrite, scorer=scorer
)
__all__ = ["Greek"]
|
package ru.srcblog.libs.imageviewwithprogress
import android.content.Context
import android.util.AttributeSet
import android.view.Gravity
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.ProgressBar
class ImageViewWithProgress @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
defStyleRes: Int = 0
) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) {
private var showProgress: Boolean = false;
private val imageView: ImageView;
private val progressBar: ProgressBar;
init {
val typedArray = context.obtainStyledAttributes(
attrs,
R.styleable.ImageViewWithProgress,
defStyleAttr,
defStyleRes
)
showProgress = typedArray.getBoolean(R.styleable.ImageViewWithProgress_showProgress, false)
imageView = ImageView(context);
progressBar = ProgressBar(context);
typedArray.recycle()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
progressBar.parent?.let { (it as ViewGroup).removeView(progressBar) }
val layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
layoutParams.gravity = Gravity.CENTER
addView(progressBar, layoutParams)
imageView.parent?.let { (it as ViewGroup).removeView(imageView) }
val layoutParamsForImage = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
addView(imageView, layoutParamsForImage)
}
}
|
RSpec.describe Tarona::TextAct do
it 'is act type' do
expect(described_class.superclass).to be(Tarona::Act)
end
it 'consists of text' do
expect(described_class.act_type).to be(:text)
end
class TestTextAct < Tarona::TextAct
subject 'mystring'
end
let(:io) { Tardvig::GameIO.new }
let(:act) { TestTextAct.new io: io}
it 'notifies IO with its text' do
expect(io).to receive(:happen).with(:act_start, hash_including(
type: :text,
subject: 'mystring'
))
act.call
end
it 'starts next act when it is requested' do
act.call
expect(act).to receive(:happen).with(:end, any_args)
io.happen :read
end
class TestTextAct
def next_act
:foo
end
end
it 'takes a name of next act from method' do
act.call
expect(act).to receive(:happen).with(:end, :foo)
io.happen :read
end
end
|
#!/bin/bash
[ -f path.sh ] && . ./path.sh
path=/home/grtzsohalf/Audio2Vec
#feat_dir=/home_local/grtzsohalf/yeeee/French
feat_dir=/nfs/Mazu/grtzsohalf/yeeee/English
feats_dir=/nfs/YueLao/grtzsohalf/yeeee/English/feats
[ -f $feat_dir/cmvned_feats.ark ] || exit 1
[ -f $feat_dir/all_prons ] || exit 1
mkdir -p $feats_dir
if [ ! -f $feats_dir/extracted ]; then
[ -f $feats_dir ] && rm -rf $feats_dir
[ -f $feat_dir/filtered_prons ] && rm -rf $feat_dir/filtered_prons
python3 $path/src/get_feat.py $feat_dir/all_prons $feat_dir/cmvned_feats.ark $feats_dir $feat_dir/filtered_prons
echo 1 > $feat_dir/feats/extracted
fi
|
/**
* Set default style element and set corresponding
* variable to the style.
*
* - attr: attribute name of element
* - data: the data want to change for the attr
* - variable: local variable need to update the value, leave NULL
* if no variable need to be updated
*/
function setDefaultStyleData(attr, data) {
let styleElement =
initHTMLElement(DATA_COLLECTION, DEFAULT_STYLE, true);
setElementAttribute(styleElement, attr, data);
}
/**
* Set default shape
* - shape: shape you want to update
*/
function setDefaultShape(shape) {
setDefaultStyleData("shape", shape);
defaultShape = shape;
}
/**
* Set default color
* - color: color you want to update
*/
function setDefaultColor(color) {
setDefaultStyleData("color", color);
defaultColor = color;
}
|
import React from 'react';
import { render } from '@testing-library/react';
import Modal from './Modal';
test('Renders the Modal component', () => {
const { container } = render(<Modal show text="Test" cancel={() => null} confirm={() => null} />);
expect(container).toBeInTheDocument();
});
|
Twig Helper
===========
thumbor Function
----------------
The thumbor twig function build a thumbor url with the different transformation configured in config.yml.
``` yml
jb_phumbor:
transformations:
width_50:
resize: { width: 50, height: 0 }
```
``` twig
{{ thumbor('test/logo.png', 'width_50') }}
```
|
# angular-quickstart-skeleton-app - Sample code to help you get started with your next Angular App
This is a bare minimum skeleton app for starting your next Angular application.
It covers most of the key features of Angular that you would use in a typical Angular App.
## Demo
Click [here][1] to view it in action
## Installation
```
git clone https://github.com/perials/angular-quickstart-skeleton-app.git
cd angular-quickstart-skeleton-app
npm install
ng serve
```
[1]: https://perials.github.io/angular-quickstart-skeleton-app-demo/
|
/**
* 6436. Floppies
*
* 작성자: xCrypt0r
* 언어: Go
* 사용 메모리: 924 KB
* 소요 시간: 4 ms
* 해결 날짜: 2021년 10월 25일
*/
package main
import (
"bufio"
"fmt"
"os"
)
const (
maxFileSize = 62 * 30000
)
func main(){
in := bufio.NewReader(os.Stdin)
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
var s int
var i int = 0
for {
fmt.Fscan(in, &s)
if s == 0 {
break
}
i++
s = (s + 1) / 2
s += (s + 1) / 2
res := (s + maxFileSize - 1) / maxFileSize
fmt.Fprintf(out, "File #%d\n", i)
fmt.Fprintf(out, "John needs %d floppies.\n\n", res)
}
}
|
package shader
import (
"bufio"
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
)
func loadFileWithIncludesRecursive(filename string, loadedpaths *map[string]bool) string {
// simplify filepath to consistently find duplicate includes
cleanpath := filepath.Clean(filename)
// early return since file had been loaded before
if _, ok := (*loadedpaths)[cleanpath]; ok {
return ""
}
(*loadedpaths)[cleanpath] = true
// create a file reader
file, err := os.Open(cleanpath)
defer file.Close()
if err != nil {
fmt.Println("Shaderinclude cannot find " + cleanpath)
return ""
}
reader := bufio.NewReader(file)
// regular expression for matching the relative paths
exp := regexp.MustCompile(`"([^"]+)"`)
// read the file line by line and load includes
var shadersource string
for {
line, err := reader.ReadString('\n')
if matched, _ := regexp.MatchString(`#include`, line); matched {
// extract the relative file path
relativepath := exp.FindString(line)
relativepath = strings.Trim(relativepath, "\"")
basepath, _ := filepath.Split(cleanpath)
// relative path as name
divider := "///////////////////////////////////////////////////////////////////////////////////"
includestart := divider + "\n// include " + relativepath + "\n//\n\n"
includeend := "\n//\n//\n" + divider + "\n\n"
// load new shader include file recursively and attach
// the result to shadersource
newpath := basepath + relativepath
childshadersource := loadFileWithIncludesRecursive(newpath, loadedpaths)
shadersource += includestart + childshadersource + includeend
} else {
shadersource = shadersource + line
}
// an error is returned when the last line has been read
if err != nil {
shadersource += "\n"
break
}
}
return shadersource
}
func LoadFileWithIncludes(filepath string) (string, error) {
loadedpaths := make(map[string]bool)
return loadFileWithIncludesRecursive(filepath, &loadedpaths) + "\000", nil
}
|
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('priv_torrents')
class FilterPrivateTorrents(object):
"""How to handle private torrents.
private_torrents: yes|no
Example::
private_torrents: no
This would reject all torrent entries with private flag.
Example::
private_torrents: yes
This would reject all public torrents.
Non-torrent content is not interviened.
"""
schema = {'type': 'boolean'}
@plugin.priority(127)
def on_task_modify(self, task, config):
private_torrents = config
for entry in task.accepted:
if 'torrent' not in entry:
log.debug('`%s` is not a torrent' % entry['title'])
continue
private = entry['torrent'].private
if not private_torrents and private:
entry.reject('torrent is marked as private', remember=True)
elif private_torrents and not private:
entry.reject('public torrent', remember=True)
@event('plugin.register')
def register_plugin():
plugin.register(FilterPrivateTorrents, 'private_torrents', api_ver=2)
|
from typing import Callable
from .context import Context
from .errors import CommandDoesNotExistError
from core.ext import ExtensionHandlerFeature, ExtensionFeature
def command(alias: str = None):
def decorator(func: Callable):
if alias is None:
return Command(func, func.__name__)
return Command(func, alias)
return decorator
def group(alias: str = None):
def decorator(func: Callable):
if alias is None:
return CommandGroup(func, func.__name__)
return CommandGroup(func, alias)
return decorator
class Command:
"""
The command class.
"""
def __init__(self, func: Callable, name: str):
self.__func = func
self.__name = name
def __call__(self, *args, **kwargs):
return self.__func(*args, **kwargs)
@property
def name(self) -> str:
return self.__name
class CommandGroup(Command):
"""
A group containing subcommands.
"""
def __init__(self, func: Callable, name: str):
Command.__init__(self, func, name)
self._commands = {}
def __call__(self, *args, **kwargs):
if len(args) > 2 and args[2] in self._commands:
extension = args[0]
context = args[1]
sub_command_name = args[2]
args = args[3:]
command_func = self._commands[sub_command_name]
return command_func(extension, context, *args, **kwargs)
return Command.__call__(self, *args, **kwargs)
@property
def commands(self) -> dict:
return self._commands
def command(self, alias: str = None) -> Callable:
"""
Decorator for adding a command to the group.
"""
def decorator(func: Callable):
if alias is None:
self._commands[func.__name__] = Command(func, func.__name__)
self._commands[alias] = Command(func, alias)
return decorator
class ExtensionCommandFeature(ExtensionFeature):
def __init__(self):
self._commands = {}
@property
def commands(self):
return self._commands
def add_command(self, name: str, cmd: Command):
self._commands[name] = cmd
class HandlerCommandFeature(ExtensionHandlerFeature):
"""
Mixin part for command handling.
"""
def __init__(self, types, to_be_executed: [Callable]):
ExtensionHandlerFeature.__init__(self, types, "Command", "CommandGroup")
self._commands = {}
to_be_executed.append(self._add_commands)
@property
def commands(self) -> dict:
return self._commands
def _add_command(self, name: str, cmd: Command, extension: ExtensionCommandFeature) -> None:
if name in self._commands:
raise RuntimeError(f'The command "{name}" already exists')
self._commands[name] = {
"command": cmd,
"extension": extension
}
extension.add_command(name, cmd)
def _add_commands(self, attributes: dict, extension: ExtensionCommandFeature) -> None:
for cmd in attributes["Command"]:
self._add_command(cmd.name, cmd, extension)
for cmd_group in attributes["CommandGroup"]:
self._add_command(cmd_group.name, cmd_group, extension)
def handle_command(self, context: Context, command_prefix: str) -> None:
"""
Handles incoming command requests.
"""
cmd = context.command
if not cmd.startswith(command_prefix):
return
# replaces the prefix with an empty string, so we have the raw command word
cmd = cmd.replace(command_prefix, "", 1)
if cmd not in self._commands:
raise CommandDoesNotExistError(f'The command "{cmd}" does not exist')
command_func = self._commands[cmd]["command"]
extension = self._commands[cmd]["extension"]
arguments = context.arguments
command_func(extension, context, *arguments)
|
import React, { Component } from "react";
let number = null;
class Coin extends Component {
state = {
number: null,
class: "",
animation: false,
div: React.createRef(),
};
randomNumber = () => {
number = Math.round(Math.random());
console.log(number);
};
handleClick = (e) => {
if (this.state.div.current.classList[1] === "coin-animation-tails")
this.state.div.current.classList.remove("coin-animation-tails");
if (this.state.div.current.classList[1] === "coin-animation-eagle")
this.state.div.current.classList.remove("coin-animation-eagle");
this.randomNumber();
void this.state.div.current.offsetWidth;
if (number === 0)
this.state.div.current.classList.add("coin-animation-eagle");
if (number === 1)
this.state.div.current.classList.add("coin-animation-tails");
};
render() {
return (
<div className="coin-wrapper">
<div className="coin">
<div
ref={this.state.div}
className="coin-inner"
// onAnimationEnd={(e) => console.log(e)}
>
<div className="coin-front"></div>
<div className="coin-back"></div>
</div>
</div>
<button className="coin-button" onClick={this.handleClick}>
Start
</button>
</div>
);
}
}
export default Coin;
|
"""Define class for Page Number argument."""
from args import _ArgType
from args.meta_arg import MetaArg
from args.arg import Arg
class PageNumber(Arg, metaclass=MetaArg, argtype=_ArgType._PAGE_NUMBER,
mandatory=True):
"""Page Number argument."""
pass # Nothing to do
|
# KiCad 6 configuration checker
This is a CLI Python3 program to check a user's configuration and emit diagnostics
Requires Python3 module sexpdata. If you do not have it, install with
```sh
pip3 install sexpdata
```
Takes an optional argument to specify the configuration directory which overrides the default for the platform.
## Usage
```
python3 kicad6cfgchk.py [-h] [-a] [-v] [directory]
Check a user's KiCad6 configuration and emit diagnostics
positional arguments:
directory Configuration directory
optional arguments:
-h, --help show this help message and exit
-a, --all show all diagnostics for tables (default: errors only)
-v, --version show version
```
## To do
Check if it works on OS/X and Windows with the paths in code
## Author
* **Ken Yap**
## License
See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).
|
import interedit.app
__version__ = "0.1.0"
main = interedit.app.main
|
package com.adlawson.json4s
import org.json4s.{DefaultFormats, FieldSerializer, Serializer}
import scala.language.existentials
object ExtendedFormats extends ExtendedFormats
trait ExtendedFormats extends DefaultFormats {
override val strict: Boolean = true
override val customSerializers: List[Serializer[_]] = List(
CharSerializer
)
override val fieldSerializers: List[(Class[_], FieldSerializer[_])] = List(
TypeFieldSerializer.mf.runtimeClass -> TypeFieldSerializer
)
}
|
# whiptail
log_info "Install whiptail"
if [ "$(command -v whiptail)" ]; then
log_success "command \"whiptail\" exists on system"
elif [[ " ${pms[@]} " =~ " apt-get " ]]; then
# whatever you want to do when array contains value
log_info "use apt-get"
$isu apt-get update -y
$isu apt-get install -y whiptail
else
log_critical "This system does not support!"
fi
|
---
el: .tabs
title: Tabs
---
__Variables:__
* modifier_classes: [string] Classes to modify the default component styling.
* heading: [string] Accessible heading of the tabs.
* tabs: [array] Tab items. Each item is an object containing:
* active: [boolean] Whether the item is active.
* url: [string] URL of the item.
* text: [string] Text of the item.
|
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package icmp
import (
"encoding/binary"
"github.com/sssvip/net/internal/iana"
)
// A ParamProb represents an ICMP parameter problem message body.
type ParamProb struct {
Pointer uintptr // offset within the data where the error was detected
Data []byte // data, known as original datagram field
Extensions []Extension // extensions
}
// Len implements the Len method of MessageBody interface.
func (p *ParamProb) Len(proto int) int {
if p == nil {
return 0
}
l, _ := multipartMessageBodyDataLen(proto, true, p.Data, p.Extensions)
return 4 + l
}
// Marshal implements the Marshal method of MessageBody interface.
func (p *ParamProb) Marshal(proto int) ([]byte, error) {
if proto == iana.ProtocolIPv6ICMP {
b := make([]byte, p.Len(proto))
binary.BigEndian.PutUint32(b[:4], uint32(p.Pointer))
copy(b[4:], p.Data)
return b, nil
}
b, err := marshalMultipartMessageBody(proto, true, p.Data, p.Extensions)
if err != nil {
return nil, err
}
b[0] = byte(p.Pointer)
return b, nil
}
// parseParamProb parses b as an ICMP parameter problem message body.
func parseParamProb(proto int, typ Type, b []byte) (MessageBody, error) {
if len(b) < 4 {
return nil, errMessageTooShort
}
p := &ParamProb{}
if proto == iana.ProtocolIPv6ICMP {
p.Pointer = uintptr(binary.BigEndian.Uint32(b[:4]))
p.Data = make([]byte, len(b)-4)
copy(p.Data, b[4:])
return p, nil
}
p.Pointer = uintptr(b[0])
var err error
p.Data, p.Extensions, err = parseMultipartMessageBody(proto, typ, b)
if err != nil {
return nil, err
}
return p, nil
}
|
# Infinitic
## Run Standalone Pulsar
> Create those directories, if you don't have them yet:
/engine/build/libs
/engine/build/schemas
In the same directory than `docker-compose.yaml`, do:
```bash
docker-compose up
```
To enter the docker container:
```bash
docker exec -it pulsar_pulsar_1 /bin/bash
```
To clean everything
```bash
docker-compose down --volumes
```
To install Infinitic:
```bash
gradle install
```
To remove Infinitic
```bash
gradle delete
```
To update Infinitic
```bash
gradle update
```
## Pulsar Manager
Once Docker run, you can access it at `http://localhost:9527`
Create an admin user with:
```bash
CSRF_TOKEN=$(curl http://localhost:7750/pulsar-manager/csrf-token)
curl \
-H "X-XSRF-TOKEN: $CSRF_TOKEN" \
-H "Cookie: XSRF-TOKEN=$CSRF_TOKEN;" \
-H 'Content-Type: application/json' \
-X PUT http://localhost:7750/pulsar-manager/users/superuser \
-d '{"name": "admin", "password": "apachepulsar", "description": "test", "email": "username@test.org"}'
```
Connect with user = `admin` and password = `apachepulsar`
To obtain the service url of Pulsar *from the Pulsar Manager container*, do:
```bash
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pulsar_pulsar_1
```
you should obtain something like `172.20.0.3`.
Then the service url to use for adding an environment is `http://172.20.0.3:8080`
|
using System;
using System.Threading.Tasks;
using DSharpPlus;
using DSharpPlus.Entities;
namespace BotV2.Services.WarframeInfo
{
public interface IWarframeCycleStatus
{
string Id { get; }
string Name { get; }
DateTimeOffset Expiry { get; }
Task<(string message, DiscordEmbed embed)> GetMessage(DiscordClient client, DiscordChannel channel);
}
}
|
package net.zhenglai.ml.lib
/**
* Created by Zhenglai on 7/21/16.
*/
private[zhenglai] object Category {
def id[A]: A ⇒ A = a ⇒ a
def compose[A, B, C](g: B ⇒ C, f: A ⇒ B): A ⇒ C =
g compose f // Function.compose, f(g(x))
}
|
using WorkTimer.Domain.Models.Enums;
namespace WorkTimer.SQLite.Entities
{
internal class WorkLog
{
public WorkTask Task { get; set; }
public int TaskId { get; set; }
public WorkType Type { get; set; }
public string StartDate { get; set; }
public string EndDate { get; set; }
}
}
|
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Foundation\Auth\User;
use App\Post;
use Storage;
use Illuminate\Support\Facades\Validator;
class PostsController extends Controller
{
//画像およびコメントアップロード
public function upload(Request $request){
//Validatorファサードのmakeメソッドの第1引数は、バリデーションを行うデータ。
//第2引数はそのデータに適用するバリデーションルール
$validator = Validator::make($request->all(), [
'file' => 'required|max:10240|mimes:jpeg,gif,png',
'comment' => 'required|max:191'
]);
//上記のバリデーションがエラーの場合、ビューにバリデーション情報を渡す
if ($validator->fails()){
return back()->withInput()->withErrors($validator);
}
//s3に画像を保存。第一引数はs3のディレクトリ。第二引数は保存するファイル。
//第三引数はファイルの公開設定。
$file = $request->file('file');
$path = Storage::disk('public')->putFile('/', $file, 'public');
//カラムに画像のパスとタイトルを保存
Post::create([
'image_file_name' => $path,
'image_title' => $request->comment
]);
return redirect('/');
}
//ページ表示
public function index(){
$posts = \App\Post::all();
// $data = [
// 'posts' => $posts,
// ];
// welcome.blade.phpに値を返す。
return view('welcome', ['posts' => $posts]);
}
}
|
/// This file contains a floating point math implementation of the vector graphics rasterizer.
use super::{clamp, Rasterizer};
#[inline(always)] fn fmax(x: f32, y: f32) -> f32 { if x > y { x } else { y } }
#[inline(always)] fn fmin(x: f32, y: f32) -> f32 { if x < y { x } else { y } }
#[inline(always)] fn floor(x: f32) -> i32 { (x as f64).floor() as i32 }
#[inline(always)] fn ceil(x: f32) -> i32 { (x as f64).ceil() as i32 }
impl Rasterizer {
pub fn floating_accumulate_mask(&mut self) {
let buf = self.buf.as_u32();
let mut acc = 0f32;
for v in buf {
acc += unsafe { *(v as *mut u32 as *mut f32) };
let a = clamp_alpha(acc);
*v = (ALMOST65536 * a) as u32;
}
}
pub fn floating_line_to(&mut self, bx: f32, by: f32) {
let [ax, ay] = self.pen;
self.pen = [bx, by];
let (dir, ax, ay, bx, by) = if ay > by {
(-1f32, bx, by, ax, ay)
} else {
(1f32, ax, ay, bx, by)
};
// Horizontal line segments yield no change in coverage. Almost horizontal
// segments would yield some change, in ideal math, but the computation
// further below, involving 1 / (by - ay), is unstable in floating point
// math, so we treat the segment as if it was perfectly horizontal.
if by-ay <= 0.000001 { return }
let dxdy = (bx - ax) / (by - ay);
let mut x = ax;
let mut y = floor(ay);
let y_max = ceil(by);
let y_max = if y_max > self.size[1] as i32 {
self.size[1] as i32
} else {
y_max
};
let width = self.size[0] as i32;
while y < y_max {
let dy = fmin((y+1) as f32, by) - fmax(y as f32, ay);
// The "float32" in expressions like "float32(foo*bar)" here and below
// look redundant, since foo and bar already have type float32, but are
// explicit in order to disable the compiler's Fused Multiply Add (FMA)
// instruction selection, which can improve performance but can result
// in different rounding errors in floating point computations.
//
// This package aims to have bit-exact identical results across all
// GOARCHes, and across pure Go code and assembly, so it disables FMA.
//
// See the discussion at
// https://groups.google.com/d/topic/golang-dev/Sti0bl2xUXQ/discussion
let x_next = x + (dy * dxdy) as f32;
if y < 0 {
x = x_next;
continue;
}
let buf = &mut self.buf.as_f32()[(y*width) as usize..];
let d = (dy * dir) as f32;
let (x0, x1) = if x > x_next {
(x_next, x)
} else {
(x, x_next)
};
let x0i = floor(x0);
let x0floor = x0i as f32;
let x1i = ceil(x1);
let x1ceil = x1i as f32;
if x1i <= x0i+1 {
let xmf = (0.5 * (x+x_next)) as f32 - x0floor;
let i = clamp(x0i+0, width);
if i < buf.len() {
buf[i] += d - (d*xmf) as f32;
}
let i = clamp(x0i+1, width);
if i < buf.len() {
buf[i] += (d * xmf) as f32;
}
} else {
let s = 1.0 / (x1 - x0);
let x0f = x0 - x0floor;
let one_minus_x0f = 1.0 - x0f;
let a0 = (0.5 * s * one_minus_x0f * one_minus_x0f) as f32;
let x1f = x1 - x1ceil + 1.0;
let am = (0.5 * s * x1f * x1f) as f32;
let i = clamp(x0i, width);
if i < buf.len() {
buf[i] += (d * a0) as f32;
}
if x1i == x0i+2 {
let i = clamp(x0i+1, width);
if i < buf.len() {
buf[i] += (d * (1.0 - a0 - am)) as f32;
}
} else {
let a1 = (s * (1.5 - x0f)) as f32;
let i = clamp(x0i+1, width);
if i < buf.len() {
buf[i] += (d * (a1 - a0)) as f32;
}
let d_times_s = (d * s) as f32;
for xi in (x0i + 2)..(x1i-1) {
let i = clamp(xi, width);
if i < buf.len() {
buf[i] += d_times_s;
}
}
let a2 = a1 + (s * (x1i-x0i-3) as f32) as f32;
let i = clamp(x1i-1, width);
if i < buf.len() {
buf[i] += (d * (1.0 - a2 - am)) as f32;
}
}
let i = clamp(x1i, width);
if i < buf.len() {
buf[i] += (d * am) as f32;
}
}
x = x_next;
y += 1;
}
}
}
// almost256 scales a floating point value in the range [0, 1] to a uint8
// value in the range [0x00, 0xff].
//
// 255 is too small. Floating point math accumulates rounding errors, so a
// fully covered src value that would in ideal math be float32(1) might be
// float32(1-ε), and uint8(255 * (1-ε)) would be 0xfe instead of 0xff. The
// uint8 conversion rounds to zero, not to nearest.
//
// 256 is too big. If we multiplied by 256, below, then a fully covered src
// value of float32(1) would translate to uint8(256 * 1), which can be 0x00
// instead of the maximal value 0xff.
//
// math.Float32bits(almost256) is 0x437fffff.
const ALMOST256: f32 = 255.99998;
// almost65536 scales a floating point value in the range [0, 1] to a
// uint16 value in the range [0x0000, 0xffff].
//
// math.Float32bits(almost65536) is 0x477fffff.
const ALMOST65536: f32 = ALMOST256 * 256.0;
#[inline(always)]
fn clamp_alpha(mut a: f32) -> f32 {
if a < 0.0 { a = -a; }
if a > 1.0 { a = 1.0; }
a
}
pub fn accumulate_op_over(dst: &mut [u8], src: &[f32]) {
// Sanity check that dst.len() >= src.len().
if dst.len() < src.len() { return }
let mut acc = 0f32;
for (i, v) in src.iter().enumerate() {
acc += *v;
let a = clamp_alpha(acc);
// This algorithm comes from the standard library's image/draw package.
let dst_a = (dst[i] as u32) * 0x101;
let mask_a = (ALMOST65536 * a) as u32;
let out_a = dst_a * (0xFFFF - mask_a) / 0xFFFF + mask_a;
dst[i] = (out_a >> 8) as u8;
}
}
pub fn accumulate_op_src(dst: &mut [u8], src: &[f32]) {
// Sanity check that dst.len() >= src.len().
if dst.len() < src.len() { return }
let mut acc = 0f32;
for (i, v) in src.iter().enumerate() {
acc += *v;
let a = clamp_alpha(acc);
dst[i] = (ALMOST256 * a) as u8;
}
}
pub fn accumulate_mask(dst: &mut [u32], src: &[f32]) {
// Sanity check that dst.len() >= src.len().
if dst.len() < src.len() { return }
let mut acc = 0f32;
for (i, v) in src.iter().enumerate() {
acc += *v;
let a = clamp_alpha(acc);
dst[i] = (ALMOST65536 * a) as u32;
}
}
pub fn accumulate_mask_x(buf: &mut [u32]) {
let src = unsafe { std::mem::transmute(&buf[..]) };
accumulate_mask(buf, src)
}
pub fn accumulate_mask_inplace(buf: &mut super::SimdVec) {
unsafe {
let dst = buf.u_u32();
let src = buf.u_f32();
accumulate_mask(dst, src)
}
}
|
<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html ng-app="inventory_system">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{html_title}}</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="stylesheets/bootstrap.min.css">
<!-- Font Awesome -->
<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<!– Ionicons –>
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">-->
<!-- Theme style -->
<link rel="stylesheet" href="stylesheets/AdminLTE.min.css">
<!-- AdminLTE Skins. We have chosen the skin-blue for this starter
page. However, you can choose any other skin. Make sure you
apply the skin class to the body tag so the changes take effect.
-->
<link rel="stylesheet" href="stylesheets/skins/skin-blue.min.css">
<script src="javascripts/jQuery/jQuery-2.1.4.min.js"></script>
<script src="javascripts/firebase.js"></script>
<script src="javascripts/angular/angular.min.js"></script>
<script src="javascripts/angularfire.min.js"></script>
<script src="javascripts/angular-route/angular-route.min.js"></script>
<script src="javascripts/ui-router/angular-ui-router.min.js"></script>
<script src="ng-app/models/Model.js"></script>
<script src="ng-app/app.js"></script>
<script src="ng-app/services/AuthService.js"></script>
<script src="ng-app/services/RouteHelper.js"></script>
<script src="ng-app/services/ResourceLoader.js"></script>
<script src="ng-app/controllers/ParentController.js"></script>
<script src="ng-app/controllers/LoginController.js"></script>
<script src="ng-app/controllers/HeaderController.js"></script>
<script src="ng-app/controllers/ContentContainerController.js"></script>
<!-- Custoemrs Controllers -->
<script src="ng-app/controllers/ContentHeaderController.js"></script>
<script src="ng-app/controllers/ShowCustomersController.js"></script>
<script src="ng-app/controllers/AddCustomersController.js"></script>
<!-- Users Controllers -->
<script src="ng-app/controllers/UserController.js"></script>
<!-- Home Controllers -->
<script src="ng-app/controllers/HomeController.js"></script>
<script src="ng-app/routes.js"></script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="" ng-controller="ParentController">
<ui-view></ui-view>
</div><!-- ./wrapper -->
<!-- REQUIRED JS SCRIPTS -->
<!-- jQuery 2.1.4 -->
<!-- Bootstrap 3.3.5 -->
<script src="javascripts/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="javascripts/app.min.js"></script>
<!-- Optionally, you can add Slimscroll and FastClick plugins.
Both of these plugins are recommended to enhance the
user experience. Slimscroll is required when using the
fixed layout. -->
</body>
</html>
|
# Copyright (c) 2020 Adam Souzis
# SPDX-License-Identifier: MIT
"""
TOSCA implementation
"""
from .tosca_plugins import TOSCA_VERSION
from .util import UnfurlError, UnfurlValidationError, getBaseDir
from .eval import Ref, RefContext, mapValue
from .result import ResourceRef, ResultsList
from .merge import patchDict
from . import getLogLevel
from toscaparser.tosca_template import ToscaTemplate
from toscaparser.properties import Property
from toscaparser.elements.entity_type import EntityType
from toscaparser.elements.statefulentitytype import StatefulEntityType
import toscaparser.workflow
import toscaparser.imports
import toscaparser.artifacts
from toscaparser.common.exception import ExceptionCollector
import six
import logging
from ruamel.yaml.comments import CommentedMap
logger = logging.getLogger("unfurl")
from toscaparser import functions
class RefFunc(functions.Function):
def result(self):
return {self.name: self.args}
def validate(self):
pass
for func in ["eval", "ref", "get_artifact", "has_env", "get_env"]:
functions.function_mappings[func] = RefFunc
toscaIsFunction = functions.is_function
def is_function(function):
return toscaIsFunction(function) or Ref.isRef(function)
functions.is_function = is_function
def findStandardInterface(op):
if op in StatefulEntityType.interfaces_node_lifecycle_operations:
return "Standard"
elif op in ["check", "discover", "revert"]:
return "Install"
elif op in StatefulEntityType.interfaces_relationship_configure_operations:
return "Configure"
else:
return ""
def createDefaultTopology():
tpl = dict(
tosca_definitions_version=TOSCA_VERSION,
topology_template=dict(
node_templates={"_default": {"type": "tosca.nodes.Root"}},
relationship_templates={"_default": {"type": "tosca.relationships.Root"}},
),
)
return ToscaTemplate(yaml_dict_tpl=tpl)
class ToscaSpec(object):
ConfiguratorType = "unfurl.nodes.Configurator"
InstallerType = "unfurl.nodes.Installer"
def _overlay(self, overlays):
def _findMatches():
ExceptionCollector.start() # clears previous errors
for expression, _tpl in overlays.items():
try:
match = Ref(expression).resolveOne(
RefContext(self.topology, trace=0)
)
if not match:
continue
if isinstance(match, ResultsList):
for item in match:
yield (item, _tpl)
else:
yield (match, _tpl)
except:
ExceptionCollector.appendException(
UnfurlValidationError(
'error evaluating decorator match expression "%s"'
% expression,
True,
)
)
matches = list(_findMatches())
def _patch(m):
node = m[0]
tpl = node.toscaEntityTemplate.entity_tpl
patch = mapValue(m[1], RefContext(node, dict(template=tpl)))
return patchDict(tpl, patch, True)
return [_patch(m) for m in matches]
def _parseTemplate(self, path, inputs, toscaDef, resolver):
# need to set a path for the import loader
self.template = ToscaTemplate(
path=path,
parsed_params=inputs,
yaml_dict_tpl=toscaDef,
import_resolver=resolver,
verify=False,
)
self.nodeTemplates = {}
self.installers = {}
self.relationshipTemplates = {}
for template in self.template.nodetemplates:
nodeTemplate = NodeSpec(template, self)
if template.is_derived_from(self.InstallerType):
self.installers[template.name] = nodeTemplate
self.nodeTemplates[template.name] = nodeTemplate
if hasattr(self.template, "relationship_templates"):
# user-declared RelationshipTemplates, source and target will be None
for template in self.template.relationship_templates:
relTemplate = RelationshipSpec(template, self)
self.relationshipTemplates[template.name] = relTemplate
self.loadImportedDefaultTemplates()
self.topology = TopologySpec(self, inputs)
self.loadWorkflows()
self.groups = {
g.name: GroupSpec(g, self) for g in self.template.topology_template.groups
}
self.policies = {
p.name: PolicySpec(p, self)
for p in self.template.topology_template.policies
}
def __init__(
self,
toscaDef,
spec=None,
path=None,
resolver=None,
):
self.discovered = None
if spec:
inputs = spec.get("inputs")
else:
inputs = None
if isinstance(toscaDef, ToscaTemplate):
self.template = toscaDef
else:
topology_tpl = toscaDef.get("topology_template")
if not topology_tpl:
toscaDef["topology_template"] = dict(
node_templates={}, relationship_templates={}
)
if spec:
self.loadInstances(toscaDef, spec)
logger.info("Validating TOSCA template at %s", path)
self._parseTemplate(path, inputs, toscaDef, resolver)
decorators = self.loadDecorators()
if decorators:
# copy errors before we clear them in _overlay
errorsSoFar = ExceptionCollector.exceptions[:]
self._overlay(decorators)
if ExceptionCollector.exceptionsCaught():
# abort if overlay caused errors
# report previously collected errors too
ExceptionCollector.exceptions[:0] = errorsSoFar
message = "\n".join(
ExceptionCollector.getExceptionsReport(
getLogLevel() < logging.INFO
)
)
raise UnfurlValidationError(
"TOSCA validation failed for %s: \n%s" % (path, message),
ExceptionCollector.getExceptions(),
)
# overlay modifies tosaDef in-place, try reparsing it
self._parseTemplate(path, inputs, toscaDef, resolver)
if ExceptionCollector.exceptionsCaught():
message = "\n".join(
ExceptionCollector.getExceptionsReport(getLogLevel() < logging.INFO)
)
raise UnfurlValidationError(
"TOSCA validation failed for %s: \n%s" % (path, message),
ExceptionCollector.getExceptions(),
)
@property
def baseDir(self):
if self.template.path is None:
return None
return getBaseDir(self.template.path)
def _getProjectDir(self, home=False):
# hacky
if self.template.import_resolver:
manifest = self.template.import_resolver.manifest
if manifest.localEnv:
if home:
if manifest.localEnv.homeProject:
return manifest.localEnv.homeProject.projectRoot
elif manifest.localEnv.project:
return manifest.localEnv.project.projectRoot
return None
def addNodeTemplate(self, name, tpl):
nodeTemplate = self.template.topology_template.add_template(name, tpl)
nodeSpec = NodeSpec(nodeTemplate, self)
self.nodeTemplates[name] = nodeSpec
if self.discovered is None:
self.discovered = CommentedMap()
self.discovered[name] = tpl
return nodeSpec
def loadDecorators(self):
decorators = {}
for import_tpl in self.template.nested_tosca_tpls.values():
decorators.update(import_tpl.get("decorators") or {})
decorators.update(self.template.tpl.get("decorators") or {})
return decorators
def loadImportedDefaultTemplates(self):
decorators = {}
for topology in self.template.nested_topologies.values():
for nodeTemplate in topology.nodetemplates:
if (
"default" in nodeTemplate.directives
and nodeTemplate.name not in self.nodeTemplates
):
nodeSpec = NodeSpec(nodeTemplate, self)
self.nodeTemplates[nodeSpec.name] = nodeSpec
return decorators
def loadWorkflows(self):
# we want to let different types defining standard workflows like deploy
# so we need to support importing workflows
workflows = {
name: [Workflow(w)]
for name, w in self.template.topology_template.workflows.items()
}
for topology in self.template.nested_topologies.values():
for name, w in topology.workflows.items():
workflows.setdefault(name, []).append(Workflow(w))
self._workflows = workflows
def getWorkflow(self, workflow):
# XXX need api to get all the workflows with the same name
wfs = self._workflows.get(workflow)
if wfs:
return wfs[0]
else:
return None
def getRepositoryPath(self, repositoryName, file=""):
baseArtifact = Artifact(dict(repository=repositoryName, file=file), spec=self)
if baseArtifact.repository:
# may resolve repository url to local path (e.g. checkout a remote git repo)
return baseArtifact.getPath()
else:
return None
def getTemplate(self, name):
if name == "~topology":
return self.topology
elif "~c~" in name:
nodeName, capability = name.split("~c~")
nodeTemplate = self.nodeTemplates.get(nodeName)
if not nodeTemplate:
return None
return nodeTemplate.getCapability(capability)
elif "~r~" in name:
nodeName, requirement = name.split("~r~")
if nodeName:
nodeTemplate = self.nodeTemplates.get(nodeName)
if not nodeTemplate:
return None
return nodeTemplate.getRelationship(requirement)
else:
return self.relationshipTemplates.get(name)
elif "~q~" in name:
nodeName, requirement = name.split("~q~")
nodeTemplate = self.nodeTemplates.get(nodeName)
if not nodeTemplate:
return None
return nodeTemplate.getRequirement(requirement)
else:
return self.nodeTemplates.get(name)
def isTypeName(self, typeName):
return (
typeName in self.template.topology_template.custom_defs
or typeName in EntityType.TOSCA_DEF
)
def findMatchingTemplates(self, typeName):
for template in self.nodeTemplates:
if template.isCompatibleType(typeName):
yield template
def loadInstances(self, toscaDef, tpl):
"""
Creates node templates for any instances defined in the spec
.. code-block:: YAML
spec:
instances:
test:
installer: test
installers:
test:
operations:
default:
implementation: TestConfigurator
inputs:"""
node_templates = toscaDef["topology_template"]["node_templates"]
for name, impl in tpl.get("installers", {}).items():
if name not in node_templates:
node_templates[name] = dict(type=self.InstallerType, properties=impl)
else:
raise UnfurlValidationError(
'can not add installer "%s", there is already a node template with that name'
% name
)
for name, impl in tpl.get("instances", {}).items():
if name not in node_templates and impl is not None:
node_templates[name] = self.loadInstance(impl.copy())
if "discovered" in tpl:
# node templates added dynamically by configurators
self.discovered = tpl["discovered"]
for name, impl in tpl["discovered"].items():
if name not in node_templates:
node_templates[name] = impl
def loadInstance(self, impl):
if "type" not in impl:
impl["type"] = "unfurl.nodes.Default"
installer = impl.pop("install", None)
if installer:
impl["requirements"] = [{"install": installer}]
return impl
def importConnections(self, importedSpec):
# user-declared telationship templates, source and target will be None
for template in importedSpec.template.relationship_templates:
assert template.default_for # it's a default relationship template
relTemplate = RelationshipSpec(template, self)
if template.name not in self.relationshipTemplates: # not defined yet
self.relationshipTemplates[template.name] = relTemplate
_defaultTopology = createDefaultTopology()
def findProps(attributes, attributeDefs, matchfn):
if not attributes:
return
for propdef in attributeDefs.values():
if propdef.name not in attributes:
continue
match = matchfn(propdef.entry_schema_entity or propdef.entity)
if not propdef.entry_schema and not propdef.entity.properties:
# it's a simple value type
if match:
yield propdef.name, attributes[propdef.name]
continue
if not propdef.entry_schema:
# it's complex datatype
value = attributes[propdef.name]
if match:
yield propdef.name, value
elif value:
# descend into its properties
for name, v in findProps(value, propdef.entity.properties, matchfn):
yield name, v
continue
properties = propdef.entry_schema_entity.properties
if not match and not properties:
# entries are simple value types and didn't match
continue
value = attributes[propdef.name]
if not value:
continue
if propdef.type == "map":
for key, val in value.items():
if match:
yield key, val
elif properties:
for name, v in findProps(val, properties, matchfn):
yield name, v
elif propdef.type == "list":
for val in value:
if match:
yield None, val
elif properties:
for name, v in findProps(val, properties, matchfn):
yield name, v
# represents a node, capability or relationship
class EntitySpec(ResourceRef):
# XXX need to define __eq__ for spec changes
def __init__(self, toscaNodeTemplate, spec=None):
self.toscaEntityTemplate = toscaNodeTemplate
self.spec = spec
self.name = toscaNodeTemplate.name
self.type = toscaNodeTemplate.type
# nodes have both properties and attributes
# as do capability properties and relationships
# but only property values are declared
self.attributeDefs = toscaNodeTemplate.get_properties()
self.properties = {
prop.name: prop.value for prop in self.attributeDefs.values()
}
if toscaNodeTemplate.type_definition:
# add attributes definitions
attrDefs = toscaNodeTemplate.type_definition.get_attributes_def()
self.defaultAttributes = {
prop.name: prop.default
for prop in attrDefs.values()
if prop.default is not None
}
for name, aDef in attrDefs.items():
self.attributeDefs[name] = Property(
name, aDef.default, aDef.schema, toscaNodeTemplate.custom_def
)
# now add any property definitions that haven't been defined yet
# i.e. missing properties without a default and not required
props_def = toscaNodeTemplate.type_definition.get_properties_def()
for pDef in props_def.values():
if pDef.name not in self.attributeDefs:
self.attributeDefs[pDef.name] = Property(
pDef.name,
pDef.default,
pDef.schema,
toscaNodeTemplate.custom_def,
)
else:
self.defaultAttributes = {}
parent = None
def __reflookup__(self, key):
"""Make attributes available to expressions"""
if key[0] == ".":
return self._getProp(key)
if key in ["name", "type", "uri", "groups", "policies"]:
return getattr(self, key)
raise KeyError(key)
def getInterfaces(self):
return self.toscaEntityTemplate.interfaces
@property
def groups(self):
if not self.spec:
return
for g in self.spec.groups.values():
if self.name in g.members:
yield g
@property
def policies(self):
return []
def isCompatibleTarget(self, targetStr):
if self.name == targetStr:
return True
return self.toscaEntityTemplate.is_derived_from(targetStr)
def isCompatibleType(self, typeStr):
return self.toscaEntityTemplate.is_derived_from(typeStr)
@property
def uri(self):
return self.getUri()
def getUri(self):
return self.name # XXX
def __repr__(self):
return "%s('%s')" % (self.__class__.__name__, self.name)
@property
def artifacts(self):
return {}
def findOrCreateArtifact(self, nameOrTpl, path=None):
if isinstance(nameOrTpl, six.string_types):
artifact = self.artifacts.get(nameOrTpl)
if artifact:
return artifact
# name not found, assume its a file path or URL
tpl = dict(file=nameOrTpl)
else:
tpl = nameOrTpl
# create an anonymous, inline artifact
return Artifact(tpl, self, path=path)
@property
def abstract(self):
return None
@property
def directives(self):
return []
def findProps(self, attributes, matchfn):
for name, val in findProps(attributes, self.attributeDefs, matchfn):
yield name, val
@property
def baseDir(self):
if self.toscaEntityTemplate._source:
return self.toscaEntityTemplate._source
elif self.spec:
return self.spec.baseDir
else:
return None
class NodeSpec(EntitySpec):
# has attributes: tosca_id, tosca_name, state, (3.4.1 Node States p.61)
def __init__(self, template=None, spec=None):
if not template:
template = next(iter(_defaultTopology.topology_template.nodetemplates))
spec = ToscaSpec(_defaultTopology)
else:
assert spec
EntitySpec.__init__(self, template, spec)
self._capabilities = None
self._requirements = None
self._relationships = []
self._artifacts = None
def __reflookup__(self, key):
try:
return super(NodeSpec, self).__reflookup__(key)
except KeyError:
relationship = self.getRelationship(key)
if not relationship:
raise KeyError(key)
return relationship
@property
def artifacts(self):
if self._artifacts is None:
self._artifacts = {
name: Artifact(artifact, self)
for name, artifact in self.toscaEntityTemplate.artifacts.items()
}
return self._artifacts
@property
def policies(self):
if not self.spec:
return
for p in self.spec.policies.values():
if p.toscaEntityTemplate.targets_type == "groups":
# the policy has groups as members, see if this node's groups is one of them
if p.members & set(g.name for g in self.groups):
yield p
elif p.toscaEntityTemplate.targets_type == "node_templates":
if self.name in p.members:
yield p
@property
def requirements(self):
if self._requirements is None:
self._requirements = {}
nodeTemplate = self.toscaEntityTemplate
for (relTpl, req, reqDef) in nodeTemplate.relationships:
name, values = next(iter(req.items()))
reqSpec = RequirementSpec(name, reqDef, self)
if relTpl.target:
nodeSpec = self.spec.getTemplate(relTpl.target.name)
assert nodeSpec
nodeSpec.addRelationship(reqSpec)
self._requirements[name] = reqSpec
return self._requirements
def getRequirement(self, name):
return self.requirements.get(name)
def getRelationship(self, name):
req = self.requirements.get(name)
if not req:
return None
return req.relationship
@property
def relationships(self):
"""
returns a list of RelationshipSpecs that are targeting this node template.
"""
for r in self.toscaEntityTemplate.relationship_tpl:
assert r.source
# calling requirement property will ensure the RelationshipSpec is properly linked
self.spec.getTemplate(r.source.name).requirements
return self._getRelationshipSpecs()
def _getRelationshipSpecs(self):
if len(self._relationships) != len(self.toscaEntityTemplate.relationship_tpl):
# relationship_tpl is a list of RelationshipTemplates that target the node
rIds = set(id(r.toscaEntityTemplate) for r in self._relationships)
for r in self.toscaEntityTemplate.relationship_tpl:
if id(r) not in rIds:
self._relationships.append(RelationshipSpec(r, self.spec, self))
return self._relationships
def getCapabilityInterfaces(self):
idefs = [r.getInterfaces() for r in self._getRelationshipSpecs()]
return [i for elem in idefs for i in elem if i.name != "default"]
def getRequirementInterfaces(self):
idefs = [r.getInterfaces() for r in self.requirements.values()]
return [i for elem in idefs for i in elem if i.name != "default"]
@property
def capabilities(self):
if self._capabilities is None:
self._capabilities = {
c.name: CapabilitySpec(self, c)
for c in self.toscaEntityTemplate.get_capabilities_objects()
}
return self._capabilities
def getCapability(self, name):
return self.capabilities.get(name)
def addRelationship(self, reqSpec):
# find the relationship for this requirement:
for relSpec in self._getRelationshipSpecs():
# the RelationshipTemplate should have had the source node assigned by the tosca parser
# XXX this won't distinguish between more than one relationship between the same two nodes
# to fix this have the RelationshipTemplate remember the name of the requirement
if (
relSpec.toscaEntityTemplate.source
is reqSpec.parentNode.toscaEntityTemplate
):
assert not reqSpec.relationship or reqSpec.relationship is relSpec
reqSpec.relationship = relSpec
assert not relSpec.requirement or relSpec.requirement is reqSpec
relSpec.requirement = reqSpec
break
else:
msg = (
'relationship not found for requirement "%s" on "%s" targeting "%s"'
% (reqSpec.name, reqSpec.parentNode, self.name)
)
raise UnfurlValidationError(msg)
@property
def abstract(self):
for name in ("select", "substitute"):
if name in self.toscaEntityTemplate.directives:
return name
return None
@property
def directives(self):
return self.toscaEntityTemplate.directives
class RelationshipSpec(EntitySpec):
"""
Links a RequirementSpec to a CapabilitySpec.
"""
def __init__(self, template=None, spec=None, targetNode=None):
# template is a RelationshipTemplate
# It is a full-fledged entity with a name, type, properties, attributes, interfaces, and metadata.
# its connected through target, source, capability
# its RelationshipType has valid_target_types
if not template:
template = _defaultTopology.topology_template.relationship_templates[0]
spec = ToscaSpec(_defaultTopology)
else:
assert spec
EntitySpec.__init__(self, template, spec)
self.requirement = None
self.capability = None
if targetNode:
assert targetNode.toscaEntityTemplate is template.target
for c in targetNode.capabilities.values():
if c.toscaEntityTemplate is template.capability:
self.capability = c
break
else:
raise UnfurlError(
"capability %s not found in %s for %s"
% (
template.capability.name,
[c.name for c in targetNode.capabilities.values()],
targetNode.name,
)
)
@property
def source(self):
return self.requirement.parentNode if self.requirement else None
@property
def target(self):
return self.capability.parentNode if self.capability else None
def __reflookup__(self, key):
try:
return super(RelationshipSpec, self).__reflookup__(key)
except KeyError:
if self.capability:
if self.capability.parentNode.isCompatibleTarget(key):
return self.capability.parentNode
if self.capability.isCompatibleTarget(key):
return self.capability
raise KeyError(key)
def getUri(self):
suffix = "~r~" + self.name
return self.source.name + suffix if self.source else suffix
def matches_target(self, capability):
defaultFor = self.toscaEntityTemplate.default_for
if not defaultFor:
return False
nodeTemplate = capability.parentNode.toscaEntityTemplate
if (
defaultFor == self.toscaEntityTemplate.ANY
or defaultFor == nodeTemplate.name
or nodeTemplate.is_derived_from(defaultFor)
or defaultFor == capability.name
or capability.is_derived_from(defaultFor)
):
return self.toscaEntityTemplate.get_matching_capabilities(
nodeTemplate, capability.name
)
return False
class RequirementSpec(object):
"""
A Requirement shares a Relationship with a Capability.
"""
# XXX need __eq__ since this doesn't derive from EntitySpec
def __init__(self, name, req, parent):
self.source = self.parentNode = parent # NodeSpec
self.spec = parent.spec
self.name = name
self.requirements_tpl = req
self.relationship = None
# requirements_tpl may specify:
# capability (definition name or type name), node (template name or type name), and node_filter,
# relationship (template name or type name or inline relationship template)
# occurrences
@property
def artifacts(self):
return self.parentNode.artifacts
def getUri(self):
return self.parentNode.name + "~q~" + self.name
def getInterfaces(self):
return self.relationship.getInterfaces() if self.relationship else []
class CapabilitySpec(EntitySpec):
def __init__(self, parent=None, capability=None):
if not parent:
parent = NodeSpec()
capability = parent.toscaEntityTemplate.get_capabilities_objects()[0]
self.parentNode = parent
assert capability
# capabilities.Capability isn't an EntityTemplate but duck types with it
EntitySpec.__init__(self, capability, parent.spec)
self._relationships = None
self._defaultRelationships = None
@property
def parent(self):
return self.parentNode
@property
def artifacts(self):
return self.parentNode.artifacts
def getInterfaces(self):
# capabilities don't have their own interfaces
return self.parentNode.getInterfaces()
def getUri(self):
# capabilities aren't standalone templates
# this is demanagled by getTemplate()
return self.parentNode.name + "~c~" + self.name
@property
def relationships(self):
return [r for r in self.parentNode.relationships if r.capability is self]
@property
def defaultRelationships(self):
if self._defaultRelationships is None:
self._defaultRelationships = [
relSpec
for relSpec in self.spec.relationshipTemplates.values()
if relSpec.matches_target(self)
]
return self._defaultRelationships
def getDefaultRelationships(self, relation=None):
if not relation:
return self.defaultRelationships
return [
relSpec
for relSpec in self.defaultRelationships
if relSpec.isCompatibleType(relation)
]
class TopologySpec(EntitySpec):
# has attributes: tosca_id, tosca_name, state, (3.4.1 Node States p.61)
def __init__(self, spec=None, inputs=None):
if spec:
self.spec = spec
template = spec.template.topology_template
else:
template = _defaultTopology.topology_template
self.spec = ToscaSpec(_defaultTopology)
self.spec.topology = self
inputs = inputs or {}
self.toscaEntityTemplate = template
self.name = "~topology"
self.type = "~topology"
self.inputs = {
input.name: inputs.get(input.name, input.default)
for input in template.inputs
}
self.outputs = {output.name: output.value for output in template.outputs}
self.properties = {}
self.defaultAttributes = {}
self.attributeDefs = {}
self.capabilities = []
def getInterfaces(self):
# doesn't have any interfaces
return []
def isCompatibleTarget(self, targetStr):
if self.name == targetStr:
return True
return False
def isCompatibleType(self, typeStr):
return False
@property
def baseDir(self):
return self.spec.baseDir
def __reflookup__(self, key):
"""Make attributes available to expressions"""
try:
return super(TopologySpec, self).__reflookup__(key)
except KeyError:
nodeTemplates = self.spec.nodeTemplates
nodeSpec = nodeTemplates.get(key)
if nodeSpec:
return nodeSpec
matches = [n for n in nodeTemplates.values() if n.isCompatibleType(key)]
if not matches:
raise KeyError(key)
return matches
class Workflow(object):
def __init__(self, workflow):
self.workflow = workflow
def initialSteps(self):
preceeding = set()
for step in self.workflow.steps.values():
preceeding.update(step.on_success + step.on_failure)
return [
step for step in self.workflow.steps.values() if step.name not in preceeding
]
def getStep(self, stepName):
return self.workflow.steps.get(stepName)
def matchStepFilter(self, stepName, resource):
step = self.getStep(stepName)
if step:
return all(filter.evaluate(resource.attributes) for filter in step.filter)
return None
def matchPreconditions(self, resource):
for precondition in self.workflow.preconditions:
target = resource.root.findResource(precondition.target)
# XXX if precondition.target_relationship
if not target:
# XXX target can be a group
return False
if not all(
filter.evaluate(target.attributes) for filter in precondition.condition
):
return False
return True
class Artifact(EntitySpec):
def __init__(self, artifact_tpl, template=None, spec=None, path=None):
# 3.6.7 Artifact definition p. 84
self.parentNode = template
spec = template.spec if template else spec
if isinstance(artifact_tpl, toscaparser.artifacts.Artifact):
artifact = artifact_tpl
else:
# inline artifact
custom_defs = spec and spec.template.topology_template.custom_defs or {}
artifact = toscaparser.artifacts.Artifact(
artifact_tpl.get("file", ""), artifact_tpl, custom_defs, path
)
EntitySpec.__init__(self, artifact, spec)
self.repository = (
spec
and artifact.repository
and spec.template.repositories.get(artifact.repository)
or None
)
@property
def file(self):
return self.toscaEntityTemplate.file
@property
def baseDir(self):
if self.toscaEntityTemplate._source:
return getBaseDir(self.toscaEntityTemplate._source)
else:
return super(Artifact, self).baseDir
def getPath(self, resolver=None):
return self.getPathAndFragment(resolver)[0]
def getPathAndFragment(self, resolver=None, tpl=None):
"""
returns path, fragment
"""
tpl = self.spec and self.spec.template.tpl or tpl
if not resolver and self.spec:
resolver = self.spec.template.import_resolver
loader = toscaparser.imports.ImportsLoader(
None, self.baseDir, tpl=tpl, resolver=resolver
)
path, isFile, fragment = loader._resolve_import_template(
None, self.asImportSpec()
)
return path, fragment
def asImportSpec(self):
return dict(file=self.file, repository=self.toscaEntityTemplate.repository)
class GroupSpec(EntitySpec):
def __init__(self, template, spec):
EntitySpec.__init__(self, template, spec)
self.members = template.members
# XXX getNodeTemplates() getInstances(), getChildren()
@property
def memberGroups(self):
return [self.spec.groups[m] for m in self.members if m in self.spec.groups]
@property
def policies(self):
if not self.spec:
return
for p in self.spec.policies.values():
if p.toscaEntityTemplate.targets_type == "groups":
if self.name in p.members:
yield p
class PolicySpec(EntitySpec):
def __init__(self, template, spec):
EntitySpec.__init__(self, template, spec)
self.members = set(template.targets_list)
|
#! /bin/bash
for idx in {1..1}
do
filename='test'
filename=$filename${idx}
filename=$filename'.yaml'
echo ${filename}
k apply -f ${filename}
done
|
using System.Collections.Generic;
using MyE.Entity;
namespace MyE.Service.implementation
{
public class MachineReviewService : IMachineReviewService
{
private IMachineReviewService machineReviewRepository;
public MachineReviewService(IMachineReviewService machineReviewRepository)
{
this.machineReviewRepository = machineReviewRepository;
}
public bool Delete(int id)
{
return this.machineReviewRepository.Delete(id);
}
public MachineReview Get(int id)
{
return this.machineReviewRepository.Get(id);
}
public IEnumerable<MachineReview> GetAll()
{
return this.machineReviewRepository.GetAll();
}
public bool Save(MachineReview entity)
{
return this.machineReviewRepository.Save(entity);
}
public bool Update(MachineReview entity)
{
return this.machineReviewRepository.Update(entity);
}
}
}
|
package models
import java.util.UUID
import com.datastax.driver.core.Row
import com.websudos.phantom.dsl._
import helpers.ExtLong._
import helpers._
import models.cassandra._
import play.api.libs.iteratee.Enumerator
import play.api.libs.json._
import scala.concurrent.Future
/**
* @author zepeng.li@gmail.com
*/
case class AccessControlEntry(
resource: String,
permission: Long,
principal_id: UUID,
is_group: Boolean
)
extends HasID[String] {
override def id = AccessControlEntry.genId(resource, principal_id)
def save(implicit repo: AccessControls) = repo.save(this)
}
trait AccessControlCanonicalNamed extends CanonicalNamed {
override val basicName = "access_controls"
}
sealed class AccessControlTable
extends NamedCassandraTable[AccessControlTable, AccessControlEntry]
with AccessControlCanonicalNamed {
object principal_id
extends UUIDColumn(this)
with PartitionKey[UUID]
object resource
extends StringColumn(this)
with PrimaryKey[String]
object is_group
extends BooleanColumn(this)
with PrimaryKey[Boolean]
object permission
extends LongColumn(this)
override def fromRow(r: Row): AccessControlEntry = {
AccessControlEntry(
resource(r),
permission(r),
principal_id(r),
is_group(r)
)
}
}
object AccessControlEntry
extends AccessControlCanonicalNamed
with ExceptionDefining {
case class NotFound(id: UUID, resource: String)
extends BaseException(error_code("not.found"))
implicit val jsonFormat = Format[AccessControlEntry](
Json.reads[AccessControlEntry],
new Writes[AccessControlEntry] {
override def writes(o: AccessControlEntry): JsValue =
Json.obj(
"resource" -> o.resource,
"permission" -> o.permission.toIndices,
"principal_id" -> o.principal_id,
"is_group" -> o.is_group
)
}
)
def genId(
resource: String,
principal: UUID
) = s"${principal.toString}/$resource"
}
class AccessControls(
implicit
val basicPlayApi: BasicPlayApi,
val keySpaceDef: KeySpaceDef
)
extends AccessControlTable
with EntityTable[AccessControlEntry]
with ExtCQL[AccessControlTable, AccessControlEntry]
with BasicPlayComponents
with CassandraComponents
with BootingProcess
with Logging {
onStart(CQL(create.ifNotExists).future())
def find(ace: AccessControlEntry): Future[AccessControlEntry] = find(ace.principal_id, ace.resource)
def find(
principal_id: UUID,
resource: String
): Future[AccessControlEntry] = {
CQL {
select
.where(_.principal_id eqs principal_id)
.and(_.resource eqs resource)
}.one().map {
case Some(ace) => ace
case None => throw AccessControlEntry.NotFound(principal_id, resource)
}
}
def findPermission(resource: String, uid: UUID): Future[Option[Long]] = {
CQL {
select(_.permission)
.where(_.principal_id eqs uid)
.and(_.resource eqs resource)
.and(_.is_group eqs false)
}.one()
}
def findPermissions(resource: String, gids: Set[UUID]): Future[List[Long]] = {
CQL {
select(_.permission)
.where(_.principal_id in gids.toList)
.and(_.resource eqs resource)
.and(_.is_group eqs true)
}.fetch()
}
def save(ace: AccessControlEntry): Future[AccessControlEntry] =
CQL {
update.where(_.principal_id eqs ace.principal_id)
.and(_.resource eqs ace.resource)
.and(_.is_group eqs ace.is_group)
.modify(_.permission setTo ace.permission)
}.future().map { _ => ace }
def remove(
principal: UUID,
resource: String
): Future[ResultSet] =
CQL {
delete.where(_.principal_id eqs principal)
.and(_.resource eqs resource)
}.future()
def all: Enumerator[AccessControlEntry] =
CQL(select).fetchEnumerator
def isEmpty: Future[Boolean] = CQL(select).one.map(_.isEmpty)
override def sortable: Set[SortableField] = Set(principal_id, resource)
}
trait AccessControl[P, A, R] {
def canAccess: Boolean
def canAccessAsync: Future[Boolean] = Future.successful(canAccess)
def principal: P
def access: A
def resource: R
}
object AccessControl extends AccessControlCanonicalNamed {
abstract class Denied[P, A, R](prefix: String)
extends BaseException(s"$prefix.permission.denied")
with AccessControl[P, A, R] {
final override def canAccess = false
}
}
|
import scala.reflect.ClassTag
package object scalan {
/** Allows implicit resolution to find appropriate instance of ClassTag in
* the scope where RType is implicitly available. */
implicit def rtypeToClassTag[A](implicit t: RType[A]): ClassTag[A] = t.classTag
/** Immutable empty array of integers, should be used instead of allocating new empty arrays. */
val EmptyArrayOfInt = Array.empty[Int]
/** Immutable empty Seq[Int] backed by empty array.
* You should prefer using it instead of `Seq[Int]()` or `Seq.empty[Int]`
*/
val EmptySeqOfInt: Seq[Int] = EmptyArrayOfInt
/** Create a new empty buffer around pre-allocated empty array.
* This method is preferred, rather that creating empty debox.Buffer directly
* because it allows to avoid allocation of the empty array.
*/
def emptyDBufferOfInt: debox.Buffer[Int] = debox.Buffer.unsafe(EmptyArrayOfInt)
}
|
Working with Docker and Google Cloud Container Registry
=======================================================
#### Create the image
First create the jar by running:
```
mvn package
```
Build the docker image:
```
docker build -t spring-boot-containerized .
```
Tag your image, to push it to [Google Cloud Container Registry](https://cloud.google.com/container-registry/)
The registry name format is `[HOSTNAME]/[PROJECT-ID]/[IMAGE]` where:
- `[HOSTNAME]` is the gcr.io hostname
- `[PROJECT-ID]` is your Google Cloud Platform Console project ID
- `[IMAGE]` is your image's name
Run
```
docker tag [IMAGE] [HOSTNAME]/[PROJECT-ID]/[IMAGE]
```
to tag your Docker image. For example:
```
docker tag spring-boot-containerized gcr.io/my-project/spring-boot-containerized
```
To push your image to Container Registry, run:
```
gcloud docker -- push [HOSTNAME]/[PROJECT-ID]/[IMAGE]
```
for example:
```
gcloud docker -- push gcr.io/my-project/spring-boot-containerized
```
#### Test image
To test locally that your image works as expected, pull it from Container Registry and run it locally.
To pull it run:
```
gcloud docker -- pull [HOSTNAME]/[PROJECT-ID]/[IMAGE]
```
To run an it:
```
docker run -p 80:8080 [HOSTNAME]/[PROJECT-ID]/[IMAGE]
```
#### Cleanup
To remove the image from Container Registry run:
```
gcloud container images delete [HOSTNAME]/[PROJECT-ID]/[IMAGE]
```
|
using System.Collections.Generic;
using JetBrains.Annotations;
using Newtonsoft.Json;
namespace VimeoDotNet.Models
{
/// <summary>
/// Upload ticket
/// </summary>
public class TusResumableUploadTicket : Video
{
/// <summary>
/// Upload status
/// </summary>
[PublicAPI]
[JsonProperty(PropertyName = "upload")]
public ResumableUploadStatus Upload { get; set; }
}
public class ResumableUploadStatus
{
/// <summary>
/// Upload Approach
/// </summary>
[PublicAPI]
[JsonProperty(PropertyName = "approach")]
public string Approach { get; set; }
/// <summary>
/// Upload Status
/// </summary>
[PublicAPI]
[JsonProperty(PropertyName = "status")]
public string Status { get; set; }
/// <summary>
/// Upload link
/// </summary>
[PublicAPI]
[JsonProperty(PropertyName = "upload_link")]
public string UploadLink { get; set; }
/// <summary>
/// Video Size in bytes
/// </summary>
[PublicAPI]
[JsonProperty(PropertyName = "size")]
public long Size { get; set; }
}
}
|
/*
* Copyright 2007 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
*
* 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.
*/
function principalNameLookup( userIdField ) {
var userIdFieldName = userIdField.name;
var elPrefix = findElPrefix( userIdFieldName );
var userNameFieldName = elPrefix + ".name";
var universalIdFieldName = findElPrefix( elPrefix ) + ".principalId";
loadPrincipalInfo( userIdFieldName, universalIdFieldName, userNameFieldName );
}
function loadPrincipalInfo( userIdFieldName, universalIdFieldName, userNameFieldName ) {
var userId = dwr.util.getValue( userIdFieldName ).trim();
if (userId == "") {
clearRecipients( universalIdFieldName );
clearRecipients( userNameFieldName );
} else {
var dwrReply = {
callback:function(data) {
if ( data != null && typeof data == 'object' ) {
setRecipientValue( universalIdFieldName, data.principalId );
setRecipientValue( userNameFieldName, data.name );
} else {
clearRecipients( universalIdFieldName );
setRecipientValue( userNameFieldName, wrapError( "User Name not found" ), true );
} },
errorHandler:function( errorMessage ) {
clearRecipients( universalIdFieldName );
setRecipientValue( userNameFieldName, wrapError( "user Name not found" ), true );
}
};
PersonService.getPersonByPrincipalName( userId, dwrReply );
}
}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../util/logger.h"
#define READ_SIZE 100
static char *work_dir = NULL;
// Prototypes.
static short file_exists(const char *file);
static inline const char *set_path(const char *file_name);
// Sets directory to work in.
void set_dir(const char *dir)
{
work_dir = malloc(strlen(dir) + 1);
strcpy(work_dir, dir);
}
// Creates a new file if it doesn't already exist.
short fs_create_file(const char *file)
{
FILE *f = fopen(set_path(file), "w");
short ret = f != NULL;
if (f != NULL)
fclose(f);
return ret;
}
// Deletes a file if it exists.
void fs_delete_file(const char *file)
{
const char *path = set_path(file);
if (file == NULL || !file_exists(path))
return;
char *command = malloc(strlen(path) + 5);
sprintf(command, "rm %s", path);
system(command);
free(command);
}
// Writes to file.
long fs_write_file(const char *file, const void *buffer, unsigned long size, short isappend)
{
const char *path = set_path(file);
if (file == NULL || (isappend && !file_exists(path)))
return -1;
else if (!file_exists(path))
fs_create_file(file);
FILE *f = fopen(path, isappend ? "a" : "w");
if (f == NULL)
{
#if defined(VERBOSE_1) || defined(VERBOSE_2)
logger(ERROR, COMP_DEFAULT, "Could not open file for writing of appending.");
#endif
return -1;
}
unsigned long written = fprintf(f, "%s", (char *) buffer);
fclose(f);
return written;
}
// Reads all content in file.
void *fs_read_file(const char *file)
{
FILE *f = fopen(set_path(file), "r");
if (f == NULL)
{
#if defined(VERBOSE_1) || defined(VERBOSE_2)
logger(ERROR, COMP_DEFAULT, "Could not open file for reading.");
#endif
return NULL;
}
char *buffer = malloc(READ_SIZE);
int c;
unsigned long counter = 0;
while ((c = getc(f)) != EOF)
{
if (c % READ_SIZE == 0)
buffer = realloc(buffer, READ_SIZE + counter);
buffer[counter++] = c;
}
return buffer;
}
// Checks whether a given file exists.
static short file_exists(const char *file)
{
FILE *f = fopen(file, "r");
if (f == NULL)
return 0;
fclose(f);
return 1;
}
// Appends working directory to file name if set.
static inline const char *set_path(const char *file_name)
{
if (file_name == NULL)
return NULL;
else if (work_dir == NULL)
return file_name;
char *appended = malloc(strlen(work_dir) + strlen(file_name) + 2);
sprintf(appended, "%s/%s", work_dir, file_name);
return appended;
}
|
<#
.SYNOPSIS
Get service list from HashTable
.DESCRIPTION
Extract the services from the list of entries in the HashTable
.PARAMETER AllAxServices
Instruct the cmdlet to return all services
.PARAMETER Aos
Instruct the cmdlet to return AOS
.PARAMETER ManagementReporter
Instruct the cmdlet to return ManagementReporter
.PARAMETER DIXF
Instruct the cmdlet to return DIXF
.EXAMPLE
PS C:\> Get-ServiceList -All
This will return all services that the cmdlet knows about.
.NOTES
Author: Mötz Jensen (@Splaxi)
#>
Function Get-ServiceList {
[CmdletBinding(DefaultParameterSetName = 'Default')]
param (
[Parameter(Mandatory = $false, ParameterSetName = 'Default', Position = 1 )]
[switch] $AllAxServices,
[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 2 )]
[switch] $Aos,
[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 3 )]
[switch] $ManagementReporter,
[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 4 )]
[switch] $DIXF
)
if ($PSCmdlet.ParameterSetName -eq "Specific") {
$AllAxServices = $false
}
Write-PSFMessage -Level Verbose -Message "The PSBoundParameters was" -Target ($PSBoundParameters.Keys -Join "," )
$mrProcessName = "MR2012ProcessService"
$mrApplicationName = "MR2012ApplicationService"
$dixfName = "Microsoft.Dynamics.AX.Framework.Tools.DMF.SSISHelperService.exe"
[System.Collections.ArrayList]$Services = New-Object -TypeName "System.Collections.ArrayList"
if ($AllAxServices) {
for ($i = 1; $i -lt 100; $i++) {
$null = $Services.Add("AOS60`$$($i.ToString("00"))")
}
$null = $Services.AddRange(@($mrProcessName, $mrApplicationName, $dixfName))
}
else {
if ($Aos) {
for ($i = 1; $i -lt 100; $i++) {
$null = $Services.Add("AOS60`$$($i.ToString("00"))")
}
}
if ($ManagementReporter) {
$null = $Services.Add($mrProcessName)
$null = $Services.Add($mrApplicationName)
}
if ($DIXF) {
$null = $Services.Add($dixfName)
}
}
$Services.ToArray()
}
|
class analyser_crystal:
def __init__(self,base_indicies):
self.base_indicies = base_indicies
def set_harmonic_list(self,harmonic_list):
self.harmonic_list = harmonic_list
def get_harmonic_list(self):
return self.harmonic_list
|
rm -Rf build
mkdir build
cd build &&
cmake ../src/dsp_server_c -DCMAKE_BUILD_TYPE=Debug
make
cd ..
|
<?php
namespace JTMcC\AtomicDeployments\Services;
use JTMcC\AtomicDeployments\Exceptions\ExecuteFailedException;
class Exec
{
/**
* @param string $command
* @param array $arguments
*
* @throws ExecuteFailedException
*
* @return string
*/
private static function run(string $command, array $arguments = [])
{
$arguments = array_map(fn ($argument) => escapeshellarg($argument), $arguments);
$command = escapeshellcmd(count($arguments) ? sprintf($command, ...$arguments) : $command);
$output = [];
$status = null;
$result = trim(exec($command, $output, $status));
//non zero status means execution failed
//see https://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/exitcodes.html
if ($status) {
throw new ExecuteFailedException("resulted in exit code {$status}");
}
return $result;
}
/**
* @param $link
*
* @throws ExecuteFailedException
*
* @return string
*/
public static function readlink($link)
{
return self::run('readlink -f %s', [$link]);
}
/**
* @param string $link
* @param string $path
*
* @throws ExecuteFailedException
*
* @return string
*/
public static function ln(string $link, string $path)
{
return self::run('ln -sfn %s %s', [$path, $link]);
}
/**
* @param string $from
* @param string $to
*
* @throws ExecuteFailedException
*
* @return string
*/
public static function rsync(string $from, string $to)
{
return self::run('rsync -aW --no-compress %s %s', [$from, $to]);
}
/**
* @throws ExecuteFailedException
*
* @return string
*/
public static function getGitHash()
{
return self::run('git log --pretty="%h" -n1');
}
}
|
package com.palmlang.palm.common
interface Query<in Key, Value> {
operator fun get(key: Key): Value
}
class ComputedQuery<Key, Value>(private val computeFn: ComputedQuery<Key, Value>.(Key) -> Value) : Query<Key, Value> {
private val map = HashMap<Key, Value>()
override fun get(key: Key): Value = map.computeIfAbsent(key) { computeFn(key) }
}
class DependantQuery<Key, Value>(private val invokeSetFn: (Key) -> Unit) : Query<Key, Value> {
val backing = HashMap<Key, Value>()
override fun get(key: Key): Value {
invokeSetFn(key)
return backing[key]!!
}
}
class ComputedCyclicQuery<Key, Value>(private val computeFn: (Key) -> Value) : Query<Key, Value?> {
private val map = HashMap<Key, Value?>()
override fun get(key: Key): Value? = if (key in map) map[key] else {
map[key] = null
computeFn(key).also { map[key] = it }
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SphereShield : MonoBehaviour
{
public float targetSize = 20f;
public AnimationCurve animationCurve;
private bool _isCasting = false;
private float _timer = 0f;
public void Cast()
{
_isCasting = true;
}
private void Update()
{
transform.localScale = Vector3.Lerp(Vector3.zero, Vector3.one * targetSize, animationCurve.Evaluate(_timer));
if (!_isCasting)
{
_timer = 0f;
}
else
{
_timer += Time.deltaTime * 5f;
}
if (_timer > 1f)
{
_timer = 0f;
_isCasting = false;
}
}
void OnTriggerStay(Collider other)
{
Destroy(other.gameObject);
}
}
|
/*
* Copyright cp-ddd-framework Authors.
*
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.github.dddplus.ext;
import io.github.dddplus.model.IDomainModel;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 用于编排领域步骤的扩展点.
*/
public interface IDecideStepsExt extends IDomainExtension {
/**
* 根据领域模型和领域活动码决定需要执行哪些领域步骤.
*
* @param model 领域模型
* @param activityCode 领域活动码
* @return step code list
*/
@NotNull
List<String> decideSteps(@NotNull IDomainModel model, @NotNull String activityCode);
}
|
# eslint-config-mg
This package is inspired by Airbnb Eslint with customizations for what I need.
## Usage
1. Install the correct versions of each package, which are listed by the command:
```sh
npx install-peerdeps --dev eslint-config-mg
```
Note: The peer dependency `babel-eslint` is just needed if you use `mg/babel`.
2. Add `"extends": "mg"` to your .eslintrc.
### Usage options
- You can extend `mg` or `mg/base` to just import javascript related rules.
- You can extend `mg/react` to import react related rules.
- You can extend `mg/babel` to import base related rules that supports babel.
Note: When using `mg/babel` you will need to have "babel-eslint` installed as well. It is a peer dependency.
|
import React from 'react'
import { Link, graphql } from 'gatsby'
import Layout from '../components/layout'
import Head from '../components/head'
import Box from '../components/box'
import ProposalBox from '../components/proposal/box'
import Covid19SupportBox from '../components/covid-19-support/box'
import styled from 'styled-components'
import Img from 'gatsby-image'
import { IndexPageQuery } from '../../types/graphql-types'
type Props = {
data: IndexPageQuery
}
const Component: React.FC<Props> = ({ data }) => {
const file = data.file
const pages = data.pages.edges
const posts = data.posts.edges
const proposals = pages.filter(page =>
page.node.fields.slug.match('/proposals/')
)
const covid = pages.filter(page =>
page.node.fields.slug.match('/covid-19-support/')
)
return (
<Layout>
<Head />
<FV>
<FVSub>頼れる街の法律家</FVSub>
<h1>安心できる老後へ</h1>
<Img className="top-eyecatch" fluid={file.childImageSharp.fluid} />
<FVText>
しおかぜ事務所は、<em>成年後見</em>、<em>遺言</em>、<em>事務委任</em>
、<em>信託</em>
などを利用して、安心してすごせる老後へとサポートする行政書士事務所です。
</FVText>
</FV>
<Container>
<Header>
<h2>新型コロナ対応支援</h2>
<p>
新型コロナウイルスによって影響を受けている方々に向けて、各省庁や地方自治体が行っている支援を
まとめました。
</p>
</Header>
<Body>
{covid.map((entry, i) => (
<Covid19SupportBox key={entry.node.id} num={('00'+(1+i)).slice(-2)} attributes={entry} />
))}
</Body>
</Container>
<Container>
<Header>
<h2>私たちからのご提案</h2>
<p>老後の生活に不安や不便を感じるすべての方へ、お客様にあったご提案をします。</p>
</Header>
<Body2Col>
{proposals.map(proposal => (
<ProposalBox key={proposal.node.id} attributes={proposal} />
))}
</Body2Col>
<Footer>
<Link to="/proposals">ご提案の一覧へ</Link>
</Footer>
</Container>
<Container>
<Header>
<h2>ブログ</h2>
<p>日常業務でのちょっとした気づきなどを中心に書きます</p>
</Header>
<Body>
{posts.map(post => (
<Box key={post.node.id} attributes={post} />
))}
</Body>
<Footer>
<Link to="/blog">ブログの一覧へ</Link>
</Footer>
</Container>
</Layout>
)
}
export const query = graphql`
query IndexPage {
file(relativePath: { eq: "images/top.png" }) {
childImageSharp {
fluid(maxWidth: 600) {
...GatsbyImageSharpFluid
}
}
}
pages: allMarkdownRemark(
filter: { fields: { slug: { regex: "/(proposals|covid)/" } } }
sort: { order: DESC, fields: [frontmatter___date] }
) {
edges {
node {
id
timeToRead
excerpt(truncate: true, pruneLength: 100)
fields {
slug
}
frontmatter {
title
lead
tags
featuredImage {
childImageSharp {
fluid(maxWidth: 600) {
...GatsbyImageSharpFluid
}
}
}
}
}
}
}
posts: allMarkdownRemark(
filter: { fields: { slug: { regex: "/blog/" } } }
sort: { order: DESC, fields: [frontmatter___date] }
limit: 3
) {
edges {
node {
id
timeToRead
excerpt(truncate: true, pruneLength: 50)
fields {
slug
}
frontmatter {
date(formatString: "YYYY年MM月DD日")
title
lead
featuredImage {
childImageSharp {
fluid(maxWidth: 600) {
...GatsbyImageSharpFluid
}
}
}
}
}
}
}
}
`
const FV = styled.div`
padding: 0 var(--gutter) 2rem;
h1 {
text-align: center;
padding: 0;
}
picture {
max-width: 800px;
margin: 0;
}
.top-eyecatch {
max-width: 800px;
margin: 0 auto 2.5rem;
}
`
const FVSub = styled.p`
text-align: center;
margin: 3rem 0 -1rem;
padding: 0;
font-family: 'Noto Serif JP', serif;
color: #999;
letter-spacing: 0.5rem;
font-size: .9rem;
`
const FVText = styled.p`
max-width: 640px;
margin: 0 auto;
`
const Container = styled.section`
margin-top: 6.25rem;
margin-bottom: 15.625rem;
`
const Header = styled.div`
padding: 0 var(--gutter);
`
const Body = styled.div`
margin-top: 1.875rem;
border-top: 1px solid rgb(0, 0, 0);
display: grid;
grid-template-columns: repeat(3, 1fr);
@media screen and (max-width:480px) {
grid-template-columns: 1fr;
border-left: 1px solid rgb(0, 0, 0);
border-right: 1px solid rgb(0, 0, 0);
margin-left: var(--gutter);
margin-right: var(--gutter);
}
`
const Body2Col = styled(Body)`
grid-template-columns: repeat(2, 1fr);
`
const Footer = styled.div`
border-bottom: 1px solid #000;
a {
font-size: 1.6rem;
padding: 2rem;
display: block;
text-align: center;
font-weight: bold;
}
@media screen and (max-width:480px) {
border-bottom: 0;
}
`
export default Component
|
DROP DATABASE IF EXISTS sampletest;
CREATE DATABASE sampletest;
\connect sampletest
GRANT ALL PRIVILEGES ON DATABASE sampleTest TO sample_owner;
|
import { Component, OnInit, OnDestroy, HostListener, AfterViewInit } from "@angular/core";
import { User } from "./_models";
import { ActivatedRoute, Router } from "@angular/router";
import { AuthenticationService } from "./_services";
import { Subject, Subscription } from "rxjs";
import {
animate,
stagger,
state,
style,
transition,
trigger,
} from "@angular/animations";
import { takeUntil } from "rxjs/operators";
@Component({
selector: "app-admin",
templateUrl: "./admin.component.html",
styleUrls: ["./admin.component.scss"],
animations: [
trigger("slideInOut", [
transition(":enter", [
style({ height: 0 }),
animate(100, style({ height: "*" })),
]),
transition(":leave", [animate(200, style({ height: 0 }))]),
]),
trigger("fadeInOut", [
transition(":enter", [
style({ opacity: 0 }),
animate(200, style({ opacity: 1 })),
]),
transition(":leave", [animate(200, style({ opacity: 0 }))]),
]),
trigger("slideInOutFromLeft", [
transition(":enter", [
style({
opacity: "0",
transform: "translateX(-100%)",
}),
animate(
200,
style({
opacity: 1,
transform: "translateX(0)",
})
),
]),
transition(":leave", [
animate(200, style({ opacity: 0, transform: "translateX(-100%)" })),
]),
]),
],
})
export class AdminComponent implements OnInit, OnDestroy, AfterViewInit {
destroyed$: Subject<boolean> = new Subject();
innerWidth: any;
sideNavVisible: boolean;
sideNavFloating = false;
currentUser: User;
constructor(
private router: Router,
private auth: AuthenticationService
) {
this.auth.currentUser
.pipe(takeUntil(this.destroyed$))
.subscribe((x) => (this.currentUser = x));
}
@HostListener("window:resize", ["$event"])
onResize(event) {
this.innerWidth = window.innerWidth;
if (this.innerWidth <= 768) {
this.sideNavVisible = false;
this.sideNavFloating = true;
} else {
this.sideNavVisible = true;
this.sideNavFloating = false;
}
}
toggleSideNav() {
this.sideNavVisible = !this.sideNavVisible;
}
logout() {
this.auth.logout();
this.router.navigate(["/admin/login"]);
}
ngOnInit() {
this.innerWidth = window.innerWidth;
if (this.innerWidth <= 768) {
this.sideNavVisible = false;
this.sideNavFloating = true;
} else {
this.sideNavVisible = true;
this.sideNavFloating = false;
}
}
ngAfterViewInit() {
}
ngOnDestroy() {
this.destroyed$.next(true);
this.destroyed$.complete();
}
}
|
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "openssl_rsa_helper.h"
#include "hks_rsa_common_mt.h"
#include <string>
#include <vector>
#include <gtest/gtest.h>
#include "hks_api.h"
#include "hks_mem.h"
using namespace testing::ext;
namespace OHOS {
namespace Security {
namespace Huks {
namespace MT {
namespace {
const int SET_SIZE_4096 = 4096;
const int KEY_SIZE_512 = 512;
const int KEY_SIZE_768 = 768;
const int KEY_SIZE_1024 = 1024;
const int KEY_SIZE_2048 = 2048;
const int KEY_SIZE_3072 = 3072;
const SignLocalCaseParams HKS_RSA_MT_26500_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_512 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignServiceCaseParams HKS_RSA_MT_26600_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_512 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY | HKS_KEY_PURPOSE_SIGN },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyLocalCaseParams HKS_RSA_MT_26700_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_512 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyServiceCaseParams HKS_RSA_MT_26800_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_512 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.keySize = KEY_SIZE_512,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignLocalCaseParams HKS_RSA_MT_26900_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_768 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignServiceCaseParams HKS_RSA_MT_27000_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_768 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY | HKS_KEY_PURPOSE_SIGN },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyLocalCaseParams HKS_RSA_MT_27100_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_768 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyServiceCaseParams HKS_RSA_MT_27200_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_768 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.keySize = KEY_SIZE_768,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignLocalCaseParams HKS_RSA_MT_27300_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_1024 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignServiceCaseParams HKS_RSA_MT_27400_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_1024 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY | HKS_KEY_PURPOSE_SIGN },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyLocalCaseParams HKS_RSA_MT_27500_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_1024 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyServiceCaseParams HKS_RSA_MT_27600_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_1024 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.keySize = KEY_SIZE_1024,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignLocalCaseParams HKS_RSA_MT_27700_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_2048 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignServiceCaseParams HKS_RSA_MT_27800_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_2048 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY | HKS_KEY_PURPOSE_SIGN },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyLocalCaseParams HKS_RSA_MT_27900_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_2048 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyServiceCaseParams HKS_RSA_MT_28000_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_2048 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.keySize = KEY_SIZE_2048,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignLocalCaseParams HKS_RSA_MT_28100_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_3072 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignServiceCaseParams HKS_RSA_MT_28200_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_3072 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY | HKS_KEY_PURPOSE_SIGN },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyLocalCaseParams HKS_RSA_MT_28300_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_3072 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyServiceCaseParams HKS_RSA_MT_28400_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_3072 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.keySize = KEY_SIZE_3072,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignLocalCaseParams HKS_RSA_MT_28500_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_4096 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const SignServiceCaseParams HKS_RSA_MT_28600_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_4096 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY | HKS_KEY_PURPOSE_SIGN },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyLocalCaseParams HKS_RSA_MT_28700_PARAMS = {
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_TEMP },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_4096 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_SIGN | HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = false },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
const VerifyServiceCaseParams HKS_RSA_MT_28800_PARAMS = {
.alias = "This is a test auth id for NONE",
.params =
{
{ .tag = HKS_TAG_KEY_STORAGE_FLAG, .uint32Param = HKS_STORAGE_PERSISTENT },
{ .tag = HKS_TAG_ALGORITHM, .uint32Param = HKS_ALG_RSA },
{ .tag = HKS_TAG_KEY_SIZE, .uint32Param = HKS_RSA_KEY_SIZE_4096 },
{ .tag = HKS_TAG_PURPOSE, .uint32Param = HKS_KEY_PURPOSE_VERIFY },
{ .tag = HKS_TAG_DIGEST, .uint32Param = HKS_DIGEST_NONE },
{ .tag = HKS_TAG_PADDING, .uint32Param = HKS_PADDING_PKCS1_V1_5 },
{ .tag = HKS_TAG_IS_KEY_ALIAS, .boolParam = true },
{ .tag = HKS_TAG_KEY_GENERATE_TYPE, .uint32Param = HKS_KEY_GENERATE_TYPE_DEFAULT },
{ .tag = HKS_TAG_BLOCK_MODE, .uint32Param = HKS_MODE_ECB },
},
.padding = RSA_PKCS1_PADDING,
.keyDigest = HKS_DIGEST_NONE,
.keySize = SET_SIZE_4096,
.generateKeyResult = HKS_SUCCESS,
.signResult = HKS_SUCCESS,
.verifyResult = HKS_SUCCESS,
};
} // namespace
class HksRsaNoneWithRsaMt : public HksRsaCommonMt, public testing::Test {};
/**
* @tc.number : HksRsaNoneWithRsaMt26500
* @tc.name : HksRsaNoneWithRsaMt26500
* @tc.desc : Test huks sign (512/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt26500, TestSize.Level1)
{
SignLocalTestCase(HKS_RSA_MT_26500_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt26600
* @tc.name : HksRsaNoneWithRsaMt26600
* @tc.desc : Test huks sign (512/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt26600, TestSize.Level1)
{
SignServiceTestCase(HKS_RSA_MT_26600_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt26700
* @tc.name : HksRsaNoneWithRsaMt26700
* @tc.desc : Test huks Verify (512/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt26700, TestSize.Level1)
{
VerifyLocalTestCase(HKS_RSA_MT_26700_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt26800
* @tc.name : HksRsaNoneWithRsaMt26800
* @tc.desc : Test huks Verify (512/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt26800, TestSize.Level1)
{
VerifyServiceTestCase(HKS_RSA_MT_26800_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt26900
* @tc.name : HksRsaNoneWithRsaMt26900
* @tc.desc : Test huks sign (768/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt26900, TestSize.Level1)
{
SignLocalTestCase(HKS_RSA_MT_26900_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt27000
* @tc.name : HksRsaNoneWithRsaMt27000
* @tc.desc : Test huks sign (768/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt27000, TestSize.Level1)
{
SignServiceTestCase(HKS_RSA_MT_27000_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt27100
* @tc.name : HksRsaNoneWithRsaMt27100
* @tc.desc : Test huks Verify (768/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt27100, TestSize.Level1)
{
VerifyLocalTestCase(HKS_RSA_MT_27100_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt27200
* @tc.name : HksRsaNoneWithRsaMt27200
* @tc.desc : Test huks Verify (768/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt27200, TestSize.Level1)
{
VerifyServiceTestCase(HKS_RSA_MT_27200_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt27300
* @tc.name : HksRsaNoneWithRsaMt27300
* @tc.desc : Test huks sign (1024/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt27300, TestSize.Level1)
{
SignLocalTestCase(HKS_RSA_MT_27300_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt27400
* @tc.name : HksRsaNoneWithRsaMt27400
* @tc.desc : Test huks sign (1024/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt27400, TestSize.Level1)
{
SignServiceTestCase(HKS_RSA_MT_27400_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt27500
* @tc.name : HksRsaNoneWithRsaMt27500
* @tc.desc : Test huks Verify (1024/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt27500, TestSize.Level1)
{
VerifyLocalTestCase(HKS_RSA_MT_27500_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt27600
* @tc.name : HksRsaNoneWithRsaMt27600
* @tc.desc : Test huks Verify (1024/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt27600, TestSize.Level1)
{
VerifyServiceTestCase(HKS_RSA_MT_27600_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt27700
* @tc.name : HksRsaNoneWithRsaMt27700
* @tc.desc : Test huks sign (2048/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt27700, TestSize.Level1)
{
SignLocalTestCase(HKS_RSA_MT_27700_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt27800
* @tc.name : HksRsaNoneWithRsaMt27800
* @tc.desc : Test huks sign (2048/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt27800, TestSize.Level1)
{
SignServiceTestCase(HKS_RSA_MT_27800_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt27900
* @tc.name : HksRsaNoneWithRsaMt27900
* @tc.desc : Test huks Verify (2048/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt27900, TestSize.Level1)
{
VerifyLocalTestCase(HKS_RSA_MT_27900_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt28000
* @tc.name : HksRsaNoneWithRsaMt28000
* @tc.desc : Test huks Verify (2048/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt28000, TestSize.Level1)
{
VerifyServiceTestCase(HKS_RSA_MT_28000_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt28100
* @tc.name : HksRsaNoneWithRsaMt28100
* @tc.desc : Test huks sign (3072/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt28100, TestSize.Level1)
{
SignLocalTestCase(HKS_RSA_MT_28100_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt28200
* @tc.name : HksRsaNoneWithRsaMt28200
* @tc.desc : Test huks sign (3072/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt28200, TestSize.Level1)
{
SignServiceTestCase(HKS_RSA_MT_28200_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt28300
* @tc.name : HksRsaNoneWithRsaMt28300
* @tc.desc : Test huks Verify (3072/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt28300, TestSize.Level1)
{
VerifyLocalTestCase(HKS_RSA_MT_28300_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt28400
* @tc.name : HksRsaNoneWithRsaMt28400
* @tc.desc : Test huks Verify (3072/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt28400, TestSize.Level1)
{
VerifyServiceTestCase(HKS_RSA_MT_28400_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt28500
* @tc.name : HksRsaNoneWithRsaMt28500
* @tc.desc : Test huks sign (4096/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt28500, TestSize.Level1)
{
SignLocalTestCase(HKS_RSA_MT_28500_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt28600
* @tc.name : HksRsaNoneWithRsaMt28600
* @tc.desc : Test huks sign (4096/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt28600, TestSize.Level1)
{
SignServiceTestCase(HKS_RSA_MT_28600_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt28700
* @tc.name : HksRsaNoneWithRsaMt28700
* @tc.desc : Test huks Verify (4096/NONEwithRSA/TEMP)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt28700, TestSize.Level1)
{
VerifyLocalTestCase(HKS_RSA_MT_28700_PARAMS);
}
/**
* @tc.number : HksRsaNoneWithRsaMt28800
* @tc.name : HksRsaNoneWithRsaMt28800
* @tc.desc : Test huks Verify (4096/NONEwithRSA/PERSISTENT)
*/
HWTEST_F(HksRsaNoneWithRsaMt, HksRsaNoneWithRsaMt28800, TestSize.Level1)
{
VerifyServiceTestCase(HKS_RSA_MT_28800_PARAMS);
}
} // namespace MT
} // namespace Huks
} // namespace Security
} // namespace OHOS
|
using Sitecore.Data.Items;
using Sitecore.Data.Managers;
using Sitecore.Data.Query;
using Sitecore.Data.Templates;
using Sitecore.Diagnostics;
using Sitecore.Exceptions;
using Sitecore.Rocks.Server.Extensibility.Composition;
using Sitecore.Rocks.Server.Extensibility.Pipelines;
using Sitecore.Rocks.Server.Extensions.QueryExtensions;
using Sitecore.Rocks.Server.Pipelines.SetFieldValue;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI;
namespace Sitecore.Rocks.Server.QueryAnalyzers.Opcodes
{
[Unexport(typeof(Sitecore.Rocks.Server.QueryAnalyzers.Opcodes.Update))]
public class RestrictedUpdate : Opcode
{
public List<ColumnExpression> ColumnExpressions { get; set; }
public Opcode From { get; set; }
public RestrictedUpdate(List<ColumnExpression> columnExpressions, Opcode from)
{
Assert.ArgumentNotNull((object)columnExpressions, "columnExpressions");
this.ColumnExpressions = columnExpressions;
this.From = from;
}
public override object Evaluate(Query query, QueryContext contextNode)
{
Assert.ArgumentNotNull((object)query, "query");
Assert.ArgumentNotNull((object)contextNode, "contextNode");
object result = (object)contextNode;
if (!Context.User.IsAdministrator)
{
throw new QueryException("You need to have admin rights to use this function");
}
Opcode from = this.From;
if (from != null)
{
result = QueryExtensions.Evaluate(query, from, contextNode);
if (result == null)
return (object)QueryExtensions.FormatItemsAffected(query, 0);
}
IEnumerable<Item> items = QueryExtensions.GetItems(query, result);
foreach (Item obj in items)
this.UpdateItem(query, obj);
return (object)QueryExtensions.FormatItemsAffected(query, Enumerable.Count<Item>(items));
}
public override void Print(HtmlTextWriter output)
{
Assert.ArgumentNotNull((object)output, "output");
this.PrintIndent(output);
this.PrintLine(output, this.GetType().Name);
if (this.From == null)
return;
++output.Indent;
this.From.Print(output);
--output.Indent;
}
private void ChangeTemplateById(Item item, string value)
{
Item obj = item.Database.GetItem(value);
Assert.IsNotNull((object)obj, "Template \"" + value + "\" not found");
item.ChangeTemplate((TemplateItem)obj);
}
private void ChangeTemplateByName(Item item, string value)
{
Template template = TemplateManager.GetTemplate(value, item.Database);
Assert.IsNotNull((object)template, "Template \"" + value + "\" not found");
Item obj = item.Database.GetItem(template.ID);
Assert.IsNotNull((object)obj, "Template \"" + value + "\" not found");
item.ChangeTemplate((TemplateItem)obj);
}
private void UpdateItem(Query query, Item item)
{
bool flag = false;
foreach (ColumnExpression columnExpression in this.ColumnExpressions)
{
string str = (string)null;
string columnName = columnExpression.ColumnName;
if (!string.IsNullOrEmpty(columnName))
{
if (columnExpression.FieldName != null)
str = item[columnExpression.FieldName];
else if (columnExpression.Expression != null)
{
object obj = QueryExtensions.EvaluateSubQuery(query, columnExpression.Expression, item);
str = obj != null ? obj.ToString() : string.Empty;
}
if (str != null)
{
if (!flag)
{
item.Editing.BeginEdit();
flag = true;
}
switch (columnName.ToLowerInvariant())
{
case "@name":
item.Name = str;
continue;
case "@templatename":
this.ChangeTemplateByName(item, str);
continue;
case "@templateid":
this.ChangeTemplateById(item, str);
continue;
default:
Pipeline<SetFieldValuePipeline>.Run().WithParameters(item, columnName, str);
continue;
}
}
}
}
if (!flag)
return;
item.Editing.EndEdit();
}
}
}
|
using System.Diagnostics.CodeAnalysis;
using EventDriven.CQRS.Abstractions.Events;
namespace CustomerService.Domain.CustomerAggregate.Events
{
[ExcludeFromCodeCoverage]
public record CustomerCreated(Customer Customer) : DomainEvent(Customer.Id);
}
|
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.actions.internal
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.project.DumbModeTask
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Key
import com.intellij.openapi.util.registry.Registry
import com.intellij.util.TimeoutUtil
import java.util.*
import kotlin.random.Random
class DumbModeTrembleAction: DumbAwareAction() {
override fun actionPerformed(e: AnActionEvent) {
val project = e.project ?: return
if (isTrembleDumb(project)) {
setTrembleDumb(project, false)
} else {
setTrembleDumb(project, true)
dumbModeTremble(project)
}
}
override fun update(e: AnActionEvent) {
val project = e.project
if (project == null) {
e.presentation.isEnabled = false
return
}
val isTrembleDumb = isTrembleDumb(project)
e.presentation.text = if (isTrembleDumb) "Disable Tremble Dumb Mode" else "Enable Tremble Dumb Mode"
}
companion object {
private fun dumbModeTremble(project: Project) {
val settings = readSettings()
ApplicationManager.getApplication().executeOnPooledThread {
LOG.info("Dumb Mode Tremble enabled")
while (isTrembleDumb(project)) {
TimeoutUtil.sleep(Random.nextLong(settings.disableMinMillis, settings.disableMaxMillis))
DumbService.getInstance(project).queueTask(object : DumbModeTask() {
override fun performInDumbMode(indicator: ProgressIndicator) {
TimeoutUtil.sleep(Random.nextLong(settings.enableMinMillis, settings.enableMaxMillis))
indicator.checkCanceled()
}
})
}
LOG.info("Dumb Mode Tremble disabled")
}
}
private data class Settings(
val disableMinMillis: Long,
val disableMaxMillis: Long,
val enableMinMillis: Long,
val enableMaxMillis: Long
)
private fun parseSettings(settingsString: String): Settings {
val numberStrings = settingsString.split("_")
if (numberStrings.size != 4) {
LOG.error("Bad $SETTING_REGISTRY_KEY value: `$numberStrings`")
return DEFAULT_SETTINGS
}
val numbers = try {
numberStrings.map { it.toLong() }
} catch (_: NumberFormatException) {
LOG.error("Can't parse longs in $SETTING_REGISTRY_KEY value: `$numberStrings`")
return DEFAULT_SETTINGS
}
val disableMinMillis = numbers[0]
val disableMaxMillis = numbers[1]
val enableMinMillis = numbers[2]
val enableMaxMillis = numbers[3]
if ((disableMinMillis in 0 until disableMaxMillis) && (enableMinMillis in 0 until enableMaxMillis)) {
return Settings(
disableMinMillis,
disableMaxMillis,
enableMinMillis,
enableMaxMillis
)
}
return DEFAULT_SETTINGS
}
private fun readSettings(): Settings {
val settingsString = try {
Registry.stringValue(SETTING_REGISTRY_KEY)
} catch (_: MissingResourceException) {
return DEFAULT_SETTINGS
}
return parseSettings(settingsString)
}
private const val SETTING_REGISTRY_KEY = "action.dumb.tremble"
private const val DEFAULT_SETTINGS_STRING = "800_2000_200_400"
private val DEFAULT_SETTINGS = parseSettings(DEFAULT_SETTINGS_STRING)
private val LOG = Logger.getInstance(DumbModeTrembleAction::class.java)
private val DUMB_TREMBLE = Key.create<Boolean>("DumbModeTrembleAction")
private fun setTrembleDumb(project: Project, value: Boolean) {
project.putUserData(DUMB_TREMBLE, value)
}
private fun isTrembleDumb(project: Project): Boolean {
return project.getUserData(DUMB_TREMBLE) === java.lang.Boolean.TRUE
}
}
}
|
/**
* @author George Foster
* @file mix_phrasetables.cc
* @brief Produce an interpolated combination of any kind of (text)
* phrasetable, using given weights.
*
* COMMENTS:
*
* Technologies langagieres interactives / Interactive Language Technologies
* Inst. de technologie de l'information / Institute for Information Technology
* Conseil national de recherches Canada / National Research Council Canada
* Copyright 2007, Sa Majeste la Reine du Chef du Canada /
* Copyright 2007, Her Majesty in Right of Canada
*/
#include <iostream>
#include <fstream>
#include "file_utils.h"
#include "str_utils.h"
#include "arg_reader.h"
#include "basicmodel.h"
#include "inputparser.h"
#include "logging.h"
using namespace Portage;
static char help_message[] = "\n\
mix_phrasetables [-vn][-s s][-w wts|-wf wtsfile][-m len][-f src] pt1 pt2 ...\n\
\n\
Produce an interpolated combination of any kind of (text) phrasetable, using\n\
given weights. The input tables <pt1>, <pt2>, etc, must have the same number of\n\
probability columns. The output table is written to stdout. It has one entry for\n\
each phrase pair that occurs in any input table. The probabilities in each\n\
column are of the form p = sum_i w_i p_i, where p_i is the entry in that column\n\
in the ith phrasetable, and w_i is the weight on that phrasetable.\n\
\n\
Options:\n\
\n\
-v Write progress reports to cerr.\n\
-n Normalize (integer) frequencies in phrasetables before combining them. This\n\
is done before filtering.\n\
-s Add smoothing count <s> to total count when normalizing [1]\n\
-w Specify a weight on each phrasetable: <wts> is a string of weights w1 w2 ...\n\
for phrasetables pt1 pt2 ... Weights can be separated by blanks or colons\n\
(don't forget quotes in the former case). [uniform values]\n\
-wf Same as -w, but read weights from file <wtsfile>.\n\
-m Apply weights only to left-column phrases of length at most <len> [no limit]\n\
-f Filter input phrasetables prior to mixing by retaining only the phrase pairs\n\
needed to translate a given source text. This assumes that source phrases\n\
are in the left column of the input phrasetables.\n\
";
// globals
static const char* sep = PHRASE_TABLE_SEP;
static Uint seplen;
static bool verbose = false;
static bool calc_norm = false;
static Uint norm_smooth = 1;
static const Uint PHRASE_LENGTH_INFINITY = 10000;
static Uint max_phrase_len = PHRASE_LENGTH_INFINITY;
static string srcname;
vector<string> pts;
vector<double> wts;
static void getArgs(int argc, char* argv[]);
template <class T>
static void parseLine(const string& pt, Uint linenum, const string& line,
string::size_type& pos, vector<T>& probs);
static void parseSourcePhrase(const string& pt, Uint linenum, const string& line,
Uint bufsize, char buf[], vector<char*>& toks);
static string getTempName();
// main
int main(int argc, char* argv[])
{
Logging::init();
seplen = strlen(sep);
assert(sep[0] == ' '); // assumed in line !!! of parseSourcePhrase()
assert(sep[seplen-1] == ' '); // assumed in line !! below
getArgs(argc, argv);
Uint num_probs = 0;
string line;
string::size_type pos;
// calculate normalization factors if normalizing
vector<Uint> freqs;
vector< vector<Uint> > norm_sums(pts.size()); // phrasetable,column -> sum of vals in column
if (calc_norm) {
for (Uint i = 0; i < pts.size(); ++i) {
iSafeMagicStream ifs(pts[i]);
norm_sums[i].assign(num_probs, norm_smooth);
Uint linenum = 0;
while (getline(ifs, line)) {
++linenum;
parseLine(pts[i], linenum, line, pos, freqs);
if (num_probs == 0) {
num_probs = freqs.size();
norm_sums[i].assign(num_probs, norm_smooth);
}
if (freqs.empty() || freqs.size() != num_probs)
error(ETFatal, "Missing or inconsistent number of frequency columns in phrasetable %s",
pts[i].c_str());
vector<Uint>::iterator it_norm = norm_sums[i].begin();
for (vector<Uint>::iterator it = freqs.begin(); it != freqs.end(); ++it, ++it_norm)
*it_norm += *it;
}
if (verbose)
cerr << "Normalized phrasetable " << pts[i] << endl;
}
}
// read in source file for filtering purposes
PhraseTable* srcphrases = NULL;
if (srcname != "") {
VectorPSrcSent sents;
CanoeConfig c;
c.loadFirst = false;
iSafeMagicStream input(srcname);
InputParser reader(input);
PSrcSent nss;
while (nss = reader.getMarkedSent())
sents.push_back(nss);
// NB: impossible to delete bmg, but not necessary anyway
BasicModelGenerator* bmg = new BasicModelGenerator(c, sents);
srcphrases = &bmg->getPhraseTable();
if (verbose)
cerr << "Filtering with source file " << srcname << endl;
}
// write temporary copies of files with scaled probabilities, filtered and
// normalized if called for
vector<string> tmp_pt_list;
const Uint linebufsize = 10000;
char linebuf[linebufsize];
vector<char*> srctoks;
vector<double> probs;
for (Uint i = 0; i < pts.size(); ++i) {
iSafeMagicStream ifs(pts[i]);
tmp_pt_list.push_back(getTempName());
oSafeMagicStream ofs(tmp_pt_list.back());
ofs.precision(9);
Uint linenum = 0;
while (getline(ifs, line)) {
++linenum;
if (srcphrases) { // see if this src phrase contained in src file
parseSourcePhrase(pts[i], linenum, line, linebufsize, linebuf, srctoks);
if (!srcphrases->containsSrcPhrase(srctoks.size(), &srctoks[0]))
continue;
} else if (max_phrase_len < PHRASE_LENGTH_INFINITY) {
// need to parse to determine source length
parseSourcePhrase(pts[i], linenum, line, linebufsize, linebuf, srctoks);
}
parseLine(pts[i], linenum, line, pos, probs);
if (num_probs == 0) num_probs = probs.size();
if (probs.empty() || probs.size() != num_probs)
error(ETFatal, "Missing or inconsistent number of probability columns in phrasetable %s",
pts[i].c_str());
ofs << line.substr(0, pos+seplen-1); // !!
double wt = srctoks.size() <= max_phrase_len ? wts[i] : 1.0 / pts.size();
if (calc_norm) {
vector<Uint>::iterator it_norm = norm_sums[i].begin();
for (vector<double>::iterator it = probs.begin(); it != probs.end(); ++it, ++it_norm)
ofs << ' ' << *it * wt / *it_norm;
} else
for (vector<double>::iterator it = probs.begin(); it != probs.end(); ++it)
ofs << ' ' << *it * wt;
ofs << endl;
}
if (verbose)
cerr << "Wrote weighted tmp file " << tmp_pt_list.back() << endl;
}
// cat and sort the temp files, so that identical phrase pairs are next to
// each other in a single merged file (another temporary)
string tmp_pts = join(tmp_pt_list);
string tmp = getTempName();
string command = "zcat -f " + tmp_pts + "| li-sort.sh > " + tmp;
int ret = system(command.c_str());
if ( ret != 0 )
error(ETFatal, "exit status %d from: %s", ret, command.c_str());
for (Uint i = 0; i < pts.size(); ++i) {
unlink(tmp_pt_list[i].c_str());
}
if (verbose)
cerr << "Wrote global sorted temp file " << tmp << endl;
// sum up the probabilities associated with each phrase pair, and write
// result to stdout
iSafeMagicStream ifs(tmp);
string prev_phrase_pair;
vector<double> tot_probs(probs.size(), 0.0);
Uint linenum = 0;
while (getline(ifs, line)) {
++linenum;
parseLine(tmp, linenum, line, pos, probs);
pos += seplen - 1; // !!
if (prev_phrase_pair == "")
prev_phrase_pair = line.substr(0,pos);
if (prev_phrase_pair != line.substr(0,pos)) {
cout << prev_phrase_pair;
for (vector<double>::iterator it = tot_probs.begin(); it != tot_probs.end(); ++it)
cout << ' ' << *it;
cout << endl;
prev_phrase_pair = line.substr(0,pos);
tot_probs.assign(probs.size(), 0.0);
}
for (Uint i = 0; i < probs.size(); ++i)
tot_probs[i] += probs[i];
}
if (prev_phrase_pair != "") {
cout << prev_phrase_pair;
for (vector<double>::iterator it = tot_probs.begin(); it != tot_probs.end(); ++it)
cout << ' ' << *it;
cout << endl;
}
unlink(tmp.c_str());
if (verbose)
cerr << "Done" << endl;
}
// parse a line from a text phrasetable, extracting probs into given array
template<class T>
static void parseLine(const string& pt, Uint linenum, const string& line,
string::size_type& pos, vector<T>& probs)
{
pos = line.rfind(sep);
if (pos == string::npos)
error(ETFatal, "Bad format at line %d in phrasetable %s", linenum, pt.c_str());
if (!splitZ(line.substr(pos+seplen), probs))
error(ETFatal, "Bad probability format at line %d in phrasetable %s", linenum, pt.c_str());
}
// parse a line from a text phrase table, extracting source phrase into
// given buffer and toks array (pointers into buffer)
static void parseSourcePhrase(const string& pt, Uint linenum, const string& line,
Uint bufsize, char buf[], vector<char*>& toks)
{
const char* linep = line.c_str();
char* bufp = buf;
toks.assign(1, buf);
for (; *linep && bufp < buf+bufsize; ++linep, ++bufp) {
if (*linep == ' ') {
*bufp = 0;
if (isPrefix(PHRASE_TABLE_SEP, linep)) // !!! (see assert in main() above)
return; // separator starts here, so we're done
toks.push_back(bufp+1);
} else
*bufp = *linep;
}
if (!*linep)
error(ETFatal, "Format error at line %d in phrase table %s - no separator found", linenum, pt.c_str());
if (bufp == buf+bufsize)
error(ETFatal, "Line %d too long for buffer size in phrase table %s", linenum, pt.c_str());
}
static string getTempName()
{
static const char* tmpdir = getenv("TMPDIR");
static const string path = tmpdir ? tmpdir : "/tmp";
static const string name = "mix_phrasetables.XXXXXX";
char tmp[path.size()+name.size()+2];
strcpy(tmp,(path+"/"+name).c_str());
if ( close(mkstemp(tmp)) )
error(ETFatal, "Unable to get a temp file name using mkstemp(%s)", tmp);
return tmp;
}
// arg processing
void getArgs(int argc, char* argv[])
{
const char* switches[] = {"v", "n", "s:", "w:", "wf:", "m:", "f:"};
ArgReader arg_reader(ARRAY_SIZE(switches), switches, 1, -1, help_message);
arg_reader.read(argc-1, argv+1);
string wts_string, wts_file;
if (arg_reader.getSwitch("w") && arg_reader.getSwitch("wf"))
error(ETFatal, "Can't specify both -w and -wf");
arg_reader.testAndSet("v", verbose);
arg_reader.testAndSet("n", calc_norm);
arg_reader.testAndSet("s", norm_smooth);
arg_reader.testAndSet("w", wts_string);
arg_reader.testAndSet("wf", wts_file);
arg_reader.testAndSet("m", max_phrase_len);
arg_reader.testAndSet("f", srcname);
if (wts_file != "")
gulpFile(wts_file.c_str(), wts_string);
arg_reader.getVars(0, pts);
split(wts_string, wts, " :\n");
if (wts.empty())
wts.assign(pts.size(), 1.0f / pts.size());
if (wts.size() != pts.size())
error(ETFatal, "Number of weights in weights string doesn't match number of phrasetables");
}
|
package com.beyondar.android.view;
import java.util.ArrayList;
import com.beyondar.android.world.BeyondarObject;
/**
* On click listener to detect when a
* {@link com.beyondar.android.world.BeyondarObject BeyondarObject} has been
* clicked on the {@link com.beyondar.android.view.BeyondarGLSurfaceView
* BeyondarGLSurfaceView}.
*/
public interface OnClickBeyondarObjectListener {
/**
* This method is called when the user click on a {@link com.beyondar.android.world.BeyondarObject BeyondarObject}
*
* @param beyondarObjects
* All the {@link com.beyondar.android.world.BeyondarObject BeyondarObject} that collide with the ray
* generated by the user click. If no object have been clicked
* the {@link ArrayList} will be empty
*/
public void onClickBeyondarObject(ArrayList<BeyondarObject> beyondarObjects);
}
|
package edu.calpoly.flipted.businesslogic.tasks.data.blocks
class ImageBlock(
val imageUrl: String,
title: String? = null
) : TaskBlock(title)
|
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import megengine as mge
import megengine.module as M
from models.yolo_fpn import YOLOFPN
from models.yolo_head import YOLOXHead
from models.yolo_pafpn import YOLOPAFPN
from models.yolox import YOLOX
def build_yolox(name="yolox-s"):
num_classes = 80
# value meaning: depth, width
param_dict = {
"yolox-nano": (0.33, 0.25),
"yolox-tiny": (0.33, 0.375),
"yolox-s": (0.33, 0.50),
"yolox-m": (0.67, 0.75),
"yolox-l": (1.0, 1.0),
"yolox-x": (1.33, 1.25),
}
if name == "yolov3":
depth = 1.0
width = 1.0
backbone = YOLOFPN()
head = YOLOXHead(num_classes, width, in_channels=[128, 256, 512], act="lrelu")
model = YOLOX(backbone, head)
else:
assert name in param_dict
kwargs = {}
depth, width = param_dict[name]
if name == "yolox-nano":
kwargs["depthwise"] = True
in_channels = [256, 512, 1024]
backbone = YOLOPAFPN(depth, width, in_channels=in_channels, **kwargs)
head = YOLOXHead(num_classes, width, in_channels=in_channels, **kwargs)
model = YOLOX(backbone, head)
for m in model.modules():
if isinstance(m, M.BatchNorm2d):
m.eps = 1e-3
return model
def build_and_load(weight_file, name="yolox-s"):
model = build_yolox(name)
model_weights = mge.load(weight_file)
model.load_state_dict(model_weights, strict=False)
return model
|
# coding=utf-8
from django.core.urlresolvers import reverse
from django.views.generic import DetailView, ListView, RedirectView, UpdateView, CreateView
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http.response import HttpResponseRedirect
from django.shortcuts import render
from .models import User, Contract, Responsibility
from .forms import ContractForm, ResponsibilityForm
class UserDetailView(LoginRequiredMixin, DetailView):
model = User
# These next two lines tell the view to index lookups by username
slug_field = 'username'
slug_url_kwarg = 'username'
class UserRedirectView(LoginRequiredMixin, RedirectView):
permanent = False
def get_redirect_url(self):
return reverse('users:detail',
kwargs={'username': self.request.user.username})
class UserUpdateView(LoginRequiredMixin, UpdateView):
fields = ['name', ]
# we already imported User in the view code above, remember?
model = User
# send the user back to their own page after a successful update
def get_success_url(self):
return reverse('users:detail',
kwargs={'username': self.request.user.username})
def get_object(self):
# Only get the User record for the user making the request
return User.objects.get(username=self.request.user.username)
class UserListView(LoginRequiredMixin, ListView):
model = User
# These next two lines tell the view to index lookups by username
slug_field = 'username'
slug_url_kwarg = 'username'
class ContractListView(LoginRequiredMixin, ListView):
model = Contract
template_name = 'users/contract_list.html'
user = None
def get(self, request, *args, **kwargs):
self.user = request.user
return super(ContractListView, self).get(request, *args, **kwargs)
def get_queryset(self):
return Contract.objects.filter(creator=self.user)
class ContractUpdateView(LoginRequiredMixin, UpdateView):
model = Contract
form_class = ContractForm
template_name = 'users/update_contract.html'
class ContractCreateView(LoginRequiredMixin, CreateView):
model = Contract
form_class = ContractForm
template_name = 'users/create_contract.html'
def get_context_data(self, request):
return {
'form': ContractForm(initial={'creator': request.user.pk})
}
def get(self, request, *args, **kwargs):
return render(request, self.template_name, self.get_context_data(request))
def post(self, request, *args, **kwargs):
form = self.form_class(request.POST, initial={'creator': request.user.pk})
if form.is_valid():
self.object = form.save()
return HttpResponseRedirect(reverse('users:smart_contract_detail', args=[self.object.pk]))
else:
messages.error(request, u'Произошла ошибка!')
return super(ContractCreateView, self).get(request, *args, **kwargs)
class ResponsibilityUpdateView(LoginRequiredMixin, UpdateView):
model = Responsibility
form_class = ResponsibilityForm
template_name = 'users/update_responsibility.html'
class ResponsibilityCreateView(LoginRequiredMixin, CreateView):
model = Responsibility
form_class = ResponsibilityForm
template_name = 'users/create_responsibility.html'
contract_id = None
def get_context_data(self, request):
return {
'form': ResponsibilityForm(initial={'contract': self.contract_id})
}
def get(self, request, *args, **kwargs):
self.contract_id = kwargs['pk']
return render(request, self.template_name, self.get_context_data(request))
def post(self, request, *args, **kwargs):
form = self.form_class(request.POST)
if form.is_valid():
self.object = form.save()
return HttpResponseRedirect(reverse('users:update_responsibility', args=[self.object.pk]))
else:
messages.error(request, u'Произошла ошибка!')
return super(ResponsibilityCreateView, self).get(request, *args, **kwargs)
|
/**
* This package is for testing MCR under RMMs
*
* @author Alan
* @author Alan
*/
/**
* @author Alan
*
*/
package edu.tamu.aser.tests.examples.mix0;
import edu.tamu.aser.reex.JUnit4MCRRunner;
import edu.tamu.aser.tests.examples.mergesort.MergeSort;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.fail;
@RunWith(JUnit4MCRRunner.class)
public class Mix0 {
static int x;
static int y;
static int z = 0;
static int b = 0;
public static void main(String[] args) {
int a = 0;
x = 0;
y = 0;
Thread t2 = new Thread(new Runnable() {
@Override
public void run() {
y = 1;
b = x;
}
});
t2.start();
x = 1;
a = y;
try {
t2.join();
System.out.println("a= " + a+ ","+ "b= "+b);
// if(a==0 && b==0){
// System.out.println("error");
// }
} catch (InterruptedException e) {
e.printStackTrace();
}
if(a!=1 && b!=0){
throw new RuntimeException("error");
}
}
@Test
public void test() throws InterruptedException {
try {
// lock = new Object();
Mix0.main(null);
} catch (Exception e) {
System.out.println("here");
fail();
}
}
}
|
using EIP.Common.DataAccess;
using EIP.System.Models.Entities;
namespace EIP.System.DataAccess.Log
{
public class SystemSqlLogRepository : DapperAsyncRepository<SystemSqlLog>, ISystemSqlLogRepository
{
}
}
|
# Sycidium
Portable and free live-poll webapp
# Usage
1. Clone Repo
2. Install dependencies with `npm install`
3. Launch in debug mode with `npm start`
4. Go to `http://localhost:3030`
5. Enjoy
|
package it.unibo.scafi.simulation.frontend.model
/**
* Created by chiara on 14/11/16.
*/
trait Action {
def name: String
def action: Any
}
|
<?php
/*
* IMServer.php - Simple instant messaging server - David Thorne / AIG / 14-01-2009
*
*
* This PHP script simply acts like a shared dictionary. A client can either set a
* value with a 'set' command, read it back again using a 'get' command, or remove
* a value using an 'unset' command. Any other form of input will have no effect.
*
* SET:
* IMServer.php?action=set&key=KEYTOSET&value=VALUETOSET
* returns nothing
*
* GET:
* IMServer.php?action=get&key=KEYTOSET
* returns the stored message
*
* UNSET:
* IMServer.php?action=unset&key=KEYTOSET
* returns nothing
*
*/
// Get parameters from query string
//Modified on 01.03.2017 by Lara Mazilu
//It was added a check so that we know what parameters are found the GET message.
//If the parameters aren't there and we still try to retrieve them, then a warning will be
//returned together with the actual result.
$action = '';
if(isset($_GET['action'])) {
$action = $_GET['action'];
}
$key = '';
if(isset($_GET['key'])) {
$key = $_GET['key'];
}
// $value = $_GET['value'];
$value = '';
if(isset($_GET['value'])) {
$value = $_GET['value'];
}
// Read in values from file
$uri = $_SERVER['REQUEST_URI'];
if (preg_match('/~[a-zA-Z0-9]+/', $uri))
{
$username = preg_replace('/[^~]*~([a-zA-Z0-9]*).*/', '$1', $uri);
}
else
{
$username = 'aig';
}
define("DATA_FILE",
"/tmp/im.".$username.".data");
$_APP = array();
if (file_exists(DATA_FILE))
{
// Read data file
$file = fopen(DATA_FILE, "r");
if ($file)
{
$data = fread($file, filesize(DATA_FILE));
fclose($file);
// build application variables from data file
$_APP = unserialize($data);
}
}
// Deal with request
switch ($action)
{
case 'get':
// Return the dictionary value
print $_APP[$key];
break;
case 'set':
// Set the dictionary value
$_APP[$key] = $value;
break;
case 'unset':
// Unset a dictionary item
unset($_APP[$key]);
break;
case 'keys':
// Return all the keys
foreach (array_keys($_APP) as $key) {
print $key."\n";
}
break;
case 'clear':
// Clear a dictionary
unset($_APP);
$_APP = array();
break;
default:
// for any other action, just print out
// a reassuring message
echo "<html><body><h1>COMP18112 IM Server</h1>";
if (file_exists(DATA_FILE))
{
include DATA_FILE;
}
echo "</body></html>";
break;
}
// Write data back to file
$data = serialize($_APP);
$file = fopen(DATA_FILE, "w");
if ($file)
{
fwrite($file, $data);
fclose($file);
}
?>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.