text
stringlengths
2
97.5k
meta
dict
// Protocol Buffers for Go with Gadgets // // Copyright (c) 2013, The GoGo Authors. All rights reserved. // http://github.com/gogo/protobuf // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package proto import ( "bytes" "errors" "fmt" "io" "reflect" "sort" "strings" "sync" ) type extensionsBytes interface { Message ExtensionRangeArray() []ExtensionRange GetExtensions() *[]byte } type slowExtensionAdapter struct { extensionsBytes } func (s slowExtensionAdapter) extensionsWrite() map[int32]Extension { panic("Please report a bug to github.com/gogo/protobuf if you see this message: Writing extensions is not supported for extensions stored in a byte slice field.") } func (s slowExtensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { b := s.GetExtensions() m, err := BytesToExtensionsMap(*b) if err != nil { panic(err) } return m, notLocker{} } func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool { if reflect.ValueOf(pb).IsNil() { return ifnotset } value, err := GetExtension(pb, extension) if err != nil { return ifnotset } if value == nil { return ifnotset } if value.(*bool) == nil { return ifnotset } return *(value.(*bool)) } func (this *Extension) Equal(that *Extension) bool { if err := this.Encode(); err != nil { return false } if err := that.Encode(); err != nil { return false } return bytes.Equal(this.enc, that.enc) } func (this *Extension) Compare(that *Extension) int { if err := this.Encode(); err != nil { return 1 } if err := that.Encode(); err != nil { return -1 } return bytes.Compare(this.enc, that.enc) } func SizeOfInternalExtension(m extendableProto) (n int) { info := getMarshalInfo(reflect.TypeOf(m)) return info.sizeV1Extensions(m.extensionsWrite()) } type sortableMapElem struct { field int32 ext Extension } func newSortableExtensionsFromMap(m map[int32]Extension) sortableExtensions { s := make(sortableExtensions, 0, len(m)) for k, v := range m { s = append(s, &sortableMapElem{field: k, ext: v}) } return s } type sortableExtensions []*sortableMapElem func (this sortableExtensions) Len() int { return len(this) } func (this sortableExtensions) Swap(i, j int) { this[i], this[j] = this[j], this[i] } func (this sortableExtensions) Less(i, j int) bool { return this[i].field < this[j].field } func (this sortableExtensions) String() string { sort.Sort(this) ss := make([]string, len(this)) for i := range this { ss[i] = fmt.Sprintf("%d: %v", this[i].field, this[i].ext) } return "map[" + strings.Join(ss, ",") + "]" } func StringFromInternalExtension(m extendableProto) string { return StringFromExtensionsMap(m.extensionsWrite()) } func StringFromExtensionsMap(m map[int32]Extension) string { return newSortableExtensionsFromMap(m).String() } func StringFromExtensionsBytes(ext []byte) string { m, err := BytesToExtensionsMap(ext) if err != nil { panic(err) } return StringFromExtensionsMap(m) } func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) { return EncodeExtensionMap(m.extensionsWrite(), data) } func EncodeInternalExtensionBackwards(m extendableProto, data []byte) (n int, err error) { return EncodeExtensionMapBackwards(m.extensionsWrite(), data) } func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { o := 0 for _, e := range m { if err := e.Encode(); err != nil { return 0, err } n := copy(data[o:], e.enc) if n != len(e.enc) { return 0, io.ErrShortBuffer } o += n } return o, nil } func EncodeExtensionMapBackwards(m map[int32]Extension, data []byte) (n int, err error) { o := 0 end := len(data) for _, e := range m { if err := e.Encode(); err != nil { return 0, err } n := copy(data[end-len(e.enc):], e.enc) if n != len(e.enc) { return 0, io.ErrShortBuffer } end -= n o += n } return o, nil } func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { e := m[id] if err := e.Encode(); err != nil { return nil, err } return e.enc, nil } func size(buf []byte, wire int) (int, error) { switch wire { case WireVarint: _, n := DecodeVarint(buf) return n, nil case WireFixed64: return 8, nil case WireBytes: v, n := DecodeVarint(buf) return int(v) + n, nil case WireFixed32: return 4, nil case WireStartGroup: offset := 0 for { u, n := DecodeVarint(buf[offset:]) fwire := int(u & 0x7) offset += n if fwire == WireEndGroup { return offset, nil } s, err := size(buf[offset:], wire) if err != nil { return 0, err } offset += s } } return 0, fmt.Errorf("proto: can't get size for unknown wire type %d", wire) } func BytesToExtensionsMap(buf []byte) (map[int32]Extension, error) { m := make(map[int32]Extension) i := 0 for i < len(buf) { tag, n := DecodeVarint(buf[i:]) if n <= 0 { return nil, fmt.Errorf("unable to decode varint") } fieldNum := int32(tag >> 3) wireType := int(tag & 0x7) l, err := size(buf[i+n:], wireType) if err != nil { return nil, err } end := i + int(l) + n m[int32(fieldNum)] = Extension{enc: buf[i:end]} i = end } return m, nil } func NewExtension(e []byte) Extension { ee := Extension{enc: make([]byte, len(e))} copy(ee.enc, e) return ee } func AppendExtension(e Message, tag int32, buf []byte) { if ee, eok := e.(extensionsBytes); eok { ext := ee.GetExtensions() *ext = append(*ext, buf...) return } if ee, eok := e.(extendableProto); eok { m := ee.extensionsWrite() ext := m[int32(tag)] // may be missing ext.enc = append(ext.enc, buf...) m[int32(tag)] = ext } } func encodeExtension(extension *ExtensionDesc, value interface{}) ([]byte, error) { u := getMarshalInfo(reflect.TypeOf(extension.ExtendedType)) ei := u.getExtElemInfo(extension) v := value p := toAddrPointer(&v, ei.isptr) siz := ei.sizer(p, SizeVarint(ei.wiretag)) buf := make([]byte, 0, siz) return ei.marshaler(buf, p, ei.wiretag, false) } func decodeExtensionFromBytes(extension *ExtensionDesc, buf []byte) (interface{}, error) { o := 0 for o < len(buf) { tag, n := DecodeVarint((buf)[o:]) fieldNum := int32(tag >> 3) wireType := int(tag & 0x7) if o+n > len(buf) { return nil, fmt.Errorf("unable to decode extension") } l, err := size((buf)[o+n:], wireType) if err != nil { return nil, err } if int32(fieldNum) == extension.Field { if o+n+l > len(buf) { return nil, fmt.Errorf("unable to decode extension") } v, err := decodeExtension((buf)[o:o+n+l], extension) if err != nil { return nil, err } return v, nil } o += n + l } return defaultExtensionValue(extension) } func (this *Extension) Encode() error { if this.enc == nil { var err error this.enc, err = encodeExtension(this.desc, this.value) if err != nil { return err } } return nil } func (this Extension) GoString() string { if err := this.Encode(); err != nil { return fmt.Sprintf("error encoding extension: %v", err) } return fmt.Sprintf("proto.NewExtension(%#v)", this.enc) } func SetUnsafeExtension(pb Message, fieldNum int32, value interface{}) error { typ := reflect.TypeOf(pb).Elem() ext, ok := extensionMaps[typ] if !ok { return fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) } desc, ok := ext[fieldNum] if !ok { return errors.New("proto: bad extension number; not in declared ranges") } return SetExtension(pb, desc, value) } func GetUnsafeExtension(pb Message, fieldNum int32) (interface{}, error) { typ := reflect.TypeOf(pb).Elem() ext, ok := extensionMaps[typ] if !ok { return nil, fmt.Errorf("proto: bad extended type; %s is not extendable", typ.String()) } desc, ok := ext[fieldNum] if !ok { return nil, fmt.Errorf("unregistered field number %d", fieldNum) } return GetExtension(pb, desc) } func NewUnsafeXXX_InternalExtensions(m map[int32]Extension) XXX_InternalExtensions { x := &XXX_InternalExtensions{ p: new(struct { mu sync.Mutex extensionMap map[int32]Extension }), } x.p.extensionMap = m return *x } func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension { pb := extendable.(extendableProto) return pb.extensionsWrite() } func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { ext := pb.GetExtensions() for offset < len(*ext) { tag, n1 := DecodeVarint((*ext)[offset:]) fieldNum := int32(tag >> 3) wireType := int(tag & 0x7) n2, err := size((*ext)[offset+n1:], wireType) if err != nil { panic(err) } newOffset := offset + n1 + n2 if fieldNum == theFieldNum { *ext = append((*ext)[:offset], (*ext)[newOffset:]...) return offset } offset = newOffset } return -1 }
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: MIT // +build !js // +build !windows package gl import ( "fmt" "reflect" "strings" "unsafe" ) // #include <stdlib.h> import "C" // Ptr takes a slice or pointer (to a singular scalar value or the first // element of an array or slice) and returns its GL-compatible address. // // For example: // // var data []uint8 // ... // gl.TexImage2D(gl.TEXTURE_2D, ..., gl.UNSIGNED_BYTE, gl.Ptr(&data[0])) func Ptr(data interface{}) unsafe.Pointer { if data == nil { return unsafe.Pointer(nil) } var addr unsafe.Pointer switch v := data.(type) { case *uint8: addr = unsafe.Pointer(v) case *uint16: addr = unsafe.Pointer(v) case *float32: addr = unsafe.Pointer(v) case []uint8: addr = unsafe.Pointer(&v[0]) case []uint16: addr = unsafe.Pointer(&v[0]) case []float32: addr = unsafe.Pointer(&v[0]) default: panic(fmt.Errorf("unsupported type %T; must be a slice or pointer to a singular scalar value or the first element of an array or slice", v)) } return addr } // Str takes a null-terminated Go string and returns its GL-compatible address. // This function reaches into Go string storage in an unsafe way so the caller // must ensure the string is not garbage collected. func Str(str string) *uint8 { if !strings.HasSuffix(str, "\x00") { panic("str argument missing null terminator: " + str) } header := (*reflect.StringHeader)(unsafe.Pointer(&str)) return (*uint8)(unsafe.Pointer(header.Data)) } // GoStr takes a null-terminated string returned by OpenGL and constructs a // corresponding Go string. func GoStr(cstr *uint8) string { return C.GoString((*C.char)(unsafe.Pointer(cstr))) } // Strs takes a list of Go strings (with or without null-termination) and // returns their C counterpart. // // The returned free function must be called once you are done using the strings // in order to free the memory. // // If no strings are provided as a parameter this function will panic. func Strs(strs ...string) (cstrs **uint8, free func()) { if len(strs) == 0 { panic("Strs: expected at least 1 string") } // Allocate a contiguous array large enough to hold all the strings' contents. n := 0 for i := range strs { n += len(strs[i]) } data := C.malloc(C.size_t(n)) // Copy all the strings into data. dataSlice := *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ Data: uintptr(data), Len: n, Cap: n, })) css := make([]*uint8, len(strs)) // Populated with pointers to each string. offset := 0 for i := range strs { copy(dataSlice[offset:offset+len(strs[i])], strs[i][:]) // Copy strs[i] into proper data location. css[i] = (*uint8)(unsafe.Pointer(&dataSlice[offset])) // Set a pointer to it. offset += len(strs[i]) } return (**uint8)(&css[0]), func() { C.free(data) } }
{ "pile_set_name": "Github" }
/** * @file xmc_ledts.c * @date 2017-02-25 * * @cond ********************************************************************************************************************* * XMClib v2.1.20 - XMC Peripheral Driver Library * * Copyright (c) 2015-2018, Infineon Technologies AG * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the * following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following * disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided with the distribution. * * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote * products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with * Infineon Technologies AG dave@infineon.com). ********************************************************************************************************************* * * Change History * -------------- * * 2015-02-20: * - Initial draft <br> * - New API added: XMC_LEDTS_SetActivePADNo() <br> * * 2015-06-20: * - Removed version macros and declaration of GetDriverVersion API * * 2017-02-25: * - XMC_LEDTS_InitGlobal() fixed compilation warnings * * <b>Detailed description of file:</b><br> * APIs for the functional blocks of LEDTS have been defined:<br> * -- GLOBAL (APIs prefixed with LEDTS_GLOBAL_) <br> * -- Clock configuration, Function/Event configuration, Interrupt configuration * * @endcond * */ /********************************************************************************************************************* * HEADER FILES ********************************************************************************************************************/ #include <xmc_ledts.h> #if defined(LEDTS0) #include "xmc_scu.h" /********************************************************************************************************************* * MACROS ********************************************************************************************************************/ #define XMC_LEDTS_CLOCK_NOT_RUNNING 0U /********************************************************************************************************************* * ENUMS ********************************************************************************************************************/ /********************************************************************************************************************* * DATA STRUCTURES ********************************************************************************************************************/ /********************************************************************************************************************* * GLOBAL DATA ********************************************************************************************************************/ /********************************************************************************************************************* * LOCAL/UTILITY ROUTINES ********************************************************************************************************************/ /********************************************************************************************************************* * API IMPLEMENTATION ********************************************************************************************************************/ /** * Initialization of global register */ XMC_LEDTS_STATUS_t XMC_LEDTS_InitGlobal(XMC_LEDTS_t *const ledts, const XMC_LEDTS_GLOBAL_CONFIG_t *config) { XMC_ASSERT("XMC_LEDTS_InitGlobal:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); XMC_ASSERT("XMC_LEDTS_InitGlobal:Null Pointer", (config != (XMC_LEDTS_GLOBAL_CONFIG_t *)NULL)); if (ledts == XMC_LEDTS0) { #if defined(CLOCK_GATING_SUPPORTED) XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_LEDTS0); #endif #if defined(PERIPHERAL_RESET_SUPPORTED) XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_LEDTS0); #endif } #if defined(LEDTS1) else if (ledts == XMC_LEDTS1) { #if defined(CLOCK_GATING_SUPPORTED) XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_LEDTS1); #endif #if defined(PERIPHERAL_RESET_SUPPORTED) XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_LEDTS1); #endif } #endif #if defined(LEDTS2) else if (ledts == XMC_LEDTS2) { #if defined(CLOCK_GATING_SUPPORTED) XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_LEDTS2); #endif #if defined(PERIPHERAL_RESET_SUPPORTED) XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_LEDTS2); #endif } #endif else { XMC_ASSERT("XMC_LEDTS_InitGlobal:Invalid Module Pointer", 0); } if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) { return XMC_LEDTS_STATUS_RUNNING; } ledts->GLOBCTL = config->globctl; return XMC_LEDTS_STATUS_SUCCESS; } /** * Initialization of registers for LED-driving function */ XMC_LEDTS_STATUS_t XMC_LEDTS_InitLED(XMC_LEDTS_t *const ledts, const XMC_LEDTS_LED_CONFIG_t *config) { XMC_ASSERT("XMC_LEDTS_LED_Init:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); XMC_ASSERT("XMC_LEDTS_LED_Init:Null Pointer", (config != (XMC_LEDTS_LED_CONFIG_t *)NULL)); if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) { return XMC_LEDTS_STATUS_RUNNING; } ledts->FNCTL &= ~(LEDTS_FNCTL_COLLEV_Msk | LEDTS_FNCTL_NR_LEDCOL_Msk); ledts->FNCTL |= (config->fnctl); /* Enable LED function */ ledts->GLOBCTL |= LEDTS_GLOBCTL_LD_EN_Msk; return XMC_LEDTS_STATUS_SUCCESS; } /** * Initialization of registers for basic Touch-Sense control function */ XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSBasic(XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_BASIC_t *config) { uint32_t reg; XMC_ASSERT("XMC_LEDTS_TS_Basic_Init:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); XMC_ASSERT("XMC_LEDTS_TS_Basic_Init:Null Pointer", (config != (XMC_LEDTS_TS_CONFIG_BASIC_t *)NULL)); if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) { return XMC_LEDTS_STATUS_RUNNING; } reg = ~(LEDTS_FNCTL_ACCCNT_Msk | LEDTS_FNCTL_TSCCMP_Msk | LEDTS_FNCTL_TSCTRR_Msk | LEDTS_FNCTL_TSCTRSAT_Msk | LEDTS_FNCTL_NR_TSIN_Msk); ledts->FNCTL &= (reg); ledts->FNCTL |= (config->fnctl); /* Enable TS function */ ledts->GLOBCTL |= LEDTS_GLOBCTL_TS_EN_Msk; return XMC_LEDTS_STATUS_SUCCESS; } /** * Initialization of registers for advanced Touch-Sense control function */ XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSAdvanced (XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_ADVANCED_t *config) { uint32_t reg; XMC_ASSERT("XMC_LEDTS_TS_Advanced_Init:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); XMC_ASSERT("XMC_LEDTS_TS_Advanced_Init:Null Pointer", (config != (XMC_LEDTS_TS_CONFIG_ADVANCED_t *)NULL)); if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) { return XMC_LEDTS_STATUS_RUNNING; } reg = ~(LEDTS_GLOBCTL_MASKVAL_Msk | LEDTS_GLOBCTL_FENVAL_Msk); ledts->GLOBCTL &= (reg); ledts->GLOBCTL |= (config->globctl); reg = ~(LEDTS_FNCTL_PADT_Msk | LEDTS_FNCTL_PADTSW_Msk | LEDTS_FNCTL_EPULL_Msk | LEDTS_FNCTL_TSOEXT_Msk); ledts->FNCTL &= (reg); ledts->FNCTL |= (config->fnctl); return XMC_LEDTS_STATUS_SUCCESS; } /** * Starts LEDTS-counter */ void XMC_LEDTS_StartCounter(XMC_LEDTS_t *const ledts, const uint16_t prescaler) { XMC_ASSERT("XMC_LEDTS_Start_Counter:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); ledts->GLOBCTL |= prescaler<<16U; } /** * Stops LEDTS-counter */ void XMC_LEDTS_StopCounter(XMC_LEDTS_t *const ledts) { XMC_ASSERT("XMC_LEDTS_Stop_Counter:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); ledts->GLOBCTL &= 0x0000FFFF; } /** * Reads time interrupt flags */ uint32_t XMC_LEDTS_ReadInterruptFlag(XMC_LEDTS_t *const ledts) { XMC_ASSERT("XMC_LEDTS_ReadInterruptFlag:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); return (ledts->EVFR & 0xF); } /** * Set the active pad number */ void XMC_LEDTS_SetActivePADNo(XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t pad_num) { uint32_t reg; XMC_ASSERT("XMC_LEDTS_SetActivePADNo:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); reg = ledts->FNCTL; reg &= ~(LEDTS_FNCTL_PADT_Msk); reg |= (uint32_t)pad_num; ledts->FNCTL = reg; } /** * Clears interrupt indication flags */ void XMC_LEDTS_ClearInterruptFlag(XMC_LEDTS_t *const ledts, uint32_t interrupt_mask) { XMC_ASSERT("XMC_LEDTS_ClearInterruptFlag:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); ledts->EVFR = (interrupt_mask << LEDTS_EVFR_CTSF_Pos); } /** * Programming of registers to output pattern on an LED column in LED matrix */ void XMC_LEDTS_SetLEDLinePattern(XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t pattern) { uint32_t reg; uint8_t reg_index = ((uint8_t)column) >> 2; uint8_t bit_shift_count = ((uint8_t)column & 0x03) * 8; XMC_ASSERT("XMC_LEDTS_Set_LED_Line_Pattern:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); reg = ledts->LINE[reg_index]; reg &= (~(0xff << bit_shift_count)); reg |= pattern << bit_shift_count; ledts->LINE[reg_index] = reg; } /** * Programming of registers to adjust brightness of an LED column in LED matrix */ void XMC_LEDTS_SetColumnBrightness(XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t brightness) { uint32_t reg; uint8_t reg_index = ((uint8_t)column) >> 2; uint8_t bit_shift_count = ((uint8_t)column & 0x03) * 8; XMC_ASSERT("XMC_LEDTS_Set_Column_Brightness:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); reg = ledts->LDCMP[reg_index]; reg &= (~(0xff << bit_shift_count)); reg |= brightness << bit_shift_count; ledts->LDCMP[reg_index] = reg; } /** * Programming of registers to set common oscillation window size for touch-sense inputs */ void XMC_LEDTS_SetCommonOscillationWindow(XMC_LEDTS_t *const ledts, const uint8_t common_size) { uint32_t reg; XMC_ASSERT("XMC_LEDTS_Set_Common_Oscillation_Window:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); reg = ledts->LDCMP[1]; reg &= ~LEDTS_LDCMP1_CMP_LDA_TSCOM_Msk; reg |= (common_size << LEDTS_LDCMP1_CMP_LDA_TSCOM_Pos); ledts->LDCMP[1] = reg; } /** * Checking the previous active function or LED column status */ uint32_t XMC_LEDTS_ReadFNCOL(XMC_LEDTS_t *const ledts) { uint32_t fncol_read; XMC_ASSERT("XMC_LEDTS_Read_FNCOL:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); fncol_read = ledts->FNCTL & LEDTS_FNCTL_FNCOL_Msk; fncol_read >>= LEDTS_FNCTL_FNCOL_Pos; return fncol_read; } /** * Set the number of LED column Enabled */ void XMC_LEDTS_SetNumOfLEDColumns(XMC_LEDTS_t *const ledts, uint8_t count) { XMC_ASSERT("XMC_LEDTS_SetNumOfLEDColumns:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); ledts->FNCTL &= ~(LEDTS_FNCTL_NR_LEDCOL_Msk); ledts->FNCTL |= (count << LEDTS_FNCTL_NR_LEDCOL_Pos); } /** * Reading recorded number of oscillation counts */ uint16_t XMC_LEDTS_ReadTSVAL(XMC_LEDTS_t *const ledts) { uint16_t no_of_oscillations; XMC_ASSERT("XMC_LEDTS_Read_TSVAL:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); no_of_oscillations = (ledts->TSVAL & 0xFFFF); return no_of_oscillations; } /** * Programming of registers to adjust the size of oscillation window */ void XMC_LEDTS_SetOscillationWindow(XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t touchpad, const uint8_t size) { uint32_t reg; uint8_t reg_index = ((uint8_t)touchpad) >> 2; uint8_t bit_shift_count = ((uint8_t)touchpad & 0x03) * 8; XMC_ASSERT("XMC_LEDTS_Set_Oscillation_Window:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); reg = ledts->TSCMP[reg_index]; reg &= (~(0xff << bit_shift_count)); reg |= size << bit_shift_count; ledts->TSCMP[reg_index] = reg; } #endif /* LEDTS0 */
{ "pile_set_name": "Github" }
import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp from scipy.sparse.linalg.eigen.arpack import eigsh import sys from scipy.sparse.linalg import norm as sparsenorm from scipy.linalg import qr # from sklearn.metrics import f1_score def parse_index_file(filename): """Parse index file.""" index = [] for line in open(filename): index.append(int(line.strip())) return index def sample_mask(idx, l): """Create mask.""" mask = np.zeros(l) mask[idx] = 1 return np.array(mask, dtype=np.bool) # # def calc_f1(y_true, y_pred): # y_true = np.argmax(y_true, axis=1) # y_pred = np.argmax(y_pred, axis=1) # return f1_score(y_true, y_pred, average="micro"), f1_score(y_true, y_pred, average="macro") # # # def load_data(dataset_str): # """Load data.""" # names = ['x', 'y', 'tx', 'ty', 'allx', 'ally', 'graph'] # objects = [] # for i in range(len(names)): # with open("data/ind.{}.{}".format(dataset_str, names[i]), 'rb') as f: # if sys.version_info > (3, 0): # objects.append(pkl.load(f, encoding='latin1')) # else: # objects.append(pkl.load(f)) # # x, y, tx, ty, allx, ally, graph = tuple(objects) # test_idx_reorder = parse_index_file("data/ind.{}.test.index".format(dataset_str)) # test_idx_range = np.sort(test_idx_reorder) # # if dataset_str == 'citeseer': # # Fix citeseer dataset (there are some isolated nodes in the graph) # # Find isolated nodes, add them as zero-vecs into the right position # test_idx_range_full = range(min(test_idx_reorder), max(test_idx_reorder)+1) # tx_extended = sp.lil_matrix((len(test_idx_range_full), x.shape[1])) # tx_extended[test_idx_range-min(test_idx_range), :] = tx # tx = tx_extended # ty_extended = np.zeros((len(test_idx_range_full), y.shape[1])) # ty_extended[test_idx_range-min(test_idx_range), :] = ty # ty = ty_extended # # features = sp.vstack((allx, tx)).tolil() # features[test_idx_reorder, :] = features[test_idx_range, :] # adj = nx.adjacency_matrix(nx.from_dict_of_lists(graph)) # # labels = np.vstack((ally, ty)) # labels[test_idx_reorder, :] = labels[test_idx_range, :] # # idx_test = test_idx_range.tolist() # idx_train = range(len(y)) # idx_val = range(len(y), len(y)+500) # # train_mask = sample_mask(idx_train, labels.shape[0]) # val_mask = sample_mask(idx_val, labels.shape[0]) # test_mask = sample_mask(idx_test, labels.shape[0]) # # y_train = np.zeros(labels.shape) # y_val = np.zeros(labels.shape) # y_test = np.zeros(labels.shape) # y_train[train_mask, :] = labels[train_mask, :] # y_val[val_mask, :] = labels[val_mask, :] # y_test[test_mask, :] = labels[test_mask, :] # # return adj, features, y_train, y_val, y_test, train_mask, val_mask, test_mask # def load_data(dataset_str): """Load data.""" names = ['x', 'y', 'tx', 'ty', 'allx', 'ally', 'graph'] objects = [] for i in range(len(names)): with open("data/ind.{}.{}".format(dataset_str, names[i]), 'rb') as f: if sys.version_info > (3, 0): objects.append(pkl.load(f, encoding='latin1')) else: objects.append(pkl.load(f)) x, y, tx, ty, allx, ally, graph = tuple(objects) test_idx_reorder = parse_index_file("data/ind.{}.test.index".format(dataset_str)) test_idx_range = np.sort(test_idx_reorder) if dataset_str == 'citeseer': # Fix citeseer dataset (there are some isolated nodes in the graph) # Find isolated nodes, add them as zero-vecs into the right position test_idx_range_full = range(min(test_idx_reorder), max(test_idx_reorder)+1) tx_extended = sp.lil_matrix((len(test_idx_range_full), x.shape[1])) tx_extended[test_idx_range-min(test_idx_range), :] = tx tx = tx_extended ty_extended = np.zeros((len(test_idx_range_full), y.shape[1])) ty_extended[test_idx_range-min(test_idx_range), :] = ty ty = ty_extended features = sp.vstack((allx, tx)).tolil() features[test_idx_reorder, :] = features[test_idx_range, :] adj = nx.adjacency_matrix(nx.from_dict_of_lists(graph)) labels = np.vstack((ally, ty)) labels[test_idx_reorder, :] = labels[test_idx_range, :] idx_test = test_idx_range.tolist() idx_train = range(len(ally)-500) idx_val = range(len(ally)-500, len(ally)) train_mask = sample_mask(idx_train, labels.shape[0]) val_mask = sample_mask(idx_val, labels.shape[0]) test_mask = sample_mask(idx_test, labels.shape[0]) y_train = np.zeros(labels.shape) y_val = np.zeros(labels.shape) y_test = np.zeros(labels.shape) y_train[train_mask, :] = labels[train_mask, :] y_val[val_mask, :] = labels[val_mask, :] y_test[test_mask, :] = labels[test_mask, :] return adj, features, y_train, y_val, y_test, train_mask, val_mask, test_mask def load_data_original(dataset_str): """Load data.""" names = ['x', 'y', 'tx', 'ty', 'allx', 'ally', 'graph'] objects = [] for i in range(len(names)): with open("data/ind.{}.{}".format(dataset_str, names[i]), 'rb') as f: if sys.version_info > (3, 0): objects.append(pkl.load(f, encoding='latin1')) else: objects.append(pkl.load(f)) x, y, tx, ty, allx, ally, graph = tuple(objects) test_idx_reorder = parse_index_file("data/ind.{}.test.index".format(dataset_str)) test_idx_range = np.sort(test_idx_reorder) if dataset_str == 'citeseer': # Fix citeseer dataset (there are some isolated nodes in the graph) # Find isolated nodes, add them as zero-vecs into the right position test_idx_range_full = range(min(test_idx_reorder), max(test_idx_reorder)+1) tx_extended = sp.lil_matrix((len(test_idx_range_full), x.shape[1])) tx_extended[test_idx_range-min(test_idx_range), :] = tx tx = tx_extended ty_extended = np.zeros((len(test_idx_range_full), y.shape[1])) ty_extended[test_idx_range-min(test_idx_range), :] = ty ty = ty_extended features = sp.vstack((allx, tx)).tolil() features[test_idx_reorder, :] = features[test_idx_range, :] adj = nx.adjacency_matrix(nx.from_dict_of_lists(graph)) labels = np.vstack((ally, ty)) labels[test_idx_reorder, :] = labels[test_idx_range, :] idx_test = test_idx_range.tolist() idx_train = range(len(y)) idx_val = range(len(y), len(y)+500) train_mask = sample_mask(idx_train, labels.shape[0]) val_mask = sample_mask(idx_val, labels.shape[0]) test_mask = sample_mask(idx_test, labels.shape[0]) y_train = np.zeros(labels.shape) y_val = np.zeros(labels.shape) y_test = np.zeros(labels.shape) y_train[train_mask, :] = labels[train_mask, :] y_val[val_mask, :] = labels[val_mask, :] y_test[test_mask, :] = labels[test_mask, :] return adj, features, y_train, y_val, y_test, train_mask, val_mask, test_mask def sparse_to_tuple(sparse_mx): """Convert sparse matrix to tuple representation.""" def to_tuple(mx): if not sp.isspmatrix_coo(mx): mx = mx.tocoo() coords = np.vstack((mx.row, mx.col)).transpose() values = mx.data shape = mx.shape return coords, values, shape if isinstance(sparse_mx, list): for i in range(len(sparse_mx)): sparse_mx[i] = to_tuple(sparse_mx[i]) else: sparse_mx = to_tuple(sparse_mx) return sparse_mx def nontuple_preprocess_features(features): """Row-normalize feature matrix and convert to tuple representation""" rowsum = np.array(features.sum(1)) r_inv = np.power(rowsum, -1).flatten() r_inv[np.isinf(r_inv)] = 0. r_mat_inv = sp.diags(r_inv) features = r_mat_inv.dot(features) return features def preprocess_features(features): """Row-normalize feature matrix and convert to tuple representation""" rowsum = np.array(features.sum(1)) r_inv = np.power(rowsum, -1).flatten() r_inv[np.isinf(r_inv)] = 0. r_mat_inv = sp.diags(r_inv) features = r_mat_inv.dot(features) return sparse_to_tuple(features) def normalize_adj(adj): """Symmetrically normalize adjacency matrix.""" adj = sp.coo_matrix(adj) rowsum = np.array(adj.sum(1)) d_inv_sqrt = np.power(rowsum, -0.5).flatten() d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0. d_mat_inv_sqrt = sp.diags(d_inv_sqrt) return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt).tocoo() def nontuple_preprocess_adj(adj): adj_normalized = normalize_adj(sp.eye(adj.shape[0]) + adj) # adj_normalized = sp.eye(adj.shape[0]) + normalize_adj(adj) return adj_normalized.tocsr() def column_prop(adj): column_norm = sparsenorm(adj, axis=0) # column_norm = pow(sparsenorm(adj, axis=0),2) norm_sum = sum(column_norm) return column_norm/norm_sum def mix_prop(adj, features, sparseinputs=False): adj_column_norm = sparsenorm(adj, axis=0) if sparseinputs: features_row_norm = sparsenorm(features, axis=1) else: features_row_norm = np.linalg.norm(features, axis=1) mix_norm = adj_column_norm*features_row_norm norm_sum = sum(mix_norm) return mix_norm / norm_sum def preprocess_adj(adj): """Preprocessing of adjacency matrix for simple GCN model and conversion to tuple representation.""" # adj_appr = np.array(sp.csr_matrix.todense(adj)) # # adj_appr = dense_lanczos(adj_appr, 100) # adj_appr = dense_RandomSVD(adj_appr, 100) # if adj_appr.sum(1).min()<0: # adj_appr = adj_appr- (adj_appr.sum(1).min()-0.5)*sp.eye(adj_appr.shape[0]) # else: # adj_appr = adj_appr + sp.eye(adj_appr.shape[0]) # adj_normalized = normalize_adj(adj_appr) # adj_normalized = normalize_adj(adj+sp.eye(adj.shape[0])) # adj_appr = np.array(sp.coo_matrix.todense(adj_normalized)) # # adj_normalized = dense_RandomSVD(adj_appr,100) # adj_normalized = dense_lanczos(adj_appr, 100) adj_normalized = normalize_adj(sp.eye(adj.shape[0]) + adj) # adj_normalized = sp.eye(adj.shape[0]) + normalize_adj(adj) return sparse_to_tuple(adj_normalized) from lanczos import lanczos def dense_lanczos(A,K): q = np.random.randn(A.shape[0], ) Q, sigma = lanczos(A, K, q) A2 = np.dot(Q[:,:K], np.dot(sigma[:K,:K], Q[:,:K].T)) return sp.csr_matrix(A2) def sparse_lanczos(A,k): q = sp.random(A.shape[0],1) n = A.shape[0] Q = sp.lil_matrix(np.zeros((n,k+1))) A = sp.lil_matrix(A) Q[:,0] = q/sparsenorm(q) alpha = 0 beta = 0 for i in range(k): if i == 0: q = A*Q[:,i] else: q = A*Q[:,i] - beta*Q[:,i-1] alpha = q.T*Q[:,i] q = q - Q[:,i]*alpha q = q - Q[:,:i]*Q[:,:i].T*q # full reorthogonalization beta = sparsenorm(q) Q[:,i+1] = q/beta print(i) Q = Q[:,:k] Sigma = Q.T*A*Q A2 = Q[:,:k]*Sigma[:k,:k]*Q[:,:k].T return A2 # return Q, Sigma def dense_RandomSVD(A,K): G = np.random.randn(A.shape[0],K) B = np.dot(A,G) Q,R =qr(B,mode='economic') M = np.dot(Q, np.dot(Q.T, A)) return sp.csr_matrix(M) def construct_feed_dict(features, support, labels, labels_mask, placeholders): """Construct feed dictionary.""" feed_dict = dict() feed_dict.update({placeholders['labels']: labels}) feed_dict.update({placeholders['labels_mask']: labels_mask}) feed_dict.update({placeholders['features']: features}) feed_dict.update({placeholders['support'][i]: support[i] for i in range(len(support))}) feed_dict.update({placeholders['num_features_nonzero']: features[1].shape}) return feed_dict def chebyshev_polynomials(adj, k): """Calculate Chebyshev polynomials up to order k. Return a list of sparse matrices (tuple representation).""" print("Calculating Chebyshev polynomials up to order {}...".format(k)) adj_normalized = normalize_adj(adj) laplacian = sp.eye(adj.shape[0]) - adj_normalized largest_eigval, _ = eigsh(laplacian, 1, which='LM') scaled_laplacian = (2. / largest_eigval[0]) * laplacian - sp.eye(adj.shape[0]) t_k = list() t_k.append(sp.eye(adj.shape[0])) t_k.append(scaled_laplacian) def chebyshev_recurrence(t_k_minus_one, t_k_minus_two, scaled_lap): s_lap = sp.csr_matrix(scaled_lap, copy=True) return 2 * s_lap.dot(t_k_minus_one) - t_k_minus_two for i in range(2, k+1): t_k.append(chebyshev_recurrence(t_k[-1], t_k[-2], scaled_laplacian)) return sparse_to_tuple(t_k)
{ "pile_set_name": "Github" }
// 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 bkwd_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,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 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 , 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 >::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 > { }; }}}
{ "pile_set_name": "Github" }
# Translation of Odoo Server. # This file contains the translation of the following modules: # * hr_timesheet_attendance # # Translators: # Martin Trigaux, 2019 # msgid "" msgstr "" "Project-Id-Version: Odoo Server saas~11.5\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-09-21 13:17+0000\n" "PO-Revision-Date: 2019-08-26 09:11+0000\n" "Last-Translator: Martin Trigaux, 2019\n" "Language-Team: Romanian (https://www.transifex.com/odoo/teams/41243/ro/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Language: ro\n" "Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" #. module: hr_timesheet_attendance #: model:ir.model.fields,field_description:hr_timesheet_attendance.field_hr_timesheet_attendance_report__date #: model_terms:ir.ui.view,arch_db:hr_timesheet_attendance.view_hr_timesheet_attendance_report_search msgid "Date" msgstr "Dată" #. module: hr_timesheet_attendance #: model:ir.model.fields,field_description:hr_timesheet_attendance.field_hr_timesheet_attendance_report__display_name msgid "Display Name" msgstr "Nume afișat" #. module: hr_timesheet_attendance #: model:ir.actions.act_window,name:hr_timesheet_attendance.action_hr_timesheet_attendance_report msgid "HR Timesheet/Attendance Report" msgstr "" #. module: hr_timesheet_attendance #: model:ir.model.fields,field_description:hr_timesheet_attendance.field_hr_timesheet_attendance_report__id msgid "ID" msgstr "ID" #. module: hr_timesheet_attendance #: model:ir.model.fields,field_description:hr_timesheet_attendance.field_hr_timesheet_attendance_report____last_update msgid "Last Modified on" msgstr "Ultima modificare la" #. module: hr_timesheet_attendance #: model:ir.ui.menu,name:hr_timesheet_attendance.menu_hr_timesheet_attendance_report msgid "Timesheet / Attendance" msgstr "" #. module: hr_timesheet_attendance #: model:ir.model,name:hr_timesheet_attendance.model_hr_timesheet_attendance_report msgid "Timesheet Attendance Report" msgstr "" #. module: hr_timesheet_attendance #: model:ir.model.fields,field_description:hr_timesheet_attendance.field_hr_timesheet_attendance_report__total_attendance msgid "Total Attendance" msgstr "Total Prezență" #. module: hr_timesheet_attendance #: model:ir.model.fields,field_description:hr_timesheet_attendance.field_hr_timesheet_attendance_report__total_difference msgid "Total Difference" msgstr "Total Diferență" #. module: hr_timesheet_attendance #: model:ir.model.fields,field_description:hr_timesheet_attendance.field_hr_timesheet_attendance_report__total_timesheet msgid "Total Timesheet" msgstr "Total fișe de pontaj" #. module: hr_timesheet_attendance #: model:ir.model.fields,field_description:hr_timesheet_attendance.field_hr_timesheet_attendance_report__user_id msgid "User" msgstr "Operator" #. module: hr_timesheet_attendance #: model_terms:ir.ui.view,arch_db:hr_timesheet_attendance.view_hr_timesheet_attendance_report_pivot #: model_terms:ir.ui.view,arch_db:hr_timesheet_attendance.view_hr_timesheet_attendance_report_search msgid "timesheet attendance" msgstr ""
{ "pile_set_name": "Github" }
(* This program is free software; you can redistribute it and/or *) (* modify it under the terms of the GNU Lesser General Public License *) (* as published by the Free Software Foundation; either version 2.1 *) (* of the License, or (at your option) any later version. *) (* *) (* This 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 Lesser General Public *) (* License along with this program; if not, write to the Free *) (* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *) (* 02110-1301 USA *) Require Export Qquadratic_sign_properties. Require Export Qquadratic_Qpositive_to_Qpositive. Require Export homographicAcc_Qhomographic_sign. Definition qnew_a (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2) := fst (fst (fst (snd (Qquadratic_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero)))). Definition qnew_b (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2) := fst (snd (fst (fst (snd (Qquadratic_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero))))). Definition qnew_c (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2) := fst (snd (snd (fst (fst (snd (Qquadratic_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero)))))). Definition qnew_d (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2) := snd (snd (snd (fst (fst (snd (Qquadratic_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero)))))). Definition qnew_e (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2) := fst (snd (fst (snd (Qquadratic_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero)))). Definition qnew_f (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2) := fst (snd (snd (fst (snd (Qquadratic_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero))))). Definition qnew_g (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2) := fst (snd (snd (snd (fst (snd (Qquadratic_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero)))))). Definition qnew_h (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2) := snd (snd (snd (snd (fst (snd (Qquadratic_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero)))))). Definition qnew_p1 (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2) := fst (snd (snd (Qquadratic_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero))). Definition qnew_p2 (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2) := snd (snd (snd (Qquadratic_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero))). Lemma Qquadratic_Qpositive_to_Q_quadraticAcc_pos_1 : forall (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2), ~ same_ratio a b c d e f g h -> q_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero = 1%Z -> Z.sgn (qnew_a a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_b a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_c a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_d a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) = 1%Z -> quadraticAcc (qnew_a a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_b a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_c a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_d a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_e a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_f a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_g a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_h a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_p1 a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_p2 a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero). Proof. intros a b c d e f g h p1 p2 H_qsign not_same_ratio_abcdefgh l1_eq_one na_nb_nc_nd_eq_one. set (na := qnew_a a b c d e f g h p1 p2 H_qsign) in *. set (nb := qnew_b a b c d e f g h p1 p2 H_qsign) in *. set (nc := qnew_c a b c d e f g h p1 p2 H_qsign) in *. set (nd := qnew_d a b c d e f g h p1 p2 H_qsign) in *. set (ne := qnew_e a b c d e f g h p1 p2 H_qsign) in *. set (nf := qnew_f a b c d e f g h p1 p2 H_qsign) in *. set (ng := qnew_g a b c d e f g h p1 p2 H_qsign) in *. set (nh := qnew_h a b c d e f g h p1 p2 H_qsign) in *. set (np1 := qnew_p1 a b c d e f g h p1 p2 H_qsign) in *. set (np2 := qnew_p2 a b c d e f g h p1 p2 H_qsign) in *. assert (H : Qquadratic_sign a b c d e f g h p1 p2 H_qsign = (1%Z, (na, (nb, (nc, nd)), (ne, (nf, (ng, nh))), (np1, np2)))). unfold na, nb, nc, nd, ne, nf, ng, nh, np1, np2 in |- *. rewrite <- l1_eq_one. unfold qnew_a, qnew_b, qnew_c, qnew_d, qnew_e, qnew_f, qnew_g, qnew_h, qnew_p1, qnew_p2 in |- *. replace (q_sign a b c d e f g h p1 p2 H_qsign) with (fst (Qquadratic_sign a b c d e f g h p1 p2 H_qsign)); [ idtac | reflexivity ]; repeat rewrite <- pair_1; reflexivity. generalize (Qquadratic_sign_pos_1 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh np1 np2 H). intros [(H_nabcd, H_nefgh)| (H1, _)]; [ idtac | apply False_ind; generalize (Zsgn_9 _ na_nb_nc_nd_eq_one); apply Zlt_asym; assumption ]. destruct np1 as [p| p| ]. (* np1 = (nR p) *) destruct np2 as [p0| p0| ]. (* np2 = (nR p0) *) apply quadraticAcc_wf; solve [ assumption | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) (nR p0) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2 = (dL p0) *) apply quadraticAcc_wf; solve [ assumption | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) (dL p0) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2=One *) apply quadraticacc0'. discriminate. reflexivity. apply homographicAcc_wf; solve [ rewrite Zplus_assoc; assumption | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) One H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]; [ apply Zplus_le_0_compat; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; rewrite <- Zplus_assoc; apply Zle_resp_neg; assumption ] ]. (* np1 = (dL p) *) destruct np2 as [p0| p0| ]. (* np2 = (nR p0) *) apply quadraticAcc_wf; solve [ assumption | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) (nR p0) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2 = (dL p0) *) apply quadraticAcc_wf; solve [ assumption | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) (dL p0) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2=One *) apply quadraticacc0'. discriminate. reflexivity. apply homographicAcc_wf; solve [ rewrite Zplus_assoc; assumption | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) One H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]; [ apply Zplus_le_0_compat; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; rewrite <- Zplus_assoc; apply Zle_resp_neg; assumption ] ]. (* np1 = One *) apply quadraticacc0. reflexivity. destruct np2 as [p| p| ]. (* np2 = (nR p) *) (* Here we use the third & forth clause in Qquadratic_sign_pos_2: p1=One /\ .... *) apply homographicAcc_wf; first [ omega | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh One (nR p) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, H_discriminate_me)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply Zplus_le_0_compat; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; omega | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2 = (dL p) *) (* Here we use the third & forth clause in Qquadratic_sign_pos_2: p1=One /\ .... *) apply homographicAcc_wf; solve [ omega | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh One (dL p) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, H_discriminate_me)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply Zplus_le_0_compat; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; omega | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2 = One *) apply homographicacc0; reflexivity || omega. Qed. Lemma Qquadratic_Qpositive_to_Q_quadraticAcc_pos_2 : forall (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2), ~ same_ratio a b c d e f g h -> q_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero = 1%Z -> Z.sgn (qnew_a a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_b a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_c a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_d a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) = (-1)%Z -> quadraticAcc (- qnew_a a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_b a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_c a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_d a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_e a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_f a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_g a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_h a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_p1 a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_p2 a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero). Proof. intros a b c d e f g h p1 p2 H_qsign not_same_ratio_abcdefgh l1_eq_one na_nb_nc_nd_eq_minus_one. set (na := qnew_a a b c d e f g h p1 p2 H_qsign) in *. set (nb := qnew_b a b c d e f g h p1 p2 H_qsign) in *. set (nc := qnew_c a b c d e f g h p1 p2 H_qsign) in *. set (nd := qnew_d a b c d e f g h p1 p2 H_qsign) in *. set (ne := qnew_e a b c d e f g h p1 p2 H_qsign) in *. set (nf := qnew_f a b c d e f g h p1 p2 H_qsign) in *. set (ng := qnew_g a b c d e f g h p1 p2 H_qsign) in *. set (nh := qnew_h a b c d e f g h p1 p2 H_qsign) in *. set (np1 := qnew_p1 a b c d e f g h p1 p2 H_qsign) in *. set (np2 := qnew_p2 a b c d e f g h p1 p2 H_qsign) in *. assert (H : Qquadratic_sign a b c d e f g h p1 p2 H_qsign = (1%Z, (na, (nb, (nc, nd)), (ne, (nf, (ng, nh))), (np1, np2)))). unfold na, nb, nc, nd, ne, nf, ng, nh, np1, np2 in |- *. rewrite <- l1_eq_one. unfold qnew_a, qnew_b, qnew_c, qnew_d, qnew_e, qnew_f, qnew_g, qnew_h, qnew_p1, qnew_p2 in |- *. replace (q_sign a b c d e f g h p1 p2 H_qsign) with (fst (Qquadratic_sign a b c d e f g h p1 p2 H_qsign)); [ idtac | reflexivity ]; repeat rewrite <- pair_1; reflexivity. generalize (Qquadratic_sign_pos_1 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh np1 np2 H). intros [(H1, _)| (H_nabcd, H_nefgh)]; [ apply False_ind; generalize (Zsgn_10 _ na_nb_nc_nd_eq_minus_one); apply Zlt_asym; assumption | idtac ]. destruct np1 as [p| p| ]. (* np1 = (nR p) *) destruct np2 as [p0| p0| ]. (* np2 = (nR p0 *) apply quadraticAcc_wf; solve [ omega | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) (nR p0) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | apply Zle_neg_opp; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2 = (dL p0) *) apply quadraticAcc_wf; solve [ omega | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) (dL p0) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | apply Zle_neg_opp; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2=One *) apply quadraticacc0'. discriminate. reflexivity. apply homographicAcc_wf; solve [ omega | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) One H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | omega | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | apply False_ind; generalize H_nabcd; apply Zle_not_lt; rewrite <- Zplus_assoc; apply Zplus_le_0_compat; assumption | omega ] ]. (* np1 = (dL p) *) destruct np2 as [p0| p0| ]. (* np2 = (nR p0) *) apply quadraticAcc_wf; solve [ omega | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) (nR p0) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | apply Zle_neg_opp; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2 = (dL p0) *) apply quadraticAcc_wf; solve [ omega | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) (dL p0) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | apply Zle_neg_opp; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2=One *) apply quadraticacc0'. discriminate. reflexivity. apply homographicAcc_wf; solve [ omega | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) One H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | omega | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | apply False_ind; generalize H_nabcd; apply Zle_not_lt; rewrite <- Zplus_assoc; apply Zplus_le_0_compat; assumption | omega ] ]. (* np1 = One *) apply quadraticacc0. reflexivity. destruct np2 as [p| p| ]. (* np2 = (nR p) *) (* Here we use the third & forth clause in Qquadratic_sign_pos_2: p1=One /\ .... *) apply homographicAcc_wf; solve [ omega | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh One (nR p) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, H_discriminate_me)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | apply Zplus_le_0_compat; apply Zle_neg_opp; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; omega | rewrite <- Zopp_plus_distr; apply Zle_neg_opp; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2 = (dL p) *) (* Here we use the third & forth clause in Qquadratic_sign_pos_2: p1=One /\ .... *) apply homographicAcc_wf; solve [ omega | generalize (Qquadratic_sign_pos_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh One (dL p) H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, H_discriminate_me)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | apply Zplus_le_0_compat; apply Zle_neg_opp; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; omega | rewrite <- Zopp_plus_distr; apply Zle_neg_opp; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]. (* np2 = One *) apply homographicacc0; reflexivity || omega. Qed. Lemma Qquadratic_Qpositive_to_Q_quadraticAcc_neg_1 : forall (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2), ~ same_ratio a b c d e f g h -> q_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero = (-1)%Z -> Z.sgn (qnew_a a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_b a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_c a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_d a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) = 1%Z -> quadraticAcc (qnew_a a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_b a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_c a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_d a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_e a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_f a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_g a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_h a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_p1 a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_p2 a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero). Proof. intros a b c d e f g h p1 p2 H_qsign not_same_ratio_abcdefgh l1_eq_min_one na_nb_nc_nd_eq_one. set (na := qnew_a a b c d e f g h p1 p2 H_qsign) in *. set (nb := qnew_b a b c d e f g h p1 p2 H_qsign) in *. set (nc := qnew_c a b c d e f g h p1 p2 H_qsign) in *. set (nd := qnew_d a b c d e f g h p1 p2 H_qsign) in *. set (ne := qnew_e a b c d e f g h p1 p2 H_qsign) in *. set (nf := qnew_f a b c d e f g h p1 p2 H_qsign) in *. set (ng := qnew_g a b c d e f g h p1 p2 H_qsign) in *. set (nh := qnew_h a b c d e f g h p1 p2 H_qsign) in *. set (np1 := qnew_p1 a b c d e f g h p1 p2 H_qsign) in *. set (np2 := qnew_p2 a b c d e f g h p1 p2 H_qsign) in *. assert (H : Qquadratic_sign a b c d e f g h p1 p2 H_qsign = ((-1)%Z, (na, (nb, (nc, nd)), (ne, (nf, (ng, nh))), (np1, np2)))). unfold na, nb, nc, nd, ne, nf, ng, nh, np1, np2 in |- *. rewrite <- l1_eq_min_one. unfold qnew_a, qnew_b, qnew_c, qnew_d, qnew_e, qnew_f, qnew_g, qnew_h, qnew_p1, qnew_p2 in |- *. replace (q_sign a b c d e f g h p1 p2 H_qsign) with (fst (Qquadratic_sign a b c d e f g h p1 p2 H_qsign)); [ idtac | reflexivity ]; repeat rewrite <- pair_1; reflexivity. generalize (Qquadratic_sign_neg_1 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh np1 np2 H). intros [(H_nabcd, H_nefgh)| (H1, _)]; [ idtac | apply False_ind; generalize (Zsgn_9 _ na_nb_nc_nd_eq_one); apply Zlt_asym; assumption ]. destruct np1 as [p| p| ]. (* np1 = (nR p) *) let T_local := (apply quadraticAcc_wf; solve [ assumption | omega | match goal with | id1:(?X1 = (?X2, (?X3, (?X4, nR ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) (nR p0) H) | id1:(?X1 = (?X2, (?X3, (?X4, dL ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) (dL p0) H) end; intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ try apply Zle_neg_opp; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]) in (destruct np2 as [p0| p0| ]; [ (* np2 = (nR p0)*) T_local | (* np2 = (dL p0) *) T_local | idtac ]). (* np2=One *) apply quadraticacc0'. discriminate. reflexivity. apply homographicAcc_wf; solve [ omega | generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) One H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]; [ apply Zplus_le_0_compat; try apply Zle_neg_opp; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | assumption || (rewrite <- Zopp_plus_distr; apply Zle_neg_opp; assumption) | apply False_ind; generalize H_nabcd; apply Zle_not_lt; rewrite <- Zplus_assoc; apply Zle_resp_neg; assumption ] ]. (* np1 = (dL p) *) let T_local := (apply quadraticAcc_wf; solve [ assumption | omega | match goal with | id1:(?X1 = (?X2, (?X3, (?X4, nR ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) (nR p0) H) | id1:(?X1 = (?X2, (?X3, (?X4, dL ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) (dL p0) H) end; intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ try apply Zle_neg_opp; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]) in (destruct np2 as [p0| p0| ]; [ (* np2 = (nR p0)*) T_local | (* np2 = (dL p0) *) T_local | idtac ]). (* np2=One *) apply quadraticacc0'. discriminate. reflexivity. apply homographicAcc_wf; solve [ rewrite Zplus_assoc; assumption || omega | generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) One H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]; [ apply Zplus_le_0_compat; try apply Zle_neg_opp; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | assumption || (rewrite <- Zopp_plus_distr; apply Zle_neg_opp; assumption) | apply False_ind; generalize H_nabcd; apply Zle_not_lt; rewrite <- Zplus_assoc; apply Zle_resp_neg; assumption ] ]. (* np1 = One *) apply quadraticacc0. reflexivity. let T_local := (apply homographicAcc_wf; solve [ omega | match goal with | id1:(?X1 = (?X2, (?X3, (?X4, nR ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh One (nR p) H) | id1:(?X1 = (?X2, (?X3, (?X4, dL ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh One (dL p) H) end; intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, H_discriminate_me)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply Zplus_le_0_compat; try apply Zle_neg_opp; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zle_resp_neg; assumption | assumption || (rewrite <- Zopp_plus_distr; apply Zle_neg_opp; assumption) | apply False_ind; generalize H_nabcd; apply Zle_not_lt; omega | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]) in (destruct np2 as [p| p| ]; [ (* np2 = (nR p)*) T_local | (* np2 = (dL p) *) T_local | (* Here we use the third clause in Qquadratic_sign_neg_2: p1=One /\ .... *) (* np2 = One *) apply homographicacc0; reflexivity || omega ]). Qed. Lemma Qquadratic_Qpositive_to_Q_quadraticAcc_neg_2 : forall (a b c d e f g h : Z) (p1 p2 : Qpositive) (H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2), ~ same_ratio a b c d e f g h -> q_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero = (-1)%Z -> Z.sgn (qnew_a a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_b a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_c a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero + qnew_d a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) = (-1)%Z -> quadraticAcc (- qnew_a a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_b a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_c a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (- qnew_d a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_e a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_f a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_g a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_h a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_p1 a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero) (qnew_p2 a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero). Proof. intros a b c d e f g h p1 p2 H_qsign not_same_ratio_abcdefgh l1_eq_min_one na_nb_nc_nd_eq_minus_one. set (na := qnew_a a b c d e f g h p1 p2 H_qsign) in *. set (nb := qnew_b a b c d e f g h p1 p2 H_qsign) in *. set (nc := qnew_c a b c d e f g h p1 p2 H_qsign) in *. set (nd := qnew_d a b c d e f g h p1 p2 H_qsign) in *. set (ne := qnew_e a b c d e f g h p1 p2 H_qsign) in *. set (nf := qnew_f a b c d e f g h p1 p2 H_qsign) in *. set (ng := qnew_g a b c d e f g h p1 p2 H_qsign) in *. set (nh := qnew_h a b c d e f g h p1 p2 H_qsign) in *. set (np1 := qnew_p1 a b c d e f g h p1 p2 H_qsign) in *. set (np2 := qnew_p2 a b c d e f g h p1 p2 H_qsign) in *. assert (H : Qquadratic_sign a b c d e f g h p1 p2 H_qsign = ((-1)%Z, (na, (nb, (nc, nd)), (ne, (nf, (ng, nh))), (np1, np2)))). unfold na, nb, nc, nd, ne, nf, ng, nh, np1, np2 in |- *. rewrite <- l1_eq_min_one. unfold qnew_a, qnew_b, qnew_c, qnew_d, qnew_e, qnew_f, qnew_g, qnew_h, qnew_p1, qnew_p2 in |- *. replace (q_sign a b c d e f g h p1 p2 H_qsign) with (fst (Qquadratic_sign a b c d e f g h p1 p2 H_qsign)); [ idtac | reflexivity ]; repeat rewrite <- pair_1; reflexivity. generalize (Qquadratic_sign_neg_1 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh np1 np2 H). intros [(H1, _)| (H_nabcd, H_nefgh)]; [ apply False_ind; generalize (Zsgn_10 _ na_nb_nc_nd_eq_minus_one); apply Zlt_asym; assumption | idtac ]. destruct np1 as [p| p| ]. (* np1 = (nR p) *) let T_local := (apply quadraticAcc_wf; solve [ assumption || omega | match goal with | id1:(?X1 = (?X2, (?X3, (?X4, nR ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) (nR p0) H) | id1:(?X1 = (?X2, (?X3, (?X4, dL ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) (dL p0) H) end; intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | try apply Zle_neg_opp; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]) in (destruct np2 as [p0| p0| ]; [ (* np2 = (nR p0)*) T_local | (* np2 = (dL p0) *) T_local | idtac ]). (* np2=One *) apply quadraticacc0'. discriminate. reflexivity. apply homographicAcc_wf; solve [ omega | generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (nR p) One H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | apply Zplus_le_0_compat; try apply Zle_neg_opp; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | apply False_ind; generalize H_nabcd; apply Zle_not_lt; rewrite <- Zplus_assoc; apply Zplus_le_0_compat; assumption | assumption || (rewrite <- Zopp_plus_distr; apply Zle_neg_opp; assumption) ] ]. (* np1 = (dL p0) *) let T_local := (apply quadraticAcc_wf; solve [ assumption || omega | match goal with | id1:(?X1 = (?X2, (?X3, (?X4, nR ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) (nR p0) H) | id1:(?X1 = (?X2, (?X3, (?X4, dL ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) (dL p0) H) end; intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | try apply Zle_neg_opp; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]) in (destruct np2 as [p0| p0| ]; [ (* np2 = (nR p0)*) T_local | (* np2 = (dL p0) *) T_local | idtac ]). (* np2=One *) apply quadraticacc0'. discriminate. reflexivity. apply homographicAcc_wf; solve [ rewrite Zplus_assoc; assumption || omega | generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh (dL p) One H); intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (H_discriminate_me, _)]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]| (_, (_, (Hab, (Hcd, (Hef, Hgh)))))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | apply Zplus_le_0_compat; try apply Zle_neg_opp; assumption | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me | apply False_ind; generalize H_nabcd; apply Zle_not_lt; rewrite <- Zplus_assoc; apply Zplus_le_0_compat; assumption | assumption || (rewrite <- Zopp_plus_distr; apply Zle_neg_opp; assumption) ] ]. (* np1 = One *) apply quadraticacc0. reflexivity. let T_local := (apply homographicAcc_wf; try solve [ omega | match goal with | id1:(?X1 = (?X2, (?X3, (?X4, nR ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh One (nR p) H) | id1:(?X1 = (?X2, (?X3, (?X4, dL ?X5)))) |- ?X6 => generalize (Qquadratic_sign_neg_2 a b c d e f g h p1 p2 H_qsign na nb nc nd ne nf ng nh One (dL p) H) end; intros [[[[[[(Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))| (Ha, (Hb, (Hc, (Hd, (He, (Hf, (Hg, Hh)))))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, (Hab, (Hcd, (Hef, Hgh))))]| (_, H_discriminate_me)]| (_, (H_discriminate_me,_))]| (_, (H_discriminate_me,_))]; [ apply False_ind; generalize H_nabcd; apply Zle_not_lt; repeat apply Zplus_le_0_compat; assumption | apply Zplus_le_0_compat; try apply Zle_neg_opp; assumption | apply False_ind; generalize H_nabcd; apply Zle_not_lt; omega | assumption || (rewrite <- Zopp_plus_distr; apply Zle_neg_opp; assumption) | discriminate H_discriminate_me | discriminate H_discriminate_me | discriminate H_discriminate_me ] ]) in (destruct np2 as [p| p| ]; [ (* np2 = (nR p)*) T_local | (* np2 = (dL p) *) T_local | (* Here we use the third clause in Qquadratic_sign_neg_2: p1=One /\ .... *) (* np2 = One *) apply homographicacc0; reflexivity || omega ]). Qed.
{ "pile_set_name": "Github" }
/* * IBM Accurate Mathematical Library * Written by International Business Machines Corp. * Copyright (C) 2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /****************************************************************/ /* TABLES FOR THE upow() FUNCTION */ /****************************************************************/ static const double powtwo[] = { 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, 8192.0, 16384.0, 32768.0, 65536.0, 131072.0, 262144.0, 524288.0, 1048576.0, 2097152.0, 4194304.0, 8388608.0, 16777216.0, 33554432.0, 67108864.0, 134217728.0 };
{ "pile_set_name": "Github" }
import numpy as np import time import parakeet from parakeet import testing_helpers def count_thresh_orig(values, thresh): n = 0 for elt in values: n += elt < thresh return n count_thresh = parakeet.jit(count_thresh_orig) def np_thresh(values, thresh): return np.sum(values < thresh) def par_thresh(values, thresh): return parakeet.sum(values < thresh) def test_count_thresh(): v = np.array([1.2, 1.4, 5.0, 2, 3]) parakeet_result = count_thresh(v, 2.0) python_result = count_thresh_orig(v,2.0) testing_helpers.expect(count_thresh, [v, 2.0], count_thresh_orig(v, 2.0)) if __name__ == '__main__': testing_helpers.run_local_tests()
{ "pile_set_name": "Github" }
/* * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.test.context.support; import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfigurationAttributes; import org.springframework.test.context.ContextLoader; import org.springframework.test.context.MergedContextConfiguration; import org.springframework.util.ObjectUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; /** * Unit tests for {@link DelegatingSmartContextLoader}. * * @author Sam Brannen * @since 3.1 */ class DelegatingSmartContextLoaderTests { private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0]; private final DelegatingSmartContextLoader loader = new DelegatingSmartContextLoader(); private static void assertEmpty(Object[] array) { assertThat(ObjectUtils.isEmpty(array)).isTrue(); } // --- SmartContextLoader - processContextConfiguration() ------------------ @Test void processContextConfigurationWithDefaultXmlConfigGeneration() { ContextConfigurationAttributes configAttributes = new ContextConfigurationAttributes( XmlTestCase.class, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, true, null, true, ContextLoader.class); loader.processContextConfiguration(configAttributes); assertThat(configAttributes.getLocations().length).isEqualTo(1); assertEmpty(configAttributes.getClasses()); } @Test void processContextConfigurationWithDefaultConfigurationClassGeneration() { ContextConfigurationAttributes configAttributes = new ContextConfigurationAttributes( ConfigClassTestCase.class, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, true, null, true, ContextLoader.class); loader.processContextConfiguration(configAttributes); assertThat(configAttributes.getClasses().length).isEqualTo(1); assertEmpty(configAttributes.getLocations()); } @Test void processContextConfigurationWithDefaultXmlConfigAndConfigurationClassGeneration() { ContextConfigurationAttributes configAttributes = new ContextConfigurationAttributes( ImproperDuplicateDefaultXmlAndConfigClassTestCase.class, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, true, null, true, ContextLoader.class); assertThatIllegalStateException().isThrownBy(() -> loader.processContextConfiguration(configAttributes)) .withMessageContaining("both default locations AND default configuration classes were detected"); } @Test void processContextConfigurationWithLocation() { String[] locations = new String[] {"classpath:/foo.xml"}; ContextConfigurationAttributes configAttributes = new ContextConfigurationAttributes( getClass(), locations, EMPTY_CLASS_ARRAY, true, null, true, ContextLoader.class); loader.processContextConfiguration(configAttributes); assertThat(configAttributes.getLocations()).isEqualTo(locations); assertEmpty(configAttributes.getClasses()); } @Test void processContextConfigurationWithConfigurationClass() { Class<?>[] classes = new Class<?>[] {getClass()}; ContextConfigurationAttributes configAttributes = new ContextConfigurationAttributes( getClass(), EMPTY_STRING_ARRAY, classes, true, null, true, ContextLoader.class); loader.processContextConfiguration(configAttributes); assertThat(configAttributes.getClasses()).isEqualTo(classes); assertEmpty(configAttributes.getLocations()); } // --- SmartContextLoader - loadContext() ---------------------------------- @Test void loadContextWithNullConfig() throws Exception { assertThatIllegalArgumentException().isThrownBy(() -> loader.loadContext((MergedContextConfiguration) null)); } @Test void loadContextWithoutLocationsAndConfigurationClasses() throws Exception { MergedContextConfiguration mergedConfig = new MergedContextConfiguration( getClass(), EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); assertThatIllegalStateException().isThrownBy(() -> loader.loadContext(mergedConfig)) .withMessageStartingWith("Neither") .withMessageContaining("was able to load an ApplicationContext from"); } /** * @since 4.1 */ @Test void loadContextWithLocationsAndConfigurationClasses() throws Exception { MergedContextConfiguration mergedConfig = new MergedContextConfiguration(getClass(), new String[] {"test.xml"}, new Class<?>[] {getClass()}, EMPTY_STRING_ARRAY, loader); assertThatIllegalStateException().isThrownBy(() -> loader.loadContext(mergedConfig)) .withMessageStartingWith("Neither") .withMessageContaining("declare either 'locations' or 'classes' but not both."); } private void assertApplicationContextLoadsAndContainsFooString(MergedContextConfiguration mergedConfig) throws Exception { ApplicationContext applicationContext = loader.loadContext(mergedConfig); assertThat(applicationContext).isNotNull(); assertThat(applicationContext.getBean(String.class)).isEqualTo("foo"); boolean condition = applicationContext instanceof ConfigurableApplicationContext; assertThat(condition).isTrue(); ((ConfigurableApplicationContext) applicationContext).close(); } @Test void loadContextWithXmlConfig() throws Exception { MergedContextConfiguration mergedConfig = new MergedContextConfiguration( XmlTestCase.class, new String[] {"classpath:/org/springframework/test/context/support/DelegatingSmartContextLoaderTests$XmlTestCase-context.xml"}, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader); assertApplicationContextLoadsAndContainsFooString(mergedConfig); } @Test void loadContextWithConfigurationClass() throws Exception { MergedContextConfiguration mergedConfig = new MergedContextConfiguration(ConfigClassTestCase.class, EMPTY_STRING_ARRAY, new Class<?>[] {ConfigClassTestCase.Config.class}, EMPTY_STRING_ARRAY, loader); assertApplicationContextLoadsAndContainsFooString(mergedConfig); } // --- ContextLoader ------------------------------------------------------- @Test void processLocations() { assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> loader.processLocations(getClass(), EMPTY_STRING_ARRAY)); } @Test void loadContextFromLocations() throws Exception { assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> loader.loadContext(EMPTY_STRING_ARRAY)); } // ------------------------------------------------------------------------- static class XmlTestCase { } static class ConfigClassTestCase { @Configuration static class Config { @Bean public String foo() { return new String("foo"); } } static class NotAConfigClass { } } static class ImproperDuplicateDefaultXmlAndConfigClassTestCase { @Configuration static class Config { // intentionally empty: we just need the class to be present to fail // the test } } }
{ "pile_set_name": "Github" }
// // MKSoundCoordinatedAnimationLayer.m // // Copyright 2010-2011 Michael F. Kamprath // michael@claireware.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #ifndef __has_feature #define __has_feature(x) 0 #endif #ifndef __has_extension #define __has_extension __has_feature // Compatibility with pre-3.0 compilers. #endif #if __has_feature(objc_arc) && __clang_major__ >= 3 #error "iPhoneMK is not designed to be used with ARC. Please add '-fno-objc-arc' to the compiler flags of iPhoneMK files." #endif // __has_feature(objc_arc) #import <AVFoundation/AVFoundation.h> #import "MKSoundCoordinatedAnimationLayer.h" NSString* const kSCANMetaDataKey = @"meta"; NSString* const kSCANSoundFileNameKey = @"soundFile"; NSString* const kSCANImageFileNameKey = @"imageFile"; NSString* const kSCANImageHighlightMaskFileKey = @"highlightMaskFile"; NSString* const kSCANStillImageFileNameKey = @"stillImageFile"; NSString* const kSCANSoundObjectKey = @"soundObj"; NSString* const kSCANImageObjectKey = @"imageObj"; NSString* const kSCANStillImageObjectKey = @"stillImageObj"; NSString* const kSCANHighlightMaskObjectKey = @"highlightMaskObj"; NSString* const kSCANLastFrameDurationKey = @"lastFrameDuration"; NSString* const kSCANVerticalTranslationKey = @"deltaY"; NSString* const kSCANHorizontalTranslationKey = @"deltaX"; NSString* const kSCANRotationPositionDegreesKey = @"rotatePosDegrees"; NSString* const kSCANAlphaKey = @"alpha"; NSString* const kSCANVerticalScaleKey = @"scaleY"; NSString* const kSCANHorizontalScaleKey = @"scaleX"; NSString* const kSCANVerticalAnchorKey = @"anchorY"; NSString* const kSCANHorizontalAnchorKey = @"anchorX"; NSString* const kSCANImageAndPositingAniamtionKey = @"imageAndPositionAnimation"; @interface MKSoundCoordinatedAnimationLayer () - (void)initValues; -(void)stopSounds; -(void)setUpSoundTimers; -(void)startAnimationCycleWithCycleCount:(NSUInteger)inCycleCount repeatDuration:(NSTimeInterval)inRepeatDuration; -(void)setUpAnimationFrames; - (void)animationDidStart:(CAAnimation *)theAnimation; - (void)animationDidStop:(CAAnimation *)inAnimation finished:(BOOL)inDidFinish; @end @interface MKDefaultAnimationObjectFactory : NSObject <MKSoundCoordinatedAnimationObjectFactory> { } -(UIImage*)getUIImageForFilename:(NSString*)inFilename; -(AVAudioPlayer*)getAVAudioPlayerForFilename:(NSString*)inFilename; @end @implementation MKSoundCoordinatedAnimationLayer @synthesize config=_config; @synthesize stillImage=_stillImage; @dynamic naturalCycleDuration; @dynamic cycleDuration; @dynamic isAnimating; @synthesize silenced=_silenced; @synthesize completionInvocation=_completionInvo; - (id)init { self = [super init]; if ( self ) { [self initValues]; } return self; } - (id)initWithLayer:(id)layer { self = [super initWithLayer:layer]; if ( self ) { [self initValues]; } return self; } - (void)initValues { _playingSounds = [[NSMutableSet setWithCapacity:10] retain]; _isAnimating = NO; } - (void)dealloc { [self stopAnimatingImmeditely:YES]; [_config release]; [_stillImage release]; [_finalStillImage release]; [_sortedFrameKeys release]; [_playingSounds release]; [_soundPlayDict release]; [super dealloc]; } #pragma mark - Properties -(void)setConfig:(NSDictionary *)inConfig { [self stopAnimatingImmeditely:YES]; if (_config != nil ) { [_config release]; _config = nil; [_sortedFrameKeys release]; _sortedFrameKeys = nil; } _config = [inConfig retain]; if ( _assignedAnimationTime != nil ) { [_assignedAnimationTime release]; _assignedAnimationTime = nil; } NSMutableArray* keys = [NSMutableArray arrayWithArray:[_config allKeys]]; [keys removeObject:kSCANMetaDataKey]; _sortedFrameKeys = [[keys sortedArrayUsingSelector:@selector(compare:)] retain]; // now prepare sounds for ( NSNumber* timeKey in _sortedFrameKeys ) { NSDictionary* datum = [_config objectForKey:timeKey]; AVAudioPlayer* sound = [datum objectForKey:kSCANSoundObjectKey]; if ( sound != nil ) { [sound prepareToPlay]; } } // // apply meta properties // NSDictionary* metaConfig = [_config objectForKey:kSCANMetaDataKey]; if ( metaConfig != nil ) { // still image UIImage* image = [metaConfig objectForKey:kSCANStillImageObjectKey]; if ( image != nil ) { self.stillImage = image; } // rotation and scale NSNumber* rotationValue = [metaConfig objectForKey:kSCANRotationPositionDegreesKey]; NSNumber* scaleXValue = [metaConfig objectForKey:kSCANHorizontalScaleKey]; NSNumber* scaleYValue = [metaConfig objectForKey:kSCANVerticalScaleKey]; if ( (rotationValue != nil)||(scaleXValue != nil)||(scaleYValue != nil) ) { CGFloat rotRadians = (rotationValue != nil) ? [rotationValue floatValue]*(M_PI/180.0) : 0.0; CGFloat scaleX = (scaleXValue != nil) ? [scaleXValue floatValue] : 1.0; CGFloat scaleY = (scaleYValue != nil) ? [scaleYValue floatValue] : 1.0; CATransform3D staticTransform = CATransform3DConcat( CATransform3DMakeRotation( rotRadians, 0, 0, 1), CATransform3DMakeScale(scaleX, scaleY, 1.0)); self.transform = staticTransform; } } } -(void)setStillImage:(UIImage *)inImage { if (_stillImage != nil) { [_stillImage release]; _stillImage = nil; } if (inImage != nil) { _stillImage = [inImage retain]; if (!self.isAnimating) { [CATransaction lock]; [CATransaction begin]; [CATransaction setAnimationDuration:0]; self.contents = (id)_stillImage.CGImage; self.contentsScale = _stillImage.scale; CGPoint originalPos = self.position; self.frame = CGRectMake( self.frame.origin.x, self.frame.origin.y, _stillImage.size.width, _stillImage.size.height ); self.position = originalPos; [CATransaction commit]; [CATransaction unlock]; } } else if (!self.isAnimating) { self.contents = nil; } } -(NSTimeInterval)naturalCycleDuration { if ((self.config != nil)&&( _sortedFrameKeys.count > 0 )) { NSTimeInterval maxTime = 0; for ( NSNumber* timeKey in _sortedFrameKeys ) { NSTimeInterval timeKeyValue = [timeKey doubleValue]; if ( timeKeyValue > maxTime ) { maxTime = timeKeyValue; } NSDictionary* datum = [self.config objectForKey:timeKey]; AVAudioPlayer* sound = [datum objectForKey:kSCANSoundObjectKey]; if ( sound != nil ) { NSTimeInterval frameEndTime = timeKeyValue + sound.duration; if ( frameEndTime > maxTime ) { maxTime = frameEndTime; } } NSNumber* lastFrameTime = [datum objectForKey:kSCANLastFrameDurationKey]; if ( lastFrameTime != nil ) { NSTimeInterval frameEndTime = timeKeyValue + ([lastFrameTime doubleValue]); if ( frameEndTime > maxTime ) { maxTime = frameEndTime; } } } return maxTime; } else { return 0; } } -(NSTimeInterval)cycleDuration { if ( _assignedAnimationTime != nil ) { return [_assignedAnimationTime doubleValue]; } else { return self.naturalCycleDuration; } } -(void)setCycleDuration:(NSTimeInterval)inCycleDuration { if (_assignedAnimationTime != nil) { [_assignedAnimationTime release]; _assignedAnimationTime = nil; } if ( inCycleDuration >= 0 ) { _assignedAnimationTime = [[NSNumber numberWithDouble:inCycleDuration] retain]; } } - (BOOL)isAnimating { return _isAnimating; } -(void)setContents:(id)contents { [super setContents:contents]; } #pragma mark - Public Methods -(void)startAnimating { // // NSUIntegerMax is sentinal value indicating to cycle animaitons with no end // [self animateWithCycleCount:NSUIntegerMax withCompletionInvocation:nil finalStaticImage:nil]; } - (void)animateOnceWithCompletionInvocation:(NSInvocation*)inInvocation { [self animateWithCycleCount:1 withCompletionInvocation:inInvocation finalStaticImage:nil]; } - (void)animateOnceWithCompletionInvocation:(NSInvocation*)inInvocation finalStaticImage:(UIImage*)inFinalStaticImage { [self animateWithCycleCount:1 withCompletionInvocation:inInvocation finalStaticImage:inFinalStaticImage]; } - (void)animateWithCycleCount:(NSUInteger)inCycleCount withCompletionInvocation:(NSInvocation*)inInvocation finalStaticImage:(UIImage*)inFinalStaticImage { if (nil != inInvocation && ![inInvocation argumentsRetained]) { [inInvocation retainArguments]; } self.completionInvocation = inInvocation; _finalStillImage = [inFinalStaticImage retain]; [self startAnimationCycleWithCycleCount:inCycleCount repeatDuration:0]; } - (void)animateRepeatedlyForDuration:(NSTimeInterval)inRepeatDuration withCompletionInvocation:(NSInvocation*)inInvocation finalStaticImage:(UIImage*)inFinalStaticImage { self.completionInvocation = inInvocation; _finalStillImage = [inFinalStaticImage retain]; [self startAnimationCycleWithCycleCount:0 repeatDuration:inRepeatDuration]; } - (void)pauseAnimation { CFTimeInterval pausedTime = [self convertTime:CACurrentMediaTime() fromLayer:nil]; self.speed = 0.0; self.timeOffset = pausedTime; } - (void)resumeAnimation { if ( 0.0 == self.speed ) { CFTimeInterval pausedTime = [self timeOffset]; self.speed = 1.0; self.timeOffset = 0.0; self.beginTime = 0.0; CFTimeInterval timeSincePause = [self convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime; self.beginTime = timeSincePause; } } #pragma mark - Class Methods +(NSDictionary*)configFromPropertList:(NSDictionary*)inPropertyList { if (inPropertyList == nil) { return nil; } MKDefaultAnimationObjectFactory* objectFactory = [[MKDefaultAnimationObjectFactory alloc] init]; NSDictionary* config = [MKSoundCoordinatedAnimationLayer configFromPropertList:inPropertyList usingObjectFactory:objectFactory]; [objectFactory release]; return config; } +(NSDictionary*)configFromPropertList:(NSDictionary*)inPropertyList usingObjectFactory:(id <MKSoundCoordinatedAnimationObjectFactory>)inObjectFactory { if (inPropertyList == nil) { return nil; } NSMutableDictionary* configDict = [NSMutableDictionary dictionaryWithCapacity:[inPropertyList count]]; for ( id dictKey in inPropertyList ) { // first check if this is the meta block if ( [kSCANMetaDataKey compare:dictKey] == NSOrderedSame ) { NSDictionary* metaProperties = [inPropertyList objectForKey:kSCANMetaDataKey]; NSMutableDictionary* metaConfig = [NSMutableDictionary dictionaryWithCapacity:[metaProperties count]]; // // still image // NSString* imageFileName = [metaProperties objectForKey:kSCANStillImageFileNameKey]; if ( imageFileName != nil ) { UIImage* image = [inObjectFactory getUIImageForFilename:imageFileName]; if (image != nil) { [metaConfig setObject:image forKey:kSCANStillImageObjectKey]; } } // // anchor values // NSNumber* anchorX = [metaProperties objectForKey:kSCANHorizontalAnchorKey]; if ( anchorX != nil ) { [metaConfig setObject:anchorX forKey:kSCANHorizontalAnchorKey]; } NSNumber* anchorY = [metaProperties objectForKey:kSCANVerticalAnchorKey]; if ( anchorY != nil ) { [metaConfig setObject:anchorY forKey:kSCANVerticalAnchorKey]; } // rotation and scale id rotValue = [metaProperties objectForKey:kSCANRotationPositionDegreesKey]; if ( rotValue != nil ) { [metaConfig setObject:rotValue forKey:kSCANRotationPositionDegreesKey]; } id scaleXValue = [metaProperties objectForKey:kSCANHorizontalScaleKey]; if ( scaleXValue != nil ) { [metaConfig setObject:scaleXValue forKey:kSCANHorizontalScaleKey]; } id scaleYValue = [metaProperties objectForKey:kSCANVerticalScaleKey]; if ( scaleYValue != nil ) { [metaConfig setObject:scaleYValue forKey:kSCANVerticalScaleKey]; } [configDict setObject:metaConfig forKey:kSCANMetaDataKey]; } else { NSNumber* timeKey = (NSNumber*)dictKey; NSDictionary* frameProperties = [inPropertyList objectForKey:timeKey]; NSMutableDictionary* frameConfig = [NSMutableDictionary dictionaryWithCapacity:[frameProperties count]]; // // frame sound // NSString* soundFileName = [frameProperties objectForKey:kSCANSoundFileNameKey]; if ( soundFileName != nil ) { AVAudioPlayer *player = [inObjectFactory getAVAudioPlayerForFilename:soundFileName]; if (player != nil) { [frameConfig setObject:player forKey:kSCANSoundObjectKey]; } } // // frame image // NSString* imageFileName = [frameProperties objectForKey:kSCANImageFileNameKey]; if ( imageFileName != nil ) { UIImage* image = [inObjectFactory getUIImageForFilename:imageFileName]; if (image != nil) { [frameConfig setObject:image forKey:kSCANImageObjectKey]; } } // // last frame duration // id durationObj = [frameProperties objectForKey:kSCANLastFrameDurationKey]; if ( durationObj != nil ) { [frameConfig setObject:durationObj forKey:kSCANLastFrameDurationKey]; } // // translations // id horizTransValue = [frameProperties objectForKey:kSCANHorizontalTranslationKey]; if ( horizTransValue != nil ) { [frameConfig setObject:horizTransValue forKey:kSCANHorizontalTranslationKey]; } id vertTransValue = [frameProperties objectForKey:kSCANVerticalTranslationKey]; if ( vertTransValue != nil ) { [frameConfig setObject:vertTransValue forKey:kSCANVerticalTranslationKey]; } id rotValue = [frameProperties objectForKey:kSCANRotationPositionDegreesKey]; if ( rotValue != nil ) { [frameConfig setObject:rotValue forKey:kSCANRotationPositionDegreesKey]; } // // alpha // id alphaValue = [frameProperties objectForKey:kSCANAlphaKey]; if ( alphaValue != nil ) { [frameConfig setObject:alphaValue forKey:kSCANAlphaKey]; } // // scale // id scaleXValue = [frameProperties objectForKey:kSCANHorizontalScaleKey]; if ( scaleXValue != nil ) { [frameConfig setObject:scaleXValue forKey:kSCANHorizontalScaleKey]; } id scaleYValue = [frameProperties objectForKey:kSCANVerticalScaleKey]; if ( scaleYValue != nil ) { [frameConfig setObject:scaleYValue forKey:kSCANVerticalScaleKey]; } // // anchor point // id anchorXValue = [frameProperties objectForKey:kSCANHorizontalAnchorKey]; if ( anchorXValue != nil ) { [frameConfig setObject:anchorXValue forKey:kSCANHorizontalAnchorKey]; } id anchorYValue = [frameProperties objectForKey:kSCANVerticalAnchorKey]; if ( anchorYValue != nil ) { [frameConfig setObject:anchorYValue forKey:kSCANVerticalAnchorKey]; } // // time key // [configDict setObject:frameConfig forKey:timeKey]; } } return configDict; } // // UIImage objects can shared between multiple instnaces of a given animation, but AVAudioPlayer objects // cannot because each animation instance may have a different play state. This method will "copy" a config // dictionary by producing an (autoreleased) copy of it where the UIImage objects are shared by the // AVAudioPlayer objects are distinct copies. +(NSDictionary*)copyConfig:(NSDictionary*)inConfig { NSMutableDictionary* newConfigDict = [NSMutableDictionary dictionaryWithCapacity:[inConfig count]]; for ( id dictKey in inConfig ) { // first check if this is the meta block if ( [kSCANMetaDataKey compare:dictKey] == NSOrderedSame ) { // just dump everthing [newConfigDict setObject:[inConfig objectForKey:kSCANMetaDataKey] forKey:kSCANMetaDataKey]; } else { NSNumber* timeKey = (NSNumber*)dictKey; NSDictionary* sourceFrameConfig = [inConfig objectForKey:timeKey]; NSMutableDictionary* frameConfig = [NSMutableDictionary dictionaryWithCapacity:[sourceFrameConfig count]]; // // create a new sound object // AVAudioPlayer* soundObj = [sourceFrameConfig objectForKey:kSCANSoundObjectKey]; if ( soundObj != nil ) { AVAudioPlayer* newSoundObj = nil; if ( soundObj.url != nil ) { NSError* sndErr; newSoundObj = [[[AVAudioPlayer alloc] initWithContentsOfURL:soundObj.url error:&sndErr] autorelease]; if ( sndErr != nil ) { NSLog(@"Error creating AVAudioPlayer with URL '%@': %@", soundObj.url, [sndErr localizedDescription]); newSoundObj = nil; } } else if ( soundObj.data != nil ) { NSError* sndErr; newSoundObj = [[[AVAudioPlayer alloc] initWithData:soundObj.data error:&sndErr] autorelease]; if ( sndErr != nil ) { NSLog(@"Error creating AVAudioPlayer from source data: %@", [sndErr localizedDescription]); newSoundObj = nil; } } if ( newSoundObj != nil ) { [frameConfig setObject:newSoundObj forKey:kSCANSoundObjectKey]; } } id imageObj = [sourceFrameConfig objectForKey:kSCANImageObjectKey]; if ( imageObj != nil ) { [frameConfig setObject:imageObj forKey:kSCANImageObjectKey]; } id durationObj = [sourceFrameConfig objectForKey:kSCANLastFrameDurationKey]; if ( durationObj != nil ) { [frameConfig setObject:durationObj forKey:kSCANLastFrameDurationKey]; } id horizTransValue = [sourceFrameConfig objectForKey:kSCANHorizontalTranslationKey]; if ( horizTransValue != nil ) { [frameConfig setObject:horizTransValue forKey:kSCANHorizontalTranslationKey]; } id vertTransValue = [sourceFrameConfig objectForKey:kSCANVerticalTranslationKey]; if ( vertTransValue != nil ) { [frameConfig setObject:vertTransValue forKey:kSCANVerticalTranslationKey]; } id rotValue = [sourceFrameConfig objectForKey:kSCANRotationPositionDegreesKey]; if ( rotValue != nil ) { [frameConfig setObject:rotValue forKey:kSCANRotationPositionDegreesKey]; } id alphaValue = [sourceFrameConfig objectForKey:kSCANAlphaKey]; if ( alphaValue != nil ) { [frameConfig setObject:alphaValue forKey:kSCANAlphaKey]; } id scaleXValue = [sourceFrameConfig objectForKey:kSCANHorizontalScaleKey]; if ( scaleXValue != nil ) { [frameConfig setObject:scaleXValue forKey:kSCANHorizontalScaleKey]; } id scaleYValue = [sourceFrameConfig objectForKey:kSCANVerticalScaleKey]; if ( scaleYValue != nil ) { [frameConfig setObject:scaleYValue forKey:kSCANVerticalScaleKey]; } id anchorXValue = [sourceFrameConfig objectForKey:kSCANHorizontalAnchorKey]; if ( anchorXValue != nil ) { [frameConfig setObject:anchorXValue forKey:kSCANHorizontalAnchorKey]; } id anchorYValue = [sourceFrameConfig objectForKey:kSCANVerticalAnchorKey]; if ( anchorYValue != nil ) { [frameConfig setObject:anchorYValue forKey:kSCANVerticalAnchorKey]; } [newConfigDict setObject:frameConfig forKey:timeKey]; } } return [newConfigDict retain]; } #pragma mark - Sound Management Methods - (void)soundPlayTimerFireMethod:(NSTimer*)theTimer { AVAudioPlayer* sound = (AVAudioPlayer*)[theTimer userInfo]; sound.delegate = self; [_playingSounds addObject:sound]; [sound play]; } - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)inPlayer successfully:(BOOL)inDidFinish { AVAudioPlayer* playingSound = [_playingSounds member:inPlayer]; if ( playingSound != nil ) { [playingSound stop]; playingSound.currentTime = 0; [playingSound prepareToPlay]; [_playingSounds removeObject:playingSound]; } } -(void)stopSounds { // first, remove times if (_soundTimers != nil) { for ( NSTimer* timer in _soundTimers ) { AVAudioPlayer* sound = (AVAudioPlayer*)[timer userInfo]; [sound stop]; [timer performSelectorOnMainThread:@selector(invalidate) withObject:nil waitUntilDone:YES]; } [_soundTimers release]; _soundTimers = nil; } for (AVAudioPlayer* playingSound in _playingSounds) { [playingSound stop]; playingSound.currentTime = 0; [playingSound prepareToPlay]; } [_playingSounds removeAllObjects]; } #pragma mark - Animation Code -(void)startAnimationCycleWithCycleCount:(NSUInteger)inCycleCount repeatDuration:(NSTimeInterval)inRepeatDuration { _animationStartPosition = self.position; if (_animationGroup == nil) { [self setUpAnimationFrames]; } [CATransaction lock]; [CATransaction begin]; NSTimeInterval duration = self.cycleDuration; _animationGroup.duration = duration; for (CAAnimation* animation in _animationGroup.animations) { animation.duration = duration; } if ( inCycleCount > 0 ) { _animationGroup.repeatCount = inCycleCount; _animationGroup.repeatDuration = 0; } else { _animationGroup.repeatCount = 0; _animationGroup.repeatDuration = inRepeatDuration; } if (_finalStillImage != nil) { [CATransaction begin]; [CATransaction setDisableActions:YES]; self.stillImage = _finalStillImage; [CATransaction commit]; [_finalStillImage release]; _finalStillImage = nil; } [self addAnimation:_animationGroup forKey:kSCANImageAndPositingAniamtionKey]; [CATransaction commit]; [CATransaction unlock]; [self performSelectorOnMainThread:@selector(setUpSoundTimers) withObject:nil waitUntilDone:NO]; } -(void)setUpSoundTimers { if ( !self.silenced && _soundPlayDict != nil && [_soundPlayDict count] > 0 ) { NSUInteger soundListSize = [_soundPlayDict count]; _soundTimers = [[NSMutableArray arrayWithCapacity:soundListSize] retain]; NSArray* timeKeys = [_soundPlayDict allKeys]; for ( NSNumber* key in timeKeys ) { NSTimeInterval keyValue = [key floatValue]; NSDate* fireTime = [NSDate dateWithTimeIntervalSinceNow:keyValue]; NSTimer* timer = [[[NSTimer alloc] initWithFireDate:fireTime interval:self.cycleDuration target:self selector:@selector(soundPlayTimerFireMethod:) userInfo:[_soundPlayDict objectForKey:key] repeats:YES] autorelease]; [_soundTimers addObject:timer]; [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode]; } } } // Stops the animation, either immediately or after the end of the current loop. -(void)stopAnimatingImmeditely:(BOOL)inImmediately { if ( inImmediately ) { if ( self.isAnimating ) { NSInvocation* invo = [self.completionInvocation retain]; self.completionInvocation = nil; [self removeAnimationForKey:kSCANImageAndPositingAniamtionKey]; if ( _animationGroup != nil ) { [_animationGroup release]; _animationGroup = nil; } // set the animating flag. Technically, the animation doesn't stop until the animationDidStop callback is called. _isAnimating = NO; if (invo != nil) { [invo invoke]; [invo release]; } } } else { NSLog(@"Defered animation stopping is not supported."); } } -(void)setUpAnimationFrames { if (self.isAnimating) { NSLog(@"setting up animation frames for %@, but already animating. Killing.", self); [self stopAnimatingImmeditely:YES]; } if ( _animationGroup != nil ) { [_animationGroup release]; _animationGroup = nil; } if ( _soundPlayDict != nil ) { [_soundPlayDict release]; _soundPlayDict = nil; } // // key times // normalize frame keys // CGFloat naturalDuration = self.naturalCycleDuration; if (naturalDuration <= 0) { NSLog(@"Error! Animation duration value = %f", naturalDuration ); return; } // first set up meta // NSDictionary* metaData = [self.config objectForKey:kSCANMetaDataKey]; BOOL hasMoveAnimation = NO; BOOL hasRotateAnimation = NO; BOOL hasAlphaAnimation = NO; BOOL hasAnchorAnimation = NO; NSMutableArray* anchorKeyArray = [NSMutableArray arrayWithCapacity:2]; NSMutableArray* anchorValueArray = [NSMutableArray arrayWithCapacity:2]; CGPoint anchorPositionOffset = CGPointMake(0, 0); if ( metaData != nil ) { NSNumber* anchorXValue = [metaData objectForKey:kSCANHorizontalAnchorKey]; NSNumber* anchorYValue = [metaData objectForKey:kSCANVerticalAnchorKey]; if ( (anchorXValue != nil) || (anchorYValue != nil) ) { CGFloat anchorX = (anchorXValue != nil) ? [anchorXValue floatValue] : self.anchorPoint.x; CGFloat anchorY = (anchorYValue != nil) ? [anchorYValue floatValue] : self.anchorPoint.y; CGPoint anchorPt = CGPointMake(anchorX, anchorY); [anchorKeyArray addObject:[NSNumber numberWithFloat:0]]; [anchorValueArray addObject:[NSValue valueWithCGPoint:anchorPt]]; [anchorKeyArray addObject:[NSNumber numberWithFloat:1]]; [anchorValueArray addObject:[NSValue valueWithCGPoint:anchorPt]]; anchorPositionOffset = CGPointMake((anchorPt.x - self.anchorPoint.x )*self.bounds.size.width, ( anchorPt.y - self.anchorPoint.y)*self.bounds.size.height); hasAnchorAnimation = YES; hasMoveAnimation = YES; } } NSMutableArray* imageKeyArray = [NSMutableArray arrayWithCapacity:[_sortedFrameKeys count]]; NSMutableArray* imageArray = [NSMutableArray arrayWithCapacity:[_sortedFrameKeys count]]; NSMutableArray* positionKeyArray = [NSMutableArray arrayWithCapacity:[_sortedFrameKeys count]]; CGMutablePathRef positionPath = CGPathCreateMutable(); CGPoint firstPt = CGPointMake( self.position.x + anchorPositionOffset.x, self.position.y + anchorPositionOffset.y ); [positionKeyArray addObject:[NSNumber numberWithFloat:0]]; CGPathMoveToPoint(positionPath,NULL, firstPt.x, firstPt.y); NSMutableArray* rotationKeyArray = [NSMutableArray arrayWithCapacity:[_sortedFrameKeys count]]; NSMutableArray* rotationValueArray = [NSMutableArray arrayWithCapacity:[_sortedFrameKeys count]]; // set initial to identity CATransform3D firstTransform = CATransform3DMakeScale(1.0, 1.0, 1.0); [rotationKeyArray addObject:[NSNumber numberWithFloat:0]]; [rotationValueArray addObject:[NSValue valueWithCATransform3D:firstTransform]]; NSMutableArray* alphaKeyArray = [NSMutableArray arrayWithCapacity:[_sortedFrameKeys count]]; NSMutableArray* alphaValueArray = [NSMutableArray arrayWithCapacity:[_sortedFrameKeys count]]; _soundPlayDict = [[NSMutableDictionary dictionaryWithCapacity:[_sortedFrameKeys count]] retain]; NSUInteger frameIndex = 0; UIImage* firstImage = nil; for ( NSNumber* frameKey in _sortedFrameKeys ) { NSNumber* normalizedFrameKey = [NSNumber numberWithFloat:([frameKey floatValue]/naturalDuration)]; // // first determine if the frame has an image // NSDictionary* datum = [self.config objectForKey:frameKey]; UIImage* image = [datum objectForKey:kSCANImageObjectKey]; if ( image != nil ) { [imageKeyArray addObject:normalizedFrameKey]; [imageArray addObject:(id)image.CGImage]; if ( firstImage == nil ) { firstImage = image; } } NSNumber* horizDelta = [datum objectForKey:kSCANHorizontalTranslationKey]; NSNumber* vertDelta = [datum objectForKey:kSCANVerticalTranslationKey]; if ( horizDelta != nil || vertDelta != nil ) { hasMoveAnimation = YES; if (horizDelta == nil) { horizDelta = [NSNumber numberWithFloat:0]; } if (vertDelta == nil) { vertDelta = [NSNumber numberWithFloat:0]; } [positionKeyArray addObject:normalizedFrameKey]; CGPathAddLineToPoint(positionPath, NULL, firstPt.x + [horizDelta floatValue], firstPt.y + [vertDelta floatValue]); } // // Add Rotation & Scale // NSNumber* rotationValue = [datum objectForKey:kSCANRotationPositionDegreesKey]; NSNumber* scaleXValue = [datum objectForKey:kSCANHorizontalScaleKey]; NSNumber* scaleYValue = [datum objectForKey:kSCANVerticalScaleKey]; if ( (rotationValue != nil)||(scaleXValue != nil)||(scaleYValue != nil) ) { hasRotateAnimation = YES; CGFloat rotRadians = (rotationValue != nil) ? [rotationValue floatValue]*(M_PI/180.0) : 0.0; CGFloat scaleX = (scaleXValue != nil) ? [scaleXValue floatValue] : 1.0; CGFloat scaleY = (scaleYValue != nil) ? [scaleYValue floatValue] : 1.0; CATransform3D rotTransform = CATransform3DConcat(firstTransform, CATransform3DMakeRotation( rotRadians, 0, 0, 1)); CATransform3D finalTransform = CATransform3DConcat( rotTransform, CATransform3DMakeScale(scaleX, scaleY, 1.0)); [rotationKeyArray addObject:normalizedFrameKey]; [rotationValueArray addObject:[NSValue valueWithCATransform3D:finalTransform]]; } // // add sound // AVAudioPlayer* sound = [datum objectForKey:kSCANSoundObjectKey]; if ( sound != nil ) { [_soundPlayDict setObject:sound forKey:frameKey]; } // // add alpha // NSNumber* alphaValue = [datum objectForKey:kSCANAlphaKey]; if (alphaValue != nil) { [alphaKeyArray addObject:normalizedFrameKey]; [alphaValueArray addObject:alphaValue]; hasAlphaAnimation = YES; } // // get ready for next // frameIndex++; } // add return to hom path NSNumber* lastKey = [NSNumber numberWithFloat:1.0]; if ( ![positionKeyArray containsObject:lastKey] ) { [positionKeyArray addObject:lastKey]; CGPathAddLineToPoint(positionPath, NULL, firstPt.x, firstPt.y); } if ( ![rotationKeyArray containsObject:lastKey] ) { [rotationKeyArray addObject:lastKey]; [rotationValueArray addObject:[NSValue valueWithCATransform3D:firstTransform]]; } // must all image at time key 1.0 so that loops works correctly if (firstImage != nil && ![imageKeyArray containsObject:lastKey]) { [imageKeyArray addObject:lastKey]; [imageArray addObject:(id)firstImage.CGImage]; } // // set up the animation // NSTimeInterval cycleDuration = self.cycleDuration; CAKeyframeAnimation* imageAnimation = nil; if ([imageArray count] > 0 ) { imageAnimation = [CAKeyframeAnimation animationWithKeyPath:@"contents"]; imageAnimation.keyTimes = imageKeyArray; imageAnimation.calculationMode = kCAAnimationDiscrete; imageAnimation.values = imageArray; imageAnimation.duration = cycleDuration; imageAnimation.delegate = self; } CAKeyframeAnimation* positionAnimation = nil; if ( hasMoveAnimation ) { positionAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; positionAnimation.keyTimes = positionKeyArray; positionAnimation.calculationMode = kCAAnimationLinear; positionAnimation.path = positionPath; positionAnimation.duration = cycleDuration; positionAnimation.delegate = self; } CFRelease(positionPath); CAKeyframeAnimation* rotationAnimation = nil; if ( hasRotateAnimation ) { rotationAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; rotationAnimation.keyTimes = rotationKeyArray; rotationAnimation.calculationMode = kCAAnimationLinear; rotationAnimation.values = rotationValueArray; rotationAnimation.duration = cycleDuration; rotationAnimation.delegate = self; } CAKeyframeAnimation* alphaAnimation = nil; if (hasAlphaAnimation) { alphaAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"]; alphaAnimation.keyTimes = alphaKeyArray; alphaAnimation.calculationMode = kCAAnimationLinear; alphaAnimation.values = alphaValueArray; alphaAnimation.duration = cycleDuration; alphaAnimation.delegate = self; } CAKeyframeAnimation* anchorAnimation = nil; if (hasAnchorAnimation) { anchorAnimation = [CAKeyframeAnimation animationWithKeyPath:@"anchorPoint"]; anchorAnimation.keyTimes = anchorKeyArray; anchorAnimation.calculationMode = kCAAnimationDiscrete; anchorAnimation.values = anchorValueArray; anchorAnimation.duration = cycleDuration; anchorAnimation.delegate = self; } // // create the group // CAAnimationGroup *theGroup = [CAAnimationGroup animation]; theGroup.duration = cycleDuration; theGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; NSMutableArray* animationList = [NSMutableArray arrayWithCapacity:3]; if ( imageAnimation != nil ) { [animationList addObject:imageAnimation]; } if ( positionAnimation != nil ) { [animationList addObject:positionAnimation]; } if ( rotationAnimation != nil ) { [animationList addObject:rotationAnimation]; } if ( alphaAnimation != nil ) { [animationList addObject:alphaAnimation]; } if ( anchorAnimation != nil ) { [animationList addObject:anchorAnimation]; } theGroup.animations = animationList; theGroup.delegate = self; theGroup.removedOnCompletion = YES; _animationGroup = [theGroup retain]; } - (void)animationDidStart:(CAAnimation *)inAnimation { _isAnimating = YES; } - (void)animationDidStop:(CAAnimation *)inAnimation finished:(BOOL)inDidFinish { _isAnimating = NO; [self stopSounds]; if ( inDidFinish ) { } [_animationGroup release]; _animationGroup = nil; [_soundPlayDict release]; _soundPlayDict = nil; self.contents = (id)self.stillImage.CGImage; self.contentsScale = self.stillImage.scale; if (inDidFinish && self.completionInvocation != nil ) { NSInvocation* invo = [self.completionInvocation retain]; // set to nil prior to invoke in case invoke sets up a new animation with it's own invocation self.completionInvocation = nil; [invo invoke]; [invo release]; } } @end #pragma mark - Default Animation Object Factory @implementation MKDefaultAnimationObjectFactory -(UIImage*)getUIImageForFilename:(NSString*)inFilename { if (inFilename != nil) { NSString* pathStr; // // if it is desired to load a specific localization, this code will need to be altered to use [NSBundle pathForResource:ofType:inDirectory:forLocalization:] // pathStr = [[NSBundle mainBundle] pathForResource:inFilename ofType:nil]; if ( pathStr != nil ) { UIImage* image = [UIImage imageWithContentsOfFile:pathStr]; if ( image != nil ) { return image; } else { NSLog( @"MKDefaultAnimationObjectFactory: Could not create image with file path '%@'", pathStr ); } } } return nil; } -(AVAudioPlayer*)getAVAudioPlayerForFilename:(NSString*)inFilename { if ( inFilename != nil ) { NSString* pathStr; // // if it is desired to load a specific localization, this code will need to be altered to use [NSBundle pathForResource:ofType:inDirectory:forLocalization:] // pathStr = [[NSBundle mainBundle] pathForResource:inFilename ofType:nil]; if ( pathStr != nil ) { NSError* sndErr; NSURL *fileURL = [NSURL fileURLWithPath:pathStr isDirectory:NO]; AVAudioPlayer *player = [[[ AVAudioPlayer alloc ] initWithContentsOfURL:fileURL error:(&sndErr) ] autorelease]; if (sndErr == nil) { [player prepareToPlay]; return player; } else { NSLog(@"MKDefaultAnimationObjectFactory: Error creating AVAudioPlayer with file path '%@': %@", pathStr, [sndErr localizedDescription]); } } } return nil; } @end
{ "pile_set_name": "Github" }
`define WB_PAGE_OFFSET_OFF 32'h0 `define WB_SPARE_SPACE_WR_OFF 32'h10 `define WB_SPARE_SPACE_RD_OFF 32'h18 `define WB_ERASE_OFF 32'h20 `define WB_STATUS_OFF 32'h28 `define WB_WRITE_OFF 32'h30 `define WB_READ_OFF 32'h38 // Wishbone Addresses used for FTL -> NAND_ECC_INLINE and NAND_ECC_INLINE -> NANDC `define WB0_FLASH_BASEADDR 32'h0000_0000 `define WB0_REG_BASEADDR 32'h1000_0000 `define WB0_FLASH_S 'd0 `define WB0_FLASH_N 'd1020 `define WB0_PAGE_OFFSET_BASEADDR (`WB0_REG_BASEADDR + `WB_PAGE_OFFSET_OFF) `define WB0_SPARE_SPACE_WR_BASEADDR (`WB0_REG_BASEADDR + `WB_SPARE_SPACE_WR_OFF) `define WB0_SPARE_SPACE_RD_BASEADDR (`WB0_REG_BASEADDR + `WB_SPARE_SPACE_RD_OFF) `define WB0_ERASE_BASEADDR (`WB0_REG_BASEADDR + `WB_ERASE_OFF) `define WB0_STATUS_BASEADDR (`WB0_REG_BASEADDR + `WB_STATUS_OFF) // Wishbone Addresses used for NAND_ECC_INLINE_CPU -> NANDC `define WB1_FLASH_BASEADDR 32'h0000_0000 `define WB1_REG_BASEADDR 32'h1000_0000 `define WB1_FLASH_S 'd1020 `define WB1_FLASH_N 'd4 `define WB1_PAGE_OFFSET_BASEADDR (`WB1_REG_BASEADDR + `WB_PAGE_OFFSET_OFF) `define WB1_SPARE_SPACE_WR_BASEADDR (`WB1_REG_BASEADDR + `WB_SPARE_SPACE_WR_OFF) `define WB1_SPARE_SPACE_RD_BASEADDR (`WB1_REG_BASEADDR + `WB_SPARE_SPACE_RD_OFF) `define WB1_ERASE_BASEADDR (`WB1_REG_BASEADDR + `WB_ERASE_OFF) `define WB1_STATUS_BASEADDR (`WB1_REG_BASEADDR + `WB_STATUS_OFF) `define WB1_WRITE_BASEADDR (`WB1_REG_BASEADDR + `WB_WRITE_OFF) `define WB1_READ_BASEADDR (`WB1_REG_BASEADDR + `WB_READ_OFF) // Wishbone Addresses used for CPU -> NAND_ECC_INLINE_CPU `define WBCPU_FLASH_BASEADDR 32'ha000_0000 `define WBCPU_REG_BASEADDR 32'ha000_1000 `define WBCPU_FLASH_S `WB1_FLASH_S `define WBCPU_FLASH_N `WB1_FLASH_N `define WBCPU_PAGE_OFFSET_BASEADDR (`WBCPU_REG_BASEADDR + `WB_PAGE_OFFSET_OFF) `define WBCPU_SPARE_SPACE_WR_BASEADDR (`WBCPU_REG_BASEADDR + `WB_SPARE_SPACE_WR_OFF) `define WBCPU_SPARE_SPACE_RD_BASEADDR (`WBCPU_REG_BASEADDR + `WB_SPARE_SPACE_RD_OFF) `define WBCPU_ERASE_BASEADDR (`WBCPU_REG_BASEADDR + `WB_ERASE_OFF) `define WBCPU_STATUS_BASEADDR (`WBCPU_REG_BASEADDR + `WB_STATUS_OFF) `define WBCPU_WRITE_BASEADDR (`WBCPU_REG_BASEADDR + `WB_WRITE_OFF) `define WBCPU_READ_BASEADDR (`WBCPU_REG_BASEADDR + `WB_READ_OFF) `define WB_FLASH_BASEADDR 32'h0000_0000 `define WB_REG_BASEADDR 32'h1000_0000 `define WB_FLASH_S 'd0 `define WB_FLASH_N 'd1024
{ "pile_set_name": "Github" }
# Contributing ## Creating your changes 1. Fork, then clone the repo: `git clone git@github.com:your-username/barrelsby.git` 2. Install dependencies: `npm install` 3. Make your changes. 4. Make sure the tests pass: `npm test` 5. Push to your fork and [submit a pull request][pullrequest]. [pullrequest]: https://github.com/bencoveney/barrelsby/compare/ If you are developing on windows you may need to convert line endings to unix-style. You can do this in git bash by running `find . -type f -exec dos2unix {} \;`. ## Requirements If you are interested in contributing to barrelsby there are plenty of tagged issues that can be picked up, or feel free to suggest your own feature in an issue. Most coding conventions are enforced by TSLint but in general: - Use small functions instead of classes. - Avoid abreviated identifiers. - Write a unit test (`fileName.test.ts`) for code changes. - Write an integration test (`test/feature/`) for option changes.
{ "pile_set_name": "Github" }
#sharing { a.twitter { color: $twitter_color; } a.facebook { color: $facebook_color; } a.google-plus { color: $gplus_color; } a.whatsapp { color: $whatsapp_color; } a.email { color: $fs-logo-blue-color; } i.fa { margin-left: 20px; } } nav, .nav-wrapper { background: #333; @include box-shadow(none); @include transition(0.5s all ease-in); } .navbar-fixed.bevel nav { @include box-shadow(0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12)); } #header { @media only screen and (max-width: 600px) and (min-width: 360px) { .nav-wrapper { width: 100%; } } @media only screen and (max-width: 600px) { .nav-wrapper > ul { > li > a > i.fa { height: 56px; line-height: 56px; } } } @media only screen and (max-width: 514px) { .nav-wrapper .right > li:last-child { display: none; } } @media only screen and (max-width: 360px) { .nav-wrapper .left > li:first-child { display: none; } } } #header a:hover { border: none; } //#header, nav { // height: 150px; // // h1 { // margin: 6.1rem 0 2.68rem 0; // } //}
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/half_transparent_black" android:orientation="vertical" android:padding="6dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="@string/part_beauty" android:textColor="@android:color/white" android:layout_marginBottom="6dp"/> <ImageView android:id="@+id/switch_beauty" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:gravity="center" android:src="@drawable/guan" android:layout_marginBottom="6dp"/> <TableLayout android:id="@+id/layout_beauty_adjust_second" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="top" android:stretchColumns="1"> <TableRow android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical"> <TextView style="@style/beauty_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/eyemagnify" /> <SeekBar android:id="@+id/seekbar_eyemagnify" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/text_eyemagnify" style="@style/beauty_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" /> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical"> <TextView style="@style/beauty_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/faceSculpt" /> <SeekBar android:id="@+id/seekbar_faceSculpt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> <TextView android:id="@+id/text_faceSculpt" style="@style/beauty_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" /> </TableRow> </TableLayout> </LinearLayout>
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <!DOCTYPE ipe SYSTEM "ipe.dtd"> <ipe version="70206" creator="Ipe 7.2.7"> <info created="D:20181112141931" modified="D:20181127095235"/> <ipestyle name="basic"> <symbol name="arrow/arc(spx)"> <path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen"> 0 0 m -1 0.333 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/farc(spx)"> <path stroke="sym-stroke" fill="white" pen="sym-pen"> 0 0 m -1 0.333 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/ptarc(spx)"> <path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen"> 0 0 m -1 0.333 l -0.8 0 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/fptarc(spx)"> <path stroke="sym-stroke" fill="white" pen="sym-pen"> 0 0 m -1 0.333 l -0.8 0 l -1 -0.333 l h </path> </symbol> <symbol name="mark/circle(sx)" transformations="translations"> <path fill="sym-stroke"> 0.6 0 0 0.6 0 0 e 0.4 0 0 0.4 0 0 e </path> </symbol> <symbol name="mark/disk(sx)" transformations="translations"> <path fill="sym-stroke"> 0.6 0 0 0.6 0 0 e </path> </symbol> <symbol name="mark/fdisk(sfx)" transformations="translations"> <group> <path fill="sym-fill"> 0.5 0 0 0.5 0 0 e </path> <path fill="sym-stroke" fillrule="eofill"> 0.6 0 0 0.6 0 0 e 0.4 0 0 0.4 0 0 e </path> </group> </symbol> <symbol name="mark/box(sx)" transformations="translations"> <path fill="sym-stroke" fillrule="eofill"> -0.6 -0.6 m 0.6 -0.6 l 0.6 0.6 l -0.6 0.6 l h -0.4 -0.4 m 0.4 -0.4 l 0.4 0.4 l -0.4 0.4 l h </path> </symbol> <symbol name="mark/square(sx)" transformations="translations"> <path fill="sym-stroke"> -0.6 -0.6 m 0.6 -0.6 l 0.6 0.6 l -0.6 0.6 l h </path> </symbol> <symbol name="mark/fsquare(sfx)" transformations="translations"> <group> <path fill="sym-fill"> -0.5 -0.5 m 0.5 -0.5 l 0.5 0.5 l -0.5 0.5 l h </path> <path fill="sym-stroke" fillrule="eofill"> -0.6 -0.6 m 0.6 -0.6 l 0.6 0.6 l -0.6 0.6 l h -0.4 -0.4 m 0.4 -0.4 l 0.4 0.4 l -0.4 0.4 l h </path> </group> </symbol> <symbol name="mark/cross(sx)" transformations="translations"> <group> <path fill="sym-stroke"> -0.43 -0.57 m 0.57 0.43 l 0.43 0.57 l -0.57 -0.43 l h </path> <path fill="sym-stroke"> -0.43 0.57 m 0.57 -0.43 l 0.43 -0.57 l -0.57 0.43 l h </path> </group> </symbol> <symbol name="arrow/fnormal(spx)"> <path stroke="sym-stroke" fill="white" pen="sym-pen"> 0 0 m -1 0.333 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/pointed(spx)"> <path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen"> 0 0 m -1 0.333 l -0.8 0 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/fpointed(spx)"> <path stroke="sym-stroke" fill="white" pen="sym-pen"> 0 0 m -1 0.333 l -0.8 0 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/linear(spx)"> <path stroke="sym-stroke" pen="sym-pen"> -1 0.333 m 0 0 l -1 -0.333 l </path> </symbol> <symbol name="arrow/fdouble(spx)"> <path stroke="sym-stroke" fill="white" pen="sym-pen"> 0 0 m -1 0.333 l -1 -0.333 l h -1 0 m -2 0.333 l -2 -0.333 l h </path> </symbol> <symbol name="arrow/double(spx)"> <path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen"> 0 0 m -1 0.333 l -1 -0.333 l h -1 0 m -2 0.333 l -2 -0.333 l h </path> </symbol> <pen name="heavier" value="0.8"/> <pen name="fat" value="1.2"/> <pen name="ultrafat" value="2"/> <symbolsize name="large" value="5"/> <symbolsize name="small" value="2"/> <symbolsize name="tiny" value="1.1"/> <arrowsize name="large" value="10"/> <arrowsize name="small" value="5"/> <arrowsize name="tiny" value="3"/> <color name="red" value="1 0 0"/> <color name="green" value="0 1 0"/> <color name="blue" value="0 0 1"/> <color name="yellow" value="1 1 0"/> <color name="orange" value="1 0.647 0"/> <color name="gold" value="1 0.843 0"/> <color name="purple" value="0.627 0.125 0.941"/> <color name="gray" value="0.745"/> <color name="brown" value="0.647 0.165 0.165"/> <color name="navy" value="0 0 0.502"/> <color name="pink" value="1 0.753 0.796"/> <color name="seagreen" value="0.18 0.545 0.341"/> <color name="turquoise" value="0.251 0.878 0.816"/> <color name="violet" value="0.933 0.51 0.933"/> <color name="darkblue" value="0 0 0.545"/> <color name="darkcyan" value="0 0.545 0.545"/> <color name="darkgray" value="0.663"/> <color name="darkgreen" value="0 0.392 0"/> <color name="darkmagenta" value="0.545 0 0.545"/> <color name="darkorange" value="1 0.549 0"/> <color name="darkred" value="0.545 0 0"/> <color name="lightblue" value="0.678 0.847 0.902"/> <color name="lightcyan" value="0.878 1 1"/> <color name="lightgray" value="0.827"/> <color name="lightgreen" value="0.565 0.933 0.565"/> <color name="lightyellow" value="1 1 0.878"/> <dashstyle name="dashed" value="[4] 0"/> <dashstyle name="dotted" value="[1 3] 0"/> <dashstyle name="dash dotted" value="[4 2 1 2] 0"/> <dashstyle name="dash dot dotted" value="[4 2 1 2 1 2] 0"/> <textsize name="large" value="\large"/> <textsize name="Large" value="\Large"/> <textsize name="LARGE" value="\LARGE"/> <textsize name="huge" value="\huge"/> <textsize name="Huge" value="\Huge"/> <textsize name="small" value="\small"/> <textsize name="footnote" value="\footnotesize"/> <textsize name="tiny" value="\tiny"/> <textstyle name="center" begin="\begin{center}" end="\end{center}"/> <textstyle name="itemize" begin="\begin{itemize}" end="\end{itemize}"/> <textstyle name="item" begin="\begin{itemize}\item{}" end="\end{itemize}"/> <gridsize name="4 pts" value="4"/> <gridsize name="8 pts (~3 mm)" value="8"/> <gridsize name="16 pts (~6 mm)" value="16"/> <gridsize name="32 pts (~12 mm)" value="32"/> <gridsize name="10 pts (~3.5 mm)" value="10"/> <gridsize name="20 pts (~7 mm)" value="20"/> <gridsize name="14 pts (~5 mm)" value="14"/> <gridsize name="28 pts (~10 mm)" value="28"/> <gridsize name="56 pts (~20 mm)" value="56"/> <anglesize name="90 deg" value="90"/> <anglesize name="60 deg" value="60"/> <anglesize name="45 deg" value="45"/> <anglesize name="30 deg" value="30"/> <anglesize name="22.5 deg" value="22.5"/> <opacity name="10%" value="0.1"/> <opacity name="30%" value="0.3"/> <opacity name="50%" value="0.5"/> <opacity name="75%" value="0.75"/> <tiling name="falling" angle="-60" step="4" width="1"/> <tiling name="rising" angle="30" step="4" width="1"/> </ipestyle> <ipestyle name="my_stylesheet"> <symbol name="arrow/arc(spx)"> <path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen"> 0 0 m -1 0.333 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/farc(spx)"> <path stroke="sym-stroke" fill="white" pen="sym-pen"> 0 0 m -1 0.333 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/ptarc(spx)"> <path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen"> 0 0 m -1 0.333 l -0.8 0 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/fptarc(spx)"> <path stroke="sym-stroke" fill="white" pen="sym-pen"> 0 0 m -1 0.333 l -0.8 0 l -1 -0.333 l h </path> </symbol> <symbol name="mark/circle(sx)" transformations="translations"> <path fill="sym-stroke"> 0.6 0 0 0.6 0 0 e 0.4 0 0 0.4 0 0 e </path> </symbol> <symbol name="mark/disk(sx)" transformations="translations"> <path fill="sym-stroke"> 0.6 0 0 0.6 0 0 e </path> </symbol> <symbol name="mark/fdisk(sfx)" transformations="translations"> <group> <path fill="sym-fill"> 0.5 0 0 0.5 0 0 e </path> <path fill="sym-stroke" fillrule="eofill"> 0.6 0 0 0.6 0 0 e 0.4 0 0 0.4 0 0 e </path> </group> </symbol> <symbol name="mark/box(sx)" transformations="translations"> <path fill="sym-stroke" fillrule="eofill"> -0.6 -0.6 m 0.6 -0.6 l 0.6 0.6 l -0.6 0.6 l h -0.4 -0.4 m 0.4 -0.4 l 0.4 0.4 l -0.4 0.4 l h </path> </symbol> <symbol name="mark/square(sx)" transformations="translations"> <path fill="sym-stroke"> -0.6 -0.6 m 0.6 -0.6 l 0.6 0.6 l -0.6 0.6 l h </path> </symbol> <symbol name="mark/fsquare(sfx)" transformations="translations"> <group> <path fill="sym-fill"> -0.5 -0.5 m 0.5 -0.5 l 0.5 0.5 l -0.5 0.5 l h </path> <path fill="sym-stroke" fillrule="eofill"> -0.6 -0.6 m 0.6 -0.6 l 0.6 0.6 l -0.6 0.6 l h -0.4 -0.4 m 0.4 -0.4 l 0.4 0.4 l -0.4 0.4 l h </path> </group> </symbol> <symbol name="mark/cross(sx)" transformations="translations"> <group> <path fill="sym-stroke"> -0.43 -0.57 m 0.57 0.43 l 0.43 0.57 l -0.57 -0.43 l h </path> <path fill="sym-stroke"> -0.43 0.57 m 0.57 -0.43 l 0.43 -0.57 l -0.57 0.43 l h </path> </group> </symbol> <symbol name="arrow/fnormal(spx)"> <path stroke="sym-stroke" fill="white" pen="sym-pen"> 0 0 m -1 0.333 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/pointed(spx)"> <path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen"> 0 0 m -1 0.333 l -0.8 0 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/fpointed(spx)"> <path stroke="sym-stroke" fill="white" pen="sym-pen"> 0 0 m -1 0.333 l -0.8 0 l -1 -0.333 l h </path> </symbol> <symbol name="arrow/linear(spx)"> <path stroke="sym-stroke" pen="sym-pen"> -1 0.333 m 0 0 l -1 -0.333 l </path> </symbol> <symbol name="arrow/fdouble(spx)"> <path stroke="sym-stroke" fill="white" pen="sym-pen"> 0 0 m -1 0.333 l -1 -0.333 l h -1 0 m -2 0.333 l -2 -0.333 l h </path> </symbol> <symbol name="arrow/double(spx)"> <path stroke="sym-stroke" fill="sym-stroke" pen="sym-pen"> 0 0 m -1 0.333 l -1 -0.333 l h -1 0 m -2 0.333 l -2 -0.333 l h </path> </symbol> <pen name="heavier" value="0.8"/> <pen name="fat" value="1.2"/> <pen name="ultrafat" value="2"/> <symbolsize name="large" value="5"/> <symbolsize name="small" value="2"/> <symbolsize name="tiny" value="1.1"/> <arrowsize name="large" value="10"/> <arrowsize name="small" value="5"/> <arrowsize name="tiny" value="3"/> <color name="red" value="1 0 0"/> <color name="green" value="0 1 0"/> <color name="blue" value="0 0 1"/> <color name="yellow" value="1 1 0"/> <color name="orange" value="1 0.647 0"/> <color name="gold" value="1 0.843 0"/> <color name="purple" value="0.627 0.125 0.941"/> <color name="gray" value="0.745"/> <color name="brown" value="0.647 0.165 0.165"/> <color name="navy" value="0 0 0.502"/> <color name="pink" value="1 0.753 0.796"/> <color name="seagreen" value="0.18 0.545 0.341"/> <color name="turquoise" value="0.251 0.878 0.816"/> <color name="violet" value="0.933 0.51 0.933"/> <color name="darkblue" value="0 0 0.545"/> <color name="darkcyan" value="0 0.545 0.545"/> <color name="darkgray" value="0.663"/> <color name="darkgreen" value="0 0.392 0"/> <color name="darkmagenta" value="0.545 0 0.545"/> <color name="darkorange" value="1 0.549 0"/> <color name="darkred" value="0.545 0 0"/> <color name="lightblue" value="0.678 0.847 0.902"/> <color name="lightcyan" value="0.878 1 1"/> <color name="lightgray" value="0.827"/> <color name="lightgreen" value="0.565 0.933 0.565"/> <color name="lightyellow" value="1 1 0.878"/> <color name="csn_p1_blue1" value="0.122 0.47 0.706"/> <color name="csn_p2_blue2" value="0.651 0.808 0.89"/> <color name="csn_p4_green1" value="0.698 0.874 0.541"/> <color name="csn_p3_green2" value="0.2 0.628 0.173"/> <color name="csn_p6_red1" value="0.984 0.604 0.6"/> <color name="csn_p5_red2" value="0.89 0.102 0.11"/> <color name="csn_p8_orange1" value="0.992 0.749 0.435"/> <color name="csn_p7_orange2" value="1 0.5 0"/> <color name="csn_p10_violet1" value="0.792 0.698 0.839"/> <color name="csn_p9_violet2" value="0.416 0.239 0.604"/> <color name="csn_p12_yellow" value="1 1 0.6"/> <color name="csn_p11_brown" value="0.694 0.349 0.157"/> <dashstyle name="dashed" value="[4] 0"/> <dashstyle name="dotted" value="[1 3] 0"/> <dashstyle name="dash dotted" value="[4 2 1 2] 0"/> <dashstyle name="dash dot dotted" value="[4 2 1 2 1 2] 0"/> <textsize name="large" value="\large"/> <textsize name="Large" value="\Large"/> <textsize name="LARGE" value="\LARGE"/> <textsize name="huge" value="\huge"/> <textsize name="Huge" value="\Huge"/> <textsize name="small" value="\small"/> <textsize name="footnote" value="\footnotesize"/> <textsize name="tiny" value="\tiny"/> <textstyle name="center" begin="\begin{center}" end="\end{center}"/> <textstyle name="itemize" begin="\begin{itemize}" end="\end{itemize}"/> <textstyle name="item" begin="\begin{itemize}\item{}" end="\end{itemize}"/> <gridsize name="4 pts" value="4"/> <gridsize name="8 pts (~3 mm)" value="8"/> <gridsize name="16 pts (~6 mm)" value="16"/> <gridsize name="32 pts (~12 mm)" value="32"/> <gridsize name="10 pts (~3.5 mm)" value="10"/> <gridsize name="20 pts (~7 mm)" value="20"/> <gridsize name="14 pts (~5 mm)" value="14"/> <gridsize name="28 pts (~10 mm)" value="28"/> <gridsize name="56 pts (~20 mm)" value="56"/> <anglesize name="90 deg" value="90"/> <anglesize name="60 deg" value="60"/> <anglesize name="45 deg" value="45"/> <anglesize name="30 deg" value="30"/> <anglesize name="22.5 deg" value="22.5"/> <opacity name="10%" value="0.1"/> <opacity name="30%" value="0.3"/> <opacity name="50%" value="0.5"/> <opacity name="75%" value="0.75"/> <tiling name="falling" angle="-60" step="4" width="1"/> <tiling name="rising" angle="30" step="4" width="1"/> </ipestyle> <page> <layer name="alpha"/> <view layers="alpha" active="alpha"/> <path layer="alpha" matrix="1 0 0 1 52 96" stroke="black" pen="fat"> 288 448 m 288 432 l 384 432 l 384 448 l h </path> <path matrix="1 0 0 1 52 96" stroke="black"> 320 448 m 320 432 l </path> <path matrix="1 0 0 1 52 96" stroke="black"> 352 448 m 352 432 l </path> <path matrix="1 0 0 1 52 0" stroke="csn_p5_red2" pen="fat" arrow="fptarc/normal"> 272 536 m 376 536 l </path> <text matrix="1 0 0 1 284 -240" transformations="translations" pos="40 776" stroke="csn_p5_red2" type="label" width="23.246" height="6.661" depth="1.93" halign="right" valign="baseline">input</text> <text matrix="1 0 0 1 252 -224" transformations="translations" pos="112 776" stroke="black" type="label" width="4.981" height="6.42" depth="0" valign="baseline">0</text> <text matrix="1 0 0 1 284 -224" transformations="translations" pos="112 776" stroke="black" type="label" width="4.981" height="6.42" depth="0" valign="baseline">1</text> <text matrix="1 0 0 1 316 -224" transformations="translations" pos="112 776" stroke="black" type="label" width="4.981" height="6.42" depth="0" valign="baseline">2</text> <path matrix="1 0 0 1 52 48" stroke="black" pen="fat"> 288 448 m 288 432 l 384 432 l 384 448 l h </path> <path matrix="1 0 0 1 52 48" stroke="black"> 320 448 m 320 432 l </path> <path matrix="1 0 0 1 52 48" stroke="black"> 352 448 m 352 432 l </path> <path matrix="1 0 0 1 244 -144" stroke="csn_p1_blue1" pen="fat" arrow="fptarc/normal"> 104 632 m 208 632 l </path> <text matrix="1 0 0 1 244 -136" transformations="translations" pos="208 624" stroke="csn_p1_blue1" type="label" width="29.335" height="6.135" depth="1.93" valign="baseline">output</text> <path matrix="1 0 0 1 52 0" stroke="csn_p7_orange2" pen="fat" arrow="fptarc/normal"> 336 528 m 336 496 l </path> <path matrix="1 0 0 1 52 0" stroke="csn_p7_orange2" pen="fat" arrow="fptarc/normal"> 304 528 m 304 496 l </path> <path matrix="1 0 0 1 52 0" stroke="csn_p7_orange2" pen="fat" arrow="fptarc/normal"> 368 528 m 368 496 l </path> </page> </ipe>
{ "pile_set_name": "Github" }
var name = "Noise-Bringer"; var collection_type = 0; var is_secret = 1; var desc = "Made metal music for sloths"; var status_text = "For rocking the sloth, an unconvincing air guitar salute to you, Noise-Bringer: Widdly-widdly-widdy-widdly-weeee! You brought the noise! Have a badge!"; var last_published = 1348801937; var is_shareworthy = 1; var url = "noisebringer"; var category = "industrial"; var url_swf = "http:\/\/c2.glitch.bz\/achievements\/2012-06-14\/noisebringer_1339712660.swf"; var url_img_180 = "http:\/\/c2.glitch.bz\/achievements\/2012-06-14\/noisebringer_1339712660_180.png"; var url_img_60 = "http:\/\/c2.glitch.bz\/achievements\/2012-06-14\/noisebringer_1339712660_60.png"; var url_img_40 = "http:\/\/c2.glitch.bz\/achievements\/2012-06-14\/noisebringer_1339712660_40.png"; function on_apply(pc){ } var conditions = { 790 : { type : "counter", group : "sloths", label : "played_music_for", value : "1" }, }; function onComplete(pc){ // generated from rewards var multiplier = pc.buffs_has('gift_of_gab') ? 1.2 : pc.buffs_has('silvertongue') ? 1.05 : 1.0; multiplier += pc.imagination_get_achievement_modifier(); if (/completist/i.exec(this.name)) { var level = pc.stats_get_level(); if (level > 4) { multiplier *= (pc.stats_get_level()/4); } } pc.stats_add_xp(round_to_5(400 * multiplier), true); pc.stats_add_favor_points("zille", round_to_5(80 * multiplier)); if(pc.buffs_has('gift_of_gab')) { pc.buffs_remove('gift_of_gab'); } else if(pc.buffs_has('silvertongue')) { pc.buffs_remove('silvertongue'); } } var rewards = { "xp" : 400, "favor" : { "giant" : "zille", "points" : 80 } }; //log.info("noisebringer.js LOADED"); // generated ok (NO DATE)
{ "pile_set_name": "Github" }
using System; namespace Serenity.ComponentModel { /// <summary> /// Controls if this field is editable in update record mode. /// When used with fields, turns on or off the updatable flag. /// </summary> public class UpdatableAttribute : Attribute { /// <summary> /// Controls if this field is editable in update record mode. /// When used with fields, turns on or off the updatable flag. /// </summary> /// <param name="updatable">True to make field updatable</param> public UpdatableAttribute(bool updatable = true) { this.Value = updatable; } /// <summary> /// Gets a value indicating whether this <see cref="UpdatableAttribute"/> is enabled. /// </summary> /// <value> /// <c>true</c> if enabled; otherwise, <c>false</c>. /// </value> public bool Value { get; private set; } } }
{ "pile_set_name": "Github" }
.\" @(#)plot.3x 6.2 (Berkeley) 5/15/86 .\" .TH PLOT 3X "May 15, 1986" .AT 3 .SH NAME plot: openpl, erase, label, line, circle, arc, move, cont, point, linemod, space, closepl \- graphics interface .SH SYNOPSIS .nf .B openpl() .PP .B erase() .PP .B label(s) .B char s[]; .PP .B line(x1, y1, x2, y2) .PP .B circle(x, y, r) .PP .B arc(x, y, x0, y0, x1, y1) .PP .B move(x, y) .PP .B cont(x, y) .PP .B point(x, y) .PP .B linemod(s) .B char s[]; .PP .B space(x0, y0, x1, y1) .PP .B closepl() .fi .PP .ft R .SH DESCRIPTION These subroutines generate graphic output in a relatively device-independent manner. See .IR plot (5) for a description of their effect. .I Openpl must be used before any of the others to open the device for writing. .I Closepl flushes the output. .PP String arguments to .I label and .I linemod are null-terminated, and do not contain newlines. .PP Various flavors of these functions exist for different output devices. They are obtained by the following .IR ld (1) options: .TP 8n .B \-lplot device-independent graphics stream on standard output for .IR plot (1) filters .br .ns .TP .B \-l300 GSI 300 terminal .br .ns .TP .B \-l300s GSI 300S terminal .br .ns .TP .B \-l450 GSI 450 terminal .br .ns .TP .B \-l4013 Tektronix 4013 terminal .br .ns .TP .B \-l4014 Tektronix 4014 and 4015 terminals with the Enhanced Graphics Module (Use .B \-l4013 for 4014's or 4015's without the Enhanced Graphics Module) .br .ns .TP .B \-lplotaed AED 512 color graphics terminal .br .ns .TP .B \-lplotbg BBN bitgraph graphics terminal .br .ns .TP .B \-lplotdumb Dumb terminals without cursor addressing or line printers .br .ns .TP .B \-lplot DEC Gigi terminals .br .ns .TP .B \-lvt0 DEC vt100 terminals .br .ns .TP .B \-lplot2648 Hewlett Packard 2648 graphics terminal .br .ns .TP .B \-lplot7221 Hewlett Packard 7221 graphics terminal .br .ns .TP .B \-lplotimagen Imagen laser printer (default 240 dots-per-inch resolution). .PP On many devices, it is necessary to pause after .IR erase (), otherwise plotting commands are lost. The pause is normally done by the tty driver if at login time, .I tset found a .I df field in the .IR termcap (5) entry for the terminal. If a pause is needed but not automatically being generated, add .RS .nf flush(stdout); sleep(1); .fi .RE after each .IR erase (). .SH "SEE ALSO" plot(5), plot(1G), plot(3F), graph(1G)
{ "pile_set_name": "Github" }
//+build !go1.9 package reflect2 import ( "unsafe" ) //go:linkname makemap reflect.makemap func makemap(rtype unsafe.Pointer) (m unsafe.Pointer) func makeMapWithSize(rtype unsafe.Pointer, cap int) unsafe.Pointer { return makemap(rtype) }
{ "pile_set_name": "Github" }
local _, L = ... local locale = GetLocale() L.RESET_MODEL = "Reset current model" L.PLAYER_BUTTON_TEXT = "P" L.PLAYER_BUTTON_TOOLTIP = "Player character" L.TARGET_BUTTON_TEXT = "T" L.TARGET_BUTTON_TOOLTIP = "Target model" L.TARGET_GEAR_BUTTON_TEXT = "TG" L.TARGET_GEAR_BUTTON_TOOLTIP = "Target gear" L.TARGET_GEAR_BUTTON_TOOLTIP_NEWBIE = [[Target gear > Left-click to equip all items worn > Right-click to skip head, shirt and tabard]] L.UNDRESS_BUTTON_TEXT = "U" L.UNDRESS_BUTTON_TOOLTIP = "Undress unit" L.UNDRESS_BUTTON_TEXT_FULL = "Undress" L["Options"] = "Options" L["Set target"] = "Set target" L["Race"] = "Race" L["Gender"] = "Gender" L["Undress"] = "Undress" L["Reset"] = "Reset" L["Alliance"] = "Alliance" L["Horde"] = "Horde" L["Allied Races"] = "Allied Races" if locale == "deDE" then elseif locale == "esES" then elseif locale == "esMX" then elseif locale == "frFR" then elseif locale == "itIT" then elseif locale == "koKR" then elseif locale == "ptBR" then elseif locale == "ruRU" then elseif locale == "zhCN" or locale == "zhTW" then L.RESET_MODEL = "重置" L.PLAYER_BUTTON_TEXT = "自" L.PLAYER_BUTTON_TOOLTIP = "玩家自身模型" L.TARGET_BUTTON_TEXT = "目模" L.TARGET_BUTTON_TOOLTIP = "使用目标模型" L.TARGET_GEAR_BUTTON_TEXT = "目装" L.TARGET_GEAR_BUTTON_TOOLTIP = "试穿目标装备" L.TARGET_GEAR_BUTTON_TOOLTIP_NEWBIE = [[试穿目标装备 > 左键点击 试穿全部物品 > 右键点击 忽略头部、衬衫和战袍]] L.UNDRESS_BUTTON_TEXT = "脱" L.UNDRESS_BUTTON_TOOLTIP = "脱光所有装备" L.UNDRESS_BUTTON_TEXT_FULL = "脱光" L["Options"] = "试穿助手选项" L["Set target"] = "设为目标模型" L["Race"] = "种族" L["Gender"] = "性别" L["Undress"] = "脱下" L["Reset"] = "重置" L["Alliance"] = "联盟" L["Horde"] = "部落" L["Allied Races"] = "同盟种族" end
{ "pile_set_name": "Github" }
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_Service * @subpackage Ebay * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Items.php 22804 2010-08-08 05:08:05Z renanbr $ */ /** * @see Zend_Service_Ebay_Finding_Response_Histograms */ require_once 'Zend/Service/Ebay/Finding/Response/Histograms.php'; /** * @category Zend * @package Zend_Service * @subpackage Ebay * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @uses Zend_Service_Ebay_Finding_Response_Histograms */ class Zend_Service_Ebay_Finding_Response_Items extends Zend_Service_Ebay_Finding_Response_Histograms { /** * @link http://developer.ebay.com/DevZone/finding/CallRef/types/PaginationInput.html */ const PAGE_MAX_DEFAULT = 100; const PAGE_MAX_INFINITY = 0; /** * Indicates the pagination of the result set. * * Child elements indicate the page number that is returned, the maximum * number of item listings to return per page, total number of pages that * can be returned, and the total number of listings that match the search * criteria. * * @var Zend_Service_Ebay_Finding_PaginationOutput */ public $paginationOutput; /** * Container for the item listings that matched the search criteria. * * The data for each item is returned in individual containers, if any * matches were found. * * @var Zend_Service_Ebay_Finding_Search_Result */ public $searchResult; /** * @var Zend_Service_Ebay_Finding_Response_Items[] */ protected static $_pageCache = array(); /** * @return void */ protected function _init() { parent::_init(); $ns = Zend_Service_Ebay_Finding::XMLNS_FINDING; $this->_attributes['searchResult'] = array( 'count' => $this->_query(".//$ns:searchResult[1]/@count[1]", 'string') ); $node = $this->_xPath->query(".//$ns:searchResult[1]", $this->_dom)->item(0); if ($node) { /** * @see Zend_Service_Ebay_Finding_Search_Result */ require_once 'Zend/Service/Ebay/Finding/Search/Result.php'; $this->searchResult = new Zend_Service_Ebay_Finding_Search_Result($node); } $node = $this->_xPath->query(".//$ns:paginationOutput[1]", $this->_dom)->item(0); if ($node) { /** * @see Zend_Service_Ebay_Finding_PaginationOutput */ require_once 'Zend/Service/Ebay/Finding/PaginationOutput.php'; $this->paginationOutput = new Zend_Service_Ebay_Finding_PaginationOutput($node); } } /** * @param Zend_Service_Ebay_Finding $proxy * @param integer $number * @throws Zend_Service_Ebay_Finding_Exception When $number is invalid * @return Zend_Service_Ebay_Finding_Response_Items */ public function page(Zend_Service_Ebay_Finding $proxy, $number) { // check page number if ($number < 1 || $number > $this->paginationOutput->totalPages) { /** * @see Zend_Service_Ebay_Finding_Exception */ require_once 'Zend/Service/Ebay/Finding/Exception.php'; throw new Zend_Service_Ebay_Finding_Exception( "Page number '{$number}' is out of range."); } // prepare arguments $arguments = array(); switch ($this->_operation) { case 'findItemsAdvanced': $arguments[] = $this->getOption('keywords'); $arguments[] = $this->getOption('descriptionSearch'); $arguments[] = $this->getOption('categoryId'); break; case 'findItemsByCategory': $arguments[] = $this->getOption('categoryId'); break; case 'findItemsByKeywords': $arguments[] = $this->getOption('keywords'); break; case 'findItemsByProduct': $productId = $this->getOption('productId'); if (!is_array($productId)) { $productId = array('' => $productId); } $arguments[] = array_key_exists('', $productId) ? $productId[''] : null; $arguments[] = array_key_exists('type', $productId) ? $productId['type'] : null; break; case 'findItemsIneBayStores': $arguments[] = $this->getOption('storeName'); break; default: /** * @see Zend_Service_Ebay_Finding_Exception */ require_once 'Zend/Service/Ebay/Finding/Exception.php'; throw new Zend_Service_Ebay_Finding_Exception( "Invalid operation '{$this->_operation}'."); } // prepare options // remove every pagination entry from current option list $options = $this->_options; foreach (array_keys($options) as $optionName) { if (substr($optionName, 0, 15) == 'paginationInput') { unset($options[$optionName]); } } // set new pagination values // see more at http://developer.ebay.com/DevZone/finding/CallRef/types/PaginationInput.html $entriesPerPage = $this->paginationOutput->entriesPerPage; $options['paginationInput'] = array('entriesPerPage' => $entriesPerPage, 'pageNumber' => $number); // add current options as last argument ksort($options); $arguments[] = $options; // verify cache $id = serialize($arguments); if (!array_key_exists($id, self::$_pageCache)) { if ($number == $this->paginationOutput->pageNumber) { // add itself to cache $new = $this; } else { // request new page $callback = array($proxy, $this->_operation); $new = call_user_func_array($callback, $arguments); } self::$_pageCache[$id] = $new; } return self::$_pageCache[$id]; } /** * @param Zend_Service_Ebay_Finding $proxy * @return Zend_Service_Ebay_Finding_Response_Items */ public function pageFirst(Zend_Service_Ebay_Finding $proxy) { return $this->page($proxy, 1); } /** * @param Zend_Service_Ebay_Finding $proxy * @param integer $max * @return Zend_Service_Ebay_Finding_Response_Items */ public function pageLast(Zend_Service_Ebay_Finding $proxy, $max = self::PAGE_MAX_DEFAULT) { $last = $this->paginationOutput->totalPages; if ($max > 0 && $last > $max) { $last = $max; } return $this->page($proxy, $last); } /** * @param Zend_Service_Ebay_Finding $proxy * @param integer $max * @return Zend_Service_Ebay_Finding_Response_Items */ public function pageNext(Zend_Service_Ebay_Finding $proxy, $max = self::PAGE_MAX_DEFAULT) { $next = $this->paginationOutput->pageNumber + 1; $last = $this->paginationOutput->totalPages; if (($max > 0 && $next > $max) || $next > $last) { return null; } return $this->page($proxy, $next); } /** * @param Zend_Service_Ebay_Finding $proxy * @return Zend_Service_Ebay_Finding_Response_Items */ public function pagePrevious(Zend_Service_Ebay_Finding $proxy) { $previous = $this->paginationOutput->pageNumber - 1; if ($previous < 1) { return null; } return $this->page($proxy, $previous); } }
{ "pile_set_name": "Github" }
package org.fossasia.phimpme.data.local; import io.realm.Realm; import io.realm.RealmQuery; import io.realm.RealmResults; /** Created by pa1pal on 10/6/17. */ public class DatabaseHelper { private Realm realm; public DatabaseHelper(Realm realm) { this.realm = realm; } public RealmQuery<AccountDatabase> fetchAccountDetails() { return realm.where(AccountDatabase.class); } public void deleteSignedOutAccount(String accountName) { final RealmResults<AccountDatabase> deletionQueryResult = realm.where(AccountDatabase.class).equalTo("name", accountName).findAll(); realm.executeTransaction( new Realm.Transaction() { @Override public void execute(Realm realm) { deletionQueryResult.deleteAllFromRealm(); } }); } /** * Store the image description * * @param item Image desc model object */ public void addImageDesc(ImageDescModel item) { realm.beginTransaction(); ImageDescModel u = realm.createObject(ImageDescModel.class, item.getId()); u.setTitle(item.getTitle()); realm.commitTransaction(); } /** * Description is getting through the match of path of the image * * @param path Path passes as a parameter * @return model object */ public ImageDescModel getImageDesc(String path) { ImageDescModel result = realm.where(ImageDescModel.class).equalTo("path", path).findFirst(); return result; } public void update(ImageDescModel item) { realm.beginTransaction(); realm.copyToRealmOrUpdate(item); realm.commitTransaction(); } public void delete(ImageDescModel item) { realm.beginTransaction(); item.deleteFromRealm(); realm.commitTransaction(); } }
{ "pile_set_name": "Github" }
RGBLIGHT_ENABLE = yes BACKLIGHT_ENABLE = yes MOUSEKEY_ENABLE = yes
{ "pile_set_name": "Github" }
{% if header %} <div class="usa-overlay"></div> {% if header.type == 'basic' %} <header class="usa-header usa-header--basic" role="banner"> {% elsif header.type == 'basic-mega' %} <header class="usa-header usa-header--basic usa-header--basic-megamenu" role="banner"> {% elsif header.type == 'extended' or header.type == 'extended-mega' %} <header class="usa-header usa-header--extended" role="banner"> {% endif %} {% if header.type == 'basic' or header.type == 'basic-mega' %} <div class="usa-nav-container"> {% endif %} <div class="usa-navbar"> <div class="usa-logo" id="header-logo"> <a href="{% if header.href %}{{ header.href }}{% else %}{{ site.baseurl }}/{% endif %}" title="Home"> {% if header.logo %} <img class="usa-logo-img" src="{% if header.logo.external %}{{ header.logo.src }}{% else %}{{ header.logo.src | relative_url }}{% endif %}" alt="{{ header.logo.alt }}"> {% endif %} <em class="usa-logo__text"> {{ header.title | default: site.title }} </em> </a> </div> <button class="usa-menu-btn">Menu</button> </div> <nav role="navigation" class="usa-nav"> <div class="usa-nav__inner"> <button class="usa-nav__close"> <img src="{{ site.baseurl }}/assets/uswds/img/close.svg" alt="close"> </button> {% assign _primary = header.primary.links %} {% assign primary_links = site.data.navigation[_primary] | default: _primary %} {% if primary_links %} <ul class="usa-nav__primary usa-accordion"> {% for _section in primary_links %} <li class="usa-nav__primary-item"> {% if _section.links %} {% assign section_links = site.data.navigation[_section.links] | default: _section.links %} {% assign _section_id = _section.id %} {% unless _section_id %}{% assign _section_id = 'nav-' | append: forloop.index %}{% endunless %} <button class="usa-accordion__button usa-nav__link" aria-expanded="false" aria-controls="{{ _section_id }}"> <span>{{ _section.text }}</span> </button> {% if header.type == 'basic' or header.type == 'extended' %} <ul id="{{ _section_id }}" class="usa-nav__submenu"> {% endif %} {% if header.type == 'basic-mega' or header.type == 'extended-mega' %} <div id="{{ _section_id }}" class="usa-nav__submenu usa-megamenu"> <div class="grid-row grid-gap-4"> {% endif %} {% for _link in section_links %} {% if header.type == 'basic-mega' or header.type == 'extended-mega' %} <!-- wrap every 3 links in a usa-megamenu-col div --> {% capture modulo %}{{ forloop.index | modulo: 3 }}{% endcapture %} {% if modulo == '1' %} <div class="desktop:grid-col-3"> <ul class="usa-nav__submenu-list"> {% endif %} {% endif %} <li class="usa-nav__submenu-item"> <a href="{% if _link.external %}{{ _link.href }}{% else %}{{ _link.href | relative_url }}{% endif %}">{{ _link.text }}</a> </li> {% if header.type == 'basic-mega' or header.type == 'extended-mega' %} {% if modulo == '0' or forloop.last %} </ul> </div> {% endif %} {% endif %} {% endfor %} {% if header.type == 'basic' or header.type == 'extended' %} </ul> {% endif %} {% if header.type == 'basic-mega' or header.type == 'extended-mega' %} </div><!-- /grid-row --> </div> {% endif %} {% else %} {% assign basedir = page.url | remove_first: '/' | split: '/' | first | lstrip %} {% assign linkdir = _section.href | replace: "/", "" | lstrip %} <a class="{% if _section.class %}{{ _section.class }}{% else %} usa-nav__link {% endif %} {% if linkdir == basedir %} usa-current{% endif %}" href="{% if _section.external %}{{ _section.href }}{% else %}{{ _section.href | relative_url }}{% endif %}"> <span>{{ _section.text }}</span> </a> {% endif %} </li> {% endfor %} </ul> {% endif %} {% if header.type == 'basic' or header.type == 'basic-mega' %} {% assign _secondary = header.secondary %} {% if site.search_site_handle %} <form accept-charset="UTF-8" action="https://search.usa.gov/search" id="search_form" method="get" class="usa-search usa-search--small js-search-form"> <input name="utf8" type="hidden" value="&#x2713;" /> <input id="affiliate" name="affiliate" type="hidden" value="{{ site.search_site_handle }}" /> <div role="search"> <label for="query" class="usa-sr-only">Enter Search Term(s):</label> <input autocomplete="off" class="usa-input usagov-search-autocomplete" id="query" name="query" type="search" /> <button class="usa-button" type="submit" name="commit"> <span class="usa-sr-only">Search</span> </button> </div> </form> {% endif %} {% endif %} {% if header.type == 'extended' or header.type == 'extended-mega' %} {% assign _secondary = header.secondary %} <div class="usa-nav__secondary"> <ul class="usa-unstyled-list usa-nav__secondary-links"> {% assign secondary_links = site.data.navigation[_secondary.links] | default: _secondary.links %} {% for _link in secondary_links %} <li class="usa-nav__secondary-item"> <a href="{% if _link.external %}{{ _link.href }}{% else %}{{ _link.href | relative_url }}{% endif %}" {% if _link.class %} class="{{ _link.class }}" {% endif %}> {{ _link.text }} </a> </li> {% endfor %} </ul> {% if site.search_site_handle %} <form accept-charset="UTF-8" action="https://search.usa.gov/search" id="search_form" method="get" class="usa-search usa-search--small js-search-form"> <input name="utf8" type="hidden" value="&#x2713;" /> <input type="hidden" name="affiliate" id="affiliate" value="{{ site.search_site_handle }}" /> <div role="search"> <label for="query" class="usa-sr-only">Enter search terms</label> <input autocomplete="off" class="usa-input usagov-search-autocomplete" id="query" name="query" type="search" /> <button class="usa-button" type="submit" name="commit"> <span class="usa-sr-only">Search</span> </button> </div> </form> {% endif %} </div> {% endif %} </div> </div> </nav> {% if header.type == 'basic' or header.type == 'basic-mega' %} </div> {% endif %} </header> {% endif %}
{ "pile_set_name": "Github" }
// // Alerts // -------------------------------------------------- // Base styles // ------------------------- .alert { padding: @alert-padding; margin-bottom: @line-height-computed; border: 1px solid transparent; border-radius: @alert-border-radius; // Headings for larger alerts h4 { margin-top: 0; // Specified for the h4 to prevent conflicts of changing @headings-color color: inherit; } // Provide class for links that match alerts .alert-link { font-weight: @alert-link-font-weight; } // Improve alignment and spacing of inner content > p, > ul { margin-bottom: 0; } > p + p { margin-top: 5px; } } // Dismissible alerts // // Expand the right padding and account for the close button's positioning. .alert-dismissable, // The misspelled .alert-dismissable was deprecated in 3.2.0. .alert-dismissible { padding-right: (@alert-padding + 20); // Adjust close link position .close { position: relative; top: -2px; right: -21px; color: inherit; } } // Alternate styles // // Generate contextual modifier classes for colorizing the alert. .alert-success { .alert-variant(@alert-success-bg; @alert-success-border; @alert-success-text); } .alert-info { .alert-variant(@alert-info-bg; @alert-info-border; @alert-info-text); } .alert-warning { .alert-variant(@alert-warning-bg; @alert-warning-border; @alert-warning-text); } .alert-danger { .alert-variant(@alert-danger-bg; @alert-danger-border; @alert-danger-text); }
{ "pile_set_name": "Github" }
<?php /* * This file is part of the overtrue/wechat. * * (c) overtrue <i@overtrue.me> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ /** * Order. * * @author overtrue <i@overtrue.me> * @copyright 2015 overtrue <i@overtrue.me> * * @see https://github.com/overtrue * @see http://overtrue.me */ namespace EasyWeChat\Payment; use EasyWeChat\Support\Attribute; /** * Class Order. * * @property string $body * @property string $detail * @property string $attach * @property string $out_trade_no * @property string $fee_type * @property string $total_fee * @property string $spbill_create_ip * @property string $time_start * @property string $time_expire * @property string $goods_tag * @property string $notify_url * @property string $trade_type * @property string $product_id * @property string $limit_pay * @property string $openid * @property string $sub_openid * @property string $auth_code */ class Order extends Attribute { const JSAPI = 'JSAPI'; const NATIVE = 'NATIVE'; const APP = 'APP'; const MICROPAY = 'MICROPAY'; protected $attributes = [ 'body', 'detail', 'attach', 'out_trade_no', 'fee_type', 'total_fee', 'spbill_create_ip', 'time_start', 'time_expire', 'goods_tag', 'notify_url', 'trade_type', 'product_id', 'limit_pay', 'openid', 'sub_openid', 'auth_code', ]; /** * Constructor. * * @param array $attributes */ public function __construct(array $attributes) { parent::__construct($attributes); } }
{ "pile_set_name": "Github" }
var crypto = require('crypto'); var bcrypt = require('bcrypt-nodejs'); var mongoose = require('mongoose') , Schema = mongoose.Schema , ObjectId = Schema.ObjectId; /////////////////////////////////////////////// //// SET YOUR APP.JSON DETAILS //// ///////////////////////////////////////////// //Not working ? try double dots on the json url.. var myModule = require('../app.json'); var sitename = myModule.sitename var website = myModule.website var repo = myModule.repo var schemaOptions = { timestamps: true, toJSON: { virtuals: true } }; var userSchema = new mongoose.Schema({ name: String, lastname: String, email: { type: String, unique: true}, password: String, bio: String, plan: { name: String,//The plan type saved on braintree braintreeid: String, //The plan ID saved on braintree payfast :Schema.Types.Mixed, }, paypalsubscriber : String, //true or false phone: String, fax: String, braintreeid:String,//Used to query the braintree customer payment details. username: String, firstsignup: String, passwordResetToken: String, permission: String,//Administrator/Editor/Author/Contributor/Subscriber passwordResetExpires: Date, company: String, location: String, website: String, picture: String, image: String, facebook: String, twitter: String, google: String, publicemail:String, github: String, vk: String }, schemaOptions); /////////////////////////////////////// //// SIGN UP EMAIL SEND //// ///////////////////////////////////// function signupEmail(user){ var port = process.env.MAIL_PORT var useremail = process.env.MAIL_USERNAME var passwords = process.env.MAIL_PASSWORD var host = process.env.MAIL_HOST var temp = {} 'use strict'; var nodemailer = require('nodemailer'); // create reusable transporter object using the default SMTP transport var transporter = nodemailer.createTransport({ host: host, tls: { rejectUnauthorized: false }, secure: false, // secure:true for port 465, secure:false for port 587 auth: { user: useremail, pass: passwords, } }); var mailOptions = { from: user.username + ' ' + '<'+ user.email + '>', // sender address to: process.env.MAIL_USERNAME, // list of receivers subject: '✔ A user has edited their information '+ sitename + '.', // Subject line html: '<h2>The following user has been edited.</h2><p>Code :</p> <pre>'+user+'</pre>', } // send mail with defined transport object transporter.sendMail(mailOptions, (error, info) => { if (error) { return console.log(error); } }); } userSchema.pre('save', function(next) { var user = this; if (!user.username) { user.username = user.name.replace(/\s/g,'') } //issues with Github and google blank usernames if (user.username =="") { user.username = user.name.replace(/\s/g,'') } signupEmail(user) if (!user.isModified('password')) { return next(); } bcrypt.genSalt(10, function(err, salt) { bcrypt.hash(user.password, salt, null, function(err, hash) { user.password = hash; next(); }); }); }); userSchema.methods.comparePassword = function(password, cb) { bcrypt.compare(password, this.password, function(err, isMatch) { cb(err, isMatch); }); }; userSchema.virtual('gravatar').get(function() { if (!this.get('email')) { return 'https://gravatar.com/avatar/?s=200&d=retro'; } var md5 = crypto.createHash('md5').update(this.get('email')).digest('hex'); return 'https://gravatar.com/avatar/' + md5 + '?s=200&d=retro'; }); userSchema.options.toJSON = { transform: function(doc, ret, options) { delete ret.password; delete ret.passwordResetToken; delete ret.passwordResetExpires; } }; var User = mongoose.model('User', userSchema); module.exports = User;
{ "pile_set_name": "Github" }
LIBRARY api-ms-win-core-synch-l1-2-0.dll EXPORTS DeleteSynchronizationBarrier EnterSynchronizationBarrier InitOnceBeginInitialize InitOnceComplete InitOnceExecuteOnce InitOnceInitialize InitializeConditionVariable InitializeSynchronizationBarrier SignalObjectAndWait Sleep SleepConditionVariableCS SleepConditionVariableSRW WaitOnAddress WakeAllConditionVariable WakeByAddressAll WakeByAddressSingle WakeConditionVariable
{ "pile_set_name": "Github" }
/* * Copyright (C) 2012-2018 The Android Money Manager Ex Project Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.money.manager.ex.settings; import android.content.Context; import android.content.SharedPreferences; import com.google.common.primitives.Ints; import com.money.manager.ex.R; /** * Handles sync-related preferences. */ public class SyncPreferences extends SettingsBase { public SyncPreferences(Context context) { super(context); } /** * Delete all preferences. */ public void clear() { getPreferences().edit().clear().apply(); } public boolean get(Integer key, boolean defaultValue) { return getPreferences().getBoolean(getKey(key), defaultValue); } public String get(Integer key, String defaultValue) { return getPreferences().getString(getKey(key), defaultValue); } @Override protected SharedPreferences getPreferences() { return getContext().getSharedPreferences(PreferenceConstants.SYNC_PREFERENCES, Context.MODE_PRIVATE); } public boolean isSyncEnabled() { return get(R.string.pref_sync_enabled, false); } public int getSyncInterval() { int defaultSchedule = 30; // time in minutes String setSchedule = get(R.string.pref_sync_interval, Integer.toString(defaultSchedule)); Integer scheduleInt = Ints.tryParse(setSchedule); if (scheduleInt == null) return defaultSchedule; return scheduleInt; } public boolean getUploadImmediately() { return get(R.string.pref_upload_immediately, true); } public String loadPreference(Integer key, String defaultValue) { String realKey = getContext().getString(key); return getPreferences().getString(realKey, defaultValue); } public void setSyncEnabled(boolean value) { set(R.string.pref_sync_enabled, value); } /** * Set synchronization period. * @param value Sync frequency in minutes. */ public void setSyncInterval(int value) { set(R.string.pref_sync_interval, Integer.toString(value)); } public boolean shouldSyncOnlyOnWifi() { return get(R.string.pref_sync_via_wifi, false); } // private private String getKey(Integer resourceId) { return getContext().getString(resourceId); } }
{ "pile_set_name": "Github" }
package org.apache.helix.participant; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.helix.SystemPropertyKeys; import org.apache.helix.zookeeper.api.client.HelixZkClient; import org.apache.helix.HelixConstants.ChangeType; import org.apache.helix.HelixDataAccessor; import org.apache.helix.HelixManager; import org.apache.helix.PropertyKey.Builder; import org.apache.helix.manager.zk.ZKHelixDataAccessor; import org.apache.helix.manager.zk.ZkBaseDataAccessor; import org.apache.helix.model.IdealState; import org.apache.helix.model.IdealState.RebalanceMode; import org.apache.helix.zookeeper.api.client.RealmAwareZkClient; import org.apache.helix.zookeeper.datamodel.serializer.ZNRecordSerializer; import org.apache.helix.zookeeper.impl.client.FederatedZkClient; import org.apache.helix.zookeeper.impl.factory.SharedZkClientFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This provides the ability for users to run a custom code in exactly one * process using a LeaderStandBy state model. <br/> * A typical use case is when one uses CUSTOMIZED ideal state mode where the * assignment of partition to nodes needs to change dynamically as the nodes go * online/offline.<br/> * <code> * HelixCustomCodeRunner runner = new HelixCustomCodeRunner(manager,ZK_ADDR); * runner * .invoke(_callback) * .on(ChangeType.LIVE_INSTANCE, ChangeType.IdealState) * .usingLeaderStandbyModel("someUniqueId") * .start() * </code> */ public class HelixCustomCodeRunner { private static final String LEADER_STANDBY = "LeaderStandby"; private static Logger LOG = LoggerFactory.getLogger(HelixCustomCodeRunner.class); private static String PARTICIPANT_LEADER = "PARTICIPANT_LEADER"; private CustomCodeCallbackHandler _callback; private List<ChangeType> _notificationTypes; private String _resourceName; private final HelixManager _manager; private final String _zkAddr; private final RealmAwareZkClient.RealmAwareZkConnectionConfig _connectionConfig; private GenericLeaderStandbyStateModelFactory _stateModelFty; /** * Constructs a HelixCustomCodeRunner that will run exactly in one place * @param manager * @param zkAddr */ public HelixCustomCodeRunner(HelixManager manager, String zkAddr) { _manager = manager; _zkAddr = zkAddr; _connectionConfig = null; } /** * Constructs a HelixCustomCodeRunner that will be run on multi-zk mode. * @param manager * @param connectionConfig config with a multi-realm fields set */ public HelixCustomCodeRunner(HelixManager manager, RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig) { _manager = manager; _zkAddr = null; _connectionConfig = connectionConfig; } /** * callback to invoke when there is a change in cluster state specified by on( * notificationTypes) This callback must be idempotent which means they should * not depend on what changed instead simply read the cluster data and act on * it. * @param callback * @return */ public HelixCustomCodeRunner invoke(CustomCodeCallbackHandler callback) { _callback = callback; return this; } /** * ChangeTypes interested in, ParticipantLeaderCallback.callback method will * be invoked on the * @param notificationTypes * @return */ public HelixCustomCodeRunner on(ChangeType... notificationTypes) { _notificationTypes = Arrays.asList(notificationTypes); return this; } public HelixCustomCodeRunner usingLeaderStandbyModel(String id) { _resourceName = PARTICIPANT_LEADER + "_" + id; return this; } /** * Get resource name for the custom-code runner * Used for retrieving the external view for the custom-code runner resource * @return resource name for the custom-code runner */ public String getResourceName() { return _resourceName; } /** * This method will be invoked when there is a change in any subscribed * notificationTypes * @throws Exception */ public void start() throws Exception { if (_callback == null || _notificationTypes == null || _notificationTypes.size() == 0 || _resourceName == null) { throw new IllegalArgumentException("Require callback | notificationTypes | resourceName"); } LOG.info("Register participantLeader on " + _notificationTypes + " using " + _resourceName); _stateModelFty = new GenericLeaderStandbyStateModelFactory(_callback, _notificationTypes); StateMachineEngine stateMach = _manager.getStateMachineEngine(); stateMach.registerStateModelFactory(LEADER_STANDBY, _stateModelFty, _resourceName); RealmAwareZkClient zkClient = null; try { // manually add ideal state for participant leader using LeaderStandby // model if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED) || _zkAddr == null) { // Use multi-zk mode (FederatedZkClient) RealmAwareZkClient.RealmAwareZkClientConfig clientConfig = new RealmAwareZkClient.RealmAwareZkClientConfig(); clientConfig.setZkSerializer(new ZNRecordSerializer()); zkClient = new FederatedZkClient(_connectionConfig, clientConfig); } else { // Use single-zk mode using the ZkAddr given HelixZkClient.ZkClientConfig clientConfig = new HelixZkClient.ZkClientConfig(); clientConfig.setZkSerializer(new ZNRecordSerializer()); zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(_zkAddr), clientConfig); } HelixDataAccessor accessor = new ZKHelixDataAccessor(_manager.getClusterName(), new ZkBaseDataAccessor<>(zkClient)); Builder keyBuilder = accessor.keyBuilder(); IdealState idealState = new IdealState(_resourceName); idealState.setRebalanceMode(RebalanceMode.SEMI_AUTO); idealState.setReplicas(IdealState.IdealStateConstants.ANY_LIVEINSTANCE.toString()); idealState.setNumPartitions(1); idealState.setStateModelDefRef(LEADER_STANDBY); idealState.setStateModelFactoryName(_resourceName); List<String> prefList = new ArrayList<String>( Arrays.asList(IdealState.IdealStateConstants.ANY_LIVEINSTANCE.toString())); idealState.getRecord().setListField(_resourceName + "_0", prefList); List<String> idealStates = accessor.getChildNames(keyBuilder.idealStates()); while (idealStates == null || !idealStates.contains(_resourceName)) { accessor.setProperty(keyBuilder.idealStates(_resourceName), idealState); idealStates = accessor.getChildNames(keyBuilder.idealStates()); } LOG.info( "Set idealState for participantLeader:" + _resourceName + ", idealState:" + idealState); } finally { if (zkClient != null && !zkClient.isClosed()) { zkClient.close(); } } } /** * Stop customer code runner */ public void stop() { LOG.info("Removing stateModelFactory for " + _resourceName); _manager.getStateMachineEngine() .removeStateModelFactory(LEADER_STANDBY, _stateModelFty, _resourceName); } }
{ "pile_set_name": "Github" }
// // serial_port_base.hpp // ~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_ASIO_SERIAL_PORT_BASE_HPP #define BOOST_ASIO_SERIAL_PORT_BASE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #if defined(BOOST_ASIO_HAS_SERIAL_PORT) \ || defined(GENERATING_DOCUMENTATION) #if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) # include <termios.h> #endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) #include <boost/asio/detail/socket_types.hpp> #include <boost/system/error_code.hpp> #if defined(GENERATING_DOCUMENTATION) # define BOOST_ASIO_OPTION_STORAGE implementation_defined #elif defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) # define BOOST_ASIO_OPTION_STORAGE DCB #else # define BOOST_ASIO_OPTION_STORAGE termios #endif #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// The serial_port_base class is used as a base for the basic_serial_port class /// template so that we have a common place to define the serial port options. class serial_port_base { public: /// Serial port option to permit changing the baud rate. /** * Implements changing the baud rate for a given serial port. */ class baud_rate { public: explicit baud_rate(unsigned int rate = 0); unsigned int value() const; BOOST_ASIO_DECL boost::system::error_code store( BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const; BOOST_ASIO_DECL boost::system::error_code load( const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec); private: unsigned int value_; }; /// Serial port option to permit changing the flow control. /** * Implements changing the flow control for a given serial port. */ class flow_control { public: enum type { none, software, hardware }; BOOST_ASIO_DECL explicit flow_control(type t = none); type value() const; BOOST_ASIO_DECL boost::system::error_code store( BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const; BOOST_ASIO_DECL boost::system::error_code load( const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec); private: type value_; }; /// Serial port option to permit changing the parity. /** * Implements changing the parity for a given serial port. */ class parity { public: enum type { none, odd, even }; BOOST_ASIO_DECL explicit parity(type t = none); type value() const; BOOST_ASIO_DECL boost::system::error_code store( BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const; BOOST_ASIO_DECL boost::system::error_code load( const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec); private: type value_; }; /// Serial port option to permit changing the number of stop bits. /** * Implements changing the number of stop bits for a given serial port. */ class stop_bits { public: enum type { one, onepointfive, two }; BOOST_ASIO_DECL explicit stop_bits(type t = one); type value() const; BOOST_ASIO_DECL boost::system::error_code store( BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const; BOOST_ASIO_DECL boost::system::error_code load( const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec); private: type value_; }; /// Serial port option to permit changing the character size. /** * Implements changing the character size for a given serial port. */ class character_size { public: BOOST_ASIO_DECL explicit character_size(unsigned int t = 8); unsigned int value() const; BOOST_ASIO_DECL boost::system::error_code store( BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec) const; BOOST_ASIO_DECL boost::system::error_code load( const BOOST_ASIO_OPTION_STORAGE& storage, boost::system::error_code& ec); private: unsigned int value_; }; protected: /// Protected destructor to prevent deletion through this type. ~serial_port_base() { } }; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #undef BOOST_ASIO_OPTION_STORAGE #include <boost/asio/impl/serial_port_base.hpp> #if defined(BOOST_ASIO_HEADER_ONLY) # include <boost/asio/impl/serial_port_base.ipp> #endif // defined(BOOST_ASIO_HEADER_ONLY) #endif // defined(BOOST_ASIO_HAS_SERIAL_PORT) // || defined(GENERATING_DOCUMENTATION) #endif // BOOST_ASIO_SERIAL_PORT_BASE_HPP
{ "pile_set_name": "Github" }
module 0xD3(output out, input in1, in2, in3); reg r_out; assign out = r_out; always@(in1, in2, in3) begin case({in1,in2,in3}) 3'b000: out = 1'b1; 3'b001: out = 1'b1; 3'b010: out = 1'b0; 3'b011: out = 1'b1; 3'b100: out = 1'b0; 3'b101: out = 1'b0; 3'b110: out = 1'b1; 3'b111: out = 1'b1; default: out = 1'b0; endcase end endmodule
{ "pile_set_name": "Github" }
#include "TestRuleOnCode.h" #include "rules/convention/TooFewBranchesInSwitchStatementRule.cpp" class TooFewBranchesInSwitchStatementRuleTest : public ::testing::Test { protected: virtual void SetUp() override { RuleConfiguration::addConfiguration("MINIMUM_CASES_IN_SWITCH", "3"); } virtual void TearDown() override { RuleConfiguration::removeAll(); } }; TEST_F(TooFewBranchesInSwitchStatementRuleTest, PropertyTest) { TooFewBranchesInSwitchStatementRule rule; EXPECT_EQ(3, rule.priority()); EXPECT_EQ("too few branches in switch statement", rule.name()); EXPECT_EQ("convention", rule.category()); } TEST_F(TooFewBranchesInSwitchStatementRuleTest, FourBranches) { testRuleOnCode(new TooFewBranchesInSwitchStatementRule(), "void aMethod(int a) { switch(a){\n\ case 1: \n\ \tbreak; \n\ case 2: \n\ \tbreak; \n\ case 3: \n\ \tbreak; \n\ case 4: \n\ \tbreak; \n\ } }"); } TEST_F(TooFewBranchesInSwitchStatementRuleTest, ThreeBranches) { testRuleOnCode(new TooFewBranchesInSwitchStatementRule(), "void aMethod(int a) { switch(a){\n\ case 1: \n\ \tbreak; \n\ case 2: \n\ \tbreak; \n\ case 3: \n\ \tbreak; \n\ } }"); } TEST_F(TooFewBranchesInSwitchStatementRuleTest, TwoBranches) { testRuleOnCode(new TooFewBranchesInSwitchStatementRule(), "void aMethod(int a) { switch(a){\n\ case 1: \n\ \tbreak; \n\ case 2: \n\ \tbreak; \n\ } }", 0, 1, 23, 6, 1); } TEST_F(TooFewBranchesInSwitchStatementRuleTest, OneBranche) { testRuleOnCode(new TooFewBranchesInSwitchStatementRule(), "void aMethod(int a) { switch(a){\n\ case 1: \n\ \tbreak; \n\ } }", 0, 1, 23, 4, 1); } TEST_F(TooFewBranchesInSwitchStatementRuleTest, ZeroBranch) { testRuleOnCode(new TooFewBranchesInSwitchStatementRule(), "void aMethod(int a) { switch(a){\n\ default: \n\ \tbreak; \n\ } }", 0, 1, 23, 4, 1); }
{ "pile_set_name": "Github" }
/* * TeleStax, Open Source Cloud Communications Copyright 2012. * and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.restcomm.protocols.ss7.tcap.asn; import java.io.IOException; import org.mobicents.protocols.asn.AsnException; import org.mobicents.protocols.asn.AsnInputStream; import org.mobicents.protocols.asn.AsnOutputStream; import org.mobicents.protocols.asn.BitSetStrictLength; import org.mobicents.protocols.asn.External; import org.mobicents.protocols.asn.Tag; import org.restcomm.protocols.ss7.tcap.asn.comp.PAbortCauseType; /** * <p> * According to ITU-T Rec Q.773 the UserInformation is defined as * </p> * <br/> * <p> * user-information [30] IMPLICIT SEQUENCE OF EXTERNAL * </p> * <br/> * <p> * For definition of EXTERNAL look {@link org.mobicents.protocols.asn.External} from Mobicents ASN module * </p> * * @author baranowb * @author amit bhayani * */ public class UserInformationImpl implements UserInformation { private External ext = new External(); /* * (non-Javadoc) * * @see org.mobicents.protocols.asn.External#decode(org.mobicents.protocols.asn.AsnInputStream) */ public void decode(AsnInputStream ais) throws ParseException { try { AsnInputStream localAis = ais.readSequenceStream(); int tag = localAis.readTag(); if (tag != Tag.EXTERNAL || localAis.getTagClass() != Tag.CLASS_UNIVERSAL) throw new AsnException("Error decoding UserInformation.sequence: wrong tag or tag class: tag=" + tag + ", tagClass=" + localAis.getTagClass()); ext.decode(localAis); } catch (IOException e) { throw new ParseException(PAbortCauseType.BadlyFormattedTxPortion, null, "IOException when decoding UserInformation: " + e.getMessage(), e); } catch (AsnException e) { throw new ParseException(PAbortCauseType.BadlyFormattedTxPortion, null, "AsnException when decoding UserInformation: " + e.getMessage(), e); } } /* * (non-Javadoc) * * @see org.mobicents.protocols.asn.External#encode(org.mobicents.protocols.asn.AsnOutputStream) */ public void encode(AsnOutputStream aos) throws EncodeException { try { aos.writeTag(Tag.CLASS_CONTEXT_SPECIFIC, false, _TAG); int pos = aos.StartContentDefiniteLength(); ext.encode(aos); aos.FinalizeContent(pos); } catch (AsnException e) { throw new EncodeException("AsnException when encoding UserInformation: " + e.getMessage(), e); } } @Override public byte[] getEncodeType() throws AsnException { return ext.getEncodeType(); } @Override public void setEncodeType(byte[] data) { ext.setEncodeType(data); } @Override public BitSetStrictLength getEncodeBitStringType() throws AsnException { return ext.getEncodeBitStringType(); } @Override public void setEncodeBitStringType(BitSetStrictLength data) { ext.setEncodeBitStringType(data); } @Override public boolean isOid() { return ext.isOid(); } @Override public void setOid(boolean oid) { ext.setOid(oid); } @Override public boolean isInteger() { return ext.isInteger(); } @Override public void setInteger(boolean integer) { ext.setInteger(integer); } @Override public boolean isObjDescriptor() { return ext.isObjDescriptor(); } @Override public void setObjDescriptor(boolean objDescriptor) { ext.setObjDescriptor(objDescriptor); } @Override public long[] getOidValue() { return ext.getOidValue(); } @Override public void setOidValue(long[] oidValue) { ext.setOidValue(oidValue); } @Override public long getIndirectReference() { return ext.getIndirectReference(); } @Override public void setIndirectReference(long indirectReference) { ext.setIndirectReference(indirectReference); } @Override public String getObjDescriptorValue() { return ext.getObjDescriptorValue(); } @Override public void setObjDescriptorValue(String objDescriptorValue) { ext.setObjDescriptorValue(objDescriptorValue); } @Override public boolean isAsn() { return ext.isAsn(); } @Override public void setAsn(boolean asn) { ext.setAsn(asn); } @Override public boolean isOctet() { return ext.isOctet(); } @Override public void setOctet(boolean octet) { ext.setOctet(octet); } @Override public boolean isArbitrary() { return ext.isArbitrary(); } @Override public void setArbitrary(boolean arbitrary) { ext.setArbitrary(arbitrary); } }
{ "pile_set_name": "Github" }
/** * Copyright (c) 2010-2020 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ package org.openhab.binding.dmx.internal.action; import org.openhab.binding.dmx.internal.core.DmxChannel; /** * Mirror action. Makes a channel mimic the behavior of another one. If * mirroring channel has a lower id than the channel being mirrored, there will * be a delay of 1 frame rate between the 1 channels. * * @author Davy Vanherbergen * @since 1.2.0 */ public class MirrorAction extends BaseAction { /** channel to mirror **/ private DmxChannel sourceChannel; /** Time in ms to keep mimicking. -1 is indefinite **/ private long holdTime; /** * Create new mirror action. * * @param sourceChannel * channel whose behavior to mirror. * @param holdTime * time in ms to keep mirroring the other channel. -1 is * indefinite. */ public MirrorAction(DmxChannel sourceChannel, int holdTime) { this.sourceChannel = sourceChannel; this.holdTime = holdTime; if (holdTime < -1) { this.holdTime = -1; } } /** * @{inheritDoc */ @Override protected int calculateNewValue(DmxChannel channel, long currentTime) { if (startTime == 0) { startTime = currentTime; } if (holdTime != -1 && (currentTime - startTime > holdTime)) { // mark action as completed completed = true; } return sourceChannel.getValue(); } /** * @{inheritDoc */ @Override public void decrease(int decrement) { // noop. decrease should have been performed on channel being mirrored. } /** * @{inheritDoc */ @Override public void increase(int increment) { // noop. increase should have been performed on channel being mirrored. } }
{ "pile_set_name": "Github" }
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <div class="row margin-top"> <div class="col-lg-12"> <div class="alert alert-success bootstrap-admin-alert"> <a class="close" data-dismiss="alert" href="#">×</a> <h4>注意:只有"参数位置"为"body"时,参数类型"ref"(引用)和"自定义"才可用。</h4> </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <div class="text-muted bootstrap-admin-box-title">请求参数</div> </div> <div class="bootstrap-admin-panel-content"> <!-- TABLE SECTION --> <div class="row"> <div class="col-lg-12"> <form id="reqParamForm" class="form-horizontal"> <table id="reqParamTable" class="table table-hover table-bordered table-responsive"> <thead> <tr> <th class="col-lg-1">#</th> <th class="col-lg-2">编码</th> <th class="col-lg-1 hidden">描述</th> <th class="col-lg-2">参数位置</th> <th class="col-lg-2">类型</th> <th class="col-lg-1 hidden">默认值</th> <th class="col-lg-1 hidden">必输项</th> <th class="col-lg-2">引用</th> <th class="col-lg-1">自定义</th> <th class="col-lg-1">更多</th> </tr> </thead> <tbody> </tbody> </table> </form> </div> </div> <div class="row"> <div class="col-md-6" style="margin-top: 20px;"> <button id="addReqParamBtn" type="button" class="btn btn-warning"> <i class="fa fa-plus"></i> 新增 </button> <button id="saveReqParamBtn" type="button" class="btn btn-success"> <i class="fa fa-floppy-o"></i> 保存 </button> </div> </div> <!-- MODAL SECTION --> <div class="row"> <div class="col-lg-12"> <div class="modal fade" id="reqExtSchemaModal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">自定义结构</h4> </div> <div class="modal-body"> <div class="row"> <div class="col-lg-12"> <textarea id="reqExtSchemaArea" style="resize: auto;height: auto;" name="extSchemaArea" class="form-control" rows="15"></textarea> </div> </div> </div> <div class="modal-footer"> <div class="col-xs-3 text-left"> <button id="reqFormatSchemaBtn" type="button" class="btn btn-warning">格式化</button> </div> <div class="col-xs-9 text-right"> <button id="reqConfirmBtn" type="button" class="btn btn-success">确定</button> <button type="button" class="btn btn-default" data-dismiss="modal">取消</button> </div> </div> </div> </div> </div> </div> </div> <!-- END MODAL SECTION --> <!-- MODAL SECTION --> <div class="row"> <div class="col-lg-12"> <div class="modal fade" id="moreModal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">更多选项</h4> </div> <div class="modal-body"> <div class="row"> <div class="col-lg-12"> <form id="moreForm" role="form" class="form-horizontal"> <div class="form-group"> <label class="control-label col-lg-3">默认值</label> <div class="col-lg-6"> <input name="defValue" type="text" value="" class="form-control"> </div> </div> <div class="form-group"> <label class="control-label col-lg-3">必输项</label> <div class="col-lg-6"> <select name="required" class="form-control"> <option value="true">是</option> <option value="false">否</option> </select> </div> </div> <div class="form-group"> <label class="control-label col-lg-3">描述</label> <div class="col-lg-6"> <textarea name="description" class="form-control"></textarea> </div> </div> </form> </div> </div> </div> <div class="modal-footer"> <button id="saveMoreBtn" type="button" class="btn btn-success">确定</button> <button type="button" class="btn btn-default" data-dismiss="modal">取消</button> </div> </div> </div> </div> </div> </div> <!-- END MODAL SECTION --> </div> </div> <script id="reqParamTmpl" type="text/html"> <tr> <td></td> <td> <input name="code" type="text" value="" class="form-control"> </td> <td class="hidden"> <input name="description" type="text" value="" class="form-control"> </td> <td> <select name="position" class="form-control req-param-position"> <option value="formData">formData</option> <option value="path">path</option> <option value="query">query</option> <option value="body">body</option> <option value="header">header</option> <option value="cookie">cookie</option> </select> </td> <td> <select name="type" class="form-control req-param-type chzn-select"> <option value="sys_string">string</option> <option value="sys_boolean">boolean</option> <option value="sys_integer_int32">int</option> <option value="sys_integer_int64">long</option> <option value="sys_number_float">float</option> <option value="sys_number_double">double</option> <option value="sys_number_decimal">decimal</option> <option value="sys_file">file</option> <option value="sys_ref">ref</option> <option value="cust_json">自定义</option> </select> </td> <td class="hidden"> <input name="defValue" type="text" value="" class="form-control"> </td> <td class="hidden"> <select name="required" class="form-control"> <option value="true">是</option> <option value="false">否</option> </select> </td> <td> <select name="refSchemaId" class="form-control cust-ref-schema"> <c:if test="${not empty refSchemaList}"> <c:forEach items="${refSchemaList}" var="refSchemaInfo" varStatus="status"> <option value="${refSchemaInfo.code}">${refSchemaInfo.name}</option> </c:forEach> </c:if> </select> </td> <td> <input name="extSchema" type="hidden"> <button class="btn ext-schema-btn" type="button"> <i class="fa fa-ellipsis-h"></i> </button> </td> <td> <button class="btn more-btn" type="button"> 更多 </button> </td> </tr> </script>
{ "pile_set_name": "Github" }
from distutils.command.register import register as _register class register(_register): __doc__ = _register.__doc__ def run(self): # Make sure that we are using valid current name/version info self.run_command('egg_info') _register.run(self)
{ "pile_set_name": "Github" }
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1994, 1995 Waldorf GmbH * Copyright (C) 1994 - 2000, 06 Ralf Baechle * Copyright (C) 1999, 2000 Silicon Graphics, Inc. * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. * Author: Maciej W. Rozycki <macro@mips.com> */ #ifndef _ASM_IO_H #define _ASM_IO_H #include <linux/compiler.h> #include <linux/kernel.h> #include <linux/types.h> #include <asm/addrspace.h> #include <asm/byteorder.h> #include <asm/cpu.h> #include <asm/cpu-features.h> #include <asm-generic/iomap.h> #include <asm/page.h> #include <asm/pgtable-bits.h> #include <asm/processor.h> #include <asm/string.h> #include <ioremap.h> #include <mangle-port.h> /* * Slowdown I/O port space accesses for antique hardware. */ #undef CONF_SLOWDOWN_IO /* * Raw operations are never swapped in software. OTOH values that raw * operations are working on may or may not have been swapped by the bus * hardware. An example use would be for flash memory that's used for * execute in place. */ # define __raw_ioswabb(a, x) (x) # define __raw_ioswabw(a, x) (x) # define __raw_ioswabl(a, x) (x) # define __raw_ioswabq(a, x) (x) # define ____raw_ioswabq(a, x) (x) /* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */ #define IO_SPACE_LIMIT 0xffff /* * On MIPS I/O ports are memory mapped, so we access them using normal * load/store instructions. mips_io_port_base is the virtual address to * which all ports are being mapped. For sake of efficiency some code * assumes that this is an address that can be loaded with a single lui * instruction, so the lower 16 bits must be zero. Should be true on * on any sane architecture; generic code does not use this assumption. */ extern const unsigned long mips_io_port_base; /* * Gcc will generate code to load the value of mips_io_port_base after each * function call which may be fairly wasteful in some cases. So we don't * play quite by the book. We tell gcc mips_io_port_base is a long variable * which solves the code generation issue. Now we need to violate the * aliasing rules a little to make initialization possible and finally we * will need the barrier() to fight side effects of the aliasing chat. * This trickery will eventually collapse under gcc's optimizer. Oh well. */ static inline void set_io_port_base(unsigned long base) { * (unsigned long *) &mips_io_port_base = base; barrier(); } /* * Thanks to James van Artsdalen for a better timing-fix than * the two short jumps: using outb's to a nonexistent port seems * to guarantee better timings even on fast machines. * * On the other hand, I'd like to be sure of a non-existent port: * I feel a bit unsafe about using 0x80 (should be safe, though) * * Linus * */ #define __SLOW_DOWN_IO \ __asm__ __volatile__( \ "sb\t$0,0x80(%0)" \ : : "r" (mips_io_port_base)); #ifdef CONF_SLOWDOWN_IO #ifdef REALLY_SLOW_IO #define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; } #else #define SLOW_DOWN_IO __SLOW_DOWN_IO #endif #else #define SLOW_DOWN_IO #endif /* * virt_to_phys - map virtual addresses to physical * @address: address to remap * * The returned physical address is the physical (CPU) mapping for * the memory address given. It is only valid to use this function on * addresses directly mapped or allocated via kmalloc. * * This function does not give bus mappings for DMA transfers. In * almost all conceivable cases a device driver should not be using * this function */ static inline unsigned long virt_to_phys(volatile const void *address) { return (unsigned long)address - PAGE_OFFSET + PHYS_OFFSET; } /* * phys_to_virt - map physical address to virtual * @address: address to remap * * The returned virtual address is a current CPU mapping for * the memory address given. It is only valid to use this function on * addresses that have a kernel mapping * * This function does not handle bus mappings for DMA transfers. In * almost all conceivable cases a device driver should not be using * this function */ static inline void * phys_to_virt(unsigned long address) { return (void *)(address + PAGE_OFFSET - PHYS_OFFSET); } /* * ISA I/O bus memory addresses are 1:1 with the physical address. */ static inline unsigned long isa_virt_to_bus(volatile void * address) { return (unsigned long)address - PAGE_OFFSET; } static inline void * isa_bus_to_virt(unsigned long address) { return (void *)(address + PAGE_OFFSET); } #define isa_page_to_bus page_to_phys /* * However PCI ones are not necessarily 1:1 and therefore these interfaces * are forbidden in portable PCI drivers. * * Allow them for x86 for legacy drivers, though. */ #define virt_to_bus virt_to_phys #define bus_to_virt phys_to_virt /* * Change "struct page" to physical address. */ #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags); extern void __iounmap(const volatile void __iomem *addr); static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size, unsigned long flags) { void __iomem *addr = plat_ioremap(offset, size, flags); if (addr) return addr; #define __IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL)) if (cpu_has_64bit_addresses) { u64 base = UNCAC_BASE; /* * R10000 supports a 2 bit uncached attribute therefore * UNCAC_BASE may not equal IO_BASE. */ if (flags == _CACHE_UNCACHED) base = (u64) IO_BASE; return (void __iomem *) (unsigned long) (base + offset); } else if (__builtin_constant_p(offset) && __builtin_constant_p(size) && __builtin_constant_p(flags)) { phys_t phys_addr, last_addr; phys_addr = fixup_bigphys_addr(offset, size); /* Don't allow wraparound or zero size. */ last_addr = phys_addr + size - 1; if (!size || last_addr < phys_addr) return NULL; /* * Map uncached objects in the low 512MB of address * space using KSEG1. */ if (__IS_LOW512(phys_addr) && __IS_LOW512(last_addr) && flags == _CACHE_UNCACHED) return (void __iomem *) (unsigned long)CKSEG1ADDR(phys_addr); } return __ioremap(offset, size, flags); #undef __IS_LOW512 } /* * ioremap - map bus memory into CPU space * @offset: bus address of the memory * @size: size of the resource to map * * ioremap performs a platform specific sequence of operations to * make bus memory CPU accessible via the readb/readw/readl/writeb/ * writew/writel functions and the other mmio helpers. The returned * address is not guaranteed to be usable directly as a virtual * address. */ #define ioremap(offset, size) \ __ioremap_mode((offset), (size), _CACHE_UNCACHED) /* * ioremap_nocache - map bus memory into CPU space * @offset: bus address of the memory * @size: size of the resource to map * * ioremap_nocache performs a platform specific sequence of operations to * make bus memory CPU accessible via the readb/readw/readl/writeb/ * writew/writel functions and the other mmio helpers. The returned * address is not guaranteed to be usable directly as a virtual * address. * * This version of ioremap ensures that the memory is marked uncachable * on the CPU as well as honouring existing caching rules from things like * the PCI bus. Note that there are other caches and buffers on many * busses. In particular driver authors should read up on PCI writes * * It's useful if some control registers are in such an area and * write combining or read caching is not desirable: */ #define ioremap_nocache(offset, size) \ __ioremap_mode((offset), (size), _CACHE_UNCACHED) /* * ioremap_cachable - map bus memory into CPU space * @offset: bus address of the memory * @size: size of the resource to map * * ioremap_nocache performs a platform specific sequence of operations to * make bus memory CPU accessible via the readb/readw/readl/writeb/ * writew/writel functions and the other mmio helpers. The returned * address is not guaranteed to be usable directly as a virtual * address. * * This version of ioremap ensures that the memory is marked cachable by * the CPU. Also enables full write-combining. Useful for some * memory-like regions on I/O busses. */ #define ioremap_cachable(offset, size) \ __ioremap_mode((offset), (size), _page_cachable_default) /* * These two are MIPS specific ioremap variant. ioremap_cacheable_cow * requests a cachable mapping, ioremap_uncached_accelerated requests a * mapping using the uncached accelerated mode which isn't supported on * all processors. */ #define ioremap_cacheable_cow(offset, size) \ __ioremap_mode((offset), (size), _CACHE_CACHABLE_COW) #define ioremap_uncached_accelerated(offset, size) \ __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED) static inline void iounmap(const volatile void __iomem *addr) { if (plat_iounmap(addr)) return; #define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1) if (cpu_has_64bit_addresses || (__builtin_constant_p(addr) && __IS_KSEG1(addr))) return; __iounmap(addr); #undef __IS_KSEG1 } #ifdef CONFIG_CPU_CAVIUM_OCTEON #define war_octeon_io_reorder_wmb() wmb() #else #define war_octeon_io_reorder_wmb() do { } while (0) #endif #define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq) \ \ static inline void pfx##write##bwlq(type val, \ volatile void __iomem *mem) \ { \ volatile type *__mem; \ type __val; \ \ war_octeon_io_reorder_wmb(); \ \ __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \ \ __val = pfx##ioswab##bwlq(__mem, val); \ \ if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \ *__mem = __val; \ else if (cpu_has_64bits) { \ unsigned long __flags; \ type __tmp; \ \ if (irq) \ local_irq_save(__flags); \ __asm__ __volatile__( \ ".set mips3" "\t\t# __writeq""\n\t" \ "dsll32 %L0, %L0, 0" "\n\t" \ "dsrl32 %L0, %L0, 0" "\n\t" \ "dsll32 %M0, %M0, 0" "\n\t" \ "or %L0, %L0, %M0" "\n\t" \ "sd %L0, %2" "\n\t" \ ".set mips0" "\n" \ : "=r" (__tmp) \ : "0" (__val), "m" (*__mem)); \ if (irq) \ local_irq_restore(__flags); \ } else \ BUG(); \ } \ \ static inline type pfx##read##bwlq(const volatile void __iomem *mem) \ { \ volatile type *__mem; \ type __val; \ \ __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \ \ if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \ __val = *__mem; \ else if (cpu_has_64bits) { \ unsigned long __flags; \ \ if (irq) \ local_irq_save(__flags); \ __asm__ __volatile__( \ ".set mips3" "\t\t# __readq" "\n\t" \ "ld %L0, %1" "\n\t" \ "dsra32 %M0, %L0, 0" "\n\t" \ "sll %L0, %L0, 0" "\n\t" \ ".set mips0" "\n" \ : "=r" (__val) \ : "m" (*__mem)); \ if (irq) \ local_irq_restore(__flags); \ } else { \ __val = 0; \ BUG(); \ } \ \ return pfx##ioswab##bwlq(__mem, __val); \ } #define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow) \ \ static inline void pfx##out##bwlq##p(type val, unsigned long port) \ { \ volatile type *__addr; \ type __val; \ \ war_octeon_io_reorder_wmb(); \ \ __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \ \ __val = pfx##ioswab##bwlq(__addr, val); \ \ /* Really, we want this to be atomic */ \ BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ \ *__addr = __val; \ slow; \ } \ \ static inline type pfx##in##bwlq##p(unsigned long port) \ { \ volatile type *__addr; \ type __val; \ \ __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \ \ BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ \ __val = *__addr; \ slow; \ \ return pfx##ioswab##bwlq(__addr, __val); \ } #define __BUILD_MEMORY_PFX(bus, bwlq, type) \ \ __BUILD_MEMORY_SINGLE(bus, bwlq, type, 1) #define BUILDIO_MEM(bwlq, type) \ \ __BUILD_MEMORY_PFX(__raw_, bwlq, type) \ __BUILD_MEMORY_PFX(, bwlq, type) \ __BUILD_MEMORY_PFX(__mem_, bwlq, type) \ BUILDIO_MEM(b, u8) BUILDIO_MEM(w, u16) BUILDIO_MEM(l, u32) BUILDIO_MEM(q, u64) #define __BUILD_IOPORT_PFX(bus, bwlq, type) \ __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \ __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO) #define BUILDIO_IOPORT(bwlq, type) \ __BUILD_IOPORT_PFX(, bwlq, type) \ __BUILD_IOPORT_PFX(__mem_, bwlq, type) BUILDIO_IOPORT(b, u8) BUILDIO_IOPORT(w, u16) BUILDIO_IOPORT(l, u32) #ifdef CONFIG_64BIT BUILDIO_IOPORT(q, u64) #endif #define __BUILDIO(bwlq, type) \ \ __BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 0) __BUILDIO(q, u64) #define readb_relaxed readb #define readw_relaxed readw #define readl_relaxed readl #define readq_relaxed readq #define readb_be(addr) \ __raw_readb((__force unsigned *)(addr)) #define readw_be(addr) \ be16_to_cpu(__raw_readw((__force unsigned *)(addr))) #define readl_be(addr) \ be32_to_cpu(__raw_readl((__force unsigned *)(addr))) #define readq_be(addr) \ be64_to_cpu(__raw_readq((__force unsigned *)(addr))) #define writeb_be(val, addr) \ __raw_writeb((val), (__force unsigned *)(addr)) #define writew_be(val, addr) \ __raw_writew(cpu_to_be16((val)), (__force unsigned *)(addr)) #define writel_be(val, addr) \ __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr)) #define writeq_be(val, addr) \ __raw_writeq(cpu_to_be64((val)), (__force unsigned *)(addr)) /* * Some code tests for these symbols */ #define readq readq #define writeq writeq #define __BUILD_MEMORY_STRING(bwlq, type) \ \ static inline void writes##bwlq(volatile void __iomem *mem, \ const void *addr, unsigned int count) \ { \ const volatile type *__addr = addr; \ \ while (count--) { \ __mem_write##bwlq(*__addr, mem); \ __addr++; \ } \ } \ \ static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \ unsigned int count) \ { \ volatile type *__addr = addr; \ \ while (count--) { \ *__addr = __mem_read##bwlq(mem); \ __addr++; \ } \ } #define __BUILD_IOPORT_STRING(bwlq, type) \ \ static inline void outs##bwlq(unsigned long port, const void *addr, \ unsigned int count) \ { \ const volatile type *__addr = addr; \ \ while (count--) { \ __mem_out##bwlq(*__addr, port); \ __addr++; \ } \ } \ \ static inline void ins##bwlq(unsigned long port, void *addr, \ unsigned int count) \ { \ volatile type *__addr = addr; \ \ while (count--) { \ *__addr = __mem_in##bwlq(port); \ __addr++; \ } \ } #define BUILDSTRING(bwlq, type) \ \ __BUILD_MEMORY_STRING(bwlq, type) \ __BUILD_IOPORT_STRING(bwlq, type) BUILDSTRING(b, u8) BUILDSTRING(w, u16) BUILDSTRING(l, u32) #ifdef CONFIG_64BIT BUILDSTRING(q, u64) #endif #ifdef CONFIG_CPU_CAVIUM_OCTEON #define mmiowb() wmb() #else /* Depends on MIPS II instruction set */ #define mmiowb() asm volatile ("sync" ::: "memory") #endif static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) { memset((void __force *) addr, val, count); } static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) { memcpy(dst, (void __force *) src, count); } static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) { memcpy((void __force *) dst, src, count); } /* * The caches on some architectures aren't dma-coherent and have need to * handle this in software. There are three types of operations that * can be applied to dma buffers. * * - dma_cache_wback_inv(start, size) makes caches and coherent by * writing the content of the caches back to memory, if necessary. * The function also invalidates the affected part of the caches as * necessary before DMA transfers from outside to memory. * - dma_cache_wback(start, size) makes caches and coherent by * writing the content of the caches back to memory, if necessary. * The function also invalidates the affected part of the caches as * necessary before DMA transfers from outside to memory. * - dma_cache_inv(start, size) invalidates the affected parts of the * caches. Dirty lines of the caches may be written back or simply * be discarded. This operation is necessary before dma operations * to the memory. * * This API used to be exported; it now is for arch code internal use only. */ #ifdef CONFIG_DMA_NONCOHERENT extern void (*_dma_cache_wback_inv)(unsigned long start, unsigned long size); extern void (*_dma_cache_wback)(unsigned long start, unsigned long size); extern void (*_dma_cache_inv)(unsigned long start, unsigned long size); #define dma_cache_wback_inv(start, size) _dma_cache_wback_inv(start, size) #define dma_cache_wback(start, size) _dma_cache_wback(start, size) #define dma_cache_inv(start, size) _dma_cache_inv(start, size) #else /* Sane hardware */ #define dma_cache_wback_inv(start,size) \ do { (void) (start); (void) (size); } while (0) #define dma_cache_wback(start,size) \ do { (void) (start); (void) (size); } while (0) #define dma_cache_inv(start,size) \ do { (void) (start); (void) (size); } while (0) #endif /* CONFIG_DMA_NONCOHERENT */ /* * Read a 32-bit register that requires a 64-bit read cycle on the bus. * Avoid interrupt mucking, just adjust the address for 4-byte access. * Assume the addresses are 8-byte aligned. */ #ifdef __MIPSEB__ #define __CSR_32_ADJUST 4 #else #define __CSR_32_ADJUST 0 #endif #define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v)) #define csr_in32(a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST)) /* * Convert a physical pointer to a virtual kernel pointer for /dev/mem * access */ #define xlate_dev_mem_ptr(p) __va(p) /* * Convert a virtual cached pointer to an uncached pointer */ #define xlate_dev_kmem_ptr(p) p #endif /* _ASM_IO_H */
{ "pile_set_name": "Github" }
/* Drop in replacement for zmalloc.h in order to just use libc malloc without * any wrappering. */ #ifndef ZMALLOC_H #define ZMALLOC_H #define zmalloc malloc #define zrealloc realloc #define zcalloc(x) calloc(x,1) #define zfree free #define zstrdup strdup #endif
{ "pile_set_name": "Github" }
#if 0 // // Generated by Microsoft (R) D3D Shader Disassembler // // // Input signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // SV_Position 0 xyzw 0 NONE float xyzw // NORMAL 0 xyz 1 NONE float xyz // TEXCOORD 0 xy 2 NONE float xy // BLENDINDICES 0 xyzw 3 NONE uint xy // BLENDWEIGHT 0 xyzw 4 NONE float xy // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ // COLOR 0 xyzw 0 NONE float xyzw // COLOR 1 xyzw 1 NONE float xyzw // TEXCOORD 0 xy 2 NONE float xy // SV_Position 0 xyzw 3 POS float xyzw // // // Constant buffer to DX9 shader constant mappings: // // Target Reg Buffer Start Reg # of Regs Data Conversion // ---------- ------- --------- --------- ---------------------- // c0 cb0 0 242 ( FLT, FLT, FLT, FLT) // // // Runtime generated constant mappings: // // Target Reg Constant Description // ---------- -------------------------------------------------- // c242 Vertex Shader position offset // // // Level9 shader bytecode: // vs_2_0 def c243, 3, 0, 1, 0 dcl_texcoord v0 // vin<0,1,2,3> dcl_texcoord1 v1 // vin<4,5,6> dcl_texcoord2 v2 // vin<7,8> dcl_texcoord3 v3 // vin<9,10,11,12> dcl_texcoord4 v4 // vin<13,14,15,16> #line 49 "D:\Microsoft\DirectXTK\Src\Shaders\SkinnedEffect.fx" mul r0.xy, v3, c243.x mova a0.xy, r0.yxzw mul r0, v4.y, c26[a0.x] mad r0, c26[a0.y], v4.x, r0 // ::skinning<0,3,6,9> #line 53 dp3 r1.x, v1, r0 // ::Skin<0> dp4 r0.x, v0, r0 // Skin::vin<0> #line 49 mul r2, v4.y, c27[a0.x] mul r3, v4.y, c28[a0.x] mad r3, c28[a0.y], v4.x, r3 // ::skinning<2,5,8,11> mad r2, c27[a0.y], v4.x, r2 // ::skinning<1,4,7,10> #line 53 dp3 r1.y, v1, r2 // ::Skin<1> dp4 r0.y, v0, r2 // Skin::vin<1> dp3 r1.z, v1, r3 // ::Skin<2> dp4 r0.z, v0, r3 // Skin::vin<2> #line 57 "D:\Microsoft\DirectXTK\Src\Shaders\Lighting.fxh" dp3 r2.x, r1, c19 dp3 r2.y, r1, c20 dp3 r2.z, r1, c21 nrm r1.xyz, r2 // ::worldNormal<0,1,2> #line 34 dp3 r2.x, -c3, r1 // ::dotL<0> dp3 r2.y, -c4, r1 // ::dotL<1> dp3 r2.z, -c5, r1 // ::dotL<2> #line 37 sge r3.xyz, r2, c243.y // ::zeroL<0,1,2> mul r4.xyz, r2, r3 // ::diffuse<0,1,2> #line 44 mul r5.xyz, r4.y, c7 mad r4.xyw, r4.x, c6.xyzz, r5.xyzz mad r4.xyz, r4.z, c8, r4.xyww mov r5.xyz, c0 // Parameters::DiffuseColor<0,1,2> mad oT0.xyz, r4, r5, c1 // ::VSSkinnedVertexLightingTwoBones<0,1,2> #line 55 mov r0.w, v0.w dp4 r4.x, r0, c15 // ::pos_ws<0> dp4 r4.y, r0, c16 // ::pos_ws<1> dp4 r4.z, r0, c17 // ::pos_ws<2> add r4.xyz, -r4, c12 nrm r5.xyz, r4 // ::eyeVector<0,1,2> #line 31 add r4.xyz, r5, -c3 nrm r6.xyz, r4 // ::halfVectors<0,1,2> #line 35 dp3 r4.x, r6, r1 // ::dotH<0> #line 31 add r6.xyz, r5, -c4 add r5.xyz, r5, -c5 nrm r7.xyz, r5 // ::halfVectors<6,7,8> #line 35 dp3 r4.z, r7, r1 // ::dotH<2> #line 31 nrm r5.xyz, r6 // ::halfVectors<3,4,5> #line 35 dp3 r4.y, r5, r1 // ::dotH<1> #line 40 max r1.xyz, r4, c243.y mul r1.xyz, r3, r1 log r3.x, r1.x log r3.y, r1.y log r3.z, r1.z mul r1.xyz, r3, c2.w exp r3.x, r1.x exp r3.y, r1.y exp r3.z, r1.z mul r1.xyz, r2, r3 // ::specular<0,1,2> #line 45 mul r2.xyz, r1.y, c10 mad r1.xyw, r1.x, c9.xyzz, r2.xyzz mad r1.xyz, r1.z, c11, r1.xyww mul oT1.xyz, r1, c2 // ::VSSkinnedVertexLightingTwoBones<4,5,6> #line 61 dp4 oPos.z, r0, c24 // ::VSSkinnedVertexLightingTwoBones<12> #line 12 "D:\Microsoft\DirectXTK\Src\Shaders\Common.fxh" dp4 r1.x, r0, c14 max r1.x, r1.x, c243.y min oT1.w, r1.x, c243.z // ::VSSkinnedVertexLightingTwoBones<7> #line 61 "D:\Microsoft\DirectXTK\Src\Shaders\Lighting.fxh" dp4 r1.x, r0, c22 // ::vout<0> dp4 r1.y, r0, c23 // ::vout<1> dp4 r0.x, r0, c25 // ::vout<3> #line 90 "D:\Microsoft\DirectXTK\Src\Shaders\SkinnedEffect.fx" mad oPos.xy, r0.x, c242, r1 // ::VSSkinnedVertexLightingTwoBones<10,11> mov oPos.w, r0.x // ::VSSkinnedVertexLightingTwoBones<13> #line 44 "D:\Microsoft\DirectXTK\Src\Shaders\Lighting.fxh" mov oT0.w, c0.w // ::VSSkinnedVertexLightingTwoBones<3> #line 94 "D:\Microsoft\DirectXTK\Src\Shaders\SkinnedEffect.fx" mov oT2.xy, v2 // ::VSSkinnedVertexLightingTwoBones<8,9> // approximately 78 instruction slots used vs_4_0 dcl_constantbuffer CB0[242], dynamicIndexed dcl_input v0.xyzw dcl_input v1.xyz dcl_input v2.xy dcl_input v3.xy dcl_input v4.xy dcl_output o0.xyzw dcl_output o1.xyzw dcl_output o2.xy dcl_output_siv o3.xyzw, position dcl_temps 7 imul null, r0.xy, v3.xyxx, l(3, 3, 0, 0) mul r1.xyzw, v4.yyyy, cb0[r0.y + 26].xyzw mad r1.xyzw, cb0[r0.x + 26].xyzw, v4.xxxx, r1.xyzw dp3 r2.x, v1.xyzx, r1.xyzx dp4 r1.x, v0.xyzw, r1.xyzw mul r3.xyzw, v4.yyyy, cb0[r0.y + 27].xyzw mad r3.xyzw, cb0[r0.x + 27].xyzw, v4.xxxx, r3.xyzw dp3 r2.y, v1.xyzx, r3.xyzx dp4 r1.y, v0.xyzw, r3.xyzw mul r3.xyzw, v4.yyyy, cb0[r0.y + 28].xyzw mad r0.xyzw, cb0[r0.x + 28].xyzw, v4.xxxx, r3.xyzw dp3 r2.z, v1.xyzx, r0.xyzx dp4 r1.z, v0.xyzw, r0.xyzw dp3 r0.x, r2.xyzx, cb0[19].xyzx dp3 r0.y, r2.xyzx, cb0[20].xyzx dp3 r0.z, r2.xyzx, cb0[21].xyzx dp3 r0.w, r0.xyzx, r0.xyzx rsq r0.w, r0.w mul r0.xyz, r0.wwww, r0.xyzx dp3 r2.x, -cb0[3].xyzx, r0.xyzx dp3 r2.y, -cb0[4].xyzx, r0.xyzx dp3 r2.z, -cb0[5].xyzx, r0.xyzx ge r3.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) and r3.xyz, r3.xyzx, l(0x3f800000, 0x3f800000, 0x3f800000, 0) mul r4.xyz, r2.xyzx, r3.xyzx mul r5.xyz, r4.yyyy, cb0[7].xyzx mad r4.xyw, r4.xxxx, cb0[6].xyxz, r5.xyxz mad r4.xyz, r4.zzzz, cb0[8].xyzx, r4.xywx mad o0.xyz, r4.xyzx, cb0[0].xyzx, cb0[1].xyzx mov o0.w, cb0[0].w mov r1.w, v0.w dp4 r4.x, r1.xyzw, cb0[15].xyzw dp4 r4.y, r1.xyzw, cb0[16].xyzw dp4 r4.z, r1.xyzw, cb0[17].xyzw add r4.xyz, -r4.xyzx, cb0[12].xyzx dp3 r0.w, r4.xyzx, r4.xyzx rsq r0.w, r0.w mad r5.xyz, r4.xyzx, r0.wwww, -cb0[3].xyzx dp3 r2.w, r5.xyzx, r5.xyzx rsq r2.w, r2.w mul r5.xyz, r2.wwww, r5.xyzx dp3 r5.x, r5.xyzx, r0.xyzx mad r6.xyz, r4.xyzx, r0.wwww, -cb0[4].xyzx mad r4.xyz, r4.xyzx, r0.wwww, -cb0[5].xyzx dp3 r0.w, r6.xyzx, r6.xyzx rsq r0.w, r0.w mul r6.xyz, r0.wwww, r6.xyzx dp3 r5.y, r6.xyzx, r0.xyzx dp3 r0.w, r4.xyzx, r4.xyzx rsq r0.w, r0.w mul r4.xyz, r0.wwww, r4.xyzx dp3 r5.z, r4.xyzx, r0.xyzx max r0.xyz, r5.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000) mul r0.xyz, r3.xyzx, r0.xyzx log r0.xyz, r0.xyzx mul r0.xyz, r0.xyzx, cb0[2].wwww exp r0.xyz, r0.xyzx mul r0.xyz, r2.xyzx, r0.xyzx mul r2.xyz, r0.yyyy, cb0[10].xyzx mad r0.xyw, r0.xxxx, cb0[9].xyxz, r2.xyxz mad r0.xyz, r0.zzzz, cb0[11].xyzx, r0.xywx mul o1.xyz, r0.xyzx, cb0[2].xyzx dp4_sat o1.w, r1.xyzw, cb0[14].xyzw mov o2.xy, v2.xyxx dp4 o3.x, r1.xyzw, cb0[22].xyzw dp4 o3.y, r1.xyzw, cb0[23].xyzw dp4 o3.z, r1.xyzw, cb0[24].xyzw dp4 o3.w, r1.xyzw, cb0[25].xyzw ret // Approximately 0 instruction slots used #endif const BYTE SkinnedEffect_VSSkinnedVertexLightingTwoBones[] = { 68, 88, 66, 67, 35, 190, 178, 215, 143, 76, 37, 132, 136, 1, 228, 228, 135, 164, 179, 9, 1, 0, 0, 0, 40, 24, 0, 0, 4, 0, 0, 0, 48, 0, 0, 0, 188, 13, 0, 0, 220, 22, 0, 0, 156, 23, 0, 0, 65, 111, 110, 57, 132, 13, 0, 0, 132, 13, 0, 0, 0, 2, 254, 255, 80, 13, 0, 0, 52, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, 0, 0, 36, 0, 1, 0, 48, 0, 0, 0, 0, 0, 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 2, 254, 255, 254, 255, 46, 2, 68, 66, 85, 71, 40, 0, 0, 0, 140, 8, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 188, 0, 0, 0, 74, 0, 0, 0, 200, 0, 0, 0, 16, 0, 0, 0, 76, 7, 0, 0, 136, 3, 0, 0, 68, 58, 92, 77, 105, 99, 114, 111, 115, 111, 102, 116, 92, 68, 105, 114, 101, 99, 116, 88, 84, 75, 92, 83, 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 83, 107, 105, 110, 110, 101, 100, 69, 102, 102, 101, 99, 116, 46, 102, 120, 0, 68, 58, 92, 77, 105, 99, 114, 111, 115, 111, 102, 116, 92, 68, 105, 114, 101, 99, 116, 88, 84, 75, 92, 83, 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 76, 105, 103, 104, 116, 105, 110, 103, 46, 102, 120, 104, 0, 68, 58, 92, 77, 105, 99, 114, 111, 115, 111, 102, 116, 92, 68, 105, 114, 101, 99, 116, 88, 84, 75, 92, 83, 114, 99, 92, 83, 104, 97, 100, 101, 114, 115, 92, 67, 111, 109, 109, 111, 110, 46, 102, 120, 104, 0, 171, 171, 40, 0, 0, 0, 92, 0, 0, 0, 140, 0, 0, 0, 0, 0, 255, 255, 192, 8, 0, 0, 0, 0, 255, 255, 216, 8, 0, 0, 0, 0, 255, 255, 228, 8, 0, 0, 0, 0, 255, 255, 240, 8, 0, 0, 0, 0, 255, 255, 252, 8, 0, 0, 0, 0, 255, 255, 8, 9, 0, 0, 49, 0, 0, 0, 20, 9, 0, 0, 49, 0, 0, 0, 36, 9, 0, 0, 49, 0, 0, 0, 48, 9, 0, 0, 49, 0, 0, 0, 68, 9, 0, 0, 53, 0, 0, 0, 92, 9, 0, 0, 52, 0, 0, 0, 108, 9, 0, 0, 49, 0, 0, 0, 124, 9, 0, 0, 49, 0, 0, 0, 144, 9, 0, 0, 49, 0, 0, 0, 164, 9, 0, 0, 49, 0, 0, 0, 188, 9, 0, 0, 53, 0, 0, 0, 212, 9, 0, 0, 52, 0, 0, 0, 228, 9, 0, 0, 53, 0, 0, 0, 244, 9, 0, 0, 52, 0, 0, 0, 4, 10, 0, 0, 57, 0, 1, 0, 20, 10, 0, 0, 57, 0, 1, 0, 36, 10, 0, 0, 57, 0, 1, 0, 52, 10, 0, 0, 57, 0, 1, 0, 68, 10, 0, 0, 34, 0, 1, 0, 80, 10, 0, 0, 34, 0, 1, 0, 96, 10, 0, 0, 34, 0, 1, 0, 112, 10, 0, 0, 37, 0, 1, 0, 128, 10, 0, 0, 39, 0, 1, 0, 144, 10, 0, 0, 44, 0, 1, 0, 160, 10, 0, 0, 44, 0, 1, 0, 176, 10, 0, 0, 44, 0, 1, 0, 196, 10, 0, 0, 44, 0, 1, 0, 216, 10, 0, 0, 44, 0, 1, 0, 228, 10, 0, 0, 55, 0, 1, 0, 248, 10, 0, 0, 55, 0, 1, 0, 4, 11, 0, 0, 55, 0, 1, 0, 20, 11, 0, 0, 55, 0, 1, 0, 36, 11, 0, 0, 56, 0, 1, 0, 52, 11, 0, 0, 56, 0, 1, 0, 68, 11, 0, 0, 31, 0, 1, 0, 80, 11, 0, 0, 31, 0, 1, 0, 96, 11, 0, 0, 35, 0, 1, 0, 108, 11, 0, 0, 31, 0, 1, 0, 124, 11, 0, 0, 31, 0, 1, 0, 140, 11, 0, 0, 31, 0, 1, 0, 156, 11, 0, 0, 35, 0, 1, 0, 168, 11, 0, 0, 31, 0, 1, 0, 184, 11, 0, 0, 35, 0, 1, 0, 196, 11, 0, 0, 40, 0, 1, 0, 212, 11, 0, 0, 40, 0, 1, 0, 228, 11, 0, 0, 40, 0, 1, 0, 244, 11, 0, 0, 40, 0, 1, 0, 0, 12, 0, 0, 40, 0, 1, 0, 12, 12, 0, 0, 40, 0, 1, 0, 24, 12, 0, 0, 40, 0, 1, 0, 40, 12, 0, 0, 40, 0, 1, 0, 52, 12, 0, 0, 40, 0, 1, 0, 64, 12, 0, 0, 40, 0, 1, 0, 76, 12, 0, 0, 45, 0, 1, 0, 92, 12, 0, 0, 45, 0, 1, 0, 108, 12, 0, 0, 45, 0, 1, 0, 128, 12, 0, 0, 45, 0, 1, 0, 148, 12, 0, 0, 61, 0, 1, 0, 164, 12, 0, 0, 12, 0, 2, 0, 180, 12, 0, 0, 12, 0, 2, 0, 196, 12, 0, 0, 12, 0, 2, 0, 212, 12, 0, 0, 61, 0, 1, 0, 228, 12, 0, 0, 61, 0, 1, 0, 244, 12, 0, 0, 61, 0, 1, 0, 4, 13, 0, 0, 90, 0, 0, 0, 20, 13, 0, 0, 90, 0, 0, 0, 40, 13, 0, 0, 44, 0, 1, 0, 52, 13, 0, 0, 94, 0, 0, 0, 64, 13, 0, 0, 80, 97, 114, 97, 109, 101, 116, 101, 114, 115, 0, 68, 105, 102, 102, 117, 115, 101, 67, 111, 108, 111, 114, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 1, 0, 2, 0, 255, 255, 83, 107, 105, 110, 0, 171, 171, 171, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 16, 0, 0, 0, 255, 255, 1, 0, 255, 255, 255, 255, 18, 0, 0, 0, 255, 255, 255, 255, 2, 0, 255, 255, 86, 83, 83, 107, 105, 110, 110, 101, 100, 86, 101, 114, 116, 101, 120, 76, 105, 103, 104, 116, 105, 110, 103, 84, 119, 111, 66, 111, 110, 101, 115, 0, 68, 105, 102, 102, 117, 115, 101, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 83, 112, 101, 99, 117, 108, 97, 114, 0, 84, 101, 120, 67, 111, 111, 114, 100, 0, 171, 171, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 80, 111, 115, 105, 116, 105, 111, 110, 80, 83, 0, 171, 168, 3, 0, 0, 176, 3, 0, 0, 192, 3, 0, 0, 176, 3, 0, 0, 201, 3, 0, 0, 212, 3, 0, 0, 228, 3, 0, 0, 176, 3, 0, 0, 5, 0, 0, 0, 1, 0, 14, 0, 1, 0, 4, 0, 240, 3, 0, 0, 33, 0, 0, 0, 0, 0, 1, 0, 2, 0, 255, 255, 62, 0, 0, 0, 4, 0, 5, 0, 6, 0, 255, 255, 63, 0, 0, 0, 255, 255, 255, 255, 12, 0, 255, 255, 66, 0, 0, 0, 255, 255, 255, 255, 255, 255, 7, 0, 70, 0, 0, 0, 10, 0, 11, 0, 255, 255, 255, 255, 71, 0, 0, 0, 255, 255, 255, 255, 255, 255, 13, 0, 72, 0, 0, 0, 255, 255, 255, 255, 255, 255, 3, 0, 73, 0, 0, 0, 8, 0, 9, 0, 255, 255, 255, 255, 100, 105, 102, 102, 117, 115, 101, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 1, 0, 2, 0, 255, 255, 100, 111, 116, 72, 0, 171, 171, 171, 42, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 46, 0, 0, 0, 255, 255, 255, 255, 2, 0, 255, 255, 48, 0, 0, 0, 255, 255, 1, 0, 255, 255, 255, 255, 100, 111, 116, 76, 0, 171, 171, 171, 24, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 25, 0, 0, 0, 255, 255, 1, 0, 255, 255, 255, 255, 26, 0, 0, 0, 255, 255, 255, 255, 2, 0, 255, 255, 101, 121, 101, 86, 101, 99, 116, 111, 114, 0, 171, 171, 39, 0, 0, 0, 0, 0, 1, 0, 2, 0, 255, 255, 104, 97, 108, 102, 86, 101, 99, 116, 111, 114, 115, 0, 3, 0, 3, 0, 3, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 1, 0, 2, 0, 255, 255, 45, 0, 0, 0, 6, 0, 7, 0, 8, 0, 255, 255, 47, 0, 0, 0, 3, 0, 4, 0, 5, 0, 255, 255, 112, 111, 115, 95, 119, 115, 0, 171, 35, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 36, 0, 0, 0, 255, 255, 1, 0, 255, 255, 255, 255, 37, 0, 0, 0, 255, 255, 255, 255, 2, 0, 255, 255, 115, 107, 105, 110, 110, 105, 110, 103, 0, 171, 171, 171, 3, 0, 3, 0, 4, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 3, 0, 6, 0, 9, 0, 14, 0, 0, 0, 2, 0, 5, 0, 8, 0, 11, 0, 15, 0, 0, 0, 1, 0, 4, 0, 7, 0, 10, 0, 115, 112, 101, 99, 117, 108, 97, 114, 0, 171, 171, 171, 58, 0, 0, 0, 0, 0, 1, 0, 2, 0, 255, 255, 118, 105, 110, 0, 80, 111, 115, 105, 116, 105, 111, 110, 0, 78, 111, 114, 109, 97, 108, 0, 73, 110, 100, 105, 99, 101, 115, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 87, 101, 105, 103, 104, 116, 115, 0, 220, 5, 0, 0, 176, 3, 0, 0, 229, 5, 0, 0, 136, 4, 0, 0, 201, 3, 0, 0, 212, 3, 0, 0, 236, 5, 0, 0, 244, 5, 0, 0, 4, 6, 0, 0, 176, 3, 0, 0, 5, 0, 0, 0, 1, 0, 17, 0, 1, 0, 5, 0, 12, 6, 0, 0, 11, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 17, 0, 0, 0, 255, 255, 1, 0, 255, 255, 255, 255, 19, 0, 0, 0, 255, 255, 255, 255, 2, 0, 255, 255, 1, 0, 0, 0, 0, 0, 1, 0, 2, 0, 3, 0, 2, 0, 0, 0, 4, 0, 5, 0, 6, 0, 255, 255, 3, 0, 0, 0, 7, 0, 8, 0, 255, 255, 255, 255, 4, 0, 0, 0, 9, 0, 10, 0, 11, 0, 12, 0, 5, 0, 0, 0, 13, 0, 14, 0, 15, 0, 16, 0, 118, 111, 117, 116, 0, 80, 111, 115, 95, 112, 115, 0, 70, 111, 103, 70, 97, 99, 116, 111, 114, 0, 171, 171, 0, 0, 3, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 169, 6, 0, 0, 176, 3, 0, 0, 168, 3, 0, 0, 176, 3, 0, 0, 192, 3, 0, 0, 136, 4, 0, 0, 176, 6, 0, 0, 188, 6, 0, 0, 5, 0, 0, 0, 1, 0, 12, 0, 1, 0, 4, 0, 204, 6, 0, 0, 67, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 68, 0, 0, 0, 255, 255, 1, 0, 255, 255, 255, 255, 69, 0, 0, 0, 3, 0, 255, 255, 255, 255, 255, 255, 119, 111, 114, 108, 100, 78, 111, 114, 109, 97, 108, 0, 23, 0, 0, 0, 0, 0, 1, 0, 2, 0, 255, 255, 122, 101, 114, 111, 76, 0, 171, 171, 27, 0, 0, 0, 0, 0, 1, 0, 2, 0, 255, 255, 24, 3, 0, 0, 35, 3, 0, 0, 48, 3, 0, 0, 1, 0, 0, 0, 64, 3, 0, 0, 0, 0, 0, 0, 76, 3, 0, 0, 84, 3, 0, 0, 3, 0, 0, 0, 100, 3, 0, 0, 0, 0, 0, 0, 136, 3, 0, 0, 16, 4, 0, 0, 8, 0, 0, 0, 32, 4, 0, 0, 0, 0, 0, 0, 128, 4, 0, 0, 136, 4, 0, 0, 1, 0, 0, 0, 152, 4, 0, 0, 0, 0, 0, 0, 164, 4, 0, 0, 136, 4, 0, 0, 3, 0, 0, 0, 172, 4, 0, 0, 0, 0, 0, 0, 208, 4, 0, 0, 136, 4, 0, 0, 3, 0, 0, 0, 216, 4, 0, 0, 0, 0, 0, 0, 252, 4, 0, 0, 136, 4, 0, 0, 1, 0, 0, 0, 8, 5, 0, 0, 0, 0, 0, 0, 20, 5, 0, 0, 32, 5, 0, 0, 3, 0, 0, 0, 48, 5, 0, 0, 0, 0, 0, 0, 84, 5, 0, 0, 176, 3, 0, 0, 3, 0, 0, 0, 92, 5, 0, 0, 0, 0, 0, 0, 128, 5, 0, 0, 140, 5, 0, 0, 3, 0, 0, 0, 156, 5, 0, 0, 0, 0, 0, 0, 192, 5, 0, 0, 136, 4, 0, 0, 1, 0, 0, 0, 204, 5, 0, 0, 76, 3, 0, 0, 216, 5, 0, 0, 52, 6, 0, 0, 3, 0, 0, 0, 68, 6, 0, 0, 136, 3, 0, 0, 216, 5, 0, 0, 52, 6, 0, 0, 5, 0, 0, 0, 104, 6, 0, 0, 0, 0, 0, 0, 164, 6, 0, 0, 236, 6, 0, 0, 3, 0, 0, 0, 252, 6, 0, 0, 0, 0, 0, 0, 32, 7, 0, 0, 136, 4, 0, 0, 1, 0, 0, 0, 44, 7, 0, 0, 0, 0, 0, 0, 56, 7, 0, 0, 136, 4, 0, 0, 1, 0, 0, 0, 64, 7, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48, 46, 49, 0, 81, 0, 0, 5, 243, 0, 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 5, 0, 1, 128, 1, 0, 15, 144, 31, 0, 0, 2, 5, 0, 2, 128, 2, 0, 15, 144, 31, 0, 0, 2, 5, 0, 3, 128, 3, 0, 15, 144, 31, 0, 0, 2, 5, 0, 4, 128, 4, 0, 15, 144, 5, 0, 0, 3, 0, 0, 3, 128, 3, 0, 228, 144, 243, 0, 0, 160, 46, 0, 0, 2, 0, 0, 3, 176, 0, 0, 225, 128, 5, 0, 0, 4, 0, 0, 15, 128, 4, 0, 85, 144, 26, 32, 228, 160, 0, 0, 0, 176, 4, 0, 0, 5, 0, 0, 15, 128, 26, 32, 228, 160, 0, 0, 85, 176, 4, 0, 0, 144, 0, 0, 228, 128, 8, 0, 0, 3, 1, 0, 1, 128, 1, 0, 228, 144, 0, 0, 228, 128, 9, 0, 0, 3, 0, 0, 1, 128, 0, 0, 228, 144, 0, 0, 228, 128, 5, 0, 0, 4, 2, 0, 15, 128, 4, 0, 85, 144, 27, 32, 228, 160, 0, 0, 0, 176, 5, 0, 0, 4, 3, 0, 15, 128, 4, 0, 85, 144, 28, 32, 228, 160, 0, 0, 0, 176, 4, 0, 0, 5, 3, 0, 15, 128, 28, 32, 228, 160, 0, 0, 85, 176, 4, 0, 0, 144, 3, 0, 228, 128, 4, 0, 0, 5, 2, 0, 15, 128, 27, 32, 228, 160, 0, 0, 85, 176, 4, 0, 0, 144, 2, 0, 228, 128, 8, 0, 0, 3, 1, 0, 2, 128, 1, 0, 228, 144, 2, 0, 228, 128, 9, 0, 0, 3, 0, 0, 2, 128, 0, 0, 228, 144, 2, 0, 228, 128, 8, 0, 0, 3, 1, 0, 4, 128, 1, 0, 228, 144, 3, 0, 228, 128, 9, 0, 0, 3, 0, 0, 4, 128, 0, 0, 228, 144, 3, 0, 228, 128, 8, 0, 0, 3, 2, 0, 1, 128, 1, 0, 228, 128, 19, 0, 228, 160, 8, 0, 0, 3, 2, 0, 2, 128, 1, 0, 228, 128, 20, 0, 228, 160, 8, 0, 0, 3, 2, 0, 4, 128, 1, 0, 228, 128, 21, 0, 228, 160, 36, 0, 0, 2, 1, 0, 7, 128, 2, 0, 228, 128, 8, 0, 0, 3, 2, 0, 1, 128, 3, 0, 228, 161, 1, 0, 228, 128, 8, 0, 0, 3, 2, 0, 2, 128, 4, 0, 228, 161, 1, 0, 228, 128, 8, 0, 0, 3, 2, 0, 4, 128, 5, 0, 228, 161, 1, 0, 228, 128, 13, 0, 0, 3, 3, 0, 7, 128, 2, 0, 228, 128, 243, 0, 85, 160, 5, 0, 0, 3, 4, 0, 7, 128, 2, 0, 228, 128, 3, 0, 228, 128, 5, 0, 0, 3, 5, 0, 7, 128, 4, 0, 85, 128, 7, 0, 228, 160, 4, 0, 0, 4, 4, 0, 11, 128, 4, 0, 0, 128, 6, 0, 164, 160, 5, 0, 164, 128, 4, 0, 0, 4, 4, 0, 7, 128, 4, 0, 170, 128, 8, 0, 228, 160, 4, 0, 244, 128, 1, 0, 0, 2, 5, 0, 7, 128, 0, 0, 228, 160, 4, 0, 0, 4, 0, 0, 7, 224, 4, 0, 228, 128, 5, 0, 228, 128, 1, 0, 228, 160, 1, 0, 0, 2, 0, 0, 8, 128, 0, 0, 255, 144, 9, 0, 0, 3, 4, 0, 1, 128, 0, 0, 228, 128, 15, 0, 228, 160, 9, 0, 0, 3, 4, 0, 2, 128, 0, 0, 228, 128, 16, 0, 228, 160, 9, 0, 0, 3, 4, 0, 4, 128, 0, 0, 228, 128, 17, 0, 228, 160, 2, 0, 0, 3, 4, 0, 7, 128, 4, 0, 228, 129, 12, 0, 228, 160, 36, 0, 0, 2, 5, 0, 7, 128, 4, 0, 228, 128, 2, 0, 0, 3, 4, 0, 7, 128, 5, 0, 228, 128, 3, 0, 228, 161, 36, 0, 0, 2, 6, 0, 7, 128, 4, 0, 228, 128, 8, 0, 0, 3, 4, 0, 1, 128, 6, 0, 228, 128, 1, 0, 228, 128, 2, 0, 0, 3, 6, 0, 7, 128, 5, 0, 228, 128, 4, 0, 228, 161, 2, 0, 0, 3, 5, 0, 7, 128, 5, 0, 228, 128, 5, 0, 228, 161, 36, 0, 0, 2, 7, 0, 7, 128, 5, 0, 228, 128, 8, 0, 0, 3, 4, 0, 4, 128, 7, 0, 228, 128, 1, 0, 228, 128, 36, 0, 0, 2, 5, 0, 7, 128, 6, 0, 228, 128, 8, 0, 0, 3, 4, 0, 2, 128, 5, 0, 228, 128, 1, 0, 228, 128, 11, 0, 0, 3, 1, 0, 7, 128, 4, 0, 228, 128, 243, 0, 85, 160, 5, 0, 0, 3, 1, 0, 7, 128, 3, 0, 228, 128, 1, 0, 228, 128, 15, 0, 0, 2, 3, 0, 1, 128, 1, 0, 0, 128, 15, 0, 0, 2, 3, 0, 2, 128, 1, 0, 85, 128, 15, 0, 0, 2, 3, 0, 4, 128, 1, 0, 170, 128, 5, 0, 0, 3, 1, 0, 7, 128, 3, 0, 228, 128, 2, 0, 255, 160, 14, 0, 0, 2, 3, 0, 1, 128, 1, 0, 0, 128, 14, 0, 0, 2, 3, 0, 2, 128, 1, 0, 85, 128, 14, 0, 0, 2, 3, 0, 4, 128, 1, 0, 170, 128, 5, 0, 0, 3, 1, 0, 7, 128, 2, 0, 228, 128, 3, 0, 228, 128, 5, 0, 0, 3, 2, 0, 7, 128, 1, 0, 85, 128, 10, 0, 228, 160, 4, 0, 0, 4, 1, 0, 11, 128, 1, 0, 0, 128, 9, 0, 164, 160, 2, 0, 164, 128, 4, 0, 0, 4, 1, 0, 7, 128, 1, 0, 170, 128, 11, 0, 228, 160, 1, 0, 244, 128, 5, 0, 0, 3, 1, 0, 7, 224, 1, 0, 228, 128, 2, 0, 228, 160, 9, 0, 0, 3, 0, 0, 4, 192, 0, 0, 228, 128, 24, 0, 228, 160, 9, 0, 0, 3, 1, 0, 1, 128, 0, 0, 228, 128, 14, 0, 228, 160, 11, 0, 0, 3, 1, 0, 1, 128, 1, 0, 0, 128, 243, 0, 85, 160, 10, 0, 0, 3, 1, 0, 8, 224, 1, 0, 0, 128, 243, 0, 170, 160, 9, 0, 0, 3, 1, 0, 1, 128, 0, 0, 228, 128, 22, 0, 228, 160, 9, 0, 0, 3, 1, 0, 2, 128, 0, 0, 228, 128, 23, 0, 228, 160, 9, 0, 0, 3, 0, 0, 1, 128, 0, 0, 228, 128, 25, 0, 228, 160, 4, 0, 0, 4, 0, 0, 3, 192, 0, 0, 0, 128, 242, 0, 228, 160, 1, 0, 228, 128, 1, 0, 0, 2, 0, 0, 8, 192, 0, 0, 0, 128, 1, 0, 0, 2, 0, 0, 8, 224, 0, 0, 255, 160, 1, 0, 0, 2, 2, 0, 3, 224, 2, 0, 228, 144, 255, 255, 0, 0, 83, 72, 68, 82, 24, 9, 0, 0, 64, 0, 1, 0, 70, 2, 0, 0, 89, 8, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 242, 0, 0, 0, 95, 0, 0, 3, 242, 16, 16, 0, 0, 0, 0, 0, 95, 0, 0, 3, 114, 16, 16, 0, 1, 0, 0, 0, 95, 0, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 95, 0, 0, 3, 50, 16, 16, 0, 3, 0, 0, 0, 95, 0, 0, 3, 50, 16, 16, 0, 4, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 50, 32, 16, 0, 2, 0, 0, 0, 103, 0, 0, 4, 242, 32, 16, 0, 3, 0, 0, 0, 1, 0, 0, 0, 104, 0, 0, 2, 7, 0, 0, 0, 38, 0, 0, 11, 0, 208, 0, 0, 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 3, 0, 0, 0, 2, 64, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 1, 0, 0, 0, 86, 21, 16, 0, 4, 0, 0, 0, 70, 142, 32, 6, 0, 0, 0, 0, 26, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 50, 0, 0, 12, 242, 0, 16, 0, 1, 0, 0, 0, 70, 142, 32, 6, 0, 0, 0, 0, 26, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 6, 16, 16, 0, 4, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 16, 0, 0, 7, 18, 0, 16, 0, 2, 0, 0, 0, 70, 18, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 17, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0, 0, 70, 30, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 3, 0, 0, 0, 86, 21, 16, 0, 4, 0, 0, 0, 70, 142, 32, 6, 0, 0, 0, 0, 27, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 50, 0, 0, 12, 242, 0, 16, 0, 3, 0, 0, 0, 70, 142, 32, 6, 0, 0, 0, 0, 27, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 6, 16, 16, 0, 4, 0, 0, 0, 70, 14, 16, 0, 3, 0, 0, 0, 16, 0, 0, 7, 34, 0, 16, 0, 2, 0, 0, 0, 70, 18, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0, 0, 17, 0, 0, 7, 34, 0, 16, 0, 1, 0, 0, 0, 70, 30, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 3, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 3, 0, 0, 0, 86, 21, 16, 0, 4, 0, 0, 0, 70, 142, 32, 6, 0, 0, 0, 0, 28, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 50, 0, 0, 12, 242, 0, 16, 0, 0, 0, 0, 0, 70, 142, 32, 6, 0, 0, 0, 0, 28, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 6, 16, 16, 0, 4, 0, 0, 0, 70, 14, 16, 0, 3, 0, 0, 0, 16, 0, 0, 7, 66, 0, 16, 0, 2, 0, 0, 0, 70, 18, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 17, 0, 0, 7, 66, 0, 16, 0, 1, 0, 0, 0, 70, 30, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 16, 0, 0, 8, 18, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 19, 0, 0, 0, 16, 0, 0, 8, 34, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 20, 0, 0, 0, 16, 0, 0, 8, 66, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 21, 0, 0, 0, 16, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 68, 0, 0, 5, 130, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 16, 0, 0, 9, 18, 0, 16, 0, 2, 0, 0, 0, 70, 130, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 16, 0, 0, 9, 34, 0, 16, 0, 2, 0, 0, 0, 70, 130, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 16, 0, 0, 9, 66, 0, 16, 0, 2, 0, 0, 0, 70, 130, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 29, 0, 0, 10, 114, 0, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 10, 114, 0, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0, 0, 2, 64, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 4, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0, 0, 56, 0, 0, 8, 114, 0, 16, 0, 5, 0, 0, 0, 86, 5, 16, 0, 4, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 7, 0, 0, 0, 50, 0, 0, 10, 178, 0, 16, 0, 4, 0, 0, 0, 6, 0, 16, 0, 4, 0, 0, 0, 70, 136, 32, 0, 0, 0, 0, 0, 6, 0, 0, 0, 70, 8, 16, 0, 5, 0, 0, 0, 50, 0, 0, 10, 114, 0, 16, 0, 4, 0, 0, 0, 166, 10, 16, 0, 4, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 8, 0, 0, 0, 70, 3, 16, 0, 4, 0, 0, 0, 50, 0, 0, 11, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 54, 0, 0, 6, 130, 32, 16, 0, 0, 0, 0, 0, 58, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1, 0, 0, 0, 58, 16, 16, 0, 0, 0, 0, 0, 17, 0, 0, 8, 18, 0, 16, 0, 4, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 15, 0, 0, 0, 17, 0, 0, 8, 34, 0, 16, 0, 4, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 0, 0, 8, 66, 0, 16, 0, 4, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 9, 114, 0, 16, 0, 4, 0, 0, 0, 70, 2, 16, 128, 65, 0, 0, 0, 4, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 12, 0, 0, 0, 16, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 68, 0, 0, 5, 130, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 50, 0, 0, 11, 114, 0, 16, 0, 5, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 130, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 16, 0, 0, 7, 130, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 5, 0, 0, 0, 70, 2, 16, 0, 5, 0, 0, 0, 68, 0, 0, 5, 130, 0, 16, 0, 2, 0, 0, 0, 58, 0, 16, 0, 2, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 5, 0, 0, 0, 246, 15, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 5, 0, 0, 0, 16, 0, 0, 7, 18, 0, 16, 0, 5, 0, 0, 0, 70, 2, 16, 0, 5, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 50, 0, 0, 11, 114, 0, 16, 0, 6, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 130, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 50, 0, 0, 11, 114, 0, 16, 0, 4, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 130, 32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 16, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 6, 0, 0, 0, 70, 2, 16, 0, 6, 0, 0, 0, 68, 0, 0, 5, 130, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 6, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 6, 0, 0, 0, 16, 0, 0, 7, 34, 0, 16, 0, 5, 0, 0, 0, 70, 2, 16, 0, 6, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 16, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 68, 0, 0, 5, 130, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 4, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 16, 0, 0, 7, 66, 0, 16, 0, 5, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 52, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 5, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 47, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 8, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 246, 143, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 25, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 8, 114, 0, 16, 0, 2, 0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 10, 0, 0, 0, 50, 0, 0, 10, 178, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 70, 136, 32, 0, 0, 0, 0, 0, 9, 0, 0, 0, 70, 8, 16, 0, 2, 0, 0, 0, 50, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0, 0, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 11, 0, 0, 0, 70, 3, 16, 0, 0, 0, 0, 0, 56, 0, 0, 8, 114, 32, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 130, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 17, 32, 0, 8, 130, 32, 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 14, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 2, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 17, 0, 0, 8, 18, 32, 16, 0, 3, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 22, 0, 0, 0, 17, 0, 0, 8, 34, 32, 16, 0, 3, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 23, 0, 0, 0, 17, 0, 0, 8, 66, 32, 16, 0, 3, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 24, 0, 0, 0, 17, 0, 0, 8, 130, 32, 16, 0, 3, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 25, 0, 0, 0, 62, 0, 0, 1, 73, 83, 71, 78, 184, 0, 0, 0, 5, 0, 0, 0, 8, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 15, 0, 0, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 7, 7, 0, 0, 147, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 3, 0, 0, 156, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 15, 3, 0, 0, 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 15, 3, 0, 0, 83, 86, 95, 80, 111, 115, 105, 116, 105, 111, 110, 0, 78, 79, 82, 77, 65, 76, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 66, 76, 69, 78, 68, 73, 78, 68, 73, 67, 69, 83, 0, 66, 76, 69, 78, 68, 87, 69, 73, 71, 72, 84, 0, 171, 171, 171, 79, 83, 71, 78, 132, 0, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 104, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 15, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 3, 12, 0, 0, 119, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 67, 79, 76, 79, 82, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 83, 86, 95, 80, 111, 115, 105, 116, 105, 111, 110, 0, 171 };
{ "pile_set_name": "Github" }
from typing import Union, Tuple, Generator, Iterable, Any BaseType = Any class BaseRegistry: def __len__(self): raise NotImplementedError def __contains__(self, item: Union[int, BaseType]): raise NotImplementedError def __iter__(self) -> Iterable[BaseType]: raise NotImplementedError def values(self) -> Tuple[BaseType]: raise NotImplementedError def items(self) -> Generator[Tuple[int, BaseType], None, None]: raise NotImplementedError def __getitem__(self, item): raise NotImplementedError def register(self, item: BaseType) -> int: raise NotImplementedError
{ "pile_set_name": "Github" }
/* This file is part of libmspack. * (C) 2003-2013 Stuart Caie. * * The LZX method was created by Jonathan Forbes and Tomi Poutanen, adapted * by Microsoft Corporation. * * libmspack is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License (LGPL) version 2.1 * * For further details, see the file COPYING.LIB distributed with libmspack */ /* LZX decompression implementation */ #include "system-mspack.h" #include "lzx.h" /* Microsoft's LZX document (in cab-sdk.exe) and their implementation * of the com.ms.util.cab Java package do not concur. * * In the LZX document, there is a table showing the correlation between * window size and the number of position slots. It states that the 1MB * window = 40 slots and the 2MB window = 42 slots. In the implementation, * 1MB = 42 slots, 2MB = 50 slots. The actual calculation is 'find the * first slot whose position base is equal to or more than the required * window size'. This would explain why other tables in the document refer * to 50 slots rather than 42. * * The constant NUM_PRIMARY_LENGTHS used in the decompression pseudocode * is not defined in the specification. * * The LZX document does not state the uncompressed block has an * uncompressed length field. Where does this length field come from, so * we can know how large the block is? The implementation has it as the 24 * bits following after the 3 blocktype bits, before the alignment * padding. * * The LZX document states that aligned offset blocks have their aligned * offset huffman tree AFTER the main and length trees. The implementation * suggests that the aligned offset tree is BEFORE the main and length * trees. * * The LZX document decoding algorithm states that, in an aligned offset * block, if an extra_bits value is 1, 2 or 3, then that number of bits * should be read and the result added to the match offset. This is * correct for 1 and 2, but not 3, where just a huffman symbol (using the * aligned tree) should be read. * * Regarding the E8 preprocessing, the LZX document states 'No translation * may be performed on the last 6 bytes of the input block'. This is * correct. However, the pseudocode provided checks for the *E8 leader* * up to the last 6 bytes. If the leader appears between -10 and -7 bytes * from the end, this would cause the next four bytes to be modified, at * least one of which would be in the last 6 bytes, which is not allowed * according to the spec. * * The specification states that the huffman trees must always contain at * least one element. However, many CAB files contain blocks where the * length tree is completely empty (because there are no matches), and * this is expected to succeed. * * The errors in LZX documentation appear have been corrected in the * new documentation for the LZX DELTA format. * * http://msdn.microsoft.com/en-us/library/cc483133.aspx * * However, this is a different format, an extension of regular LZX. * I have noticed the following differences, there may be more: * * The maximum window size has increased from 2MB to 32MB. This also * increases the maximum number of position slots, etc. * * If the match length is 257 (the maximum possible), this signals * a further length decoding step, that allows for matches up to * 33024 bytes long. * * The format now allows for "reference data", supplied by the caller. * If match offsets go further back than the number of bytes * decompressed so far, that is them accessing the reference data. */ /* import bit-reading macros and code */ #define BITS_TYPE struct lzxd_stream #define BITS_VAR lzx #define BITS_ORDER_MSB #define READ_BYTES do { \ unsigned char b0, b1; \ READ_IF_NEEDED; b0 = *i_ptr++; \ READ_IF_NEEDED; b1 = *i_ptr++; \ INJECT_BITS((b1 << 8) | b0, 16); \ } while (0) #include "readbits.h" /* import huffman-reading macros and code */ #define TABLEBITS(tbl) LZX_##tbl##_TABLEBITS #define MAXSYMBOLS(tbl) LZX_##tbl##_MAXSYMBOLS #define HUFF_TABLE(tbl,idx) lzx->tbl##_table[idx] #define HUFF_LEN(tbl,idx) lzx->tbl##_len[idx] #define HUFF_ERROR return lzx->error = MSPACK_ERR_DECRUNCH #include "readhuff.h" /* BUILD_TABLE(tbl) builds a huffman lookup table from code lengths */ #define BUILD_TABLE(tbl) \ if (make_decode_table(MAXSYMBOLS(tbl), TABLEBITS(tbl), \ &HUFF_LEN(tbl,0), &HUFF_TABLE(tbl,0))) \ { \ D(("failed to build %s table", #tbl)) \ return lzx->error = MSPACK_ERR_DECRUNCH; \ } #define BUILD_TABLE_MAYBE_EMPTY(tbl) do { \ lzx->tbl##_empty = 0; \ if (make_decode_table(MAXSYMBOLS(tbl), TABLEBITS(tbl), \ &HUFF_LEN(tbl,0), &HUFF_TABLE(tbl,0))) \ { \ for (i = 0; i < MAXSYMBOLS(tbl); i++) { \ if (HUFF_LEN(tbl, i) > 0) { \ D(("failed to build %s table", #tbl)) \ return lzx->error = MSPACK_ERR_DECRUNCH; \ } \ } \ /* empty tree - allow it, but don't decode symbols with it */ \ lzx->tbl##_empty = 1; \ } \ } while (0) /* READ_LENGTHS(tablename, first, last) reads in code lengths for symbols * first to last in the given table. The code lengths are stored in their * own special LZX way. */ #define READ_LENGTHS(tbl, first, last) do { \ STORE_BITS; \ if (lzxd_read_lens(lzx, &HUFF_LEN(tbl, 0), (first), \ (unsigned int)(last))) return lzx->error; \ RESTORE_BITS; \ } while (0) static int lzxd_read_lens(struct lzxd_stream *lzx, unsigned char *lens, unsigned int first, unsigned int last) { /* bit buffer and huffman symbol decode variables */ register unsigned int bit_buffer; register int bits_left, i; register unsigned short sym; unsigned char *i_ptr, *i_end; unsigned int x, y; int z; RESTORE_BITS; /* read lengths for pretree (20 symbols, lengths stored in fixed 4 bits) */ for (x = 0; x < 20; x++) { READ_BITS(y, 4); lzx->PRETREE_len[x] = y; } BUILD_TABLE(PRETREE); for (x = first; x < last; ) { READ_HUFFSYM(PRETREE, z); if (z == 17) { /* code = 17, run of ([read 4 bits]+4) zeros */ READ_BITS(y, 4); y += 4; while (y--) lens[x++] = 0; } else if (z == 18) { /* code = 18, run of ([read 5 bits]+20) zeros */ READ_BITS(y, 5); y += 20; while (y--) lens[x++] = 0; } else if (z == 19) { /* code = 19, run of ([read 1 bit]+4) [read huffman symbol] */ READ_BITS(y, 1); y += 4; READ_HUFFSYM(PRETREE, z); z = lens[x] - z; if (z < 0) z += 17; while (y--) lens[x++] = z; } else { /* code = 0 to 16, delta current length entry */ z = lens[x] - z; if (z < 0) z += 17; lens[x++] = z; } } STORE_BITS; return MSPACK_ERR_OK; } /* LZX static data tables: * * LZX uses 'position slots' to represent match offsets. For every match, * a small 'position slot' number and a small offset from that slot are * encoded instead of one large offset. * * The number of slots is decided by how many are needed to encode the * largest offset for a given window size. This is easy when the gap between * slots is less than 128Kb, it's a linear relationship. But when extra_bits * reaches its limit of 17 (because LZX can only ensure reading 17 bits of * data at a time), we can only jump 128Kb at a time and have to start * using more and more position slots as each window size doubles. * * position_base[] is an index to the position slot bases * * extra_bits[] states how many bits of offset-from-base data is needed. * * They are calculated as follows: * extra_bits[i] = 0 where i < 4 * extra_bits[i] = floor(i/2)-1 where i >= 4 && i < 36 * extra_bits[i] = 17 where i >= 36 * position_base[0] = 0 * position_base[i] = position_base[i-1] + (1 << extra_bits[i-1]) */ static const unsigned int position_slots[11] = { 30, 32, 34, 36, 38, 42, 50, 66, 98, 162, 290 }; static const unsigned char extra_bits[36] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16 }; static const unsigned int position_base[290] = { 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576, 32768, 49152, 65536, 98304, 131072, 196608, 262144, 393216, 524288, 655360, 786432, 917504, 1048576, 1179648, 1310720, 1441792, 1572864, 1703936, 1835008, 1966080, 2097152, 2228224, 2359296, 2490368, 2621440, 2752512, 2883584, 3014656, 3145728, 3276800, 3407872, 3538944, 3670016, 3801088, 3932160, 4063232, 4194304, 4325376, 4456448, 4587520, 4718592, 4849664, 4980736, 5111808, 5242880, 5373952, 5505024, 5636096, 5767168, 5898240, 6029312, 6160384, 6291456, 6422528, 6553600, 6684672, 6815744, 6946816, 7077888, 7208960, 7340032, 7471104, 7602176, 7733248, 7864320, 7995392, 8126464, 8257536, 8388608, 8519680, 8650752, 8781824, 8912896, 9043968, 9175040, 9306112, 9437184, 9568256, 9699328, 9830400, 9961472, 10092544, 10223616, 10354688, 10485760, 10616832, 10747904, 10878976, 11010048, 11141120, 11272192, 11403264, 11534336, 11665408, 11796480, 11927552, 12058624, 12189696, 12320768, 12451840, 12582912, 12713984, 12845056, 12976128, 13107200, 13238272, 13369344, 13500416, 13631488, 13762560, 13893632, 14024704, 14155776, 14286848, 14417920, 14548992, 14680064, 14811136, 14942208, 15073280, 15204352, 15335424, 15466496, 15597568, 15728640, 15859712, 15990784, 16121856, 16252928, 16384000, 16515072, 16646144, 16777216, 16908288, 17039360, 17170432, 17301504, 17432576, 17563648, 17694720, 17825792, 17956864, 18087936, 18219008, 18350080, 18481152, 18612224, 18743296, 18874368, 19005440, 19136512, 19267584, 19398656, 19529728, 19660800, 19791872, 19922944, 20054016, 20185088, 20316160, 20447232, 20578304, 20709376, 20840448, 20971520, 21102592, 21233664, 21364736, 21495808, 21626880, 21757952, 21889024, 22020096, 22151168, 22282240, 22413312, 22544384, 22675456, 22806528, 22937600, 23068672, 23199744, 23330816, 23461888, 23592960, 23724032, 23855104, 23986176, 24117248, 24248320, 24379392, 24510464, 24641536, 24772608, 24903680, 25034752, 25165824, 25296896, 25427968, 25559040, 25690112, 25821184, 25952256, 26083328, 26214400, 26345472, 26476544, 26607616, 26738688, 26869760, 27000832, 27131904, 27262976, 27394048, 27525120, 27656192, 27787264, 27918336, 28049408, 28180480, 28311552, 28442624, 28573696, 28704768, 28835840, 28966912, 29097984, 29229056, 29360128, 29491200, 29622272, 29753344, 29884416, 30015488, 30146560, 30277632, 30408704, 30539776, 30670848, 30801920, 30932992, 31064064, 31195136, 31326208, 31457280, 31588352, 31719424, 31850496, 31981568, 32112640, 32243712, 32374784, 32505856, 32636928, 32768000, 32899072, 33030144, 33161216, 33292288, 33423360 }; static void lzxd_reset_state(struct lzxd_stream *lzx) { int i; lzx->R0 = 1; lzx->R1 = 1; lzx->R2 = 1; lzx->header_read = 0; lzx->block_remaining = 0; lzx->block_type = LZX_BLOCKTYPE_INVALID; /* initialise tables to 0 (because deltas will be applied to them) */ for (i = 0; i < LZX_MAINTREE_MAXSYMBOLS; i++) lzx->MAINTREE_len[i] = 0; for (i = 0; i < LZX_LENGTH_MAXSYMBOLS; i++) lzx->LENGTH_len[i] = 0; } /*-------- main LZX code --------*/ struct lzxd_stream *lzxd_init(struct mspack_system *system, struct mspack_file *input, struct mspack_file *output, int window_bits, int reset_interval, int input_buffer_size, off_t output_length, char is_delta) { unsigned int window_size = 1 << window_bits; struct lzxd_stream *lzx; if (!system) return NULL; /* LZX DELTA window sizes are between 2^17 (128KiB) and 2^25 (32MiB), * regular LZX windows are between 2^15 (32KiB) and 2^21 (2MiB) */ if (is_delta) { if (window_bits < 17 || window_bits > 25) return NULL; } else { if (window_bits < 15 || window_bits > 21) return NULL; } if (reset_interval < 0 || output_length < 0) { D(("reset interval or output length < 0")) return NULL; } /* round up input buffer size to multiple of two */ input_buffer_size = (input_buffer_size + 1) & -2; if (input_buffer_size < 2) return NULL; /* allocate decompression state */ if (!(lzx = (struct lzxd_stream *) system->alloc(system, sizeof(struct lzxd_stream)))) { return NULL; } /* allocate decompression window and input buffer */ lzx->window = (unsigned char *) system->alloc(system, (size_t) window_size); lzx->inbuf = (unsigned char *) system->alloc(system, (size_t) input_buffer_size); if (!lzx->window || !lzx->inbuf) { system->free(lzx->window); system->free(lzx->inbuf); system->free(lzx); return NULL; } /* initialise decompression state */ lzx->sys = system; lzx->input = input; lzx->output = output; lzx->offset = 0; lzx->length = output_length; lzx->inbuf_size = input_buffer_size; lzx->window_size = 1 << window_bits; lzx->ref_data_size = 0; lzx->window_posn = 0; lzx->frame_posn = 0; lzx->frame = 0; lzx->reset_interval = reset_interval; lzx->intel_filesize = 0; lzx->intel_curpos = 0; lzx->intel_started = 0; lzx->error = MSPACK_ERR_OK; lzx->num_offsets = position_slots[window_bits - 15] << 3; lzx->is_delta = is_delta; lzx->o_ptr = lzx->o_end = &lzx->e8_buf[0]; lzxd_reset_state(lzx); INIT_BITS; return lzx; } int lzxd_set_reference_data(struct lzxd_stream *lzx, struct mspack_system *system, struct mspack_file *input, unsigned int length) { if (!lzx) return MSPACK_ERR_ARGS; if (!lzx->is_delta) { D(("only LZX DELTA streams support reference data")) return MSPACK_ERR_ARGS; } if (lzx->offset) { D(("too late to set reference data after decoding starts")) return MSPACK_ERR_ARGS; } if (length > lzx->window_size) { D(("reference length (%u) is longer than the window", length)) return MSPACK_ERR_ARGS; } if (length > 0 && (!system || !input)) { D(("length > 0 but no system or input")) return MSPACK_ERR_ARGS; } lzx->ref_data_size = length; if (length > 0) { /* copy reference data */ unsigned char *pos = &lzx->window[lzx->window_size - length]; int bytes = system->read(input, pos, length); /* length can't be more than 2^25, so no signedness problem */ if (bytes < (int)length) return MSPACK_ERR_READ; } lzx->ref_data_size = length; return MSPACK_ERR_OK; } void lzxd_set_output_length(struct lzxd_stream *lzx, off_t out_bytes) { if (lzx && out_bytes > 0) lzx->length = out_bytes; } int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) { /* bitstream and huffman reading variables */ register unsigned int bit_buffer; register int bits_left, i=0; unsigned char *i_ptr, *i_end; register unsigned short sym; int match_length, length_footer, extra, verbatim_bits, bytes_todo; int this_run, main_element, aligned_bits, j, warned = 0; unsigned char *window, *runsrc, *rundest, buf[12]; unsigned int frame_size=0, end_frame, match_offset, window_posn; unsigned int R0, R1, R2; /* easy answers */ if (!lzx || (out_bytes < 0)) return MSPACK_ERR_ARGS; if (lzx->error) return lzx->error; /* flush out any stored-up bytes before we begin */ i = lzx->o_end - lzx->o_ptr; if ((off_t) i > out_bytes) i = (int) out_bytes; if (i) { if (lzx->sys->write(lzx->output, lzx->o_ptr, i) != i) { return lzx->error = MSPACK_ERR_WRITE; } lzx->o_ptr += i; lzx->offset += i; out_bytes -= i; } if (out_bytes == 0) return MSPACK_ERR_OK; /* restore local state */ RESTORE_BITS; window = lzx->window; window_posn = lzx->window_posn; R0 = lzx->R0; R1 = lzx->R1; R2 = lzx->R2; end_frame = (unsigned int)((lzx->offset + out_bytes) / LZX_FRAME_SIZE) + 1; while (lzx->frame < end_frame) { /* have we reached the reset interval? (if there is one?) */ if (lzx->reset_interval && ((lzx->frame % lzx->reset_interval) == 0)) { if (lzx->block_remaining) { /* this is a file format error, we can make a best effort to extract what we can */ D(("%d bytes remaining at reset interval", lzx->block_remaining)) if (!warned) { lzx->sys->message(NULL, "WARNING; invalid reset interval detected during LZX decompression"); warned++; } } /* re-read the intel header and reset the huffman lengths */ lzxd_reset_state(lzx); R0 = lzx->R0; R1 = lzx->R1; R2 = lzx->R2; } /* LZX DELTA format has chunk_size, not present in LZX format */ if (lzx->is_delta) { ENSURE_BITS(16); REMOVE_BITS(16); } /* read header if necessary */ if (!lzx->header_read) { /* read 1 bit. if bit=0, intel filesize = 0. * if bit=1, read intel filesize (32 bits) */ j = 0; READ_BITS(i, 1); if (i) { READ_BITS(i, 16); READ_BITS(j, 16); } lzx->intel_filesize = (i << 16) | j; lzx->header_read = 1; } /* calculate size of frame: all frames are 32k except the final frame * which is 32kb or less. this can only be calculated when lzx->length * has been filled in. */ frame_size = LZX_FRAME_SIZE; if (lzx->length && (lzx->length - lzx->offset) < (off_t)frame_size) { frame_size = lzx->length - lzx->offset; } /* decode until one more frame is available */ bytes_todo = lzx->frame_posn + frame_size - window_posn; while (bytes_todo > 0) { /* initialise new block, if one is needed */ if (lzx->block_remaining == 0) { /* realign if previous block was an odd-sized UNCOMPRESSED block */ if ((lzx->block_type == LZX_BLOCKTYPE_UNCOMPRESSED) && (lzx->block_length & 1)) { READ_IF_NEEDED; i_ptr++; } /* read block type (3 bits) and block length (24 bits) */ READ_BITS(lzx->block_type, 3); READ_BITS(i, 16); READ_BITS(j, 8); lzx->block_remaining = lzx->block_length = (i << 8) | j; /*D(("new block t%d len %u", lzx->block_type, lzx->block_length))*/ /* read individual block headers */ switch (lzx->block_type) { case LZX_BLOCKTYPE_ALIGNED: /* read lengths of and build aligned huffman decoding tree */ for (i = 0; i < 8; i++) { READ_BITS(j, 3); lzx->ALIGNED_len[i] = j; } BUILD_TABLE(ALIGNED); /* rest of aligned header is same as verbatim */ /*@fallthrough@*/ case LZX_BLOCKTYPE_VERBATIM: /* read lengths of and build main huffman decoding tree */ READ_LENGTHS(MAINTREE, 0, 256); READ_LENGTHS(MAINTREE, 256, LZX_NUM_CHARS + lzx->num_offsets); BUILD_TABLE(MAINTREE); /* if the literal 0xE8 is anywhere in the block... */ if (lzx->MAINTREE_len[0xE8] != 0) lzx->intel_started = 1; /* read lengths of and build lengths huffman decoding tree */ READ_LENGTHS(LENGTH, 0, LZX_NUM_SECONDARY_LENGTHS); BUILD_TABLE_MAYBE_EMPTY(LENGTH); break; case LZX_BLOCKTYPE_UNCOMPRESSED: /* because we can't assume otherwise */ lzx->intel_started = 1; /* read 1-16 (not 0-15) bits to align to bytes */ if (bits_left == 0) ENSURE_BITS(16); bits_left = 0; bit_buffer = 0; /* read 12 bytes of stored R0 / R1 / R2 values */ for (rundest = &buf[0], i = 0; i < 12; i++) { READ_IF_NEEDED; *rundest++ = *i_ptr++; } R0 = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); R1 = buf[4] | (buf[5] << 8) | (buf[6] << 16) | (buf[7] << 24); R2 = buf[8] | (buf[9] << 8) | (buf[10] << 16) | (buf[11] << 24); break; default: D(("bad block type")) return lzx->error = MSPACK_ERR_DECRUNCH; } } /* decode more of the block: * run = min(what's available, what's needed) */ this_run = lzx->block_remaining; if (this_run > bytes_todo) this_run = bytes_todo; /* assume we decode exactly this_run bytes, for now */ bytes_todo -= this_run; lzx->block_remaining -= this_run; /* decode at least this_run bytes */ switch (lzx->block_type) { case LZX_BLOCKTYPE_VERBATIM: while (this_run > 0) { READ_HUFFSYM(MAINTREE, main_element); if (main_element < LZX_NUM_CHARS) { /* literal: 0 to LZX_NUM_CHARS-1 */ window[window_posn++] = main_element; this_run--; } else { /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */ main_element -= LZX_NUM_CHARS; /* get match length */ match_length = main_element & LZX_NUM_PRIMARY_LENGTHS; if (match_length == LZX_NUM_PRIMARY_LENGTHS) { if (lzx->LENGTH_empty) { D(("LENGTH symbol needed but tree is empty")) return lzx->error = MSPACK_ERR_DECRUNCH; } READ_HUFFSYM(LENGTH, length_footer); match_length += length_footer; } match_length += LZX_MIN_MATCH; /* get match offset */ switch ((match_offset = (main_element >> 3))) { case 0: match_offset = R0; break; case 1: match_offset = R1; R1=R0; R0 = match_offset; break; case 2: match_offset = R2; R2=R0; R0 = match_offset; break; case 3: match_offset = 1; R2=R1; R1=R0; R0 = match_offset; break; default: extra = (match_offset >= 36) ? 17 : extra_bits[match_offset]; READ_BITS(verbatim_bits, extra); match_offset = position_base[match_offset] - 2 + verbatim_bits; R2 = R1; R1 = R0; R0 = match_offset; } /* LZX DELTA uses max match length to signal even longer match */ if (match_length == LZX_MAX_MATCH && lzx->is_delta) { int extra_len = 0; ENSURE_BITS(3); /* 4 entry huffman tree */ if (PEEK_BITS(1) == 0) { REMOVE_BITS(1); /* '0' -> 8 extra length bits */ READ_BITS(extra_len, 8); } else if (PEEK_BITS(2) == 2) { REMOVE_BITS(2); /* '10' -> 10 extra length bits + 0x100 */ READ_BITS(extra_len, 10); extra_len += 0x100; } else if (PEEK_BITS(3) == 6) { REMOVE_BITS(3); /* '110' -> 12 extra length bits + 0x500 */ READ_BITS(extra_len, 12); extra_len += 0x500; } else { REMOVE_BITS(3); /* '111' -> 15 extra length bits */ READ_BITS(extra_len, 15); } match_length += extra_len; } if ((window_posn + match_length) > lzx->window_size) { D(("match ran over window wrap")) return lzx->error = MSPACK_ERR_DECRUNCH; } /* copy match */ rundest = &window[window_posn]; i = match_length; /* does match offset wrap the window? */ if (match_offset > window_posn) { if (match_offset > lzx->offset && (match_offset - window_posn) > lzx->ref_data_size) { D(("match offset beyond LZX stream")) return lzx->error = MSPACK_ERR_DECRUNCH; } /* j = length from match offset to end of window */ j = match_offset - window_posn; if (j > (int) lzx->window_size) { D(("match offset beyond window boundaries")) return lzx->error = MSPACK_ERR_DECRUNCH; } runsrc = &window[lzx->window_size - j]; if (j < i) { /* if match goes over the window edge, do two copy runs */ i -= j; while (j-- > 0) *rundest++ = *runsrc++; runsrc = window; } while (i-- > 0) *rundest++ = *runsrc++; } else { runsrc = rundest - match_offset; while (i-- > 0) *rundest++ = *runsrc++; } this_run -= match_length; window_posn += match_length; } } /* while (this_run > 0) */ break; case LZX_BLOCKTYPE_ALIGNED: while (this_run > 0) { READ_HUFFSYM(MAINTREE, main_element); if (main_element < LZX_NUM_CHARS) { /* literal: 0 to LZX_NUM_CHARS-1 */ window[window_posn++] = main_element; this_run--; } else { /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */ main_element -= LZX_NUM_CHARS; /* get match length */ match_length = main_element & LZX_NUM_PRIMARY_LENGTHS; if (match_length == LZX_NUM_PRIMARY_LENGTHS) { if (lzx->LENGTH_empty) { D(("LENGTH symbol needed but tree is empty")) return lzx->error = MSPACK_ERR_DECRUNCH; } READ_HUFFSYM(LENGTH, length_footer); match_length += length_footer; } match_length += LZX_MIN_MATCH; /* get match offset */ switch ((match_offset = (main_element >> 3))) { case 0: match_offset = R0; break; case 1: match_offset = R1; R1 = R0; R0 = match_offset; break; case 2: match_offset = R2; R2 = R0; R0 = match_offset; break; default: extra = (match_offset >= 36) ? 17 : extra_bits[match_offset]; match_offset = position_base[match_offset] - 2; if (extra > 3) { /* verbatim and aligned bits */ extra -= 3; READ_BITS(verbatim_bits, extra); match_offset += (verbatim_bits << 3); READ_HUFFSYM(ALIGNED, aligned_bits); match_offset += aligned_bits; } else if (extra == 3) { /* aligned bits only */ READ_HUFFSYM(ALIGNED, aligned_bits); match_offset += aligned_bits; } else if (extra > 0) { /* extra==1, extra==2 */ /* verbatim bits only */ READ_BITS(verbatim_bits, extra); match_offset += verbatim_bits; } else /* extra == 0 */ { /* ??? not defined in LZX specification! */ match_offset = 1; } /* update repeated offset LRU queue */ R2 = R1; R1 = R0; R0 = match_offset; } /* LZX DELTA uses max match length to signal even longer match */ if (match_length == LZX_MAX_MATCH && lzx->is_delta) { int extra_len = 0; ENSURE_BITS(3); /* 4 entry huffman tree */ if (PEEK_BITS(1) == 0) { REMOVE_BITS(1); /* '0' -> 8 extra length bits */ READ_BITS(extra_len, 8); } else if (PEEK_BITS(2) == 2) { REMOVE_BITS(2); /* '10' -> 10 extra length bits + 0x100 */ READ_BITS(extra_len, 10); extra_len += 0x100; } else if (PEEK_BITS(3) == 6) { REMOVE_BITS(3); /* '110' -> 12 extra length bits + 0x500 */ READ_BITS(extra_len, 12); extra_len += 0x500; } else { REMOVE_BITS(3); /* '111' -> 15 extra length bits */ READ_BITS(extra_len, 15); } match_length += extra_len; } if ((window_posn + match_length) > lzx->window_size) { D(("match ran over window wrap")) return lzx->error = MSPACK_ERR_DECRUNCH; } /* copy match */ rundest = &window[window_posn]; i = match_length; /* does match offset wrap the window? */ if (match_offset > window_posn) { if (match_offset > lzx->offset && (match_offset - window_posn) > lzx->ref_data_size) { D(("match offset beyond LZX stream")) return lzx->error = MSPACK_ERR_DECRUNCH; } /* j = length from match offset to end of window */ j = match_offset - window_posn; if (j > (int) lzx->window_size) { D(("match offset beyond window boundaries")) return lzx->error = MSPACK_ERR_DECRUNCH; } runsrc = &window[lzx->window_size - j]; if (j < i) { /* if match goes over the window edge, do two copy runs */ i -= j; while (j-- > 0) *rundest++ = *runsrc++; runsrc = window; } while (i-- > 0) *rundest++ = *runsrc++; } else { runsrc = rundest - match_offset; while (i-- > 0) *rundest++ = *runsrc++; } this_run -= match_length; window_posn += match_length; } } /* while (this_run > 0) */ break; case LZX_BLOCKTYPE_UNCOMPRESSED: /* as this_run is limited not to wrap a frame, this also means it * won't wrap the window (as the window is a multiple of 32k) */ rundest = &window[window_posn]; window_posn += this_run; while (this_run > 0) { if ((i = i_end - i_ptr) == 0) { READ_IF_NEEDED; } else { if (i > this_run) i = this_run; lzx->sys->copy(i_ptr, rundest, (size_t) i); rundest += i; i_ptr += i; this_run -= i; } } break; default: return lzx->error = MSPACK_ERR_DECRUNCH; /* might as well */ } /* did the final match overrun our desired this_run length? */ if (this_run < 0) { if ((unsigned int)(-this_run) > lzx->block_remaining) { D(("overrun went past end of block by %d (%d remaining)", -this_run, lzx->block_remaining )) return lzx->error = MSPACK_ERR_DECRUNCH; } lzx->block_remaining -= -this_run; } } /* while (bytes_todo > 0) */ /* streams don't extend over frame boundaries */ if ((window_posn - lzx->frame_posn) != frame_size) { D(("decode beyond output frame limits! %d != %d", window_posn - lzx->frame_posn, frame_size)) return lzx->error = MSPACK_ERR_DECRUNCH; } /* re-align input bitstream */ if (bits_left > 0) ENSURE_BITS(16); if (bits_left & 15) REMOVE_BITS(bits_left & 15); /* check that we've used all of the previous frame first */ if (lzx->o_ptr != lzx->o_end) { D(("%ld avail bytes, new %d frame", (long)(lzx->o_end - lzx->o_ptr), frame_size)) return lzx->error = MSPACK_ERR_DECRUNCH; } /* does this intel block _really_ need decoding? */ if (lzx->intel_started && lzx->intel_filesize && (lzx->frame <= 32768) && (frame_size > 10)) { unsigned char *data = &lzx->e8_buf[0]; unsigned char *dataend = &lzx->e8_buf[frame_size - 10]; signed int curpos = lzx->intel_curpos; signed int filesize = lzx->intel_filesize; signed int abs_off, rel_off; /* copy e8 block to the e8 buffer and tweak if needed */ lzx->o_ptr = data; lzx->sys->copy(&lzx->window[lzx->frame_posn], data, frame_size); while (data < dataend) { if (*data++ != 0xE8) { curpos++; continue; } abs_off = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24); if ((abs_off >= -curpos) && (abs_off < filesize)) { rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + filesize; data[0] = (unsigned char) rel_off; data[1] = (unsigned char) (rel_off >> 8); data[2] = (unsigned char) (rel_off >> 16); data[3] = (unsigned char) (rel_off >> 24); } data += 4; curpos += 5; } lzx->intel_curpos += frame_size; } else { lzx->o_ptr = &lzx->window[lzx->frame_posn]; if (lzx->intel_filesize) lzx->intel_curpos += frame_size; } lzx->o_end = &lzx->o_ptr[frame_size]; /* write a frame */ i = (out_bytes < (off_t)frame_size) ? (unsigned int)out_bytes : frame_size; if (lzx->sys->write(lzx->output, lzx->o_ptr, i) != i) { return lzx->error = MSPACK_ERR_WRITE; } lzx->o_ptr += i; lzx->offset += i; out_bytes -= i; /* advance frame start position */ lzx->frame_posn += frame_size; lzx->frame++; /* wrap window / frame position pointers */ if (window_posn == lzx->window_size) window_posn = 0; if (lzx->frame_posn == lzx->window_size) lzx->frame_posn = 0; } /* while (lzx->frame < end_frame) */ if (out_bytes) { D(("bytes left to output")) return lzx->error = MSPACK_ERR_DECRUNCH; } /* store local state */ STORE_BITS; lzx->window_posn = window_posn; lzx->R0 = R0; lzx->R1 = R1; lzx->R2 = R2; return MSPACK_ERR_OK; } void lzxd_free(struct lzxd_stream *lzx) { struct mspack_system *sys; if (lzx) { sys = lzx->sys; sys->free(lzx->inbuf); sys->free(lzx->window); sys->free(lzx); } }
{ "pile_set_name": "Github" }
C2.pl works
{ "pile_set_name": "Github" }
# ReportRunMetricsResponseReportRunMetricResultStatus - UNSPECIFIED: Default value if not present. - OK: Indicates successful reporting. - INVALID_ARGUMENT: Indicates that the payload of the metric is invalid. - DUPLICATE_REPORTING: Indicates that the metric has been reported before. - INTERNAL_ERROR: Indicates that something went wrong in the server. ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
{ "pile_set_name": "Github" }
<?php /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * Interface for classes that can return a description of itself. * * @since Interface available since Release 3.0.0 */ interface PHPUnit_Framework_SelfDescribing { /** * Returns a string representation of the object. * * @return string */ public function toString(); }
{ "pile_set_name": "Github" }
// mkerrors.sh -maix32 // Code generated by the command above; see README.md. DO NOT EDIT. // +build ppc,aix // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -maix32 _const.go package unix import "syscall" const ( AF_APPLETALK = 0x10 AF_BYPASS = 0x19 AF_CCITT = 0xa AF_CHAOS = 0x5 AF_DATAKIT = 0x9 AF_DECnet = 0xc AF_DLI = 0xd AF_ECMA = 0x8 AF_HYLINK = 0xf AF_IMPLINK = 0x3 AF_INET = 0x2 AF_INET6 = 0x18 AF_INTF = 0x14 AF_ISO = 0x7 AF_LAT = 0xe AF_LINK = 0x12 AF_LOCAL = 0x1 AF_MAX = 0x1e AF_NDD = 0x17 AF_NETWARE = 0x16 AF_NS = 0x6 AF_OSI = 0x7 AF_PUP = 0x4 AF_RIF = 0x15 AF_ROUTE = 0x11 AF_SNA = 0xb AF_UNIX = 0x1 AF_UNSPEC = 0x0 ALTWERASE = 0x400000 ARPHRD_802_3 = 0x6 ARPHRD_802_5 = 0x6 ARPHRD_ETHER = 0x1 ARPHRD_FDDI = 0x1 B0 = 0x0 B110 = 0x3 B1200 = 0x9 B134 = 0x4 B150 = 0x5 B1800 = 0xa B19200 = 0xe B200 = 0x6 B2400 = 0xb B300 = 0x7 B38400 = 0xf B4800 = 0xc B50 = 0x1 B600 = 0x8 B75 = 0x2 B9600 = 0xd BRKINT = 0x2 BS0 = 0x0 BS1 = 0x1000 BSDLY = 0x1000 CAP_AACCT = 0x6 CAP_ARM_APPLICATION = 0x5 CAP_BYPASS_RAC_VMM = 0x3 CAP_CLEAR = 0x0 CAP_CREDENTIALS = 0x7 CAP_EFFECTIVE = 0x1 CAP_EWLM_AGENT = 0x4 CAP_INHERITABLE = 0x2 CAP_MAXIMUM = 0x7 CAP_NUMA_ATTACH = 0x2 CAP_PERMITTED = 0x3 CAP_PROPAGATE = 0x1 CAP_PROPOGATE = 0x1 CAP_SET = 0x1 CBAUD = 0xf CFLUSH = 0xf CIBAUD = 0xf0000 CLOCAL = 0x800 CLOCK_MONOTONIC = 0xa CLOCK_PROCESS_CPUTIME_ID = 0xb CLOCK_REALTIME = 0x9 CLOCK_THREAD_CPUTIME_ID = 0xc CR0 = 0x0 CR1 = 0x100 CR2 = 0x200 CR3 = 0x300 CRDLY = 0x300 CREAD = 0x80 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 CS8 = 0x30 CSIOCGIFCONF = -0x3ff796dc CSIZE = 0x30 CSMAP_DIR = "/usr/lib/nls/csmap/" CSTART = '\021' CSTOP = '\023' CSTOPB = 0x40 CSUSP = 0x1a ECHO = 0x8 ECHOCTL = 0x20000 ECHOE = 0x10 ECHOK = 0x20 ECHOKE = 0x80000 ECHONL = 0x40 ECHOPRT = 0x40000 ECH_ICMPID = 0x2 ETHERNET_CSMACD = 0x6 EVENP = 0x80 EXCONTINUE = 0x0 EXDLOK = 0x3 EXIO = 0x2 EXPGIO = 0x0 EXRESUME = 0x2 EXRETURN = 0x1 EXSIG = 0x4 EXTA = 0xe EXTB = 0xf EXTRAP = 0x1 EYEC_RTENTRYA = 0x257274656e747241 EYEC_RTENTRYF = 0x257274656e747246 E_ACC = 0x0 FD_CLOEXEC = 0x1 FD_SETSIZE = 0xfffe FF0 = 0x0 FF1 = 0x2000 FFDLY = 0x2000 FLUSHBAND = 0x40 FLUSHLOW = 0x8 FLUSHO = 0x100000 FLUSHR = 0x1 FLUSHRW = 0x3 FLUSHW = 0x2 F_CLOSEM = 0xa F_DUP2FD = 0xe F_DUPFD = 0x0 F_GETFD = 0x1 F_GETFL = 0x3 F_GETLK = 0x5 F_GETLK64 = 0xb F_GETOWN = 0x8 F_LOCK = 0x1 F_OK = 0x0 F_RDLCK = 0x1 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLK = 0x6 F_SETLK64 = 0xc F_SETLKW = 0x7 F_SETLKW64 = 0xd F_SETOWN = 0x9 F_TEST = 0x3 F_TLOCK = 0x2 F_TSTLK = 0xf F_ULOCK = 0x0 F_UNLCK = 0x3 F_WRLCK = 0x2 HUPCL = 0x400 IBSHIFT = 0x10 ICANON = 0x2 ICMP6_FILTER = 0x26 ICMP6_SEC_SEND_DEL = 0x46 ICMP6_SEC_SEND_GET = 0x47 ICMP6_SEC_SEND_SET = 0x44 ICMP6_SEC_SEND_SET_CGA_ADDR = 0x45 ICRNL = 0x100 IEXTEN = 0x200000 IFA_FIRSTALIAS = 0x2000 IFA_ROUTE = 0x1 IFF_64BIT = 0x4000000 IFF_ALLCAST = 0x20000 IFF_ALLMULTI = 0x200 IFF_BPF = 0x8000000 IFF_BRIDGE = 0x40000 IFF_BROADCAST = 0x2 IFF_CANTCHANGE = 0x80c52 IFF_CHECKSUM_OFFLOAD = 0x10000000 IFF_D1 = 0x8000 IFF_D2 = 0x4000 IFF_D3 = 0x2000 IFF_D4 = 0x1000 IFF_DEBUG = 0x4 IFF_DEVHEALTH = 0x4000 IFF_DO_HW_LOOPBACK = 0x10000 IFF_GROUP_ROUTING = 0x2000000 IFF_IFBUFMGT = 0x800000 IFF_LINK0 = 0x100000 IFF_LINK1 = 0x200000 IFF_LINK2 = 0x400000 IFF_LOOPBACK = 0x8 IFF_MULTICAST = 0x80000 IFF_NOARP = 0x80 IFF_NOECHO = 0x800 IFF_NOTRAILERS = 0x20 IFF_OACTIVE = 0x400 IFF_POINTOPOINT = 0x10 IFF_PROMISC = 0x100 IFF_PSEG = 0x40000000 IFF_RUNNING = 0x40 IFF_SIMPLEX = 0x800 IFF_SNAP = 0x8000 IFF_TCP_DISABLE_CKSUM = 0x20000000 IFF_TCP_NOCKSUM = 0x1000000 IFF_UP = 0x1 IFF_VIPA = 0x80000000 IFNAMSIZ = 0x10 IFO_FLUSH = 0x1 IFT_1822 = 0x2 IFT_AAL5 = 0x31 IFT_ARCNET = 0x23 IFT_ARCNETPLUS = 0x24 IFT_ATM = 0x25 IFT_CEPT = 0x13 IFT_CLUSTER = 0x3e IFT_DS3 = 0x1e IFT_EON = 0x19 IFT_ETHER = 0x6 IFT_FCS = 0x3a IFT_FDDI = 0xf IFT_FRELAY = 0x20 IFT_FRELAYDCE = 0x2c IFT_GIFTUNNEL = 0x3c IFT_HDH1822 = 0x3 IFT_HF = 0x3d IFT_HIPPI = 0x2f IFT_HSSI = 0x2e IFT_HY = 0xe IFT_IB = 0xc7 IFT_ISDNBASIC = 0x14 IFT_ISDNPRIMARY = 0x15 IFT_ISO88022LLC = 0x29 IFT_ISO88023 = 0x7 IFT_ISO88024 = 0x8 IFT_ISO88025 = 0x9 IFT_ISO88026 = 0xa IFT_LAPB = 0x10 IFT_LOCALTALK = 0x2a IFT_LOOP = 0x18 IFT_MIOX25 = 0x26 IFT_MODEM = 0x30 IFT_NSIP = 0x1b IFT_OTHER = 0x1 IFT_P10 = 0xc IFT_P80 = 0xd IFT_PARA = 0x22 IFT_PPP = 0x17 IFT_PROPMUX = 0x36 IFT_PROPVIRTUAL = 0x35 IFT_PTPSERIAL = 0x16 IFT_RS232 = 0x21 IFT_SDLC = 0x11 IFT_SIP = 0x1f IFT_SLIP = 0x1c IFT_SMDSDXI = 0x2b IFT_SMDSICIP = 0x34 IFT_SN = 0x38 IFT_SONET = 0x27 IFT_SONETPATH = 0x32 IFT_SONETVT = 0x33 IFT_SP = 0x39 IFT_STARLAN = 0xb IFT_T1 = 0x12 IFT_TUNNEL = 0x3b IFT_ULTRA = 0x1d IFT_V35 = 0x2d IFT_VIPA = 0x37 IFT_X25 = 0x5 IFT_X25DDN = 0x4 IFT_X25PLE = 0x28 IFT_XETHER = 0x1a IGNBRK = 0x1 IGNCR = 0x80 IGNPAR = 0x4 IMAXBEL = 0x10000 INLCR = 0x40 INPCK = 0x10 IN_CLASSA_HOST = 0xffffff IN_CLASSA_MAX = 0x80 IN_CLASSA_NET = 0xff000000 IN_CLASSA_NSHIFT = 0x18 IN_CLASSB_HOST = 0xffff IN_CLASSB_MAX = 0x10000 IN_CLASSB_NET = 0xffff0000 IN_CLASSB_NSHIFT = 0x10 IN_CLASSC_HOST = 0xff IN_CLASSC_NET = 0xffffff00 IN_CLASSC_NSHIFT = 0x8 IN_CLASSD_HOST = 0xfffffff IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 0x1c IN_LOOPBACKNET = 0x7f IN_USE = 0x1 IPPROTO_AH = 0x33 IPPROTO_BIP = 0x53 IPPROTO_DSTOPTS = 0x3c IPPROTO_EGP = 0x8 IPPROTO_EON = 0x50 IPPROTO_ESP = 0x32 IPPROTO_FRAGMENT = 0x2c IPPROTO_GGP = 0x3 IPPROTO_GIF = 0x8c IPPROTO_GRE = 0x2f IPPROTO_HOPOPTS = 0x0 IPPROTO_ICMP = 0x1 IPPROTO_ICMPV6 = 0x3a IPPROTO_IDP = 0x16 IPPROTO_IGMP = 0x2 IPPROTO_IP = 0x0 IPPROTO_IPIP = 0x4 IPPROTO_IPV6 = 0x29 IPPROTO_LOCAL = 0x3f IPPROTO_MAX = 0x100 IPPROTO_MH = 0x87 IPPROTO_NONE = 0x3b IPPROTO_PUP = 0xc IPPROTO_QOS = 0x2d IPPROTO_RAW = 0xff IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e IPPROTO_SCTP = 0x84 IPPROTO_TCP = 0x6 IPPROTO_TP = 0x1d IPPROTO_UDP = 0x11 IPV6_ADDRFORM = 0x16 IPV6_ADDR_PREFERENCES = 0x4a IPV6_ADD_MEMBERSHIP = 0xc IPV6_AIXRAWSOCKET = 0x39 IPV6_CHECKSUM = 0x27 IPV6_DONTFRAG = 0x2d IPV6_DROP_MEMBERSHIP = 0xd IPV6_DSTOPTS = 0x36 IPV6_FLOWINFO_FLOWLABEL = 0xffffff IPV6_FLOWINFO_PRIFLOW = 0xfffffff IPV6_FLOWINFO_PRIORITY = 0xf000000 IPV6_FLOWINFO_SRFLAG = 0x10000000 IPV6_FLOWINFO_VERSION = 0xf0000000 IPV6_HOPLIMIT = 0x28 IPV6_HOPOPTS = 0x34 IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd IPV6_MIPDSTOPTS = 0x36 IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 IPV6_MULTICAST_LOOP = 0xb IPV6_NEXTHOP = 0x30 IPV6_NOPROBE = 0x1c IPV6_PATHMTU = 0x2e IPV6_PKTINFO = 0x21 IPV6_PKTOPTIONS = 0x24 IPV6_PRIORITY_10 = 0xa000000 IPV6_PRIORITY_11 = 0xb000000 IPV6_PRIORITY_12 = 0xc000000 IPV6_PRIORITY_13 = 0xd000000 IPV6_PRIORITY_14 = 0xe000000 IPV6_PRIORITY_15 = 0xf000000 IPV6_PRIORITY_8 = 0x8000000 IPV6_PRIORITY_9 = 0x9000000 IPV6_PRIORITY_BULK = 0x4000000 IPV6_PRIORITY_CONTROL = 0x7000000 IPV6_PRIORITY_FILLER = 0x1000000 IPV6_PRIORITY_INTERACTIVE = 0x6000000 IPV6_PRIORITY_RESERVED1 = 0x3000000 IPV6_PRIORITY_RESERVED2 = 0x5000000 IPV6_PRIORITY_UNATTENDED = 0x2000000 IPV6_PRIORITY_UNCHARACTERIZED = 0x0 IPV6_RECVDSTOPTS = 0x38 IPV6_RECVHOPLIMIT = 0x29 IPV6_RECVHOPOPTS = 0x35 IPV6_RECVHOPS = 0x22 IPV6_RECVIF = 0x1e IPV6_RECVPATHMTU = 0x2f IPV6_RECVPKTINFO = 0x23 IPV6_RECVRTHDR = 0x33 IPV6_RECVSRCRT = 0x1d IPV6_RECVTCLASS = 0x2a IPV6_RTHDR = 0x32 IPV6_RTHDRDSTOPTS = 0x37 IPV6_RTHDR_TYPE_0 = 0x0 IPV6_RTHDR_TYPE_2 = 0x2 IPV6_SENDIF = 0x1f IPV6_SRFLAG_LOOSE = 0x0 IPV6_SRFLAG_STRICT = 0x10000000 IPV6_TCLASS = 0x2b IPV6_TOKEN_LENGTH = 0x40 IPV6_UNICAST_HOPS = 0x4 IPV6_USE_MIN_MTU = 0x2c IPV6_V6ONLY = 0x25 IPV6_VERSION = 0x60000000 IP_ADDRFORM = 0x16 IP_ADD_MEMBERSHIP = 0xc IP_ADD_SOURCE_MEMBERSHIP = 0x3c IP_BLOCK_SOURCE = 0x3a IP_BROADCAST_IF = 0x10 IP_CACHE_LINE_SIZE = 0x80 IP_DEFAULT_MULTICAST_LOOP = 0x1 IP_DEFAULT_MULTICAST_TTL = 0x1 IP_DF = 0x4000 IP_DHCPMODE = 0x11 IP_DONTFRAG = 0x19 IP_DROP_MEMBERSHIP = 0xd IP_DROP_SOURCE_MEMBERSHIP = 0x3d IP_FINDPMTU = 0x1a IP_HDRINCL = 0x2 IP_INC_MEMBERSHIPS = 0x14 IP_INIT_MEMBERSHIP = 0x14 IP_MAXPACKET = 0xffff IP_MF = 0x2000 IP_MSS = 0x240 IP_MULTICAST_HOPS = 0xa IP_MULTICAST_IF = 0x9 IP_MULTICAST_LOOP = 0xb IP_MULTICAST_TTL = 0xa IP_OPT = 0x1b IP_OPTIONS = 0x1 IP_PMTUAGE = 0x1b IP_RECVDSTADDR = 0x7 IP_RECVIF = 0x14 IP_RECVIFINFO = 0xf IP_RECVINTERFACE = 0x20 IP_RECVMACHDR = 0xe IP_RECVOPTS = 0x5 IP_RECVRETOPTS = 0x6 IP_RECVTTL = 0x22 IP_RETOPTS = 0x8 IP_SOURCE_FILTER = 0x48 IP_TOS = 0x3 IP_TTL = 0x4 IP_UNBLOCK_SOURCE = 0x3b IP_UNICAST_HOPS = 0x4 ISIG = 0x1 ISTRIP = 0x20 IUCLC = 0x800 IXANY = 0x1000 IXOFF = 0x400 IXON = 0x200 I_FLUSH = 0x20005305 LNOFLSH = 0x8000 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 MADV_DONTNEED = 0x4 MADV_NORMAL = 0x0 MADV_RANDOM = 0x1 MADV_SEQUENTIAL = 0x2 MADV_SPACEAVAIL = 0x5 MADV_WILLNEED = 0x3 MAP_ANON = 0x10 MAP_ANONYMOUS = 0x10 MAP_FILE = 0x0 MAP_FIXED = 0x100 MAP_PRIVATE = 0x2 MAP_SHARED = 0x1 MAP_TYPE = 0xf0 MAP_VARIABLE = 0x0 MCAST_BLOCK_SOURCE = 0x40 MCAST_EXCLUDE = 0x2 MCAST_INCLUDE = 0x1 MCAST_JOIN_GROUP = 0x3e MCAST_JOIN_SOURCE_GROUP = 0x42 MCAST_LEAVE_GROUP = 0x3f MCAST_LEAVE_SOURCE_GROUP = 0x43 MCAST_SOURCE_FILTER = 0x49 MCAST_UNBLOCK_SOURCE = 0x41 MCL_CURRENT = 0x100 MCL_FUTURE = 0x200 MSG_ANY = 0x4 MSG_ARGEXT = 0x400 MSG_BAND = 0x2 MSG_COMPAT = 0x8000 MSG_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 MSG_EOR = 0x8 MSG_HIPRI = 0x1 MSG_MAXIOVLEN = 0x10 MSG_MPEG2 = 0x80 MSG_NONBLOCK = 0x4000 MSG_NOSIGNAL = 0x100 MSG_OOB = 0x1 MSG_PEEK = 0x2 MSG_TRUNC = 0x10 MSG_WAITALL = 0x40 MSG_WAITFORONE = 0x200 MS_ASYNC = 0x10 MS_EINTR = 0x80 MS_INVALIDATE = 0x40 MS_PER_SEC = 0x3e8 MS_SYNC = 0x20 NFDBITS = 0x20 NL0 = 0x0 NL1 = 0x4000 NL2 = 0x8000 NL3 = 0xc000 NLDLY = 0x4000 NOFLSH = 0x80 NOFLUSH = 0x80000000 OCRNL = 0x8 OFDEL = 0x80 OFILL = 0x40 OLCUC = 0x2 ONLCR = 0x4 ONLRET = 0x20 ONOCR = 0x10 ONOEOT = 0x80000 OPOST = 0x1 OXTABS = 0x40000 O_ACCMODE = 0x23 O_APPEND = 0x8 O_CIO = 0x80 O_CIOR = 0x800000000 O_CLOEXEC = 0x800000 O_CREAT = 0x100 O_DEFER = 0x2000 O_DELAY = 0x4000 O_DIRECT = 0x8000000 O_DIRECTORY = 0x80000 O_DSYNC = 0x400000 O_EFSOFF = 0x400000000 O_EFSON = 0x200000000 O_EXCL = 0x400 O_EXEC = 0x20 O_LARGEFILE = 0x4000000 O_NDELAY = 0x8000 O_NOCACHE = 0x100000 O_NOCTTY = 0x800 O_NOFOLLOW = 0x1000000 O_NONBLOCK = 0x4 O_NONE = 0x3 O_NSHARE = 0x10000 O_RAW = 0x100000000 O_RDONLY = 0x0 O_RDWR = 0x2 O_RSHARE = 0x1000 O_RSYNC = 0x200000 O_SEARCH = 0x20 O_SNAPSHOT = 0x40 O_SYNC = 0x10 O_TRUNC = 0x200 O_TTY_INIT = 0x0 O_WRONLY = 0x1 PARENB = 0x100 PAREXT = 0x100000 PARMRK = 0x8 PARODD = 0x200 PENDIN = 0x20000000 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 PROT_EXEC = 0x4 PROT_NONE = 0x0 PROT_READ = 0x1 PROT_WRITE = 0x2 PR_64BIT = 0x20 PR_ADDR = 0x2 PR_ARGEXT = 0x400 PR_ATOMIC = 0x1 PR_CONNREQUIRED = 0x4 PR_FASTHZ = 0x5 PR_INP = 0x40 PR_INTRLEVEL = 0x8000 PR_MLS = 0x100 PR_MLS_1_LABEL = 0x200 PR_NOEOR = 0x4000 PR_RIGHTS = 0x10 PR_SLOWHZ = 0x2 PR_WANTRCVD = 0x8 RLIMIT_AS = 0x6 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 RLIMIT_NOFILE = 0x7 RLIMIT_NPROC = 0x9 RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffff RTAX_AUTHOR = 0x6 RTAX_BRD = 0x7 RTAX_DST = 0x0 RTAX_GATEWAY = 0x1 RTAX_GENMASK = 0x3 RTAX_IFA = 0x5 RTAX_IFP = 0x4 RTAX_MAX = 0x8 RTAX_NETMASK = 0x2 RTA_AUTHOR = 0x40 RTA_BRD = 0x80 RTA_DOWNSTREAM = 0x100 RTA_DST = 0x1 RTA_GATEWAY = 0x2 RTA_GENMASK = 0x8 RTA_IFA = 0x20 RTA_IFP = 0x10 RTA_NETMASK = 0x4 RTC_IA64 = 0x3 RTC_POWER = 0x1 RTC_POWER_PC = 0x2 RTF_ACTIVE_DGD = 0x1000000 RTF_BCE = 0x80000 RTF_BLACKHOLE = 0x1000 RTF_BROADCAST = 0x400000 RTF_BUL = 0x2000 RTF_CLONE = 0x10000 RTF_CLONED = 0x20000 RTF_CLONING = 0x100 RTF_DONE = 0x40 RTF_DYNAMIC = 0x10 RTF_FREE_IN_PROG = 0x4000000 RTF_GATEWAY = 0x2 RTF_HOST = 0x4 RTF_LLINFO = 0x400 RTF_LOCAL = 0x200000 RTF_MASK = 0x80 RTF_MODIFIED = 0x20 RTF_MULTICAST = 0x800000 RTF_PERMANENT6 = 0x8000000 RTF_PINNED = 0x100000 RTF_PROTO1 = 0x8000 RTF_PROTO2 = 0x4000 RTF_PROTO3 = 0x40000 RTF_REJECT = 0x8 RTF_SMALLMTU = 0x40000 RTF_STATIC = 0x800 RTF_STOPSRCH = 0x2000000 RTF_UNREACHABLE = 0x10000000 RTF_UP = 0x1 RTF_XRESOLVE = 0x200 RTM_ADD = 0x1 RTM_CHANGE = 0x3 RTM_DELADDR = 0xd RTM_DELETE = 0x2 RTM_EXPIRE = 0xf RTM_GET = 0x4 RTM_GETNEXT = 0x11 RTM_IFINFO = 0xe RTM_LOCK = 0x8 RTM_LOSING = 0x5 RTM_MISS = 0x7 RTM_NEWADDR = 0xc RTM_OLDADD = 0x9 RTM_OLDDEL = 0xa RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb RTM_RTLOST = 0x10 RTM_RTTUNIT = 0xf4240 RTM_SAMEADDR = 0x12 RTM_SET = 0x13 RTM_VERSION = 0x2 RTM_VERSION_GR = 0x4 RTM_VERSION_GR_COMPAT = 0x3 RTM_VERSION_POLICY = 0x5 RTM_VERSION_POLICY_EXT = 0x6 RTM_VERSION_POLICY_PRFN = 0x7 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 RTV_MTU = 0x1 RTV_RPIPE = 0x8 RTV_RTT = 0x40 RTV_RTTVAR = 0x80 RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 RUSAGE_THREAD = 0x1 SCM_RIGHTS = 0x1 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 SIGMAX64 = 0xff SIGQUEUE_MAX = 0x20 SIOCADDIFVIPA = 0x20006942 SIOCADDMTU = -0x7ffb9690 SIOCADDMULTI = -0x7fdf96cf SIOCADDNETID = -0x7fd796a9 SIOCADDRT = -0x7fcf8df6 SIOCAIFADDR = -0x7fbf96e6 SIOCATMARK = 0x40047307 SIOCDARP = -0x7fb396e0 SIOCDELIFVIPA = 0x20006943 SIOCDELMTU = -0x7ffb968f SIOCDELMULTI = -0x7fdf96ce SIOCDELPMTU = -0x7fd78ff6 SIOCDELRT = -0x7fcf8df5 SIOCDIFADDR = -0x7fd796e7 SIOCDNETOPT = -0x3ffe9680 SIOCDX25XLATE = -0x7fd7969b SIOCFIFADDR = -0x7fdf966d SIOCGARP = -0x3fb396da SIOCGETMTUS = 0x2000696f SIOCGETSGCNT = -0x3feb8acc SIOCGETVIFCNT = -0x3feb8acd SIOCGHIWAT = 0x40047301 SIOCGIFADDR = -0x3fd796df SIOCGIFADDRS = 0x2000698c SIOCGIFBAUDRATE = -0x3fdf9669 SIOCGIFBRDADDR = -0x3fd796dd SIOCGIFCONF = -0x3ff796bb SIOCGIFCONFGLOB = -0x3ff79670 SIOCGIFDSTADDR = -0x3fd796de SIOCGIFFLAGS = -0x3fd796ef SIOCGIFGIDLIST = 0x20006968 SIOCGIFHWADDR = -0x3fab966b SIOCGIFMETRIC = -0x3fd796e9 SIOCGIFMTU = -0x3fd796aa SIOCGIFNETMASK = -0x3fd796db SIOCGIFOPTIONS = -0x3fd796d6 SIOCGISNO = -0x3fd79695 SIOCGLOADF = -0x3ffb967e SIOCGLOWAT = 0x40047303 SIOCGNETOPT = -0x3ffe96a5 SIOCGNETOPT1 = -0x3fdf967f SIOCGNMTUS = 0x2000696e SIOCGPGRP = 0x40047309 SIOCGSIZIFCONF = 0x4004696a SIOCGSRCFILTER = -0x3fe796cb SIOCGTUNEPHASE = -0x3ffb9676 SIOCGX25XLATE = -0x3fd7969c SIOCIFATTACH = -0x7fdf9699 SIOCIFDETACH = -0x7fdf969a SIOCIFGETPKEY = -0x7fdf969b SIOCIF_ATM_DARP = -0x7fdf9683 SIOCIF_ATM_DUMPARP = -0x7fdf9685 SIOCIF_ATM_GARP = -0x7fdf9682 SIOCIF_ATM_IDLE = -0x7fdf9686 SIOCIF_ATM_SARP = -0x7fdf9681 SIOCIF_ATM_SNMPARP = -0x7fdf9687 SIOCIF_ATM_SVC = -0x7fdf9684 SIOCIF_ATM_UBR = -0x7fdf9688 SIOCIF_DEVHEALTH = -0x7ffb966c SIOCIF_IB_ARP_INCOMP = -0x7fdf9677 SIOCIF_IB_ARP_TIMER = -0x7fdf9678 SIOCIF_IB_CLEAR_PINFO = -0x3fdf966f SIOCIF_IB_DEL_ARP = -0x7fdf967f SIOCIF_IB_DEL_PINFO = -0x3fdf9670 SIOCIF_IB_DUMP_ARP = -0x7fdf9680 SIOCIF_IB_GET_ARP = -0x7fdf967e SIOCIF_IB_GET_INFO = -0x3f879675 SIOCIF_IB_GET_STATS = -0x3f879672 SIOCIF_IB_NOTIFY_ADDR_REM = -0x3f87966a SIOCIF_IB_RESET_STATS = -0x3f879671 SIOCIF_IB_RESIZE_CQ = -0x7fdf9679 SIOCIF_IB_SET_ARP = -0x7fdf967d SIOCIF_IB_SET_PKEY = -0x7fdf967c SIOCIF_IB_SET_PORT = -0x7fdf967b SIOCIF_IB_SET_QKEY = -0x7fdf9676 SIOCIF_IB_SET_QSIZE = -0x7fdf967a SIOCLISTIFVIPA = 0x20006944 SIOCSARP = -0x7fb396e2 SIOCSHIWAT = 0x80047300 SIOCSIFADDR = -0x7fd796f4 SIOCSIFADDRORI = -0x7fdb9673 SIOCSIFBRDADDR = -0x7fd796ed SIOCSIFDSTADDR = -0x7fd796f2 SIOCSIFFLAGS = -0x7fd796f0 SIOCSIFGIDLIST = 0x20006969 SIOCSIFMETRIC = -0x7fd796e8 SIOCSIFMTU = -0x7fd796a8 SIOCSIFNETDUMP = -0x7fd796e4 SIOCSIFNETMASK = -0x7fd796ea SIOCSIFOPTIONS = -0x7fd796d7 SIOCSIFSUBCHAN = -0x7fd796e5 SIOCSISNO = -0x7fd79694 SIOCSLOADF = -0x3ffb967d SIOCSLOWAT = 0x80047302 SIOCSNETOPT = -0x7ffe96a6 SIOCSPGRP = 0x80047308 SIOCSX25XLATE = -0x7fd7969d SOCK_CONN_DGRAM = 0x6 SOCK_DGRAM = 0x2 SOCK_RAW = 0x3 SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 SOL_SOCKET = 0xffff SOMAXCONN = 0x400 SO_ACCEPTCONN = 0x2 SO_AUDIT = 0x8000 SO_BROADCAST = 0x20 SO_CKSUMRECV = 0x800 SO_DEBUG = 0x1 SO_DONTROUTE = 0x10 SO_ERROR = 0x1007 SO_KEEPALIVE = 0x8 SO_KERNACCEPT = 0x2000 SO_LINGER = 0x80 SO_NOMULTIPATH = 0x4000 SO_NOREUSEADDR = 0x1000 SO_OOBINLINE = 0x100 SO_PEERID = 0x1009 SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_SNDBUF = 0x1001 SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 SO_TIMESTAMPNS = 0x100a SO_TYPE = 0x1008 SO_USELOOPBACK = 0x40 SO_USE_IFBUFS = 0x400 S_BANDURG = 0x400 S_EMODFMT = 0x3c000000 S_ENFMT = 0x400 S_ERROR = 0x100 S_HANGUP = 0x200 S_HIPRI = 0x2 S_ICRYPTO = 0x80000 S_IEXEC = 0x40 S_IFBLK = 0x6000 S_IFCHR = 0x2000 S_IFDIR = 0x4000 S_IFIFO = 0x1000 S_IFJOURNAL = 0x10000 S_IFLNK = 0xa000 S_IFMPX = 0x2200 S_IFMT = 0xf000 S_IFPDIR = 0x4000000 S_IFPSDIR = 0x8000000 S_IFPSSDIR = 0xc000000 S_IFREG = 0x8000 S_IFSOCK = 0xc000 S_IFSYSEA = 0x30000000 S_INPUT = 0x1 S_IREAD = 0x100 S_IRGRP = 0x20 S_IROTH = 0x4 S_IRUSR = 0x100 S_IRWXG = 0x38 S_IRWXO = 0x7 S_IRWXU = 0x1c0 S_ISGID = 0x400 S_ISUID = 0x800 S_ISVTX = 0x200 S_ITCB = 0x1000000 S_ITP = 0x800000 S_IWGRP = 0x10 S_IWOTH = 0x2 S_IWRITE = 0x80 S_IWUSR = 0x80 S_IXACL = 0x2000000 S_IXATTR = 0x40000 S_IXGRP = 0x8 S_IXINTERFACE = 0x100000 S_IXMOD = 0x40000000 S_IXOTH = 0x1 S_IXUSR = 0x40 S_MSG = 0x8 S_OUTPUT = 0x4 S_RDBAND = 0x20 S_RDNORM = 0x10 S_RESERVED1 = 0x20000 S_RESERVED2 = 0x200000 S_RESERVED3 = 0x400000 S_RESERVED4 = 0x80000000 S_RESFMT1 = 0x10000000 S_RESFMT10 = 0x34000000 S_RESFMT11 = 0x38000000 S_RESFMT12 = 0x3c000000 S_RESFMT2 = 0x14000000 S_RESFMT3 = 0x18000000 S_RESFMT4 = 0x1c000000 S_RESFMT5 = 0x20000000 S_RESFMT6 = 0x24000000 S_RESFMT7 = 0x28000000 S_RESFMT8 = 0x2c000000 S_WRBAND = 0x80 S_WRNORM = 0x40 TAB0 = 0x0 TAB1 = 0x400 TAB2 = 0x800 TAB3 = 0xc00 TABDLY = 0xc00 TCFLSH = 0x540c TCGETA = 0x5405 TCGETS = 0x5401 TCIFLUSH = 0x0 TCIOFF = 0x2 TCIOFLUSH = 0x2 TCION = 0x3 TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 TCP_24DAYS_WORTH_OF_SLOWTICKS = 0x3f4800 TCP_ACLADD = 0x23 TCP_ACLBIND = 0x26 TCP_ACLCLEAR = 0x22 TCP_ACLDEL = 0x24 TCP_ACLDENY = 0x8 TCP_ACLFLUSH = 0x21 TCP_ACLGID = 0x1 TCP_ACLLS = 0x25 TCP_ACLSUBNET = 0x4 TCP_ACLUID = 0x2 TCP_CWND_DF = 0x16 TCP_CWND_IF = 0x15 TCP_DELAY_ACK_FIN = 0x2 TCP_DELAY_ACK_SYN = 0x1 TCP_FASTNAME = 0x101080a TCP_KEEPCNT = 0x13 TCP_KEEPIDLE = 0x11 TCP_KEEPINTVL = 0x12 TCP_LSPRIV = 0x29 TCP_LUID = 0x20 TCP_MAXBURST = 0x8 TCP_MAXDF = 0x64 TCP_MAXIF = 0x64 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff TCP_MAXWINDOWSCALE = 0xe TCP_MAX_SACK = 0x4 TCP_MSS = 0x5b4 TCP_NODELAY = 0x1 TCP_NODELAYACK = 0x14 TCP_NOREDUCE_CWND_EXIT_FRXMT = 0x19 TCP_NOREDUCE_CWND_IN_FRXMT = 0x18 TCP_NOTENTER_SSTART = 0x17 TCP_OPT = 0x19 TCP_RFC1323 = 0x4 TCP_SETPRIV = 0x27 TCP_STDURG = 0x10 TCP_TIMESTAMP_OPTLEN = 0xc TCP_UNSETPRIV = 0x28 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSETA = 0x5406 TCSETAF = 0x5408 TCSETAW = 0x5407 TCSETS = 0x5402 TCSETSF = 0x5404 TCSETSW = 0x5403 TCXONC = 0x540b TIMER_ABSTIME = 0x3e7 TIMER_MAX = 0x20 TIOC = 0x5400 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 TIOCCONS = 0x80047462 TIOCEXCL = 0x2000740d TIOCFLUSH = 0x80047410 TIOCGETC = 0x40067412 TIOCGETD = 0x40047400 TIOCGETP = 0x40067408 TIOCGLTC = 0x40067474 TIOCGPGRP = 0x40047477 TIOCGSID = 0x40047448 TIOCGSIZE = 0x40087468 TIOCGWINSZ = 0x40087468 TIOCHPCL = 0x20007402 TIOCLBIC = 0x8004747e TIOCLBIS = 0x8004747f TIOCLGET = 0x4004747c TIOCLSET = 0x8004747d TIOCMBIC = 0x8004746b TIOCMBIS = 0x8004746c TIOCMGET = 0x4004746a TIOCMIWAIT = 0x80047464 TIOCMODG = 0x40047403 TIOCMODS = 0x80047404 TIOCMSET = 0x8004746d TIOCM_CAR = 0x40 TIOCM_CD = 0x40 TIOCM_CTS = 0x20 TIOCM_DSR = 0x100 TIOCM_DTR = 0x2 TIOCM_LE = 0x1 TIOCM_RI = 0x80 TIOCM_RNG = 0x80 TIOCM_RTS = 0x4 TIOCM_SR = 0x10 TIOCM_ST = 0x8 TIOCNOTTY = 0x20007471 TIOCNXCL = 0x2000740e TIOCOUTQ = 0x40047473 TIOCPKT = 0x80047470 TIOCPKT_DATA = 0x0 TIOCPKT_DOSTOP = 0x20 TIOCPKT_FLUSHREAD = 0x1 TIOCPKT_FLUSHWRITE = 0x2 TIOCPKT_NOSTOP = 0x10 TIOCPKT_START = 0x8 TIOCPKT_STOP = 0x4 TIOCREMOTE = 0x80047469 TIOCSBRK = 0x2000747b TIOCSDTR = 0x20007479 TIOCSETC = 0x80067411 TIOCSETD = 0x80047401 TIOCSETN = 0x8006740a TIOCSETP = 0x80067409 TIOCSLTC = 0x80067475 TIOCSPGRP = 0x80047476 TIOCSSIZE = 0x80087467 TIOCSTART = 0x2000746e TIOCSTI = 0x80017472 TIOCSTOP = 0x2000746f TIOCSWINSZ = 0x80087467 TIOCUCNTL = 0x80047466 TOSTOP = 0x10000 UTIME_NOW = -0x2 UTIME_OMIT = -0x3 VDISCRD = 0xc VDSUSP = 0xa VEOF = 0x4 VEOL = 0x5 VEOL2 = 0x6 VERASE = 0x2 VINTR = 0x0 VKILL = 0x3 VLNEXT = 0xe VMIN = 0x4 VQUIT = 0x1 VREPRINT = 0xb VSTART = 0x7 VSTOP = 0x8 VSTRT = 0x7 VSUSP = 0x9 VT0 = 0x0 VT1 = 0x8000 VTDELAY = 0x2000 VTDLY = 0x8000 VTIME = 0x5 VWERSE = 0xd WPARSTART = 0x1 WPARSTOP = 0x2 WPARTTYNAME = "Global" XCASE = 0x4 XTABS = 0xc00 _FDATAFLUSH = 0x2000000000 ) // Errors const ( E2BIG = syscall.Errno(0x7) EACCES = syscall.Errno(0xd) EADDRINUSE = syscall.Errno(0x43) EADDRNOTAVAIL = syscall.Errno(0x44) EAFNOSUPPORT = syscall.Errno(0x42) EAGAIN = syscall.Errno(0xb) EALREADY = syscall.Errno(0x38) EBADF = syscall.Errno(0x9) EBADMSG = syscall.Errno(0x78) EBUSY = syscall.Errno(0x10) ECANCELED = syscall.Errno(0x75) ECHILD = syscall.Errno(0xa) ECHRNG = syscall.Errno(0x25) ECLONEME = syscall.Errno(0x52) ECONNABORTED = syscall.Errno(0x48) ECONNREFUSED = syscall.Errno(0x4f) ECONNRESET = syscall.Errno(0x49) ECORRUPT = syscall.Errno(0x59) EDEADLK = syscall.Errno(0x2d) EDESTADDREQ = syscall.Errno(0x3a) EDESTADDRREQ = syscall.Errno(0x3a) EDIST = syscall.Errno(0x35) EDOM = syscall.Errno(0x21) EDQUOT = syscall.Errno(0x58) EEXIST = syscall.Errno(0x11) EFAULT = syscall.Errno(0xe) EFBIG = syscall.Errno(0x1b) EFORMAT = syscall.Errno(0x30) EHOSTDOWN = syscall.Errno(0x50) EHOSTUNREACH = syscall.Errno(0x51) EIDRM = syscall.Errno(0x24) EILSEQ = syscall.Errno(0x74) EINPROGRESS = syscall.Errno(0x37) EINTR = syscall.Errno(0x4) EINVAL = syscall.Errno(0x16) EIO = syscall.Errno(0x5) EISCONN = syscall.Errno(0x4b) EISDIR = syscall.Errno(0x15) EL2HLT = syscall.Errno(0x2c) EL2NSYNC = syscall.Errno(0x26) EL3HLT = syscall.Errno(0x27) EL3RST = syscall.Errno(0x28) ELNRNG = syscall.Errno(0x29) ELOOP = syscall.Errno(0x55) EMEDIA = syscall.Errno(0x6e) EMFILE = syscall.Errno(0x18) EMLINK = syscall.Errno(0x1f) EMSGSIZE = syscall.Errno(0x3b) EMULTIHOP = syscall.Errno(0x7d) ENAMETOOLONG = syscall.Errno(0x56) ENETDOWN = syscall.Errno(0x45) ENETRESET = syscall.Errno(0x47) ENETUNREACH = syscall.Errno(0x46) ENFILE = syscall.Errno(0x17) ENOATTR = syscall.Errno(0x70) ENOBUFS = syscall.Errno(0x4a) ENOCONNECT = syscall.Errno(0x32) ENOCSI = syscall.Errno(0x2b) ENODATA = syscall.Errno(0x7a) ENODEV = syscall.Errno(0x13) ENOENT = syscall.Errno(0x2) ENOEXEC = syscall.Errno(0x8) ENOLCK = syscall.Errno(0x31) ENOLINK = syscall.Errno(0x7e) ENOMEM = syscall.Errno(0xc) ENOMSG = syscall.Errno(0x23) ENOPROTOOPT = syscall.Errno(0x3d) ENOSPC = syscall.Errno(0x1c) ENOSR = syscall.Errno(0x76) ENOSTR = syscall.Errno(0x7b) ENOSYS = syscall.Errno(0x6d) ENOTBLK = syscall.Errno(0xf) ENOTCONN = syscall.Errno(0x4c) ENOTDIR = syscall.Errno(0x14) ENOTEMPTY = syscall.Errno(0x11) ENOTREADY = syscall.Errno(0x2e) ENOTRECOVERABLE = syscall.Errno(0x5e) ENOTRUST = syscall.Errno(0x72) ENOTSOCK = syscall.Errno(0x39) ENOTSUP = syscall.Errno(0x7c) ENOTTY = syscall.Errno(0x19) ENXIO = syscall.Errno(0x6) EOPNOTSUPP = syscall.Errno(0x40) EOVERFLOW = syscall.Errno(0x7f) EOWNERDEAD = syscall.Errno(0x5f) EPERM = syscall.Errno(0x1) EPFNOSUPPORT = syscall.Errno(0x41) EPIPE = syscall.Errno(0x20) EPROCLIM = syscall.Errno(0x53) EPROTO = syscall.Errno(0x79) EPROTONOSUPPORT = syscall.Errno(0x3e) EPROTOTYPE = syscall.Errno(0x3c) ERANGE = syscall.Errno(0x22) EREMOTE = syscall.Errno(0x5d) ERESTART = syscall.Errno(0x52) EROFS = syscall.Errno(0x1e) ESAD = syscall.Errno(0x71) ESHUTDOWN = syscall.Errno(0x4d) ESOCKTNOSUPPORT = syscall.Errno(0x3f) ESOFT = syscall.Errno(0x6f) ESPIPE = syscall.Errno(0x1d) ESRCH = syscall.Errno(0x3) ESTALE = syscall.Errno(0x34) ESYSERROR = syscall.Errno(0x5a) ETIME = syscall.Errno(0x77) ETIMEDOUT = syscall.Errno(0x4e) ETOOMANYREFS = syscall.Errno(0x73) ETXTBSY = syscall.Errno(0x1a) EUNATCH = syscall.Errno(0x2a) EUSERS = syscall.Errno(0x54) EWOULDBLOCK = syscall.Errno(0xb) EWRPROTECT = syscall.Errno(0x2f) EXDEV = syscall.Errno(0x12) ) // Signals const ( SIGABRT = syscall.Signal(0x6) SIGAIO = syscall.Signal(0x17) SIGALRM = syscall.Signal(0xe) SIGALRM1 = syscall.Signal(0x26) SIGBUS = syscall.Signal(0xa) SIGCAPI = syscall.Signal(0x31) SIGCHLD = syscall.Signal(0x14) SIGCLD = syscall.Signal(0x14) SIGCONT = syscall.Signal(0x13) SIGCPUFAIL = syscall.Signal(0x3b) SIGDANGER = syscall.Signal(0x21) SIGEMT = syscall.Signal(0x7) SIGFPE = syscall.Signal(0x8) SIGGRANT = syscall.Signal(0x3c) SIGHUP = syscall.Signal(0x1) SIGILL = syscall.Signal(0x4) SIGINT = syscall.Signal(0x2) SIGIO = syscall.Signal(0x17) SIGIOINT = syscall.Signal(0x10) SIGIOT = syscall.Signal(0x6) SIGKAP = syscall.Signal(0x3c) SIGKILL = syscall.Signal(0x9) SIGLOST = syscall.Signal(0x6) SIGMAX = syscall.Signal(0x3f) SIGMAX32 = syscall.Signal(0x3f) SIGMIGRATE = syscall.Signal(0x23) SIGMSG = syscall.Signal(0x1b) SIGPIPE = syscall.Signal(0xd) SIGPOLL = syscall.Signal(0x17) SIGPRE = syscall.Signal(0x24) SIGPROF = syscall.Signal(0x20) SIGPTY = syscall.Signal(0x17) SIGPWR = syscall.Signal(0x1d) SIGQUIT = syscall.Signal(0x3) SIGRECONFIG = syscall.Signal(0x3a) SIGRETRACT = syscall.Signal(0x3d) SIGSAK = syscall.Signal(0x3f) SIGSEGV = syscall.Signal(0xb) SIGSOUND = syscall.Signal(0x3e) SIGSTOP = syscall.Signal(0x11) SIGSYS = syscall.Signal(0xc) SIGSYSERROR = syscall.Signal(0x30) SIGTALRM = syscall.Signal(0x26) SIGTERM = syscall.Signal(0xf) SIGTRAP = syscall.Signal(0x5) SIGTSTP = syscall.Signal(0x12) SIGTTIN = syscall.Signal(0x15) SIGTTOU = syscall.Signal(0x16) SIGURG = syscall.Signal(0x10) SIGUSR1 = syscall.Signal(0x1e) SIGUSR2 = syscall.Signal(0x1f) SIGVIRT = syscall.Signal(0x25) SIGVTALRM = syscall.Signal(0x22) SIGWAITING = syscall.Signal(0x27) SIGWINCH = syscall.Signal(0x1c) SIGXCPU = syscall.Signal(0x18) SIGXFSZ = syscall.Signal(0x19) ) // Error table var errorList = [...]struct { num syscall.Errno name string desc string }{ {1, "EPERM", "not owner"}, {2, "ENOENT", "no such file or directory"}, {3, "ESRCH", "no such process"}, {4, "EINTR", "interrupted system call"}, {5, "EIO", "I/O error"}, {6, "ENXIO", "no such device or address"}, {7, "E2BIG", "arg list too long"}, {8, "ENOEXEC", "exec format error"}, {9, "EBADF", "bad file number"}, {10, "ECHILD", "no child processes"}, {11, "EWOULDBLOCK", "resource temporarily unavailable"}, {12, "ENOMEM", "not enough space"}, {13, "EACCES", "permission denied"}, {14, "EFAULT", "bad address"}, {15, "ENOTBLK", "block device required"}, {16, "EBUSY", "device busy"}, {17, "ENOTEMPTY", "file exists"}, {18, "EXDEV", "cross-device link"}, {19, "ENODEV", "no such device"}, {20, "ENOTDIR", "not a directory"}, {21, "EISDIR", "is a directory"}, {22, "EINVAL", "invalid argument"}, {23, "ENFILE", "file table overflow"}, {24, "EMFILE", "too many open files"}, {25, "ENOTTY", "not a typewriter"}, {26, "ETXTBSY", "text file busy"}, {27, "EFBIG", "file too large"}, {28, "ENOSPC", "no space left on device"}, {29, "ESPIPE", "illegal seek"}, {30, "EROFS", "read-only file system"}, {31, "EMLINK", "too many links"}, {32, "EPIPE", "broken pipe"}, {33, "EDOM", "argument out of domain"}, {34, "ERANGE", "result too large"}, {35, "ENOMSG", "no message of desired type"}, {36, "EIDRM", "identifier removed"}, {37, "ECHRNG", "channel number out of range"}, {38, "EL2NSYNC", "level 2 not synchronized"}, {39, "EL3HLT", "level 3 halted"}, {40, "EL3RST", "level 3 reset"}, {41, "ELNRNG", "link number out of range"}, {42, "EUNATCH", "protocol driver not attached"}, {43, "ENOCSI", "no CSI structure available"}, {44, "EL2HLT", "level 2 halted"}, {45, "EDEADLK", "deadlock condition if locked"}, {46, "ENOTREADY", "device not ready"}, {47, "EWRPROTECT", "write-protected media"}, {48, "EFORMAT", "unformatted or incompatible media"}, {49, "ENOLCK", "no locks available"}, {50, "ENOCONNECT", "cannot Establish Connection"}, {52, "ESTALE", "missing file or filesystem"}, {53, "EDIST", "requests blocked by Administrator"}, {55, "EINPROGRESS", "operation now in progress"}, {56, "EALREADY", "operation already in progress"}, {57, "ENOTSOCK", "socket operation on non-socket"}, {58, "EDESTADDREQ", "destination address required"}, {59, "EMSGSIZE", "message too long"}, {60, "EPROTOTYPE", "protocol wrong type for socket"}, {61, "ENOPROTOOPT", "protocol not available"}, {62, "EPROTONOSUPPORT", "protocol not supported"}, {63, "ESOCKTNOSUPPORT", "socket type not supported"}, {64, "EOPNOTSUPP", "operation not supported on socket"}, {65, "EPFNOSUPPORT", "protocol family not supported"}, {66, "EAFNOSUPPORT", "addr family not supported by protocol"}, {67, "EADDRINUSE", "address already in use"}, {68, "EADDRNOTAVAIL", "can't assign requested address"}, {69, "ENETDOWN", "network is down"}, {70, "ENETUNREACH", "network is unreachable"}, {71, "ENETRESET", "network dropped connection on reset"}, {72, "ECONNABORTED", "software caused connection abort"}, {73, "ECONNRESET", "connection reset by peer"}, {74, "ENOBUFS", "no buffer space available"}, {75, "EISCONN", "socket is already connected"}, {76, "ENOTCONN", "socket is not connected"}, {77, "ESHUTDOWN", "can't send after socket shutdown"}, {78, "ETIMEDOUT", "connection timed out"}, {79, "ECONNREFUSED", "connection refused"}, {80, "EHOSTDOWN", "host is down"}, {81, "EHOSTUNREACH", "no route to host"}, {82, "ERESTART", "restart the system call"}, {83, "EPROCLIM", "too many processes"}, {84, "EUSERS", "too many users"}, {85, "ELOOP", "too many levels of symbolic links"}, {86, "ENAMETOOLONG", "file name too long"}, {88, "EDQUOT", "disk quota exceeded"}, {89, "ECORRUPT", "invalid file system control data detected"}, {90, "ESYSERROR", "for future use "}, {93, "EREMOTE", "item is not local to host"}, {94, "ENOTRECOVERABLE", "state not recoverable "}, {95, "EOWNERDEAD", "previous owner died "}, {109, "ENOSYS", "function not implemented"}, {110, "EMEDIA", "media surface error"}, {111, "ESOFT", "I/O completed, but needs relocation"}, {112, "ENOATTR", "no attribute found"}, {113, "ESAD", "security Authentication Denied"}, {114, "ENOTRUST", "not a Trusted Program"}, {115, "ETOOMANYREFS", "too many references: can't splice"}, {116, "EILSEQ", "invalid wide character"}, {117, "ECANCELED", "asynchronous I/O cancelled"}, {118, "ENOSR", "out of STREAMS resources"}, {119, "ETIME", "system call timed out"}, {120, "EBADMSG", "next message has wrong type"}, {121, "EPROTO", "error in protocol"}, {122, "ENODATA", "no message on stream head read q"}, {123, "ENOSTR", "fd not associated with a stream"}, {124, "ENOTSUP", "unsupported attribute value"}, {125, "EMULTIHOP", "multihop is not allowed"}, {126, "ENOLINK", "the server link has been severed"}, {127, "EOVERFLOW", "value too large to be stored in data type"}, } // Signal table var signalList = [...]struct { num syscall.Signal name string desc string }{ {1, "SIGHUP", "hangup"}, {2, "SIGINT", "interrupt"}, {3, "SIGQUIT", "quit"}, {4, "SIGILL", "illegal instruction"}, {5, "SIGTRAP", "trace/BPT trap"}, {6, "SIGIOT", "IOT/Abort trap"}, {7, "SIGEMT", "EMT trap"}, {8, "SIGFPE", "floating point exception"}, {9, "SIGKILL", "killed"}, {10, "SIGBUS", "bus error"}, {11, "SIGSEGV", "segmentation fault"}, {12, "SIGSYS", "bad system call"}, {13, "SIGPIPE", "broken pipe"}, {14, "SIGALRM", "alarm clock"}, {15, "SIGTERM", "terminated"}, {16, "SIGURG", "urgent I/O condition"}, {17, "SIGSTOP", "stopped (signal)"}, {18, "SIGTSTP", "stopped"}, {19, "SIGCONT", "continued"}, {20, "SIGCHLD", "child exited"}, {21, "SIGTTIN", "stopped (tty input)"}, {22, "SIGTTOU", "stopped (tty output)"}, {23, "SIGIO", "I/O possible/complete"}, {24, "SIGXCPU", "cputime limit exceeded"}, {25, "SIGXFSZ", "filesize limit exceeded"}, {27, "SIGMSG", "input device data"}, {28, "SIGWINCH", "window size changes"}, {29, "SIGPWR", "power-failure"}, {30, "SIGUSR1", "user defined signal 1"}, {31, "SIGUSR2", "user defined signal 2"}, {32, "SIGPROF", "profiling timer expired"}, {33, "SIGDANGER", "paging space low"}, {34, "SIGVTALRM", "virtual timer expired"}, {35, "SIGMIGRATE", "signal 35"}, {36, "SIGPRE", "signal 36"}, {37, "SIGVIRT", "signal 37"}, {38, "SIGTALRM", "signal 38"}, {39, "SIGWAITING", "signal 39"}, {48, "SIGSYSERROR", "signal 48"}, {49, "SIGCAPI", "signal 49"}, {58, "SIGRECONFIG", "signal 58"}, {59, "SIGCPUFAIL", "CPU Failure Predicted"}, {60, "SIGKAP", "monitor mode granted"}, {61, "SIGRETRACT", "monitor mode retracted"}, {62, "SIGSOUND", "sound completed"}, {63, "SIGSAK", "secure attention"}, }
{ "pile_set_name": "Github" }
/* Xilinx MicroBlaze support for BFD. Copyright (C) 2009-2019 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file holds definitions specific to the MICROBLAZE ELF ABI. */ #ifndef _ELF_MICROBLAZE_H #define _ELF_MICROBLAZE_H #include "elf/reloc-macros.h" /* Relocations. */ START_RELOC_NUMBERS (elf_microblaze_reloc_type) RELOC_NUMBER (R_MICROBLAZE_NONE, 0) RELOC_NUMBER (R_MICROBLAZE_32, 1) RELOC_NUMBER (R_MICROBLAZE_32_PCREL, 2) RELOC_NUMBER (R_MICROBLAZE_64_PCREL, 3) RELOC_NUMBER (R_MICROBLAZE_32_PCREL_LO, 4) RELOC_NUMBER (R_MICROBLAZE_64, 5) RELOC_NUMBER (R_MICROBLAZE_32_LO, 6) RELOC_NUMBER (R_MICROBLAZE_SRO32, 7) RELOC_NUMBER (R_MICROBLAZE_SRW32, 8) RELOC_NUMBER (R_MICROBLAZE_64_NONE, 9) RELOC_NUMBER (R_MICROBLAZE_32_SYM_OP_SYM, 10) RELOC_NUMBER (R_MICROBLAZE_GNU_VTINHERIT, 11) RELOC_NUMBER (R_MICROBLAZE_GNU_VTENTRY, 12) RELOC_NUMBER (R_MICROBLAZE_GOTPC_64, 13) /* PC-relative GOT offset. */ RELOC_NUMBER (R_MICROBLAZE_GOT_64, 14) /* GOT entry offset. */ RELOC_NUMBER (R_MICROBLAZE_PLT_64, 15) /* PLT offset (PC-relative). */ RELOC_NUMBER (R_MICROBLAZE_REL, 16) /* Adjust by program base. */ RELOC_NUMBER (R_MICROBLAZE_JUMP_SLOT, 17) /* Create PLT entry. */ RELOC_NUMBER (R_MICROBLAZE_GLOB_DAT, 18) /* Create GOT entry. */ RELOC_NUMBER (R_MICROBLAZE_GOTOFF_64, 19) /* Offset relative to GOT. */ RELOC_NUMBER (R_MICROBLAZE_GOTOFF_32, 20) /* Offset relative to GOT. */ RELOC_NUMBER (R_MICROBLAZE_COPY, 21) /* Runtime copy. */ RELOC_NUMBER (R_MICROBLAZE_TLS, 22) /* TLS Reloc */ RELOC_NUMBER (R_MICROBLAZE_TLSGD, 23) /* TLS General Dynamic */ RELOC_NUMBER (R_MICROBLAZE_TLSLD, 24) /* TLS Local Dynamic */ RELOC_NUMBER (R_MICROBLAZE_TLSDTPMOD32, 25) /* TLS Module ID */ RELOC_NUMBER (R_MICROBLAZE_TLSDTPREL32, 26) /* TLS Offset Within TLS Block */ RELOC_NUMBER (R_MICROBLAZE_TLSDTPREL64, 27) /* TLS Offset Within TLS Block */ RELOC_NUMBER (R_MICROBLAZE_TLSGOTTPREL32, 28) /* TLS Offset From Thread Pointer */ RELOC_NUMBER (R_MICROBLAZE_TLSTPREL32, 29) /* TLS Offset From Thread Pointer */ RELOC_NUMBER (R_MICROBLAZE_TEXTPCREL_64, 30) /* PC-relative TEXT offset. */ RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */ RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */ END_RELOC_NUMBERS (R_MICROBLAZE_max) /* Global base address names. */ #define RO_SDA_ANCHOR_NAME "_SDA2_BASE_" #define RW_SDA_ANCHOR_NAME "_SDA_BASE_" /* Section Attributes. */ #define SHF_MICROBLAZE_NOREAD 0x80000000 #endif /* _ELF_MICROBLAZE_H */
{ "pile_set_name": "Github" }
require 'rubygems' require 'hoe' require './lib/spec/rails/version' require 'cucumber/rake/task' $:.unshift(File.join(File.dirname(__FILE__), "/../rspec/lib")) require 'spec/rake/spectask' class Hoe def extra_deps @extra_deps.reject! { |x| Array(x).first == 'hoe' } @extra_deps end end Hoe.new('rspec-rails', Spec::Rails::VERSION::STRING) do |p| p.summary = Spec::Rails::VERSION::SUMMARY p.url = 'http://rspec.info/' p.description = "Behaviour Driven Development for Ruby on Rails." p.rubyforge_name = 'rspec' p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org') p.extra_deps = [["rspec","1.1.12"]] p.extra_dev_deps = [["cucumber",">= 0.1.13"]] p.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}" end ['audit','test','test_deps','default','post_blog', 'release'].each do |task| Rake.application.instance_variable_get('@tasks').delete(task) end task :release => [:clean, :package] do |t| version = ENV["VERSION"] or abort "Must supply VERSION=x.y.z" abort "Versions don't match #{version} vs #{Spec::Rails::VERSION::STRING}" unless version == Spec::Rails::VERSION::STRING pkg = "pkg/rspec-rails-#{version}" rubyforge = RubyForge.new.configure puts "Logging in to rubyforge ..." rubyforge.login puts "Releasing rspec-rails version #{version} ..." ["#{pkg}.gem", "#{pkg}.tgz"].each do |file| rubyforge.add_file('rspec', 'rspec', Spec::Rails::VERSION::STRING, file) end end Spec::Rake::SpecTask.new Cucumber::Rake::Task.new task :default => [:features]
{ "pile_set_name": "Github" }
// RUN: %clang_cc1 -Wdate-time -Wno-builtin-macro-redefined %s -verify -E // RUN: %clang_cc1 -Wdate-time -Wno-builtin-macro-redefined %s -DIS_SYSHEADER -verify -E // RUN: not %clang_cc1 -Werror=date-time -Wno-builtin-macro-redefined %s -DIS_SYSHEADER -E 2>&1 | grep 'error: expansion' | count 3 #ifdef IS_HEADER #ifdef IS_SYSHEADER #pragma clang system_header #endif __TIME__ // expected-warning {{expansion of date or time macro is not reproducible}} __DATE__ // expected-warning {{expansion of date or time macro is not reproducible}} __TIMESTAMP__ // expected-warning {{expansion of date or time macro is not reproducible}} #define __TIME__ __TIME__ #else #define IS_HEADER #include __FILE__ #endif
{ "pile_set_name": "Github" }
function getJSON (url, callback) { const xhr = new XMLHttpRequest(); xhr.responseType = 'json'; xhr.open('get', url, true); xhr.onload = function () { if (xhr.status >= 200 && xhr.status < 300) { callback(xhr.response); } else { throw new Error(xhr.statusText); } }; xhr.send(); }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 8968463441945ba45a32cd9c231a256a timeCreated: 1560165192 licenseType: Pro TextureImporter: fileIDToRecycleName: {} serializedVersion: 4 mipmaps: mipMapMode: 0 enableMipMap: 1 sRGBTexture: 1 linearTexture: 0 fadeOut: 0 borderMipMap: 0 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 seamlessCubemap: 0 textureFormat: 1 maxTextureSize: 2048 textureSettings: filterMode: -1 aniso: -1 mipBias: -1 wrapMode: -1 nPOTScale: 1 lightmap: 0 compressionQuality: 50 spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaUsage: 1 alphaIsTransparency: 0 spriteTessellationDetail: -1 textureType: 0 textureShape: 1 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - buildTarget: DefaultTexturePlatform maxTextureSize: 2048 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] spritePackingTag: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
/** * Copyright (C) 2013-2019 Stefan Löffler * * 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, 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. */ #ifndef PDFAnnotations_H #define PDFAnnotations_H #include "PDFActions.h" #include <QColor> #include <QDateTime> #include <QFlags> #include <QPolygonF> #include <QRectF> #include <QString> #include <QWeakPointer> namespace QtPDF { namespace Backend { class Page; } namespace Annotation { class Popup; // ABC for annotations // Modelled after sec. 8.4.1 of the PDF 1.7 specifications class AbstractAnnotation { public: enum AnnotationFlag { Annotation_Default = 0x0, Annotation_Invisible = 0x1, Annotation_Hidden = 0x2, Annotation_Print = 0x4, Annotation_NoZoom = 0x8, Annotation_NoRotate = 0x10, Annotation_NoView = 0x20, Annotation_ReadOnly = 0x40, Annotation_Locked = 0x80, Annotation_ToggleNoView = 0x100, Annotation_LockedContents = 0x200 }; Q_DECLARE_FLAGS(AnnotationFlags, AnnotationFlag) enum AnnotationType { AnnotationTypeText, AnnotationTypeLink, AnnotationTypeFreeText, AnnotationTypeLine, AnnotationTypeSquare, AnnotationTypeCircle, AnnotationTypePolygon, AnnotationTypePolyLine, AnnotationTypeHighlight, AnnotationTypeUnderline, AnnotationTypeSquiggly, AnnotationTypeStrikeOut, AnnotationTypeStamp, AnnotationTypeCaret, AnnotationTypeInk, AnnotationTypePopup, AnnotationTypeFileAttachment, AnnotationTypeSound, AnnotationTypeMovie, AnnotationTypeWidget, AnnotationTypeScreen, AnnotationTypePrinterMark, AnnotationTypeTrapNet, AnnotationTypeWatermark, AnnotationType3D }; AbstractAnnotation() = default; virtual ~AbstractAnnotation() = default; virtual AnnotationType type() const = 0; virtual bool isMarkup() const { return false; } // Declare all the getter/setter methods virtual so derived classes can // override them virtual QRectF rect() const { return _rect; } virtual QString contents() const { return _contents; } virtual QWeakPointer<Backend::Page> page() const { return _page; } virtual QString name() const { return _name; } virtual QDateTime lastModified() const { return _lastModified; } virtual AnnotationFlags flags() const { return _flags; } virtual AnnotationFlags& flags() { return _flags; } virtual QColor color() const { return _color; } virtual void setRect(const QRectF rect) { _rect = rect; } virtual void setContents(const QString contents) { _contents = contents; } virtual void setPage(QWeakPointer<Backend::Page> page) { _page = page; } virtual void setName(const QString name) { _name = name; } virtual void setLastModified(const QDateTime lastModified) { _lastModified = lastModified; } virtual void setColor(const QColor color) { _color = color; } virtual bool operator==(const AbstractAnnotation & o) const; protected: QRectF _rect; // required, in pdf coordinates QString _contents; // optional QWeakPointer<Backend::Page> _page; // optional; since PDF 1.3 QString _name; // optional; since PDF 1.4 QDateTime _lastModified; // optional; since PDF 1.1 // TODO: _appearance, _appearanceState, _border, _structParent, _optContent AnnotationFlags _flags; // QList<???> _appearance; // ??? _appearanceState; // ??? _border; QColor _color; // ??? _structParent; // ??? _optContent; }; Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractAnnotation::AnnotationFlags) // Markup Annotation are: // Text, FreeText, Line, Square, Circle, Polygon, PolyLine, Highlight, Underline // Squiggly, StrikeOut, Stamp, Caret, Ink, FileAttachment, Sound class Markup : public AbstractAnnotation { public: Markup() : AbstractAnnotation() { } ~Markup() override; Markup(const Markup & o); Markup & operator=(const Markup & o); bool isMarkup() const override { return true; } virtual QString title() const { return _title; } // Synonym for title(), but easier to read virtual QString author() const { return _title; } virtual QString richContents() const { return (!_richContents.isEmpty() ? _richContents : _contents); } virtual QDateTime creationDate() const { return _creationDate; } virtual QString subject() const { return _subject; } virtual Popup * popup() const { return _popup; } virtual void setTitle(const QString title) { _title = title; } // Synonym for setTitle(), but easier to read virtual void setAuthor(const QString author) { _title = author; } virtual void setRichContents(const QString contents) { _richContents = contents; } virtual void setCreationDate(const QDateTime timestamp) { _creationDate = timestamp; } virtual void setSubject(const QString subject) { _subject = subject; } // Note: the Markup takes ownership of `popup` virtual void setPopup(Popup * popup); bool operator==(const AbstractAnnotation & o) const override; protected: QString _title; // optional; since PDF 1.1; by convention identifies the annotation author Popup * _popup{nullptr}; // float _opacity; QString _richContents; // optional; since PDF 1.5; may contain some HTML tags QDateTime _creationDate; // optional; since PDF 1.5 // AbstractAnnotation * _inReplyTo; // enum _replyType; QString _subject; // optional; since PDF 1.5 // enum/int _intent; // _externalData; // currently only Markup3D }; class Link : public AbstractAnnotation { public: enum HighlightingMode { HighlightingNone, HighlightingInvert, HighlightingOutline, HighlightingPush }; Link() : AbstractAnnotation() { } ~Link() override; Link(const Link & other) : AbstractAnnotation(other), _highlightingMode(other._highlightingMode), _quadPoints(other._quadPoints) { _actionOnActivation = (other._actionOnActivation ? other._actionOnActivation->clone() : nullptr); } Link & operator =(const Link & other) { if (&other == this) return *this; AbstractAnnotation::operator =(other); _highlightingMode = other._highlightingMode; _quadPoints = other._quadPoints; if (_actionOnActivation) delete _actionOnActivation; _actionOnActivation = (other._actionOnActivation ? other._actionOnActivation->clone() : nullptr); return *this; } AnnotationType type() const override { return AnnotationTypeLink; } HighlightingMode highlightingMode() const { return _highlightingMode; } QPolygonF quadPoints() const; PDFAction * actionOnActivation() const { return _actionOnActivation; } void setHighlightingMode(const HighlightingMode mode) { _highlightingMode = mode; } void setQuadPoints(const QPolygonF quadPoints) { _quadPoints = quadPoints; } // Note: Link takes ownership of PDFAction pointers void setActionOnActivation(PDFAction * const action); bool operator==(const AbstractAnnotation & o) const override; private: // Note: the PA member of the link annotation dict is deliberately ommitted // because we don't support WebCapture at the moment // Note: The PDF specs include a "destination" field for LinkAnnotations; // In this implementation this case should be handled by a PDFGoToAction HighlightingMode _highlightingMode{HighlightingNone}; QPolygonF _quadPoints; PDFAction * _actionOnActivation{nullptr}; }; class Text : public Markup { public: AnnotationType type() const override { return AnnotationTypeText; } private: //bool _open; QString _iconName; QString _state; QString _stateModel; }; class FreeText : public Markup { public: AnnotationType type() const override { return AnnotationTypeFreeText; } // TODO: members }; class Caret : public Markup { public: AnnotationType type() const override { return AnnotationTypeCaret; } private: QRectF _rectDiff; // enum _symbol; }; class Popup : public AbstractAnnotation { public: AnnotationType type() const override { return AnnotationTypePopup; } Markup * parent() { return _parent; } bool isOpen() const { return _open; } void setParent(Markup * parent) { _parent = parent; } void setOpen(const bool open = true) { _open = open; } QString contents() const override { return (_parent != nullptr ? _parent->contents() : _contents); } QDateTime lastModified() const override { return (_parent != nullptr ? _parent->lastModified() : _lastModified); } QColor color() const override { return (_parent != nullptr ? _parent->color() : _color); } QString title() const { return (_parent != nullptr ? _parent->title() : _title); } void setTitle(const QString & title) { _title = title; } bool operator==(const AbstractAnnotation & o) const override; private: Markup * _parent{nullptr}; bool _open{false}; QString _title; }; class Highlight : public Markup { public: AnnotationType type() const override { return AnnotationTypeHighlight; } // TODO: members }; class Underline: public Markup { public: AnnotationType type() const override { return AnnotationTypeUnderline; } // TODO: members }; class Squiggly: public Markup { public: AnnotationType type() const override { return AnnotationTypeSquiggly; } // TODO: members }; class StrikeOut: public Markup { public: AnnotationType type() const override { return AnnotationTypeStrikeOut; } // TODO: members }; // Line, Square, Circle, Polygon, PolyLine, Stamp, Ink, FileAttachment, Sound } // namespace Annotation } // namespace QtPDF #endif // End header guard // vim: set sw=2 ts=2 et
{ "pile_set_name": "Github" }
'use strict'; let fs = require('fs'); let dateTime = require(__dirname+'/../../../tools/date/formatUTC.js'); let configFile = require(__dirname+'/../../../configurations/configuration.js'); let create = function(type, name, data) { /* Formats information to write to the trace log file. Creates a timestamp, classify the event (e.g. ENTER, ERROR,...) and displays input/output */ //Checks if tracing is enabled in the config file if(!configFile.config.trace && name != 'toggleTrace') { return; } let formattedTime = dateTime.convert(Date.now()); if(type == 'ENTER') { var value = formattedTime + '\t' + type + '\t' + name + '\tINPUT: ' + JSON.stringify(data) + '\n'; console.log(type + '\t' + name + '\tINPUT: ' + JSON.stringify(data)); } else if(type == 'INFO') { var value = '\t' + formattedTime + '\t' + type + '\t' + name + '\t' + data+ '\n'; console.log(type + '\t' + name + '\t' + data+ '\n'); } else if(type == 'EXIT') { var value = formattedTime + '\t' + type + '\t' + name + '\tOUTPUT: ' + JSON.stringify(data) + '\n'; console.log(type + '\t' + name + '\tOUTPUT: ' + JSON.stringify(data)); } else if(type == 'EVENT') { let eventTxt = data; if(name.trim() == 'toggleTrace' && eventTxt == 'OFF') { var value = formattedTime + '\t' + type + '\t' + name + '\t' + eventTxt + '\n----------------------------------------------------------------\n'; console.log('---------------------------------------LOGGING TURNED OFF---------------------------------------'); } else { var value = formattedTime + '\t' + type + '\t' + name + '\t' + eventTxt + '\n'; console.log('---------------------------------------LOGGING TURNED ON----------------------------------------'); } } else if(type == 'ERROR') { var value = '\t' + formattedTime + '\t' + type + '\t' + name + '\tOUTPUT: ' + JSON.stringify(data)+ '\n'; console.error(type + '\t' + name + '\tOUTPUT: ' + JSON.stringify(data)); } fs.appendFile(configFile.config.traceFile, value, function (err){ if(err) { console.error('UNABLE TO WRITE LOGS TO FILE'); } }); }; exports.create = create;
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2020 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You 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. --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="no_upstream_notification_title" msgid="611650570559011140">"ઇન્ટરનેટ શેર કરવાની સુવિધામાં ઇન્ટરનેટ નથી"</string> <string name="no_upstream_notification_message" msgid="6508394877641864863">"ડિવાઇસ કનેક્ટ કરી શકાતા નથી"</string> <string name="no_upstream_notification_disable_button" msgid="7609346639290990508">"ઇન્ટરનેટ શેર કરવાની સુવિધા બંધ કરો"</string> <string name="upstream_roaming_notification_title" msgid="6032901176124830787">"હૉટસ્પૉટ અથવા ઇન્ટરનેટ શેર કરવાની સુવિધા ચાલુ છે"</string> <string name="upstream_roaming_notification_message" msgid="7599056263326217523">"રોમિંગમાં વધારાના શુલ્ક લાગી શકે છે"</string> </resources>
{ "pile_set_name": "Github" }
// self.onmessage = function (event) { // const data = event.data // let { songs, likeIds } = data // songs.forEach(song => { // if (likeIds.includes(song.id)) { // song.isLiked = true // } // }) // self.postMessage({ songs, likeIds }) // } self.onmessage = function (event) { const data = event.data let { songs, id } = data let index = songs.findIndex(song => song.id == id) self.postMessage({index, id}) }
{ "pile_set_name": "Github" }
/* * This software Copyright by the RPTools.net development team, and * licensed under the Affero GPL Version 3 or, at your option, any later * version. * * MapTool Source Code is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * You should have received a copy of the GNU Affero General Public * License * along with this source Code. If not, please visit * <http://www.gnu.org/licenses/> and specifically the Affero license * text at <http://www.gnu.org/licenses/agpl.html>. */ package net.rptools.maptool.client.functions; import java.math.BigDecimal; import java.util.List; import net.rptools.maptool.client.MapTool; import net.rptools.maptool.language.I18N; import net.rptools.maptool.model.InitiativeList; import net.rptools.maptool.model.Token; import net.rptools.maptool.util.FunctionUtil; import net.rptools.parser.Parser; import net.rptools.parser.ParserException; import net.rptools.parser.function.AbstractFunction; /** * Remove a token from initiative * * @author Jay */ public class TokenRemoveFromInitiativeFunction extends AbstractFunction { /** Handle adding one, all, all PCs or all NPC tokens. */ private TokenRemoveFromInitiativeFunction() { super(0, 2, "removeFromInitiative"); } /** singleton instance of this function */ private static final TokenRemoveFromInitiativeFunction instance = new TokenRemoveFromInitiativeFunction(); /** @return singleton instance */ public static TokenRemoveFromInitiativeFunction getInstance() { return instance; } /** * @see net.rptools.parser.function.AbstractFunction#childEvaluate(net.rptools.parser.Parser, * java.lang.String, java.util.List) */ @Override public Object childEvaluate(Parser parser, String functionName, List<Object> args) throws ParserException { Token token = FunctionUtil.getTokenFromParam(parser, functionName, args, 0, 1); InitiativeList list = token.getZoneRenderer().getZone().getInitiativeList(); if (!MapTool.getParser().isMacroTrusted()) { if (!MapTool.getFrame().getInitiativePanel().hasOwnerPermission(token)) { String message = I18N.getText("macro.function.initiative.gmOnly", functionName); if (MapTool.getFrame().getInitiativePanel().isOwnerPermissions()) message = I18N.getText("macro.function.initiative.gmOrOwner", functionName); throw new ParserException(message); } // endif } List<Integer> tokens = list.indexOf(token); list.startUnitOfWork(); for (int i = tokens.size() - 1; i >= 0; i--) list.removeToken(tokens.get(i).intValue()); list.finishUnitOfWork(); return new BigDecimal(tokens.size()); } }
{ "pile_set_name": "Github" }
@import './aliases' @import './ellipsis' @import './hide-text' @import './replace-text'
{ "pile_set_name": "Github" }
/* ****************************************************************************** * Copyright (C) 2015, International Business Machines Corporation and * others. All Rights Reserved. ****************************************************************************** * * File UNIFIEDCACHE.H - The ICU Unified cache. ****************************************************************************** */ #ifndef __UNIFIED_CACHE_H__ #define __UNIFIED_CACHE_H__ #include "utypeinfo.h" // for 'typeid' to work #include "unicode/uobject.h" #include "unicode/locid.h" #include "sharedobject.h" #include "unicode/unistr.h" #include "cstring.h" #include "ustr_imp.h" struct UHashtable; struct UHashElement; U_NAMESPACE_BEGIN class UnifiedCache; /** * A base class for all cache keys. */ class U_COMMON_API CacheKeyBase : public UObject { public: CacheKeyBase() : fCreationStatus(U_ZERO_ERROR), fIsMaster(FALSE) {} /** * Copy constructor. Needed to support cloning. */ CacheKeyBase(const CacheKeyBase &other) : UObject(other), fCreationStatus(other.fCreationStatus), fIsMaster(FALSE) { } virtual ~CacheKeyBase(); /** * Returns the hash code for this object. */ virtual int32_t hashCode() const = 0; /** * Clones this object polymorphically. Caller owns returned value. */ virtual CacheKeyBase *clone() const = 0; /** * Equality operator. */ virtual UBool operator == (const CacheKeyBase &other) const = 0; /** * Create a new object for this key. Called by cache on cache miss. * createObject must add a reference to the object it returns. Note * that getting an object from the cache and returning it without calling * removeRef on it satisfies this requirement. It can also return NULL * and set status to an error. * * @param creationContext the context in which the object is being * created. May be NULL. * @param status Implementations can return a failure here. * In addition, implementations may return a * non NULL object and set a warning status. */ virtual const SharedObject *createObject( const void *creationContext, UErrorCode &status) const = 0; /** * Writes a description of this key to buffer and returns buffer. Written * description is NULL terminated. */ virtual char *writeDescription(char *buffer, int32_t bufSize) const = 0; /** * Inequality operator. */ UBool operator != (const CacheKeyBase &other) const { return !(*this == other); } private: mutable UErrorCode fCreationStatus; mutable UBool fIsMaster; friend class UnifiedCache; }; /** * Templated version of CacheKeyBase. * A key of type LocaleCacheKey<T> maps to a value of type T. */ template<typename T> class CacheKey : public CacheKeyBase { public: virtual ~CacheKey() { } /** * The template parameter, T, determines the hash code returned. */ virtual int32_t hashCode() const { const char *s = typeid(T).name(); return ustr_hashCharsN(s, uprv_strlen(s)); } /** * Use the value type, T, as the description. */ virtual char *writeDescription(char *buffer, int32_t bufLen) const { const char *s = typeid(T).name(); uprv_strncpy(buffer, s, bufLen); buffer[bufLen - 1] = 0; return buffer; } /** * Two objects are equal if they are of the same type. */ virtual UBool operator == (const CacheKeyBase &other) const { return typeid(*this) == typeid(other); } }; /** * Cache key based on locale. * A key of type LocaleCacheKey<T> maps to a value of type T. */ template<typename T> class LocaleCacheKey : public CacheKey<T> { protected: Locale fLoc; public: LocaleCacheKey(const Locale &loc) : fLoc(loc) {}; LocaleCacheKey(const LocaleCacheKey<T> &other) : CacheKey<T>(other), fLoc(other.fLoc) { } virtual ~LocaleCacheKey() { } virtual int32_t hashCode() const { return 37 *CacheKey<T>::hashCode() + fLoc.hashCode(); } virtual UBool operator == (const CacheKeyBase &other) const { // reflexive if (this == &other) { return TRUE; } if (!CacheKey<T>::operator == (other)) { return FALSE; } // We know this and other are of same class because operator== on // CacheKey returned true. const LocaleCacheKey<T> *fOther = static_cast<const LocaleCacheKey<T> *>(&other); return fLoc == fOther->fLoc; } virtual CacheKeyBase *clone() const { return new LocaleCacheKey<T>(*this); } virtual const T *createObject( const void *creationContext, UErrorCode &status) const; /** * Use the locale id as the description. */ virtual char *writeDescription(char *buffer, int32_t bufLen) const { const char *s = fLoc.getName(); uprv_strncpy(buffer, s, bufLen); buffer[bufLen - 1] = 0; return buffer; } }; /** * The unified cache. A singleton type. * Design doc here: * https://docs.google.com/document/d/1RwGQJs4N4tawNbf809iYDRCvXoMKqDJihxzYt1ysmd8/edit?usp=sharing */ class U_COMMON_API UnifiedCache : public UnifiedCacheBase { public: /** * @internal * Do not call directly. Instead use UnifiedCache::getInstance() as * there should be only one UnifiedCache in an application. */ UnifiedCache(UErrorCode &status); /** * Returns the cache instance. */ static UnifiedCache *getInstance(UErrorCode &status); /** * Fetches a value from the cache by key. Equivalent to * get(key, NULL, ptr, status); */ template<typename T> void get( const CacheKey<T>& key, const T *&ptr, UErrorCode &status) const { get(key, NULL, ptr, status); } /** * Fetches value from the cache by key. * * @param key the cache key. * @param creationContext passed verbatim to createObject method of key * @param ptr On entry, ptr must be NULL or be included if * the reference count of the object it points * to. On exit, ptr points to the fetched object * from the cache or is left unchanged on * failure. Caller must call removeRef on ptr * if set to a non NULL value. * @param status Any error returned here. May be set to a * warning value even if ptr is set. */ template<typename T> void get( const CacheKey<T>& key, const void *creationContext, const T *&ptr, UErrorCode &status) const { if (U_FAILURE(status)) { return; } UErrorCode creationStatus = U_ZERO_ERROR; const SharedObject *value = NULL; _get(key, value, creationContext, creationStatus); const T *tvalue = (const T *) value; if (U_SUCCESS(creationStatus)) { SharedObject::copyPtr(tvalue, ptr); } SharedObject::clearPtr(tvalue); // Take care not to overwrite a warning status passed in with // another warning or U_ZERO_ERROR. if (status == U_ZERO_ERROR || U_FAILURE(creationStatus)) { status = creationStatus; } } #ifdef UNIFIED_CACHE_DEBUG /** * Dumps the contents of this cache to standard error. Used for testing of * cache only. */ void dumpContents() const; #endif /** * Convenience method to get a value of type T from cache for a * particular locale with creationContext == NULL. * @param loc the locale * @param ptr On entry, must be NULL or included in the ref count * of the object to which it points. * On exit, fetched value stored here or is left * unchanged on failure. Caller must call removeRef on * ptr if set to a non NULL value. * @param status Any error returned here. May be set to a * warning value even if ptr is set. */ template<typename T> static void getByLocale( const Locale &loc, const T *&ptr, UErrorCode &status) { const UnifiedCache *cache = getInstance(status); if (U_FAILURE(status)) { return; } cache->get(LocaleCacheKey<T>(loc), ptr, status); } #ifdef UNIFIED_CACHE_DEBUG /** * Dumps the cache contents to stderr. For testing only. */ static void dump(); #endif /** * Returns the number of keys in this cache. For testing only. */ int32_t keyCount() const; /** * Removes any values from cache that are not referenced outside * the cache. */ void flush() const; /** * Configures at what point evcition of unused entries will begin. * Eviction is triggered whenever the number of unused entries exeeds * BOTH count AND (number of in-use items) * (percentageOfInUseItems / 100). * Once the number of unused entries drops below one of these, * eviction ceases. Because eviction happens incrementally, * the actual unused entry count may exceed both these numbers * from time to time. * * A cache entry is defined as unused if it is not essential to guarantee * that for a given key X, the cache returns the same reference to the * same value as long as the client already holds a reference to that * value. * * If this method is never called, the default settings are 1000 and 100%. * * Although this method is thread-safe, it is designed to be called at * application startup. If it is called in the middle of execution, it * will have no immediate effect on the cache. However over time, the * cache will perform eviction slices in an attempt to honor the new * settings. * * If a client already holds references to many different unique values * in the cache such that the number of those unique values far exeeds * "count" then the cache may not be able to maintain this maximum. * However, if this happens, the cache still guarantees that the number of * unused entries will remain only a small percentage of the total cache * size. * * If the parameters passed are negative, setEvctionPolicy sets status to * U_ILLEGAL_ARGUMENT_ERROR. */ void setEvictionPolicy( int32_t count, int32_t percentageOfInUseItems, UErrorCode &status); /** * Returns how many entries have been auto evicted during the lifetime * of this cache. This only includes auto evicted entries, not * entries evicted because of a call to flush(). */ int64_t autoEvictedCount() const; /** * Returns the unused entry count in this cache. For testing only, * Regular clients will not need this. */ int32_t unusedCount() const; virtual void incrementItemsInUse() const; virtual void decrementItemsInUseWithLockingAndEviction() const; virtual void decrementItemsInUse() const; virtual ~UnifiedCache(); private: UHashtable *fHashtable; mutable int32_t fEvictPos; mutable int32_t fItemsInUseCount; int32_t fMaxUnused; int32_t fMaxPercentageOfInUse; mutable int64_t fAutoEvictedCount; UnifiedCache(const UnifiedCache &other); UnifiedCache &operator=(const UnifiedCache &other); UBool _flush(UBool all) const; void _get( const CacheKeyBase &key, const SharedObject *&value, const void *creationContext, UErrorCode &status) const; UBool _poll( const CacheKeyBase &key, const SharedObject *&value, UErrorCode &status) const; void _putNew( const CacheKeyBase &key, const SharedObject *value, const UErrorCode creationStatus, UErrorCode &status) const; void _putIfAbsentAndGet( const CacheKeyBase &key, const SharedObject *&value, UErrorCode &status) const; const UHashElement *_nextElement() const; int32_t _computeCountOfItemsToEvict() const; void _runEvictionSlice() const; void _registerMaster( const CacheKeyBase *theKey, const SharedObject *value) const; void _put( const UHashElement *element, const SharedObject *value, const UErrorCode status) const; #ifdef UNIFIED_CACHE_DEBUG void _dumpContents() const; #endif static void copyPtr(const SharedObject *src, const SharedObject *&dest); static void clearPtr(const SharedObject *&ptr); static void _fetch( const UHashElement *element, const SharedObject *&value, UErrorCode &status); static UBool _inProgress(const UHashElement *element); static UBool _inProgress( const SharedObject *theValue, UErrorCode creationStatus); static UBool _isEvictable(const UHashElement *element); }; U_NAMESPACE_END #endif
{ "pile_set_name": "Github" }
.bold{ font-weight: bold; } .widget{ margin-bottom: 25px; /* taken from https://css-tricks.com/examples/GradientBorder/ */ border-bottom: 3px solid black; background-image: linear-gradient(transparent, #000), linear-gradient(transparent, #000); background-size: 3px 100%; background-position: 0 0, 100% 0; background-repeat: no-repeat; padding-bottom: 20px; position: relative; } .not-active{ font-family: 'Montserrat Subrayada', sans-serif; color: #8b0000; font-size: 100px; position: absolute; z-index: 2; } .cpu-wdiget{ margin-top: 20px; } .cpu,.mem{ background-color: white; position: relative; text-align: center } .cpu-text, .mem-text{ position: absolute; transform: translate(-45%, -50%); top: 50%; left: 50%; font-size: 30px; } .canvas-wrapper{ position: relative; }
{ "pile_set_name": "Github" }
death.attack.ember=%1$s 已被焚化 death.attack.ember.player=%1$s 被 %2$s 焚化了 embers.aspect.copper=铜 embers.aspect.dawnstone=黎明石 embers.aspect.iron=铁 embers.aspect.lead=铅 embers.aspect.silver=银 embers.commands.fill.added=为区块 [%3$s,%4$s](位于 X %5$s,Z %6$s 处)添加了 %1$s 点灰烬等级(现在是 %2$s) embers.commands.fill.failed=区块 [%1$s,%2$s](位于 X %3$s,Z %4$s 处)处缺失灰烬数据 embers.commands.fill.query=区块 [%2$s,%3$s](位于 X %4$s,Z %5$s 处)处灰烬等级为 %1$s embers.commands.fill.set=为区块 [%2$s,%3$s](位于 X %4$s,Z %5$s 处)处添加了 %1$s 点灰烬等级 embers.commands.fill.usage=/ember-fill <x> <z> <set|add|query> ... embers.commands.fill.usage.add=/ember-fill <x> <z> add <数值> embers.commands.fill.usage.set=/ember-fill <x> <z> set <数值> embers.decimal_format.attenuator_multiplier=0.##x embers.decimal_format.ember=0.## embers.decimal_format.ember_multiplier=0.##x embers.decimal_format.heat=0.## embers.decimal_format.inaccuracy=0 embers.decimal_format.item_amount=0x embers.decimal_format.mechanical_multiplier=0.##x embers.jei.recipe.alchemy=炼金配方 embers.jei.recipe.dawnstone_anvil=黎明石砧配方 embers.jei.recipe.melter=熔炼配方 embers.jei.recipe.mixer=合金配方 embers.jei.recipe.stamp=冲压配方 embers.research.alchemy=炼金蜕变 embers.research.core=核心的辉光 embers.research.image.catalyzer_glowstone=功率系数:4x embers.research.image.catalyzer_gunpowder=功率系数:3x embers.research.image.catalyzer_redstone=功率系数:2x embers.research.image.combustor_blaze_powder=功率系数:4x embers.research.image.combustor_coal=功率系数:2x embers.research.image.combustor_nether_brick=功率系数:3x embers.research.materia=物质奥术 embers.research.mechanisms=火与机械 embers.research.metallurgy=冶金构成 embers.research.multipage=%s(%s/%s) embers.research.page.access=机械连接器 embers.research.page.access.desc=很多设备体积都有点大,却只有一个端口。因此,你开发出了机械核心和机械核心连接器,它们可以帮助你扩展端口。机械核心可以直接连接多方块设备的物品缓存、流体缓存、灰烬能量缓存或其他功能。机械核心连接器只允许作为机械核心的代理,而机械核心又充当您访问机器的代理。 embers.research.page.access.title=接口 embers.research.page.activator=灰烬能量催化器 embers.research.page.activator.desc=挖掘灰烬水晶中蕴含能量的关键设备。当灰烬晶体或灰烬晶体碎片被泵入设备下半部分时,设备将进行一系列复杂的反应,使得灰烬水晶内部蕴含的能量被挥发到上半部分的铜质网笼中。从铜质网笼中就可以使用灰烬能量发射器提取珍贵的灰烬能量。我们有理由相信,这种挥发性的灰烬能量可以作用于各种设备。 embers.research.page.activator.title=萃取 embers.research.page.actuator=机械驱动器 embers.research.page.actuator.desc=一些使用灰烬能量供能的机器还能由机械能供能。这个设备有4个输入端用于连接机械能。与变速箱类似,每个输入端需要放置齿轮。如果你向4个端都输入机械能,那么输出的机械能就相当于所有输入端输入的功率的总和。但大部分机器并不需要大功率的机械能,过大的机械能可能使机器的效率递减。因此太大的功率并不总是最好的。 embers.research.page.actuator.title=可替代的能源 embers.research.page.actuator_auto_hammer.desc=自动锤与压印锤非常相似,通过连接机械动力可以实现类似的加速过节省灰烬能量。 embers.research.page.actuator_bore.desc=灰烬晶体开采机几乎是纯机械构成的,所以非常适合用机械能来供能。以这种方式供给机械能可以提高煤的燃料效率(你仍然需要加入燃料),但最初的速度稍慢。 embers.research.page.actuator_mixer.desc=混合离心器使用灰烬能量和搅拌部件将液态金属混合在一起,虽然搅拌部件可以通过机械能供能,但并非所有处理都可以通过提高机械能解决。 embers.research.page.actuator_pump.desc=泵是最适合用机械能供能的机器。即使是少量的机械能供能也能显著加速其运转,让其运行的非常快。 embers.research.page.actuator_stamper.desc=压印锤是另一台具有机械部件的机器,不过由于灰烬能量驱动压印锤十分简单,所以哪怕是连上机械能供能,也只能使压印锤加速一点点。然而从灰烬能量的消耗成本上来说,连接了机械能的压印锤比不连接的压印锤效率要高的多。 embers.research.page.adhesive=胶粘剂 embers.research.page.adhesive.desc=你偶尔得到的粘液球是十分实用的,但实在是比较难以取得。现在,炼金合成的胶粘剂可以很好的作为粘液球的替代物。 embers.research.page.adhesive.title=粘性解决方案 embers.research.page.alchemy=独一无二的的炼金术 embers.research.page.alchemy.desc=灰烬炼金术是一个奇妙的发现。第一个关键设备是炼金台:通过右键除了底面以外的五个面来放入物品(或者使用管道)。接下来是炼金基座,基座上必须包含金属元素象征和一定量的灰烬。你必须在炼金台中摆上正确的配方,并在相应的元素象征中放入确定范围数量的灰烬,最后,用光束炮轰击炼金台以启动炼金仪式。 embers.research.page.alchemy.title=炼金蜕变 embers.research.page.ancient_golem=太古魔像 embers.research.page.ancient_golem.desc=在这个世界上,很少有人知道这些类似人形生物的奇怪结构。这些神秘的魔像具有超自然能力,会发出强大的热射线,且看起来不需要燃料就能行动。这样的自动机械看似无用,但也许其中的未知机制与材料可以起到意想不到的作用。 embers.research.page.ancient_golem.title=古老的敌人 embers.research.page.anti_tinker_lens=烟熏的工匠单片眼镜 embers.research.page.anti_tinker_lens.desc=有时候,太多的信息可能是不必要的。有些头盔比如灰烬护目镜可以直接提供像是加装了工匠单片眼镜时的效果,但有些时候你不需要这些信息。当这个强化应用到这种头盔上时,将关闭此信息显示。此强化并不占用强化槽,但太古动力核心是必要的。 embers.research.page.anti_tinker_lens.title=盲目的真相 embers.research.page.archaic_brick=古代砖 embers.research.page.archaic_brick.desc=漫游在这片土地上的古代魔像哨兵被杀死后,经常掉落看似砖头的东西。通过特殊的炼金术,你发现你可以复制这些砖石,前提是你已经拥有一块。合成的这些材料应该会与你的建筑相得益彰。 embers.research.page.archaic_brick.title=古建筑材料 embers.research.page.armor_augments_category=装甲增强 embers.research.page.ashen_amulet=灰烬护身符 embers.research.page.ashen_amulet.desc=将万物化为灰烬……这当然是力量的象征!虽然这玩意含有的是不是很深思熟虑的力量,但无论如何,这个护身符好歹是有力量的。当一个生物在穿戴着这个护身符时杀死生物或者挖掘方块时,它们会立即变成灰烬,除了灰烬之外什么掉落物都不会掉下来。 embers.research.page.ashen_amulet.title=尘归尘 embers.research.page.ashen_cloak=灰烬装备 embers.research.page.ashen_cloak.desc=通过对平凡的不了施以炼金术,你已经设法合成了一种灵活而坚固的灰烬布料。用它来设计盔甲是十分明智的。这套装备的确十分强大且潇洒,但你有一种感觉,它或许能够进一步的升级…… embers.research.page.ashen_cloak.title=法师的斗篷 embers.research.page.aspecti=金属元素象征 embers.research.page.aspecti.desc=将熔融金属包裹在一个灰烬晶体上,你设计出了这些元素指代物。当这些物品放置在炼金基座上时,它们可以将灰烬燃烧产生的炼金能量集中到特定的元素排列中。 embers.research.page.aspecti.title=炼金术 embers.research.page.autohammer=自动锤 embers.research.page.autohammer.desc=用铁匠锤使劲敲十分费事,有了灰烬能量的帮助,你相信有解决方案。自动锤只需要一点灰烬能量以及一个红石信号,他将会对黎明石砧进行自动敲击。比你手动敲的更快更强! embers.research.page.autohammer.title=自动锤 embers.research.page.axle_iron=铁质轴 embers.research.page.axle_iron.desc=轴用于在动能发生设备、变速箱和使用动能的机器之间传递机械动力。轴不会因为距离而失去动能,所以它的传输范围几乎是无限的。 embers.research.page.axle_iron.title=轴向旋转 embers.research.page.baubles=饰品 embers.research.page.baubles.desc=Baubles是Embers模组的一个可选前置兼容模组。它当前要么在配置中关闭,要么没有被安装。 embers.research.page.baubles.title=不是你想要的mod embers.research.page.baubles_category=Baubles embers.research.page.beam_cannon=光束炮 embers.research.page.beam_cannon.desc=光束炮也许是最危险的装置了。使用铁匠锤右键目标方块,再右键光束炮来瞄准。当灰烬能量足够时,给予一个红石信号,它会发射一道纯粹的热辐射射线。这个射线可以杀死几乎任何没有护甲的生物。并且可以对炼金台发射以启动炼金仪式。 embers.research.page.beam_cannon.title=灼热射线 embers.research.page.bin=储物仓 embers.research.page.bin.desc=一个简易的铁质储物仓,能够容纳一个堆栈的物品。物品可以从上方投掷放入。它可以作为一部分设备的输出部分。 embers.research.page.bin.title=储物仓 embers.research.page.blasting_core=爆破核心 embers.research.page.blasting_core.desc=爆破核心是造成爆炸的升级。当嵌入到工具,使用工具挖掘方块后,它将破坏附近的方块。当嵌入到武器时,会发生爆炸并伤害附近的生物。当嵌入到护甲时,当护甲受到损耗时,会发生爆炸并吹开附近的生物。所有三种效果都随着强化升级的等级的提高 而增加。 embers.research.page.blasting_core.title=挥发物 embers.research.page.blazing_ray=灼热射线枪 embers.research.page.blazing_ray.desc=以灰烬能量驱动的黎明石射线枪。它必须能从副手、物品、快捷栏中的能量罐中获取能量以工作。消耗能量发射超超超远距离的灼热射线,造成一定伤害并使目标燃烧。 embers.research.page.blazing_ray.title=灰烬加农 embers.research.page.boiler=高压能量激发器 embers.research.page.boiler.desc=虽然灰烬能量激发器可以激发灰烬晶体能量,但它只是基础产能机器,高压能量激发器可以使得每个晶体产生更多的能量。它需要水和灰烬晶体共同作用。默认为灰烬能量激发器的1.5倍产能。但如果将其放置在金属块上,并且周围有岩浆或者火,根据其周围的热源,它最多可以达到基础激发器的3倍产能。 embers.research.page.boiler.title=蒸汽室 embers.research.page.bore=灰烬晶体开采机 embers.research.page.bore.desc=虽然基岩可能会停止你挖掘的脚步,但不会停止机器的。灰烬晶体开采机必须消耗燃料来运作,并且必须放置在基岩上方一层。当燃料被泵入器核心时,他将开始工作,叶片开始旋转。它会消耗燃料从基岩中开采各种尺寸的灰烬能量结晶,结晶可以从机器中心泵出。 embers.research.page.bore.title=Diggy Diggy Hole ♪ embers.research.page.breaker=自动方块破坏器 embers.research.page.breaker.desc=自动方块破坏器是一个非常简单的装置。将其面向需要的方向放置,其不断旋转的研磨片方向的方块会被破坏。默认情况下这些方块将会被抛出到世界上,但是你可以在方块破坏器旁边放置一个存储仓来避免这个情况。 embers.research.page.breaker.title=打破方块 embers.research.page.caminite=方镁矾 embers.research.page.caminite.desc=方镁矾是一种非常坚固的陶瓷,混合了一点粘土和沙子。这种混合物经过烧制后会变成一种非常不错的材料。你认为这种材料完全可以满足你在制作机械时的各种需求。 embers.research.page.caminite.title=坚固的陶瓷 embers.research.page.caster_orb=法师法球 embers.research.page.caster_orb.desc=法师法球是一种工具和武器升级,它可以使得具有这种升级的工具拥有发射灰烬能量弹丸的能力。需要便携式灰烬能量来启动。当使用(左键)这个工具时,该工具就可以发射一个灰烬能量弹丸。弹丸的发射间隔等同于工具的复原时间。弹丸的尺寸和伤害随升级的等级增加而增加 embers.research.page.caster_orb.title=灰烬能量启动! embers.research.page.caster_orb_addendum.desc=由于法师法球的强化允许工具或者武器射击由灰烬能量形成的弹丸。因此添加了法师法球强化的工具或者武器也可以接受改变弹射物性状的升级强化。 embers.research.page.catalytic_plug=催化剂插头 embers.research.page.catalytic_plug.desc=如果你等的不耐烦的话,催化器插头是一个神奇的装置。当连接到机器后,插头会使机器的运行速度提升到原来的两倍。当然,你必须从后部供入炼金红石浆液,插头才能消耗浆液运行。插头最多可以在一个机器上放置两个,使其速度提高四倍。 embers.research.page.catalytic_plug.title=过载注入 embers.research.page.catalyzer=催化室 embers.research.page.catalyzer.desc=催化室是一个简单的设备,它功能很少且相当简便,它可以使用催化剂物品来催化。每种催化剂都有特定的功率:红石的功率为2,火药的功率为3,荧石粉的功率为4。 embers.research.page.catalyzer.title=化学能量 embers.research.page.charger=铜质灰烬能量充能器 embers.research.page.charger.desc=对便携式地幔能量罐充能的设备。当充能器被接入灰烬能量,并且放置了可以存储灰烬能量的物品时(例如地幔能量罐或筒),充能器将会对灰烬能量存储物品填充能量。 embers.research.page.charger.title=灰烬能量充能开始! embers.research.page.cinder_jet=煤渣喷气机 embers.research.page.cinder_jet.desc=煤渣喷气机是一种装甲强化装置,可以让你进行冲刺行动。当装备了有这种升级的盔甲并且有足够的便携式灰烬能量支持时,每当你按下快跑(两下前进键),就可以向前冲刺一段距离。等级越高,速度和距离越远(似乎对船有效)。 embers.research.page.cinder_jet.title=向前冲! embers.research.page.cinder_plinth=灰烬炉 embers.research.page.cinder_plinth.desc=灰烬炉是一台简单的机器:将任何物品放入其中,以灰烬能量供能,它会将物品焚烧成灰烬。它可以自动将灰烬放入其下方的储物仓中。灰烬有几种用途:作为一种不太理想的燃料,以及改变石头的颜色和质地,你相信在其燃烧中释放的能量可能有其他的应用。 embers.research.page.cinder_plinth.title=焚烧 embers.research.page.cinder_staff=焚毁之杖 embers.research.page.cinder_staff.desc=奇怪,不应该是这样,银为什么能控制余烬的混乱之火?这根杖使用便携式能量罐供能,按住右键可以制造火球,按的越久消耗的能量越多,火球也越大,造成的伤害也越高。 embers.research.page.cinder_staff.title=魔法导弹 embers.research.page.clockwork_axe.desc=发条战斧是一种强大的斧头。像其他工具一样,它需要灰烬能量来工作。由于它兼作武器,它可以同时获得武器和工具附魔。 embers.research.page.clockwork_hammer.desc=灰烬战锤是一种强大的近战武器,像其他工具一样,它需要灰烬能量来工作。如果你将其作为工具来挖掘方块,那么它会将挖掘的方块抹除,不留下任何掉落物。像发条镐一样,它可以获得武器和工具附魔,但由于它的性质,时运和精准采集对其无效。 embers.research.page.clockwork_pickaxe.desc=发条镐可以同时起到的镐和铲子的作用。像其他工具一样,它需要灰烬能量来工作。由于它兼作武器,它可以同时获得武器和工具附魔。 embers.research.page.clockwork_tools=发条工具 embers.research.page.clockwork_tools.desc=利用最近发现的便携式灰烬能量容器,你可以用黎明石合金制作专门的发条工具。这三个工具共享某些属性:它们都需要在的物品栏中有便携式灰烬能量容器来供能。都是无耐久牢不可破的。都具有很高的基础伤害,可以作为不错的武器使用。此外,当获得灰烬能量供能时,它们会点燃击中的敌人。 embers.research.page.clockwork_tools.title=电动工具 embers.research.page.cluster=灰烬水晶簇 embers.research.page.cluster.desc=虽然你过去使用的较小的灰烬晶体非常方便,但你很快相信你需要更多的力量。通过将几块灰烬晶体和灰烬晶体碎片融合在一起,你制做了灰烬水晶簇,一种更强大的结晶。你相信这种晶体会在未来帮你大忙。 embers.research.page.cluster.title=纯化结晶 embers.research.page.combustor=燃烧室 embers.research.page.combustor.desc=燃烧室是一个简单的设备,它功能很少且相当简便,它可以燃烧燃料。每种燃料都有特定的功率:煤的功率为2,地狱砖的功率为3,烈焰粉的功率为4 embers.research.page.combustor.title=供奉牲礼 embers.research.page.copper_cell=铜质灰烬能量单元 embers.research.page.copper_cell.desc=铜质电池实现了一个非常简单的功能:存储灰烬能量。它可以使用接收器接收灰烬能量并存储在其内部。也可以使用发射器将其内部的能量提取出来。在被破坏会后它能够保存内部存储的灰烬能量。 embers.research.page.copper_cell.title=电容器 embers.research.page.cost_reduction=灰烬饰品 embers.research.page.cost_reduction.desc=使用发条工具或者灰烬能量驱动的武器可能是一件非常麻烦的事,因为地幔能量罐和能量筒需要定期的补充能量。这些珠宝首饰可以一定程度上减少工具或者武器的能量损耗速率,戒指、护身符或者腰带都有不同的减速率,它们是可以叠加的。 embers.research.page.cost_reduction.title=降低成本 embers.research.page.crystal_cell=晶胞灰烬能量单元 embers.research.page.crystal_cell.desc=具有容量扩展性的大型灰烬能存储单元。晶胞不仅可以在浮动的水晶中存储大量的灰烬能量,而且还可以使用灰烬晶体来扩展能量存储上限。在底部泵入灰烬晶体将增加灰烬能量的存储上限,并且在视觉效果上增加上方浮动晶体的尺寸。 embers.research.page.crystal_cell.title=大容量能量储存 embers.research.page.crystals=结晶的灰烬 embers.research.page.crystals.desc=灰烬晶体开采器挖掘产生的奇妙结晶。这些由灰烬能量固化成的发光水晶有不同的尺寸,较大的灰烬晶体和灰烬晶体碎片。这些晶体是证明世界核心力量存在的明证。通过对这些晶体的焚烧,你相信,你能够激活其中的力量,为你所用。 embers.research.page.crystals.title=凝固的热量 embers.research.page.dawnstone=黎明石 embers.research.page.dawnstone.desc=黎明石是使用混合离心机将等量的铜和金混合后的产生的强力合金。它强度类似铁,但更轻,具有金一样的附魔效率。并且神奇的适用于灰烬能量。你相信它对你的研究将会很有帮助 。 embers.research.page.dawnstone.title=闪亮的合金 embers.research.page.dawnstone_anvil=黎明石砧 embers.research.page.dawnstone_anvil.desc=黎明石的弹性非常适合制作成。它可以修理物品,或将物品分解成其组成部分。把一个有损耗了的工具放置在砧座上,然后放置修理材料。使用铁匠锤按住右键锤击,就可以将工具修好。或者把品单独放置在砧座上,给予强烈的敲击,它将会被分解成合成其的物品。 embers.research.page.dawnstone_anvil.title=修理 embers.research.page.dawnstone_mail=黎明石甲胄 embers.research.page.dawnstone_mail.desc=黎明石合金拥有很多非常不错的特性,这使得它能用于甲胄的制作。这款黎明石甲胄将保护佩戴者免受所有击退。请不要质疑甲胄为什么是用板做成的。 embers.research.page.dawnstone_mail.title=守备万一 embers.research.page.dials=表盘 embers.research.page.dials.desc=计量表是从机器中获取信息的一种简单的方法。表盘主要有两种:灰烬能量计量表和流体计量表。将它们附加到各自的容器上后,当你指着表盘时,会显示该容器内的缓存和存储上限 。 embers.research.page.dials.title=仔细测量 embers.research.page.diffraction_barrel=散射枪管 embers.research.page.diffraction_barrel.desc=在快速射击时,灼热射线枪可能会比较难以击中。这种枪管强化不仅可以放置在灼热射线枪上,也能放置在任何可以弹射灰烬能量弹丸的武器上。它可以有效的将上述武器变成霰弹枪。请注意,加装了这个强化的灼热射线枪发射的不再是射线,而是灰烬能量弹丸。 embers.research.page.diffraction_barrel.title=这...是我的霰弹枪! embers.research.page.dismantling=分离强化 embers.research.page.dismantling.desc=有时候你可能会为工具或装甲添加一些有的没的的增强功能,并最终发现这些强化没啥用。这时候,你会知道强化部件并不是永久性的。黎明石砧可以帮到你。通过将有强化的工具放置在砧座上(另外不放其他东西),使用自动锤锤击它,你就可以完美的移除所有的强化部件。当然,工具或装甲的核心本身和积累的热量将始终保持在工具上,并且,这些工具不能被砧座拆解。 embers.research.page.dismantling.title=我们得退回去 embers.research.page.dropper=物品投掷口 embers.research.page.dropper.desc=一个简单的管道开口槽。当使用漏斗或者物品管道将物品泵入投掷口时,物品将立即从投掷口直线落下扔到世界上。 embers.research.page.dropper.title=掉了下来 embers.research.page.eldritch_insignia=恐怖徽章 embers.research.page.eldritch_insignia.desc=当怪异标记嵌入到你的盔甲时,某些怪物会害怕你。你将获得恐吓怪物的能力,怪物无法攻击你,除非你攻击它们。恐惧这些符号持有人的怪物的比例会随升级的等级增加而增加。 embers.research.page.eldritch_insignia.title=怪异标记 embers.research.page.ember_funnel.desc=由于普通的灰烬能量接收器不能有效的接收喷发器发射的大量的灰烬能量,为了解决这个问题,你已经设计出了灰烬能量漏斗,这个漏斗可以从多个来源获取灰烬能量并非常快速的将其传输进连接的设备中。 embers.research.page.ember_siphon=灰烬能量虹吸器 embers.research.page.emitters=灰烬能量传输 embers.research.page.emitters.desc=从灰烬能量催化器获得的灰烬能量的传输涉及到两个设备:灰烬能量发射器和灰烬能量接收器。发射器用于发送灰烬能量。只需要将其放置在产能设备上,使用铁匠锤链接,通入红石信号后,它就能将灰烬能量分批次传输至机械的内部缓存中。 embers.research.page.emitters.title=发送和接收 embers.research.page.explosion_charm=炸裂吊坠 embers.research.page.explosion_charm.desc=当你穿戴着这个吊坠时,在你附近爆发的爆炸将会消散,爆炸的破坏力将会被吸收进这个吊坠中。不幸的是,这个吊坠没有其他特殊效果。 embers.research.page.explosion_charm.title=人造破魔石 embers.research.page.field_chart=能量波峰地形显示器 embers.research.page.field_chart.desc=当您唯一的测量设备是大气测量器时,找到高灰烬能量浓度的地点可能是一件很繁琐的事情。不过,似乎灰烬能量与它自身产生共鸣,通过灰烬水晶簇和合适的制造方法,你已经设计了能量波峰地形显示器,这是一个能直观显示灰烬能量高低的大型地图,其显示的面积比徒步能测量的范围大很多。 embers.research.page.field_chart.title=战术概貌 embers.research.page.flame_barrier=烈焰屏障 embers.research.page.flame_barrier.desc=烈焰屏障是一种装甲强化装置,在装备了拥有这种升级的护甲并且拥有便携式灰烬能量储备时,如果受到攻击,那么就会在玩家身上残绕烈焰保护玩家。攻击到玩家的生物会着火并造成一定伤害。伤害随升级的等级增加而增加。 embers.research.page.flame_barrier.title=火焰风衣 embers.research.page.fluid_transfer.desc=流体传输过滤器是和物品传输过滤器功能相似的设备。它们在传输方面几乎有相同的作用。只不过物品传输过滤器是过滤物品,而流体传输过滤器是过滤各种液体。你想设置一个液体过滤,你就必须拿着装有流体的桶或其他容器右键过滤器。设置过滤器时,不会消耗容器内的液体。 embers.research.page.focal_lens=聚焦镜片 embers.research.page.focal_lens.desc=当使用灰烬能量射击武器时,聚焦镜片强化可以辅助增加射击的精确度。根据你将强化嵌入到发射火球或者发射射线的武器的不同,它可以衍生出跟踪弹和穿透射线两种变体强化。 embers.research.page.focal_lens.title=穿透火焰 embers.research.page.gauge=大气能量测量表 embers.research.page.gauge.desc=大地深处存在者熔化的岩石,炽热的热量维持的魔像的运转。你相信,世界的中心是一个强大的能量源。你已经找到了一种方法来制作一个能够测量这种能量的设备。由铜与铁制作的表盘。可以检测被称为“灰烬能量”的能量 embers.research.page.gauge.title=勘探 embers.research.page.gear_dawnstone.desc=黎明石金属更适合做高速旋转的齿轮材料。与铁齿轮相比,它没有传输限制。在高速旋转下,齿轮会发出橙色的粒子特效,当然,这种特效几乎无害。 embers.research.page.gear_iron=铁齿轮 embers.research.page.gear_iron.desc=齿轮是将轴连接到变速箱或者机器的接口。铁齿轮价格便宜且经久耐用,但它传输的动能有功率限制。超过齿轮极限传输而来的动能大部分都会被丢失。 embers.research.page.gear_iron.title=机器的齿轮 embers.research.page.gearbox=变速齿轮箱 embers.research.page.gearbox.desc=变速箱外壳是机械传动的核心部件。变速箱每侧可以安装一个齿轮。但你不需要全部安上齿轮,只需要将连接了轴或者机器的一端安上齿轮就可以了。变速箱只有一个输入部,既带有阻拦板的那端,其余均为输出端。输入的功率将会在每个输出的功率之间分配,既两个输出端都连接了轴,则每个轴将接收到输入功率的一半。 embers.research.page.gearbox.title=机械传动 embers.research.page.glimmer=微光水晶 embers.research.page.glimmer.desc=通过在石英中注入灰烬晶体和火药热力,你设计出了一种发光材料,它奇异的特性似乎能将其的光亮分割。这种水晶可以让你随意放置光源,当然这会消耗水晶的耐久。更加奇妙的是,当你待在光线照耀下时,水晶的耐久会缓缓再生。 embers.research.page.glimmer.title=光亮,光灭 embers.research.page.hammer=铁匠锤 embers.research.page.hammer.desc=由铁和铅制作的简单的金属锤。它是一个伟大的工具。是本模组的定位工具和基础砸板工具。它可以将任意的两个同种金属锭砸成相应的板,以及一些可以在适当的时机使用的其他功能。 embers.research.page.hammer.title=粉碎 embers.research.page.hearth_coil=线圈炉 embers.research.page.hearth_coil.desc=现在已经不是在石炉中使用固体燃料烹饪的时代了!使用灰烬能量,你开发了线圈炉。当中心方块被灰烬能量充能后,线圈将开始升温。线圈越热,顶部的粒子效果就越明亮,冶炼物品的速度也越快。它会吧冶炼后的物品放入自身内部缓存,可以使用管线泵出。 embers.research.page.hearth_coil.title=开火! embers.research.page.heat=热量 embers.research.page.heat.desc=就像您使用“黎明石砧”拆分物品或修理物品一样,您也可以使用石砧将附件物品附加到装备上。在砧上放一把工具,剑或装甲,然后在砧上放置一个太古动力核心。当锤子敲击完成时,该工具将获得吸收热量的能力。这种热量是通过正常使用的工具产生的,热量条满后,需要炼狱锻造炉来处理才能获得升级槽 embers.research.page.heat.title=用旧了 embers.research.page.hellish_synthesis=各色合成 embers.research.page.hellish_synthesis.desc=通过炼金术过程,你发现了创造几种新物质的方法。这些物质包括奇怪的红色岩石和诡异的沙子,你在古代文献中读到,这两种东西构成了一个奇诡遥远的领域。 embers.research.page.hellish_synthesis.title=新奇的材料 embers.research.page.inferno_forge=炼狱锻造炉 embers.research.page.inferno_forge.desc=当物品的热量条达到满值后,如果你想要增加强化槽。就必须控温。该设备必须在下方中央部位提供灰烬能量才能工作。打开上方的舱口,将你热量条满了的物品和一些灰烬晶体一起扔入仓内,灰烬晶体越多,成功率越大(通常低级只需要一个)。它工作时,周围的四个孔会冒出黑烟。一旦成功,它的舱口会出现粒子效果并自动打开。然后,工具会弹出并获得一个升级强化槽。有了等级的工具,升级物品可以在黎明石砧中嵌入,直到这个物品的等级的上限。 embers.research.page.inferno_forge.title=等级再提升! embers.research.page.inflictor=惩罚者宝石 embers.research.page.inflictor.desc=如同黑夜般漆黑的宝石。当持有惩罚者宝石时,宝石会记录持有者所遭受的伤害类型,是否记录由宝石上的白光所提示。你也可以右键宝石来解开记录,但这样会使你受伤。惩罚者宝石可以通过与斗篷和线在工作台合成:一个简单的配方,中上方为线,中间为斗篷,余下七格放宝石。你也可以将斗篷再合成一次退回宝石。当宝石被嵌入后,斗篷将减少宝石记录的伤害类型所造成的伤害的七分之一左右。允许嵌入记录不同的伤害的宝石 。 embers.research.page.inflictor.title=吸收疼痛 embers.research.page.injector=金属结晶 embers.research.page.injector.desc=你已经发现了一种通过炼金术制作金属结晶之种的方法。种植结晶之种需要灰烬能量灌注器。在灰烬能量灌注器开口上放置一块结晶种子,通入灰烬能量后,种子将会被灌注能量。在一段时间后,结晶种子将会析出结晶,掉落相应的金属粒。 embers.research.page.injector.title=世界的种子 embers.research.page.intelligent_apparatus=智械机关 embers.research.page.intelligent_apparatus.desc=智械机关是一种简单的防具的嵌入升级。穿着这个升级的防具可以提升杀死生物所获得的经验的数量。增加的经验数量随强化的等级增加而增加。 embers.research.page.intelligent_apparatus.title=堕落的智慧 embers.research.page.jars=地幔能量罐 embers.research.page.jars.desc=旅行中携带晶胞是不切实际的,用一点玻璃和灰烬晶体,你开发出了便携式灰烬能量携带装置:地幔小型能量罐和地幔大型能量筒。小型能量罐可以携带在身上任何部位使用,而大型能量筒只能放置在副手栏才能起作用 。 embers.research.page.jars.title=便携式能量存储 embers.research.page.linking.desc=要将发射器和接收器链接在一起,你只需要使用铁匠锤Shift右键接收器,然后再次右键发射器,这样,两个发射和接收端就链接起来了。链接虽然没有距离限制,但是发射的灰烬能量流会在飞行一段时间后衰竭且逐渐消失,并失去其所有携带的灰烬能量。 embers.research.page.mantle_bulb=地幔能量灯泡 embers.research.page.mantle_bulb.desc=手上拿着一个地幔能量筒或者只是在你的物品栏中放一个地幔能量罐,可能对你来说都是很麻烦的一件事。这个小玩意可以帮到你。这款灰烬能量容器可以放置在任意Baubles的饰品槽中。代价是能存储的能量大大的降低了。 embers.research.page.mantle_bulb.title=隐藏起来 embers.research.page.materia=万用修复要素 embers.research.page.materia.desc=万用修复要素是一种特殊的材料,它具有在某种情况下转变为其他物质的能力。它能在黎明石砧中,作为任意修理材料的替换材料来修理工具。你可以预见,它在未来将更有用…… embers.research.page.materia.title=通用修理材料 embers.research.page.melter=熔炼炉 embers.research.page.melter.desc=使用激活的灰烬能量,你设计了一种可以熔炼金属的设备。熔炉会视其下半部分的灰烬能量功率来熔炼熔炉中的矿石或者物品。当供能后,如果物品是可以被熔炼的,那么熔炉将会将其熔炼为相应的液体形式,液体能被泵出。在熔炉中放入物品的方法是:在熔炉上方投掷物品、使用漏斗其他物品传输管道、或者将物品直接拿在手中右键熔炉上方。 embers.research.page.melter.title=熔炼那些事 embers.research.page.metallurgic_dust=冶金粉尘 embers.research.page.metallurgic_dust.desc=有时候,你在挖矿时挖掘到的矿物并不是你需要的。事实上,以我们对炼金术的了解,可以很容易的解决这个问题。通过将结晶之种的变换特性与红石和灰烬沙砾结合,可以产出这种细白色粉末。当这种粉末和矿石接触时,它会迅速将整个相同矿物相连的矿床随机转换为其他不同的矿物。但是值得警告的是,一些矿石可能会被衰变成无价值的石头…… embers.research.page.metallurgic_dust.title=为此而生 embers.research.page.mini_boiler=微型锅炉 embers.research.page.mini_boiler.desc=灰烬能量是一种高能量物质,在产生和消耗时都会产生不可忽视的热量。让热量浪费是一种耻辱。通过将这个压力容器连接到生产或者消耗灰烬能量的机器的侧面,你可以用这个压力容器将水煮沸成蒸汽用于其他目的。但要注意,在高压下,这玩意是很容易破裂的…… embers.research.page.mini_boiler.title=捎带了个爆炸 embers.research.page.misc_augments_category=其他增强 embers.research.page.mixer=混合离心器 embers.research.page.mixer.desc=种能够将熔融金属混合成合金的机械设备。设备的下半部分每个面包含一个独立的流体存储,当设备上半部分被通入灰烬能量且下半部分中存储的几种熔融金属适用于合金配方,那么熔融合金将会被混合通入到设备上半部分,并且可以被机械流体泵泵出。 embers.research.page.mixer.title=混合起来~ embers.research.page.modifiers=附加强化 embers.research.page.modifiers.desc=您相信,通过足够先进的技术,您可以制作为您的装备授予额外功能的设备。这些物品在黎明石砧锤击后可以应用于盔甲、工具或武器。将需要强化的物品放入石砧,然后放入强化物品,然后敲击。强化物品具有等级,这将提高装备的力量。 embers.research.page.modifiers.title=升级 embers.research.page.motive_core=太古动力核心 embers.research.page.motive_core.desc=炼金术不只可以复制砖块。太古动力核心似乎是古代魔像的命脉和能量来源,通过炼金术,这种力量现在握在你的指尖。 embers.research.page.motive_core.title=前沿科技 embers.research.page.mystical_mechanics=神秘力学 embers.research.page.mystical_mechanics.desc=Mystical Mechanics是Embers模组的一个可选的前置兼容模组。它当前要么在配置中关闭,要么没有被安装。 embers.research.page.mystical_mechanics.title=不是你想要的mod embers.research.page.mystical_mechanics_category=神秘力学 embers.research.page.nonbeliever_amulet=邪教徒护身符 embers.research.page.nonbeliever_amulet.desc=那些该死的女巫和它们对超凡能力的抵抗令人不悦……这个护身符就是模仿它们的能力制作而成的。当你戴着这个护身符被任何魔法攻击击中时,90%%的伤害将被抵抗消除。但请注意,这个伤害抵抗并不是完全的,你将仍然会受到一次魔法攻击至少半心的伤害。 embers.research.page.nonbeliever_amulet.title=它就这样消散了 embers.research.page.ores=矿石 embers.research.page.ores.desc=在坚实的地底深处,新手挖矿者可能会发现许多有用的矿物,即铜、铅、银和石英。铜作为导体具有多种用途,银可以作为施展奥术的媒介,以及石英,它是结晶物质的良好来源。 embers.research.page.ores.title=原矿 embers.research.page.pipe_tools.desc=管道将自动连接到其他相邻管道。如果不需要连接,可以使用铁匠锤右键断开它们。(请注意,双方可以单独断开连接),有时,管道网络中的路由可能会出错。当发生这种情况时,管道会喷出烟雾以显示它们已被堵塞。要疏通管道,只需用木棍右键单击堵塞的管道即可。 embers.research.page.pipes=管道 embers.research.page.pipes.desc=你的野心所需的最简单的机制之一是管道,一种简单的移动材料的方法。你已开发了铁和铅管:铁管可用于输送流体,而铅管可用于运输物品。管道只能在流体储罐和物品容器输入,但是如果需要提取功能,你必须制作一个相应的泵,把它依附在毗邻容器,并给予红石信号。 embers.research.page.pipes.title=物流运输 embers.research.page.pipes_category=管道 embers.research.page.projectile_augments_category=弹丸增强 embers.research.page.pulser=灰烬能量喷发器 embers.research.page.pulser.desc=简单的灰烬能量发射器是很泛用的,但是,你有时候需要更大量的灰烬能量吞吐。通过使用黎明石合金电镀普通的灰烬能量发射器,你可以大大的增加其传输速率。黎明石拥有对灰烬能量很强的传导性。该装置每次发射的能量是普通发射器的10倍。请注意,如果使用普通的接收器很容易就会传输饱和,溢出的灰烬能量将会浪费掉。 embers.research.page.pulser.title=全功率破坏 embers.research.page.pump=机械泵 embers.research.page.pump.desc=由于高压能量激发器需要消耗水来提高其灰烬能量的产量,因此您需要一种自动收集水的方法。机械泵是个比较不错的选择。但是灰烬能量转换成机械能的效率很差。仅仅使用灰烬能量驱动这个泵的话,泵运行的会非常缓慢,多做几个或许会更有帮助。 embers.research.page.pump.title=把它抽起来 embers.research.page.reactor=高温催化反应器 embers.research.page.reactor.desc=高温催化反应器是一种非常强大的激发灰烬晶体内能量的设备。它必须与燃烧室和催化室的顶部相连接。当燃烧室和催化室工作时,反应器将以等于燃料等级+催化等级再+1的倍速功率工作。催化室和燃烧室的功率水平必须接近。 embers.research.page.reactor.title=灰烬化学 embers.research.page.receivers.desc=接收器用于接收发射器传输过来的灰烬能量。当其接收到灰烬能量时,它会将其传输至机器的内部能量缓存中。它不需要红石信号的控制。请注意,如果它接收到灰烬能量,但它不能全部接收转化的话,其中一些能量将会被浪费。浪费的外部表现为一缕烟雾和火花。 embers.research.page.reservoir=蓄水池 embers.research.page.reservoir.desc=蓄水池是存储大量流体的简单方法。虽然默认情况下它只能存储40桶流体,但通过将方镁矾圈墙放置在其上方,每个圈墙可以扩容40桶存储上限。蓄水池只能从下方端口或者与其连接的机械核心存取。 embers.research.page.reservoir.title=大型水库 embers.research.page.resonating_bell=共鸣之铃 embers.research.page.resonating_bell.desc=共鸣之铃是嵌入到工具的升级。它能通过拥有此升级的工具右键敲击某类方块,使得附近的同类方块发光。共鸣的范围随升级的等级增加而增加。 embers.research.page.resonating_bell.title=共振 embers.research.page.routing.desc=管道中的物品和流体遵循简单的规则来确定它们的传输方向。它们将永远向前移动,不会自动反向,或上天保佑,永远不会弹出管道。在管道十字交叉并且这几根管道权重相等的情况下,它们会优先考虑传输方向直线相对的管道进行传输。当管道被打破时,物品和液体会在单一管道内循环。 embers.research.page.simple_alchemy_category=简单的炼金术 embers.research.page.splitter=灰烬能量分束器 embers.research.page.splitter.desc=使用新的黎明石合金,你发现了一种均分灰烬能量的方法。分束器有四个有效面:分别是两个具有较大铜端口和两个较小端口的面。每个较大的端口可以连接到能量发射器。当两侧都放置了发射器时,则分束器会将内部能量均匀分割后对两个接收器发射。每个端口都可以独立绑定。 embers.research.page.splitter.title=灰烬能量分裂法 embers.research.page.stamper=压印锤 embers.research.page.stamper.desc=为了将熔融金属制成想要的形状,你设置了压印器。它有两部分组成:压印锤和压印基座。压印须面向压印基座,且两者之间必须有一格的空间距离。给予压印锤模具以及一定量的灰烬能量,压印器将开始工作。压印后的产物会直接掉落到世界上,或者放入到压印器和压印基座中间的储物仓中(如果有的话)。 embers.research.page.stamper.title=敲平它 embers.research.page.steam_engine=蒸汽机 embers.research.page.steam_engine.desc=蒸汽机是生产机械能的最简单的机械。它所需要的仅仅是一点煤和水。供给足够的煤和水后,它会在输出面上输出一定的机械能。虽然蒸汽机使用燃料的效率比灰烬晶体开采机略高,但是如果处理不当也会浪费:比如,蒸汽机在运行时无法持续供给水,那么这段时间的燃料将会被浪费。 embers.research.page.steam_engine.title=工业革命 embers.research.page.steam_engine_overclock.desc=既然你已经开始涉猎灰烬能量产生蒸汽的研究,那么你可以尝试直接把蒸汽作为蒸汽机的动力。直接从外部泵入蒸汽可以显著提高蒸汽机的运行效率,能输出更多的动力。但此时蒸汽将会被快速消耗。你可能需要每个蒸汽机连接多个锅炉,或者将锅炉连接到使用大量灰烬能量的机器上。 embers.research.page.superheater=热炙器 embers.research.page.superheater.desc=热炙器是一个简单的升级,可以应用于积累了热量的物品。嵌入这个升级后,所有被拥有这个升级的工具挖掘/杀死的方块/生物的掉落都会自动烧炼并产生相应的物品损耗。升级的等级越高,燃烧的伤害越高。需要携带式灰烬能量才能运作。 embers.research.page.superheater.title=热力上升! embers.research.page.tank=流体容器 embers.research.page.tank.desc=液体,比如水或者岩浆在世界上是非常常见的。这种液体容器由金属和方镁矾制成,这个容器可以容纳16桶任何液体,并且它被敲掉后可以保存里面的液体。 embers.research.page.tank.title=流体容器 embers.research.page.tinker_lens=工匠单片眼镜 embers.research.page.tinker_lens.desc=尽管这些机器都是你自己单独制作出来的,但健忘的你有时会忘掉它们的一些功能。幸运的是,你已经设计出了一个可以用来仔细检视那些机器的目镜。当用任意一只手握住工匠单片眼镜时,你所注射的机器的那一面的功能会完整的显示出来。注意,这个工具没办法检查一个相邻的设备的功能,所以你检视机械核心时可能会遇到一些问题…… embers.research.page.tinker_lens.title=啥,这是是啥? embers.research.page.tinker_lens_augment=工匠单片眼镜 embers.research.page.tinker_lens_augment.desc=一直拿着单片眼镜很不方便。幸运的是,你可以将其强化到头盔上,这样你就可以在穿戴头盔时获得握着眼镜时的功能了。此强化并不占用强化槽,但太古动力核心是必要的。 embers.research.page.tinker_lens_augment.title=啥,这是是啥? embers.research.page.transfer=物品传输过滤器 embers.research.page.transfer.desc=能够对通过物品管道的物品进行过滤。默认情况下,这个设备可以为物品管道提供更高优先级的传输方向。另外,你可以拿着一个物品对着过滤器右键,设置一个白名单,使它只能允许该物品通过。过滤只支持从下方面往上方面的传输(支持扳手旋转) 。 embers.research.page.transfer.title=过滤 embers.research.page.tyrfing=提尔锋 embers.research.page.tyrfing.desc=这绝对是一种奇怪的结构,不是吗。提尔锋是一把非常精妙的武器,通过炼金术制成。虽然对大多数敌人来说,用于制作它的铅剑被轻微钝化导致伤害降低了,但是对于有护甲的敌人来说却异乎寻常的好用。你的敌人的护甲越高,此刃能造成的伤害就越大 。 embers.research.page.tyrfing.title=邪恶之刃 embers.research.page.vacuum=虚空吸取器 embers.research.page.vacuum.desc=虚空吸取器是收集掉落在地上的物品的设备。只需要通入红石信号,它将会把其开口前方大范围区域内的所有物品吸入到其后方的存储容器或管道里。 embers.research.page.vacuum.title=自动收集 embers.research.page.vacuum_transfer.desc=虚空吸取器没有内部库存,它会直接将物品推入连接的管道或者容器中。通过这个特性,你可以将物品传输过滤器连接到其后方来过滤需要吸取的物品。 embers.research.page.valves.desc=提取泵管道有许多特殊属性,在此列出:泵管道不会连接到其他泵管道。当没有接受到红石信号时,它们可以接收到普通管道传输过来的传输物而不是仅仅从容器里提取物品。当红石信号打开时,泵管道将永远不会接收来自管道的传输物。这使得泵管道可以用作管道系统中的阀门,来控制管道的流量。 embers.research.page.waste=实验法 embers.research.page.waste.desc=你很快发现,炼金术的变化并不总是会奏效。除了一个特定的灰烬数量的组合,其他的炼金过程将失败,并导致产生炼金失败品。这种炼金失败品可以放置在压印器中回收到一些灰烬,并且,你需要仔细观察这些失败品,以分析以确定你离正确的配方有多远。 embers.research.page.waste.title=化学反应 embers.research.page.weapon_augments_category=武器增强 embers.research.page.wildfire=野火核心 embers.research.page.wildfire.desc=然而,控制灰烬水晶簇的能量的难度有点超乎你的想象。虽然它很适合用 来在燃烧和催化室工作,但是你必须将其制作为野火核心以达到你的目的 。 embers.research.page.wildfire.title=掌控烈焰 embers.research.page.wildfire_category=野火核心 embers.research.smithing=强化锻造 embers.research.world=自然能源 embers.tooltip.accuracy=%s之误差:%s embers.tooltip.atmosEmber=大气灰烬: embers.tooltip.dial.ember_multiplier=产能倍数:%s embers.tooltip.dial.heat=热量:%s/%s embers.tooltip.emberdial.ember=灰烬能量:%s/%s embers.tooltip.fluiddial.fluid=%s:%s/%s embers.tooltip.fluiddial.nofluid=0/%s embers.tooltip.goggles.accessor_slot=• 机器访问存取器出入口 embers.tooltip.goggles.actuator_slot=• 机器运行出入口 embers.tooltip.goggles.ember=灰烬晶体 embers.tooltip.goggles.filter=%s (%s) embers.tooltip.goggles.fluid=流体 embers.tooltip.goggles.fluid.any=任意 embers.tooltip.goggles.fluid.metal=熔融金属 embers.tooltip.goggles.fluid.redstone=炼金红石浆液 embers.tooltip.goggles.fluid.steam=蒸汽 embers.tooltip.goggles.fluid.water=水 embers.tooltip.goggles.fluid.water_or_steam=水或蒸汽 embers.tooltip.goggles.input=§9⬊§r %s embers.tooltip.goggles.item=物品 embers.tooltip.goggles.item.any=任意 embers.tooltip.goggles.item.ash=灰烬 embers.tooltip.goggles.item.catalysis=催化剂 embers.tooltip.goggles.item.combustion=燃烧剂 embers.tooltip.goggles.item.ember=灰烬能量 embers.tooltip.goggles.item.ember_storage=便携灰烬能量存储器 embers.tooltip.goggles.item.fuel=燃料 embers.tooltip.goggles.item.stamp=模具 embers.tooltip.goggles.mechanical=机械能 embers.tooltip.goggles.output=§6⬉§r %s embers.tooltip.goggles.storage=• %s embers.tooltip.goggles.upgrade=• 机器升级 embers.tooltip.goggles.upgrade_slot=• 机器升级出入口 embers.tooltip.heat_amount=热量: embers.tooltip.heat_level=等级: embers.tooltip.inflictor=协调伤害 embers.tooltip.item.ember=灰烬能量:%s/%s embers.tooltip.itemdial.item=%sx %s embers.tooltip.itemdial.noitem=无 embers.tooltip.itemdial.slot=存储槽 %s:%s embers.tooltip.modifier.anti_tinker_lens=盲目工匠 embers.tooltip.modifier.blasting_core=爆破 %s embers.tooltip.modifier.caster_orb=能量发射 %s embers.tooltip.modifier.diffraction=衍射 %s embers.tooltip.modifier.eldritch_insignia=怪诞 %s embers.tooltip.modifier.flame_barrier=烈焰屏障 %s embers.tooltip.modifier.focal_lens=聚焦 %s embers.tooltip.modifier.intelligent_apparatus=智能 %s embers.tooltip.modifier.jet_augment=煤渣喷气机 %s embers.tooltip.modifier.resonating_bell=共振 %s embers.tooltip.modifier.superheater=过热 %s embers.tooltip.modifier.tinker_lens=工匠的凝视 embers.tooltip.modifiers=附加强化: embers.tooltip.num1=I embers.tooltip.num2=II embers.tooltip.num3=III embers.tooltip.num4=IV embers.tooltip.num5=V embers.tooltip.num6=VI embers.tooltip.num7=VII embers.tooltip.numstop=该停下了 embers.tooltip.side.center=中央 embers.tooltip.side.down=底部 embers.tooltip.side.east=东 embers.tooltip.side.north=北 embers.tooltip.side.south=南 embers.tooltip.side.up=顶端 embers.tooltip.side.west=西 embers.tooltip.targetingBlock=指向定位: embers.tooltip.tyrfing=基于目标的护甲造成伤害,护甲越高,伤害越大。 embers.tooltip.upgrade.actuator=运行速率:%s entity.ancient_golem.name=太古魔像 fluid.alchemical_redstone=炼金红石浆液 fluid.aluminum=熔融铝 fluid.astralite=熔融硝酸甘油 fluid.bronze=熔融青铜 fluid.copper=熔融铜 fluid.dawnstone=熔融黎明石 fluid.electrum=熔融琥珀金 fluid.gold=熔融金 fluid.iron=熔融铁 fluid.lead=熔融铅 fluid.nickel=熔融镍 fluid.silver=熔融银 fluid.steam=蒸汽 fluid.tin=熔融锡 fluid.umber_steel=熔融锈钢 item.adhesive.name=胶粘剂 item.alchemic_waste.name=炼金失败物 item.ancient_motive_core.name=太古动力核心 item.anti_tinker_lens.name=烟熏的工匠单片眼镜 item.archaic_brick.name=古代砖块 item.archaic_circuit.name=太古电路 item.ashen_amulet.name=灰烬护身符 item.ashen_cloak_boots.name=灰烬长筒靴 item.ashen_cloak_chest.name=灰烬斗篷 item.ashen_cloak_head.name=灰烬护目镜 item.ashen_cloak_legs.name=灰烬绑腿 item.ashen_cloth.name=灰烬布匹 item.aspectus_copper.name=铜之元素象征 item.aspectus_dawnstone.name=黎明石之元素象征 item.aspectus_iron.name=铁之元素象征 item.aspectus_lead.name=铅之元素象征 item.aspectus_silver.name=银之元素象征 item.axe_aluminum.name=铝斧 item.axe_bronze.name=青铜斧 item.axe_clockwork.name=发条战斧 item.axe_copper.name=铜斧 item.axe_dawnstone.name=黎明石斧 item.axe_electrum.name=琥珀金斧 item.axe_lead.name=铅斧 item.axe_nickel.name=镍斧 item.axe_silver.name=银斧 item.axe_tin.name=锡斧 item.blasting_core.name=爆破核心 item.blend_caminite.name=方镁矾混合物 item.brick_caminite.name=方镁矾砖 item.caster_orb.name=法师法球 item.codex.name=古代法典 item.core_stone.name=核心石 item.crystal_ember.name=灰烬晶体 item.dawnstone_mail.name=黎明石甲胄 item.diffraction_barrel.name=散射枪管 item.dust_ash.name=灰烬 item.dust_ember.name=灰烬沙砾 item.dust_metallurgic.name=冶金粉尘 item.eldritch_insignia.name=恐怖徽章 item.ember_amulet.name=余烬护身符 item.ember_belt.name=余烬腰带 item.ember_bulb.name=地幔能量灯泡 item.ember_cartridge.name=地幔大型能量筒 item.ember_cluster.name=灰烬水晶簇 item.ember_detector.name=大气能量测量表 item.ember_jar.name=地幔小型能量罐 item.ember_ring.name=余烬之戒 item.explosion_charm.name=炸裂吊坠 item.flame_barrier.name=烈焰屏障 item.focal_lens.name=聚焦镜片 item.gear_dawnstone.name=黎明石齿轮 item.gear_iron.name=铁齿轮 item.glimmer_lamp.name=微光水晶灯 item.glimmer_shard.name=微光水晶 item.golems_eye.name=太古之眼 item.grandhammer.name=灰烬大锤 item.hoe_aluminum.name=铝锄 item.hoe_bronze.name=青铜锄 item.hoe_copper.name=铜锄 item.hoe_dawnstone.name=黎明石锄 item.hoe_electrum.name=琥珀金锄 item.hoe_lead.name=铅锄 item.hoe_nickel.name=镍锄 item.hoe_silver.name=银锄 item.hoe_tin.name=锡锄 item.ignition_cannon.name=灼热射线枪 item.inferno_forge.name=炼狱锻造炉 item.inflictor_gem.name=惩罚者宝石 item.ingot_aluminum.name=铝锭 item.ingot_bronze.name=青铜锭 item.ingot_copper.name=铜锭 item.ingot_dawnstone.name=黎明石锭 item.ingot_electrum.name=琥珀金锭 item.ingot_lead.name=铅锭 item.ingot_mithril.name=秘银锭 item.ingot_nickel.name=镍锭 item.ingot_silver.name=银锭 item.ingot_tin.name=锡锭 item.intelligent_apparatus.name=智械机关 item.isolated_materia.name=万用修复要素 item.jet_augment.name=煤渣喷气机 item.nonbeliever_amulet.name=邪教徒护身符 item.nugget_aluminum.name=铝粒 item.nugget_bronze.name=青铜粒 item.nugget_copper.name=铜粒 item.nugget_dawnstone.name=黎明石粒 item.nugget_electrum.name=琥珀金粒 item.nugget_iron.name=铁粒 item.nugget_lead.name=铅粒 item.nugget_mithril.name=秘银粒 item.nugget_nickel.name=镍粒 item.nugget_silver.name=银粒 item.nugget_tin.name=锡粒 item.pickaxe_aluminum.name=铝镐 item.pickaxe_bronze.name=青铜镐 item.pickaxe_clockwork.name=发条镐 item.pickaxe_copper.name=铜镐 item.pickaxe_dawnstone.name=黎明石镐 item.pickaxe_electrum.name=琥珀金镐 item.pickaxe_lead.name=铅镐 item.pickaxe_nickel.name=镍镐 item.pickaxe_silver.name=银镐 item.pickaxe_tin.name=锡镐 item.plate_aluminum.name=铝板 item.plate_bronze.name=青铜板 item.plate_caminite.name=方镁矾板 item.plate_caminite_raw.name=生方镁矾板 item.plate_copper.name=铜板 item.plate_dawnstone.name=黎明石板 item.plate_electrum.name=琥珀金板 item.plate_gold.name=金板 item.plate_iron.name=铁板 item.plate_lead.name=铅板 item.plate_mithril.name=秘银板 item.plate_nickel.name=镍板 item.plate_silver.name=银板 item.plate_tin.name=锡板 item.resonating_bell.name=共鸣之铃 item.shard_ember.name=灰烬晶体碎片 item.shovel_aluminum.name=铝铲 item.shovel_bronze.name=青铜铲 item.shovel_copper.name=铜铲 item.shovel_dawnstone.name=黎明石铲 item.shovel_electrum.name=琥珀金铲 item.shovel_lead.name=铅铲 item.shovel_nickel.name=镍铲 item.shovel_silver.name=银铲 item.shovel_tin.name=锡铲 item.staff_ember.name=焚毁之杖 item.stamp_bar.name=锭模具 item.stamp_bar_raw.name=未烧制的锭模具 item.stamp_flat.name=平模具 item.stamp_flat_raw.name=未烧制的平模具 item.stamp_gear.name=齿轮模具 item.stamp_gear_raw.name=未烧制的齿轮模具 item.stamp_plate.name=板模具 item.stamp_plate_raw.name=未烧制的板模具 item.superheater.name=热炙器 item.sword_aluminum.name=铝剑 item.sword_bronze.name=青铜剑 item.sword_copper.name=铜剑 item.sword_dawnstone.name=黎明石剑 item.sword_electrum.name=琥珀金剑 item.sword_lead.name=铅剑 item.sword_nickel.name=镍剑 item.sword_silver.name=银剑 item.sword_tin.name=锡剑 item.tinker_hammer.name=铁匠锤 item.tinker_lens.name=工匠单片眼镜 item.tyrfing.name=提尔锋 item.wildfire_core.name=野火核心 itemGroup.embers=Embers itemGroup.embers_resources=Embers|金属 subtitles.ancient_golem.death=古代魔像被摧毁 subtitles.ancient_golem.hurt=古代魔像被击中 subtitles.ancient_golem.punch=古代魔像在击打 subtitles.ancient_golem.step=古代魔像在行走 subtitles.ash_amulet.burn=物品燃烧成灰烬 subtitles.blazing_ray.empty=灼热射线枪发出咔哒声 subtitles.blazing_ray.fire=灼热射线枪射击 subtitles.block.activator.plume=灰烬能量催化器激发出灰烬能量 subtitles.block.alchemy.fail=炼金术失败了...... subtitles.block.alchemy.start=炼金术开始了 subtitles.block.alchemy.success=炼金术成功了! subtitles.block.beam_cannon.fire=光束炮射击 subtitles.block.beam_cannon.hit=光束撞击 subtitles.block.boiler.plume=高压能量激发器激发出灰烬能量 subtitles.block.bore.start=灰烬晶体开采机隆隆作响 subtitles.block.bore.stop=灰烬晶体开采机喷气并停止 subtitles.block.catalytic_plug.start=催化剂插头开始注入催化剂 subtitles.block.catalytic_plug.stop=催化剂插头空了 subtitles.block.ignem_reactor.plume=高温催化反应器激发出灰烬能量 subtitles.block.inferno_forge.close=炼狱锻造炉关闭 subtitles.block.inferno_forge.fail=重铸失败...... subtitles.block.inferno_forge.open=炼狱锻造炉打开 subtitles.block.inferno_forge.start=炼狱锻造炉开始锻造 subtitles.block.inferno_forge.success=重铸成功! subtitles.block.metal_seed.ping=结晶种子分裂出金属碎片 subtitles.block.mini_boiler.rupture=微型锅炉猛地破裂开来 subtitles.block.pipe.connect=管道连接 subtitles.block.pipe.disconnect=管道断开 subtitles.block.pump.fast=机械泵以极快的速度泵动 subtitles.block.pump.mid=机械泵泵动 subtitles.block.pump.slow=机械泵发出砂纸般的声音泵动 subtitles.block.stamp.down=压印锤猛击下来 subtitles.block.stamp.up=压印锤缩回 subtitles.block.steam_engine.start_burn=蒸汽机开始燃烧燃料 subtitles.block.steam_engine.start_steam=蒸汽机开始旋转 subtitles.block.steam_engine.stop=蒸汽机发出嘎嘎声并停下来 subtitles.cinder_jet.boost=煤渣喷气上升 subtitles.cinder_staff.charge=灰烬能量充能 subtitles.cinder_staff.fail=煤渣冲锋失败 subtitles.ember_transfer.emit.big=喷发出大型灰烬能量束 subtitles.ember_transfer.emit.small=喷发出灰烬能量束 subtitles.ember_transfer.receive.big=大型灰烬能量束被接收 subtitles.ember_transfer.receive.small=灰烬能量束被接收 subtitles.ember_transfer.relay=灰烬能量束被中继 subtitles.explosion_charm.absorb=爆炸被吸收了 subtitles.fireball.big.fire=大火球被释放 subtitles.fireball.big.hit=大火球撞击 subtitles.fireball.small.fire=火球弹丸被释放 subtitles.fireball.small.hit=火球弹丸撞击 subtitles.heated.level_up=物品等级上升渣冲锋 subtitles.inflictor_gem.absorb=惩罚者宝石吸收伤害 subtitles.metallurgic_dust.convert=冶金粉尘转化矿石 subtitles.metallurgic_dust.fail=冶金粉尘将矿石转化为了无用的材料 subtitles.resonating_bell.ring=共鸣之铃发出铃声 tile.alchemy_pedestal.name=炼金术基座 tile.alchemy_tablet.name=炼金台 tile.archaic_bricks.name=古代砖 tile.archaic_edge.name=古代镶边砖 tile.archaic_light.name=古代灯笼 tile.archaic_tile.name=古代瓦块 tile.ashen_brick.name=灰石砖 tile.ashen_brick_slab.name=灰石砖台阶 tile.ashen_brick_slab_double.name=灰石砖双层台阶 tile.ashen_stone.name=灰石 tile.ashen_stone_slab.name=灰石台阶 tile.ashen_stone_slab_double.name=灰石双层台阶 tile.ashen_tile.name=灰石瓷砖 tile.ashen_tile_slab.name=灰石瓷砖台阶 tile.ashen_tile_slab_double.name=灰石瓷砖双层台阶 tile.auto_hammer.name=自动锤 tile.axle_iron.name=铁质轴 tile.beam_cannon.name=光束炮 tile.beam_splitter.name=灰烬能量分束器 tile.bin.name=储物仓 tile.block_aluminum.name=铝块 tile.block_bronze.name=青铜块 tile.block_caminite_brick.name=方镁矾砖块 tile.block_caminite_brick_slab.name=方镁矾台阶 tile.block_caminite_brick_slab_double.name=方镁矾双层台阶 tile.block_copper.name=铜块 tile.block_dawnstone.name=黎明石块 tile.block_electrum.name=琥珀金块 tile.block_furnace.name=熔炼炉 tile.block_lantern.name=灰烬灯笼 tile.block_lead.name=铅块 tile.block_mithril.name=秘银块 tile.block_nickel.name=镍块 tile.block_silver.name=银块 tile.block_tank.name=流体容器 tile.block_tin.name=锡块 tile.boiler.name=高压能量激发器 tile.breaker.name=自动方块破坏器 tile.caminite_lever.name=方镁矾拉杆 tile.catalytic_plug.name=催化剂插头 tile.catalyzer.name=催化室 tile.charger.name=铜质灰烬能量充能器 tile.cinder_plinth.name=灰烬炉 tile.combustor.name=燃烧室 tile.copper_cell.name=铜质灰烬能量单元 tile.core_stone.name=核心石 tile.creative_ember_source.name=创造模式无限灰烬能量源 tile.creative_mech_source.name=创造模式机械能发生器 tile.crystal_cell.name=晶胞灰烬能量单元 tile.dawnstone_anvil.name=黎明石砧 tile.deep_line.name=深井 tile.ember_activator.name=灰烬能量催化器 tile.ember_bore.name=灰烬晶体开采机 tile.ember_emitter.name=灰烬能量发射器 tile.ember_funnel.name=灰烬能量漏斗 tile.ember_gauge.name=灰烬能量计量表 tile.ember_injector.name=灰烬能量灌注器 tile.ember_pulser.name=灰烬能量喷发器 tile.ember_receiver.name=灰烬能量接收器 tile.ember_relay.name=灰烬能量中继器 tile.field_chart.name=能量波峰地形显示器 tile.fluid_gauge.name=流体计量表 tile.fluid_transfer.name=流体传输过滤器 tile.gearbox_frame.name=变速齿轮箱框架 tile.heat_coil.name=线圈炉 tile.inferno_forge.name=炼狱锻造炉 tile.item_dropper.name=物品投掷口 tile.item_gauge.name=物品计量表 tile.item_pipe.name=物品管道 tile.item_pump.name=物品提取泵管道 tile.item_transfer.name=物品传输过滤器 tile.knowledge_table.name=凝视研究台 tile.large_tank.name=蓄水池 tile.mech_accessor.name=机械核心连接器 tile.mech_actuator.name=机械驱动器 tile.mech_core.name=机械核心 tile.mechanical_pump.name=机械泵 tile.mini_boiler.name=微型锅炉 tile.mixer.name=混合离心器 tile.ore_aluminum.name=铝矿石 tile.ore_bronze.name=青铜矿石 tile.ore_copper.name=铜矿石 tile.ore_electrum.name=琥珀金矿石 tile.ore_lead.name=铅矿石 tile.ore_nickel.name=镍矿石 tile.ore_quartz.name=石英矿 tile.ore_silver.name=银矿石 tile.ore_tin.name=锡矿石 tile.pipe.name=流体管道 tile.pump.name=机械流体泵管道 tile.reactor.name=高温催化反应器 tile.sealed_planks.name=密封板 tile.seed.0.name=铁质结晶之种 tile.seed.1.name=金质结晶之种 tile.seed.2.name=铜质结晶之种 tile.seed.3.name=铅质结晶之种 tile.seed.4.name=银质结晶中种 tile.stairs_ashen_brick.name=灰石砖楼梯 tile.stairs_ashen_stone.name=灰石楼梯 tile.stairs_ashen_tile.name=灰石瓷砖楼梯 tile.stairs_caminite_brick.name=方镁矾砖楼梯 tile.stamper.name=压印锤 tile.stamper_base.name=压印基座 tile.steam_engine.name=蒸汽机 tile.stone_edge.name=方镁矾圈墙 tile.vacuum.name=虚空吸取器 tile.wall_ashen_brick.name=灰石砖墙 tile.wall_ashen_stone.name=灰石墙 tile.wall_ashen_tile.name=灰石瓷砖墙 tile.wall_caminite_brick.name=方镁矾砖墙 tile.wrapped_sealed_planks.name=加固密封板 tile.ember_siphon.name=灰烬能量虹吸器 tile.clockwork_attenuator.name=发条阻尼器 tile.explosion_pedestal.name=炸裂吊坠基座 tile.stirling.name=野火斯特林 item.shifting_scales.name=蠕动鳞片 item.winding_gears.name=发条齿轮 item.creative_heat.name=创造模式热力强化 embers.tooltip.attenuator.on=红石信号开:%s倍速度 embers.tooltip.attenuator.off=红石信号关:%s倍速度 embers.tooltip.modifier.shifting_scales=鳞片护甲 %s embers.tooltip.modifier.winding_gears=发条 %s embers.tooltip.modifier.core_stone=深度感知 %s embers.research.page.clockwork_attenuator=发条阻尼器 embers.research.page.clockwork_attenuator.title=油门控制 embers.research.page.clockwork_attenuator.desc=想要精确的控制机器的运作是一件非常困难的事情,很多时候你只能眼睁睁的看着机器全速运行到燃料完全消耗。而这个表盘可以帮助你控制并降低机器的运行速度。它内部有两个可以设置的速度:红石信号开时的速度和红石信号关时的速度。你可以通过红石信号进行切换。你可以通过右键或潜行右键来对其中一个生效的设置进行速度高低调试,注意,它并不能帮你提高机器运行速度。 embers.research.page.mergebox=合并齿轮箱 embers.research.page.mergebox.title=机械融合 embers.research.page.mergebox.desc=合并箱是机械系统的另一个总要组成部分。和常规的变速箱功能相反,它不是用于分流动力,而是用于将动能合并。注意,所有输入的动能大小必须一致才能用于合并!!! 如果某处动能输入发生变化,齿轮箱将暂时停止工作。 embers.research.page.gear_gold.desc=金齿轮与铁齿轮大致相同,但它能传输更高的功率。 embers.research.page.gear_redstone.desc=这些镶嵌有红石的齿轮拥有从外部控制齿轮箱的能力。当有红石信号通入齿轮箱时,红石齿轮才会开始运转。而红石齿轮(反向)则相反,通入信号会关闭。这两种齿轮的其他属性与金齿轮基本相同。 embers.research.page.ember_siphon.title=能量逆流 embers.research.page.ember_siphon.desc=能量虹吸器是一种机器升级,可放置在任何使用灰烬能量的机器下方以反转其功能。与其将灰烬能量白白的存储在耗能机器中,还不如作为中继器让别的要用能量的机器来消耗灰烬能量。它会与它上方使用灰烬能量的机器的能量缓存连接,相当于共用一个能量缓存,然后你就可以使用通常的方式从虹吸器的侧面提取灰烬能量了。虹吸器下面不能放虹吸器。 embers.research.page.stirling=野火斯特林 embers.research.page.stirling.title=反证法 embers.research.page.stirling.desc=这台机器与催化剂插头有类似的功能。不同的是当连接到机器并提供蒸汽时,野火斯特林会将所有机器运作时的灰烬能量能耗降低一半。第二个斯特林可以将能量能耗降为原来的四分之一。 embers.research.page.explosion_pedestal=炸裂吊坠基座 embers.research.page.explosion_pedestal.title=大日球体 embers.research.page.explosion_pedestal.desc=炸裂吊坠对于抵御炸有非常好的效果,但通常只有在你带在身上的时候才起作用。现在通过对炼金术中使用的基座进行一些小小的修改,你就可以将炸裂吊坠放置在上面并使其吸收周围的爆炸。 embers.research.page.winding_gears=发条齿轮 embers.research.page.winding_gears.title=组合玩具 embers.research.page.winding_gears.desc=当你手持带有此项升级的工具时,将会出现一些线圈环绕在经验条上用于显示工具所拥有的发条能量。你可以通过右击来给工具积攒发条能量(使用鼠标连续右击或者按住右击不放给工具上发条);当工具有发条能量时,持续按住鼠标左击就可以进行自动攻击。然而,随着时间的推移,工具所拥有的发条能量也会缓慢流失。 发条齿轮也有一些其他的用处,详情见下一页 embers.research.page.winding_gears_boots.desc=发条齿轮也可以加装在鞋子上,但是想要使用鞋子上的发条升级起作用,必须手持一个带有发条齿轮的工具(才能显示发条能量和上发条)并有足够的发条能量。根据发条能量的多少,你可以进行更高的跳跃。并且摔落地面时,也会免疫掉落伤害并发生反弹(就像落在粘液块上)。如果你进行冲刺跳跃,你会跳的更远。 embers.research.page.shifting_scales=蠕动之鳞 embers.research.page.shifting_scales.title=额外的护甲 embers.research.page.shifting_scales.desc=蠕动之鳞可以被安装在任何部位的盔甲上。当你穿着盔甲并在原地休息时(不进行移动且未收到伤害),你将会获得额外的防护,并会在血条上显示刻度。随着你受到攻击,这些刻度会被消耗并保护你免受大部分伤害(其实可以理解为伤害吸收的效果)。但是这些刻度不会因为饥饿或者溺水收到的伤害而消失(也不会减免此类伤害)。 tile.seed_iron.name=铁质结晶之种 tile.seed_gold.name=金质结晶之种 tile.seed_copper.name=铜质结晶之种 tile.seed_lead.name=铅质结晶之种 tile.seed_silver.name=银质结晶之种 tile.seed_aluminum.name=铝质结晶之种 tile.seed_nickel.name=镍质结晶之种 tile.seed_tin.name=锡质结晶之种 tile.seed_dawnstone.name=黎明石质结晶之种 tile.stone_valve.name=方镁矾阀门圈墙 tile.geo_separator.name=地质分离器 embers.tooltip.crystal.level=纯度等级 %s embers.tooltip.crystal.xp=正在提纯 %s /%s embers.tooltip.forge.cannot_start=没有足够的灰烬来点燃锻造炉。 embers.tooltip.broken=损坏的 embers.research.page.ores.tags=铜;铅;银;镍;铁;铝;铝;石英;矿石; embers.research.page.hammer.tags=锤;板;工具; embers.research.page.ancient_golem.tags=傀儡;岩石地精;烦人的;独眼巨人;古代的; embers.research.page.gauge.tags=灰烬;仪表;工具;信息; embers.research.page.caminite.tags=陶瓷;方镁矾;红砖;粘土;沙子; embers.research.page.activator.tags=灰烬;发射器;发生机; embers.research.page.crystals.tags=灰烬;晶体;碎片;矿石; embers.research.page.bore.tags=灰烬;钻孔;矿石; embers.research.page.pipes.tags=管道;运输;物品;流体;液体; embers.research.page.tank.tags=储罐;储存;液体;流体;便携;方镁矾; embers.research.page.bin.tags=容器;箱子;储存;物品;漏斗; embers.research.page.boiler.tags=锅炉;炼油厂;灰烬;压力;发生机;水;蒸汽;热量; embers.research.page.mini_boiler.tags=锅炉;压力;水;蒸汽;热量;爆炸; embers.research.page.dials.tags=信息;物品;流体;液体;灰烬;表盘;记量; embers.research.page.tinker_lens.tags=信息;调节器;增强;装甲;工具; embers.research.page.melter.tags=矿石;机械;熔融;复制;加工;液体;流体;物品;多方块;多方块; embers.research.page.stamper.tags=矿石;机器;熔化;元素象征;板;复制;加工;模具;液体;流体;物品;多方块;多方块;容器; embers.research.page.hearth_coil.tags=熔炉;线圈;炉床;机器;烧制;加工;物品;多方块;多方块; embers.research.page.mixer.tags=混合;混合机;熔融;机械;加工;液体;流体;多方块;多方块; embers.research.page.access.tags=核心;机械;代理;性能;侧面;端口;接口;访问;升级; embers.research.page.reservoir.tags=储罐;储存;液体;流体;方镁矾;多方块;多方块; embers.research.page.transfer.tags=管道;运输;物品;流体;液体;过滤器;运输; embers.research.page.breaker.tags=机器;打破;方块;物品;容器; embers.research.page.pump.tags=机械;泵;流体;液体;机械; embers.research.page.vacuum.tags=管道;运输;物品;过滤器;输送;运输;真空;漏斗; embers.research.page.dropper.tags=管道;运输;物品;掉落;漏斗;垃圾;虚空; embers.research.page.dawnstone.tags=黎明石;合金;金属;冶金; embers.research.page.emitters.tags=锤子;传输;传输;灰烬;能量接收器;发射器;接收;发送;红石;拉杆;链接;连接; embers.research.page.copper_cell.tags=单元;铜;灰烬;存储;便携;电容; embers.research.page.clockwork_attenuator.tags=计量表;控制;红石;速度;升级; embers.research.page.gearbox.tags=齿轮;箱;变速器;机械;分摊;分配;连接; embers.research.page.mergebox.tags=齿轮;箱;变速器;合并箱;机械;合并;融合; embers.research.page.axle_iron.tags=轴;机械;铁质轴;运输;转移;连接; embers.research.page.gear_iron.tags=齿轮;机械;铁齿轮;金齿轮;黎明石齿轮;连接;接口;齿轮; embers.research.page.actuator.tags=齿轮;机械;机床;升级;钻孔;泵;模具;混合器;锤子; embers.research.page.steam_engine.tags=机械;引擎;发生机;蒸汽;水;煤;燃料; embers.research.page.pulser.tags=灰烬;漏斗;喷发器;传输;传输;接收器;发射器;接收;沙子;红石;拉杆;链接;连接;损失; embers.research.page.splitter.tags=灰烬;分配;传输;传导;链接;连接; embers.research.page.dawnstone_anvil.tags=黎明石;铁砧;修理;破裂;伤害;锤子; embers.research.page.autohammer.tags=锤子;铁砧;机器;加工; embers.research.page.crystal_cell.tags=单元;晶体;灰烬;存储;电容; embers.research.page.charger.tags=充能;灰烬;机器; embers.research.page.jars.tags=灰烬;便携式;存储;地幔;筒;罐;电池; embers.research.page.clockwork_tools.tags=灰烬;武器;工具;发条;镐;锤子;斧;剑;锹; embers.research.page.cinder_staff.tags=灰烬;武器;权杖;弹射物;导弹;煤渣; embers.research.page.blazing_ray.tags=灰烬;武器;枪;射线;加农炮;弹射物;导弹;烈焰人;烈焰; embers.research.page.aspecti.tags=炼金术;集中;要素;元素象征;核心;模具;碎片;炼金蜕变; embers.research.page.cinder_plinth.tags=炼金术;机械;灰烬;处理;虚空;删除;炼金蜕变;炉;焚烧;烧成灰烬;火元素; embers.research.page.beam_cannon.tags=炼金术;武器;机;大炮;弹丸;梁;雷;嬗变; embers.jei.recipe.geologic_separator=地质分离器配方 embers.research.controls=右键单击手册上的条目,将其标记为✔来解锁完成。;解锁完成相应的条目后,其他锁定的条目将打开。;;可以把需要搜索的条目相匹配的文本输入进手册来高亮相应条目;您可以使用§f|§r符号,来使多个单词匹配高亮单个条目;例如:§f野火|能量发生器§r;支持中文输入 embers.research.prerequisite=此条目可以解锁 %s embers.research.prerequisite.locked=§4✕§8需要解锁条目 %s embers.research.prerequisite.unlocked=§a✔§r已解锁条目%s embers.research.page.reservoir_valve.desc=方镁矾圈墙可以替换为方镁矾阀门圈墙,阀门圈墙提供的流体容量与普通圈墙一样,但是阀门圈墙提供了四个输入输出口以供交互。 embers.research.page.alchemy.tags=炼金术;蜕变;片剂;变换;灰烬;基座;方位;绝景; embers.research.page.catalytic_plug.tags=速度;升级;红石;炼金术;炼金红石; embers.research.page.ember_siphon.tags=升级;反转;虹吸;灰烬能量;充能;放出; embers.research.page.waste.tags=Waste;炼金术;蜕变;实验;灰烬;印记; embers.research.page.hellish_synthesis.tags=炼金术;蜕变;地狱;下界;地狱岩;灵魂沙;灵魂;沙; embers.research.page.archaic_brick.tags=炼金术;蜕变;古代;砖; embers.research.page.motive_core.tags=炼金术;蜕变;古代;核心;发动机;魔像; embers.research.page.adhesive.tags=炼金术;蜕变;粘液;胶水;粘合; embers.research.page.tyrfing.tags=炼金术;蜕变;灰烬;武器;剑;盔甲;铅;伤害; embers.research.page.ashen_cloak.tags=炼金术;蜕变;灰烬;苍灰;斗篷;惩罚者;宝石;织物;布匹; embers.research.page.inflictor.tags=炼金术;蜕变;灰烬;苍灰;斗篷;惩罚者;宝石;织物;布匹; embers.research.page.glimmer.tags=炼金术;蜕变;光;微弱光;水晶;工具;石英; embers.research.page.metallurgic_dust.tags=炼金术;蜕变;矿石;粉末;金属;冶金学; embers.research.page.cluster.tags=炼金术;蜕变;灰烬能量;碎片;水晶;簇; embers.research.page.field_chart.tags=场地;图表;灰烬能量;测量仪器;信息显示; embers.research.page.wildfire.tags=炼金术;蜕变;野火;核心; embers.research.page.injector.tags=炼金术;蜕变;水晶;种子;金属;灰烬能量;注入器;机械;生长;加工; embers.research.page.crystal_level.desc=通过将灰烬能量注入到种子中,它不仅仅会自然生长并产出金属粒,并且随着时间的推移,种子也会变得更加纯净。结晶之种越纯净,生长完成时产出的金属粒就越多。可以通过工匠单片眼镜检查水晶的当前的纯度。请注意,当结晶之种被敲碎并移到别处时,所有纯度都会丢失。 embers.research.page.combustor.tags=燃烧;开始燃烧;机械;反应;室;升级;多方块结构;多方块; embers.research.page.catalyzer.tags=催化;催化剂;机械;反应;室;升级;多方块结构;多方块; embers.research.page.reactor.tags=野火;核心;催化;催化剂;燃烧;开始燃烧;能量发生器;反应;室;多方块结构;多方块; embers.research.page.materia.tags=炼金术;蜕变;修补;金属;物质;分离;重要;砧; embers.research.page.stirling.tags=野火;斯特林;灰烬能量;升级;蒸汽; embers.research.page.cost_reduction.tags=灰烬能量;戒指;护身符;腰带;Bauble; embers.research.page.mantle_bulb.tags=灰烬能量;存储;灯泡;地幔;Bauble;便携; embers.research.page.explosion_charm.tags=爆炸;饰品;Bauble; embers.research.page.explosion_pedestal.tags=爆炸;饰品;基座;Bauble; embers.research.page.nonbeliever_amulet.tags=护身符;异端;魔法;女巫;Bauble; embers.research.page.ashen_amulet.tags=护身符;灰烬;苍灰;Bauble; embers.research.page.dawnstone_mail.tags=着甲;黎明石;震退;盔甲;Bauble; embers.research.page.modifiers.tags=强化附加;强化;砧;锤;等级;工具;武器;盔甲; embers.research.page.heat.tags=强化附加;强化;砧;锤;等级;工具;武器;盔甲;热力;核心;古代;Ancient;发动机; embers.research.page.dismantling.tags=强化附加;强化;砧;锤;等级;工具;武器;盔甲;移除;拆卸;裂解; embers.research.page.inferno_forge.tags=强化附加;强化;砧;锤;等级;工具;武器;盔甲;热力;无量烈焰;锻造;机械;多方块结构;多方块; embers.research.page.superheater.tags=强化附加;强化;工具;武器;盔甲;熔炼;烹调; embers.research.page.cinder_jet.tags=强化附加;强化;盔甲;冲锋;喷气;余烬; embers.research.page.blasting_core.tags=强化附加;强化;工具;武器;盔甲;爆炸; embers.research.page.caster_orb.tags=强化附加;强化;工具;武器;枪弹;Missile; embers.research.page.flame_barrier.tags=强化附加;强化;盔甲;火;盾;屏障;防御; embers.research.page.eldritch_insignia.tags=强化附加;强化;盔甲;恐惧;恐怖; embers.research.page.intelligent_apparatus.tags=强化附加;强化;盔甲;阅历;智慧;经验; embers.research.page.resonating_bell.tags=强化附加;强化;工具;武器;光;铃; embers.research.page.tinker_lens_augment.tags=强化附加;强化;盔甲;信息显示; embers.research.page.anti_tinker_lens.tags=强化附加;强化;盔甲;信息显示; embers.research.page.mystical_mechanics.tags=机械动力;齿轮;轴;引擎; embers.research.page.baubles.tags=Bauble;护身符;戒指;腰带;饰品; embers.research.page.diffraction_barrel.tags=强化附加;强化;武器;枪弹;枪械;火枪;扩张; embers.research.page.focal_lens.tags=强化附加;强化;武器;枪弹;聚集;穿透; embers.research.page.winding_gears.tags=强化附加;强化;盔甲;工具;武器;齿轮;风;缠绕轴;反弹; embers.research.page.shifting_scales.tags=强化附加;强化;盔甲;度量程;心;血量;防御;
{ "pile_set_name": "Github" }
Sequel.migration do change do alter_table :scan_results do add_column :incomplete_task_count, Integer end end end
{ "pile_set_name": "Github" }
package io.cattle.platform.token.impl; import io.cattle.platform.token.CertSet; import java.io.IOException; import java.security.PublicKey; import java.security.cert.Certificate; import java.util.Map; public interface RSAKeyProvider { RSAPrivateKeyHolder getPrivateKey(); Map<String, PublicKey> getPublicKeys(); PublicKey getDefaultPublicKey(); CertSet generateCertificate(String subject, String... sans) throws Exception; Certificate getCACertificate(); byte[] toBytes(Certificate cert) throws IOException; }
{ "pile_set_name": "Github" }
module Spree class ProductCustomization < ActiveRecord::Base belongs_to :product_customization_type belongs_to :line_item has_many :customized_product_options, :dependent => :destroy attr_accessible :product_customization_type_id, :line_item_id # TODO: Jeff, add 'required' # price might depend on something contained in the variant (like product property value)a def price(variant=nil) amount = product_customization_type.calculator.compute(self, variant) end def calculator product_customization_type.calculator end end end
{ "pile_set_name": "Github" }
""" 03-output-range.py - The `mul` and `add` attributes. Almost all audio objects have a `mul` and `add` attributes. These are defined inside the PyoObject, which is the base class for all objects generating audio signal. The manual page of the PyoObject explains all behaviours common to audio objects. An audio signal outputs samples as floating-point numbers in the range -1 to 1. The `mul` and `add` attributes can be used to change the output range. Common uses are for modulating the amplitude of a sound or for building control signals like low frequency oscillators. A shortcut to automatically manipulate both `mul` and `add` attributes is to call the range(min, max) method of the PyoObject. This method sets `mul` and `add` attributes according to the desired `min` and `max` output values. It assumes that the generated signal is in the range -1 to 1. """ from pyo import * s = Server().boot().start() # The `mul` attribute multiplies each sample by its value. a = Sine(freq=100, mul=0.1) # The `add` attribute adds an offset to each sample. # The multiplication is applied before the addition. b = Sine(freq=100, mul=0.5, add=0.5) # Using the range(min, max) method allows to automatically # compute both `mul` and `add` attributes. c = Sine(freq=100).range(-0.25, 0.5) # Displays the waveforms sc = Scope([a, b, c]) s.gui(locals())
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2011 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You 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. --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:padding="6dip" android:textAppearance="?android:attr/textAppearanceMedium" />
{ "pile_set_name": "Github" }
> 策略名称 OkEX Websocket Realtime v3 > 策略作者 FawkesPan > 策略描述 # OkEX WebSocket API Connecter (compress supported) 因为 `websocket-client` 新版的各种大脑降级设计 很多功能无法使用 需要安装老版本websocket-client的包才能正常使用 `pip3 install websocket-client==0.46.0` > 源码 (python) ``` python #!/usr/bin/env python3 # -*- coding: utf-8 -*- # encoding: utf-8 # # Market Real-time Subscription v3 # # Copyright 2019 FawkesPan # # Do What the Fuck You Want To Public License # import time import ssl import sys import code import json import hashlib import hmac import urllib import threading import websocket import zlib import string try: import readline except ImportError: pass pong = time.time() class WSSubscription: def __init__(self, instrument_id='BTC-USD-190517', market='futures', on_message=None): self.__iid = instrument_id self.__market = market self.__Depth = {} if on_message is not None: self.__callbackEnabled = True self.__callback = on_message else: self.__callbackEnabled = False thread = threading.Thread(target=self.sub, args=()) thread.daemon = True thread.start() def GetDepth(self): return self.__Depth def subscribe(self, ws): def operator(op, args): message = { 'op': op, 'args': args } ws.send(json.dumps(message)) def run(*args): operator('subscribe', ['%s/depth5:%s' % (self.__market, self.__iid)]) operator('subscribe', ['%s/trade:%s' % (self.__market, self.__iid)]) while True: ws.send("ping") time.sleep(30) threading.Thread(target=run).start() def sub(self): websocket.enableTrace(False) URL = "wss://real.okex.com:10442/ws/v3" ws = websocket.WebSocketApp(URL, on_message=self.incoming, on_error=self.error_handling, on_close=self.closing) ws.on_open = self.subscribe while True: try: ws.run_forever() except: pass pass def incoming(self,ws,message): message = zlib.decompress(message, -zlib.MAX_WBITS) message = message.decode('utf-8') global pong if 'pong' in message: pong = time.time() if 'asks' in message and 'bids' in message: d = json.loads(message) self.__Depth = d['data'][0] if self.__callbackEnabled: self.__callback(message) def error_handling(self,ws,error): print(str(error)) def closing(self,ws): print("WebSocket Closing...") ext.OkEXWS = WSSubscription # 模块测试 def main(): OkEX = ext.OkEXWS('BTC-USD-190517', 'futures') while (True): Log(OkEX.GetDepth()) time.sleep(1) ``` > 策略出处 https://www.fmz.com/strategy/143457 > 更新时间 2019-05-18 00:17:12
{ "pile_set_name": "Github" }
// Copyright (c) 2001, Daniel C. Nuffer // Copyright (c) 2001-2011 Hartmut Kaiser // // 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) #if !defined(BOOST_SPIRIT_ITERATOR_BUF_ID_CHECK_POLICY_MAR_16_2007_1108AM) #define BOOST_SPIRIT_ITERATOR_BUF_ID_CHECK_POLICY_MAR_16_2007_1108AM #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp> #include <boost/spirit/home/support/iterators/detail/multi_pass.hpp> #include <boost/config.hpp> #include <boost/throw_exception.hpp> #include <exception> // for std::exception namespace boost { namespace spirit { namespace iterator_policies { /////////////////////////////////////////////////////////////////////////// // class illegal_backtracking // thrown by buf_id_check CheckingPolicy if an instance of an iterator is // used after another one has invalidated the queue /////////////////////////////////////////////////////////////////////////// class illegal_backtracking : public std::exception { public: illegal_backtracking() throw() {} ~illegal_backtracking() throw() {} char const* what() const throw() { return "boost::spirit::multi_pass::illegal_backtracking"; } }; /////////////////////////////////////////////////////////////////////////////// // class buf_id_check // Implementation of the CheckingPolicy used by multi_pass // This policy is most effective when used together with the std_deque // StoragePolicy. // // If used with the fixed_size_queue StoragePolicy, it will not detect // iterator dereferences that are out of the range of the queue. /////////////////////////////////////////////////////////////////////////////// struct buf_id_check { /////////////////////////////////////////////////////////////////////// struct unique //: detail::default_checking_policy { unique() : buf_id(0) {} unique(unique const& x) : buf_id(x.buf_id) {} void swap(unique& x) { boost::swap(buf_id, x.buf_id); } // called to verify that everything is ok. template <typename MultiPass> static void docheck(MultiPass const& mp) { if (mp.buf_id != mp.shared()->shared_buf_id) boost::throw_exception(illegal_backtracking()); } // called from multi_pass::clear_queue, so we can increment the count template <typename MultiPass> static void clear_queue(MultiPass& mp) { ++mp.shared()->shared_buf_id; ++mp.buf_id; } template <typename MultiPass> static void destroy(MultiPass&) {} protected: unsigned long buf_id; }; /////////////////////////////////////////////////////////////////////// struct shared { shared() : shared_buf_id(0) {} unsigned long shared_buf_id; }; }; }}} #endif
{ "pile_set_name": "Github" }
We do regular testing of ISO MPEG compliant decoder accuracy, automatic with snapshot generation each night at least, with results shown on the front page of http://mpg123.org . Since version 1.8.0, mpg123 really looks fine in that area... it's fast and sounds good;-)
{ "pile_set_name": "Github" }
<?php /** * @package Joomla.Platform * @subpackage GitHub * * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * GitHub API Account class for the Joomla Platform. * * @since 12.3 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithubAccount extends JGithubObject { /** * Method to create an authorisation. * * @param array $scopes A list of scopes that this authorisation is in. * @param string $note A note to remind you what the OAuth token is for. * @param string $url A URL to remind you what app the OAuth token is for. * * @deprecated use authorization->create() * * @return object * * @since 12.3 * @throws DomainException */ public function createAuthorisation(array $scopes = array(), $note = '', $url = '') { // Build the request path. $path = '/authorizations'; $data = json_encode( array('scopes' => $scopes, 'note' => $note, 'note_url' => $url) ); // Send the request. $response = $this->client->post($this->fetchUrl($path), $data); // Validate the response code. if ($response->code != 201) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to delete an authorisation * * @param integer $id ID of the authorisation to delete * * @deprecated use authorization->delete() * * @return object * * @since 12.3 * @throws DomainException */ public function deleteAuthorisation($id) { // Build the request path. $path = '/authorizations/' . $id; // Send the request. $response = $this->client->delete($this->fetchUrl($path)); // Validate the response code. if ($response->code != 204) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to edit an authorisation. * * @param integer $id ID of the authorisation to edit * @param array $scopes Replaces the authorisation scopes with these. * @param array $addScopes A list of scopes to add to this authorisation. * @param array $removeScopes A list of scopes to remove from this authorisation. * @param string $note A note to remind you what the OAuth token is for. * @param string $url A URL to remind you what app the OAuth token is for. * * @deprecated use authorization->edit() * * @return object * * @since 12.3 * @throws DomainException * @throws RuntimeException */ public function editAuthorisation($id, array $scopes = array(), array $addScopes = array(), array $removeScopes = array(), $note = '', $url = '') { // Check if more than one scopes array contains data $scopesCount = 0; if (!empty($scopes)) { $scope = 'scopes'; $scopeData = $scopes; $scopesCount++; } if (!empty($addScopes)) { $scope = 'add_scopes'; $scopeData = $addScopes; $scopesCount++; } if (!empty($removeScopes)) { $scope = 'remove_scopes'; $scopeData = $removeScopes; $scopesCount++; } // Only allowed to send data for one scope parameter if ($scopesCount >= 2) { throw new RuntimeException('You can only send one scope key in this request.'); } // Build the request path. $path = '/authorizations/' . $id; $data = json_encode( array( $scope => $scopeData, 'note' => $note, 'note_url' => $url, ) ); // Send the request. $response = $this->client->patch($this->fetchUrl($path), $data); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get details about an authorised application for the authenticated user. * * @param integer $id ID of the authorisation to retrieve * * @deprecated use authorization->get() * * @return object * * @since 12.3 * @note This method will only accept Basic Authentication * @throws DomainException */ public function getAuthorisation($id) { // Build the request path. $path = '/authorizations/' . $id; // Send the request. $response = $this->client->get($this->fetchUrl($path)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get the authorised applications for the authenticated user. * * @deprecated use authorization->getList() * * @return object * * @since 12.3 * @throws DomainException * @note This method will only accept Basic Authentication */ public function getAuthorisations() { // Build the request path. $path = '/authorizations'; // Send the request. $response = $this->client->get($this->fetchUrl($path)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get the rate limit for the authenticated user. * * @deprecated use authorization->getRateLimit() * * @return object * * @since 12.3 * @throws DomainException */ public function getRateLimit() { // Build the request path. $path = '/rate_limit'; // Send the request. $response = $this->client->get($this->fetchUrl($path)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } }
{ "pile_set_name": "Github" }
// DATA_TEMPLATE: js_data oTest.fnStart( "sPaginationType" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Check two button paging is the default", null, function () { return oSettings.sPaginationType == "two_button"; } ); oTest.fnTest( "Check class is applied", null, function () { return $('#example_paginate').hasClass('paging_two_button'); } ); oTest.fnTest( "Two A elements are in the wrapper", null, function () { return $('#example_paginate a').length == 2; } ); oTest.fnTest( "We have the previous button", null, function () { return document.getElementById('example_previous'); } ); oTest.fnTest( "We have the next button", null, function () { return document.getElementById('example_next'); } ); oTest.fnTest( "Previous button is disabled", null, function () { return $('#example_previous').hasClass('paginate_disabled_previous'); } ); oTest.fnTest( "Next button is enabled", null, function () { return $('#example_next').hasClass('paginate_enabled_next'); } ); /* Don't test paging - that's done by the zero config test script. */ /* Two buttons paging */ oTest.fnTest( "Can enabled full numbers paging", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "sPaginationType": "full_numbers" } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.sPaginationType == "full_numbers"; } ); oTest.fnTest( "Check full numbers class is applied", null, function () { return $('#example_paginate').hasClass('paging_full_numbers'); } ); var nFirst, nPrevious, nNext, nLast; oTest.fnTest( "Jump to last page", function () { nFirst = $('div.dataTables_paginate a.first'); nPrevious = $('div.dataTables_paginate a.previous'); nNext = $('div.dataTables_paginate a.next'); nLast = $('div.dataTables_paginate a.last'); nLast.click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries"; } ); oTest.fnTest( "Go to two pages previous", function () { nPrevious.click(); nPrevious.click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 31 to 40 of 57 entries"; } ); oTest.fnTest( "Next (second last) page", function () { nNext.click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 41 to 50 of 57 entries"; } ); oTest.fnTest( "Jump to first page", function () { nFirst.click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnComplete(); } );
{ "pile_set_name": "Github" }
{ "id": "suckerfish", "name": "Suckerfish", "games": { "nh": { "orderable": false, "sources": [ "North: Finned Shadows at Sea, Jun-Sep (All day)", "South: Finned Shadows at Sea, Dec-Mar (All day)" ], "sellPrice": { "currency": "bells", "value": 1500 } } }, "category": "Fish" }
{ "pile_set_name": "Github" }
<?php /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * Prettifies class and method names for use in TestDox documentation. * * @since Class available since Release 2.1.0 */ class PHPUnit_Util_TestDox_NamePrettifier { /** * @var string */ protected $prefix = 'Test'; /** * @var string */ protected $suffix = 'Test'; /** * @var array */ protected $strings = array(); /** * Prettifies the name of a test class. * * @param string $name * * @return string */ public function prettifyTestClass($name) { $title = $name; if ($this->suffix !== null && $this->suffix == substr($name, -1 * strlen($this->suffix))) { $title = substr($title, 0, strripos($title, $this->suffix)); } if ($this->prefix !== null && $this->prefix == substr($name, 0, strlen($this->prefix))) { $title = substr($title, strlen($this->prefix)); } if (substr($title, 0, 1) == '\\') { $title = substr($title, 1); } return $title; } /** * Prettifies the name of a test method. * * @param string $name * * @return string */ public function prettifyTestMethod($name) { $buffer = ''; if (!is_string($name) || strlen($name) == 0) { return $buffer; } $string = preg_replace('#\d+$#', '', $name, -1, $count); if (in_array($string, $this->strings)) { $name = $string; } elseif ($count == 0) { $this->strings[] = $string; } if (strpos($name, '_') !== false) { return str_replace('_', ' ', $name); } $max = strlen($name); if (substr($name, 0, 4) == 'test') { $offset = 4; } else { $offset = 0; $name[0] = strtoupper($name[0]); } $wasNumeric = false; for ($i = $offset; $i < $max; $i++) { if ($i > $offset && ord($name[$i]) >= 65 && ord($name[$i]) <= 90) { $buffer .= ' ' . strtolower($name[$i]); } else { $isNumeric = is_numeric($name[$i]); if (!$wasNumeric && $isNumeric) { $buffer .= ' '; $wasNumeric = true; } if ($wasNumeric && !$isNumeric) { $wasNumeric = false; } $buffer .= $name[$i]; } } return $buffer; } /** * Sets the prefix of test names. * * @param string $prefix */ public function setPrefix($prefix) { $this->prefix = $prefix; } /** * Sets the suffix of test names. * * @param string $suffix */ public function setSuffix($suffix) { $this->suffix = $suffix; } }
{ "pile_set_name": "Github" }
a6f10947d6c37b62a4c0f5e4d0d32cc826a957c7d1026f316d5651262c4f0b24 Dyre.zip
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_232) on Tue Jan 28 22:35:22 EST 2020 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class org.easymock.internal.matchers.CompareTo (EasyMock 4.2 API)</title> <meta name="date" content="2020-01-28"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.easymock.internal.matchers.CompareTo (EasyMock 4.2 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/easymock/internal/matchers/CompareTo.html" title="class in org.easymock.internal.matchers">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/easymock/internal/matchers/class-use/CompareTo.html" target="_top">Frames</a></li> <li><a href="CompareTo.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.easymock.internal.matchers.CompareTo" class="title">Uses of Class<br>org.easymock.internal.matchers.CompareTo</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../org/easymock/internal/matchers/CompareTo.html" title="class in org.easymock.internal.matchers">CompareTo</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.easymock.internal.matchers">org.easymock.internal.matchers</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.easymock.internal.matchers"> <!-- --> </a> <h3>Uses of <a href="../../../../../org/easymock/internal/matchers/CompareTo.html" title="class in org.easymock.internal.matchers">CompareTo</a> in <a href="../../../../../org/easymock/internal/matchers/package-summary.html">org.easymock.internal.matchers</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../../../org/easymock/internal/matchers/CompareTo.html" title="class in org.easymock.internal.matchers">CompareTo</a> in <a href="../../../../../org/easymock/internal/matchers/package-summary.html">org.easymock.internal.matchers</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/easymock/internal/matchers/CompareEqual.html" title="class in org.easymock.internal.matchers">CompareEqual</a>&lt;T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a>&lt;T&gt;&gt;</span></code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/easymock/internal/matchers/GreaterOrEqual.html" title="class in org.easymock.internal.matchers">GreaterOrEqual</a>&lt;T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a>&lt;T&gt;&gt;</span></code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/easymock/internal/matchers/GreaterThan.html" title="class in org.easymock.internal.matchers">GreaterThan</a>&lt;T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a>&lt;T&gt;&gt;</span></code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/easymock/internal/matchers/LessOrEqual.html" title="class in org.easymock.internal.matchers">LessOrEqual</a>&lt;T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a>&lt;T&gt;&gt;</span></code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/easymock/internal/matchers/LessThan.html" title="class in org.easymock.internal.matchers">LessThan</a>&lt;T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a>&lt;T&gt;&gt;</span></code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/easymock/internal/matchers/CompareTo.html" title="class in org.easymock.internal.matchers">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/easymock/internal/matchers/class-use/CompareTo.html" target="_top">Frames</a></li> <li><a href="CompareTo.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2001&#x2013;2020 <a href="http://easymock.org/contributors.html" target="_blank">EasyMock contributors</a>. All rights reserved.</small></p> </body> </html>
{ "pile_set_name": "Github" }
{ "action": { "error": { "notes": "Location: Unknown", "variety": [ "Loss" ], "vector": [ "Unknown" ] } }, "actor": { "internal": { "motive": [ "Unknown" ], "variety": [ "Unknown" ] } }, "asset": { "assets": [ { "variety": "U - Unknown" } ], "cloud": [ "Unknown" ], "management": [ "External" ], "notes": "It was a camera, with passport photos on the memory card in the camera" }, "attribute": { "availability": { "variety": [ "Loss" ] }, "confidentiality": { "data": [ { "amount": 6, "variety": "Personal" } ], "data_disclosure": "Potentially", "data_total": 6, "data_victim": [ "Other" ], "state": [ "Stored unencrypted" ] } }, "discovery_method": { "internal": { "variety": [ "Reported by employee" ] } }, "impact": { "overall_rating": "Unknown" }, "incident_id": "8B5C7282-2CFD-419D-82C5-9AD31F17BFB5", "plus": { "analysis_status": "First pass", "analyst": "jayjacobs", "attribute": { "confidentiality": { "credit_monitoring": "Unknown" } }, "created": "2013-10-18T14:37:00Z", "github": "591", "master_id": "8B5C7282-2CFD-419D-82C5-9AD31F17BFB5", "modified": "2014-05-10T00:58:19Z", "timeline": { "notification": { "year": 2013 } } }, "reference": "http://www.v3.co.uk/v3-uk/news/2300878/ico-slams-royal-veterinary-college-for-lack-of-byod-policies-after-data-loss", "schema_version": "1.3.4", "security_incident": "Confirmed", "source_id": "vcdb", "summary": "Employee lost camera with pictures of 6 passports of prospective job applicants.", "timeline": { "compromise": { "unit": "NA" }, "containment": { "unit": "NA" }, "discovery": { "unit": "NA" }, "exfiltration": { "unit": "NA" }, "incident": { "month": 10, "year": 2013 } }, "victim": { "country": [ "GB" ], "employee_count": "101 to 1000", "industry": "611310", "region": [ "150154" ], "victim_id": "Royal Veterinary College" } }
{ "pile_set_name": "Github" }
// version 1.1.2 val data = intArrayOf( 85, 88, 75, 66, 25, 29, 83, 39, 97, 68, 41, 10, 49, 16, 65, 32, 92, 28, 98 ) fun pick(at: Int, remain: Int, accu: Int, treat: Int): Int { if (remain == 0) return if (accu > treat) 1 else 0 return pick(at - 1, remain - 1, accu + data[at - 1], treat) + if (at > remain) pick(at - 1, remain, accu, treat) else 0 } fun main(args: Array<String>) { var treat = 0 var total = 1.0 for (i in 0..8) treat += data[i] for (i in 19 downTo 11) total *= i for (i in 9 downTo 1) total /= i val gt = pick(19, 9, 0, treat) val le = (total - gt).toInt() System.out.printf("<= : %f%% %d\n", 100.0 * le / total, le) System.out.printf(" > : %f%% %d\n", 100.0 * gt / total, gt) }
{ "pile_set_name": "Github" }
\ProvidesFile{gloss-croatian.ldf}[polyglossia: module for croatian] \PolyglossiaSetup{croatian}{ bcp47=hr, langtag=HRV, hyphennames={croatian}, hyphenmins={2,2}, % aligned with https://ctan.org/pkg/hrhyph patterns and http://lebesgue.math.hr/~nenad/Diplomski/Maja_Ribaric_2011.pdf frenchspacing=true, % recommendation from Damir Bralić indentfirst=false, % recommendation from Damir Bralić fontsetup=true } % BCP-47 compliant aliases \setlanguagealias*{croatian}{hr} \define@boolkey{croatian}[croatian@]{babelshorthands}[true]{} \define@boolkey{croatian}[croatian@]{disableligatures}[true]{} % Register default options \xpg@initialize@gloss@options{croatian}{babelshorthands=false,disableligatures=false} \ifsystem@babelshorthands \setkeys{croatian}{babelshorthands=true} \else \setkeys{croatian}{babelshorthands=false} \fi \ifcsundef{initiate@active@char}{% \input{babelsh.def}% \initiate@active@char{"}% \shorthandoff{"}% }{} \def\croatian@shorthands{% \bbl@activate{"}% \def\language@group{croatian}% \declare@shorthand{croatian}{"=}{\penalty\@M-\hskip\z@skip}% \declare@shorthand{croatian}{""}{\hskip\z@skip}% \declare@shorthand{croatian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}% \declare@shorthand{croatian}{"-}{\nobreak\-\bbl@allowhyphens}% \declare@shorthand{croatian}{"|}{% \textormath{\penalty\@M\discretionary{-}{}{\kern.03em}% \bbl@allowhyphens}{}% }% \declare@shorthand{croatian}{"/}{\textormath {\bbl@allowhyphens\discretionary{/}{}{/}\bbl@allowhyphens}{}}% \declare@shorthand{croatian}{"`}{„}% \declare@shorthand{croatian}{"'}{”}% \declare@shorthand{croatian}{"<}{«}% \declare@shorthand{croatian}{">}{»}% \declare@shorthand{croatian}{"D}{\xpg@hr@lig{D}}% \declare@shorthand{croatian}{"d}{\xpg@hr@lig{d}}% \declare@shorthand{croatian}{"L}{\xpg@hr@lig{L}}% \declare@shorthand{croatian}{"l}{\xpg@hr@lig{l}}% \declare@shorthand{croatian}{"N}{\xpg@hr@lig{N}}% \declare@shorthand{croatian}{"n}{\xpg@hr@lig{n}}% } \def\nocroatian@shorthands{% \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}% } \newcommand*\hr@charifavailable[2]{% \ifcroatian@disableligatures \bgroup#2\egroup% \else \charifavailable{#1}{#2}% \fi% } % Provide croatian ligatures if available in current font \def\xpg@hr@lig#1#2{% \bgroup% % 1. DŽ, Dž and dž \ifx#1D% \ifx#2Z\relax% \hr@charifavailable{01C4}{DŽ}% \else% \ifx#2z\relax \hr@charifavailable{01C5}{Dž}% \else D#2% \fi% \fi% \fi% \ifx#1d% \ifx#2z\relax \hr@charifavailable{01C6}{dž}% \else d#2% \fi% \fi% % 2. LJ, Lj and lj \ifx#1L% \ifx#2J\relax% \hr@charifavailable{01C7}{LJ}% \else% \ifx#2j\relax \hr@charifavailable{01C8}{Lj}% \else L#2% \fi% \fi% \fi% \ifx#1l% \ifx#2j\relax \hr@charifavailable{01C9}{lj}% \else l#2% \fi% \fi% % 2. NJ, Nj and nj \ifx#1N% \ifx#2J\relax% \hr@charifavailable{01CA}{NJ}% \else% \ifx#2j\relax \hr@charifavailable{01CB}{Nj}% \else N#2% \fi% \fi% \fi% \ifx#1n% \ifx#2j\relax \hr@charifavailable{01CC}{nj}% \else n#2% \fi% \fi% \egroup% } \def\captionscroatian{% \def\prefacename{Predgovor}% \def\refname{Literatura}% \def\abstractname{Sažetak}% \def\bibname{Bibliografija}% \def\chaptername{Poglav\hr@charifavailable{01C9}{lj}e}% \def\appendixname{Dodatak}% \def\contentsname{Sadržaj}% \def\listfigurename{Popis slika}% \def\listtablename{Popis tablica}% \def\indexname{Kazalo}% \def\figurename{Slika}% \def\tablename{Tablica}% \def\partname{Dio}% \def\enclname{Prilozi}% \def\ccname{Kopija}% \def\headtoname{Prima}% \def\pagename{Stranica}% \def\seename{Vidjeti}% \def\alsoname{Također vidjeti}% \def\proofname{Dokaz}% \def\glossaryname{Pojmovnik}% } \def\datecroatian{% \def\today{\number\day.~\ifcase\month\or siječnja\or veljače\or ožujka\or travnja\or svibnja\or lipnja\or srpnja\or kolovoza\or rujna\or listopada\or studenoga\or prosinca\fi \space \number\year.}% } \def\noextras@croatian{% \ifcroatian@babelshorthands\nocroatian@shorthands\fi% } \def\blockextras@croatian{% \ifcroatian@babelshorthands\croatian@shorthands\fi% } \def\inlineextras@croatian{% \ifcroatian@babelshorthands\croatian@shorthands\fi% } \endinput
{ "pile_set_name": "Github" }
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2011-2017 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2011 UT-Battelle, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ #include "opal_config.h" #include "btl_ugni.h" #include "btl_ugni_frag.h" #include "btl_ugni_smsg.h" #include "opal/include/opal/align.h" static pthread_t mca_btl_ugni_progress_thread_id; static volatile int stop_progress_thread = 0; unsigned int mca_btl_ugni_progress_thread_wakeups = 0; static void *mca_btl_ugni_prog_thread_fn(void * data) { uint32_t which; gni_return_t status; gni_cq_handle_t cq_vec[1 + MCA_BTL_UGNI_MAX_DEV_HANDLES]; struct mca_btl_ugni_module_t *btl = (mca_btl_ugni_module_t *)data; int cq_count = 1 + mca_btl_ugni_component.virtual_device_count; /* * need to block signals */ cq_vec[0] = btl->smsg_remote_irq_cq; for (int i = 0 ; i < mca_btl_ugni_component.virtual_device_count ; ++i) { cq_vec[i + 1] = btl->devices[i].dev_rdma_local_irq_cq.gni_handle; } while (stop_progress_thread == 0) { /* * this ugni call doesn't need a lock */ status = GNI_CqVectorMonitor(cq_vec, cq_count, -1, &which); if (status == GNI_RC_NOT_DONE) continue; if ((status == GNI_RC_SUCCESS) && (stop_progress_thread == 0)) { mca_btl_ugni_progress_thread_wakeups++; opal_progress(); } } return (void *) (intptr_t) OPAL_SUCCESS; } int mca_btl_ugni_spawn_progress_thread(struct mca_btl_base_module_t *btl) { int rc, ret=OPAL_SUCCESS; pthread_attr_t attr; pthread_attr_init(&attr); rc = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); if (0 != rc) { BTL_ERROR(("btl/ugni pthread_attr_setdetachstate returned %s ",strerror(rc))); ret = OPAL_ERROR; goto fn_exit; } rc = pthread_create(&mca_btl_ugni_progress_thread_id, &attr, mca_btl_ugni_prog_thread_fn, (void *)btl); if (0 != rc) { BTL_ERROR(("btl/ugni pthread_create returned %s ",strerror(rc))); ret = OPAL_ERROR; goto fn_exit; } rc = pthread_attr_destroy(&attr); if (0 != rc) { BTL_ERROR(("btl/ugni pthread_attr_destory returned %s ",strerror(rc))); ret = OPAL_ERROR; } fn_exit: return ret; } int mca_btl_ugni_kill_progress_thread(void) { int ret=OPAL_SUCCESS; void *thread_rc; stop_progress_thread = 1; /* * post a CQ to myself to wake my thread up */ ret = mca_btl_ugni_post_cqwrite (mca_btl_ugni_component.modules[0].local_ep, &mca_btl_ugni_component.modules[0].devices[0].dev_rdma_local_cq, mca_btl_ugni_component.modules[0].devices[0].smsg_irq_mhndl, 0xdead, NULL, NULL, NULL); /* * TODO: if error returned, need to kill off thread manually */ if (OPAL_SUCCESS != ret) { /* force the thread to exit */ pthread_cancel (mca_btl_ugni_progress_thread_id); goto fn_exit; } pthread_join (mca_btl_ugni_progress_thread_id, &thread_rc); if (0 != (intptr_t) thread_rc) { BTL_ERROR(("btl/ugni error returned from progress thread: %d", (int) (intptr_t) thread_rc)); ret = (int)(intptr_t) thread_rc; } fn_exit: return ret; }
{ "pile_set_name": "Github" }
// Copyright (C) 2012-2018 Leap Motion, Inc. All rights reserved. #pragma once #include "EnclosedContextTestBase.h" class OptionalDecorationTest: public EnclosedContextTestBase {};
{ "pile_set_name": "Github" }
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/browser/cache_storage/cross_sequence/cross_sequence_cache_storage.h" #include "content/browser/cache_storage/cache_storage_context_impl.h" #include "content/browser/cache_storage/cache_storage_histogram_utils.h" #include "content/browser/cache_storage/cross_sequence/cross_sequence_cache_storage_cache.h" #include "content/browser/cache_storage/cross_sequence/cross_sequence_utils.h" namespace content { // The Inner class is SequenceBound<> to the real target CacheStorage sequence // by the outer CrossSequenceCacheStorage. All CacheStorage operations are // proxied to the Inner on the correct sequence via the Post() method. The // outer storage is responsible for wrapping any callbacks in order to post on // the outer's original sequence. class CrossSequenceCacheStorage::Inner { public: using OpenCacheAdapterCallback = base::OnceCallback<void(scoped_refptr<CrossSequenceCacheStorageCache>, blink::mojom::CacheStorageError)>; Inner(const url::Origin& origin, CacheStorageOwner owner, scoped_refptr<CacheStorageContextWithManager> context) { scoped_refptr<CacheStorageManager> manager = context->CacheManager(); if (manager) handle_ = manager->OpenCacheStorage(origin, owner); } void Init() { if (!handle_.value()) return; handle_.value()->Init(); } void OpenCache(scoped_refptr<CrossSequenceCacheStorageCache> cache_wrapper, const std::string& cache_name, int64_t trace_id, OpenCacheAdapterCallback adapter_callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!handle_.value()) { std::move(adapter_callback) .Run(std::move(cache_wrapper), MakeErrorStorage(ErrorStorageType::kStorageHandleNull)); return; } // Open the cache and set the handle on the wrapper object provided. The // wrapper will then be sent back to the source sequence to be exposed via // its own handle. handle_.value()->OpenCache( cache_name, trace_id, base::BindOnce( [](scoped_refptr<CrossSequenceCacheStorageCache> cache_wrapper, OpenCacheAdapterCallback adapter_callback, CacheStorageCacheHandle handle, blink::mojom::CacheStorageError error) { // Called on target TaskRunner. if (handle.value()) cache_wrapper->SetHandleOnTaskRunner(std::move(handle)); // Passing |cache_wrapper| back across the sequence boundary is // safe because we are guaranteed this is the only reference to // the object. std::move(adapter_callback).Run(std::move(cache_wrapper), error); }, std::move(cache_wrapper), std::move(adapter_callback))); } void HasCache(const std::string& cache_name, int64_t trace_id, BoolAndErrorCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!handle_.value()) { std::move(callback).Run( false, MakeErrorStorage(ErrorStorageType::kStorageHandleNull)); return; } handle_.value()->HasCache(cache_name, trace_id, std::move(callback)); } void DoomCache(const std::string& cache_name, int64_t trace_id, ErrorCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!handle_.value()) { std::move(callback).Run( MakeErrorStorage(ErrorStorageType::kStorageHandleNull)); return; } handle_.value()->DoomCache(cache_name, trace_id, std::move(callback)); } void EnumerateCaches(int64_t trace_id, EnumerateCachesCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!handle_.value()) { std::move(callback).Run(std::vector<std::string>()); return; } handle_.value()->EnumerateCaches(trace_id, std::move(callback)); } void MatchCache(const std::string& cache_name, blink::mojom::FetchAPIRequestPtr request, blink::mojom::CacheQueryOptionsPtr match_options, CacheStorageSchedulerPriority priority, int64_t trace_id, CacheStorageCache::ResponseCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!handle_.value()) { std::move(callback).Run( MakeErrorStorage(ErrorStorageType::kStorageHandleNull), nullptr); return; } handle_.value()->MatchCache(cache_name, std::move(request), std::move(match_options), priority, trace_id, std::move(callback)); } void MatchAllCaches(blink::mojom::FetchAPIRequestPtr request, blink::mojom::CacheQueryOptionsPtr match_options, CacheStorageSchedulerPriority priority, int64_t trace_id, CacheStorageCache::ResponseCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!handle_.value()) { std::move(callback).Run( MakeErrorStorage(ErrorStorageType::kStorageHandleNull), nullptr); return; } handle_.value()->MatchAllCaches(std::move(request), std::move(match_options), priority, trace_id, std::move(callback)); } void WriteToCache(const std::string& cache_name, blink::mojom::FetchAPIRequestPtr request, blink::mojom::FetchAPIResponsePtr response, int64_t trace_id, ErrorCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!handle_.value()) { std::move(callback).Run( MakeErrorStorage(ErrorStorageType::kStorageHandleNull)); return; } handle_.value()->WriteToCache(cache_name, std::move(request), std::move(response), trace_id, std::move(callback)); } private: CacheStorageHandle handle_; SEQUENCE_CHECKER(sequence_checker_); }; CrossSequenceCacheStorage::CrossSequenceCacheStorage( const url::Origin& origin, CacheStorageOwner owner, scoped_refptr<base::SequencedTaskRunner> target_task_runner, scoped_refptr<CacheStorageContextWithManager> context) : CacheStorage(origin), target_task_runner_(std::move(target_task_runner)), inner_(target_task_runner_, origin, std::move(owner), std::move(context)) {} CacheStorageHandle CrossSequenceCacheStorage::CreateHandle() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return CacheStorageHandle(weak_factory_.GetWeakPtr()); } void CrossSequenceCacheStorage::AddHandleRef() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); handle_ref_count_ += 1; if (handle_ref_count_ == 1) self_ref_ = base::WrapRefCounted(this); } void CrossSequenceCacheStorage::DropHandleRef() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_GT(handle_ref_count_, 0); handle_ref_count_ -= 1; if (handle_ref_count_ == 0) self_ref_.reset(); } void CrossSequenceCacheStorage::Init() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); inner_.Post(FROM_HERE, &Inner::Init); } void CrossSequenceCacheStorage::OpenCache(const std::string& cache_name, int64_t trace_id, CacheAndErrorCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Create our cross-sequence cache wrapper object first. This will be sent // down to the target TaskRunner with our open request. It must already // exist in order for the open request to set the real handle on it on the // target TaskRunner. If an error occurs the wrapper object is thrown // away. auto cache_wrapper = base::MakeRefCounted<CrossSequenceCacheStorageCache>(target_task_runner_); // After the open request sets the real handle on the target TaskRunner our // cache wrapper will be passed back to this sequence. We then create a // handle to the wrapper and pass that to the external callback. auto adapter_callback = base::BindOnce( [](CacheAndErrorCallback inner_callback, scoped_refptr<CrossSequenceCacheStorageCache> cache_wrapper, blink::mojom::CacheStorageError error) { if (error != blink::mojom::CacheStorageError::kSuccess) { // Don't create a handle to the wrapper if there was an error. // The |cache_wrapper| will be destroyed when it goes out of scope. std::move(inner_callback).Run(CacheStorageCacheHandle(), error); return; } // Called on source TaskRunner (thanks to callback wrapping below). // Note, CreateHandle() will cause the cache to remain strongly // referenced and survive even though |cache_wrapper| goes out of // scope. std::move(inner_callback).Run(cache_wrapper->CreateHandle(), error); }, std::move(callback)); // We use our standard wrapping to ensure that we execute our adapter // callback on the correct current sequence. adapter_callback = WrapCallbackForCurrentSequence(std::move(adapter_callback)); // Passing |cache_wrapper| across sequence boundaries is safe because // we are guaranteed this is the only reference to the object. inner_.Post(FROM_HERE, &Inner::OpenCache, std::move(cache_wrapper), cache_name, trace_id, std::move(adapter_callback)); } void CrossSequenceCacheStorage::HasCache(const std::string& cache_name, int64_t trace_id, BoolAndErrorCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); inner_.Post(FROM_HERE, &Inner::HasCache, cache_name, trace_id, WrapCallbackForCurrentSequence(std::move(callback))); } void CrossSequenceCacheStorage::DoomCache(const std::string& cache_name, int64_t trace_id, ErrorCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); inner_.Post(FROM_HERE, &Inner::DoomCache, cache_name, trace_id, WrapCallbackForCurrentSequence(std::move(callback))); } void CrossSequenceCacheStorage::EnumerateCaches( int64_t trace_id, EnumerateCachesCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); inner_.Post(FROM_HERE, &Inner::EnumerateCaches, trace_id, WrapCallbackForCurrentSequence(std::move(callback))); } void CrossSequenceCacheStorage::MatchCache( const std::string& cache_name, blink::mojom::FetchAPIRequestPtr request, blink::mojom::CacheQueryOptionsPtr match_options, CacheStorageSchedulerPriority priority, int64_t trace_id, CacheStorageCache::ResponseCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); inner_.Post(FROM_HERE, &Inner::MatchCache, cache_name, std::move(request), std::move(match_options), priority, trace_id, WrapCallbackForCurrentSequence(std::move(callback))); } void CrossSequenceCacheStorage::MatchAllCaches( blink::mojom::FetchAPIRequestPtr request, blink::mojom::CacheQueryOptionsPtr match_options, CacheStorageSchedulerPriority priority, int64_t trace_id, CacheStorageCache::ResponseCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); inner_.Post(FROM_HERE, &Inner::MatchAllCaches, std::move(request), std::move(match_options), priority, trace_id, WrapCallbackForCurrentSequence(std::move(callback))); } void CrossSequenceCacheStorage::WriteToCache( const std::string& cache_name, blink::mojom::FetchAPIRequestPtr request, blink::mojom::FetchAPIResponsePtr response, int64_t trace_id, ErrorCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); inner_.Post(FROM_HERE, &Inner::WriteToCache, cache_name, std::move(request), std::move(response), trace_id, WrapCallbackForCurrentSequence(std::move(callback))); } CrossSequenceCacheStorage::~CrossSequenceCacheStorage() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } } // namespace content
{ "pile_set_name": "Github" }
/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang("language","nl",{button:"Taal instellen",remove:"Taal verwijderen"});
{ "pile_set_name": "Github" }
""" Objects for dealing with Laguerre series. This module provides a number of objects (mostly functions) useful for dealing with Laguerre series, including a `Laguerre` class that encapsulates the usual arithmetic operations. (General information on how this module represents and works with such polynomials is in the docstring for its "parent" sub-package, `numpy.polynomial`). Constants --------- - `lagdomain` -- Laguerre series default domain, [-1,1]. - `lagzero` -- Laguerre series that evaluates identically to 0. - `lagone` -- Laguerre series that evaluates identically to 1. - `lagx` -- Laguerre series for the identity map, ``f(x) = x``. Arithmetic ---------- - `lagmulx` -- multiply a Laguerre series in ``P_i(x)`` by ``x``. - `lagadd` -- add two Laguerre series. - `lagsub` -- subtract one Laguerre series from another. - `lagmul` -- multiply two Laguerre series. - `lagdiv` -- divide one Laguerre series by another. - `lagval` -- evaluate a Laguerre series at given points. - `lagval2d` -- evaluate a 2D Laguerre series at given points. - `lagval3d` -- evaluate a 3D Laguerre series at given points. - `laggrid2d` -- evaluate a 2D Laguerre series on a Cartesian product. - `laggrid3d` -- evaluate a 3D Laguerre series on a Cartesian product. Calculus -------- - `lagder` -- differentiate a Laguerre series. - `lagint` -- integrate a Laguerre series. Misc Functions -------------- - `lagfromroots` -- create a Laguerre series with specified roots. - `lagroots` -- find the roots of a Laguerre series. - `lagvander` -- Vandermonde-like matrix for Laguerre polynomials. - `lagvander2d` -- Vandermonde-like matrix for 2D power series. - `lagvander3d` -- Vandermonde-like matrix for 3D power series. - `laggauss` -- Gauss-Laguerre quadrature, points and weights. - `lagweight` -- Laguerre weight function. - `lagcompanion` -- symmetrized companion matrix in Laguerre form. - `lagfit` -- least-squares fit returning a Laguerre series. - `lagtrim` -- trim leading coefficients from a Laguerre series. - `lagline` -- Laguerre series of given straight line. - `lag2poly` -- convert a Laguerre series to a polynomial. - `poly2lag` -- convert a polynomial to a Laguerre series. Classes ------- - `Laguerre` -- A Laguerre series class. See also -------- `numpy.polynomial` """ from __future__ import division, absolute_import, print_function import warnings import numpy as np import numpy.linalg as la from numpy.core.multiarray import normalize_axis_index from . import polyutils as pu from ._polybase import ABCPolyBase __all__ = [ 'lagzero', 'lagone', 'lagx', 'lagdomain', 'lagline', 'lagadd', 'lagsub', 'lagmulx', 'lagmul', 'lagdiv', 'lagpow', 'lagval', 'lagder', 'lagint', 'lag2poly', 'poly2lag', 'lagfromroots', 'lagvander', 'lagfit', 'lagtrim', 'lagroots', 'Laguerre', 'lagval2d', 'lagval3d', 'laggrid2d', 'laggrid3d', 'lagvander2d', 'lagvander3d', 'lagcompanion', 'laggauss', 'lagweight'] lagtrim = pu.trimcoef def poly2lag(pol): """ poly2lag(pol) Convert a polynomial to a Laguerre series. Convert an array representing the coefficients of a polynomial (relative to the "standard" basis) ordered from lowest degree to highest, to an array of the coefficients of the equivalent Laguerre series, ordered from lowest to highest degree. Parameters ---------- pol : array_like 1-D array containing the polynomial coefficients Returns ------- c : ndarray 1-D array containing the coefficients of the equivalent Laguerre series. See Also -------- lag2poly Notes ----- The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples -------- >>> from numpy.polynomial.laguerre import poly2lag >>> poly2lag(np.arange(4)) array([ 23., -63., 58., -18.]) """ [pol] = pu.as_series([pol]) deg = len(pol) - 1 res = 0 for i in range(deg, -1, -1): res = lagadd(lagmulx(res), pol[i]) return res def lag2poly(c): """ Convert a Laguerre series to a polynomial. Convert an array representing the coefficients of a Laguerre series, ordered from lowest degree to highest, to an array of the coefficients of the equivalent polynomial (relative to the "standard" basis) ordered from lowest to highest degree. Parameters ---------- c : array_like 1-D array containing the Laguerre series coefficients, ordered from lowest order term to highest. Returns ------- pol : ndarray 1-D array containing the coefficients of the equivalent polynomial (relative to the "standard" basis) ordered from lowest order term to highest. See Also -------- poly2lag Notes ----- The easy way to do conversions between polynomial basis sets is to use the convert method of a class instance. Examples -------- >>> from numpy.polynomial.laguerre import lag2poly >>> lag2poly([ 23., -63., 58., -18.]) array([ 0., 1., 2., 3.]) """ from .polynomial import polyadd, polysub, polymulx [c] = pu.as_series([c]) n = len(c) if n == 1: return c else: c0 = c[-2] c1 = c[-1] # i is the current degree of c1 for i in range(n - 1, 1, -1): tmp = c0 c0 = polysub(c[i - 2], (c1*(i - 1))/i) c1 = polyadd(tmp, polysub((2*i - 1)*c1, polymulx(c1))/i) return polyadd(c0, polysub(c1, polymulx(c1))) # # These are constant arrays are of integer type so as to be compatible # with the widest range of other types, such as Decimal. # # Laguerre lagdomain = np.array([0, 1]) # Laguerre coefficients representing zero. lagzero = np.array([0]) # Laguerre coefficients representing one. lagone = np.array([1]) # Laguerre coefficients representing the identity x. lagx = np.array([1, -1]) def lagline(off, scl): """ Laguerre series whose graph is a straight line. Parameters ---------- off, scl : scalars The specified line is given by ``off + scl*x``. Returns ------- y : ndarray This module's representation of the Laguerre series for ``off + scl*x``. See Also -------- polyline, chebline Examples -------- >>> from numpy.polynomial.laguerre import lagline, lagval >>> lagval(0,lagline(3, 2)) 3.0 >>> lagval(1,lagline(3, 2)) 5.0 """ if scl != 0: return np.array([off + scl, -scl]) else: return np.array([off]) def lagfromroots(roots): """ Generate a Laguerre series with given roots. The function returns the coefficients of the polynomial .. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n), in Laguerre form, where the `r_n` are the roots specified in `roots`. If a zero has multiplicity n, then it must appear in `roots` n times. For instance, if 2 is a root of multiplicity three and 3 is a root of multiplicity 2, then `roots` looks something like [2, 2, 2, 3, 3]. The roots can appear in any order. If the returned coefficients are `c`, then .. math:: p(x) = c_0 + c_1 * L_1(x) + ... + c_n * L_n(x) The coefficient of the last term is not generally 1 for monic polynomials in Laguerre form. Parameters ---------- roots : array_like Sequence containing the roots. Returns ------- out : ndarray 1-D array of coefficients. If all roots are real then `out` is a real array, if some of the roots are complex, then `out` is complex even if all the coefficients in the result are real (see Examples below). See Also -------- polyfromroots, legfromroots, chebfromroots, hermfromroots, hermefromroots. Examples -------- >>> from numpy.polynomial.laguerre import lagfromroots, lagval >>> coef = lagfromroots((-1, 0, 1)) >>> lagval((-1, 0, 1), coef) array([ 0., 0., 0.]) >>> coef = lagfromroots((-1j, 1j)) >>> lagval((-1j, 1j), coef) array([ 0.+0.j, 0.+0.j]) """ if len(roots) == 0: return np.ones(1) else: [roots] = pu.as_series([roots], trim=False) roots.sort() p = [lagline(-r, 1) for r in roots] n = len(p) while n > 1: m, r = divmod(n, 2) tmp = [lagmul(p[i], p[i+m]) for i in range(m)] if r: tmp[0] = lagmul(tmp[0], p[-1]) p = tmp n = m return p[0] def lagadd(c1, c2): """ Add one Laguerre series to another. Returns the sum of two Laguerre series `c1` + `c2`. The arguments are sequences of coefficients ordered from lowest order term to highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array_like 1-D arrays of Laguerre series coefficients ordered from low to high. Returns ------- out : ndarray Array representing the Laguerre series of their sum. See Also -------- lagsub, lagmul, lagdiv, lagpow Notes ----- Unlike multiplication, division, etc., the sum of two Laguerre series is a Laguerre series (without having to "reproject" the result onto the basis set) so addition, just like that of "standard" polynomials, is simply "component-wise." Examples -------- >>> from numpy.polynomial.laguerre import lagadd >>> lagadd([1, 2, 3], [1, 2, 3, 4]) array([ 2., 4., 6., 4.]) """ # c1, c2 are trimmed copies [c1, c2] = pu.as_series([c1, c2]) if len(c1) > len(c2): c1[:c2.size] += c2 ret = c1 else: c2[:c1.size] += c1 ret = c2 return pu.trimseq(ret) def lagsub(c1, c2): """ Subtract one Laguerre series from another. Returns the difference of two Laguerre series `c1` - `c2`. The sequences of coefficients are from lowest order term to highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array_like 1-D arrays of Laguerre series coefficients ordered from low to high. Returns ------- out : ndarray Of Laguerre series coefficients representing their difference. See Also -------- lagadd, lagmul, lagdiv, lagpow Notes ----- Unlike multiplication, division, etc., the difference of two Laguerre series is a Laguerre series (without having to "reproject" the result onto the basis set) so subtraction, just like that of "standard" polynomials, is simply "component-wise." Examples -------- >>> from numpy.polynomial.laguerre import lagsub >>> lagsub([1, 2, 3, 4], [1, 2, 3]) array([ 0., 0., 0., 4.]) """ # c1, c2 are trimmed copies [c1, c2] = pu.as_series([c1, c2]) if len(c1) > len(c2): c1[:c2.size] -= c2 ret = c1 else: c2 = -c2 c2[:c1.size] += c1 ret = c2 return pu.trimseq(ret) def lagmulx(c): """Multiply a Laguerre series by x. Multiply the Laguerre series `c` by x, where x is the independent variable. Parameters ---------- c : array_like 1-D array of Laguerre series coefficients ordered from low to high. Returns ------- out : ndarray Array representing the result of the multiplication. Notes ----- The multiplication uses the recursion relationship for Laguerre polynomials in the form .. math:: xP_i(x) = (-(i + 1)*P_{i + 1}(x) + (2i + 1)P_{i}(x) - iP_{i - 1}(x)) Examples -------- >>> from numpy.polynomial.laguerre import lagmulx >>> lagmulx([1, 2, 3]) array([ -1., -1., 11., -9.]) """ # c is a trimmed copy [c] = pu.as_series([c]) # The zero series needs special treatment if len(c) == 1 and c[0] == 0: return c prd = np.empty(len(c) + 1, dtype=c.dtype) prd[0] = c[0] prd[1] = -c[0] for i in range(1, len(c)): prd[i + 1] = -c[i]*(i + 1) prd[i] += c[i]*(2*i + 1) prd[i - 1] -= c[i]*i return prd def lagmul(c1, c2): """ Multiply one Laguerre series by another. Returns the product of two Laguerre series `c1` * `c2`. The arguments are sequences of coefficients, from lowest order "term" to highest, e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array_like 1-D arrays of Laguerre series coefficients ordered from low to high. Returns ------- out : ndarray Of Laguerre series coefficients representing their product. See Also -------- lagadd, lagsub, lagdiv, lagpow Notes ----- In general, the (polynomial) product of two C-series results in terms that are not in the Laguerre polynomial basis set. Thus, to express the product as a Laguerre series, it is necessary to "reproject" the product onto said basis set, which may produce "unintuitive" (but correct) results; see Examples section below. Examples -------- >>> from numpy.polynomial.laguerre import lagmul >>> lagmul([1, 2, 3], [0, 1, 2]) array([ 8., -13., 38., -51., 36.]) """ # s1, s2 are trimmed copies [c1, c2] = pu.as_series([c1, c2]) if len(c1) > len(c2): c = c2 xs = c1 else: c = c1 xs = c2 if len(c) == 1: c0 = c[0]*xs c1 = 0 elif len(c) == 2: c0 = c[0]*xs c1 = c[1]*xs else: nd = len(c) c0 = c[-2]*xs c1 = c[-1]*xs for i in range(3, len(c) + 1): tmp = c0 nd = nd - 1 c0 = lagsub(c[-i]*xs, (c1*(nd - 1))/nd) c1 = lagadd(tmp, lagsub((2*nd - 1)*c1, lagmulx(c1))/nd) return lagadd(c0, lagsub(c1, lagmulx(c1))) def lagdiv(c1, c2): """ Divide one Laguerre series by another. Returns the quotient-with-remainder of two Laguerre series `c1` / `c2`. The arguments are sequences of coefficients from lowest order "term" to highest, e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``. Parameters ---------- c1, c2 : array_like 1-D arrays of Laguerre series coefficients ordered from low to high. Returns ------- [quo, rem] : ndarrays Of Laguerre series coefficients representing the quotient and remainder. See Also -------- lagadd, lagsub, lagmul, lagpow Notes ----- In general, the (polynomial) division of one Laguerre series by another results in quotient and remainder terms that are not in the Laguerre polynomial basis set. Thus, to express these results as a Laguerre series, it is necessary to "reproject" the results onto the Laguerre basis set, which may produce "unintuitive" (but correct) results; see Examples section below. Examples -------- >>> from numpy.polynomial.laguerre import lagdiv >>> lagdiv([ 8., -13., 38., -51., 36.], [0, 1, 2]) (array([ 1., 2., 3.]), array([ 0.])) >>> lagdiv([ 9., -12., 38., -51., 36.], [0, 1, 2]) (array([ 1., 2., 3.]), array([ 1., 1.])) """ # c1, c2 are trimmed copies [c1, c2] = pu.as_series([c1, c2]) if c2[-1] == 0: raise ZeroDivisionError() lc1 = len(c1) lc2 = len(c2) if lc1 < lc2: return c1[:1]*0, c1 elif lc2 == 1: return c1/c2[-1], c1[:1]*0 else: quo = np.empty(lc1 - lc2 + 1, dtype=c1.dtype) rem = c1 for i in range(lc1 - lc2, - 1, -1): p = lagmul([0]*i + [1], c2) q = rem[-1]/p[-1] rem = rem[:-1] - q*p[:-1] quo[i] = q return quo, pu.trimseq(rem) def lagpow(c, pow, maxpower=16): """Raise a Laguerre series to a power. Returns the Laguerre series `c` raised to the power `pow`. The argument `c` is a sequence of coefficients ordered from low to high. i.e., [1,2,3] is the series ``P_0 + 2*P_1 + 3*P_2.`` Parameters ---------- c : array_like 1-D array of Laguerre series coefficients ordered from low to high. pow : integer Power to which the series will be raised maxpower : integer, optional Maximum power allowed. This is mainly to limit growth of the series to unmanageable size. Default is 16 Returns ------- coef : ndarray Laguerre series of power. See Also -------- lagadd, lagsub, lagmul, lagdiv Examples -------- >>> from numpy.polynomial.laguerre import lagpow >>> lagpow([1, 2, 3], 2) array([ 14., -16., 56., -72., 54.]) """ # c is a trimmed copy [c] = pu.as_series([c]) power = int(pow) if power != pow or power < 0: raise ValueError("Power must be a non-negative integer.") elif maxpower is not None and power > maxpower: raise ValueError("Power is too large") elif power == 0: return np.array([1], dtype=c.dtype) elif power == 1: return c else: # This can be made more efficient by using powers of two # in the usual way. prd = c for i in range(2, power + 1): prd = lagmul(prd, c) return prd def lagder(c, m=1, scl=1, axis=0): """ Differentiate a Laguerre series. Returns the Laguerre series coefficients `c` differentiated `m` times along `axis`. At each iteration the result is multiplied by `scl` (the scaling factor is for use in a linear change of variable). The argument `c` is an array of coefficients from low to high degree along each axis, e.g., [1,2,3] represents the series ``1*L_0 + 2*L_1 + 3*L_2`` while [[1,2],[1,2]] represents ``1*L_0(x)*L_0(y) + 1*L_1(x)*L_0(y) + 2*L_0(x)*L_1(y) + 2*L_1(x)*L_1(y)`` if axis=0 is ``x`` and axis=1 is ``y``. Parameters ---------- c : array_like Array of Laguerre series coefficients. If `c` is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index. m : int, optional Number of derivatives taken, must be non-negative. (Default: 1) scl : scalar, optional Each differentiation is multiplied by `scl`. The end result is multiplication by ``scl**m``. This is for use in a linear change of variable. (Default: 1) axis : int, optional Axis over which the derivative is taken. (Default: 0). .. versionadded:: 1.7.0 Returns ------- der : ndarray Laguerre series of the derivative. See Also -------- lagint Notes ----- In general, the result of differentiating a Laguerre series does not resemble the same operation on a power series. Thus the result of this function may be "unintuitive," albeit correct; see Examples section below. Examples -------- >>> from numpy.polynomial.laguerre import lagder >>> lagder([ 1., 1., 1., -3.]) array([ 1., 2., 3.]) >>> lagder([ 1., 0., 0., -4., 3.], m=2) array([ 1., 2., 3.]) """ c = np.array(c, ndmin=1, copy=1) if c.dtype.char in '?bBhHiIlLqQpP': c = c.astype(np.double) cnt, iaxis = [int(t) for t in [m, axis]] if cnt != m: raise ValueError("The order of derivation must be integer") if cnt < 0: raise ValueError("The order of derivation must be non-negative") if iaxis != axis: raise ValueError("The axis must be integer") iaxis = normalize_axis_index(iaxis, c.ndim) if cnt == 0: return c c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 else: for i in range(cnt): n = n - 1 c *= scl der = np.empty((n,) + c.shape[1:], dtype=c.dtype) for j in range(n, 1, -1): der[j - 1] = -c[j] c[j - 1] += c[j] der[0] = -c[1] c = der c = np.moveaxis(c, 0, iaxis) return c def lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0): """ Integrate a Laguerre series. Returns the Laguerre series coefficients `c` integrated `m` times from `lbnd` along `axis`. At each iteration the resulting series is **multiplied** by `scl` and an integration constant, `k`, is added. The scaling factor is for use in a linear change of variable. ("Buyer beware": note that, depending on what one is doing, one may want `scl` to be the reciprocal of what one might expect; for more information, see the Notes section below.) The argument `c` is an array of coefficients from low to high degree along each axis, e.g., [1,2,3] represents the series ``L_0 + 2*L_1 + 3*L_2`` while [[1,2],[1,2]] represents ``1*L_0(x)*L_0(y) + 1*L_1(x)*L_0(y) + 2*L_0(x)*L_1(y) + 2*L_1(x)*L_1(y)`` if axis=0 is ``x`` and axis=1 is ``y``. Parameters ---------- c : array_like Array of Laguerre series coefficients. If `c` is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index. m : int, optional Order of integration, must be positive. (Default: 1) k : {[], list, scalar}, optional Integration constant(s). The value of the first integral at ``lbnd`` is the first value in the list, the value of the second integral at ``lbnd`` is the second value, etc. If ``k == []`` (the default), all constants are set to zero. If ``m == 1``, a single scalar can be given instead of a list. lbnd : scalar, optional The lower bound of the integral. (Default: 0) scl : scalar, optional Following each integration the result is *multiplied* by `scl` before the integration constant is added. (Default: 1) axis : int, optional Axis over which the integral is taken. (Default: 0). .. versionadded:: 1.7.0 Returns ------- S : ndarray Laguerre series coefficients of the integral. Raises ------ ValueError If ``m < 0``, ``len(k) > m``, ``np.ndim(lbnd) != 0``, or ``np.ndim(scl) != 0``. See Also -------- lagder Notes ----- Note that the result of each integration is *multiplied* by `scl`. Why is this important to note? Say one is making a linear change of variable :math:`u = ax + b` in an integral relative to `x`. Then :math:`dx = du/a`, so one will need to set `scl` equal to :math:`1/a` - perhaps not what one would have first thought. Also note that, in general, the result of integrating a C-series needs to be "reprojected" onto the C-series basis set. Thus, typically, the result of this function is "unintuitive," albeit correct; see Examples section below. Examples -------- >>> from numpy.polynomial.laguerre import lagint >>> lagint([1,2,3]) array([ 1., 1., 1., -3.]) >>> lagint([1,2,3], m=2) array([ 1., 0., 0., -4., 3.]) >>> lagint([1,2,3], k=1) array([ 2., 1., 1., -3.]) >>> lagint([1,2,3], lbnd=-1) array([ 11.5, 1. , 1. , -3. ]) >>> lagint([1,2], m=2, k=[1,2], lbnd=-1) array([ 11.16666667, -5. , -3. , 2. ]) """ c = np.array(c, ndmin=1, copy=1) if c.dtype.char in '?bBhHiIlLqQpP': c = c.astype(np.double) if not np.iterable(k): k = [k] cnt, iaxis = [int(t) for t in [m, axis]] if cnt != m: raise ValueError("The order of integration must be integer") if cnt < 0: raise ValueError("The order of integration must be non-negative") if len(k) > cnt: raise ValueError("Too many integration constants") if np.ndim(lbnd) != 0: raise ValueError("lbnd must be a scalar.") if np.ndim(scl) != 0: raise ValueError("scl must be a scalar.") if iaxis != axis: raise ValueError("The axis must be integer") iaxis = normalize_axis_index(iaxis, c.ndim) if cnt == 0: return c c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) c *= scl if n == 1 and np.all(c[0] == 0): c[0] += k[i] else: tmp = np.empty((n + 1,) + c.shape[1:], dtype=c.dtype) tmp[0] = c[0] tmp[1] = -c[0] for j in range(1, n): tmp[j] += c[j] tmp[j + 1] = -c[j] tmp[0] += k[i] - lagval(lbnd, tmp) c = tmp c = np.moveaxis(c, 0, iaxis) return c def lagval(x, c, tensor=True): """ Evaluate a Laguerre series at points x. If `c` is of length `n + 1`, this function returns the value: .. math:: p(x) = c_0 * L_0(x) + c_1 * L_1(x) + ... + c_n * L_n(x) The parameter `x` is converted to an array only if it is a tuple or a list, otherwise it is treated as a scalar. In either case, either `x` or its elements must support multiplication and addition both with themselves and with the elements of `c`. If `c` is a 1-D array, then `p(x)` will have the same shape as `x`. If `c` is multidimensional, then the shape of the result depends on the value of `tensor`. If `tensor` is true the shape will be c.shape[1:] + x.shape. If `tensor` is false the shape will be c.shape[1:]. Note that scalars have shape (,). Trailing zeros in the coefficients will be used in the evaluation, so they should be avoided if efficiency is a concern. Parameters ---------- x : array_like, compatible object If `x` is a list or tuple, it is converted to an ndarray, otherwise it is left unchanged and treated as a scalar. In either case, `x` or its elements must support addition and multiplication with with themselves and with the elements of `c`. c : array_like Array of coefficients ordered so that the coefficients for terms of degree n are contained in c[n]. If `c` is multidimensional the remaining indices enumerate multiple polynomials. In the two dimensional case the coefficients may be thought of as stored in the columns of `c`. tensor : boolean, optional If True, the shape of the coefficient array is extended with ones on the right, one for each dimension of `x`. Scalars have dimension 0 for this action. The result is that every column of coefficients in `c` is evaluated for every element of `x`. If False, `x` is broadcast over the columns of `c` for the evaluation. This keyword is useful when `c` is multidimensional. The default value is True. .. versionadded:: 1.7.0 Returns ------- values : ndarray, algebra_like The shape of the return value is described above. See Also -------- lagval2d, laggrid2d, lagval3d, laggrid3d Notes ----- The evaluation uses Clenshaw recursion, aka synthetic division. Examples -------- >>> from numpy.polynomial.laguerre import lagval >>> coef = [1,2,3] >>> lagval(1, coef) -0.5 >>> lagval([[1,2],[3,4]], coef) array([[-0.5, -4. ], [-4.5, -2. ]]) """ c = np.array(c, ndmin=1, copy=0) if c.dtype.char in '?bBhHiIlLqQpP': c = c.astype(np.double) if isinstance(x, (tuple, list)): x = np.asarray(x) if isinstance(x, np.ndarray) and tensor: c = c.reshape(c.shape + (1,)*x.ndim) if len(c) == 1: c0 = c[0] c1 = 0 elif len(c) == 2: c0 = c[0] c1 = c[1] else: nd = len(c) c0 = c[-2] c1 = c[-1] for i in range(3, len(c) + 1): tmp = c0 nd = nd - 1 c0 = c[-i] - (c1*(nd - 1))/nd c1 = tmp + (c1*((2*nd - 1) - x))/nd return c0 + c1*(1 - x) def lagval2d(x, y, c): """ Evaluate a 2-D Laguerre series at points (x, y). This function returns the values: .. math:: p(x,y) = \\sum_{i,j} c_{i,j} * L_i(x) * L_j(y) The parameters `x` and `y` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the same shape after conversion. In either case, either `x` and `y` or their elements must support multiplication and addition both with themselves and with the elements of `c`. If `c` is a 1-D array a one is implicitly appended to its shape to make it 2-D. The shape of the result will be c.shape[2:] + x.shape. Parameters ---------- x, y : array_like, compatible objects The two dimensional series is evaluated at the points `(x, y)`, where `x` and `y` must have the same shape. If `x` or `y` is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and if it isn't an ndarray it is treated as a scalar. c : array_like Array of coefficients ordered so that the coefficient of the term of multi-degree i,j is contained in ``c[i,j]``. If `c` has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns ------- values : ndarray, compatible object The values of the two dimensional polynomial at points formed with pairs of corresponding values from `x` and `y`. See Also -------- lagval, laggrid2d, lagval3d, laggrid3d Notes ----- .. versionadded:: 1.7.0 """ try: x, y = np.array((x, y), copy=0) except Exception: raise ValueError('x, y are incompatible') c = lagval(x, c) c = lagval(y, c, tensor=False) return c def laggrid2d(x, y, c): """ Evaluate a 2-D Laguerre series on the Cartesian product of x and y. This function returns the values: .. math:: p(a,b) = \\sum_{i,j} c_{i,j} * L_i(a) * L_j(b) where the points `(a, b)` consist of all pairs formed by taking `a` from `x` and `b` from `y`. The resulting points form a grid with `x` in the first dimension and `y` in the second. The parameters `x` and `y` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars. In either case, either `x` and `y` or their elements must support multiplication and addition both with themselves and with the elements of `c`. If `c` has fewer than two dimensions, ones are implicitly appended to its shape to make it 2-D. The shape of the result will be c.shape[2:] + x.shape + y.shape. Parameters ---------- x, y : array_like, compatible objects The two dimensional series is evaluated at the points in the Cartesian product of `x` and `y`. If `x` or `y` is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn't an ndarray, it is treated as a scalar. c : array_like Array of coefficients ordered so that the coefficient of the term of multi-degree i,j is contained in `c[i,j]`. If `c` has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns ------- values : ndarray, compatible object The values of the two dimensional Chebyshev series at points in the Cartesian product of `x` and `y`. See Also -------- lagval, lagval2d, lagval3d, laggrid3d Notes ----- .. versionadded:: 1.7.0 """ c = lagval(x, c) c = lagval(y, c) return c def lagval3d(x, y, z, c): """ Evaluate a 3-D Laguerre series at points (x, y, z). This function returns the values: .. math:: p(x,y,z) = \\sum_{i,j,k} c_{i,j,k} * L_i(x) * L_j(y) * L_k(z) The parameters `x`, `y`, and `z` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the same shape after conversion. In either case, either `x`, `y`, and `z` or their elements must support multiplication and addition both with themselves and with the elements of `c`. If `c` has fewer than 3 dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape. Parameters ---------- x, y, z : array_like, compatible object The three dimensional series is evaluated at the points `(x, y, z)`, where `x`, `y`, and `z` must have the same shape. If any of `x`, `y`, or `z` is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and if it isn't an ndarray it is treated as a scalar. c : array_like Array of coefficients ordered so that the coefficient of the term of multi-degree i,j,k is contained in ``c[i,j,k]``. If `c` has dimension greater than 3 the remaining indices enumerate multiple sets of coefficients. Returns ------- values : ndarray, compatible object The values of the multidimension polynomial on points formed with triples of corresponding values from `x`, `y`, and `z`. See Also -------- lagval, lagval2d, laggrid2d, laggrid3d Notes ----- .. versionadded:: 1.7.0 """ try: x, y, z = np.array((x, y, z), copy=0) except Exception: raise ValueError('x, y, z are incompatible') c = lagval(x, c) c = lagval(y, c, tensor=False) c = lagval(z, c, tensor=False) return c def laggrid3d(x, y, z, c): """ Evaluate a 3-D Laguerre series on the Cartesian product of x, y, and z. This function returns the values: .. math:: p(a,b,c) = \\sum_{i,j,k} c_{i,j,k} * L_i(a) * L_j(b) * L_k(c) where the points `(a, b, c)` consist of all triples formed by taking `a` from `x`, `b` from `y`, and `c` from `z`. The resulting points form a grid with `x` in the first dimension, `y` in the second, and `z` in the third. The parameters `x`, `y`, and `z` are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars. In either case, either `x`, `y`, and `z` or their elements must support multiplication and addition both with themselves and with the elements of `c`. If `c` has fewer than three dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape + y.shape + z.shape. Parameters ---------- x, y, z : array_like, compatible objects The three dimensional series is evaluated at the points in the Cartesian product of `x`, `y`, and `z`. If `x`,`y`, or `z` is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn't an ndarray, it is treated as a scalar. c : array_like Array of coefficients ordered so that the coefficients for terms of degree i,j are contained in ``c[i,j]``. If `c` has dimension greater than two the remaining indices enumerate multiple sets of coefficients. Returns ------- values : ndarray, compatible object The values of the two dimensional polynomial at points in the Cartesian product of `x` and `y`. See Also -------- lagval, lagval2d, laggrid2d, lagval3d Notes ----- .. versionadded:: 1.7.0 """ c = lagval(x, c) c = lagval(y, c) c = lagval(z, c) return c def lagvander(x, deg): """Pseudo-Vandermonde matrix of given degree. Returns the pseudo-Vandermonde matrix of degree `deg` and sample points `x`. The pseudo-Vandermonde matrix is defined by .. math:: V[..., i] = L_i(x) where `0 <= i <= deg`. The leading indices of `V` index the elements of `x` and the last index is the degree of the Laguerre polynomial. If `c` is a 1-D array of coefficients of length `n + 1` and `V` is the array ``V = lagvander(x, n)``, then ``np.dot(V, c)`` and ``lagval(x, c)`` are the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of Laguerre series of the same degree and sample points. Parameters ---------- x : array_like Array of points. The dtype is converted to float64 or complex128 depending on whether any of the elements are complex. If `x` is scalar it is converted to a 1-D array. deg : int Degree of the resulting matrix. Returns ------- vander : ndarray The pseudo-Vandermonde matrix. The shape of the returned matrix is ``x.shape + (deg + 1,)``, where The last index is the degree of the corresponding Laguerre polynomial. The dtype will be the same as the converted `x`. Examples -------- >>> from numpy.polynomial.laguerre import lagvander >>> x = np.array([0, 1, 2]) >>> lagvander(x, 3) array([[ 1. , 1. , 1. , 1. ], [ 1. , 0. , -0.5 , -0.66666667], [ 1. , -1. , -1. , -0.33333333]]) """ ideg = int(deg) if ideg != deg: raise ValueError("deg must be integer") if ideg < 0: raise ValueError("deg must be non-negative") x = np.array(x, copy=0, ndmin=1) + 0.0 dims = (ideg + 1,) + x.shape dtyp = x.dtype v = np.empty(dims, dtype=dtyp) v[0] = x*0 + 1 if ideg > 0: v[1] = 1 - x for i in range(2, ideg + 1): v[i] = (v[i-1]*(2*i - 1 - x) - v[i-2]*(i - 1))/i return np.moveaxis(v, 0, -1) def lagvander2d(x, y, deg): """Pseudo-Vandermonde matrix of given degrees. Returns the pseudo-Vandermonde matrix of degrees `deg` and sample points `(x, y)`. The pseudo-Vandermonde matrix is defined by .. math:: V[..., (deg[1] + 1)*i + j] = L_i(x) * L_j(y), where `0 <= i <= deg[0]` and `0 <= j <= deg[1]`. The leading indices of `V` index the points `(x, y)` and the last index encodes the degrees of the Laguerre polynomials. If ``V = lagvander2d(x, y, [xdeg, ydeg])``, then the columns of `V` correspond to the elements of a 2-D coefficient array `c` of shape (xdeg + 1, ydeg + 1) in the order .. math:: c_{00}, c_{01}, c_{02} ... , c_{10}, c_{11}, c_{12} ... and ``np.dot(V, c.flat)`` and ``lagval2d(x, y, c)`` will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 2-D Laguerre series of the same degrees and sample points. Parameters ---------- x, y : array_like Arrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays. deg : list of ints List of maximum degrees of the form [x_deg, y_deg]. Returns ------- vander2d : ndarray The shape of the returned matrix is ``x.shape + (order,)``, where :math:`order = (deg[0]+1)*(deg([1]+1)`. The dtype will be the same as the converted `x` and `y`. See Also -------- lagvander, lagvander3d. lagval2d, lagval3d Notes ----- .. versionadded:: 1.7.0 """ ideg = [int(d) for d in deg] is_valid = [id == d and id >= 0 for id, d in zip(ideg, deg)] if is_valid != [1, 1]: raise ValueError("degrees must be non-negative integers") degx, degy = ideg x, y = np.array((x, y), copy=0) + 0.0 vx = lagvander(x, degx) vy = lagvander(y, degy) v = vx[..., None]*vy[..., None,:] return v.reshape(v.shape[:-2] + (-1,)) def lagvander3d(x, y, z, deg): """Pseudo-Vandermonde matrix of given degrees. Returns the pseudo-Vandermonde matrix of degrees `deg` and sample points `(x, y, z)`. If `l, m, n` are the given degrees in `x, y, z`, then The pseudo-Vandermonde matrix is defined by .. math:: V[..., (m+1)(n+1)i + (n+1)j + k] = L_i(x)*L_j(y)*L_k(z), where `0 <= i <= l`, `0 <= j <= m`, and `0 <= j <= n`. The leading indices of `V` index the points `(x, y, z)` and the last index encodes the degrees of the Laguerre polynomials. If ``V = lagvander3d(x, y, z, [xdeg, ydeg, zdeg])``, then the columns of `V` correspond to the elements of a 3-D coefficient array `c` of shape (xdeg + 1, ydeg + 1, zdeg + 1) in the order .. math:: c_{000}, c_{001}, c_{002},... , c_{010}, c_{011}, c_{012},... and ``np.dot(V, c.flat)`` and ``lagval3d(x, y, z, c)`` will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 3-D Laguerre series of the same degrees and sample points. Parameters ---------- x, y, z : array_like Arrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays. deg : list of ints List of maximum degrees of the form [x_deg, y_deg, z_deg]. Returns ------- vander3d : ndarray The shape of the returned matrix is ``x.shape + (order,)``, where :math:`order = (deg[0]+1)*(deg([1]+1)*(deg[2]+1)`. The dtype will be the same as the converted `x`, `y`, and `z`. See Also -------- lagvander, lagvander3d. lagval2d, lagval3d Notes ----- .. versionadded:: 1.7.0 """ ideg = [int(d) for d in deg] is_valid = [id == d and id >= 0 for id, d in zip(ideg, deg)] if is_valid != [1, 1, 1]: raise ValueError("degrees must be non-negative integers") degx, degy, degz = ideg x, y, z = np.array((x, y, z), copy=0) + 0.0 vx = lagvander(x, degx) vy = lagvander(y, degy) vz = lagvander(z, degz) v = vx[..., None, None]*vy[..., None,:, None]*vz[..., None, None,:] return v.reshape(v.shape[:-3] + (-1,)) def lagfit(x, y, deg, rcond=None, full=False, w=None): """ Least squares fit of Laguerre series to data. Return the coefficients of a Laguerre series of degree `deg` that is the least squares fit to the data values `y` given at points `x`. If `y` is 1-D the returned coefficients will also be 1-D. If `y` is 2-D multiple fits are done, one for each column of `y`, and the resulting coefficients are stored in the corresponding columns of a 2-D return. The fitted polynomial(s) are in the form .. math:: p(x) = c_0 + c_1 * L_1(x) + ... + c_n * L_n(x), where `n` is `deg`. Parameters ---------- x : array_like, shape (M,) x-coordinates of the M sample points ``(x[i], y[i])``. y : array_like, shape (M,) or (M, K) y-coordinates of the sample points. Several data sets of sample points sharing the same x-coordinates can be fitted at once by passing in a 2D-array that contains one dataset per column. deg : int or 1-D array_like Degree(s) of the fitting polynomials. If `deg` is a single integer all terms up to and including the `deg`'th term are included in the fit. For NumPy versions >= 1.11.0 a list of integers specifying the degrees of the terms to include may be used instead. rcond : float, optional Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be ignored. The default value is len(x)*eps, where eps is the relative precision of the float type, about 2e-16 in most cases. full : bool, optional Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned. w : array_like, shape (`M`,), optional Weights. If not None, the contribution of each point ``(x[i],y[i])`` to the fit is weighted by `w[i]`. Ideally the weights are chosen so that the errors of the products ``w[i]*y[i]`` all have the same variance. The default value is None. Returns ------- coef : ndarray, shape (M,) or (M, K) Laguerre coefficients ordered from low to high. If `y` was 2-D, the coefficients for the data in column k of `y` are in column `k`. [residuals, rank, singular_values, rcond] : list These values are only returned if `full` = True resid -- sum of squared residuals of the least squares fit rank -- the numerical rank of the scaled Vandermonde matrix sv -- singular values of the scaled Vandermonde matrix rcond -- value of `rcond`. For more details, see `linalg.lstsq`. Warns ----- RankWarning The rank of the coefficient matrix in the least-squares fit is deficient. The warning is only raised if `full` = False. The warnings can be turned off by >>> import warnings >>> warnings.simplefilter('ignore', RankWarning) See Also -------- chebfit, legfit, polyfit, hermfit, hermefit lagval : Evaluates a Laguerre series. lagvander : pseudo Vandermonde matrix of Laguerre series. lagweight : Laguerre weight function. linalg.lstsq : Computes a least-squares fit from the matrix. scipy.interpolate.UnivariateSpline : Computes spline fits. Notes ----- The solution is the coefficients of the Laguerre series `p` that minimizes the sum of the weighted squared errors .. math:: E = \\sum_j w_j^2 * |y_j - p(x_j)|^2, where the :math:`w_j` are the weights. This problem is solved by setting up as the (typically) overdetermined matrix equation .. math:: V(x) * c = w * y, where `V` is the weighted pseudo Vandermonde matrix of `x`, `c` are the coefficients to be solved for, `w` are the weights, and `y` are the observed values. This equation is then solved using the singular value decomposition of `V`. If some of the singular values of `V` are so small that they are neglected, then a `RankWarning` will be issued. This means that the coefficient values may be poorly determined. Using a lower order fit will usually get rid of the warning. The `rcond` parameter can also be set to a value smaller than its default, but the resulting fit may be spurious and have large contributions from roundoff error. Fits using Laguerre series are probably most useful when the data can be approximated by ``sqrt(w(x)) * p(x)``, where `w(x)` is the Laguerre weight. In that case the weight ``sqrt(w(x[i])`` should be used together with data values ``y[i]/sqrt(w(x[i])``. The weight function is available as `lagweight`. References ---------- .. [1] Wikipedia, "Curve fitting", http://en.wikipedia.org/wiki/Curve_fitting Examples -------- >>> from numpy.polynomial.laguerre import lagfit, lagval >>> x = np.linspace(0, 10) >>> err = np.random.randn(len(x))/10 >>> y = lagval(x, [1, 2, 3]) + err >>> lagfit(x, y, 2) array([ 0.96971004, 2.00193749, 3.00288744]) """ x = np.asarray(x) + 0.0 y = np.asarray(y) + 0.0 deg = np.asarray(deg) # check arguments. if deg.ndim > 1 or deg.dtype.kind not in 'iu' or deg.size == 0: raise TypeError("deg must be an int or non-empty 1-D array of int") if deg.min() < 0: raise ValueError("expected deg >= 0") if x.ndim != 1: raise TypeError("expected 1D vector for x") if x.size == 0: raise TypeError("expected non-empty vector for x") if y.ndim < 1 or y.ndim > 2: raise TypeError("expected 1D or 2D array for y") if len(x) != len(y): raise TypeError("expected x and y to have same length") if deg.ndim == 0: lmax = deg order = lmax + 1 van = lagvander(x, lmax) else: deg = np.sort(deg) lmax = deg[-1] order = len(deg) van = lagvander(x, lmax)[:, deg] # set up the least squares matrices in transposed form lhs = van.T rhs = y.T if w is not None: w = np.asarray(w) + 0.0 if w.ndim != 1: raise TypeError("expected 1D vector for w") if len(x) != len(w): raise TypeError("expected x and w to have same length") # apply weights. Don't use inplace operations as they # can cause problems with NA. lhs = lhs * w rhs = rhs * w # set rcond if rcond is None: rcond = len(x)*np.finfo(x.dtype).eps # Determine the norms of the design matrix columns. if issubclass(lhs.dtype.type, np.complexfloating): scl = np.sqrt((np.square(lhs.real) + np.square(lhs.imag)).sum(1)) else: scl = np.sqrt(np.square(lhs).sum(1)) scl[scl == 0] = 1 # Solve the least squares problem. c, resids, rank, s = la.lstsq(lhs.T/scl, rhs.T, rcond) c = (c.T/scl).T # Expand c to include non-fitted coefficients which are set to zero if deg.ndim > 0: if c.ndim == 2: cc = np.zeros((lmax+1, c.shape[1]), dtype=c.dtype) else: cc = np.zeros(lmax+1, dtype=c.dtype) cc[deg] = c c = cc # warn on rank reduction if rank != order and not full: msg = "The fit may be poorly conditioned" warnings.warn(msg, pu.RankWarning, stacklevel=2) if full: return c, [resids, rank, s, rcond] else: return c def lagcompanion(c): """ Return the companion matrix of c. The usual companion matrix of the Laguerre polynomials is already symmetric when `c` is a basis Laguerre polynomial, so no scaling is applied. Parameters ---------- c : array_like 1-D array of Laguerre series coefficients ordered from low to high degree. Returns ------- mat : ndarray Companion matrix of dimensions (deg, deg). Notes ----- .. versionadded:: 1.7.0 """ # c is a trimmed copy [c] = pu.as_series([c]) if len(c) < 2: raise ValueError('Series must have maximum degree of at least 1.') if len(c) == 2: return np.array([[1 + c[0]/c[1]]]) n = len(c) - 1 mat = np.zeros((n, n), dtype=c.dtype) top = mat.reshape(-1)[1::n+1] mid = mat.reshape(-1)[0::n+1] bot = mat.reshape(-1)[n::n+1] top[...] = -np.arange(1, n) mid[...] = 2.*np.arange(n) + 1. bot[...] = top mat[:, -1] += (c[:-1]/c[-1])*n return mat def lagroots(c): """ Compute the roots of a Laguerre series. Return the roots (a.k.a. "zeros") of the polynomial .. math:: p(x) = \\sum_i c[i] * L_i(x). Parameters ---------- c : 1-D array_like 1-D array of coefficients. Returns ------- out : ndarray Array of the roots of the series. If all the roots are real, then `out` is also real, otherwise it is complex. See Also -------- polyroots, legroots, chebroots, hermroots, hermeroots Notes ----- The root estimates are obtained as the eigenvalues of the companion matrix, Roots far from the origin of the complex plane may have large errors due to the numerical instability of the series for such values. Roots with multiplicity greater than 1 will also show larger errors as the value of the series near such points is relatively insensitive to errors in the roots. Isolated roots near the origin can be improved by a few iterations of Newton's method. The Laguerre series basis polynomials aren't powers of `x` so the results of this function may seem unintuitive. Examples -------- >>> from numpy.polynomial.laguerre import lagroots, lagfromroots >>> coef = lagfromroots([0, 1, 2]) >>> coef array([ 2., -8., 12., -6.]) >>> lagroots(coef) array([ -4.44089210e-16, 1.00000000e+00, 2.00000000e+00]) """ # c is a trimmed copy [c] = pu.as_series([c]) if len(c) <= 1: return np.array([], dtype=c.dtype) if len(c) == 2: return np.array([1 + c[0]/c[1]]) m = lagcompanion(c) r = la.eigvals(m) r.sort() return r def laggauss(deg): """ Gauss-Laguerre quadrature. Computes the sample points and weights for Gauss-Laguerre quadrature. These sample points and weights will correctly integrate polynomials of degree :math:`2*deg - 1` or less over the interval :math:`[0, \\inf]` with the weight function :math:`f(x) = \\exp(-x)`. Parameters ---------- deg : int Number of sample points and weights. It must be >= 1. Returns ------- x : ndarray 1-D ndarray containing the sample points. y : ndarray 1-D ndarray containing the weights. Notes ----- .. versionadded:: 1.7.0 The results have only been tested up to degree 100 higher degrees may be problematic. The weights are determined by using the fact that .. math:: w_k = c / (L'_n(x_k) * L_{n-1}(x_k)) where :math:`c` is a constant independent of :math:`k` and :math:`x_k` is the k'th root of :math:`L_n`, and then scaling the results to get the right value when integrating 1. """ ideg = int(deg) if ideg != deg or ideg < 1: raise ValueError("deg must be a non-negative integer") # first approximation of roots. We use the fact that the companion # matrix is symmetric in this case in order to obtain better zeros. c = np.array([0]*deg + [1]) m = lagcompanion(c) x = la.eigvalsh(m) # improve roots by one application of Newton dy = lagval(x, c) df = lagval(x, lagder(c)) x -= dy/df # compute the weights. We scale the factor to avoid possible numerical # overflow. fm = lagval(x, c[1:]) fm /= np.abs(fm).max() df /= np.abs(df).max() w = 1/(fm * df) # scale w to get the right value, 1 in this case w /= w.sum() return x, w def lagweight(x): """Weight function of the Laguerre polynomials. The weight function is :math:`exp(-x)` and the interval of integration is :math:`[0, \\inf]`. The Laguerre polynomials are orthogonal, but not normalized, with respect to this weight function. Parameters ---------- x : array_like Values at which the weight function will be computed. Returns ------- w : ndarray The weight function at `x`. Notes ----- .. versionadded:: 1.7.0 """ w = np.exp(-x) return w # # Laguerre series class # class Laguerre(ABCPolyBase): """A Laguerre series class. The Laguerre class provides the standard Python numerical methods '+', '-', '*', '//', '%', 'divmod', '**', and '()' as well as the attributes and methods listed in the `ABCPolyBase` documentation. Parameters ---------- coef : array_like Laguerre coefficients in order of increasing degree, i.e, ``(1, 2, 3)`` gives ``1*L_0(x) + 2*L_1(X) + 3*L_2(x)``. domain : (2,) array_like, optional Domain to use. The interval ``[domain[0], domain[1]]`` is mapped to the interval ``[window[0], window[1]]`` by shifting and scaling. The default value is [0, 1]. window : (2,) array_like, optional Window, see `domain` for its use. The default value is [0, 1]. .. versionadded:: 1.6.0 """ # Virtual Functions _add = staticmethod(lagadd) _sub = staticmethod(lagsub) _mul = staticmethod(lagmul) _div = staticmethod(lagdiv) _pow = staticmethod(lagpow) _val = staticmethod(lagval) _int = staticmethod(lagint) _der = staticmethod(lagder) _fit = staticmethod(lagfit) _line = staticmethod(lagline) _roots = staticmethod(lagroots) _fromroots = staticmethod(lagfromroots) # Virtual properties nickname = 'lag' domain = np.array(lagdomain) window = np.array(lagdomain)
{ "pile_set_name": "Github" }
# ##### BEGIN GPL LICENSE BLOCK ##### # # 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. # # ##### END GPL LICENSE BLOCK ##### bl_info = { "name": "Render Settings", "author": "meta-androcto, Saidenka", "version": (0, 1, 1), "blender": (2, 80, 0), "location": "Render Menu, UV Editor Render Tab", "description": "Render Settings BI & Cycles", "warning": "", "wiki_url": "https://github.com/meta-androcto/blenderpython/wiki/AF_Render_Settings", "tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/", "category": "Render" } import bpy import sys import subprocess class RenderBackground(bpy.types.Operator): bl_idname = "render.render_background" bl_label = "Background Render" bl_description = "Render From The Commandline" bl_options = {'REGISTER'} is_quit: bpy.props.BoolProperty(name="Quit Blender", default=True) items = [ ('IMAGE', "Image", "", 1), ('ANIME', "Animation", "", 2), ] mode: bpy.props.EnumProperty(items=items, name="Mode", default='IMAGE') thread: bpy.props.IntProperty(name="Threads", default=2, min=1, max=16, soft_min=1, soft_max=16) def execute(self, context): blend_path = bpy.data.filepath if (not blend_path): self.report(type={'ERROR'}, message="Save File First") return {'CANCELLED'} if (self.mode == 'IMAGE'): subprocess.Popen([sys.argv[0], '-b', blend_path, '-f', str(context.scene.frame_current), '-t', str(self.thread)]) elif (self.mode == 'ANIME'): subprocess.Popen([sys.argv[0], '-b', blend_path, '-a', '-t', str(self.thread)]) if (self.is_quit): bpy.ops.wm.quit_blender() return {'FINISHED'} def invoke(self, context, event): return context.window_manager.invoke_props_dialog(self) class SetRenderResolutionPercentage(bpy.types.Operator): bl_idname = "render.set_render_resolution_percentage" bl_label = "Set Resolution" bl_description = "Percent of the size of the resolution" bl_options = {'REGISTER', 'UNDO'} size: bpy.props.IntProperty(name="Rendering size (%)", default=100, min=1, max=1000, soft_min=1, soft_max=1000, step=1) def execute(self, context): context.scene.render.resolution_percentage = self.size return {'FINISHED'} class ToggleThreadsMode(bpy.types.Operator): bl_idname = "render.toggle_threads_mode" bl_label = "Set Threads" bl_description = "I will switch the number of threads in the CPU to be used for rendering" bl_options = {'REGISTER', 'UNDO'} threads: bpy.props.IntProperty(name="Number of threads", default=1, min=1, max=16, soft_min=1, soft_max=16, step=1) def execute(self, context): if (context.scene.render.threads_mode == 'AUTO'): context.scene.render.threads_mode = 'FIXED' context.scene.render.threads = self.threads else: context.scene.render.threads_mode = 'AUTO' return {'FINISHED'} def invoke(self, context, event): if (context.scene.render.threads_mode == 'AUTO'): self.threads = context.scene.render.threads return context.window_manager.invoke_props_dialog(self) else: return self.execute(context) class SetAllSubsurfRenderLevels(bpy.types.Operator): bl_idname = "render.set_all_subsurf_render_levels" bl_label = "Set Global Subsurf" bl_description = "Level of Subsurf to apply when rendering" bl_options = {'REGISTER', 'UNDO'} items = [ ('ABSOLUTE', "Absolute value", "", 1), ('RELATIVE', "Relative value", "", 2), ] mode: bpy.props.EnumProperty(items=items, name="Mode") levels: bpy.props.IntProperty(name="Level", default=2, min=-20, max=20, soft_min=-20, soft_max=20, step=1) def execute(self, context): for obj in bpy.data.objects: if (obj.type != 'MESH' and obj.type != 'CURVE'): continue for mod in obj.modifiers: if (mod.type == 'SUBSURF'): if (self.mode == 'ABSOLUTE'): mod.render_levels = self.levels elif (self.mode == 'RELATIVE'): mod.render_levels += self.levels else: self.report(type={'ERROR'}, message="Setting value is invalid") return {'CANCELLED'} for area in context.screen.areas: area.tag_redraw() return {'FINISHED'} class SyncAllSubsurfRenderLevels(bpy.types.Operator): bl_idname = "render.sync_all_subsurf_render_levels" bl_label = "Sync All Subsurf Levels" bl_description = "sync_all_subsurf_render_levels" bl_options = {'REGISTER', 'UNDO'} level_offset: bpy.props.IntProperty(name="Sync Levels", default=0, min=-20, max=20, soft_min=-20, soft_max=20, step=1) def execute(self, context): for obj in bpy.data.objects: if (obj.type != 'MESH'): continue for mod in obj.modifiers: if (mod.type == 'SUBSURF'): mod.render_levels = mod.levels + self.level_offset for area in context.screen.areas: area.tag_redraw() return {'FINISHED'} def invoke(self, context, event): return context.window_manager.invoke_props_dialog(self) ################ # Render Size ################ class RenderResolutionPercentageMenu(bpy.types.Menu): bl_idname = "TOPBAR_MT_render_resolution_percentage" bl_label = "Rendering size (%)" bl_description = "Setting is set to either rendered in what percent of the size of the resolution" def check(self, context): return True def draw(self, context): x = bpy.context.scene.render.resolution_x y = bpy.context.scene.render.resolution_y self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="10% (" + str(int(x * 0.1)) + "x" + str(int(y * 0.1)) + ")", icon="CAMERA_DATA").size = 10 self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="20% (" + str(int(x * 0.2)) + "x" + str(int(y * 0.2)) + ")", icon="CAMERA_DATA").size = 20 self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="30% (" + str(int(x * 0.3)) + "x" + str(int(y * 0.3)) + ")", icon="CAMERA_DATA").size = 30 self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="40% (" + str(int(x * 0.4)) + "x" + str(int(y * 0.4)) + ")", icon="CAMERA_DATA").size = 40 self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="50% (" + str(int(x * 0.5)) + "x" + str(int(y * 0.5)) + ")", icon="CAMERA_DATA").size = 50 self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="60% (" + str(int(x * 0.6)) + "x" + str(int(y * 0.6)) + ")", icon="CAMERA_DATA").size = 60 self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="70% (" + str(int(x * 0.7)) + "x" + str(int(y * 0.7)) + ")", icon="CAMERA_DATA").size = 70 self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="80% (" + str(int(x * 0.8)) + "x" + str(int(y * 0.8)) + ")", icon="CAMERA_DATA").size = 80 self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="90% (" + str(int(x * 0.9)) + "x" + str(int(y * 0.9)) + ")", icon="CAMERA_DATA").size = 90 self.layout.separator() self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="100% (" + str(int(x)) + "x" + str(int(y)) + ")", icon="CAMERA_DATA").size = 100 self.layout.separator() self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="150% (" + str(int(x * 1.5)) + "x" + str(int(y * 1.5)) + ")", icon="CAMERA_DATA").size = 150 self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="200% (" + str(int(x * 2.0)) + "x" + str(int(y * 2.0)) + ")", icon="CAMERA_DATA").size = 200 self.layout.operator(SetRenderResolutionPercentage.bl_idname, text="300% (" + str(int(x * 3.0)) + "x" + str(int(y * 3.0)) + ")", icon="CAMERA_DATA").size = 300 class SimplifyRenderMenu(bpy.types.Menu): bl_idname = "TOPBAR_MT_render_simplify" bl_label = "Simplify Render" bl_description = "I simplified set of rendering" def draw(self, context): self.layout.prop(context.scene.render, "use_simplify") self.layout.separator() self.layout.prop(context.scene.render, "simplify_subdivision") self.layout.prop(context.scene.render, "simplify_shadow_samples") self.layout.prop(context.scene.render, "simplify_child_particles") self.layout.prop(context.scene.render, "simplify_ao_sss") self.layout.prop(context.scene.render, "use_simplify_triangulate") class ShadeingMenu(bpy.types.Menu): bl_idname = "TOPBAR_MT_render_shadeing" bl_label = "Use shading" bl_description = "Shading on / off" def draw(self, context): self.layout.prop(context.scene.render, 'use_textures') self.layout.prop(context.scene.render, 'use_shadows') self.layout.prop(context.scene.render, 'use_sss') self.layout.prop(context.scene.render, 'use_envmaps') self.layout.prop(context.scene.render, 'use_raytrace') class SubsurfMenu(bpy.types.Menu): bl_idname = "TOPBAR_MT_render_subsurf" bl_label = "Subsurf Level All" bl_description = "Subsurf subdivision level of all objects" def draw(self, context): operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision + 1", icon="MOD_SUBSURF") operator.mode = 'RELATIVE' operator.levels = 1 operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision - 1", icon="MOD_SUBSURF") operator.mode = 'RELATIVE' operator.levels = -1 self.layout.separator() operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision = 0", icon="MOD_SUBSURF") operator.mode = 'ABSOLUTE' operator.levels = 0 operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision = 1", icon="MOD_SUBSURF") operator.mode = 'ABSOLUTE' operator.levels = 1 operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision = 2", icon="MOD_SUBSURF") operator.mode = 'ABSOLUTE' operator.levels = 2 operator = self.layout.operator(SetAllSubsurfRenderLevels.bl_idname, text="Subdivision = 3", icon="MOD_SUBSURF") operator.mode = 'ABSOLUTE' operator.levels = 3 self.layout.separator() self.layout.operator(SyncAllSubsurfRenderLevels.bl_idname, text="Sync Subsurf Render Levels", icon="MOD_SUBSURF") class RenderToolsMenu(bpy.types.Operator): bl_idname = "render.render_tools" bl_label = "Render Settings" bl_description = "Pop up Render Settings" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES'} def draw(self, context): # Cycles layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' scene = context.scene cscene = scene.cycles self.layout.label(text="Render Cycles") self.layout.separator() self.layout.operator("render.render", text="Render Image").use_viewport = True self.layout.operator("render.render", text="Render Animation") self.layout.separator() self.layout.prop(context.scene.render, 'resolution_x', text="Resolution X") self.layout.prop(context.scene.render, 'resolution_y', text="Resolution Y") self.layout.prop(context.scene.render, "resolution_percentage", text="Render Resolution") self.layout.menu(RenderResolutionPercentageMenu.bl_idname, text="Resolution Presets") self.layout.prop_menu_enum(context.scene.render.image_settings, 'file_format', text="File Format") self.layout.separator() self.layout.menu(AnimateRenderMenu.bl_idname, text="Animation") self.layout.separator() self.layout.prop(context.scene.world.light_settings, 'use_ambient_occlusion', text="Use AO") self.layout.prop(context.scene.world.light_settings, "ao_factor", text="AO Factor") self.layout.separator() self.layout.label(text="Samples:") self.layout.prop(cscene, "samples", text="Render") self.layout.prop(cscene, "preview_samples", text="Preview") self.layout.separator() self.layout.prop(context.scene.render, 'use_freestyle', text="Use Freestyle") self.layout.separator() self.layout.menu(SimplifyRenderMenu.bl_idname) self.layout.menu(SubsurfMenu.bl_idname) self.layout.separator() self.layout.operator(ToggleThreadsMode.bl_idname, text='Set Threads') self.layout.operator(RenderBackground.bl_idname) def execute(self, context): return {'FINISHED'} def invoke(self, context, event): return context.window_manager.invoke_popup(self, width=250) # Menu def menu(self, context): self.layout.separator() self.layout.operator(RenderToolsMenu.bl_idname) class AnimateRenderMenu(bpy.types.Menu): bl_idname = "TOPBAR_MT_render_animate_menu" bl_label = "Animation" bl_description = "Set Frames & Animation Length" def draw(self, context): self.layout.separator() self.layout.prop(context.scene, 'frame_start', text="Start Frame") self.layout.prop(context.scene, 'frame_end', text="End Frame") self.layout.prop(context.scene, 'frame_step', text="Frame Step") self.layout.prop(context.scene.render, 'fps', text="FPS") class IMAGE_PT_RenderSettingsPanel(bpy.types.Panel): """Render Settings Panel""" bl_label = "Render settings" bl_space_type = 'IMAGE_EDITOR' bl_category = 'Render' bl_region_type = 'UI' COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES'} def draw(self, context): # Cycles layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' scene = context.scene cscene = scene.cycles self.layout.label(text="Render Settings") self.layout.separator() self.layout.operator("render.render", text="Render Image").use_viewport = True self.layout.operator("render.render", text="Render Animation",) self.layout.separator() self.layout.prop(context.scene.render, 'resolution_x', text="Resolution X") self.layout.prop(context.scene.render, 'resolution_y', text="Resolution Y") self.layout.prop(context.scene.render, "resolution_percentage", text="Render Resolution") self.layout.menu(RenderResolutionPercentageMenu.bl_idname, text="Resolution Presets") self.layout.prop_menu_enum(context.scene.render.image_settings, 'file_format', text="File Format") self.layout.separator() self.layout.menu(AnimateRenderMenu.bl_idname, text="Animation") self.layout.separator() self.layout.prop(context.scene.world.light_settings, 'use_ambient_occlusion', text="Use AO") self.layout.prop(context.scene.world.light_settings, "ao_factor", text="AO Factor") self.layout.separator() self.layout.label(text="Samples:") self.layout.prop(cscene, "samples", text="Render") self.layout.prop(cscene, "preview_samples", text="Preview") self.layout.separator() self.layout.prop(context.scene.render, 'use_freestyle', text="Use Freestyle") self.layout.separator() self.layout.menu(SimplifyRenderMenu.bl_idname) self.layout.menu(SubsurfMenu.bl_idname) self.layout.separator() self.layout.operator(ToggleThreadsMode.bl_idname, text='Set Threads') self.layout.operator(RenderBackground.bl_idname) def execute(self, context): return {'FINISHED'} def invoke(self, context, event): return context.window_manager.invoke_popup(self, width=250) # Class List classes = ( RenderBackground, SetRenderResolutionPercentage, ToggleThreadsMode, SetAllSubsurfRenderLevels, SyncAllSubsurfRenderLevels, RenderResolutionPercentageMenu, SimplifyRenderMenu, ShadeingMenu, SubsurfMenu, RenderToolsMenu, AnimateRenderMenu, IMAGE_PT_RenderSettingsPanel ) # register def register(): for cls in classes: bpy.utils.register_class(cls) bpy.types.TOPBAR_MT_render.append(menu) # unregister def unregister(): bpy.types.TOPBAR_MT_render.remove(menu) for cls in classes: bpy.utils.unregister_class(cls) if __name__ == "__main__": register()
{ "pile_set_name": "Github" }
#pragma once #include "ofMain.h" #include "ofxBox2d.h" class ofApp : public ofBaseApp { public: void setup(); void update(); void draw(); void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void resized(int w, int h); ofxBox2d box2d; vector <shared_ptr<ofxBox2dRect>> boxes; };
{ "pile_set_name": "Github" }
diff --git a/hll.c b/hll.c index 9169aaf..8ea8fc4 100644 --- a/hll.c +++ b/hll.c @@ -103,30 +103,31 @@ static ret_code GetExpression(struct hll_item *hll, int *i, struct asm_tok[], in * must not be changed. */ enum c_bop { - COP_NONE, - COP_EQ, /* == */ - COP_NE, /* != */ - COP_GT, /* > */ - COP_LT, /* < */ - COP_GE, /* >= */ - COP_LE, /* <= */ - COP_AND, /* && */ - COP_OR, /* || */ - COP_ANDB, /* & */ - COP_NEG, /* ! */ - COP_ZERO, /* ZERO? not really a valid C operator */ - COP_CARRY,/* CARRY? not really a valid C operator */ - COP_SIGN, /* SIGN? not really a valid C operator */ - COP_PARITY, /* PARITY? not really a valid C operator */ - COP_OVERFLOW, /* OVERFLOW? not really a valid C operator */ - //added by habran - COP_LESS,/* SIGN=OVERFLOW not really a valid C operator */ - COP_GREATER, /* SIGNED ZERO OR CARRY not really a valid C operator */ - COP_ABOVE, /* ZERO OR CARRY not really a valid C operator */ - COP_EQUAL, - COP_BELOW + COP_NONE, + COP_EQ, /* == */ + COP_NE, /* != */ + COP_GT, /* > */ + COP_LT, /* < */ + COP_GE, /* >= */ + COP_LE, /* <= */ + COP_AND, /* && */ + COP_OR, /* || */ + COP_ANDB, /* & */ + COP_NEG, /* ! */ + COP_ZERO, /* ZERO? not really a valid C operator */ + COP_CARRY, /* CARRY? not really a valid C operator */ + COP_SIGN, /* SIGN? not really a valid C operator */ + COP_PARITY, /* PARITY? not really a valid C operator */ + COP_OVERFLOW, /* OVERFLOW? not really a valid C operator */ + //added by habran + COP_LESS, /* Used for signed integers SIGN=OVERFLOW */ + COP_GREATER, /* Used for signed integers SIGNED ZERO OR CARRY */ + COP_ABOVE, /* Used for unsigned integers ZERO OR CARRY */ + COP_EQUAL, + COP_BELOW /* Used for unsigned integers */ }; + /* items in table below must match order COP_ZERO - COP_OVERFLOW */ static const char flaginstr[] = { 'z', 'c', 's', 'p', 'o', 'l', 'g', 'a', 'e', 'b' };
{ "pile_set_name": "Github" }
var util = require('util'); var zlib = require('zlib'); var benchmark = require('async-benchmark'); var bytes = require('bytes'); var chalk = require('chalk'); var snappy = require('../snappy'); var input = require('fs').readFileSync( require('path').join(__dirname, '../deps/snappy/snappy-1.1.4/snappy.cc') ); var round = function (number) { return Math.round(number * 100) / 100; }; var customGzip = function (data, callback) { var buffers = []; var size = 0; var gzip = new zlib.Gzip({ level: zlib.Z_BEST_SPEED, memLevel: zlib.Z_MAX_MEMLEVEL }); gzip.on('data', function (buffer) { buffers.push(buffer); size += buffer.length; }).on('end', function () { callback(null, Buffer.concat(buffers, size)); }); gzip.write(data); gzip.end(); }; var customGunzip = function (data, callback) { var buffers = []; var size = 0; var gunzip = new zlib.Gunzip(); gunzip.on('data', function (buffer) { buffers.push(buffer); size += buffer.length; }).on('end', function () { callback(null, Buffer.concat(buffers, size)); }); gunzip.write(data); gunzip.end(); }; var customDeflate = function (data, callback) { var buffers = []; var size = 0; var deflate = new zlib.Deflate({ level: zlib.Z_BEST_SPEED, memLevel: zlib.Z_MAX_MEMLEVEL }); deflate.on('data', function (buffer) { buffers.push(buffer); size += buffer.length; }).on('end', function () { callback(null, Buffer.concat(buffers, size)); }); deflate.write(data); deflate.end(); }; var customInflate = function (data, callback) { var buffers = []; var size = 0; var inflate = new zlib.Inflate(); inflate.on('data', function (buffer) { buffers.push(buffer); size += buffer.length; }).on('end', function () { callback(null, Buffer.concat(buffers, size)); }); inflate.write(data); inflate.end(); }; console.log(chalk.underline(util.format('input size %s', bytes(input.length)))); console.log(); require('run-series')([ function (done) { benchmark( 'snappy.compress()', snappy.compress.bind(snappy, input), function (err, event) { if (err) { throw err; } console.log(chalk.blue(event.target.toString())); snappy.compress(input, function (err, compressed) { if (err) { throw err; } var str = util.format( 'compressed size %s (%s%)', bytes(compressed.length), round(compressed.length / input.length * 100) ); console.log(chalk.blue(str)); done(); }); } ); }, function (done) { benchmark( 'zlib.gzip()', zlib.gzip.bind(zlib, input), function (err, event) { if (err) { throw err; } console.log(chalk.yellow(event.target.toString())); zlib.gzip(input, function (err, compressed) { if (err) { throw err; } var str = util.format( 'compressed size %s (%s%)', bytes(compressed.length), round(compressed.length / input.length * 100) ); console.log(chalk.yellow(str)); done(); }); } ); }, function (done) { benchmark( 'zlib.deflate()', zlib.deflate.bind(zlib, input), function (err, event) { if (err) { throw err; } console.log(chalk.white(event.target.toString())); zlib.deflate(input, function (err, compressed) { if (err) { throw err; } var str = util.format( 'compressed size %s (%s%)', bytes(compressed.length), round(compressed.length / input.length * 100) ); console.log(chalk.white(str)); done(); }); } ); }, function (done) { benchmark( 'zlib.Gzip with custom options', customGzip.bind(zlib, input), function (err, event) { if (err) { throw err; } console.log(chalk.magenta(event.target.toString())); customGzip(input, function (err, compressed) { if (err) { throw err; } var str = util.format( 'compressed size %s (%s%)', bytes(compressed.length), round(compressed.length / input.length * 100) ); console.log(chalk.magenta(str)); done(); }); } ); }, function (done) { benchmark( 'zlib.Deflate with custom options', customDeflate.bind(zlib, input), function (err, event) { if (err) { throw err; } console.log(chalk.green(event.target.toString())); customDeflate(input, function (err, compressed) { if (err) { throw err; } var str = util.format( 'compressed size %s (%s%)', bytes(compressed.length), round(compressed.length / input.length * 100) ); console.log(chalk.green(str)); console.log(); done(); }); } ); }, function (done) { snappy.compress(input, function (err, compressed) { if (err) { throw err; } benchmark( 'snappy.uncompress()', snappy.uncompress.bind(snappy, compressed), function (err, event) { if (err) { throw err; } console.log(chalk.blue(event.target.toString())); done(); } ); }); }, function (done) { zlib.gzip(input, function (err, compressed) { if (err) { throw err; } benchmark( 'zlib.gunzip()', zlib.gunzip.bind(zlib, compressed), function (err, event) { if (err) { throw err; } console.log(chalk.yellow(event.target.toString())); done(); } ); }); }, function (done) { zlib.deflate(input, function (err, compressed) { if (err) { throw err; } benchmark( 'zlib.inflate()', zlib.inflate.bind(zlib, compressed), function (err, event) { if (err) { throw err; } console.log(chalk.white(event.target.toString())); done(); } ); }); }, function (done) { customGzip(input, function (err, compressed) { if (err) { throw err; } benchmark( 'zlib.Gunzip with custom options', customGunzip.bind(zlib, compressed), function (err, event) { if (err) { throw err; } console.log(chalk.magenta(event.target.toString())); done(); } ); }); }, function (done) { customDeflate(input, function (err, compressed) { if (err) { throw err; } benchmark( 'zlib.Inflate with custom options', customInflate.bind(zlib, compressed), function (err, event) { if (err) { throw err; } console.log(chalk.green(event.target.toString())); done(); } ); }); } ]);
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyHeight="@integer/key_normal_height" android:keyWidth="15%p"> <Row> <Key android:keyLabel="&#129465;&#127995;‍♂️" android:keyOutputText="&#129465;&#127995;‍♂️" xmlns:ask="http://schemas.android.com/apk/res-auto" ask:tags=""/> <Key android:keyLabel="&#129465;&#127996;‍♂️" android:keyOutputText="&#129465;&#127996;‍♂️" xmlns:ask="http://schemas.android.com/apk/res-auto" ask:tags=""/> <Key android:keyLabel="&#129465;&#127997;‍♂️" android:keyOutputText="&#129465;&#127997;‍♂️" xmlns:ask="http://schemas.android.com/apk/res-auto" ask:tags=""/> <Key android:keyLabel="&#129465;&#127998;‍♂️" android:keyOutputText="&#129465;&#127998;‍♂️" xmlns:ask="http://schemas.android.com/apk/res-auto" ask:tags=""/> <Key android:keyLabel="&#129465;&#127999;‍♂️" android:keyOutputText="&#129465;&#127999;‍♂️" xmlns:ask="http://schemas.android.com/apk/res-auto" ask:tags=""/> </Row> </Keyboard>
{ "pile_set_name": "Github" }
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This file is autogenerated by: // mojo/public/tools/bindings/mojom_bindings_generator.py // For: // components/payments/mojom/payment_request.mojom // package org.chromium.payments.mojom; import org.chromium.base.annotations.SuppressFBWarnings; import org.chromium.mojo.bindings.DeserializationException; public final class PaymentErrorReason { public static final int UNKNOWN = 0; public static final int USER_CANCEL = UNKNOWN + 1; public static final int NOT_SUPPORTED = USER_CANCEL + 1; private static final boolean IS_EXTENSIBLE = false; public static boolean isKnownValue(int value) { switch (value) { case 0: case 1: case 2: return true; } return false; } public static void validate(int value) { if (IS_EXTENSIBLE || isKnownValue(value)) return; throw new DeserializationException("Invalid enum value."); } private PaymentErrorReason() {} }
{ "pile_set_name": "Github" }
# 20. Refactoring the Reducers [Video Link](https://egghead.io/lessons/javascript-redux-refactoring-the-reducers) Earlier, we removed the `visibilityFilter` reducer, and so the root reducer in the app now combines only a single `todos` reducer. Since `index.js` acts effectively as a proxy to the `todos` reducer, we will remove `index.js` completely. Then we will rename `todos.js` to `index.js`, thereby making `todos` the new root reducer. The root reducer file now contains `byId`, `allIds`, `activeIds`, and `completedIDs`. We're going to extract some of them into separate files. Creating a file called `byid.js`, where we paste the code for the `byId` reducer. Now we'll add a named export for a selector called `getTodo` that takes the `state` and `id`, where the state corresponds to the state of the `byId` reducer. Now going back to `index.js`, we can import the reducer as a default import. We can also import any associated selectors in a single object with a namespace import: ```javascript import byId, * as fromById from './byid' ``` Now if we take a look at the reducers managing the IDs, we will notice that their code is almost exactly the same except for the filter value which they compare `action.filter` to. ### Creating `createList` Let's create a new function called `createList` that takes `filter` as an argument. `createList` will return another function– a reducer that handles the `id`s for the specified filter– , so its state shape is an array. To save time, we can copy & paste the implementation from `allIds`, and then just change the `'all'` literal to `createList`'s `filter` argument, so that we can create it for any filter. ```javascript const createList = (filter) => { return (state = [], action) => { if (action.filter !== filter) { return state; } switch (action.type) { case 'RECEIVE_TODOS': return action.response.map(todo => todo.id); default: return state; } }; }; ``` Now we can remove the `allIds`, `activeIds`, and `completedIds` reducer code completely. Instead, we will generate the reducers using the new `createList` function, and pass the filter as an argument to it. Next, extract the `createList` function into a separate file called `createList.js`. Now that it's in a separate file, we will add a public API for accessing the state in form of a selector. For now, we will call it `getIds`, and will just returns the state of the list (we may change this in the future). #### Finishing Up Back in `index.js`, we will import `createList` and any named selectors from this file. ```javascript import createList, * as fromList from './createList'; ``` We will also rename `idsByFilter` to `listByFilter` because now that the list implementation is in a separate file, we will use the `getIds` selector that it exports. ```javascript export const getVisibleTodos = (state, filter) => { const ids = fromList.getIds(state.listByFilter[filter]); return ids.map(id => fromById.getTodo(state.byId, id)); }; ``` Since we also moved the `byId` reducer into a separate file, we want to make sure we don't make an assumption that it's just a lookup table. With this in mind, we will use the `fromById.getTodo` selector that it exports and pass its state and the corresponding ID. With this refactor, we can change the state shape of any reducer in the future without rippling changes across the codebase. [Recap at 3:41 in video](https://egghead.io/lessons/javascript-redux-refactoring-the-reducers) <p align="center"> <a href="./19-Updating_the_State_with_the_Fetched_Data.md"><- Prev</a> <a href="./21-Displaying_Loading_Indicators.md">Next -></a> </p>
{ "pile_set_name": "Github" }
cd %windir%\Microsoft.NET\Framework\v4.0.30319 aspnet_regiis.exe –i
{ "pile_set_name": "Github" }
import hou def AddCustomFloor(a_node): Index = a_node.parm("mpFloorOverrides").evalAsInt() # DEFAULT PARMS Parms = ['bFacadeCorner','bTopLedgeCorner', 'bBottomLedgeCorner', 'sTopLedgePattern', 'sBottomLedgePattern','fFloorHeight', 'bTopLedge', 'fTopLedgeHeight', 'bBottomLedge', 'fBottomLedgeHeight', 'sFacadePattern', 'sSideSlopID'] ParmsMulti = [['sConvexCornerID', 2], ['sConcaveCornerID', 2], ['sTopLedgeConvexCorner', 2], ['sTopLedgeConcaveCorner', 2], ['sBottomLedgeConvexCorner', 2], ['sBottomLedgeConcaveCorner', 2]] if Index > 0: for parm in Parms: ParmToSet = a_node.parm(parm+"Override%s" % Index) if ParmToSet != None: ParmToSet.setFromParm(a_node.parm(parm)) for parm in ParmsMulti: for x in range(parm[1]): ParmToSet = a_node.parm(parm[0]+"Override%s%s" % (Index,x+1)) if ParmToSet != None: ParmToSet.setFromParm(a_node.parm(parm[0]+str(x+1)))
{ "pile_set_name": "Github" }
/** * Copyright 2000-2009 DFKI GmbH. * All Rights Reserved. Use is subject to license terms. * * This file is part of MARY TTS. * * MARY TTS is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, version 3 of the License. * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package marytts.cart; import marytts.cart.LeafNode.FeatureVectorLeafNode; import marytts.cart.LeafNode.IntArrayLeafNode; import marytts.features.FeatureDefinition; import marytts.features.FeatureVector; /** * A decision node that determines the next Node to go to in the CART. All decision nodes inherit from this class */ public abstract class DecisionNode extends Node { public enum Type { BinaryByteDecisionNode, BinaryShortDecisionNode, BinaryFloatDecisionNode, ByteDecisionNode, ShortDecisionNode }; protected boolean TRACE = false; // for debugging: protected FeatureDefinition featureDefinition; // a decision node has an array of daughters protected Node[] daughters; // the feature index protected int featureIndex; // the feature name protected String feature; // remember last added daughter protected int lastDaughter; // the total number of data in the leaves below this node protected int nData; // unique index used in MaryCART format protected int uniqueDecisionNodeId; /** * Construct a new DecisionNode * * @param feature * the feature * @param numDaughters * the number of daughters * @param featureDefinition * feature definition */ public DecisionNode(String feature, int numDaughters, FeatureDefinition featureDefinition) { this.feature = feature; this.featureIndex = featureDefinition.getFeatureIndex(feature); daughters = new Node[numDaughters]; isRoot = false; // for trace and getDecisionPath(): this.featureDefinition = featureDefinition; } /** * Construct a new DecisionNode * * @param featureIndex * the feature index * @param numDaughters * the number of daughters * @param featureDefinition * feature definition */ public DecisionNode(int featureIndex, int numDaughters, FeatureDefinition featureDefinition) { this.featureIndex = featureIndex; this.feature = featureDefinition.getFeatureName(featureIndex); daughters = new Node[numDaughters]; isRoot = false; // for trace and getDecisionPath(): this.featureDefinition = featureDefinition; } /** * Construct a new DecisionNode * * @param numDaughters * the number of daughters * @param featureDefinition * feature definition */ public DecisionNode(int numDaughters, FeatureDefinition featureDefinition) { daughters = new Node[numDaughters]; isRoot = false; // for trace and getDecisionPath(): this.featureDefinition = featureDefinition; } @Override public boolean isDecisionNode() { return true; } /** * Get the name of the feature * * @return the name of the feature */ public String getFeatureName() { return feature; } public int getFeatureIndex() { return featureIndex; } public FeatureDefinition getFeatureDefinition() { return featureDefinition; } /** * Add a daughter to the node * * @param daughter * the new daughter */ public void addDaughter(Node daughter) { if (lastDaughter > daughters.length - 1) { throw new RuntimeException("Can not add daughter number " + (lastDaughter + 1) + ", since node has only " + daughters.length + " daughters!"); } daughters[lastDaughter] = daughter; if (daughter != null) { daughter.setMother(this, lastDaughter); } lastDaughter++; } /** * Get the daughter at the specified index * * @param index * the index of the daughter * @return the daughter (potentially null); if index out of range: null */ public Node getDaughter(int index) { if (index > daughters.length - 1 || index < 0) { return null; } return daughters[index]; } /** * Replace daughter at given index with another daughter * * @param newDaughter * the new daughter * @param index * the index of the daughter to replace */ public void replaceDaughter(Node newDaughter, int index) { if (index > daughters.length - 1 || index < 0) { throw new RuntimeException("Can not replace daughter number " + index + ", since daughter index goes from 0 to " + (daughters.length - 1) + "!"); } daughters[index] = newDaughter; newDaughter.setMother(this, index); } /** * Tests, if the given index refers to a daughter * * @param index * the index * @return true, if the index is in range of the daughters array */ public boolean hasMoreDaughters(int index) { return (index > -1 && index < daughters.length); } /** * Get all unit indices from all leaves below this node * * @return an int array containing the indices */ public Object getAllData() { // What to do depends on the type of leaves. LeafNode firstLeaf = new NodeIterator<LeafNode>(this, true, false, false).next(); if (firstLeaf == null) return null; Object result; if (firstLeaf instanceof IntArrayLeafNode) { // this includes subclass IntAndFloatArrayLeafNode result = new int[nData]; } else if (firstLeaf instanceof FeatureVectorLeafNode) { result = new FeatureVector[nData]; } else { return null; } fillData(result, 0, nData); return result; } protected void fillData(Object target, int pos, int total) { // assert pos + total <= target.length; for (int i = 0; i < daughters.length; i++) { if (daughters[i] == null) continue; int len = daughters[i].getNumberOfData(); daughters[i].fillData(target, pos, len); pos += len; } } /** * Count all the nodes at and below this node. A leaf will return 1; the root node will report the total number of decision * and leaf nodes in the tree. * * @return the number of nodes */ public int getNumberOfNodes() { int nNodes = 1; // this node for (int i = 0; i < daughters.length; i++) { if (daughters[i] != null) nNodes += daughters[i].getNumberOfNodes(); } return nNodes; } public int getNumberOfData() { return nData; } /** * Number of daughters of current node. * * @return daughters.length */ public int getNumberOfDaugthers() { return daughters.length; } /** * Set the number of candidates correctly, by counting while walking down the tree. This needs to be done once for the entire * tree. * */ // protected void countData() { public void countData() { nData = 0; for (int i = 0; i < daughters.length; i++) { if (daughters[i] instanceof DecisionNode) ((DecisionNode) daughters[i]).countData(); if (daughters[i] != null) { nData += daughters[i].getNumberOfData(); } } } public String toString() { return "dn" + uniqueDecisionNodeId; } /** * Get the path leading to the daughter with the given index. This will recursively go up to the root node. * * @param daughterIndex * daughterIndex * @return the unique decision node id */ public abstract String getDecisionPath(int daughterIndex); // unique index used in MaryCART format public void setUniqueDecisionNodeId(int id) { this.uniqueDecisionNodeId = id; } public int getUniqueDecisionNodeId() { return uniqueDecisionNodeId; } /** * Gets the String that defines the decision done in the node * * @return the node definition */ public abstract String getNodeDefinition(); /** * Get the decision node type * * @return the decision node type */ public abstract Type getDecisionNodeType(); /** * Select a daughter node according to the value in the given target * * @param featureVector * the feature vector * @return a daughter */ public abstract Node getNextNode(FeatureVector featureVector); /** * A binary decision Node that compares two byte values. */ public static class BinaryByteDecisionNode extends DecisionNode { // the value of this node private byte value; /** * Create a new binary String DecisionNode. * * @param feature * the string used to get a value from an Item * @param value * the value to compare to * @param featureDefinition * featureDefinition */ public BinaryByteDecisionNode(String feature, String value, FeatureDefinition featureDefinition) { super(feature, 2, featureDefinition); this.value = featureDefinition.getFeatureValueAsByte(feature, value); } public BinaryByteDecisionNode(int featureIndex, byte value, FeatureDefinition featureDefinition) { super(featureIndex, 2, featureDefinition); this.value = value; } /*** * Creates an empty BinaryByteDecisionNode, the feature and feature value of this node should be filled with * setFeatureAndFeatureValue() function. * * @param uniqueId * unique index from tree HTS test file. * @param featureDefinition * featureDefinition */ public BinaryByteDecisionNode(int uniqueId, FeatureDefinition featureDefinition) { super(2, featureDefinition); // System.out.println("adding decision node: " + uniqueId); this.uniqueDecisionNodeId = uniqueId; } /*** * Fill the feature and feature value of an already created (empty) BinaryByteDecisionNode. * * @param feature * feature * @param value * value */ public void setFeatureAndFeatureValue(String feature, String value) { this.feature = feature; this.featureIndex = featureDefinition.getFeatureIndex(feature); this.value = featureDefinition.getFeatureValueAsByte(feature, value); } public byte getCriterionValueAsByte() { return value; } public String getCriterionValueAsString() { return featureDefinition.getFeatureValueAsString(featureIndex, value); } /** * Select a daughter node according to the value in the given target * * @param featureVector * the feature vector * @return a daughter */ public Node getNextNode(FeatureVector featureVector) { byte val = featureVector.getByteFeature(featureIndex); Node returnNode; if (val == value) { returnNode = daughters[0]; } else { returnNode = daughters[1]; } if (TRACE) { System.out.print(" " + feature + ": " + featureDefinition.getFeatureValueAsString(featureIndex, value) + " == " + featureDefinition.getFeatureValueAsString(featureIndex, val)); if (val == value) System.out.println(" YES "); else System.out.println(" NO "); } return returnNode; } public String getDecisionPath(int daughterIndex) { String thisNodeInfo; if (daughterIndex == 0) thisNodeInfo = feature + "==" + featureDefinition.getFeatureValueAsString(featureIndex, value); else thisNodeInfo = feature + "!=" + featureDefinition.getFeatureValueAsString(featureIndex, value); if (mother == null) return thisNodeInfo; else if (mother.isDecisionNode()) return ((DecisionNode) mother).getDecisionPath(getNodeIndex()) + " - " + thisNodeInfo; else return mother.getDecisionPath() + " - " + thisNodeInfo; } /** * Gets the String that defines the decision done in the node * * @return the node definition */ public String getNodeDefinition() { return feature + " is " + featureDefinition.getFeatureValueAsString(featureIndex, value); } public Type getDecisionNodeType() { return Type.BinaryByteDecisionNode; } } /** * A binary decision Node that compares two short values. */ public static class BinaryShortDecisionNode extends DecisionNode { // the value of this node private short value; /** * Create a new binary String DecisionNode. * * @param feature * the string used to get a value from an Item * @param value * the value to compare to * @param featureDefinition * featureDefinition */ public BinaryShortDecisionNode(String feature, String value, FeatureDefinition featureDefinition) { super(feature, 2, featureDefinition); this.value = featureDefinition.getFeatureValueAsShort(feature, value); } public BinaryShortDecisionNode(int featureIndex, short value, FeatureDefinition featureDefinition) { super(featureIndex, 2, featureDefinition); this.value = value; } public short getCriterionValueAsShort() { return value; } public String getCriterionValueAsString() { return featureDefinition.getFeatureValueAsString(featureIndex, value); } /** * Select a daughter node according to the value in the given target * * @param featureVector * the feature vector * @return a daughter */ public Node getNextNode(FeatureVector featureVector) { short val = featureVector.getShortFeature(featureIndex); Node returnNode; if (val == value) { returnNode = daughters[0]; } else { returnNode = daughters[1]; } if (TRACE) { System.out.print(feature + ": " + featureDefinition.getFeatureValueAsString(featureIndex, val)); if (val == value) System.out.print(" == "); else System.out.print(" != "); System.out.println(featureDefinition.getFeatureValueAsString(featureIndex, value)); } return returnNode; } public String getDecisionPath(int daughterIndex) { String thisNodeInfo; if (daughterIndex == 0) thisNodeInfo = feature + "==" + featureDefinition.getFeatureValueAsString(featureIndex, value); else thisNodeInfo = feature + "!=" + featureDefinition.getFeatureValueAsString(featureIndex, value); if (mother == null) return thisNodeInfo; else if (mother.isDecisionNode()) return ((DecisionNode) mother).getDecisionPath(getNodeIndex()) + " - " + thisNodeInfo; else return mother.getDecisionPath() + " - " + thisNodeInfo; } /** * Gets the String that defines the decision done in the node * * @return the node definition */ public String getNodeDefinition() { return feature + " is " + featureDefinition.getFeatureValueAsString(featureIndex, value); } public Type getDecisionNodeType() { return Type.BinaryShortDecisionNode; } } /** * A binary decision Node that compares two float values. */ public static class BinaryFloatDecisionNode extends DecisionNode { // the value of this node private float value; private boolean isByteFeature; /** * Create a new binary String DecisionNode. * * @param featureIndex * the string used to get a value from an Item * @param value * the value to compare to * @param featureDefinition * featureDefinition */ public BinaryFloatDecisionNode(int featureIndex, float value, FeatureDefinition featureDefinition) { this(featureDefinition.getFeatureName(featureIndex), value, featureDefinition); } public BinaryFloatDecisionNode(String feature, float value, FeatureDefinition featureDefinition) { super(feature, 2, featureDefinition); this.value = value; // check for pseudo-floats: // TODO: clean this up: if (featureDefinition.isByteFeature(featureIndex)) isByteFeature = true; else isByteFeature = false; } public float getCriterionValueAsFloat() { return value; } public String getCriterionValueAsString() { return String.valueOf(value); } /** * Select a daughter node according to the value in the given target * * @param featureVector * the feature vector * @return a daughter */ public Node getNextNode(FeatureVector featureVector) { float val; if (isByteFeature) val = (float) featureVector.getByteFeature(featureIndex); else val = featureVector.getContinuousFeature(featureIndex); Node returnNode; if (val < value) { returnNode = daughters[0]; } else { returnNode = daughters[1]; } if (TRACE) { System.out.print(feature + ": " + val); if (val < value) System.out.print(" < "); else System.out.print(" >= "); System.out.println(value); } return returnNode; } public String getDecisionPath(int daughterIndex) { String thisNodeInfo; if (daughterIndex == 0) thisNodeInfo = feature + "<" + value; else thisNodeInfo = feature + ">=" + value; if (mother == null) return thisNodeInfo; else if (mother.isDecisionNode()) return ((DecisionNode) mother).getDecisionPath(getNodeIndex()) + " - " + thisNodeInfo; else return mother.getDecisionPath() + " - " + thisNodeInfo; } /** * Gets the String that defines the decision done in the node * * @return the node definition */ public String getNodeDefinition() { return feature + " < " + value; } public Type getDecisionNodeType() { return Type.BinaryFloatDecisionNode; } } /** * An decision Node with an arbitrary number of daughters. Value of the target corresponds to the index number of next * daughter. */ public static class ByteDecisionNode extends DecisionNode { /** * Build a new byte decision node * * @param feature * the feature name * @param numDaughters * the number of daughters * @param featureDefinition * featureDefinition */ public ByteDecisionNode(String feature, int numDaughters, FeatureDefinition featureDefinition) { super(feature, numDaughters, featureDefinition); } /** * Build a new byte decision node * * @param featureIndex * the feature index * @param numDaughters * the number of daughters * @param featureDefinition * featureDefinition */ public ByteDecisionNode(int featureIndex, int numDaughters, FeatureDefinition featureDefinition) { super(featureIndex, numDaughters, featureDefinition); } /** * Select a daughter node according to the value in the given target * * @param featureVector * the feature vector * @return a daughter */ public Node getNextNode(FeatureVector featureVector) { byte val = featureVector.getByteFeature(featureIndex); if (TRACE) { System.out.println(feature + ": " + featureDefinition.getFeatureValueAsString(featureIndex, val)); } return daughters[val]; } public String getDecisionPath(int daughterIndex) { String thisNodeInfo = feature + "==" + featureDefinition.getFeatureValueAsString(featureIndex, daughterIndex); if (mother == null) return thisNodeInfo; else if (mother.isDecisionNode()) return ((DecisionNode) mother).getDecisionPath(getNodeIndex()) + " - " + thisNodeInfo; else return mother.getDecisionPath() + " - " + thisNodeInfo; } /** * Gets the String that defines the decision done in the node * * @return the node definition */ public String getNodeDefinition() { return feature + " isByteOf " + daughters.length; } public Type getDecisionNodeType() { return Type.ByteDecisionNode; } } /** * An decision Node with an arbitrary number of daughters. Value of the target corresponds to the index number of next * daughter. */ public static class ShortDecisionNode extends DecisionNode { /** * Build a new short decision node * * @param feature * the feature name * @param numDaughters * the number of daughters * @param featureDefinition * featureDefinition */ public ShortDecisionNode(String feature, int numDaughters, FeatureDefinition featureDefinition) { super(feature, numDaughters, featureDefinition); } /** * Build a new short decision node * * @param featureIndex * the feature index * @param numDaughters * the number of daughters * @param featureDefinition * featureDefinition */ public ShortDecisionNode(int featureIndex, int numDaughters, FeatureDefinition featureDefinition) { super(featureIndex, numDaughters, featureDefinition); } /** * Select a daughter node according to the value in the given target * * @param featureVector * the feature vector * @return a daughter */ public Node getNextNode(FeatureVector featureVector) { short val = featureVector.getShortFeature(featureIndex); if (TRACE) { System.out.println(feature + ": " + featureDefinition.getFeatureValueAsString(featureIndex, val)); } return daughters[val]; } public String getDecisionPath(int daughterIndex) { String thisNodeInfo = feature + "==" + featureDefinition.getFeatureValueAsString(featureIndex, daughterIndex); if (mother == null) return thisNodeInfo; else if (mother.isDecisionNode()) return ((DecisionNode) mother).getDecisionPath(getNodeIndex()) + " - " + thisNodeInfo; else return mother.getDecisionPath() + " - " + thisNodeInfo; } /** * Gets the String that defines the decision done in the node * * @return the node definition */ public String getNodeDefinition() { return feature + " isShortOf " + daughters.length; } public Type getDecisionNodeType() { return Type.ShortDecisionNode; } } }
{ "pile_set_name": "Github" }
// Created by cgo -godefs - DO NOT EDIT // cgo -godefs types_openbsd.go // +build amd64,openbsd package unix const ( sizeofPtr = 0x8 sizeofShort = 0x2 sizeofInt = 0x4 sizeofLong = 0x8 sizeofLongLong = 0x8 ) type ( _C_short int16 _C_int int32 _C_long int64 _C_long_long int64 ) type Timespec struct { Sec int64 Nsec int64 } type Timeval struct { Sec int64 Usec int64 } type Rusage struct { Utime Timeval Stime Timeval Maxrss int64 Ixrss int64 Idrss int64 Isrss int64 Minflt int64 Majflt int64 Nswap int64 Inblock int64 Oublock int64 Msgsnd int64 Msgrcv int64 Nsignals int64 Nvcsw int64 Nivcsw int64 } type Rlimit struct { Cur uint64 Max uint64 } type _Gid_t uint32 const ( S_IFMT = 0xf000 S_IFIFO = 0x1000 S_IFCHR = 0x2000 S_IFDIR = 0x4000 S_IFBLK = 0x6000 S_IFREG = 0x8000 S_IFLNK = 0xa000 S_IFSOCK = 0xc000 S_ISUID = 0x800 S_ISGID = 0x400 S_ISVTX = 0x200 S_IRUSR = 0x100 S_IWUSR = 0x80 S_IXUSR = 0x40 ) type Stat_t struct { Mode uint32 Dev int32 Ino uint64 Nlink uint32 Uid uint32 Gid uint32 Rdev int32 Atim Timespec Mtim Timespec Ctim Timespec Size int64 Blocks int64 Blksize uint32 Flags uint32 Gen uint32 Pad_cgo_0 [4]byte X__st_birthtim Timespec } type Statfs_t struct { F_flags uint32 F_bsize uint32 F_iosize uint32 Pad_cgo_0 [4]byte F_blocks uint64 F_bfree uint64 F_bavail int64 F_files uint64 F_ffree uint64 F_favail int64 F_syncwrites uint64 F_syncreads uint64 F_asyncwrites uint64 F_asyncreads uint64 F_fsid Fsid F_namemax uint32 F_owner uint32 F_ctime uint64 F_fstypename [16]int8 F_mntonname [90]int8 F_mntfromname [90]int8 F_mntfromspec [90]int8 Pad_cgo_1 [2]byte Mount_info [160]byte } type Flock_t struct { Start int64 Len int64 Pid int32 Type int16 Whence int16 } type Dirent struct { Fileno uint64 Off int64 Reclen uint16 Type uint8 Namlen uint8 X__d_padding [4]uint8 Name [256]int8 } type Fsid struct { Val [2]int32 } type RawSockaddrInet4 struct { Len uint8 Family uint8 Port uint16 Addr [4]byte /* in_addr */ Zero [8]int8 } type RawSockaddrInet6 struct { Len uint8 Family uint8 Port uint16 Flowinfo uint32 Addr [16]byte /* in6_addr */ Scope_id uint32 } type RawSockaddrUnix struct { Len uint8 Family uint8 Path [104]int8 } type RawSockaddrDatalink struct { Len uint8 Family uint8 Index uint16 Type uint8 Nlen uint8 Alen uint8 Slen uint8 Data [24]int8 } type RawSockaddr struct { Len uint8 Family uint8 Data [14]int8 } type RawSockaddrAny struct { Addr RawSockaddr Pad [92]int8 } type _Socklen uint32 type Linger struct { Onoff int32 Linger int32 } type Iovec struct { Base *byte Len uint64 } type IPMreq struct { Multiaddr [4]byte /* in_addr */ Interface [4]byte /* in_addr */ } type IPv6Mreq struct { Multiaddr [16]byte /* in6_addr */ Interface uint32 } type Msghdr struct { Name *byte Namelen uint32 Pad_cgo_0 [4]byte Iov *Iovec Iovlen uint32 Pad_cgo_1 [4]byte Control *byte Controllen uint32 Flags int32 } type Cmsghdr struct { Len uint32 Level int32 Type int32 } type Inet6Pktinfo struct { Addr [16]byte /* in6_addr */ Ifindex uint32 } type IPv6MTUInfo struct { Addr RawSockaddrInet6 Mtu uint32 } type ICMPv6Filter struct { Filt [8]uint32 } const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x20 SizeofLinger = 0x8 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 SizeofCmsghdr = 0xc SizeofInet6Pktinfo = 0x14 SizeofIPv6MTUInfo = 0x20 SizeofICMPv6Filter = 0x20 ) const ( PTRACE_TRACEME = 0x0 PTRACE_CONT = 0x7 PTRACE_KILL = 0x8 ) type Kevent_t struct { Ident uint64 Filter int16 Flags uint16 Fflags uint32 Data int64 Udata *byte } type FdSet struct { Bits [32]uint32 } const ( SizeofIfMsghdr = 0xf8 SizeofIfData = 0xe0 SizeofIfaMsghdr = 0x18 SizeofIfAnnounceMsghdr = 0x1a SizeofRtMsghdr = 0x60 SizeofRtMetrics = 0x38 ) type IfMsghdr struct { Msglen uint16 Version uint8 Type uint8 Hdrlen uint16 Index uint16 Tableid uint16 Pad1 uint8 Pad2 uint8 Addrs int32 Flags int32 Xflags int32 Data IfData } type IfData struct { Type uint8 Addrlen uint8 Hdrlen uint8 Link_state uint8 Mtu uint32 Metric uint32 Pad uint32 Baudrate uint64 Ipackets uint64 Ierrors uint64 Opackets uint64 Oerrors uint64 Collisions uint64 Ibytes uint64 Obytes uint64 Imcasts uint64 Omcasts uint64 Iqdrops uint64 Noproto uint64 Capabilities uint32 Pad_cgo_0 [4]byte Lastchange Timeval Mclpool [7]Mclpool Pad_cgo_1 [4]byte } type IfaMsghdr struct { Msglen uint16 Version uint8 Type uint8 Hdrlen uint16 Index uint16 Tableid uint16 Pad1 uint8 Pad2 uint8 Addrs int32 Flags int32 Metric int32 } type IfAnnounceMsghdr struct { Msglen uint16 Version uint8 Type uint8 Hdrlen uint16 Index uint16 What uint16 Name [16]int8 } type RtMsghdr struct { Msglen uint16 Version uint8 Type uint8 Hdrlen uint16 Index uint16 Tableid uint16 Priority uint8 Mpls uint8 Addrs int32 Flags int32 Fmask int32 Pid int32 Seq int32 Errno int32 Inits uint32 Rmx RtMetrics } type RtMetrics struct { Pksent uint64 Expire int64 Locks uint32 Mtu uint32 Refcnt uint32 Hopcount uint32 Recvpipe uint32 Sendpipe uint32 Ssthresh uint32 Rtt uint32 Rttvar uint32 Pad uint32 } type Mclpool struct { Grown int32 Alive uint16 Hwm uint16 Cwm uint16 Lwm uint16 } const ( SizeofBpfVersion = 0x4 SizeofBpfStat = 0x8 SizeofBpfProgram = 0x10 SizeofBpfInsn = 0x8 SizeofBpfHdr = 0x14 ) type BpfVersion struct { Major uint16 Minor uint16 } type BpfStat struct { Recv uint32 Drop uint32 } type BpfProgram struct { Len uint32 Pad_cgo_0 [4]byte Insns *BpfInsn } type BpfInsn struct { Code uint16 Jt uint8 Jf uint8 K uint32 } type BpfHdr struct { Tstamp BpfTimeval Caplen uint32 Datalen uint32 Hdrlen uint16 Pad_cgo_0 [2]byte } type BpfTimeval struct { Sec uint32 Usec uint32 } type Termios struct { Iflag uint32 Oflag uint32 Cflag uint32 Lflag uint32 Cc [20]uint8 Ispeed int32 Ospeed int32 }
{ "pile_set_name": "Github" }
/* (c) 2020 Open Source Geospatial Foundation - all rights reserved * This code is licensed under the GPL 2.0 license, available at the root * application directory. */ package org.geoserver.dggs.rhealpix; import java.util.logging.Level; import java.util.logging.Logger; import jep.JepException; import org.geoserver.ows.AbstractDispatcherCallback; import org.geoserver.ows.Request; import org.geotools.dggs.rhealpix.JEPWebRuntime; import org.geotools.util.logging.Logging; public class SharedInterpreterCleaner extends AbstractDispatcherCallback { static final Logger LOGGER = Logging.getLogger(SharedInterpreterCleaner.class); @Override public void finished(Request request) { try { JEPWebRuntime.closeThreadIntepreter(); } catch (JepException e) { LOGGER.log( Level.FINE, "Exception happened while cleaning up JEP shared runtime for rHealPix DDGGS support", e); } } }
{ "pile_set_name": "Github" }
@e-color-black: #000000; .e-text-black{ color: @e-color-black !important; } .e-background-black{ background-color: @e-color-black !important; }
{ "pile_set_name": "Github" }
from direct.wxwidgets.WxAppShell import * import os from . import ObjectGlobals as OG CLOSE_STDIN = "<CLOSE STDIN>" class StartupError(Exception): pass class Process: def __init__(self, parent, cmd, end_callback): self.process = wx.Process(parent) self.process.Redirect() self.process.pid = wx.Execute(cmd, wx.EXEC_ASYNC|wx.EXEC_MAKE_GROUP_LEADER, self.process) self.b = [] if self.process.pid: #what was up with wx.Process.Get*Stream names? self.process._stdin_ = self.process.GetOutputStream() self.process._stdout_ = self.process.GetInputStream() self.process._stderr_ = self.process.GetErrorStream() self.process.Bind(wx.EVT_END_PROCESS, end_callback) return raise StartupError def Poll(self, input=''): if (input or self.b) and self.process and self.process._stdin_: if self.b or len(input) > 512: if input: #if we don't chop up our input into resonably sized chunks, #some platforms (like Windows) will send some small number #of bytes per .write() call (sometimes 2 in the case of #Windows). self.b.extend([input[i:i+512] for i in range(0, len(input), 512)]) input = self.b.pop(0) self.process._stdin_.write(input) if hasattr(self.process._stdin_, "LastWrite"): y = self.process._stdin_.LastWrite() if y != len(input): self.b.insert(0, input[y:]) x = [] for s in (self.process._stderr_, self.process._stdout_): if s and s.CanRead(): x.append(s.read()) else: x.append('') return x def CloseInp(self): if self.process and self.process._stdin_: self.process.CloseOutput() self.process._stdin_ = None def Kill(self, ks='SIGKILL'): errors = {wx.KILL_BAD_SIGNAL: "KILL_BAD_SIGNAL", wx.KILL_ACCESS_DENIED: "KILL_ACCESS_DENIED", wx.KILL_ERROR: "KILL_ERROR"} if self.process: if ks == CLOSE_STDIN: self.CloseInp() return 1, None elif wx.Process.Exists(self.process.pid): signal = getattr(wx, ks) r = wx.Process.Kill(self.process.pid, signal, flags=wx.KILL_CHILDREN) else: r = 65535 self.CloseInp() return 1, None if r not in (wx.KILL_OK, wx.KILL_NO_PROCESS, 65535): return 0, (self.process.pid, signal, errors.get(r, "UNKNOWN_KILL_ERROR %s"%r)) else: return 1, None FROM_MAYA_TO_EGG = 0 FROM_BAM_TO_MAYA = 1 class MayaConverter(wx.Dialog): def __init__(self, parent, editor, mayaFile, callBack=None, obj=None, isAnim=False, convertMode=FROM_MAYA_TO_EGG): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="Maya Converter", pos=wx.DefaultPosition, size=(300, 200)) self.editor = editor self.obj = obj self.isAnim = isAnim self.callBack = callBack self.mayaFile = mayaFile self.mainPanel = wx.Panel(self, -1) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.mainPanel, 1, wx.EXPAND, 0) self.SetSizer(sizer) self.output = wx.TextCtrl(self.mainPanel, -1, style = wx.TE_MULTILINE, pos = (0, 0), size = (100, 400)) sizer2 = wx.BoxSizer(wx.VERTICAL) sizer2.Add(self.output, 1, wx.EXPAND, 0) self.mainPanel.SetSizer(sizer2) if convertMode == FROM_MAYA_TO_EGG: self.convertFromMaya() elif convertMode == FROM_BAM_TO_MAYA: self.convertToMaya() else: pass self.timer = wx.Timer(self, -1) self.Bind(wx.EVT_TIMER, self.onPoll, self.timer) self.timer.Start(100) def convertFromMaya(self): if self.isAnim: if self.obj: command = 'maya2egg -uo ft -a chan %s -o %s.anim.egg'%(self.mayaFile, self.mayaFile) self.process = Process(self, command, lambda p0=None: self.onProcessEnded(p0)) else: command = 'maya2egg -uo ft -a model %s -o %s.model.egg'%(self.mayaFile, self.mayaFile) self.process = Process(self, command, lambda p0=None: self.onModelProcessEnded(p0)) else: command = 'maya2egg -uo ft %s -o %s.egg'%(self.mayaFile, self.mayaFile) self.process = Process(self, command, lambda p0=None: self.onProcessEnded(p0)) def convertToMaya(self): bamFileName = self.mayaFile + ".bam" eggFileName = self.mayaFile + ".egg" command = 'bam2egg %s -o %s'%(bamFileName, eggFileName) self.process = Process(self, command, lambda p0=None: self.onBam2EggEnded(p0)) def onEgg2MayaEnded(self, evt): self.process.CloseInp() for i in self.process.Poll(): self.output.AppendText(i) self.process = None def onBam2EggEnded(self, evt): self.process.CloseInp() for i in self.process.Poll(): self.output.AppendText(i) eggFileName = self.mayaFile + ".egg" command = 'egg2maya -ui ft -uo ft %s -o %s'%(eggFileName, self.mayaFile) self.process = Process(self, command, lambda p0=None: self.onEgg2MayaEnded(p0)) def onPoll(self, evt): if self.process: for i in self.process.Poll(): self.output.AppendText(i) def onModelProcessEnded(self, evt): self.process.CloseInp() for i in self.process.Poll(): self.output.AppendText(i) self.process = None command = 'maya2egg -uo ft -a chan %s -o %s.anim.egg'%(self.mayaFile, self.mayaFile) self.process = Process(self, command, lambda p0 = None: self.onProcessEnded(p0)) def onProcessEnded(self, evt): self.process.CloseInp() for i in self.process.Poll(): self.output.AppendText(i) self.output.AppendText('Converting %s is finished\n'%self.mayaFile) self.process = None name = os.path.basename(self.mayaFile) if self.isAnim: if self.obj: objDef = self.obj[OG.OBJ_DEF] objNP = self.obj[OG.OBJ_NP] animName = "%s.anim.egg"%self.mayaFile if animName not in objDef.anims: objDef.anims.append(animName) name = os.path.basename(animName) objNP.loadAnims({name:animName}) objNP.loop(name) self.obj[OG.OBJ_ANIM] = animName self.editor.ui.objectPropertyUI.updateProps(self.obj) return else: modelName = "%s.model.egg"%self.mayaFile animName = "%s.anim.egg"%self.mayaFile result = [name, modelName, animName] else: modelName = "%s.egg"%self.mayaFile result = [name, modelName] if self.callBack: self.callBack(result)
{ "pile_set_name": "Github" }
/////////////////////////////////////////////////////////////////////// // Copyright (c) 2017 VMware, Inc. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 /////////////////////////////////////////////////////////////////////// // Code generated by go-swagger; DO NOT EDIT. package policy // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "net/http" "time" "golang.org/x/net/context" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" strfmt "github.com/go-openapi/strfmt" "github.com/vmware/dispatch/pkg/api/v1" ) // NewUpdatePolicyParams creates a new UpdatePolicyParams object // with the default values initialized. func NewUpdatePolicyParams() *UpdatePolicyParams { var () return &UpdatePolicyParams{ timeout: cr.DefaultTimeout, } } // NewUpdatePolicyParamsWithTimeout creates a new UpdatePolicyParams object // with the default values initialized, and the ability to set a timeout on a request func NewUpdatePolicyParamsWithTimeout(timeout time.Duration) *UpdatePolicyParams { var () return &UpdatePolicyParams{ timeout: timeout, } } // NewUpdatePolicyParamsWithContext creates a new UpdatePolicyParams object // with the default values initialized, and the ability to set a context for a request func NewUpdatePolicyParamsWithContext(ctx context.Context) *UpdatePolicyParams { var () return &UpdatePolicyParams{ Context: ctx, } } // NewUpdatePolicyParamsWithHTTPClient creates a new UpdatePolicyParams object // with the default values initialized, and the ability to set a custom HTTPClient for a request func NewUpdatePolicyParamsWithHTTPClient(client *http.Client) *UpdatePolicyParams { var () return &UpdatePolicyParams{ HTTPClient: client, } } /*UpdatePolicyParams contains all the parameters to send to the API endpoint for the update policy operation typically these are written to a http.Request */ type UpdatePolicyParams struct { /*XDispatchOrg*/ XDispatchOrg string /*Body Policy object */ Body *v1.Policy /*PolicyName Name of Policy to work on */ PolicyName string timeout time.Duration Context context.Context HTTPClient *http.Client } // WithTimeout adds the timeout to the update policy params func (o *UpdatePolicyParams) WithTimeout(timeout time.Duration) *UpdatePolicyParams { o.SetTimeout(timeout) return o } // SetTimeout adds the timeout to the update policy params func (o *UpdatePolicyParams) SetTimeout(timeout time.Duration) { o.timeout = timeout } // WithContext adds the context to the update policy params func (o *UpdatePolicyParams) WithContext(ctx context.Context) *UpdatePolicyParams { o.SetContext(ctx) return o } // SetContext adds the context to the update policy params func (o *UpdatePolicyParams) SetContext(ctx context.Context) { o.Context = ctx } // WithHTTPClient adds the HTTPClient to the update policy params func (o *UpdatePolicyParams) WithHTTPClient(client *http.Client) *UpdatePolicyParams { o.SetHTTPClient(client) return o } // SetHTTPClient adds the HTTPClient to the update policy params func (o *UpdatePolicyParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } // WithXDispatchOrg adds the xDispatchOrg to the update policy params func (o *UpdatePolicyParams) WithXDispatchOrg(xDispatchOrg string) *UpdatePolicyParams { o.SetXDispatchOrg(xDispatchOrg) return o } // SetXDispatchOrg adds the xDispatchOrg to the update policy params func (o *UpdatePolicyParams) SetXDispatchOrg(xDispatchOrg string) { o.XDispatchOrg = xDispatchOrg } // WithBody adds the body to the update policy params func (o *UpdatePolicyParams) WithBody(body *v1.Policy) *UpdatePolicyParams { o.SetBody(body) return o } // SetBody adds the body to the update policy params func (o *UpdatePolicyParams) SetBody(body *v1.Policy) { o.Body = body } // WithPolicyName adds the policyName to the update policy params func (o *UpdatePolicyParams) WithPolicyName(policyName string) *UpdatePolicyParams { o.SetPolicyName(policyName) return o } // SetPolicyName adds the policyName to the update policy params func (o *UpdatePolicyParams) SetPolicyName(policyName string) { o.PolicyName = policyName } // WriteToRequest writes these params to a swagger request func (o *UpdatePolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err } var res []error // header param X-Dispatch-Org if err := r.SetHeaderParam("X-Dispatch-Org", o.XDispatchOrg); err != nil { return err } if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err } } // path param policyName if err := r.SetPathParam("policyName", o.PolicyName); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
{ "pile_set_name": "Github" }
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using Google.Apis.Auth.OAuth2; using Google.Cloud.ClientTesting; using System.IO; namespace Google.Cloud.Storage.V1.Tests.Conformance { /// <summary> /// Simple centralized access to the conformance test data. /// </summary> public static class StorageConformanceTestData { /// <summary> /// The service account credential used in conformance tests. /// </summary> public static ServiceAccountCredential TestCredential { get; } /// <summary> /// All conformance tests. /// </summary> public static ConformanceTestData<TestFile> TestData { get; } static StorageConformanceTestData() { TestData = ConformanceTestData.Load<TestFile>("storage", "v1"); var serviceAccountFile = Path.Combine(TestData.DataPath, "test_service_account.not-a-test.json"); TestCredential = (ServiceAccountCredential) GoogleCredential.FromFile(serviceAccountFile).UnderlyingCredential; } } }
{ "pile_set_name": "Github" }
/// @ref gtx_scalar_relational /// @file glm/gtx/scalar_relational.hpp /// /// @see core (dependence) /// /// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational /// @ingroup gtx /// /// Include <glm/gtx/scalar_relational.hpp> to use the features of this extension. /// /// Extend a position from a source to a position at a defined length. #pragma once // Dependency: #include "../glm.hpp" #ifndef GLM_ENABLE_EXPERIMENTAL # error "GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." #endif #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTX_extend extension included") #endif namespace glm { /// @addtogroup gtx_scalar_relational /// @{ /// @} }//namespace glm #include "scalar_relational.inl"
{ "pile_set_name": "Github" }