text
large_stringlengths
384
2.05k
rank_avg
float64
1
4.19k
rank_max
float64
1
8.21k
rank_min
float64
1
5.03k
rank_median
float64
1
4.21k
rank_by_avgsim
float64
1
4.19k
avgsim_to_github
float32
0.77
0.85
dataset
large_stringclasses
1 value
& 0x0F ); res ~= toHexDigit(( c >> 4 ) & 0x0F ); res ~= toHexDigit(( c >> 0 ) & 0x0F ); } else { res ~= toHexDigit(( c >> 28 ) & 0x0F ); res ~= toHexDigit(( c >> 24 ) & 0x0F ); res ~= toHexDigit(( c >> 20 ) & 0x0F ); res ~= toHexDigit(( c >> 16 ) & 0x0F ); res ~= toHexDigit(( c >> 12 ) & 0x0F ); res ~= toHexDigit(( c >> 8 ) & 0x0F ); res ~= toHexDigit(( c >> 4 ) & 0x0F ); res ~= toHexDigit(( c >> 0 ) & 0x0F ); } break; } res ~= ';'; } } assert (0); } // Copyright 2008 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include "dsp_interface.h" class RealDSP : public IDSP { public: virtual void Init(); virtual void Reset(); virtual u32 CheckMailTo(); virtual void SendMailTo(u32 mail); }; <!-- Copyright World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. Please see the full Copyright clause at <http://www.w3.org/Consortium/Legal/copyright-software.html> $Id: test016.rdf,v 1.1 2002/07/26 04:26:56 jcarroll Exp $ --> <!-- Description: Like test001.rdf but with a processing instruction as the only content of the otherwise empty element. Author: Jeremy Carroll --> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:random="http://random.ioctl.org/#"> <rdf:Description rdf:about="http://random.ioctl.org/#bar"> <random:someProperty rdf:resource="http://random.ioctl.org/#foo"><?a processing instruction?></random:someProperty> </rdf:Description> </rdf:RDF> /*************************************************************
null
null
null
null
null
null
github_plus_top10pct_by_avg
************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id$ * * Copyright (C) 2006-2007 Adam Gashlin (hcs) * Copyright (C) 2004-2007 Shay Green (blargg) * Copyright (C) 2002 Brad Martin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ static inline int apply_gen_envx( struct voice_t* voice, int output ) { return (output * voice->envx) >> 11; } static inline int apply_gen_volume( struct voice_t* voice, int output, int* amp_0, int* amp_1 ) { *amp_0 = voice->volume [0] * output; *amp_1 = voice->volume [1] * output; return output; } static inline int apply_gen_amp( struct voice_t* voice, int output, int* amp_0, int* amp_1) { output = apply_gen_envx( voice, output ); output = apply_gen_volume( voice, output, amp_0, amp_1 ); return output; } #if !SPC_NOINTERP #ifndef SPC_GAUSSIAN_FAST_INTERP static inline int gaussian_fast_interp( int16_t const* samples, int32_t position, int16_t const* fwd, int16_t const* rev ) { samples += position >> 12; return (fwd [0] * samples [0] + fwd [1] * samples [1] + rev [1] * samples [2] +
null
null
null
null
null
null
github_plus_top10pct_by_avg
rev [0] * samples [3]) >> 11; } #endif /* SPC_GAUSSIAN_FAST_INTERP */ #ifndef SPC_GAUSSIAN_FAST_AMP #define gaussian_fast_amp apply_amp #endif /* SPC_GAUSSIAN_FAST_AMP */ #ifndef SPC_GAUSSIAN_SLOW_INTERP static inline int gaussian_slow_interp( int16_t const* samples, int32_t position, int16_t const* fwd, int16_t const* rev ) { int output; samples += position >> 12; output = (fwd [0] * samples [0]) & ~0xFFF; output = (output + fwd [1] * samples [1]) & ~0xFFF; output = (output + rev [1] * samples [2]) >> 12; output = (int16_t) (output * 2); output += ((rev [0] * samples [3]) >> 12) * 2; return CLAMP16( output ); } #endif /* SPC_GAUSSIAN_SLOW_INTERP */ #ifndef SPC_GAUSSIAN_SLOW_AMP static inline int gaussian_slow_amp( struct voice_t* voice, int output, int *amp_0, int *amp_1 ) { output = apply_gen_envx( voice, output ) & ~1; output = apply_gen_volume( voice, output, amp_0, amp_1 ); return output; } #endif /* SPC_GAUSSIAN_SLOW_AMP */ #define interp gaussian_slow_interp #define apply_amp gaussian_slow_amp #else /* SPC_NOINTERP */ #ifndef SPC_LINEAR_INTERP static inline int linear_interp( int16_t const* samples, int32_t position ) { int32_t fraction = position & 0xfff; int16_t const* pos = (samples + (position >> 12)) + 1; return pos[0] + ((fraction * (pos[1] - pos[0])) >> 12); } #endif /* SPC_LINEAR_INTERP */ #define interp( samp, pos, fwd, rev ) \ linear_interp( (samp), (pos) ) #ifndef SPC_LINEAR_AMP #define linear_amp apply_gen_amp #endif /* SPC_LINEAR_AMP */ #define apply_amp linear_amp #endif /* SPC_NOINTERP */ #if !SPC_NOECHO #ifndef SPC_DSP_ECHO_APPLY /* Init FIR filter */ static inline void echo_init( struct Spc_Dsp* this ) { this->fir.pos = 0; ci->memset( this->fir.buf, 0, sizeof this->fir.buf ); } /* Apply FIR filter */ static inline void echo_apply(struct Spc_
null
null
null
null
null
null
github_plus_top10pct_by_avg
Dsp* this, uint8_t* const echo_ptr, int* out_0, int* out_1) { int fb_0 = GET_LE16SA( echo_ptr ); int fb_1 = GET_LE16SA( echo_ptr + 2 ); /* Keep last 8 samples */ int (* const fir_ptr) [2] = this->fir.buf + this->fir.pos; this->fir.pos = (this->fir.pos + 1) & (FIR_BUF_HALF - 1); fir_ptr [ 0] [0] = fb_0; fir_ptr [ 0] [1] = fb_1; /* duplicate at +8 eliminates wrap checking below */ fir_ptr [FIR_BUF_HALF] [0] = fb_0; fir_ptr [FIR_BUF_HALF] [1] = fb_1; fb_0 *= this->fir.coeff [0]; fb_1 *= this->fir.coeff [0]; #define DO_PT( i ) \ fb_0 += fir_ptr [i] [0] * this->fir.coeff [i]; \ fb_1 += fir_ptr [i] [1] * this->fir.coeff [i]; DO_PT( 1 ) DO_PT( 2 ) DO_PT( 3 ) DO_PT( 4 ) DO_PT( 5 ) DO_PT( 6 ) DO_PT( 7 ) #undef DO_PT *out_0 = fb_0; *out_1 = fb_1; } #endif /* SPC_DSP_ECHO_APPLY */ #ifndef SPC_DSP_ECHO_FEEDBACK /* Feedback into echo buffer */ static inline void echo_feedback( struct Spc_Dsp* this, uint8_t *echo_ptr, int echo_0, int echo_1, int fb_0, int fb_1 ) { int e0 = (echo_0 >> 7) + ((fb_0 * this->r.g.echo_feedback) >> 14); int e1 = (echo_1 >> 7) + ((fb_1 * this->r.g.echo_feedback) >> 14); e0 = CLAMP16( e0 ); SET_LE16A( echo_ptr , e0 ); e1 = CLAMP16( e1 ); SET_LE16A( echo_ptr + 2, e1 ); } #endif /* SPC_DSP_ECHO_FEEDBACK */ #ifndef SPC_DSP_GENERATE_OUTPUT /* Generate final output */ static inline void echo_output( struct Spc_Dsp* this, int global_muting, int global_vol_0, int global_vol_1, int chans_0, int chans_1, int fb_0, int fb_1, int* out_0, int* out_1 ) { *out_0 = (chans_0 * global_vol_0 + fb_0 * this->r.g.echo_volume_0) >> global_muting; *out_1 = (chans_1 * global_vol_1 + fb_1 * this->r.g.echo_volume_1) >> global_muting; } #endif /* SPC_DSP_GENERATE_OUTPUT */ #define mix_output echo_output #else /* SPC_NOECHO */ #ifndef SPC_DSP_GENERATE_OUTPUT /* Gen
null
null
null
null
null
null
github_plus_top10pct_by_avg
erate final output */ static inline void noecho_output( struct Spc_Dsp* this, int global_muting, int global_vol_0, int global_vol_1, int chans_0, int chans_1, int* out_0, int* out_1 ) { *out_0 = (chans_0 * global_vol_0) >> global_muting; *out_1 = (chans_1 * global_vol_1) >> global_muting; (void)this; } #endif /* SPC_DSP_GENERATE_OUTPUT */ #define mix_output(this, gm, gv0, gv1, ch0, ch1, fb_0, fb_1, o0, o1) \ noecho_output( (this), (gm), (gv0), (gv1), (ch0), (ch1), (o0), (o1) ) #endif /* !SPC_NOECHO */ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Rabin-Karp method\n", "\n", "If you think hard enough, there's nothing that diferrentiates piecs of text from numbers. You can think of letters as digits and base of the numbers as sufficently big to accomodate for all the digits. For example take the following text\n", "\n", "$$\n", "babacb\n", "$$\n", "\n", "it can be though of as a number base 26 (for all the english letters):\n", "\n", "$$\n", "(1,0,1,0,2,1)_{26}\n", "$$\n", "\n", "We can transform this number to base 10 using the following equation.\n", "\n", "$$\n", "1*26^5 + 0 * 26^4 + 1*26^3 + 0*26^2 + 2*26^1 + 1*26^0 = 11899005\n", "$$\n", "\n", "From the formulation above the following property should be clear.\n", "\n", "$$\n", "abba = abb * 26 + b\n", "$$\n", "\n", "in general we can write $concat(word, letter) = base * word + letter$ (1).\n", "\n", "There's also a small technicality. When we compare numbers then $0001$ and $001$ and $1$ are equivalent. This means that we cannot map any letter to 0 if we want to be able to successfuly compare the numbers. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Observation (1) allows us to quickly compute hashes for all the prefixes of a given word. Just like in class we are going to use modular arithmetic for our computations." ] }, { "cell_typ
null
null
null
null
null
null
github_plus_top10pct_by_avg
e": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "'A' 65\n", "'a' 97\n", "'b' 98\n", "'c' 99\n", "' ' 32\n", "'c' - 'a' + 1 = 3\n" ] } ], "source": [ "# we need to map letters to numbers. Python function ord does the job\n", "print(repr('A'), ord('A'))\n", "print(repr('a'), ord('a'))\n", "print(repr('b'), ord('b'))\n", "print(repr('c'), ord('c'))\n", "print(repr(' '), ord(' '))\n", "\n", "print('%s - %s + 1 = %d' % (repr('c'), repr('a'), ord('c') - ord('a') + 1))\n" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [], "source": [ "BIG_FAT_PRIME = 2**32 - 1\n", "ENGLISH_BASE = 30 # in theory 27 is sufficient but better safe than sorry!\n", "\n", "def compute_hashes(text, base=ENGLISH_BASE, modulo = BIG_FAT_PRIME):\n", " # \n", " h = [None for _ in range(len(text) + 1)]\n", " h[0] = 0 # hash of empty word is 0\n", " for i in range(len(text)):\n", " # we only deal with english letters so we subtract 'a'\n", " # to normalize range. We add 0 to avoid creating zero digit.\n", " letter_as_number = (ord(text[i]) - ord('a') + 1)\n", " h[i + 1] = h[i] * base + letter_as_number\n", " h[i + 1] %= modulo\n", " # at the end of the iteration h[i+1] is the hash\n", " # of prefix of text of lenght (i+1) which in\n", " # Python is text[:(i+1)]\n", " return h" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "PROTIP: If you happen to ever implemented this is lower level programming language like C or C++, be ware of integer overflows." ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "data": {
null
null
null
null
null
null
github_plus_top10pct_by_avg
"text/plain": [ "[0, 2, 61, 1832, 54961, 1648833, 49464992]" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "compute_hashes(\"babacb\")" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[0, 2, 61, 1832, 54964, 1648924, 49467724]" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "compute_hashes(\"babddd\")" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[0,\n", " 2,\n", " 61,\n", " 1832,\n", " 54964,\n", " 1648924,\n", " 49467721,\n", " 1484031649,\n", " 1571276524,\n", " 4188622771,\n", " 1104631594,\n", " 3074176759,\n", " 2030989594,\n", " 800145691,\n", " 2529534259]" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# for longer strings modulo matters\n", "compute_hashes(\"babddasdasdsad\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## hashes of substrings\n", "\n", "Now here's a crutial observation. Let's take polynomial representation of string $babacb$ (where $X$ is the base)\n", "\n", "$$\n", "b*X^5 + a * X^4 + b*X^3 + a*X^2 + c*X^1 + b*X^0 \n", "$$\n", "\n", "Say we want to compute hash of $ac$ which is conveniently appears on 4-th index the string we originally hashed. Moreover we have hashes of all the prefixes - it seems like we are in good shape:\n", "\n", "\\begin{align}\n", "\\text{we have }\\ \\ \\ & hash(babac) &=\\ & b*X^4 + a * X^3 + b*X^2 &+& a*X^1 + c*X^0 \\\\\n", "\\text{we have }\\ \\ \\ & has
null
null
null
null
null
null
github_plus_top10pct_by_avg
h(bab) &=\\ & b*X^2 + a * X^1 + b*X^0&&\\\\\n", "\\text{we WANT }\\ \\ \\ & hash(ac) &=\\ & && a*X^1 + c*X^0\\\\\n", "\\end{align}\n", "\n", "\n", "From above we can clearly see that:\n", "\n", "$$\n", "hash(ac) = hash(babac) - X^2 * hash(bab)\n", "$$\n", "\n", "We can generalize this to arbitrary substring of our hashed string. Assume we hashed string $s_0, s_1, ..., s_{n-1}$ such that $h_0 = hash(\\emptyset)$, $h_1 = hash(s_0)$, $h_2 = hash(s_0, s_1)$ etc. \n", "Then we can compute $hash(s_i, ..., s_j)$ using the following formula:\n", "\n", "$$\n", "hash(s_i, ..., s_{j-1}) = h_j - h_i * X ^{j - i}\n", "$$\n", "\n", "This looks very close to $O(1)$ complexity hash computation if not for $X ^{j - i}$. But since there are at most $n$ different powers of $X$ that we are interested in, we can precompute them in $O(n)$ time." ] }, { "cell_type": "code", "execution_count": 37, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def compute_powers(n, base=ENGLISH_BASE, modulo=BIG_FAT_PRIME):\n", " powers = [None for _ in range(n + 1)]\n", " powers[0] = 1\n", " for i in range(n):\n", " powers[i+1] = (powers[i] * base) % modulo\n", " return powers" ] }, { "cell_type": "code", "execution_count": 38, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[1,\n", " 30,\n", " 900,\n", " 27000,\n", " 810000,\n", " 24300000,\n", " 729000000,\n", " 395163525,\n", " 3264971160,\n", " 3459854310,\n", " 716414220]" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "compute_powers(10)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can put all those observations together into efficient det
null
null
null
null
null
null
github_plus_top10pct_by_avg
astructure that allows us to compute hashes of substrings in $O(1)$" ] }, { "cell_type": "code", "execution_count": 77, "metadata": { "collapsed": true }, "outputs": [], "source": [ "class Hasher(object):\n", " def __init__(self, word):\n", " self.h = compute_hashes(word)\n", " self.powers = compute_powers(len(word))\n", " \n", " def substring_hash(self, i, j):\n", " result = self.h[j] - self.h[i] * self.powers[j-i]\n", " return result % BIG_FAT_PRIME" ] }, { "cell_type": "code", "execution_count": 78, "metadata": { "collapsed": false }, "outputs": [], "source": [ "TEXT = \"abcxabcx\"\n", "h = Hasher(TEXT)" ] }, { "cell_type": "code", "execution_count": 79, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[ab]cxabcx 32\n", "abcx[ab]cx 32\n", "abc[xa]bcx 721\n" ] } ], "source": [ "def highlight(word, i, j):\n", " return word[:i] + \"[\" + word[i:j] + \"]\" + word[j:]\n", "\n", "print(highlight(TEXT, 0, 2), h.substring_hash(0, 2))\n", "print(highlight(TEXT, 4, 6), h.substring_hash(4, 6))\n", "print(highlight(TEXT, 3, 5), h.substring_hash(3, 5))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Hasher complexity analysis.\n", "\n", "Preprocessing (`__init__`):\n", "- `compute_hashes` is $O(n)$\n", "- 'compute_powers` is $O(n)$\n", "Therefore precomputing is $O(n)$.\n", "\n", "Queries (`substring_hash`) is of complexity $O(1)$ - it is just a simple formula." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notice that this technique is very powerful. More powerful than we need for pattern matching. It should not be a surprise that we can easily use it to solve pattern matching" ] }, { "cell_type": "code", "execution_
null
null
null
null
null
null
github_plus_top10pct_by_avg
count": 100, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# hasher for text\n", "text_h = Hasher(\"to be or not to be\")" ] }, { "cell_type": "code", "execution_count": 101, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "65" ] }, "execution_count": 101, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# hash of the pattern\n", "compute_hashes(\"be\")[-1]" ] }, { "cell_type": "code", "execution_count": 102, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "65" ] }, "execution_count": 102, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# hash of the occurence of \"be\" in original text. \n", "text_h.substring_hash(3, 5)" ] }, { "cell_type": "code", "execution_count": 105, "metadata": { "collapsed": false }, "outputs": [], "source": [ "def compute_matches(text, pattern):\n", " # hash of patter\n", " pattern_hash = compute_hashes(pattern)[-1]\n", " # hasher for text\n", " text_h = Hasher(text)\n", " res = []\n", " for i in range(len(text) - len(pattern) + 1):\n", " # i is potential match start index\n", " # compare hash in text with hash of pattern\n", " if text_h.substring_hash(i, i + len(pattern)) == pattern_hash:\n", " # if matching append to result list.\n", " res.append(i)\n", " return res" ] }, { "cell_type": "code", "execution_count": 106, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[3, 16]" ] }, "execution_count": 106, "metadata": {}, "output_type": "execute_result" } ], "source": [ "compute_matches(\"to be or not to be\", \"be\")"
null
null
null
null
null
null
github_plus_top10pct_by_avg
] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Rabin-Karp complexity analysis\n", "\n", "Assume that pattern is of length $n$ and text of length $m$\n", "\n", "- pattern hash: $O(n)$\n", "- text preprocessing $O(m)$.\n", "- $n - m$ iterations of main loop with $O(1)$ hash computation in each loop\n", "\n", "total: $O(n+m)$\n", "\n", "Catch? Relies on luck." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.4.1" } }, "nbformat": 4, "nbformat_minor": 0 } // Copyright 2013 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package model import ( "fmt" "math" "regexp" "strconv" "strings" "time" ) const ( // MinimumTick is the minimum supported time resolution. This has to be // at least time.Second in order for the code below to work. minimumTick = time.Millisecond // second is the Time duration equivalent to one second. second = int64(time.Second / minimumTick) // The number of nanoseconds per minimum tick. nanosPerTick = int64(minimumTick / time.Nanosecond) // Earliest is the earliest Time representable. Handy for // initializing a high watermark. Earliest = Time(math.Mi
null
null
null
null
null
null
github_plus_top10pct_by_avg
nInt64) // Latest is the latest Time representable. Handy for initializing // a low watermark. Latest = Time(math.MaxInt64) ) // Time is the number of milliseconds since the epoch // (1970-01-01 00:00 UTC) excluding leap seconds. type Time int64 // Interval describes an interval between two timestamps. type Interval struct { Start, End Time } // Now returns the current time as a Time. func Now() Time { return TimeFromUnixNano(time.Now().UnixNano()) } // TimeFromUnix returns the Time equivalent to the Unix Time t // provided in seconds. func TimeFromUnix(t int64) Time { return Time(t * second) } // TimeFromUnixNano returns the Time equivalent to the Unix Time // t provided in nanoseconds. func TimeFromUnixNano(t int64) Time { return Time(t / nanosPerTick) } // Equal reports whether two Times represent the same instant. func (t Time) Equal(o Time) bool { return t == o } // Before reports whether the Time t is before o. func (t Time) Before(o Time) bool { return t < o } // After reports whether the Time t is after o. func (t Time) After(o Time) bool { return t > o } // Add returns the Time t + d. func (t Time) Add(d time.Duration) Time { return t + Time(d/minimumTick) } // Sub returns the Duration t - o. func (t Time) Sub(o Time) time.Duration { return time.Duration(t-o) * minimumTick } // Time returns the time.Time representation of t. func (t Time) Time() time.Time { return time.Unix(int64(t)/second, (int64(t)%second)*nanosPerTick) } // Unix returns t as a Unix time, the number of seconds elapsed // since January 1, 1970 UTC. func (t Time) Unix() int64 { return int64(t) / second } // UnixNano returns t as a Unix time, the number of nanoseconds elapsed // since January 1, 1970 UTC. func (t Time) UnixNano() int64 { return int64(t) * nanosPerTick } // The number of digits after the dot. var dotPrecision = int(math.Log10(float64(second))) // String returns a string representation of the Time. func (t Time) String() string { return strconv.FormatFloat(float64(t)/float64(second), 'f', -1,
null
null
null
null
null
null
github_plus_top10pct_by_avg
64) } // MarshalJSON implements the json.Marshaler interface. func (t Time) MarshalJSON() ([]byte, error) { return []byte(t.String()), nil } // UnmarshalJSON implements the json.Unmarshaler interface. func (t *Time) UnmarshalJSON(b []byte) error { p := strings.Split(string(b), ".") switch len(p) { case 1: v, err := strconv.ParseInt(string(p[0]), 10, 64) if err != nil { return err } *t = Time(v * second) case 2: v, err := strconv.ParseInt(string(p[0]), 10, 64) if err != nil { return err } v *= second prec := dotPrecision - len(p[1]) if prec < 0 { p[1] = p[1][:dotPrecision] } else if prec > 0 { p[1] = p[1] + strings.Repeat("0", prec) } va, err := strconv.ParseInt(p[1], 10, 32) if err != nil { return err } // If the value was something like -0.1 the negative is lost in the // parsing because of the leading zero, this ensures that we capture it. if len(p[0]) > 0 && p[0][0] == '-' && v+va > 0 { *t = Time(v+va) * -1 } else { *t = Time(v + va) } default: return fmt.Errorf("invalid time %q", string(b)) } return nil } // Duration wraps time.Duration. It is used to parse the custom duration format // from YAML. // This type should not propagate beyond the scope of input/output processing. type Duration time.Duration // Set implements pflag/flag.Value func (d *Duration) Set(s string) error { var err error *d, err = ParseDuration(s) return err } // Type implements pflag.Value func (d *Duration) Type() string { return "duration" } var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$") // ParseDuration parses a string into a time.Duration, assuming that a year // always has 365d, a week always has 7d, and a day always has 24h. func ParseDuration(durationStr string) (Duration, error) { matches := durationRE.FindStringSubmatch(durationStr) if len(matches) != 3 { return 0, fmt.Errorf("not a valid duration string: %q", durationStr) } var ( n, _ = strconv.Atoi(matches[1]) dur = time.Duration(n) * time.Millisecond ) switch
null
null
null
null
null
null
github_plus_top10pct_by_avg
unit := matches[2]; unit { case "y": dur *= 1000 * 60 * 60 * 24 * 365 case "w": dur *= 1000 * 60 * 60 * 24 * 7 case "d": dur *= 1000 * 60 * 60 * 24 case "h": dur *= 1000 * 60 * 60 case "m": dur *= 1000 * 60 case "s": dur *= 1000 case "ms": // Value already correct default: return 0, fmt.Errorf("invalid time unit in duration string: %q", unit) } return Duration(dur), nil } func (d Duration) String() string { var ( ms = int64(time.Duration(d) / time.Millisecond) unit = "ms" ) if ms == 0 { return "0s" } factors := map[string]int64{ "y": 1000 * 60 * 60 * 24 * 365, "w": 1000 * 60 * 60 * 24 * 7, "d": 1000 * 60 * 60 * 24, "h": 1000 * 60 * 60, "m": 1000 * 60, "s": 1000, "ms": 1, } switch int64(0) { case ms % factors["y"]: unit = "y" case ms % factors["w"]: unit = "w" case ms % factors["d"]: unit = "d" case ms % factors["h"]: unit = "h" case ms % factors["m"]: unit = "m" case ms % factors["s"]: unit = "s" } return fmt.Sprintf("%v%v", ms/factors[unit], unit) } // MarshalYAML implements the yaml.Marshaler interface. func (d Duration) MarshalYAML() (interface{}, error) { return d.String(), nil } // UnmarshalYAML implements the yaml.Unmarshaler interface. func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error { var s string if err := unmarshal(&s); err != nil { return err } dur, err := ParseDuration(s) if err != nil { return err } *d = dur return nil } /* * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unles
null
null
null
null
null
null
github_plus_top10pct_by_avg
s required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.sun.org.apache.xerces.internal.impl.xs.traversers; import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeFacetException; import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType; import com.sun.org.apache.xerces.internal.impl.dv.xs.XSSimpleTypeDecl; import com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar; import com.sun.org.apache.xerces.internal.impl.xs.SchemaSymbols; import com.sun.org.apache.xerces.internal.impl.xs.XSAnnotationImpl; import com.sun.org.apache.xerces.internal.impl.xs.util.XInt; import com.sun.org.apache.xerces.internal.impl.xs.util.XSObjectListImpl; import com.sun.org.apache.xerces.internal.util.DOMUtil; import com.sun.org.apache.xerces.internal.xni.QName; import com.sun.org.apache.xerces.internal.xs.XSConstants; import com.sun.org.apache.xerces.internal.xs.XSObject; import com.sun.org.apache.xerces.internal.xs.XSObjectList; import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition; import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; /** * The simple type definition schema component traverser. * * <simpleType * final = (#all | (list | union | restriction)) * id = ID * name = NCName * {any attributes with non-schema namespace . . .}> * Content: (annotation?, (restriction | list | union)) * </simpleType> * * <restriction * base = QName * id = ID * {any attributes with non-schema namespace . . .}> * Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)) * </restriction> * * <list * id = ID * itemType = QName * {any attributes with
null
null
null
null
null
null
github_plus_top10pct_by_avg
non-schema namespace . . .}> * Content: (annotation?, (simpleType?)) * </list> * * <union * id = ID * memberTypes = List of QName * {any attributes with non-schema namespace . . .}> * Content: (annotation?, (simpleType*)) * </union> * * @xerces.internal * * @author Elena Litani, IBM * @author Neeraj Bajaj, Sun Microsystems, Inc. * @author Sandy Gao, IBM * * @LastModified: Nov 2017 */ class XSDSimpleTypeTraverser extends XSDAbstractTraverser { // whether the type being parsed is a S4S built-in type. private boolean fIsBuiltIn = false; XSDSimpleTypeTraverser (XSDHandler handler, XSAttributeChecker gAttrCheck) { super(handler, gAttrCheck); } //return qualified name of simpleType or empty string if error occured XSSimpleType traverseGlobal(Element elmNode, XSDocumentInfo schemaDoc, SchemaGrammar grammar) { // General Attribute Checking Object[] attrValues = fAttrChecker.checkAttributes(elmNode, true, schemaDoc); String nameAtt = (String)attrValues[XSAttributeChecker.ATTIDX_NAME]; if (nameAtt == null) { attrValues[XSAttributeChecker.ATTIDX_NAME] = NO_NAME; } XSSimpleType type = traverseSimpleTypeDecl(elmNode, attrValues, schemaDoc, grammar); fAttrChecker.returnAttrArray(attrValues, schemaDoc); // if it's a global type without a name, return null if (nameAtt == null) { reportSchemaError("s4s-att-must-appear", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, SchemaSymbols.ATT_NAME}, elmNode); type = null; } // don't add global components without name to the grammar if (type != null) { if (grammar.getGlobalTypeDecl(type.getName()) == null) { grammar.addGlobalSimpleTypeDecl(type); } // also add it to extended map final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc); final XSTypeDefinition type2 = grammar.g
null
null
null
null
null
null
github_plus_top10pct_by_avg
etGlobalTypeDecl(type.getName(), loc); if (type2 == null) { grammar.addGlobalSimpleTypeDecl(type, loc); } // handle duplicates if (fSchemaHandler.fTolerateDuplicates) { if (type2 != null) { if (type2 instanceof XSSimpleType) { type = (XSSimpleType) type2; } } fSchemaHandler.addGlobalTypeDecl(type); } } return type; } XSSimpleType traverseLocal(Element elmNode, XSDocumentInfo schemaDoc, SchemaGrammar grammar) { // General Attribute Checking Object[] attrValues = fAttrChecker.checkAttributes(elmNode, false, schemaDoc); String name = genAnonTypeName(elmNode); XSSimpleType type = getSimpleType (name, elmNode, attrValues, schemaDoc, grammar); if (type instanceof XSSimpleTypeDecl) { ((XSSimpleTypeDecl)type).setAnonymous(true); } fAttrChecker.returnAttrArray(attrValues, schemaDoc); return type; } private XSSimpleType traverseSimpleTypeDecl(Element simpleTypeDecl, Object[] attrValues, XSDocumentInfo schemaDoc, SchemaGrammar grammar) { // get name and final values String name = (String)attrValues[XSAttributeChecker.ATTIDX_NAME]; return getSimpleType(name, simpleTypeDecl, attrValues, schemaDoc, grammar); } /* * Generate a name for an anonymous type */ private String genAnonTypeName(Element simpleTypeDecl) { // Generate a unique name for the anonymous type by concatenating together the // names of parent nodes // The name is quite good for debugging/error purposes, but we may want to // revisit how this is done for performance reasons (LM). StringBuffer typeName = new StringBuffer("#AnonType_"); Element node = DOMUtil.getParent(simpleTypeDecl); while (node != null &
null
null
null
null
null
null
github_plus_top10pct_by_avg
& (node != DOMUtil.getRoot(DOMUtil.getDocument(node)))) { typeName.append(node.getAttribute(SchemaSymbols.ATT_NAME)); node = DOMUtil.getParent(node); } return typeName.toString(); } /** * @param name * @param simpleTypeDecl * @param attrValues * @param schemaDoc * @param grammar * @return */ private XSSimpleType getSimpleType(String name, Element simpleTypeDecl, Object[] attrValues, XSDocumentInfo schemaDoc, SchemaGrammar grammar) { XInt finalAttr = (XInt)attrValues[XSAttributeChecker.ATTIDX_FINAL]; int finalProperty = finalAttr == null ? schemaDoc.fFinalDefault : finalAttr.intValue(); // annotation?,(list|restriction|union) Element child = DOMUtil.getFirstChildElement(simpleTypeDecl); XSAnnotationImpl [] annotations = null; if (child != null && DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) { XSAnnotationImpl annotation = traverseAnnotationDecl(child, attrValues, false, schemaDoc); if (annotation != null) annotations = new XSAnnotationImpl [] {annotation}; child = DOMUtil.getNextSiblingElement(child); } else { String text = DOMUtil.getSyntheticAnnotation(simpleTypeDecl); if (text != null) { XSAnnotationImpl annotation = traverseSyntheticAnnotation(simpleTypeDecl, text, attrValues, false, schemaDoc); annotations = new XSAnnotationImpl[] {annotation}; } } // (list|restriction|union) if (child == null) { reportSchemaError("s4s-elt-must-match.2", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, "(annotation?, (restriction | list | union))"}, simpleTypeDecl); return errorType(name, schemaDoc.fTargetNamespace, XSConstants.DERIVATION_RESTRICTION); } // derivation type: restriction/list/union String varietyProperty = DOMUtil.getLocalName(child); short refType =
null
null
null
null
null
null
github_plus_top10pct_by_avg
XSConstants.DERIVATION_RESTRICTION; boolean restriction = false, list = false, union = false; if (varietyProperty.equals(SchemaSymbols.ELT_RESTRICTION)) { refType = XSConstants.DERIVATION_RESTRICTION; restriction = true; } else if (varietyProperty.equals(SchemaSymbols.ELT_LIST)) { refType = XSConstants.DERIVATION_LIST; list = true; } else if (varietyProperty.equals(SchemaSymbols.ELT_UNION)) { refType = XSConstants.DERIVATION_UNION; union = true; } else { reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, "(annotation?, (restriction | list | union))", varietyProperty}, simpleTypeDecl); return errorType(name, schemaDoc.fTargetNamespace, XSConstants.DERIVATION_RESTRICTION); } // nothing should follow this element Element nextChild = DOMUtil.getNextSiblingElement(child); if (nextChild != null) { reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_SIMPLETYPE, "(annotation?, (restriction | list | union))", DOMUtil.getLocalName(nextChild)}, nextChild); } // General Attribute Checking: get base/item/member types Object[] contentAttrs = fAttrChecker.checkAttributes(child, false, schemaDoc); QName baseTypeName = (QName)contentAttrs[restriction ? XSAttributeChecker.ATTIDX_BASE : XSAttributeChecker.ATTIDX_ITEMTYPE]; @SuppressWarnings("unchecked") List<QName> memberTypes = (ArrayList<QName>)contentAttrs[XSAttributeChecker.ATTIDX_MEMBERTYPES]; //content = {annotation?,simpleType?...} Element content = DOMUtil.getFirstChildElement(child); //check content (annotation?, ...) if (content != null && DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_ANNOTATION)) { XSAnnotationImpl annotation = traverseAnnotationDecl(content, contentAttrs, false, sc
null
null
null
null
null
null
github_plus_top10pct_by_avg
hemaDoc); if (annotation != null ) { if(annotations == null) { annotations = new XSAnnotationImpl [] {annotation}; } else { XSAnnotationImpl [] tempArray = new XSAnnotationImpl[2]; tempArray[0] = annotations[0]; annotations = tempArray; annotations[1] = annotation; } } content = DOMUtil.getNextSiblingElement(content); } else { String text = DOMUtil.getSyntheticAnnotation(child); if (text != null) { XSAnnotationImpl annotation = traverseSyntheticAnnotation(child, text, contentAttrs, false, schemaDoc); if (annotations == null) { annotations = new XSAnnotationImpl [] {annotation}; } else { XSAnnotationImpl [] tempArray = new XSAnnotationImpl[2]; tempArray[0] = annotations[0]; annotations = tempArray; annotations[1] = annotation; } } } // get base type from "base" attribute XSSimpleType baseValidator = null; if ((restriction || list) && baseTypeName != null) { baseValidator = findDTValidator(child, name, baseTypeName, refType, schemaDoc); // if its the built-in type, return null from here if (baseValidator == null && fIsBuiltIn) { fIsBuiltIn = false; return null; } } // get types from "memberTypes" attribute List<XSObject> dTValidators = null; XSSimpleType dv = null; XSObjectList dvs; if (union && memberTypes != null && memberTypes.size() > 0) { int size = memberTypes.size(); dTValidators = new ArrayList<>(size); // for each qname in the list for (int i = 0; i < size; i++) {
null
null
null
null
null
null
github_plus_top10pct_by_avg
// get the type decl dv = findDTValidator(child, name, memberTypes.get(i), XSConstants.DERIVATION_UNION, schemaDoc); if (dv != null) { // if it's a union, expand it if (dv.getVariety() == XSSimpleType.VARIETY_UNION) { dvs = dv.getMemberTypes(); for (int j = 0; j < dvs.getLength(); j++) dTValidators.add(dvs.item(j)); } else { dTValidators.add(dv); } } } } // check if there is a child "simpleType" if (content != null && DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_SIMPLETYPE)) { if (restriction || list) { // it's an error for both "base" and "simpleType" to appear if (baseTypeName != null) { reportSchemaError(list ? "src-simple-type.3.a" : "src-simple-type.2.a", null, content); } if (baseValidator == null) { // traverse this child to get the base type baseValidator = traverseLocal(content, schemaDoc, grammar); } // get the next element content = DOMUtil.getNextSiblingElement(content); } else if (union) { if (dTValidators == null) { dTValidators = new ArrayList<>(2); } do { // traverse this child to get the member type dv = traverseLocal(content, schemaDoc, grammar); if (dv != null) { // if it's a union, expand it if (dv.getVariety() == XSSimpleType.VARIETY_UNION) { dvs = dv.getMemberTypes(); for (int j = 0; j < dvs.getLength(); j++) { dTValidators.add(dvs.i
null
null
null
null
null
null
github_plus_top10pct_by_avg
tem(j)); } } else { dTValidators.add(dv); } } // get the next element content = DOMUtil.getNextSiblingElement(content); } while (content != null && DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_SIMPLETYPE)); } } else if ((restriction || list) && baseTypeName == null) { // it's an error if neither "base/itemType" nor "simpleType" appears reportSchemaError(list ? "src-simple-type.3.b" : "src-simple-type.2.b", null, child); } else if (union && (memberTypes == null || memberTypes.size() == 0)) { // it's an error if "memberTypes" is empty and no "simpleType" appears reportSchemaError("src-union-memberTypes-or-simpleTypes", null, child); } // error finding "base" or error traversing "simpleType". // don't need to report an error, since some error has been reported. if ((restriction || list) && baseValidator == null) { fAttrChecker.returnAttrArray(contentAttrs, schemaDoc); return errorType(name, schemaDoc.fTargetNamespace, restriction ? XSConstants.DERIVATION_RESTRICTION : XSConstants.DERIVATION_LIST); } // error finding "memberTypes" or error traversing "simpleType". // don't need to report an error, since some error has been reported. if (union && (dTValidators == null || dTValidators.size() == 0)) { fAttrChecker.returnAttrArray(contentAttrs, schemaDoc); return errorType(name, schemaDoc.fTargetNamespace, XSConstants.DERIVATION_UNION); } // item type of list types can't have list content if (list && isListDatatype(baseValidator)) { reportSchemaError("cos-st-restricts.2.1", new Object[]{name, baseValidator.getName()}, child);
null
null
null
null
null
null
github_plus_top10pct_by_avg
fAttrChecker.returnAttrArray(contentAttrs, schemaDoc); return errorType(name, schemaDoc.fTargetNamespace, XSConstants.DERIVATION_LIST); } // create the simple type based on the "base" type XSSimpleType newDecl = null; if (restriction) { newDecl = fSchemaHandler.fDVFactory.createTypeRestriction(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator, annotations == null? null : new XSObjectListImpl(annotations, annotations.length)); } else if (list) { newDecl = fSchemaHandler.fDVFactory.createTypeList(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator, annotations == null? null : new XSObjectListImpl(annotations, annotations.length)); } else if (union) { XSSimpleType[] memberDecls = dTValidators.toArray(new XSSimpleType[dTValidators.size()]); newDecl = fSchemaHandler.fDVFactory.createTypeUnion(name, schemaDoc.fTargetNamespace, (short)finalProperty, memberDecls, annotations == null? null : new XSObjectListImpl(annotations, annotations.length)); } // now traverse facets, if it's derived by restriction if (restriction && content != null) { FacetInfo fi = traverseFacets(content, baseValidator, schemaDoc); content = fi.nodeAfterFacets; try { fValidationState.setNamespaceSupport(schemaDoc.fNamespaceSupport); newDecl.applyFacets(fi.facetdata, fi.fPresentFacets, fi.fFixedFacets, fValidationState); } catch (InvalidDatatypeFacetException ex) { reportSchemaError(ex.getKey(), ex.getArgs(), child); // Recreate the type, ignoring the facets newDecl = fSchemaHandler.fDVFactory.createTypeRestriction(name, schemaDoc.fTargetNamespace, (short)finalProperty, baseValidator, annotations == null? null : new XSObjectListImpl(anno
null
null
null
null
null
null
github_plus_top10pct_by_avg
tations, annotations.length)); } } // no element should appear after this point if (content != null) { if (restriction) { reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_RESTRICTION, "(annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))", DOMUtil.getLocalName(content)}, content); } else if (list) { reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_LIST, "(annotation?, (simpleType?))", DOMUtil.getLocalName(content)}, content); } else if (union) { reportSchemaError("s4s-elt-must-match.1", new Object[]{SchemaSymbols.ELT_UNION, "(annotation?, (simpleType*))", DOMUtil.getLocalName(content)}, content); } } fAttrChecker.returnAttrArray(contentAttrs, schemaDoc); // return the new type return newDecl; } //@param: elm - top element //@param: baseTypeStr - type (base/itemType/memberTypes) //@param: baseRefContext: whether the caller is using this type as a base for restriction, union or list //return XSSimpleType available for the baseTypeStr, null if not found or disallowed. // also throws an error if the base type won't allow itself to be used in this context. // REVISIT: can this code be re-used? private XSSimpleType findDTValidator(Element elm, String refName, QName baseTypeStr, short baseRefContext, XSDocumentInfo schemaDoc) { if (baseTypeStr == null) return null; XSTypeDefinition baseType = (XSTypeDefinition)fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.TYPEDECL_TYPE, baseTypeStr, elm); if (baseType == null) { return null; } if (baseType.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) { reportSchemaError("cos-
null
null
null
null
null
null
github_plus_top10pct_by_avg
st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm); return null; } // if it's a complex type, or if its restriction of anySimpleType if (baseType == SchemaGrammar.fAnySimpleType && baseRefContext == XSConstants.DERIVATION_RESTRICTION) { // if the base type is anySimpleType and the current type is // a S4S built-in type, return null. (not an error). if (checkBuiltIn(refName, schemaDoc.fTargetNamespace)) { return null; } reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm); return null; } if ((baseType.getFinal() & baseRefContext) != 0) { if (baseRefContext == XSConstants.DERIVATION_RESTRICTION) { reportSchemaError("st-props-correct.3", new Object[]{refName, baseTypeStr.rawname}, elm); } else if (baseRefContext == XSConstants.DERIVATION_LIST) { reportSchemaError("cos-st-restricts.2.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm); } else if (baseRefContext == XSConstants.DERIVATION_UNION) { reportSchemaError("cos-st-restricts.3.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm); } return null; } return (XSSimpleType)baseType; } // check whethe the type denoted by the name and namespace is a S4S // built-in type. update fIsBuiltIn at the same time. private final boolean checkBuiltIn(String name, String namespace) { if (namespace != SchemaSymbols.URI_SCHEMAFORSCHEMA) return false; if (SchemaGrammar.SG_SchemaNS.getGlobalTypeDecl(name) != null) fIsBuiltIn = true; return fIsBuiltIn; } // find if a datatype validator is a list or has list datatype member. private boolean isListDatatype(XSSimpleType validator) { if (validator.getVariety() == XSSimpleType.VARIETY_LIST)
null
null
null
null
null
null
github_plus_top10pct_by_avg
return true; if (validator.getVariety() == XSSimpleType.VARIETY_UNION) { XSObjectList temp = validator.getMemberTypes(); for (int i = 0; i < temp.getLength(); i++) { if (((XSSimpleType)temp.item(i)).getVariety() == XSSimpleType.VARIETY_LIST) { return true; } } } return false; }//isListDatatype(XSSimpleTypeDecl):boolean private XSSimpleType errorType(String name, String namespace, short refType) { XSSimpleType stringType = (XSSimpleType)SchemaGrammar.SG_SchemaNS.getTypeDefinition("string"); switch (refType) { case XSConstants.DERIVATION_RESTRICTION: return fSchemaHandler.fDVFactory.createTypeRestriction(name, namespace, (short)0, stringType, null); case XSConstants.DERIVATION_LIST: return fSchemaHandler.fDVFactory.createTypeList(name, namespace, (short)0, stringType, null); case XSConstants.DERIVATION_UNION: return fSchemaHandler.fDVFactory.createTypeUnion(name, namespace, (short)0, new XSSimpleType[]{stringType}, null); } return null; } }//class XSDSimpleTypeTraverser control ctrl() { bool hasExited; @name("ctrl.e") action e() { hasExited = true; } @name("ctrl.t") table t_0 { actions = { e(); } default_action = e(); } @hidden action act() { hasExited = false; } @hidden table tbl_act { actions = { act(); } const default_action = act(); } apply { tbl_act.apply(); if (t_0.apply().hit) { if (!hasExited) { t_0.apply(); } } else if (!hasExited) { t_0.apply(); } } } control noop(); package p(noop _n); p(ctrl()) main; try: import uctypes except ImportError: print("SKIP") raise SystemExit print(uctypes.sizeo
null
null
null
null
null
null
github_plus_top10pct_by_avg
f({'f':uctypes.FLOAT32})) print(uctypes.sizeof({'f':uctypes.FLOAT64})) <?php /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Formatter; use Monolog\Logger; class ElasticaFormatterTest extends \PHPUnit_Framework_TestCase { public function setUp() { if (!class_exists("Elastica\Document")) { $this->markTestSkipped("ruflin/elastica not installed"); } } /** * @covers Monolog\Formatter\ElasticaFormatter::__construct * @covers Monolog\Formatter\ElasticaFormatter::format * @covers Monolog\Formatter\ElasticaFormatter::getDocument */ public function testFormat() { // test log message $msg = array( 'level' => Logger::ERROR, 'level_name' => 'ERROR', 'channel' => 'meh', 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass), 'datetime' => new \DateTime("@0"), 'extra' => array(), 'message' => 'log', ); // expected values $expected = $msg; $expected['datetime'] = '1970-01-01T00:00:00+0000'; $expected['context'] = array( 'class' => '[object] (stdClass: {})', 'foo' => 7, 0 => 'bar', ); // format log message $formatter = new ElasticaFormatter('my_index', 'doc_type'); $doc = $formatter->format($msg); $this->assertInstanceOf('Elastica\Document', $doc); // Document parameters $params = $doc->getParams(); $this->assertEquals('my_index', $params['_index']); $this->assertEquals('doc_type', $params['_type']); // Document data values $data = $doc->getData(); foreach (array_keys($expected) as $key) { $this->assertEquals($expected[$key], $data[$key]); } } /**
null
null
null
null
null
null
github_plus_top10pct_by_avg
* @covers Monolog\Formatter\ElasticaFormatter::getIndex * @covers Monolog\Formatter\ElasticaFormatter::getType */ public function testGetters() { $formatter = new ElasticaFormatter('my_index', 'doc_type'); $this->assertEquals('my_index', $formatter->getIndex()); $this->assertEquals('doc_type', $formatter->getType()); } } # SOME DESCRIPTIVE TITLE. # Copyright (C) 2019-2020 The Zrythm contributors # This file is distributed under the same license as the Zrythm package. # FIRST AUTHOR <EMAIL@ADDRESS>, 2020. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Zrythm 1.0.0-alpha.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-09-24 00:47+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.8.0\n" #: ../../control-surfaces/intro.rst:6 msgid "Control Surfaces" msgstr "" #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | # / __| | | | |_) | | # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # # Copyright (C) 2004 - 2015, Guenter Knauf, <http://www.gknw.net/phpbb>. # Copyright (C) 2001 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at https://curl.haxx.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is # furnished to do so, under the terms of the COPYING file. # # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY # KIND, either express or implied.
null
null
null
null
null
null
github_plus_top10pct_by_avg
# #*************************************************************************** ################################################################# # ## Makefile for building libcurl.nlm (NetWare version - gnu make) ## ## Use: make -f Makefile.netware # ################################################################# # Edit the path below to point to the base of your Novell NDK. ifndef NDKBASE NDKBASE = c:/novell endif # Edit the path below to point to the base of your Zlib sources. ifndef ZLIB_PATH ZLIB_PATH = ../../zlib-1.2.8 endif # Edit the path below to point to the base of your OpenSSL package. ifndef OPENSSL_PATH OPENSSL_PATH = ../../openssl-1.0.2a endif # Edit the path below to point to the base of your LibSSH2 package. ifndef LIBSSH2_PATH LIBSSH2_PATH = ../../libssh2-1.5.0 endif # Edit the path below to point to the base of your axTLS package. ifndef AXTLS_PATH AXTLS_PATH = ../../axTLS-1.2.7 endif # Edit the path below to point to the base of your libidn package. ifndef LIBIDN_PATH LIBIDN_PATH = ../../libidn-1.18 endif # Edit the path below to point to the base of your librtmp package. ifndef LIBRTMP_PATH LIBRTMP_PATH = ../../librtmp-2.3 endif # Edit the path below to point to the base of your nghttp2 package. ifndef NGHTTP2_PATH NGHTTP2_PATH = ../../nghttp2-0.6.7 endif # Edit the path below to point to the base of your fbopenssl package. ifndef FBOPENSSL_PATH FBOPENSSL_PATH = ../../fbopenssl-0.4 endif # Edit the path below to point to the base of your c-ares package. ifndef LIBCARES_PATH LIBCARES_PATH = ../ares endif ifndef INSTDIR INSTDIR = ..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw endif # Edit the vars below to change NLM target settings. TARGET = libcurl VERSION = $(LIBCURL_VERSION) COPYR = Copyright (C) $(LIBCURL_COPYRIGHT_STR) DESCR = curl libcurl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - https://curl.haxx.se MTSAFE = YES STACK = 64000 SCREEN = none EXPORTF = $(TARGET).imp EXPORTS = @$(EXPORTF) # Uncomment the next line to enable linking with POSIX semantics. # POSIXFL = 1 # Edit the var
null
null
null
null
null
null
github_plus_top10pct_by_avg
below to point to your lib architecture. ifndef LIBARCH LIBARCH = LIBC endif # must be equal to NDEBUG or DEBUG, CURLDEBUG ifndef DB DB = NDEBUG endif # Optimization: -O<n> or debugging: -g ifeq ($(DB),NDEBUG) OPT = -O2 OBJDIR = release else OPT = -g OBJDIR = debug endif # The following lines defines your compiler. ifdef CWFolder METROWERKS = $(CWFolder) endif ifdef METROWERKS # MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support CC = mwccnlm else CC = gcc endif PERL = perl # Here you can find a native Win32 binary of the original awk: # http://www.gknw.net/development/prgtools/awk-20100523.zip AWK = awk CP = cp -afv MKDIR = mkdir # RM = rm -f # If you want to mark the target as MTSAFE you will need a tool for # generating the xdc data for the linker; here's a minimal tool: # http://www.gknw.net/development/prgtools/mkxdc.zip MPKXDC = mkxdc # LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH)) LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH)) # Include the version info retrieved from curlver.h -include $(OBJDIR)/version.inc # Global flags for all compilers CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc ifeq ($(CC),mwccnlm) LD = mwldnlm LDFLAGS = -nostdlib $(PRELUDE) $(OBJL) -o $@ -commandfile AR = mwldnlm ARFLAGS = -nostdlib -type library -o LIBEXT = lib #RANLIB = CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586 CFLAGS += -relax_pointers #CFLAGS += -w on ifeq ($(LIBARCH),LIBC) ifeq ($(POSIXFL),1) PRELUDE = $(NDK_LIBC)/imports/posixpre.o else PRELUDE = $(NDK_LIBC)/imports/libcpre.o endif CFLAGS += -align 4 else # PRELUDE = $(NDK_CLIB)/imports/clibpre.o # to avoid the __init_* / __deinit_* woes don't use prelude from NDK PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj" # CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h" CFLAGS += -align 1 endif else LD = nlmconv LDFLAGS = -T AR = ar ARFLAGS = -cq LIBEXT = a RANLIB = ranlib C
null
null
null
null
null
null
github_plus_top10pct_by_avg
FLAGS += -m32 CFLAGS += -fno-builtin -fno-strict-aliasing ifeq ($(findstring gcc,$(CC)),gcc) CFLAGS += -fpcc-struct-return endif CFLAGS += -Wall # -pedantic ifeq ($(LIBARCH),LIBC) ifeq ($(POSIXFL),1) PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o else PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o endif else PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o # to avoid the __init_* / __deinit_* woes don't use prelude from NDK # http://www.gknw.net/development/mk_nlm/gcc_pre.zip # PRELUDE = $(NDK_ROOT)/pre/prelude.o CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h endif endif NDK_ROOT = $(NDKBASE)/ndk ifndef NDK_CLIB NDK_CLIB = $(NDK_ROOT)/nwsdk endif ifndef NDK_LIBC NDK_LIBC = $(NDK_ROOT)/libc endif ifndef NDK_LDAP NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware endif CURL_INC = ../include CURL_LIB = ../lib INCLUDES = -I$(CURL_INC) -I$(CURL_LIB) ifeq ($(findstring -static,$(CFG)),-static) LINK_STATIC = 1 endif ifeq ($(findstring -ares,$(CFG)),-ares) WITH_ARES = 1 endif ifeq ($(findstring -rtmp,$(CFG)),-rtmp) WITH_RTMP = 1 WITH_SSL = 1 WITH_ZLIB = 1 endif ifeq ($(findstring -ssh2,$(CFG)),-ssh2) WITH_SSH2 = 1 WITH_SSL = 1 WITH_ZLIB = 1 endif ifeq ($(findstring -axtls,$(CFG)),-axtls) WITH_AXTLS = 1 WITH_SSL = else ifeq ($(findstring -ssl,$(CFG)),-ssl) WITH_SSL = 1 ifeq ($(findstring -srp,$(CFG)),-srp) ifeq "$(wildcard $(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)/openssl/srp.h)" "$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)/openssl/srp.h" WITH_SRP = 1 endif endif endif endif ifeq ($(findstring -zlib,$(CFG)),-zlib) WITH_ZLIB = 1 endif ifeq ($(findstring -idn,$(CFG)),-idn) WITH_IDN = 1 endif ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2) WITH_NGHTTP2 = 1 endif ifeq ($(findstring -ipv6,$(CFG)),-ipv6) ENABLE_IPV6 = 1 endif ifdef WITH_ARES INCLUDES += -I$(LIBCARES_PATH) LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT) endif ifdef WITH_SSH2 INCLUDES += -I$(LIBSSH2_PATH)/include ifdef LINK_STATIC LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT) else MODULES += libssh2.nlm IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp endif endif ifdef WITH_RTMP INC
null
null
null
null
null
null
github_plus_top10pct_by_avg
LUDES += -I$(LIBRTMP_PATH) LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT) endif ifdef WITH_SSL INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L) LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT) LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT) IMPORTS += GetProcessSwitchCount RunningProcess INSTDEP += ca-bundle.crt else ifdef WITH_AXTLS INCLUDES += -I$(AXTLS_PATH)/inc ifdef LINK_STATIC LDLIBS += $(AXTLS_PATH)/lib/libaxtls.$(LIBEXT) else MODULES += libaxtls.nlm IMPORTS += $(AXTLS_PATH)/lib/libaxtls.imp endif INSTDEP += ca-bundle.crt endif endif ifdef WITH_ZLIB INCLUDES += -I$(ZLIB_PATH) ifdef LINK_STATIC LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT) else MODULES += libz.nlm IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp endif endif ifdef WITH_IDN INCLUDES += -I$(LIBIDN_PATH)/include LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT) endif ifdef WITH_NGHTTP2 INCLUDES += -I$(NGHTTP2_PATH)/include LDLIBS += $(NGHTTP2_PATH)/lib/libnghttp2.$(LIBEXT) endif ifeq ($(LIBARCH),LIBC) INCLUDES += -I$(NDK_LIBC)/include # INCLUDES += -I$(NDK_LIBC)/include/nks # INCLUDES += -I$(NDK_LIBC)/include/winsock CFLAGS += -D_POSIX_SOURCE else INCLUDES += -I$(NDK_CLIB)/include/nlm # INCLUDES += -I$(NDK_CLIB)/include/nlm/obsolete # INCLUDES += -I$(NDK_CLIB)/include endif ifndef DISABLE_LDAP INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc endif CFLAGS += $(INCLUDES) ifeq ($(MTSAFE),YES) XDCOPT = -n endif ifeq ($(MTSAFE),NO) XDCOPT = -u endif ifdef XDCOPT XDCDATA = $(OBJDIR)/$(TARGET).xdc endif ifeq ($(findstring /sh,$(SHELL)),/sh) DL = ' DS = / PCT = % #-include $(NDKBASE)/nlmconv/ncpfs.inc else DS = \\ PCT = %% endif # Makefile.inc provides the CSOURCES and HHEADERS defines include Makefile.inc OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(notdir $(CSOURCES)))) $(OBJDIR)/nwos.o OBJL = $(OBJS) $(OBJDIR)/nwlib.o $(LDLIBS) vpath %.c . vauth vtls all: lib nlm nlm: prebuild $(TARGET).nlm lib: prebuild $(TARGET).$(LIBEXT) prebuild: $(OBJDIR) $(OBJDIR)/version.inc curl_config.
null
null
null
null
null
null
github_plus_top10pct_by_avg
h $(OBJDIR)/%.o: %.c # @echo Compiling $< $(CC) $(CFLAGS) -c $< -o $@ $(OBJDIR)/version.inc: $(CURL_INC)/curl/curlver.h $(OBJDIR) @echo Creating $@ @$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@ install: $(INSTDIR) all $(INSTDEP) @$(CP) $(TARGET).nlm $(INSTDIR) @$(CP) $(TARGET).$(LIBEXT) $(INSTDIR) @$(CP) ../CHANGES $(INSTDIR) @$(CP) ../COPYING $(INSTDIR) @$(CP) ../README $(INSTDIR) @$(CP) ../RELEASE-NOTES $(INSTDIR) ifdef WITH_SSL @-$(CP) ca-bundle.crt $(INSTDIR)/ca-bundle.crt endif clean: -$(RM) curl_config.h -$(RM) -r $(OBJDIR) distclean vclean: clean -$(RM) $(TARGET).$(LIBEXT) $(TARGET).nlm $(TARGET).imp -$(RM) certdata.txt ca-bundle.crt $(OBJDIR) $(INSTDIR): @$(MKDIR) $@ $(TARGET).$(LIBEXT): $(OBJS) @echo Creating $@ @-$(RM) $@ @$(AR) $(ARFLAGS) $@ $^ ifdef RANLIB @$(RANLIB) $@ endif $(TARGET).nlm: $(OBJDIR)/$(TARGET).def $(OBJL) $(EXPORTF) $(XDCDATA) @echo Linking $@ @-$(RM) $@ @$(LD) $(LDFLAGS) $< $(OBJDIR)/%.xdc: Makefile.netware @echo Creating $@ @$(MPKXDC) $(XDCOPT) $@ $(OBJDIR)/%.def: Makefile.netware @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@ @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@ @echo $(DL)# All your changes will be lost!!$(DL) >> $@ @echo $(DL)#$(DL) >> $@ @echo $(DL)copyright "$(COPYR)"$(DL) >> $@ @echo $(DL)description "$(DESCR)"$(DL) >> $@ @echo $(DL)version $(VERSION)$(DL) >> $@ ifdef NLMTYPE @echo $(DL)type $(NLMTYPE)$(DL) >> $@ endif ifdef STACK @echo $(DL)stack $(STACK)$(DL) >> $@ endif ifdef SCREEN @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@ else @echo $(DL)screenname "DEFAULT"$(DL) >> $@ endif ifneq ($(DB),NDEBUG) @echo $(DL)debug$(DL) >> $@ endif @echo $(DL)threadname "$(TARGET)"$(DL) >> $@ ifdef XDCDATA @echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@ endif @echo $(DL)flag_on 64$(DL) >> $@ ifeq ($(LIBARCH),CLIB) @echo $(DL)start _Prelude$(DL) >> $@ @echo $(DL)exit _Stop$(DL) >> $@ @echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@ @echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >
null
null
null
null
null
null
github_plus_top10pct_by_avg
> $@ @echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@ @echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@ @echo $(DL)module clib$(DL) >> $@ ifndef DISABLE_LDAP @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@ @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@ # @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@ @echo $(DL)module ldapsdk ldapssl$(DL) >> $@ endif else ifeq ($(POSIXFL),1) @echo $(DL)flag_on 4194304$(DL) >> $@ endif @echo $(DL)pseudopreemption$(DL) >> $@ ifeq ($(findstring posixpre,$(PRELUDE)),posixpre) @echo $(DL)start POSIX_Start$(DL) >> $@ @echo $(DL)exit POSIX_Stop$(DL) >> $@ @echo $(DL)check POSIX_CheckUnload$(DL) >> $@ else @echo $(DL)start _LibCPrelude$(DL) >> $@ @echo $(DL)exit _LibCPostlude$(DL) >> $@ @echo $(DL)check _LibCCheckUnload$(DL) >> $@ endif @echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@ @echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@ @echo $(DL)module libc$(DL) >> $@ ifndef DISABLE_LDAP @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@ @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@ # @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@ @echo $(DL)module lldapsdk lldapssl$(DL) >> $@ endif endif ifdef MODULES @echo $(DL)module $(MODULES)$(DL) >> $@ endif ifdef EXPORTS @echo $(DL)export $(EXPORTS)$(DL) >> $@ endif ifdef IMPORTS @echo $(DL)import $(IMPORTS)$(DL) >> $@ endif ifeq ($(findstring nlmconv,$(LD)),nlmconv) @echo $(DL)input $(PRELUDE)$(DL) >> $@ @echo $(DL)input $(OBJL)$(DL) >> $@ #ifdef LDLIBS # @echo $(DL)input $(LDLIBS)$(DL) >> $@ #endif @echo $(DL)output $(TARGET).nlm$(DL) >> $@ endif curl_config.h: Makefile.netware @echo Creating $@ @echo $(DL)/* $@ for NetWare target.$(DL) > $@ @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ @echo $(DL)** All your changes will be lost!!$(DL) >> $@ @echo $(DL)*/$(DL) >> $@ @echo $(DL)#ifndef NETWARE$(DL) >> $@ @echo $(DL)#error This $(
null
null
null
null
null
null
github_plus_top10pct_by_avg
notdir $@) is created for NetWare platform!$(DL) >> $@ @echo $(DL)#endif$(DL) >> $@ @echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@ @echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => https://curl.haxx.se/mail/"$(DL) >> $@ ifeq ($(LIBARCH),CLIB) @echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@ @echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@ @echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@ @echo $(DL)#define HAVE_STRNICMP 1$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG2 char$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG6 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@ @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@ @echo $(DL)#define SIZEOF_SIZE_T 4$(DL) >> $@ @echo $(DL)#define pressanykey PressAnyKeyToContinue$(DL) >> $@ else @echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@ @echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@ @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@ @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@ @echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@ @echo $(DL)#defin
null
null
null
null
null
null
github_plus_top10pct_by_avg
e HAVE_SYS_PARAM_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG2 void$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG6 size_t$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@ @echo $(DL)#define RECVFROM_TYPE_ARG2_IS_VOID 1$(DL) >> $@ @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@ @echo $(DL)#define SIZEOF_OFF_T 8$(DL) >> $@ @echo $(DL)#define SIZEOF_SIZE_T 8$(DL) >> $@ @echo $(DL)#define _LARGEFILE 1$(DL) >> $@ ifdef ENABLE_IPV6 @echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@ @echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@ @echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@ @echo $(DL)#define HAVE_FREEADDRINFO 1$(DL) >> $@ @echo $(DL)#define HAVE_GETADDRINFO 1$(DL) >> $@ @echo $(DL)#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1$(DL) >> $@ @echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@ @echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@ @echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@ @echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@ endif endif @echo $(DL)#define USE_MANUAL 1$(DL) >> $@ @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@ @echo $
null
null
null
null
null
null
github_plus_top10pct_by_avg
(DL)#define HAVE_ERR_H 1$(DL) >> $@ @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@ @echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@ @echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@ @echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@ @echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@ @echo $(DL)#define HAVE_IOCTL 1$(DL) >> $@ @echo $(DL)#define HAVE_IOCTL_FIONBIO 1$(DL) >> $@ @echo $(DL)#define HAVE_LL 1$(DL) >> $@ @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@ @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@ @echo $(DL)#define HAVE_RECV 1$(DL) >> $@ @echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@ @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ @echo $(DL)#define HAVE_SEND 1$(DL) >> $@ @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SETLOCALE 1$(DL) >> $@ @echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@ @echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@ @echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@ @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@ @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@ @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@ @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@ @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@ @echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@ @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@ @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@ @echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@ @echo $(DL)#define HAVE_UTIME 1$(DL) >> $@ @echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@ @echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@ @echo $(DL)#define RETSIGTYPE void$(DL) >> $@ @echo $(DL)#define SIZEOF_INT 4$(DL) >> $@ @echo $(DL)#define SIZEOF_SHORT 2$(DL) >> $@ @echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@ @echo $(DL)#define STDC_H
null
null
null
null
null
null
github_plus_top10pct_by_avg
EADERS 1$(DL) >> $@ @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ ifdef DISABLE_LDAP @echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@ else @echo $(DL)#define CURL_HAS_NOVELL_LDAPSDK 1$(DL) >> $@ ifndef DISABLE_LDAPS @echo $(DL)#define HAVE_LDAP_SSL 1$(DL) >> $@ endif @echo $(DL)#define HAVE_LDAP_SSL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LDAP_URL_PARSE 1$(DL) >> $@ endif ifdef NW_WINSOCK @echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@ else @echo $(DL)#define USE_BSD_SOCKETS 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@ @echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@ @echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@ endif ifdef WITH_ARES @echo $(DL)#define USE_ARES 1$(DL) >> $@ endif ifdef WITH_ZLIB @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@ endif ifdef WITH_SSL @echo $(DL)#define USE_SSLEAY 1$(DL) >> $@ @echo $(DL)#define USE_OPENSSL 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_X509_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_SSL_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_RSA_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_PEM_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_ERR_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_CRYPTO_H 1$(DL) >> $@ @echo $(DL)#define HAVE_OPENSSL_ENGINE_H 1$(DL) >> $@ @echo $(DL)#define HAVE_LIBSSL 1$(DL) >> $@ @echo $(DL)#define HAVE_LIBCRYPTO 1$(DL) >> $@ @echo $(DL)#define OPENSSL_NO_KRB5 1$(DL) >> $@ ifdef WITH_SRP @echo $(DL)#define HAVE_SSLEAY_SRP 1$(DL) >> $@ @echo $(DL)#define USE_TLS_SRP 1$(DL) >> $@ endif ifdef WITH_SPNEGO @echo $(DL)#define HAVE_SPNEGO 1$(DL) >> $@ endif else ifdef WITH_AXTLS @echo $(DL)#define USE_AXTLS 1$(DL) >> $@ endif endif ifdef WITH_SSH2 @echo $(DL)#define USE_LIBSSH2 1$(DL) >> $@ @echo $(DL)#define HAVE_LIBSSH2_H 1$(DL) >> $@ endif ifdef WITH_IDN @echo $(DL)#define HAVE_LIBIDN 1$(DL) >> $@ @echo $(DL)#define HAVE_TLD_H 1$(DL) >> $@ endif ifdef WITH_RTMP @echo $(DL)#define USE_LIBRTMP 1$(DL) >> $@
null
null
null
null
null
null
github_plus_top10pct_by_avg
endif ifdef WITH_NGHTTP2 @echo $(DL)#define USE_NGHTTP2 1$(DL) >> $@ endif @echo $(DL)#ifdef __GNUC__$(DL) >> $@ @echo $(DL)#define HAVE_VARIADIC_MACROS_GCC 1$(DL) >> $@ @echo $(DL)#else$(DL) >> $@ @echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@ @echo $(DL)#endif$(DL) >> $@ ifdef CABUNDLE @echo $(DL)#define CURL_CA_BUNDLE "$(CABUNDLE)"$(DL) >> $@ else @echo $(DL)#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")$(DL) >> $@ endif $(EXPORTF): $(CURL_INC)/curl/curl.h $(CURL_INC)/curl/easy.h $(CURL_INC)/curl/multi.h $(CURL_INC)/curl/mprintf.h @echo Creating $@ @$(AWK) -f ../packages/NetWare/get_exp.awk $^ > $@ FORCE: ; info: $(OBJDIR)/version.inc @echo Configured to build $(TARGET) with these options: @echo libarchitecture: $(LIBARCH) @echo curl version: $(LIBCURL_VERSION_STR) @echo compiler/linker: $(CC) / $(LD) ifdef CABUNDLE @echo ca-bundle path: $(CABUNDLE) endif ifdef WITH_SSL @echo SSL support: enabled (OpenSSL) else @echo SSL support: no endif ifdef WITH_SRP @echo SRP support: enabled else @echo SRP support: no endif ifdef WITH_SSH2 @echo SSH2 support: enabled (libssh2) else @echo SSH2 support: no endif ifdef WITH_ZLIB @echo zlib support: enabled else @echo zlib support: no endif ifdef WITH_NGHTTP2 @echo http2 support: enabled else @echo http2 support: no endif ifdef WITH_ARES @echo c-ares support: enabled else @echo c-ares support: no endif ifdef ENABLE_IPV6 @echo IPv6 support: enabled else @echo IPv6 support: no endif $(LIBCARES_PATH)/libcares.$(LIBEXT): $(MAKE) -C $(LIBCARES_PATH) -f Makefile.netware lib ca-bundle.crt: mk-ca-bundle.pl @echo Creating $@ @-$(PERL) $< -b -n $@ (function() { var dfs = {"am_pm":["နံနက်","ညနေ"],"day_name":["တနင်္ဂနွေ","တနင်္လာ","အင်္ဂါ","ဗုဒ္ဓဟူး","ကြာသပတေး","သောကြာ","စနေ"],"day_short":["နွေ","လာ","ဂါ","ဟူး","တေး","ကြာ","နေ"],"era":["ဘီစ�
null
null
null
null
null
null
github_plus_top10pct_by_avg
�","အေဒီ"],"era_name":["ခရစ်တော် မပေါ်မီကာလ","ခရစ်တော် ပေါ်ထွန်းပြီးကာလ"],"month_name":["ဇန်နဝါရီ","ဖေဖော်ဝါရီ","မတ်","ဧပြီ","မေ","ဇွန်","ဇူလိုင်","ဩဂုတ်","စက်တင်ဘာ","အောက်တိုဘာ","နိုဝင်ဘာ","ဒီဇင်ဘာ"],"month_short":["ဇန်","ဖေ","မတ်","ဧ","မေ","ဇွန်","ဇူ","ဩ","စက်","အောက်","နို","ဒီ"],"order_full":"MDY","order_long":"MDY","order_medium":"MDY","order_short":"MDY"}; var nfs = {"decimal_separator":".","grouping_separator":",","minus":"-"}; var df = {SHORT_PADDED_CENTURY:function(d){if(d){return(((d.getMonth()+101)+'').substring(1)+'/'+((d.getDate()+101)+'').substring(1)+'/'+d.getFullYear());}},SHORT:function(d){if(d){return((d.getMonth()+1)+'/'+d.getDate()+'/'+(d.getFullYear()+'').substring(2));}},SHORT_NOYEAR:function(d){if(d){return((d.getMonth()+1)+'/'+d.getDate());}},SHORT_NODAY:function(d){if(d){return((d.getMonth()+1)+' '+(d.getFullYear()+'').substring(2));}},MEDIUM:function(d){if(d){return(dfs.month_short[d.getMonth()]+' '+d.getDate()+','+' '+d.getFullYear());}},MEDIUM_NOYEAR:function(d){if(d){return(dfs.month_short[d.getMonth()]+' '+d.getDate());}},MEDIUM_WEEKDAY_NOYEAR:function(d){if(d){return(dfs.day_short[d.getDay()]+' '+dfs.month_short[d.getMonth()]+' '+d.getDate());}},LONG_NODAY:function(d){if(d){return(dfs.month_name[d.getMonth()]+' '+d.getFullYear());}},LONG:function(d){if(d){return(dfs.month_name[d.getMonth()]+' '+d.getDate()+','+' '+d.getFullYear());}},FULL:function(d){if(d){return(dfs.day_name[d.getDay()]+','+' '+dfs.month_name[d.getMonth()]+' '+d.getDate()+','+' '+d.getFullYear());}}}; window.icu = window.icu || new Object(); var icu = window.icu; icu.getCountry = function() { return "MM" }; icu.getCountryName = function() { return "မြန်မာ" }; icu.getDateFormat = function(fo
null
null
null
null
null
null
github_plus_top10pct_by_avg
rmatCode) { var retVal = {}; retVal.format = df[formatCode]; return retVal; }; icu.getDateFormats = function() { return df; }; icu.getDateFormatSymbols = function() { return dfs; }; icu.getDecimalFormat = function(places) { var retVal = {}; retVal.format = function(n) { var ns = n < 0 ? Math.abs(n).toFixed(places) : n.toFixed(places); var ns2 = ns.split('.'); s = ns2[0]; var d = ns2[1]; var rgx = /(\d+)(\d{3})/;while(rgx.test(s)){s = s.replace(rgx, '$1' + nfs["grouping_separator"] + '$2');} return (n < 0 ? nfs["minus"] : "") + s + nfs["decimal_separator"] + d;}; return retVal; }; icu.getDecimalFormatSymbols = function() { return nfs; }; icu.getIntegerFormat = function() { var retVal = {}; retVal.format = function(i) { var s = i < 0 ? Math.abs(i).toString() : i.toString(); var rgx = /(\d+)(\d{3})/;while(rgx.test(s)){s = s.replace(rgx, '$1' + nfs["grouping_separator"] + '$2');} return i < 0 ? nfs["minus"] + s : s;}; return retVal; }; icu.getLanguage = function() { return "my" }; icu.getLanguageName = function() { return "ဗမာ" }; icu.getLocale = function() { return "my-MM" }; icu.getLocaleName = function() { return "ဗမာ (မြန်မာ)" }; })(); ^F:\DATA STRUCTURE\SEQQUEUE\DEBUG\MAIN.OBJ C:\WINDOWS\GLOBALIZATION\SORTING\SORTDEFAULT.NLS C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\KERNEL32.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\USER32.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\GDI32.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\WINSPOOL.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\COMDLG32.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\ADVAPI32.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\SHELL32.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\OLE32.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\OLEAUT32.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\UUID.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\ODBC32.LIB C:\PROGRAM FILES\WINDOWS KITS\8.0\LIB\WIN8\UM\X86\ODBCCP32.LIB F:\DATA STRU
null
null
null
null
null
null
github_plus_top10pct_by_avg
CTURE\SEQQUEUE\DEBUG\MAIN.OBJ C:\WINDOWS\SYSTEM32\TZRES.DLL D:\CPP\VC\LIB\MSVCPRTD.LIB D:\CPP\VC\LIB\MSVCRTD.LIB D:\CPP\VC\LIB\OLDNAMES.LIB /**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */ /**************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** ThreadX Component */ /** */ /** Module Manager */ /** */ /**************************************************************************/ /**************************************************************************/ #define TX_SOURCE_CODE #include "tx_api.h" #include "txm_module.h" #include "txm_module_manager_util.h" /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _
null
null
null
null
null
null
github_plus_top10pct_by_avg
txm_module_manager_region_size_get Cortex-M7/MPU/IAR */ /* 6.0.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function converts the region size in bytes to the block size */ /* for the Cortex-M7 MPU specification. */ /* */ /* INPUT */ /* */ /* block_size Size of the block in bytes */ /* */ /* OUTPUT */ /* */ /* MPU size specification */ /* */ /* CALLS */ /* */ /* None */ /* */ /* CALLED BY */ /* */ /* _txm_module_manager_mm_register_setup */ /*
null
null
null
null
null
null
github_plus_top10pct_by_avg
*/ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 06-30-2020 Scott Larson Initial Version 6.0.1 */ /* */ /**************************************************************************/ ULONG _txm_module_manager_region_size_get(ULONG block_size) { ULONG return_value; /* Process relative to the input block size. */ if (block_size == 32) { return_value = 0x04; } else if (block_size == 64) { return_value = 0x05; } else if (block_size == 128) { return_value = 0x06; } else if (block_size == 256) { return_value = 0x07; } else if (block_size == 512) { return_value = 0x08; } else if (block_size == 1024) { return_value = 0x09; } else if (block_size == 2048) { return_value = 0x0A; } else if (block_size == 4096) { return_value = 0x0B; } else if (block_size == 8192) { return_value = 0x0C; } else if (block_size == 16384) { return_value = 0x0D; } else if (block_size == 32768) { return_value = 0x0E; } else if (block_size == 65536) { return_value = 0x0F; } else if (block_size == 131072) { return_value = 0x10; } else if (block_size == 262144) { return_value = 0x11; } else if (block_size == 524288) { return_value = 0x12; } else if (block_size == 1048576) { return_value = 0x13; } else if (block_size == 2097152) { return_value = 0x14; } else { /* Max 4MB MPU pag
null
null
null
null
null
null
github_plus_top10pct_by_avg
es for modules. */ return_value = 0x15; } return(return_value); } /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _txm_module_manager_calculate_srd_bits Cortex-M7/MPU/IAR */ /* 6.0.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function calculates the SRD bits that need to be set to */ /* protect "length" bytes in a block. */ /* */ /* INPUT */ /* */ /* block_size Size of the block in bytes */ /* length Actual length in bytes */ /* */ /* OUTPUT */ /* */ /* SRD bits to be OR'ed with region attribute register. */ /* */ /* CALLS */ /*
null
null
null
null
null
null
github_plus_top10pct_by_avg
*/ /* None */ /* */ /* CALLED BY */ /* */ /* _txm_module_manager_mm_register_setup */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 06-30-2020 Scott Larson Initial Version 6.0.1 */ /* */ /**************************************************************************/ ULONG _txm_module_manager_calculate_srd_bits(ULONG block_size, ULONG length) { ULONG srd_bits = 0; UINT srd_bit_index; /* length is smaller than block_size, set SRD bits if block_size is 256 or more. */ if((block_size >= 256) && (length < block_size)) { /* Divide block_size by 8 by shifting right 3. Result is size of subregion. */ block_size = block_size >> 3; /* Set SRD index into attribute register. */ srd_bit_index = 8; /* If subregion overlaps length, move to the next subregion. */ while(length > block_size) { length = length - block_size; srd_bit_index++; } /* Check for a portion of code remaining. */ if(length) { srd_bit_index++; } /* Set unused subregion bits. */ while(srd_bit_index < 16) { srd_bits = srd_bits | (0x1 << srd_bit_index);
null
null
null
null
null
null
github_plus_top10pct_by_avg
srd_bit_index++; } } return(srd_bits); } /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _txm_module_manager_mm_register_setup Cortex-M7/MPU/IAR */ /* 6.0.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function sets up the MPU register definitions based on the */ /* module's memory characteristics. */ /* MPU layout for the Cortex-M7: */ /* Entry Description */ /* 0 Kernel mode entry */ /* 1 Module code region */ /* 2 Module code region */ /* 3 Module code region */ /* 4 Module code region */ /* 5 Module data region */ /* 6 Module data region */ /* 7 Module data region */ /* 8 Module data region */ /* 9 Module shared me
null
null
null
null
null
null
github_plus_top10pct_by_avg
mory region */ /* 10 Module shared memory region */ /* 11 Module shared memory region */ /* 12 Unused region */ /* 13 Unused region */ /* 14 Unused region */ /* 15 Unused region */ /* */ /* */ /* INPUT */ /* */ /* module_instance Pointer to module instance */ /* */ /* OUTPUT */ /* */ /* MPU specifications for module in module_instance */ /* */ /* CALLS */ /* */ /* _txm_module_manager_region_size_get */ /* */ /* CALLED BY */ /* */ /* _txm_module_manager_thread_create */ /* */ /* RELEASE HISTORY */ /*
null
null
null
null
null
null
github_plus_top10pct_by_avg
*/ /* DATE NAME DESCRIPTION */ /* */ /* 06-30-2020 Scott Larson Initial Version 6.0.1 */ /* */ /**************************************************************************/ VOID _txm_module_manager_mm_register_setup(TXM_MODULE_INSTANCE *module_instance) { ULONG code_address; ULONG code_size; ULONG data_address; ULONG data_size; ULONG start_stop_stack_size; ULONG callback_stack_size; ULONG block_size; ULONG region_size; ULONG srd_bits = 0; UINT mpu_table_index; UINT i; /* Setup the first MPU region for kernel mode entry. */ /* Set address register to user mode entry function address, which is guaranteed to be at least 32-byte aligned. Mask address to proper range, region 0, set Valid bit. */ module_instance -> txm_module_instance_mpu_registers[TXM_MODULE_MPU_KERNEL_ENTRY_INDEX].txm_module_mpu_region_address = ((ULONG) _txm_module_manager_user_mode_entry & 0xFFFFFFE0) | 0x10; /* Set the attributes, size (32 bytes) and enable bit. */ module_instance -> txm_module_instance_mpu_registers[TXM_MODULE_MPU_KERNEL_ENTRY_INDEX].txm_module_mpu_region_attribute_size = TXM_MODULE_MPU_CODE_ACCESS_CONTROL | (_txm_module_manager_region_size_get(32) << 1) | TXM_ENABLE_REGION; /* End of kernel mode entry setup. */ /* Setup code protection. */ /* Initialize the MPU table index. */ mpu_table_index = 1; /* Pickup code starting address and actual size. */ code_address = (ULONG) module_instance -> txm_module_instance_code_start; code_size = module_instance -> txm_module_instance_preamble_ptr -> txm_module_preamble_code_size; /* Determine code block sizes. Minimize the alignment requirement. There are 4 MPU code entries available. The following is how the code size will be dist
null
null
null
null
null
null
github_plus_top10pct_by_avg
ributed: 1. 1/4 of the largest power of two that is greater than or equal to code size. 2. 1/4 of the largest power of two that is greater than or equal to code size. 3. Largest power of 2 that fits in the remaining space. 4. Smallest power of 2 that exceeds the remaining space, minimum 32. */ /* Now loop through to setup MPU protection for the code area. */ for (i = 0; i < TXM_MODULE_MPU_CODE_ENTRIES; i++) { /* First two MPU blocks are 1/4 of the largest power of two that is greater than or equal to code size. */ if (i < 2) { block_size = _txm_power_of_two_block_size(code_size) >> 2; } /* Third MPU block is the largest power of 2 that fits in the remaining space. */ else if (i == 2) { /* Subtract (block_size*2) from code_size to calculate remaining space. */ code_size = code_size - (block_size << 1); block_size = _txm_power_of_two_block_size(code_size) >> 1; } /* Last MPU block is the smallest power of 2 that exceeds the remaining space, minimum 32. */ else { /* Calculate remaining space. */ code_size = code_size - block_size; block_size = _txm_power_of_two_block_size(code_size); srd_bits = _txm_module_manager_calculate_srd_bits(block_size, code_size); } /* Calculate the region size information. */ region_size = (_txm_module_manager_region_size_get(block_size) << 1); /* Build the base address register with address, MPU region, set Valid bit. */ module_instance -> txm_module_instance_mpu_registers[mpu_table_index].txm_module_mpu_region_address = (code_address & ~(block_size - 1)) | mpu_table_index | 0x10; /* Build the attribute-size register with permissions, SRD, size, enable. */ module_instance -> txm_module_instance_mpu_registers[mpu_table_index].txm_module_mpu_region_attribu
null
null
null
null
null
null
github_plus_top10pct_by_avg
te_size = TXM_MODULE_MPU_CODE_ACCESS_CONTROL | srd_bits | region_size | TXM_ENABLE_REGION; /* Adjust the code address. */ code_address = code_address + block_size; /* Increment MPU table index. */ mpu_table_index++; } /* End of code protection. */ /* Setup data protection. */ /* Reset SRD bitfield. */ srd_bits = 0; /* Pickup data starting address and actual size. */ data_address = (ULONG) module_instance -> txm_module_instance_data_start; /* Adjust the size of the module elements to be aligned to the default alignment. We do this so that when we partition the allocated memory, we can simply place these regions right beside each other without having to align their pointers. Note this only works when they all have the same alignment. */ data_size = module_instance -> txm_module_instance_preamble_ptr -> txm_module_preamble_data_size; start_stop_stack_size = module_instance -> txm_module_instance_preamble_ptr -> txm_module_preamble_start_stop_stack_size; callback_stack_size = module_instance -> txm_module_instance_preamble_ptr -> txm_module_preamble_callback_stack_size; data_size = ((data_size + TXM_MODULE_DATA_ALIGNMENT - 1)/TXM_MODULE_DATA_ALIGNMENT) * TXM_MODULE_DATA_ALIGNMENT; start_stop_stack_size = ((start_stop_stack_size + TXM_MODULE_DATA_ALIGNMENT - 1)/TXM_MODULE_DATA_ALIGNMENT) * TXM_MODULE_DATA_ALIGNMENT; callback_stack_size = ((callback_stack_size + TXM_MODULE_DATA_ALIGNMENT - 1)/TXM_MODULE_DATA_ALIGNMENT) * TXM_MODULE_DATA_ALIGNMENT; /* Update the data size to include thread stacks. */ data_size = data_size + start_stop_stack_size + callback_stack_size; /* Determine data block sizes. Minimize the alignment requirement. There are 4 MPU data entries available. The following is how the data size will be distributed: 1. 1/4 of the largest power of two that is greater than or equal t
null
null
null
null
null
null
github_plus_top10pct_by_avg
o data size. 2. 1/4 of the largest power of two that is greater than or equal to data size. 3. Largest power of 2 that fits in the remaining space. 4. Smallest power of 2 that exceeds the remaining space, minimum 32. */ /* Now loop through to setup MPU protection for the data area. */ for (i = 0; i < TXM_MODULE_MPU_DATA_ENTRIES; i++) { /* First two MPU blocks are 1/4 of the largest power of two that is greater than or equal to data size. */ if (i < 2) { block_size = _txm_power_of_two_block_size(data_size) >> 2; } /* Third MPU block is the largest power of 2 that fits in the remaining space. */ else if (i == 2) { /* Subtract (block_size*2) from data_size to calculate remaining space. */ data_size = data_size - (block_size << 1); block_size = _txm_power_of_two_block_size(data_size) >> 1; } /* Last MPU block is the smallest power of 2 that exceeds the remaining space, minimum 32. */ else { /* Calculate remaining space. */ data_size = data_size - block_size; block_size = _txm_power_of_two_block_size(data_size); srd_bits = _txm_module_manager_calculate_srd_bits(block_size, data_size); } /* Calculate the region size information. */ region_size = (_txm_module_manager_region_size_get(block_size) << 1); /* Build the base address register with address, MPU region, set Valid bit. */ module_instance -> txm_module_instance_mpu_registers[mpu_table_index].txm_module_mpu_region_address = (data_address & ~(block_size - 1)) | mpu_table_index | 0x10; /* Build the attribute-size register with permissions, SRD, size, enable. */ module_instance -> txm_module_instance_mpu_registers[mpu_table_index].txm_module_mpu_region_attribute_size = TXM_MODULE_MPU_DATA_ACCESS_CONTROL | srd_bits | region_size | TXM_ENABL
null
null
null
null
null
null
github_plus_top10pct_by_avg
E_REGION; /* Adjust the data address. */ data_address = data_address + block_size; /* Increment MPU table index. */ mpu_table_index++; } /* Setup MPU for the remaining regions. */ while (mpu_table_index < TXM_MODULE_MPU_TOTAL_ENTRIES) { /* Build the base address register with address, MPU region, set Valid bit. */ module_instance -> txm_module_instance_mpu_registers[mpu_table_index].txm_module_mpu_region_address = mpu_table_index | 0x10; /* Increment MPU table index. */ mpu_table_index++; } } /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _txm_module_manager_shared_memory_check_outside */ /* Cortex-M7/MPU/IAR */ /* 6.0.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function checks if the specified object is outside shared */ /* memory. */ /* */ /* INPUT */ /* */ /* module_instance
null
null
null
null
null
null
github_plus_top10pct_by_avg
Pointer to module instance */ /* obj_ptr Pointer to the object */ /* obj_size Size of the object */ /* */ /* OUTPUT */ /* */ /* Whether the object is outside the shared memory region. */ /* */ /* CALLS */ /* */ /* N/A */ /* */ /* CALLED BY */ /* */ /* Module dispatch check functions */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 06-30-2020 Scott Larson Initial Version 6.0.1 */ /* */ /**************************************************************************/ UCHAR _txm_module_manager_shared_memory_check_outside(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE obj_ptr, UINT obj_size) { UINT shared_memory_index; UINT num_shared_memory_mpu_entries; ALIGN_TYPE shared_memory_address_start; ALIGN_TYPE shared_memory_address_end; num_shared_memo
null
null
null
null
null
null
github_plus_top10pct_by_avg
ry_mpu_entries = module_instance -> txm_module_instance_shared_memory_count; for (shared_memory_index = 0; shared_memory_index < num_shared_memory_mpu_entries; shared_memory_index++) { shared_memory_address_start = (ALIGN_TYPE) module_instance -> txm_module_instance_shared_memory_address[shared_memory_index]; shared_memory_address_end = shared_memory_address_start + module_instance -> txm_module_instance_shared_memory_length[shared_memory_index]; if (TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_EXCLUSIVE(shared_memory_address_start, shared_memory_address_end, obj_ptr, obj_size)) { return(TX_FALSE); } } return(TX_TRUE); } /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _txm_module_manager_shared_memory_check_inside Cortex-M7/MPU/IAR */ /* 6.0.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function checks if the specified object is inside shared */ /* memory. */ /* */ /* INPUT */ /*
null
null
null
null
null
null
github_plus_top10pct_by_avg
*/ /* module_instance Pointer to module instance */ /* obj_ptr Pointer to the object */ /* obj_size Size of the object */ /* */ /* OUTPUT */ /* */ /* Whether the object is inside the shared memory region. */ /* */ /* CALLS */ /* */ /* N/A */ /* */ /* CALLED BY */ /* */ /* Module dispatch check functions */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 06-30-2020 Scott Larson Initial Version 6.0.1 */ /* */ /**************************************************************************/ UCHAR _txm_module_manager_shared_memory_check_inside(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE obj_ptr, UINT obj_size) { UINT shared_memory_index; UINT num_shared_memory_mpu_entries; ALIGN_TYPE shared_memory_address_start; A
null
null
null
null
null
null
github_plus_top10pct_by_avg
LIGN_TYPE shared_memory_address_end; num_shared_memory_mpu_entries = module_instance -> txm_module_instance_shared_memory_count; for (shared_memory_index = 0; shared_memory_index < num_shared_memory_mpu_entries; shared_memory_index++) { shared_memory_address_start = (ALIGN_TYPE) module_instance -> txm_module_instance_shared_memory_address[shared_memory_index]; shared_memory_address_end = shared_memory_address_start + module_instance -> txm_module_instance_shared_memory_length[shared_memory_index]; if (TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_EXCLUSIVE(shared_memory_address_start, shared_memory_address_end, obj_ptr, obj_size)) { return(TX_TRUE); } } return(TX_FALSE); } /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _txm_module_manager_shared_memory_check_inside_byte */ /* Cortex-M7/MPU/IAR */ /* 6.0.1 */ /* AUTHOR */ /* */ /* Scott Larson, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function checks if the specified byte is inside shared memory. */ /* */ /* INPUT
null
null
null
null
null
null
github_plus_top10pct_by_avg
*/ /* */ /* module_instance Pointer to module instance */ /* byte_ptr Pointer to the byte */ /* */ /* OUTPUT */ /* */ /* Whether the byte is inside the shared memory region. */ /* */ /* CALLS */ /* */ /* N/A */ /* */ /* CALLED BY */ /* */ /* Module dispatch check functions */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 06-30-2020 Scott Larson Initial Version 6.0.1 */ /* */ /**************************************************************************/ UCHAR _txm_module_manager_shared_memory_check_inside_byte(TXM_MODULE_INSTANCE *module_instance, ALIGN_TYPE byte_ptr) { UINT shared_memory_index; UINT num_shared_memory_mpu_entries; ALIGN_TYPE shared_memory_address_start; ALIGN_TYPE shared_memory_addres
null
null
null
null
null
null
github_plus_top10pct_by_avg
s_end; num_shared_memory_mpu_entries = module_instance -> txm_module_instance_shared_memory_count; for (shared_memory_index = 0; shared_memory_index < num_shared_memory_mpu_entries; shared_memory_index++) { shared_memory_address_start = (ALIGN_TYPE) module_instance -> txm_module_instance_shared_memory_address[shared_memory_index]; shared_memory_address_end = shared_memory_address_start + module_instance -> txm_module_instance_shared_memory_length[shared_memory_index]; if (TXM_MODULE_MANAGER_CHECK_INSIDE_RANGE_EXCLUSIVE_BYTE(shared_memory_address_start, shared_memory_address_end, byte_ptr)) { return(TX_TRUE); } } return(TX_FALSE); } # Project-wide Gradle settings. # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true // Unless explicitly stated otherwise all files in this repository are licensed // under the Apache License Version 2.0. // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-2020 Datadog, Inc. package errors import ( "fmt" "testing" "github.com/stretchr/testify/require" ) func TestNotFound(t *testing.T) { // New err := NewNotFound("foo") require.Error(t, err) require.Equal(t, `"foo" not found`, err.Error()) // Is require.True(t, IsNotFound(err)) require.False(t, I
null
null
null
null
null
null
github_plus_top10pct_by_avg
sNotFound(fmt.Errorf("fake"))) require.False(t, IsNotFound(fmt.Errorf(`"foo" not found`))) } #ifndef AIKIDO_STATESPACE_DART_SE3JOINTSTATESPACE_HPP_ #define AIKIDO_STATESPACE_DART_SE3JOINTSTATESPACE_HPP_ #include "aikido/statespace/SE3.hpp" #include "aikido/statespace/dart/JointStateSpace.hpp" namespace aikido { namespace statespace { namespace dart { /// \c SE3 for a DART \c FreeJoint. This class does not support /// position limits on the three rotational <tt>DegreeOfFreedom</tt>s. class SE3Joint : public SE3 , public JointStateSpace , public std::enable_shared_from_this<SE3Joint> { public: using SE3::State; /// Creates a state space for a \c FreeJoint. This class does not support /// position limits on the rotational <tt>DegreeOfFreedom</tt>s. /// /// \param joint joint to create a state space for explicit SE3Joint(const ::dart::dynamics::FreeJoint* joint); // Documentation inherited. void convertPositionsToState( const Eigen::VectorXd& positions, StateSpace::State* state) const override; // Documentation inherited. void convertStateToPositions( const StateSpace::State* state, Eigen::VectorXd& positions) const override; }; } // namespace dart } // namespace statespace } // namespace aikido #endif // ifndef AIKIDO_STATESPACE_SE3JOINTSTATESPACE_HPP_ // Copyright 2018 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package procfs import ( "github.com/prometheus/procfs/internal/fs" ) // FS represents the pseudo-filesystem sys, which
null
null
null
null
null
null
github_plus_top10pct_by_avg
provides an interface to // kernel data structures. type FS struct { proc fs.FS } // DefaultMountPoint is the common mount point of the proc filesystem. const DefaultMountPoint = fs.DefaultProcMountPoint // NewDefaultFS returns a new proc FS mounted under the default proc mountPoint. // It will error if the mount point directory can't be read or is a file. func NewDefaultFS() (FS, error) { return NewFS(DefaultMountPoint) } // NewFS returns a new proc FS mounted under the given proc mountPoint. It will error // if the mount point directory can't be read or is a file. func NewFS(mountPoint string) (FS, error) { fs, err := fs.NewFS(mountPoint) if err != nil { return FS{}, err } return FS{fs}, nil } // This file is part of Sophus. // // Copyright 2012-2013 Hauke Strasdat // // 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 SOPHUS_SO2_HPP #define SOPHUS_SO2_HPP #include <complex> #include "sophus.hpp" //////////////////////////////////////////////////////////////////////////// // Forward De
null
null
null
null
null
null
github_plus_top10pct_by_avg
clarations / typedefs //////////////////////////////////////////////////////////////////////////// namespace Sophus { template<typename _Scalar, int _Options=0> class SO2Group; typedef SO2Group<double> SO2 EIGEN_DEPRECATED; typedef SO2Group<double> SO2d; /**< double precision SO2 */ typedef SO2Group<float> SO2f; /**< single precision SO2 */ } //////////////////////////////////////////////////////////////////////////// // Eigen Traits (For querying derived types in CRTP hierarchy) //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// // Eigen Traits (For querying derived types in CRTP hierarchy) //////////////////////////////////////////////////////////////////////////// namespace Eigen { namespace internal { template<typename _Scalar, int _Options> struct traits<Sophus::SO2Group<_Scalar,_Options> > { typedef _Scalar Scalar; typedef Matrix<Scalar,2,1> ComplexType; }; template<typename _Scalar, int _Options> struct traits<Map<Sophus::SO2Group<_Scalar>, _Options> > : traits<Sophus::SO2Group<_Scalar, _Options> > { typedef _Scalar Scalar; typedef Map<Matrix<Scalar,2,1>,_Options> ComplexType; }; template<typename _Scalar, int _Options> struct traits<Map<const Sophus::SO2Group<_Scalar>, _Options> > : traits<const Sophus::SO2Group<_Scalar, _Options> > { typedef _Scalar Scalar; typedef Map<const Matrix<Scalar,2,1>,_Options> ComplexType; }; } } namespace Sophus { using namespace Eigen; /** * \brief SO2 base type - implements SO2 class but is storage agnostic * * [add more detailed description/tutorial] */ template<typename Derived> class SO2GroupBase { public: /** \brief scalar type */ typedef typename internal::traits<Derived>::Scalar Scalar; /** \brief complex number reference type */ typedef typename internal::traits<Derived>::ComplexType & ComplexReference; /** \brief complex number const reference type */ typedef const typename internal::traits<Derived>::ComplexType & C
null
null
null
null
null
null
github_plus_top10pct_by_avg
onstComplexReference; /** \brief degree of freedom of group * (one for in-plane rotation) */ static const int DoF = 1; /** \brief number of internal parameters used * (unit complex number for rotation) */ static const int num_parameters = 2; /** \brief group transformations are NxN matrices */ static const int N = 2; /** \brief group transfomation type */ typedef Matrix<Scalar,N,N> Transformation; /** \brief point type */ typedef Matrix<Scalar,2,1> Point; /** \brief tangent vector type */ typedef Scalar Tangent; /** \brief adjoint transformation type */ typedef Scalar Adjoint; /** * \brief Adjoint transformation * * This function return the adjoint transformation \f$ Ad \f$ of the * group instance \f$ A \f$ such that for all \f$ x \f$ * it holds that \f$ \widehat{Ad_A\cdot x} = A\widehat{x}A^{-1} \f$ * with \f$\ \widehat{\cdot} \f$ being the hat()-operator. * * For SO2, it simply returns 1. */ inline const Adjoint Adj() const { return 1; } /** * \returns copy of instance casted to NewScalarType */ template<typename NewScalarType> inline SO2Group<NewScalarType> cast() const { return SO2Group<NewScalarType>(unit_complex() .template cast<NewScalarType>() ); } /** * \returns pointer to internal data * * This provides unsafe read/write access to internal data. SO2 is represented * by a complex number with unit length (two parameters). When using direct * write access, the user needs to take care of that the complex number stays * normalized. * * \see normalize() */ inline Scalar* data() { return unit_complex_nonconst().data(); } /** * \returns const pointer to internal data * * Const version of data(). */ inline const Scalar* data() const { return unit_complex().data(); } /** * \brief Fast group multiplication * * This method is a fast version of operator*=(), since it does not perform * normalizatio
null
null
null
null
null
null
github_plus_top10pct_by_avg
n. It is up to the user to call normalize() once in a while. * * \see operator*=() */ inline void fastMultiply(const SO2Group<Scalar>& other) { Scalar lhs_real = unit_complex().x(); Scalar lhs_imag = unit_complex().y(); const Scalar & rhs_real = other.unit_complex().x(); const Scalar & rhs_imag = other.unit_complex().y(); // complex multiplication unit_complex_nonconst().x() = lhs_real*rhs_real - lhs_imag*rhs_imag; unit_complex_nonconst().y() = lhs_real*rhs_imag + lhs_imag*rhs_real; } /** * \returns group inverse of instance */ inline const SO2Group<Scalar> inverse() const { return SO2Group<Scalar>(unit_complex().x(), -unit_complex().y()); } /** * \brief Logarithmic map * * \returns tangent space representation (=rotation angle) of instance * * \see log(). */ inline const Scalar log() const { return SO2Group<Scalar>::log(*this); } /** * \brief Normalize complex number * * It re-normalizes complex number to unit length. This method only needs to * be called in conjunction with fastMultiply() or data() write access. */ inline void normalize() { Scalar length = std::sqrt(unit_complex().x()*unit_complex().x() + unit_complex().y()*unit_complex().y()); if(length < SophusConstants<Scalar>::epsilon()) { throw SophusException("Complex number is (near) zero!"); } unit_complex_nonconst().x() /= length; unit_complex_nonconst().y() /= length; } /** * \returns 2x2 matrix representation of instance * * For SO2, the matrix representation is an orthogonal matrix R with det(R)=1, * thus the so-called rotation matrix. */ inline const Transformation matrix() const { const Scalar & real = unit_complex().x(); const Scalar & imag = unit_complex().y(); Transformation R; R << real, -imag ,imag, real; return R; } /** * \brief Assignment operator */ template<typename OtherDerived> inline SO2GroupBase<Derived>& op
null
null
null
null
null
null
github_plus_top10pct_by_avg
erator=(const SO2GroupBase<OtherDerived> & other) { unit_complex_nonconst() = other.unit_complex(); return *this; } /** * \brief Group multiplication * \see operator*=() */ inline const SO2Group<Scalar> operator*(const SO2Group<Scalar>& other) const { SO2Group<Scalar> result(*this); result *= other; return result; } /** * \brief Group action on \f$ \mathbf{R}^2 \f$ * * \param p point \f$p \in \mathbf{R}^2 \f$ * \returns point \f$p' \in \mathbf{R}^2 \f$, rotated version of \f$p\f$ * * This function rotates a point \f$ p \f$ in \f$ \mathbf{R}^2 \f$ by the * SO2 transformation \f$R\f$ (=rotation matrix): \f$ p' = R\cdot p \f$. */ inline const Point operator*(const Point & p) const { const Scalar & real = unit_complex().x(); const Scalar & imag = unit_complex().y(); return Point(real*p[0] - imag*p[1], imag*p[0] + real*p[1]); } /** * \brief In-place group multiplication * * \see fastMultiply() * \see operator*() */ inline void operator*=(const SO2Group<Scalar>& other) { fastMultiply(other); normalize(); } /** * \brief Setter of internal unit complex number representation * * \param complex * \pre the complex number must not be near zero * * The complex number is normalized to unit length. */ inline void setComplex(const Point & complex) { unit_complex_nonconst() = complex; normalize(); } /** * \brief Accessor of unit complex number * * No direct write access is given to ensure the complex stays normalized. */ EIGEN_STRONG_INLINE ConstComplexReference unit_complex() const { return static_cast<const Derived*>(this)->unit_complex(); } //////////////////////////////////////////////////////////////////////////// // public static functions //////////////////////////////////////////////////////////////////////////// /** * \brief Group exponential * * \param theta tangent space element (=rotation angle \f$ \theta \f$) * \ret
null
null
null
null
null
null
github_plus_top10pct_by_avg
urns corresponding element of the group SO2 * * To be more specific, this function computes \f$ \exp(\widehat{\theta}) \f$ * with \f$ \exp(\cdot) \f$ being the matrix exponential * and \f$ \widehat{\cdot} \f$ the hat()-operator of SO2. * * \see hat() * \see log() */ inline static const SO2Group<Scalar> exp(const Tangent & theta) { return SO2Group<Scalar>(std::cos(theta), std::sin(theta)); } /** * \brief Generator * * The infinitesimal generator of SO2 * is \f$ * G_0 = \left( \begin{array}{ccc} * 0& -1& \\ * 1& 0& * \end{array} \right). * \f$ * \see hat() */ inline static const Transformation generator() { return hat(1); } /** * \brief hat-operator * * \param theta scalar representation of Lie algebra element * \returns 2x2-matrix representatin of Lie algebra element * * Formally, the hat-operator of SO2 is defined * as \f$ \widehat{\cdot}: \mathbf{R}^2 \rightarrow \mathbf{R}^{2\times 2}, * \quad \widehat{\theta} = G_0\cdot \theta \f$ * with \f$ G_0 \f$ being the infinitesial generator(). * * \see generator() * \see vee() */ inline static const Transformation hat(const Tangent & theta) { Transformation Omega; Omega << static_cast<Scalar>(0), -theta , theta, static_cast<Scalar>(0); return Omega; } /** * \brief Lie bracket * * \param theta1 scalar representation of Lie algebra element * \param theta2 scalar representation of Lie algebra element * \returns zero * * It computes the bracket. For the Lie algebra so2, the Lie bracket is * simply \f$ [\theta_1, \theta_2]_{so2} = 0 \f$ since SO2 is a * commutative group. * * \see hat() * \see vee() */ inline static const Tangent lieBracket(const Tangent & theta1, const Tangent & theta2) { return static_cast<Scalar>(0); } /** * \brief Logarithmic map
null
null
null
null
null
null
github_plus_top10pct_by_avg
* * \param other element of the group SO2 * \returns corresponding tangent space element * (=rotation angle \f$ \theta \f$) * * Computes the logarithmic, the inverse of the group exponential. * To be specific, this function computes \f$ \log({\cdot})^\vee \f$ * with \f$ \vee(\cdot) \f$ being the matrix logarithm * and \f$ \vee{\cdot} \f$ the vee()-operator of SO2. * * \see exp() * \see vee() */ inline static const Tangent log(const SO2Group<Scalar> & other) { // todo: general implementation for Scalar not being float or double. return atan2(other.unit_complex_.y(), other.unit_complex().x()); } /** * \brief vee-operator * * \param Omega 2x2-matrix representation of Lie algebra element * \pre Omega need to be a skew-symmetric matrix * \returns scalar representatin of Lie algebra element *s * This is the inverse of the hat()-operator. * * \see hat() */ inline static const Tangent vee(const Transformation & Omega) { return static_cast<Scalar>(0.5)*(Omega(1,0) - Omega(0,1)); } private: // Mutator of complex number is private so users are hampered // from setting non-unit complex numbers. EIGEN_STRONG_INLINE ComplexReference unit_complex_nonconst() { return static_cast<Derived*>(this)->unit_complex_nonconst(); } }; /** * \brief SO2 default type - Constructors and default storage for SO2 Type */ template<typename _Scalar, int _Options> class SO2Group : public SO2GroupBase<SO2Group<_Scalar,_Options> > { typedef SO2GroupBase<SO2Group<_Scalar,_Options> > Base; public: /** \brief scalar type */ typedef typename internal::traits<SO2Group<_Scalar,_Options> > ::Scalar Scalar; /** \brief complex number reference type */ typedef typename internal::traits<SO2Group<_Scalar,_Options> > ::ComplexType & ComplexReference; /** \brief complex number const reference type */ typedef const typename internal::traits<SO2Group<_Scalar,_Options> > ::ComplexType & ConstComplexRefere
null
null
null
null
null
null
github_plus_top10pct_by_avg
nce; /** \brief degree of freedom of group */ static const int DoF = Base::DoF; /** \brief number of internal parameters used */ static const int num_parameters = Base::num_parameters; /** \brief group transformations are NxN matrices */ static const int N = Base::N; /** \brief group transfomation type */ typedef typename Base::Transformation Transformation; /** \brief point type */ typedef typename Base::Point Point; /** \brief tangent vector type */ typedef typename Base::Tangent Tangent; /** \brief adjoint transformation type */ typedef typename Base::Adjoint Adjoint; // base is friend so unit_complex_nonconst can be accessed from base friend class SO2GroupBase<SO2Group<_Scalar,_Options> >; EIGEN_MAKE_ALIGNED_OPERATOR_NEW /** * \brief Default constructor * * Initialize complex number to identity rotation. */ inline SO2Group() : unit_complex_(static_cast<Scalar>(1), static_cast<Scalar>(0)) { } /** * \brief Copy constructor */ template<typename OtherDerived> inline SO2Group(const SO2GroupBase<OtherDerived> & other) : unit_complex_(other.unit_complex()) { } /** * \brief Constructor from rotation matrix * * \pre rotation matrix need to be orthogonal with determinant of 1 */ inline explicit SO2Group(const Transformation & R) : unit_complex_(static_cast<Scalar>(0.5)*(R(0,0)+R(1,1)), static_cast<Scalar>(0.5)*(R(1,0)-R(0,1))) { if (std::abs(R.determinant()-static_cast<Scalar>(1)) > SophusConstants<Scalar>::epsilon()) { throw SophusException("det(R) is not near 1."); } } /** * \brief Constructor from pair of real and imaginary number * * \pre pair must not be zero */ inline SO2Group(const Scalar & real, const Scalar & imag) : unit_complex_(real, imag) { Base::normalize(); } /** * \brief Constructor from 2-vector * * \pre vector must not be zero */ inline explicit SO2Group(const Matrix<Scalar,2,1> & complex) : unit_complex_(com
null
null
null
null
null
null
github_plus_top10pct_by_avg
plex) { Base::normalize(); } /** * \brief Constructor from std::complex * * \pre complex number must not be zero */ inline explicit SO2Group(const std::complex<Scalar> & complex) : unit_complex_(complex.real(), complex.imag()) { Base::normalize(); } /** * \brief Constructor from an angle */ inline explicit SO2Group(Scalar theta) { unit_complex_nonconst() = SO2Group<Scalar>::exp(theta).unit_complex(); } /** * \brief Accessor of unit complex number * * No direct write access is given to ensure the complex number stays * normalized. */ EIGEN_STRONG_INLINE ConstComplexReference unit_complex() const { return unit_complex_; } protected: // Mutator of complex number is protected so users are hampered // from setting non-unit complex numbers. EIGEN_STRONG_INLINE ComplexReference unit_complex_nonconst() { return unit_complex_; } static bool isNearZero(const Scalar & real, const Scalar & imag) { return (real*real + imag*imag < SophusConstants<Scalar>::epsilon()); } Matrix<Scalar,2,1> unit_complex_; }; } // end namespace namespace Eigen { /** * \brief Specialisation of Eigen::Map for SO2GroupBase * * Allows us to wrap SO2 Objects around POD array * (e.g. external c style complex number) */ template<typename _Scalar, int _Options> class Map<Sophus::SO2Group<_Scalar>, _Options> : public Sophus::SO2GroupBase<Map<Sophus::SO2Group<_Scalar>, _Options> > { typedef Sophus::SO2GroupBase<Map<Sophus::SO2Group<_Scalar>, _Options> > Base; public: /** \brief scalar type */ typedef typename internal::traits<Map>::Scalar Scalar; /** \brief complex number reference type */ typedef typename internal::traits<Map>::ComplexType & ComplexReference; /** \brief complex number const reference type */ typedef const typename internal::traits<Map>::ComplexType & ConstComplexReference; /** \brief degree of freedom of group */ static const int DoF = Base::DoF; /** \brief number of internal parameters used */
null
null
null
null
null
null
github_plus_top10pct_by_avg
static const int num_parameters = Base::num_parameters; /** \brief group transformations are NxN matrices */ static const int N = Base::N; /** \brief group transfomation type */ typedef typename Base::Transformation Transformation; /** \brief point type */ typedef typename Base::Point Point; /** \brief tangent vector type */ typedef typename Base::Tangent Tangent; /** \brief adjoint transformation type */ typedef typename Base::Adjoint Adjoint; // base is friend so unit_complex_nonconst can be accessed from base friend class Sophus::SO2GroupBase<Map<Sophus::SO2Group<_Scalar>, _Options> >; EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map) using Base::operator*=; using Base::operator*; EIGEN_STRONG_INLINE Map(Scalar* coeffs) : unit_complex_(coeffs) { } /** * \brief Accessor of unit complex number * * No direct write access is given to ensure the complex number stays * normalized. */ EIGEN_STRONG_INLINE ConstComplexReference unit_complex() const { return unit_complex_; } protected: // Mutator of complex number is protected so users are hampered // from setting non-unit complex number. EIGEN_STRONG_INLINE ComplexReference unit_complex_nonconst() { return unit_complex_; } Map<Matrix<Scalar,2,1>,_Options> unit_complex_; }; /** * \brief Specialisation of Eigen::Map for const SO2GroupBase * * Allows us to wrap SO2 Objects around POD array * (e.g. external c style complex number) */ template<typename _Scalar, int _Options> class Map<const Sophus::SO2Group<_Scalar>, _Options> : public Sophus::SO2GroupBase< Map<const Sophus::SO2Group<_Scalar>, _Options> > { typedef Sophus::SO2GroupBase<Map<const Sophus::SO2Group<_Scalar>, _Options> > Base; public: /** \brief scalar type */ typedef typename internal::traits<Map>::Scalar Scalar; /** \brief complex number const reference type */ typedef const typename internal::traits<Map>::ComplexType & ConstComplexReference; /** \brief degree of freedom of group */ static const
null
null
null
null
null
null
github_plus_top10pct_by_avg
int DoF = Base::DoF; /** \brief number of internal parameters used */ static const int num_parameters = Base::num_parameters; /** \brief group transformations are NxN matrices */ static const int N = Base::N; /** \brief group transfomation type */ typedef typename Base::Transformation Transformation; /** \brief point type */ typedef typename Base::Point Point; /** \brief tangent vector type */ typedef typename Base::Tangent Tangent; /** \brief adjoint transformation type */ typedef typename Base::Adjoint Adjoint; EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map) using Base::operator*=; using Base::operator*; EIGEN_STRONG_INLINE Map(const Scalar* coeffs) : unit_complex_(coeffs) { } /** * \brief Accessor of unit complex number * * No direct write access is given to ensure the complex number stays * normalized. */ EIGEN_STRONG_INLINE ConstComplexReference unit_complex() const { return unit_complex_; } protected: const Map<const Matrix<Scalar,2,1>,_Options> unit_complex_; }; } #endif // SOPHUS_SO2_HPP // Copyright Aleksey Gurtovoy 2000-2004 // // 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) // // Preprocessed version of "boost/mpl/aux_/reverse_iter_fold_impl.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { namespace aux { /// forward declaration template< long N , typename First , typename Last , typename State , typename BackwardOp , typename ForwardOp > struct reverse_iter_fold_impl; template< long N > struct reverse_iter_fold_chunk; template<> struct reverse_iter_fold_chunk<0> { template< typename First , typename Last , typename State , typename BackwardOp , typename ForwardOp > struct result_ { typedef First iter0; typedef State fwd_state0; typedef fwd_state0 bkwd_state0; typedef bk
null
null
null
null
null
null
github_plus_top10pct_by_avg
wd_state0 state; typedef iter0 iterator; }; }; template<> struct reverse_iter_fold_chunk<1> { template< typename First , typename Last , typename State , typename BackwardOp , typename ForwardOp > struct result_ { typedef First iter0; typedef State fwd_state0; typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; typedef typename mpl::next<iter0>::type iter1; typedef fwd_state1 bkwd_state1; typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; typedef bkwd_state0 state; typedef iter1 iterator; }; }; template<> struct reverse_iter_fold_chunk<2> { template< typename First , typename Last , typename State , typename BackwardOp , typename ForwardOp > struct result_ { typedef First iter0; typedef State fwd_state0; typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; typedef typename mpl::next<iter0>::type iter1; typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; typedef typename mpl::next<iter1>::type iter2; typedef fwd_state2 bkwd_state2; typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; typedef bkwd_state0 state; typedef iter2 iterator; }; }; template<> struct reverse_iter_fold_chunk<3> { template< typename First , typename Last , typename State , typename BackwardOp , typename ForwardOp > struct result_ { typedef First iter0; typedef State fwd_state0; typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; typedef typename mpl::next<iter0>::type iter1; typedef typename apply2< ForwardOp,fwd_state1,ite
null
null
null
null
null
null
github_plus_top10pct_by_avg
r1 >::type fwd_state2; typedef typename mpl::next<iter1>::type iter2; typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3; typedef typename mpl::next<iter2>::type iter3; typedef fwd_state3 bkwd_state3; typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2; typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; typedef bkwd_state0 state; typedef iter3 iterator; }; }; template<> struct reverse_iter_fold_chunk<4> { template< typename First , typename Last , typename State , typename BackwardOp , typename ForwardOp > struct result_ { typedef First iter0; typedef State fwd_state0; typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; typedef typename mpl::next<iter0>::type iter1; typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; typedef typename mpl::next<iter1>::type iter2; typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3; typedef typename mpl::next<iter2>::type iter3; typedef typename apply2< ForwardOp,fwd_state3,iter3 >::type fwd_state4; typedef typename mpl::next<iter3>::type iter4; typedef fwd_state4 bkwd_state4; typedef typename apply2< BackwardOp,bkwd_state4,iter3 >::type bkwd_state3; typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2; typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; typedef bkwd_state0 state; typedef iter4 iterator; }; }; template< long N > struct reverse_iter_fold_chunk { template< typename First , typename Last , typename State
null
null
null
null
null
null
github_plus_top10pct_by_avg
, typename BackwardOp , typename ForwardOp > struct result_ { typedef First iter0; typedef State fwd_state0; typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; typedef typename mpl::next<iter0>::type iter1; typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; typedef typename mpl::next<iter1>::type iter2; typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3; typedef typename mpl::next<iter2>::type iter3; typedef typename apply2< ForwardOp,fwd_state3,iter3 >::type fwd_state4; typedef typename mpl::next<iter3>::type iter4; typedef reverse_iter_fold_impl< ( (N - 4) < 0 ? 0 : N - 4 ) , iter4 , Last , fwd_state4 , BackwardOp , ForwardOp > nested_chunk; typedef typename nested_chunk::state bkwd_state4; typedef typename apply2< BackwardOp,bkwd_state4,iter3 >::type bkwd_state3; typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2; typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; typedef bkwd_state0 state; typedef typename nested_chunk::iterator iterator; }; }; template< typename First , typename Last , typename State , typename BackwardOp , typename ForwardOp > struct reverse_iter_fold_step; template< typename Last , typename State > struct reverse_iter_fold_null_step { typedef Last iterator; typedef State state; }; template<> struct reverse_iter_fold_chunk< -1 > { template< typename First , typename Last , typename State , typename BackwardOp , typename ForwardOp > struct result_ { typedef typename if_< typename is_same< First,Last >::
null
null
null
null
null
null
github_plus_top10pct_by_avg
type , reverse_iter_fold_null_step< Last,State > , reverse_iter_fold_step< First,Last,State,BackwardOp,ForwardOp > >::type res_; typedef typename res_::state state; typedef typename res_::iterator iterator; }; }; template< typename First , typename Last , typename State , typename BackwardOp , typename ForwardOp > struct reverse_iter_fold_step { typedef reverse_iter_fold_chunk< -1 >::template result_< typename mpl::next<First>::type , Last , typename apply2< ForwardOp,State,First >::type , BackwardOp , ForwardOp > nested_step; typedef typename apply2< BackwardOp , typename nested_step::state , First >::type state; typedef typename nested_step::iterator iterator; }; template< long N , typename First , typename Last , typename State , typename BackwardOp , typename ForwardOp > struct reverse_iter_fold_impl : reverse_iter_fold_chunk<N> ::template result_< First,Last,State,BackwardOp,ForwardOp > { }; }}} Subdomain take over (xxx.xxxxxxxxxxxx.xxx) Hi, ## Description You have a subdomain aka `xxx.xxxxxxxxxxxx.xxx` that point to a third party service hosted on XXX: `www.XXX.com`. The nslookup command shows the DNS configuration. ``` $ nslookup xxx.xxxxxxxxxxxx.xxx 8.8.8.8 ``` However it seems that your didn't own/claim the name `YYY` on XXX. That means an attacker could take it and trick your users/staff by copying your primary website and design. ## PoC {} ## Risk - fake website - malicious code injection - users tricking - company impersonation This issue can have really huge impact on the companies reputation someone could post malicious content on the compromised site and then your users will think it's official but it's not. ## Remediation Remove the cname entry or claim the subdomain `YYY` on XXX. ## See also https://labs.detectify.com/2014/10/21/hostile-subdomain-takeo
null
null
null
null
null
null
github_plus_top10pct_by_avg
ver-using-herokugithubdesk-more/ https://0xpatrik.com/subdomain-takeover/ https://medium.com/@ajdumanhug/subdomain-takeover-through-external-services-f0f7ee2b93bd http://yassineaboukir.com/blog/neglected-dns-records-exploited-to-takeover-subdomains/ ## Additional note I claimed the domain on XXX, let me know if you want to get it back, I'll delete it soon. Best regards, Gwen /** * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md. */ /* global process */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; // A dictionary of words to help keeping the output size smaller. const $element = 'e'; const $text = 't'; const $attribs = 'a'; const $children = '_'; /** * Enables `editor.model.data`, a "live" property that can be used to get and set simple native object representation * of the main root in the model document. * * The focus of this plugin is performance, providing a very fast way to dump the editor data * for every change made in the editor content. Using `editor.model.data` should be at least 100x faster * than `editor.getData()`. */ export default class LiveModelData extends Plugin { constructor( editor ) { super( editor ); const liveDocumentData = new LiveDocumentData( editor.model.document ); /** * The model raw data as simple object. * * Attention: the object returned by this property must not be manipulated directly or it can * immediately break the editor. If manipulation is necessary, be sure to do so in a deep clone of it. * * This property can be set to data in the same format as the one it outputs, * having it the following structure: * { -> document root, wrapping the whole data * _: [ -> root children * { -> if element * e: "...", -> element name * a: {}, -> element attributes (optional) * _: [ ... ] -> element children (optional) * }, * { ->
null
null
null
null
null
null
github_plus_top10pct_by_avg
if text * t: "...", -> text data * a: {}, -> text attributes (optional) * }, * ... * ] * } * * @memberOf Model * @member {String} #data */ Object.defineProperty( editor.model, 'data', { get: () => { return liveDocumentData.get(); }, set: data => { return liveDocumentData.set( data ); } } ); } } /** * Maintains a "live" version of the main root element in a model document. * * By "live" we mean that changes to the model will just update the portions of the data that they touch. */ class LiveDocumentData { /** * Creates an instance of the LiveDocumentData class. * * @param document {module:engine/model/document~Document} The document to be watching for changes. */ constructor( document ) { this.root = document.getRoot(); // This is the "database" that holds the output text version for all nodes in the document model. const tree = this.tree = new Tree(); document.on( 'change:data', () => { /* istanbul ignore next */ if ( process.env.NODE_ENV !== 'production' ) { // Just set the following global (in the extension console) to see the performance log. if ( window.LOG_LIVE_MODEL_DATA ) { console.time( 'LiveModelData - process changes' ); } } const changes = document.differ.getChanges(); for ( const change of changes ) { const position = change.position; switch ( change.type ) { case 'insert' : { if ( change.name === '$text' ) { // It is hard to say precisely what a text insertion changed so we refresh // all texts (for simplicity). tree.refreshTexts( position.parent ); } else { const element = position.nodeAfter; tree.insert( element ); // If the element ended up between texts, there is a chance that it split them, // creating additional text nodes. As we don't have means to know that, // we refresh all texts (for simplicity). const isBetweenTexts = element.previousSibling && eleme
null
null
null
null
null
null
github_plus_top10pct_by_avg
nt.previousSibling.is( '$text' ) && element.nextSibling && element.nextSibling.is( '$text' ); if ( isBetweenTexts ) { tree.refreshTexts( position.parent ); } } break; } case 'remove' : { if ( change.name === '$text' ) { // We have no information about which text nodes have been touched so // we refresh all of them (for simplicity). tree.refreshTexts( position.parent ); } else { tree.remove( position ); } break; } case 'attribute': { const walker = change.range.getWalker( { ignoreElementEnd: true } ); let lastTextRefreshParent; for ( const { item } of walker ) { if ( item.is( 'element' ) ) { // If the walker is passing through an element, we just refresh it, // updating the attribute value in it (if it applies). tree.refreshNode( item ); } else { // If instead we have a text node, we have no idea if it has been // merged with siblings, so we update it and all its sibling texts. if ( item.parent !== lastTextRefreshParent ) { tree.refreshTexts( item.parent ); // Do it just once for this parent. lastTextRefreshParent = item.parent; } } } } } } /* istanbul ignore next */ if ( process.env.NODE_ENV !== 'production' ) { if ( window.LOG_LIVE_MODEL_DATA ) { console.timeEnd( 'LiveModelData - process changes' ); } } /** * Fired when the `data` property value "potentially" changed. * * @memberOf {Model} * @event #data */ document.model.fire( 'data' ); } ); } /** * Gets the live object that holds the representation of the document main root data. * * This object must not be changed directly. It's main purpose is storage. * * return {Object} A live object. */ get() { return this.tree.root; } /** * Sets the data of the main document root with data produced by get(). * * @param data {Object} And objec
null
null
null
null
null
null
github_plus_top10pct_by_avg
t containing the model data representation. */ set( data ) { const root = this.root; const model = root.document.model; model.change( writer => { // Replace the document contents. writer.remove( writer.createRangeIn( root ) ); writer.insert( createFragment( data, writer ), root ); // Clean up previous document selection. writer.setSelection( null ); writer.removeSelectionAttribute( model.document.selection.getAttributeKeys() ); } ); function createFragment( data, writer ) { const fragment = writer.createDocumentFragment(); addChildren( data, fragment ); return fragment; function addChildren( dataNode, modelTarget ) { const children = dataNode[ $children ]; if ( children ) { let index = 0; let child; while ( ( child = children[ index ] ) ) { if ( $text in child ) { writer.appendText( child[ $text ], child[ $attribs ], modelTarget ); } else { const element = writer.createElement( child[ $element ], child[ $attribs ] ); // Go recursively. addChildren( child, element ); writer.append( element, modelTarget ); } index++; } } } } } } /** * Holds a deep object representation of model nodes. */ class Tree { /** * Creates and instance of the Tree class with an empty root node. */ constructor() { /** * The root node. * * @type {String[]} */ this.root = {}; } /** * Inserts a model node in the tree. * * The node position in the tree reflects its position in the model. * * @param modelNode {Element|Text} The model node to be inserted. */ insert( modelNode ) { const parent = this.getNode( modelNode.parent ); const children = parent[ $children ] || ( parent[ $children ] = [] ); children.splice( modelNode.index, 0, this.getDefinition( modelNode ) ); } /** * Remove a node from the tree based on its position. * * The position in the tree is calculated out of a model position. * * @param modelPosition {Position} The model posit
null
null
null
null
null
null
github_plus_top10pct_by_avg
ion. */ remove( modelPosition ) { // By default we take the node which matches the position index. let index = modelPosition.index; // If we're inside a text node though, it means that the removed node was actually // after that text node, so we fix the index. To illustrate (e.g.): // // Index: 0 1 2 // Before: text-before|{removed}text-after -> | == position.index = 1 // // Index: 0 // After: text-before|text-after -> | == position.index = 0 // const inTextNode = modelPosition.textNode; if ( inTextNode ) { index = modelPosition.textNode.index + 1; } const parent = this.getNode( modelPosition.parent ); parent[ $children ].splice( index, 1 ); if ( !parent[ $children ].length ) { delete parent[ $children ]; } // As demonstrated in the above comment, text need to be refreshed as they where merged. if ( inTextNode ) { this.refreshTexts( modelPosition.parent ); } } /** * Refreshes a node. This is useful when changes to attributes happen. * * @param modelNode {Element|Text} The node to be refreshed. */ refreshNode( modelNode ) { this.updateDefinition( this.getNode( modelNode ), modelNode ); } /** * Removes and re-inserts all text nodes that are direct children of an element. * * @param modelNode {Element} The parent element. */ refreshTexts( modelNode ) { const node = this.getNode( modelNode ); const children = node[ $children ] || []; // Remove all text nodes. for ( let i = children.length - 1; i >= 0; i-- ) { if ( $text in children[ i ] ) { children.splice( i, 1 ); } } // Insert all text nodes back again. Array.from( modelNode.getChildren() ).forEach( child => { if ( child.is( '$text' ) ) { children.splice( child.index, 0, this.getDefinition( child ) ); } } ); if ( children.length ) { node[ $children ] = children; } else { delete node[ $children ]; } } /** * Fills up a node definition, not including children nodes. * * @param definition {Object} * @para
null
null
null
null
null
null
github_plus_top10pct_by_avg
m modelNode {Element|Text} The node to be processed. */ updateDefinition( definition, modelNode ) { if ( modelNode.data ) { definition[ $text ] = modelNode.data; } else { definition[ $element ] = modelNode.name; } // Attributes. { const nodeAttribs = Array.from( modelNode.getAttributes() ); if ( nodeAttribs.length ) { definition[ $attribs ] = nodeAttribs.reduce( ( obj, [ name, value ] ) => { obj[ name ] = value; return obj; }, {} ); } } } /** * Gets the complete node definition, including its children tree. * * @param modelNode {Element|Text} The node to be processed. * @returns {Object} The node definition. */ getDefinition( modelNode ) { const definition = {}; this.updateDefinition( definition, modelNode ); if ( $element in definition ) { if ( modelNode.childCount ) { definition[ $children ] = Array.from( modelNode.getChildren() ) .map( child => this.getDefinition( child ) ); } } return definition; } /** * Calculates the tree path for a given model node. * * The path reflects that node position in the model document. * * @param modelNode {Element|Text} The model node. * @returns {Number[]} A sequence of indexes to reach this node in the tree. */ getPath( modelNode ) { const path = []; while ( modelNode.parent ) { path.unshift( modelNode.index ); modelNode = modelNode.parent; } return path; } /** * Gets the tree entry representing a model node. * * @param modelNode {Element|Text} The model node. * @returns {String[]} The tree representation of the node. */ getNode( modelNode ) { const path = this.getPath( modelNode ); let node = this.root; while ( path.length ) { node = node[ $children ][ path.shift() ]; } return node; } } TEST?=./... default: test fmt: generate go fmt ./... test: generate go get -t ./... go test $(TEST) $(TESTARGS) generate: go generate ./... updatedeps: go get -u golang.org/x/tools/cmd/stringer .PHONY: default
null
null
null
null
null
null
github_plus_top10pct_by_avg
generate test updatedeps { "images" : [ { "idiom" : "iphone", "scale" : "1x" }, { "idiom" : "iphone", "filename" : "GroundBotGoodWalk_5_01_100.png", "scale" : "2x" }, { "idiom" : "iphone", "filename" : "GroundBotGoodWalk_5_01_180.png", "scale" : "3x" }, { "idiom" : "ipad", "filename" : "GroundBotGoodWalk_5_01_120.png", "scale" : "1x" }, { "idiom" : "ipad", "filename" : "GroundBotGoodWalk_5_01_240.png", "scale" : "2x" }, { "idiom" : "tv", "filename" : "GroundBotGoodWalk_5_01_169.png", "scale" : "1x" }, { "idiom" : "mac", "filename" : "GroundBotGoodWalk_5_01_225.png", "scale" : "1x" }, { "idiom" : "mac", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } # frozen_string_literal: true module Solargraph::LanguageServer::Message::Workspace class DidChangeWatchedFiles < Solargraph::LanguageServer::Message::Base CREATED = 1 CHANGED = 2 DELETED = 3 include Solargraph::LanguageServer::UriHelpers def process need_catalog = false # @param change [Hash] params['changes'].each do |change| if change['type'] == CREATED host.create change['uri'] need_catalog = true elsif change['type'] == CHANGED next if host.open?(change['uri']) host.create change['uri'] need_catalog = true elsif change['type'] == DELETED host.delete change['uri'] need_catalog = true else set_error Solargraph::LanguageServer::ErrorCodes::INVALID_PARAMS, "Unknown change type ##{change['type']} for #{uri_to_file(change['uri'])}" end end # Force host to catalog libraries after file changes (see castwide/solargraph#139) host.catalog if need_catalog end end end <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@s
null
null
null
null
null
null
github_plus_top10pct_by_avg
ymfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Contracts\Cache; use Psr\Cache\CacheItemPoolInterface; use Psr\Cache\InvalidArgumentException; use Psr\Log\LoggerInterface; // Help opcache.preload discover always-needed symbols class_exists(InvalidArgumentException::class); /** * An implementation of CacheInterface for PSR-6 CacheItemPoolInterface classes. * * @author Nicolas Grekas <p@tchwork.com> */ trait CacheTrait { /** * {@inheritdoc} */ public function get(string $key, callable $callback, float $beta = null, array &$metadata = null) { return $this->doGet($this, $key, $callback, $beta, $metadata); } /** * {@inheritdoc} */ public function delete(string $key): bool { return $this->deleteItem($key); } private function doGet(CacheItemPoolInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null, LoggerInterface $logger = null) { if (0 > $beta = $beta ?? 1.0) { throw new class(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', static::class, $beta)) extends \InvalidArgumentException implements InvalidArgumentException { }; } $item = $pool->getItem($key); $recompute = !$item->isHit() || \INF === $beta; $metadata = $item instanceof ItemInterface ? $item->getMetadata() : []; if (!$recompute && $metadata) { $expiry = $metadata[ItemInterface::METADATA_EXPIRY] ?? false; $ctime = $metadata[ItemInterface::METADATA_CTIME] ?? false; if ($recompute = $ctime && $expiry && $expiry <= ($now = microtime(true)) - $ctime / 1000 * $beta * log(random_int(1, \PHP_INT_MAX) / \PHP_INT_MAX)) { // force applying defaultLifetime to expiry $item->expiresAt(null); $logger && $logger->info('Item "{key}" elected for early recomputati
null
null
null
null
null
null
github_plus_top10pct_by_avg
on {delta}s before its expiration', [ 'key' => $key, 'delta' => sprintf('%.1f', $expiry - $now), ]); } } if ($recompute) { $save = true; $item->set($callback($item, $save)); if ($save) { $pool->save($item); } } return $item->get(); } } --- title: 機能フィルターを使用してユーザーのサブセットに対して機能を有効にする titleSuffix: Azure App Configuration description: 機能フィルターを使用してユーザーのサブセットに対して機能を有効にする方法を説明します ms.service: azure-app-configuration ms.custom: devx-track-csharp author: lisaguthrie ms.author: lcozzens ms.topic: conceptual ms.date: 3/9/2020 ms.openlocfilehash: 5b2eb942581f6e4163012b0f767d04c02689bb7b ms.sourcegitcommit: 4913da04fd0f3cf7710ec08d0c1867b62c2effe7 ms.translationtype: HT ms.contentlocale: ja-JP ms.lasthandoff: 08/14/2020 ms.locfileid: "88206758" --- # <a name="use-feature-filters-to-enable-a-feature-for-a-subset-of-users"></a>機能フィルターを使用してユーザーのサブセットに対して機能を有効にする 機能フラグを使用すると、アプリケーションの機能をアクティブ化または非アクティブ化することができます。 単純な機能フラグは、オンまたはオフのいずれかです。 アプリケーションは常に同じように動作します。 たとえば、機能フラグを使用して新しい機能をロールアウトします。 機能フラグを有効にすると、すべてのユーザーに新しい機能が表示されます。 機能フラグを無効にすると、新しい機能は表示されなくなります。 これに対し、"_条件付き機能フラグ_" を使用すると、機能フラグを動的に有効または無効にすることができます。 機能フラグの条件によっては、アプリケー�
null
null
null
null
null
null
github_plus_top10pct_by_avg
�ョンの動作が異なる場合があります。 最初に、ユーザーの小さなサブセットに新しい機能を表示するとします。 条件付き機能フラグを使用すると、一部のユーザーに対しては機能フラグを有効にし、他のユーザーに対しては無効にすることができます。 "_機能フィルター_" では、評価のたびに機能フラグの状態が判断されます。 `Microsoft.FeatureManagement` ライブラリには、次の 2 つの機能フィルターがあります。 - `PercentageFilter` では、パーセンテージに基づいて機能フラグが有効にされます。 - `TimeWindowFilter` では、指定した時間帯に機能フラグが有効にされます。 また、[Microsoft.FeatureManagement.IFeatureFilter インターフェイス](/dotnet/api/microsoft.featuremanagement.ifeaturefilter)を実装する独自の機能フィルターを作成することもできます。 ## <a name="registering-a-feature-filter"></a>機能フィルターの登録 機能フィルターを登録するには、機能フィルターの名前を指定して `AddFeatureFilter` メソッドを呼び出します。 たとえば、次のコードでは `PercentageFilter` が登録されます。 ```csharp public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); services.AddFeatureManagement().AddFeatureFilter<PercentageFilter>(); } ``` ## <a name="configuring-a-feature-filter-in-azure-app-configuration"></a>Azure App Configuration での機能フィルターの構成 一部の機能フィルターには追加の設定があります。 たとえば、`PercentageFilter` ではパーセンテージに基づいて機能がアクティブ化されます。 使用するパーセンテージを定義する設定があります。 定義されている機能フラグに対するこれらの設定は、Azure App Configuration で構成できます。 たとえば、`PercentageFilter` を使用し�
null
null
null
null
null
null
github_plus_top10pct_by_avg
��、Web アプリに対する要求の 50% について機能フラグを有効にするには、次の手順のようにします。 1. 「[クイックスタート: ASP.NET Core アプリに機能フラグを追加する](./quickstart-feature-flag-aspnet-core.md)」の手順に従って、機能フラグを使用して Web アプリを作成します。 1. Azure portal で、お使いの構成ストアにアクセスし、 **[機能マネージャー]** をクリックします。 1. クイックスタートで作成した *Beta* 機能フラグのコンテキスト メニューをクリックします。 **[編集]** をクリックします。 > [!div class="mx-imgBorder"] > ![Beta 機能フラグを編集する](./media/edit-beta-feature-flag.png) 1. **[編集]** 画面で、 **[オン]** ラジオ ボタンがまだ選択されていない場合はオンにします。 次に、 **[フィルターの追加]** ボタンをクリックします。 ( **[オン]** ラジオ ボタンのラベルが **[条件付き]** に変わります)。 1. **[キー]** フィールドに、「*Microsoft.Percentage*」と入力します。 > [!div class="mx-imgBorder"] > ![機能フィルターを追加する](./media/feature-flag-add-filter.png) 1. 機能フィルター キーの横にあるコンテキスト メニューをクリックします。 **[パラメーターの編集]** をクリックします。 > [!div class="mx-imgBorder"] > ![機能フィルターのパラメーターを編集する](./media/feature-flag-edit-filter-parameters.png) 1. **[名前]** ヘッダーの下をポイントして、グリッドにテキスト ボックスを表示します。 **[名前]** に「*値*」と入力し、 **[値]** に「50」と入力します。 **[値]** フィールドは、機能フィルターを有効にする要求の割合を示します。 > [!div class="mx-imgBorder"] > ![機能フィルターのパラメーターを設定する](./media/feature-flag-set-filter-parame
null
null
null
null
null
null
github_plus_top10pct_by_avg
ters.png) 1. **[適用]** をクリックして、 **[機能フラグの編集]** 画面に戻ります。 次に、 **[適用]** を再びクリックして、機能フラグの設定を保存します。 1. 機能フラグの **[状態]** が、 *[条件付き]* と表示されるようになります。 この状態は、機能フィルターによって適用される条件に基づいて、機能フラグが要求ごとに有効または無効になることを示します。 > [!div class="mx-imgBorder"] > ![条件付き機能フラグ](./media/feature-flag-filter-enabled.png) ## <a name="feature-filters-in-action"></a>機能フィルターの動作 この機能フラグの効果を確認するには、アプリケーションを起動し、ブラウザーの **[更新]** ボタンを何回かクリックします。 約 50% の時間は、ツール バーに *Beta* と表示されます。 要求のサブセットに対する *Beta* 機能は `PercentageFilter` によって非アクティブ化されるため、残りの時間は表示されません。 次のビデオでは、この動作を示します。 > [!div class="mx-imgBorder"] > ![PercentageFilter の動作](./media/feature-flags-percentagefilter.gif) ## <a name="next-steps"></a>次のステップ > [!div class="nextstepaction"] > [機能管理の概要](./concept-feature-management.md) /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS
null
null
null
null
null
null
github_plus_top10pct_by_avg
OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.jstorm.batch.util; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import backtype.storm.Config; import com.alibaba.jstorm.cluster.ClusterState; import com.alibaba.jstorm.cluster.DistributedClusterState; import com.alibaba.jstorm.utils.JStormUtils; public class BatchCommon { private static final Logger LOG = LoggerFactory.getLogger(BatchCommon.class); private static ClusterState zkClient = null; public static ClusterState getZkClient(Map conf) throws Exception { synchronized (BatchCommon.class) { if (zkClient != null) { return zkClient; } List<String> zkServers; if (conf.get(Config.TRANSACTIONAL_ZOOKEEPER_SERVERS) != null) { zkServers = (List<String>) conf.get(Config.TRANSACTIONAL_ZOOKEEPER_SERVERS); } else if (conf.get(Config.STORM_ZOOKEEPER_SERVERS) != null) { zkServers = (List<String>) conf.get(Config.STORM_ZOOKEEPER_SERVERS); } else { throw new RuntimeException("No setting zk"); } int port = 2181; if (conf.get(Config.TRANSACTIONAL_ZOOKEEPER_PORT) != null) { port = JStormUtils.parseInt(conf.get(Config.TRANSACTIONAL_ZOOKEEPER_PORT), 2181); } else if (conf.get(Config.STORM_ZOOKEEPER_PORT) != null) { port = JStormUtils.parseInt(conf.get(Config.STORM_ZOOKEEPER_PORT), 2181); } String root = BatchDef.BATCH_ZK_ROOT; if (conf.get(Config.TRANSACTIONAL_ZOOKEEPER_ROOT) != null) { root = (String) conf.get(Config.TRANSACTIONAL_ZOOKEEPER_ROOT); } root = root + BatchDef.ZK_SEPERATOR + conf.get(Config.TOPOLOGY_NAME); Map<Object, Object> tmpConf = new H
null
null
null
null
null
null
github_plus_top10pct_by_avg
ashMap<>(); tmpConf.putAll(conf); tmpConf.put(Config.STORM_ZOOKEEPER_SERVERS, zkServers); tmpConf.put(Config.STORM_ZOOKEEPER_ROOT, root); zkClient = new DistributedClusterState(tmpConf); LOG.info("Successfully connect ZK"); return zkClient; } } } {% load comment_tags oauth_tags %} {% load humanize %} <div class="card-body p-2 p-md-3 f-17" id="comment-list"> <ul class="list-unstyled"> <div class="mb-3"> <strong>{% get_comment_user_count article %}&nbsp;人参与&nbsp;|&nbsp;{% get_comment_count article %}&nbsp;条评论</strong> </div> {% for comment in comment_list %} <div class="comment-parent pt-2" id="com-{{ comment.id }}"> <li class="media"> {% get_user_avatar_tag comment.author %} <div class="media-body ml-2"> <a class="float-right small mr-2 rep-btn" href="#editor-block" data-repid="{{ comment.id }}" data-repuser="{{ comment.author.username }}">回复</a> <p class="mt-0 mb-1"> {% get_user_link comment.author as user_link_info %} {% if user_link_info.is_verified and user_link_info.link %} <strong > <a href="{{ user_link_info.link }}" title="前往 {{ comment.author }} 的个人网站" target="_blank">{{ comment.author }} </a> </strong> {% else %} <strong title="该用户未认证或没有个人站点">{{ comment.author }}</strong> {% endif %} {% if user_link_info.is_verified %} {% if user_link_info.provider == 'GitHub' %} <i class="fa fa-github" title="Github 绑定用户"></i> {% e
null
null
null
null
null
null
github_plus_top10pct_by_avg
lif user_link_info.provider == 'Weibo' %} <i class="fa fa-weibo" title="Weibo 绑定用户"></i> {% else %} <i class="fa fa-envelope-o" title="邮箱认证用户"></i> {% endif %} {% endif %} {% if comment.author.is_superuser %} <small class="text-danger">[博主]</small> {% elif comment.author == article.author %} <small class="text-info">[作者]</small> {% endif %} </p> <p class="small text-muted">{{ forloop.revcounter }}&nbsp;楼&nbsp;-&nbsp;{{ comment.create_date|naturaltime }}</p> </div> </li> <div class="comment-body">{{ comment.content_to_markdown|safe }}</div> </div> {% get_child_comments comment as child_comments %} {% if child_comments %} <ul class="list-unstyled ml-4"> {% for each in child_comments %} <div class="comment-child pt-2" id="com-{{ each.id }}"> <li class="media"> {% get_user_avatar_tag each.author %} <div class="media-body ml-2"> <a class="float-right small mr-2 rep-btn" href="#editor-block" data-repid="{{ each.id }}" data-repuser="{{ each.author.username }}">回复</a> <p class="mt-0 mb-1"> {% get_user_link each.author as each_user_link_info %} {% if each_user_link_info.is_verified and each_user_link_info.link %} <strong > <a href="{{ each_user_link_info.link }}" title="前往 {{ each.author }} 的个人网站" target="_blank">{{ each.author }} </a>
null
null
null
null
null
null
github_plus_top10pct_by_avg
</strong> {% else %} <strong title="该用户未认证或没有个人站点">{{ each.author }}</strong> {% endif %} {% if each_user_link_info.is_verified %} {% if each_user_link_info.provider == 'GitHub' %} <i class="fa fa-github" title="Github 绑定用户"></i> {% elif each_user_link_info.provider == 'Weibo' %} <i class="fa fa-weibo" title="Weibo 绑定用户"></i> {% else %} <i class="fa fa-envelope-o" title="邮箱认证用户"></i> {% endif %} {% endif %} {% if each.author.is_superuser %} <small class="text-danger">[博主]</small> {% endif %} <i class="fa fa-share"></i> @{{ each.rep_to.author.username }} </p> <p class="small text-muted">{{ each.create_date|naturaltime }}</p> </div> </li> <div class="comment-body">{{ each.content_to_markdown|safe }}</div> </div> {% endfor %} </ul> {% endif %} {% empty %} 暂时没有评论,欢迎来尬聊! {% endfor %} </ul> </div> PREP(accessAllowed); PREP(addDisplayPassthroughKeys); PREP(getUnitsBIChannel); PREP(handlePttKeyPress); PREP(handlePttKeyPressUp); PREP(modifyGroup); PREP(nameGroup); PREP(sendText); /******************************************************************************* * Copyright (c) 2004 Actuate Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies t
null
null
null
null
null
null
github_plus_top10pct_by_avg
his distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Actuate Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.birt.report.designer.internal.ui.editors.schematic.tools; import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.AbstractCellEditPart; import org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.ListBandEditPart; import org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.MultipleEditPart; import org.eclipse.draw2d.ColorConstants; import org.eclipse.draw2d.Figure; import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gef.DragTracker; import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPartViewer; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gef.GraphicalViewer; import org.eclipse.gef.KeyHandler; import org.eclipse.gef.Request; import org.eclipse.gef.RequestConstants; import org.eclipse.gef.SharedCursors; import org.eclipse.gef.tools.AbstractTool; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.widgets.Display; /** * <p> * root dragtracker * </p> * * @author Dazhen Gao */ public class RootDragTracker extends AbstractTool implements DragTracker { protected void handleFinished( ) { } static final int TOGGLE_MODE = 1; static final int APPEND_MODE = 2; private int mode; private Figure marqueeRectangleFigure; private List allChildren = new ArrayList( ); private List selectedEditParts; private Request targetRequest; private static final Request MARQUEE_REQUEST = new Request( RequestConstants.REQ_SELECTION ); /** * Creates a new MarqueeSelectionTool. */ public RootDragTracker( ) { setDefaultCursor( SharedCu
null
null
null
null
null
null
github_plus_top10pct_by_avg
rsors.CROSS ); setUnloadWhenFinished( false ); } private List calculateNewSelection( ) { List newSelections = new ArrayList( ); List children = getAllChildren( ); // Calculate new selections based on which children fall // inside the marquee selection rectangle. Do not select // children who are not visible for ( int i = 0; i < children.size( ); i++ ) { EditPart child = (EditPart) children.get( i ); if ( !child.isSelectable( ) || isInTable( child ) ) continue; IFigure figure = ( (GraphicalEditPart) child ).getFigure( ); Rectangle r = figure.getBounds( ).getCopy( ); figure.translateToAbsolute( r ); if ( getMarqueeSelectionRectangle( ).contains( r.getTopLeft( ) ) && getMarqueeSelectionRectangle( ).contains( r.getBottomRight( ) ) && figure.isShowing( ) && child.getTargetEditPart( MARQUEE_REQUEST ) == child && isFigureVisible( figure ) ) newSelections.add( child ); } return newSelections; } /** * Judges the editpart if in table * * @param child * @return */ private boolean isInTable( EditPart child ) { if ( child instanceof AbstractCellEditPart || child instanceof ListBandEditPart) { return true; } EditPart part = child.getParent( ); if (part instanceof MultipleEditPart) { return true; } while ( part != null ) { if ( part instanceof AbstractCellEditPart ) { return true; } part = part.getParent( ); } return false; } private Request createTargetRequest( ) { return MARQUEE_REQUEST; } /** * Erases feedback if necessary and puts the tool into the terminal state. */ public void deactivate( ) { if ( isInState( STATE_DRAG_IN_PROGRESS ) ) { eraseMarqueeFeedback( ); eraseTargetFeedback( ); } super.deactivate( ); allChildren = new ArrayList( ); setState( STATE_TERMINAL ); } private void eraseMarqueeFeedback( ) { if ( marqueeRectangleFigure != null ) { removeFeedback( marqueeRectangleFigure ); marqueeRectangleFigure = null; } } private void er
null
null
null
null
null
null
github_plus_top10pct_by_avg
aseTargetFeedback( ) { if ( selectedEditParts == null ) return; ListIterator oldEditParts = selectedEditParts.listIterator( ); while ( oldEditParts.hasNext( ) ) { EditPart editPart = (EditPart) oldEditParts.next( ); editPart.eraseTargetFeedback( getTargetRequest( ) ); } } /** * Returns a list including all of the children of the edit part passed in. */ private List getAllChildren( EditPart editPart, List allChildren ) { List children = editPart.getChildren( ); for ( int i = 0; i < children.size( ); i++ ) { GraphicalEditPart child = (GraphicalEditPart) children.get( i ); allChildren.add( child ); getAllChildren( child, allChildren ); } return allChildren; } /** * Return a vector including all of the children of the root editpart */ private List getAllChildren( ) { if ( allChildren.isEmpty( ) ) allChildren = getAllChildren( getCurrentViewer( ).getRootEditPart( ), new ArrayList( ) ); return allChildren; } /** * @see org.eclipse.gef.tools.AbstractTool#getCommandName() */ protected String getCommandName( ) { return REQ_SELECTION; } /** * @see org.eclipse.gef.tools.AbstractTool#getDebugName() */ protected String getDebugName( ) { return "Marquee Tool";//$NON-NLS-1$ } private IFigure getMarqueeFeedbackFigure( ) { if ( marqueeRectangleFigure == null ) { marqueeRectangleFigure = new MarqueeRectangleFigure( ); addFeedback( marqueeRectangleFigure ); } return marqueeRectangleFigure; } private Rectangle getMarqueeSelectionRectangle( ) { return new Rectangle( getStartLocation( ), getLocation( ) ); } private int getSelectionMode( ) { return mode; } private Request getTargetRequest( ) { if ( targetRequest == null ) targetRequest = createTargetRequest( ); return targetRequest; } /** * @see org.eclipse.gef.tools.AbstractTool#handleButtonDown(int) */ protected boolean handleButtonDown( int button ) { if ( !isGraphicalViewer( ) ) return true; if ( button != 1 ) { setState( STATE_IN
null
null
null
null
null
null
github_plus_top10pct_by_avg
VALID ); handleInvalidInput( ); } if ( stateTransition( STATE_INITIAL, STATE_DRAG_IN_PROGRESS ) ) { if ( getCurrentInput( ).isControlKeyDown( ) ) setSelectionMode( TOGGLE_MODE ); else if ( getCurrentInput( ).isShiftKeyDown( ) ) setSelectionMode( APPEND_MODE ); } return true; } /** * @see org.eclipse.gef.tools.AbstractTool#handleButtonUp(int) */ protected boolean handleButtonUp( int button ) { if ( stateTransition( STATE_DRAG_IN_PROGRESS, STATE_TERMINAL ) ) { eraseTargetFeedback( ); eraseMarqueeFeedback( ); performMarqueeSelect( ); } handleFinished( ); return true; } /** * @see org.eclipse.gef.tools.AbstractTool#handleDragInProgress() */ protected boolean handleDragInProgress( ) { if ( isInState( STATE_DRAG | STATE_DRAG_IN_PROGRESS ) ) { showMarqueeFeedback( ); eraseTargetFeedback( ); selectedEditParts = calculateNewSelection( ); showTargetFeedback( ); } return true; } /** * @see org.eclipse.gef.tools.AbstractTool#handleFocusLost() */ protected boolean handleFocusLost( ) { if ( isInState( STATE_DRAG | STATE_DRAG_IN_PROGRESS ) ) { handleFinished( ); return true; } return false; } /** * This method is called when mouse or keyboard input is invalid and erases * the feedback. * * @return <code>true</code> */ protected boolean handleInvalidInput( ) { eraseTargetFeedback( ); eraseMarqueeFeedback( ); return true; } /** * Handles high-level processing of a key down event. KeyEvents are * forwarded to the current viewer's {@link KeyHandler}, via * {@link KeyHandler#keyPressed(KeyEvent)}. * * @see AbstractTool#handleKeyDown(KeyEvent) */ protected boolean handleKeyDown( KeyEvent e ) { if ( super.handleKeyDown( e ) ) return true; if ( getCurrentViewer( ).getKeyHandler( ) != null && getCurrentViewer( ).getKeyHandler( ).keyPressed( e ) ) return true; return false; } private boolean isFigureVisible( IFigure fig ) { Rectangle figBounds = fig.getBounds( ).getCopy(
null
null
null
null
null
null
github_plus_top10pct_by_avg
); IFigure walker = fig.getParent( ); while ( !figBounds.isEmpty( ) && walker != null ) { walker.translateToParent( figBounds ); figBounds.intersect( walker.getBounds( ) ); walker = walker.getParent( ); } return !figBounds.isEmpty( ); } private boolean isGraphicalViewer( ) { return getCurrentViewer( ) instanceof GraphicalViewer; } private void performMarqueeSelect( ) { EditPartViewer viewer = getCurrentViewer( ); List newSelections = calculateNewSelection( ); // If in multi select mode, add the new selections to the already // selected group; otherwise, clear the selection and select the new // group if ( getSelectionMode( ) == APPEND_MODE ) { for ( int i = 0; i < newSelections.size( ); i++ ) { EditPart editPart = (EditPart) newSelections.get( i ); viewer.appendSelection( editPart ); } } else if ( getSelectionMode( ) == TOGGLE_MODE ) { List selected = new ArrayList( viewer.getSelectedEditParts( ) ); for ( int i = 0; i < newSelections.size( ); i++ ) { EditPart editPart = (EditPart) newSelections.get( i ); if ( editPart.getSelected( ) != EditPart.SELECTED_NONE ) selected.remove( editPart ); else selected.add( editPart ); } viewer.setSelection( new StructuredSelection( selected ) ); } else { viewer.setSelection( new StructuredSelection( newSelections ) ); } } /** * @see org.eclipse.gef.Tool#setViewer(org.eclipse.gef.EditPartViewer) */ public void setViewer( EditPartViewer viewer ) { if ( viewer == getCurrentViewer( ) ) return; super.setViewer( viewer ); if ( viewer instanceof GraphicalViewer ) setDefaultCursor( SharedCursors.CROSS ); else setDefaultCursor( SharedCursors.NO ); } private void setSelectionMode( int mode ) { this.mode = mode; } private void showMarqueeFeedback( ) { Rectangle rect = getMarqueeSelectionRectangle( ).getCopy( ); getMarqueeFeedbackFigure( ).translateToRelative( rect ); getMarqueeFeedbackFigure( ).setBounds( rect ); } private void sho
null
null
null
null
null
null
github_plus_top10pct_by_avg
wTargetFeedback( ) { for ( int i = 0; i < selectedEditParts.size( ); i++ ) { EditPart editPart = (EditPart) selectedEditParts.get( i ); editPart.showTargetFeedback( getTargetRequest( ) ); } } private static class MarqueeRectangleFigure extends Figure { private int offset = 0; private boolean schedulePaint = true; private static final int DELAY = 110; //animation delay in millisecond /** * @see org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics) */ protected void paintFigure( Graphics graphics ) { Rectangle bounds = getBounds( ).getCopy( ); graphics.translate( getLocation( ) ); graphics.setXORMode( true ); graphics.setForegroundColor( ColorConstants.white ); graphics.setBackgroundColor( ColorConstants.black ); graphics.setLineStyle( Graphics.LINE_DOT ); int[] points = new int[6]; points[0] = 0 + offset; points[1] = 0; points[2] = bounds.width - 1; points[3] = 0; points[4] = bounds.width - 1; points[5] = bounds.height - 1; graphics.drawPolyline( points ); points[0] = 0; points[1] = 0 + offset; points[2] = 0; points[3] = bounds.height - 1; points[4] = bounds.width - 1; points[5] = bounds.height - 1; graphics.drawPolyline( points ); graphics.translate( getLocation( ).getNegated( ) ); if ( schedulePaint ) { Display.getCurrent( ).timerExec( DELAY, new Runnable( ) { public void run( ) { offset++; if ( offset > 5 ) offset = 0; schedulePaint = true; repaint( ); } } ); } schedulePaint = false; } } } -- wherelimit.test -- -- execsql {SELECT count(*) FROM t1} SELECT count(*) FROM t1 // // QLPreviewPanel+iTerm.m // iTerm2 // // Created by Rony Fadel on 2/20/16. // // #import "QLPreviewPanel+iTerm.h" @implementation QLPreviewPanel (iTerm) + (instancetype)sharedPreviewPanelIfExists { if ([QLPreviewPanel sharedPreviewPanelExists]) { return [QLPreviewPanel sharedPreviewPanel]; } else { return nil;
null
null
null
null
null
null
github_plus_top10pct_by_avg
} } @end /* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef GUI_WIDGETS_POPUP_H #define GUI_WIDGETS_POPUP_H #include "gui/dialog.h" #include "gui/widget.h" #include "common/str.h" #include "common/array.h" namespace GUI { enum { kPopUpItemSelectedCmd = 'POPs' }; /** * Popup or dropdown widget which, when clicked, "pop up" a list of items and * lets the user pick on of them. * * Implementation wise, when the user selects an item, then a kPopUpItemSelectedCmd * is broadcast, with data being equal to the tag value of the selected entry. */ class PopUpWidget : public Widget, public CommandSender { typedef Common::String String; typedef Common::U32String U32String; struct Entry { U32String name; uint32 tag; }; typedef Common::Array<Entry> EntryList; protected: EntryList _entries; int _selectedItem; int _leftPadding; int _rightPadding; public: PopUpWidget(GuiObject *boss, const String &name, const U32String &tooltip = U32String("")); PopUpWidget(GuiObject *boss, int x, int y, int w, int h, const U32String &tooltip = U32String("")); void handleMouseDown(int x, int y, int button, int
null
null
null
null
null
null
github_plus_top10pct_by_avg
clickCount) override; void handleMouseWheel(int x, int y, int direction) override; void appendEntry(const U32String &entry, uint32 tag = (uint32)-1); void appendEntry(const String &entry, uint32 tag = (uint32)-1); void clearEntries(); int numEntries() { return _entries.size(); } /** Select the entry at the given index. */ void setSelected(int item); /** Select the first entry matching the given tag. */ void setSelectedTag(uint32 tag); int getSelected() const { return _selectedItem; } uint32 getSelectedTag() const { return (_selectedItem >= 0) ? _entries[_selectedItem].tag : (uint32)-1; } // const String& getSelectedString() const { return (_selectedItem >= 0) ? _entries[_selectedItem].name : String::emptyString; } void handleMouseEntered(int button) override { if (_selectedItem != -1) read(_entries[_selectedItem].name); setFlags(WIDGET_HILITED); markAsDirty(); } void handleMouseLeft(int button) override { clearFlags(WIDGET_HILITED); markAsDirty(); } void reflowLayout() override; protected: void drawWidget() override; }; /** * A small dialog showing a list of items and allowing the user to chose one of them * * Used by PopUpWidget and DropdownButtonWidget. */ class PopUpDialog : public Dialog { protected: Widget *_boss; int _clickX, _clickY; int _selection; int _initialSelection; uint32 _openTime; bool _twoColumns; int _entriesPerColumn; int _leftPadding; int _rightPadding; int _lineHeight; int _lastRead; typedef Common::Array<Common::U32String> EntryList; EntryList _entries; public: PopUpDialog(Widget *boss, const Common::String &name, int clickX, int clickY); void open() override; void reflowLayout() override; void drawDialog(DrawLayer layerToDraw) override; void handleMouseUp(int x, int y, int button, int clickCount) override; void handleMouseWheel(int x, int y, int direction) override; // Scroll through entries with scroll wheel void handleMouseMoved(int x, int y, int button) override; // Redraw selections depending on mouse posit
null
null
null
null
null
null
github_plus_top10pct_by_avg
ion void handleMouseLeft(int button) override; void handleKeyDown(Common::KeyState state) override; // Scroll through entries with arrow keys etc. void setPosition(int x, int y); void setPadding(int left, int right); void setLineHeight(int lineHeight); void setWidth(uint16 width); void appendEntry(const Common::U32String &entry); void clearEntries(); void setSelection(int item); protected: void drawMenuEntry(int entry, bool hilite); int findItem(int x, int y) const; bool isMouseDown(); void moveUp(); void moveDown(); void read(const Common::U32String &str); }; } // End of namespace GUI #endif import { Guid } from '../../common/guid'; import { HistoryPage } from '../pages/history-page'; import { RotkiApp } from '../pages/rotki-app'; import { OTCTrade } from '../support/types'; describe('history', () => { let username: string; let app: RotkiApp; let page: HistoryPage; let otcData: OTCTrade[]; before(() => { username = Guid.newGuid().toString(); app = new RotkiApp(); page = new HistoryPage(); app.visit(); app.createAccount(username); cy.fixture('otc').then(otc => { otcData = otc; }); }); after(() => { app.logout(); }); it('add two external trades', () => { page.visit(); page.addTrade(otcData[0]); page.addTrade(otcData[1]); }); it('displays two trades', () => { page.visibleEntries(2); page.tradeIsVisible(0, otcData[0]); page.tradeIsVisible(1, otcData[1]); }); it('edit external trade', () => { page.editTrade(0, '123.2'); page.tradeIsVisible(0, { ...otcData[0], amount: '123.2' }); }); it('delete external trade', () => { page.deleteTrade(0); page.confirmDelete(); page.visibleEntries(1); page.tradeIsVisible(0, otcData[1]); }); }); <Window x:Class="SDKSample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="PopupCustomPlacement" > <Grid> <Grid.
null
null
null
null
null
null
github_plus_top10pct_by_avg