text
stringlengths
2
100k
meta
dict
import Maths, { Vec3, Quat } from "../../fungi/Maths.js"; import DualQuat from "../../fungi/maths/DualQuat.js"; import Armature from "./Armature.js"; //Find a child bone in an armature BUT only if one exists, if more then one child found, return as it no next bone. function findSingleNextJoint(ary, j){ let i, itm = -1; for(i=0; i < ary.length; i++){ if(ary[i].parent === j){ if(itm != -1) return -1; //If another child joint found, exit with -1 itm = i; } } return itm; } class Weights{ //Two Weight Conditions. // 1 - If there is a next bone, Share weight with it. // 2 - if there is no next bone, then weight is 1. static geoWeights(geo, e, range = 1){ let arm = (e instanceof Armature)? e : e.com.Armature, bones = Weights.getBoneInfoFromJoints(arm), bCnt = bones.length, maxLen = range * range; //Square it to get lengthSqr for comparison //console.log(bones); let i, // Index b, // Bone Ref t, // Projection Value lenVec = new Vec3(), // Length Vector lenSqr, // Length Square nextIdx, // Index of Next Bone nextWeight, // Weight for next Bone thisWeight, // Weight for this bone being checked tPos = new Vec3(), // Position of Projection bvLen = new Vec3(); // Vector Length of Bone Origin to Vertex for(let v of geo.verts){ for(i=0; i < bCnt; i++){ b = bones[i]; //.................................... Vec3.sub(v, b.vStart, bvLen); // get b for projection t = Vec3.dot( b.vLength, bvLen ) * b.fLenSqrInv; // proj = dot(a,b) / dot(a,a); //console.log("T", b.fLenSqrInv); // if out of bounds, then not parallel to bone. // If by chance its 1 BUT there is a next bone, exit too. if( t < 0 || t > 1 || (t == 1 && b.nextIdx != -1) ) continue; //.................................... //Check of the vertex is within range of the bone b.vLength.scale(t, tPos).add( b.vStart ); // BoneVecLen * t + BoneOriginPos lenSqr = Vec3.sub( v, tPos, lenVec).lengthSqr(); // dot(VertexPos - BoneTPos) if(lenSqr > maxLen) continue; //.................................... //Calc Weight if(b.nextIdx == -1){ // No next bone to share weight nextIdx = 0; nextWeight = 0; thisWeight = 1; }else{ // Share Weight with next Bone nextIdx = b.nextIdx; nextWeight = t; thisWeight = 1 - t; } v .initJoints( i, nextIdx, 0, 0 ) .initJointWeights( thisWeight, nextWeight, 0, 0 ); //console.log(i, nextIdx, thisWeight, nextWeight); } } } //////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////// static getBoneInfoFromJoints(e){ let arm = (e instanceof Armature)? e : e.com.Armature, v = new Vec3(), b0 = new Vec3(), b1 = new Vec3(), lenSqr; //Precalculate all the bones from Joint Data let bones = new Array(); for(let j of arm.orderedJoints){ //.................................. // Calc the 2 points of a bone. DualQuat.getTranslation(j.dqWorld, b0); // Get World Space Position of Joint from DQ v.copy(Vec3.UP).scale(j.length); // Vector Length of the Bone // Rotate the direction based on World Rotation from DQ if(j.parent) Quat.rotateVec3(j.parent.dqWorld, v, v); else Quat.rotateVec3(j.dqWorld, v, v); b0.add(v, b1); // Add Vector Length to Joint Position //.................................. // Create Bone Information that may be needed for calculating Weights lenSqr = v.lengthSqr(); bones.push({ joint : j, vStart : new Vec3(b0), vEnd : new Vec3(b1), vLength : new Vec3(v), fLenSqr : lenSqr, fLenSqrInv : 1 / lenSqr, nextIdx : findSingleNextJoint( arm.orderedJoints, j) }); } return bones; } } export default Weights;
{ "pile_set_name": "Github" }
>>> Lint for path/to/example.c: Warning (WARN123) Lint Warning Consider this. 1 A 2 ~ >>> - 3 ~ 4 B
{ "pile_set_name": "Github" }
/* * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.management; /** * Provides definitions of the attribute change notifications sent by MBeans. * <P> * It's up to the MBean owning the attribute of interest to create and send * attribute change notifications when the attribute change occurs. * So the <CODE>NotificationBroadcaster</CODE> interface has to be implemented * by any MBean for which an attribute change is of interest. * <P> * Example: * If an MBean called <CODE>myMbean</CODE> needs to notify registered listeners * when its attribute: * <BLOCKQUOTE><CODE> * String myString * </CODE></BLOCKQUOTE> * is modified, <CODE>myMbean</CODE> creates and emits the following notification: * <BLOCKQUOTE><CODE> * new AttributeChangeNotification(myMbean, sequenceNumber, timeStamp, msg, * "myString", "String", oldValue, newValue); * </CODE></BLOCKQUOTE> * * @since 1.5 */ public class AttributeChangeNotification extends javax.management.Notification { /* Serial version */ private static final long serialVersionUID = 535176054565814134L; /** * Notification type which indicates that the observed MBean attribute value has changed. * <BR>The value of this type string is <CODE>jmx.attribute.change</CODE>. */ public static final String ATTRIBUTE_CHANGE = "jmx.attribute.change"; /** * @serial The MBean attribute name. */ private String attributeName = null; /** * @serial The MBean attribute type. */ private String attributeType = null; /** * @serial The MBean attribute old value. */ private Object oldValue = null; /** * @serial The MBean attribute new value. */ private Object newValue = null; /** * Constructs an attribute change notification object. * In addition to the information common to all notification, the caller must supply the name and type * of the attribute, as well as its old and new values. * * @param source The notification producer, that is, the MBean the attribute belongs to. * @param sequenceNumber The notification sequence number within the source object. * @param timeStamp The date at which the notification is being sent. * @param msg A String containing the message of the notification. * @param attributeName A String giving the name of the attribute. * @param attributeType A String containing the type of the attribute. * @param oldValue An object representing value of the attribute before the change. * @param newValue An object representing value of the attribute after the change. */ public AttributeChangeNotification(Object source, long sequenceNumber, long timeStamp, String msg, String attributeName, String attributeType, Object oldValue, Object newValue) { super(AttributeChangeNotification.ATTRIBUTE_CHANGE, source, sequenceNumber, timeStamp, msg); this.attributeName = attributeName; this.attributeType = attributeType; this.oldValue = oldValue; this.newValue = newValue; } /** * Gets the name of the attribute which has changed. * * @return A String containing the name of the attribute. */ public String getAttributeName() { return attributeName; } /** * Gets the type of the attribute which has changed. * * @return A String containing the type of the attribute. */ public String getAttributeType() { return attributeType; } /** * Gets the old value of the attribute which has changed. * * @return An Object containing the old value of the attribute. */ public Object getOldValue() { return oldValue; } /** * Gets the new value of the attribute which has changed. * * @return An Object containing the new value of the attribute. */ public Object getNewValue() { return newValue; } }
{ "pile_set_name": "Github" }
var assert = require("assert"); var path = require("path"); var fs = require("fs"); var Q = require("q"); var iconv = require("iconv-lite"); var createHash = require("crypto").createHash; var getRequiredIDs = require("install").getRequiredIDs; var util = require("./util"); var BuildContext = require("./context").BuildContext; var slice = Array.prototype.slice; function ModuleReader(context, resolvers, processors) { var self = this; assert.ok(self instanceof ModuleReader); assert.ok(context instanceof BuildContext); assert.ok(resolvers instanceof Array); assert.ok(processors instanceof Array); var hash = createHash("sha1").update(context.optionsHash + "\0"); function hashCallbacks(salt) { hash.update(salt + "\0"); var cbs = util.flatten(slice.call(arguments, 1)); cbs.forEach(function(cb) { assert.strictEqual(typeof cb, "function"); hash.update(cb + "\0"); }); return cbs; } resolvers = hashCallbacks("resolvers", resolvers, warnMissingModule); var procArgs = [processors]; if (context.relativize && !context.ignoreDependencies) procArgs.push(require("./relative").getProcessor(self)); processors = hashCallbacks("processors", procArgs); Object.defineProperties(self, { context: { value: context }, idToHash: { value: {} }, resolvers: { value: resolvers }, processors: { value: processors }, salt: { value: hash.digest("hex") } }); } ModuleReader.prototype = { getSourceP: util.cachedMethod(function(id) { var context = this.context; var copy = this.resolvers.slice(0).reverse(); assert.ok(copy.length > 0, "no source resolvers registered"); function tryNextResolverP() { var resolve = copy.pop(); try { var promise = Q(resolve && resolve.call(context, id)); } catch (e) { promise = Q.reject(e); } return resolve ? promise.then(function(result) { if (typeof result === "string") return result; return tryNextResolverP(); }, tryNextResolverP) : promise; } return tryNextResolverP(); }), getCanonicalIdP: util.cachedMethod(function(id) { var reader = this; if (reader.context.useProvidesModule) { return reader.getSourceP(id).then(function(source) { return reader.context.getProvidedId(source) || id; }); } else { return Q(id); } }), readModuleP: util.cachedMethod(function(id) { var reader = this; return reader.getSourceP(id).then(function(source) { if (reader.context.useProvidesModule) { // If the source contains a @providesModule declaration, treat // that declaration as canonical. Note that the Module object // returned by readModuleP might have an .id property whose // value differs from the original id parameter. id = reader.context.getProvidedId(source) || id; } assert.strictEqual(typeof source, "string"); var hash = createHash("sha1") .update("module\0") .update(id + "\0") .update(reader.salt + "\0") .update(source.length + "\0" + source) .digest("hex"); if (reader.idToHash.hasOwnProperty(id)) { // Ensure that the same module identifier is not // provided by distinct modules. assert.strictEqual( reader.idToHash[id], hash, "more than one module named " + JSON.stringify(id)); } else { reader.idToHash[id] = hash; } return reader.buildModuleP(id, hash, source); }); }), buildModuleP: util.cachedMethod(function(id, hash, source) { var reader = this; return reader.processOutputP( id, hash, source ).then(function(output) { return new Module(reader, id, hash, output); }); }, function(id, hash, source) { return hash; }), processOutputP: function(id, hash, source) { var reader = this; var cacheDir = reader.context.cacheDir; var manifestDir = cacheDir && path.join(cacheDir, "manifest"); var charset = reader.context.options.outputCharset; function buildP() { var promise = Q(source); reader.processors.forEach(function(build) { promise = promise.then(function(input) { return util.waitForValuesP( build.call(reader.context, id, input) ); }); }); return promise.then(function(output) { if (typeof output === "string") { output = { ".js": output }; } else { assert.strictEqual(typeof output, "object"); } return util.waitForValuesP(output); }).then(function(output) { util.log.err( "built Module(" + JSON.stringify(id) + ")", "cyan" ); return output; }).catch(function(err) { // Provide additional context for uncaught build errors. util.log.err("Error while reading module " + id + ":"); throw err; }); } if (manifestDir) { return util.mkdirP(manifestDir).then(function(manifestDir) { var manifestFile = path.join(manifestDir, hash + ".json"); return util.readJsonFileP(manifestFile).then(function(manifest) { Object.keys(manifest).forEach(function(key) { var cacheFile = path.join(cacheDir, manifest[key]); manifest[key] = util.readFileP(cacheFile); }); return util.waitForValuesP(manifest, true); }).catch(function(err) { return buildP().then(function(output) { var manifest = {}; Object.keys(output).forEach(function(key) { var cacheFile = manifest[key] = hash + key; var fullPath = path.join(cacheDir, cacheFile); if (charset) { fs.writeFileSync(fullPath, iconv.encode(output[key], charset)) } else { fs.writeFileSync(fullPath, output[key], "utf8"); } }); fs.writeFileSync( manifestFile, JSON.stringify(manifest), "utf8" ); return output; }); }); }); } return buildP(); }, readMultiP: function(ids) { var reader = this; return Q(ids).all().then(function(ids) { if (ids.length === 0) return ids; // Shortcut. var modulePs = ids.map(reader.readModuleP, reader); return Q(modulePs).all().then(function(modules) { var seen = {}; var result = []; modules.forEach(function(module) { if (!seen.hasOwnProperty(module.id)) { seen[module.id] = true; result.push(module); } }); return result; }); }); } }; exports.ModuleReader = ModuleReader; function warnMissingModule(id) { // A missing module may be a false positive and therefore does not warrant // a fatal error, but a warning is certainly in order. util.log.err( "unable to resolve module " + JSON.stringify(id) + "; false positive?", "yellow"); // Missing modules are installed as if they existed, but it's a run-time // error if one is ever actually required. var message = "nonexistent module required: " + id; return "throw new Error(" + JSON.stringify(message) + ");"; } function Module(reader, id, hash, output) { assert.ok(this instanceof Module); assert.ok(reader instanceof ModuleReader); assert.strictEqual(typeof output, "object"); var source = output[".js"]; assert.strictEqual(typeof source, "string"); Object.defineProperties(this, { reader: { value: reader }, id: { value: id }, hash: { value: hash }, // TODO Remove? deps: { value: getRequiredIDs(id, source) }, source: { value: source }, output: { value: output } }); } Module.prototype = { getRequiredP: function() { return this.reader.readMultiP(this.deps); }, writeVersionP: function(outputDir) { var id = this.id; var hash = this.hash; var output = this.output; var cacheDir = this.reader.context.cacheDir; var charset = this.reader.context.options.outputCharset; return Q.all(Object.keys(output).map(function(key) { var outputFile = path.join(outputDir, id + key); function writeCopy() { if (charset) { fs.writeFileSync(outputFile, iconv.encode(output[key], charset)); } else { fs.writeFileSync(outputFile, output[key], "utf8"); } return outputFile; } if (cacheDir) { var cacheFile = path.join(cacheDir, hash + key); return util.linkP(cacheFile, outputFile) // If the hard linking fails, the cache directory // might be on a different device, so fall back to // writing a copy of the file (slightly slower). .catch(writeCopy); } return util.mkdirP(path.dirname(outputFile)).then(writeCopy); })); }, toString: function() { return "Module(" + JSON.stringify(this.id) + ")"; }, resolveId: function(id) { return util.absolutize(this.id, id); } };
{ "pile_set_name": "Github" }
@charset "ISO-8859-1";
{ "pile_set_name": "Github" }
<config> { "component": true } </config> <template lang="wxml"> <view class="li"> <view class="a {{ visibility === filterType ? 'selected' : '' }}" data-filter="{{ filterType }}" bindtap="onChangeFilter" > {{ filterType }} </view> </view> </template> <script> import { VALID_FILTERS } from '@const' export default { props: { visibility: { type: String, validator: val => VALID_FILTERS.includes(val), }, filterType: { type: String, validator: val => VALID_FILTERS.includes(val), }, }, computed: { computedVal () { return this.visibility + this.filterType }, }, methods: { onChangeFilter (e) { this.$emit('onChangeFilter', e) }, }, } </script> <style lang="scss"> .li { display: inline-block; .a { display: inline; margin: 3px; padding: 6rpx 10rpx; text-decoration: none; color: inherit; border: 1px solid transparent; border-radius: 3px; &:hover { border-color: rgba(175, 47, 47, 0.1); } &.selected { border-color: rgba(175, 47, 47, 0.2); } } } </style>
{ "pile_set_name": "Github" }
/* * Copyright (C) 2005-2017 Qihoo 360 Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed To in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.qihoo360.loader2; import android.os.Build; /** * @author RePlugin Team */ public class BuildCompat { public static final String ARM = "arm"; public static final String ARM64 = "arm64"; public static final String[] SUPPORTED_ABIS; public static final String[] SUPPORTED_32_BIT_ABIS; public static final String[] SUPPORTED_64_BIT_ABIS; static { //init SUPPORTED_ABIS if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.SUPPORTED_ABIS != null) { SUPPORTED_ABIS = new String[Build.SUPPORTED_ABIS.length]; System.arraycopy(Build.SUPPORTED_ABIS, 0, SUPPORTED_ABIS, 0, SUPPORTED_ABIS.length); } else { SUPPORTED_ABIS = new String[]{Build.CPU_ABI, Build.CPU_ABI2}; } } else { SUPPORTED_ABIS = new String[]{Build.CPU_ABI, Build.CPU_ABI2}; } //init SUPPORTED_32_BIT_ABIS if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.SUPPORTED_32_BIT_ABIS != null) { SUPPORTED_32_BIT_ABIS = new String[Build.SUPPORTED_32_BIT_ABIS.length]; System.arraycopy(Build.SUPPORTED_32_BIT_ABIS, 0, SUPPORTED_32_BIT_ABIS, 0, SUPPORTED_32_BIT_ABIS.length); } else { SUPPORTED_32_BIT_ABIS = new String[]{Build.CPU_ABI, Build.CPU_ABI2}; } } else { SUPPORTED_32_BIT_ABIS = new String[]{Build.CPU_ABI, Build.CPU_ABI2}; } //init SUPPORTED_64_BIT_ABIS if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.SUPPORTED_64_BIT_ABIS != null) { SUPPORTED_64_BIT_ABIS = new String[Build.SUPPORTED_64_BIT_ABIS.length]; System.arraycopy(Build.SUPPORTED_64_BIT_ABIS, 0, SUPPORTED_64_BIT_ABIS, 0, SUPPORTED_64_BIT_ABIS.length); } else { SUPPORTED_64_BIT_ABIS = new String[]{Build.CPU_ABI, Build.CPU_ABI2}; } } else { SUPPORTED_64_BIT_ABIS = new String[]{Build.CPU_ABI, Build.CPU_ABI2}; } } }
{ "pile_set_name": "Github" }
tags meter: aBlock self meter with: aBlock
{ "pile_set_name": "Github" }
The arguments to assertThat method is a constant. It should be a variable or a method invocation. For eg. switch assertThat(1).isEqualTo(methodCall()) to assertThat(methodCall()).isEqualTo(1).
{ "pile_set_name": "Github" }
package constants import "jvmgo/ch08/instructions/base" import "jvmgo/ch08/rtda" // Push byte type BIPUSH struct { val int8 } func (self *BIPUSH) FetchOperands(reader *base.BytecodeReader) { self.val = reader.ReadInt8() } func (self *BIPUSH) Execute(frame *rtda.Frame) { i := int32(self.val) frame.OperandStack().PushInt(i) } // Push short type SIPUSH struct { val int16 } func (self *SIPUSH) FetchOperands(reader *base.BytecodeReader) { self.val = reader.ReadInt16() } func (self *SIPUSH) Execute(frame *rtda.Frame) { i := int32(self.val) frame.OperandStack().PushInt(i) }
{ "pile_set_name": "Github" }
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.mapreduce.v2.api.protocolrecords.impl.pb; import org.apache.hadoop.mapreduce.v2.api.protocolrecords.KillJobResponse; import org.apache.hadoop.mapreduce.v2.proto.MRServiceProtos.KillJobResponseProto; import org.apache.hadoop.yarn.api.records.impl.pb.ProtoBase; public class KillJobResponsePBImpl extends ProtoBase<KillJobResponseProto> implements KillJobResponse { KillJobResponseProto proto = KillJobResponseProto.getDefaultInstance(); KillJobResponseProto.Builder builder = null; boolean viaProto = false; public KillJobResponsePBImpl() { builder = KillJobResponseProto.newBuilder(); } public KillJobResponsePBImpl(KillJobResponseProto proto) { this.proto = proto; viaProto = true; } public KillJobResponseProto getProto() { proto = viaProto ? proto : builder.build(); viaProto = true; return proto; } private void maybeInitBuilder() { if (viaProto || builder == null) { builder = KillJobResponseProto.newBuilder(proto); } viaProto = false; } }
{ "pile_set_name": "Github" }
<?php /* * Copyright 2014 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ class Google_Service_ShoppingContent_OrdersCreateTestOrderResponse extends Google_Model { public $kind; public $orderId; public function setKind($kind) { $this->kind = $kind; } public function getKind() { return $this->kind; } public function setOrderId($orderId) { $this->orderId = $orderId; } public function getOrderId() { return $this->orderId; } }
{ "pile_set_name": "Github" }
//-------------------------------------------------------------------------------------- // pch.cpp // // Include the standard header and generate the precompiled header. // // Advanced Technology Group (ATG) // Copyright (C) Microsoft Corporation. All rights reserved. //-------------------------------------------------------------------------------------- #include "pch.h"
{ "pile_set_name": "Github" }
# Copyright (C) 2010-2016 GRNET S.A. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import division import logging from synnefo.logic.allocators.base import AllocatorBase from django.conf import settings from django.utils import importlib log = logging.getLogger(__name__) class FilterAllocator(AllocatorBase): filters = None def __init__(self, filter_modules=None): filters = [] if filter_modules is None: filter_modules = settings.BACKEND_FILTER_ALLOCATOR_FILTERS for fm in filter_modules: path, filter_class = fm.rsplit('.', 1) module = importlib.import_module(path) filter = getattr(module, filter_class)() filters.append(filter) self.filters = filters def filter_backends(self, backends, vm): """ Run each backend filter in the specified order. """ for filter in self.filters: backends = filter.filter_backends(backends, vm) if not backends: return backends return backends def allocate(self, backends, vm): """ Choose the 'best' backend for the VM. """ if len(backends) == 1: return backends[0] # Compute the scores for each backend backend_scores = [(backend, self.backend_score(backend)) for backend in backends] log.debug("Backend scores %s", backend_scores) # Pick out the best result = min(backend_scores, key=lambda (b, b_score): b_score) backend = result[0] return backend def backend_score(self, backend): """ Score a backend based on available memory, disk size and cpu ratio. """ mem_ratio = 0 disk_ratio = 0 cpu_ratio = 1 if backend.mtotal: mem_ratio = 1 - (backend.mfree / backend.mtotal) if backend.dtotal: disk_ratio = 1 - (backend.dfree / backend.dtotal) if backend.ctotal: cpu_ratio = ((backend.pinst_cnt + 1) * 4) / (backend.ctotal * 3) return 0.5 * cpu_ratio + 0.5 * (mem_ratio + disk_ratio)
{ "pile_set_name": "Github" }
As you learn about Ember, you'll see code like `Ember.Component.extend()` and `DS.Model.extend()`. Here, you'll learn about this `extend()` method, as well as other major features of the Ember object model. ### Defining Classes To define a new Ember _class_, call the [`extend()`][1] method on [`Ember.Object`][2]: [1]: https://api.emberjs.com/classes/Ember.Object.html#method_extend [2]: https://api.emberjs.com/classes/Ember.Object.html ```javascript const Person = Ember.Object.extend({ say(thing) { alert(thing); } }); ``` This defines a new `Person` class with a `say()` method. You can also create a _subclass_ from any existing class by calling its `extend()` method. For example, you might want to create a subclass of Ember's built-in [`Ember.Component`][3] class: [3]: https://api.emberjs.com/classes/Ember.Component.html ```javascript {data-filename=app/components/todo-item.js} export default Ember.Component.extend({ classNameBindings: ['isUrgent'], isUrgent: true }); ``` ### Overriding Parent Class Methods When defining a subclass, you can override methods but still access the implementation of your parent class by calling the special `_super()` method: ```javascript const Person = Ember.Object.extend({ say(thing) { alert(`${this.get('name')} says: ${thing}`); } }); const Soldier = Person.extend({ say(thing) { // this will call the method in the parent class (Person#say), appending // the string ', sir!' to the variable `thing` passed in this._super(`${thing}, sir!`); } }); let yehuda = Soldier.create({ name: 'Yehuda Katz' }); yehuda.say('Yes'); // alerts "Yehuda Katz says: Yes, sir!" ``` In certain cases, you will want to pass arguments to `_super()` before or after overriding. This allows the original method to continue operating as it normally would. One common example is when overriding the [`normalizeResponse()`][4] hook in one of Ember-Data's serializers. A handy shortcut for this is to use a "spread operator", like `...arguments`: [4]: https://api.emberjs.com/data/classes/DS.JSONAPISerializer.html#method_normalizeResponse ```javascript normalizeResponse(store, primaryModelClass, payload, id, requestType) { // Customize my JSON payload for Ember-Data return this._super(...arguments); } ``` The above example returns the original arguments (after your customizations) back to the parent class, so it can continue with its normal operations. ### Creating Instances Once you have defined a class, you can create new _instances_ of that class by calling its [`create()`][5] method. Any methods, properties and computed properties you defined on the class will be available to instances: [5]: https://api.emberjs.com/classes/Ember.Object.html#method_create ```javascript const Person = Ember.Object.extend({ say(thing) { alert(`${this.get('name')} says: ${thing}`); } }); let person = Person.create(); person.say('Hello'); // alerts " says: Hello" ``` When creating an instance, you can initialize the values of its properties by passing an optional hash to the `create()` method: ```javascript const Person = Ember.Object.extend({ helloWorld() { alert(`Hi, my name is ${this.get('name')}`); } }); let tom = Person.create({ name: 'Tom Dale' }); tom.helloWorld(); // alerts "Hi, my name is Tom Dale" ``` Note that for performance reasons, while calling `create()` you cannot redefine an instance's computed properties and should not redefine existing or define new methods. You should only set simple properties when calling `create()`. If you need to define or redefine methods or computed properties, create a new subclass and instantiate that. By convention, properties or variables that hold classes are PascalCased, while instances are not. So, for example, the variable `Person` would point to a class, while `person` would point to an instance (usually of the `Person` class). You should stick to these naming conventions in your Ember applications. ### Initializing Instances When a new instance is created, its [`init()`][6] method is invoked automatically. This is the ideal place to implement setup required on new instances: [6]: https://api.emberjs.com/classes/Ember.Object.html#method_init ```javascript const Person = Ember.Object.extend({ init() { alert(`${this.get('name')}, reporting for duty!`); } }); Person.create({ name: 'Stefan Penner' }); // alerts "Stefan Penner, reporting for duty!" ``` If you are subclassing a framework class, like `Ember.Component`, and you override the `init()` method, make sure you call `this._super(...arguments)`! If you don't, a parent class may not have an opportunity to do important setup work, and you'll see strange behavior in your application. Arrays and objects defined directly on any `Ember.Object` are shared across all instances of that class. ```javascript const Person = Ember.Object.extend({ shoppingList: ['eggs', 'cheese'] }); Person.create({ name: 'Stefan Penner', addItem() { this.get('shoppingList').pushObject('bacon'); } }); Person.create({ name: 'Robert Jackson', addItem() { this.get('shoppingList').pushObject('sausage'); } }); // Stefan and Robert both trigger their addItem. // They both end up with: ['eggs', 'cheese', 'bacon', 'sausage'] ``` To avoid this behavior, it is encouraged to initialize those arrays and object properties during `init()`. Doing so ensures each instance will be unique. ```javascript const Person = Ember.Object.extend({ init() { this.set('shoppingList', ['eggs', 'cheese']); } }); Person.create({ name: 'Stefan Penner', addItem() { this.get('shoppingList').pushObject('bacon'); } }); Person.create({ name: 'Robert Jackson', addItem() { this.get('shoppingList').pushObject('sausage'); } }); // Stefan ['eggs', 'cheese', 'bacon'] // Robert ['eggs', 'cheese', 'sausage'] ``` ### Accessing Object Properties When accessing the properties of an object, use the [`get()`][7] and [`set()`][8] accessor methods: [7]: https://api.emberjs.com/classes/Ember.Object.html#method_get [8]: https://api.emberjs.com/classes/Ember.Object.html#method_set ```javascript const Person = Ember.Object.extend({ name: 'Robert Jackson' }); let person = Person.create(); person.get('name'); // 'Robert Jackson' person.set('name', 'Tobias Fünke'); person.get('name'); // 'Tobias Fünke' ``` Make sure to use these accessor methods; otherwise, computed properties won't recalculate, observers won't fire, and templates won't update.
{ "pile_set_name": "Github" }
Subject: the permanent fix to penis enlargement limited time offer : add atleast 3 inches or your money back ! - - - - > visit us to learn more no more offers
{ "pile_set_name": "Github" }
/* * IXP4XX EHCI Host Controller Driver * * Author: Vladimir Barinov <[email protected]> * * Based on "ehci-fsl.c" by Randy Vinson <[email protected]> * * 2007 (c) MontaVista Software, Inc. This file is licensed under * the terms of the GNU General Public License version 2. This program * is licensed "as is" without any warranty of any kind, whether express * or implied. */ #include <linux/platform_device.h> static int ixp4xx_ehci_init(struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci(hcd); int retval = 0; ehci->big_endian_desc = 1; ehci->big_endian_mmio = 1; ehci->caps = hcd->regs + 0x100; ehci->regs = hcd->regs + 0x100 + HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase)); ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); hcd->has_tt = 1; ehci_reset(ehci); retval = ehci_init(hcd); if (retval) return retval; ehci_port_power(ehci, 0); return retval; } static const struct hc_driver ixp4xx_ehci_hc_driver = { .description = hcd_name, .product_desc = "IXP4XX EHCI Host Controller", .hcd_priv_size = sizeof(struct ehci_hcd), .irq = ehci_irq, .flags = HCD_MEMORY | HCD_USB2, .reset = ixp4xx_ehci_init, .start = ehci_run, .stop = ehci_stop, .shutdown = ehci_shutdown, .urb_enqueue = ehci_urb_enqueue, .urb_dequeue = ehci_urb_dequeue, .endpoint_disable = ehci_endpoint_disable, .endpoint_reset = ehci_endpoint_reset, .get_frame_number = ehci_get_frame, .hub_status_data = ehci_hub_status_data, .hub_control = ehci_hub_control, #if defined(CONFIG_PM) .bus_suspend = ehci_bus_suspend, .bus_resume = ehci_bus_resume, #endif .relinquish_port = ehci_relinquish_port, .port_handed_over = ehci_port_handed_over, .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, }; static int ixp4xx_ehci_probe(struct platform_device *pdev) { struct usb_hcd *hcd; const struct hc_driver *driver = &ixp4xx_ehci_hc_driver; struct resource *res; int irq; int retval; if (usb_disabled()) return -ENODEV; res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { dev_err(&pdev->dev, "Found HC with no IRQ. Check %s setup!\n", dev_name(&pdev->dev)); return -ENODEV; } irq = res->start; hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); if (!hcd) { retval = -ENOMEM; goto fail_create_hcd; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(&pdev->dev, "Found HC with no register addr. Check %s setup!\n", dev_name(&pdev->dev)); retval = -ENODEV; goto fail_request_resource; } hcd->rsrc_start = res->start; hcd->rsrc_len = resource_size(res); if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, driver->description)) { dev_dbg(&pdev->dev, "controller already in use\n"); retval = -EBUSY; goto fail_request_resource; } hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); if (hcd->regs == NULL) { dev_dbg(&pdev->dev, "error mapping memory\n"); retval = -EFAULT; goto fail_ioremap; } retval = usb_add_hcd(hcd, irq, IRQF_SHARED); if (retval) goto fail_add_hcd; return retval; fail_add_hcd: iounmap(hcd->regs); fail_ioremap: release_mem_region(hcd->rsrc_start, hcd->rsrc_len); fail_request_resource: usb_put_hcd(hcd); fail_create_hcd: dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval); return retval; } static int ixp4xx_ehci_remove(struct platform_device *pdev) { struct usb_hcd *hcd = platform_get_drvdata(pdev); usb_remove_hcd(hcd); iounmap(hcd->regs); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); return 0; } MODULE_ALIAS("platform:ixp4xx-ehci"); static struct platform_driver ixp4xx_ehci_driver = { .probe = ixp4xx_ehci_probe, .remove = ixp4xx_ehci_remove, .driver = { .name = "ixp4xx-ehci", }, };
{ "pile_set_name": "Github" }
[NO_PID]: ECPGdebug: set to 1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGconnect: opening database ecpg1_regression on <DEFAULT> port <DEFAULT> [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 35: query: set datestyle to mdy; with 0 parameter(s) on connection ecpg1_regression [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 35: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_process_output on line 35: OK: SET [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 37: query: create table test ( a serial , b numeric ( 12 , 3 ) , c varchar , d varchar ( 3 ) , e char ( 4 ) , f timestamptz , g boolean , h box , i inet ); with 0 parameter(s) on connection ecpg1_regression [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 37: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_process_output on line 37: OK: CREATE TABLE [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 38: query: insert into test ( b , c , d , e , f , g , h , i ) values ( 23.456 , 'varchar' , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , true , '(1,2,3,4)' , '2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128' ); with 0 parameter(s) on connection ecpg1_regression [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 38: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_process_output on line 38: OK: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 39: query: insert into test ( b , c , d , e , f , g , h , i ) values ( 2.446456 , null , 'v' , 'c' , '2003-03-03 12:33:07 PDT' , false , null , null ); with 0 parameter(s) on connection ecpg1_regression [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 39: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_process_output on line 39: OK: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 42: query: select a , b , c , d , e , f , g , h , i from test order by a; with 0 parameter(s) on connection ecpg1_regression [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 42: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_process_output on line 42: correctly got 2 tuples with 9 fields [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_process_output on line 42: putting result (2 tuples) into descriptor mydesc [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGget_desc: reading items for tuple 1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_store_result on line 43: allocating memory for 2 tuples [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 43: RESULT: 1 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 43: RESULT: 2 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGget_desc: reading items for tuple 2 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_store_result on line 44: allocating memory for 2 tuples [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 44: RESULT: 23.456 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 44: RESULT: 2.446 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGget_desc: reading items for tuple 3 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_store_result on line 45: allocating memory for 2 tuples [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 45: RESULT: varchar offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 45: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGget_desc: reading items for tuple 4 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_store_result on line 46: allocating memory for 2 tuples [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 46: RESULT: v offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 46: RESULT: v offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGget_desc: reading items for tuple 5 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_store_result on line 47: allocating memory for 2 tuples [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 47: RESULT: c offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 47: RESULT: c offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGget_desc: reading items for tuple 6 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_store_result on line 48: allocating memory for 2 tuples [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 48: RESULT: Mon Mar 03 11:33:07 2003 PST offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 48: RESULT: Mon Mar 03 11:33:07 2003 PST offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGget_desc: reading items for tuple 7 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_store_result on line 49: allocating memory for 2 tuples [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 49: RESULT: t offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 49: RESULT: f offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGget_desc: reading items for tuple 9 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_store_result on line 52: allocating memory for 2 tuples [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 52: RESULT: 2001:4f8:3:ba:2e0:81ff:fe22:d1f1 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 52: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_finish: connection ecpg1_regression closed [NO_PID]: sqlca: code: 0, state: 00000
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>ACPI</key> <dict> <key>DSDT</key> <dict> <key>Debug</key> <false/> <key>DropOEM_DSM</key> <false/> <key>Name</key> <string>DSDT.aml</string> <key>ReuseFFFF</key> <false/> </dict> <key>SSDT</key> <dict> <key>DropOem</key> <true/> <key>Generate</key> <dict> <key>CStates</key> <false/> <key>PStates</key> <false/> </dict> </dict> </dict> <key>Boot</key> <dict> <key>Arguments</key> <string>dart=0 darkwake=no kext-dev-mode=1 rootless=0</string> <key>CustomLogo</key> <string>Theme</string> <key>Debug</key> <false/> <key>DefaultVolume</key> <string>LastBootedVolume</string> <key>HibernationFixup</key> <true/> <key>NeverHibernate</key> <true/> <key>Secure</key> <false/> <key>Timeout</key> <integer>4</integer> <key>XMPDetection</key> <string>Yes</string> </dict> <key>CPU</key> <dict> <key>FrequencyMHz</key> <integer>2600</integer> <key>UseARTFrequency</key> <false/> </dict> <key>Devices</key> <dict> <key>USB</key> <dict> <key>FixOwnership</key> <false/> <key>HighCurrent</key> <true/> <key>Inject</key> <false/> </dict> <key>UseIntelHDMI</key> <true/> </dict> <key>GUI</key> <dict> <key>Hide</key> <array> <string>Windows</string> <string>BOOTX64.EFI</string> </array> <key>Mouse</key> <dict> <key>DoubleClick</key> <integer>500</integer> <key>Enabled</key> <true/> <key>Mirror</key> <false/> <key>Speed</key> <integer>4</integer> </dict> <key>Scan</key> <dict> <key>Entries</key> <true/> <key>Legacy</key> <false/> <key>Linux</key> <false/> <key>Tool</key> <true/> </dict> <key>ScreenResolution</key> <string>1366x768</string> <key>Theme</key> <string>iclover</string> </dict> <key>Graphics</key> <dict> <key>DualLink</key> <integer>0</integer> <key>EDID</key> <dict> <key>Inject</key> <true/> </dict> <key>Inject</key> <dict> <key>ATI</key> <false/> <key>Intel</key> <true/> <key>NVidia</key> <false/> </dict> <key>NvidiaSingle</key> <false/> </dict> <key>KernelAndKextPatches</key> <dict> <key>AppleIntelCPUPM</key> <true/> <key>AppleRTC</key> <true/> <key>Debug</key> <false/> <key>DellSMBIOSPatch</key> <false/> <key>ForceKextsToLoad</key> <array> <string>\System\Library\Extensions\IONetworkingFamily.kext</string> </array> <key>KernelCpu</key> <false/> <key>KernelLapic</key> <false/> <key>KernelPm</key> <false/> <key>KernelXCPM</key> <false/> <key>KextsToPatch</key> <array> <dict> <key>Comment</key> <string>Enable TRIM</string> <key>Disabled</key> <false/> <key>Find</key> <data> QVBQTEUgU1NE </data> <key>InfoPlistPatch</key> <false/> <key>Name</key> <string>IOAHCIBlockStorage</string> <key>Replace</key> <data> AAAAAAAAAAAA </data> </dict> <dict> <key>Comment</key> <string>Boot graphics glitch, 10.12.x</string> <key>Disabled</key> <false/> <key>Find</key> <data> AQAAdSU= </data> <key>InfoPlistPatch</key> <false/> <key>Name</key> <string>IOGraphicsFamily</string> <key>Replace</key> <data> AQAA6yU= </data> </dict> <dict> <key>Comment</key> <string>Logo Fix White</string> <key>Disabled</key> <false/> <key>Find</key> <data> hcB0a0g= </data> <key>InfoPlistPatch</key> <false/> <key>Name</key> <string>IOGraphicsFamily</string> <key>Replace</key> <data> McB0W0g= </data> </dict> <dict> <key>Comment</key> <string>change F%uT%04x to F%uTxxxx in AppleBacklightInjector.kext (credit RehabMan)</string> <key>Disabled</key> <false/> <key>Find</key> <data> RiV1VCUwNHgA </data> <key>InfoPlistPatch</key> <false/> <key>Name</key> <string>com.apple.driver.AppleBacklight</string> <key>Replace</key> <data> RiV1VHh4eHgA </data> </dict> <dict> <key>Comment</key> <string>Enable USB3 after wake for Intel 8</string> <key>Disabled</key> <false/> <key>Find</key> <data> g710////EA== </data> <key>InfoPlistPatch</key> <false/> <key>Name</key> <string>AppleUSBXHCIPCI</string> <key>Replace</key> <data> g710////Gw== </data> </dict> <dict> <key>Comment</key> <string>change 15 port limit to 26 in XHCI kext (100-Series-10.12)</string> <key>Disabled</key> <false/> <key>Find</key> <data> g710////EA== </data> <key>InfoPlistPatch</key> <false/> <key>Name</key> <string>AppleUSBXHCIPCI</string> <key>Replace</key> <data> g710////Gw== </data> </dict> </array> </dict> <key>RtVariables</key> <dict> <key>BooterConfig</key> <string>0x28</string> <key>CsrActiveConfig</key> <string>0x67</string> <key>ROM</key> <data> PAdUovm+ </data> </dict> <key>SMBIOS</key> <dict> <key>BiosReleaseDate</key> <string>08/08/2017</string> <key>BiosVendor</key> <string>Apple Inc.</string> <key>BiosVersion</key> <string>MBP91.88Z.00D7.B00.1708080744</string> <key>Board-ID</key> <string>Mac-6F01561E16C75D06</string> <key>BoardManufacturer</key> <string>Apple Inc.</string> <key>BoardSerialNumber</key> <string>C023541304NFF4P1H</string> <key>BoardType</key> <integer>10</integer> <key>BoardVersion</key> <string>MacBookPro9,2</string> <key>ChassisAssetTag</key> <string>MacBook-Aluminum</string> <key>ChassisManufacturer</key> <string>Apple Inc.</string> <key>ChassisType</key> <string>0x0A</string> <key>Family</key> <string>MacBook Pro</string> <key>FirmwareFeatures</key> <string>0xC00DE137</string> <key>FirmwareFeaturesMask</key> <string>0xFF1FFF3F</string> <key>LocationInChassis</key> <string>Part Component</string> <key>Manufacturer</key> <string>Apple Inc.</string> <key>Mobile</key> <true/> <key>PlatformFeature</key> <string>0xFFFF</string> <key>ProductName</key> <string>MacBookPro9,2</string> <key>SerialNumber</key> <string>C02LY1THDTY3</string> <key>Trust</key> <true/> <key>Version</key> <string>1.0</string> </dict> <key>SystemParameters</key> <dict> <key>CustomUUID</key> <string>287267D6-83D3-6959-97C4-2B2EA0341CFA</string> <key>InjectKexts</key> <string>Yes</string> <key>InjectSystemID</key> <true/> </dict> </dict> </plist>
{ "pile_set_name": "Github" }
/** ****************************************************************************** * @file usbd_audio_cdc_comp.h * @author MCD Application Team/ mcHF Devel * @version V2.4.2 * @date 11-December-2015 * @brief header file for the usbd_audio.c file. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 * * 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. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __USB_AUDIO_COMP_H #define __USB_AUDIO_COMP_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "usbd_ioreq.h" #include "usbd_desc.h" /** @addtogroup STM32_USB_DEVICE_LIBRARY * @{ */ /** @defgroup USBD_AUDIO * @brief This file is the Header file for usbd_audio.c * @{ */ /** @defgroup USBD_AUDIO_Exported_Defines * @{ */ ///#define AUDIO_OUT_EP 0x01 // #define USB_AUDIO_CONFIG_DESC_SIZ 109 #define USBD_AUDIO_OUT_CHANNELS 2 #define USBD_AUDIO_IN_CHANNELS 2 #define USBD_AUDIO_IN_OUT_DIV 1 // USBD_IN_AUDIO_IN_OUT_DIV must be set to an integer number between 3 and 1 // in order to keep within the limits of the existing code in audio_driver.c audio_rx_processor #define USBD_AUDIO_IN_FREQ (USBD_AUDIO_FREQ/USBD_AUDIO_IN_OUT_DIV) #define AUDIO_CONTROL_MUTE 0x0001 #define AUDIO_FORMAT_TYPE_I 0x01 #define AUDIO_FORMAT_TYPE_III 0x03 #define AUDIO_ENDPOINT_GENERAL 0x01 #define AUDIO_REQ_GET_CUR 0x81 #define AUDIO_REQ_SET_CUR 0x01 #define AUDIO_OUT_STREAMING_CTRL 0x02 #define AUDIO_IN_STREAMING_CTRL 0x06 #define AUDIO_OUT_PACKET (uint32_t)(((USBD_AUDIO_FREQ * 2 * 2) /1000)) #define AUDIO_DEFAULT_VOLUME 70 /* Number of sub-packets in the audio transfer buffer. You can modify this value but always make sure that it is an even number and higher than 3 */ #define AUDIO_OUT_PACKET_NUM 16 /* Total size of the audio transfer buffer */ #define AUDIO_TOTAL_BUF_SIZE ((uint32_t)(AUDIO_OUT_PACKET * AUDIO_OUT_PACKET_NUM)) /* Audio Commands enumeration */ typedef enum { AUDIO_CMD_START = 1, AUDIO_CMD_PLAY, AUDIO_CMD_STOP, AUDIO_CMD_PAUSE }AUDIO_CMD_TypeDef; typedef enum { AUDIO_OFFSET_NONE = 0, AUDIO_OFFSET_HALF, AUDIO_OFFSET_FULL, AUDIO_OFFSET_UNKNOWN, } AUDIO_OffsetTypeDef; /** * @} */ /** @defgroup USBD_CORE_Exported_TypesDefinitions * @{ */ typedef struct { uint8_t cmd; uint8_t data[USB_MAX_EP0_SIZE]; uint8_t len; uint8_t unit; } USBD_AUDIO_ControlTypeDef; typedef struct { __IO uint32_t alt_setting[USBD_MAX_NUM_INTERFACES+1]; // uint8_t buffer[AUDIO_TOTAL_BUF_SIZE]; // AUDIO_OffsetTypeDef offset; // uint8_t rd_enable; // uint16_t rd_ptr; // uint16_t wr_ptr; USBD_AUDIO_ControlTypeDef control; uint32_t SendFlag; uint32_t PlayFlag; } USBD_AUDIO_HandleTypeDef; typedef struct { int8_t (*Init) (uint32_t AudioFreq, uint32_t Volume, uint32_t options); int8_t (*DeInit) (uint32_t options); int8_t (*AudioCmd) (uint8_t* pbuf, uint32_t size, uint8_t cmd); int8_t (*VolumeCtl) (uint8_t vol); int8_t (*MuteCtl) (uint8_t cmd); int8_t (*PeriodicTC) (uint8_t cmd); int8_t (*GetState) (void); int8_t (*InVolumeCtl) (uint8_t vol); }USBD_AUDIO_ItfTypeDef; /** * @} */ /** @defgroup USBD_CORE_Exported_Macros * @{ */ /** * @} */ /** @defgroup USBD_CORE_Exported_Variables * @{ */ extern USBD_ClassTypeDef USBD_AUDIO; #define USBD_AUDIO_CLASS &USBD_AUDIO /** * @} */ /** @defgroup USB_CORE_Exported_Functions * @{ */ uint8_t USBD_AUDIO_RegisterInterface (USBD_HandleTypeDef *pdev, USBD_AUDIO_ItfTypeDef *fops); void USBD_AUDIO_Sync (USBD_HandleTypeDef *pdev, AUDIO_OffsetTypeDef offset); /** * @} */ typedef struct UsbAudioUnit_s { uint8_t cs; uint8_t cn; int16_t min; int16_t max; uint16_t res; int16_t cur; __IO uint8_t* ptr; // pointer to data structure which is used elsewhere to store volume } UsbAudioUnit; // In / Out Volume; enum { UnitVolumeTX = 0, UnitVolumeRX, UnitMax }; extern UsbAudioUnit usbUnits[UnitMax]; #ifdef __cplusplus } #endif #endif /* __USB_AUDIO_COMP_H */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
{ "pile_set_name": "Github" }
/** * Most of the code in the Qalingo project is copyrighted Hoteia and licensed * under the Apache License Version 2.0 (release version 0.8.0) * http://www.apache.org/licenses/LICENSE-2.0 * * Copyright (c) Hoteia, 2012-2014 * http://www.hoteia.com - http://twitter.com/hoteia - [email protected] * */ package org.hoteia.qalingo.core.web.mvc.controller.openid; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.hoteia.qalingo.core.domain.enumtype.FoUrls; import org.hoteia.qalingo.core.service.openid.Association; import org.hoteia.qalingo.core.service.openid.Endpoint; import org.hoteia.qalingo.core.service.openid.OpenProvider; import org.hoteia.qalingo.core.service.openid.Utils; import org.hoteia.qalingo.core.web.resolver.RequestData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; /** * */ @Controller("connectOpenIdYahooController") public class ConnectOpenIdYahooController extends AbstractOpenIdFrontofficeController { protected final Logger logger = LoggerFactory.getLogger(getClass()); @RequestMapping("/connect-openid-yahoo.html*") public ModelAndView connectGoogle(final HttpServletRequest request, final HttpServletResponse response) throws Exception { final RequestData requestData = requestUtil.getRequestData(request); // SANITY CHECK if(!requestUtil.hasKnownCustomerLogged(request)){ try { openIdService.setRealm(urlService.buildDomainePathUrl(requestData)); String openIdCallBackURL = urlService.buildOpenIdCallBackUrl(requestData); openIdService.setReturnTo(urlService.buildAbsoluteUrl(requestData, openIdCallBackURL)); Endpoint endpoint = openIdService.lookupEndpoint(OpenProvider.YAHOO.getPropertyKey().toLowerCase()); Association association = openIdService.lookupAssociation(endpoint); request.getSession().setAttribute(Utils.ATTR_MAC, association.getRawMacKey()); request.getSession().setAttribute(Utils.ATTR_ALIAS, endpoint.getAlias()); String url = openIdService.getAuthenticationUrl(endpoint, association); response.sendRedirect(url); } catch (Exception e) { logger.error("Connect With " + OpenProvider.YAHOO.getPropertyKey() + " failed!"); } } // DEFAULT FALLBACK VALUE if(!response.isCommitted()){ response.sendRedirect(urlService.generateUrl(FoUrls.LOGIN, requestData)); } return null; } }
{ "pile_set_name": "Github" }
--- title: Dover, NH permalink: "/dover-nh" name: Letter to City Government Officials city: Dover state: NH recipients: - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] body: |- Dear Dover Officials, I am a resident of Dover, writing to demand that the Dover Mayor and City Council adopt a budget prioritizing community well-being and redirecting funding away from the Dover Police Department. Our country, state, and city are in the midst of widespread upheaval over the systemic violence of policing. At the same time, we face a growing economic crisis in the wake of COVID-19, with Dover’s unemployment rate at 17.3% as of April 2020. We are demanding that our voices be heard now, and that real change be made to the way this city allocates its resources. Despite the clear need to fund services dedicated to mental health, substance abuse, and affordable housing, the current budget proposal for FY 2021 calls for an increase of $511,672 in funding for the Dover Police Department. More funding for Dover’s already 50-plus-officer force is not what our community needs in this moment. In a recent interview with Fosters, Police Chief Breault’s own words made plain why a shift away from increased funding for police is imperative right now. In describing the 22% increase in service calls since 2010, Chief Breault noted that this increase was largely driven by so-called “‘social service related calls,’ which include drugs, homelessness and mental illness.” Under Chief Breault’s own reasoning, Dover needs to allocate funding for services that will address our interrelated crises in mental health resources, substance use treatment, and affordable housing. Our police officers are not experts in these fields. Our community’s challenges are best addressed with skilled and dedicated social workers and other support staff who can provide trained expertise and assistance in these interconnected areas that affect those in poverty and/or struggling with substance use. Adding more armed police officers and making them the first line of response in myriad crises does not effectively serve the needs of everyone in our community. As a taxpayer of the city of Dover, I insist that funds be reallocated from the Dover Police into services that meet these needs. Finally, as we continue to witness acts of police brutality against People of Color in the United States, this moment demands that we reorient funds in our community. We must stand with cities around the country who have called to defund the police. I likewise demand increased investment in services that provide support affordable housing, education, and other human services for the most in need. The current crises we face requires a drastic reorienting of our priorities. Further funding for the police will not adequately address the issues we face today. Thank you for your time and attention, [YOUR NAME] [YOUR ADDRESS] [YOUR EMAIL] [YOUR PHONE NUMBER] layout: email ---
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket 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. import logging from synapse.push.emailpusher import EmailPusher from synapse.push.mailer import Mailer from .httppusher import HttpPusher logger = logging.getLogger(__name__) class PusherFactory: def __init__(self, hs): self.hs = hs self.config = hs.config self.pusher_types = {"http": HttpPusher} logger.info("email enable notifs: %r", hs.config.email_enable_notifs) if hs.config.email_enable_notifs: self.mailers = {} # app_name -> Mailer self._notif_template_html = hs.config.email_notif_template_html self._notif_template_text = hs.config.email_notif_template_text self.pusher_types["email"] = self._create_email_pusher logger.info("defined email pusher type") def create_pusher(self, pusherdict): kind = pusherdict["kind"] f = self.pusher_types.get(kind, None) if not f: return None logger.debug("creating %s pusher for %r", kind, pusherdict) return f(self.hs, pusherdict) def _create_email_pusher(self, _hs, pusherdict): app_name = self._app_name_from_pusherdict(pusherdict) mailer = self.mailers.get(app_name) if not mailer: mailer = Mailer( hs=self.hs, app_name=app_name, template_html=self._notif_template_html, template_text=self._notif_template_text, ) self.mailers[app_name] = mailer return EmailPusher(self.hs, pusherdict, mailer) def _app_name_from_pusherdict(self, pusherdict): data = pusherdict["data"] if isinstance(data, dict): brand = data.get("brand") if isinstance(brand, str): return brand return self.config.email_app_name
{ "pile_set_name": "Github" }
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_ERRNO_H #define _ASM_GENERIC_ERRNO_H #include <asm-generic/errno-base.h> #define EDEADLK 35 /* Resource deadlock would occur */ #define ENAMETOOLONG 36 /* File name too long */ #define ENOLCK 37 /* No record locks available */ /* * This error code is special: arch syscall entry code will return * -ENOSYS if users try to call a syscall that doesn't exist. To keep * failures of syscalls that really do exist distinguishable from * failures due to attempts to use a nonexistent syscall, syscall * implementations should refrain from returning -ENOSYS. */ #define ENOSYS 38 /* Invalid system call number */ #define ENOTEMPTY 39 /* Directory not empty */ #define ELOOP 40 /* Too many symbolic links encountered */ #define EWOULDBLOCK EAGAIN /* Operation would block */ #define ENOMSG 42 /* No message of desired type */ #define EIDRM 43 /* Identifier removed */ #define ECHRNG 44 /* Channel number out of range */ #define EL2NSYNC 45 /* Level 2 not synchronized */ #define EL3HLT 46 /* Level 3 halted */ #define EL3RST 47 /* Level 3 reset */ #define ELNRNG 48 /* Link number out of range */ #define EUNATCH 49 /* Protocol driver not attached */ #define ENOCSI 50 /* No CSI structure available */ #define EL2HLT 51 /* Level 2 halted */ #define EBADE 52 /* Invalid exchange */ #define EBADR 53 /* Invalid request descriptor */ #define EXFULL 54 /* Exchange full */ #define ENOANO 55 /* No anode */ #define EBADRQC 56 /* Invalid request code */ #define EBADSLT 57 /* Invalid slot */ #define EDEADLOCK EDEADLK #define EBFONT 59 /* Bad font file format */ #define ENOSTR 60 /* Device not a stream */ #define ENODATA 61 /* No data available */ #define ETIME 62 /* Timer expired */ #define ENOSR 63 /* Out of streams resources */ #define ENONET 64 /* Machine is not on the network */ #define ENOPKG 65 /* Package not installed */ #define EREMOTE 66 /* Object is remote */ #define ENOLINK 67 /* Link has been severed */ #define EADV 68 /* Advertise error */ #define ESRMNT 69 /* Srmount error */ #define ECOMM 70 /* Communication error on send */ #define EPROTO 71 /* Protocol error */ #define EMULTIHOP 72 /* Multihop attempted */ #define EDOTDOT 73 /* RFS specific error */ #define EBADMSG 74 /* Not a data message */ #define EOVERFLOW 75 /* Value too large for defined data type */ #define ENOTUNIQ 76 /* Name not unique on network */ #define EBADFD 77 /* File descriptor in bad state */ #define EREMCHG 78 /* Remote address changed */ #define ELIBACC 79 /* Can not access a needed shared library */ #define ELIBBAD 80 /* Accessing a corrupted shared library */ #define ELIBSCN 81 /* .lib section in a.out corrupted */ #define ELIBMAX 82 /* Attempting to link in too many shared libraries */ #define ELIBEXEC 83 /* Cannot exec a shared library directly */ #define EILSEQ 84 /* Illegal byte sequence */ #define ERESTART 85 /* Interrupted system call should be restarted */ #define ESTRPIPE 86 /* Streams pipe error */ #define EUSERS 87 /* Too many users */ #define ENOTSOCK 88 /* Socket operation on non-socket */ #define EDESTADDRREQ 89 /* Destination address required */ #define EMSGSIZE 90 /* Message too long */ #define EPROTOTYPE 91 /* Protocol wrong type for socket */ #define ENOPROTOOPT 92 /* Protocol not available */ #define EPROTONOSUPPORT 93 /* Protocol not supported */ #define ESOCKTNOSUPPORT 94 /* Socket type not supported */ #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ #define EPFNOSUPPORT 96 /* Protocol family not supported */ #define EAFNOSUPPORT 97 /* Address family not supported by protocol */ #define EADDRINUSE 98 /* Address already in use */ #define EADDRNOTAVAIL 99 /* Cannot assign requested address */ #define ENETDOWN 100 /* Network is down */ #define ENETUNREACH 101 /* Network is unreachable */ #define ENETRESET 102 /* Network dropped connection because of reset */ #define ECONNABORTED 103 /* Software caused connection abort */ #define ECONNRESET 104 /* Connection reset by peer */ #define ENOBUFS 105 /* No buffer space available */ #define EISCONN 106 /* Transport endpoint is already connected */ #define ENOTCONN 107 /* Transport endpoint is not connected */ #define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ #define ETOOMANYREFS 109 /* Too many references: cannot splice */ #define ETIMEDOUT 110 /* Connection timed out */ #define ECONNREFUSED 111 /* Connection refused */ #define EHOSTDOWN 112 /* Host is down */ #define EHOSTUNREACH 113 /* No route to host */ #define EALREADY 114 /* Operation already in progress */ #define EINPROGRESS 115 /* Operation now in progress */ #define ESTALE 116 /* Stale file handle */ #define EUCLEAN 117 /* Structure needs cleaning */ #define ENOTNAM 118 /* Not a XENIX named type file */ #define ENAVAIL 119 /* No XENIX semaphores available */ #define EISNAM 120 /* Is a named type file */ #define EREMOTEIO 121 /* Remote I/O error */ #define EDQUOT 122 /* Quota exceeded */ #define ENOMEDIUM 123 /* No medium found */ #define EMEDIUMTYPE 124 /* Wrong medium type */ #define ECANCELED 125 /* Operation Canceled */ #define ENOKEY 126 /* Required key not available */ #define EKEYEXPIRED 127 /* Key has expired */ #define EKEYREVOKED 128 /* Key has been revoked */ #define EKEYREJECTED 129 /* Key was rejected by service */ /* for robust mutexes */ #define EOWNERDEAD 130 /* Owner died */ #define ENOTRECOVERABLE 131 /* State not recoverable */ #define ERFKILL 132 /* Operation not possible due to RF-kill */ #define EHWPOISON 133 /* Memory page has hardware error */ #endif
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <plist version="1.0"> <dict/> </plist>
{ "pile_set_name": "Github" }
package com.snowcattle.game.service.rpc.client; /** * Created by jiangwenping on 17/3/13. * rpc 服务器列表选择 */ public final class RpcContextHolder { private static final ThreadLocal<RpcContextHolderObject> contextHolder = new ThreadLocal<RpcContextHolderObject>(); private RpcContextHolder() { } public static RpcContextHolderObject getContext() { return contextHolder.get(); } /** * 通过字符串选择数据源 * @param rpcContextHolderObject */ public static void setContextHolder(RpcContextHolderObject rpcContextHolderObject) { contextHolder.set(rpcContextHolderObject); } }
{ "pile_set_name": "Github" }
# frozen_string_literal: true Before("@organizations") do @service = Aws::Organizations::Resource.new @client = @service.client end After("@organizations") do # shared cleanup logic end
{ "pile_set_name": "Github" }
# Copyright (c) 2011 Florian Mounier # Copyright (c) 2012, 2014-2015 Tycho Andersen # Copyright (c) 2013 Mattias Svala # Copyright (c) 2013 Craig Barnes # Copyright (c) 2014 ramnes # Copyright (c) 2014 Sean Vig # Copyright (c) 2014 Adi Sieker # Copyright (c) 2014 Chris Wesseling # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import pytest import libqtile.config from libqtile import layout from libqtile.confreader import Config from test.conftest import no_xinerama from test.layouts.layout_utils import ( assert_dimensions, assert_focus_path, assert_focused, ) class VerticalTileConfig(Config): auto_fullscreen = True groups = [ libqtile.config.Group("a"), libqtile.config.Group("b"), libqtile.config.Group("c"), libqtile.config.Group("d") ] layouts = [ layout.VerticalTile(columns=2) ] floating_layout = libqtile.layout.floating.Floating() keys = [] mouse = [] screens = [] def verticaltile_config(x): return no_xinerama(pytest.mark.parametrize("qtile", [VerticalTileConfig], indirect=True)(x)) @verticaltile_config def test_verticaltile_simple(qtile): qtile.test_window("one") assert_dimensions(qtile, 0, 0, 800, 600) qtile.test_window("two") assert_dimensions(qtile, 0, 300, 798, 298) qtile.test_window("three") assert_dimensions(qtile, 0, 400, 798, 198) @verticaltile_config def test_verticaltile_maximize(qtile): qtile.test_window("one") assert_dimensions(qtile, 0, 0, 800, 600) qtile.test_window("two") assert_dimensions(qtile, 0, 300, 798, 298) # Maximize the bottom layout, taking 75% of space qtile.c.layout.maximize() assert_dimensions(qtile, 0, 150, 798, 448) @verticaltile_config def test_verticaltile_window_focus_cycle(qtile): # setup 3 tiled and two floating clients qtile.test_window("one") qtile.test_window("two") qtile.test_window("float1") qtile.c.window.toggle_floating() qtile.test_window("float2") qtile.c.window.toggle_floating() qtile.test_window("three") # test preconditions assert qtile.c.layout.info()['clients'] == ['one', 'two', 'three'] # last added window has focus assert_focused(qtile, "three") # assert window focus cycle, according to order in layout assert_focus_path(qtile, 'float1', 'float2', 'one', 'two', 'three')
{ "pile_set_name": "Github" }
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam <[email protected]> // Copyright (C) 2012 Gael Guennebaud <[email protected]> // // 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/. #ifndef EIGEN_SPARSE_LU_H #define EIGEN_SPARSE_LU_H namespace Eigen { template <typename _MatrixType, typename _OrderingType = COLAMDOrdering<typename _MatrixType::Index> > class SparseLU; template <typename MappedSparseMatrixType> struct SparseLUMatrixLReturnType; template <typename MatrixLType, typename MatrixUType> struct SparseLUMatrixUReturnType; /** \ingroup SparseLU_Module * \class SparseLU * * \brief Sparse supernodal LU factorization for general matrices * * This class implements the supernodal LU factorization for general matrices. * It uses the main techniques from the sequential SuperLU package * (http://crd-legacy.lbl.gov/~xiaoye/SuperLU/). It handles transparently real * and complex arithmetics with single and double precision, depending on the * scalar type of your input matrix. * The code has been optimized to provide BLAS-3 operations during supernode-panel updates. * It benefits directly from the built-in high-performant Eigen BLAS routines. * Moreover, when the size of a supernode is very small, the BLAS calls are avoided to * enable a better optimization from the compiler. For best performance, * you should compile it with NDEBUG flag to avoid the numerous bounds checking on vectors. * * An important parameter of this class is the ordering method. It is used to reorder the columns * (and eventually the rows) of the matrix to reduce the number of new elements that are created during * numerical factorization. The cheapest method available is COLAMD. * See \link OrderingMethods_Module the OrderingMethods module \endlink for the list of * built-in and external ordering methods. * * Simple example with key steps * \code * VectorXd x(n), b(n); * SparseMatrix<double, ColMajor> A; * SparseLU<SparseMatrix<scalar, ColMajor>, COLAMDOrdering<Index> > solver; * // fill A and b; * // Compute the ordering permutation vector from the structural pattern of A * solver.analyzePattern(A); * // Compute the numerical factorization * solver.factorize(A); * //Use the factors to solve the linear system * x = solver.solve(b); * \endcode * * \warning The input matrix A should be in a \b compressed and \b column-major form. * Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix. * * \note Unlike the initial SuperLU implementation, there is no step to equilibrate the matrix. * For badly scaled matrices, this step can be useful to reduce the pivoting during factorization. * If this is the case for your matrices, you can try the basic scaling method at * "unsupported/Eigen/src/IterativeSolvers/Scaling.h" * * \tparam _MatrixType The type of the sparse matrix. It must be a column-major SparseMatrix<> * \tparam _OrderingType The ordering method to use, either AMD, COLAMD or METIS. Default is COLMAD * * * \sa \ref TutorialSparseDirectSolvers * \sa \ref OrderingMethods_Module */ template <typename _MatrixType, typename _OrderingType> class SparseLU : public internal::SparseLUImpl<typename _MatrixType::Scalar, typename _MatrixType::Index> { public: typedef _MatrixType MatrixType; typedef _OrderingType OrderingType; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef typename MatrixType::Index Index; typedef SparseMatrix<Scalar,ColMajor,Index> NCMatrix; typedef internal::MappedSuperNodalMatrix<Scalar, Index> SCMatrix; typedef Matrix<Scalar,Dynamic,1> ScalarVector; typedef Matrix<Index,Dynamic,1> IndexVector; typedef PermutationMatrix<Dynamic, Dynamic, Index> PermutationType; typedef internal::SparseLUImpl<Scalar, Index> Base; public: SparseLU():m_isInitialized(true),m_lastError(""),m_Ustore(0,0,0,0,0,0),m_symmetricmode(false),m_diagpivotthresh(1.0),m_detPermR(1) { initperfvalues(); } SparseLU(const MatrixType& matrix):m_isInitialized(true),m_lastError(""),m_Ustore(0,0,0,0,0,0),m_symmetricmode(false),m_diagpivotthresh(1.0),m_detPermR(1) { initperfvalues(); compute(matrix); } ~SparseLU() { // Free all explicit dynamic pointers } void analyzePattern (const MatrixType& matrix); void factorize (const MatrixType& matrix); void simplicialfactorize(const MatrixType& matrix); /** * Compute the symbolic and numeric factorization of the input sparse matrix. * The input matrix should be in column-major storage. */ void compute (const MatrixType& matrix) { // Analyze analyzePattern(matrix); //Factorize factorize(matrix); } inline Index rows() const { return m_mat.rows(); } inline Index cols() const { return m_mat.cols(); } /** Indicate that the pattern of the input matrix is symmetric */ void isSymmetric(bool sym) { m_symmetricmode = sym; } /** \returns an expression of the matrix L, internally stored as supernodes * The only operation available with this expression is the triangular solve * \code * y = b; matrixL().solveInPlace(y); * \endcode */ SparseLUMatrixLReturnType<SCMatrix> matrixL() const { return SparseLUMatrixLReturnType<SCMatrix>(m_Lstore); } /** \returns an expression of the matrix U, * The only operation available with this expression is the triangular solve * \code * y = b; matrixU().solveInPlace(y); * \endcode */ SparseLUMatrixUReturnType<SCMatrix,MappedSparseMatrix<Scalar,ColMajor,Index> > matrixU() const { return SparseLUMatrixUReturnType<SCMatrix, MappedSparseMatrix<Scalar,ColMajor,Index> >(m_Lstore, m_Ustore); } /** * \returns a reference to the row matrix permutation \f$ P_r \f$ such that \f$P_r A P_c^T = L U\f$ * \sa colsPermutation() */ inline const PermutationType& rowsPermutation() const { return m_perm_r; } /** * \returns a reference to the column matrix permutation\f$ P_c^T \f$ such that \f$P_r A P_c^T = L U\f$ * \sa rowsPermutation() */ inline const PermutationType& colsPermutation() const { return m_perm_c; } /** Set the threshold used for a diagonal entry to be an acceptable pivot. */ void setPivotThreshold(const RealScalar& thresh) { m_diagpivotthresh = thresh; } /** \returns the solution X of \f$ A X = B \f$ using the current decomposition of A. * * \warning the destination matrix X in X = this->solve(B) must be colmun-major. * * \sa compute() */ template<typename Rhs> inline const internal::solve_retval<SparseLU, Rhs> solve(const MatrixBase<Rhs>& B) const { eigen_assert(m_factorizationIsOk && "SparseLU is not initialized."); eigen_assert(rows()==B.rows() && "SparseLU::solve(): invalid number of rows of the right hand side matrix B"); return internal::solve_retval<SparseLU, Rhs>(*this, B.derived()); } /** \returns the solution X of \f$ A X = B \f$ using the current decomposition of A. * * \sa compute() */ template<typename Rhs> inline const internal::sparse_solve_retval<SparseLU, Rhs> solve(const SparseMatrixBase<Rhs>& B) const { eigen_assert(m_factorizationIsOk && "SparseLU is not initialized."); eigen_assert(rows()==B.rows() && "SparseLU::solve(): invalid number of rows of the right hand side matrix B"); return internal::sparse_solve_retval<SparseLU, Rhs>(*this, B.derived()); } /** \brief Reports whether previous computation was successful. * * \returns \c Success if computation was succesful, * \c NumericalIssue if the LU factorization reports a problem, zero diagonal for instance * \c InvalidInput if the input matrix is invalid * * \sa iparm() */ ComputationInfo info() const { eigen_assert(m_isInitialized && "Decomposition is not initialized."); return m_info; } /** * \returns A string describing the type of error */ std::string lastErrorMessage() const { return m_lastError; } template<typename Rhs, typename Dest> bool _solve(const MatrixBase<Rhs> &B, MatrixBase<Dest> &X_base) const { Dest& X(X_base.derived()); eigen_assert(m_factorizationIsOk && "The matrix should be factorized first"); EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); // Permute the right hand side to form X = Pr*B // on return, X is overwritten by the computed solution X.resize(B.rows(),B.cols()); // this ugly const_cast_derived() helps to detect aliasing when applying the permutations for(Index j = 0; j < B.cols(); ++j) X.col(j) = rowsPermutation() * B.const_cast_derived().col(j); //Forward substitution with L this->matrixL().solveInPlace(X); this->matrixU().solveInPlace(X); // Permute back the solution for (Index j = 0; j < B.cols(); ++j) X.col(j) = colsPermutation().inverse() * X.col(j); return true; } /** * \returns the absolute value of the determinant of the matrix of which * *this is the QR decomposition. * * \warning a determinant can be very big or small, so for matrices * of large enough dimension, there is a risk of overflow/underflow. * One way to work around that is to use logAbsDeterminant() instead. * * \sa logAbsDeterminant(), signDeterminant() */ Scalar absDeterminant() { eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); // Initialize with the determinant of the row matrix Scalar det = Scalar(1.); // Note that the diagonal blocks of U are stored in supernodes, // which are available in the L part :) for (Index j = 0; j < this->cols(); ++j) { for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) { if(it.index() == j) { using std::abs; det *= abs(it.value()); break; } } } return det; } /** \returns the natural log of the absolute value of the determinant of the matrix * of which **this is the QR decomposition * * \note This method is useful to work around the risk of overflow/underflow that's * inherent to the determinant computation. * * \sa absDeterminant(), signDeterminant() */ Scalar logAbsDeterminant() const { eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); Scalar det = Scalar(0.); for (Index j = 0; j < this->cols(); ++j) { for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) { if(it.row() < j) continue; if(it.row() == j) { using std::log; using std::abs; det += log(abs(it.value())); break; } } } return det; } /** \returns A number representing the sign of the determinant * * \sa absDeterminant(), logAbsDeterminant() */ Scalar signDeterminant() { eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); // Initialize with the determinant of the row matrix Index det = 1; // Note that the diagonal blocks of U are stored in supernodes, // which are available in the L part :) for (Index j = 0; j < this->cols(); ++j) { for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) { if(it.index() == j) { if(it.value()<0) det = -det; else if(it.value()==0) return 0; break; } } } return det * m_detPermR * m_detPermC; } /** \returns The determinant of the matrix. * * \sa absDeterminant(), logAbsDeterminant() */ Scalar determinant() { eigen_assert(m_factorizationIsOk && "The matrix should be factorized first."); // Initialize with the determinant of the row matrix Scalar det = Scalar(1.); // Note that the diagonal blocks of U are stored in supernodes, // which are available in the L part :) for (Index j = 0; j < this->cols(); ++j) { for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it) { if(it.index() == j) { det *= it.value(); break; } } } return det * Scalar(m_detPermR * m_detPermC); } protected: // Functions void initperfvalues() { m_perfv.panel_size = 16; m_perfv.relax = 1; m_perfv.maxsuper = 128; m_perfv.rowblk = 16; m_perfv.colblk = 8; m_perfv.fillfactor = 20; } // Variables mutable ComputationInfo m_info; bool m_isInitialized; bool m_factorizationIsOk; bool m_analysisIsOk; std::string m_lastError; NCMatrix m_mat; // The input (permuted ) matrix SCMatrix m_Lstore; // The lower triangular matrix (supernodal) MappedSparseMatrix<Scalar,ColMajor,Index> m_Ustore; // The upper triangular matrix PermutationType m_perm_c; // Column permutation PermutationType m_perm_r ; // Row permutation IndexVector m_etree; // Column elimination tree typename Base::GlobalLU_t m_glu; // SparseLU options bool m_symmetricmode; // values for performance internal::perfvalues<Index> m_perfv; RealScalar m_diagpivotthresh; // Specifies the threshold used for a diagonal entry to be an acceptable pivot Index m_nnzL, m_nnzU; // Nonzeros in L and U factors Index m_detPermR, m_detPermC; // Determinants of the permutation matrices private: // Disable copy constructor SparseLU (const SparseLU& ); }; // End class SparseLU // Functions needed by the anaysis phase /** * Compute the column permutation to minimize the fill-in * * - Apply this permutation to the input matrix - * * - Compute the column elimination tree on the permuted matrix * * - Postorder the elimination tree and the column permutation * */ template <typename MatrixType, typename OrderingType> void SparseLU<MatrixType, OrderingType>::analyzePattern(const MatrixType& mat) { //TODO It is possible as in SuperLU to compute row and columns scaling vectors to equilibrate the matrix mat. OrderingType ord; ord(mat,m_perm_c); // Apply the permutation to the column of the input matrix //First copy the whole input matrix. m_mat = mat; if (m_perm_c.size()) { m_mat.uncompress(); //NOTE: The effect of this command is only to create the InnerNonzeros pointers. FIXME : This vector is filled but not subsequently used. //Then, permute only the column pointers const Index * outerIndexPtr; if (mat.isCompressed()) outerIndexPtr = mat.outerIndexPtr(); else { Index *outerIndexPtr_t = new Index[mat.cols()+1]; for(Index i = 0; i <= mat.cols(); i++) outerIndexPtr_t[i] = m_mat.outerIndexPtr()[i]; outerIndexPtr = outerIndexPtr_t; } for (Index i = 0; i < mat.cols(); i++) { m_mat.outerIndexPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i]; m_mat.innerNonZeroPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i+1] - outerIndexPtr[i]; } if(!mat.isCompressed()) delete[] outerIndexPtr; } // Compute the column elimination tree of the permuted matrix IndexVector firstRowElt; internal::coletree(m_mat, m_etree,firstRowElt); // In symmetric mode, do not do postorder here if (!m_symmetricmode) { IndexVector post, iwork; // Post order etree internal::treePostorder(m_mat.cols(), m_etree, post); // Renumber etree in postorder Index m = m_mat.cols(); iwork.resize(m+1); for (Index i = 0; i < m; ++i) iwork(post(i)) = post(m_etree(i)); m_etree = iwork; // Postmultiply A*Pc by post, i.e reorder the matrix according to the postorder of the etree PermutationType post_perm(m); for (Index i = 0; i < m; i++) post_perm.indices()(i) = post(i); // Combine the two permutations : postorder the permutation for future use if(m_perm_c.size()) { m_perm_c = post_perm * m_perm_c; } } // end postordering m_analysisIsOk = true; } // Functions needed by the numerical factorization phase /** * - Numerical factorization * - Interleaved with the symbolic factorization * On exit, info is * * = 0: successful factorization * * > 0: if info = i, and i is * * <= A->ncol: U(i,i) is exactly zero. The factorization has * been completed, but the factor U is exactly singular, * and division by zero will occur if it is used to solve a * system of equations. * * > A->ncol: number of bytes allocated when memory allocation * failure occurred, plus A->ncol. If lwork = -1, it is * the estimated amount of space needed, plus A->ncol. */ template <typename MatrixType, typename OrderingType> void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix) { using internal::emptyIdxLU; eigen_assert(m_analysisIsOk && "analyzePattern() should be called first"); eigen_assert((matrix.rows() == matrix.cols()) && "Only for squared matrices"); typedef typename IndexVector::Scalar Index; // Apply the column permutation computed in analyzepattern() // m_mat = matrix * m_perm_c.inverse(); m_mat = matrix; if (m_perm_c.size()) { m_mat.uncompress(); //NOTE: The effect of this command is only to create the InnerNonzeros pointers. //Then, permute only the column pointers const Index * outerIndexPtr; if (matrix.isCompressed()) outerIndexPtr = matrix.outerIndexPtr(); else { Index* outerIndexPtr_t = new Index[matrix.cols()+1]; for(Index i = 0; i <= matrix.cols(); i++) outerIndexPtr_t[i] = m_mat.outerIndexPtr()[i]; outerIndexPtr = outerIndexPtr_t; } for (Index i = 0; i < matrix.cols(); i++) { m_mat.outerIndexPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i]; m_mat.innerNonZeroPtr()[m_perm_c.indices()(i)] = outerIndexPtr[i+1] - outerIndexPtr[i]; } if(!matrix.isCompressed()) delete[] outerIndexPtr; } else { //FIXME This should not be needed if the empty permutation is handled transparently m_perm_c.resize(matrix.cols()); for(Index i = 0; i < matrix.cols(); ++i) m_perm_c.indices()(i) = i; } Index m = m_mat.rows(); Index n = m_mat.cols(); Index nnz = m_mat.nonZeros(); Index maxpanel = m_perfv.panel_size * m; // Allocate working storage common to the factor routines Index lwork = 0; Index info = Base::memInit(m, n, nnz, lwork, m_perfv.fillfactor, m_perfv.panel_size, m_glu); if (info) { m_lastError = "UNABLE TO ALLOCATE WORKING MEMORY\n\n" ; m_factorizationIsOk = false; return ; } // Set up pointers for integer working arrays IndexVector segrep(m); segrep.setZero(); IndexVector parent(m); parent.setZero(); IndexVector xplore(m); xplore.setZero(); IndexVector repfnz(maxpanel); IndexVector panel_lsub(maxpanel); IndexVector xprune(n); xprune.setZero(); IndexVector marker(m*internal::LUNoMarker); marker.setZero(); repfnz.setConstant(-1); panel_lsub.setConstant(-1); // Set up pointers for scalar working arrays ScalarVector dense; dense.setZero(maxpanel); ScalarVector tempv; tempv.setZero(internal::LUnumTempV(m, m_perfv.panel_size, m_perfv.maxsuper, /*m_perfv.rowblk*/m) ); // Compute the inverse of perm_c PermutationType iperm_c(m_perm_c.inverse()); // Identify initial relaxed snodes IndexVector relax_end(n); if ( m_symmetricmode == true ) Base::heap_relax_snode(n, m_etree, m_perfv.relax, marker, relax_end); else Base::relax_snode(n, m_etree, m_perfv.relax, marker, relax_end); m_perm_r.resize(m); m_perm_r.indices().setConstant(-1); marker.setConstant(-1); m_detPermR = 1; // Record the determinant of the row permutation m_glu.supno(0) = emptyIdxLU; m_glu.xsup.setConstant(0); m_glu.xsup(0) = m_glu.xlsub(0) = m_glu.xusub(0) = m_glu.xlusup(0) = Index(0); // Work on one 'panel' at a time. A panel is one of the following : // (a) a relaxed supernode at the bottom of the etree, or // (b) panel_size contiguous columns, <panel_size> defined by the user Index jcol; IndexVector panel_histo(n); Index pivrow; // Pivotal row number in the original row matrix Index nseg1; // Number of segments in U-column above panel row jcol Index nseg; // Number of segments in each U-column Index irep; Index i, k, jj; for (jcol = 0; jcol < n; ) { // Adjust panel size so that a panel won't overlap with the next relaxed snode. Index panel_size = m_perfv.panel_size; // upper bound on panel width for (k = jcol + 1; k < (std::min)(jcol+panel_size, n); k++) { if (relax_end(k) != emptyIdxLU) { panel_size = k - jcol; break; } } if (k == n) panel_size = n - jcol; // Symbolic outer factorization on a panel of columns Base::panel_dfs(m, panel_size, jcol, m_mat, m_perm_r.indices(), nseg1, dense, panel_lsub, segrep, repfnz, xprune, marker, parent, xplore, m_glu); // Numeric sup-panel updates in topological order Base::panel_bmod(m, panel_size, jcol, nseg1, dense, tempv, segrep, repfnz, m_glu); // Sparse LU within the panel, and below the panel diagonal for ( jj = jcol; jj< jcol + panel_size; jj++) { k = (jj - jcol) * m; // Column index for w-wide arrays nseg = nseg1; // begin after all the panel segments //Depth-first-search for the current column VectorBlock<IndexVector> panel_lsubk(panel_lsub, k, m); VectorBlock<IndexVector> repfnz_k(repfnz, k, m); info = Base::column_dfs(m, jj, m_perm_r.indices(), m_perfv.maxsuper, nseg, panel_lsubk, segrep, repfnz_k, xprune, marker, parent, xplore, m_glu); if ( info ) { m_lastError = "UNABLE TO EXPAND MEMORY IN COLUMN_DFS() "; m_info = NumericalIssue; m_factorizationIsOk = false; return; } // Numeric updates to this column VectorBlock<ScalarVector> dense_k(dense, k, m); VectorBlock<IndexVector> segrep_k(segrep, nseg1, m-nseg1); info = Base::column_bmod(jj, (nseg - nseg1), dense_k, tempv, segrep_k, repfnz_k, jcol, m_glu); if ( info ) { m_lastError = "UNABLE TO EXPAND MEMORY IN COLUMN_BMOD() "; m_info = NumericalIssue; m_factorizationIsOk = false; return; } // Copy the U-segments to ucol(*) info = Base::copy_to_ucol(jj, nseg, segrep, repfnz_k ,m_perm_r.indices(), dense_k, m_glu); if ( info ) { m_lastError = "UNABLE TO EXPAND MEMORY IN COPY_TO_UCOL() "; m_info = NumericalIssue; m_factorizationIsOk = false; return; } // Form the L-segment info = Base::pivotL(jj, m_diagpivotthresh, m_perm_r.indices(), iperm_c.indices(), pivrow, m_glu); if ( info ) { m_lastError = "THE MATRIX IS STRUCTURALLY SINGULAR ... ZERO COLUMN AT "; std::ostringstream returnInfo; returnInfo << info; m_lastError += returnInfo.str(); m_info = NumericalIssue; m_factorizationIsOk = false; return; } // Update the determinant of the row permutation matrix // FIXME: the following test is not correct, we should probably take iperm_c into account and pivrow is not directly the row pivot. if (pivrow != jj) m_detPermR = -m_detPermR; // Prune columns (0:jj-1) using column jj Base::pruneL(jj, m_perm_r.indices(), pivrow, nseg, segrep, repfnz_k, xprune, m_glu); // Reset repfnz for this column for (i = 0; i < nseg; i++) { irep = segrep(i); repfnz_k(irep) = emptyIdxLU; } } // end SparseLU within the panel jcol += panel_size; // Move to the next panel } // end for -- end elimination m_detPermR = m_perm_r.determinant(); m_detPermC = m_perm_c.determinant(); // Count the number of nonzeros in factors Base::countnz(n, m_nnzL, m_nnzU, m_glu); // Apply permutation to the L subscripts Base::fixupL(n, m_perm_r.indices(), m_glu); // Create supernode matrix L m_Lstore.setInfos(m, n, m_glu.lusup, m_glu.xlusup, m_glu.lsub, m_glu.xlsub, m_glu.supno, m_glu.xsup); // Create the column major upper sparse matrix U; new (&m_Ustore) MappedSparseMatrix<Scalar, ColMajor, Index> ( m, n, m_nnzU, m_glu.xusub.data(), m_glu.usub.data(), m_glu.ucol.data() ); m_info = Success; m_factorizationIsOk = true; } template<typename MappedSupernodalType> struct SparseLUMatrixLReturnType : internal::no_assignment_operator { typedef typename MappedSupernodalType::Index Index; typedef typename MappedSupernodalType::Scalar Scalar; SparseLUMatrixLReturnType(const MappedSupernodalType& mapL) : m_mapL(mapL) { } Index rows() { return m_mapL.rows(); } Index cols() { return m_mapL.cols(); } template<typename Dest> void solveInPlace( MatrixBase<Dest> &X) const { m_mapL.solveInPlace(X); } const MappedSupernodalType& m_mapL; }; template<typename MatrixLType, typename MatrixUType> struct SparseLUMatrixUReturnType : internal::no_assignment_operator { typedef typename MatrixLType::Index Index; typedef typename MatrixLType::Scalar Scalar; SparseLUMatrixUReturnType(const MatrixLType& mapL, const MatrixUType& mapU) : m_mapL(mapL),m_mapU(mapU) { } Index rows() { return m_mapL.rows(); } Index cols() { return m_mapL.cols(); } template<typename Dest> void solveInPlace(MatrixBase<Dest> &X) const { Index nrhs = X.cols(); Index n = X.rows(); // Backward solve with U for (Index k = m_mapL.nsuper(); k >= 0; k--) { Index fsupc = m_mapL.supToCol()[k]; Index lda = m_mapL.colIndexPtr()[fsupc+1] - m_mapL.colIndexPtr()[fsupc]; // leading dimension Index nsupc = m_mapL.supToCol()[k+1] - fsupc; Index luptr = m_mapL.colIndexPtr()[fsupc]; if (nsupc == 1) { for (Index j = 0; j < nrhs; j++) { X(fsupc, j) /= m_mapL.valuePtr()[luptr]; } } else { Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > A( &(m_mapL.valuePtr()[luptr]), nsupc, nsupc, OuterStride<>(lda) ); Map< Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) ); U = A.template triangularView<Upper>().solve(U); } for (Index j = 0; j < nrhs; ++j) { for (Index jcol = fsupc; jcol < fsupc + nsupc; jcol++) { typename MatrixUType::InnerIterator it(m_mapU, jcol); for ( ; it; ++it) { Index irow = it.index(); X(irow, j) -= X(jcol, j) * it.value(); } } } } // End For U-solve } const MatrixLType& m_mapL; const MatrixUType& m_mapU; }; namespace internal { template<typename _MatrixType, typename Derived, typename Rhs> struct solve_retval<SparseLU<_MatrixType,Derived>, Rhs> : solve_retval_base<SparseLU<_MatrixType,Derived>, Rhs> { typedef SparseLU<_MatrixType,Derived> Dec; EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs) template<typename Dest> void evalTo(Dest& dst) const { dec()._solve(rhs(),dst); } }; template<typename _MatrixType, typename Derived, typename Rhs> struct sparse_solve_retval<SparseLU<_MatrixType,Derived>, Rhs> : sparse_solve_retval_base<SparseLU<_MatrixType,Derived>, Rhs> { typedef SparseLU<_MatrixType,Derived> Dec; EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs) template<typename Dest> void evalTo(Dest& dst) const { this->defaultEvalTo(dst); } }; } // end namespace internal } // End namespace Eigen #endif
{ "pile_set_name": "Github" }
/* edid.S: EDID data template Copyright (C) 2012 Carsten Emde <[email protected]> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ /* Manufacturer */ #define MFG_LNX1 'L' #define MFG_LNX2 'N' #define MFG_LNX3 'X' #define SERIAL 0 #define YEAR 2012 #define WEEK 5 /* EDID 1.3 standard definitions */ #define XY_RATIO_16_10 0b00 #define XY_RATIO_4_3 0b01 #define XY_RATIO_5_4 0b10 #define XY_RATIO_16_9 0b11 /* Provide defaults for the timing bits */ #ifndef ESTABLISHED_TIMING1_BITS #define ESTABLISHED_TIMING1_BITS 0x00 #endif #ifndef ESTABLISHED_TIMING2_BITS #define ESTABLISHED_TIMING2_BITS 0x00 #endif #ifndef ESTABLISHED_TIMING3_BITS #define ESTABLISHED_TIMING3_BITS 0x00 #endif #define mfgname2id(v1,v2,v3) \ ((((v1-'@')&0x1f)<<10)+(((v2-'@')&0x1f)<<5)+((v3-'@')&0x1f)) #define swap16(v1) ((v1>>8)+((v1&0xff)<<8)) #define lsbs2(v1,v2) (((v1&0x0f)<<4)+(v2&0x0f)) #define msbs2(v1,v2) ((((v1>>8)&0x0f)<<4)+((v2>>8)&0x0f)) #define msbs4(v1,v2,v3,v4) \ ((((v1>>8)&0x03)<<6)+(((v2>>8)&0x03)<<4)+\ (((v3>>4)&0x03)<<2)+((v4>>4)&0x03)) #define pixdpi2mm(pix,dpi) ((pix*25)/dpi) #define xsize pixdpi2mm(XPIX,DPI) #define ysize pixdpi2mm(YPIX,DPI) .data /* Fixed header pattern */ header: .byte 0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x00 mfg_id: .hword swap16(mfgname2id(MFG_LNX1, MFG_LNX2, MFG_LNX3)) prod_code: .hword 0 /* Serial number. 32 bits, little endian. */ serial_number: .long SERIAL /* Week of manufacture */ week: .byte WEEK /* Year of manufacture, less 1990. (1990-2245) If week=255, it is the model year instead */ year: .byte YEAR-1990 version: .byte VERSION /* EDID version, usually 1 (for 1.3) */ revision: .byte REVISION /* EDID revision, usually 3 (for 1.3) */ /* If Bit 7=1 Digital input. If set, the following bit definitions apply: Bits 6-1 Reserved, must be 0 Bit 0 Signal is compatible with VESA DFP 1.x TMDS CRGB, 1 pixel per clock, up to 8 bits per color, MSB aligned, If Bit 7=0 Analog input. If clear, the following bit definitions apply: Bits 6-5 Video white and sync levels, relative to blank 00=+0.7/-0.3 V; 01=+0.714/-0.286 V; 10=+1.0/-0.4 V; 11=+0.7/0 V Bit 4 Blank-to-black setup (pedestal) expected Bit 3 Separate sync supported Bit 2 Composite sync (on HSync) supported Bit 1 Sync on green supported Bit 0 VSync pulse must be serrated when somposite or sync-on-green is used. */ video_parms: .byte 0x6d /* Maximum horizontal image size, in centimetres (max 292 cm/115 in at 16:9 aspect ratio) */ max_hor_size: .byte xsize/10 /* Maximum vertical image size, in centimetres. If either byte is 0, undefined (e.g. projector) */ max_vert_size: .byte ysize/10 /* Display gamma, minus 1, times 100 (range 1.00-3.5 */ gamma: .byte 120 /* Bit 7 DPMS standby supported Bit 6 DPMS suspend supported Bit 5 DPMS active-off supported Bits 4-3 Display type: 00=monochrome; 01=RGB colour; 10=non-RGB multicolour; 11=undefined Bit 2 Standard sRGB colour space. Bytes 25-34 must contain sRGB standard values. Bit 1 Preferred timing mode specified in descriptor block 1. Bit 0 GTF supported with default parameter values. */ dsp_features: .byte 0xea /* Chromaticity coordinates. */ /* Red and green least-significant bits Bits 7-6 Red x value least-significant 2 bits Bits 5-4 Red y value least-significant 2 bits Bits 3-2 Green x value lst-significant 2 bits Bits 1-0 Green y value least-significant 2 bits */ red_green_lsb: .byte 0x5e /* Blue and white least-significant 2 bits */ blue_white_lsb: .byte 0xc0 /* Red x value most significant 8 bits. 0-255 encodes 0-0.996 (255/256); 0-0.999 (1023/1024) with lsbits */ red_x_msb: .byte 0xa4 /* Red y value most significant 8 bits */ red_y_msb: .byte 0x59 /* Green x and y value most significant 8 bits */ green_x_y_msb: .byte 0x4a,0x98 /* Blue x and y value most significant 8 bits */ blue_x_y_msb: .byte 0x25,0x20 /* Default white point x and y value most significant 8 bits */ white_x_y_msb: .byte 0x50,0x54 /* Established timings */ /* Bit 7 720x400 @ 70 Hz Bit 6 720x400 @ 88 Hz Bit 5 640x480 @ 60 Hz Bit 4 640x480 @ 67 Hz Bit 3 640x480 @ 72 Hz Bit 2 640x480 @ 75 Hz Bit 1 800x600 @ 56 Hz Bit 0 800x600 @ 60 Hz */ estbl_timing1: .byte ESTABLISHED_TIMING1_BITS /* Bit 7 800x600 @ 72 Hz Bit 6 800x600 @ 75 Hz Bit 5 832x624 @ 75 Hz Bit 4 1024x768 @ 87 Hz, interlaced (1024x768) Bit 3 1024x768 @ 60 Hz Bit 2 1024x768 @ 72 Hz Bit 1 1024x768 @ 75 Hz Bit 0 1280x1024 @ 75 Hz */ estbl_timing2: .byte ESTABLISHED_TIMING2_BITS /* Bit 7 1152x870 @ 75 Hz (Apple Macintosh II) Bits 6-0 Other manufacturer-specific display mod */ estbl_timing3: .byte ESTABLISHED_TIMING3_BITS /* Standard timing */ /* X resolution, less 31, divided by 8 (256-2288 pixels) */ std_xres: .byte (XPIX/8)-31 /* Y resolution, X:Y pixel ratio Bits 7-6 X:Y pixel ratio: 00=16:10; 01=4:3; 10=5:4; 11=16:9. Bits 5-0 Vertical frequency, less 60 (60-123 Hz) */ std_vres: .byte (XY_RATIO<<6)+VFREQ-60 .fill 7,2,0x0101 /* Unused */ descriptor1: /* Pixel clock in 10 kHz units. (0.-655.35 MHz, little-endian) */ clock: .hword CLOCK/10 /* Horizontal active pixels 8 lsbits (0-4095) */ x_act_lsb: .byte XPIX&0xff /* Horizontal blanking pixels 8 lsbits (0-4095) End of active to start of next active. */ x_blk_lsb: .byte XBLANK&0xff /* Bits 7-4 Horizontal active pixels 4 msbits Bits 3-0 Horizontal blanking pixels 4 msbits */ x_msbs: .byte msbs2(XPIX,XBLANK) /* Vertical active lines 8 lsbits (0-4095) */ y_act_lsb: .byte YPIX&0xff /* Vertical blanking lines 8 lsbits (0-4095) */ y_blk_lsb: .byte YBLANK&0xff /* Bits 7-4 Vertical active lines 4 msbits Bits 3-0 Vertical blanking lines 4 msbits */ y_msbs: .byte msbs2(YPIX,YBLANK) /* Horizontal sync offset pixels 8 lsbits (0-1023) From blanking start */ x_snc_off_lsb: .byte XOFFSET&0xff /* Horizontal sync pulse width pixels 8 lsbits (0-1023) */ x_snc_pls_lsb: .byte XPULSE&0xff /* Bits 7-4 Vertical sync offset lines 4 lsbits (0-63) Bits 3-0 Vertical sync pulse width lines 4 lsbits (0-63) */ y_snc_lsb: .byte lsbs2(YOFFSET, YPULSE) /* Bits 7-6 Horizontal sync offset pixels 2 msbits Bits 5-4 Horizontal sync pulse width pixels 2 msbits Bits 3-2 Vertical sync offset lines 2 msbits Bits 1-0 Vertical sync pulse width lines 2 msbits */ xy_snc_msbs: .byte msbs4(XOFFSET,XPULSE,YOFFSET,YPULSE) /* Horizontal display size, mm, 8 lsbits (0-4095 mm, 161 in) */ x_dsp_size: .byte xsize&0xff /* Vertical display size, mm, 8 lsbits (0-4095 mm, 161 in) */ y_dsp_size: .byte ysize&0xff /* Bits 7-4 Horizontal display size, mm, 4 msbits Bits 3-0 Vertical display size, mm, 4 msbits */ dsp_size_mbsb: .byte msbs2(xsize,ysize) /* Horizontal border pixels (each side; total is twice this) */ x_border: .byte 0 /* Vertical border lines (each side; total is twice this) */ y_border: .byte 0 /* Bit 7 Interlaced Bits 6-5 Stereo mode: 00=No stereo; other values depend on bit 0: Bit 0=0: 01=Field sequential, sync=1 during right; 10=similar, sync=1 during left; 11=4-way interleaved stereo Bit 0=1 2-way interleaved stereo: 01=Right image on even lines; 10=Left image on even lines; 11=side-by-side Bits 4-3 Sync type: 00=Analog composite; 01=Bipolar analog composite; 10=Digital composite (on HSync); 11=Digital separate Bit 2 If digital separate: Vertical sync polarity (1=positive) Other types: VSync serrated (HSync during VSync) Bit 1 If analog sync: Sync on all 3 RGB lines (else green only) Digital: HSync polarity (1=positive) Bit 0 2-way line-interleaved stereo, if bits 4-3 are not 00. */ features: .byte 0x18+(VSYNC_POL<<2)+(HSYNC_POL<<1) descriptor2: .byte 0,0 /* Not a detailed timing descriptor */ .byte 0 /* Must be zero */ .byte 0xff /* Descriptor is monitor serial number (text) */ .byte 0 /* Must be zero */ start1: .ascii "Linux #0" end1: .byte 0x0a /* End marker */ .fill 12-(end1-start1), 1, 0x20 /* Padded spaces */ descriptor3: .byte 0,0 /* Not a detailed timing descriptor */ .byte 0 /* Must be zero */ .byte 0xfd /* Descriptor is monitor range limits */ .byte 0 /* Must be zero */ start2: .byte VFREQ-1 /* Minimum vertical field rate (1-255 Hz) */ .byte VFREQ+1 /* Maximum vertical field rate (1-255 Hz) */ .byte (CLOCK/(XPIX+XBLANK))-1 /* Minimum horizontal line rate (1-255 kHz) */ .byte (CLOCK/(XPIX+XBLANK))+1 /* Maximum horizontal line rate (1-255 kHz) */ .byte (CLOCK/10000)+1 /* Maximum pixel clock rate, rounded up to 10 MHz multiple (10-2550 MHz) */ .byte 0 /* No extended timing information type */ end2: .byte 0x0a /* End marker */ .fill 12-(end2-start2), 1, 0x20 /* Padded spaces */ descriptor4: .byte 0,0 /* Not a detailed timing descriptor */ .byte 0 /* Must be zero */ .byte 0xfc /* Descriptor is text */ .byte 0 /* Must be zero */ start3: .ascii TIMING_NAME end3: .byte 0x0a /* End marker */ .fill 12-(end3-start3), 1, 0x20 /* Padded spaces */ extensions: .byte 0 /* Number of extensions to follow */ checksum: .byte CRC /* Sum of all bytes must be 0 */
{ "pile_set_name": "Github" }
{ "images" : [ { "idiom" : "universal", "scale" : "1x", "filename" : "birds.png" }, { "idiom" : "universal", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }
{ "pile_set_name": "Github" }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="IValueValidator.cs" company="Catel development team"> // Copyright (c) 2008 - 2015 Catel development team. All rights reserved. // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace Catel.Data { /// <summary> /// The value validator interface /// </summary> /// <typeparam name="TValue">The type of the value</typeparam> public interface IValueValidator<in TValue> { #region Methods /// <summary> /// Determines whether the specified value is valid. /// </summary> /// <param name="value">The value.</param> /// <returns> /// <c>true</c> if is valid, otherwise <c>false</c>. /// </returns> bool IsValid(TValue @value); #endregion } }
{ "pile_set_name": "Github" }
// -*- C++ -*- // Copyright (C) 2007 Douglas Gregor <[email protected]> // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP #define BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP #ifndef BOOST_GRAPH_USE_MPI #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" #endif #include <vector> namespace boost { namespace graph { namespace distributed { namespace detail { /** * \brief The tag allocator allows clients to request unique tags that * can be used for one-time communications. * * The tag allocator hands out tag values from a predefined maximum * (given in the constructor) moving downward. Tags are provided one * at a time via a @c token. When the @c token goes out of scope, the * tag is returned and may be reallocated. These tags should be used, * for example, for one-time communication of values. */ class tag_allocator { public: class token; friend class token; /** * Construct a new tag allocator that provides unique tags starting * with the value @p top_tag and moving lower, as necessary. */ explicit tag_allocator(int top_tag) : bottom(top_tag) { } /** * Retrieve a new tag. The token itself holds onto the tag, which * will be released when the token is destroyed. */ token get_tag(); private: int bottom; std::vector<int> freed; }; /** * A token used to represent an allocated tag. */ class tag_allocator::token { public: /// Transfer ownership of the tag from @p other. token(const token& other); /// De-allocate the tag, if this token still owns it. ~token(); /// Retrieve the tag allocated for this task. operator int() const { return tag_; } private: /// Create a token with a specific tag from the given tag_allocator token(tag_allocator* allocator, int tag) : allocator(allocator), tag_(tag) { } /// Undefined: tokens are not copy-assignable token& operator=(const token&); /// The allocator from which this tag was allocated. tag_allocator* allocator; /// The stored tag flag. If -1, this token does not own the tag. mutable int tag_; friend class tag_allocator; }; } } } } // end namespace boost::graph::distributed::detail #endif // BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP
{ "pile_set_name": "Github" }
import { ipcRenderer } from 'electron'; // eslint-disable-line import/no-unresolved export default class MenuHandler { setMenus(commands) { if (this.commands) { this.removeAllMenus(); } Object.keys(commands) .forEach(command => ipcRenderer.on(command, commands[command])); this.commands = commands; } removeAllMenus() { Object.keys(this.commands) .forEach(command => ipcRenderer.removeListener(command, this.commands[command])); this.commands = null; } }
{ "pile_set_name": "Github" }
//----------------------------------------------------------------------------- // Copyright (c) 2012 GarageGames, LLC // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. //----------------------------------------------------------------------------- #ifndef _GUI_INSPECTOR_VARIABLEGROUP_H_ #define _GUI_INSPECTOR_VARIABLEGROUP_H_ #ifndef _GUI_INSPECTOR_GROUP_H_ #include "gui/editor/inspector/group.h" #endif // Forward refs class GuiInspector; class GuiInspectorField; struct VariableField { StringTableEntry mFieldName; StringTableEntry mFieldLabel; StringTableEntry mFieldDescription; StringTableEntry mFieldTypeName; S32 mFieldType; SimObject* mOwnerObject; StringTableEntry mDefaultValue; String mDataValues; String mGroup; StringTableEntry mSetCallbackName; bool mHidden; bool mEnabled; }; class GuiInspectorVariableGroup : public GuiInspectorGroup { public: typedef GuiInspectorGroup Parent; String mSearchString; GuiInspectorVariableGroup(); virtual ~GuiInspectorVariableGroup(); DECLARE_CONOBJECT(GuiInspectorVariableGroup); DECLARE_CATEGORY( "Gui Editor" ); virtual GuiInspectorField* constructField( S32 fieldType ); virtual bool inspectGroup(); void clearFields(); void addField(VariableField* field); void addInspectorField(GuiInspectorField* field); GuiInspectorField* createInspectorField(); protected: Vector<VariableField*> mFields; }; #endif // _GUI_INSPECTOR_VARIABLEGROUP_H_
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>creator</key> <string>com.schriftgestaltung.GlyphsUFOExport</string> <key>formatVersion</key> <integer>2</integer> </dict> </plist>
{ "pile_set_name": "Github" }
// Package unidecode implements a unicode transliterator // which replaces non-ASCII characters with their ASCII // approximations. package unidecode //go:generate go run make_table.go import ( "sync" "unicode" ) const pooledCapacity = 64 var ( slicePool sync.Pool decodingOnce sync.Once ) // Unidecode implements a unicode transliterator, which // replaces non-ASCII characters with their ASCII // counterparts. // Given an unicode encoded string, returns // another string with non-ASCII characters replaced // with their closest ASCII counterparts. // e.g. Unicode("áéíóú") => "aeiou" func Unidecode(s string) string { decodingOnce.Do(decodeTransliterations) l := len(s) var r []rune if l > pooledCapacity { r = make([]rune, 0, len(s)) } else { if x := slicePool.Get(); x != nil { r = x.([]rune)[:0] } else { r = make([]rune, 0, pooledCapacity) } } for _, c := range s { if c <= unicode.MaxASCII { r = append(r, c) continue } if c > unicode.MaxRune || c > transCount { /* Ignore reserved chars */ continue } if d := transliterations[c]; d != nil { r = append(r, d...) } } res := string(r) if l <= pooledCapacity { slicePool.Put(r) } return res }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>detect { |${1:e}| $0 }</string> <key>name</key> <string>detect { |e| .. }</string> <key>scope</key> <string>source.ruby</string> <key>tabTrigger</key> <string>det</string> <key>uuid</key> <string>6C6B9849-9631-49FF-A9F9-F0E94A1512C5</string> </dict> </plist>
{ "pile_set_name": "Github" }
# O(1) time effi. def maskify(str: raise) return str if str.size <= 4 "#{'#' * (str.size - 4)}#{str[-4..-1]}" end puts maskify(str:"4556364607935616") == "############5616" puts maskify(str: "1") == "1" puts maskify(str: "") == "" puts maskify(str: "Skippy") == "##ippy"
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" manifest="cll.appcache" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>17.11. Mathematical uses of lerfu strings</title> <link rel="stylesheet" type="text/css" href="final.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /> <link rel="home" href="index.html" title="The Complete Lojban Language" /> <link rel="up" href="chapter-letterals.html" title="Chapter 17. As Easy As A-B-C? The Lojban Letteral System And Its Uses" /> <link rel="prev" href="section-meho.html" title="17.10. References to lerfu" /> <link rel="next" href="section-acronyms.html" title="17.12. Acronyms" /> <script xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=MML_HTMLorMML"></script> <meta xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" name="viewport" content="width=device-width, initial-scale=1" /> </head> <body> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="navheader"> <table width="100%" summary="Chapter Header"> <tr> <th colspan="3" align="center">Chapter 17. As Easy As A-B-C? The Lojban Letteral System And Its Uses</th> </tr> </table> <table width="100%" summary="Navigation header"> <tr> <td width="50%" align="right"> <a accesskey="p" href="section-meho.html">Prev: Section 17.10</a> </td> <td width="50%" align="left"> <a accesskey="n" href="section-acronyms.html">Next: Section 17.12</a> </td> </tr> </table> </div> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="toc-link" align="center"> <a accesskey="h" href="index.html">Table of Contents</a> </div> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="back-to-info-link" align="center"> <a accesskey="b" href="http://www.lojban.org/cll">Book Info Page</a> </div> <hr xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" /> <div class="section"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="section-math"></a>17.11. <a id="c17s11"></a>Mathematical uses of lerfu strings</h2> </div> </div> </div> <p><a id="idm22952480850512" class="indexterm"></a><a id="idm22952480849376" class="indexterm"></a> This chapter is not about Lojban mathematics, which is explained in <a class="xref" href="chapter-mekso.html" title="Chapter 18. lojbau mekso: Mathematical Expressions in Lojban">Chapter 18</a>, so the mathematical uses of lerfu strings will be listed and exemplified but not explained.</p> <div class="itemizedlist"> <ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"> <p><a id="idm22952480846448" class="indexterm"></a><a id="idm22952480845216" class="indexterm"></a> A lerfu string as mathematical variable:</p> </li> </ul> </div> <div class="interlinear-gloss-example example"> <a id="example-random-id-1Nuz"></a> <p class="title"> <strong>Example 17.34.  <a id="c17e11d1"></a> </strong> </p> <div class="interlinear-gloss-example example-contents"> <div class="informaltable"> <table class="interlinear-gloss"> <colgroup></colgroup> <tr class="jbo"> <td>li</td> <td>.abu</td> <td>du</td> <td>li</td> <td>by.</td> <td>su'i</td> <td>cy.</td> </tr> <tr class="gloss"> <td>the-number</td> <td>a</td> <td>equals</td> <td>the-number</td> <td>b</td> <td>plus</td> <td>c</td> </tr> </table> </div> <div class="informaltable"> <table class="interlinear-gloss"> <tr class="para"> <td colspan="12321"> <p class="natlang">a = b + c</p> </td> </tr> </table> </div> </div> </div> <br class="interlinear-gloss-example example-break" /> <div class="itemizedlist"> <ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"> <p><a id="idm22952480832032" class="indexterm"></a><a id="idm22952480830896" class="indexterm"></a> A lerfu string as function name (preceded by <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480829360" class="indexterm"></a><a class="glossterm" href="go01.html#valsi-maho"><em class="glossterm">ma'o</em></a></em></span> of selma'o MAhO):</p> </li> </ul> </div> <div class="interlinear-gloss-example example"> <a id="example-random-id-H0SM"></a> <p class="title"> <strong>Example 17.35.  <a id="c17e11d2"></a> <a id="idm22952480825072" class="indexterm"></a> </strong> </p> <div class="interlinear-gloss-example example-contents"> <div class="informaltable"> <table class="interlinear-gloss"> <colgroup></colgroup> <tr class="jbo"> <td>li</td> <td>.y.bu</td> <td>du</td> <td>li</td> <td>ma'o</td> <td>fy.</td> <td>boi</td> <td>xy.</td> </tr> <tr class="gloss"> <td>the-number</td> <td>y</td> <td>equals</td> <td>the-number</td> <td>the-function</td> <td>f</td> <td>of</td> <td>x</td> </tr> <tr class="informalequation"> <td colspan="12321"> <div class="informalequation"> <span class="mathphrase">y = f(x)</span> </div> </td> </tr> </table> </div> </div> </div> <br class="interlinear-gloss-example example-break" /> <p class="indent">Note the <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480814176" class="indexterm"></a><a class="glossterm" href="go01.html#valsi-boi"><em class="glossterm">boi</em></a></em></span> here to separate the lerfu strings <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480811792" class="indexterm"></a><a class="glossterm" href="go01.html#valsi-fy"><em class="glossterm">fy</em></a></em></span> and <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480809440" class="indexterm"></a><a class="glossterm" href="go01.html#valsi-xy"><em class="glossterm">xy</em></a></em></span>.</p> <div class="itemizedlist"> <ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"> <p><a id="idm22952480806432" class="indexterm"></a><a id="idm22952480805296" class="indexterm"></a> A lerfu string as selbri (followed by a cmavo of selma'o MOI):</p> </li> </ul> </div> <div class="interlinear-gloss-example example"> <a id="example-random-id-X4KM"></a> <p class="title"> <strong>Example 17.36.  <a id="c17e11d3"></a> <a id="idm22952480801968" class="indexterm"></a> </strong> </p> <div class="interlinear-gloss-example example-contents"> <div class="informaltable"> <table class="interlinear-gloss"> <colgroup></colgroup> <tr class="jbo"> <td>le</td> <td>vi</td> <td>ratcu</td> <td>ny.moi</td> <td>le'i</td> <td>mi</td> <td>ratcu</td> </tr> <tr class="gloss"> <td>the</td> <td>here</td> <td>rat</td> <td>is-nth-of</td> <td>the-set-of</td> <td>my</td> <td>rats</td> </tr> </table> </div> <div class="informaltable"> <table class="interlinear-gloss"> <tr class="para"> <td colspan="12321"> <p class="natlang">This rat is my Nth rat.</p> </td> </tr> </table> </div> </div> </div> <br class="interlinear-gloss-example example-break" /> <div class="itemizedlist"> <ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"> <p><a id="idm22952480791296" class="indexterm"></a><a id="idm22952480790160" class="indexterm"></a> A lerfu string as utterance ordinal (followed by a cmavo of selma'o MAI):</p> </li> </ul> </div> <div class="interlinear-gloss-example example"> <a id="example-random-id-Jw40"></a> <p class="title"> <strong>Example 17.37.  <a id="c17e11d4"></a> <a id="idm22952480786864" class="indexterm"></a> </strong> </p> <div class="interlinear-gloss-example example-contents"> <div class="informaltable"> <table class="interlinear-gloss"> <colgroup></colgroup> <tr class="jbo"> <td>ny.mai</td> </tr> </table> </div> <div class="informaltable"> <table class="interlinear-gloss"> <tr class="para"> <td colspan="12321"> <p class="natlang">Nthly</p> </td> </tr> </table> </div> </div> </div> <br class="interlinear-gloss-example example-break" /> <div class="itemizedlist"> <ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"> <p><a id="idm22952480780512" class="indexterm"></a><a id="idm22952480779376" class="indexterm"></a> A lerfu string as subscript (preceded by <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480777776" class="indexterm"></a><a class="glossterm" href="go01.html#valsi-xi"><em class="glossterm">xi</em></a></em></span> of selma'o XI):</p> </li> </ul> </div> <div class="interlinear-gloss-example example"> <a id="example-random-id-oTgS"></a> <p class="title"> <strong>Example 17.38.  <a id="c17e11d5"></a> <a id="idm22952480773568" class="indexterm"></a> </strong> </p> <div class="interlinear-gloss-example example-contents"> <div class="informaltable"> <table class="interlinear-gloss"> <colgroup></colgroup> <tr class="jbo"> <td>xy.</td> <td>xi</td> <td>ky.</td> </tr> <tr class="gloss"> <td>x</td> <td>sub</td> <td>k</td> </tr> </table> </div> </div> </div> <br class="interlinear-gloss-example example-break" /> <div class="itemizedlist"> <ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"> <p><a id="idm22952480767536" class="indexterm"></a><a id="idm22952480766400" class="indexterm"></a> A lerfu string as quantifier (enclosed in <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480764800" class="indexterm"></a><a class="glossterm" href="go01.html#valsi-vei"><em class="glossterm">vei</em></a></em></span>…<span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480762448" class="indexterm"></a><a class="glossterm" href="go01.html#valsi-veho"><em class="glossterm">ve'o</em></a></em></span> parentheses):</p> </li> </ul> </div> <div class="interlinear-gloss-example example"> <a id="example-random-id-bbnL"></a> <p class="title"> <strong>Example 17.39.  <a id="c17e11d6"></a> <a id="idm22952480758384" class="indexterm"></a> </strong> </p> <div class="interlinear-gloss-example example-contents"> <div class="informaltable"> <table class="interlinear-gloss"> <colgroup></colgroup> <tr class="jbo"> <td>vei</td> <td>ny.</td> <td>[ve'o]</td> <td>lo prenu</td> </tr> <tr class="gloss"> <td>(</td> <td> <span class="quote">“<span class="quote">n</span>”</span> </td> <td>)</td> <td>persons</td> </tr> </table> </div> </div> </div> <br class="interlinear-gloss-example example-break" /> <p class="indent"><a id="idm22952480751840" class="indexterm"></a> The parentheses are required because <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480749648" class="indexterm"></a>ny. lo prenu</em></span> would be two separate sumti, <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480748000" class="indexterm"></a><a class="glossterm" href="go01.html#valsi-ny"><em class="glossterm">ny.</em></a></em></span> and <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480745472" class="indexterm"></a>lo prenu</em></span>. In general, any mathematical expression other than a simple number must be in parentheses when used as a quantifier; the right parenthesis mark, the cmavo <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480743824" class="indexterm"></a><a class="glossterm" href="go01.html#valsi-veho"><em class="glossterm">ve'o</em></a></em></span>, can usually be elided.</p> <p><a id="idm22952480741264" class="indexterm"></a><a id="idm22952480740080" class="indexterm"></a> All the examples above have exhibited single lerfu words rather than lerfu strings, in accordance with the conventions of ordinary mathematics. A longer lerfu string would still be treated as a single variable or function name: in Lojban, <span xml:lang="jbo" class="foreignphrase" lang="jbo"><em xml:lang="jbo" class="foreignphrase" lang="jbo"><a id="idm22952480737680" class="indexterm"></a>.abu by. cy.</em></span> is not the multiplication <span class="quote">“<span class="quote"><span class="mathphrase">a × b × c</span></span>”</span> but is the variable <code class="varname">abc</code>. (Of course, a local convention could be employed that made the value of a variable like <code class="varname">abc</code>, with a multi-lerfu-word name, equal to the values of the variables <code class="varname">a</code>, <code class="varname">b</code>, and <code class="varname">c</code> multiplied together.)</p> <p><a id="idm22952480732544" class="indexterm"></a><a id="idm22952480731440" class="indexterm"></a> There is a special rule about shift words in mathematical text: shifts within mathematical expressions do not affect lerfu words appearing outside mathematical expressions, and vice versa.</p> </div> <hr xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" /> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="navheader"> <table width="100%" summary="Chapter Header"> <tr> <th colspan="3" align="center">Chapter 17. As Easy As A-B-C? The Lojban Letteral System And Its Uses</th> </tr> </table> <table width="100%" summary="Navigation header"> <tr> <td width="50%" align="right"> <a accesskey="p" href="section-meho.html">Prev: Section 17.10</a> </td> <td width="50%" align="left"> <a accesskey="n" href="section-acronyms.html">Next: Section 17.12</a> </td> </tr> </table> </div> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="toc-link" align="center"> <a accesskey="h" href="index.html">Table of Contents</a> </div> <div xmlns="" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:docbook="http://docbook.org/ns/docbook" class="back-to-info-link" align="center"> <a accesskey="b" href="http://www.lojban.org/cll">Book Info Page</a> </div> </body> </html>
{ "pile_set_name": "Github" }
// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EuiHeaderSectionItem border defaults to left 1`] = ` <div class="euiHeaderSectionItem euiHeaderSectionItem--borderLeft" /> `; exports[`EuiHeaderSectionItem border renders right 1`] = ` <div class="euiHeaderSectionItem euiHeaderSectionItem--borderRight" /> `; exports[`EuiHeaderSectionItem is rendered 1`] = ` <div aria-label="aria-label" class="euiHeaderSectionItem euiHeaderSectionItem--borderLeft testClass1 testClass2" data-test-subj="test subject string" /> `; exports[`EuiHeaderSectionItem renders children 1`] = ` <div class="euiHeaderSectionItem euiHeaderSectionItem--borderLeft" > <span> Call me Ishmael. </span> </div> `;
{ "pile_set_name": "Github" }
module Json.Encode exposing ( Value , encode , string, int, float, bool, null , list, array , object ) {-| Library for turning Elm values into Json values. # Encoding @docs encode, Value # Primitives @docs string, int, float, bool, null # Arrays @docs list, array # Objects @docs object -} import Array exposing (Array) import Native.Json {-| Represents a JavaScript value. -} type Value = Value {-| Convert a `Value` into a prettified string. The first argument specifies the amount of indentation in the resulting string. person = object [ ("name", string "Tom") , ("age", int 42) ] compact = encode 0 person -- {"name":"Tom","age":42} readable = encode 4 person -- { -- "name": "Tom", -- "age": 42 -- } -} encode : Int -> Value -> String encode = Native.Json.encode {-|-} string : String -> Value string = Native.Json.identity {-|-} int : Int -> Value int = Native.Json.identity {-| Encode a Float. `Infinity` and `NaN` are encoded as `null`. -} float : Float -> Value float = Native.Json.identity {-|-} bool : Bool -> Value bool = Native.Json.identity {-|-} null : Value null = Native.Json.encodeNull {-|-} object : List (String, Value) -> Value object = Native.Json.encodeObject {-|-} array : Array Value -> Value array = Native.Json.encodeArray {-|-} list : List Value -> Value list = Native.Json.encodeList
{ "pile_set_name": "Github" }
/** * @license RequireJS text 2.0.12 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/requirejs/text for details */ /*jslint regexp: true */ /*global require, XMLHttpRequest, ActiveXObject, define, window, process, Packages, java, location, Components, FileUtils */ define(['module'], function (module) { 'use strict'; var text, fs, Cc, Ci, xpcIsWindows, progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'], xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im, hasLocation = typeof location !== 'undefined' && location.href, defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''), defaultHostName = hasLocation && location.hostname, defaultPort = hasLocation && (location.port || undefined), buildMap = {}, masterConfig = (module.config && module.config()) || {}; text = { version: '2.0.12', strip: function (content) { //Strips <?xml ...?> declarations so that external SVG and XML //documents can be added to a document without worry. Also, if the string //is an HTML document, only the part inside the body tag is returned. if (content) { content = content.replace(xmlRegExp, ""); var matches = content.match(bodyRegExp); if (matches) { content = matches[1]; } } else { content = ""; } return content; }, jsEscape: function (content) { return content.replace(/(['\\])/g, '\\$1') .replace(/[\f]/g, "\\f") .replace(/[\b]/g, "\\b") .replace(/[\n]/g, "\\n") .replace(/[\t]/g, "\\t") .replace(/[\r]/g, "\\r") .replace(/[\u2028]/g, "\\u2028") .replace(/[\u2029]/g, "\\u2029"); }, createXhr: masterConfig.createXhr || function () { //Would love to dump the ActiveX crap in here. Need IE 6 to die first. var xhr, i, progId; if (typeof XMLHttpRequest !== "undefined") { return new XMLHttpRequest(); } else if (typeof ActiveXObject !== "undefined") { for (i = 0; i < 3; i += 1) { progId = progIds[i]; try { xhr = new ActiveXObject(progId); } catch (e) {} if (xhr) { progIds = [progId]; // so faster next time break; } } } return xhr; }, /** * Parses a resource name into its component parts. Resource names * look like: module/name.ext!strip, where the !strip part is * optional. * @param {String} name the resource name * @returns {Object} with properties "moduleName", "ext" and "strip" * where strip is a boolean. */ parseName: function (name) { var modName, ext, temp, strip = false, index = name.indexOf("."), isRelative = name.indexOf('./') === 0 || name.indexOf('../') === 0; if (index !== -1 && (!isRelative || index > 1)) { modName = name.substring(0, index); ext = name.substring(index + 1, name.length); } else { modName = name; } temp = ext || modName; index = temp.indexOf("!"); if (index !== -1) { //Pull off the strip arg. strip = temp.substring(index + 1) === "strip"; temp = temp.substring(0, index); if (ext) { ext = temp; } else { modName = temp; } } return { moduleName: modName, ext: ext, strip: strip }; }, xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/, /** * Is an URL on another domain. Only works for browser use, returns * false in non-browser environments. Only used to know if an * optimized .js version of a text resource should be loaded * instead. * @param {String} url * @returns Boolean */ useXhr: function (url, protocol, hostname, port) { var uProtocol, uHostName, uPort, match = text.xdRegExp.exec(url); if (!match) { return true; } uProtocol = match[2]; uHostName = match[3]; uHostName = uHostName.split(':'); uPort = uHostName[1]; uHostName = uHostName[0]; return (!uProtocol || uProtocol === protocol) && (!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) && ((!uPort && !uHostName) || uPort === port); }, finishLoad: function (name, strip, content, onLoad) { content = strip ? text.strip(content) : content; if (masterConfig.isBuild) { buildMap[name] = content; } onLoad(content); }, load: function (name, req, onLoad, config) { //Name has format: some.module.filext!strip //The strip part is optional. //if strip is present, then that means only get the string contents //inside a body tag in an HTML string. For XML/SVG content it means //removing the <?xml ...?> declarations so the content can be inserted //into the current doc without problems. // Do not bother with the work if a build and text will // not be inlined. if (config && config.isBuild && !config.inlineText) { onLoad(); return; } masterConfig.isBuild = config && config.isBuild; var parsed = text.parseName(name), nonStripName = parsed.moduleName + (parsed.ext ? '.' + parsed.ext : ''), url = req.toUrl(nonStripName), useXhr = (masterConfig.useXhr) || text.useXhr; // Do not load if it is an empty: url if (url.indexOf('empty:') === 0) { onLoad(); return; } //Load the text. Use XHR if possible and in a browser. if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) { text.get(url, function (content) { text.finishLoad(name, parsed.strip, content, onLoad); }, function (err) { if (onLoad.error) { onLoad.error(err); } }); } else { //Need to fetch the resource across domains. Assume //the resource has been optimized into a JS module. Fetch //by the module name + extension, but do not include the //!strip part to avoid file system issues. req([nonStripName], function (content) { text.finishLoad(parsed.moduleName + '.' + parsed.ext, parsed.strip, content, onLoad); }); } }, write: function (pluginName, moduleName, write, config) { if (buildMap.hasOwnProperty(moduleName)) { var content = text.jsEscape(buildMap[moduleName]); write.asModule(pluginName + "!" + moduleName, "define(function () { return '" + content + "';});\n"); } }, writeFile: function (pluginName, moduleName, req, write, config) { var parsed = text.parseName(moduleName), extPart = parsed.ext ? '.' + parsed.ext : '', nonStripName = parsed.moduleName + extPart, //Use a '.js' file name so that it indicates it is a //script that can be loaded across domains. fileName = req.toUrl(parsed.moduleName + extPart) + '.js'; //Leverage own load() method to load plugin value, but only //write out values that do not have the strip argument, //to avoid any potential issues with ! in file names. text.load(nonStripName, req, function (value) { //Use own write() method to construct full module value. //But need to create shell that translates writeFile's //write() to the right interface. var textWrite = function (contents) { return write(fileName, contents); }; textWrite.asModule = function (moduleName, contents) { return write.asModule(moduleName, fileName, contents); }; text.write(pluginName, nonStripName, textWrite, config); }, config); } }; if (masterConfig.env === 'node' || (!masterConfig.env && typeof process !== "undefined" && process.versions && !!process.versions.node && !process.versions['node-webkit'])) { //Using special require.nodeRequire, something added by r.js. fs = require.nodeRequire('fs'); text.get = function (url, callback, errback) { try { var file = fs.readFileSync(url, 'utf8'); //Remove BOM (Byte Mark Order) from utf8 files if it is there. if (file.indexOf('\uFEFF') === 0) { file = file.substring(1); } callback(file); } catch (e) { if (errback) { errback(e); } } }; } else if (masterConfig.env === 'xhr' || (!masterConfig.env && text.createXhr())) { text.get = function (url, callback, errback, headers) { var xhr = text.createXhr(), header; xhr.open('GET', url, true); //Allow plugins direct access to xhr headers if (headers) { for (header in headers) { if (headers.hasOwnProperty(header)) { xhr.setRequestHeader(header.toLowerCase(), headers[header]); } } } //Allow overrides specified in config if (masterConfig.onXhr) { masterConfig.onXhr(xhr, url); } xhr.onreadystatechange = function (evt) { var status, err; //Do not explicitly handle errors, those should be //visible via console output in the browser. if (xhr.readyState === 4) { status = xhr.status || 0; if (status > 399 && status < 600) { //An http 4xx or 5xx error. Signal an error. err = new Error(url + ' HTTP status: ' + status); err.xhr = xhr; if (errback) { errback(err); } } else { callback(xhr.responseText); } if (masterConfig.onXhrComplete) { masterConfig.onXhrComplete(xhr, url); } } }; xhr.send(null); }; } else if (masterConfig.env === 'rhino' || (!masterConfig.env && typeof Packages !== 'undefined' && typeof java !== 'undefined')) { //Why Java, why is this so awkward? text.get = function (url, callback) { var stringBuffer, line, encoding = "utf-8", file = new java.io.File(url), lineSeparator = java.lang.System.getProperty("line.separator"), input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)), content = ''; try { stringBuffer = new java.lang.StringBuffer(); line = input.readLine(); // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324 // http://www.unicode.org/faq/utf_bom.html // Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK: // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058 if (line && line.length() && line.charAt(0) === 0xfeff) { // Eat the BOM, since we've already found the encoding on this file, // and we plan to concatenating this buffer with others; the BOM should // only appear at the top of a file. line = line.substring(1); } if (line !== null) { stringBuffer.append(line); } while ((line = input.readLine()) !== null) { stringBuffer.append(lineSeparator); stringBuffer.append(line); } //Make sure we return a JavaScript string and not a Java string. content = String(stringBuffer.toString()); //String } finally { input.close(); } callback(content); }; } else if (masterConfig.env === 'xpconnect' || (!masterConfig.env && typeof Components !== 'undefined' && Components.classes && Components.interfaces)) { //Avert your gaze! Cc = Components.classes; Ci = Components.interfaces; Components.utils['import']('resource://gre/modules/FileUtils.jsm'); xpcIsWindows = ('@mozilla.org/windows-registry-key;1' in Cc); text.get = function (url, callback) { var inStream, convertStream, fileObj, readData = {}; if (xpcIsWindows) { url = url.replace(/\//g, '\\'); } fileObj = new FileUtils.File(url); //XPCOM, you so crazy try { inStream = Cc['@mozilla.org/network/file-input-stream;1'] .createInstance(Ci.nsIFileInputStream); inStream.init(fileObj, 1, 0, false); convertStream = Cc['@mozilla.org/intl/converter-input-stream;1'] .createInstance(Ci.nsIConverterInputStream); convertStream.init(inStream, "utf-8", inStream.available(), Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER); convertStream.readString(inStream.available(), readData); convertStream.close(); inStream.close(); callback(readData.value); } catch (e) { throw new Error((fileObj && fileObj.path || '') + ': ' + e); } }; } return text; });
{ "pile_set_name": "Github" }
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #pragma once #ifdef __cplusplus #include <functional> #endif extern "C" { void HALSIMGUI_Add(void* param, void (*initialize)(void*)); void HALSIMGUI_AddExecute(void* param, void (*execute)(void*)); void HALSIMGUI_AddWindow(const char* name, void* param, void (*display)(void*), int32_t flags); void HALSIMGUI_AddMainMenu(void* param, void (*menu)(void*)); void HALSIMGUI_AddOptionMenu(void* param, void (*menu)(void*)); void HALSIMGUI_SetWindowVisibility(const char* name, int32_t visibility); void HALSIMGUI_SetDefaultWindowPos(const char* name, float x, float y); void HALSIMGUI_SetDefaultWindowSize(const char* name, float width, float height); void HALSIMGUI_SetWindowPadding(const char* name, float x, float y); int HALSIMGUI_AreOutputsDisabled(void); } // extern "C" #ifdef __cplusplus namespace halsimgui { class HALSimGui { public: static void GlobalInit(); static bool Initialize(); static void Main(void*); static void Exit(void*); /** * Adds feature to GUI. The initialize function is called once, immediately * after the GUI (both GLFW and Dear ImGui) are initialized. * * @param initialize initialization function * @param execute frame execution function */ static void Add(std::function<void()> initialize); /** * Adds per-frame executor to GUI. The passed function is called on each * Dear ImGui frame prior to window and menu functions. * * @param execute frame execution function */ static void AddExecute(std::function<void()> execute); /** * Adds window to GUI. The display function is called from within a * ImGui::Begin()/End() block. While windows can be created within the * execute function passed to AddExecute(), using this function ensures the * windows are consistently integrated with the rest of the GUI. * * On each Dear ImGui frame, AddExecute() functions are always called prior * to AddWindow display functions. Note that windows may be shaded or * completely hidden, in which case this function will not be called. * It's important to perform any processing steps that must be performed * every frame in the AddExecute() function. * * @param name name of the window (title bar) * @param display window contents display function * @param flags Dear ImGui window flags */ static void AddWindow(const char* name, std::function<void()> display, int flags = 0); /** * Adds to GUI's main menu bar. The menu function is called from within a * ImGui::BeginMainMenuBar()/EndMainMenuBar() block. Usually it's only * appropriate to create a menu with ImGui::BeginMenu()/EndMenu() inside of * this function. * * On each Dear ImGui frame, AddExecute() functions are always called prior * to AddMainMenu menu functions. * * @param menu menu display function */ static void AddMainMenu(std::function<void()> menu); /** * Adds to GUI's option menu. The menu function is called from within a * ImGui::BeginMenu()/EndMenu() block. Usually it's only appropriate to * create menu items inside of this function. * * On each Dear ImGui frame, AddExecute() functions are always called prior * to AddMainMenu menu functions. * * @param menu menu display function */ static void AddOptionMenu(std::function<void()> menu); enum WindowVisibility { kHide = 0, kShow, kDisabled }; /** * Sets visibility of window added with AddWindow(). * * @param name window name (same as name passed to AddWindow()) * @param visibility 0=hide, 1=show, 2=disabled (force-hide) */ static void SetWindowVisibility(const char* name, WindowVisibility visibility); /** * Sets default position of window added with AddWindow(). * * @param name window name (same as name passed to AddWindow()) * @param x x location of upper left corner * @param y y location of upper left corner */ static void SetDefaultWindowPos(const char* name, float x, float y); /** * Sets default size of window added with AddWindow(). * * @param name window name (same as name passed to AddWindow()) * @param width width * @param height height */ static void SetDefaultWindowSize(const char* name, float width, float height); /** * Sets internal padding of window added with AddWindow(). * @param name window name (same as name passed to AddWindow()) * @param x horizontal padding * @param y vertical padding */ static void SetWindowPadding(const char* name, float x, float y); /** * Returns true if outputs are disabled. * * @return true if outputs are disabled, false otherwise. */ static bool AreOutputsDisabled(); }; } // namespace halsimgui #endif // __cplusplus
{ "pile_set_name": "Github" }
// Copyright 2012 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 colltab import "unicode/utf8" // For a description of ContractTrieSet, see text/collate/build/contract.go. type ContractTrieSet []struct{ L, H, N, I uint8 } // ctScanner is used to match a trie to an input sequence. // A contraction may match a non-contiguous sequence of bytes in an input string. // For example, if there is a contraction for <a, combining_ring>, it should match // the sequence <a, combining_cedilla, combining_ring>, as combining_cedilla does // not block combining_ring. // ctScanner does not automatically skip over non-blocking non-starters, but rather // retains the state of the last match and leaves it up to the user to continue // the match at the appropriate points. type ctScanner struct { states ContractTrieSet s []byte n int index int pindex int done bool } type ctScannerString struct { states ContractTrieSet s string n int index int pindex int done bool } func (t ContractTrieSet) scanner(index, n int, b []byte) ctScanner { return ctScanner{s: b, states: t[index:], n: n} } func (t ContractTrieSet) scannerString(index, n int, str string) ctScannerString { return ctScannerString{s: str, states: t[index:], n: n} } // result returns the offset i and bytes consumed p so far. If no suffix // matched, i and p will be 0. func (s *ctScanner) result() (i, p int) { return s.index, s.pindex } func (s *ctScannerString) result() (i, p int) { return s.index, s.pindex } const ( final = 0 noIndex = 0xFF ) // scan matches the longest suffix at the current location in the input // and returns the number of bytes consumed. func (s *ctScanner) scan(p int) int { pr := p // the p at the rune start str := s.s states, n := s.states, s.n for i := 0; i < n && p < len(str); { e := states[i] c := str[p] // TODO: a significant number of contractions are of a form that // cannot match discontiguous UTF-8 in a normalized string. We could let // a negative value of e.n mean that we can set s.done = true and avoid // the need for additional matches. if c >= e.L { if e.L == c { p++ if e.I != noIndex { s.index = int(e.I) s.pindex = p } if e.N != final { i, states, n = 0, states[int(e.H)+n:], int(e.N) if p >= len(str) || utf8.RuneStart(str[p]) { s.states, s.n, pr = states, n, p } } else { s.done = true return p } continue } else if e.N == final && c <= e.H { p++ s.done = true s.index = int(c-e.L) + int(e.I) s.pindex = p return p } } i++ } return pr } // scan is a verbatim copy of ctScanner.scan. func (s *ctScannerString) scan(p int) int { pr := p // the p at the rune start str := s.s states, n := s.states, s.n for i := 0; i < n && p < len(str); { e := states[i] c := str[p] // TODO: a significant number of contractions are of a form that // cannot match discontiguous UTF-8 in a normalized string. We could let // a negative value of e.n mean that we can set s.done = true and avoid // the need for additional matches. if c >= e.L { if e.L == c { p++ if e.I != noIndex { s.index = int(e.I) s.pindex = p } if e.N != final { i, states, n = 0, states[int(e.H)+n:], int(e.N) if p >= len(str) || utf8.RuneStart(str[p]) { s.states, s.n, pr = states, n, p } } else { s.done = true return p } continue } else if e.N == final && c <= e.H { p++ s.done = true s.index = int(c-e.L) + int(e.I) s.pindex = p return p } } i++ } return pr }
{ "pile_set_name": "Github" }
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.fs; import java.io.*; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; /** Stream that permits positional reading. */ @InterfaceAudience.Public @InterfaceStability.Evolving public interface PositionedReadable { /** * Read upto the specified number of bytes, from a given * position within a file, and return the number of bytes read. This does not * change the current offset of a file, and is thread-safe. */ public int read(long position, byte[] buffer, int offset, int length) throws IOException; /** * Read the specified number of bytes, from a given * position within a file. This does not * change the current offset of a file, and is thread-safe. */ public void readFully(long position, byte[] buffer, int offset, int length) throws IOException; /** * Read number of bytes equal to the length of the buffer, from a given * position within a file. This does not * change the current offset of a file, and is thread-safe. */ public void readFully(long position, byte[] buffer) throws IOException; }
{ "pile_set_name": "Github" }
#!/usr/bin/env python import argparse from argparse import ArgumentParser import logging from pathlib import Path from catalyst.dl.utils.quantization import ( quantize_model_from_checkpoint, save_quantized_model, ) def build_args(parser: ArgumentParser): """Builds the command line parameters.""" parser.add_argument("--logdir", type=Path, help="Path to model logdir") parser.add_argument( "--checkpoint", "-c", default="best", help="Checkpoint's name to trace", metavar="CHECKPOINT_NAME", ) parser.add_argument( "--out-dir", type=Path, default=None, help="Output directory to save traced model", ) parser.add_argument( "--out-model", type=Path, default=None, help="Output path to save traced model (overrides --out-dir)", ) parser.add_argument( "--stage", type=str, default=None, help="Stage from experiment from which model and loader will be taken", ) parser.add_argument( "--verbose", action="store_true", ) parser.add_argument( "--backend", type=str, default=None, help="Defines backend for quantization", ) return parser def parse_args(): """Parses the command line arguments for the main method.""" parser = argparse.ArgumentParser() build_args(parser) args = parser.parse_args() return args def main(args, _): """Main method for ``catalyst-dl quantize``.""" logdir: Path = args.logdir checkpoint_name: str = args.checkpoint if args.verbose: logging.basicConfig(level=logging.INFO) else: logging.basicConfig(level=logging.WARNING) quantized_model = quantize_model_from_checkpoint( logdir, checkpoint_name=checkpoint_name, stage=args.stage, backend=args.backend, ) save_quantized_model( model=quantized_model, logdir=logdir, out_model=args.out_model, out_dir=args.out_dir, checkpoint_name=checkpoint_name, ) if __name__ == "__main__": main(parse_args(), None)
{ "pile_set_name": "Github" }
console.log("hello");
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <TestSettings name="Integration Tests" id="be253cdd-63ce-48f6-b0e2-95247f86f79d" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> <Description>These are test settings for using the VS IDE host type.</Description> <Execution> <Hosts> <VSSDKTestHostRunConfig name="VS IDE" HiveKind="DevEnv" HiveName="15.0Exp" xmlns="http://microsoft.com/schemas/VisualStudio/SDK/Tools/IdeHostAdapter/2006/06" /> </Hosts> <TestTypeSpecific> <UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b"> <AssemblyResolution> <TestDirectory useLoadContext="true" /> </AssemblyResolution> </UnitTestRunConfig> </TestTypeSpecific> <AgentRule name="Execution Agents"> </AgentRule> </Execution> </TestSettings>
{ "pile_set_name": "Github" }
<!doctype html> <title>CodeMirror: Verilog/SystemVerilog mode</title> <meta charset="utf-8"/> <link href="../../doc/docs.css" rel=stylesheet> <link href="../../lib/codemirror.css" rel="stylesheet"> <script src="../../lib/codemirror.js"></script> <script src="../../addon/edit/matchbrackets.js"></script> <script src="verilog.js"></script> <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> <div id=nav> <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> <ul> <li><a href="../../index.html">Home</a> <li><a href="../../doc/manual.html">Manual</a> <li><a href="https://github.com/codemirror/codemirror">Code</a> </ul> <ul> <li><a href="../index.html">Language modes</a> <li><a class=active href="#">Verilog/SystemVerilog</a> </ul> </div> <article> <h2>SystemVerilog mode</h2> <div><textarea id="code" name="code"> // Literals 1'b0 1'bx 1'bz 16'hDC78 'hdeadbeef 'b0011xxzz 1234 32'd5678 3.4e6 -128.7 // Macro definition `define BUS_WIDTH = 8; // Module definition module block( input clk, input rst_n, input [`BUS_WIDTH-1:0] data_in, output [`BUS_WIDTH-1:0] data_out ); always @(posedge clk or negedge rst_n) begin if (~rst_n) begin data_out <= 8'b0; end else begin data_out <= data_in; end if (~rst_n) data_out <= 8'b0; else data_out <= data_in; if (~rst_n) begin data_out <= 8'b0; end else begin data_out <= data_in; end end endmodule // Class definition class test; /** * Sum two integers */ function int sum(int a, int b); int result = a + b; string msg = $sformatf("%d + %d = %d", a, b, result); $display(msg); return result; endfunction task delay(int num_cycles); repeat(num_cycles) #1; endtask endclass </textarea></div> <script> var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, matchBrackets: true, mode: { name: "verilog", noIndentKeywords: ["package"] } }); </script> <p> Syntax highlighting and indentation for the Verilog and SystemVerilog languages (IEEE 1800). <h2>Configuration options:</h2> <ul> <li><strong>noIndentKeywords</strong> - List of keywords which should not cause identation to increase. E.g. ["package", "module"]. Default: None</li> </ul> </p> <p><strong>MIME types defined:</strong> <code>text/x-verilog</code> and <code>text/x-systemverilog</code>.</p> </article>
{ "pile_set_name": "Github" }
/** * Licensed to jclouds, Inc. (jclouds) under one or more * contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. jclouds licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.jclouds.cloudstack.features; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; import java.net.URI; import org.jclouds.cloudstack.CloudStackContext; import org.jclouds.cloudstack.domain.ConfigurationEntry; import org.jclouds.cloudstack.internal.BaseCloudStackExpectTest; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; /** * Test the CloudStack GlobalConfigurationClient * * @author Andrei Savu */ @Test(groups = "unit", testName = "GlobalConfigurationClientExpectTest") public class GlobalConfigurationClientExpectTest extends BaseCloudStackExpectTest<GlobalConfigurationClient> { @Test public void testListConfigurationEntriesWhenResponseIs2xx() { GlobalConfigurationClient client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=listConfigurations&listAll=true&apiKey=identity&signature=%2BJ9mTuw%2BZXaumzMAJAXgZQaO2cc%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/listconfigurationsresponse.json")) .build()); assertEquals(client.listConfigurationEntries(), ImmutableSet.of( ConfigurationEntry.builder().category("Advanced").name("account.cleanup.interval").value("86400") .description("The interval (in seconds) between cleanup for removed accounts").build(), ConfigurationEntry.builder().category("Advanced").name("agent.lb.enabled").value("true") .description("If agent load balancing enabled in cluster setup").build() )); } @Test public void testListConfigurationEntriesEmptyOn404() { GlobalConfigurationClient client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=listConfigurations&listAll=true&apiKey=identity&signature=%2BJ9mTuw%2BZXaumzMAJAXgZQaO2cc%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(404) .build()); assertEquals(client.listConfigurationEntries(), ImmutableSet.of()); } @Test public void testUpdateConfigurationEntryWhenResponseIs2xx() { GlobalConfigurationClient client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=updateConfiguration&name=expunge.delay&value=11&" + "apiKey=identity&signature=I2yG35EhfgIXYObeLfU3cvf%2BPeE%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/updateconfigurationsresponse.json")) .build()); assertEquals(client.updateConfigurationEntry("expunge.delay", "11"), ConfigurationEntry.builder().category("Advanced").name("expunge.delay").value("11") .description("Determines how long (in seconds) to wait before actually expunging " + "destroyed vm. The default value = the default value of expunge.interval").build() ); } @Test public void testUpdateConfigurationEntryNullOn404() { GlobalConfigurationClient client = requestSendsResponse( HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=updateConfiguration&name=expunge.delay&value=11&" + "apiKey=identity&signature=I2yG35EhfgIXYObeLfU3cvf%2BPeE%3D")) .addHeader("Accept", "application/json") .build(), HttpResponse.builder() .statusCode(404) .build()); assertNull(client.updateConfigurationEntry("expunge.delay", "11")); } @Override protected GlobalConfigurationClient clientFrom(CloudStackContext context) { return context.getGlobalContext().getApi().getConfigurationClient(); } }
{ "pile_set_name": "Github" }
class LoadOperationType(Enum,IComparable,IFormattable,IConvertible): """ An enum indicating whether a resource load operation was triggered by a user action or an automatic process. enum LoadOperationType,values: Automatic (0),Explicit (1) """ def __eq__(self,*args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self,*args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self,*args): pass def __gt__(self,*args): pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __le__(self,*args): pass def __lt__(self,*args): pass def __ne__(self,*args): pass def __reduce_ex__(self,*args): pass def __str__(self,*args): pass Automatic=None Explicit=None value__=None
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.3"/> <title>prd: xprd.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); $(window).load(resizeHeight); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="HTML_custom.css" rel="stylesheet" type="text/css"/> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td> <td style="padding-left: 0.5em;"> <div id="projectname">prd </div> <div id="projectbrief">Xilinx Vitis Drivers API Documentation</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.3 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Overview</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li><a href="globals.html"><span>APIs</span></a></li> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="pages.html"><span>Examples</span></a></li> </ul> </div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('xprd_8h.html','');}); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> &#124; <a href="#enum-members">Enumerations</a> &#124; <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">xprd.h File Reference</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_x_prd.html">XPrd</a></td></tr> <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The <a class="el" href="struct_x_prd.html" title="The XPrd instance data structure.">XPrd</a> instance data structure. <a href="struct_x_prd.html#details">More...</a><br/></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a> Enumerations</h2></td></tr> <tr class="memitem:ga0535d78c352329f7600250c0936ffc21"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__prd__v2__0.html#ga0535d78c352329f7600250c0936ffc21">XPrd_State</a> { <a class="el" href="group__prd__v2__0.html#gga0535d78c352329f7600250c0936ffc21ac14eedee45ec9f0d49f1bd9c395177f2">XPRD_DECOUPLER_OFF</a>, <a class="el" href="group__prd__v2__0.html#gga0535d78c352329f7600250c0936ffc21a91d1acd860924ac7a0255af3fd3fbb30">XPRD_DECOUPLER_ON</a> }</td></tr> <tr class="separator:ga0535d78c352329f7600250c0936ffc21"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:ga7a83aa6940de765c091dfd07df308ac2"><td class="memItemLeft" align="right" valign="top">XPrd_Config *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__prd__v2__0.html#ga7a83aa6940de765c091dfd07df308ac2">XPrd_LookupConfig</a> (u16 DeviceId)</td></tr> <tr class="memdesc:ga7a83aa6940de765c091dfd07df308ac2"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function looks for the device configuration based on the unique device ID. <a href="group__prd__v2__0.html#ga7a83aa6940de765c091dfd07df308ac2"></a><br/></td></tr> <tr class="separator:ga7a83aa6940de765c091dfd07df308ac2"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ga424f5c8b2cad657a5aea953ba959be55"><td class="memItemLeft" align="right" valign="top">s32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__prd__v2__0.html#ga424f5c8b2cad657a5aea953ba959be55">XPrd_CfgInitialize</a> (<a class="el" href="struct_x_prd.html">XPrd</a> *InstancePtr, XPrd_Config *ConfigPtr, u32 EffectiveAddress)</td></tr> <tr class="memdesc:ga424f5c8b2cad657a5aea953ba959be55"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function initializes a <a class="el" href="struct_x_prd.html" title="The XPrd instance data structure.">XPrd</a> instance/driver. <a href="group__prd__v2__0.html#ga424f5c8b2cad657a5aea953ba959be55"></a><br/></td></tr> <tr class="separator:ga424f5c8b2cad657a5aea953ba959be55"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gacb64d55940567d71186233e1e230c0d0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__prd__v2__0.html#gacb64d55940567d71186233e1e230c0d0">XPrd_SetDecouplerState</a> (<a class="el" href="struct_x_prd.html">XPrd</a> *InstancePtr, <a class="el" href="group__prd__v2__0.html#ga0535d78c352329f7600250c0936ffc21">XPrd_State</a> DecouplerValue)</td></tr> <tr class="memdesc:gacb64d55940567d71186233e1e230c0d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to set Decoupler On or Off. <a href="group__prd__v2__0.html#gacb64d55940567d71186233e1e230c0d0"></a><br/></td></tr> <tr class="separator:gacb64d55940567d71186233e1e230c0d0"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gad37688cbdb9d0b50c481132f6f05cee0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__prd__v2__0.html#ga0535d78c352329f7600250c0936ffc21">XPrd_State</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__prd__v2__0.html#gad37688cbdb9d0b50c481132f6f05cee0">XPrd_GetDecouplerState</a> (<a class="el" href="struct_x_prd.html">XPrd</a> *InstancePtr)</td></tr> <tr class="memdesc:gad37688cbdb9d0b50c481132f6f05cee0"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to read the state of the Decoupler. <a href="group__prd__v2__0.html#gad37688cbdb9d0b50c481132f6f05cee0"></a><br/></td></tr> <tr class="separator:gad37688cbdb9d0b50c481132f6f05cee0"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:gaf18335c2976ab9b7c9d12a5a0c0a450c"><td class="memItemLeft" align="right" valign="top">s32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__prd__v2__0.html#gaf18335c2976ab9b7c9d12a5a0c0a450c">XPrd_SelfTest</a> (<a class="el" href="struct_x_prd.html">XPrd</a> *InstancePtr)</td></tr> <tr class="memdesc:gaf18335c2976ab9b7c9d12a5a0c0a450c"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function runs a self-test for the PRD driver. <a href="group__prd__v2__0.html#gaf18335c2976ab9b7c9d12a5a0c0a450c"></a><br/></td></tr> <tr class="separator:gaf18335c2976ab9b7c9d12a5a0c0a450c"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> </div><!-- contents --> </div><!-- doc-content --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li> </ul> </div> </body> </html>
{ "pile_set_name": "Github" }
面さつくる Making surface $01C65 6A 86 A2 98 B9 20 20 20 | Original Japanese Hex 面 さ つ く る | Original Japanese Text M A P E D I T | New English Text 4D 41 50 20 45 44 49 54 | New English Hex | キャラクターへんこう Change Character $01CC5 D7 CC F7 D8 E0 90 AD BD 9A 93 | Original Japanese Hex キ ャ ラ ク タ ー へ ん こ う | Original Japanese Text S E T T I L E | New English Text 20 53 45 54 20 54 49 4C 45 20 | New English Hex あそんでみる Try playing $01C6F 91 9F BD A3 BE B0 B9 20 | Original Japanese Hex あ そ ん で み る | Original Japanese Text P L A Y M A P | New English Text 50 4C 41 59 20 4D 41 50 | New English Hex | 面さ みなおして くだ さい。 Please Reconsider the surface. $01D61 6A 86 20 B0 A5 95 9C A3 20 98 A0 BE 9B 92 81 | Original Japanese Hex 面 さ み な お し て く だ さ い 。 | Original Japanese Text N O M A P T O P L A Y . | New English Text 4E 4F 20 4D 41 50 20 54 4F 20 50 4C 41 59 2E | New English Hex ゲーム面さよぶ We call the game surfaces $01C79 D9 6B F1 6A 86 B6 AC BE | Original Japanese Hex ゲ ー ム 面 さ よ ぶ | Original Japanese Text M A P L O A D | New English Text 4D 41 50 20 4C 4F 41 44 | New English Hex | ゲーム面さよびます。 The surfaces called a game. $01D02 D9 6B F1 6A 86 B6 AB BE AF 9D 81 | Original Japanese Hex ゲ ー ム 面 さ よ び ま す 。 | Original Japanese Text L O A D L E V E L : | New English Text 4C 4F 41 44 20 4C 45 56 45 4C 3A | New English Hex | こてしらベ コース Preliminary test or trial; tryout Course $018D4 9A A3 9C B7 AD BE 6D 6E 6F | Original Japanese Hex こ て し ら ベ コ ー ス | Original Japanese Text T R I A L S E T | New English Text 54 52 49 41 4C 20 53 45 54 | New English Hex | ウォーミング コース Warming/up Course $018DD D3 CB 7C 7D 7E 7F 6D 6E 6F | Original Japanese Hex ウ ォ ー ミ ン グ コ ー ス | Original Japanese Text W A R M S E T | New English Text 57 41 52 4D 20 20 53 45 54 | New English Hex | ひっかけ コース Grappling/Sumo Course $018E6 AB 8F 96 99 20 20 6D 6E 6F | Original Japanese Hex ひ っ か け コ ー ス | Original Japanese Text S U M O S E T | New English Text 53 55 4D 4F 20 20 53 45 54 | New English Hex | たいさく コース Wants to spend/epic Course $018EF A0 92 9B 98 20 20 6D 6E 6F | Original Japanese Hex た い さ く コ ー ス | Original Japanese Text E P I C S E T | New English Text 45 50 49 43 20 20 53 45 54 | New English Hex | エレガント コース Elegant Course $018F8 D4 FA D6 BE FD E4 6D 6E 6F | Original Japanese Hex エ レ ガ ン ト コ ー ス | Original Japanese Text G R A N D S E T | New English Text 47 52 41 4E 44 20 53 45 54 | New English Hex | なんかい コース Difficult Course $01901 A5 BD 96 92 20 20 6D 6E 6F | Original Japanese Hex な ん か い コ ー ス | Original Japanese Text T O U G H S E T | New English Text 54 4F 55 47 48 20 53 45 54 | New English Hex | num 面 Surface $01D36 20 20 20 20 30 31 6A | Original Japanese Hex num 面 | Original Japanese Text M A P : num | New English Text 4D 41 50 3A 30 31 20 | New English Hex 面さけす Surface Disappear $01C83 6A 86 99 9D 20 20 | Original Japanese Hex 面 さ け す | Original Japanese Text D E L E T E | New English Text 44 45 4C 45 54 45 | New English Hex | 面さ けしますか? The け it does? $01D8E 6A 86 20 99 9C AF 9D 96 3F | Original Japanese Hex 面 さ け し ま す か ? | Original Japanese Text E R A S E A L L | New English Text 45 52 41 53 45 20 41 4C 4C | New English Hex | $01D99 20 20 20 20 20 20 20 20 20 | Original Japanese Hex | Original Japanese Text M A P D A T A ? | New English Text 4D 41 50 20 44 41 54 41 3F | New English Hex | はい / いいえ Yes / No $01DA4 20 AA 20 92 2F 92 92 94 20 | Original Japanese Hex は い / い い え | Original Japanese Text Y E S / N O | New English Text 20 59 45 53 2F 4E 4F 20 20 | New English Hex もどる Back / Return $01C8D B3 85 B9 20 | Original Japanese Hex も ど る | Original Japanese Text E X I T | New English Text 45 58 49 54 | New English Hex
{ "pile_set_name": "Github" }
class AddDefaultsForCacheColumns < ActiveRecord::Migration def self.up change_column_default :users, :karma_cache, 0 change_column_default :samples, :plusminus_cache, 0 end def self.down change_column_default :users, :karma_cache, nil change_column_default :samples, :plusminus_cache, nil end end
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script type="text/javascript"> window.location.href="/sys/toLogin"; </script> </body> </html>
{ "pile_set_name": "Github" }
using System; using System.Globalization; using System.Threading; namespace ChameleonForms.Tests.Helpers { public class ChangeCulture : IDisposable { public static ChangeCulture To(string culture) { return new ChangeCulture(culture); } private readonly CultureInfo _existingCulture; private ChangeCulture(string culture) { _existingCulture = Thread.CurrentThread.CurrentCulture; SetCulture(CultureInfo.GetCultureInfo(culture)); } private void SetCulture(CultureInfo cultureInfo) { Thread.CurrentThread.CurrentCulture = cultureInfo; } public void Dispose() { SetCulture(_existingCulture); } } }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <title>Syncable Protocol Reference</title> <link rel="stylesheet" type="text/css" href="../css/jazzy.css" /> <link rel="stylesheet" type="text/css" href="../css/highlight.css" /> <meta charset='utf-8'> <script src="../js/jquery.min.js" defer></script> <script src="../js/jazzy.js" defer></script> </head> <body> <a name="//apple_ref/swift/Protocol/Syncable" class="dashAnchor"></a> <a title="Syncable Protocol Reference"></a> <header> <div class="content-wrapper"> <p><a href="../index.html">Restofire Docs</a> (85% documented)</p> </div> </header> <div class="content-wrapper"> <p id="breadcrumbs"> <a href="../index.html">Restofire Reference</a> <img id="carat" src="../img/carat.png" /> Syncable Protocol Reference </p> </div> <div class="content-wrapper"> <nav class="sidebar"> <ul class="nav-groups"> <li class="nav-group-name"> <a href="../Classes.html">Classes</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Classes/AnyResponseSerializer.html">AnyResponseSerializer</a> </li> <li class="nav-group-task"> <a href="../Classes/DownloadOperation.html">DownloadOperation</a> </li> <li class="nav-group-task"> <a href="../Classes/NetworkOperation.html">NetworkOperation</a> </li> <li class="nav-group-task"> <a href="../Classes/RequestOperation.html">RequestOperation</a> </li> <li class="nav-group-task"> <a href="../Classes/UploadOperation.html">UploadOperation</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Enums.html">Enumerations</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Enums/ParametersType.html">ParametersType</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Extensions.html">Extensions</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Extensions/JSONEncoding.html">JSONEncoding</a> </li> <li class="nav-group-task"> <a href="../Extensions/Result.html">Result</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Protocols.html">Protocols</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Protocols/ArrayParameterEncoding.html">ArrayParameterEncoding</a> </li> <li class="nav-group-task"> <a href="../Protocols/Authenticable.html">Authenticable</a> </li> <li class="nav-group-task"> <a href="../Protocols/BackgroundQosable.html">BackgroundQosable</a> </li> <li class="nav-group-task"> <a href="../Protocols/BaseRequestable.html">BaseRequestable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Cancellable.html">Cancellable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Configurable.html">Configurable</a> </li> <li class="nav-group-task"> <a href="../Protocols/CoreDataSyncable.html">CoreDataSyncable</a> </li> <li class="nav-group-task"> <a href="../Protocols/DataUploadable.html">DataUploadable</a> </li> <li class="nav-group-task"> <a href="../Protocols/DefaultQosable.html">DefaultQosable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Downloadable.html">Downloadable</a> </li> <li class="nav-group-task"> <a href="../Protocols/FileUploadable.html">FileUploadable</a> </li> <li class="nav-group-task"> <a href="../Protocols/HighQueuePriortizable.html">HighQueuePriortizable</a> </li> <li class="nav-group-task"> <a href="../Protocols/LowQueuePriortizable.html">LowQueuePriortizable</a> </li> <li class="nav-group-task"> <a href="../Protocols/MultipartUploadable.html">MultipartUploadable</a> </li> <li class="nav-group-task"> <a href="../Protocols/NormalQueuePriortizable.html">NormalQueuePriortizable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Pollable.html">Pollable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Qosable.html">Qosable</a> </li> <li class="nav-group-task"> <a href="../Protocols/QueuePriortizable.html">QueuePriortizable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Queueable.html">Queueable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Reachable.html">Reachable</a> </li> <li class="nav-group-task"> <a href="../Protocols/RequestDelegate.html">RequestDelegate</a> </li> <li class="nav-group-task"> <a href="../Protocols/Requestable.html">Requestable</a> </li> <li class="nav-group-task"> <a href="../Protocols/ResponseSerializable.html">ResponseSerializable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Retryable.html">Retryable</a> </li> <li class="nav-group-task"> <a href="../Protocols/SessionManagable.html">SessionManagable</a> </li> <li class="nav-group-task"> <a href="../Protocols/StreamUploadable.html">StreamUploadable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Syncable.html">Syncable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Uploadable.html">Uploadable</a> </li> <li class="nav-group-task"> <a href="../Protocols/UserInitiatedQosable.html">UserInitiatedQosable</a> </li> <li class="nav-group-task"> <a href="../Protocols/UserInteractiveQosable.html">UserInteractiveQosable</a> </li> <li class="nav-group-task"> <a href="../Protocols/UtilityQosable.html">UtilityQosable</a> </li> <li class="nav-group-task"> <a href="../Protocols/Validatable.html">Validatable</a> </li> <li class="nav-group-task"> <a href="../Protocols/VeryHighQueuePriortizable.html">VeryHighQueuePriortizable</a> </li> <li class="nav-group-task"> <a href="../Protocols/VeryLowQueuePriortizable.html">VeryLowQueuePriortizable</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Structs.html">Structures</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Structs/Authentication.html">Authentication</a> </li> <li class="nav-group-task"> <a href="../Structs/Configuration.html">Configuration</a> </li> <li class="nav-group-task"> <a href="../Structs/Poll.html">Poll</a> </li> <li class="nav-group-task"> <a href="../Structs/Queues.html">Queues</a> </li> <li class="nav-group-task"> <a href="../Structs/Reachability.html">Reachability</a> </li> <li class="nav-group-task"> <a href="../Structs/Retry.html">Retry</a> </li> <li class="nav-group-task"> <a href="../Structs/SessionManager.html">SessionManager</a> </li> <li class="nav-group-task"> <a href="../Structs/Validation.html">Validation</a> </li> </ul> </li> <li class="nav-group-name"> <a href="../Typealiases.html">Type Aliases</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire11DataRequesta">DataRequest</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire12DataResponsea">DataResponse</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire22DataResponseSerializera">DataResponseSerializer</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire15DownloadRequesta">DownloadRequest</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire16DownloadResponsea">DownloadResponse</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire10HTTPHeadera">HTTPHeader</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire11HTTPHeadersa">HTTPHeaders</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire10HTTPMethoda">HTTPMethod</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire12JSONEncodinga">JSONEncoding</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire20JSONParameterEncodera">JSONParameterEncoder</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire17MultipartFormDataa">MultipartFormData</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire26NetworkReachabilityManagera">NetworkReachabilityManager</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire16ParameterEncodera">ParameterEncoder</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire17ParameterEncodinga">ParameterEncoding</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire7RFErrora">RFError</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire8RFResulta">RFResult</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire7Requesta">Request</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire7Sessiona">Session</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire30URLEncodedFormParameterEncodera">URLEncodedFormParameterEncoder</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire11URLEncodinga">URLEncoding</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire21URLRequestConvertiblea">URLRequestConvertible</a> </li> <li class="nav-group-task"> <a href="../Typealiases.html#/s:9Restofire13UploadRequesta">UploadRequest</a> </li> </ul> </li> </ul> </nav> <article class="main-content"> <section> <section class="section"> <h1>Syncable</h1> <div class="declaration"> <div class="language"> <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Syncable</span></code></pre> </div> </div> <p>Undocumented</p> </section> <section class="section task-group-section"> <div class="task-group"> <ul> <li class="item"> <div> <code> <a name="/s:9Restofire8SyncableP7RequestQa"></a> <a name="//apple_ref/swift/Alias/Request" class="dashAnchor"></a> <a class="token" href="#/s:9Restofire8SyncableP7RequestQa">Request</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Undocumented</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">associatedtype</span> <span class="kt">Request</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/Requestable.html">Requestable</a></span></code></pre> </div> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/s:9Restofire8SyncableP7request7RequestQzvp"></a> <a name="//apple_ref/swift/Property/request" class="dashAnchor"></a> <a class="token" href="#/s:9Restofire8SyncableP7request7RequestQzvp">request</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Undocumented</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="k">var</span> <span class="nv">request</span><span class="p">:</span> <span class="kt"><a href="../Protocols/Syncable.html#/s:9Restofire8SyncableP7RequestQa">Request</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre> </div> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/s:9Restofire8SyncableP10shouldSyncSbyKF"></a> <a name="//apple_ref/swift/Method/shouldSync()" class="dashAnchor"></a> <a class="token" href="#/s:9Restofire8SyncableP10shouldSyncSbyKF">shouldSync()</a> </code> <span class="declaration-note"> Default implementation </span> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Undocumented</p> </div> <h4>Default Implementation</h4> <div class="default_impl abstract"> <p>Undocumented</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">shouldSync</span><span class="p">()</span> <span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre> </div> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/s:9Restofire8SyncableP6insert5model10completiony7Request_8ResponseQZ_yyKctKF"></a> <a name="//apple_ref/swift/Method/insert(model:completion:)" class="dashAnchor"></a> <a class="token" href="#/s:9Restofire8SyncableP6insert5model10completiony7Request_8ResponseQZ_yyKctKF">insert(model:completion:)</a> </code> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Undocumented</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">insert</span><span class="p">(</span><span class="nv">model</span><span class="p">:</span> <span class="kt"><a href="../Protocols/Syncable.html#/s:9Restofire8SyncableP7RequestQa">Request</a></span><span class="o">.</span><span class="kt">Response</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">()</span> <span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="k">throws</span></code></pre> </div> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/s:9Restofire8SyncablePAAE4sync10parameters23downloadProgressHandler15completionQueue9immediate0H0AA11Cancellable_pSgypSg_ySo10NSProgressCc_So17OS_dispatch_queueCSg0O0tSgAPSbys5Error_pSgcSgtF"></a> <a name="//apple_ref/swift/Method/sync(parameters:downloadProgressHandler:completionQueue:immediate:completion:)" class="dashAnchor"></a> <a class="token" href="#/s:9Restofire8SyncablePAAE4sync10parameters23downloadProgressHandler15completionQueue9immediate0H0AA11Cancellable_pSgypSg_ySo10NSProgressCc_So17OS_dispatch_queueCSg0O0tSgAPSbys5Error_pSgcSgtF">sync(parameters:downloadProgressHandler:completionQueue:immediate:completion:)</a> </code> <span class="declaration-note"> Extension method </span> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Undocumented</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">sync</span><span class="p">(</span> <span class="nv">parameters</span><span class="p">:</span> <span class="kt">Any</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">downloadProgressHandler</span><span class="p">:</span> <span class="p">((</span><span class="kt">Progress</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">,</span> <span class="nv">queue</span><span class="p">:</span> <span class="kt">DispatchQueue</span><span class="p">?)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">completionQueue</span><span class="p">:</span> <span class="kt">DispatchQueue</span> <span class="o">=</span> <span class="o">.</span><span class="n">main</span><span class="p">,</span> <span class="nv">immediate</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span> <span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Protocols/Cancellable.html">Cancellable</a></span><span class="p">?</span></code></pre> </div> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/s:9Restofire8SyncablePAAE4sync10parameters23downloadProgressHandler15completionQueue9immediate0H0AA11Cancellable_pSgqd___ySo10NSProgressCc_So17OS_dispatch_queueCSg0O0tSgAOSbys5Error_pSgcSgtSERd__lF"></a> <a name="//apple_ref/swift/Method/sync(parameters:downloadProgressHandler:completionQueue:immediate:completion:)" class="dashAnchor"></a> <a class="token" href="#/s:9Restofire8SyncablePAAE4sync10parameters23downloadProgressHandler15completionQueue9immediate0H0AA11Cancellable_pSgqd___ySo10NSProgressCc_So17OS_dispatch_queueCSg0O0tSgAOSbys5Error_pSgcSgtSERd__lF">sync(parameters:downloadProgressHandler:completionQueue:immediate:completion:)</a> </code> <span class="declaration-note"> Extension method </span> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Undocumented</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">sync</span><span class="o">&lt;</span><span class="kt">T</span><span class="p">:</span> <span class="kt">Encodable</span><span class="o">&gt;</span><span class="p">(</span> <span class="nv">parameters</span><span class="p">:</span> <span class="kt">T</span><span class="p">,</span> <span class="nv">downloadProgressHandler</span><span class="p">:</span> <span class="p">((</span><span class="kt">Progress</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">,</span> <span class="nv">queue</span><span class="p">:</span> <span class="kt">DispatchQueue</span><span class="p">?)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">completionQueue</span><span class="p">:</span> <span class="kt">DispatchQueue</span> <span class="o">=</span> <span class="o">.</span><span class="n">main</span><span class="p">,</span> <span class="nv">immediate</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span> <span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Protocols/Cancellable.html">Cancellable</a></span><span class="p">?</span></code></pre> </div> </div> </section> </div> </li> <li class="item"> <div> <code> <a name="/s:9Restofire8SyncablePAAE4sync14parametersType23downloadProgressHandler15completionQueue9immediate0I0AA11Cancellable_pSgAA010ParametersE0Oyqd__G_ySo10NSProgressCc_So17OS_dispatch_queueCSg0Q0tSgARSbys5Error_pSgcSgtSERd__lF"></a> <a name="//apple_ref/swift/Method/sync(parametersType:downloadProgressHandler:completionQueue:immediate:completion:)" class="dashAnchor"></a> <a class="token" href="#/s:9Restofire8SyncablePAAE4sync14parametersType23downloadProgressHandler15completionQueue9immediate0I0AA11Cancellable_pSgAA010ParametersE0Oyqd__G_ySo10NSProgressCc_So17OS_dispatch_queueCSg0Q0tSgARSbys5Error_pSgcSgtSERd__lF">sync(parametersType:downloadProgressHandler:completionQueue:immediate:completion:)</a> </code> <span class="declaration-note"> Extension method </span> </div> <div class="height-container"> <div class="pointer-container"></div> <section class="section"> <div class="pointer"></div> <div class="abstract"> <p>Undocumented</p> </div> <div class="declaration"> <h4>Declaration</h4> <div class="language"> <p class="aside-title">Swift</p> <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">sync</span><span class="o">&lt;</span><span class="kt">T</span><span class="p">:</span> <span class="kt">Encodable</span><span class="o">&gt;</span><span class="p">(</span> <span class="nv">parametersType</span><span class="p">:</span> <span class="kt"><a href="../Enums/ParametersType.html">ParametersType</a></span><span class="o">&lt;</span><span class="kt">T</span><span class="o">&gt;</span><span class="p">,</span> <span class="nv">downloadProgressHandler</span><span class="p">:</span> <span class="p">((</span><span class="kt">Progress</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">,</span> <span class="nv">queue</span><span class="p">:</span> <span class="kt">DispatchQueue</span><span class="p">?)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">completionQueue</span><span class="p">:</span> <span class="kt">DispatchQueue</span> <span class="o">=</span> <span class="o">.</span><span class="n">main</span><span class="p">,</span> <span class="nv">immediate</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span> <span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Protocols/Cancellable.html">Cancellable</a></span><span class="p">?</span></code></pre> </div> </div> </section> </div> </li> </ul> </div> </section> </section> <section id="footer"> <p>&copy; 2020 <a class="link" href="https://github.com/Restofire/Restofire" target="_blank" rel="external">Rahul Katariya</a>. All rights reserved. (Last updated: 2020-02-19)</p> <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.1</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p> </section> </article> </div> </body> </div> </html>
{ "pile_set_name": "Github" }
set hive.map.aggr=false; set hive.groupby.skewindata=false; set mapred.reduce.tasks=31; CREATE TABLE dest1(c1 DOUBLE, c2 DOUBLE, c3 DOUBLE, c4 DOUBLE, c5 DOUBLE, c6 DOUBLE, c7 DOUBLE, c8 DOUBLE, c9 DOUBLE, c10 DOUBLE, c11 DOUBLE) STORED AS TEXTFILE; EXPLAIN FROM src INSERT OVERWRITE TABLE dest1 SELECT sum(substr(src.value,5)), avg(substr(src.value,5)), avg(DISTINCT substr(src.value,5)), max(substr(src.value,5)), min(substr(src.value,5)), std(substr(src.value,5)), stddev_samp(substr(src.value,5)), variance(substr(src.value,5)), var_samp(substr(src.value,5)), sum(DISTINCT substr(src.value, 5)), count(DISTINCT substr(src.value, 5)); FROM src INSERT OVERWRITE TABLE dest1 SELECT sum(substr(src.value,5)), avg(substr(src.value,5)), avg(DISTINCT substr(src.value,5)), max(substr(src.value,5)), min(substr(src.value,5)), std(substr(src.value,5)), stddev_samp(substr(src.value,5)), variance(substr(src.value,5)), var_samp(substr(src.value,5)), sum(DISTINCT substr(src.value, 5)), count(DISTINCT substr(src.value, 5)); SELECT dest1.* FROM dest1;
{ "pile_set_name": "Github" }
<!doctype html> <title>CodeMirror: Smalltalk mode</title> <meta charset="utf-8"/> <link rel=stylesheet href="../../doc/docs.css"> <link rel="stylesheet" href="../../lib/codemirror.css"> <script src="../../lib/codemirror.js"></script> <script src="../../addon/edit/matchbrackets.js"></script> <script src="smalltalk.js"></script> <style> .CodeMirror {border: 2px solid #dee; border-right-width: 10px;} .CodeMirror-gutter {border: none; background: #dee;} .CodeMirror-gutter pre {color: white; font-weight: bold;} </style> <div id=nav> <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> <ul> <li><a href="../../index.html">Home</a> <li><a href="../../doc/manual.html">Manual</a> <li><a href="https://github.com/codemirror/codemirror">Code</a> </ul> <ul> <li><a href="../index.html">Language modes</a> <li><a class=active href="#">Smalltalk</a> </ul> </div> <article> <h2>Smalltalk mode</h2> <form><textarea id="code" name="code"> " This is a test of the Smalltalk code " Seaside.WAComponent subclass: #MyCounter [ | count | MyCounter class &gt;&gt; canBeRoot [ ^true ] initialize [ super initialize. count := 0. ] states [ ^{ self } ] renderContentOn: html [ html heading: count. html anchor callback: [ count := count + 1 ]; with: '++'. html space. html anchor callback: [ count := count - 1 ]; with: '--'. ] ] MyCounter registerAsApplication: 'mycounter' </textarea></form> <script> var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, matchBrackets: true, mode: "text/x-stsrc", indentUnit: 4 }); </script> <p>Simple Smalltalk mode.</p> <p><strong>MIME types defined:</strong> <code>text/x-stsrc</code>.</p> </article>
{ "pile_set_name": "Github" }
# # The MIT License # Copyright (c) 2015 Estonian Information System Authority (RIA), Population Register Centre (VRK) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # $CLASSPATH << "build/libs" Dir.glob(File.expand_path("../../../build/libs/*.jar", __FILE__)).each do |file| require file end CenterUi::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Log error messages when you accidentally call methods on nil. config.whiny_nils = true # Show full error reports and disable caching config.consider_all_requests_local = true config.action_controller.perform_caching = false # Don't care if the mailer can't send # config.action_mailer.raise_delivery_errors = false # Print deprecation notices to the Rails logger config.active_support.deprecation = :log # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin # Use SQL instead of Active Record's schema dumper when creating the database. # This is necessary if your schema can't be completely dumped by the schema dumper, # like if you have constraints or database-specific column types. # XXX Make sure the version of pg_dump found first in your path matches the # version of Postgres used. # XXX Make sure the local connections are authenticated using the md5 scheme; # this is set in pg_hba.conf. config.active_record.schema_format = :sql end
{ "pile_set_name": "Github" }
/* $NetBSD: mbuf.c,v 1.33 2015/07/28 19:46:42 christos Exp $ */ /* * Copyright (c) 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "from: @(#)mbuf.c 8.1 (Berkeley) 6/6/93"; #else __RCSID("$NetBSD: mbuf.c,v 1.33 2015/07/28 19:46:42 christos Exp $"); #endif #endif /* not lint */ #define __POOL_EXPOSE #include <sys/param.h> #include <sys/protosw.h> #include <sys/socket.h> #include <sys/mbuf.h> #include <sys/pool.h> #include <sys/sysctl.h> #include <stdio.h> #include <kvm.h> #include <stdlib.h> #include <limits.h> #include <errno.h> #include <err.h> #include "netstat.h" #include "prog_ops.h" #define YES 1 struct mbstat mbstat; struct pool mbpool, mclpool; struct pool_allocator mbpa, mclpa; static struct mbtypes { int mt_type; const char *mt_name; } mbtypes[] = { { MT_DATA, "data" }, { MT_OOBDATA, "oob data" }, { MT_CONTROL, "ancillary data" }, { MT_HEADER, "packet headers" }, { MT_FTABLE, "fragment reassembly queue headers" }, /* XXX */ { MT_SONAME, "socket names and addresses" }, { MT_SOOPTS, "socket options" }, { 0, 0 } }; const int nmbtypes = sizeof(mbstat.m_mtypes) / sizeof(short); bool seen[256]; /* "have we seen this type yet?" */ int mbstats_ctl[] = { CTL_KERN, KERN_MBUF, MBUF_STATS }; int mowners_ctl[] = { CTL_KERN, KERN_MBUF, MBUF_MOWNERS }; /* * Print mbuf statistics. */ void mbpr(u_long mbaddr, u_long msizeaddr, u_long mclbaddr, u_long mbpooladdr, u_long mclpooladdr) { u_long totmem, totused, totpct; u_int totmbufs; int i, lines; struct mbtypes *mp; size_t len; void *data; struct mowner_user *mo; int mclbytes, msize; if (nmbtypes != 256) { fprintf(stderr, "%s: unexpected change to mbstat; check source\n", getprogname()); return; } if (use_sysctl) { size_t mbstatlen = sizeof(mbstat); if (prog_sysctl(mbstats_ctl, sizeof(mbstats_ctl) / sizeof(mbstats_ctl[0]), &mbstat, &mbstatlen, NULL, 0) < 0) { warn("mbstat: sysctl failed"); return; } goto printit; } if (mbaddr == 0) { fprintf(stderr, "%s: mbstat: symbol not in namelist\n", getprogname()); return; } /*XXX*/ if (msizeaddr != 0) kread(msizeaddr, (char *)&msize, sizeof (msize)); else msize = MSIZE; if (mclbaddr != 0) kread(mclbaddr, (char *)&mclbytes, sizeof (mclbytes)); else mclbytes = MCLBYTES; /*XXX*/ if (kread(mbaddr, (char *)&mbstat, sizeof (mbstat))) return; if (kread(mbpooladdr, (char *)&mbpool, sizeof (mbpool))) return; if (kread(mclpooladdr, (char *)&mclpool, sizeof (mclpool))) return; mbpooladdr = (u_long) mbpool.pr_alloc; mclpooladdr = (u_long) mclpool.pr_alloc; if (kread(mbpooladdr, (char *)&mbpa, sizeof (mbpa))) return; if (kread(mclpooladdr, (char *)&mclpa, sizeof (mclpa))) return; printit: totmbufs = 0; for (mp = mbtypes; mp->mt_name; mp++) totmbufs += mbstat.m_mtypes[mp->mt_type]; printf("%u mbufs in use:\n", totmbufs); for (mp = mbtypes; mp->mt_name; mp++) if (mbstat.m_mtypes[mp->mt_type]) { seen[mp->mt_type] = YES; printf("\t%u mbufs allocated to %s\n", mbstat.m_mtypes[mp->mt_type], mp->mt_name); } seen[MT_FREE] = YES; for (i = 0; i < nmbtypes; i++) if (!seen[i] && mbstat.m_mtypes[i]) { printf("\t%u mbufs allocated to <mbuf type %d>\n", mbstat.m_mtypes[i], i); } if (use_sysctl) /* XXX */ goto dump_drain; printf("%lu/%lu mapped pages in use\n", (u_long)(mclpool.pr_nget - mclpool.pr_nput), ((u_long)mclpool.pr_npages * mclpool.pr_itemsperpage)); totmem = (mbpool.pr_npages << mbpa.pa_pageshift) + (mclpool.pr_npages << mclpa.pa_pageshift); totused = (mbpool.pr_nget - mbpool.pr_nput) * mbpool.pr_size + (mclpool.pr_nget - mclpool.pr_nput) * mclpool.pr_size; if (totmem == 0) totpct = 0; else if (totused < (ULONG_MAX/100)) totpct = (totused * 100)/totmem; else { u_long totmem1 = totmem/100; u_long totused1 = totused/100; totpct = (totused1 * 100)/totmem1; } printf("%lu Kbytes allocated to network (%lu%% in use)\n", totmem / 1024, totpct); dump_drain: printf("%lu calls to protocol drain routines\n", mbstat.m_drain); if (sflag < 2) return; if (!use_sysctl) return; if (prog_sysctl(mowners_ctl, sizeof(mowners_ctl)/sizeof(mowners_ctl[0]), NULL, &len, NULL, 0) < 0) { if (errno == ENOENT) return; warn("mowners: sysctl test"); return; } len += 10 * sizeof(*mo); /* add some slop */ data = malloc(len); if (data == NULL) { warn("malloc(%lu)", (u_long)len); return; } if (prog_sysctl(mowners_ctl, sizeof(mowners_ctl)/sizeof(mowners_ctl[0]), data, &len, NULL, 0) < 0) { warn("mowners: sysctl get"); free(data); return; } for (mo = (void *) data, lines = 0; len >= sizeof(*mo); len -= sizeof(*mo), mo++) { char buf[32]; if (vflag == 1 && mo->mo_counter[MOWNER_COUNTER_CLAIMS] == 0 && mo->mo_counter[MOWNER_COUNTER_EXT_CLAIMS] == 0 && mo->mo_counter[MOWNER_COUNTER_CLUSTER_CLAIMS] == 0) continue; if (vflag == 0 && mo->mo_counter[MOWNER_COUNTER_CLAIMS] == mo->mo_counter[MOWNER_COUNTER_RELEASES] && mo->mo_counter[MOWNER_COUNTER_EXT_CLAIMS] == mo->mo_counter[MOWNER_COUNTER_EXT_RELEASES] && mo->mo_counter[MOWNER_COUNTER_CLUSTER_CLAIMS] == mo->mo_counter[MOWNER_COUNTER_CLUSTER_RELEASES]) continue; snprintf(buf, sizeof(buf), "%16s %-13s", mo->mo_name, mo->mo_descr); if ((lines % 24) == 0 || lines > 24) { printf("%30s %-8s %10s %10s %10s\n", "", "", "small", "ext", "cluster"); lines = 1; } printf("%30s %-8s %10lu %10lu %10lu\n", buf, "inuse", mo->mo_counter[MOWNER_COUNTER_CLAIMS] - mo->mo_counter[MOWNER_COUNTER_RELEASES], mo->mo_counter[MOWNER_COUNTER_EXT_CLAIMS] - mo->mo_counter[MOWNER_COUNTER_EXT_RELEASES], mo->mo_counter[MOWNER_COUNTER_CLUSTER_CLAIMS] - mo->mo_counter[MOWNER_COUNTER_CLUSTER_RELEASES]); lines++; if (vflag) { printf("%30s %-8s %10lu %10lu %10lu\n", "", "claims", mo->mo_counter[MOWNER_COUNTER_CLAIMS], mo->mo_counter[MOWNER_COUNTER_EXT_CLAIMS], mo->mo_counter[MOWNER_COUNTER_CLUSTER_CLAIMS]); printf("%30s %-8s %10lu %10lu %10lu\n", "", "releases", mo->mo_counter[MOWNER_COUNTER_RELEASES], mo->mo_counter[MOWNER_COUNTER_EXT_RELEASES], mo->mo_counter[MOWNER_COUNTER_CLUSTER_RELEASES]); lines += 2; } } free(data); }
{ "pile_set_name": "Github" }
- name: Bring up docker containers for network test cloud hosts: localhost vars: inventory: - name: provision_docker_host_one image: "ubuntu-upstart:14.04" network_mode: "host" roles: - role: provision_docker provision_docker_inventory: "{{ inventory }}" - name: Bring up docker containers for inventory iface hosts: localhost vars: provision_docker_network: "host" roles: - role: provision_docker provision_docker_inventory_group: "{{ groups['decepticons'] }}" - name: Run tests for docker connection cloud hosts: docker_containers:decepticons tasks: - name: Verify that network related file is in container stat: path: "/proc/sys/net/ipv4/tcp_tw_reuse" register: st - name: Fail when doesn't exist fail: msg: "/proc/sys/net/ipv4/tcp_tw_reuse" when: not st.stat.exists
{ "pile_set_name": "Github" }
git-stacktrace ============== git-stacktrace is a tool to help you associate git commits with stacktraces. It helps you identify related commits by looking at: * commits in given range that touched files present in the stacktrace * commits in given range that added/removed code present in the stacktrace Supported Languages ------------------- * Python * Java * `JavaScript <https://v8.dev/docs/stack-trace-api>`_ Development ------------ Run tests with: ``tox`` Installation ------------ .. code-block:: sh $ pip install git_stacktrace Usage ----- Run ``git stacktrace`` within a git initialized directory. .. code-block:: sh usage: git stacktrace [<options>] [<RANGE>] < stacktrace from stdin Lookup commits related to a given stacktrace. positional arguments: range git commit range to use optional arguments: -h, --help show this help message and exit --since <date1> show commits more recent than a specific date (from git-log) --server start a webserver to visually interact with git- stacktrace --port PORT Server port -f, --fast Speed things up by not running pickaxe if the file for a line of code cannot be found -b [BRANCH], --branch [BRANCH] Git branch. If using --since, use this to specify which branch to run since on. Runs on current branch by default --version show program's version number and exit -d, --debug Enable debug logging For the Python API see: ``git_stacktrace/api.py`` To run as a web server: ``git stacktrace --server --port=8080`` or ``GIT_STACKTRACE_PORT=8080 git stacktrace --server`` Use the web server as an API: .. code-block:: sh $ curl \ -d '{"option-type":"by-date", "since":"1.day", "trace":"..."}' \ -H "Content-Type: application/json" \ -X POST http://localhost:8080/ Examples -------- Example output:: $ git stacktrace --since=1.day < trace Traceback (most recent call last): File "webapp/framework/resource.py", line 72, in _call result = getattr(self, method_name)() File "webapp/resources/interests_resource.py", line 232, in get if self.options['from_navigate'] == "true": KeyError commit da39a3ee5e6b4b0d3255bfef95601890afd80709 Commit Date: Tue, 19 Jul 2016 14:18:08 -0700 Author: John Doe <[email protected]> Subject: break interest resource Link: https://example.com/D1000 Files Modified: - webapp/resources/interests_resource.py:232 Lines Added: - "if self.options['from_navigate'] == "true":"
{ "pile_set_name": "Github" }
96a81e4c15a24c97b31e85652e161f994b13750bf7d8e4d06f39640c4e9c116d
{ "pile_set_name": "Github" }
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.personalize.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.Request; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.personalize.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.protocol.*; import com.amazonaws.protocol.Protocol; import com.amazonaws.annotation.SdkInternalApi; /** * ListEventTrackersRequest Marshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class ListEventTrackersRequestProtocolMarshaller implements Marshaller<Request<ListEventTrackersRequest>, ListEventTrackersRequest> { private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.AWS_JSON).requestUri("/") .httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true) .operationIdentifier("AmazonPersonalize.ListEventTrackers").serviceName("AmazonPersonalize").build(); private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory; public ListEventTrackersRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) { this.protocolFactory = protocolFactory; } public Request<ListEventTrackersRequest> marshall(ListEventTrackersRequest listEventTrackersRequest) { if (listEventTrackersRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { final ProtocolRequestMarshaller<ListEventTrackersRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING, listEventTrackersRequest); protocolMarshaller.startMarshalling(); ListEventTrackersRequestMarshaller.getInstance().marshall(listEventTrackersRequest, protocolMarshaller); return protocolMarshaller.finishMarshalling(); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
{ "pile_set_name": "Github" }
// MIT License - Copyright (c) Malte Rupprecht // This file is subject to the terms and conditions defined in // LICENSE, which is part of this source code package using System; using System.IO; using System.Numerics; namespace LibreLancer.Utf { public class PrisConstruct : AbstractConstruct { public Vector3 Offset { get; set; } public Vector3 AxisTranslation { get; set; } public float Min { get; set; } public float Max { get; set; } private Matrix4x4 currentTransform = Matrix4x4.Identity; public override Matrix4x4 LocalTransform { get { return internalGetTransform(Rotation * currentTransform * Matrix4x4.CreateTranslation(Origin + Offset)); } } public PrisConstruct() : base() {} public PrisConstruct(BinaryReader reader) : base(reader) { Offset = ConvertData.ToVector3(reader); Rotation = ConvertData.ToMatrix3x3(reader); AxisTranslation = ConvertData.ToVector3(reader); Min = reader.ReadSingle(); Max = reader.ReadSingle(); } protected PrisConstruct(PrisConstruct cloneFrom) : base(cloneFrom) { } public override AbstractConstruct Clone() { var newc = new PrisConstruct(this); newc.Offset = Offset; newc.AxisTranslation = AxisTranslation; newc.Min = Min; newc.Max = Max; return newc; } public override void Reset() { currentTransform = Matrix4x4.Identity; } public override void Update(float distance, Quaternion quat) { Vector3 currentTranslation = AxisTranslation * MathHelper.Clamp(distance, Min, Max); currentTransform = Matrix4x4.CreateTranslation(currentTranslation); } } }
{ "pile_set_name": "Github" }
<?php /** * Controller for validator test-cases. */ class HTMLPurifier_ConfigSchema_ValidatorTestCase extends UnitTestCase { protected $_path, $_parser, $_builder; public $validator; public function __construct($path) { $this->_path = $path; $this->_parser = new HTMLPurifier_StringHashParser(); $this->_builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder(); parent::__construct($path); } public function setup() { $this->validator = new HTMLPurifier_ConfigSchema_Validator(); } public function testValidator() { $hashes = $this->_parser->parseMultiFile($this->_path); $interchange = new HTMLPurifier_ConfigSchema_Interchange(); $error = null; foreach ($hashes as $hash) { if (!isset($hash['ID'])) { if (isset($hash['ERROR'])) { $this->expectException( new HTMLPurifier_ConfigSchema_Exception($hash['ERROR']) ); } continue; } $this->_builder->build($interchange, new HTMLPurifier_StringHash($hash)); } $this->validator->validate($interchange); $this->pass(); } } // vim: et sw=4 sts=4
{ "pile_set_name": "Github" }
/* Copyright (C) 2018-2019 Andres Castellanos This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/> */ package jupiter.riscv.instructions; /** * Represents the RISC-V instruction formats. */ public enum Format { /** R4 format **/ R4, /** R format */ R, /** I format */ I, /** S format */ S, /** B format */ B, /** U format */ U, /** J format */ J; }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <odoo> <record model="ir.ui.view" id="crm_lead_forward_to_partner_form"> <field name="name">crm_lead_forward_to_partner</field> <field name="model">crm.lead.forward.to.partner</field> <field name="arch" type="xml"> <form string="Send Mail"> <group> <field name="forward_type" invisible="context.get('hide_forward_type',False)"/> </group> <group> <group> <field name="partner_id" attrs="{'invisible': [('forward_type', 'in', ['assigned',False])], 'required': [('forward_type', '=', 'single')]}" /> </group> <group> </group> </group> <field name="assignation_lines" attrs="{'invisible': [('forward_type', 'in', ['single',False])]}"> <tree create="false" editable="bottom"> <field name="lead_id" readonly="1" force_save="1" /> <field name="lead_location" readonly="1"/> <field name="partner_assigned_id"/> <field name="partner_location" readonly="1"/> </tree> </field> <notebook colspan="4" groups="base.group_no_one"> <page string="Email Template"> <field name="body" readonly="1" options="{'style-inline': true}"/> </page> </notebook> <footer> <button name="action_forward" string="Send" type="object" class="btn-primary"/> <button string="Cancel" special="cancel" class="btn-secondary"/> </footer> </form> </field> </record> <record model="ir.actions.act_window" id="crm_lead_forward_to_partner_act"> <field name="name">Forward to Partner</field> <field name="res_model">crm.lead.forward.to.partner</field> <field name="view_mode">form</field> <field name="view_id" ref="crm_lead_forward_to_partner_form"/> <field name="target">new</field> </record> <act_window id="action_crm_send_mass_forward" name="Forward to partner" res_model="crm.lead.forward.to.partner" binding_model="crm.lead" view_mode="form" target="new" groups="sales_team.group_sale_manager" context="{'default_composition_mode' : 'mass_mail'}" view_id="crm_lead_forward_to_partner_form" /> </odoo>
{ "pile_set_name": "Github" }
define(["sugar-web/env", "sugar-web/datastore"], function (env, datastore) { 'use strict'; describe("Ensure the datastore object has an objectId", function () { // FIXME does not work in standalone mode it("should have objectId", function () { var objectId = "objectId"; spyOn(env, "getObjectId").andCallFake(function (callback) { setTimeout(function () { callback(objectId); }, 0); }); var callback = jasmine.createSpy(); var datastoreObject = new datastore.DatastoreObject(); runs(function () { datastoreObject.ensureObjectId(callback); }); waitsFor(function () { return datastoreObject.objectId !== undefined; }, "should have objectId received from the environment"); runs(function () { expect(callback).toHaveBeenCalled(); }); }); }); });
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html><head><title></title> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta name="generator" content="Doxygen 1.8.6"> <link rel="stylesheet" type="text/css" href="search.css"/> <script type="text/javascript" src="functions_7.js"></script> <script type="text/javascript" src="search.js"></script> </head> <body class="SRPage"> <div id="SRIndex"> <div class="SRStatus" id="Loading">Loading...</div> <div id="SRResults"></div> <script type="text/javascript"><!-- createResults(); --></script> <div class="SRStatus" id="Searching">Searching...</div> <div class="SRStatus" id="NoMatches">No Matches</div> <script type="text/javascript"><!-- document.getElementById("Loading").style.display="none"; document.getElementById("NoMatches").style.display="none"; var searchResults = new SearchResults("searchResults"); searchResults.Search(); --></script> </div> </body> </html>
{ "pile_set_name": "Github" }
/* * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.reactive.result.view.script; import org.springframework.web.reactive.result.view.UrlBasedViewResolver; /** * Convenience subclass of {@link UrlBasedViewResolver} that supports * {@link ScriptTemplateView} and custom subclasses of it. * * <p>The view class for all views created by this resolver can be specified * via the {@link #setViewClass(Class)} property. * * <p><b>Note:</b> When chaining ViewResolvers this resolver will check for the * existence of the specified template resources and only return a non-null * View object if a template is actually found. * * @author Sebastien Deleuze * @since 5.0 * @see ScriptTemplateConfigurer */ public class ScriptTemplateViewResolver extends UrlBasedViewResolver { /** * Sets the default {@link #setViewClass view class} to {@link #requiredViewClass}: * by default {@link ScriptTemplateView}. */ public ScriptTemplateViewResolver() { setViewClass(requiredViewClass()); } /** * A convenience constructor that allows for specifying {@link #setPrefix prefix} * and {@link #setSuffix suffix} as constructor arguments. * @param prefix the prefix that gets prepended to view names when building a URL * @param suffix the suffix that gets appended to view names when building a URL */ public ScriptTemplateViewResolver(String prefix, String suffix) { this(); setPrefix(prefix); setSuffix(suffix); } @Override protected Class<?> requiredViewClass() { return ScriptTemplateView.class; } }
{ "pile_set_name": "Github" }
--- id: version-v1.2.0-quick-start title: Quick Start original_id: quick-start --- There are three ways to get started running Liftbridge on your machine: [downloading a pre-built binary](#binary), [building from source](#building-from-source), or [running a Docker container](#docker-container). There are also several options for running a Liftbridge cluster [described below](#running-a-liftbridge-cluster-locally). ## Binary A pre-built Liftbridge binary can be downloaded for a specific platform from the [releases](https://github.com/liftbridge-io/liftbridge/releases) page. Once you have installed the binary, refer to the steps under [Building From Source](#building-from-source) for running the server. ## Building From Source A Liftbridge binary can be built and installed from source using [Go](https://golang.org/doc/install). Follow the below step to install from source. ```shell $ go get github.com/liftbridge-io/liftbridge ``` *Liftbridge uses [Go modules](https://github.com/golang/go/wiki/Modules), so ensure this is enabled, e.g. `export GO111MODULE=on`.* Liftbridge currently relies on an externally running [NATS server](https://github.com/nats-io/gnatsd). By default, it will connect to a NATS server running on localhost. The `--nats-servers` flag allows configuring the NATS server(s) to connect to. Also note that Liftbridge is clustered by default and relies on Raft for coordination. This means a cluster of three or more servers is normally run for high availability, and Raft manages electing a leader. A single server is actually a cluster of size 1. For safety purposes, the server cannot elect itself as leader without using the `--raft-bootstrap-seed` flag, which will indicate to the server to elect itself as leader. This will start a single server that can begin handling requests. **Use this flag with caution as it should only be set on one server when bootstrapping a cluster.** ```shell $ liftbridge --raft-bootstrap-seed INFO[2020-04-27 17:20:21] Liftbridge Version: v1.2.0 INFO[2020-04-27 17:20:21] Server ID: agTv5PkzvgKygm688EMd4C INFO[2020-04-27 17:20:21] Namespace: liftbridge-default INFO[2020-04-27 17:20:21] Retention Policy: [Age: 1 week, Compact: false] INFO[2020-04-27 17:20:21] Starting server on 0.0.0.0:9292... INFO[2020-04-27 17:20:23] Server became metadata leader, performing leader promotion actions ``` Once a leader has been elected, other servers will automatically join the cluster. We set the `--data-dir` and `--port` flags to avoid clobbering the first server. ```shell $ liftbridge --data-dir /tmp/liftbridge/server-2 --port=9293 INFO[2020-04-27 17:21:10] Liftbridge Version: v1.2.0 INFO[2020-04-27 17:21:10] Server ID: OtKIIhwxBztcSkgZD0xXQP INFO[2020-04-27 17:21:10] Namespace: liftbridge-default INFO[2020-04-27 17:21:10] Retention Policy: [Age: 1 week, Compact: false] INFO[2020-04-27 17:21:10] Starting server on 0.0.0.0:9293... ``` We can also bootstrap a cluster by providing the explicit cluster configuration. To do this, we provide the IDs of the participating peers in the cluster using the `--raft-bootstrap-peers` flag. Raft will then handle electing a leader. ```shell $ liftbridge --raft-bootstrap-peers server-2,server-3 ``` ## Docker Container Instead of running a binary, you can run Liftbridge using a container. There is a [container image](https://hub.docker.com/r/liftbridge/standalone-dev) available which runs an instance of Liftbridge and NATS inside a single Docker container. This is meant for development and testing purposes. Use the following Docker commands to run this container: ```shell $ docker pull liftbridge/standalone-dev $ docker run -d --name=liftbridge-main -p 4222:4222 -p 9292:9292 -p 8222:8222 -p 6222:6222 liftbridge/standalone-dev ``` This will run the container which will start both the NATS and Liftbridge servers. To check the logs to see if the container started properly, run: ```shell $ docker logs liftbridge-main ``` See the [deployment guide](./deployment.md) for more information. ## Running a Liftbridge Cluster Locally The quickest way to get a multi-node Liftbridge cluster up and running on your machine is with either [Docker Compose](https://docs.docker.com/compose) or [Kind](https://kind.sigs.k8s.io) (Kubernetes in Docker). Follow the [deployment guide](./deployment.md) for help running a cluster locally for development or testing.
{ "pile_set_name": "Github" }
@extends ('backend.layouts.app') @section ('title', trans('labels.backend.access.users.management') . ' | ' . trans('labels.backend.access.users.deleted')) @section('page-header') <h1> {{ trans('labels.backend.access.users.management') }} <small>{{ trans('labels.backend.access.users.deleted') }}</small> </h1> @endsection @section('content') <div class="box box-info"> <div class="box-header with-border"> <h3 class="box-title">{{ trans('labels.backend.access.users.deleted') }}</h3> <div class="box-tools pull-right"> @include('backend.access.includes.partials.user-header-buttons') </div><!--box-tools pull-right--> </div><!-- /.box-header --> <div class="box-body"> <div class="table-responsive data-table-wrapper"> <table id="users-table" class="table table-condensed table-hover table-bordered"> <thead> <tr> <th>{{ trans('labels.backend.access.users.table.first_name') }}</th> <th>{{ trans('labels.backend.access.users.table.last_name') }}</th> <th>{{ trans('labels.backend.access.users.table.email') }}</th> <th>{{ trans('labels.backend.access.users.table.confirmed') }}</th> <th>{{ trans('labels.backend.access.users.table.roles') }}</th> <th>{{ trans('labels.backend.access.users.table.created') }}</th> <th>{{ trans('labels.backend.access.users.table.last_updated') }}</th> <th>{{ trans('labels.general.actions') }}</th> </tr> </thead> <thead class="transparent-bg"> <tr> <th> {!! Form::text('first_name', null, ["class" => "search-input-text form-control", "data-column" => 0, "placeholder" => trans('labels.backend.access.users.table.first_name')]) !!} <a class="reset-data" href="javascript:void(0)"><i class="fa fa-times"></i></a> </th> <th> {!! Form::text('last_name', null, ["class" => "search-input-text form-control", "data-column" => 1, "placeholder" => trans('labels.backend.access.users.table.last_name')]) !!} <a class="reset-data" href="javascript:void(0)"><i class="fa fa-times"></i></a> </th> <th> {!! Form::text('email', null, ["class" => "search-input-text form-control", "data-column" => 2, "placeholder" => trans('labels.backend.access.users.table.email')]) !!} <a class="reset-data" href="javascript:void(0)"><i class="fa fa-times"></i></a> </th> <th></th> <th> {!! Form::text('roles', null, ["class" => "search-input-text form-control", "data-column" => 4, "placeholder" => trans('labels.backend.access.users.table.roles')]) !!} <a class="reset-data" href="javascript:void(0)"><i class="fa fa-times"></i></a> </th> <th></th> <th></th> <th></th> </tr> </thead> </table> </div><!--table-responsive--> </div><!-- /.box-body --> </div><!--box--> @endsection @section('after-scripts') {{-- For DataTables --}} {{ Html::script(mix('js/dataTable.js')) }} <script> (function () { $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); var dataTable = $('#users-table').dataTable({ processing: true, serverSide: true, ajax: { url: '{{ route("admin.access.user.get") }}', type: 'post', data: {status: false, trashed: true} }, columns: [ {data: 'first_name', name: '{{config('access.users_table')}}.first_name'}, {data: 'last_name', name: '{{config('access.users_table')}}.last_name'}, {data: 'email', name: '{{config('access.users_table')}}.email'}, {data: 'confirmed', name: '{{config('access.users_table')}}.confirmed'}, {data: 'roles', name: '{{config('access.roles_table')}}.name', sortable: false}, {data: 'created_at', name: '{{config('access.users_table')}}.created_at'}, {data: 'updated_at', name: '{{config('access.users_table')}}.updated_at'}, {data: 'actions', name: 'actions', searchable: false, sortable: false} ], order: [[0, "asc"]], searchDelay: 500, dom: 'lBfrtip', buttons: { buttons: [ { extend: 'copy', className: 'copyButton', exportOptions: {columns: [ 0, 1, 2, 3, 4, 5, 6 ] }}, { extend: 'csv', className: 'csvButton', exportOptions: {columns: [ 0, 1, 2, 3, 4, 5, 6 ] }}, { extend: 'excel', className: 'excelButton', exportOptions: {columns: [ 0, 1, 2, 3, 4, 5, 6 ] }}, { extend: 'pdf', className: 'pdfButton', exportOptions: {columns: [ 0, 1, 2, 3, 4, 5, 6 ] }}, { extend: 'print', className: 'printButton', exportOptions: {columns: [ 0, 1, 2, 3, 4, 5, 6 ] }} ] } }); Backend.DataTableSearch.init(dataTable); Backend.UserDeleted.selectors.Areyousure = "{{ trans('strings.backend.general.are_you_sure') }}"; Backend.UserDeleted.selectors.delete_user_confirm = "{{ trans('strings.backend.access.users.delete_user_confirm') }}"; Backend.UserDeleted.selectors.continue = "{{ trans('strings.backend.general.continue') }}"; Backend.UserDeleted.selectors.cancel ="{{ trans('buttons.general.cancel') }}"; Backend.UserDeleted.selectors.restore_user_confirm ="{{ trans('strings.backend.access.users.restore_user_confirm') }}"; })(); window.onload = function(){ Backend.UserDeleted.windowloadhandler(); } </script> @endsection
{ "pile_set_name": "Github" }
package rfc3961 import ( "bytes" "gopkg.in/jcmturner/gokrb5.v7/crypto/etype" ) const ( prfconstant = "prf" ) // DeriveRandom implements the RFC 3961 defined function: DR(Key, Constant) = k-truncate(E(Key, Constant, initial-cipher-state)). // // key: base key or protocol key. Likely to be a key from a keytab file. // // usage: a constant. // // n: block size in bits (not bytes) - note if you use something like aes.BlockSize this is in bytes. // // k: key length / key seed length in bits. Eg. for AES256 this value is 256. // // e: the encryption etype function to use. func DeriveRandom(key, usage []byte, e etype.EType) ([]byte, error) { n := e.GetCypherBlockBitLength() k := e.GetKeySeedBitLength() //Ensure the usage constant is at least the size of the cypher block size. Pass it through the nfold algorithm that will "stretch" it if needs be. nFoldUsage := Nfold(usage, n) //k-truncate implemented by creating a byte array the size of k (k is in bits hence /8) out := make([]byte, k/8) /*If the output of E is shorter than k bits, it is fed back into the encryption as many times as necessary. The construct is as follows (where | indicates concatenation): K1 = E(Key, n-fold(Constant), initial-cipher-state) K2 = E(Key, K1, initial-cipher-state) K3 = E(Key, K2, initial-cipher-state) K4 = ... DR(Key, Constant) = k-truncate(K1 | K2 | K3 | K4 ...)*/ _, K, err := e.EncryptData(key, nFoldUsage) if err != nil { return out, err } for i := copy(out, K); i < len(out); { _, K, _ = e.EncryptData(key, K) i = i + copy(out[i:], K) } return out, nil } // DeriveKey derives a key from the protocol key based on the usage and the etype's specific methods. func DeriveKey(protocolKey, usage []byte, e etype.EType) ([]byte, error) { r, err := e.DeriveRandom(protocolKey, usage) if err != nil { return nil, err } return e.RandomToKey(r), nil } // RandomToKey returns a key from the bytes provided according to the definition in RFC 3961. func RandomToKey(b []byte) []byte { return b } // DES3RandomToKey returns a key from the bytes provided according to the definition in RFC 3961 for DES3 etypes. func DES3RandomToKey(b []byte) []byte { r := fixWeakKey(stretch56Bits(b[:7])) r2 := fixWeakKey(stretch56Bits(b[7:14])) r = append(r, r2...) r3 := fixWeakKey(stretch56Bits(b[14:21])) r = append(r, r3...) return r } // DES3StringToKey returns a key derived from the string provided according to the definition in RFC 3961 for DES3 etypes. func DES3StringToKey(secret, salt string, e etype.EType) ([]byte, error) { s := secret + salt tkey := e.RandomToKey(Nfold([]byte(s), e.GetKeySeedBitLength())) return e.DeriveKey(tkey, []byte("kerberos")) } // PseudoRandom function as defined in RFC 3961 func PseudoRandom(key, b []byte, e etype.EType) ([]byte, error) { h := e.GetHashFunc()() h.Write(b) tmp := h.Sum(nil)[:e.GetMessageBlockByteSize()] k, err := e.DeriveKey(key, []byte(prfconstant)) if err != nil { return []byte{}, err } _, prf, err := e.EncryptData(k, tmp) if err != nil { return []byte{}, err } return prf, nil } func stretch56Bits(b []byte) []byte { d := make([]byte, len(b), len(b)) copy(d, b) var lb byte for i, v := range d { bv, nb := calcEvenParity(v) d[i] = nb if bv != 0 { lb = lb | (1 << uint(i+1)) } else { lb = lb &^ (1 << uint(i+1)) } } _, lb = calcEvenParity(lb) d = append(d, lb) return d } func calcEvenParity(b byte) (uint8, uint8) { lowestbit := b & 0x01 // c counter of 1s in the first 7 bits of the byte var c int // Iterate over the highest 7 bits (hence p starts at 1 not zero) and count the 1s. for p := 1; p < 8; p++ { v := b & (1 << uint(p)) if v != 0 { c++ } } if c%2 == 0 { //Even number of 1s so set parity to 1 b = b | 1 } else { //Odd number of 1s so set parity to 0 b = b &^ 1 } return lowestbit, b } func fixWeakKey(b []byte) []byte { if weak(b) { b[7] ^= 0xF0 } return b } func weak(b []byte) bool { // weak keys from https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-67r1.pdf weakKeys := [4][]byte{ {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, {0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE}, {0xE0, 0xE0, 0xE0, 0xE0, 0xF1, 0xF1, 0xF1, 0xF1}, {0x1F, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x0E}, } semiWeakKeys := [12][]byte{ {0x01, 0x1F, 0x01, 0x1F, 0x01, 0x0E, 0x01, 0x0E}, {0x1F, 0x01, 0x1F, 0x01, 0x0E, 0x01, 0x0E, 0x01}, {0x01, 0xE0, 0x01, 0xE0, 0x01, 0xF1, 0x01, 0xF1}, {0xE0, 0x01, 0xE0, 0x01, 0xF1, 0x01, 0xF1, 0x01}, {0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE}, {0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01, 0xFE, 0x01}, {0x1F, 0xE0, 0x1F, 0xE0, 0x0E, 0xF1, 0x0E, 0xF1}, {0xE0, 0x1F, 0xE0, 0x1F, 0xF1, 0x0E, 0xF1, 0x0E}, {0x1F, 0xFE, 0x1F, 0xFE, 0x0E, 0xFE, 0x0E, 0xFE}, {0xFE, 0x1F, 0xFE, 0x1F, 0xFE, 0x0E, 0xFE, 0x0E}, {0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1, 0xFE}, {0xFE, 0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1}, } for _, k := range weakKeys { if bytes.Equal(b, k) { return true } } for _, k := range semiWeakKeys { if bytes.Equal(b, k) { return true } } return false }
{ "pile_set_name": "Github" }
/* Class = "IBUITextField"; accessibilityLabel = "Username"; ObjectID = "12"; */ "12.accessibilityLabel" = "Username"; /* Class = "IBUITextField"; placeholder = "username"; ObjectID = "12"; */ "12.placeholder" = "username"; /* Class = "IBUIButton"; accessibilityHint = "Press to activate account"; ObjectID = "55"; */ "55.accessibilityHint" = "Press to activate account"; /* Class = "IBUIButton"; accessibilityLabel = "Activate"; ObjectID = "55"; */ "55.accessibilityLabel" = "Activate"; /* Class = "IBUIButton"; normalTitle = "ACTIVATE"; ObjectID = "55"; */ "55.normalTitle" = "ACTIVATE"; /* Class = "IBUILabel"; text = "Username"; ObjectID = "75"; */ "75.text" = "Username"; /* Class = "IBUITextField"; accessibilityLabel = "Password"; ObjectID = "88"; */ "88.accessibilityLabel" = "Password"; /* Class = "IBUITextField"; placeholder = "password"; ObjectID = "88"; */ "88.placeholder" = "password"; /* Class = "IBUILabel"; text = "Password"; ObjectID = "89"; */ "89.text" = "Password"; /* Class = "IBUITextField"; accessibilityLabel = "Device name"; ObjectID = "133"; */ "133.accessibilityLabel" = "Device name"; /* Class = "IBUITextField"; text = "device"; ObjectID = "133"; */ "133.text" = "device"; /* Class = "IBUILabel"; text = "Device"; ObjectID = "134"; */ "134.text" = "Device"; /* Class = "IBUIButton"; normalTitle = "Network Name Here"; ObjectID = "ATR-aK-KHt"; */ "ATR-aK-KHt.normalTitle" = "Network Name Here"; /* Class = "IBUILabel"; text = "Network"; ObjectID = "HVb-U2-VfT"; */ "HVb-U2-VfT.text" = "Network";
{ "pile_set_name": "Github" }
/* * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #ifndef SHARE_VM_JFR_PERIODIC_SAMPLING_JFRTHREADSAMPLER_HPP #define SHARE_VM_JFR_PERIODIC_SAMPLING_JFRTHREADSAMPLER_HPP #include "jfr/utilities/jfrAllocation.hpp" class JavaThread; class JfrStackFrame; class JfrThreadSampler; class Thread; class JfrThreadSampling : public JfrCHeapObj { friend class JfrRecorder; private: JfrThreadSampler* _sampler; void start_sampler(size_t interval_java, size_t interval_native); void set_sampling_interval(bool java_interval, size_t period); JfrThreadSampling(); ~JfrThreadSampling(); static JfrThreadSampling& instance(); static JfrThreadSampling* create(); static void destroy(); public: static void set_java_sample_interval(size_t period); static void set_native_sample_interval(size_t period); static void on_javathread_suspend(JavaThread* thread); static Thread* sampler_thread(); }; #endif // SHARE_VM_JFR_PERIODIC_SAMPLING_JFRTHREADSAMPLER_HPP
{ "pile_set_name": "Github" }
// Package pagespeedonline provides access to the PageSpeed Insights API. // // See https://developers.google.com/speed/docs/insights/v1/getting_started // // Usage example: // // import "google.golang.org/api/pagespeedonline/v1" // ... // pagespeedonlineService, err := pagespeedonline.New(oauthHttpClient) package pagespeedonline // import "google.golang.org/api/pagespeedonline/v1" import ( "bytes" "encoding/json" "errors" "fmt" context "golang.org/x/net/context" ctxhttp "golang.org/x/net/context/ctxhttp" gensupport "google.golang.org/api/gensupport" googleapi "google.golang.org/api/googleapi" "io" "net/http" "net/url" "strconv" "strings" ) // Always reference these packages, just in case the auto-generated code // below doesn't. var _ = bytes.NewBuffer var _ = strconv.Itoa var _ = fmt.Sprintf var _ = json.NewDecoder var _ = io.Copy var _ = url.Parse var _ = gensupport.MarshalJSON var _ = googleapi.Version var _ = errors.New var _ = strings.Replace var _ = context.Canceled var _ = ctxhttp.Do const apiId = "pagespeedonline:v1" const apiName = "pagespeedonline" const apiVersion = "v1" const basePath = "https://www.googleapis.com/pagespeedonline/v1/" func New(client *http.Client) (*Service, error) { if client == nil { return nil, errors.New("client is nil") } s := &Service{client: client, BasePath: basePath} s.Pagespeedapi = NewPagespeedapiService(s) return s, nil } type Service struct { client *http.Client BasePath string // API endpoint base URL UserAgent string // optional additional User-Agent fragment Pagespeedapi *PagespeedapiService } func (s *Service) userAgent() string { if s.UserAgent == "" { return googleapi.UserAgent } return googleapi.UserAgent + " " + s.UserAgent } func NewPagespeedapiService(s *Service) *PagespeedapiService { rs := &PagespeedapiService{s: s} return rs } type PagespeedapiService struct { s *Service } type Result struct { // CaptchaResult: The captcha verify result CaptchaResult string `json:"captchaResult,omitempty"` // FormattedResults: Localized PageSpeed results. Contains a ruleResults // entry for each PageSpeed rule instantiated and run by the server. FormattedResults *ResultFormattedResults `json:"formattedResults,omitempty"` // Id: Canonicalized and final URL for the document, after following // page redirects (if any). Id string `json:"id,omitempty"` // InvalidRules: List of rules that were specified in the request, but // which the server did not know how to instantiate. InvalidRules []string `json:"invalidRules,omitempty"` // Kind: Kind of result. Kind string `json:"kind,omitempty"` // PageStats: Summary statistics for the page, such as number of // JavaScript bytes, number of HTML bytes, etc. PageStats *ResultPageStats `json:"pageStats,omitempty"` // ResponseCode: Response code for the document. 200 indicates a normal // page load. 4xx/5xx indicates an error. ResponseCode int64 `json:"responseCode,omitempty"` // Score: The PageSpeed Score (0-100), which indicates how much faster a // page could be. A high score indicates little room for improvement, // while a lower score indicates more room for improvement. Score int64 `json:"score,omitempty"` // Screenshot: Base64-encoded screenshot of the page that was analyzed. Screenshot *ResultScreenshot `json:"screenshot,omitempty"` // Title: Title of the page, as displayed in the browser's title bar. Title string `json:"title,omitempty"` // Version: The version of PageSpeed used to generate these results. Version *ResultVersion `json:"version,omitempty"` // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "CaptchaResult") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CaptchaResult") to include // in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. However, any field with // an empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *Result) MarshalJSON() ([]byte, error) { type NoMethod Result raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ResultFormattedResults: Localized PageSpeed results. Contains a // ruleResults entry for each PageSpeed rule instantiated and run by the // server. type ResultFormattedResults struct { // Locale: The locale of the formattedResults, e.g. "en_US". Locale string `json:"locale,omitempty"` // RuleResults: Dictionary of formatted rule results, with one entry for // each PageSpeed rule instantiated and run by the server. RuleResults map[string]ResultFormattedResultsRuleResults `json:"ruleResults,omitempty"` // ForceSendFields is a list of field names (e.g. "Locale") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Locale") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultFormattedResults) MarshalJSON() ([]byte, error) { type NoMethod ResultFormattedResults raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ResultFormattedResultsRuleResults: The enum-like identifier for this // rule. For instance "EnableKeepAlive" or "AvoidCssImport". Not // localized. type ResultFormattedResultsRuleResults struct { // LocalizedRuleName: Localized name of the rule, intended for // presentation to a user. LocalizedRuleName string `json:"localizedRuleName,omitempty"` // RuleImpact: The impact (unbounded floating point value) that // implementing the suggestions for this rule would have on making the // page faster. Impact is comparable between rules to determine which // rule's suggestions would have a higher or lower impact on making a // page faster. For instance, if enabling compression would save 1MB, // while optimizing images would save 500kB, the enable compression rule // would have 2x the impact of the image optimization rule, all other // things being equal. RuleImpact float64 `json:"ruleImpact,omitempty"` // UrlBlocks: List of blocks of URLs. Each block may contain a heading // and a list of URLs. Each URL may optionally include additional // details. UrlBlocks []*ResultFormattedResultsRuleResultsUrlBlocks `json:"urlBlocks,omitempty"` // ForceSendFields is a list of field names (e.g. "LocalizedRuleName") // to unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "LocalizedRuleName") to // include in API requests with the JSON null value. By default, fields // with empty values are omitted from API requests. However, any field // with an empty value appearing in NullFields will be sent to the // server as null. It is an error if a field in this list has a // non-empty value. This may be used to include null fields in Patch // requests. NullFields []string `json:"-"` } func (s *ResultFormattedResultsRuleResults) MarshalJSON() ([]byte, error) { type NoMethod ResultFormattedResultsRuleResults raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } func (s *ResultFormattedResultsRuleResults) UnmarshalJSON(data []byte) error { type NoMethod ResultFormattedResultsRuleResults var s1 struct { RuleImpact gensupport.JSONFloat64 `json:"ruleImpact"` *NoMethod } s1.NoMethod = (*NoMethod)(s) if err := json.Unmarshal(data, &s1); err != nil { return err } s.RuleImpact = float64(s1.RuleImpact) return nil } type ResultFormattedResultsRuleResultsUrlBlocks struct { // Header: Heading to be displayed with the list of URLs. Header *ResultFormattedResultsRuleResultsUrlBlocksHeader `json:"header,omitempty"` // Urls: List of entries that provide information about URLs in the url // block. Optional. Urls []*ResultFormattedResultsRuleResultsUrlBlocksUrls `json:"urls,omitempty"` // ForceSendFields is a list of field names (e.g. "Header") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Header") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultFormattedResultsRuleResultsUrlBlocks) MarshalJSON() ([]byte, error) { type NoMethod ResultFormattedResultsRuleResultsUrlBlocks raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ResultFormattedResultsRuleResultsUrlBlocksHeader: Heading to be // displayed with the list of URLs. type ResultFormattedResultsRuleResultsUrlBlocksHeader struct { // Args: List of arguments for the format string. Args []*ResultFormattedResultsRuleResultsUrlBlocksHeaderArgs `json:"args,omitempty"` // Format: A localized format string with $N placeholders, where N is // the 1-indexed argument number, e.g. 'Minifying the following $1 // resources would save a total of $2 bytes'. Format string `json:"format,omitempty"` // ForceSendFields is a list of field names (e.g. "Args") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Args") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultFormattedResultsRuleResultsUrlBlocksHeader) MarshalJSON() ([]byte, error) { type NoMethod ResultFormattedResultsRuleResultsUrlBlocksHeader raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } type ResultFormattedResultsRuleResultsUrlBlocksHeaderArgs struct { // Type: Type of argument. One of URL, STRING_LITERAL, INT_LITERAL, // BYTES, or DURATION. Type string `json:"type,omitempty"` // Value: Argument value, as a localized string. Value string `json:"value,omitempty"` // ForceSendFields is a list of field names (e.g. "Type") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Type") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultFormattedResultsRuleResultsUrlBlocksHeaderArgs) MarshalJSON() ([]byte, error) { type NoMethod ResultFormattedResultsRuleResultsUrlBlocksHeaderArgs raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } type ResultFormattedResultsRuleResultsUrlBlocksUrls struct { // Details: List of entries that provide additional details about a // single URL. Optional. Details []*ResultFormattedResultsRuleResultsUrlBlocksUrlsDetails `json:"details,omitempty"` // Result: A format string that gives information about the URL, and a // list of arguments for that format string. Result *ResultFormattedResultsRuleResultsUrlBlocksUrlsResult `json:"result,omitempty"` // ForceSendFields is a list of field names (e.g. "Details") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Details") to include in // API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultFormattedResultsRuleResultsUrlBlocksUrls) MarshalJSON() ([]byte, error) { type NoMethod ResultFormattedResultsRuleResultsUrlBlocksUrls raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } type ResultFormattedResultsRuleResultsUrlBlocksUrlsDetails struct { // Args: List of arguments for the format string. Args []*ResultFormattedResultsRuleResultsUrlBlocksUrlsDetailsArgs `json:"args,omitempty"` // Format: A localized format string with $N placeholders, where N is // the 1-indexed argument number, e.g. 'Unnecessary metadata for this // resource adds an additional $1 bytes to its download size'. Format string `json:"format,omitempty"` // ForceSendFields is a list of field names (e.g. "Args") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Args") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultFormattedResultsRuleResultsUrlBlocksUrlsDetails) MarshalJSON() ([]byte, error) { type NoMethod ResultFormattedResultsRuleResultsUrlBlocksUrlsDetails raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } type ResultFormattedResultsRuleResultsUrlBlocksUrlsDetailsArgs struct { // Type: Type of argument. One of URL, STRING_LITERAL, INT_LITERAL, // BYTES, or DURATION. Type string `json:"type,omitempty"` // Value: Argument value, as a localized string. Value string `json:"value,omitempty"` // ForceSendFields is a list of field names (e.g. "Type") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Type") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultFormattedResultsRuleResultsUrlBlocksUrlsDetailsArgs) MarshalJSON() ([]byte, error) { type NoMethod ResultFormattedResultsRuleResultsUrlBlocksUrlsDetailsArgs raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ResultFormattedResultsRuleResultsUrlBlocksUrlsResult: A format string // that gives information about the URL, and a list of arguments for // that format string. type ResultFormattedResultsRuleResultsUrlBlocksUrlsResult struct { // Args: List of arguments for the format string. Args []*ResultFormattedResultsRuleResultsUrlBlocksUrlsResultArgs `json:"args,omitempty"` // Format: A localized format string with $N placeholders, where N is // the 1-indexed argument number, e.g. 'Minifying the resource at URL $1 // can save $2 bytes'. Format string `json:"format,omitempty"` // ForceSendFields is a list of field names (e.g. "Args") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Args") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultFormattedResultsRuleResultsUrlBlocksUrlsResult) MarshalJSON() ([]byte, error) { type NoMethod ResultFormattedResultsRuleResultsUrlBlocksUrlsResult raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } type ResultFormattedResultsRuleResultsUrlBlocksUrlsResultArgs struct { // Type: Type of argument. One of URL, STRING_LITERAL, INT_LITERAL, // BYTES, or DURATION. Type string `json:"type,omitempty"` // Value: Argument value, as a localized string. Value string `json:"value,omitempty"` // ForceSendFields is a list of field names (e.g. "Type") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Type") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultFormattedResultsRuleResultsUrlBlocksUrlsResultArgs) MarshalJSON() ([]byte, error) { type NoMethod ResultFormattedResultsRuleResultsUrlBlocksUrlsResultArgs raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ResultPageStats: Summary statistics for the page, such as number of // JavaScript bytes, number of HTML bytes, etc. type ResultPageStats struct { // CssResponseBytes: Number of uncompressed response bytes for CSS // resources on the page. CssResponseBytes int64 `json:"cssResponseBytes,omitempty,string"` // FlashResponseBytes: Number of response bytes for flash resources on // the page. FlashResponseBytes int64 `json:"flashResponseBytes,omitempty,string"` // HtmlResponseBytes: Number of uncompressed response bytes for the main // HTML document and all iframes on the page. HtmlResponseBytes int64 `json:"htmlResponseBytes,omitempty,string"` // ImageResponseBytes: Number of response bytes for image resources on // the page. ImageResponseBytes int64 `json:"imageResponseBytes,omitempty,string"` // JavascriptResponseBytes: Number of uncompressed response bytes for JS // resources on the page. JavascriptResponseBytes int64 `json:"javascriptResponseBytes,omitempty,string"` // NumberCssResources: Number of CSS resources referenced by the page. NumberCssResources int64 `json:"numberCssResources,omitempty"` // NumberHosts: Number of unique hosts referenced by the page. NumberHosts int64 `json:"numberHosts,omitempty"` // NumberJsResources: Number of JavaScript resources referenced by the // page. NumberJsResources int64 `json:"numberJsResources,omitempty"` // NumberResources: Number of HTTP resources loaded by the page. NumberResources int64 `json:"numberResources,omitempty"` // NumberStaticResources: Number of static (i.e. cacheable) resources on // the page. NumberStaticResources int64 `json:"numberStaticResources,omitempty"` // OtherResponseBytes: Number of response bytes for other resources on // the page. OtherResponseBytes int64 `json:"otherResponseBytes,omitempty,string"` // TextResponseBytes: Number of uncompressed response bytes for text // resources not covered by other statistics (i.e non-HTML, non-script, // non-CSS resources) on the page. TextResponseBytes int64 `json:"textResponseBytes,omitempty,string"` // TotalRequestBytes: Total size of all request bytes sent by the page. TotalRequestBytes int64 `json:"totalRequestBytes,omitempty,string"` // ForceSendFields is a list of field names (e.g. "CssResponseBytes") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CssResponseBytes") to // include in API requests with the JSON null value. By default, fields // with empty values are omitted from API requests. However, any field // with an empty value appearing in NullFields will be sent to the // server as null. It is an error if a field in this list has a // non-empty value. This may be used to include null fields in Patch // requests. NullFields []string `json:"-"` } func (s *ResultPageStats) MarshalJSON() ([]byte, error) { type NoMethod ResultPageStats raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ResultScreenshot: Base64-encoded screenshot of the page that was // analyzed. type ResultScreenshot struct { // Data: Image data base64 encoded. Data string `json:"data,omitempty"` // Height: Height of screenshot in pixels. Height int64 `json:"height,omitempty"` // MimeType: Mime type of image data. E.g. "image/jpeg". MimeType string `json:"mime_type,omitempty"` // Width: Width of screenshot in pixels. Width int64 `json:"width,omitempty"` // ForceSendFields is a list of field names (e.g. "Data") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Data") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultScreenshot) MarshalJSON() ([]byte, error) { type NoMethod ResultScreenshot raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ResultVersion: The version of PageSpeed used to generate these // results. type ResultVersion struct { // Major: The major version number of PageSpeed used to generate these // results. Major int64 `json:"major,omitempty"` // Minor: The minor version number of PageSpeed used to generate these // results. Minor int64 `json:"minor,omitempty"` // ForceSendFields is a list of field names (e.g. "Major") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Major") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ResultVersion) MarshalJSON() ([]byte, error) { type NoMethod ResultVersion raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // method id "pagespeedonline.pagespeedapi.runpagespeed": type PagespeedapiRunpagespeedCall struct { s *Service urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // Runpagespeed: Runs PageSpeed analysis on the page at the specified // URL, and returns a PageSpeed score, a list of suggestions to make // that page faster, and other information. func (r *PagespeedapiService) Runpagespeed(url string) *PagespeedapiRunpagespeedCall { c := &PagespeedapiRunpagespeedCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.urlParams_.Set("url", url) return c } // FilterThirdPartyResources sets the optional parameter // "filter_third_party_resources": Indicates if third party resources // should be filtered out before PageSpeed analysis. func (c *PagespeedapiRunpagespeedCall) FilterThirdPartyResources(filterThirdPartyResources bool) *PagespeedapiRunpagespeedCall { c.urlParams_.Set("filter_third_party_resources", fmt.Sprint(filterThirdPartyResources)) return c } // Locale sets the optional parameter "locale": The locale used to // localize formatted results func (c *PagespeedapiRunpagespeedCall) Locale(locale string) *PagespeedapiRunpagespeedCall { c.urlParams_.Set("locale", locale) return c } // Rule sets the optional parameter "rule": A PageSpeed rule to run; if // none are given, all rules are run func (c *PagespeedapiRunpagespeedCall) Rule(rule ...string) *PagespeedapiRunpagespeedCall { c.urlParams_.SetMulti("rule", append([]string{}, rule...)) return c } // Screenshot sets the optional parameter "screenshot": Indicates if // binary data containing a screenshot should be included func (c *PagespeedapiRunpagespeedCall) Screenshot(screenshot bool) *PagespeedapiRunpagespeedCall { c.urlParams_.Set("screenshot", fmt.Sprint(screenshot)) return c } // Strategy sets the optional parameter "strategy": The analysis // strategy to use // // Possible values: // "desktop" - Fetch and analyze the URL for desktop browsers // "mobile" - Fetch and analyze the URL for mobile devices func (c *PagespeedapiRunpagespeedCall) Strategy(strategy string) *PagespeedapiRunpagespeedCall { c.urlParams_.Set("strategy", strategy) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *PagespeedapiRunpagespeedCall) Fields(s ...googleapi.Field) *PagespeedapiRunpagespeedCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *PagespeedapiRunpagespeedCall) IfNoneMatch(entityTag string) *PagespeedapiRunpagespeedCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *PagespeedapiRunpagespeedCall) Context(ctx context.Context) *PagespeedapiRunpagespeedCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *PagespeedapiRunpagespeedCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *PagespeedapiRunpagespeedCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "runPagespeed") urls += "?" + c.urlParams_.Encode() req, _ := http.NewRequest("GET", urls, body) req.Header = reqHeaders return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "pagespeedonline.pagespeedapi.runpagespeed" call. // Exactly one of *Result or error will be non-nil. Any non-2xx status // code is an error. Response headers are in either // *Result.ServerResponse.Header or (if a response was returned at all) // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to // check whether the returned error was because http.StatusNotModified // was returned. func (c *PagespeedapiRunpagespeedCall) Do(opts ...googleapi.CallOption) (*Result, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &Result{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "description": "Runs PageSpeed analysis on the page at the specified URL, and returns a PageSpeed score, a list of suggestions to make that page faster, and other information.", // "httpMethod": "GET", // "id": "pagespeedonline.pagespeedapi.runpagespeed", // "parameterOrder": [ // "url" // ], // "parameters": { // "filter_third_party_resources": { // "default": "false", // "description": "Indicates if third party resources should be filtered out before PageSpeed analysis.", // "location": "query", // "type": "boolean" // }, // "locale": { // "description": "The locale used to localize formatted results", // "location": "query", // "pattern": "[a-zA-Z]+(_[a-zA-Z]+)?", // "type": "string" // }, // "rule": { // "description": "A PageSpeed rule to run; if none are given, all rules are run", // "location": "query", // "pattern": "[a-zA-Z]+", // "repeated": true, // "type": "string" // }, // "screenshot": { // "default": "false", // "description": "Indicates if binary data containing a screenshot should be included", // "location": "query", // "type": "boolean" // }, // "strategy": { // "description": "The analysis strategy to use", // "enum": [ // "desktop", // "mobile" // ], // "enumDescriptions": [ // "Fetch and analyze the URL for desktop browsers", // "Fetch and analyze the URL for mobile devices" // ], // "location": "query", // "type": "string" // }, // "url": { // "description": "The URL to fetch and analyze", // "location": "query", // "pattern": "(?i)http(s)?://.*", // "required": true, // "type": "string" // } // }, // "path": "runPagespeed", // "response": { // "$ref": "Result" // } // } }
{ "pile_set_name": "Github" }
train_net: "models/pascal_voc/ResNet-101/rfcn_alt_opt_5step_ohem/stage1_rpn_train.pt" base_lr: 0.001 lr_policy: "step" gamma: 0.1 stepsize: 60000 display: 20 average_loss: 100 momentum: 0.9 weight_decay: 0.0005 # We disable standard caffe solver snapshotting and implement our own snapshot # function snapshot: 0 # We still use the snapshot prefix, though snapshot_prefix: "resnet101_rpn"
{ "pile_set_name": "Github" }
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { LoadBalancersComponent } from './load-balancers.component'; describe('LoadBalancersComponent', () => { let component: LoadBalancersComponent; let fixture: ComponentFixture<LoadBalancersComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ schemas: [NO_ERRORS_SCHEMA], declarations: [ LoadBalancersComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(LoadBalancersComponent); component = fixture.componentInstance; fixture.detectChanges(); }); xit('should be created', () => { expect(component).toBeTruthy(); }); });
{ "pile_set_name": "Github" }
"" INDEX__SECTION INDEX_SECTION houdini.hdalibrary houdini.hdalibrary labs_8_8Sop_1lot__subdivision labs::Sop/lot_subdivision
{ "pile_set_name": "Github" }
-----BEGIN CERTIFICATE----- MIICvjCCAaigAwIBAgIUMUZEIRRo2v0demTGW3vuRccAgCMwCwYJKoZIhvcNAQEL MBUxEzARBgNVBAMMCmV4cGlyZWQtY2EwIhgPMjAxNDExMjcwMDAwMDBaGA8yMDE3 MDIwNDAwMDAwMFowHTEbMBkGA1UEAwwSZWUtZnJvbS1leHBpcmVkLWNhMIIBIjAN BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuohRqESOFtZB/W62iAY2ED08E9nq 5DVKtOz1aFdsJHvBxyWo4NgfvbGcBptuGobya+KvWnVramRxCHqlWqdFh/cc1SSc An7NQ/weadA4ICmTqyDDSeTbuUzCa2wO7RWCD/F+rWkasdMCOosqQe6ncOAPDY39 ZgsrsCSSpH25iGF5kLFXkD3SO8XguEgfqDfTiEPvJxbYVbdmWqp+ApAvOnsQgAYk zBxsl62WYVu34pYSwHUxowyR3bTK9/ytHSXTCe+5Fw6naOGzey8ib2njtIqVYR3u JtYlnauRCE42yxwkBCy/Fosv5fGPmRcxuLP+SSP6clHEMdUDrNoYCjXtjQIDAQAB MAsGCSqGSIb3DQEBCwOCAQEABbpfCUwzbTCDWWwBqaY8+3q3PjeQK/QdyI4HSX5C +dp7LJF+x/24xArqKf8HTuhndprUvlJOFkojK1CLaece7yC1fh/viFZ6NLoTPNXU cmdEHsrzO4LTOY/eeR9ml7Rx26B50Wva01SyXkW9TZbPGPQysCgD31XkxmzTAG9t M5kp+XplMd/UEjkNQaXD0lzm3lJ+3n2U6xMmDc+8us0l6X8yBmjjywBWTSX+U83a eZXMpU40Y4ZHyNqfALGZUG22trd+68YVvK7jmnbk9fu/FZkjh0qiPlAUJXg0OybW YHerQxXuf+5+ftPTDkzyPY9txQGFoqY8k3zVQNw33wFzGQ== -----END CERTIFICATE-----
{ "pile_set_name": "Github" }
DD-NOARG(1) - General Commands Manual # NAME **Dd-noarg** - date macro without an argument # DESCRIPTION some text OpenBSD -
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Scheduled Synth Unit Tests</title> <link rel="stylesheet" media="screen" href="../../../node_modules/infusion/tests/lib/qunit/css/qunit.css" /> <script src="../../../node_modules/jquery/dist/jquery.js"></script> <script src="../../../dist/infusion-for-flocking.js"></script> <script src="../../../src/core.js"></script> <script src="../../../src/node-list.js"></script> <script src="../../../src/evaluators.js"></script> <script src="../../../src/synths/synth.js"></script> <script src="../../../src/synths/value.js"></script> <script src="../../../src/synths/frame-rate.js"></script> <script src="../../../src/synths/model.js"></script> <script src="../../../src/synths/group.js"></script> <script src="../../../src/synths/polyphonic.js"></script> <script src="../../../src/synths/band.js"></script> <script src="../../../src/audiofile.js"></script> <script src="../../../src/scheduler.js"></script> <script src="../../../src/web/webaudio-core.js"></script> <script src="../../../src/web/audio-system.js"></script> <script src="../../../src/web/buffer-writer.js"></script> <script src="../../../src/web/input-device-manager.js"></script> <script src="../../../src/web/native-node-manager.js"></script> <script src="../../../src/web/output-manager.js"></script> <script src="../../../src/buffers.js"></script> <script src="../../../src/parser.js"></script> <script src="../../../src/ugens/core.js"></script> <script src="../../../src/ugens/oscillators.js"></script> <script src="../../../node_modules/infusion/tests/lib/qunit/js/qunit.js"></script> <script src="../../../node_modules/infusion/tests/test-core/jqUnit/js/jqUnit.js"></script> <script src="../../../node_modules/infusion/tests/test-core/utils/js/IoCTestUtils.js"></script> <script src="../../../src/testing.js"></script> <script src="../js/flocking-test-utils.js"></script> <script src="../js/synth-scheduled-tests.js"></script> </head> <body id="body"> <h1 id="qunit-header">Scheduled Synth Unit Tests</h1> <h2 id="qunit-banner"></h2> <div id="qunit-testrunner-toolbar"></div> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol> <!-- Test HTML --> <div id="main" style="display: none;"> </div> </body> </html>
{ "pile_set_name": "Github" }
// // System.ObjectDisposedException.cs // // Authors: // Paolo Molaro ([email protected]) // Duncan Mak ([email protected]) // // (C) 2001 Ximian, Inc. http://www.ximian.com // // // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System.Runtime.Serialization; using System.Runtime.InteropServices; namespace System { [Serializable] [ComVisible (true)] public class ObjectDisposedException : InvalidOperationException { // Does not override the HResult from InvalidOperationException private string obj_name; private string msg; // Constructors public ObjectDisposedException (string objectName) : base (Locale.GetText ("The object was used after being disposed.")) { obj_name = objectName; msg = Locale.GetText ("The object was used after being disposed."); } public ObjectDisposedException (string objectName, string message) : base (message) { obj_name = objectName; msg = message; } public ObjectDisposedException (string message, Exception innerException) : base(message, innerException) { } protected ObjectDisposedException (SerializationInfo info, StreamingContext context) : base (info, context) { obj_name = info.GetString ("ObjectName"); } // Properties public override string Message { get { return msg; } } public string ObjectName { get { return obj_name; } } public override void GetObjectData (SerializationInfo info, StreamingContext context) { base.GetObjectData (info, context); info.AddValue ("ObjectName", obj_name); } } }
{ "pile_set_name": "Github" }
/* * Written by J.T. Conklin <[email protected]>. * Changes for long double by Ulrich Drepper <[email protected]>. * Adopted for x86-64 by Andreas Jaeger <[email protected]>. * Public domain. */ #include <libm-alias-ldouble.h> #include <machine/asm.h> RCSID("$NetBSD: $") ENTRY(__copysignl) movl 32(%rsp),%edx movl 16(%rsp),%eax andl $0x8000,%edx andl $0x7fff,%eax orl %edx,%eax movl %eax,16(%rsp) fldt 8(%rsp) ret END (__copysignl) libm_alias_ldouble (__copysign, copysign)
{ "pile_set_name": "Github" }
/* * Hibernate Tools, Tooling for your Hibernate Projects * * Copyright 2004-2020 Red Hat, Inc. * * Licensed under the GNU Lesser General Public License (LGPL), * version 2.1 or later (the "License"). * You may not use this file except in compliance with the License. * You may read the licence in the 'lgpl.txt' file in the root folder of * project or obtain a copy at * * http://www.gnu.org/licenses/lgpl-2.1.html * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.hibernate.tool.hbm2x.OtherCfg2HbmTest; import java.io.File; import java.util.List; import java.util.Properties; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.XPath; import org.dom4j.io.SAXReader; import org.hibernate.boot.Metadata; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.AvailableSettings; import org.hibernate.tool.api.export.Exporter; import org.hibernate.tool.api.export.ExporterConstants; import org.hibernate.tool.api.metadata.MetadataDescriptor; import org.hibernate.tool.api.metadata.MetadataDescriptorFactory; import org.hibernate.tool.internal.export.hbm.HbmExporter; import org.hibernate.tools.test.util.FileUtil; import org.hibernate.tools.test.util.HibernateUtil; import org.hibernate.tools.test.util.JUnitUtil; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; /** * @author max * @author koen */ public class TestCase { private static final String[] HBM_XML_FILES = new String[] { "Customer.hbm.xml", "Order.hbm.xml", "LineItem.hbm.xml", "Product.hbm.xml", "HelloWorld.hbm.xml" }; @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); private File outputDir = null; private File resourcesDir = null; @Before public void setUp() throws Exception { outputDir = new File(temporaryFolder.getRoot(), "output"); outputDir.mkdir(); resourcesDir = new File(temporaryFolder.getRoot(), "resources"); resourcesDir.mkdir(); MetadataDescriptor metadataDescriptor = HibernateUtil .initializeMetadataDescriptor(this, HBM_XML_FILES, resourcesDir); Exporter hbmexporter = new HbmExporter(); hbmexporter.getProperties().put(ExporterConstants.METADATA_DESCRIPTOR, metadataDescriptor); hbmexporter.getProperties().put(ExporterConstants.DESTINATION_FOLDER, outputDir); hbmexporter.start(); } @Test public void testFileExistence() { JUnitUtil.assertIsNonEmptyFile(new File(outputDir, "org/hibernate/tool/hbm2x/Customer.hbm.xml") ); JUnitUtil.assertIsNonEmptyFile(new File(outputDir, "org/hibernate/tool/hbm2x/LineItem.hbm.xml") ); JUnitUtil.assertIsNonEmptyFile(new File(outputDir, "org/hibernate/tool/hbm2x/Order.hbm.xml") ); JUnitUtil.assertIsNonEmptyFile(new File(outputDir, "org/hibernate/tool/hbm2x/Product.hbm.xml") ); JUnitUtil.assertIsNonEmptyFile(new File(outputDir, "HelloWorld.hbm.xml") ); JUnitUtil.assertIsNonEmptyFile(new File(outputDir, "HelloUniverse.hbm.xml") ); } @Test public void testReadable() { StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder(); ssrb.applySetting(AvailableSettings.DIALECT, HibernateUtil.Dialect.class.getName()); Properties properties = new Properties(); properties.put(AvailableSettings.DIALECT, HibernateUtil.Dialect.class.getName()); File[] hbmFiles = new File[4]; hbmFiles[0] = new File(outputDir, "org/hibernate/tool/hbm2x/Customer.hbm.xml"); hbmFiles[1] = new File(outputDir, "org/hibernate/tool/hbm2x/LineItem.hbm.xml"); hbmFiles[2] = new File(outputDir, "org/hibernate/tool/hbm2x/Order.hbm.xml"); hbmFiles[3] = new File(outputDir, "org/hibernate/tool/hbm2x/Product.hbm.xml"); Metadata metadata = MetadataDescriptorFactory .createNativeDescriptor(null, hbmFiles, properties) .createMetadata(); Assert.assertNotNull(metadata); } @Test public void testNoVelocityLeftOvers() { Assert.assertEquals(null, FileUtil.findFirstString("$",new File(outputDir, "org/hibernate/tool/hbm2x/Customer.hbm.xml") ) ); Assert.assertEquals(null, FileUtil.findFirstString("$",new File(outputDir, "org/hibernate/tool/hbm2x/LineItem.hbm.xml") ) ); Assert.assertEquals(null, FileUtil.findFirstString("$",new File(outputDir, "org/hibernate/tool/hbm2x/Order.hbm.xml") ) ); Assert.assertEquals(null, FileUtil.findFirstString("$",new File(outputDir, "org/hibernate/tool/hbm2x/Product.hbm.xml") ) ); } @Test public void testVersioning() throws DocumentException { SAXReader xmlReader = new SAXReader(); xmlReader.setValidation(true); Document document = xmlReader.read(new File(outputDir, "org/hibernate/tool/hbm2x/Product.hbm.xml")); XPath xpath = DocumentHelper.createXPath("//hibernate-mapping/class/version"); List<?> list = xpath.selectNodes(document); Assert.assertEquals("Expected to get one version element", 1, list.size()); } }
{ "pile_set_name": "Github" }
t7187.scala:16: error: _ must follow method; cannot follow () => String val t1f: Any = foo() _ // error: _ must follow method ^ t7187.scala:19: error: type mismatch; found : String required: () => Any val t2a: () => Any = bar // error: no eta-expansion of zero-arglist-methods (nullary methods) ^ t7187.scala:20: error: not enough arguments for method apply: (i: Int): Char in class StringOps. Unspecified value parameter i. val t2b: () => Any = bar() // error: bar doesn't take arguments, so expanded to bar.apply(), which misses an argument ^ t7187.scala:23: error: not enough arguments for method apply: (i: Int): Char in class StringOps. Unspecified value parameter i. val t2e: Any = bar() _ // error: not enough arguments for method apply ^ t7187.scala:29: error: _ must follow method; cannot follow String val t3d: Any = baz() _ // error: _ must follow method ^ t7187.scala:38: error: missing argument list for method zup in class EtaExpandZeroArg Unapplied methods are only converted to functions when a function type is expected. You can make this conversion explicit by writing `zup _` or `zup(_)` instead of `zup`. val t5a = zup // error in 2.13, eta-expansion in 3.0 ^ t7187.scala:12: warning: An unapplied 0-arity method was eta-expanded (due to the expected type () => Any), rather than applied to `()`. Write foo() to invoke method foo, or change the expected type. val t1b: () => Any = foo // eta-expansion, but lint warning ^ t7187.scala:13: warning: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method foo, or remove the empty argument list from its definition (Java-defined methods are exempt). In Scala 3, an unapplied method like this will be eta-expanded into a function. val t1c: () => Any = { val t = foo; t } // `()`-insertion because no expected type ^ t7187.scala:21: warning: Methods without a parameter list and by-name params can no longer be converted to functions as `m _`, write a function literal `() => m` instead val t2c: () => Any = bar _ // warning: eta-expanding a nullary method ^ t7187.scala:22: warning: Methods without a parameter list and by-name params can no longer be converted to functions as `m _`, write a function literal `() => m` instead val t2d: Any = bar _ // warning: eta-expanding a nullary method ^ t7187.scala:26: warning: An unapplied 0-arity method was eta-expanded (due to the expected type () => Any), rather than applied to `()`. Write baz() to invoke method baz, or change the expected type. val t3a: () => Any = baz // eta-expansion, but lint warning ^ t7187.scala:32: warning: An unapplied 0-arity method was eta-expanded (due to the expected type () => Any), rather than applied to `()`. Write zap() to invoke method zap, or change the expected type. val t4a: () => Any = zap // eta-expansion, but lint warning ^ t7187.scala:33: warning: An unapplied 0-arity method was eta-expanded (due to the expected type () => Any), rather than applied to `()`. Write zap()() to invoke method zap, or change the expected type. val t4b: () => Any = zap() // ditto ^ t7187.scala:40: warning: Eta-expansion performed to meet expected type AcciSamOne, which is SAM-equivalent to Int => Int, even though trait AcciSamOne is not annotated with `@FunctionalInterface`; to suppress warning, add the annotation or write out the equivalent function literal. val t5AcciSam: AcciSamOne = zup // ok, but warning ^ 8 warnings 6 errors
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject Name="SampleApp" Version="9.00" ProjectType="Visual C++" ProjectGUID="{C3F12C11-469F-3FB6-8C95-8638F78FF7C0}" RootNamespace="SampleApp" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <ToolFiles/> <Configurations> <Configuration Name="debug_shared|Win32" OutputDirectory="obj\$(ConfigurationName)" IntermediateDirectory="obj\$(ConfigurationName)" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;" StringPooling="true" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" BufferSecurityCheck="true" TreatWChar_tAsBuiltInType="true" ForceConformanceInForLoopScope="true" RuntimeTypeInfo="true" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" DebugInformationFormat="3" CompileAs="0" DisableSpecificWarnings="" AdditionalOptions=""/> <Tool Name="VCManagedResourceCompilerTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="ws2_32.lib iphlpapi.lib" OutputFile="bin\SampleAppd.exe" LinkIncremental="2" AdditionalLibraryDirectories="..\..\..\lib" SuppressStartupBanner="true" GenerateDebugInformation="true" ProgramDatabaseFile="bin\SampleAppd.pdb" SubSystem="1" TargetMachine="1" AdditionalOptions=""/> <Tool Name="VCALinkTool"/> <Tool Name="VCManifestTool"/> <Tool Name="VCXDCMakeTool"/> <Tool Name="VCBscMakeTool"/> <Tool Name="VCFxCopTool"/> <Tool Name="VCAppVerifierTool"/> <Tool Name="VCPostBuildEventTool"/> </Configuration> <Configuration Name="release_shared|Win32" OutputDirectory="obj\$(ConfigurationName)" IntermediateDirectory="obj\$(ConfigurationName)" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCCLCompilerTool" Optimization="4" InlineFunctionExpansion="1" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" OmitFramePointers="true" AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;" StringPooling="true" RuntimeLibrary="2" BufferSecurityCheck="false" TreatWChar_tAsBuiltInType="true" ForceConformanceInForLoopScope="true" RuntimeTypeInfo="true" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" DebugInformationFormat="0" CompileAs="0" DisableSpecificWarnings="" AdditionalOptions=""/> <Tool Name="VCManagedResourceCompilerTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="ws2_32.lib iphlpapi.lib" OutputFile="bin\SampleApp.exe" LinkIncremental="1" AdditionalLibraryDirectories="..\..\..\lib" GenerateDebugInformation="false" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1" AdditionalOptions=""/> <Tool Name="VCALinkTool"/> <Tool Name="VCManifestTool"/> <Tool Name="VCXDCMakeTool"/> <Tool Name="VCBscMakeTool"/> <Tool Name="VCFxCopTool"/> <Tool Name="VCAppVerifierTool"/> <Tool Name="VCPostBuildEventTool"/> </Configuration> <Configuration Name="debug_static_mt|Win32" OutputDirectory="obj\$(ConfigurationName)" IntermediateDirectory="obj\$(ConfigurationName)" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCCLCompilerTool" Optimization="4" AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;" StringPooling="true" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" BufferSecurityCheck="true" TreatWChar_tAsBuiltInType="true" ForceConformanceInForLoopScope="true" RuntimeTypeInfo="true" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" DebugInformationFormat="3" CompileAs="0" DisableSpecificWarnings="" AdditionalOptions=""/> <Tool Name="VCManagedResourceCompilerTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="iphlpapi.lib winmm.lib ws2_32.lib iphlpapi.lib" OutputFile="bin\static_mt\SampleAppd.exe" LinkIncremental="2" AdditionalLibraryDirectories="..\..\..\lib" SuppressStartupBanner="true" GenerateDebugInformation="true" ProgramDatabaseFile="bin\static_mt\SampleAppd.pdb" SubSystem="1" TargetMachine="1" AdditionalOptions=""/> <Tool Name="VCALinkTool"/> <Tool Name="VCManifestTool"/> <Tool Name="VCXDCMakeTool"/> <Tool Name="VCBscMakeTool"/> <Tool Name="VCFxCopTool"/> <Tool Name="VCAppVerifierTool"/> <Tool Name="VCPostBuildEventTool"/> </Configuration> <Configuration Name="release_static_mt|Win32" OutputDirectory="obj\$(ConfigurationName)" IntermediateDirectory="obj\$(ConfigurationName)" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCCLCompilerTool" Optimization="4" InlineFunctionExpansion="1" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" OmitFramePointers="true" AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;" StringPooling="true" RuntimeLibrary="0" BufferSecurityCheck="false" TreatWChar_tAsBuiltInType="true" ForceConformanceInForLoopScope="true" RuntimeTypeInfo="true" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" DebugInformationFormat="0" CompileAs="0" DisableSpecificWarnings="" AdditionalOptions=""/> <Tool Name="VCManagedResourceCompilerTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="iphlpapi.lib winmm.lib ws2_32.lib iphlpapi.lib" OutputFile="bin\static_mt\SampleApp.exe" LinkIncremental="1" AdditionalLibraryDirectories="..\..\..\lib" GenerateDebugInformation="false" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1" AdditionalOptions=""/> <Tool Name="VCALinkTool"/> <Tool Name="VCManifestTool"/> <Tool Name="VCXDCMakeTool"/> <Tool Name="VCBscMakeTool"/> <Tool Name="VCFxCopTool"/> <Tool Name="VCAppVerifierTool"/> <Tool Name="VCPostBuildEventTool"/> </Configuration> <Configuration Name="debug_static_md|Win32" OutputDirectory="obj\$(ConfigurationName)" IntermediateDirectory="obj\$(ConfigurationName)" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCCLCompilerTool" Optimization="4" AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;" StringPooling="true" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" BufferSecurityCheck="true" TreatWChar_tAsBuiltInType="true" ForceConformanceInForLoopScope="true" RuntimeTypeInfo="true" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" DebugInformationFormat="3" CompileAs="0" DisableSpecificWarnings="" AdditionalOptions=""/> <Tool Name="VCManagedResourceCompilerTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="iphlpapi.lib winmm.lib ws2_32.lib iphlpapi.lib" OutputFile="bin\static_md\SampleAppd.exe" LinkIncremental="2" AdditionalLibraryDirectories="..\..\..\lib" SuppressStartupBanner="true" GenerateDebugInformation="true" ProgramDatabaseFile="bin\static_md\SampleAppd.pdb" SubSystem="1" TargetMachine="1" AdditionalOptions=""/> <Tool Name="VCALinkTool"/> <Tool Name="VCManifestTool"/> <Tool Name="VCXDCMakeTool"/> <Tool Name="VCBscMakeTool"/> <Tool Name="VCFxCopTool"/> <Tool Name="VCAppVerifierTool"/> <Tool Name="VCPostBuildEventTool"/> </Configuration> <Configuration Name="release_static_md|Win32" OutputDirectory="obj\$(ConfigurationName)" IntermediateDirectory="obj\$(ConfigurationName)" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCCLCompilerTool" Optimization="4" InlineFunctionExpansion="1" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" OmitFramePointers="true" AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;" StringPooling="true" RuntimeLibrary="2" BufferSecurityCheck="false" TreatWChar_tAsBuiltInType="true" ForceConformanceInForLoopScope="true" RuntimeTypeInfo="true" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" DebugInformationFormat="0" CompileAs="0" DisableSpecificWarnings="" AdditionalOptions=""/> <Tool Name="VCManagedResourceCompilerTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="iphlpapi.lib winmm.lib ws2_32.lib iphlpapi.lib" OutputFile="bin\static_md\SampleApp.exe" LinkIncremental="1" AdditionalLibraryDirectories="..\..\..\lib" GenerateDebugInformation="false" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1" AdditionalOptions=""/> <Tool Name="VCALinkTool"/> <Tool Name="VCManifestTool"/> <Tool Name="VCXDCMakeTool"/> <Tool Name="VCBscMakeTool"/> <Tool Name="VCFxCopTool"/> <Tool Name="VCAppVerifierTool"/> <Tool Name="VCPostBuildEventTool"/> </Configuration> </Configurations> <References/> <Files> <Filter Name="Configuration Files"> <File RelativePath=".\SampleApp.properties"/> </Filter> <Filter Name="Source Files"> <File RelativePath=".\src\SampleApp.cpp"/> </Filter> </Files> <Globals/> </VisualStudioProject>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- /* ** Copyright 2016, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You my obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ --> <!-- These resources are around just to allow their values to be customized for different hardware and product builds. --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="wfcOperatorErrorAlertMessages"> <item msgid="1972026366984640493">"To make calls and send messages over Wi-Fi, first ask your operator to set up this service. Then turn on Wi-Fi calling again from Settings."</item> </string-array> <string-array name="wfcOperatorErrorNotificationMessages"> <item msgid="1383416528714661108">"Register with your operator"</item> </string-array> <string name="wfcSpnFormat" msgid="7770475174975527040">"%s Wi-Fi Calling"</string> </resources>
{ "pile_set_name": "Github" }
Ignorante del nuevo aliado de sus contrarios, deciden avanzar y atacar con todos sus ejércitos la fortaleza en donde está el Pegaso. Confiados en que existe una ventaja de 3 a 1, se saborean la victoria, pero al llegar a las murallas de la fortaleza...
{ "pile_set_name": "Github" }
<?php use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { // $this->call(UsersTableSeeder::class); } }
{ "pile_set_name": "Github" }
/********************************************************************* * * Description: Driver for the SMC Infrared Communications Controller * Author: Daniele Peri ([email protected]) * Created at: * Modified at: * Modified by: * * Copyright (c) 2002 Daniele Peri * All Rights Reserved. * Copyright (c) 2002 Jean Tourrilhes * Copyright (c) 2006 Linus Walleij * * * Based on smc-ircc.c: * * Copyright (c) 2001 Stefani Seibold * Copyright (c) 1999-2001 Dag Brattli * Copyright (c) 1998-1999 Thomas Davis, * * and irport.c: * * Copyright (c) 1997, 1998, 1999-2000 Dag Brattli, All Rights Reserved. * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. * ********************************************************************/ #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/skbuff.h> #include <linux/netdevice.h> #include <linux/ioport.h> #include <linux/delay.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/rtnetlink.h> #include <linux/serial_reg.h> #include <linux/dma-mapping.h> #include <linux/pnp.h> #include <linux/platform_device.h> #include <linux/gfp.h> #include <asm/io.h> #include <asm/dma.h> #include <asm/byteorder.h> #include <linux/spinlock.h> #include <linux/pm.h> #ifdef CONFIG_PCI #include <linux/pci.h> #endif #include <net/irda/wrapper.h> #include <net/irda/irda.h> #include <net/irda/irda_device.h> #include "smsc-ircc2.h" #include "smsc-sio.h" MODULE_AUTHOR("Daniele Peri <[email protected]>"); MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver"); MODULE_LICENSE("GPL"); static bool smsc_nopnp = true; module_param_named(nopnp, smsc_nopnp, bool, 0); MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings, defaults to true"); #define DMA_INVAL 255 static int ircc_dma = DMA_INVAL; module_param(ircc_dma, int, 0); MODULE_PARM_DESC(ircc_dma, "DMA channel"); #define IRQ_INVAL 255 static int ircc_irq = IRQ_INVAL; module_param(ircc_irq, int, 0); MODULE_PARM_DESC(ircc_irq, "IRQ line"); static int ircc_fir; module_param(ircc_fir, int, 0); MODULE_PARM_DESC(ircc_fir, "FIR Base Address"); static int ircc_sir; module_param(ircc_sir, int, 0); MODULE_PARM_DESC(ircc_sir, "SIR Base Address"); static int ircc_cfg; module_param(ircc_cfg, int, 0); MODULE_PARM_DESC(ircc_cfg, "Configuration register base address"); static int ircc_transceiver; module_param(ircc_transceiver, int, 0); MODULE_PARM_DESC(ircc_transceiver, "Transceiver type"); /* Types */ #ifdef CONFIG_PCI struct smsc_ircc_subsystem_configuration { unsigned short vendor; /* PCI vendor ID */ unsigned short device; /* PCI vendor ID */ unsigned short subvendor; /* PCI subsystem vendor ID */ unsigned short subdevice; /* PCI subsystem device ID */ unsigned short sir_io; /* I/O port for SIR */ unsigned short fir_io; /* I/O port for FIR */ unsigned char fir_irq; /* FIR IRQ */ unsigned char fir_dma; /* FIR DMA */ unsigned short cfg_base; /* I/O port for chip configuration */ int (*preconfigure)(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); /* Preconfig function */ const char *name; /* name shown as info */ }; #endif struct smsc_transceiver { char *name; void (*set_for_speed)(int fir_base, u32 speed); int (*probe)(int fir_base); }; struct smsc_chip { char *name; #if 0 u8 type; #endif u16 flags; u8 devid; u8 rev; }; struct smsc_chip_address { unsigned int cfg_base; unsigned int type; }; /* Private data for each instance */ struct smsc_ircc_cb { struct net_device *netdev; /* Yes! we are some kind of netdevice */ struct irlap_cb *irlap; /* The link layer we are binded to */ chipio_t io; /* IrDA controller information */ iobuff_t tx_buff; /* Transmit buffer */ iobuff_t rx_buff; /* Receive buffer */ dma_addr_t tx_buff_dma; dma_addr_t rx_buff_dma; struct qos_info qos; /* QoS capabilities for this device */ spinlock_t lock; /* For serializing operations */ __u32 new_speed; __u32 flags; /* Interface flags */ int tx_buff_offsets[10]; /* Offsets between frames in tx_buff */ int tx_len; /* Number of frames in tx_buff */ int transceiver; struct platform_device *pldev; }; /* Constants */ #define SMSC_IRCC2_DRIVER_NAME "smsc-ircc2" #define SMSC_IRCC2_C_IRDA_FALLBACK_SPEED 9600 #define SMSC_IRCC2_C_DEFAULT_TRANSCEIVER 1 #define SMSC_IRCC2_C_NET_TIMEOUT 0 #define SMSC_IRCC2_C_SIR_STOP 0 static const char *driver_name = SMSC_IRCC2_DRIVER_NAME; /* Prototypes */ static int smsc_ircc_open(unsigned int firbase, unsigned int sirbase, u8 dma, u8 irq); static int smsc_ircc_present(unsigned int fir_base, unsigned int sir_base); static void smsc_ircc_setup_io(struct smsc_ircc_cb *self, unsigned int fir_base, unsigned int sir_base, u8 dma, u8 irq); static void smsc_ircc_setup_qos(struct smsc_ircc_cb *self); static void smsc_ircc_init_chip(struct smsc_ircc_cb *self); static int __exit smsc_ircc_close(struct smsc_ircc_cb *self); static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self); static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self); static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self); static netdev_tx_t smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev); static netdev_tx_t smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev); static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int bofs); static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self); static void smsc_ircc_change_speed(struct smsc_ircc_cb *self, u32 speed); static void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, u32 speed); static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id); static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev); static void smsc_ircc_sir_start(struct smsc_ircc_cb *self); #if SMSC_IRCC2_C_SIR_STOP static void smsc_ircc_sir_stop(struct smsc_ircc_cb *self); #endif static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self); static int smsc_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len); static int smsc_ircc_net_open(struct net_device *dev); static int smsc_ircc_net_close(struct net_device *dev); static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); #if SMSC_IRCC2_C_NET_TIMEOUT static void smsc_ircc_timeout(struct net_device *dev); #endif static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self); static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self); static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 speed); static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self); /* Probing */ static int __init smsc_ircc_look_for_chips(void); static const struct smsc_chip * __init smsc_ircc_probe(unsigned short cfg_base, u8 reg, const struct smsc_chip *chip, char *type); static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned short cfg_base, char *type); static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned short cfg_base, char *type); static int __init smsc_superio_fdc(unsigned short cfg_base); static int __init smsc_superio_lpc(unsigned short cfg_base); #ifdef CONFIG_PCI static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf); static int __init preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); static void __init preconfigure_ali_port(struct pci_dev *dev, unsigned short port); static int __init preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, unsigned short ircc_fir, unsigned short ircc_sir, unsigned char ircc_dma, unsigned char ircc_irq); #endif /* Transceivers specific functions */ static void smsc_ircc_set_transceiver_toshiba_sat1800(int fir_base, u32 speed); static int smsc_ircc_probe_transceiver_toshiba_sat1800(int fir_base); static void smsc_ircc_set_transceiver_smsc_ircc_fast_pin_select(int fir_base, u32 speed); static int smsc_ircc_probe_transceiver_smsc_ircc_fast_pin_select(int fir_base); static void smsc_ircc_set_transceiver_smsc_ircc_atc(int fir_base, u32 speed); static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base); /* Power Management */ static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state); static int smsc_ircc_resume(struct platform_device *dev); static struct platform_driver smsc_ircc_driver = { .suspend = smsc_ircc_suspend, .resume = smsc_ircc_resume, .driver = { .name = SMSC_IRCC2_DRIVER_NAME, }, }; /* Transceivers for SMSC-ircc */ static struct smsc_transceiver smsc_transceivers[] = { { "Toshiba Satellite 1800 (GP data pin select)", smsc_ircc_set_transceiver_toshiba_sat1800, smsc_ircc_probe_transceiver_toshiba_sat1800 }, { "Fast pin select", smsc_ircc_set_transceiver_smsc_ircc_fast_pin_select, smsc_ircc_probe_transceiver_smsc_ircc_fast_pin_select }, { "ATC IRMode", smsc_ircc_set_transceiver_smsc_ircc_atc, smsc_ircc_probe_transceiver_smsc_ircc_atc }, { NULL, NULL } }; #define SMSC_IRCC2_C_NUMBER_OF_TRANSCEIVERS (ARRAY_SIZE(smsc_transceivers) - 1) /* SMC SuperIO chipsets definitions */ #define KEY55_1 0 /* SuperIO Configuration mode with Key <0x55> */ #define KEY55_2 1 /* SuperIO Configuration mode with Key <0x55,0x55> */ #define NoIRDA 2 /* SuperIO Chip has no IRDA Port */ #define SIR 0 /* SuperIO Chip has only slow IRDA */ #define FIR 4 /* SuperIO Chip has fast IRDA */ #define SERx4 8 /* SuperIO Chip supports 115,2 KBaud * 4=460,8 KBaud */ static struct smsc_chip __initdata fdc_chips_flat[] = { /* Base address 0x3f0 or 0x370 */ { "37C44", KEY55_1|NoIRDA, 0x00, 0x00 }, /* This chip cannot be detected */ { "37C665GT", KEY55_2|NoIRDA, 0x65, 0x01 }, { "37C665GT", KEY55_2|NoIRDA, 0x66, 0x01 }, { "37C669", KEY55_2|SIR|SERx4, 0x03, 0x02 }, { "37C669", KEY55_2|SIR|SERx4, 0x04, 0x02 }, /* ID? */ { "37C78", KEY55_2|NoIRDA, 0x78, 0x00 }, { "37N769", KEY55_1|FIR|SERx4, 0x28, 0x00 }, { "37N869", KEY55_1|FIR|SERx4, 0x29, 0x00 }, { NULL } }; static struct smsc_chip __initdata fdc_chips_paged[] = { /* Base address 0x3f0 or 0x370 */ { "37B72X", KEY55_1|SIR|SERx4, 0x4c, 0x00 }, { "37B77X", KEY55_1|SIR|SERx4, 0x43, 0x00 }, { "37B78X", KEY55_1|SIR|SERx4, 0x44, 0x00 }, { "37B80X", KEY55_1|SIR|SERx4, 0x42, 0x00 }, { "37C67X", KEY55_1|FIR|SERx4, 0x40, 0x00 }, { "37C93X", KEY55_2|SIR|SERx4, 0x02, 0x01 }, { "37C93XAPM", KEY55_1|SIR|SERx4, 0x30, 0x01 }, { "37C93XFR", KEY55_2|FIR|SERx4, 0x03, 0x01 }, { "37M707", KEY55_1|SIR|SERx4, 0x42, 0x00 }, { "37M81X", KEY55_1|SIR|SERx4, 0x4d, 0x00 }, { "37N958FR", KEY55_1|FIR|SERx4, 0x09, 0x04 }, { "37N971", KEY55_1|FIR|SERx4, 0x0a, 0x00 }, { "37N972", KEY55_1|FIR|SERx4, 0x0b, 0x00 }, { NULL } }; static struct smsc_chip __initdata lpc_chips_flat[] = { /* Base address 0x2E or 0x4E */ { "47N227", KEY55_1|FIR|SERx4, 0x5a, 0x00 }, { "47N227", KEY55_1|FIR|SERx4, 0x7a, 0x00 }, { "47N267", KEY55_1|FIR|SERx4, 0x5e, 0x00 }, { NULL } }; static struct smsc_chip __initdata lpc_chips_paged[] = { /* Base address 0x2E or 0x4E */ { "47B27X", KEY55_1|SIR|SERx4, 0x51, 0x00 }, { "47B37X", KEY55_1|SIR|SERx4, 0x52, 0x00 }, { "47M10X", KEY55_1|SIR|SERx4, 0x59, 0x00 }, { "47M120", KEY55_1|NoIRDA|SERx4, 0x5c, 0x00 }, { "47M13X", KEY55_1|SIR|SERx4, 0x59, 0x00 }, { "47M14X", KEY55_1|SIR|SERx4, 0x5f, 0x00 }, { "47N252", KEY55_1|FIR|SERx4, 0x0e, 0x00 }, { "47S42X", KEY55_1|SIR|SERx4, 0x57, 0x00 }, { NULL } }; #define SMSCSIO_TYPE_FDC 1 #define SMSCSIO_TYPE_LPC 2 #define SMSCSIO_TYPE_FLAT 4 #define SMSCSIO_TYPE_PAGED 8 static struct smsc_chip_address __initdata possible_addresses[] = { { 0x3f0, SMSCSIO_TYPE_FDC|SMSCSIO_TYPE_FLAT|SMSCSIO_TYPE_PAGED }, { 0x370, SMSCSIO_TYPE_FDC|SMSCSIO_TYPE_FLAT|SMSCSIO_TYPE_PAGED }, { 0xe0, SMSCSIO_TYPE_FDC|SMSCSIO_TYPE_FLAT|SMSCSIO_TYPE_PAGED }, { 0x2e, SMSCSIO_TYPE_LPC|SMSCSIO_TYPE_FLAT|SMSCSIO_TYPE_PAGED }, { 0x4e, SMSCSIO_TYPE_LPC|SMSCSIO_TYPE_FLAT|SMSCSIO_TYPE_PAGED }, { 0, 0 } }; /* Globals */ static struct smsc_ircc_cb *dev_self[] = { NULL, NULL }; static unsigned short dev_count; static inline void register_bank(int iobase, int bank) { outb(((inb(iobase + IRCC_MASTER) & 0xf0) | (bank & 0x07)), iobase + IRCC_MASTER); } /* PNP hotplug support */ static const struct pnp_device_id smsc_ircc_pnp_table[] = { { .id = "SMCf010", .driver_data = 0 }, /* and presumably others */ { } }; MODULE_DEVICE_TABLE(pnp, smsc_ircc_pnp_table); static int pnp_driver_registered; #ifdef CONFIG_PNP static int smsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) { unsigned int firbase, sirbase; u8 dma, irq; if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_dma_valid(dev, 0) && pnp_irq_valid(dev, 0))) return -EINVAL; sirbase = pnp_port_start(dev, 0); firbase = pnp_port_start(dev, 1); dma = pnp_dma(dev, 0); irq = pnp_irq(dev, 0); if (smsc_ircc_open(firbase, sirbase, dma, irq)) return -ENODEV; return 0; } static struct pnp_driver smsc_ircc_pnp_driver = { .name = "smsc-ircc2", .id_table = smsc_ircc_pnp_table, .probe = smsc_ircc_pnp_probe, }; #else /* CONFIG_PNP */ static struct pnp_driver smsc_ircc_pnp_driver; #endif /******************************************************************************* * * * SMSC-ircc stuff * * *******************************************************************************/ static int __init smsc_ircc_legacy_probe(void) { int ret = 0; #ifdef CONFIG_PCI if (smsc_ircc_preconfigure_subsystems(ircc_cfg, ircc_fir, ircc_sir, ircc_dma, ircc_irq) < 0) { /* Ignore errors from preconfiguration */ net_err_ratelimited("%s, Preconfiguration failed !\n", driver_name); } #endif if (ircc_fir > 0 && ircc_sir > 0) { net_info_ratelimited(" Overriding FIR address 0x%04x\n", ircc_fir); net_info_ratelimited(" Overriding SIR address 0x%04x\n", ircc_sir); if (smsc_ircc_open(ircc_fir, ircc_sir, ircc_dma, ircc_irq)) ret = -ENODEV; } else { ret = -ENODEV; /* try user provided configuration register base address */ if (ircc_cfg > 0) { net_info_ratelimited(" Overriding configuration address 0x%04x\n", ircc_cfg); if (!smsc_superio_fdc(ircc_cfg)) ret = 0; if (!smsc_superio_lpc(ircc_cfg)) ret = 0; } if (smsc_ircc_look_for_chips() > 0) ret = 0; } return ret; } /* * Function smsc_ircc_init () * * Initialize chip. Just try to find out how many chips we are dealing with * and where they are */ static int __init smsc_ircc_init(void) { int ret; pr_debug("%s\n", __func__); ret = platform_driver_register(&smsc_ircc_driver); if (ret) { net_err_ratelimited("%s, Can't register driver!\n", driver_name); return ret; } dev_count = 0; if (smsc_nopnp || !pnp_platform_devices || ircc_cfg || ircc_fir || ircc_sir || ircc_dma != DMA_INVAL || ircc_irq != IRQ_INVAL) { ret = smsc_ircc_legacy_probe(); } else { if (pnp_register_driver(&smsc_ircc_pnp_driver) == 0) pnp_driver_registered = 1; } if (ret) { if (pnp_driver_registered) pnp_unregister_driver(&smsc_ircc_pnp_driver); platform_driver_unregister(&smsc_ircc_driver); } return ret; } static netdev_tx_t smsc_ircc_net_xmit(struct sk_buff *skb, struct net_device *dev) { struct smsc_ircc_cb *self = netdev_priv(dev); if (self->io.speed > 115200) return smsc_ircc_hard_xmit_fir(skb, dev); else return smsc_ircc_hard_xmit_sir(skb, dev); } static const struct net_device_ops smsc_ircc_netdev_ops = { .ndo_open = smsc_ircc_net_open, .ndo_stop = smsc_ircc_net_close, .ndo_do_ioctl = smsc_ircc_net_ioctl, .ndo_start_xmit = smsc_ircc_net_xmit, #if SMSC_IRCC2_C_NET_TIMEOUT .ndo_tx_timeout = smsc_ircc_timeout, #endif }; /* * Function smsc_ircc_open (firbase, sirbase, dma, irq) * * Try to open driver instance * */ static int smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u8 dma, u8 irq) { struct smsc_ircc_cb *self; struct net_device *dev; int err; pr_debug("%s\n", __func__); err = smsc_ircc_present(fir_base, sir_base); if (err) goto err_out; err = -ENOMEM; if (dev_count >= ARRAY_SIZE(dev_self)) { net_warn_ratelimited("%s(), too many devices!\n", __func__); goto err_out1; } /* * Allocate new instance of the driver */ dev = alloc_irdadev(sizeof(struct smsc_ircc_cb)); if (!dev) { net_warn_ratelimited("%s() can't allocate net device\n", __func__); goto err_out1; } #if SMSC_IRCC2_C_NET_TIMEOUT dev->watchdog_timeo = HZ * 2; /* Allow enough time for speed change */ #endif dev->netdev_ops = &smsc_ircc_netdev_ops; self = netdev_priv(dev); self->netdev = dev; /* Make ifconfig display some details */ dev->base_addr = self->io.fir_base = fir_base; dev->irq = self->io.irq = irq; /* Need to store self somewhere */ dev_self[dev_count] = self; spin_lock_init(&self->lock); self->rx_buff.truesize = SMSC_IRCC2_RX_BUFF_TRUESIZE; self->tx_buff.truesize = SMSC_IRCC2_TX_BUFF_TRUESIZE; self->rx_buff.head = dma_zalloc_coherent(NULL, self->rx_buff.truesize, &self->rx_buff_dma, GFP_KERNEL); if (self->rx_buff.head == NULL) goto err_out2; self->tx_buff.head = dma_zalloc_coherent(NULL, self->tx_buff.truesize, &self->tx_buff_dma, GFP_KERNEL); if (self->tx_buff.head == NULL) goto err_out3; self->rx_buff.in_frame = FALSE; self->rx_buff.state = OUTSIDE_FRAME; self->tx_buff.data = self->tx_buff.head; self->rx_buff.data = self->rx_buff.head; smsc_ircc_setup_io(self, fir_base, sir_base, dma, irq); smsc_ircc_setup_qos(self); smsc_ircc_init_chip(self); if (ircc_transceiver > 0 && ircc_transceiver < SMSC_IRCC2_C_NUMBER_OF_TRANSCEIVERS) self->transceiver = ircc_transceiver; else smsc_ircc_probe_transceiver(self); err = register_netdev(self->netdev); if (err) { net_err_ratelimited("%s, Network device registration failed!\n", driver_name); goto err_out4; } self->pldev = platform_device_register_simple(SMSC_IRCC2_DRIVER_NAME, dev_count, NULL, 0); if (IS_ERR(self->pldev)) { err = PTR_ERR(self->pldev); goto err_out5; } platform_set_drvdata(self->pldev, self); net_info_ratelimited("IrDA: Registered device %s\n", dev->name); dev_count++; return 0; err_out5: unregister_netdev(self->netdev); err_out4: dma_free_coherent(NULL, self->tx_buff.truesize, self->tx_buff.head, self->tx_buff_dma); err_out3: dma_free_coherent(NULL, self->rx_buff.truesize, self->rx_buff.head, self->rx_buff_dma); err_out2: free_netdev(self->netdev); dev_self[dev_count] = NULL; err_out1: release_region(fir_base, SMSC_IRCC2_FIR_CHIP_IO_EXTENT); release_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT); err_out: return err; } /* * Function smsc_ircc_present(fir_base, sir_base) * * Check the smsc-ircc chip presence * */ static int smsc_ircc_present(unsigned int fir_base, unsigned int sir_base) { unsigned char low, high, chip, config, dma, irq, version; if (!request_region(fir_base, SMSC_IRCC2_FIR_CHIP_IO_EXTENT, driver_name)) { net_warn_ratelimited("%s: can't get fir_base of 0x%03x\n", __func__, fir_base); goto out1; } if (!request_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT, driver_name)) { net_warn_ratelimited("%s: can't get sir_base of 0x%03x\n", __func__, sir_base); goto out2; } register_bank(fir_base, 3); high = inb(fir_base + IRCC_ID_HIGH); low = inb(fir_base + IRCC_ID_LOW); chip = inb(fir_base + IRCC_CHIP_ID); version = inb(fir_base + IRCC_VERSION); config = inb(fir_base + IRCC_INTERFACE); dma = config & IRCC_INTERFACE_DMA_MASK; irq = (config & IRCC_INTERFACE_IRQ_MASK) >> 4; if (high != 0x10 || low != 0xb8 || (chip != 0xf1 && chip != 0xf2)) { net_warn_ratelimited("%s(), addr 0x%04x - no device found!\n", __func__, fir_base); goto out3; } net_info_ratelimited("SMsC IrDA Controller found\n IrCC version %d.%d, firport 0x%03x, sirport 0x%03x dma=%d, irq=%d\n", chip & 0x0f, version, fir_base, sir_base, dma, irq); return 0; out3: release_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT); out2: release_region(fir_base, SMSC_IRCC2_FIR_CHIP_IO_EXTENT); out1: return -ENODEV; } /* * Function smsc_ircc_setup_io(self, fir_base, sir_base, dma, irq) * * Setup I/O * */ static void smsc_ircc_setup_io(struct smsc_ircc_cb *self, unsigned int fir_base, unsigned int sir_base, u8 dma, u8 irq) { unsigned char config, chip_dma, chip_irq; register_bank(fir_base, 3); config = inb(fir_base + IRCC_INTERFACE); chip_dma = config & IRCC_INTERFACE_DMA_MASK; chip_irq = (config & IRCC_INTERFACE_IRQ_MASK) >> 4; self->io.fir_base = fir_base; self->io.sir_base = sir_base; self->io.fir_ext = SMSC_IRCC2_FIR_CHIP_IO_EXTENT; self->io.sir_ext = SMSC_IRCC2_SIR_CHIP_IO_EXTENT; self->io.fifo_size = SMSC_IRCC2_FIFO_SIZE; self->io.speed = SMSC_IRCC2_C_IRDA_FALLBACK_SPEED; if (irq != IRQ_INVAL) { if (irq != chip_irq) net_info_ratelimited("%s, Overriding IRQ - chip says %d, using %d\n", driver_name, chip_irq, irq); self->io.irq = irq; } else self->io.irq = chip_irq; if (dma != DMA_INVAL) { if (dma != chip_dma) net_info_ratelimited("%s, Overriding DMA - chip says %d, using %d\n", driver_name, chip_dma, dma); self->io.dma = dma; } else self->io.dma = chip_dma; } /* * Function smsc_ircc_setup_qos(self) * * Setup qos * */ static void smsc_ircc_setup_qos(struct smsc_ircc_cb *self) { /* Initialize QoS for this device */ irda_init_max_qos_capabilies(&self->qos); self->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600| IR_115200|IR_576000|IR_1152000|(IR_4000000 << 8); self->qos.min_turn_time.bits = SMSC_IRCC2_MIN_TURN_TIME; self->qos.window_size.bits = SMSC_IRCC2_WINDOW_SIZE; irda_qos_bits_to_value(&self->qos); } /* * Function smsc_ircc_init_chip(self) * * Init chip * */ static void smsc_ircc_init_chip(struct smsc_ircc_cb *self) { int iobase = self->io.fir_base; register_bank(iobase, 0); outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); outb(0x00, iobase + IRCC_MASTER); register_bank(iobase, 1); outb(((inb(iobase + IRCC_SCE_CFGA) & 0x87) | IRCC_CFGA_IRDA_SIR_A), iobase + IRCC_SCE_CFGA); #ifdef smsc_669 /* Uses pin 88/89 for Rx/Tx */ outb(((inb(iobase + IRCC_SCE_CFGB) & 0x3f) | IRCC_CFGB_MUX_COM), iobase + IRCC_SCE_CFGB); #else outb(((inb(iobase + IRCC_SCE_CFGB) & 0x3f) | IRCC_CFGB_MUX_IR), iobase + IRCC_SCE_CFGB); #endif (void) inb(iobase + IRCC_FIFO_THRESHOLD); outb(SMSC_IRCC2_FIFO_THRESHOLD, iobase + IRCC_FIFO_THRESHOLD); register_bank(iobase, 4); outb((inb(iobase + IRCC_CONTROL) & 0x30), iobase + IRCC_CONTROL); register_bank(iobase, 0); outb(0, iobase + IRCC_LCR_A); smsc_ircc_set_sir_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); /* Power on device */ outb(0x00, iobase + IRCC_MASTER); } /* * Function smsc_ircc_net_ioctl (dev, rq, cmd) * * Process IOCTL commands for this device * */ static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { struct if_irda_req *irq = (struct if_irda_req *) rq; struct smsc_ircc_cb *self; unsigned long flags; int ret = 0; IRDA_ASSERT(dev != NULL, return -1;); self = netdev_priv(dev); IRDA_ASSERT(self != NULL, return -1;); pr_debug("%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd); switch (cmd) { case SIOCSBANDWIDTH: /* Set bandwidth */ if (!capable(CAP_NET_ADMIN)) ret = -EPERM; else { /* Make sure we are the only one touching * self->io.speed and the hardware - Jean II */ spin_lock_irqsave(&self->lock, flags); smsc_ircc_change_speed(self, irq->ifr_baudrate); spin_unlock_irqrestore(&self->lock, flags); } break; case SIOCSMEDIABUSY: /* Set media busy */ if (!capable(CAP_NET_ADMIN)) { ret = -EPERM; break; } irda_device_set_media_busy(self->netdev, TRUE); break; case SIOCGRECEIVING: /* Check if we are receiving right now */ irq->ifr_receiving = smsc_ircc_is_receiving(self); break; #if 0 case SIOCSDTRRTS: if (!capable(CAP_NET_ADMIN)) { ret = -EPERM; break; } smsc_ircc_sir_set_dtr_rts(dev, irq->ifr_dtr, irq->ifr_rts); break; #endif default: ret = -EOPNOTSUPP; } return ret; } #if SMSC_IRCC2_C_NET_TIMEOUT /* * Function smsc_ircc_timeout (struct net_device *dev) * * The networking timeout management. * */ static void smsc_ircc_timeout(struct net_device *dev) { struct smsc_ircc_cb *self = netdev_priv(dev); unsigned long flags; net_warn_ratelimited("%s: transmit timed out, changing speed to: %d\n", dev->name, self->io.speed); spin_lock_irqsave(&self->lock, flags); smsc_ircc_sir_start(self); smsc_ircc_change_speed(self, self->io.speed); netif_trans_update(dev); /* prevent tx timeout */ netif_wake_queue(dev); spin_unlock_irqrestore(&self->lock, flags); } #endif /* * Function smsc_ircc_hard_xmit_sir (struct sk_buff *skb, struct net_device *dev) * * Transmits the current frame until FIFO is full, then * waits until the next transmit interrupt, and continues until the * frame is transmitted. */ static netdev_tx_t smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev) { struct smsc_ircc_cb *self; unsigned long flags; s32 speed; pr_debug("%s\n", __func__); IRDA_ASSERT(dev != NULL, return NETDEV_TX_OK;); self = netdev_priv(dev); IRDA_ASSERT(self != NULL, return NETDEV_TX_OK;); netif_stop_queue(dev); /* Make sure test of self->io.speed & speed change are atomic */ spin_lock_irqsave(&self->lock, flags); /* Check if we need to change the speed */ speed = irda_get_next_speed(skb); if (speed != self->io.speed && speed != -1) { /* Check for empty frame */ if (!skb->len) { /* * We send frames one by one in SIR mode (no * pipelining), so at this point, if we were sending * a previous frame, we just received the interrupt * telling us it is finished (UART_IIR_THRI). * Therefore, waiting for the transmitter to really * finish draining the fifo won't take too long. * And the interrupt handler is not expected to run. * - Jean II */ smsc_ircc_sir_wait_hw_transmitter_finish(self); smsc_ircc_change_speed(self, speed); spin_unlock_irqrestore(&self->lock, flags); dev_kfree_skb(skb); return NETDEV_TX_OK; } self->new_speed = speed; } /* Init tx buffer */ self->tx_buff.data = self->tx_buff.head; /* Copy skb to tx_buff while wrapping, stuffing and making CRC */ self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, self->tx_buff.truesize); dev->stats.tx_bytes += self->tx_buff.len; /* Turn on transmit finished interrupt. Will fire immediately! */ outb(UART_IER_THRI, self->io.sir_base + UART_IER); spin_unlock_irqrestore(&self->lock, flags); dev_kfree_skb(skb); return NETDEV_TX_OK; } /* * Function smsc_ircc_set_fir_speed (self, baud) * * Change the speed of the device * */ static void smsc_ircc_set_fir_speed(struct smsc_ircc_cb *self, u32 speed) { int fir_base, ir_mode, ctrl, fast; IRDA_ASSERT(self != NULL, return;); fir_base = self->io.fir_base; self->io.speed = speed; switch (speed) { default: case 576000: ir_mode = IRCC_CFGA_IRDA_HDLC; ctrl = IRCC_CRC; fast = 0; pr_debug("%s(), handling baud of 576000\n", __func__); break; case 1152000: ir_mode = IRCC_CFGA_IRDA_HDLC; ctrl = IRCC_1152 | IRCC_CRC; fast = IRCC_LCR_A_FAST | IRCC_LCR_A_GP_DATA; pr_debug("%s(), handling baud of 1152000\n", __func__); break; case 4000000: ir_mode = IRCC_CFGA_IRDA_4PPM; ctrl = IRCC_CRC; fast = IRCC_LCR_A_FAST; pr_debug("%s(), handling baud of 4000000\n", __func__); break; } #if 0 Now in tranceiver! /* This causes an interrupt */ register_bank(fir_base, 0); outb((inb(fir_base + IRCC_LCR_A) & 0xbf) | fast, fir_base + IRCC_LCR_A); #endif register_bank(fir_base, 1); outb(((inb(fir_base + IRCC_SCE_CFGA) & IRCC_SCE_CFGA_BLOCK_CTRL_BITS_MASK) | ir_mode), fir_base + IRCC_SCE_CFGA); register_bank(fir_base, 4); outb((inb(fir_base + IRCC_CONTROL) & 0x30) | ctrl, fir_base + IRCC_CONTROL); } /* * Function smsc_ircc_fir_start(self) * * Change the speed of the device * */ static void smsc_ircc_fir_start(struct smsc_ircc_cb *self) { struct net_device *dev; int fir_base; pr_debug("%s\n", __func__); IRDA_ASSERT(self != NULL, return;); dev = self->netdev; IRDA_ASSERT(dev != NULL, return;); fir_base = self->io.fir_base; /* Reset everything */ /* Clear FIFO */ outb(inb(fir_base + IRCC_LCR_A) | IRCC_LCR_A_FIFO_RESET, fir_base + IRCC_LCR_A); /* Enable interrupt */ /*outb(IRCC_IER_ACTIVE_FRAME|IRCC_IER_EOM, fir_base + IRCC_IER);*/ register_bank(fir_base, 1); /* Select the TX/RX interface */ #ifdef SMSC_669 /* Uses pin 88/89 for Rx/Tx */ outb(((inb(fir_base + IRCC_SCE_CFGB) & 0x3f) | IRCC_CFGB_MUX_COM), fir_base + IRCC_SCE_CFGB); #else outb(((inb(fir_base + IRCC_SCE_CFGB) & 0x3f) | IRCC_CFGB_MUX_IR), fir_base + IRCC_SCE_CFGB); #endif (void) inb(fir_base + IRCC_FIFO_THRESHOLD); /* Enable SCE interrupts */ outb(0, fir_base + IRCC_MASTER); register_bank(fir_base, 0); outb(IRCC_IER_ACTIVE_FRAME | IRCC_IER_EOM, fir_base + IRCC_IER); outb(IRCC_MASTER_INT_EN, fir_base + IRCC_MASTER); } /* * Function smsc_ircc_fir_stop(self, baud) * * Change the speed of the device * */ static void smsc_ircc_fir_stop(struct smsc_ircc_cb *self) { int fir_base; pr_debug("%s\n", __func__); IRDA_ASSERT(self != NULL, return;); fir_base = self->io.fir_base; register_bank(fir_base, 0); /*outb(IRCC_MASTER_RESET, fir_base + IRCC_MASTER);*/ outb(inb(fir_base + IRCC_LCR_B) & IRCC_LCR_B_SIP_ENABLE, fir_base + IRCC_LCR_B); } /* * Function smsc_ircc_change_speed(self, baud) * * Change the speed of the device * * This function *must* be called with spinlock held, because it may * be called from the irq handler. - Jean II */ static void smsc_ircc_change_speed(struct smsc_ircc_cb *self, u32 speed) { struct net_device *dev; int last_speed_was_sir; pr_debug("%s() changing speed to: %d\n", __func__, speed); IRDA_ASSERT(self != NULL, return;); dev = self->netdev; last_speed_was_sir = self->io.speed <= SMSC_IRCC2_MAX_SIR_SPEED; #if 0 /* Temp Hack */ speed= 1152000; self->io.speed = speed; last_speed_was_sir = 0; smsc_ircc_fir_start(self); #endif if (self->io.speed == 0) smsc_ircc_sir_start(self); #if 0 if (!last_speed_was_sir) speed = self->io.speed; #endif if (self->io.speed != speed) smsc_ircc_set_transceiver_for_speed(self, speed); self->io.speed = speed; if (speed <= SMSC_IRCC2_MAX_SIR_SPEED) { if (!last_speed_was_sir) { smsc_ircc_fir_stop(self); smsc_ircc_sir_start(self); } smsc_ircc_set_sir_speed(self, speed); } else { if (last_speed_was_sir) { #if SMSC_IRCC2_C_SIR_STOP smsc_ircc_sir_stop(self); #endif smsc_ircc_fir_start(self); } smsc_ircc_set_fir_speed(self, speed); #if 0 self->tx_buff.len = 10; self->tx_buff.data = self->tx_buff.head; smsc_ircc_dma_xmit(self, 4000); #endif /* Be ready for incoming frames */ smsc_ircc_dma_receive(self); } netif_wake_queue(dev); } /* * Function smsc_ircc_set_sir_speed (self, speed) * * Set speed of IrDA port to specified baudrate * */ static void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed) { int iobase; int fcr; /* FIFO control reg */ int lcr; /* Line control reg */ int divisor; pr_debug("%s(), Setting speed to: %d\n", __func__, speed); IRDA_ASSERT(self != NULL, return;); iobase = self->io.sir_base; /* Update accounting for new speed */ self->io.speed = speed; /* Turn off interrupts */ outb(0, iobase + UART_IER); divisor = SMSC_IRCC2_MAX_SIR_SPEED / speed; fcr = UART_FCR_ENABLE_FIFO; /* * Use trigger level 1 to avoid 3 ms. timeout delay at 9600 bps, and * almost 1,7 ms at 19200 bps. At speeds above that we can just forget * about this timeout since it will always be fast enough. */ fcr |= self->io.speed < 38400 ? UART_FCR_TRIGGER_1 : UART_FCR_TRIGGER_14; /* IrDA ports use 8N1 */ lcr = UART_LCR_WLEN8; outb(UART_LCR_DLAB | lcr, iobase + UART_LCR); /* Set DLAB */ outb(divisor & 0xff, iobase + UART_DLL); /* Set speed */ outb(divisor >> 8, iobase + UART_DLM); outb(lcr, iobase + UART_LCR); /* Set 8N1 */ outb(fcr, iobase + UART_FCR); /* Enable FIFO's */ /* Turn on interrups */ outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER); pr_debug("%s() speed changed to: %d\n", __func__, speed); } /* * Function smsc_ircc_hard_xmit_fir (skb, dev) * * Transmit the frame! * */ static netdev_tx_t smsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev) { struct smsc_ircc_cb *self; unsigned long flags; s32 speed; int mtt; IRDA_ASSERT(dev != NULL, return NETDEV_TX_OK;); self = netdev_priv(dev); IRDA_ASSERT(self != NULL, return NETDEV_TX_OK;); netif_stop_queue(dev); /* Make sure test of self->io.speed & speed change are atomic */ spin_lock_irqsave(&self->lock, flags); /* Check if we need to change the speed after this frame */ speed = irda_get_next_speed(skb); if (speed != self->io.speed && speed != -1) { /* Check for empty frame */ if (!skb->len) { /* Note : you should make sure that speed changes * are not going to corrupt any outgoing frame. * Look at nsc-ircc for the gory details - Jean II */ smsc_ircc_change_speed(self, speed); spin_unlock_irqrestore(&self->lock, flags); dev_kfree_skb(skb); return NETDEV_TX_OK; } self->new_speed = speed; } skb_copy_from_linear_data(skb, self->tx_buff.head, skb->len); self->tx_buff.len = skb->len; self->tx_buff.data = self->tx_buff.head; mtt = irda_get_mtt(skb); if (mtt) { int bofs; /* * Compute how many BOFs (STA or PA's) we need to waste the * min turn time given the speed of the link. */ bofs = mtt * (self->io.speed / 1000) / 8000; if (bofs > 4095) bofs = 4095; smsc_ircc_dma_xmit(self, bofs); } else { /* Transmit frame */ smsc_ircc_dma_xmit(self, 0); } spin_unlock_irqrestore(&self->lock, flags); dev_kfree_skb(skb); return NETDEV_TX_OK; } /* * Function smsc_ircc_dma_xmit (self, bofs) * * Transmit data using DMA * */ static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int bofs) { int iobase = self->io.fir_base; u8 ctrl; pr_debug("%s\n", __func__); #if 1 /* Disable Rx */ register_bank(iobase, 0); outb(0x00, iobase + IRCC_LCR_B); #endif register_bank(iobase, 1); outb(inb(iobase + IRCC_SCE_CFGB) & ~IRCC_CFGB_DMA_ENABLE, iobase + IRCC_SCE_CFGB); self->io.direction = IO_XMIT; /* Set BOF additional count for generating the min turn time */ register_bank(iobase, 4); outb(bofs & 0xff, iobase + IRCC_BOF_COUNT_LO); ctrl = inb(iobase + IRCC_CONTROL) & 0xf0; outb(ctrl | ((bofs >> 8) & 0x0f), iobase + IRCC_BOF_COUNT_HI); /* Set max Tx frame size */ outb(self->tx_buff.len >> 8, iobase + IRCC_TX_SIZE_HI); outb(self->tx_buff.len & 0xff, iobase + IRCC_TX_SIZE_LO); /*outb(UART_MCR_OUT2, self->io.sir_base + UART_MCR);*/ /* Enable burst mode chip Tx DMA */ register_bank(iobase, 1); outb(inb(iobase + IRCC_SCE_CFGB) | IRCC_CFGB_DMA_ENABLE | IRCC_CFGB_DMA_BURST, iobase + IRCC_SCE_CFGB); /* Setup DMA controller (must be done after enabling chip DMA) */ irda_setup_dma(self->io.dma, self->tx_buff_dma, self->tx_buff.len, DMA_TX_MODE); /* Enable interrupt */ register_bank(iobase, 0); outb(IRCC_IER_ACTIVE_FRAME | IRCC_IER_EOM, iobase + IRCC_IER); outb(IRCC_MASTER_INT_EN, iobase + IRCC_MASTER); /* Enable transmit */ outb(IRCC_LCR_B_SCE_TRANSMIT | IRCC_LCR_B_SIP_ENABLE, iobase + IRCC_LCR_B); } /* * Function smsc_ircc_dma_xmit_complete (self) * * The transfer of a frame in finished. This function will only be called * by the interrupt handler * */ static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self) { int iobase = self->io.fir_base; pr_debug("%s\n", __func__); #if 0 /* Disable Tx */ register_bank(iobase, 0); outb(0x00, iobase + IRCC_LCR_B); #endif register_bank(iobase, 1); outb(inb(iobase + IRCC_SCE_CFGB) & ~IRCC_CFGB_DMA_ENABLE, iobase + IRCC_SCE_CFGB); /* Check for underrun! */ register_bank(iobase, 0); if (inb(iobase + IRCC_LSR) & IRCC_LSR_UNDERRUN) { self->netdev->stats.tx_errors++; self->netdev->stats.tx_fifo_errors++; /* Reset error condition */ register_bank(iobase, 0); outb(IRCC_MASTER_ERROR_RESET, iobase + IRCC_MASTER); outb(0x00, iobase + IRCC_MASTER); } else { self->netdev->stats.tx_packets++; self->netdev->stats.tx_bytes += self->tx_buff.len; } /* Check if it's time to change the speed */ if (self->new_speed) { smsc_ircc_change_speed(self, self->new_speed); self->new_speed = 0; } netif_wake_queue(self->netdev); } /* * Function smsc_ircc_dma_receive(self) * * Get ready for receiving a frame. The device will initiate a DMA * if it starts to receive a frame. * */ static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self) { int iobase = self->io.fir_base; #if 0 /* Turn off chip DMA */ register_bank(iobase, 1); outb(inb(iobase + IRCC_SCE_CFGB) & ~IRCC_CFGB_DMA_ENABLE, iobase + IRCC_SCE_CFGB); #endif /* Disable Tx */ register_bank(iobase, 0); outb(0x00, iobase + IRCC_LCR_B); /* Turn off chip DMA */ register_bank(iobase, 1); outb(inb(iobase + IRCC_SCE_CFGB) & ~IRCC_CFGB_DMA_ENABLE, iobase + IRCC_SCE_CFGB); self->io.direction = IO_RECV; self->rx_buff.data = self->rx_buff.head; /* Set max Rx frame size */ register_bank(iobase, 4); outb((2050 >> 8) & 0x0f, iobase + IRCC_RX_SIZE_HI); outb(2050 & 0xff, iobase + IRCC_RX_SIZE_LO); /* Setup DMA controller */ irda_setup_dma(self->io.dma, self->rx_buff_dma, self->rx_buff.truesize, DMA_RX_MODE); /* Enable burst mode chip Rx DMA */ register_bank(iobase, 1); outb(inb(iobase + IRCC_SCE_CFGB) | IRCC_CFGB_DMA_ENABLE | IRCC_CFGB_DMA_BURST, iobase + IRCC_SCE_CFGB); /* Enable interrupt */ register_bank(iobase, 0); outb(IRCC_IER_ACTIVE_FRAME | IRCC_IER_EOM, iobase + IRCC_IER); outb(IRCC_MASTER_INT_EN, iobase + IRCC_MASTER); /* Enable receiver */ register_bank(iobase, 0); outb(IRCC_LCR_B_SCE_RECEIVE | IRCC_LCR_B_SIP_ENABLE, iobase + IRCC_LCR_B); return 0; } /* * Function smsc_ircc_dma_receive_complete(self) * * Finished with receiving frames * */ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self) { struct sk_buff *skb; int len, msgcnt, lsr; int iobase = self->io.fir_base; register_bank(iobase, 0); pr_debug("%s\n", __func__); #if 0 /* Disable Rx */ register_bank(iobase, 0); outb(0x00, iobase + IRCC_LCR_B); #endif register_bank(iobase, 0); outb(inb(iobase + IRCC_LSAR) & ~IRCC_LSAR_ADDRESS_MASK, iobase + IRCC_LSAR); lsr= inb(iobase + IRCC_LSR); msgcnt = inb(iobase + IRCC_LCR_B) & 0x08; pr_debug("%s: dma count = %d\n", __func__, get_dma_residue(self->io.dma)); len = self->rx_buff.truesize - get_dma_residue(self->io.dma); /* Look for errors */ if (lsr & (IRCC_LSR_FRAME_ERROR | IRCC_LSR_CRC_ERROR | IRCC_LSR_SIZE_ERROR)) { self->netdev->stats.rx_errors++; if (lsr & IRCC_LSR_FRAME_ERROR) self->netdev->stats.rx_frame_errors++; if (lsr & IRCC_LSR_CRC_ERROR) self->netdev->stats.rx_crc_errors++; if (lsr & IRCC_LSR_SIZE_ERROR) self->netdev->stats.rx_length_errors++; if (lsr & (IRCC_LSR_UNDERRUN | IRCC_LSR_OVERRUN)) self->netdev->stats.rx_length_errors++; return; } /* Remove CRC */ len -= self->io.speed < 4000000 ? 2 : 4; if (len < 2 || len > 2050) { net_warn_ratelimited("%s(), bogus len=%d\n", __func__, len); return; } pr_debug("%s: msgcnt = %d, len=%d\n", __func__, msgcnt, len); skb = dev_alloc_skb(len + 1); if (!skb) return; /* Make sure IP header gets aligned */ skb_reserve(skb, 1); memcpy(skb_put(skb, len), self->rx_buff.data, len); self->netdev->stats.rx_packets++; self->netdev->stats.rx_bytes += len; skb->dev = self->netdev; skb_reset_mac_header(skb); skb->protocol = htons(ETH_P_IRDA); netif_rx(skb); } /* * Function smsc_ircc_sir_receive (self) * * Receive one frame from the infrared port * */ static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self) { int boguscount = 0; int iobase; IRDA_ASSERT(self != NULL, return;); iobase = self->io.sir_base; /* * Receive all characters in Rx FIFO, unwrap and unstuff them. * async_unwrap_char will deliver all found frames */ do { async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff, inb(iobase + UART_RX)); /* Make sure we don't stay here to long */ if (boguscount++ > 32) { pr_debug("%s(), breaking!\n", __func__); break; } } while (inb(iobase + UART_LSR) & UART_LSR_DR); } /* * Function smsc_ircc_interrupt (irq, dev_id, regs) * * An interrupt from the chip has arrived. Time to do some work * */ static irqreturn_t smsc_ircc_interrupt(int dummy, void *dev_id) { struct net_device *dev = dev_id; struct smsc_ircc_cb *self = netdev_priv(dev); int iobase, iir, lcra, lsr; irqreturn_t ret = IRQ_NONE; /* Serialise the interrupt handler in various CPUs, stop Tx path */ spin_lock(&self->lock); /* Check if we should use the SIR interrupt handler */ if (self->io.speed <= SMSC_IRCC2_MAX_SIR_SPEED) { ret = smsc_ircc_interrupt_sir(dev); goto irq_ret_unlock; } iobase = self->io.fir_base; register_bank(iobase, 0); iir = inb(iobase + IRCC_IIR); if (iir == 0) goto irq_ret_unlock; ret = IRQ_HANDLED; /* Disable interrupts */ outb(0, iobase + IRCC_IER); lcra = inb(iobase + IRCC_LCR_A); lsr = inb(iobase + IRCC_LSR); pr_debug("%s(), iir = 0x%02x\n", __func__, iir); if (iir & IRCC_IIR_EOM) { if (self->io.direction == IO_RECV) smsc_ircc_dma_receive_complete(self); else smsc_ircc_dma_xmit_complete(self); smsc_ircc_dma_receive(self); } if (iir & IRCC_IIR_ACTIVE_FRAME) { /*printk(KERN_WARNING "%s(): Active Frame\n", __func__);*/ } /* Enable interrupts again */ register_bank(iobase, 0); outb(IRCC_IER_ACTIVE_FRAME | IRCC_IER_EOM, iobase + IRCC_IER); irq_ret_unlock: spin_unlock(&self->lock); return ret; } /* * Function irport_interrupt_sir (irq, dev_id) * * Interrupt handler for SIR modes */ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev) { struct smsc_ircc_cb *self = netdev_priv(dev); int boguscount = 0; int iobase; int iir, lsr; /* Already locked coming here in smsc_ircc_interrupt() */ /*spin_lock(&self->lock);*/ iobase = self->io.sir_base; iir = inb(iobase + UART_IIR) & UART_IIR_ID; if (iir == 0) return IRQ_NONE; while (iir) { /* Clear interrupt */ lsr = inb(iobase + UART_LSR); pr_debug("%s(), iir=%02x, lsr=%02x, iobase=%#x\n", __func__, iir, lsr, iobase); switch (iir) { case UART_IIR_RLSI: pr_debug("%s(), RLSI\n", __func__); break; case UART_IIR_RDI: /* Receive interrupt */ smsc_ircc_sir_receive(self); break; case UART_IIR_THRI: if (lsr & UART_LSR_THRE) /* Transmitter ready for data */ smsc_ircc_sir_write_wakeup(self); break; default: pr_debug("%s(), unhandled IIR=%#x\n", __func__, iir); break; } /* Make sure we don't stay here to long */ if (boguscount++ > 100) break; iir = inb(iobase + UART_IIR) & UART_IIR_ID; } /*spin_unlock(&self->lock);*/ return IRQ_HANDLED; } #if 0 /* unused */ /* * Function ircc_is_receiving (self) * * Return TRUE is we are currently receiving a frame * */ static int ircc_is_receiving(struct smsc_ircc_cb *self) { int status = FALSE; /* int iobase; */ pr_debug("%s\n", __func__); IRDA_ASSERT(self != NULL, return FALSE;); pr_debug("%s: dma count = %d\n", __func__, get_dma_residue(self->io.dma)); status = (self->rx_buff.state != OUTSIDE_FRAME); return status; } #endif /* unused */ static int smsc_ircc_request_irq(struct smsc_ircc_cb *self) { int error; error = request_irq(self->io.irq, smsc_ircc_interrupt, 0, self->netdev->name, self->netdev); if (error) pr_debug("%s(), unable to allocate irq=%d, err=%d\n", __func__, self->io.irq, error); return error; } static void smsc_ircc_start_interrupts(struct smsc_ircc_cb *self) { unsigned long flags; spin_lock_irqsave(&self->lock, flags); self->io.speed = 0; smsc_ircc_change_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); spin_unlock_irqrestore(&self->lock, flags); } static void smsc_ircc_stop_interrupts(struct smsc_ircc_cb *self) { int iobase = self->io.fir_base; unsigned long flags; spin_lock_irqsave(&self->lock, flags); register_bank(iobase, 0); outb(0, iobase + IRCC_IER); outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); outb(0x00, iobase + IRCC_MASTER); spin_unlock_irqrestore(&self->lock, flags); } /* * Function smsc_ircc_net_open (dev) * * Start the device * */ static int smsc_ircc_net_open(struct net_device *dev) { struct smsc_ircc_cb *self; char hwname[16]; pr_debug("%s\n", __func__); IRDA_ASSERT(dev != NULL, return -1;); self = netdev_priv(dev); IRDA_ASSERT(self != NULL, return 0;); if (self->io.suspended) { pr_debug("%s(), device is suspended\n", __func__); return -EAGAIN; } if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name, (void *) dev)) { pr_debug("%s(), unable to allocate irq=%d\n", __func__, self->io.irq); return -EAGAIN; } smsc_ircc_start_interrupts(self); /* Give self a hardware name */ /* It would be cool to offer the chip revision here - Jean II */ sprintf(hwname, "SMSC @ 0x%03x", self->io.fir_base); /* * Open new IrLAP layer instance, now that everything should be * initialized properly */ self->irlap = irlap_open(dev, &self->qos, hwname); /* * Always allocate the DMA channel after the IRQ, * and clean up on failure. */ if (request_dma(self->io.dma, dev->name)) { smsc_ircc_net_close(dev); net_warn_ratelimited("%s(), unable to allocate DMA=%d\n", __func__, self->io.dma); return -EAGAIN; } netif_start_queue(dev); return 0; } /* * Function smsc_ircc_net_close (dev) * * Stop the device * */ static int smsc_ircc_net_close(struct net_device *dev) { struct smsc_ircc_cb *self; pr_debug("%s\n", __func__); IRDA_ASSERT(dev != NULL, return -1;); self = netdev_priv(dev); IRDA_ASSERT(self != NULL, return 0;); /* Stop device */ netif_stop_queue(dev); /* Stop and remove instance of IrLAP */ if (self->irlap) irlap_close(self->irlap); self->irlap = NULL; smsc_ircc_stop_interrupts(self); /* if we are called from smsc_ircc_resume we don't have IRQ reserved */ if (!self->io.suspended) free_irq(self->io.irq, dev); disable_dma(self->io.dma); free_dma(self->io.dma); return 0; } static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state) { struct smsc_ircc_cb *self = platform_get_drvdata(dev); if (!self->io.suspended) { pr_debug("%s, Suspending\n", driver_name); rtnl_lock(); if (netif_running(self->netdev)) { netif_device_detach(self->netdev); smsc_ircc_stop_interrupts(self); free_irq(self->io.irq, self->netdev); disable_dma(self->io.dma); } self->io.suspended = 1; rtnl_unlock(); } return 0; } static int smsc_ircc_resume(struct platform_device *dev) { struct smsc_ircc_cb *self = platform_get_drvdata(dev); if (self->io.suspended) { pr_debug("%s, Waking up\n", driver_name); rtnl_lock(); smsc_ircc_init_chip(self); if (netif_running(self->netdev)) { if (smsc_ircc_request_irq(self)) { /* * Don't fail resume process, just kill this * network interface */ unregister_netdevice(self->netdev); } else { enable_dma(self->io.dma); smsc_ircc_start_interrupts(self); netif_device_attach(self->netdev); } } self->io.suspended = 0; rtnl_unlock(); } return 0; } /* * Function smsc_ircc_close (self) * * Close driver instance * */ static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) { pr_debug("%s\n", __func__); IRDA_ASSERT(self != NULL, return -1;); platform_device_unregister(self->pldev); /* Remove netdevice */ unregister_netdev(self->netdev); smsc_ircc_stop_interrupts(self); /* Release the PORTS that this driver is using */ pr_debug("%s(), releasing 0x%03x\n", __func__, self->io.fir_base); release_region(self->io.fir_base, self->io.fir_ext); pr_debug("%s(), releasing 0x%03x\n", __func__, self->io.sir_base); release_region(self->io.sir_base, self->io.sir_ext); if (self->tx_buff.head) dma_free_coherent(NULL, self->tx_buff.truesize, self->tx_buff.head, self->tx_buff_dma); if (self->rx_buff.head) dma_free_coherent(NULL, self->rx_buff.truesize, self->rx_buff.head, self->rx_buff_dma); free_netdev(self->netdev); return 0; } static void __exit smsc_ircc_cleanup(void) { int i; pr_debug("%s\n", __func__); for (i = 0; i < 2; i++) { if (dev_self[i]) smsc_ircc_close(dev_self[i]); } if (pnp_driver_registered) pnp_unregister_driver(&smsc_ircc_pnp_driver); platform_driver_unregister(&smsc_ircc_driver); } /* * Start SIR operations * * This function *must* be called with spinlock held, because it may * be called from the irq handler (via smsc_ircc_change_speed()). - Jean II */ static void smsc_ircc_sir_start(struct smsc_ircc_cb *self) { struct net_device *dev; int fir_base, sir_base; pr_debug("%s\n", __func__); IRDA_ASSERT(self != NULL, return;); dev = self->netdev; IRDA_ASSERT(dev != NULL, return;); fir_base = self->io.fir_base; sir_base = self->io.sir_base; /* Reset everything */ outb(IRCC_MASTER_RESET, fir_base + IRCC_MASTER); #if SMSC_IRCC2_C_SIR_STOP /*smsc_ircc_sir_stop(self);*/ #endif register_bank(fir_base, 1); outb(((inb(fir_base + IRCC_SCE_CFGA) & IRCC_SCE_CFGA_BLOCK_CTRL_BITS_MASK) | IRCC_CFGA_IRDA_SIR_A), fir_base + IRCC_SCE_CFGA); /* Initialize UART */ outb(UART_LCR_WLEN8, sir_base + UART_LCR); /* Reset DLAB */ outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), sir_base + UART_MCR); /* Turn on interrups */ outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER); pr_debug("%s() - exit\n", __func__); outb(0x00, fir_base + IRCC_MASTER); } #if SMSC_IRCC2_C_SIR_STOP void smsc_ircc_sir_stop(struct smsc_ircc_cb *self) { int iobase; pr_debug("%s\n", __func__); iobase = self->io.sir_base; /* Reset UART */ outb(0, iobase + UART_MCR); /* Turn off interrupts */ outb(0, iobase + UART_IER); } #endif /* * Function smsc_sir_write_wakeup (self) * * Called by the SIR interrupt handler when there's room for more data. * If we have more packets to send, we send them here. * */ static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self) { int actual = 0; int iobase; int fcr; IRDA_ASSERT(self != NULL, return;); pr_debug("%s\n", __func__); iobase = self->io.sir_base; /* Finished with frame? */ if (self->tx_buff.len > 0) { /* Write data left in transmit buffer */ actual = smsc_ircc_sir_write(iobase, self->io.fifo_size, self->tx_buff.data, self->tx_buff.len); self->tx_buff.data += actual; self->tx_buff.len -= actual; } else { /*if (self->tx_buff.len ==0) {*/ /* * Now serial buffer is almost free & we can start * transmission of another packet. But first we must check * if we need to change the speed of the hardware */ if (self->new_speed) { pr_debug("%s(), Changing speed to %d.\n", __func__, self->new_speed); smsc_ircc_sir_wait_hw_transmitter_finish(self); smsc_ircc_change_speed(self, self->new_speed); self->new_speed = 0; } else { /* Tell network layer that we want more frames */ netif_wake_queue(self->netdev); } self->netdev->stats.tx_packets++; if (self->io.speed <= 115200) { /* * Reset Rx FIFO to make sure that all reflected transmit data * is discarded. This is needed for half duplex operation */ fcr = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR; fcr |= self->io.speed < 38400 ? UART_FCR_TRIGGER_1 : UART_FCR_TRIGGER_14; outb(fcr, iobase + UART_FCR); /* Turn on receive interrupts */ outb(UART_IER_RDI, iobase + UART_IER); } } } /* * Function smsc_ircc_sir_write (iobase, fifo_size, buf, len) * * Fill Tx FIFO with transmit data * */ static int smsc_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len) { int actual = 0; /* Tx FIFO should be empty! */ if (!(inb(iobase + UART_LSR) & UART_LSR_THRE)) { net_warn_ratelimited("%s(), failed, fifo not empty!\n", __func__); return 0; } /* Fill FIFO with current frame */ while (fifo_size-- > 0 && actual < len) { /* Transmit next byte */ outb(buf[actual], iobase + UART_TX); actual++; } return actual; } /* * Function smsc_ircc_is_receiving (self) * * Returns true is we are currently receiving data * */ static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self) { return self->rx_buff.state != OUTSIDE_FRAME; } /* * Function smsc_ircc_probe_transceiver(self) * * Tries to find the used Transceiver * */ static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self) { unsigned int i; IRDA_ASSERT(self != NULL, return;); for (i = 0; smsc_transceivers[i].name != NULL; i++) if (smsc_transceivers[i].probe(self->io.fir_base)) { net_info_ratelimited(" %s transceiver found\n", smsc_transceivers[i].name); self->transceiver= i + 1; return; } net_info_ratelimited("No transceiver found. Defaulting to %s\n", smsc_transceivers[SMSC_IRCC2_C_DEFAULT_TRANSCEIVER].name); self->transceiver = SMSC_IRCC2_C_DEFAULT_TRANSCEIVER; } /* * Function smsc_ircc_set_transceiver_for_speed(self, speed) * * Set the transceiver according to the speed * */ static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 speed) { unsigned int trx; trx = self->transceiver; if (trx > 0) smsc_transceivers[trx - 1].set_for_speed(self->io.fir_base, speed); } /* * Function smsc_ircc_wait_hw_transmitter_finish () * * Wait for the real end of HW transmission * * The UART is a strict FIFO, and we get called only when we have finished * pushing data to the FIFO, so the maximum amount of time we must wait * is only for the FIFO to drain out. * * We use a simple calibrated loop. We may need to adjust the loop * delay (udelay) to balance I/O traffic and latency. And we also need to * adjust the maximum timeout. * It would probably be better to wait for the proper interrupt, * but it doesn't seem to be available. * * We can't use jiffies or kernel timers because : * 1) We are called from the interrupt handler, which disable softirqs, * so jiffies won't be increased * 2) Jiffies granularity is usually very coarse (10ms), and we don't * want to wait that long to detect stuck hardware. * Jean II */ static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self) { int iobase = self->io.sir_base; int count = SMSC_IRCC2_HW_TRANSMITTER_TIMEOUT_US; /* Calibrated busy loop */ while (count-- > 0 && !(inb(iobase + UART_LSR) & UART_LSR_TEMT)) udelay(1); if (count < 0) pr_debug("%s(): stuck transmitter\n", __func__); } /* PROBING * * REVISIT we can be told about the device by PNP, and should use that info * instead of probing hardware and creating a platform_device ... */ static int __init smsc_ircc_look_for_chips(void) { struct smsc_chip_address *address; char *type; unsigned int cfg_base, found; found = 0; address = possible_addresses; while (address->cfg_base) { cfg_base = address->cfg_base; /*printk(KERN_WARNING "%s(): probing: 0x%02x for: 0x%02x\n", __func__, cfg_base, address->type);*/ if (address->type & SMSCSIO_TYPE_FDC) { type = "FDC"; if (address->type & SMSCSIO_TYPE_FLAT) if (!smsc_superio_flat(fdc_chips_flat, cfg_base, type)) found++; if (address->type & SMSCSIO_TYPE_PAGED) if (!smsc_superio_paged(fdc_chips_paged, cfg_base, type)) found++; } if (address->type & SMSCSIO_TYPE_LPC) { type = "LPC"; if (address->type & SMSCSIO_TYPE_FLAT) if (!smsc_superio_flat(lpc_chips_flat, cfg_base, type)) found++; if (address->type & SMSCSIO_TYPE_PAGED) if (!smsc_superio_paged(lpc_chips_paged, cfg_base, type)) found++; } address++; } return found; } /* * Function smsc_superio_flat (chip, base, type) * * Try to get configuration of a smc SuperIO chip with flat register model * */ static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned short cfgbase, char *type) { unsigned short firbase, sirbase; u8 mode, dma, irq; int ret = -ENODEV; pr_debug("%s\n", __func__); if (smsc_ircc_probe(cfgbase, SMSCSIOFLAT_DEVICEID_REG, chips, type) == NULL) return ret; outb(SMSCSIOFLAT_UARTMODE0C_REG, cfgbase); mode = inb(cfgbase + 1); /*printk(KERN_WARNING "%s(): mode: 0x%02x\n", __func__, mode);*/ if (!(mode & SMSCSIOFLAT_UART2MODE_VAL_IRDA)) net_warn_ratelimited("%s(): IrDA not enabled\n", __func__); outb(SMSCSIOFLAT_UART2BASEADDR_REG, cfgbase); sirbase = inb(cfgbase + 1) << 2; /* FIR iobase */ outb(SMSCSIOFLAT_FIRBASEADDR_REG, cfgbase); firbase = inb(cfgbase + 1) << 3; /* DMA */ outb(SMSCSIOFLAT_FIRDMASELECT_REG, cfgbase); dma = inb(cfgbase + 1) & SMSCSIOFLAT_FIRDMASELECT_MASK; /* IRQ */ outb(SMSCSIOFLAT_UARTIRQSELECT_REG, cfgbase); irq = inb(cfgbase + 1) & SMSCSIOFLAT_UART2IRQSELECT_MASK; net_info_ratelimited("%s(): fir: 0x%02x, sir: 0x%02x, dma: %02d, irq: %d, mode: 0x%02x\n", __func__, firbase, sirbase, dma, irq, mode); if (firbase && smsc_ircc_open(firbase, sirbase, dma, irq) == 0) ret = 0; /* Exit configuration */ outb(SMSCSIO_CFGEXITKEY, cfgbase); return ret; } /* * Function smsc_superio_paged (chip, base, type) * * Try to get configuration of a smc SuperIO chip with paged register model * */ static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned short cfg_base, char *type) { unsigned short fir_io, sir_io; int ret = -ENODEV; pr_debug("%s\n", __func__); if (smsc_ircc_probe(cfg_base, 0x20, chips, type) == NULL) return ret; /* Select logical device (UART2) */ outb(0x07, cfg_base); outb(0x05, cfg_base + 1); /* SIR iobase */ outb(0x60, cfg_base); sir_io = inb(cfg_base + 1) << 8; outb(0x61, cfg_base); sir_io |= inb(cfg_base + 1); /* Read FIR base */ outb(0x62, cfg_base); fir_io = inb(cfg_base + 1) << 8; outb(0x63, cfg_base); fir_io |= inb(cfg_base + 1); outb(0x2b, cfg_base); /* ??? */ if (fir_io && smsc_ircc_open(fir_io, sir_io, ircc_dma, ircc_irq) == 0) ret = 0; /* Exit configuration */ outb(SMSCSIO_CFGEXITKEY, cfg_base); return ret; } static int __init smsc_access(unsigned short cfg_base, unsigned char reg) { pr_debug("%s\n", __func__); outb(reg, cfg_base); return inb(cfg_base) != reg ? -1 : 0; } static const struct smsc_chip * __init smsc_ircc_probe(unsigned short cfg_base, u8 reg, const struct smsc_chip *chip, char *type) { u8 devid, xdevid, rev; pr_debug("%s\n", __func__); /* Leave configuration */ outb(SMSCSIO_CFGEXITKEY, cfg_base); if (inb(cfg_base) == SMSCSIO_CFGEXITKEY) /* not a smc superio chip */ return NULL; outb(reg, cfg_base); xdevid = inb(cfg_base + 1); /* Enter configuration */ outb(SMSCSIO_CFGACCESSKEY, cfg_base); #if 0 if (smsc_access(cfg_base,0x55)) /* send second key and check */ return NULL; #endif /* probe device ID */ if (smsc_access(cfg_base, reg)) return NULL; devid = inb(cfg_base + 1); if (devid == 0 || devid == 0xff) /* typical values for unused port */ return NULL; /* probe revision ID */ if (smsc_access(cfg_base, reg + 1)) return NULL; rev = inb(cfg_base + 1); if (rev >= 128) /* i think this will make no sense */ return NULL; if (devid == xdevid) /* protection against false positives */ return NULL; /* Check for expected device ID; are there others? */ while (chip->devid != devid) { chip++; if (chip->name == NULL) return NULL; } net_info_ratelimited("found SMC SuperIO Chip (devid=0x%02x rev=%02X base=0x%04x): %s%s\n", devid, rev, cfg_base, type, chip->name); if (chip->rev > rev) { net_info_ratelimited("Revision higher than expected\n"); return NULL; } if (chip->flags & NoIRDA) net_info_ratelimited("chipset does not support IRDA\n"); return chip; } static int __init smsc_superio_fdc(unsigned short cfg_base) { int ret = -1; if (!request_region(cfg_base, 2, driver_name)) { net_warn_ratelimited("%s: can't get cfg_base of 0x%03x\n", __func__, cfg_base); } else { if (!smsc_superio_flat(fdc_chips_flat, cfg_base, "FDC") || !smsc_superio_paged(fdc_chips_paged, cfg_base, "FDC")) ret = 0; release_region(cfg_base, 2); } return ret; } static int __init smsc_superio_lpc(unsigned short cfg_base) { int ret = -1; if (!request_region(cfg_base, 2, driver_name)) { net_warn_ratelimited("%s: can't get cfg_base of 0x%03x\n", __func__, cfg_base); } else { if (!smsc_superio_flat(lpc_chips_flat, cfg_base, "LPC") || !smsc_superio_paged(lpc_chips_paged, cfg_base, "LPC")) ret = 0; release_region(cfg_base, 2); } return ret; } /* * Look for some specific subsystem setups that need * pre-configuration not properly done by the BIOS (especially laptops) * This code is based in part on smcinit.c, tosh1800-smcinit.c * and tosh2450-smcinit.c. The table lists the device entries * for ISA bridges with an LPC (Low Pin Count) controller which * handles the communication with the SMSC device. After the LPC * controller is initialized through PCI, the SMSC device is initialized * through a dedicated port in the ISA port-mapped I/O area, this latter * area is used to configure the SMSC device with default * SIR and FIR I/O ports, DMA and IRQ. Different vendors have * used different sets of parameters and different control port * addresses making a subsystem device table necessary. */ #ifdef CONFIG_PCI static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __initdata = { /* * Subsystems needing entries: * 0x10b9:0x1533 0x103c:0x0850 HP nx9010 family * 0x10b9:0x1533 0x0e11:0x005a Compaq nc4000 family * 0x8086:0x24cc 0x0e11:0x002a HP nx9000 family */ { /* Guessed entry */ .vendor = PCI_VENDOR_ID_INTEL, /* Intel 82801DBM LPC bridge */ .device = 0x24cc, .subvendor = 0x103c, .subdevice = 0x08bc, .sir_io = 0x02f8, .fir_io = 0x0130, .fir_irq = 0x05, .fir_dma = 0x03, .cfg_base = 0x004e, .preconfigure = preconfigure_through_82801, .name = "HP nx5000 family", }, { .vendor = PCI_VENDOR_ID_INTEL, /* Intel 82801DBM LPC bridge */ .device = 0x24cc, .subvendor = 0x103c, .subdevice = 0x088c, /* Quite certain these are the same for nc8000 as for nc6000 */ .sir_io = 0x02f8, .fir_io = 0x0130, .fir_irq = 0x05, .fir_dma = 0x03, .cfg_base = 0x004e, .preconfigure = preconfigure_through_82801, .name = "HP nc8000 family", }, { .vendor = PCI_VENDOR_ID_INTEL, /* Intel 82801DBM LPC bridge */ .device = 0x24cc, .subvendor = 0x103c, .subdevice = 0x0890, .sir_io = 0x02f8, .fir_io = 0x0130, .fir_irq = 0x05, .fir_dma = 0x03, .cfg_base = 0x004e, .preconfigure = preconfigure_through_82801, .name = "HP nc6000 family", }, { .vendor = PCI_VENDOR_ID_INTEL, /* Intel 82801DBM LPC bridge */ .device = 0x24cc, .subvendor = 0x0e11, .subdevice = 0x0860, /* I assume these are the same for x1000 as for the others */ .sir_io = 0x02e8, .fir_io = 0x02f8, .fir_irq = 0x07, .fir_dma = 0x03, .cfg_base = 0x002e, .preconfigure = preconfigure_through_82801, .name = "Compaq x1000 family", }, { /* Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge */ .vendor = PCI_VENDOR_ID_INTEL, .device = 0x24c0, .subvendor = 0x1179, .subdevice = 0xffff, /* 0xffff is "any" */ .sir_io = 0x03f8, .fir_io = 0x0130, .fir_irq = 0x07, .fir_dma = 0x01, .cfg_base = 0x002e, .preconfigure = preconfigure_through_82801, .name = "Toshiba laptop with Intel 82801DB/DBL LPC bridge", }, { .vendor = PCI_VENDOR_ID_INTEL, /* Intel 82801CAM ISA bridge */ .device = 0x248c, .subvendor = 0x1179, .subdevice = 0xffff, /* 0xffff is "any" */ .sir_io = 0x03f8, .fir_io = 0x0130, .fir_irq = 0x03, .fir_dma = 0x03, .cfg_base = 0x002e, .preconfigure = preconfigure_through_82801, .name = "Toshiba laptop with Intel 82801CAM ISA bridge", }, { /* 82801DBM (ICH4-M) LPC Interface Bridge */ .vendor = PCI_VENDOR_ID_INTEL, .device = 0x24cc, .subvendor = 0x1179, .subdevice = 0xffff, /* 0xffff is "any" */ .sir_io = 0x03f8, .fir_io = 0x0130, .fir_irq = 0x03, .fir_dma = 0x03, .cfg_base = 0x002e, .preconfigure = preconfigure_through_82801, .name = "Toshiba laptop with Intel 8281DBM LPC bridge", }, { /* ALi M1533/M1535 PCI to ISA Bridge [Aladdin IV/V/V+] */ .vendor = PCI_VENDOR_ID_AL, .device = 0x1533, .subvendor = 0x1179, .subdevice = 0xffff, /* 0xffff is "any" */ .sir_io = 0x02e8, .fir_io = 0x02f8, .fir_irq = 0x07, .fir_dma = 0x03, .cfg_base = 0x002e, .preconfigure = preconfigure_through_ali, .name = "Toshiba laptop with ALi ISA bridge", }, { } // Terminator }; /* * This sets up the basic SMSC parameters * (FIR port, SIR port, FIR DMA, FIR IRQ) * through the chip configuration port. */ static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf) { unsigned short iobase = conf->cfg_base; unsigned char tmpbyte; outb(LPC47N227_CFGACCESSKEY, iobase); // enter configuration state outb(SMSCSIOFLAT_DEVICEID_REG, iobase); // set for device ID tmpbyte = inb(iobase +1); // Read device ID pr_debug("Detected Chip id: 0x%02x, setting up registers...\n", tmpbyte); /* Disable UART1 and set up SIR I/O port */ outb(0x24, iobase); // select CR24 - UART1 base addr outb(0x00, iobase + 1); // disable UART1 outb(SMSCSIOFLAT_UART2BASEADDR_REG, iobase); // select CR25 - UART2 base addr outb( (conf->sir_io >> 2), iobase + 1); // bits 2-9 of 0x3f8 tmpbyte = inb(iobase + 1); if (tmpbyte != (conf->sir_io >> 2) ) { net_warn_ratelimited("ERROR: could not configure SIR ioport\n"); net_warn_ratelimited("Try to supply ircc_cfg argument\n"); return -ENXIO; } /* Set up FIR IRQ channel for UART2 */ outb(SMSCSIOFLAT_UARTIRQSELECT_REG, iobase); // select CR28 - UART1,2 IRQ select tmpbyte = inb(iobase + 1); tmpbyte &= SMSCSIOFLAT_UART1IRQSELECT_MASK; // Do not touch the UART1 portion tmpbyte |= (conf->fir_irq & SMSCSIOFLAT_UART2IRQSELECT_MASK); outb(tmpbyte, iobase + 1); tmpbyte = inb(iobase + 1) & SMSCSIOFLAT_UART2IRQSELECT_MASK; if (tmpbyte != conf->fir_irq) { net_warn_ratelimited("ERROR: could not configure FIR IRQ channel\n"); return -ENXIO; } /* Set up FIR I/O port */ outb(SMSCSIOFLAT_FIRBASEADDR_REG, iobase); // CR2B - SCE (FIR) base addr outb((conf->fir_io >> 3), iobase + 1); tmpbyte = inb(iobase + 1); if (tmpbyte != (conf->fir_io >> 3) ) { net_warn_ratelimited("ERROR: could not configure FIR I/O port\n"); return -ENXIO; } /* Set up FIR DMA channel */ outb(SMSCSIOFLAT_FIRDMASELECT_REG, iobase); // CR2C - SCE (FIR) DMA select outb((conf->fir_dma & LPC47N227_FIRDMASELECT_MASK), iobase + 1); // DMA tmpbyte = inb(iobase + 1) & LPC47N227_FIRDMASELECT_MASK; if (tmpbyte != (conf->fir_dma & LPC47N227_FIRDMASELECT_MASK)) { net_warn_ratelimited("ERROR: could not configure FIR DMA channel\n"); return -ENXIO; } outb(SMSCSIOFLAT_UARTMODE0C_REG, iobase); // CR0C - UART mode tmpbyte = inb(iobase + 1); tmpbyte &= ~SMSCSIOFLAT_UART2MODE_MASK | SMSCSIOFLAT_UART2MODE_VAL_IRDA; outb(tmpbyte, iobase + 1); // enable IrDA (HPSIR) mode, high speed outb(LPC47N227_APMBOOTDRIVE_REG, iobase); // CR07 - Auto Pwr Mgt/boot drive sel tmpbyte = inb(iobase + 1); outb(tmpbyte | LPC47N227_UART2AUTOPWRDOWN_MASK, iobase + 1); // enable UART2 autopower down /* This one was not part of tosh1800 */ outb(0x0a, iobase); // CR0a - ecp fifo / ir mux tmpbyte = inb(iobase + 1); outb(tmpbyte | 0x40, iobase + 1); // send active device to ir port outb(LPC47N227_UART12POWER_REG, iobase); // CR02 - UART 1,2 power tmpbyte = inb(iobase + 1); outb(tmpbyte | LPC47N227_UART2POWERDOWN_MASK, iobase + 1); // UART2 power up mode, UART1 power down outb(LPC47N227_FDCPOWERVALIDCONF_REG, iobase); // CR00 - FDC Power/valid config cycle tmpbyte = inb(iobase + 1); outb(tmpbyte | LPC47N227_VALID_MASK, iobase + 1); // valid config cycle done outb(LPC47N227_CFGEXITKEY, iobase); // Exit configuration return 0; } /* 82801CAM generic registers */ #define VID 0x00 #define DID 0x02 #define PIRQ_A_D_ROUT 0x60 #define SIRQ_CNTL 0x64 #define PIRQ_E_H_ROUT 0x68 #define PCI_DMA_C 0x90 /* LPC-specific registers */ #define COM_DEC 0xe0 #define GEN1_DEC 0xe4 #define LPC_EN 0xe6 #define GEN2_DEC 0xec /* * Sets up the I/O range using the 82801CAM ISA bridge, 82801DBM LPC bridge * or Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge. * They all work the same way! */ static int __init preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf) { unsigned short tmpword; unsigned char tmpbyte; net_info_ratelimited("Setting up Intel 82801 controller and SMSC device\n"); /* * Select the range for the COMA COM port (SIR) * Register COM_DEC: * Bit 7: reserved * Bit 6-4, COMB decode range * Bit 3: reserved * Bit 2-0, COMA decode range * * Decode ranges: * 000 = 0x3f8-0x3ff (COM1) * 001 = 0x2f8-0x2ff (COM2) * 010 = 0x220-0x227 * 011 = 0x228-0x22f * 100 = 0x238-0x23f * 101 = 0x2e8-0x2ef (COM4) * 110 = 0x338-0x33f * 111 = 0x3e8-0x3ef (COM3) */ pci_read_config_byte(dev, COM_DEC, &tmpbyte); tmpbyte &= 0xf8; /* mask COMA bits */ switch(conf->sir_io) { case 0x3f8: tmpbyte |= 0x00; break; case 0x2f8: tmpbyte |= 0x01; break; case 0x220: tmpbyte |= 0x02; break; case 0x228: tmpbyte |= 0x03; break; case 0x238: tmpbyte |= 0x04; break; case 0x2e8: tmpbyte |= 0x05; break; case 0x338: tmpbyte |= 0x06; break; case 0x3e8: tmpbyte |= 0x07; break; default: tmpbyte |= 0x01; /* COM2 default */ } pr_debug("COM_DEC (write): 0x%02x\n", tmpbyte); pci_write_config_byte(dev, COM_DEC, tmpbyte); /* Enable Low Pin Count interface */ pci_read_config_word(dev, LPC_EN, &tmpword); /* These seem to be set up at all times, * just make sure it is properly set. */ switch(conf->cfg_base) { case 0x04e: tmpword |= 0x2000; break; case 0x02e: tmpword |= 0x1000; break; case 0x062: tmpword |= 0x0800; break; case 0x060: tmpword |= 0x0400; break; default: net_warn_ratelimited("Uncommon I/O base address: 0x%04x\n", conf->cfg_base); break; } tmpword &= 0xfffd; /* disable LPC COMB */ tmpword |= 0x0001; /* set bit 0 : enable LPC COMA addr range (GEN2) */ pr_debug("LPC_EN (write): 0x%04x\n", tmpword); pci_write_config_word(dev, LPC_EN, tmpword); /* * Configure LPC DMA channel * PCI_DMA_C bits: * Bit 15-14: DMA channel 7 select * Bit 13-12: DMA channel 6 select * Bit 11-10: DMA channel 5 select * Bit 9-8: Reserved * Bit 7-6: DMA channel 3 select * Bit 5-4: DMA channel 2 select * Bit 3-2: DMA channel 1 select * Bit 1-0: DMA channel 0 select * 00 = Reserved value * 01 = PC/PCI DMA * 10 = Reserved value * 11 = LPC I/F DMA */ pci_read_config_word(dev, PCI_DMA_C, &tmpword); switch(conf->fir_dma) { case 0x07: tmpword |= 0xc000; break; case 0x06: tmpword |= 0x3000; break; case 0x05: tmpword |= 0x0c00; break; case 0x03: tmpword |= 0x00c0; break; case 0x02: tmpword |= 0x0030; break; case 0x01: tmpword |= 0x000c; break; case 0x00: tmpword |= 0x0003; break; default: break; /* do not change settings */ } pr_debug("PCI_DMA_C (write): 0x%04x\n", tmpword); pci_write_config_word(dev, PCI_DMA_C, tmpword); /* * GEN2_DEC bits: * Bit 15-4: Generic I/O range * Bit 3-1: reserved (read as 0) * Bit 0: enable GEN2 range on LPC I/F */ tmpword = conf->fir_io & 0xfff8; tmpword |= 0x0001; pr_debug("GEN2_DEC (write): 0x%04x\n", tmpword); pci_write_config_word(dev, GEN2_DEC, tmpword); /* Pre-configure chip */ return preconfigure_smsc_chip(conf); } /* * Pre-configure a certain port on the ALi 1533 bridge. * This is based on reverse-engineering since ALi does not * provide any data sheet for the 1533 chip. */ static void __init preconfigure_ali_port(struct pci_dev *dev, unsigned short port) { unsigned char reg; /* These bits obviously control the different ports */ unsigned char mask; unsigned char tmpbyte; switch(port) { case 0x0130: case 0x0178: reg = 0xb0; mask = 0x80; break; case 0x03f8: reg = 0xb4; mask = 0x80; break; case 0x02f8: reg = 0xb4; mask = 0x30; break; case 0x02e8: reg = 0xb4; mask = 0x08; break; default: net_err_ratelimited("Failed to configure unsupported port on ALi 1533 bridge: 0x%04x\n", port); return; } pci_read_config_byte(dev, reg, &tmpbyte); /* Turn on the right bits */ tmpbyte |= mask; pci_write_config_byte(dev, reg, tmpbyte); net_info_ratelimited("Activated ALi 1533 ISA bridge port 0x%04x\n", port); } static int __init preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf) { /* Configure the two ports on the ALi 1533 */ preconfigure_ali_port(dev, conf->sir_io); preconfigure_ali_port(dev, conf->fir_io); /* Pre-configure chip */ return preconfigure_smsc_chip(conf); } static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, unsigned short ircc_fir, unsigned short ircc_sir, unsigned char ircc_dma, unsigned char ircc_irq) { struct pci_dev *dev = NULL; unsigned short ss_vendor = 0x0000; unsigned short ss_device = 0x0000; int ret = 0; for_each_pci_dev(dev) { struct smsc_ircc_subsystem_configuration *conf; /* * Cache the subsystem vendor/device: * some manufacturers fail to set this for all components, * so we save it in case there is just 0x0000 0x0000 on the * device we want to check. */ if (dev->subsystem_vendor != 0x0000U) { ss_vendor = dev->subsystem_vendor; ss_device = dev->subsystem_device; } conf = subsystem_configurations; for( ; conf->subvendor; conf++) { if(conf->vendor == dev->vendor && conf->device == dev->device && conf->subvendor == ss_vendor && /* Sometimes these are cached values */ (conf->subdevice == ss_device || conf->subdevice == 0xffff)) { struct smsc_ircc_subsystem_configuration tmpconf; memcpy(&tmpconf, conf, sizeof(struct smsc_ircc_subsystem_configuration)); /* * Override the default values with anything * passed in as parameter */ if (ircc_cfg != 0) tmpconf.cfg_base = ircc_cfg; if (ircc_fir != 0) tmpconf.fir_io = ircc_fir; if (ircc_sir != 0) tmpconf.sir_io = ircc_sir; if (ircc_dma != DMA_INVAL) tmpconf.fir_dma = ircc_dma; if (ircc_irq != IRQ_INVAL) tmpconf.fir_irq = ircc_irq; net_info_ratelimited("Detected unconfigured %s SMSC IrDA chip, pre-configuring device\n", conf->name); if (conf->preconfigure) ret = conf->preconfigure(dev, &tmpconf); else ret = -ENODEV; } } } return ret; } #endif // CONFIG_PCI /************************************************ * * Transceivers specific functions * ************************************************/ /* * Function smsc_ircc_set_transceiver_smsc_ircc_atc(fir_base, speed) * * Program transceiver through smsc-ircc ATC circuitry * */ static void smsc_ircc_set_transceiver_smsc_ircc_atc(int fir_base, u32 speed) { unsigned long jiffies_now, jiffies_timeout; u8 val; jiffies_now = jiffies; jiffies_timeout = jiffies + SMSC_IRCC2_ATC_PROGRAMMING_TIMEOUT_JIFFIES; /* ATC */ register_bank(fir_base, 4); outb((inb(fir_base + IRCC_ATC) & IRCC_ATC_MASK) | IRCC_ATC_nPROGREADY|IRCC_ATC_ENABLE, fir_base + IRCC_ATC); while ((val = (inb(fir_base + IRCC_ATC) & IRCC_ATC_nPROGREADY)) && !time_after(jiffies, jiffies_timeout)) /* empty */; if (val) net_warn_ratelimited("%s(): ATC: 0x%02x\n", __func__, inb(fir_base + IRCC_ATC)); } /* * Function smsc_ircc_probe_transceiver_smsc_ircc_atc(fir_base) * * Probe transceiver smsc-ircc ATC circuitry * */ static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base) { return 0; } /* * Function smsc_ircc_set_transceiver_smsc_ircc_fast_pin_select(self, speed) * * Set transceiver * */ static void smsc_ircc_set_transceiver_smsc_ircc_fast_pin_select(int fir_base, u32 speed) { u8 fast_mode; switch (speed) { default: case 576000 : fast_mode = 0; break; case 1152000 : case 4000000 : fast_mode = IRCC_LCR_A_FAST; break; } register_bank(fir_base, 0); outb((inb(fir_base + IRCC_LCR_A) & 0xbf) | fast_mode, fir_base + IRCC_LCR_A); } /* * Function smsc_ircc_probe_transceiver_smsc_ircc_fast_pin_select(fir_base) * * Probe transceiver * */ static int smsc_ircc_probe_transceiver_smsc_ircc_fast_pin_select(int fir_base) { return 0; } /* * Function smsc_ircc_set_transceiver_toshiba_sat1800(fir_base, speed) * * Set transceiver * */ static void smsc_ircc_set_transceiver_toshiba_sat1800(int fir_base, u32 speed) { u8 fast_mode; switch (speed) { default: case 576000 : fast_mode = 0; break; case 1152000 : case 4000000 : fast_mode = /*IRCC_LCR_A_FAST |*/ IRCC_LCR_A_GP_DATA; break; } /* This causes an interrupt */ register_bank(fir_base, 0); outb((inb(fir_base + IRCC_LCR_A) & 0xbf) | fast_mode, fir_base + IRCC_LCR_A); } /* * Function smsc_ircc_probe_transceiver_toshiba_sat1800(fir_base) * * Probe transceiver * */ static int smsc_ircc_probe_transceiver_toshiba_sat1800(int fir_base) { return 0; } module_init(smsc_ircc_init); module_exit(smsc_ircc_cleanup);
{ "pile_set_name": "Github" }
# ticket 895 is a query optimization problem with the primary key --source include/have_tokudb.inc SET DEFAULT_STORAGE_ENGINE = 'tokudb'; --disable_warnings DROP TABLE IF EXISTS t; --enable_warnings CREATE TABLE t (r INT, s INT, t BIGINT, PRIMARY KEY (r, s)); INSERT INTO t VALUES (1,2,3),(4,5,6); # ignore rows column --replace_column 9 NULL; EXPLAIN SELECT * FROM t WHERE r > 0; CREATE INDEX it on t(t); # ignore rows column --replace_column 9 NULL; EXPLAIN SELECT * FROM t WHERE r > 0; # Final cleanup. DROP TABLE t;
{ "pile_set_name": "Github" }
rows = {[1.631719e+002 1.441956e+002 1.451944e+002 1.471919e+002 1.551819e+002 1.591769e+002 1.631719e+002 1.681656e+002 1.841456e+002 1.901381e+002 1.961306e+002 2.021231e+002 2.091144e+002 2.201006e+002 2.260931e+002 2.310869e+002 2.350819e+002 2.400756e+002 2.440706e+002 2.480656e+002 2.520606e+002 2.560556e+002 2.590519e+002 2.620481e+002 2.690394e+002 2.720356e+002 2.750319e+002 2.780281e+002 2.850194e+002 2.890144e+002 2.970044e+002 3.019981e+002 3.069919e+002 3.119856e+002 3.229719e+002 3.279656e+002 3.339581e+002 3.399506e+002 3.459431e+002 3.569294e+002 3.639206e+002 3.699131e+002 3.759056e+002 3.878906e+002 3.928844e+002 3.978781e+002 4.078656e+002 4.128594e+002 4.158556e+002 4.198506e+002 4.228469e+002 4.258431e+002 4.298381e+002 4.328344e+002 4.338331e+002 4.348319e+002 4.358306e+002 4.358306e+002 4.368294e+002 4.358306e+002 4.358306e+002 4.348319e+002 4.328344e+002 4.308369e+002 ]; }; cols = {[4.479406e+002 4.059931e+002 3.990019e+002 3.910119e+002 3.640456e+002 3.540581e+002 3.450694e+002 3.360806e+002 3.111119e+002 3.041206e+002 2.981281e+002 2.941331e+002 2.901381e+002 2.871419e+002 2.871419e+002 2.891394e+002 2.911369e+002 2.951319e+002 2.991269e+002 3.051194e+002 3.111119e+002 3.181031e+002 3.250944e+002 3.340831e+002 3.520606e+002 3.610494e+002 3.710369e+002 3.800256e+002 3.990019e+002 4.069919e+002 4.229719e+002 4.299631e+002 4.359556e+002 4.419481e+002 4.509369e+002 4.539331e+002 4.569294e+002 4.589269e+002 4.599256e+002 4.589269e+002 4.579281e+002 4.549319e+002 4.519356e+002 4.439456e+002 4.389519e+002 4.329594e+002 4.199756e+002 4.119856e+002 4.049944e+002 3.970044e+002 3.890144e+002 3.810244e+002 3.640456e+002 3.480656e+002 3.400756e+002 3.320856e+002 3.250944e+002 3.191019e+002 3.131094e+002 3.081156e+002 3.041206e+002 3.011244e+002 2.991269e+002 2.981281e+002 ]; };
{ "pile_set_name": "Github" }
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="CobarTestSuite-Sequencial-Execution-Tests" verbose="2"> <test name="CobarSqlMapClientTemplateWithComposedRuleRouterTest"> <classes> <class name="com.alibaba.cobar.client.CobarSqlMapClientDaoSupportTestWithComposedRuleRouter"></class> </classes> </test> <test name="CobarSqlMapClientTemplateWithNamespaceRouterTest"> <classes> <class name="com.alibaba.cobar.client.CobarSqlMapClientTemplateWithNamespaceRouterTest"></class> </classes> </test> <test name="CobarSqlMapClientTemplateWithNamespaceShardingRouterTest"> <classes> <class name="com.alibaba.cobar.client.CobarSqlMapClientTemplateWithNamespaceShardingRouterTest"></class> </classes> </test> <test name="obarSqlMapClientTemplateWithSqlActionOnlyRouterTest"> <classes> <class name="com.alibaba.cobar.client.CobarSqlMapClientTemplateWithSqlActionOnlyRouterTest"></class> </classes> </test> <test name="obarSqlMapClientTemplateWithSqlActionShardingRouterTest"> <classes> <class name="com.alibaba.cobar.client.CobarSqlMapClientTemplateWithSqlActionShardingRouterTest"></class> </classes> </test> <test name="MultipleDataSourcesTransactionManagerTest"> <classes> <class name="com.alibaba.cobar.client.transaction.MultipleDataSourcesTransactionManagerTest"></class> </classes> </test> <test name="CobarSqlMapClientTemplateWithCustomMergerTest"> <classes> <class name="com.alibaba.cobar.client.CobarSqlMapClientTemplateWithCustomMergerTest"></class> </classes> </test> <test name="CobarSqlMapClientDaoSupportTestWithComposedRuleRouter"> <classes> <class name="com.alibaba.cobar.client.CobarSqlMapClientDaoSupportTestWithComposedRuleRouter"></class> </classes> </test> </suite>
{ "pile_set_name": "Github" }
;********************************************************** ;* ;* APPLE ][ 128K PLASMA INTERPRETER ;* ;* SYSTEM ROUTINES AND LOCATIONS ;* ;********************************************************** !CPU 65C02 ;* ;* MONITOR SPECIAL LOCATIONS ;* CSWL = $36 CSWH = $37 PROMPT = $33 ;* ;* PRODOS ;* PRODOS = $BF00 DEVCNT = $BF31 ; GLOBAL PAGE DEVICE COUNT DEVLST = $BF32 ; GLOBAL PAGE DEVICE LIST MACHID = $BF98 ; GLOBAL PAGE MACHINE ID BYTE RAMSLOT = $BF26 ; SLOT 3, DRIVE 2 IS /RAM'S DRIVER VECTOR NODEV = $BF10 ;* ;* HARDWARE ADDRESSES ;* KEYBD = $C000 CLRKBD = $C010 SPKR = $C030 LCRDEN = $C080 LCWTEN = $C081 ROMEN = $C082 LCRWEN = $C083 LCBNK2 = $00 LCBNK1 = $08 ALTZPOFF= $C008 ALTZPON = $C009 ALTRDOFF= $C002 ALTRDON = $C003 ALTWROFF= $C004 ALTWRON = $C005 !SOURCE "vmsrc/plvmzp.inc" DVSIGN = TMP+2 DROP = $EF NEXTOP = $F0 FETCHOP = NEXTOP+1 IP = FETCHOP+1 IPL = IP IPH = IPL+1 OPIDX = FETCHOP+6 OPPAGE = OPIDX+1 STRBUF = $0300 JITMOD = $02F0 INTERP = $03D0 JITCOMP = $03E2 JITCODE = $03E4 ;****************************** ;* * ;* INTERPRETER INITIALIZATION * ;* * ;****************************** * = $2000 ;* ;* MUST HAVE 128K FOR JIT ;* + LDA MACHID AND #$30 CMP #$30 BEQ ++ LDY #$00 - LDA NEEDAUX,Y BEQ + ORA #$80 JSR $FDED INY BNE - + LDA $C000 BPL - LDA $C010 JSR PRODOS !BYTE $65 !WORD BYEPARMS BYEPARMS !BYTE 4 !BYTE 4 !WORD 0 !BYTE 0 !WORD 0 NEEDAUX !TEXT "128K MEMORY REQUIRED.", 13 !TEXT "PRESS ANY KEY...", 0 ;* ;* DISCONNECT /RAM ;* ++ ;SEI ; DISABLE /RAM LDA RAMSLOT CMP NODEV BNE RAMCONT LDA RAMSLOT+1 CMP NODEV+1 BEQ RAMDONE RAMCONT LDY DEVCNT RAMLOOP LDA DEVLST,Y AND #$F3 CMP #$B3 BEQ GETLOOP DEY BPL RAMLOOP BMI RAMDONE GETLOOP LDA DEVLST+1,Y STA DEVLST,Y BEQ RAMEXIT INY BNE GETLOOP RAMEXIT LDA NODEV STA RAMSLOT LDA NODEV+1 STA RAMSLOT+1 DEC DEVCNT RAMDONE ;CLI UNTIL I KNOW WHAT TO DO WITH THE UNENHANCED IIE ;* ;* MOVE VM INTO LANGUAGE CARD ;* BIT LCRWEN+LCBNK2 BIT LCRWEN+LCBNK2 LDA #<VMCORE STA SRCL LDA #>VMCORE STA SRCH LDY #$00 STY DSTL LDA #$D0 STA DSTH - LDA (SRC),Y ; COPY VM+BYE INTO LANGUAGE CARD STA (DST),Y INY BNE - INC SRCH INC DSTH LDA DSTH CMP #$E0 BNE - ;* ;* MOVE FIRST PAGE OF 'BYE' INTO PLACE ;* - LDA $D100,Y STA $1000,Y INY BNE - ;* ;* INSERT 65C02 OPS IF APPLICABLE ;* LDA #$00 INC BEQ + JSR C02OPS ;* ;* SAVE DEFAULT COMMAND INTERPRETER PATH IN LC ;* + JSR PRODOS ; GET PREFIX !BYTE $C7 !WORD GETPFXPARMS LDY STRBUF ; APPEND "CMDJIT" LDA #"/" CMP STRBUF,Y BEQ + INY STA STRBUF,Y + LDA #"C" INY STA STRBUF,Y LDA #"M" INY STA STRBUF,Y LDA #"D" INY STA STRBUF,Y LDA #"1" INY STA STRBUF,Y LDA #"2" INY STA STRBUF,Y LDA #"8" INY STA STRBUF,Y STY STRBUF BIT LCRWEN+LCBNK2 ; COPY TO LC FOR BYE BIT LCRWEN+LCBNK2 - LDA STRBUF,Y STA LCDEFCMD,Y DEY BPL - JMP CMDENTRY GETPFXPARMS !BYTE 1 !WORD STRBUF ; PATH STRING GOES HERE ;************************************************ ;* * ;* LANGUAGE CARD RESIDENT PLASMA VM STARTS HERE * ;* * ;************************************************ VMCORE = * !PSEUDOPC $D000 { ;**************** ;* * ;* OPCODE TABLE * ;* * ;**************** !ALIGN 255,0 OPTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E !WORD MINUS1,BREQ,BRNE,LA,LLA,CB,CW,CS ; 20 22 24 26 28 2A 2C 2E !WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E !WORD ISEQ,ISNE,ISGT,ISLT,ISGE,ISLE,BRFLS,BRTRU ; 40 42 44 46 48 4A 4C 4E !WORD BRNCH,SEL,CALL,ICAL,ENTER,LEAVE,RET,CFFB ; 50 52 54 56 58 5A 5C 5E !WORD LB,LW,LLB,LLW,LAB,LAW,DLB,DLW ; 60 62 64 66 68 6A 6C 6E !WORD SB,SW,SLB,SLW,SAB,SAW,DAB,DAW ; 70 72 74 76 78 7A 7C 7E !WORD LNOT,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 80 82 84 86 88 8A 8C 8E !WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 90 92 94 96 98 9A 9C 9E !WORD BRGT,BRLT,INCBRLE,ADDBRLE,DECBRGE,SUBBRGE,BRAND,BROR ; A0 A2 A4 A6 A8 AA AC AE !WORD ADDLB,ADDLW,ADDAB,ADDAW,IDXLB,IDXLW,IDXAB,IDXAW ; B0 B2 B4 B6 B8 BA BC BE !WORD NATV ; C0 ;* ;* DIRECTLY ENTER INTO BYTECODE INTERPRETER ;* DINTRP PLA CLC ADC #$01 STA IPL PLA ADC #$00 STA IPH LDY #$00 LDA #>OPTBL STA OPPAGE JMP FETCHOP ;* ;* INDIRECTLY ENTER INTO BYTECODE INTERPRETER ;* IINTRPX PLA STA TMPL PLA STA TMPH LDY #$02 LDA (TMP),Y STA IPH DEY LDA (TMP),Y STA IPL DEY LDA #>OPXTBL STA OPPAGE PHP ; SAVE PSR SEI STA ALTRDON JMP FETCHOP ;************************************************************ ;* * ;* 'BYE' PROCESSING - COPIED TO $1000 ON PRODOS BYE COMMAND * ;* * ;************************************************************ !ALIGN 255,0 !PSEUDOPC $1000 { BYE LDY DEFCMD - LDA DEFCMD,Y ; SET DEFAULT COMMAND WHEN CALLED FROM 'BYE' STA STRBUF,Y DEY BPL - ; INY ; CLEAR CMDLINE BUFF ; STY $01FF CMDENTRY = * ; ; DEACTIVATE 80 COL CARDS AND SET DCI STRING FOR JIT MODULE ; BIT ROMEN LDY #4 - LDA DISABLE80,Y ORA #$80 JSR $FDED LDA JITDCI,Y STA JITMOD,Y DEY BPL - BIT $C054 ; SET TEXT MODE BIT $C051 BIT $C05F JSR $FC58 ; HOME ; ; INSTALL PAGE 0 FETCHOP ROUTINE ; LDY #$0F - LDA PAGE0,Y STA DROP,Y DEY BPL - ; ; SET JMPTMP OPCODE ; LDA #$4C STA JMPTMP ; ; INSTALL PAGE 3 VECTORS ; LDY #$12 - LDA PAGE3,Y STA INTERP,Y DEY BPL - ; ; READ CMD INTO MEMORY ; JSR PRODOS ; CLOSE EVERYTHING !BYTE $CC !WORD CLOSEPARMS BNE FAIL JSR PRODOS ; OPEN CMD !BYTE $C8 !WORD OPENPARMS BNE FAIL LDA REFNUM STA READPARMS+1 JSR PRODOS !BYTE $CA !WORD READPARMS BNE FAIL JSR PRODOS !BYTE $CC !WORD CLOSEPARMS BNE FAIL ; ; CHANGE CMD STRING TO SYSPATH STRING ; LDA STRBUF SEC SBC #$06 STA STRBUF JMP $2000 ; JUMP TO LOADED SYSTEM COMMAND ; ; PRINT FAIL MESSAGE, WAIT FOR KEYPRESS, AND REBOOT ; FAIL INC $3F4 ; INVALIDATE POWER-UP BYTE LDY #11 - LDA FAILMSG,Y ORA #$80 JSR $FDED DEY BPL - JSR $FD0C ; WAIT FOR KEYPRESS JMP ($FFFC) ; RESET OPENPARMS !BYTE 3 !WORD STRBUF !WORD $0800 REFNUM !BYTE 0 READPARMS !BYTE 4 !BYTE 0 !WORD $2000 !WORD $9F00 !WORD 0 CLOSEPARMS !BYTE 1 !BYTE 0 DISABLE80 !BYTE 21, 13, '1', 26, 13 JITDCI !BYTE 'J'|$80,'I'|$80,'T' FAILMSG !TEXT ".DMC GNISSIM" PAGE0 = * ;****************************** ;* * ;* INTERP BYTECODE INNER LOOP * ;* * ;****************************** !PSEUDOPC DROP { INX ; DROP @ $EF INY ; NEXTOP @ $F0 LDA $FFFF,Y ; FETCHOP @ $F1, IP MAPS OVER $FFFF @ $F2 STA OPIDX JMP (OPTBL) ; OPIDX AND OPPAGE MAP OVER OPTBL } PAGE3 = * ;* ;* PAGE 3 VECTORS INTO INTERPRETER ;* !PSEUDOPC $03D0 { BIT LCRDEN+LCBNK2 ; $03D0 - BYTECODE DIRECT INTERP ENTRY JMP DINTRP BIT LCRDEN+LCBNK2 ; $03D6 - JIT INDIRECT INTERPX ENTRY JMP JITINTRPX BIT LCRDEN+LCBNK2 ; $03DC - BYTECODE INDIRECT INTERPX ENTRY JMP IINTRPX } DEFCMD = * ;!FILL 28 ENDBYE = * } LCDEFCMD = * ;*-28 ; DEFCMD IN LC MEMORY ;***************** ;* * ;* OPXCODE TABLE * ;* * ;***************** !ALIGN 255,0 OPXTBL !WORD ZERO,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E !WORD MINUS1,BREQ,BRNE,LA,LLA,CB,CW,CSX ; 20 22 24 26 28 2A 2C 2E !WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E !WORD ISEQ,ISNE,ISGT,ISLT,ISGE,ISLE,BRFLS,BRTRU ; 40 42 44 46 48 4A 4C 4E !WORD BRNCH,SEL,CALLX,ICALX,ENTERX,LEAVEX,RETX,CFFB ; 50 52 54 56 58 5A 5C 5E !WORD LBX,LWX,LLBX,LLWX,LABX,LAWX,DLB,DLW ; 60 62 64 66 68 6A 6C 6E !WORD SB,SW,SLB,SLW,SAB,SAW,DAB,DAW ; 70 72 74 76 78 7A 7C 7E !WORD LNOT,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 80 82 84 86 88 8A 8C 8E !WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 90 92 94 96 98 9A 9C 9E !WORD BRGT,BRLT,INCBRLE,ADDBRLE,DECBRGE,SUBBRGE,BRAND,BROR ; A0 A2 A4 A6 A8 AA AC AE !WORD ADDLBX,ADDLWX,ADDABX,ADDAWX,IDXLBX,IDXLWX,IDXABX,IDXAWX ; B0 B2 B4 B6 B8 BA BC BE !WORD NATV ; C0 ;* ;* JIT PROFILING ENTRY INTO INTERPRETER ;* JITINTRPX PLA SEC SBC #$02 ; POINT TO DEF ENTRY STA TMPL PLA SBC #$00 STA TMPH LDY #$05 LDA (TMP),Y ; DEC JIT COUNT SEC SBC #$01 STA (TMP),Y BEQ RUNJIT DEY ; INTERP BYTECODE AS USUAL LDA (TMP),Y STA IPH DEY LDA (TMP),Y STA IPL LDY #$00 LDA #>OPXTBL STA OPPAGE PHP SEI STA ALTRDON JMP FETCHOP RUNJIT LDA JITCOMP STA SRCL LDA JITCOMP+1 STA SRCH DEY ; LDY #$04 LDA (SRC),Y STA IPH DEY LDA (SRC),Y STA IPL DEX ; ADD PARAMETER TO DEF ENTRY LDA TMPL PHA ; AND SAVE IT FOR LATER STA ESTKL,X LDA TMPH PHA STA ESTKH,X LDY #$00 LDA #>OPXTBL STA OPPAGE LDA #>(RETJIT-1) PHA LDA #<(RETJIT-1) PHA PHP SEI STA ALTRDON JMP FETCHOP ; CALL JIT COMPILER RETJIT PLA STA TMPH PLA STA TMPL JMP (TMP) ; RE-CALL ORIGINAL DEF ENTRY ;* ;* ADD TOS TO TOS-1 ;* ADD LDA ESTKL,X CLC ADC ESTKL+1,X STA ESTKL+1,X LDA ESTKH,X ADC ESTKH+1,X STA ESTKH+1,X JMP DROP ;* ;* SUB TOS FROM TOS-1 ;* SUB LDA ESTKL+1,X SEC SBC ESTKL,X STA ESTKL+1,X LDA ESTKH+1,X SBC ESTKH,X STA ESTKH+1,X JMP DROP ;* ;* SHIFT TOS LEFT BY 1, ADD TO TOS-1 ;* IDXW LDA ESTKL,X ASL ROL ESTKH,X CLC ADC ESTKL+1,X STA ESTKL+1,X LDA ESTKH,X ADC ESTKH+1,X STA ESTKH+1,X JMP DROP ;* ;* MUL TOS-1 BY TOS ;* MUL STY IPY LDY #$10 LDA ESTKL+1,X EOR #$FF STA TMPL LDA ESTKH+1,X EOR #$FF STA TMPH LDA #$00 STA ESTKL+1,X ; PRODL ; STA ESTKH+1,X ; PRODH _MULLP LSR TMPH ; MULTPLRH ROR TMPL ; MULTPLRL BCS + STA ESTKH+1,X ; PRODH LDA ESTKL,X ; MULTPLNDL ADC ESTKL+1,X ; PRODL STA ESTKL+1,X LDA ESTKH,X ; MULTPLNDH ADC ESTKH+1,X ; PRODH + ASL ESTKL,X ; MULTPLNDL ROL ESTKH,X ; MULTPLNDH DEY BNE _MULLP STA ESTKH+1,X ; PRODH LDY IPY JMP DROP ;* ;* INTERNAL DIVIDE ALGORITHM ;* _NEG LDA #$00 SEC SBC ESTKL,X STA ESTKL,X LDA #$00 SBC ESTKH,X STA ESTKH,X RTS _DIV STY IPY LDY #$11 ; #BITS+1 LDA #$00 STA TMPL ; REMNDRL STA TMPH ; REMNDRH STA DVSIGN LDA ESTKH+1,X BPL + INX JSR _NEG DEX LDA #$81 STA DVSIGN + ORA ESTKL+1,X ; DVDNDL BEQ _DIVEX LDA ESTKH,X BPL _DIV1 JSR _NEG INC DVSIGN _DIV1 ASL ESTKL+1,X ; DVDNDL ROL ESTKH+1,X ; DVDNDH DEY BCC _DIV1 _DIVLP ROL TMPL ; REMNDRL ROL TMPH ; REMNDRH LDA TMPL ; REMNDRL CMP ESTKL,X ; DVSRL LDA TMPH ; REMNDRH SBC ESTKH,X ; DVSRH BCC + STA TMPH ; REMNDRH LDA TMPL ; REMNDRL SBC ESTKL,X ; DVSRL STA TMPL ; REMNDRL SEC + ROL ESTKL+1,X ; DVDNDL ROL ESTKH+1,X ; DVDNDH DEY BNE _DIVLP _DIVEX INX LDY IPY RTS ;* ;* NEGATE TOS ;* NEG LDA #$00 SEC SBC ESTKL,X STA ESTKL,X LDA #$00 SBC ESTKH,X STA ESTKH,X JMP NEXTOP ;* ;* DIV TOS-1 BY TOS ;* DIV JSR _DIV LSR DVSIGN ; SIGN(RESULT) = (SIGN(DIVIDEND) + SIGN(DIVISOR)) & 1 BCS NEG JMP NEXTOP ;* ;* MOD TOS-1 BY TOS ;* MOD JSR _DIV LDA TMPL ; REMNDRL STA ESTKL,X LDA TMPH ; REMNDRH STA ESTKH,X LDA DVSIGN ; REMAINDER IS SIGN OF DIVIDEND BMI NEG JMP NEXTOP ;* ;* DIVMOD TOS-1 BY TOS ;* DIVMOD JSR _DIV LSR DVSIGN ; SIGN(RESULT) = (SIGN(DIVIDEND) + SIGN(DIVISOR)) & 1 BCC + JSR _NEG + DEX LDA TMPL ; REMNDRL STA ESTKL,X LDA TMPH ; REMNDRH STA ESTKH,X ASL DVSIGN ; REMAINDER IS SIGN OF DIVIDEND BMI NEG JMP NEXTOP ;* ;* INCREMENT TOS ;* INCR INC ESTKL,X BEQ + JMP NEXTOP + INC ESTKH,X JMP NEXTOP ;* ;* DECREMENT TOS ;* DECR LDA ESTKL,X BEQ + DEC ESTKL,X JMP NEXTOP + DEC ESTKL,X DEC ESTKH,X JMP NEXTOP ;* ;* BITWISE COMPLIMENT TOS ;* COMP LDA #$FF EOR ESTKL,X STA ESTKL,X LDA #$FF EOR ESTKH,X STA ESTKH,X JMP NEXTOP ;* ;* BITWISE AND TOS TO TOS-1 ;* BAND LDA ESTKL+1,X AND ESTKL,X STA ESTKL+1,X LDA ESTKH+1,X AND ESTKH,X STA ESTKH+1,X JMP DROP ;* ;* INCLUSIVE OR TOS TO TOS-1 ;* IOR LDA ESTKL+1,X ORA ESTKL,X STA ESTKL+1,X LDA ESTKH+1,X ORA ESTKH,X STA ESTKH+1,X JMP DROP ;* ;* EXLUSIVE OR TOS TO TOS-1 ;* XOR LDA ESTKL+1,X EOR ESTKL,X STA ESTKL+1,X LDA ESTKH+1,X EOR ESTKH,X STA ESTKH+1,X JMP DROP ;* ;* SHIFT TOS-1 LEFT BY TOS ;* SHL STY IPY LDA ESTKL,X CMP #$08 BCC + LDY ESTKL+1,X STY ESTKH+1,X LDY #$00 STY ESTKL+1,X SBC #$08 + TAY BEQ + LDA ESTKL+1,X - ASL ROL ESTKH+1,X DEY BNE - STA ESTKL+1,X + LDY IPY JMP DROP ;* ;* SHIFT TOS-1 RIGHT BY TOS ;* SHR STY IPY LDA ESTKL,X CMP #$08 BCC ++ LDY ESTKH+1,X STY ESTKL+1,X CPY #$80 LDY #$00 BCC + DEY + STY ESTKH+1,X SEC SBC #$08 ++ TAY BEQ + LDA ESTKH+1,X - CMP #$80 ROR ROR ESTKL+1,X DEY BNE - STA ESTKH+1,X + LDY IPY JMP DROP ;* ;* DUPLICATE TOS ;* DUP DEX LDA ESTKL+1,X STA ESTKL,X LDA ESTKH+1,X STA ESTKH,X JMP NEXTOP ;* ;* ADD IMMEDIATE TO TOS ;* ADDI INY ;+INC_IP LDA (IP),Y CLC ADC ESTKL,X STA ESTKL,X BCC + INC ESTKH,X + JMP NEXTOP ;* ;* SUB IMMEDIATE FROM TOS ;* SUBI INY ;+INC_IP LDA ESTKL,X SEC SBC (IP),Y STA ESTKL,X BCS + DEC ESTKH,X + JMP NEXTOP ;* ;* AND IMMEDIATE TO TOS ;* ANDI INY ;+INC_IP LDA (IP),Y AND ESTKL,X STA ESTKL,X LDA #$00 STA ESTKH,X JMP NEXTOP ;* ;* IOR IMMEDIATE TO TOS ;* ORI INY ;+INC_IP LDA (IP),Y ORA ESTKL,X STA ESTKL,X JMP NEXTOP ;* ;* LOGICAL NOT ;* LNOT LDA ESTKL,X ORA ESTKH,X BEQ + LDA #$00 STA ESTKL,X STA ESTKH,X JMP NEXTOP ;* ;* CONSTANT -1, ZERO, NYBBLE, BYTE, $FF BYTE, WORD (BELOW) ;* MINUS1 DEX + LDA #$FF STA ESTKL,X STA ESTKH,X JMP NEXTOP ZERO DEX STA ESTKL,X STA ESTKH,X JMP NEXTOP CN DEX LSR ; A = CONST * 2 STA ESTKL,X LDA #$00 STA ESTKH,X JMP NEXTOP CB DEX LDA #$00 STA ESTKH,X INY ;+INC_IP LDA (IP),Y STA ESTKL,X JMP NEXTOP CFFB DEX LDA #$FF STA ESTKH,X INY ;+INC_IP LDA (IP),Y STA ESTKL,X JMP NEXTOP ;* ;* LOAD ADDRESS & LOAD CONSTANT WORD (SAME THING, WITH OR WITHOUT FIXUP) ;* - TYA ; RENORMALIZE IP CLC ADC IPL STA IPL BCC + INC IPH + LDY #$FF LA INY ;+INC_IP BMI - DEX LDA (IP),Y STA ESTKL,X INY LDA (IP),Y STA ESTKH,X JMP NEXTOP CW DEX INY ;+INC_IP LDA (IP),Y STA ESTKL,X INY LDA (IP),Y STA ESTKH,X JMP NEXTOP ;* ;* CONSTANT STRING ;* CS DEX ;INY ;+INC_IP TYA ; NORMALIZE IP AND SAVE STRING ADDR ON ESTK SEC ADC IPL STA IPL STA ESTKL,X LDA #$00 TAY ADC IPH STA IPH STA ESTKH,X LDA (IP),Y TAY JMP NEXTOP CSX DEX ;INY ;+INC_IP TYA ; NORMALIZE IP SEC ADC IPL STA IPL LDA #$00 TAY ADC IPH STA IPH LDA PPL ; SCAN POOL FOR STRING ALREADY THERE STA TMPL LDA PPH STA TMPH _CMPPSX ;LDA TMPH ; CHECK FOR END OF POOL CMP IFPH BCC _CMPSX ; CHECK FOR MATCHING STRING BNE _CPYSX ; BEYOND END OF POOL, COPY STRING OVER LDA TMPL CMP IFPL BCS _CPYSX ; AT OR BEYOND END OF POOL, COPY STRING OVER _CMPSX STA ALTRDOFF LDA (TMP),Y ; COMPARE STRINGS FROM AUX MEM TO STRINGS IN MAIN MEM STA ALTRDON CMP (IP),Y ; COMPARE STRING LENGTHS BNE _CNXTSX1 TAY _CMPCSX STA ALTRDOFF LDA (TMP),Y ; COMPARE STRING CHARS FROM END STA ALTRDON CMP (IP),Y BNE _CNXTSX DEY BNE _CMPCSX LDA TMPL ; MATCH - SAVE EXISTING ADDR ON ESTK AND MOVE ON STA ESTKL,X LDA TMPH STA ESTKH,X BNE _CEXSX _CNXTSX LDY #$00 STA ALTRDOFF LDA (TMP),Y STA ALTRDON _CNXTSX1 SEC ADC TMPL STA TMPL LDA #$00 ADC TMPH STA TMPH BNE _CMPPSX _CPYSX LDA (IP),Y ; COPY STRING FROM AUX TO MAIN MEM POOL TAY ; MAKE ROOM IN POOL AND SAVE ADDR ON ESTK EOR #$FF CLC ADC PPL STA PPL STA ESTKL,X LDA #$FF ADC PPH STA PPH STA ESTKH,X ; COPY STRING FROM AUX MEM BYTECODE TO MAIN MEM POOL _CPYSX1 LDA (IP),Y ; ALTRD IS ON, NO NEED TO CHANGE IT HERE STA (PP),Y ; ALTWR IS OFF, NO NEED TO CHANGE IT HERE DEY CPY #$FF BNE _CPYSX1 INY _CEXSX LDA (IP),Y ; SKIP TO NEXT OP ADDR AFTER STRING TAY JMP NEXTOP ;* ;* LOAD VALUE FROM ADDRESS TAG ;* LB LDA ESTKL,X STA ESTKH-1,X LDA (ESTKH-1,X) STA ESTKL,X LDA #$00 STA ESTKH,X JMP NEXTOP LW LDA ESTKL,X STA ESTKH-1,X LDA (ESTKH-1,X) STA ESTKL,X INC ESTKH-1,X BEQ + LDA (ESTKH-1,X) STA ESTKH,X JMP NEXTOP + INC ESTKH,X LDA (ESTKH-1,X) STA ESTKH,X JMP NEXTOP LBX LDA ESTKL,X STA ESTKH-1,X STA ALTRDOFF LDA (ESTKH-1,X) STA ESTKL,X LDA #$00 STA ESTKH,X STA ALTRDON JMP NEXTOP LWX LDA ESTKL,X STA ESTKH-1,X STA ALTRDOFF LDA (ESTKH-1,X) STA ESTKL,X INC ESTKH-1,X BEQ + LDA (ESTKH-1,X) STA ESTKH,X STA ALTRDON JMP NEXTOP + INC ESTKH,X LDA (ESTKH-1,X) STA ESTKH,X STA ALTRDON JMP NEXTOP ;* ;* LOAD ADDRESS OF LOCAL FRAME OFFSET ;* - TYA ; RENORMALIZE IP CLC ADC IPL STA IPL BCC + INC IPH + LDY #$FF LLA INY ;+INC_IP BMI - LDA (IP),Y DEX CLC ADC IFPL STA ESTKL,X LDA #$00 ADC IFPH STA ESTKH,X JMP NEXTOP ;* ;* LOAD VALUE FROM LOCAL FRAME OFFSET ;* LLB INY ;+INC_IP LDA (IP),Y STY IPY TAY DEX LDA (IFP),Y STA ESTKL,X LDA #$00 STA ESTKH,X LDY IPY JMP NEXTOP LLW INY ;+INC_IP LDA (IP),Y STY IPY TAY DEX LDA (IFP),Y STA ESTKL,X INY LDA (IFP),Y STA ESTKH,X LDY IPY JMP NEXTOP LLBX INY ;+INC_IP LDA (IP),Y STY IPY TAY DEX STA ALTRDOFF LDA (IFP),Y STA ESTKL,X LDA #$00 STA ESTKH,X STA ALTRDON LDY IPY JMP NEXTOP LLWX INY ;+INC_IP LDA (IP),Y STY IPY TAY DEX STA ALTRDOFF LDA (IFP),Y STA ESTKL,X INY LDA (IFP),Y STA ESTKH,X STA ALTRDON LDY IPY JMP NEXTOP ;* ;* ADD VALUE FROM LOCAL FRAME OFFSET ;* ADDLB INY ;+INC_IP LDA (IP),Y STY IPY TAY LDA (IFP),Y CLC ADC ESTKL,X STA ESTKL,X BCC + INC ESTKH,X + LDY IPY JMP NEXTOP ADDLBX INY ;+INC_IP LDA (IP),Y STY IPY TAY STA ALTRDOFF LDA (IFP),Y CLC ADC ESTKL,X STA ESTKL,X BCC + INC ESTKH,X + STA ALTRDON LDY IPY JMP NEXTOP ADDLW INY ;+INC_IP LDA (IP),Y STY IPY TAY LDA (IFP),Y CLC ADC ESTKL,X STA ESTKL,X INY LDA (IFP),Y ADC ESTKH,X STA ESTKH,X LDY IPY JMP NEXTOP ADDLWX INY ;+INC_IP LDA (IP),Y STY IPY TAY STA ALTRDOFF LDA (IFP),Y CLC ADC ESTKL,X STA ESTKL,X INY LDA (IFP),Y ADC ESTKH,X STA ESTKH,X STA ALTRDON LDY IPY JMP NEXTOP ;* ;* INDEX VALUE FROM LOCAL FRAME OFFSET ;* IDXLB INY ;+INC_IP LDA (IP),Y STY IPY TAY LDA (IFP),Y LDY #$00 ASL BCC + INY CLC + ADC ESTKL,X STA ESTKL,X TYA ADC ESTKH,X STA ESTKH,X LDY IPY JMP NEXTOP IDXLBX INY ;+INC_IP LDA (IP),Y STY IPY TAY STA ALTRDOFF LDA (IFP),Y LDY #$00 ASL BCC + INY CLC + ADC ESTKL,X STA ESTKL,X TYA ADC ESTKH,X STA ESTKH,X STA ALTRDON LDY IPY JMP NEXTOP IDXLW INY ;+INC_IP LDA (IP),Y STY IPY TAY LDA (IFP),Y ASL STA TMPL INY LDA (IFP),Y ROL STA TMPH LDA TMPL CLC ADC ESTKL,X STA ESTKL,X LDA TMPH ADC ESTKH,X STA ESTKH,X LDY IPY JMP NEXTOP IDXLWX INY ;+INC_IP LDA (IP),Y STY IPY TAY STA ALTRDOFF LDA (IFP),Y ASL STA TMPL INY LDA (IFP),Y ROL STA TMPH LDA TMPL CLC ADC ESTKL,X STA ESTKL,X LDA TMPH ADC ESTKH,X STA ESTKH,X STA ALTRDON LDY IPY JMP NEXTOP ;* ;* LOAD VALUE FROM ABSOLUTE ADDRESS ;* LAB INY ;+INC_IP LDA (IP),Y STA ESTKH-2,X INY ;+INC_IP LDA (IP),Y STA ESTKH-1,X LDA (ESTKH-2,X) DEX STA ESTKL,X LDA #$00 STA ESTKH,X JMP NEXTOP LAW INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH STY IPY LDY #$00 LDA (TMP),Y DEX STA ESTKL,X INY LDA (TMP),Y STA ESTKH,X LDY IPY JMP NEXTOP LABX INY ;+INC_IP LDA (IP),Y STA ESTKH-2,X INY ;+INC_IP LDA (IP),Y STA ESTKH-1,X STA ALTRDOFF LDA (ESTKH-2,X) DEX STA ESTKL,X LDA #$00 STA ESTKH,X STA ALTRDON JMP NEXTOP LAWX INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH STY IPY STA ALTRDOFF LDY #$00 LDA (TMP),Y DEX STA ESTKL,X INY LDA (TMP),Y STA ESTKH,X STA ALTRDON LDY IPY JMP NEXTOP ;* ;* ADD VALUE FROM ABSOLUTE ADDRESS ;* ADDAB INY ;+INC_IP LDA (IP),Y STA ESTKH-2,X INY ;+INC_IP LDA (IP),Y STA ESTKH-1,X LDA (ESTKH-2,X) CLC ADC ESTKL,X STA ESTKL,X BCC + INC ESTKH,X + JMP NEXTOP ADDABX INY ;+INC_IP LDA (IP),Y STA ESTKH-2,X INY ;+INC_IP LDA (IP),Y STA ESTKH-1,X STA ALTRDOFF LDA (ESTKH-2,X) CLC ADC ESTKL,X STA ESTKL,X BCC + INC ESTKH,X + STA ALTRDON JMP NEXTOP ADDAW INY ;+INC_IP LDA (IP),Y STA SRCL INY ;+INC_IP LDA (IP),Y STA SRCH STY IPY LDY #$00 LDA (SRC),Y CLC ADC ESTKL,X STA ESTKL,X INY LDA (SRC),Y ADC ESTKH,X STA ESTKH,X LDY IPY JMP NEXTOP ADDAWX INY ;+INC_IP LDA (IP),Y STA SRCL INY ;+INC_IP LDA (IP),Y STA SRCH STY IPY STA ALTRDOFF LDY #$00 LDA (SRC),Y CLC ADC ESTKL,X STA ESTKL,X INY LDA (SRC),Y ADC ESTKH,X STA ESTKH,X STA ALTRDON LDY IPY JMP NEXTOP ;* ;* INDEX VALUE FROM ABSOLUTE ADDRESS ;* IDXAB INY ;+INC_IP LDA (IP),Y STA ESTKH-2,X INY ;+INC_IP LDA (IP),Y STA ESTKH-1,X LDA (ESTKH-2,X) STY IPY LDY #$00 ASL BCC + INY CLC + ADC ESTKL,X STA ESTKL,X TYA ADC ESTKH,X STA ESTKH,X LDY IPY JMP NEXTOP IDXABX INY ;+INC_IP LDA (IP),Y STA ESTKH-2,X INY ;+INC_IP LDA (IP),Y STA ESTKH-1,X STA ALTRDOFF LDA (ESTKH-2,X) STY IPY LDY #$00 ASL BCC + INY CLC + ADC ESTKL,X STA ESTKL,X TYA ADC ESTKH,X STA ESTKH,X LDY IPY STA ALTRDON JMP NEXTOP IDXAW INY ;+INC_IP LDA (IP),Y STA SRCL INY ;+INC_IP LDA (IP),Y STA SRCH STY IPY LDY #$00 LDA (SRC),Y ASL STA TMPL INY LDA (SRC),Y ROL STA TMPH LDA TMPL CLC ADC ESTKL,X STA ESTKL,X LDA TMPH ADC ESTKH,X STA ESTKH,X LDY IPY JMP NEXTOP IDXAWX INY ;+INC_IP LDA (IP),Y STA SRCL INY ;+INC_IP LDA (IP),Y STA SRCH STY IPY STA ALTRDOFF LDY #$00 LDA (SRC),Y ASL STA TMPL INY LDA (SRC),Y ROL STA TMPH LDA TMPL CLC ADC ESTKL,X STA ESTKL,X LDA TMPH ADC ESTKH,X STA ESTKH,X STA ALTRDON LDY IPY JMP NEXTOP ;* ;* STORE VALUE TO ADDRESS ;* SB LDA ESTKL,X STA ESTKH-1,X LDA ESTKL+1,X STA (ESTKH-1,X) INX JMP DROP SW LDA ESTKL,X STA ESTKH-1,X LDA ESTKL+1,X STA (ESTKH-1,X) LDA ESTKH+1,X INC ESTKH-1,X BEQ + STA (ESTKH-1,X) INX JMP DROP + INC ESTKH,X STA (ESTKH-1,X) ;* ;* DROP TOS, TOS-1 ;* DROP2 INX JMP DROP ;* ;* STORE VALUE TO LOCAL FRAME OFFSET ;* SLB INY ;+INC_IP LDA (IP),Y STY IPY TAY LDA ESTKL,X STA (IFP),Y LDY IPY BMI FIXDROP JMP DROP SLW INY ;+INC_IP LDA (IP),Y STY IPY TAY LDA ESTKL,X STA (IFP),Y INY LDA ESTKH,X STA (IFP),Y LDY IPY BMI FIXDROP JMP DROP FIXDROP TYA LDY #$00 CLC ADC IPL STA IPL BCC + INC IPH + JMP DROP ;* ;* STORE VALUE TO LOCAL FRAME OFFSET WITHOUT POPPING STACK ;* DLB INY ;+INC_IP LDA (IP),Y STY IPY TAY LDA ESTKL,X STA (IFP),Y LDA #$00 STA ESTKH,X LDY IPY JMP NEXTOP DLW INY ;+INC_IP LDA (IP),Y STY IPY TAY LDA ESTKL,X STA (IFP),Y INY LDA ESTKH,X STA (IFP),Y LDY IPY JMP NEXTOP ;* ;* STORE VALUE TO ABSOLUTE ADDRESS ;* - TYA ; RENORMALIZE IP CLC ADC IPL STA IPL BCC + INC IPH + LDY #$FF SAB INY ;+INC_IP BMI - LDA (IP),Y STA ESTKH-2,X INY ;+INC_IP LDA (IP),Y STA ESTKH-1,X LDA ESTKL,X STA (ESTKH-2,X) JMP DROP SAW INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH STY IPY LDY #$00 LDA ESTKL,X STA (TMP),Y INY LDA ESTKH,X STA (TMP),Y LDY IPY BMI + JMP DROP + JMP FIXDROP ;* ;* STORE VALUE TO ABSOLUTE ADDRESS WITHOUT POPPING STACK ;* DAB INY ;+INC_IP LDA (IP),Y STA ESTKH-2,X INY ;+INC_IP LDA (IP),Y STA ESTKH-1,X LDA ESTKL,X STA (ESTKH-2,X) LDA #$00 STA ESTKH,X JMP NEXTOP DAW INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH STY IPY LDY #$00 LDA ESTKL,X STA (TMP),Y INY LDA ESTKH,X STA (TMP),Y LDY IPY JMP NEXTOP ;* ;* COMPARES ;* ISEQ LDA ESTKL,X CMP ESTKL+1,X BNE ISFLS LDA ESTKH,X CMP ESTKH+1,X BNE ISFLS ISTRU LDA #$FF STA ESTKL+1,X STA ESTKH+1,X JMP DROP ISNE LDA ESTKL,X CMP ESTKL+1,X BNE ISTRU LDA ESTKH,X CMP ESTKH+1,X BNE ISTRU ISFLS LDA #$00 STA ESTKL+1,X STA ESTKH+1,X JMP DROP ISGE LDA ESTKL+1,X CMP ESTKL,X LDA ESTKH+1,X SBC ESTKH,X BVS + BPL ISTRU BMI ISFLS + - BPL ISFLS BMI ISTRU ISLE LDA ESTKL,X CMP ESTKL+1,X LDA ESTKH,X SBC ESTKH+1,X BVS - BPL ISTRU BMI ISFLS ISGT LDA ESTKL,X CMP ESTKL+1,X LDA ESTKH,X SBC ESTKH+1,X BVS + BMI ISTRU BPL ISFLS + - BMI ISFLS BPL ISTRU ISLT LDA ESTKL+1,X CMP ESTKL,X LDA ESTKH+1,X SBC ESTKH,X BVS - BMI ISTRU BPL ISFLS ;* ;* BRANCHES ;* SEL INX TYA ; FLATTEN IP SEC ADC IPL STA TMPL LDA #$00 TAY ADC IPH STA TMPH ; ADD BRANCH OFFSET LDA (TMP),Y ;CLC ; BETTER NOT CARRY OUT OF IP+Y ADC TMPL STA IPL INY LDA (TMP),Y ADC TMPH STA IPH DEY LDA (IP),Y STA TMPL ; CASE COUNT INC IPL BNE CASELP INC IPH CASELP LDA ESTKL-1,X CMP (IP),Y BEQ + LDA ESTKH-1,X INY SBC (IP),Y BMI CASEEND - INY INY DEC TMPL BEQ FIXNEXT INY BNE CASELP INC IPH BNE CASELP + LDA ESTKH-1,X INY SBC (IP),Y BEQ BRNCH BPL - CASEEND LDA #$00 STA TMPH DEC TMPL LDA TMPL ASL ; SKIP REMAINING CASES ROL TMPH ASL ROL TMPH ; CLC ADC IPL STA IPL LDA TMPH ADC IPH STA IPH INY INY FIXNEXT TYA LDY #$00 SEC ADC IPL STA IPL BCC + INC IPH + JMP FETCHOP BRAND LDA ESTKL,X ORA ESTKH,X BEQ BRNCH INX ; DROP LEFT HALF OF AND BNE NOBRNCH BROR LDA ESTKL,X ORA ESTKH,X BNE BRNCH INX ; DROP LEFT HALF OF OR BNE NOBRNCH BREQ INX INX LDA ESTKL-2,X CMP ESTKL-1,X BNE NOBRNCH LDA ESTKH-2,X CMP ESTKH-1,X BEQ BRNCH BNE NOBRNCH BRNE INX INX LDA ESTKL-2,X CMP ESTKL-1,X BNE BRNCH LDA ESTKH-2,X CMP ESTKH-1,X BNE BRNCH BEQ NOBRNCH BRTRU INX LDA ESTKH-1,X ORA ESTKL-1,X BNE BRNCH NOBRNCH INY ;+INC_IP INY BMI FIXNEXT JMP NEXTOP BRFLS INX LDA ESTKH-1,X ORA ESTKL-1,X BNE NOBRNCH BRNCH TYA ; FLATTEN IP SEC ADC IPL STA TMPL LDA #$00 TAY ADC IPH STA TMPH ; ADD BRANCH OFFSET LDA (TMP),Y ;CLC ; BETTER NOT CARRY OUT OF IP+Y ADC TMPL STA IPL INY LDA (TMP),Y ADC TMPH STA IPH DEY JMP FETCHOP ;* ;* FOR LOOPS PUT TERMINAL VALUE AT ESTK+1 AND CURRENT COUNT ON ESTK ;* BRGT LDA ESTKL+1,X CMP ESTKL,X LDA ESTKH+1,X SBC ESTKH,X BVS + BPL NOBRNCH BMI BRNCH BRLT LDA ESTKL,X CMP ESTKL+1,X LDA ESTKH,X SBC ESTKH+1,X BVS + BPL NOBRNCH BMI BRNCH + BMI NOBRNCH BPL BRNCH DECBRGE DEC ESTKL,X LDA ESTKL,X CMP #$FF BNE + DEC ESTKH,X _BRGE LDA ESTKL,X + CMP ESTKL+1,X LDA ESTKH,X SBC ESTKH+1,X BVS + BPL BRNCH BMI NOBRNCH INCBRLE INC ESTKL,X BNE _BRLE INC ESTKH,X _BRLE LDA ESTKL+1,X CMP ESTKL,X LDA ESTKH+1,X SBC ESTKH,X BVS + BPL BRNCH BMI NOBRNCH + BMI BRNCH BPL NOBRNCH SUBBRGE LDA ESTKL+1,X SEC SBC ESTKL,X STA ESTKL+1,X LDA ESTKH+1,X SBC ESTKH,X STA ESTKH+1,X INX BNE _BRGE ADDBRLE LDA ESTKL,X CLC ADC ESTKL+1,X STA ESTKL+1,X LDA ESTKH,X ADC ESTKH+1,X STA ESTKH+1,X INX BNE _BRLE ;* ;* CALL INTO ABSOLUTE ADDRESS (NATIVE CODE) ;* CALL INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH TYA SEC ADC IPL PHA LDA IPH ADC #$00 PHA JSR JMPTMP PLA STA IPH PLA STA IPL LDA #>OPTBL ; MAKE SURE WE'RE INDEXING THE RIGHT TABLE STA OPPAGE LDY #$00 JMP FETCHOP CALLX INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH STA ALTRDOFF PLP ; RESTORE FLAGS TYA SEC ADC IPL PHA LDA IPH ADC #$00 PHA JSR JMPTMP PLA STA IPH PLA STA IPL LDA #>OPXTBL ; MAKE SURE WE'RE INDEXING THE RIGHT TABLE STA OPPAGE LDY #$00 PHP SEI STA ALTRDON JMP FETCHOP ;* ;* INDIRECT CALL TO ADDRESS (NATIVE CODE) ;* ICAL LDA ESTKL,X STA TMPL LDA ESTKH,X STA TMPH INX TYA SEC ADC IPL PHA LDA IPH ADC #$00 PHA JSR JMPTMP PLA STA IPH PLA STA IPL LDA #>OPTBL ; MAKE SURE WE'RE INDEXING THE RIGHT TABLE STA OPPAGE LDY #$00 JMP FETCHOP ICALX STA ALTRDOFF PLP ; RESTORE FLAGS LDA ESTKL,X STA TMPL LDA ESTKH,X STA TMPH INX TYA SEC ADC IPL PHA LDA IPH ADC #$00 PHA JSR JMPTMP PLA STA IPH PLA STA IPL LDA #>OPXTBL ; MAKE SURE WE'RE INDEXING THE RIGHT TABLE STA OPPAGE LDY #$00 PHP SEI STA ALTRDON JMP FETCHOP ;* ;* JUMP INDIRECT TRHOUGH TMP ;* ;JMPTMP JMP (TMP) ;* ;* ENTER FUNCTION WITH FRAME SIZE AND PARAM COUNT ;* ENTERX PLA ; KEEP PSR ON TOP OF STACK TAY LDA IFPH PHA ; SAVE ON STACK FOR LEAVE LDA IFPL PHA TYA PHA LDA PPL ; ALLOCATE FRAME LDY #$01 SEC SBC (IP),Y STA PPL STA IFPL LDA PPH SBC #$00 STA PPH STA IFPH INY LDA (IP),Y BEQ + ASL TAY - LDA ESTKH,X DEY STA (IFP),Y LDA ESTKL,X INX DEY STA (IFP),Y BNE - + LDY #$03 JMP FETCHOP ENTER LDA IFPH PHA ; SAVE ON STACK FOR LEAVE LDA IFPL PHA LDA PPL ; ALLOCATE FRAME INY SEC SBC (IP),Y STA PPL STA IFPL LDA PPH SBC #$00 STA PPH STA IFPH INY LDA (IP),Y BEQ + ASL TAY - LDA ESTKH,X DEY STA (IFP),Y LDA ESTKL,X INX DEY STA (IFP),Y BNE - + LDY #$03 JMP FETCHOP ;* ;* LEAVE FUNCTION ;* LEAVEX LDA IFPL INY ;+INC_IP CLC ADC (IP),Y STA PPL LDA IFPH ADC #$00 STA PPH STA ALTRDOFF PLP PLA ; RESTORE PREVIOUS FRAME STA IFPL PLA STA IFPH RTS RETX STA ALTRDOFF PLP RTS LEAVE LDA IFPL INY ;+INC_IP CLC ADC (IP),Y STA PPL LDA IFPH ADC #$00 STA PPH PLA ; RESTORE PREVIOUS FRAME STA IFPL PLA STA IFPH RET RTS ;* ;* RETURN TO NATIVE CODE ;* NATV TYA ; FLATTEN IP SEC ADC IPL STA IPL BCS + JMP (IP) + INC IPH JMP (IP) VMEND = * } ;*************************************** ;* * ;* 65C02 OPS TO OVERWRITE STANDARD OPS * ;* * ;*************************************** C02OPS LDA #<DINTRP LDX #>DINTRP LDY #(CDINTRPEND-CDINTRP) JSR OPCPY CDINTRP PLY PLA INY BNE + INC + STY IPL STA IPH LDY #$00 LDA #>OPTBL STA OPPAGE JMP FETCHOP CDINTRPEND ; LDA #<CN LDX #>CN LDY #(CCNEND-CCN) JSR OPCPY CCN DEX LSR STA ESTKL,X STZ ESTKH,X JMP NEXTOP CCNEND ; LDA #<CB LDX #>CB LDY #(CCBEND-CCB) JSR OPCPY CCB DEX STZ ESTKH,X INY LDA (IP),Y STA ESTKL,X JMP NEXTOP CCBEND ; LDA #<CS LDX #>CS LDY #(CCSEND-CCS) JSR OPCPY CCS DEX ;INY ;+INC_IP TYA ; NORMALIZE IP AND SAVE STRING ADDR ON ESTK SEC ADC IPL STA IPL STA ESTKL,X LDA #$00 ADC IPH STA IPH STA ESTKH,X LDA (IP) TAY JMP NEXTOP CCSEND ; LDA #<SHL LDX #>SHL LDY #(CSHLEND-CSHL) JSR OPCPY CSHL STY IPY LDA ESTKL,X CMP #$08 BCC + LDY ESTKL+1,X STY ESTKH+1,X STZ ESTKL+1,X SBC #$08 + TAY BEQ + LDA ESTKL+1,X - ASL ROL ESTKH+1,X DEY BNE - STA ESTKL+1,X + LDY IPY JMP DROP CSHLEND ; LDA #<LB LDX #>LB LDY #(CLBEND-CLB) JSR OPCPY CLB LDA ESTKL,X STA ESTKH-1,X LDA (ESTKH-1,X) STA ESTKL,X STZ ESTKH,X JMP NEXTOP CLBEND ; LDA #<LBX LDX #>LBX LDY #(CLBXEND-CLBX) JSR OPCPY CLBX LDA ESTKL,X STA ESTKH-1,X STA ALTRDOFF LDA (ESTKH-1,X) STA ESTKL,X STZ ESTKH,X STA ALTRDON JMP NEXTOP CLBXEND ; LDA #<LLB LDX #>LLB LDY #(CLLBEND-CLLB) JSR OPCPY CLLB INY ;+INC_IP LDA (IP),Y STY IPY TAY DEX LDA (IFP),Y STA ESTKL,X STZ ESTKH,X LDY IPY JMP NEXTOP CLLBEND ; LDA #<LLBX LDX #>LLBX LDY #(CLLBXEND-CLLBX) JSR OPCPY CLLBX INY ;+INC_IP LDA (IP),Y STY IPY TAY DEX STA ALTRDOFF LDA (IFP),Y STA ESTKL,X STZ ESTKH,X STA ALTRDON LDY IPY JMP NEXTOP CLLBXEND ; LDA #<LAB LDX #>LAB LDY #(CLABEND-CLAB) JSR OPCPY CLAB INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH LDA (TMP) DEX STA ESTKL,X STZ ESTKH,X JMP NEXTOP CLABEND ; LDA #<LAW LDX #>LAW LDY #(CLAWEND-CLAW) JSR OPCPY CLAW INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH STY IPY LDA (TMP) DEX STA ESTKL,X LDY #$01 LDA (TMP),Y STA ESTKH,X LDY IPY JMP NEXTOP CLAWEND ; LDA #<LABX LDX #>LABX LDY #(CLABXEND-CLABX) JSR OPCPY CLABX INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH STA ALTRDOFF LDA (TMP) DEX STA ESTKL,X STZ ESTKH,X STA ALTRDON JMP NEXTOP CLABXEND ; LDA #<LAWX LDX #>LAWX LDY #(CLAWXEND-CLAWX) JSR OPCPY CLAWX INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH STY IPY STA ALTRDOFF LDA (TMP) DEX STA ESTKL,X LDY #$01 LDA (TMP),Y STA ESTKH,X STA ALTRDON LDY IPY JMP NEXTOP CLAWXEND ; LDA #<SAW LDX #>SAW LDY #(CSAWEND-CSAW) JSR OPCPY CSAW INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH STY IPY LDA ESTKL,X STA (TMP) LDY #$01 LDA ESTKH,X STA (TMP),Y LDY IPY BMI + JMP DROP + JMP FIXDROP CSAWEND ; LDA #<DAW LDX #>DAW LDY #(CDAWEND-CDAW) JSR OPCPY CDAW INY ;+INC_IP LDA (IP),Y STA TMPL INY ;+INC_IP LDA (IP),Y STA TMPH STY IPY LDA ESTKL,X STA (TMP) LDY #$01 LDA ESTKH,X STA (TMP),Y LDY IPY JMP NEXTOP CDAWEND ; LDA #<DAB LDX #>DAB LDY #(CDABEND-CDAB) JSR OPCPY CDAB INY ;+INC_IP LDA (IP),Y STA ESTKH-2,X INY ;+INC_IP LDA (IP),Y STA ESTKH-1,X LDA ESTKL,X STA (ESTKH-2,X) STZ ESTKH,X JMP NEXTOP CDABEND ; LDA #<DLB LDX #>DLB LDY #(CDLBEND-CDLB) JSR OPCPY CDLB INY ;+INC_IP LDA (IP),Y STY IPY TAY LDA ESTKL,X STA (IFP),Y STZ ESTKH,X LDY IPY JMP NEXTOP CDLBEND ; LDA #<ISFLS LDX #>ISFLS LDY #(CISFLSEND-CISFLS) JSR OPCPY CISFLS STZ ESTKL+1,X STZ ESTKH+1,X JMP DROP CISFLSEND ; LDA #<BRNCH LDX #>BRNCH LDY #(CBRNCHEND-CBRNCH) JSR OPCPY CBRNCH TYA ; FLATTEN IP SEC ADC IPL STA TMPL LDA #$00 ADC IPH STA TMPH ; ADD BRANCH OFFSET LDA (TMP) ;CLC ; BETTER NOT CARRY OUT OF IP+Y ADC TMPL STA IPL LDY #$01 LDA (TMP),Y ADC TMPH STA IPH DEY JMP FETCHOP CBRNCHEND ; LDA #<ENTERX LDX #>ENTERX LDY #(CENTERXEND-CENTERX) JSR OPCPY CENTERX PLY ; KEEP PSR ON TOP OF STACK LDA IFPH PHA ; SAVE ON STACK FOR LEAVE LDA IFPL PHA PHY LDA PPL ; ALLOCATE FRAME LDY #$01 SEC SBC (IP),Y STA PPL STA IFPL LDA PPH SBC #$00 STA PPH STA IFPH INY LDA (IP),Y BEQ + ASL TAY - LDA ESTKH,X DEY STA (IFP),Y LDA ESTKL,X INX DEY STA (IFP),Y BNE - + LDY #$03 JMP FETCHOP CENTERXEND ; RTS ;* ;* COPY OP TO VM ;* OPCPY STA DST STX DST+1 PLA STA SRC PLA STA SRC+1 TYA CLC ADC SRC TAX LDA #$00 ADC SRC+1 PHA PHX INC SRC BNE + INC SRC+1 + DEY - LDA (SRC),Y STA (DST),Y DEY BPL - RTS
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <Workspace version = "1.0"> <FileRef location = "self:BMI.xcodeproj"> </FileRef> </Workspace>
{ "pile_set_name": "Github" }
// Copyright (C) 2011 PAL Robotics S.L. All rights reserved. // Copyright (C) 2007-2008 Ruben Smits <ruben dot smits at mech dot kuleuven dot be> // Copyright (C) 2008 Mikael Mayer // Copyright (C) 2008 Julia Jesse // Version: 1.0 // Author: Marcus Liebhardt // This class has been derived from the KDL::TreeIkSolverPos_NR_JL class // by Julia Jesse, Mikael Mayer and Ruben Smits // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #ifndef KDLTREEIKSOLVERPOS_ONLINE_HPP #define KDLTREEIKSOLVERPOS_ONLINE_HPP #include <vector> #include <string> #include "treeiksolver.hpp" #include "treefksolver.hpp" namespace KDL { /** * Implementation of a general inverse position kinematics algorithm to calculate the position transformation from * Cartesian to joint space of a general KDL::Tree. This class has been derived from the TreeIkSolverPos_NR_JL class, * but was modified for online solving for use in realtime systems. Thus, the calculation is only done once, * meaning that no iteration is done, because this solver is intended to run at a high frequency. * It enforces velocity limits in task as well as in joint space. It also takes joint limits into account. * * @ingroup KinematicFamily */ class TreeIkSolverPos_Online: public TreeIkSolverPos { public: /** * Constructor of the solver, it needs the number of joints of the tree, a list of the endpoints * you are interested in, the maximum and minimum values you want to enforce and a forward position kinematics * solver as well as an inverse velocity kinematics solver for the calculations * * @param nr_of_jnts number of joints of the tree to calculate the joint positions for * @param endpoints the list of endpoints you are interested in * @param q_min the minimum joint positions * @param q_max the maximum joint positions * @param q_dot_max the maximum joint velocities * @param x_dot_trans_max the maximum translational velocity of your endpoints * @param x_dot_rot_max the maximum rotational velocity of your endpoints * @param fksolver a forward position kinematics solver * @param iksolver an inverse velocity kinematics solver * * @return */ TreeIkSolverPos_Online(const double& nr_of_jnts, const std::vector<std::string>& endpoints, const JntArray& q_min, const JntArray& q_max, const JntArray& q_dot_max, const double x_dot_trans_max, const double x_dot_rot_max, TreeFkSolverPos& fksolver, TreeIkSolverVel& iksolver); ~TreeIkSolverPos_Online(); virtual double CartToJnt(const JntArray& q_in, const Frames& p_in, JntArray& q_out); private: /** * Scales the class member KDL::JntArray q_dot_, if one (or more) joint velocity exceeds the maximum value. * Scaling is done proportional to the biggest overshoot among all joint velocities. */ void enforceJointVelLimits(); /** * Scales translational and rotational velocity vectors of the class member KDL::Twist twist_, * if at least one of both exceeds the maximum value/length. * Scaling is done proportional to the biggest overshoot among both velocities. */ void enforceCartVelLimits(); JntArray q_min_; JntArray q_max_; JntArray q_dot_max_; double x_dot_trans_max_; double x_dot_rot_max_; TreeFkSolverPos& fksolver_; TreeIkSolverVel& iksolver_; JntArray q_dot_; Twist twist_; Frames frames_; Twists delta_twists_; }; } // namespace #endif /* KDLTREEIKSOLVERPOS_ONLINE_HPP */
{ "pile_set_name": "Github" }