code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
var fs = require('fs'); var os = require('os'); var blessed = require('blessed'); var multiline = require('multiline'); if (os.platform() === 'win32') { console.log('*************************************************************'); console.log('Hackthon Starter Generator has been disabled on Windows until'); console.log('https://github.com/chjj/blessed is fixed or until I find a'); console.log('better CLI module.'); console.log('*************************************************************'); process.exit(); } var screen = blessed.screen({ autoPadding: true }); screen.key('q', function() { process.exit(0); }); var home = blessed.list({ parent: screen, padding: { top: 2 }, mouse: true, keys: true, fg: 'white', bg: 'blue', selectedFg: 'blue', selectedBg: 'white', items: [ '» REMOVE AUTHENTICATION PROVIDER', '» CHANGE EMAIL SERVICE', '» ADD NODE.JS CLUSTER SUPPORT', '» EXIT' ] }); var homeTitle = blessed.text({ parent: screen, align: 'center', fg: 'blue', bg: 'white', content: 'Hackathon Starter (c) 2014' }); var footer = blessed.text({ parent: screen, bottom: 0, fg: 'white', bg: 'blue', tags: true, content: ' {cyan-fg}<Up/Down>{/cyan-fg} moves | {cyan-fg}<Enter>{/cyan-fg} selects | {cyan-fg}<q>{/cyan-fg} exits' }); var inner = blessed.form({ top: 'center', left: 'center', mouse: true, keys: true, width: 33, height: 10, border: { type: 'line', fg: 'white', bg: 'red' }, fg: 'white', bg: 'red' }); var success = blessed.box({ top: 'center', left: 'center', mouse: true, keys: true, tags: true, width: '50%', height: '40%', border: { type: 'line', fg: 'white', bg: 'green' }, fg: 'white', bg: 'green', padding: 1 }); success.on('keypress', function() { home.focus(); home.remove(success); }); var clusterText = blessed.text({ top: 'top', bg: 'red', fg: 'white', tags: true, content: 'Take advantage of multi-core systems using built-in {underline}cluster{/underline} module.' }); var enable = blessed.button({ parent: inner, bottom: 0, mouse: true, shrink: true, name: 'enable', content: ' ENABLE ', border: { type: 'line', fg: 'white', bg: 'red' }, style: { fg: 'white', bg: 'red', focus: { fg: 'red', bg: 'white' } } }); var disable = blessed.button({ parent: inner, bottom: 0, left: 10, mouse: true, shrink: true, name: 'disable', content: ' DISABLE ', border: { type: 'line', fg: 'white', bg: 'red' }, style: { fg: 'white', bg: 'red', focus: { fg: 'red', bg: 'white' } } }); var cancel = blessed.button({ parent: inner, bottom: 0, left: 21, mouse: true, shrink: true, name: 'cancel', content: ' CANCEL ', border: { type: 'line', fg: 'white', bg: 'red' }, style: { fg: 'white', bg: 'red', focus: { fg: 'red', bg: 'white' } } }); cancel.on('press', function() { home.focus(); home.remove(inner); screen.render(); }); var authForm = blessed.form({ mouse: true, keys: true, fg: 'white', bg: 'blue', padding: { left: 1, right: 1 } }); authForm.on('submit', function() { var passportConfig = fs.readFileSync('config/passport.js').toString().split(os.EOL); var loginTemplate = fs.readFileSync('views/account/login.jade').toString().split(os.EOL); var profileTemplate = fs.readFileSync('views/account/profile.jade').toString().split(os.EOL); var userModel = fs.readFileSync('models/User.js').toString().split(os.EOL); var app = fs.readFileSync('app.js').toString().split(os.EOL); var secrets = fs.readFileSync('config/secrets.js').toString().split(os.EOL); var index = passportConfig.indexOf("var FacebookStrategy = require('passport-facebook').Strategy;"); if (facebookCheckbox.checked && index !== -1) { passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with Facebook.'); passportConfig.splice(index, 47); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-facebook.btn-social(href='/auth/facebook')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(" if user.facebook"); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = userModel.indexOf(' facebook: String,'); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); index = app.indexOf("app.get('/auth/facebook', passport.authenticate('facebook', { scope: ['email', 'user_location'] }));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); } index = passportConfig.indexOf("var GitHubStrategy = require('passport-github').Strategy;"); if (githubCheckbox.checked && index !== -1) { console.log(index); passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with GitHub.'); passportConfig.splice(index, 48); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-github.btn-social(href='/auth/github')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(' if user.github'); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = userModel.indexOf(' github: String,'); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); index = app.indexOf("app.get('/auth/github', passport.authenticate('github'));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); } index = passportConfig.indexOf("var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;"); if (googleCheckbox.checked && index !== -1) { passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with Google.'); passportConfig.splice(index, 46); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-google-plus.btn-social(href='/auth/google')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(' if user.google'); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = userModel.indexOf(' google: String,'); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); index = app.indexOf("app.get('/auth/google', passport.authenticate('google', { scope: 'profile email' }));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); } index = passportConfig.indexOf("var TwitterStrategy = require('passport-twitter').Strategy;"); if (twitterCheckbox.checked && index !== -1) { passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with Twitter.'); passportConfig.splice(index, 43); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-twitter.btn-social(href='/auth/twitter')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(' if user.twitter'); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = userModel.indexOf(' twitter: String,'); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); index = app.indexOf("app.get('/auth/twitter', passport.authenticate('twitter'));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); } index = passportConfig.indexOf("var LinkedInStrategy = require('passport-linkedin-oauth2').Strategy;"); if (linkedinCheckbox.checked && index !== -1) { passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with LinkedIn.'); passportConfig.splice(index, 47); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-linkedin.btn-social(href='/auth/linkedin')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(' if user.linkedin'); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = userModel.indexOf(' linkedin: String,'); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); index = app.indexOf("app.get('/auth/linkedin', passport.authenticate('linkedin', { state: 'SOME STATE' }));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); } index = passportConfig.indexOf("var InstagramStrategy = require('passport-instagram').Strategy;"); if (instagramCheckbox.checked && index !== -1) { passportConfig.splice(index, 1); index = passportConfig.indexOf('// Sign in with Instagram.'); passportConfig.splice(index, 43); fs.writeFileSync('config/passport.js', passportConfig.join(os.EOL)); index = loginTemplate.indexOf(" a.btn.btn-block.btn-instagram.btn-social(href='/auth/instagram')"); loginTemplate.splice(index, 3); fs.writeFileSync('views/account/login.jade', loginTemplate.join(os.EOL)); index = profileTemplate.indexOf(' if user.instagram'); profileTemplate.splice(index - 1, 5); fs.writeFileSync('views/account/profile.jade', profileTemplate.join(os.EOL)); index = app.indexOf("app.get('/auth/instagram', passport.authenticate('instagram'));"); app.splice(index, 4); fs.writeFileSync('app.js', app.join(os.EOL)); userModel.splice(index, 1); fs.writeFileSync('models/User.js', userModel.join(os.EOL)); } home.remove(authForm); home.append(success); success.setContent('Selected authentication providers have been removed from passportConfig.js, User.js, app.js, login.jade and profile.jade!'); success.focus(); screen.render(); }); var authText = blessed.text({ parent: authForm, content: 'Selecting a checkbox removes an authentication provider. If authentication provider is already removed, no action will be taken.', padding: 1, bg: 'magenta', fg: 'white' }); var facebookCheckbox = blessed.checkbox({ parent: authForm, top: 6, mouse: true, fg: 'white', bg: 'blue', content: 'Facebook' }); var githubCheckbox = blessed.checkbox({ parent: authForm, top: 7, mouse: true, fg: 'white', bg: 'blue', content: 'GitHub' }); var googleCheckbox = blessed.checkbox({ parent: authForm, top: 8, mouse: true, fg: 'white', bg: 'blue', content: 'Google' }); var twitterCheckbox = blessed.checkbox({ parent: authForm, top: 9, mouse: true, fg: 'white', bg: 'blue', content: 'Twitter' }); var linkedinCheckbox = blessed.checkbox({ parent: authForm, top: 10, mouse: true, fg: 'white', bg: 'blue', content: 'LinkedIn' }); var instagramCheckbox = blessed.checkbox({ parent: authForm, top: 11, mouse: true, fg: 'white', bg: 'blue', content: 'Instagram' }); var authSubmit = blessed.button({ parent: authForm, top: 13, mouse: true, shrink: true, name: 'submit', content: ' SUBMIT ', style: { fg: 'blue', bg: 'white', focus: { fg: 'white', bg: 'red' } } }); authSubmit.on('press', function() { authForm.submit(); }); var authCancel = blessed.button({ parent: authForm, top: 13, left: 9, mouse: true, shrink: true, name: 'cancel', content: ' CANCEL ', style: { fg: 'blue', bg: 'white', focus: { fg: 'white', bg: 'red' } } }); authCancel.on('press', function() { home.focus(); home.remove(authForm); screen.render(); }); var emailForm = blessed.form({ mouse: true, keys: true, fg: 'white', bg: 'blue', padding: { left: 1, right: 1 } }); emailForm.on('submit', function() { var contactCtrl = fs.readFileSync('controllers/contact.js').toString().split(os.EOL); var userCtrl = fs.readFileSync('controllers/user.js').toString().split(os.EOL); var choice = null; if (sendgridRadio.checked) { choice = 'SendGrid'; } else if (mailgunRadio.checked) { choice = 'Mailgun'; } else if (mandrillRadio.checked) { choice = 'Mandrill'; } var index = contactCtrl.indexOf('var transporter = nodemailer.createTransport({'); contactCtrl.splice(index + 1, 1, " service: '" + choice + "',"); contactCtrl.splice(index + 3, 1, ' user: secrets.' + choice.toLowerCase() +'.user,'); contactCtrl.splice(index + 4, 1, ' pass: secrets.' + choice.toLowerCase() + '.password'); fs.writeFileSync('controllers/contact.js', contactCtrl.join(os.EOL)); index = userCtrl.indexOf(' var transporter = nodemailer.createTransport({'); userCtrl.splice(index + 1, 1, " service: '" + choice + "',"); userCtrl.splice(index + 3, 1, ' user: secrets.' + choice.toLowerCase() + '.user,'); userCtrl.splice(index + 4, 1, ' pass: secrets.' + choice.toLowerCase() + '.password'); index = userCtrl.indexOf(' var transporter = nodemailer.createTransport({', (index + 1)); userCtrl.splice(index + 1, 1, " service: '" + choice + "',"); userCtrl.splice(index + 3, 1, ' user: secrets.' + choice.toLowerCase() + '.user,'); userCtrl.splice(index + 4, 1, ' pass: secrets.' + choice.toLowerCase() + '.password'); fs.writeFileSync('controllers/user.js', userCtrl.join(os.EOL)); home.remove(emailForm); home.append(success); success.setContent('Email Service has been switched to ' + choice); success.focus(); screen.render(); }); var emailText = blessed.text({ parent: emailForm, content: 'Select one of the following email service providers for {underline}contact form{/underline} and {underline}password reset{/underline}.', padding: 1, bg: 'red', fg: 'white', tags: true }); var sendgridRadio = blessed.radiobutton({ parent: emailForm, top: 5, checked: true, mouse: true, fg: 'white', bg: 'blue', content: 'SendGrid' }); var mailgunRadio = blessed.radiobutton({ parent: emailForm, top: 6, mouse: true, fg: 'white', bg: 'blue', content: 'Mailgun' }); var mandrillRadio = blessed.radiobutton({ parent: emailForm, top: 7, mouse: true, fg: 'white', bg: 'blue', content: 'Mandrill' }); var emailSubmit = blessed.button({ parent: emailForm, top: 9, mouse: true, shrink: true, name: 'submit', content: ' SUBMIT ', style: { fg: 'blue', bg: 'white', focus: { fg: 'white', bg: 'red' } } }); emailSubmit.on('press', function() { emailForm.submit(); }); var emailCancel = blessed.button({ parent: emailForm, top: 9, left: 9, mouse: true, shrink: true, name: 'cancel', content: ' CANCEL ', style: { fg: 'blue', bg: 'white', focus: { fg: 'white', bg: 'red' } } }); emailCancel.on('press', function() { home.focus(); home.remove(emailForm); screen.render(); }); home.on('select', function(child, index) { switch (index) { case 0: home.append(authForm); authForm.focus(); screen.render(); break; case 1: home.append(emailForm); emailForm.focus(); break; case 2: addClusterSupport(); home.append(success); success.setContent('New file {underline}cluster_app.js{/underline} has been created. Your app is now able to use more than 1 CPU by running {underline}node cluster_app.js{/underline}, which in turn spawns multiple instances of {underline}app.js{/underline}'); success.focus(); screen.render(); break; default: process.exit(0); } }); screen.render(); function addClusterSupport() { var fileContents = multiline(function() { /* var os = require('os'); var cluster = require('cluster'); cluster.setupMaster({ exec: 'app.js' }); cluster.on('exit', function(worker) { console.log('worker ' + worker.id + ' died'); cluster.fork(); }); for (var i = 0; i < os.cpus().length; i++) { cluster.fork(); } */ }); fs.writeFileSync('cluster_app.js', fileContents); }
Jarvl/ENG2089-Project
setup.js
JavaScript
mit
16,738
import Vue from 'vue'; import store from '~/ide/stores'; import List from '~/ide/components/merge_requests/list.vue'; import { createComponentWithStore } from '../../../helpers/vue_mount_component_helper'; import { mergeRequests } from '../../mock_data'; import { resetStore } from '../../helpers'; describe('IDE merge requests list', () => { const Component = Vue.extend(List); let vm; beforeEach(() => { vm = createComponentWithStore(Component, store, {}); spyOn(vm, 'fetchMergeRequests'); vm.$mount(); }); afterEach(() => { vm.$destroy(); resetStore(vm.$store); }); it('calls fetch on mounted', () => { expect(vm.fetchMergeRequests).toHaveBeenCalledWith({ search: '', type: '', }); }); it('renders loading icon', done => { vm.$store.state.mergeRequests.isLoading = true; vm.$nextTick(() => { expect(vm.$el.querySelector('.loading-container')).not.toBe(null); done(); }); }); it('renders no search results text when search is not empty', done => { vm.search = 'testing'; vm.$nextTick(() => { expect(vm.$el.textContent).toContain('No merge requests found'); done(); }); }); it('clicking on search type, sets currentSearchType and loads merge requests', done => { vm.onSearchFocus(); vm.$nextTick() .then(() => { vm.$el.querySelector('li button').click(); return vm.$nextTick(); }) .then(() => { expect(vm.currentSearchType).toEqual(vm.$options.searchTypes[0]); expect(vm.fetchMergeRequests).toHaveBeenCalledWith({ type: vm.currentSearchType.type, search: '', }); }) .then(done) .catch(done.fail); }); describe('with merge requests', () => { beforeEach(done => { vm.$store.state.mergeRequests.mergeRequests.push({ ...mergeRequests[0], projectPathWithNamespace: 'gitlab-org/gitlab-ce', }); vm.$nextTick(done); }); it('renders list', () => { expect(vm.$el.querySelectorAll('li').length).toBe(1); expect(vm.$el.querySelector('li').textContent).toContain(mergeRequests[0].title); }); }); describe('searchMergeRequests', () => { beforeEach(() => { spyOn(vm, 'loadMergeRequests'); jasmine.clock().install(); }); afterEach(() => { jasmine.clock().uninstall(); }); it('calls loadMergeRequests on input in search field', () => { const event = new Event('input'); vm.$el.querySelector('input').dispatchEvent(event); jasmine.clock().tick(300); expect(vm.loadMergeRequests).toHaveBeenCalled(); }); }); describe('onSearchFocus', () => { it('shows search types', done => { vm.$el.querySelector('input').dispatchEvent(new Event('focus')); expect(vm.hasSearchFocus).toBe(true); expect(vm.showSearchTypes).toBe(true); vm.$nextTick() .then(() => { const expectedSearchTypes = vm.$options.searchTypes.map(x => x.label); const renderedSearchTypes = Array.from(vm.$el.querySelectorAll('li')).map(x => x.textContent.trim(), ); expect(renderedSearchTypes).toEqual(expectedSearchTypes); }) .then(done) .catch(done.fail); }); it('does not show search types, if already has search value', () => { vm.search = 'lorem ipsum'; vm.$el.querySelector('input').dispatchEvent(new Event('focus')); expect(vm.hasSearchFocus).toBe(true); expect(vm.showSearchTypes).toBe(false); }); it('does not show search types, if already has a search type', () => { vm.currentSearchType = {}; vm.$el.querySelector('input').dispatchEvent(new Event('focus')); expect(vm.hasSearchFocus).toBe(true); expect(vm.showSearchTypes).toBe(false); }); it('resets hasSearchFocus when search changes', done => { vm.hasSearchFocus = true; vm.search = 'something else'; vm.$nextTick() .then(() => { expect(vm.hasSearchFocus).toBe(false); }) .then(done) .catch(done.fail); }); }); });
iiet/iiet-git
spec/javascripts/ide/components/merge_requests/list_spec.js
JavaScript
mit
4,162
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2012 Torus Knot Software Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------------- */ #ifndef __ShaderProgramWriterCG_H__ #define __ShaderProgramWriterCG_H__ #include "OgreShaderProgramWriterManager.h" namespace Ogre { namespace RTShader { /** \addtogroup Core * @{ */ /** \addtogroup RTShader * @{ */ /** CG target language writer implementation. @see ProgramWriter. */ class _OgreRTSSExport CGProgramWriter : public ProgramWriter { // Interface. public: /** Class constructor. @param language The target shader language. */ CGProgramWriter (); /** Class destructor */ virtual ~CGProgramWriter (); /** @see ProgramWriter::writeSourceCode. */ virtual void writeSourceCode (std::ostream& os, Program* program); /** @see ProgramWriter::getTargetLanguage. */ virtual const String& getTargetLanguage () const { return TargetLanguage; } static String TargetLanguage; // Protected methods. protected: /** Initialize string maps. */ void initializeStringMaps (); /** Write the program dependencies. */ void writeProgramDependencies (std::ostream& os, Program* program); /** Write a uniform parameter. */ void writeUniformParameter (std::ostream& os, UniformParameterPtr parameter); /** Write a function parameter. */ void writeFunctionParameter (std::ostream& os, ParameterPtr parameter); /** Write a local parameter. */ void writeLocalParameter (std::ostream& os, ParameterPtr parameter); /** Write a function declaration. */ void writeFunctionDeclaration (std::ostream& os, Function* function, ParameterPtr & colorParameter); /** Write function atom instance. */ void writeAtomInstance (std::ostream& os, FunctionAtom* atom); protected: typedef map<GpuConstantType, const char*>::type GpuConstTypeToStringMap; typedef map<Parameter::Semantic, const char*>::type ParamSemanticToStringMap; // Attributes. protected: GpuConstTypeToStringMap mGpuConstTypeMap; // Map between GPU constant type to string value. ParamSemanticToStringMap mParamSemanticMap; // Map between parameter semantic to string value. }; /** CG program writer factory implementation. @see ProgramWriterFactory */ class _OgreRTSSExport ShaderProgramWriterCGFactory : public ProgramWriterFactory { public: ShaderProgramWriterCGFactory() { mLanguage = "cg"; } virtual ~ShaderProgramWriterCGFactory() {} /** @see ProgramWriterFactory::getTargetLanguage */ virtual const String& getTargetLanguage(void) const { return mLanguage; } /** @see ProgramWriterFactory::create */ virtual ProgramWriter* create(void) { return OGRE_NEW CGProgramWriter(); } private: String mLanguage; }; /** @} */ /** @} */ } } #endif
airgames/vuforia-gamekit-integration
Gamekit/Ogre-1.8rc/Components/RTShaderSystem/include/OgreShaderCGProgramWriter.h
C
mit
3,957
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013-2016 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include "py/compile.h" #include "py/persistentcode.h" #include "py/runtime.h" #include "py/gc.h" #include "py/stackctrl.h" #include "genhdr/mpversion.h" #ifdef _WIN32 #include "ports/windows/fmode.h" #endif // Command line options, with their defaults STATIC uint emit_opt = MP_EMIT_OPT_NONE; mp_uint_t mp_verbose_flag = 0; // Heap size of GC heap (if enabled) // Make it larger on a 64 bit machine, because pointers are larger. long heap_size = 1024 * 1024 * (sizeof(mp_uint_t) / 4); STATIC void stderr_print_strn(void *env, const char *str, size_t len) { (void)env; ssize_t dummy = write(STDERR_FILENO, str, len); (void)dummy; } STATIC const mp_print_t mp_stderr_print = {NULL, stderr_print_strn}; STATIC int compile_and_save(const char *file, const char *output_file, const char *source_file) { nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { mp_lexer_t *lex = mp_lexer_new_from_file(file); qstr source_name; if (source_file == NULL) { source_name = lex->source_name; } else { source_name = qstr_from_str(source_file); } #if MICROPY_PY___FILE__ mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name)); #endif mp_parse_tree_t parse_tree = mp_parse(lex, MP_PARSE_FILE_INPUT); mp_raw_code_t *rc = mp_compile_to_raw_code(&parse_tree, source_name, false); vstr_t vstr; vstr_init(&vstr, 16); if (output_file == NULL) { vstr_add_str(&vstr, file); vstr_cut_tail_bytes(&vstr, 2); vstr_add_str(&vstr, "mpy"); } else { vstr_add_str(&vstr, output_file); } mp_raw_code_save_file(rc, vstr_null_terminated_str(&vstr)); vstr_clear(&vstr); nlr_pop(); return 0; } else { // uncaught exception mp_obj_print_exception(&mp_stderr_print, (mp_obj_t)nlr.ret_val); return 1; } } STATIC int usage(char **argv) { printf( "usage: %s [<opts>] [-X <implopt>] <input filename>\n" "Options:\n" "--version : show version information\n" "-o : output file for compiled bytecode (defaults to input with .mpy extension)\n" "-s : source filename to embed in the compiled bytecode (defaults to input file)\n" "-v : verbose (trace various operations); can be multiple\n" "-O[N] : apply bytecode optimizations of level N\n" "\n" "Target specific options:\n" "-msmall-int-bits=number : set the maximum bits used to encode a small-int\n" "-mno-unicode : don't support unicode in compiled strings\n" "-march=<arch> : set architecture for native emitter; x86, x64, armv6, armv7m, armv7em, armv7emsp, armv7emdp, xtensa, xtensawin\n" "\n" "Implementation specific options:\n", argv[0] ); int impl_opts_cnt = 0; printf( #if MICROPY_EMIT_NATIVE " emit={bytecode,native,viper} -- set the default code emitter\n" #else " emit=bytecode -- set the default code emitter\n" #endif ); impl_opts_cnt++; printf( " heapsize=<n> -- set the heap size for the GC (default %ld)\n" , heap_size); impl_opts_cnt++; if (impl_opts_cnt == 0) { printf(" (none)\n"); } return 1; } // Process options which set interpreter init options STATIC void pre_process_options(int argc, char **argv) { for (int a = 1; a < argc; a++) { if (argv[a][0] == '-') { if (strcmp(argv[a], "-X") == 0) { if (a + 1 >= argc) { exit(usage(argv)); } if (strcmp(argv[a + 1], "emit=bytecode") == 0) { emit_opt = MP_EMIT_OPT_BYTECODE; #if MICROPY_EMIT_NATIVE } else if (strcmp(argv[a + 1], "emit=native") == 0) { emit_opt = MP_EMIT_OPT_NATIVE_PYTHON; } else if (strcmp(argv[a + 1], "emit=viper") == 0) { emit_opt = MP_EMIT_OPT_VIPER; #endif } else if (strncmp(argv[a + 1], "heapsize=", sizeof("heapsize=") - 1) == 0) { char *end; heap_size = strtol(argv[a + 1] + sizeof("heapsize=") - 1, &end, 0); // Don't bring unneeded libc dependencies like tolower() // If there's 'w' immediately after number, adjust it for // target word size. Note that it should be *before* size // suffix like K or M, to avoid confusion with kilowords, // etc. the size is still in bytes, just can be adjusted // for word size (taking 32bit as baseline). bool word_adjust = false; if ((*end | 0x20) == 'w') { word_adjust = true; end++; } if ((*end | 0x20) == 'k') { heap_size *= 1024; } else if ((*end | 0x20) == 'm') { heap_size *= 1024 * 1024; } if (word_adjust) { heap_size = heap_size * MP_BYTES_PER_OBJ_WORD / 4; } } else { exit(usage(argv)); } a++; } } } } MP_NOINLINE int main_(int argc, char **argv) { mp_stack_set_limit(40000 * (sizeof(void *) / 4)); pre_process_options(argc, argv); char *heap = malloc(heap_size); gc_init(heap, heap + heap_size); mp_init(); #ifdef _WIN32 set_fmode_binary(); #endif #if MICROPY_EMIT_NATIVE // Set default emitter options MP_STATE_VM(default_emit_opt) = emit_opt; #else (void)emit_opt; #endif // set default compiler configuration mp_dynamic_compiler.small_int_bits = 31; mp_dynamic_compiler.py_builtins_str_unicode = 1; #if defined(__i386__) mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_X86; mp_dynamic_compiler.nlr_buf_num_regs = MICROPY_NLR_NUM_REGS_X86; #elif defined(__x86_64__) mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_X64; mp_dynamic_compiler.nlr_buf_num_regs = MAX(MICROPY_NLR_NUM_REGS_X64, MICROPY_NLR_NUM_REGS_X64_WIN); #elif defined(__arm__) && !defined(__thumb2__) mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_ARMV6; mp_dynamic_compiler.nlr_buf_num_regs = MICROPY_NLR_NUM_REGS_ARM_THUMB_FP; #else mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_NONE; mp_dynamic_compiler.nlr_buf_num_regs = 0; #endif const char *input_file = NULL; const char *output_file = NULL; const char *source_file = NULL; // parse main options for (int a = 1; a < argc; a++) { if (argv[a][0] == '-') { if (strcmp(argv[a], "-X") == 0) { a += 1; } else if (strcmp(argv[a], "--version") == 0) { printf("MicroPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; mpy-cross emitting mpy v" MP_STRINGIFY(MPY_VERSION) "\n"); return 0; } else if (strcmp(argv[a], "-v") == 0) { mp_verbose_flag++; } else if (strncmp(argv[a], "-O", 2) == 0) { if (unichar_isdigit(argv[a][2])) { MP_STATE_VM(mp_optimise_value) = argv[a][2] & 0xf; } else { MP_STATE_VM(mp_optimise_value) = 0; for (char *p = argv[a] + 1; *p && *p == 'O'; p++, MP_STATE_VM(mp_optimise_value)++) {; } } } else if (strcmp(argv[a], "-o") == 0) { if (a + 1 >= argc) { exit(usage(argv)); } a += 1; output_file = argv[a]; } else if (strcmp(argv[a], "-s") == 0) { if (a + 1 >= argc) { exit(usage(argv)); } a += 1; source_file = argv[a]; } else if (strncmp(argv[a], "-msmall-int-bits=", sizeof("-msmall-int-bits=") - 1) == 0) { char *end; mp_dynamic_compiler.small_int_bits = strtol(argv[a] + sizeof("-msmall-int-bits=") - 1, &end, 0); if (*end) { return usage(argv); } // TODO check that small_int_bits is within range of host's capabilities } else if (strcmp(argv[a], "-mno-unicode") == 0) { mp_dynamic_compiler.py_builtins_str_unicode = 0; } else if (strcmp(argv[a], "-municode") == 0) { mp_dynamic_compiler.py_builtins_str_unicode = 1; } else if (strncmp(argv[a], "-march=", sizeof("-march=") - 1) == 0) { const char *arch = argv[a] + sizeof("-march=") - 1; if (strcmp(arch, "x86") == 0) { mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_X86; mp_dynamic_compiler.nlr_buf_num_regs = MICROPY_NLR_NUM_REGS_X86; } else if (strcmp(arch, "x64") == 0) { mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_X64; mp_dynamic_compiler.nlr_buf_num_regs = MAX(MICROPY_NLR_NUM_REGS_X64, MICROPY_NLR_NUM_REGS_X64_WIN); } else if (strcmp(arch, "armv6") == 0) { mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_ARMV6; mp_dynamic_compiler.nlr_buf_num_regs = MICROPY_NLR_NUM_REGS_ARM_THUMB_FP; } else if (strcmp(arch, "armv7m") == 0) { mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_ARMV7M; mp_dynamic_compiler.nlr_buf_num_regs = MICROPY_NLR_NUM_REGS_ARM_THUMB_FP; } else if (strcmp(arch, "armv7em") == 0) { mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_ARMV7EM; mp_dynamic_compiler.nlr_buf_num_regs = MICROPY_NLR_NUM_REGS_ARM_THUMB_FP; } else if (strcmp(arch, "armv7emsp") == 0) { mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_ARMV7EMSP; mp_dynamic_compiler.nlr_buf_num_regs = MICROPY_NLR_NUM_REGS_ARM_THUMB_FP; } else if (strcmp(arch, "armv7emdp") == 0) { mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_ARMV7EMDP; mp_dynamic_compiler.nlr_buf_num_regs = MICROPY_NLR_NUM_REGS_ARM_THUMB_FP; } else if (strcmp(arch, "xtensa") == 0) { mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_XTENSA; mp_dynamic_compiler.nlr_buf_num_regs = MICROPY_NLR_NUM_REGS_XTENSA; } else if (strcmp(arch, "xtensawin") == 0) { mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_XTENSAWIN; mp_dynamic_compiler.nlr_buf_num_regs = MICROPY_NLR_NUM_REGS_XTENSAWIN; } else { return usage(argv); } } else { return usage(argv); } } else { if (input_file != NULL) { mp_printf(&mp_stderr_print, "multiple input files\n"); exit(1); } input_file = argv[a]; } } if (input_file == NULL) { mp_printf(&mp_stderr_print, "no input file\n"); exit(1); } int ret = compile_and_save(input_file, output_file, source_file); #if MICROPY_PY_MICROPYTHON_MEM_INFO if (mp_verbose_flag) { mp_micropython_mem_info(0, NULL); } #endif mp_deinit(); return ret & 0xff; } int main(int argc, char **argv) { mp_stack_ctrl_init(); return main_(argc, argv); } uint mp_import_stat(const char *path) { (void)path; return MP_IMPORT_STAT_NO_EXIST; } void nlr_jump_fail(void *val) { fprintf(stderr, "FATAL: uncaught NLR %p\n", val); exit(1); }
glennrub/micropython
mpy-cross/main.c
C
mit
13,336
/* eslint max-len: 0 */ import find from "lodash/find"; import findLast from "lodash/findLast"; import isInteger from "lodash/isInteger"; import repeat from "lodash/repeat"; import Buffer from "./buffer"; import * as n from "./node"; import Whitespace from "./whitespace"; import * as t from "babel-types"; const SCIENTIFIC_NOTATION = /e/i; const ZERO_DECIMAL_INTEGER = /\.0+$/; const NON_DECIMAL_LITERAL = /^0[box]/; export type Format = { shouldPrintComment: (comment: string) => boolean; retainLines: boolean; comments: boolean; auxiliaryCommentBefore: string; auxiliaryCommentAfter: string; compact: boolean | "auto"; minified: boolean; quotes: "single" | "double"; concise: boolean; indent: { adjustMultilineComment: boolean; style: string; base: number; } }; export default class Printer { constructor(format, map, tokens) { this.format = format || {}; this._buf = new Buffer(map); this._whitespace = tokens.length > 0 ? new Whitespace(tokens) : null; } format: Format; inForStatementInitCounter: number = 0; _buf: Buffer; _whitespace: Whitespace; _printStack: Array<Node> = []; _indent: number = 0; _insideAux: boolean = false; _printedCommentStarts: Object = {}; _parenPushNewlineState: ?Object = null; _printAuxAfterOnNextUserNode: boolean = false; _printedComments: WeakSet = new WeakSet(); _endsWithInteger = false; _endsWithWord = false; generate(ast) { this.print(ast); this._maybeAddAuxComment(); return this._buf.get(); } /** * Increment indent size. */ indent(): void { if (this.format.compact || this.format.concise) return; this._indent++; } /** * Decrement indent size. */ dedent(): void { if (this.format.compact || this.format.concise) return; this._indent--; } /** * Add a semicolon to the buffer. */ semicolon(force: boolean = false): void { this._maybeAddAuxComment(); this._append(";", !force /* queue */); } /** * Add a right brace to the buffer. */ rightBrace(): void { if (this.format.minified) { this._buf.removeLastSemicolon(); } this.token("}"); } /** * Add a space to the buffer unless it is compact. */ space(force: boolean = false): void { if (this.format.compact) return; if ((this._buf.hasContent() && !this.endsWith(" ") && !this.endsWith("\n")) || force) { this._space(); } } /** * Writes a token that can't be safely parsed without taking whitespace into account. */ word(str: string): void { if (this._endsWithWord) this._space(); this._maybeAddAuxComment(); this._append(str); this._endsWithWord = true; } /** * Writes a number token so that we can validate if it is an integer. */ number(str: string): void { this.word(str); // Integer tokens need special handling because they cannot have '.'s inserted // immediately after them. this._endsWithInteger = isInteger(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== "."; } /** * Writes a simple token. */ token(str: string): void { // space is mandatory to avoid outputting <!-- // http://javascript.spec.whatwg.org/#comment-syntax if ((str === "--" && this.endsWith("!")) || // Need spaces for operators of the same kind to avoid: `a+++b` (str[0] === "+" && this.endsWith("+")) || (str[0] === "-" && this.endsWith("-")) || // Needs spaces to avoid changing '34' to '34.', which would still be a valid number. (str[0] === "." && this._endsWithInteger)) { this._space(); } this._maybeAddAuxComment(); this._append(str); } /** * Add a newline (or many newlines), maintaining formatting. */ newline(i?: number): void { if (this.format.retainLines || this.format.compact) return; if (this.format.concise) { this.space(); return; } // never allow more than two lines if (this.endsWith("\n\n")) return; if (typeof i !== "number") i = 1; i = Math.min(2, i); if (this.endsWith("{\n") || this.endsWith(":\n")) i--; if (i <= 0) return; for (let j = 0; j < i; j++) { this._newline(); } } endsWith(str: string): boolean { return this._buf.endsWith(str); } removeTrailingNewline(): void { this._buf.removeTrailingNewline(); } source(prop: string, loc: Object): void { this._catchUp(prop, loc); this._buf.source(prop, loc); } withSource(prop: string, loc: Object, cb: () => void): void { this._catchUp(prop, loc); this._buf.withSource(prop, loc, cb); } _space(): void { this._append(" ", true /* queue */); } _newline(): void { this._append("\n", true /* queue */); } _append(str: string, queue: boolean = false) { this._maybeAddParen(str); this._maybeIndent(str); if (queue) this._buf.queue(str); else this._buf.append(str); this._endsWithWord = false; this._endsWithInteger = false; } _maybeIndent(str: string): void { // we've got a newline before us so prepend on the indentation if (this._indent && this.endsWith("\n") && str[0] !== "\n") { this._buf.queue(this._getIndent()); } } _maybeAddParen(str: string): void { // see startTerminatorless() instance method let parenPushNewlineState = this._parenPushNewlineState; if (!parenPushNewlineState) return; this._parenPushNewlineState = null; let i; for (i = 0; i < str.length && str[i] === " "; i++) continue; if (i === str.length) return; const cha = str[i]; if (cha === "\n" || cha === "/") { // we're going to break this terminator expression so we need to add a parentheses this.token("("); this.indent(); parenPushNewlineState.printed = true; } } _catchUp(prop: string, loc: Object) { if (!this.format.retainLines) return; // catch up to this nodes newline if we're behind const pos = loc ? loc[prop] : null; if (pos && pos.line !== null) { const count = pos.line - this._buf.getCurrentLine(); for (let i = 0; i < count; i++) { this._newline(); } } } /** * Get the current indent. */ _getIndent(): string { return repeat(this.format.indent.style, this._indent); } /** * Set some state that will be modified if a newline has been inserted before any * non-space characters. * * This is to prevent breaking semantics for terminatorless separator nodes. eg: * * return foo; * * returns `foo`. But if we do: * * return * foo; * * `undefined` will be returned and not `foo` due to the terminator. */ startTerminatorless(): Object { return this._parenPushNewlineState = { printed: false }; } /** * Print an ending parentheses if a starting one has been printed. */ endTerminatorless(state: Object) { if (state.printed) { this.dedent(); this.newline(); this.token(")"); } } print(node, parent) { if (!node) return; let oldConcise = this.format.concise; if (node._compact) { this.format.concise = true; } let printMethod = this[node.type]; if (!printMethod) { throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node && node.constructor.name)}`); } this._printStack.push(node); let oldInAux = this._insideAux; this._insideAux = !node.loc; this._maybeAddAuxComment(this._insideAux && !oldInAux); let needsParens = n.needsParens(node, parent, this._printStack); if (needsParens) this.token("("); this._printLeadingComments(node, parent); let loc = (t.isProgram(node) || t.isFile(node)) ? null : node.loc; this.withSource("start", loc, () => { this[node.type](node, parent); }); this._printTrailingComments(node, parent); if (needsParens) this.token(")"); // end this._printStack.pop(); this.format.concise = oldConcise; this._insideAux = oldInAux; } _maybeAddAuxComment(enteredPositionlessNode) { if (enteredPositionlessNode) this._printAuxBeforeComment(); if (!this._insideAux) this._printAuxAfterComment(); } _printAuxBeforeComment() { if (this._printAuxAfterOnNextUserNode) return; this._printAuxAfterOnNextUserNode = true; const comment = this.format.auxiliaryCommentBefore; if (comment) { this._printComment({ type: "CommentBlock", value: comment }); } } _printAuxAfterComment() { if (!this._printAuxAfterOnNextUserNode) return; this._printAuxAfterOnNextUserNode = false; const comment = this.format.auxiliaryCommentAfter; if (comment) { this._printComment({ type: "CommentBlock", value: comment }); } } getPossibleRaw(node) { if (this.format.minified) return; let extra = node.extra; if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) { return extra.raw; } } printJoin(nodes: ?Array, parent: Object, opts = {}) { if (!nodes || !nodes.length) return; if (opts.indent) this.indent(); const newlineOpts = { addNewlines: opts.addNewlines, }; for (let i = 0; i < nodes.length; i++) { const node = nodes[i]; if (!node) continue; if (opts.statement) this._printNewline(true, node, parent, newlineOpts); this.print(node, parent); if (opts.iterator) { opts.iterator(node, i); } if (opts.separator && i < nodes.length - 1) { opts.separator.call(this); } if (opts.statement) this._printNewline(false, node, parent, newlineOpts); } if (opts.indent) this.dedent(); } printAndIndentOnComments(node, parent) { let indent = !!node.leadingComments; if (indent) this.indent(); this.print(node, parent); if (indent) this.dedent(); } printBlock(parent) { let node = parent.body; if (!t.isEmptyStatement(node)) { this.space(); } this.print(node, parent); } _printTrailingComments(node, parent) { this._printComments(this._getComments(false, node, parent)); } _printLeadingComments(node, parent) { this._printComments(this._getComments(true, node, parent)); } printInnerComments(node, indent = true) { if (!node.innerComments) return; if (indent) this.indent(); this._printComments(node.innerComments); if (indent) this.dedent(); } printSequence(nodes, parent, opts = {}) { opts.statement = true; return this.printJoin(nodes, parent, opts); } printList(items, parent, opts = {}) { if (opts.separator == null) { opts.separator = commaSeparator; } return this.printJoin(items, parent, opts); } _printNewline(leading, node, parent, opts) { // Fast path since 'this.newline' does nothing when not tracking lines. if (this.format.retainLines || this.format.compact) return; // Fast path for concise since 'this.newline' just inserts a space when // concise formatting is in use. if (this.format.concise) { this.space(); return; } let lines = 0; if (node.start != null && !node._ignoreUserWhitespace && this._whitespace) { // user node if (leading) { const comments = node.leadingComments; const comment = comments && find(comments, (comment) => !!comment.loc && this.format.shouldPrintComment(comment.value)); lines = this._whitespace.getNewlinesBefore(comment || node); } else { const comments = node.trailingComments; const comment = comments && findLast(comments, (comment) => !!comment.loc && this.format.shouldPrintComment(comment.value)); lines = this._whitespace.getNewlinesAfter(comment || node); } } else { // generated node if (!leading) lines++; // always include at least a single line after if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0; let needs = n.needsWhitespaceAfter; if (leading) needs = n.needsWhitespaceBefore; if (needs(node, parent)) lines++; // generated nodes can't add starting file whitespace if (!this._buf.hasContent()) lines = 0; } this.newline(lines); } _getComments(leading, node) { // Note, we use a boolean flag here instead of passing in the attribute name as it is faster // because this is called extremely frequently. return (node && (leading ? node.leadingComments : node.trailingComments)) || []; } _printComment(comment) { if (!this.format.shouldPrintComment(comment.value)) return; // Some plugins use this to mark comments as removed using the AST-root 'comments' property, // where they can't manually mutate the AST node comment lists. if (comment.ignore) return; if (this._printedComments.has(comment)) return; this._printedComments.add(comment); if (comment.start != null) { if (this._printedCommentStarts[comment.start]) return; this._printedCommentStarts[comment.start] = true; } // whitespace before this.newline(this._whitespace ? this._whitespace.getNewlinesBefore(comment) : 0); if (!this.endsWith("[") && !this.endsWith("{")) this.space(); let val = comment.type === "CommentLine" ? `//${comment.value}\n` : `/*${comment.value}*/`; // if (comment.type === "CommentBlock" && this.format.indent.adjustMultilineComment) { let offset = comment.loc && comment.loc.start.column; if (offset) { let newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); val = val.replace(newlineRegex, "\n"); } let indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn()); val = val.replace(/\n(?!$)/g, `\n${repeat(" ", indentSize)}`); } this.withSource("start", comment.loc, () => { this._append(val); }); // whitespace after this.newline((this._whitespace ? this._whitespace.getNewlinesAfter(comment) : 0) + // Subtract one to account for the line force-added above. (comment.type === "CommentLine" ? -1 : 0)); } _printComments(comments?: Array<Object>) { if (!comments || !comments.length) return; for (let comment of comments) { this._printComment(comment); } } } function commaSeparator() { this.token(","); this.space(); } for (let generator of [ require("./generators/template-literals"), require("./generators/expressions"), require("./generators/statements"), require("./generators/classes"), require("./generators/methods"), require("./generators/modules"), require("./generators/types"), require("./generators/flow"), require("./generators/base"), require("./generators/jsx") ]) { Object.assign(Printer.prototype, generator); }
lxe/babel
packages/babel-generator/src/printer.js
JavaScript
mit
15,027
/** * @author alteredq / http://alteredqualia.com/ * @author mrdoob / http://mrdoob.com/ * @author WestLangley / http://github.com/WestLangley */ import { Vector3 } from '../math/Vector3.js'; import { Object3D } from '../core/Object3D.js'; import { LineSegments } from '../objects/LineSegments.js'; import { LineBasicMaterial } from '../materials/LineBasicMaterial.js'; import { Float32BufferAttribute } from '../core/BufferAttribute.js'; import { BufferGeometry } from '../core/BufferGeometry.js'; var _vector = new Vector3(); function SpotLightHelper( light, color ) { Object3D.call( this ); this.light = light; this.light.updateMatrixWorld(); this.matrix = light.matrixWorld; this.matrixAutoUpdate = false; this.color = color; var geometry = new BufferGeometry(); var positions = [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, - 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, - 1, 1 ]; for ( var i = 0, j = 1, l = 32; i < l; i ++, j ++ ) { var p1 = ( i / l ) * Math.PI * 2; var p2 = ( j / l ) * Math.PI * 2; positions.push( Math.cos( p1 ), Math.sin( p1 ), 1, Math.cos( p2 ), Math.sin( p2 ), 1 ); } geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); var material = new LineBasicMaterial( { fog: false, toneMapped: false } ); this.cone = new LineSegments( geometry, material ); this.add( this.cone ); this.update(); } SpotLightHelper.prototype = Object.create( Object3D.prototype ); SpotLightHelper.prototype.constructor = SpotLightHelper; SpotLightHelper.prototype.dispose = function () { this.cone.geometry.dispose(); this.cone.material.dispose(); }; SpotLightHelper.prototype.update = function () { this.light.updateMatrixWorld(); var coneLength = this.light.distance ? this.light.distance : 1000; var coneWidth = coneLength * Math.tan( this.light.angle ); this.cone.scale.set( coneWidth, coneWidth, coneLength ); _vector.setFromMatrixPosition( this.light.target.matrixWorld ); this.cone.lookAt( _vector ); if ( this.color !== undefined ) { this.cone.material.color.set( this.color ); } else { this.cone.material.color.copy( this.light.color ); } }; export { SpotLightHelper };
zhoushijie163/three.js
src/helpers/SpotLightHelper.js
JavaScript
mit
2,203
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System.Collections.Generic; using Odachi.AspNetCore.Authentication.Basic; namespace Microsoft.R.Host.Broker { public static class BasicSignInContextExtensions { static readonly HashSet<string> _skipSignInPaths = new HashSet<string>() { "/info/load", "/info/about" }; public static bool IsSignInRequired(this BasicSignInContext context) { string path = context.HttpContext.Request.Path.ToString(); if (_skipSignInPaths.Contains(path)) { return false; } return true; } } }
AlexanderSher/RTVS
src/Host/Broker/Impl/Extensions/BasicSignInContextExtensions.cs
C#
mit
732
<md-button class="md-button-toggle" ng-click="toggle()" aria-controls="docs-menu-{{section.name | nospace}}" aria-expanded="{{isOpen()}}"> <div flex layout="row"> {{section.name}} <span flex=""></span> <span aria-hidden="true" class="md-toggle-icon" ng-class="{'toggled' : isOpen()}"> <md-icon md-svg-src="toggle-arrow"></md-icon> </span> </div> <span class="visually-hidden"> Toggle {{isOpen()? 'expanded' : 'collapsed'}} </span> </md-button> <ul ng-show="isOpen()" id="docs-menu-{{section.name | nospace}}" class="menu-toggle-list"> <li ng-repeat="page in section.pages"> <menu-link section="page"></menu-link> </li> </ul>
angularjscl/material
docs/app/partials/menu-toggle.tmpl.html
HTML
mit
678
// Copyright (c) 2014 SIL International // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) using System; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Windows.Forms; using Gecko; using Gecko.Interop; using L10NSharp; using Microsoft.Win32; using SIL.IO; #if !__MonoCS__ #endif namespace Bloom.Publish.PDF { /// <summary> /// Wrapper class that wraps either a Gecko web browser that displays the PDF file through /// pdf.js, or the Adobe Reader control. Which one is used depends on the operating system /// (Linux always uses pdf.js) and the UseAdobePdfViewer setting in the config file. /// </summary> public partial class PdfViewer : UserControl, nsIWebProgressListener, nsISupportsWeakReference { private Control _pdfViewerControl; private Timer _pauseTimer; private FormWindowState _savedState; private const ulong STATE_STOP = 0x00000010; private bool _printing; public event EventHandler<PdfPrintProgressEventArgs> PrintProgress; #if __MonoCS__ public event EventHandler PrintFinished; #endif //private PdfPrintProgressListener _listener; private string _pdfPath; private bool _haveShownAdobeReaderRecommendation; public PdfViewer() { InitializeComponent(); #if !__MonoCS__ // In Windows we would prefer to use Acrobat to display and print PDFs. It avoids various bugs in // PDFjs, such as BL-1177 (Andika sometimes lost when printing directly from Bloom), // BL-1170 Printing stops after certain point // BL-1037 PDFjs sometimes fails to display if use certain jpg images // If Acrobat is not installed, it will fall back to PDFjs, and we hope for the best. // Todo: we need a better solution in Linux, also. Ghostscript might provide something but // has a GPL license. _pdfViewerControl = new AdobeReaderControl(); #else _pdfViewerControl = new GeckoWebBrowser(); #endif SetupViewerControl(); } private void SetupViewerControl() { if (_pdfViewerControl is GeckoWebBrowser) { // BL-752: The zoom drop down list does not display on Linux ((GeckoWebBrowser)_pdfViewerControl).DomClick += (sender, e) => ((GeckoWebBrowser)_pdfViewerControl).WebBrowserFocus.Activate(); } SuspendLayout(); _pdfViewerControl.BackColor = Color.White; _pdfViewerControl.Dock = DockStyle.Fill; _pdfViewerControl.Name = "_pdfViewerControl"; _pdfViewerControl.TabIndex = 0; AutoScaleDimensions = new SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; Controls.Add(_pdfViewerControl); Name = "PdfViewer"; ResumeLayout(false); } #if(!__MonoCS__) private void UpdatePdfViewer(Control viewerControl) { Controls.Remove(_pdfViewerControl); _pdfViewerControl.Dispose(); _pdfViewerControl = viewerControl; SetupViewerControl(); _pdfViewerControl.Size = this.Size; // not sure why dock doesn't do this } #endif public bool ShowPdf(string pdfFile) { _pdfPath = pdfFile; #if !__MonoCS__ var arc = _pdfViewerControl as AdobeReaderControl; if (arc != null) // We haven't yet had a problem displaying with Acrobat... { if (arc.ShowPdf(pdfFile)) return true; // success using acrobat // Acrobat not working (probably not installed). Switch to using Gecko to display PDF. UpdatePdfViewer(new GeckoWebBrowser()); // and continue to show it using that. } #endif // Escaping the filename twice for characters like # is needed in order to get the // pdf filename through Geckofx/xulrunner to our local server on Linux. This is to // prevent the filename from being cut short at the # character. As far as I can // tell, Linux xulrunner strips one level of escaping on input, then before passing // the query on to the localhost server it truncates the query portion at the first // # it sees. The localhost processor expects one level of encoding, and we deal // with having a # in the query (file path) there without any problem. You may // regard this double escaping as a hack to get around the Linux xulrunner which // behaves differently than the Windows xulrunner. It is an exception to the rule // of matching EscapeFileNameForHttp() with UnescapeFileNameForHttp(). See a comment in // https://jira.sil.org/browse/BL-951 for a description of the buggy program // behavior without this hack. var file = pdfFile; if (SIL.PlatformUtilities.Platform.IsUnix) file = file.EscapeFileNameForHttp().EscapeFileNameForHttp(); var url = string.Format("{0}{1}?file=/bloom/{2}", Api.BloomServer.ServerUrlWithBloomPrefixEndingInSlash, FileLocationUtilities.GetFileDistributedWithApplication("pdf/web/viewer.html"), file); var browser = ((GeckoWebBrowser)_pdfViewerControl); browser.Navigate(url); browser.DocumentCompleted += (sender, args) => { // We want to suppress several of the buttons that the control normally shows. // It's nice if we don't have to modify the html and related files, because they are unzipped from a package we install // from a source I'm not sure we control, and installed into a directory we can't modify at runtime. // A workaround is to tweak the stylesheet to hide them. The actual buttons (and two menu items) are easily // hidden by ID. // Unfortunately we're getting rid of a complete group in the pull-down menu, which leaves an ugly pair of // adjacent separators. And the separators don't have IDs so we can't easily select just one to hide. // Fortunately there are no other divs in the parent (besides the separator) so we just hide the second one. // This is unfortunately rather fragile and may not do exactly what we want if the viewer.html file // defining the pdfjs viewer changes. GeckoStyleSheet stylesheet = browser.Document.StyleSheets.First(); stylesheet.CssRules.Add("#toolbarViewerRight, #viewOutline, #viewAttachments, #viewThumbnail, #viewFind {display: none}"); stylesheet.CssRules.Add("#previous, #next, #pageNumberLabel, #pageNumber, #numPages {display: none}"); stylesheet.CssRules.Add("#toolbarViewerLeft .splitToolbarButtonSeparator {display: none}"); #if !__MonoCS__ if (!_haveShownAdobeReaderRecommendation) { _haveShownAdobeReaderRecommendation = true; var message = LocalizationManager.GetString("PublishTab.Notifications.AdobeReaderRecommendation", "This PDF viewer can be improved by installing the free Adobe Reader on this computer."); RunJavaScript("toastr.remove();" + "toastr.options = { 'positionClass': 'toast-bottom-right','timeOut': '15000'};" + "toastr['info']('" + message + "')"); } #endif }; return true; } public string RunJavaScript(string script) { var browser = ((GeckoWebBrowser)_pdfViewerControl); Debug.Assert(!InvokeRequired); Debug.Assert(browser.Window != null); if (browser.Window != null) { using (var context = new AutoJSContext(browser.Window)) { string result; context.EvaluateScript(script, (nsISupports)browser.Document.DomObject, out result); return result; } } return null; } public void Print() { #if !__MonoCS__ var arc = _pdfViewerControl as AdobeReaderControl; if (arc != null) { // The print button is only enabled after we have generated a PDF and tried to display it, // so if we still have an ARC by this point, it displayed successfully, and presumably can also print. arc.Print(); return; } // PDFjs printing has proved unreliable, so GhostScript is preferable even on Windows. if (TryGhostcriptPrint()) return; var browser = ((GeckoWebBrowser)_pdfViewerControl); using (AutoJSContext context = new AutoJSContext(browser.Window)) { string result; context.EvaluateScript(@"window.print()", (nsISupports)browser.Document.DomObject, out result); } #else // on Linux the isntaller will have a dependency on GhostScript so it should always be available. // We've had many problems with PDFJs so hopefully this solves them. if (TryGhostcriptPrint()) return; // BL-788 Print dialog appears behind Bloom on Linux // Finally went to minimizing Bloom to allow the print window to be // displayed and then restore to the original size after the // Print or Cancel button is pushed on the print dialog. _pauseTimer = new Timer(); _pauseTimer.Interval = 250; _pauseTimer.Tick += PrintAfterPause; _savedState = this.ParentForm.WindowState; this.ParentForm.WindowState = FormWindowState.Minimized; _pauseTimer.Start(); #endif } private bool TryGhostcriptPrint() { string systemSpecificArgs = String.Empty; #if __MonoCS__ // Ghostscript is built into the CUPS printer service, which is the standard // setup in Ubuntu. It handles PDF automatically. gtklp is a graphical // front end to the printer service that allows the user to specify the // printer, paper size, and other parameters that may need to be tweaked. var exePath = "/usr/bin/gtklp"; systemSpecificArgs = ""; #else var gsKey = Registry.LocalMachine.OpenSubKey(@"Software\GPL Ghostscript"); if (gsKey == null) gsKey = Registry.LocalMachine.OpenSubKey(@"Software\AGPL Ghostscript"); // Just possibly the paid version is present? if (gsKey == null) { var hklm64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); // maybe the 64-bit version is installed? gsKey = hklm64.OpenSubKey(@"Software\GPL Ghostscript"); if (gsKey == null) gsKey = hklm64.OpenSubKey(@"Software\AGPL Ghostscript"); } if (gsKey == null) return false; // not able to print this way, GhostScript not present string exePath = null; foreach (var version in gsKey.GetSubKeyNames()) { var gsVersKey = gsKey.OpenSubKey(version); var dllPath = gsVersKey.GetValue("GS_DLL") as String; if (dllPath == null) continue; if (!RobustFile.Exists(dllPath)) continue; // some junk there?? exePath = Path.Combine(Path.GetDirectoryName(dllPath), "gswin32c.exe"); if (RobustFile.Exists(exePath)) break; exePath = Path.Combine(Path.GetDirectoryName(dllPath), "gswin64c.exe"); if (RobustFile.Exists(exePath)) break; // some old install in a bad state? Try another subkey } // -sDEVICE#mswinpr2 makes it display a print dialog so the user can choose printer. // -dBATCH -dNOPAUSE -dQUIET make it go ahead without waiting for user input on each page or after last // -dQUIET was an attempt to prevent it display per-page messages. Didn't work. Not sure it does any good. // -dNORANGEPAGESIZE makes it automatically select the right page orientation. systemSpecificArgs = "-sDEVICE#mswinpr2 -dBATCH -dNOPAUSE -dQUIET -dNORANGEPAGESIZE "; #endif if (exePath == null || !RobustFile.Exists(exePath)) return false; // Can't use ghostscript approach var proc = new Process { StartInfo = { FileName = exePath, Arguments = systemSpecificArgs + "\"" + _pdfPath + "\"", UseShellExecute = false, // enables CreateNoWindow CreateNoWindow = true // don't need a DOS box (does not suppress print dialog) } }; #if __MonoCS__ proc.EnableRaisingEvents = true; proc.Exited += PrintProcessExited; // gtklp may use a different GTK version than Bloom: clear the library path, which will cause // gtklp to do the right lookup. See https://issues.bloomlibrary.org/youtrack/issue/BL-9957. proc.StartInfo.Environment.Remove("LD_LIBRARY_PATH"); #endif proc.Start(); return true; // we at least think we printed it (unless the user cancels...anyway, don't try again some other way). } #if __MonoCS__ void PrintProcessExited(object sender, EventArgs e) { if (PrintFinished != null) PrintFinished(sender, e); } #endif private void PrintAfterPause(object sender, EventArgs e) { _pauseTimer.Stop (); BrowserPrint (); _pauseTimer = new Timer(); _pauseTimer.Interval = 250; _pauseTimer.Tick += RestoreAfterPrint; _pauseTimer.Start(); } private void RestoreAfterPrint(object sender, EventArgs e) { _pauseTimer.Stop (); this.ParentForm.WindowState = _savedState; } public void BrowserPrint() { var browser = ((GeckoWebBrowser)_pdfViewerControl); using (AutoJSContext context = new AutoJSContext (browser.Window)) { nsISupports domWindow = browser.Window.DomWindow; nsIWebBrowserPrint print = Xpcom.QueryInterface<nsIWebBrowserPrint> (domWindow); try { if (PrintProgress != null) { // Send event to disable print, simple, outside cover and inside buttons // while printing PrintProgress.Invoke (this, new PdfPrintProgressEventArgs(true)); } _printing = true; print.Print (null, this); } catch (COMException e) { if (PrintProgress != null) { PrintProgress.Invoke (this, new PdfPrintProgressEventArgs(false)); } //NS_ERROR_ABORT means user cancelled the printing, not really an error. if (e.ErrorCode != GeckoError.NS_ERROR_ABORT) throw; } finally { Marshal.ReleaseComObject (print); } } } #region nsISupportsWeakReference Members public nsIWeakReference GetWeakReference() { return new nsWeakReference( this ); } #endregion #region nsIWebProgressListener Members public void OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aStateFlags, int aStatus) { if (_printing && ((aStateFlags & STATE_STOP) != 0)) { _printing = false; if (PrintProgress != null) { PrintProgress.Invoke (this, new PdfPrintProgressEventArgs(false)); } } } public void OnProgressChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { } public void OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation, uint flags) { } public void OnStatusChange(nsIWebProgress aWebProgress, nsIRequest aRequest, int aStatus, string aMessage) { } public void OnSecurityChange(nsIWebProgress aWebProgress, nsIRequest aRequest, uint aState) { } #endregion } public class PdfPrintProgressEventArgs : EventArgs { public readonly bool PrintInProgress; public PdfPrintProgressEventArgs(bool printInProgress) { PrintInProgress = printInProgress; } } }
StephenMcConnel/BloomDesktop
src/BloomExe/Publish/PDF/PdfViewer.cs
C#
mit
14,476
/** * Copyright (c) 2004-2011 QOS.ch * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ package org.slf4j.helpers; import java.text.MessageFormat; import org.junit.Ignore; import org.junit.Test; @Ignore public class MessageFormatterPerfTest { // extends TestCase { Integer i1 = new Integer(1); Integer i2 = new Integer(2); static long RUN_LENGTH = 100 * 1000; // static long REFERENCE_BIPS = 48416; public void XtestJDKFormatterPerf() { jdkMessageFormatter(RUN_LENGTH); double duration = jdkMessageFormatter(RUN_LENGTH); System.out.println("jdk duration = " + duration + " nanos"); } @Test public void testSLF4JPerf_OneArg() { slf4jMessageFormatter_OneArg(RUN_LENGTH); double duration = slf4jMessageFormatter_OneArg(RUN_LENGTH); System.out.println("duration=" + duration); long referencePerf = 36; BogoPerf.assertDuration(duration, referencePerf, REFERENCE_BIPS); } @Test public void testSLF4JPerf_TwoArg() { slf4jMessageFormatter_TwoArg(RUN_LENGTH); double duration = slf4jMessageFormatter_TwoArg(RUN_LENGTH); long referencePerf = 60; BogoPerf.assertDuration(duration, referencePerf, REFERENCE_BIPS); } public double slf4jMessageFormatter_OneArg(long len) { long start = System.nanoTime(); for (int i = 0; i < len; i++) { final FormattingTuple tp = MessageFormatter.format("This is some rather short message {} ", i1); tp.getMessage(); tp.getArgArray(); tp.getThrowable(); MessageFormatter.format("This is some rather short message {} ", i1); } long end = System.nanoTime(); return (end - start) / (1000 * 1000.0); } public double slf4jMessageFormatter_TwoArg(long len) { long start = System.nanoTime(); for (int i = 0; i < len; i++) { final FormattingTuple tp = MessageFormatter.format("This is some {} short message {} ", i1, i2); tp.getMessage(); tp.getArgArray(); tp.getThrowable(); } long end = System.nanoTime(); return (end - start) / (1000 * 1000.0); } public double jdkMessageFormatter(long len) { @SuppressWarnings("unused") String s = ""; s += ""; // keep compiler happy long start = System.currentTimeMillis(); Object[] oa = new Object[] { i1 }; for (int i = 0; i < len; i++) { s = MessageFormat.format("This is some rather short message {0}", oa); } long end = System.currentTimeMillis(); return (1.0 * end - start); } }
FranckW/projet1_opl
server/lib/slf4j-1.7.21/slf4j-api/src/test/java/org/slf4j/helpers/MessageFormatterPerfTest.java
Java
mit
3,806
--- title: 王の約束 date: 23/07/2019 --- `問3: 詩編 101 編を読んでください。これは指導者たちに向けて書かれたものですが、私たちはどんな重要な勧告をそこから得ることができますか。` 詩編 101 編は指導者のための聖句です。これらの言葉は、ダビデがイスラエルの王として統治し始めた頃に書いたものだと考えられています。彼が王になったときに立てた誓いから改作されたものかもしれません。サウルのための戦士としての体験や、やがて彼から逃げる者となった体験において、ダビデは、道を見失った指導者がいかに国民や家族を傷つけうるのかを自ら目撃しました。彼は、通常とは異なる種類の指導者になろう、と決心したのです。 私たちの中に政治や国の指導者はほとんどいませんが、他者を励まし、他者に影響を及ぼす機会を持つという役割なら、私たち全員が生活の中で担っています。それは職場でのことかもしれませんし、地域社会への参加、家庭、教会の中でのことかもしれません。エレン・G・ホワイトがこういった指導の場の一つについてコメントしているように、「詩編 101 編に書かれているダビデの誓いの言葉は、家庭の影響を守る責任を負わせられている人すべての誓いの言葉となるべきです」(『次世代につなぐ信仰―両親、教師、生徒への勧め』105 ページ)。 機会があるとき、私たちは、私たちを指導する立場にある人たちにこのような原則を勧め、支持する心構えでいるべきです。また私たちはみな、自分の指導的立場や影響を及ぼす立場において、私たちが他者の祝福となるようダビデの指導の原則を適用する機会を持っています。 ダビデの出発点は、慈しみと裁きのゆえに神をほめたたえることであり(詩編101:1)、それが、ダビデが指導者として守ろうとしたすべてのことの土台になりました。彼は生活と仕事の中で、このような品性を身につけ、実践しようとしました。そうするために彼は、不正、腐敗、不誠実の誘惑と戦わねばなりませんでした。これらはみな、権力と指導権を持つ立場にいる人たちにとってとりわけ落とし穴だからです。 正しいことを行うためには、良い相談相手に助けてもらうことがとても重要であるのを知っていたので、ダビデは信頼できる助言者を探し出し、正直な官吏を任命することを誓います。ダビデとともに働く人たちや、彼のために働く人たちの中にあっても、裁きと慈しみが彼の指導の特徴となるべきでした。 `◆ 私たちは助言者や官吏を持つような立場にないかもしれませんが、裁きと慈しみを必要とする人たちのために、それらを持ちつつ生き、指導するのに助けとなる影響力で生活を満たすには、どうしたらよいのでしょうか。`
PrJared/sabbath-school-lessons
src/ja/2019-03/04/04.md
Markdown
mit
3,280
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>windows::random_access_handle_service::async_read_some_at</title> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> <link rel="home" href="../../../boost_asio.html" title="Boost.Asio"> <link rel="up" href="../windows__random_access_handle_service.html" title="windows::random_access_handle_service"> <link rel="prev" href="assign.html" title="windows::random_access_handle_service::assign"> <link rel="next" href="async_write_some_at.html" title="windows::random_access_handle_service::async_write_some_at"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> <td align="center"><a href="../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="assign.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../windows__random_access_handle_service.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="async_write_some_at.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> <a name="boost_asio.reference.windows__random_access_handle_service.async_read_some_at"></a><a class="link" href="async_read_some_at.html" title="windows::random_access_handle_service::async_read_some_at">windows::random_access_handle_service::async_read_some_at</a> </h4></div></div></div> <p> <a class="indexterm" name="idp109533088"></a> Start an asynchronous read at the specified offset. </p> <pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <a class="link" href="../MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a><span class="special">,</span> <span class="keyword">typename</span> <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a><span class="special">&gt;</span> <a class="link" href="../asynchronous_operations.html#boost_asio.reference.asynchronous_operations.return_type_of_an_initiating_function"><span class="emphasis"><em>void-or-deduced</em></span></a> <span class="identifier">async_read_some_at</span><span class="special">(</span> <span class="identifier">implementation_type</span> <span class="special">&amp;</span> <span class="identifier">impl</span><span class="special">,</span> <span class="identifier">uint64_t</span> <span class="identifier">offset</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">MutableBufferSequence</span> <span class="special">&amp;</span> <span class="identifier">buffers</span><span class="special">,</span> <span class="identifier">ReadHandler</span> <span class="identifier">handler</span><span class="special">);</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2015 Christopher M. Kohlhoff<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="assign.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../windows__random_access_handle_service.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="async_write_some_at.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
yinchunlong/abelkhan-1
ext/c++/thirdpart/c++/boost/libs/asio/doc/html/boost_asio/reference/windows__random_access_handle_service/async_read_some_at.html
HTML
mit
4,686
# Copyright 2010-2011, Sikuli.org # Released under the MIT License. from org.sikuli.script import VDictProxy import java.io.File ## # VDict implements a visual dictionary that has Python's conventional dict # interfaces. # # A visual dictionary is a data type for storing key-value pairs using # images as keys. Using a visual dictionary, a user can easily automate # the tasks of saving and retrieving arbitrary data objects by images. # The syntax of the visual dictionary data type is modeled after that of # the built-in Python dictionary data type. class VDict(VDictProxy): ## # the default similarity for fuzzy matching. The range of this is from # 0 to 1.0, where 0 matches everything and 1.0 does exactly matching. # <br/> # The default similarity is 0.7. _DEFAULT_SIMILARITY = 0.7 _DEFAULT_GET_ITEM_N = 0 ## # Constructs a new visual dictionary with the same mapping as the given dict. # def __init__(self, dict=None): self._keys = {} if dict: for k in dict.keys(): self[k] = dict[k] ## # Returns the number of keys in this visual dictionary. # def __len__(self): return self.size() ## # Maps the specified key to the specified item in this visual dictionary. # def __setitem__(self, key, item): self.insert(key, item) self._keys[key] = item ## # Tests if the specified object looks like a key in this visual dictionary # with the default similarity. # def __contains__(self, key): return len(self.get(key)) > 0 ## # Returns all values to which the specified key is fuzzily matched in # this visual dictionary with the default similarity. # <br/> # This is a wrapper for the {@link #VDict.get get} method. def __getitem__(self, key): return self.get(key) ## # Deletes the key and its corresponding value from this visual dictionary. # def __delitem__(self, key): self.erase(key) del self._keys[key] ## # Returns a list of the keys in this visual dictionary. # def keys(self): return self._keys.keys() ## # Returns the value to which the specified key is exactly matched in # this visual dictionary. # def get_exact(self, key): if key == None: return None return self.lookup(key) ## # Returns the values to which the specified key is fuzzily matched in # this visual dictionary with the given similarity and the given maximum # number of return items. # @param similarity the similarity for matching. # @param n maximum number of return items. # def get(self, key, similarity=_DEFAULT_SIMILARITY, n=_DEFAULT_GET_ITEM_N): if key == None: return None return self.lookup_similar_n(key, similarity, n) ## # Returns the value to which the specified key is best matched in # this visual dictionary with the given similarity. # @param similarity the similarity for matching. # def get1(self, key, similarity=_DEFAULT_SIMILARITY): if key == None: return None return self.lookup_similar(key, similarity)
ck1125/sikuli
sikuli-script/src/main/python/sikuli/VDict.py
Python
mit
3,120
## Buenas prácticas > En teoría, la teoría es igual a la práctica, pero en la práctica, no.
pieroblunda/curso-git
slides/buenas-practicas-0.md
Markdown
mit
98
using System.Collections.Generic; using System.ServiceModel; using BrightstarDB.Cluster.Common; namespace BrightstarDB.ClusterManager { /// <summary> /// Represents the configured topology for the cluster /// </summary> public class ClusterConfiguration { /// <summary> /// Get or the list of nodes that form the cluster /// </summary> public List<NodeConfiguration> ClusterNodes { get; set; } /// <summary> /// Get or set the minimum number of slave nodes required for a master to enter the running state /// </summary> public MasterConfiguration MasterConfiguration { get; set; } } }
kentcb/BrightstarDB
src/cluster/BrightstarDB.ClusterManager/ClusterConfiguration.cs
C#
mit
675
--- title: Oči podignute prema nebu date: 29/01/2020 --- `Pročitajte Daniel 4,34-37. Kako su se i zašto kraljeve prilike promijenile?` Bog dopušta da Nabukodonozor bude pogođen čudnom bolešću, ali mu na kraju rado vraća duševno zdravlje. Zanimljivo je što se sve mijenja kada na kraju sedam prorečenih godina bolesni kralj podiže svoje oči k Nebu (Daniel 4,34). “Sedam godina Nabukodonozor je služio kao čudo svim svojim podanicima; sedam godina bio je ponižavan pred očima cijeloga svijeta. A onda mu se vratio razum i on se ponizio obrativši se Bogu nebeskom i priznao da je Božja ruka upravljala njegovim kažnjavanjem. U javnom proglasu priznao je svoju krivnju i da ga je samo velika Božja milost vratila na položaj.” (Ellen G. White, Proroci i kraljevi, str. 331; u izvorniku 520) Nema sumnje, može doći do velikih promjena kada podignemo svoje oči prema Nebu. Čim mu se razum vratio, kralj daje svjedočanstvo da je naučio pouku. Međutim, ovaj izvještaj ne govori toliko o Nabukodonozoru koliko o Božjoj milosti. Kralj propušta tri prethodne prilike da prizna izraelskog Boga kao Gospodara u svojem životu. Te su mu prilike bile ponuđene kada je prepoznao iznimnu mudrost četvorice mladih judejskih zarobljenika (Daniel 1), kada je Daniel protumačio njegov san (Daniel 2) i kada su tri judejska mladića spašena iz užarene peći (Daniel 3). Pa ako ga to izbavljenje nije naučilo poniznosti, što će ga naučiti? Usprkos vladarovoj tvrdoglavosti, Bog mu daje četvrtu priliku, konačno zadobiva kraljevo srce i vraća ga na njegov kraljevski položaj (Daniel 4). Kao što Nabukodonozorov slučaj pokazuje, Bog pruža priliku za prilikom da bi nas vratio u pravu zajednicu s Njim. Kao što Pavao piše mnogo stoljeća kasnije, Gospodin “hoće da se svi ljudi spase i dođu do potpune spoznaje istine” (1. Timoteju 2,4). U ovom izvještaju vidimo snažan primjer te istine. `Na koje vas je načine Bog naučio poniznosti? Što ste naučili iz tih iskustava? Što kod sebe morate promijeniti kako ponovno ne biste primili tu pouku?`
imasaru/sabbath-school-lessons
src/hr/2020-01/05/05.md
Markdown
mit
2,092
#include "qrcodedialog.h" #include "ui_qrcodedialog.h" #include "bitcoinunits.h" #include "guiconstants.h" #include "guiutil.h" #include "optionsmodel.h" #include <QPixmap> #if QT_VERSION < 0x050000 #include <QUrl> #endif #include <qrencode.h> QRCodeDialog::QRCodeDialog(const QString &addr, const QString &label, bool enableReq, QWidget *parent) : QDialog(parent), ui(new Ui::QRCodeDialog), model(0), address(addr) { ui->setupUi(this); setWindowTitle(QString("%1").arg(address)); ui->chkReqPayment->setVisible(enableReq); ui->lblAmount->setVisible(enableReq); ui->lnReqAmount->setVisible(enableReq); ui->lnLabel->setText(label); ui->btnSaveAs->setEnabled(false); genCode(); } QRCodeDialog::~QRCodeDialog() { delete ui; } void QRCodeDialog::setModel(OptionsModel *model) { this->model = model; if (model) connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); // update the display unit, to not use the default ("BTC") updateDisplayUnit(); } void QRCodeDialog::genCode() { QString uri = getURI(); if (uri != "") { ui->lblQRCode->setText(""); QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1); if (!code) { ui->lblQRCode->setText(tr("Error encoding URI into QR Code.")); return; } myImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32); myImage.fill(0xffffff); unsigned char *p = code->data; for (int y = 0; y < code->width; y++) { for (int x = 0; x < code->width; x++) { myImage.setPixel(x + 4, y + 4, ((*p & 1) ? 0x0 : 0xffffff)); p++; } } QRcode_free(code); ui->lblQRCode->setPixmap(QPixmap::fromImage(myImage).scaled(300, 300)); ui->outUri->setPlainText(uri); } } QString QRCodeDialog::getURI() { QString ret = QString("tacocoin:%1").arg(address); int paramCount = 0; ui->outUri->clear(); if (ui->chkReqPayment->isChecked()) { if (ui->lnReqAmount->validate()) { // even if we allow a non BTC unit input in lnReqAmount, we generate the URI with BTC as unit (as defined in BIP21) ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, ui->lnReqAmount->value())); paramCount++; } else { ui->btnSaveAs->setEnabled(false); ui->lblQRCode->setText(tr("The entered amount is invalid, please check.")); return QString(""); } } if (!ui->lnLabel->text().isEmpty()) { QString lbl(QUrl::toPercentEncoding(ui->lnLabel->text())); ret += QString("%1label=%2").arg(paramCount == 0 ? "?" : "&").arg(lbl); paramCount++; } if (!ui->lnMessage->text().isEmpty()) { QString msg(QUrl::toPercentEncoding(ui->lnMessage->text())); ret += QString("%1message=%2").arg(paramCount == 0 ? "?" : "&").arg(msg); paramCount++; } // limit URI length to prevent a DoS against the QR-Code dialog if (ret.length() > MAX_URI_LENGTH) { ui->btnSaveAs->setEnabled(false); ui->lblQRCode->setText(tr("Resulting URI too long, try to reduce the text for label / message.")); return QString(""); } ui->btnSaveAs->setEnabled(true); return ret; } void QRCodeDialog::on_lnReqAmount_textChanged() { genCode(); } void QRCodeDialog::on_lnLabel_textChanged() { genCode(); } void QRCodeDialog::on_lnMessage_textChanged() { genCode(); } void QRCodeDialog::on_btnSaveAs_clicked() { QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Images (*.png)")); if (!fn.isEmpty()) myImage.scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE).save(fn); } void QRCodeDialog::on_chkReqPayment_toggled(bool fChecked) { if (!fChecked) // if chkReqPayment is not active, don't display lnReqAmount as invalid ui->lnReqAmount->setValid(true); genCode(); } void QRCodeDialog::updateDisplayUnit() { if (model) { // Update lnReqAmount with the current unit ui->lnReqAmount->setDisplayUnit(model->getDisplayUnit()); } }
Healdb/TacoCoin
src/qt/qrcodedialog.cpp
C++
mit
4,344
using System; using Nancy; namespace Starscream.Web.Api.Infrastructure.RestExceptions { public class BadRequestExceptionRepackager : IExceptionRepackager { #region IExceptionRepackager Members public ErrorResponse Repackage(Exception exception, NancyContext context, string contentType) { return new ErrorResponse(exception.Message, HttpStatusCode.BadRequest, contentType); } public bool CanHandle(Exception ex, string contentType) { Type type = ex.GetType(); return type.Name.Contains("NotValid"); } #endregion } }
AcklenAvenue/Starscream
src/Starscream.Web/Api/Infrastructure/RestExceptions/BadRequestExceptionRepackager.cs
C#
mit
631
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magento.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magento.com for more information. * * @category Mage * @package Mage_Reports * @copyright Copyright (c) 2006-2017 X.commerce, Inc. and affiliates (http://www.magento.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Report Sold Products collection * * @category Mage * @package Mage_Reports * @author Magento Core Team <core@magentocommerce.com> */ class Mage_Reports_Model_Mysql4_Product_Sold_Collection extends Mage_Reports_Model_Resource_Product_Sold_Collection { }
fabiensebban/magento
app/code/core/Mage/Reports/Model/Mysql4/Product/Sold/Collection.php
PHP
mit
1,240
(function() { window.samples.todo_lighted_spinning_cube = { initialize: function(canvas) { var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera( 30, sample_defaults.width / sample_defaults.height, 1, 1000 ); camera.position.set(0, 3, 7); camera.lookAt( new THREE.Vector3(0,0,0)); var scale = 2.5; var geometry = new THREE.CubeGeometry( scale, scale, scale ); var material = new THREE.MeshPhongMaterial({ color: 0xdddddd }); var mesh = new THREE.Mesh( geometry, material ); scene.add( mesh ); // ASSIGNMENT var directionalLight = new THREE.DirectionalLight ( 0xffffffff ); directionalLight.position.set(0, 3, 7); scene.add( directionalLight ); // ASSIGNMENT var renderer = new THREE.WebGLRenderer({canvas: canvas, antialias: true}); renderer.setSize( sample_defaults.width, sample_defaults.height ); var instance = { active: false }; function animate() { requestAnimationFrame( animate, canvas ); if(!instance.active || sample_defaults.paused) return; mesh.rotation.y += 0.008; renderer.render( scene, camera ); } animate(); return instance; } }; })();
dimroc/reveal.js-threejs
js/samples/todo_lighted_spinning_cube.js
JavaScript
mit
1,253
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. # MIT License. See license.txt from __future__ import unicode_literals """ Customize Form is a Single DocType used to mask the Property Setter Thus providing a better UI from user perspective """ import webnotes from webnotes.utils import cstr class DocType: def __init__(self, doc, doclist=[]): self.doc, self.doclist = doc, doclist self.doctype_properties = [ 'search_fields', 'default_print_format', 'read_only_onload', 'allow_print', 'allow_email', 'allow_copy', 'allow_attach', 'max_attachments' ] self.docfield_properties = [ 'idx', 'label', 'fieldtype', 'fieldname', 'options', 'permlevel', 'width', 'print_width', 'reqd', 'in_filter', 'in_list_view', 'hidden', 'print_hide', 'report_hide', 'allow_on_submit', 'depends_on', 'description', 'default', 'name' ] self.property_restrictions = { 'fieldtype': [['Currency', 'Float'], ['Small Text', 'Data'], ['Text', 'Text Editor', 'Code']], } self.forbidden_properties = ['idx'] def get(self): """ Gets DocFields applied with Property Setter customizations via Customize Form Field """ self.clear() if self.doc.doc_type: from webnotes.model.doc import addchild for d in self.get_ref_doclist(): if d.doctype=='DocField': new = addchild(self.doc, 'fields', 'Customize Form Field', self.doclist) self.set( { 'list': self.docfield_properties, 'doc' : d, 'doc_to_set': new } ) elif d.doctype=='DocType': self.set({ 'list': self.doctype_properties, 'doc': d }) def get_ref_doclist(self): """ * Gets doclist of type self.doc.doc_type * Applies property setter properties on the doclist * returns the modified doclist """ from webnotes.model.doctype import get ref_doclist = get(self.doc.doc_type) ref_doclist = webnotes.doclist([ref_doclist[0]] + ref_doclist.get({"parent": self.doc.doc_type})) return ref_doclist def clear(self): """ Clear fields in the doc """ # Clear table before adding new doctype's fields self.doclist = self.doc.clear_table(self.doclist, 'fields') self.set({ 'list': self.doctype_properties, 'value': None }) def set(self, args): """ Set a list of attributes of a doc to a value or to attribute values of a doc passed args can contain: * list --> list of attributes to set * doc_to_set --> defaults to self.doc * value --> to set all attributes to one value eg. None * doc --> copy attributes from doc to doc_to_set """ if not 'doc_to_set' in args: args['doc_to_set'] = self.doc if 'list' in args: if 'value' in args: for f in args['list']: args['doc_to_set'].fields[f] = None elif 'doc' in args: for f in args['list']: args['doc_to_set'].fields[f] = args['doc'].fields.get(f) else: webnotes.msgprint("Please specify args['list'] to set", raise_exception=1) def post(self): """ Save diff between Customize Form Bean and DocType Bean as property setter entries """ if self.doc.doc_type: from webnotes.model import doc from core.doctype.doctype.doctype import validate_fields_for_doctype this_doclist = webnotes.doclist([self.doc] + self.doclist) ref_doclist = self.get_ref_doclist() dt_doclist = doc.get('DocType', self.doc.doc_type) # get a list of property setter docs diff_list = self.diff(this_doclist, ref_doclist, dt_doclist) self.set_properties(diff_list) validate_fields_for_doctype(self.doc.doc_type) webnotes.clear_cache(doctype=self.doc.doc_type) webnotes.msgprint("Updated") def diff(self, new_dl, ref_dl, dt_dl): """ Get difference between new_dl doclist and ref_dl doclist then check how it differs from dt_dl i.e. default doclist """ import re self.defaults = self.get_defaults() diff_list = [] for new_d in new_dl: for ref_d in ref_dl: if ref_d.doctype == 'DocField' and new_d.name == ref_d.name: for prop in self.docfield_properties: # do not set forbidden properties like idx if prop in self.forbidden_properties: continue d = self.prepare_to_set(prop, new_d, ref_d, dt_dl) if d: diff_list.append(d) break elif ref_d.doctype == 'DocType' and new_d.doctype == 'Customize Form': for prop in self.doctype_properties: d = self.prepare_to_set(prop, new_d, ref_d, dt_dl) if d: diff_list.append(d) break return diff_list def get_defaults(self): """ Get fieldtype and default value for properties of a field """ df_defaults = webnotes.conn.sql(""" SELECT fieldname, fieldtype, `default`, label FROM `tabDocField` WHERE parent='DocField' or parent='DocType'""", as_dict=1) defaults = {} for d in df_defaults: defaults[d['fieldname']] = d defaults['idx'] = {'fieldname' : 'idx', 'fieldtype' : 'Int', 'default' : 1, 'label' : 'idx'} defaults['previous_field'] = {'fieldname' : 'previous_field', 'fieldtype' : 'Data', 'default' : None, 'label' : 'Previous Field'} return defaults def prepare_to_set(self, prop, new_d, ref_d, dt_doclist, delete=0): """ Prepares docs of property setter sets delete property if it is required to be deleted """ # Check if property has changed compared to when it was loaded if new_d.fields.get(prop) != ref_d.fields.get(prop) \ and not \ ( \ new_d.fields.get(prop) in [None, 0] \ and ref_d.fields.get(prop) in [None, 0] \ ) and not \ ( \ new_d.fields.get(prop) in [None, ''] \ and ref_d.fields.get(prop) in [None, ''] \ ): #webnotes.msgprint("new: " + str(new_d.fields[prop]) + " | old: " + str(ref_d.fields[prop])) # Check if the new property is same as that in original doctype # If yes, we need to delete the property setter entry for dt_d in dt_doclist: if dt_d.name == ref_d.name \ and (new_d.fields.get(prop) == dt_d.fields.get(prop) \ or \ ( \ new_d.fields.get(prop) in [None, 0] \ and dt_d.fields.get(prop) in [None, 0] \ ) or \ ( \ new_d.fields.get(prop) in [None, ''] \ and dt_d.fields.get(prop) in [None, ''] \ )): delete = 1 break value = new_d.fields.get(prop) if prop in self.property_restrictions: allow_change = False for restrict_list in self.property_restrictions.get(prop): if value in restrict_list and \ ref_d.fields.get(prop) in restrict_list: allow_change = True break if not allow_change: webnotes.msgprint("""\ You cannot change '%s' of '%s' from '%s' to '%s'. %s can only be changed among %s. <i>Ignoring this change and saving.</i>""" % \ (self.defaults.get(prop, {}).get("label") or prop, new_d.fields.get("label") or new_d.fields.get("idx"), ref_d.fields.get(prop), value, self.defaults.get(prop, {}).get("label") or prop, " -or- ".join([", ".join(r) for r in \ self.property_restrictions.get(prop)]))) return None # If the above conditions are fulfilled, # create a property setter doc, but dont save it yet. from webnotes.model.doc import Document d = Document('Property Setter') d.doctype_or_field = ref_d.doctype=='DocField' and 'DocField' or 'DocType' d.doc_type = self.doc.doc_type d.field_name = ref_d.fieldname d.property = prop d.value = value d.property_type = self.defaults[prop]['fieldtype'] #d.default_value = self.defaults[prop]['default'] if delete: d.delete = 1 if d.select_item: d.select_item = self.remove_forbidden(d.select_item) # return the property setter doc return d else: return None def set_properties(self, ps_doclist): """ * Delete a property setter entry + if it already exists + if marked for deletion * Save the property setter doc in the list """ for d in ps_doclist: # Delete existing property setter entry if not d.fields.get("field_name"): webnotes.conn.sql(""" DELETE FROM `tabProperty Setter` WHERE doc_type = %(doc_type)s AND property = %(property)s""", d.fields) else: webnotes.conn.sql(""" DELETE FROM `tabProperty Setter` WHERE doc_type = %(doc_type)s AND field_name = %(field_name)s AND property = %(property)s""", d.fields) # Save the property setter doc if not marked for deletion i.e. delete=0 if not d.delete: d.save(1) def delete(self): """ Deletes all property setter entries for the selected doctype and resets it to standard """ if self.doc.doc_type: webnotes.conn.sql(""" DELETE FROM `tabProperty Setter` WHERE doc_type = %s""", self.doc.doc_type) webnotes.clear_cache(doctype=self.doc.doc_type) self.get() def remove_forbidden(self, string): """ Replace forbidden characters with a space """ forbidden = ['%', "'", '"', '#', '*', '?', '`'] for f in forbidden: string.replace(f, ' ')
gangadhar-kadam/sapphite_lib
core/doctype/customize_form/customize_form.py
Python
mit
8,959
/* * GlobalClusteringCoefficient.h * * Created on: 12.11.2013 */ #ifndef GLOBALCLUSTERINGCOEFFICIENT_H_ #define GLOBALCLUSTERINGCOEFFICIENT_H_ #include "../graph/Graph.h" namespace NetworKit { /** * @ingroup global */ class GlobalClusteringCoefficient { public: virtual double approximate(const Graph& G, int k); }; } /* namespace NetworKit */ #endif /* GLOBALCLUSTERINGCOEFFICIENT_H_ */
fmaschler/networkit
networkit/cpp/global/GlobalClusteringCoefficient.h
C
mit
404
angular.module('IntrepidJS').directive('ngShare', ['$location', 'i18n', function($location, i18n) { return { restrict: "E", template: "<div class='btn-group'><span data-toggle='dropdown' " + "class='dropdown-toggle pointer'> " + "<i class='fa fa-share-alt fa-fw'></i></span>" + "<ul role='menu' class='dropdown-menu'></ul></div>", replace: true, link: function ($scope, element, attrs) { var path = $location.absUrl().replace($location.url(), ''); var ul = angular.element(element).find('ul'); var doAll = function () { var items = angular.copy(share_widgets); var text = attrs.text ? attrs.text : document.title; var link = attrs.link ? path + attrs.link : $location.absUrl(); ul.empty(); _.each(items, function(w) { w.link = w.link.replace('@text', encodeURIComponent(text)); w.link = w.link.replace('@link', encodeURIComponent(link)); var li = "<li><a href='" + w.link + "' target='_blank'>" + "<i class='" + w.icon + " fa-fw'></i>&nbsp; " + "<span>" + i18n.__('Share on') + " " + w.name + "</span></a></li>"; ul.append(li); }); }; attrs.$observe('text', function(text) { if (text) doAll(); }); attrs.$observe('link', function(link) { if (link) doAll(); }); } }; }]);
wtelecom/intrepidjs-web
public/javascripts/core/directives/ng_share.js
JavaScript
mit
1,683
/************************************************************************** * * Copyright 2011 Jose Fonseca * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **************************************************************************/ #pragma once #include <stdint.h> #include "glimports.hpp" #include "glproc.hpp" #include "image.hpp" class StateWriter; namespace glstate { struct Context { unsigned ES:1; unsigned core:1; unsigned ARB_draw_buffers:1; unsigned ARB_sampler_objects:1; unsigned ARB_get_program_binary:1; unsigned KHR_debug:1; unsigned EXT_debug_label:1; Context(void); }; class PixelPackState { public: PixelPackState(const Context & context); ~PixelPackState(); private: bool ES; // Pack state GLint pack_alignment; GLint pack_image_height; GLint pack_lsb_first; GLint pack_row_length; GLint pack_skip_images; GLint pack_skip_pixels; GLint pack_skip_rows; GLint pack_swap_bytes; GLint pixel_pack_buffer_binding; }; static inline void flushErrors(void) { while (glGetError() != GL_NO_ERROR) { } } const char * formatToString(GLenum internalFormat); struct InternalFormatDesc { GLenum internalFormat; /* The external format/type that matches the internalFormat exactly, or GL_NONE. */ GLenum format; GLenum type; /* The appropriate read type for dumping. */ GLenum readType; }; const InternalFormatDesc & getInternalFormatDesc(GLenum internalFormat); void chooseReadBackFormat(const InternalFormatDesc &formatDesc, GLenum &format, GLenum &type); void getImageFormat(GLenum format, GLenum type, GLuint &channels, image::ChannelType &channelType); // Abstract base class for pixel format conversion class PixelFormat { public: virtual ~PixelFormat() {} // Size in bytes virtual size_t size(void) const = 0; // Unpack a span of pixels virtual void unpackSpan(const uint8_t *inSpan, float *outSpan, unsigned width) const = 0; }; const PixelFormat * getPixelFormat(GLenum internalFormat); /** * Helper class to temporarily bind a buffer to the specified target until * control leaves the declaration scope. */ class BufferBinding { private: GLenum target; GLuint buffer; GLuint prevBuffer; public: BufferBinding(GLenum _target, GLuint _buffer); ~BufferBinding(); }; /** * Helper class to temporarily map a buffer (if necessary), and unmap when * destroyed. */ class BufferMapping { GLuint target; GLuint buffer; GLvoid *map_pointer; bool unmap; public: BufferMapping(); GLvoid * map(GLenum _target, GLuint _buffer); ~BufferMapping(); }; bool isGeometryShaderBound(Context &context); void dumpBoolean(StateWriter &writer, GLboolean value); void dumpEnum(StateWriter &writer, GLenum pname); char * getObjectLabel(Context &context, GLenum identifier, GLuint name); void dumpObjectLabel(StateWriter &writer, Context &context, GLenum identifier, GLuint name, const char *member); void dumpParameters(StateWriter &writer, Context &context); void dumpShadersUniforms(StateWriter &writer, Context &context); void dumpTextures(StateWriter &writer, Context &context); void dumpFramebuffer(StateWriter &writer, Context &context); } /* namespace glstate */
surround-io/apitrace
retrace/glstate_internal.hpp
C++
mit
4,386
# level-manifest Describe the functions that multilevel should provide access to on the client. [![Build Status](https://travis-ci.org/dominictarr/level-manifest.png?branch=master)](https://travis-ci.org/dominictarr/level-manifest) ## Example Suppose you implement a levelup plugin that adds some cool new features to a [sublevel](https://github.com/dominictarr/level-sublevel) retrive a js object describing what methods a client protocol should be able to access. ``` js var manifest = require('level-manifest') var m = manifest(db) ``` `manifest` build a tree of sublevels. ``` js { methods: {}, sublevels: { foo: { methods: {}, sublevels: {} } } } ``` Plugins extending a sublevel should add a `methods` property that describes any new methods that can be used by a remote client. for example, the default methods are specified like this: ``` js var methods = { createReadStream : {type: 'readable'}, readStream : {type: 'readable'}, createValueStream : {type: 'readable'}, valueStream : {type: 'readable'}, createKeyStream : {type: 'readable'}, keyStream : {type: 'readable'}, createWriteStream : {type: 'writable'}, writeStream : {type: 'writable'}, isOpen : {type: 'sync'}, isClosed : {type: 'sync'}, put : {type: 'async'}, get : {type: 'async'}, del : {type: 'async'}, batch : {type: 'async'}, approximateSize : {type: 'async'} } ``` `readable`, and `writable` mean readable or writable streams, (use `duplex` for a stream that is both readable and writable.) A client should also provide support for these types: ``` js var other = { error : {type: 'error', message: 'not-supported'}, createStream : {type: 'duplex'}, nested : {type: 'object', methods: {get: {type: 'async'}}} } ``` `error` is used when a method has been disabled. ## License MIT
zzhi191/easyleveldb
node_modules/q-level/node_modules/level-manifest/README.md
Markdown
mit
1,954
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace SwdPageRecorder.UI.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } }
moinuddin14/swd-recorder
SwdPageRecorder/SwdPageRecorder.UI/Properties/Settings.Designer.cs
C#
mit
1,075
# NEWS *We'll keep a history of the news. A few bullets at the top will also show on the [README.md](./README.md).* * Always see the [CHANGELOG.md](./CHANGELOG.md) for the latest project changes. * 2017-04-25: 7.0.0 Shipped! Performance improvements! Please upgrade! Only "breaking" change is that you have to update both the node module and the Ruby gem. * 2017-04-09: 8.0.0 beta work to include webpacker_lite gem has begun. See [#786](https://github.com/shakacode/react_on_rails/issues/786). * 2017-04-03: 6.9.3 Released! Props rendered in JSON script tag. Page size is smaller now due to less escaping! * 2017-03-06: Updated to Webpack v2! * 2017-03-02: Demo of internationalization (i18n) is live at [reactrails.com](https://www.reactrails.com/). Docs [here](docs/basics/i18n.md). * 2017-02-28: See [discussions here on Webpacker](https://github.com/rails/webpacker/issues/139) regarding how Webpacker will allow React on Rails to avoid using the asset pipeline in the near future. * 2017-02-28: Upgrade to Webpack v2 or use the `--bail` option in your webpack script for test and production builds. See the discussion on [PR #730](https://github.com/shakacode/react_on_rails/pull/730). * 2016-11-03: Spoke at [LA Ruby: "React on Rails: Why, What, and How?"](http://www.meetup.com/laruby/events/234825187/). [Video and pictures in this article](https://blog.shakacode.com/my-react-on-rails-talk-at-the-la-ruby-rails-meetup-november-10-2016-eaaa83aff800#.ej6h4eglp). * 2016-12-20: New Video on Egghead.io: [Creating a component with React on Rails](https://egghead.io/lessons/react-creating-a-component-with-react-on-rails) * 2016-11-03: Spoke at [LA Ruby, 7pm, Thursday, November 10 in Venice, CA: "React on Rails: Why, What, and How?"](http://www.meetup.com/laruby/events/234825187/). [Video and pictures in this article](https://blog.shakacode.com/my-react-on-rails-talk-at-the-la-ruby-rails-meetup-november-10-2016-eaaa83aff800#.ej6h4eglp). * 2016-08-27: We now have a [Documentation Gitbook](https://shakacode.gitbooks.io/react-on-rails/content/) for improved readability & reference. * 2016-08-21: v6.1 ships with serveral new features and bug fixes. See the [Changelog](CHANGELOG.md). * 2016-07-28: If you're doing server rendering, be sure to use mini\_racer! See [issues/428](https://github.com/shakacode/react_on_rails/issues/428). It's supposedly much faster than `therubyracer`. * 2016-08-27: We now have a [Documentation Gitbook](https://shakacode.gitbooks.io/react-on-rails/content/) for improved readability & reference. * 2016-08-21: v6.1 ships with serveral new features and bug fixes. See the [Changelog](CHANGELOG.md). * 2016-06-13: 6.0.4 shipped with a critical fix regarding a missing polyfill for `clearTimeout`, used by babel-polyfill. * 2016-06-06: 6.0.2 shipped with a critical fix if you are fragment caching the server generated React. * 2016-05-24: 6.0.0 Released! Simplified generator and install process! See the [CHANGELOG.md](./CHANGELOG.md) for details. * 2016-04-08: 5.2.0 Released! Support for React 15.0 and updates to the Generator. * 2016-03-18: [Slides on React on Rails](http://www.slideshare.net/justingordon/react-on-rails-v4032). * 2016-03-17: **4.0.3** Shipped! Includes using the new Heroku buildpack steps, several smaller changes detailed in the [CHANGELOG.md](./CHANGELOG.md). * 2016-03-17: **4.0.2** Shipped! Includes using the new Heroku buildpack steps. * Better support for hot reloading of assets from Rails with new helpers and updates to the sample testing app, [spec/dummy](spec/dummy). * Better support for Turbolinks 5. * Controller rendering of shared redux stores and ability to render store data at bottom of HTML page. * See [#311](https://github.com/shakacode/react_on_rails/pull/311/files). * Some breaking changes! See [CHANGELOG.md](./CHANGELOG.md) for details. * 2016-02-28: We added a [Projects page](PROJECTS.md). Please edit the page your project or [email us](mailto:contact@shakacode.com) and we'll add you. We also love stars as it helps us attract new users and contributors. [jbhatab](https://github.com/jbhatab) is leading an effort to ease the onboarding process for newbies with simpler project generators. See [#245](https://github.com/shakacode/react_on_rails/issues/245). * 3.0.6 shipped on Tuesday, 2016-03-01. Please see the [Changelog](CHANGELOG.md) for details, and let us know if you see any issues! [Migration steps from 1.x](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md#migration-steps-v1-to-v2). [Migration steps from 2.x](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md#migration-steps-v2-to-v3). * [RubyGems](https://rubygems.org/gems/react_on_rails/) * [NPM](https://www.npmjs.com/package/react-on-rails) * 3.0.0 Highlights: 1. Support for ensuring JavaScript is current when running tests. 2. Support for multiple React components with one Redux store. So you can have a header React component and different body React components talking to the same Redux store! 3. Support for Turbolinks 5! * There was a fatal error when using the lastest version of Redux for server rendering. See [Redux #1335](https://github.com/reactjs/redux/issues/1335). See [diff 3.1.6...3.1.4](https://github.com/reactjs/redux/commit/e2e14d26f09ca729ae0555442f50fcfc45bfb423#diff-1fdf421c05c1140f6d71444ea2b27638). Workaround for server rendering: Use Redux 3.1.7 or upgrade to React On Rails v2.3.0. [this commit](https://github.com/shakacode/react_on_rails/commit/59f1e68d3d233775e6abc63bff180ea59ac2d79e) on [PR #244](https://github.com/shakacode/react_on_rails/pull/244/). * 2.x Highlights: 1. Fixed a **critical** problem with TurboLinks. Be sure to see [turbolinks docs](docs/additional-reading/turbolinks.md) for more information on how to debug TurboLinks issues. 2. Provides a convenient helper to ensure that JavaScript assets are compiled before running tests. * React on Rails does not yet have *generator* support for building new apps that use CSS modules and hot reloading via the Rails server as is demonstrated in the [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/). *We do support this, but we don't generate the code.* If you did generate a fresh app from react_on_rails and want to move to CSS Modules, then see [PR 175: Babel 6 / CSS Modules / Rails hot reloading](https://github.com/shakacode/react-webpack-rails-tutorial/pull/175). Note, while there are probably fixes after this PR was accepted, this has the majority of the changes. See [the tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/#news) for more information. Ping us if you want to help! * [ShakaCode](http://www.shakacode.com) is doing Skype plus Slack/Github based coaching for "React on Rails". [Click here](http://www.shakacode.com/work/index.html) for more information. * Be sure to read our article [The React on Rails Doctrine](https://medium.com/@railsonmaui/the-react-on-rails-doctrine-3c59a778c724).
lrosskamp/makealist-public
vendor/cache/ruby/2.3.0/gems/react_on_rails-8.0.0/NEWS.md
Markdown
mit
7,016
import Mark = require("./mark"); declare class YAMLException { message: string; reason: string; name: string; mark: Mark; isWarning: boolean; private static CLASS_IDENTIFIER; static isInstance(instance: any): instance is YAMLException; getClassIdentifier(): string[]; constructor(reason: string, mark?: Mark, isWarning?: boolean); toString(compact?: boolean): any; } export = YAMLException;
karan/dotfiles
.vscode/extensions/redhat.vscode-yaml-0.7.2/node_modules/yaml-language-server/out/server/node_modules/yaml-ast-parser-custom-tags/dist/src/exception.d.ts
TypeScript
mit
431
from __future__ import absolute_import, unicode_literals import email import logging from email.utils import formataddr from collections import defaultdict from django.conf import settings from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.core.urlresolvers import reverse from django.db.models import Q from django.template.loader import render_to_string from django.utils import six, timezone from django.utils.datastructures import MultiValueDict from django.utils.six.moves.urllib.parse import urljoin from djblets.mail.message import EmailMessage as DjbletsEmailMessage from djblets.siteconfig.models import SiteConfiguration from djblets.auth.signals import user_registered from reviewboard.accounts.models import ReviewRequestVisit from reviewboard.admin.server import get_server_url from reviewboard.reviews.models import Group, ReviewRequest, Review from reviewboard.reviews.signals import (review_request_published, review_published, reply_published, review_request_closed) from reviewboard.reviews.views import build_diff_comment_fragments # A mapping of signals to EmailHooks. _hooks = defaultdict(set) def _ensure_unicode(text): """Return a unicode object for the given text. Args: text (bytes or unicode): The text to decode. Returns: unicode: The decoded text. """ if isinstance(text, bytes): text = text.decode('utf-8') return text def register_email_hook(signal, handler): """Register an e-mail hook. Args: signal (django.dispatch.Signal): The signal that will trigger the e-mail to be sent. This is one of :py:data:`~reviewboard.reviews.signals.review_request_published`, :py:data:`~reviewboard.reviews.signals.review_request_closed`, :py:data:`~reviewboard.reviews.signals.review_published`, or :py:data:`~reviewboard.reviews.signals.reply_published`. handler (reviewboard.extensions.hooks.EmailHook): The ``EmailHook`` that will be triggered when an e-mail of the chosen type is about to be sent. """ assert signal in (review_request_published, review_request_closed, review_published, reply_published), ( 'Invalid signal %r' % signal) _hooks[signal].add(handler) def unregister_email_hook(signal, handler): """Unregister an e-mail hook. Args: signal (django.dispatch.Signal): The signal that will trigger the e-mail to be sent. This is one of :py:data:`~reviewboard.reviews.signals.review_request_published`, :py:data:`~reviewboard.reviews.signals.review_request_closed`, :py:data:`~reviewboard.reviews.signals.review_published`, or :py:data:`~reviewboard.reviews.signals.reply_published`. handler (reviewboard.extensions.hooks.EmailHook): The ``EmailHook`` that will be triggered when an e-mail of the chosen type is about to be sent. """ assert signal in (review_request_published, review_request_closed, review_published, reply_published), ( 'Invalid signal %r' % signal) _hooks[signal].discard(handler) def review_request_closed_cb(sender, user, review_request, type, **kwargs): """Send e-mail when a review request is closed. Listens to the :py:data:`~reviewboard.reviews.signals.review_request_closed` signal and sends an e-mail if this type of notification is enabled (through the ``mail_send_review_close_mail`` site configuration setting). """ siteconfig = SiteConfiguration.objects.get_current() if siteconfig.get('mail_send_review_close_mail'): mail_review_request(review_request, user, close_type=type) def review_request_published_cb(sender, user, review_request, trivial, changedesc, **kwargs): """Send e-mail when a review request is published. Listens to the :py:data:`~reviewboard.reviews.signals.review_request_published` signal and sends an e-mail if this type of notification is enabled through the ``mail_send_review_mail`` site configuration setting). """ siteconfig = SiteConfiguration.objects.get_current() if siteconfig.get('mail_send_review_mail') and not trivial: mail_review_request(review_request, user, changedesc) def review_published_cb(sender, user, review, to_submitter_only, **kwargs): """Send e-mail when a review is published. Listens to the :py:data:`~reviewboard.reviews.signals.review_published` signal and sends e-mail if this type of notification is enabled through the ``mail_send_review_mail`` site configuration setting). """ siteconfig = SiteConfiguration.objects.get_current() if siteconfig.get('mail_send_review_mail'): mail_review(review, user, to_submitter_only) def reply_published_cb(sender, user, reply, trivial, **kwargs): """Send e-mail when a review reply is published. Listens to the :py:data:`~reviewboard.reviews.signals.reply_published` signal and sends an e-mail if this type of notification is enabled (through ``mail_send_review_mail`` site configuration). """ siteconfig = SiteConfiguration.objects.get_current() if siteconfig.get('mail_send_review_mail') and not trivial: mail_reply(reply, user) def user_registered_cb(user, **kwargs): """Send e-mail when a user is registered. Listens for new user registrations and sends a new user registration e-mail to administrators, if this type of notification is enabled (through ``mail_send_new_user_mail`` site configuration). """ siteconfig = SiteConfiguration.objects.get_current() if siteconfig.get('mail_send_new_user_mail'): mail_new_user(user) def connect_signals(): """Connect e-mail callbacks to signals.""" review_request_published.connect(review_request_published_cb, sender=ReviewRequest) review_published.connect(review_published_cb, sender=Review) reply_published.connect(reply_published_cb, sender=Review) review_request_closed.connect(review_request_closed_cb, sender=ReviewRequest) user_registered.connect(user_registered_cb) def build_email_address(fullname, email): """Build an e-mail address for the name and e-mail address. Args: fullname (unicode): The full name associated with the e-mail address (or ``None``). email (unicode): The e-mail address. Returns: unicode: A properly formatted e-mail address. """ return formataddr((fullname, email)) def get_email_address_for_user(user): """Build an e-mail address for the given user. Args: user (django.contrib.auth.models.User): The user. Returns: unicode: A properly formatted e-mail address for the user. """ return build_email_address(user.get_full_name(), user.email) def get_email_addresses_for_group(group, review_request_id=None): """Build a list of e-mail addresses for the group. Args: group (reviewboard.reviews.models.Group): The review group to build the e-mail addresses for. Returns: list: A list of properly formatted e-mail addresses for all users in the review group. """ addresses = [] if group.mailing_list: if ',' not in group.mailing_list: # The mailing list field has only one e-mail address in it, # so we can just use that and the group's display name. addresses = [build_email_address(group.display_name, group.mailing_list)] else: # The mailing list field has multiple e-mail addresses in it. # We don't know which one should have the group's display name # attached to it, so just return their custom list as-is. addresses = group.mailing_list.split(',') if not (group.mailing_list and group.email_list_only): users_q = Q(is_active=True) local_site = group.local_site if local_site: users_q = users_q & (Q(local_site=local_site) | Q(local_site_admins=local_site)) users = group.users.filter(users_q).select_related('profile') if review_request_id: users = users.extra(select={ 'visibility': """ SELECT accounts_reviewrequestvisit.visibility FROM accounts_reviewrequestvisit WHERE accounts_reviewrequestvisit.review_request_id = %s AND accounts_reviewrequestvisit.user_id = reviews_group_users.user_id """ % review_request_id }) addresses.extend([ get_email_address_for_user(u) for u in users if (u.should_send_email() and (not review_request_id or u.visibility != ReviewRequestVisit.MUTED)) ]) return addresses class EmailMessage(DjbletsEmailMessage): """The Review Board EmailMessage subclass. This class only differs from Djblets' :py:class:`EmailMessage <djblets.email.message.EmailMessage>` by using the site configuration to generate some e-mail settings. """ def __init__(self, subject, text_body, html_body, from_email, sender, to, cc=None, in_reply_to=None, headers=None): siteconfig = SiteConfiguration.objects.get_current() auto_generated = siteconfig.get('mail_enable_autogenerated_header') super(EmailMessage, self).__init__( subject=subject, text_body=text_body, html_body=html_body, from_email=from_email, to=to, cc=cc, sender=sender, in_reply_to=in_reply_to, headers=headers, auto_generated=auto_generated, prevent_auto_responses=True) def build_recipients(user, review_request, extra_recipients=None, limit_recipients_to=None): """Build the recipient sets for an e-mail. By default, the user sending the e-mail, the review request submitter (if they are active), all active reviewers, and all active members of review groups will be recipients of the e-mail. If the ``limit_recipients_to`` parameter is provided, the given ``user`` and the review request submitter (if active) will still be recipients of the e-mail, but all reviewers and members of review groups will not. Instead, the recipients given in ``limit_recipients_to`` will be used. Args: user (django.contrib.auth.models.User): The user sending the e-mail. review_request (reviewboard.reviews.models.ReviewRequest): The review request the e-mail corresponds to. extra_recipients (list): An optional list of extra recipients as :py:class:`Users <django.contrib.auth.models.User>` and :py:class:`Groups <reviewboard.reviews.models.Group>` that will receive the e-mail. limit_recipients_to (list): An optional list of recipients as :py:class:`Users <django.contrib.auth.models.User>` and :py:class:`Groups <reviewboard.reviews.models.Group>` who will receive the e-mail in place of the normal recipients. Returns: tuple: A 2-tuple of the To field and the CC field, as sets of :py:class:`Users <django.contrib.auth.models.User>` and :py:class:`Groups <reviewboard.reviews.models.Group>`. """ recipients = set() to_field = set() local_site = review_request.local_site_id submitter = review_request.submitter target_people = review_request.target_people.filter(is_active=True).extra( select={ 'visibility': """ SELECT accounts_reviewrequestvisit.visibility FROM accounts_reviewrequestvisit WHERE accounts_reviewrequestvisit.review_request_id = reviews_reviewrequest_target_people.reviewrequest_id AND accounts_reviewrequestvisit.user_id = reviews_reviewrequest_target_people.user_id """ }) starred_users = User.objects.filter( is_active=True, profile__starred_review_requests=review_request, profile__should_send_email=True) local_site_q = Q() if local_site: # Filter out users who are on the reviewer list in some form or have # starred the review request but are no longer part of the LocalSite. local_site_q = (Q(local_site=local_site) | Q(local_site_admins=local_site)) target_people = target_people.filter(local_site_q) starred_users = starred_users.filter(local_site_q) if not extra_recipients: extra_recipients = User.objects.none() if user.should_send_email(): recipients.add(user) if submitter.is_active and submitter.should_send_email(): recipients.add(submitter) recipients.update(starred_users) def _filter_recipients(to_filter): """Filter the given recipients. All groups will be added to the resulting recipients. Only users with a matching local site will be added to the resulting recipients. Args: to_filter (list): A list of recipients as :py:class:`Users <django.contrib.auth.models.User>` and :py:class:`Groups <reviewboard.reviews.models.Group>`. """ pks = set() for recipient in to_filter: if isinstance(recipient, User): pks.add(recipient.pk) elif isinstance(recipient, Group): recipients.add(recipient) else: logging.error( 'Unexpected e-mail recipient %r; expected ' 'django.contrib.auth.models.User or ' 'reviewboard.reviews.models.Group.', recipient) if pks: filtered_users = User.objects.filter( Q(is_active=True, pk__in=pks), local_site_q) recipients.update( recipient for recipient in filtered_users.select_related('Profile') if recipient.should_send_email() ) if limit_recipients_to is not None: _filter_recipients(limit_recipients_to) else: _filter_recipients(extra_recipients) target_people = target_people.filter(is_active=True) to_field.update( recipient for recipient in target_people.select_related('Profile') if (recipient.should_send_email() and recipient.visibility != ReviewRequestVisit.MUTED) ) recipients.update(to_field) recipients.update(review_request.target_groups.all()) if not user.should_send_own_updates(): recipients.discard(user) to_field.discard(user) if to_field: cc_field = recipients.symmetric_difference(to_field) else: to_field = recipients cc_field = set() return to_field, cc_field def recipients_to_addresses(recipients, review_request_id=None): """Return the set of e-mail addresses for the recipients. Args: recipients (list): A list of :py:class:`Users <django.contrib.auth.models.User>` and :py:class:`Groups <reviewboard.reviews.models.Group>`. Returns: set: The e-mail addresses for all recipients. """ addresses = set() for recipient in recipients: assert isinstance(recipient, User) or isinstance(recipient, Group) if isinstance(recipient, User): addresses.add(get_email_address_for_user(recipient)) else: addresses.update(get_email_addresses_for_group(recipient, review_request_id)) return addresses def send_review_mail(user, review_request, subject, in_reply_to, to_field, cc_field, text_template_name, html_template_name, context=None, extra_headers=None): """Format and send an e-mail out. Args: user (django.contrib.auth.models.User): The user who is sending the e-mail. review_request (reviewboard.reviews.models.ReviewRequest): The review request that the e-mail is about. subject (unicode): The subject of the e-mail address. in_reply_to (unicode): The e-mail message ID for threading. to_field (list): The recipients to send the e-mail to. This should be a list of :py:class:`Users <django.contrib.auth.models.User>` and :py:class:`Groups <reviewboard.reviews.models.Group>`. cc_field (list): The addresses to be CC'ed on the e-mail. This should be a list of :py:class:`Users <django.contrib.auth.models.User>` and :py:class:`Groups <reviewboard.reviews.models.Group>`. text_template_name (unicode): The name for the text e-mail template. html_template_name (unicode): The name for the HTML e-mail template. context (dict): Optional extra context to provide to the template. extra_headers (dict): Either a dict or :py:class:`~django.utils.datastructures.MultiValueDict` providing additional headers to send with the e-mail. Returns: unicode: The resulting e-mail message ID. """ current_site = Site.objects.get_current() local_site = review_request.local_site from_email = get_email_address_for_user(user) to_field = recipients_to_addresses(to_field, review_request.id) cc_field = recipients_to_addresses(cc_field, review_request.id) - to_field if not user.should_send_own_updates(): to_field.discard(get_email_address_for_user(user)) if not to_field and not cc_field: # Nothing to send. return siteconfig = current_site.config.get() domain_method = siteconfig.get("site_domain_method") if not context: context = {} context['user'] = user context['domain'] = current_site.domain context['domain_method'] = domain_method context['review_request'] = review_request if review_request.local_site: context['local_site_name'] = review_request.local_site.name text_body = render_to_string(text_template_name, context) html_body = render_to_string(html_template_name, context) base_url = get_server_url(local_site=local_site) headers = MultiValueDict({ 'X-ReviewBoard-URL': [base_url], 'X-ReviewRequest-URL': [urljoin(base_url, review_request.get_absolute_url())], 'X-ReviewGroup': [', '.join(group.name for group in review_request.target_groups.all())], }) if extra_headers: if not isinstance(extra_headers, MultiValueDict): extra_headers = MultiValueDict( (key, [value]) for (key, value) in six.iteritems(extra_headers) ) headers.update(extra_headers) if review_request.repository: headers['X-ReviewRequest-Repository'] = review_request.repository.name latest_diffset = review_request.get_latest_diffset() if latest_diffset: modified_files = set() for filediff in latest_diffset.files.all(): if filediff.deleted or filediff.copied or filediff.moved: modified_files.add(filediff.source_file) if filediff.is_new or filediff.copied or filediff.moved: modified_files.add(filediff.dest_file) for filename in modified_files: headers.appendlist('X-ReviewBoard-Diff-For', filename) sender = None if settings.DEFAULT_FROM_EMAIL: sender = build_email_address(user.get_full_name(), settings.DEFAULT_FROM_EMAIL) if sender == from_email: # RFC 2822 states that we should only include Sender if the # two are not equal. sender = None message = EmailMessage(subject.strip(), text_body.encode('utf-8'), html_body.encode('utf-8'), from_email, sender, list(to_field), list(cc_field), in_reply_to, headers) try: message.send() except Exception: logging.exception("Error sending e-mail notification with subject " "'%s' on behalf of '%s' to '%s'", subject.strip(), from_email, ','.join(list(to_field) + list(cc_field))) return message.message_id def mail_review_request(review_request, user, changedesc=None, close_type=None): """Send an e-mail representing the supplied review request. Args: review_request (reviewboard.reviews.models.ReviewRequest): The review request to send an e-mail about. user (django.contrib.auth.models.User): The user who triggered the e-mail (i.e., they published or closed the review request). changedesc (reviewboard.changedescs.models.ChangeDescription): An optional change description showing what has changed in the review request, possibly with explanatory text from the submitter. This is created when saving a draft on a public review request and will be ``None`` when publishing initially. This is used by the template to add contextual (updated) flags to inform people what has changed. close_type (unicode): How the review request was closed or ``None`` if it was published. If this is not ``None`` it must be one of :py:attr:`~reviewboard.reviews.models.ReviewRequest.SUBMITTED` or :py:attr:`~reviewboard.reviews.models.ReviewRequest.DISCARDED`. """ # If the review request is not yet public or has been discarded, don't send # any mail. Relax the "discarded" rule when e-mails are sent on closing # review requests if (not review_request.public or (not close_type and review_request.status == 'D')): return summary = _ensure_unicode(review_request.summary) subject = "Review Request %d: %s" % (review_request.display_id, summary) reply_message_id = None if review_request.email_message_id: # Fancy quoted "replies" subject = "Re: " + subject reply_message_id = review_request.email_message_id extra_recipients = review_request.participants else: extra_recipients = None extra_context = {} if close_type: changedesc = review_request.changedescs.filter(public=True).latest() limit_recipients_to = None if changedesc: extra_context['change_text'] = changedesc.text extra_context['changes'] = changedesc.fields_changed fields_changed = changedesc.fields_changed changed_field_names = set(fields_changed.keys()) if (changed_field_names and changed_field_names.issubset(['target_people', 'target_groups'])): # If the only changes are to the target reviewers, try to send a # much more targeted e-mail (rather than sending it out to # everyone, only send it to new people). limit_recipients_to = set() if 'target_people' in changed_field_names: user_pks = [ item[2] for item in fields_changed['target_people']['added'] ] limit_recipients_to.update(User.objects.filter( pk__in=user_pks)) if 'target_groups' in changed_field_names: group_pks = [ item[2] for item in fields_changed['target_groups']['added'] ] limit_recipients_to.update(Group.objects.filter( pk__in=group_pks)) submitter = review_request.submitter to_field, cc_field = build_recipients(submitter, review_request, extra_recipients, limit_recipients_to) extra_filter_kwargs = {} if close_type: signal = review_request_closed extra_filter_kwargs['close_type'] = close_type else: signal = review_request_published to_field, cc_field = filter_email_recipients_from_hooks( to_field, cc_field, signal, review_request=review_request, user=user, **extra_filter_kwargs) review_request.time_emailed = timezone.now() review_request.email_message_id = \ send_review_mail(review_request.submitter, review_request, subject, reply_message_id, to_field, cc_field, 'notifications/review_request_email.txt', 'notifications/review_request_email.html', extra_context) review_request.save() def mail_review(review, user, to_submitter_only): """Send an e-mail representing the supplied review. Args: review (reviewboard.reviews.models.Review): The review to send an e-mail about. to_submitter_only (bool): Determines if the review is to the submitter only or not. """ review_request = review.review_request if not review_request.public: return review.ordered_comments = \ review.comments.order_by('filediff', 'first_line') extra_context = { 'user': review.user, 'review': review, } extra_headers = {} if review.ship_it: extra_headers['X-ReviewBoard-ShipIt'] = '1' if review.ship_it_only: extra_headers['X-ReviewBoard-ShipIt-Only'] = '1' has_error, extra_context['comment_entries'] = \ build_diff_comment_fragments( review.ordered_comments, extra_context, "notifications/email_diff_comment_fragment.html") reviewer = review.user limit_to=None if to_submitter_only: limit_to = set([review_request.submitter, review.user]) to_field, cc_field = build_recipients(reviewer, review_request, limit_recipients_to=limit_to) to_field, cc_field = filter_email_recipients_from_hooks( to_field, cc_field, review_published, review=review, user=user, review_request=review_request) summary = _ensure_unicode(review_request.summary) review.email_message_id = send_review_mail( reviewer, review_request, ('Re: Review Request %d: %s' % (review_request.display_id, summary)), review_request.email_message_id, to_field, cc_field, 'notifications/review_email.txt', 'notifications/review_email.html', extra_context, extra_headers=extra_headers) review.time_emailed = timezone.now() review.save() def mail_reply(reply, user): """Send an e-mail representing the supplied reply to a review. Args: reply (reviewboard.reviews.models.Review): The review reply to send an e-mail about. """ review = reply.base_reply_to review_request = review.review_request if not review_request.public: return extra_context = { 'user': reply.user, 'review': review, 'reply': reply, } has_error, extra_context['comment_entries'] = \ build_diff_comment_fragments( reply.comments.order_by('filediff', 'first_line'), extra_context, "notifications/email_diff_comment_fragment.html") reviewer = reply.user to_field, cc_field = build_recipients(reviewer, review_request, review_request.participants) to_field, cc_field = filter_email_recipients_from_hooks( to_field, cc_field, reply_published, reply=reply, user=user, review=review, review_request=review_request) summary = _ensure_unicode(review_request.summary) reply.email_message_id = send_review_mail( user, review_request, ('Re: Review Request %d: %s' % (review_request.display_id, summary)), review.email_message_id, to_field, cc_field, 'notifications/reply_email.txt', 'notifications/reply_email.html', extra_context) reply.time_emailed = timezone.now() reply.save() def mail_new_user(user): """Send an e-mail to administrators for newly registered users. Args: user (django.contrib.auth.models.User): The user to send an e-mail about. """ current_site = Site.objects.get_current() siteconfig = current_site.config.get_current() domain_method = siteconfig.get("site_domain_method") subject = "New Review Board user registration for %s" % user.username from_email = get_email_address_for_user(user) context = { 'domain': current_site.domain, 'domain_method': domain_method, 'user': user, 'user_url': reverse('admin:auth_user_change', args=(user.id,)) } text_message = render_to_string('notifications/new_user_email.txt', context) html_message = render_to_string('notifications/new_user_email.html', context) message = EmailMessage(subject.strip(), text_message, html_message, settings.SERVER_EMAIL, settings.SERVER_EMAIL, [build_email_address(*a) for a in settings.ADMINS], None, None) try: message.send() except Exception as e: logging.error("Error sending e-mail notification with subject '%s' on " "behalf of '%s' to admin: %s", subject.strip(), from_email, e, exc_info=1) def filter_email_recipients_from_hooks(to_field, cc_field, signal, **kwargs): """Filter the e-mail recipients through configured e-mail hooks. Args: to_field (set): The original To field of the e-mail, as a set of :py:class:`Users <django.contrib.auth.models.User>` and :py:class:`Groups <reviewboard.reviews.models.Group>`. cc_field (set): The original CC field of the e-mail, as a set of :py:class:`Users <django.contrib.auth.models.User>` and :py:class:`Groups <reviewboard.reviews.models.Group>`. signal (django.dispatch.Signal): The signal that triggered the e-mail. **kwargs (dict): Extra keyword arguments to pass to the e-mail hook. Returns: tuple: A 2-tuple of the To field and the CC field, as sets of :py:class:`Users <django.contrib.auth.models.User>` and :py:class:`Groups <reviewboard.reviews.models.Group>`. """ if signal in _hooks: for hook in _hooks[signal]: to_field = hook.get_to_field(to_field, **kwargs) cc_field = hook.get_cc_field(cc_field, **kwargs) return to_field, cc_field # Fixes bug #3613 _old_header_init = email.header.Header.__init__ def _unified_header_init(self, *args, **kwargs): kwargs['continuation_ws'] = b' ' _old_header_init(self, *args, **kwargs) email.header.Header.__init__ = _unified_header_init
beol/reviewboard
reviewboard/notifications/email.py
Python
mit
32,206
// Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2013-2014 Dogecoin Developers // Copyright (c) 2013-2014 Team Mooncoin // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CHECKPOINT_H #define BITCOIN_CHECKPOINT_H #include <map> class uint256; class CBlockIndex; /** Block-chain checkpoints are compiled-in sanity checks. * They are updated every release or three. */ namespace Checkpoints { // Returns true if block passes checkpoint checks bool CheckBlock(int nHeight, const uint256& hash); // Return conservative estimate of total number of blocks, 0 if unknown int GetTotalBlocksEstimate(); // Returns last CBlockIndex* in mapBlockIndex that is a checkpoint CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex); double GuessVerificationProgress(CBlockIndex *pindex); } #endif
mooncoin-project/mooncoin-landann
src/checkpoints.h
C
mit
974
<?php class PWS_Guestbook_Model_Session extends Mage_Core_Model_Session_Abstract { public function __construct() { $this->init('pws_questbook'); } }
dmsherazi/magento-product-qa
app/code/community/PWS/ProductQA/Model/Session.php
PHP
mit
169
--- title: لمزيد من الدرس date: 08/02/2019 --- لم يُكشف لنا مَن بالتحديد سيكون في تلك المجموعة. فهويتهم أحدُ الأسرار التي احتفظ بها الرب لنفسه (تثنية ٢٩: ٢٩). ولن يَكْشف لنا عمَّن سيكون جزءًا من هذه المجموعة الخاصة بالقديسين المخلصين إلا المستقبل. وفيما يتعلق بهذا السر، حُذرنا بالتحذير الآتي: «يقول المسيح أنه سيكون في الكنيسة أولئك الذين سيأتون بخرافات ومزاعم، في حين أن الله قدم حقائق عظيمة مهذّبة ومشرّفة يجب أن تحفظ أبدًا في ذاكرتنا. وعندما يتبع الناس هذه النظرية وتلك النظرية، عندما يقودهم فضولهم لمعرفة أمرًا ليس ضروريًا لهم معرفته، لا يقودهم الله في ذلك. فخطته ليست في أن يأتي شعبه بأمرٍ عليهم افتراضي، أمر لا تُعلّمه الكلمة. وإرادته ليست في أن يدخلوا في صراع حول أسئلة لن تساعدهم روحيًا، نحو: ممّن سيتكون المئة والأربعة والأربعين ألفًا؟ فهذه سيعرفها مختارو الله وشيكًا دون تساؤل» (روح النبوة، Selected Messages، مجلد ١، صفحة ١٧٤). **أسئلة للنقاش:** `١. فكّر في النصيحة التالية: «دعنا نكافح بكل ما أتانا الله من قوة كي نكون من ضمن المئة والأربعة والأربعين ألفًا» (تعليقات روح النبوة، SDA Bible Commentary، مجلد ٧، صفحة ٩٧٠). كيف لنا أن نطبق هذه الكلمات؟ كيف يؤثر هذا الكفاح على قراراتك اليومية؟` `٢. أحد الصفات المهمة المميزة للمئة والأربعة والأربعين ألف قديسًا في نهاية الزمان هي الترنم بالترنيمة الجديدة. وهي ترنيمة لا يستطيع أن يرنمها إلا المئة والأربعة والأربعون ألفًا لأنها ترنيمة الاختبار – اختبار لم تختبره أي مجموعة أخرى قط في التاريخ (رؤيا ١٤: ٣، ٤؛ رؤيا ١٥: ٢، ٣). إذ تفكر في حياتك الخاصة، كيف تعكس مسيرتك الروحية الحالية ترنيمة اختبار جديد مع الله؟ أم هل تعكس حياتك قصصك الماضية التافهة عن أعمال الله في حياتك، مفتقرةً إلى براهين التكريس الحاضر؟ أي تغييرات يمكنك صنعها الآن لتساعدك على إعادة تكريس حياتك له؟` `٣. ما هو الفرق بين المعرفة عن المسيح ومعرفته الحقيقية؟ إذا سألك أحدهم: «كيف تصف المسيح؟»، ماذا ستكون إجابتك، ولماذا؟`
PrJared/sabbath-school-lessons
src/ar/2019-01/06/07.md
Markdown
mit
3,101
--- title: قناعت date: 26/03/2018 --- `«من به احتیاجات شخصی خود اشاره نمی کنم، زیرا یاد گرفته ام در هر وضعی که باشم، قناعت کنم» (فیلیپیان باب ۴ آیه ۱۱). اگر قرار باشد ما در هر وضعی که هستیم، قناعت کنیم، این قناعت در نهایت باید از کجا بیاید؟` پولس زمانی که برای تیموتائوس می نویسد، گروه ناخوشایندی از مردم را توصیف می کند «که گمان می کنند خدایی بودن وسیله ای است برای کسب منفعت» (اول تیموتائوس باب ۶ آیه ۵). چه توصیف بهتری برای برخی از گویندگان تلویزیون می تواند وجود داشته باشد؟ آنها با گفتن این به شنوندگان خود که اگر آنها با ایمان باشند (و این «ایمانداری» شامل حمایت از خدمات میسیونری ایشان می شود)، آن شنوندگان ثروتمند خواهند شد. برابر قرار دادن ثروت با ایمانداری، شکل و صورتی دیگر از مادیگرایی است که تحت پوشش مسیحیت خود را ظاهر نموده است. واقعیت این است که خداگونه بودن و تعبد هیچ ربطی به ثروت ندارد. اگر چنین بود، برخی از خبیث ترین افراد باید خداپرست تلقی می شدند زیرا جزء ثروتمندان هستند. در عوض، پولس پاسخ داد که «خداپرستی همراه با قناعت، منفعت بسیار دارد» (اول تیموتائوس باب ۶ آیه ۶). خداپرستی به همراه قناعت در هر شرایطی، بهترین نوع ثروت است زیرا فیض خدا بسیار با ارزش تر از منفعت مالی می باشد. از این رو، ما باید با «خوراک و پوشاک» (اول تیموتائوس باب ۶ آیه ۸) قانع باشیم. در پایان، ما هر چقدر دارایی داشته باشیم، اگر تمایل به اینگونه فکر کردن داشته باشیم، همیشه چیزهای بیشتری برای گرفتن خواهد بود. > <p></p> > «قناعت در هر شرایطی، یک هنر بزرگ و راز روحانی می باشد. باید آموخته شود و به عنوان یک راز آموخته شود.... قناعت مسیحی، در قابی دلپذیر، درونی، آرام و بخشنده روح جای دارد که آزادانه تسلیم خدا می شود و در هر شرایطی آزادانه در برابر حکمت خدا و حس پدرانه محظوظ گردیده وسر فرود می آورد.... مانند روغن و مرهمی گرانبها و تسکین دهنده و مفید برای دل نگرانان در زمان ها و شرایط دشوار می باشد.» جرمایا بورو، Jeremiah Burroughs, The Rare Jewel of Christian Contentment, pp. 1, 3 `رومیان باب ۸ آیه ۲۸، عبرانیان باب ۱۳ آیه ۵ و فیلیپیان باب ۴ آیات ۴ تا ۱۳ را بخوانید. ما در اینجا چه چیزی می توانیم بیابیم که به ما در داشتن زندگی قانع کمک کند؟`
PrJared/sabbath-school-lessons
src/fa/2018-01/13/03.md
Markdown
mit
3,381
<?php require_once getenv( 'WP_TESTS_DIR' ) . '/includes/functions.php'; function _manually_load_plugin() { require dirname( __FILE__ ) . '/../wpthumb.php'; } tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); require getenv( 'WP_TESTS_DIR' ) . '/includes/bootstrap.php'; class WP_Thumb_UnitTestCase extends WP_UnitTestCase { function assertImageRGBAtPoint( $image_path, $point, $color ) { $im = imagecreatefrompng( $image_path ); $rgb = imagecolorat($im, $point[0], $point[1]); $colors = imagecolorsforindex($im, $rgb); $colors = array( $colors['red'], $colors['green'], $colors['blue'] ); //hm_log( $colors ); $this->assertEquals( $colors, $color ); } function assertImageAlphaAtPoint( $image_path, $point, $alpha ) { $im = imagecreatefrompng( $image_path ); $rgb = imagecolorat($im, $point[0], $point[1]); $colors = imagecolorsforindex($im, $rgb); $this->assertEquals( $colors['alpha'], $alpha ); } }
shout-reverie/thesixthlie-dev
www/wordpress/wp-content/plugins/hammy/WPThumb/tests/bootstrap.php
PHP
mit
954
require 'httparty' require 'uri' module Dragonfly module DataStorage #class Forbidden < StandardError; end class RemoteDataStore include Configurable configurable_attr :url_host def store(temp_object, opts={}) raise "Sorry friend, this datastore is read-only." end def retrieve(uid) response = HTTParty.get URI::join(url_host.to_s, uid).to_s, :timeout => 3 unless response.ok? #raise Forbidden if response.code == 403 raise DataNotFound end content = response.body extra_data = {} [ content, # either a File, String or Tempfile extra_data # Hash with optional keys :meta, :name, :format ] end def destroy(uid) raise "Sorry friend, this datastore is read-only." end end end end
allibubba/magickly
lib/dragonfly/data_storage/remote_data_store.rb
Ruby
mit
879
// // Copyright (c) 2015 IronCore Labs // package com.ironcorelabs.davenport import scalaz._, Scalaz._, scalaz.concurrent.Task import db._ import datastore.MemDatastore import syntax._ class DBSpec extends TestBase { "DB" should { "fail lifting none into dbprog" in { val datastore = MemDatastore.empty val error = liftIntoDBProg(None, ValueNotFound(Key("blah"))).execute(datastore).run.leftValue error.message should include("blah") } "fail with a GeneralError when lifting none into dbprog with message" in { val datastore = MemDatastore.empty val error = datastore.execute(liftIntoDBProg(None, "blah")).run.leftValue error shouldBe an[GeneralError] error.message should include("blah") } "fail with a GeneralError when lifting a throwable into a DBProg" in { val datastore = MemDatastore.empty val ex = new Exception("I am an exception hear me roar!") val error = datastore.execute(liftIntoDBProg(ex.left)).run.leftValue error shouldBe an[GeneralError] error.message shouldBe ex.getMessage } "fail with a GeneralError when lifting a DBError into a DBProg" in { val datastore = MemDatastore.empty val error = liftDisjunction(ValueNotFound(Key("blah")).left).execute(datastore).run.leftValue error.message should include("blah") } } }
BobWall23/davenport
src/test/scala/com/ironcorelabs/davenport/DBSpec.scala
Scala
mit
1,367
package org.multibit.hd.testing.hardware_wallet_fixtures.trezor; import com.google.common.base.Optional; import com.google.protobuf.Message; import org.multibit.hd.hardware.core.HardwareWalletClient; import org.multibit.hd.hardware.core.events.MessageEvent; import org.multibit.hd.hardware.core.events.MessageEventType; import org.multibit.hd.hardware.core.messages.Features; import org.multibit.hd.hardware.core.messages.HardwareWalletMessage; import org.multibit.hd.hardware.trezor.clients.AbstractTrezorHardwareWalletClient; import org.multibit.hd.testing.message_event_fixtures.MessageEventFixtures; import org.multibit.hd.testing.hardware_wallet_fixtures.AbstractHardwareWalletFixture; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * <p>Hardware wallet fixture to provide the following to FEST requirements:</p> * <ul> * <li>Low level events and client handling</li> * </ul> * * <p>Emulates an attached initialised Trezor during the re-attach use case</p> * * <p>Presents a PIN request on "get cipher key"</p> * @since 0.0.1 *   */ public class TrezorInitialisedReattachedFixture extends AbstractHardwareWalletFixture { public TrezorInitialisedReattachedFixture(String name) { super(name); } @Override public void setUpClient() { client = mock(AbstractTrezorHardwareWalletClient.class); when(client.name()).thenReturn(name); when(client.attach()).thenReturn(true); when(client.verifyFeatures(any(Features.class))).thenReturn(true); mockConnect(client); mockInitialise(client); mockDeterministicHierarchy(client); mockPinMatrixAck(client); mockGetCipherKey(client); } @Override public void setUpMessageQueue() { messageEvents.clear(); // Standard client will start as attached // Trezor has been detached final MessageEvent event1 = new MessageEvent( MessageEventType.DEVICE_DETACHED, Optional.<HardwareWalletMessage>absent(), Optional.<Message>absent(), name ); messageEvents.add(event1); // Trezor has been attached final MessageEvent event2 = new MessageEvent( MessageEventType.DEVICE_ATTACHED, Optional.<HardwareWalletMessage>absent(), Optional.<Message>absent(), name ); messageEvents.add(event2); // ButtonAck -> Cipher key success final MessageEvent event3 = new MessageEvent( MessageEventType.CIPHERED_KEY_VALUE, Optional.<HardwareWalletMessage>of(MessageEventFixtures.newCipheredKeyValue()), Optional.<Message>absent(), name ); messageEvents.add(event3); } /** * <p>Configure for a DEVICE_CONNECTED</p> * <p>Fires low level messages that trigger state changes in the MultiBit Hardware FSM</p> * * @param client The mock client */ private void mockConnect(HardwareWalletClient client) { useConnectWithConnected(client); } /** * <p>Configure for a FEATURES based on the standard features</p> * <p>Fires low level messages that trigger state changes in the MultiBit Hardware FSM</p> * * @param client The mock client */ private void mockInitialise(HardwareWalletClient client) { useInitialiseWithStandardFeatures(client); } /** * <p>Configure for a PUBLIC_KEY message for M</p> * <p>Fires low level messages that trigger state changes in the MultiBit Hardware FSM</p> * * @param client The mock client */ @SuppressWarnings("unchecked") private void mockDeterministicHierarchy(HardwareWalletClient client) { useDeterministicHierarchyNoPIN(client); } /** * <p>Configure for a CIPHER_KEY value</p> * <p>Fires low level messages that trigger state changes in the MultiBit Hardware FSM</p> * * @param client The mock client */ private void mockGetCipherKey(HardwareWalletClient client) { useGetCipherKeyWithPIN(client); } /** * <p>Configure for PIN matrix responses when unlocking a wallet (no previous create)</p> * <ol> * <li>"1234" is a correct PIN, "6789" will trigger FAILURE</li> * <li>First call triggers a "protect call" BUTTON_REQUEST</li> * <li>Subsequent calls do nothing so rely on event fixtures to provide use case context</li> * </ol> * <p>Fires low level messages that trigger state changes in the MultiBit Hardware FSM</p> * * @param client The mock client */ private void mockPinMatrixAck(HardwareWalletClient client) { // Failed PIN usePinMatrixAckWithProtect(client); } }
akonring/multibit-hd-modified
mbhd-swing/src/test/java/org/multibit/hd/testing/hardware_wallet_fixtures/trezor/TrezorInitialisedReattachedFixture.java
Java
mit
4,550
# Video.JS HLS Live ## Brightcove Service Differences: - Brightcove uses the Zencoder HLS Live API. - Once ingest begins, approximately 50 seconds later the original manifest is available. - I have not seen any ability to enforce a sliding window, so I believe Brightcove Live HLS serves all available segments on a continuously growing manifest. - One minute after last disconnect from the ingest stream, the event is considered complete and the final manifest delivered. - The final manifest will be different in two distinct ways, it will include the `EXT-X-ENDLIST` tag notifying all connected clients that the live stream has concluded and is now VOD. It will also contain a custom `ZEN-TOTAL-DURATION`: tag with representing the total amount of recorded time in seconds. ## Akamai Service Differences: - Akamai only serves HLS Live off of Akamai HD2 endpoints. - These vary from their HDS counterparts by url syntax. - ```<host> /i/``` vs.``` <host> /z/``` for HDS - `master.m3u8` vs.`manifest.f4m` for HDS - Their endpoints are difficult to arrange CORS configurations on. - Akamai manifests span the gamut of known HLS tags, both supported and unsupported by our plugin. ## Once Service Differences: - Once manifests tend to include the use of `EXT-X-DISCONTINUITY` tags which are unsupported to date. - Once streams so far tend to use a different encoding algorithm on their segments which sometime result in a range error during transmuxing. # Live HLS Research This document is a collection of notes on Live HLS implementations in the wild. There are two varieties of Live HLS. In the first, playlists are persistent and strictly appended to. In the alternative form, the maximum number of segments in a playlist is relatively stable and an old segment is removed every time a new segment becomes available. On iOS devices, both stream types report a duration of `Infinity`. The `currentTime` is equal to the amount of the stream that has been played back on the device. ## Akamai HD2 ## OnceLIVE "Sliding window" live streams. ### Variant Playlists Once variant playlists look like standard HLS variant playlists. ### Media Playlists OnceLIVE uses "sliding window" manifests for live playback. The media playlists do not have an `EXT-X-ENDLIST` and don't declare a `EXT-X-PLAYLIST-TYPE`. On first request, the stream media playlist returned four segment URLs with a starting media sequence of one, preceded by a `EXT-X-DISCONTINUITY` tag. As playback progressed, that number grew to 13 segment URLs, at which point it stabilized. That would equate to a steady-state 65 second window at 5 seconds per segment. OnceLive documentation is [available on the Unicorn Media website](http://www.unicornmedia.com/documents/2013/02/oncelive_implementationguide.pdf). Here's a script to quickly parse out segment URLs: ```shell curl $ONCE_MEDIA_PLAYLIST | grep '^http' ``` An example media playlist might look something like this: ```m3u8 #EXTM3U #EXT-X-TARGETDURATION:5 #EXT-X-MEDIA-SEQUENCE:3 #EXTINF:5,3 http://example.com/0/1/content.ts?visitguid=uuid&asseturl=http://once.example.com/asset.lrm&failoverurl=http://example.com/blank.jpg #EXTINF:5,4 http://example.com/1/2/content.ts?visitguid=uuid&asseturl=http://once.example.com/asset.lrm&failoverurl=http://example.com/blank.jpg #EXTINF:5,5 http://example.com/2/3/content.ts?visitguid=uuid&asseturl=http://once.example.com/asset.lrm&failoverurl=http://example.com/blank.jpg #EXTINF:5,6 http://example.com/3/4/content.ts?visitguid=uuid&asseturl=http://once.example.com/asset.lrm&failoverurl=http://example.com/blank.jpg ``` ## Zencoder Live
Akagi201/web-player
videojs/static/node_modules/videojs-contrib-hls/docs/live.md
Markdown
mit
3,621
module Grafana module Frontend def get_frontend_settings() endpoint = "/api/frontend/settings" @logger.info("Getting frontend settings (GET #{endpoint})") if @debug return get_request(endpoint) end end end
jwroblewski/ruby-grafana-api
lib/grafana/frontend.rb
Ruby
mit
240
<?php /** * LICENSE: Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0. * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * PHP version 5 * * @category Microsoft * * @author Azure PHP SDK <azurephpsdk@microsoft.com> * @copyright 2012 Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * * @link https://github.com/windowsazure/azure-sdk-for-php */ namespace Tests\framework; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; use org\bovigo\vfs\vfsStreamWrapper; /** * Represents virtual file system for testing purpose. * * @category Microsoft * * @author Azure PHP SDK <azurephpsdk@microsoft.com> * @copyright 2012 Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * * @version Release: 0.4.3_2016-05 * * @link https://github.com/windowsazure/azure-sdk-for-php */ class VirtualFileSystem { public static function newFile($contents, $fileName = null, $root = null) { $root = is_null($root) ? 'root' : $root; $fileName = is_null($fileName) ? 'test.txt' : $fileName; vfsStreamWrapper::register(); vfsStreamWrapper::setRoot(new vfsStreamDirectory($root)); $file = vfsStream::newFile($fileName); $file->setContent($contents); vfsStreamWrapper::getRoot()->addChild($file); $virtualPath = vfsStream::url($root.'/'.$fileName); return $virtualPath; } }
yaqiyang/php-sdk-dev
tests/framework/VirtualFileSystem.php
PHP
mit
1,943
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_Json * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Http.php 16541 2009-07-07 06:59:03Z bkarwin $ */ /** * @see Zend_Json_Server_Request */ require_once 'Zend/Json/Server/Request.php'; /** * @category Zend * @package Zend_Json * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Json_Server_Request_Http extends Zend_Json_Server_Request { /** * Raw JSON pulled from POST body * @var string */ protected $_rawJson; /** * Constructor * * Pull JSON request from raw POST body and use to populate request. * * @return void */ public function __construct() { $json = file_get_contents('php://input'); $this->_rawJson = $json; if (!empty($json)) { $this->loadJson($json); } } /** * Get JSON from raw POST body * * @return string */ public function getRawJson() { return $this->_rawJson; } }
vrunoa/examen-fadgut
solucion/library/Zend/Json/Server/Request/Http.php
PHP
mit
1,727
// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. namespace Swagger.Models { using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; /// <summary> /// Describes an Azure Search service and its current state. /// </summary> public partial class SearchServiceResource { /// <summary> /// Initializes a new instance of the SearchServiceResource class. /// </summary> public SearchServiceResource() { CustomInit(); } /// <summary> /// Initializes a new instance of the SearchServiceResource class. /// </summary> /// <param name="id">The resource Id of the Azure Search /// service.</param> /// <param name="name">The name of the Search service.</param> /// <param name="location">The geographic location of the Search /// service.</param> /// <param name="tags">Tags to help categorize the Search service in /// the Azure Portal.</param> public SearchServiceResource(string id = default(string), string name = default(string), string location = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>)) { Id = id; Name = name; Location = location; Tags = tags; CustomInit(); } /// <summary> /// An initialization method that performs custom operations like setting defaults /// </summary> partial void CustomInit(); /// <summary> /// Gets the resource Id of the Azure Search service. /// </summary> [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// <summary> /// Gets or sets the name of the Search service. /// </summary> [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// <summary> /// Gets or sets the geographic location of the Search service. /// </summary> [JsonProperty(PropertyName = "location")] public string Location { get; set; } /// <summary> /// Gets or sets tags to help categorize the Search service in the /// Azure Portal. /// </summary> [JsonProperty(PropertyName = "tags")] public IDictionary<string, string> Tags { get; set; } } }
vishrutshah/autorest
Samples/3a-literate-swagger/Client/Models/SearchServiceResource.cs
C#
mit
2,556
/*================================================================================ code generated by: java2cpp author: Zoran Angelov, mailto://baldzar@gmail.com class: android.webkit.WebStorage ================================================================================*/ #ifndef J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_ANDROID_WEBKIT_WEBSTORAGE_HPP_DECL #define J2CPP_ANDROID_WEBKIT_WEBSTORAGE_HPP_DECL namespace j2cpp { namespace android { namespace webkit { class ValueCallback; } } } namespace j2cpp { namespace java { namespace lang { class String; } } } namespace j2cpp { namespace java { namespace lang { class Object; } } } #include <android/webkit/ValueCallback.hpp> #include <java/lang/Object.hpp> #include <java/lang/String.hpp> namespace j2cpp { namespace android { namespace webkit { class WebStorage; namespace WebStorage_ { class QuotaUpdater; class QuotaUpdater : public object<QuotaUpdater> { public: J2CPP_DECLARE_CLASS J2CPP_DECLARE_METHOD(0) explicit QuotaUpdater(jobject jobj) : object<QuotaUpdater>(jobj) { } operator local_ref<java::lang::Object>() const; void updateQuota(jlong); }; //class QuotaUpdater } //namespace WebStorage_ class WebStorage : public object<WebStorage> { public: J2CPP_DECLARE_CLASS J2CPP_DECLARE_METHOD(0) J2CPP_DECLARE_METHOD(1) J2CPP_DECLARE_METHOD(2) J2CPP_DECLARE_METHOD(3) J2CPP_DECLARE_METHOD(4) J2CPP_DECLARE_METHOD(5) J2CPP_DECLARE_METHOD(6) J2CPP_DECLARE_METHOD(7) typedef WebStorage_::QuotaUpdater QuotaUpdater; explicit WebStorage(jobject jobj) : object<WebStorage>(jobj) { } operator local_ref<java::lang::Object>() const; WebStorage(); void getOrigins(local_ref< android::webkit::ValueCallback > const&); void getUsageForOrigin(local_ref< java::lang::String > const&, local_ref< android::webkit::ValueCallback > const&); void getQuotaForOrigin(local_ref< java::lang::String > const&, local_ref< android::webkit::ValueCallback > const&); void setQuotaForOrigin(local_ref< java::lang::String > const&, jlong); void deleteOrigin(local_ref< java::lang::String > const&); void deleteAllData(); static local_ref< android::webkit::WebStorage > getInstance(); }; //class WebStorage } //namespace webkit } //namespace android } //namespace j2cpp #endif //J2CPP_ANDROID_WEBKIT_WEBSTORAGE_HPP_DECL #else //J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_ANDROID_WEBKIT_WEBSTORAGE_HPP_IMPL #define J2CPP_ANDROID_WEBKIT_WEBSTORAGE_HPP_IMPL namespace j2cpp { android::webkit::WebStorage_::QuotaUpdater::operator local_ref<java::lang::Object>() const { return local_ref<java::lang::Object>(get_jobject()); } void android::webkit::WebStorage_::QuotaUpdater::updateQuota(jlong a0) { return call_method< android::webkit::WebStorage_::QuotaUpdater::J2CPP_CLASS_NAME, android::webkit::WebStorage_::QuotaUpdater::J2CPP_METHOD_NAME(0), android::webkit::WebStorage_::QuotaUpdater::J2CPP_METHOD_SIGNATURE(0), void >(get_jobject(), a0); } J2CPP_DEFINE_CLASS(android::webkit::WebStorage_::QuotaUpdater,"android/webkit/WebStorage$QuotaUpdater") J2CPP_DEFINE_METHOD(android::webkit::WebStorage_::QuotaUpdater,0,"updateQuota","(J)V") android::webkit::WebStorage::operator local_ref<java::lang::Object>() const { return local_ref<java::lang::Object>(get_jobject()); } android::webkit::WebStorage::WebStorage() : object<android::webkit::WebStorage>( call_new_object< android::webkit::WebStorage::J2CPP_CLASS_NAME, android::webkit::WebStorage::J2CPP_METHOD_NAME(0), android::webkit::WebStorage::J2CPP_METHOD_SIGNATURE(0) >() ) { } void android::webkit::WebStorage::getOrigins(local_ref< android::webkit::ValueCallback > const &a0) { return call_method< android::webkit::WebStorage::J2CPP_CLASS_NAME, android::webkit::WebStorage::J2CPP_METHOD_NAME(1), android::webkit::WebStorage::J2CPP_METHOD_SIGNATURE(1), void >(get_jobject(), a0); } void android::webkit::WebStorage::getUsageForOrigin(local_ref< java::lang::String > const &a0, local_ref< android::webkit::ValueCallback > const &a1) { return call_method< android::webkit::WebStorage::J2CPP_CLASS_NAME, android::webkit::WebStorage::J2CPP_METHOD_NAME(2), android::webkit::WebStorage::J2CPP_METHOD_SIGNATURE(2), void >(get_jobject(), a0, a1); } void android::webkit::WebStorage::getQuotaForOrigin(local_ref< java::lang::String > const &a0, local_ref< android::webkit::ValueCallback > const &a1) { return call_method< android::webkit::WebStorage::J2CPP_CLASS_NAME, android::webkit::WebStorage::J2CPP_METHOD_NAME(3), android::webkit::WebStorage::J2CPP_METHOD_SIGNATURE(3), void >(get_jobject(), a0, a1); } void android::webkit::WebStorage::setQuotaForOrigin(local_ref< java::lang::String > const &a0, jlong a1) { return call_method< android::webkit::WebStorage::J2CPP_CLASS_NAME, android::webkit::WebStorage::J2CPP_METHOD_NAME(4), android::webkit::WebStorage::J2CPP_METHOD_SIGNATURE(4), void >(get_jobject(), a0, a1); } void android::webkit::WebStorage::deleteOrigin(local_ref< java::lang::String > const &a0) { return call_method< android::webkit::WebStorage::J2CPP_CLASS_NAME, android::webkit::WebStorage::J2CPP_METHOD_NAME(5), android::webkit::WebStorage::J2CPP_METHOD_SIGNATURE(5), void >(get_jobject(), a0); } void android::webkit::WebStorage::deleteAllData() { return call_method< android::webkit::WebStorage::J2CPP_CLASS_NAME, android::webkit::WebStorage::J2CPP_METHOD_NAME(6), android::webkit::WebStorage::J2CPP_METHOD_SIGNATURE(6), void >(get_jobject()); } local_ref< android::webkit::WebStorage > android::webkit::WebStorage::getInstance() { return call_static_method< android::webkit::WebStorage::J2CPP_CLASS_NAME, android::webkit::WebStorage::J2CPP_METHOD_NAME(7), android::webkit::WebStorage::J2CPP_METHOD_SIGNATURE(7), local_ref< android::webkit::WebStorage > >(); } J2CPP_DEFINE_CLASS(android::webkit::WebStorage,"android/webkit/WebStorage") J2CPP_DEFINE_METHOD(android::webkit::WebStorage,0,"<init>","()V") J2CPP_DEFINE_METHOD(android::webkit::WebStorage,1,"getOrigins","(Landroid/webkit/ValueCallback;)V") J2CPP_DEFINE_METHOD(android::webkit::WebStorage,2,"getUsageForOrigin","(Ljava/lang/String;Landroid/webkit/ValueCallback;)V") J2CPP_DEFINE_METHOD(android::webkit::WebStorage,3,"getQuotaForOrigin","(Ljava/lang/String;Landroid/webkit/ValueCallback;)V") J2CPP_DEFINE_METHOD(android::webkit::WebStorage,4,"setQuotaForOrigin","(Ljava/lang/String;J)V") J2CPP_DEFINE_METHOD(android::webkit::WebStorage,5,"deleteOrigin","(Ljava/lang/String;)V") J2CPP_DEFINE_METHOD(android::webkit::WebStorage,6,"deleteAllData","()V") J2CPP_DEFINE_METHOD(android::webkit::WebStorage,7,"getInstance","()Landroid/webkit/WebStorage;") } //namespace j2cpp #endif //J2CPP_ANDROID_WEBKIT_WEBSTORAGE_HPP_IMPL #endif //J2CPP_INCLUDE_IMPLEMENTATION
seem-sky/ph-open
proj.android/jni/puzzleHero/platforms/android-8/android/webkit/WebStorage.hpp
C++
mit
7,108
module.exports = require('regenerate')().addRange(0x700, 0x70D).addRange(0x70F, 0x74A).addRange(0x74D, 0x74F).addRange(0x860, 0x86A);
Engineering-Robert/personal-website
plugins/gatsby-plugin-feed-custom/node_modules/regenerate-unicode-properties/Script/Syriac.js
JavaScript
mit
134
<?php /** * Piwik - free/libre analytics platform * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * */ namespace Piwik; use Exception; /** * Singleton that provides read & write access to Piwik's INI configuration. * * This class reads and writes to the `config/config.ini.php` file. If config * options are missing from that file, this class will look for their default * values in `config/global.ini.php`. * * ### Examples * * **Getting a value:** * * // read the minimum_memory_limit option under the [General] section * $minValue = Config::getInstance()->General['minimum_memory_limit']; * * **Setting a value:** * * // set the minimum_memory_limit option * Config::getInstance()->General['minimum_memory_limit'] = 256; * Config::getInstance()->forceSave(); * * **Setting an entire section:** * * Config::getInstance()->MySection = array('myoption' => 1); * Config::getInstance()->forceSave(); * * @method static \Piwik\Config getInstance() */ class Config extends Singleton { const DEFAULT_LOCAL_CONFIG_PATH = '/config/config.ini.php'; const DEFAULT_COMMON_CONFIG_PATH = '/config/common.config.ini.php'; const DEFAULT_GLOBAL_CONFIG_PATH = '/config/global.ini.php'; /** * Contains configuration files values * * @var array */ protected $initialized = false; protected $configGlobal = array(); protected $configLocal = array(); protected $configCommon = array(); protected $configCache = array(); protected $pathGlobal = null; protected $pathCommon = null; protected $pathLocal = null; /** * @var boolean */ protected $isTest = false; /** * Constructor */ public function __construct($pathGlobal = null, $pathLocal = null, $pathCommon = null) { $this->pathGlobal = $pathGlobal ?: self::getGlobalConfigPath(); $this->pathCommon = $pathCommon ?: self::getCommonConfigPath(); $this->pathLocal = $pathLocal ?: self::getLocalConfigPath(); } /** * Returns the path to the local config file used by this instance. * * @return string */ public function getLocalPath() { return $this->pathLocal; } /** * Returns the path to the global config file used by this instance. * * @return string */ public function getGlobalPath() { return $this->pathGlobal; } /** * Returns the path to the common config file used by this instance. * * @return string */ public function getCommonPath() { return $this->pathCommon; } /** * Enable test environment * * @param string $pathLocal * @param string $pathGlobal * @param string $pathCommon */ public function setTestEnvironment($pathLocal = null, $pathGlobal = null, $pathCommon = null, $allowSaving = false) { if (!$allowSaving) { $this->isTest = true; } $this->clear(); $this->pathLocal = $pathLocal ?: Config::getLocalConfigPath(); $this->pathGlobal = $pathGlobal ?: Config::getGlobalConfigPath(); $this->pathCommon = $pathCommon ?: Config::getCommonConfigPath(); $this->init(); // this proxy will not record any data in the production database. // this provides security for Piwik installs and tests were setup. if (isset($this->configGlobal['database_tests']) || isset($this->configLocal['database_tests']) ) { $this->__get('database_tests'); $this->configCache['database'] = $this->configCache['database_tests']; } // Ensure local mods do not affect tests if (empty($pathGlobal)) { $this->configCache['log'] = $this->configGlobal['log']; $this->configCache['Debug'] = $this->configGlobal['Debug']; $this->configCache['mail'] = $this->configGlobal['mail']; $this->configCache['General'] = $this->configGlobal['General']; $this->configCache['Segments'] = $this->configGlobal['Segments']; $this->configCache['Tracker'] = $this->configGlobal['Tracker']; $this->configCache['Deletelogs'] = $this->configGlobal['Deletelogs']; $this->configCache['Deletereports'] = $this->configGlobal['Deletereports']; $this->configCache['Development'] = $this->configGlobal['Development']; } // for unit tests, we set that no plugin is installed. This will force // the test initialization to create the plugins tables, execute ALTER queries, etc. $this->configCache['PluginsInstalled'] = array('PluginsInstalled' => array()); } /** * Returns absolute path to the global configuration file * * @return string */ protected static function getGlobalConfigPath() { return PIWIK_USER_PATH . self::DEFAULT_GLOBAL_CONFIG_PATH; } /** * Returns absolute path to the common configuration file. * * @return string */ public static function getCommonConfigPath() { return PIWIK_USER_PATH . self::DEFAULT_COMMON_CONFIG_PATH; } /** * Returns absolute path to the local configuration file * * @return string */ public static function getLocalConfigPath() { $path = self::getByDomainConfigPath(); if ($path) { return $path; } return PIWIK_USER_PATH . self::DEFAULT_LOCAL_CONFIG_PATH; } private static function getLocalConfigInfoForHostname($hostname) { // Remove any port number to get actual hostname $hostname = Url::getHostSanitized($hostname); $perHostFilename = $hostname . '.config.ini.php'; $pathDomainConfig = PIWIK_USER_PATH . '/config/' . $perHostFilename; return array('file' => $perHostFilename, 'path' => $pathDomainConfig); } public function getConfigHostnameIfSet() { if ($this->getByDomainConfigPath() === false) { return false; } return $this->getHostname(); } public function getClientSideOptions() { $general = $this->General; return array( 'action_url_category_delimiter' => $general['action_url_category_delimiter'], 'autocomplete_min_sites' => $general['autocomplete_min_sites'], 'datatable_export_range_as_day' => $general['datatable_export_range_as_day'], 'datatable_row_limits' => $this->getDatatableRowLimits() ); } /** * @param $general * @return mixed */ private function getDatatableRowLimits() { $limits = $this->General['datatable_row_limits']; $limits = explode(",", $limits); $limits = array_map('trim', $limits); return $limits; } protected static function getByDomainConfigPath() { $host = self::getHostname(); $hostConfig = self::getLocalConfigInfoForHostname($host); if (Filesystem::isValidFilename($hostConfig['file']) && file_exists($hostConfig['path']) ) { return $hostConfig['path']; } return false; } /** * Returns the hostname of the current request (without port number) * * @return string */ public static function getHostname() { // Check trusted requires config file which is not ready yet $host = Url::getHost($checkIfTrusted = false); // Remove any port number to get actual hostname $host = Url::getHostSanitized($host); return $host; } /** * If set, Piwik will use the hostname config no matter if it exists or not. Useful for instance if you want to * create a new hostname config: * * $config = Config::getInstance(); * $config->forceUsageOfHostnameConfig('piwik.example.com'); * $config->save(); * * @param string $hostname eg piwik.example.com * @return string * @throws \Exception In case the domain contains not allowed characters */ public function forceUsageOfLocalHostnameConfig($hostname) { $hostConfig = static::getLocalConfigInfoForHostname($hostname); if (!Filesystem::isValidFilename($hostConfig['file'])) { throw new Exception('Hostname is not valid'); } $this->pathLocal = $hostConfig['path']; $this->configLocal = array(); $this->initialized = false; return $this->pathLocal; } /** * Returns `true` if the local configuration file is writable. * * @return bool */ public function isFileWritable() { return is_writable($this->pathLocal); } /** * Clear in-memory configuration so it can be reloaded */ public function clear() { $this->configGlobal = array(); $this->configLocal = array(); $this->configCache = array(); $this->initialized = false; } /** * Read configuration from files into memory * * @throws Exception if local config file is not readable; exits for other errors */ public function init() { $this->initialized = true; $reportError = SettingsServer::isTrackerApiRequest(); // read defaults from global.ini.php if (!is_readable($this->pathGlobal) && $reportError) { Piwik_ExitWithMessage(Piwik::translate('General_ExceptionConfigurationFileNotFound', array($this->pathGlobal))); } $this->configGlobal = _parse_ini_file($this->pathGlobal, true); if (empty($this->configGlobal) && $reportError) { Piwik_ExitWithMessage(Piwik::translate('General_ExceptionUnreadableFileDisabledMethod', array($this->pathGlobal, "parse_ini_file()"))); } $this->configCommon = _parse_ini_file($this->pathCommon, true); // Check config.ini.php last $this->checkLocalConfigFound(); $this->configLocal = _parse_ini_file($this->pathLocal, true); if (empty($this->configLocal) && $reportError) { Piwik_ExitWithMessage(Piwik::translate('General_ExceptionUnreadableFileDisabledMethod', array($this->pathLocal, "parse_ini_file()"))); } } public function existsLocalConfig() { return is_readable($this->pathLocal); } public function deleteLocalConfig() { $configLocal = $this->getLocalPath(); unlink($configLocal); } public function checkLocalConfigFound() { if (!$this->existsLocalConfig()) { throw new Exception(Piwik::translate('General_ExceptionConfigurationFileNotFound', array($this->pathLocal))); } } /** * Decode HTML entities * * @param mixed $values * @return mixed */ protected function decodeValues($values) { if (is_array($values)) { foreach ($values as &$value) { $value = $this->decodeValues($value); } return $values; } return html_entity_decode($values, ENT_COMPAT, 'UTF-8'); } /** * Encode HTML entities * * @param mixed $values * @return mixed */ protected function encodeValues($values) { if (is_array($values)) { foreach ($values as &$value) { $value = $this->encodeValues($value); } } else { $values = htmlentities($values, ENT_COMPAT, 'UTF-8'); $values = str_replace('$', '&#36;', $values); } return $values; } /** * Returns a configuration value or section by name. * * @param string $name The value or section name. * @return string|array The requested value requested. Returned by reference. * @throws Exception If the value requested not found in either `config.ini.php` or * `global.ini.php`. * @api */ public function &__get($name) { if (!$this->initialized) { $this->init(); // must be called here, not in init(), since setTestEnvironment() calls init(). (this avoids // infinite recursion) Piwik::postTestEvent('Config.createConfigSingleton', array($this, &$this->configCache, &$this->configLocal)); } // check cache for merged section if (isset($this->configCache[$name])) { $tmp =& $this->configCache[$name]; return $tmp; } $section = $this->getFromGlobalConfig($name); $sectionCommon = $this->getFromCommonConfig($name); if(empty($section) && !empty($sectionCommon)) { $section = $sectionCommon; } elseif(!empty($section) && !empty($sectionCommon)) { $section = $this->array_merge_recursive_distinct($section, $sectionCommon); } if (isset($this->configLocal[$name])) { // local settings override the global defaults $section = $section ? array_merge($section, $this->configLocal[$name]) : $this->configLocal[$name]; } if ($section === null && $name = 'superuser') { $user = $this->getConfigSuperUserForBackwardCompatibility(); return $user; } else if ($section === null) { throw new Exception("Error while trying to read a specific config file entry <strong>'$name'</strong> from your configuration files.</b>If you just completed a Piwik upgrade, please check that the file config/global.ini.php was overwritten by the latest Piwik version."); } // cache merged section for later $this->configCache[$name] = $this->decodeValues($section); $tmp =& $this->configCache[$name]; return $tmp; } /** * @deprecated since version 2.0.4 */ public function getConfigSuperUserForBackwardCompatibility() { try { $db = Db::get(); $user = $db->fetchRow("SELECT login, email, password FROM " . Common::prefixTable("user") . " WHERE superuser_access = 1 ORDER BY date_registered ASC LIMIT 1"); if (!empty($user)) { $user['bridge'] = 1; return $user; } } catch (Exception $e) {} return array(); } public function getFromGlobalConfig($name) { if (isset($this->configGlobal[$name])) { return $this->configGlobal[$name]; } return null; } public function getFromCommonConfig($name) { if (isset($this->configCommon[$name])) { return $this->configCommon[$name]; } return null; } /** * Sets a configuration value or section. * * @param string $name This section name or value name to set. * @param mixed $value * @api */ public function __set($name, $value) { $this->configCache[$name] = $value; } /** * Comparison function * * @param mixed $elem1 * @param mixed $elem2 * @return int; */ public static function compareElements($elem1, $elem2) { if (is_array($elem1)) { if (is_array($elem2)) { return strcmp(serialize($elem1), serialize($elem2)); } return 1; } if (is_array($elem2)) { return -1; } if ((string)$elem1 === (string)$elem2) { return 0; } return ((string)$elem1 > (string)$elem2) ? 1 : -1; } /** * Compare arrays and return difference, such that: * * $modified = array_merge($original, $difference); * * @param array $original original array * @param array $modified modified array * @return array differences between original and modified */ public function array_unmerge($original, $modified) { // return key/value pairs for keys in $modified but not in $original // return key/value pairs for keys in both $modified and $original, but values differ // ignore keys that are in $original but not in $modified return array_udiff_assoc($modified, $original, array(__CLASS__, 'compareElements')); } /** * Dump config * * @param array $configLocal * @param array $configGlobal * @param array $configCommon * @param array $configCache * @return string */ public function dumpConfig($configLocal, $configGlobal, $configCommon, $configCache) { $dirty = false; $output = "; <?php exit; ?> DO NOT REMOVE THIS LINE\n"; $output .= "; file automatically generated or modified by Piwik; you can manually override the default values in global.ini.php by redefining them in this file.\n"; if (!$configCache) { return false; } // If there is a common.config.ini.php, this will ensure config.ini.php does not duplicate its values if(!empty($configCommon)) { $configGlobal = $this->array_merge_recursive_distinct($configGlobal, $configCommon); } if ($configLocal) { foreach ($configLocal as $name => $section) { if (!isset($configCache[$name])) { $configCache[$name] = $this->decodeValues($section); } } } $sectionNames = array_unique(array_merge(array_keys($configGlobal), array_keys($configCache))); foreach ($sectionNames as $section) { if (!isset($configCache[$section])) { continue; } // Only merge if the section exists in global.ini.php (in case a section only lives in config.ini.php) // get local and cached config $local = isset($configLocal[$section]) ? $configLocal[$section] : array(); $config = $configCache[$section]; // remove default values from both (they should not get written to local) if (isset($configGlobal[$section])) { $config = $this->array_unmerge($configGlobal[$section], $configCache[$section]); $local = $this->array_unmerge($configGlobal[$section], $local); } // if either local/config have non-default values and the other doesn't, // OR both have values, but different values, we must write to config.ini.php if (empty($local) xor empty($config) || (!empty($local) && !empty($config) && self::compareElements($config, $configLocal[$section])) ) { $dirty = true; } // no point in writing empty sections, so skip if the cached section is empty if (empty($config)) { continue; } $output .= "[$section]\n"; foreach ($config as $name => $value) { $value = $this->encodeValues($value); if (is_numeric($name)) { $name = $section; $value = array($value); } if (is_array($value)) { foreach ($value as $currentValue) { $output .= $name . "[] = \"$currentValue\"\n"; } } else { if (!is_numeric($value)) { $value = "\"$value\""; } $output .= $name . ' = ' . $value . "\n"; } } $output .= "\n"; } if ($dirty) { return $output; } return false; } /** * Write user configuration file * * @param array $configLocal * @param array $configGlobal * @param array $configCommon * @param array $configCache * @param string $pathLocal * @param bool $clear * * @throws \Exception if config file not writable */ protected function writeConfig($configLocal, $configGlobal, $configCommon, $configCache, $pathLocal, $clear = true) { if ($this->isTest) { return; } $output = $this->dumpConfig($configLocal, $configGlobal, $configCommon, $configCache); if ($output !== false) { $success = @file_put_contents($pathLocal, $output); if (!$success) { throw $this->getConfigNotWritableException(); } } if ($clear) { $this->clear(); } } /** * Writes the current configuration to the **config.ini.php** file. Only writes options whose * values are different from the default. * * @api */ public function forceSave() { $this->writeConfig($this->configLocal, $this->configGlobal, $this->configCommon, $this->configCache, $this->pathLocal); } /** * @throws \Exception */ public function getConfigNotWritableException() { $path = "config/" . basename($this->pathLocal); return new Exception(Piwik::translate('General_ConfigFileIsNotWritable', array("(" . $path . ")", ""))); } /** * array_merge_recursive does indeed merge arrays, but it converts values with duplicate * keys to arrays rather than overwriting the value in the first array with the duplicate * value in the second array, as array_merge does. I.e., with array_merge_recursive, * this happens (documented behavior): * * array_merge_recursive(array('key' => 'org value'), array('key' => 'new value')); * => array('key' => array('org value', 'new value')); * * array_merge_recursive_distinct does not change the datatypes of the values in the arrays. * Matching keys' values in the second array overwrite those in the first array, as is the * case with array_merge, i.e.: * * array_merge_recursive_distinct(array('key' => 'org value'), array('key' => 'new value')); * => array('key' => array('new value')); * * Parameters are passed by reference, though only for performance reasons. They're not * altered by this function. * * @param array $array1 * @param array $array2 * @return array * @author Daniel <daniel (at) danielsmedegaardbuus (dot) dk> * @author Gabriel Sobrinho <gabriel (dot) sobrinho (at) gmail (dot) com> */ function array_merge_recursive_distinct ( array &$array1, array &$array2 ) { $merged = $array1; foreach ( $array2 as $key => &$value ) { if ( is_array ( $value ) && isset ( $merged [$key] ) && is_array ( $merged [$key] ) ) { $merged [$key] = $this->array_merge_recursive_distinct ( $merged [$key], $value ); } else { $merged [$key] = $value; } } return $merged; } }
ACOKing/ArcherSys
piwik/core/Config.php
PHP
mit
23,158
""" Copyright 2011 Jeff Garzik AuthServiceProxy has the following improvements over python-jsonrpc's ServiceProxy class: - HTTP connections persist for the life of the AuthServiceProxy object (if server supports HTTP/1.1) - sends protocol 'version', per JSON-RPC 1.1 - sends proper, incrementing 'id' - sends Basic HTTP authentication headers - parses all JSON numbers that look like floats as Decimal - uses standard Python json lib Previous copyright, from python-jsonrpc/jsonrpc/proxy.py: Copyright (c) 2007 Jan-Klaas Kollhof This file is part of jsonrpc. jsonrpc is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ try: import http.client as httplib except ImportError: import httplib import base64 import decimal import json import logging try: import urllib.parse as urlparse except ImportError: import urlparse USER_AGENT = "AuthServiceProxy/0.1" HTTP_TIMEOUT = 30 log = logging.getLogger("HivemindRPC") class JSONRPCException(Exception): def __init__(self, rpc_error): Exception.__init__(self) self.error = rpc_error def EncodeDecimal(o): if isinstance(o, decimal.Decimal): return round(o, 8) raise TypeError(repr(o) + " is not JSON serializable") class AuthServiceProxy(object): __id_count = 0 def __init__(self, service_url, service_name=None, timeout=HTTP_TIMEOUT, connection=None): self.__service_url = service_url self.__service_name = service_name self.__url = urlparse.urlparse(service_url) if self.__url.port is None: port = 80 else: port = self.__url.port (user, passwd) = (self.__url.username, self.__url.password) try: user = user.encode('utf8') except AttributeError: pass try: passwd = passwd.encode('utf8') except AttributeError: pass authpair = user + b':' + passwd self.__auth_header = b'Basic ' + base64.b64encode(authpair) if connection: # Callables re-use the connection of the original proxy self.__conn = connection elif self.__url.scheme == 'https': self.__conn = httplib.HTTPSConnection(self.__url.hostname, port, None, None, False, timeout) else: self.__conn = httplib.HTTPConnection(self.__url.hostname, port, False, timeout) def __getattr__(self, name): if name.startswith('__') and name.endswith('__'): # Python internal stuff raise AttributeError if self.__service_name is not None: name = "%s.%s" % (self.__service_name, name) return AuthServiceProxy(self.__service_url, name, connection=self.__conn) def __call__(self, *args): AuthServiceProxy.__id_count += 1 log.debug("-%s-> %s %s"%(AuthServiceProxy.__id_count, self.__service_name, json.dumps(args, default=EncodeDecimal))) postdata = json.dumps({'version': '1.1', 'method': self.__service_name, 'params': args, 'id': AuthServiceProxy.__id_count}, default=EncodeDecimal) self.__conn.request('POST', self.__url.path, postdata, {'Host': self.__url.hostname, 'User-Agent': USER_AGENT, 'Authorization': self.__auth_header, 'Content-type': 'application/json'}) response = self._get_response() if response['error'] is not None: raise JSONRPCException(response['error']) elif 'result' not in response: raise JSONRPCException({ 'code': -343, 'message': 'missing JSON-RPC result'}) else: return response['result'] def _batch(self, rpc_call_list): postdata = json.dumps(list(rpc_call_list), default=EncodeDecimal) log.debug("--> "+postdata) self.__conn.request('POST', self.__url.path, postdata, {'Host': self.__url.hostname, 'User-Agent': USER_AGENT, 'Authorization': self.__auth_header, 'Content-type': 'application/json'}) return self._get_response() def _get_response(self): http_response = self.__conn.getresponse() if http_response is None: raise JSONRPCException({ 'code': -342, 'message': 'missing HTTP response from server'}) responsedata = http_response.read().decode('utf8') response = json.loads(responsedata, parse_float=decimal.Decimal) if "error" in response and response["error"] is None: log.debug("<-%s- %s"%(response["id"], json.dumps(response["result"], default=EncodeDecimal))) else: log.debug("<-- "+responsedata) return response
bitcoin-hivemind/hivemind
qa/rpc-tests/python-hivemindrpc/hivemindrpc/authproxy.py
Python
mit
5,785
<?php /** * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @since 3.0.0 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ namespace Cake\ORM; use ArrayObject; use BadMethodCallException; use Cake\Core\App; use Cake\Database\Schema\Table as Schema; use Cake\Database\Type; use Cake\Datasource\ConnectionInterface; use Cake\Datasource\EntityInterface; use Cake\Datasource\Exception\InvalidPrimaryKeyException; use Cake\Datasource\RepositoryInterface; use Cake\Datasource\RulesAwareTrait; use Cake\Event\EventDispatcherInterface; use Cake\Event\EventDispatcherTrait; use Cake\Event\EventListenerInterface; use Cake\Event\EventManager; use Cake\ORM\Association\BelongsTo; use Cake\ORM\Association\BelongsToMany; use Cake\ORM\Association\HasMany; use Cake\ORM\Association\HasOne; use Cake\ORM\Exception\MissingEntityException; use Cake\ORM\Rule\IsUnique; use Cake\Utility\Inflector; use Cake\Validation\ValidatorAwareTrait; use InvalidArgumentException; use RuntimeException; /** * Represents a single database table. * * Exposes methods for retrieving data out of it, and manages the associations * this table has to other tables. Multiple instances of this class can be created * for the same database table with different aliases, this allows you to address * your database structure in a richer and more expressive way. * * ### Retrieving data * * The primary way to retrieve data is using Table::find(). See that method * for more information. * * ### Dynamic finders * * In addition to the standard find($type) finder methods, CakePHP provides dynamic * finder methods. These methods allow you to easily set basic conditions up. For example * to filter users by username you would call * * ``` * $query = $users->findByUsername('mark'); * ``` * * You can also combine conditions on multiple fields using either `Or` or `And`: * * ``` * $query = $users->findByUsernameOrEmail('mark', 'mark@example.org'); * ``` * * ### Bulk updates/deletes * * You can use Table::updateAll() and Table::deleteAll() to do bulk updates/deletes. * You should be aware that events will *not* be fired for bulk updates/deletes. * * ### Callbacks/events * * Table objects provide a few callbacks/events you can hook into to augment/replace * find operations. Each event uses the standard event subsystem in CakePHP * * - `beforeFind(Event $event, Query $query, ArrayObject $options, boolean $primary)` * Fired before each find operation. By stopping the event and supplying a * return value you can bypass the find operation entirely. Any changes done * to the $query instance will be retained for the rest of the find. The * $primary parameter indicates whether or not this is the root query, * or an associated query. * * - `buildValidator(Event $event, Validator $validator, string $name)` * Allows listeners to modify validation rules for the provided named validator. * * - `buildRules(Event $event, RulesChecker $rules)` * Allows listeners to modify the rules checker by adding more rules. * * - `beforeRules(Event $event, EntityInterface $entity, ArrayObject $options, string $operation)` * Fired before an entity is validated using the rules checker. By stopping this event, * you can return the final value of the rules checking operation. * * - `afterRules(Event $event, EntityInterface $entity, ArrayObject $options, bool $result, string $operation)` * Fired after the rules have been checked on the entity. By stopping this event, * you can return the final value of the rules checking operation. * * - `beforeSave(Event $event, EntityInterface $entity, ArrayObject $options)` * Fired before each entity is saved. Stopping this event will abort the save * operation. When the event is stopped the result of the event will be returned. * * - `afterSave(Event $event, EntityInterface $entity, ArrayObject $options)` * Fired after an entity is saved. * * - `afterSaveCommit(Event $event, EntityInterface $entity, ArrayObject $options)` * Fired after the transaction in which the save operation is wrapped has been committed. * It’s also triggered for non atomic saves where database operations are implicitly committed. * The event is triggered only for the primary table on which save() is directly called. * The event is not triggered if a transaction is started before calling save. * * - `beforeDelete(Event $event, EntityInterface $entity, ArrayObject $options)` * Fired before an entity is deleted. By stopping this event you will abort * the delete operation. * * - `afterDelete(Event $event, EntityInterface $entity, ArrayObject $options)` * Fired after an entity has been deleted. * * @see \Cake\Event\EventManager for reference on the events system. */ class Table implements RepositoryInterface, EventListenerInterface, EventDispatcherInterface { use EventDispatcherTrait; use RulesAwareTrait; use ValidatorAwareTrait; /** * Name of default validation set. * * @var string */ const DEFAULT_VALIDATOR = 'default'; /** * The alias this object is assigned to validators as. * * @var string */ const VALIDATOR_PROVIDER_NAME = 'table'; /** * The rules class name that is used. * * @var string */ const RULES_CLASS = 'Cake\ORM\RulesChecker'; /** * Name of the table as it can be found in the database * * @var string */ protected $_table; /** * Human name giving to this particular instance. Multiple objects representing * the same database table can exist by using different aliases. * * @var string */ protected $_alias; /** * Connection instance * * @var \Cake\Datasource\ConnectionInterface */ protected $_connection; /** * The schema object containing a description of this table fields * * @var \Cake\Database\Schema\Table */ protected $_schema; /** * The name of the field that represents the primary key in the table * * @var string|array */ protected $_primaryKey; /** * The name of the field that represents a human readable representation of a row * * @var string */ protected $_displayField; /** * The associations container for this Table. * * @var \Cake\ORM\AssociationCollection */ protected $_associations; /** * BehaviorRegistry for this table * * @var \Cake\ORM\BehaviorRegistry */ protected $_behaviors; /** * The name of the class that represent a single row for this table * * @var string */ protected $_entityClass; /** * Registry key used to create this table object * * @var string */ protected $_registryAlias; /** * Initializes a new instance * * The $config array understands the following keys: * * - table: Name of the database table to represent * - alias: Alias to be assigned to this table (default to table name) * - connection: The connection instance to use * - entityClass: The fully namespaced class name of the entity class that will * represent rows in this table. * - schema: A \Cake\Database\Schema\Table object or an array that can be * passed to it. * - eventManager: An instance of an event manager to use for internal events * - behaviors: A BehaviorRegistry. Generally not used outside of tests. * - associations: An AssociationCollection instance. * - validator: A Validator instance which is assigned as the "default" * validation set, or an associative array, where key is the name of the * validation set and value the Validator instance. * * @param array $config List of options for this table */ public function __construct(array $config = []) { if (!empty($config['registryAlias'])) { $this->registryAlias($config['registryAlias']); } if (!empty($config['table'])) { $this->table($config['table']); } if (!empty($config['alias'])) { $this->alias($config['alias']); } if (!empty($config['connection'])) { $this->connection($config['connection']); } if (!empty($config['schema'])) { $this->schema($config['schema']); } if (!empty($config['entityClass'])) { $this->entityClass($config['entityClass']); } $eventManager = $behaviors = $associations = null; if (!empty($config['eventManager'])) { $eventManager = $config['eventManager']; } if (!empty($config['behaviors'])) { $behaviors = $config['behaviors']; } if (!empty($config['associations'])) { $associations = $config['associations']; } if (!empty($config['validator'])) { if (!is_array($config['validator'])) { $this->validator(static::DEFAULT_VALIDATOR, $config['validator']); } else { foreach ($config['validator'] as $name => $validator) { $this->validator($name, $validator); } } } $this->_eventManager = $eventManager ?: new EventManager(); $this->_behaviors = $behaviors ?: new BehaviorRegistry(); $this->_behaviors->setTable($this); $this->_associations = $associations ?: new AssociationCollection(); $this->initialize($config); $this->_eventManager->on($this); $this->dispatchEvent('Model.initialize'); } /** * Get the default connection name. * * This method is used to get the fallback connection name if an * instance is created through the TableRegistry without a connection. * * @return string * @see \Cake\ORM\TableRegistry::get() */ public static function defaultConnectionName() { return 'default'; } /** * Initialize a table instance. Called after the constructor. * * You can use this method to define associations, attach behaviors * define validation and do any other initialization logic you need. * * ``` * public function initialize(array $config) * { * $this->belongsTo('Users'); * $this->belongsToMany('Tagging.Tags'); * $this->primaryKey('something_else'); * } * ``` * * @param array $config Configuration options passed to the constructor * @return void */ public function initialize(array $config) { } /** * Returns the database table name or sets a new one * * @param string|null $table the new table name * @return string */ public function table($table = null) { if ($table !== null) { $this->_table = $table; } if ($this->_table === null) { $table = namespaceSplit(get_class($this)); $table = substr(end($table), 0, -5); if (empty($table)) { $table = $this->alias(); } $this->_table = Inflector::underscore($table); } return $this->_table; } /** * {@inheritDoc} */ public function alias($alias = null) { if ($alias !== null) { $this->_alias = $alias; } if ($this->_alias === null) { $alias = namespaceSplit(get_class($this)); $alias = substr(end($alias), 0, -5) ?: $this->_table; $this->_alias = $alias; } return $this->_alias; } /** * Alias a field with the table's current alias. * * @param string $field The field to alias. * @return string The field prefixed with the table alias. */ public function aliasField($field) { return $this->alias() . '.' . $field; } /** * Returns the table registry key used to create this table instance * * @param string|null $registryAlias the key used to access this object * @return string */ public function registryAlias($registryAlias = null) { if ($registryAlias !== null) { $this->_registryAlias = $registryAlias; } if ($this->_registryAlias === null) { $this->_registryAlias = $this->alias(); } return $this->_registryAlias; } /** * Returns the connection instance or sets a new one * * @param \Cake\Datasource\ConnectionInterface|null $conn The new connection instance * @return \Cake\Datasource\ConnectionInterface */ public function connection(ConnectionInterface $conn = null) { if ($conn === null) { return $this->_connection; } return $this->_connection = $conn; } /** * Returns the schema table object describing this table's properties. * * If an \Cake\Database\Schema\Table is passed, it will be used for this table * instead of the default one. * * If an array is passed, a new \Cake\Database\Schema\Table will be constructed * out of it and used as the schema for this table. * * @param array|\Cake\Database\Schema\Table|null $schema New schema to be used for this table * @return \Cake\Database\Schema\Table */ public function schema($schema = null) { if ($schema === null) { if ($this->_schema === null) { $this->_schema = $this->_initializeSchema( $this->connection() ->schemaCollection() ->describe($this->table()) ); } return $this->_schema; } if (is_array($schema)) { $constraints = []; if (isset($schema['_constraints'])) { $constraints = $schema['_constraints']; unset($schema['_constraints']); } $schema = new Schema($this->table(), $schema); foreach ($constraints as $name => $value) { $schema->addConstraint($name, $value); } } return $this->_schema = $schema; } /** * Override this function in order to alter the schema used by this table. * This function is only called after fetching the schema out of the database. * If you wish to provide your own schema to this table without touching the * database, you can override schema() or inject the definitions though that * method. * * ### Example: * * ``` * protected function _initializeSchema(\Cake\Database\Schema\Table $table) { * $table->columnType('preferences', 'json'); * return $table; * } * ``` * * @param \Cake\Database\Schema\Table $table The table definition fetched from database. * @return \Cake\Database\Schema\Table the altered schema * @api */ protected function _initializeSchema(Schema $table) { return $table; } /** * Test to see if a Table has a specific field/column. * * Delegates to the schema object and checks for column presence * using the Schema\Table instance. * * @param string $field The field to check for. * @return bool True if the field exists, false if it does not. */ public function hasField($field) { $schema = $this->schema(); return $schema->column($field) !== null; } /** * Returns the primary key field name or sets a new one * * @param string|array|null $key sets a new name to be used as primary key * @return string|array */ public function primaryKey($key = null) { if ($key !== null) { $this->_primaryKey = $key; } if ($this->_primaryKey === null) { $key = (array)$this->schema()->primaryKey(); if (count($key) === 1) { $key = $key[0]; } $this->_primaryKey = $key; } return $this->_primaryKey; } /** * Returns the display field or sets a new one * * @param string|null $key sets a new name to be used as display field * @return string */ public function displayField($key = null) { if ($key !== null) { $this->_displayField = $key; } if ($this->_displayField === null) { $schema = $this->schema(); $primary = (array)$this->primaryKey(); $this->_displayField = array_shift($primary); if ($schema->column('title')) { $this->_displayField = 'title'; } if ($schema->column('name')) { $this->_displayField = 'name'; } } return $this->_displayField; } /** * Returns the class used to hydrate rows for this table or sets * a new one * * @param string|null $name the name of the class to use * @throws \Cake\ORM\Exception\MissingEntityException when the entity class cannot be found * @return string */ public function entityClass($name = null) { if ($name === null && !$this->_entityClass) { $default = '\Cake\ORM\Entity'; $self = get_called_class(); $parts = explode('\\', $self); if ($self === __CLASS__ || count($parts) < 3) { return $this->_entityClass = $default; } $alias = Inflector::singularize(substr(array_pop($parts), 0, -5)); $name = implode('\\', array_slice($parts, 0, -1)) . '\Entity\\' . $alias; if (!class_exists($name)) { return $this->_entityClass = $default; } } if ($name !== null) { $class = App::className($name, 'Model/Entity'); $this->_entityClass = $class; } if (!$this->_entityClass) { throw new MissingEntityException([$name]); } return $this->_entityClass; } /** * Add a behavior. * * Adds a behavior to this table's behavior collection. Behaviors * provide an easy way to create horizontally re-usable features * that can provide trait like functionality, and allow for events * to be listened to. * * Example: * * Load a behavior, with some settings. * * ``` * $this->addBehavior('Tree', ['parent' => 'parentId']); * ``` * * Behaviors are generally loaded during Table::initialize(). * * @param string $name The name of the behavior. Can be a short class reference. * @param array $options The options for the behavior to use. * @return void * @throws \RuntimeException If a behavior is being reloaded. * @see \Cake\ORM\Behavior */ public function addBehavior($name, array $options = []) { $this->_behaviors->load($name, $options); } /** * Removes a behavior from this table's behavior registry. * * Example: * * Remove a behavior from this table. * * ``` * $this->removeBehavior('Tree'); * ``` * * @param string $name The alias that the behavior was added with. * @return void * @see \Cake\ORM\Behavior */ public function removeBehavior($name) { $this->_behaviors->unload($name); } /** * Returns the behavior registry for this table. * * @return \Cake\ORM\BehaviorRegistry The BehaviorRegistry instance. */ public function behaviors() { return $this->_behaviors; } /** * Check if a behavior with the given alias has been loaded. * * @param string $name The behavior alias to check. * @return bool Whether or not the behavior exists. */ public function hasBehavior($name) { return $this->_behaviors->has($name); } /** * Returns an association object configured for the specified alias if any * * @param string $name the alias used for the association. * @return \Cake\ORM\Association|null Either the association or null. */ public function association($name) { return $this->_associations->get($name); } /** * Get the associations collection for this table. * * @return \Cake\ORM\AssociationCollection The collection of association objects. */ public function associations() { return $this->_associations; } /** * Setup multiple associations. * * It takes an array containing set of table names indexed by association type * as argument: * * ``` * $this->Posts->addAssociations([ * 'belongsTo' => [ * 'Users' => ['className' => 'App\Model\Table\UsersTable'] * ], * 'hasMany' => ['Comments'], * 'belongsToMany' => ['Tags'] * ]); * ``` * * Each association type accepts multiple associations where the keys * are the aliases, and the values are association config data. If numeric * keys are used the values will be treated as association aliases. * * @param array $params Set of associations to bind (indexed by association type) * @return void * @see \Cake\ORM\Table::belongsTo() * @see \Cake\ORM\Table::hasOne() * @see \Cake\ORM\Table::hasMany() * @see \Cake\ORM\Table::belongsToMany() */ public function addAssociations(array $params) { foreach ($params as $assocType => $tables) { foreach ($tables as $associated => $options) { if (is_numeric($associated)) { $associated = $options; $options = []; } $this->{$assocType}($associated, $options); } } } /** * Creates a new BelongsTo association between this table and a target * table. A "belongs to" association is a N-1 relationship where this table * is the N side, and where there is a single associated record in the target * table for each one in this table. * * Target table can be inferred by its name, which is provided in the * first argument, or you can either pass the to be instantiated or * an instance of it directly. * * The options array accept the following keys: * * - className: The class name of the target table object * - targetTable: An instance of a table object to be used as the target table * - foreignKey: The name of the field to use as foreign key, if false none * will be used * - conditions: array with a list of conditions to filter the join with * - joinType: The type of join to be used (e.g. INNER) * - strategy: The loading strategy to use. 'join' and 'select' are supported. * - finder: The finder method to use when loading records from this association. * Defaults to 'all'. When the strategy is 'join', only the fields, containments, * and where conditions will be used from the finder. * * This method will return the association object that was built. * * @param string $associated the alias for the target table. This is used to * uniquely identify the association * @param array $options list of options to configure the association definition * @return \Cake\ORM\Association\BelongsTo */ public function belongsTo($associated, array $options = []) { $options += ['sourceTable' => $this]; $association = new BelongsTo($associated, $options); return $this->_associations->add($association->name(), $association); } /** * Creates a new HasOne association between this table and a target * table. A "has one" association is a 1-1 relationship. * * Target table can be inferred by its name, which is provided in the * first argument, or you can either pass the class name to be instantiated or * an instance of it directly. * * The options array accept the following keys: * * - className: The class name of the target table object * - targetTable: An instance of a table object to be used as the target table * - foreignKey: The name of the field to use as foreign key, if false none * will be used * - dependent: Set to true if you want CakePHP to cascade deletes to the * associated table when an entity is removed on this table. Set to false * if you don't want CakePHP to remove associated data, for when you are using * database constraints. * - cascadeCallbacks: Set to true if you want CakePHP to fire callbacks on * cascaded deletes. If false the ORM will use deleteAll() to remove data. * When true records will be loaded and then deleted. * - conditions: array with a list of conditions to filter the join with * - joinType: The type of join to be used (e.g. LEFT) * - strategy: The loading strategy to use. 'join' and 'select' are supported. * - finder: The finder method to use when loading records from this association. * Defaults to 'all'. When the strategy is 'join', only the fields, containments, * and where conditions will be used from the finder. * * This method will return the association object that was built. * * @param string $associated the alias for the target table. This is used to * uniquely identify the association * @param array $options list of options to configure the association definition * @return \Cake\ORM\Association\HasOne */ public function hasOne($associated, array $options = []) { $options += ['sourceTable' => $this]; $association = new HasOne($associated, $options); return $this->_associations->add($association->name(), $association); } /** * Creates a new HasMany association between this table and a target * table. A "has many" association is a 1-N relationship. * * Target table can be inferred by its name, which is provided in the * first argument, or you can either pass the class name to be instantiated or * an instance of it directly. * * The options array accept the following keys: * * - className: The class name of the target table object * - targetTable: An instance of a table object to be used as the target table * - foreignKey: The name of the field to use as foreign key, if false none * will be used * - dependent: Set to true if you want CakePHP to cascade deletes to the * associated table when an entity is removed on this table. Set to false * if you don't want CakePHP to remove associated data, for when you are using * database constraints. * - cascadeCallbacks: Set to true if you want CakePHP to fire callbacks on * cascaded deletes. If false the ORM will use deleteAll() to remove data. * When true records will be loaded and then deleted. * - conditions: array with a list of conditions to filter the join with * - sort: The order in which results for this association should be returned * - saveStrategy: Either 'append' or 'replace'. When 'append' the current records * are appended to any records in the database. When 'replace' associated records * not in the current set will be removed. If the foreign key is a null able column * or if `dependent` is true records will be orphaned. * - strategy: The strategy to be used for selecting results Either 'select' * or 'subquery'. If subquery is selected the query used to return results * in the source table will be used as conditions for getting rows in the * target table. * - finder: The finder method to use when loading records from this association. * Defaults to 'all'. * * This method will return the association object that was built. * * @param string $associated the alias for the target table. This is used to * uniquely identify the association * @param array $options list of options to configure the association definition * @return \Cake\ORM\Association\HasMany */ public function hasMany($associated, array $options = []) { $options += ['sourceTable' => $this]; $association = new HasMany($associated, $options); return $this->_associations->add($association->name(), $association); } /** * Creates a new BelongsToMany association between this table and a target * table. A "belongs to many" association is a M-N relationship. * * Target table can be inferred by its name, which is provided in the * first argument, or you can either pass the class name to be instantiated or * an instance of it directly. * * The options array accept the following keys: * * - className: The class name of the target table object. * - targetTable: An instance of a table object to be used as the target table. * - foreignKey: The name of the field to use as foreign key. * - targetForeignKey: The name of the field to use as the target foreign key. * - joinTable: The name of the table representing the link between the two * - through: If you choose to use an already instantiated link table, set this * key to a configured Table instance containing associations to both the source * and target tables in this association. * - cascadeCallbacks: Set to true if you want CakePHP to fire callbacks on * cascaded deletes. If false the ORM will use deleteAll() to remove data. * When true join/junction table records will be loaded and then deleted. * - conditions: array with a list of conditions to filter the join with. * - sort: The order in which results for this association should be returned. * - strategy: The strategy to be used for selecting results Either 'select' * or 'subquery'. If subquery is selected the query used to return results * in the source table will be used as conditions for getting rows in the * target table. * - saveStrategy: Either 'append' or 'replace'. Indicates the mode to be used * for saving associated entities. The former will only create new links * between both side of the relation and the latter will do a wipe and * replace to create the links between the passed entities when saving. * - strategy: The loading strategy to use. 'select' and 'subquery' are supported. * - finder: The finder method to use when loading records from this association. * Defaults to 'all'. * * This method will return the association object that was built. * * @param string $associated the alias for the target table. This is used to * uniquely identify the association * @param array $options list of options to configure the association definition * @return \Cake\ORM\Association\BelongsToMany */ public function belongsToMany($associated, array $options = []) { $options += ['sourceTable' => $this]; $association = new BelongsToMany($associated, $options); return $this->_associations->add($association->name(), $association); } /** * {@inheritDoc} * * ### Model.beforeFind event * * Each find() will trigger a `Model.beforeFind` event for all attached * listeners. Any listener can set a valid result set using $query * * By default, `$options` will recognize the following keys: * * - fields * - conditions * - order * - limit * - offset * - page * - group * - having * - contain * - join * * ### Usage * * Using the options array: * * ``` * $query = $articles->find('all', [ * 'conditions' => ['published' => 1], * 'limit' => 10, * 'contain' => ['Users', 'Comments'] * ]); * ``` * * Using the builder interface: * * ``` * $query = $articles->find() * ->where(['published' => 1]) * ->limit(10) * ->contain(['Users', 'Comments']); * ``` * * ### Calling finders * * The find() method is the entry point for custom finder methods. * You can invoke a finder by specifying the type: * * ``` * $query = $articles->find('published'); * ``` * * Would invoke the `findPublished` method. * * @return \Cake\ORM\Query The query builder */ public function find($type = 'all', $options = []) { $query = $this->query(); $query->select(); return $this->callFinder($type, $query, $options); } /** * Returns the query as passed. * * By default findAll() applies no conditions, you * can override this method in subclasses to modify how `find('all')` works. * * @param \Cake\ORM\Query $query The query to find with * @param array $options The options to use for the find * @return \Cake\ORM\Query The query builder */ public function findAll(Query $query, array $options) { return $query; } /** * Sets up a query object so results appear as an indexed array, useful for any * place where you would want a list such as for populating input select boxes. * * When calling this finder, the fields passed are used to determine what should * be used as the array key, value and optionally what to group the results by. * By default the primary key for the model is used for the key, and the display * field as value. * * The results of this finder will be in the following form: * * ``` * [ * 1 => 'value for id 1', * 2 => 'value for id 2', * 4 => 'value for id 4' * ] * ``` * * You can specify which property will be used as the key and which as value * by using the `$options` array, when not specified, it will use the results * of calling `primaryKey` and `displayField` respectively in this table: * * ``` * $table->find('list', [ * 'keyField' => 'name', * 'valueField' => 'age' * ]); * ``` * * Results can be put together in bigger groups when they share a property, you * can customize the property to use for grouping by setting `groupField`: * * ``` * $table->find('list', [ * 'groupField' => 'category_id', * ]); * ``` * * When using a `groupField` results will be returned in this format: * * ``` * [ * 'group_1' => [ * 1 => 'value for id 1', * 2 => 'value for id 2', * ] * 'group_2' => [ * 4 => 'value for id 4' * ] * ] * ``` * * @param \Cake\ORM\Query $query The query to find with * @param array $options The options for the find * @return \Cake\ORM\Query The query builder */ public function findList(Query $query, array $options) { $options += [ 'keyField' => $this->primaryKey(), 'valueField' => $this->displayField(), 'groupField' => null ]; if (isset($options['idField'])) { $options['keyField'] = $options['idField']; unset($options['idField']); trigger_error('Option "idField" is deprecated, use "keyField" instead.', E_USER_WARNING); } if (!$query->clause('select') && !is_object($options['keyField']) && !is_object($options['valueField']) && !is_object($options['groupField']) ) { $fields = array_merge( (array)$options['keyField'], (array)$options['valueField'], (array)$options['groupField'] ); $columns = $this->schema()->columns(); if (count($fields) === count(array_intersect($fields, $columns))) { $query->select($fields); } } $options = $this->_setFieldMatchers( $options, ['keyField', 'valueField', 'groupField'] ); return $query->formatResults(function ($results) use ($options) { return $results->combine( $options['keyField'], $options['valueField'], $options['groupField'] ); }); } /** * Results for this finder will be a nested array, and is appropriate if you want * to use the parent_id field of your model data to build nested results. * * Values belonging to a parent row based on their parent_id value will be * recursively nested inside the parent row values using the `children` property * * You can customize what fields are used for nesting results, by default the * primary key and the `parent_id` fields are used. If you wish to change * these defaults you need to provide the keys `keyField` or `parentField` in * `$options`: * * ``` * $table->find('threaded', [ * 'keyField' => 'id', * 'parentField' => 'ancestor_id' * ]); * ``` * * @param \Cake\ORM\Query $query The query to find with * @param array $options The options to find with * @return \Cake\ORM\Query The query builder */ public function findThreaded(Query $query, array $options) { $options += [ 'keyField' => $this->primaryKey(), 'parentField' => 'parent_id', ]; if (isset($options['idField'])) { $options['keyField'] = $options['idField']; unset($options['idField']); trigger_error('Option "idField" is deprecated, use "keyField" instead.', E_USER_WARNING); } $options = $this->_setFieldMatchers($options, ['keyField', 'parentField']); return $query->formatResults(function ($results) use ($options) { return $results->nest($options['keyField'], $options['parentField']); }); } /** * Out of an options array, check if the keys described in `$keys` are arrays * and change the values for closures that will concatenate the each of the * properties in the value array when passed a row. * * This is an auxiliary function used for result formatters that can accept * composite keys when comparing values. * * @param array $options the original options passed to a finder * @param array $keys the keys to check in $options to build matchers from * the associated value * @return array */ protected function _setFieldMatchers($options, $keys) { foreach ($keys as $field) { if (!is_array($options[$field])) { continue; } if (count($options[$field]) === 1) { $options[$field] = current($options[$field]); continue; } $fields = $options[$field]; $options[$field] = function ($row) use ($fields) { $matches = []; foreach ($fields as $field) { $matches[] = $row[$field]; } return implode(';', $matches); }; } return $options; } /** * {@inheritDoc} * * ### Usage * * Get an article and some relationships: * * ``` * $article = $articles->get(1, ['contain' => ['Users', 'Comments']]); * ``` * * @throws \Cake\Datasource\Exception\InvalidPrimaryKeyException When $primaryKey has an * incorrect number of elements. */ public function get($primaryKey, $options = []) { $key = (array)$this->primaryKey(); $alias = $this->alias(); foreach ($key as $index => $keyname) { $key[$index] = $alias . '.' . $keyname; } $primaryKey = (array)$primaryKey; if (count($key) !== count($primaryKey)) { $primaryKey = $primaryKey ?: [null]; $primaryKey = array_map(function ($key) { return var_export($key, true); }, $primaryKey); throw new InvalidPrimaryKeyException(sprintf( 'Record not found in table "%s" with primary key [%s]', $this->table(), implode($primaryKey, ', ') )); } $conditions = array_combine($key, $primaryKey); $cacheConfig = isset($options['cache']) ? $options['cache'] : false; $cacheKey = isset($options['key']) ? $options['key'] : false; $finder = isset($options['finder']) ? $options['finder'] : 'all'; unset($options['key'], $options['cache'], $options['finder']); $query = $this->find($finder, $options)->where($conditions); if ($cacheConfig) { if (!$cacheKey) { $cacheKey = sprintf( "get:%s.%s%s", $this->connection()->configName(), $this->table(), json_encode($primaryKey) ); } $query->cache($cacheKey, $cacheConfig); } return $query->firstOrFail(); } /** * Finds an existing record or creates a new one. * * Using the attributes defined in $search a find() will be done to locate * an existing record. If records matches the conditions, the first record * will be returned. * * If no record can be found, a new entity will be created * with the $search properties. If a callback is provided, it will be * called allowing you to define additional default values. The new * entity will be saved and returned. * * @param array $search The criteria to find existing records by. * @param callable|null $callback A callback that will be invoked for newly * created entities. This callback will be called *before* the entity * is persisted. * @return \Cake\Datasource\EntityInterface An entity. */ public function findOrCreate($search, callable $callback = null) { $query = $this->find()->where($search); $row = $query->first(); if ($row) { return $row; } $entity = $this->newEntity(); $entity->set($search, ['guard' => false]); if ($callback) { $callback($entity); } return $this->save($entity) ?: $entity; } /** * {@inheritDoc} */ public function query() { return new Query($this->connection(), $this); } /** * {@inheritDoc} */ public function updateAll($fields, $conditions) { $query = $this->query(); $query->update() ->set($fields) ->where($conditions); $statement = $query->execute(); $statement->closeCursor(); return $statement->rowCount(); } /** * {@inheritDoc} */ public function deleteAll($conditions) { $query = $this->query() ->delete() ->where($conditions); $statement = $query->execute(); $statement->closeCursor(); return $statement->rowCount(); } /** * {@inheritDoc} */ public function exists($conditions) { return (bool)count( $this->find('all') ->select(['existing' => 1]) ->where($conditions) ->limit(1) ->hydrate(false) ->toArray() ); } /** * {@inheritDoc} * * ### Options * * The options array accepts the following keys: * * - atomic: Whether to execute the save and callbacks inside a database * transaction (default: true) * - checkRules: Whether or not to check the rules on entity before saving, if the checking * fails, it will abort the save operation. (default:true) * - associated: If true it will save all associated entities as they are found * in the passed `$entity` whenever the property defined for the association * is marked as dirty. Associated records are saved recursively unless told * otherwise. If an array, it will be interpreted as the list of associations * to be saved. It is possible to provide different options for saving on associated * table objects using this key by making the custom options the array value. * If false no associated records will be saved. (default: true) * - checkExisting: Whether or not to check if the entity already exists, assuming that the * entity is marked as not new, and the primary key has been set. * * ### Events * * When saving, this method will trigger four events: * * - Model.beforeRules: Will be triggered right before any rule checking is done * for the passed entity if the `checkRules` key in $options is not set to false. * Listeners will receive as arguments the entity, options array and the operation type. * If the event is stopped the rules check result will be set to the result of the event itself. * - Model.afterRules: Will be triggered right after the `checkRules()` method is * called for the entity. Listeners will receive as arguments the entity, * options array, the result of checking the rules and the operation type. * If the event is stopped the checking result will be set to the result of * the event itself. * - Model.beforeSave: Will be triggered just before the list of fields to be * persisted is calculated. It receives both the entity and the options as * arguments. The options array is passed as an ArrayObject, so any changes in * it will be reflected in every listener and remembered at the end of the event * so it can be used for the rest of the save operation. Returning false in any * of the listeners will abort the saving process. If the event is stopped * using the event API, the event object's `result` property will be returned. * This can be useful when having your own saving strategy implemented inside a * listener. * - Model.afterSave: Will be triggered after a successful insert or save, * listeners will receive the entity and the options array as arguments. The type * of operation performed (insert or update) can be determined by checking the * entity's method `isNew`, true meaning an insert and false an update. * - Model.afterSaveCommit: Will be triggered after the transaction is commited * for atomic save, listeners will receive the entity and the options array * as arguments. * * This method will determine whether the passed entity needs to be * inserted or updated in the database. It does that by checking the `isNew` * method on the entity. If the entity to be saved returns a non-empty value from * its `errors()` method, it will not be saved. * * ### Saving on associated tables * * This method will by default persist entities belonging to associated tables, * whenever a dirty property matching the name of the property name set for an * association in this table. It is possible to control what associations will * be saved and to pass additional option for saving them. * * ``` * // Only save the comments association * $articles->save($entity, ['associated' => ['Comments']); * * // Save the company, the employees and related addresses for each of them. * // For employees do not check the entity rules * $companies->save($entity, [ * 'associated' => [ * 'Employees' => [ * 'associated' => ['Addresses'], * 'checkRules' => false * ] * ] * ]); * * // Save no associations * $articles->save($entity, ['associated' => false]); * ``` * */ public function save(EntityInterface $entity, $options = []) { $options = new ArrayObject($options + [ 'atomic' => true, 'associated' => true, 'checkRules' => true, 'checkExisting' => true, '_primary' => true ]); if ($entity->errors()) { return false; } if ($entity->isNew() === false && !$entity->dirty()) { return $entity; } $connection = $this->connection(); if ($options['atomic']) { $success = $connection->transactional(function () use ($entity, $options) { return $this->_processSave($entity, $options); }); } else { $success = $this->_processSave($entity, $options); } if ($success) { if (!$connection->inTransaction() && ($options['atomic'] || (!$options['atomic'] && $options['_primary'])) ) { $this->dispatchEvent('Model.afterSaveCommit', compact('entity', 'options')); } if ($options['atomic'] || $options['_primary']) { $entity->isNew(false); $entity->source($this->registryAlias()); } } return $success; } /** * Performs the actual saving of an entity based on the passed options. * * @param \Cake\Datasource\EntityInterface $entity the entity to be saved * @param \ArrayObject $options the options to use for the save operation * @return \Cake\Datasource\EntityInterface|bool * @throws \RuntimeException When an entity is missing some of the primary keys. */ protected function _processSave($entity, $options) { $primaryColumns = (array)$this->primaryKey(); if ($options['checkExisting'] && $primaryColumns && $entity->isNew() && $entity->has($primaryColumns)) { $alias = $this->alias(); $conditions = []; foreach ($entity->extract($primaryColumns) as $k => $v) { $conditions["$alias.$k"] = $v; } $entity->isNew(!$this->exists($conditions)); } $mode = $entity->isNew() ? RulesChecker::CREATE : RulesChecker::UPDATE; if ($options['checkRules'] && !$this->checkRules($entity, $mode, $options)) { return false; } $options['associated'] = $this->_associations->normalizeKeys($options['associated']); $event = $this->dispatchEvent('Model.beforeSave', compact('entity', 'options')); if ($event->isStopped()) { return $event->result; } $saved = $this->_associations->saveParents( $this, $entity, $options['associated'], ['_primary' => false] + $options->getArrayCopy() ); if (!$saved && $options['atomic']) { return false; } $data = $entity->extract($this->schema()->columns(), true); $isNew = $entity->isNew(); if ($isNew) { $success = $this->_insert($entity, $data); } else { $success = $this->_update($entity, $data); } if ($success) { $success = $this->_associations->saveChildren( $this, $entity, $options['associated'], ['_primary' => false] + $options->getArrayCopy() ); if ($success || !$options['atomic']) { $this->dispatchEvent('Model.afterSave', compact('entity', 'options')); $entity->clean(); if (!$options['atomic'] && !$options['_primary']) { $entity->isNew(false); $entity->source($this->registryAlias()); } $success = true; } } if (!$success && $isNew) { $entity->unsetProperty($this->primaryKey()); $entity->isNew(true); } if ($success) { return $entity; } return false; } /** * Auxiliary function to handle the insert of an entity's data in the table * * @param \Cake\Datasource\EntityInterface $entity the subject entity from were $data was extracted * @param array $data The actual data that needs to be saved * @return \Cake\Datasource\EntityInterface|bool * @throws \RuntimeException if not all the primary keys where supplied or could * be generated when the table has composite primary keys. Or when the table has no primary key. */ protected function _insert($entity, $data) { $primary = (array)$this->primaryKey(); if (empty($primary)) { $msg = sprintf( 'Cannot insert row in "%s" table, it has no primary key.', $this->table() ); throw new RuntimeException($msg); } $keys = array_fill(0, count($primary), null); $id = (array)$this->_newId($primary) + $keys; // Generate primary keys preferring values in $data. $primary = array_combine($primary, $id); $primary = array_intersect_key($data, $primary) + $primary; $filteredKeys = array_filter($primary, 'strlen'); $data = $data + $filteredKeys; if (count($primary) > 1) { $schema = $this->schema(); foreach ($primary as $k => $v) { if (!isset($data[$k]) && empty($schema->column($k)['autoIncrement'])) { $msg = 'Cannot insert row, some of the primary key values are missing. '; $msg .= sprintf( 'Got (%s), expecting (%s)', implode(', ', $filteredKeys + $entity->extract(array_keys($primary))), implode(', ', array_keys($primary)) ); throw new RuntimeException($msg); } } } $success = false; if (empty($data)) { return $success; } $statement = $this->query()->insert(array_keys($data)) ->values($data) ->execute(); if ($statement->rowCount() !== 0) { $success = $entity; $entity->set($filteredKeys, ['guard' => false]); $schema = $this->schema(); $driver = $this->connection()->driver(); foreach ($primary as $key => $v) { if (!isset($data[$key])) { $id = $statement->lastInsertId($this->table(), $key); $type = $schema->columnType($key); $entity->set($key, Type::build($type)->toPHP($id, $driver)); break; } } } $statement->closeCursor(); return $success; } /** * Generate a primary key value for a new record. * * By default, this uses the type system to generate a new primary key * value if possible. You can override this method if you have specific requirements * for id generation. * * @param array $primary The primary key columns to get a new ID for. * @return mixed Either null or the new primary key value. */ protected function _newId($primary) { if (!$primary || count((array)$primary) > 1) { return null; } $typeName = $this->schema()->columnType($primary[0]); $type = Type::build($typeName); return $type->newId(); } /** * Auxiliary function to handle the update of an entity's data in the table * * @param \Cake\Datasource\EntityInterface $entity the subject entity from were $data was extracted * @param array $data The actual data that needs to be saved * @return \Cake\Datasource\EntityInterface|bool * @throws \InvalidArgumentException When primary key data is missing. */ protected function _update($entity, $data) { $primaryColumns = (array)$this->primaryKey(); $primaryKey = $entity->extract($primaryColumns); $data = array_diff_key($data, $primaryKey); if (empty($data)) { return $entity; } if (!$entity->has($primaryColumns)) { $message = 'All primary key value(s) are needed for updating'; throw new InvalidArgumentException($message); } $query = $this->query(); $statement = $query->update() ->set($data) ->where($primaryKey) ->execute(); $success = false; if ($statement->errorCode() === '00000') { $success = $entity; } $statement->closeCursor(); return $success; } /** * {@inheritDoc} * * For HasMany and HasOne associations records will be removed based on * the dependent option. Join table records in BelongsToMany associations * will always be removed. You can use the `cascadeCallbacks` option * when defining associations to change how associated data is deleted. * * ### Options * * - `atomic` Defaults to true. When true the deletion happens within a transaction. * - `checkRules` Defaults to true. Check deletion rules before deleting the record. * * ### Events * * - `Model.beforeDelete` Fired before the delete occurs. If stopped the delete * will be aborted. Receives the event, entity, and options. * - `Model.afterDelete` Fired after the delete has been successful. Receives * the event, entity, and options. * - `Model.afterDeleteCommit` Fired after the transaction is committed for * an atomic delete. Receives the event, entity, and options. * * The options argument will be converted into an \ArrayObject instance * for the duration of the callbacks, this allows listeners to modify * the options used in the delete operation. * */ public function delete(EntityInterface $entity, $options = []) { $options = new ArrayObject($options + [ 'atomic' => true, 'checkRules' => true, '_primary' => true, ]); $process = function () use ($entity, $options) { return $this->_processDelete($entity, $options); }; $connection = $this->connection(); if ($options['atomic']) { $success = $connection->transactional($process); } else { $success = $process(); } if ($success && !$connection->inTransaction() && ($options['atomic'] || (!$options['atomic'] && $options['_primary'])) ) { $this->dispatchEvent('Model.afterDeleteCommit', [ 'entity' => $entity, 'options' => $options ]); } return $success; } /** * Perform the delete operation. * * Will delete the entity provided. Will remove rows from any * dependent associations, and clear out join tables for BelongsToMany associations. * * @param \Cake\Datasource\EntityInterface $entity The entity to delete. * @param \ArrayObject $options The options for the delete. * @throws \InvalidArgumentException if there are no primary key values of the * passed entity * @return bool success */ protected function _processDelete($entity, $options) { if ($entity->isNew()) { return false; } $primaryKey = (array)$this->primaryKey(); if (!$entity->has($primaryKey)) { $msg = 'Deleting requires all primary key values.'; throw new InvalidArgumentException($msg); } if ($options['checkRules'] && !$this->checkRules($entity, RulesChecker::DELETE, $options)) { return false; } $event = $this->dispatchEvent('Model.beforeDelete', [ 'entity' => $entity, 'options' => $options ]); if ($event->isStopped()) { return $event->result; } $this->_associations->cascadeDelete( $entity, ['_primary' => false] + $options->getArrayCopy() ); $query = $this->query(); $conditions = (array)$entity->extract($primaryKey); $statement = $query->delete() ->where($conditions) ->execute(); $success = $statement->rowCount() > 0; if (!$success) { return $success; } $this->dispatchEvent('Model.afterDelete', [ 'entity' => $entity, 'options' => $options ]); return $success; } /** * Returns true if the finder exists for the table * * @param string $type name of finder to check * * @return bool */ public function hasFinder($type) { $finder = 'find' . $type; return method_exists($this, $finder) || ($this->_behaviors && $this->_behaviors->hasFinder($type)); } /** * Calls a finder method directly and applies it to the passed query, * if no query is passed a new one will be created and returned * * @param string $type name of the finder to be called * @param \Cake\ORM\Query $query The query object to apply the finder options to * @param array $options List of options to pass to the finder * @return \Cake\ORM\Query * @throws \BadMethodCallException */ public function callFinder($type, Query $query, array $options = []) { $query->applyOptions($options); $options = $query->getOptions(); $finder = 'find' . $type; if (method_exists($this, $finder)) { return $this->{$finder}($query, $options); } if ($this->_behaviors && $this->_behaviors->hasFinder($type)) { return $this->_behaviors->callFinder($type, [$query, $options]); } throw new BadMethodCallException( sprintf('Unknown finder method "%s"', $type) ); } /** * Provides the dynamic findBy and findByAll methods. * * @param string $method The method name that was fired. * @param array $args List of arguments passed to the function. * @return mixed * @throws \BadMethodCallException when there are missing arguments, or when * and & or are combined. */ protected function _dynamicFinder($method, $args) { $method = Inflector::underscore($method); preg_match('/^find_([\w]+)_by_/', $method, $matches); if (empty($matches)) { // find_by_ is 8 characters. $fields = substr($method, 8); $findType = 'all'; } else { $fields = substr($method, strlen($matches[0])); $findType = Inflector::variable($matches[1]); } $hasOr = strpos($fields, '_or_'); $hasAnd = strpos($fields, '_and_'); $makeConditions = function ($fields, $args) { $conditions = []; if (count($args) < count($fields)) { throw new BadMethodCallException(sprintf( 'Not enough arguments for magic finder. Got %s required %s', count($args), count($fields) )); } foreach ($fields as $field) { $conditions[$this->aliasField($field)] = array_shift($args); } return $conditions; }; if ($hasOr !== false && $hasAnd !== false) { throw new BadMethodCallException( 'Cannot mix "and" & "or" in a magic finder. Use find() instead.' ); } $conditions = []; if ($hasOr === false && $hasAnd === false) { $conditions = $makeConditions([$fields], $args); } elseif ($hasOr !== false) { $fields = explode('_or_', $fields); $conditions = [ 'OR' => $makeConditions($fields, $args) ]; } elseif ($hasAnd !== false) { $fields = explode('_and_', $fields); $conditions = $makeConditions($fields, $args); } return $this->find($findType, [ 'conditions' => $conditions, ]); } /** * Handles behavior delegation + dynamic finders. * * If your Table uses any behaviors you can call them as if * they were on the table object. * * @param string $method name of the method to be invoked * @param array $args List of arguments passed to the function * @return mixed * @throws \BadMethodCallException */ public function __call($method, $args) { if ($this->_behaviors && $this->_behaviors->hasMethod($method)) { return $this->_behaviors->call($method, $args); } if (preg_match('/^find(?:\w+)?By/', $method) > 0) { return $this->_dynamicFinder($method, $args); } throw new BadMethodCallException( sprintf('Unknown method "%s"', $method) ); } /** * Returns the association named after the passed value if exists, otherwise * throws an exception. * * @param string $property the association name * @return \Cake\ORM\Association * @throws \RuntimeException if no association with such name exists */ public function __get($property) { $association = $this->_associations->get($property); if (!$association) { throw new RuntimeException(sprintf( 'Table "%s" is not associated with "%s"', get_class($this), $property )); } return $association; } /** * Returns whether an association named after the passed value * exists for this table. * * @param string $property the association name * @return bool */ public function __isset($property) { return $this->_associations->has($property); } /** * Get the object used to marshal/convert array data into objects. * * Override this method if you want a table object to use custom * marshalling logic. * * @return \Cake\ORM\Marshaller * @see \Cake\ORM\Marshaller */ public function marshaller() { return new Marshaller($this); } /** * {@inheritDoc} * * By default all the associations on this table will be hydrated. You can * limit which associations are built, or include deeper associations * using the options parameter: * * ``` * $article = $this->Articles->newEntity( * $this->request->data(), * ['associated' => ['Tags', 'Comments.Users']] * ); * ``` * * You can limit fields that will be present in the constructed entity by * passing the `fieldList` option, which is also accepted for associations: * * ``` * $article = $this->Articles->newEntity($this->request->data(), [ * 'fieldList' => ['title', 'body'], * 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']] * ] * ); * ``` * * The `fieldList` option lets remove or restrict input data from ending up in * the entity. If you'd like to relax the entity's default accessible fields, * you can use the `accessibleFields` option: * * ``` * $article = $this->Articles->newEntity( * $this->request->data(), * ['accessibleFields' => ['protected_field' => true]] * ); * ``` * * By default, the data is validated before being passed to the new entity. In * the case of invalid fields, those will not be present in the resulting object. * The `validate` option can be used to disable validation on the passed data: * * ``` * $article = $this->Articles->newEntity( * $this->request->data(), * ['validate' => false] * ); * ``` * * You can also pass the name of the validator to use in the `validate` option. * If `null` is passed to the first param of this function, no validation will * be performed. * * You can use the `Model.beforeMarshal` event to modify request data * before it is converted into entities. */ public function newEntity($data = null, array $options = []) { if ($data === null) { $class = $this->entityClass(); $entity = new $class([], ['source' => $this->registryAlias()]); return $entity; } if (!isset($options['associated'])) { $options['associated'] = $this->_associations->keys(); } $marshaller = $this->marshaller(); return $marshaller->one($data, $options); } /** * {@inheritDoc} * * By default all the associations on this table will be hydrated. You can * limit which associations are built, or include deeper associations * using the options parameter: * * ``` * $articles = $this->Articles->newEntities( * $this->request->data(), * ['associated' => ['Tags', 'Comments.Users']] * ); * ``` * * You can limit fields that will be present in the constructed entities by * passing the `fieldList` option, which is also accepted for associations: * * ``` * $articles = $this->Articles->newEntities($this->request->data(), [ * 'fieldList' => ['title', 'body'], * 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']] * ] * ); * ``` * * You can use the `Model.beforeMarshal` event to modify request data * before it is converted into entities. */ public function newEntities(array $data, array $options = []) { if (!isset($options['associated'])) { $options['associated'] = $this->_associations->keys(); } $marshaller = $this->marshaller(); return $marshaller->many($data, $options); } /** * {@inheritDoc} * * When merging HasMany or BelongsToMany associations, all the entities in the * `$data` array will appear, those that can be matched by primary key will get * the data merged, but those that cannot, will be discarded. * * You can limit fields that will be present in the merged entity by * passing the `fieldList` option, which is also accepted for associations: * * ``` * $article = $this->Articles->patchEntity($article, $this->request->data(), [ * 'fieldList' => ['title', 'body'], * 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']] * ] * ); * ``` * * By default, the data is validated before being passed to the entity. In * the case of invalid fields, those will not be assigned to the entity. * The `validate` option can be used to disable validation on the passed data: * * ``` * $article = $this->patchEntity($article, $this->request->data(),[ * 'validate' => false * ]); * ``` * * You can use the `Model.beforeMarshal` event to modify request data * before it is converted into entities. */ public function patchEntity(EntityInterface $entity, array $data, array $options = []) { if (!isset($options['associated'])) { $options['associated'] = $this->_associations->keys(); } $marshaller = $this->marshaller(); return $marshaller->merge($entity, $data, $options); } /** * {@inheritDoc} * * Those entries in `$entities` that cannot be matched to any record in * `$data` will be discarded. Records in `$data` that could not be matched will * be marshalled as a new entity. * * When merging HasMany or BelongsToMany associations, all the entities in the * `$data` array will appear, those that can be matched by primary key will get * the data merged, but those that cannot, will be discarded. * * You can limit fields that will be present in the merged entities by * passing the `fieldList` option, which is also accepted for associations: * * ``` * $articles = $this->Articles->patchEntities($articles, $this->request->data(), [ * 'fieldList' => ['title', 'body'], * 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']] * ] * ); * ``` * * You can use the `Model.beforeMarshal` event to modify request data * before it is converted into entities. */ public function patchEntities($entities, array $data, array $options = []) { if (!isset($options['associated'])) { $options['associated'] = $this->_associations->keys(); } $marshaller = $this->marshaller(); return $marshaller->mergeMany($entities, $data, $options); } /** * Validator method used to check the uniqueness of a value for a column. * This is meant to be used with the validation API and not to be called * directly. * * ### Example: * * ``` * $validator->add('email', [ * 'unique' => ['rule' => 'validateUnique', 'provider' => 'table'] * ]) * ``` * * Unique validation can be scoped to the value of another column: * * ``` * $validator->add('email', [ * 'unique' => [ * 'rule' => ['validateUnique', ['scope' => 'site_id']], * 'provider' => 'table' * ] * ]); * ``` * * In the above example, the email uniqueness will be scoped to only rows having * the same site_id. Scoping will only be used if the scoping field is present in * the data to be validated. * * @param mixed $value The value of column to be checked for uniqueness * @param array $options The options array, optionally containing the 'scope' key. * May also be the validation context if there are no options. * @param array|null $context Either the validation context or null. * @return bool true if the value is unique */ public function validateUnique($value, array $options, array $context = null) { if ($context === null) { $context = $options; } $entity = new Entity( $context['data'], [ 'useSetters' => false, 'markNew' => $context['newRecord'], 'source' => $this->registryAlias() ] ); $fields = array_merge( [$context['field']], isset($options['scope']) ? (array)$options['scope'] : [] ); $rule = new IsUnique($fields); return $rule($entity, ['repository' => $this]); } /** * Get the Model callbacks this table is interested in. * * By implementing the conventional methods a table class is assumed * to be interested in the related event. * * Override this method if you need to add non-conventional event listeners. * Or if you want you table to listen to non-standard events. * * The conventional method map is: * * - Model.beforeMarshal => beforeMarshal * - Model.beforeFind => beforeFind * - Model.beforeSave => beforeSave * - Model.afterSave => afterSave * - Model.afterSaveCommit => afterSaveCommit * - Model.beforeDelete => beforeDelete * - Model.afterDelete => afterDelete * - Model.afterDeleteCommit => afterDeleteCommit * - Model.beforeRules => beforeRules * - Model.afterRules => afterRules * * @return array */ public function implementedEvents() { $eventMap = [ 'Model.beforeMarshal' => 'beforeMarshal', 'Model.beforeFind' => 'beforeFind', 'Model.beforeSave' => 'beforeSave', 'Model.afterSave' => 'afterSave', 'Model.afterSaveCommit' => 'afterSaveCommit', 'Model.beforeDelete' => 'beforeDelete', 'Model.afterDelete' => 'afterDelete', 'Model.afterDeleteCommit' => 'afterDeleteCommit', 'Model.beforeRules' => 'beforeRules', 'Model.afterRules' => 'afterRules', ]; $events = []; foreach ($eventMap as $event => $method) { if (!method_exists($this, $method)) { continue; } $events[$event] = $method; } return $events; } /** * {@inheritDoc} * * @param \Cake\ORM\RulesChecker $rules The rules object to be modified. * @return \Cake\ORM\RulesChecker */ public function buildRules(RulesChecker $rules) { return $rules; } /** * Loads the specified associations in the passed entity or list of entities * by executing extra queries in the database and merging the results in the * appropriate properties. * * ### Example: * * ``` * $user = $usersTable->get(1); * $user = $usersTable->loadInto($user, ['Articles.Tags', 'Articles.Comments']); * echo $user->articles[0]->title; * ``` * * You can also load associations for multiple entities at once * * ### Example: * * ``` * $users = $usersTable->find()->where([...])->toList(); * $users = $usersTable->loadInto($users, ['Articles.Tags', 'Articles.Comments']); * echo $user[1]->articles[0]->title; * ``` * * The properties for the associations to be loaded will be overwritten on each entity. * * @param \Cake\Datasource\EntityInterface|array $entities a single entity or list of entities * @param array $contain A `contain()` compatible array. * @see \Cake\ORM\Query::contain() * @return \Cake\Datasource\EntityInterface|array */ public function loadInto($entities, array $contain) { return (new LazyEagerLoader)->loadInto($entities, $contain, $this); } /** * Returns an array that can be used to describe the internal state of this * object. * * @return array */ public function __debugInfo() { $conn = $this->connection(); $associations = $this->_associations ?: false; $behaviors = $this->_behaviors ?: false; return [ 'registryAlias' => $this->registryAlias(), 'table' => $this->table(), 'alias' => $this->alias(), 'entityClass' => $this->entityClass(), 'associations' => $associations ? $associations->keys() : false, 'behaviors' => $behaviors ? $behaviors->loaded() : false, 'defaultConnection' => $this->defaultConnectionName(), 'connectionName' => $conn ? $conn->configName() : null ]; } }
bravo-kernel/cakephp
src/ORM/Table.php
PHP
mit
79,654
module UsdaNutrientDatabase class Railtie < Rails::Railtie railtie_name :usda_nutrient_database rake_tasks do load 'usda_nutrient_database/tasks/usda_nutrient_database.rake' end end end
mattbeedle/usda-nutrient-database
lib/usda_nutrient_database/railtie.rb
Ruby
mit
208
using System; using System.Linq; using System.Threading; #if PORTABLE using BrightstarDB.Portable.Compatibility; #elif WINDOWS_PHONE using BrightstarDB.Mobile.Compatibility; #else using System.Collections.Concurrent; #endif namespace BrightstarDB.Caching { /// <summary> /// A simple least-recently-used cache eviction policy implementation. /// </summary> public class LruCacheEvictionPolicy : ICacheEvictionPolicy { private readonly ConcurrentDictionary<string, TimestampedCacheEntry> _normalPriorityEntries; private readonly ConcurrentDictionary<string, TimestampedCacheEntry> _highPriorityEntries; private bool _running; #if SILVERLIGHT || PORTABLE private readonly ManualResetEvent _evictionCompleted = new ManualResetEvent(false); #else private readonly ManualResetEventSlim _evictionCompleted = new ManualResetEventSlim(); #endif /// <summary> /// Creates a new LRU cache eviction policy /// </summary> public LruCacheEvictionPolicy() { _highPriorityEntries= new ConcurrentDictionary<string, TimestampedCacheEntry>(); _normalPriorityEntries = new ConcurrentDictionary<string, TimestampedCacheEntry>(); } /// <summary> /// Runs this policy against the specified cache until a target number of bytes have been evicted from the cache /// </summary> /// <param name="cache">The cache to run against</param> /// <param name="target">The target number of bytes to be evicted from the cache</param> public void Run(AbstractCache cache, long target) { lock (this) { if (_running) { #if SILVERLIGHT || PORTABLE _evictionCompleted.WaitOne(); #else _evictionCompleted.Wait(); #endif } _running = true; _evictionCompleted.Reset(); } long evictedBytes = 0; TimestampedCacheEntry removed; foreach(var lpEntry in _normalPriorityEntries.Values.OrderBy(e=>e.Timestamp)) { if (_normalPriorityEntries.TryRemove(lpEntry.Key, out removed)) { evictedBytes += cache.EvictEntry(lpEntry.Key); } if(evictedBytes >= target) break; } if (evictedBytes < target) { foreach(var npEntry in _highPriorityEntries.Values.OrderBy(e=>e.Timestamp)) { if (_highPriorityEntries.TryRemove(npEntry.Key, out removed)) { evictedBytes += cache.EvictEntry(npEntry.Key); } if (evictedBytes >= target) break; } } _evictionCompleted.Set(); } /// <summary> /// Initialize the eviction policy to run on the specified cache /// </summary> /// <param name="cache"></param> public void Initialize(AbstractCache cache) { foreach(var entry in cache.ListEntries()) { NotifyInsert(entry.Key, entry.Size, entry.Priority); } } /// <summary> /// Tracks cache inserts /// </summary> /// <param name="insertedKey">The inserted key</param> /// <param name="size">The size (in bytes) of the inserted value</param> /// <param name="priority">The priority assigned to the inserted cache item</param> public void NotifyInsert(string insertedKey, long size, CachePriority priority) { ConcurrentDictionary<string, TimestampedCacheEntry> queue = null; switch (priority) { case CachePriority.Normal: queue = _normalPriorityEntries; break; case CachePriority.High: queue = _highPriorityEntries; break; } if (queue != null) { queue[insertedKey] = new TimestampedCacheEntry(insertedKey); } } /// <summary> /// Tracks cache removals /// </summary> /// <param name="removedKey">The removed key</param> public void NotifyRemove(string removedKey) { TimestampedCacheEntry removed; if (_normalPriorityEntries.ContainsKey(removedKey)) { _normalPriorityEntries.TryRemove(removedKey, out removed); } if (_highPriorityEntries.ContainsKey(removedKey)) { _highPriorityEntries.TryRemove(removedKey, out removed); } } /// <summary> /// Tracks cache lookups /// </summary> /// <param name="lookupKey">The key accessed</param> public void NotifyLookup(string lookupKey) { TimestampedCacheEntry entry; if (_normalPriorityEntries.TryGetValue(lookupKey, out entry)) entry.Timestamp = DateTime.UtcNow.Ticks; if (_highPriorityEntries.TryGetValue(lookupKey, out entry)) entry.Timestamp = DateTime.UtcNow.Ticks; } private class TimestampedCacheEntry { public string Key { get; private set; } public long Timestamp { get; set; } public TimestampedCacheEntry(string key) { Key = key; Timestamp = DateTime.UtcNow.Ticks; } } } }
kentcb/BrightstarDB
src/core/BrightstarDB/Caching/LruCacheEvictionPolicy.cs
C#
mit
5,618
module.exports={A:{A:{"2":"H D G E A FB","132":"B"},B:{"1":"C p z J L N I"},C:{"2":"4 aB YB","4":"0 2 3 5 6 8 9 H D G E A B C p z J L N I O P Q R S T U V W X Y Z a c d e f g h i j k l m n o M q r s t u v w x y CB AB","8":"F K SB"},D:{"2":"F K H","4":"0 2 3 5 6 8 9 D G E A B C p z J L N I O P Q R S T U V W X Y Z a c d e f g h i j k l m n o M q r s t u v w x y CB AB MB cB GB b HB IB JB KB"},E:{"2":"1 F K H D G E A B C LB DB NB OB PB QB RB TB"},F:{"2":"1 E B C UB VB WB XB BB ZB EB","4":"2 J L N I O P Q R S T U V W X Y Z a c d e f g h i j k l m n o M q r s t u v w x y"},G:{"2":"DB bB","4":"7 G C dB eB fB gB hB iB jB kB lB mB"},H:{"2":"nB"},I:{"2":"oB pB qB","4":"4 7 F b rB sB tB"},J:{"2":"D","4":"A"},K:{"1":"C EB","2":"1 A B BB","4":"M"},L:{"4":"b"},M:{"4":"0"},N:{"1":"B","2":"A"},O:{"4":"uB"},P:{"4":"F K vB wB"},Q:{"4":"xB"},R:{"4":"yB"}},B:4,C:"DeviceOrientation & DeviceMotion events"};
stephaniejn/stephaniejn.github.io
node_modules/caniuse-lite/data/features/deviceorientation.js
JavaScript
mit
898
<?php namespace PHPCR\Util\Console\Command; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use PHPCR\Util\NodeHelper; /** * Command to remove all non-system nodes and properties in the workspace of * the configured session. * * @license http://www.apache.org/licenses Apache License Version 2.0, January 2004 * @license http://opensource.org/licenses/MIT MIT License * * @author Daniel Leech <daniel@dantleech.com> */ class WorkspacePurgeCommand extends BaseCommand { /** * {@inheritDoc} */ protected function configure() { parent::configure(); $this ->setName('phpcr:workspace:purge') ->setDescription('Remove all nodes from a workspace') ->addOption('force', null, InputOption::VALUE_NONE, 'Use to bypass the confirmation dialog') ->setHelp(<<<EOF The <info>phpcr:workspace:purge</info> command removes all nodes except the system nodes and all non-system properties of the root node from the workspace. EOF ) ; } /** * {@inheritDoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $session = $this->getPhpcrSession(); $force = $input->getOption('force'); $workspaceName = $session->getWorkspace()->getName(); if (!$force) { $force = $this->askConfirmation($input, $output, sprintf( '<question>Are you sure you want to purge workspace "%s" Y/N ?</question>', $workspaceName ), false); } if (!$force) { $output->writeln('<error>Aborted</error>'); return 1; } $output->writeln(sprintf('<info>Purging workspace:</info> %s', $workspaceName)); // Using the static NodeHelper is bad for testing as we cannot mock it. NodeHelper::purgeWorkspace($session); $session->save(); return 0; } }
fahadonline/sulu
vendor/phpcr/phpcr-utils/src/PHPCR/Util/Console/Command/WorkspacePurgeCommand.php
PHP
mit
2,054
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0" language="nl"> <defaultcodec>UTF-8</defaultcodec> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="14"/> <source>About Paycoin</source> <translation>Over Paycoin</translation> </message> <message> <location filename="../forms/aboutdialog.ui" line="75"/> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Paycoin&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Paycoin&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> </message> <message> <location filename="../forms/aboutdialog.ui" line="113"/> <source>Copyright © 2014 Paycoin Developers</source> <translation>Copyright © 2014 Paycoin Developers</translation> </message> <message> <location filename="../forms/aboutdialog.ui" line="120"/> <source>Copyright © 2011-2014 Paycoin Developers</source> <translation>Copyright © 2011-2014 Paycoin Developers</translation> </message> <message> <location filename="../forms/aboutdialog.ui" line="133"/> <source>Copyright © 2009-2014 Bitcoin Developers This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file license.txt or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source> <translation>Copyright © 2009-2014 Bitcoin ontwikkelaars Dit is experimentele code. Verspreiding onder de MIT/X11 software licentie, zie de meegeleverde bestand license.txt of http://www.opensource.org/licenses/mit-license.php. Dit product bevat code ontwikkeld door het OpenSSL project voor het gebruik in het OpenSSL raamwerk (http://www.openssl.org/) en cryptografische code geschreven door Eric Young (eay@cryptsoft.com) en UPnP code geschreven door Thomas Bernard.</translation> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="14"/> <source>Address Book</source> <translation>Adresboek</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="20"/> <source>These are your Paycoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation>Dit zijn je Paycoin adressen om bedragen te ontvangen. Je kan een verschillend adres opgeven voor iedere geaddresseerde zodat je kan achterhalen wie jouw betaalt.</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="33"/> <source>Double-click to edit address or label</source> <translation>Dubbelklik om adres of label te wijzigen</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="57"/> <source>Create a new address</source> <translation>Maak een nieuw adres aan</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="60"/> <source>&amp;New Address...</source> <translation>&amp;Nieuw Adres...</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="71"/> <source>Copy the currently selected address to the system clipboard</source> <translation>Kopieer het huidig geselecteerde adres naar het klembord</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="74"/> <source>&amp;Copy to Clipboard</source> <translation>&amp;Kopieer naar Klembord</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="85"/> <source>Show &amp;QR Code</source> <translation>Toon &amp;QR-Code</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="96"/> <source>Sign a message to prove you own this address</source> <translation>Onderteken een bericht om te bewijzen dat u dit adres bezit</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="99"/> <source>&amp;Sign Message</source> <translation>&amp;Onderteken Bericht</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="110"/> <source>Delete the currently selected address from the list. Only sending addresses can be deleted.</source> <translation>Verwijder het huidige geselecteerde adres van de lijst. Alleen verzend-adressen kunnen verwijderd worden, niet uw ontvangstadressen.</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="113"/> <source>&amp;Delete</source> <translation>&amp;Verwijder</translation> </message> <message> <location filename="../addressbookpage.cpp" line="65"/> <source>Copy address</source> <translation>Kopieer adres</translation> </message> <message> <location filename="../addressbookpage.cpp" line="66"/> <source>Copy label</source> <translation>Kopieer label</translation> </message> <message> <location filename="../addressbookpage.cpp" line="67"/> <source>Edit</source> <translation>Bewerk</translation> </message> <message> <location filename="../addressbookpage.cpp" line="68"/> <source>Delete</source> <translation>Verwijder</translation> </message> <message> <location filename="../addressbookpage.cpp" line="273"/> <source>Export Address Book Data</source> <translation>Exporteer Gegevens van het Adresboek</translation> </message> <message> <location filename="../addressbookpage.cpp" line="274"/> <source>Comma separated file (*.csv)</source> <translation>Kommagescheiden bestand (*.csv)</translation> </message> <message> <location filename="../addressbookpage.cpp" line="287"/> <source>Error exporting</source> <translation>Fout bij exporteren</translation> </message> <message> <location filename="../addressbookpage.cpp" line="287"/> <source>Could not write to file %1.</source> <translation>Kon niet schrijven naar bestand %1.</translation> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="79"/> <source>Label</source> <translation>Label</translation> </message> <message> <location filename="../addresstablemodel.cpp" line="79"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../addresstablemodel.cpp" line="115"/> <source>(no label)</source> <translation>(geen label)</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="26"/> <source>Dialog</source> <translation>Dialoog</translation> </message> <message> <location filename="../forms/askpassphrasedialog.ui" line="94"/> <source>TextLabel</source> <translation>TekstLabel</translation> </message> <message> <location filename="../forms/askpassphrasedialog.ui" line="47"/> <source>Enter passphrase</source> <translation>Huidige wachtwoordzin</translation> </message> <message> <location filename="../forms/askpassphrasedialog.ui" line="61"/> <source>New passphrase</source> <translation>Nieuwe wachtwoordzin</translation> </message> <message> <location filename="../forms/askpassphrasedialog.ui" line="75"/> <source>Repeat new passphrase</source> <translation>Herhaal wachtwoordzin</translation> </message> <message> <location filename="../forms/askpassphrasedialog.ui" line="114"/> <source>Toggle Keyboard</source> <translation type="unfinished"></translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="37"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation>Vul een nieuw wachtwoord in voor uw portemonnee. &lt;br/&gt; Gebruik een wachtwoord van &lt;b&gt;10 of meer lukrake karakters&lt;/b&gt;, of &lt;b&gt; acht of meer woorden&lt;/b&gt; . </translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="38"/> <source>Encrypt wallet</source> <translation>Versleutel portemonnee</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="41"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>Deze operatie vereist uw portemonnee wachtwoordzin om de portemonnee te openen.</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="46"/> <source>Unlock wallet</source> <translation>Open portemonnee</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="49"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>Deze operatie vereist uw portemonnee wachtwoordzin om de portemonnee te ontsleutelen</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="54"/> <source>Decrypt wallet</source> <translation>Ontsleutel portemonnee</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="57"/> <source>Change passphrase</source> <translation>Wijzig de wachtwoordzin</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="58"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>Vul uw oude en nieuwe portemonnee wachtwoordzin in.</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="106"/> <source>Confirm wallet encryption</source> <translation>Bevestig versleuteling van de portemonnee</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="116"/> <location filename="../askpassphrasedialog.cpp" line="165"/> <source>Wallet encrypted</source> <translation>Portemonnee versleuteld</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="213"/> <location filename="../askpassphrasedialog.cpp" line="237"/> <source>Warning: The Caps Lock key is on.</source> <translation>Waarschuwing: De Caps-Lock-toets staat aan.</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="122"/> <location filename="../askpassphrasedialog.cpp" line="129"/> <location filename="../askpassphrasedialog.cpp" line="171"/> <location filename="../askpassphrasedialog.cpp" line="177"/> <source>Wallet encryption failed</source> <translation>Portemonneeversleuteling mislukt</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="107"/> <source>WARNING: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR PEERCOINS&lt;/b&gt;! Are you sure you wish to encrypt your wallet?</source> <translation>WAARSCHUWING: Indien je de portemonnee versleutelt en je wachtwoordzin verliest, dan verlies je &lt;b&gt; AL JE PEERCOINS&lt;/b&gt;! Weet je zeker dat je de portemonee wilt versleutelen?</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="117"/> <source>Paycoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your Paycoins from being stolen by malware infecting your computer.</source> <translation>Paycoin sluit nu af om het versleutelings proces te beeindigen. Onthoud dat het versleutelen van de portemonnee je Paycoins niet volledig kan beschermen tegen schadelijke software op een geinfecteerde computer</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="123"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>Portemonneeversleuteling mislukt door een interne fout. Uw portemonnee is niet versleuteld.</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="130"/> <location filename="../askpassphrasedialog.cpp" line="178"/> <source>The supplied passphrases do not match.</source> <translation>De opgegeven wachtwoordzin is niet correct</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="141"/> <source>Wallet unlock failed</source> <translation>Portemonnee openen mislukt</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="142"/> <location filename="../askpassphrasedialog.cpp" line="153"/> <location filename="../askpassphrasedialog.cpp" line="172"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>De opgegeven wachtwoordzin voor de portemonnee-ontsleuteling is niet correct.</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="152"/> <source>Wallet decryption failed</source> <translation>Portemonnee-ontsleuteling mislukt</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="166"/> <source>Wallet passphrase was succesfully changed.</source> <translation>Portemonnee wachtwoordzin is succesvol gewijzigd</translation> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="191"/> <source>&amp;Overview</source> <translation>&amp;Overzicht</translation> </message> <message> <location filename="../bitcoingui.cpp" line="192"/> <source>Show general overview of wallet</source> <translation>Toon algemeen overzicht van de portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="197"/> <source>&amp;Transactions</source> <translation>&amp;Transacties</translation> </message> <message> <location filename="../bitcoingui.cpp" line="198"/> <source>Browse transaction history</source> <translation>Blader door transactieverleden</translation> </message> <message> <location filename="../bitcoingui.cpp" line="203"/> <source>&amp;Minting</source> <translation type="unfinished"></translation> </message> <message> <location filename="../bitcoingui.cpp" line="204"/> <source>Show your minting capacity</source> <translation type="unfinished"></translation> </message> <message> <location filename="../bitcoingui.cpp" line="209"/> <source>&amp;Address Book</source> <translation>&amp;Adresboek</translation> </message> <message> <location filename="../bitcoingui.cpp" line="210"/> <source>Edit the list of stored addresses and labels</source> <translation>Bewerk de lijst van opgeslagen adressen en labels</translation> </message> <message> <location filename="../bitcoingui.cpp" line="215"/> <source>&amp;Receive coins</source> <translation>&amp;Ontvang munten</translation> </message> <message> <location filename="../bitcoingui.cpp" line="216"/> <source>Show the list of addresses for receiving payments</source> <translation>Toon lijst van betalingsadressen</translation> </message> <message> <location filename="../bitcoingui.cpp" line="221"/> <source>&amp;Send coins</source> <translation>&amp;Verstuur munten</translation> </message> <message> <location filename="../bitcoingui.cpp" line="227"/> <source>Sign/Verify &amp;message</source> <translation>Onderteken/verifieer &amp;bericht</translation> </message> <message> <location filename="../bitcoingui.cpp" line="228"/> <source>Prove you control an address</source> <translation>Bewijs dat u een adres bezit</translation> </message> <message> <location filename="../bitcoingui.cpp" line="249"/> <source>E&amp;xit</source> <translation>&amp;Afsluiten</translation> </message> <message> <location filename="../bitcoingui.cpp" line="250"/> <source>Quit application</source> <translation>Programma afsluiten</translation> </message> <message> <location filename="../bitcoingui.cpp" line="254"/> <source>Show information about Paycoin</source> <translation>Toon informatie over Paycoin</translation> </message> <message> <location filename="../bitcoingui.cpp" line="256"/> <source>About &amp;Qt</source> <translation>Over &amp;Qt</translation> </message> <message> <location filename="../bitcoingui.cpp" line="257"/> <source>Show information about Qt</source> <translation>Toon informatie over Qt</translation> </message> <message> <location filename="../bitcoingui.cpp" line="259"/> <source>&amp;Options...</source> <translation>&amp;Opties...</translation> </message> <message> <location filename="../bitcoingui.cpp" line="264"/> <source>&amp;Export...</source> <translation>&amp;Exporteer...</translation> </message> <message> <location filename="../bitcoingui.cpp" line="265"/> <source>Export the data in the current tab to a file</source> <translation>Exporteer de data in de huidige tab naar een bestand</translation> </message> <message> <location filename="../bitcoingui.cpp" line="266"/> <source>&amp;Encrypt Wallet</source> <translation>&amp;Versleutel Portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="267"/> <source>Encrypt or decrypt wallet</source> <translation>Versleutel of ontsleutel portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="269"/> <source>&amp;Unlock Wallet for Minting Only</source> <translation>&amp;Ontsleutel portemonnee alleen om te minten</translation> </message> <message> <location filename="../bitcoingui.cpp" line="270"/> <source>Unlock wallet only for minting. Sending coins will still require the passphrase.</source> <translation>Ontsleutel portemonnee alleen om te minten. Voor het versturen van munten is nog een wachtwoordzin nodig</translation> </message> <message> <location filename="../bitcoingui.cpp" line="272"/> <source>&amp;Backup Wallet</source> <translation>Backup &amp;Portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="273"/> <source>Backup wallet to another location</source> <translation>&amp;Backup portemonnee naar een andere locatie</translation> </message> <message> <location filename="../bitcoingui.cpp" line="274"/> <source>&amp;Change Passphrase</source> <translation>&amp;Wijzig Wachtwoordzin</translation> </message> <message> <location filename="../bitcoingui.cpp" line="275"/> <source>Change the passphrase used for wallet encryption</source> <translation>Wijzig de wachtwoordzin voor uw portemonneversleuteling</translation> </message> <message> <location filename="../bitcoingui.cpp" line="276"/> <source>&amp;Debug window</source> <translation>&amp;Debug scherm</translation> </message> <message> <location filename="../bitcoingui.cpp" line="277"/> <source>Open debugging and diagnostic console</source> <translation>Open debugging en diagnostische console</translation> </message> <message> <location filename="../bitcoingui.cpp" line="301"/> <source>&amp;File</source> <translation>&amp;Bestand</translation> </message> <message> <location filename="../bitcoingui.cpp" line="310"/> <source>&amp;Settings</source> <translation>&amp;Instellingen</translation> </message> <message> <location filename="../bitcoingui.cpp" line="317"/> <source>&amp;Help</source> <translation>&amp;Hulp</translation> </message> <message> <location filename="../bitcoingui.cpp" line="326"/> <source>Tabs toolbar</source> <translation>Tab-werkbalk</translation> </message> <message> <location filename="../bitcoingui.cpp" line="338"/> <source>Actions toolbar</source> <translation>Actie-werkbalk</translation> </message> <message> <location filename="../bitcoingui.cpp" line="350"/> <source>[testnet]</source> <translation>[testnetwerk]</translation> </message> <message> <location filename="../bitcoingui.cpp" line="658"/> <source>This transaction is over the size limit. You can still send it for a fee of %1. Do you want to pay the fee?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../bitcoingui.cpp" line="76"/> <source>Paycoin Wallet</source> <translation>Paycoin portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="222"/> <source>Send coins to a Paycoin address</source> <translation>Zend munten naar een Paycoin adres</translation> </message> <message> <location filename="../bitcoingui.cpp" line="253"/> <source>&amp;About Paycoin</source> <translation>Over Paycoin</translation> </message> <message> <location filename="../bitcoingui.cpp" line="260"/> <source>Modify configuration options for Paycoin</source> <translation>Wijzig configuratie opties voor Paycoin</translation> </message> <message> <location filename="../bitcoingui.cpp" line="262"/> <source>Show/Hide &amp;Paycoin</source> <translation>Toon/Verberg &amp;Paycoin</translation> </message> <message> <location filename="../bitcoingui.cpp" line="263"/> <source>Show or hide the Paycoin window</source> <translation>Toon of verberg het Paycoin scherm</translation> </message> <message> <location filename="../bitcoingui.cpp" line="415"/> <source>Paycoin client</source> <translation>Paycoin client</translation> </message> <message> <location filename="../bitcoingui.cpp" line="443"/> <source>p-qt</source> <translation>p-qt</translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="507"/> <source>%n active connection(s) to Paycoin network</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message> <location filename="../bitcoingui.cpp" line="531"/> <source>Synchronizing with network...</source> <translation>Synchroniseren met netwerk...</translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="533"/> <source>~%n block(s) remaining</source> <translation type="unfinished"> <numerusform>Nog ~%n blok te gaan</numerusform> <numerusform>Nog ~%n blokken te gaan</numerusform> </translation> </message> <message> <location filename="../bitcoingui.cpp" line="544"/> <source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source> <translation>Binnengehaald %1 van %2 blokken met transactie geschiedenis (%3% binnen).</translation> </message> <message> <location filename="../bitcoingui.cpp" line="556"/> <source>Downloaded %1 blocks of transaction history.</source> <translation>%1 blokken van transactiehistorie opgehaald.</translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="571"/> <source>%n second(s) ago</source> <translation type="unfinished"> <numerusform>%n seconde geleden</numerusform> <numerusform>%n seconden geleden</numerusform> </translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="575"/> <source>%n minute(s) ago</source> <translation type="unfinished"> <numerusform>%n minuut geleden</numerusform> <numerusform>%n minuten geleden</numerusform> </translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="579"/> <source>%n hour(s) ago</source> <translation type="unfinished"> <numerusform>%n uur geleden</numerusform> <numerusform>%n uur geleden</numerusform> </translation> </message> <message numerus="yes"> <location filename="../bitcoingui.cpp" line="583"/> <source>%n day(s) ago</source> <translation type="unfinished"> <numerusform>%n dag geleden</numerusform> <numerusform>%n dagen geleden</numerusform> </translation> </message> <message> <location filename="../bitcoingui.cpp" line="589"/> <source>Up to date</source> <translation>Bijgewerkt</translation> </message> <message> <location filename="../bitcoingui.cpp" line="594"/> <source>Catching up...</source> <translation>Aan het bijwerken...</translation> </message> <message> <location filename="../bitcoingui.cpp" line="602"/> <source>Last received block was generated %1.</source> <translation>Laatst ontvangen blok is %1 gegenereerd.</translation> </message> <message> <location filename="../bitcoingui.cpp" line="661"/> <source>Sending...</source> <translation>Versturen...</translation> </message> <message> <location filename="../bitcoingui.cpp" line="688"/> <source>Sent transaction</source> <translation>Verzonden transactie</translation> </message> <message> <location filename="../bitcoingui.cpp" line="689"/> <source>Incoming transaction</source> <translation>Binnenkomende transactie</translation> </message> <message> <location filename="../bitcoingui.cpp" line="690"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation>Datum: %1 Bedrag: %2 Type: %3 Adres: %4 </translation> </message> <message> <location filename="../bitcoingui.cpp" line="821"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked for block minting only&lt;/b&gt;</source> <translation>Portemonnee is &lt;b&gt;versleuteld&lt;/b&gt; en momenteel &lt;b&gt;geopend om blokken te minten&lt;/b&gt;</translation> </message> <message> <location filename="../bitcoingui.cpp" line="821"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>Portemonnee is &lt;b&gt;versleuteld&lt;/b&gt; en momenteel &lt;b&gt;geopend&lt;/b&gt;</translation> </message> <message> <location filename="../bitcoingui.cpp" line="831"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>Portemonnee is &lt;b&gt;versleuteld&lt;/b&gt; en momenteel &lt;b&gt;gesloten&lt;/b&gt;</translation> </message> <message> <location filename="../bitcoingui.cpp" line="888"/> <source>Backup Wallet</source> <translation>Backup Portemonnee</translation> </message> <message> <location filename="../bitcoingui.cpp" line="888"/> <source>Wallet Data (*.dat)</source> <translation>Portemonnee-data (*.dat)</translation> </message> <message> <location filename="../bitcoingui.cpp" line="891"/> <source>Backup Failed</source> <translation>Backup Mislukt</translation> </message> <message> <location filename="../bitcoingui.cpp" line="891"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation>Er is een fout opgetreden bij het wegschrijven van de portemonnee-data naar de nieuwe locatie.</translation> </message> <message> <location filename="../bitcoin.cpp" line="128"/> <source>A fatal error occured. Paycoin can no longer continue safely and will quit.</source> <translation>Een fatale fout heeft plaatsgevonden. Paycoin kan niet langer veilig doorgaan en zal afsluiten.</translation> </message> </context> <context> <name>CoinControlDialog</name> <message> <location filename="../forms/coincontroldialog.ui" line="14"/> <source>Coin Control</source> <translation>Munt Controle</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="45"/> <source>Quantity:</source> <translation>Aantal:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="64"/> <location filename="../forms/coincontroldialog.ui" line="96"/> <source>0</source> <translation>0</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="77"/> <source>Bytes:</source> <translation>Bytes:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="125"/> <source>Amount:</source> <translation>Bedrag:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="144"/> <location filename="../forms/coincontroldialog.ui" line="224"/> <location filename="../forms/coincontroldialog.ui" line="310"/> <location filename="../forms/coincontroldialog.ui" line="348"/> <source>0.00 BTC</source> <translation>123.456 BTC {0.00 ?}</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="157"/> <source>Priority:</source> <translation>Prioriteit:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="205"/> <source>Fee:</source> <translation>Transactiekosten:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="240"/> <source>Low Output:</source> <translation>Kopieer lage uitvoer</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="262"/> <location filename="../coincontroldialog.cpp" line="572"/> <source>no</source> <translation>nee</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="291"/> <source>After Fee:</source> <translation>Na aftrek kosten:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="326"/> <source>Change:</source> <translation>Teruggave:</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="395"/> <source>(un)select all</source> <translation>Alles (de)selecteren</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="408"/> <source>Tree mode</source> <translation>Toon boomstructuur</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="424"/> <source>List mode</source> <translation>Lijst modus</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="469"/> <source>Amount</source> <translation>Bedrag</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="479"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="484"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="489"/> <source>Confirmations</source> <translation>Bevestigingen</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="492"/> <source>Confirmed</source> <translation>Bevestigd</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="497"/> <source>Coin days</source> <translation type="unfinished"></translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="502"/> <source>Priority</source> <translation>Prioriteit</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="36"/> <source>Copy address</source> <translation>Kopieer adres</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="37"/> <source>Copy label</source> <translation>Kopieer label</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="38"/> <location filename="../coincontroldialog.cpp" line="64"/> <source>Copy amount</source> <translation>Kopieer bedrag</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="39"/> <source>Copy transaction ID</source> <translation>Kopieer transactie ID</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="63"/> <source>Copy quantity</source> <translation>Kopieer aantal</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="65"/> <source>Copy fee</source> <translation>Kopieer kosten</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="66"/> <source>Copy after fee</source> <translation>Kopieer na kosten</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="67"/> <source>Copy bytes</source> <translation>Kopieer bytes</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="68"/> <source>Copy priority</source> <translation>Kopieer prioriteit</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="69"/> <source>Copy low output</source> <translation>Kopieer lage uitvoer</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="70"/> <source>Copy change</source> <translation>Kopieer teruggave</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="388"/> <source>highest</source> <translation>hoogste</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="389"/> <source>high</source> <translation>Hoogste</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="390"/> <source>medium-high</source> <translation>medium-hoog</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="391"/> <source>medium</source> <translation>medium</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="395"/> <source>low-medium</source> <translation>laag-medium</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="396"/> <source>low</source> <translation>laag</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="397"/> <source>lowest</source> <translation>laagste</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="572"/> <source>DUST</source> <translation>STOF</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="572"/> <source>yes</source> <translation>ja</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="582"/> <source>This label turns red, if the transaction size is bigger than 10000 bytes. This means a fee of at least %1 per kb is required. Can vary +/- 1 Byte per input.</source> <translation>Dit label kleurt rood, indien de transactie groter is dan 10000 bytes Dit betekent transactie kosten van minstens %1 per kb. Dit kan varieren met +/- 1 byte per invoer</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="583"/> <source>Transactions with higher priority get more likely into a block. This label turns red, if the priority is smaller than &quot;medium&quot;. This means a fee of at least %1 per kb is required.</source> <translation>Transacties met hogere prioriteit komen met grotere waarschijnlijkheid in een blok. Dit label kleurt rood als de prioriteit kleiner dan gemiddeld is. Dit betekent dat de kosten minimaal %1 per kb bedragen.</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="584"/> <source>This label turns red, if any recipient receives an amount smaller than %1. This means a fee of at least %2 is required. Amounts below 0.546 times the minimum relay fee are shown as DUST.</source> <translation>Dit label kleurt rood, indien de verandering kleiner is dan %1. Dit betekent dat de kosten minimaal %2 zijn. Bedragen kleiner dan 0.546 keer de minimum kosten worden weergegeven als STOF.</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="585"/> <source>This label turns red, if the change is smaller than %1. This means a fee of at least %2 is required.</source> <translation>Dit label kleurt rood, indien de verandering kleiner is dan %1. Dit betekent dat de kosten minimaal %2 zijn. Bedragen kleiner dan 0.546 keer de minimum vergoeding worden weergegeven als STOF</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="622"/> <location filename="../coincontroldialog.cpp" line="688"/> <source>(no label)</source> <translation>(geen label)</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="679"/> <source>change from %1 (%2)</source> <translation>gewijzigd van %1 (%2)</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="680"/> <source>(change)</source> <translation>(wijzig)</translation> </message> </context> <context> <name>DisplayOptionsPage</name> <message> <location filename="../optionsdialog.cpp" line="275"/> <source>&amp;Unit to show amounts in: </source> <translation>&amp;Eenheid om bedrag in te tonen:</translation> </message> <message> <location filename="../optionsdialog.cpp" line="279"/> <source>Choose the default subdivision unit to show in the interface, and when sending coins</source> <translation>Kies de standaard onderverdelingseenheid om weer te geven in uw programma, en voor het versturen van munten</translation> </message> <message> <location filename="../optionsdialog.cpp" line="286"/> <source>&amp;Display addresses in transaction list</source> <translation>Toon adressen in transactielijst</translation> </message> <message> <location filename="../optionsdialog.cpp" line="287"/> <source>Whether to show Paycoin addresses in the transaction list</source> <translation>Toon Paycoinadressen in transactielijst</translation> </message> <message> <location filename="../optionsdialog.cpp" line="290"/> <source>Display coin control features (experts only!)</source> <translation>Laat muntcontrole functies zien (alleen voor experts!)</translation> </message> <message> <location filename="../optionsdialog.cpp" line="291"/> <source>Whether to show coin control features or not</source> <translation>Munt controle mogelijkheden of niet</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="14"/> <source>Edit Address</source> <translation>Bewerk Adres</translation> </message> <message> <location filename="../forms/editaddressdialog.ui" line="25"/> <source>&amp;Label</source> <translation>&amp;Label</translation> </message> <message> <location filename="../forms/editaddressdialog.ui" line="35"/> <source>The label associated with this address book entry</source> <translation>Het label dat geassocieerd is met dit adres</translation> </message> <message> <location filename="../forms/editaddressdialog.ui" line="42"/> <source>&amp;Address</source> <translation>&amp;Adres</translation> </message> <message> <location filename="../forms/editaddressdialog.ui" line="52"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation>Het adres dat geassocieerd is met deze adresboek-opgave. Dit kan alleen worden veranderd voor zend-adressen.</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="20"/> <source>New receiving address</source> <translation>Nieuw ontvangstadres</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="24"/> <source>New sending address</source> <translation>Nieuw adres om naar te versturen</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="27"/> <source>Edit receiving address</source> <translation>Bewerk ontvangstadres</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="31"/> <source>Edit sending address</source> <translation>Bewerk verzendadres</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="91"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>Het opgegeven adres &quot;%1&quot; bestaat al in uw adresboek.</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="96"/> <source>The entered address &quot;%1&quot; is not a valid Paycoin address.</source> <translation>Het ingevoerde adres &quot;%1&quot; is geen geldig Paycoin adres.</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="101"/> <source>Could not unlock wallet.</source> <translation>Kon de portemonnee niet openen.</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="106"/> <source>New key generation failed.</source> <translation>Genereren nieuwe sleutel mislukt.</translation> </message> </context> <context> <name>MainOptionsPage</name> <message> <location filename="../optionsdialog.cpp" line="177"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation>&amp;Minimaliseer naar het systeemvak in plaats van de taakbalk</translation> </message> <message> <location filename="../optionsdialog.cpp" line="178"/> <source>Show only a tray icon after minimizing the window</source> <translation>Laat alleen een systeemvak-icoon zien wanneer het venster geminimaliseerd is</translation> </message> <message> <location filename="../optionsdialog.cpp" line="186"/> <source>Map port using &amp;UPnP</source> <translation>Poort mapping via &amp;UPnP</translation> </message> <message> <location filename="../optionsdialog.cpp" line="181"/> <source>M&amp;inimize on close</source> <translation>Minimaliseer bij &amp;sluiten van het venster</translation> </message> <message> <location filename="../optionsdialog.cpp" line="182"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation>Minimaliseer het venster in de plaats van de applicatie af te sluiten als het venster gesloten wordt. Wanneer deze optie aan staan, kan de applicatie alleen worden afgesloten door Afsluiten te kiezen in het menu.</translation> </message> <message> <location filename="../optionsdialog.cpp" line="187"/> <source>Automatically open the Paycoin client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation>Open automatisch de Paycoin client poort op de router. Dit werkt alleen indien je router PnP ondersteund en het geactiveerd is.</translation> </message> <message> <location filename="../optionsdialog.cpp" line="190"/> <source>&amp;Connect through SOCKS4 proxy:</source> <translation>&amp;Verbind via SOCKS4 proxy: </translation> </message> <message> <location filename="../optionsdialog.cpp" line="191"/> <source>Connect to the Bitcon network through a SOCKS4 proxy (e.g. when connecting through Tor)</source> <translation>Verbind met het Paycoin-netwerk door een SOCKS4 proxy (bijv. wanneer Tor gebruikt wordt)</translation> </message> <message> <location filename="../optionsdialog.cpp" line="196"/> <source>Proxy &amp;IP: </source> <translation>Proxy &amp;IP:</translation> </message> <message> <location filename="../optionsdialog.cpp" line="202"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation>IP-adres van de proxy (bijv. 127.0.0.1)</translation> </message> <message> <location filename="../optionsdialog.cpp" line="205"/> <source>&amp;Port: </source> <translation>&amp;Poort:</translation> </message> <message> <location filename="../optionsdialog.cpp" line="211"/> <source>Port of the proxy (e.g. 1234)</source> <translation>Poort waarop de proxy luistert (bijv. 1234)</translation> </message> <message> <location filename="../optionsdialog.cpp" line="217"/> <source>Mandatory network transaction fee per kB transferred. Most transactions are 1 kB and incur a 0.01 PPC fee. Note: transfer size may increase depending on the number of input transactions required to be added together to fund the payment.</source> <translation>Verplichte network transactie kosten per verstuurde kB. De meeste transacties zijn 1kB en kosten 0.01 PPC. Opm. Het aantal verstuurde kB neemt toe afhankelijk van het aantal ingebrachte transacties benodigd om de betaling te kunnen bekostigen.</translation> </message> <message> <location filename="../optionsdialog.cpp" line="223"/> <source>Additional network &amp;fee:</source> <translation>Extra netwerk &amp;kosten</translation> </message> <message> <location filename="../optionsdialog.cpp" line="234"/> <source>Detach databases at shutdown</source> <translation>Ontkoppel database tijdens afsluiten</translation> </message> <message> <location filename="../optionsdialog.cpp" line="235"/> <source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source> <translation>Ontkoppel blok en adres database tijdens afsluiten. Dit betekent dat ze kunnen worden verplaatst naar een andere bestandslokatie, maar het afsluiten is daardoor langzamer. De portomonnee is altijd ontkoppeld.</translation> </message> <message> <location filename="../optionsdialog.cpp" line="172"/> <source>&amp;Start Paycoin on window system startup</source> <translation>Start Paycoin als windows wordt geladen</translation> </message> <message> <location filename="../optionsdialog.cpp" line="173"/> <source>Automatically start Paycoin after the computer is turned on</source> <translation>Start Paycoin automatisch nadat de computer is ingeschakeld</translation> </message> </context> <context> <name>MintingTableModel</name> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>Transaction</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>Age</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>Balance</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>CoinDay</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="203"/> <source>MintProbability</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="284"/> <source>minutes</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="291"/> <source>hours</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="295"/> <source>days</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="298"/> <source>You have %1 chance to find a POS block if you mint %2 %3 at current difficulty.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="418"/> <source>Destination address of the output.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="420"/> <source>Original transaction id.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="422"/> <source>Age of the transaction in days.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="424"/> <source>Balance of the output.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="426"/> <source>Coin age in the output.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingtablemodel.cpp" line="428"/> <source>Chance to mint a block within given time interval.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MintingView</name> <message> <location filename="../mintingview.cpp" line="33"/> <source>transaction is too young</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="40"/> <source>transaction is mature</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="47"/> <source>transaction has reached maximum probability</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="60"/> <source>Display minting probability within : </source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="62"/> <source>10 min</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="63"/> <source>24 hours</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="64"/> <source>30 days</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="65"/> <source>90 days</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="162"/> <source>Export Minting Data</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="163"/> <source>Comma separated file (*.csv)</source> <translation>Kommagescheiden bestand (*.csv)</translation> </message> <message> <location filename="../mintingview.cpp" line="171"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../mintingview.cpp" line="172"/> <source>Transaction</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="173"/> <source>Age</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="174"/> <source>CoinDay</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="175"/> <source>Balance</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="176"/> <source>MintingProbability</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mintingview.cpp" line="180"/> <source>Error exporting</source> <translation>Fout bij exporteren</translation> </message> <message> <location filename="../mintingview.cpp" line="180"/> <source>Could not write to file %1.</source> <translation>Kon niet schrijven naar bestand %1.</translation> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../optionsdialog.cpp" line="81"/> <source>Main</source> <translation>Algemeen</translation> </message> <message> <location filename="../optionsdialog.cpp" line="86"/> <source>Display</source> <translation>Beeldscherm</translation> </message> <message> <location filename="../optionsdialog.cpp" line="106"/> <source>Options</source> <translation>Opties</translation> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="14"/> <source>Form</source> <translation>Vorm</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="40"/> <source>Balance:</source> <translation>Saldo:</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="54"/> <source>Number of transactions:</source> <translation>Aantal transacties:</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="61"/> <source>0</source> <translation>0</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="68"/> <source>Unconfirmed:</source> <translation>Onbevestigd:</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="82"/> <source>Stake:</source> <translation>Inzet:</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="102"/> <source>Wallet</source> <translation>Portemonnee</translation> </message> <message> <location filename="../forms/overviewpage.ui" line="138"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>&lt;b&gt;Recente transacties&lt;/b&gt;</translation> </message> <message> <location filename="../overviewpage.cpp" line="104"/> <source>Your current balance</source> <translation>Uw huidige saldo</translation> </message> <message> <location filename="../overviewpage.cpp" line="109"/> <source>Your current stake</source> <translation>Huidige inzet</translation> </message> <message> <location filename="../overviewpage.cpp" line="114"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation>Totaal aantal transacties dat nog moet worden bevestigd, en nog niet is meegeteld in uw huidige saldo </translation> </message> <message> <location filename="../overviewpage.cpp" line="117"/> <source>Total number of transactions in wallet</source> <translation>Totaal aantal transacties in uw portemonnee</translation> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="14"/> <source>Dialog</source> <translation>Dialoog</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="32"/> <source>QR Code</source> <translation>QR-code</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="55"/> <source>Request Payment</source> <translation>Vraag betaling aan</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="70"/> <source>Amount:</source> <translation>Bedrag:</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="105"/> <source>PPC</source> <translation>PPC</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="121"/> <source>Label:</source> <translation>Label:</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="144"/> <source>Message:</source> <translation>Bericht:</translation> </message> <message> <location filename="../forms/qrcodedialog.ui" line="186"/> <source>&amp;Save As...</source> <translation>&amp;Opslaan Als...</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="46"/> <source>Error encoding URI into QR Code.</source> <translation>Fout in codering URI naar QR-code</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="64"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation>Resultaat URI te lang, probeer de tekst in te korten.</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="121"/> <source>Save Image...</source> <translation>Afbeelding Opslaan...</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="121"/> <source>PNG Images (*.png)</source> <translation>PNG-Afbeeldingen (*.png)</translation> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="14"/> <source>Paycoin (Paycoin) debug window</source> <translation>Paycoin (PPcoin) debug scherm</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="24"/> <source>Information</source> <translation>Informatie</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="33"/> <source>Client name</source> <translation>Client naam</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="40"/> <location filename="../forms/rpcconsole.ui" line="60"/> <location filename="../forms/rpcconsole.ui" line="106"/> <location filename="../forms/rpcconsole.ui" line="156"/> <location filename="../forms/rpcconsole.ui" line="176"/> <location filename="../forms/rpcconsole.ui" line="196"/> <location filename="../forms/rpcconsole.ui" line="229"/> <location filename="../rpcconsole.cpp" line="338"/> <source>N/A</source> <translation>N.v.t.</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="53"/> <source>Client version</source> <translation>Client versie</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="79"/> <source>Version</source> <translation>Versie</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="92"/> <source>Network</source> <translation>Netwerk</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="99"/> <source>Number of connections</source> <translation>Aantal connecties</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="119"/> <source>On testnet</source> <translation>Op testnetwerk</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="142"/> <source>Block chain</source> <translation>Blokkenketen</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="149"/> <source>Current number of blocks</source> <translation>Huidig aantal blokken</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="169"/> <source>Estimated total blocks</source> <translation>Geschat aantal blokken</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="189"/> <source>Last block time</source> <translation>Laaste bloktijd</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="222"/> <source>Build date</source> <translation>Bouwdatum</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="237"/> <source>Console</source> <translation>Console</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="270"/> <source>&gt;</source> <translation>&gt;</translation> </message> <message> <location filename="../forms/rpcconsole.ui" line="286"/> <source>Clear console</source> <translation>Console opschonen</translation> </message> <message> <location filename="../rpcconsole.cpp" line="306"/> <source>Welcome to the Paycoin RPC console.&lt;br&gt;Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.&lt;br&gt;Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>Welkom bij de Paycoin RPC console. &lt;br&gt;Gebruik pijltjes naar boven en naar beneden om de geschiedenis te navigeren, en &lt;b&gt;Ctrl-L&lt;/b&gt; om het scherm te wissen.&lt;br&gt;Typ &lt;b&gt;help&lt;/b&gt; voor een overzicht met commandos.</translation> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="14"/> <location filename="../sendcoinsdialog.cpp" line="176"/> <location filename="../sendcoinsdialog.cpp" line="181"/> <location filename="../sendcoinsdialog.cpp" line="186"/> <location filename="../sendcoinsdialog.cpp" line="191"/> <location filename="../sendcoinsdialog.cpp" line="197"/> <location filename="../sendcoinsdialog.cpp" line="202"/> <location filename="../sendcoinsdialog.cpp" line="207"/> <source>Send Coins</source> <translation>Verstuur munten</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="90"/> <source>Coin Control Features</source> <translation>Munt controle opties</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="110"/> <source>Inputs...</source> <translation>Toevoer...</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="117"/> <source>automatically selected</source> <translation>automatisch geselecteerd</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="136"/> <source>Insufficient funds!</source> <translation>Onvoldoende fondsen!</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="213"/> <source>Quantity:</source> <translation>Aantal:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="235"/> <location filename="../forms/sendcoinsdialog.ui" line="270"/> <source>0</source> <translation>0</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="251"/> <source>Bytes:</source> <translation>Bytes:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="302"/> <source>Amount:</source> <translation>Bedrag:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="324"/> <location filename="../forms/sendcoinsdialog.ui" line="410"/> <location filename="../forms/sendcoinsdialog.ui" line="496"/> <location filename="../forms/sendcoinsdialog.ui" line="528"/> <source>0.00 BTC</source> <translation>123.456 BTC {0.00 ?}</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="337"/> <source>Priority:</source> <translation>Prioriteit:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="356"/> <source>medium</source> <translation>medium</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="388"/> <source>Fee:</source> <translation>Transactiekosten:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="423"/> <source>Low Output:</source> <translation>Kopieer lage uitvoer</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="442"/> <source>no</source> <translation>nee</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="474"/> <source>After Fee:</source> <translation>Na aftrek kosten:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="509"/> <source>Change</source> <translation>Teruggave</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="559"/> <source>custom change address</source> <translation>zelfopgegeven teruggaveadres</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="665"/> <source>Send to multiple recipients at once</source> <translation>Verstuur aan verschillende ontvangers tegelijkertijd</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="668"/> <source>&amp;Add recipient...</source> <translation>Voeg &amp;ontvanger toe...</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="685"/> <source>Remove all transaction fields</source> <translation>Verwijder alle transactievelden</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="688"/> <source>Clear all</source> <translation>Verwijder alles</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="707"/> <source>Balance:</source> <translation>Saldo:</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="714"/> <source>123.456 BTC</source> <translation>123.456 BTC</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="745"/> <source>Confirm the send action</source> <translation>Bevestig de verstuuractie</translation> </message> <message> <location filename="../forms/sendcoinsdialog.ui" line="748"/> <source>&amp;Send</source> <translation>&amp;Verstuur</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="51"/> <source>Copy quantity</source> <translation>Kopieer aantal</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="52"/> <source>Copy amount</source> <translation>Kopieer bedrag</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="53"/> <source>Copy fee</source> <translation>Kopieer kosten</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="54"/> <source>Copy after fee</source> <translation>Kopieer na kosten</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="55"/> <source>Copy bytes</source> <translation>Kopieer bytes</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="56"/> <source>Copy priority</source> <translation>Kopieer prioriteit</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="57"/> <source>Copy low output</source> <translation>Kopieer lage uitvoer</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="58"/> <source>Copy change</source> <translation>Kopieer teruggave</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="144"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation>&lt;b&gt;%1&lt;/b&gt; aan %2 (%3)</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="149"/> <source>Confirm send coins</source> <translation>Bevestig versturen munten</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="150"/> <source>Are you sure you want to send %1?</source> <translation>Weet u zeker dat u %1 wil versturen?</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="150"/> <source> and </source> <translation> en </translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="182"/> <source>The amount to pay must be at least one cent (0.01).</source> <translation>Het te betalen bedrag moet minimaal een cent zijn (0.01).</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="457"/> <source>Warning: Invalid Bitcoin address</source> <translation>Waarschuwing: Ongeldig Paycoin adres</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="466"/> <source>Warning: Unknown change address</source> <translation>Waarschuwing: onbekend teruggave adres</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="477"/> <source>(no label)</source> <translation>(geen label)</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="187"/> <source>Amount exceeds your balance</source> <translation>Bedrag overschrijdt uw huidige saldo</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="36"/> <source>Enter a Paycoin address</source> <translation>Voer een Paycoin adres in</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="177"/> <source>The recipient address is not valid, please recheck.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="192"/> <source>Total exceeds your balance when the %1 transaction fee is included</source> <translation>Totaal overschrijdt uw huidige saldo wanneer de %1 transactiekosten worden meegerekend</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="198"/> <source>Duplicate address found, can only send to each address once in one send operation</source> <translation>Dubbel adres gevonden, u kunt slechts eenmaal per verzendtransactie naar een bepaald adres versturen</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="203"/> <source>Error: Transaction creation failed </source> <translation>Fout: Aanmaak transactie mislukt</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="208"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation>Fout: De transactie was afgewezen. Dit kan gebeuren als u eerder uitgegeven munten opnieuw wilt versturen, zoals wanneer u een kopie van uw wallet.dat heeft gebruikt en in de kopie deze munten zijn gemarkeerd als uitgegeven, maar in de huidige nog niet.</translation> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="14"/> <source>Form</source> <translation>Vorm</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="29"/> <source>A&amp;mount:</source> <translation>Bedra&amp;g:</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="42"/> <source>Pay &amp;To:</source> <translation>Betaal &amp;Aan:</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="66"/> <location filename="../sendcoinsentry.cpp" line="26"/> <source>Enter a label for this address to add it to your address book</source> <translation>Vul een label in voor dit adres om het toe te voegen aan uw adresboek</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="75"/> <source>&amp;Label:</source> <translation>&amp;Label:</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="93"/> <source>The address to send the payment to</source> <translation>Het verzendadres voor de betaling</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="103"/> <source>Choose address from address book</source> <translation>Kies adres uit adresboek</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="113"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="120"/> <source>Paste address from clipboard</source> <translation>Plak adres vanuit klembord</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="130"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location filename="../forms/sendcoinsentry.ui" line="137"/> <source>Remove this recipient</source> <translation>Verwijder deze ontvanger</translation> </message> <message> <location filename="../sendcoinsentry.cpp" line="25"/> <source>Enter a Paycoin address</source> <translation>Voer een Paycoin adres in</translation> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="14"/> <source>Signatures - Sign / Verify a Message</source> <translation>Ondertekeningen - Onderteken / verifieer een bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="24"/> <source>&amp;Sign Message</source> <translation>&amp;Onderteken Bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="30"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation>U kunt berichten ondertekenen met een van uw adressen om te bewijzen dat u dit adres bezit. Pas op dat u geen onduidelijke dingen ondertekent, want phishingaanvallen zouden u voor de gek kunnen houden om zo uw identiteit te stelen. Onderteken alleen berichten waarmee u het volledig eens bent.</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="48"/> <source>The address to sign the message with</source> <translation>Het ondertekenings adres voor het bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="55"/> <location filename="../forms/signverifymessagedialog.ui" line="265"/> <source>Choose previously used address</source> <translation>Kies eerder gebruikt adres</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="65"/> <location filename="../forms/signverifymessagedialog.ui" line="275"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="75"/> <source>Paste address from clipboard</source> <translation>Plak adres vanuit klembord</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="85"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="97"/> <source>Enter the message you want to sign here</source> <translation>Typ hier het bericht dat u wilt ondertekenen</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="104"/> <source>Signature</source> <translation>Ondertekening</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="131"/> <source>Copy the current signature to the system clipboard</source> <translation>Kopieer de huidige onderteking naar het systeem klembord</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="152"/> <source>Sign the message to prove you own this Paycoin address</source> <translation>Bewijs dat je dit Paycoin adres bezit door het te ondertekenen </translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="155"/> <source>Sign &amp;Message</source> <translation>Onderteken &amp;Bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="169"/> <source>Reset all sign message fields</source> <translation>Herinitialiseer alle ondertekende bericht velden</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="172"/> <location filename="../forms/signverifymessagedialog.ui" line="315"/> <source>Clear &amp;All</source> <translation>&amp;Alles wissen</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="231"/> <source>&amp;Verify Message</source> <translation>&amp;Verifieer bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="237"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation>Voer hieronder het ondertekeningsadres in, het bericht (vergeet niet precies alle regelafbrekingen, spaties, tabulaties, etc. in te voeren) en ondertekening om het bericht te verifieren. Wees voorzichtig om verder te lezen waar de tekst niet deel uitmaakt van het ondertekende bericht, dit om te voorkomen dat je verleid wordt door een man-in-het-midden aanval.</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="258"/> <source>The address the message was signed with</source> <translation>Het adres waarmee het bericht getekend was</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="295"/> <source>Verify the message to ensure it was signed with the specified Paycoin address</source> <translation>Verifieer het bericht om vast te stellen dat het bericht ondertekend was met het gespecificeerde Paycoin adres</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="298"/> <source>Verify &amp;Message</source> <translation>&amp;Verifieer bericht</translation> </message> <message> <location filename="../forms/signverifymessagedialog.ui" line="312"/> <source>Reset all verify message fields</source> <translation>Herinitialiseer alle geverifieerde bericht velden</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="29"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation>Klik &apos;Onderteken bericht&apos; om te ondertekenen</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="30"/> <source>Enter the signature of the message</source> <translation>Voer de ondertekening in voor het bericht</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="31"/> <location filename="../signverifymessagedialog.cpp" line="32"/> <source>Enter a Paycoin address</source> <translation>Voer een Paycoin adres in</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="115"/> <location filename="../signverifymessagedialog.cpp" line="195"/> <source>The entered address is invalid.</source> <translation>Het ingevoerde adres is onjuist</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="115"/> <location filename="../signverifymessagedialog.cpp" line="123"/> <location filename="../signverifymessagedialog.cpp" line="195"/> <location filename="../signverifymessagedialog.cpp" line="203"/> <source>Please check the address and try again.</source> <translation>Controleer het adres and probeer opnieuw.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="123"/> <location filename="../signverifymessagedialog.cpp" line="203"/> <source>The entered address does not refer to a key.</source> <translation>Het ingevoerde adres refereert niet naar een sleutel</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="131"/> <source>Wallet unlock was cancelled.</source> <translation>Portemonnee ontsleuteling is afgebroken.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="139"/> <source>Private key for the entered address is not available.</source> <translation>Geheime sleutel voor het ingevoerde adres is niet beschikbaar.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="151"/> <source>Message signing failed.</source> <translation>Bericht ondertekening mislukt.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="156"/> <source>Message signed.</source> <translation>Bericht ontedertekend.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="214"/> <source>The signature could not be decoded.</source> <translation>De ondertekeing kan niet worden ontcijferd.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="214"/> <location filename="../signverifymessagedialog.cpp" line="227"/> <source>Please check the signature and try again.</source> <translation>Controleer de ondertekening and probeer opnieuw.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="227"/> <source>The signature did not match the message digest.</source> <translation>De ondertekening komt niet overeen met de bericht samenvatting.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="234"/> <source>Message verification failed.</source> <translation>Bericht verficatie mislukt.</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="239"/> <source>Message verified.</source> <translation>Bericht geverifieerd.</translation> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="21"/> <source>Open for %1 blocks</source> <translation>Openen voor %1 blokken</translation> </message> <message> <location filename="../transactiondesc.cpp" line="23"/> <source>Open until %1</source> <translation>Open tot %1</translation> </message> <message> <location filename="../transactiondesc.cpp" line="29"/> <source>%1/offline?</source> <translation>%1/niet verbonden?</translation> </message> <message> <location filename="../transactiondesc.cpp" line="31"/> <source>%1/unconfirmed</source> <translation>%1/onbevestigd</translation> </message> <message> <location filename="../transactiondesc.cpp" line="33"/> <source>%1 confirmations</source> <translation>%1 bevestigingen</translation> </message> <message> <location filename="../transactiondesc.cpp" line="51"/> <source>&lt;b&gt;Status:&lt;/b&gt; </source> <translation>&lt;b&gt;Status:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="56"/> <source>, has not been successfully broadcast yet</source> <translation>, is nog niet succesvol uitgezonden</translation> </message> <message> <location filename="../transactiondesc.cpp" line="58"/> <source>, broadcast through %1 node</source> <translation>, uitgezonden naar %1 node</translation> </message> <message> <location filename="../transactiondesc.cpp" line="60"/> <source>, broadcast through %1 nodes</source> <translation>, uitgezonden naar %1 nodes</translation> </message> <message> <location filename="../transactiondesc.cpp" line="64"/> <source>&lt;b&gt;Date:&lt;/b&gt; </source> <translation>&lt;b&gt;Datum:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="71"/> <source>&lt;b&gt;Source:&lt;/b&gt; Generated&lt;br&gt;</source> <translation>&lt;b&gt;Bron:&lt;/b&gt;Gegenereerd&lt;br&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="77"/> <location filename="../transactiondesc.cpp" line="94"/> <source>&lt;b&gt;From:&lt;/b&gt; </source> <translation>&lt;b&gt;Van:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="94"/> <source>unknown</source> <translation>onbekend</translation> </message> <message> <location filename="../transactiondesc.cpp" line="95"/> <location filename="../transactiondesc.cpp" line="118"/> <location filename="../transactiondesc.cpp" line="178"/> <source>&lt;b&gt;To:&lt;/b&gt; </source> <translation>&lt;b&gt; Aan:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="98"/> <source> (yours, label: </source> <translation>(Uw adres, label:</translation> </message> <message> <location filename="../transactiondesc.cpp" line="100"/> <source> (yours)</source> <translation>(uw)</translation> </message> <message> <location filename="../transactiondesc.cpp" line="136"/> <location filename="../transactiondesc.cpp" line="150"/> <location filename="../transactiondesc.cpp" line="195"/> <location filename="../transactiondesc.cpp" line="212"/> <source>&lt;b&gt;Credit:&lt;/b&gt; </source> <translation>&lt;b&gt;Bij:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="138"/> <source>(%1 matures in %2 more blocks)</source> <translation>(%1 komt beschikbaar na %2 blokken)</translation> </message> <message> <location filename="../transactiondesc.cpp" line="142"/> <source>(not accepted)</source> <translation>(niet geaccepteerd)</translation> </message> <message> <location filename="../transactiondesc.cpp" line="186"/> <location filename="../transactiondesc.cpp" line="194"/> <location filename="../transactiondesc.cpp" line="209"/> <source>&lt;b&gt;Debit:&lt;/b&gt; </source> <translation>&lt;b&gt;Af:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="200"/> <source>&lt;b&gt;Transaction fee:&lt;/b&gt; </source> <translation>&lt;b&gt;Transactiekosten:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="218"/> <source>&lt;b&gt;Net amount:&lt;/b&gt; </source> <translation>&lt;b&gt;Netto bedrag:&lt;/b&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="220"/> <source>&lt;b&gt;Retained amount:&lt;/b&gt; %1 until %2 more blocks&lt;br&gt;</source> <translation>&lt;b&gt;Vastgehouden bedrag: &lt;/b&gt; %1 totdat %2 meer blokken&lt;br&gt;</translation> </message> <message> <location filename="../transactiondesc.cpp" line="227"/> <source>Message:</source> <translation>Bericht:</translation> </message> <message> <location filename="../transactiondesc.cpp" line="229"/> <source>Comment:</source> <translation>Opmerking:</translation> </message> <message> <location filename="../transactiondesc.cpp" line="231"/> <source>Transaction ID:</source> <translation>Transactie-ID:</translation> </message> <message> <location filename="../transactiondesc.cpp" line="234"/> <source>Generated coins must wait 520 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to &quot;not accepted&quot; and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation>Gegeneerde munten moeten 120 blokken wachten voor ze kunnen worden uitgegeven. Uw net gegenereerde blok is uitgezonden aan het netwerk om te worden toegevoegd aan de blokkenketen. Als het niet wordt geaccepteerd in de keten, zal het blok als &quot;ongeldig&quot; worden aangemerkt en kan het niet worden uitgegeven. Dit kan soms gebeuren als een andere node net iets sneller een blok heeft gegenereerd; een paar seconden voor het uwe. {520 ?}</translation> </message> <message> <location filename="../transactiondesc.cpp" line="236"/> <source>Staked coins must wait 520 blocks before they can return to balance and be spent. When you generated this proof-of-stake block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to &quot;not accepted&quot; and not be a valid stake. This may occasionally happen if another node generates a proof-of-stake block within a few seconds of yours.</source> <translation>Gegenereerde munten moeten 520 blokken wachten voor ze kunnen worden uitgegeven. Uw net gegenereerde blok is uitgezonden aan het netwerk om te worden toegevoegd aan de blokkenketen. Als het niet wordt geaccepteerd in de keten, zal het blok als &quot;ongeldig&quot; worden aangemerkt en kan het niet worden uitgegeven. Dit kan soms gebeuren als een andere node net iets sneller een blok heeft gegenereerd; een paar seconden voor het uwe.</translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="14"/> <source>Transaction details</source> <translation>Transactiedetails</translation> </message> <message> <location filename="../forms/transactiondescdialog.ui" line="20"/> <source>This pane shows a detailed description of the transaction</source> <translation>Dit venster laat een uitgebreide beschrijving van de transactie zien</translation> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="214"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="214"/> <source>Type</source> <translation>Type</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="214"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="214"/> <source>Amount</source> <translation>Bedrag</translation> </message> <message numerus="yes"> <location filename="../transactiontablemodel.cpp" line="281"/> <source>Open for %n block(s)</source> <translation> <numerusform>Open gedurende %n blok</numerusform> <numerusform>Open gedurende %n blokken</numerusform> </translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="284"/> <source>Open until %1</source> <translation>Open tot %1</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="287"/> <source>Offline (%1 confirmations)</source> <translation>Niet verbonden (%1 bevestigingen)</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="290"/> <source>Unconfirmed (%1 of %2 confirmations)</source> <translation>Onbevestigd (%1 van %2 bevestigd)</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="293"/> <source>Confirmed (%1 confirmations)</source> <translation>Bevestigd (%1 bevestigingen)</translation> </message> <message numerus="yes"> <location filename="../transactiontablemodel.cpp" line="301"/> <source>Mined balance will be available in %n more blocks</source> <translation> <numerusform>Ontgonnen saldo komt beschikbaar na %n blok</numerusform> <numerusform>Ontgonnen saldo komt beschikbaar na %n blokken</numerusform> </translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="307"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation>Dit blok is niet ontvangen bij andere nodes en zal waarschijnlijk niet worden geaccepteerd!</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="310"/> <source>Generated but not accepted</source> <translation>Gegenereerd maar niet geaccepteerd</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="353"/> <source>Received with</source> <translation>Ontvangen met</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="355"/> <source>Received from</source> <translation>Ontvangen van</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="358"/> <source>Sent to</source> <translation>Verzonden aan</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="360"/> <source>Payment to yourself</source> <translation>Betaling aan uzelf</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="362"/> <source>Mined</source> <translation>Ontgonnen</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="364"/> <source>Mint by stake</source> <translation>Minten met inzet</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="403"/> <source>(n/a)</source> <translation>(nvt)</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="603"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation>Transactiestatus. Houd de muiscursor boven dit veld om het aantal bevestigingen te laten zien.</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="605"/> <source>Date and time that the transaction was received.</source> <translation>Datum en tijd waarop deze transactie is ontvangen.</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="607"/> <source>Type of transaction.</source> <translation>Type transactie.</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="609"/> <source>Destination address of transaction.</source> <translation>Ontvangend adres van transactie</translation> </message> <message> <location filename="../transactiontablemodel.cpp" line="611"/> <source>Amount removed from or added to balance.</source> <translation>Bedrag verwijderd van of toegevoegd aan saldo</translation> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="55"/> <location filename="../transactionview.cpp" line="71"/> <source>All</source> <translation>Alles</translation> </message> <message> <location filename="../transactionview.cpp" line="56"/> <source>Today</source> <translation>Vandaag</translation> </message> <message> <location filename="../transactionview.cpp" line="57"/> <source>This week</source> <translation>Deze week</translation> </message> <message> <location filename="../transactionview.cpp" line="58"/> <source>This month</source> <translation>Deze maand</translation> </message> <message> <location filename="../transactionview.cpp" line="59"/> <source>Last month</source> <translation>Vorige maand</translation> </message> <message> <location filename="../transactionview.cpp" line="60"/> <source>This year</source> <translation>Dit jaar</translation> </message> <message> <location filename="../transactionview.cpp" line="61"/> <source>Range...</source> <translation>Bereik...</translation> </message> <message> <location filename="../transactionview.cpp" line="72"/> <source>Received with</source> <translation>Ontvangen met</translation> </message> <message> <location filename="../transactionview.cpp" line="74"/> <source>Sent to</source> <translation>Verzonden aan</translation> </message> <message> <location filename="../transactionview.cpp" line="76"/> <source>To yourself</source> <translation>Aan uzelf</translation> </message> <message> <location filename="../transactionview.cpp" line="77"/> <source>Mined</source> <translation>Ontgonnen</translation> </message> <message> <location filename="../transactionview.cpp" line="78"/> <source>Mint by stake</source> <translation>Minten met inzet</translation> </message> <message> <location filename="../transactionview.cpp" line="79"/> <source>Other</source> <translation>Anders</translation> </message> <message> <location filename="../transactionview.cpp" line="85"/> <source>Enter address or label to search</source> <translation>Vul adres of label in om te zoeken</translation> </message> <message> <location filename="../transactionview.cpp" line="91"/> <source>Min amount</source> <translation>Min. bedrag</translation> </message> <message> <location filename="../transactionview.cpp" line="125"/> <source>Copy address</source> <translation>Kopieer adres</translation> </message> <message> <location filename="../transactionview.cpp" line="126"/> <source>Copy label</source> <translation>Kopieer label</translation> </message> <message> <location filename="../transactionview.cpp" line="127"/> <source>Copy amount</source> <translation>Kopieer bedrag</translation> </message> <message> <location filename="../transactionview.cpp" line="128"/> <source>Edit label</source> <translation>Bewerk label</translation> </message> <message> <location filename="../transactionview.cpp" line="129"/> <source>Show details...</source> <translation>Toon details...</translation> </message> <message> <location filename="../transactionview.cpp" line="130"/> <source>Clear orphans</source> <translation type="unfinished"></translation> </message> <message> <location filename="../transactionview.cpp" line="273"/> <source>Export Transaction Data</source> <translation>Exporteer transactiegegevens</translation> </message> <message> <location filename="../transactionview.cpp" line="274"/> <source>Comma separated file (*.csv)</source> <translation>Kommagescheiden bestand (*.csv)</translation> </message> <message> <location filename="../transactionview.cpp" line="282"/> <source>Confirmed</source> <translation>Bevestigd</translation> </message> <message> <location filename="../transactionview.cpp" line="283"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location filename="../transactionview.cpp" line="284"/> <source>Type</source> <translation>Type</translation> </message> <message> <location filename="../transactionview.cpp" line="285"/> <source>Label</source> <translation>Label</translation> </message> <message> <location filename="../transactionview.cpp" line="286"/> <source>Address</source> <translation>Adres</translation> </message> <message> <location filename="../transactionview.cpp" line="287"/> <source>Amount</source> <translation>Bedrag</translation> </message> <message> <location filename="../transactionview.cpp" line="288"/> <source>ID</source> <translation>ID</translation> </message> <message> <location filename="../transactionview.cpp" line="292"/> <source>Error exporting</source> <translation>Fout bij exporteren</translation> </message> <message> <location filename="../transactionview.cpp" line="292"/> <source>Could not write to file %1.</source> <translation>Kon niet schrijven naar bestand %1.</translation> </message> <message> <location filename="../transactionview.cpp" line="400"/> <source>Range:</source> <translation>Bereik:</translation> </message> <message> <location filename="../transactionview.cpp" line="408"/> <source>to</source> <translation>naar</translation> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="164"/> <source>Sending...</source> <translation>Versturen...</translation> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="11"/> <source>Warning: Disk space is low </source> <translation>Waarschuwing: Weinig schijfruimte over </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="13"/> <source>Usage:</source> <translation>Gebruik:</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="8"/> <source>Unable to bind to port %d on this computer. Paycoin is probably already running.</source> <translation>Onmogelijk om poort %d te verbinden op deze computer. Paycoin is mogelijk al eerder opgestart.</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="12"/> <source>Paycoin version</source> <translation>Paycoin versie</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="14"/> <source>Send command to -server or paycoind</source> <translation>Zend commando naar -server of paycoind</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="15"/> <source>List commands</source> <translation>List van commando&apos;s </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="16"/> <source>Get help for a command</source> <translation>Toon hulp voor een commando </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="17"/> <source>Options:</source> <translation>Opties: </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="18"/> <source>Specify configuration file (default: paycoin.conf)</source> <translation>Configuratiebestand specificeren (standaard: paycoin.conf)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="19"/> <source>Specify pid file (default: paycoind.pid)</source> <translation>Specifieer pid-bestand (standaard: paycoind.pid) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="20"/> <source>Generate coins</source> <translation>Genereer munten </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="21"/> <source>Don&apos;t generate coins</source> <translation>Genereer geen munten</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="22"/> <source>Start minimized</source> <translation>Geminimaliseerd starten </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="23"/> <source>Show splash screen on startup (default: 1)</source> <translation>Toon welkom scherm bij het opstarten (standaard: 1)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="24"/> <source>Specify data directory</source> <translation>Stel datamap in </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="25"/> <source>Set database cache size in megabytes (default: 25)</source> <translation>Database cache instellen in Mb (standaard: 25)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="26"/> <source>Set database disk log size in megabytes (default: 100)</source> <translation>Database logbestandgrootte instellen in Mb (standaard: 100)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="27"/> <source>Specify connection timeout (in milliseconds)</source> <translation>Specificeer de time-out tijd (in milliseconden) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="28"/> <source>Connect through socks4 proxy</source> <translation>Verbind via socks4 proxy </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="29"/> <source>Allow DNS lookups for addnode and connect</source> <translation>Sta DNS-naslag toe voor addnode en connect </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="30"/> <source>Listen for connections on &lt;port&gt; (default: 9901 or testnet: 9903)</source> <translation>Luister voor verbindingen op &lt;port&gt; (standaard:9901 of testnet: 9903)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="31"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation>Onderhoud maximaal &lt;n&gt; verbindingen naar peers (standaard: 125)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="32"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>Maak connectie met een node en houd deze open</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="33"/> <source>Connect only to the specified node</source> <translation>Verbind alleen met deze node </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="34"/> <source>Find peers using internet relay chat (default: 0)</source> <translation>Zoek anderen via internet chat (standaard: 0)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="35"/> <source>Accept connections from outside (default: 1)</source> <translation>Connecties van buiten accepteren (standaard: 1)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="36"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation>Taal instellen, bijv &quot;de_DE&quot; (standaard: system locale)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="37"/> <source>Find peers using DNS lookup (default: 1)</source> <translation>Zoek anderen via DNS (standaard: 1)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="38"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation>Drempel om verbinding te verbreken naar zich misdragende peers (standaard: 100)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="39"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation>Aantal seconden dat zich misdragende peers niet opnieuw mogen verbinden (standaard: 86400)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="42"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 10000)</source> <translation>Maximale ontvangstbuffer per connectie, &lt;n&gt;*1000 bytes (standaard: 10000)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="43"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 10000)</source> <translation>Maximale zendbuffer per connectie, &lt;n&gt;*1000 bytes (standaard: 10000)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="44"/> <source>Use Universal Plug and Play to map the listening port (default: 1)</source> <translation>Gebruik uPNP om de netwerk poort in te delen (standaard 1)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="45"/> <source>Use Universal Plug and Play to map the listening port (default: 0)</source> <translation>Gebruik uPNP om de netwerkpoort in te delen (standaard 0)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="46"/> <source>Fee per KB to add to transactions you send</source> <translation>Kosten per kB voor te versturen transacties</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="47"/> <source>Accept command line and JSON-RPC commands</source> <translation>Aanvaard commandoregel en JSON-RPC commando&apos;s </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="48"/> <source>Run in the background as a daemon and accept commands</source> <translation>Draai in de achtergrond als daemon en aanvaard commando&apos;s </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="49"/> <source>Use the test network</source> <translation>Gebruik het testnetwerk </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="50"/> <source>Output extra debugging information</source> <translation>Toon extra debuggingsinformatie</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="51"/> <source>Prepend debug output with timestamp</source> <translation>Voorzie de debuggingsuitvoer van een tijdsaanduiding</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="52"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation>Stuur opsporing/debug-info naar de console in plaats van het debug.log bestand</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="53"/> <source>Send trace/debug info to debugger</source> <translation>Stuur opsporings/debug-info naar debugger</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="54"/> <source>Username for JSON-RPC connections</source> <translation>Gebruikersnaam voor JSON-RPC verbindingen </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="55"/> <source>Password for JSON-RPC connections</source> <translation>Wachtwoord voor JSON-RPC verbindingen </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="56"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 9902)</source> <translation>Luister voor JSON-RPC verbindingen op &lt;port&gt; (standaard: 9902) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="57"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>Sta JSON-RPC verbindingen van opgegeven IP adres toe </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="58"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation>Verstuur commando&apos;s naar proces dat op &lt;ip&gt; draait (standaard: 127.0.0.1) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="59"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>Voer commando uit indien het hoogste blok verandert (%s in cmd is herplaats met blok hash)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="62"/> <source>Upgrade wallet to latest format</source> <translation>Opwaardeer portemonnee naar laatste formaat</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="63"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation>Stel sleutelpoelgrootte in op &lt;n&gt; (standaard: 100) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="64"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>Doorzoek de blokkenketen op ontbrekende portemonnee-transacties</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="65"/> <source>How many blocks to check at startup (default: 2500, 0 = all)</source> <translation>Aantal blokken bij opstarten controleren (standaard: 2500, 0 = alle)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="66"/> <source>How thorough the block verification is (0-6, default: 1)</source> <translation>Grondigheid blok verificatie (0-6, standaard: 1)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="67"/> <source> SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source> <translation>SSL opties: (zie de Bitcoin wiki voor SSL installatie instructies)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="70"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>Gebruik OpenSSL (https) voor JSON-RPC verbindingen </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="71"/> <source>Server certificate file (default: server.cert)</source> <translation>Certificaat-bestand voor server (standaard: server.cert) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="72"/> <source>Server private key (default: server.pem)</source> <translation>Geheime sleutel voor server (standaard: server.pem) </translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="73"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation>Aanvaardbare sleuteltypen (standaard: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="76"/> <source>This help message</source> <translation>Dit hulpbericht</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="77"/> <source>Usage</source> <translation>Gebruik</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="78"/> <source>Cannot obtain a lock on data directory %s. Paycoin is probably already running.</source> <translation>Blokkeren van data folder %s is niet gelukt. Paycoin is mogelijk al opgestart.</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="81"/> <source>Paycoin</source> <translation>Paycoin</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="88"/> <source>Error loading wallet.dat: Wallet requires newer version of Paycoin</source> <translation>Fout geconstateerd bij het laden van wallet.dat: Portemonnee vereist een nieuwere versie van Paycoin</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="89"/> <source>Wallet needed to be rewritten: restart Paycoin to complete</source> <translation>Portemonnee dient opnieuw bewerkt te worden: start Paycoin opnieuw op om te voltooien</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="103"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=paycoinrpc rpcpassword=%s (you do not need to remember this password) If the file does not exist, create it with owner-readable-only file permissions. </source> <translation type="unfinished"></translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="119"/> <source>Warning: Please check that your computer&apos;s date and time are correct. If your clock is wrong Paycoin will not work properly.</source> <translation>Waarschuwing: controleer of de datum en tijd op uw computer correct zijn. Indien uw klok verkeerd staat, zal Paycoin niet goed werken</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="82"/> <source>Loading addresses...</source> <translation>Adressen aan het laden...</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="83"/> <source>Error loading addr.dat</source> <translation>Fout bij laden addr.dat</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="84"/> <source>Loading block index...</source> <translation>Blokindex aan het laden...</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="85"/> <source>Error loading blkindex.dat</source> <translation>Fout bij laden blkindex.dat</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="86"/> <source>Loading wallet...</source> <translation>Portemonnee aan het laden...</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="87"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>Fout bij laden wallet.dat: Portemonnee corrupt</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="90"/> <source>Error loading wallet.dat</source> <translation>Fout bij laden wallet.dat</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="91"/> <source>Cannot downgrade wallet</source> <translation>Kan portemonnee niet degraderen</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="92"/> <source>Cannot initialize keypool</source> <translation>Kan sleutelpoel niet initaliseren</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="93"/> <source>Cannot write default address</source> <translation>Kan niet schrijven naar standaard adres</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="94"/> <source>Rescanning...</source> <translation>Opnieuw aan het scannen ...</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="95"/> <source>Done loading</source> <translation>Klaar met laden</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="96"/> <source>Invalid -proxy address</source> <translation>Foutief -proxy adres</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="97"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;</source> <translation>Ongeldig bedrag voor -paytxfee=&lt;amount&gt;</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="98"/> <source>Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction.</source> <translation>Waarschuwing: -paytxfee is zeer hoog ingesteld. Dit zijn de transactiekosten die u betaalt bij het versturen van een transactie.</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="101"/> <source>Error: CreateThread(StartNode) failed</source> <translation>Fout: CreateThread(StartNode) is mislukt</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="102"/> <source>To use the %s option</source> <translation>Gebruik de %s optie</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="112"/> <source>Error</source> <translation>Fout</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="113"/> <source>An error occured while setting up the RPC port %i for listening: %s</source> <translation>Een fout geconstateerd met het opzetten van RPC port %i om te luisteren: %s</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="114"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation>Je moet rpcpassword=&lt;password&gt; in het configuratie bestand instellen: %s Indien het bestand niet bestaat, maak het aan met alleen gebruikers leesrechten op het bestand.</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="122"/> <source>Error: Wallet locked, unable to create transaction </source> <translation>Fout: Portemonnee is gesloten, kan geen nieuwe transactie aanmaken</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="123"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source> <translation>Fout: Deze transactie vereist minstens %s transactie kosten vanwege het bedrag, moeilijkheid, of recent ontvangen fondsen</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="126"/> <source>Error: Transaction creation failed </source> <translation>Fout: Aanmaak transactie mislukt</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="127"/> <source>Sending...</source> <translation>Versturen...</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="128"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation>Fout: De transactie was afgewezen. Dit kan gebeuren als u eerder uitgegeven munten opnieuw wilt versturen, zoals wanneer u een kopie van uw wallet.dat heeft gebruikt en in de kopie deze munten zijn gemarkeerd als uitgegeven, maar in de huidige nog niet.</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="132"/> <source>Invalid amount</source> <translation>Onjuist bedrag</translation> </message> <message> <location filename="../bitcoinstrings.cpp" line="133"/> <source>Insufficient funds</source> <translation>Onvoldoende fondsen</translation> </message> </context> </TS>
wdl1908/paycoin-old
src/qt/locale/bitcoin_nl.ts
TypeScript
mit
135,055
#-- # Copyright (c) 2014 SoftLayer Technologies, Inc. All rights reserved. # # For licensing information see the LICENSE.md file in the project root. #++ $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '../lib')) require 'rubygems' require 'softlayer_api' require 'rspec' describe SoftLayer::Datacenter do let (:mock_client) do mock_client = SoftLayer::Client.new(:username => "fakeuser", :api_key => "DEADBEEFBADF00D") allow(mock_client[:Location]).to receive(:call_softlayer_api_with_params) do |method_name, parameters, args| fixture_from_json('datacenter_locations.json') end mock_client end it "retrieves a list of datacenters" do datacenters = SoftLayer::Datacenter.datacenters(mock_client) names = datacenters.collect { |datacenter| datacenter.name } expect(names.sort).to eq ["ams01", "dal01", "dal02", "dal04", "dal05", "dal06", "dal07", "hkg02", "hou02", "lon02", "sea01", "sjc01", "sng01", "tor01", "wdc01", "wdc03"] end it "retrieves a particular datacenter by name" do dal05 = SoftLayer::Datacenter.datacenter_named("dal05", mock_client) expect(dal05.name).to eq "dal05" expect(dal05.id).to be 138124 end end
SLsthompson/softlayer-ruby
spec/Datacenter_spec.rb
Ruby
mit
1,204
/* [auto_generated] boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp [begin_description] Default Integrate adaptive implementation. [end_description] Copyright 2009-2011 Karsten Ahnert Copyright 2009-2011 Mario Mulansky Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED #define BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED #include <stdexcept> #include <boost/numeric/odeint/stepper/stepper_categories.hpp> #include <boost/numeric/odeint/stepper/controlled_step_result.hpp> #include <boost/numeric/odeint/integrate/detail/integrate_const.hpp> #include <boost/numeric/odeint/util/bind.hpp> #include <boost/numeric/odeint/util/unwrap_reference.hpp> #include <boost/numeric/odeint/util/copy.hpp> #include <boost/numeric/odeint/util/detail/less_with_sign.hpp> #include <iostream> namespace boost { namespace numeric { namespace odeint { namespace detail { // forward declaration template< class Stepper , class System , class State , class Time , class Observer> size_t integrate_const( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer , stepper_tag ); /* * integrate_adaptive for simple stepper is basically an integrate_const + some last step */ template< class Stepper , class System , class State , class Time , class Observer > size_t integrate_adaptive( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer , stepper_tag ) { size_t steps = detail::integrate_const( stepper , system , start_state , start_time , end_time , dt , observer , stepper_tag() ); typename odeint::unwrap_reference< Observer >::type &obs = observer; typename odeint::unwrap_reference< Stepper >::type &st = stepper; Time end = start_time + dt*steps; if( less_with_sign( end , end_time , dt ) ) { //make a last step to end exactly at end_time st.do_step( system , start_state , end , end_time - end ); steps++; obs( start_state , end_time ); } return steps; } /* * classical integrate adaptive */ template< class Stepper , class System , class State , class Time , class Observer > size_t integrate_adaptive( Stepper stepper , System system , State &start_state , Time &start_time , Time end_time , Time &dt , Observer observer , controlled_stepper_tag ) { typename odeint::unwrap_reference< Observer >::type &obs = observer; typename odeint::unwrap_reference< Stepper >::type &st = stepper; const size_t max_attempts = 1000; const char *error_string = "Integrate adaptive : Maximal number of iterations reached. A step size could not be found."; size_t count = 0; while( less_with_sign( start_time , end_time , dt ) ) { obs( start_state , start_time ); if( less_with_sign( end_time , static_cast<Time>(start_time + dt) , dt ) ) { dt = end_time - start_time; } size_t trials = 0; controlled_step_result res = success; do { res = st.try_step( system , start_state , start_time , dt ); ++trials; } while( ( res == fail ) && ( trials < max_attempts ) ); if( trials == max_attempts ) throw std::overflow_error( error_string ); ++count; } obs( start_state , start_time ); return count; } /* * integrate adaptive for dense output steppers * * step size control is used if the stepper supports it */ template< class Stepper , class System , class State , class Time , class Observer > size_t integrate_adaptive( Stepper stepper , System system , State &start_state , Time start_time , Time end_time , Time dt , Observer observer , dense_output_stepper_tag ) { typename odeint::unwrap_reference< Observer >::type &obs = observer; typename odeint::unwrap_reference< Stepper >::type &st = stepper; size_t count = 0; st.initialize( start_state , start_time , dt ); while( less_with_sign( st.current_time() , end_time , st.current_time_step() ) ) { while( less_eq_with_sign( static_cast<Time>(st.current_time() + st.current_time_step()) , end_time , st.current_time_step() ) ) { //make sure we don't go beyond the end_time obs( st.current_state() , st.current_time() ); st.do_step( system ); ++count; } // calculate time step to arrive exactly at end time st.initialize( st.current_state() , st.current_time() , static_cast<Time>(end_time - st.current_time()) ); } obs( st.current_state() , st.current_time() ); // overwrite start_state with the final point boost::numeric::odeint::copy( st.current_state() , start_state ); return count; } } // namespace detail } // namespace odeint } // namespace numeric } // namespace boost #endif // BOOST_NUMERIC_ODEINT_INTEGRATE_DETAIL_INTEGRATE_ADAPTIVE_HPP_INCLUDED
gt-ros-pkg/humans
src/videoray/catkin_ws/src/videoray/include/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp
C++
mit
5,288
#include <stdio.h> #include <stdlib.h> int main(){ int n,m,k,i,a,b,c; scanf("%d",&n); scanf("%d",&m); scanf("%d",&k); a=m; b=0; c=0; for(i=0;i<n;i++){ if(i!=0 && i%k==0){ c=c+2; m=a-(a*c/100);} b=b+m; } printf("%d\n",b); return 0; }
Enchak/c-programming-homework
G/03/06/03_money-for-nothing.c
C
mit
235
<?php session_start(); if(!isset($_SESSION["admin"])){ echo "<script language='javascript'>document.location.href='index.php';</script>"; } if(isset($_REQUEST["dec"]) and $_REQUEST["dec"]=="1"){ session_destroy(); echo "<script language='javascript'>document.location.href='index.php';</script>"; } include("../connect.php"); if(isset($_POST["libelle"]) and $_POST["libelle"] and isset($_POST["id_cat"]) and $_POST["id_cat"]){ mysql_query("update categorie set libelle = '".utf8_encode(addslashes($_POST["libelle"]))."' where id_cat=".$_POST["id_cat"]); echo "<script language='javascript'>document.location.href='modifierCat.php?id=".$_POST["id_cat"]."';</script>"; } if(isset($_REQUEST['id']) and is_numeric($_REQUEST['id'])){ $rr = mysql_query("select * from categorie where id_cat = ".$_REQUEST['id']); $t = mysql_fetch_array($rr); if(!$t){ echo "<script language='javascript'>document.location.href='cats.php';</script>"; } } ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Administration | NACR BLEU</title> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> <!-- Bootstrap 3.3.2 --> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <!-- FontAwesome 4.3.0 --> <link href="font-awesome-4.4.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> <!-- Ionicons 2.0.0 --> <!-- Theme style --> <link href="dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" /> <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. --> <link href="dist/css/skins/skin-blue.min.css" rel="stylesheet" type="text/css" /> <!-- iCheck --> <link href="plugins/iCheck/flat/blue.css" rel="stylesheet" type="text/css" /> <!-- Morris chart --> <link href="plugins/morris/morris.css" rel="stylesheet" type="text/css" /> <!-- jvectormap --> <link href="plugins/jvectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" /> <!-- Date Picker --> <link href="plugins/datepicker/datepicker3.css" rel="stylesheet" type="text/css" /> <!-- Daterange picker --> <link href="plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" /> <!-- bootstrap wysihtml5 - text editor --> <link href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css" /> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> </head> <body class="skin-blue"> <div class="wrapper"> <?php include("header.php"); ?> <!-- Left side column. contains the logo and sidebar --> <aside class="main-sidebar"> <?php include("sidebar.php"); ?> <!-- /.sidebar --> </aside> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> <a href="cats.php">Cat&eacute;gories</a> <small>Panneau de controle</small> </h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> Accueil</a></li> <li class="active">Cat&eacute;gories</li> </ol> </section> <!-- Main content --> <section class="content"> <!-- general form elements --> <div class="box box-primary"> <div class="box-header"> <h3 class="box-title">Modifier cat&eacute;gorie: <i><?php echo $t[1]; ?></i></h3> </div><!-- /.box-header --> <!-- form start --> <form role="form" method="post" action="modifierCat.php?id=<?php echo $t[0]; ?>"> <div class="box-body"> <div class="form-group"> <label for="exampleInputEmail1">Libelle *</label> <input class="form-control" name="libelle" placeholder="Entrez le libelle" value="<?php echo $t[1]; ?>" required> <input type="hidden" name="id_cat" class="form-control" value="<?php echo $t[0]; ?>"> </div> </div> <div class="box-footer"> <button type="submit" class="btn btn-primary">Valider</button> </div> </form> </div><!-- /.box --> </section><!-- /.content --> </div><!-- /.content-wrapper --> <footer class="main-footer"> <div class="pull-right hidden-xs"> <b>Version</b> 1.0 </div> <strong>Copyright &copy; 2015.</strong> Tous droits r&eacute;serv&eacute;s. </footer> </div><!-- ./wrapper --> <!-- jQuery 2.1.3 --> <script src="plugins/jQuery/jQuery-2.1.3.min.js"></script> <!-- Bootstrap 3.3.2 JS --> <script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <!-- FastClick --> <script src='plugins/fastclick/fastclick.min.js'></script> <!-- AdminLTE App --> <script src="dist/js/app.min.js" type="text/javascript"></script> <!-- AdminLTE for demo purposes <script src="dist/js/demo.js" type="text/javascript"></script>--> <script src="plugins/slimScroll/jquery.slimscroll.min.js" type="text/javascript"></script> <!-- CK Editor --> <script src="//cdn.ckeditor.com/4.4.3/standard/ckeditor.js"></script> <!-- Bootstrap WYSIHTML5 --> <script src="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { // Replace the <textarea id="editor1"> with a CKEditor // instance, using default configuration. CKEDITOR.replace('editor1'); //bootstrap WYSIHTML5 - text editor $(".textarea").wysihtml5(); }); </script> <link href="dist/css/select2.css" rel="stylesheet" /> <link href="dist/css/select2-bootstrap.css" rel="stylesheet" /> <script src="dist/js/select2.min.js"></script> <script type="text/javascript"> $('select').select2(); function sup(id){ if(confirm('Etes-vous sure de supprimer cette entite?\n Attention: il se peut que des biens sont enregistres sous cette categorie!')){ document.location.href='cats.php?id_sp='+id; } } </script> <!-- AdminLTE for demo purposes <script src="dist/js/demo.js" type="text/javascript"></script>--> </body> </html>
imadmouna/nacr_bleu
manager/modifierCat.php
PHP
mit
7,000
/* * Copyright 2008-2014 NVIDIA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*! \file version.h * \brief Cusp version */ #pragma once #include <cusp/detail/config.h> // This is the only cusp header that is guaranteed to // change with every cusp release. // // CUSP_VERSION % 100 is the sub-minor version // CUSP_VERSION / 100 % 1000 is the minor version // CUSP_VERSION / 100000 is the major version #define CUSP_VERSION 600 #define CUSP_MAJOR_VERSION (CUSP_VERSION / 100000) #define CUSP_MINOR_VERSION (CUSP_VERSION / 100 % 1000) #define CUSP_SUBMINOR_VERSION (CUSP_VERSION % 100)
sidharth87/Transitive.Closure.GPU
cusp/version.h
C
mit
1,147
<?php namespace Doctrine\ODM\MongoDB\Tests; use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\Configuration; use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver; /** * @author Bulat Shakirzyanov <mallluhuct@gmail.com> */ class MongoCollectionTest extends \Doctrine\ODM\MongoDB\Tests\BaseTest { public function testGridFSEmptyResult() { $mongoCollection = $this->dm->getDocumentCollection('Documents\File'); $this->assertNull($mongoCollection->findOne(array('_id' => 'definitelynotanid'))); } }
l3l0/BehatExamples
vendor_full/doctrine-mongodb-odm/tests/Doctrine/ODM/MongoDB/Tests/MongoCollectionTest.php
PHP
mit
598
h1 { background: url("/assets/images/magic-f67894a08006a2af9f5076180676323c.gif") no-repeat; background-position: right center; background-size: contain; } /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnNjc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7RUFDRSx1RkFBNEM7RUFDNUMsa0NBQWtDO0VBQ2xDLHlCQUF5QixFQUMxQiIsImZpbGUiOiJhcHBsaWNhdGlvbi0xMmZjZmQwNTQ4YTZhOTQ4YzE2NjYxZjA2ZDIwMDQ2Zi5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyJoMSB7XG4gIGJhY2tncm91bmQ6IGFzc2V0LXVybChcIm1hZ2ljLmdpZlwiKSBuby1yZXBlYXQ7XG4gIGJhY2tncm91bmQtcG9zaXRpb246IHJpZ2h0IGNlbnRlcjtcbiAgYmFja2dyb3VuZC1zaXplOiBjb250YWluO1xufVxuIl0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9 */
fejo-dk/rails_external_asset_pipeline
test/fixtures/good_assets/stylesheets/application-12fcfd0548a6a948c16661f06d20046f.css
CSS
mit
673
package madgik.exareme.master.engine; import madgik.exareme.master.app.cluster.ExaremeCluster; import madgik.exareme.master.app.cluster.ExaremeClusterFactory; import madgik.exareme.utils.file.FileUtil; import madgik.exareme.worker.art.executionEngine.ExecutionEngineLocator; import madgik.exareme.worker.art.executionEngine.ExecutionEngineProxy; import madgik.exareme.worker.art.executionEngine.session.ExecutionEngineSession; import madgik.exareme.worker.art.executionEngine.session.ExecutionEngineSessionPlan; import madgik.exareme.worker.art.executionPlan.ExecutionPlan; import madgik.exareme.worker.art.executionPlan.ExecutionPlanParser; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.File; /** * @author alex */ public class BuggyPlanEngineClientTest { private static final Logger log = Logger.getLogger(BuggyPlanEngineClientTest.class); @Before public void setUp() throws Exception { Logger.getRootLogger().setLevel(Level.ALL); log.info("------- SETUP --------"); log.info("------- SETUP --------"); } @Test public void testLocalDBManager() throws Exception { log.info("------- TEST --------"); ExaremeCluster miniCluster = ExaremeClusterFactory.createMiniCluster(1098, 8088, 5); miniCluster.start(); log.info("Mini cluster started."); try { String art = FileUtil.readFile(new File(BuggyPlanEngineClientTest.class.getClassLoader() .getResource("madgik/exareme/master/engine/buggyPlan2.json").getFile())); log.info("Art plan :" + art); ExecutionPlanParser planParser = new ExecutionPlanParser(); ExecutionPlan executionPlan = planParser.parse(art); log.info("Parsed :" + executionPlan.toString()); ExecutionEngineProxy engineProxy = ExecutionEngineLocator.getExecutionEngineProxy(); ExecutionEngineSession engineSession = engineProxy.createSession(); final ExecutionEngineSessionPlan sessionPlan = engineSession.startSession(); sessionPlan.submitPlan(executionPlan); log.info("Submitted."); while (sessionPlan.getPlanSessionStatusManagerProxy().hasFinished() == false && sessionPlan.getPlanSessionStatusManagerProxy().hasError() == false) { Thread.sleep(100); } log.info("Exited"); if (sessionPlan.getPlanSessionStatusManagerProxy().hasError() == true) { log.error(sessionPlan.getPlanSessionStatusManagerProxy().getErrorList().get(0)); } log.info("Submitting Again..."); engineSession = engineProxy.createSession(); final ExecutionEngineSessionPlan sessionPlan1 = engineSession.startSession(); sessionPlan1.submitPlan(executionPlan); log.info("Submitted."); while (sessionPlan1.getPlanSessionStatusManagerProxy().hasFinished() == false && sessionPlan1.getPlanSessionStatusManagerProxy().hasError() == false) { Thread.sleep(100); } log.info("Exited"); if (sessionPlan1.getPlanSessionStatusManagerProxy().hasError() == true) { log.error(sessionPlan1.getPlanSessionStatusManagerProxy().getErrorList().get(0)); } } catch (Exception e) { log.error(e); e.printStackTrace(); } Thread.sleep(10 * 1000); miniCluster.stop(true); log.info("Mini Cluster stopped."); log.info("------- TEST --------"); } @After public void tearDown() throws Exception { log.info("------- CLEAN --------"); log.info("------- CLEAN --------"); } }
XristosMallios/cache
exareme-master/src/test/java/madgik/exareme/master/engine/BuggyPlanEngineClientTest.java
Java
mit
3,832
# MembershipData.Properties ID **Namespace:** [OfficeDevPnP.Core.UPAWebService](OfficeDevPnP.Core.UPAWebService.md) **Assembly:** OfficeDevPnP.Core.dll ## Syntax ```C# public long ID { get; set; } ``` ### Property Value Type: System.Int64 ## See also - [MembershipData](OfficeDevPnP.Core.UPAWebService.MembershipData.md) - [OfficeDevPnP.Core.UPAWebService](OfficeDevPnP.Core.UPAWebService.md)
PaoloPia/PnP-Guidance
sitescore/OfficeDevPnP.Core.UPAWebService.MembershipData.ID.md
Markdown
mit
407
<div class="section-header"> <h1>Setting up schedule aliases</h1> </div> <section class="content"> <header class="content-header"> <div>Use this page to add new names (aliases) for schedules on pagerduty.</div> </header> <div class="paragraph"> <div class="alert alert-success" role="alert" ng-repeat="schedule in schedules.added"> Added new schedule <strong>{{ schedule.name }}</strong>! </div> <div class="alert alert-info" role="alert" ng-repeat="schedule in schedules.removed"> Removed schedule <strong>{{ schedule.name }}</strong>! </div> <div class="panel panel-default"> <div class="panel-heading"> <a href class="accordion-toggle" ng-click="show_mass_add = !show_mass_add"> <h4 class="panel-title"> Mass add aliases </h4> </a> </div> <div class="panel-collapse " ng-show="!show_mass_add"> <div class="panel-body"> You can mass add aliases by writing expressions which operate on schedule object and result in an alias. Structure of an schedule object is shown on the right. </div> <div class="row"> <div class="panel-body subsection col-xs-12 col-sm-12 col-md-5 col-lg-4" > <div class="paragraph"> <label class="control-label">Expression:</label> <input ng-model="mass.expression" class="form-control short"\> <span class="input-description"> Enter a <a href="http://documentcloud.github.io/underscore/#template">underscore.js templating expression</a> which operates on a schedule object such as the one on the right and yields an alias. </span> </div> <p class="paragraph"> Example output: <span class="highlight">{{ manager.evaluate(mass.expression, schedules.schedules[manager.active_row]) }}</span> <span class="input-description"> Note that names are treated in a case-insensitive way and empty aliases are ignored. </span> </p> <p class="paragraph"> <a class="btn btn-primary" ng-click="manager.mass_add_aliases(mass.expression)"> Mass add aliases </a> </p> <p class="paragraph"> <a class="btn btn-danger" ng-click="manager.remove_mass_aliases()"> Remove mass added aliases </a> </p> </div> <pre class="panel-body subsection examples col-xs-12 col-sm-12 col-md-7 col-lg-8">{{ schedules.schedules[manager.active_row] | json }}</pre> </div> </div> </div> </div> <div class="paragraph"> <table ng-table="manager.table" class="alias-table table table-condensed table-striped table-hover"> <tr ng-repeat="s in $data" ng-init="real = $index; schedule = schedules.schedules[real]" ng-class="{'active-row': real == manager.active_row}" ng-click="manager.active_row = $index"> <td data-title="'ID'" sortable="'id'"> {{ schedule.id }} </td> <td data-title="'Full name'" sortable="'name'"> <a ng-href="{{url_base}}/schedules/{{schedule.id}}"> {{ schedule.name }} </a> </td> <td data-title="'Aliases'"> <ul class="single-list"> <!-- Add different color for automatically added aliases --> <li ng-repeat="alias in schedules.schedules[real].aliases" class="hollow-badge hollow-badge-green"> {{alias.name}} <a href ng-click="manager.remove_alias(real, $index)" class="close-button">&times;</a> </li> </ul> <a class="hollow-badge hollow-badge-blue" href ng-click="add_alias(real)">&plus;</a> </td> </tr> </table> </div> </section> <div class="continue-bar"> <a href ng-click="goTo('/user-aliases')" class="btn btn-primary"> Back </a> <a href ng-click="goTo('/deploy')" class="btn btn-primary pull-right"> Continue </a> </div>
stripe-contrib/pagerbot
public/views/schedules.html
HTML
mit
4,138
#line 2 "scan.c" /* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header$ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include <stdio.h> /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include <stdlib.h> #include <unistd.h> /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include <io.h> #include <stdlib.h> #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 165 #define YY_END_OF_BUFFER 166 static yyconst short int yy_accept[769] = { 0, 0, 0, 0, 0, 87, 87, 163, 163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 164, 7, 18, 164, 16, 1, 17, 164, 164, 164, 164, 15, 108, 100, 101, 108, 93, 108, 107, 108, 108, 108, 107, 99, 89, 108, 108, 91, 92, 87, 88, 87, 86, 85, 86, 86, 163, 163, 28, 29, 28, 28, 28, 28, 28, 28, 31, 30, 32, 31, 113, 109, 110, 112, 114, 141, 142, 141, 139, 138, 140, 115, 117, 115, 116, 115, 120, 120, 120, 120, 122, 124, 122, 122, 122, 122, 123, 151, 155, 151, 154, 156, 156, 152, 152, 152, 149, 150, 164, 82, 164, 21, 22, 21, 20, 157, 159, 157, 160, 161, 147, 147, 148, 147, 147, 147, 147, 147, 147, 147, 81, 34, 33, 81, 81, 81, 81, 35, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 26, 23, 26, 24, 7, 18, 0, 16, 1, 17, 0, 0, 0, 14, 8, 0, 0, 0, 0, 4, 5, 0, 2, 15, 100, 101, 0, 0, 0, 95, 0, 0, 105, 105, 0, 162, 162, 162, 94, 0, 99, 89, 0, 0, 0, 91, 92, 104, 90, 0, 87, 88, 86, 85, 85, 83, 84, 163, 163, 28, 29, 28, 28, 28, 28, 31, 30, 32, 111, 112, 142, 138, 117, 0, 118, 119, 124, 121, 151, 155, 0, 153, 0, 144, 152, 152, 152, 0, 82, 0, 21, 22, 21, 19, 157, 159, 158, 147, 147, 147, 148, 143, 147, 147, 147, 34, 33, 0, 80, 0, 0, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 36, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 0, 25, 24, 0, 14, 8, 0, 12, 0, 0, 0, 0, 0, 4, 5, 0, 6, 0, 96, 0, 97, 0, 0, 105, 105, 0, 105, 105, 105, 162, 162, 0, 106, 90, 98, 0, 104, 0, 83, 84, 28, 28, 28, 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, 152, 143, 143, 147, 147, 0, 0, 81, 81, 81, 81, 81, 44, 81, 81, 81, 49, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 0, 81, 81, 81, 81, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 4, 5, 0, 105, 105, 105, 105, 105, 105, 162, 0, 0, 28, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, 152, 147, 147, 37, 38, 81, 81, 81, 81, 81, 81, 81, 81, 50, 51, 81, 81, 81, 55, 81, 81, 81, 81, 81, 81, 60, 81, 81, 81, 81, 81, 81, 67, 0, 0, 0, 81, 81, 81, 81, 0, 13, 0, 0, 0, 0, 0, 0, 105, 105, 105, 105, 105, 105, 0, 0, 28, 28, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, 152, 147, 147, 39, 81, 41, 81, 43, 81, 81, 81, 47, 81, 52, 81, 81, 81, 81, 81, 81, 81, 81, 81, 62, 81, 81, 65, 81, 0, 0, 0, 0, 81, 81, 81, 81, 3, 0, 0, 0, 0, 105, 105, 105, 0, 0, 28, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 145, 146, 145, 146, 81, 42, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 78, 61, 81, 64, 81, 0, 0, 0, 0, 81, 81, 69, 70, 0, 10, 0, 11, 0, 103, 0, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 81, 81, 45, 81, 48, 81, 81, 81, 81, 77, 81, 59, 63, 66, 0, 0, 0, 0, 79, 81, 0, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 81, 81, 46, 81, 81, 56, 81, 81, 0, 0, 0, 0, 68, 0, 9, 0, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 0, 81, 81, 81, 81, 81, 81, 81, 0, 0, 0, 0, 0, 136, 81, 81, 81, 81, 54, 81, 81, 0, 0, 0, 0, 0, 0, 81, 81, 81, 53, 81, 58, 0, 0, 0, 0, 0, 0, 81, 81, 81, 81, 72, 0, 0, 0, 0, 73, 81, 81, 81, 81, 71, 0, 75, 0, 81, 81, 81, 74, 76, 81, 81, 81, 81, 81, 81, 57, 40, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 5, 6, 7, 8, 1, 9, 10, 10, 11, 12, 13, 14, 10, 15, 16, 16, 16, 16, 16, 16, 16, 17, 18, 19, 20, 1, 21, 22, 23, 10, 1, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 47, 26, 27, 28, 29, 30, 1, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 47, 56, 57, 58, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[59] = { 0, 1, 1, 2, 1, 3, 1, 1, 1, 4, 1, 5, 6, 1, 7, 4, 8, 8, 8, 8, 1, 1, 1, 1, 9, 10, 1, 11, 12, 1, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 4, 1, 16 } ; static yyconst short int yy_base[858] = { 0, 0, 58, 115, 172, 120, 129, 2712, 2711, 230, 2705, 136, 141, 288, 0, 2683, 2682, 144, 151, 185, 191, 178, 188, 344, 347, 375, 0, 125, 131, 147, 216, 431, 434, 461, 0, 519, 0, 205, 349, 2710, 2716, 353, 2716, 2706, 0, 360, 2716, 2705, 144, 570, 2696, 0, 2716, 577, 2716, 2703, 2716, 438, 2716, 2684, 126, 149, 427, 591, 2716, 2701, 141, 2682, 2716, 0, 2716, 2699, 0, 2699, 2697, 155, 2696, 2716, 0, 2716, 2695, 2716, 0, 2662, 2641, 2637, 0, 2692, 2716, 2690, 2716, 2716, 2663, 0, 2716, 2716, 2716, 2688, 2716, 431, 2716, 2716, 2716, 2687, 2716, 567, 2716, 2669, 571, 164, 2716, 2716, 2685, 0, 2667, 573, 2716, 0, 2716, 2683, 2716, 573, 2674, 0, 2649, 2628, 2716, 2716, 222, 2716, 356, 448, 2716, 450, 2667, 0, 2716, 2678, 2716, 0, 0, 198, 2716, 2677, 2621, 2716, 2667, 0, 2642, 2621, 2716, 2673, 2716, 2671, 2668, 2640, 2639, 2716, 544, 2639, 579, 2634, 2635, 318, 0, 2623, 2631, 424, 562, 2614, 587, 2629, 2613, 2618, 2626, 2629, 2604, 2716, 2716, 2653, 612, 634, 2716, 2654, 0, 637, 2716, 2653, 600, 2616, 0, 0, 641, 647, 651, 669, 0, 0, 453, 2716, 0, 672, 2716, 2651, 2597, 605, 2716, 2649, 2616, 620, 657, 645, 2716, 662, 0, 2716, 2592, 688, 2716, 2646, 2592, 2636, 2625, 2716, 0, 2716, 2610, 0, 2716, 0, 0, 2642, 0, 0, 2640, 2716, 0, 2716, 0, 2602, 2598, 745, 0, 2638, 2716, 2716, 0, 2716, 688, 2716, 773, 2716, 2716, 2716, 2716, 0, 2716, 673, 2716, 0, 2716, 0, 2599, 2595, 690, 2716, 698, 707, 2716, 709, 2716, 0, 2716, 2716, 0, 596, 2579, 2716, 827, 0, 2596, 2592, 2632, 2716, 2628, 2716, 2593, 2592, 0, 642, 2582, 563, 2617, 2579, 620, 2578, 2577, 2583, 669, 2570, 2584, 2572, 0, 2569, 2716, 2570, 2571, 2579, 2582, 685, 125, 2570, 2567, 2566, 688, 2608, 2716, 716, 2568, 0, 0, 720, 2716, 2608, 884, 2562, 2559, 2569, 0, 0, 723, 2716, 739, 2716, 805, 2716, 808, 2562, 787, 869, 876, 930, 881, 973, 800, 0, 2548, 2716, 2716, 2716, 2570, 0, 2559, 0, 0, 2568, 2557, 0, 2716, 0, 1009, 2581, 678, 870, 871, 874, 879, 913, 992, 974, 1013, 885, 2565, 2554, 0, 1067, 2563, 2552, 2546, 2545, 2557, 2562, 2561, 2550, 2557, 0, 2554, 2537, 2556, 0, 2536, 2543, 2533, 2548, 2568, 2537, 2549, 2544, 2542, 2541, 2532, 2539, 2540, 2538, 2539, 578, 2520, 2538, 2525, 860, 2526, 2528, 2521, 2517, 2529, 817, 1044, 2716, 822, 1095, 914, 2532, 2523, 2517, 0, 0, 2524, 1102, 1025, 1142, 2539, 1028, 1163, 2716, 2513, 2521, 2523, 2507, 0, 2526, 1058, 891, 1014, 1019, 894, 1038, 1080, 1072, 1086, 1083, 1081, 2520, 2504, 2518, 2502, 2716, 2716, 2505, 2493, 2492, 2495, 2507, 1148, 2507, 2492, 0, 0, 2492, 2493, 2507, 0, 2525, 2490, 2498, 2522, 2485, 2495, 0, 2500, 2491, 2487, 2479, 2479, 2483, 0, 875, 2494, 2481, 2494, 2480, 2475, 2491, 2519, 2716, 920, 999, 2465, 2474, 2468, 2494, 2496, 1105, 1184, 1081, 902, 969, 2479, 2491, 2463, 2477, 2716, 165, 1090, 1144, 1143, 1147, 1163, 1095, 1145, 1037, 1085, 1150, 1173, 2461, 2475, 2459, 2473, 0, 2458, 0, 2460, 0, 1165, 2454, 2469, 0, 2461, 0, 2471, 2410, 2414, 2434, 2400, 2393, 2405, 2385, 2382, 0, 2383, 2335, 0, 2335, 2330, 2326, 2309, 2278, 2259, 2269, 2268, 2256, 2297, 1046, 2238, 2242, 2253, 1179, 1142, 1145, 2247, 2246, 0, 0, 1191, 1192, 1172, 1201, 1202, 1204, 1205, 1206, 1207, 1209, 1210, 1208, 0, 0, 0, 0, 2254, 0, 2221, 2229, 2218, 2208, 2200, 2209, 2198, 2195, 2165, 2168, 2149, 2132, 0, 0, 2129, 0, 2139, 2143, 2134, 2124, 2137, 2117, 2116, 0, 0, 1228, 2716, 1232, 2716, 2111, 2716, 2117, 2716, 2115, 2114, 2108, 2107, 2106, 2103, 2102, 2098, 2095, 2063, 2047, 1213, 2012, 1986, 1975, 0, 1954, 0, 1947, 1950, 1941, 1945, 0, 1942, 0, 0, 0, 1938, 1940, 1934, 1905, 0, 1872, 1234, 2716, 1888, 1882, 1881, 1864, 1848, 1832, 1828, 1827, 1826, 1823, 1806, 1809, 1784, 1787, 1772, 0, 1781, 1786, 0, 1766, 1767, 1759, 1744, 1213, 1736, 0, 1236, 2716, 1245, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 1750, 1727, 1720, 1701, 1687, 1670, 1681, 1667, 1679, 1659, 689, 1658, 1671, 2716, 1657, 1627, 1621, 1635, 0, 1603, 1596, 1595, 1608, 1602, 1587, 1586, 1583, 1581, 1587, 1555, 0, 1547, 0, 1527, 1507, 1520, 1503, 1483, 1482, 1485, 1443, 1440, 1228, 2716, 1225, 1224, 1206, 1210, 2716, 1213, 1202, 1018, 948, 2716, 945, 2716, 884, 780, 771, 779, 2716, 2716, 689, 673, 581, 408, 318, 86, 0, 0, 2716, 1263, 1279, 1295, 1311, 1327, 1343, 1359, 1375, 1391, 1407, 1423, 1439, 1455, 1471, 1481, 1496, 1505, 1520, 1536, 1545, 1560, 1576, 1592, 1608, 1624, 1634, 1649, 1659, 1674, 1690, 1706, 1718, 1728, 1743, 1759, 1775, 1791, 1807, 1817, 1832, 1843, 1236, 1858, 1874, 1890, 1898, 1905, 1920, 1936, 1952, 1968, 1977, 1985, 2001, 2017, 2033, 2049, 2065, 2081, 2097, 2113, 2123, 2138, 2148, 2155, 2170, 2182, 2192, 2207, 2223, 2239, 2255, 2265, 2280, 2291, 2306, 2322, 2338, 2354, 2364, 2373, 2388, 2404, 2420, 2429, 2437, 2453, 2469, 2485 } ; static yyconst short int yy_def[858] = { 0, 768, 768, 769, 769, 770, 771, 772, 772, 768, 9, 773, 773, 768, 13, 774, 774, 775, 775, 776, 776, 777, 777, 778, 778, 768, 25, 779, 779, 780, 780, 781, 781, 768, 33, 768, 35, 782, 782, 768, 768, 768, 768, 768, 783, 768, 768, 768, 768, 784, 768, 785, 768, 768, 768, 768, 768, 768, 768, 768, 786, 787, 788, 768, 768, 768, 768, 768, 768, 789, 768, 789, 790, 791, 790, 790, 792, 768, 793, 768, 793, 768, 794, 794, 794, 793, 795, 768, 768, 795, 768, 768, 768, 796, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 787, 768, 768, 787, 797, 768, 768, 768, 798, 768, 787, 768, 799, 768, 799, 768, 800, 768, 801, 801, 801, 768, 768, 802, 768, 802, 803, 768, 803, 768, 804, 768, 804, 768, 805, 806, 806, 768, 806, 806, 768, 806, 807, 807, 807, 768, 768, 768, 768, 808, 768, 768, 768, 809, 809, 809, 809, 809, 809, 809, 809, 809, 809, 810, 809, 809, 809, 809, 809, 809, 809, 809, 768, 768, 811, 768, 768, 768, 768, 783, 768, 768, 768, 768, 768, 812, 813, 768, 768, 768, 768, 814, 815, 816, 768, 785, 768, 768, 768, 768, 817, 768, 768, 768, 818, 818, 819, 768, 768, 820, 768, 821, 768, 768, 768, 768, 768, 768, 768, 822, 768, 768, 823, 768, 824, 825, 825, 826, 827, 828, 768, 829, 768, 830, 830, 830, 768, 831, 768, 768, 768, 832, 768, 768, 768, 833, 768, 768, 768, 768, 834, 768, 835, 768, 835, 768, 836, 836, 836, 837, 768, 837, 838, 768, 838, 768, 839, 768, 768, 840, 840, 840, 768, 768, 841, 841, 841, 768, 768, 842, 768, 768, 768, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 768, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 844, 768, 768, 768, 845, 846, 847, 768, 768, 768, 768, 768, 768, 848, 849, 850, 768, 850, 768, 851, 768, 851, 768, 852, 852, 852, 768, 852, 852, 768, 853, 854, 768, 768, 768, 768, 855, 768, 826, 827, 830, 830, 241, 768, 241, 241, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 836, 836, 278, 278, 841, 841, 768, 768, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 768, 843, 843, 843, 843, 768, 847, 847, 768, 847, 847, 768, 768, 768, 768, 848, 849, 768, 341, 852, 343, 341, 852, 343, 768, 768, 768, 830, 830, 360, 768, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 836, 836, 841, 841, 768, 768, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 768, 768, 768, 843, 843, 843, 843, 768, 768, 847, 847, 768, 768, 768, 768, 427, 852, 343, 852, 852, 852, 768, 768, 830, 830, 768, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 836, 836, 841, 841, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 768, 768, 768, 768, 843, 843, 843, 843, 768, 856, 768, 768, 768, 852, 852, 852, 768, 768, 830, 830, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 836, 836, 841, 841, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 768, 768, 768, 768, 843, 843, 843, 843, 856, 768, 856, 768, 768, 768, 768, 768, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 843, 768, 768, 768, 768, 843, 843, 857, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 833, 843, 843, 843, 843, 843, 843, 843, 843, 843, 768, 768, 768, 768, 843, 857, 768, 857, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 843, 843, 843, 843, 843, 843, 843, 768, 768, 768, 768, 768, 768, 843, 843, 843, 843, 843, 843, 843, 768, 768, 768, 768, 768, 768, 843, 843, 843, 843, 843, 843, 768, 768, 768, 768, 768, 768, 843, 843, 843, 843, 768, 768, 768, 768, 768, 768, 843, 843, 843, 843, 768, 768, 768, 768, 843, 843, 843, 768, 768, 843, 843, 843, 843, 843, 843, 843, 843, 0, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768 } ; static yyconst short int yy_nxt[2775] = { 0, 40, 41, 42, 43, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 44, 44, 40, 40, 40, 40, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 40, 40, 40, 40, 45, 46, 47, 40, 48, 40, 49, 40, 40, 40, 40, 40, 40, 50, 40, 40, 40, 40, 40, 40, 40, 40, 51, 51, 40, 40, 40, 40, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 40, 40, 40, 53, 54, 55, 56, 767, 57, 70, 71, 58, 58, 58, 129, 130, 58, 73, 70, 74, 129, 130, 59, 75, 87, 88, 89, 60, 61, 87, 88, 89, 188, 96, 97, 224, 132, 133, 210, 211, 96, 97, 404, 98, 134, 405, 99, 99, 99, 99, 98, 213, 213, 99, 99, 99, 99, 62, 58, 58, 63, 64, 65, 56, 252, 57, 66, 40, 58, 58, 58, 439, 189, 58, 102, 103, 104, 40, 252, 67, 102, 103, 104, 225, 60, 61, 275, 68, 100, 214, 107, 108, 276, 109, 178, 100, 179, 232, 105, 233, 107, 108, 572, 109, 105, 132, 133, 180, 180, 180, 180, 265, 266, 134, 62, 58, 58, 78, 78, 79, 80, 78, 78, 78, 78, 78, 78, 81, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 82, 82, 78, 78, 78, 78, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 83, 82, 82, 82, 82, 82, 82, 84, 78, 78, 78, 90, 90, 40, 90, 90, 90, 90, 90, 90, 90, 91, 90, 91, 90, 90, 90, 90, 90, 90, 90, 90, 90, 92, 93, 93, 90, 90, 90, 90, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 90, 90, 90, 111, 112, 296, 111, 112, 178, 766, 179, 181, 182, 183, 113, 265, 266, 113, 185, 186, 187, 180, 180, 180, 180, 297, 114, 115, 116, 114, 115, 116, 117, 117, 118, 119, 120, 117, 117, 117, 121, 117, 117, 117, 117, 117, 122, 117, 117, 117, 117, 117, 117, 117, 117, 123, 123, 117, 117, 117, 117, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 124, 123, 123, 123, 123, 123, 123, 125, 126, 117, 127, 136, 137, 138, 136, 137, 138, 206, 206, 207, 215, 215, 215, 215, 248, 248, 248, 248, 268, 269, 268, 269, 300, 331, 332, 139, 301, 765, 139, 140, 141, 142, 143, 140, 140, 140, 144, 140, 140, 145, 140, 140, 140, 146, 140, 140, 140, 140, 140, 140, 140, 140, 147, 147, 140, 140, 140, 140, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 148, 147, 147, 147, 147, 147, 147, 149, 140, 140, 140, 150, 151, 152, 153, 154, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 155, 156, 150, 150, 150, 157, 150, 150, 150, 150, 150, 150, 150, 150, 158, 159, 160, 161, 162, 163, 164, 164, 165, 164, 164, 166, 167, 168, 169, 170, 164, 171, 172, 164, 173, 174, 175, 164, 176, 150, 150, 150, 191, 201, 202, 203, 258, 213, 213, 204, 289, 213, 213, 213, 213, 292, 290, 217, 218, 219, 383, 303, 275, 220, 259, 192, 188, 193, 276, 193, 221, 304, 335, 336, 293, 193, 222, 384, 193, 194, 195, 480, 193, 196, 223, 214, 306, 481, 197, 214, 198, 214, 317, 317, 317, 317, 307, 764, 205, 308, 181, 182, 183, 185, 186, 187, 189, 321, 322, 323, 339, 340, 205, 321, 322, 323, 387, 321, 322, 323, 388, 324, 324, 324, 324, 342, 342, 324, 324, 324, 324, 324, 324, 324, 324, 321, 322, 323, 201, 202, 203, 341, 344, 344, 204, 380, 258, 339, 340, 324, 324, 324, 324, 325, 217, 218, 219, 265, 266, 381, 220, 326, 439, 343, 259, 265, 266, 221, 248, 248, 248, 248, 673, 222, 268, 269, 268, 269, 327, 392, 402, 223, 409, 393, 440, 410, 416, 417, 418, 403, 331, 332, 763, 205, 411, 412, 317, 317, 317, 317, 419, 419, 419, 419, 721, 413, 331, 332, 722, 205, 357, 357, 358, 359, 357, 357, 357, 357, 357, 357, 360, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 360, 360, 357, 357, 357, 357, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 357, 357, 357, 362, 363, 364, 365, 335, 336, 366, 335, 336, 339, 340, 367, 212, 212, 762, 368, 493, 494, 369, 761, 370, 417, 494, 371, 374, 374, 760, 374, 374, 374, 374, 374, 374, 374, 375, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, 375, 375, 374, 374, 374, 374, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 374, 374, 374, 420, 322, 323, 427, 439, 439, 428, 428, 439, 339, 340, 431, 431, 439, 324, 324, 324, 324, 338, 439, 485, 339, 340, 486, 487, 439, 441, 443, 439, 442, 420, 322, 323, 450, 552, 759, 513, 493, 494, 516, 553, 444, 339, 340, 429, 338, 338, 439, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 430, 430, 339, 340, 445, 338, 338, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 338, 338, 338, 432, 432, 432, 432, 758, 439, 339, 340, 432, 757, 339, 340, 495, 417, 418, 432, 432, 432, 432, 432, 432, 360, 360, 439, 438, 360, 360, 360, 360, 360, 360, 448, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 439, 439, 360, 360, 360, 360, 439, 446, 501, 501, 447, 504, 504, 416, 417, 418, 616, 617, 339, 340, 638, 339, 340, 515, 439, 439, 449, 419, 419, 419, 419, 514, 360, 360, 360, 375, 375, 580, 375, 375, 375, 375, 375, 375, 375, 439, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 517, 439, 375, 375, 375, 375, 495, 417, 418, 439, 439, 511, 439, 512, 439, 439, 339, 340, 209, 439, 419, 419, 419, 419, 439, 519, 520, 581, 518, 522, 566, 566, 375, 375, 375, 500, 500, 573, 521, 578, 339, 340, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 502, 502, 502, 502, 532, 439, 439, 439, 502, 439, 339, 340, 439, 339, 340, 502, 502, 502, 502, 502, 502, 505, 505, 505, 505, 439, 533, 582, 576, 505, 574, 579, 534, 575, 439, 439, 505, 505, 505, 505, 505, 505, 567, 567, 567, 567, 590, 339, 340, 338, 567, 577, 583, 439, 439, 625, 591, 567, 567, 567, 567, 567, 567, 439, 439, 624, 439, 439, 439, 439, 439, 439, 439, 616, 617, 439, 623, 616, 617, 685, 686, 685, 686, 756, 628, 626, 632, 708, 755, 634, 685, 686, 302, 302, 627, 629, 754, 753, 630, 631, 633, 752, 751, 750, 709, 669, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 184, 184, 184, 184, 749, 748, 184, 184, 184, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 200, 200, 200, 200, 747, 746, 200, 200, 200, 209, 745, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 212, 744, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 216, 216, 216, 743, 742, 216, 216, 216, 227, 741, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 229, 740, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 230, 739, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 236, 738, 236, 236, 737, 236, 236, 236, 736, 735, 236, 236, 734, 733, 732, 236, 238, 238, 238, 238, 731, 730, 238, 238, 238, 242, 729, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 246, 246, 246, 246, 728, 727, 246, 246, 246, 251, 726, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 254, 725, 254, 254, 254, 254, 254, 254, 254, 254, 254, 724, 254, 254, 254, 254, 255, 723, 720, 719, 255, 255, 255, 255, 718, 717, 255, 255, 257, 716, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 261, 261, 261, 261, 715, 714, 261, 261, 261, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 267, 267, 267, 267, 713, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 271, 712, 711, 271, 271, 271, 271, 271, 271, 271, 710, 271, 271, 271, 271, 271, 273, 707, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 274, 706, 274, 274, 705, 274, 274, 274, 704, 703, 274, 274, 702, 701, 700, 274, 279, 279, 279, 279, 699, 698, 279, 279, 279, 284, 697, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 288, 288, 696, 288, 288, 695, 694, 693, 288, 288, 315, 692, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 319, 691, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 320, 690, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 328, 328, 689, 688, 328, 328, 328, 329, 329, 687, 683, 329, 329, 329, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 338, 682, 338, 338, 338, 338, 338, 338, 338, 338, 338, 681, 338, 338, 338, 338, 209, 680, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 345, 345, 679, 678, 677, 676, 345, 346, 346, 346, 346, 675, 674, 346, 346, 346, 346, 351, 673, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 227, 672, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 229, 671, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, 230, 670, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 353, 668, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 354, 667, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 236, 666, 236, 236, 665, 236, 236, 236, 664, 663, 236, 236, 662, 661, 660, 236, 238, 238, 238, 238, 659, 658, 238, 238, 238, 242, 657, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, 246, 246, 246, 246, 656, 655, 246, 246, 246, 361, 361, 654, 653, 652, 361, 361, 255, 651, 650, 649, 255, 255, 255, 255, 648, 647, 255, 255, 257, 646, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 261, 261, 261, 261, 645, 644, 261, 261, 261, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 267, 267, 267, 267, 643, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 271, 642, 641, 271, 271, 271, 271, 271, 271, 271, 640, 271, 271, 271, 271, 271, 274, 639, 274, 274, 638, 274, 274, 274, 637, 636, 274, 274, 635, 622, 621, 274, 279, 279, 279, 279, 620, 619, 279, 279, 279, 284, 618, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 288, 288, 560, 288, 288, 614, 613, 612, 288, 288, 315, 611, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 319, 610, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 320, 609, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, 424, 424, 424, 424, 608, 607, 424, 424, 424, 425, 425, 425, 425, 606, 605, 425, 425, 425, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, 338, 604, 338, 338, 338, 338, 338, 338, 338, 338, 338, 603, 338, 338, 338, 338, 433, 433, 602, 601, 600, 599, 433, 346, 346, 346, 346, 598, 597, 346, 346, 346, 346, 351, 596, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 595, 594, 593, 592, 589, 588, 587, 586, 585, 584, 571, 570, 569, 568, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 551, 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, 536, 535, 531, 530, 529, 528, 527, 526, 525, 524, 523, 510, 509, 508, 507, 506, 503, 499, 498, 497, 496, 492, 491, 490, 489, 488, 484, 483, 482, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 439, 437, 436, 435, 434, 347, 426, 423, 422, 421, 322, 414, 316, 408, 407, 406, 401, 400, 399, 398, 397, 396, 395, 394, 391, 390, 389, 386, 385, 382, 379, 378, 285, 282, 377, 376, 278, 373, 372, 243, 356, 355, 235, 231, 352, 350, 349, 348, 218, 347, 337, 206, 333, 202, 318, 186, 182, 316, 314, 313, 312, 311, 310, 309, 305, 299, 298, 295, 294, 291, 287, 286, 285, 283, 282, 281, 280, 260, 278, 277, 272, 270, 263, 262, 260, 256, 250, 253, 250, 249, 247, 245, 244, 243, 241, 240, 239, 237, 235, 228, 231, 228, 226, 218, 208, 202, 199, 186, 182, 768, 94, 94, 85, 77, 77, 39, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768 } ; static yyconst short int yy_chk[2775] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 765, 3, 5, 5, 3, 3, 3, 27, 27, 3, 6, 6, 6, 28, 28, 3, 6, 11, 11, 11, 3, 3, 12, 12, 12, 48, 17, 17, 66, 29, 29, 60, 60, 18, 18, 310, 17, 29, 310, 17, 17, 17, 17, 18, 61, 61, 18, 18, 18, 18, 3, 3, 3, 4, 4, 4, 4, 109, 4, 4, 21, 4, 4, 4, 511, 48, 4, 19, 19, 19, 22, 109, 4, 20, 20, 20, 66, 4, 4, 141, 4, 17, 61, 21, 21, 141, 21, 37, 18, 37, 75, 19, 75, 22, 22, 511, 22, 20, 30, 30, 37, 37, 37, 37, 128, 128, 30, 4, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 23, 23, 163, 24, 24, 38, 764, 38, 41, 41, 41, 23, 130, 130, 24, 45, 45, 45, 38, 38, 38, 38, 163, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 31, 31, 31, 32, 32, 32, 57, 57, 57, 62, 62, 62, 62, 99, 99, 99, 99, 131, 131, 133, 133, 167, 198, 198, 31, 167, 763, 32, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 49, 53, 53, 53, 121, 105, 105, 53, 158, 108, 108, 115, 115, 160, 158, 63, 63, 63, 291, 168, 275, 63, 121, 49, 188, 49, 275, 49, 63, 168, 205, 205, 160, 49, 63, 291, 49, 49, 49, 405, 49, 49, 63, 105, 170, 405, 49, 108, 49, 115, 180, 180, 180, 180, 170, 762, 53, 170, 181, 181, 181, 185, 185, 185, 188, 192, 192, 192, 209, 209, 63, 193, 193, 193, 294, 194, 194, 194, 294, 192, 192, 192, 192, 211, 211, 193, 193, 193, 193, 194, 194, 194, 194, 195, 195, 195, 201, 201, 201, 210, 213, 213, 201, 289, 257, 210, 210, 195, 195, 195, 195, 192, 217, 217, 217, 264, 264, 289, 217, 194, 362, 211, 257, 266, 266, 217, 248, 248, 248, 248, 761, 217, 267, 267, 269, 269, 195, 298, 309, 217, 314, 298, 362, 314, 321, 321, 321, 309, 330, 330, 760, 201, 314, 314, 317, 317, 317, 317, 321, 321, 321, 321, 708, 314, 332, 332, 708, 217, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 250, 250, 250, 250, 334, 334, 250, 336, 336, 338, 338, 250, 344, 344, 757, 250, 415, 415, 250, 756, 250, 418, 418, 250, 278, 278, 755, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 324, 324, 324, 339, 363, 364, 340, 340, 365, 339, 339, 342, 342, 366, 324, 324, 324, 324, 340, 371, 409, 342, 342, 409, 409, 441, 363, 365, 444, 364, 420, 420, 420, 371, 485, 754, 441, 494, 494, 444, 485, 366, 504, 504, 340, 341, 341, 367, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 367, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, 343, 343, 343, 343, 752, 369, 505, 505, 343, 750, 343, 343, 495, 495, 495, 343, 343, 343, 343, 343, 343, 360, 360, 368, 360, 360, 360, 360, 360, 360, 360, 369, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 370, 442, 360, 360, 360, 360, 443, 368, 428, 428, 368, 431, 431, 416, 416, 416, 561, 561, 428, 428, 749, 431, 431, 443, 519, 445, 370, 416, 416, 416, 416, 442, 360, 360, 360, 375, 375, 519, 375, 375, 375, 375, 375, 375, 375, 440, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, 445, 447, 375, 375, 375, 375, 419, 419, 419, 446, 450, 440, 449, 440, 520, 448, 503, 503, 503, 512, 419, 419, 419, 419, 517, 447, 448, 520, 446, 450, 501, 501, 375, 375, 375, 427, 427, 512, 449, 517, 501, 501, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 429, 429, 429, 429, 462, 514, 513, 518, 429, 515, 566, 566, 521, 567, 567, 429, 429, 429, 429, 429, 429, 432, 432, 432, 432, 516, 462, 521, 515, 432, 513, 518, 462, 514, 574, 522, 432, 432, 432, 432, 432, 432, 502, 502, 502, 502, 532, 565, 565, 565, 502, 516, 522, 572, 573, 574, 532, 502, 502, 502, 502, 502, 502, 575, 576, 573, 577, 578, 579, 580, 583, 581, 582, 615, 615, 634, 572, 617, 617, 656, 656, 684, 684, 748, 577, 575, 581, 681, 747, 583, 686, 686, 810, 810, 576, 578, 745, 744, 579, 580, 582, 743, 742, 740, 681, 634, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 769, 770, 770, 770, 770, 770, 770, 770, 770, 770, 770, 770, 770, 770, 770, 770, 770, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 771, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 779, 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 783, 783, 783, 783, 739, 738, 783, 783, 783, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 784, 785, 785, 785, 785, 737, 736, 785, 785, 785, 786, 735, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 787, 734, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 788, 788, 788, 733, 732, 788, 788, 788, 789, 731, 789, 789, 789, 789, 789, 789, 789, 789, 789, 789, 789, 789, 789, 789, 790, 729, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 791, 727, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, 793, 726, 793, 793, 725, 793, 793, 793, 724, 723, 793, 793, 722, 721, 720, 793, 794, 794, 794, 794, 719, 718, 794, 794, 794, 795, 717, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 795, 796, 796, 796, 796, 715, 714, 796, 796, 796, 797, 713, 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, 797, 798, 712, 798, 798, 798, 798, 798, 798, 798, 798, 798, 710, 798, 798, 798, 798, 799, 709, 707, 706, 799, 799, 799, 799, 705, 704, 799, 799, 800, 703, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 801, 801, 801, 801, 702, 701, 801, 801, 801, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, 803, 803, 803, 803, 700, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 804, 699, 698, 804, 804, 804, 804, 804, 804, 804, 682, 804, 804, 804, 804, 804, 805, 680, 805, 805, 805, 805, 805, 805, 805, 805, 805, 805, 805, 805, 805, 805, 806, 679, 806, 806, 678, 806, 806, 806, 677, 675, 806, 806, 674, 672, 671, 806, 807, 807, 807, 807, 670, 669, 807, 807, 807, 808, 668, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 809, 809, 667, 809, 809, 666, 665, 664, 809, 809, 811, 663, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, 812, 662, 812, 812, 812, 812, 812, 812, 812, 812, 812, 812, 812, 812, 812, 812, 813, 661, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, 814, 814, 660, 659, 814, 814, 814, 815, 815, 658, 655, 815, 815, 815, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, 817, 818, 653, 818, 818, 818, 818, 818, 818, 818, 818, 818, 652, 818, 818, 818, 818, 819, 651, 819, 819, 819, 819, 819, 819, 819, 819, 819, 819, 819, 819, 819, 819, 820, 820, 650, 646, 644, 643, 820, 821, 821, 821, 821, 642, 641, 821, 821, 821, 821, 822, 639, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 823, 637, 823, 823, 823, 823, 823, 823, 823, 823, 823, 823, 823, 823, 823, 823, 824, 636, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 825, 635, 825, 825, 825, 825, 825, 825, 825, 825, 825, 825, 825, 825, 825, 825, 826, 633, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 826, 827, 632, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 828, 829, 631, 829, 829, 630, 829, 829, 829, 629, 628, 829, 829, 627, 626, 625, 829, 830, 830, 830, 830, 624, 623, 830, 830, 830, 831, 621, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, 832, 832, 832, 832, 619, 612, 832, 832, 832, 833, 833, 611, 610, 609, 833, 833, 834, 608, 607, 606, 834, 834, 834, 834, 604, 601, 834, 834, 835, 600, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 836, 836, 836, 836, 599, 598, 836, 836, 836, 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, 838, 838, 838, 838, 597, 838, 838, 838, 838, 838, 838, 838, 838, 838, 838, 838, 839, 596, 595, 839, 839, 839, 839, 839, 839, 839, 594, 839, 839, 839, 839, 839, 840, 593, 840, 840, 592, 840, 840, 840, 591, 590, 840, 840, 588, 569, 568, 840, 841, 841, 841, 841, 564, 563, 841, 841, 841, 842, 562, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 842, 843, 843, 560, 843, 843, 559, 558, 557, 843, 843, 844, 556, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 845, 555, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 845, 846, 554, 846, 846, 846, 846, 846, 846, 846, 846, 846, 846, 846, 846, 846, 846, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 848, 848, 848, 848, 553, 552, 848, 848, 848, 849, 849, 849, 849, 551, 549, 849, 849, 849, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 850, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 852, 548, 852, 852, 852, 852, 852, 852, 852, 852, 852, 546, 852, 852, 852, 852, 853, 853, 545, 544, 543, 542, 853, 854, 854, 854, 854, 541, 540, 854, 854, 854, 854, 855, 539, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 538, 536, 534, 533, 530, 528, 526, 525, 524, 523, 509, 508, 507, 506, 500, 499, 498, 497, 496, 492, 491, 490, 489, 488, 487, 486, 483, 482, 481, 480, 479, 478, 476, 475, 474, 473, 472, 471, 469, 468, 467, 464, 463, 461, 460, 459, 458, 457, 454, 453, 452, 451, 439, 437, 436, 435, 434, 430, 426, 423, 422, 421, 414, 413, 412, 411, 410, 408, 407, 406, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 388, 387, 386, 384, 383, 382, 381, 380, 379, 378, 377, 376, 373, 372, 361, 356, 355, 352, 350, 346, 337, 327, 326, 325, 323, 318, 315, 313, 312, 311, 308, 307, 306, 305, 303, 301, 300, 299, 297, 296, 295, 293, 292, 290, 287, 286, 284, 282, 281, 280, 276, 263, 262, 243, 240, 239, 234, 231, 226, 222, 221, 220, 219, 216, 208, 207, 204, 203, 189, 187, 183, 179, 176, 175, 174, 173, 172, 171, 169, 166, 165, 162, 161, 159, 156, 155, 154, 153, 151, 149, 148, 146, 144, 143, 137, 134, 125, 124, 122, 119, 114, 112, 107, 103, 97, 92, 89, 87, 85, 84, 83, 80, 76, 74, 73, 71, 67, 65, 59, 55, 50, 47, 43, 39, 16, 15, 10, 8, 7, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "scan.l" #define INITIAL 0 /* scan.l - scanner for flex input */ #line 4 "scan.l" /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Vern Paxson. * * The United States Government has rights in this work pursuant * to contract no. DE-AC03-76SF00098 between the United States * Department of Energy and the University of California. * * Redistribution and use in source and binary forms with or without * modification are permitted provided that: (1) source distributions retain * this entire copyright notice and comment, and (2) distributions including * binaries display the following acknowledgement: ``This product includes * software developed by the University of California, Berkeley and its * contributors'' in the documentation or other materials provided with the * distribution and in all advertising materials mentioning features or use * of this software. Neither the name of the University nor the names of * its contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ /* $Header$ */ #include "flexdef.h" #include "parse.h" #define ACTION_ECHO add_action( yytext ) #define ACTION_IFDEF(def, should_define) \ { \ if ( should_define ) \ action_define( def, 1 ); \ } #define MARK_END_OF_PROLOG mark_prolog(); #define YY_DECL \ int flexscan() #define RETURNCHAR \ yylval = (unsigned char) yytext[0]; \ return CHAR; #define RETURNNAME \ strcpy( nmstr, yytext ); \ return NAME; #define PUT_BACK_STRING(str, start) \ for ( i = strlen( str ) - 1; i >= start; --i ) \ unput((str)[i]) #define CHECK_REJECT(str) \ if ( all_upper( str ) ) \ reject = true; #define CHECK_YYMORE(str) \ if ( all_lower( str ) ) \ yymore_used = true; #define YY_STACK_USED 1 #define YY_NO_TOP_STATE 1 #define SECT2 1 #define SECT2PROLOG 2 #define SECT3 3 #define CODEBLOCK 4 #define PICKUPDEF 5 #define SC 6 #define CARETISBOL 7 #define NUM 8 #define QUOTE 9 #define FIRSTCCL 10 #define CCL 11 #define ACTION 12 #define RECOVER 13 #define COMMENT 14 #define ACTION_STRING 15 #define PERCENT_BRACE_ACTION 16 #define OPTION 17 #define LINEDIR 18 #line 1333 "scan.c" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include <stdlib.h> #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ if ( yyleng > 0 ) \ yy_current_buffer->yy_at_bol = \ (yytext[yyleng - 1] == '\n'); \ YY_USER_ACTION YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 94 "scan.l" static int bracelevel, didadef, indented_code; static int doing_rule_action = false; static int option_sense; int doing_codeblock = false; int i; Char nmdef[MAXLINE]; #line 1498 "scan.c" if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_current_state += YY_AT_BOL(); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 769 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 2716 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 105 "scan.l" indented_code = true; BEGIN(CODEBLOCK); YY_BREAK case 2: YY_RULE_SETUP #line 106 "scan.l" ACTION_ECHO; yy_push_state( COMMENT ); YY_BREAK case 3: YY_RULE_SETUP #line 107 "scan.l" yy_push_state( LINEDIR ); YY_BREAK case 4: YY_RULE_SETUP #line 108 "scan.l" return SCDECL; YY_BREAK case 5: YY_RULE_SETUP #line 109 "scan.l" return XSCDECL; YY_BREAK case 6: YY_RULE_SETUP #line 110 "scan.l" { ++linenum; line_directive_out( (FILE *) 0, 1 ); indented_code = false; BEGIN(CODEBLOCK); } YY_BREAK case 7: YY_RULE_SETUP #line 117 "scan.l" /* discard */ YY_BREAK case 8: YY_RULE_SETUP #line 119 "scan.l" { sectnum = 2; bracelevel = 0; mark_defs1(); line_directive_out( (FILE *) 0, 1 ); BEGIN(SECT2PROLOG); return SECTEND; } YY_BREAK case 9: YY_RULE_SETUP #line 128 "scan.l" yytext_is_array = false; ++linenum; YY_BREAK case 10: YY_RULE_SETUP #line 129 "scan.l" yytext_is_array = true; ++linenum; YY_BREAK case 11: YY_RULE_SETUP #line 131 "scan.l" BEGIN(OPTION); return OPTION_OP; YY_BREAK case 12: YY_RULE_SETUP #line 133 "scan.l" ++linenum; /* ignore */ YY_BREAK case 13: YY_RULE_SETUP #line 134 "scan.l" ++linenum; /* ignore */ YY_BREAK case 14: YY_RULE_SETUP #line 136 "scan.l" synerr( _( "unrecognized '%' directive" ) ); YY_BREAK case 15: YY_RULE_SETUP #line 138 "scan.l" { strcpy( nmstr, yytext ); didadef = false; BEGIN(PICKUPDEF); } YY_BREAK case 16: YY_RULE_SETUP #line 144 "scan.l" RETURNNAME; YY_BREAK case 17: YY_RULE_SETUP #line 145 "scan.l" ++linenum; /* allows blank lines in section 1 */ YY_BREAK case 18: YY_RULE_SETUP #line 146 "scan.l" ACTION_ECHO; ++linenum; /* maybe end of comment line */ YY_BREAK case 19: YY_RULE_SETUP #line 151 "scan.l" ACTION_ECHO; yy_pop_state(); YY_BREAK case 20: YY_RULE_SETUP #line 152 "scan.l" ACTION_ECHO; YY_BREAK case 21: YY_RULE_SETUP #line 153 "scan.l" ACTION_ECHO; YY_BREAK case 22: YY_RULE_SETUP #line 154 "scan.l" ++linenum; ACTION_ECHO; YY_BREAK case 23: YY_RULE_SETUP #line 158 "scan.l" yy_pop_state(); YY_BREAK case 24: YY_RULE_SETUP #line 159 "scan.l" linenum = myctoi( yytext ); YY_BREAK case 25: YY_RULE_SETUP #line 161 "scan.l" { flex_free( (void *) infilename ); infilename = copy_string( yytext + 1 ); infilename[strlen( infilename ) - 1] = '\0'; } YY_BREAK case 26: YY_RULE_SETUP #line 166 "scan.l" /* ignore spurious characters */ YY_BREAK case 27: YY_RULE_SETUP #line 170 "scan.l" ++linenum; BEGIN(INITIAL); YY_BREAK case 28: YY_RULE_SETUP #line 172 "scan.l" ACTION_ECHO; YY_BREAK case 29: YY_RULE_SETUP #line 174 "scan.l" { ++linenum; ACTION_ECHO; if ( indented_code ) BEGIN(INITIAL); } YY_BREAK case 30: YY_RULE_SETUP #line 184 "scan.l" /* separates name and definition */ YY_BREAK case 31: YY_RULE_SETUP #line 186 "scan.l" { strcpy( (char *) nmdef, yytext ); /* Skip trailing whitespace. */ for ( i = strlen( (char *) nmdef ) - 1; i >= 0 && (nmdef[i] == ' ' || nmdef[i] == '\t'); --i ) ; nmdef[i + 1] = '\0'; ndinstal( nmstr, nmdef ); didadef = true; } YY_BREAK case 32: YY_RULE_SETUP #line 201 "scan.l" { if ( ! didadef ) synerr( _( "incomplete name definition" ) ); BEGIN(INITIAL); ++linenum; } YY_BREAK case 33: YY_RULE_SETUP #line 211 "scan.l" ++linenum; BEGIN(INITIAL); YY_BREAK case 34: YY_RULE_SETUP #line 212 "scan.l" option_sense = true; YY_BREAK case 35: YY_RULE_SETUP #line 214 "scan.l" return '='; YY_BREAK case 36: YY_RULE_SETUP #line 216 "scan.l" option_sense = ! option_sense; YY_BREAK case 37: YY_RULE_SETUP #line 218 "scan.l" csize = option_sense ? 128 : 256; YY_BREAK case 38: YY_RULE_SETUP #line 219 "scan.l" csize = option_sense ? 256 : 128; YY_BREAK case 39: YY_RULE_SETUP #line 221 "scan.l" long_align = option_sense; YY_BREAK case 40: YY_RULE_SETUP #line 222 "scan.l" { action_define( "YY_ALWAYS_INTERACTIVE", option_sense ); } YY_BREAK case 41: YY_RULE_SETUP #line 225 "scan.l" yytext_is_array = option_sense; YY_BREAK case 42: YY_RULE_SETUP #line 226 "scan.l" backing_up_report = option_sense; YY_BREAK case 43: YY_RULE_SETUP #line 227 "scan.l" interactive = ! option_sense; YY_BREAK case 44: YY_RULE_SETUP #line 228 "scan.l" C_plus_plus = option_sense; YY_BREAK case 45: YY_RULE_SETUP #line 229 "scan.l" caseins = ! option_sense; YY_BREAK case 46: YY_RULE_SETUP #line 230 "scan.l" caseins = option_sense; YY_BREAK case 47: YY_RULE_SETUP #line 231 "scan.l" ddebug = option_sense; YY_BREAK case 48: YY_RULE_SETUP #line 232 "scan.l" spprdflt = ! option_sense; YY_BREAK case 49: YY_RULE_SETUP #line 233 "scan.l" useecs = option_sense; YY_BREAK case 50: YY_RULE_SETUP #line 234 "scan.l" { useecs = usemecs = false; use_read = fullspd = true; } YY_BREAK case 51: YY_RULE_SETUP #line 238 "scan.l" { useecs = usemecs = false; use_read = fulltbl = true; } YY_BREAK case 52: YY_RULE_SETUP #line 242 "scan.l" ACTION_IFDEF("YY_NO_INPUT", ! option_sense); YY_BREAK case 53: YY_RULE_SETUP #line 243 "scan.l" interactive = option_sense; YY_BREAK case 54: YY_RULE_SETUP #line 244 "scan.l" lex_compat = option_sense; YY_BREAK case 55: YY_RULE_SETUP #line 245 "scan.l" { action_define( "YY_MAIN", option_sense ); do_yywrap = ! option_sense; } YY_BREAK case 56: YY_RULE_SETUP #line 249 "scan.l" usemecs = option_sense; YY_BREAK case 57: YY_RULE_SETUP #line 250 "scan.l" { action_define( "YY_NEVER_INTERACTIVE", option_sense ); } YY_BREAK case 58: YY_RULE_SETUP #line 253 "scan.l" performance_report += option_sense ? 1 : -1; YY_BREAK case 59: YY_RULE_SETUP #line 254 "scan.l" yytext_is_array = ! option_sense; YY_BREAK case 60: YY_RULE_SETUP #line 255 "scan.l" use_read = option_sense; YY_BREAK case 61: YY_RULE_SETUP #line 256 "scan.l" reject_really_used = option_sense; YY_BREAK case 62: YY_RULE_SETUP #line 257 "scan.l" action_define( "YY_STACK_USED", option_sense ); YY_BREAK case 63: YY_RULE_SETUP #line 258 "scan.l" do_stdinit = option_sense; YY_BREAK case 64: YY_RULE_SETUP #line 259 "scan.l" use_stdout = option_sense; YY_BREAK case 65: YY_RULE_SETUP #line 260 "scan.l" ACTION_IFDEF("YY_NO_UNPUT", ! option_sense); YY_BREAK case 66: YY_RULE_SETUP #line 261 "scan.l" printstats = option_sense; YY_BREAK case 67: YY_RULE_SETUP #line 262 "scan.l" nowarn = ! option_sense; YY_BREAK case 68: YY_RULE_SETUP #line 263 "scan.l" do_yylineno = option_sense; YY_BREAK case 69: YY_RULE_SETUP #line 264 "scan.l" yymore_really_used = option_sense; YY_BREAK case 70: YY_RULE_SETUP #line 265 "scan.l" do_yywrap = option_sense; YY_BREAK case 71: YY_RULE_SETUP #line 267 "scan.l" ACTION_IFDEF("YY_NO_PUSH_STATE", ! option_sense); YY_BREAK case 72: YY_RULE_SETUP #line 268 "scan.l" ACTION_IFDEF("YY_NO_POP_STATE", ! option_sense); YY_BREAK case 73: YY_RULE_SETUP #line 269 "scan.l" ACTION_IFDEF("YY_NO_TOP_STATE", ! option_sense); YY_BREAK case 74: YY_RULE_SETUP #line 271 "scan.l" ACTION_IFDEF("YY_NO_SCAN_BUFFER", ! option_sense); YY_BREAK case 75: YY_RULE_SETUP #line 272 "scan.l" ACTION_IFDEF("YY_NO_SCAN_BYTES", ! option_sense); YY_BREAK case 76: YY_RULE_SETUP #line 273 "scan.l" ACTION_IFDEF("YY_NO_SCAN_STRING", ! option_sense); YY_BREAK case 77: YY_RULE_SETUP #line 275 "scan.l" return OPT_OUTFILE; YY_BREAK case 78: YY_RULE_SETUP #line 276 "scan.l" return OPT_PREFIX; YY_BREAK case 79: YY_RULE_SETUP #line 277 "scan.l" return OPT_YYCLASS; YY_BREAK case 80: YY_RULE_SETUP #line 279 "scan.l" { strcpy( nmstr, yytext + 1 ); nmstr[strlen( nmstr ) - 1] = '\0'; return NAME; } YY_BREAK case 81: YY_RULE_SETUP #line 285 "scan.l" { format_synerr( _( "unrecognized %%option: %s" ), yytext ); BEGIN(RECOVER); } YY_BREAK case 82: YY_RULE_SETUP #line 292 "scan.l" ++linenum; BEGIN(INITIAL); YY_BREAK case 83: YY_RULE_SETUP #line 296 "scan.l" ++bracelevel; yyless( 2 ); /* eat only %{ */ YY_BREAK case 84: YY_RULE_SETUP #line 297 "scan.l" --bracelevel; yyless( 2 ); /* eat only %} */ YY_BREAK case 85: YY_RULE_SETUP #line 299 "scan.l" ACTION_ECHO; /* indented code in prolog */ YY_BREAK case 86: YY_RULE_SETUP #line 301 "scan.l" { /* non-indented code */ if ( bracelevel <= 0 ) { /* not in %{ ... %} */ yyless( 0 ); /* put it all back */ yy_set_bol( 1 ); mark_prolog(); BEGIN(SECT2); } else ACTION_ECHO; } YY_BREAK case 87: YY_RULE_SETUP #line 313 "scan.l" ACTION_ECHO; YY_BREAK case 88: YY_RULE_SETUP #line 314 "scan.l" ++linenum; ACTION_ECHO; YY_BREAK case YY_STATE_EOF(SECT2PROLOG): #line 316 "scan.l" { mark_prolog(); sectnum = 0; yyterminate(); /* to stop the parser */ } YY_BREAK case 89: YY_RULE_SETUP #line 324 "scan.l" ++linenum; /* allow blank lines in section 2 */ YY_BREAK case 90: YY_RULE_SETUP #line 326 "scan.l" { indented_code = false; doing_codeblock = true; bracelevel = 1; BEGIN(PERCENT_BRACE_ACTION); } YY_BREAK case 91: YY_RULE_SETUP #line 333 "scan.l" BEGIN(SC); return '<'; YY_BREAK case 92: YY_RULE_SETUP #line 334 "scan.l" return '^'; YY_BREAK case 93: YY_RULE_SETUP #line 335 "scan.l" BEGIN(QUOTE); return '"'; YY_BREAK case 94: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 336 "scan.l" BEGIN(NUM); return '{'; YY_BREAK case 95: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 337 "scan.l" return '$'; YY_BREAK case 96: YY_RULE_SETUP #line 339 "scan.l" { bracelevel = 1; BEGIN(PERCENT_BRACE_ACTION); if ( in_rule ) { doing_rule_action = true; in_rule = false; return '\n'; } } YY_BREAK case 97: YY_RULE_SETUP #line 350 "scan.l" continued_action = true; ++linenum; return '\n'; YY_BREAK case 98: YY_RULE_SETUP #line 352 "scan.l" { yyless( yyleng - 2 ); /* put back '/', '*' */ bracelevel = 0; continued_action = false; BEGIN(ACTION); } YY_BREAK case 99: YY_RULE_SETUP #line 359 "scan.l" /* allow indented rules */ YY_BREAK case 100: YY_RULE_SETUP #line 361 "scan.l" { /* This rule is separate from the one below because * otherwise we get variable trailing context, so * we can't build the scanner using -{f,F}. */ bracelevel = 0; continued_action = false; BEGIN(ACTION); if ( in_rule ) { doing_rule_action = true; in_rule = false; return '\n'; } } YY_BREAK case 101: YY_RULE_SETUP #line 378 "scan.l" { bracelevel = 0; continued_action = false; BEGIN(ACTION); unput( '\n' ); /* so <ACTION> sees it */ if ( in_rule ) { doing_rule_action = true; in_rule = false; return '\n'; } } YY_BREAK case 102: #line 393 "scan.l" case 103: YY_RULE_SETUP #line 393 "scan.l" return EOF_OP; YY_BREAK case 104: YY_RULE_SETUP #line 395 "scan.l" { sectnum = 3; BEGIN(SECT3); yyterminate(); /* to stop the parser */ } YY_BREAK case 105: YY_RULE_SETUP #line 401 "scan.l" { int cclval; strcpy( nmstr, yytext ); /* Check to see if we've already encountered this * ccl. */ if ( (cclval = ccllookup( (Char *) nmstr )) != 0 ) { if ( input() != ']' ) synerr( _( "bad character class" ) ); yylval = cclval; ++cclreuse; return PREVCCL; } else { /* We fudge a bit. We know that this ccl will * soon be numbered as lastccl + 1 by cclinit. */ cclinstal( (Char *) nmstr, lastccl + 1 ); /* Push back everything but the leading bracket * so the ccl can be rescanned. */ yyless( 1 ); BEGIN(FIRSTCCL); return '['; } } YY_BREAK case 106: YY_RULE_SETUP #line 435 "scan.l" { register Char *nmdefptr; strcpy( nmstr, yytext + 1 ); nmstr[yyleng - 2] = '\0'; /* chop trailing brace */ if ( (nmdefptr = ndlookup( nmstr )) == 0 ) format_synerr( _( "undefined definition {%s}" ), nmstr ); else { /* push back name surrounded by ()'s */ int len = strlen( (char *) nmdefptr ); if ( lex_compat || nmdefptr[0] == '^' || (len > 0 && nmdefptr[len - 1] == '$') ) { /* don't use ()'s after all */ PUT_BACK_STRING((char *) nmdefptr, 0); if ( nmdefptr[0] == '^' ) BEGIN(CARETISBOL); } else { unput(')'); PUT_BACK_STRING((char *) nmdefptr, 0); unput('('); } } } YY_BREAK case 107: YY_RULE_SETUP #line 469 "scan.l" return (unsigned char) yytext[0]; YY_BREAK case 108: YY_RULE_SETUP #line 470 "scan.l" RETURNCHAR; YY_BREAK case 109: YY_RULE_SETUP #line 475 "scan.l" return (unsigned char) yytext[0]; YY_BREAK case 110: YY_RULE_SETUP #line 476 "scan.l" BEGIN(SECT2); return '>'; YY_BREAK case 111: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 477 "scan.l" BEGIN(CARETISBOL); return '>'; YY_BREAK case 112: YY_RULE_SETUP #line 478 "scan.l" RETURNNAME; YY_BREAK case 113: YY_RULE_SETUP #line 479 "scan.l" { format_synerr( _( "bad <start condition>: %s" ), yytext ); } YY_BREAK case 114: YY_RULE_SETUP #line 485 "scan.l" BEGIN(SECT2); return '^'; YY_BREAK case 115: YY_RULE_SETUP #line 489 "scan.l" RETURNCHAR; YY_BREAK case 116: YY_RULE_SETUP #line 490 "scan.l" BEGIN(SECT2); return '"'; YY_BREAK case 117: YY_RULE_SETUP #line 492 "scan.l" { synerr( _( "missing quote" ) ); BEGIN(SECT2); ++linenum; return '"'; } YY_BREAK case 118: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 502 "scan.l" BEGIN(CCL); return '^'; YY_BREAK case 119: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 503 "scan.l" return '^'; YY_BREAK case 120: YY_RULE_SETUP #line 504 "scan.l" BEGIN(CCL); RETURNCHAR; YY_BREAK case 121: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 508 "scan.l" return '-'; YY_BREAK case 122: YY_RULE_SETUP #line 509 "scan.l" RETURNCHAR; YY_BREAK case 123: YY_RULE_SETUP #line 510 "scan.l" BEGIN(SECT2); return ']'; YY_BREAK case 124: YY_RULE_SETUP #line 511 "scan.l" { synerr( _( "bad character class" ) ); BEGIN(SECT2); return ']'; } YY_BREAK case 125: YY_RULE_SETUP #line 519 "scan.l" BEGIN(CCL); return CCE_ALNUM; YY_BREAK case 126: YY_RULE_SETUP #line 520 "scan.l" BEGIN(CCL); return CCE_ALPHA; YY_BREAK case 127: YY_RULE_SETUP #line 521 "scan.l" BEGIN(CCL); return CCE_BLANK; YY_BREAK case 128: YY_RULE_SETUP #line 522 "scan.l" BEGIN(CCL); return CCE_CNTRL; YY_BREAK case 129: YY_RULE_SETUP #line 523 "scan.l" BEGIN(CCL); return CCE_DIGIT; YY_BREAK case 130: YY_RULE_SETUP #line 524 "scan.l" BEGIN(CCL); return CCE_GRAPH; YY_BREAK case 131: YY_RULE_SETUP #line 525 "scan.l" BEGIN(CCL); return CCE_LOWER; YY_BREAK case 132: YY_RULE_SETUP #line 526 "scan.l" BEGIN(CCL); return CCE_PRINT; YY_BREAK case 133: YY_RULE_SETUP #line 527 "scan.l" BEGIN(CCL); return CCE_PUNCT; YY_BREAK case 134: YY_RULE_SETUP #line 528 "scan.l" BEGIN(CCL); return CCE_SPACE; YY_BREAK case 135: YY_RULE_SETUP #line 529 "scan.l" BEGIN(CCL); return CCE_UPPER; YY_BREAK case 136: YY_RULE_SETUP #line 530 "scan.l" BEGIN(CCL); return CCE_XDIGIT; YY_BREAK case 137: YY_RULE_SETUP #line 531 "scan.l" { format_synerr( _( "bad character class expression: %s" ), yytext ); BEGIN(CCL); return CCE_ALNUM; } YY_BREAK case 138: YY_RULE_SETUP #line 540 "scan.l" { yylval = myctoi( yytext ); return NUMBER; } YY_BREAK case 139: YY_RULE_SETUP #line 545 "scan.l" return ','; YY_BREAK case 140: YY_RULE_SETUP #line 546 "scan.l" BEGIN(SECT2); return '}'; YY_BREAK case 141: YY_RULE_SETUP #line 548 "scan.l" { synerr( _( "bad character inside {}'s" ) ); BEGIN(SECT2); return '}'; } YY_BREAK case 142: YY_RULE_SETUP #line 554 "scan.l" { synerr( _( "missing }" ) ); BEGIN(SECT2); ++linenum; return '}'; } YY_BREAK case 143: YY_RULE_SETUP #line 564 "scan.l" bracelevel = 0; YY_BREAK case 144: YY_RULE_SETUP #line 566 "scan.l" ACTION_ECHO; yy_push_state( COMMENT ); YY_BREAK case 145: YY_RULE_SETUP #line 569 "scan.l" { ACTION_ECHO; CHECK_REJECT(yytext); } YY_BREAK case 146: YY_RULE_SETUP #line 573 "scan.l" { ACTION_ECHO; CHECK_YYMORE(yytext); } YY_BREAK case 147: YY_RULE_SETUP #line 579 "scan.l" ACTION_ECHO; YY_BREAK case 148: YY_RULE_SETUP #line 580 "scan.l" { ++linenum; ACTION_ECHO; if ( bracelevel == 0 || (doing_codeblock && indented_code) ) { if ( doing_rule_action ) add_action( "\tYY_BREAK\n" ); doing_rule_action = doing_codeblock = false; BEGIN(SECT2); } } YY_BREAK /* Reject and YYmore() are checked for above, in PERCENT_BRACE_ACTION */ case 149: YY_RULE_SETUP #line 598 "scan.l" ACTION_ECHO; ++bracelevel; YY_BREAK case 150: YY_RULE_SETUP #line 599 "scan.l" ACTION_ECHO; --bracelevel; YY_BREAK case 151: YY_RULE_SETUP #line 600 "scan.l" ACTION_ECHO; YY_BREAK case 152: YY_RULE_SETUP #line 601 "scan.l" ACTION_ECHO; YY_BREAK case 153: YY_RULE_SETUP #line 602 "scan.l" ACTION_ECHO; /* character constant */ YY_BREAK case 154: YY_RULE_SETUP #line 603 "scan.l" ACTION_ECHO; BEGIN(ACTION_STRING); YY_BREAK case 155: YY_RULE_SETUP #line 604 "scan.l" { ++linenum; ACTION_ECHO; if ( bracelevel == 0 ) { if ( doing_rule_action ) add_action( "\tYY_BREAK\n" ); doing_rule_action = false; BEGIN(SECT2); } } YY_BREAK case 156: YY_RULE_SETUP #line 616 "scan.l" ACTION_ECHO; YY_BREAK case 157: YY_RULE_SETUP #line 620 "scan.l" ACTION_ECHO; YY_BREAK case 158: YY_RULE_SETUP #line 621 "scan.l" ACTION_ECHO; YY_BREAK case 159: YY_RULE_SETUP #line 622 "scan.l" ++linenum; ACTION_ECHO; YY_BREAK case 160: YY_RULE_SETUP #line 623 "scan.l" ACTION_ECHO; BEGIN(ACTION); YY_BREAK case 161: YY_RULE_SETUP #line 624 "scan.l" ACTION_ECHO; YY_BREAK case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(ACTION): case YY_STATE_EOF(ACTION_STRING): #line 627 "scan.l" { synerr( _( "EOF encountered inside an action" ) ); yyterminate(); } YY_BREAK case 162: YY_RULE_SETUP #line 633 "scan.l" { yylval = myesc( (Char *) yytext ); if ( YY_START == FIRSTCCL ) BEGIN(CCL); return CHAR; } YY_BREAK case 163: YY_RULE_SETUP #line 644 "scan.l" ECHO; YY_BREAK case YY_STATE_EOF(SECT3): #line 645 "scan.l" sectnum = 0; yyterminate(); YY_BREAK case 164: YY_RULE_SETUP #line 648 "scan.l" format_synerr( _( "bad character: %s" ), yytext ); YY_BREAK case 165: YY_RULE_SETUP #line 650 "scan.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 2736 "scan.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(SECT2): case YY_STATE_EOF(CODEBLOCK): case YY_STATE_EOF(PICKUPDEF): case YY_STATE_EOF(SC): case YY_STATE_EOF(CARETISBOL): case YY_STATE_EOF(NUM): case YY_STATE_EOF(QUOTE): case YY_STATE_EOF(FIRSTCCL): case YY_STATE_EOF(CCL): case YY_STATE_EOF(RECOVER): case YY_STATE_EOF(PERCENT_BRACE_ACTION): case YY_STATE_EOF(OPTION): case YY_STATE_EOF(LINEDIR): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = yy_start; yy_current_state += YY_AT_BOL(); for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 769 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 769 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 768); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; yy_current_buffer->yy_at_bol = (c == '\n'); return c; } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE extern int isatty YY_PROTO(( int )); #endif #endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { yylex(); return 0; } #endif #line 650 "scan.l" int yywrap() { if ( --num_input_files > 0 ) { set_input_file( *++input_files ); return 0; } else return 1; } /* set_input_file - open the given file (if NULL, stdin) for scanning */ void set_input_file( file ) char *file; { if ( file && strcmp( file, "-" ) ) { infilename = copy_string( file ); yyin = fopen( infilename, "r" ); if ( yyin == NULL ) lerrsf( _( "can't open %s" ), file ); } else { yyin = stdin; infilename = copy_string( "<stdin>" ); } linenum = 1; } /* Wrapper routines for accessing the scanner's malloc routines. */ void *flex_alloc( size ) size_t size; { return (void *) malloc( size ); } void *flex_realloc( ptr, size ) void *ptr; size_t size; { return (void *) realloc( ptr, size ); } void flex_free( ptr ) void *ptr; { if ( ptr ) free( ptr ); }
ducis/operating-system-labs
src.clean/commands/lex/initscan.c
C
mit
114,417
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. namespace Fixtures.AcceptanceTestsBodyComplex.Models { using AcceptanceTestsBodyComplex; using Newtonsoft.Json; using System.Linq; public partial class ByteWrapper { /// <summary> /// Initializes a new instance of the ByteWrapper class. /// </summary> public ByteWrapper() { } /// <summary> /// Initializes a new instance of the ByteWrapper class. /// </summary> public ByteWrapper(byte[] field = default(byte[])) { Field = field; } /// <summary> /// </summary> [JsonProperty(PropertyName = "field")] public byte[] Field { get; set; } } }
yugangw-msft/autorest
src/generator/AutoRest.CSharp.Tests/Expected/AcceptanceTests/BodyComplex/Models/ByteWrapper.cs
C#
mit
1,004
<?php /** * This file is part of the Nextras\Dbal library. * @license MIT * @link https://github.com/nextras/dbal */ namespace Nextras\Dbal\Bridges\NetteTracy; use Nextras\Dbal\Connection; use Nextras\Dbal\Result\Result; use Tracy\Debugger; use Tracy\IBarPanel; class ConnectionPanel implements IBarPanel { /** @var int */ private $maxQueries = 100; /** @var int */ private $count = 0; /** @var float */ private $totalTime; /** @var array */ private $queries = []; public static function install(Connection $connection) { Debugger::getBar()->addPanel(new ConnectionPanel($connection)); } public function __construct(Connection $connection) { $connection->onQuery[] = [$this, 'logQuery']; } public function logQuery(Connection $connection, $sql, Result $result = NULL) { $this->count++; if ($this->count > $this->maxQueries) { return; } $this->queries[] = [ $connection, $sql, $result ? $result->getElapsedTime() : NULL, ]; if ($result) { $this->totalTime += $result->getElapsedTime(); } } public function getTab() { $count = $this->count; $totalTime = $this->totalTime; ob_start(); require __DIR__ . '/ConnectionPanel.tab.phtml'; return ob_get_clean(); } public function getPanel() { $count = $this->count; $queries = $this->queries; $queries = array_map(function($row) { $row[1] = self::highlight($row[1]); return $row; }, $queries); ob_start(); require __DIR__ . '/ConnectionPanel.panel.phtml'; return ob_get_clean(); } public static function highlight($sql) { static $keywords1 = 'SELECT|(?:ON\s+DUPLICATE\s+KEY)?UPDATE|INSERT(?:\s+INTO)?|REPLACE(?:\s+INTO)?|SHOW|DELETE|CALL|UNION|FROM|WHERE|HAVING|GROUP\s+BY|ORDER\s+BY|LIMIT|OFFSET|SET|VALUES|LEFT\s+JOIN|INNER\s+JOIN|TRUNCATE'; static $keywords2 = 'ALL|DISTINCT|DISTINCTROW|IGNORE|AS|USING|ON|AND|OR|IN|IS|NOT|NULL|[RI]?LIKE|REGEXP|TRUE|FALSE'; $sql = " $sql "; $sql = htmlSpecialChars($sql, ENT_IGNORE, 'UTF-8'); $sql = preg_replace_callback("#(/\\*.+?\\*/)|(?<=[\\s,(])($keywords1)(?=[\\s,)])|(?<=[\\s,(=])($keywords2)(?=[\\s,)=])#is", function($matches) { if (!empty($matches[1])) { // comment return '<em style="color:gray">' . $matches[1] . '</em>'; } elseif (!empty($matches[2])) { // most important keywords return '<strong style="color:#2D44AD">' . $matches[2] . '</strong>'; } elseif (!empty($matches[3])) { // other keywords return '<strong>' . $matches[3] . '</strong>'; } }, $sql); return trim($sql); } }
Mikulas/dbal
src/Bridges/NetteTracy/ConnectionPanel.php
PHP
mit
2,541
#pragma once #include "ofMain.h" #include "baseScene.h" class RileyArcsRoy : public baseScene { public: void setup(); void update(); void draw(); ofParameter<float> thinWideRatio;//, speed, oscMax; float minWidth, minSpacing, initTime; };
ofZach/dayForNightSFPC
src/scenes/RileyArcsRoy/RileyArcsRoy.h
C
mit
283
// <copyright company="XATA"> // Copyright (c) 2017, All Right Reserved // </copyright> // <author>Ivan Ivchenko</author> // <email>iivchenko@live.com</email> using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OwnClassesImplementation")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("XATA")] [assembly: AssemblyProduct("OwnClassesImplementation")] [assembly: AssemblyCopyright("Copyright © Shogun 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("fec0f286-a697-4cfa-a8ed-cb360b83b44e")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision [assembly: AssemblyVersion("0.1")] [assembly: AssemblyFileVersion("0.1")]
iivchenko/ShogunLib.CommandLine
Src/ShogunLib.CommandLine.OldSamples/OwnClassesImplementation/Properties/AssemblyInfo.cs
C#
mit
1,388
// // SSRatingDemoViewController.h // SSCatalog // // Created by Sam Soffes on 2/3/11. // Copyright 2011 Sam Soffes. All rights reserved. // @interface SSRatingDemoViewController : SSRatingPickerViewController + (NSString *)title; @end
0xced/CocoaPods
examples/SSCatalog/Classes/SSRatingDemoViewController.h
C
mit
243
' Copyright (c) 2015 ZZZ Projects. All rights reserved ' Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods) ' Website: http://www.zzzprojects.com/ ' Feedback / Feature Requests / Issues : http://zzzprojects.uservoice.com/forums/283927 ' All ZZZ Projects products: Entity Framework Extensions / Bulk Operations / Extension Methods /Icon Library Public Module Extensions_206 ''' <summary> ''' Returns the angle whose cosine is the specified number. ''' </summary> ''' <param name="d"> ''' A number representing a cosine, where must be greater than or equal to -1, but less than or ''' equal to 1. ''' </param> ''' <returns>An angle, ?, measured in radians, such that 0 ????-or- if &lt; -1 or &gt; 1 or equals .</returns> <System.Runtime.CompilerServices.Extension> _ Public Function Acos(d As [Double]) As [Double] Return Math.Acos(d) End Function End Module
huoxudong125/Z.ExtensionMethods
src (VB.NET)/Z.ExtensionMethods.VB/Z.Core/System.Double/System.Math/Double.Acos.vb
Visual Basic
mit
927
<?php $custom_js = array('profile.js'); $custom_css = array('settings.scss', 'profile.scss'); require_once('init.php'); $app->page->title = 'Settings - Forum'; $profile = new profile($app->user->username); $value = array(); $values['signature'] = isset($profile->forum_signature)?$profile->forum_signature:''; if (isset($_GET['save'])) { $updated = $app->user->updateForum($_POST['signature'], $_POST['token']); if ($updated === true) { header('location: ?done'); die(); } $values['signature'] = $_POST['signature']; } require_once('header.php'); $tab = 'forum'; include('elements/tabs_settings.php'); ?> <h1>Forum</h1> <?php if (isset($updated)) { $app->utils->message($updated); } else if (isset($_GET['done'])) { $app->utils->message("Forum settings updated", "good"); } ?> <form action="?save" method="POST"> <fieldset> <label for="name">Signature:</label><br> <?php $wysiwyg_name = 'signature'; $wysiwyg_placeholder = 'This will be displayed below any post you make in the forum...'; $wysiwyg_text = $values['signature']; include('elements/wysiwyg.php'); ?> <input type="hidden" value="<?=$app->generateCSRFKey("settings");?>" name="token"> <input type="submit" value="Save Changes" class="button"> </fieldset> </form> <?php require_once('footer.php'); ?>
ChrononGit/hackthis.co.uk
html/settings/forum.php
PHP
mit
1,485
require File.dirname(__FILE__) + '/test_helper.rb' require 'tempfile' class TestSkynet < Test::Unit::TestCase # this test doesn't work on a mac def test_fork_and_exec Tempfile.new('control').open file = Tempfile.new('fork_exec') Skynet.fork_and_exec("/usr/sbin/lsof -p $$ >#{file.path}") sleep 1 open("#{file.path}", 'r') do |f| lines = f.readlines assert_equal 3, lines.grep(/null/).size, "fork_and_exec should redirect 0,1,2 to dev null" assert_equal 0, lines.grep(/control/).size, "fork_and_exec should close parent's file descriptors" end end end
saimonmoore/skynet
test/test_skynet.rb
Ruby
mit
603
using UnityEngine; namespace UniRx { /// <summary> /// <para>Note: TypedMonoBehaviour and ObservableMonoBehaviour cause some performance issues.</para> /// <para>This is legacy interface.</para> /// <para>I recommend use ObservableTriggers(UniRx.Triggers) instead.</para> /// <para>More information, see github page.</para> /// </summary> public class TypedMonoBehaviour : MonoBehaviour { /// <summary>Awake is called when the script instance is being loaded.</summary> public virtual void Awake() { } /// <summary>This function is called every fixed framerate frame, if the MonoBehaviour is enabled.</summary> public virtual void FixedUpdate() { } /// <summary>LateUpdate is called every frame, if the Behaviour is enabled.</summary> public virtual void LateUpdate() { } /// <summary>Callback for setting up animation IK (inverse kinematics).</summary> public virtual void OnAnimatorIK(int layerIndex) { } /// <summary>Callback for processing animation movements for modifying root motion.</summary> public virtual void OnAnimatorMove() { } /// <summary>Sent to all game objects when the player gets or loses focus.</summary> public virtual void OnApplicationFocus(bool focus) { } /// <summary>Sent to all game objects when the player pauses.</summary> public virtual void OnApplicationPause(bool pause) { } /// <summary>Sent to all game objects before the application is quit.</summary> public virtual void OnApplicationQuit() { } /// <summary>If OnAudioFilterRead is implemented, Unity will insert a custom filter into the audio DSP chain.</summary> public virtual void OnAudioFilterRead(float[] data, int channels) { } /// <summary>OnBecameInvisible is called when the renderer is no longer visible by any camera.</summary> public virtual void OnBecameInvisible() { } /// <summary>OnBecameVisible is called when the renderer became visible by any camera.</summary> public virtual void OnBecameVisible() { } /// <summary>OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.</summary> public virtual void OnCollisionEnter(Collision collision) { } /// <summary>Sent when an incoming collider makes contact with this object's collider (2D physics only).</summary> public virtual void OnCollisionEnter2D(Collision2D coll) { } /// <summary>OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.</summary> public virtual void OnCollisionExit(Collision collisionInfo) { } /// <summary>Sent when a collider on another object stops touching this object's collider (2D physics only).</summary> public virtual void OnCollisionExit2D(Collision2D coll) { } /// <summary>OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.</summary> public virtual void OnCollisionStay(Collision collisionInfo) { } /// <summary>Sent each frame where a collider on another object is touching this object's collider (2D physics only).</summary> public virtual void OnCollisionStay2D(Collision2D coll) { } /// <summary>Called on the client when you have successfully connected to a server.</summary> public virtual void OnConnectedToServer() { } /// <summary>OnControllerColliderHit is called when the controller hits a collider while performing a Move.</summary> public virtual void OnControllerColliderHit(ControllerColliderHit hit) { } /// <summary>This function is called when the MonoBehaviour will be destroyed.</summary> public virtual void OnDestroy() { } /// <summary>This function is called when the behaviour becomes disabled () or inactive.</summary> public virtual void OnDisable() { } /// <summary>Implement OnDrawGizmos if you want to draw gizmos that are also pickable and always drawn.</summary> public virtual void OnDrawGizmos() { } /// <summary>Implement this OnDrawGizmosSelected if you want to draw gizmos only if the object is selected.</summary> public virtual void OnDrawGizmosSelected() { } /// <summary>This function is called when the object becomes enabled and active.</summary> public virtual void OnEnable() { } #if FALSE // OnGUI called multiple time per frame update and it cause performance issue, If you want to need OnGUI, copy & paste this code on your MonoBehaviour /// <summary>OnGUI is called for rendering and handling GUI events.</summary> public virtual void OnGUI() { } #endif /// <summary>Called when a joint attached to the same game object broke.</summary> public virtual void OnJointBreak(float breakForce) { } /// <summary>This function is called after a new level was loaded.</summary> public virtual void OnLevelWasLoaded(int level) { } #if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) /// <summary>OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider.</summary> public virtual void OnMouseDown() { } /// <summary>OnMouseDrag is called when the user has clicked on a GUIElement or Collider and is still holding down the mouse.</summary> public virtual void OnMouseDrag() { } /// <summary>OnMouseEnter is called when the mouse entered the GUIElement or Collider.</summary> public virtual void OnMouseEnter() { } /// <summary>OnMouseExit is called when the mouse is not any longer over the GUIElement or Collider.</summary> public virtual void OnMouseExit() { } /// <summary>OnMouseOver is called every frame while the mouse is over the GUIElement or Collider.</summary> public virtual void OnMouseOver() { } /// <summary>OnMouseUp is called when the user has released the mouse button.</summary> public virtual void OnMouseUp() { } /// <summary>OnMouseUpAsButton is only called when the mouse is released over the same GUIElement or Collider as it was pressed.</summary> public virtual void OnMouseUpAsButton() { } #endif /// <summary>OnParticleCollision is called when a particle hits a collider.</summary> public virtual void OnParticleCollision(GameObject other) { } /// <summary>OnPostRender is called after a camera finished rendering the scene.</summary> public virtual void OnPostRender() { } /// <summary>OnPreCull is called before a camera culls the scene.</summary> public virtual void OnPreCull() { } /// <summary>OnPreRender is called before a camera starts rendering the scene.</summary> public virtual void OnPreRender() { } /// <summary>OnRenderImage is called after all rendering is complete to render image.</summary> public virtual void OnRenderImage(RenderTexture src, RenderTexture dest) { } /// <summary>OnRenderObject is called after camera has rendered the scene.</summary> public virtual void OnRenderObject() { } /// <summary>Called on the server whenever a Network. InitializeServer was invoked and has completed.</summary> public virtual void OnServerInitialized() { } /// <summary>OnTriggerEnter is called when the Collider other enters the trigger.</summary> public virtual void OnTriggerEnter(Collider other) { } /// <summary>Sent when another object enters a trigger collider attached to this object (2D physics only).</summary> public virtual void OnTriggerEnter2D(Collider2D other) { } /// <summary>OnTriggerExit is called when the Collider other has stopped touching the trigger.</summary> public virtual void OnTriggerExit(Collider other) { } /// <summary>Sent when another object leaves a trigger collider attached to this object (2D physics only).</summary> public virtual void OnTriggerExit2D(Collider2D other) { } /// <summary>OnTriggerStay is called once per frame for every Collider other that is touching the trigger.</summary> public virtual void OnTriggerStay(Collider other) { } /// <summary>Sent each frame where another object is within a trigger collider attached to this object (2D physics only).</summary> public virtual void OnTriggerStay2D(Collider2D other) { } /// <summary>This function is called when the script is loaded or a value is changed in the inspector (Called in the editor only).</summary> public virtual void OnValidate() { } /// <summary>OnWillRenderObject is called once for each camera if the object is visible.</summary> public virtual void OnWillRenderObject() { } /// <summary>Reset to default values.</summary> public virtual void Reset() { } /// <summary>Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.</summary> public virtual void Start() { } /// <summary>Update is called every frame, if the MonoBehaviour is enabled.</summary> public virtual void Update() { } #if !(UNITY_METRO || UNITY_WP8 || UNITY_NACL_CHROME || UNITY_WEBGL) /// <summary>Called on the client when the connection was lost or you disconnected from the server.</summary> public virtual void OnDisconnectedFromServer(NetworkDisconnection info) { } /// <summary>Called on the client when a connection attempt fails for some reason.</summary> public virtual void OnFailedToConnect(NetworkConnectionError error) { } /// <summary>Called on clients or servers when there is a problem connecting to the MasterServer.</summary> public virtual void OnFailedToConnectToMasterServer(NetworkConnectionError info) { } /// <summary>Called on clients or servers when reporting events from the MasterServer.</summary> public virtual void OnMasterServerEvent(MasterServerEvent msEvent) { } /// <summary>Called on objects which have been network instantiated with Network Instantiate.</summary> public virtual void OnNetworkInstantiate(NetworkMessageInfo info) { } /// <summary>Called on the server whenever a new player has successfully connected.</summary> public virtual void OnPlayerConnected(NetworkPlayer player) { } /// <summary>Called on the server whenever a player disconnected from the server.</summary> public virtual void OnPlayerDisconnected(NetworkPlayer player) { } /// <summary>Used to customize synchronization of variables in a script watched by a network view.</summary> public virtual void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info) { } #endif } }
tautalos/Unity.Mobius
Assets/packages/UniRx/Scripts/UnityEngineBridge/TypedMonoBehaviour.cs
C#
mit
11,179
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ 'use strict'; const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** * Retrieve the statistics for the account. * * @param {string} resourceGroupName The resource group name. * * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} callback - The callback. * * @returns {function} callback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link StatisticsListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ function _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { callback = options; options = null; } if (!callback) { throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); } } if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { throw new Error('filter must be of type string.'); } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } } catch (error) { return callback(error); } // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/statistics'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } // Create HTTP transport objects let httpRequest = new WebResource(); httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } if(options) { for(let headerName in options['customHeaders']) { if (options['customHeaders'].hasOwnProperty(headerName)) { httpRequest.headers[headerName] = options['customHeaders'][headerName]; } } } httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); error.response = msRest.stripResponse(response); if (responseBody === '') responseBody = null; let parsedErrorResponse; try { parsedErrorResponse = JSON.parse(responseBody); if (parsedErrorResponse) { let internalError = null; if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; error.code = internalError ? internalError.code : parsedErrorResponse.code; error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + `- "${responseBody}" for the default response.`; return callback(error); } return callback(error); } // Create Result let result = null; if (responseBody === '') responseBody = null; // Deserialize Response if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { let resultMapper = new client.models['StatisticsListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); deserializationError.request = msRest.stripRequest(httpRequest); deserializationError.response = msRest.stripResponse(response); return callback(deserializationError); } } return callback(null, result, httpRequest, response); }); } /** Class representing a StatisticsOperations. */ class StatisticsOperations { /** * Create a StatisticsOperations. * @param {AutomationClient} client Reference to the service client. */ constructor(client) { this.client = client; this._listByAutomationAccount = _listByAutomationAccount; } /** * Retrieve the statistics for the account. * * @param {string} resourceGroupName The resource group name. * * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * * @resolve {HttpOperationResponse<StatisticsListResult>} - The deserialized result object. * * @reject {Error} - The error object. */ listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } else { resolve(httpOperationResponse); } return; }); }); } /** * Retrieve the statistics for the account. * * @param {string} resourceGroupName The resource group name. * * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @param {function} [optionalCallback] - The optional callback. * * @returns {function|Promise} If a callback was passed as the last parameter * then it returns the callback else returns a Promise. * * {Promise} A promise is returned * * @resolve {StatisticsListResult} - The deserialized result object. * * @reject {Error} - The error object. * * {function} optionalCallback(err, result, request, response) * * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. * See {@link StatisticsListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { optionalCallback = options; options = null; } if (!optionalCallback) { return new Promise((resolve, reject) => { self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); } } } module.exports = StatisticsOperations;
lmazuel/azure-sdk-for-node
lib/services/automationManagement/lib/operations/statisticsOperations.js
JavaScript
mit
11,482
## VI. Processes ### Execute the app as one or more stateless processes The app is executed in the execution environment as one or more *processes*. In the simplest case, the code is a stand-alone script, the execution environment is a developer's local laptop with an installed language runtime, and the process is launched via the command line (for example, `python my_script.py`). On the other end of the spectrum, a production deploy of a sophisticated app may use many [process types, instantiated into zero or more running processes](./concurrency). **Twelve-factor processes are stateless and [share-nothing](http://en.wikipedia.org/wiki/Shared_nothing_architecture).** Any data that needs to persist must be stored in a stateful [backing service](./backing-services), typically a database. The memory space or filesystem of the process can be used as a brief, single-transaction cache. For example, downloading a large file, operating on it, and storing the results of the operation in the database. The twelve-factor app never assumes that anything cached in memory or on disk will be available on a future request or job -- with many processes of each type running, chances are high that a future request will be served by a different process. Even when running only one process, a restart (triggered by code deploy, config change, or the execution environment relocating the process to a different physical location) will usually wipe out all local (e.g., memory and filesystem) state. Asset packagers (such as [Jammit](http://documentcloud.github.com/jammit/) or [django-assetpackager](http://code.google.com/p/django-assetpackager/)) use the filesystem as a cache for compiled assets. A twelve-factor app prefers to do this compiling during the [build stage](./build-release-run), such as the [Rails asset pipeline](http://ryanbigg.com/guides/asset_pipeline.html), rather than at runtime. Some web systems rely on ["sticky sessions"](http://en.wikipedia.org/wiki/Load_balancing_%28computing%29#Persistence) -- that is, caching user session data in memory of the app's process and expecting future requests from the same visitor to be routed to the same process. Sticky sessions are a violation of twelve-factor and should never be used or relied upon. Session state data is a good candidate for a datastore that offers time-expiration, such as [Memcached](http://memcached.org/) or [Redis](http://redis.io/).
orangain/12factor
content/en/processes.md
Markdown
mit
2,437
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="robots" content="index, follow, all" /> <title>Thelia\Form\Definition\FrontForm | Thelia 2 API</title> <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../../../css/bootstrap-theme.min.css"> <link rel="stylesheet" type="text/css" href="../../../css/sami.css"> <script src="../../../js/jquery-1.11.1.min.js"></script> <script src="../../../js/bootstrap.min.js"></script> <script src="../../../js/typeahead.min.js"></script> <script src="../../../sami.js"></script> <meta name="MobileOptimized" content="width"> <meta name="HandheldFriendly" content="true"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"> </head> <body id="class" data-name="class:Thelia_Form_Definition_FrontForm" data-root-path="../../../"> <div id="content"> <div id="left-column"> <div id="control-panel"> <form id="search-form" action="../../../search.html" method="GET"> <span class="glyphicon glyphicon-search"></span> <input name="search" class="typeahead form-control" type="search" placeholder="Search"> </form> </div> <div id="api-tree"></div> </div> <div id="right-column"> <nav id="site-nav" class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-elements"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="../../../index.html">Thelia 2 API</a> </div> <div class="collapse navbar-collapse" id="navbar-elements"> <ul class="nav navbar-nav"> <li><a href="../../../classes.html">Classes</a></li> <li><a href="../../../namespaces.html">Namespaces</a></li> <li><a href="../../../interfaces.html">Interfaces</a></li> <li><a href="../../../traits.html">Traits</a></li> <li><a href="../../../doc-index.html">Index</a></li> <li><a href="../../../search.html">Search</a></li> </ul> </div> </div> </nav> <div class="namespace-breadcrumbs"> <ol class="breadcrumb"> <li><span class="label label-default">class</span></li> <li><a href="../../../Thelia.html">Thelia</a></li> <li><a href="../../../Thelia/Form.html">Form</a></li> <li><a href="../../../Thelia/Form/Definition.html">Definition</a></li> <li>FrontForm</li> </ol> </div> <div id="page-content"> <div class="page-header"> <h1>FrontForm</h1> </div> <p> class <strong>FrontForm</strong> </p> <div class="description"> <p>Class FrontForm</p> </div> <h2>Constants</h2> <table class="table table-condensed"> <tr> <td>ADDRESS_CREATE</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>ADDRESS_UPDATE</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>CART_ADD</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>CONTACT</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>COUPON_CONSUME</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>CUSTOMER_LOGIN</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>CUSTOMER_LOST_PASSWORD</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>CUSTOMER_CREATE</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>CUSTOMER_PROFILE_UPDATE</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>CUSTOMER_PASSWORD_UPDATE</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>NEWSLETTER</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>ORDER_DELIVER</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> <tr> <td>ORDER_PAYMENT</td> <td class="last"> <p><em></em></p> <p></p> </td> </tr> </table> </div> <div id="footer"> Generated by <a href="http://sami.sensiolabs.org/">Sami, the API Documentation Generator</a>. </div> </div> </div> </body> </html>
sitecrafting/thelia.github.io
api/2.2/Thelia/Form/Definition/FrontForm.html
HTML
mit
6,673
"use strict"; /** * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* jshint maxlen: false */ const apirequest_1 = require("../../lib/apirequest"); /** * TaskQueue API * * Accesses a Google App Engine Pull Task Queue over REST. * * @example * const google = require('googleapis'); * const taskqueue = google.taskqueue('v1beta2'); * * @namespace taskqueue * @type {Function} * @version v1beta2 * @variation v1beta2 * @param {object=} options Options for Taskqueue */ function Taskqueue(options) { const self = this; self._options = options || {}; self.taskqueues = { /** * taskqueue.taskqueues.get * * @desc Get detailed information about a TaskQueue. * * @alias taskqueue.taskqueues.get * @memberOf! taskqueue(v1beta2) * * @param {object} params Parameters for request * @param {boolean=} params.getStats Whether to get stats. Optional. * @param {string} params.project The project under which the queue lies. * @param {string} params.taskqueue The id of the taskqueue to get the properties of. * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ get: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); const rootUrl = options.rootUrl || 'https://www.googleapis.com/'; const parameters = { options: Object.assign({ url: (rootUrl + '/taskqueue/v1beta2/projects/{project}/taskqueues/{taskqueue}').replace(/([^:]\/)\/+/g, '$1'), method: 'GET' }, options), params: params, requiredParams: ['project', 'taskqueue'], pathParams: ['project', 'taskqueue'], context: self }; return apirequest_1.default(parameters, callback); } }; self.tasks = { /** * taskqueue.tasks.delete * * @desc Delete a task from a TaskQueue. * * @alias taskqueue.tasks.delete * @memberOf! taskqueue(v1beta2) * * @param {object} params Parameters for request * @param {string} params.project The project under which the queue lies. * @param {string} params.task The id of the task to delete. * @param {string} params.taskqueue The taskqueue to delete a task from. * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ delete: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); const rootUrl = options.rootUrl || 'https://www.googleapis.com/'; const parameters = { options: Object.assign({ url: (rootUrl + '/taskqueue/v1beta2/projects/{project}/taskqueues/{taskqueue}/tasks/{task}').replace(/([^:]\/)\/+/g, '$1'), method: 'DELETE' }, options), params: params, requiredParams: ['project', 'taskqueue', 'task'], pathParams: ['project', 'task', 'taskqueue'], context: self }; return apirequest_1.default(parameters, callback); }, /** * taskqueue.tasks.get * * @desc Get a particular task from a TaskQueue. * * @alias taskqueue.tasks.get * @memberOf! taskqueue(v1beta2) * * @param {object} params Parameters for request * @param {string} params.project The project under which the queue lies. * @param {string} params.task The task to get properties of. * @param {string} params.taskqueue The taskqueue in which the task belongs. * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ get: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); const rootUrl = options.rootUrl || 'https://www.googleapis.com/'; const parameters = { options: Object.assign({ url: (rootUrl + '/taskqueue/v1beta2/projects/{project}/taskqueues/{taskqueue}/tasks/{task}').replace(/([^:]\/)\/+/g, '$1'), method: 'GET' }, options), params: params, requiredParams: ['project', 'taskqueue', 'task'], pathParams: ['project', 'task', 'taskqueue'], context: self }; return apirequest_1.default(parameters, callback); }, /** * taskqueue.tasks.insert * * @desc Insert a new task in a TaskQueue * * @alias taskqueue.tasks.insert * @memberOf! taskqueue(v1beta2) * * @param {object} params Parameters for request * @param {string} params.project The project under which the queue lies * @param {string} params.taskqueue The taskqueue to insert the task into * @param {taskqueue(v1beta2).Task} params.resource Request body data * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ insert: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); const rootUrl = options.rootUrl || 'https://www.googleapis.com/'; const parameters = { options: Object.assign({ url: (rootUrl + '/taskqueue/v1beta2/projects/{project}/taskqueues/{taskqueue}/tasks').replace(/([^:]\/)\/+/g, '$1'), method: 'POST' }, options), params: params, requiredParams: ['project', 'taskqueue'], pathParams: ['project', 'taskqueue'], context: self }; return apirequest_1.default(parameters, callback); }, /** * taskqueue.tasks.lease * * @desc Lease 1 or more tasks from a TaskQueue. * * @alias taskqueue.tasks.lease * @memberOf! taskqueue(v1beta2) * * @param {object} params Parameters for request * @param {boolean=} params.groupByTag When true, all returned tasks will have the same tag * @param {integer} params.leaseSecs The lease in seconds. * @param {integer} params.numTasks The number of tasks to lease. * @param {string} params.project The project under which the queue lies. * @param {string=} params.tag The tag allowed for tasks in the response. Must only be specified if group_by_tag is true. If group_by_tag is true and tag is not specified the tag will be that of the oldest task by eta, i.e. the first available tag * @param {string} params.taskqueue The taskqueue to lease a task from. * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ lease: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); const rootUrl = options.rootUrl || 'https://www.googleapis.com/'; const parameters = { options: Object.assign({ url: (rootUrl + '/taskqueue/v1beta2/projects/{project}/taskqueues/{taskqueue}/tasks/lease').replace(/([^:]\/)\/+/g, '$1'), method: 'POST' }, options), params: params, requiredParams: ['project', 'taskqueue', 'numTasks', 'leaseSecs'], pathParams: ['project', 'taskqueue'], context: self }; return apirequest_1.default(parameters, callback); }, /** * taskqueue.tasks.list * * @desc List Tasks in a TaskQueue * * @alias taskqueue.tasks.list * @memberOf! taskqueue(v1beta2) * * @param {object} params Parameters for request * @param {string} params.project The project under which the queue lies. * @param {string} params.taskqueue The id of the taskqueue to list tasks from. * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ list: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); const rootUrl = options.rootUrl || 'https://www.googleapis.com/'; const parameters = { options: Object.assign({ url: (rootUrl + '/taskqueue/v1beta2/projects/{project}/taskqueues/{taskqueue}/tasks').replace(/([^:]\/)\/+/g, '$1'), method: 'GET' }, options), params: params, requiredParams: ['project', 'taskqueue'], pathParams: ['project', 'taskqueue'], context: self }; return apirequest_1.default(parameters, callback); }, /** * taskqueue.tasks.patch * * @desc Update tasks that are leased out of a TaskQueue. This method supports patch semantics. * * @alias taskqueue.tasks.patch * @memberOf! taskqueue(v1beta2) * * @param {object} params Parameters for request * @param {integer} params.newLeaseSeconds The new lease in seconds. * @param {string} params.project The project under which the queue lies. * @param {string} params.task * @param {string} params.taskqueue * @param {taskqueue(v1beta2).Task} params.resource Request body data * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ patch: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); const rootUrl = options.rootUrl || 'https://www.googleapis.com/'; const parameters = { options: Object.assign({ url: (rootUrl + '/taskqueue/v1beta2/projects/{project}/taskqueues/{taskqueue}/tasks/{task}').replace(/([^:]\/)\/+/g, '$1'), method: 'PATCH' }, options), params: params, requiredParams: ['project', 'taskqueue', 'task', 'newLeaseSeconds'], pathParams: ['project', 'task', 'taskqueue'], context: self }; return apirequest_1.default(parameters, callback); }, /** * taskqueue.tasks.update * * @desc Update tasks that are leased out of a TaskQueue. * * @alias taskqueue.tasks.update * @memberOf! taskqueue(v1beta2) * * @param {object} params Parameters for request * @param {integer} params.newLeaseSeconds The new lease in seconds. * @param {string} params.project The project under which the queue lies. * @param {string} params.task * @param {string} params.taskqueue * @param {taskqueue(v1beta2).Task} params.resource Request body data * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ update: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); const rootUrl = options.rootUrl || 'https://www.googleapis.com/'; const parameters = { options: Object.assign({ url: (rootUrl + '/taskqueue/v1beta2/projects/{project}/taskqueues/{taskqueue}/tasks/{task}').replace(/([^:]\/)\/+/g, '$1'), method: 'POST' }, options), params: params, requiredParams: ['project', 'taskqueue', 'task', 'newLeaseSeconds'], pathParams: ['project', 'task', 'taskqueue'], context: self }; return apirequest_1.default(parameters, callback); } }; } module.exports = Taskqueue; //# sourceMappingURL=v1beta2.js.map
ratokeshi/endo-google-cloud-platform
node_modules/googleapis/apis/taskqueue/v1beta2.js
JavaScript
mit
14,747
// Copyright (C) 2002-2012 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #ifndef __C_GUI_SCROLL_BAR_H_INCLUDED__ #define __C_GUI_SCROLL_BAR_H_INCLUDED__ #include "IrrCompileConfig.h" #ifdef _IRR_COMPILE_WITH_GUI_ #include "IGUIScrollBar.h" #include "IGUIButton.h" namespace irr { namespace gui { class CGUIScrollBar : public IGUIScrollBar { public: //! constructor CGUIScrollBar(bool horizontal, IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle, bool noclip=false); //! destructor virtual ~CGUIScrollBar(); //! called if an event happened. virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_; //! draws the element and its children virtual void draw() _IRR_OVERRIDE_; virtual void OnPostRender(u32 timeMs) _IRR_OVERRIDE_; //! gets the maximum value of the scrollbar. virtual s32 getMax() const _IRR_OVERRIDE_; //! sets the maximum value of the scrollbar. virtual void setMax(s32 max) _IRR_OVERRIDE_; //! gets the minimum value of the scrollbar. virtual s32 getMin() const _IRR_OVERRIDE_; //! sets the minimum value of the scrollbar. virtual void setMin(s32 min) _IRR_OVERRIDE_; //! gets the small step value virtual s32 getSmallStep() const _IRR_OVERRIDE_; //! sets the small step value virtual void setSmallStep(s32 step) _IRR_OVERRIDE_; //! gets the large step value virtual s32 getLargeStep() const _IRR_OVERRIDE_; //! sets the large step value virtual void setLargeStep(s32 step) _IRR_OVERRIDE_; //! gets the current position of the scrollbar virtual s32 getPos() const _IRR_OVERRIDE_; //! sets the position of the scrollbar virtual void setPos(s32 pos) _IRR_OVERRIDE_; //! updates the rectangle virtual void updateAbsolutePosition() _IRR_OVERRIDE_; //! Writes attributes of the element. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_; //! Reads attributes of the element virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_; private: void refreshControls(); s32 getPosFromMousePos(const core::position2di &p) const; IGUIButton* UpButton; IGUIButton* DownButton; core::rect<s32> SliderRect; bool Dragging; bool Horizontal; bool DraggedBySlider; bool TrayClick; s32 Pos; s32 DrawPos; s32 DrawHeight; s32 Min; s32 Max; s32 SmallStep; s32 LargeStep; s32 DesiredPos; u32 LastChange; video::SColor CurrentIconColor; f32 range () const { return (f32) ( Max - Min ); } }; } // end namespace gui } // end namespace irr #endif // _IRR_COMPILE_WITH_GUI_ #endif
garymabin/YGOMobile
irrlicht/source/Irrlicht/CGUIScrollBar.h
C
mit
2,890
MIT License Copyright (c) 2016 xiaozhuai, Weihang Ding Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
xiaozhuai/tiny_wiki
LICENSE.md
Markdown
mit
1,080
'use strict'; /** * Module dependencies */ var racesPolicy = require('../policies/races.server.policy'), races = require('../controllers/races.server.controller'); module.exports = function(app) { // Races Routes app.route('/api/races').all(racesPolicy.isAllowed) .get(races.list) .post(races.create); app.route('/api/races/:raceId').all(racesPolicy.isAllowed) .get(races.read) .put(races.update) .delete(races.delete); // Finish by binding the Race middleware app.param('raceId', races.raceByID); };
etkirsch/tolmea
modules/races/server/routes/races.server.routes.js
JavaScript
mit
539
using System; using System.Collections.Generic; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class JonDouglas : IWorkAtXamarinOrMicrosoft { public string FirstName => "Jon"; public string LastName => "Douglas"; public string ShortBioOrTagLine => string.Empty; public string StateOrRegion => "Utah"; public string EmailAddress => ""; public string TwitterHandle => "_jondouglas"; public Uri WebSite => new Uri("http://www.jon-douglas.com/"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("http://www.jon-douglas.com/atom.xml"); } } public string GravatarHash => "83d67df0b9e002d1c55a2786aeeb0c1b"; public string GitHubHandle => string.Empty; public GeoPosition Position => new GeoPosition(39.3209800, -111.0937310); } }
beraybentesen/planetxamarin
src/Firehose.Web/Authors/JonDouglas.cs
C#
mit
899
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Class: Concurrent::Edge::LockFreeLinkedSet &mdash; Concurrent </title> <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" /> <script type="text/javascript" charset="utf-8"> hasFrames = window.top.frames.main ? true : false; relpath = '../../'; framesUrl = "../../frames.html#!Concurrent/Edge/LockFreeLinkedSet.html"; </script> <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script> <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script> </head> <body> <div id="header"> <div id="menu"> <a href="../../_index.html">Index (L)</a> &raquo; <span class='title'><span class='object_link'><a href="../../root/Concurrent.html" title="Concurrent (module)">Concurrent</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Edge.html" title="Concurrent::Edge (module)">Edge</a></span></span> &raquo; <span class="title">LockFreeLinkedSet</span> <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div> </div> <div id="search"> <a class="full_list_link" id="class_list_link" href="../../class_list.html"> Class List </a> <a class="full_list_link" id="method_list_link" href="../../method_list.html"> Method List </a> <a class="full_list_link" id="file_list_link" href="../../file_list.html"> File List </a> </div> <div class="clear"></div> </div> <iframe id="search_frame"></iframe> <div id="content"><h1>Class: Concurrent::Edge::LockFreeLinkedSet </h1> <dl class="box"> <dt class="r1">Inherits:</dt> <dd class="r1"> <span class="inheritName">Object</span> <ul class="fullTree"> <li>Object</li> <li class="next">Concurrent::Edge::LockFreeLinkedSet</li> </ul> <a href="#" class="inheritanceTree">show all</a> </dd> <dt class="r2">Includes:</dt> <dd class="r2">Enumerable</dd> <dt class="r1 last">Defined in:</dt> <dd class="r1 last">lib/concurrent/edge/lock_free_linked_set.rb<span class="defines">,<br /> lib/concurrent/edge/lock_free_linked_set/node.rb,<br /> lib/concurrent/edge/lock_free_linked_set/window.rb</span> </dd> </dl> <div class="clear"></div> <h2>Overview</h2><div class="docstring"> <div class="discussion"> <p>This class implements a lock-free linked set. The general idea of this implementation is this: each node has a successor which is an Atomic Markable Reference. This is used to ensure that all modifications to the list are atomic, preserving the structure of the linked list under <em>any</em> circumstance in a multithreaded application.</p> <p>One interesting aspect of this algorithm occurs with removing a node. Instead of physically removing a node when remove is called, a node is logically removed, by &#39;marking it.&#39; By doing this, we prevent calls to <code>remove</code> from traversing the list twice to perform a physical removal. Instead, we have have calls to <code>add</code> and <code>remove</code> clean up all marked nodes they encounter while traversing the list.</p> <p>This algorithm is a variation of the Nonblocking Linked Set found in &#39;The Art of Multiprocessor Programming&#39; by Herlihy and Shavit.</p> </div> </div> <div class="tags"> </div><h2>Defined Under Namespace</h2> <p class="children"> <strong class="classes">Classes:</strong> <span class='object_link'><a href="LockFreeLinkedSet/Head.html" title="Concurrent::Edge::LockFreeLinkedSet::Head (class)">Head</a></span>, <span class='object_link'><a href="LockFreeLinkedSet/Node.html" title="Concurrent::Edge::LockFreeLinkedSet::Node (class)">Node</a></span>, <span class='object_link'><a href="LockFreeLinkedSet/Tail.html" title="Concurrent::Edge::LockFreeLinkedSet::Tail (class)">Tail</a></span>, <span class='object_link'><a href="LockFreeLinkedSet/Window.html" title="Concurrent::Edge::LockFreeLinkedSet::Window (class)">Window</a></span> </p> <h2> Instance Method Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small> </h2> <ul class="summary"> <li class="public "> <span class="summary_signature"> <a href="#%3C%3C-instance_method" title="#&lt;&lt; (instance method)">- (Object) <strong>&lt;&lt;</strong>(item) </a> </span> <span class="summary_desc"><div class='inline'><p>Atomically adds the item to the set if it does not yet exist.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#add-instance_method" title="#add (instance method)">- (Boolean) <strong>add</strong>(item) </a> </span> <span class="summary_desc"><div class='inline'><p>Atomically adds the item to the set if it does not yet exist.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#contains%3F-instance_method" title="#contains? (instance method)">- (Boolean) <strong>contains?</strong>(item) </a> </span> <span class="summary_desc"><div class='inline'><p>Atomically checks to see if the set contains an item.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#each-instance_method" title="#each (instance method)">- (Object) <strong>each</strong> {|item| ... }</a> </span> <span class="summary_desc"><div class='inline'><p>An iterator to loop through the set.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#initialize-instance_method" title="#initialize (instance method)">- (LockFreeLinkedSet) <strong>initialize</strong>(initial_size = 0, val = nil) </a> </span> <span class="note title constructor">constructor</span> <span class="summary_desc"><div class='inline'><p>A new instance of LockFreeLinkedSet.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#remove-instance_method" title="#remove (instance method)">- (Boolean) <strong>remove</strong>(item) </a> </span> <span class="summary_desc"><div class='inline'><p>Atomically attempts to remove an item, comparing using <code>Object#hash</code>.</p> </div></span> </li> </ul> <div id="constructor_details" class="method_details_list"> <h2>Constructor Details</h2> <div class="method_details first"> <h3 class="signature first" id="initialize-instance_method"> - (<tt><span class='object_link'><a href="" title="Concurrent::Edge::LockFreeLinkedSet (class)">LockFreeLinkedSet</a></span></tt>) <strong>initialize</strong>(initial_size = 0, val = nil) </h3><div class="docstring"> <div class="discussion"> <p>Returns a new instance of LockFreeLinkedSet</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>initial_size</span> <span class='type'>(<tt>Fixnum</tt>)</span> <em class="default">(defaults to: <tt>0</tt>)</em> &mdash; <div class='inline'><p>the size of the linked_list to initialize</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 27 28 29 30 31 32 33 34</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/concurrent/edge/lock_free_linked_set.rb', line 27</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_initial_size'>initial_size</span> <span class='op'>=</span> <span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_val'>val</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span> <span class='ivar'>@head</span> <span class='op'>=</span> <span class='const'>Head</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_initial_size'>initial_size</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span> <span class='id identifier rubyid_val'>val</span> <span class='op'>=</span> <span class='id identifier rubyid_block_given?'>block_given?</span> <span class='op'>?</span> <span class='kw'>yield</span> <span class='op'>:</span> <span class='id identifier rubyid_val'>val</span> <span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_val'>val</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> <div id="instance_method_details" class="method_details_list"> <h2>Instance Method Details</h2> <div class="method_details first"> <h3 class="signature first" id="<<-instance_method"> - (<tt>Object</tt>) <strong>&lt;&lt;</strong>(item) </h3><div class="docstring"> <div class="discussion"> <p>Atomically adds the item to the set if it does not yet exist.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>item</span> <span class='type'>(<tt>Object</tt>)</span> &mdash; <div class='inline'><p>the item you wish to insert</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Object</tt>)</span> &mdash; <div class='inline'><p>the set on which the :&lt;&lt; method was invoked</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 71 72 73 74</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/concurrent/edge/lock_free_linked_set.rb', line 71</span> <span class='kw'>def</span> <span class='op'>&lt;&lt;</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span> <span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_item'>item</span> <span class='kw'>self</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="add-instance_method"> - (<tt>Boolean</tt>) <strong>add</strong>(item) </h3><div class="docstring"> <div class="discussion"> <p>Atomically adds the item to the set if it does not yet exist. Note: internally the set uses <code>Object#hash</code> to compare equality of items, meaning that Strings and other objects will be considered equal despite being different objects.</p> <p>that the item was already in the set.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>item</span> <span class='type'>(<tt>Object</tt>)</span> &mdash; <div class='inline'><p>the item you wish to insert</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Boolean</tt>)</span> &mdash; <div class='inline'><p><code>true</code> if successful. A <code>false</code> return indicates</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/concurrent/edge/lock_free_linked_set.rb', line 47</span> <span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span> <span class='id identifier rubyid_loop'>loop</span> <span class='kw'>do</span> <span class='id identifier rubyid_window'>window</span> <span class='op'>=</span> <span class='const'>Window</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='ivar'>@head</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span> <span class='id identifier rubyid_pred'>pred</span><span class='comma'>,</span> <span class='id identifier rubyid_curr'>curr</span> <span class='op'>=</span> <span class='id identifier rubyid_window'>window</span><span class='period'>.</span><span class='id identifier rubyid_pred'>pred</span><span class='comma'>,</span> <span class='id identifier rubyid_window'>window</span><span class='period'>.</span><span class='id identifier rubyid_curr'>curr</span> <span class='comment'># Item already in set </span> <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_curr'>curr</span> <span class='op'>==</span> <span class='id identifier rubyid_item'>item</span> <span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='const'>Node</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_item'>item</span><span class='comma'>,</span> <span class='id identifier rubyid_curr'>curr</span> <span class='kw'>if</span> <span class='id identifier rubyid_pred'>pred</span><span class='period'>.</span><span class='id identifier rubyid_successor_reference'>successor_reference</span><span class='period'>.</span><span class='id identifier rubyid_compare_and_set'>compare_and_set</span> <span class='id identifier rubyid_curr'>curr</span><span class='comma'>,</span> <span class='id identifier rubyid_node'>node</span><span class='comma'>,</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>end</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="contains?-instance_method"> - (<tt>Boolean</tt>) <strong>contains?</strong>(item) </h3><div class="docstring"> <div class="discussion"> <p>Atomically checks to see if the set contains an item. This method compares equality based on the <code>Object#hash</code> method, meaning that the hashed contents of an object is what determines equality instead of <code>Object#object_id</code></p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>item</span> <span class='type'>(<tt>Object</tt>)</span> &mdash; <div class='inline'><p>the item you to check for presence in the set</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Boolean</tt>)</span> &mdash; <div class='inline'><p>whether or not the item is in the set</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 86 87 88 89 90 91 92 93 94 95</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/concurrent/edge/lock_free_linked_set.rb', line 86</span> <span class='kw'>def</span> <span class='id identifier rubyid_contains?'>contains?</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span> <span class='id identifier rubyid_curr'>curr</span> <span class='op'>=</span> <span class='ivar'>@head</span> <span class='kw'>while</span> <span class='id identifier rubyid_curr'>curr</span> <span class='op'>&lt;</span> <span class='id identifier rubyid_item'>item</span> <span class='id identifier rubyid_curr'>curr</span> <span class='op'>=</span> <span class='id identifier rubyid_curr'>curr</span><span class='period'>.</span><span class='id identifier rubyid_next_node'>next_node</span> <span class='id identifier rubyid_marked'>marked</span> <span class='op'>=</span> <span class='id identifier rubyid_curr'>curr</span><span class='period'>.</span><span class='id identifier rubyid_successor_reference'>successor_reference</span><span class='period'>.</span><span class='id identifier rubyid_marked?'>marked?</span> <span class='kw'>end</span> <span class='id identifier rubyid_curr'>curr</span> <span class='op'>==</span> <span class='id identifier rubyid_item'>item</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_marked'>marked</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="each-instance_method"> - (<tt>Object</tt>) <strong>each</strong> {|item| ... } </h3><div class="docstring"> <div class="discussion"> <p>An iterator to loop through the set.</p> </div> </div> <div class="tags"> <p class="tag_title">Yields:</p> <ul class="yield"> <li> <span class='type'>(<tt>item</tt>)</span> &mdash; <div class='inline'><p>each item in the set</p> </div> </li> </ul> <p class="tag_title">Yield Parameters:</p> <ul class="yieldparam"> <li> <span class='name'>item</span> <span class='type'>(<tt>Object</tt>)</span> &mdash; <div class='inline'><p>the item you to remove from the set</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Object</tt>)</span> &mdash; <div class='inline'><p>self: the linked set on which each was called</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 131 132 133 134 135 136 137 138 139 140 141 142 143 144</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/concurrent/edge/lock_free_linked_set.rb', line 131</span> <span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span> <span class='kw'>return</span> <span class='id identifier rubyid_to_enum'>to_enum</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span> <span class='id identifier rubyid_curr'>curr</span> <span class='op'>=</span> <span class='ivar'>@head</span> <span class='kw'>until</span> <span class='id identifier rubyid_curr'>curr</span><span class='period'>.</span><span class='id identifier rubyid_last?'>last?</span> <span class='id identifier rubyid_curr'>curr</span> <span class='op'>=</span> <span class='id identifier rubyid_curr'>curr</span><span class='period'>.</span><span class='id identifier rubyid_next_node'>next_node</span> <span class='id identifier rubyid_marked'>marked</span> <span class='op'>=</span> <span class='id identifier rubyid_curr'>curr</span><span class='period'>.</span><span class='id identifier rubyid_successor_reference'>successor_reference</span><span class='period'>.</span><span class='id identifier rubyid_marked?'>marked?</span> <span class='kw'>yield</span> <span class='id identifier rubyid_curr'>curr</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span> <span class='kw'>unless</span> <span class='id identifier rubyid_marked'>marked</span> <span class='kw'>end</span> <span class='kw'>self</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="remove-instance_method"> - (<tt>Boolean</tt>) <strong>remove</strong>(item) </h3><div class="docstring"> <div class="discussion"> <p>Atomically attempts to remove an item, comparing using <code>Object#hash</code>.</p> </div> </div> <div class="tags"> <p class="tag_title">Parameters:</p> <ul class="param"> <li> <span class='name'>item</span> <span class='type'>(<tt>Object</tt>)</span> &mdash; <div class='inline'><p>the item you to remove from the set</p> </div> </li> </ul> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>Boolean</tt>)</span> &mdash; <div class='inline'><p>whether or not the item was removed from the set</p> </div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/concurrent/edge/lock_free_linked_set.rb', line 104</span> <span class='kw'>def</span> <span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span> <span class='id identifier rubyid_loop'>loop</span> <span class='kw'>do</span> <span class='id identifier rubyid_window'>window</span> <span class='op'>=</span> <span class='const'>Window</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='ivar'>@head</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span> <span class='id identifier rubyid_pred'>pred</span><span class='comma'>,</span> <span class='id identifier rubyid_curr'>curr</span> <span class='op'>=</span> <span class='id identifier rubyid_window'>window</span><span class='period'>.</span><span class='id identifier rubyid_pred'>pred</span><span class='comma'>,</span> <span class='id identifier rubyid_window'>window</span><span class='period'>.</span><span class='id identifier rubyid_curr'>curr</span> <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_curr'>curr</span> <span class='op'>!=</span> <span class='id identifier rubyid_item'>item</span> <span class='id identifier rubyid_succ'>succ</span> <span class='op'>=</span> <span class='id identifier rubyid_curr'>curr</span><span class='period'>.</span><span class='id identifier rubyid_next_node'>next_node</span> <span class='id identifier rubyid_removed'>removed</span> <span class='op'>=</span> <span class='id identifier rubyid_curr'>curr</span><span class='period'>.</span><span class='id identifier rubyid_successor_reference'>successor_reference</span><span class='period'>.</span><span class='id identifier rubyid_compare_and_set'>compare_and_set</span> <span class='id identifier rubyid_succ'>succ</span><span class='comma'>,</span> <span class='id identifier rubyid_succ'>succ</span><span class='comma'>,</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>true</span> <span class='comment'>#next_node unless removed </span> <span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_removed'>removed</span> <span class='id identifier rubyid_pred'>pred</span><span class='period'>.</span><span class='id identifier rubyid_successor_reference'>successor_reference</span><span class='period'>.</span><span class='id identifier rubyid_compare_and_set'>compare_and_set</span> <span class='id identifier rubyid_curr'>curr</span><span class='comma'>,</span> <span class='id identifier rubyid_succ'>succ</span><span class='comma'>,</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Wed Aug 15 13:38:47 2018 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.8.7.6 (ruby-2.4.3). </div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-57940973-1', 'auto'); ga('send', 'pageview'); </script> </body> </html>
lucasallan/concurrent-ruby
docs/1.0.5/Concurrent/Edge/LockFreeLinkedSet.html
HTML
mit
25,702
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'acq4/analysis/old/UncagingControlTemplate.ui' # # Created by: PyQt5 UI code generator 5.8.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_UncagingControlWidget(object): def setupUi(self, UncagingControlWidget): UncagingControlWidget.setObjectName("UncagingControlWidget") UncagingControlWidget.resize(442, 354) self.gridLayout_4 = QtWidgets.QGridLayout(UncagingControlWidget) self.gridLayout_4.setObjectName("gridLayout_4") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(UncagingControlWidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.thresholdSpin = QtWidgets.QDoubleSpinBox(UncagingControlWidget) self.thresholdSpin.setObjectName("thresholdSpin") self.gridLayout.addWidget(self.thresholdSpin, 0, 1, 1, 1) self.label_3 = QtWidgets.QLabel(UncagingControlWidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1) self.directTimeSpin = QtWidgets.QDoubleSpinBox(UncagingControlWidget) self.directTimeSpin.setObjectName("directTimeSpin") self.gridLayout.addWidget(self.directTimeSpin, 1, 1, 1, 1) self.label_2 = QtWidgets.QLabel(UncagingControlWidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1) self.poststimTimeSpin = QtWidgets.QDoubleSpinBox(UncagingControlWidget) self.poststimTimeSpin.setObjectName("poststimTimeSpin") self.gridLayout.addWidget(self.poststimTimeSpin, 2, 1, 1, 1) self.gridLayout_4.addLayout(self.gridLayout, 0, 0, 1, 1) self.groupBox_4 = QtWidgets.QGroupBox(UncagingControlWidget) self.groupBox_4.setObjectName("groupBox_4") self.horizontalLayout = QtWidgets.QHBoxLayout(self.groupBox_4) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setSpacing(0) self.horizontalLayout.setObjectName("horizontalLayout") self.groupBox_2 = QtWidgets.QGroupBox(self.groupBox_4) self.groupBox_2.setTitle("") self.groupBox_2.setObjectName("groupBox_2") self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox_2) self.gridLayout_3.setObjectName("gridLayout_3") self.gradientRadio = QtWidgets.QRadioButton(self.groupBox_2) self.gradientRadio.setObjectName("gradientRadio") self.gridLayout_3.addWidget(self.gradientRadio, 0, 0, 1, 2) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_4 = QtWidgets.QLabel(self.groupBox_2) self.label_4.setObjectName("label_4") self.horizontalLayout_2.addWidget(self.label_4) self.colorSpin1 = QtWidgets.QDoubleSpinBox(self.groupBox_2) self.colorSpin1.setObjectName("colorSpin1") self.horizontalLayout_2.addWidget(self.colorSpin1) self.gridLayout_3.addLayout(self.horizontalLayout_2, 1, 0, 1, 2) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.label_5 = QtWidgets.QLabel(self.groupBox_2) self.label_5.setObjectName("label_5") self.horizontalLayout_3.addWidget(self.label_5) self.colorSpin3 = QtWidgets.QDoubleSpinBox(self.groupBox_2) self.colorSpin3.setMaximum(100.0) self.colorSpin3.setObjectName("colorSpin3") self.horizontalLayout_3.addWidget(self.colorSpin3) self.gridLayout_3.addLayout(self.horizontalLayout_3, 2, 0, 1, 2) self.gradientWidget = GradientWidget(self.groupBox_2) self.gradientWidget.setObjectName("gradientWidget") self.gridLayout_3.addWidget(self.gradientWidget, 3, 0, 2, 2) self.rgbRadio = QtWidgets.QRadioButton(self.groupBox_2) self.rgbRadio.setObjectName("rgbRadio") self.gridLayout_3.addWidget(self.rgbRadio, 5, 0, 1, 2) self.colorTracesCheck = QtWidgets.QCheckBox(self.groupBox_2) self.colorTracesCheck.setObjectName("colorTracesCheck") self.gridLayout_3.addWidget(self.colorTracesCheck, 7, 0, 1, 2) self.svgCheck = QtWidgets.QCheckBox(self.groupBox_2) self.svgCheck.setObjectName("svgCheck") self.gridLayout_3.addWidget(self.svgCheck, 8, 0, 1, 2) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.label_6 = QtWidgets.QLabel(self.groupBox_2) self.label_6.setObjectName("label_6") self.horizontalLayout_4.addWidget(self.label_6) self.lowClipSpin = QtWidgets.QSpinBox(self.groupBox_2) self.lowClipSpin.setObjectName("lowClipSpin") self.horizontalLayout_4.addWidget(self.lowClipSpin) self.highClipSpin = QtWidgets.QSpinBox(self.groupBox_2) self.highClipSpin.setObjectName("highClipSpin") self.horizontalLayout_4.addWidget(self.highClipSpin) self.gridLayout_3.addLayout(self.horizontalLayout_4, 9, 0, 1, 2) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.label_7 = QtWidgets.QLabel(self.groupBox_2) self.label_7.setObjectName("label_7") self.horizontalLayout_5.addWidget(self.label_7) self.downsampleSpin = QtWidgets.QSpinBox(self.groupBox_2) self.downsampleSpin.setObjectName("downsampleSpin") self.horizontalLayout_5.addWidget(self.downsampleSpin) self.gridLayout_3.addLayout(self.horizontalLayout_5, 10, 0, 1, 2) self.horizontalLayout.addWidget(self.groupBox_2) self.gridLayout_4.addWidget(self.groupBox_4, 0, 1, 2, 1) self.groupBox = QtWidgets.QGroupBox(UncagingControlWidget) self.groupBox.setObjectName("groupBox") self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setSpacing(0) self.gridLayout_2.setObjectName("gridLayout_2") self.eventFindRadio = QtWidgets.QRadioButton(self.groupBox) self.eventFindRadio.setObjectName("eventFindRadio") self.gridLayout_2.addWidget(self.eventFindRadio, 0, 0, 1, 1) self.chargeTransferRadio = QtWidgets.QRadioButton(self.groupBox) self.chargeTransferRadio.setObjectName("chargeTransferRadio") self.gridLayout_2.addWidget(self.chargeTransferRadio, 1, 0, 1, 1) self.useSpontActCheck = QtWidgets.QCheckBox(self.groupBox) self.useSpontActCheck.setObjectName("useSpontActCheck") self.gridLayout_2.addWidget(self.useSpontActCheck, 2, 0, 1, 1) self.medianCheck = QtWidgets.QCheckBox(self.groupBox) self.medianCheck.setObjectName("medianCheck") self.gridLayout_2.addWidget(self.medianCheck, 3, 0, 1, 1) self.gridLayout_4.addWidget(self.groupBox, 1, 0, 1, 1) self.recolorBtn = QtWidgets.QPushButton(UncagingControlWidget) self.recolorBtn.setObjectName("recolorBtn") self.gridLayout_4.addWidget(self.recolorBtn, 2, 0, 1, 2) self.retranslateUi(UncagingControlWidget) Qt.QMetaObject.connectSlotsByName(UncagingControlWidget) def retranslateUi(self, UncagingControlWidget): _translate = Qt.QCoreApplication.translate UncagingControlWidget.setWindowTitle(_translate("UncagingControlWidget", "Form")) self.label.setText(_translate("UncagingControlWidget", "Noise Threshold")) self.label_3.setText(_translate("UncagingControlWidget", "Direct Time")) self.label_2.setText(_translate("UncagingControlWidget", "Post-Stim. Time")) self.groupBox_4.setTitle(_translate("UncagingControlWidget", "Coloring Scheme:")) self.gradientRadio.setText(_translate("UncagingControlWidget", "Gradient")) self.label_4.setText(_translate("UncagingControlWidget", "Low % Cutoff")) self.label_5.setText(_translate("UncagingControlWidget", "High % Cutoff")) self.rgbRadio.setText(_translate("UncagingControlWidget", "RGB")) self.colorTracesCheck.setText(_translate("UncagingControlWidget", "Color Traces by Laser Power")) self.svgCheck.setText(_translate("UncagingControlWidget", "Prepare for SVG")) self.label_6.setText(_translate("UncagingControlWidget", "Clip:")) self.label_7.setText(_translate("UncagingControlWidget", "Downsample:")) self.groupBox.setTitle(_translate("UncagingControlWidget", "Analysis Method:")) self.eventFindRadio.setText(_translate("UncagingControlWidget", "Event Finding")) self.chargeTransferRadio.setText(_translate("UncagingControlWidget", "Total Charge Transfer")) self.useSpontActCheck.setText(_translate("UncagingControlWidget", "Use Spont. Activity")) self.medianCheck.setText(_translate("UncagingControlWidget", "Use Median")) self.recolorBtn.setText(_translate("UncagingControlWidget", "Re-Color")) from acq4.pyqtgraph.GradientWidget import GradientWidget
campagnola/acq4
acq4/analysis/old/UncagingControlTemplate_pyqt5.py
Python
mit
9,306
// // FlashCardListController.h // FlashCards // // Created by Raul Chacon on 12/2/11. // Copyright (c) 2011 Student. All rights reserved. // #import <UIKit/UIKit.h> @class DatabaseModel; @class AddFlashCardController; @class FlashCardModel; /* * FlashCardListController: * table view controller that displays all flash cards for a given subject. */ @interface FlashCardListController : UITableViewController <UITableViewDelegate, UITableViewDataSource> @property (nonatomic, strong) NSMutableArray *flashCards; @property (nonatomic, strong) DatabaseModel *databaseModel; @property (nonatomic, strong) NSMutableString *parentSubjectTitle; // given subject @property (nonatomic, assign) int needsRefresh; // Edit button which allow for insert and update to flash card db table - (IBAction) editButtonPressed:(id)sender; @end
raulchacon/iPhone-Flash-Card-App
FlashCards/FlashCardListController.h
C
mit
838
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_Tool * @subpackage Framework * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Repository.php 23775 2011-03-01 17:25:24Z ralph $ */ /** * @see Zend_Tool_Framework_Registry_EnabledInterface */ require_once 'Zend/Tool/Framework/Registry/EnabledInterface.php'; /** * @category Zend * @package Zend_Tool * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Tool_Framework_Manifest_Repository implements Zend_Tool_Framework_Registry_EnabledInterface, IteratorAggregate, Countable { /** * @var Zend_Tool_Framework_Provider_Registry_Interface */ protected $_registry = null; /** * @var array */ protected $_manifests = array(); /** * @var array Array of Zend_Tool_Framework_Metadata_Interface */ protected $_metadatas = array(); /** * setRegistry() * * @param Zend_Tool_Framework_Registry_Interface $registry * @return unknown */ public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry) { $this->_registry = $registry; return $this; } /** * addManifest() - Add a manifest for later processing * * @param Zend_Tool_Framework_Manifest_Interface $manifest * @return Zend_Tool_Framework_Manifest_Repository */ public function addManifest(Zend_Tool_Framework_Manifest_Interface $manifest) { // we need to get an index number so that manifests with // higher indexes have priority over others $index = count($this->_manifests); if ($manifest instanceof Zend_Tool_Framework_Registry_EnabledInterface) { $manifest->setRegistry($this->_registry); } // if the manifest supplies a getIndex() method, use it if ($manifest instanceof Zend_Tool_Framework_Manifest_Indexable) { $index = $manifest->getIndex(); } // get the required objects from the framework registry $actionRepository = $this->_registry->getActionRepository(); $providerRepository = $this->_registry->getProviderRepository(); // load providers if interface supports that method if ($manifest instanceof Zend_Tool_Framework_Manifest_ProviderManifestable) { $providers = $manifest->getProviders(); if (!is_array($providers)) { $providers = array($providers); } foreach ($providers as $provider) { // if provider is a string, try and load it as an object if (is_string($provider)) { $provider = new $provider(); } if (!$provider instanceof Zend_Tool_Framework_Provider_Interface) { require_once 'Zend/Tool/Framework/Manifest/Exception.php'; throw new Zend_Tool_Framework_Manifest_Exception( 'A provider provided by the ' . get_class($manifest) . ' does not implement Zend_Tool_Framework_Provider_Interface' ); } if (!$providerRepository->hasProvider($provider, false)) { $providerRepository->addProvider($provider); } } } // load actions if interface supports that method if ($manifest instanceof Zend_Tool_Framework_Manifest_ActionManifestable) { $actions = $manifest->getActions(); if (!is_array($actions)) { $actions = array($actions); } foreach ($actions as $action) { if (is_string($action)) { $action = new Zend_Tool_Framework_Action_Base($action); } $actionRepository->addAction($action); } } // should we detect collisions here? does it even matter? $this->_manifests[$index] = $manifest; ksort($this->_manifests); return $this; } /** * getManifests() * * @return Zend_Tool_Framework_Manifest_Interface[] */ public function getManifests() { return $this->_manifests; } /** * addMetadata() - add a metadata peice by peice * * @param Zend_Tool_Framework_Manifest_Metadata $metadata * @return Zend_Tool_Framework_Manifest_Repository */ public function addMetadata(Zend_Tool_Framework_Metadata_Interface $metadata) { $this->_metadatas[] = $metadata; return $this; } /** * process() - Process is expected to be called at the end of client construction time. * By this time, the loader has run and loaded any found manifests into the repository * for loading * * @return Zend_Tool_Framework_Manifest_Repository */ public function process() { foreach ($this->_manifests as $manifest) { if ($manifest instanceof Zend_Tool_Framework_Manifest_MetadataManifestable) { $metadatas = $manifest->getMetadata(); if (!is_array($metadatas)) { $metadatas = array($metadatas); } foreach ($metadatas as $metadata) { if (is_array($metadata)) { if (!class_exists('Zend_Tool_Framework_Metadata_Dynamic')) { require_once 'Zend/Tool/Framework/Metadata/Dynamic.php'; } $metadata = new Zend_Tool_Framework_Metadata_Dynamic($metadata); } if (!$metadata instanceof Zend_Tool_Framework_Metadata_Interface) { require_once 'Zend/Tool/Framework/Manifest/Exception.php'; throw new Zend_Tool_Framework_Manifest_Exception( 'A Zend_Tool_Framework_Metadata_Interface object was not found in manifest ' . get_class($manifest) ); } $this->addMetadata($metadata); } } } return $this; } /** * getMetadatas() - This is the main search function for the repository. * * example: This will retrieve all metadata that matches the following criteria * $manifestRepo->getMetadatas(array( * 'providerName' => 'Version', * 'actionName' => 'show' * )); * * @param array $searchProperties * @param bool $includeNonExistentProperties * @return Zend_Tool_Framework_Manifest_Metadata[] */ public function getMetadatas(Array $searchProperties = array(), $includeNonExistentProperties = true) { $returnMetadatas = array(); // loop through the metadatas so that we can search each individual one foreach ($this->_metadatas as $metadata) { // each value will be retrieved from the metadata, each metadata should // implement a getter method to retrieve the value foreach ($searchProperties as $searchPropertyName => $searchPropertyValue) { if (method_exists($metadata, 'get' . $searchPropertyName)) { if ($metadata->{'get' . $searchPropertyName}() != $searchPropertyValue) { // if the metadata supports a specific property but the value does not // match, move on continue 2; } } elseif (!$includeNonExistentProperties) { // if the option $includeNonExitentProperties is false, then move on as // we dont want to include this metadata if non existent // search properties are not inside the target (current) metadata continue 2; } } // all searching has been accounted for, if we reach this point, then the metadata // is good and we can return it $returnMetadatas[] = $metadata; } return $returnMetadatas; } /** * getMetadata() - This will proxy to getMetadatas(), but will only return a single metadata. This method * should be used in situations where the search criteria is known to only find a single metadata object * * @param array $searchProperties * @param bool $includeNonExistentProperties * @return Zend_Tool_Framework_Manifest_Metadata */ public function getMetadata(Array $searchProperties = array(), $includeNonExistentProperties = true) { $metadatas = $this->getMetadatas($searchProperties, $includeNonExistentProperties); return array_shift($metadatas); } /** * __toString() - cast to string * * @return string */ public function __toString() { $metadatasByType = array(); foreach ($this->_metadatas as $metadata) { if (!array_key_exists($metadata->getType(), $metadatasByType)) { $metadatasByType[$metadata->getType()] = array(); } $metadatasByType[$metadata->getType()][] = $metadata; } $string = ''; foreach ($metadatasByType as $type => $metadatas) { $string .= $type . PHP_EOL; foreach ($metadatas as $metadata) { $metadataString = ' ' . $metadata->__toString() . PHP_EOL; //$metadataString = str_replace(PHP_EOL, PHP_EOL . ' ', $metadataString); $string .= $metadataString; } } return $string; } /** * count() - required by the Countable Interface * * @return int */ public function count() { return count($this->_metadatas); } /** * getIterator() - required by the IteratorAggregate interface * * @return ArrayIterator */ public function getIterator() { return new ArrayIterator($this->_metadatas); } }
elpd/coop
library/Zend/Tool/Framework/Manifest/Repository.php
PHP
mit
11,065
<?php namespace Oro\Bundle\LocaleBundle\Tests\Unit\Model; use Oro\Bundle\LocaleBundle\Model\LocaleSettings; use Oro\Bundle\LocaleBundle\DependencyInjection\Configuration as LocaleConfiguration; class LocaleSettingsTest extends \PHPUnit_Framework_TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $configManager; /** * @var \PHPUnit_Framework_MockObject_MockObject */ protected $calendarFactory; /** * @var LocaleSettings */ protected $localeSettings; protected function setUp() { $this->configManager = $this->getMockBuilder('Oro\Bundle\ConfigBundle\Config\ConfigManager') ->disableOriginalConstructor() ->getMock(); $this->calendarFactory = $this->getMock('Oro\Bundle\LocaleBundle\Model\CalendarFactoryInterface'); $this->localeSettings = new LocaleSettings($this->configManager, $this->calendarFactory); } public function testAddNameFormats() { $enFormat = '%first_name% %middle_name% %last_name%'; $enFormatModified = '%prefix% %%first_name% %middle_name% %last_name% %suffix%'; $ruFormat = '%last_name% %first_name% %middle_name%'; $this->assertEmpty($this->localeSettings->getNameFormats()); $this->localeSettings->addNameFormats(array('en' => $enFormat)); $this->assertEquals( array('en' => $enFormat), $this->localeSettings->getNameFormats() ); $this->localeSettings->addNameFormats(array('en' => $enFormatModified, 'ru' => $ruFormat)); $this->assertEquals( array('en' => $enFormatModified, 'ru' => $ruFormat), $this->localeSettings->getNameFormats() ); } public function testAddAddressFormats() { $usFormat = array( LocaleSettings::ADDRESS_FORMAT_KEY => '%name%\n%organization%\n%street%\n%CITY% %REGION% %COUNTRY% %postal_code%' ); $usFormatModified = array( LocaleSettings::ADDRESS_FORMAT_KEY => '%name%\n%organization%\n%street%\n%CITY% %REGION_CODE% %COUNTRY% %postal_code%' ); $ruFormat = array( LocaleSettings::ADDRESS_FORMAT_KEY => '%postal_code% %COUNTRY% %CITY%\n%STREET%\n%organization%\n%name%' ); $this->assertEmpty($this->localeSettings->getAddressFormats()); $this->localeSettings->addAddressFormats(array('US' => $usFormat)); $this->assertEquals( array('US' => $usFormat), $this->localeSettings->getAddressFormats() ); $this->localeSettings->addAddressFormats(array('US' => $usFormatModified, 'RU' => $ruFormat)); $this->assertEquals( array('US' => $usFormatModified, 'RU' => $ruFormat), $this->localeSettings->getAddressFormats() ); } public function testAddLocaleData() { $usData = array(LocaleSettings::DEFAULT_LOCALE_KEY => 'en_US'); $usDataModified = array(LocaleSettings::DEFAULT_LOCALE_KEY => 'en'); $ruData = array(LocaleSettings::DEFAULT_LOCALE_KEY => 'ru'); $this->assertEmpty($this->localeSettings->getLocaleData()); $this->localeSettings->addLocaleData(array('US' => $usData)); $this->assertEquals( array('US' => $usData), $this->localeSettings->getLocaleData() ); $this->localeSettings->addLocaleData(array('US' => $usDataModified, 'RU' => $ruData)); $this->assertEquals( array('US' => $usDataModified, 'RU' => $ruData), $this->localeSettings->getLocaleData() ); } public function testAddCurrencyData() { $usData = array(LocaleSettings::CURRENCY_SYMBOL_KEY => '$'); $usDataModified = array(LocaleSettings::CURRENCY_SYMBOL_KEY => 'AU$'); $ruData = array(LocaleSettings::CURRENCY_SYMBOL_KEY => 'руб.'); $this->assertEmpty($this->localeSettings->getCurrencyData()); $this->localeSettings->addCurrencyData(array('USD' => $usData)); $this->assertEquals( array('USD' => $usData), $this->localeSettings->getCurrencyData() ); $this->localeSettings->addCurrencyData(array('USD' => $usDataModified, 'RUR' => $ruData)); $this->assertEquals( array('USD' => $usDataModified, 'RUR' => $ruData), $this->localeSettings->getCurrencyData() ); } /** * @dataProvider getValidLocaleDataProvider */ public function testGetValidLocale($locale, $expectedLocale) { $this->assertEquals($expectedLocale, LocaleSettings::getValidLocale($locale)); } public function getValidLocaleDataProvider() { return array( array('ru_RU', 'ru_RU'), array('en', LocaleConfiguration::DEFAULT_LOCALE), array(null, LocaleConfiguration::DEFAULT_LOCALE), array('ru', 'ru'), array('en_Hans_CN_nedis_rozaj_x_prv1_prv2', 'en_US'), array('en_Hans_CA_nedis_rozaj_x_prv1_prv2', 'en_CA'), array('unknown', 'en_US'), ); } /** * @dataProvider getCountryByLocaleDataProvider */ public function testGetCountryByLocale($locale, $expectedCountry) { $this->assertEquals($expectedCountry, LocaleSettings::getCountryByLocale($locale)); } public function getCountryByLocaleDataProvider() { return array( array('EN', LocaleConfiguration::DEFAULT_COUNTRY), array('RU', LocaleConfiguration::DEFAULT_COUNTRY), array('en_US', 'US'), array('en_XX', LocaleConfiguration::DEFAULT_COUNTRY), ); } /** * @dataProvider getLocaleByCountryDataProvider */ public function testGetLocaleByCountry(array $localeData, $countryCode, $expectedLocale, $defaultLocale = null) { $this->localeSettings->addLocaleData($localeData); if (null !== $defaultLocale) { $this->configManager->expects($this->once()) ->method('get') ->with('oro_locale.locale') ->will($this->returnValue($defaultLocale)); } else { $this->configManager->expects($this->never())->method($this->anything()); } $this->assertEquals($expectedLocale, $this->localeSettings->getLocaleByCountry($countryCode)); } public function getLocaleByCountryDataProvider() { return array( array( array('GB' => array(LocaleSettings::DEFAULT_LOCALE_KEY => 'en_GB')), 'GB', 'en_GB' ), array( array(), 'GB', 'en_US', 'en_US' ), ); } /** * @param string $expectedValue * @param string $configurationValue * @dataProvider getLocaleDataProvider */ public function testGetLocale($expectedValue, $configurationValue) { $this->configManager->expects($this->once()) ->method('get') ->with('oro_locale.locale') ->will($this->returnValue($configurationValue)); $this->assertEquals($expectedValue, $this->localeSettings->getLocale()); $this->assertEquals($expectedValue, $this->localeSettings->getLocale()); } /** * @return array */ public function getLocaleDataProvider() { return array( 'configuration value' => array( 'expectedValue' => 'ru_RU', 'configurationValue' => 'ru_RU', ), 'default value' => array( 'expectedValue' => LocaleConfiguration::DEFAULT_LOCALE, 'configurationValue' => null, ), ); } public function testGetCountry() { $expectedCountry = 'CA'; $this->configManager->expects($this->once()) ->method('get') ->with('oro_locale.country') ->will($this->returnValue($expectedCountry)); $this->assertEquals($expectedCountry, $this->localeSettings->getCountry()); $this->assertEquals($expectedCountry, $this->localeSettings->getCountry()); } public function testGetCountryDefault() { $expectedCountry = 'US'; $this->configManager->expects($this->at(0)) ->method('get') ->with('oro_locale.country') ->will($this->returnValue(null)); $this->configManager->expects($this->at(1)) ->method('get') ->with('oro_locale.locale') ->will($this->returnValue('en_US')); $this->assertEquals($expectedCountry, $this->localeSettings->getCountry()); $this->assertEquals($expectedCountry, $this->localeSettings->getCountry()); } /** * @param $expectedValue * @param $configurationValue * @dataProvider getTimeZoneDataProvider */ public function testGetTimeZone($expectedValue, $configurationValue) { $this->configManager->expects($this->once()) ->method('get') ->with('oro_locale.timezone', false) ->will($this->returnValue($configurationValue)); $this->assertEquals($expectedValue, $this->localeSettings->getTimeZone()); $this->assertEquals($expectedValue, $this->localeSettings->getTimeZone()); } /** * @return array */ public function getTimeZoneDataProvider() { return array( 'configuration value' => array( 'expectedValue' => 'America/Los_Angeles', 'configurationValue' => 'America/Los_Angeles', ), 'default value' => array( 'expectedValue' => date_default_timezone_get(), 'configurationValue' => null, ), ); } public function testGetCurrency() { $expectedCurrency = 'GBP'; $this->configManager->expects($this->once()) ->method('get') ->with('oro_locale.currency') ->will($this->returnValue($expectedCurrency)); $this->assertEquals($expectedCurrency, $this->localeSettings->getCurrency()); $this->assertEquals($expectedCurrency, $this->localeSettings->getCurrency()); } public function testGetCurrencyDefault() { $expectedCurrency = LocaleConfiguration::DEFAULT_CURRENCY; $this->configManager->expects($this->once()) ->method('get') ->with('oro_locale.currency') ->will($this->returnValue(null)); $this->assertEquals($expectedCurrency, $this->localeSettings->getCurrency()); $this->assertEquals($expectedCurrency, $this->localeSettings->getCurrency()); } public function testGetCalendarDefaultLocaleAndLanguage() { $expectedLocale = 'ru_RU'; $expectedLanguage = 'fr_CA'; $this->configManager->expects($this->at(0)) ->method('get') ->with('oro_locale.locale') ->will($this->returnValue($expectedLocale)); $this->configManager->expects($this->at(1)) ->method('get') ->with('oro_locale.language') ->will($this->returnValue($expectedLanguage)); $calendar = $this->getMock('Oro\Bundle\LocaleBundle\Model\Calendar'); $this->calendarFactory->expects($this->once())->method('getCalendar') ->with($expectedLocale, $expectedLanguage) ->will($this->returnValue($calendar)); $this->assertSame($calendar, $this->localeSettings->getCalendar()); } public function testGetCalendarSpecificLocale() { $locale = 'ru_RU'; $language = 'fr_CA'; $this->configManager->expects($this->never())->method($this->anything()); $calendar = $this->getMock('Oro\Bundle\LocaleBundle\Model\Calendar'); $this->calendarFactory->expects($this->once())->method('getCalendar') ->with($locale, $language) ->will($this->returnValue($calendar)); $this->assertSame($calendar, $this->localeSettings->getCalendar($locale, $language)); } public function testIsFormatAddressByAddressCountry() { $this->configManager->expects($this->at(0)) ->method('get') ->with('oro_locale.format_address_by_address_country') ->will($this->returnValue('')); $this->configManager->expects($this->at(1)) ->method('get') ->with('oro_locale.format_address_by_address_country') ->will($this->returnValue('1')); $this->assertFalse($this->localeSettings->isFormatAddressByAddressCountry()); $this->assertTrue($this->localeSettings->isFormatAddressByAddressCountry()); } /** * @param string $expectedValue * @param string $configurationValue * @dataProvider getLanguageDataProvider */ public function testGetLanguage($expectedValue, $configurationValue) { $this->configManager->expects($this->once()) ->method('get') ->with('oro_locale.language') ->will($this->returnValue($configurationValue)); $this->assertEquals($expectedValue, $this->localeSettings->getLanguage()); } /** * @return array */ public function getLanguageDataProvider() { return array( 'configuration value' => array( 'expectedValue' => 'ru', 'configurationValue' => 'ru', ), 'default value' => array( 'expectedValue' => LocaleConfiguration::DEFAULT_LANGUAGE, 'configurationValue' => null, ), ); } public function testGetCurrencySymbolByCurrency() { $existingCurrencyCode = 'USD'; $existingCurrencySymbol = '$'; $notExistingCurrencyCode = 'UAK'; $currencyData = array( $existingCurrencyCode => array('symbol' => $existingCurrencySymbol) ); $this->localeSettings->addCurrencyData($currencyData); $this->assertEquals( $existingCurrencySymbol, $this->localeSettings->getCurrencySymbolByCurrency($existingCurrencyCode) ); $this->assertEquals( $notExistingCurrencyCode, $this->localeSettings->getCurrencySymbolByCurrency($notExistingCurrencyCode) ); } public function testGetLocaleByCode() { $locales = $this->localeSettings->getLocalesByCodes(['en', 'fr']); $this->assertCount(2, $locales); $this->configManager->expects($this->once()) ->method('get') ->with('test'); $this->localeSettings->get('test'); } }
minhnguyen-balance/oro_platform
vendor/oro/platform/src/Oro/Bundle/LocaleBundle/Tests/Unit/Model/LocaleSettingsTest.php
PHP
mit
14,838
/* Copyright (C) 2001-2011 by Serge Lamikhov-Center Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ELF_HEADER_HPP #define ELF_HEADER_HPP #include <iostream> namespace ELFIO { class elf_header { public: virtual ~elf_header() {}; virtual bool load( std::istream& stream ) = 0; virtual bool save( std::ostream& stream ) const = 0; // ELF header functions ELFIO_GET_ACCESS_DECL( unsigned char, class ); ELFIO_GET_ACCESS_DECL( unsigned char, elf_version ); ELFIO_GET_ACCESS_DECL( unsigned char, encoding ); ELFIO_GET_ACCESS_DECL( Elf_Word, version ); ELFIO_GET_ACCESS_DECL( Elf_Half, header_size ); ELFIO_GET_ACCESS_DECL( Elf_Half, section_entry_size ); ELFIO_GET_ACCESS_DECL( Elf_Half, segment_entry_size ); ELFIO_GET_SET_ACCESS_DECL( unsigned char, os_abi ); ELFIO_GET_SET_ACCESS_DECL( unsigned char, abi_version ); ELFIO_GET_SET_ACCESS_DECL( Elf_Half, type ); ELFIO_GET_SET_ACCESS_DECL( Elf_Half, machine ); ELFIO_GET_SET_ACCESS_DECL( Elf_Word, flags ); ELFIO_GET_SET_ACCESS_DECL( Elf64_Addr, entry ); ELFIO_GET_SET_ACCESS_DECL( Elf_Half, sections_num ); ELFIO_GET_SET_ACCESS_DECL( Elf64_Off, sections_offset ); ELFIO_GET_SET_ACCESS_DECL( Elf_Half, segments_num ); ELFIO_GET_SET_ACCESS_DECL( Elf64_Off, segments_offset ); ELFIO_GET_SET_ACCESS_DECL( Elf_Half, section_name_str_index ); }; template< class T > struct elf_header_impl_types; template<> struct elf_header_impl_types<Elf32_Ehdr> { typedef Elf32_Phdr Phdr_type; typedef Elf32_Shdr Shdr_type; static const unsigned char file_class = ELFCLASS32; }; template<> struct elf_header_impl_types<Elf64_Ehdr> { typedef Elf64_Phdr Phdr_type; typedef Elf64_Shdr Shdr_type; static const unsigned char file_class = ELFCLASS64; }; template< class T > class elf_header_impl : public elf_header { public: elf_header_impl( endianess_convertor* convertor_, unsigned char encoding ) { convertor = convertor_; std::fill_n( reinterpret_cast<char*>( &header ), sizeof( header ), '\0' ); header.e_ident[EI_MAG0] = ELFMAG0; header.e_ident[EI_MAG1] = ELFMAG1; header.e_ident[EI_MAG2] = ELFMAG2; header.e_ident[EI_MAG3] = ELFMAG3; header.e_ident[EI_CLASS] = elf_header_impl_types<T>::file_class; header.e_ident[EI_DATA] = encoding; header.e_ident[EI_VERSION] = EV_CURRENT; header.e_version = EV_CURRENT; header.e_version = (*convertor)( header.e_version ); header.e_ehsize = ( sizeof( header ) ); header.e_ehsize = (*convertor)( header.e_ehsize ); header.e_shstrndx = (*convertor)( (Elf_Half)1 ); header.e_phentsize = sizeof( typename elf_header_impl_types<T>::Phdr_type ); header.e_shentsize = sizeof( typename elf_header_impl_types<T>::Shdr_type ); header.e_phentsize = (*convertor)( header.e_phentsize ); header.e_shentsize = (*convertor)( header.e_shentsize ); } bool load( std::istream& stream ) { stream.seekg( 0 ); stream.read( reinterpret_cast<char*>( &header ), sizeof( header ) ); return (stream.gcount() == sizeof( header ) ); } bool save( std::ostream& stream ) const { stream.seekp( 0 ); stream.write( reinterpret_cast<const char*>( &header ), sizeof( header ) ); return stream.good(); } // ELF header functions ELFIO_GET_ACCESS( unsigned char, class, header.e_ident[EI_CLASS] ); ELFIO_GET_ACCESS( unsigned char, elf_version, header.e_ident[EI_VERSION] ); ELFIO_GET_ACCESS( unsigned char, encoding, header.e_ident[EI_DATA] ); ELFIO_GET_ACCESS( Elf_Word, version, header.e_version ); ELFIO_GET_ACCESS( Elf_Half, header_size, header.e_ehsize ); ELFIO_GET_ACCESS( Elf_Half, section_entry_size, header.e_shentsize ); ELFIO_GET_ACCESS( Elf_Half, segment_entry_size, header.e_phentsize ); ELFIO_GET_SET_ACCESS( unsigned char, os_abi, header.e_ident[EI_OSABI] ); ELFIO_GET_SET_ACCESS( unsigned char, abi_version, header.e_ident[EI_ABIVERSION] ); ELFIO_GET_SET_ACCESS( Elf_Half, type, header.e_type ); ELFIO_GET_SET_ACCESS( Elf_Half, machine, header.e_machine ); ELFIO_GET_SET_ACCESS( Elf_Word, flags, header.e_flags ); ELFIO_GET_SET_ACCESS( Elf_Half, section_name_str_index, header.e_shstrndx ); ELFIO_GET_SET_ACCESS( Elf64_Addr, entry, header.e_entry ); ELFIO_GET_SET_ACCESS( Elf_Half, sections_num, header.e_shnum ); ELFIO_GET_SET_ACCESS( Elf64_Off, sections_offset, header.e_shoff ); ELFIO_GET_SET_ACCESS( Elf_Half, segments_num, header.e_phnum ); ELFIO_GET_SET_ACCESS( Elf64_Off, segments_offset, header.e_phoff ); private: T header; endianess_convertor* convertor; }; } // namespace ELFIO #endif // ELF_HEADER_HPP
terry2012/codereason
libs/elfio/elfio_header.hpp
C++
mit
6,263
require 'spec_helper' describe 'redis::administration' do context 'should set kernel and system values' do it do is_expected.to contain_sysctl('vm.overcommit_memory').with( { 'ensure'=>'present', 'value'=>'1' } ) end it do is_expected.to contain_exec("Disable Hugepages").with( { "command" => "echo never > /sys/kernel/mm/transparent_hugepage/enabled", "path" => ["/sbin", "/usr/sbin", "/bin", "/usr/bin"], "onlyif" => "test -f /sys/kernel/mm/transparent_hugepage/enabled", "unless" => "cat /sys/kernel/mm/transparent_hugepage/enabled | grep \"\\[never\\]\"", } ) end it do is_expected.to contain_sysctl("net.core.somaxconn").with( { "ensure" => "present", "value" => "65535", } ) end end end
integratedfordevelopers/integrated-puphpet
puppet/modules/redis/spec/classes/redis_administration_spec.rb
Ruby
mit
891
<div rima-users-connections-map class="rima-users-connections"></div>
Cha-OS/KnAllEdge
src/frontend/app/components/rima/partials/rima-insights-map.tpl.html
HTML
mit
69
require "test/unit" require "oversip" class OverSIPTest < Test::Unit::TestCase def assert_true(object, message="") assert_equal(true, object, message) end def assert_false(object, message="") assert_equal(false, object, message) end def assert_equal_options(options, element) assert options.include?(element) end end
yuan-/OverSIP
test/oversip_test_helper.rb
Ruby
mit
347
/* * Author: Brian <brian@vamrs.com> * Copyright (c) 2019 Vamrs Corporation. * * SPDX-License-Identifier: MIT */ #pragma once #ifdef __cplusplus extern "C" { #endif #include "mraa_internal.h" #define MRAA_ROCKPI4_GPIO_COUNT 27 #define MRAA_ROCKPI4_I2C_COUNT 3 #define MRAA_ROCKPI4_SPI_COUNT 2 #define MRAA_ROCKPI4_UART_COUNT 2 #define MRAA_ROCKPI4_PWM_COUNT 2 #define MRAA_ROCKPI4_AIO_COUNT 1 #define MRAA_ROCKPI4_PIN_COUNT 40 mraa_board_t * mraa_rockpi4(); #ifdef __cplusplus } #endif
intel-iot-devkit/mraa
include/arm/rockpi4.h
C
mit
510
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Store.Model")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Store.Model")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("940b32e0-96e1-4353-a691-67f094b325f0")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
chsakell/mvcarchitecture
Store.Model/Properties/AssemblyInfo.cs
C#
mit
1,398
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. module MsRest # # Class which represents an error meaning that either HTTP request or HTTP response was invalid. # class HttpOperationException < StandardError # @return [Net::HTTPRequest] the HTTP request object. attr_accessor :request # @return [Net::HTTPResponse] the HTTP response object. attr_accessor :response # @return [String] the HTTP response body. attr_accessor :body # # Creates and initialize new instance of the HttpOperationException class. # @param [Net::HTTPRequest] request the HTTP request object. # @param [Net::HTTPResponse] response the HTTP response object. # @param [String] body the HTTP response body. def initialize(request, response, body = nil) @request = request @response = response @body = body end end end
colemickens/autorest
ClientRuntimes/Ruby/ms-rest/lib/ms_rest/http_operation_exception.rb
Ruby
mit
981
module ActiveRecord module Calculations # Count the records. # # Person.count # # => the total count of all people # # Person.count(:age) # # => returns the total count of all people whose age is present in database # # Person.count(:all) # # => performs a COUNT(*) (:all is an alias for '*') # # Person.distinct.count(:age) # # => counts the number of different age values # # If +count+ is used with +group+, it returns a Hash whose keys represent the aggregated column, # and the values are the respective amounts: # # Person.group(:city).count # # => { 'Rome' => 5, 'Paris' => 3 } # # If +count+ is used with +group+ for multiple columns, it returns a Hash whose # keys are an array containing the individual values of each column and the value # of each key would be the +count+. # # Article.group(:status, :category).count # # => {["draft", "business"]=>10, ["draft", "technology"]=>4, # ["published", "business"]=>0, ["published", "technology"]=>2} # # If +count+ is used with +select+, it will count the selected columns: # # Person.select(:age).count # # => counts the number of different age values # # Note: not all valid +select+ expressions are valid +count+ expressions. The specifics differ # between databases. In invalid cases, an error from the database is thrown. def count(column_name = nil, options = {}) if options.present? && !ActiveRecord.const_defined?(:DeprecatedFinders) raise ArgumentError, "Relation#count does not support finder options anymore. " \ "Please build a scope and then call count on it or use the " \ "activerecord-deprecated_finders gem to enable this functionality." end # TODO: Remove options argument as soon we remove support to # activerecord-deprecated_finders. calculate(:count, column_name, options) end # Calculates the average value on a given column. Returns +nil+ if there's # no row. See +calculate+ for examples with options. # # Person.average(:age) # => 35.8 def average(column_name, options = {}) # TODO: Remove options argument as soon we remove support to # activerecord-deprecated_finders. calculate(:average, column_name, options) end # Calculates the minimum value on a given column. The value is returned # with the same data type of the column, or +nil+ if there's no row. See # +calculate+ for examples with options. # # Person.minimum(:age) # => 7 def minimum(column_name, options = {}) # TODO: Remove options argument as soon we remove support to # activerecord-deprecated_finders. calculate(:minimum, column_name, options) end # Calculates the maximum value on a given column. The value is returned # with the same data type of the column, or +nil+ if there's no row. See # +calculate+ for examples with options. # # Person.maximum(:age) # => 93 def maximum(column_name, options = {}) # TODO: Remove options argument as soon we remove support to # activerecord-deprecated_finders. calculate(:maximum, column_name, options) end # Calculates the sum of values on a given column. The value is returned # with the same data type of the column, 0 if there's no row. See # +calculate+ for examples with options. # # Person.sum(:age) # => 4562 def sum(*args) calculate(:sum, *args) end # This calculates aggregate values in the given column. Methods for count, sum, average, # minimum, and maximum have been added as shortcuts. # # There are two basic forms of output: # # * Single aggregate value: The single value is type cast to Integer for COUNT, Float # for AVG, and the given column's type for everything else. # # * Grouped values: This returns an ordered hash of the values and groups them. It # takes either a column name, or the name of a belongs_to association. # # values = Person.group('last_name').maximum(:age) # puts values["Drake"] # # => 43 # # drake = Family.find_by(last_name: 'Drake') # values = Person.group(:family).maximum(:age) # Person belongs_to :family # puts values[drake] # # => 43 # # values.each do |family, max_age| # ... # end # # Person.calculate(:count, :all) # The same as Person.count # Person.average(:age) # SELECT AVG(age) FROM people... # # # Selects the minimum age for any family without any minors # Person.group(:last_name).having("min(age) > 17").minimum(:age) # # Person.sum("2 * age") def calculate(operation, column_name, options = {}) # TODO: Remove options argument as soon we remove support to # activerecord-deprecated_finders. if column_name.is_a?(Symbol) && attribute_alias?(column_name) column_name = attribute_alias(column_name) end if has_include?(column_name) construct_relation_for_association_calculations.calculate(operation, column_name, options) else perform_calculation(operation, column_name, options) end end # Use <tt>pluck</tt> as a shortcut to select one or more attributes without # loading a bunch of records just to grab the attributes you want. # # Person.pluck(:name) # # instead of # # Person.all.map(&:name) # # Pluck returns an <tt>Array</tt> of attribute values type-casted to match # the plucked column names, if they can be deduced. Plucking an SQL fragment # returns String values by default. # # Person.pluck(:id) # # SELECT people.id FROM people # # => [1, 2, 3] # # Person.pluck(:id, :name) # # SELECT people.id, people.name FROM people # # => [[1, 'David'], [2, 'Jeremy'], [3, 'Jose']] # # Person.pluck('DISTINCT role') # # SELECT DISTINCT role FROM people # # => ['admin', 'member', 'guest'] # # Person.where(age: 21).limit(5).pluck(:id) # # SELECT people.id FROM people WHERE people.age = 21 LIMIT 5 # # => [2, 3] # # Person.pluck('DATEDIFF(updated_at, created_at)') # # SELECT DATEDIFF(updated_at, created_at) FROM people # # => ['0', '27761', '173'] # def pluck(*column_names) column_names.map! do |column_name| if column_name.is_a?(Symbol) && attribute_alias?(column_name) attribute_alias(column_name) else column_name.to_s end end if has_include?(column_names.first) construct_relation_for_association_calculations.pluck(*column_names) else relation = spawn relation.select_values = column_names.map { |cn| columns_hash.key?(cn) ? arel_table[cn] : cn } result = klass.connection.select_all(relation.arel, nil, relation.arel.bind_values + bind_values) result.cast_values(klass.column_types) end end # Pluck all the ID's for the relation using the table's primary key # # Person.ids # SELECT people.id FROM people # Person.joins(:companies).ids # SELECT people.id FROM people INNER JOIN companies ON companies.person_id = people.id def ids pluck primary_key end private def has_include?(column_name) eager_loading? || (includes_values.present? && ((column_name && column_name != :all) || references_eager_loaded_tables?)) end def perform_calculation(operation, column_name, options = {}) # TODO: Remove options argument as soon we remove support to # activerecord-deprecated_finders. operation = operation.to_s.downcase # If #count is used with #distinct / #uniq it is considered distinct. (eg. relation.distinct.count) distinct = self.distinct_value if operation == "count" column_name ||= select_for_count unless arel.ast.grep(Arel::Nodes::OuterJoin).empty? distinct = true end column_name = primary_key if column_name == :all && distinct distinct = nil if column_name =~ /\s*DISTINCT[\s(]+/i end if group_values.any? execute_grouped_calculation(operation, column_name, distinct) else execute_simple_calculation(operation, column_name, distinct) end end def aggregate_column(column_name) if @klass.column_names.include?(column_name.to_s) Arel::Attribute.new(@klass.unscoped.table, column_name) else Arel.sql(column_name == :all ? "*" : column_name.to_s) end end def operation_over_aggregate_column(column, operation, distinct) operation == 'count' ? column.count(distinct) : column.send(operation) end def execute_simple_calculation(operation, column_name, distinct) #:nodoc: # Postgresql doesn't like ORDER BY when there are no GROUP BY relation = unscope(:order) column_alias = column_name bind_values = nil if operation == "count" && (relation.limit_value || relation.offset_value) # Shortcut when limit is zero. return 0 if relation.limit_value == 0 query_builder = build_count_subquery(relation, column_name, distinct) bind_values = query_builder.bind_values + relation.bind_values else column = aggregate_column(column_name) select_value = operation_over_aggregate_column(column, operation, distinct) column_alias = select_value.alias column_alias ||= @klass.connection.column_name_for_operation(operation, select_value) relation.select_values = [select_value] query_builder = relation.arel bind_values = query_builder.bind_values + relation.bind_values end result = @klass.connection.select_all(query_builder, nil, bind_values) row = result.first value = row && row.values.first column = result.column_types.fetch(column_alias) do type_for(column_name) end type_cast_calculated_value(value, column, operation) end def execute_grouped_calculation(operation, column_name, distinct) #:nodoc: group_attrs = group_values if group_attrs.first.respond_to?(:to_sym) association = @klass._reflect_on_association(group_attrs.first) associated = group_attrs.size == 1 && association && association.belongs_to? # only count belongs_to associations group_fields = Array(associated ? association.foreign_key : group_attrs) else group_fields = group_attrs end group_fields = arel_columns(group_fields) group_aliases = group_fields.map { |field| column_alias_for(field) } group_columns = group_aliases.zip(group_fields).map { |aliaz,field| [aliaz, field] } group = group_fields if operation == 'count' && column_name == :all aggregate_alias = 'count_all' else aggregate_alias = column_alias_for([operation, column_name].join(' ')) end select_values = [ operation_over_aggregate_column( aggregate_column(column_name), operation, distinct).as(aggregate_alias) ] select_values += self.select_values unless having_values.empty? select_values.concat group_fields.zip(group_aliases).map { |field,aliaz| if field.respond_to?(:as) field.as(aliaz) else "#{field} AS #{aliaz}" end } relation = except(:group) relation.group_values = group relation.select_values = select_values calculated_data = @klass.connection.select_all(relation, nil, relation.arel.bind_values + bind_values) if association key_ids = calculated_data.collect { |row| row[group_aliases.first] } key_records = association.klass.base_class.find(key_ids) key_records = Hash[key_records.map { |r| [r.id, r] }] end Hash[calculated_data.map do |row| key = group_columns.map { |aliaz, col_name| column = calculated_data.column_types.fetch(aliaz) do type_for(col_name) end type_cast_calculated_value(row[aliaz], column) } key = key.first if key.size == 1 key = key_records[key] if associated column_type = calculated_data.column_types.fetch(aggregate_alias) { type_for(column_name) } [key, type_cast_calculated_value(row[aggregate_alias], column_type, operation)] end] end # Converts the given keys to the value that the database adapter returns as # a usable column name: # # column_alias_for("users.id") # => "users_id" # column_alias_for("sum(id)") # => "sum_id" # column_alias_for("count(distinct users.id)") # => "count_distinct_users_id" # column_alias_for("count(*)") # => "count_all" # column_alias_for("count", "id") # => "count_id" def column_alias_for(keys) if keys.respond_to? :name keys = "#{keys.relation.name}.#{keys.name}" end table_name = keys.to_s.downcase table_name.gsub!(/\*/, 'all') table_name.gsub!(/\W+/, ' ') table_name.strip! table_name.gsub!(/ +/, '_') @klass.connection.table_alias_for(table_name) end def type_for(field) field_name = field.respond_to?(:name) ? field.name.to_s : field.to_s.split('.').last @klass.type_for_attribute(field_name) end def type_cast_calculated_value(value, type, operation = nil) case operation when 'count' then value.to_i when 'sum' then type.type_cast_from_database(value || 0) when 'average' then value.respond_to?(:to_d) ? value.to_d : value else type.type_cast_from_database(value) end end # TODO: refactor to allow non-string `select_values` (eg. Arel nodes). def select_for_count if select_values.present? select_values.join(", ") else :all end end def build_count_subquery(relation, column_name, distinct) column_alias = Arel.sql('count_column') subquery_alias = Arel.sql('subquery_for_count') aliased_column = aggregate_column(column_name == :all ? 1 : column_name).as(column_alias) relation.select_values = [aliased_column] arel = relation.arel subquery = arel.as(subquery_alias) sm = Arel::SelectManager.new relation.engine sm.bind_values = arel.bind_values select_value = operation_over_aggregate_column(column_alias, 'count', distinct) sm.project(select_value).from(subquery) end end end
msaintemarie/msaintemarie.github.io
vendor/cache/ruby/2.6.0/gems/activerecord-4.2.11.1/lib/active_record/relation/calculations.rb
Ruby
mit
14,881
/* * This file is part of SpongeAPI, licensed under the MIT License (MIT). * * Copyright (c) SpongePowered <https://www.spongepowered.org> * Copyright (c) contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.spongepowered.api.extra.fluid.data.manipulator.mutable; import static com.google.common.base.Preconditions.checkNotNull; import org.spongepowered.api.data.DataHolder; import org.spongepowered.api.data.manipulator.DataManipulator; import org.spongepowered.api.data.manipulator.mutable.MappedData; import org.spongepowered.api.data.value.mutable.ListValue; import org.spongepowered.api.data.value.mutable.MapValue; import org.spongepowered.api.extra.fluid.FluidStack; import org.spongepowered.api.extra.fluid.FluidStackSnapshot; import org.spongepowered.api.extra.fluid.data.manipulator.immutable.ImmutableFluidTankData; import org.spongepowered.api.util.Direction; import java.util.ArrayList; import java.util.List; import java.util.Optional; /** * The primary definition of a "tank" is that at any given {@link Direction}, * the {@link DataHolder} may have multiple {@link FluidStack}s existing within * itself. Granted, in most cases, the {@link Direction} doesn't quite matter as * the tank itself is just a single container containing multiple * {@link FluidStack}s, however, in some cases, mod added tanks may have * different tanks for different directions. Note that setting an empty * {@link List} of {@link FluidStackSnapshot}s to a {@link Direction} is the * functional equivalent to saying "remove all fluids from that direction". */ public interface FluidTankData extends MappedData<Direction, List<FluidStackSnapshot>, FluidTankData, ImmutableFluidTankData> { /** * Gets the {@link MapValue} of the various {@link FluidStackSnapshot}s * available from the owner. Note that a fluid tank may have multiple * {@link FluidStack}s differing based on {@link Direction}. * * @return The map value of direction to list of fluid snapshots */ MapValue<Direction, List<FluidStackSnapshot>> fluids(); /** * Gets the {@link List} of {@link FluidStackSnapshot}s at a defined * {@link Direction}. * * @param direction The direction * @return The list of fluid stack snapshots, if available */ default Optional<List<FluidStackSnapshot>> fluidAtDirection(Direction direction) { MapValue<Direction, List<FluidStackSnapshot>> fluids = fluids(); if (fluids.containsKey(checkNotNull(direction, "Direction was null!"))) { return Optional.of(new ArrayList<>(fluids.get().get(direction))); } return Optional.empty(); } }
AlphaModder/SpongeAPI
src/main/java/org/spongepowered/api/extra/fluid/data/manipulator/mutable/FluidTankData.java
Java
mit
3,712
--- layout: page weight: 0 title: Categories navigation: show: false seo: title: Categories override: true description: Paying attention to your deliverability metrics can help optimize your delivery rate and reduce the risk of being seen as a spammer. --- Categories help organize your email analytics by enabling you to tag emails you send by topics you define. Just as you can view the statistics on all your activity under the '[Statistics]({{root_url}}/User_Guide/Statistics/index.html)' tab, you can go a step further and view the [statistics broken down to a particular category]({{root_url}}/User_Guide/Statistics/categories.html). The events that can be associated with category include: - Emails sent - Clicks - Opens - Bounces - Spam Reports - Unsubscribes The actual statistics included vary depending upon the set of enabled [Apps]({{root_url}}/User_Guide/Settings/). Emails sent, bounces and spam reports will always get tracked. [Unsubscribes]({{root_url}}/User_Guide/Settings/tracking.html), [Clicks]({{root_url}}/User_Guide/Settings/tracking.html), and [Opens]({{root_url}}/User_Guide/Settings/tracking.html) require that the associated Setting is enabled. Check out [Settings]({{site.app_url}}/settings) to see which apps you have enabled. In order to add the X-SMTPAPI categories header, please look at our [SMTP API Categories]({{root_url}}/API_Reference/SMTP_API/categories.html) documentation. You can also get a [full category list]({{root_url}}/API_Reference/Web_API_v3/Categories/categories.html#-GET) or get [category specific statistics]({{root_url}}/API_Reference/Web_API_v3/Stats/categories.html) from the SendGrid API.
katieporter/docs
source/Glossary/categories.md
Markdown
mit
1,675
/* * Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ /*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */ /*global define, $, brackets, console */ define(function (require, exports, module) { "use strict"; var AppInit = brackets.getModule("utils/AppInit"), PreferencesManager = brackets.getModule("preferences/PreferencesManager"), UrlParams = brackets.getModule("utils/UrlParams").UrlParams, Strings = brackets.getModule("strings"), HealthDataUtils = require("HealthDataUtils"), uuid = require("thirdparty/uuid"); var prefs = PreferencesManager.getExtensionPrefs("healthData"); prefs.definePreference("healthDataTracking", "boolean", true, { description: Strings.DESCRIPTION_HEALTH_DATA_TRACKING }); var ONE_MINUTE = 60 * 1000, ONE_DAY = 24 * 60 * ONE_MINUTE, FIRST_LAUNCH_SEND_DELAY = 30 * ONE_MINUTE, timeoutVar; var params = new UrlParams(); params.parse(); /** * Get the Health Data which will be sent to the server. Initially it is only one time data. */ function getHealthData() { var result = new $.Deferred(), oneTimeHealthData = {}; var userUuid = PreferencesManager.getViewState("UUID"); if (!userUuid) { userUuid = uuid.v4(); PreferencesManager.setViewState("UUID", userUuid); } oneTimeHealthData.uuid = userUuid; oneTimeHealthData.snapshotTime = Date.now(); oneTimeHealthData.os = brackets.platform; oneTimeHealthData.userAgent = navigator.userAgent; oneTimeHealthData.osLanguage = brackets.app.language; oneTimeHealthData.bracketsLanguage = brackets.getLocale(); oneTimeHealthData.bracketsVersion = brackets.metadata.version; HealthDataUtils.getUserInstalledExtensions() .done(function (userInstalledExtensions) { oneTimeHealthData.installedExtensions = userInstalledExtensions; }) .always(function () { return result.resolve(oneTimeHealthData); }); return result.promise(); } /** * Send data to the server */ function sendHealthDataToServer() { var result = new $.Deferred(); getHealthData().done(function (healthData) { var url = brackets.config.healthDataServerURL, data = JSON.stringify(healthData); $.ajax({ url: url, type: "POST", data: data, dataType: "text", contentType: "text/plain" }) .done(function () { result.resolve(); }) .fail(function (jqXHR, status, errorThrown) { console.error("Error in sending Health Data. Response : " + jqXHR.responseText + ". Status : " + status + ". Error : " + errorThrown); result.reject(); }); }) .fail(function () { result.reject(); }); return result.promise(); } /* * Check if the Health Data is to be sent to the server. If the user has enabled tracking, Health Data will be sent once every 24 hours. * Send Health Data to the server if the period is more than 24 hours. * We are sending the data as soon as the user launches brackets. The data will be sent to the server only after the notification dialog * for opt-out/in is closed. */ function checkHealthDataSend() { var result = new $.Deferred(), isHDTracking = prefs.get("healthDataTracking"); window.clearTimeout(timeoutVar); if (isHDTracking) { var nextTimeToSend = PreferencesManager.getViewState("nextHealthDataSendTime"), currentTime = Date.now(); // Never send data before FIRST_LAUNCH_SEND_DELAY has ellapsed on a fresh install. This gives the user time to read the notification // popup, learn more, and opt out if desired if (!nextTimeToSend) { nextTimeToSend = currentTime + FIRST_LAUNCH_SEND_DELAY; PreferencesManager.setViewState("nextHealthDataSendTime", nextTimeToSend); // don't return yet though - still want to set the timeout below } if (currentTime >= nextTimeToSend) { // Bump up nextHealthDataSendTime now to avoid any chance of sending data again before 24 hours, e.g. if the server request fails // or the code below crashes PreferencesManager.setViewState("nextHealthDataSendTime", currentTime + ONE_DAY); sendHealthDataToServer() .done(function () { result.resolve(); }) .fail(function () { result.reject(); }) .always(function () { timeoutVar = setTimeout(checkHealthDataSend, ONE_DAY); }); } else { timeoutVar = setTimeout(checkHealthDataSend, nextTimeToSend - currentTime); result.reject(); } } else { result.reject(); } return result.promise(); } prefs.on("change", "healthDataTracking", function () { checkHealthDataSend(); }); window.addEventListener("online", function () { checkHealthDataSend(); }); window.addEventListener("offline", function () { window.clearTimeout(timeoutVar); }); AppInit.appReady(function () { checkHealthDataSend(); }); exports.getHealthData = getHealthData; exports.checkHealthDataSend = checkHealthDataSend; });
resir014/brackets
src/extensions/default/HealthData/HealthDataManager.js
JavaScript
mit
7,092
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.azure.resourcemanager.resources.fluentcore.model; /** * The wrapper around an inner model providing extended functionalities. * * @param <T> the type of the inner object. */ public interface HasInnerModel<T> { /** * @return wrapped inner model providing direct access to the underlying * auto-generated API implementation, based on Azure REST API */ T innerModel(); }
Azure/azure-sdk-for-java
sdk/resourcemanagerhybrid/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/model/HasInnerModel.java
Java
mit
505
using Chemistry; using MassSpectrometry; using MzLibUtil; using Proteomics.Fragmentation; using Proteomics.ProteolyticDigestion; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; namespace EngineLayer { public abstract class MetaMorpheusEngine { protected static readonly Dictionary<DissociationType, double> complementaryIonConversionDictionary = new Dictionary<DissociationType, double> { { DissociationType.HCD, Constants.ProtonMass }, { DissociationType.ETD, 2 * Constants.ProtonMass }, //presence of zplusone (zdot) makes this two instead of one { DissociationType.CID, Constants.ProtonMass }, //TODO: refactor such that complementary ions are generated specifically for their complementary pair. //TODO: create a method to auto-determine the conversion }; public readonly CommonParameters CommonParameters; protected readonly List<(string FileName, CommonParameters Parameters)> FileSpecificParameters; protected readonly List<string> NestedIds; protected MetaMorpheusEngine(CommonParameters commonParameters, List<(string FileName, CommonParameters Parameters)> fileSpecificParameters, List<string> nestedIds) { CommonParameters = commonParameters; FileSpecificParameters = fileSpecificParameters; NestedIds = nestedIds; } public static event EventHandler<SingleEngineEventArgs> StartingSingleEngineHander; public static event EventHandler<SingleEngineFinishedEventArgs> FinishedSingleEngineHandler; public static event EventHandler<StringEventArgs> OutLabelStatusHandler; public static event EventHandler<StringEventArgs> WarnHandler; public static event EventHandler<ProgressEventArgs> OutProgressHandler; public static double CalculatePeptideScore(MsDataScan thisScan, List<MatchedFragmentIon> matchedFragmentIons, bool fragmentsCanHaveDifferentCharges = false) { if(fragmentsCanHaveDifferentCharges) { return CalculateAllChargesPeptideScore(thisScan, matchedFragmentIons); } double score = 0; if (thisScan.MassSpectrum.XcorrProcessed) { // XCorr foreach (var fragment in matchedFragmentIons) { switch (fragment.NeutralTheoreticalProduct.ProductType) { case ProductType.aDegree: case ProductType.aStar: case ProductType.bDegree: case ProductType.bStar: case ProductType.yDegree: case ProductType.yStar: score += 0.01 * fragment.Intensity; break; default: score += 1 * fragment.Intensity; break; } } } else { // Morpheus score for (int i = 0; i < matchedFragmentIons.Count; i++) { score += 1 + matchedFragmentIons[i].Intensity / thisScan.TotalIonCurrent; } } return score; } //Used only when user wants to generate spectral library. //Normal search only looks for one match ion for one fragment, and if it accepts it then it doesn't try to look for different charge states of that same fragment. //The score will be the number of matched ions and plus some fraction calculated by intensity(matchedFragmentIons[i].Intensity / thisScan.TotalIonCurrent). //Like b1, b2, b3 will have score 3.xxx;But when generating library, we need look for match ions with all charges.So we will have b1,b2,b3, b1^2, b2^3. If using //the normal scoring function, the score will be 5.xxxx, which is not proper. The score for b1 and b1^2 should also be 1 plus some some fraction calculated by intensity, //because they are matching the same fragment ion just with different charges. So b1, b2, b3, b1^2, b2^3 should be also 3.xxx(but a little higher than b1, b2, b3 as //the fraction part) rather than 5.xxx. private static double CalculateAllChargesPeptideScore(MsDataScan thisScan, List<MatchedFragmentIon> matchedFragmentIons) { double score = 0; // Morpheus score List<String> ions = new List<String>(); for (int i = 0; i < matchedFragmentIons.Count; i++) { String ion = $"{ matchedFragmentIons[i].NeutralTheoreticalProduct.ProductType.ToString()}{ matchedFragmentIons[i].NeutralTheoreticalProduct.FragmentNumber}"; if (ions.Contains(ion)) { score += matchedFragmentIons[i].Intensity / thisScan.TotalIonCurrent; } else { score += 1 + matchedFragmentIons[i].Intensity / thisScan.TotalIonCurrent; ions.Add(ion); } } return score; } public static List<MatchedFragmentIon> MatchFragmentIons(Ms2ScanWithSpecificMass scan, List<Product> theoreticalProducts, CommonParameters commonParameters, bool matchAllCharges = false) { if (matchAllCharges) { return MatchFragmentIonsOfAllCharges(scan, theoreticalProducts, commonParameters); } var matchedFragmentIons = new List<MatchedFragmentIon>(); if (scan.TheScan.MassSpectrum.XcorrProcessed && scan.TheScan.MassSpectrum.XArray.Length != 0) { // if the spectrum has no peaks if (scan.TheScan.MassSpectrum.XArray.Length == 0) { return matchedFragmentIons; } for (int i = 0; i < theoreticalProducts.Count; i++) { var product = theoreticalProducts[i]; // unknown fragment mass; this only happens rarely for sequences with unknown amino acids if (double.IsNaN(product.NeutralMass)) { continue; } double theoreticalFragmentMz = Math.Round(product.NeutralMass.ToMz(1) / 1.0005079, 0) * 1.0005079; var closestMzIndex = scan.TheScan.MassSpectrum.GetClosestPeakIndex(theoreticalFragmentMz); if (commonParameters.ProductMassTolerance.Within(scan.TheScan.MassSpectrum.XArray[closestMzIndex], theoreticalFragmentMz)) { matchedFragmentIons.Add(new MatchedFragmentIon(ref product, theoreticalFragmentMz, scan.TheScan.MassSpectrum.YArray[closestMzIndex], 1)); } } return matchedFragmentIons; } // if the spectrum has no peaks if (scan.ExperimentalFragments != null && !scan.ExperimentalFragments.Any()) { return matchedFragmentIons; } // search for ions in the spectrum //foreach (Product product in theoreticalProducts) for (int i = 0; i < theoreticalProducts.Count; i++) { var product = theoreticalProducts[i]; // unknown fragment mass; this only happens rarely for sequences with unknown amino acids if (double.IsNaN(product.NeutralMass)) { continue; } // get the closest peak in the spectrum to the theoretical peak var closestExperimentalMass = scan.GetClosestExperimentalIsotopicEnvelope(product.NeutralMass); // is the mass error acceptable? if (closestExperimentalMass != null && commonParameters.ProductMassTolerance.Within(closestExperimentalMass.MonoisotopicMass, product.NeutralMass) && closestExperimentalMass.Charge <= scan.PrecursorCharge)//TODO apply this filter before picking the envelope { matchedFragmentIons.Add(new MatchedFragmentIon(ref product, closestExperimentalMass.MonoisotopicMass.ToMz(closestExperimentalMass.Charge), closestExperimentalMass.Peaks.First().intensity, closestExperimentalMass.Charge)); } } if (commonParameters.AddCompIons) { double protonMassShift = complementaryIonConversionDictionary[commonParameters.DissociationType].ToMass(1); for (int i = 0; i < theoreticalProducts.Count; i++) { var product = theoreticalProducts[i]; // unknown fragment mass or diagnostic ion or precursor; skip those if (double.IsNaN(product.NeutralMass) || product.ProductType == ProductType.D || product.ProductType == ProductType.M) { continue; } double compIonMass = scan.PrecursorMass + protonMassShift - product.NeutralMass; // get the closest peak in the spectrum to the theoretical peak IsotopicEnvelope closestExperimentalMass = scan.GetClosestExperimentalIsotopicEnvelope(compIonMass); // is the mass error acceptable? if (commonParameters.ProductMassTolerance.Within(closestExperimentalMass.MonoisotopicMass, compIonMass) && closestExperimentalMass.Charge <= scan.PrecursorCharge) { //found the peak, but we don't want to save that m/z because it's the complementary of the observed ion that we "added". Need to create a fake ion instead. double mz = (scan.PrecursorMass + protonMassShift - closestExperimentalMass.MonoisotopicMass).ToMz(closestExperimentalMass.Charge); matchedFragmentIons.Add(new MatchedFragmentIon(ref product, mz, closestExperimentalMass.TotalIntensity, closestExperimentalMass.Charge)); } } } return matchedFragmentIons; } //Used only when user wants to generate spectral library. //Normal search only looks for one match ion for one fragment, and if it accepts it then it doesn't try to look for different charge states of that same fragment. //But for library generation, we need find all the matched peaks with all the different charges. private static List<MatchedFragmentIon> MatchFragmentIonsOfAllCharges(Ms2ScanWithSpecificMass scan, List<Product> theoreticalProducts, CommonParameters commonParameters) { var matchedFragmentIons = new List<MatchedFragmentIon>(); var ions = new List<string>(); // if the spectrum has no peaks if (scan.ExperimentalFragments != null && !scan.ExperimentalFragments.Any()) { return matchedFragmentIons; } // search for ions in the spectrum foreach (Product product in theoreticalProducts) { // unknown fragment mass; this only happens rarely for sequences with unknown amino acids if (double.IsNaN(product.NeutralMass)) { continue; } //get the range we can accept var minMass = commonParameters.ProductMassTolerance.GetMinimumValue(product.NeutralMass); var maxMass = commonParameters.ProductMassTolerance.GetMaximumValue(product.NeutralMass); var closestExperimentalMassList = scan.GetClosestExperimentalIsotopicEnvelopeList(minMass, maxMass); if (closestExperimentalMassList != null) { foreach (var x in closestExperimentalMassList) { String ion = $"{product.ProductType.ToString()}{ product.FragmentNumber}^{x.Charge}-{product.NeutralLoss}"; if (x != null && !ions.Contains(ion) && commonParameters.ProductMassTolerance.Within(x.MonoisotopicMass, product.NeutralMass) && x.Charge <= scan.PrecursorCharge)//TODO apply this filter before picking the envelope { Product temProduct = product; matchedFragmentIons.Add(new MatchedFragmentIon(ref temProduct, x.MonoisotopicMass.ToMz(x.Charge), x.Peaks.First().intensity, x.Charge)); ions.Add(ion); } } } } return matchedFragmentIons; } public MetaMorpheusEngineResults Run() { StartingSingleEngine(); var stopWatch = new Stopwatch(); stopWatch.Start(); var myResults = RunSpecific(); stopWatch.Stop(); myResults.Time = stopWatch.Elapsed; FinishedSingleEngine(myResults); return myResults; } public string GetId() { return string.Join(",", NestedIds); } protected void Warn(string v) { WarnHandler?.Invoke(this, new StringEventArgs(v, NestedIds)); } protected void Status(string v) { OutLabelStatusHandler?.Invoke(this, new StringEventArgs(v, NestedIds)); } protected void ReportProgress(ProgressEventArgs v) { OutProgressHandler?.Invoke(this, v); } protected abstract MetaMorpheusEngineResults RunSpecific(); private void StartingSingleEngine() { StartingSingleEngineHander?.Invoke(this, new SingleEngineEventArgs(this)); } private void FinishedSingleEngine(MetaMorpheusEngineResults myResults) { FinishedSingleEngineHandler?.Invoke(this, new SingleEngineFinishedEventArgs(myResults)); } } }
zrolfs/MetaMorpheus
EngineLayer/MetaMorpheusEngine.cs
C#
mit
14,371
import * as assert from "assert"; import * as fs from "fs"; import * as events from "events"; import * as zlib from "zlib"; import * as url from "url"; import * as util from "util"; import * as crypto from "crypto"; import * as tls from "tls"; import * as http from "http"; import * as https from "https"; import * as net from "net"; import * as tty from "tty"; import * as dgram from "dgram"; import * as querystring from "querystring"; import * as path from "path"; import * as readline from "readline"; import * as childProcess from "child_process"; import * as cluster from "cluster"; import * as os from "os"; import * as vm from "vm"; import * as string_decoder from "string_decoder"; import * as dns from "dns"; // Specifically test buffer module regression. import { Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer } from "buffer"; ////////////////////////////////////////////////////////// /// Global Tests : https://nodejs.org/api/global.html /// ////////////////////////////////////////////////////////// namespace global_tests { { let x: NodeModule; let y: NodeModule; x.children.push(y); x.parent = require.main; require.main = y; } } ////////////////////////////////////////////////////////// /// Assert Tests : https://nodejs.org/api/assert.html /// ////////////////////////////////////////////////////////// namespace assert_tests { { assert(1 + 1 - 2 === 0, "The universe isn't how it should."); assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP"); assert.deepStrictEqual({ a: 1 }, { a: 1 }, "uses === comparator"); assert.doesNotThrow(() => { const b = false; if (b) { throw "a hammer at your face"; } }, undefined, "What the...*crunch*"); assert.equal(3, "3", "uses == comparator"); assert.fail(1, 2, undefined, '>'); assert.ifError(0); assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses !== comparator"); assert.notEqual(1, 2, "uses != comparator"); assert.notStrictEqual(2, "2", "uses === comparator"); assert.ok(true); assert.ok(1); assert.strictEqual(1, 1, "uses === comparator"); assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT"); } } //////////////////////////////////////////////////// /// Events tests : http://nodejs.org/api/events.html //////////////////////////////////////////////////// namespace events_tests { let emitter: events.EventEmitter; let event: string; let listener: Function; let any: any; { let result: events.EventEmitter; result = emitter.addListener(event, listener); result = emitter.on(event, listener); result = emitter.once(event, listener); result = emitter.removeListener(event, listener); result = emitter.removeAllListeners(); result = emitter.removeAllListeners(event); result = emitter.setMaxListeners(42); } { let result: number; result = events.EventEmitter.defaultMaxListeners; result = events.EventEmitter.listenerCount(emitter, event); // deprecated result = emitter.getMaxListeners(); result = emitter.listenerCount(event); } { let result: Function[]; result = emitter.listeners(event); } { let result: boolean; result = emitter.emit(event); result = emitter.emit(event, any); result = emitter.emit(event, any, any); result = emitter.emit(event, any, any, any); } { class Networker extends events.EventEmitter { constructor() { super(); this.emit("mingling"); } } } } //////////////////////////////////////////////////// /// File system tests : http://nodejs.org/api/fs.html //////////////////////////////////////////////////// namespace fs_tests { { fs.writeFile("thebible.txt", "Do unto others as you would have them do unto you.", assert.ifError); fs.write(1234, "test"); fs.writeFile("Harry Potter", "\"You be wizzing, Harry,\" jived Dumbledore.", { encoding: "ascii" }, assert.ifError); fs.writeFile("testfile", "content", "utf8", assert.ifError); fs.writeFileSync("testfile", "content", "utf8"); fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } { fs.appendFile("testfile", "foobar", "utf8", assert.ifError); fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); fs.appendFileSync("testfile", "foobar", "utf8"); fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); } { var content: string; var buffer: Buffer; var stringOrBuffer: string | Buffer; var nullEncoding: string | null = null; var stringEncoding: string | null = 'utf8'; content = fs.readFileSync('testfile', 'utf8'); content = fs.readFileSync('testfile', { encoding: 'utf8' }); stringOrBuffer = fs.readFileSync('testfile', stringEncoding); stringOrBuffer = fs.readFileSync('testfile', { encoding: stringEncoding }); buffer = fs.readFileSync('testfile'); buffer = fs.readFileSync('testfile', null); buffer = fs.readFileSync('testfile', { encoding: null }); stringOrBuffer = fs.readFileSync('testfile', nullEncoding); stringOrBuffer = fs.readFileSync('testfile', { encoding: nullEncoding }); buffer = fs.readFileSync('testfile', { flag: 'r' }); fs.readFile('testfile', 'utf8', (err, data) => content = data); fs.readFile('testfile', { encoding: 'utf8' }, (err, data) => content = data); fs.readFile('testfile', stringEncoding, (err, data) => stringOrBuffer = data); fs.readFile('testfile', { encoding: stringEncoding }, (err, data) => stringOrBuffer = data); fs.readFile('testfile', (err, data) => buffer = data); fs.readFile('testfile', null, (err, data) => buffer = data); fs.readFile('testfile', { encoding: null }, (err, data) => buffer = data); fs.readFile('testfile', nullEncoding, (err, data) => stringOrBuffer = data); fs.readFile('testfile', { encoding: nullEncoding }, (err, data) => stringOrBuffer = data); fs.readFile('testfile', { flag: 'r' }, (err, data) => buffer = data); } { var errno: number; fs.readFile('testfile', (err, data) => { if (err && err.errno) { errno = err.errno; } }); } { fs.mkdtemp('/tmp/foo-', (err, folder) => { console.log(folder); // Prints: /tmp/foo-itXde2 }); } { var tempDir: string; tempDir = fs.mkdtempSync('/tmp/foo-'); } } /////////////////////////////////////////////////////// /// Buffer tests : https://nodejs.org/api/buffer.html /////////////////////////////////////////////////////// function bufferTests() { var utf8Buffer = new Buffer('test'); var base64Buffer = new Buffer('', 'base64'); var octets: Uint8Array = null; var octetBuffer = new Buffer(octets); var sharedBuffer = new Buffer(octets.buffer); var copiedBuffer = new Buffer(utf8Buffer); console.log(Buffer.isBuffer(octetBuffer)); console.log(Buffer.isEncoding('utf8')); console.log(Buffer.byteLength('xyz123')); console.log(Buffer.byteLength('xyz123', 'ascii')); var result1 = Buffer.concat([utf8Buffer, base64Buffer]); var result2 = Buffer.concat([utf8Buffer, base64Buffer], 9999999); // Class Method: Buffer.from(array) { const buf: Buffer = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); } // Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) { const arr: Uint16Array = new Uint16Array(2); arr[0] = 5000; arr[1] = 4000; let buf: Buffer; buf = Buffer.from(arr.buffer); buf = Buffer.from(arr.buffer, 1); buf = Buffer.from(arr.buffer, 0, 1); } // Class Method: Buffer.from(buffer) { const buf1: Buffer = Buffer.from('buffer'); const buf2: Buffer = Buffer.from(buf1); } // Class Method: Buffer.from(str[, encoding]) { const buf1: Buffer = Buffer.from('this is a tést'); const buf2: Buffer = Buffer.from('7468697320697320612074c3a97374', 'hex'); } // Test that TS 1.6 works with the 'as Buffer' annotation // on isBuffer. var a: Buffer | number; a = new Buffer(10); if (Buffer.isBuffer(a)) { a.writeUInt8(3, 4); } // write* methods return offsets. var b = new Buffer(16); var result: number = b.writeUInt32LE(0, 0); result = b.writeUInt16LE(0, 4); result = b.writeUInt8(0, 6); result = b.writeInt8(0, 7); result = b.writeDoubleLE(0, 8); // fill returns the input buffer. b.fill('a').fill('b'); { let buffer = new Buffer('123'); let index: number; index = buffer.indexOf("23"); index = buffer.indexOf("23", 1); index = buffer.indexOf(23); index = buffer.indexOf(buffer); } // Imported Buffer from buffer module works properly { let b = new ImportedBuffer('123'); b.writeUInt8(0, 6); let sb = new ImportedSlowBuffer(43); b.writeUInt8(0, 6); } // Buffer has Uint8Array's buffer field (an ArrayBuffer). { let buffer = new Buffer('123'); let octets = new Uint8Array(buffer.buffer); } } //////////////////////////////////////////////////// /// Url tests : http://nodejs.org/api/url.html //////////////////////////////////////////////////// namespace url_tests { { url.format(url.parse('http://www.example.com/xyz')); // https://google.com/search?q=you're%20a%20lizard%2C%20gary url.format({ protocol: 'https', host: "google.com", pathname: 'search', query: { q: "you're a lizard, gary" } }); } { var helloUrl = url.parse('http://example.com/?hello=world', true) assert.equal(helloUrl.query.hello, 'world'); } } ///////////////////////////////////////////////////// /// util tests : https://nodejs.org/api/util.html /// ///////////////////////////////////////////////////// namespace util_tests { { // Old and new util.inspect APIs util.inspect(["This is nice"], false, 5); util.inspect(["This is nice"], false, null); util.inspect(["This is nice"], { colors: true, depth: 5, customInspect: false }); util.inspect(["This is nice"], { colors: true, depth: null, customInspect: false }); // util.deprecate const foo = () => {}; // $ExpectType () => void util.deprecate(foo, 'foo() is deprecated, use bar() instead'); // $ExpectType <T extends Function>(fn: T, message: string) => T util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead'); } } //////////////////////////////////////////////////// /// Stream tests : http://nodejs.org/api/stream.html //////////////////////////////////////////////////// // http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options function stream_readable_pipe_test() { var r = fs.createReadStream('file.txt'); var z = zlib.createGzip(); var w = fs.createWriteStream('file.txt.gz'); r.pipe(z).pipe(w); r.close(); } //////////////////////////////////////////////////// /// zlib tests : http://nodejs.org/api/zlib.html /// //////////////////////////////////////////////////// namespace zlib_tests { { const gzipped = zlib.gzipSync('test'); const unzipped = zlib.gunzipSync(gzipped.toString()); } { const deflate = zlib.deflateSync('test'); const inflate = zlib.inflateSync(deflate.toString()); } } //////////////////////////////////////////////////////// /// Crypto tests : http://nodejs.org/api/crypto.html /// //////////////////////////////////////////////////////// namespace crypto_tests { { var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex'); } { let hmac: crypto.Hmac; (hmac = crypto.createHmac('md5', 'hello')).end('world', 'utf8', () => { let hash: Buffer | string = hmac.read(); }); } { //crypto_cipher_decipher_string_test let key: Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]); let clearText: string = "This is the clear text."; let cipher: crypto.Cipher = crypto.createCipher("aes-128-ecb", key); let cipherText: string = cipher.update(clearText, "utf8", "hex"); cipherText += cipher.final("hex"); let decipher: crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); let clearText2: string = decipher.update(cipherText, "hex", "utf8"); clearText2 += decipher.final("utf8"); assert.equal(clearText2, clearText); } { //crypto_cipher_decipher_buffer_test let key: Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]); let clearText: Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4]); let cipher: crypto.Cipher = crypto.createCipher("aes-128-ecb", key); let cipherBuffers: Buffer[] = []; cipherBuffers.push(cipher.update(clearText)); cipherBuffers.push(cipher.final()); let cipherText: Buffer = Buffer.concat(cipherBuffers); let decipher: crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); let decipherBuffers: Buffer[] = []; decipherBuffers.push(decipher.update(cipherText)); decipherBuffers.push(decipher.final()); let clearText2: Buffer = Buffer.concat(decipherBuffers); assert.deepEqual(clearText2, clearText); } } ////////////////////////////////////////////////// /// TLS tests : http://nodejs.org/api/tls.html /// ////////////////////////////////////////////////// namespace tls_tests { var ctx: tls.SecureContext = tls.createSecureContext({ key: "NOT REALLY A KEY", cert: "SOME CERTIFICATE", }); var blah = ctx.context; var connOpts: tls.ConnectionOptions = { host: "127.0.0.1", port: 55 }; var tlsSocket = tls.connect(connOpts); } //////////////////////////////////////////////////// /// Http tests : http://nodejs.org/api/http.html /// //////////////////////////////////////////////////// namespace http_tests { { // Status codes var codeMessage = http.STATUS_CODES['400']; var codeMessage = http.STATUS_CODES[400]; } { var agent: http.Agent = new http.Agent({ keepAlive: true, keepAliveMsecs: 10000, maxSockets: Infinity, maxFreeSockets: 256 }); var agent: http.Agent = http.globalAgent; http.request({ agent: false }); http.request({ agent: agent }); http.request({ agent: undefined }); } { http.request('http://www.example.com/xyz'); } { // Make sure .listen() and .close() retuern a Server instance http.createServer().listen(0).close().address(); net.createServer().listen(0).close().address(); } { var request = http.request({ path: 'http://0.0.0.0' }); request.once('error', function() { }); request.setNoDelay(true); request.abort(); } // http request options { const requestOpts: http.RequestOptions = { timeout: 30000 }; const clientArgs: http.ClientRequestArgs = { timeout: 30000 }; } // http headers { const headers: http.IncomingHttpHeaders = { 'content-type': 'application/json', 'set-cookie': [ 'type=ninja', 'language=javascript' ] }; } } ////////////////////////////////////////////////////// /// Https tests : http://nodejs.org/api/https.html /// ////////////////////////////////////////////////////// namespace https_tests { var agent: https.Agent = new https.Agent({ keepAlive: true, keepAliveMsecs: 10000, maxSockets: Infinity, maxFreeSockets: 256, maxCachedSessions: 100 }); var agent: https.Agent = https.globalAgent; https.request({ agent: false }); https.request({ agent: agent }); https.request({ agent: undefined }); https.request('http://www.example.com/xyz'); } //////////////////////////////////////////////////// /// TTY tests : http://nodejs.org/api/tty.html //////////////////////////////////////////////////// namespace tty_tests { let rs: tty.ReadStream; let ws: tty.WriteStream; let rsIsRaw: boolean = rs.isRaw; rs.setRawMode(true); let wsColumns: number = ws.columns; let wsRows: number = ws.rows; let isTTY: boolean = tty.isatty(1); } //////////////////////////////////////////////////// /// Dgram tests : http://nodejs.org/api/dgram.html //////////////////////////////////////////////////// namespace dgram_tests { var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => { }); var ai: dgram.AddressInfo = ds.address(); ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => { }); } //////////////////////////////////////////////////// ///Querystring tests : https://nodejs.org/api/querystring.html //////////////////////////////////////////////////// namespace querystring_tests { type SampleObject = { a: string; b: number; } { let obj: SampleObject; let sep: string; let eq: string; let options: querystring.StringifyOptions; let result: string; result = querystring.stringify<SampleObject>(obj); result = querystring.stringify<SampleObject>(obj, sep); result = querystring.stringify<SampleObject>(obj, sep, eq); result = querystring.stringify<SampleObject>(obj, sep, eq); result = querystring.stringify<SampleObject>(obj, sep, eq, options); } { let str: string; let sep: string; let eq: string; let options: querystring.ParseOptions; let result: SampleObject; result = querystring.parse<SampleObject>(str); result = querystring.parse<SampleObject>(str, sep); result = querystring.parse<SampleObject>(str, sep, eq); result = querystring.parse<SampleObject>(str, sep, eq, options); } { let str: string; let result: string; result = querystring.escape(str); result = querystring.unescape(str); } } //////////////////////////////////////////////////// /// path tests : http://nodejs.org/api/path.html //////////////////////////////////////////////////// namespace path_tests { path.normalize('/foo/bar//baz/asdf/quux/..'); path.join('/foo', 'bar', 'baz/asdf', 'quux', '..'); // returns //'/foo/bar/baz/asdf' try { path.join('foo', {}, 'bar'); } catch (error) { } path.resolve('foo/bar', '/tmp/file/', '..', 'a/../subfile'); //Is similar to: // //cd foo/bar //cd /tmp/file/ //cd .. // cd a/../subfile //pwd path.resolve('/foo/bar', './baz') // returns // '/foo/bar/baz' path.resolve('/foo/bar', '/tmp/file/') // returns // '/tmp/file' path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif') // if currently in /home/myself/node, it returns // '/home/myself/node/wwwroot/static_files/gif/image.gif' path.isAbsolute('/foo/bar') // true path.isAbsolute('/baz/..') // true path.isAbsolute('qux/') // false path.isAbsolute('.') // false path.isAbsolute('//server') // true path.isAbsolute('C:/foo/..') // true path.isAbsolute('bar\\baz') // false path.isAbsolute('.') // false path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb') // returns // '..\\..\\impl\\bbb' path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb') // returns // '../../impl/bbb' path.dirname('/foo/bar/baz/asdf/quux') // returns // '/foo/bar/baz/asdf' path.basename('/foo/bar/baz/asdf/quux.html') // returns // 'quux.html' path.basename('/foo/bar/baz/asdf/quux.html', '.html') // returns // 'quux' path.extname('index.html') // returns // '.html' path.extname('index.coffee.md') // returns // '.md' path.extname('index.') // returns // '.' path.extname('index') // returns // '' 'foo/bar/baz'.split(path.sep) // returns // ['foo', 'bar', 'baz'] 'foo\\bar\\baz'.split(path.sep) // returns // ['foo', 'bar', 'baz'] console.log(process.env.PATH) // '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' process.env.PATH.split(path.delimiter) // returns // ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin'] console.log(process.env.PATH) // 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\' process.env.PATH.split(path.delimiter) // returns // ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\'] path.parse('/home/user/dir/file.txt') // returns // { // root : "/", // dir : "/home/user/dir", // base : "file.txt", // ext : ".txt", // name : "file" // } path.parse('C:\\path\\dir\\index.html') // returns // { // root : "C:\", // dir : "C:\path\dir", // base : "index.html", // ext : ".html", // name : "index" // } path.format({ root: "/", dir: "/home/user/dir", base: "file.txt", ext: ".txt", name: "file" }); // returns // '/home/user/dir/file.txt' } //////////////////////////////////////////////////// /// readline tests : https://nodejs.org/api/readline.html //////////////////////////////////////////////////// namespace readline_tests { let rl: readline.ReadLine; { let options: readline.ReadLineOptions; let input: NodeJS.ReadableStream; let output: NodeJS.WritableStream; let completer: readline.Completer; let terminal: boolean; let result: readline.ReadLine; result = readline.createInterface(options); result = readline.createInterface(input); result = readline.createInterface(input, output); result = readline.createInterface(input, output, completer); result = readline.createInterface(input, output, completer, terminal); result = readline.createInterface({ input: input, completer: function(str: string): readline.CompleterResult { return [['test'], 'test']; } }); } { let prompt: string; rl.setPrompt(prompt); } { let preserveCursor: boolean; rl.prompt(); rl.prompt(preserveCursor); } { let query: string; let callback: (answer: string) => void; rl.question(query, callback); } { let result: readline.ReadLine; result = rl.pause(); } { let result: readline.ReadLine; result = rl.resume(); } { rl.close(); } { let data: string | Buffer; let key: readline.Key; rl.write(data); rl.write(null, key); } { let stream: NodeJS.WritableStream; let x: number; let y: number; readline.cursorTo(stream, x, y); } { let stream: NodeJS.WritableStream; let dx: number | string; let dy: number | string; readline.moveCursor(stream, dx, dy); } { let stream: NodeJS.WritableStream; let dir: number; readline.clearLine(stream, dir); } { let stream: NodeJS.WritableStream; readline.clearScreenDown(stream); } } //////////////////////////////////////////////////// /// string_decoder tests : https://nodejs.org/api/string_decoder.html //////////////////////////////////////////////////// namespace string_decoder_tests { const StringDecoder = string_decoder.StringDecoder; const buffer = new Buffer('test'); const decoder = new StringDecoder('utf8'); const part: string = decoder.write(new Buffer('test')); const end: string = decoder.end(); } ////////////////////////////////////////////////////////////////////// /// Child Process tests: https://nodejs.org/api/child_process.html /// ////////////////////////////////////////////////////////////////////// namespace child_process_tests { { childProcess.exec("echo test"); childProcess.spawnSync("echo test"); } } ////////////////////////////////////////////////////////////////////// /// cluster tests: https://nodejs.org/api/cluster.html /// ////////////////////////////////////////////////////////////////////// namespace cluster_tests  { { cluster.fork(); Object.keys(cluster.workers).forEach(key => { const worker = cluster.workers[key]; if (worker.isDead()) { console.log('worker %d is dead', worker.process.pid); } }); } } //////////////////////////////////////////////////// /// os tests : https://nodejs.org/api/os.html //////////////////////////////////////////////////// namespace os_tests { { let result: string; result = os.tmpdir(); result = os.homedir(); result = os.endianness(); result = os.hostname(); result = os.type(); result = os.platform(); result = os.arch(); result = os.release(); result = os.EOL; } { let result: number; result = os.uptime(); result = os.totalmem(); result = os.freemem(); } { let result: number[]; result = os.loadavg(); } { let result: os.CpuInfo[]; result = os.cpus(); } { let result: { [index: string]: os.NetworkInterfaceInfo[] }; result = os.networkInterfaces(); } } //////////////////////////////////////////////////// /// vm tests : https://nodejs.org/api/vm.html //////////////////////////////////////////////////// namespace vm_tests { { const sandbox = { animal: 'cat', count: 2 }; const context = vm.createContext(sandbox); console.log(vm.isContext(context)); const script = new vm.Script('count += 1; name = "kitty"'); for (let i = 0; i < 10; ++i) { script.runInContext(context); } console.log(util.inspect(sandbox)); vm.runInNewContext('count += 1; name = "kitty"', sandbox); console.log(util.inspect(sandbox)); } { const sandboxes = [{}, {}, {}]; const script = new vm.Script('globalVar = "set"'); sandboxes.forEach((sandbox) => { script.runInNewContext(sandbox); script.runInThisContext(); }); console.log(util.inspect(sandboxes)); var localVar = 'initial value'; vm.runInThisContext('localVar = "vm";'); console.log(localVar); } { const Debug = vm.runInDebugContext('Debug'); Debug.scripts().forEach(function(script: any) { console.log(script.name); }); } } /////////////////////////////////////////////////////////////////////////////// /// Errors Tests : https://nodejs.org/dist/latest-v4.x/docs/api/errors.html /// /////////////////////////////////////////////////////////////////////////////// namespace errors_tests { { Error.stackTraceLimit = Infinity; } { const myObject = {}; Error.captureStackTrace(myObject); } } /////////////////////////////////////////////////////////// /// Process Tests : https://nodejs.org/api/process.html /// /////////////////////////////////////////////////////////// import * as p from "process"; namespace process_tests { { var eventEmitter: events.EventEmitter; eventEmitter = process; // Test that process implements EventEmitter... var _p: NodeJS.Process = process; _p = p; } { var module: NodeModule | undefined; module = process.mainModule; } } /////////////////////////////////////////////////////////// /// Console Tests : https://nodejs.org/api/console.html /// /////////////////////////////////////////////////////////// import * as c from "console"; namespace console_tests { { var _c: Console = console; _c = c; } } /////////////////////////////////////////////////// /// Net Tests : https://nodejs.org/api/net.html /// /////////////////////////////////////////////////// namespace net_tests { { // Make sure .listen() and .close() retuern a Server instance net.createServer().listen(0).close().address(); } { /** * net.Socket - events.EventEmitter */ let _socket: net.Socket = new net.Socket({ fd: 1, allowHalfOpen: false, readable: false, writable: false }); } } /////////////////////////////////////////////////// /// DNS Tests : https://nodejs.org/api/dns.html /// /////////////////////////////////////////////////// namespace dns_tests { dns.lookup("nodejs.org", (err, address, family) => { const _err: NodeJS.ErrnoException = err; const _address: string = address; const _family: number = family; }); dns.lookup("nodejs.org", 4, (err, address, family) => { const _err: NodeJS.ErrnoException = err; const _address: string = address; const _family: number = family; }); dns.lookup("nodejs.org", 6, (err, address, family) => { const _err: NodeJS.ErrnoException = err; const _address: string = address; const _family: number = family; }); dns.lookup("nodejs.org", {}, (err, address, family) => { const _err: NodeJS.ErrnoException = err; const _address: string = address; const _family: number = family; }); dns.lookup( "nodejs.org", { family: 4, hints: dns.ADDRCONFIG | dns.V4MAPPED, all: false }, (err, address, family) => { const _err: NodeJS.ErrnoException = err; const _address: string = address; const _family: number = family; } ); dns.lookup("nodejs.org", {all: true}, (err, addresses) => { const _err: NodeJS.ErrnoException = err; const _address: dns.LookupAddress[] = addresses; }); function trueOrFalse(): boolean { return Math.random() > 0.5 ? true : false; } dns.lookup("nodejs.org", {all: trueOrFalse()}, (err, addresses, family) => { const _err: NodeJS.ErrnoException = err; const _addresses: string | dns.LookupAddress[] = addresses; const _family: number | undefined = family; }); dns.resolve("nodejs.org", (err, addresses) => { const _addresses: string[] = addresses; }); dns.resolve("nodejs.org", "A", (err, addresses) => { const _addresses: string[] = addresses; }); dns.resolve("nodejs.org", "AAAA", (err, addresses) => { const _addresses: string[] = addresses; }); dns.resolve("nodejs.org", "MX", (err, addresses) => { const _addresses: dns.MxRecord[] = addresses; }); dns.resolve4("nodejs.org", (err, addresses) => { const _addresses: string[] = addresses; }); dns.resolve6("nodejs.org", (err, addresses) => { const _addresses: string[] = addresses; }); }
AbraaoAlves/DefinitelyTyped
types/node/v4/node-tests.ts
TypeScript
mit
32,350
--- title: The Morning Star in Our Hearts date: 30/05/2017 --- ### The Morning Star in Our Hearts “And so we have the prophetic word confirmed, which you do well to heed as a light that shines in a dark place, until the day dawns and the morning star rises in your hearts” (2 Pet. 1:19, NKJV). `Read this text carefully. What is Peter saying that is so important to us, even today?` Here, as we can see in many places in the Bible (Gen. 1:4, John 1:5, Isa. 5:20, Eph. 5:8), a division is made between light and darkness. For Peter the Word of God shone like a light in a “dark” place (some translate the word dark as “squalid,” “dirty,” as well). That’s why he’s so clear that we need to take “heed” to that light, to follow it until “the day dawns and the morning star rises in [our] hearts.” We are fallen beings, living in a fallen and dark world. We need the supernatural power of God to lead us out of this darkness and to the light, and that light is Jesus. Peter is pointing his readers to a goal. Some believe that the expression “until the day dawns” refers to the second coming of Jesus. Though that’s certainly our ultimate hope, the idea of the “morning star” rising in your hearts sounds more immediate and more personal. The “morning star” refers to Jesus (Rev. 2:28, 22:16). His rising in their hearts seems to be about knowing Jesus, fully taking hold of Him and experiencing the reality of the living Christ in their own individual lives. Jesus shouldn’t be just a doctrinal truth; He should be the center of our existence and source of our hope and faith. So, Peter is establishing a clear link between studying the Word of God and having a saving relationship with Jesus, the “morning star.” And, of course, with the light shining in us, we will spread it to others. “The whole earth is to be illuminated with the glory of God’s truth. The light is to shine to all lands and all peoples. And it is from those who have received the light that it is to shine forth. The day-star has risen upon us, and we are to flash its light upon the pathway of those in darkness.”—Ellen G. White, Christian Experience and Teachings of Ellen G. White, p. 220. `How does your own study of the Word help you to come to know Jesus better?`
PrJared/sabbath-school-lessons
src/en/2017-02/10/04.md
Markdown
mit
2,309