answer
stringlengths
15
1.25M
package org.knowm.xchange.dsx.dto.trade; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; import org.knowm.xchange.dsx.dto.DSXReturn; /** @author Mikhail Wall */ public class <API key> extends DSXReturn<Map<Long, <API key>>> { public <API key>( @JsonProperty("success") boolean success, @JsonProperty("return") Map<Long, <API key>> value, @JsonProperty("error") String error) { super(success, value, error); } }
<?php namespace Sabre\CardDAV; use Sabre\HTTP; use Sabre\DAV; require_once 'Sabre/HTTP/ResponseMock.php'; class MultiGetTest extends AbstractPluginTest { function testMultiGet() { $request = HTTP\Sapi::<API key>([ 'REQUEST_METHOD' => 'REPORT', 'REQUEST_URI' => '/addressbooks/user1/book1', ]); $request->setBody( '<?xml version="1.0"?> <c:<API key> xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> <d:prop> <d:getetag /> <c:address-data /> </d:prop> <d:href>/addressbooks/user1/book1/card1</d:href> </c:<API key>>' ); $response = new HTTP\ResponseMock(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; $this->server->exec(); $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); $result = $client->parseMultiStatus($response->body); $this->assertEquals([ '/addressbooks/user1/book1/card1' => [ 200 => [ '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"', '{urn:ietf:params:xml:ns:carddav}address-data' => "BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD", ] ] ], $result); } function testMultiGetVCard4() { $request = HTTP\Sapi::<API key>([ 'REQUEST_METHOD' => 'REPORT', 'REQUEST_URI' => '/addressbooks/user1/book1', ]); $request->setBody( '<?xml version="1.0"?> <c:<API key> xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav"> <d:prop> <d:getetag /> <c:address-data content-type="text/vcard" version="4.0" /> </d:prop> <d:href>/addressbooks/user1/book1/card1</d:href> </c:<API key>>' ); $response = new HTTP\ResponseMock(); $this->server->httpRequest = $request; $this->server->httpResponse = $response; $this->server->exec(); $this->assertEquals(207, $response->status, 'Incorrect status code. Full response body:' . $response->body); // using the client for parsing $client = new DAV\Client(['baseUri' => '/']); $result = $client->parseMultiStatus($response->body); $prodId = "PRODID:- $this->assertEquals([ '/addressbooks/user1/book1/card1' => [ 200 => [ '{DAV:}getetag' => '"' . md5("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD") . '"', '{urn:ietf:params:xml:ns:carddav}address-data' => "BEGIN:VCARD\r\nVERSION:4.0\r\n$prodId\r\nUID:12345\r\nEND:VCARD\r\n", ] ] ], $result); } }
<?php namespace Kunstmaan\NodeBundle\Twig; use Kunstmaan\NodeBundle\Helper\URLHelper; class <API key> extends \Twig_Extension { /** * @var URLHelper */ private $urlHelper; /** * @param URLHelper $urlHelper */ public function __construct(URLHelper $urlHelper) { $this->urlHelper = $urlHelper; } /** * @return array */ public function getFilters() { return array( new \Twig_SimpleFilter('replace_url', array($this, 'replaceUrl')) ); } public function replaceUrl($text) { return $this->urlHelper->replaceUrl($text); } }
#include "unwind_i.h" #include "offsets.h" #include "ex_tables.h" #include <signal.h> #define arm_exidx_step UNW_OBJ(arm_exidx_step) static inline int arm_exidx_step (struct cursor *c) { unw_word_t old_ip, old_cfa; uint8_t buf[32]; int ret; old_ip = c->dwarf.ip; old_cfa = c->dwarf.cfa; /* mark PC unsaved */ c->dwarf.loc[UNW_ARM_R15] = DWARF_NULL_LOC; if ((ret = tdep_find_proc_info (&c->dwarf, c->dwarf.ip, 1)) < 0) return ret; if (c->dwarf.pi.format != <API key>) return -UNW_ENOINFO; ret = arm_exidx_extract (&c->dwarf, buf); if (ret == -UNW_ESTOPUNWIND) return 0; else if (ret < 0) return ret; ret = arm_exidx_decode (buf, ret, &c->dwarf); if (ret < 0) return ret; if (c->dwarf.ip == old_ip && c->dwarf.cfa == old_cfa) { Dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n", __FUNCTION__, (long) c->dwarf.ip); return -UNW_EBADFRAME; } return (c->dwarf.ip == 0) ? 0 : 1; } PROTECTED int <API key> (unw_cursor_t *cursor) { struct cursor *c = (struct cursor *) cursor; int ret; unw_word_t sc_addr, sp, sp_addr = c->dwarf.cfa; struct dwarf_loc sp_loc = DWARF_LOC (sp_addr, 0); if ((ret = dwarf_get (&c->dwarf, sp_loc, &sp)) < 0) return -UNW_EUNSPEC; /* Obtain signal frame type (non-RT or RT). */ ret = unw_is_signal_frame (cursor); /* Save the SP and PC to be able to return execution at this point later in time (unw_resume). */ c->sigcontext_sp = c->dwarf.cfa; c->sigcontext_pc = c->dwarf.ip; /* Since kernel version 2.6.18 the non-RT signal frame starts with a ucontext while the RT signal frame starts with a siginfo, followed by a sigframe whose first element is an ucontext. Prior 2.6.18 the non-RT signal frame starts with a sigcontext while the RT signal frame starts with two pointers followed by a siginfo and an ucontext. The first pointer points to the start of the siginfo structure and the second one to the ucontext structure. */ if (ret == 1) { /* Handle non-RT signal frames. Check if the first word on the stack is the magic number. */ if (sp == 0x5ac3c35a) { c->sigcontext_format = <API key>; sc_addr = sp_addr + <API key>; } else { c->sigcontext_format = <API key>; sc_addr = sp_addr; } c->sigcontext_addr = sp_addr; } else if (ret == 2) { /* Handle RT signal frames. Check if the first word on the stack is a pointer to the siginfo structure. */ if (sp == sp_addr + 8) { c->sigcontext_format = <API key>; c->sigcontext_addr = sp_addr + 8 + sizeof (siginfo_t); } else { c->sigcontext_format = <API key>; c->sigcontext_addr = sp_addr + sizeof (siginfo_t); } sc_addr = c->sigcontext_addr + <API key>; } else return -UNW_EUNSPEC; /* Update the dwarf cursor. Set the location of the registers to the corresponding addresses of the uc_mcontext / sigcontext structure contents. */ c->dwarf.loc[UNW_ARM_R0] = DWARF_LOC (sc_addr + LINUX_SC_R0_OFF, 0); c->dwarf.loc[UNW_ARM_R1] = DWARF_LOC (sc_addr + LINUX_SC_R1_OFF, 0); c->dwarf.loc[UNW_ARM_R2] = DWARF_LOC (sc_addr + LINUX_SC_R2_OFF, 0); c->dwarf.loc[UNW_ARM_R3] = DWARF_LOC (sc_addr + LINUX_SC_R3_OFF, 0); c->dwarf.loc[UNW_ARM_R4] = DWARF_LOC (sc_addr + LINUX_SC_R4_OFF, 0); c->dwarf.loc[UNW_ARM_R5] = DWARF_LOC (sc_addr + LINUX_SC_R5_OFF, 0); c->dwarf.loc[UNW_ARM_R6] = DWARF_LOC (sc_addr + LINUX_SC_R6_OFF, 0); c->dwarf.loc[UNW_ARM_R7] = DWARF_LOC (sc_addr + LINUX_SC_R7_OFF, 0); c->dwarf.loc[UNW_ARM_R8] = DWARF_LOC (sc_addr + LINUX_SC_R8_OFF, 0); c->dwarf.loc[UNW_ARM_R9] = DWARF_LOC (sc_addr + LINUX_SC_R9_OFF, 0); c->dwarf.loc[UNW_ARM_R10] = DWARF_LOC (sc_addr + LINUX_SC_R10_OFF, 0); c->dwarf.loc[UNW_ARM_R11] = DWARF_LOC (sc_addr + LINUX_SC_FP_OFF, 0); c->dwarf.loc[UNW_ARM_R12] = DWARF_LOC (sc_addr + LINUX_SC_IP_OFF, 0); c->dwarf.loc[UNW_ARM_R13] = DWARF_LOC (sc_addr + LINUX_SC_SP_OFF, 0); c->dwarf.loc[UNW_ARM_R14] = DWARF_LOC (sc_addr + LINUX_SC_LR_OFF, 0); c->dwarf.loc[UNW_ARM_R15] = DWARF_LOC (sc_addr + LINUX_SC_PC_OFF, 0); /* Set SP/CFA and PC/IP. */ dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R13], &c->dwarf.cfa); dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R15], &c->dwarf.ip); return 1; } PROTECTED int unw_step (unw_cursor_t *cursor) { struct cursor *c = (struct cursor *) cursor; int ret = -UNW_EUNSPEC; Debug (1, "(cursor=%p)\n", c); /* Check if this is a signal frame. */ if (unw_is_signal_frame (cursor)) return <API key> (cursor); #ifdef CONFIG_DEBUG_FRAME /* First, try DWARF-based unwinding. */ if (UNW_TRY_METHOD(<API key>)) { ret = dwarf_step (&c->dwarf); Debug(1, "dwarf_step()=%d\n", ret); if (likely (ret > 0)) return 1; else if (unlikely (ret == -UNW_ESTOPUNWIND)) return ret; if (ret < 0 && ret != -UNW_ENOINFO) { Debug (2, "returning %d\n", ret); return ret; } } #endif /* CONFIG_DEBUG_FRAME */ /* Next, try extbl-based unwinding. */ if (UNW_TRY_METHOD (<API key>)) { ret = arm_exidx_step (c); if (ret > 0) return 1; if (ret == -UNW_ESTOPUNWIND || ret == 0) return ret; } /* Fall back on APCS frame parsing. Note: This won't work in case the ARM EABI is used. */ if (unlikely (ret < 0)) { if (UNW_TRY_METHOD(<API key>)) { ret = UNW_ESUCCESS; /* DWARF unwinding failed, try to follow APCS/optimized APCS frame chain */ unw_word_t instr, i; Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret); dwarf_loc_t ip_loc, fp_loc; unw_word_t frame; /* Mark all registers unsaved, since we don't know where they are saved (if at all), except for the EBP and EIP. */ if (dwarf_get(&c->dwarf, c->dwarf.loc[UNW_ARM_R11], &frame) < 0) { return 0; } for (i = 0; i < <API key>; ++i) { c->dwarf.loc[i] = DWARF_NULL_LOC; } if (frame) { if (dwarf_get(&c->dwarf, DWARF_LOC(frame, 0), &instr) < 0) { return 0; } instr -= 8; if (dwarf_get(&c->dwarf, DWARF_LOC(instr, 0), &instr) < 0) { return 0; } if ((instr & 0xFFFFD800) == 0xE92DD800) { /* Standard APCS frame. */ ip_loc = DWARF_LOC(frame - 4, 0); fp_loc = DWARF_LOC(frame - 12, 0); } else { /* Codesourcery optimized normal frame. */ ip_loc = DWARF_LOC(frame, 0); fp_loc = DWARF_LOC(frame - 4, 0); } if (dwarf_get(&c->dwarf, ip_loc, &c->dwarf.ip) < 0) { return 0; } c->dwarf.loc[UNW_ARM_R12] = ip_loc; c->dwarf.loc[UNW_ARM_R11] = fp_loc; Debug(15, "ip=%lx\n", c->dwarf.ip); } else { ret = -UNW_ENOINFO; } } } return ret == -UNW_ENOINFO ? 0 : 1; }
#!/bin/bash FN="pd.atdschip.tiling_0.32.0.tar.gz" URLS=( "https://bioconductor.org/packages/3.14/data/experiment/src/contrib/pd.atdschip.tiling_0.32.0.tar.gz" "https://bioarchive.galaxyproject.org/pd.atdschip.tiling_0.32.0.tar.gz" "https://depot.galaxyproject.org/software/bioconductor-pd.atdschip.tiling/bioconductor-pd.atdschip.tiling_0.32.0_src_all.tar.gz" ) MD5="<API key>" # Use a staging area in the conda dir rather than temp dirs, both to avoid # manner. STAGING=$PREFIX/share/$PKG_NAME-$PKG_VERSION-$PKG_BUILDNUM mkdir -p $STAGING TARBALL=$STAGING/$FN SUCCESS=0 for URL in ${URLS[@]}; do curl $URL > $TARBALL [[ $? == 0 ]] || continue # Platform-specific md5sum checks. if [[ $(uname -s) == "Linux" ]]; then if md5sum -c <<<"$MD5 $TARBALL"; then SUCCESS=1 break fi else if [[ $(uname -s) == "Darwin" ]]; then if [[ $(md5 $TARBALL | cut -f4 -d " ") == "$MD5" ]]; then SUCCESS=1 break fi fi fi done if [[ $SUCCESS != 1 ]]; then echo "ERROR: post-link.sh was unable to download any of the following URLs with the md5sum $MD5:" printf '%s\n' "${URLS[@]}" exit 1 fi # Install and clean up R CMD INSTALL --library=$PREFIX/lib/R/library $TARBALL rm $TARBALL rmdir $STAGING
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment") require 'test_help'
// copy, modify, and distribute this software in source code or binary form for use // in connection with the web services and APIs provided by Facebook. // As with any software that integrates with the Facebook platform, your use of // this software is subject to the Facebook Developer Principles and Policies // included in all copies or substantial portions of the software. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // 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 <Foundation/Foundation.h> <API key> /** AccountKit application settings. */ @interface AKFSettings : NSObject /** Get the Account Kit Client Token used by the SDK. If not explicitly set, the default will be read from the application's plist (<API key>). */ + (NSString *)clientToken; /** Set the Account Kit Client Token used by the SDK. - Parameter clientToken: The Account Kit Client Token to be used by the SDK. */ + (void)setClientToken:(NSString *)clientToken; @end <API key>
using System; using System.Collections; using System.Collections.Generic; using System.Text; namespace Microsoft.Protocols.TestTools.StackSdk.Messages.Marshaling { <summary> Token </summary> public class Token : IToken { private string text; private TokenType type; <summary> Constructor </summary> <param name="type">Token type</param> public Token(TokenType type) { this.type = type; } <summary> Constructor </summary> <param name="type">Token type</param> <param name="text">Token text</param> public Token(TokenType type, string text) { this.type = type; this.text = text; } <summary> Token text </summary> public string Text { get { return text; } set { text = value; } } <summary> Token type </summary> public virtual TokenType Type { get { return type; } set { this.type = value; } } } }
#include "wrapper_common.h" #include "cblas.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Capability is supported if >0 Actual number can be increased over time to indicate extensions/revisions (that do not break compatibility) */ DLLEXPORT int query_capability(const int capability) { switch (capability) { // SANITY CHECKS case 0: return 0; case 1: return -1; // PLATFORM case 8: #ifdef _M_IX86 return 1; #else return 0; #endif case 9: #ifdef _M_X64 return 1; #else return 0; #endif case 10: #ifdef _M_IA64 return 1; #else return 0; #endif // COMMON/SHARED case 64: return 1; // revision case 66: return 1; // threading control // LINEAR ALGEBRA case 128: return 1; // basic dense linear algebra (major - breaking) case 129: return 0; // basic dense linear algebra (minor - non-breaking) default: return 0; // unknown or not supported } } DLLEXPORT void set_max_threads(const blasint num_threads) { <API key>(num_threads); } DLLEXPORT char* get_build_config() { return openblas_get_config(); } DLLEXPORT char* get_cpu_core() { return <API key>(); } DLLEXPORT int get_parallel_type() { return <API key>(); } #ifdef __cplusplus } #endif /* __cplusplus */
'use strict'; // Load modules const Http = require('http'); const Stream = require('stream'); // Declare internals const internals = {}; exports = module.exports = class Response extends Http.ServerResponse { constructor(req, onEnd) { super({ method: req.method, httpVersionMajor: 1, httpVersionMinor: 1 }); this._shot = { headers: null, trailers: {}, payloadChunks: [] }; this._headers = {}; // This forces node@8 to always render the headers this.assignSocket(internals.nullSocket()); this.once('finish', () => { const res = internals.payload(this); res.raw.req = req; process.nextTick(() => onEnd(res)); }); } writeHead() { const result = super.writeHead.apply(this, arguments); this._shot.headers = Object.assign({}, this._headers); // Should be .getHeaders() since node v7.7 // Add raw headers ['Date', 'Connection', 'Transfer-Encoding'].forEach((name) => { const regex = new RegExp('\\r\\n' + name + ': ([^\\r]*)\\r\\n'); const field = this._header.match(regex); if (field) { this._shot.headers[name.toLowerCase()] = field[1]; } }); return result; } write(data, encoding, callback) { super.write(data, encoding, callback); this._shot.payloadChunks.push(new Buffer(data, encoding)); return true; // Write always returns false when disconnected } end(data, encoding, callback) { if (data) { this.write(data, encoding); } super.end(callback); this.emit('finish'); } destroy() { } addTrailers(trailers) { for (const key in trailers) { this._shot.trailers[key.toLowerCase().trim()] = trailers[key].toString().trim(); } } }; internals.payload = function (response) { // Prepare response object const res = { raw: { res: response }, headers: response._shot.headers, statusCode: response.statusCode, statusMessage: response.statusMessage, trailers: {} }; // Prepare payload and trailers const rawBuffer = Buffer.concat(response._shot.payloadChunks); res.rawPayload = rawBuffer; res.payload = rawBuffer.toString(); res.trailers = response._shot.trailers; return res; }; // Throws away all written data to prevent response from buffering payload internals.nullSocket = function () { return new Stream.Writable({ write(chunk, encoding, callback) { setImmediate(callback); } }); };
#if !defined(__mips_soft_float) && __mips >= 2 #include <math.h> float sqrtf(float x) { float r; __asm__("sqrt.s %0,%1" : "=f"(r) : "f"(x)); return r; } #else #include "../sqrtf.c" #endif
var chownr = require('chownr') var tar = require('tar-stream') var pump = require('pump') var mkdirp = require('mkdirp') var fs = require('fs') var path = require('path') var os = require('os') var win32 = os.platform() === 'win32' var noop = function () {} var echo = function (name) { return name } var normalize = !win32 ? echo : function (name) { return name.replace(/\\/g, '/').replace(/[:?<>|]/g, '_') } var statAll = function (fs, stat, cwd, ignore, entries, sort) { var queue = entries || ['.'] return function loop (callback) { if (!queue.length) return callback() var next = queue.shift() var nextAbs = path.join(cwd, next) stat(nextAbs, function (err, stat) { if (err) return callback(err) if (!stat.isDirectory()) return callback(null, next, stat) fs.readdir(nextAbs, function (err, files) { if (err) return callback(err) if (sort) files.sort() for (var i = 0; i < files.length; i++) { if (!ignore(path.join(cwd, next, files[i]))) queue.push(path.join(next, files[i])) } callback(null, next, stat) }) }) } } var strip = function (map, level) { return function (header) { header.name = header.name.split('/').slice(level).join('/') var linkname = header.linkname if (linkname && (header.type === 'link' || path.isAbsolute(linkname))) { header.linkname = linkname.split('/').slice(level).join('/') } return map(header) } } exports.pack = function (cwd, opts) { if (!cwd) cwd = '.' if (!opts) opts = {} var xfs = opts.fs || fs var ignore = opts.ignore || opts.filter || noop var map = opts.map || noop var mapStream = opts.mapStream || echo var statNext = statAll(xfs, opts.dereference ? xfs.stat : xfs.lstat, cwd, ignore, opts.entries, opts.sort) var strict = opts.strict !== false var umask = typeof opts.umask === 'number' ? ~opts.umask : ~processUmask() var dmode = typeof opts.dmode === 'number' ? opts.dmode : 0 var fmode = typeof opts.fmode === 'number' ? opts.fmode : 0 var pack = opts.pack || tar.pack() var finish = opts.finish || noop if (opts.strip) map = strip(map, opts.strip) if (opts.readable) { dmode |= parseInt(555, 8) fmode |= parseInt(444, 8) } if (opts.writable) { dmode |= parseInt(333, 8) fmode |= parseInt(222, 8) } var onsymlink = function (filename, header) { xfs.readlink(path.join(cwd, filename), function (err, linkname) { if (err) return pack.destroy(err) header.linkname = normalize(linkname) pack.entry(header, onnextentry) }) } var onstat = function (err, filename, stat) { if (err) return pack.destroy(err) if (!filename) { if (opts.finalize !== false) pack.finalize() return finish(pack) } if (stat.isSocket()) return onnextentry() // tar does not support sockets... var header = { name: normalize(filename), mode: (stat.mode | (stat.isDirectory() ? dmode : fmode)) & umask, mtime: stat.mtime, size: stat.size, type: 'file', uid: stat.uid, gid: stat.gid } if (stat.isDirectory()) { header.size = 0 header.type = 'directory' header = map(header) || header return pack.entry(header, onnextentry) } if (stat.isSymbolicLink()) { header.size = 0 header.type = 'symlink' header = map(header) || header return onsymlink(filename, header) } // TODO: add fifo etc... header = map(header) || header if (!stat.isFile()) { if (strict) return pack.destroy(new Error('unsupported type for ' + filename)) return onnextentry() } var entry = pack.entry(header, onnextentry) if (!entry) return var rs = mapStream(xfs.createReadStream(path.join(cwd, filename)), header) rs.on('error', function (err) { // always forward errors on destroy entry.destroy(err) }) pump(rs, entry) } var onnextentry = function (err) { if (err) return pack.destroy(err) statNext(onstat) } onnextentry() return pack } var head = function (list) { return list.length ? list[list.length - 1] : null } var processGetuid = function () { return process.getuid ? process.getuid() : -1 } var processUmask = function () { return process.umask ? process.umask() : 0 } exports.extract = function (cwd, opts) { if (!cwd) cwd = '.' if (!opts) opts = {} var xfs = opts.fs || fs var ignore = opts.ignore || opts.filter || noop var map = opts.map || noop var mapStream = opts.mapStream || echo var own = opts.chown !== false && !win32 && processGetuid() === 0 var extract = opts.extract || tar.extract() var stack = [] var now = new Date() var umask = typeof opts.umask === 'number' ? ~opts.umask : ~processUmask() var dmode = typeof opts.dmode === 'number' ? opts.dmode : 0 var fmode = typeof opts.fmode === 'number' ? opts.fmode : 0 var strict = opts.strict !== false if (opts.strip) map = strip(map, opts.strip) if (opts.readable) { dmode |= parseInt(555, 8) fmode |= parseInt(444, 8) } if (opts.writable) { dmode |= parseInt(333, 8) fmode |= parseInt(222, 8) } var utimesParent = function (name, cb) { // we just set the mtime on the parent dir again everytime we write an entry var top while ((top = head(stack)) && name.slice(0, top[0].length) !== top[0]) stack.pop() if (!top) return cb() xfs.utimes(top[0], now, top[1], cb) } var utimes = function (name, header, cb) { if (opts.utimes === false) return cb() if (header.type === 'directory') return xfs.utimes(name, now, header.mtime, cb) if (header.type === 'symlink') return utimesParent(name, cb) // TODO: how to set mtime on link? xfs.utimes(name, now, header.mtime, function (err) { if (err) return cb(err) utimesParent(name, cb) }) } var chperm = function (name, header, cb) { var link = header.type === 'symlink' var chmod = link ? xfs.lchmod : xfs.chmod var chown = link ? xfs.lchown : xfs.chown if (!chmod) return cb() var mode = (header.mode | (header.type === 'directory' ? dmode : fmode)) & umask chmod(name, mode, function (err) { if (err) return cb(err) if (!own) return cb() if (!chown) return cb() chown(name, header.uid, header.gid, cb) }) } extract.on('entry', function (header, stream, next) { header = map(header) || header header.name = normalize(header.name) var name = path.join(cwd, path.join('/', header.name)) if (ignore(name, header)) { stream.resume() return next() } var stat = function (err) { if (err) return next(err) utimes(name, header, function (err) { if (err) return next(err) if (win32) return next() chperm(name, header, next) }) } var onsymlink = function () { if (win32) return next() // skip symlinks on win for now before it can be tested xfs.unlink(name, function () { xfs.symlink(header.linkname, name, stat) }) } var onlink = function () { if (win32) return next() // skip links on win for now before it can be tested xfs.unlink(name, function () { var srcpath = path.join(cwd, path.join('/', header.linkname)) xfs.link(srcpath, name, function (err) { if (err && err.code === 'EPERM' && opts.<API key>) { stream = xfs.createReadStream(srcpath) return onfile() } stat(err) }) }) } var onfile = function () { var ws = xfs.createWriteStream(name) var rs = mapStream(stream, header) ws.on('error', function (err) { // always forward errors on destroy rs.destroy(err) }) pump(rs, ws, function (err) { if (err) return next(err) ws.on('close', stat) }) } if (header.type === 'directory') { stack.push([name, header.mtime]) return mkdirfix(name, { fs: xfs, own: own, uid: header.uid, gid: header.gid }, stat) } var dir = path.dirname(name) validate(xfs, dir, path.join(cwd, '.'), function (err, valid) { if (err) return next(err) if (!valid) return next(new Error(dir + ' is not a valid path')) mkdirfix(dir, { fs: xfs, own: own, uid: header.uid, gid: header.gid }, function (err) { if (err) return next(err) switch (header.type) { case 'file': return onfile() case 'link': return onlink() case 'symlink': return onsymlink() } if (strict) return next(new Error('unsupported type for ' + name + ' (' + header.type + ')')) stream.resume() next() }) }) }) if (opts.finish) extract.on('finish', opts.finish) return extract } function validate (fs, name, root, cb) { if (name === root) return cb(null, true) fs.lstat(name, function (err, st) { if (err && err.code !== 'ENOENT') return cb(err) if (err || st.isDirectory()) return validate(fs, path.join(name, '..'), root, cb) cb(null, false) }) } function mkdirfix (name, opts, cb) { mkdirp(name, {fs: opts.fs}, function (err, made) { if (!err && made && opts.own) { chownr(made, opts.uid, opts.gid, cb) } else { cb(err) } }) }
class <API key> < ActiveRecord::Migration def change add_column :users, :<API key>, :boolean, default: true add_column :users, :<API key>, :integer end end
<?php defined('BASEPATH') OR exit('No direct script access allowed'); abstract class CI_DB_forge { /** * Database object * * @var object */ protected $db; /** * Fields data * * @var array */ public $fields = array(); /** * Keys data * * @var array */ public $keys = array(); /** * Primary Keys data * * @var array */ public $primary_keys = array(); /** * Database character set * * @var string */ public $db_char_set = ''; /** * CREATE DATABASE statement * * @var string */ protected $_create_database = 'CREATE DATABASE %s'; /** * DROP DATABASE statement * * @var string */ protected $_drop_database = 'DROP DATABASE %s'; /** * CREATE TABLE statement * * @var string */ protected $_create_table = "%s %s (%s\n)"; /** * CREATE TABLE IF statement * * @var string */ protected $_create_table_if = 'CREATE TABLE IF NOT EXISTS'; /** * CREATE TABLE keys flag * * Whether table keys are created from within the * CREATE TABLE statement. * * @var bool */ protected $_create_table_keys = FALSE; /** * DROP TABLE IF EXISTS statement * * @var string */ protected $_drop_table_if = 'DROP TABLE IF EXISTS'; /** * RENAME TABLE statement * * @var string */ protected $_rename_table = 'ALTER TABLE %s RENAME TO %s;'; /** * UNSIGNED support * * @var bool|array */ protected $_unsigned = TRUE; /** * NULL value representation in CREATE/ALTER TABLE statements * * @var string */ protected $_null = ''; /** * DEFAULT value representation in CREATE/ALTER TABLE statements * * @var string */ protected $_default = ' DEFAULT '; /** * Class constructor * * @param object &$db Database object * @return void */ public function __construct(&$db) { $this->db =& $db; log_message('info', 'Database Forge Class Initialized'); } /** * Create database * * @param string $db_name * @return bool */ public function create_database($db_name) { if ($this->_create_database === FALSE) { return ($this->db->db_debug) ? $this->db->display_error('<API key>') : FALSE; } elseif ( ! $this->db->query(sprintf($this->_create_database, $db_name, $this->db->char_set, $this->db->dbcollat))) { return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; } if ( ! empty($this->db->data_cache['db_names'])) { $this->db->data_cache['db_names'][] = $db_name; } return TRUE; } /** * Drop database * * @param string $db_name * @return bool */ public function drop_database($db_name) { if ($this->_drop_database === FALSE) { return ($this->db->db_debug) ? $this->db->display_error('<API key>') : FALSE; } elseif ( ! $this->db->query(sprintf($this->_drop_database, $db_name))) { return ($this->db->db_debug) ? $this->db->display_error('db_unable_to_drop') : FALSE; } if ( ! empty($this->db->data_cache['db_names'])) { $key = array_search(strtolower($db_name), array_map('strtolower', $this->db->data_cache['db_names']), TRUE); if ($key !== FALSE) { unset($this->db->data_cache['db_names'][$key]); } } return TRUE; } /** * Add Key * * @param string $key * @param bool $primary * @return CI_DB_forge */ public function add_key($key, $primary = FALSE) { // DO NOT change this! This condition is only applicable // for PRIMARY keys because you can only have one such, // and therefore all fields you add to it will be included // in the same, composite PRIMARY KEY. // It's not the same for regular indexes. if ($primary === TRUE && is_array($key)) { foreach ($key as $one) { $this->add_key($one, $primary); } return $this; } if ($primary === TRUE) { $this->primary_keys[] = $key; } else { $this->keys[] = $key; } return $this; } /** * Add Field * * @param array $field * @return CI_DB_forge */ public function add_field($field) { if (is_string($field)) { if ($field === 'id') { $this->add_field(array( 'id' => array( 'type' => 'INT', 'constraint' => 9, 'auto_increment' => TRUE ) )); $this->add_key('id', TRUE); } else { if (strpos($field, ' ') === FALSE) { show_error('Field information is required for that operation.'); } $this->fields[] = $field; } } if (is_array($field)) { $this->fields = array_merge($this->fields, $field); } return $this; } /** * Create Table * * @param string $table Table name * @param bool $if_not_exists Whether to add IF NOT EXISTS condition * @param array $attributes Associative array of table attributes * @return bool */ public function create_table($table, $if_not_exists = FALSE, array $attributes = array()) { if ($table === '') { show_error('A table name is required for that operation.'); } else { $table = $this->db->dbprefix.$table; } if (count($this->fields) === 0) { show_error('Field information is required.'); } $sql = $this->_create_table($table, $if_not_exists, $attributes); if (is_bool($sql)) { $this->_reset(); if ($sql === FALSE) { return ($this->db->db_debug) ? $this->db->display_error('<API key>') : FALSE; } } if (($result = $this->db->query($sql)) !== FALSE) { empty($this->db->data_cache['table_names']) OR $this->db->data_cache['table_names'][] = $table; // Most databases don't support creating indexes from within the CREATE TABLE statement if ( ! empty($this->keys)) { for ($i = 0, $sqls = $this->_process_indexes($table), $c = count($sqls); $i < $c; $i++) { $this->db->query($sqls[$i]); } } } $this->_reset(); return $result; } /** * Create Table * * @param string $table Table name * @param bool $if_not_exists Whether to add 'IF NOT EXISTS' condition * @param array $attributes Associative array of table attributes * @return mixed */ protected function _create_table($table, $if_not_exists, $attributes) { if ($if_not_exists === TRUE && $this->_create_table_if === FALSE) { if ($this->db->table_exists($table)) { return TRUE; } else { $if_not_exists = FALSE; } } $sql = ($if_not_exists) ? sprintf($this->_create_table_if, $this->db->escape_identifiers($table)) : 'CREATE TABLE'; $columns = $this->_process_fields(TRUE); for ($i = 0, $c = count($columns); $i < $c; $i++) { $columns[$i] = ($columns[$i]['_literal'] !== FALSE) ? "\n\t".$columns[$i]['_literal'] : "\n\t".$this->_process_column($columns[$i]); } $columns = implode(',', $columns) .$this-><API key>($table); // Are indexes created from within the CREATE TABLE statement? (e.g. in MySQL) if ($this->_create_table_keys === TRUE) { $columns .= $this->_process_indexes($table); } // _create_table will usually have the following format: "%s %s (%s\n)" $sql = sprintf($this->_create_table.'%s', $sql, $this->db->escape_identifiers($table), $columns, $this->_create_table_attr($attributes) ); return $sql; } /** * CREATE TABLE attributes * * @param array $attributes Associative array of table attributes * @return string */ protected function _create_table_attr($attributes) { $sql = ''; foreach (array_keys($attributes) as $key) { if (is_string($key)) { $sql .= ' '.strtoupper($key).' '.$attributes[$key]; } } return $sql; } /** * Drop Table * * @param string $table_name Table name * @param bool $if_exists Whether to add an IF EXISTS condition * @return bool */ public function drop_table($table_name, $if_exists = FALSE) { if ($table_name === '') { return ($this->db->db_debug) ? $this->db->display_error('<API key>') : FALSE; } if (($query = $this->_drop_table($this->db->dbprefix.$table_name, $if_exists)) === TRUE) { return TRUE; } $query = $this->db->query($query); // Update table list cache if ($query && ! empty($this->db->data_cache['table_names'])) { $key = array_search(strtolower($this->db->dbprefix.$table_name), array_map('strtolower', $this->db->data_cache['table_names']), TRUE); if ($key !== FALSE) { unset($this->db->data_cache['table_names'][$key]); } } return $query; } /** * Drop Table * * Generates a platform-specific DROP TABLE string * * @param string $table Table name * @param bool $if_exists Whether to add an IF EXISTS condition * @return string */ protected function _drop_table($table, $if_exists) { $sql = 'DROP TABLE'; if ($if_exists) { if ($this->_drop_table_if === FALSE) { if ( ! $this->db->table_exists($table)) { return TRUE; } } else { $sql = sprintf($this->_drop_table_if, $this->db->escape_identifiers($table)); } } return $sql.' '.$this->db->escape_identifiers($table); } /** * Rename Table * * @param string $table_name Old table name * @param string $new_table_name New table name * @return bool */ public function rename_table($table_name, $new_table_name) { if ($table_name === '' OR $new_table_name === '') { show_error('A table name is required for that operation.'); return FALSE; } elseif ($this->_rename_table === FALSE) { return ($this->db->db_debug) ? $this->db->display_error('<API key>') : FALSE; } $result = $this->db->query(sprintf($this->_rename_table, $this->db->escape_identifiers($this->db->dbprefix.$table_name), $this->db->escape_identifiers($this->db->dbprefix.$new_table_name)) ); if ($result && ! empty($this->db->data_cache['table_names'])) { $key = array_search(strtolower($this->db->dbprefix.$table_name), array_map('strtolower', $this->db->data_cache['table_names']), TRUE); if ($key !== FALSE) { $this->db->data_cache['table_names'][$key] = $this->db->dbprefix.$new_table_name; } } return $result; } /** * Column Add * * @todo Remove deprecated $_after option in 3.1+ * @param string $table Table name * @param array $field Column definition * @param string $_after Column for AFTER clause (deprecated) * @return bool */ public function add_column($table, $field, $_after = NULL) { // Work-around for literal column definitions is_array($field) OR $field = array($field); foreach (array_keys($field) as $k) { // <API key> work-around for MySQL/CUBRID AFTER clause (remove in 3.1+) if ($_after !== NULL && is_array($field[$k]) && ! isset($field[$k]['after'])) { $field[$k]['after'] = $_after; } $this->add_field(array($k => $field[$k])); } $sqls = $this->_alter_table('ADD', $this->db->dbprefix.$table, $this->_process_fields()); $this->_reset(); if ($sqls === FALSE) { return ($this->db->db_debug) ? $this->db->display_error('<API key>') : FALSE; } for ($i = 0, $c = count($sqls); $i < $c; $i++) { if ($this->db->query($sqls[$i]) === FALSE) { return FALSE; } } return TRUE; } /** * Column Drop * * @param string $table Table name * @param string $column_name Column name * @return bool */ public function drop_column($table, $column_name) { $sql = $this->_alter_table('DROP', $this->db->dbprefix.$table, $column_name); if ($sql === FALSE) { return ($this->db->db_debug) ? $this->db->display_error('<API key>') : FALSE; } return $this->db->query($sql); } /** * Column Modify * * @param string $table Table name * @param string $field Column definition * @return bool */ public function modify_column($table, $field) { // Work-around for literal column definitions is_array($field) OR $field = array($field); foreach (array_keys($field) as $k) { $this->add_field(array($k => $field[$k])); } if (count($this->fields) === 0) { show_error('Field information is required.'); } $sqls = $this->_alter_table('CHANGE', $this->db->dbprefix.$table, $this->_process_fields()); $this->_reset(); if ($sqls === FALSE) { return ($this->db->db_debug) ? $this->db->display_error('<API key>') : FALSE; } for ($i = 0, $c = count($sqls); $i < $c; $i++) { if ($this->db->query($sqls[$i]) === FALSE) { return FALSE; } } return TRUE; } /** * ALTER TABLE * * @param string $alter_type ALTER type * @param string $table Table name * @param mixed $field Column definition * @return string|string[] */ protected function _alter_table($alter_type, $table, $field) { $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table).' '; // DROP has everything it needs now. if ($alter_type === 'DROP') { return $sql.'DROP COLUMN '.$this->db->escape_identifiers($field); } $sql .= ($alter_type === 'ADD') ? 'ADD ' : $alter_type.' COLUMN '; $sqls = array(); for ($i = 0, $c = count($field); $i < $c; $i++) { $sqls[] = $sql .($field[$i]['_literal'] !== FALSE ? $field[$i]['_literal'] : $this->_process_column($field[$i])); } return $sqls; } /** * Process fields * * @param bool $create_table * @return array */ protected function _process_fields($create_table = FALSE) { $fields = array(); foreach ($this->fields as $key => $attributes) { if (is_int($key) && ! is_array($attributes)) { $fields[] = array('_literal' => $attributes); continue; } $attributes = <API key>($attributes, CASE_UPPER); if ($create_table === TRUE && empty($attributes['TYPE'])) { continue; } isset($attributes['TYPE']) && $this->_attr_type($attributes); $field = array( 'name' => $key, 'new_name' => isset($attributes['NAME']) ? $attributes['NAME'] : NULL, 'type' => isset($attributes['TYPE']) ? $attributes['TYPE'] : NULL, 'length' => '', 'unsigned' => '', 'null' => '', 'unique' => '', 'default' => '', 'auto_increment' => '', '_literal' => FALSE ); isset($attributes['TYPE']) && $this->_attr_unsigned($attributes, $field); if ($create_table === FALSE) { if (isset($attributes['AFTER'])) { $field['after'] = $attributes['AFTER']; } elseif (isset($attributes['FIRST'])) { $field['first'] = (bool) $attributes['FIRST']; } } $this->_attr_default($attributes, $field); if (isset($attributes['NULL'])) { if ($attributes['NULL'] === TRUE) { $field['null'] = empty($this->_null) ? '' : ' '.$this->_null; } else { $field['null'] = ' NOT NULL'; } } elseif ($create_table === TRUE) { $field['null'] = ' NOT NULL'; } $this-><API key>($attributes, $field); $this->_attr_unique($attributes, $field); if (isset($attributes['COMMENT'])) { $field['comment'] = $this->db->escape($attributes['COMMENT']); } if (isset($attributes['TYPE']) && ! empty($attributes['CONSTRAINT'])) { switch (strtoupper($attributes['TYPE'])) { case 'ENUM': case 'SET': $attributes['CONSTRAINT'] = $this->db->escape($attributes['CONSTRAINT']); default: $field['length'] = is_array($attributes['CONSTRAINT']) ? '('.implode(',', $attributes['CONSTRAINT']).')' : '('.$attributes['CONSTRAINT'].')'; break; } } $fields[] = $field; } return $fields; } /** * Process column * * @param array $field * @return string */ protected function _process_column($field) { return $this->db->escape_identifiers($field['name']) .' '.$field['type'].$field['length'] .$field['unsigned'] .$field['default'] .$field['null'] .$field['auto_increment'] .$field['unique']; } /** * Field attribute TYPE * * Performs a data type mapping between different databases. * * @param array &$attributes * @return void */ protected function _attr_type(&$attributes) { // Usually overridden by drivers } /** * Field attribute UNSIGNED * * Depending on the _unsigned property value: * * - TRUE will always set $field['unsigned'] to 'UNSIGNED' * - FALSE will always set $field['unsigned'] to '' * - array(TYPE) will set $field['unsigned'] to 'UNSIGNED', * if $attributes['TYPE'] is found in the array * - array(TYPE => UTYPE) will change $field['type'], * from TYPE to UTYPE in case of a match * * @param array &$attributes * @param array &$field * @return void */ protected function _attr_unsigned(&$attributes, &$field) { if (empty($attributes['UNSIGNED']) OR $attributes['UNSIGNED'] !== TRUE) { return; } // Reset the attribute in order to avoid issues if we do type conversion $attributes['UNSIGNED'] = FALSE; if (is_array($this->_unsigned)) { foreach (array_keys($this->_unsigned) as $key) { if (is_int($key) && strcasecmp($attributes['TYPE'], $this->_unsigned[$key]) === 0) { $field['unsigned'] = ' UNSIGNED'; return; } elseif (is_string($key) && strcasecmp($attributes['TYPE'], $key) === 0) { $field['type'] = $key; return; } } return; } $field['unsigned'] = ($this->_unsigned === TRUE) ? ' UNSIGNED' : ''; } /** * Field attribute DEFAULT * * @param array &$attributes * @param array &$field * @return void */ protected function _attr_default(&$attributes, &$field) { if ($this->_default === FALSE) { return; } if (array_key_exists('DEFAULT', $attributes)) { if ($attributes['DEFAULT'] === NULL) { $field['default'] = empty($this->_null) ? '' : $this->_default.$this->_null; // Override the NULL attribute if that's our default $attributes['NULL'] = TRUE; $field['null'] = empty($this->_null) ? '' : ' '.$this->_null; } else { $field['default'] = $this->_default.$this->db->escape($attributes['DEFAULT']); } } } /** * Field attribute UNIQUE * * @param array &$attributes * @param array &$field * @return void */ protected function _attr_unique(&$attributes, &$field) { if ( ! empty($attributes['UNIQUE']) && $attributes['UNIQUE'] === TRUE) { $field['unique'] = ' UNIQUE'; } } /** * Field attribute AUTO_INCREMENT * * @param array &$attributes * @param array &$field * @return void */ protected function <API key>(&$attributes, &$field) { if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE) { $field['auto_increment'] = ' AUTO_INCREMENT'; } } /** * Process primary keys * * @param string $table Table name * @return string */ protected function <API key>($table) { $sql = ''; for ($i = 0, $c = count($this->primary_keys); $i < $c; $i++) { if ( ! isset($this->fields[$this->primary_keys[$i]])) { unset($this->primary_keys[$i]); } } if (count($this->primary_keys) > 0) { $sql .= ",\n\tCONSTRAINT ".$this->db->escape_identifiers('pk_'.$table) .' PRIMARY KEY('.implode(', ', $this->db->escape_identifiers($this->primary_keys)).')'; } return $sql; } /** * Process indexes * * @param string $table * @return string */ protected function _process_indexes($table) { $sqls = array(); for ($i = 0, $c = count($this->keys); $i < $c; $i++) { if (is_array($this->keys[$i])) { for ($i2 = 0, $c2 = count($this->keys[$i]); $i2 < $c2; $i2++) { if ( ! isset($this->fields[$this->keys[$i][$i2]])) { unset($this->keys[$i][$i2]); continue; } } } elseif ( ! isset($this->fields[$this->keys[$i]])) { unset($this->keys[$i]); continue; } is_array($this->keys[$i]) OR $this->keys[$i] = array($this->keys[$i]); $sqls[] = 'CREATE INDEX '.$this->db->escape_identifiers($table.'_'.implode('_', $this->keys[$i])) .' ON '.$this->db->escape_identifiers($table) .' ('.implode(', ', $this->db->escape_identifiers($this->keys[$i])).');'; } return $sqls; } /** * Reset * * Resets table creation vars * * @return void */ protected function _reset() { $this->fields = $this->keys = $this->primary_keys = array(); } }
"use strict"; // local import of the exported AngularPage class var angularPage_1 = require('./angularPage'); // The jasmine typings are brought in via DefinitelyTyped ambient typings. describe('angularjs homepage', function () { it('should greet the named user', function () { var angularHomepage = new angularPage_1.AngularHomepage(); angularHomepage.get(); angularHomepage.setName('Julie'); expect(angularHomepage.getGreeting()).toEqual('Hello Julie!'); }); });
package java.time; import static java.time.temporal.ChronoField.ERA; import static java.time.temporal.ChronoField.YEAR; import static java.time.temporal.ChronoField.YEAR_OF_ERA; import static java.time.temporal.ChronoUnit.CENTURIES; import static java.time.temporal.ChronoUnit.DECADES; import static java.time.temporal.ChronoUnit.ERAS; import static java.time.temporal.ChronoUnit.MILLENNIA; import static java.time.temporal.ChronoUnit.YEARS; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.io.<API key>; import java.io.ObjectInputStream; import java.io.Serializable; import java.time.chrono.Chronology; import java.time.chrono.IsoChronology; import java.time.format.DateTimeFormatter; import java.time.format.<API key>; import java.time.format.<API key>; import java.time.format.SignStyle; import java.time.temporal.ChronoField; import java.time.temporal.ChronoUnit; import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.<API key>; import java.time.temporal.ValueRange; import java.util.Objects; /** * A year in the ISO-8601 calendar system, such as {@code 2007}. * <p> * {@code Year} is an immutable date-time object that represents a year. * Any field that can be derived from a year can be obtained. * <p> * <b>Note that years in the ISO chronology only align with years in the * Gregorian-Julian system for modern years. Parts of Russia did not switch to the * modern Gregorian/ISO rules until 1920. * As such, historical years must be treated with caution.</b> * <p> * This class does not store or represent a month, day, time or time-zone. * For example, the value "2007" can be stored in a {@code Year}. * <p> * Years represented by this class follow the ISO-8601 standard and use * the proleptic numbering system. Year 1 is preceded by year 0, then by year -1. * <p> * The ISO-8601 calendar system is the modern civil calendar system used today * in most of the world. It is equivalent to the proleptic Gregorian calendar * system, in which today's rules for leap years are applied for all time. * For most applications written today, the ISO-8601 rules are entirely suitable. * However, any application that makes use of historical dates, and requires them * to be accurate will find the ISO-8601 approach unsuitable. * * <p> * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a> * class; use of identity-sensitive operations (including reference equality * ({@code ==}), identity hash code, or synchronization) on instances of * {@code Year} may have unpredictable results and should be avoided. * The {@code equals} method should be used for comparisons. * * @implSpec * This class is immutable and thread-safe. * * @since 1.8 */ public final class Year implements Temporal, TemporalAdjuster, Comparable<Year>, Serializable { /** * The minimum supported year, '-999,999,999'. */ public static final int MIN_VALUE = -999_999_999; /** * The maximum supported year, '+999,999,999'. */ public static final int MAX_VALUE = 999_999_999; /** * Serialization version. */ private static final long serialVersionUID = -23038383694477807L; /** * Parser. */ private static final DateTimeFormatter PARSER = new <API key>() .appendValue(YEAR, 4, 10, SignStyle.EXCEEDS_PAD) .toFormatter(); /** * The year being represented. */ private final int year; /** * Obtains the current year from the system clock in the default time-zone. * <p> * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default * time-zone to obtain the current year. * <p> * Using this method will prevent the ability to use an alternate clock for testing * because the clock is hard-coded. * * @return the current year using the system clock and default time-zone, not null */ public static Year now() { return now(Clock.systemDefaultZone()); } /** * Obtains the current year from the system clock in the specified time-zone. * <p> * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year. * Specifying the time-zone avoids dependence on the default time-zone. * <p> * Using this method will prevent the ability to use an alternate clock for testing * because the clock is hard-coded. * * @param zone the zone ID to use, not null * @return the current year using the system clock, not null */ public static Year now(ZoneId zone) { return now(Clock.system(zone)); } /** * Obtains the current year from the specified clock. * <p> * This will query the specified clock to obtain the current year. * Using this method allows the use of an alternate clock for testing. * The alternate clock may be introduced using {@link Clock dependency injection}. * * @param clock the clock to use, not null * @return the current year, not null */ public static Year now(Clock clock) { final LocalDate now = LocalDate.now(clock); // called once return Year.of(now.getYear()); } /** * Obtains an instance of {@code Year}. * <p> * This method accepts a year value from the proleptic ISO calendar system. * <p> * The year 2AD/CE is represented by 2.<br> * The year 1AD/CE is represented by 1.<br> * The year 1BC/BCE is represented by 0.<br> * The year 2BC/BCE is represented by -1.<br> * * @param isoYear the ISO proleptic year to represent, from {@code MIN_VALUE} to {@code MAX_VALUE} * @return the year, not null * @throws DateTimeException if the field is invalid */ public static Year of(int isoYear) { YEAR.checkValidValue(isoYear); return new Year(isoYear); } /** * Obtains an instance of {@code Year} from a temporal object. * <p> * This obtains a year based on the specified temporal. * A {@code TemporalAccessor} represents an arbitrary set of date and time information, * which this factory converts to an instance of {@code Year}. * <p> * The conversion extracts the {@link ChronoField#YEAR year} field. * The extraction is only permitted if the temporal object has an ISO * chronology, or can be converted to a {@code LocalDate}. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} * allowing it to be used in queries via method reference, {@code Year::from}. * * @param temporal the temporal object to convert, not null * @return the year, not null * @throws DateTimeException if unable to convert to a {@code Year} */ public static Year from(TemporalAccessor temporal) { if (temporal instanceof Year) { return (Year) temporal; } Objects.requireNonNull(temporal, "temporal"); try { if (IsoChronology.INSTANCE.equals(Chronology.from(temporal)) == false) { temporal = LocalDate.from(temporal); } return of(temporal.get(YEAR)); } catch (DateTimeException ex) { throw new DateTimeException("Unable to obtain Year from TemporalAccessor: " + temporal + " of type " + temporal.getClass().getName(), ex); } } /** * Obtains an instance of {@code Year} from a text string such as {@code 2007}. * <p> * The string must represent a valid year. * Years outside the range 0000 to 9999 must be prefixed by the plus or minus symbol. * * @param text the text to parse such as "2007", not null * @return the parsed year, not null * @throws <API key> if the text cannot be parsed */ public static Year parse(CharSequence text) { return parse(text, PARSER); } /** * Obtains an instance of {@code Year} from a text string using a specific formatter. * <p> * The text is parsed using the formatter, returning a year. * * @param text the text to parse, not null * @param formatter the formatter to use, not null * @return the parsed year, not null * @throws <API key> if the text cannot be parsed */ public static Year parse(CharSequence text, DateTimeFormatter formatter) { Objects.requireNonNull(formatter, "formatter"); return formatter.parse(text, Year::from); } /** * Checks if the year is a leap year, according to the ISO proleptic * calendar system rules. * <p> * This method applies the current rules for leap years across the whole time-line. * In general, a year is a leap year if it is divisible by four without * remainder. However, years divisible by 100, are not leap years, with * the exception of years divisible by 400 which are. * <p> * For example, 1904 is a leap year it is divisible by 4. * 1900 was not a leap year as it is divisible by 100, however 2000 was a * leap year as it is divisible by 400. * <p> * The calculation is proleptic - applying the same rules into the far future and far past. * This is historically inaccurate, but is correct for the ISO-8601 standard. * * @param year the year to check * @return true if the year is leap, false otherwise */ public static boolean isLeap(long year) { return ((year & 3) == 0) && ((year % 100) != 0 || (year % 400) == 0); } /** * Constructor. * * @param year the year to represent */ private Year(int year) { this.year = year; } /** * Gets the year value. * <p> * The year returned by this method is proleptic as per {@code get(YEAR)}. * * @return the year, {@code MIN_VALUE} to {@code MAX_VALUE} */ public int getValue() { return year; } /** * Checks if the specified field is supported. * <p> * This checks if this year can be queried for the specified field. * If false, then calling the {@link #range(TemporalField) range}, * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)} * methods will throw an exception. * <p> * If the field is a {@link ChronoField} then the query is implemented here. * The supported fields are: * <ul> * <li>{@code YEAR_OF_ERA} * <li>{@code YEAR} * <li>{@code ERA} * </ul> * All other {@code ChronoField} instances will return false. * <p> * If the field is not a {@code ChronoField}, then the result of this method * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)} * passing {@code this} as the argument. * Whether the field is supported is determined by the field. * * @param field the field to check, null returns false * @return true if the field is supported on this year, false if not */ @Override public boolean isSupported(TemporalField field) { if (field instanceof ChronoField) { return field == YEAR || field == YEAR_OF_ERA || field == ERA; } return field != null && field.isSupportedBy(this); } /** * Checks if the specified unit is supported. * <p> * This checks if the specified unit can be added to, or subtracted from, this date-time. * If false, then calling the {@link #plus(long, TemporalUnit)} and * {@link #minus(long, TemporalUnit) minus} methods will throw an exception. * <p> * If the unit is a {@link ChronoUnit} then the query is implemented here. * The supported units are: * <ul> * <li>{@code YEARS} * <li>{@code DECADES} * <li>{@code CENTURIES} * <li>{@code MILLENNIA} * <li>{@code ERAS} * </ul> * All other {@code ChronoUnit} instances will return false. * <p> * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} * passing {@code this} as the argument. * Whether the unit is supported is determined by the unit. * * @param unit the unit to check, null returns false * @return true if the unit can be added/subtracted, false if not */ @Override public boolean isSupported(TemporalUnit unit) { if (unit instanceof ChronoUnit) { return unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS; } return unit != null && unit.isSupportedBy(this); } /** * Gets the range of valid values for the specified field. * <p> * The range object expresses the minimum and maximum valid values for a field. * This year is used to enhance the accuracy of the returned range. * If it is not possible to return the range, because the field is not supported * or for some other reason, an exception is thrown. * <p> * If the field is a {@link ChronoField} then the query is implemented here. * The {@link #isSupported(TemporalField) supported fields} will return * appropriate range instances. * All other {@code ChronoField} instances will throw an {@code <API key>}. * <p> * If the field is not a {@code ChronoField}, then the result of this method * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} * passing {@code this} as the argument. * Whether the range can be obtained is determined by the field. * * @param field the field to query the range for, not null * @return the range of valid values for the field, not null * @throws DateTimeException if the range for the field cannot be obtained * @throws <API key> if the field is not supported */ @Override public ValueRange range(TemporalField field) { if (field == YEAR_OF_ERA) { return (year <= 0 ? ValueRange.of(1, MAX_VALUE + 1) : ValueRange.of(1, MAX_VALUE)); } return Temporal.super.range(field); } /** * Gets the value of the specified field from this year as an {@code int}. * <p> * This queries this year for the value for the specified field. * The returned value will always be within the valid range of values for the field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> * If the field is a {@link ChronoField} then the query is implemented here. * The {@link #isSupported(TemporalField) supported fields} will return valid * values based on this year. * All other {@code ChronoField} instances will throw an {@code <API key>}. * <p> * If the field is not a {@code ChronoField}, then the result of this method * is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} * passing {@code this} as the argument. Whether the value can be obtained, * and what the value represents, is determined by the field. * * @param field the field to get, not null * @return the value for the field * @throws DateTimeException if a value for the field cannot be obtained or * the value is outside the range of valid values for the field * @throws <API key> if the field is not supported or * the range of values exceeds an {@code int} * @throws ArithmeticException if numeric overflow occurs */ @Override // override for Javadoc public int get(TemporalField field) { return range(field).checkValidIntValue(getLong(field), field); } /** * Gets the value of the specified field from this year as a {@code long}. * <p> * This queries this year for the value for the specified field. * If it is not possible to return the value, because the field is not supported * or for some other reason, an exception is thrown. * <p> * If the field is a {@link ChronoField} then the query is implemented here. * The {@link #isSupported(TemporalField) supported fields} will return valid * values based on this year. * All other {@code ChronoField} instances will throw an {@code <API key>}. * <p> * If the field is not a {@code ChronoField}, then the result of this method * is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)} * passing {@code this} as the argument. Whether the value can be obtained, * and what the value represents, is determined by the field. * * @param field the field to get, not null * @return the value for the field * @throws DateTimeException if a value for the field cannot be obtained * @throws <API key> if the field is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override public long getLong(TemporalField field) { if (field instanceof ChronoField) { switch ((ChronoField) field) { case YEAR_OF_ERA: return (year < 1 ? 1 - year : year); case YEAR: return year; case ERA: return (year < 1 ? 0 : 1); } throw new <API key>("Unsupported field: " + field); } return field.getFrom(this); } /** * Checks if the year is a leap year, according to the ISO proleptic * calendar system rules. * <p> * This method applies the current rules for leap years across the whole time-line. * In general, a year is a leap year if it is divisible by four without * remainder. However, years divisible by 100, are not leap years, with * the exception of years divisible by 400 which are. * <p> * For example, 1904 is a leap year it is divisible by 4. * 1900 was not a leap year as it is divisible by 100, however 2000 was a * leap year as it is divisible by 400. * <p> * The calculation is proleptic - applying the same rules into the far future and far past. * This is historically inaccurate, but is correct for the ISO-8601 standard. * * @return true if the year is leap, false otherwise */ public boolean isLeap() { return Year.isLeap(year); } /** * Checks if the month-day is valid for this year. * <p> * This method checks whether this year and the input month and day form * a valid date. * * @param monthDay the month-day to validate, null returns false * @return true if the month and day are valid for this year */ public boolean isValidMonthDay(MonthDay monthDay) { return monthDay != null && monthDay.isValidYear(year); } /** * Gets the length of this year in days. * * @return the length of this year in days, 365 or 366 */ public int length() { return isLeap() ? 366 : 365; } /** * Returns an adjusted copy of this year. * <p> * This returns a {@code Year}, based on this one, with the year adjusted. * The adjustment takes place using the specified adjuster strategy object. * Read the documentation of the adjuster to understand what adjustment will be made. * <p> * The result of this method is obtained by invoking the * {@link TemporalAdjuster#adjustInto(Temporal)} method on the * specified adjuster passing {@code this} as the argument. * <p> * This instance is immutable and unaffected by this method call. * * @param adjuster the adjuster to use, not null * @return a {@code Year} based on {@code this} with the adjustment made, not null * @throws DateTimeException if the adjustment cannot be made * @throws ArithmeticException if numeric overflow occurs */ @Override public Year with(TemporalAdjuster adjuster) { return (Year) adjuster.adjustInto(this); } /** * Returns a copy of this year with the specified field set to a new value. * <p> * This returns a {@code Year}, based on this one, with the value * for the specified field changed. * If it is not possible to set the value, because the field is not supported or for * some other reason, an exception is thrown. * <p> * If the field is a {@link ChronoField} then the adjustment is implemented here. * The supported fields behave as follows: * <ul> * <li>{@code YEAR_OF_ERA} - * Returns a {@code Year} with the specified year-of-era * The era will be unchanged. * <li>{@code YEAR} - * Returns a {@code Year} with the specified year. * This completely replaces the date and is equivalent to {@link #of(int)}. * <li>{@code ERA} - * Returns a {@code Year} with the specified era. * The year-of-era will be unchanged. * </ul> * <p> * In all cases, if the new value is outside the valid range of values for the field * then a {@code DateTimeException} will be thrown. * <p> * All other {@code ChronoField} instances will throw an {@code <API key>}. * <p> * If the field is not a {@code ChronoField}, then the result of this method * is obtained by invoking {@code TemporalField.adjustInto(Temporal, long)} * passing {@code this} as the argument. In this case, the field determines * whether and how to adjust the instant. * <p> * This instance is immutable and unaffected by this method call. * * @param field the field to set in the result, not null * @param newValue the new value of the field in the result * @return a {@code Year} based on {@code this} with the specified field set, not null * @throws DateTimeException if the field cannot be set * @throws <API key> if the field is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override public Year with(TemporalField field, long newValue) { if (field instanceof ChronoField) { ChronoField f = (ChronoField) field; f.checkValidValue(newValue); switch (f) { case YEAR_OF_ERA: return Year.of((int) (year < 1 ? 1 - newValue : newValue)); case YEAR: return Year.of((int) newValue); case ERA: return (getLong(ERA) == newValue ? this : Year.of(1 - year)); } throw new <API key>("Unsupported field: " + field); } return field.adjustInto(this, newValue); } /** * Returns a copy of this year with the specified amount added. * <p> * This returns a {@code Year}, based on this one, with the specified amount added. * The amount is typically {@link Period} but may be any other type implementing * the {@link TemporalAmount} interface. * <p> * The calculation is delegated to the amount object by calling * {@link TemporalAmount#addTo(Temporal)}. The amount implementation is free * to implement the addition in any way it wishes, however it typically * calls back to {@link #plus(long, TemporalUnit)}. Consult the documentation * of the amount implementation to determine if it can be successfully added. * <p> * This instance is immutable and unaffected by this method call. * * @param amountToAdd the amount to add, not null * @return a {@code Year} based on this year with the addition made, not null * @throws DateTimeException if the addition cannot be made * @throws ArithmeticException if numeric overflow occurs */ @Override public Year plus(TemporalAmount amountToAdd) { return (Year) amountToAdd.addTo(this); } /** * Returns a copy of this year with the specified amount added. * <p> * This returns a {@code Year}, based on this one, with the amount * in terms of the unit added. If it is not possible to add the amount, because the * unit is not supported or for some other reason, an exception is thrown. * <p> * If the field is a {@link ChronoUnit} then the addition is implemented here. * The supported fields behave as follows: * <ul> * <li>{@code YEARS} - * Returns a {@code Year} with the specified number of years added. * This is equivalent to {@link #plusYears(long)}. * <li>{@code DECADES} - * Returns a {@code Year} with the specified number of decades added. * This is equivalent to calling {@link #plusYears(long)} with the amount * multiplied by 10. * <li>{@code CENTURIES} - * Returns a {@code Year} with the specified number of centuries added. * This is equivalent to calling {@link #plusYears(long)} with the amount * multiplied by 100. * <li>{@code MILLENNIA} - * Returns a {@code Year} with the specified number of millennia added. * This is equivalent to calling {@link #plusYears(long)} with the amount * multiplied by 1,000. * <li>{@code ERAS} - * Returns a {@code Year} with the specified number of eras added. * Only two eras are supported so the amount must be one, zero or minus one. * If the amount is non-zero then the year is changed such that the year-of-era * is unchanged. * </ul> * <p> * All other {@code ChronoUnit} instances will throw an {@code <API key>}. * <p> * If the field is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.addTo(Temporal, long)} * passing {@code this} as the argument. In this case, the unit determines * whether and how to perform the addition. * <p> * This instance is immutable and unaffected by this method call. * * @param amountToAdd the amount of the unit to add to the result, may be negative * @param unit the unit of the amount to add, not null * @return a {@code Year} based on this year with the specified amount added, not null * @throws DateTimeException if the addition cannot be made * @throws <API key> if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override public Year plus(long amountToAdd, TemporalUnit unit) { if (unit instanceof ChronoUnit) { switch ((ChronoUnit) unit) { case YEARS: return plusYears(amountToAdd); case DECADES: return plusYears(Math.multiplyExact(amountToAdd, 10)); case CENTURIES: return plusYears(Math.multiplyExact(amountToAdd, 100)); case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000)); case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd)); } throw new <API key>("Unsupported unit: " + unit); } return unit.addTo(this, amountToAdd); } /** * Returns a copy of this year with the specified number of years added. * <p> * This instance is immutable and unaffected by this method call. * * @param yearsToAdd the years to add, may be negative * @return a {@code Year} based on this year with the period added, not null * @throws DateTimeException if the result exceeds the supported year range */ public Year plusYears(long yearsToAdd) { if (yearsToAdd == 0) { return this; } return of(YEAR.checkValidIntValue(year + yearsToAdd)); // overflow safe } /** * Returns a copy of this year with the specified amount subtracted. * <p> * This returns a {@code Year}, based on this one, with the specified amount subtracted. * The amount is typically {@link Period} but may be any other type implementing * the {@link TemporalAmount} interface. * <p> * The calculation is delegated to the amount object by calling * {@link TemporalAmount#subtractFrom(Temporal)}. The amount implementation is free * to implement the subtraction in any way it wishes, however it typically * calls back to {@link #minus(long, TemporalUnit)}. Consult the documentation * of the amount implementation to determine if it can be successfully subtracted. * <p> * This instance is immutable and unaffected by this method call. * * @param amountToSubtract the amount to subtract, not null * @return a {@code Year} based on this year with the subtraction made, not null * @throws DateTimeException if the subtraction cannot be made * @throws ArithmeticException if numeric overflow occurs */ @Override public Year minus(TemporalAmount amountToSubtract) { return (Year) amountToSubtract.subtractFrom(this); } /** * Returns a copy of this year with the specified amount subtracted. * <p> * This returns a {@code Year}, based on this one, with the amount * in terms of the unit subtracted. If it is not possible to subtract the amount, * because the unit is not supported or for some other reason, an exception is thrown. * <p> * This method is equivalent to {@link #plus(long, TemporalUnit)} with the amount negated. * See that method for a full description of how addition, and thus subtraction, works. * <p> * This instance is immutable and unaffected by this method call. * * @param amountToSubtract the amount of the unit to subtract from the result, may be negative * @param unit the unit of the amount to subtract, not null * @return a {@code Year} based on this year with the specified amount subtracted, not null * @throws DateTimeException if the subtraction cannot be made * @throws <API key> if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override public Year minus(long amountToSubtract, TemporalUnit unit) { return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE, unit).plus(1, unit) : plus(-amountToSubtract, unit)); } /** * Returns a copy of this year with the specified number of years subtracted. * <p> * This instance is immutable and unaffected by this method call. * * @param yearsToSubtract the years to subtract, may be negative * @return a {@code Year} based on this year with the period subtracted, not null * @throws DateTimeException if the result exceeds the supported year range */ public Year minusYears(long yearsToSubtract) { return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract)); } /** * Queries this year using the specified query. * <p> * This queries this year using the specified query strategy object. * The {@code TemporalQuery} object defines the logic to be used to * obtain the result. Read the documentation of the query to understand * what the result of this method will be. * <p> * The result of this method is obtained by invoking the * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the * specified query passing {@code this} as the argument. * * @param <R> the type of the result * @param query the query to invoke, not null * @return the query result, null may be returned (defined by the query) * @throws DateTimeException if unable to query (defined by the query) * @throws ArithmeticException if numeric overflow occurs (defined by the query) */ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { if (query == TemporalQueries.chronology()) { return (R) IsoChronology.INSTANCE; } else if (query == TemporalQueries.precision()) { return (R) YEARS; } return Temporal.super.query(query); } /** * Adjusts the specified temporal object to have this year. * <p> * This returns a temporal object of the same observable type as the input * with the year changed to be the same as this. * <p> * The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)} * passing {@link ChronoField#YEAR} as the field. * If the specified temporal object does not use the ISO calendar system then * a {@code DateTimeException} is thrown. * <p> * In most cases, it is clearer to reverse the calling pattern by using * {@link Temporal#with(TemporalAdjuster)}: * <pre> * // these two lines are equivalent, but the second approach is recommended * temporal = thisYear.adjustInto(temporal); * temporal = temporal.with(thisYear); * </pre> * <p> * This instance is immutable and unaffected by this method call. * * @param temporal the target object to be adjusted, not null * @return the adjusted object, not null * @throws DateTimeException if unable to make the adjustment * @throws ArithmeticException if numeric overflow occurs */ @Override public Temporal adjustInto(Temporal temporal) { if (Chronology.from(temporal).equals(IsoChronology.INSTANCE) == false) { throw new DateTimeException("Adjustment only supported on ISO date-time"); } return temporal.with(YEAR, year); } /** * Calculates the amount of time until another year in terms of the specified unit. * <p> * This calculates the amount of time between two {@code Year} * objects in terms of a single {@code TemporalUnit}. * The start and end points are {@code this} and the specified year. * The result will be negative if the end is before the start. * The {@code Temporal} passed to this method is converted to a * {@code Year} using {@link #from(TemporalAccessor)}. * For example, the period in decades between two year can be calculated * using {@code startYear.until(endYear, DECADES)}. * <p> * The calculation returns a whole number, representing the number of * complete units between the two years. * For example, the period in decades between 2012 and 2031 * will only be one decade as it is one year short of two decades. * <p> * There are two equivalent ways of using this method. * The first is to invoke this method. * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: * <pre> * // these two lines are equivalent * amount = start.until(end, YEARS); * amount = YEARS.between(start, end); * </pre> * The choice should be made based on which makes the code more readable. * <p> * The calculation is implemented in this method for {@link ChronoUnit}. * The units {@code YEARS}, {@code DECADES}, {@code CENTURIES}, * {@code MILLENNIA} and {@code ERAS} are supported. * Other {@code ChronoUnit} values will throw an exception. * <p> * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} * passing {@code this} as the first argument and the converted input temporal * as the second argument. * <p> * This instance is immutable and unaffected by this method call. * * @param endExclusive the end date, exclusive, which is converted to a {@code Year}, not null * @param unit the unit to measure the amount in, not null * @return the amount of time between this year and the end year * @throws DateTimeException if the amount cannot be calculated, or the end * temporal cannot be converted to a {@code Year} * @throws <API key> if the unit is not supported * @throws ArithmeticException if numeric overflow occurs */ @Override public long until(Temporal endExclusive, TemporalUnit unit) { Year end = Year.from(endExclusive); if (unit instanceof ChronoUnit) { long yearsUntil = ((long) end.year) - year; // no overflow switch ((ChronoUnit) unit) { case YEARS: return yearsUntil; case DECADES: return yearsUntil / 10; case CENTURIES: return yearsUntil / 100; case MILLENNIA: return yearsUntil / 1000; case ERAS: return end.getLong(ERA) - getLong(ERA); } throw new <API key>("Unsupported unit: " + unit); } return unit.between(this, end); } /** * Formats this year using the specified formatter. * <p> * This year will be passed to the formatter to produce a string. * * @param formatter the formatter to use, not null * @return the formatted year string, not null * @throws DateTimeException if an error occurs during printing */ public String format(DateTimeFormatter formatter) { Objects.requireNonNull(formatter, "formatter"); return formatter.format(this); } /** * Combines this year with a day-of-year to create a {@code LocalDate}. * <p> * This returns a {@code LocalDate} formed from this year and the specified day-of-year. * <p> * The day-of-year value 366 is only valid in a leap year. * * @param dayOfYear the day-of-year to use, not null * @return the local date formed from this year and the specified date of year, not null * @throws DateTimeException if the day of year is zero or less, 366 or greater or equal * to 366 and this is not a leap year */ public LocalDate atDay(int dayOfYear) { return LocalDate.ofYearDay(year, dayOfYear); } public YearMonth atMonth(Month month) { return YearMonth.of(year, month); } public YearMonth atMonth(int month) { return YearMonth.of(year, month); } /** * Combines this year with a month-day to create a {@code LocalDate}. * <p> * This returns a {@code LocalDate} formed from this year and the specified month-day. * <p> * A month-day of February 29th will be adjusted to February 28th in the resulting * date if the year is not a leap year. * * @param monthDay the month-day to use, not null * @return the local date formed from this year and the specified month-day, not null */ public LocalDate atMonthDay(MonthDay monthDay) { return monthDay.atYear(year); } /** * Compares this year to another year. * <p> * The comparison is based on the value of the year. * It is "consistent with equals", as defined by {@link Comparable}. * * @param other the other year to compare to, not null * @return the comparator value, negative if less, positive if greater */ @Override public int compareTo(Year other) { return year - other.year; } /** * Is this year after the specified year. * * @param other the other year to compare to, not null * @return true if this is after the specified year */ public boolean isAfter(Year other) { return year > other.year; } /** * Is this year before the specified year. * * @param other the other year to compare to, not null * @return true if this point is before the specified year */ public boolean isBefore(Year other) { return year < other.year; } /** * Checks if this year is equal to another year. * <p> * The comparison is based on the time-line position of the years. * * @param obj the object to check, null returns false * @return true if this is equal to the other year */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Year) { return year == ((Year) obj).year; } return false; } /** * A hash code for this year. * * @return a suitable hash code */ @Override public int hashCode() { return year; } /** * Outputs this year as a {@code String}. * * @return a string representation of this year, not null */ @Override public String toString() { return Integer.toString(year); } /** * Writes the object using a * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>. * @serialData * <pre> * out.writeByte(11); // identifies a Year * out.writeInt(year); * </pre> * * @return the instance of {@code Ser}, not null */ private Object writeReplace() { return new Ser(Ser.YEAR_TYPE, this); } /** * Defend against malicious streams. * * @throws <API key> always */ private void readObject(ObjectInputStream s) throws <API key> { throw new <API key>("Deserialization via serialization delegate"); } void writeExternal(DataOutput out) throws IOException { out.writeInt(year); } static Year readExternal(DataInput in) throws IOException { return Year.of(in.readInt()); } }
//of this software and associated documentation files (the "Software"), to deal //in the Software without restriction, including without limitation the rights //copies of the Software, and to permit persons to whom the Software is //furnished to do so, subject to the following conditions: //copies or substantial portions of the Software. //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //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.Threading.Tasks; using Microsoft.Online.Applications.Core.Authentication; using Microsoft.Online.Applications.Core.Configuration; namespace Microsoft.Online.Applications.Core { public class ServiceProvider : <API key> { public I<API key> <API key> { get; private set; } public virtual Task<ServiceInformation> CreateServiceInfo(AppConfig appConfig, CredentialType credentialType) { var <API key> = new <API key> { ClientID = appConfig.ClientID, ClientSecret = appConfig.ClientSecret, Tenant = appConfig.TenantDomain, ServiceResource = appConfig.ServiceResource }; if (credentialType == CredentialType.Certificate) { <API key>.<API key> = this.<API key> ?? new AdalCertificate<API key>(<API key>); } else { <API key>.<API key> = this.<API key> ?? new AdalClient<API key>(<API key>); } return Task.FromResult<ServiceInformation>(<API key>); } } }
import answer from './answer'; var answer2 = answer; export default answer2;
title: Structure page_title: Structure | RadSocialShare for ASP.NET AJAX Documentation description: Structure slug: socialshare/getting-started/structure tags: structure published: True position: 1 # Structure The main elements of the **RadSocialShare** control are:![<API key>](images/<API key>.png) * **MainButtons** - these are the buttons that are always visible on the page * **CompactButton** - this is an extra button that is not used for sharing, but to show the other available buttons * **CompactButtons list** - these are the buttons that are not initially visible on the page, yet are easily reachable in a movable popup * **SearchBox** - you can start typing a social network's name and the **CompactButtons** will be filtered accordingly * **CompactButtons popup** - the **RadWindow** that holds the additional buttons * **Send E-mail button** - a button that pops up a form in a **RadWindow** that allows you to send an e-mail via a dedicated server * **Mailto button** - a button that triggers the system's default mail client to send an e-mail via the user machine * **Label Text** - the text associated with the button. It can be set explicitly via a property. The CompactButtons have a predefined value which is used for the Search Box even if you do not set the label explicitly.
import { Quaternion } from '../math/Quaternion'; import { Vector3 } from '../math/Vector3'; import { Matrix4 } from '../math/Matrix4'; import { EventDispatcher } from './EventDispatcher'; import { Euler } from '../math/Euler'; import { Layers } from './Layers'; import { Matrix3 } from '../math/Matrix3'; import { _Math } from '../math/Math'; var object3DId = 0; function Object3D() { Object.defineProperty( this, 'id', { value: object3DId ++ } ); this.uuid = _Math.generateUUID(); this.name = ''; this.type = 'Object3D'; this.parent = null; this.children = []; this.up = Object3D.DefaultUp.clone(); var position = new Vector3(); var rotation = new Euler(); var quaternion = new Quaternion(); var scale = new Vector3( 1, 1, 1 ); function onRotationChange() { quaternion.setFromEuler( rotation, false ); } function onQuaternionChange() { rotation.setFromQuaternion( quaternion, undefined, false ); } rotation.onChange( onRotationChange ); quaternion.onChange( onQuaternionChange ); Object.defineProperties( this, { position: { enumerable: true, value: position }, rotation: { enumerable: true, value: rotation }, quaternion: { enumerable: true, value: quaternion }, scale: { enumerable: true, value: scale }, modelViewMatrix: { value: new Matrix4() }, normalMatrix: { value: new Matrix3() } } ); this.matrix = new Matrix4(); this.matrixWorld = new Matrix4(); this.matrixAutoUpdate = Object3D.<API key>; this.<API key> = false; this.layers = new Layers(); this.visible = true; this.castShadow = false; this.receiveShadow = false; this.frustumCulled = true; this.renderOrder = 0; this.userData = {}; } Object3D.DefaultUp = new Vector3( 0, 1, 0 ); Object3D.<API key> = true; Object.assign( Object3D.prototype, EventDispatcher.prototype, { isObject3D: true, onBeforeRender: function () {}, onAfterRender: function () {}, applyMatrix: function ( matrix ) { this.matrix.multiplyMatrices( matrix, this.matrix ); this.matrix.decompose( this.position, this.quaternion, this.scale ); }, applyQuaternion: function ( q ) { this.quaternion.premultiply( q ); return this; }, <API key>: function ( axis, angle ) { // assumes axis is normalized this.quaternion.setFromAxisAngle( axis, angle ); }, <API key>: function ( euler ) { this.quaternion.setFromEuler( euler, true ); }, <API key>: function ( m ) { // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) this.quaternion.<API key>( m ); }, <API key>: function ( q ) { // assumes q is normalized this.quaternion.copy( q ); }, rotateOnAxis: function () { // rotate object on axis in object space // axis is assumed to be normalized var q1 = new Quaternion(); return function rotateOnAxis( axis, angle ) { q1.setFromAxisAngle( axis, angle ); this.quaternion.multiply( q1 ); return this; }; }(), rotateX: function () { var v1 = new Vector3( 1, 0, 0 ); return function rotateX( angle ) { return this.rotateOnAxis( v1, angle ); }; }(), rotateY: function () { var v1 = new Vector3( 0, 1, 0 ); return function rotateY( angle ) { return this.rotateOnAxis( v1, angle ); }; }(), rotateZ: function () { var v1 = new Vector3( 0, 0, 1 ); return function rotateZ( angle ) { return this.rotateOnAxis( v1, angle ); }; }(), translateOnAxis: function () { // translate object by distance along axis in object space // axis is assumed to be normalized var v1 = new Vector3(); return function translateOnAxis( axis, distance ) { v1.copy( axis ).applyQuaternion( this.quaternion ); this.position.add( v1.multiplyScalar( distance ) ); return this; }; }(), translateX: function () { var v1 = new Vector3( 1, 0, 0 ); return function translateX( distance ) { return this.translateOnAxis( v1, distance ); }; }(), translateY: function () { var v1 = new Vector3( 0, 1, 0 ); return function translateY( distance ) { return this.translateOnAxis( v1, distance ); }; }(), translateZ: function () { var v1 = new Vector3( 0, 0, 1 ); return function translateZ( distance ) { return this.translateOnAxis( v1, distance ); }; }(), localToWorld: function ( vector ) { return vector.applyMatrix4( this.matrixWorld ); }, worldToLocal: function () { var m1 = new Matrix4(); return function worldToLocal( vector ) { return vector.applyMatrix4( m1.getInverse( this.matrixWorld ) ); }; }(), lookAt: function () { // This method does not support objects with rotated and/or translated parent(s) var m1 = new Matrix4(); return function lookAt( vector ) { if ( this.isCamera ) { m1.lookAt( this.position, vector, this.up ); } else { m1.lookAt( vector, this.position, this.up ); } this.quaternion.<API key>( m1 ); }; }(), add: function ( object ) { if ( arguments.length > 1 ) { for ( var i = 0; i < arguments.length; i ++ ) { this.add( arguments[ i ] ); } return this; } if ( object === this ) { console.error( "THREE.Object3D.add: object can't be added as a child of itself.", object ); return this; } if ( ( object && object.isObject3D ) ) { if ( object.parent !== null ) { object.parent.remove( object ); } object.parent = this; object.dispatchEvent( { type: 'added' } ); this.children.push( object ); } else { console.error( "THREE.Object3D.add: object not an instance of THREE.Object3D.", object ); } return this; }, remove: function ( object ) { if ( arguments.length > 1 ) { for ( var i = 0; i < arguments.length; i ++ ) { this.remove( arguments[ i ] ); } return this; } var index = this.children.indexOf( object ); if ( index !== - 1 ) { object.parent = null; object.dispatchEvent( { type: 'removed' } ); this.children.splice( index, 1 ); } return this; }, getObjectById: function ( id ) { return this.getObjectByProperty( 'id', id ); }, getObjectByName: function ( name ) { return this.getObjectByProperty( 'name', name ); }, getObjectByProperty: function ( name, value ) { if ( this[ name ] === value ) return this; for ( var i = 0, l = this.children.length; i < l; i ++ ) { var child = this.children[ i ]; var object = child.getObjectByProperty( name, value ); if ( object !== undefined ) { return object; } } return undefined; }, getWorldPosition: function ( optionalTarget ) { var result = optionalTarget || new Vector3(); this.updateMatrixWorld( true ); return result.<API key>( this.matrixWorld ); }, getWorldQuaternion: function () { var position = new Vector3(); var scale = new Vector3(); return function getWorldQuaternion( optionalTarget ) { var result = optionalTarget || new Quaternion(); this.updateMatrixWorld( true ); this.matrixWorld.decompose( position, result, scale ); return result; }; }(), getWorldRotation: function () { var quaternion = new Quaternion(); return function getWorldRotation( optionalTarget ) { var result = optionalTarget || new Euler(); this.getWorldQuaternion( quaternion ); return result.setFromQuaternion( quaternion, this.rotation.order, false ); }; }(), getWorldScale: function () { var position = new Vector3(); var quaternion = new Quaternion(); return function getWorldScale( optionalTarget ) { var result = optionalTarget || new Vector3(); this.updateMatrixWorld( true ); this.matrixWorld.decompose( position, quaternion, result ); return result; }; }(), getWorldDirection: function () { var quaternion = new Quaternion(); return function getWorldDirection( optionalTarget ) { var result = optionalTarget || new Vector3(); this.getWorldQuaternion( quaternion ); return result.set( 0, 0, 1 ).applyQuaternion( quaternion ); }; }(), raycast: function () {}, traverse: function ( callback ) { callback( this ); var children = this.children; for ( var i = 0, l = children.length; i < l; i ++ ) { children[ i ].traverse( callback ); } }, traverseVisible: function ( callback ) { if ( this.visible === false ) return; callback( this ); var children = this.children; for ( var i = 0, l = children.length; i < l; i ++ ) { children[ i ].traverseVisible( callback ); } }, traverseAncestors: function ( callback ) { var parent = this.parent; if ( parent !== null ) { callback( parent ); parent.traverseAncestors( callback ); } }, updateMatrix: function () { this.matrix.compose( this.position, this.quaternion, this.scale ); this.<API key> = true; }, updateMatrixWorld: function ( force ) { if ( this.matrixAutoUpdate ) this.updateMatrix(); if ( this.<API key> || force ) { if ( this.parent === null ) { this.matrixWorld.copy( this.matrix ); } else { this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); } this.<API key> = false; force = true; } // update children var children = this.children; for ( var i = 0, l = children.length; i < l; i ++ ) { children[ i ].updateMatrixWorld( force ); } }, toJSON: function ( meta ) { // meta is '' when called from JSON.stringify var isRootObject = ( meta === undefined || meta === '' ); var output = {}; // meta is a hash used to collect geometries, materials. // not providing it implies that this is the root object // being serialized. if ( isRootObject ) { // initialize meta obj meta = { geometries: {}, materials: {}, textures: {}, images: {} }; output.metadata = { version: 4.5, type: 'Object', generator: 'Object3D.toJSON' }; } // standard Object3D serialization var object = {}; object.uuid = this.uuid; object.type = this.type; if ( this.name !== '' ) object.name = this.name; if ( this.castShadow === true ) object.castShadow = true; if ( this.receiveShadow === true ) object.receiveShadow = true; if ( this.visible === false ) object.visible = false; if ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData; object.matrix = this.matrix.toArray(); function serialize( library, element ) { if ( library[ element.uuid ] === undefined ) { library[ element.uuid ] = element.toJSON( meta ); } return element.uuid; } if ( this.geometry !== undefined ) { object.geometry = serialize( meta.geometries, this.geometry ); } if ( this.material !== undefined ) { if ( Array.isArray( this.material ) ) { var uuids = []; for ( var i = 0, l = this.material.length; i < l; i ++ ) { uuids.push( serialize( meta.materials, this.material[ i ] ) ); } object.material = uuids; } else { object.material = serialize( meta.materials, this.material ); } } if ( this.children.length > 0 ) { object.children = []; for ( var i = 0; i < this.children.length; i ++ ) { object.children.push( this.children[ i ].toJSON( meta ).object ); } } if ( isRootObject ) { var geometries = extractFromCache( meta.geometries ); var materials = extractFromCache( meta.materials ); var textures = extractFromCache( meta.textures ); var images = extractFromCache( meta.images ); if ( geometries.length > 0 ) output.geometries = geometries; if ( materials.length > 0 ) output.materials = materials; if ( textures.length > 0 ) output.textures = textures; if ( images.length > 0 ) output.images = images; } output.object = object; return output; // extract data from the cache hash // remove metadata on each item // and return as array function extractFromCache( cache ) { var values = []; for ( var key in cache ) { var data = cache[ key ]; delete data.metadata; values.push( data ); } return values; } }, clone: function ( recursive ) { return new this.constructor().copy( this, recursive ); }, copy: function ( source, recursive ) { if ( recursive === undefined ) recursive = true; this.name = source.name; this.up.copy( source.up ); this.position.copy( source.position ); this.quaternion.copy( source.quaternion ); this.scale.copy( source.scale ); this.matrix.copy( source.matrix ); this.matrixWorld.copy( source.matrixWorld ); this.matrixAutoUpdate = source.matrixAutoUpdate; this.<API key> = source.<API key>; this.layers.mask = source.layers.mask; this.visible = source.visible; this.castShadow = source.castShadow; this.receiveShadow = source.receiveShadow; this.frustumCulled = source.frustumCulled; this.renderOrder = source.renderOrder; this.userData = JSON.parse( JSON.stringify( source.userData ) ); if ( recursive === true ) { for ( var i = 0; i < source.children.length; i ++ ) { var child = source.children[ i ]; this.add( child.clone() ); } } return this; } } ); export { Object3D };
/* * 82542 Gigabit Ethernet Controller */ #include "e1000_api.h" STATIC s32 <API key>(struct e1000_hw *hw); STATIC s32 <API key>(struct e1000_hw *hw); STATIC s32 <API key>(struct e1000_hw *hw); STATIC s32 <API key>(struct e1000_hw *hw); STATIC s32 <API key>(struct e1000_hw *hw); STATIC s32 e1000_init_hw_82542(struct e1000_hw *hw); STATIC s32 <API key>(struct e1000_hw *hw); STATIC s32 e1000_led_on_82542(struct e1000_hw *hw); STATIC s32 e1000_led_off_82542(struct e1000_hw *hw); STATIC int e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index); STATIC void <API key>(struct e1000_hw *hw); STATIC s32 <API key>(struct e1000_hw *hw); /** * <API key> - Init PHY func ptrs. * @hw: pointer to the HW structure **/ STATIC s32 <API key>(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; DEBUGFUNC("<API key>"); phy->type = e1000_phy_none; return ret_val; } /** * <API key> - Init NVM func ptrs. * @hw: pointer to the HW structure **/ STATIC s32 <API key>(struct e1000_hw *hw) { struct e1000_nvm_info *nvm = &hw->nvm; DEBUGFUNC("<API key>"); nvm->address_bits = 6; nvm->delay_usec = 50; nvm->opcode_bits = 3; nvm->type = <API key>; nvm->word_size = 64; /* Function Pointers */ nvm->ops.read = <API key>; nvm->ops.release = e1000_stop_nvm; nvm->ops.write = <API key>; nvm->ops.update = <API key>; nvm->ops.validate = <API key>; return E1000_SUCCESS; } /** * <API key> - Init MAC func ptrs. * @hw: pointer to the HW structure **/ STATIC s32 <API key>(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; DEBUGFUNC("<API key>"); /* Set media type */ hw->phy.media_type = <API key>; /* Set mta register count */ mac->mta_reg_count = 128; /* Set rar entry count */ mac->rar_entry_count = E1000_RAR_ENTRIES; /* Function pointers */ /* bus type/speed/width */ mac->ops.get_bus_info = <API key>; /* function id */ mac->ops.set_lan_id = <API key>; /* reset */ mac->ops.reset_hw = <API key>; /* hw initialization */ mac->ops.init_hw = e1000_init_hw_82542; /* link setup */ mac->ops.setup_link = <API key>; /* phy/fiber/serdes setup */ mac->ops.<API key> = <API key>; /* check for link */ mac->ops.check_for_link = <API key>; /* multicast address update */ mac->ops.update_mc_addr_list = <API key>; /* writing VFTA */ mac->ops.write_vfta = <API key>; /* clearing VFTA */ mac->ops.clear_vfta = <API key>; /* read mac address */ mac->ops.read_mac_addr = <API key>; /* set RAR */ mac->ops.rar_set = e1000_rar_set_82542; /* turn on/off LED */ mac->ops.led_on = e1000_led_on_82542; mac->ops.led_off = e1000_led_off_82542; /* clear hardware counters */ mac->ops.clear_hw_cntrs = <API key>; /* link info */ mac->ops.get_link_up_info = <API key>; return E1000_SUCCESS; } /** * <API key> - Init func ptrs. * @hw: pointer to the HW structure * * Called to initialize all function pointers and parameters. **/ void <API key>(struct e1000_hw *hw) { DEBUGFUNC("<API key>"); hw->mac.ops.init_params = <API key>; hw->nvm.ops.init_params = <API key>; hw->phy.ops.init_params = <API key>; } /** * <API key> - Obtain bus information for adapter * @hw: pointer to the HW structure * * This will obtain information about the HW bus for which the * adapter is attached and stores it in the hw structure. **/ STATIC s32 <API key>(struct e1000_hw *hw) { DEBUGFUNC("<API key>"); hw->bus.type = e1000_bus_type_pci; hw->bus.speed = <API key>; hw->bus.width = <API key>; return E1000_SUCCESS; } /** * <API key> - Reset hardware * @hw: pointer to the HW structure * * This resets the hardware into a known state. **/ STATIC s32 <API key>(struct e1000_hw *hw) { struct e1000_bus_info *bus = &hw->bus; s32 ret_val = E1000_SUCCESS; u32 ctrl; DEBUGFUNC("<API key>"); if (hw->revision_id == E1000_REVISION_2) { DEBUGOUT("Disabling MWI on 82542 rev 2\n"); e1000_pci_clear_mwi(hw); } DEBUGOUT("Masking off all interrupts\n"); E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); E1000_WRITE_REG(hw, E1000_RCTL, 0); E1000_WRITE_REG(hw, E1000_TCTL, E1000_TCTL_PSP); E1000_WRITE_FLUSH(hw); /* * Delay to allow any outstanding PCI transactions to complete before * resetting the device */ msec_delay(10); ctrl = E1000_READ_REG(hw, E1000_CTRL); DEBUGOUT("Issuing a global reset to 82542/82543 MAC\n"); E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_RST); hw->nvm.ops.reload(hw); msec_delay(2); E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); E1000_READ_REG(hw, E1000_ICR); if (hw->revision_id == E1000_REVISION_2) { if (bus->pci_cmd_word & <API key>) e1000_pci_set_mwi(hw); } return ret_val; } /** * e1000_init_hw_82542 - Initialize hardware * @hw: pointer to the HW structure * * This inits the hardware readying it for operation. **/ STATIC s32 e1000_init_hw_82542(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; struct <API key> *dev_spec = &hw->dev_spec._82542; s32 ret_val = E1000_SUCCESS; u32 ctrl; u16 i; DEBUGFUNC("e1000_init_hw_82542"); /* Disabling VLAN filtering */ E1000_WRITE_REG(hw, E1000_VET, 0); mac->ops.clear_vfta(hw); /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ if (hw->revision_id == E1000_REVISION_2) { DEBUGOUT("Disabling MWI on 82542 rev 2.0\n"); e1000_pci_clear_mwi(hw); E1000_WRITE_REG(hw, E1000_RCTL, E1000_RCTL_RST); E1000_WRITE_FLUSH(hw); msec_delay(5); } /* Setup the receive address. */ <API key>(hw, mac->rar_entry_count); /* For 82542 (rev 2.0), take the receiver out of reset and enable MWI */ if (hw->revision_id == E1000_REVISION_2) { E1000_WRITE_REG(hw, E1000_RCTL, 0); E1000_WRITE_FLUSH(hw); msec_delay(1); if (hw->bus.pci_cmd_word & <API key>) e1000_pci_set_mwi(hw); } /* Zero out the Multicast HASH table */ DEBUGOUT("Zeroing the MTA\n"); for (i = 0; i < mac->mta_reg_count; i++) <API key>(hw, E1000_MTA, i, 0); /* * Set the PCI priority bit correctly in the CTRL register. This * determines if the adapter gives priority to receives, or if it * gives equal priority to transmits and receives. */ if (dev_spec->dma_fairness) { ctrl = E1000_READ_REG(hw, E1000_CTRL); E1000_WRITE_REG(hw, E1000_CTRL, ctrl | E1000_CTRL_PRIOR); } /* Setup link and flow control */ ret_val = <API key>(hw); /* * Clear all of the statistics registers (clear on read). It is * important that we do this after we have tried to establish link * because the symbol error count will increment wildly if there * is no link. */ <API key>(hw); return ret_val; } /** * <API key> - Setup flow control and link settings * @hw: pointer to the HW structure * * Determines which flow control settings to use, then configures flow * control. Calls the appropriate media-specific link configuration * function. Assuming the adapter has a valid link partner, a valid link * should be established. Assumes the hardware has previously been reset * and the transmitter and receiver are not enabled. **/ STATIC s32 <API key>(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; s32 ret_val; DEBUGFUNC("<API key>"); ret_val = <API key>(hw); if (ret_val) goto out; hw->fc.requested_mode &= ~e1000_fc_tx_pause; if (mac->report_tx_early) hw->fc.requested_mode &= ~e1000_fc_rx_pause; /* * Save off the requested flow control mode for use later. Depending * on the link partner's capabilities, we may or may not use this mode. */ hw->fc.current_mode = hw->fc.requested_mode; DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc.current_mode); /* Call the necessary subroutine to configure the link. */ ret_val = mac->ops.<API key>(hw); if (ret_val) goto out; /* * Initialize the flow control address, type, and PAUSE timer * registers to their default values. This is done even if flow * control is disabled, because it does not hurt anything to * initialize these registers. */ DEBUGOUT("Initializing Flow Control address, type and timer regs\n"); E1000_WRITE_REG(hw, E1000_FCAL, <API key>); E1000_WRITE_REG(hw, E1000_FCAH, <API key>); E1000_WRITE_REG(hw, E1000_FCT, FLOW_CONTROL_TYPE); E1000_WRITE_REG(hw, E1000_FCTTV, hw->fc.pause_time); ret_val = <API key>(hw); out: return ret_val; } /** * e1000_led_on_82542 - Turn on SW controllable LED * @hw: pointer to the HW structure * * Turns the SW defined LED on. **/ STATIC s32 e1000_led_on_82542(struct e1000_hw *hw) { u32 ctrl = E1000_READ_REG(hw, E1000_CTRL); DEBUGFUNC("e1000_led_on_82542"); ctrl |= E1000_CTRL_SWDPIN0; ctrl |= E1000_CTRL_SWDPIO0; E1000_WRITE_REG(hw, E1000_CTRL, ctrl); return E1000_SUCCESS; } /** * e1000_led_off_82542 - Turn off SW controllable LED * @hw: pointer to the HW structure * * Turns the SW defined LED off. **/ STATIC s32 e1000_led_off_82542(struct e1000_hw *hw) { u32 ctrl = E1000_READ_REG(hw, E1000_CTRL); DEBUGFUNC("e1000_led_off_82542"); ctrl &= ~E1000_CTRL_SWDPIN0; ctrl |= E1000_CTRL_SWDPIO0; E1000_WRITE_REG(hw, E1000_CTRL, ctrl); return E1000_SUCCESS; } /** * e1000_rar_set_82542 - Set receive address register * @hw: pointer to the HW structure * @addr: pointer to the receive address * @index: receive address array register * * Sets the receive address array register at index to the address passed * in by addr. **/ STATIC int e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index) { u32 rar_low, rar_high; DEBUGFUNC("e1000_rar_set_82542"); /* * HW expects these in little endian so we reverse the byte order * from network order (big endian) to little endian */ rar_low = ((u32) addr[0] | ((u32) addr[1] << 8) | ((u32) addr[2] << 16) | ((u32) addr[3] << 24)); rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); /* If MAC address zero, no need to set the AV bit */ if (rar_low || rar_high) rar_high |= E1000_RAH_AV; <API key>(hw, E1000_RA, (index << 1), rar_low); <API key>(hw, E1000_RA, ((index << 1) + 1), rar_high); return E1000_SUCCESS; } /** * <API key> - Translate the proper register offset * @reg: e1000 register to be read * * Registers in 82542 are located in different offsets than other adapters * even though they function in the same manner. This function takes in * the name of the register to read and returns the correct offset for * 82542 silicon. **/ u32 <API key>(u32 reg) { /* * Some of the 82542 registers are located at different * offsets than they are in newer adapters. * Despite the difference in location, the registers * function in the same manner. */ switch (reg) { case E1000_RA: reg = 0x00040; break; case E1000_RDTR: reg = 0x00108; break; case E1000_RDBAL(0): reg = 0x00110; break; case E1000_RDBAH(0): reg = 0x00114; break; case E1000_RDLEN(0): reg = 0x00118; break; case E1000_RDH(0): reg = 0x00120; break; case E1000_RDT(0): reg = 0x00128; break; case E1000_RDBAL(1): reg = 0x00138; break; case E1000_RDBAH(1): reg = 0x0013C; break; case E1000_RDLEN(1): reg = 0x00140; break; case E1000_RDH(1): reg = 0x00148; break; case E1000_RDT(1): reg = 0x00150; break; case E1000_FCRTH: reg = 0x00160; break; case E1000_FCRTL: reg = 0x00168; break; case E1000_MTA: reg = 0x00200; break; case E1000_TDBAL(0): reg = 0x00420; break; case E1000_TDBAH(0): reg = 0x00424; break; case E1000_TDLEN(0): reg = 0x00428; break; case E1000_TDH(0): reg = 0x00430; break; case E1000_TDT(0): reg = 0x00438; break; case E1000_TIDV: reg = 0x00440; break; case E1000_VFTA: reg = 0x00600; break; case E1000_TDFH: reg = 0x08010; break; case E1000_TDFT: reg = 0x08018; break; default: break; } return reg; } /** * <API key> - Clear device specific hardware counters * @hw: pointer to the HW structure * * Clears the hardware counters by reading the counter registers. **/ STATIC void <API key>(struct e1000_hw *hw) { DEBUGFUNC("<API key>"); <API key>(hw); E1000_READ_REG(hw, E1000_PRC64); E1000_READ_REG(hw, E1000_PRC127); E1000_READ_REG(hw, E1000_PRC255); E1000_READ_REG(hw, E1000_PRC511); E1000_READ_REG(hw, E1000_PRC1023); E1000_READ_REG(hw, E1000_PRC1522); E1000_READ_REG(hw, E1000_PTC64); E1000_READ_REG(hw, E1000_PTC127); E1000_READ_REG(hw, E1000_PTC255); E1000_READ_REG(hw, E1000_PTC511); E1000_READ_REG(hw, E1000_PTC1023); E1000_READ_REG(hw, E1000_PTC1522); } /** * <API key> - Read device MAC address * @hw: pointer to the HW structure * * Reads the device MAC address from the EEPROM and stores the value. **/ s32 <API key>(struct e1000_hw *hw) { s32 ret_val = E1000_SUCCESS; u16 offset, nvm_data, i; DEBUGFUNC("e1000_read_mac_addr"); for (i = 0; i < ETH_ADDR_LEN; i += 2) { offset = i >> 1; ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); if (ret_val) { DEBUGOUT("NVM Read Error\n"); goto out; } hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); } for (i = 0; i < ETH_ADDR_LEN; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; out: return ret_val; }
# coding=utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. from msrest.serialization import Model class ConnectivitySource(Model): """Parameters that define the source of the connection. All required parameters must be populated in order to send to Azure. :param resource_id: Required. The ID of the resource from which a connectivity check will be initiated. :type resource_id: str :param port: The source port from which a connectivity check will be performed. :type port: int """ _validation = { 'resource_id': {'required': True}, } _attribute_map = { 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'port': {'key': 'port', 'type': 'int'}, } def __init__(self, *, resource_id: str, port: int=None, **kwargs) -> None: super(ConnectivitySource, self).__init__(**kwargs) self.resource_id = resource_id self.port = port
export default window['%testCafeAutomation%'];
<div id="widgetinteract-{{widget.pk}}" rel="{{widget.pk}}" class="<API key>" title="{{widget.name}} interaction" width="400" height="300"> <form> <label for="class_name{{widget.pk}}">New class attribute name</label> <input type="text" name="class_name{{widget.pk}}" value="{{class_name}}"/> {% for class_val in class_values %} <label for="class{{forloop.counter0}}{{widget.pk}}">Class label for set on signal #{{forloop.counter}}</label> <input type="text" name="class{{forloop.counter0}}{{widget.pk}}" value="{{class_val}}"/> {% endfor %} <input type="checkbox" name="replace{{widget.pk}}" {% if replace %}checked{% endif %}/> <label for="replace{{widget.pk}}">Replace existing class</label> <input type="hidden" name="widget_id" value="{{widget.pk}}"> </form> <script type="text/javascript"> </script> </div>
title: <API key> page_title: <API key> | RadRibbonBar for ASP.NET AJAX Documentation description: <API key> slug: ribbonbar/<API key>/events/<API key> tags: <API key> published: True position: 18 # <API key> The **<API key>** client-side event occurs when the user is changing the selected item in the DropDown. 1. The instance of the **ribbonbar** firing the event 1. An **eventArgs** parameter containing the following methods: * get_dropDown() * get_index() * get_cance() * set_cancel()
require 'gmail_xoauth' module Gmail module Client class XOAuth < Base attr_reader :token attr_reader :secret attr_reader :consumer_key attr_reader :consumer_secret def initialize(username, options={}) @token = options.delete(:token) @secret = options.delete(:secret) @consumer_key = options.delete(:consumer_key) @consumer_secret = options.delete(:consumer_secret) super(username, options) end def login(raise_errors=false) @imap and @logged_in = (login = @imap.authenticate('XOAUTH', username, :consumer_key => consumer_key, :consumer_secret => consumer_secret, :token => token, :token_secret => secret )) && login.name == 'OK' rescue Net::IMAP::NoResponseError => e if raise_errors message = "Couldn't login to given GMail account: #{username}" message += " (#{e.response.data.text.strip})" raise(AuthorizationError.new(e.response), message, e.backtrace) end end def smtp_settings [:smtp, { :address => GMAIL_SMTP_HOST, :port => GMAIL_SMTP_PORT, :domain => mail_domain, :user_name => username, :password => { :consumer_key => consumer_key, :consumer_secret => consumer_secret, :token => token, :token_secret => secret }, :authentication => :xoauth, :<API key> => true }] end end # XOAuth register :xoauth, XOAuth end # Client end # Gmail
// sensible server which advertises itself via Bonjour // NODE INCLUDES var dgram = require ("dgram"); var fs = require ("fs"); var http = require ("http"); var os = require ("os"); var url = require ("url"); // REGULAR JS INCLUDES // assume that sensible.js lives in the same directory as our mainline var code = fs.readFileSync (require ("path").dirname (process.argv [1]) + "/sensible.js"); eval (code.toString ()); // MAINLINE sensible.ApplicationFactory.createApplication ( function (inError) { if (inError) { console.error ("error during sensible application startup"); console.error (inError); } else { console.log ("sensible application startup"); } } ); // called just before sensible.Application.start() sensible.node.Application.prototype.onBeforeStart = function (inCallback) { console.log ("node.Application.onBeforeStart()"); inCallback (); } // called just after sensible.Application.start() sensible.node.Application.prototype.onAfterStart = function (inCallback) { console.log ("node.Application.onAfterStart()"); inCallback (); }
<?php /** * This code was generated by * \ / _ _ _| _ _ * | (_)\/(_)(_|\/| |(/_ v1.0.0 * / / */ namespace Twilio\Rest\Preview\Understand\Assistant; use Twilio\InstanceContext; use Twilio\Options; use Twilio\Values; use Twilio\Version; /** * PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com. */ class QueryContext extends InstanceContext { /** * Initialize the QueryContext * * @param \Twilio\Version $version Version that contains the resource * @param string $assistantSid The assistant_sid * @param string $sid The sid * @return \Twilio\Rest\Preview\Understand\Assistant\QueryContext */ public function __construct(Version $version, $assistantSid, $sid) { parent::__construct($version); // Path Solution $this->solution = array('assistantSid' => $assistantSid, 'sid' => $sid, ); $this->uri = '/Assistants/' . rawurlencode($assistantSid) . '/Queries/' . rawurlencode($sid) . ''; } /** * Fetch a QueryInstance * * @return QueryInstance Fetched QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch() { $params = Values::of(array()); $payload = $this->version->fetch( 'GET', $this->uri, $params ); return new QueryInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Update the QueryInstance * * @param array|Options $options Optional Arguments * @return QueryInstance Updated QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function update($options = array()) { $options = new Values($options); $data = Values::of(array('SampleSid' => $options['sampleSid'], 'Status' => $options['status'], )); $payload = $this->version->update( 'POST', $this->uri, array(), $data ); return new QueryInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Deletes the QueryInstance * * @return boolean True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete() { return $this->version->delete('delete', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString() { $context = array(); foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.QueryContext ' . implode(' ', $context) . ']'; } }
<?php use yii\helpers\Html; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use yii\widgets\Breadcrumbs; use dixonsatit\agencyTheme\assets\AgencyAsset; /* @var $this \yii\web\View */ /* @var $content string */ AgencyAsset::register($this); $directoryAsset = Yii::$app->assetManager->getPublishedUrl('@dixonsatit/agencyTheme/dist'); ?> <?php $this->beginPage() ?> <!DOCTYPE html> <html lang="<?= Yii::$app->language ?>"> <head> <meta charset="<?= Yii::$app->charset ?>"> <meta name="viewport" content="width=device-width, initial-scale=1"> <?= Html::csrfMetaTags() ?> <title><?= Html::encode($this->title) ?></title> <?php $this->head() ?> </head> <body id="page-top" class="index"> <?php $this->beginBody() ?> <?= $content ?> <?php $this->endBody() ?> </body> </html> <?php $this->endPage() ?>
require 'test_helper' class InteractionTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
// The LLVM Compiler Infrastructure // This file is distributed under the University of Illinois Open Source #include "MCTargetDesc/X86FixupKinds.h" #include "MCTargetDesc/X86MCTargetDesc.h" #include "llvm/MC/MCELFObjectWriter.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCValue.h" #include "llvm/Support/ELF.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; namespace { class X86ELFObjectWriter : public <API key> { public: X86ELFObjectWriter(bool IsELF64, uint8_t OSABI, uint16_t EMachine); virtual ~X86ELFObjectWriter(); protected: virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup, bool IsPCRel, bool IsRelocWithSymbol, int64_t Addend) const; }; } X86ELFObjectWriter::X86ELFObjectWriter(bool IsELF64, uint8_t OSABI, uint16_t EMachine) : <API key>(IsELF64, OSABI, EMachine, // Only i386 uses Rel instead of RelA. /*HasRelocationAddend*/ EMachine != ELF::EM_386) {} X86ELFObjectWriter::~X86ELFObjectWriter() {} unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target, const MCFixup &Fixup, bool IsPCRel, bool IsRelocWithSymbol, int64_t Addend) const { // determine the type of the relocation MCSymbolRefExpr::VariantKind Modifier = Target.isAbsolute() ? MCSymbolRefExpr::VK_None : Target.getSymA()->getKind(); unsigned Type; if (getEMachine() == ELF::EM_X86_64) { if (IsPCRel) { switch ((unsigned)Fixup.getKind()) { default: llvm_unreachable("invalid fixup kind!"); case FK_Data_8: Type = ELF::R_X86_64_PC64; break; case FK_Data_4: Type = ELF::R_X86_64_PC32; break; case FK_Data_2: Type = ELF::R_X86_64_PC16; break; case FK_PCRel_8: assert(Modifier == MCSymbolRefExpr::VK_None); Type = ELF::R_X86_64_PC64; break; case X86::reloc_signed_4byte: case X86::<API key>: case X86::reloc_riprel_4byte: case FK_PCRel_4: switch (Modifier) { default: llvm_unreachable("Unimplemented"); case MCSymbolRefExpr::VK_None: Type = ELF::R_X86_64_PC32; break; case MCSymbolRefExpr::VK_PLT: Type = ELF::R_X86_64_PLT32; break; case MCSymbolRefExpr::VK_GOTPCREL: Type = ELF::R_X86_64_GOTPCREL; break; case MCSymbolRefExpr::VK_GOTTPOFF: Type = ELF::R_X86_64_GOTTPOFF; break; case MCSymbolRefExpr::VK_TLSGD: Type = ELF::R_X86_64_TLSGD; break; case MCSymbolRefExpr::VK_TLSLD: Type = ELF::R_X86_64_TLSLD; break; } break; case FK_PCRel_2: assert(Modifier == MCSymbolRefExpr::VK_None); Type = ELF::R_X86_64_PC16; break; case FK_PCRel_1: assert(Modifier == MCSymbolRefExpr::VK_None); Type = ELF::R_X86_64_PC8; break; } } else { switch ((unsigned)Fixup.getKind()) { default: llvm_unreachable("invalid fixup kind!"); case FK_Data_8: Type = ELF::R_X86_64_64; break; case X86::reloc_signed_4byte: switch (Modifier) { default: llvm_unreachable("Unimplemented"); case MCSymbolRefExpr::VK_None: Type = ELF::R_X86_64_32S; break; case MCSymbolRefExpr::VK_GOT: Type = ELF::R_X86_64_GOT32; break; case MCSymbolRefExpr::VK_GOTPCREL: Type = ELF::R_X86_64_GOTPCREL; break; case MCSymbolRefExpr::VK_TPOFF: Type = ELF::R_X86_64_TPOFF32; break; case MCSymbolRefExpr::VK_DTPOFF: Type = ELF::R_X86_64_DTPOFF32; break; } break; case FK_Data_4: Type = ELF::R_X86_64_32; break; case FK_Data_2: Type = ELF::R_X86_64_16; break; case FK_PCRel_1: case FK_Data_1: Type = ELF::R_X86_64_8; break; } } } else if (getEMachine() == ELF::EM_386) { if (IsPCRel) { switch ((unsigned)Fixup.getKind()) { default: llvm_unreachable("invalid fixup kind!"); case X86::<API key>: Type = ELF::R_386_GOTPC; break; case X86::reloc_signed_4byte: case FK_PCRel_4: case FK_Data_4: switch (Modifier) { default: llvm_unreachable("Unimplemented"); case MCSymbolRefExpr::VK_None: Type = ELF::R_386_PC32; break; case MCSymbolRefExpr::VK_PLT: Type = ELF::R_386_PLT32; break; } break; } } else { switch ((unsigned)Fixup.getKind()) { default: llvm_unreachable("invalid fixup kind!"); case X86::<API key>: Type = ELF::R_386_GOTPC; break; // FIXME: Should we avoid selecting reloc_signed_4byte in 32 bit mode // instead? case X86::reloc_signed_4byte: case FK_PCRel_4: case FK_Data_4: switch (Modifier) { default: llvm_unreachable("Unimplemented"); case MCSymbolRefExpr::VK_None: Type = ELF::R_386_32; break; case MCSymbolRefExpr::VK_GOT: Type = ELF::R_386_GOT32; break; case MCSymbolRefExpr::VK_GOTOFF: Type = ELF::R_386_GOTOFF; break; case MCSymbolRefExpr::VK_TLSGD: Type = ELF::R_386_TLS_GD; break; case MCSymbolRefExpr::VK_TPOFF: Type = ELF::R_386_TLS_LE_32; break; case MCSymbolRefExpr::VK_INDNTPOFF: Type = ELF::R_386_TLS_IE; break; case MCSymbolRefExpr::VK_NTPOFF: Type = ELF::R_386_TLS_LE; break; case MCSymbolRefExpr::VK_GOTNTPOFF: Type = ELF::R_386_TLS_GOTIE; break; case MCSymbolRefExpr::VK_TLSLDM: Type = ELF::R_386_TLS_LDM; break; case MCSymbolRefExpr::VK_DTPOFF: Type = ELF::R_386_TLS_LDO_32; break; case MCSymbolRefExpr::VK_GOTTPOFF: Type = ELF::R_386_TLS_IE_32; break; } break; case FK_Data_2: Type = ELF::R_386_16; break; case FK_PCRel_1: case FK_Data_1: Type = ELF::R_386_8; break; } } } else llvm_unreachable("Unsupported ELF machine type."); return Type; } MCObjectWriter *llvm::<API key>(raw_ostream &OS, bool IsELF64, uint8_t OSABI, uint16_t EMachine) { <API key> *MOTW = new X86ELFObjectWriter(IsELF64, OSABI, EMachine); return <API key>(MOTW, OS, /*IsLittleEndian=*/true); }
# = JavaScript Object Notation (JSON) # JSON is a lightweight data-interchange format. It is easy for us # humans to read and write. Plus, equally simple for machines to generate or parse. # JSON is completely language agnostic, making it the ideal interchange format. # Built on two universally available structures: # 1. A collection of name/value pairs. Often referred to as an _object_, hash table, record, struct, keyed list, or associative array. # 2. An orderd list of values. More commonly named as an _array_, vector, sequence, or list. # == Parsing JSON # To parse a JSON string received by another application, or generated within # your existing application: # require 'json' # my_hash = JSON.parse('{"hello": "goodbye"}') # puts my_hash["hello"] => "goodbye" # Notice the extra quotes <tt>''</tt> around the hash notation. Ruby expects # the argument to be a string and can't convert objects like a hash or array. # Ruby converts your string into a hash # == Generating JSON # Creating a JSON string for communication or serialization is # just as simple. # require 'json' # my_hash = {:hello => "goodbye"} # puts JSON.generate(my_hash) => "{\"hello\":\"goodbye\"}" # Or an alternative way: # require 'json' # puts {:hello => "goodbye"}.to_json => "{\"hello\":\"goodbye\"}" # <tt>JSON.generate</tt> only allows objects or arrays to be converted # to JSON syntax. While <tt>to_json</tt> accepts many Ruby classes # even though it only acts a method for serialization: # require 'json' # 1.to_json => "1" require 'json/common' module JSON require 'json/version' begin require 'json/ext' rescue LoadError require 'json/pure' end end
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="refresh" content="0;URL=../../../libc/constant.POSIX_FADV_WILLNEED.html"> </head> <body> <p>Redirecting to <a href="../../../libc/constant.POSIX_FADV_WILLNEED.html">../../../libc/constant.POSIX_FADV_WILLNEED.html</a>...</p> <script>location.replace("../../../libc/constant.POSIX_FADV_WILLNEED.html" + location.search + location.hash);</script> </body> </html>
#ifndef <API key> #define <API key> #include "py/pairheap.h" #define <API key> (1) #define <API key> (2) typedef struct _soft_timer_entry_t { mp_pairheap_t pairheap; uint32_t mode; uint32_t expiry_ms; uint32_t delta_ms; // for periodic mode mp_obj_t callback; } soft_timer_entry_t; extern volatile uint32_t soft_timer_next; void soft_timer_deinit(void); void soft_timer_handler(void); void soft_timer_insert(soft_timer_entry_t *entry); void soft_timer_remove(soft_timer_entry_t *entry); #endif // <API key>
"use strict"; // Rule Definition /** * Returns the name of the module imported or re-exported. * * @param {ASTNode} node - A node to get. * @returns {string} the name of the module, or empty string if no name. */ function getValue(node) { if (node && node.source && node.source.value) { return node.source.value.trim(); } return ""; } /** * Checks if the name of the import or export exists in the given array, and reports if so. * * @param {RuleContext} context - The ESLint rule context object. * @param {ASTNode} node - A node to get. * @param {string} value - The name of the imported or exported module. * @param {string[]} array - The array containing other imports or exports in the file. * @param {string} message - A message to be reported after the name of the module * * @returns {void} No return value */ function checkAndReport(context, node, value, array, message) { if (array.indexOf(value) !== -1) { context.report({ node: node, message: "'{{module}}' " + message, data: {module: value} }); } } /** * @callback nodeCallback * @param {ASTNode} node - A node to handle. */ /** * Returns a function handling the imports of a given file * * @param {RuleContext} context - The ESLint rule context object. * @param {boolean} includeExports - Whether or not to check for exports in addition to imports. * @param {string[]} importsInFile - The array containing other imports in the file. * @param {string[]} exportsInFile - The array containing other exports in the file. * * @returns {nodeCallback} A function passed to ESLint to handle the statement. */ function handleImports(context, includeExports, importsInFile, exportsInFile) { return function(node) { var value = getValue(node); if (value) { checkAndReport(context, node, value, importsInFile, "import is duplicated."); if (includeExports) { checkAndReport(context, node, value, exportsInFile, "import is duplicated as export."); } importsInFile.push(value); } }; } /** * Returns a function handling the exports of a given file * * @param {RuleContext} context - The ESLint rule context object. * @param {string[]} importsInFile - The array containing other imports in the file. * @param {string[]} exportsInFile - The array containing other exports in the file. * * @returns {nodeCallback} A function passed to ESLint to handle the statement. */ function handleExports(context, importsInFile, exportsInFile) { return function(node) { var value = getValue(node); if (value) { checkAndReport(context, node, value, exportsInFile, "export is duplicated."); checkAndReport(context, node, value, importsInFile, "export is duplicated as import."); exportsInFile.push(value); } }; } module.exports = function(context) { var includeExports = (context.options[0] || {}).includeExports, importsInFile = [], exportsInFile = []; var handlers = { "ImportDeclaration": handleImports(context, includeExports, importsInFile, exportsInFile) }; if (includeExports) { handlers.<API key> = handleExports(context, importsInFile, exportsInFile); handlers.<API key> = handleExports(context, importsInFile, exportsInFile); } return handlers; }; module.exports.schema = [{ "type": "object", "properties": { "includeExports": { "type": "boolean" } }, "<API key>": false }];
<fieldset> <legend>Δικαιώματα στις φωτογραφίες</legend> <p>Κάθε φωτογραφία έχει ένα <strong>επίπεδο προστασίας</strong> (ένα κλείδωμα). Κάθε χρήστης έχει επίσης ένα επίπεδο προστασίας (βασικό). There are 5 privacy levels:</p> <ol> <li>Κανένας</li> <li><em>Επαφές</em></li> <li><em>Φίλοι (η οποία είναι υψηλότερη από μια Eπαφή)</em></li> <li><em>Οικογένεια (η οποία είναι υψηλότερη από ένα Φίλο)</em></li> <li><em>Διαχειριστές (το οποίο είναι υψηλότερο από ό, τι οποιοδήποτε άλλο επίπεδο)</em></li> </ol> <p>Τα υψηλότερα επίπεδα έχουν δικαιώματα σε χαμηλότερα επίπεδα. Για ένα συγκεκριμένο χρήστη, όσο υψηλότερο είναι το επίπεδο προστασίας της ιδιωτικότητας, τόσο περισσότερες φωτογραφίες μπορεί να δει.</p> <p>Για παράδειγμα, εάν η φωτογραφία "peter_wedding-0024.jpg" έχει δικαιώματα <em>"Οικογένεια"</em>, Τότε:</p> <ul> <li>Πέτερ (που είναι <em>"Διαχειριστής"</em>) Θα δεί τη φωτογραφία γιατί <em>"Διαχειριστές"</em> μπορούν να δουν όλες τις φωτογραφίες</li> <li>Μπεθ (που είναι μέλος στο <em>"Οικογένεια"</em> ) επίσης θα δει τις φωτογραφίες</li> <li>Μαίρη(που είναι μια <em>"Φίλη"</em>) δεν θα δει τις φωτογραφίες</li> </ul> <p>Ένας χρήστης που δεν έχει άδεια για να δεί το περιεχόμενο του λευκώματος δεν θα δεί το ίδιο το λεύκωμα, ούτε καν τον τίτλο του. Η ίδια αρχή ισχύει και για μια ετικέτα.</p> <p>Μπορείτε να ρυθμίσετε το επίπεδο προστασίας της ιδιωτικότητας του χρήστη πάτε στην οθόνη <span class="pwgScreen">Διαχείριση &raquo; Χρήστες &raquo; Διαχειριστείτε </span>.</p> </fieldset> <fieldset> <legend>Δικαιώματα για τα Λευκώματα</legend> <p>Αν τα επίπεδα της ιδιωτικότητας δεν ταιριάζει στις ανάγκες σας, μπορείτε επίσης να διαχειριστείτε δικαιώματα στα λευκώματα για ένα χρήστη ή μια ομάδα. Μπορείτε να διαχειρίζεστε δικαιώματα για τις φωτογραφίες και τα λευκώματα ταυτόχρονα, χωρίς διενέξεις.</p> <p>Μπορείτε να απαγορεύσετε την πρόσβαση στα λευκώματα. Ενεργοποιήστε τον τύπο πρόσβασης στο λεύκωμα σε "ιδιωτικό" αν θέλετε να διαχειριστείτε δικαιώματα.</p> <p>Μπορείτε να ορίσετε ένα λεύκωμα ως ιδιωτικό με επεξεργασία κάποιου λευκώματος (<span class="pwgScreen">Διαχείριση &raquo; Λευκώματα &raquo; Διαχειριστείτε &raquo; Επεξεργαστείτε </span>) ή με τη ρύθμιση των επιλογών για όλο το δέντρο του λευκώματός σας (<span class="pwgScreen">Διαχείριση &raquo; Λευκώματα &raquo; Ιδιότητες &raquo; Δημόσιο / Ιδιωτικό</span>).</p> <p>Έτσι και το άλμπουμ είναι ιδιωτικό, μπορείτε να διαχειριστείτε δικαιώματα για τις ομάδες και τους χρήστες με 3 οθόνες:</p> <ul> <li><span class="pwgScreen">Διαχείριση &raquo; Χρήστες &raquo; Διαχειριστείτε &raquo; δράση δικαιωμάτων </span> (μία σύνδεση ανά χρήστη)</li> <li><span class="pwgScreen">Διαχείριση &raquo; Χρήστες &raquo; Ομάδες &raquo; δράση δικαιωμάτων</span> (μία σύνδεση ανά χρήστη)</li> <li><span class="pwgScreen">Διαχείριση &raquo; Λευκώματα &raquo; Διαχειριστείτε &raquo; επεξεργαστείτε δράση δικαιωμάτων λευκώματος</span> (μία σύνδεση ανά χρήστη)</li> </ul> </fieldset>
import{<API key>,<API key>}from"@material-ui/unstyled";export function <API key>(t){return <API key>("MuiCardActionArea",t)};var <API key>=<API key>("MuiCardActionArea",["root","focusVisible","focusHighlight"]);export default <API key>;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var strings={prefixAgo:null,prefixFromNow:null,suffixAgo:"",suffixFromNow:"",seconds:"1m",minute:"1m",minutes:"%dm",hour:"1h",hours:"%dh",day:"1g",days:"%dg",month:"1me",months:"%dme",year:"1a",years:"%da",wordSeparator:" "},_default=strings;exports.default=_default;
package org.eclipse.che.api.core.util; import com.sun.jna.Library; import com.sun.jna.Native; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; /** * Process manager for *nix like system. * * @author andrew00x */ class UnixProcessManager extends ProcessManager { /* At the moment tested on linux only. */ private static final Logger LOG = LoggerFactory.getLogger(UnixProcessManager.class); private static final CLibrary C_LIBRARY; private static final Field PID_FIELD; static { CLibrary lib = null; Field pidField = null; if (SystemInfo.isUnix()) { try { lib = ((CLibrary)Native.loadLibrary("c", CLibrary.class)); } catch (Exception e) { LOG.error("Cannot load native library", e); } try { pidField = Thread.currentThread().<API key>().loadClass("java.lang.UNIXProcess").getDeclaredField("pid"); pidField.setAccessible(true); } catch (Exception e) { LOG.error(e.getMessage(), e); } } C_LIBRARY = lib; PID_FIELD = pidField; } private static interface CLibrary extends Library { // kill -l int SIGKILL = 9; int SIGTERM = 15; int kill(int pid, int signal); String strerror(int errno); int system(String cmd); } private static final Pattern <API key> = Pattern.compile("\\s+"); @Override public void kill(Process process) { if (C_LIBRARY != null) { killTree(getPid(process)); } else { throw new <API key>("Can't kill process. Not unix system?"); } } private void killTree(int pid) { final int[] children = getChildProcesses(pid); LOG.debug("PID: {}, child PIDs: {}", pid, children); if (children.length > 0) { for (int cpid : children) { killTree(cpid); // kill process tree recursively } } int r = C_LIBRARY.kill(pid, CLibrary.SIGKILL); // kill origin process LOG.debug("kill {}", pid); if (r != 0) { if (LOG.isDebugEnabled()) { LOG.debug("kill for {} returns {}, strerror '{}'", pid, r, C_LIBRARY.strerror(r)); } } } private int[] getChildProcesses(final int myPid) { final String ps = "ps -e -o ppid,pid,comm"; /* PPID, PID, COMMAND */ final List<Integer> children = new ArrayList<>(); final StringBuilder error = new StringBuilder(); final LineConsumer stdout = new LineConsumer() { @Override public void writeLine(String line) throws IOException { if (line != null && !line.isEmpty()) { final String[] tokens = <API key>.split(line.trim()); if (tokens.length == 3 /* PPID, PID, COMMAND */) { int ppid; try { ppid = Integer.parseInt(tokens[0]); } catch (<API key> e) { // May be first line from process table: 'PPID PID COMMAND'. Skip it. return; } if (ppid == myPid) { int pid = Integer.parseInt(tokens[1]); children.add(pid); } } } } @Override public void close() throws IOException { } }; final LineConsumer stderr = new LineConsumer() { @Override public void writeLine(String line) throws IOException { if (error.length() > 0) { error.append('\n'); } error.append(line); } @Override public void close() throws IOException { } }; try { ProcessUtil.process(Runtime.getRuntime().exec(ps), stdout, stderr); } catch (IOException e) { throw new <API key>(e); } if (error.length() > 0) { throw new <API key>("can't get child processes: " + error.toString()); } final int size = children.size(); final int[] result = new int[size]; for (int i = 0; i < size; i++) { result[i] = children.get(i); } return result; } @Override public boolean isAlive(Process process) { return process.isAlive(); } int getPid(Process process) { if (PID_FIELD != null) { try { return ((Number)PID_FIELD.get(process)).intValue(); } catch (<API key> e) { throw new <API key>("Can't get process' pid. Not unix system?", e); } } else { throw new <API key>("Can't get process' pid. Not unix system?"); } } @Override int system(String command) { return C_LIBRARY.system(command); } }
package org.eclipse.che.ide.ui.toolbar; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.RootPanel; /** * This Lock Layer for Popup Menu uses as root for for Popup Menus and uses for closing all visible popups when user clicked outside one of * them. * * @author Vitaliy Guliy */ public class MenuLockLayer extends AbsolutePanel { /** Lock Layer uses for locking of screen. Uses for hiding popups. */ private class LockLayer extends AbsolutePanel { public LockLayer() { sinkEvents(Event.ONMOUSEDOWN); } @Override public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: close(); break; } } } /** Callback which is uses for closing Popup menu. */ private CloseMenuHandler closeMenuCallback; private int topOffset = 20; /** Create Menu Lock Layer. */ public MenuLockLayer() { this(null, 0); } /** * Create Menu Lock Layer. * * @param closeMenuCallback * - callback which is uses for */ public MenuLockLayer(CloseMenuHandler closeMenuCallback) { this(closeMenuCallback, 0); } public MenuLockLayer(CloseMenuHandler closeMenuCallback, int topOffset) { this.closeMenuCallback = closeMenuCallback; this.topOffset = topOffset; getElement().setId("menu-lock-layer-id"); RootPanel.get().add(this, 0, topOffset); getElement().getStyle().setProperty("right", "0px"); getElement().getStyle().setProperty("bottom", "0px"); getElement().getStyle().setProperty("zIndex", (Integer.MAX_VALUE - 5) + ""); AbsolutePanel <API key> = new LockLayer(); <API key>.setStyleName("exo-lockLayer"); <API key>.getElement().getStyle().setProperty("position", "absolute"); <API key>.getElement().getStyle().setProperty("left", "0px"); <API key>.getElement().getStyle().setProperty("top", "0px"); <API key>.getElement().getStyle().setProperty("right", "0px"); <API key>.getElement().getStyle().setProperty("bottom", "0px"); add(<API key>); } public void close() { removeFromParent(); if (closeMenuCallback != null) { closeMenuCallback.onCloseMenu(); } } public int getTopOffset() { return topOffset; } }
package backtype.storm.state; import java.util.List; public interface <API key> { void add(int streamId, Object id, List<Object> tuple); }
package org.eclipse.che.api.core.rest; import javax.ws.rs.core.UriBuilder; /** * Helps to deliver context of RESTful request to components. * * @author <a href="mailto:andrew00x@gmail.com">Andrey Parfonov</a> */ public interface ServiceContext { /** * Get UriBuilder which already contains base URI of RESTful application and URL pattern of RESTful service that produces this * instance. */ UriBuilder <API key>(); /** Get UriBuilder which already contains base URI of RESTful application. */ UriBuilder getBaseUriBuilder(); }
/** @file modules/ins/xsens700.h * Parser for the Xsens protocol. */ #ifndef XSENS700_H #define XSENS700_H #include "std.h" #include "math/pprz_algebra_float.h" #include "math/pprz_geodetic_float.h" #include "math/pprz_geodetic_int.h" #include "xsens_parser.h" #if USE_GPS_XSENS #include "subsystems/gps.h" #endif struct XsensTime { int8_t hour; int8_t min; int8_t sec; int32_t nanosec; int16_t year; int8_t month; int8_t day; }; struct Xsens { struct XsensTime time; uint16_t time_stamp; struct FloatRates gyro; struct FloatVect3 accel; struct FloatVect3 mag; struct LlaCoor_f lla_f; struct FloatVect3 vel; ///< NED velocity in m/s struct FloatQuat quat; struct FloatEulers euler; struct XsensParser parser; volatile bool new_attitude; bool gyro_available; bool accel_available; bool mag_available; #if USE_GPS_XSENS struct GpsState gps; bool gps_available; #endif }; extern struct Xsens xsens700; extern void xsens700_init(void); extern void xsens700_periodic(void); extern void parse_xsens700_msg(void); #endif /* XSENS700_H */
#ifndef __INTEL_MID_OTG_H #define __INTEL_MID_OTG_H #include <linux/pm.h> #include <linux/usb/otg.h> #include <linux/notifier.h> #include <linux/wakelock.h> struct intel_mid_otg_xceiv; /* This is a common data structure for Intel MID platform to * save values of the OTG state machine */ struct otg_hsm { /* Input */ int a_bus_resume; int a_bus_suspend; int a_conn; int a_sess_vld; int a_srp_det; int a_vbus_vld; int b_bus_resume; int b_bus_suspend; int b_conn; int b_se0_srp; int b_ssend_srp; int b_sess_end; int b_sess_vld; int id; /* id values */ #define ID_B 0x05 #define ID_A 0x04 #define ID_ACA_C 0x03 #define ID_ACA_B 0x02 #define ID_ACA_A 0x01 int power_up; int adp_change; int test_device; /* Internal variables */ int a_set_b_hnp_en; int b_srp_done; int b_hnp_enable; int hnp_poll_enable; /* Timeout indicator for timers */ int a_wait_vrise_tmout; int a_wait_bcon_tmout; int a_aidl_bdis_tmout; int a_bidl_adis_tmout; int a_bidl_adis_tmr; int a_wait_vfall_tmout; int b_ase0_brst_tmout; int b_bus_suspend_tmout; int b_srp_init_tmout; int b_srp_fail_tmout; int b_srp_fail_tmr; int b_adp_sense_tmout; int tst_maint_tmout; int tst_noadp_tmout; /* Informative variables */ int a_bus_drop; int a_bus_req; int a_clr_err; int b_bus_req; int a_suspend_req; int b_bus_suspend_vld; /* Output */ int drv_vbus; int loc_conn; int loc_sof; /* Others */ int vbus_srp_up; int ulpi_error; int ulpi_polling; /* Test Mode */ int otg_srp_reqd; int otg_hnp_reqd; int otg_vbus_off; int in_test_mode; }; /* must provide ULPI access function to read/write registers implemented in * ULPI address space */ struct <API key> { int (*read)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 *val); int (*write)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 val); }; #define OTG_A_DEVICE 0x0 #define OTG_B_DEVICE 0x1 /* * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact * with device and host drivers to implement the USB OTG related feature. More * function members are added based on usb_phy data structure for this * purpose. */ struct intel_mid_otg_xceiv { struct usb_phy otg; struct otg_hsm hsm; /* base address */ void __iomem *base; /* ops to access ulpi */ struct <API key> ulpi_ops; /* atomic notifier for interrupt context */ struct <API key> iotg_notifier; /* hnp poll lock */ spinlock_t hnp_poll_lock; #ifdef CONFIG_USB_SUSPEND struct wake_lock wake_lock; #endif /* start/stop USB Host function */ int (*start_host)(struct intel_mid_otg_xceiv *iotg); int (*stop_host)(struct intel_mid_otg_xceiv *iotg); /* start/stop USB Peripheral function */ int (*start_peripheral)(struct intel_mid_otg_xceiv *iotg); int (*stop_peripheral)(struct intel_mid_otg_xceiv *iotg); /* start/stop ADP sense/probe function */ int (*set_adp_probe)(struct intel_mid_otg_xceiv *iotg, bool enabled, int dev); int (*set_adp_sense)(struct intel_mid_otg_xceiv *iotg, bool enabled); /* start/stop HNP Polling function */ int (*start_hnp_poll)(struct intel_mid_otg_xceiv *iotg); int (*stop_hnp_poll)(struct intel_mid_otg_xceiv *iotg); #ifdef CONFIG_PM /* suspend/resume USB host function */ int (*suspend_host)(struct intel_mid_otg_xceiv *iotg); int (*suspend_noirq_host)(struct intel_mid_otg_xceiv *iotg); int (*resume_host)(struct intel_mid_otg_xceiv *iotg); int (*resume_noirq_host)(struct intel_mid_otg_xceiv *iotg); int (*suspend_peripheral)(struct intel_mid_otg_xceiv *iotg, pm_message_t message); int (*resume_peripheral)(struct intel_mid_otg_xceiv *iotg); /* runtime suspend/resume */ int (*<API key>)(struct intel_mid_otg_xceiv *iotg); int (*runtime_resume_host)(struct intel_mid_otg_xceiv *iotg); int (*<API key>)(struct intel_mid_otg_xceiv *iotg); int (*<API key>)(struct intel_mid_otg_xceiv *iotg); #endif }; static inline struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg) { return container_of(otg, struct intel_mid_otg_xceiv, otg); } #define <API key> 0x0001 #define <API key> 0x0002 #define <API key> 0x0003 #define <API key> 0x0004 #define <API key> 0x0005 #define <API key> 0x0006 #define <API key> 0x0007 #define <API key> 0x0008 #define <API key> 0x0009 #define <API key> 0x000a #define <API key> 0x000b #define <API key> 0x0101 #define <API key> 0x0102 #define MID_OTG_NOTIFY_TEST 0x0103 #define <API key> 0x0104 #define <API key> 0x0105 static inline int <API key>(struct intel_mid_otg_xceiv *iotg, struct notifier_block *nb) { return <API key>(&iotg->iotg_notifier, nb); } static inline void <API key>(struct intel_mid_otg_xceiv *iotg, struct notifier_block *nb) { <API key>(&iotg->iotg_notifier, nb); } #endif /* __INTEL_MID_OTG_H */
#include <linux/kernel.h> #include <linux/mm.h> #include <linux/tty.h> #include <linux/tty_driver.h> #include <linux/console.h> #include <linux/init.h> #include <linux/jiffies.h> #include <linux/nmi.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/interrupt.h> /* For in_interrupt() */ #include <linux/delay.h> #include <linux/smp.h> #include <linux/security.h> #include <linux/bootmem.h> #include <linux/syscalls.h> #include <asm/uaccess.h> /* * Architectures can override it: */ void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...) { } #define __LOG_BUF_LEN (1 << <API key>) /* printk's without a loglevel use this.. */ #define <API key> 4 /* KERN_WARNING */ /* We show everything that is MORE important than this.. */ #define <API key> 1 /* Minimum loglevel we let people use */ #define <API key> 7 /* anything MORE serious than KERN_DEBUG */ <API key>(log_wait); int console_printk[4] = { <API key>, /* console_loglevel */ <API key>, /* <API key> */ <API key>, /* <API key> */ <API key>, /* <API key> */ }; /* * Low level drivers may need that to know if they can schedule in * their unblank() callback or not. So let's export it. */ int oops_in_progress; EXPORT_SYMBOL(oops_in_progress); /* * console_sem protects the console_drivers list, and also * provides serialisation for access to the entire console * driver system. */ static DECLARE_MUTEX(console_sem); struct console *console_drivers; EXPORT_SYMBOL_GPL(console_drivers); /* * This is used for debugging the mess that is the VT code by * keeping track if we have the console semaphore held. It's * definitely not the perfect debug tool (we don't know if _WE_ * hold it are racing, but it helps tracking those weird code * path in the console code where we end up in places I want * locked without the console sempahore held */ static int console_locked, console_suspended; /* * logbuf_lock protects log_buf, log_start, log_end, con_start and logged_chars * It is also used in interesting ways to provide interlocking in * release_console_sem(). */ static DEFINE_SPINLOCK(logbuf_lock); #define LOG_BUF_MASK (log_buf_len-1) #define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK]) /* * The indices into log_buf are not constrained to log_buf_len - they * must be masked before subscripting */ static unsigned log_start; /* Index into log_buf: next char to be read by syslog() */ static unsigned con_start; /* Index into log_buf: next char to be sent to consoles */ static unsigned log_end; /* Index into log_buf: <API key> + 1 */ /* * Array of consoles built from command line options (console=) */ struct console_cmdline { char name[8]; /* Name of the driver */ int index; /* Minor dev. to use */ char *options; /* Options for the driver */ #ifdef <API key> char *brl_options; /* Options for braille driver */ #endif }; #define MAX_CMDLINECONSOLES 8 static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; static int selected_console = -1; static int preferred_console = -1; int <API key>; EXPORT_SYMBOL(<API key>); /* Flag: console code may call schedule() */ static int <API key>; #ifdef CONFIG_PRINTK static char __log_buf[__LOG_BUF_LEN]; static char *log_buf = __log_buf; static int log_buf_len = __LOG_BUF_LEN; static unsigned logged_chars; /* Number of chars produced since last read+clear operation */ static int __init log_buf_len_setup(char *str) { unsigned size = memparse(str, &str); unsigned long flags; if (size) size = roundup_pow_of_two(size); if (size > log_buf_len) { unsigned start, dest_idx, offset; char *new_log_buf; new_log_buf = alloc_bootmem(size); if (!new_log_buf) { printk(KERN_WARNING "log_buf_len: allocation failed\n"); goto out; } spin_lock_irqsave(&logbuf_lock, flags); log_buf_len = size; log_buf = new_log_buf; offset = start = min(con_start, log_start); dest_idx = 0; while (start != log_end) { log_buf[dest_idx] = __log_buf[start & (__LOG_BUF_LEN - 1)]; start++; dest_idx++; } log_start -= offset; con_start -= offset; log_end -= offset; <API key>(&logbuf_lock, flags); printk(KERN_NOTICE "log_buf_len: %d\n", log_buf_len); } out: return 1; } __setup("log_buf_len=", log_buf_len_setup); #ifdef <API key> static unsigned int boot_delay; /* msecs delay after each printk during bootup */ static unsigned long long printk_delay_msec; /* per msec, based on boot_delay */ static int __init boot_delay_setup(char *str) { unsigned long lpj; unsigned long long loops_per_msec; lpj = preset_lpj ? preset_lpj : 1000000; /* some guess */ loops_per_msec = (unsigned long long)lpj / 1000 * HZ; get_option(&str, &boot_delay); if (boot_delay > 10 * 1000) boot_delay = 0; printk_delay_msec = loops_per_msec; printk(KERN_DEBUG "boot_delay: %u, preset_lpj: %ld, lpj: %lu, " "HZ: %d, printk_delay_msec: %llu\n", boot_delay, preset_lpj, lpj, HZ, printk_delay_msec); return 1; } __setup("boot_delay=", boot_delay_setup); static void boot_delay_msec(void) { unsigned long long k; unsigned long timeout; if (boot_delay == 0 || system_state != SYSTEM_BOOTING) return; k = (unsigned long long)printk_delay_msec * boot_delay; timeout = jiffies + msecs_to_jiffies(boot_delay); while (k) { k cpu_relax(); /* * use (volatile) jiffies to prevent * compiler reduction; loop termination via jiffies * is secondary and may or may not happen. */ if (time_after(jiffies, timeout)) break; touch_nmi_watchdog(); } } #else static inline void boot_delay_msec(void) { } #endif /* * Commands to do_syslog: * * 0 -- Close the log. Currently a NOP. * 1 -- Open the log. Currently a NOP. * 2 -- Read from the log. * 3 -- Read all messages remaining in the ring buffer. * 4 -- Read and clear all messages remaining in the ring buffer * 5 -- Clear ring buffer. * 6 -- Disable printk's to console * 7 -- Enable printk's to console * 8 -- Set level of messages printed to console * 9 -- Return number of unread characters in the log buffer * 10 -- Return size of the log buffer */ int do_syslog(int type, char __user *buf, int len) { unsigned i, j, limit, count; int do_clear = 0; char c; int error = 0; error = security_syslog(type); if (error) return error; switch (type) { case 0: /* Close log */ break; case 1: /* Open log */ break; case 2: /* Read from log */ error = -EINVAL; if (!buf || len < 0) goto out; error = 0; if (!len) goto out; if (!access_ok(VERIFY_WRITE, buf, len)) { error = -EFAULT; goto out; } error = <API key>(log_wait, (log_start - log_end)); if (error) goto out; i = 0; spin_lock_irq(&logbuf_lock); while (!error && (log_start != log_end) && i < len) { c = LOG_BUF(log_start); log_start++; spin_unlock_irq(&logbuf_lock); error = __put_user(c,buf); buf++; i++; cond_resched(); spin_lock_irq(&logbuf_lock); } spin_unlock_irq(&logbuf_lock); if (!error) error = i; break; case 4: /* Read/clear last kernel messages */ do_clear = 1; /* FALL THRU */ case 3: /* Read last kernel messages */ error = -EINVAL; if (!buf || len < 0) goto out; error = 0; if (!len) goto out; if (!access_ok(VERIFY_WRITE, buf, len)) { error = -EFAULT; goto out; } count = len; if (count > log_buf_len) count = log_buf_len; spin_lock_irq(&logbuf_lock); if (count > logged_chars) count = logged_chars; if (do_clear) logged_chars = 0; limit = log_end; /* * __put_user() could sleep, and while we sleep * printk() could overwrite the messages * we try to copy to user space. Therefore * the messages are copied in reverse. <manfreds> */ for (i = 0; i < count && !error; i++) { j = limit-1-i; if (j + log_buf_len < log_end) break; c = LOG_BUF(j); spin_unlock_irq(&logbuf_lock); error = __put_user(c,&buf[count-1-i]); cond_resched(); spin_lock_irq(&logbuf_lock); } spin_unlock_irq(&logbuf_lock); if (error) break; error = i; if (i != count) { int offset = count-error; /* buffer overflow during copy, correct user buffer. */ for (i = 0; i < error; i++) { if (__get_user(c,&buf[i+offset]) || __put_user(c,&buf[i])) { error = -EFAULT; break; } cond_resched(); } } break; case 5: /* Clear ring buffer */ logged_chars = 0; break; case 6: /* Disable logging to console */ console_loglevel = <API key>; break; case 7: /* Enable logging to console */ console_loglevel = <API key>; break; case 8: /* Set level of messages printed to console */ error = -EINVAL; if (len < 1 || len > 8) goto out; if (len < <API key>) len = <API key>; console_loglevel = len; error = 0; break; case 9: /* Number of chars in the log buffer */ error = log_end - log_start; break; case 10: /* Size of the log buffer */ error = log_buf_len; break; default: error = -EINVAL; break; } out: return error; } SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) { return do_syslog(type, buf, len); } /* * Call the console drivers on a range of log_buf */ static void <API key>(unsigned start, unsigned end) { struct console *con; for (con = console_drivers; con; con = con->next) { if ((con->flags & CON_ENABLED) && con->write && (cpu_online(smp_processor_id()) || (con->flags & CON_ANYTIME))) con->write(con, &LOG_BUF(start), end - start); } } static int __read_mostly ignore_loglevel; static int __init <API key>(char *str) { ignore_loglevel = 1; printk(KERN_INFO "debug: ignoring loglevel setting.\n"); return 0; } early_param("ignore_loglevel", <API key>); /* * Write out chars from start to end - 1 inclusive */ static void <API key>(unsigned start, unsigned end, int msg_log_level) { if ((msg_log_level < console_loglevel || ignore_loglevel) && console_drivers && start != end) { if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) { /* wrapped write */ <API key>(start & LOG_BUF_MASK, log_buf_len); <API key>(0, end & LOG_BUF_MASK); } else { <API key>(start, end); } } } /* * Call the console drivers, asking them to write out * log_buf[start] to log_buf[end - 1]. * The console_sem must be held. */ static void <API key>(unsigned start, unsigned end) { unsigned cur_index, start_print; static int msg_level = -1; BUG_ON(((int)(start - end)) > 0); cur_index = start; start_print = start; while (cur_index != end) { if (msg_level < 0 && ((end - cur_index) > 2) && LOG_BUF(cur_index + 0) == '<' && LOG_BUF(cur_index + 1) >= '0' && LOG_BUF(cur_index + 1) <= '7' && LOG_BUF(cur_index + 2) == '>') { msg_level = LOG_BUF(cur_index + 1) - '0'; cur_index += 3; start_print = cur_index; } while (cur_index != end) { char c = LOG_BUF(cur_index); cur_index++; if (c == '\n') { if (msg_level < 0) { /* * printk() has already given us loglevel tags in * the buffer. This code is here in case the * log buffer has wrapped right round and scribbled * on those tags */ msg_level = <API key>; } <API key>(start_print, cur_index, msg_level); msg_level = -1; start_print = cur_index; break; } } } <API key>(start_print, end, msg_level); } static void emit_log_char(char c) { LOG_BUF(log_end) = c; log_end++; if (log_end - log_start > log_buf_len) log_start = log_end - log_buf_len; if (log_end - con_start > log_buf_len) con_start = log_end - log_buf_len; if (logged_chars < log_buf_len) logged_chars++; } /* * Zap console related locks when oopsing. Only zap at most once * every 10 seconds, to leave time for slow consoles to print a * full oops. */ static void zap_locks(void) { static unsigned long oops_timestamp; if (time_after_eq(jiffies, oops_timestamp) && !time_after(jiffies, oops_timestamp + 30 * HZ)) return; oops_timestamp = jiffies; /* If a crash is occurring, make sure we can't deadlock */ spin_lock_init(&logbuf_lock); /* And make sure that we print immediately */ init_MUTEX(&console_sem); } #if defined(CONFIG_PRINTK_TIME) static int printk_time = 1; #else static int printk_time = 0; #endif module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR); /* Check if we have any console registered that can be called early in boot. */ static int <API key>(void) { struct console *con; for (con = console_drivers; con; con = con->next) if (con->flags & CON_ANYTIME) return 1; return 0; } /** * printk - print a kernel message * @fmt: format string * * This is printk(). It can be called from any context. We want it to work. * * We try to grab the console_sem. If we succeed, it's easy - we log the output and * call the console drivers. If we fail to get the semaphore we place the output * into the log buffer and return. The current holder of the console_sem will * notice the new output in release_console_sem() and will send it to the * consoles before releasing the semaphore. * * One effect of this deferred printing is that code which calls printk() and * then changes console_loglevel may break. This is because console_loglevel * is inspected when the actual printing occurs. * * See also: * printf(3) * * See the vsnprintf() documentation for format string extensions over C99. */ asmlinkage int printk(const char *fmt, ...) { va_list args; int r; va_start(args, fmt); r = vprintk(fmt, args); va_end(args); return r; } /* cpu currently holding logbuf_lock */ static volatile unsigned int printk_cpu = UINT_MAX; /* * Can we actually use the console at this time on this cpu? * * Console drivers may assume that per-cpu resources have * been allocated. So unless they're explicitly marked as * being able to cope (CON_ANYTIME) don't call them until * this CPU is officially up. */ static inline int can_use_console(unsigned int cpu) { return cpu_online(cpu) || <API key>(); } /* * Try to get console ownership to actually show the kernel * messages from a 'printk'. Return true (and with the * console_semaphore held, and 'console_locked' set) if it * is successful, false otherwise. * * This gets called with the 'logbuf_lock' spinlock held and * interrupts disabled. It should return with 'lockbuf_lock' * released but interrupts still disabled. */ static int <API key>(unsigned int cpu) { int retval = 0; if (!<API key>()) { retval = 1; /* * If we can't use the console, we need to release * the console semaphore by hand to avoid flushing * the buffer. We need to hold the console semaphore * in order to do this test safely. */ if (!can_use_console(cpu)) { console_locked = 0; up(&console_sem); retval = 0; } } printk_cpu = UINT_MAX; spin_unlock(&logbuf_lock); return retval; } static const char recursion_bug_msg [] = KERN_CRIT "BUG: recent printk recursion!\n"; static int recursion_bug; static int new_text_line = 1; static char printk_buf[1024]; asmlinkage int vprintk(const char *fmt, va_list args) { int printed_len = 0; int current_log_level = <API key>; unsigned long flags; int this_cpu; char *p; boot_delay_msec(); preempt_disable(); /* This stops the holder of console_sem just where we want him */ raw_local_irq_save(flags); this_cpu = smp_processor_id(); /* * Ouch, printk recursed into itself! */ if (unlikely(printk_cpu == this_cpu)) { /* * If a crash is occurring during printk() on this CPU, * then try to get the crash message out but make sure * we can't deadlock. Otherwise just return to avoid the * recursion and return - but flag the recursion so that * it can be printed at the next appropriate moment: */ if (!oops_in_progress) { recursion_bug = 1; goto out_restore_irqs; } zap_locks(); } lockdep_off(); spin_lock(&logbuf_lock); printk_cpu = this_cpu; if (recursion_bug) { recursion_bug = 0; strcpy(printk_buf, recursion_bug_msg); printed_len = strlen(recursion_bug_msg); } /* Emit the output into the temporary buffer */ printed_len += vscnprintf(printk_buf + printed_len, sizeof(printk_buf) - printed_len, fmt, args); /* * Copy the output into log_buf. If the caller didn't provide * appropriate log level tags, we insert them here */ for (p = printk_buf; *p; p++) { if (new_text_line) { /* If a token, set current_log_level and skip over */ if (p[0] == '<' && p[1] >= '0' && p[1] <= '7' && p[2] == '>') { current_log_level = p[1] - '0'; p += 3; printed_len -= 3; } /* Always output the token */ emit_log_char('<'); emit_log_char(current_log_level + '0'); emit_log_char('>'); printed_len += 3; new_text_line = 0; if (printk_time) { /* Follow the token with the time */ char tbuf[50], *tp; unsigned tlen; unsigned long long t; unsigned long nanosec_rem; t = cpu_clock(printk_cpu); nanosec_rem = do_div(t, 1000000000); tlen = sprintf(tbuf, "[%5lu.%06lu] ", (unsigned long) t, nanosec_rem / 1000); for (tp = tbuf; tp < tbuf + tlen; tp++) emit_log_char(*tp); printed_len += tlen; } if (!*p) break; } emit_log_char(*p); if (*p == '\n') new_text_line = 1; } /* * Try to acquire and then immediately release the * console semaphore. The release will do all the * actual magic (print out buffers, wake up klogd, * etc). * * The <API key>() function * will release 'logbuf_lock' regardless of whether it * actually gets the semaphore or not. */ if (<API key>(this_cpu)) release_console_sem(); lockdep_on(); out_restore_irqs: <API key>(flags); preempt_enable(); return printed_len; } EXPORT_SYMBOL(printk); EXPORT_SYMBOL(vprintk); #else static void <API key>(unsigned start, unsigned end) { } #endif static int <API key>(char *name, int idx, char *options, char *brl_options) { struct console_cmdline *c; int i; /* * See if this tty is not yet registered, and * if we have a slot free. */ for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) if (strcmp(console_cmdline[i].name, name) == 0 && console_cmdline[i].index == idx) { if (!brl_options) selected_console = i; return 0; } if (i == MAX_CMDLINECONSOLES) return -E2BIG; if (!brl_options) selected_console = i; c = &console_cmdline[i]; strlcpy(c->name, name, sizeof(c->name)); c->options = options; #ifdef <API key> c->brl_options = brl_options; #endif c->index = idx; return 0; } /* * Set up a list of consoles. Called from init/main.c */ static int __init console_setup(char *str) { char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for index */ char *s, *options, *brl_options = NULL; int idx; #ifdef <API key> if (!memcmp(str, "brl,", 4)) { brl_options = ""; str += 4; } else if (!memcmp(str, "brl=", 4)) { brl_options = str + 4; str = strchr(brl_options, ','); if (!str) { printk(KERN_ERR "need port name after brl=\n"); return 1; } *(str++) = 0; } #endif /* * Decode str into name, index, options. */ if (str[0] >= '0' && str[0] <= '9') { strcpy(buf, "ttyS"); strncpy(buf + 4, str, sizeof(buf) - 5); } else { strncpy(buf, str, sizeof(buf) - 1); } buf[sizeof(buf) - 1] = 0; if ((options = strchr(str, ',')) != NULL) *(options++) = 0; #ifdef __sparc__ if (!strcmp(str, "ttya")) strcpy(buf, "ttyS0"); if (!strcmp(str, "ttyb")) strcpy(buf, "ttyS1"); #endif for (s = buf; *s; s++) if ((*s >= '0' && *s <= '9') || *s == ',') break; idx = simple_strtoul(s, NULL, 10); *s = 0; <API key>(buf, idx, options, brl_options); <API key> = 1; return 1; } __setup("console=", console_setup); /** * <API key> - add a device to the list of preferred consoles. * @name: device name * @idx: device index * @options: options for this console * * The last preferred console added will be used for kernel messages * and stdin/out/err for init. Normally this is used by console_setup * above to handle user-supplied console arguments; however it can also * be used by arch-specific code either to override the user or more * commonly to provide a default console (ie from PROM variables) when * the user has not supplied one. */ int <API key>(char *name, int idx, char *options) { return <API key>(name, idx, options, NULL); } int <API key>(char *name, int idx, char *name_new, int idx_new, char *options) { struct console_cmdline *c; int i; for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) if (strcmp(console_cmdline[i].name, name) == 0 && console_cmdline[i].index == idx) { c = &console_cmdline[i]; strlcpy(c->name, name_new, sizeof(c->name)); c->name[sizeof(c->name) - 1] = 0; c->options = options; c->index = idx_new; return i; } /* not found */ return -1; } int <API key> = 1; EXPORT_SYMBOL(<API key>); static int __init <API key>(char *str) { <API key> = 0; return 1; } __setup("no_console_suspend", <API key>); /** * suspend_console - suspend the console subsystem * * This disables printk() while we go into suspend states */ void suspend_console(void) { if (!<API key>) return; printk("Suspending console(s) (use no_console_suspend to debug)\n"); acquire_console_sem(); console_suspended = 1; up(&console_sem); } void resume_console(void) { if (!<API key>) return; down(&console_sem); console_suspended = 0; release_console_sem(); } /** * acquire_console_sem - lock the console system for exclusive use. * * Acquires a semaphore which guarantees that the caller has * exclusive access to the console system and the console_drivers list. * * Can sleep, returns nothing. */ void acquire_console_sem(void) { BUG_ON(in_interrupt()); down(&console_sem); if (console_suspended) return; console_locked = 1; <API key> = 1; } EXPORT_SYMBOL(acquire_console_sem); int <API key>(void) { if (down_trylock(&console_sem)) return -1; if (console_suspended) { up(&console_sem); return -1; } console_locked = 1; <API key> = 0; return 0; } EXPORT_SYMBOL(<API key>); int is_console_locked(void) { return console_locked; } static DEFINE_PER_CPU(int, printk_pending); void printk_tick(void) { if (__get_cpu_var(printk_pending)) { __get_cpu_var(printk_pending) = 0; <API key>(&log_wait); } } int printk_needs_cpu(int cpu) { return per_cpu(printk_pending, cpu); } void wake_up_klogd(void) { if (waitqueue_active(&log_wait)) __raw_get_cpu_var(printk_pending) = 1; } /** * release_console_sem - unlock the console system * * Releases the semaphore which the caller holds on the console system * and the console driver list. * * While the semaphore was held, console output may have been buffered * by printk(). If this is the case, release_console_sem() emits * the output prior to releasing the semaphore. * * If there is output waiting for klogd, we wake it up. * * release_console_sem() may be called from any context. */ void release_console_sem(void) { unsigned long flags; unsigned _con_start, _log_end; unsigned wake_klogd = 0; if (console_suspended) { up(&console_sem); return; } <API key> = 0; for ( ; ; ) { spin_lock_irqsave(&logbuf_lock, flags); wake_klogd |= log_start - log_end; if (con_start == log_end) break; /* Nothing to print */ _con_start = con_start; _log_end = log_end; con_start = log_end; /* Flush */ spin_unlock(&logbuf_lock); <API key>(); /* don't trace print latency */ <API key>(_con_start, _log_end); <API key>(); local_irq_restore(flags); } console_locked = 0; up(&console_sem); <API key>(&logbuf_lock, flags); if (wake_klogd) wake_up_klogd(); } EXPORT_SYMBOL(release_console_sem); /** * <API key> - yield the CPU if required * * If the console code is currently allowed to sleep, and * if this CPU should yield the CPU to another task, do * so here. * * Must be called within acquire_console_sem(). */ void __sched <API key>(void) { if (<API key>) cond_resched(); } EXPORT_SYMBOL(<API key>); void console_print(const char *s) { printk(KERN_EMERG "%s", s); } EXPORT_SYMBOL(console_print); void console_unblank(void) { struct console *c; /* * console_unblank can no longer be called in interrupt context unless * oops_in_progress is set to 1.. */ if (oops_in_progress) { if (down_trylock(&console_sem) != 0) return; } else acquire_console_sem(); console_locked = 1; <API key> = 0; for (c = console_drivers; c != NULL; c = c->next) if ((c->flags & CON_ENABLED) && c->unblank) c->unblank(); release_console_sem(); } /* * Return the console tty driver structure and its associated index */ struct tty_driver *console_device(int *index) { struct console *c; struct tty_driver *driver = NULL; acquire_console_sem(); for (c = console_drivers; c != NULL; c = c->next) { if (!c->device) continue; driver = c->device(c, index); if (driver) break; } release_console_sem(); return driver; } /* * Prevent further output on the passed console device so that (for example) * serial drivers can disable console output before suspending a port, and can * re-enable output afterwards. */ void console_stop(struct console *console) { acquire_console_sem(); console->flags &= ~CON_ENABLED; release_console_sem(); } EXPORT_SYMBOL(console_stop); void console_start(struct console *console) { acquire_console_sem(); console->flags |= CON_ENABLED; release_console_sem(); } EXPORT_SYMBOL(console_start); /* * The console driver calls this routine during kernel initialization * to register the console printing procedure with printk() and to * print any messages that were printed by the kernel before the * console driver was initialized. */ void register_console(struct console *console) { int i; unsigned long flags; struct console *bootconsole = NULL; if (console_drivers) { if (console->flags & CON_BOOT) return; if (console_drivers->flags & CON_BOOT) bootconsole = console_drivers; } if (preferred_console < 0 || bootconsole || !console_drivers) preferred_console = selected_console; if (console->early_setup) console->early_setup(); /* * See if we want to use this console driver. If we * didn't select a console we take the first one * that registers here. */ if (preferred_console < 0) { if (console->index < 0) console->index = 0; if (console->setup == NULL || console->setup(console, NULL) == 0) { console->flags |= CON_ENABLED; if (console->device) { console->flags |= CON_CONSDEV; preferred_console = 0; } } } /* * See if this console matches one we selected on * the command line. */ for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) { if (strcmp(console_cmdline[i].name, console->name) != 0) continue; if (console->index >= 0 && console->index != console_cmdline[i].index) continue; if (console->index < 0) console->index = console_cmdline[i].index; #ifdef <API key> if (console_cmdline[i].brl_options) { console->flags |= CON_BRL; <API key>(console, console_cmdline[i].index, console_cmdline[i].options, console_cmdline[i].brl_options); return; } #endif if (console->setup && console->setup(console, console_cmdline[i].options) != 0) break; console->flags |= CON_ENABLED; console->index = console_cmdline[i].index; if (i == selected_console) { console->flags |= CON_CONSDEV; preferred_console = selected_console; } break; } if (!(console->flags & CON_ENABLED)) return; if (bootconsole && (console->flags & CON_CONSDEV)) { printk(KERN_INFO "console handover: boot [%s%d] -> real [%s%d]\n", bootconsole->name, bootconsole->index, console->name, console->index); unregister_console(bootconsole); console->flags &= ~CON_PRINTBUFFER; } else { printk(KERN_INFO "console [%s%d] enabled\n", console->name, console->index); } /* * Put this console in the list - keep the * preferred driver at the head of the list. */ acquire_console_sem(); if ((console->flags & CON_CONSDEV) || console_drivers == NULL) { console->next = console_drivers; console_drivers = console; if (console->next) console->next->flags &= ~CON_CONSDEV; } else { console->next = console_drivers->next; console_drivers->next = console; } if (console->flags & CON_PRINTBUFFER) { /* * release_console_sem() will print out the buffered messages * for us. */ spin_lock_irqsave(&logbuf_lock, flags); con_start = log_start; <API key>(&logbuf_lock, flags); } release_console_sem(); } EXPORT_SYMBOL(register_console); int unregister_console(struct console *console) { struct console *a, *b; int res = 1; #ifdef <API key> if (console->flags & CON_BRL) return <API key>(console); #endif acquire_console_sem(); if (console_drivers == console) { console_drivers=console->next; res = 0; } else if (console_drivers) { for (a=console_drivers->next, b=console_drivers ; a; b=a, a=b->next) { if (a == console) { b->next = a->next; res = 0; break; } } } /* * If this isn't the last console and it has CON_CONSDEV set, we * need to set it on the next preferred console. */ if (console_drivers != NULL && console->flags & CON_CONSDEV) console_drivers->flags |= CON_CONSDEV; release_console_sem(); return res; } EXPORT_SYMBOL(unregister_console); static int __init <API key>(void) { if (console_drivers != NULL) { if (console_drivers->flags & CON_BOOT) { printk(KERN_INFO "turn off boot console %s%d\n", console_drivers->name, console_drivers->index); return unregister_console(console_drivers); } } return 0; } late_initcall(<API key>); #if defined CONFIG_PRINTK /* * printk rate limiting, lifted from the networking subsystem. * * This enforces a rate limit: not more than 10 kernel messages * every 5s to make a denial-of-service attack impossible. */ <API key>(<API key>, 5 * HZ, 10); int printk_ratelimit(void) { return __ratelimit(&<API key>); } EXPORT_SYMBOL(printk_ratelimit); /** * <API key> - caller-controlled printk ratelimiting * @caller_jiffies: pointer to caller's state * @interval_msecs: minimum interval between prints * * <API key>() returns true if more than @interval_msecs * milliseconds have elapsed since the last time <API key>() * returned true. */ bool <API key>(unsigned long *caller_jiffies, unsigned int interval_msecs) { if (*caller_jiffies == 0 || time_after(jiffies, *caller_jiffies)) { *caller_jiffies = jiffies + msecs_to_jiffies(interval_msecs); return true; } return false; } EXPORT_SYMBOL(<API key>); #endif
module.exports={A:{A:{"1":"K C G E A B","16":"CB"},B:{"1":"D v Z I M H"},C:{"1":"0 1 2 3 5 6 7 y F J K C G E A B D v Z I M H N O P Q R S T U V W X Y x a b c d e f L h i j k l m n o p q r s t u z w TB SB","16":"VB"},D:{"1":"0 1 2 3 5 6 7 I M H N O P Q R S T U V W X Y x a b c d e f L h i j k l m n o p q r s t u z w HB g DB XB EB FB","16":"F J K C G E A B D v Z"},E:{"1":"J K C G E A B IB JB KB LB MB NB","16":"F GB AB"},F:{"1":"8 9 B D I M H N O P Q R S T U V W X Y x a b c d e f L h i j k l m n o p q r s t u UB BB","16":"E OB PB QB RB"},G:{"1":"4 G WB YB ZB aB bB cB dB eB fB gB","16":"AB"},H:{"1":"hB"},I:{"1":"4 y F g kB lB mB nB","16":"iB jB"},J:{"1":"C A"},K:{"1":"D L BB","16":"8 9 A B"},L:{"1":"g"},M:{"1":"w"},N:{"1":"A B"},O:{"1":"oB"},P:{"1":"F J pB"},Q:{"1":"qB"},R:{"1":"rB"}},B:5,C:"document.elementFromPoint()"};
#ifndef __SEARCH_TL_H__ #define __SEARCH_TL_H__ #include "TL/constants.h" #define FLAG_SORT (1 << 1) #define FLAG_SORT_DESC (1 << 2) #define FLAG_RESTR (1 << 3) #define FLAG_EXACT_HASH (1 << 4) #define FLAG_GROUP_HASH (1 << 5) #define FLAG_HASH_CHANGE (1 << 6) #define FLAG_RELEVANCE (1 << 7) #define FLAG_TITLE (1 << 8) #define FLAG_OPTTAG (1 << 9) #define <API key> (1 << 10) #define <API key> (1 << 11) #define FLAG_DECAY (1 << 12) #define FLAG_EXTENDED_MODE (1 << 13) #define <API key> (1 << 14) #define FLAG_RAND (1 << 15) #define FLAG_WEAK_SEARCH (1 << 16) #define FLAG_SEARCHX (1 << 17) #define FLAG_RETRY_SEARCH (1 << 30) #endif
/* ScriptData SDName: Boss_Ouro SD%Complete: 85 SDComment: No model for submerging. Currently just invisible. SDCategory: Temple of Ahn'Qiraj EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "temple_of_ahnqiraj.h" enum Spells { SPELL_SWEEP = 26103, SPELL_SANDBLAST = 26102, <API key> = 26100, SPELL_BIRTH = 26262, // The Birth Animation <API key> = 26092 }; class boss_ouro : public CreatureScript { public: boss_ouro() : CreatureScript("boss_ouro") { } CreatureAI* GetAI(Creature* creature) const { return new boss_ouroAI (creature); } struct boss_ouroAI : public ScriptedAI { boss_ouroAI(Creature* creature) : ScriptedAI(creature) {} uint32 Sweep_Timer; uint32 SandBlast_Timer; uint32 Submerge_Timer; uint32 Back_Timer; uint32 ChangeTarget_Timer; uint32 Spawn_Timer; bool Enrage; bool Submerged; void Reset() { Sweep_Timer = urand(5000, 10000); SandBlast_Timer = urand(20000, 35000); Submerge_Timer = urand(90000, 150000); Back_Timer = urand(30000, 45000); ChangeTarget_Timer = urand(5000, 8000); Spawn_Timer = urand(10000, 20000); Enrage = false; Submerged = false; } void EnterCombat(Unit* /*who*/) { DoCast(me->GetVictim(), SPELL_BIRTH); } void UpdateAI(uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; //Sweep_Timer if (!Submerged && Sweep_Timer <= diff) { DoCast(me->GetVictim(), SPELL_SWEEP); Sweep_Timer = urand(15000, 30000); } else Sweep_Timer -= diff; //SandBlast_Timer if (!Submerged && SandBlast_Timer <= diff) { DoCast(me->GetVictim(), SPELL_SANDBLAST); SandBlast_Timer = urand(20000, 35000); } else SandBlast_Timer -= diff; //Submerge_Timer if (!Submerged && Submerge_Timer <= diff) { //Cast me->HandleEmoteCommand(<API key>); me->SetFlag(UNIT_FIELD_FLAGS, <API key>); me->setFaction(35); DoCast(me, <API key>); Submerged = true; Back_Timer = urand(30000, 45000); } else Submerge_Timer -= diff; //ChangeTarget_Timer if (Submerged && ChangeTarget_Timer <= diff) { Unit* target = NULL; target = SelectTarget(<API key>, 0); if (target) DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); ChangeTarget_Timer = urand(10000, 20000); } else ChangeTarget_Timer -= diff; //Back_Timer if (Submerged && Back_Timer <= diff) { me->RemoveFlag(UNIT_FIELD_FLAGS, <API key>); me->setFaction(14); DoCast(me->GetVictim(), <API key>); Submerged = false; Submerge_Timer = urand(60000, 120000); } else Back_Timer -= diff; <API key>(); } }; }; void AddSC_boss_ouro() { new boss_ouro(); }
<?php namespace Magento\TestFramework\Isolation; use Magento\TestFramework\Helper\Bootstrap; use Magento\Framework\App\DeploymentConfig\Reader; /** * A listener that watches for integrity of deployment configuration */ class DeploymentConfig { /** * Deployment configuration reader * * @var Reader */ private $reader; /** * Initial value of deployment configuration * * @var mixed */ private $config; /** * Memorizes the initial value of configuration reader and the configuration value * * Assumption: this is done once right before executing very first test suite. * It is assumed that deployment configuration is valid at this point * * @return void */ public function startTestSuite() { if (null === $this->reader) { $this->reader = Bootstrap::getObjectManager()->get('Magento\Framework\App\DeploymentConfig\Reader'); $this->config = $this->reader->load(); } } /** * Checks if deployment configuration has been changed by a test * * Changing deployment configuration violates isolation between tests, so further tests may become broken. * To fix this issue, find out why this test changes deployment configuration. * If this is intentional, then it must be reverted to the previous state within the test. * After that, the application needs to be wiped out and reinstalled. * * @param \<API key> $test * @return void */ public function endTest(\<API key> $test) { $config = $this->reader->load(); if ($this->config != $config) { $error = "\n\nERROR: deployment configuration is corrupted. The application state is no longer valid.\n" . 'Further tests may fail.' . " This test failure may be misleading, if you are re-running it on a corrupted application.\n" . $test->toString() . "\n"; $test->fail($error); } } }
<?php namespace Magento\Downloadable\Test\Handler\DownloadableProduct; use Magento\Catalog\Test\Handler\<API key>\Curl as ProductCurl; use Magento\Downloadable\Test\Fixture\DownloadableProduct; use Magento\Mtf\Fixture\FixtureInterface; use Magento\Mtf\Config\DataInterface; use Magento\Mtf\System\Event\<API key>; use Magento\Mtf\Util\Protocol\CurlTransport; use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** * Class Curl * Create new downloadable product via curl */ class Curl extends ProductCurl implements <API key> { /** * Constructor * * @param DataInterface $configuration * @param <API key> $eventManager */ public function __construct(DataInterface $configuration, <API key> $eventManager) { parent::__construct($configuration, $eventManager); $this->mappingData += [ '<API key>' => [ 'Yes' => 1, 'No' => 0, ], 'is_shareable' => [ 'Yes' => 1, 'No' => 0, 'Use config' => 2, ], ]; } /** * Prepare POST data for creating product request * * @param FixtureInterface $fixture * @param string|null $prefix [optional] * @return array */ protected function prepareData(FixtureInterface $fixture, $prefix = null) { /** @var DownloadableProduct $fixture */ $fixtureData = parent::prepareData($fixture, $prefix); $downloadableData = [ 'downloadable_sample' => $fixture-><API key>(), 'downloadable_links' => $fixture-><API key>() ]; $data = []; if (!empty($downloadableData['downloadable_sample'])) { foreach ($downloadableData['downloadable_sample']['downloadable']['sample'] as $key => $sample) { $data['downloadable']['sample'][$key]['title'] = $sample['title']; // only url type $data['downloadable']['sample'][$key]['type'] = 'url'; $data['downloadable']['sample'][$key]['sample_url'] = $sample['sample_url']; $data['downloadable']['sample'][$key]['sort_order'] = $sample['sort_order']; } $sampleTitle = $downloadableData['downloadable_sample']['title']; $data['samples_title'] = $prefix ? [$prefix => $sampleTitle] : $sampleTitle; unset($data['downloadable_sample']); } if (!empty($downloadableData['downloadable_links'])) { foreach ($downloadableData['downloadable_links']['downloadable']['link'] as $key => $link) { $data['downloadable']['link'][$key]['title'] = $link['title']; // only url type $data['downloadable']['link'][$key]['type'] = 'url'; $data['downloadable']['link'][$key]['link_url'] = $link['file_link_url']; $data['downloadable']['link'][$key]['price'] = $link['price']; $data['downloadable']['link'][$key]['number_of_downloads'] = $link['number_of_downloads']; $data['downloadable']['link'][$key]['is_shareable'] = $link['is_shareable']; $data['downloadable']['link'][$key]['sample']['type'] = 'url'; $data['downloadable']['link'][$key]['sample']['url'] = $link['sample']['sample_url']; } $links = [ 'links_title' => $downloadableData['downloadable_links']['title'], '<API key>' => $downloadableData['downloadable_links']['<API key>'] ]; $data = array_merge($data, $prefix ? [$prefix => $links] : $links); unset($downloadableData['downloadable_links']); } $data = <API key>($fixtureData, $data); return $this->replaceMappingData($data); } /** * Create product via curl * * @param array $data * @param array $config * @return array * @throws \Exception */ protected function createProduct(array $data, array $config) { $url = $this->getUrl($config); $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); $curl->addOption(CURLOPT_HEADER, 1); $curl->write($url, $data); $response = $curl->read(); $curl->close(); if (!strpos($response, 'data-ui-id="<API key>"')) { throw new \Exception("Product creation by curl handler was not successful! Response: $response"); } preg_match("~Location: [^\s]*\/id\/(\d+)~", $response, $matches); $checkoutData = isset($data['product']['checkout_data']) ? $data['product']['checkout_data'] : null; if (isset($data['downloadable']['link'])) { foreach ($data['downloadable']['link'] as $key => $link) { preg_match('`"link_id":"(\d*?)","title":"' . $link['title'] . '"`', $response, $linkId); if (isset($checkoutData['options']['links'][$key]['label'])) { $checkoutData['options']['links'][$key]['id'] = $linkId[1]; } } } return ['id' => $matches[1], 'checkout_data' => $checkoutData]; } }
#include <linux/sched.h> #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/completion.h> #include <linux/buffer_head.h> #include <linux/pagemap.h> #include <linux/pagevec.h> #include <linux/mpage.h> #include <linux/fs.h> #include <linux/writeback.h> #include <linux/swap.h> #include <linux/gfs2_ondisk.h> #include <linux/backing-dev.h> #include "gfs2.h" #include "incore.h" #include "bmap.h" #include "glock.h" #include "inode.h" #include "log.h" #include "meta_io.h" #include "quota.h" #include "trans.h" #include "rgrp.h" #include "super.h" #include "util.h" #include "glops.h" void <API key>(struct gfs2_inode *ip, struct page *page, unsigned int from, unsigned int to) { struct buffer_head *head = page_buffers(page); unsigned int bsize = head->b_size; struct buffer_head *bh; unsigned int start, end; for (bh = head, start = 0; bh != head || !start; bh = bh->b_this_page, start = end) { end = start + bsize; if (end <= from || start >= to) continue; if (gfs2_is_jdata(ip)) set_buffer_uptodate(bh); gfs2_trans_add_bh(ip->i_gl, bh, 0); } } /** * <API key> - Fills in a buffer head with details about a block * @inode: The inode * @lblock: The block number to look up * @bh_result: The buffer head to return the result in * @create: Non-zero if we may add block to the file * * Returns: errno */ static int <API key>(struct inode *inode, sector_t lblock, struct buffer_head *bh_result, int create) { int error; error = gfs2_block_map(inode, lblock, bh_result, 0); if (error) return error; if (!buffer_mapped(bh_result)) return -EIO; return 0; } static int <API key>(struct inode *inode, sector_t lblock, struct buffer_head *bh_result, int create) { return gfs2_block_map(inode, lblock, bh_result, 0); } /** * <API key> - Common bits of writepage * @page: The page to be written * @wbc: The writeback control * * Returns: 1 if writepage is ok, otherwise an error code or zero if no error. */ static int <API key>(struct page *page, struct writeback_control *wbc) { struct inode *inode = page->mapping->host; struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_sbd *sdp = GFS2_SB(inode); loff_t i_size = i_size_read(inode); pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT; unsigned offset; if (<API key>(sdp, <API key>(ip->i_gl))) goto out; if (current->journal_info) goto redirty; /* Is the page fully outside i_size? (truncate in progress) */ offset = i_size & (PAGE_CACHE_SIZE-1); if (page->index > end_index || (page->index == end_index && !offset)) { page->mapping->a_ops->invalidatepage(page, 0); goto out; } return 1; redirty: <API key>(wbc, page); out: unlock_page(page); return 0; } /** * <API key> - Write page for writeback mappings * @page: The page * @wbc: The writeback control * */ static int <API key>(struct page *page, struct writeback_control *wbc) { int ret; ret = <API key>(page, wbc); if (ret <= 0) return ret; return nobh_writepage(page, <API key>, wbc); } /** * <API key> - Write page for ordered data files * @page: The page to write * @wbc: The writeback control * */ static int <API key>(struct page *page, struct writeback_control *wbc) { struct inode *inode = page->mapping->host; struct gfs2_inode *ip = GFS2_I(inode); int ret; ret = <API key>(page, wbc); if (ret <= 0) return ret; if (!page_has_buffers(page)) { <API key>(page, inode->i_sb->s_blocksize, (1 << BH_Dirty)|(1 << BH_Uptodate)); } <API key>(ip, page, 0, inode->i_sb->s_blocksize-1); return <API key>(page, <API key>, wbc); } /** * <API key> - The core of jdata writepage * @page: The page to write * @wbc: The writeback control * * This is shared between writepage and writepages and implements the * core of the writepage operation. If a transaction is required then * PageChecked will have been set and the transaction will have * already been started before this is called. */ static int <API key>(struct page *page, struct writeback_control *wbc) { struct inode *inode = page->mapping->host; struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_sbd *sdp = GFS2_SB(inode); if (PageChecked(page)) { ClearPageChecked(page); if (!page_has_buffers(page)) { <API key>(page, inode->i_sb->s_blocksize, (1 << BH_Dirty)|(1 << BH_Uptodate)); } <API key>(ip, page, 0, sdp->sd_vfs->s_blocksize-1); } return <API key>(page, <API key>, wbc); } /** * <API key> - Write complete page * @page: Page to write * * Returns: errno * */ static int <API key>(struct page *page, struct writeback_control *wbc) { struct inode *inode = page->mapping->host; struct gfs2_sbd *sdp = GFS2_SB(inode); int ret; int done_trans = 0; if (PageChecked(page)) { if (wbc->sync_mode != WB_SYNC_ALL) goto out_ignore; ret = gfs2_trans_begin(sdp, RES_DINODE + 1, 0); if (ret) goto out_ignore; done_trans = 1; } ret = <API key>(page, wbc); if (ret > 0) ret = <API key>(page, wbc); if (done_trans) gfs2_trans_end(sdp); return ret; out_ignore: <API key>(wbc, page); unlock_page(page); return 0; } /** * <API key> - Write a bunch of dirty pages back to disk * @mapping: The mapping to write * @wbc: Write-back control * * For the data=writeback case we can already ignore buffer heads * and write whole extents at once. This is a big reduction in the * number of I/O requests we send and the bmap calls we make in this case. */ static int <API key>(struct address_space *mapping, struct writeback_control *wbc) { return mpage_writepages(mapping, wbc, <API key>); } /** * <API key> - Write back a pagevec's worth of pages * @mapping: The mapping * @wbc: The writeback control * @writepage: The writepage function to call for each page * @pvec: The vector of pages * @nr_pages: The number of pages to write * * Returns: non-zero if loop should terminate, zero otherwise */ static int <API key>(struct address_space *mapping, struct writeback_control *wbc, struct pagevec *pvec, int nr_pages, pgoff_t end) { struct inode *inode = mapping->host; struct gfs2_sbd *sdp = GFS2_SB(inode); loff_t i_size = i_size_read(inode); pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT; unsigned offset = i_size & (PAGE_CACHE_SIZE-1); unsigned nrblocks = nr_pages * (PAGE_CACHE_SIZE/inode->i_sb->s_blocksize); int i; int ret; ret = gfs2_trans_begin(sdp, nrblocks, nrblocks); if (ret < 0) return ret; for(i = 0; i < nr_pages; i++) { struct page *page = pvec->pages[i]; lock_page(page); if (unlikely(page->mapping != mapping)) { unlock_page(page); continue; } if (!wbc->range_cyclic && page->index > end) { ret = 1; unlock_page(page); continue; } if (wbc->sync_mode != WB_SYNC_NONE) <API key>(page); if (PageWriteback(page) || !<API key>(page)) { unlock_page(page); continue; } /* Is the page fully outside i_size? (truncate in progress) */ if (page->index > end_index || (page->index == end_index && !offset)) { page->mapping->a_ops->invalidatepage(page, 0); unlock_page(page); continue; } ret = <API key>(page, wbc); if (ret || (--(wbc->nr_to_write) <= 0)) ret = 1; } gfs2_trans_end(sdp); return ret; } /** * <API key> - Like write_cache_pages but different * @mapping: The mapping to write * @wbc: The writeback control * @writepage: The writepage function to call * @data: The data to pass to writepage * * The reason that we use our own function here is that we need to * start transactions before we grab page locks. This allows us * to get the ordering right. */ static int <API key>(struct address_space *mapping, struct writeback_control *wbc) { int ret = 0; int done = 0; struct pagevec pvec; int nr_pages; pgoff_t index; pgoff_t end; int scanned = 0; int range_whole = 0; pagevec_init(&pvec, 0); if (wbc->range_cyclic) { index = mapping->writeback_index; /* Start from prev offset */ end = -1; } else { index = wbc->range_start >> PAGE_CACHE_SHIFT; end = wbc->range_end >> PAGE_CACHE_SHIFT; if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) range_whole = 1; scanned = 1; } retry: while (!done && (index <= end) && (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, PAGECACHE_TAG_DIRTY, min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) { scanned = 1; ret = <API key>(mapping, wbc, &pvec, nr_pages, end); if (ret) done = 1; if (ret > 0) ret = 0; pagevec_release(&pvec); cond_resched(); } if (!scanned && !done) { /* * We hit the last page and there is more work to be done: wrap * back to the start of the file */ scanned = 1; index = 0; goto retry; } if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) mapping->writeback_index = index; return ret; } /** * <API key> - Write a bunch of dirty pages back to disk * @mapping: The mapping to write * @wbc: The writeback control * */ static int <API key>(struct address_space *mapping, struct writeback_control *wbc) { struct gfs2_inode *ip = GFS2_I(mapping->host); struct gfs2_sbd *sdp = GFS2_SB(mapping->host); int ret; ret = <API key>(mapping, wbc); if (ret == 0 && wbc->sync_mode == WB_SYNC_ALL) { gfs2_log_flush(sdp, ip->i_gl); ret = <API key>(mapping, wbc); } return ret; } /** * stuffed_readpage - Fill in a Linux page with stuffed file data * @ip: the inode * @page: the page * * Returns: errno */ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) { struct buffer_head *dibh; u64 dsize = i_size_read(&ip->i_inode); void *kaddr; int error; /* * Due to the order of unstuffing files and ->fault(), we can be * asked for a zero page in the case of a stuffed file being extended, * so we need to supply one here. It doesn't happen often. */ if (unlikely(page->index)) { zero_user(page, 0, PAGE_CACHE_SIZE); SetPageUptodate(page); return 0; } error = <API key>(ip, &dibh); if (error) return error; kaddr = kmap_atomic(page, KM_USER0); if (dsize > (dibh->b_size - sizeof(struct gfs2_dinode))) dsize = (dibh->b_size - sizeof(struct gfs2_dinode)); memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); memset(kaddr + dsize, 0, PAGE_CACHE_SIZE - dsize); kunmap_atomic(kaddr, KM_USER0); flush_dcache_page(page); brelse(dibh); SetPageUptodate(page); return 0; } /** * __gfs2_readpage - readpage * @file: The file to read a page for * @page: The page to read * * This is the core of gfs2's readpage. Its used by the internal file * reading code as in that case we already hold the glock. Also its * called by gfs2_readpage() once the required lock has been granted. * */ static int __gfs2_readpage(void *file, struct page *page) { struct gfs2_inode *ip = GFS2_I(page->mapping->host); struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host); int error; if (gfs2_is_stuffed(ip)) { error = stuffed_readpage(ip, page); unlock_page(page); } else { error = mpage_readpage(page, gfs2_block_map); } if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) return -EIO; return error; } /** * gfs2_readpage - read a page of a file * @file: The file to read * @page: The page of the file * * This deals with the locking required. We have to unlock and * relock the page in order to get the locking in the right * order. */ static int gfs2_readpage(struct file *file, struct page *page) { struct address_space *mapping = page->mapping; struct gfs2_inode *ip = GFS2_I(mapping->host); struct gfs2_holder gh; int error; unlock_page(page); gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &gh); error = gfs2_glock_nq(&gh); if (unlikely(error)) goto out; error = AOP_TRUNCATED_PAGE; lock_page(page); if (page->mapping == mapping && !PageUptodate(page)) error = __gfs2_readpage(file, page); else unlock_page(page); gfs2_glock_dq(&gh); out: gfs2_holder_uninit(&gh); if (error && error != AOP_TRUNCATED_PAGE) lock_page(page); return error; } /** * gfs2_internal_read - read an internal file * @ip: The gfs2 inode * @ra_state: The readahead state (or NULL for no readahead) * @buf: The buffer to fill * @pos: The file position * @size: The amount to read * */ int gfs2_internal_read(struct gfs2_inode *ip, struct file_ra_state *ra_state, char *buf, loff_t *pos, unsigned size) { struct address_space *mapping = ip->i_inode.i_mapping; unsigned long index = *pos / PAGE_CACHE_SIZE; unsigned offset = *pos & (PAGE_CACHE_SIZE - 1); unsigned copied = 0; unsigned amt; struct page *page; void *p; do { amt = size - copied; if (offset + size > PAGE_CACHE_SIZE) amt = PAGE_CACHE_SIZE - offset; page = read_cache_page(mapping, index, __gfs2_readpage, NULL); if (IS_ERR(page)) return PTR_ERR(page); p = kmap_atomic(page, KM_USER0); memcpy(buf + copied, p + offset, amt); kunmap_atomic(p, KM_USER0); mark_page_accessed(page); page_cache_release(page); copied += amt; index++; offset = 0; } while(copied < size); (*pos) += size; return size; } /** * gfs2_readpages - Read a bunch of pages at once * * Some notes: * 1. This is only for readahead, so we can simply ignore any things * which are slightly inconvenient (such as locking conflicts between * the page lock and the glock) and return having done no I/O. Its * obviously not something we'd want to do on too regular a basis. * Any I/O we ignore at this time will be done via readpage later. * 2. We don't handle stuffed files here we let readpage do the honours. * 3. mpage_readpages() does most of the heavy lifting in the common case. * 4. gfs2_block_map() is relied upon to set BH_Boundary in the right places. */ static int gfs2_readpages(struct file *file, struct address_space *mapping, struct list_head *pages, unsigned nr_pages) { struct inode *inode = mapping->host; struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_holder gh; int ret; gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &gh); ret = gfs2_glock_nq(&gh); if (unlikely(ret)) goto out_uninit; if (!gfs2_is_stuffed(ip)) ret = mpage_readpages(mapping, pages, nr_pages, gfs2_block_map); gfs2_glock_dq(&gh); out_uninit: gfs2_holder_uninit(&gh); if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) ret = -EIO; return ret; } /** * gfs2_write_begin - Begin to write to a file * @file: The file to write to * @mapping: The mapping in which to write * @pos: The file offset at which to start writing * @len: Length of the write * @flags: Various flags * @pagep: Pointer to return the page * @fsdata: Pointer to return fs data (unused by GFS2) * * Returns: errno */ static int gfs2_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata) { struct gfs2_inode *ip = GFS2_I(mapping->host); struct gfs2_sbd *sdp = GFS2_SB(mapping->host); struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); unsigned int data_blocks = 0, ind_blocks = 0, rblocks; int alloc_required; int error = 0; struct gfs2_alloc *al = NULL; pgoff_t index = pos >> PAGE_CACHE_SHIFT; unsigned from = pos & (PAGE_CACHE_SIZE - 1); struct page *page; gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ip->i_gh); error = gfs2_glock_nq(&ip->i_gh); if (unlikely(error)) goto out_uninit; if (&ip->i_inode == sdp->sd_rindex) { error = gfs2_glock_nq_init(m_ip->i_gl, LM_ST_EXCLUSIVE, GL_NOCACHE, &m_ip->i_gh); if (unlikely(error)) { gfs2_glock_dq(&ip->i_gh); goto out_uninit; } } alloc_required = <API key>(ip, pos, len); if (alloc_required || gfs2_is_jdata(ip)) <API key>(ip, len, &data_blocks, &ind_blocks); if (alloc_required) { al = gfs2_alloc_get(ip); if (!al) { error = -ENOMEM; goto out_unlock; } error = <API key>(ip); if (error) goto out_alloc_put; al->al_requested = data_blocks + ind_blocks; error = <API key>(ip); if (error) goto out_qunlock; } rblocks = RES_DINODE + ind_blocks; if (gfs2_is_jdata(ip)) rblocks += data_blocks ? data_blocks : 1; if (ind_blocks || data_blocks) rblocks += RES_STATFS + RES_QUOTA; if (&ip->i_inode == sdp->sd_rindex) rblocks += 2 * RES_STATFS; if (alloc_required) rblocks += gfs2_rg_blocks(al); error = gfs2_trans_begin(sdp, rblocks, PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize); if (error) goto out_trans_fail; error = -ENOMEM; flags |= AOP_FLAG_NOFS; page = <API key>(mapping, index, flags); *pagep = page; if (unlikely(!page)) goto out_endtrans; if (gfs2_is_stuffed(ip)) { error = 0; if (pos + len > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) { error = gfs2_unstuff_dinode(ip, page); if (error == 0) goto prepare_write; } else if (!PageUptodate(page)) { error = stuffed_readpage(ip, page); } goto out; } prepare_write: error = __block_write_begin(page, from, len, gfs2_block_map); out: if (error == 0) return 0; unlock_page(page); page_cache_release(page); gfs2_trans_end(sdp); if (pos + len > ip->i_inode.i_size) gfs2_trim_blocks(&ip->i_inode); goto out_trans_fail; out_endtrans: gfs2_trans_end(sdp); out_trans_fail: if (alloc_required) { <API key>(ip); out_qunlock: gfs2_quota_unlock(ip); out_alloc_put: gfs2_alloc_put(ip); } out_unlock: if (&ip->i_inode == sdp->sd_rindex) { gfs2_glock_dq(&m_ip->i_gh); gfs2_holder_uninit(&m_ip->i_gh); } gfs2_glock_dq(&ip->i_gh); out_uninit: gfs2_holder_uninit(&ip->i_gh); return error; } /** * adjust_fs_space - Adjusts the free space available due to gfs2_grow * @inode: the rindex inode */ static void adjust_fs_space(struct inode *inode) { struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode); struct <API key> *m_sc = &sdp->sd_statfs_master; struct <API key> *l_sc = &sdp->sd_statfs_local; struct buffer_head *m_bh, *l_bh; u64 fs_total, new_free; /* Total up the file system space, according to the latest rindex. */ fs_total = gfs2_ri_total(sdp); if (<API key>(m_ip, &m_bh) != 0) return; spin_lock(&sdp->sd_statfs_spin); <API key>(m_sc, m_bh->b_data + sizeof(struct gfs2_dinode)); if (fs_total > (m_sc->sc_total + l_sc->sc_total)) new_free = fs_total - (m_sc->sc_total + l_sc->sc_total); else new_free = 0; spin_unlock(&sdp->sd_statfs_spin); fs_warn(sdp, "File system extended by %llu blocks.\n", (unsigned long long)new_free); gfs2_statfs_change(sdp, new_free, new_free, 0); if (<API key>(l_ip, &l_bh) != 0) goto out; update_statfs(sdp, m_bh, l_bh); brelse(l_bh); out: brelse(m_bh); } /** * <API key> - Write end for stuffed files * @inode: The inode * @dibh: The buffer_head containing the on-disk inode * @pos: The file position * @len: The length of the write * @copied: How much was actually copied by the VFS * @page: The page * * This copies the data from the page into the inode block after * the inode data structure itself. * * Returns: errno */ static int <API key>(struct inode *inode, struct buffer_head *dibh, loff_t pos, unsigned len, unsigned copied, struct page *page) { struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); u64 to = pos + copied; void *kaddr; unsigned char *buf = dibh->b_data + sizeof(struct gfs2_dinode); struct gfs2_dinode *di = (struct gfs2_dinode *)dibh->b_data; BUG_ON((pos + len) > (dibh->b_size - sizeof(struct gfs2_dinode))); kaddr = kmap_atomic(page, KM_USER0); memcpy(buf + pos, kaddr + pos, copied); memset(kaddr + pos + copied, 0, len - copied); flush_dcache_page(page); kunmap_atomic(kaddr, KM_USER0); if (!PageUptodate(page)) SetPageUptodate(page); unlock_page(page); page_cache_release(page); if (copied) { if (inode->i_size < to) i_size_write(inode, to); gfs2_dinode_out(ip, di); mark_inode_dirty(inode); } if (inode == sdp->sd_rindex) { adjust_fs_space(inode); ip->i_gh.gh_flags |= GL_NOCACHE; } brelse(dibh); gfs2_trans_end(sdp); if (inode == sdp->sd_rindex) { gfs2_glock_dq(&m_ip->i_gh); gfs2_holder_uninit(&m_ip->i_gh); } gfs2_glock_dq(&ip->i_gh); gfs2_holder_uninit(&ip->i_gh); return copied; } /** * gfs2_write_end * @file: The file to write to * @mapping: The address space to write to * @pos: The file position * @len: The length of the data * @copied: * @page: The page that has been written * @fsdata: The fsdata (unused in GFS2) * * The main write_end function for GFS2. We have a separate one for * stuffed files as they are slightly different, otherwise we just * put our locking around the VFS provided functions. * * Returns: errno */ static int gfs2_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata) { struct inode *inode = page->mapping->host; struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); struct buffer_head *dibh; struct gfs2_alloc *al = ip->i_alloc; unsigned int from = pos & (PAGE_CACHE_SIZE - 1); unsigned int to = from + len; int ret; BUG_ON(<API key>(ip->i_gl) == NULL); ret = <API key>(ip, &dibh); if (unlikely(ret)) { unlock_page(page); page_cache_release(page); goto failed; } gfs2_trans_add_bh(ip->i_gl, dibh, 1); if (gfs2_is_stuffed(ip)) return <API key>(inode, dibh, pos, len, copied, page); if (!gfs2_is_writeback(ip)) <API key>(ip, page, from, to); ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); if (ret > 0) { gfs2_dinode_out(ip, dibh->b_data); mark_inode_dirty(inode); } if (inode == sdp->sd_rindex) { adjust_fs_space(inode); ip->i_gh.gh_flags |= GL_NOCACHE; } brelse(dibh); failed: gfs2_trans_end(sdp); if (al) { <API key>(ip); gfs2_quota_unlock(ip); gfs2_alloc_put(ip); } if (inode == sdp->sd_rindex) { gfs2_glock_dq(&m_ip->i_gh); gfs2_holder_uninit(&m_ip->i_gh); } gfs2_glock_dq(&ip->i_gh); gfs2_holder_uninit(&ip->i_gh); return ret; } /** * gfs2_set_page_dirty - Page dirtying function * @page: The page to dirty * * Returns: 1 if it dirtyed the page, or 0 otherwise */ static int gfs2_set_page_dirty(struct page *page) { SetPageChecked(page); return <API key>(page); } /** * gfs2_bmap - Block map function * @mapping: Address space info * @lblock: The block to map * * Returns: The disk address for the block or 0 on hole or error */ static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock) { struct gfs2_inode *ip = GFS2_I(mapping->host); struct gfs2_holder i_gh; sector_t dblock = 0; int error; error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); if (error) return 0; if (!gfs2_is_stuffed(ip)) dblock = generic_block_bmap(mapping, lblock, gfs2_block_map); <API key>(&i_gh); return dblock; } static void gfs2_discard(struct gfs2_sbd *sdp, struct buffer_head *bh) { struct gfs2_bufdata *bd; lock_buffer(bh); gfs2_log_lock(sdp); clear_buffer_dirty(bh); bd = bh->b_private; if (bd) { if (!list_empty(&bd->bd_le.le_list) && !buffer_pinned(bh)) list_del_init(&bd->bd_le.le_list); else <API key>(bh, current->journal_info, 0); } bh->b_bdev = NULL; clear_buffer_mapped(bh); clear_buffer_req(bh); clear_buffer_new(bh); gfs2_log_unlock(sdp); unlock_buffer(bh); } static void gfs2_invalidatepage(struct page *page, unsigned long offset) { struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host); struct buffer_head *bh, *head; unsigned long pos = 0; BUG_ON(!PageLocked(page)); if (offset == 0) ClearPageChecked(page); if (!page_has_buffers(page)) goto out; bh = head = page_buffers(page); do { if (offset <= pos) gfs2_discard(sdp, bh); pos += bh->b_size; bh = bh->b_this_page; } while (bh != head); out: if (offset == 0) try_to_release_page(page, 0); } /** * gfs2_ok_for_dio - check that dio is valid on this file * @ip: The inode * @rw: READ or WRITE * @offset: The offset at which we are reading or writing * * Returns: 0 (to ignore the i/o request and thus fall back to buffered i/o) * 1 (to accept the i/o request) */ static int gfs2_ok_for_dio(struct gfs2_inode *ip, int rw, loff_t offset) { /* * Should we return an error here? I can't see that O_DIRECT for * a stuffed file makes any sense. For now we'll silently fall * back to buffered I/O */ if (gfs2_is_stuffed(ip)) return 0; if (offset >= i_size_read(&ip->i_inode)) return 0; return 1; } static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs) { struct file *file = iocb->ki_filp; struct inode *inode = file->f_mapping->host; struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_holder gh; int rv; /* * Deferred lock, even if its a write, since we do no allocation * on this path. All we need change is atime, and this lock mode * ensures that other nodes have flushed their buffered read caches * (i.e. their page cache entries for this inode). We do not, * unfortunately have the option of only flushing a range like * the VFS does. */ gfs2_holder_init(ip->i_gl, LM_ST_DEFERRED, 0, &gh); rv = gfs2_glock_nq(&gh); if (rv) return rv; rv = gfs2_ok_for_dio(ip, rw, offset); if (rv != 1) goto out; /* dio not valid, fall back to buffered i/o */ rv = <API key>(rw, iocb, inode, inode->i_sb->s_bdev, iov, offset, nr_segs, <API key>, NULL, NULL, 0); out: gfs2_glock_dq_m(1, &gh); gfs2_holder_uninit(&gh); return rv; } /** * gfs2_releasepage - free the metadata associated with a page * @page: the page that's being released * @gfp_mask: passed from Linux VFS, ignored by us * * Call try_to_free_buffers() if the buffers in this page can be * released. * * Returns: 0 */ int gfs2_releasepage(struct page *page, gfp_t gfp_mask) { struct address_space *mapping = page->mapping; struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping); struct buffer_head *bh, *head; struct gfs2_bufdata *bd; if (!page_has_buffers(page)) return 0; gfs2_log_lock(sdp); head = bh = page_buffers(page); do { if (atomic_read(&bh->b_count)) goto cannot_release; bd = bh->b_private; if (bd && bd->bd_ail) goto cannot_release; if (buffer_pinned(bh) || buffer_dirty(bh)) goto not_possible; bh = bh->b_this_page; } while(bh != head); gfs2_log_unlock(sdp); head = bh = page_buffers(page); do { gfs2_log_lock(sdp); bd = bh->b_private; if (bd) { gfs2_assert_warn(sdp, bd->bd_bh == bh); gfs2_assert_warn(sdp, list_empty(&bd->bd_list_tr)); if (!list_empty(&bd->bd_le.le_list)) { if (!buffer_pinned(bh)) list_del_init(&bd->bd_le.le_list); else bd = NULL; } if (bd) bd->bd_bh = NULL; bh->b_private = NULL; } gfs2_log_unlock(sdp); if (bd) kmem_cache_free(gfs2_bufdata_cachep, bd); bh = bh->b_this_page; } while (bh != head); return try_to_free_buffers(page); not_possible: /* Should never happen */ WARN_ON(buffer_dirty(bh)); WARN_ON(buffer_pinned(bh)); cannot_release: gfs2_log_unlock(sdp); return 0; } static const struct <API key> gfs2_writeback_aops = { .writepage = <API key>, .writepages = <API key>, .readpage = gfs2_readpage, .readpages = gfs2_readpages, .write_begin = gfs2_write_begin, .write_end = gfs2_write_end, .bmap = gfs2_bmap, .invalidatepage = gfs2_invalidatepage, .releasepage = gfs2_releasepage, .direct_IO = gfs2_direct_IO, .migratepage = buffer_migrate_page, .<API key> = <API key>, .error_remove_page = <API key>, }; static const struct <API key> gfs2_ordered_aops = { .writepage = <API key>, .readpage = gfs2_readpage, .readpages = gfs2_readpages, .write_begin = gfs2_write_begin, .write_end = gfs2_write_end, .set_page_dirty = gfs2_set_page_dirty, .bmap = gfs2_bmap, .invalidatepage = gfs2_invalidatepage, .releasepage = gfs2_releasepage, .direct_IO = gfs2_direct_IO, .migratepage = buffer_migrate_page, .<API key> = <API key>, .error_remove_page = <API key>, }; static const struct <API key> gfs2_jdata_aops = { .writepage = <API key>, .writepages = <API key>, .readpage = gfs2_readpage, .readpages = gfs2_readpages, .write_begin = gfs2_write_begin, .write_end = gfs2_write_end, .set_page_dirty = gfs2_set_page_dirty, .bmap = gfs2_bmap, .invalidatepage = gfs2_invalidatepage, .releasepage = gfs2_releasepage, .<API key> = <API key>, .error_remove_page = <API key>, }; void gfs2_set_aops(struct inode *inode) { struct gfs2_inode *ip = GFS2_I(inode); if (gfs2_is_writeback(ip)) inode->i_mapping->a_ops = &gfs2_writeback_aops; else if (gfs2_is_ordered(ip)) inode->i_mapping->a_ops = &gfs2_ordered_aops; else if (gfs2_is_jdata(ip)) inode->i_mapping->a_ops = &gfs2_jdata_aops; else BUG(); }
/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ #include <mrn_mysql.h> #include <mrn_windows.hpp> #include <mrn_table.hpp> #include <mrn_macro.hpp> #include <mrn_current_thread.hpp> MRN_BEGIN_DECLS MRN_API my_bool <API key>(UDF_INIT *init, UDF_ARGS *args, char *message) { if (args->arg_count != 0) { strcpy(message, "last_insert_grn_id must not have arguments"); return 1; } init->maybe_null = 0; return 0; } MRN_API longlong last_insert_grn_id(UDF_INIT *init, UDF_ARGS *args, char *is_null, char *error) { THD *thd = current_thd; st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, false); if (slot_data == NULL) { return 0; } longlong <API key> = slot_data-><API key>; return <API key>; } MRN_API void <API key>(UDF_INIT *init) { } MRN_END_DECLS
<?php /** @var $cacheTypeList \Magento\Framework\App\Cache\TypeListInterface */ $cacheTypeList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Framework\App\Cache\TypeListInterface' ); $cacheTypeList->invalidate(array_keys($cacheTypeList->getTypes()));
<?php // No direct access to this file defined('_JEXEC') or die('Restricted access'); $utils = JSNTplUtils::getInstance(); // Get all fieldset in XML $fieldSets = $adminFormXml->fields->fieldset; // Set appropriate wrapper class $wrapperClass = 'jsn-joomla' . JSNTplHelper::getJoomlaVersion(1, false); // Get template details $template = <API key>::detect($this->data->template); // Prepare template name for link generation $templateName = 'jsn-' . strtolower($template->name); // Generate template introduction link $templateLink = "http: // Process template edition $edition = $this->templateEdition->getEdition(); if ($edition == 'FREE') { $editionClass = 'jsn-free-edition'; } else { $editionClass = 'jsn-pro-edition'; } // Get next template edition $nextEdition = str_replace('PRO ', '', $this->templateEdition->getNextEdition()); // Get installed template version $version = JSNTplHelper::getTemplateVersion($this->data->template); // Get list of JoomlaShine template for cross promotion $promotion = $nextEdition == 'STANDARD' ? true : false; if ($promotion) { $config = JFactory::getConfig(); $cache = $config->get('tmp_path') . '/jsn_templates.json'; if ( ! @is_file($cache) || ! @is_readable($cache) || time() - filemtime($cache) > 86400) { try { $jsn_templates = JSNTplHttpRequest::get( 'http://demo.joomlashine.com/products-intro/assets/json/showlist-templates-' . ($nextEdition == 'STANDARD' ? 'free' : 'pro') . '.json', $cache ); $jsn_templates = $jsn_templates['body']; } catch (Exception $e) { // Disable cross promotion $promotion = false; } } else { $jsn_templates = JFile::read($cache); } if ($jsn_templates = json_decode($jsn_templates)) { $jsn_templates = $jsn_templates->showlist->images->image; } else { $promotion = false; } } $jversion = new JVersion(); $megamenu = (string) $this->templateXml->megamenu; // Migrate megamenu data if ($megamenu == 'yes') { if (version_compare($jversion->getShortVersion(), '3.0', ">=")) { include_once <API key> . '/helpers/megamenu.php'; <API key>::migrate(); } } $plgTplBrand = $utils->checkPlgJSNBrand(); $showUpgradeButton = 1; $showChangelog = 1; $showThumbnailLink = 1; $<API key> = 1; $<API key> = 0; $<API key> = 0; $<API key> = ''; $<API key> = ''; if ($plgTplBrand) { $dispatcher = JEventDispatcher::getInstance(); $rload = JPluginHelper::importPlugin('system', 'jsnbrand'); if ($rload === true) { $showUpgradeButton = $dispatcher->trigger('<API key>'); $showUpgradeButton = (int) $showUpgradeButton[0]; $showChangelog = $dispatcher->trigger('showTplChangelog'); $showChangelog = (int) $showChangelog[0]; $showThumbnailLink = $dispatcher->trigger('<API key>'); $showThumbnailLink = (int) $showThumbnailLink[0]; $<API key> = $dispatcher->trigger('<API key>'); $<API key> = (int) $<API key>[0]; $<API key> = $dispatcher->trigger('<API key>'); $<API key> = (int) $<API key>[0]; $<API key> = $dispatcher->trigger('getTplFooterContent'); $<API key> = (string) $<API key>[0]; $<API key> = $dispatcher->trigger('<API key>'); $<API key> = (int) $<API key>[0]; $<API key> = $dispatcher->trigger('<API key>'); $<API key> = (string) $<API key>[0]; } } if (!$showThumbnailLink) { $templateLink = ' } ?> <div class="jsn-master"><div id="jsn-template-config" class="jsn-bootstrap <?php echo $wrapperClass ?> <?php echo $editionClass ?>"> <form action="" method="POST" name="adminForm" id="style-form"> <input type="hidden" name="task" /> <input type="hidden" id="jsn-tpl-style-id" value="<?php echo JFactory::getApplication()->input->getInt('id', 0); ?>" /> <input type="hidden" id="jsn-tpl-edition" value="<?php echo strtolower(trim($edition)); ?>" /> <input type="hidden" id="jsn-tpl-name" value="<?php echo strtolower(trim($this->data->template)); ?>" /> <input type="hidden" id="jsn-tpl-token" value="<?php echo JSession::getFormToken(); ?>" /> <input type="hidden" name="customized" value="<?php echo @count($this->data->params) ? 'yes' : 'no'; ?>" /> <?php echo JHtml::_('form.token'); ?> <div id="<API key>"> <label for="jform_title pull-left"><?php echo JText::_('<API key>') ?></label> <?php echo $this->templateForm->getInput('title') ?> <label for="jform_template pull-left"><?php echo JText::_('<API key>') ?></label> <?php echo $this->templateForm->getInput('template') ?> <label for="jform_home pull-left"><?php echo JText::_('<API key>') ?></label> <?php echo $this->templateForm->getInput('home') ?> <?php echo $this->templateForm->getInput('client_id') ?> <div class="clearfix"></div> </div> <div id="<API key>" class="jsn-hide form-horizontal"> <ul id="jsn-main-nav"> <li> <a href="#getting-started"> <i class="icon-home icon-black"></i> <?php echo JText::_('<API key>') ?> </a> </li> <?php foreach ($fieldSets as $fieldSet): ?> <?php $valid = false; if (isset($fieldSet['joomlaVersion'])) { if (version_compare($jversion->getShortVersion(), (string) $fieldSet['joomlaVersion'], ">=")) { $valid = true; } } else { $valid = true; } ?> <?php if ($valid) : ?> <?php if ((string) $fieldSet['name'] == 'jsn-megamenu' && $megamenu != 'yes') { continue; } ?> <?php $class = isset($fieldSet['pro']) && $fieldSet['pro'] == 'true' ? 'jsn-pro-tab' : '' ?> <li class="<?php echo $class ?>"> <a href="#<?php echo $fieldSet['name'] ?>"> <?php if (isset($fieldSet['icon'])): ?> <i class="<?php echo $fieldSet['icon'] ?>"></i> <?php endif ?> <?php echo JText::_($fieldSet['label']) ?> <?php if (isset($fieldSet['pro']) && $fieldSet['pro'] == 'true'): ?> <span class="label label-important label-pro">PRO</span> <?php endif ?> </a> </li> <?php endif ?> <?php endforeach ?> <li><a href="#menu-assignment"><i class="icon-checkbox"></i> <?php echo JText::_('<API key>') ?></a></li> </ul> <div id="<API key>" class="btn-group pull-right"> <a class="btn dropdown-toggle" data-toggle="dropdown" href=" <?php echo JText::_('<API key>'); ?> <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a id="<API key>" href="<?php echo JRoute::_('index.php?widget=maintenance&action=backup&template=' . $this->data->template) . '&styleId=' . $this->data->id; ?>"><?php echo JText::_('<API key>'); ?></a></li> <li><a id="<API key>" href="<?php echo JRoute::_('index.php?widget=maintenance&action=restore&template=' . $this->data->template) . '&styleId=' . $this->data->id; ?>"><?php echo JText::_('<API key>'); ?></a></li> </ul> </div> <div class="row-fluid" id="getting-started"> <?php include <API key> . '/template/tmpl/default_home.php' ?> </div> <?php foreach ($fieldSets as $xmlFieldSet): ?> <?php $valid = false; if (isset($xmlFieldSet['joomlaVersion'])) { if (version_compare($jversion->getShortVersion(), (string) $xmlFieldSet['joomlaVersion'], ">=")) { $valid = true; } } else { $valid = true; } ?> <?php if ($valid) : ?> <?php if ((string) $xmlFieldSet['name'] == 'jsn-megamenu' && $megamenu != 'yes') { continue; } ?> <div id="<?php echo $xmlFieldSet['name'] ?>"> <?php if (isset($xmlFieldSet['pro']) && $xmlFieldSet['pro'] == 'true' && $this->templateEdition->getEdition() == 'FREE'): ?> <div class="jsn-section-pro alert alert-block"> <p class="pull-left"><?php echo JText::_('<API key>') ?></p> <?php if ($showUpgradeButton) {?> <a href="javascript:void(0)" class="jsn-upgrade-link btn pull-right"><?php echo JText::_('<API key>') ?></a> <?php } ?> <div class="clearfix"></div> </div> <?php endif ?> <?php if (isset($xmlFieldSet['twoColumns']) && $xmlFieldSet['twoColumns'] == 'true'): ?> <?php include <API key> . '/template/tmpl/default_layout.php' ?> <?php else: ?> <?php foreach ($xmlFieldSet->children() as $field): ?> <?php $nodeName = strtolower($field->getName()) ?> <?php if ($nodeName == 'field'): ?> <?php $input = $this->adminForm->getField($field['name'], 'jsn') ?> <?php if (trim($field['label']) != '') : ?> <div class="control-group"> <div class="control-label"> <label for="<?php echo $input->id ?>" rel="tipsy" title="<?php echo JText::_($field['label'] . '_DESC') ?>"> <?php echo JText::_($field['label']) ?> </label> </div> <div class="controls"> <?php echo str_replace('%TEMPLATE%', $this->data->template, $input->input) ?> </div> </div> <?php else : ?> <div> <?php echo str_replace('%TEMPLATE%', $this->data->template, $input->input) ?> </div> <?php endif; ?> <?php elseif ($nodeName == 'fieldset'): ?> <fieldset class="<?php echo $field['name'] ?>"> <legend><?php echo JText::_($field['label']) ?></legend> <?php foreach ($field->children() as $innerField): ?> <?php $input = $this->adminForm->getField($innerField['name'], 'jsn') ?> <?php if (trim($innerField['label']) != '') : ?> <div class="control-group"> <div class="control-label"> <label for="<?php echo $input->id ?>" rel="tipsy" title="<?php echo JText::_($innerField['label'] . '_DESC') ?>"> <?php echo JText::_($innerField['label']) ?> </label> </div> <div class="controls"> <?php echo str_replace('%TEMPLATE%', $this->data->template, $input->input) ?> </div> </div> <?php else : ?> <div> <?php echo str_replace('%TEMPLATE%', $this->data->template, $input->input) ?> </div> <?php endif; ?> <?php endforeach ?> </fieldset> <?php endif ?> <?php endforeach ?> <?php endif ?> </div> <?php endif ?> <?php endforeach ?> <div id="menu-assignment"> <?php include <API key> . '/template/tmpl/default_assignment.php' ?> </div> </div> </form> <?php if ($promotion) : ?> <div id="see-other-products"> <h2 class="jsn-section-header"> <?php echo JText::_('<API key>') ?> <ul class="jsn-list-horizontal pull-right"> <li> <a class="jsn-icon24 jsn-icon-social jsn-icon-facebook" href="http: title="<?php echo JText::_('<API key>') ?>" target="_blank"> </a> </li> <li> <a class="jsn-icon24 jsn-icon-social jsn-icon-twitter" href="http: title="<?php echo JText::_('<API key>') ?>" target="_blank"> </a> </li> <li> <a class="jsn-icon24 jsn-icon-social jsn-icon-youtube" href="http: title="<?php echo JText::_('<API key>') ?>" target="_blank"> </a> </li> </ul> </h2> <div class="clearbreak"></div> <div class="bxslider"> <?php foreach ($jsn_templates as $item) : $download = 'javascript:void(0)'; $title = 'Joomla Templates by JoomlaShine.com'; if (preg_match('#/jsn-([a-z0-9]+)\.#i', $item->image, $m)) { $download = 'http: $title = 'JSN ' . ucfirst($m[1]); } ?> <a <?php echo 'href="http://demo.joomlashine.com/products-intro/' . $item->image . '" title="' . $title . '" data-demo="' . $item->link . '" data-download="' . $download . '" rel="cross-promo"'; ?>> <img src="http://demo.joomlashine.com/products-intro/<?php echo $item->thumbnail; ?>" /> </a> <?php endforeach; ?> </div> <input type="hidden" name="visited" value="" /> <script type="text/javascript"> (function($) { $(document).ready(function() { var promotion = $('.bxslider'); slicesPerView = parseInt(promotion.innerWidth() / 250); promotion.bxSlider({ hideControlOnEnd: true, adaptiveHeight: true, pager: false, slideWidth: 250, slideMargin: 10, minSlides: slicesPerView, maxSlides: slicesPerView, }); $('.bxslider > a').colorbox({ rel: 'cross-promo', onComplete: function(event) { // Set title $('#colorbox #cboxCurrent').html($(event.el).attr('title')); // Set buttons $('#colorbox #cboxTitle').html( '<div class="jsn-master"><div class="jsn-bootstrap">' + '<a href="' + $(event.el).attr('data-demo') + '" class="btn btn-primary" target="_blank"><?php echo JText::_('JSN_TPLFW_DEMO'); ?></a>' + '<a href="' + $(event.el).attr('data-download') + '" class="btn btn-success" target="_blank"><?php echo JText::_('JSN_TPLFW_DOWNLOAD'); ?></a>' + '</div></div>' ); }, }); }); })(jQuery); </script> </div> <?php endif; ?> <div class="modal hide" id="<API key>"> <div class="modal-body"> <p><?php echo JText::_('<API key>'); ?></p> </div> <div class="modal-footer"> <a class="btn btn-primary jsn-upgrade-link" href="javascript:void(0)" onclick="jQuery(this).parent().parent().addClass('hide');"><?php echo JText::_('<API key>'); ?></a> <a class="btn" href="javascript:void(0)" onclick="jQuery(this).parent().parent().addClass('hide');"><?php echo JText::_('JSN_TPLFW_CLOSE'); ?></a> </div> </div> <div class="<API key> <API key> alert alert-error hide"> <span></span> <a href="javascript:void(0);" title="<?php echo JText::_('JSN_TPLFW_CLOSE'); ?>" class="close" onclick="jQuery(this).parent().addClass('hide');">×</a> </div> </div></div> <div class="jsn-master"> <div class="jsn-page-footer jsn-bootstrap" id="jsn-footer"> <?php if ($<API key>) { ?> <?php echo $<API key>; ?> <?php } else { ?> <div class="pull-left"> <ul class="jsn-footer-menu"> <li class="first"> <a target="_blank" href="http: </li> <li> <a target="_blank" href="http: </li> <li class="jsn-iconbar"> <strong>Keep in touch:</strong> <a href="http: </li> </ul> <ul class="jsn-footer-menu"> <li class="first"> <a target="_blank" href="<?php echo $templateLink ?>"><?php echo JText::_($template->name) ?> <?php echo $edition ?> v<?php echo $version ?></a> by <a target="_blank" href="http: <?php if ($nextEdition) : ?> &nbsp;<a class="label label-important jsn-upgrade-link" href="javascript:void()"><strong class="jsn-text-attention"><?php echo JText::_($nextEdition == 'STANDARD' ? '<API key>' : '<API key>'); ?></strong></a> <?php endif; ?> </li> <li class="<API key>" id="<API key>" style="display:none"> <span class="<API key>"><?php echo JText::_('<API key>'); ?></span> &nbsp;<a class="label label-important jsn-update-link" data-target="template" href="javascript:void(0)"><?php echo JText::_('<API key>'); ?></a> </li> </ul> </div> <div class="pull-right"> <ul class="jsn-footer-menu"> <li class="jsn-iconbar first"> <a href="http: <i class="jsn-icon32 jsn-icon-products jsn-icon-poweradmin"></i> </a> <a href="http: <i class="jsn-icon32 jsn-icon-products jsn-icon-imageshow"></i> </a> <a href="http: <i class="jsn-icon32 jsn-icon-products jsn-icon-uniform"></i> </a> <a href="http: <i class="jsn-icon32 jsn-icon-products jsn-icon-mobilize"></i> </a> <a href="http: <i class="jsn-icon32 jsn-icon-products <API key>"></i> </a> <a href="http: <i class="jsn-icon32 jsn-icon-products jsn-icon-easyslider"></i> </a> </li> </ul> </div> <?php } ?> <div class="clearbreak"></div> </div> </div> <!-- Hidden form for saving/restoring template parameters --> <form id="<API key>" method="post" enctype="multipart/form-data" target="jsn-silent-save" class="hide"> <input type="file" name="backup-upload" /> </form> <iframe id="jsn-silent-save" name="jsn-silent-save" class="hide" src="about:blank"></iframe> <script type="text/javascript"> (function($) { $(document).ready(function() { $(".jsn-modal-overlay,.jsn-modal-indicator").remove(); $("body").append($("<div/>", { "class":"jsn-modal-overlay", "style":"z-index: 1000; display: inline;" })).append($("<div/>", { "class":"jsn-modal-indicator", "style":"display:block" })).addClass("jsn-loading-page"); $(".jsn-modal-overlay,.jsn-modal-indicator").delay(1200).queue(function () { $(this).remove(); $("#<API key>").removeClass("jsn-hide"); }); }); // Setup tabs $('#<API key>').tabs(); // Setup form validation new $.JSNFormValidation({ lang: { <API key>: '<?php echo JText::_('<API key>'); ?>', <API key>: '<?php echo JText::_('<API key>'); ?>', <API key>: '<?php echo JText::_('<API key>'); ?>' } }); })(jQuery); </script>
#ifndef _SYS_PARAM_H #define _SYS_PARAM_H #include <limits.h> #define MAXPATHLEN PATH_MAX #define MAXHOSTNAMELEN 64 #define NGROUPS 32 #define NOGROUP (-1) #define NOFILE OPEN_MAX #undef MIN #undef MAX #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) #ifdef __alpha__ #define HZ 1024 #else #define HZ 100 #endif #ifndef howmany # define howmany(x, y) (((x)+((y)-1))/(y)) #endif #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) #define powerof2(x) ((((x)-1)&(x))==0) #endif
/** @file Common.cpp * @author Gav Wood <i@gavwood.com> * @date 2014 */ #include "Common.h" #include "Network.h" using namespace std; using namespace dev; using namespace dev::p2p; const unsigned dev::p2p::c_protocolVersion = 4; const unsigned dev::p2p::c_defaultIPPort = 30303; static_assert(dev::p2p::c_protocolVersion == 4, "Replace v3 compatbility with v4 compatibility before updating network version."); const dev::p2p::NodeIPEndpoint dev::p2p::<API key> = NodeIPEndpoint(bi::address(), 0, 0); const dev::p2p::Node dev::p2p::UnspecifiedNode = dev::p2p::Node(NodeID(), <API key>); bool dev::p2p::NodeIPEndpoint::test_allowLocal = false; #if defined(_WIN32) const char* NetWarn::name() { return EthYellow "N" EthRed " X"; } const char* NetImpolite::name() { return EthYellow "N" EthRed " !"; } const char* NetNote::name() { return EthYellow "N" EthBlue " i"; } const char* NetConnect::name() { return EthYellow "N" EthYellow " C"; } const char* NetMessageSummary::name() { return EthYellow "N" EthWhite " ."; } const char* NetMessageDetail::name() { return EthYellow "N" EthGray " o"; } const char* NetTriviaSummary::name() { return EthYellow "N" EthGray " O"; } const char* NetTriviaDetail::name() { return EthYellow "N" EthCoal " 0"; } const char* NetAllDetail::name() { return EthYellow "N" EthCoal " A"; } const char* NetRight::name() { return EthYellow "N" EthGreen "->"; } const char* NetLeft::name() { return EthYellow "N" EthNavy "<-"; } const char* NetP2PWarn::name() { return EthYellow "N" EthRed " X"; } const char* NetP2PNote::name() { return EthYellow "N" EthBlue " i"; } const char* NetP2PConnect::name() { return EthYellow "N" EthYellow " C"; } #else const char* NetWarn::name() { return EthYellow "" EthRed " "; } const char* NetImpolite::name() { return EthYellow "" EthRed " !"; } const char* NetNote::name() { return EthYellow "" EthBlue " ℹ"; } const char* NetConnect::name() { return EthYellow "" EthYellow " "; } const char* NetMessageSummary::name() { return EthYellow "" EthWhite " "; } const char* NetMessageDetail::name() { return EthYellow "" EthGray " "; } const char* NetTriviaSummary::name() { return EthYellow "" EthGray " "; } const char* NetTriviaDetail::name() { return EthYellow "" EthCoal " "; } const char* NetAllDetail::name() { return EthYellow "" EthCoal " "; } const char* NetRight::name() { return EthYellow "" EthGreen ""; } const char* NetLeft::name() { return EthYellow "" EthNavy ""; } const char* NetP2PWarn::name() { return EthYellow "" EthRed " "; } const char* NetP2PNote::name() { return EthYellow "" EthBlue " ℹ"; } const char* NetP2PConnect::name() { return EthYellow "" EthYellow " "; } #endif bool p2p::isPublicAddress(std::string const& _addressToCheck) { return _addressToCheck.empty() ? false : isPublicAddress(bi::address::from_string(_addressToCheck)); } bool p2p::isPublicAddress(bi::address const& _addressToCheck) { return !(isPrivateAddress(_addressToCheck) || isLocalHostAddress(_addressToCheck)); } // Helper function to determine if an address falls within one of the reserved ranges // For V4: // Class A "10.*", Class B "172.[16->31].*", Class C "192.168.*" bool p2p::isPrivateAddress(bi::address const& _addressToCheck) { if (_addressToCheck.is_v4()) { bi::address_v4 v4Address = _addressToCheck.to_v4(); bi::address_v4::bytes_type bytesToCheck = v4Address.to_bytes(); if (bytesToCheck[0] == 10 || bytesToCheck[0] == 127) return true; if (bytesToCheck[0] == 172 && (bytesToCheck[1] >= 16 && bytesToCheck[1] <= 31)) return true; if (bytesToCheck[0] == 192 && bytesToCheck[1] == 168) return true; } else if (_addressToCheck.is_v6()) { bi::address_v6 v6Address = _addressToCheck.to_v6(); bi::address_v6::bytes_type bytesToCheck = v6Address.to_bytes(); if (bytesToCheck[0] == 0xfd && bytesToCheck[1] == 0) return true; if (!bytesToCheck[0] && !bytesToCheck[1] && !bytesToCheck[2] && !bytesToCheck[3] && !bytesToCheck[4] && !bytesToCheck[5] && !bytesToCheck[6] && !bytesToCheck[7] && !bytesToCheck[8] && !bytesToCheck[9] && !bytesToCheck[10] && !bytesToCheck[11] && !bytesToCheck[12] && !bytesToCheck[13] && !bytesToCheck[14] && (bytesToCheck[15] == 0 || bytesToCheck[15] == 1)) return true; } return false; } bool p2p::isPrivateAddress(std::string const& _addressToCheck) { return _addressToCheck.empty() ? false : isPrivateAddress(bi::address::from_string(_addressToCheck)); } // Helper function to determine if an address is localhost bool p2p::isLocalHostAddress(bi::address const& _addressToCheck) { // @todo: ivp6 link-local adresses (macos), ex: fe80::1%lo0 static const set<bi::address> c_rejectAddresses = { {bi::address_v4::from_string("127.0.0.1")}, {bi::address_v4::from_string("0.0.0.0")}, {bi::address_v6::from_string("::1")}, {bi::address_v6::from_string("::")} }; return find(c_rejectAddresses.begin(), c_rejectAddresses.end(), _addressToCheck) != c_rejectAddresses.end(); } bool p2p::isLocalHostAddress(std::string const& _addressToCheck) { return _addressToCheck.empty() ? false : isLocalHostAddress(bi::address::from_string(_addressToCheck)); } std::string p2p::reasonOf(DisconnectReason _r) { switch (_r) { case DisconnectRequested: return "Disconnect was requested."; case TCPError: return "Low-level TCP communication error."; case BadProtocol: return "Data format error."; case UselessPeer: return "Peer had no use for this node."; case TooManyPeers: return "Peer had too many connections."; case DuplicatePeer: return "Peer was already connected."; case <API key>: return "Peer protocol versions are incompatible."; case NullIdentity: return "Null identity given."; case ClientQuit: return "Peer is exiting."; case UnexpectedIdentity: return "Unexpected identity given."; case LocalIdentity: return "Connected to ourselves."; case UserReason: return "Subprotocol reason."; case NoDisconnect: return "(No disconnect has happened.)"; default: return "Unknown reason."; } } void NodeIPEndpoint::streamRLP(RLPStream& _s, RLPAppend _append) const { if (_append == StreamList) _s.appendList(3); if (address.is_v4()) _s << bytesConstRef(&address.to_v4().to_bytes()[0], 4); else if (address.is_v6()) _s << bytesConstRef(&address.to_v6().to_bytes()[0], 16); else _s << bytes(); _s << udpPort << tcpPort; } void NodeIPEndpoint::interpretRLP(RLP const& _r) { if (_r[0].size() == 4) address = bi::address_v4(*(bi::address_v4::bytes_type*)_r[0].toBytes().data()); else if (_r[0].size() == 16) address = bi::address_v6(*(bi::address_v6::bytes_type*)_r[0].toBytes().data()); else address = bi::address(); udpPort = _r[1].toInt<uint16_t>(); tcpPort = _r[2].toInt<uint16_t>(); } void DeadlineOps::reap() { if (m_stopped) return; Guard l(x_timers); std::vector<DeadlineOp>::iterator t = m_timers.begin(); while (t != m_timers.end()) if (t->expired()) { t->wait(); t = m_timers.erase(t); } else t++; m_timers.emplace_back(m_io, m_reapIntervalMs, [this](boost::system::error_code const& ec) { if (!ec && !m_stopped) reap(); }); } Node::Node(NodeSpec const& _s, PeerType _p): id(_s.id()), endpoint(_s.nodeIPEndpoint()), peerType(_p) {} NodeSpec::NodeSpec(string const& _user) { m_address = _user; if (m_address.substr(0, 8) == "enode://" && m_address.find('@') == 136) { m_id = p2p::NodeID(m_address.substr(8, 128)); m_address = m_address.substr(137); } size_t colon = m_address.find_first_of(":"); if (colon != string::npos) { string ports = m_address.substr(colon + 1); m_address = m_address.substr(0, colon); size_t p2 = ports.find_first_of("."); if (p2 != string::npos) { m_udpPort = stoi(ports.substr(p2 + 1)); m_tcpPort = stoi(ports.substr(0, p2)); } else m_tcpPort = m_udpPort = stoi(ports); } } NodeIPEndpoint NodeSpec::nodeIPEndpoint() const { return NodeIPEndpoint(p2p::Network::resolveHost(m_address).address(), m_udpPort, m_tcpPort); } std::string NodeSpec::enode() const { string ret = m_address; if (m_tcpPort) if (m_udpPort && m_tcpPort != m_udpPort) ret += ":" + toString(m_tcpPort) + "." + toString(m_udpPort); else ret += ":" + toString(m_tcpPort); else if (m_udpPort) ret += ":" + toString(m_udpPort); if (m_id) return "enode://" + m_id.hex() + "@" + ret; return ret; } namespace dev { std::ostream& operator<<(std::ostream& _out, dev::p2p::NodeIPEndpoint const& _ep) { _out << _ep.address << _ep.udpPort << _ep.tcpPort; return _out; } }
#include <linux/delay.h> #include <linux/fs.h> #include <linux/i2c.h> #include <linux/miscdevice.h> #include <linux/regulator/consumer.h> #include <linux/slab.h> #include <linux/uaccess.h> #include <media/ar0832_focuser.h> // LGE_CHANGE_S X2_ICS [byun.youngki@lge.com], 2012-05-03, < recover to GB version > #include <media/ar0832_main.h> // LGE_CHANGE_E X2_ICS [byun.youngki@lge.com], 2012-05-03, < recover to GB version > #define POS_LOW 0 #define POS_HIGH 255 #define SETTLETIME_MS 100 #define FOCAL_LENGTH (3.5f) #define FNUMBER (2.8f) #define FPOS_COUNT 1024 DEFINE_MUTEX(star_focuser_lock); #define DW9716_MAX_RETRIES (3) static int <API key>(struct i2c_client *client, u16 value) { int count; struct i2c_msg msg[1]; unsigned char data[2]; int retry = 0; if (!client->adapter) return -ENODEV; data[0] = (u8) ((value >> 4) & 0x3F); data[1] = (u8) ((value & 0xF) << 4); data[1] = (data[1] &0xF0) |0x05; // Slew rate control (8 steps, 50us) msg[0].addr = client->addr; msg[0].flags = 0; msg[0].len = ARRAY_SIZE(data); msg[0].buf = data; // pr_info("%s: focuser set position = %d, 0x%x\n", __func__, value, *(u16*)data); do { count = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); if (count == ARRAY_SIZE(msg)) return 0; retry++; pr_err("ar0832_focuser: i2c transfer failed, retrying %x\n", value); msleep(3); }while (retry <= DW9716_MAX_RETRIES); return -EIO; } static int <API key>(struct ar0832_focuser_info *info, u16 value) { int ret; switch(info->camera_mode){ case Main: case LeftOnly: ret = <API key>(info->i2c_client, value); break; case Stereo: ret = <API key>(info->i2c_client, value); ret = <API key>(info->i2c_client_right, value); break; case RightOnly: ret = <API key>(info->i2c_client_right, value); break; default : return -1; } return ret; } static int <API key>(struct ar0832_focuser_info *info, u32 position) { if (position < info->config.pos_low || position > info->config.pos_high) return -EINVAL; return <API key>(info->i2c_client, position); } static long <API key>(struct file *file, unsigned int cmd, unsigned long arg) { struct ar0832_focuser_info *info = file->private_data; int ret; switch (cmd) { case <API key>: { if (copy_to_user((void __user *) arg, &info->config, sizeof(info->config))) { pr_err("%s: 0x%x\n", __func__, __LINE__); return -EFAULT; } break; } case <API key>: mutex_lock(&star_focuser_lock); ret = <API key>(info, (u32) arg); mutex_unlock(&star_focuser_lock); return ret; case <API key>: info->camera_mode =(enum StereoCameraMode)arg; break; default: return -EINVAL; } return 0; } static struct ar0832_focuser_info *info = NULL; static int ar0832_focuser_open(struct inode *inode, struct file *file) { pr_info("ar0832_focuser: open!\n"); file->private_data = info; if (info->regulator) regulator_enable(info->regulator); return 0; } int <API key>(struct inode *inode, struct file *file) { pr_info("ar0832_focuser: release!\n"); if (info->regulator) regulator_disable(info->regulator); file->private_data = NULL; return 0; } static const struct file_operations <API key> = { .owner = THIS_MODULE, .open = ar0832_focuser_open, .unlocked_ioctl = <API key>, .release = <API key>, }; static struct miscdevice <API key> = { .minor = MISC_DYNAMIC_MINOR, .name = "ar0832_focuser", .fops = &<API key>, }; static int <API key>(struct i2c_client *client, const struct i2c_device_id *id) { int err; pr_info("ar0832_focuser: probing sensor.\n"); info = kzalloc(sizeof(struct ar0832_focuser_info), GFP_KERNEL); if (!info) { pr_err("ar0832_focuser: Unable to allocate memory!\n"); return -ENOMEM; } err = misc_register(&<API key>); if (err) { pr_err("ar0832_focuser: Unable to register misc device!\n"); kfree(info); return err; } //WBT#196353 : don'use the regulator. the power turn on when camera turn on. /* info->regulator = regulator_get(&client->dev, "p_cam_avdd"); if (IS_ERR_OR_NULL(info->regulator)) { dev_err(&client->dev, "unable to get regulator %s\n", dev_name(&client->dev)); info->regulator = NULL; } else { regulator_enable(info->regulator); } */ info->regulator = 0; info->i2c_client = client; info->config.settle_time = SETTLETIME_MS; info->config.focal_length = FOCAL_LENGTH; info->config.fnumber = FNUMBER; info->config.pos_low = POS_LOW; info->config.pos_high = POS_HIGH; i2c_set_clientdata(client, info); return 0; } static int <API key>(struct i2c_client *client) { struct ar0832_focuser_info *info; info = i2c_get_clientdata(client); misc_deregister(&<API key>); kfree(info); return 0; } static const struct i2c_device_id ar0832_focuser_id[] = { { "ar0832_focuser", 0 }, { }, }; MODULE_DEVICE_TABLE(i2c, ar0832_focuser_id); static struct i2c_driver <API key> = { .driver = { .name = "ar0832_focuser", .owner = THIS_MODULE, }, .probe = <API key>, .remove = <API key>, .id_table = ar0832_focuser_id, }; static int __init ar0832_focuser_init(void) { pr_info("ar0832_focuser sensor driver loading\n"); i2c_add_driver(&<API key>); return 0; } static void __exit ar0832_focuser_exit(void) { i2c_del_driver(&<API key>); } module_init(ar0832_focuser_init); module_exit(ar0832_focuser_exit);
#ifndef LINUX_BTRACE_H #define LINUX_BTRACE_H #include "btrace-common.h" #include "vec.h" #if <API key> # include <linux/perf_event.h> #endif struct target_ops; #if <API key> /* A Linux perf event buffer. */ struct perf_event_buffer { /* The mapped memory. */ const uint8_t *mem; /* The size of the mapped memory in bytes. */ size_t size; /* A pointer to the data_head field for this buffer. */ volatile __u64 *data_head; /* The data_head value from the last read. */ __u64 last_head; }; /* Branch trace target information for BTS tracing. */ struct btrace_tinfo_bts { /* The Linux perf_event configuration for collecting the branch trace. */ struct perf_event_attr attr; /* The perf event file. */ int file; /* The perf event configuration page. */ volatile struct <API key> *header; /* The BTS perf event buffer. */ struct perf_event_buffer bts; }; /* Branch trace target information for Intel Processor Trace tracing. */ struct btrace_tinfo_pt { /* The Linux perf_event configuration for collecting the branch trace. */ struct perf_event_attr attr; /* The perf event file. */ int file; /* The perf event configuration page. */ volatile struct <API key> *header; /* The trace perf event buffer. */ struct perf_event_buffer pt; }; #endif /* <API key> */ /* Branch trace target information per thread. */ struct btrace_target_info { /* The ptid of this thread. */ ptid_t ptid; /* The obtained branch trace configuration. */ struct btrace_config conf; #if <API key> /* The branch tracing format specific information. */ union { /* CONF.FORMAT == BTRACE_FORMAT_BTS. */ struct btrace_tinfo_bts bts; /* CONF.FORMAT == BTRACE_FORMAT_PT. */ struct btrace_tinfo_pt pt; } variant; #endif /* <API key> */ }; /* See to_supports_btrace in target.h. */ extern int <API key> (struct target_ops *, enum btrace_format); /* See to_enable_btrace in target.h. */ extern struct btrace_target_info * linux_enable_btrace (ptid_t ptid, const struct btrace_config *conf); /* See to_disable_btrace in target.h. */ extern enum btrace_error <API key> (struct btrace_target_info *ti); /* See to_read_btrace in target.h. */ extern enum btrace_error linux_read_btrace (struct btrace_data *btrace, struct btrace_target_info *btinfo, enum btrace_read_type type); /* See to_btrace_conf in target.h. */ extern const struct btrace_config * linux_btrace_conf (const struct btrace_target_info *); #endif /* LINUX_BTRACE_H */
/*! * \file atomic/detail/atomic_template.hpp * * This header contains interface definition of \c atomic template. */ #ifndef <API key> #define <API key> #include <cstddef> #include <boost/cstdint.hpp> #include <boost/assert.hpp> #include <boost/atomic/detail/config.hpp> #include <boost/atomic/detail/bitwise_cast.hpp> #include <boost/atomic/detail/operations_fwd.hpp> #include <boost/atomic/detail/type_traits/is_signed.hpp> #include <boost/atomic/detail/type_traits/is_integral.hpp> #include <boost/atomic/detail/type_traits/is_function.hpp> #include <boost/atomic/detail/type_traits/conditional.hpp> #ifdef <API key> #pragma once #endif #if defined(BOOST_MSVC) #pragma warning(push) // 'boost::atomics::atomic<T>' : multiple assignment operators specified #pragma warning(disable: 4522) #endif /* * IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE, * see comment for <API key> in ops_gcc_atomic.hpp. */ namespace boost { namespace atomics { namespace detail { BOOST_FORCEINLINE BOOST_CONSTEXPR memory_order <API key>(memory_order order) BOOST_NOEXCEPT { return order == <API key> ? <API key> : (order == <API key> ? <API key> : order); } BOOST_FORCEINLINE BOOST_CONSTEXPR bool <API key>(memory_order success_order, memory_order failure_order) BOOST_NOEXCEPT { // 15 == (<API key> | <API key>), see memory_order.hpp // Given the enum values we can test the strength of memory order requirements with this single condition. return (failure_order & 15u) <= (success_order & 15u); } template< typename T, bool IsFunction = boost::atomics::detail::is_function< T >::value > struct classify_pointer { typedef void* type; }; template< typename T > struct classify_pointer< T, true > { typedef void type; }; template< typename T, bool IsInt = boost::atomics::detail::is_integral< T >::value > struct classify { typedef void type; }; template< typename T > struct classify< T, true > { typedef int type; }; template< typename T > struct classify< T*, false > { typedef typename classify_pointer< T >::type type; }; template< > struct classify< void*, false > { typedef void type; }; template< > struct classify< const void*, false > { typedef void type; }; template< > struct classify< volatile void*, false > { typedef void type; }; template< > struct classify< const volatile void*, false > { typedef void type; }; template< typename T, typename U > struct classify< T U::*, false > { typedef void type; }; template< bool > struct boolean_constant {}; typedef boolean_constant< true > true_constant; typedef boolean_constant< false > false_constant; template< typename T, typename Kind > class base_atomic; //! General template. Implementation for user-defined types, such as structs and enums, and pointers to non-object types template< typename T > class base_atomic< T, void > { public: typedef T value_type; protected: typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations; typedef typename boost::atomics::detail::conditional< sizeof(value_type) <= sizeof(void*), value_type, value_type const& >::type value_arg_type; public: typedef typename operations::storage_type storage_type; private: typedef boolean_constant< sizeof(value_type) == sizeof(storage_type) > <API key>; protected: typename operations::<API key> m_storage; public: BOOST_FORCEINLINE explicit base_atomic(value_arg_type v = value_type()) BOOST_NOEXCEPT : m_storage(atomics::detail::bitwise_cast< storage_type >(v)) { } BOOST_FORCEINLINE void store(value_arg_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); operations::store(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order); } BOOST_FORCEINLINE value_type load(memory_order order = <API key>) const volatile BOOST_NOEXCEPT { BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); return atomics::detail::bitwise_cast< value_type >(operations::load(m_storage.value, order)); } BOOST_FORCEINLINE value_type exchange(value_arg_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return atomics::detail::bitwise_cast< value_type >(operations::exchange(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order)); } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_arg_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT { BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(<API key>(success_order, failure_order)); return <API key>(expected, desired, success_order, failure_order, <API key>()); } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_arg_type desired, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return <API key>(expected, desired, order, atomics::detail::<API key>(order)); } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_arg_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT { BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(<API key>(success_order, failure_order)); return <API key>(expected, desired, success_order, failure_order, <API key>()); } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_arg_type desired, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return <API key>(expected, desired, order, atomics::detail::<API key>(order)); } <API key>(base_atomic(base_atomic const&)) <API key>(base_atomic& operator=(base_atomic const&)) private: BOOST_FORCEINLINE bool <API key>(value_type& expected, value_arg_type desired, memory_order success_order, memory_order failure_order, true_constant) volatile BOOST_NOEXCEPT { #if defined(<API key>) return operations::<API key>(m_storage.value, reinterpret_cast< storage_type& >(expected), atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); #else return <API key>(expected, desired, success_order, failure_order, false_constant()); #endif } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_arg_type desired, memory_order success_order, memory_order failure_order, false_constant) volatile BOOST_NOEXCEPT { storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected); const bool res = operations::<API key>(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); expected = atomics::detail::bitwise_cast< value_type >(old_value); return res; } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_arg_type desired, memory_order success_order, memory_order failure_order, true_constant) volatile BOOST_NOEXCEPT { #if defined(<API key>) return operations::<API key>(m_storage.value, reinterpret_cast< storage_type& >(expected), atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); #else return <API key>(expected, desired, success_order, failure_order, false_constant()); #endif } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_arg_type desired, memory_order success_order, memory_order failure_order, false_constant) volatile BOOST_NOEXCEPT { storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected); const bool res = operations::<API key>(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); expected = atomics::detail::bitwise_cast< value_type >(old_value); return res; } }; //! Implementation for integers template< typename T > class base_atomic< T, int > { public: typedef T value_type; typedef T difference_type; protected: typedef atomics::detail::operations< storage_size_of< value_type >::value, boost::atomics::detail::is_signed< T >::value > operations; typedef value_type value_arg_type; public: typedef typename operations::storage_type storage_type; protected: typename operations::<API key> m_storage; public: <API key>(base_atomic(), {}) BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : m_storage(v) {} BOOST_FORCEINLINE void store(value_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); operations::store(m_storage.value, static_cast< storage_type >(v), order); } BOOST_FORCEINLINE value_type load(memory_order order = <API key>) const volatile BOOST_NOEXCEPT { BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); return static_cast< value_type >(operations::load(m_storage.value, order)); } BOOST_FORCEINLINE value_type fetch_add(difference_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return static_cast< value_type >(operations::fetch_add(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type fetch_sub(difference_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return static_cast< value_type >(operations::fetch_sub(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return static_cast< value_type >(operations::exchange(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT { BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(<API key>(success_order, failure_order)); #if defined(<API key>) return operations::<API key>(m_storage.value, reinterpret_cast< storage_type& >(expected), static_cast< storage_type >(desired), success_order, failure_order); #else storage_type old_value = static_cast< storage_type >(expected); const bool res = operations::<API key>(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order); expected = static_cast< value_type >(old_value); return res; #endif } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return <API key>(expected, desired, order, atomics::detail::<API key>(order)); } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT { BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(<API key>(success_order, failure_order)); #if defined(<API key>) return operations::<API key>(m_storage.value, reinterpret_cast< storage_type& >(expected), static_cast< storage_type >(desired), success_order, failure_order); #else storage_type old_value = static_cast< storage_type >(expected); const bool res = operations::<API key>(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order); expected = static_cast< value_type >(old_value); return res; #endif } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return <API key>(expected, desired, order, atomics::detail::<API key>(order)); } BOOST_FORCEINLINE value_type fetch_and(value_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return static_cast< value_type >(operations::fetch_and(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type fetch_or(value_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return static_cast< value_type >(operations::fetch_or(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type fetch_xor(value_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return static_cast< value_type >(operations::fetch_xor(m_storage.value, static_cast< storage_type >(v), order)); } BOOST_FORCEINLINE value_type operator++(int) volatile BOOST_NOEXCEPT { return fetch_add(1); } BOOST_FORCEINLINE value_type operator++() volatile BOOST_NOEXCEPT { return fetch_add(1) + 1; } BOOST_FORCEINLINE value_type operator--(int) volatile BOOST_NOEXCEPT { return fetch_sub(1); } BOOST_FORCEINLINE value_type operator--() volatile BOOST_NOEXCEPT { return fetch_sub(1) - 1; } BOOST_FORCEINLINE value_type operator+=(difference_type v) volatile BOOST_NOEXCEPT { return fetch_add(v) + v; } BOOST_FORCEINLINE value_type operator-=(difference_type v) volatile BOOST_NOEXCEPT { return fetch_sub(v) - v; } BOOST_FORCEINLINE value_type operator&=(value_type v) volatile BOOST_NOEXCEPT { return fetch_and(v) & v; } BOOST_FORCEINLINE value_type operator|=(value_type v) volatile BOOST_NOEXCEPT { return fetch_or(v) | v; } BOOST_FORCEINLINE value_type operator^=(value_type v) volatile BOOST_NOEXCEPT { return fetch_xor(v) ^ v; } <API key>(base_atomic(base_atomic const&)) <API key>(base_atomic& operator=(base_atomic const&)) }; //! Implementation for bool template< > class base_atomic< bool, int > { public: typedef bool value_type; protected: typedef atomics::detail::operations< 1u, false > operations; typedef value_type value_arg_type; public: typedef operations::storage_type storage_type; protected: operations::<API key> m_storage; public: <API key>(base_atomic(), {}) BOOST_CONSTEXPR explicit base_atomic(value_type v) BOOST_NOEXCEPT : m_storage(v) {} BOOST_FORCEINLINE void store(value_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); operations::store(m_storage.value, static_cast< storage_type >(v), order); } BOOST_FORCEINLINE value_type load(memory_order order = <API key>) const volatile BOOST_NOEXCEPT { BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); return !!operations::load(m_storage.value, order); } BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return !!operations::exchange(m_storage.value, static_cast< storage_type >(v), order); } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT { BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(<API key>(success_order, failure_order)); #if defined(<API key>) return operations::<API key>(m_storage.value, reinterpret_cast< storage_type& >(expected), static_cast< storage_type >(desired), success_order, failure_order); #else storage_type old_value = static_cast< storage_type >(expected); const bool res = operations::<API key>(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order); expected = !!old_value; return res; #endif } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return <API key>(expected, desired, order, atomics::detail::<API key>(order)); } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT { BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(<API key>(success_order, failure_order)); #if defined(<API key>) return operations::<API key>(m_storage.value, reinterpret_cast< storage_type& >(expected), static_cast< storage_type >(desired), success_order, failure_order); #else storage_type old_value = static_cast< storage_type >(expected); const bool res = operations::<API key>(m_storage.value, old_value, static_cast< storage_type >(desired), success_order, failure_order); expected = !!old_value; return res; #endif } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return <API key>(expected, desired, order, atomics::detail::<API key>(order)); } <API key>(base_atomic(base_atomic const&)) <API key>(base_atomic& operator=(base_atomic const&)) }; //! Implementation for pointers to object types template< typename T > class base_atomic< T*, void* > { public: typedef T* value_type; typedef std::ptrdiff_t difference_type; protected: typedef atomics::detail::operations< storage_size_of< value_type >::value, false > operations; typedef value_type value_arg_type; public: typedef typename operations::storage_type storage_type; protected: typename operations::<API key> m_storage; public: <API key>(base_atomic(), {}) BOOST_FORCEINLINE explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : m_storage(atomics::detail::bitwise_cast< storage_type >(v)) { } BOOST_FORCEINLINE void store(value_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); operations::store(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order); } BOOST_FORCEINLINE value_type load(memory_order order = <API key>) const volatile BOOST_NOEXCEPT { BOOST_ASSERT(order != <API key>); BOOST_ASSERT(order != <API key>); return atomics::detail::bitwise_cast< value_type >(operations::load(m_storage.value, order)); } BOOST_FORCEINLINE value_type fetch_add(difference_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return atomics::detail::bitwise_cast< value_type >(operations::fetch_add(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order)); } BOOST_FORCEINLINE value_type fetch_sub(difference_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return atomics::detail::bitwise_cast< value_type >(operations::fetch_sub(m_storage.value, static_cast< storage_type >(v * sizeof(T)), order)); } BOOST_FORCEINLINE value_type exchange(value_type v, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return atomics::detail::bitwise_cast< value_type >(operations::exchange(m_storage.value, atomics::detail::bitwise_cast< storage_type >(v), order)); } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT { BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(<API key>(success_order, failure_order)); #if defined(<API key>) return operations::<API key>(m_storage.value, reinterpret_cast< storage_type& >(expected), atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); #else storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected); const bool res = operations::<API key>(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); expected = atomics::detail::bitwise_cast< value_type >(old_value); return res; #endif } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return <API key>(expected, desired, order, atomics::detail::<API key>(order)); } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order success_order, memory_order failure_order) volatile BOOST_NOEXCEPT { BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(failure_order != <API key>); BOOST_ASSERT(<API key>(success_order, failure_order)); #if defined(<API key>) return operations::<API key>(m_storage.value, reinterpret_cast< storage_type& >(expected), atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); #else storage_type old_value = atomics::detail::bitwise_cast< storage_type >(expected); const bool res = operations::<API key>(m_storage.value, old_value, atomics::detail::bitwise_cast< storage_type >(desired), success_order, failure_order); expected = atomics::detail::bitwise_cast< value_type >(old_value); return res; #endif } BOOST_FORCEINLINE bool <API key>(value_type& expected, value_type desired, memory_order order = <API key>) volatile BOOST_NOEXCEPT { return <API key>(expected, desired, order, atomics::detail::<API key>(order)); } BOOST_FORCEINLINE value_type operator++(int) volatile BOOST_NOEXCEPT { return fetch_add(1); } BOOST_FORCEINLINE value_type operator++() volatile BOOST_NOEXCEPT { return fetch_add(1) + 1; } BOOST_FORCEINLINE value_type operator--(int) volatile BOOST_NOEXCEPT { return fetch_sub(1); } BOOST_FORCEINLINE value_type operator--() volatile BOOST_NOEXCEPT { return fetch_sub(1) - 1; } BOOST_FORCEINLINE value_type operator+=(difference_type v) volatile BOOST_NOEXCEPT { return fetch_add(v) + v; } BOOST_FORCEINLINE value_type operator-=(difference_type v) volatile BOOST_NOEXCEPT { return fetch_sub(v) - v; } <API key>(base_atomic(base_atomic const&)) <API key>(base_atomic& operator=(base_atomic const&)) }; } // namespace detail template< typename T > class atomic : public atomics::detail::base_atomic< T, typename atomics::detail::classify< T >::type > { private: typedef atomics::detail::base_atomic< T, typename atomics::detail::classify< T >::type > base_type; typedef typename base_type::value_arg_type value_arg_type; public: typedef typename base_type::value_type value_type; typedef typename base_type::storage_type storage_type; public: static <API key> bool is_always_lock_free = base_type::operations::is_always_lock_free; public: <API key>(atomic(), BOOST_NOEXCEPT {}) // NOTE: The constructor is made explicit because gcc 4.7 complains that // operator=(value_arg_type) is considered ambiguous with operator=(atomic const&) // in assignment expressions, even though conversion to atomic<> is less preferred // than conversion to value_arg_type. BOOST_FORCEINLINE explicit BOOST_CONSTEXPR atomic(value_arg_type v) BOOST_NOEXCEPT : base_type(v) {} BOOST_FORCEINLINE value_type operator= (value_arg_type v) volatile BOOST_NOEXCEPT { this->store(v); return v; } BOOST_FORCEINLINE operator value_type() const volatile BOOST_NOEXCEPT { return this->load(); } BOOST_FORCEINLINE bool is_lock_free() const volatile BOOST_NOEXCEPT { // C++17 requires all instances of atomic<> return a value consistent with is_always_lock_free here return is_always_lock_free; } BOOST_FORCEINLINE storage_type& storage() BOOST_NOEXCEPT { return this->m_storage.value; } BOOST_FORCEINLINE storage_type volatile& storage() volatile BOOST_NOEXCEPT { return this->m_storage.value; } BOOST_FORCEINLINE storage_type const& storage() const BOOST_NOEXCEPT { return this->m_storage.value; } BOOST_FORCEINLINE storage_type const volatile& storage() const volatile BOOST_NOEXCEPT { return this->m_storage.value; } <API key>(atomic(atomic const&)) <API key>(atomic& operator= (atomic const&)) <API key>(atomic& operator= (atomic const&) volatile) }; template< typename T > <API key> bool atomic< T >::is_always_lock_free; typedef atomic< char > atomic_char; typedef atomic< unsigned char > atomic_uchar; typedef atomic< signed char > atomic_schar; typedef atomic< uint8_t > atomic_uint8_t; typedef atomic< int8_t > atomic_int8_t; typedef atomic< unsigned short > atomic_ushort; typedef atomic< short > atomic_short; typedef atomic< uint16_t > atomic_uint16_t; typedef atomic< int16_t > atomic_int16_t; typedef atomic< unsigned int > atomic_uint; typedef atomic< int > atomic_int; typedef atomic< uint32_t > atomic_uint32_t; typedef atomic< int32_t > atomic_int32_t; typedef atomic< unsigned long > atomic_ulong; typedef atomic< long > atomic_long; typedef atomic< uint64_t > atomic_uint64_t; typedef atomic< int64_t > atomic_int64_t; #ifdef BOOST_HAS_LONG_LONG typedef atomic< boost::ulong_long_type > atomic_ullong; typedef atomic< boost::long_long_type > atomic_llong; #endif typedef atomic< void* > atomic_address; typedef atomic< bool > atomic_bool; typedef atomic< wchar_t > atomic_wchar_t; #if !defined(<API key>) typedef atomic< char16_t > atomic_char16_t; #endif #if !defined(<API key>) typedef atomic< char32_t > atomic_char32_t; #endif typedef atomic< int_least8_t > atomic_int_least8_t; typedef atomic< uint_least8_t > <API key>; typedef atomic< int_least16_t > <API key>; typedef atomic< uint_least16_t > <API key>; typedef atomic< int_least32_t > <API key>; typedef atomic< uint_least32_t > <API key>; typedef atomic< int_least64_t > <API key>; typedef atomic< uint_least64_t > <API key>; typedef atomic< int_fast8_t > atomic_int_fast8_t; typedef atomic< uint_fast8_t > atomic_uint_fast8_t; typedef atomic< int_fast16_t > atomic_int_fast16_t; typedef atomic< uint_fast16_t > <API key>; typedef atomic< int_fast32_t > atomic_int_fast32_t; typedef atomic< uint_fast32_t > <API key>; typedef atomic< int_fast64_t > atomic_int_fast64_t; typedef atomic< uint_fast64_t > <API key>; typedef atomic< intmax_t > atomic_intmax_t; typedef atomic< uintmax_t > atomic_uintmax_t; typedef atomic< std::size_t > atomic_size_t; typedef atomic< std::ptrdiff_t > atomic_ptrdiff_t; #if defined(BOOST_HAS_INTPTR_T) typedef atomic< intptr_t > atomic_intptr_t; typedef atomic< uintptr_t > atomic_uintptr_t; #endif } // namespace atomics } // namespace boost #if defined(BOOST_MSVC) #pragma warning(pop) #endif #endif // <API key>
#include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> #include <linux/smp.h> #include <linux/interrupt.h> #include <linux/clk.h> #include <linux/delay.h> #include <linux/irq.h> #include <mach/gpio.h> #include <mach/iomap.h> #include <mach/irqs.h> #include <asm/cpu_pm.h> #include <asm/hardware/gic.h> #include <trace/events/power.h> #include "clock.h" #include "cpuidle.h" #include "pm.h" #include "sleep.h" #include "tegra3_emc.h" #include "dvfs.h" #ifdef <API key> #define <API key> \ (IO_ADDRESS(<API key>) + 0x20) #define <API key> \ (IO_ADDRESS(<API key>) + 0x24) #define <API key> \ (IO_ADDRESS(<API key>) + 0x368) #define <API key> \ (IO_ADDRESS(<API key>) + 0x36C) #define <API key> \ (IO_ADDRESS(<API key>) + 0x370) #define PLLX_DIV2_BYPASS_LP (1<<16) #define <API key> \ (IO_ADDRESS(<API key>) + 0x374) #define CAR_BOND_OUT_V \ (IO_ADDRESS(<API key>) + 0x390) #define <API key> (1<<0) #define <API key> (1<<1) #define CAR_CLK_ENB_V_SET \ (IO_ADDRESS(<API key>) + 0x440) #define CAR_CLK_ENB_V_CPU_G (1<<0) #define <API key> (1<<1) #define <API key> \ (IO_ADDRESS(<API key>) + 0x450) #define <API key> \ (IO_ADDRESS(<API key>) + 0x454) #define <API key> \ (IO_ADDRESS(<API key>) + 0x458) #define <API key> \ (IO_ADDRESS(<API key>) + 0x45C) #define <API key> \ (IO_ADDRESS(<API key>) + 0x460) #define <API key> \ (IO_ADDRESS(<API key>) + 0x464) #define <API key> \ (IO_ADDRESS(<API key>) + 0x468) #define <API key> \ (IO_ADDRESS(<API key>) + 0x46C) #define CPU_CLOCK(cpu) (0x1<<(8+cpu)) #define CPU_RESET(cpu) (0x1111ul<<(cpu)) static int <API key>(unsigned int flags) { u32 reg; u32 CclkBurstPolicy; u32 SuperCclkDivier; /* Read the bond out register containing the G and LP CPUs. */ reg = readl(CAR_BOND_OUT_V); /* Sync G-PLLX divider bypass with LP (no effect on G, just to prevent LP settings overwrite by save/restore code */ CclkBurstPolicy = ~PLLX_DIV2_BYPASS_LP & readl(<API key>); CclkBurstPolicy |= PLLX_DIV2_BYPASS_LP & readl(<API key>); writel(CclkBurstPolicy, <API key>); /* Switching to G? */ if (flags & <API key>) { /* Do the G CPUs exist? */ if (reg & <API key>) return -ENXIO; /* Keep G CPU clock policy set by upper laayer, with the exception of the transition via LP1 */ if (flags & <API key>) { /* In LP1 power mode come up on CLKM (oscillator) */ CclkBurstPolicy = readl(<API key>); CclkBurstPolicy &= ~0xF; SuperCclkDivier = 0; writel(CclkBurstPolicy, <API key>); writel(SuperCclkDivier, <API key>); } /* Hold G CPUs 1-3 in reset after the switch */ reg = CPU_RESET(1) | CPU_RESET(2) | CPU_RESET(3); writel(reg, <API key>); /* Take G CPU 0 out of reset after the switch */ reg = CPU_RESET(0); writel(reg, <API key>); /* Disable the clocks on G CPUs 1-3 after the switch */ reg = CPU_CLOCK(1) | CPU_CLOCK(2) | CPU_CLOCK(3); writel(reg, <API key>); /* Enable the clock on G CPU 0 after the switch */ reg = CPU_CLOCK(0); writel(reg, <API key>); /* Enable the G CPU complex clock after the switch */ reg = CAR_CLK_ENB_V_CPU_G; writel(reg, CAR_CLK_ENB_V_SET); } /* Switching to LP? */ else if (flags & <API key>) { /* Does the LP CPU exist? */ if (reg & <API key>) return -ENXIO; /* Keep LP CPU clock policy set by upper layer, with the exception of the transition via LP1 */ if (flags & <API key>) { /* In LP1 power mode come up on CLKM (oscillator) */ CclkBurstPolicy = readl(<API key>); CclkBurstPolicy &= ~0xF; SuperCclkDivier = 0; writel(CclkBurstPolicy, <API key>); writel(SuperCclkDivier, <API key>); } /* Take the LP CPU ut of reset after the switch */ reg = CPU_RESET(0); writel(reg, <API key>); /* Enable the clock on the LP CPU after the switch */ reg = CPU_CLOCK(0); writel(reg, <API key>); /* Enable the LP CPU complex clock after the switch */ reg = <API key>; writel(reg, CAR_CLK_ENB_V_SET); } return 0; } void <API key>(unsigned int flags) { unsigned int target_cluster = flags & <API key>; unsigned int current_cluster = is_lp_cluster() ? <API key> : <API key>; u32 reg; /* Read the flow controler CSR register and clear the CPU switch and immediate flags. If an actual CPU switch is to be performed, re-write the CSR register with the desired values. */ reg = readl(FLOW_CTRL_CPU_CSR(0)); reg &= ~(<API key> | <API key>); /* Program flow controller for immediate wake if requested */ if (flags & <API key>) reg |= <API key>; /* Do nothing if no switch actions requested */ if (!target_cluster) goto done; if ((current_cluster != target_cluster) || (flags & <API key>)) { if (current_cluster != target_cluster) { // Set up the clocks for the target CPU. if (<API key>(flags)) { /* The target CPU does not exist */ goto done; } /* Set up the flow controller to switch CPUs. */ reg |= <API key>; } } done: writel(reg, FLOW_CTRL_CPU_CSR(0)); } static void <API key>(void) { u32 actlr; /* TLB maintenance broadcast bit (FW) is stubbed out on LP CPU (reads as zero, writes ignored). Hence, it is not preserved across G=>LP=>G switch by CPU save/restore code, but SMP bit is restored correctly. Synchronize these two bits here after LP=>G transition. Note that only CPU0 core is powered on before and after the switch. See also bug 807595. */ __asm__("mrc p15, 0, %0, c1, c0, 1\n" : "=r" (actlr)); if (actlr & (0x1 << 6)) { actlr |= 0x1; __asm__("mcr p15, 0, %0, c1, c0, 1\n" : : "r" (actlr)); } } static void <API key>(void) { unsigned int max_irq, i; void __iomem *gic_base = IO_ADDRESS(<API key>); /* Reprogram the interrupt affinity because the on the LP CPU, the interrupt distributor affinity regsiters are stubbed out by ARM (reads as zero, writes ignored). So when the LP CPU context save code runs, the affinity registers will read as all zero. This causes all interrupts to be effectively disabled when back on the G CPU because they aren't routable to any CPU. See bug 667720 for details. */ max_irq = readl(gic_base + GIC_DIST_CTR) & 0x1f; max_irq = (max_irq + 1) * 32; for (i = 32; i < max_irq; i += 4) { u32 val = 0x01010101; #ifdef <API key> unsigned int irq; for (irq = i; irq < (i + 4); irq++) { struct cpumask mask; struct irq_desc *desc = irq_to_desc(irq); if (desc && desc->affinity_hint && desc->irq_data.affinity) { if (cpumask_and(&mask, desc->affinity_hint, desc->irq_data.affinity)) val |= (*cpumask_bits(&mask) & 0xff) << ((irq & 3) * 8); } } #endif writel(val, gic_base + GIC_DIST_TARGET + i * 4 / 4); } } void <API key>(unsigned int flags) { u32 reg; /* Make sure the switch and immediate flags are cleared in the flow controller to prevent undesirable side-effects for future users of the flow controller. */ reg = readl(FLOW_CTRL_CPU_CSR(0)); reg &= ~(<API key> | <API key>); writel(reg, FLOW_CTRL_CPU_CSR(0)); /* Perform post-switch LP=>G clean-up */ if (!is_lp_cluster()) { <API key>(); <API key>(); } #if <API key> { /* FIXME: clock functions below are taking mutex */ struct clk *c = <API key>( is_lp_cluster() ? "cpu_lp" : "cpu_g"); DEBUG_CLUSTER(("%s: %s freq %lu\r\n", __func__, is_lp_cluster() ? "LP" : "G", clk_get_rate(c))); } #endif } int <API key>(unsigned int us, unsigned int flags) { static ktime_t last_g2lp; unsigned int target_cluster = flags & <API key>; unsigned int current_cluster = is_lp_cluster() ? <API key> : <API key>; unsigned long irq_flags; if ((target_cluster == <API key>) || !target_cluster) return -EINVAL; if (num_online_cpus() > 1) return -EBUSY; if ((current_cluster == target_cluster) && !(flags & <API key>)) return -EEXIST; if (target_cluster == <API key>) if (!<API key>()) return -EPERM; trace_power_start(POWER_PSTATE, target_cluster, 0); if (flags & <API key>) us = 0; DEBUG_CLUSTER(("%s(LP%d): %s->%s %s %s %d\r\n", __func__, (flags & <API key>) ? 1 : 2, is_lp_cluster() ? "LP" : "G", (target_cluster == <API key>) ? "G" : "LP", (flags & <API key>) ? "immediate" : "", (flags & <API key>) ? "force" : "", us)); local_irq_save(irq_flags); if (current_cluster != target_cluster && !<API key>) { ktime_t now = ktime_get(); if (target_cluster == <API key>) { s64 t = ktime_to_us(ktime_sub(now, last_g2lp)); s64 t_off = <API key>(); if (t_off > t) udelay((unsigned int)(t_off - t)); tegra_dvfs_rail_on(tegra_cpu_rail, now); } else { last_g2lp = now; tegra_dvfs_rail_off(tegra_cpu_rail, now); } } if (flags & <API key>) { if (us) <API key>(us); <API key>(flags); tegra_suspend_dram(TEGRA_SUSPEND_LP1, flags); <API key>(flags); if (us) <API key>(0); } else { <API key>(0); cpu_pm_enter(); tegra_idle_lp2_last(0, flags); cpu_pm_exit(); <API key>(0); } local_irq_restore(irq_flags); DEBUG_CLUSTER(("%s: %s\r\n", __func__, is_lp_cluster() ? "LP" : "G")); return 0; } #endif #ifdef CONFIG_PM_SLEEP void <API key>(void) { /* Since memory frequency after LP0 is restored to boot rate mc timing is saved during init, not on entry to LP0. Keep this hook just in case, anyway */ } void tegra_lp0_resume_mc(void) { <API key>(); } void tegra_exit_lp_mode(void) { unsigned int flags; printk("tegra_exit_lp_mod+\n"); if (is_lp_cluster()) { flags = <API key>; flags |= <API key>; <API key>(0, flags); } printk("tegra_exit_lp_mod-\n"); } void tegra_enter_lp_mode(void) { unsigned int flags; printk("tegra_enter_lp_mod+\n"); if (!is_lp_cluster()) { flags = <API key>; flags |= <API key>; <API key>(0, flags); } printk("tegra_enter_lp_mod-\n"); } void tegra_lp0_cpu_mode(bool enter) { static bool entered_on_g = false; unsigned int flags; if (enter) entered_on_g = !is_lp_cluster(); if (entered_on_g) { flags = enter ? <API key> : <API key>; flags |= <API key>; <API key>(0, flags); } } #endif
#include <rtthread.h> #include <sep4020.h> /** * @addtogroup S3C24X0 */ /** * This function will initialize thread stack * * @param tentry the entry of thread * @param parameter the parameter of entry * @param stack_addr the beginning stack address * @param texit the function will be called when thread exit * * @return stack address */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit) { rt_uint32_t *stk; stack_addr += sizeof(rt_uint32_t); stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8); stk = (rt_uint32_t *)stack_addr; *(--stk) = (rt_uint32_t)tentry; /* entry point */ *(--stk) = (rt_uint32_t)texit; *(--stk) = 0xdeadbeef; /* r12 */ *(--stk) = 0xdeadbeef; /* r11 */ *(--stk) = 0xdeadbeef; /* r10 */ *(--stk) = 0xdeadbeef; *(--stk) = 0xdeadbeef; *(--stk) = 0xdeadbeef; *(--stk) = 0xdeadbeef; *(--stk) = 0xdeadbeef; *(--stk) = 0xdeadbeef; *(--stk) = 0xdeadbeef; *(--stk) = 0xdeadbeef; *(--stk) = 0xdeadbeef; *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ *(--stk) = Mode_SVC; /* cpsr */ *(--stk) = Mode_SVC; /* spsr */ /* return task's current stack address */ return (rt_uint8_t *)stk; }
// I18N constants // LANG: "pl", ENCODING: UTF-8 // translated: Krzysztof Kotowicz koto@webworkers.pl { "Align": "Wyrównanie", "All four sides": "Wszystkie 4 strony", "Background": "Tło", "Baseline": "Linia bazowa", "Border": "Ramka", "Borders": "Ramki", "Bottom": "Dół", "Style [CSS]": "Styl [CSS]", "CSS Style": "Styl CSS", "Caption": "Podpis", "Cell Properties": "Właściwości komórki", "Center": "Środek", "Char": "Znak", "Collapsed borders": "Ramki skolapsowane", "Color": "Kolor", "Description": "Opis", "FG Color": "Kolor czcionek", "Float": "Opływanie", "Frames": "Ramki zewn.", "Frame and borders": "Obramowania", "Height": "Wysokość", "How many columns would you like to merge?": "Ile kolumn chcesz scalić?", "How many rows would you like to merge?": "Ile wierszy chcesz scalić?", "Image URL": "URL obrazka", "Justify": "Wyjustuj", "Layout": "Layout", "Left": "Lewo", "Margin": "Margines", "Middle": "Środek", "No rules": "Bez wewnętrzych", "No sides": "Bez ramek", "None": "Brak", "Padding": "Wcięcia", "Please click into some cell": "Kliknij w jakąś komórkę", "Right": "Prawo", "Row Properties": "Właściwości wiersza", "Rules will appear between all rows and columns": "Linie będą widoczne pomiędzy kolumnami i wierszami", "Rules will appear between columns only": "Linie będą widoczne tylko pomiędzy kolumnami", "Rules will appear between rows only": "Linie będą widoczne tylko pomiędzy wierszami", "Rules": "Linie wewn.", "Spacing and padding": "Spacjowanie", "Spacing": "Odstęp", "Summary": "Podsumowanie", "Delete cell": "Usuń komórkę", "Insert cell after": "Wstaw komórkę po", "Insert cell before": "Wstaw komórkę przed", "Merge cells": "Scal komórki", "Cell properties": "Właściwości komórki", "Split cell": "Rozdziel komórkę", "Delete column": "Usuń kolumnę", "Insert column after": "Wstaw kolumnę po", "Insert column before": "Wstaw kolumnę przed", "Split column": "Rozdziel kolumnę", "Delete row": "Usuń wiersz", "Insert row before": "Wstaw wiersz przed", "Insert row after": "Wstaw wiersz po", "Row properties": "Właściwości wiersza", "Split row": "Rozdziel wiersz", "Table properties": "Właściwości tabeli", "Table Properties": "Właściwości tabeli", "Text align": "Wyr. w poziomie", "The bottom side only": "Tylko dolna linia", "The left-hand side only": "Tylko lewa linia", "The right and left sides only": "Lewa i prawa linia", "The right-hand side only": "Tylko prawa linia", "The top and bottom sides only": "Górna i dolna linia", "The top side only": "Tylko górna linia", "Top": "Góra", "Unset color": "Usuń kolor", "Vertical align": "Wyr. w pionie", "Width": "Szerokość", "HTMLArea cowardly refuses to delete the last cell in row.": "Nie możesz skasować ostatniej komórki w wierszu.", "HTMLArea cowardly refuses to delete the last column in table.": "Nie możesz skasować ostatniej kolumny w tabeli.", "HTMLArea cowardly refuses to delete the last row in table.": "Nie możesz skasować ostatniego wiersza w tabeli.", "percent": "%", "pixels": "pikseli", "OK": "OK", "Cancel": "Anuluj" };
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ #include <unistd.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <stdlib.h> #ifdef HAVE_SELINUX #include <selinux/selinux.h> #endif #include "selinux-setup.h" #include "selinux-util.h" #include "label.h" #include "mount-setup.h" #include "macro.h" #include "util.h" #include "log.h" #ifdef HAVE_SELINUX static int null_log(int type, const char *fmt, ...) { return 0; } #endif int selinux_setup(bool *loaded_policy) { #ifdef HAVE_SELINUX int enforce = 0; usec_t before_load, after_load; security_context_t con; int r; union selinux_callback cb; bool initialized = false; assert(loaded_policy); /* Turn off all of SELinux' own logging, we want to do that */ cb.func_log = null_log; <API key>(SELINUX_CB_LOG, cb); /* Don't load policy in the initrd if we don't appear to have * it. For the real root, we check below if we've already * loaded policy, and return gracefully. */ if (in_initrd() && access(selinux_path(), F_OK) < 0) return 0; /* Already initialized by somebody else? */ r = getcon_raw(&con); if (r == 0) { initialized = !streq(con, "kernel"); freecon(con); } /* Make sure we have no fds open while loading the policy and * transitioning */ log_close(); /* Now load the policy */ before_load = now(CLOCK_MONOTONIC); r = <API key>(&enforce); if (r == 0) { char timespan[FORMAT_TIMESPAN_MAX]; char *label; retest_selinux(); /* Transition to the new context */ r = <API key>(SYSTEMD_BINARY_PATH, &label); if (r < 0 || label == NULL) { log_open(); log_error("Failed to compute init label, ignoring."); } else { r = setcon(label); log_open(); if (r < 0) log_error("Failed to transition into init label '%s', ignoring.", label); label_free(label); } after_load = now(CLOCK_MONOTONIC); log_info("Successfully loaded SELinux policy in %s.", format_timespan(timespan, sizeof(timespan), after_load - before_load, 0)); *loaded_policy = true; } else { log_open(); if (enforce > 0) { if (!initialized) { log_error("Failed to load SELinux policy. Freezing."); return -EIO; } log_warning("Failed to load new SELinux policy. Continuing with old policy."); } else log_debug("Unable to load SELinux policy. Ignoring."); } #endif return 0; }
<?php /** * Require the XPath implementation. */ require_once 'Auth/Yadis/XML.php'; /** * This match mode means a given service must match ALL filters passed * to the Auth_Yadis_XRDS::services() call. */ define('<API key>', 101); /** * This match mode means a given service must match ANY filters (at * least one) passed to the Auth_Yadis_XRDS::services() call. */ define('<API key>', 102); /** * The priority value used for service elements with no priority * specified. */ define('<API key>', pow(2, 30)); /** * XRD XML namespace */ define('<API key>, 'xri://$xrd*($v*2.0)'); /** * XRDS XML namespace */ define('<API key>, 'xri://$xrds'); function Auth_Yadis_getNSMap() { return array('xrds' => <API key>, 'xrd' => <API key>); } /** * @access private */ function <API key>($arr) { $result = array(); while (count($arr)) { $index = array_rand($arr, 1); $result[] = $arr[$index]; unset($arr[$index]); } return $result; } /** * This class represents a <Service> element in an XRDS document. * Objects of this type are returned by * Auth_Yadis_XRDS::services() and * Auth_Yadis_Yadis::services(). Each object corresponds directly * to a <Service> element in the XRDS and supplies a * getElements($name) method which you should use to inspect the * element's contents. See {@link Auth_Yadis_Yadis} for more * information on the role this class plays in Yadis discovery. * * @package OpenID */ class Auth_Yadis_Service { /** * Creates an empty service object. */ function Auth_Yadis_Service() { $this->element = null; $this->parser = null; } /** * Return the URIs in the "Type" elements, if any, of this Service * element. * * @return array $type_uris An array of Type URI strings. */ function getTypes() { $t = array(); foreach ($this->getElements('xrd:Type') as $elem) { $c = $this->parser->content($elem); if ($c) { $t[] = $c; } } return $t; } function matchTypes($type_uris) { $result = array(); foreach ($this->getTypes() as $typ) { if (in_array($typ, $type_uris)) { $result[] = $typ; } } return $result; } /** * Return the URIs in the "URI" elements, if any, of this Service * element. The URIs are returned sorted in priority order. * * @return array $uris An array of URI strings. */ function getURIs() { $uris = array(); $last = array(); foreach ($this->getElements('xrd:URI') as $elem) { $uri_string = $this->parser->content($elem); $attrs = $this->parser->attributes($elem); if ($attrs && array_key_exists('priority', $attrs)) { $priority = intval($attrs['priority']); if (!array_key_exists($priority, $uris)) { $uris[$priority] = array(); } $uris[$priority][] = $uri_string; } else { $last[] = $uri_string; } } $keys = array_keys($uris); sort($keys); // Rebuild array of URIs. $result = array(); foreach ($keys as $k) { $new_uris = <API key>($uris[$k]); $result = array_merge($result, $new_uris); } $result = array_merge($result, <API key>($last)); return $result; } /** * Returns the "priority" attribute value of this <Service> * element, if the attribute is present. Returns null if not. * * @return mixed $result Null or integer, depending on whether * this Service element has a 'priority' attribute. */ function getPriority() { $attributes = $this->parser->attributes($this->element); if (array_key_exists('priority', $attributes)) { return intval($attributes['priority']); } return null; } /** * Used to get XML elements from this object's <Service> element. * * This is what you should use to get all custom information out * of this element. This is used by service filter functions to * determine whether a service element contains specific tags, * etc. NOTE: this only considers elements which are direct * children of the <Service> element for this object. * * @param string $name The name of the element to look for * @return array $list An array of elements with the specified * name which are direct children of the <Service> element. The * nodes returned by this function can be passed to $this->parser * methods (see {@link <API key>}). */ function getElements($name) { return $this->parser->evalXPath($name, $this->element); } } /* * Return the expiration date of this XRD element, or None if no * expiration was specified. * * @param $default The value to use as the expiration if no expiration * was specified in the XRD. */ function <API key>($xrd_element, $default=null) { $expires_element = $xrd_element->$parser->evalXPath('/xrd:Expires'); if ($expires_element === null) { return $default; } else { $expires_string = $expires_element->text; // Will raise ValueError if the string is not the expected // format $t = strptime($expires_string, "%Y-%m-%dT%H:%M:%SZ"); if ($t === false) { return false; } // [int $hour [, int $minute [, int $second [, // int $month [, int $day [, int $year ]]]]]] return mktime($t['tm_hour'], $t['tm_min'], $t['tm_sec'], $t['tm_mon'], $t['tm_day'], $t['tm_year']); } } /** * This class performs parsing of XRDS documents. * * You should not instantiate this class directly; rather, call * parseXRDS statically: * * <pre> $xrds = Auth_Yadis_XRDS::parseXRDS($xml_string);</pre> * * If the XRDS can be parsed and is valid, an instance of * Auth_Yadis_XRDS will be returned. Otherwise, null will be * returned. This class is used by the Auth_Yadis_Yadis::discover * method. * * @package OpenID */ class Auth_Yadis_XRDS { /** * Instantiate a Auth_Yadis_XRDS object. Requires an XPath * instance which has been used to parse a valid XRDS document. */ function Auth_Yadis_XRDS(&$xmlParser, &$xrdNodes) { $this->parser =& $xmlParser; $this->xrdNode = $xrdNodes[count($xrdNodes) - 1]; $this->allXrdNodes =& $xrdNodes; $this->serviceList = array(); $this->_parse(); } /** * Parse an XML string (XRDS document) and return either a * Auth_Yadis_XRDS object or null, depending on whether the * XRDS XML is valid. * * @param string $xml_string An XRDS XML string. * @return mixed $xrds An instance of Auth_Yadis_XRDS or null, * depending on the validity of $xml_string */ function &parseXRDS($xml_string, $extra_ns_map = null) { $_null = null; if (!$xml_string) { return $_null; } $parser = <API key>(); $ns_map = Auth_Yadis_getNSMap(); if ($extra_ns_map && is_array($extra_ns_map)) { $ns_map = array_merge($ns_map, $extra_ns_map); } if (!($parser && $parser->init($xml_string, $ns_map))) { return $_null; } // Try to get root element. $root = $parser->evalXPath('/xrds:XRDS[1]'); if (!$root) { return $_null; } if (is_array($root)) { $root = $root[0]; } $attrs = $parser->attributes($root); if (array_key_exists('xmlns:xrd', $attrs) && $attrs['xmlns:xrd'] != <API key>) { return $_null; } else if (array_key_exists('xmlns', $attrs) && preg_match('/xri/', $attrs['xmlns']) && $attrs['xmlns'] != <API key>) { return $_null; } // Get the last XRD node. $xrd_nodes = $parser->evalXPath('/xrds:XRDS[1]/xrd:XRD'); if (!$xrd_nodes) { return $_null; } $xrds = new Auth_Yadis_XRDS($parser, $xrd_nodes); return $xrds; } /** * @access private */ function _addService($priority, $service) { $priority = intval($priority); if (!array_key_exists($priority, $this->serviceList)) { $this->serviceList[$priority] = array(); } $this->serviceList[$priority][] = $service; } /** * Creates the service list using nodes from the XRDS XML * document. * * @access private */ function _parse() { $this->serviceList = array(); $services = $this->parser->evalXPath('xrd:Service', $this->xrdNode); foreach ($services as $node) { $s = new Auth_Yadis_Service(); $s->element = $node; $s->parser =& $this->parser; $priority = $s->getPriority(); if ($priority === null) { $priority = <API key>; } $this->_addService($priority, $s); } } /** * Returns a list of service objects which correspond to <Service> * elements in the XRDS XML document for this object. * * Optionally, an array of filter callbacks may be given to limit * the list of returned service objects. Furthermore, the default * mode is to return all service objects which match ANY of the * specified filters, but $filter_mode may be * <API key> if you want to be sure that the * returned services match all the given filters. See {@link * Auth_Yadis_Yadis} for detailed usage information on filter * functions. * * @param mixed $filters An array of callbacks to filter the * returned services, or null if all services are to be returned. * @param integer $filter_mode <API key> or * <API key>, depending on whether the returned * services should match ALL or ANY of the specified filters, * respectively. * @return mixed $services An array of {@link * Auth_Yadis_Service} objects if $filter_mode is a valid * mode; null if $filter_mode is an invalid mode (i.e., not * <API key> or <API key>). */ function services($filters = null, $filter_mode = <API key>) { $pri_keys = array_keys($this->serviceList); sort($pri_keys, SORT_NUMERIC); // If no filters are specified, return the entire service // list, ordered by priority. if (!$filters || (!is_array($filters))) { $result = array(); foreach ($pri_keys as $pri) { $result = array_merge($result, $this->serviceList[$pri]); } return $result; } // If a bad filter mode is specified, return null. if (!in_array($filter_mode, array(<API key>, <API key>))) { return null; } // Otherwise, use the callbacks in the filter list to // determine which services are returned. $filtered = array(); foreach ($pri_keys as $priority_value) { $service_obj_list = $this->serviceList[$priority_value]; foreach ($service_obj_list as $service) { $matches = 0; foreach ($filters as $filter) { if (<API key>($filter, array($service))) { $matches++; if ($filter_mode == <API key>) { $pri = $service->getPriority(); if ($pri === null) { $pri = <API key>; } if (!array_key_exists($pri, $filtered)) { $filtered[$pri] = array(); } $filtered[$pri][] = $service; break; } } } if (($filter_mode == <API key>) && ($matches == count($filters))) { $pri = $service->getPriority(); if ($pri === null) { $pri = <API key>; } if (!array_key_exists($pri, $filtered)) { $filtered[$pri] = array(); } $filtered[$pri][] = $service; } } } $pri_keys = array_keys($filtered); sort($pri_keys, SORT_NUMERIC); $result = array(); foreach ($pri_keys as $pri) { $result = array_merge($result, $filtered[$pri]); } return $result; } } ?>
package org.graalvm.compiler.nodes; import java.util.List; import org.graalvm.compiler.graph.NodeClass; import jdk.vm.ci.meta.Assumptions; import jdk.vm.ci.meta.ResolvedJavaMethod; /** * A {@link StructuredGraph} encoded in a compact binary representation as a byte[] array. See * {@link GraphEncoder} for a description of the encoding format. Use {@link GraphDecoder} for * decoding. */ public class EncodedGraph { private final byte[] encoding; private final long startOffset; private final Object[] objects; private final NodeClass<?>[] types; private final Assumptions assumptions; private final List<ResolvedJavaMethod> inlinedMethods; /** * The "table of contents" of the encoded graph, i.e., the mapping from orderId numbers to the * offset in the encoded byte[] array. Used as a cache during decoding. */ protected long[] nodeStartOffsets; public EncodedGraph(byte[] encoding, long startOffset, Object[] objects, NodeClass<?>[] types, Assumptions assumptions, List<ResolvedJavaMethod> inlinedMethods) { this.encoding = encoding; this.startOffset = startOffset; this.objects = objects; this.types = types; this.assumptions = assumptions; this.inlinedMethods = inlinedMethods; } public byte[] getEncoding() { return encoding; } public long getStartOffset() { return startOffset; } public Object[] getObjects() { return objects; } public NodeClass<?>[] getNodeClasses() { return types; } public Assumptions getAssumptions() { return assumptions; } public List<ResolvedJavaMethod> getInlinedMethods() { return inlinedMethods; } }
// MessagePack for C++ static resolution routine #ifndef <API key> #define <API key> #include "msgpack/versioning.hpp" #include "msgpack/adaptor/adaptor_base.hpp" namespace msgpack { @cond <API key>(v1) { @endcond namespace type { struct nil_t { }; #if !defined(<API key>) typedef nil_t nil; #endif // !defined(<API key>) inline bool operator<(nil_t const& lhs, nil_t const& rhs) { return &lhs < &rhs; } inline bool operator==(nil_t const& lhs, nil_t const& rhs) { return &lhs == &rhs; } } // namespace type namespace adaptor { template <> struct convert<type::nil_t> { msgpack::object const& operator()(msgpack::object const& o, type::nil_t&) const { if(o.type != msgpack::type::NIL) { throw msgpack::type_error(); } return o; } }; template <> struct pack<type::nil_t> { template <typename Stream> msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const type::nil_t&) const { o.pack_nil(); return o; } }; template <> struct object<type::nil_t> { void operator()(msgpack::object& o, type::nil_t) const { o.type = msgpack::type::NIL; } }; template <> struct object_with_zone<type::nil_t> { void operator()(msgpack::object::with_zone& o, type::nil_t v) const { static_cast<msgpack::object&>(o) << v; } }; } // namespace adaptor template <> inline void msgpack::object::as<void>() const { msgpack::type::nil_t v; convert(v); } @cond } // <API key>(v1) @endcond } // namespace msgpack #endif // <API key>
#include "types.h" #include "file.h" #include "utils/endian.h" #include "netplay.h" #include "fceu.h" #include "state.h" #include "cheat.h" #include "input.h" #include "driver.h" #include "utils/memory.h" #include <cstdio> #include <cstdlib> #include <cstring> #include <sys/types.h> #include <sys/stat.h> //#include <unistd.h> //mbg merge 7/17/06 removed #include <zlib.h> int FCEUnetplay=0; static uint8 netjoy[4]; // Controller cache. static int numlocal; static int netdivisor; static int netdcount; //NetError should only be called after a FCEUD_*Data function returned 0, in the function //that called FCEUD_*Data, to prevent it from being called twice. static void NetError(void) { FCEU_DispMessage("Network error/connection lost!",0); FCEUD_NetworkClose(); } void FCEUI_NetplayStop(void) { if(FCEUnetplay) { FCEUnetplay = 0; <API key>(0,1); //Don't save netplay cheats. FCEU_LoadGameCheats(0); //Reload our original cheats. } else puts("Check your code!"); } int FCEUI_NetplayStart(int nlocal, int divisor) { <API key>(0, 0); //Save our pre-netplay cheats. FCEU_LoadGameCheats(0); // Load them again, for pre-multiplayer action. FCEUnetplay = 1; memset(netjoy,0,sizeof(netjoy)); numlocal = nlocal; netdivisor = divisor; netdcount = 0; return(1); } int FCEUNET_SendCommand(uint8 cmd, uint32 len) { //mbg merge 7/17/06 changed to alloca //uint8 buf[numlocal + 1 + 4]; uint8 *buf = (uint8*)alloca(numlocal+1+4); buf[0] = 0xFF; FCEU_en32lsb(&buf[numlocal], len); buf[numlocal + 4] = cmd; if(!FCEUD_SendData(buf,numlocal + 1 + 4)) { NetError(); return(0); } return(1); } void FCEUI_NetplayText(uint8 *text) { uint32 len; len = strlen((char*)text); //mbg merge 7/17/06 added cast if(!FCEUNET_SendCommand(FCEUNPCMD_TEXT,len)) return; if(!FCEUD_SendData(text,len)) NetError(); } int FCEUNET_SendFile(uint8 cmd, char *fn) { uint32 len; uLongf clen; char *buf, *cbuf; FILE *fp; struct stat sb; if(!(fp=FCEUD_UTF8fopen(fn,"rb"))) return(0); fstat(fileno(fp),&sb); len = sb.st_size; buf = (char*)FCEU_dmalloc(len); //mbg merge 7/17/06 added cast fread(buf, 1, len, fp); fclose(fp); cbuf = (char*)FCEU_dmalloc(4 + len + len / 1000 + 12); //mbg merge 7/17/06 added cast FCEU_en32lsb((uint8*)cbuf, len); //mbg merge 7/17/06 added cast compress2((uint8*)cbuf + 4, &clen, (uint8*)buf, len, 7); //mbg merge 7/17/06 added casts free(buf); //printf("Sending file: %s, %d, %d\n",fn,len,clen); len = clen + 4; if(!FCEUNET_SendCommand(cmd,len)) { free(cbuf); return(0); } if(!FCEUD_SendData(cbuf, len)) { NetError(); free(cbuf); return(0); } free(cbuf); return(1); } static FILE *FetchFile(uint32 remlen) { uint32 clen = remlen; char *cbuf; uLongf len; char *buf; FILE *fp; if(clen > 500000) // Sanity check { NetError(); return(0); } //printf("Receiving file: %d...\n",clen); if((fp = tmpfile())) { cbuf = (char *)FCEU_dmalloc(clen); //mbg merge 7/17/06 added cast if(!FCEUD_RecvData(cbuf, clen)) { NetError(); fclose(fp); free(cbuf); return(0); } len = FCEU_de32lsb((uint8*)cbuf); //mbg merge 7/17/06 added cast if(len > 500000) // Another sanity check { NetError(); fclose(fp); free(cbuf); return(0); } buf = (char *)FCEU_dmalloc(len); //mbg merge 7/17/06 added cast uncompress((uint8*)buf, &len, (uint8*)cbuf + 4, clen - 4); //mbg merge 7/17/06 added casts fwrite(buf, 1, len, fp); free(buf); fseek(fp, 0, SEEK_SET); return(fp); } return(0); } void NetplayUpdate(uint8 *joyp) { static uint8 buf[5]; /* 4 play states, + command/extra byte */ static uint8 joypb[4]; memcpy(joypb,joyp,4); /* This shouldn't happen, but just in case. 0xFF is used as a command escape elsewhere. */ if(joypb[0] == 0xFF) joypb[0] = 0xF; if(!netdcount) if(!FCEUD_SendData(joypb,numlocal)) { NetError(); return; } if(!netdcount) { do { if(!FCEUD_RecvData(buf,5)) { NetError(); return; } switch(buf[4]) { default: <API key>(buf[4]);break; case FCEUNPCMD_TEXT: { uint8 *tbuf; uint32 len = FCEU_de32lsb(buf); if(len > 100000) // Insanity check! { NetError(); return; } tbuf = (uint8*)malloc(len + 1); //mbg merge 7/17/06 added cast tbuf[len] = 0; if(!FCEUD_RecvData(tbuf, len)) { NetError(); free(tbuf); return; } FCEUD_NetplayText(tbuf); free(tbuf); } break; case FCEUNPCMD_SAVESTATE: { //mbg todo netplay //char *fn; //FILE *fp; /Send the cheats first, then the save state, since /there might be a frame or two in between the two sendfile /commands on the server side. //fn = strdup(FCEU_MakeFName(FCEUMKF_CHEAT,0,0).c_str()); /why?????? /if(! // FCEUNET_SendFile(<API key>,fn); / { / free(fn); / return; / } //free(fn); //if(!FCEUnetplay) return; //fn = strdup(FCEU_MakeFName(FCEUMKF_NPTEMP,0,0).c_str()); //fp = fopen(fn, "wb"); //if(FCEUSS_SaveFP(fp,Z_BEST_COMPRESSION)) // fclose(fp); // if(!FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn)) // unlink(fn); // free(fn); // return; // unlink(fn); // free(fn); //else // fclose(fp); // FCEUD_PrintError("File error. (K)ill, (M)aim, (D)estroy? Now!"); // unlink(fn); // free(fn); // return; } break; case <API key>: { FILE *fp = FetchFile(FCEU_de32lsb(buf)); if(!fp) return; <API key>(0,1); FCEU_LoadGameCheats(fp); } break; //mbg 6/16/08 - netplay doesnt work right now anyway /*case FCEUNPCMD_LOADSTATE: { FILE *fp = FetchFile(FCEU_de32lsb(buf)); if(!fp) return; if(FCEUSS_LoadFP(fp,SSLOADPARAM_BACKUP)) { fclose(fp); FCEU_DispMessage("Remote state loaded.",0); } else FCEUD_PrintError("File error. (K)ill, (M)aim, (D)estroy?"); } break;*/ } } while(buf[4]); netdcount=(netdcount+1)%netdivisor; memcpy(netjoy,buf,4); *(uint32 *)joyp=*(uint32 *)netjoy; } }
#ifndef _LINUX_SEQ_FILE_H #define _LINUX_SEQ_FILE_H #include <linux/types.h> #include <linux/string.h> #include <linux/bug.h> #include <linux/mutex.h> #include <linux/cpumask.h> #include <linux/nodemask.h> struct seq_operations; struct file; struct path; struct inode; struct dentry; struct user_namespace; struct seq_file { char *buf; size_t size; size_t from; size_t count; size_t pad_until; loff_t index; loff_t read_pos; u64 version; struct mutex lock; const struct seq_operations *op; int poll_event; #ifdef <API key> u64 exec_id; #endif #ifdef CONFIG_USER_NS struct user_namespace *user_ns; #endif void *private; }; struct seq_operations { void * (*start) (struct seq_file *m, loff_t *pos); void (*stop) (struct seq_file *m, void *v); void * (*next) (struct seq_file *m, void *v, loff_t *pos); int (*show) (struct seq_file *m, void *v); }; typedef struct seq_operations __no_const <API key>; #define SEQ_SKIP 1 /** * seq_get_buf - get buffer to write arbitrary data to * @m: the seq_file handle * @bufp: the beginning of the buffer is stored here * * Return the number of bytes available in the buffer, or zero if * there's no space. */ static inline size_t seq_get_buf(struct seq_file *m, char **bufp) { BUG_ON(m->count > m->size); if (m->count < m->size) *bufp = m->buf + m->count; else *bufp = NULL; return m->size - m->count; } /** * seq_commit - commit data to the buffer * @m: the seq_file handle * @num: the number of bytes to commit * * Commit @num bytes of data written to a buffer previously acquired * by seq_buf_get. To signal an error condition, or that the data * didn't fit in the available space, pass a negative @num value. */ static inline void seq_commit(struct seq_file *m, int num) { if (num < 0) { m->count = m->size; } else { BUG_ON(m->count + num > m->size); m->count += num; } } /** * seq_setwidth - set padding width * @m: the seq_file handle * @size: the max number of bytes to pad. * * Call seq_setwidth() for setting max width, then call seq_printf() etc. and * finally call seq_pad() to pad the remaining bytes. */ static inline void seq_setwidth(struct seq_file *m, size_t size) { m->pad_until = m->count + size; } void seq_pad(struct seq_file *m, char c); char *mangle_path(char *s, const char *p, const char *esc); int seq_open(struct file *, const struct seq_operations *); int seq_open_restrict(struct file *, const struct seq_operations *); ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); loff_t seq_lseek(struct file *, loff_t, int); int seq_release(struct inode *, struct file *); int seq_escape(struct seq_file *, const char *, const char *); int seq_putc(struct seq_file *m, char c); int seq_puts(struct seq_file *m, const char *s); int seq_write(struct seq_file *seq, const void *data, size_t len); __printf(2, 3) int seq_printf(struct seq_file *, const char *, ...); __printf(2, 0) int seq_vprintf(struct seq_file *, const char *, va_list args); int seq_path(struct seq_file *, const struct path *, const char *); int seq_dentry(struct seq_file *, struct dentry *, const char *); int seq_path_root(struct seq_file *m, const struct path *path, const struct path *root, const char *esc); int seq_bitmap(struct seq_file *m, const unsigned long *bits, unsigned int nr_bits); static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask) { return seq_bitmap(m, cpumask_bits(mask), nr_cpu_ids); } static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask) { return seq_bitmap(m, mask->bits, MAX_NUMNODES); } int seq_bitmap_list(struct seq_file *m, const unsigned long *bits, unsigned int nr_bits); static inline int seq_cpumask_list(struct seq_file *m, const struct cpumask *mask) { return seq_bitmap_list(m, cpumask_bits(mask), nr_cpu_ids); } static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask) { return seq_bitmap_list(m, mask->bits, MAX_NUMNODES); } int single_open(struct file *, int (*)(struct seq_file *, void *), void *); int <API key>(struct file *, int (*)(struct seq_file *, void *), void *); int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t); int single_release(struct inode *, struct file *); void *__seq_open_private(struct file *, const struct seq_operations *, int); int seq_open_private(struct file *, const struct seq_operations *, int); int seq_release_private(struct inode *, struct file *); int seq_put_decimal_ull(struct seq_file *m, char delimiter, unsigned long long num); int seq_put_decimal_ll(struct seq_file *m, char delimiter, long long num); static inline struct user_namespace *seq_user_ns(struct seq_file *seq) { #ifdef CONFIG_USER_NS return seq->user_ns; #else extern struct user_namespace init_user_ns; return &init_user_ns; #endif } #define SEQ_START_TOKEN ((void *)1) /* * Helpers for iteration over list_head-s in seq_files */ extern struct list_head *seq_list_start(struct list_head *head, loff_t pos); extern struct list_head *seq_list_start_head(struct list_head *head, loff_t pos); extern struct list_head *seq_list_next(void *v, struct list_head *head, loff_t *ppos); /* * Helpers for iteration over hlist_head-s in seq_files */ extern struct hlist_node *seq_hlist_start(struct hlist_head *head, loff_t pos); extern struct hlist_node *<API key>(struct hlist_head *head, loff_t pos); extern struct hlist_node *seq_hlist_next(void *v, struct hlist_head *head, loff_t *ppos); extern struct hlist_node *seq_hlist_start_rcu(struct hlist_head *head, loff_t pos); extern struct hlist_node *<API key>(struct hlist_head *head, loff_t pos); extern struct hlist_node *seq_hlist_next_rcu(void *v, struct hlist_head *head, loff_t *ppos); /* Helpers for iterating over per-cpu hlist_head-s in seq_files */ extern struct hlist_node *<API key>(struct hlist_head __percpu *head, int *cpu, loff_t pos); extern struct hlist_node *<API key>(void *v, struct hlist_head __percpu *head, int *cpu, loff_t *pos); #endif
package net.sf.mzmine.modules.peaklistmethods.peakpicking.deconvolution.savitzkygolay; public final class SGDerivative { /** * This method returns the second smoothed derivative values of an array. * * @param double[] values * @param boolean is first derivative * @param int level of filter (1 - 12) * @return double[] derivative of values */ public static double[] calculateDerivative(double[] values, boolean firstDerivative, int levelOfFilter) { double[] derivative = new double[values.length]; int M = 0; for (int k = 0; k < derivative.length; k++) { // Determine boundaries if (k <= levelOfFilter) M = k; if (k + M > derivative.length - 1) M = derivative.length - (k + 1); // Perform derivative using Savitzky Golay coefficients for (int i = -M; i <= M; i++) { derivative[k] += values[k + i] * getSGCoefficient(M, i, firstDerivative); } // if ((Math.abs(derivative[k])) > maxValueDerivative) // maxValueDerivative = Math.abs(derivative[k]); } return derivative; } /** * This method return the Savitzky-Golay 2nd smoothed derivative coefficient * from an array * * @param M * @param signedC * @return */ private static Double getSGCoefficient(int M, int signedC, boolean firstDerivate) { int C = Math.abs(signedC), sign = 1; if (firstDerivate) { if (signedC < 0) sign = -1; return sign * SGCoefficients.<API key>[M][C]; } else { return SGCoefficients.<API key>[M][C]; } } }
<?php namespace Magento\Tax\Api; use Magento\Framework\Api\FilterBuilder; use Magento\Framework\Api\<API key>; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\WebapiAbstract; use Magento\Webapi\Model\Rest\Config as HttpConstants; class <API key> extends WebapiAbstract { const SERVICE_NAME = "<API key>"; const SERVICE_VERSION = "V1"; const RESOURCE_PATH = "/V1/taxRules"; /** @var \Magento\Tax\Model\Calculation\Rate[] */ private $fixtureTaxRates; /** @var \Magento\Tax\Model\ClassModel[] */ private $fixtureTaxClasses; /** @var \Magento\Tax\Model\Calculation\Rule[] */ private $fixtureTaxRules; /** @var FilterBuilder */ private $filterBuilder; /** @var <API key> */ private $<API key>; /** * Execute per test initialization. */ public function setUp() { $this-><API key> = Bootstrap::getObjectManager()->create( 'Magento\Framework\Api\<API key>' ); $this->filterBuilder = Bootstrap::getObjectManager()->create( 'Magento\Framework\Api\FilterBuilder' ); $objectManager = Bootstrap::getObjectManager(); $this-><API key> = $objectManager->create( 'Magento\Framework\Api\<API key>' ); $this->filterBuilder = $objectManager->create( 'Magento\Framework\Api\FilterBuilder' ); /** Initialize tax classes, tax rates and tax rules defined in fixture Magento/Tax/_files/tax_classes.php */ $this->getFixtureTaxRates(); $this-><API key>(); $this->getFixtureTaxRules(); } public function tearDown() { $taxRules = $this->getFixtureTaxRules(); if (count($taxRules)) { $taxRates = $this->getFixtureTaxRates(); $taxClasses = $this-><API key>(); foreach ($taxRules as $taxRule) { $taxRule->delete(); } foreach ($taxRates as $taxRate) { $taxRate->delete(); } foreach ($taxClasses as $taxClass) { $taxClass->delete(); } } } /** * @<API key> Magento/Tax/_files/tax_classes.php */ public function testDeleteTaxRule() { $fixtureRule = $this->getFixtureTaxRules()[0]; $taxRuleId = $fixtureRule->getId(); $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . "/$taxRuleId", 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'DeleteById', ], ]; $requestData = ['ruleId' => $taxRuleId]; $result = $this->_webApiCall($serviceInfo, $requestData); $this->assertTrue($result); /** Ensure that tax rule was actually removed from DB */ /** @var \Magento\Tax\Model\Calculation\Rule $taxRule */ $taxRate = Bootstrap::getObjectManager()->create('Magento\Tax\Model\Calculation\Rate'); $this->assertNull($taxRate->load($taxRuleId)->getId(), 'Tax rule was not deleted from DB.'); } public function testCreateTaxRule() { $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH, 'httpMethod' => HttpConstants::HTTP_METHOD_POST, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'Save', ], ]; $requestData = [ 'rule' => [ 'code' => 'Test Rule ' . microtime(), 'position' => 10, 'priority' => 5, '<API key>' => [3], '<API key>' => [2], 'tax_rate_ids' => [1, 2], 'calculate_subtotal' => 1, ], ]; $taxRuleData = $this->_webApiCall($serviceInfo, $requestData); $this->assertArrayHasKey('id', $taxRuleData, "Tax rule ID is expected"); $this->assertGreaterThan(0, $taxRuleData['id']); $taxRuleId = $taxRuleData['id']; unset($taxRuleData['id']); $this->assertEquals($requestData['rule'], $taxRuleData, "Tax rule is created with invalid data."); /** Ensure that tax rule was actually created in DB */ /** @var \Magento\Tax\Model\Calculation\Rule $taxRule */ $taxRule = Bootstrap::getObjectManager()->create('Magento\Tax\Model\Calculation\Rule'); $this->assertEquals($taxRuleId, $taxRule->load($taxRuleId)->getId(), 'Tax rule was not created in DB.'); $taxRule->delete(); } public function <API key>() { $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH, 'httpMethod' => HttpConstants::HTTP_METHOD_POST, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'Save', ], ]; $requestData = [ 'rule' => [ 'code' => 'Test Rule ' . microtime(), 'position' => 10, 'priority' => 5, '<API key>' => [2], '<API key>' => [3], 'tax_rate_ids' => [1, 2], 'calculate_subtotal' => 1, ], ]; try { $this->_webApiCall($serviceInfo, $requestData); $this->fail('Did not throw expected InputException'); } catch (\SoapFault $e) { $this->assertContains('No such entity with <API key> = %fieldValue', $e->getMessage()); } catch (\Exception $e) { $this->assertContains('No such entity with <API key> = %fieldValue', $e->getMessage()); } } public function <API key>() { $expectedMessage = '%1 already exists.'; $requestData = [ 'rule' => [ 'code' => 'Test Rule ' . microtime(), 'position' => 10, 'priority' => 5, '<API key>' => [3], '<API key>' => [2], 'tax_rate_ids' => [1, 2], 'calculate_subtotal' => 0, ], ]; $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'Save', ], ]; $newTaxRuleData = $this->_webApiCall($serviceInfo, $requestData); try { $this->_webApiCall($serviceInfo, $requestData); $this->fail('Expected exception was not raised'); } catch (\SoapFault $e) { $this->assertContains( $expectedMessage, $e->getMessage(), 'SoapFault does not contain expected message.' ); } catch (\Exception $e) { $errorObj = $this-><API key>($e); $this->assertEquals($expectedMessage, $errorObj['message']); $this->assertEquals(['Code'], $errorObj['parameters']); } // Clean up the new tax rule so it won't affect other tests /** @var \Magento\Tax\Model\Calculation\Rule $taxRule */ $taxRule = Bootstrap::getObjectManager()->create('Magento\Tax\Model\Calculation\Rule'); $taxRule->load($newTaxRuleData['id']); $taxRule->delete(); } /** * @<API key> Magento/Tax/_files/tax_classes.php */ public function testGetTaxRule() { $fixtureRule = $this->getFixtureTaxRules()[0]; $taxRuleId = $fixtureRule->getId(); $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . "/$taxRuleId", 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'Get', ], ]; $expectedRuleData = [ 'id' => $taxRuleId, 'code' => 'Test Rule Duplicate', 'priority' => '0', 'position' => '0', '<API key>' => array_values(array_unique($fixtureRule-><API key>())), '<API key>' => array_values(array_unique($fixtureRule-><API key>())), 'tax_rate_ids' => array_values(array_unique($fixtureRule->getRates())), 'calculate_subtotal' => false, ]; $requestData = ['ruleId' => $taxRuleId]; $result = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals($expectedRuleData, $result); } /** * @<API key> Magento/Tax/_files/tax_classes.php */ public function <API key>() { // Find rules whose code is 'Test Rule' $filter = $this->filterBuilder->setField('code') ->setValue('Test Rule') ->create(); $this-><API key>->addFilters([$filter]); $fixtureRule = $this->getFixtureTaxRules()[1]; $searchData = $this-><API key>->create()->__toArray(); $requestData = ['searchCriteria' => $searchData]; $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData), 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'GetList', ], ]; /** @var \Magento\Framework\Api\SearchResults $searchResults */ $searchResults = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals(1, $searchResults['total_count']); $expectedRuleData = [ [ 'id' => $fixtureRule->getId(), 'code' => 'Test Rule', 'priority' => 0, 'position' => 0, 'calculate_subtotal' => 0, '<API key>' => array_values(array_unique($fixtureRule-><API key>())), '<API key>' => array_values(array_unique($fixtureRule-><API key>())), 'tax_rate_ids' => array_values(array_unique($fixtureRule->getRates())), ], ]; $this->assertEquals($expectedRuleData, $searchResults['items']); } /** * @<API key> Magento/Tax/_files/tax_classes.php */ public function <API key>() { // Find rules whose code starts with 'Test Rule' $filter = $this->filterBuilder ->setField('code') ->setValue('Test Rule%') ->setConditionType('like') ->create(); $sortFilter = $this->filterBuilder ->setField('position') ->setValue(0) ->create(); $this-><API key>->addFilters([$filter, $sortFilter]); $fixtureRule = $this->getFixtureTaxRules()[1]; $searchData = $this-><API key>->create()->__toArray(); $requestData = ['searchCriteria' => $searchData]; $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData), 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'GetList', ], ]; /** @var \Magento\Framework\Api\SearchResults $searchResults */ $searchResults = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals(2, $searchResults['total_count']); $expectedRuleData = [ [ 'id' => $fixtureRule->getId(), 'code' => 'Test Rule', 'priority' => 0, 'position' => 0, 'calculate_subtotal' => 0, '<API key>' => array_values(array_unique($fixtureRule-><API key>())), '<API key>' => array_values(array_unique($fixtureRule-><API key>())), 'tax_rate_ids' => array_values(array_unique($fixtureRule->getRates())), ], [ 'id' => $this->getFixtureTaxRules()[0]->getId(), 'code' => 'Test Rule Duplicate', 'priority' => 0, 'position' => 0, 'calculate_subtotal' => 0, '<API key>' => array_values(array_unique($fixtureRule-><API key>())), '<API key>' => array_values(array_unique($fixtureRule-><API key>())), 'tax_rate_ids' => array_values(array_unique($fixtureRule->getRates())) ], ]; $this->assertEquals($expectedRuleData, $searchResults['items']); } public function <API key>() { $taxRuleId = 37865; $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . "/$taxRuleId", 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'Get', ], ]; $requestData = ['ruleId' => $taxRuleId]; try { $this->_webApiCall($serviceInfo, $requestData); $this->fail('Expected exception was not raised'); } catch (\Exception $e) { $expectedMessage = 'No such entity with %fieldName = %fieldValue'; $this->assertContains( $expectedMessage, $e->getMessage(), "Exception does not contain expected message." ); } } /** * @<API key> Magento/Tax/_files/tax_classes.php */ public function testUpdateTaxRule() { $fixtureRule = $this->getFixtureTaxRules()[0]; $requestData = [ 'rule' => [ 'id' => $fixtureRule->getId(), 'code' => 'Test Rule ' . microtime(), 'position' => 10, 'priority' => 5, '<API key>' => [3], '<API key>' => [2], 'tax_rate_ids' => [1, 2], 'calculate_subtotal' => 1, ], ]; $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'Save', ], ]; $this->_webApiCall($serviceInfo, $requestData); $expectedRuleData = $requestData['rule']; /** Ensure that tax rule was actually updated in DB */ /** @var \Magento\Tax\Model\Calculation $taxCalculation */ $taxCalculation = Bootstrap::getObjectManager()->create('Magento\Tax\Model\Calculation'); /** @var \Magento\Tax\Model\Calculation\Rule $taxRule */ $taxRule = Bootstrap::getObjectManager()->create( 'Magento\Tax\Model\Calculation\Rule', ['calculation' => $taxCalculation] ); $taxRuleModel = $taxRule->load($fixtureRule->getId()); $this->assertEquals($expectedRuleData['id'], $taxRuleModel->getId(), 'Tax rule was not updated in DB.'); $this->assertEquals( $expectedRuleData['code'], $taxRuleModel->getCode(), 'Tax rule code was updated incorrectly.' ); $this->assertEquals( $expectedRuleData['position'], $taxRuleModel->getPosition(), 'Tax rule sort order was updated incorrectly.' ); $this->assertEquals( $expectedRuleData['priority'], $taxRuleModel->getPriority(), 'Tax rule priority was updated incorrectly.' ); $this->assertEquals( $expectedRuleData['<API key>'], array_values(array_unique($taxRuleModel-><API key>())), 'Customer Tax classes were updated incorrectly' ); $this->assertEquals( $expectedRuleData['<API key>'], array_values(array_unique($taxRuleModel-><API key>())), 'Product Tax classes were updated incorrectly.' ); $this->assertEquals( $expectedRuleData['tax_rate_ids'], array_values(array_unique($taxRuleModel->getRates())), 'Tax rates were updated incorrectly.' ); } public function <API key>() { $requestData = [ 'rule' => [ 'id' => 12345, 'code' => 'Test Rule ' . microtime(), 'position' => 10, 'priority' => 5, '<API key>' => [3], '<API key>' => [2], 'tax_rate_ids' => [1, 2], ], ]; $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'Save', ], ]; try { $this->_webApiCall($serviceInfo, $requestData); $this->fail('Expected exception was not raised'); } catch (\Exception $e) { $expectedMessage = 'No such entity with %fieldName = %fieldValue'; $this->assertContains( $expectedMessage, $e->getMessage(), "Exception does not contain expected message." ); } } /** * @<API key> Magento/Tax/_files/tax_classes.php */ public function testSearchTaxRule() { $fixtureRule = $this->getFixtureTaxRules()[0]; $filter = $this->filterBuilder->setField('code') ->setValue($fixtureRule->getCode()) ->create(); $this-><API key>->addFilters([$filter]); $searchData = $this-><API key>->create()->__toArray(); $requestData = ['searchCriteria' => $searchData]; $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData), 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => [ 'service' => self::SERVICE_NAME, 'serviceVersion' => self::SERVICE_VERSION, 'operation' => self::SERVICE_NAME . 'GetList', ], ]; $searchResults = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals(1, $searchResults['total_count']); $this->assertEquals($fixtureRule->getId(), $searchResults['items'][0]["id"]); $this->assertEquals($fixtureRule->getCode(), $searchResults['items'][0]['code']); } /** * Get tax rates created in Magento\Tax\_files\tax_classes.php * * @return \Magento\Tax\Model\Calculation\Rate[] */ private function getFixtureTaxRates() { if ($this->fixtureTaxRates === null) { $this->fixtureTaxRates = []; if ($this->getFixtureTaxRules()) { $taxRateIds = (array)$this->getFixtureTaxRules()[0]->getRates(); foreach ($taxRateIds as $taxRateId) { /** @var \Magento\Tax\Model\Calculation\Rate $taxRate */ $taxRate = Bootstrap::getObjectManager()->create('Magento\Tax\Model\Calculation\Rate'); $this->fixtureTaxRates[] = $taxRate->load($taxRateId); } } } return $this->fixtureTaxRates; } /** * Get tax classes created in Magento\Tax\_files\tax_classes.php * * @return \Magento\Tax\Model\ClassModel[] */ private function <API key>() { if ($this->fixtureTaxClasses === null) { $this->fixtureTaxClasses = []; if ($this->getFixtureTaxRules()) { $taxClassIds = array_merge( (array)$this->getFixtureTaxRules()[0]-><API key>(), (array)$this->getFixtureTaxRules()[0]-><API key>() ); foreach ($taxClassIds as $taxClassId) { /** @var \Magento\Tax\Model\ClassModel $taxClass */ $taxClass = Bootstrap::getObjectManager()->create('Magento\Tax\Model\ClassModel'); $this->fixtureTaxClasses[] = $taxClass->load($taxClassId); } } } return $this->fixtureTaxClasses; } /** * Get tax rule created in Magento\Tax\_files\tax_classes.php * * @return \Magento\Tax\Model\Calculation\Rule[] */ private function getFixtureTaxRules() { if ($this->fixtureTaxRules === null) { $this->fixtureTaxRules = []; $taxRuleCodes = ['Test Rule Duplicate', 'Test Rule']; foreach ($taxRuleCodes as $taxRuleCode) { /** @var \Magento\Tax\Model\Calculation\Rule $taxRule */ $taxRule = Bootstrap::getObjectManager()->create('Magento\Tax\Model\Calculation\Rule'); $taxRule->load($taxRuleCode, 'code'); if ($taxRule->getId()) { $this->fixtureTaxRules[] = $taxRule; } } } return $this->fixtureTaxRules; } }
int func (int n) { int vla[n], i; for (i = 0; i < n; i++) vla[i] = i; return n; /* vla-filled */ } int main (void) { func (5); return 0; }
#ifndef <API key> #define <API key> #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) #define REG_RTC_READREQ (0x40001402U) /**< \brief (RTC) Read Request */ #define REG_RTC_STATUS (0x4000140AU) /**< \brief (RTC) Status */ #define REG_RTC_DBGCTRL (0x4000140BU) /**< \brief (RTC) Debug Control */ #define REG_RTC_FREQCORR (0x4000140CU) /**< \brief (RTC) Frequency Correction */ #define REG_RTC_MODE0_CTRL (0x40001400U) /**< \brief (RTC) MODE0 Control */ #define <API key> (0x40001404U) /**< \brief (RTC) MODE0 Event Control */ #define <API key> (0x40001406U) /**< \brief (RTC) MODE0 Interrupt Enable Clear */ #define <API key> (0x40001407U) /**< \brief (RTC) MODE0 Interrupt Enable Set */ #define <API key> (0x40001408U) /**< \brief (RTC) MODE0 Interrupt Flag Status and Clear */ #define REG_RTC_MODE0_COUNT (0x40001410U) /**< \brief (RTC) MODE0 Counter Value */ #define REG_RTC_MODE0_COMP0 (0x40001418U) /**< \brief (RTC) MODE0 Compare 0 Value */ #define REG_RTC_MODE1_CTRL (0x40001400U) /**< \brief (RTC) MODE1 Control */ #define <API key> (0x40001404U) /**< \brief (RTC) MODE1 Event Control */ #define <API key> (0x40001406U) /**< \brief (RTC) MODE1 Interrupt Enable Clear */ #define <API key> (0x40001407U) /**< \brief (RTC) MODE1 Interrupt Enable Set */ #define <API key> (0x40001408U) /**< \brief (RTC) MODE1 Interrupt Flag Status and Clear */ #define REG_RTC_MODE1_COUNT (0x40001410U) /**< \brief (RTC) MODE1 Counter Value */ #define REG_RTC_MODE1_PER (0x40001414U) /**< \brief (RTC) MODE1 Counter Period */ #define REG_RTC_MODE1_COMP0 (0x40001418U) /**< \brief (RTC) MODE1 Compare 0 Value */ #define REG_RTC_MODE1_COMP1 (0x4000141AU) /**< \brief (RTC) MODE1 Compare 1 Value */ #define REG_RTC_MODE2_CTRL (0x40001400U) /**< \brief (RTC) MODE2 Control */ #define <API key> (0x40001404U) /**< \brief (RTC) MODE2 Event Control */ #define <API key> (0x40001406U) /**< \brief (RTC) MODE2 Interrupt Enable Clear */ #define <API key> (0x40001407U) /**< \brief (RTC) MODE2 Interrupt Enable Set */ #define <API key> (0x40001408U) /**< \brief (RTC) MODE2 Interrupt Flag Status and Clear */ #define REG_RTC_MODE2_CLOCK (0x40001410U) /**< \brief (RTC) MODE2 Clock Value */ #define <API key> (0x40001418U) /**< \brief (RTC) MODE2_ALARM Alarm 0 Value */ #define <API key> (0x4000141CU) /**< \brief (RTC) MODE2_ALARM Alarm 0 Mask */ #else #define REG_RTC_READREQ (*(RwReg16*)0x40001402U) /**< \brief (RTC) Read Request */ #define REG_RTC_STATUS (*(RwReg8 *)0x4000140AU) /**< \brief (RTC) Status */ #define REG_RTC_DBGCTRL (*(RwReg8 *)0x4000140BU) /**< \brief (RTC) Debug Control */ #define REG_RTC_FREQCORR (*(RwReg8 *)0x4000140CU) /**< \brief (RTC) Frequency Correction */ #define REG_RTC_MODE0_CTRL (*(RwReg16*)0x40001400U) /**< \brief (RTC) MODE0 Control */ #define <API key> (*(RwReg16*)0x40001404U) /**< \brief (RTC) MODE0 Event Control */ #define <API key> (*(RwReg8 *)0x40001406U) /**< \brief (RTC) MODE0 Interrupt Enable Clear */ #define <API key> (*(RwReg8 *)0x40001407U) /**< \brief (RTC) MODE0 Interrupt Enable Set */ #define <API key> (*(RwReg8 *)0x40001408U) /**< \brief (RTC) MODE0 Interrupt Flag Status and Clear */ #define REG_RTC_MODE0_COUNT (*(RwReg *)0x40001410U) /**< \brief (RTC) MODE0 Counter Value */ #define REG_RTC_MODE0_COMP0 (*(RwReg *)0x40001418U) /**< \brief (RTC) MODE0 Compare 0 Value */ #define REG_RTC_MODE1_CTRL (*(RwReg16*)0x40001400U) /**< \brief (RTC) MODE1 Control */ #define <API key> (*(RwReg16*)0x40001404U) /**< \brief (RTC) MODE1 Event Control */ #define <API key> (*(RwReg8 *)0x40001406U) /**< \brief (RTC) MODE1 Interrupt Enable Clear */ #define <API key> (*(RwReg8 *)0x40001407U) /**< \brief (RTC) MODE1 Interrupt Enable Set */ #define <API key> (*(RwReg8 *)0x40001408U) /**< \brief (RTC) MODE1 Interrupt Flag Status and Clear */ #define REG_RTC_MODE1_COUNT (*(RwReg16*)0x40001410U) /**< \brief (RTC) MODE1 Counter Value */ #define REG_RTC_MODE1_PER (*(RwReg16*)0x40001414U) /**< \brief (RTC) MODE1 Counter Period */ #define REG_RTC_MODE1_COMP0 (*(RwReg16*)0x40001418U) /**< \brief (RTC) MODE1 Compare 0 Value */ #define REG_RTC_MODE1_COMP1 (*(RwReg16*)0x4000141AU) /**< \brief (RTC) MODE1 Compare 1 Value */ #define REG_RTC_MODE2_CTRL (*(RwReg16*)0x40001400U) /**< \brief (RTC) MODE2 Control */ #define <API key> (*(RwReg16*)0x40001404U) /**< \brief (RTC) MODE2 Event Control */ #define <API key> (*(RwReg8 *)0x40001406U) /**< \brief (RTC) MODE2 Interrupt Enable Clear */ #define <API key> (*(RwReg8 *)0x40001407U) /**< \brief (RTC) MODE2 Interrupt Enable Set */ #define <API key> (*(RwReg8 *)0x40001408U) /**< \brief (RTC) MODE2 Interrupt Flag Status and Clear */ #define REG_RTC_MODE2_CLOCK (*(RwReg *)0x40001410U) /**< \brief (RTC) MODE2 Clock Value */ #define <API key> (*(RwReg *)0x40001418U) /**< \brief (RTC) MODE2_ALARM Alarm 0 Value */ #define <API key> (*(RwReg *)0x4000141CU) /**< \brief (RTC) MODE2_ALARM Alarm 0 Mask */ #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define RTC_ALARM_NUM 1 // Number of Alarms #define RTC_COMP16_NUM 2 // Number of 16-bit Comparators #define RTC_COMP32_NUM 1 // Number of 32-bit Comparators #define RTC_GCLK_ID 2 // Index of Generic Clock #define RTC_NUM_OF_ALARMS 1 // Number of Alarms (obsolete) #define RTC_NUM_OF_COMP16 2 // Number of 16-bit Comparators (obsolete) #define RTC_NUM_OF_COMP32 1 // Number of 32-bit Comparators (obsolete) #endif /* <API key> */
/* <API key>: GPL-2.0 */ #ifndef <API key> #define <API key> #include <linux/types.h> #include <uapi/asm/cputable.h> #include <asm/asm-const.h> #ifndef __ASSEMBLY__ /* This structure can grow, it's real size is used by head.S code * via the mkdefs mechanism. */ struct cpu_spec; typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); typedef void (*cpu_restore_t)(void); enum <API key> { <API key> = 0, PPC_OPROFILE_RS64 = 1, PPC_OPROFILE_POWER4 = 2, PPC_OPROFILE_G4 = 3, <API key> = 4, PPC_OPROFILE_CELL = 5, PPC_OPROFILE_PA6T = 6, }; enum powerpc_pmc_type { PPC_PMC_DEFAULT = 0, PPC_PMC_IBM = 1, PPC_PMC_PA6T = 2, PPC_PMC_G4 = 3, }; struct pt_regs; extern int <API key>(struct pt_regs *regs); extern int machine_check_4xx(struct pt_regs *regs); extern int machine_check_440A(struct pt_regs *regs); extern int <API key>(struct pt_regs *regs); extern int machine_check_e500(struct pt_regs *regs); extern int machine_check_e200(struct pt_regs *regs); extern int machine_check_47x(struct pt_regs *regs); int machine_check_8xx(struct pt_regs *regs); int machine_check_83xx(struct pt_regs *regs); extern void <API key>(void); extern void <API key>(void); extern void <API key>(void); extern void <API key>(void); /* NOTE WELL: Update identify_cpu() if fields are added or removed! */ struct cpu_spec { /* CPU is matched via (PVR & pvr_mask) == pvr_value */ unsigned int pvr_mask; unsigned int pvr_value; char *cpu_name; unsigned long cpu_features; /* Kernel features */ unsigned int cpu_user_features; /* Userland features */ unsigned int cpu_user_features2; /* Userland features v2 */ unsigned int mmu_features; /* MMU features */ /* cache line sizes */ unsigned int icache_bsize; unsigned int dcache_bsize; /* flush caches inside the current cpu */ void (*cpu_down_flush)(void); /* number of performance monitor counters */ unsigned int num_pmcs; enum powerpc_pmc_type pmc_type; /* this is called to initialize various CPU bits like L1 cache, * BHT, SPD, etc... from head.S before branching to identify_machine */ cpu_setup_t cpu_setup; /* Used to restore cpu setup on secondary processors and at resume */ cpu_restore_t cpu_restore; /* Used by oprofile userspace to select the right counters */ char *oprofile_cpu_type; /* Processor specific oprofile operations */ enum <API key> oprofile_type; /* Bit locations inside the mmcra change */ unsigned long oprofile_mmcra_sihv; unsigned long oprofile_mmcra_sipr; /* Bits to clear during an oprofile exception */ unsigned long <API key>; /* Name of processor class, for the ELF AT_PLATFORM entry */ char *platform; /* Processor specific machine check handling. Return negative * if the error is fatal, 1 if it was fully recovered and 0 to * pass up (not CPU originated) */ int (*machine_check)(struct pt_regs *regs); /* * Processor specific early machine check handler which is * called in real mode to handle SLB and TLB errors. */ long (*machine_check_early)(struct pt_regs *regs); }; extern struct cpu_spec *cur_cpu_spec; extern unsigned int __start___ftr_fixup, __stop___ftr_fixup; extern void set_cur_cpu_spec(struct cpu_spec *s); extern struct cpu_spec *identify_cpu(unsigned long offset, unsigned int pvr); extern void identify_cpu_name(unsigned int pvr); extern void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end); extern const char *<API key>; #ifdef <API key> extern void <API key>(void); #else static inline void <API key>(void) { } #endif #endif /* __ASSEMBLY__ */ /* CPU kernel features */ /* Definitions for features that we have on both 32-bit and 64-bit chips */ #define <API key> ASM_CONST(0x00000001) #define CPU_FTR_ALTIVEC ASM_CONST(0x00000002) #define CPU_FTR_DBELL ASM_CONST(0x00000004) #define CPU_FTR_CAN_NAP ASM_CONST(0x00000008) #define <API key> ASM_CONST(0x00000010) #define <API key> ASM_CONST(0x00000020) #define <API key> ASM_CONST(0x00000040) #define CPU_FTR_LWSYNC ASM_CONST(0x00000080) #define CPU_FTR_NOEXECUTE ASM_CONST(0x00000100) #define CPU_FTR_EMB_HV ASM_CONST(0x00000200) /* Definitions for features that only exist on 32-bit chips */ #ifdef CONFIG_PPC32 #define CPU_FTR_601 ASM_CONST(0x00001000) #define CPU_FTR_L2CR ASM_CONST(0x00002000) #define CPU_FTR_SPEC7450 ASM_CONST(0x00004000) #define CPU_FTR_TAU ASM_CONST(0x00008000) #define CPU_FTR_CAN_DOZE ASM_CONST(0x00010000) #define CPU_FTR_USE_RTC ASM_CONST(0x00020000) #define CPU_FTR_L3CR ASM_CONST(0x00040000) #define <API key> ASM_CONST(0x00080000) #define <API key> ASM_CONST(0x00100000) #define <API key> ASM_CONST(0x00200000) #define CPU_FTR_NO_DPM ASM_CONST(0x00400000) #define CPU_FTR_476_DD2 ASM_CONST(0x00800000) #define <API key> ASM_CONST(0x01000000) #define CPU_FTR_NO_BTIC ASM_CONST(0x02000000) #define CPU_FTR_PPC_LE ASM_CONST(0x04000000) #define <API key> ASM_CONST(0x08000000) #define CPU_FTR_SPE ASM_CONST(0x10000000) #define <API key> ASM_CONST(0x20000000) #define CPU_FTR_INDEXED_DCR ASM_CONST(0x40000000) #else /* CONFIG_PPC32 */ /* Define these to 0 for the sake of tests in common code */ #define CPU_FTR_601 (0) #define CPU_FTR_PPC_LE (0) #endif /* * Definitions for the 64-bit processor unique features; * on 32-bit, make the names available but defined to be 0. */ #ifdef __powerpc64__ #define LONG_ASM_CONST(x) ASM_CONST(x) #else #define LONG_ASM_CONST(x) 0 #endif #define CPU_FTR_REAL_LE LONG_ASM_CONST(0x0000000000001000) #define CPU_FTR_HVMODE LONG_ASM_CONST(0x0000000000002000) #define CPU_FTR_ARCH_206 LONG_ASM_CONST(0x0000000000008000) #define CPU_FTR_ARCH_207S LONG_ASM_CONST(0x0000000000010000) #define CPU_FTR_ARCH_300 LONG_ASM_CONST(0x0000000000020000) #define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000000000040000) #define CPU_FTR_CTRL LONG_ASM_CONST(0x0000000000080000) #define CPU_FTR_SMT LONG_ASM_CONST(0x0000000000100000) #define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000000000200000) #define CPU_FTR_PURR LONG_ASM_CONST(0x0000000000400000) #define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000000000800000) #define CPU_FTR_SPURR LONG_ASM_CONST(0x0000000001000000) #define CPU_FTR_DSCR LONG_ASM_CONST(0x0000000002000000) #define CPU_FTR_VSX LONG_ASM_CONST(0x0000000004000000) #define CPU_FTR_SAO LONG_ASM_CONST(0x0000000008000000) #define <API key> LONG_ASM_CONST(0x0000000010000000) #define <API key> LONG_ASM_CONST(0x0000000020000000) #define CPU_FTR_ASYM_SMT LONG_ASM_CONST(0x0000000040000000) #define <API key> LONG_ASM_CONST(0x0000000080000000) #define CPU_FTR_POPCNTB LONG_ASM_CONST(0x0000000100000000) #define CPU_FTR_POPCNTD LONG_ASM_CONST(0x0000000200000000) #define CPU_FTR_PKEY LONG_ASM_CONST(0x0000000400000000) #define CPU_FTR_VMX_COPY LONG_ASM_CONST(0x0000000800000000) #define CPU_FTR_TM LONG_ASM_CONST(0x0000001000000000) #define CPU_FTR_CFAR LONG_ASM_CONST(0x0000002000000000) #define CPU_FTR_HAS_PPR LONG_ASM_CONST(0x0000004000000000) #define CPU_FTR_DAWR LONG_ASM_CONST(0x0000008000000000) #define CPU_FTR_DABRX LONG_ASM_CONST(0x0000010000000000) #define CPU_FTR_PMAO_BUG LONG_ASM_CONST(0x0000020000000000) #define <API key> LONG_ASM_CONST(0x0000080000000000) #define <API key> LONG_ASM_CONST(0x0000100000000000) #define <API key> LONG_ASM_CONST(0x0000200000000000) #define <API key> LONG_ASM_CONST(0x0000400000000000) #define CPU_FTR_P9_TIDR LONG_ASM_CONST(0x0000800000000000) #define <API key> LONG_ASM_CONST(0x0001000000000000) #ifndef __ASSEMBLY__ #define <API key> (CPU_FTR_NOEXECUTE | <API key>) #define <API key> (MMU_FTR_TLBIEL | MMU_FTR_16M_PAGE) /* We only set the altivec features if the kernel was compiled with altivec * support */ #ifdef CONFIG_ALTIVEC #define <API key> CPU_FTR_ALTIVEC #define <API key> <API key> #else #define <API key> 0 #define <API key> 0 #endif /* We only set the VSX features if the kernel was compiled with VSX * support */ #ifdef CONFIG_VSX #define CPU_FTR_VSX_COMP CPU_FTR_VSX #define <API key> PPC_FEATURE_HAS_VSX #else #define CPU_FTR_VSX_COMP 0 #define <API key> 0 #endif /* We only set the spe features if the kernel was compiled with spe * support */ #ifdef CONFIG_SPE #define CPU_FTR_SPE_COMP CPU_FTR_SPE #define <API key> PPC_FEATURE_HAS_SPE #define <API key> <API key> #define <API key> <API key> #else #define CPU_FTR_SPE_COMP 0 #define <API key> 0 #define <API key> 0 #define <API key> 0 #endif /* We only set the TM feature if the kernel was compiled with TM supprt */ #ifdef <API key> #define CPU_FTR_TM_COMP CPU_FTR_TM #define <API key> PPC_FEATURE2_HTM #define <API key> <API key> #else #define CPU_FTR_TM_COMP 0 #define <API key> 0 #define <API key> 0 #endif /* We need to mark all pages as being coherent if we're SMP or we have a * 74[45]x and an MPC107 host bridge. Also 83xx and PowerQUICC II * require it for PCI "streaming/prefetch" to work properly. * This is also required by 52xx family. */ #if defined(CONFIG_SMP) || defined(<API key>) \ || defined(CONFIG_PPC_83xx) || defined(CONFIG_8260) \ || defined(CONFIG_PPC_MPC52xx) #define CPU_FTR_COMMON <API key> #else #define CPU_FTR_COMMON 0 #endif /* The powersave features NAP & DOZE seems to confuse BDI when debugging. So if a BDI is used, disable theses */ #ifndef CONFIG_BDI_SWITCH #define <API key> CPU_FTR_CAN_DOZE #define <API key> CPU_FTR_CAN_NAP #else #define <API key> 0 #define <API key> 0 #endif #define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | \ <API key> | <API key> | CPU_FTR_USE_RTC) #define CPU_FTRS_603 (CPU_FTR_COMMON | <API key> | \ <API key> | CPU_FTR_PPC_LE) #define CPU_FTRS_604 (CPU_FTR_COMMON | CPU_FTR_PPC_LE) #define CPU_FTRS_740_NOTAU (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | \ <API key> | CPU_FTR_PPC_LE) #define CPU_FTRS_740 (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | \ CPU_FTR_TAU | <API key> | \ CPU_FTR_PPC_LE) #define CPU_FTRS_750 (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | \ CPU_FTR_TAU | <API key> | \ CPU_FTR_PPC_LE) #define CPU_FTRS_750CL (CPU_FTRS_750) #define CPU_FTRS_750FX1 (CPU_FTRS_750 | <API key> | CPU_FTR_NO_DPM) #define CPU_FTRS_750FX2 (CPU_FTRS_750 | CPU_FTR_NO_DPM) #define CPU_FTRS_750FX (CPU_FTRS_750 | <API key>) #define CPU_FTRS_750GX (CPU_FTRS_750FX) #define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | \ <API key> | \ <API key> | CPU_FTR_PPC_LE) #define CPU_FTRS_7400 (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | \ CPU_FTR_TAU | <API key> | \ <API key> | CPU_FTR_PPC_LE) #define CPU_FTRS_7450_20 (CPU_FTR_COMMON | \ CPU_FTR_L2CR | <API key> | \ CPU_FTR_L3CR | CPU_FTR_SPEC7450 | \ <API key> | CPU_FTR_PPC_LE | <API key>) #define CPU_FTRS_7450_21 (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | <API key> | \ CPU_FTR_L3CR | CPU_FTR_SPEC7450 | \ <API key> | <API key> | \ <API key> | CPU_FTR_PPC_LE | <API key>) #define CPU_FTRS_7450_23 (CPU_FTR_COMMON | \ <API key> | \ <API key> | CPU_FTR_L2CR | <API key> | \ CPU_FTR_L3CR | CPU_FTR_SPEC7450 | \ <API key> | <API key> | CPU_FTR_PPC_LE) #define CPU_FTRS_7455_1 (CPU_FTR_COMMON | \ <API key> | \ CPU_FTR_L2CR | <API key> | CPU_FTR_L3CR | \ CPU_FTR_SPEC7450 | <API key> | CPU_FTR_PPC_LE) #define CPU_FTRS_7455_20 (CPU_FTR_COMMON | \ <API key> | \ <API key> | CPU_FTR_L2CR | <API key> | \ CPU_FTR_L3CR | CPU_FTR_SPEC7450 | \ <API key> | <API key> | \ <API key> | CPU_FTR_PPC_LE) #define CPU_FTRS_7455 (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | <API key> | \ CPU_FTR_L3CR | CPU_FTR_SPEC7450 | <API key> | \ <API key> | CPU_FTR_PPC_LE | <API key>) #define CPU_FTRS_7447_10 (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | <API key> | \ CPU_FTR_L3CR | CPU_FTR_SPEC7450 | <API key> | \ <API key> | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE | \ <API key>) #define CPU_FTRS_7447 (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | <API key> | \ CPU_FTR_L3CR | CPU_FTR_SPEC7450 | <API key> | \ <API key> | CPU_FTR_PPC_LE | <API key>) #define CPU_FTRS_7447A (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | <API key> | \ CPU_FTR_SPEC7450 | <API key> | \ <API key> | CPU_FTR_PPC_LE | <API key>) #define CPU_FTRS_7448 (CPU_FTR_COMMON | \ <API key> | CPU_FTR_L2CR | <API key> | \ CPU_FTR_SPEC7450 | <API key> | \ CPU_FTR_PPC_LE | <API key>) #define CPU_FTRS_82XX (CPU_FTR_COMMON | <API key>) #define CPU_FTRS_G2_LE (CPU_FTR_COMMON | <API key> | \ <API key>) #define CPU_FTRS_E300 (<API key> | \ <API key> | \ CPU_FTR_COMMON) #define CPU_FTRS_E300C2 (<API key> | \ <API key> | \ CPU_FTR_COMMON | <API key>) #define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON) #define CPU_FTRS_8XX (CPU_FTR_NOEXECUTE) #define CPU_FTRS_40X (<API key> | CPU_FTR_NOEXECUTE) #define CPU_FTRS_44X (<API key> | CPU_FTR_NOEXECUTE) #define CPU_FTRS_440x6 (<API key> | CPU_FTR_NOEXECUTE | \ CPU_FTR_INDEXED_DCR) #define CPU_FTRS_47X (CPU_FTRS_440x6) #define CPU_FTRS_E200 (CPU_FTR_SPE_COMP | \ <API key> | <API key> | \ <API key> | CPU_FTR_NOEXECUTE | \ <API key>) #define CPU_FTRS_E500 (<API key> | \ CPU_FTR_SPE_COMP | <API key> | <API key> | \ CPU_FTR_NOEXECUTE) #define CPU_FTRS_E500_2 (<API key> | \ CPU_FTR_SPE_COMP | <API key> | \ <API key> | CPU_FTR_NOEXECUTE) #define CPU_FTRS_E500MC (<API key> | \ CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \ CPU_FTR_DBELL | <API key> | CPU_FTR_EMB_HV) /* * e5500/e6500 erratum A-006958 is a timebase bug that can use the * same workaround as CPU_FTR_CELL_TB_BUG. */ #define CPU_FTRS_E5500 (<API key> | \ CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \ CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ <API key> | CPU_FTR_EMB_HV | CPU_FTR_CELL_TB_BUG) #define CPU_FTRS_E6500 (<API key> | \ CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \ CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ <API key> | CPU_FTR_EMB_HV | <API key> | \ CPU_FTR_CELL_TB_BUG | CPU_FTR_SMT) #define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | <API key>) /* 64-bit CPUs */ #define CPU_FTRS_PPC970 (CPU_FTR_LWSYNC | \ <API key> | CPU_FTR_CTRL | \ <API key> | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA | \ <API key> | <API key> | \ CPU_FTR_HVMODE | CPU_FTR_DABRX) #define CPU_FTRS_POWER5 (CPU_FTR_LWSYNC | \ <API key> | CPU_FTR_CTRL | \ CPU_FTR_MMCRA | CPU_FTR_SMT | \ <API key> | CPU_FTR_PURR | \ <API key> | CPU_FTR_POPCNTB | CPU_FTR_DABRX) #define CPU_FTRS_POWER6 (CPU_FTR_LWSYNC | \ <API key> | CPU_FTR_CTRL | \ CPU_FTR_MMCRA | CPU_FTR_SMT | \ <API key> | \ CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ CPU_FTR_DSCR | <API key> | \ <API key> | CPU_FTR_POPCNTB | CPU_FTR_CFAR | \ CPU_FTR_DABRX) #define CPU_FTRS_POWER7 (CPU_FTR_LWSYNC | \ <API key> | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\ CPU_FTR_MMCRA | CPU_FTR_SMT | \ <API key> | \ CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT | \ <API key> | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_CFAR | CPU_FTR_HVMODE | \ CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR | CPU_FTR_DABRX | CPU_FTR_PKEY) #define CPU_FTRS_POWER8 (CPU_FTR_LWSYNC | \ <API key> | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\ CPU_FTR_MMCRA | CPU_FTR_SMT | \ <API key> | \ CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ CPU_FTR_DSCR | CPU_FTR_SAO | \ <API key> | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \ CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP | CPU_FTR_PKEY) #define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG) #define CPU_FTRS_POWER9 (CPU_FTR_LWSYNC | \ <API key> | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\ CPU_FTR_MMCRA | CPU_FTR_SMT | \ <API key> | \ CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ CPU_FTR_DSCR | CPU_FTR_SAO | \ <API key> | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \ CPU_FTR_TM_COMP | CPU_FTR_ARCH_300 | CPU_FTR_PKEY | \ <API key> | <API key> | CPU_FTR_P9_TIDR) #define <API key> CPU_FTRS_POWER9 #define <API key> (CPU_FTRS_POWER9 | <API key>) #define <API key> (CPU_FTRS_POWER9 | <API key> | \ <API key> | \ <API key>) #define CPU_FTRS_CELL (CPU_FTR_LWSYNC | \ <API key> | CPU_FTR_CTRL | \ <API key> | CPU_FTR_MMCRA | CPU_FTR_SMT | \ CPU_FTR_PAUSE_ZERO | CPU_FTR_CELL_TB_BUG | <API key> | \ <API key> | CPU_FTR_DABRX) #define CPU_FTRS_PA6T (CPU_FTR_LWSYNC | \ <API key> | <API key> | \ CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_DABRX) #define CPU_FTRS_COMPATIBLE (<API key>) #ifdef __powerpc64__ #ifdef CONFIG_PPC_BOOK3E #define CPU_FTRS_POSSIBLE (CPU_FTRS_E6500 | CPU_FTRS_E5500) #else #ifdef <API key> #define CPU_FTRS_POSSIBLE \ (CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | CPU_FTRS_POWER8 | \ <API key> | CPU_FTR_VSX_COMP | CPU_FTRS_POWER9 | \ <API key> | <API key>) #else #define CPU_FTRS_POSSIBLE \ (CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \ CPU_FTRS_POWER6 | CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | \ CPU_FTRS_POWER8 | CPU_FTRS_CELL | CPU_FTRS_PA6T | \ CPU_FTR_VSX_COMP | <API key> | CPU_FTRS_POWER9 | \ <API key> | <API key>) #endif /* <API key> */ #endif #else enum { CPU_FTRS_POSSIBLE = #ifdef <API key> CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 | CPU_FTRS_750FX2 | CPU_FTRS_750FX | CPU_FTRS_750GX | CPU_FTRS_7400_NOTAU | CPU_FTRS_7400 | CPU_FTRS_7450_20 | CPU_FTRS_7450_21 | CPU_FTRS_7450_23 | CPU_FTRS_7455_1 | CPU_FTRS_7455_20 | CPU_FTRS_7455 | CPU_FTRS_7447_10 | CPU_FTRS_7447 | CPU_FTRS_7447A | CPU_FTRS_82XX | CPU_FTRS_G2_LE | CPU_FTRS_E300 | CPU_FTRS_E300C2 | CPU_FTRS_CLASSIC32 | #else CPU_FTRS_GENERIC_32 | #endif #ifdef CONFIG_PPC_8xx CPU_FTRS_8XX | #endif #ifdef CONFIG_40x CPU_FTRS_40X | #endif #ifdef CONFIG_44x CPU_FTRS_44X | CPU_FTRS_440x6 | #endif #ifdef CONFIG_PPC_47x CPU_FTRS_47X | CPU_FTR_476_DD2 | #endif #ifdef CONFIG_E200 CPU_FTRS_E200 | #endif #ifdef CONFIG_E500 CPU_FTRS_E500 | CPU_FTRS_E500_2 | #endif #ifdef CONFIG_PPC_E500MC CPU_FTRS_E500MC | CPU_FTRS_E5500 | CPU_FTRS_E6500 | #endif 0, }; #endif /* __powerpc64__ */ #ifdef __powerpc64__ #ifdef CONFIG_PPC_BOOK3E #define CPU_FTRS_ALWAYS (CPU_FTRS_E6500 & CPU_FTRS_E5500) #else #ifdef <API key> #define <API key> \ (CPU_FTR_LWSYNC | \ <API key> | \ <API key> | \ CPU_FTR_NOEXECUTE | \ <API key> | \ <API key> | \ CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ CPU_FTR_DAWR | \ CPU_FTR_ARCH_206 | \ CPU_FTR_ARCH_207S) #else #define <API key> (~0ul) #endif #ifdef <API key> #define CPU_FTRS_ALWAYS \ (CPU_FTRS_POSSIBLE & ~CPU_FTR_HVMODE & CPU_FTRS_POWER7 & \ CPU_FTRS_POWER8E & CPU_FTRS_POWER8 & CPU_FTRS_POWER9 & \ <API key> & <API key>) #else #define CPU_FTRS_ALWAYS \ (CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & \ CPU_FTRS_POWER6 & CPU_FTRS_POWER7 & CPU_FTRS_CELL & \ CPU_FTRS_PA6T & CPU_FTRS_POWER8 & CPU_FTRS_POWER8E & \ ~CPU_FTR_HVMODE & CPU_FTRS_POSSIBLE & CPU_FTRS_POWER9 & \ <API key> & <API key>) #endif /* <API key> */ #endif #else enum { CPU_FTRS_ALWAYS = #ifdef <API key> CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU & CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 & CPU_FTRS_750FX2 & CPU_FTRS_750FX & CPU_FTRS_750GX & CPU_FTRS_7400_NOTAU & CPU_FTRS_7400 & CPU_FTRS_7450_20 & CPU_FTRS_7450_21 & CPU_FTRS_7450_23 & CPU_FTRS_7455_1 & CPU_FTRS_7455_20 & CPU_FTRS_7455 & CPU_FTRS_7447_10 & CPU_FTRS_7447 & CPU_FTRS_7447A & CPU_FTRS_82XX & CPU_FTRS_G2_LE & CPU_FTRS_E300 & CPU_FTRS_E300C2 & CPU_FTRS_CLASSIC32 & #else CPU_FTRS_GENERIC_32 & #endif #ifdef CONFIG_PPC_8xx CPU_FTRS_8XX & #endif #ifdef CONFIG_40x CPU_FTRS_40X & #endif #ifdef CONFIG_44x CPU_FTRS_44X & CPU_FTRS_440x6 & #endif #ifdef CONFIG_E200 CPU_FTRS_E200 & #endif #ifdef CONFIG_E500 CPU_FTRS_E500 & CPU_FTRS_E500_2 & #endif #ifdef CONFIG_PPC_E500MC CPU_FTRS_E500MC & CPU_FTRS_E5500 & CPU_FTRS_E6500 & #endif ~CPU_FTR_EMB_HV & /* can be removed at runtime */ CPU_FTRS_POSSIBLE, }; #endif /* __powerpc64__ */ #define HBP_NUM 1 #endif /* !__ASSEMBLY__ */ #endif /* <API key> */
#ifndef BASE_BATTERY_H #define BASE_BATTERY_H #include <omnetpp.h> #include "MiXiMDefs.h" #include "BaseModule.h" #include "HostState.h" /** * @brief Defines the amount of power drawn by a device from * a power source. * * Used as generic amount parameter for BaseBatteries "draw"-method. * * Can be either an instantaneous draw of a certain energy amount * in mWs (type=ENERGY) or a draw of a certain current in mA over * time (type=CURRENT). * * Can be sub-classed for more complex power draws. * * @ingroup baseModules * @ingroup power */ class MIXIM_API DrawAmount { public: /** @brief The type of the amount to draw.*/ enum PowerType { CURRENT, /** @brief Current in mA over time. */ ENERGY /** @brief Single fixed energy draw in mWs */ }; protected: /** @brief Stores the type of the amount.*/ int type; /** @brief Stores the actual amount.*/ double value; public: /** @brief Initializes with passed type and value.*/ DrawAmount(int type = CURRENT, double value = 0): type(type), value(value) {} virtual ~DrawAmount() {} /** @brief Returns the type of power drawn as PowerType. */ virtual int getType() const { return type; } /** @brief Returns the actual amount of power drawn. */ virtual double getValue() const { return value; } /** @brief Sets the type of power drawn. */ virtual void setType(int t) { type = t; } /** @brief Sets the actual amount of power drawn. */ virtual void setValue(double v) { value = v; } }; /** * @brief Base class for any power source. * * See "SimpleBattery" for an example implementation. * * @ingroup baseModules * @ingroup power * @see SimpleBattery */ class MIXIM_API BaseBattery : public BaseModule { private: /** @brief Copy constructor is not allowed. */ BaseBattery(const BaseBattery&); /** @brief Assignment operator is not allowed. */ BaseBattery& operator=(const BaseBattery&); public: BaseBattery() : BaseModule() {} BaseBattery(unsigned stacksize) : BaseModule(stacksize) {} /** * @brief Registers a power draining device with this battery. * * Takes the name of the device as well as a number of accounts * the devices draws power for (like rx, tx, idle for a radio device). * * Returns an ID by which the device can identify itself to the * battery. * * Has to be implemented by actual battery implementations. */ virtual int registerDevice(const std::string& name, int numAccounts) = 0; /** * @brief Draws power from the battery. * * The actual amount and type of power drawn is defined by the passed * DrawAmount parameter. Can be an fixed single amount or an amount * drawn over time. * The drainID identifies the device which drains the power. * "Account" identifies the account the power is drawn from. It is * used for statistical evaluation only to see which activity of a * device has used how much power. It does not affect functionality. */ virtual void draw(int drainID, DrawAmount& amount, int account) = 0; /** * @name State-of-charge interface * * @brief Other host modules should use these interfaces to obtain * the state-of-charge of the battery. Do NOT use BatteryState * interfaces, which should be used only by Battery Stats modules. */ /** @brief get voltage (future support for non-voltage regulated h/w */ virtual double getVoltage() const = 0; /** @brief current state of charge of the battery, relative to its * rated nominal capacity [0..1] */ virtual double <API key>() const = 0; /** @brief current state of charge of the battery (mW-s) */ virtual double estimateResidualAbs() const = 0; /** @brief Current state of the battery. */ virtual HostState::States getState() const = 0; }; #endif
/* File hw_atl_utils.c: Definition of common functions for Atlantic hardware * abstraction layer. */ #include "../aq_hw.h" #include "../aq_hw_utils.h" #include "../aq_pci_func.h" #include "../aq_ring.h" #include "../aq_vec.h" #include "hw_atl_utils.h" #include "hw_atl_llh.h" #include <linux/random.h> #define <API key> 0x0370U #define HW_ATL_FW_SM_RAM 0x2U #define <API key> 0x0368U #define <API key> 0x036CU #define <API key> 0x00FFU #define <API key> 0U #define <API key> 0xFFFFU #define <API key> 16U static int <API key>(struct aq_hw_s *self, u32 a, u32 *p, u32 cnt) { int err = 0; AQ_HW_WAIT_FOR(reg_glb_cpu_sem_get(self, HW_ATL_FW_SM_RAM) == 1U, 1U, 10000U); if (err < 0) { bool is_locked; reg_glb_cpu_sem_set(self, 1U, HW_ATL_FW_SM_RAM); is_locked = reg_glb_cpu_sem_get(self, HW_ATL_FW_SM_RAM); if (!is_locked) { err = -ETIME; goto err_exit; } } aq_hw_write_reg(self, 0x00000208U, a); for (++cnt; --cnt;) { u32 i = 0U; aq_hw_write_reg(self, 0x00000200U, 0x00008000U); for (i = 1024U; (0x100U & aq_hw_read_reg(self, 0x00000200U)) && --i;) { } *(p++) = aq_hw_read_reg(self, 0x0000020CU); } reg_glb_cpu_sem_set(self, 1U, HW_ATL_FW_SM_RAM); err_exit: return err; } static int <API key>(struct aq_hw_s *self, u32 a, u32 *p, u32 cnt) { int err = 0; bool is_locked; is_locked = reg_glb_cpu_sem_get(self, HW_ATL_FW_SM_RAM); if (!is_locked) { err = -ETIME; goto err_exit; } aq_hw_write_reg(self, 0x00000208U, a); for (++cnt; --cnt;) { u32 i = 0U; aq_hw_write_reg(self, 0x0000020CU, *(p++)); aq_hw_write_reg(self, 0x00000200U, 0xC000U); for (i = 1024U; (0x100U & aq_hw_read_reg(self, 0x00000200U)) && --i;) { } } reg_glb_cpu_sem_set(self, 1U, HW_ATL_FW_SM_RAM); err_exit: return err; } static int <API key>(u32 ver_expected, u32 ver_actual) { int err = 0; const u32 dw_major_mask = 0xff000000U; const u32 dw_minor_mask = 0x00ffffffU; err = (dw_major_mask & (ver_expected ^ ver_actual)) ? -EOPNOTSUPP : 0; if (err < 0) goto err_exit; err = ((dw_minor_mask & ver_expected) > (dw_minor_mask & ver_actual)) ? -EOPNOTSUPP : 0; err_exit: return err; } static int <API key>(struct aq_hw_s *self, struct aq_hw_caps_s *aq_hw_caps) { int err = 0; if (!aq_hw_read_reg(self, 0x370U)) { unsigned int rnd = 0U; unsigned int ucp_0x370 = 0U; get_random_bytes(&rnd, sizeof(unsigned int)); ucp_0x370 = 0x02020202U | (0xFEFEFEFEU & rnd); aq_hw_write_reg(self, <API key>, ucp_0x370); } <API key>(self, 0x00000000U, 25U); /* check 10 times by 1ms */ AQ_HW_WAIT_FOR(0U != (PHAL_ATLANTIC_A0->mbox_addr = aq_hw_read_reg(self, 0x360U)), 1000U, 10U); err = <API key>(aq_hw_caps->fw_ver_expected, aq_hw_read_reg(self, 0x18U)); if (err < 0) pr_err("%s: Bad FW version detected: expected=%x, actual=%x\n", AQ_CFG_DRV_NAME, aq_hw_caps->fw_ver_expected, aq_hw_read_reg(self, 0x18U)); return err; } #define <API key> 0x0338U #define <API key> 0x033CU struct <API key> { union { u32 val; struct { u16 tid; u16 len; }; }; }; #define <API key>(_H_) <API key>(_H_, NULL) static int <API key>(struct aq_hw_s *self, unsigned int rpc_size) { int err = 0; struct <API key> sw; if (!IS_CHIP_FEATURE(MIPS)) { err = -1; goto err_exit; } err = <API key>(self, PHAL_ATLANTIC->rpc_addr, (u32 *)(void *)&PHAL_ATLANTIC->rpc, (rpc_size + sizeof(u32) - sizeof(u8)) / sizeof(u32)); if (err < 0) goto err_exit; sw.tid = 0xFFFFU & (++PHAL_ATLANTIC->rpc_tid); sw.len = (u16)rpc_size; aq_hw_write_reg(self, <API key>, sw.val); err_exit: return err; } static int <API key>(struct aq_hw_s *self, struct <API key> **rpc) { int err = 0; struct <API key> sw; struct <API key> fw; do { sw.val = aq_hw_read_reg(self, <API key>); PHAL_ATLANTIC->rpc_tid = sw.tid; AQ_HW_WAIT_FOR(sw.tid == (fw.val = aq_hw_read_reg(self, <API key>), fw.tid), 1000U, 100U); if (err < 0) goto err_exit; if (fw.len == 0xFFFFU) { err = <API key>(self, sw.len); if (err < 0) goto err_exit; } } while (sw.tid != fw.tid || 0xFFFFU == fw.len); if (err < 0) goto err_exit; if (rpc) { if (fw.len) { err = <API key>(self, PHAL_ATLANTIC->rpc_addr, (u32 *)(void *) &PHAL_ATLANTIC->rpc, (fw.len + sizeof(u32) - sizeof(u8)) / sizeof(u32)); if (err < 0) goto err_exit; } *rpc = &PHAL_ATLANTIC->rpc; } err_exit: return err; } static int <API key>(struct aq_hw_s *self, struct aq_hw_caps_s *aq_hw_caps) { int err = 0; err = <API key>(self, aq_hw_caps); if (err < 0) goto err_exit; err = <API key>(self); if (err < 0) goto err_exit; err_exit: return err; } void <API key>(struct aq_hw_s *self, struct <API key> *pmbox) { int err = 0; err = <API key>(self, PHAL_ATLANTIC->mbox_addr, (u32 *)(void *)pmbox, sizeof(*pmbox) / sizeof(u32)); if (err < 0) goto err_exit; if (pmbox != &PHAL_ATLANTIC->mbox) memcpy(pmbox, &PHAL_ATLANTIC->mbox, sizeof(*pmbox)); if (IS_CHIP_FEATURE(REVISION_A0)) { unsigned int mtu = self->aq_nic_cfg ? self->aq_nic_cfg->mtu : 1514U; pmbox->stats.ubrc = pmbox->stats.uprc * mtu; pmbox->stats.ubtc = pmbox->stats.uptc * mtu; pmbox->stats.dpc = atomic_read(&PHAL_ATLANTIC_A0->dpc); } else { pmbox->stats.dpc = <API key>(self); } err_exit:; } int <API key>(struct aq_hw_s *self, u32 speed, enum <API key> state) { u32 ucp_0x368 = 0; ucp_0x368 = (speed << <API key>) | state; aq_hw_write_reg(self, <API key>, ucp_0x368); return 0; } void <API key>(struct aq_hw_s *self, enum <API key> state, u32 speed) { int err = 0; u32 transaction_id = 0; if (state == MPI_RESET) { <API key>(self, &PHAL_ATLANTIC->mbox); transaction_id = PHAL_ATLANTIC->mbox.transaction_id; AQ_HW_WAIT_FOR(transaction_id != (<API key> (self, &PHAL_ATLANTIC->mbox), PHAL_ATLANTIC->mbox.transaction_id), 1000U, 100U); if (err < 0) goto err_exit; } err = <API key>(self, speed, state); err_exit:; } int <API key>(struct aq_hw_s *self) { u32 cp0x036C = aq_hw_read_reg(self, <API key>); u32 link_speed_mask = cp0x036C >> <API key>; struct aq_hw_link_status_s *link_status = &self->aq_link_status; if (!link_speed_mask) { link_status->mbps = 0U; } else { switch (link_speed_mask) { case <API key>: link_status->mbps = 10000U; break; case <API key>: case <API key>: link_status->mbps = 5000U; break; case <API key>: link_status->mbps = 2500U; break; case <API key>: link_status->mbps = 1000U; break; case <API key>: link_status->mbps = 100U; break; default: return -EBUSY; } } return 0; } int <API key>(struct aq_hw_s *self, struct aq_hw_caps_s *aq_hw_caps, u8 *mac) { int err = 0; u32 h = 0U; u32 l = 0U; u32 mac_addr[2]; self->mmio = <API key>(self->aq_pci_func); <API key>(self, &PHAL_ATLANTIC_A0->chip_features); err = <API key>(self, aq_hw_caps); if (err < 0) goto err_exit; if (!aq_hw_read_reg(self, <API key>)) { unsigned int rnd = 0; unsigned int ucp_0x370 = 0; get_random_bytes(&rnd, sizeof(unsigned int)); ucp_0x370 = 0x02020202 | (0xFEFEFEFE & rnd); aq_hw_write_reg(self, <API key>, ucp_0x370); } err = <API key>(self, aq_hw_read_reg(self, 0x00000374U) + (40U * 4U), mac_addr, AQ_DIMOF(mac_addr)); if (err < 0) { mac_addr[0] = 0U; mac_addr[1] = 0U; err = 0; } else { mac_addr[0] = __swab32(mac_addr[0]); mac_addr[1] = __swab32(mac_addr[1]); } ether_addr_copy(mac, (u8 *)mac_addr); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { /* chip revision */ l = 0xE3000000U | (0xFFFFU & aq_hw_read_reg(self, <API key>)) | (0x00 << 16); h = 0x8001300EU; mac[5] = (u8)(0xFFU & l); l >>= 8; mac[4] = (u8)(0xFFU & l); l >>= 8; mac[3] = (u8)(0xFFU & l); l >>= 8; mac[2] = (u8)(0xFFU & l); mac[1] = (u8)(0xFFU & h); h >>= 8; mac[0] = (u8)(0xFFU & h); } err_exit: return err; } unsigned int <API key>(unsigned int mbps) { unsigned int ret = 0U; switch (mbps) { case 100U: ret = 5U; break; case 1000U: ret = 4U; break; case 2500U: ret = 3U; break; case 5000U: ret = 1U; break; case 10000U: ret = 0U; break; default: break; } return ret; } void <API key>(struct aq_hw_s *self, u32 *p) { u32 chip_features = 0U; u32 val = reg_glb_mif_id_get(self); u32 mif_rev = val & 0xFFU; if ((3U & mif_rev) == 1U) { chip_features |= <API key> | <API key> | <API key>; } else if ((3U & mif_rev) == 2U) { chip_features |= <API key> | <API key> | <API key> | <API key> | <API key>; } *p = chip_features; } int <API key>(struct aq_hw_s *self) { <API key>(self, MPI_DEINIT, 0x0U); return 0; } int <API key>(struct aq_hw_s *self, unsigned int power_state) { <API key>(self, MPI_POWER, 0x0U); return 0; } int <API key>(struct aq_hw_s *self, u64 *data, unsigned int *p_count) { struct hw_atl_stats_s *stats = NULL; int i = 0; <API key>(self, &PHAL_ATLANTIC->mbox); stats = &PHAL_ATLANTIC->mbox.stats; data[i] = stats->uprc + stats->mprc + stats->bprc; data[++i] = stats->uprc; data[++i] = stats->mprc; data[++i] = stats->bprc; data[++i] = stats->erpt; data[++i] = stats->uptc + stats->mptc + stats->bptc; data[++i] = stats->uptc; data[++i] = stats->mptc; data[++i] = stats->bptc; data[++i] = stats->ubrc; data[++i] = stats->ubtc; data[++i] = stats->mbrc; data[++i] = stats->mbtc; data[++i] = stats->bbrc; data[++i] = stats->bbtc; data[++i] = stats->ubrc + stats->mbrc + stats->bbrc; data[++i] = stats->ubtc + stats->mbtc + stats->bbtc; data[++i] = <API key>(self); data[++i] = <API key>(self); data[++i] = <API key>(self); data[++i] = <API key>(self); data[++i] = stats->dpc; if (p_count) *p_count = ++i; return 0; } static const u32 <API key>[] = { 0x00005580U, 0x00005590U, 0x000055B0U, 0x000055B4U, 0x000055C0U, 0x00005B00U, 0x00005B04U, 0x00005B08U, 0x00005B0CU, 0x00005B10U, 0x00005B14U, 0x00005B18U, 0x00005B1CU, 0x00005B20U, 0x00005B24U, 0x00005B28U, 0x00005B2CU, 0x00005B30U, 0x00005B34U, 0x00005B38U, 0x00005B3CU, 0x00005B40U, 0x00005B44U, 0x00005B48U, 0x00005B4CU, 0x00005B50U, 0x00005B54U, 0x00005B58U, 0x00005B5CU, 0x00005B60U, 0x00005B64U, 0x00005B68U, 0x00005B6CU, 0x00005B70U, 0x00005B74U, 0x00005B78U, 0x00005B7CU, 0x00007C00U, 0x00007C04U, 0x00007C08U, 0x00007C0CU, 0x00007C10U, 0x00007C14U, 0x00007C18U, 0x00007C1CU, 0x00007C20U, 0x00007C40U, 0x00007C44U, 0x00007C48U, 0x00007C4CU, 0x00007C50U, 0x00007C54U, 0x00007C58U, 0x00007C5CU, 0x00007C60U, 0x00007C80U, 0x00007C84U, 0x00007C88U, 0x00007C8CU, 0x00007C90U, 0x00007C94U, 0x00007C98U, 0x00007C9CU, 0x00007CA0U, 0x00007CC0U, 0x00007CC4U, 0x00007CC8U, 0x00007CCCU, 0x00007CD0U, 0x00007CD4U, 0x00007CD8U, 0x00007CDCU, 0x00007CE0U, 0x00000300U, 0x00000304U, 0x00000308U, 0x0000030cU, 0x00000310U, 0x00000314U, 0x00000318U, 0x0000031cU, 0x00000360U, 0x00000364U, 0x00000368U, 0x0000036cU, 0x00000370U, 0x00000374U, 0x00006900U, }; int <API key>(struct aq_hw_s *self, struct aq_hw_caps_s *aq_hw_caps, u32 *regs_buff) { unsigned int i = 0U; for (i = 0; i < aq_hw_caps->mac_regs_count; i++) regs_buff[i] = aq_hw_read_reg(self, <API key>[i]); return 0; } int <API key>(struct aq_hw_s *self, u32 *fw_version) { *fw_version = aq_hw_read_reg(self, 0x18U); return 0; }
#include "emu.h" #include "cpu/z80/z80.h" #include "sound/wave.h" #include "includes/galaxy.h" #include "imagedev/snapquik.h" #include "imagedev/cassette.h" #include "sound/ay8910.h" #include "formats/gtp_cas.h" #include "machine/ram.h" #include "softlist.h" static ADDRESS_MAP_START (galaxyp_io, AS_IO, 8, galaxy_state ) <API key>(0x01) <API key> AM_RANGE(0xbe, 0xbe) AM_DEVWRITE("ay8910", ay8910_device, address_w) AM_RANGE(0xbf, 0xbf) AM_DEVWRITE("ay8910", ay8910_device, data_w) ADDRESS_MAP_END static ADDRESS_MAP_START (galaxy_mem, AS_PROGRAM, 8, galaxy_state ) AM_RANGE(0x0000, 0x0fff) AM_ROM AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ(galaxy_keyboard_r ) AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_WRITE(galaxy_latch_w ) ADDRESS_MAP_END static ADDRESS_MAP_START (galaxyp_mem, AS_PROGRAM, 8, galaxy_state ) AM_RANGE(0x0000, 0x0fff) AM_ROM // ROM A AM_RANGE(0x1000, 0x1fff) AM_ROM // ROM B AM_RANGE(0x2000, 0x2037) AM_MIRROR(0x07c0) AM_READ(galaxy_keyboard_r ) AM_RANGE(0x2038, 0x203f) AM_MIRROR(0x07c0) AM_WRITE(galaxy_latch_w ) AM_RANGE(0xe000, 0xefff) AM_ROM // ROM C AM_RANGE(0xf000, 0xffff) AM_ROM // ROM D ADDRESS_MAP_END /* 2008-05 FP: Small note about natural keyboard support. Currently: - "List" is mapped to 'ESC' - "Break" is mapped to 'F1' - "Repeat" is mapped to 'F2' */ static INPUT_PORTS_START (galaxy_common) PORT_START("LINE0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_START("LINE1") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_START("LINE2") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_START("LINE3") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_START("LINE4") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('_') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(' PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') PORT_START("LINE5") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('-') PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_START("LINE6") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Break") PORT_CODE(KEYCODE_PAUSE) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Repeat") PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("List") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) INPUT_PORTS_END static INPUT_PORTS_START( galaxy ) PORT_INCLUDE( galaxy_common ) PORT_START("ROM2") PORT_CONFNAME(0x01, 0x01, "ROM 2") PORT_CONFSETTING(0x01, "Installed") PORT_CONFSETTING(0x00, "Not installed") INPUT_PORTS_END static INPUT_PORTS_START( galaxyp ) PORT_INCLUDE( galaxy_common ) INPUT_PORTS_END #define XTAL 6144000 /* F4 Character Displayer */ static const gfx_layout galaxy_charlayout = { 8, 16, /* 8 x 16 characters */ 128, /* 128 characters */ 1, /* 1 bits per pixel */ { 0 }, /* no bitplanes */ /* x offsets */ { 7, 6, 5, 4, 3, 2, 1, 0 }, /* y offsets */ { 0, 1*128*8, 2*128*8, 3*128*8, 4*128*8, 5*128*8, 6*128*8, 7*128*8, 8*128*8, 9*128*8, 10*128*8, 11*128*8, 12*128*8, 13*128*8, 14*128*8, 15*128*8 }, 8 /* every char takes 1 x 16 bytes */ }; static GFXDECODE_START( galaxy ) GFXDECODE_ENTRY( "gfx1", 0x0000, galaxy_charlayout, 0, 1 ) GFXDECODE_END static <API key>( galaxy, galaxy_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, XTAL / 2) <API key>(galaxy_mem) <API key>("screen", galaxy_state, galaxy_interrupt) <API key>(galaxy_state,galaxy_irq_callback) MCFG_SCREEN_ADD("screen", RASTER) <API key>(50) MCFG_SCREEN_PALETTE("palette") <API key>(galaxy_state, galaxy ) /* video hardware */ MCFG_SCREEN_SIZE(384, 212) <API key>(0, 384-1, 0, 208-1) <API key>(galaxy_state, <API key>) MCFG_GFXDECODE_ADD("gfxdecode", "palette", galaxy) <API key>("palette") /* snapshot */ MCFG_SNAPSHOT_ADD("snapshot", galaxy_state, galaxy, "gal", 0) <API key>("mono") MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MCFG_CASSETTE_ADD( "cassette" ) <API key>(<API key>) <API key>(CASSETTE_STOPPED | <API key> | <API key>) <API key>("galaxy_cass") <API key>("cass_list","galaxy") /* internal ram */ MCFG_RAM_ADD(RAM_TAG) <API key>("6K") <API key>("2K,22K,38K,54K") MACHINE_CONFIG_END static <API key>( galaxyp, galaxy_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, XTAL / 2) <API key>(galaxyp_mem) MCFG_CPU_IO_MAP(galaxyp_io) <API key>("screen", galaxy_state, galaxy_interrupt) <API key>(galaxy_state,galaxy_irq_callback) MCFG_SCREEN_ADD("screen", RASTER) <API key>(50) MCFG_SCREEN_PALETTE("palette") <API key>(galaxy_state, galaxyp ) /* video hardware */ MCFG_SCREEN_SIZE(384, 208) <API key>(0, 384-1, 0, 208-1) <API key>(galaxy_state, <API key>) <API key>("palette") /* snapshot */ MCFG_SNAPSHOT_ADD("snapshot", galaxy_state, galaxy, "gal", 0) /* sound hardware */ <API key>("mono") MCFG_SOUND_ADD("ay8910", AY8910, XTAL/4) MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MCFG_CASSETTE_ADD( "cassette" ) <API key>(<API key>) <API key>(CASSETTE_STOPPED | <API key> | <API key>) <API key>("galaxy_cass") <API key>("cass_list","galaxy") /* internal ram */ MCFG_RAM_ADD(RAM_TAG) <API key>("38K") MACHINE_CONFIG_END ROM_START (galaxy) ROM_REGION (0x10000, "maincpu", ROMREGION_ERASEFF) ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(dc970a32) SHA1(<SHA1-like>)) ROM_LOAD_OPTIONAL ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(<SHA1-like>)) ROM_REGION(0x0800, "gfx1",0) ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(<SHA1-like>)) ROM_END ROM_START (galaxyp) ROM_REGION (0x10000, "maincpu", ROMREGION_ERASEFF) ROM_LOAD ("galrom1.bin", 0x0000, 0x1000, CRC(dc970a32) SHA1(<SHA1-like>)) ROM_LOAD ("galrom2.bin", 0x1000, 0x1000, CRC(5dc5a100) SHA1(<SHA1-like>)) ROM_LOAD ("galplus.bin", 0xe000, 0x1000, CRC(d4cfab14) SHA1(<SHA1-like>)) ROM_REGION(0x0800, "gfx1",0) ROM_LOAD ("galchr.bin", 0x0000, 0x0800, CRC(5c3b5bb5) SHA1(<SHA1-like>)) ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ COMP(1983, galaxy, 0, 0, galaxy, galaxy, galaxy_state, galaxy, "Voja Antonic / Elektronika inzenjering", "Galaksija", 0) COMP(1985, galaxyp, galaxy, 0, galaxyp,galaxyp, galaxy_state,galaxyp,"Nenad Dunjic", "Galaksija plus", 0)
#include <linux/config.h> #include <linux/init.h> #include "hisax.h" #include "isac.h" #include "hscx.h" #include "isdnl1.h" #include "ipac.h" #include <linux/pci.h> extern const char *CardType[]; static const char *gazel_revision = "$Revision: 2.19.2.4 $"; #define R647 1 #define R685 2 #define R753 3 #define R742 4 #define PLX_CNTRL 0x50 /* registre de controle PLX */ #define RESET_GAZEL 0x4 #define RESET_9050 0x40000000 #define PLX_INCSR 0x4C /* registre d'IT du 9050 */ #define INT_ISAC_EN 0x8 /* 1 = enable IT isac */ #define INT_ISAC 0x20 /* 1 = IT isac en cours */ #define INT_HSCX_EN 0x1 /* 1 = enable IT hscx */ #define INT_HSCX 0x4 /* 1 = IT hscx en cours */ #define INT_PCI_EN 0x40 /* 1 = enable IT PCI */ #define INT_IPAC_EN 0x3 /* enable IT ipac */ #define byteout(addr,val) outb(val,addr) #define bytein(addr) inb(addr) static inline u_char readreg(unsigned int adr, u_short off) { return bytein(adr + off); } static inline void writereg(unsigned int adr, u_short off, u_char data) { byteout(adr + off, data); } static inline void read_fifo(unsigned int adr, u_char * data, int size) { insb(adr, data, size); } static void write_fifo(unsigned int adr, u_char * data, int size) { outsb(adr, data, size); } static inline u_char readreg_ipac(unsigned int adr, u_short off) { register u_char ret; byteout(adr, off); ret = bytein(adr + 4); return ret; } static inline void writereg_ipac(unsigned int adr, u_short off, u_char data) { byteout(adr, off); byteout(adr + 4, data); } static inline void read_fifo_ipac(unsigned int adr, u_short off, u_char * data, int size) { byteout(adr, off); insb(adr + 4, data, size); } static void write_fifo_ipac(unsigned int adr, u_short off, u_char * data, int size) { byteout(adr, off); outsb(adr + 4, data, size); } /* Interface functions */ static u_char ReadISAC(struct IsdnCardState *cs, u_char offset) { u_short off2 = offset; switch (cs->subtyp) { case R647: off2 = ((off2 << 8 & 0xf000) | (off2 & 0xf)); case R685: return (readreg(cs->hw.gazel.isac, off2)); case R753: case R742: return (readreg_ipac(cs->hw.gazel.ipac, 0x80 + off2)); } return 0; } static void WriteISAC(struct IsdnCardState *cs, u_char offset, u_char value) { u_short off2 = offset; switch (cs->subtyp) { case R647: off2 = ((off2 << 8 & 0xf000) | (off2 & 0xf)); case R685: writereg(cs->hw.gazel.isac, off2, value); break; case R753: case R742: writereg_ipac(cs->hw.gazel.ipac, 0x80 + off2, value); break; } } static void ReadISACfifo(struct IsdnCardState *cs, u_char * data, int size) { switch (cs->subtyp) { case R647: case R685: read_fifo(cs->hw.gazel.isacfifo, data, size); break; case R753: case R742: read_fifo_ipac(cs->hw.gazel.ipac, 0x80, data, size); break; } } static void WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) { switch (cs->subtyp) { case R647: case R685: write_fifo(cs->hw.gazel.isacfifo, data, size); break; case R753: case R742: write_fifo_ipac(cs->hw.gazel.ipac, 0x80, data, size); break; } } static void ReadHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size) { switch (cs->subtyp) { case R647: case R685: read_fifo(cs->hw.gazel.hscxfifo[hscx], data, size); break; case R753: case R742: read_fifo_ipac(cs->hw.gazel.ipac, hscx * 0x40, data, size); break; } } static void WriteHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size) { switch (cs->subtyp) { case R647: case R685: write_fifo(cs->hw.gazel.hscxfifo[hscx], data, size); break; case R753: case R742: write_fifo_ipac(cs->hw.gazel.ipac, hscx * 0x40, data, size); break; } } static u_char ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) { u_short off2 = offset; switch (cs->subtyp) { case R647: off2 = ((off2 << 8 & 0xf000) | (off2 & 0xf)); case R685: return (readreg(cs->hw.gazel.hscx[hscx], off2)); case R753: case R742: return (readreg_ipac(cs->hw.gazel.ipac, hscx * 0x40 + off2)); } return 0; } static void WriteHSCX(struct IsdnCardState *cs, int hscx, u_char offset, u_char value) { u_short off2 = offset; switch (cs->subtyp) { case R647: off2 = ((off2 << 8 & 0xf000) | (off2 & 0xf)); case R685: writereg(cs->hw.gazel.hscx[hscx], off2, value); break; case R753: case R742: writereg_ipac(cs->hw.gazel.ipac, hscx * 0x40 + off2, value); break; } } /* * fast interrupt HSCX stuff goes here */ #define READHSCX(cs, nr, reg) ReadHSCX(cs, nr, reg) #define WRITEHSCX(cs, nr, reg, data) WriteHSCX(cs, nr, reg, data) #define READHSCXFIFO(cs, nr, ptr, cnt) ReadHSCXfifo(cs, nr, ptr, cnt) #define WRITEHSCXFIFO(cs, nr, ptr, cnt) WriteHSCXfifo(cs, nr, ptr, cnt) #include "hscx_irq.c" static irqreturn_t gazel_interrupt(int intno, void *dev_id, struct pt_regs *regs) { #define MAXCOUNT 5 struct IsdnCardState *cs = dev_id; u_char valisac, valhscx; int count = 0; u_long flags; spin_lock_irqsave(&cs->lock, flags); do { valhscx = ReadHSCX(cs, 1, HSCX_ISTA); if (valhscx) hscx_int_main(cs, valhscx); valisac = ReadISAC(cs, ISAC_ISTA); if (valisac) isac_interrupt(cs, valisac); count++; } while ((valhscx || valisac) && (count < MAXCOUNT)); WriteHSCX(cs, 0, HSCX_MASK, 0xFF); WriteHSCX(cs, 1, HSCX_MASK, 0xFF); WriteISAC(cs, ISAC_MASK, 0xFF); WriteISAC(cs, ISAC_MASK, 0x0); WriteHSCX(cs, 0, HSCX_MASK, 0x0); WriteHSCX(cs, 1, HSCX_MASK, 0x0); <API key>(&cs->lock, flags); return IRQ_HANDLED; } static irqreturn_t <API key>(int intno, void *dev_id, struct pt_regs *regs) { struct IsdnCardState *cs = dev_id; u_char ista, val; int count = 0; u_long flags; spin_lock_irqsave(&cs->lock, flags); ista = ReadISAC(cs, IPAC_ISTA - 0x80); do { if (ista & 0x0f) { val = ReadHSCX(cs, 1, HSCX_ISTA); if (ista & 0x01) val |= 0x01; if (ista & 0x04) val |= 0x02; if (ista & 0x08) val |= 0x04; if (val) { hscx_int_main(cs, val); } } if (ista & 0x20) { val = 0xfe & ReadISAC(cs, ISAC_ISTA); if (val) { isac_interrupt(cs, val); } } if (ista & 0x10) { val = 0x01; isac_interrupt(cs, val); } ista = ReadISAC(cs, IPAC_ISTA - 0x80); count++; } while ((ista & 0x3f) && (count < MAXCOUNT)); WriteISAC(cs, IPAC_MASK - 0x80, 0xFF); WriteISAC(cs, IPAC_MASK - 0x80, 0xC0); <API key>(&cs->lock, flags); return IRQ_HANDLED; } static void release_io_gazel(struct IsdnCardState *cs) { unsigned int i; switch (cs->subtyp) { case R647: for (i = 0x0000; i < 0xC000; i += 0x1000) release_region(i + cs->hw.gazel.hscx[0], 16); release_region(0xC000 + cs->hw.gazel.hscx[0], 1); break; case R685: release_region(cs->hw.gazel.hscx[0], 0x100); release_region(cs->hw.gazel.cfg_reg, 0x80); break; case R753: release_region(cs->hw.gazel.ipac, 0x8); release_region(cs->hw.gazel.cfg_reg, 0x80); break; case R742: release_region(cs->hw.gazel.ipac, 8); break; } } static int reset_gazel(struct IsdnCardState *cs) { unsigned long plxcntrl, addr = cs->hw.gazel.cfg_reg; switch (cs->subtyp) { case R647: writereg(addr, 0, 0); HZDELAY(10); writereg(addr, 0, 1); HZDELAY(2); break; case R685: plxcntrl = inl(addr + PLX_CNTRL); plxcntrl |= (RESET_9050 + RESET_GAZEL); outl(plxcntrl, addr + PLX_CNTRL); plxcntrl &= ~(RESET_9050 + RESET_GAZEL); HZDELAY(4); outl(plxcntrl, addr + PLX_CNTRL); HZDELAY(10); outb(INT_ISAC_EN + INT_HSCX_EN + INT_PCI_EN, addr + PLX_INCSR); break; case R753: plxcntrl = inl(addr + PLX_CNTRL); plxcntrl |= (RESET_9050 + RESET_GAZEL); outl(plxcntrl, addr + PLX_CNTRL); plxcntrl &= ~(RESET_9050 + RESET_GAZEL); WriteISAC(cs, IPAC_POTA2 - 0x80, 0x20); HZDELAY(4); outl(plxcntrl, addr + PLX_CNTRL); HZDELAY(10); WriteISAC(cs, IPAC_POTA2 - 0x80, 0x00); WriteISAC(cs, IPAC_ACFG - 0x80, 0xff); WriteISAC(cs, IPAC_AOE - 0x80, 0x0); WriteISAC(cs, IPAC_MASK - 0x80, 0xff); WriteISAC(cs, IPAC_CONF - 0x80, 0x1); outb(INT_IPAC_EN + INT_PCI_EN, addr + PLX_INCSR); WriteISAC(cs, IPAC_MASK - 0x80, 0xc0); break; case R742: WriteISAC(cs, IPAC_POTA2 - 0x80, 0x20); HZDELAY(4); WriteISAC(cs, IPAC_POTA2 - 0x80, 0x00); WriteISAC(cs, IPAC_ACFG - 0x80, 0xff); WriteISAC(cs, IPAC_AOE - 0x80, 0x0); WriteISAC(cs, IPAC_MASK - 0x80, 0xff); WriteISAC(cs, IPAC_CONF - 0x80, 0x1); WriteISAC(cs, IPAC_MASK - 0x80, 0xc0); break; } return (0); } static int Gazel_card_msg(struct IsdnCardState *cs, int mt, void *arg) { u_long flags; switch (mt) { case CARD_RESET: spin_lock_irqsave(&cs->lock, flags); reset_gazel(cs); <API key>(&cs->lock, flags); return (0); case CARD_RELEASE: release_io_gazel(cs); return (0); case CARD_INIT: spin_lock_irqsave(&cs->lock, flags); inithscxisac(cs, 1); if ((cs->subtyp==R647)||(cs->subtyp==R685)) { int i; for (i=0;i<(2+MAX_WAITING_CALLS);i++) { cs->bcs[i].hw.hscx.tsaxr0 = 0x1f; cs->bcs[i].hw.hscx.tsaxr1 = 0x23; } } <API key>(&cs->lock, flags); return (0); case CARD_TEST: return (0); } return (0); } static int reserve_regions(struct IsdnCard *card, struct IsdnCardState *cs) { unsigned int i, j, base = 0, adr = 0, len = 0; switch (cs->subtyp) { case R647: base = cs->hw.gazel.hscx[0]; if (!request_region(adr = (0xC000 + base), len = 1, "gazel")) goto error; for (i = 0x0000; i < 0xC000; i += 0x1000) { if (!request_region(adr = (i + base), len = 16, "gazel")) goto error; } if (i != 0xC000) { for (j = 0; j < i; j+= 0x1000) release_region(j + base, 16); release_region(0xC000 + base, 1); goto error; } break; case R685: if (!request_region(adr = cs->hw.gazel.hscx[0], len = 0x100, "gazel")) goto error; if (!request_region(adr = cs->hw.gazel.cfg_reg, len = 0x80, "gazel")) { release_region(cs->hw.gazel.hscx[0],0x100); goto error; } break; case R753: if (!request_region(adr = cs->hw.gazel.ipac, len = 0x8, "gazel")) goto error; if (!request_region(adr = cs->hw.gazel.cfg_reg, len = 0x80, "gazel")) { release_region(cs->hw.gazel.ipac, 8); goto error; } break; case R742: if (!request_region(adr = cs->hw.gazel.ipac, len = 0x8, "gazel")) goto error; break; } return 0; error: printk(KERN_WARNING "Gazel: %s io ports 0x%x-0x%x already in use\n", CardType[cs->typ], adr, adr + len); return 1; } static int __init setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs) { printk(KERN_INFO "Gazel: ISA PnP card automatic recognition\n"); // we got an irq parameter, assume it is an ISA card // R742 decodes address even in not started... // R647 returns FF if not present or not started // eventually needs improvment if (readreg_ipac(card->para[1], IPAC_ID) == 1) cs->subtyp = R742; else cs->subtyp = R647; setup_isac(cs); cs->hw.gazel.cfg_reg = card->para[1] + 0xC000; cs->hw.gazel.ipac = card->para[1]; cs->hw.gazel.isac = card->para[1] + 0x8000; cs->hw.gazel.hscx[0] = card->para[1]; cs->hw.gazel.hscx[1] = card->para[1] + 0x4000; cs->irq = card->para[0]; cs->hw.gazel.isacfifo = cs->hw.gazel.isac; cs->hw.gazel.hscxfifo[0] = cs->hw.gazel.hscx[0]; cs->hw.gazel.hscxfifo[1] = cs->hw.gazel.hscx[1]; switch (cs->subtyp) { case R647: printk(KERN_INFO "Gazel: Card ISA R647/R648 found\n"); cs->dc.isac.adf2 = 0x87; printk(KERN_INFO "Gazel: config irq:%d isac:0x%X cfg:0x%X\n", cs->irq, cs->hw.gazel.isac, cs->hw.gazel.cfg_reg); printk(KERN_INFO "Gazel: hscx A:0x%X hscx B:0x%X\n", cs->hw.gazel.hscx[0], cs->hw.gazel.hscx[1]); break; case R742: printk(KERN_INFO "Gazel: Card ISA R742 found\n"); test_and_set_bit(HW_IPAC, &cs->HW_Flags); printk(KERN_INFO "Gazel: config irq:%d ipac:0x%X\n", cs->irq, cs->hw.gazel.ipac); break; } return (0); } static struct pci_dev *dev_tel __initdata = NULL; static int __init setup_gazelpci(struct IsdnCardState *cs) { u_int pci_ioaddr0 = 0, pci_ioaddr1 = 0; u_char pci_irq = 0, found; u_int nbseek, seekcard; printk(KERN_WARNING "Gazel: PCI card automatic recognition\n"); found = 0; seekcard = <API key>; for (nbseek = 0; nbseek < 4; nbseek++) { if ((dev_tel = pci_find_device(PCI_VENDOR_ID_PLX, seekcard, dev_tel))) { if (pci_enable_device(dev_tel)) return 1; pci_irq = dev_tel->irq; pci_ioaddr0 = pci_resource_start(dev_tel, 1); pci_ioaddr1 = pci_resource_start(dev_tel, 2); found = 1; } if (found) break; else { switch (seekcard) { case <API key>: seekcard = <API key>; break; case <API key>: seekcard = <API key>; break; case <API key>: seekcard = <API key>; break; } } } if (!found) { printk(KERN_WARNING "Gazel: No PCI card found\n"); return (1); } if (!pci_irq) { printk(KERN_WARNING "Gazel: No IRQ for PCI card found\n"); return 1; } cs->hw.gazel.pciaddr[0] = pci_ioaddr0; cs->hw.gazel.pciaddr[1] = pci_ioaddr1; setup_isac(cs); pci_ioaddr1 &= 0xfffe; cs->hw.gazel.cfg_reg = pci_ioaddr0 & 0xfffe; cs->hw.gazel.ipac = pci_ioaddr1; cs->hw.gazel.isac = pci_ioaddr1 + 0x80; cs->hw.gazel.hscx[0] = pci_ioaddr1; cs->hw.gazel.hscx[1] = pci_ioaddr1 + 0x40; cs->hw.gazel.isacfifo = cs->hw.gazel.isac; cs->hw.gazel.hscxfifo[0] = cs->hw.gazel.hscx[0]; cs->hw.gazel.hscxfifo[1] = cs->hw.gazel.hscx[1]; cs->irq = pci_irq; cs->irq_flags |= SA_SHIRQ; switch (seekcard) { case <API key>: printk(KERN_INFO "Gazel: Card PCI R685 found\n"); cs->subtyp = R685; cs->dc.isac.adf2 = 0x87; printk(KERN_INFO "Gazel: config irq:%d isac:0x%X cfg:0x%X\n", cs->irq, cs->hw.gazel.isac, cs->hw.gazel.cfg_reg); printk(KERN_INFO "Gazel: hscx A:0x%X hscx B:0x%X\n", cs->hw.gazel.hscx[0], cs->hw.gazel.hscx[1]); break; case <API key>: case <API key>: case <API key>: printk(KERN_INFO "Gazel: Card PCI R753 found\n"); cs->subtyp = R753; test_and_set_bit(HW_IPAC, &cs->HW_Flags); printk(KERN_INFO "Gazel: config irq:%d ipac:0x%X cfg:0x%X\n", cs->irq, cs->hw.gazel.ipac, cs->hw.gazel.cfg_reg); break; } return (0); } int __init setup_gazel(struct IsdnCard *card) { struct IsdnCardState *cs = card->cs; char tmp[64]; u_char val; strcpy(tmp, gazel_revision); printk(KERN_INFO "Gazel: Driver Revision %s\n", HiSax_getrev(tmp)); if (cs->typ != ISDN_CTYPE_GAZEL) return (0); if (card->para[0]) { if (setup_gazelisa(card, cs)) return (0); } else { #ifdef CONFIG_PCI if (setup_gazelpci(cs)) return (0); #else printk(KERN_WARNING "Gazel: Card PCI requested and NO_PCI_BIOS, unable to config\n"); return (0); #endif /* CONFIG_PCI */ } if (reserve_regions(card, cs)) { return (0); } if (reset_gazel(cs)) { printk(KERN_WARNING "Gazel: wrong IRQ\n"); release_io_gazel(cs); return (0); } cs->readisac = &ReadISAC; cs->writeisac = &WriteISAC; cs->readisacfifo = &ReadISACfifo; cs->writeisacfifo = &WriteISACfifo; cs->BC_Read_Reg = &ReadHSCX; cs->BC_Write_Reg = &WriteHSCX; cs->BC_Send_Data = &hscx_fill_fifo; cs->cardmsg = &Gazel_card_msg; switch (cs->subtyp) { case R647: case R685: cs->irq_func = &gazel_interrupt; ISACVersion(cs, "Gazel:"); if (HscxVersion(cs, "Gazel:")) { printk(KERN_WARNING "Gazel: wrong HSCX versions check IO address\n"); release_io_gazel(cs); return (0); } break; case R742: case R753: cs->irq_func = &<API key>; val = ReadISAC(cs, IPAC_ID - 0x80); printk(KERN_INFO "Gazel: IPAC version %x\n", val); break; } return (1); }
#include <linux/smp.h> #include <linux/cpumask.h> #include <linux/delay.h> #include <linux/init.h> #include <linux/percpu.h> #include <asm/apic.h> #include <asm/nmi.h> #define SUCCESS 0 #define FAILURE 1 #define TIMEOUT 2 static int __initdata nmi_fail; /* check to see if NMI IPIs work on this machine */ static DECLARE_BITMAP(nmi_ipi_mask, NR_CPUS) __initdata; static int __initdata testcase_total; static int __initdata testcase_successes; static int __initdata <API key>; static int __initdata <API key>; static int __initdata <API key>; static int __init nmi_unk_cb(unsigned int val, struct pt_regs *regs) { <API key>++; return NMI_HANDLED; } static void __init init_nmi_testsuite(void) { /* trap all the unknown NMIs we may generate */ <API key>(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk"); } static void __init <API key>(void) { <API key>(NMI_UNKNOWN, "nmi_selftest_unk"); } static int __init <API key>(unsigned int val, struct pt_regs *regs) { int cpu = <API key>(); if (<API key>(cpu, to_cpumask(nmi_ipi_mask))) return NMI_HANDLED; return NMI_DONE; } static void __init test_nmi_ipi(struct cpumask *mask) { unsigned long timeout; if (<API key>(NMI_LOCAL, <API key>, NMI_FLAG_FIRST, "nmi_selftest")) { nmi_fail = FAILURE; return; } /* sync above data before sending NMI */ wmb(); apic->send_IPI_mask(mask, NMI_VECTOR); /* Don't wait longer than a second */ timeout = USEC_PER_SEC; while (!cpumask_empty(mask) && timeout udelay(1); /* What happens if we timeout, do we still unregister?? */ <API key>(NMI_LOCAL, "nmi_selftest"); if (!timeout) nmi_fail = TIMEOUT; return; } static void __init remote_ipi(void) { cpumask_copy(to_cpumask(nmi_ipi_mask), cpu_online_mask); cpumask_clear_cpu(smp_processor_id(), to_cpumask(nmi_ipi_mask)); if (!cpumask_empty(to_cpumask(nmi_ipi_mask))) test_nmi_ipi(to_cpumask(nmi_ipi_mask)); } static void __init local_ipi(void) { cpumask_clear(to_cpumask(nmi_ipi_mask)); cpumask_set_cpu(smp_processor_id(), to_cpumask(nmi_ipi_mask)); test_nmi_ipi(to_cpumask(nmi_ipi_mask)); } static void __init reset_nmi(void) { nmi_fail = 0; } static void __init dotest(void (*testcase_fn)(void), int expected) { testcase_fn(); /* * Filter out expected failures: */ if (nmi_fail != expected) { <API key>++; if (nmi_fail == FAILURE) printk(KERN_CONT "FAILED |"); else if (nmi_fail == TIMEOUT) printk(KERN_CONT "TIMEOUT|"); else printk(KERN_CONT "ERROR |"); dump_stack(); } else { testcase_successes++; printk(KERN_CONT " ok |"); } testcase_total++; reset_nmi(); } static inline void __init print_testname(const char *testname) { printk("%12s:", testname); } void __init nmi_selftest(void) { init_nmi_testsuite(); /* * Run the testsuite: */ printk(" printk("| NMI testsuite:\n"); printk(" print_testname("remote IPI"); dotest(remote_ipi, SUCCESS); printk(KERN_CONT "\n"); print_testname("local IPI"); dotest(local_ipi, SUCCESS); printk(KERN_CONT "\n"); <API key>(); if (<API key>) { printk(" printk("BUG: %3d unexpected failures (out of %3d) - debugging disabled! |\n", <API key>, testcase_total); printk(" } else if (<API key> && testcase_successes) { printk(" printk("%3d out of %3d testcases failed, as expected. |\n", <API key>, testcase_total); printk(" } else if (<API key> && !testcase_successes) { printk(" printk("All %3d testcases failed, as expected. |\n", <API key>); printk(" } else { printk(" printk("Good, all %3d testcases passed! |\n", testcase_successes); printk(" } }
DROP DATABASE IF EXISTS test; CREATE DATABASE test; USE test; CREATE TABLE `test_empty` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; CREATE TABLE `test_full` ( `id` int(11) NOT NULL AUTO_INCREMENT, `d` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; INSERT INTO `test_full` (`id`, `d`) VALUES (1, '2');
#ifndef MTL_ORIEN_H #define MTL_ORIEN_H namespace mtl { struct row_orien; struct column_orien; struct row_major; struct column_major; //: Row Orientation // This is used in <API key> and in the indexer objects // to map (row,column) to (major,minor). struct row_orien { template <int MM, int NN> struct dims { enum { M = MM, N = NN }; }; typedef row_tag orientation; typedef row_major constructor_tag; typedef column_orien transpose_type; template <class Dim> static typename Dim::size_type row(Dim d) { return d.first(); } template <class Dim> static typename Dim::size_type column(Dim d){ return d.second();} template <class Dim> static Dim map(Dim d) { return d; } }; //: Column Orientation // This is used in <API key> and in the indexer objects // to map (row,column) to (minor,major). struct column_orien { template <int MM, int NN> struct dims { enum { M = NN, N = MM }; }; typedef column_tag orientation; typedef row_orien transpose_type; typedef column_major constructor_tag; template <class Dim> static typename Dim::size_type row(Dim d) { return d.second(); } template <class Dim> static typename Dim::size_type column(Dim d){ return d.first(); } #if 0 /* the static dim has already been transposed in matrix.h so no need to do it here */ template <class Dim> static typename Dim::transpose_type map(Dim d) { return d.transpose(); } #else template <class Dim> static Dim map(Dim d) { return Dim(d.second(), d.first()); } #endif }; } /* namespace mtl */ #endif /* MTL_ORIEN_H */
#include "lastexpress/entities/pascale.h" #include "lastexpress/game/entities.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" #include "lastexpress/game/state.h" #include "lastexpress/sound/queue.h" #include "lastexpress/lastexpress.h" namespace LastExpress { Pascale::Pascale(LastExpressEngine *engine) : Entity(engine, kEntityPascale) { <API key>(Pascale, draw); <API key>(Pascale, <API key>); <API key>(Pascale, <API key>); <API key>(Pascale, updateFromTime); <API key>(Pascale, updatePosition); <API key>(Pascale, playSound); <API key>(Pascale, draw2); <API key>(Pascale, <API key>); <API key>(Pascale, sitSophieAndRebecca); <API key>(Pascale, welcomeCath); <API key>(Pascale, function11); <API key>(Pascale, chapter1); <API key>(Pascale, <API key>); <API key>(Pascale, sitAnna); <API key>(Pascale, welcomeAnna); <API key>(Pascale, serveTatianaVassili); <API key>(Pascale, chapter1Handler); <API key>(Pascale, function18); <API key>(Pascale, function19); <API key>(Pascale, chapter2); <API key>(Pascale, chapter3); <API key>(Pascale, chapter3Handler); <API key>(Pascale, function23); <API key>(Pascale, welcomeAbbot); <API key>(Pascale, chapter4); <API key>(Pascale, chapter4Handler); <API key>(Pascale, function27); <API key>(Pascale, messageFromAnna); <API key>(Pascale, function29); <API key>(Pascale, function30); <API key>(Pascale, chapter5); <API key>(Pascale, chapter5Handler); <API key>(Pascale, function33); ADD_NULL_FUNCTION(); } <API key>(1, Pascale, draw) Entity::draw(savepoint, true); <API key> IMPLEMENT_FUNCTION(2, Pascale, <API key>) Entity::<API key>(savepoint); <API key> IMPLEMENT_FUNCTION(3, Pascale, <API key>) if (savepoint.action == kActionExcuseMeCath) { if (!params->param1) { getSound()->excuseMe(kEntityPascale); params->param1 = 1; } return; } Entity::<API key>(savepoint); <API key> <API key>(4, Pascale, updateFromTime, uint32) Entity::updateFromTime(savepoint); <API key> <API key>(5, Pascale, updatePosition) Entity::updatePosition(savepoint, true); <API key> <API key>(6, Pascale, playSound) Entity::playSound(savepoint); <API key> <API key>(7, Pascale, draw2) Entity::draw2(savepoint); <API key> IMPLEMENT_FUNCTION(8, Pascale, <API key>) switch (savepoint.action) { default: break; case kActionDefault: getData()->entityPosition = kPosition_850; getData()->location = <API key>; setCallback(1); setup_draw("901"); break; case kActionCallback: switch (getCallback()) { default: break; case 1: switch (getProgress().chapter) { default: break; case kChapter1: getSound()->playSound(kEntityPascale, "REB1198", kFlagInvalid, 30); break; case kChapter3: getSound()->playSound(kEntityPascale, "REB3001", kFlagInvalid, 30); break; case kChapter4: getSound()->playSound(kEntityPascale, "REB4001", kFlagInvalid, 30); break; } setCallback(2); <API key>(); break; case 2: getSavePoints()->push(kEntityPascale, kEntityRebecca, kAction157370960); setCallback(3); setup_draw("905"); break; case 3: getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_5900; ENTITY_PARAM(0, 4) = 0; callbackAction(); break; } break; } <API key> IMPLEMENT_FUNCTION(9, Pascale, sitSophieAndRebecca) switch (savepoint.action) { default: break; case <API key>: callbackAction(); break; case kActionDefault: getEntities()->drawSequenceLeft(kEntityPascale, "012C1"); getEntities()->drawSequenceLeft(kEntityRebecca, "012C2"); getEntities()->drawSequenceLeft(kEntityTables3, "012C3"); break; } <API key> IMPLEMENT_FUNCTION(10, Pascale, welcomeCath) switch (savepoint.action) { default: break; case kActionNone: if (params->param1 && !getSoundQueue()->isBuffered(kEntityPascale)) getEntities()->updatePositionExit(kEntityPascale, kCarRestaurant, 64); break; case <API key>: if (!params->param2) { params->param2 = 1; getSound()->playSound(kEntityPascale, "HED1001A"); getSound()->playSound(kEntityPlayer, "LIB004"); getScenes()-><API key>(kCarRestaurant, 69); } callbackAction(); break; case kAction4: if (!params->param1) { params->param1 = 1; getSound()->playSound(kEntityPascale, "HED1001"); } break; case kActionDefault: getEntities()->updatePositionEnter(kEntityPascale, kCarRestaurant, 64); getEntities()->drawSequenceRight(kEntityPascale, "035A"); break; case kActionDrawScene: if (params->param1 && getEntities()->isPlayerPosition(kCarRestaurant, 64)) { getSound()->playSound(kEntityPascale, "HED1001A"); getSound()->playSound(kEntityPlayer, "LIB004"); getScenes()-><API key>(kCarRestaurant, 69); callbackAction(); } break; } <API key> IMPLEMENT_FUNCTION(11, Pascale, function11) switch (savepoint.action) { default: break; case kActionDefault: getData()->entityPosition = kPosition_5800; getData()->location = <API key>; getSavePoints()->push(kEntityPascale, kEntityAugust, kAction168046720); getSavePoints()->push(kEntityPascale, kEntityAnna, kAction168046720); getSavePoints()->push(kEntityPascale, kEntityAlexei, kAction168046720); getEntities()->updatePositionEnter(kEntityPascale, kCarRestaurant, 55); setCallback(1); setup_welcomeCath(); break; case kActionCallback: switch (getCallback()) { default: break; case 1: getSavePoints()->push(kEntityPascale, kEntityAugust, kAction168627977); getSavePoints()->push(kEntityPascale, kEntityAnna, kAction168627977); getSavePoints()->push(kEntityPascale, kEntityAlexei, kAction168627977); getEntities()->updatePositionExit(kEntityPascale, kCarRestaurant, 55); setCallback(2); setup_draw("905"); break; case 2: getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_5900; callbackAction(); break; } break; } <API key> IMPLEMENT_FUNCTION(12, Pascale, chapter1) switch (savepoint.action) { default: break; case kActionNone: <API key>(); break; case kActionDefault: getSavePoints()->addData(kEntityPascale, kAction239072064, 0); getSavePoints()->addData(kEntityPascale, kAction257489762, 2); getSavePoints()->addData(kEntityPascale, kAction207769280, 6); getSavePoints()->addData(kEntityPascale, kAction101824388, 7); getSavePoints()->addData(kEntityPascale, kAction136059947, 8); getSavePoints()->addData(kEntityPascale, kAction223262556, 1); getSavePoints()->addData(kEntityPascale, kAction269479296, 3); getSavePoints()->addData(kEntityPascale, kAction352703104, 4); getSavePoints()->addData(kEntityPascale, kAction352768896, 5); getSavePoints()->addData(kEntityPascale, kAction191604416, 10); getSavePoints()->addData(kEntityPascale, kAction190605184, 11); getData()->entityPosition = kPosition_5900; getData()->location = <API key>; getData()->car = kCarRestaurant; break; } <API key> IMPLEMENT_FUNCTION(13, Pascale, <API key>) switch (savepoint.action) { default: break; case kActionDefault: getData()->entityPosition = kPosition_5800; getData()->location = <API key>; setCallback(1); setup_draw("902"); break; case kActionCallback: switch (getCallback()) { default: break; case 1: if (!ENTITY_PARAM(1, 3)) { getEntities()->drawSequenceLeft(kEntityPascale, "010E"); getEntities()->drawSequenceLeft(kEntityAugust, "BLANK"); setCallback(2); setup_playSound("AUG1001"); break; } setCallback(3); setup_draw("905"); break; case 2: getEntities()->drawSequenceLeft(kEntityPascale, "010B"); setCallback(3); setup_draw("905"); break; case 3: getData()->entityPosition = kPosition_5900; getEntities()->clearSequences(kEntityPascale); getSavePoints()->push(kEntityPascale, kEntityVerges, <API key>); ENTITY_PARAM(0, 1) = 0; callbackAction(); break; } break; } <API key> IMPLEMENT_FUNCTION(14, Pascale, sitAnna) switch (savepoint.action) { default: break; case <API key>: getEntities()->updatePositionExit(kEntityPascale, kCarRestaurant, 62); callbackAction(); break; case kActionDefault: getEntities()->drawSequenceRight(kEntityTables0, "001C3"); getEntities()->drawSequenceRight(kEntityAnna, "001C2"); getEntities()->drawSequenceRight(kEntityPascale, "001C1"); getEntities()->updatePositionEnter(kEntityPascale, kCarRestaurant, 62); break; } <API key> IMPLEMENT_FUNCTION(15, Pascale, welcomeAnna) switch (savepoint.action) { default: break; case kActionDefault: getData()->entityPosition = kPosition_5800; getData()->location = <API key>; setCallback(1); setup_draw("901"); break; case kActionCallback: switch (getCallback()) { default: break; case 1: getSound()->playSound(kEntityPascale, "ANN1047"); setCallback(2); setup_sitAnna(); break; case 2: getSavePoints()->push(kEntityPascale, kEntityAnna, kAction157370960); setCallback(3); setup_draw("904"); break; case 3: getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_5900; ENTITY_PARAM(0, 2) = 0; callbackAction(); break; } break; } <API key> IMPLEMENT_FUNCTION(16, Pascale, serveTatianaVassili) switch (savepoint.action) { default: break; case kActionDefault: getData()->entityPosition = kPosition_5800; getData()->location = <API key>; setCallback(1); setup_draw("903"); break; case kActionCallback: switch (getCallback()) { default: break; case 1: getSavePoints()->push(kEntityPascale, kEntityTatiana, kAction122358304); getEntities()->drawSequenceLeft(kEntityPascale, "014B"); getEntities()->updatePositionEnter(kEntityPascale, kCarRestaurant, 67); if (getSoundQueue()->isBuffered("TAT1069A")) getSoundQueue()->processEntry("TAT1069A"); else if (getSoundQueue()->isBuffered("TAT1069B")) getSoundQueue()->processEntry("TAT1069B"); setCallback(2); setup_playSound("TAT1066"); break; case 2: getEntities()->updatePositionExit(kEntityPascale, kCarRestaurant, 67); getSavePoints()->push(kEntityPascale, kEntityTatiana, kAction122288808); setCallback(3); setup_draw("906"); break; case 3: getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_5900; ENTITY_PARAM(0, 3) = 0; callbackAction(); break; } break; } <API key> IMPLEMENT_FUNCTION(17, Pascale, chapter1Handler) switch (savepoint.action) { default: break; case kActionNone: if (!params->param2) { if (getEntities()->isPlayerPosition(kCarRestaurant, 69) || getEntities()->isPlayerPosition(kCarRestaurant, 70) || getEntities()->isPlayerPosition(kCarRestaurant, 71)) params->param2 = 1; if (!params->param2 && getEntities()->isPlayerPosition(kCarRestaurant, 61)) params->param1 = 1; } if (!getEntities()->isInKitchen(kEntityPascale)) break; if (ENTITY_PARAM(0, 5) && ENTITY_PARAM(0, 6)) { setup_function18(); break; } if (!getEntities()-><API key>()) goto label_callback3; if (params->param1 && !params->param2 && getEntities()->isPlayerPosition(kCarRestaurant, 61)) { setCallback(1); setup_function11(); break; } label_callback1: if (ENTITY_PARAM(0, 1) && !ENTITY_PARAM(1, 3)) { setCallback(2); <API key>(); break; } label_callback2: if (ENTITY_PARAM(0, 3)) { setCallback(3); <API key>(); break; } label_callback3: if (ENTITY_PARAM(0, 2)) { setCallback(4); setup_welcomeAnna(); break; } label_callback4: if (ENTITY_PARAM(0, 4)) { setCallback(5); <API key>(); } break; case kActionCallback: switch (getCallback()) { default: break; case 1: params->param1 = 0; params->param2 = 1; goto label_callback1; case 2: goto label_callback2; case 3: goto label_callback3; case 4: goto label_callback4; } break; } <API key> IMPLEMENT_FUNCTION(18, Pascale, function18) if (savepoint.action != kActionNone) return; if (getState()->time > kTime1242000 && !params->param1) { params->param1 = 1; getSavePoints()->push(kEntityPascale, kEntityServers0, kAction101632192); getSavePoints()->push(kEntityPascale, kEntityServers1, kAction101632192); getSavePoints()->push(kEntityPascale, kEntityCooks, kAction101632192); getSavePoints()->push(kEntityPascale, kEntityVerges, kAction101632192); setup_function19(); } <API key> IMPLEMENT_FUNCTION(19, Pascale, function19) switch (savepoint.action) { default: break; case kActionNone: if (!params->param1 && getEntityData(kEntityPlayer)->entityPosition < kPosition_3650) { getObjects()->update(kObject65, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand); getSavePoints()->push(kEntityPascale, kEntityTables0, <API key>, "001P"); getSavePoints()->push(kEntityPascale, kEntityTables1, <API key>, "005J"); getSavePoints()->push(kEntityPascale, kEntityTables2, <API key>, "009G"); getSavePoints()->push(kEntityPascale, kEntityTables3, <API key>, "010M"); getSavePoints()->push(kEntityPascale, kEntityTables4, <API key>, "014F"); getSavePoints()->push(kEntityPascale, kEntityTables5, <API key>, "024D"); params->param1 = 1; } break; case kActionDefault: getData()->car = kCarRestaurant; getData()->entityPosition = kPosition_5900; getData()->location = <API key>; getEntities()->clearSequences(kEntityPascale); break; } <API key> IMPLEMENT_FUNCTION(20, Pascale, chapter2) if (savepoint.action == kActionDefault) { getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_5900; getData()->location = <API key>; getData()->car = kCarRestaurant; getData()->clothes = kClothes1; getData()->inventoryItem = kItemNone; getObjects()->update(kObject65, kEntityPlayer, kObjectLocationNone, kCursorNormal, kCursorForward); } <API key> IMPLEMENT_FUNCTION(21, Pascale, chapter3) switch (savepoint.action) { default: break; case kActionNone: <API key>(); break; case kActionDefault: getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_5900; getData()->location = <API key>; getData()->car = kCarRestaurant; getData()->inventoryItem = kItemNone; ENTITY_PARAM(0, 4) = 0; ENTITY_PARAM(0, 7) = 0; break; } <API key> IMPLEMENT_FUNCTION(22, Pascale, chapter3Handler) switch (savepoint.action) { default: break; case kActionNone: if (!getEntities()->isInKitchen(kEntityPascale)) break; if (ENTITY_PARAM(0, 7)) { setCallback(1); setup_function23(); break; } label_callback: if (ENTITY_PARAM(0, 4)) { setCallback(2); <API key>(); } break; case kActionCallback: if (getCallback() == 1) goto label_callback; break; } <API key> IMPLEMENT_FUNCTION(23, Pascale, function23) switch (savepoint.action) { default: break; case kActionDefault: getData()->entityPosition = kPosition_5800; getData()->location = <API key>; getEntities()->updatePositionEnter(kEntityPascale, kCarRestaurant, 67); setCallback(1); setup_welcomeAbbot(); break; case kActionCallback: switch (getCallback()) { default: break; case 1: getEntities()->updatePositionExit(kEntityPascale, kCarRestaurant, 67); getSavePoints()->push(kEntityPascale, kEntityAbbot, kAction122288808); setCallback(2); setup_draw("906"); break; case 2: getData()->entityPosition = kPosition_5900; ENTITY_PARAM(0, 7) = 0; getEntities()->clearSequences(kEntityPascale); callbackAction(); break; } break; } <API key> IMPLEMENT_FUNCTION(24, Pascale, welcomeAbbot) switch (savepoint.action) { default: break; case kActionNone: if (!params->param1) { getSound()->playSound(kEntityPascale, "ABB3015A"); params->param1 = 1; } break; case <API key>: callbackAction(); break; case kAction10: getSavePoints()->push(kEntityPascale, kEntityTables4, kAction136455232); break; case kActionDefault: getSound()->playSound(kEntityPascale, "ABB3015", kFlagInvalid, 105); getEntities()->drawSequenceRight(kEntityPascale, "029A1"); getEntities()->drawSequenceRight(kEntityAbbot, "029A2"); break; } <API key> IMPLEMENT_FUNCTION(25, Pascale, chapter4) switch (savepoint.action) { default: break; case kActionNone: <API key>(); break; case kActionDefault: getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_5900; getData()->location = <API key>; getData()->car = kCarRestaurant; getData()->inventoryItem = kItemNone; ENTITY_PARAM(0, 4) = 0; ENTITY_PARAM(0, 8) = 0; ENTITY_PARAM(1, 1) = 0; ENTITY_PARAM(1, 2) = 0; break; } <API key> IMPLEMENT_FUNCTION(26, Pascale, chapter4Handler) switch (savepoint.action) { default: break; case kActionNone: if (getState()->time > kTime2511000 && !params->param4) { params->param2 = 1; params->param4 = 1; } if (!getEntities()->isInKitchen(kEntityPascale)) break; if (getEntities()-><API key>()) { if (ENTITY_PARAM(0, 8)) { setCallback(1); setup_function27(); break; } label_callback1: if (ENTITY_PARAM(1, 2) && ENTITY_PARAM(1, 4)) { if (!params->param3) params->param3 = (uint)(getState()->time + 9000); if (params->param5 != kTimeInvalid) { if (params->param3 < getState()->time) { params->param5 = kTimeInvalid; setCallback(2); <API key>(); break; } if (!getEntities()->isInRestaurant(kEntityPlayer) || !params->param5) params->param5 = (uint)getState()->time; if (params->param5 < getState()->time) { params->param5 = kTimeInvalid; setCallback(2); <API key>(); break; } } } label_callback2: if (params->param1 && !params->param2 && getEntities()->isPlayerPosition(kCarRestaurant, 61)) { setCallback(3); setup_function11(); break; } } label_callback3: if (ENTITY_PARAM(0, 4)) { setCallback(4); <API key>(); } break; case kActionDefault: if (getEntities()->isPlayerPosition(kCarRestaurant, 69) || getEntities()->isPlayerPosition(kCarRestaurant, 70) || getEntities()->isPlayerPosition(kCarRestaurant, 71)) params->param2 = 1; break; case kActionDrawScene: if (!params->param2) { if (getEntities()->isPlayerPosition(kCarRestaurant, 69) || getEntities()->isPlayerPosition(kCarRestaurant, 70) || getEntities()->isPlayerPosition(kCarRestaurant, 71)) params->param2 = 1; if (!params->param2 && getEntities()->isPlayerPosition(kCarRestaurant, 61)) params->param1 = 1; } break; case kActionCallback: switch (getCallback()) { default: break; case 1: goto label_callback1; case 2: goto label_callback2; case 3: params->param1 = 0; params->param2 = 1; goto label_callback3; } break; case kAction201431954: ENTITY_PARAM(0, 4) = 0; ENTITY_PARAM(0, 8) = 0; getSavePoints()->push(kEntityPascale, kEntityTables0, <API key>, "001P"); getSavePoints()->push(kEntityPascale, kEntityTables1, <API key>, "005J"); getSavePoints()->push(kEntityPascale, kEntityTables2, <API key>, "009G"); getSavePoints()->push(kEntityPascale, kEntityTables3, <API key>, "010M"); getSavePoints()->push(kEntityPascale, kEntityTables4, <API key>, "014F"); getSavePoints()->push(kEntityPascale, kEntityTables5, <API key>, "024D"); getData()->entityPosition = kPosition_5900; getData()->location = <API key>; break; } <API key> IMPLEMENT_FUNCTION(27, Pascale, function27) switch (savepoint.action) { default: break; case kActionNone: if (ENTITY_PARAM(1, 1)) { setCallback(2); <API key>(450); } break; case kActionDefault: setCallback(1); setup_function29(); break; case kActionCallback: switch (getCallback()) { default: break; case 1: getEntities()->clearSequences(kEntityPascale); break; case 2: getSavePoints()->push(kEntityPascale, kEntityCoudert, kAction123712592); setCallback(3); <API key>(); break; case 3: setCallback(4); setup_function30(); break; case 4: getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_5900; ENTITY_PARAM(0, 8) = 0; ENTITY_PARAM(1, 1) = 0; ENTITY_PARAM(1, 2) = 1; callbackAction(); break; } break; } <API key> IMPLEMENT_FUNCTION(28, Pascale, messageFromAnna) switch (savepoint.action) { default: break; case kActionDefault: getData()->entityPosition = kPosition_5800; getData()->location = <API key>; setCallback(1); setup_draw("902"); break; case kActionCallback: switch (getCallback()) { default: break; case 1: getSavePoints()->push(kEntityPascale, kEntityAugust, kAction122358304); getEntities()->drawSequenceLeft(kEntityPascale, "010E2"); setCallback(2); setup_playSound("Aug4001"); break; case 2: getSavePoints()->push(kEntityPascale, kEntityAugust, kAction123793792); setCallback(3); setup_draw("905"); break; case 3: getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_5900; ENTITY_PARAM(1, 2) = 0; callbackAction(); break; } break; } <API key> IMPLEMENT_FUNCTION(29, Pascale, function29) switch (savepoint.action) { default: break; case kActionDefault: getData()->entityPosition = kPosition_1540; getData()->location = <API key>; setCallback(1); setup_draw("817DD"); break; case kActionCallback: switch (getCallback()) { default: break; case 1: getEntities()->drawSequenceRight(kEntityPascale, "817DS"); if (getEntities()->isInRestaurant(kEntityPlayer)) getEntities()->updateFrame(kEntityPascale); setCallback(2); <API key>(); break; case 2: getData()->entityPosition = kPosition_850; callbackAction(); break; } break; } <API key> IMPLEMENT_FUNCTION(30, Pascale, function30) switch (savepoint.action) { default: break; case kActionDefault: getData()->entityPosition = kPosition_9270; getData()->location = <API key>; setCallback(1); setup_draw("817US"); break; case kActionCallback: switch (getCallback()) { default: break; case 1: getEntities()->drawSequenceRight(kEntityPascale, "817UD"); if (getEntities()->isInSalon(kEntityPlayer)) getEntities()->updateFrame(kEntityPascale); setCallback(2); <API key>(); break; case 2: getData()->entityPosition = kPosition_5900; callbackAction(); break; } break; } <API key> IMPLEMENT_FUNCTION(31, Pascale, chapter5) switch (savepoint.action) { default: break; case kActionNone: <API key>(); break; case kActionDefault: getEntities()->clearSequences(kEntityPascale); getData()->entityPosition = kPosition_3969; getData()->location = <API key>; getData()->car = kCarRestaurant; getData()->inventoryItem = kItemNone; break; } <API key> IMPLEMENT_FUNCTION(32, Pascale, chapter5Handler) if (savepoint.action == <API key>) setup_function33(); <API key> IMPLEMENT_FUNCTION(33, Pascale, function33) switch (savepoint.action) { default: break; case kActionNone: if (params->param4) { if (Entity::updateParameter(params->param5, getState()->time, 4500)) { getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorNormal, kCursorNormal); setCallback(1); setup_playSound("Wat5010"); break; } } label_callback1: if (params->param1) { if (!Entity::updateParameter(params->param6, getState()->timeTicks, 75)) break; params->param1 = 0; params->param2 = 2; getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorNormal, kCursorNormal); } params->param6 = 0; break; case kActionKnock: case kActionOpenDoor: if (params->param1) { getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorNormal, kCursorNormal); params->param1 = 0; setCallback(2); setup_playSound(getSound()->justCheckingCath()); } else { setCallback(savepoint.action == kActionKnock ? 3 : 4); setup_playSound(savepoint.action == kActionKnock ? "LIB012" : "LIB013"); } break; case kActionDefault: getData()->car = kCarRedSleeping; getData()->entityPosition = kPosition_3050; getData()->location = <API key>; getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorHandKnock, kCursorHand); break; case kActionDrawScene: if (params->param2 || params->param1) { params->param1 = 0; params->param2 = 0; params->param3 = 0; getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorHandKnock, kCursorHand); } break; case kActionCallback: switch (getCallback()) { default: break; case 1: getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorHandKnock, kCursorHand); goto label_callback1; case 2: getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorHandKnock, kCursorHand); break; case 3: case 4: params->param3++; if (params->param3 == 1 || params->param3 == 2) { getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorNormal, kCursorNormal); setCallback(params->param3 == 1 ? 5 : 6); setup_playSound(params->param3 == 1 ? "Wat5001" : "Wat5002"); } break; case 5: params->param1 = 1; getObjects()->update(kObjectCompartmentG, kEntityPascale, kObjectLocation1, kCursorTalk, kCursorNormal); break; case 6: params->param2 = 1; break; case 7: params->param4 = 1; break; } break; case kAction135800432: setup_nullfunction(); break; case kAction169750080: if (getSoundQueue()->isBuffered(kEntityPascale)) { params->param4 = 1; } else { setCallback(7); setup_playSound("Wat5002"); } break; } <API key> <API key>(34, Pascale) } // End of namespace LastExpress
#ifndef _PTHREAD_H #define _PTHREAD_H 1 #include <features.h> #include <endian.h> #include <sched.h> #include <time.h> #include <bits/pthreadtypes.h> #include <bits/setjmp.h> #include <bits/wordsize.h> /* Detach state. */ enum { <API key>, #define <API key> <API key> <API key> #define <API key> <API key> }; /* Mutex types. */ enum { <API key>, <API key>, <API key>, <API key> #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 , <API key> = <API key>, <API key> = <API key>, <API key> = <API key>, <API key> = <API key> #endif #ifdef __USE_GNU /* For compatibility. */ , <API key> = <API key> #endif }; #ifdef __USE_XOPEN2K /* Robust mutex or not flags. */ enum { <API key>, <API key> = <API key>, <API key>, <API key> = <API key> }; #endif #if defined __USE_POSIX199506 || defined __USE_UNIX98 /* Mutex protocols. */ enum { PTHREAD_PRIO_NONE, <API key>, <API key> }; #endif /* Mutex initializers. */ #ifdef <API key> # define <API key> \ { { 0, 0, 0, 0, 0, 0, { 0, 0 } } } # ifdef __USE_GNU # define <API key> \ { { 0, 0, 0, 0, <API key>, 0, { 0, 0 } } } # define <API key> \ { { 0, 0, 0, 0, <API key>, 0, { 0, 0 } } } # define <API key> \ { { 0, 0, 0, 0, <API key>, 0, { 0, 0 } } } # endif #else # define <API key> \ { { 0, 0, 0, 0, 0, { 0 } } } # ifdef __USE_GNU # define <API key> \ { { 0, 0, 0, <API key>, 0, { 0 } } } # define <API key> \ { { 0, 0, 0, <API key>, 0, { 0 } } } # define <API key> \ { { 0, 0, 0, <API key>, 0, { 0 } } } # endif #endif /* Read-write lock types. */ #if defined __USE_UNIX98 || defined __USE_XOPEN2K enum { <API key>, <API key>, <API key>, <API key> = <API key> }; /* Define <API key> to 1 if pthread_rwlock_t has the shared field. All 64-bit architectures have the shared field in pthread_rwlock_t. */ #ifndef <API key> # if __WORDSIZE == 64 # define <API key> 1 # endif #endif /* Read-write lock initializers. */ # define <API key> \ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } # ifdef __USE_GNU # ifdef <API key> # define <API key> \ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ <API key> } } # else # if __BYTE_ORDER == __LITTLE_ENDIAN # define <API key> \ { { 0, 0, 0, 0, 0, 0, <API key>, \ 0, 0, 0, 0 } } # else # define <API key> \ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, <API key>,\ 0 } } # endif # endif # endif #endif /* Unix98 or XOpen2K */ /* Scheduler inheritance. */ enum { <API key>, #define <API key> <API key> <API key> #define <API key> <API key> }; /* Scope handling. */ enum { <API key>, #define <API key> <API key> <API key> #define <API key> <API key> }; /* Process shared or private flag. */ enum { <API key>, #define <API key> <API key> <API key> #define <API key> <API key> }; /* Conditional variable handling. */ #define <API key> { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } } /* Cleanup buffers */ struct <API key> { void (*__routine) (void *); /* Function to call. */ void *__arg; /* Its argument. */ int __canceltype; /* Saved cancellation type. */ struct <API key> *__prev; /* Chaining of cleanup functions. */ }; /* Cancellation */ enum { <API key>, #define <API key> <API key> <API key> #define <API key> <API key> }; enum { <API key>, #define <API key> <API key> <API key> #define <API key> <API key> }; #define PTHREAD_CANCELED ((void *) -1) /* Single execution handling. */ #define PTHREAD_ONCE_INIT 0 #ifdef __USE_XOPEN2K /* Value returned by '<API key>' for one of the threads after the required number of threads have called this function. -1 is distinct from 0 and all errno constants */ # define <API key> -1 #endif __BEGIN_DECLS /* Create a new thread, starting with execution of START-ROUTINE getting passed ARG. Creation attributed come from ATTR. The new handle is stored in *NEWTHREAD. */ extern int pthread_create (pthread_t *__restrict __newthread, const pthread_attr_t *__restrict __attr, void *(*__start_routine) (void *), void *__restrict __arg) __THROWNL __nonnull ((1, 3)); /* Terminate calling thread. The registered cleanup handlers are called via exception handling so we cannot mark this function with __THROW.*/ extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__)); /* Make calling thread wait for termination of the thread TH. The exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN is not NULL. This function is a cancellation point and therefore not marked with __THROW. */ extern int pthread_join (pthread_t __th, void **__thread_return); #ifdef __USE_GNU /* Check whether thread TH has terminated. If yes return the status of the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; /* Make calling thread wait for termination of the thread TH, but only until TIMEOUT. The exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN is not NULL. This function is a cancellation point and therefore not marked with __THROW. */ extern int <API key> (pthread_t __th, void **__thread_return, const struct timespec *__abstime); #endif /* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. The resources of TH will therefore be freed immediately when it terminates, instead of waiting for another thread to perform PTHREAD_JOIN on it. */ extern int pthread_detach (pthread_t __th) __THROW; /* Obtain the identifier of the current thread. */ extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__)); /* Compare two thread identifiers. */ extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW __attribute__ ((__const__)); /* Thread attribute handling. */ /* Initialize thread attribute *ATTR with default attributes (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER, no user-provided stack). */ extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1)); /* Destroy thread attribute *ATTR. */ extern int <API key> (pthread_attr_t *__attr) __THROW __nonnull ((1)); /* Get detach state attribute. */ extern int <API key> (const pthread_attr_t *__attr, int *__detachstate) __THROW __nonnull ((1, 2)); /* Set detach state attribute. */ extern int <API key> (pthread_attr_t *__attr, int __detachstate) __THROW __nonnull ((1)); /* Get the size of the guard area created for stack overflow protection. */ extern int <API key> (const pthread_attr_t *__attr, size_t *__guardsize) __THROW __nonnull ((1, 2)); /* Set the size of the guard area created for stack overflow protection. */ extern int <API key> (pthread_attr_t *__attr, size_t __guardsize) __THROW __nonnull ((1)); /* Return in *PARAM the scheduling parameters of *ATTR. */ extern int <API key> (const pthread_attr_t *__restrict __attr, struct sched_param *__restrict __param) __THROW __nonnull ((1, 2)); /* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */ extern int <API key> (pthread_attr_t *__restrict __attr, const struct sched_param *__restrict __param) __THROW __nonnull ((1, 2)); /* Return in *POLICY the scheduling policy of *ATTR. */ extern int <API key> (const pthread_attr_t *__restrict __attr, int *__restrict __policy) __THROW __nonnull ((1, 2)); /* Set scheduling policy in *ATTR according to POLICY. */ extern int <API key> (pthread_attr_t *__attr, int __policy) __THROW __nonnull ((1)); /* Return in *INHERIT the scheduling inheritance mode of *ATTR. */ extern int <API key> (const pthread_attr_t *__restrict __attr, int *__restrict __inherit) __THROW __nonnull ((1, 2)); /* Set scheduling inheritance mode in *ATTR according to INHERIT. */ extern int <API key> (pthread_attr_t *__attr, int __inherit) __THROW __nonnull ((1)); /* Return in *SCOPE the scheduling contention scope of *ATTR. */ extern int <API key> (const pthread_attr_t *__restrict __attr, int *__restrict __scope) __THROW __nonnull ((1, 2)); /* Set scheduling contention scope in *ATTR according to SCOPE. */ extern int <API key> (pthread_attr_t *__attr, int __scope) __THROW __nonnull ((1)); /* Return the previously set address for the stack. */ extern int <API key> (const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr) __THROW __nonnull ((1, 2)) <API key>; /* Set the starting address of the stack of the thread to be created. Depending on whether the stack grows up or down the value must either be higher or lower than all the address in the memory block. The minimal size of the block must be PTHREAD_STACK_MIN. */ extern int <API key> (pthread_attr_t *__attr, void *__stackaddr) __THROW __nonnull ((1)) <API key>; /* Return the currently used minimal stack size. */ extern int <API key> (const pthread_attr_t *__restrict __attr, size_t *__restrict __stacksize) __THROW __nonnull ((1, 2)); /* Add information about the minimum stack size needed for the thread to be started. This size must never be less than PTHREAD_STACK_MIN and must also not exceed the system limits. */ extern int <API key> (pthread_attr_t *__attr, size_t __stacksize) __THROW __nonnull ((1)); #ifdef __USE_XOPEN2K /* Return the previously set address for the stack. */ extern int <API key> (const pthread_attr_t *__restrict __attr, void **__restrict __stackaddr, size_t *__restrict __stacksize) __THROW __nonnull ((1, 2, 3)); /* The following two interfaces are intended to replace the last two. They require setting the address as well as the size since only setting the address will make the implementation on some architectures impossible. */ extern int <API key> (pthread_attr_t *__attr, void *__stackaddr, size_t __stacksize) __THROW __nonnull ((1)); #endif #ifdef __USE_GNU /* Thread created with attribute ATTR will be limited to run only on the processors represented in CPUSET. */ extern int <API key> (pthread_attr_t *__attr, size_t __cpusetsize, const cpu_set_t *__cpuset) __THROW __nonnull ((1, 3)); /* Get bit set in CPUSET representing the processors threads created with ATTR can run on. */ extern int <API key> (const pthread_attr_t *__attr, size_t __cpusetsize, cpu_set_t *__cpuset) __THROW __nonnull ((1, 3)); /* Initialize thread attribute *ATTR with attributes corresponding to the already running thread TH. It shall be called on uninitialized ATTR and destroyed with <API key> when no longer needed. */ extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) __THROW __nonnull ((2)); #endif /* Functions for scheduling control. */ /* Set the scheduling parameters for TARGET_THREAD according to POLICY and *PARAM. */ extern int <API key> (pthread_t __target_thread, int __policy, const struct sched_param *__param) __THROW __nonnull ((3)); /* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */ extern int <API key> (pthread_t __target_thread, int *__restrict __policy, struct sched_param *__restrict __param) __THROW __nonnull ((2, 3)); /* Set the scheduling priority for TARGET_THREAD. */ extern int <API key> (pthread_t __target_thread, int __prio) __THROW; #ifdef __USE_GNU /* Get thread name visible in the kernel and its interfaces. */ extern int pthread_getname_np (pthread_t __target_thread, char *__buf, size_t __buflen) __THROW __nonnull ((2)); /* Set thread name visible in the kernel and its interfaces. */ extern int pthread_setname_np (pthread_t __target_thread, const char *__name) __THROW __nonnull ((2)); #endif #ifdef __USE_UNIX98 /* Determine level of concurrency. */ extern int <API key> (void) __THROW; /* Set new concurrency level to LEVEL. */ extern int <API key> (int __level) __THROW; #endif #ifdef __USE_GNU /* Yield the processor to another thread or process. This function is similar to the POSIX `sched_yield' function but might be differently implemented in the case of a m-on-n thread implementation. */ extern int pthread_yield (void) __THROW; /* Limit specified thread TH to run only on the processors represented in CPUSET. */ extern int <API key> (pthread_t __th, size_t __cpusetsize, const cpu_set_t *__cpuset) __THROW __nonnull ((3)); /* Get bit set in CPUSET representing the processors TH can run on. */ extern int <API key> (pthread_t __th, size_t __cpusetsize, cpu_set_t *__cpuset) __THROW __nonnull ((3)); #endif /* Functions for handling initialization. */ /* Guarantee that the initialization function INIT_ROUTINE will be called only once, even if pthread_once is executed several times with the same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or extern variable initialized to PTHREAD_ONCE_INIT. The initialization functions might throw exception which is why this function is not marked with __THROW. */ extern int pthread_once (pthread_once_t *__once_control, void (*__init_routine) (void)) __nonnull ((1, 2)); /* Functions for handling cancellation. Note that these functions are explicitly not marked to not throw an exception in C++ code. If cancellation is implemented by unwinding this is necessary to have the compiler generate the unwind information. */ /* Set cancelability state of current thread to STATE, returning old state in *OLDSTATE if OLDSTATE is not NULL. */ extern int <API key> (int __state, int *__oldstate); /* Set cancellation state of current thread to TYPE, returning the old type in *OLDTYPE if OLDTYPE is not NULL. */ extern int <API key> (int __type, int *__oldtype); /* Cancel THREAD immediately or at the next possibility. */ extern int pthread_cancel (pthread_t __th); /* Test for pending cancellation for the current thread and terminate the thread as per pthread_exit(PTHREAD_CANCELED) if it has been cancelled. */ extern void pthread_testcancel (void); /* Cancellation handling with integration into exception handling. */ typedef struct { struct { __jmp_buf __cancel_jmp_buf; int __mask_was_saved; } __cancel_jmp_buf[1]; void *__pad[4]; } <API key> __attribute__ ((__aligned__)); /* No special attributes by default. */ #ifndef <API key> # define <API key> #endif /* Structure to hold the cleanup handler information. */ struct <API key> { void (*__cancel_routine) (void *); void *__cancel_arg; int __do_it; int __cancel_type; }; #if defined __GNUC__ && defined __EXCEPTIONS # ifdef __cplusplus /* Class to handle cancellation handler invocation. */ class <API key> { void (*__cancel_routine) (void *); void *__cancel_arg; int __do_it; int __cancel_type; public: <API key> (void (*__fct) (void *), void *__arg) : __cancel_routine (__fct), __cancel_arg (__arg), __do_it (1) { } ~<API key> () { if (__do_it) __cancel_routine (__cancel_arg); } void __setdoit (int __newval) { __do_it = __newval; } void __defer () { <API key> (<API key>, &__cancel_type); } void __restore () const { <API key> (__cancel_type, 0); } }; /* Install a cleanup handler: ROUTINE will be called with arguments ARG when the thread is canceled or calls pthread_exit. ROUTINE will also be called with arguments ARG when the matching pthread_cleanup_pop is executed with non-zero EXECUTE argument. <API key> and pthread_cleanup_pop are macros and must always be used in matching pairs at the same nesting level of braces. */ # define <API key>(routine, arg) \ do { \ <API key> __clframe (routine, arg) /* Remove a cleanup handler installed by the matching <API key>. If EXECUTE is non-zero, the handler function is called. */ # define pthread_cleanup_pop(execute) \ __clframe.__setdoit (execute); \ } while (0) # ifdef __USE_GNU /* Install a cleanup handler as <API key> does, but also saves the current cancellation type and sets it to deferred cancellation. */ # define <API key>(routine, arg) \ do { \ <API key> __clframe (routine, arg); \ __clframe.__defer () /* Remove a cleanup handler as pthread_cleanup_pop does, but also restores the cancellation type that was in effect when the matching <API key> was called. */ # define <API key>(execute) \ __clframe.__restore (); \ __clframe.__setdoit (execute); \ } while (0) # endif # else /* Function called to call the cleanup handler. As an extern inline function the compiler is free to decide inlining the change when needed or fall back on the copy which must exist somewhere else. */ __extern_inline void <API key> (struct <API key> *__frame) { if (__frame->__do_it) __frame->__cancel_routine (__frame->__cancel_arg); } /* Install a cleanup handler: ROUTINE will be called with arguments ARG when the thread is canceled or calls pthread_exit. ROUTINE will also be called with arguments ARG when the matching pthread_cleanup_pop is executed with non-zero EXECUTE argument. <API key> and pthread_cleanup_pop are macros and must always be used in matching pairs at the same nesting level of braces. */ # define <API key>(routine, arg) \ do { \ struct <API key> __clframe \ __attribute__ ((__cleanup__ (<API key>))) \ = { .__cancel_routine = (routine), .__cancel_arg = (arg), \ .__do_it = 1 }; /* Remove a cleanup handler installed by the matching <API key>. If EXECUTE is non-zero, the handler function is called. */ # define pthread_cleanup_pop(execute) \ __clframe.__do_it = (execute); \ } while (0) # ifdef __USE_GNU /* Install a cleanup handler as <API key> does, but also saves the current cancellation type and sets it to deferred cancellation. */ # define <API key>(routine, arg) \ do { \ struct <API key> __clframe \ __attribute__ ((__cleanup__ (<API key>))) \ = { .__cancel_routine = (routine), .__cancel_arg = (arg), \ .__do_it = 1 }; \ (void) <API key> (<API key>, \ &__clframe.__cancel_type) /* Remove a cleanup handler as pthread_cleanup_pop does, but also restores the cancellation type that was in effect when the matching <API key> was called. */ # define <API key>(execute) \ (void) <API key> (__clframe.__cancel_type, NULL); \ __clframe.__do_it = (execute); \ } while (0) # endif # endif #else /* Install a cleanup handler: ROUTINE will be called with arguments ARG when the thread is canceled or calls pthread_exit. ROUTINE will also be called with arguments ARG when the matching pthread_cleanup_pop is executed with non-zero EXECUTE argument. <API key> and pthread_cleanup_pop are macros and must always be used in matching pairs at the same nesting level of braces. */ # define <API key>(routine, arg) \ do { \ <API key> __cancel_buf; \ void (*__cancel_routine) (void *) = (routine); \ void *__cancel_arg = (arg); \ int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ __cancel_buf.__cancel_jmp_buf, 0); \ if (__glibc_unlikely (__not_first_call)) \ { \ __cancel_routine (__cancel_arg); \ <API key> (&__cancel_buf); \ /* NOTREACHED */ \ } \ \ <API key> (&__cancel_buf); \ do { extern void <API key> (<API key> *__buf) <API key>; /* Remove a cleanup handler installed by the matching <API key>. If EXECUTE is non-zero, the handler function is called. */ # define pthread_cleanup_pop(execute) \ do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\ } while (0); \ <API key> (&__cancel_buf); \ if (execute) \ __cancel_routine (__cancel_arg); \ } while (0) extern void <API key> (<API key> *__buf) <API key>; # ifdef __USE_GNU /* Install a cleanup handler as <API key> does, but also saves the current cancellation type and sets it to deferred cancellation. */ # define <API key>(routine, arg) \ do { \ <API key> __cancel_buf; \ void (*__cancel_routine) (void *) = (routine); \ void *__cancel_arg = (arg); \ int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ __cancel_buf.__cancel_jmp_buf, 0); \ if (__glibc_unlikely (__not_first_call)) \ { \ __cancel_routine (__cancel_arg); \ <API key> (&__cancel_buf); \ /* NOTREACHED */ \ } \ \ <API key> (&__cancel_buf); \ do { extern void <API key> (<API key> *__buf) <API key>; /* Remove a cleanup handler as pthread_cleanup_pop does, but also restores the cancellation type that was in effect when the matching <API key> was called. */ # define <API key>(execute) \ do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\ } while (0); \ <API key> (&__cancel_buf); \ if (execute) \ __cancel_routine (__cancel_arg); \ } while (0) extern void <API key> (<API key> *__buf) <API key>; # endif /* Internal interface to initiate cleanup. */ extern void <API key> (<API key> *__buf) <API key> __attribute__ ((__noreturn__)) # ifndef SHARED __attribute__ ((__weak__)) # endif ; #endif /* Function used in the macros. */ struct __jmp_buf_tag; extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL; /* Mutex handling. */ /* Initialize a mutex. */ extern int pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__mutexattr) __THROW __nonnull ((1)); /* Destroy a mutex. */ extern int <API key> (pthread_mutex_t *__mutex) __THROW __nonnull ((1)); /* Try locking a mutex. */ extern int <API key> (pthread_mutex_t *__mutex) __THROWNL __nonnull ((1)); /* Lock a mutex. */ extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROWNL __nonnull ((1)); #ifdef __USE_XOPEN2K /* Wait until lock becomes available, or specified time passes. */ extern int <API key> (pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); #endif /* Unlock a mutex. */ extern int <API key> (pthread_mutex_t *__mutex) __THROWNL __nonnull ((1)); /* Get the priority ceiling of MUTEX. */ extern int <API key> (const pthread_mutex_t * __restrict __mutex, int *__restrict __prioceiling) __THROW __nonnull ((1, 2)); /* Set the priority ceiling of MUTEX to PRIOCEILING, return old priority ceiling value in *OLD_CEILING. */ extern int <API key> (pthread_mutex_t *__restrict __mutex, int __prioceiling, int *__restrict __old_ceiling) __THROW __nonnull ((1, 3)); #ifdef __USE_XOPEN2K8 /* Declare the state protected by MUTEX as consistent. */ extern int <API key> (pthread_mutex_t *__mutex) __THROW __nonnull ((1)); # ifdef __USE_GNU extern int <API key> (pthread_mutex_t *__mutex) __THROW __nonnull ((1)); # endif #endif /* Functions for handling mutex attributes. */ /* Initialize mutex attribute object ATTR with default attributes (kind is <API key>). */ extern int <API key> (pthread_mutexattr_t *__attr) __THROW __nonnull ((1)); /* Destroy mutex attribute object ATTR. */ extern int <API key> (pthread_mutexattr_t *__attr) __THROW __nonnull ((1)); /* Get the process-shared flag of the mutex attribute ATTR. */ extern int <API key> (const pthread_mutexattr_t * __restrict __attr, int *__restrict __pshared) __THROW __nonnull ((1, 2)); /* Set the process-shared flag of the mutex attribute ATTR. */ extern int <API key> (pthread_mutexattr_t *__attr, int __pshared) __THROW __nonnull ((1)); #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 /* Return in *KIND the mutex kind attribute in *ATTR. */ extern int <API key> (const pthread_mutexattr_t *__restrict __attr, int *__restrict __kind) __THROW __nonnull ((1, 2)); /* Set the mutex kind attribute in *ATTR to KIND (either <API key>, <API key>, <API key>, or <API key>). */ extern int <API key> (pthread_mutexattr_t *__attr, int __kind) __THROW __nonnull ((1)); #endif /* Return in *PROTOCOL the mutex protocol attribute in *ATTR. */ extern int <API key> (const pthread_mutexattr_t * __restrict __attr, int *__restrict __protocol) __THROW __nonnull ((1, 2)); /* Set the mutex protocol attribute in *ATTR to PROTOCOL (either PTHREAD_PRIO_NONE, <API key>, or <API key>). */ extern int <API key> (pthread_mutexattr_t *__attr, int __protocol) __THROW __nonnull ((1)); /* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */ extern int <API key> (const pthread_mutexattr_t * __restrict __attr, int *__restrict __prioceiling) __THROW __nonnull ((1, 2)); /* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */ extern int <API key> (pthread_mutexattr_t *__attr, int __prioceiling) __THROW __nonnull ((1)); #ifdef __USE_XOPEN2K /* Get the robustness flag of the mutex attribute ATTR. */ extern int <API key> (const pthread_mutexattr_t *__attr, int *__robustness) __THROW __nonnull ((1, 2)); # ifdef __USE_GNU extern int <API key> (const pthread_mutexattr_t *__attr, int *__robustness) __THROW __nonnull ((1, 2)); # endif /* Set the robustness flag of the mutex attribute ATTR. */ extern int <API key> (pthread_mutexattr_t *__attr, int __robustness) __THROW __nonnull ((1)); # ifdef __USE_GNU extern int <API key> (pthread_mutexattr_t *__attr, int __robustness) __THROW __nonnull ((1)); # endif #endif #if defined __USE_UNIX98 || defined __USE_XOPEN2K /* Functions for handling read-write locks. */ /* Initialize read-write lock RWLOCK using attributes ATTR, or use the default values if later is NULL. */ extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, const <API key> *__restrict __attr) __THROW __nonnull ((1)); /* Destroy read-write lock RWLOCK. */ extern int <API key> (pthread_rwlock_t *__rwlock) __THROW __nonnull ((1)); /* Acquire read lock for RWLOCK. */ extern int <API key> (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); /* Try to acquire read lock for RWLOCK. */ extern int <API key> (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); # ifdef __USE_XOPEN2K /* Try to acquire read lock for RWLOCK or return after specfied time. */ extern int <API key> (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); # endif /* Acquire write lock for RWLOCK. */ extern int <API key> (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); /* Try to acquire write lock for RWLOCK. */ extern int <API key> (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); # ifdef __USE_XOPEN2K /* Try to acquire write lock for RWLOCK or return after specfied time. */ extern int <API key> (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); # endif /* Unlock RWLOCK. */ extern int <API key> (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); /* Functions for handling read-write lock attributes. */ /* Initialize attribute object ATTR with default values. */ extern int <API key> (<API key> *__attr) __THROW __nonnull ((1)); /* Destroy attribute object ATTR. */ extern int <API key> (<API key> *__attr) __THROW __nonnull ((1)); /* Return current setting of process-shared attribute of ATTR in PSHARED. */ extern int <API key> (const <API key> * __restrict __attr, int *__restrict __pshared) __THROW __nonnull ((1, 2)); /* Set process-shared attribute of ATTR to PSHARED. */ extern int <API key> (<API key> *__attr, int __pshared) __THROW __nonnull ((1)); /* Return current setting of reader/writer preference. */ extern int <API key> (const <API key> * __restrict __attr, int *__restrict __pref) __THROW __nonnull ((1, 2)); /* Set reader/write preference. */ extern int <API key> (<API key> *__attr, int __pref) __THROW __nonnull ((1)); #endif /* Functions for handling conditional variables. */ /* Initialize condition variable COND using attributes ATTR, or use the default values if later is NULL. */ extern int pthread_cond_init (pthread_cond_t *__restrict __cond, const pthread_condattr_t *__restrict __cond_attr) __THROW __nonnull ((1)); /* Destroy condition variable COND. */ extern int <API key> (pthread_cond_t *__cond) __THROW __nonnull ((1)); /* Wake up one thread waiting for condition variable COND. */ extern int pthread_cond_signal (pthread_cond_t *__cond) __THROWNL __nonnull ((1)); /* Wake up all threads waiting for condition variables COND. */ extern int <API key> (pthread_cond_t *__cond) __THROWNL __nonnull ((1)); /* Wait for condition variable COND to be signaled or broadcast. MUTEX is assumed to be locked before. This function is a cancellation point and therefore not marked with __THROW. */ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex) __nonnull ((1, 2)); /* Wait for condition variable COND to be signaled or broadcast until ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an absolute time specification; zero is the beginning of the epoch (00:00:00 GMT, January 1, 1970). This function is a cancellation point and therefore not marked with __THROW. */ extern int <API key> (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __nonnull ((1, 2, 3)); /* Functions for handling condition variable attributes. */ /* Initialize condition variable attribute ATTR. */ extern int <API key> (pthread_condattr_t *__attr) __THROW __nonnull ((1)); /* Destroy condition variable attribute ATTR. */ extern int <API key> (pthread_condattr_t *__attr) __THROW __nonnull ((1)); /* Get the process-shared flag of the condition variable attribute ATTR. */ extern int <API key> (const pthread_condattr_t * __restrict __attr, int *__restrict __pshared) __THROW __nonnull ((1, 2)); /* Set the process-shared flag of the condition variable attribute ATTR. */ extern int <API key> (pthread_condattr_t *__attr, int __pshared) __THROW __nonnull ((1)); #ifdef __USE_XOPEN2K /* Get the clock selected for the conditon variable attribute ATTR. */ extern int <API key> (const pthread_condattr_t * __restrict __attr, __clockid_t *__restrict __clock_id) __THROW __nonnull ((1, 2)); /* Set the clock selected for the conditon variable attribute ATTR. */ extern int <API key> (pthread_condattr_t *__attr, __clockid_t __clock_id) __THROW __nonnull ((1)); #endif #ifdef __USE_XOPEN2K /* Functions to handle spinlocks. */ /* Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can be shared between different processes. */ extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) __THROW __nonnull ((1)); /* Destroy the spinlock LOCK. */ extern int <API key> (pthread_spinlock_t *__lock) __THROW __nonnull ((1)); /* Wait until spinlock LOCK is retrieved. */ extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROWNL __nonnull ((1)); /* Try to lock spinlock LOCK. */ extern int <API key> (pthread_spinlock_t *__lock) __THROWNL __nonnull ((1)); /* Release spinlock LOCK. */ extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROWNL __nonnull ((1)); /* Functions to handle barriers. */ /* Initialize BARRIER with the attributes in ATTR. The barrier is opened when COUNT waiters arrived. */ extern int <API key> (pthread_barrier_t *__restrict __barrier, const <API key> *__restrict __attr, unsigned int __count) __THROW __nonnull ((1)); /* Destroy a previously dynamically initialized barrier BARRIER. */ extern int <API key> (pthread_barrier_t *__barrier) __THROW __nonnull ((1)); /* Wait on barrier BARRIER. */ extern int <API key> (pthread_barrier_t *__barrier) __THROWNL __nonnull ((1)); /* Initialize barrier attribute ATTR. */ extern int <API key> (<API key> *__attr) __THROW __nonnull ((1)); /* Destroy previously dynamically initialized barrier attribute ATTR. */ extern int <API key> (<API key> *__attr) __THROW __nonnull ((1)); /* Get the process-shared flag of the barrier attribute ATTR. */ extern int <API key> (const <API key> * __restrict __attr, int *__restrict __pshared) __THROW __nonnull ((1, 2)); /* Set the process-shared flag of the barrier attribute ATTR. */ extern int <API key> (<API key> *__attr, int __pshared) __THROW __nonnull ((1)); #endif /* Functions for handling thread-specific data. */ /* Create a key value identifying a location in the thread-specific data area. Each thread maintains a distinct thread-specific data area. DESTR_FUNCTION, if non-NULL, is called with the value associated to that key when the key is destroyed. DESTR_FUNCTION is not called if the value associated is NULL when the key is destroyed. */ extern int pthread_key_create (pthread_key_t *__key, void (*__destr_function) (void *)) __THROW __nonnull ((1)); /* Destroy KEY. */ extern int pthread_key_delete (pthread_key_t __key) __THROW; /* Return current value of the thread-specific data slot identified by KEY. */ extern void *pthread_getspecific (pthread_key_t __key) __THROW; /* Store POINTER in the thread-specific data slot identified by KEY. */ extern int pthread_setspecific (pthread_key_t __key, const void *__pointer) __THROW ; #ifdef __USE_XOPEN2K /* Get ID of CPU-time clock for thread THREAD_ID. */ extern int <API key> (pthread_t __thread_id, __clockid_t *__clock_id) __THROW __nonnull ((2)); #endif /* Install handlers to be called when a new process is created with FORK. The PREPARE handler is called in the parent process just before performing FORK. The PARENT handler is called in the parent process just after FORK. The CHILD handler is called in the child process. Each of the three handlers can be NULL, meaning that no handler needs to be called at that point. PTHREAD_ATFORK can be called several times, in which case the PREPARE handlers are called in LIFO order (last added with PTHREAD_ATFORK, first called before FORK), and the PARENT and CHILD handlers are called in FIFO (first added, first called). */ extern int pthread_atfork (void (*__prepare) (void), void (*__parent) (void), void (*__child) (void)) __THROW; #ifdef <API key> /* Optimizations. */ __extern_inline int __NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2)) { return __thread1 == __thread2; } #endif __END_DECLS #endif /* pthread.h */ #ifndef _PTHREAD_H_HPPA_ #define _PTHREAD_H_HPPA_ 1 /* The pthread_cond_t initializer is compatible only with NPTL. We do not want to be forwards compatible, we eventually want to drop the code that has to clear the old LT initializer. */ #undef <API key> #define <API key> { { 0, 0, 0, (void *) 0, 0, 0, 0, 0, 0 } } /* The pthread_mutex_t and pthread_rwlock_t initializers are compatible only with NPTL. NPTL assumes pthread_rwlock_t is all zero. */ #undef <API key> #undef <API key> #undef <API key> #undef <API key> /* Mutex initializers. */ #define <API key> \ { { 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, { 0 }, 0, 0 } } #ifdef __USE_GNU # define <API key> \ { { 0, 0, 0, <API key>, { 0, 0, 0, 0 }, 0, { 0 }, 0, 0 } } # define <API key> \ { { 0, 0, 0, <API key>, { 0, 0, 0, 0 }, 0, { 0 }, 0, 0 } } # define <API key> \ { { 0, 0, 0, <API key>, { 0, 0, 0, 0 }, 0, { 0 }, 0, 0 } } #endif #undef <API key> #undef <API key> /* Read-write lock initializers. */ #define <API key> \ { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } #ifdef __USE_GNU # define <API key> \ { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, <API key>,\ 0, 0, 0 } } #endif /* Unix98 or XOpen2K */ #endif
#include "dosbox.h" #if C_DEBUG #include "control.h" #include <stdlib.h> #include <stdarg.h> #include <stdio.h> #include <curses.h> #include <string.h> #include "support.h" #include "regs.h" #include "debug.h" #include "debug_inc.h" struct _LogGroup { char const* front; bool enabled; }; #include <list> #include <string> using namespace std; #define MAX_LOG_BUFFER 500 static list<string> logBuff; static list<string>::iterator logBuffPos = logBuff.end(); static _LogGroup loggrp[LOG_MAX]={{"",true},{0,false}}; static FILE* debuglog; extern int old_cursor_state; void DEBUG_ShowMsg(char const* format,...) { char buf[512]; va_list msg; va_start(msg,format); vsprintf(buf,format,msg); va_end(msg); /* Add newline if not present */ Bitu len=strlen(buf); if(buf[len-1]!='\n') strcat(buf,"\n"); if(debuglog) fprintf(debuglog,"%s",buf); if (logBuffPos!=logBuff.end()) { logBuffPos=logBuff.end(); DEBUG_RefreshPage(0); // mvwprintw(dbg.win_out,dbg.win_out->_maxy-1, 0, ""); } logBuff.push_back(buf); if (logBuff.size() > MAX_LOG_BUFFER) logBuff.pop_front(); logBuffPos = logBuff.end(); wprintw(dbg.win_out,"%s",buf); wrefresh(dbg.win_out); } void DEBUG_RefreshPage(char scroll) { if (scroll==-1 && logBuffPos!=logBuff.begin()) logBuffPos else if (scroll==1 && logBuffPos!=logBuff.end()) logBuffPos++; list<string>::iterator i = logBuffPos; int maxy, maxx; getmaxyx(dbg.win_out,maxy,maxx); int rem_lines = maxy; if(rem_lines == -1) return; wclear(dbg.win_out); while (rem_lines > 0 && i!=logBuff.begin()) { --i; for (string::size_type posf=0, posl; (posl=(*i).find('\n',posf)) != string::npos ;posf=posl+1) rem_lines -= (int) ((posl-posf) / maxx) + 1; // len=(posl+1)-posf-1 /* Const cast is needed for pdcurses which has no const char in mvwprintw (bug maybe) */ mvwprintw(dbg.win_out,rem_lines-1, 0, const_cast<char*>((*i).c_str())); } mvwprintw(dbg.win_out,maxy-1, 0, ""); wrefresh(dbg.win_out); } void LOG::operator() (char const* format, ...){ char buf[512]; va_list msg; va_start(msg,format); vsprintf(buf,format,msg); va_end(msg); if (d_type>=LOG_MAX) return; if ((d_severity!=LOG_ERROR) && (!loggrp[d_type].enabled)) return; DEBUG_ShowMsg("%10u: %s:%s\n",static_cast<Bit32u>(cycle_count),loggrp[d_type].front,buf); } static void Draw_RegisterLayout(void) { mvwaddstr(dbg.win_reg,0,0,"EAX="); mvwaddstr(dbg.win_reg,1,0,"EBX="); mvwaddstr(dbg.win_reg,2,0,"ECX="); mvwaddstr(dbg.win_reg,3,0,"EDX="); mvwaddstr(dbg.win_reg,0,14,"ESI="); mvwaddstr(dbg.win_reg,1,14,"EDI="); mvwaddstr(dbg.win_reg,2,14,"EBP="); mvwaddstr(dbg.win_reg,3,14,"ESP="); mvwaddstr(dbg.win_reg,0,28,"DS="); mvwaddstr(dbg.win_reg,0,38,"ES="); mvwaddstr(dbg.win_reg,0,48,"FS="); mvwaddstr(dbg.win_reg,0,58,"GS="); mvwaddstr(dbg.win_reg,0,68,"SS="); mvwaddstr(dbg.win_reg,1,28,"CS="); mvwaddstr(dbg.win_reg,1,38,"EIP="); mvwaddstr(dbg.win_reg,2,75,"CPL"); mvwaddstr(dbg.win_reg,2,68,"IOPL"); mvwaddstr(dbg.win_reg,1,52,"C Z S O A P D I T "); } static void DrawBars(void) { if (has_colors()) { attrset(COLOR_PAIR(PAIR_BLACK_BLUE)); } /* Show the Register bar */ mvaddstr(1-1,0, " /* Show the Data Overview bar perhaps with more special stuff in the end */ mvaddstr(6-1,0," /* Show the Code Overview perhaps with special stuff in bar too */ mvaddstr(17-1,0," /* Show the Variable Overview bar */ mvaddstr(29-1,0, " /* Show the Output OverView */ mvaddstr(34-1,0, " attrset(0); //Match values with below. So we don't need to touch the internal window structures } static void MakeSubWindows(void) { /* The Std output win should go at the bottom */ /* Make all the subwindows */ int win_main_maxy, win_main_maxx; getmaxyx(dbg.win_main,win_main_maxy,win_main_maxx); int outy=1; //Match values with above /* The Register window */ dbg.win_reg=subwin(dbg.win_main,4,win_main_maxx,outy,0); outy+=5; /* The Data Window */ dbg.win_data=subwin(dbg.win_main,10,win_main_maxx,outy,0); outy+=11; /* The Code Window */ dbg.win_code=subwin(dbg.win_main,11,win_main_maxx,outy,0); outy+=12; /* The Variable Window */ dbg.win_var=subwin(dbg.win_main,4,win_main_maxx,outy,0); outy+=5; /* The Output Window */ dbg.win_out=subwin(dbg.win_main,win_main_maxy-outy,win_main_maxx,outy,0); if(!dbg.win_reg ||!dbg.win_data || !dbg.win_code || !dbg.win_var || !dbg.win_out) E_Exit("Setting up windows failed"); // dbg.input_y=win_main_maxy-1; scrollok(dbg.win_out,TRUE); DrawBars(); Draw_RegisterLayout(); refresh(); } static void MakePairs(void) { init_pair(PAIR_BLACK_BLUE, COLOR_BLACK, COLOR_CYAN); init_pair(PAIR_BYELLOW_BLACK, COLOR_YELLOW /*| <API key> */, COLOR_BLACK); init_pair(PAIR_GREEN_BLACK, COLOR_GREEN /*| <API key> */, COLOR_BLACK); init_pair(PAIR_BLACK_GREY, COLOR_BLACK /*| <API key> */, COLOR_WHITE); init_pair(PAIR_GREY_RED, COLOR_WHITE/*| <API key> */, COLOR_RED); } static void LOG_Destroy(Section*) { if(debuglog) fclose(debuglog); } static void LOG_Init(Section * sec) { Section_prop * sect=static_cast<Section_prop *>(sec); const char * blah=sect->Get_string("logfile"); if(blah && blah[0] &&(debuglog = fopen(blah,"wt+"))){ }else{ debuglog=0; } sect->AddDestroyFunction(&LOG_Destroy); char buf[1024]; for (Bitu i=1;i<LOG_MAX;i++) { strcpy(buf,loggrp[i].front); buf[strlen(buf)]=0; lowcase(buf); loggrp[i].enabled=sect->Get_bool(buf); } } void LOG_StartUp(void) { /* Setup logging groups */ loggrp[LOG_ALL].front="ALL"; loggrp[LOG_VGA].front="VGA"; loggrp[LOG_VGAGFX].front="VGAGFX"; loggrp[LOG_VGAMISC].front="VGAMISC"; loggrp[LOG_INT10].front="INT10"; loggrp[LOG_SB].front="SBLASTER"; loggrp[LOG_DMACONTROL].front="DMA_CONTROL"; loggrp[LOG_FPU].front="FPU"; loggrp[LOG_CPU].front="CPU"; loggrp[LOG_PAGING].front="PAGING"; loggrp[LOG_FCB].front="FCB"; loggrp[LOG_FILES].front="FILES"; loggrp[LOG_IOCTL].front="IOCTL"; loggrp[LOG_EXEC].front="EXEC"; loggrp[LOG_DOSMISC].front="DOSMISC"; loggrp[LOG_PIT].front="PIT"; loggrp[LOG_KEYBOARD].front="KEYBOARD"; loggrp[LOG_PIC].front="PIC"; loggrp[LOG_MOUSE].front="MOUSE"; loggrp[LOG_BIOS].front="BIOS"; loggrp[LOG_GUI].front="GUI"; loggrp[LOG_MISC].front="MISC"; loggrp[LOG_IO].front="IO"; loggrp[LOG_PCI].front="PCI"; /* Register the log section */ Section_prop * sect=control->AddSection_prop("log",LOG_Init); Prop_string* Pstring = sect->Add_string("logfile",Property::Changeable::Always,""); Pstring->Set_help("file where the log messages will be saved to"); char buf[1024]; for (Bitu i=1;i<LOG_MAX;i++) { strcpy(buf,loggrp[i].front); lowcase(buf); Prop_bool* Pbool = sect->Add_bool(buf,Property::Changeable::Always,true); Pbool->Set_help("Enable/Disable logging of this type."); } // MSG_Add("LOG_CONFIGFILE_HELP","Logging related options for the debugger.\n"); } void DBGUI_StartUp(void) { /* Start the main window */ dbg.win_main=initscr(); cbreak(); /* take input chars one at a time, no wait for \n */ noecho(); /* don't echo input */ nodelay(dbg.win_main,true); keypad(dbg.win_main,true); #ifndef WIN32 printf("\e[8;50;80t"); fflush(NULL); resizeterm(50,80); touchwin(dbg.win_main); #endif old_cursor_state = curs_set(0); start_color(); cycle_count=0; MakePairs(); MakeSubWindows(); } #endif
#include "drm_flip_work.h" #include "omap_drv.h" #include "omap_dmm_tiler.h" /* some hackery because omapdss has an 'enum omap_plane' (which would be * better named omap_plane_id).. and compiler seems unhappy about having * both a 'struct omap_plane' and 'enum omap_plane' */ #define omap_plane _omap_plane /* * plane funcs */ struct callback { void (*fxn)(void *); void *arg; }; #define to_omap_plane(x) container_of(x, struct omap_plane, base) struct omap_plane { struct drm_plane base; int id; /* TODO rename omap_plane -> omap_plane_id in omapdss so I can use the enum */ const char *name; struct omap_overlay_info info; struct omap_drm_apply apply; /* position/orientation of scanout within the fb: */ struct omap_drm_window win; bool enabled; /* last fb that we pinned: */ struct drm_framebuffer *pinned_fb; uint32_t nformats; uint32_t formats[32]; struct omap_drm_irq error_irq; /* for deferring bo unpin's until next post_apply(): */ struct drm_flip_work unpin_work; // XXX maybe get rid of this and handle vblank in crtc too? struct callback apply_done_cb; }; static void unpin_worker(struct drm_flip_work *work, void *val) { struct omap_plane *omap_plane = container_of(work, struct omap_plane, unpin_work); struct drm_device *dev = omap_plane->base.dev; /* * <API key>/unpin are always called from priv->wq, * so there's no need for locking here. */ <API key>(val); mutex_lock(&dev->mode_config.mutex); <API key>(val); mutex_unlock(&dev->mode_config.mutex); } /* update which fb (if any) is pinned for scanout */ static int update_pin(struct drm_plane *plane, struct drm_framebuffer *fb) { struct omap_plane *omap_plane = to_omap_plane(plane); struct drm_framebuffer *pinned_fb = omap_plane->pinned_fb; if (pinned_fb != fb) { int ret = 0; DBG("%p -> %p", pinned_fb, fb); if (fb) { <API key>(fb); ret = <API key>(fb); } if (pinned_fb) drm_flip_work_queue(&omap_plane->unpin_work, pinned_fb); if (ret) { dev_err(plane->dev->dev, "could not swap %p -> %p\n", omap_plane->pinned_fb, fb); <API key>(fb); omap_plane->pinned_fb = NULL; return ret; } omap_plane->pinned_fb = fb; } return 0; } static void <API key>(struct omap_drm_apply *apply) { struct omap_plane *omap_plane = container_of(apply, struct omap_plane, apply); struct omap_drm_window *win = &omap_plane->win; struct drm_plane *plane = &omap_plane->base; struct drm_device *dev = plane->dev; struct omap_overlay_info *info = &omap_plane->info; struct drm_crtc *crtc = plane->crtc; enum omap_channel channel; bool enabled = omap_plane->enabled && crtc; bool ilace, replication; int ret; DBG("%s, enabled=%d", omap_plane->name, enabled); /* if fb has changed, pin new fb: */ update_pin(plane, enabled ? plane->fb : NULL); if (!enabled) { dispc_ovl_enable(omap_plane->id, false); return; } channel = omap_crtc_channel(crtc); /* update scanout: */ <API key>(plane->fb, win, info); DBG("%dx%d -> %dx%d (%d)", info->width, info->height, info->out_width, info->out_height, info->screen_width); DBG("%d,%d %pad %pad", info->pos_x, info->pos_y, &info->paddr, &info->p_uv_addr); /* TODO: */ ilace = false; replication = false; <API key>(omap_plane->id, channel); /* and finally, update omapdss: */ ret = dispc_ovl_setup(omap_plane->id, info, replication, omap_crtc_timings(crtc), false); if (ret) { dev_err(dev->dev, "dispc_ovl_setup failed: %d\n", ret); return; } dispc_ovl_enable(omap_plane->id, true); } static void <API key>(struct omap_drm_apply *apply) { struct omap_plane *omap_plane = container_of(apply, struct omap_plane, apply); struct drm_plane *plane = &omap_plane->base; struct omap_drm_private *priv = plane->dev->dev_private; struct omap_overlay_info *info = &omap_plane->info; struct callback cb; cb = omap_plane->apply_done_cb; omap_plane->apply_done_cb.fxn = NULL; <API key>(&omap_plane->unpin_work, priv->wq); if (cb.fxn) cb.fxn(cb.arg); if (omap_plane->enabled) { <API key>(plane->fb, info->pos_x, info->pos_y, info->out_width, info->out_height); } } static int apply(struct drm_plane *plane) { if (plane->crtc) { struct omap_plane *omap_plane = to_omap_plane(plane); return omap_crtc_apply(plane->crtc, &omap_plane->apply); } return 0; } int omap_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h, void (*fxn)(void *), void *arg) { struct omap_plane *omap_plane = to_omap_plane(plane); struct omap_drm_window *win = &omap_plane->win; int i; /* * Check whether this plane supports the fb pixel format. * I don't think this should really be needed, but it looks like the * drm core only checks the format for planes, not for the crtc. So * when setting the format for crtc, without this check we would * get an error later when trying to program the color format into the * HW. */ for (i = 0; i < plane->format_count; i++) if (fb->pixel_format == plane->format_types[i]) break; if (i == plane->format_count) { DBG("Invalid pixel format %s", drm_get_format_name(fb->pixel_format)); return -EINVAL; } win->crtc_x = crtc_x; win->crtc_y = crtc_y; win->crtc_w = crtc_w; win->crtc_h = crtc_h; /* src values are in Q16 fixed point, convert to integer: */ win->src_x = src_x >> 16; win->src_y = src_y >> 16; win->src_w = src_w >> 16; win->src_h = src_h >> 16; if (fxn) { /* omap_crtc should ensure that a new page flip * isn't permitted while there is one pending: */ BUG_ON(omap_plane->apply_done_cb.fxn); omap_plane->apply_done_cb.fxn = fxn; omap_plane->apply_done_cb.arg = arg; } plane->fb = fb; plane->crtc = crtc; return apply(plane); } static int omap_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h) { struct omap_plane *omap_plane = to_omap_plane(plane); omap_plane->enabled = true; if (plane->fb) <API key>(plane->fb); <API key>(fb); /* omap_plane_mode_set() takes adjusted src */ switch (omap_plane->win.rotation & 0xf) { case BIT(DRM_ROTATE_90): case BIT(DRM_ROTATE_270): swap(src_w, src_h); break; } return omap_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h, NULL, NULL); } static int omap_plane_disable(struct drm_plane *plane) { struct omap_plane *omap_plane = to_omap_plane(plane); omap_plane->win.rotation = BIT(DRM_ROTATE_0); return omap_plane_dpms(plane, DRM_MODE_DPMS_OFF); } static void omap_plane_destroy(struct drm_plane *plane) { struct omap_plane *omap_plane = to_omap_plane(plane); DBG("%s", omap_plane->name); omap_irq_unregister(plane->dev, &omap_plane->error_irq); omap_plane_disable(plane); drm_plane_cleanup(plane); <API key>(&omap_plane->unpin_work); kfree(omap_plane); } int omap_plane_dpms(struct drm_plane *plane, int mode) { struct omap_plane *omap_plane = to_omap_plane(plane); bool enabled = (mode == DRM_MODE_DPMS_ON); int ret = 0; if (enabled != omap_plane->enabled) { omap_plane->enabled = enabled; ret = apply(plane); } return ret; } /* helper to install properties which are common to planes and crtcs */ void <API key>(struct drm_plane *plane, struct drm_mode_object *obj) { struct drm_device *dev = plane->dev; struct omap_drm_private *priv = dev->dev_private; struct drm_property *prop; if (priv->has_dmm) { prop = priv->rotation_prop; if (!prop) { const struct drm_prop_enum_list props[] = { { DRM_ROTATE_0, "rotate-0" }, { DRM_ROTATE_90, "rotate-90" }, { DRM_ROTATE_180, "rotate-180" }, { DRM_ROTATE_270, "rotate-270" }, { DRM_REFLECT_X, "reflect-x" }, { DRM_REFLECT_Y, "reflect-y" }, }; prop = <API key>(dev, 0, "rotation", props, ARRAY_SIZE(props)); if (prop == NULL) return; priv->rotation_prop = prop; } <API key>(obj, prop, 0); } prop = priv->zorder_prop; if (!prop) { prop = <API key>(dev, 0, "zorder", 0, 3); if (prop == NULL) return; priv->zorder_prop = prop; } <API key>(obj, prop, 0); } int <API key>(struct drm_plane *plane, struct drm_property *property, uint64_t val) { struct omap_plane *omap_plane = to_omap_plane(plane); struct omap_drm_private *priv = plane->dev->dev_private; int ret = -EINVAL; if (property == priv->rotation_prop) { DBG("%s: rotation: %02x", omap_plane->name, (uint32_t)val); omap_plane->win.rotation = val; ret = apply(plane); } else if (property == priv->zorder_prop) { DBG("%s: zorder: %02x", omap_plane->name, (uint32_t)val); omap_plane->info.zorder = val; ret = apply(plane); } return ret; } static const struct drm_plane_funcs omap_plane_funcs = { .update_plane = omap_plane_update, .disable_plane = omap_plane_disable, .destroy = omap_plane_destroy, .set_property = <API key>, }; static void <API key>(struct omap_drm_irq *irq, uint32_t irqstatus) { struct omap_plane *omap_plane = container_of(irq, struct omap_plane, error_irq); <API key>("%s: errors: %08x\n", omap_plane->name, irqstatus); } static const char *plane_names[] = { [OMAP_DSS_GFX] = "gfx", [OMAP_DSS_VIDEO1] = "vid1", [OMAP_DSS_VIDEO2] = "vid2", [OMAP_DSS_VIDEO3] = "vid3", }; static const uint32_t error_irqs[] = { [OMAP_DSS_GFX] = <API key>, [OMAP_DSS_VIDEO1] = <API key>, [OMAP_DSS_VIDEO2] = <API key>, [OMAP_DSS_VIDEO3] = <API key>, }; /* initialize plane */ struct drm_plane *omap_plane_init(struct drm_device *dev, int id, bool private_plane) { struct omap_drm_private *priv = dev->dev_private; struct drm_plane *plane = NULL; struct omap_plane *omap_plane; struct omap_overlay_info *info; int ret; DBG("%s: priv=%d", plane_names[id], private_plane); omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL); if (!omap_plane) goto fail; ret = drm_flip_work_init(&omap_plane->unpin_work, 16, "unpin", unpin_worker); if (ret) { dev_err(dev->dev, "could not allocate unpin FIFO\n"); goto fail; } omap_plane->nformats = <API key>( omap_plane->formats, ARRAY_SIZE(omap_plane->formats), <API key>(id)); omap_plane->id = id; omap_plane->name = plane_names[id]; plane = &omap_plane->base; omap_plane->apply.pre_apply = <API key>; omap_plane->apply.post_apply = <API key>; omap_plane->error_irq.irqmask = error_irqs[id]; omap_plane->error_irq.irq = <API key>; omap_irq_register(dev, &omap_plane->error_irq); drm_plane_init(dev, plane, (1 << priv->num_crtcs) - 1, &omap_plane_funcs, omap_plane->formats, omap_plane->nformats, private_plane); <API key>(plane, &plane->base); /* get our starting configuration, set defaults for parameters * we don't currently use, etc: */ info = &omap_plane->info; info->rotation_type = OMAP_DSS_ROT_DMA; info->rotation = OMAP_DSS_ROT_0; info->global_alpha = 0xff; info->mirror = 0; /* Set defaults depending on whether we are a CRTC or overlay * layer. * TODO add ioctl to give userspace an API to change this.. this * will come in a subsequent patch. */ if (private_plane) omap_plane->info.zorder = 0; else omap_plane->info.zorder = id; return plane; fail: if (plane) omap_plane_destroy(plane); return NULL; }
#ifndef HB_SUBSET_GLYF_HH #define HB_SUBSET_GLYF_HH #include "hb.hh" #include "hb-subset.hh" HB_INTERNAL bool <API key> (hb_subset_plan_t *plan, bool *use_short_loca, /* OUT */ hb_blob_t **glyf_prime /* OUT */, hb_blob_t **loca_prime /* OUT */); #endif /* HB_SUBSET_GLYF_HH */
<?php namespace Drupal\Tests\system\Kernel\Theme; use Drupal\KernelTests\KernelTestBase; use Twig\TemplateWrapper; /** * Tests Twig namespaces. * * @group Theme */ class TwigNamespaceTest extends KernelTestBase { /** * Modules to enable. * * @var array */ public static $modules = ['twig_theme_test', 'twig_namespace_a', 'twig_namespace_b', 'node']; /** * @var \Drupal\Core\Template\TwigEnvironment */ protected $twig; protected function setUp() { parent::setUp(); \Drupal::service('theme_installer')->install(['test_theme', 'bartik']); $this->twig = \Drupal::service('twig'); } /** * Checks to see if a value is a twig template. */ public function assertTwigTemplate($value, $message = '', $group = 'Other') { $this->assertTrue($value instanceof TemplateWrapper, $message, $group); } /** * Tests template discovery using namespaces. */ public function <API key>() { // Tests resolving namespaced templates in modules. $this->assertTwigTemplate($this->twig->load('@node/node.html.twig'), 'Found node.html.twig in node module.'); // Tests resolving namespaced templates in themes. $this->assertTwigTemplate($this->twig->load('@bartik/page.html.twig'), 'Found page.html.twig in Bartik theme.'); } /** * Tests template extension and includes using namespaces. */ public function testTwigNamespaces() { // Test twig @extends and @include in template files. $test = ['#theme' => 'twig_namespace_test']; $this->setRawContent(\Drupal::service('renderer')->renderRoot($test)); $this->assertText('This line is from twig_namespace_a/templates/test.html.twig'); $this->assertText('This line is from twig_namespace_b/templates/test.html.twig'); } }
function widget:GetInfo() return { name = "Lua Metal Decals", desc = "Draws a decal on each metal spot", author = "Bluestone (based on the Lua Metal Spots widget by Cheesecan)", date = "April 2014", license = "GPL v3 or later", layer = 5, enabled = true -- loaded by default? } end local MEX_TEXTURE = "luaui/images/metal_spot.png" local MEX_WIDTH = 80 local MEX_HEIGHT = 80 local displayList = 0 local mexRotation = {} function drawPatches() local mSpots = WG.metalSpots -- Switch to texture matrix mode gl.MatrixMode(GL.TEXTURE) gl.PolygonOffset(-25, -2) gl.Culling(GL.BACK) gl.DepthTest(true) gl.Texture(MEX_TEXTURE) gl.Color(1, 1, 1, 0.85) -- fix color from other widgets for i = 1, #mSpots do mexRotation[i] = mexRotation[i] or math.random(0, 360) gl.PushMatrix() gl.Translate(0.5, 0.5, 0) gl.Rotate(mexRotation[i], 0, 0, 1) gl.DrawGroundQuad(mSpots[i].x - MEX_WIDTH/2, mSpots[i].z - MEX_HEIGHT/2, mSpots[i].x + MEX_WIDTH/2, mSpots[i].z + MEX_HEIGHT/2, false, -0.5, -0.5, 0.5, 0.5) gl.PopMatrix() end gl.Texture(false) gl.DepthTest(false) gl.Culling(false) gl.PolygonOffset(false) -- Restore Modelview matrix gl.MatrixMode(GL.MODELVIEW) end function widget:DrawWorldPreUnit() local mode = Spring.GetMapDrawMode() if (mode ~= "height" and mode ~= "path") then gl.CallList(displayList) end end function widget:Initialize() if not (WG.metalSpots and Spring.GetGameRulesParam("mex_need_drawing")) then widgetHandler:RemoveWidget(self) return end displayList = gl.CreateList(drawPatches) end function widget:GameFrame(n) if n%15 == 0 then -- Update display to take terraform into account displayList = gl.CreateList(drawPatches) end end function widget:Shutdown() gl.DeleteList(displayList) end
INCLUDE(<API key>) MACRO(<API key> _SYMBOL _HEADER _RESULT) SET(_INCLUDE_FILES) FOREACH (it ${_HEADER}) SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") ENDFOREACH (it) SET(<API key> " ${_INCLUDE_FILES} void cmakeRequireSymbol(int dummy,...){(void)dummy;} int main() { int i = ${_SYMBOL}; return 0; } ") <API key>("${<API key>}" ${_RESULT}) IF("${_RESULT}") FILE(APPEND ${CMAKE_BINARY_DIR}${<API key>}/CMakeOutput.log "Variable ${_SYMBOL} was found in headers\n") ELSE("${_RESULT}") FILE(APPEND ${CMAKE_BINARY_DIR}${<API key>}/CMakeError.log "Failed to find variable ${_SYMBOL}. Source: ${<API key>}\n") ENDIF("${_RESULT}") ENDMACRO(<API key> _SYMBOL _HEADER _RESULT)
#include "git-compat-util.h" #include "cache.h" #include "branch.h" #include "refs.h" #include "remote.h" #include "commit.h" #include "worktree.h" struct tracking { struct refspec spec; char *src; const char *remote; int matches; }; static int find_tracked_branch(struct remote *remote, void *priv) { struct tracking *tracking = priv; if (!<API key>(remote, &tracking->spec)) { if (++tracking->matches == 1) { tracking->src = tracking->spec.src; tracking->remote = remote->name; } else { free(tracking->spec.src); if (tracking->src) { free(tracking->src); tracking->src = NULL; } } tracking->spec.src = NULL; } return 0; } static int should_setup_rebase(const char *origin) { switch (autorebase) { case AUTOREBASE_NEVER: return 0; case AUTOREBASE_LOCAL: return origin == NULL; case AUTOREBASE_REMOTE: return origin != NULL; case AUTOREBASE_ALWAYS: return 1; } return 0; } void <API key>(int flag, const char *local, const char *origin, const char *remote) { const char *shortname = NULL; struct strbuf key = STRBUF_INIT; int rebasing = should_setup_rebase(origin); if (skip_prefix(remote, "refs/heads/", &shortname) && !strcmp(local, shortname) && !origin) { warning(_("Not setting branch %s as its own upstream."), local); return; } strbuf_addf(&key, "branch.%s.remote", local); git_config_set(key.buf, origin ? origin : "."); strbuf_reset(&key); strbuf_addf(&key, "branch.%s.merge", local); git_config_set(key.buf, remote); if (rebasing) { strbuf_reset(&key); strbuf_addf(&key, "branch.%s.rebase", local); git_config_set(key.buf, "true"); } strbuf_release(&key); if (flag & <API key>) { if (shortname) { if (origin) printf_ln(rebasing ? _("Branch %s set up to track remote branch %s from %s by rebasing.") : _("Branch %s set up to track remote branch %s from %s."), local, shortname, origin); else printf_ln(rebasing ? _("Branch %s set up to track local branch %s by rebasing.") : _("Branch %s set up to track local branch %s."), local, shortname); } else { if (origin) printf_ln(rebasing ? _("Branch %s set up to track remote ref %s by rebasing.") : _("Branch %s set up to track remote ref %s."), local, remote); else printf_ln(rebasing ? _("Branch %s set up to track local ref %s by rebasing.") : _("Branch %s set up to track local ref %s."), local, remote); } } } /* * This is called when new_ref is branched off of orig_ref, and tries * to infer the settings for branch.<new_ref>.{remote,merge} from the * config. */ static int setup_tracking(const char *new_ref, const char *orig_ref, enum branch_track track, int quiet) { struct tracking tracking; int config_flags = quiet ? 0 : <API key>; memset(&tracking, 0, sizeof(tracking)); tracking.spec.dst = (char *)orig_ref; if (for_each_remote(find_tracked_branch, &tracking)) return 1; if (!tracking.matches) switch (track) { case BRANCH_TRACK_ALWAYS: case <API key>: case <API key>: break; default: return 1; } if (tracking.matches > 1) return error(_("Not tracking: ambiguous information for ref %s"), orig_ref); <API key>(config_flags, new_ref, tracking.remote, tracking.src ? tracking.src : orig_ref); free(tracking.src); return 0; } int read_branch_desc(struct strbuf *buf, const char *branch_name) { char *v = NULL; struct strbuf name = STRBUF_INIT; strbuf_addf(&name, "branch.%s.description", branch_name); if (<API key>(name.buf, &v)) { strbuf_release(&name); return -1; } strbuf_addstr(buf, v); free(v); strbuf_release(&name); return 0; } int <API key>(const char *name, struct strbuf *ref, int force, int attr_only) { if (<API key>(ref, name)) die(_("'%s' is not a valid branch name."), name); if (!ref_exists(ref->buf)) return 0; else if (!force && !attr_only) die(_("A branch named '%s' already exists."), ref->buf + strlen("refs/heads/")); if (!attr_only) { const char *head; unsigned char sha1[20]; head = resolve_ref_unsafe("HEAD", 0, sha1, NULL); if (!is_bare_repository() && head && !strcmp(head, ref->buf)) die(_("Cannot force update the current branch.")); } return 1; } static int <API key>(struct remote *remote, void *cb_data) { char *tracking_branch = cb_data; struct refspec query; memset(&query, 0, sizeof(struct refspec)); query.dst = tracking_branch; return !<API key>(remote, &query); } static int <API key>(char *ref) { return !for_each_remote(<API key>, ref); } static const char upstream_not_branch[] = N_("Cannot setup tracking information; starting point '%s' is not a branch."); static const char upstream_missing[] = N_("the requested upstream branch '%s' does not exist"); static const char upstream_advice[] = N_("\n" "If you are planning on basing your work on an upstream\n" "branch that already exists at the remote, you may need to\n" "run \"git fetch\" to retrieve it.\n" "\n" "If you are planning to push out a new local branch that\n" "will track its remote counterpart, you may want to use\n" "\"git push -u\" to set the upstream config as you push."); void create_branch(const char *head, const char *name, const char *start_name, int force, int reflog, int clobber_head, int quiet, enum branch_track track) { struct commit *commit; unsigned char sha1[20]; char *real_ref, msg[PATH_MAX + 20]; struct strbuf ref = STRBUF_INIT; int forcing = 0; int dont_change_ref = 0; int explicit_tracking = 0; if (track == <API key> || track == <API key>) explicit_tracking = 1; if (<API key>(name, &ref, force, track == <API key> || clobber_head)) { if (!force) dont_change_ref = 1; else forcing = 1; } real_ref = NULL; if (get_sha1(start_name, sha1)) { if (explicit_tracking) { if (<API key>) { error(_(upstream_missing), start_name); advise(_(upstream_advice)); exit(1); } die(_(upstream_missing), start_name); } die(_("Not a valid object name: '%s'."), start_name); } switch (dwim_ref(start_name, strlen(start_name), sha1, &real_ref)) { case 0: /* Not branching from any existing branch */ if (explicit_tracking) die(_(upstream_not_branch), start_name); break; case 1: /* Unique completion -- good, only if it is a real branch */ if (!starts_with(real_ref, "refs/heads/") && <API key>(real_ref)) { if (explicit_tracking) die(_(upstream_not_branch), start_name); else real_ref = NULL; } break; default: die(_("Ambiguous object name: '%s'."), start_name); break; } if ((commit = <API key>(sha1)) == NULL) die(_("Not a valid branch point: '%s'."), start_name); hashcpy(sha1, commit->object.oid.hash); if (forcing) snprintf(msg, sizeof msg, "branch: Reset to %s", start_name); else if (!dont_change_ref) snprintf(msg, sizeof msg, "branch: Created from %s", start_name); if (reflog) log_all_ref_updates = 1; if (!dont_change_ref) { struct ref_transaction *transaction; struct strbuf err = STRBUF_INIT; transaction = <API key>(&err); if (!transaction || <API key>(transaction, ref.buf, sha1, forcing ? NULL : null_sha1, 0, msg, &err) || <API key>(transaction, &err)) die("%s", err.buf); <API key>(transaction); strbuf_release(&err); } if (real_ref && track) setup_tracking(ref.buf + 11, real_ref, track, quiet); strbuf_release(&ref); free(real_ref); } void remove_branch_state(void) { unlink(<API key>()); unlink(<API key>()); unlink(git_path_merge_head()); unlink(git_path_merge_rr()); unlink(git_path_merge_msg()); unlink(git_path_merge_mode()); unlink(git_path_squash_msg()); } void die_if_checked_out(const char *branch) { char *existing; existing = find_shared_symref("HEAD", branch); if (existing) { skip_prefix(branch, "refs/heads/", &branch); die(_("'%s' is already checked out at '%s'"), branch, existing); } }
#ifndef <API key> #define <API key> #include <linux/list.h> #include <linux/poll.h> #include <linux/cdev.h> #include <linux/platform_device.h> #include <linux/wakelock.h> #include "linux/types.h" #include <mach/board.h> #include <media/<API key>.h> //#define <API key> #ifdef <API key> #define CDBG(fmt, args...) printk(KERN_INFO "msm_camera: " fmt, ##args) #else #define CDBG(fmt, args...) do { } while (0) #endif #define MSM_CAMERA_MSG 0 #define MSM_CAMERA_EVT 1 #define <API key> 4 #define <API key> 3 #define <API key> 16 #define <API key> 3 #define <API key> 3 #define <API key> 150 #define CROP_LEN 36 enum msm_queue { MSM_CAM_Q_CTRL, /* control command or control command status */ MSM_CAM_Q_VFE_EVT, /* adsp event */ MSM_CAM_Q_VFE_MSG, /* adsp message */ MSM_CAM_Q_V4L2_REQ, /* v4l2 request */ MSM_CAM_Q_VPE_MSG, /* adsp message */ }; enum vfe_resp_msg { VFE_EVENT, VFE_MSG_GENERAL, VFE_MSG_SNAPSHOT, VFE_MSG_OUTPUT_P, /* preview (continuous mode ) */ VFE_MSG_OUTPUT_T, /* thumbnail (snapshot mode )*/ VFE_MSG_OUTPUT_S, /* main image (snapshot mode )*/ VFE_MSG_OUTPUT_V, /* video (continuous mode ) */ VFE_MSG_STATS_AEC, VFE_MSG_STATS_AF, VFE_MSG_STATS_AWB, VFE_MSG_STATS_RS, VFE_MSG_STATS_CS, VFE_MSG_STATS_IHIST, VFE_MSG_STATS_SKIN, VFE_MSG_STATS_WE, /* AEC + AWB */ VFE_MSG_SYNC_TIMER0, VFE_MSG_SYNC_TIMER1, VFE_MSG_SYNC_TIMER2, }; enum vpe_resp_msg { VPE_EVENT, VPE_MSG_GENERAL, VPE_MSG_SNAPSHOT, VPE_MSG_OUTPUT_P, /* preview (continuous mode ) */ VPE_MSG_OUTPUT_T, /* thumbnail (snapshot mode )*/ VPE_MSG_OUTPUT_S, /* main image (snapshot mode )*/ VPE_MSG_OUTPUT_V, /* video (continuous mode ) */ }; struct msm_vpe_phy_info { uint32_t sbuf_phy; uint32_t y_phy; uint32_t cbcr_phy; uint8_t output_id; /* <API key>/S/V */ uint32_t frame_id; }; #define <API key> (0x1 << 0) #define VFE31_OUTPUT_MODE_S (0x1 << 1) #define VFE31_OUTPUT_MODE_V (0x1 << 2) struct msm_vfe_phy_info { uint32_t sbuf_phy; uint32_t y_phy; uint32_t cbcr_phy; uint8_t output_id; /* <API key>/S/V */ uint32_t frame_id; }; struct video_crop_t{ uint32_t in1_w; uint32_t out1_w; uint32_t in1_h; uint32_t out1_h; uint32_t in2_w; uint32_t out2_w; uint32_t in2_h; uint32_t out2_h; uint8_t update_flag; }; struct msm_vpe_buf_info { uint32_t y_phy; uint32_t cbcr_phy; struct timespec ts; uint32_t frame_id; struct video_crop_t vpe_crop; }; struct msm_vfe_resp { enum vfe_resp_msg type; struct msm_vfe_evt_msg evt_msg; struct msm_vfe_phy_info phy; struct msm_vpe_buf_info vpe_bf; void *extdata; int32_t extlen; }; struct msm_vpe_resp { enum vpe_resp_msg type; struct msm_vpe_evt_msg evt_msg; struct msm_vpe_phy_info phy; void *extdata; int32_t extlen; }; struct msm_vpe_callback { void (*vpe_resp)(struct msm_vpe_resp *, enum msm_queue, void *syncdata, void *time_stamp, gfp_t gfp); void* (*vpe_alloc)(int, void *syncdata, gfp_t gfp); void (*vpe_free)(void *ptr); }; struct msm_vfe_callback { void (*vfe_resp)(struct msm_vfe_resp *, enum msm_queue, void *syncdata, gfp_t gfp); void* (*vfe_alloc)(int, void *syncdata, gfp_t gfp); void (*vfe_free)(void *ptr); }; struct msm_camvfe_fn { int (*vfe_init)(struct msm_vfe_callback *, struct platform_device *); int (*vfe_enable)(struct camera_enable_cmd *); int (*vfe_config)(struct msm_vfe_cfg_cmd *, void *); int (*vfe_disable)(struct camera_enable_cmd *, struct platform_device *dev); void (*vfe_release)(struct platform_device *); void (*vfe_stop)(void); }; struct msm_camvpe_fn { int (*vpe_reg)(struct msm_vpe_callback *); int (*vpe_cfg_update) (void *); void (*send_frame_to_vpe) (uint32_t y_phy, uint32_t cbcr_phy, struct timespec *ts); int (*vpe_config)(struct msm_vpe_cfg_cmd *, void *); int *dis; }; struct msm_sensor_ctrl { int (*s_init)(const struct <API key> *); int (*s_release)(void); int (*s_config)(void __user *); enum msm_camera_type s_camera_type; uint32_t s_mount_angle; }; struct <API key> { int (*strobe_flash_init) (struct <API key> *); int (*<API key>) (struct <API key> *, int32_t); int (*strobe_flash_charge)(int32_t, int32_t, uint32_t); }; /* this structure is used in kernel */ struct msm_queue_cmd { struct list_head list_config; struct list_head list_control; struct list_head list_frame; struct list_head list_pict; struct list_head list_vpe_frame; enum msm_queue type; void *command; atomic_t on_heap; struct timespec ts; uint32_t error_code; }; struct msm_device_queue { struct list_head list; spinlock_t lock; wait_queue_head_t wait; int max; int len; const char *name; }; struct msm_sync { /* These two queues are accessed from a process context only * They contain pmem descriptors for the preview frames and the stats * coming from the camera sensor. */ struct hlist_head pmem_frames; struct hlist_head pmem_stats; /* The message queue is used by the control thread to send commands * to the config thread, and also by the DSP to send messages to the * config thread. Thus it is the only queue that is accessed from * both interrupt and process context. */ struct msm_device_queue event_q; /* This queue contains preview frames. It is accessed by the DSP (in * in interrupt context, and by the frame thread. */ struct msm_device_queue frame_q; int unblock_poll_frame; /* This queue contains snapshot frames. It is accessed by the DSP (in * interrupt context, and by the control thread. */ struct msm_device_queue pict_q; int get_pic_abort; struct msm_device_queue vpe_q; struct <API key> *sdata; struct msm_camvfe_fn vfefn; struct msm_camvpe_fn vpefn; struct msm_sensor_ctrl sctrl; struct <API key> sfctrl; struct wake_lock wake_lock; struct platform_device *pdev; int16_t ignore_qcmd_type; uint8_t ignore_qcmd; uint8_t opencnt; void *cropinfo; int croplen; int core_powered_on; struct fd_roi_info fdroiinfo; atomic_t vpe_enable; uint32_t pp_mask; uint8_t pp_frame_avail; struct msm_queue_cmd *pp_prev; struct msm_queue_cmd *pp_snap; struct msm_queue_cmd *pp_thumb; int video_fd; const char *apps_id; struct mutex lock; struct list_head list; uint8_t liveshot_enabled; struct msm_cam_v4l2_device *pcam_sync; spinlock_t pmem_frame_spinlock; spinlock_t pmem_stats_spinlock; spinlock_t abort_pict_lock; }; #define MSM_APPS_ID_V4L2 "msm_v4l2" #define MSM_APPS_ID_PROP "msm_qct" struct msm_cam_device { struct msm_sync *sync; /* most-frequently accessed */ struct device *device; struct cdev cdev; /* opened is meaningful only for the config and frame nodes, * which may be opened only once. */ atomic_t opened; }; struct msm_control_device { struct msm_cam_device *pmsm; /* Used for <API key> responses */ uint8_t ctrl_data[<API key>]; struct msm_ctrl_cmd ctrl; struct msm_queue_cmd qcmd; /* This queue used by the config thread to send responses back to the * control thread. It is accessed only from a process context. */ struct msm_device_queue ctrl_q; }; struct <API key> { uint16_t register_address; uint16_t register_value; }; struct msm_pmem_region { struct hlist_node list; unsigned long paddr; unsigned long len; struct file *file; struct msm_pmem_info info; struct ion_handle *handle; }; struct axidata { uint32_t bufnum1; uint32_t bufnum2; uint32_t bufnum3; struct msm_pmem_region *region; }; #ifdef <API key> int <API key>( struct <API key> *fdata, unsigned led_state); int <API key>(struct msm_sync *sync, uint32_t sftype); int msm_flash_ctrl(struct <API key> *sdata, struct flash_ctrl_data *flash_info); #else static inline int <API key>( struct <API key> *fdata, unsigned led_state) { return -ENOTSUPP; } static inline int <API key>( struct msm_sync *sync, uint32_t sftype) { return -ENOTSUPP; } static inline int msm_flash_ctrl( struct <API key> *sdata, struct flash_ctrl_data *flash_info) { return -ENOTSUPP; } #endif /* Below functions are added for V4L2 kernel APIs */ struct msm_v4l2_driver { struct msm_sync *sync; int (*open)(struct msm_sync *, const char *apps_id, int); int (*release)(struct msm_sync *); int (*ctrl)(struct msm_sync *, struct msm_ctrl_cmd *); int (*reg_pmem)(struct msm_sync *, struct msm_pmem_info *); int (*get_frame) (struct msm_sync *, struct msm_frame *); int (*put_frame) (struct msm_sync *, struct msm_frame *); int (*get_pict) (struct msm_sync *, struct msm_ctrl_cmd *); unsigned int (*drv_poll) (struct msm_sync *, struct file *, struct poll_table_struct *); }; int msm_v4l2_register(struct msm_v4l2_driver *); int msm_v4l2_unregister(struct msm_v4l2_driver *); void msm_camvfe_init(void); int msm_camvfe_check(void *); void msm_camvfe_fn_init(struct msm_camvfe_fn *, void *); void msm_camvpe_fn_init(struct msm_camvpe_fn *, void *); int <API key>(struct platform_device *dev, int (*sensor_probe)(const struct <API key> *, struct msm_sensor_ctrl *)); enum msm_camio_clk_type { CAMIO_VFE_MDC_CLK, CAMIO_MDC_CLK, CAMIO_VFE_CLK, CAMIO_VFE_AXI_CLK, CAMIO_VFE_CAMIF_CLK, CAMIO_VFE_PBDG_CLK, CAMIO_CAM_MCLK_CLK, <API key>, CAMIO_CSI0_VFE_CLK, CAMIO_CSI1_VFE_CLK, CAMIO_VFE_PCLK, CAMIO_CSI_SRC_CLK, CAMIO_CSI0_CLK, CAMIO_CSI1_CLK, CAMIO_CSI0_PCLK, CAMIO_CSI1_PCLK, CAMIO_JPEG_CLK, CAMIO_JPEG_PCLK, CAMIO_VPE_CLK, CAMIO_VPE_PCLK, CAMIO_MAX_CLK }; enum <API key> { <API key>, <API key>, <API key> }; enum msm_s_test_mode { S_TEST_OFF, S_TEST_1, S_TEST_2, S_TEST_3 }; enum msm_s_resolution { S_QTR_SIZE, S_FULL_SIZE, S_INVALID_SIZE }; enum msm_s_reg_update { /* Sensor egisters that need to be updated during initialization */ S_REG_INIT, /* Sensor egisters that needs periodic I2C writes */ S_UPDATE_PERIODIC, /* All the sensor Registers will be updated */ S_UPDATE_ALL, /* Not valid update */ S_UPDATE_INVALID }; enum msm_s_setting { S_RES_PREVIEW, S_RES_CAPTURE }; enum <API key> { S_INIT, S_PREVIEW, S_VIDEO, S_CAPTURE, S_DEFAULT, S_EXIT }; int msm_camio_enable(struct platform_device *dev); int <API key>(void); int <API key>(void); int <API key>(void); int <API key>(void); int <API key>(enum msm_camio_clk_type clk); int <API key>(enum msm_camio_clk_type clk); int <API key>(uint32_t freq); void <API key>(int rate); void <API key>(int rate); void <API key>(struct clk *clk, int rate); void <API key>(struct clk *clk, int rate); void <API key>(int rate); void <API key>(enum msm_s_setting); void <API key>(struct platform_device *); void <API key>(void); void <API key>(void); void <API key>(void); void msm_camio_clk_sel(enum <API key>); void msm_camio_disable(struct platform_device *); int msm_camio_probe_on(struct platform_device *); int msm_camio_probe_off(struct platform_device *); int <API key>(struct platform_device *); int <API key>(struct platform_device *); int <API key>(struct <API key> *csi_params); int add_axi_qos(void); int update_axi_qos(uint32_t freq); void release_axi_qos(void); void msm_io_w(u32 data, void __iomem *addr); void msm_io_w_mb(u32 data, void __iomem *addr); u32 msm_io_r(void __iomem *addr); u32 msm_io_r_mb(void __iomem *addr); void msm_io_dump(void __iomem *addr, int size); void msm_io_memcpy(void __iomem *dest_addr, void __iomem *src_addr, u32 len); void <API key>(enum <API key>); #endif
#include "<API key>.h" #include "qgslayout.h" #include "qgslayoutitemmap.h" #include "qgsprintlayout.h" #include "<API key>.h" #include "qgslayoutexporter.h" @cond PRIVATE QString <API key>::name() const { return QStringLiteral( "printlayouttopdf" ); } QString <API key>::displayName() const { return QObject::tr( "Export print layout as PDF" ); } QStringList <API key>::tags() const { return QObject::tr( "layout,composer,composition,save" ).split( ',' ); } QString <API key>::group() const { return QObject::tr( "Cartography" ); } QString <API key>::groupId() const { return QStringLiteral( "cartography" ); } QString <API key>::shortDescription() const { return QObject::tr( "Exports a print layout as a PDF." ); } QString <API key>::shortHelpString() const { return QObject::tr( "This algorithm outputs a print layout as a PDF file." ); } void <API key>::initAlgorithm( const QVariantMap & ) { addParameter( new <API key>( QStringLiteral( "LAYOUT" ), QObject::tr( "Print layout" ) ) ); std::unique_ptr< <API key> > layersParam = std::make_unique< <API key>>( QStringLiteral( "LAYERS" ), QObject::tr( "Map layers to assign to unlocked map item(s)" ), QgsProcessing::TypeMapLayer, QVariant(), true ); layersParam->setFlags( layersParam->flags() | <API key>::FlagAdvanced ); addParameter( layersParam.release() ); std::unique_ptr< <API key> > dpiParam = std::make_unique< <API key> >( QStringLiteral( "DPI" ), QObject::tr( "DPI (leave blank for default layout DPI)" ), <API key>::Double, QVariant(), true, 0 ); dpiParam->setFlags( dpiParam->flags() | <API key>::FlagAdvanced ); addParameter( dpiParam.release() ); std::unique_ptr< <API key> > forceVectorParam = std::make_unique< <API key> >( QStringLiteral( "FORCE_VECTOR" ), QObject::tr( "Always export as vectors" ), false ); forceVectorParam->setFlags( forceVectorParam->flags() | <API key>::FlagAdvanced ); addParameter( forceVectorParam.release() ); std::unique_ptr< <API key> > appendGeorefParam = std::make_unique< <API key> >( QStringLiteral( "GEOREFERENCE" ), QObject::tr( "Append georeference information" ), true ); appendGeorefParam->setFlags( appendGeorefParam->flags() | <API key>::FlagAdvanced ); addParameter( appendGeorefParam.release() ); std::unique_ptr< <API key> > exportRDFParam = std::make_unique< <API key> >( QStringLiteral( "INCLUDE_METADATA" ), QObject::tr( "Export RDF metadata (title, author, etc.)" ), true ); exportRDFParam->setFlags( exportRDFParam->flags() | <API key>::FlagAdvanced ); addParameter( exportRDFParam.release() ); std::unique_ptr< <API key> > disableTiled = std::make_unique< <API key> >( QStringLiteral( "DISABLE_TILED" ), QObject::tr( "Disable tiled raster layer exports" ), false ); disableTiled->setFlags( disableTiled->flags() | <API key>::FlagAdvanced ); addParameter( disableTiled.release() ); std::unique_ptr< <API key> > simplify = std::make_unique< <API key> >( QStringLiteral( "SIMPLIFY" ), QObject::tr( "Simplify geometries to reduce output file size" ), true ); simplify->setFlags( simplify->flags() | <API key>::FlagAdvanced ); addParameter( simplify.release() ); QStringList textExportOptions { QObject::tr( "Always Export Text as Paths (Recommended)" ), QObject::tr( "Always Export Text as Text Objects" ) }; std::unique_ptr< <API key> > textFormat = std::make_unique< <API key> >( QStringLiteral( "TEXT_FORMAT" ), QObject::tr( "Text export" ), textExportOptions, false, 0 ); textFormat->setFlags( textFormat->flags() | <API key>::FlagAdvanced ); addParameter( textFormat.release() ); std::unique_ptr< <API key> > layeredExport = std::make_unique< <API key> >( QStringLiteral( "SEPARATE_LAYERS" ), QObject::tr( "Export layers as separate PDF files" ), false ); layeredExport->setFlags( layeredExport->flags() | <API key>::FlagAdvanced ); addParameter( layeredExport.release() ); addParameter( new <API key>( QStringLiteral( "OUTPUT" ), QObject::tr( "PDF file" ), QObject::tr( "PDF Format" ) + " (*.pdf *.PDF)" ) ); } <API key>::Flags <API key>::flags() const { return <API key>::flags() | FlagNoThreading; } <API key> *<API key>::createInstance() const { return new <API key>(); } QVariantMap <API key>::processAlgorithm( const QVariantMap &parameters, <API key> &context, <API key> *feedback ) { // this needs to be done in main thread, layouts are not thread safe QgsPrintLayout *l = parameterAsLayout( parameters, QStringLiteral( "LAYOUT" ), context ); if ( !l ) throw <API key>( QObject::tr( "Cannot find layout with name \"%1\"" ).arg( parameters.value( QStringLiteral( "LAYOUT" ) ).toString() ) ); std::unique_ptr< QgsPrintLayout > layout( l->clone() ); const QList< QgsMapLayer * > layers = <API key>( parameters, QStringLiteral( "LAYERS" ), context ); if ( layers.size() > 0 ) { const QList<QGraphicsItem *> items = layout->items(); for ( QGraphicsItem *graphicsItem : items ) { QgsLayoutItem *item = dynamic_cast<QgsLayoutItem *>( graphicsItem ); QgsLayoutItemMap *map = dynamic_cast<QgsLayoutItemMap *>( item ); if ( map && !map-><API key>() && !map->keepLayerSet() ) { map->setKeepLayerSet( true ); map->setLayers( layers ); } } } const QString dest = <API key>( parameters, QStringLiteral( "OUTPUT" ), context ); QgsLayoutExporter exporter( layout.get() ); QgsLayoutExporter::PdfExportSettings settings; if ( parameters.value( QStringLiteral( "DPI" ) ).isValid() ) { settings.dpi = parameterAsDouble( parameters, QStringLiteral( "DPI" ), context ); } settings.forceVectorOutput = parameterAsBool( parameters, QStringLiteral( "FORCE_VECTOR" ), context ); settings.appendGeoreference = parameterAsBool( parameters, QStringLiteral( "GEOREFERENCE" ), context ); settings.exportMetadata = parameterAsBool( parameters, QStringLiteral( "INCLUDE_METADATA" ), context ); settings.exportMetadata = parameterAsBool( parameters, QStringLiteral( "INCLUDE_METADATA" ), context ); settings.simplifyGeometries = parameterAsBool( parameters, QStringLiteral( "SIMPLIFY" ), context ); settings.textRenderFormat = parameterAsEnum( parameters, QStringLiteral( "TEXT_FORMAT" ), context ) == 0 ? QgsRenderContext::<API key> : QgsRenderContext::<API key>; settings.<API key> = parameterAsBool( parameters, QStringLiteral( "SEPARATE_LAYERS" ), context ); //#spellok if ( parameterAsBool( parameters, QStringLiteral( "DISABLE_TILED" ), context ) ) settings.flags = settings.flags | <API key>::<API key>; else settings.flags = settings.flags & ~<API key>::<API key>; switch ( exporter.exportToPdf( dest, settings ) ) { case QgsLayoutExporter::Success: { feedback->pushInfo( QObject::tr( "Successfully exported layout to %1" ).arg( QDir::toNativeSeparators( dest ) ) ); break; } case QgsLayoutExporter::FileError: throw <API key>( QObject::tr( "Cannot write to %1.\n\nThis file may be open in another application." ).arg( QDir::toNativeSeparators( dest ) ) ); case QgsLayoutExporter::PrintError: throw <API key>( QObject::tr( "Could not create print device." ) ); case QgsLayoutExporter::MemoryError: throw <API key>( QObject::tr( "Exporting the PDF " "resulted in a memory overflow.\n\n" "Please try a lower resolution or a smaller paper size." ) ); case QgsLayoutExporter::SvgLayerError: case QgsLayoutExporter::IteratorError: case QgsLayoutExporter::Canceled: // no meaning for PDF exports, will not be encountered break; } feedback->setProgress( 100 ); QVariantMap outputs; outputs.insert( QStringLiteral( "OUTPUT" ), dest ); return outputs; } @endcond
<?php /** * @see <API key> */ #require_once 'Zend/Tool/Project/Context/Filesystem/File.php'; class <API key> extends <API key> { /** * @var string */ protected $_forClassName = ''; /** * getName() * * @return string */ public function getName() { return 'TestLibraryFile'; } /** * init() * * @return <API key> */ public function init() { $this->_forClassName = $this->_resource->getAttribute('forClassName'); $this->_filesystemName = ucfirst(ltrim(strrchr($this->_forClassName, '_'), '_')) . 'Test.php'; parent::init(); return $this; } /** * getContents() * * @return string */ public function getContents() { $filter = new <API key>(); $className = $filter->filter($this->_forClassName) . 'Test'; $codeGenFile = new <API key>(array( 'requiredFiles' => array( 'PHPUnit/Framework/TestCase.php' ), 'classes' => array( new <API key>(array( 'name' => $className, 'extendedClass' => '<API key>', 'methods' => array( new <API key>(array( 'name' => 'setUp', 'body' => ' /* Setup Routine */' )), new <API key>(array( 'name' => 'tearDown', 'body' => ' /* Tear Down Routine */' )) ) )) ) )); return $codeGenFile->generate(); } }
#include "pub_core_basics.h" #include "pub_core_debuglog.h" #include "pub_core_vki.h" #include "pub_core_vkiscnums.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_syscall.h" #include "pub_core_libcsignal.h" /* self */ #if !defined(VGO_solaris) # define _VKI_MAXSIG (_VKI_NSIG - 1) #endif STATIC_ASSERT((_VKI_MAXSIG % _VKI_NSIG_BPW) != 0); /* IMPORTANT: on Darwin it is essential to use the _nocancel versions of syscalls rather than the vanilla version, if a _nocancel version is available. See docs/internals/Darwin-notes.txt for the reason why. */ /* sigemptyset, sigfullset, sigaddset and sigdelset return 0 on success and -1 on error. */ /* In the sigset routines below, be aware that _VKI_NSIG_BPW can be either 32 or 64, and hence the sig[] words can either be 32- or 64-bits. And which they are it doesn't necessarily follow from the host word size. */ /* Functions VG_(isemptysigset) and VG_(isfullsigset) check only bits that represent valid signals (i.e. signals <= _VKI_MAXSIG). The same applies for the comparison in VG_(iseqsigset). This is important because when a signal set is received from an operating system then bits which represent signals > _VKI_MAXSIG can have unexpected values for Valgrind. This is mainly specific to the Solaris kernel which clears these bits. */ Int VG_(sigfillset)( vki_sigset_t* set ) { Int i; if (set == NULL) return -1; for (i = 0; i < _VKI_NSIG_WORDS; i++) set->sig[i] = ~0; return 0; } Int VG_(sigemptyset)( vki_sigset_t* set ) { Int i; if (set == NULL) return -1; for (i = 0; i < _VKI_NSIG_WORDS; i++) set->sig[i] = 0; return 0; } Bool VG_(isemptysigset)( const vki_sigset_t* set ) { Int i; vg_assert(set != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) { if (_VKI_NSIG_BPW * (i + 1) <= (_VKI_MAXSIG + 1)) { /* Full word check. */ if (set->sig[i] != 0) return False; } else { /* Partial word check. */ ULong mask = ((ULong)1UL << (_VKI_MAXSIG % _VKI_NSIG_BPW)) - 1; if ((set->sig[i] & mask) != 0) return False; break; } } return True; } Bool VG_(isfullsigset)( const vki_sigset_t* set ) { Int i; vg_assert(set != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) { if (_VKI_NSIG_BPW * (i + 1) <= (_VKI_MAXSIG + 1)) { /* Full word check. */ if (set->sig[i] != ~0) return False; } else { /* Partial word check. */ ULong mask = ((ULong)1UL << (_VKI_MAXSIG % _VKI_NSIG_BPW)) - 1; if ((set->sig[i] & mask) != mask) return False; break; } } return True; } Bool VG_(iseqsigset)( const vki_sigset_t* set1, const vki_sigset_t* set2 ) { Int i; vg_assert(set1 != NULL && set2 != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) { if (_VKI_NSIG_BPW * (i + 1) <= (_VKI_MAXSIG + 1)) { /* Full word comparison. */ if (set1->sig[i] != set2->sig[i]) return False; } else { /* Partial word comparison. */ ULong mask = ((ULong)1UL << (_VKI_MAXSIG % _VKI_NSIG_BPW)) - 1; if ((set1->sig[i] & mask) != (set2->sig[i] & mask)) return False; break; } } return True; } Int VG_(sigaddset)( vki_sigset_t* set, Int signum ) { if (set == NULL) return -1; if (signum < 1 || signum > _VKI_NSIG) return -1; signum set->sig[signum / _VKI_NSIG_BPW] |= (1ULL << (signum % _VKI_NSIG_BPW)); return 0; } Int VG_(sigdelset)( vki_sigset_t* set, Int signum ) { if (set == NULL) return -1; if (signum < 1 || signum > _VKI_NSIG) return -1; signum set->sig[signum / _VKI_NSIG_BPW] &= ~(1ULL << (signum % _VKI_NSIG_BPW)); return 0; } Int VG_(sigismember) ( const vki_sigset_t* set, Int signum ) { if (set == NULL) return 0; if (signum < 1 || signum > _VKI_NSIG) return 0; signum if (1 & ((set->sig[signum / _VKI_NSIG_BPW]) >> (signum % _VKI_NSIG_BPW))) return 1; else return 0; } /* Add all signals in src to dst. */ void VG_(sigaddset_from_set)( vki_sigset_t* dst, const vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) dst->sig[i] |= src->sig[i]; } /* Remove all signals in src from dst. */ void VG_(sigdelset_from_set)( vki_sigset_t* dst, const vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) dst->sig[i] &= ~(src->sig[i]); } /* dst = dst `intersect` src. */ void VG_(sigintersectset)( vki_sigset_t* dst, const vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) dst->sig[i] &= src->sig[i]; } /* dst = ~src */ void VG_(sigcomplementset)( vki_sigset_t* dst, const vki_sigset_t* src ) { Int i; vg_assert(dst != NULL && src != NULL); for (i = 0; i < _VKI_NSIG_WORDS; i++) dst->sig[i] = ~ src->sig[i]; } /* The functions sigaction, sigprocmask, sigpending and sigsuspend return 0 on success and -1 on error. */ Int VG_(sigprocmask)( Int how, const vki_sigset_t* set, vki_sigset_t* oldset) { # if defined(VGO_linux) || defined(VGO_solaris) # if defined(__NR_rt_sigprocmask) SysRes res = VG_(do_syscall4)(__NR_rt_sigprocmask, how, (UWord)set, (UWord)oldset, _VKI_NSIG_WORDS * sizeof(UWord)); # else SysRes res = VG_(do_syscall3)(__NR_sigprocmask, how, (UWord)set, (UWord)oldset); # endif # elif defined(VGO_darwin) /* On Darwin, __NR_sigprocmask appears to affect the entire process, not just this thread. Hence need to use <API key> instead. */ SysRes res = VG_(do_syscall3)(<API key>, how, (UWord)set, (UWord)oldset); # else # error "Unknown OS" # endif return sr_isError(res) ? -1 : 0; } #if defined(VGO_darwin) /* A helper function for sigaction on Darwin. */ static void darwin_signal_demux(void* a1, UWord a2, UWord a3, void* a4, void* a5) { VG_(debugLog)(2, "libcsignal", "PRE demux sig, a2 = %lu, signo = %lu\n", a2, a3); if (a2 == 1) ((void(*)(int))a1) (a3); else ((void(*)(int,void*,void*))a1) (a3,a4,a5); VG_(debugLog)(2, "libcsignal", "POST demux sig, a2 = %lu, signo = %lu\n", a2, a3); VG_(do_syscall2)(__NR_sigreturn, (UWord)a5, 0x1E); /* NOTREACHED */ __asm__ __volatile__("ud2"); } #endif Int VG_(sigaction) ( Int signum, const vki_sigaction_toK_t* act, <API key>* oldact) { # if defined(VGO_linux) /* Normal case: vki_sigaction_toK_t and <API key> are identical types. */ SysRes res = VG_(do_syscall4)(__NR_rt_sigaction, signum, (UWord)act, (UWord)oldact, _VKI_NSIG_WORDS * sizeof(UWord)); return sr_isError(res) ? -1 : 0; # elif defined(VGO_darwin) /* If we're passing a new action to the kernel, make a copy of the new action, install our own sa_tramp field in it, and ignore whatever we were provided with. This is OK because all the sigaction requests come from m_signals, and are not directly what the client program requested, so there is no chance that we will inadvertently ignore the sa_tramp field requested by the client. (In fact m_signals does ignore it when building signal frames for the client, but that's a completely different matter). If we're receiving an old action from the kernel, be very paranoid and make sure the kernel doesn't trash bits of memory that we don't expect it to. */ SysRes res; vki_sigaction_toK_t actCopy; struct { ULong before[2]; <API key> oa; ULong after[2]; } oldactCopy; vki_sigaction_toK_t* real_act; <API key>* real_oldact; real_act = act ? &actCopy : NULL; real_oldact = oldact ? &oldactCopy.oa : NULL; VG_(memset)(&oldactCopy, 0x55, sizeof(oldactCopy)); if (real_act) { *real_act = *act; real_act->sa_tramp = (void*)&darwin_signal_demux; } res = VG_(do_syscall3)(__NR_sigaction, signum, (UWord)real_act, (UWord)real_oldact); if (real_oldact) { vg_assert(oldactCopy.before[0] == <API key>); vg_assert(oldactCopy.before[1] == <API key>); vg_assert(oldactCopy.after[0] == <API key>); vg_assert(oldactCopy.after[1] == <API key>); *oldact = *real_oldact; } return sr_isError(res) ? -1 : 0; # elif defined(VGO_solaris) /* vki_sigaction_toK_t and <API key> are identical types. */ SysRes res = VG_(do_syscall3)(__NR_sigaction, signum, (UWord)act, (UWord)oldact); return sr_isError(res) ? -1 : 0; # else # error "Unsupported OS" # endif } /* See explanation in pub_core_libcsignal.h. */ void VG_(<API key>)( const <API key>* fromK, /*OUT*/vki_sigaction_toK_t* toK ) { # if defined(VGO_linux) || defined(VGO_solaris) *toK = *fromK; # elif defined(VGO_darwin) toK->ksa_handler = fromK->ksa_handler; toK->sa_tramp = NULL; /* the cause of all the difficulty */ toK->sa_mask = fromK->sa_mask; toK->sa_flags = fromK->sa_flags; # else # error "Unsupported OS" # endif } Int VG_(kill)( Int pid, Int signo ) { # if defined(VGO_linux) || defined(VGO_solaris) SysRes res = VG_(do_syscall2)(__NR_kill, pid, signo); # elif defined(VGO_darwin) SysRes res = VG_(do_syscall3)(__NR_kill, pid, signo, 1/*posix-compliant*/); # else # error "Unsupported OS" # endif return sr_isError(res) ? -1 : 0; } Int VG_(tkill)( Int lwpid, Int signo ) { # if defined(__NR_tkill) SysRes res = VG_(mk_SysRes_Error)(VKI_ENOSYS); res = VG_(do_syscall2)(__NR_tkill, lwpid, signo); if (sr_isError(res) && sr_Err(res) == VKI_ENOSYS) res = VG_(do_syscall2)(__NR_kill, lwpid, signo); return sr_isError(res) ? -1 : 0; # elif defined(VGO_darwin) // Note that the __pthread_kill syscall takes a Mach thread, not a pthread. SysRes res; res = VG_(do_syscall2)(__NR___pthread_kill, lwpid, signo); return sr_isError(res) ? -1 : 0; # elif defined(VGO_solaris) SysRes res; # if defined(<API key>) # if defined(<API key>) res = VG_(do_syscall6)(__NR_lwp_sigqueue, 0, lwpid, signo, 0, VKI_SI_LWP, 0); # else res = VG_(do_syscall5)(__NR_lwp_sigqueue, lwpid, signo, 0, VKI_SI_LWP, 0); # endif # else res = VG_(do_syscall2)(__NR_lwp_kill, lwpid, signo); # endif return sr_isError(res) ? -1 : 0; # else # error "Unsupported plat" # endif } /* A cut-down version of POSIX sigtimedwait: poll for pending signals mentioned in the sigset_t, and if any are present, select one arbitrarily, return its number (which must be > 0), and put auxiliary info about it in the siginfo_t, and make it <API key>. If none are pending, return zero. The _zero refers to the fact that there is zero timeout, so if no signals are pending it returns immediately. Perhaps a better name would be 'sigpoll'. Returns -1 on error, 0 if no signals pending, and n > 0 if signal n was selected. The Linux implementation is trivial: do the corresponding syscall. The Darwin implementation is horrible and probably broken in a dozen obscure ways. I suspect it's only thread-safe because V forces single-threadedness. */ #if defined(VGO_linux) Int VG_(sigtimedwait_zero)( const vki_sigset_t *set, vki_siginfo_t *info ) { static const struct vki_timespec zero = { 0, 0 }; SysRes res = VG_(do_syscall4)(<API key>, (UWord)set, (UWord)info, (UWord)&zero, sizeof(*set)); return sr_isError(res) ? -1 : sr_Res(res); } #elif defined(VGO_darwin) //static void show_set ( HChar* str, const vki_sigset_t* set ) { // Int i; // VG_(printf)("%s { ", str); // for (i = 1; i <= _VKI_NSIG; i++) { // if (VG_(sigismember)(set, i)) // VG_(printf)("%u ", i); // VG_(printf)("}\n"); /* The general idea is: - use sigpending to find out which signals are pending - choose one - temporarily set its handler to <API key> - use sigsuspend atomically unblock it and wait for the signal. Upon return, sigsuspend restores the signal mask to what it was to start with. - Restore the handler for the signal to whatever it was before. */ /* A signal handler which does nothing (it doesn't need to). It does however check that it's not handing a sync signal for which returning is meaningless. */ static void <API key> ( Int sig ) { /* XXX this is wrong -- get rid of these. We could get _any_ signal here */ vg_assert(sig != VKI_SIGILL); vg_assert(sig != VKI_SIGSEGV); vg_assert(sig != VKI_SIGBUS); vg_assert(sig != VKI_SIGTRAP); /* do nothing */ } Int VG_(sigtimedwait_zero)( const vki_sigset_t *set, vki_siginfo_t *info ) { const Bool debug = False; Int i, ir; SysRes sr; vki_sigset_t pending, blocked, allbutone; vki_sigaction_toK_t sa, saved_sa2; <API key> saved_sa; //show_set("STWZ: looking for", set); /* Find out what's pending: Darwin sigpending */ sr = VG_(do_syscall1)(__NR_sigpending, (UWord)&pending); vg_assert(!sr_isError(sr)); /* don't try for signals not in 'set' */ /* pending = pending `intersect` set */ VG_(sigintersectset)(&pending, (const vki_sigset_t*)set); /* don't try for signals not blocked at the moment */ ir = VG_(sigprocmask)(VKI_SIG_SETMASK, NULL, &blocked); vg_assert(ir == 0); /* pending = pending `intersect` blocked */ VG_(sigintersectset)(&pending, &blocked); /* decide which signal we're going to snarf */ for (i = 1; i < _VKI_NSIG; i++) if (VG_(sigismember)(&pending,i)) break; if (i == _VKI_NSIG) return 0; if (debug) VG_(debugLog)(0, "libcsignal", "sigtimedwait_zero: snarfing signal %d\n", i ); /* fetch signal i. pre: i is blocked and pending pre: we are the only thread running */ /* Set up alternative signal handler */ VG_(sigfillset)(&sa.sa_mask); sa.ksa_handler = &<API key>; sa.sa_flags = 0; ir = VG_(sigaction)(i, &sa, &saved_sa); vg_assert(ir == 0); /* Switch signal masks and wait for the signal. This should happen immediately, since we've already established it is pending and blocked. */ VG_(sigfillset)(&allbutone); VG_(sigdelset)(&allbutone, i); /* Note: pass the sig mask by value here, not reference (!) */ vg_assert(_VKI_NSIG_WORDS == 1); sr = VG_(do_syscall3)(<API key>, (UWord)allbutone.sig[0], 0,0); if (debug) VG_(debugLog)(0, "libcsignal", "sigtimedwait_zero: sigsuspend got " "res: %s %#lx\n", sr_isError(sr) ? "FAIL" : "SUCCESS", sr_isError(sr) ? sr_Err(sr) : sr_Res(sr)); vg_assert(sr_isError(sr)); vg_assert(sr_Err(sr) == VKI_EINTR); /* Restore signal's handler to whatever it was before */ VG_(<API key>)( &saved_sa, &saved_sa2 ); ir = VG_(sigaction)(i, &saved_sa2, NULL); vg_assert(ir == 0); /* This is bogus - we could get more info from the sighandler. */ VG_(memset)( info, 0, sizeof(*info) ); info->si_signo = i; return i; } #elif defined(VGO_solaris) Int VG_(sigtimedwait_zero)( const vki_sigset_t *set, vki_siginfo_t *info ) { /* Trivial as on Linux. */ static const struct vki_timespec zero = { 0, 0 }; SysRes res = VG_(do_syscall3)(__NR_sigtimedwait, (UWord)set, (UWord)info, (UWord)&zero); return sr_isError(res) ? -1 : sr_Res(res); } #else # error "Unknown OS" #endif
<?php /** * @file * Definition of Drupal\search\Tests\SearchBlockTest. */ namespace Drupal\search\Tests; /** * Tests the rendering of the search block. */ class SearchBlockTest extends SearchTestBase { /** * Modules to enable. * * @var array */ public static $modules = array('block'); public static function getInfo() { return array( 'name' => 'Block availability', 'description' => 'Check if the search form block is available.', 'group' => 'Search', ); } function setUp() { parent::setUp(); // Create and login user. $admin_user = $this->drupalCreateUser(array('administer blocks', 'search content')); $this->drupalLogin($admin_user); } /** * Test that the search form block can be placed and works. */ protected function testSearchFormBlock() { // Test availability of the search block in the admin "Place blocks" list. $this->drupalGet('admin/structure/block'); $this->assertLinkByHref('/admin/structure/block/add/search_form_block/stark', 0, 'Did not find the search block in block candidate list.'); $block = $this->drupalPlaceBlock('search_form_block'); $this->drupalGet(''); $this->assertText($block->label(), 'Block title was found.'); // Test a normal search via the block form, from the front page. $terms = array('search_block_form' => 'test'); $this->drupalPostForm('', $terms, t('Search')); $this->assertResponse(200); $this->assertText('Your search yielded no results'); // Test a search from the block on a 404 page. $this->drupalGet('foo'); $this->assertResponse(404); $this->drupalPostForm(NULL, $terms, t('Search')); $this->assertResponse(200); $this->assertText('Your search yielded no results'); $visibility = $block->get('visibility'); $visibility['path']['pages'] = 'search'; $block->set('visibility', $visibility); $this->drupalPostForm('', $terms, t('Search')); $this->assertResponse(200); $this->assertText('Your search yielded no results'); // Confirm that the user is redirected to the search page. $this->assertEqual( $this->getUrl(), url('search/node/' . $terms['search_block_form'], array('absolute' => TRUE)), 'Redirected to correct url.' ); // Test an empty search via the block form, from the front page. $terms = array('search_block_form' => ''); $this->drupalPostForm('', $terms, t('Search')); $this->assertResponse(200); $this->assertText('Please enter some keywords'); // Confirm that the user is redirected to the search page, when form is // submitted empty. $this->assertEqual( $this->getUrl(), url('search/node/', array('absolute' => TRUE)), 'Redirected to correct url.' ); } }
define(["../../buildControl"], function(bc){ if(bc.stripConsole){ var consoleMethods = "assert|count|debug|dir|dirxml|group|groupEnd|info|profile|profileEnd|time|timeEnd|trace|log"; if(bc.stripConsole === "warn"){ consoleMethods += "|warn"; }else if(bc.stripConsole === "all"){ consoleMethods += "|warn|error"; } // Match on "window.console" and plain "console" but not things like "myconsole" or "my.console" var stripConsoleRe = new RegExp("([^\\w\\.]|^)((window.)?console\\.(" + consoleMethods + ")\\s*\\()", "g"); return function(text){ return text.replace(stripConsoleRe, "$1 0 && $2"); }; }else{ return function(text){ return text; }; } });
#!/bin/sh # verify that ls -lL works when applied to a symlink to an ACL'd file # This program is free software: you can redistribute it and/or modify # (at your option) any later version. # This program is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ ls require_setfacl_ touch k || framework_failure_ setfacl -m user::r-- k || framework_failure_ ln -s k s || framework_failure_ set _ $(ls -Log s); shift; link=$1 set _ $(ls -og k); shift; reg=$1 test "$link" = "$reg" || fail=1 Exit $fail
/** * This file contains JS functionality required by mforms and is included automatically * when required. */ // Namespace for the form bits and bobs M.form = M.form || {}; /** * Initialises the show advanced functionality and events. * This should only ever happen ONCE per page. * * @param {YUI} Y * @param {object} config */ M.form.initShowAdvanced = function(Y, config) { if (M.form.showAdvanced) { return M.form.showAdvanced; } var showAdvanced = function(config) { showAdvanced.superclass.constructor.apply(this, arguments); }; showAdvanced.prototype = { _advButtons : [], _advAreas : [], _stateInput : null, initializer : function() { this._advAreas = Y.all('form .advanced'); this._advButtons = Y.all('.showadvancedbtn'); if (this._advButtons.size() > 0) { this._stateInput = new Y.NodeList(document.getElementsByName('<API key>')); this._advButtons.on('click', this.switchState, this); } }, /** * Toggles between showing advanced items and hiding them. * Should be fired by an event. */ switchState : function(e) { e.preventDefault(); if (this._stateInput.get('value')=='1') { this._stateInput.set('value', '0'); this._advButtons.setAttribute('value', M.str.form.showadvanced); this._advAreas.addClass('hide'); } else { this._stateInput.set('value', '1'); this._advButtons.setAttribute('value', M.str.form.hideadvanced); this._advAreas.removeClass('hide'); } } }; // Extend it with the YUI widget fw. Y.extend(showAdvanced, Y.Base, showAdvanced.prototype, { NAME : 'mform-showAdvanced' }); M.form.showAdvanced = new showAdvanced(config); return M.form.showAdvanced; }; /** * Initialises a manager for a forms dependencies. * This should happen once per form. */ M.form.<API key> = function(Y, formid, dependencies) { // If the dependencies isn't an array or object we don't want to // know about it if (!Y.Lang.isArray(dependencies) && !Y.Lang.isObject(dependencies)) { return false; } Y.Node.ATTRS.elements = { getter: function() { return Y.all(new Y.Array(this._node.elements, 0, true)); } }; // Define the dependency manager if it hasn't already been defined. M.form.dependencyManager = M.form.dependencyManager || (function(){ var dependencyManager = function(config) { dependencyManager.superclass.constructor.apply(this, arguments); }; dependencyManager.prototype = { _form : null, _depElements : [], _nameCollections : [], initializer : function(config) { var i = 0, nodeName; this._form = Y.one('#'+formid); for (i in dependencies) { this._depElements[i] = this.elementsByName(i); if (this._depElements[i].size() == 0) { continue; } this._depElements[i].each(function(node){ nodeName = node.get('nodeName').toUpperCase(); if (nodeName == 'INPUT') { if (node.getAttribute('type').match(/^(button|submit|radio|checkbox)$/)) { node.on('click', this.checkDependencies, this); } else { node.on('blur', this.checkDependencies, this); } node.on('change', this.checkDependencies, this); } else if (nodeName == 'SELECT') { node.on('change', this.checkDependencies, this); } else { node.on('click', this.checkDependencies, this); node.on('blur', this.checkDependencies, this); node.on('change', this.checkDependencies, this); } }, this); } this._form.get('elements').each(function(input){ if (input.getAttribute('type')=='reset') { input.on('click', function(){ this._form.reset(); this.checkDependencies(); }, this); } }, this); return this.checkDependencies(null); }, /** * Gets all elements in the form by thier name and returns * a YUI NodeList * @return Y.NodeList */ elementsByName : function(name) { if (!this._nameCollections[name]) { var elements = []; this._form.get('elements').each(function(){ if (this.getAttribute('name') == name) { elements.push(this); } }); this._nameCollections[name] = new Y.NodeList(elements); } return this._nameCollections[name]; }, /** * Checks the dependencies the form has an makes any changes to the * form that are required. * * Changes are made by functions title _dependency_{dependencytype} * and more can easily be introduced by defining further functions. */ checkDependencies : function(e) { var tolock = [], tohide = [], dependon, condition, value, lock, hide, checkfunction, result; for (dependon in dependencies) { if (this._depElements[dependon].size() == 0) { continue; } for (condition in dependencies[dependon]) { for (value in dependencies[dependon][condition]) { lock = false; hide = false; checkfunction = '_dependency_'+condition; if (Y.Lang.isFunction(this[checkfunction])) { result = this[checkfunction].apply(this, [this._depElements[dependon], value, e]); } else { result = this._dependency_default(this._depElements[dependon], value, e); } lock = result.lock || false; hide = result.hide || false; for (var ei in dependencies[dependon][condition][value]) { var eltolock = dependencies[dependon][condition][value][ei]; if (hide) { tohide[eltolock] = true; } if (tolock[eltolock] != null) { tolock[eltolock] = lock || tolock[eltolock]; } else { tolock[eltolock] = lock; } } } } } for (var el in tolock) { this._disableElement(el, tolock[el]); if (tohide.<API key>(el)) { this._hideElement(el, tohide[el]); } } return true; }, /** * Disabled all form elements with the given name */ _disableElement : function(name, disabled) { var els = this.elementsByName(name); els.each(function(){ if (disabled) { this.setAttribute('disabled', 'disabled'); } else { this.removeAttribute('disabled'); } }) }, /** * Hides all elements with the given name. */ _hideElement : function(name, hidden) { var els = this.elementsByName(name); els.each(function(){ var e = els.ancestor('.fitem'); if (e) { e.setStyles({ display : (hidden)?'none':'' }) } }); }, <API key> : function(elements, value) { var lock = false; elements.each(function(){ if (this.getAttribute('type').toLowerCase()=='radio' && this.get('value') != value) { return; } lock = lock || !Y.Node.getDOMNode(this).checked; }); return { lock : lock, hide : false } }, _dependency_checked : function(elements, value) { var lock = false; elements.each(function(){ if (this.getAttribute('type').toLowerCase()=='radio' && this.get('value') != value) { return; } lock = lock || Y.Node.getDOMNode(this).checked; }); return { lock : lock, hide : false } }, <API key> : function(elements, value) { var lock = false; elements.each(function(){ lock = lock || this.get('selectedIndex') == -1; }); return { lock : lock, hide : false } }, _dependency_eq : function(elements, value) { var lock = false; elements.each(function(){ if (this.getAttribute('type').toLowerCase()=='radio' && !Y.Node.getDOMNode(this).checked) { return; } else if (this.getAttribute('type').toLowerCase() == 'checkbox' && !Y.Node.getDOMNode(this).checked) { return; } lock = lock || this.get('value') == value; }); return { lock : lock, hide : false } }, _dependency_hide : function(elements, value) { return { lock : false, hide : true } }, _dependency_default : function(elements, value, ev) { var lock = false; elements.each(function(){ if (this.getAttribute('type').toLowerCase()=='radio' && !Y.Node.getDOMNode(this).checked) { return; } else if (this.getAttribute('type').toLowerCase() == 'checkbox' && !Y.Node.getDOMNode(this).checked) { return; } lock = lock || this.get('value') != value; }); return { lock : lock, hide : false } } }; Y.extend(dependencyManager, Y.Base, dependencyManager.prototype, { NAME : '<API key>' }); return dependencyManager; })(); return new M.form.dependencyManager(); };
#ifndef <API key> #define <API key> /* X r d C m s B l a c k L i s t . h h */ /* Produced by Andrew Hanushevsky for Stanford University under contract */ /* DE-AC02-76-SFO0515 with the Department of Energy */ /* This file is part of the XRootD software suite. */ /* XRootD is free software: you can redistribute it and/or modify it under */ /* option) any later version. */ /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ /* be used to endorse or promote products derived from this software without */ #include "Xrd/XrdJob.hh" class XrdCmsCluster; class XrdOucTList; class XrdScheduler; class BL_Grip; class XrdCmsBlackList : public XrdJob { public: //! Time driven method for checking black list file. void DoIt(); //! Initialize the black list //! @param sP Pointer to the scheduler object. //! @param cP Pointer to the cluster object. //! @param blfn The path to the black list file or null. //! @param chkt Seconds between checks for blacklist changes. If the value //! is negative, the blacklist is treated as a whitelist. static void Init(XrdScheduler *sP, XrdCmsCluster *cP, const char *blfn, int chkt=600); //! Check if host is in the black list and how it should be managed. //! @param hName Pointer to the host name or address. //! @param bList Optional pointer to a private black list. //! @param rbuff Pointer to the buffer to contain the redirect response. If //! nil, the host is not redirected. //! @param rblen The size of rbuff. If zero or insufficiently large the host //! is not redirected. //! @return < -1 Host is in the black list and would be redirected; //! but either rbuff was nil or the buffer was too small. The //! abs(returned value) is the size the buffer should have been. //! @return = -1 Host is in the black list and should not be redirected. //! @return = 0 Host not in the black list. //! @return > 0 Host is in the black list and should be redirected. //! The return value is the size of the redirect response placed //! in the supplied buffer. static int Present(const char *hName, XrdOucTList *bList=0, char *rbuff=0, int rblen=0); //! Constructor and Destructor XrdCmsBlackList() : XrdJob("Black List Check") {} ~XrdCmsBlackList() {} private: static bool AddBL(BL_Grip &bAnchor, char *hSpec, BL_Grip *rAnchor, char *rSpec); static int AddRD(BL_Grip *rAnchor, char *rSpec, char *hSpec); static bool AddRD(XrdOucTList **rList, char *rSpec, char *hSpec); static XrdOucTList *Flatten(XrdOucTList *tList, int tPort); static bool GetBL(XrdOucTList *&bList, XrdOucTList **&rList, int &rcnt); }; #endif
export default 'ALERT_SETTINGS';
<?php namespace Bitpay; /** * Invoice * * @package Bitpay */ interface InvoiceInterface { /** * An invoice starts in this state.  When in this state and only in this state, payments * to the associated bitcoin address are credited to the invoice.  If an invoice has * received a partial payment, it will still reflect a status of new to the merchant * (from a merchant system perspective, an invoice is either paid or not paid, partial * payments and over payments are handled by bitpay.com by either refunding the * customer or applying the funds to a new invoice. */ const STATUS_NEW = 'new'; /** * As soon as full payment (or over payment) is received, an invoice goes into the * paid status. */ const STATUS_PAID = 'paid'; /** * The transaction speed preference of an invoice determines when an invoice is * confirmed.  For the high speed setting, it will be confirmed as soon as full * payment is received on the bitcoin network (note, the invoice will go from a status * of new to confirmed, bypassing the paid status).  For the medium speed setting, * the invoice is confirmed after the payment transaction(s) have been confirmed by * 1 block on the bitcoin network.  For the low speed setting, 6 blocks on the bitcoin * network are required.  Invoices are considered complete after 6 blocks on the * bitcoin network, therefore an invoice will go from a paid status directly to a * complete status if the transaction speed is set to low. */ const STATUS_CONFIRMED = 'confirmed'; const STATUS_COMPLETE = 'complete'; /** * An expired invoice is one where payment was not received and the 15 minute * payment window has elapsed. */ const STATUS_EXPIRED = 'expired'; /** * An invoice is considered invalid when it was paid, but payment was not confirmed * within 1 hour after receipt.  It is possible that some transactions on the bitcoin * network can take longer than 1 hour to be included in a block.  In such * circumstances, once payment is confirmed, BitPay.com will make arrangements * with the merchant regarding the funds (which can either be credited to the * merchant account on another invoice, or returned to the buyer). */ const STATUS_INVALID = 'invalid'; /** * Code comment for each transaction speed */ const <API key> = 'high'; const <API key> = 'medium'; const <API key> = 'low'; /** * This is the amount that is required to be collected from the buyer. Note, if this is * specified in a currency other than BTC, the price will be converted into BTC at * market exchange rates to determine the amount collected from the buyer. * * @return string */ public function getPrice(); public function getCurrency(); /** * @return ItemInterface */ public function getItem(); /** * @return BuyerInterface */ public function getBuyer(); public function getTransactionSpeed(); /** * Bitpay.com will send an email to this email address when the invoice status * changes. * * @return string */ public function <API key>(); /** * A URL to send status update messages to your server (this must be an https * URL, unencrypted http URLs or any other type of URL is not supported). * Bitpay.com will send a POST request with a JSON encoding of the invoice to * this URL when the invoice status changes. * * @return string */ public function getNotificationUrl(); /** * This is the URL for a return link that is displayed on the receipt, to return the * shopper back to your website after a successful purchase. This could be a page * specific to the order, or to their account. * * @return string */ public function getRedirectUrl(); /** * A passthru variable provided by the merchant and designed to be used by the * merchant to correlate the invoice with an order or other object in their system. * Maximum string length is 100 characters. * * @return array|object */ public function getPosData(); /** * The current invoice status. The possible states are described earlier in this * document. * * @return string */ public function getStatus(); public function isFullNotifications(); /** * default value: false * true: Notifications will also be sent for expired invoices and refunds. * false: Notifications will not be sent for expired invoices and refunds * * @return boolean */ public function <API key>(); /** * The unique id of the invoice assigned by bitpay.com * * @return string */ public function getId(); /** * An https URL where the invoice can be viewed. * * @return string */ public function getUrl(); /** * The amount of bitcoins being requested for payment of this invoice (same as the * price if the merchant set the price in BTC). * * @return string */ public function getBtcPrice(); public function getInvoiceTime(); public function getExpirationTime(); public function getCurrentTime(); /** * Used to display your public order number to the buyer on the BitPay invoice. In * the merchant Account Summary page, this value is used to identify the ledger * entry. Maximum string length is 100 characters. * * @return string */ public function getOrderId(); /** * Used to display an item description to the buyer. Maximum string length is 100 * characters. * * @deprecated * @return string */ public function getItemDesc(); /** * Used to display an item SKU code or part number to the buyer. Maximum string * length is 100 characters. * * @deprecated * @return string */ public function getItemCode(); /** * default value: false * true: Indicates a physical item will be shipped (or picked up) * false: Indicates that nothing is to be shipped for this order * * @deprecated * @return boolean */ public function isPhysical(); /** * These fields are used for display purposes only and will be shown on the invoice * if provided. Maximum string length of each field is 100 characters. * * @deprecated * @return string */ public function getBuyerName(); /** * These fields are used for display purposes only and will be shown on the invoice * if provided. Maximum string length of each field is 100 characters. * * @deprecated * @return string */ public function getBuyerAddress1(); /** * These fields are used for display purposes only and will be shown on the invoice * if provided. Maximum string length of each field is 100 characters. * * @deprecated * @return string */ public function getBuyerAddress2(); /** * These fields are used for display purposes only and will be shown on the invoice * if provided. Maximum string length of each field is 100 characters. * * @deprecated * @return string */ public function getBuyerCity(); /** * These fields are used for display purposes only and will be shown on the invoice * if provided. Maximum string length of each field is 100 characters. * * @deprecated * @return string */ public function getBuyerState(); /** * These fields are used for display purposes only and will be shown on the invoice * if provided. Maximum string length of each field is 100 characters. * * @deprecated * @return string */ public function getBuyerZip(); /** * These fields are used for display purposes only and will be shown on the invoice * if provided. Maximum string length of each field is 100 characters. * * @deprecated * @return string */ public function getBuyerCountry(); /** * These fields are used for display purposes only and will be shown on the invoice * if provided. Maximum string length of each field is 100 characters. * * @deprecated * @return string */ public function getBuyerEmail(); /** * These fields are used for display purposes only and will be shown on the invoice * if provided. Maximum string length of each field is 100 characters. * * @deprecated * @return string */ public function getBuyerPhone(); public function getExceptionStatus(); public function getBtcPaid(); public function getRate(); public function getToken(); /** * An array containing all bitcoin addresses linked to the invoice. * Only filled when doing a getInvoice using the Merchant facade. * The array contains * [refundAddress] => Array * [type] => string (e.g. "PaymentProtocol") * [date] => datetime string * * @return array|object */ public function getRefundAddresses(); }