code
stringlengths
5
1.01M
repo_name
stringlengths
5
84
path
stringlengths
4
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
5
1.01M
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
// File__Duplicate - Duplication of some formats // Copyright (C) 2007-2012 MediaArea.net SARL, Info@MediaArea.net // // This library is free software: you can redistribute it and/or modify it // under the terms of the GNU Library General Public License as published by // the Free Software Foundation, either version 2 of the License, or // any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with this library. If not, see <http://www.gnu.org/licenses/>. // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Duplication helper for some specific formats // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_AVC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Video/File_Avc.h" #include "MediaInfo/MediaInfo_Config.h" #include "MediaInfo/MediaInfo_Config_MediaInfo.h" #include "ZenLib/ZtringList.h" #include "ZenLib/File.h" #include <cstring> using namespace ZenLib; using namespace std; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Options //*************************************************************************** //--------------------------------------------------------------------------- void File_Avc::Option_Manage() { #if MEDIAINFO_DUPLICATE //File__Duplicate configuration if (File__Duplicate_HasChanged()) { //Autorisation of other streams Streams[0x07].ShouldDuplicate=true; } #endif //MEDIAINFO_DUPLICATE } //*************************************************************************** // Set //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DUPLICATE bool File_Avc::File__Duplicate_Set (const Ztring &Value) { ZtringList List(Value); //Searching Target bool IsForUs=false; std::vector<ZtringList::iterator> Targets_ToAdd; std::vector<ZtringList::iterator> Targets_ToRemove; std::vector<ZtringList::iterator> Orders_ToAdd; std::vector<ZtringList::iterator> Orders_ToRemove; for (ZtringList::iterator Current=List.begin(); Current<List.end(); ++Current) { //Detecting if we want to remove bool ToRemove=false; if (Current->find(__T('-'))==0) { ToRemove=true; Current->erase(Current->begin()); } //Managing targets if (Current->find(__T("file:"))==0 || Current->find(__T("memory:"))==0) (ToRemove?Targets_ToRemove:Targets_ToAdd).push_back(Current); //Parser name else if (Current->find(__T("parser=Avc"))==0) IsForUs=true; //Managing orders else (ToRemove?Orders_ToRemove:Orders_ToAdd).push_back(Current); } //For us? if (!IsForUs) return false; //Configuration of initial values frame_num_Old=(int32u)-1; Duplicate_Buffer_Size=0; SPS_PPS_AlreadyDone=false; FLV=false; //For each target to add for (std::vector<ZtringList::iterator>::iterator Target=Targets_ToAdd.begin(); Target<Targets_ToAdd.end(); ++Target) Writer.Configure(**Target); //For each order to add for (std::vector<ZtringList::iterator>::iterator Order=Orders_ToAdd.begin(); Order<Orders_ToAdd.end(); ++Order) if ((**Order)==__T("format=Flv")) FLV=true; return true; } #endif //MEDIAINFO_DUPLICATE //*************************************************************************** // Write //*************************************************************************** #if MEDIAINFO_DUPLICATE void File_Avc::File__Duplicate_Write (int64u Element_Code, int32u frame_num) { const int8u* ToAdd=Buffer+Buffer_Offset-(size_t)Header_Size+3; size_t ToAdd_Size=(size_t)(Element_Size+Header_Size-3); if (!SPS_PPS_AlreadyDone) { if (Element_Code==7) { std::memcpy(Duplicate_Buffer, ToAdd, ToAdd_Size); Duplicate_Buffer_Size=ToAdd_Size; } else if (Element_Code==8) { // Form: // 8 bytes : PTS // 8 bytes : DTS // 8 bytes : Size (without header) // 1 byte : Type (0=Frame, 1=Header); // 7 bytes : Reserved size_t Extra; if (FLV) Extra=1; //FLV else Extra=0; //MPEG-4 int8u Header[32]; int64u2BigEndian(Header+ 0, FrameInfo.PTS); int64u2BigEndian(Header+ 8, FrameInfo.DTS); int64u2BigEndian(Header+16, 5+Extra+2+Duplicate_Buffer_Size+1+2+ToAdd_Size); //5+Extra for SPS_SQS header, 2 for SPS size, 1 for PPS count, 2 for PPS size Header[24]=1; int56u2BigEndian(Header+25, 0); Writer.Write(Header, 32); //SPS_PPS int8u* SPS_SQS=new int8u[5+Extra]; if (Extra==1) { SPS_SQS[0]=0x01; //Profile FLV SPS_SQS[1]=(!seq_parameter_sets.empty() && seq_parameter_sets[0])?seq_parameter_sets[0]->profile_idc:0x00; //Compatible Profile. TODO: Handling more than 1 seq_parameter_set SPS_SQS[2]=0x00; //Reserved } else { SPS_SQS[0]=(!seq_parameter_sets.empty() && seq_parameter_sets[0])?seq_parameter_sets[0]->profile_idc:0x00; //Profile MPEG-4. TODO: Handling more than 1 seq_parameter_set SPS_SQS[1]=0x00; //Compatible Profile } SPS_SQS[2+Extra]=(!seq_parameter_sets.empty() && seq_parameter_sets[0])?seq_parameter_sets[0]->level_idc:0x00; //Level. TODO: Handling more than 1 seq_parameter_set SPS_SQS[3+Extra]=0xFF; //Reserved + Size of NALU length minus 1 SPS_SQS[4+Extra]=0xE1; //Reserved + seq_parameter_set count Writer.Write(SPS_SQS, 5+Extra); //NALU int8u NALU[2]; NALU[0]=((Duplicate_Buffer_Size)>> 8)&0xFF; NALU[1]=((Duplicate_Buffer_Size)>> 0)&0xFF; Writer.Write(NALU, 2); //SPS Writer.Write(Duplicate_Buffer, Duplicate_Buffer_Size); Duplicate_Buffer_Size=0; //PPS count SPS_SQS[0]=0x01; //pic_parameter_set count Writer.Write(SPS_SQS, 1); delete[] SPS_SQS; //NALU NALU[0]=((ToAdd_Size)>> 8)&0xFF; NALU[1]=((ToAdd_Size)>> 0)&0xFF; Writer.Write(NALU, 2); //PPS Writer.Write(ToAdd, ToAdd_Size); SPS_PPS_AlreadyDone=true; } } else if (frame_num!=(int32u)-1) { if (frame_num!=frame_num_Old && frame_num_Old!=(int32u)-1 && frame_num!=(int32u)-1) { // Form: // 8 bytes : PTS // 8 bytes : DTS // 8 bytes : Size (without header) // 1 byte : Type (0=Frame, 1=Header); // 7 bytes : Reserved int8u Header[32]; int64u2BigEndian(Header+ 0, FrameInfo.PTS); int64u2BigEndian(Header+ 8, FrameInfo.DTS); int64u2BigEndian(Header+16, Duplicate_Buffer_Size); Header[24]=0; int56u2BigEndian(Header+25, 0); Writer.Write(Header, 32); Writer.Write(Duplicate_Buffer, Duplicate_Buffer_Size); Duplicate_Buffer_Size=0; } //NALU int32u2BigEndian(Duplicate_Buffer+Duplicate_Buffer_Size, (int32u)ToAdd_Size); //4 bytes for NALU header Duplicate_Buffer_Size+=4; //Frame (partial) std::memcpy(Duplicate_Buffer+Duplicate_Buffer_Size, ToAdd, ToAdd_Size); Duplicate_Buffer_Size+=ToAdd_Size; frame_num_Old=frame_num; } } #endif //MEDIAINFO_DUPLICATE //*************************************************************************** // Output_Buffer //*************************************************************************** //--------------------------------------------------------------------------- #if MEDIAINFO_DUPLICATE size_t File_Avc::Output_Buffer_Get (const String &) { return Writer.Output_Buffer_Get(); } #endif //MEDIAINFO_DUPLICATE //--------------------------------------------------------------------------- #if MEDIAINFO_DUPLICATE size_t File_Avc::Output_Buffer_Get (size_t) { return Writer.Output_Buffer_Get(); } #endif //MEDIAINFO_DUPLICATE } //NameSpace #endif //MEDIAINFO_AVC_YES
MikeSouza/mpc-hc
src/thirdparty/MediaInfo/MediaInfo/Video/File_Avc_Duplicate.cpp
C++
gpl-3.0
9,917
[ 30522, 1013, 1013, 5371, 1035, 1035, 24473, 1011, 4241, 21557, 1997, 2070, 11630, 1013, 1013, 9385, 1006, 1039, 1007, 2289, 1011, 2262, 2865, 12069, 2050, 1012, 5658, 18906, 2140, 1010, 18558, 1030, 2865, 12069, 2050, 1012, 5658, 1013, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package adept.common; /*- * #%L * adept-api * %% * Copyright (C) 2012 - 2017 Raytheon BBN Technologies * %% * 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. * #L% */ import static com.google.common.base.Preconditions.checkArgument; import java.io.Serializable; import java.util.List; /** * The Class LatticePath. */ public class LatticePath implements Serializable { private static final long serialVersionUID = -3112044093379521747L; /** The weight. */ private float weight; /** The token stream list. */ private List<TokenStream> tokenStreamList; /** * Instantiates a new lattice path. */ public LatticePath() { super(); } /** * Gets the weight. * * @return the weight */ public float getWeight() { return weight; } /** * Sets the weight. * * @param weight the new weight */ public void setWeight(float weight) { this.weight = weight; } /** * Gets the token stream list. * * @return the token stream list */ public List<TokenStream> getTokenStreamList() { return tokenStreamList; } /** * Sets the token stream list. * * @param tokenStreamList the new token stream list */ public void setTokenStreamList(List<TokenStream> tokenStreamList) { checkArgument(tokenStreamList != null); this.tokenStreamList = tokenStreamList; } }
BBN-E/Adept
adept-api/src/main/java/adept/common/LatticePath.java
Java
apache-2.0
1,846
[ 30522, 7427, 26398, 1012, 2691, 1025, 1013, 1008, 1011, 1008, 1001, 1003, 1048, 1008, 26398, 1011, 17928, 1008, 1003, 1003, 1008, 9385, 1006, 1039, 1007, 2262, 1011, 2418, 4097, 10760, 2239, 22861, 2078, 6786, 1008, 1003, 1003, 1008, 7000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!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 (version 1.7.0) on Mon Jan 13 19:53:37 EST 2014 --> <title>Uses of Class org.drip.analytics.holset.ZUSHoliday</title> <meta name="date" content="2014-01-13"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.drip.analytics.holset.ZUSHoliday"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><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/drip/analytics/holset/ZUSHoliday.html" title="class in org.drip.analytics.holset">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-files/index-1.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/drip/analytics/holset/\class-useZUSHoliday.html" target="_top">Frames</a></li> <li><a href="ZUSHoliday.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All 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.drip.analytics.holset.ZUSHoliday" class="title">Uses of Class<br>org.drip.analytics.holset.ZUSHoliday</h2> </div> <div class="classUseContainer">No usage of org.drip.analytics.holset.ZUSHoliday</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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/drip/analytics/holset/ZUSHoliday.html" title="class in org.drip.analytics.holset">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-files/index-1.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/drip/analytics/holset/\class-useZUSHoliday.html" target="_top">Frames</a></li> <li><a href="ZUSHoliday.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All 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 ======= --> </body> </html>
tectronics/splinelibrary
2.3/docs/Javadoc/org/drip/analytics/holset/class-use/ZUSHoliday.html
HTML
apache-2.0
4,253
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 5890, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2013.07.08 at 01:02:29 PM CEST // @XmlSchema(namespace = "http://uri.etsi.org/m2m", xmlns = { @XmlNs(namespaceURI = "http://uri.etsi.org/m2m", prefix = "om2m")}, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.eclipse.om2m.commons.resource; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlSchema;
BeliliFahem/om2m-java-client-api
src/main/java/org/eclipse/om2m/commons/resource/package-info.java
Java
epl-1.0
667
[ 30522, 1013, 1013, 1013, 1013, 2023, 5371, 2001, 7013, 2011, 1996, 9262, 21246, 4294, 2005, 20950, 8031, 1006, 13118, 2497, 1007, 4431, 7375, 1010, 1058, 2475, 1012, 1016, 1012, 1021, 1013, 1013, 2156, 1026, 1037, 17850, 12879, 1027, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.diff.tools.fragmented; import com.intellij.diff.DiffContext; import com.intellij.diff.actions.AllLinesIterator; import com.intellij.diff.actions.BufferedLineIterator; import com.intellij.diff.actions.impl.OpenInEditorWithMouseAction; import com.intellij.diff.actions.impl.SetEditorSettingsAction; import com.intellij.diff.comparison.DiffTooBigException; import com.intellij.diff.contents.DocumentContent; import com.intellij.diff.fragments.LineFragment; import com.intellij.diff.requests.ContentDiffRequest; import com.intellij.diff.requests.DiffRequest; import com.intellij.diff.tools.util.*; import com.intellij.diff.tools.util.base.InitialScrollPositionSupport; import com.intellij.diff.tools.util.base.ListenerDiffViewerBase; import com.intellij.diff.tools.util.base.TextDiffSettingsHolder.TextDiffSettings; import com.intellij.diff.tools.util.base.TextDiffViewerUtil; import com.intellij.diff.tools.util.side.TwosideTextDiffViewer; import com.intellij.diff.tools.util.text.TwosideTextDiffProvider; import com.intellij.diff.util.*; import com.intellij.diff.util.DiffUserDataKeysEx.ScrollToPolicy; import com.intellij.icons.AllIcons; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.command.undo.UndoManager; import com.intellij.openapi.diff.DiffBundle; import com.intellij.openapi.diff.LineTokenizer; import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.actionSystem.EditorActionManager; import com.intellij.openapi.editor.actionSystem.ReadonlyFragmentModificationHandler; import com.intellij.openapi.editor.colors.EditorColors; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.highlighter.EditorHighlighter; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.UserDataHolder; import com.intellij.pom.Navigatable; import com.intellij.util.containers.ContainerUtil; import gnu.trove.TIntFunction; import org.jetbrains.annotations.*; import javax.swing.*; import java.util.*; import static com.intellij.diff.util.DiffUtil.getLinesContent; public class UnifiedDiffViewer extends ListenerDiffViewerBase { @NotNull protected final EditorEx myEditor; @NotNull protected final Document myDocument; @NotNull private final UnifiedDiffPanel myPanel; @NotNull private final SetEditorSettingsAction myEditorSettingsAction; @NotNull private final PrevNextDifferenceIterable myPrevNextDifferenceIterable; @NotNull private final MyStatusPanel myStatusPanel; @NotNull private final MyInitialScrollHelper myInitialScrollHelper = new MyInitialScrollHelper(); @NotNull private final MyFoldingModel myFoldingModel; @NotNull private final TwosideTextDiffProvider.NoIgnore myTextDiffProvider; @NotNull protected Side myMasterSide = Side.RIGHT; @Nullable private ChangedBlockData myChangedBlockData; private final boolean[] myForceReadOnlyFlags; private boolean myReadOnlyLockSet = false; private boolean myDuringOnesideDocumentModification; private boolean myDuringTwosideDocumentModification; private boolean myStateIsOutOfDate; // whether something was changed since last rediff private boolean mySuppressEditorTyping; // our state is inconsistent. No typing can be handled correctly public UnifiedDiffViewer(@NotNull DiffContext context, @NotNull DiffRequest request) { super(context, (ContentDiffRequest)request); myPrevNextDifferenceIterable = new MyPrevNextDifferenceIterable(); myStatusPanel = new MyStatusPanel(); myForceReadOnlyFlags = TextDiffViewerUtil.checkForceReadOnly(myContext, myRequest); boolean leftEditable = isEditable(Side.LEFT, false); boolean rightEditable = isEditable(Side.RIGHT, false); if (leftEditable && !rightEditable) myMasterSide = Side.LEFT; if (!leftEditable && rightEditable) myMasterSide = Side.RIGHT; myDocument = EditorFactory.getInstance().createDocument(""); myEditor = DiffUtil.createEditor(myDocument, myProject, true, true); List<JComponent> titles = DiffUtil.createTextTitles(myRequest, ContainerUtil.list(myEditor, myEditor)); UnifiedContentPanel contentPanel = new UnifiedContentPanel(titles, myEditor); myPanel = new UnifiedDiffPanel(myProject, contentPanel, this, myContext); myFoldingModel = new MyFoldingModel(myEditor, this); myEditorSettingsAction = new SetEditorSettingsAction(getTextSettings(), getEditors()); myEditorSettingsAction.applyDefaults(); myTextDiffProvider = DiffUtil.createNoIgnoreTextDiffProvider(getProject(), getRequest(), getTextSettings(), this::rediff, this); new MyOpenInEditorWithMouseAction().install(getEditors()); TextDiffViewerUtil.checkDifferentDocuments(myRequest); DiffUtil.registerAction(new ReplaceSelectedChangesAction(Side.LEFT, true), myPanel); DiffUtil.registerAction(new AppendSelectedChangesAction(Side.LEFT, true), myPanel); DiffUtil.registerAction(new ReplaceSelectedChangesAction(Side.RIGHT, true), myPanel); DiffUtil.registerAction(new AppendSelectedChangesAction(Side.RIGHT, true), myPanel); } @Override @CalledInAwt protected void onInit() { super.onInit(); installEditorListeners(); installTypingSupport(); myPanel.setLoadingContent(); // We need loading panel only for initial rediff() myPanel.setPersistentNotifications(DiffUtil.getCustomNotifications(myContext, myRequest)); } @Override @CalledInAwt protected void onDispose() { super.onDispose(); EditorFactory.getInstance().releaseEditor(myEditor); } @Override @CalledInAwt protected void processContextHints() { super.processContextHints(); Side side = DiffUtil.getUserData(myRequest, myContext, DiffUserDataKeys.MASTER_SIDE); if (side != null) myMasterSide = side; myInitialScrollHelper.processContext(myRequest); } @Override @CalledInAwt protected void updateContextHints() { super.updateContextHints(); myInitialScrollHelper.updateContext(myRequest); myFoldingModel.updateContext(myRequest, getFoldingModelSettings()); } @CalledInAwt protected void updateEditorCanBeTyped() { myEditor.setViewer(mySuppressEditorTyping || !isEditable(myMasterSide, true)); } private void installTypingSupport() { if (!isEditable(myMasterSide, false)) return; updateEditorCanBeTyped(); myEditor.getColorsScheme().setColor(EditorColors.READONLY_FRAGMENT_BACKGROUND_COLOR, null); // guarded blocks EditorActionManager.getInstance().setReadonlyFragmentModificationHandler(myDocument, new MyReadonlyFragmentModificationHandler()); myDocument.putUserData(UndoManager.ORIGINAL_DOCUMENT, getDocument(myMasterSide)); // use undo of master document myDocument.addDocumentListener(new MyOnesideDocumentListener()); } @NotNull @Override @CalledInAwt public List<AnAction> createToolbarActions() { List<AnAction> group = new ArrayList<>(myTextDiffProvider.getToolbarActions()); group.add(new MyToggleExpandByDefaultAction()); group.add(new MyReadOnlyLockAction()); group.add(myEditorSettingsAction); group.add(Separator.getInstance()); group.addAll(super.createToolbarActions()); return group; } @NotNull @Override @CalledInAwt public List<AnAction> createPopupActions() { List<AnAction> group = new ArrayList<>(myTextDiffProvider.getPopupActions()); group.add(new MyToggleExpandByDefaultAction()); group.add(Separator.getInstance()); group.addAll(super.createPopupActions()); return group; } @NotNull protected List<AnAction> createEditorPopupActions() { List<AnAction> group = new ArrayList<>(); if (isEditable(Side.RIGHT, false)) { group.add(new ReplaceSelectedChangesAction(Side.LEFT, false)); group.add(new ReplaceSelectedChangesAction(Side.RIGHT, false)); } group.add(Separator.getInstance()); group.addAll(TextDiffViewerUtil.createEditorPopupActions()); return group; } @CalledInAwt protected void installEditorListeners() { new TextDiffViewerUtil.EditorActionsPopup(createEditorPopupActions()).install(getEditors()); } // // Diff // @Override @CalledInAwt protected void onSlowRediff() { super.onSlowRediff(); myStatusPanel.setBusy(true); } @Override @NotNull protected Runnable performRediff(@NotNull final ProgressIndicator indicator) { try { indicator.checkCanceled(); final Document document1 = getContent1().getDocument(); final Document document2 = getContent2().getDocument(); final CharSequence[] texts = ReadAction.compute(() -> { return new CharSequence[]{document1.getImmutableCharSequence(), document2.getImmutableCharSequence()}; }); final List<LineFragment> fragments = myTextDiffProvider.compare(texts[0], texts[1], indicator); final DocumentContent content1 = getContent1(); final DocumentContent content2 = getContent2(); indicator.checkCanceled(); TwosideDocumentData data = ReadAction.compute(() -> { indicator.checkCanceled(); UnifiedFragmentBuilder builder = new UnifiedFragmentBuilder(fragments, document1, document2, myMasterSide); builder.exec(); indicator.checkCanceled(); EditorHighlighter highlighter = buildHighlighter(myProject, content1, content2, texts[0], texts[1], builder.getRanges(), builder.getText().length()); UnifiedEditorRangeHighlighter rangeHighlighter = new UnifiedEditorRangeHighlighter(myProject, document1, document2, builder.getRanges()); return new TwosideDocumentData(builder, highlighter, rangeHighlighter); }); UnifiedFragmentBuilder builder = data.getBuilder(); FileType fileType = content2.getContentType() == null ? content1.getContentType() : content2.getContentType(); LineNumberConvertor convertor1 = builder.getConvertor1(); LineNumberConvertor convertor2 = builder.getConvertor2(); List<LineRange> changedLines = builder.getChangedLines(); boolean isContentsEqual = builder.isEqual(); CombinedEditorData editorData = new CombinedEditorData(builder.getText(), data.getHighlighter(), data.getRangeHighlighter(), fileType, convertor1.createConvertor(), convertor2.createConvertor()); return apply(editorData, builder.getBlocks(), convertor1, convertor2, changedLines, isContentsEqual); } catch (DiffTooBigException e) { return () -> { clearDiffPresentation(); myPanel.setTooBigContent(); }; } catch (ProcessCanceledException e) { throw e; } catch (Throwable e) { LOG.error(e); return () -> { clearDiffPresentation(); myPanel.setErrorContent(); }; } } private void clearDiffPresentation() { myPanel.resetNotifications(); myStatusPanel.setBusy(false); destroyChangedBlockData(); myStateIsOutOfDate = false; mySuppressEditorTyping = false; updateEditorCanBeTyped(); } @CalledInAwt protected void markSuppressEditorTyping() { mySuppressEditorTyping = true; updateEditorCanBeTyped(); } @CalledInAwt protected void markStateIsOutOfDate() { myStateIsOutOfDate = true; if (myChangedBlockData != null) { for (UnifiedDiffChange diffChange : myChangedBlockData.getDiffChanges()) { diffChange.updateGutterActions(); } } } @Nullable private EditorHighlighter buildHighlighter(@Nullable Project project, @NotNull DocumentContent content1, @NotNull DocumentContent content2, @NotNull CharSequence text1, @NotNull CharSequence text2, @NotNull List<HighlightRange> ranges, int textLength) { EditorHighlighter highlighter1 = DiffUtil.initEditorHighlighter(project, content1, text1); EditorHighlighter highlighter2 = DiffUtil.initEditorHighlighter(project, content2, text2); if (highlighter1 == null && highlighter2 == null) return null; if (highlighter1 == null) highlighter1 = DiffUtil.initEmptyEditorHighlighter(text1); if (highlighter2 == null) highlighter2 = DiffUtil.initEmptyEditorHighlighter(text2); return new UnifiedEditorHighlighter(myDocument, highlighter1, highlighter2, ranges, textLength); } @NotNull private Runnable apply(@NotNull final CombinedEditorData data, @NotNull final List<ChangedBlock> blocks, @NotNull final LineNumberConvertor convertor1, @NotNull final LineNumberConvertor convertor2, @NotNull final List<LineRange> changedLines, final boolean isContentsEqual) { return () -> { myFoldingModel.updateContext(myRequest, getFoldingModelSettings()); LineCol oldCaretPosition = LineCol.fromOffset(myDocument, myEditor.getCaretModel().getPrimaryCaret().getOffset()); Pair<int[], Side> oldCaretLineTwoside = transferLineFromOneside(oldCaretPosition.line); clearDiffPresentation(); if (isContentsEqual) { boolean equalCharsets = TextDiffViewerUtil.areEqualCharsets(getContents()); boolean equalSeparators = TextDiffViewerUtil.areEqualLineSeparators(getContents()); myPanel.addNotification(DiffNotifications.createEqualContents(equalCharsets, equalSeparators)); } TIntFunction foldingLineConvertor = myFoldingModel.getLineNumberConvertor(); TIntFunction contentConvertor1 = DiffUtil.getContentLineConvertor(getContent1()); TIntFunction contentConvertor2 = DiffUtil.getContentLineConvertor(getContent2()); myEditor.getGutterComponentEx().setLineNumberConvertor( mergeLineConverters(contentConvertor1, data.getLineConvertor1(), foldingLineConvertor), mergeLineConverters(contentConvertor2, data.getLineConvertor2(), foldingLineConvertor)); ApplicationManager.getApplication().runWriteAction(() -> { myDuringOnesideDocumentModification = true; try { myDocument.setText(data.getText()); } finally { myDuringOnesideDocumentModification = false; } }); if (data.getHighlighter() != null) myEditor.setHighlighter(data.getHighlighter()); DiffUtil.setEditorCodeStyle(myProject, myEditor, data.getFileType()); if (data.getRangeHighlighter() != null) data.getRangeHighlighter().apply(myProject, myDocument); ArrayList<UnifiedDiffChange> diffChanges = new ArrayList<>(blocks.size()); for (ChangedBlock block : blocks) { diffChanges.add(new UnifiedDiffChange(this, block)); } List<RangeMarker> guarderRangeBlocks = new ArrayList<>(); if (!myEditor.isViewer()) { for (ChangedBlock block : blocks) { LineRange range = myMasterSide.select(block.getRange2(), block.getRange1()); if (range.isEmpty()) continue; TextRange textRange = DiffUtil.getLinesRange(myDocument, range.start, range.end); guarderRangeBlocks.add(createGuardedBlock(textRange.getStartOffset(), textRange.getEndOffset())); } int textLength = myDocument.getTextLength(); // there are 'fake' newline at the very end guarderRangeBlocks.add(createGuardedBlock(textLength, textLength)); } myChangedBlockData = new ChangedBlockData(diffChanges, guarderRangeBlocks, convertor1, convertor2, isContentsEqual); int newCaretLine = transferLineToOneside(oldCaretLineTwoside.second, oldCaretLineTwoside.second.select(oldCaretLineTwoside.first)); myEditor.getCaretModel().moveToOffset(LineCol.toOffset(myDocument, newCaretLine, oldCaretPosition.column)); myFoldingModel.install(changedLines, myRequest, getFoldingModelSettings()); myInitialScrollHelper.onRediff(); myStatusPanel.update(); myPanel.setGoodContent(); myEditor.getGutterComponentEx().revalidateMarkup(); }; } @NotNull private RangeMarker createGuardedBlock(int start, int end) { RangeMarker block = myDocument.createGuardedBlock(start, end); block.setGreedyToLeft(true); block.setGreedyToRight(true); return block; } private static TIntFunction mergeLineConverters(@Nullable TIntFunction contentConvertor, @NotNull TIntFunction unifiedConvertor, @NotNull TIntFunction foldingConvertor) { return DiffUtil.mergeLineConverters(DiffUtil.mergeLineConverters(contentConvertor, unifiedConvertor), foldingConvertor); } /* * This convertor returns -1 if exact matching is impossible */ @CalledInAwt public int transferLineToOnesideStrict(@NotNull Side side, int line) { if (myChangedBlockData == null) return -1; return myChangedBlockData.getLineNumberConvertor(side).convertInv(line); } /* * This convertor returns -1 if exact matching is impossible */ @CalledInAwt public int transferLineFromOnesideStrict(@NotNull Side side, int line) { if (myChangedBlockData == null) return -1; return myChangedBlockData.getLineNumberConvertor(side).convert(line); } /* * This convertor returns 'good enough' position, even if exact matching is impossible */ @CalledInAwt public int transferLineToOneside(@NotNull Side side, int line) { if (myChangedBlockData == null) return line; return myChangedBlockData.getLineNumberConvertor(side).convertApproximateInv(line); } /* * This convertor returns 'good enough' position, even if exact matching is impossible */ @CalledInAwt @NotNull public Pair<int[], Side> transferLineFromOneside(int line) { int[] lines = new int[2]; if (myChangedBlockData == null) { lines[0] = line; lines[1] = line; return Pair.create(lines, myMasterSide); } LineNumberConvertor lineConvertor1 = myChangedBlockData.getLineNumberConvertor(Side.LEFT); LineNumberConvertor lineConvertor2 = myChangedBlockData.getLineNumberConvertor(Side.RIGHT); Side side = myMasterSide; lines[0] = lineConvertor1.convert(line); lines[1] = lineConvertor2.convert(line); if (lines[0] == -1 && lines[1] == -1) { lines[0] = lineConvertor1.convertApproximate(line); lines[1] = lineConvertor2.convertApproximate(line); } else if (lines[0] == -1) { lines[0] = lineConvertor1.convertApproximate(line); side = Side.RIGHT; } else if (lines[1] == -1) { lines[1] = lineConvertor2.convertApproximate(line); side = Side.LEFT; } return Pair.create(lines, side); } @CalledInAwt private void destroyChangedBlockData() { if (myChangedBlockData == null) return; for (UnifiedDiffChange change : myChangedBlockData.getDiffChanges()) { change.destroyHighlighter(); } for (RangeMarker block : myChangedBlockData.getGuardedRangeBlocks()) { myDocument.removeGuardedBlock(block); } myChangedBlockData = null; UnifiedEditorRangeHighlighter.erase(myProject, myDocument); myFoldingModel.destroy(); myStatusPanel.update(); } // // Typing // private class MyOnesideDocumentListener implements DocumentListener { @Override public void beforeDocumentChange(@NotNull DocumentEvent e) { if (myDuringOnesideDocumentModification) return; if (myChangedBlockData == null) { LOG.warn("oneside beforeDocumentChange - myChangedBlockData == null"); return; } // TODO: modify Document guard range logic - we can handle case, when whole read-only block is modified (ex: my replacing selection). try { myDuringTwosideDocumentModification = true; Document twosideDocument = getDocument(myMasterSide); LineCol onesideStartPosition = LineCol.fromOffset(myDocument, e.getOffset()); LineCol onesideEndPosition = LineCol.fromOffset(myDocument, e.getOffset() + e.getOldLength()); int line1 = onesideStartPosition.line; int line2 = onesideEndPosition.line + 1; int shift = DiffUtil.countLinesShift(e); int twosideStartLine = transferLineFromOnesideStrict(myMasterSide, onesideStartPosition.line); int twosideEndLine = transferLineFromOnesideStrict(myMasterSide, onesideEndPosition.line); if (twosideStartLine == -1 || twosideEndLine == -1) { // this should never happen logDebugInfo(e, onesideStartPosition, onesideEndPosition, twosideStartLine, twosideEndLine); markSuppressEditorTyping(); return; } int twosideStartOffset = twosideDocument.getLineStartOffset(twosideStartLine) + onesideStartPosition.column; int twosideEndOffset = twosideDocument.getLineStartOffset(twosideEndLine) + onesideEndPosition.column; twosideDocument.replaceString(twosideStartOffset, twosideEndOffset, e.getNewFragment()); for (UnifiedDiffChange change : myChangedBlockData.getDiffChanges()) { change.processChange(line1, line2, shift); } LineNumberConvertor masterConvertor = myChangedBlockData.getLineNumberConvertor(myMasterSide); LineNumberConvertor slaveConvertor = myChangedBlockData.getLineNumberConvertor(myMasterSide.other()); masterConvertor.handleMasterChange(line1, line2, shift, true); slaveConvertor.handleMasterChange(line1, line2, shift, false); } finally { // TODO: we can avoid marking state out-of-date in some simple cases (like in SimpleDiffViewer) // but this will greatly increase complexity, so let's wait if it's actually required by users markStateIsOutOfDate(); scheduleRediff(); myDuringTwosideDocumentModification = false; } } private void logDebugInfo(DocumentEvent e, LineCol onesideStartPosition, LineCol onesideEndPosition, int twosideStartLine, int twosideEndLine) { StringBuilder info = new StringBuilder(); Document document1 = getDocument(Side.LEFT); Document document2 = getDocument(Side.RIGHT); info.append("==== UnifiedDiffViewer Debug Info ===="); info.append("myMasterSide - ").append(myMasterSide).append('\n'); info.append("myLeftDocument.length() - ").append(document1.getTextLength()).append('\n'); info.append("myRightDocument.length() - ").append(document2.getTextLength()).append('\n'); info.append("myDocument.length() - ").append(myDocument.getTextLength()).append('\n'); info.append("e.getOffset() - ").append(e.getOffset()).append('\n'); info.append("e.getNewLength() - ").append(e.getNewLength()).append('\n'); info.append("e.getOldLength() - ").append(e.getOldLength()).append('\n'); info.append("onesideStartPosition - ").append(onesideStartPosition).append('\n'); info.append("onesideEndPosition - ").append(onesideEndPosition).append('\n'); info.append("twosideStartLine - ").append(twosideStartLine).append('\n'); info.append("twosideEndLine - ").append(twosideEndLine).append('\n'); Pair<int[], Side> pair1 = transferLineFromOneside(onesideStartPosition.line); Pair<int[], Side> pair2 = transferLineFromOneside(onesideEndPosition.line); info.append("non-strict transferStartLine - ").append(pair1.first[0]).append("-").append(pair1.first[1]) .append(":").append(pair1.second).append('\n'); info.append("non-strict transferEndLine - ").append(pair2.first[0]).append("-").append(pair2.first[1]) .append(":").append(pair2.second).append('\n'); info.append("---- UnifiedDiffViewer Debug Info ----"); LOG.warn(info.toString()); } } @Override protected void onDocumentChange(@NotNull DocumentEvent e) { if (myDuringTwosideDocumentModification) return; markStateIsOutOfDate(); markSuppressEditorTyping(); scheduleRediff(); } // // Modification operations // private abstract class ApplySelectedChangesActionBase extends AnAction implements DumbAware { @NotNull protected final Side myModifiedSide; protected final boolean myShortcut; ApplySelectedChangesActionBase(@NotNull Side modifiedSide, boolean shortcut) { myModifiedSide = modifiedSide; myShortcut = shortcut; } @Override public void update(@NotNull AnActionEvent e) { if (myShortcut) { // consume shortcut even if there are nothing to do - avoid calling some other action e.getPresentation().setEnabledAndVisible(true); return; } Editor editor = e.getData(CommonDataKeys.EDITOR); if (editor != getEditor()) { e.getPresentation().setEnabledAndVisible(false); return; } if (!isEditable(myModifiedSide, true) || isStateIsOutOfDate()) { e.getPresentation().setEnabledAndVisible(false); return; } e.getPresentation().setVisible(true); e.getPresentation().setEnabled(isSomeChangeSelected()); } @Override public void actionPerformed(@NotNull final AnActionEvent e) { final List<UnifiedDiffChange> selectedChanges = getSelectedChanges(); if (selectedChanges.isEmpty()) return; if (!isEditable(myModifiedSide, true)) return; if (isStateIsOutOfDate()) return; String title = e.getPresentation().getText() + " selected changes"; DiffUtil.executeWriteCommand(getDocument(myModifiedSide), e.getProject(), title, () -> { // state is invalidated during apply(), but changes are in reverse order, so they should not conflict with each other apply(ContainerUtil.reverse(selectedChanges)); scheduleRediff(); }); } protected boolean isSomeChangeSelected() { if (myChangedBlockData == null) return false; List<UnifiedDiffChange> changes = myChangedBlockData.getDiffChanges(); if (changes.isEmpty()) return false; return DiffUtil.isSomeRangeSelected(getEditor(), lines -> { return ContainerUtil.exists(changes, change -> isChangeSelected(change, lines)); }); } @NotNull @CalledInAwt private List<UnifiedDiffChange> getSelectedChanges() { if (myChangedBlockData == null) return Collections.emptyList(); final BitSet lines = DiffUtil.getSelectedLines(myEditor); List<UnifiedDiffChange> changes = myChangedBlockData.getDiffChanges(); return ContainerUtil.filter(changes, change -> isChangeSelected(change, lines)); } private boolean isChangeSelected(@NotNull UnifiedDiffChange change, @NotNull BitSet lines) { return DiffUtil.isSelectedByLine(lines, change.getLine1(), change.getLine2()); } @CalledWithWriteLock protected abstract void apply(@NotNull List<UnifiedDiffChange> changes); } private class ReplaceSelectedChangesAction extends ApplySelectedChangesActionBase { ReplaceSelectedChangesAction(@NotNull Side focusedSide, boolean shortcut) { super(focusedSide.other(), shortcut); setShortcutSet(ActionManager.getInstance().getAction(focusedSide.select("Diff.ApplyLeftSide", "Diff.ApplyRightSide")).getShortcutSet()); getTemplatePresentation().setText(focusedSide.select("Revert", "Accept")); getTemplatePresentation().setIcon(focusedSide.select(AllIcons.Diff.Remove, AllIcons.Actions.Checked)); } @Override protected void apply(@NotNull List<UnifiedDiffChange> changes) { for (UnifiedDiffChange change : changes) { replaceChange(change, myModifiedSide.other()); } } } private class AppendSelectedChangesAction extends ApplySelectedChangesActionBase { AppendSelectedChangesAction(@NotNull Side focusedSide, boolean shortcut) { super(focusedSide.other(), shortcut); setShortcutSet(ActionManager.getInstance().getAction(focusedSide.select("Diff.AppendLeftSide", "Diff.AppendRightSide")).getShortcutSet()); getTemplatePresentation().setText("Append"); getTemplatePresentation().setIcon(DiffUtil.getArrowDownIcon(focusedSide)); } @Override protected void apply(@NotNull List<UnifiedDiffChange> changes) { for (UnifiedDiffChange change : changes) { appendChange(change, myModifiedSide.other()); } } } @CalledWithWriteLock public void replaceChange(@NotNull UnifiedDiffChange change, @NotNull Side sourceSide) { Side outputSide = sourceSide.other(); Document document1 = getDocument(Side.LEFT); Document document2 = getDocument(Side.RIGHT); LineFragment lineFragment = change.getLineFragment(); DiffUtil.applyModification(outputSide.select(document1, document2), outputSide.getStartLine(lineFragment), outputSide.getEndLine(lineFragment), sourceSide.select(document1, document2), sourceSide.getStartLine(lineFragment), sourceSide.getEndLine(lineFragment)); // no need to mark myStateIsOutOfDate - it will be made by DocumentListener // TODO: we can apply change manually, without marking state out-of-date. But we'll have to schedule rediff anyway. } @CalledWithWriteLock public void appendChange(@NotNull UnifiedDiffChange change, @NotNull final Side sourceSide) { Side outputSide = sourceSide.other(); Document document1 = getDocument(Side.LEFT); Document document2 = getDocument(Side.RIGHT); LineFragment lineFragment = change.getLineFragment(); if (sourceSide.getStartLine(lineFragment) == sourceSide.getEndLine(lineFragment)) return; DiffUtil.applyModification(outputSide.select(document1, document2), outputSide.getEndLine(lineFragment), outputSide.getEndLine(lineFragment), sourceSide.select(document1, document2), sourceSide.getStartLine(lineFragment), sourceSide.getEndLine(lineFragment)); } // // Impl // @NotNull public TextDiffSettings getTextSettings() { return TextDiffViewerUtil.getTextSettings(myContext); } @NotNull public FoldingModelSupport.Settings getFoldingModelSettings() { return TextDiffViewerUtil.getFoldingModelSettings(myContext); } // // Getters // @NotNull public Side getMasterSide() { return myMasterSide; } @NotNull public EditorEx getEditor() { return myEditor; } @NotNull protected List<? extends EditorEx> getEditors() { return Collections.singletonList(myEditor); } @NotNull protected List<? extends DocumentContent> getContents() { //noinspection unchecked return (List<? extends DocumentContent>)(List)myRequest.getContents(); } @NotNull protected DocumentContent getContent(@NotNull Side side) { return side.select(getContents()); } @NotNull protected DocumentContent getContent1() { return getContent(Side.LEFT); } @NotNull protected DocumentContent getContent2() { return getContent(Side.RIGHT); } @CalledInAwt @Nullable protected List<UnifiedDiffChange> getDiffChanges() { return myChangedBlockData == null ? null : myChangedBlockData.getDiffChanges(); } @NotNull @Override public JComponent getComponent() { return myPanel; } @Nullable @Override public JComponent getPreferredFocusedComponent() { if (!myPanel.isGoodContent()) return null; return myEditor.getContentComponent(); } @NotNull @Override protected JComponent getStatusPanel() { return myStatusPanel; } @CalledInAwt public boolean isEditable(@NotNull Side side, boolean respectReadOnlyLock) { if (myReadOnlyLockSet && respectReadOnlyLock) return false; if (side.select(myForceReadOnlyFlags)) return false; return DiffUtil.canMakeWritable(getDocument(side)); } @NotNull public Document getDocument(@NotNull Side side) { return getContent(side).getDocument(); } protected boolean isStateIsOutOfDate() { return myStateIsOutOfDate; } // // Misc // @Nullable @Override protected Navigatable getNavigatable() { return getNavigatable(LineCol.fromCaret(myEditor)); } @CalledInAwt @Nullable protected UnifiedDiffChange getCurrentChange() { if (myChangedBlockData == null) return null; int caretLine = myEditor.getCaretModel().getLogicalPosition().line; for (UnifiedDiffChange change : myChangedBlockData.getDiffChanges()) { if (DiffUtil.isSelectedByLine(caretLine, change.getLine1(), change.getLine2())) return change; } return null; } @CalledInAwt @Nullable protected Navigatable getNavigatable(@NotNull LineCol position) { Pair<int[], Side> pair = transferLineFromOneside(position.line); int line1 = pair.first[0]; int line2 = pair.first[1]; Navigatable navigatable1 = getContent1().getNavigatable(new LineCol(line1, position.column)); Navigatable navigatable2 = getContent2().getNavigatable(new LineCol(line2, position.column)); if (navigatable1 == null) return navigatable2; if (navigatable2 == null) return navigatable1; return pair.second.select(navigatable1, navigatable2); } public static boolean canShowRequest(@NotNull DiffContext context, @NotNull DiffRequest request) { return TwosideTextDiffViewer.canShowRequest(context, request); } // // Actions // private class MyPrevNextDifferenceIterable extends PrevNextDifferenceIterableBase<UnifiedDiffChange> { @NotNull @Override protected List<UnifiedDiffChange> getChanges() { return ContainerUtil.notNullize(getDiffChanges()); } @NotNull @Override protected EditorEx getEditor() { return myEditor; } @Override protected int getStartLine(@NotNull UnifiedDiffChange change) { return change.getLine1(); } @Override protected int getEndLine(@NotNull UnifiedDiffChange change) { return change.getLine2(); } } private class MyOpenInEditorWithMouseAction extends OpenInEditorWithMouseAction { @Override protected Navigatable getNavigatable(@NotNull Editor editor, int line) { if (editor != myEditor) return null; return UnifiedDiffViewer.this.getNavigatable(new LineCol(line)); } } private class MyToggleExpandByDefaultAction extends TextDiffViewerUtil.ToggleExpandByDefaultAction { MyToggleExpandByDefaultAction() { super(getTextSettings()); } @Override protected void expandAll(boolean expand) { myFoldingModel.expandAll(expand); } } private class MyReadOnlyLockAction extends TextDiffViewerUtil.ReadOnlyLockAction { MyReadOnlyLockAction() { super(getContext()); applyDefaults(); } @Override protected void doApply(boolean readOnly) { myReadOnlyLockSet = readOnly; if (myChangedBlockData != null) { for (UnifiedDiffChange unifiedDiffChange : myChangedBlockData.getDiffChanges()) { unifiedDiffChange.updateGutterActions(); } } updateEditorCanBeTyped(); } @Override protected boolean canEdit() { return !myForceReadOnlyFlags[0] && DiffUtil.canMakeWritable(getContent1().getDocument()) || !myForceReadOnlyFlags[1] && DiffUtil.canMakeWritable(getContent2().getDocument()); } } // // Scroll from annotate // private class ChangedLinesIterator extends BufferedLineIterator { @NotNull private final List<UnifiedDiffChange> myChanges; private int myIndex = 0; private ChangedLinesIterator(@NotNull List<UnifiedDiffChange> changes) { myChanges = changes; init(); } @Override public boolean hasNextBlock() { return myIndex < myChanges.size(); } @Override public void loadNextBlock() { LOG.assertTrue(!myStateIsOutOfDate); UnifiedDiffChange change = myChanges.get(myIndex); myIndex++; LineFragment lineFragment = change.getLineFragment(); Document document = getContent2().getDocument(); CharSequence insertedText = getLinesContent(document, lineFragment.getStartLine2(), lineFragment.getEndLine2()); int lineNumber = lineFragment.getStartLine2(); LineTokenizer tokenizer = new LineTokenizer(insertedText.toString()); for (String line : tokenizer.execute()) { addLine(lineNumber, line); lineNumber++; } } } // // Helpers // @Nullable @Override public Object getData(@NotNull @NonNls String dataId) { if (DiffDataKeys.PREV_NEXT_DIFFERENCE_ITERABLE.is(dataId)) { return myPrevNextDifferenceIterable; } else if (DiffDataKeys.CURRENT_EDITOR.is(dataId)) { return myEditor; } else if (DiffDataKeys.CURRENT_CHANGE_RANGE.is(dataId)) { UnifiedDiffChange change = getCurrentChange(); if (change != null) { return new LineRange(change.getLine1(), change.getLine2()); } } return super.getData(dataId); } private class MyStatusPanel extends StatusPanel { @Nullable @Override protected String getMessage() { if (myChangedBlockData == null) return null; int changesCount = myChangedBlockData.getDiffChanges().size(); if (changesCount == 0 && !myChangedBlockData.isContentsEqual()) { return DiffBundle.message("diff.all.differences.ignored.text"); } return DiffBundle.message("diff.count.differences.status.text", changesCount); } } private static class TwosideDocumentData { @NotNull private final UnifiedFragmentBuilder myBuilder; @Nullable private final EditorHighlighter myHighlighter; @Nullable private final UnifiedEditorRangeHighlighter myRangeHighlighter; TwosideDocumentData(@NotNull UnifiedFragmentBuilder builder, @Nullable EditorHighlighter highlighter, @Nullable UnifiedEditorRangeHighlighter rangeHighlighter) { myBuilder = builder; myHighlighter = highlighter; myRangeHighlighter = rangeHighlighter; } @NotNull public UnifiedFragmentBuilder getBuilder() { return myBuilder; } @Nullable public EditorHighlighter getHighlighter() { return myHighlighter; } @Nullable public UnifiedEditorRangeHighlighter getRangeHighlighter() { return myRangeHighlighter; } } private static class ChangedBlockData { @NotNull private final List<UnifiedDiffChange> myDiffChanges; @NotNull private final List<RangeMarker> myGuardedRangeBlocks; @NotNull private final LineNumberConvertor myLineNumberConvertor1; @NotNull private final LineNumberConvertor myLineNumberConvertor2; private final boolean myIsContentsEqual; ChangedBlockData(@NotNull List<UnifiedDiffChange> diffChanges, @NotNull List<RangeMarker> guarderRangeBlocks, @NotNull LineNumberConvertor lineNumberConvertor1, @NotNull LineNumberConvertor lineNumberConvertor2, boolean isContentsEqual) { myDiffChanges = diffChanges; myGuardedRangeBlocks = guarderRangeBlocks; myLineNumberConvertor1 = lineNumberConvertor1; myLineNumberConvertor2 = lineNumberConvertor2; myIsContentsEqual = isContentsEqual; } @NotNull public List<UnifiedDiffChange> getDiffChanges() { return myDiffChanges; } @NotNull public List<RangeMarker> getGuardedRangeBlocks() { return myGuardedRangeBlocks; } @NotNull public LineNumberConvertor getLineNumberConvertor(@NotNull Side side) { return side.select(myLineNumberConvertor1, myLineNumberConvertor2); } public boolean isContentsEqual() { return myIsContentsEqual; } } private static class CombinedEditorData { @NotNull private final CharSequence myText; @Nullable private final EditorHighlighter myHighlighter; @Nullable private final UnifiedEditorRangeHighlighter myRangeHighlighter; @Nullable private final FileType myFileType; @NotNull private final TIntFunction myLineConvertor1; @NotNull private final TIntFunction myLineConvertor2; CombinedEditorData(@NotNull CharSequence text, @Nullable EditorHighlighter highlighter, @Nullable UnifiedEditorRangeHighlighter rangeHighlighter, @Nullable FileType fileType, @NotNull TIntFunction convertor1, @NotNull TIntFunction convertor2) { myText = text; myHighlighter = highlighter; myRangeHighlighter = rangeHighlighter; myFileType = fileType; myLineConvertor1 = convertor1; myLineConvertor2 = convertor2; } @NotNull public CharSequence getText() { return myText; } @Nullable public EditorHighlighter getHighlighter() { return myHighlighter; } @Nullable public UnifiedEditorRangeHighlighter getRangeHighlighter() { return myRangeHighlighter; } @Nullable public FileType getFileType() { return myFileType; } @NotNull public TIntFunction getLineConvertor1() { return myLineConvertor1; } @NotNull public TIntFunction getLineConvertor2() { return myLineConvertor2; } } private class MyInitialScrollHelper extends InitialScrollPositionSupport.TwosideInitialScrollHelper { @NotNull @Override protected List<? extends Editor> getEditors() { return UnifiedDiffViewer.this.getEditors(); } @Override protected void disableSyncScroll(boolean value) { } @Override public void onSlowRediff() { // Will not happen for initial rediff } @Nullable @Override protected LogicalPosition[] getCaretPositions() { LogicalPosition position = myEditor.getCaretModel().getLogicalPosition(); Pair<int[], Side> pair = transferLineFromOneside(position.line); LogicalPosition[] carets = new LogicalPosition[2]; carets[0] = getPosition(pair.first[0], position.column); carets[1] = getPosition(pair.first[1], position.column); return carets; } @Override protected boolean doScrollToPosition() { if (myCaretPosition == null) return false; LogicalPosition twosidePosition = myMasterSide.selectNotNull(myCaretPosition); int onesideLine = transferLineToOneside(myMasterSide, twosidePosition.line); LogicalPosition position = new LogicalPosition(onesideLine, twosidePosition.column); myEditor.getCaretModel().moveToLogicalPosition(position); if (myEditorsPosition != null && myEditorsPosition.isSame(position)) { DiffUtil.scrollToPoint(myEditor, myEditorsPosition.myPoints[0], false); } else { DiffUtil.scrollToCaret(myEditor, false); } return true; } @NotNull private LogicalPosition getPosition(int line, int column) { if (line == -1) return new LogicalPosition(0, 0); return new LogicalPosition(line, column); } private void doScrollToLine(@NotNull Side side, @NotNull LogicalPosition position) { int onesideLine = transferLineToOneside(side, position.line); DiffUtil.scrollEditor(myEditor, onesideLine, position.column, false); } @Override protected boolean doScrollToLine() { if (myScrollToLine == null) return false; doScrollToLine(myScrollToLine.first, new LogicalPosition(myScrollToLine.second, 0)); return true; } private boolean doScrollToChange(@NotNull ScrollToPolicy scrollToChangePolicy) { if (myChangedBlockData == null) return false; List<UnifiedDiffChange> changes = myChangedBlockData.getDiffChanges(); UnifiedDiffChange targetChange = scrollToChangePolicy.select(changes); if (targetChange == null) return false; DiffUtil.scrollEditor(myEditor, targetChange.getLine1(), false); return true; } @Override protected boolean doScrollToChange() { if (myScrollToChange == null) return false; return doScrollToChange(myScrollToChange); } @Override protected boolean doScrollToFirstChange() { return doScrollToChange(ScrollToPolicy.FIRST_CHANGE); } @Override protected boolean doScrollToContext() { if (myNavigationContext == null) return false; if (myChangedBlockData == null) return false; ChangedLinesIterator changedLinesIterator = new ChangedLinesIterator(myChangedBlockData.getDiffChanges()); int line = myNavigationContext.contextMatchCheck(changedLinesIterator); if (line == -1) { // this will work for the case, when spaces changes are ignored, and corresponding fragments are not reported as changed // just try to find target line -> +- AllLinesIterator allLinesIterator = new AllLinesIterator(getContent2().getDocument()); line = myNavigationContext.contextMatchCheck(allLinesIterator); } if (line == -1) return false; doScrollToLine(Side.RIGHT, new LogicalPosition(line, 0)); return true; } } private static class MyFoldingModel extends FoldingModelSupport { MyFoldingModel(@NotNull EditorEx editor, @NotNull Disposable disposable) { super(new EditorEx[]{editor}, disposable); } public void install(@Nullable List<LineRange> changedLines, @NotNull UserDataHolder context, @NotNull FoldingModelSupport.Settings settings) { Iterator<int[]> it = map(changedLines, line -> new int[]{ line.start, line.end }); install(it, context, settings); } @NotNull public TIntFunction getLineNumberConvertor() { return getLineConvertor(0); } } private static class MyReadonlyFragmentModificationHandler implements ReadonlyFragmentModificationHandler { @Override public void handle(ReadOnlyFragmentModificationException e) { // do nothing } } }
goodwinnk/intellij-community
platform/diff-impl/src/com/intellij/diff/tools/fragmented/UnifiedDiffViewer.java
Java
apache-2.0
47,029
[ 30522, 1013, 1013, 9385, 2456, 1011, 2760, 6892, 10024, 7076, 1055, 1012, 1054, 1012, 1051, 1012, 2224, 1997, 2023, 3120, 3642, 2003, 9950, 2011, 1996, 15895, 1016, 1012, 1014, 6105, 2008, 2064, 2022, 2179, 1999, 1996, 6105, 5371, 1012, 7...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * 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. */ package com.android.dialer.calllog; import android.content.Context; import android.content.res.Resources; import android.provider.CallLog.Calls; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.util.Log; import com.android.contacts.common.CallUtil; import com.android.dialer.PhoneCallDetails; import com.android.dialer.PhoneCallDetailsHelper; import com.android.dialer.R; /** * Helper class to fill in the views of a call log entry. */ /* package */class CallLogListItemHelper { private static final String TAG = "CallLogListItemHelper"; /** Helper for populating the details of a phone call. */ private final PhoneCallDetailsHelper mPhoneCallDetailsHelper; /** Helper for handling phone numbers. */ private final PhoneNumberDisplayHelper mPhoneNumberHelper; /** Resources to look up strings. */ private final Resources mResources; /** * Creates a new helper instance. * * @param phoneCallDetailsHelper used to set the details of a phone call * @param phoneNumberHelper used to process phone number */ public CallLogListItemHelper(PhoneCallDetailsHelper phoneCallDetailsHelper, PhoneNumberDisplayHelper phoneNumberHelper, Resources resources) { mPhoneCallDetailsHelper = phoneCallDetailsHelper; mPhoneNumberHelper = phoneNumberHelper; mResources = resources; } /** * Sets the name, label, and number for a contact. * * @param context The application context. * @param views the views to populate * @param details the details of a phone call needed to fill in the data */ public void setPhoneCallDetails( Context context, CallLogListItemViews views, PhoneCallDetails details) { mPhoneCallDetailsHelper.setPhoneCallDetails(views.phoneCallDetailsViews, details); // Set the accessibility text for the contact badge views.quickContactView.setContentDescription(getContactBadgeDescription(details)); // Set the primary action accessibility description views.primaryActionView.setContentDescription(getCallDescription(context, details)); // Cache name or number of caller. Used when setting the content descriptions of buttons // when the actions ViewStub is inflated. views.nameOrNumber = this.getNameOrNumber(details); } /** * Sets the accessibility descriptions for the action buttons in the action button ViewStub. * * @param views The views associated with the current call log entry. */ public void setActionContentDescriptions(CallLogListItemViews views) { if (views.nameOrNumber == null) { Log.e(TAG, "setActionContentDescriptions; name or number is null."); } // Calling expandTemplate with a null parameter will cause a NullPointerException. // Although we don't expect a null name or number, it is best to protect against it. CharSequence nameOrNumber = views.nameOrNumber == null ? "" : views.nameOrNumber; views.callBackButtonView.setContentDescription( TextUtils.expandTemplate( mResources.getString(R.string.description_call_back_action), nameOrNumber)); views.videoCallButtonView.setContentDescription( TextUtils.expandTemplate( mResources.getString(R.string.description_video_call_action), nameOrNumber)); views.voicemailButtonView.setContentDescription( TextUtils.expandTemplate( mResources.getString(R.string.description_voicemail_action), nameOrNumber)); views.detailsButtonView.setContentDescription( TextUtils.expandTemplate( mResources.getString(R.string.description_details_action), nameOrNumber)); } /** * Returns the accessibility description for the contact badge for a call log entry. * * @param details Details of call. * @return Accessibility description. */ private CharSequence getContactBadgeDescription(PhoneCallDetails details) { return mResources.getString(R.string.description_contact_details, getNameOrNumber(details)); } /** * Returns the accessibility description of the "return call/call" action for a call log * entry. * Accessibility text is a combination of: * {Voicemail Prefix}. {Number of Calls}. {Caller information} {Phone Account}. * If most recent call is a voicemail, {Voicemail Prefix} is "New Voicemail.", otherwise "". * * If more than one call for the caller, {Number of Calls} is: * "{number of calls} calls.", otherwise "". * * The {Caller Information} references the most recent call associated with the caller. * For incoming calls: * If missed call: Missed call from {Name/Number} {Call Type} {Call Time}. * If answered call: Answered call from {Name/Number} {Call Type} {Call Time}. * * For outgoing calls: * If outgoing: Call to {Name/Number] {Call Type} {Call Time}. * * Where: * {Name/Number} is the name or number of the caller (as shown in call log). * {Call type} is the contact phone number type (eg mobile) or location. * {Call Time} is the time since the last call for the contact occurred. * * The {Phone Account} refers to the account/SIM through which the call was placed or received * in multi-SIM devices. * * Examples: * 3 calls. New Voicemail. Missed call from Joe Smith mobile 2 hours ago on SIM 1. * * 2 calls. Answered call from John Doe mobile 1 hour ago. * * @param context The application context. * @param details Details of call. * @return Return call action description. */ public CharSequence getCallDescription(Context context, PhoneCallDetails details) { int lastCallType = getLastCallType(details.callTypes); boolean isVoiceMail = lastCallType == Calls.VOICEMAIL_TYPE; // Get the name or number of the caller. final CharSequence nameOrNumber = getNameOrNumber(details); // Get the call type or location of the caller; null if not applicable final CharSequence typeOrLocation = mPhoneCallDetailsHelper.getCallTypeOrLocation(details); // Get the time/date of the call final CharSequence timeOfCall = mPhoneCallDetailsHelper.getCallDate(details); SpannableStringBuilder callDescription = new SpannableStringBuilder(); // Prepend the voicemail indication. if (isVoiceMail) { callDescription.append(mResources.getString(R.string.description_new_voicemail)); } // Add number of calls if more than one. if (details.callTypes.length > 1) { callDescription.append(mResources.getString(R.string.description_num_calls, details.callTypes.length)); } // If call had video capabilities, add the "Video Call" string. if ((details.features & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO && CallUtil.isVideoEnabled(context)) { callDescription.append(mResources.getString(R.string.description_video_call)); } int stringID = getCallDescriptionStringID(details); String accountLabel = PhoneAccountUtils.getAccountLabel(context, details.accountHandle); // Use chosen string resource to build up the message. CharSequence onAccountLabel = accountLabel == null ? "" : TextUtils.expandTemplate( mResources.getString(R.string.description_phone_account), accountLabel); callDescription.append( TextUtils.expandTemplate( mResources.getString(stringID), nameOrNumber, // If no type or location can be determined, sub in empty string. typeOrLocation == null ? "" : typeOrLocation, timeOfCall, onAccountLabel)); return callDescription; } /** * Determine the appropriate string ID to describe a call for accessibility purposes. * * @param details Call details. * @return String resource ID to use. */ public int getCallDescriptionStringID(PhoneCallDetails details) { int lastCallType = getLastCallType(details.callTypes); int stringID; if (lastCallType == Calls.VOICEMAIL_TYPE || lastCallType == Calls.MISSED_TYPE) { //Message: Missed call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>, //<PhoneAccount>. stringID = R.string.description_incoming_missed_call; } else if (lastCallType == Calls.INCOMING_TYPE) { //Message: Answered call from <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>, //<PhoneAccount>. stringID = R.string.description_incoming_answered_call; } else { //Message: Call to <NameOrNumber>, <TypeOrLocation>, <TimeOfCall>, <PhoneAccount>. stringID = R.string.description_outgoing_call; } return stringID; } /** * Determine the call type for the most recent call. * @param callTypes Call types to check. * @return Call type. */ private int getLastCallType(int[] callTypes) { if (callTypes.length > 0) { return callTypes[0]; } else { return Calls.MISSED_TYPE; } } /** * Return the name or number of the caller specified by the details. * @param details Call details * @return the name (if known) of the caller, otherwise the formatted number. */ private CharSequence getNameOrNumber(PhoneCallDetails details) { final CharSequence recipient; if (!TextUtils.isEmpty(details.name)) { recipient = details.name; } else { recipient = mPhoneNumberHelper.getDisplayNumber(details.accountHandle, details.number, details.numberPresentation, details.formattedNumber); } return recipient; } }
s20121035/rk3288_android5.1_repo
packages/apps/Dialer/src/com/android/dialer/calllog/CallLogListItemHelper.java
Java
gpl-3.0
10,890
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2249, 1996, 11924, 2330, 3120, 2622, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Spartium fragrans Lam. ex Steud. SPECIES #### Status ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Spartium/Spartium fragrans/README.md
Markdown
apache-2.0
182
[ 30522, 1001, 12403, 28228, 2819, 25312, 17643, 3619, 16983, 1012, 4654, 26261, 6784, 1012, 2427, 1001, 1001, 1001, 1001, 3570, 3970, 1001, 1001, 1001, 1001, 2429, 2000, 2248, 3269, 3415, 5950, 1001, 1001, 1001, 1001, 2405, 1999, 19701, 1001...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
=pod =head1 NAME RSA_blinding_on, RSA_blinding_off - protect the RSA operation from timing attacks =head1 SYNOPSIS #include <openssl/rsa.h> int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); void RSA_blinding_off(RSA *rsa); =head1 DESCRIPTION RSA is vulnerable to timing attacks. In a setup where attackers can measure the time of RSA decryption or signature operations, blinding must be used to protect the RSA operation from that attack. RSA_blinding_on() turns blinding on for key B<rsa> and generates a random blinding factor. B<ctx> is B<NULL> or a pre-allocated and initialized B<BN_CTX>. The random number generator must be seeded prior to calling RSA_blinding_on(). RSA_blinding_off() turns blinding off and frees the memory used for the blinding factor. =head1 RETURN VALUES RSA_blinding_on() returns 1 on success, and 0 if an error occurred. RSA_blinding_off() returns no value. =head1 SEE ALSO L<rsa(3)|rsa(3)>, L<rand(3)|rand(3)> =head1 HISTORY RSA_blinding_on() and RSA_blinding_off() appeared in SSLeay 0.9.0. =cut
teeple/pns_server
work/install/node-v0.10.25/deps/openssl/openssl/doc/crypto/RSA_blinding_on.pod
Perl
gpl-2.0
1,043
[ 30522, 1027, 17491, 1027, 2132, 2487, 2171, 12667, 2050, 1035, 19709, 1035, 2006, 1010, 12667, 2050, 1035, 19709, 1035, 2125, 1011, 4047, 1996, 12667, 2050, 3169, 2013, 10984, 4491, 1027, 2132, 2487, 19962, 22599, 1001, 2421, 1026, 7480, 14...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Copyright (c) 2019 Infortrend Technology, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. class InfortrendNASTestData(object): fake_share_id = ['5a0aa06e-1c57-4996-be46-b81e360e8866', # NFS 'aac4fe64-7a9c-472a-b156-9adbb50b4d29'] # CIFS fake_share_name = [fake_share_id[0].replace('-', ''), fake_share_id[1].replace('-', '')] fake_channel_ip = ['172.27.112.223', '172.27.113.209'] fake_service_status_data = ('(64175, 1234, 272, 0)\n\n' '{"cliCode": ' '[{"Return": "0x0000", "CLI": "Successful"}], ' '"returnCode": [], ' '"data": ' '[{"A": ' '{"NFS": ' '{"displayName": "NFS", ' '"state_time": "2017-05-04 14:19:53", ' '"enabled": true, ' '"cpu_rate": "0.0", ' '"mem_rate": "0.0", ' '"state": "exited", ' '"type": "share"}}}]}\n\n') fake_folder_status_data = ('(64175, 1234, 1017, 0)\n\n' '{"cliCode": ' '[{"Return": "0x0000", "CLI": "Successful"}], ' '"returnCode": [], ' '"data": ' '[{"utility": "1.00", ' '"used": "33886208", ' '"subshare": true, ' '"share": false, ' '"worm": "", ' '"free": "321931374592", ' '"fsType": "xfs", ' '"owner": "A", ' '"readOnly": false, ' '"modifyTime": "2017-04-27 16:16", ' '"directory": "/share-pool-01/LV-1", ' '"volumeId": "6541BAFB2E6C57B6", ' '"mounted": true, ' '"size": "321965260800"}, ' '{"utility": "1.00", ' '"used": "33779712", ' '"subshare": false, ' '"share": false, ' '"worm": "", ' '"free": "107287973888", ' '"fsType": "xfs", ' '"owner": "A", ' '"readOnly": false, ' '"modifyTime": "2017-04-27 15:45", ' '"directory": "/share-pool-02/LV-1", ' '"volumeId": "147A8FB67DA39914", ' '"mounted": true, ' '"size": "107321753600"}]}\n\n') fake_nfs_status_off = [{ 'A': { 'NFS': { 'displayName': 'NFS', 'state_time': '2017-05-04 14:19:53', 'enabled': False, 'cpu_rate': '0.0', 'mem_rate': '0.0', 'state': 'exited', 'type': 'share', } } }] fake_folder_status = [{ 'utility': '1.00', 'used': '33886208', 'subshare': True, 'share': False, 'worm': '', 'free': '321931374592', 'fsType': 'xfs', 'owner': 'A', 'readOnly': False, 'modifyTime': '2017-04-27 16:16', 'directory': '/share-pool-01/LV-1', 'volumeId': '6541BAFB2E6C57B6', 'mounted': True, 'size': '321965260800'}, { 'utility': '1.00', 'used': '33779712', 'subshare': False, 'share': False, 'worm': '', 'free': '107287973888', 'fsType': 'xfs', 'owner': 'A', 'readOnly': False, 'modifyTime': '2017-04-27 15:45', 'directory': '/share-pool-02/LV-1', 'volumeId': '147A8FB67DA39914', 'mounted': True, 'size': '107321753600', }] def fake_get_channel_status(self, ch1_status='UP'): return [{ 'datalink': 'mgmt0', 'status': 'UP', 'typeConfig': 'DHCP', 'IP': '172.27.112.125', 'MAC': '00:d0:23:00:15:a6', 'netmask': '255.255.240.0', 'type': 'dhcp', 'gateway': '172.27.127.254'}, { 'datalink': 'CH0', 'status': 'UP', 'typeConfig': 'DHCP', 'IP': self.fake_channel_ip[0], 'MAC': '00:d0:23:80:15:a6', 'netmask': '255.255.240.0', 'type': 'dhcp', 'gateway': '172.27.127.254'}, { 'datalink': 'CH1', 'status': ch1_status, 'typeConfig': 'DHCP', 'IP': self.fake_channel_ip[1], 'MAC': '00:d0:23:40:15:a6', 'netmask': '255.255.240.0', 'type': 'dhcp', 'gateway': '172.27.127.254'}, { 'datalink': 'CH2', 'status': 'DOWN', 'typeConfig': 'DHCP', 'IP': '', 'MAC': '00:d0:23:c0:15:a6', 'netmask': '', 'type': '', 'gateway': ''}, { 'datalink': 'CH3', 'status': 'DOWN', 'typeConfig': 'DHCP', 'IP': '', 'MAC': '00:d0:23:20:15:a6', 'netmask': '', 'type': '', 'gateway': '', }] fake_fquota_status = [{ 'quota': '21474836480', 'used': '0', 'name': 'test-folder', 'type': 'subfolder', 'id': '537178178'}, { 'quota': '32212254720', 'used': '0', 'name': fake_share_name[0], 'type': 'subfolder', 'id': '805306752'}, { 'quota': '53687091200', 'used': '21474836480', 'name': fake_share_name[1], 'type': 'subfolder', 'id': '69'}, { 'quota': '94091997184', 'used': '0', 'type': 'subfolder', 'id': '70', "name": 'test-folder-02' }] fake_fquota_status_with_no_settings = [] def fake_get_share_status_nfs(self, status=False): fake_share_status_nfs = [{ 'ftp': False, 'cifs': False, 'oss': False, 'sftp': False, 'nfs': status, 'directory': '/LV-1/share-pool-01/' + self.fake_share_name[0], 'exist': True, 'afp': False, 'webdav': False }] if status: fake_share_status_nfs[0]['nfs_detail'] = { 'hostList': [{ 'uid': '65534', 'insecure': 'insecure', 'squash': 'all', 'access': 'ro', 'host': '*', 'gid': '65534', 'mode': 'async', 'no_subtree_check': 'no_subtree_check', }] } return fake_share_status_nfs def fake_get_share_status_cifs(self, status=False): fake_share_status_cifs = [{ 'ftp': False, 'cifs': status, 'oss': False, 'sftp': False, 'nfs': False, 'directory': '/share-pool-01/LV-1/' + self.fake_share_name[1], 'exist': True, 'afp': False, 'webdav': False }] if status: fake_share_status_cifs[0]['cifs_detail'] = { 'available': True, 'encrypt': False, 'description': '', 'sharename': 'cifs-01', 'failover': '', 'AIO': True, 'priv': 'None', 'recycle_bin': False, 'ABE': True, } return fake_share_status_cifs fake_subfolder_data = [{ 'size': '6', 'index': '34', 'description': '', 'encryption': '', 'isEnd': False, 'share': False, 'volumeId': '6541BAFB2E6C57B6', 'quota': '', 'modifyTime': '2017-04-06 11:35', 'owner': 'A', 'path': '/share-pool-01/LV-1/UserHome', 'subshare': True, 'type': 'subfolder', 'empty': False, 'name': 'UserHome'}, { 'size': '6', 'index': '39', 'description': '', 'encryption': '', 'isEnd': False, 'share': False, 'volumeId': '6541BAFB2E6C57B6', 'quota': '21474836480', 'modifyTime': '2017-04-27 15:44', 'owner': 'A', 'path': '/share-pool-01/LV-1/test-folder', 'subshare': False, 'type': 'subfolder', 'empty': True, 'name': 'test-folder'}, { 'size': '6', 'index': '45', 'description': '', 'encryption': '', 'isEnd': False, 'share': True, 'volumeId': '6541BAFB2E6C57B6', 'quota': '32212254720', 'modifyTime': '2017-04-27 16:15', 'owner': 'A', 'path': '/share-pool-01/LV-1/' + fake_share_name[0], 'subshare': False, 'type': 'subfolder', 'empty': True, 'name': fake_share_name[0]}, { 'size': '6', 'index': '512', 'description': '', 'encryption': '', 'isEnd': True, 'share': True, 'volumeId': '6541BAFB2E6C57B6', 'quota': '53687091200', 'modifyTime': '2017-04-27 16:16', 'owner': 'A', 'path': '/share-pool-01/LV-1/' + fake_share_name[1], 'subshare': False, 'type': 'subfolder', 'empty': True, 'name': fake_share_name[1]}, { 'size': '6', 'index': '777', 'description': '', 'encryption': '', 'isEnd': False, 'share': False, 'volumeId': '6541BAFB2E6C57B6', 'quota': '94091997184', 'modifyTime': '2017-04-28 15:44', 'owner': 'A', 'path': '/share-pool-01/LV-1/test-folder-02', 'subshare': False, 'type': 'subfolder', 'empty': True, 'name': 'test-folder-02' }] fake_cifs_user_list = [{ 'Superuser': 'No', 'Group': 'users', 'Description': '', 'Quota': 'none', 'PWD Expiry Date': '2291-01-19', 'Home Directory': '/share-pool-01/LV-1/UserHome/user01', 'UID': '100001', 'Type': 'Local', 'Name': 'user01'}, { 'Superuser': 'No', 'Group': 'users', 'Description': '', 'Quota': 'none', 'PWD Expiry Date': '2017-08-07', 'Home Directory': '/share-pool-01/LV-1/UserHome/user02', 'UID': '100002', 'Type': 'Local', 'Name': 'user02' }] fake_share_status_nfs_with_rules = [{ 'ftp': False, 'cifs': False, 'oss': False, 'sftp': False, 'nfs': True, 'directory': '/share-pool-01/LV-1/' + fake_share_name[0], 'exist': True, 'nfs_detail': { 'hostList': [{ 'uid': '65534', 'insecure': 'insecure', 'squash': 'all', 'access': 'ro', 'host': '*', 'gid': '65534', 'mode': 'async', 'no_subtree_check': 'no_subtree_check'}, { 'uid': '65534', 'insecure': 'insecure', 'squash': 'all', 'access': 'rw', 'host': '172.27.1.1', 'gid': '65534', 'mode': 'async', 'no_subtree_check': 'no_subtree_check'}, { 'uid': '65534', 'insecure': 'insecure', 'squash': 'all', 'access': 'rw', 'host': '172.27.1.2', 'gid': '65534', 'mode': 'async', 'no_subtree_check': 'no_subtree_check'}] }, 'afp': False, 'webdav': False, }] fake_share_status_cifs_with_rules = [ { 'permission': { 'Read': True, 'Write': True, 'Execute': True}, 'type': 'user', 'id': '100001', 'name': 'user01' }, { 'permission': { 'Read': True, 'Write': False, 'Execute': True}, 'type': 'user', 'id': '100002', 'name': 'user02' }, { 'permission': { 'Read': True, 'Write': False, 'Execute': True}, 'type': 'group@', 'id': '100', 'name': 'users' }, { 'permission': { 'Read': True, 'Write': False, 'Execute': True}, 'type': 'other@', 'id': '', 'name': '' } ]
openstack/manila
manila/tests/share/drivers/infortrend/fake_infortrend_nas_data.py
Python
apache-2.0
13,722
[ 30522, 1001, 9385, 1006, 1039, 1007, 10476, 18558, 5339, 7389, 2094, 2974, 1010, 4297, 1012, 1001, 2035, 2916, 9235, 1012, 1001, 1001, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * pins.h * * Created on: Feb 8, 2015 * Author: shaun */ #ifndef PINS_H_ #define PINS_H_ #define SET_DIRECTION_INNER(port, pin, out) if (out) {\ DDR##port |= _BV(DD##port##pin); \ } else { \ DDR##port &= ~_BV(DD##port##pin); \ } #define SET_DIRECTION(port, pin, out) SET_DIRECTION_INNER(port, pin, out) #define DIR_OUT 1 #define DIR_IN 0 #define WRITE_PIN_INNER(port, pin, out) do { if (out) {\ PORT##port |= _BV(PORT##port##pin); \ } else { \ PORT##port &= ~_BV(PORT##port##pin); \ } } while (0) #define WRITE_PIN(port, pin, out) WRITE_PIN_INNER(port, pin, out) #define TOGGLE_PIN_INNER(port, pin, out) do { if (out) {\ PIN##port |= _BV(PIN##port##pin); \ } else { \ PIN##port &= ~_BV(PIN##port##pin); \ } } while (0) #define TOGGLE_PIN(port, pin, out) TOGGLE_PIN_INNER(port, pin, out) #define PIN_ON 1 #define PIN_OFF 0 // Pin definitions #define LED_PORT D #define LED_PIN 7 // PWM A = PD3 = OC2B // PWM control for motor outputs 1 and 2 is on digital pin 3 #define PWM_A_PORT D #define PWM_A_PIN 3 #define PWM_A OCR2B // PWM B = PB3 = OC2A // PWM control for motor outputs 3 and 4 is on digital pin 11 #define PWM_B_PORT B #define PWM_B_PIN 3 #define PWM_B OCR2A // direction control for motor outputs 1 and 2 is on Arduino digital pin 12 #define DIR_A_PORT B #define DIR_A_PIN 4 // direction control for motor outputs 3 and 4 is on Arduino digital pin 13 #define DIR_B_PORT B #define DIR_B_PIN 5 // Pin connected to our active-low push switch. #define SWITCH_PORT B #define SWITCH_PIN 0 // Analog pins assignments. #define X_APIN 0 #define Y_APIN 1 #define GYRO_APIN 2 #define TILT_POT_APIN 3 #define GYRO_POT_APIN 4 #define X_POT_APIN 5 #endif /* PINS_H_ */
fasaxc/ArduRoller
pins.h
C
gpl-3.0
1,703
[ 30522, 1013, 1008, 1008, 16300, 1012, 1044, 1008, 1008, 2580, 2006, 1024, 13114, 1022, 1010, 2325, 1008, 3166, 1024, 16845, 1008, 1013, 1001, 2065, 13629, 2546, 16300, 1035, 1044, 1035, 1001, 9375, 16300, 1035, 1044, 1035, 1001, 9375, 2275,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
""" Control global computation context """ from collections import defaultdict _globals = defaultdict(lambda: None) _globals['callbacks'] = set() class set_options(object): """ Set global state within controled context This lets you specify various global settings in a tightly controlled with block Valid keyword arguments currently include: get - the scheduler to use pool - a thread or process pool cache - Cache to use for intermediate results func_loads/func_dumps - loads/dumps functions for serialization of data likely to contain functions. Defaults to dill.loads/dill.dumps rerun_exceptions_locally - rerun failed tasks in master process Example ------- >>> with set_options(get=dask.get): # doctest: +SKIP ... x = np.array(x) # uses dask.get internally """ def __init__(self, **kwargs): self.old = _globals.copy() _globals.update(kwargs) def __enter__(self): return def __exit__(self, type, value, traceback): _globals.clear() _globals.update(self.old)
wiso/dask
dask/context.py
Python
bsd-3-clause
1,121
[ 30522, 1000, 1000, 1000, 2491, 3795, 22334, 6123, 1000, 1000, 1000, 2013, 6407, 12324, 12398, 29201, 1035, 3795, 2015, 1027, 12398, 29201, 1006, 23375, 1024, 3904, 1007, 1035, 3795, 2015, 1031, 1005, 2655, 12221, 1005, 1033, 1027, 2275, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# PyQt5 Small application ##### 测试
LiJingkang/PyQt5
README.md
Markdown
apache-2.0
39
[ 30522, 1001, 1052, 2100, 4160, 2102, 2629, 2235, 4646, 1001, 1001, 1001, 1001, 1001, 100, 100, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
use actix::Addr; use actix_web::{http, middleware}; use actix_web::{web, App, HttpServer}; use diesel::r2d2::{self, ConnectionManager}; use diesel::PgConnection; use crate::database::DbExecutor; use badge::handlers::badge_handler; // use run::handlers::run_handler; use status::handlers::status_handler; pub type Pool = r2d2::Pool<ConnectionManager<PgConnection>>; #[derive(Clone)] pub struct WebState { pub db: Pool, pub db_actor: Addr<DbExecutor>, } pub fn http_server(state: WebState, http_bind: String, http_port: String) { use actix_web::middleware::cors::Cors; HttpServer::new(move || { App::new() .data(state.clone()) .wrap(middleware::Logger::default()) .wrap( Cors::new() // <- Construct CORS middleware builder .allowed_methods(vec!["GET", "POST", "OPTION"]) .allowed_headers(vec![http::header::AUTHORIZATION, http::header::ACCEPT]) .allowed_header(http::header::CONTENT_TYPE) .max_age(3600), ) .service(web::resource("/{project}/{workflow}/badge.svg").to_async(badge_handler)) .service(web::resource("/mon/status").to(status_handler)) }) .bind(format!("{}:{}", http_bind, http_port)) .unwrap() .start(); }
ovh/cds
contrib/uservices/badge/src/web.rs
Rust
bsd-3-clause
1,331
[ 30522, 2224, 2552, 7646, 1024, 1024, 5587, 2099, 1025, 2224, 2552, 7646, 1035, 4773, 1024, 1024, 1063, 8299, 1010, 2690, 8059, 1065, 1025, 2224, 2552, 7646, 1035, 4773, 1024, 1024, 1063, 4773, 1010, 10439, 1010, 16770, 2121, 6299, 1065, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Ext.define('Wif.setup.trend.trendnewEmploymentCard', { extend : 'Ext.form.Panel', project : null, title : 'Employment Trends', assocLuCbox : null, assocLuColIdx : 1, model : null, pendingChanges : null, sortKey : 'label', isEditing: true, isLoadingExisting: true, constructor : function(config) { var me = this; Ext.apply(this, config); var projectId = me.project.projectId; var isnew = me.project.isnew; me.isLoadingExisting = true; this.Output2 = []; this.gridfields = []; this.modelfields = []; this.modelfields.push("_id"); this.modelfields.push("item"); var gfield_id = { text : "_id", dataIndex : "_id", hidden: true }; var gfield = { text : "item", dataIndex : "item" }; this.gridfields.push(gfield_id); this.gridfields.push(gfield); var definition = this.project.getDefinition(); var rows =[]; var sortfields = []; var rows = definition.projections.sort(); _.log(me, 'projections', rows); for (var i = 0; i < rows.count(); i++) { sortfields.push(rows[i].label); } sortfields.sort(); for (var i = 0; i < sortfields.count(); i++) { var field = { text : sortfields[i], dataIndex : sortfields[i], editor: 'numberfield', type: 'number' }; this.gridfields.push(field); this.modelfields.push(sortfields[i]); } _.log(me, 'sortFields', sortfields); _.log(me, 'modelFields1', this.modelfields); _.log(me, 'gridFields', this.gridfields); var storeData = []; var sectors = definition.sectors; for (var i=0; i <sectors.length; i++) { var mjsonStr='{'; mjsonStr = mjsonStr + '\"_id\" :' + '\"' + sectors[i].label +'\",'; mjsonStr = mjsonStr + '\"item\" :' + '\"' + sectors[i].label +'\",'; for (var m = 2; m < me.modelfields.count(); m++) { var myear=me.modelfields[m]; mjsonStr = mjsonStr + '\"' + myear + '\"' + ':0,'; } mjsonStr = mjsonStr.substring(0,mjsonStr.length-1) + '}'; storeData.push(JSON.parse(mjsonStr)); } this.model = Ext.define('User', { extend: 'Ext.data.Model', fields: this.modelfields }); this.store = Ext.create('Ext.data.Store', { model: this.model, data : storeData }); this.grid = Ext.create('Ext.grid.Panel', { //title: 'Projection Population', selType: 'cellmodel', border : 0, margin : '0 5 5 5', store : this.store, height : 400, autoRender : true, columns : this.gridfields, flex: 1, viewConfig: { plugins: { ptype: 'gridviewdragdrop', dragText: 'Drag and drop to reorganize' } }, plugins: [ Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }) ] }); this.grid.reconfigure(this.store, this.gridfields); // var cmbData=[]; var cmbData ={}; var rows = definition.demographicTrends; // if (definition.demographicTrends2 == undefined) // { // definition.demographicTrends2= definition.demographicTrends; // } //this.Output2 = definition.demographicTrends; //var rows = this.Output2; var st='['; for (var i = 0; i< rows.length; i++) { st = st + '{\"label\":' + '\"' + rows[i].label+ '\"},'; } st = st.substring(0,st.length-1) + ']'; if (st == ']') { st = '[]'; } this.cmbStore = Ext.create('Ext.data.Store', { //autoLoad : true, fields: ['label'], data : JSON.parse(st) }); this.cmb=Ext.create('Ext.form.field.ComboBox', { extend : 'Aura.Util.RemoteComboBox', fieldLabel: 'Choose Trend', //width: 500, labelWidth: 200, store: this.cmbStore, //data : cmbData, queryMode: 'local', displayField: 'label', valueField: 'label', autoLoad : false, multiSelect : false, forceSelection: true, projectId : null, editable : true, allowBlank : false, emptyText : "Choose Trendo", //renderTo: Ext.getBody() listeners: { change: function (cb, newValue, oldValue, options) { console.log(newValue, oldValue); if (oldValue != undefined){ me.saveGrid(oldValue); } me.loadGrid(newValue); } } }); this.cmb.bindStore(this.cmbStore); var enumDistrictFieldSet = Ext.create('Ext.form.FieldSet', { columnWidth : 0.5, title : 'Trends', collapsible : true, margin : '15 5 5 0', defaults : { bodyPadding : 10, anchor : '90%' }, items : [this.cmb] }); this.items = [enumDistrictFieldSet,this.grid]; this.callParent(arguments); }, listeners : { activate : function() { _.log(this, 'activate'); //this.build(this.fillcombo()); this.build(); var definition = this.project.getDefinition(); this.Output2 = definition.demographicTrends; //this.Output2 = definition.demographicTrends; // if (definition.demographicTrends2 == undefined) // { // definition.demographicTrends2= definition.demographicTrends; // } // // this.Output2 = definition.demographicTrends2; //this.cmb.setValue(""); //this.build(function() { this.fillcombo; if (callback) { callback(); }}); } }, loadGrid : function(cmbValue) { var me = this, projectId = this.project.projectId; me.isLoadingExisting = true; var definition = this.project.getDefinition(); var storeDataNew = []; //if (definition.demographicTrends != undefined) if (this.Output2 != undefined) { //var mainrows = definition.demographicTrends; var mainrows = this.Output2; //for projection population var lsw1 = false; var storeData = []; var sectors = definition.sectors; for (var i=0; i <sectors.length; i++) { var mjson0Str='{'; mjson0Str = mjson0Str + '\"_id\" :' + '\"' + sectors[i].label +'\",'; mjson0Str = mjson0Str + '\"item\" :' + '\"' + sectors[i].label +'\",'; for (var m = 2; m < me.modelfields.count(); m++) { var myear=me.modelfields[m]; mjson0Str = mjson0Str + '\"' + myear + '\"' + ':0,'; } mjson0Str = mjson0Str.substring(0,mjson0Str.length-1) + '}'; storeData.push(JSON.parse(mjson0Str)); } this.store.removeAll(); this.grid.getSelectionModel().deselectAll(); this.store.loadData(storeData); this.grid.reconfigure(this.store, this.gridfields); this.store.each(function(record,idx){ val = record.get('_id'); var totalRows = mainrows.count(); for (var l = 0; l < totalRows; l++) { if (mainrows[l].label == cmbValue) { // var cnt0= mainrows[l].demographicData.count(); // for (var j = 0; j < cnt0; j++) // { // if (mainrows[l].demographicData[j]["@class"] == ".EmploymentDemographicData" ) // { var sectors = definition.sectors; for (var i=0; i <sectors.length; i++) { var jsonStr='{'; jsonStr = jsonStr + '\"_id\" :' + '\"' + sectors[i].label +'\",'; jsonStr = jsonStr + '\"item\" :' + '\"' + sectors[i].label +'\",'; if (val == sectors[i].label) { // if (lsw1 == false) // { for (var m = 0; m < me.modelfields.count(); m++) { var cnt01 = mainrows[l].demographicData.count(); for (var v = 0; v < cnt01; v++) { if (mainrows[l].demographicData[v]["@class"] == ".EmploymentDemographicData" ) { if ( me.modelfields[m] == mainrows[l].demographicData[v].projectionLabel) { var myear=me.modelfields[m]; if ( mainrows[l].demographicData[v].sectorLabel == sectors[i].label) { jsonStr = jsonStr + '\"' + myear + '\"' + ':' + mainrows[l].demographicData[v].employees + ','; } }//end if ( me.modelfields[m] }//end if (mainrows[l] }//end for (var v = 0 }//end for (var m = 0 jsonStr = jsonStr.substring(0,jsonStr.length-1) + '}'; storeDataNew.push(JSON.parse(jsonStr)); lsw1 = true; //}//end if lsw }//end if (sectors[i].label) }// end for sectors //}//end if (mainrows[l].demographicData[j]["@class"] //} //end for (var j = 0 }//end if (mainrows[l].label == cmbValue) }//end for (var l = 0) }); //end this.store }//end if definition.demographicTrends if (storeDataNew.length>0) { this.store.removeAll(); this.grid.getSelectionModel().deselectAll(); this.store.loadData(storeDataNew); this.grid.reconfigure(this.store, this.gridfields); } return true; }, //end build function saveGrid : function(cmbValue) { var me = this, projectId = this.project.projectId; me.isLoadingExisting = true; var definition = this.project.getDefinition(); var storeDataNew = []; var demographicData = []; //saving projection population var jsonStrTotal=''; for (var m = 2; m < this.modelfields.count(); m++) { // jsonStr='{'; // jsonStr = jsonStr + '\"@class\" :' + '\".EmploymentDemographicData\",'; // jsonStr = jsonStr + '\"projectionLabel\" :\"' +this.modelfields[m] + '\",'; var i = 0; var sectors = definition.sectors; for (var z=0; z <sectors.length; z++) { jsonStr='{'; jsonStr = jsonStr + '\"@class\" :' + '\".EmploymentDemographicData\",'; jsonStr = jsonStr + '\"projectionLabel\" :\"' +this.modelfields[m] + '\",'; var slbl = sectors[z].label; this.store.each(function(record,idx){ i = i + 1; //var x= '\"' +record.get('_id') + '\"'; if (record.get('_id') == slbl) { jsonStr = jsonStr + '\"sectorLabel\" :\"' +slbl + '\",'; var x1 = ':' + 0 +','; if (record.get(me.modelfields[m]) =='' || record.get(me.modelfields[m]) ==null) { x1 = ':' + 0 +','; } else { x1 = ':' + record.get(me.modelfields[m]) +','; } jsonStr = jsonStr + '\"employees\"' + x1; } }); jsonStr = jsonStr.substring(0,jsonStr.length-1); jsonStr = jsonStr + '}'; jsonStrTotal = jsonStrTotal + jsonStr + ','; //jsonStr = jsonStr.substring(0,jsonStr.length-1) + '}'; demographicData.push(JSON.parse(jsonStr)); } } var demographicTrends = []; jsonStrTotal = jsonStrTotal.substring(0,jsonStrTotal.length-1); var strNew = '[{'; //strNew = strNew + '\"label\" :' + '\"' + me.cmb.getValue() + '\",'; strNew = strNew + '\"label\" :' + '\"' + cmbValue + '\",'; var strOld = '\"' + 'demographicData' + '\"' + ':[' + jsonStrTotal +']'; strNew = strNew + strOld + '}]'; demographicTrends.push(JSON.parse(strNew)); for (var l = 0; l < this.Output2.count(); l++) { // if (this.Output2[l].label == cmbValue) // { // //this.Output2[l].demographicData.add = JSON.parse('[' + jsonStrTotal + ']'); // for(var t=0; t<this.Output2[l].demographicData.count(); t++) // { // if (this.Output2[l].demographicData[t]["@class"] == ".EmploymentDemographicData") // { // this.Output2[l].demographicData.removeAt(t); // } // } // } //this.Output2[l].demographicData.add(JSON.parse('[' + jsonStrTotal + ']')); //// this.Output2[l].demographicData = JSON.parse('[' + jsonStrTotal + ']'); } var emp =[]; emp.push(JSON.parse('[' + jsonStrTotal + ']')); for (var l = 0; l < this.Output2.count(); l++) { if (this.Output2[l].label == cmbValue) { ///this.Output[l].demographicData = JSON.parse('[' + jsonStrTotal + ']'); } if (this.Output2[l].label == cmbValue) { //this.Output[l].demographicData.add = JSON.parse('[' + jsonStrTotal + ']'); for(var t=0; t<this.Output2[l].demographicData.count(); t++) { if (this.Output2[l].demographicData[t]["@class"] == ".EmploymentDemographicData") { ////this.Output[l].demographicData.removeAt(t); } else if (this.Output2[l].demographicData[t]["@class"] == ".ResidentialDemographicData") { emp[0].push(this.Output2[l].demographicData[t]); } } } //////this.Output[l].demographicData.add(JSON.parse('[' + jsonStrTotal + ']')); } for (var l = 0; l < this.Output2.count(); l++) { if (this.Output2[l].label == cmbValue) { this.Output2[l].demographicData = emp[0]; } } var ccc=0; return true; }, //end build build : function() { var me = this, projectId = this.project.projectId; me.isLoadingExisting = true; var definition = this.project.getDefinition(); if (definition.demographicTrends != undefined) //if(this.Output2 != undefined) { var rows = definition.demographicTrends; //var rows = this.Output2; var st='['; for (var i = 0; i< rows.length; i++) { st = st + '{\"label\":' + '\"' + rows[i].label+ '\"},'; } st = st.substring(0,st.length-1) + ']'; var arr=[]; arr.push(JSON.parse(st)); this.cmbStore.removeAll(); this.cmbStore.load(JSON.parse(st)); this.cmb.store.loadData(JSON.parse(st),false); this.cmb.bindStore(this.cmbStore); } return true; }, //end build function validate : function(callback) { var me = this, gridValid = true; me.store.each(function(record) { if (!record.isValid()) { _.log(this, 'validate', 'record is not valid'); gridValid = false; } }); if (!gridValid) { Ext.Msg.alert('Status', 'All fields should have values!'); return false; } if (me.cmb.getValue() != undefined){ me.saveGrid(me.cmb.getValue()); } var definition = me.project.getDefinition(); Ext.merge(definition, { demographicTrends:this.Output2 }); me.project.setDefinition(definition); _.log(this, 'validate', _.translate3(this.store.data.items, me.sectorTranslators), me.project.getDefinition()); if (callback) { _.log(this, 'callback'); callback(); } return true; } });
AURIN/online-whatif-ui
src/main/webapp/js/wif/setup/trend/trendnewEmploymentCard.js
JavaScript
gpl-3.0
17,630
[ 30522, 4654, 2102, 1012, 9375, 1006, 1005, 15536, 2546, 1012, 16437, 1012, 9874, 1012, 9874, 2638, 8545, 8737, 4135, 25219, 3372, 11522, 1005, 1010, 1063, 7949, 1024, 1005, 4654, 2102, 1012, 2433, 1012, 5997, 1005, 1010, 2622, 1024, 19701, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*************************************************************************/ /*! @File @Title Server bridge for srvcore @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved @Description Implements the server side of the bridge for srvcore @License Dual MIT/GPLv2 The contents of this file are subject to the MIT license as set out below. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 ("GPL") in which case the provisions of GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of GPL, and not to allow others to use your version of this file under the terms of the MIT license, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by GPL as set out in the file called "GPL-COPYING" included in this distribution. If you do not delete the provisions above, a recipient may use your version of this file under the terms of either the MIT license or GPL. This License is also included in this distribution in the file called "MIT-COPYING". EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ #include <stddef.h> #include <asm/uaccess.h> #include "img_defs.h" #include "srvcore.h" #include "pvrsrv.h" #include "common_srvcore_bridge.h" #include "allocmem.h" #include "pvr_debug.h" #include "connection_server.h" #include "pvr_bridge.h" #include "rgx_bridge.h" #include "srvcore.h" #include "handle.h" #if defined (SUPPORT_AUTH) #include "osauth.h" #endif #include <linux/slab.h> /* *************************************************************************** * Bridge proxy functions */ static PVRSRV_ERROR ReleaseGlobalEventObjectResManProxy(IMG_HANDLE hResmanItem) { PVRSRV_ERROR eError; eError = ResManFreeResByPtr(hResmanItem); /* Freeing a resource should never fail... */ PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY)); return eError; } static PVRSRV_ERROR EventObjectCloseResManProxy(IMG_HANDLE hResmanItem) { PVRSRV_ERROR eError; eError = ResManFreeResByPtr(hResmanItem); /* Freeing a resource should never fail... */ PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY)); return eError; } /* *************************************************************************** * Server-side bridge entry points */ static IMG_INT PVRSRVBridgeConnect(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_CONNECT *psConnectIN, PVRSRV_BRIDGE_OUT_CONNECT *psConnectOUT, CONNECTION_DATA *psConnection) { PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_CONNECT); PVR_UNREFERENCED_PARAMETER(psConnection); psConnectOUT->eError = PVRSRVConnectKM( psConnectIN->ui32Flags, psConnectIN->ui32ClientBuildOptions, psConnectIN->ui32ClientDDKVersion, psConnectIN->ui32ClientDDKBuild, &psConnectOUT->ui8KernelArch, &psConnectOUT->ui32Log2PageSize); return 0; } static IMG_INT PVRSRVBridgeDisconnect(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_DISCONNECT *psDisconnectIN, PVRSRV_BRIDGE_OUT_DISCONNECT *psDisconnectOUT, CONNECTION_DATA *psConnection) { PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_DISCONNECT); PVR_UNREFERENCED_PARAMETER(psConnection); PVR_UNREFERENCED_PARAMETER(psDisconnectIN); psDisconnectOUT->eError = PVRSRVDisconnectKM( ); return 0; } static IMG_INT PVRSRVBridgeEnumerateDevices(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_ENUMERATEDEVICES *psEnumerateDevicesIN, PVRSRV_BRIDGE_OUT_ENUMERATEDEVICES *psEnumerateDevicesOUT, CONNECTION_DATA *psConnection) { PVRSRV_DEVICE_TYPE *peDeviceTypeInt = IMG_NULL; PVRSRV_DEVICE_CLASS *peDeviceClassInt = IMG_NULL; IMG_UINT32 *pui32DeviceIndexInt = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_ENUMERATEDEVICES); PVR_UNREFERENCED_PARAMETER(psConnection); PVR_UNREFERENCED_PARAMETER(psEnumerateDevicesIN); psEnumerateDevicesOUT->peDeviceType = psEnumerateDevicesIN->peDeviceType; psEnumerateDevicesOUT->peDeviceClass = psEnumerateDevicesIN->peDeviceClass; psEnumerateDevicesOUT->pui32DeviceIndex = psEnumerateDevicesIN->pui32DeviceIndex; { peDeviceTypeInt = OSAllocMem(PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_TYPE)); if (!peDeviceTypeInt) { psEnumerateDevicesOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY; goto EnumerateDevices_exit; } } { peDeviceClassInt = OSAllocMem(PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_CLASS)); if (!peDeviceClassInt) { psEnumerateDevicesOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY; goto EnumerateDevices_exit; } } { pui32DeviceIndexInt = OSAllocMem(PVRSRV_MAX_DEVICES * sizeof(IMG_UINT32)); if (!pui32DeviceIndexInt) { psEnumerateDevicesOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY; goto EnumerateDevices_exit; } } psEnumerateDevicesOUT->eError = PVRSRVEnumerateDevicesKM( &psEnumerateDevicesOUT->ui32NumDevices, peDeviceTypeInt, peDeviceClassInt, pui32DeviceIndexInt); if ( !OSAccessOK(PVR_VERIFY_WRITE, (IMG_VOID*) psEnumerateDevicesOUT->peDeviceType, (PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_TYPE))) || (OSCopyToUser(NULL, psEnumerateDevicesOUT->peDeviceType, peDeviceTypeInt, (PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_TYPE))) != PVRSRV_OK) ) { psEnumerateDevicesOUT->eError = PVRSRV_ERROR_INVALID_PARAMS; goto EnumerateDevices_exit; } if ( !OSAccessOK(PVR_VERIFY_WRITE, (IMG_VOID*) psEnumerateDevicesOUT->peDeviceClass, (PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_CLASS))) || (OSCopyToUser(NULL, psEnumerateDevicesOUT->peDeviceClass, peDeviceClassInt, (PVRSRV_MAX_DEVICES * sizeof(PVRSRV_DEVICE_CLASS))) != PVRSRV_OK) ) { psEnumerateDevicesOUT->eError = PVRSRV_ERROR_INVALID_PARAMS; goto EnumerateDevices_exit; } if ( !OSAccessOK(PVR_VERIFY_WRITE, (IMG_VOID*) psEnumerateDevicesOUT->pui32DeviceIndex, (PVRSRV_MAX_DEVICES * sizeof(IMG_UINT32))) || (OSCopyToUser(NULL, psEnumerateDevicesOUT->pui32DeviceIndex, pui32DeviceIndexInt, (PVRSRV_MAX_DEVICES * sizeof(IMG_UINT32))) != PVRSRV_OK) ) { psEnumerateDevicesOUT->eError = PVRSRV_ERROR_INVALID_PARAMS; goto EnumerateDevices_exit; } EnumerateDevices_exit: if (peDeviceTypeInt) OSFreeMem(peDeviceTypeInt); if (peDeviceClassInt) OSFreeMem(peDeviceClassInt); if (pui32DeviceIndexInt) OSFreeMem(pui32DeviceIndexInt); return 0; } static IMG_INT PVRSRVBridgeAcquireDeviceData(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_ACQUIREDEVICEDATA *psAcquireDeviceDataIN, PVRSRV_BRIDGE_OUT_ACQUIREDEVICEDATA *psAcquireDeviceDataOUT, CONNECTION_DATA *psConnection) { IMG_HANDLE hDevCookieInt = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_ACQUIREDEVICEDATA); psAcquireDeviceDataOUT->eError = PVRSRVAcquireDeviceDataKM( psAcquireDeviceDataIN->ui32DevIndex, psAcquireDeviceDataIN->eDeviceType, &hDevCookieInt); /* Exit early if bridged call fails */ if(psAcquireDeviceDataOUT->eError != PVRSRV_OK) { goto AcquireDeviceData_exit; } psAcquireDeviceDataOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase, &psAcquireDeviceDataOUT->hDevCookie, (IMG_HANDLE) hDevCookieInt, PVRSRV_HANDLE_TYPE_DEV_NODE, PVRSRV_HANDLE_ALLOC_FLAG_SHARED ); if (psAcquireDeviceDataOUT->eError != PVRSRV_OK) { goto AcquireDeviceData_exit; } AcquireDeviceData_exit: if (psAcquireDeviceDataOUT->eError != PVRSRV_OK) { } return 0; } static IMG_INT PVRSRVBridgeReleaseDeviceData(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_RELEASEDEVICEDATA *psReleaseDeviceDataIN, PVRSRV_BRIDGE_OUT_RELEASEDEVICEDATA *psReleaseDeviceDataOUT, CONNECTION_DATA *psConnection) { IMG_HANDLE hDevCookieInt = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_RELEASEDEVICEDATA); { /* Look up the address from the handle */ psReleaseDeviceDataOUT->eError = PVRSRVLookupHandle(psConnection->psHandleBase, (IMG_HANDLE *) &hDevCookieInt, psReleaseDeviceDataIN->hDevCookie, PVRSRV_HANDLE_TYPE_DEV_NODE); if(psReleaseDeviceDataOUT->eError != PVRSRV_OK) { goto ReleaseDeviceData_exit; } } psReleaseDeviceDataOUT->eError = PVRSRVReleaseDeviceDataKM( hDevCookieInt); /* Exit early if bridged call fails */ if(psReleaseDeviceDataOUT->eError != PVRSRV_OK) { goto ReleaseDeviceData_exit; } psReleaseDeviceDataOUT->eError = PVRSRVReleaseHandle(psConnection->psHandleBase, (IMG_HANDLE) psReleaseDeviceDataIN->hDevCookie, PVRSRV_HANDLE_TYPE_DEV_NODE); ReleaseDeviceData_exit: return 0; } static IMG_INT PVRSRVBridgeInitSrvConnect(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_INITSRVCONNECT *psInitSrvConnectIN, PVRSRV_BRIDGE_OUT_INITSRVCONNECT *psInitSrvConnectOUT, CONNECTION_DATA *psConnection) { PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_INITSRVCONNECT); PVR_UNREFERENCED_PARAMETER(psInitSrvConnectIN); psInitSrvConnectOUT->eError = PVRSRVInitSrvConnectKM(psConnection ); return 0; } static IMG_INT PVRSRVBridgeInitSrvDisconnect(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_INITSRVDISCONNECT *psInitSrvDisconnectIN, PVRSRV_BRIDGE_OUT_INITSRVDISCONNECT *psInitSrvDisconnectOUT, CONNECTION_DATA *psConnection) { PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_INITSRVDISCONNECT); psInitSrvDisconnectOUT->eError = PVRSRVInitSrvDisconnectKM(psConnection, psInitSrvDisconnectIN->bInitSuccesful, psInitSrvDisconnectIN->ui32ClientBuildOptions); return 0; } static IMG_INT PVRSRVBridgeAcquireGlobalEventObject(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_ACQUIREGLOBALEVENTOBJECT *psAcquireGlobalEventObjectIN, PVRSRV_BRIDGE_OUT_ACQUIREGLOBALEVENTOBJECT *psAcquireGlobalEventObjectOUT, CONNECTION_DATA *psConnection) { IMG_HANDLE hGlobalEventObjectInt = IMG_NULL; IMG_HANDLE hGlobalEventObjectInt2 = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_ACQUIREGLOBALEVENTOBJECT); PVR_UNREFERENCED_PARAMETER(psAcquireGlobalEventObjectIN); psAcquireGlobalEventObjectOUT->eError = AcquireGlobalEventObjectServer( &hGlobalEventObjectInt); /* Exit early if bridged call fails */ if(psAcquireGlobalEventObjectOUT->eError != PVRSRV_OK) { goto AcquireGlobalEventObject_exit; } /* Create a resman item and overwrite the handle with it */ hGlobalEventObjectInt2 = ResManRegisterRes(psConnection->hResManContext, RESMAN_TYPE_SHARED_EVENT_OBJECT, hGlobalEventObjectInt, (RESMAN_FREE_FN)&ReleaseGlobalEventObjectServer); if (hGlobalEventObjectInt2 == IMG_NULL) { psAcquireGlobalEventObjectOUT->eError = PVRSRV_ERROR_UNABLE_TO_REGISTER_RESOURCE; goto AcquireGlobalEventObject_exit; } psAcquireGlobalEventObjectOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase, &psAcquireGlobalEventObjectOUT->hGlobalEventObject, (IMG_HANDLE) hGlobalEventObjectInt2, PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT, PVRSRV_HANDLE_ALLOC_FLAG_SHARED ); if (psAcquireGlobalEventObjectOUT->eError != PVRSRV_OK) { goto AcquireGlobalEventObject_exit; } AcquireGlobalEventObject_exit: if (psAcquireGlobalEventObjectOUT->eError != PVRSRV_OK) { /* If we have a valid resman item we should undo the bridge function by freeing the resman item */ if (hGlobalEventObjectInt2) { PVRSRV_ERROR eError = ResManFreeResByPtr(hGlobalEventObjectInt2); /* Freeing a resource should never fail... */ PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY)); } else if (hGlobalEventObjectInt) { ReleaseGlobalEventObjectServer(hGlobalEventObjectInt); } } return 0; } static IMG_INT PVRSRVBridgeReleaseGlobalEventObject(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_RELEASEGLOBALEVENTOBJECT *psReleaseGlobalEventObjectIN, PVRSRV_BRIDGE_OUT_RELEASEGLOBALEVENTOBJECT *psReleaseGlobalEventObjectOUT, CONNECTION_DATA *psConnection) { IMG_HANDLE hGlobalEventObjectInt2 = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_RELEASEGLOBALEVENTOBJECT); { /* Look up the address from the handle */ psReleaseGlobalEventObjectOUT->eError = PVRSRVLookupHandle(psConnection->psHandleBase, (IMG_HANDLE *) &hGlobalEventObjectInt2, psReleaseGlobalEventObjectIN->hGlobalEventObject, PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT); if(psReleaseGlobalEventObjectOUT->eError != PVRSRV_OK) { goto ReleaseGlobalEventObject_exit; } } psReleaseGlobalEventObjectOUT->eError = ReleaseGlobalEventObjectResManProxy(hGlobalEventObjectInt2); /* Exit early if bridged call fails */ if(psReleaseGlobalEventObjectOUT->eError != PVRSRV_OK) { goto ReleaseGlobalEventObject_exit; } psReleaseGlobalEventObjectOUT->eError = PVRSRVReleaseHandle(psConnection->psHandleBase, (IMG_HANDLE) psReleaseGlobalEventObjectIN->hGlobalEventObject, PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT); ReleaseGlobalEventObject_exit: return 0; } static IMG_INT PVRSRVBridgeEventObjectOpen(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_EVENTOBJECTOPEN *psEventObjectOpenIN, PVRSRV_BRIDGE_OUT_EVENTOBJECTOPEN *psEventObjectOpenOUT, CONNECTION_DATA *psConnection) { IMG_HANDLE hEventObjectInt = IMG_NULL; IMG_HANDLE hEventObjectInt2 = IMG_NULL; IMG_HANDLE hOSEventInt = IMG_NULL; IMG_HANDLE hOSEventInt2 = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTOPEN); { /* Look up the address from the handle */ psEventObjectOpenOUT->eError = PVRSRVLookupHandle(psConnection->psHandleBase, (IMG_HANDLE *) &hEventObjectInt2, psEventObjectOpenIN->hEventObject, PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT); if(psEventObjectOpenOUT->eError != PVRSRV_OK) { goto EventObjectOpen_exit; } /* Look up the data from the resman address */ psEventObjectOpenOUT->eError = ResManFindPrivateDataByPtr(hEventObjectInt2, (IMG_VOID **) &hEventObjectInt); if(psEventObjectOpenOUT->eError != PVRSRV_OK) { goto EventObjectOpen_exit; } } psEventObjectOpenOUT->eError = OSEventObjectOpen( hEventObjectInt, &hOSEventInt); /* Exit early if bridged call fails */ if(psEventObjectOpenOUT->eError != PVRSRV_OK) { goto EventObjectOpen_exit; } /* Create a resman item and overwrite the handle with it */ hOSEventInt2 = ResManRegisterRes(psConnection->hResManContext, RESMAN_TYPE_EVENT_OBJECT, hOSEventInt, (RESMAN_FREE_FN)&OSEventObjectClose); if (hOSEventInt2 == IMG_NULL) { psEventObjectOpenOUT->eError = PVRSRV_ERROR_UNABLE_TO_REGISTER_RESOURCE; goto EventObjectOpen_exit; } psEventObjectOpenOUT->eError = PVRSRVAllocHandle(psConnection->psHandleBase, &psEventObjectOpenOUT->hOSEvent, (IMG_HANDLE) hOSEventInt2, PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT, PVRSRV_HANDLE_ALLOC_FLAG_MULTI ); if (psEventObjectOpenOUT->eError != PVRSRV_OK) { goto EventObjectOpen_exit; } EventObjectOpen_exit: if (psEventObjectOpenOUT->eError != PVRSRV_OK) { /* If we have a valid resman item we should undo the bridge function by freeing the resman item */ if (hOSEventInt2) { PVRSRV_ERROR eError = ResManFreeResByPtr(hOSEventInt2); /* Freeing a resource should never fail... */ PVR_ASSERT((eError == PVRSRV_OK) || (eError == PVRSRV_ERROR_RETRY)); } else if (hOSEventInt) { OSEventObjectClose(hOSEventInt); } } return 0; } static IMG_INT PVRSRVBridgeEventObjectWait(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_EVENTOBJECTWAIT *psEventObjectWaitIN, PVRSRV_BRIDGE_OUT_EVENTOBJECTWAIT *psEventObjectWaitOUT, CONNECTION_DATA *psConnection) { IMG_HANDLE hOSEventKMInt = IMG_NULL; IMG_HANDLE hOSEventKMInt2 = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTWAIT); { /* Look up the address from the handle */ psEventObjectWaitOUT->eError = PVRSRVLookupHandle(psConnection->psHandleBase, (IMG_HANDLE *) &hOSEventKMInt2, psEventObjectWaitIN->hOSEventKM, PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT); if(psEventObjectWaitOUT->eError != PVRSRV_OK) { goto EventObjectWait_exit; } /* Look up the data from the resman address */ psEventObjectWaitOUT->eError = ResManFindPrivateDataByPtr(hOSEventKMInt2, (IMG_VOID **) &hOSEventKMInt); if(psEventObjectWaitOUT->eError != PVRSRV_OK) { goto EventObjectWait_exit; } } psEventObjectWaitOUT->eError = OSEventObjectWait( hOSEventKMInt); EventObjectWait_exit: return 0; } static IMG_INT PVRSRVBridgeEventObjectClose(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_EVENTOBJECTCLOSE *psEventObjectCloseIN, PVRSRV_BRIDGE_OUT_EVENTOBJECTCLOSE *psEventObjectCloseOUT, CONNECTION_DATA *psConnection) { IMG_HANDLE hOSEventKMInt2 = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTCLOSE); { /* Look up the address from the handle */ psEventObjectCloseOUT->eError = PVRSRVLookupHandle(psConnection->psHandleBase, (IMG_HANDLE *) &hOSEventKMInt2, psEventObjectCloseIN->hOSEventKM, PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT); if(psEventObjectCloseOUT->eError != PVRSRV_OK) { goto EventObjectClose_exit; } } psEventObjectCloseOUT->eError = EventObjectCloseResManProxy(hOSEventKMInt2); /* Exit early if bridged call fails */ if(psEventObjectCloseOUT->eError != PVRSRV_OK) { goto EventObjectClose_exit; } psEventObjectCloseOUT->eError = PVRSRVReleaseHandle(psConnection->psHandleBase, (IMG_HANDLE) psEventObjectCloseIN->hOSEventKM, PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT); EventObjectClose_exit: return 0; } static IMG_INT PVRSRVBridgeDumpDebugInfo(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_DUMPDEBUGINFO *psDumpDebugInfoIN, PVRSRV_BRIDGE_OUT_DUMPDEBUGINFO *psDumpDebugInfoOUT, CONNECTION_DATA *psConnection) { PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_DUMPDEBUGINFO); PVR_UNREFERENCED_PARAMETER(psConnection); psDumpDebugInfoOUT->eError = PVRSRVDumpDebugInfoKM( psDumpDebugInfoIN->ui32ui32VerbLevel); return 0; } static IMG_INT PVRSRVBridgeGetDevClockSpeed(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_GETDEVCLOCKSPEED *psGetDevClockSpeedIN, PVRSRV_BRIDGE_OUT_GETDEVCLOCKSPEED *psGetDevClockSpeedOUT, CONNECTION_DATA *psConnection) { IMG_HANDLE hDevNodeInt = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_GETDEVCLOCKSPEED); { /* Look up the address from the handle */ psGetDevClockSpeedOUT->eError = PVRSRVLookupHandle(psConnection->psHandleBase, (IMG_HANDLE *) &hDevNodeInt, psGetDevClockSpeedIN->hDevNode, PVRSRV_HANDLE_TYPE_DEV_NODE); if(psGetDevClockSpeedOUT->eError != PVRSRV_OK) { goto GetDevClockSpeed_exit; } } psGetDevClockSpeedOUT->eError = PVRSRVGetDevClockSpeedKM( hDevNodeInt, &psGetDevClockSpeedOUT->ui32ui32RGXClockSpeed); GetDevClockSpeed_exit: return 0; } static IMG_INT PVRSRVBridgeHWOpTimeout(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_HWOPTIMEOUT *psHWOpTimeoutIN, PVRSRV_BRIDGE_OUT_HWOPTIMEOUT *psHWOpTimeoutOUT, CONNECTION_DATA *psConnection) { PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_HWOPTIMEOUT); PVR_UNREFERENCED_PARAMETER(psConnection); PVR_UNREFERENCED_PARAMETER(psHWOpTimeoutIN); psHWOpTimeoutOUT->eError = PVRSRVHWOpTimeoutKM( ); return 0; } static IMG_INT PVRSRVBridgeKickDevices(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_KICKDEVICES *psKickDevicesIN, PVRSRV_BRIDGE_OUT_KICKDEVICES *psKickDevicesOUT, CONNECTION_DATA *psConnection) { PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_KICKDEVICES); PVR_UNREFERENCED_PARAMETER(psConnection); PVR_UNREFERENCED_PARAMETER(psKickDevicesIN); psKickDevicesOUT->eError = PVRSRVKickDevicesKM( ); return 0; } static IMG_INT PVRSRVBridgeResetHWRLogs(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_RESETHWRLOGS *psResetHWRLogsIN, PVRSRV_BRIDGE_OUT_RESETHWRLOGS *psResetHWRLogsOUT, CONNECTION_DATA *psConnection) { IMG_HANDLE hDevNodeInt = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_RESETHWRLOGS); { /* Look up the address from the handle */ psResetHWRLogsOUT->eError = PVRSRVLookupHandle(psConnection->psHandleBase, (IMG_HANDLE *) &hDevNodeInt, psResetHWRLogsIN->hDevNode, PVRSRV_HANDLE_TYPE_DEV_NODE); if(psResetHWRLogsOUT->eError != PVRSRV_OK) { goto ResetHWRLogs_exit; } } psResetHWRLogsOUT->eError = PVRSRVResetHWRLogsKM( hDevNodeInt); ResetHWRLogs_exit: return 0; } static IMG_INT PVRSRVBridgeSoftReset(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_SOFTRESET *psSoftResetIN, PVRSRV_BRIDGE_OUT_SOFTRESET *psSoftResetOUT, CONNECTION_DATA *psConnection) { IMG_HANDLE hDevNodeInt = IMG_NULL; PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SRVCORE_SOFTRESET); { /* Look up the address from the handle */ psSoftResetOUT->eError = PVRSRVLookupHandle(psConnection->psHandleBase, (IMG_HANDLE *) &hDevNodeInt, psSoftResetIN->hDevNode, PVRSRV_HANDLE_TYPE_DEV_NODE); if(psSoftResetOUT->eError != PVRSRV_OK) { goto SoftReset_exit; } } psSoftResetOUT->eError = PVRSRVSoftResetKM( hDevNodeInt, psSoftResetIN->ui64ResetValue); SoftReset_exit: return 0; } /* *************************************************************************** * Server bridge dispatch related glue */ PVRSRV_ERROR RegisterSRVCOREFunctions(IMG_VOID); IMG_VOID UnregisterSRVCOREFunctions(IMG_VOID); /* * Register all SRVCORE functions with services */ PVRSRV_ERROR RegisterSRVCOREFunctions(IMG_VOID) { SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_CONNECT, PVRSRVBridgeConnect); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_DISCONNECT, PVRSRVBridgeDisconnect); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_ENUMERATEDEVICES, PVRSRVBridgeEnumerateDevices); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_ACQUIREDEVICEDATA, PVRSRVBridgeAcquireDeviceData); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_RELEASEDEVICEDATA, PVRSRVBridgeReleaseDeviceData); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_INITSRVCONNECT, PVRSRVBridgeInitSrvConnect); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_INITSRVDISCONNECT, PVRSRVBridgeInitSrvDisconnect); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_ACQUIREGLOBALEVENTOBJECT, PVRSRVBridgeAcquireGlobalEventObject); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_RELEASEGLOBALEVENTOBJECT, PVRSRVBridgeReleaseGlobalEventObject); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTOPEN, PVRSRVBridgeEventObjectOpen); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTWAIT, PVRSRVBridgeEventObjectWait); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_EVENTOBJECTCLOSE, PVRSRVBridgeEventObjectClose); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_DUMPDEBUGINFO, PVRSRVBridgeDumpDebugInfo); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_GETDEVCLOCKSPEED, PVRSRVBridgeGetDevClockSpeed); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_HWOPTIMEOUT, PVRSRVBridgeHWOpTimeout); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_KICKDEVICES, PVRSRVBridgeKickDevices); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_RESETHWRLOGS, PVRSRVBridgeResetHWRLogs); SetDispatchTableEntry(PVRSRV_BRIDGE_SRVCORE_SOFTRESET, PVRSRVBridgeSoftReset); return PVRSRV_OK; } /* * Unregister all srvcore functions with services */ IMG_VOID UnregisterSRVCOREFunctions(IMG_VOID) { }
cubieboard/Cubieboard5-kernel-source
modules/rogue_km/generated/srvcore_bridge/server_srvcore_bridge.c
C
gpl-2.0
25,186
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <title>LoggerPatternConverter xref</title> <link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" /> </head> <body> <div id="overview"><a href="../../../../../apidocs/org/apache/log4j/pattern/LoggerPatternConverter.html">View Javadoc</a></div><pre> <a name="1" href="#1">1</a> <em class="jxr_comment">/*</em> <a name="2" href="#2">2</a> <em class="jxr_comment"> * Licensed to the Apache Software Foundation (ASF) under one or more</em> <a name="3" href="#3">3</a> <em class="jxr_comment"> * contributor license agreements. See the NOTICE file distributed with</em> <a name="4" href="#4">4</a> <em class="jxr_comment"> * this work for additional information regarding copyright ownership.</em> <a name="5" href="#5">5</a> <em class="jxr_comment"> * The ASF licenses this file to You under the Apache License, Version 2.0</em> <a name="6" href="#6">6</a> <em class="jxr_comment"> * (the "License"); you may not use this file except in compliance with</em> <a name="7" href="#7">7</a> <em class="jxr_comment"> * the License. You may obtain a copy of the License at</em> <a name="8" href="#8">8</a> <em class="jxr_comment"> *</em> <a name="9" href="#9">9</a> <em class="jxr_comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em> <a name="10" href="#10">10</a> <em class="jxr_comment"> *</em> <a name="11" href="#11">11</a> <em class="jxr_comment"> * Unless required by applicable law or agreed to in writing, software</em> <a name="12" href="#12">12</a> <em class="jxr_comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em> <a name="13" href="#13">13</a> <em class="jxr_comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em> <a name="14" href="#14">14</a> <em class="jxr_comment"> * See the License for the specific language governing permissions and</em> <a name="15" href="#15">15</a> <em class="jxr_comment"> * limitations under the License.</em> <a name="16" href="#16">16</a> <em class="jxr_comment"> */</em> <a name="17" href="#17">17</a> <a name="18" href="#18">18</a> <strong class="jxr_keyword">package</strong> org.apache.log4j.pattern; <a name="19" href="#19">19</a> <a name="20" href="#20">20</a> <strong class="jxr_keyword">import</strong> org.apache.log4j.spi.LoggingEvent; <a name="21" href="#21">21</a> <a name="22" href="#22">22</a> <a name="23" href="#23">23</a> <em class="jxr_javadoccomment">/**</em> <a name="24" href="#24">24</a> <em class="jxr_javadoccomment"> * Formats a logger name.</em> <a name="25" href="#25">25</a> <em class="jxr_javadoccomment"> *</em> <a name="26" href="#26">26</a> <em class="jxr_javadoccomment"> * @author Ceki G&amp;uuml;lc&amp;uuml;</em> <a name="27" href="#27">27</a> <em class="jxr_javadoccomment"> *</em> <a name="28" href="#28">28</a> <em class="jxr_javadoccomment"> */</em> <a name="29" href="#29">29</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/log4j/pattern/LoggerPatternConverter.html">LoggerPatternConverter</a> <strong class="jxr_keyword">extends</strong> <a href="../../../../org/apache/log4j/pattern/NamePatternConverter.html">NamePatternConverter</a> { <a name="30" href="#30">30</a> <em class="jxr_javadoccomment">/**</em> <a name="31" href="#31">31</a> <em class="jxr_javadoccomment"> * Singleton.</em> <a name="32" href="#32">32</a> <em class="jxr_javadoccomment"> */</em> <a name="33" href="#33">33</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <a href="../../../../org/apache/log4j/pattern/LoggerPatternConverter.html">LoggerPatternConverter</a> INSTANCE = <a name="34" href="#34">34</a> <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/log4j/pattern/LoggerPatternConverter.html">LoggerPatternConverter</a>(<strong class="jxr_keyword">null</strong>); <a name="35" href="#35">35</a> <a name="36" href="#36">36</a> <em class="jxr_javadoccomment">/**</em> <a name="37" href="#37">37</a> <em class="jxr_javadoccomment"> * Private constructor.</em> <a name="38" href="#38">38</a> <em class="jxr_javadoccomment"> * @param options options, may be null.</em> <a name="39" href="#39">39</a> <em class="jxr_javadoccomment"> */</em> <a name="40" href="#40">40</a> <strong class="jxr_keyword">private</strong> <a href="../../../../org/apache/log4j/pattern/LoggerPatternConverter.html">LoggerPatternConverter</a>(<strong class="jxr_keyword">final</strong> String[] options) { <a name="41" href="#41">41</a> <strong class="jxr_keyword">super</strong>(<span class="jxr_string">"Logger"</span>, <span class="jxr_string">"logger"</span>, options); <a name="42" href="#42">42</a> } <a name="43" href="#43">43</a> <a name="44" href="#44">44</a> <em class="jxr_javadoccomment">/**</em> <a name="45" href="#45">45</a> <em class="jxr_javadoccomment"> * Obtains an instance of pattern converter.</em> <a name="46" href="#46">46</a> <em class="jxr_javadoccomment"> * @param options options, may be null.</em> <a name="47" href="#47">47</a> <em class="jxr_javadoccomment"> * @return instance of pattern converter.</em> <a name="48" href="#48">48</a> <em class="jxr_javadoccomment"> */</em> <a name="49" href="#49">49</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <a href="../../../../org/apache/log4j/pattern/LoggerPatternConverter.html">LoggerPatternConverter</a> newInstance( <a name="50" href="#50">50</a> <strong class="jxr_keyword">final</strong> String[] options) { <a name="51" href="#51">51</a> <strong class="jxr_keyword">if</strong> ((options == <strong class="jxr_keyword">null</strong>) || (options.length == 0)) { <a name="52" href="#52">52</a> <strong class="jxr_keyword">return</strong> INSTANCE; <a name="53" href="#53">53</a> } <a name="54" href="#54">54</a> <a name="55" href="#55">55</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/log4j/pattern/LoggerPatternConverter.html">LoggerPatternConverter</a>(options); <a name="56" href="#56">56</a> } <a name="57" href="#57">57</a> <a name="58" href="#58">58</a> <em class="jxr_javadoccomment">/**</em> <a name="59" href="#59">59</a> <em class="jxr_javadoccomment"> * {@inheritDoc}</em> <a name="60" href="#60">60</a> <em class="jxr_javadoccomment"> */</em> <a name="61" href="#61">61</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> format(<strong class="jxr_keyword">final</strong> <a href="../../../../org/apache/log4j/spi/LoggingEvent.html">LoggingEvent</a> event, <strong class="jxr_keyword">final</strong> StringBuffer toAppendTo) { <a name="62" href="#62">62</a> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> initialLength = toAppendTo.length(); <a name="63" href="#63">63</a> toAppendTo.append(event.getLoggerName()); <a name="64" href="#64">64</a> abbreviate(initialLength, toAppendTo); <a name="65" href="#65">65</a> } <a name="66" href="#66">66</a> } </pre> <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body> </html>
kikonen/log4j-share
site/xref/org/apache/log4j/pattern/LoggerPatternConverter.html
HTML
apache-2.0
7,753
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<div class="esriAnalysis"> <div data-dojo-type="dijit/layout/ContentPane" style="margin-top:0.5em; margin-bottom: 0.5em;"> <div data-dojo-attach-point="_aggregateToolContentTitle" class="analysisTitle"> <table class="esriFormTable" > <tr> <td class="esriToolIconTd"><div class="sumWithinIcon"></div></td> <td class="esriAlignLeading esriAnalysisTitle" data-dojo-attach-point="_toolTitle"> <label data-dojo-attach-point="_titleLbl">${i18n.summarizeWithin}</label> <nav class="breadcrumbs" data-dojo-attach-point="_analysisModeLblNode" style="display:none;"> <a href="#" class="crumb" style="font-size:12px;" data-dojo-attach-event="onclick:_handleModeCrumbClick" data-dojo-attach-point="_analysisModeCrumb"></a> <a href="#" class="crumb is-active" data-dojo-attach-point="_analysisTitleCrumb" style="font-size:16px;">${i18n.summarizeWithin}</a> </nav> </td> <td> <div class="esriFloatTrailing" style="padding:0;"> <div class="esriFloatLeading"> <a href="#" class='esriFloatLeading helpIcon' esriHelpTopic="toolDescription"></a> </div> <div class="esriFloatTrailing"> <a href="#" data-dojo-attach-point="_closeBtn" title="${i18n.close}" class="esriAnalysisCloseIcon"></a> </div> </div> </td> </tr> </table> </div> <div style="clear:both; border-bottom: #CCC thin solid; height:1px;width:100%;"></div> </div> <div data-dojo-type="dijit/form/Form" data-dojo-attach-point="_form" readOnly="true"> <table class="esriFormTable" data-dojo-attach-point="_aggregateTable" style="border-collapse:collapse;border-spacing:5px;" cellpadding="5px" cellspacing="5px"> <tbody> <tr data-dojo-attach-point="_titleRow"> <td colspan="3" class="sectionHeader" data-dojo-attach-point="_aggregateToolDescription" >${i18n.summarizeDefine}</td> </tr> <tr data-dojo-attach-point="_analysisLabelRow" style="display:none;"> <td colspan="2" style="padding-bottom:0;"> <label class="esriFloatLeading esriTrailingMargin025 esriAnalysisNumberLabel">${i18n.oneLabel}</label> <label class="esriAnalysisStepsLabel">${i18n.analysisLayerLabel}</label> </td> <td class="shortTextInput" style="padding-bottom:0;"> <a href="#" class='esriFloatTrailing helpIcon' esriHelpTopic="sumWithinLayer"></a> </td> </tr> <tr data-dojo-attach-point="_sumGeomTypeRow"> <td data-dojo-attach-point="bufTypeTd" colspan="2"> <table style="width:100%"> <tr> <td> <div class="bufferSelector selected" data-dojo-attach-point="_polygon" > <div class="bufferIcon polygonBinIcon"></div> <div><label class="esriSelectLabel">${i18n.polygon}</label></div> </div> </td> <td> <div class="bufferSelector" data-dojo-attach-point="_square"> <div class="bufferIcon squareBinIcon"></div> <div><label class="esriSelectLabel">${i18n.square}</label></div> </div> </td> <td> <div class="bufferSelector" data-dojo-attach-point="_hexagon"> <div class="bufferIcon hexagonBinIcon"></div> <div><label class="esriSelectLabel">${i18n.hexagon}</label></div> </div> </td> </tr> </table> </td> </tr> <tr data-dojo-attach-point="_chooseBinSizeLblRow"> <td colspan="3" style="padding-top:0;padding-bottom:0"> <label class="esriLeadingMargin1" data-dojo-attach-point="_binSizeLabel"></label> </td> </tr> <tr data-dojo-attach-point="_binsTypeRow"> <td style="padding-right:0;margin-top:1.0em;idth:50%;"> <input type="text" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props="intermediateChanges:true,value:'5',required:false,missingMessage:'${i18n.distanceMsg}'" data-dojo-attach-point="_binsInput" class="esriLeadingMargin1" style="width:75%;"> </td> <td colspan="2" style="padding-left:0.25em;margin-top:1.0em;width:50%;"> <select class="mediumInput esriAnalysisSelect" data-dojo-type="dijit/form/Select" data-dojo-attach-point="_binUnits" style="width:80%;table-layout:fixed;"> <option value="NauticalMiles">${i18n.nautMiles}</option> <option value="Miles">${i18n.miles}</option> <option value="Yards">${i18n.yards}</option> <option value="Feet">${i18n.feet}</option> <option type="separator"></option> <option value="Kilometers">${i18n.kilometers}</option> <option value="Meters">${i18n.meters}</option> </select> </td> </tr> <tr data-dojo-attach-point="_choosePolyLblRow"> <td colspan="3" style="padding-top:0;padding-bottom:0"> <label class="esriLeadingMargin1">${i18n.choosePolyLayer}</label> </td> </tr> <tr data-dojo-attach-point="_selectAnalysisRow" style="display:none;"> <td colspan="3" style="padding-top:0;"> <select class="esriLeadingMargin1 longInput esriLongLabel" style="margin-top:0.5em;" data-dojo-type="dijit/form/Select" data-dojo-attach-point="_analysisSelect" data-dojo-attach-event="onChange:_handleAnalysisLayerChange"></select> </td> </tr> <tr> <td colspan="2" style="padding-bottom:0;"> <label class="esriFloatLeading esriTrailingMargin025 esriAnalysisNumberLabel">${i18n.oneLabel}</label> <label class="esriAnalysisStepsLabel">${i18n.chooseSummarizeLabel}</label> </td> <td class="shortTextInput" style="padding-bottom:0;"> <a href="#" class='esriFloatTrailing helpIcon' data-dojo-attach-point="_sumLabelHelp" esriHelpTopic="Summarize"></a> </td> </tr> <tr data-dojo-attach-point="_polyLayerSelectRow"> <td colspan="3" style="padding-top:0;"> <select class="longInput esriLongLabel esriLeadingMargin1" style="margin-top:1.0em;" data-dojo-props="required:true" data-dojo-type="dijit/form/Select" data-dojo-attach-point="_layersSelect" data-dojo-attach-event="onChange:_handleLayerChange"></select> </td> </tr> <tr> <tr> <td colspan="3" class="clear"></td> </tr> <!--<tr data-dojo-attach-point="_timeStepsLabelRow"> <td colspan="2"> <label data-dojo-attach-point="_timeStepLabelNo" class="esriFloatLeading esriTrailingMargin025 esriAnalysisNumberLabel">${i18n.twoLabel}</label> <label class="esriAnalysisStepsLabel">${i18n.aggTimeStepsLabel}</label> </td> <td class="shortTextInput"> <a href="#" class='esriFloatTrailing helpIcon' esriHelpTopic="timeSlicing"></a> </td> </tr> <tr data-dojo-attach-point="_intervalLabelRow"> <td colspan="2"> <label>${i18n.intervalLabel}</label> </td> <td class="shortTextInput"> <a href="#" class='esriFloatTrailing helpIcon' esriHelpTopic="timeInterval"></a> </td> </tr> <tr data-dojo-attach-point="_intervalRow"> <td style="padding-right:0;padding-bottom:0;width:50%;"> <input type="text" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props="constraints:{min:1,places:0},intermediateChanges:true,required:false,missingMessage:'${i18n.distanceMsg}'" data-dojo-attach-point="_timeIntervalInput" class="esriLeadingMargin1" style="width:75%;"> </td> <td colspan="2" style="padding-left:0.25em;padding-bottom:0;width:50%;"> <select class="mediumInput esriAnalysisSelect" data-dojo-type="dijit/form/Select" data-dojo-attach-point="_timeIntervalUnits" style="width:80%;table-layout:fixed;"> <option value="milliseconds">${i18n.milliseconds}</option> <option value="seconds">${i18n.seconds}</option> <option value="minutes">${i18n.minutes}</option> <option value="hours">${i18n.hours}</option> <option value="days">${i18n.days}</option> <option value="weeks">${i18n.weeks}</option> <option value="months">${i18n.months}</option> <option value="years">${i18n.years}</option> </select> </td> </tr> <tr data-dojo-attach-point="_repeatLabelRow"> <td colspan="2"> <label>${i18n.repeatLabel}</label> </td> <td class="shortTextInput"> <a href="#" class='esriFloatTrailing helpIcon' esriHelpTopic="timeStep"></a> </td> </tr> <tr data-dojo-attach-point="_repeatRow"> <td style="padding-right:0;padding-bottom:0;width:50%;"> <input type="text" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props="constraints:{min:1,places:0},intermediateChanges:true,required:false,missingMessage:'${i18n.distanceMsg}'" data-dojo-attach-point="_timeRepeatInput" class="esriLeadingMargin1" style="width:75%;"> </td> <td colspan="2" style="padding-left:0.25em;padding-bottom:0;width:50%;"> <select class="mediumInput esriAnalysisSelect" data-dojo-type="dijit/form/Select" data-dojo-attach-point="_timeRepeatUnits" style="width:80%;table-layout:fixed;"> <option value="milliseconds">${i18n.milliseconds}</option> <option value="seconds">${i18n.seconds}</option> <option value="minutes">${i18n.minutes}</option> <option value="hours">${i18n.hours}</option> <option value="days">${i18n.days}</option> <option value="weeks">${i18n.weeks}</option> <option value="months">${i18n.months}</option> <option value="years">${i18n.years}</option> </select> </td> </tr> <tr data-dojo-attach-point="_timeLabelRow"> <td colspan="2"> <labe>${i18n.timeRefLabel}</label> </td> <td class="shortTextInput"> <a href="#" class='esriFloatTrailing helpIcon' esriHelpTopic="timeReference"></a> </td> </tr> <tr data-dojo-attach-point="_timeRefRow"> <td style="padding-right:0;width:50%;padding-bottom:1em;"> <input class="esriLeadingMargin1 esriAnalysisSelect" data-dojo-props="required:false" data-dojo-type="dijit/form/DateTextBox" data-dojo-attach-point="_timeRefDay" style="width:75%;"> </input> </td> <td colpsan="2" style="padding-left:0.25em;width:50%;padding-bottom:1em;"> <input class="esriAnalysisSelect" type="text" data-dojo-type="dijit/form/TimeTextBox" data-dojo-props="required:false,intermediateChanges:true,constraints:{formatLength:'short',selector:'time'}" data-dojo-attach-point="_timeRefTime" data-dojo-attach-event="onChange:_handleRefTimeChange" style="margin-top:0;width:90%;"> </input> </td> </tr>--> <tr> <td colspan="3"> <label class="esriFloatLeading esriTrailingMargin025 esriAnalysisNumberLabel" data-dojo-attach-point="_statsLblNo">${i18n.threeLabel}</label> <label class="esriAnalysisStepsLabel" data-dojo-attach-point="_addStatsLabel">${i18n.addStats}</label> <a href="#" class='esriFloatTrailing helpIcon' data-dojo-attach-point="_addStatsHelpLink" esriHelpTopic="StatisticsNoLayer"></a> </td> </tr> <tr data-dojo-attach-point="_sumShapeRow"> <td colspan="3"> <label class="esriLeadingMargin1"> <div data-dojo-type="dijit/form/CheckBox" data-dojo-attach-point="_sumMetricCheck" data-dojo-props="checked:'true', disabled:'true'"></div> <label data-dojo-attach-point="_sumMetricLabel"></label> </label> <select class="mediumInput esriShortlabel" data-dojo-type="dijit.form.Select" data-dojo-props="style:{tableLayout: 'fixed', overflowX:'hidden'}" data-dojo-attach-event="onChange:_handleShapeUnitsChange" data-dojo-attach-point="_shapeUnitsSelect"></select> </td> </tr> <tr data-dojo-attach-point="_addNonWgtRow" style="display:none;"> <td colspan="2" class="padBottom0"> <label class="esriLeadingMargin2">${i18n.addNonWightLabel}</label> </td> <td class="shortTextInput padBottom0"> <a href="#" class='esriFloatTrailing helpIcon' esriHelpTopic="timeReference"></a> </td> </tr> <tr data-dojo-attach-point="_afterStatsRow"> <td colspan="3" class="clear"></td> </tr> <tr data-dojo-attach-point="_addWgtRow" style="display:none;"> <td colspan="2" class="padBottom0"> <label class="esriLeadingMargin2">${i18n.addWeightLabel}</label> </td> <td class="shortTextInput padBottom0"> <a href="#" class='esriFloatTrailing helpIcon' esriHelpTopic="timeReference"></a> </td> </tr> <tr data-dojo-attach-point="_afterStatsRow1" style="display:none;"> <td colspan="3" class="clear"></td> </tr> <tr data-dojo-attach-point="_groupByLabelRow"> <td colspan="2"> <label data-dojo-attach-point="_groupByLabelNo" class="esriFloatLeading esriTrailingMargin025 esriAnalysisNumberLabel">${i18n.threeLabel}</label> <label class="esriAnalysisStepsLabel" data-dojo-attach-point="_groupByLabel">${i18n.groupByLabel}</label> </td> <td class="shortTextInput"> <a href="#" class='esriFloatTrailing helpIcon' esriHelpTopic="GroupBy"></a> </td> </tr> <tr data-dojo-attach-point="_groupBySelectRow"> <td colspan="3"> <select class="longInput esriLeadingMargin1" data-dojo-type="dijit.form.Select" data-dojo-attach-point="_groupBySelect" data-dojo-attach-event="onChange:_handleGroupBySelectChange"></select> </td> </tr> <tr data-dojo-attach-point="_minmajorityRow"> <td colspan="2"> <label class="esriLeadingMargin2 esriSelectLabel" data-dojo-attach-point="_minmajorityLabel"> <div data-dojo-type="dijit/form/CheckBox" data-dojo-attach-point="_minmajorityCheck" data-dojo-props="checked:false"></div> ${i18n.addMinMajorityLable} </label> </td> <td class="shortTextInput"> <a href="#" class='esriFloatTrailing helpIcon' esriHelpTopic="MinorityMajority"></a> </td> </tr> <tr data-dojo-attach-point="_percentPointsRow"> <td colspan="2"> <label class="esriLeadingMargin2 esriSelectLabel" data-dojo-attach-point="_percentPointsLabel"> <div data-dojo-type="dijit/form/CheckBox" data-dojo-attach-point="_percentPointsCheck" data-dojo-props="checked:false"></div> ${i18n.addPercentageLabel} </label> </td> <td class="shortTextInput"> <a href="#" class='esriFloatTrailing helpIcon' esriHelpTopic="PercentShape"></a> </td> </tr> <tr> <td colspan="3" class="clear"></td> </tr> <!-- <tr data-dojo-attach-point="_srLabelRow"> <td colspan="3"> <label class="esriFloatLeading esriTrailingMargin025 esriAnalysisNumberLabel" data-dojo-attach-point="_spatialRefLabel">${i18n.fourLabel}</label> <label class="esriAnalysisStepsLabel">${i18n.spatialReference}</label> </td> </tr> <tr data-dojo-attach-point="_srInputRow"> <td colspan="3"> <input type="text" data-dojo-type="dijit/form/ValidationTextBox" class="esriLeadingMargin1 longInput" data-dojo-props="trim:true" data-dojo-attach-point="_spatialRefInput" value=""></input> </td> </tr>--> <tr data-dojo-attach-point="_datastoreLabelRow"> <td colspan="3"> <label class="esriFloatLeading esriTrailingMargin025 esriAnalysisNumberLabel" data-dojo-attach-point="_datastoreLabel">${i18n.fiveLabel}</label> <label class="esriAnalysisStepsLabel">${i18n.datastoreLabel}</label> </td> </tr> <tr data-dojo-attach-point="_selectDataStore"> <td colspan="3" style="padding-top:0;"> <select class="esriLeadingMargin1 longInput esriLongLabel" style="margin-top:1.0em;" data-dojo-type="dijit/form/Select" data-dojo-attach-point="_datastoreSelect"> <option value="relational">${i18n.relationalDS}</option> <option value="spatialtemporal" selected="true">${i18n.spatialDS}</option> </select> </td> </tr> <tr> <td colspan="2"> <label class="esriFloatLeading esriTrailingMargin025 esriAnalysisNumberLabel" data-dojo-attach-point="_outputLbl">${i18n.fourLabel}</label> <label class="esriAnalysisStepsLabel">${i18n.outputLayerLabel}</label> </td> <td class="shortTextInput"> <a href="#" class='esriFloatTrailing helpIcon' data-dojo-attach-point="_outputHelp" esriHelpTopic="ResultLayerName"></a> </td> </tr> <tr> <td colspan="3"> <input type="text" data-dojo-type="dijit/form/ValidationTextBox" class="longInput esriLeadingMargin1" data-dojo-props="trim:true,required:true" data-dojo-attach-point="_outputLayerInput" value=""></input> </td> </tr> <tr> <td colspan="3"> <div data-dojo-attach-point="_chooseFolderRow" class="esriLeadingMargin1"> <label style="width:9px;font-size:smaller;">${i18n.saveResultIn}</label> <input class="longInput" data-dojo-attach-point="_webMapFolderSelect" data-dojo-type="dijit/form/FilteringSelect" trim="true" style="width:60%;"></input> </div> </td> </tr> </tbody> </table> </div> <div data-dojo-attach-point="_aggregateToolContentButtons" style="padding:5px;margin-top:5px;border-top:solid 1px #BBB;"> <div class="esriFormWarning esriRoundedBox" data-dojo-attach-point="_errorMessagePane" style="display:none;"> <a href="#" title="${i18n.close}" class="esriFloatTrailing esriAnalysisCloseIcon" data-dojo-attach-event="onclick:_handleCloseMsg"></a> <span data-dojo-attach-point="_bodyNode"></span> </div> <div class="esriExtentCreditsCtr"> <a class="esriFloatTrailing esriSmallFont" href="#" data-dojo-attach-point="_showCreditsLink" data-dojo-attach-event="onclick:_handleShowCreditsClick">${i18n.showCredits}</a> <label data-dojo-attach-point="_chooseExtentDiv" class="esriSelectLabel esriExtentLabel"> <input type="radio" data-dojo-attach-point="_useExtentCheck" data-dojo-type="dijit/form/CheckBox" data-dojo-props="checked:true" name="extent" value="true"/> ${i18n.useMapExtent} </label> </div> <button data-dojo-type="dijit/form/Button" type="submit" data-dojo-attach-point="_saveBtn" class="esriLeadingMargin4 esriAnalysisSubmitButton" data-dojo-attach-event="onClick:_handleSaveBtnClick"> ${i18n.runAnalysis} </button> </div> <div data-dojo-type="dijit/Dialog" title="${i18n.creditTitle}" data-dojo-attach-point="_usageDialog" style="width:40em;"> <div data-dojo-type="esri/dijit/analysis/CreditEstimator" data-dojo-attach-point="_usageForm"></div> </div> </div>
wanglongbiao/webapp-tools
Highlander/ship-gis/src/main/webapp/js/arcgis_js_api/library/3.22/esri/dijit/analysis/templates/SummarizeWithin.html
HTML
apache-2.0
20,985
[ 30522, 1026, 4487, 2615, 2465, 1027, 1000, 9686, 6862, 20766, 6190, 1000, 1028, 1026, 4487, 2615, 2951, 1011, 2079, 5558, 1011, 2828, 1027, 1000, 4487, 18902, 1013, 9621, 1013, 4180, 9739, 2063, 1000, 2806, 1027, 1000, 7785, 1011, 2327, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.chandilsachin.diettracker.io; import android.app.Activity; import android.content.Context; import android.graphics.Typeface; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Iterator; public final class FontsOverride { public static void populateFonts(Activity activity, HashMap<String, String> fontTable) { if (fontTable != null) { Iterator<String> fonts = fontTable.keySet().iterator(); while (fonts.hasNext()) { String font = fonts.next(); setDefaultFont(activity, font, "fonts/" + fontTable.get(font)); } } } public static void setDefaultFont(Context context, String staticTypefaceFieldName, String fontAssetName) { final Typeface regular = Typeface.createFromAsset(context.getAssets(), fontAssetName); replaceFont(staticTypefaceFieldName, regular); } protected static void replaceFont(String staticTypefaceFieldName, final Typeface newTypeface) { try { final Field staticField = Typeface.class .getDeclaredField(staticTypefaceFieldName); staticField.setAccessible(true); staticField.set(null, newTypeface); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } }
chandilsachin/DietTracker
app/src/main/java/com/chandilsachin/diettracker/io/FontsOverride.java
Java
gpl-3.0
1,560
[ 30522, 7427, 4012, 1012, 9212, 4305, 4877, 21046, 2078, 1012, 8738, 6494, 9102, 1012, 22834, 1025, 12324, 11924, 1012, 10439, 1012, 4023, 1025, 12324, 11924, 1012, 4180, 1012, 6123, 1025, 12324, 11924, 1012, 8389, 1012, 2828, 12172, 1025, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?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_Feed * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ /** * Wraps a DOMElement allowing for SimpleXML-like access to attributes. * * @category Zend * @package Zend_Feed * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Feed_Element implements ArrayAccess { /** * @var DOMElement */ protected $_element; /** * @var string Character encoding to utilize */ protected $_encoding = 'UTF-8'; /** * @var Zend_Feed_Element */ protected $_parentElement; /** * @var boolean */ protected $_appended = true; /** * Zend_Feed_Element constructor. * * @param DOMElement $element The DOM element we're encapsulating. * @return void */ public function __construct($element = null) { $this->_element = $element; } /** * Get a DOM representation of the element * * Returns the underlying DOM object, which can then be * manipulated with full DOM methods. * * @return DOMDocument */ public function getDOM() { return $this->_element; } /** * Update the object from a DOM element * * Take a DOMElement object, which may be originally from a call * to getDOM() or may be custom created, and use it as the * DOM tree for this Zend_Feed_Element. * * @param DOMElement $element * @return void */ public function setDOM(DOMElement $element) { $this->_element = $this->_element->ownerDocument->importNode($element, true); } /** * Set the parent element of this object to another * Zend_Feed_Element. * * @param Zend_Feed_Element $element * @return void */ public function setParent(Zend_Feed_Element $element) { $this->_parentElement = $element; $this->_appended = false; } /** * Appends this element to its parent if necessary. * * @return void */ protected function ensureAppended() { if (!$this->_appended) { $this->_parentElement->getDOM()->appendChild($this->_element); $this->_appended = true; $this->_parentElement->ensureAppended(); } } /** * Get an XML string representation of this element * * Returns a string of this element's XML, including the XML * prologue. * * @return string */ public function saveXml() { // Return a complete document including XML prologue. $doc = new DOMDocument($this->_element->ownerDocument->version, $this->_element->ownerDocument->actualEncoding); $doc->appendChild($doc->importNode($this->_element, true)); return $doc->saveXML(); } /** * Get the XML for only this element * * Returns a string of this element's XML without prologue. * * @return string */ public function saveXmlFragment() { return $this->_element->ownerDocument->saveXML($this->_element); } /** * Get encoding * * @return string */ public function getEncoding() { return $this->_encoding; } /** * Set encoding * * @param string $value Encoding to use * @return Zend_Feed_Element */ public function setEncoding($value) { $this->_encoding = (string) $value; return $this; } /** * Map variable access onto the underlying entry representation. * * Get-style access returns a Zend_Feed_Element representing the * child element accessed. To get string values, use method syntax * with the __call() overriding. * * @param string $var The property to access. * @return mixed */ public function __get($var) { $nodes = $this->_children($var); $length = count($nodes); if ($length == 1) { return new Zend_Feed_Element($nodes[0]); } elseif ($length > 1) { return array_map(create_function('$e', 'return new Zend_Feed_Element($e);'), $nodes); } else { // When creating anonymous nodes for __set chaining, don't // call appendChild() on them. Instead we pass the current // element to them as an extra reference; the child is // then responsible for appending itself when it is // actually set. This way "if ($foo->bar)" doesn't create // a phantom "bar" element in our tree. if (strpos($var, ':') !== false) { list($ns, $elt) = explode(':', $var, 2); $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $elt); } else { $node = $this->_element->ownerDocument->createElement($var); } $node = new self($node); $node->setParent($this); return $node; } } /** * Map variable sets onto the underlying entry representation. * * @param string $var The property to change. * @param string $val The property's new value. * @return void * @throws Zend_Feed_Exception */ public function __set($var, $val) { $this->ensureAppended(); $nodes = $this->_children($var); if (!$nodes) { if (strpos($var, ':') !== false) { list($ns, $elt) = explode(':', $var, 2); $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $var, htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); $this->_element->appendChild($node); } else { $node = $this->_element->ownerDocument->createElement($var, htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); $this->_element->appendChild($node); } } elseif (count($nodes) > 1) { /** * @see Zend_Feed_Exception */ require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Cannot set the value of multiple tags simultaneously.'); } else { $nodes[0]->nodeValue = $val; } } /** * Map isset calls onto the underlying entry representation. * * @param string $var * @return boolean */ public function __isset($var) { // Look for access of the form {ns:var}. We don't use // _children() here because we can break out of the loop // immediately once we find something. if (strpos($var, ':') !== false) { list($ns, $elt) = explode(':', $var, 2); foreach ($this->_element->childNodes as $child) { if ($child->localName == $elt && $child->prefix == $ns) { return true; } } } else { foreach ($this->_element->childNodes as $child) { if ($child->localName == $var) { return true; } } } } /** * Get the value of an element with method syntax. * * Map method calls to get the string value of the requested * element. If there are multiple elements that match, this will * return an array of those objects. * * @param string $var The element to get the string value of. * @param mixed $unused This parameter is not used. * @return mixed The node's value, null, or an array of nodes. */ public function __call($var, $unused) { $nodes = $this->_children($var); if (!$nodes) { return null; } elseif (count($nodes) > 1) { return $nodes; } else { return $nodes[0]->nodeValue; } } /** * Remove all children matching $var. * * @param string $var * @return void */ public function __unset($var) { $nodes = $this->_children($var); foreach ($nodes as $node) { $parent = $node->parentNode; $parent->removeChild($node); } } /** * Returns the nodeValue of this element when this object is used * in a string context. * * @return string */ public function __toString() { return $this->_element->nodeValue; } /** * Finds children with tagnames matching $var * * Similar to SimpleXML's children() method. * * @param string $var Tagname to match, can be either namespace:tagName or just tagName. * @return array */ protected function _children($var) { $found = array(); // Look for access of the form {ns:var}. if (strpos($var, ':') !== false) { list($ns, $elt) = explode(':', $var, 2); foreach ($this->_element->childNodes as $child) { if ($child->localName == $elt && $child->prefix == $ns) { $found[] = $child; } } } else { foreach ($this->_element->childNodes as $child) { if ($child->localName == $var) { $found[] = $child; } } } return $found; } /** * Required by the ArrayAccess interface. * * @param string $offset * @return boolean */ public function offsetExists($offset) { if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); return $this->_element->hasAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); } else { return $this->_element->hasAttribute($offset); } } /** * Required by the ArrayAccess interface. * * @param string $offset * @return string */ public function offsetGet($offset) { if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); return $this->_element->getAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); } else { return $this->_element->getAttribute($offset); } } /** * Required by the ArrayAccess interface. * * @param string $offset * @param string $value * @return string */ public function offsetSet($offset, $value) { $this->ensureAppended(); if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); // DOMElement::setAttributeNS() requires $qualifiedName to have a prefix return $this->_element->setAttributeNS(Zend_Feed::lookupNamespace($ns), $offset, $value); } else { return $this->_element->setAttribute($offset, $value); } } /** * Required by the ArrayAccess interface. * * @param string $offset * @return boolean */ public function offsetUnset($offset) { if (strpos($offset, ':') !== false) { list($ns, $attr) = explode(':', $offset, 2); return $this->_element->removeAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); } else { return $this->_element->removeAttribute($offset); } } }
trungkienpvt/wordpress
wp-content/themes/ecommerce/inc/Zend/Feed/Element.php
PHP
gpl-2.0
12,600
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 16729, 2094, 7705, 1008, 1008, 6105, 1008, 1008, 2023, 3120, 5371, 2003, 3395, 2000, 1996, 2047, 18667, 2094, 6105, 2008, 2003, 24378, 1008, 2007, 2023, 7427, 1999, 1996, 5371, 6105, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.IO; using System.Xml.Serialization; using ZohoPeopleTimeLogger.Model; namespace ZohoPeopleTimeLogger.Services { public class AuthenticationStorage : IAuthenticationStorage { private readonly string authenticationStorageFolder; private readonly string authenticationStorageFilePath; public AuthenticationStorage() { authenticationStorageFolder = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ZohoPeopleTimeLogger"); authenticationStorageFilePath = Path.Combine( authenticationStorageFolder, "autheentication.xml"); } public AuthenticationData GetAuthenticationData() { if (!File.Exists(authenticationStorageFilePath)) { return null; } using (var file = File.OpenRead(authenticationStorageFilePath)) { var serializer = new XmlSerializer(typeof(AuthenticationData)); return serializer.Deserialize(file) as AuthenticationData; } } public void SaveAuthenticationData(AuthenticationData data) { if (!Directory.Exists(authenticationStorageFolder)) { Directory.CreateDirectory(authenticationStorageFolder); } using (var file = File.Open(authenticationStorageFilePath, FileMode.Create)) { var serializer = new XmlSerializer(typeof(AuthenticationData)); serializer.Serialize(file, data); } } public void Clear() { if (File.Exists(authenticationStorageFilePath)) { File.Delete(authenticationStorageFilePath); } } } }
drussilla/ZohoPeopleTimeLogger
ZohoPeopleTimeLogger/Services/AuthenticationStorage.cs
C#
mit
1,934
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 22834, 1025, 2478, 2291, 1012, 20950, 1012, 7642, 3989, 1025, 2478, 1062, 11631, 17635, 27469, 7292, 21197, 4590, 1012, 2944, 1025, 3415, 15327, 1062, 11631, 17635, 27469, 7292, 21197, 4590, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# dialogs - provide common dialogs # # Copyright (c) 2006 FSF Europe # # Authors: # Sebastian Heinlein <glatzor@ubuntu.com> # Michael Vogt <mvo@canonical.com> # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA from gi.repository import Gtk def show_error_dialog(parent, primary, secondary): p = "<span weight=\"bold\" size=\"larger\">%s</span>" % primary dialog = Gtk.MessageDialog(parent,Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR,Gtk.ButtonsType.CLOSE,"") dialog.set_markup(p); dialog.format_secondary_text(secondary); dialog.run() dialog.hide()
ruibarreira/linuxtrail
usr/lib/python3/dist-packages/softwareproperties/gtk/dialogs.py
Python
gpl-3.0
1,305
[ 30522, 1001, 13764, 8649, 2015, 30524, 1043, 20051, 6844, 2099, 1030, 1057, 8569, 3372, 2226, 1012, 4012, 1028, 1001, 2745, 29536, 13512, 1026, 19842, 2080, 1030, 18562, 1012, 4012, 1028, 1001, 1001, 2023, 2565, 2003, 2489, 4007, 1025, 2017...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2007 Sascha Weinreuter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.intellij.plugins.relaxNG.references; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.LocalQuickFixProvider; import com.intellij.codeInspection.XmlQuickFixFactory; import com.intellij.lang.xml.XMLLanguage; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiReference; import com.intellij.psi.PsiReferenceProvider; import com.intellij.psi.XmlElementFactory; import com.intellij.psi.impl.source.resolve.reference.impl.providers.BasicAttributeValueReference; import com.intellij.psi.impl.source.xml.SchemaPrefix; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlAttributeValue; import com.intellij.psi.xml.XmlTag; import com.intellij.util.ArrayUtil; import com.intellij.util.ProcessingContext; /* * Created by IntelliJ IDEA. * User: sweinreuter * Date: 24.07.2007 */ public class PrefixReferenceProvider extends PsiReferenceProvider { private static final Logger LOG = Logger.getInstance("#org.intellij.plugins.relaxNG.references.PrefixReferenceProvider"); @Override @NotNull public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { final XmlAttributeValue value = (XmlAttributeValue) element; final String s = value.getValue(); final int i = s.indexOf(':'); if(i <= 0 || s.startsWith("xml:")) { return PsiReference.EMPTY_ARRAY; } return new PsiReference[]{ new PrefixReference(value, i) }; } private static class PrefixReference extends BasicAttributeValueReference implements EmptyResolveMessageProvider, LocalQuickFixProvider { public PrefixReference(XmlAttributeValue value, int length) { super(value, TextRange.from(1, length)); } @Override @Nullable public PsiElement resolve() { final String prefix = getCanonicalText(); XmlTag tag = PsiTreeUtil.getParentOfType(getElement(), XmlTag.class); while(tag != null) { if(tag.getLocalNamespaceDeclarations().containsKey(prefix)) { final XmlAttribute attribute = tag.getAttribute("xmlns:" + prefix, ""); final TextRange textRange = TextRange.from("xmlns:".length(), prefix.length()); return new SchemaPrefix(attribute, textRange, prefix); } tag = tag.getParentTag(); } return null; } @Override public boolean isReferenceTo(PsiElement element) { if(element instanceof SchemaPrefix && element.getContainingFile() == myElement.getContainingFile()) { final PsiElement e = resolve(); if(e instanceof SchemaPrefix) { final String s = ((SchemaPrefix) e).getName(); return s != null && s.equals(((SchemaPrefix) element).getName()); } } return super.isReferenceTo(element); } @Nullable @Override public LocalQuickFix[] getQuickFixes() { final PsiElement element = getElement(); final XmlElementFactory factory = XmlElementFactory.getInstance(element.getProject()); final String value = ((XmlAttributeValue) element).getValue(); final String[] name = value.split(":"); final XmlTag tag = factory.createTagFromText("<" + (name.length > 1 ? name[1] : value) + " />", XMLLanguage.INSTANCE); return new LocalQuickFix[]{XmlQuickFixFactory.getInstance().createNSDeclarationIntentionFix(tag, getCanonicalText(), null)}; } @Override @NotNull public Object[] getVariants() { return ArrayUtil.EMPTY_OBJECT_ARRAY; } @Override public boolean isSoft() { return false; } @Override @NotNull public String getUnresolvedMessagePattern() { return "Undefined namespace prefix ''{0}''"; } } }
consulo/consulo-relaxng
src/org/intellij/plugins/relaxNG/references/PrefixReferenceProvider.java
Java
apache-2.0
4,459
[ 30522, 1013, 1008, 1008, 9385, 2289, 21871, 7507, 11417, 16118, 13765, 3334, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/// <reference types='jest' /> import * as React from 'react'; import ServicesPanel from '../ServicesPanel'; import Cases from './ServicesPanel.cases'; import { shallow, mount, render } from 'enzyme'; describe('ServicesPanel', () => { let servicesPanel:any; beforeEach(()=>{ servicesPanel = mount(<ServicesPanel {...Cases['Default']}/>) }); it('should render correctly', () => { expect(servicesPanel.find('Dropdown').length).toEqual(1); expect(servicesPanel.find('ServicesList').length).toEqual(1); expect(servicesPanel.find('Input').length).toEqual(1); }); it('should render the roles dropdown with the services prop roles as items', () => { // let roles: string[] = []; // servicesPanel.props().services.forEach((service:any) => { // if (roles.indexOf(service.roleId) === -1) { // roles.push(service.roleId); // } // }); // let dropDownItemsTexts = servicesPanel.find('DropdownItem .role').map((node:any) => { return node.text()}); // expect(JSON.stringify(roles.sort())).toEqual(JSON.stringify(dropDownItemsTexts.sort())); }); it('should render only services with the selected role', () => { // let activeRole = 'Mollis.'; // servicesPanel.setState({ // activeRole: activeRole // }); // let allHaveActiveRole = servicesPanel.find('ServiceCard').map((node:any) => { // return node.props().service.roles.indexOf(activeRole) > -1; // }).every((value:boolean) => { // return value === true; // }); // expect(allHaveActiveRole).toEqual(true); }); it('should render only services with the selected role when a search value is entered by user', () => { // let activeRole = 'Mollis.'; // servicesPanel.setState({ // activeRole: activeRole, // searhValue: 'test' // }); // let allHaveActiveRole = servicesPanel.find('ServiceCard').map((node:any) => { // return node.props().service.roles.indexOf(activeRole) > -1; // }).every((value:boolean) => { // return value === true; // }); // expect(allHaveActiveRole).toEqual(true); }); it('should render the Not found services message when search is performed an it returns no services', () => { // servicesPanel.setState({ // searchValue:'mycrazytestsearchcriteria', // activeRole:'Mollis.' // }); // expect(servicesPanel.find('h3').first().text()).toEqual('No services found'); }); it('should render the right search indicator in search bar depending on searching state', () => { // servicesPanel.setState({loadingSearch:false, searchValue:''}); // expect(servicesPanel.find('.rowHead').first().find('i').length).toEqual(0); // servicesPanel.setState({loadingSearch:false, searchValue:'mysearchcriteria'}); // expect(servicesPanel.find('.rowHead').first().find('i').length).toEqual(1); // expect(servicesPanel.find('.rowHead').first().find('i').html()).toContain('fa fa-times fa-lg'); // servicesPanel.setState({loadingSearch:true, searchValue:'mysearchcriteria'}); // expect(servicesPanel.find('.rowHead').first().find('i').length).toEqual(1); // expect(servicesPanel.find('.rowHead').first().find('i').html()).toContain('fa fa-pulse fa-spinner'); }); it(`should set the right searching state after a second depending on the searchOnChangeMethod actioned by user input`, (done) => { done(); // servicesPanel.instance().searchOnChange({target:{value:'mysearchcriteria'}, persist: () => {}}); // expect(servicesPanel.state().searchValue).toEqual('mysearchcriteria'); // expect(servicesPanel.state().loadingSearch).toEqual(true); // try { // setTimeout(()=>{ // expect(servicesPanel.state().loadingSearch).toEqual(false); // done(); // }, 2000); // }catch (e){ // done.fail(e); // } }); });
nebtex/menshend-ui
src/components/services/ServicesPanel/__tests__/ServicesPanel.spec.tsx
TypeScript
apache-2.0
3,882
[ 30522, 1013, 1013, 1013, 1026, 4431, 4127, 1027, 1005, 15333, 3367, 1005, 1013, 1028, 12324, 1008, 2004, 10509, 2013, 1005, 10509, 1005, 1025, 12324, 2578, 9739, 2884, 2013, 1005, 1012, 1012, 1013, 2578, 9739, 2884, 1005, 1025, 12324, 3572,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <!--basic styles--> <link href="asset/css/bootstrap.css" rel="stylesheet" /> <link rel="stylesheet" href="asset/css/dexter.min.css" /> <link rel="stylesheet" href="asset/css/font-awesome.min.css" /> <!--[if IE 7]> <link rel="stylesheet" href="asset/css/font-awesome-ie7.min.css"> <![endif]--> <link rel="stylesheet" href="asset/css/prettify.css" /> <script src="asset/js/jquery-2.0.3.min.js"></script> <!--[if IE]> <script src="asset/js/jquery.min.js"></script> <![endif]--> <script src="asset/js/prettify.js"></script> <script type="text/javascript"> $(function() { window.prettyPrint && prettyPrint(); $('#id-check-horizontal').removeAttr('checked').on('click', function(){ $('#dt-list-1').toggleClass('dl-horizontal').prev().html(this.checked ? '&lt;dl class="dl-horizontal"&gt;' : '&lt;dl&gt;'); }); }) </script> </head> <body> <div class="space-12"></div> <div class="table-grid-info table-grid-info-striped"> <div class="table-grid-row"> <div class="table-grid-label"> Checker Code</div> <div class="table-grid-value"><h5 class="header blue"><i class="fa fa-bug"></i>&nbsp; nonreentrantFunctionsgcvt</h5> </div> </div> <div class="table-grid-row"> <div class="table-grid-label"> Description </div> <div class="table-grid-value-highlight"><i class="fa fa-th"></i>&nbsp; Avoid usage of the function 'gcvt'. </div> </div> <div class="table-grid-row"> <div class="table-grid-label"> Severity </div> <div class="table-grid-value"> Critical </div> </div> <div class="table-grid-row"> <div class="table-grid-label"> Detector / Bug Pattern </div> <div class="table-grid-value"> Avoid usage of the function 'gcvt'. </div> </div> <div class="table-grid-row"> <div class="table-grid-label"> More Information </div> <div class="table-grid-value"> The function 'gcvt' is not reentrant. For thread safe applications it is recommended to use the reentrant replacement function 'gcvt_r'. </div> </div> <div class="table-grid-row"> <div class="table-grid-label"> Bad Code </div> <div class="table-grid-value"> <pre class="prettyprint linenums warning"> </pre> </div> </div> <div class="table-grid-row"> <div class="table-grid-label"> Good Code </div> <div class="table-grid-value"> <pre class="prettyprint linenums correct"> </pre> </div> </div> <div class="table-grid-row"> <div class="table-grid-label"> CWE ID </div> <div class="table-grid-value"> <a href="asset/CWE_ID.html" target="_blank">0 </a> </div> </div> <div class="table-grid-row"> <div class="table-grid-label"> Code Review Asset </div> <div class="table-grid-value"> N/A </div> </div> <div class="table-grid-row"> <div class="table-grid-label"> URLs </div> <div class="table-grid-value"> <i class="fa fa-link"></i>&nbsp; <a target="_blank" href="http://pubs.opengroup.org/onlinepubs/009695399/functions/ecvt.html"> http://pubs.opengroup.org/onlinepubs/009695399/functions/ecvt.html </a> </div> </div> </div> <div class="space-20"></div> </body> <html>
KarolAntczak/Dexter
project/dexter-server/public/tool/cppcheck/CPP/help/nonreentrantFunctionsgcvt.html
HTML
bsd-2-clause
3,340
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1013, 1028, 1026, 999, 30524, 2140, 1027, 1000, 6782, 2103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { ExtendComponent } from './src/components/extend.component'; import { SubExtendComponent } from './src/components/sub-extend.component'; const extendRoutes: Routes = [ { path: '', component: ExtendComponent, }, { path: 'main', component: ExtendComponent, }, { path: 'sub', component: SubExtendComponent }, ]; @NgModule({ imports: [ RouterModule.forChild(extendRoutes) ], exports: [ RouterModule ] }) export class ExtendRoutingModule {}
seveves/ng2-lib-test
@lib-test/extend/extend.routes.ts
TypeScript
mit
595
[ 30522, 12324, 1063, 12835, 5302, 8566, 2571, 1065, 2013, 1005, 1030, 16108, 1013, 4563, 1005, 1025, 12324, 1063, 2799, 10867, 7716, 9307, 1010, 5847, 1065, 2013, 1005, 1030, 16108, 1013, 2799, 2099, 1005, 1025, 12324, 1063, 7949, 9006, 2951...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*************************************************************************** * Copyright (C) 2008 by Ralf Kaestner * * ralf.kaestner@gmail.com * * * * 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., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef CAN_H #define CAN_H /** \file * \brief Generic CAN communication * Common commands used to communicate via the CAN protocol. * These methods are implemented by all CAN communication backends. */ #include <tulibs/config.h> /** Predefined CAN constants */ #define CAN_CONFIG_ARG_PREFIX "can" /** Predefined CAN error codes */ #define CAN_ERROR_NONE 0 #define CAN_ERROR_OPEN 1 #define CAN_ERROR_SETUP 2 #define CAN_ERROR_CLOSE 3 #define CAN_ERROR_SEND 4 #define CAN_ERROR_RECEIVE 5 /** \brief Predefined CAN error descriptions */ extern const char* can_errors[]; /** \brief Structure defining a CAN message */ typedef struct can_message_t { int id; //!< The CAN message identifier. unsigned char content[8]; //!< The actual CAN message content. ssize_t length; //!< The length of the CAN message. } can_message_t, *can_message_p; /** \brief Structure defining a CAN device */ typedef struct can_device_t { void* comm_dev; //!< The CAN communication device. config_t config; //!< The CAN configuration parameters. ssize_t num_references; //!< Number of references to this device. ssize_t num_sent; //!< The number of CAN messages sent. ssize_t num_received; //!< The number of CAN messages read. } can_device_t, *can_device_p; /** \brief Predefined CAN default configuration */ extern config_t can_default_config; /** \brief Initialize CAN device * \param[in] dev The CAN device to be initialized. * \param[in] config The optional CAN device configuration parameters. * Can be null. */ void can_init( can_device_p dev, config_p config); /** \brief Initialize CAN device from command line arguments * \param[in] dev The CAN device to be initialized. * \param[in] argc The number of supplied command line arguments. * \param[in] argv The list of supplied command line arguments. * \param[in] prefix An optional argument prefix. */ void can_init_arg( can_device_p dev, int argc, char **argv, const char* prefix); /** \brief Destroy an existing CAN device * \param[in] dev The CAN device to be destroyed. */ void can_destroy( can_device_p dev); /** \brief Open CAN communication * \note This method is implemented by the CAN communication backend. * \param[in] dev The initialized CAN device to be opened. * \return The resulting error code. */ int can_open( can_device_p dev); /** \brief Close CAN communication * \note This method is implemented by the CAN communication backend. * \param[in] dev The opened CAN device to be closed. * \return The resulting error code. */ int can_close( can_device_p dev); /** \brief Send a CAN message * \note This method is implemented by the CAN communication backend. * \param[in] dev The CAN device to be used for sending the message. * \param[in] message The CAN message to be sent. * \return The resulting error code. */ int can_send_message( can_device_p dev, can_message_p message); /** \brief Synchronously receive a CAN message * \note This method is implemented by the CAN communication backend. * \param[in] dev The CAN device to be used for receiving the message. * \param[in,out] message The sent CAN message that will be transformed * into the CAN message received. * \return The resulting error code. */ int can_receive_message( can_device_p dev, can_message_p message); #endif
NIFTi-Fraunhofer/nifti_arm
libcan/src/can/can.h
C
bsd-3-clause
5,084
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
from __future__ import division import abc import numpy as n import scipy.linalg as linalg import scipy.optimize as opt import scipy.spatial.distance as dist class Feature(object): ''' Abstract class that represents a feature to be used with :py:class:`pyransac.ransac.RansacFeature` ''' __metaclass__ = abc.ABCMeta @abc.abstractmethod def __init__(self): pass @abc.abstractproperty def min_points(self): '''int: Minimum number of points needed to define the feature.''' pass @abc.abstractmethod def points_distance(self,points): ''' This function implements a method to compute the distance of points from the feature. Args: points (numpy.ndarray): a numpy array of points the distance must be computed of. Returns: distances (numpy.ndarray): the computed distances of the points from the feature. ''' pass @abc.abstractmethod def print_feature(self,num_points): ''' This method returns an array of x,y coordinates for points that are in the feature. Args: num_points (numpy.ndarray): the number of points to be returned Returns: coords (numpy.ndarray): a num_points x 2 numpy array that contains the points coordinates ''' class Circle(Feature): ''' Feature class for a Circle :math:`(x-x_c)^2 + (y-y_c)^2 - r = 0` ''' min_points = 3 '''int: Minimum number of points needed to define the circle (3).''' def __init__(self,points): self.radius,self.xc,self.yc = self.__gen(points) def __gen(self,points): ''' Compute the radius and the center coordinates of a circumference given three points Args: points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point. Returns: (tuple): A 3 elements tuple that contains the circumference radius and center coordinates [radius,xc,yc] Raises: RuntimeError: If the circle computation does not succeed a RuntimeError is raised. ''' # Linear system for (D,E,F) in circle # equations: D*xi + E*yi + F = -(xi**2 + yi**2) # where xi, yi are the coordinate of the i-th point. # Generating A matrix A = n.array([(x,y,1) for x,y in points]) # Generating rhs rhs = n.array([-(x**2+y**2) for x,y in points]) try: #Solving linear system D,E,F = linalg.lstsq(A,rhs)[0] except linalg.LinAlgError: raise RuntimeError('Circle calculation not successful. Please\ check the input data, probable collinear points') xc = -D/2 yc = -E/2 r = n.sqrt(xc**2+yc**2-F) return (r,xc,yc) def points_distance(self,points): r''' Compute the distance of the points from the feature :math:`d = \left| \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2} - r \right|` Args: points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point. Returns: d (numpy.ndarray): the computed distances of the points from the feature. ''' xa = n.array([self.xc,self.yc]).reshape((1,2)) d = n.abs(dist.cdist(points,xa) - self.radius) return d def print_feature(self, num_points): ''' This method returns an array of x,y coordinates for points that are in the feature. Args: num_points (numpy.ndarray): the number of points to be returned Returns: coords (numpy.ndarray): a num_points x 2 numpy array that contains the points coordinates ''' theta = n.linspace(0,2*n.pi,num_points) x = self.xc + self.radius*n.cos(theta) y = self.yc + self.radius*n.sin(theta) return n.vstack((x,y)) class Exponential (Feature): ''' Feature Class for an exponential curve :math:`y=ax^{k} + b` ''' min_points = 3 def __init__(self,points): self.a,self.k,self.b = self.__gen(points) def __gen(self,points): ''' Compute the three parameters that univocally determine the exponential curve Args: points(numpy.ndarray): a (3,2) numpy array, each row is a 2D Point. Returns: exp(numpy.ndarray): A (3,) numpy array that contains the a,n,b parameters [a,k,b] Raises: RuntimeError: If the circle computation does not succeed a RuntimeError is raised. ''' def exponential(x,points): ''' Non linear system function to use with :py:func:`scypy.optimize.root` ''' aa = x[0] nn = x[1] bb = x[2] f = n.zeros((3,)) f[0] = n.abs(aa)*n.power(points[0,0],nn)+bb - points[0,1] f[1] = n.abs(aa)*n.power(points[1,0],nn)+bb - points[1,1] f[2] = n.abs(aa)*n.power(points[2,0],nn)+bb - points[2,1] return f exp = opt.root(exponential,[1,1,1],points,method='lm')['x'] return exp def points_distance(self,points): r''' Compute the distance of the points from the feature :math:`d = \sqrt{(x_i - x_c)^2 + (y_i-y_c)^2}` Args: points (numpy.ndarray): a (3,2) numpy array, each row is a 2D Point. Returns: d (numpy.ndarray): the computed distances of the points from the feature. ''' x = points[:,0] xa = n.array([x,self.a*n.power(x,self.k)+self.b]) xa = xa.T d = dist.cdist(points,xa) return n.diag(d) def print_feature(self, num_points, a,b): ''' This method returns an array of x,y coordinates for points that are in the feature in the interval [a,b]. Args: num_points (numpy.ndarray): the number of points to be returned a (float): left end of the interval b (float): right end of the interval Returns: coords (numpy.ndarray): a num_points x 2 numpy array that contains the points coordinates ''' x = n.linspace(a,b,num_points) y = self.a*x**self.k + self.b return n.vstack((x,y))
rubendibattista/python-ransac-library
pyransac/features.py
Python
bsd-3-clause
6,919
[ 30522, 2013, 1035, 1035, 2925, 1035, 1035, 12324, 2407, 12324, 5925, 12324, 16371, 8737, 2100, 2004, 1050, 12324, 16596, 7685, 1012, 27022, 2140, 2290, 2004, 27022, 2140, 2290, 12324, 16596, 7685, 1012, 23569, 27605, 4371, 2004, 23569, 12324,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package tsmt import ( "encoding/xml" "github.com/fgrid/iso20022" ) type Document01800105 struct { XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:tsmt.018.001.05 Document"` Message *FullPushThroughReportV05 `xml:"FullPushThrghRpt"` } func (d *Document01800105) AddMessage() *FullPushThroughReportV05 { d.Message = new(FullPushThroughReportV05) return d.Message } // Scope // The FullPushThroughReport message is sent by the matching application to a party involved in a transaction. // This message is used to pass on information that the matching application has received from the submitter. The forwarded information can originate from an InitialBaselineSubmission or BaselineReSubmission or BaselineAmendmentRequest message. // Usage // The FullPushThroughReport message can be sent by the matching application to a party to convey // - the details of an InitialBaselineSubmission message that it has obtained,or // - the details of a BaselineResubmission message that it has obtained,or // - the details of a BaselineAmendmentRequest message that it has obtained. type FullPushThroughReportV05 struct { // Identifies the report. ReportIdentification *iso20022.MessageIdentification1 `xml:"RptId"` // Unique identification assigned by the matching application to the transaction. // This identification is to be used in any communication between the parties. TransactionIdentification *iso20022.SimpleIdentificationInformation `xml:"TxId"` // Unique identification assigned by the matching application to the baseline when it is established. EstablishedBaselineIdentification *iso20022.DocumentIdentification3 `xml:"EstblishdBaselnId,omitempty"` // Identifies the status of the transaction by means of a code. TransactionStatus *iso20022.TransactionStatus4 `xml:"TxSts"` // Reference to the transaction for the financial institution which submitted the baseline. UserTransactionReference []*iso20022.DocumentIdentification5 `xml:"UsrTxRef,omitempty"` // Specifies the type of report. ReportPurpose *iso20022.ReportType1 `xml:"RptPurp"` // Specifies the commercial details of the underlying transaction. PushedThroughBaseline *iso20022.Baseline5 `xml:"PushdThrghBaseln"` // Person to be contacted in the organisation of the buyer. BuyerContactPerson []*iso20022.ContactIdentification1 `xml:"BuyrCtctPrsn,omitempty"` // Person to be contacted in the organisation of the seller. SellerContactPerson []*iso20022.ContactIdentification1 `xml:"SellrCtctPrsn,omitempty"` // Person to be contacted in the buyer's bank. BuyerBankContactPerson []*iso20022.ContactIdentification1 `xml:"BuyrBkCtctPrsn,omitempty"` // Person to be contacted in the seller's bank. SellerBankContactPerson []*iso20022.ContactIdentification1 `xml:"SellrBkCtctPrsn,omitempty"` // Person to be contacted in another bank than the seller or buyer's bank. OtherBankContactPerson []*iso20022.ContactIdentification3 `xml:"OthrBkCtctPrsn,omitempty"` // Information on the next processing step required. RequestForAction *iso20022.PendingActivity2 `xml:"ReqForActn,omitempty"` } func (f *FullPushThroughReportV05) AddReportIdentification() *iso20022.MessageIdentification1 { f.ReportIdentification = new(iso20022.MessageIdentification1) return f.ReportIdentification } func (f *FullPushThroughReportV05) AddTransactionIdentification() *iso20022.SimpleIdentificationInformation { f.TransactionIdentification = new(iso20022.SimpleIdentificationInformation) return f.TransactionIdentification } func (f *FullPushThroughReportV05) AddEstablishedBaselineIdentification() *iso20022.DocumentIdentification3 { f.EstablishedBaselineIdentification = new(iso20022.DocumentIdentification3) return f.EstablishedBaselineIdentification } func (f *FullPushThroughReportV05) AddTransactionStatus() *iso20022.TransactionStatus4 { f.TransactionStatus = new(iso20022.TransactionStatus4) return f.TransactionStatus } func (f *FullPushThroughReportV05) AddUserTransactionReference() *iso20022.DocumentIdentification5 { newValue := new(iso20022.DocumentIdentification5) f.UserTransactionReference = append(f.UserTransactionReference, newValue) return newValue } func (f *FullPushThroughReportV05) AddReportPurpose() *iso20022.ReportType1 { f.ReportPurpose = new(iso20022.ReportType1) return f.ReportPurpose } func (f *FullPushThroughReportV05) AddPushedThroughBaseline() *iso20022.Baseline5 { f.PushedThroughBaseline = new(iso20022.Baseline5) return f.PushedThroughBaseline } func (f *FullPushThroughReportV05) AddBuyerContactPerson() *iso20022.ContactIdentification1 { newValue := new(iso20022.ContactIdentification1) f.BuyerContactPerson = append(f.BuyerContactPerson, newValue) return newValue } func (f *FullPushThroughReportV05) AddSellerContactPerson() *iso20022.ContactIdentification1 { newValue := new(iso20022.ContactIdentification1) f.SellerContactPerson = append(f.SellerContactPerson, newValue) return newValue } func (f *FullPushThroughReportV05) AddBuyerBankContactPerson() *iso20022.ContactIdentification1 { newValue := new(iso20022.ContactIdentification1) f.BuyerBankContactPerson = append(f.BuyerBankContactPerson, newValue) return newValue } func (f *FullPushThroughReportV05) AddSellerBankContactPerson() *iso20022.ContactIdentification1 { newValue := new(iso20022.ContactIdentification1) f.SellerBankContactPerson = append(f.SellerBankContactPerson, newValue) return newValue } func (f *FullPushThroughReportV05) AddOtherBankContactPerson() *iso20022.ContactIdentification3 { newValue := new(iso20022.ContactIdentification3) f.OtherBankContactPerson = append(f.OtherBankContactPerson, newValue) return newValue } func (f *FullPushThroughReportV05) AddRequestForAction() *iso20022.PendingActivity2 { f.RequestForAction = new(iso20022.PendingActivity2) return f.RequestForAction }
fgrid/iso20022
tsmt/FullPushThroughReportV05.go
GO
mit
5,855
[ 30522, 7427, 24529, 20492, 12324, 1006, 1000, 17181, 1013, 20950, 1000, 1000, 21025, 2705, 12083, 1012, 4012, 1013, 1042, 16523, 3593, 1013, 11163, 28332, 19317, 1000, 1007, 2828, 6254, 24096, 17914, 24096, 2692, 2629, 2358, 6820, 6593, 1063,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** Jutish (jysk) * * See MessagesQqq.php for message documentation incl. usage of parameters * To improve a translation please visit http://translatewiki.net * * @ingroup Language * @file * * @author Geitost * @author Huslåke * @author Urhixidur * @author Ælsån */ $fallback = 'da'; $messages = array( # User preference toggles 'tog-underline' => 'Understreg henvesnenger', 'tog-justify' => 'Ves ertikler ve lege margener', 'tog-hideminor' => "Skjul mendre ændrenger i'n liste åver seneste ændrenger", 'tog-extendwatchlist' => 'Udvedet liste ve seneste ændrenger', 'tog-usenewrc' => 'Førbedret liste åver seneste ændrenger (JavaScript)', 'tog-numberheadings' => 'Åtåmatisk nåmererenge åf åverskrefter', 'tog-showtoolbar' => 'Ves værktøjslenje til redigærenge (JavaScript)', 'tog-editondblclick' => 'Redigær sider ve dåbeltklik (JavaScript)', 'tog-editsection' => 'Redigær åfsnet ve hjælp åf [redigær]-henvesnenger', 'tog-editsectiononrightclick' => 'Redigær åfsnet ve at klikke på deres titler (JavaScript)', 'tog-showtoc' => 'Ves endholtsførtegnelse (i artikler ve mære end tre åfsnet)', 'tog-rememberpassword' => 'Husk adgengskode til næste besøĝ frå denne kompjuter (for a maximum of $1 {{PLURAL:$1|day|days}})', 'tog-watchcreations' => 'Tilføj sider a åpretter til miin åvervågnengsliste', 'tog-watchdefault' => 'Tilføj sider a redigærer til miin åvervågnengsliste', 'tog-watchmoves' => 'Tilføj sider a flytter til miin åvervågnengsliste', 'tog-watchdeletion' => 'Tilføj sider a sletter til miin åvervågnengsliste', 'tog-minordefault' => 'Markær søm standård ål redigærenge søm mendre', 'tog-previewontop' => 'Ves førhåndsvesnenge åver æ rædigerengsboks', 'tog-previewonfirst' => 'Ves førhåndsvesnenge når du stårtst ve at redigære', 'tog-nocache' => 'Slå caching åf sider frå', 'tog-enotifwatchlistpages' => 'Send mig en e-mail ve sideændrenger', 'tog-enotifusertalkpages' => 'Send mig en e-mail når miin brugerdiskusjeside ændres', 'tog-enotifminoredits' => 'Send mig også en e-mail ve mendre ændrenger åf åvervågede sider', 'tog-enotifrevealaddr' => "Ves miin e-mail-adresse i mails ve besked ændrenger'm", 'tog-shownumberswatching' => 'Ves åntal brugere, der åvervåger', 'tog-fancysig' => 'Signaturer uden åtåmatisk henvesnenge', 'tog-showjumplinks' => 'Ves tilgængelegheds-henvesnenger', 'tog-uselivepreview' => 'Brug åtåmatisk førhåndsvesnenge (JavaScript) (eksperimentel)', 'tog-forceeditsummary' => 'Advar, hves sammenfatnenge mangler ve gemnenge', 'tog-watchlisthideown' => "Skjul egne ændrenger i'n åvervågnengsliste", 'tog-watchlisthidebots' => "Skjul ændrenger frå bots i'n åvervågnengsliste", 'tog-watchlisthideminor' => "Skjul mendre ændrenger i'n åvervågnengsliste", 'tog-ccmeonemails' => 'Send mig kopier åf e-mails, søm a sender til andre brugere.', 'tog-diffonly' => "Ves ve versjesammenlegnenger kun førskelle, ekke'n hele side", 'tog-showhiddencats' => 'Ves skjulte klynger', 'underline-always' => 'åltid', 'underline-never' => 'åldreg', 'underline-default' => 'æfter brovserendstellenge', # Dates 'sunday' => 'søndåg', 'monday' => 'måndåg', 'tuesday' => 'tirsdåg', 'wednesday' => 'ønsdåg', 'thursday' => 'tårsdåg', 'friday' => 'fredåg', 'saturday' => 'lørsdåg', 'sun' => 'søn', 'mon' => 'mån', 'tue' => 'tir', 'wed' => 'øns', 'thu' => 'tår', 'fri' => 'fre', 'sat' => 'lør', 'january' => 'januar', 'february' => 'februar', 'march' => 'mårts', 'april' => 'åpril', 'may_long' => 'mæ', 'june' => 'juni', 'july' => 'juli', 'august' => 'ågust', 'september' => 'september', 'october' => 'oktober', 'november' => 'november', 'december' => 'desember', 'january-gen' => 'januars', 'february-gen' => 'februars', 'march-gen' => 'mårtses', 'april-gen' => 'åprils', 'may-gen' => 'mæs', 'june-gen' => 'juniis', 'july-gen' => 'juliis', 'august-gen' => 'ågusts', 'september-gen' => 'septembers', 'october-gen' => 'oktobers', 'november-gen' => 'novembers', 'december-gen' => 'desembers', 'jan' => 'jan', 'feb' => 'feb', 'mar' => 'mår', 'apr' => 'åpr', 'may' => 'mæ', 'jun' => 'jun', 'jul' => 'jul', 'aug' => 'ågu', 'sep' => 'sep', 'oct' => 'okt', 'nov' => 'nov', 'dec' => 'des', # Categories related messages 'pagecategories' => '{{PLURAL:$1|Klynge|Klynger}}', 'category_header' => 'Ertikler i\'n klynge "$1"', 'subcategories' => 'Underklynger', 'category-media-header' => "Medier i'n klynge „$1“", 'category-empty' => "''Denne klynge endeholter før øjeblikket æ verke sider æller medie-gøret.''", 'hidden-categories' => '{{PLURAL:$1|Skjult klynge|Skjulte klynger}}', 'hidden-category-category' => 'Skjulte klynger', 'listingcontinuesabbrev' => 'førtgøte', 'about' => 'Åm', 'article' => 'Ertikel', 'newwindow' => '(åbner i et nyt vendue)', 'cancel' => 'Åfbryd', 'moredotdotdot' => 'Mære...', 'mypage' => 'Miin side', 'mytalk' => 'Min diskusje', 'anontalk' => 'Diskusjeside før denne IP-adresse', 'navigation' => 'Navigasje', 'and' => '&#32;og', # Cologne Blue skin 'qbfind' => 'Søĝ', 'qbbrowse' => 'Gennemse', 'qbedit' => 'Redigær', 'qbpageoptions' => 'Endstellenger før side', 'qbmyoptions' => 'Miine endstellenger', 'qbspecialpages' => 'Sonst sider', 'faq' => 'VSF', 'faqpage' => 'Project:Vøl stellen fråĝer (VSF)', 'errorpagetitle' => 'Fejl', 'returnto' => 'Tilbage til $1.', 'tagline' => 'Frå {{SITENAME}}', 'help' => 'Hjælp', 'search' => 'Søĝ', 'searchbutton' => 'Søĝ', 'go' => 'Gå til', 'searcharticle' => 'Gå til', 'history' => 'Skigt', 'history_short' => 'Skigte', 'updatedmarker' => '(ændret)', 'printableversion' => 'Utskreftsvelig utgåf', 'permalink' => 'Permanent henvesnenge', 'print' => 'Udskrev', 'edit' => 'Redigær', 'create' => 'Skep', 'editthispage' => 'Redigær side', 'create-this-page' => 'Skep denne side', 'delete' => 'Slet', 'deletethispage' => 'Slet side', 'undelete_short' => 'Førtryd sletnenge åf {{PLURAL:$1|$1 versje|$1 versje}}', 'protect' => 'Beskyt', 'protect_change' => 'Ændret beskyttelse', 'protectthispage' => 'Beskyt side', 'unprotect' => 'Fjern beskyttelse', 'unprotectthispage' => 'Frigæv side', 'newpage' => 'Ny side', 'talkpage' => 'Diskusje', 'talkpagelinktext' => 'diskusje', 'specialpage' => 'Sonst side', 'personaltools' => "Personlige værktø'r", 'postcomment' => 'Tilføj en biskrevselenger', 'articlepage' => "Se'n ertikel", 'talk' => 'Diskusje', 'views' => 'Vesnenger', 'toolbox' => "Værktø'r", 'userpage' => "Se'n brugerside", 'projectpage' => "Se'n projektside", 'imagepage' => "Se'n billetside", 'mediawikipage' => 'Vese endholtsside', 'templatepage' => 'Vese skablånside', 'viewhelppage' => 'Vese hjælpeside', 'categorypage' => 'Vese klyngeside', 'viewtalkpage' => "Se'n diskusje", 'otherlanguages' => 'Andre språĝ', 'redirectedfrom' => '(Åmstyret frå $1)', 'redirectpagesub' => 'Åmstyrenge', 'lastmodifiedat' => 'Denne side blev senest ændret den $2, $1.', 'viewcount' => 'Æ side er vest i alt $1 {{PLURAL:$1|geng|genger}}.', 'protectedpage' => 'Beskyttet side', 'jumpto' => 'Skeft til:', 'jumptonavigation' => 'navigasje', 'jumptosearch' => 'Søĝnenge', # All link text and link target definitions of links into project namespace that get used by other message strings, with the exception of user group pages (see grouppage) and the disambiguation template definition (see disambiguations). 'aboutsite' => "{{SITENAME}}'m", 'aboutpage' => 'Project:Åm', 'copyright' => 'Endholtet er udgævet under $1.', 'copyrightpage' => '{{ns:project}}:Åphavsret', 'currentevents' => 'Nænte begevenheder', 'currentevents-url' => 'Project:Nænte begevenheder', 'disclaimers' => 'Førbeholt', 'disclaimerpage' => 'Project:Huses førbeholt', 'edithelp' => 'Hjælp til redigærenge', 'helppage' => 'Help:Hjælpførside', 'mainpage' => 'Førsit', 'mainpage-description' => 'Førsit', 'policy-url' => 'Project:Politik', 'portal' => 'Førside før skrebenter', 'portal-url' => 'Project:Førside før skrebenter', 'privacy' => 'Behandlenge åf personlige åplysnenger', 'privacypage' => 'Project:Behandlinge åf personlige åplysnenger', 'badaccess' => 'Manglende rettigheder', 'badaccess-group0' => 'Du harst ekke de nødvendege rettegheder til denne håndlenge.', 'badaccess-groups' => 'Denne håndlenge ken kun udføres åf brugere, søm tilhører en åf grupperne „$1“.', 'versionrequired' => 'Kræver versje $1 åf MediaWiki', 'versionrequiredtext' => "Versje $1 åf MediaWiki er påkrævet, før at bruge denne side. Se'n [[Special:Version|versjeside]]", 'ok' => 'Er åkæ', 'retrievedfrom' => 'Hæntet frå "$1"', 'youhavenewmessages' => 'Du har $1 ($2).', 'newmessageslink' => 'nye beskeder', 'newmessagesdifflink' => 'ændrenger æ side sedste vesnenge', 'youhavenewmessagesmulti' => 'Der er nye meddelelser til dig: $1', 'editsection' => 'redigær', 'editold' => 'redigær', 'viewsourceold' => 'ves æ kelde', 'editsectionhint' => 'Redigær åfsnet: $1', 'toc' => 'Endholtsførtegnelse', 'showtoc' => 'ves', 'hidetoc' => 'skjul', 'thisisdeleted' => 'Se æller gendan $1?', 'viewdeleted' => 'Ves $1?', 'restorelink' => '{{PLURAL:$1|en slettet ændrenge|$1 slettede ændrenger}}', 'feedlinks' => 'Fiid:', 'feed-invalid' => 'Ugyldeg abånmentstype.', 'feed-unavailable' => 'RSS og Atåm fiid er ekke tilgængelege på {{SITENAME}}', 'site-rss-feed' => '$1 RSS-fiid', 'site-atom-feed' => '$1 Atom-fiid', 'page-rss-feed' => '"$1" RSS-fiid', 'page-atom-feed' => '"$1" Atom-fiid', 'red-link-title' => '$1 (ekke skrevet endnu)', # Short words for each namespace, by default used in the namespace tab in monobook 'nstab-main' => 'ertikel', 'nstab-user' => 'brugerside', 'nstab-media' => 'medie', 'nstab-special' => 'sonst', 'nstab-project' => 'åm', 'nstab-image' => 'billet', 'nstab-mediawiki' => 'besked', 'nstab-template' => 'skablån', 'nstab-help' => 'hjælp', 'nstab-category' => 'Klynge', # Main script and global functions 'nosuchaction' => 'Æ funksje fendes ekke', 'nosuchactiontext' => "Funksje ångævet i'n URL ken ekke genkendes åf æ MediaWiki-softwær", 'nosuchspecialpage' => 'En sådan sonstside fendes ekke', 'nospecialpagetext' => "Du harst bedt en sonstside'm, der ekke ken genkendes åf æ MediaWiki-softwær.", # General errors 'error' => 'Fejl', 'databaseerror' => 'Databasefejl', 'dberrortext' => 'Der er åpstået en syntaksfejl i en databaseførespørgsel. Dette ken være på grund åf en ugyldeg førespørgsel, æller det ken betyde en fejl i\'n softwær. Den seneste førsøĝte databaseførespørgsel var: <blockquote><tt>$1</tt></blockquote> frå\'n funksje "<tt>$2</tt>". MySQL æ returnerede fejl "<tt>$3: $4</tt>".', 'dberrortextcl' => 'Der er åpstået en syntaksfejl i en databaseførespørgsel. Den seneste førsøĝte databaseførespørgsel var: "$1" frå\'n funksje "$2". MySQL æ returnerede fejl "$3: $4".', 'laggedslavemode' => 'Bemærk: Den veste side endholter mulegves ekke de nyeste ændrenger.', 'readonly' => 'Æ database er skrevebeskyttet', 'enterlockreason' => "Skrev en begrundelse før æ skrevebeskyttelse, ve samt en vurderenge åf, hvornår æ skrevebeskyttelse åphæves ig'n", 'readonlytext' => 'Æ database er midlertedegt skrevebeskyttet. Førsøĝ venlegst senere. Årsag til æ spærrenge: $1', 'readonly_lag' => "Æ database er åtåmatisk blevet låst mens slæfdatabaseserverne synkroniserer ve'n master database", 'internalerror' => 'Intern fejl', 'internalerror_info' => 'Intern fejl: $1', 'filecopyerror' => 'Kan ekke kopiere\'n file "$1" til "$2".', 'filerenameerror' => 'Kan ekke omdøbe\'n file "$1" til "$2".', 'filedeleteerror' => 'Kan ekke slette\'n file "$1".', 'directorycreateerror' => 'Kan ekke åprette katalåget "$1".', 'filenotfound' => 'Kan ekke finde\'n file "$1".', 'fileexistserror' => 'Kan ekke åprette "$1": æ file findes ålrede', 'unexpected' => 'Uventet værdi: "$1"="$2".', 'formerror' => 'Fejl: Kan ekke åfsende formulær', 'badtitle' => 'Førkert skrevselenger', 'badtitletext' => 'Den ønskede sides nav var ekke tilladt, tøm æller æ side er førkert henvest frå en {{SITENAME}} på et andet språĝ.', 'wrong_wfQuery_params' => 'Ugyldeg paramæter til wfQuery()<br /> Funksje: $1<br /> Førespørgsel: $2', 'viewsource' => 'Ves æ kelde', 'viewsourcetext' => "Du ken dog se og åfskreve'n keldekode til æ side:", # Login and logout pages 'yourname' => 'Dit brugernav', 'yourpassword' => 'Din adgangskode', 'remembermypassword' => 'Husk min adgangskode til næste gang (for a maximum of $1 {{PLURAL:$1|day|days}})', 'login' => 'Loĝ på', 'nav-login-createaccount' => 'Åpret æ konto æller loĝ på', 'loginprompt' => 'Du skal have cookies slået til før at kunne loĝge på {{SITENAME}}.', 'userlogin' => 'Åpret æ konto æller loĝ på', 'logout' => 'Loĝ åf', 'userlogout' => 'Loĝ åf', 'nologin' => 'Du har engen brugerkonto? $1.', 'nologinlink' => 'Åpret ny brugerkonto', 'createaccount' => 'Åpret en ny konto', 'gotaccount' => "Du har ålerede en brugerkonto? '''$1'''.", 'gotaccountlink' => 'Loĝ på', 'loginsuccesstitle' => 'Du er nu loĝget på', 'loginsuccess' => 'Du er nu loĝget på {{SITENAME}} søm "$1".', 'nosuchuser' => 'Der er ig\'n bruger ve navnet "$1". Kontrollér æ stavemåde ig\'n, æller brug æ formulår herunder til at åprette en ny brugerkonto.', 'nosuchusershort' => 'Der er ig\'n bruger ve navn "$1". Tjek din stavnenge.', 'nouserspecified' => 'Angæv venlegst et brugernavn.', 'wrongpassword' => "Den endtastede adgangskode var førkert. Prøv ig'n.", 'wrongpasswordempty' => "Du glemte at endtaste password. Prøv ig'n.", 'passwordtooshort' => 'Dit kodeort er før kårt. Det skal være mendst $1 tegn langt.', 'mailmypassword' => 'Send et nyt adgangskode til min e-mail-adresse', 'passwordremindertitle' => 'Nyt password til {{SITENAME}}', 'passwordremindertext' => 'Nogen (sandsynlegves dig, frå\'n IP-addresse $1) har bedt at vi sender dig en ny adgangskode til at loĝge på {{SITENAME}} ($4)\'m. Æ adgangskode før bruger "$2" er nu "$3". Du bør loĝge på nu og ændre din adgangskode., Hves en anden har bestilt den nye adgangskode æller hves du er kåmet i tanke dit gamle password og ekke mære vil ændre det\'m, kenst du bare ignorere denne mail og førtsætte ve at bruge dit gamle password.', 'noemail' => 'Der er ekke åplyst en e-mail-adresse før bruger "$1".', 'passwordsent' => 'En ny adgangskode er sendt til æ e-mail-adresse, søm er registræret før "$1". Du bør loĝge på og ændre din adgangskode straks æfter du harst modtaget æ e-mail.', 'eauthentsent' => 'En bekrftelsesmail er sendt til den angævne e-mail-adresse. Før en e-mail ken modtages åf andre brugere åf æ {{SITENAME}}-mailfunksje, skel æ adresse og dens tilhørsførholt til denne bruger bekræftes. Følg venlegst anvesnengerne i denne mail.', # Change password dialog 'retypenew' => 'Gentag ny adgangskode', # Edit page toolbar 'bold_sample' => 'Fed skrevselenger', 'bold_tip' => 'Fed skrevselenger', 'italic_sample' => 'Skyn skrevselenger', 'italic_tip' => 'Skyn skrevselenger', 'link_sample' => 'Henvesnenge', 'link_tip' => 'Ensende henvesnenge', 'extlink_sample' => 'http://www.example.com Skrevselenger på henvesnenge', 'extlink_tip' => 'Utsende henvesnenge (husk http:// førgøret)', 'headline_sample' => 'Skrevselenger til åverskreft', 'headline_tip' => 'Skå 2 åverskreft', 'nowiki_sample' => 'Endsæt skrevselenger her søm ekke skal redigær påke wikiskrevselenger', 'nowiki_tip' => 'Ekke wikiskrevselenger utse', 'image_tip' => 'Endlejret billet', 'media_tip' => 'Henvesnenge til multimediagøret', 'sig_tip' => 'Din håndstep ve tidsstep', 'hr_tip' => 'Plat lenje (brug den sparsåmt)', # Edit pages 'summary' => 'Beskrevelse:', 'subject' => 'Emne/åverskreft:', 'minoredit' => "Dette'r en mendre æller lile ændrenge.", 'watchthis' => 'Åvervåg denne ertikel', 'savearticle' => 'Gem side', 'preview' => 'Førhåndsvesnenge', 'showpreview' => 'Førhåndsvesnenge', 'showdiff' => 'Ves ændrenger', 'anoneditwarning' => "Du arbejder uden at være loĝget på. Estedet før brugernav veses så'n IP-adresse i'n hersenengerskigt.", 'summary-preview' => 'Førhåndsvesnenge åf beskrevelselejne:', 'blockedtext' => "'''Dit brugernav æller din IP-adresse er blevet blokeret.''' Æ blokerenge er lavet åf $1. Æ begrundelse er ''$2''. Æ blokerenge starter: $8 Æ blokerenge udløber: $6 Æ blokerenge er rettet mod: $7 Du ken kåle $1 æller en åf de andre [[{{MediaWiki:Grouppage-sysop}}|administratårer]] før at diskutere æ blokerenge. Du ken ekke bruge æ funksje 'e-mail til denne bruger' vemendre der er ångevet en gyldig email-addresse i dine [[Special:Preferences|kontoendstellenger]]. Din nuværende IP-addresse er $3, og blokerengs-ID er #$5. Ångev venlegst en æller begge i åle henvendelser.", 'newarticle' => '(Ny)', 'newarticletext' => "'''{{SITENAME}} har endnu ekke nogen {{NAMESPACE}}-side ve nav {{PAGENAME}}.'''<br /> Du ken begynde en side ve at skreve i'n boks herunder. (se'n [[{{MediaWiki:Helppage}}|hjælp]] før yderligere åplysnenger).<br /> Æller du ken [[Special:Search/{{PAGENAME}}|søĝe æfter {{PAGENAME}} i {{SITENAME}}]].<br /> Ves det ekke var din meneng, så tryk på æ '''Tilbage'''- æller æ '''Back'''-knåp.", 'noarticletext' => "'''{{SITENAME}} har ekke nogen side ve prånt dette nav.''' * Du ken '''[{{fullurl:{{FULLPAGENAME}}|action=edit}} starte æ side {{PAGENAME}}]''' * Æller [[Special:Search/{{PAGENAME}}|søĝe æfter {{PAGENAME}}]] i andre ertikler ---- * Ves du har åprettet denne ertikel endenfør de sedste få minutter, så ken de skyldes at der er ledt førsenkelse i'n åpdaterenge åf {{SITENAME}}s cache. Vent venligst og tjek igen senere'n ertikel'm dukker åp, enden du førsøĝer at åprette'n ertikel igen.", 'previewnote' => "'''Husk at dette er kun en førhåndsvesnenge, æ side er ekke gemt endnu!'''", 'editing' => 'Redigærer $1', 'editingsection' => 'Redigærer $1 (åfsnet)', 'copyrightwarning' => "'''Husk: åpskrev engen websider, søm ekke tilhører dig selv, brug engen åphavsretsligt beskyttede værker uden tilladelse frå'n ejer!'''<br /> Du lover os hermed, at du selv '''har skrevet skrevselenger''', at skrevselenger tilhører ålmenheden, er ('''åpværer hus'''), æller at æ '''åphavsrets-endehaver''' har gevet sen '''tilladelse'''. Ves denne skrevselenger ålerede er åfentliggkort andre steder, skrev det venligst på æ diskusjesside. <i>Bemærk venligst, at ål {{SITENAME}}-ertikler åtomatisk står under „$2“ (se $1 før lileskrevselenger). Ves du ekke vel, at dit arbejde her ændres og udbredes åf andre, så tryk ekke på „Gem“.</i>", 'templatesused' => 'Skablåner der er brugt på denne side:', 'templatesusedpreview' => 'Følgende skablåner bruges åf denne ertikelførhåndsvesnenge:', 'template-protected' => '(skrevebeskyttet)', 'template-semiprotected' => '(skrevebeskyttet før ekke ånmeldte og nye brugere)', 'nocreatetext' => "Æ'n åpdiin har begrænset åprettelse åf nye sider. Bestående sider ken ændres æller [[Special:UserLogin|loĝge på]].", 'recreate-moveddeleted-warn' => "'''Advarsel: Du er ve at genskabe en tidligere slettet side.''' Åvervej det'm er passende at genåprette'n side. De slettede hersenenger før denne side er vest nedenfør:", # History pages 'viewpagelogs' => 'Ves loglister før denne side', 'currentrev' => 'Nuværende hersenenge', 'revisionasof' => 'Hersenenger frå $1', 'revision-info' => 'Hersenenge frå $1 til $2', 'previousrevision' => '←Ældre hersenenge', 'nextrevision' => 'Nyere hersenenge→', 'currentrevisionlink' => 'se nuværende hersenenge', 'cur' => 'nuværende', 'last' => 'forrige', 'page_first' => 'Startem', 'page_last' => 'Enden', 'histlegend' => 'Førklårenge: (nuværende) = førskel til den nuværende hersenenge, (førge) = førskel til den førge hersenenge, l = lile til mendre ændrenge', 'histfirst' => 'Ældste', 'histlast' => 'Nyeste', # Revision feed 'history-feed-item-nocomment' => '$1 ve $2', # Diffs 'history-title' => 'Hersengsskigte før "$1"', 'lineno' => 'Lenje $1:', 'compareselectedversions' => 'Sammenlign valgte hersenenger', 'editundo' => 'baĝgøt', 'diff-multi' => '(Æ hersenengssammenlegnenge vetåger {{PLURAL:$1|en mellemleggende hersenenge|$1 mellemleggende hersenenger}}.)', # Search results 'prevn' => 'førge {{PLURAL:$1|$1}}', 'nextn' => 'nægste {{PLURAL:$1|$1}}', 'viewprevnext' => 'Ves ($1 {{int:pipe-separator}} $2) ($3)', 'searchall' => 'ål', 'powersearch' => 'Søĝ', # Preferences page 'preferences' => 'Endstellenger', 'mypreferences' => 'Endstellenger', 'skin-preview' => 'Førhåndsvesnenge', 'youremail' => 'E-mail:', 'yourrealname' => 'Dit rigtege navn*', 'prefs-help-realname' => '* <strong>Dit rigtege navn</strong> (valgfrit): Hves du vælger at åplyse dit navn hvil dette bleve brugt til at tilskreve dig dit arbejde.', 'grouppage-sysop' => '{{ns:project}}:Administråtorer', # Special:Log/newusers 'newuserlogpage' => 'Brugeråprettelseslog', 'newuserlogpagetext' => "Dett'er en log åver de senest åprettede brugere.", # User rights log 'rightslog' => 'Rettigheds-logbåĝ', # Recent changes 'nchanges' => '$1 {{PLURAL:$1|ændrenge|ændrenger}}', 'recentchanges' => 'Seneste ændrenger', 'recentchanges-feed-description' => 'Ve dette fiid ken du følge de seneste ændrenger på {{SITENAME}}.', 'rcnote' => "Herunder ses {{PLURAL:$1|'''1''' ændrenge|de sedste '''$1''' ændrenger}} frå {{PLURAL:$2|i dåg|de sedste '''$2''' dåg}}, søm i $3.", 'rcnotefrom' => "Nedenfør ses ændrengerne frå '''$2''' til '''$1''' vest.", 'rclistfrom' => 'Ves nye ændrenger startende frå $1', 'rcshowhideminor' => '$1 lile ændrenger', 'rcshowhidebots' => '$1 råbotter', 'rcshowhideliu' => '$1 regestrerede brugere', 'rcshowhideanons' => '$1 anonyme brugere', 'rcshowhidepatr' => '$1 bekiiknurede ændrenger', 'rcshowhidemine' => '$1 egne bidråg', 'rclinks' => 'Ves seneste $1 ændrenger i de sedste $2 dåg<br />$3', 'diff' => 'førskel', 'hist' => 'skigte', 'hide' => 'skjul', 'show' => 'ves', 'minoreditletter' => 'l', 'newpageletter' => 'N', 'boteditletter' => 'b', # Recent changes linked 'recentchangeslinked' => 'Relaterede ændrenger', 'recentchangeslinked-feed' => 'Relaterede ændrenger', 'recentchangeslinked-toolbox' => 'Relaterede ændrenger', 'recentchangeslinked-title' => 'Ændrenger der vegånde til "$1"', 'recentchangeslinked-summary' => "Denne sonstside beser de seneste ændrenger på de sider der henveses til. Sider på din åvervågnengsliste er vest ve '''fed''' skreft.", # Upload 'upload' => 'Læĝ æ billet åp', 'uploadbtn' => 'Læĝ æ gøret åp', 'uploadlogpage' => 'Åplægnengslog', 'uploadedimage' => 'Låĝde "[[$1]]" åp', # Special:ListFiles 'listfiles' => 'Billetliste', # File description page 'file-anchor-link' => 'Billet', 'filehist' => 'Billetskigt', 'filehist-help' => "Klik på'n dato/tid før at se den hersenenge åf gøret.", 'filehist-current' => 'nuværende', 'filehist-datetime' => 'Dato/tid', 'filehist-user' => 'Bruger', 'filehist-dimensions' => 'Treflåksjener', 'filehist-filesize' => 'Gøretstørrelse', 'filehist-comment' => 'Biskrevselenge', 'imagelinks' => 'Billethenvesnenger', 'linkstoimage' => 'De følgende sider henveser til dette billet:', 'nolinkstoimage' => 'Der er engen sider der henveser til dette billet.', 'sharedupload' => 'Denne gøret er en fælles læĝenge og ken bruges åf andre projekter.', 'uploadnewversion-linktext' => 'Læĝ en ny hersenenge åf denne gøret åp', # MIME search 'mimesearch' => 'Søĝe æfter MIME-sårt', # List redirects 'listredirects' => 'Henvesnengsliste', # Unused templates 'unusedtemplates' => 'Ekke brugte skablåner', # Random page 'randompage' => 'Tilfældig ertikel', # Random redirect 'randomredirect' => 'Tilfældige henvesnenger', # Statistics 'statistics' => 'Sensje', 'disambiguations' => 'Ertikler ve flertydige skrevselenger', 'doubleredirects' => 'Dåbbelte åmstyrenger', 'brokenredirects' => 'Bråken åmstyrenger', 'withoutinterwiki' => 'Sider uden henvesnenger til andre språĝ', 'fewestrevisions' => 'Sider ve de færreste hersenenger', # Miscellaneous special pages 'nbytes' => '$1 {{PLURAL:$1|åg|åger}}', 'nlinks' => '{{PLURAL:$1|1 henvesnenge|$1 henvesnenger}}', 'nmembers' => '- {{PLURAL:$1|1 ertikel|$1 ertikler}}', 'lonelypages' => 'Førældreløse ertikler', 'uncategorizedpages' => 'Uklyngede sider', 'uncategorizedcategories' => 'Uklyngede klynger', 'uncategorizedimages' => 'Ekke klyngede gøret', 'uncategorizedtemplates' => 'Ekke klyngede skablåner', 'unusedcategories' => 'Ubrugte klynger', 'unusedimages' => 'Ubrugte billeter', 'wantedcategories' => 'Brugte men ekke ånlagte klynger', 'wantedpages' => 'Ønskede ertikler', 'mostlinked' => 'Sider ve flest henvesnenger', 'mostlinkedcategories' => 'Mest brugte klynger', 'mostlinkedtemplates' => 'Hyppigst brugte skablåner', 'mostcategories' => 'Mest brugte sider', 'mostimages' => 'Mest brugte gøret', 'mostrevisions' => 'Sider ve de fleste ændrenger', 'prefixindex' => 'Åle sider (ve førgøret)', 'shortpages' => 'Kårte ertikler', 'longpages' => 'Långe ertikler', 'deadendpages' => 'Blendgydesider', 'protectedpages' => 'Skrevebeskyttede sider', 'listusers' => 'Brugerliste', 'newpages' => 'Nyeste ertikler', 'ancientpages' => 'Ældste ertikler', 'move' => 'Flyt', 'movethispage' => 'Flyt side', # Book sources 'booksources' => 'Boĝkelder', # Special:Log 'specialloguserlabel' => 'Bruger:', 'speciallogtitlelabel' => 'Skrevselenge:', 'log' => 'Loglister', 'all-logs-page' => 'Åle loglister', # Special:AllPages 'allpages' => 'Åle ertikler', 'alphaindexline' => '$1 til $2', 'nextpage' => 'Næste side ($1)', 'prevpage' => 'Førge side ($1)', 'allpagesfrom' => 'Ves sider startende frå:', 'allarticles' => 'Åle ertikler', 'allpagessubmit' => 'Ves', 'allpagesprefix' => 'Ves sider ve førgøret:', # Special:Categories 'categories' => 'Klynger', # Special:DeletedContributions 'deletedcontributions' => 'Slettede brugerbidråg', 'deletedcontributions-title' => 'Slettede brugerbidråg', # Special:LinkSearch 'linksearch' => 'Søĝ i weblinks', 'linksearch-pat' => 'Søĝ æfter links til:', 'linksearch-ns' => 'Navnerum:', 'linksearch-ok' => 'Søĝ', 'linksearch-text' => 'Wildkårter søm "*.wikipedia.org" ken benyttes.<br />Understøttede pråtåkoller: <code>$1</code>', 'linksearch-line' => '$2 linker til $1', 'linksearch-error' => "Wildkårter må ken benyttes i'n stårt åf håstnavnet.", # Email user 'emailuser' => 'E-mail til denne bruger', # Watchlist 'watchlist' => 'Åvervågnengsliste', 'mywatchlist' => 'Åvervågnengsliste', 'addedwatchtext' => "Æ side \"[[:\$1]]\" er blevet tilføjet til din [[Special:Watchlist|åvervågningsliste]]. Fremtidige ændrenger til denne side og den tilhørende diskusjeside hvil bleve listet der, og æ side hvil fremstå '''fremhævet''' i'n [[Special:RecentChanges|liste ve de seneste ændrenger]] før at gøre det lettere at finde den. Hves du senere hvilst fjerne'n side frå din åvervågningsliste, så klik \"Fjern åvervågnenge\".", 'removedwatchtext' => 'Æ side "[[:$1]]" er blevet fjernet frå din åvervågnengsliste.', 'watch' => 'Åvervåg', 'watchthispage' => 'Åvervåg side', 'unwatch' => 'Fjern åvervågnenge', 'watchlist-details' => 'Du har $1 {{PLURAL:$1|side|sider}} på din åvervågnengsliste (øn diskusjesider).', 'wlshowlast' => 'Ves de seneste $1 têmer $2 dåg $3', # Displayed when you click the "watch" button and it is in the process of watching 'watching' => 'Åvervåge …', 'unwatching' => 'Ekke åvervåge …', # Delete 'deletepage' => 'Slet side', 'historywarning' => 'Advarsel: Æ side du erst ve at slette har en skigte:', 'confirmdeletetext' => "Du erst ve permanent at slette en side æller et billet sammen ve hæle den tilhørende skigte frå'n database. Bekræft venlegst at du virkelg hvilst gøre dette, at du førstårst konsekvenserne, og at du gør dette i åverensstemmelse ve [[{{MediaWiki:Policy-url}}]].", 'actioncomplete' => 'Gennemført', 'deletedtext' => '"$1" er slettet. Sæg $2 før en førtegnelse åver de nyeste sletnenger.', 'dellogpage' => 'Sletnengslog', 'deletecomment' => 'Begrundelse:', 'deleteotherreason' => 'Anden/uddybende begrundelse:', 'deletereasonotherlist' => 'Anden begrundelse', # Rollback 'rollbacklink' => 'fjern redigærenge', # Protect 'protectlogpage' => 'Liste åver beskyttede sider', 'prot_1movedto2' => '[[$1]] flyttet til [[$2]]', 'protectcomment' => 'Begrundelse:', 'protectexpiry' => 'Udløb:', 'protect_expiry_invalid' => 'Æ udløbstiid er ugyldeg.', 'protect_expiry_old' => "Æ udløbstiid legger i'n førtiid.", 'protect-text' => "Her ken beskyttelsesståt før æ side '''$1''' ses og ændres.", 'protect-locked-access' => "Den brugerkonto har ekke de nødvendege rettegheder til at æ ændre sidebeskyttelse. Her er de aktuelle beskyttelsesendstellenger før æ side '''„$1“:'''", 'protect-cascadeon' => 'Denne side er del åf en nedarvet skrevebeskyttelse. Wen er endeholt i nedenstående {{PLURAL:$1|side|sider}}, søm er skrevebeskyttet ve tilvalg åf "nedarvende sidebeskyttelse" Æ sidebeskyttelse ken ændres før denne side, det påverker dog ekke\'n kaskadespærrenge:', 'protect-default' => 'Ål (standård)', 'protect-fallback' => 'Kræv "$1"-tilladelse', 'protect-level-autoconfirmed' => 'Spærrenge før ekke registrærede brugere', 'protect-level-sysop' => 'Kan administratårer', 'protect-summary-cascade' => 'nedarvende', 'protect-expiring' => 'til $1 (UTC)', 'protect-cascade' => 'Nedarvende spærrenge – ål skabelåner, søm er endbundet i denne side spærres også.', 'protect-cantedit' => 'Du kenst ekke ændre beskyttelsesnivå før denne side, da du ekke kenst redigære føden.', 'protect-expiry-options' => '1 tême:1 hour,1 dåĝ:1 day,1 uge:1 week,2 uger:2 weeks,1 måned:1 month,3 måneder:3 months,6 måneder:6 months,1 år:1 year,ubegrænset:indefinite', 'restriction-type' => 'Beskyttelsesståt', 'restriction-level' => 'Beskyttelseshøjde', # Undelete 'undeletebtn' => 'Gendan!', # Namespace form on various pages 'namespace' => 'Naverum:', 'invert' => 'Næbiiner udvalg', 'blanknamespace' => '(Ertikler)', # Contributions 'contributions' => 'Brugerbidråg', 'mycontris' => 'Mine bidråg', 'contribsub2' => 'Før $1 ($2)', 'uctop' => '(seneste)', 'month' => 'Måned:', 'year' => 'År:', 'sp-contributions-newbies-sub' => 'Før nybegyndere', 'sp-contributions-blocklog' => 'Blokerengslog', 'sp-contributions-deleted' => 'Slettede brugerbidråg', 'sp-contributions-talk' => 'diskusje', # What links here 'whatlinkshere' => 'Vat henveser hertil', 'whatlinkshere-title' => 'Sider der henveser til $1', 'linkshere' => "De følgende sider henveser til '''„[[:$1]]“''':", 'nolinkshere' => "Engen sider henveser til '''„[[:$1]]“'''.", 'isredirect' => 'åmstyrsside', 'istemplate' => 'Skablånvetagnenge', 'whatlinkshere-prev' => '{{PLURAL:$1|førge|førge $1}}', 'whatlinkshere-next' => '{{PLURAL:$1|nægste|nægste $1}}', 'whatlinkshere-links' => '← henvesnenger', # Block/unblock 'blockip' => 'Bloker bruger', 'ipboptions' => '1 tême:1 hour,2 têmer:2 hours,6 têmer:6 hours,1 dåĝ:1 day,3 dåĝ:3 days,1 uge:1 week,2 uger:2 weeks,1 måned:1 month,3 måneder:3 months,1 år:1 year,ubegrænset:indefinite', 'ipblocklist' => 'Blokerede IP-adresser og brugernave', 'blocklink' => 'blåker', 'unblocklink' => 'åphæv blokerenge', 'contribslink' => 'bidråĝ', 'blocklogpage' => 'Blokerengslog', 'blocklogentry' => 'blokerede "[[$1]]" ve\'n udløbstid på $2 $3', # Move page 'movepagetext' => "Når du brugerst æ formulær herunder hvilst du få omdøbt en side og flyttet æ hæle side han skigte til det nye navn. Den gamle titel hvil bleve en omdirigærengsside til den nye titel. Henvesnenger til den gamle titel hvil ekke bleve ændret. Sørg før at tjekke før dåbelte æller dårlege omdirigærenger. Du erst ansvarleg før, at ål henvesnenger stadeg pæger derhen, hvår det er æ mænenge de skal pæge. Bemærk at æ side '''ekke''' ken flyttes hves der ålrede er en side ve den nye titel, medmendre den side er tøm æller er en omdirigærenge uden nogen skigte. Det betyder at du kenst flytte en side tilbåge hvår den kåm frå, hves du kåmer til at lave en fejl. '''ADVARSEL!''' Dette ken være en drastisk og uventet ændrenge før en populær side; vær sekker på, at du førstår konsekvenserne åf dette før du førtsætter.", 'movepagetalktext' => "Den tilhørende diskusjeside, hves der er en, hvil åtåmatisk bleve flyttet ve'n side '''medmendre:''' *Du flytter æ side til et andet navnerum, *En ekke-tøm diskusjeside ålrede eksisterer under det nye navn, æller *Du fjerner æ markærenge i'n boks nedenunder. I disse tilfælde er du nødt til at flytte æller sammenflette'n side manuelt.", 'movearticle' => 'Flyt side:', 'newtitle' => 'Til ny titel:', 'move-watch' => 'Denne side åvervåges', 'movepagebtn' => 'Flyt side', 'pagemovedsub' => 'Flytnenge gennemført', 'movepage-moved' => 'Æ side \'\'\'"$1" er flyttet til "$2"\'\'\'', 'articleexists' => 'En side ve det navn eksisterer ålrede, æller det navn du harst valgt er ekke gyldegt. Vælg et andet navn.', 'talkexists' => 'Æ side blev flyttet korrekt, men den tilhørende diskusjeside ken ekke flyttes, førdi der ålrede eksisterer en ve den nye titel. Du erst nødt til at flette dem sammen manuelt.', 'movedto' => 'flyttet til', 'movetalk' => 'Flyt også\'n "diskusjeside", hves den eksisterer.', 'movelogpage' => 'Flyttelog', 'movereason' => 'Begrundelse:', 'revertmove' => 'gendan', # Export 'export' => 'Utgøter sider', # Namespace 8 related 'allmessages' => 'Åle beskeder', # Thumbnails 'thumbnail-more' => 'Førstør', 'thumbnail_error' => 'Fejl ve åprettelse åf thumbnail: $1', # Import log 'importlogpage' => 'Importlog', # Tooltip help for the actions 'tooltip-pt-userpage' => 'Min brugersside', 'tooltip-pt-mytalk' => 'Min diskusjesside', 'tooltip-pt-preferences' => 'Min endstellenger', 'tooltip-pt-watchlist' => 'Æ liste åver sider du åvervåger før ændrenger.', 'tooltip-pt-mycontris' => 'Æ liste åver dine bidråg', 'tooltip-pt-login' => 'Du åpførdres til at loĝge på, men dat er ekke plechnenge.', 'tooltip-pt-logout' => 'Loĝ åf', 'tooltip-ca-talk' => "Diskusje æ indholt'm på'n side", 'tooltip-ca-edit' => 'Du ken redigære denne side. Brug venligst førhåndsvesnenge før du gemmer.', 'tooltip-ca-addsection' => 'Tilføj en biskrevselenge til denne diskusje.', 'tooltip-ca-viewsource' => "Denne side er beskyttet. Du ken kegge på'n keldekode.", 'tooltip-ca-protect' => 'Beskyt denne side', 'tooltip-ca-delete' => 'Slet denne side', 'tooltip-ca-move' => 'Flyt denne side', 'tooltip-ca-watch' => 'Sæt denne side på din åvervågnengsliste', 'tooltip-ca-unwatch' => 'Fjern denne side frå din åvervågnengsliste', 'tooltip-search' => 'Søĝ på {{SITENAME}}', 'tooltip-n-mainpage' => 'Besøĝ æ Førsit', 'tooltip-n-portal' => "Æ projekt'm, vat du ken gøre, vår tenger fendes", 'tooltip-n-currentevents' => "Find baĝgrundsinformasje nessende begivenheder'm", 'tooltip-n-recentchanges' => "Æ liste åver de seneste ændrenger æ'n wiki.", 'tooltip-n-randompage' => 'Gå til æ tilfældig ertikel', 'tooltip-n-help' => 'Vordan gør a ...', 'tooltip-t-whatlinkshere' => 'Liste ve ål sider søm henveser hertil', 'tooltip-t-contributions' => 'Se denne brugers bidråg', 'tooltip-t-emailuser' => 'Send en e-mail til denne bruger', 'tooltip-t-upload' => 'Læĝ æ billet, æ sunnåm æller anden mediagøret åp', 'tooltip-t-specialpages' => 'Liste ve ål sonst sider', 'tooltip-ca-nstab-user' => "Se'n brugerside", 'tooltip-ca-nstab-project' => "Vese'n wiki'mside", 'tooltip-ca-nstab-image' => "Se'n billetside", 'tooltip-ca-nstab-template' => "Se'n skablån", 'tooltip-ca-nstab-help' => "Se'n hjælpeside", 'tooltip-ca-nstab-category' => "Se'n klyngeside", 'tooltip-minoredit' => 'Marker dette søm en mendre ændrenge', 'tooltip-save' => 'Gem dine ændrenger', 'tooltip-preview' => 'Førhånds dine ændrenger, brug venligst denne funksje enden du gemmer!', 'tooltip-diff' => 'Ves velke ændrenger du har lavet i æ skrevselenger.', 'tooltip-compareselectedversions' => 'Se førskellene imellem de to valgte hersenenger åf denne side.', 'tooltip-watch' => 'Tilføj denne side til din åvervågnengsliste', # Browsing diffs 'previousdiff' => '← Gå til førge førskel', 'nextdiff' => 'Gå til næste førskel →', # Media information 'file-info-size' => '$1 × $2 pixel, gøretstørrelse: $3, MIME-senenge: $4', 'file-nohires' => 'Engen højere åpløsnenge fundet.', 'svg-long-desc' => 'SVG gøret, wønetstørrelse $1 × $2 pixel, gøretstørrelse: $3', 'show-big-image' => 'Hersenenge i større åpløsnenge', # Special:NewFiles 'newimages' => 'Liste ve de nyeste billeter', # Bad image list 'bad_image_list' => "Æ førmåt er: Kun endholtet åf æ liste (lenjer startende ve *) bliver brugt. Den første henvesnenge på'n lenje er til det uønskede billet. Æfterfølgende lenker på samme lenjer er undtagelser, dvs. sider vår æ billet må åptræde.", # Metadata 'metadata' => 'Metadata', 'metadata-help' => "Denne gøret endeholder yderligere informasje, der søm regel stammer frå lysnåmer æller den brugte skænner. Ve'n æfterføgende bearbejdnenge ken nogle data være ændret.", 'metadata-expand' => 'Ves udvedede data', 'metadata-collapse' => 'Skjul udvedede data', 'metadata-fields' => 'Æ følgende felter frå EXIF-metadata i denne MediaWiki-beskedskrevselenger veses på billetbeskrevelsessider; yderligere lileskrevselenger ken veses. * make * model * datetimeoriginal * exposuretime * fnumber * isospeedratings * focallength * artist * copyright * imagedescription * gpslatitude * gpslongitude * gpsaltitude', # External editor support 'edit-externally' => "Redigær denne gøret ve'n utsende redigærstøme", 'edit-externally-help' => 'Se [//www.mediawiki.org/wiki/Manual:External_editors setup hjælpje] før mære informasje.', # 'all' in various places, this might be different for inflected languages 'watchlistall2' => 'åle', 'namespacesall' => 'åle', 'monthsall' => 'åle', # Watchlist editing tools 'watchlisttools-view' => "Se ændrede sider i'n åvervågnengsliste", 'watchlisttools-edit' => 'Redigær åvervågnengsliste', 'watchlisttools-raw' => 'Redigær rå åvervågnengsliste', # Special:Version 'version' => "Informasje MediaWiki'm", # Special:SpecialPages 'specialpages' => 'Sonst sider', );
BRL-CAD/web
wiki/languages/messages/MessagesJut.php
PHP
bsd-2-clause
38,434
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 18414, 24788, 1006, 1046, 7274, 2243, 1007, 1008, 1008, 2156, 7696, 4160, 4160, 4160, 1012, 25718, 2005, 4471, 12653, 4297, 2140, 1012, 8192, 1997, 11709, 1008, 2000, 5335, 1037, 5449, 3531, 3942,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.wso2.carbon.apimgt.gateway.utils; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.synapse.MessageContext; import org.apache.synapse.core.axis2.Axis2MessageContext; import org.wso2.carbon.apimgt.impl.APIConstants; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.security.SecurityRequirement; public class OpenAPIUtils { /** * Return the resource authentication scheme of the API resource. * * @param openAPI OpenAPI of the API * @param synCtx The message containing resource request * @return the resource authentication scheme */ public static String getResourceAuthenticationScheme(OpenAPI openAPI, MessageContext synCtx) { String authType = null; Map<String, Object> vendorExtensions = getPathItemExtensions(synCtx, openAPI); if (vendorExtensions != null) { authType = (String) vendorExtensions.get(APIConstants.SWAGGER_X_AUTH_TYPE); } if (StringUtils.isNotBlank(authType)) { if (APIConstants.OASResourceAuthTypes.APPLICATION_OR_APPLICATION_USER.equals(authType)) { authType = APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN; } else if (APIConstants.OASResourceAuthTypes.APPLICATION_USER.equals(authType)) { authType = APIConstants.AUTH_APPLICATION_USER_LEVEL_TOKEN; } else if (APIConstants.OASResourceAuthTypes.NONE.equals(authType)) { authType = APIConstants.AUTH_NO_AUTHENTICATION; } else if (APIConstants.OASResourceAuthTypes.APPLICATION.equals(authType)) { authType = APIConstants.AUTH_APPLICATION_LEVEL_TOKEN; } else { authType = APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN; } return authType; } //Return 'Any' type (meaning security is on) if the authType is null or empty. return APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN; } /** * Return the scopes bound to the API resource. * * @param openAPI OpenAPI of the API * @param synCtx The message containing resource request * @return the scopes */ public static List<String> getScopesOfResource(OpenAPI openAPI, MessageContext synCtx) { Map<String, Object> vendorExtensions = getPathItemExtensions(synCtx, openAPI); if (vendorExtensions != null) { String resourceScope = (String) vendorExtensions.get(APIConstants.SWAGGER_X_SCOPE); if (resourceScope == null) { // If x-scope not found in swagger, check for the scopes in security List<String> securityScopes = getPathItemSecurityScopes(synCtx, openAPI); if (securityScopes == null || securityScopes.isEmpty()) { return null; } else { return securityScopes; } } else { List<String> scopeList = new ArrayList<>(); scopeList.add(resourceScope); return scopeList; } } return null; } /** * Return the roles of a given scope attached to a resource using the API swagger. * * @param openAPI OpenAPI of the API * @param synCtx The message containing resource request * @param resourceScope The scope of the resource * @return the roles of the scope in the comma separated format */ public static String getRolesOfScope(OpenAPI openAPI, MessageContext synCtx, String resourceScope) { String resourceRoles = null; Map<String, Object> vendorExtensions = getPathItemExtensions(synCtx, openAPI); if (vendorExtensions != null) { if (StringUtils.isNotBlank(resourceScope)) { if (openAPI.getExtensions() != null && openAPI.getExtensions().get(APIConstants.SWAGGER_X_WSO2_SECURITY) != null) { LinkedHashMap swaggerWSO2Security = (LinkedHashMap) openAPI.getExtensions() .get(APIConstants.SWAGGER_X_WSO2_SECURITY); if (swaggerWSO2Security != null && swaggerWSO2Security.get(APIConstants.SWAGGER_OBJECT_NAME_APIM) != null) { LinkedHashMap swaggerObjectAPIM = (LinkedHashMap) swaggerWSO2Security .get(APIConstants.SWAGGER_OBJECT_NAME_APIM); if (swaggerObjectAPIM != null && swaggerObjectAPIM.get(APIConstants.SWAGGER_X_WSO2_SCOPES) != null) { ArrayList<LinkedHashMap> apiScopes = (ArrayList<LinkedHashMap>) swaggerObjectAPIM.get(APIConstants.SWAGGER_X_WSO2_SCOPES); for (LinkedHashMap scope: apiScopes) { if (resourceScope.equals(scope.get(APIConstants.SWAGGER_SCOPE_KEY))) { resourceRoles = (String) scope.get(APIConstants.SWAGGER_ROLES); break; } } } } } } } if (resourceRoles == null) { LinkedHashMap<String, Object> scopeBindings = null; Map<String, Object> extensions = openAPI.getComponents().getSecuritySchemes() .get(APIConstants.SWAGGER_APIM_DEFAULT_SECURITY).getExtensions(); if (extensions != null && extensions.get(APIConstants.SWAGGER_X_SCOPES_BINDINGS) != null) { scopeBindings = (LinkedHashMap<String, Object>) extensions.get(APIConstants.SWAGGER_X_SCOPES_BINDINGS); } else { scopeBindings = (LinkedHashMap<String, Object>) openAPI.getComponents().getSecuritySchemes(). get(APIConstants.SWAGGER_APIM_DEFAULT_SECURITY).getFlows().getImplicit().getExtensions(). get(APIConstants.SWAGGER_X_SCOPES_BINDINGS); } if (scopeBindings != null) { return (String) scopeBindings.get(resourceScope); } } return null; } /** * Return the throttling tier of the API resource. * * @param openAPI OpenAPI of the API * @param synCtx The message containing resource request * @return the resource throttling tier */ public static String getResourceThrottlingTier(OpenAPI openAPI, MessageContext synCtx) { String throttlingTier = null; Map<String, Object> vendorExtensions = getPathItemExtensions(synCtx, openAPI); if (vendorExtensions != null) { throttlingTier = (String) vendorExtensions.get(APIConstants.SWAGGER_X_THROTTLING_TIER); } if (StringUtils.isNotBlank(throttlingTier)) { return throttlingTier; } return APIConstants.UNLIMITED_TIER; } /** * Check whether the tier for the API is content aware or not. * @param openAPI OpenAPI of the API * @param synCtx The message containing resource request * @return whether tier is content aware or not. */ public static boolean isContentAwareTierAvailable(OpenAPI openAPI, MessageContext synCtx) { boolean status = false; Map<String, Object> vendorExtensions; if (openAPI != null) { vendorExtensions = openAPI.getExtensions(); if (vendorExtensions != null && vendorExtensions.get(APIConstants.SWAGGER_X_THROTTLING_BANDWIDTH) != null && (boolean) vendorExtensions.get(APIConstants.SWAGGER_X_THROTTLING_BANDWIDTH)) { // check for api level policy status = true; } // if there is api level policy. no need to check for resource level. if not, check for resource level if(!status) { vendorExtensions = getPathItemExtensions(synCtx, openAPI); if (vendorExtensions != null && vendorExtensions.get(APIConstants.SWAGGER_X_THROTTLING_BANDWIDTH) != null && (boolean) vendorExtensions.get(APIConstants.SWAGGER_X_THROTTLING_BANDWIDTH)) { // check for resource level policy status = true; } } } return status; } private static Map<String, Object> getPathItemExtensions(MessageContext synCtx, OpenAPI openAPI) { if (openAPI != null) { String apiElectedResource = (String) synCtx.getProperty(APIConstants.API_ELECTED_RESOURCE); org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) synCtx).getAxis2MessageContext(); String httpMethod = (String) axis2MessageContext.getProperty(APIConstants.DigestAuthConstants.HTTP_METHOD); PathItem path = openAPI.getPaths().get(apiElectedResource); if (path != null) { switch (httpMethod) { case APIConstants.HTTP_GET: return path.getGet().getExtensions(); case APIConstants.HTTP_POST: return path.getPost().getExtensions(); case APIConstants.HTTP_PUT: return path.getPut().getExtensions(); case APIConstants.HTTP_DELETE: return path.getDelete().getExtensions(); case APIConstants.HTTP_HEAD: return path.getHead().getExtensions(); case APIConstants.HTTP_OPTIONS: return path.getOptions().getExtensions(); case APIConstants.HTTP_PATCH: return path.getPatch().getExtensions(); } } } return null; } private static List<String> getPathItemSecurityScopes(MessageContext synCtx, OpenAPI openAPI) { if (openAPI != null) { String apiElectedResource = (String) synCtx.getProperty(APIConstants.API_ELECTED_RESOURCE); org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) synCtx).getAxis2MessageContext(); String httpMethod = (String) axis2MessageContext.getProperty(APIConstants.DigestAuthConstants.HTTP_METHOD); PathItem path = openAPI.getPaths().get(apiElectedResource); if (path != null) { Operation operation = path.readOperationsMap().get(PathItem.HttpMethod.valueOf(httpMethod)); return getDefaultSecurityScopes(operation.getSecurity()); } } return null; } /** * Extract the scopes of "default" security definition * * @param requirements security requirements of the operation * @return extracted scopes of "default" security definition */ private static List<String> getDefaultSecurityScopes(List<SecurityRequirement> requirements) { if (requirements != null) { for (SecurityRequirement requirement: requirements) { if (requirement.get(APIConstants.SWAGGER_APIM_DEFAULT_SECURITY) != null) { return requirement.get(APIConstants.SWAGGER_APIM_DEFAULT_SECURITY); } } } return new ArrayList<>(); } }
ruks/carbon-apimgt
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/OpenAPIUtils.java
Java
apache-2.0
12,297
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 10476, 1010, 1059, 6499, 2475, 4297, 1012, 1006, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 6499, 2475, 1012, 8917, 1007, 2035, 2916, 9235, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright (C) 2009 William Hart This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> #include <gmp.h> #include "flint.h" #include "ulong_extras.h" int main(void) { int result; ulong i; FLINT_TEST_INIT(state); flint_printf("divrem2_precomp...."); fflush(stdout); for (i = 0; i < 100000 * flint_test_multiplier(); i++) { mp_limb_t d, n, r1, r2, q1, q2; double dpre; d = n_randtest(state); if (d == UWORD(0)) d++; n = n_randtest(state); dpre = n_precompute_inverse(d); r1 = n_divrem2_precomp(&q1, n, d, dpre); r2 = n%d; q2 = n/d; result = ((r1 == r2) && (q1 == q2)); if (!result) { flint_printf("FAIL:\n"); flint_printf("n = %wu, d = %wu, dpre = %f\n", n, d, dpre); flint_printf("q1 = %wu, q2 = %wu, r1 = %wu, r2 = %wu\n", q1, q2, r1, r2); abort(); } } FLINT_TEST_CLEANUP(state); flint_printf("PASS\n"); return 0; }
jpflori/flint2
ulong_extras/test/t-divrem2_precomp.c
C
lgpl-2.1
1,319
[ 30522, 1013, 1008, 9385, 1006, 1039, 1007, 2268, 2520, 7530, 2023, 5371, 2003, 2112, 1997, 13493, 1012, 13493, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 2009, 2104, 1996, 3408, 1997, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
jsonp({"cep":"74487070","logradouro":"Rua SM 21","bairro":"Residencial S\u00e3o Marcos","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
lfreneda/cepdb
api/v1/74487070.jsonp.js
JavaScript
cc0-1.0
147
[ 30522, 1046, 3385, 2361, 1006, 1063, 1000, 8292, 2361, 1000, 1024, 1000, 6356, 18139, 19841, 19841, 1000, 1010, 1000, 8833, 12173, 8162, 2080, 1000, 1024, 1000, 21766, 2050, 15488, 2538, 1000, 1010, 1000, 21790, 18933, 1000, 1024, 1000, 139...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package de.intarsys.tools.locator; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import de.intarsys.tools.randomaccess.IRandomAccess; import de.intarsys.tools.stream.StreamTools; /** * ! not yet functional ! * * An {@link ILocator} into a zip file. * */ public class ZipFileLocator extends CommonLocator { static class ZipFile { final private ILocator zipLocator; private List<ZipEntry> entries; public ZipFile(ILocator zipLocator) { super(); this.zipLocator = zipLocator; } protected List<ZipEntry> createEntries() throws IOException { List<ZipEntry> tempEntries = new ArrayList<ZipEntry>(); InputStream is = zipLocator.getInputStream(); try { ZipInputStream zis = new ZipInputStream(is); ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { tempEntries.add(entry); } } finally { StreamTools.close(is); } return tempEntries; } synchronized protected List<ZipEntry> getEntries() throws IOException { if (entries == null) { entries = createEntries(); } return entries; } } final private ZipFile zipFile; final private String path; public ZipFileLocator(ILocator zipLocator, String path) { super(); this.zipFile = new ZipFile(zipLocator); this.path = path; } protected ZipFileLocator(ZipFile zipFile, String path) { super(); this.zipFile = zipFile; this.path = path; } public boolean exists() { return false; } protected ZipEntry findEntry(String tempPath) throws IOException { for (ZipEntry entry : zipFile.getEntries()) { if (entry.getName().equals(path)) { return entry; } } return null; } public ILocator getChild(String name) { String tempPath = path + "/" + name; return new ZipFileLocator(this, tempPath); } public String getFullName() { return null; } public InputStream getInputStream() throws IOException { return null; } public String getLocalName() { return null; } public OutputStream getOutputStream() throws IOException { return null; } public ILocator getParent() { return null; } public IRandomAccess getRandomAccess() throws IOException { return null; } public Reader getReader() throws IOException { return null; } public Reader getReader(String encoding) throws IOException { return null; } public String getType() { return null; } public String getTypedName() { return null; } public Writer getWriter() throws IOException { return null; } public Writer getWriter(String encoding) throws IOException { return null; } public boolean isDirectory() { return false; } public boolean isOutOfSynch() { return false; } public ILocator[] listLocators(ILocatorNameFilter filter) throws IOException { return null; } public void synch() { } public URL toURL() { return null; } }
intarsys/runtime
src/de/intarsys/tools/locator/ZipFileLocator.java
Java
bsd-3-clause
3,058
[ 30522, 7427, 2139, 1012, 20014, 11650, 7274, 1012, 5906, 1012, 8840, 11266, 2953, 1025, 12324, 9262, 1012, 22834, 1012, 22834, 10288, 24422, 1025, 12324, 9262, 1012, 22834, 1012, 20407, 25379, 1025, 12324, 9262, 1012, 22834, 1012, 27852, 2537...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Copyright (c) 2013-2021 Nikita Koksharov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.redisson.spring.data.connection; import org.reactivestreams.Publisher; import org.redisson.api.StreamMessageId; import org.redisson.client.codec.ByteArrayCodec; import org.redisson.client.codec.StringCodec; import org.redisson.client.protocol.RedisCommand; import org.redisson.client.protocol.RedisCommands; import org.redisson.client.protocol.RedisStrictCommand; import org.redisson.reactive.CommandReactiveExecutor; import org.springframework.data.redis.connection.ReactiveRedisConnection; import org.springframework.data.redis.connection.ReactiveStreamCommands; import org.springframework.data.redis.connection.stream.ByteBufferRecord; import org.springframework.data.redis.connection.stream.RecordId; import org.springframework.data.redis.connection.stream.StreamOffset; import org.springframework.data.redis.connection.stream.StreamRecords; import org.springframework.util.Assert; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.nio.ByteBuffer; import java.util.*; import java.util.stream.Collectors; /** * * @author Nikita Koksharov * */ public class RedissonReactiveStreamCommands extends RedissonBaseReactive implements ReactiveStreamCommands { RedissonReactiveStreamCommands(CommandReactiveExecutor executorService) { super(executorService); } private static List<String> toStringList(List<RecordId> recordIds) { return recordIds.stream().map(RecordId::getValue).collect(Collectors.toList()); } @Override public Flux<ReactiveRedisConnection.NumericResponse<AcknowledgeCommand, Long>> xAck(Publisher<AcknowledgeCommand> publisher) { return execute(publisher, command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getGroup(), "Group must not be null!"); Assert.notNull(command.getRecordIds(), "recordIds must not be null!"); List<Object> params = new ArrayList<>(); byte[] k = toByteArray(command.getKey()); params.add(k); params.add(command.getGroup()); params.addAll(toStringList(command.getRecordIds())); Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XACK, params.toArray()); return m.map(v -> new ReactiveRedisConnection.NumericResponse<>(command, v)); }); } @Override public Flux<ReactiveRedisConnection.CommandResponse<AddStreamRecord, RecordId>> xAdd(Publisher<AddStreamRecord> publisher) { return execute(publisher, command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getBody(), "Body must not be null!"); byte[] k = toByteArray(command.getKey()); List<Object> params = new LinkedList<>(); params.add(k); if (!command.getRecord().getId().shouldBeAutoGenerated()) { params.add(command.getRecord().getId().getValue()); } else { params.add("*"); } for (Map.Entry<ByteBuffer, ByteBuffer> entry : command.getBody().entrySet()) { params.add(toByteArray(entry.getKey())); params.add(toByteArray(entry.getValue())); } Mono<StreamMessageId> m = write(k, StringCodec.INSTANCE, RedisCommands.XADD, params.toArray()); return m.map(v -> new ReactiveRedisConnection.CommandResponse<>(command, RecordId.of(v.toString()))); }); } @Override public Flux<ReactiveRedisConnection.CommandResponse<DeleteCommand, Long>> xDel(Publisher<DeleteCommand> publisher) { return execute(publisher, command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRecordIds(), "recordIds must not be null!"); byte[] k = toByteArray(command.getKey()); List<Object> params = new ArrayList<>(); params.add(k); params.addAll(toStringList(command.getRecordIds())); Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XDEL, params.toArray()); return m.map(v -> new ReactiveRedisConnection.CommandResponse<>(command, v)); }); } @Override public Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand, Long>> xLen(Publisher<ReactiveRedisConnection.KeyCommand> publisher) { return execute(publisher, command -> { Assert.notNull(command.getKey(), "Key must not be null!"); byte[] k = toByteArray(command.getKey()); Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XLEN, k); return m.map(v -> new ReactiveRedisConnection.NumericResponse<>(command, v)); }); } @Override public Flux<ReactiveRedisConnection.CommandResponse<RangeCommand, Flux<ByteBufferRecord>>> xRange(Publisher<RangeCommand> publisher) { return range(RedisCommands.XRANGE, publisher); } private Flux<ReactiveRedisConnection.CommandResponse<RangeCommand, Flux<ByteBufferRecord>>> range(RedisCommand<?> rangeCommand, Publisher<RangeCommand> publisher) { return execute(publisher, command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); Assert.notNull(command.getLimit(), "Limit must not be null!"); byte[] k = toByteArray(command.getKey()); List<Object> params = new LinkedList<>(); params.add(k); if (rangeCommand == RedisCommands.XRANGE) { params.add(command.getRange().getLowerBound().getValue().orElse("-")); params.add(command.getRange().getUpperBound().getValue().orElse("+")); } else { params.add(command.getRange().getUpperBound().getValue().orElse("+")); params.add(command.getRange().getLowerBound().getValue().orElse("-")); } if (command.getLimit().getCount() > 0) { params.add("COUNT"); params.add(command.getLimit().getCount()); } Mono<Map<StreamMessageId, Map<byte[], byte[]>>> m = write(k, ByteArrayCodec.INSTANCE, rangeCommand, params.toArray()); return m.map(v -> new ReactiveRedisConnection.CommandResponse<>(command, Flux.fromStream(v.entrySet().stream()).map(e -> { Map<ByteBuffer, ByteBuffer> map = e.getValue().entrySet().stream() .collect(Collectors.toMap(entry -> ByteBuffer.wrap(entry.getKey()), entry -> ByteBuffer.wrap(entry.getValue()))); return StreamRecords.newRecord() .in(command.getKey()) .withId(RecordId.of(e.getKey().toString())) .ofBuffer(map); }))); }); } @Override public Flux<ReactiveRedisConnection.CommandResponse<ReadCommand, Flux<ByteBufferRecord>>> read(Publisher<ReadCommand> publisher) { return execute(publisher, command -> { Assert.notNull(command.getStreamOffsets(), "StreamOffsets must not be null!"); Assert.notNull(command.getReadOptions(), "ReadOptions must not be null!"); List<Object> params = new ArrayList<>(); if (command.getConsumer() != null) { params.add("GROUP"); params.add(command.getConsumer().getGroup()); params.add(command.getConsumer().getName()); } if (command.getReadOptions().getCount() != null && command.getReadOptions().getCount() > 0) { params.add("COUNT"); params.add(command.getReadOptions().getCount()); } if (command.getReadOptions().getBlock() != null && command.getReadOptions().getBlock() > 0) { params.add("BLOCK"); params.add(command.getReadOptions().getBlock()); } if (command.getConsumer() != null && command.getReadOptions().isNoack()) { params.add("NOACK"); } params.add("STREAMS"); for (StreamOffset<ByteBuffer> streamOffset : command.getStreamOffsets()) { params.add(toByteArray(streamOffset.getKey())); } for (StreamOffset<ByteBuffer> streamOffset : command.getStreamOffsets()) { params.add(streamOffset.getOffset().getOffset()); } Mono<Map<String, Map<StreamMessageId, Map<byte[], byte[]>>>> m; if (command.getConsumer() == null) { if (command.getReadOptions().getBlock() != null && command.getReadOptions().getBlock() > 0) { m = read(toByteArray(command.getStreamOffsets().get(0).getKey()), ByteArrayCodec.INSTANCE, RedisCommands.XREAD_BLOCKING, params.toArray()); } else { m = read(toByteArray(command.getStreamOffsets().get(0).getKey()), ByteArrayCodec.INSTANCE, RedisCommands.XREAD, params.toArray()); } } else { if (command.getReadOptions().getBlock() != null && command.getReadOptions().getBlock() > 0) { m = read(toByteArray(command.getStreamOffsets().get(0).getKey()), ByteArrayCodec.INSTANCE, RedisCommands.XREADGROUP_BLOCKING, params.toArray()); } else { m = read(toByteArray(command.getStreamOffsets().get(0).getKey()), ByteArrayCodec.INSTANCE, RedisCommands.XREADGROUP, params.toArray()); } } return m.map(v -> new ReactiveRedisConnection.CommandResponse<>(command, Flux.fromStream(v.entrySet().stream()) .map(ee -> { return ee.getValue().entrySet().stream().map(e -> { Map<ByteBuffer, ByteBuffer> map = e.getValue().entrySet().stream() .collect(Collectors.toMap(entry -> ByteBuffer.wrap(entry.getKey()), entry -> ByteBuffer.wrap(entry.getValue()))); return StreamRecords.newRecord() .in(ee.getKey()) .withId(RecordId.of(e.getKey().toString())) .ofBuffer(map); }); }).flatMap(Flux::fromStream) )); }); } private static final RedisStrictCommand<String> XGROUP_STRING = new RedisStrictCommand<>("XGROUP"); @Override public Flux<ReactiveRedisConnection.CommandResponse<GroupCommand, String>> xGroup(Publisher<GroupCommand> publisher) { return execute(publisher, command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getGroupName(), "GroupName must not be null!"); byte[] k = toByteArray(command.getKey()); if (command.getAction().equals(GroupCommand.GroupCommandAction.CREATE)) { Assert.notNull(command.getReadOffset(), "ReadOffset must not be null!"); Mono<String> m = write(k, StringCodec.INSTANCE, XGROUP_STRING, "CREATE", k, command.getGroupName(), command.getReadOffset().getOffset(), "MKSTREAM"); return m.map(v -> new ReactiveRedisConnection.CommandResponse<>(command, v)); } if (command.getAction().equals(GroupCommand.GroupCommandAction.DELETE_CONSUMER)) { Assert.notNull(command.getConsumerName(), "ConsumerName must not be null!"); Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XGROUP_LONG, "DELCONSUMER", k, command.getGroupName(), command.getConsumerName()); return m.map(v -> new ReactiveRedisConnection.CommandResponse<>(command, v > 0 ? "OK" : "Error")); } if (command.getAction().equals(GroupCommand.GroupCommandAction.DESTROY)) { Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XGROUP_LONG, "DESTROY", k, command.getGroupName()); return m.map(v -> new ReactiveRedisConnection.CommandResponse<>(command, v > 0 ? "OK" : "Error")); } throw new IllegalArgumentException("unknown command " + command.getAction()); }); } @Override public Flux<ReactiveRedisConnection.CommandResponse<RangeCommand, Flux<ByteBufferRecord>>> xRevRange(Publisher<RangeCommand> publisher) { return range(RedisCommands.XREVRANGE, publisher); } @Override public Flux<ReactiveRedisConnection.NumericResponse<ReactiveRedisConnection.KeyCommand, Long>> xTrim(Publisher<TrimCommand> publisher) { return execute(publisher, command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getCount(), "Count must not be null!"); byte[] k = toByteArray(command.getKey()); Mono<Long> m = write(k, StringCodec.INSTANCE, RedisCommands.XTRIM, k, "MAXLEN", command.getCount()); return m.map(v -> new ReactiveRedisConnection.NumericResponse<>(command, v)); }); } }
redisson/redisson
redisson-spring-data/redisson-spring-data-22/src/main/java/org/redisson/spring/data/connection/RedissonReactiveStreamCommands.java
Java
apache-2.0
13,883
[ 30522, 1013, 1008, 1008, 1008, 9385, 1006, 1039, 1007, 2286, 1011, 25682, 29106, 12849, 28132, 12298, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package software.amazon.awssdk.codegen.poet.model; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeSpec; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import javax.lang.model.element.Modifier; import software.amazon.awssdk.annotations.SdkPublicApi; import software.amazon.awssdk.awscore.AwsResponseMetadata; import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; import software.amazon.awssdk.codegen.poet.ClassSpec; import software.amazon.awssdk.codegen.poet.PoetExtensions; import software.amazon.awssdk.codegen.poet.PoetUtils; import software.amazon.awssdk.utils.CollectionUtils; import software.amazon.awssdk.utils.StringUtils; import software.amazon.awssdk.utils.internal.CodegenNamingUtils; /** * Generate ResponseMetadata class */ public class ResponseMetadataSpec implements ClassSpec { private PoetExtensions poetExtensions; private Map<String, String> headerMetadata = new HashMap<>(); public ResponseMetadataSpec(IntermediateModel model) { if (!CollectionUtils.isNullOrEmpty(model.getCustomizationConfig().getCustomResponseMetadata())) { this.headerMetadata.putAll(model.getCustomizationConfig().getCustomResponseMetadata()); } this.poetExtensions = new PoetExtensions(model); } @Override public TypeSpec poetSpec() { TypeSpec.Builder specBuilder = TypeSpec.classBuilder(className()) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .addAnnotation(PoetUtils.generatedAnnotation()) .addAnnotation(SdkPublicApi.class) .superclass(AwsResponseMetadata.class) .addMethod(constructor()) .addMethod(staticFactoryMethod()) .addMethods(metadataMethods()); List<FieldSpec> fields = headerMetadata.entrySet().stream().map(e -> FieldSpec.builder(String.class, e.getKey()) .addModifiers(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL) .initializer("$S", e.getValue()) .build() ).collect(Collectors.toList()); specBuilder.addFields(fields); return specBuilder.build(); } private MethodSpec constructor() { return MethodSpec.constructorBuilder() .addModifiers(Modifier.PRIVATE) .addParameter(AwsResponseMetadata.class, "responseMetadata") .addStatement("super(responseMetadata)") .build(); } private MethodSpec staticFactoryMethod() { return MethodSpec.methodBuilder("create") .addModifiers(Modifier.PUBLIC, Modifier.STATIC) .addParameter(AwsResponseMetadata.class, "responseMetadata") .addStatement("return new $T(responseMetadata)", className()) .returns(className()) .build(); } private List<MethodSpec> metadataMethods() { return headerMetadata.keySet() .stream() .map(key -> { String methodName = convertMethodName(key); MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(methodName) .addModifiers(Modifier.PUBLIC) .addStatement("return getValue($L)", key) .returns(String.class); if (methodName.equals("requestId")) { methodBuilder.addAnnotation(Override.class); } return methodBuilder.build(); }).collect(Collectors.toList()); } /** * Convert key (UPPER_CASE) to method name. */ private String convertMethodName(String key) { String pascalCase = CodegenNamingUtils.pascalCase(key); return StringUtils.uncapitalize(pascalCase); } @Override public ClassName className() { return poetExtensions.getResponseMetadataClass(); } }
aws/aws-sdk-java-v2
codegen/src/main/java/software/amazon/awssdk/codegen/poet/model/ResponseMetadataSpec.java
Java
apache-2.0
5,616
[ 30522, 1013, 1008, 1008, 9385, 9733, 1012, 4012, 1010, 4297, 1012, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1012, 1008, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace backend\models; use Yii; use yii\base\Model; use yii\data\ActiveDataProvider; use backend\models\OrderItems; /** * OrderItemsSearch represents the model behind the search form about `backend\models\OrderItems`. */ class OrderItemsSearch extends OrderItems { /** * @inheritdoc */ public $orderItemsGlobalSearch; public function rules() { return [ [['id', 'order_id', 'item_id', 'qty', 'item_price', 'is_canceled'], 'integer'], [['total', 'created_at', 'updated_at','orderItemsGlobalSearch','item_id'], 'safe'], ]; } /** * @inheritdoc */ public function scenarios() { // bypass scenarios() implementation in the parent class return Model::scenarios(); } /** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = OrderItems::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => array('pageSize' => Yii::$app->params['pageSize']), ]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->joinWith('item'); if(!Yii::$app->user->can('full_shops_admin')){ $query->joinWith('order'); $userShops = Yii::$app->session['userShops']; $query->andFilterWhere( ['in','orders.shop_id',$userShops]); } $query->orFilterWhere(['like', 'total', $this->orderItemsGlobalSearch]) ->orFilterWhere(['like', 'items.name', $this->orderItemsGlobalSearch]); // print_r($query->createCommand()->getRawSql()); return $dataProvider; } }
MobiLifeCompany/DeliveryV2WebAdmin
backend/models/OrderItemsSearch.php
PHP
bsd-3-clause
2,054
[ 30522, 1026, 1029, 25718, 3415, 15327, 2067, 10497, 1032, 4275, 1025, 2224, 12316, 2072, 1025, 2224, 12316, 2072, 1032, 2918, 1032, 2944, 1025, 2224, 12316, 2072, 1032, 2951, 1032, 3161, 2850, 2696, 21572, 17258, 2121, 1025, 2224, 2067, 104...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.codedeploy.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.codedeploy.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * CreateDeploymentConfigRequestMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class CreateDeploymentConfigRequestMarshaller { private static final MarshallingInfo<String> DEPLOYMENTCONFIGNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("deploymentConfigName").build(); private static final MarshallingInfo<StructuredPojo> MINIMUMHEALTHYHOSTS_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("minimumHealthyHosts").build(); private static final MarshallingInfo<StructuredPojo> TRAFFICROUTINGCONFIG_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("trafficRoutingConfig").build(); private static final MarshallingInfo<String> COMPUTEPLATFORM_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("computePlatform").build(); private static final CreateDeploymentConfigRequestMarshaller instance = new CreateDeploymentConfigRequestMarshaller(); public static CreateDeploymentConfigRequestMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(CreateDeploymentConfigRequest createDeploymentConfigRequest, ProtocolMarshaller protocolMarshaller) { if (createDeploymentConfigRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createDeploymentConfigRequest.getDeploymentConfigName(), DEPLOYMENTCONFIGNAME_BINDING); protocolMarshaller.marshall(createDeploymentConfigRequest.getMinimumHealthyHosts(), MINIMUMHEALTHYHOSTS_BINDING); protocolMarshaller.marshall(createDeploymentConfigRequest.getTrafficRoutingConfig(), TRAFFICROUTINGCONFIG_BINDING); protocolMarshaller.marshall(createDeploymentConfigRequest.getComputePlatform(), COMPUTEPLATFORM_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
jentfoo/aws-sdk-java
aws-java-sdk-codedeploy/src/main/java/com/amazonaws/services/codedeploy/model/transform/CreateDeploymentConfigRequestMarshaller.java
Java
apache-2.0
3,230
[ 30522, 1013, 1008, 1008, 9385, 2297, 1011, 10476, 9733, 1012, 4012, 1010, 4297, 1012, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import { autoinject } from 'aurelia-framework'; import { Customers } from './customers'; import { Router } from 'aurelia-router'; @autoinject() export class List { heading = 'Customer management'; customerList = []; customers: Customers; router: Router; constructor(customers: Customers, router: Router) { this.customers = customers; this.router = router; } gotoCustomer(customer: any) { this.router.navigateToRoute('edit', {id: customer.id}); } new() { this.router.navigateToRoute('create'); } activate() { return this.customers.getAll() .then(customerList => this.customerList = customerList); } }
doktordirk/aurelia-authentication-loopback-sample
client-ts/src/modules/customer/list.ts
TypeScript
mit
657
[ 30522, 12324, 1063, 8285, 2378, 20614, 1065, 2013, 1005, 8740, 16570, 2401, 1011, 7705, 1005, 1025, 12324, 1063, 6304, 1065, 2013, 1005, 1012, 1013, 6304, 1005, 1025, 12324, 1063, 2799, 2099, 1065, 30524, 8013, 9863, 1027, 1031, 1033, 1025,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import pyes import os from models import * from sqlalchemy import select from downloader import download import utils import re import time class Search(object): def __init__(self,host,index,map_name,mapping=None,id_key=None): self.es = pyes.ES(host) self.index = index self.map_name = map_name self.mapping = mapping self.id_key = id_key def create_index(self): self.es.create_index_if_missing(self.index) if self.mapping: if self.id_key: self.es.put_mapping(self.map_name,{ self.map_name:{ '_id':{ 'path':self.id_key }, 'properties':self.mapping} },[self.index]) else: self.es.put_mapping(self.map_name,{ self.map_name:{ 'properties':self.mapping } },[self.index]) self.es.refresh(self.index) def index_item(self,item): self.es.index(item,self.index,self.map_name) self.es.refresh(self.index) def convert_to_document(revision): temp = {} rev_key = [ i for i in dir(revision) if not re.match('^_',i) ] bill_key = [ i for i in dir(revision.bill) if not re.match('^_',i) ] for key in rev_key: if key != 'metadata' and key != 'bill': temp[key] = getattr(revision,key) for key in bill_key: if key != 'metadata' and key!='id' and key!='bill_revs': temp[key] = getattr(revision.bill,key) full_path = download(temp['url']) if full_path: temp['document'] = pyes.file_to_attachment(full_path) return temp def initial_index(): host = '127.0.0.1:9200' index = 'bill-index' map_name = 'bill-type' mapping = { 'document':{ 'type':'attachment', 'fields':{ "title" : { "store" : "yes" }, "file" : { "term_vector":"with_positions_offsets", "store":"yes" } } }, 'name':{ 'type':'string', 'store':'yes', 'boost':1.0, 'index':'analyzed' }, 'long_name':{ 'type':'string', 'store':'yes', 'boost':1.0, 'index':'analyzed' }, 'status':{ 'type':'string', 'store':'yes', }, 'year':{ 'type':'integer', 'store':'yes' }, 'read_by':{ 'type':'string', 'store':'yes', 'index':'analyzed' }, 'date_presented':{ 'type':'date', 'store':'yes' }, 'bill_id':{ 'type':'integer', 'store':'yes' }, 'id':{ 'type':'integer', 'store':'yes' } } search = Search(host,index,map_name,mapping) search.create_index() initdb() session = DBSession() revision = (session.query(BillRevision) .join((BillRevision.bill,Bill)).all() ) for rev in revision: temp = convert_to_document(rev) search.index_item(temp) time.sleep(5) def index_single(rev_id): host = '127.0.0.1:9200' index = 'bill-index' map_name = 'bill-type' initdb() session = DBSession() revision = (session.query(BillRevision).get(rev_id) ) temp = convert_to_document(revision) search = Search(host,index,map_name) search.index_item(temp) if __name__ == '__main__': initial_index()
sweemeng/Malaysian-Bill-Watcher
billwatcher/indexer.py
Python
gpl-3.0
3,747
[ 30522, 12324, 1052, 23147, 12324, 9808, 2013, 4275, 12324, 1008, 2013, 29296, 2389, 5403, 8029, 12324, 7276, 2013, 8816, 2121, 12324, 8816, 12324, 21183, 12146, 12324, 2128, 12324, 30524, 2969, 1012, 5950, 1027, 5950, 2969, 1012, 4949, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// CC0 Public Domain: http://creativecommons.org/publicdomain/zero/1.0/ #include "bsefilter.hh" #include <sfi/sfi.hh> using namespace Bse; const gchar* bse_iir_filter_kind_string (BseIIRFilterKind fkind) { switch (fkind) { case BSE_IIR_FILTER_BUTTERWORTH: return "Butterworth"; case BSE_IIR_FILTER_BESSEL: return "Bessel"; case BSE_IIR_FILTER_CHEBYSHEV1: return "Chebyshev1"; case BSE_IIR_FILTER_CHEBYSHEV2: return "Chebyshev2"; case BSE_IIR_FILTER_ELLIPTIC: return "Elliptic"; default: return "?unknown?"; } } const gchar* bse_iir_filter_type_string (BseIIRFilterType ftype) { switch (ftype) { case BSE_IIR_FILTER_LOW_PASS: return "Low-pass"; case BSE_IIR_FILTER_BAND_PASS: return "Band-pass"; case BSE_IIR_FILTER_HIGH_PASS: return "High-pass"; case BSE_IIR_FILTER_BAND_STOP: return "Band-stop"; default: return "?unknown?"; } } gchar* bse_iir_filter_request_string (const BseIIRFilterRequest *ifr) { String s; s += bse_iir_filter_kind_string (ifr->kind); s += " "; s += bse_iir_filter_type_string (ifr->type); s += " order=" + string_from_int (ifr->order); s += " sample-rate=" + string_from_float (ifr->sampling_frequency); if (ifr->kind == BSE_IIR_FILTER_CHEBYSHEV1 || ifr->kind == BSE_IIR_FILTER_ELLIPTIC) s += " passband-ripple-db=" + string_from_float (ifr->passband_ripple_db); s += " passband-edge=" + string_from_float (ifr->passband_edge); if (ifr->type == BSE_IIR_FILTER_BAND_PASS || ifr->type == BSE_IIR_FILTER_BAND_STOP) s += " passband-edge2=" + string_from_float (ifr->passband_edge2); if (ifr->kind == BSE_IIR_FILTER_ELLIPTIC && ifr->stopband_db < 0) s += " stopband-db=" + string_from_float (ifr->stopband_db); if (ifr->kind == BSE_IIR_FILTER_ELLIPTIC && ifr->stopband_edge > 0) s += " stopband-edge=" + string_from_float (ifr->stopband_edge); return g_strdup (s.c_str()); } gchar* bse_iir_filter_design_string (const BseIIRFilterDesign *fid) { String s; s += "order=" + string_from_int (fid->order); s += " sampling-frequency=" + string_from_float (fid->sampling_frequency); s += " center-frequency=" + string_from_float (fid->center_frequency); s += " gain=" + string_from_double (fid->gain); s += " n_zeros=" + string_from_int (fid->n_zeros); s += " n_poles=" + string_from_int (fid->n_poles); for (uint i = 0; i < fid->n_zeros; i++) { String u ("Zero:"); u += " " + string_from_double (fid->zz[i].re); u += " + " + string_from_double (fid->zz[i].im) + "*i"; s += "\n" + u; } for (uint i = 0; i < fid->n_poles; i++) { String u ("Pole:"); u += " " + string_from_double (fid->zp[i].re); u += " + " + string_from_double (fid->zp[i].im) + "*i"; s += "\n" + u; } String u; #if 0 uint o = fid->order; u = string_from_double (fid->zn[o]); while (o--) u = "(" + u + ") * z + " + string_from_double (fid->zn[o]); s += "\nNominator: " + u; o = fid->order; u = string_from_double (fid->zd[o]); while (o--) u = "(" + u + ") * z + " + string_from_double (fid->zd[o]); s += "\nDenominator: " + u; #endif return g_strdup (s.c_str()); } bool bse_iir_filter_design (const BseIIRFilterRequest *filter_request, BseIIRFilterDesign *filter_design) { if (filter_request->kind == BSE_IIR_FILTER_BUTTERWORTH || filter_request->kind == BSE_IIR_FILTER_CHEBYSHEV1 || filter_request->kind == BSE_IIR_FILTER_ELLIPTIC) return _bse_filter_design_ellf (filter_request, filter_design); return false; }
GNOME/beast
bse/bsefilter.cc
C++
lgpl-2.1
3,662
[ 30522, 1013, 1013, 10507, 2692, 2270, 5884, 1024, 8299, 1024, 1013, 1013, 5541, 9006, 16563, 1012, 8917, 1013, 2270, 9527, 8113, 1013, 5717, 1013, 1015, 1012, 1014, 1013, 1001, 2421, 1000, 18667, 12879, 4014, 3334, 1012, 1044, 2232, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace CR\GSBRBundle\Controller; //require_once("include/fct.inc.php"); // décommenter pour utiliser PDO // require_once("include/class.pdogsb.inc.php"); use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Bundle\FrameworkBundle\Controller\Controller; //use PdoGsb; /*use CR\GSBRBundle\Entity\medicament; use CR\GSBRBundle\Entity\famille; use CR\GSBRBundle\Entity\rapportVisite; use CR\GSBRBundle\Entity\praticien; use CR\GSBRBundle\Entity\typePraticien; use CR\GSBRBundle\Entity\visiteur;*/ class MedicamentController extends Controller{ public function medicamentAction(){ $lesMedicaments= $this->getDoctrine()->getRepository('CRGSBRBundle:medicament')->findAll(); return $this->render('CRGSBRBundle:Medicament:medicament.html.twig', array('mesMed'=>$lesMedicaments)); } public function rechercheAction(){ $resRecherche = $this->getDoctrine()->getRepository('CRGSBRBundle:medicament') } }
myrkur/CR
src/CR/GSBRBundle/Controller/MedicamentController.php
PHP
mit
994
[ 30522, 1026, 1029, 25718, 3415, 15327, 13675, 1032, 28177, 19892, 27265, 2571, 1032, 11486, 1025, 1013, 1013, 5478, 1035, 2320, 1006, 1000, 2421, 1013, 4429, 2102, 1012, 4297, 1012, 25718, 1000, 1007, 1025, 1013, 1013, 21933, 20058, 10111, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Redland RDF Language Bindings - Ruby RDoc - Class: Redland::Parser</title> <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" /> <script src="../js/jquery.js" type="text/javascript" charset="utf-8"> </script> <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"> </script> <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"> </script> <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"> </script> </head> <body id="top" class="class"> <div id="metadata"> <div id="home-metadata"> <div id="home-section" class="section"> <h3 class="section-header"><a href="../index.html">Home</a> <a href="../index.html#classes">Classes</a> <a href="../index.html#methods">Methods</a></h3> </div> </div> <div id="file-metadata"> <div id="file-list-section" class="section"> <h3 class="section-header">In Files</h3> <div class="section-body"> <ul> <li><a href="../rdf/redland/parser_rb.html?TB_iframe=true&amp;height=550&amp;width=785" class="thickbox" title="rdf/redland/parser.rb">rdf/redland/parser.rb</a></li> </ul> </div> </div> </div> <div id="class-metadata"><!-- Parent Class --> <div id="parent-class-section" class="section"> <h3 class="section-header">Parent</h3> <p class="link">Object</p> </div> <!-- Method Quickref --> <div id="method-list-section" class="section"> <h3 class="section-header">Methods</h3> <ul class="link-list"> <li><a href="#method-c-create_finalizer">::create_finalizer</a></li> <li><a href="#method-c-new">::new</a></li> <li><a href="#method-c-ntriples">::ntriples</a></li> <li><a href="#method-c-raptor">::raptor</a></li> <li><a href="#method-c-turtle">::turtle</a></li> <li><a href="#method-i-add_ident">#add_ident</a></li> <li><a href="#method-i-feature">#feature</a></li> <li><a href="#method-i-parse_as_stream">#parse_as_stream</a></li> <li><a href="#method-i-parse_into_model">#parse_into_model</a></li> <li><a href="#method-i-parse_string_as_stream">#parse_string_as_stream</a></li> <li><a href="#method-i-parse_string_into_model">#parse_string_into_model</a></li> <li><a href="#method-i-setFeature">#setFeature</a></li> <li><a href="#method-i-smush_file">#smush_file</a></li> <li><a href="#method-i-smush_string">#smush_string</a></li> </ul> </div> </div> <div id="project-metadata"> <div id="fileindex-section" class="section project-section"> <h3 class="section-header">Files</h3> <ul> <li class="file"><a href="../Makefile.html">Makefile</a></li> <li class="file"><a href="../rdf/Makefile.html">Makefile</a></li> <li class="file"><a href="../rdf/redland/Makefile.html">Makefile</a></li> <li class="file"><a href="../rdf/redland/schemas/Makefile.html">Makefile</a></li> </ul> </div> <div id="classindex-section" class="section project-section"> <h3 class="section-header">Class/Module Index <span class="search-toggle"><img src="../images/find.png" height="16" width="16" alt="[+]" title="show/hide quicksearch" /></span></h3> <form action="#" method="get" accept-charset="utf-8" class="initially-hidden"> <fieldset><legend>Quicksearch</legend> <input type="text" name="quicksearch" value="" class="quicksearch-field" /></fieldset> </form> <ul class="link-list"> <li><a href="../Redland.html">Redland</a></li> <li><a href="../Redland/BNode.html">Redland::BNode</a></li> <li><a href="../Redland/ContextParser.html">Redland::ContextParser</a></li> <li><a href="../Redland/FileStore.html">Redland::FileStore</a></li> <li><a href="../Redland/HashOpen.html">Redland::HashOpen</a></li> <li><a href="../Redland/HashStore.html">Redland::HashStore</a></li> <li><a href="../Redland/Literal.html">Redland::Literal</a></li> <li><a href="../Redland/MemoryStore.html">Redland::MemoryStore</a></li> <li><a href="../Redland/MergedModel.html">Redland::MergedModel</a></li> <li><a href="../Redland/Model.html">Redland::Model</a></li> <li><a href="../Redland/Namespace.html">Redland::Namespace</a></li> <li><a href="../Redland/Node.html">Redland::Node</a></li> <li><a href="../Redland/NodeIterator.html">Redland::NodeIterator</a></li> <li><a href="../Redland/NodeTypeError.html">Redland::NodeTypeError</a></li> <li><a href="../Redland/OWL.html">Redland::OWL</a></li> <li><a href="../Redland/Parser.html">Redland::Parser</a></li> <li><a href="../Redland/Query.html">Redland::Query</a></li> <li><a href="../Redland/QueryResults.html">Redland::QueryResults</a></li> <li><a href="../Redland/RDFS.html">Redland::RDFS</a></li> <li><a href="../Redland/RedlandError.html">Redland::RedlandError</a></li> <li><a href="../Redland/Resource.html">Redland::Resource</a></li> <li><a href="../Redland/Serializer.html">Redland::Serializer</a></li> <li><a href="../Redland/Statement.html">Redland::Statement</a></li> <li><a href="../Redland/Stream.html">Redland::Stream</a></li> <li><a href="../Redland/TripleStore.html">Redland::TripleStore</a></li> <li><a href="../Redland/Uri.html">Redland::Uri</a></li> <li><a href="../Redland/Util.html">Redland::Util</a></li> <li><a href="../Redland/World.html">Redland::World</a></li> <li><a href="../DC.html">DC</a></li> <li><a href="../FOAF.html">FOAF</a></li> </ul> <div id="no-class-search-results" style="display: none;">No matching classes.</div> </div> </div> </div> <div id="documentation"> <h1 class="class">Redland::Parser</h1> <div id="description" class="description"> <p>The <a href="Parser.html">Parser</a> class for rdf. There are currently three types of parsers *'rdfxml'- a rdf parser *'ntriples' a An triples parser *'turtle' - a parser for the turtle syntax as defined in</p> <pre> http://www.dajobe.org/2004/01/turtle/ </pre> <p>*'rss-tag-soup' - a parser for all RSS flavours and some atom *'grddl' - GRDDL</p> <p>The last two may or may not be available depending on systems.</p> <pre> model = Model.new() parser = Parser.ntriples() parser.parse_into_model(model,'file:./ical.rdf') </pre></div> <!-- description --> <div id="5Buntitled-5D" class="documentation-section"><!-- Attributes --> <div id="attribute-method-details" class="method-section section"> <h3 class="section-header">Attributes</h3> <div id="context-attribute-method" class="method-detail"><a name="context" id="context"></a> <a name="context="></a> <div class="method-heading attribute-method-heading"><span class="method-name">context</span><span class="attribute-access-type">[RW]</span></div> <div class="method-description"></div> </div> </div> <!-- attribute-method-details --> <!-- Methods --> <div id="public-class-method-details" class="method-section section"> <h3 class="section-header">Public Class Methods</h3> <div id="create_finalizer-method" class="method-detail"><a name="method-c-create_finalizer" id="method-c-create_finalizer"></a> <div class="method-heading"><span class="method-name">create_finalizer</span><span class="method-args">(parser)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <div class="method-source-code" id="create_finalizer-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 34</span> <span class="ruby-keyword">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">create_finalizer</span>(<span class="ruby-identifier">parser</span>) <span class="ruby-identifier">proc</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">id</span><span class="ruby-operator">|</span> <span class="ruby-comment"># "Finalizer on #{id}"</span> <span class="ruby-comment">#$log_final.info "closing parser"</span> <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-identifier">librdf_free_parser</span>(<span class="ruby-identifier">parser</span>) } <span class="ruby-keyword">end</span> </pre></div> <!-- create_finalizer-source --></div> </div> <!-- create_finalizer-method --> <div id="new-method" class="method-detail"><a name="method-c-new" id="method-c-new"></a> <div class="method-heading"><span class="method-name">new</span><span class="method-args">(name='rdfxml',mime_type="application/rdf+xml",uri=nil,context=nil)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <p>create a new <a href="Parser.html">Parser</a>. if no name is given, it defaults to parsing RDF/XML syntax</p> <div class="method-source-code" id="new-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 25</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>=<span class="ruby-string">'rdfxml'</span>,<span class="ruby-identifier">mime_type</span>=<span class="ruby-string">"application/rdf+xml"</span>,<span class="ruby-identifier">uri</span>=<span class="ruby-keyword">nil</span>,<span class="ruby-identifier">context</span>=<span class="ruby-keyword">nil</span>) <span class="ruby-ivar">@context</span> = <span class="ruby-keyword">nil</span> <span class="ruby-ivar">@idents</span> = [] <span class="ruby-identifier">uri</span>=<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">uri</span> <span class="ruby-ivar">@parser</span> = <span class="ruby-constant">Redland</span>.<span class="ruby-identifier">librdf_new_parser</span>(<span class="ruby-identifier">$world</span>.<span class="ruby-identifier">world</span>,<span class="ruby-identifier">name</span>,<span class="ruby-identifier">mime_type</span>,<span class="ruby-identifier">uri</span>) <span class="ruby-identifier">raise</span> <span class="ruby-constant">RedlandError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"Parser construction failed"</span>) <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@parser</span> <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">define_finalizer</span>(<span class="ruby-keyword">self</span>,<span class="ruby-constant">Parser</span>.<span class="ruby-identifier">create_finalizer</span>(<span class="ruby-ivar">@parser</span>)) <span class="ruby-keyword">end</span> </pre></div> <!-- new-source --></div> </div> <!-- new-method --> <div id="ntriples-method" class="method-detail"><a name="method-c-ntriples" id="method-c-ntriples"></a> <div class="method-heading"><span class="method-name">ntriples</span><span class="method-args">(uri=nil)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <p>create a parser for the ntriples syntax</p> <div class="method-source-code" id="ntriples-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 42</span> <span class="ruby-keyword">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">ntriples</span>(<span class="ruby-identifier">uri</span>=<span class="ruby-keyword">nil</span>) <span class="ruby-keyword">return</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'ntriples'</span>,<span class="ruby-string">""</span>,<span class="ruby-identifier">uri</span>) <span class="ruby-keyword">end</span> </pre></div> <!-- ntriples-source --></div> </div> <!-- ntriples-method --> <div id="raptor-method" class="method-detail"><a name="method-c-raptor" id="method-c-raptor"></a> <div class="method-heading"><span class="method-name">raptor</span><span class="method-args">(uri=nil)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <p>create a parser for rdf syntax</p> <div class="method-source-code" id="raptor-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 52</span> <span class="ruby-keyword">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">raptor</span>(<span class="ruby-identifier">uri</span>=<span class="ruby-keyword">nil</span>) <span class="ruby-keyword">return</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'rdfxml'</span>,<span class="ruby-string">'application/rdf+xml'</span>,<span class="ruby-identifier">uri</span>) <span class="ruby-keyword">end</span> </pre></div> <!-- raptor-source --></div> </div> <!-- raptor-method --> <div id="turtle-method" class="method-detail"><a name="method-c-turtle" id="method-c-turtle"></a> <div class="method-heading"><span class="method-name">turtle</span><span class="method-args">(uri=nil)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <p>create a parser for the turtle syntax</p> <div class="method-source-code" id="turtle-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 47</span> <span class="ruby-keyword">def</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">turtle</span>(<span class="ruby-identifier">uri</span>=<span class="ruby-keyword">nil</span>) <span class="ruby-keyword">return</span> <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'turtle'</span>,<span class="ruby-string">""</span>,<span class="ruby-identifier">uri</span>) <span class="ruby-keyword">end</span> </pre></div> <!-- turtle-source --></div> </div> <!-- turtle-method --></div> <!-- public-class-method-details --> <div id="public-instance-method-details" class="method-section section"> <h3 class="section-header">Public Instance Methods</h3> <div id="add_ident-method" class="method-detail"><a name="method-i-add_ident" id="method-i-add_ident"></a> <div class="method-heading"><span class="method-name">add_ident</span><span class="method-args">(node)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <div class="method-source-code" id="add_ident-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 165</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">add_ident</span>(<span class="ruby-identifier">node</span>) <span class="ruby-ivar">@idents</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">node</span> <span class="ruby-keyword">end</span> </pre></div> <!-- add_ident-source --></div> </div> <!-- add_ident-method --> <div id="feature-method" class="method-detail"><a name="method-i-feature" id="method-i-feature"></a> <div class="method-heading"><span class="method-name">feature</span><span class="method-args">(uri)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <p>Get a parser feature. The feature is a <a href="Uri.html">Uri</a></p> <div class="method-source-code" id="feature-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 147</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">feature</span>(<span class="ruby-identifier">uri</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">uri</span> = <span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>) <span class="ruby-keyword">end</span> <span class="ruby-identifier">value</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-identifier">librdf_parser_get_feature</span>(<span class="ruby-ivar">@parser</span>,<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">==</span> <span class="ruby-string">"NULL"</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">else</span> <span class="ruby-keyword">return</span> <span class="ruby-constant">Node</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:from_object=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">value</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span> </pre></div> <!-- feature-source --></div> </div> <!-- feature-method --> <div id="parse_as_stream-method" class="method-detail"><a name="method-i-parse_as_stream" id="method-i-parse_as_stream"></a> <div class="method-heading"><span class="method-name">parse_as_stream</span><span class="method-args">(uri,base_uri=nil)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <p>Parse the given uri with optional base_uri and return a <a href="Stream.html">Stream</a>. If block_given, yield the <a href="Statement.html">Statement</a> instead Returns nil on failure.</p> <div class="method-source-code" id="parse_as_stream-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 59</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_as_stream</span>(<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">base_uri</span>=<span class="ruby-keyword">nil</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">uri</span> = <span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">base_uri</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">base_uri</span> = <span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">base_uri</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">base_uri</span> <span class="ruby-identifier">my_stream</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-identifier">librdf_parser_parse_as_stream</span> <span class="ruby-ivar">@parser</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>, <span class="ruby-keyword">nil</span> <span class="ruby-keyword">else</span> <span class="ruby-identifier">my_stream</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-identifier">librdf_parser_parse_as_stream</span> <span class="ruby-ivar">@parser</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span> ,<span class="ruby-identifier">base_uri</span>.<span class="ruby-identifier">uri</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">my_stream</span> <span class="ruby-identifier">stream</span> = <span class="ruby-constant">Stream</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">my_stream</span>,<span class="ruby-keyword">self</span>) <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">block_given?</span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">stream</span> <span class="ruby-keyword">else</span> <span class="ruby-keyword">while</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">end?</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">current</span> <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">next</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span> </pre></div> <!-- parse_as_stream-source --></div> </div> <!-- parse_as_stream-method --> <div id="parse_into_model-method" class="method-detail"><a name="method-i-parse_into_model" id="method-i-parse_into_model"></a> <div class="method-heading"><span class="method-name">parse_into_model</span><span class="method-args">(model,uri,base_uri=nil,context=@context)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <p>Parse the syntax at the uri <a href="Uri.html">Uri</a> with optional base <a href="Uri.html">Uri</a> base_uri into <a href="Model.html">Model</a> model. If the base_uri is given then the content is parsed as if it was at the base_uri rather than the uri. If the optional context is given, the statement is added to the context</p> <p>NOTE: The order of the arguments to this method is different from the C API and other language bindings.</p> <div class="method-source-code" id="parse_into_model-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 85</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_into_model</span>(<span class="ruby-identifier">model</span>,<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">base_uri</span>=<span class="ruby-keyword">nil</span>,<span class="ruby-identifier">context</span>=<span class="ruby-ivar">@context</span>) <span class="ruby-comment">#puts "parse_into_model context is #{context}"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span> <span class="ruby-identifier">uri</span> = <span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">base_uri</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">base_uri</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span> <span class="ruby-identifier">base_uri</span> = <span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">base_uri</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">else</span> <span class="ruby-identifier">base_uri</span>=<span class="ruby-identifier">uri</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">context</span> <span class="ruby-keyword">begin</span> <span class="ruby-identifier">r</span> = <span class="ruby-constant">Redland</span>.<span class="ruby-identifier">librdf_parser_parse_into_model</span>(<span class="ruby-ivar">@parser</span>,<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">base_uri</span>.<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">model</span>.<span class="ruby-identifier">model</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-constant">RedlandError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">err</span> <span class="ruby-identifier">print</span> <span class="ruby-string">"caught error"</span><span class="ruby-operator">+</span> <span class="ruby-identifier">err</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">else</span> <span class="ruby-comment">#context</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">RedlandError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"Cannot make a Node from an object of #{context.class}"</span>) <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">context</span> <span class="ruby-identifier">context</span> = <span class="ruby-constant">Node</span>.<span class="ruby-identifier">ensure</span>(<span class="ruby-identifier">context</span>) <span class="ruby-identifier">my_stream</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-identifier">librdf_parser_parse_as_stream</span>(<span class="ruby-ivar">@parser</span>,<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">base_uri</span>.<span class="ruby-identifier">uri</span>) <span class="ruby-constant">Redland</span>.<span class="ruby-identifier">librdf_model_context_add_statements</span>(<span class="ruby-identifier">model</span>.<span class="ruby-identifier">model</span>,<span class="ruby-identifier">context</span>,<span class="ruby-identifier">my_stream</span>) <span class="ruby-comment">#self.parse_as_stream(uri,base_uri){|s| model.add_statement(s,context)}</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span> </pre></div> <!-- parse_into_model-source --></div> </div> <!-- parse_into_model-method --> <div id="parse_string_as_stream-method" class="method-detail"><a name="method-i-parse_string_as_stream" id="method-i-parse_string_as_stream"></a> <div class="method-heading"><span class="method-name">parse_string_as_stream</span><span class="method-args">(string,base_uri)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <p>Parse the syntax in string with required base <a href="Uri.html">Uri</a> base_uri</p> <p>Returns a <a href="Stream.html">Stream</a> or yields <a href="Statement.html">Statement</a> if block given. Returns nil on failure.</p> <div class="method-source-code" id="parse_string_as_stream-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 118</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_string_as_stream</span>(<span class="ruby-identifier">string</span>,<span class="ruby-identifier">base_uri</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">base_uri</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">base_uri</span> = <span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">base_uri</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">base_uri</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">RedlandError</span>(<span class="ruby-string">"A base URI is required when parsing a string"</span>) <span class="ruby-keyword">end</span> <span class="ruby-identifier">my_stream</span> = <span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-identifier">librdf_parser_parse_string_as_stream</span>(<span class="ruby-ivar">@parser</span>,<span class="ruby-identifier">string</span>,<span class="ruby-identifier">base_uri</span>.<span class="ruby-identifier">uri</span>) <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">my_stream</span> <span class="ruby-identifier">stream</span> = <span class="ruby-constant">Stream</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">my_stream</span>,<span class="ruby-keyword">self</span>) <span class="ruby-keyword">return</span> <span class="ruby-identifier">stream</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">block_given?</span> <span class="ruby-keyword">while</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">end?</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">current</span> <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">next</span> <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span> </pre></div> <!-- parse_string_as_stream-source --></div> </div> <!-- parse_string_as_stream-method --> <div id="parse_string_into_model-method" class="method-detail"><a name="method-i-parse_string_into_model" id="method-i-parse_string_into_model"></a> <div class="method-heading"><span class="method-name">parse_string_into_model</span><span class="method-args">(model,string,base_uri=nil,context=@context)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <p>Parse the syntax in String string with required <a href="Uri.html">Uri</a> base_uri into <a href="Model.html">Model</a> model. if context is given then the context information is stored as well</p> <p>NOTE: The order of the arguments to this method is different from the C API and other language bindings.</p> <div class="method-source-code" id="parse_string_into_model-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 136</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_string_into_model</span>(<span class="ruby-identifier">model</span>,<span class="ruby-identifier">string</span>,<span class="ruby-identifier">base_uri</span>=<span class="ruby-keyword">nil</span>,<span class="ruby-identifier">context</span>=<span class="ruby-ivar">@context</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">base_uri</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">base_uri</span> = <span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">base_uri</span>)<span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">base_uri</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">RedlandError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"A base URI is required when parsing a string"</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">context</span> <span class="ruby-keyword">return</span> (<span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-identifier">librdf_parser_parse_string_into_model</span>(<span class="ruby-ivar">@parser</span>,<span class="ruby-identifier">string</span>,<span class="ruby-identifier">base_uri</span>.<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">model</span>.<span class="ruby-identifier">model</span>)<span class="ruby-operator">==</span> <span class="ruby-value">0</span>) <span class="ruby-keyword">else</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse_string_as_stream</span>(<span class="ruby-identifier">string</span>,<span class="ruby-identifier">base_uri</span>.<span class="ruby-identifier">uri</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">model</span>.<span class="ruby-identifier">add_statement</span>(<span class="ruby-identifier">s</span>,<span class="ruby-identifier">context</span>)} <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span> </pre></div> <!-- parse_string_into_model-source --></div> </div> <!-- parse_string_into_model-method --> <div id="setFeature-method" class="method-detail"><a name="method-i-setFeature" id="method-i-setFeature"></a> <div class="method-heading"><span class="method-name">setFeature</span><span class="method-args">(uri,value)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <p>Set a parser feature. The feature is named <a href="Uri.html">Uri</a> uri and the value is a <a href="Node.html">Node</a>.</p> <div class="method-source-code" id="setFeature-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 159</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">setFeature</span>(<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">value</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">uri</span> = <span class="ruby-constant">Uri</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">String</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">value</span> = <span class="ruby-constant">Node</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:literal=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">value</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">return</span> (<span class="ruby-constant">Redland</span><span class="ruby-operator">::</span><span class="ruby-identifier">librdf_parser_set_feature</span>(<span class="ruby-ivar">@parser</span>,<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">value</span>.<span class="ruby-identifier">node</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>) <span class="ruby-keyword">end</span> </pre></div> <!-- setFeature-source --></div> </div> <!-- setFeature-method --> <div id="smush_file-method" class="method-detail"><a name="method-i-smush_file" id="method-i-smush_file"></a> <div class="method-heading"><span class="method-name">smush_file</span><span class="method-args">(model,uri,base_uri=nil,context=nil,idents=@idents)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <div class="method-source-code" id="smush_file-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 190</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">smush_file</span>(<span class="ruby-identifier">model</span>,<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">base_uri</span>=<span class="ruby-keyword">nil</span>,<span class="ruby-identifier">context</span>=<span class="ruby-keyword">nil</span>,<span class="ruby-identifier">idents</span>=<span class="ruby-ivar">@idents</span>) <span class="ruby-identifier">to_change</span> = {} <span class="ruby-identifier">temp_model</span> = <span class="ruby-constant">Model</span>.<span class="ruby-identifier">new</span>() <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse_into_model</span>(<span class="ruby-identifier">temp_model</span>,<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">base_uri</span>,<span class="ruby-identifier">context</span>) <span class="ruby-identifier">idents</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ident</span><span class="ruby-operator">|</span> <span class="ruby-identifier">temp_model</span>.<span class="ruby-identifier">find</span>(<span class="ruby-keyword">nil</span>,<span class="ruby-identifier">ident</span>,<span class="ruby-keyword">nil</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">old_id</span> = <span class="ruby-identifier">s</span> <span class="ruby-identifier">new_id</span> = <span class="ruby-identifier">model</span>.<span class="ruby-identifier">subject</span>(<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">new_id</span> <span class="ruby-identifier">to_change</span>[<span class="ruby-identifier">old_id</span>.<span class="ruby-identifier">to_s</span>]= <span class="ruby-identifier">new_id</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">to_change</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">old_id</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword">end</span> } <span class="ruby-keyword">end</span> <span class="ruby-comment">#puts to_change</span> <span class="ruby-identifier">temp_model</span>.<span class="ruby-identifier">triples</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span> = <span class="ruby-identifier">to_change</span>[<span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">to_change</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-identifier">model</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span>,<span class="ruby-identifier">context</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span> </pre></div> <!-- smush_file-source --></div> </div> <!-- smush_file-method --> <div id="smush_string-method" class="method-detail"><a name="method-i-smush_string" id="method-i-smush_string"></a> <div class="method-heading"><span class="method-name">smush_string</span><span class="method-args">(string,model,idents=@idents)</span> <span class="method-click-advice">click to toggle source</span></div> <div class="method-description"> <div class="method-source-code" id="smush_string-source"> <pre> <span class="ruby-comment"># File rdf/redland/parser.rb, line 169</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier">smush_string</span>(<span class="ruby-identifier">string</span>,<span class="ruby-identifier">model</span>,<span class="ruby-identifier">idents</span>=<span class="ruby-ivar">@idents</span>) <span class="ruby-identifier">to_change</span> = {} <span class="ruby-identifier">temp_model</span> = <span class="ruby-constant">Model</span>.<span class="ruby-identifier">new</span>() <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse_string_into_model</span>(<span class="ruby-identifier">temp_model</span>,<span class="ruby-identifier">string</span>,<span class="ruby-string">'http://xml.com'</span>) <span class="ruby-identifier">idents</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ident</span><span class="ruby-operator">|</span> <span class="ruby-identifier">temp_model</span>.<span class="ruby-identifier">find</span>(<span class="ruby-keyword">nil</span>,<span class="ruby-identifier">ident</span>,<span class="ruby-keyword">nil</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">old_id</span> = <span class="ruby-identifier">s</span> <span class="ruby-identifier">new_id</span> = <span class="ruby-identifier">model</span>.<span class="ruby-identifier">subject</span>(<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">new_id</span> <span class="ruby-identifier">to_change</span>[<span class="ruby-identifier">old_id</span>.<span class="ruby-identifier">to_s</span>]= <span class="ruby-identifier">new_id</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">to_change</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">old_id</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword">end</span> } <span class="ruby-keyword">end</span> <span class="ruby-comment">#puts to_change</span> <span class="ruby-identifier">temp_model</span>.<span class="ruby-identifier">triples</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span> = <span class="ruby-identifier">to_change</span>[<span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">to_change</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-identifier">model</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">s</span>,<span class="ruby-identifier">p</span>,<span class="ruby-identifier">o</span>) <span class="ruby-keyword">end</span> <span class="ruby-keyword">end</span> </pre></div> <!-- smush_string-source --></div> </div> <!-- smush_string-method --></div> <!-- public-instance-method-details --></div> <!-- 5Buntitled-5D --></div> <!-- documentation --> <hr /> <div class="outerHeader"> Go to <a href="/" target="_parent">Redland Home</a> - <a href="/bindings/" target="_parent">Language Bindings Home</a> - <a href="/docs/ruby.html" target="_parent">Ruby API Home</a> </div> <p>(C) Copyright 2004-2013 <a href="http://www.dajobe.org/" target="_parent">Dave Beckett</a>, (C) Copyright 2004-2005 <a href="http://www.bristol.ac.uk/" target="_parent">University of Bristol</a></p> </div> <!-- end outerBlock --> </body> </html>
detrout/redland-bindings
docs/rdoc/Redland/Parser.html
HTML
gpl-2.0
43,783
[ 30522, 1026, 1029, 20950, 2544, 1027, 1000, 1015, 1012, 1014, 1000, 17181, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1029, 1028, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
var s = document.createElement('script'); s.src = chrome.extension.getURL('flourish.js'); s.onload = function() { this.parentNode.removeChild(this); }; (document.head||document.documentElement).appendChild(s);
mrwillis21/flourish
extension.js
JavaScript
mit
213
[ 30522, 13075, 1055, 1027, 6254, 1012, 3443, 12260, 3672, 1006, 1005, 5896, 1005, 1007, 1025, 1055, 1012, 5034, 2278, 1027, 18546, 1012, 5331, 1012, 2131, 3126, 2140, 1006, 1005, 24299, 1012, 1046, 2015, 1005, 1007, 1025, 1055, 1012, 2006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Contains a handy indexed triangle class. * \file IceIndexedTriangle.h * \author Pierre Terdiman * \date January, 17, 2000 */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Include Guard #ifndef __ICEINDEXEDTRIANGLE_H__ #define __ICEINDEXEDTRIANGLE_H__ // Forward declarations #ifdef _MSC_VER enum CubeIndex; #else typedef int CubeIndex; #endif // An indexed triangle class. class ICEMATHS_API IndexedTriangle { public: //! Constructor inline_ IndexedTriangle() {} //! Constructor inline_ IndexedTriangle(udword r0, udword r1, udword r2) { mVRef[0]=r0; mVRef[1]=r1; mVRef[2]=r2; } //! Copy constructor inline_ IndexedTriangle(const IndexedTriangle& triangle) { mVRef[0] = triangle.mVRef[0]; mVRef[1] = triangle.mVRef[1]; mVRef[2] = triangle.mVRef[2]; } //! Destructor inline_ ~IndexedTriangle() {} //! Vertex-references udword mVRef[3]; // Methods void Flip(); float Area(const Point* verts) const; float Perimeter(const Point* verts) const; float Compacity(const Point* verts) const; void Normal(const Point* verts, Point& normal) const; void DenormalizedNormal(const Point* verts, Point& normal) const; void Center(const Point* verts, Point& center) const; void CenteredNormal(const Point* verts, Point& normal) const; void RandomPoint(const Point* verts, Point& random) const; bool IsVisible(const Point* verts, const Point& source) const; bool BackfaceCulling(const Point* verts, const Point& source) const; float ComputeOcclusionPotential(const Point* verts, const Point& view) const; bool ReplaceVertex(udword oldref, udword newref); bool IsDegenerate() const; bool HasVertex(udword ref) const; bool HasVertex(udword ref, udword* index) const; ubyte FindEdge(udword vref0, udword vref1) const; udword OppositeVertex(udword vref0, udword vref1) const; inline_ udword OppositeVertex(ubyte edgenb) const { return mVRef[2-edgenb]; } void GetVRefs(ubyte edgenb, udword& vref0, udword& vref1, udword& vref2) const; float MinEdgeLength(const Point* verts) const; float MaxEdgeLength(const Point* verts) const; void ComputePoint(const Point* verts, float u, float v, Point& pt, udword* nearvtx=null) const; float Angle(const IndexedTriangle& tri, const Point* verts) const; inline_ Plane PlaneEquation(const Point* verts) const { return Plane(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]); } bool Equal(const IndexedTriangle& tri) const; CubeIndex ComputeCubeIndex(const Point* verts) const; }; #endif // __ICEINDEXEDTRIANGLE_H__
ClinicalGraphics/pyopcode
vendor/opcode/Ice/IceIndexedTriangle.h
C
lgpl-3.0
3,427
[ 30522, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php //---------------------------------------------------------------------- // // Copyright (C) 2017-2022 Artem Rodygin // // This file is part of eTraxis. // // You should have received a copy of the GNU General Public License // along with eTraxis. If not, see <https://www.gnu.org/licenses/>. // //---------------------------------------------------------------------- namespace App\MessageHandler\Fields; use App\Dictionary\FieldType; use App\Entity\Field; use App\Entity\Fields\FieldInterface; use App\Entity\State; use App\LoginTrait; use App\Message\Fields\CreateTextFieldCommand; use App\MessageBus\Contracts\CommandBusInterface; use App\Repository\Contracts\FieldRepositoryInterface; use App\TransactionalTestCase; use Symfony\Component\Messenger\Exception\ValidationFailedException; /** * @internal * @covers \App\MessageHandler\Fields\CreateFieldCommandHandler::__invoke */ final class CreateTextFieldCommandHandlerTest extends TransactionalTestCase { use LoginTrait; private CommandBusInterface $commandBus; private FieldRepositoryInterface $repository; protected function setUp(): void { parent::setUp(); $this->commandBus = self::getContainer()->get(CommandBusInterface::class); $this->repository = $this->doctrine->getRepository(Field::class); } public function testSuccess(): void { $this->loginUser('admin@example.com'); /** @var State $state */ [/* skipping */ , $state] = $this->doctrine->getRepository(State::class)->findBy(['name' => 'Opened'], ['id' => 'ASC']); /** @var Field $field */ $field = $this->repository->findOneBy(['name' => 'Body']); self::assertNull($field); $command = new CreateTextFieldCommand($state->getId(), 'Body', FieldType::TEXT, null, true, [ FieldInterface::LENGTH => 1000, FieldInterface::DEFAULT => 'Message body', FieldInterface::PCRE_CHECK => '[0-9a-f]+', FieldInterface::PCRE_SEARCH => '(\d{3})-(\d{3})-(\d{4})', FieldInterface::PCRE_REPLACE => '($1) $2-$3', ]); $this->commandBus->handle($command); /** @var Field $field */ $field = $this->repository->findOneBy(['name' => 'Body']); self::assertInstanceOf(Field::class, $field); self::assertSame(FieldType::TEXT, $field->getType()); /** @var \App\Entity\Fields\TextField $facade */ $facade = $field->getFacade(); self::assertSame(1000, $facade->getParameter(FieldInterface::LENGTH)); self::assertSame('Message body', $facade->getParameter(FieldInterface::DEFAULT)); self::assertSame('[0-9a-f]+', $facade->getParameter(FieldInterface::PCRE_CHECK)); self::assertSame('(\d{3})-(\d{3})-(\d{4})', $facade->getParameter(FieldInterface::PCRE_SEARCH)); self::assertSame('($1) $2-$3', $facade->getParameter(FieldInterface::PCRE_REPLACE)); } public function testSuccessFallback(): void { $this->loginUser('admin@example.com'); /** @var State $state */ [/* skipping */ , $state] = $this->doctrine->getRepository(State::class)->findBy(['name' => 'Opened'], ['id' => 'ASC']); /** @var Field $field */ $field = $this->repository->findOneBy(['name' => 'Body']); self::assertNull($field); $command = new CreateTextFieldCommand($state->getId(), 'Body', FieldType::TEXT, null, true, null); $this->commandBus->handle($command); /** @var Field $field */ $field = $this->repository->findOneBy(['name' => 'Body']); self::assertInstanceOf(Field::class, $field); self::assertSame(FieldType::TEXT, $field->getType()); /** @var \App\Entity\Fields\TextField $facade */ $facade = $field->getFacade(); self::assertSame(10000, $facade->getParameter(FieldInterface::LENGTH)); self::assertNull($facade->getParameter(FieldInterface::DEFAULT)); self::assertNull($facade->getParameter(FieldInterface::PCRE_CHECK)); self::assertNull($facade->getParameter(FieldInterface::PCRE_SEARCH)); self::assertNull($facade->getParameter(FieldInterface::PCRE_REPLACE)); } public function testDefaultValueLength(): void { $this->expectException(ValidationFailedException::class); $this->loginUser('admin@example.com'); /** @var State $state */ [/* skipping */ , $state] = $this->doctrine->getRepository(State::class)->findBy(['name' => 'Opened'], ['id' => 'ASC']); /** @var Field $field */ $field = $this->repository->findOneBy(['name' => 'Body']); self::assertNull($field); $command = new CreateTextFieldCommand($state->getId(), 'Body', FieldType::TEXT, null, true, [ FieldInterface::LENGTH => 10, FieldInterface::DEFAULT => 'Message body', ]); try { $this->commandBus->handle($command); } catch (ValidationFailedException $exception) { self::assertSame('Default value should not be longer than 10 characters.', $exception->getViolations()->get(0)->getMessage()); throw $exception; } } }
etraxis/etraxis
tests/MessageHandler/Fields/CreateTextFieldCommandHandlerTest.php
PHP
gpl-3.0
5,220
[ 30522, 1026, 1029, 25718, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
class Post < ActiveRecord::Base belongs_to :forum, :counter_cache => true belongs_to :user, :counter_cache => true belongs_to :topic, :counter_cache => true has_one :event_log, :as => :target, :dependent => :destroy acts_as_ferret :fields => ['company_id', 'project_id', 'body', 'forum_id'] format_attribute :body before_create { |r| r.forum_id = r.topic.forum_id } after_create { |r| Topic.update_all(['replied_at = ?, replied_by = ?, last_post_id = ?', r.created_at, r.user_id, r.id], ['id = ?', r.topic_id]) if r.id l = r.create_event_log l.company_id = r.company_id l.project_id = r.project_id l.user_id = r.user_id l.event_type = EventLog::FORUM_NEW_POST l.created_at = r.created_at l.save end } after_destroy { |r| t = Topic.find(r.topic_id) ; Topic.update_all(['replied_at = ?, replied_by = ?, last_post_id = ?', t.posts.last.created_at, t.posts.last.user_id, t.posts.last.id], ['id = ?', t.id]) if t.posts.last } validates_presence_of :user_id, :body, :topic attr_accessible :body def editable_by?(user) user && (user.id == user_id || (user.admin? && topic.forum.company_id == user.company_id) || user.admin > 2 || user.moderator_of?(topic.forum_id)) end def to_xml(options = {}) options[:except] ||= [] options[:except] << :topic_title << :forum_name super end def company_id self.forum.company_id end def project_id self.forum.project_id end def started_at self.created_at end end
SpiderJack/cit
app/models/post.rb
Ruby
mit
1,537
[ 30522, 2465, 2695, 1026, 3161, 2890, 27108, 2094, 1024, 1024, 2918, 7460, 1035, 2000, 1024, 7057, 1010, 1024, 4675, 1035, 17053, 1027, 1028, 2995, 7460, 1035, 2000, 1024, 5310, 1010, 1024, 4675, 1035, 17053, 1027, 1028, 2995, 7460, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Colorinator</title> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="viewport" content="width=410"> <!-- jQuery --> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script> <!-- Wijmo CSS and script --> <link type="text/css" href="http://cdn.wijmo.com/themes/metro/jquery-wijmo.css" rel="stylesheet" title="metro-jqueryui" /> <link type="text/css" href="http://cdn.wijmo.com/jquery.wijmo-complete.all.2.1.5.min.css" rel="stylesheet" /> <script type="text/javascript" src="http://cdn.wijmo.com/jquery.wijmo-open.all.2.1.5.min.js"></script> <!-- KnockoutJS for MVVM--> <script type="text/javascript" src="http://cdn.wijmo.com/external/knockout-2.0.0.js"></script> <script type="text/javascript" src="http://cdn.wijmo.com/external/knockout.wijmo.js"></script> <script type="text/javascript"> //Create ViewModel var viewModel = function () { var self = this; self.red = ko.observable(120); self.green = ko.observable(120); self.blue = ko.observable(120); self.minRGB = ko.observable(0); self.maxRGB = ko.observable(255); self.rgbColor = ko.computed(function () { // Knockout tracks dependencies automatically. It knows that rgbColor depends on hue, saturation and lightness, because these get called when evaluating rgbColor. return "rgb(" + self.red() + ", " + self.green() + ", " + self.blue() + ")"; }, self); self.hslColor = ko.computed(function () { //Convert red, green and blue numbers to hue (degree), saturation (percentage) and lightness (percentage) var r = self.red() / 255, g = self.green() / 255, b = self.blue() / 255; var max = Math.max(r, g, b), min = Math.min(r, g, b); var h, s, l = (max + min) / 2; var hue, saturation, lightness; if (max == min) { h = s = 0; } else { var d = max - min; s = l > 0.5 ? d / (2 - max - min) : d / (max + min); switch (max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; } h /= 6; } hue = Math.round(h * 360); saturation = Math.round(s * 100) + "%"; lightness = Math.round(l * 100) + "%"; return "hsl(" + hue + ", " + saturation + ", " + lightness + ")"; }, self); self.hexColor = ko.computed({ read: function () { //Convert red, green and blue numbers to base 16 strings var r = self.red(), g = self.green(), b = self.blue(); var hex = 1 << 24 | r << 16 | g << 8 | b; return '#' + hex.toString(16).substr(1); }, write: function (value) { //This is a writable computed observable so that one can type in a hex color to update the RGB values. var r, g, b; if (value[0] === "#") { value = value.substr(1); } if (value.length < 3) { return; } else if (value.length > 6) { value = value.substr(0, 6); } else if (value.length === 3) { //Short code hex converted to full hex r = value.substr(0, 1) + value.substr(0, 1); g = value.substr(1, 1) + value.substr(1, 1); b = value.substr(2, 1) + value.substr(2, 1); value = r + g + b; } //Update ViewModel red, green and blue values self.red(parseInt(value.substr(0, 2), 16)); self.green(parseInt(value.substr(2, 2), 16)); self.blue(parseInt(value.substr(4, 2), 16)); }, owner: self }); }; //Bind ViewModel and Event Handlers $(document).ready(function () { var vm = new viewModel(); //check for hex color passed in URL getColorFromHash(); //Apply ViewModel bindings in markup ko.applyBindings(vm); //Trigger CSS3 animation to show color picker pane when ViewModel is initialized $(".wait").addClass("show").removeClass("wait"); //Check if browser supports hashchange event if ("onhashchange" in window) { window.onhashchange = getColorFromHash; } //Get hex color from URL and update ViewModel with value function getColorFromHash() { if (window.location.hash && window.location.hash != vm.hexColor()) { vm.hexColor(window.location.hash); } } }); </script> <style type="text/css"> body { font-family: "Segoe UI Light" , Frutiger, "Frutiger Linotype" , "Dejavu Sans" , "Helvetica Neue" , Arial, sans-serif; font-size: 14px; background: #000; } h1 { font-size: 2.4em; color: #fff; padding: 20px 0 0 6px; margin: 0; } .container { margin: 0 auto; width: 400px; } .wait { height: 1px; } .show { height: 530px; -webkit-transition: all 1.2s ease-out; -moz-transition: all 1.2s ease-out; -o-transition: all 1.2s ease-out; transition: all 1.2s ease-out; } .color-picker { overflow: hidden; background: #fff; padding: 20px; box-shadow: 5px 5px 50px rgba(0, 0, 0, 0.5); } .swatch { margin: 20px; width: 320px; height: 200px; box-shadow: 5px 5px 20px rgba(0, 0, 0, 0.5) inset; } .color-section { padding: 6px 0 0 0; } .color-label { width: 70px; display: inline-block; } .unit { width: 30px; } .color-value { width: 140px; } .color-slider { width: 200px; } .wijmo-wijslider-horizontal { display: inline-block; } </style> </head> <body data-bind="style: { background: hexColor }"> <div class="container"> <h1> Colorinator</h1> <div class="color-picker wait"> <div class="swatch" data-bind="style: { background: hexColor }"> </div> <div class="color-section"> <label class="color-label"> Red</label> <div data-bind="wijslider: { value: red, min: minRGB, max: maxRGB }" class="color-slider"> </div> <input type="text" data-bind="value: red, valueUpdate: 'keyup', wijtextbox: {}" class="unit" /> </div> <div class="color-section"> <label class="color-label"> Green</label> <div data-bind="wijslider: { value: green, min: minRGB, max: maxRGB }" class="color-slider"> </div> <input type="text" data-bind="value: green, valueUpdate: 'keyup', wijtextbox: {}" class="unit" /> </div> <div class="color-section"> <label class="color-label"> Blue</label> <div data-bind="wijslider: { value: blue, min: minRGB, max: maxRGB }" class="color-slider"> </div> <input type="text" data-bind="value: blue, valueUpdate: 'keyup', wijtextbox: {}" class="unit" /> </div> <div class="color-section"> <label class="color-label"> RGB Color</label> <input type="text" data-bind="value: rgbColor, disable: true, wijtextbox: { disabled: true }" class="color-value" /> <span data-bind="text: rgbColor"></span> </div> <div class="color-section"> <label class="color-label"> HSL Color</label> <input type="text" data-bind="value: hslColor, disable: true, wijtextbox: { disabled: true }" class="color-value" /> <span data-bind="text: hslColor"></span> </div> <div class="color-section"> <label class="color-label"> HEX Color</label> <input type="text" data-bind="value: hexColor, wijtextbox: { }" class="color-value" /> <a data-bind="text: hexColor, attr: { href: hexColor }" title="Link to this color"></a> </div> <p> Made with <a href="http://knockoutjs.com">KnockoutJS</a> and <a href="http://wijmo.com">Wijmo</a></p> </div> </div> </body> </html>
wijmo/Wijmo-Complete
demo-apps/colour/index.html
HTML
gpl-3.0
9,738
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 2516, 1028, 3609, 23207, 1026, 1013, 2516, 1028, 1026, 18804, 8299, 30524, 41...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NUnit.Framework; using TSQL; namespace Tests { public class CharactersTests { [Test] public void Characters_InTrue() { Assert.IsTrue(TSQLCharacters.Comma.In( TSQLCharacters.Comma, TSQLCharacters.Period)); } [Test] public void Characters_InFalse() { Assert.IsFalse(TSQLCharacters.Comma.In( TSQLCharacters.Period)); } [Test] public void Characters_InNull() { Assert.IsFalse(TSQLCharacters.Comma.In()); } [Test] public void Characters_IsTrue() { Assert.IsTrue(TSQLCharacters.IsCharacter(",")); } [Test] public void Characters_IsFalse() { Assert.IsFalse(TSQLCharacters.IsCharacter("a")); } [Test] public void Characters_IsNull() { Assert.IsFalse(TSQLCharacters.IsCharacter(null)); } [Test] public void Characters_ParseNull() { Assert.AreEqual(TSQLCharacters.None, TSQLCharacters.Parse(null)); } [Test] public void Characters_EqualsObjectTrue() { Assert.IsTrue(TSQLCharacters.Comma.Equals((object)TSQLCharacters.Comma)); } [Test] public void Characters_EqualsObjectFalse() { Assert.IsFalse(TSQLCharacters.Comma.Equals((object)TSQLCharacters.Period)); } [Test] public void Characters_GetHashCode() { Dictionary<TSQLCharacters, string> lookupTest = new Dictionary<TSQLCharacters, string>(); lookupTest[TSQLCharacters.Comma] = ","; // this should call GetHashCode Assert.AreEqual(",", lookupTest[TSQLCharacters.Comma]); } } }
bruce-dunwiddie/tsql-parser
TSQL_Parser/Tests/CharactersTests.cs
C#
apache-2.0
1,591
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 2291, 1012, 11409, 4160, 1025, 2478, 2291, 1012, 3793, 1025, 2478, 2291, 1012, 11689, 2075, 1012, 8518, 1025, 2478, 16634, 4183, 1012, 7705, 1025, 2478, 24529, 4160, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Showing how to use Go concurrency constructs to safely fan-out a request to multiple backends, return the fastest correct response, and clean up the laggards.
jabley/fptp
README.md
Markdown
mit
159
[ 30522, 4760, 2129, 2000, 2224, 2175, 24154, 9570, 2015, 2000, 9689, 5470, 1011, 2041, 1037, 5227, 2000, 3674, 2067, 10497, 2015, 1010, 2709, 1996, 7915, 6149, 3433, 1010, 1998, 4550, 2039, 1996, 2474, 23033, 17811, 1012, 102, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace App\Form; use Symfony\Component\Form\{ AbstractType, FormBuilderInterface }; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\Extension\Core\Type\{ TextType, TextareaType, FileType }; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Doctrine\ORM\EntityRepository; use App\Entity\{ Company, Category }; class CompanyType extends AbstractType { private $container; public function __construct(ContainerInterface $container) { $this->container = $container; } /** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('logo', Type\ImageFileType::class, [ 'required' => false, 'label' => 'front.logo', 'upload_path' => $this->container->getParameter('company_images'), 'attr' => [ 'accept' => 'image/*', 'class' => 'form-control form-control-lg' ] ]) ->add('title', TextType::class, [ 'label' => 'front.name', 'attr' => [ 'class' => 'form-control form-control-lg' ] ]) ->add('description', TextareaType::class, [ 'required' => false, 'label' => 'front.description', 'attr' => [ 'class' => 'form-control form-control-lg' // text-editor ] ]) ->add('categories', EntityType::class, [ 'class' => Category::class, //'required' => false, 'multiple' => true, 'label' => 'front.select.category', 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('c') ->where('c.parent <> :null') ->setParameter('null', 'null') ->orderBy('c.title', 'ASC'); }, 'attr' => [ 'class' => 'form-control select2' ] ]) ->add('gallery_images', FileType::class, [ "data_class" => null, 'multiple' => true, "mapped" => false, 'required' => false, 'label' => 'front.add.gallery', 'attr' => [ 'class' => 'form-control form-control-lg' ] ]) ; } /** * {@inheritdoc} */ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'data_class' => Company::class ]); } /** * {@inheritdoc} */ public function getBlockPrefix() { return 'app_company'; } }
lloonnyyaa/reviews
src/Form/CompanyType.php
PHP
mit
3,177
[ 30522, 1026, 1029, 25718, 3415, 15327, 10439, 1032, 2433, 1025, 2224, 25353, 2213, 14876, 4890, 1032, 6922, 1032, 2433, 1032, 1063, 10061, 13874, 1010, 2433, 8569, 23891, 6657, 3334, 12172, 1065, 1025, 2224, 25353, 2213, 14876, 4890, 1032, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.inferred.freevisitor.tests.j8; public class TypeA extends VisitableType {}
inferred/freevisitor
src/it/j8/main/java/org/inferred/freevisitor/tests/j8/TypeA.java
Java
apache-2.0
88
[ 30522, 7427, 8917, 1012, 1999, 7512, 5596, 1012, 2489, 11365, 15660, 1012, 5852, 1012, 1046, 2620, 1025, 2270, 2465, 2828, 2050, 8908, 3942, 3085, 13874, 1063, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
GreenLifePiCar ============== The project using Android smartphone to control Raspberry pi, including basic moving by motor controlling, and support gravity sensing by G-Sensor built-in mobile phone. When Pi moving towards to the obstacle, ultrasonic detection can make Pi stop itself if distance less than 10cm e.g. It also can detect current humiture if you want. However the mobile and Pi connect with wifi. The app can also display real-time imaging througn camera install in Pi. This can use for remote video monitor. <img src="https://github.com/spiritedRunning/GreenLifePiCar/raw/master/screenshots/20160726214000.jpg" width="30%" height="30%"> <img src="https://github.com/spiritedRunning/GreenLifePiCar/raw/master/screenshots/20160726214832.jpg" width="30%" height="30%"> <img src="https://github.com/spiritedRunning/GreenLifePiCar/raw/master/screenshots/20160726214545.jpg" width="50%" height="50%"> <img src="https://github.com/spiritedRunning/GreenLifePiCar/raw/master/screenshots/20160726214723.jpg" width="50%" height="50%"> Requirement Devices: 1. Raspberry pi Mode B Rev2 2. Meizu mx mobile phone(4.1.1) 3. DHT11 humiture sensor(3.5V-5.5V DC) / DS18B20 temperature sensor 4. DC deceleration motor * 4(12V DC) 5. L298N double H motor driver board(+5V~+35V) 6. HC-SR04 ultrasonic detect distance sensor(accuracy: 0.3cm) 7. portable source 8. a USB camera 8. 1-way relay mode(5V, optional)
spiritedRunning/GreenLifePiCar
README.md
Markdown
apache-2.0
1,411
[ 30522, 2665, 15509, 24330, 2906, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1996, 2622, 2478, 11924, 26381, 2000, 2491, 20710, 2361, 9766, 14255, 1010, 2164, 3937, 3048, 2011, 5013, 9756, 1010, 1998,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* ide.h */ /* Copyright (C) 2011 John R. Coffman. Licensed for hobbyist use on the N8VEM baby M68k CPU board. *********************************************************************** 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 in the file COPYING in the distribution directory along with this program. If not, see <http://www.gnu.org/licenses/>. **********************************************************************/ #ifndef __IDE_H #define __IDE_H #include "mytypes.h" #pragma pack(1) #ifndef MASTER #define MASTER 0 #define SLAVE 16 #endif typedef struct _IDENTIFY_DEVICE_DATA { struct { word Reserved1 :1; word Retired3 :1; word ResponseIncomplete :1; word Retired2 :3; word FixedDevice :1; word RemovableMedia :1; word Retired1 :7; word DeviceType :1; } GeneralConfiguration; word NumCylinders; // use it word ReservedWord2; word NumHeads; // use it word Retired1[2]; word NumSectorsPerTrack; // use it word VendorUnique1[3]; byte SerialNumber[20]; word Retired2[2]; word Obsolete1; byte FirmwareRevision[8]; byte ModelNumber[40]; byte MaximumBlockTransfer; byte VendorUnique2; word ReservedWord48; struct { byte ReservedByte49; #ifndef M68000 byte DmaSupported :1; byte LbaSupported :1; // use it byte IordyDisable :1; byte IordySupported :1; byte Reserved1 :1; byte StandybyTimerSupport :1; byte Reserved2 :2; #else byte Reserved2 :2; byte StandybyTimerSupport :1; byte Reserved1 :1; byte IordySupported :1; byte IordyDisable :1; byte LbaSupported :1; // use it byte DmaSupported :1; #endif word ReservedWord50; } Capabilities; word ObsoleteWords51[2]; word TranslationFieldsValid :3; word Reserved3 :13; word NumberOfCurrentCylinders; // check it word NumberOfCurrentHeads; // check it word CurrentSectorsPerTrack; // check it dword CurrentSectorCapacity; // check it byte CurrentMultiSectorSetting; byte MultiSectorSettingValid :1; byte ReservedByte59 :7; dword UserAddressableSectors; // use it -- 28 bit LBA max word ObsoleteWord62; word MultiWordDMASupport :8; word MultiWordDMAActive :8; word AdvancedPIOModes :8; word ReservedByte64 :8; word MinimumMWXferCycleTime; word RecommendedMWXferCycleTime; word MinimumPIOCycleTime; word MinimumPIOCycleTimeIORDY; word ReservedWords69[6]; word QueueDepth :5; word ReservedWord75 :11; word ReservedWords76[4]; word MajorRevision; word MinorRevision; struct { word SmartCommands :1; word SecurityMode :1; word RemovableMediaFeature :1; word PowerManagement :1; word Reserved1 :1; word WriteCache :1; word LookAhead :1; word ReleaseInterrupt :1; word ServiceInterrupt :1; word DeviceReset :1; word HostProtectedArea :1; word Obsolete1 :1; word WriteBuffer :1; word ReadBuffer :1; word Nop :1; word Obsolete2 :1; word DownloadMicrocode :1; word DmaQueued :1; word Cfa :1; word AdvancedPm :1; word Msn :1; word PowerUpInStandby :1; word ManualPowerUp :1; word Reserved2 :1; word SetMax :1; word Acoustics :1; word BigLba :1; word DeviceConfigOverlay :1; word FlushCache :1; word FlushCacheExt :1; word Resrved3 :2; word SmartErrorLog :1; word SmartSelfTest :1; word MediaSerialNumber :1; word MediaCardPassThrough :1; word StreamingFeature :1; word GpLogging :1; word WriteFua :1; word WriteQueuedFua :1; word WWN64Bit :1; word URGReadStream :1; word URGWriteStream :1; word ReservedForTechReport :2; word IdleWithUnloadFeature :1; word Reserved4 :2; } CommandSetSupport; struct { word SmartCommands :1; word SecurityMode :1; word RemovableMediaFeature :1; word PowerManagement :1; word Reserved1 :1; word WriteCache :1; word LookAhead :1; word ReleaseInterrupt :1; word ServiceInterrupt :1; word DeviceReset :1; word HostProtectedArea :1; word Obsolete1 :1; word WriteBuffer :1; word ReadBuffer :1; word Nop :1; word Obsolete2 :1; word DownloadMicrocode :1; word DmaQueued :1; word Cfa :1; word AdvancedPm :1; word Msn :1; word PowerUpInStandby :1; word ManualPowerUp :1; word Reserved2 :1; word SetMax :1; word Acoustics :1; word BigLba :1; word DeviceConfigOverlay :1; word FlushCache :1; word FlushCacheExt :1; word Resrved3 :2; word SmartErrorLog :1; word SmartSelfTest :1; word MediaSerialNumber :1; word MediaCardPassThrough :1; word StreamingFeature :1; word GpLogging :1; word WriteFua :1; word WriteQueuedFua :1; word WWN64Bit :1; word URGReadStream :1; word URGWriteStream :1; word ReservedForTechReport :2; word IdleWithUnloadFeature :1; word Reserved4 :2; } CommandSetActive; word UltraDMASupport :8; word UltraDMAActive :8; word ReservedWord89[4]; word HardwareResetResult; word CurrentAcousticValue :8; word RecommendedAcousticValue :8; word ReservedWord95[5]; dword Max48BitLBA[2]; // MBZ -- check it word StreamingTransferTime; word ReservedWord105; struct { word LogicalSectorsPerPhysicalSector :4; word Reserved0 :8; word LogicalSectorLongerThan256Words :1; word MultipleLogicalSectorsPerPhysicalSector :1; word Reserved1 :2; } PhysicalLogicalSectorSize; word InterSeekDelay; word WorldWideName[4]; word ReservedForWorldWideName128[4]; word ReservedForTlcTechnicalReport; word WordsPerLogicalSector[2]; struct { word ReservedForDrqTechnicalReport :1; word WriteReadVerifySupported :1; word Reserved01 :11; word Reserved1 :2; } CommandSetSupportExt; struct { word ReservedForDrqTechnicalReport :1; word WriteReadVerifyEnabled :1; word Reserved01 :11; word Reserved1 :2; } CommandSetActiveExt; word ReservedForExpandedSupportandActive[6]; word MsnSupport :2; word ReservedWord1274 :14; struct { word SecuritySupported :1; word SecurityEnabled :1; word SecurityLocked :1; word SecurityFrozen :1; word SecurityCountExpired :1; word EnhancedSecurityEraseSupported :1; word Reserved0 :2; word SecurityLevel :1; word Reserved1 :7; } SecurityStatus; word ReservedWord129[31]; struct { word MaximumCurrentInMA2 :12; word CfaPowerMode1Disabled :1; word CfaPowerMode1Required :1; word Reserved0 :1; word Word160Supported :1; } CfaPowerModel; word ReservedForCfaWord161[8]; struct { word SupportsTrim :1; word Reserved0 :15; } DataSetManagementFeature; word ReservedForCfaWord170[6]; word CurrentMediaSerialNumber[30]; word ReservedWord206; word ReservedWord207[2]; struct { word AlignmentOfLogicalWithinPhysical :14; word Word209Supported :1; word Reserved0 :1; } BlockAlignment; word WriteReadVerifySectorCountMode3Only[2]; word WriteReadVerifySectorCountMode2Only[2]; struct { word NVCachePowerModeEnabled :1; word Reserved0 :3; word NVCacheFeatureSetEnabled :1; word Reserved1 :3; word NVCachePowerModeVersion :4; word NVCacheFeatureSetVersion :4; } NVCacheCapabilities; word NVCacheSizeLSW; word NVCacheSizeMSW; word NominalMediaRotationRate; word ReservedWord218; struct { byte NVCacheEstimatedTimeToSpinUpInSeconds; byte Reserved; } NVCacheOptions; word ReservedWord220[35]; word Signature :8; word CheckSum :8; } IDENTIFY_DEVICE_DATA; #define FMT_IDD "wwwwdwwwwwwwwwwwwwwdwwwwwwwwwwwwwwwwwwwwwwwwwccwccwwwwwwwdccdww" #define FMT_ID2 "wwwwwwwwwwwwwwwwww" #define FMT_ID3 "wwwwwwwwwwwwwwwwwwddwwwwwwwwwwwwwwwwwwwwwwwww" #define FMT_ID4 "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwww" #define FMT_ID5 "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww" #define FMT_ID6 "wwwwwwwwwccwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww" #endif // __IDE_H
willsowerbutts/kiss-bios
ide.h
C
gpl-3.0
8,745
[ 30522, 1013, 1008, 8909, 2063, 1012, 1044, 1008, 1013, 1013, 1008, 9385, 1006, 1039, 1007, 2249, 2198, 1054, 1012, 2522, 4246, 2386, 1012, 7000, 2005, 17792, 2923, 2224, 2006, 1996, 1050, 2620, 3726, 2213, 3336, 1049, 2575, 2620, 2243, 17...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.ComponentModel; namespace LinqAn.Google.Metrics { /// <summary> /// The total number of completions for the requested goal number. /// </summary> [Description("The total number of completions for the requested goal number.")] public class Goal19Completions: Metric<int> { /// <summary> /// Instantiates a <seealso cref="Goal19Completions" />. /// </summary> public Goal19Completions(): base("Goal 19 Completions",true,"ga:goal19Completions") { } } }
kenshinthebattosai/LinqAn.Google
src/LinqAn.Google/Metrics/Goal19Completions.cs
C#
mit
490
[ 30522, 2478, 2291, 1012, 6922, 5302, 9247, 1025, 3415, 15327, 11409, 19062, 2078, 1012, 8224, 1012, 12046, 2015, 1063, 1013, 1013, 1013, 1026, 12654, 1028, 1013, 1013, 1013, 1996, 2561, 2193, 1997, 6503, 2015, 2005, 1996, 7303, 3125, 2193, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* File: ConditionalMacros.h Contains: Set up for compiler independent conditionals Version: Technology: Universal Interface Files Release: Universal Interfaces 3.4.1 Copyright: © 1993-2001 by Apple Computer, Inc., all rights reserved Bugs?: For bug reports, consult the following page on the World Wide Web: http://developer.apple.com/bugreporter/ */ #ifndef __CONDITIONALMACROS__ #define __CONDITIONALMACROS__ /**************************************************************************************************** UNIVERSAL_INTERFACES_VERSION 0x0400 --> version 4.0 (Mac OS X only) 0x0341 --> version 3.4.1 0x0340 --> version 3.4 0x0331 --> version 3.3.1 0x0330 --> version 3.3 0x0320 --> version 3.2 0x0310 --> version 3.1 0x0301 --> version 3.0.1 0x0300 --> version 3.0 0x0210 --> version 2.1 This conditional did not exist prior to version 2.1 ****************************************************************************************************/ #define UNIVERSAL_INTERFACES_VERSION 0x0341 /**************************************************************************************************** TARGET_CPU_Å These conditionals specify which microprocessor instruction set is being generated. At most one of these is true, the rest are false. TARGET_CPU_PPC - Compiler is generating PowerPC instructions TARGET_CPU_68K - Compiler is generating 680x0 instructions TARGET_CPU_X86 - Compiler is generating x86 instructions TARGET_CPU_MIPS - Compiler is generating MIPS instructions TARGET_CPU_SPARC - Compiler is generating Sparc instructions TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions TARGET_OS_Å These conditionals specify in which Operating System the generated code will run. At most one of the these is true, the rest are false. TARGET_OS_MAC - Generate code will run under Mac OS TARGET_OS_WIN32 - Generate code will run under 32-bit Windows TARGET_OS_UNIX - Generate code will run under some unix TARGET_RT_Å These conditionals specify in which runtime the generated code will run. This is needed when the OS and CPU support more than one runtime (e.g. MacOS on 68K supports CFM68K and Classic 68k). TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O style runtime TARGET_RT_MAC_68881 - TARGET_OS_MAC is true and 68881 floating point instructions used TARGET__API_Å_Å These conditionals are used to differentiate between sets of API's on the same processor under the same OS. The first section after _API_ is the OS. The second section is the API set. Unlike TARGET_OS_ and TARGET_CPU_, these conditionals are not mutally exclusive. This file will attempt to auto-configure all TARGET_API_Å_Å values, but will often need a TARGET_API_Å_Å value predefined in order to disambiguate. TARGET_API_MAC_OS8 - Code is being compiled to run on System 7 through Mac OS 8.x TARGET_API_MAC_CARBON - Code is being compiled to run on Mac OS 8 and Mac OS X via CarbonLib TARGET_API_MAC_OSX - Code is being compiled to run on Mac OS X PRAGMA_Å These conditionals specify whether the compiler supports particular #pragma's PRAGMA_IMPORT - Compiler supports: #pragma import on/off/reset PRAGMA_ONCE - Compiler supports: #pragma once PRAGMA_STRUCT_ALIGN - Compiler supports: #pragma options align=mac68k/power/reset PRAGMA_STRUCT_PACK - Compiler supports: #pragma pack(n) PRAGMA_STRUCT_PACKPUSH - Compiler supports: #pragma pack(push, n)/pack(pop) PRAGMA_ENUM_PACK - Compiler supports: #pragma options(!pack_enums) PRAGMA_ENUM_ALWAYSINT - Compiler supports: #pragma enumsalwaysint on/off/reset PRAGMA_ENUM_OPTIONS - Compiler supports: #pragma options enum=int/small/reset FOUR_CHAR_CODE This conditional does the proper byte swapping to assue that a four character code (e.g. 'TEXT') is compiled down to the correct value on all compilers. FOUR_CHAR_CODE('abcd') - Convert a four-char-code to the correct 32-bit value TYPE_Å These conditionals specify whether the compiler supports particular types. TYPE_LONGLONG - Compiler supports "long long" 64-bit integers TYPE_BOOL - Compiler supports "bool" TYPE_EXTENDED - Compiler supports "extended" 80/96 bit floating point TYPE_LONGDOUBLE_IS_DOUBLE - Compiler implements "long double" same as "double" FUNCTION_Å These conditionals specify whether the compiler supports particular language extensions to function prototypes and definitions. FUNCTION_PASCAL - Compiler supports "pascal void Foo()" FUNCTION_DECLSPEC - Compiler supports "__declspec(xxx) void Foo()" FUNCTION_WIN32CC - Compiler supports "void __cdecl Foo()" and "void __stdcall Foo()" ****************************************************************************************************/ #if defined(__MRC__) /* MrC[pp] compiler from Apple Computer, Inc. */ #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define TARGET_RT_MAC_CFM 1 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #if (__MRC__ > 0x0200) && (__MRC__ < 0x0700) #define PRAGMA_IMPORT 1 #else #define PRAGMA_IMPORT 0 #endif #define PRAGMA_STRUCT_ALIGN 1 #define PRAGMA_ONCE 1 #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 1 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #if (__MRC__ > 0x0300) && (__MRC__ < 0x0700) #if __option(longlong) #define TYPE_LONGLONG 1 #else #define TYPE_LONGLONG 0 #endif #if __option(bool) #define TYPE_BOOL 1 #else #define TYPE_BOOL 0 #endif #define SLASH_INCLUDES_UNSUPPORTED !__option(unix_includes) #else #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define SLASH_INCLUDES_UNSUPPORTED 1 #endif #define TYPE_EXTENDED 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 0 #define FUNCTION_PASCAL 1 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(__SC__) && (defined(MPW_CPLUS) || defined(MPW_C)) /* SC[pp] compiler from Apple Computer, Inc. */ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 1 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #if defined(__CFM68K__) #define TARGET_RT_MAC_CFM 1 #else #define TARGET_RT_MAC_CFM 0 #endif #define TARGET_RT_MAC_MACHO 0 #if defined(mc68881) #define TARGET_RT_MAC_68881 1 #else #define TARGET_RT_MAC_68881 0 #endif #if TARGET_RT_MAC_CFM #define PRAGMA_IMPORT 1 #if (__SC__ <= 0x0810) /* old versions of SC don't support Ò#pragma import resetÓ */ #define PRAGMA_IMPORT_OFF 1 #endif #else #define PRAGMA_IMPORT 0 #endif #if (__SC__ >= 0x0801) #define PRAGMA_STRUCT_ALIGN 1 #else #define PRAGMA_STRUCT_ALIGN 0 #endif #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 1 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_LONGLONG 0 #define TYPE_EXTENDED 1 #define TYPE_LONGDOUBLE_IS_DOUBLE 0 #if (__SC__ > 0x0810) #if __option(bool) #define TYPE_BOOL 1 #else #define TYPE_BOOL 0 #endif #else #define TYPE_BOOL 0 #endif #if TARGET_RT_MAC_CFM #define FUNCTION_PASCAL 0 #else #define FUNCTION_PASCAL 1 #endif #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #define SLASH_INCLUDES_UNSUPPORTED !__option(unix_includes) #elif defined(__MWERKS__) /* CodeWarrior compiler from Metrowerks, Inc. */ #if (__MWERKS__ < 0x0900) || macintosh #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #if powerc #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_RT_MAC_CFM 1 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #else #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 1 #if defined(__CFM68K__) #define TARGET_RT_MAC_CFM 1 #else #define TARGET_RT_MAC_CFM 0 #endif #define TARGET_RT_MAC_MACHO 0 #if __MC68881__ #define TARGET_RT_MAC_68881 1 #else #define TARGET_RT_MAC_68881 0 #endif #if __option(IEEEdoubles) #define TYPE_LONGDOUBLE_IS_DOUBLE 0 #else #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #endif #endif #define PRAGMA_ONCE 1 #if (__MWERKS__ >= 0x0700) #define PRAGMA_IMPORT TARGET_RT_MAC_CFM #else #define PRAGMA_IMPORT 0 #endif #define PRAGMA_STRUCT_ALIGN 1 #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 1 #define PRAGMA_ENUM_OPTIONS 0 #if __option(enumsalwaysint) && __option(ANSI_strict) #define FOUR_CHAR_CODE(x) ((long)(x)) /* otherwise compiler will complain about values with high bit set */ #else #define FOUR_CHAR_CODE(x) (x) #endif #if TARGET_CPU_68K && !TARGET_RT_MAC_CFM #define FUNCTION_PASCAL 1 #else #define FUNCTION_PASCAL 1 #endif #if (__MWERKS__ >= 0x2000) #define FUNCTION_DECLSPEC 1 #else #define FUNCTION_DECLSPEC 0 #endif #define FUNCTION_WIN32CC 0 #elif (__MWERKS__ >= 0x0900) && __INTEL__ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 1 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 1 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 #define PRAGMA_ONCE 1 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 1 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 1 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define FUNCTION_PASCAL 0 #ifndef FUNCTION_DECLSPEC /* allow use of __declspec(dllimport) to be enabled */ #define FUNCTION_DECLSPEC 0 /* QuickTime for Windows cannot use dllimport */ #endif #ifndef FUNCTION_WIN32CC /* allow calling convention to be overriddden */ #define FUNCTION_WIN32CC 1 #endif #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #elif (__MWERKS__ >= 0x1900) && __MIPS__ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 1 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 1 #if __option(little_endian) #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 #else #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #endif #define PRAGMA_ONCE 1 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 1 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #elif (__MWERKS__ >= 0x2110) && __MACH__ #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #if __option(little_endian) #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 #else #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #endif #define TARGET_RT_MAC_CFM 0 #define TARGET_RT_MAC_MACHO 1 #define TARGET_RT_MAC_68881 0 #define PRAGMA_ONCE 1 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 1 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 1 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define FUNCTION_PASCAL 1 #define FUNCTION_DECLSPEC 1 #define FUNCTION_WIN32CC 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #else #error unknown Metrowerks compiler #endif #if (__MWERKS__ >= 0x1100) #if __option(longlong) #define TYPE_LONGLONG 1 #else #define TYPE_LONGLONG 0 #endif #else #define TYPE_LONGLONG 0 #endif #if (__MWERKS__ >= 0x1000) #if __option(bool) #define TYPE_BOOL 1 #else #define TYPE_BOOL 0 #endif #else #define TYPE_BOOL 0 #endif #define TYPE_EXTENDED 0 #define SLASH_INCLUDES_UNSUPPORTED 1 #elif defined(SYMANTEC_CPLUS) || defined(SYMANTEC_C) /* C and C++ compiler from Symantec, Inc. */ #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #if powerc #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_RT_MAC_CFM 1 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #else #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 1 #if defined(__CFM68K) #define TARGET_RT_MAC_CFM 1 #else #define TARGET_RT_MAC_CFM 0 #endif #define TARGET_RT_MAC_MACHO 0 #if mc68881 #define TARGET_RT_MAC_68881 1 #else #define TARGET_RT_MAC_68881 0 #endif #endif #define PRAGMA_IMPORT 0 #define PRAGMA_ONCE 1 #define PRAGMA_STRUCT_ALIGN 1 #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 1 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #if __useAppleExts__ #define TYPE_EXTENDED 1 #else #define TYPE_EXTENDED 0 #endif #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #define SLASH_INCLUDES_UNSUPPORTED 1 #elif defined(THINK_C) /* THINK C compiler from Symantec, Inc. << WARNING: Unsupported Compiler >> */ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 1 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define TARGET_RT_MAC_CFM 0 #define TARGET_RT_MAC_MACHO 0 #if defined(mc68881) #define TARGET_RT_MAC_68881 1 #else #define TARGET_RT_MAC_68881 0 #endif #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_ONCE 1 #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 1 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_EXTENDED 1 #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define FUNCTION_PASCAL 1 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #define SLASH_INCLUDES_UNSUPPORTED 1 #elif defined(__PPCC__) /* PPCC compiler from Apple Computer, Inc. << WARNING: Unsupported Compiler >> */ #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define TARGET_RT_MAC_CFM 1 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 1 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_EXTENDED 0 #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #define SLASH_INCLUDES_UNSUPPORTED 1 #elif defined(applec) && !defined(__SC__) /* MPW C compiler from Apple Computer, Inc. << WARNING: Unsupported Compiler >> */ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 1 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define TARGET_RT_MAC_CFM 0 #define TARGET_RT_MAC_MACHO 0 #if defined(mc68881) #define TARGET_RT_MAC_68881 1 #else #define TARGET_RT_MAC_68881 0 #endif #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 /* Note: MPW C 3.2 had a bug where MACRO('xx ') would cause 'xx ' to be misevaluated */ #define FOUR_CHAR_CODE #define TYPE_EXTENDED 1 #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 0 #define FUNCTION_PASCAL 1 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #define SLASH_INCLUDES_UNSUPPORTED 1 #elif defined(__GNUC__) && (defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__NEXT_CPP__)) /* gcc based compilers used on OpenStep -> Rhapsody -> Mac OS X */ #if defined(__ppc__) || defined(powerpc) || defined(ppc) #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_MAC_68881 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #ifdef __MACH__ #define TARGET_RT_MAC_MACHO 1 #define TARGET_RT_MAC_CFM 0 #else #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_CFM 1 #endif #elif defined(m68k) #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 1 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_MAC_CFM 0 #define TARGET_RT_MAC_MACHO 1 #define TARGET_RT_MAC_68881 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #elif defined(sparc) #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 1 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_MAC_CFM 0 #define TARGET_RT_MAC_MACHO 1 #define TARGET_RT_MAC_68881 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #elif defined(__i386__) || defined(i386) || defined(intel) #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 1 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_MAC_CFM 0 #define TARGET_RT_MAC_MACHO 1 #define TARGET_RT_MAC_68881 0 #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 #else #error unrecognized GNU C compiler #endif #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 1 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_EXTENDED 0 #if __GNUC__ >= 2 #define TYPE_LONGLONG 1 #else #define TYPE_LONGLONG 0 #endif #ifdef __cplusplus #define TYPE_BOOL 1 #else #define TYPE_BOOL 0 #endif #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(__GNUC__) && defined(__linux__) /* gcc (egcs, really) for MkLinux. << WARNING: Unsupported Compiler >> */ #if #cpu(powerpc) #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_MAC_CFM 1 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #elif #cpu(m68k) #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 1 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_MAC_CFM 0 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #else #error unsupported GNU C compiler #endif #if #system(macos) #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #elif #system(unix) #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 1 #else #error unsupported GNU C compiler #endif #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_EXTENDED 0 #ifdef _LONG_LONG #define TYPE_LONGLONG 1 #else #define TYPE_LONGLONG 0 #endif #define TYPE_BOOL 0 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(__GNUC__) && defined(__MINGW32__) /* Mingw gnu gcc/egcs compiler for Win32 systems (http://www.mingw.org). */ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 1 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_MAC_CFM 0 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 1 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_EXTENDED 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_LONGLONG 1 #define TYPE_BOOL 1 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(__GNUC__) /* gC for MPW from Free Software Foundation, Inc. */ #if #cpu(powerpc) #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_MAC_CFM 1 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #elif #cpu(m68k) #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 1 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_RT_MAC_CFM 0 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #else #error unsupported GNU C compiler #endif #if #system(macos) #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #elif #system(unix) #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 1 #else #error unsupported GNU C compiler #endif #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 1 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_EXTENDED 0 #ifdef _LONG_LONG #define TYPE_LONGLONG 1 #else #define TYPE_LONGLONG 0 #endif #define TYPE_BOOL 0 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__) /* xlc and xlC on RS/6000 from IBM, Inc. */ #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #if defined(_AIX) #define TARGET_OS_MAC 0 #define TARGET_OS_UNIX 1 #else #define TARGET_OS_MAC 1 #define TARGET_OS_UNIX 0 #endif #define TARGET_OS_WIN32 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define TARGET_RT_MAC_CFM 1 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 1 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 1 #define FOUR_CHAR_CODE(x) (x) #define TYPE_LONGDOUBLE_IS_DOUBLE 0 #define TYPE_EXTENDED 0 #ifdef _LONG_LONG #define TYPE_LONGLONG 1 #else #define TYPE_LONGLONG 0 #endif #define TYPE_BOOL 0 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(_MSC_VER) && !defined(__MWERKS__) /* Visual Studio C/C++ from Microsoft, Inc. */ #if defined(_M_M68K) /* Visual C++ with Macintosh 68K target */ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 1 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define TARGET_RT_MAC_CFM 0 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 1 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 1 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_EXTENDED 0 #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define FUNCTION_PASCAL 1 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(_M_MPPC) /* Visual C++ with Macintosh PowerPC target */ #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define TARGET_RT_MAC_CFM 1 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 1 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 1 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_EXTENDED 0 #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(_M_IX86) /* Visual Studio with Intel x86 target */ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 1 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 1 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 1 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_EXTENDED 0 #define TYPE_LONGLONG 1 /* note: uses __int64 instead of long long */ #define LONGLONG_TYPENAME __int64 #define LONGLONG_SIGNED_MAX (9223372036854775807i64) #define LONGLONG_SIGNED_MIN (-9223372036854775807i64 - 1) #define LONGLONG_UNSIGNED_MAX (0xffffffffffffffffui64) #if defined(__cplusplus) && (_MSC_VER >= 1100) #define TYPE_BOOL 1 #else #define TYPE_BOOL 0 #endif #define FUNCTION_PASCAL 0 #ifndef FUNCTION_DECLSPEC /* allow use of __declspec(dllimport) to be enabled */ #define FUNCTION_DECLSPEC 0 /* QuickTime for Windows cannot use dllimport */ #endif #ifndef FUNCTION_WIN32CC /* allow calling convention to be overriddden */ #define FUNCTION_WIN32CC 1 #endif /* Warning: This macros away the pascal word in source code. */ /* Very useful for code that needs to compile on Mac 68k and Windows */ /* but can silently change code */ #undef pascal #define pascal #elif defined(_M_ALPHA) /* Visual C++ with Dec Alpha target */ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 1 #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 1 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 1 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (((unsigned long) ((x) & 0x000000FF)) << 24) \ | (((unsigned long) ((x) & 0x0000FF00)) << 8) \ | (((unsigned long) ((x) & 0x00FF0000)) >> 8) \ | (((unsigned long) ((x) & 0xFF000000)) >> 24) #define TYPE_EXTENDED 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(_M_PPC) /* Visual C++ for Windows NT on PowerPC target */ #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 1 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 1 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (((unsigned long) ((x) & 0x000000FF)) << 24) \ | (((unsigned long) ((x) & 0x0000FF00)) << 8) \ | (((unsigned long) ((x) & 0x00FF0000)) >> 8) \ | (((unsigned long) ((x) & 0xFF000000)) >> 24) #define TYPE_EXTENDED 0 #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(_M_MRX000) /* Visual C++ for Windows NT on MIPS target */ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 1 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 1 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 1 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (((unsigned long) ((x) & 0x000000FF)) << 24) \ | (((unsigned long) ((x) & 0x0000FF00)) << 8) \ | (((unsigned long) ((x) & 0x00FF0000)) >> 8) \ | (((unsigned long) ((x) & 0xFF000000)) >> 24) #define TYPE_EXTENDED 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #endif #elif defined(__MOTO__) /* mcc from Motorola, Inc. */ #define TARGET_CPU_PPC 1 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define TARGET_RT_MAC_CFM 1 #define TARGET_RT_MAC_MACHO 0 #define TARGET_RT_MAC_68881 0 #define PRAGMA_IMPORT 0 /* how is this detected ?? */ #define PRAGMA_STRUCT_ALIGN 1 #if __MOTO__ >= 40702 /* MCC version 4.7.2 */ #define PRAGMA_ONCE 1 #else #define PRAGMA_ONCE 0 #endif #define PRAGMA_STRUCT_PACK 0 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_LONGLONG 0 /* how is this detected ?? */ #ifdef _BOOL #define TYPE_BOOL 1 #else #define TYPE_BOOL 0 #endif #define TYPE_EXTENDED 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(_MIPS_ISA) /* MIPSpro compiler from Silicon Graphics Inc. */ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 1 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 1 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (x) #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_EXTENDED 0 #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #elif defined(__sparc) /* SPARCompiler compiler from Sun Microsystems Inc. */ #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 1 #define TARGET_CPU_ALPHA 0 #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 1 #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #define PRAGMA_IMPORT 0 #define PRAGMA_STRUCT_ALIGN 0 #define PRAGMA_ONCE 0 #define PRAGMA_STRUCT_PACK 1 #define PRAGMA_STRUCT_PACKPUSH 0 #define PRAGMA_ENUM_PACK 0 #define PRAGMA_ENUM_ALWAYSINT 0 #define PRAGMA_ENUM_OPTIONS 0 #define FOUR_CHAR_CODE(x) (((unsigned long) ((x) & 0x000000FF)) << 24) \ | (((unsigned long) ((x) & 0x0000FF00)) << 8) \ | (((unsigned long) ((x) & 0x00FF0000)) >> 8) \ | (((unsigned long) ((x) & 0xFF000000)) >> 24) #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #define TYPE_EXTENDED 0 #define TYPE_LONGLONG 0 #define TYPE_BOOL 0 #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 #define FUNCTION_WIN32CC 0 #else /* Unknown compiler, perhaps set up from the command line (e.g. -d TARGET_CPU_MIPS , etc.) */ #if defined(TARGET_CPU_PPC) && TARGET_CPU_PPC #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #elif defined(TARGET_CPU_68K) && TARGET_CPU_68K #define TARGET_CPU_PPC 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #elif defined(TARGET_CPU_X86) && TARGET_CPU_X86 #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #elif defined(TARGET_CPU_MIPS) && TARGET_CPU_MIPS #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #elif defined(TARGET_CPU_SPARC) && TARGET_CPU_SPARC #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_ALPHA 0 #elif defined(TARGET_CPU_ALPHA) && TARGET_CPU_ALPHA #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #else /* NOTE: If your compiler errors out here then support for your compiler has not yet been added to ConditionalMacros.h. ConditionalMacros.h is designed to be plug-and-play. It auto detects which compiler is being run and configures the TARGET_ conditionals appropriately. The short term work around is to set the TARGET_CPU_ and TARGET_OS_ on the command line to the compiler (e.g. d TARGET_CPU_MIPS -d TARGET_OS_UNIX) The long term solution is to add a new case to this file which auto detects your compiler and sets up the TARGET_ conditionals. If you do this, send the changes you made to devsupport@apple.com to get it integrated into the next release of ConditionalMacros.h. */ #error ConditionalMacros.h: unknown compiler (see comment above) #define TARGET_CPU_PPC 0 #define TARGET_CPU_68K 0 #define TARGET_CPU_X86 0 #define TARGET_CPU_MIPS 0 #define TARGET_CPU_SPARC 0 #define TARGET_CPU_ALPHA 0 #endif #if defined(TARGET_OS_MAC) && TARGET_OS_MAC #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #elif defined(TARGET_OS_WIN32) && TARGET_OS_WIN32 #define TARGET_OS_MAC 0 #define TARGET_OS_UNIX 0 #elif defined(TARGET_OS_UNIX) && TARGET_OS_UNIX #define TARGET_OS_MAC 0 #define TARGET_OS_WIN32 0 #elif TARGET_CPU_PPC || TARGET_CPU_68K #define TARGET_OS_MAC 1 #define TARGET_OS_WIN32 0 #define TARGET_OS_UNIX 0 #else #error ConditionalMacros.h: unknown target OS (see comment above) #endif #if !defined(TARGET_RT_BIG_ENDIAN) && !defined(TARGET_RT_LITTLE_ENDIAN) #if TARGET_OS_MAC #define TARGET_RT_LITTLE_ENDIAN 0 #define TARGET_RT_BIG_ENDIAN 1 #elif TARGET_OS_WIN32 #define TARGET_RT_LITTLE_ENDIAN 1 #define TARGET_RT_BIG_ENDIAN 0 #endif #endif #if defined(TARGET_RT_BIG_ENDIAN) && !defined(TARGET_RT_LITTLE_ENDIAN) #define TARGET_RT_LITTLE_ENDIAN !TARGET_RT_BIG_ENDIAN #elif !defined(TARGET_RT_BIG_ENDIAN) && defined(TARGET_RT_LITTLE_ENDIAN) #define TARGET_RT_BIG_ENDIAN !TARGET_RT_LITTLE_ENDIAN #endif #if !defined(TARGET_RT_BIG_ENDIAN) && !defined(TARGET_RT_LITTLE_ENDIAN) #error unknown endianess of target processor #endif #if TARGET_OS_MAC #ifndef TARGET_RT_MAC_CFM #define TARGET_RT_MAC_CFM TARGET_CPU_PPC #endif #ifndef TARGET_RT_MAC_68881 #define TARGET_RT_MAC_68881 0 #endif #ifndef TARGET_RT_MAC_MACHO #define TARGET_RT_MAC_MACHO !TARGET_RT_MAC_CFM #endif #endif #ifndef PRAGMA_IMPORT #define PRAGMA_IMPORT 0 #endif #ifndef PRAGMA_STRUCT_ALIGN #define PRAGMA_STRUCT_ALIGN 0 #endif #ifndef PRAGMA_ONCE #define PRAGMA_ONCE 0 #endif #ifndef PRAGMA_STRUCT_PACK #define PRAGMA_STRUCT_PACK 0 #endif #ifndef PRAGMA_STRUCT_PACKPUSH #define PRAGMA_STRUCT_PACKPUSH 0 #endif #ifndef PRAGMA_ENUM_PACK #define PRAGMA_ENUM_PACK 0 #endif #ifndef PRAGMA_ENUM_ALWAYSINT #define PRAGMA_ENUM_ALWAYSINT 0 #endif #ifndef PRAGMA_ENUM_OPTIONS #define PRAGMA_ENUM_OPTIONS 0 #endif #ifndef FOUR_CHAR_CODE #define FOUR_CHAR_CODE(x) (x) #endif #ifndef TYPE_LONGDOUBLE_IS_DOUBLE #define TYPE_LONGDOUBLE_IS_DOUBLE 1 #endif #ifndef TYPE_EXTENDED #define TYPE_EXTENDED 0 #endif #ifndef TYPE_LONGLONG #define TYPE_LONGLONG 0 #endif #ifndef TYPE_BOOL #define TYPE_BOOL 0 #endif #ifndef FUNCTION_PASCAL #define FUNCTION_PASCAL 0 #endif #ifndef FUNCTION_DECLSPEC #define FUNCTION_DECLSPEC 0 #endif #ifndef FUNCTION_WIN32CC #define FUNCTION_WIN32CC 0 #endif #endif /**************************************************************************************************** Under MacOS, the classic 68k runtime has two calling conventions: pascal or C Under Win32, there are two calling conventions: __cdecl or __stdcall Headers and implementation files can use the following macros to make their source more portable by hiding the calling convention details: EXTERN_APIÅ These macros are used to specify the calling convention on a function prototype. EXTERN_API - Classic 68k: pascal, Win32: __cdecl EXTERN_API_C - Classic 68k: C, Win32: __cdecl EXTERN_API_STDCALL - Classic 68k: pascal, Win32: __stdcall EXTERN_API_C_STDCALL - Classic 68k: C, Win32: __stdcall DEFINE_APIÅ These macros are used to specify the calling convention on a function definition. DEFINE_API - Classic 68k: pascal, Win32: __cdecl DEFINE_API_C - Classic 68k: C, Win32: __cdecl DEFINE_API_STDCALL - Classic 68k: pascal, Win32: __stdcall DEFINE_API_C_STDCALL - Classic 68k: C, Win32: __stdcall CALLBACK_APIÅ These macros are used to specify the calling convention of a function pointer. CALLBACK_API - Classic 68k: pascal, Win32: __stdcall CALLBACK_API_C - Classic 68k: C, Win32: __stdcall CALLBACK_API_STDCALL - Classic 68k: pascal, Win32: __cdecl CALLBACK_API_C_STDCALL - Classic 68k: C, Win32: __cdecl ****************************************************************************************************/ #if FUNCTION_PASCAL && !FUNCTION_DECLSPEC && !FUNCTION_WIN32CC /* compiler supports pascal keyword only */ #define EXTERN_API(_type) extern pascal _type #define EXTERN_API_C(_type) extern _type #define EXTERN_API_STDCALL(_type) extern pascal _type #define EXTERN_API_C_STDCALL(_type) extern _type #define DEFINE_API(_type) pascal _type #define DEFINE_API_C(_type) _type #define DEFINE_API_STDCALL(_type) pascal _type #define DEFINE_API_C_STDCALL(_type) _type #define CALLBACK_API(_type, _name) pascal _type (*_name) #define CALLBACK_API_C(_type, _name) _type (*_name) #define CALLBACK_API_STDCALL(_type, _name) pascal _type (*_name) #define CALLBACK_API_C_STDCALL(_type, _name) _type (*_name) #elif FUNCTION_PASCAL && FUNCTION_DECLSPEC && !FUNCTION_WIN32CC /* compiler supports pascal and __declspec() */ #define EXTERN_API(_type) extern pascal __declspec(dllimport) _type #define EXTERN_API_C(_type) extern __declspec(dllimport) _type #define EXTERN_API_STDCALL(_type) extern pascal __declspec(dllimport) _type #define EXTERN_API_C_STDCALL(_type) extern __declspec(dllimport) _type #define DEFINE_API(_type) pascal __declspec(dllexport) _type #define DEFINE_API_C(_type) __declspec(dllexport) _type #define DEFINE_API_STDCALL(_type) pascal __declspec(dllexport) _type #define DEFINE_API_C_STDCALL(_type) __declspec(dllexport) _type #define CALLBACK_API(_type, _name) pascal _type (*_name) #define CALLBACK_API_C(_type, _name) _type (*_name) #define CALLBACK_API_STDCALL(_type, _name) pascal _type (*_name) #define CALLBACK_API_C_STDCALL(_type, _name) _type (*_name) #elif !FUNCTION_PASCAL && FUNCTION_DECLSPEC && !FUNCTION_WIN32CC /* compiler supports __declspec() */ #define EXTERN_API(_type) extern __declspec(dllimport) _type #define EXTERN_API_C(_type) extern __declspec(dllimport) _type #define EXTERN_API_STDCALL(_type) extern __declspec(dllimport) _type #define EXTERN_API_C_STDCALL(_type) extern __declspec(dllimport) _type #define DEFINE_API(_type) __declspec(dllexport) _type #define DEFINE_API_C(_type) __declspec(dllexport) _type #define DEFINE_API_STDCALL(_type) __declspec(dllexport) _type #define DEFINE_API_C_STDCALL(_type) __declspec(dllexport) _type #define CALLBACK_API(_type, _name) _type ( * _name) #define CALLBACK_API_C(_type, _name) _type ( * _name) #define CALLBACK_API_STDCALL(_type, _name) _type ( * _name) #define CALLBACK_API_C_STDCALL(_type, _name) _type ( * _name) #elif !FUNCTION_PASCAL && FUNCTION_DECLSPEC && FUNCTION_WIN32CC /* compiler supports __declspec() and __cdecl */ #define EXTERN_API(_type) __declspec(dllimport) _type __cdecl #define EXTERN_API_C(_type) __declspec(dllimport) _type __cdecl #define EXTERN_API_STDCALL(_type) __declspec(dllimport) _type __stdcall #define EXTERN_API_C_STDCALL(_type) __declspec(dllimport) _type __stdcall #define DEFINE_API(_type) __declspec(dllexport) _type __cdecl #define DEFINE_API_C(_type) __declspec(dllexport) _type __cdecl #define DEFINE_API_STDCALL(_type) __declspec(dllexport) _type __stdcall #define DEFINE_API_C_STDCALL(_type) __declspec(dllexport) _type __stdcall #define CALLBACK_API(_type, _name) _type (__cdecl * _name) #define CALLBACK_API_C(_type, _name) _type (__cdecl * _name) #define CALLBACK_API_STDCALL(_type, _name) _type (__stdcall * _name) #define CALLBACK_API_C_STDCALL(_type, _name) _type (__stdcall * _name) #elif !FUNCTION_PASCAL && !FUNCTION_DECLSPEC && FUNCTION_WIN32CC /* compiler supports __cdecl */ #define EXTERN_API(_type) _type __cdecl #define EXTERN_API_C(_type) _type __cdecl #define EXTERN_API_STDCALL(_type) _type __stdcall #define EXTERN_API_C_STDCALL(_type) _type __stdcall #define DEFINE_API(_type) _type __cdecl #define DEFINE_API_C(_type) _type __cdecl #define DEFINE_API_STDCALL(_type) _type __stdcall #define DEFINE_API_C_STDCALL(_type) _type __stdcall #define CALLBACK_API(_type, _name) _type (__cdecl * _name) #define CALLBACK_API_C(_type, _name) _type (__cdecl * _name) #define CALLBACK_API_STDCALL(_type, _name) _type (__stdcall * _name) #define CALLBACK_API_C_STDCALL(_type, _name) _type (__stdcall * _name) #else /* compiler supports no extensions */ #define EXTERN_API(_type) extern _type #define EXTERN_API_C(_type) extern _type #define EXTERN_API_STDCALL(_type) extern _type #define EXTERN_API_C_STDCALL(_type) extern _type #define DEFINE_API(_type) _type #define DEFINE_API_C(_type) _type #define DEFINE_API_STDCALL(_type) _type #define DEFINE_API_C_STDCALL(_type) _type #define CALLBACK_API(_type, _name) _type ( * _name) #define CALLBACK_API_C(_type, _name) _type ( * _name) #define CALLBACK_API_STDCALL(_type, _name) _type ( * _name) #define CALLBACK_API_C_STDCALL(_type, _name) _type ( * _name) #undef pascal #define pascal #endif /* On classic 68k, some callbacks are register based. The only way to */ /* write them in C is to make a function with no parameters and a void */ /* return. Inside the function you manually get and set registers. */ #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM #define CALLBACK_API_REGISTER68K(_type, _name, _params) CALLBACK_API(void, _name)() #else #define CALLBACK_API_REGISTER68K(_type, _name, _params) CALLBACK_API(_type, _name)_params #endif /**************************************************************************************************** Set up TARGET_API_Å_Å values ****************************************************************************************************/ #if TARGET_OS_MAC #if !defined(TARGET_API_MAC_OS8) && !defined(TARGET_API_MAC_OSX) && !defined(TARGET_API_MAC_CARBON) /* No TARGET_API_MAC_* predefined on command line */ #if TARGET_RT_MAC_MACHO /* Looks like MachO style compiler */ #define TARGET_API_MAC_OS8 0 #define TARGET_API_MAC_CARBON 1 #define TARGET_API_MAC_OSX 1 #elif defined(TARGET_CARBON) && TARGET_CARBON /* grandfather in use of TARGET_CARBON */ #define TARGET_API_MAC_OS8 0 #define TARGET_API_MAC_CARBON 1 #define TARGET_API_MAC_OSX 0 #elif TARGET_CPU_PPC && TARGET_RT_MAC_CFM /* Looks like CFM style PPC compiler */ #define TARGET_API_MAC_OS8 1 #define TARGET_API_MAC_CARBON 0 #define TARGET_API_MAC_OSX 0 #else /* 68k or some other compiler */ #define TARGET_API_MAC_OS8 1 #define TARGET_API_MAC_CARBON 0 #define TARGET_API_MAC_OSX 0 #endif /* */ #else #ifndef TARGET_API_MAC_OS8 #define TARGET_API_MAC_OS8 0 #endif /* !defined(TARGET_API_MAC_OS8) */ #ifndef TARGET_API_MAC_OSX #define TARGET_API_MAC_OSX TARGET_RT_MAC_MACHO #endif /* !defined(TARGET_API_MAC_OSX) */ #ifndef TARGET_API_MAC_CARBON #define TARGET_API_MAC_CARBON TARGET_API_MAC_OSX #endif /* !defined(TARGET_API_MAC_CARBON) */ #endif /* !defined(TARGET_API_MAC_OS8) && !defined(TARGET_API_MAC_OSX) && !defined(TARGET_API_MAC_CARBON) */ #if TARGET_API_MAC_OS8 && TARGET_API_MAC_OSX #error TARGET_API_MAC_OS8 and TARGET_API_MAC_OSX are mutually exclusive #endif /* TARGET_API_MAC_OS8 && TARGET_API_MAC_OSX */ #if !TARGET_API_MAC_OS8 && !TARGET_API_MAC_CARBON && !TARGET_API_MAC_OSX #error At least one of TARGET_API_MAC_* must be true #endif /* !TARGET_API_MAC_OS8 && !TARGET_API_MAC_CARBON && !TARGET_API_MAC_OSX */ #else #define TARGET_API_MAC_OS8 0 #define TARGET_API_MAC_CARBON 0 #define TARGET_API_MAC_OSX 0 #endif /* TARGET_OS_MAC */ /* Support source code still using TARGET_CARBON */ #ifndef TARGET_CARBON #if TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8 #define TARGET_CARBON 1 #else #define TARGET_CARBON 0 #endif /* TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8 */ #endif /* !defined(TARGET_CARBON) */ /**************************************************************************************************** Backward compatibility for clients expecting 2.x version on ConditionalMacros.h GENERATINGPOWERPC - Compiler is generating PowerPC instructions GENERATING68K - Compiler is generating 68k family instructions GENERATING68881 - Compiler is generating mc68881 floating point instructions GENERATINGCFM - Code being generated assumes CFM calling conventions CFMSYSTEMCALLS - No A-traps. Systems calls are made using CFM and UPP's PRAGMA_ALIGN_SUPPORTED - Compiler supports: #pragma options align=mac68k/power/reset PRAGMA_IMPORT_SUPPORTED - Compiler supports: #pragma import on/off/reset CGLUESUPPORTED - Clients can use all lowercase toolbox functions that take C strings instead of pascal strings ****************************************************************************************************/ #if !TARGET_API_MAC_CARBON #define GENERATINGPOWERPC TARGET_CPU_PPC #define GENERATING68K TARGET_CPU_68K #define GENERATING68881 TARGET_RT_MAC_68881 #define GENERATINGCFM TARGET_RT_MAC_CFM #define CFMSYSTEMCALLS TARGET_RT_MAC_CFM #ifndef CGLUESUPPORTED #define CGLUESUPPORTED 0 #endif /* !defined(CGLUESUPPORTED) */ #ifndef OLDROUTINELOCATIONS #define OLDROUTINELOCATIONS 0 #endif /* !defined(OLDROUTINELOCATIONS) */ #define PRAGMA_ALIGN_SUPPORTED PRAGMA_STRUCT_ALIGN #define PRAGMA_IMPORT_SUPPORTED PRAGMA_IMPORT #else /* Carbon code should not use old conditionals */ #define PRAGMA_ALIGN_SUPPORTED ..PRAGMA_ALIGN_SUPPORTED_is_obsolete.. #define GENERATINGPOWERPC ..GENERATINGPOWERPC_is_obsolete.. #define GENERATING68K ..GENERATING68K_is_obsolete.. #define GENERATING68881 ..GENERATING68881_is_obsolete.. #define GENERATINGCFM ..GENERATINGCFM_is_obsolete.. #define CFMSYSTEMCALLS ..CFMSYSTEMCALLS_is_obsolete.. #endif /* !TARGET_API_MAC_CARBON */ /**************************************************************************************************** OLDROUTINENAMES - "Old" names for Macintosh system calls are allowed in source code. (e.g. DisposPtr instead of DisposePtr). The names of system routine are now more sensitive to change because CFM binds by name. In the past, system routine names were compiled out to just an A-Trap. Macros have been added that each map an old name to its new name. This allows old routine names to be used in existing source files, but the macros only work if OLDROUTINENAMES is true. This support will be removed in the near future. Thus, all source code should be changed to use the new names! You can set OLDROUTINENAMES to false to see if your code has any old names left in it. ****************************************************************************************************/ #ifndef OLDROUTINENAMES #define OLDROUTINENAMES 0 #endif /* !defined(OLDROUTINENAMES) */ /**************************************************************************************************** The following macros isolate the use of 68K inlines in function prototypes. On the Mac OS under the Classic 68K runtime, function prototypes were followed by a list of 68K opcodes which the compiler inserted in the generated code instead of a JSR. Under Classic 68K on the Mac OS, this macro will put the opcodes in the right syntax. For all other OS's and runtimes the macro suppress the opcodes. Example: EXTERN_P void DrawPicture(PicHandle myPicture, const Rect *dstRect) ONEWORDINLINE(0xA8F6); ****************************************************************************************************/ #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM #define ONEWORDINLINE(w1) = w1 #define TWOWORDINLINE(w1,w2) = {w1,w2} #define THREEWORDINLINE(w1,w2,w3) = {w1,w2,w3} #define FOURWORDINLINE(w1,w2,w3,w4) = {w1,w2,w3,w4} #define FIVEWORDINLINE(w1,w2,w3,w4,w5) = {w1,w2,w3,w4,w5} #define SIXWORDINLINE(w1,w2,w3,w4,w5,w6) = {w1,w2,w3,w4,w5,w6} #define SEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7) = {w1,w2,w3,w4,w5,w6,w7} #define EIGHTWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8) = {w1,w2,w3,w4,w5,w6,w7,w8} #define NINEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9) = {w1,w2,w3,w4,w5,w6,w7,w8,w9} #define TENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10} #define ELEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11} #define TWELVEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12} #else #define ONEWORDINLINE(w1) #define TWOWORDINLINE(w1,w2) #define THREEWORDINLINE(w1,w2,w3) #define FOURWORDINLINE(w1,w2,w3,w4) #define FIVEWORDINLINE(w1,w2,w3,w4,w5) #define SIXWORDINLINE(w1,w2,w3,w4,w5,w6) #define SEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7) #define EIGHTWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8) #define NINEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9) #define TENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10) #define ELEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11) #define TWELVEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12) #endif /**************************************************************************************************** TARGET_CARBON - default: false. Switches all of the above as described. Overrides all others - NOTE: If you set TARGET_CARBON to 1, then the other switches will be setup by ConditionalMacros, and should not be set manually. If you wish to do development for pre-Carbon Systems, you can set the following: OPAQUE_TOOLBOX_STRUCTS - default: false. True for Carbon builds, hides struct fields. OPAQUE_UPP_TYPES - default: false. True for Carbon builds, UPP types are unique and opaque. ACCESSOR_CALLS_ARE_FUNCTIONS - default: false. True for Carbon builds, enables accessor functions. CALL_NOT_IN_CARBON - default: true. False for Carbon builds, hides calls not supported in Carbon. Specifically, if you are building a non-Carbon application (one that links against InterfaceLib) but you wish to use some of the accessor functions, you can set ACCESSOR_CALLS_ARE_FUNCTIONS to 1 and link with CarbonAccessors.o, which implements just the accessor functions. This will help you preserve source compatibility between your Carbon and non-Carbon application targets. MIXEDMODE_CALLS_ARE_FUNCTIONS - deprecated. ****************************************************************************************************/ #if TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8 #ifndef OPAQUE_TOOLBOX_STRUCTS #define OPAQUE_TOOLBOX_STRUCTS 1 #endif /* !defined(OPAQUE_TOOLBOX_STRUCTS) */ #ifndef OPAQUE_UPP_TYPES #define OPAQUE_UPP_TYPES 1 #endif /* !defined(OPAQUE_UPP_TYPES) */ #ifndef ACCESSOR_CALLS_ARE_FUNCTIONS #define ACCESSOR_CALLS_ARE_FUNCTIONS 1 #endif /* !defined(ACCESSOR_CALLS_ARE_FUNCTIONS) */ #ifndef CALL_NOT_IN_CARBON #define CALL_NOT_IN_CARBON 0 #endif /* !defined(CALL_NOT_IN_CARBON) */ #ifndef MIXEDMODE_CALLS_ARE_FUNCTIONS #define MIXEDMODE_CALLS_ARE_FUNCTIONS 1 #endif /* !defined(MIXEDMODE_CALLS_ARE_FUNCTIONS) */ #else #ifndef OPAQUE_TOOLBOX_STRUCTS #define OPAQUE_TOOLBOX_STRUCTS 0 #endif /* !defined(OPAQUE_TOOLBOX_STRUCTS) */ #ifndef OPAQUE_UPP_TYPES #define OPAQUE_UPP_TYPES 0 #endif /* !defined(OPAQUE_UPP_TYPES) */ #ifndef ACCESSOR_CALLS_ARE_FUNCTIONS #define ACCESSOR_CALLS_ARE_FUNCTIONS 0 #endif /* !defined(ACCESSOR_CALLS_ARE_FUNCTIONS) */ /* * It's possible to have ACCESSOR_CALLS_ARE_FUNCTIONS set to true and OPAQUE_TOOLBOX_STRUCTS * set to false, but not the other way around, so make sure the defines are not set this way. */ #if OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS #error OPAQUE_TOOLBOX_STRUCTS cannot be true when ACCESSOR_CALLS_ARE_FUNCTIONS is false #endif /* OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS */ #ifndef CALL_NOT_IN_CARBON #define CALL_NOT_IN_CARBON 1 #endif /* !defined(CALL_NOT_IN_CARBON) */ #ifndef MIXEDMODE_CALLS_ARE_FUNCTIONS #define MIXEDMODE_CALLS_ARE_FUNCTIONS 0 #endif /* !defined(MIXEDMODE_CALLS_ARE_FUNCTIONS) */ #endif /* TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8 */ #endif /* __CONDITIONALMACROS__ */
ATMakersOrg/OpenIKeys
original/IntelliKeys/WindowsOld/common/MoreFiles/CHeaders/ConditionalMacros.h
C
mit
72,327
[ 30522, 1013, 1008, 5371, 1024, 18462, 22911, 7352, 1012, 1044, 3397, 1024, 2275, 2039, 2005, 21624, 2981, 18462, 2015, 2544, 1024, 2974, 1024, 5415, 8278, 6764, 2713, 1024, 5415, 19706, 1017, 1012, 1018, 1012, 30524, 2011, 6207, 3274, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Dynamic; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Text; using System.Xml; using System.Xml.Serialization; using XSerializer.Encryption; namespace XSerializer { internal static class SerializationExtensions { internal const string ReadOnlyDictionary = "System.Collections.ObjectModel.ReadOnlyDictionary`2, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; internal const string IReadOnlyDictionary = "System.Collections.Generic.IReadOnlyDictionary`2, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; internal const string IReadOnlyCollection = "System.Collections.Generic.IReadOnlyCollection`1, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; internal const string IReadOnlyList = "System.Collections.Generic.IReadOnlyList`1, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; private static readonly Type[] _readOnlyCollections = new[] { Type.GetType(IReadOnlyCollection), Type.GetType(IReadOnlyList), typeof(ReadOnlyCollection<>) }.Where(t => t != null).ToArray(); private static readonly ConcurrentDictionary<Tuple<Type, Type>, Func<object, object>> _convertFuncs = new ConcurrentDictionary<Tuple<Type, Type>, Func<object, object>>(); private static readonly Dictionary<Type, string> _typeToXsdTypeMap = new Dictionary<Type, string>(); private static readonly Dictionary<string, Type> _xsdTypeToTypeMap = new Dictionary<string, Type>(); private static readonly ConcurrentDictionary<int, Type> _xsdTypeToTypeCache = new ConcurrentDictionary<int, Type>(); static SerializationExtensions() { _typeToXsdTypeMap.Add(typeof(bool), "xsd:boolean"); _typeToXsdTypeMap.Add(typeof(byte), "xsd:unsignedByte"); _typeToXsdTypeMap.Add(typeof(sbyte), "xsd:byte"); _typeToXsdTypeMap.Add(typeof(short), "xsd:short"); _typeToXsdTypeMap.Add(typeof(ushort), "xsd:unsignedShort"); _typeToXsdTypeMap.Add(typeof(int), "xsd:int"); _typeToXsdTypeMap.Add(typeof(uint), "xsd:unsignedInt"); _typeToXsdTypeMap.Add(typeof(long), "xsd:long"); _typeToXsdTypeMap.Add(typeof(ulong), "xsd:unsignedLong"); _typeToXsdTypeMap.Add(typeof(float), "xsd:float"); _typeToXsdTypeMap.Add(typeof(double), "xsd:double"); _typeToXsdTypeMap.Add(typeof(decimal), "xsd:decimal"); _typeToXsdTypeMap.Add(typeof(DateTime), "xsd:dateTime"); _typeToXsdTypeMap.Add(typeof(string), "xsd:string"); foreach (var typeToXsdType in _typeToXsdTypeMap) { _xsdTypeToTypeMap.Add(typeToXsdType.Value, typeToXsdType.Key); } } public static string SerializeObject( this IXmlSerializerInternal serializer, object instance, Encoding encoding, Formatting formatting, ISerializeOptions options) { options = options.WithNewSerializationState(); var sb = new StringBuilder(); using (var stringWriter = new StringWriterWithEncoding(sb, encoding ?? Encoding.UTF8)) { using (var xmlWriter = new XSerializerXmlTextWriter(stringWriter, options)) { xmlWriter.Formatting = formatting; serializer.SerializeObject(xmlWriter, instance, options); } } return sb.ToString(); } public static void SerializeObject( this IXmlSerializerInternal serializer, Stream stream, object instance, Encoding encoding, Formatting formatting, ISerializeOptions options) { options = options.WithNewSerializationState(); StreamWriter streamWriter = null; try { streamWriter = new StreamWriter(stream, encoding ?? Encoding.UTF8); var xmlWriter = new XSerializerXmlTextWriter(streamWriter, options) { Formatting = formatting }; serializer.SerializeObject(xmlWriter, instance, options); xmlWriter.Flush(); } finally { if (streamWriter != null) { streamWriter.Flush(); } } } public static void SerializeObject( this IXmlSerializerInternal serializer, TextWriter writer, object instance, Formatting formatting, ISerializeOptions options) { options = options.WithNewSerializationState(); var xmlWriter = new XSerializerXmlTextWriter(writer, options) { Formatting = formatting }; serializer.SerializeObject(xmlWriter, instance, options); xmlWriter.Flush(); } public static object DeserializeObject(this IXmlSerializerInternal serializer, string xml, ISerializeOptions options) { options = options.WithNewSerializationState(); using (var stringReader = new StringReader(xml)) { using (var xmlReader = new XmlTextReader(stringReader)) { using (var reader = new XSerializerXmlReader(xmlReader, options.GetEncryptionMechanism(), options.EncryptKey, options.SerializationState)) { return serializer.DeserializeObject(reader, options); } } } } public static object DeserializeObject(this IXmlSerializerInternal serializer, Stream stream, ISerializeOptions options) { options = options.WithNewSerializationState(); var xmlReader = new XmlTextReader(stream); var reader = new XSerializerXmlReader(xmlReader, options.GetEncryptionMechanism(), options.EncryptKey, options.SerializationState); return serializer.DeserializeObject(reader, options); } public static object DeserializeObject(this IXmlSerializerInternal serializer, TextReader textReader, ISerializeOptions options) { options = options.WithNewSerializationState(); var xmlReader = new XmlTextReader(textReader); var reader = new XSerializerXmlReader(xmlReader, options.GetEncryptionMechanism(), options.EncryptKey, options.SerializationState); return serializer.DeserializeObject(reader, options); } private static ISerializeOptions WithNewSerializationState(this ISerializeOptions serializeOptions) { return new SerializeOptions { EncryptionMechanism = serializeOptions.EncryptionMechanism, EncryptKey = serializeOptions.EncryptKey, Namespaces = serializeOptions.Namespaces, SerializationState = new SerializationState(), ShouldAlwaysEmitTypes = serializeOptions.ShouldAlwaysEmitTypes, ShouldEmitNil = serializeOptions.ShouldEmitNil, ShouldEncrypt = serializeOptions.ShouldEncrypt, ShouldRedact = serializeOptions.ShouldRedact, ShouldIgnoreCaseForEnum = serializeOptions.ShouldIgnoreCaseForEnum, ShouldSerializeCharAsInt = serializeOptions.ShouldSerializeCharAsInt }; } private class SerializeOptions : ISerializeOptions { public XmlSerializerNamespaces Namespaces { get; set; } public bool ShouldAlwaysEmitTypes { get; set; } public bool ShouldRedact { get; set; } public bool ShouldEncrypt { get; set; } public bool ShouldEmitNil { get; set; } public IEncryptionMechanism EncryptionMechanism { get; set; } public object EncryptKey { get; set; } public SerializationState SerializationState { get; set; } public bool ShouldIgnoreCaseForEnum { get; set; } public bool ShouldSerializeCharAsInt { get; set; } } /// <summary> /// Maybe sets the <see cref="XSerializerXmlTextWriter.IsEncryptionEnabled"/> property of /// <paramref name="writer"/> to true. Returns true if the value was changed to true, false /// if it was not changed to true. /// </summary> internal static bool MaybeSetIsEncryptionEnabledToTrue(this XSerializerXmlTextWriter writer, EncryptAttribute encryptAttribute, ISerializeOptions options) { if (options.ShouldEncrypt && encryptAttribute != null && !writer.IsEncryptionEnabled) { writer.IsEncryptionEnabled = true; return true; } return false; } /// <summary> /// Maybe sets the <see cref="XSerializerXmlTextWriter.IsEncryptionEnabled"/> property of /// <paramref name="reader"/> to true. Returns true if the value was changed to true, false /// if it was not changed to true. /// </summary> internal static bool MaybeSetIsDecryptionEnabledToTrue(this XSerializerXmlReader reader, EncryptAttribute encryptAttribute, ISerializeOptions options) { if (options.ShouldEncrypt && encryptAttribute != null && !reader.IsDecryptionEnabled) { reader.IsDecryptionEnabled = true; return true; } return false; } internal static bool HasDefaultConstructor(this Type type) { return type.GetConstructor(Type.EmptyTypes) != null; } public static bool IsSerializable(this PropertyInfo property, IEnumerable<ParameterInfo> constructorParameters) { if (property.DeclaringType.IsAnonymous()) { return true; } if (Attribute.IsDefined(property, typeof(XmlIgnoreAttribute))) { return false; } var isSerializable = property.GetIndexParameters().Length == 0 && (property.IsReadWriteProperty() || property.IsSerializableReadOnlyProperty(constructorParameters)); return isSerializable; } public static bool IsJsonSerializable(this PropertyInfo property, IEnumerable<ParameterInfo> constructorParameters) { if (property.DeclaringType.IsAnonymous()) { return true; } if (Attribute.IsDefined(property, typeof(JsonIgnoreAttribute)) || Attribute.GetCustomAttributes(property).Any(attribute => attribute.GetType().FullName == "Newtonsoft.Json.JsonIgnoreAttribute")) { return false; } var isSerializable = property.GetIndexParameters().Length == 0 && (property.IsReadWriteProperty() || property.IsJsonSerializableReadOnlyProperty(constructorParameters)); return isSerializable; } internal static string GetName(this PropertyInfo property) { var jsonPropertyAttribute = (JsonPropertyAttribute)Attribute.GetCustomAttribute(property, typeof(JsonPropertyAttribute)); if (jsonPropertyAttribute != null && !string.IsNullOrEmpty(jsonPropertyAttribute.Name)) { return jsonPropertyAttribute.Name; } var newtonsoftJsonPropertyAttribute = Attribute.GetCustomAttributes(property).FirstOrDefault(attribute => attribute.GetType().FullName == "Newtonsoft.Json.JsonPropertyAttribute"); if (newtonsoftJsonPropertyAttribute != null) { var propertyNameProperty = newtonsoftJsonPropertyAttribute.GetType().GetProperty("PropertyName"); if (propertyNameProperty != null && propertyNameProperty.PropertyType == typeof(string)) { var propertyName = (string)propertyNameProperty.GetValue(newtonsoftJsonPropertyAttribute, new object[0]); if (!string.IsNullOrEmpty(propertyName)) { return propertyName; } } } return property.Name; } internal static bool IsReadWriteProperty(this PropertyInfo property) { var isReadWriteProperty = property.HasPublicGetter() && property.HasPublicSetter(); return isReadWriteProperty; } internal static bool IsSerializableReadOnlyProperty(this PropertyInfo property, IEnumerable<ParameterInfo> constructorParameters = null) { return property.IsReadOnlyProperty() && !IsConditionalProperty(property, constructorParameters) && ( ((constructorParameters ?? Enumerable.Empty<ParameterInfo>()).Any(p => p.Name.ToLower() == property.Name.ToLower() && p.ParameterType == property.PropertyType)) || (property.PropertyType.IsAnyKindOfDictionary() && property.PropertyType != typeof(ExpandoObject)) || (property.PropertyType.IsAssignableToGenericIEnumerable() && property.PropertyType.HasAddMethodOfType(property.PropertyType.GetGenericIEnumerableType().GetGenericArguments()[0])) || (property.PropertyType.IsAssignableToNonGenericIEnumerable() && property.PropertyType.HasAddMethod()) || (property.PropertyType.IsReadOnlyCollection()) || (property.PropertyType.IsArray && property.PropertyType.GetArrayRank() == 1) || (property.PropertyType.IsReadOnlyDictionary()) ); // TODO: add additional serializable types? } internal static bool IsJsonSerializableReadOnlyProperty(this PropertyInfo propertyInfo, IEnumerable<ParameterInfo> constructorParameters = null) { if (!propertyInfo.IsReadOnlyProperty()) { return false; } if (constructorParameters != null && constructorParameters.Any(p => string.Equals(p.Name, propertyInfo.Name, StringComparison.OrdinalIgnoreCase))) { return true; } if (typeof(IDictionary).IsAssignableFrom(propertyInfo.PropertyType) || propertyInfo.PropertyType.IsAssignableToGenericIDictionary()) { return true; } if (propertyInfo.PropertyType.IsArray) { return false; } if (typeof(IList).IsAssignableFrom(propertyInfo.PropertyType) || propertyInfo.PropertyType.IsAssignableToGenericICollection()) { return true; } return false; } internal static object ConvertIfNecessary(this object instance, Type targetType) { if (instance == null) { return null; } var instanceType = instance.GetType(); if (targetType.IsAssignableFrom(instanceType)) { return instance; } var convertFunc = _convertFuncs.GetOrAdd( Tuple.Create(instanceType, targetType), tuple => CreateConvertFunc(tuple.Item1, tuple.Item2)); return convertFunc(instance); } private static Func<object, object> CreateConvertFunc(Type instanceType, Type targetType) { if (instanceType.IsGenericType && instanceType.GetGenericTypeDefinition() == typeof(List<>)) { if (targetType.IsArray) { return CreateToArrayFunc(targetType.GetElementType()); } if (targetType.IsReadOnlyCollection()) { var collectionType = targetType.GetReadOnlyCollectionType(); return CreateAsReadOnlyFunc(collectionType.GetGenericArguments()[0]); } } // Oh well, we were gonna throw anyway. Just let it happen... return x => x; } private static Func<object, object> CreateToArrayFunc(Type itemType) { var toArrayMethod = typeof(Enumerable) .GetMethod("ToArray", BindingFlags.Static | BindingFlags.Public) .MakeGenericMethod(itemType); var sourceParameter = Expression.Parameter(typeof(object), "source"); var lambda = Expression.Lambda<Func<object, object>>( Expression.Call( toArrayMethod, Expression.Convert(sourceParameter, typeof(IEnumerable<>).MakeGenericType(itemType))), sourceParameter); return lambda.Compile(); } private static Func<object, object> CreateAsReadOnlyFunc(Type itemType) { var listType = typeof (List<>).MakeGenericType(itemType); var asReadOnlyMethod = listType.GetMethod("AsReadOnly", BindingFlags.Instance | BindingFlags.Public); var instanceParameter = Expression.Parameter(typeof(object), "instance"); var lambda = Expression.Lambda<Func<object, object>>( Expression.Call( Expression.Convert(instanceParameter, listType), asReadOnlyMethod), instanceParameter); return lambda.Compile(); } internal static bool IsReadOnlyCollection(this Type type) { var openGenerics = GetOpenGenerics(type); foreach (var openGeneric in openGenerics) { if (openGeneric == typeof(ReadOnlyCollection<>)) { return true; } switch (openGeneric.AssemblyQualifiedName) { case IReadOnlyCollection: case IReadOnlyList: return true; } } return false; } internal static Type GetReadOnlyCollectionType(this Type type) { if (IsReadOnlyCollectionType(type)) { return type; } var interfaceType = type.GetInterfaces().FirstOrDefault(IsReadOnlyCollectionType); if (interfaceType != null) { return interfaceType; } do { type = type.BaseType; if (type == null) { return null; } if (IsReadOnlyCollectionType(type)) { return type; } } while (true); } private static bool IsReadOnlyCollectionType(Type i) { if (i.IsGenericType) { var genericTypeDefinition = i.GetGenericTypeDefinition(); if (_readOnlyCollections.Any(readOnlyCollectionType => genericTypeDefinition == readOnlyCollectionType)) { return true; } } return false; } internal static bool IsReadOnlyDictionary(this Type type) { var openGenerics = GetOpenGenerics(type); foreach (var openGeneric in openGenerics) { switch (openGeneric.AssemblyQualifiedName) { case IReadOnlyDictionary: case ReadOnlyDictionary: return true; } } return false; } internal static Type GetIReadOnlyDictionaryInterface(this Type type) { var iReadOnlyDictionaryType = Type.GetType(IReadOnlyDictionary); if (type.IsGenericType && type.GetGenericTypeDefinition() == iReadOnlyDictionaryType) { return type; } return type.GetInterfaces() .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == iReadOnlyDictionaryType); } private static IEnumerable<Type> GetOpenGenerics(Type type) { if (type.IsGenericType) { yield return type.GetGenericTypeDefinition(); } foreach (var interfaceType in type.GetInterfaces()) { if (interfaceType.IsGenericType) { yield return interfaceType; } } while (true) { type = type.BaseType; if (type == null) { yield break; } if (type.IsGenericType) { yield return type.GetGenericTypeDefinition(); } } } private static bool IsConditionalProperty(PropertyInfo property, IEnumerable<ParameterInfo> constructorParameters) { if (property.Name.EndsWith("Specified")) { var otherPropertyName = property.Name.Substring(0, property.Name.LastIndexOf("Specified")); return property.DeclaringType.GetProperties().Any(p => p.Name == otherPropertyName); } return false; } internal static bool HasAddMethodOfType(this Type type, Type addMethodType) { return type.GetMethod("Add", new[] { addMethodType }) != null; } internal static bool HasAddMethod(this Type type) { return type.GetMethods().Any(m => m.Name == "Add" && m.GetParameters().Length == 1); } internal static bool IsAnyKindOfDictionary(this Type type) { return type.IsAssignableToNonGenericIDictionary() || type.IsAssignableToGenericIDictionary(); } internal static bool IsReadOnlyProperty(this PropertyInfo property) { var canCallGetter = property.HasPublicGetter(); var canCallSetter = property.HasPublicSetter(); return canCallGetter && !canCallSetter; } internal static bool IsAssignableToNonGenericIDictionary(this Type type) { var isAssignableToIDictionary = typeof(IDictionary).IsAssignableFrom(type); return isAssignableToIDictionary; } internal static bool IsGenericIDictionary(this Type type) { return type.IsInterface && type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IDictionary<,>); } internal static bool IsAssignableToGenericIDictionary(this Type type) { var isAssignableToGenericIDictionary = (type.IsInterface && type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IDictionary<,>)) || type.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IDictionary<,>)); return isAssignableToGenericIDictionary; } internal static bool IsAssignableToGenericIDictionaryWithKeyOrValueOfTypeObject(this Type type) { var isAssignableToGenericIDictionary = type.IsAssignableToGenericIDictionary(); if (!isAssignableToGenericIDictionary) { return false; } Type iDictionaryType; if (type.IsInterface && type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IDictionary<,>)) { iDictionaryType = type; } else { iDictionaryType = type.GetInterfaces().Single(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IDictionary<,>)); } return iDictionaryType.GetGenericArguments()[0] == typeof(object) || iDictionaryType.GetGenericArguments()[1] == typeof(object); } internal static bool IsAssignableToGenericIDictionaryOfStringToAnything(this Type type) { if (type.IsAssignableToGenericIDictionary()) { var dictionaryType = type.GetGenericIDictionaryType(); var args = dictionaryType.GetGenericArguments(); return args[0] == typeof(string); } return false; } internal static bool IsAssignableToNonGenericIEnumerable(this Type type) { var isAssignableToIEnumerable = typeof(IEnumerable).IsAssignableFrom(type); return isAssignableToIEnumerable; } internal static bool IsGenericIEnumerable(this Type type) { return type.IsInterface && type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IEnumerable<>); } internal static bool IsAssignableToGenericIEnumerable(this Type type) { var isAssignableToGenericIEnumerable = type.IsGenericIEnumerable() || type.GetInterfaces().Any(i => i.IsGenericIEnumerable()); return isAssignableToGenericIEnumerable; } internal static bool IsAssignableToGenericIEnumerableOfTypeObject(this Type type) { var isAssignableToGenericIEnumerable = type.IsAssignableToGenericIEnumerable(); if (!isAssignableToGenericIEnumerable) { return false; } var iEnumerableType = type.IsGenericIEnumerable() ? type : type.GetInterfaces().Single(i => i.IsGenericIEnumerable()); return iEnumerableType.GetGenericArguments()[0] == typeof(object); } internal static bool IsGenericICollection(this Type type) { return type.IsInterface && type.IsGenericType && type.GetGenericTypeDefinition() == typeof(ICollection<>); } internal static bool IsAssignableToGenericICollection(this Type type) { var isAssignableToGenericICollection = type.IsGenericICollection() || type.GetInterfaces().Any(i => i.IsGenericICollection()); return isAssignableToGenericICollection; } internal static Type GetGenericIDictionaryType(this Type type) { if (type.IsInterface && type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IDictionary<,>)) { return type; } return type.GetInterfaces().First(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IDictionary<,>)); } internal static Type GetGenericIEnumerableType(this Type type) { if (type.IsGenericIEnumerable()) { return type; } return type.GetInterfaces().First(i => i.IsGenericIEnumerable()); } internal static Type GetGenericICollectionType(this Type type) { if (type.IsGenericICollection()) { return type; } return type.GetInterfaces().First(i => i.IsGenericICollection()); } private static bool HasPublicGetter(this PropertyInfo property) { if (!property.CanRead) { return false; } var getMethod = property.GetGetMethod(); return getMethod != null && getMethod.IsPublic; } private static bool HasPublicSetter(this PropertyInfo property) { if (!property.CanWrite) { return false; } var setMethod = property.GetSetMethod(); return setMethod != null && setMethod.IsPublic; } internal static bool ReadIfNeeded(this XSerializerXmlReader reader, bool shouldRead) { if (shouldRead) { return reader.Read(); } return true; } internal static bool IsNil(this XSerializerXmlReader reader) { var nilFound = false; while (reader.MoveToNextAttribute()) { if (reader.LocalName == "nil" && reader.NamespaceURI == "http://www.w3.org/2001/XMLSchema-instance") { nilFound = true; break; } } reader.MoveToElement(); return nilFound; } internal static void WriteNilAttribute(this XmlWriter writer) { writer.WriteAttributeString("xsi", "nil", null, "true"); } internal static bool IsPrimitiveLike(this Type type) { return type.IsPrimitive || type.IsEnum || type == typeof(string) || type == typeof(decimal) || type == typeof(DateTime) || type == typeof(Guid) || type == typeof(TimeSpan) || type == typeof(DateTimeOffset); } internal static bool IsNullablePrimitiveLike(this Type type) { return type.IsNullableType() && type.GetGenericArguments()[0].IsPrimitiveLike(); } internal static bool IsNullableType(this Type type) { return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>); } internal static bool IsReferenceType(this Type type) { return !type.IsValueType; } internal static object GetUninitializedObject(this Type type) { return FormatterServices.GetUninitializedObject(type); } public static bool IsAnonymous(this object instance) { if (instance == null) { return false; } return instance.GetType().IsAnonymous(); } public static bool IsAnonymous(this Type type) { return type.Namespace == null && type.IsClass && type.IsNotPublic && type.IsSealed && type.DeclaringType == null && type.BaseType == typeof(object) && (type.Name.StartsWith("<>", StringComparison.OrdinalIgnoreCase) || type.Name.StartsWith("VB$", StringComparison.OrdinalIgnoreCase)) && type.Name.Contains("AnonymousType") && Attribute.IsDefined(type, typeof(CompilerGeneratedAttribute)); } public static string GetElementName(this Type type) { if (type.IsGenericType) { return type.Name.Substring(0, type.Name.IndexOf("`")) + "Of" + string.Join("_", type.GetGenericArguments().Select(x => x.GetElementName())); } if (type.IsArray) { return "ArrayOf" + type.GetElementType().Name; } return type.Name; } public static string GetXsdType(this Type type) { string xsdType; if (_typeToXsdTypeMap.TryGetValue(type, out xsdType)) { return xsdType; } return type.Name; } public static Type GetXsdType<T>(this XSerializerXmlReader reader, Type[] extraTypes) { string typeName = null; while (reader.MoveToNextAttribute()) { if (reader.LocalName == "type" && reader.LookupNamespace(reader.Prefix) == "http://www.w3.org/2001/XMLSchema-instance") { typeName = reader.Value; break; } } reader.MoveToElement(); if (typeName == null) { return null; } Type typeFromXsdType; if (_xsdTypeToTypeMap.TryGetValue(typeName, out typeFromXsdType)) { return typeFromXsdType; } return _xsdTypeToTypeCache.GetOrAdd( CreateTypeCacheKey<T>(typeName), _ => { Type type = null; //// try REAL hard to get the type. (holy crap, this is UUUUUGLY!!!!) if (extraTypes != null) { var matchingExtraTypes = extraTypes.Where(t => t.Name == typeName && typeof(T).IsAssignableFrom(t)).ToList(); if (matchingExtraTypes.Count == 1) { type = matchingExtraTypes[0]; } } if (type == null) { var typeNameWithPossibleNamespace = typeName; if (!typeName.Contains('.')) { typeNameWithPossibleNamespace = typeof(T).Namespace + "." + typeName; } var checkPossibleNamespace = typeName != typeNameWithPossibleNamespace; type = Type.GetType(typeName); type = typeof(T).IsAssignableFrom(type) ? type : null; if (type == null) { type = checkPossibleNamespace ? Type.GetType(typeNameWithPossibleNamespace) : null; type = typeof(T).IsAssignableFrom(type) ? type : null; if (type == null) { type = typeof(T).Assembly.GetType(typeName); type = typeof(T).IsAssignableFrom(type) ? type : null; if (type == null) { type = checkPossibleNamespace ? typeof(T).Assembly.GetType(typeNameWithPossibleNamespace) : null; type = typeof(T).IsAssignableFrom(type) ? type : null; if (type == null) { var matches = typeof(T).Assembly.GetTypes().Where(t => t.Name == typeName && typeof(T).IsAssignableFrom(t)).ToList(); if (matches.Count == 1) { type = matches.Single(); } var entryAssembly = Assembly.GetEntryAssembly(); if (entryAssembly != null) { type = entryAssembly.GetType(typeName); type = typeof(T).IsAssignableFrom(type) ? type : null; if (type == null) { type = checkPossibleNamespace ? entryAssembly.GetType(typeNameWithPossibleNamespace) : null; type = typeof(T).IsAssignableFrom(type) ? type : null; } if (type == null) { matches = entryAssembly.GetTypes().Where(t => t.Name == typeName && typeof(T).IsAssignableFrom(t)).ToList(); if (matches.Count == 1) { type = matches.Single(); } } } if (type == null) { matches = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => { try { return a.GetTypes(); } catch { return Enumerable.Empty<Type>(); } }).Where(t => t.Name == typeName && typeof(T).IsAssignableFrom(t)).ToList(); if (matches.Count == 1) { type = matches.Single(); } else if (matches.Count > 1) { throw new SerializationException(string.Format("More than one type matches '{0}'. Consider decorating your type with the XmlIncludeAttribute, or pass in the type into the serializer as an extra type.", typeName)); } } } } } } } if (type == null) { throw new SerializationException(string.Format("No suitable type matches '{0}'. Consider decorating your type with the XmlIncludeAttribute, or pass in the type into the serializer as an extra type.", typeName)); } return type; }); } private static int CreateTypeCacheKey<T>(string typeName) { unchecked { var key = typeof(T).GetHashCode(); key = (key * 397) ^ typeName.GetHashCode(); return key; } } } }
rlyczynski/XSerializer
XSerializer/SerializationExtensions.cs
C#
mit
39,564
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 6407, 1025, 2478, 2291, 1012, 6407, 1012, 16483, 1025, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 2291, 1012, 6407, 1012, 4874, 5302, 9247, 1025, 2478, 2291, 1012, 8790, 1025, 2478, 2291, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Google Fonts to use. See the following page for more fonts: http://cssdeck.com/labs/cool-and-professional-google-web-fonts-for-use */ @import url(//fonts.googleapis.com/css?family=Ubuntu); @import url(//fonts.googleapis.com/css?family=Advent+Pro); html { min-height: 100%; position: relative; } body { /*padding-bottom: 60px;*/ /* This is the same as the sky in background 4, to make the mobile display look better. */ background-color: #376BD0; background-image: url('../img/background4.jpg'); background-position: center; background-repeat: no-repeat; margin: 0px; padding: 0px; height: 100%; width: 100%; font-family: "Advent Pro", Times, sans-serif; } body > .container { padding: 65px 10px 0; } body > .row { margin: 10px; } .easy_text { color: white; text-align: center; background-color:black; z-index:0; opacity:0.5; } /* About / Header name */ .about { color: white; text-align: center; } a:link { } h1.name { color: white; text-align: center; font-family: "Ubuntu"; font-size: 750%; } .black { background-color: black; } object { width: 100%; height: 100%; border: 0; } /* Center text with no background. */ .center_text_nohighlight { color: black; text-align: center; font-size: 200%; } /* Center text */ .center_text { color: white; text-align: center; font-family: "Advent Pro"; font-weight:900; font-size: 200%; } .center_text_small { color: white; text-align: center; font-family: "Advent Pro"; font-weight:900; font-size: 120%; } /* Highlight just the text. */ .highlight { background-color: black; } /* Left align text */ .left_align { color: black; text-align: left; font-family: "Advent Pro"; font-size: 150%; } .content { width: 70%; margin: 0px auto; padding: 0px; border: 0px; background-color: transparent; } .embed-container { height: 0; width: 100%; padding-bottom: 130%; /* play with this until right */ overflow: hidden; position: relative; } .embed-container iframe { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
JasonD94/Website
css/index.css
CSS
mit
2,122
[ 30522, 1013, 1008, 8224, 15489, 2015, 2000, 2224, 1012, 2156, 1996, 2206, 3931, 2005, 2062, 15489, 2015, 1024, 8299, 1024, 1013, 1013, 20116, 16150, 11012, 1012, 4012, 1013, 13625, 1013, 4658, 1011, 1998, 1011, 2658, 1011, 8224, 1011, 4773,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Table of relaxations for Xtensa assembly. Copyright 2003, 2004 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. GAS 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. GAS 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 GAS; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef XTENSA_RELAX_H #define XTENSA_RELAX_H #include "xtensa-isa.h" /* Data structures for the table-driven relaxations for Xtensa processors. See xtensa-relax.c for details. */ typedef struct transition_list TransitionList; typedef struct transition_table TransitionTable; typedef struct transition_rule TransitionRule; typedef struct precondition_list PreconditionList; typedef struct precondition Precondition; typedef struct req_or_option_list ReqOrOptionList; typedef struct req_or_option_list ReqOrOption; typedef struct req_option_list ReqOptionList; typedef struct req_option_list ReqOption; struct transition_table { int num_opcodes; TransitionList **table; /* Possible transitions for each opcode. */ }; struct transition_list { TransitionRule *rule; TransitionList *next; }; struct precondition_list { Precondition *precond; PreconditionList *next; }; /* The required options for a rule are represented with a two-level structure, with leaf expressions combined by logical ORs at the lower level, and the results then combined by logical ANDs at the top level. The AND terms are linked in a list, and each one can contain a reference to a list of OR terms. The leaf expressions, i.e., the OR options, can be negated by setting the is_true field to FALSE. There are two classes of leaf expressions: (1) those that are properties of the Xtensa configuration and can be evaluated once when building the tables, and (2) those that depend of the state of directives or other settings that may vary during the assembly. The following expressions may be used in group (1): IsaUse*: Xtensa configuration settings. realnop: TRUE if the instruction set includes a NOP instruction. There are currently no expressions in group (2), but they are still supported since there is a good chance they'll be needed again for something. */ struct req_option_list { ReqOrOptionList *or_option_terms; ReqOptionList *next; }; struct req_or_option_list { char *option_name; bfd_boolean is_true; ReqOrOptionList *next; }; /* Operand types and constraints on operands: */ typedef enum op_type OpType; typedef enum cmp_op CmpOp; enum op_type { OP_CONSTANT, OP_OPERAND, OP_OPERAND_LOW8, /* Sign-extended low 8 bits of immed. */ OP_OPERAND_HI24S, /* High 24 bits of immed, plus 0x100 if low 8 bits are signed. */ OP_OPERAND_F32MINUS, /* 32 - immed. */ OP_OPERAND_LOW16U, /* Low 16 bits of immed. */ OP_OPERAND_HI16U, /* High 16 bits of immed. */ OP_LITERAL, OP_LABEL }; enum cmp_op { OP_EQUAL, OP_NOTEQUAL, }; struct precondition { CmpOp cmp; int op_num; OpType typ; /* CONSTANT: op_data is a constant. OPERAND: operand op_num must equal op_data. Cannot be LITERAL or LABEL. */ int op_data; }; typedef struct build_op BuildOp; struct build_op { int op_num; OpType typ; unsigned op_data; /* CONSTANT: op_data is the value to encode. OPERAND: op_data is the field in the source instruction to take the value from and encode in the op_num field here. LITERAL or LABEL: op_data is the ordinal that identifies the appropriate one, i.e., there can be more than one literal or label in an expansion. */ BuildOp *next; }; typedef struct build_instr BuildInstr; typedef enum instr_type InstrType; enum instr_type { INSTR_INSTR, INSTR_LITERAL_DEF, INSTR_LABEL_DEF }; struct build_instr { InstrType typ; unsigned id; /* LITERAL_DEF or LABEL_DEF: an ordinal to identify which one. */ xtensa_opcode opcode; /* Unused for LITERAL_DEF or LABEL_DEF. */ BuildOp *ops; BuildInstr *next; }; struct transition_rule { xtensa_opcode opcode; PreconditionList *conditions; ReqOptionList *options; BuildInstr *to_instr; }; typedef int (*transition_cmp_fn) (const TransitionRule *, const TransitionRule *); extern TransitionTable *xg_build_simplify_table (transition_cmp_fn); extern TransitionTable *xg_build_widen_table (transition_cmp_fn); extern bfd_boolean xg_has_userdef_op_fn (OpType); extern long xg_apply_userdef_op_fn (OpType, long); #endif /* !XTENSA_RELAX_H */
guoqingzhang/binutils-coffee
gas/config/xtensa-relax.h
C
gpl-2.0
5,051
[ 30522, 1013, 1008, 2795, 1997, 23370, 2015, 2005, 1060, 25808, 2050, 3320, 1012, 9385, 2494, 1010, 2432, 2489, 4007, 30524, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 2009, 2104, 1996, 3408, 1997, 1996, 27004, 2236, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Easy Template Finder ==================== An ExpressionEngine plugin that finds the template used by a given entry. API --- This plugin is most useful for dynamically embedding entries. Here’s an example using a Playa field to control sidebars (stored in the `sidebars` custom field): {exp:channel:entries disable="categories|category_fields|member_data|pagination|trackbacks" } {sidebars} {embed="{exp:easy_template_finder entry_id='{entry_id}'}" entry_id="{entry_id}" } {/sidebars} {/exp:channel:entries} The plugin only takes a single argument, the `entry_id`, and it returns the template path for embedding.
easy-designs/easy_template_finder.ee_addon
README.md
Markdown
mit
640
[ 30522, 3733, 23561, 2424, 2121, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 2019, 3670, 13159, 3170, 13354, 2378, 2008, 4858, 1996, 23561, 2109, 2011, 1037, 2445, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#Copyright ReportLab Europe Ltd. 2000-2012 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/__init__.py __version__=''' $Id$ ''' __doc__="""The Reportlab PDF generation library.""" Version = "2.7" import sys if sys.version_info[0:2] < (2, 7): warning = """The trunk of reportlab currently requires Python 2.7 or higher. This is being done to let us move forwards with 2.7/3.x compatibility with the minimum of baggage. ReportLab 2.7 was the last packaged version to suppo0rt Python 2.5 and 2.6. Python 2.3 users may still use ReportLab 2.4 or any other bugfixes derived from it, and Python 2.4 users may use ReportLab 2.5. Python 2.2 and below need to use released versions beginning with 1.x (e.g. 1.21), or snapshots or checkouts from our 'version1' branch. Our current plan is to remove Python 2.5 compatibility on our next release, allowing us to use the 2to3 tool and work on Python 3.0 compatibility. If you have a choice, Python 2.7.x is best long term version to use. """ raise ImportError("reportlab needs Python 2.5 or higher", warning) def getStory(context): "This is a helper for our old autogenerated documentation system" if context.target == 'UserGuide': # parse some local file import os myDir = os.path.split(__file__)[0] import yaml return yaml.parseFile(myDir + os.sep + 'mydocs.yaml') else: # this signals that it should revert to default processing return None def getMonitor(): import reportlab.monitor mon = reportlab.monitor.ReportLabToolkitMonitor() return mon
TaskEvolution/Task-Coach-Evolution
taskcoach/taskcoachlib/thirdparty/src/reportlab/__init__.py
Python
gpl-3.0
1,715
[ 30522, 1001, 9385, 3189, 20470, 2885, 5183, 1012, 2456, 1011, 2262, 1001, 2156, 6105, 1012, 19067, 2102, 2005, 6105, 4751, 1001, 2381, 8299, 1024, 1013, 1013, 7479, 1012, 3189, 20470, 1012, 2522, 1012, 2866, 1013, 1039, 5856, 1011, 8026, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<div class="palm-row BT-row" x-mojo-tap-highlight="persistent"> <div class="palm-row-wrapper BT-row-wrapper"> <div class="rt">#{rt}</div> <div class="rtnm truncating-text">#{rtnm}</div> <div x-mojo-element="Spinner" name="route-spinner"></div> </div> </div>
ifeanyi/webos-chi-bustracker
app/views/routes/route-list-item-tpl.html
HTML
apache-2.0
276
[ 30522, 1026, 4487, 2615, 2465, 1027, 1000, 5340, 1011, 5216, 18411, 1011, 5216, 1000, 1060, 1011, 28017, 1011, 11112, 1011, 12944, 1027, 1000, 14516, 1000, 1028, 1026, 4487, 2615, 2465, 1027, 1000, 5340, 1011, 5216, 1011, 10236, 4842, 18411...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="description" content="Description"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css"> </head> <body> <div id="app"></div> <script> window.$docsify = { alias: { '/.*/_navbar.md': '/_navbar.md' }, name: 'GoBatis', repo: 'runner-mei/GoBatis', auto2top: true, coverpage: true, executeScript: true, loadSidebar: true, loadNavbar: true, mergeNavbar: true, maxLevel: 4, subMaxLevel: 2, search: 'auto', // 默认值 search : [ '/', // => /README.md '/zh-cn/', // => /zh-cn/README.md ], // 完整配置参数 search: { maxAge: 86400000, // 过期时间,单位毫秒,默认一天 paths: [], // or 'auto' placeholder: 'Type to search', // 支持本地化 placeholder: { '/zh-cn/': '搜索', '/': 'Type to search' }, noData: 'No Results!', // 支持本地化 noData: { '/zh-cn/': '找不到内容', '/': 'No Results' }, // 搜索标题的最大程级, 1 - 6 depth: 2 }, formatUpdated: '{MM}/{DD} {HH}:{mm}', plugins: [ function (hook, vm) { hook.beforeEach(function (html) { //var url = 'https://github.com/QingWei-Li/docsify/blob/master/docs/' + vm.route.file //var editHtml = '[:memo: Edit Document](' + url + ')\n' var editHtml = '' return editHtml + html + '\n\n----\n\n' + '<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>' }) } ] } </script> <script src="//unpkg.com/docsify/lib/docsify.min.js"></script> <script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script> <script src="//unpkg.com/prismjs/components/prism-go.min.js"></script> <script src="//unpkg.com/docsify/lib/plugins/search.js"></script> <script src="//unpkg.com/docsify/lib/plugins/emoji.js"></script> </body> </html>
arstd/gobatis
docs/index.html
HTML
mit
2,476
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 2516, 1028, 6254, 1026, 1013, 2516, 1028, 1026...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.outr.arango.api.model import io.circe.Json case class CollectionFiguresAlive(count: Option[Long] = None, size: Option[Long] = None)
outr/arangodb-scala
api/src/main/scala/com/outr/arango/api/model/CollectionFiguresAlive.scala
Scala
mit
180
[ 30522, 7427, 4012, 1012, 2041, 2099, 1012, 19027, 16656, 1012, 17928, 1012, 2944, 12324, 22834, 1012, 25022, 19170, 1012, 1046, 3385, 2553, 2465, 3074, 8873, 27390, 22447, 3669, 3726, 1006, 4175, 1024, 5724, 1031, 2146, 1033, 1027, 3904, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #if !defined(__APPLE__) && !defined(__NetBSD__) #include <pthread.h> # include <pthread_np.h> /* For pthread_attr_get_np */ #endif // no precompiled headers #include "assembler_zero.inline.hpp" #include "classfile/classLoader.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" #include "jvm_bsd.h" #include "memory/allocation.inline.hpp" #include "mutex_bsd.inline.hpp" #include "nativeInst_zero.hpp" #include "os_share_bsd.hpp" #include "prims/jniFastGetField.hpp" #include "prims/jvm.h" #include "prims/jvm_misc.hpp" #include "runtime/arguments.hpp" #include "runtime/extendedPC.hpp" #include "runtime/frame.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/java.hpp" #include "runtime/javaCalls.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/osThread.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" address os::current_stack_pointer() { address dummy = (address) &dummy; return dummy; } frame os::get_sender_for_C_frame(frame* fr) { ShouldNotCallThis(); } frame os::current_frame() { // The only thing that calls this is the stack printing code in // VMError::report: // - Step 110 (printing stack bounds) uses the sp in the frame // to determine the amount of free space on the stack. We // set the sp to a close approximation of the real value in // order to allow this step to complete. // - Step 120 (printing native stack) tries to walk the stack. // The frame we create has a NULL pc, which is ignored as an // invalid frame. frame dummy = frame(); dummy.set_sp((intptr_t *) current_stack_pointer()); return dummy; } char* os::non_memory_address_word() { // Must never look like an address returned by reserve_memory, // even in its subfields (as defined by the CPU immediate fields, // if the CPU splits constants across multiple instructions). #ifdef SPARC // On SPARC, 0 != %hi(any real address), because there is no // allocation in the first 1Kb of the virtual address space. return (char *) 0; #else // This is the value for x86; works pretty well for PPC too. return (char *) -1; #endif // SPARC } void os::initialize_thread(Thread* thr) { // Nothing to do. } address os::Bsd::ucontext_get_pc(ucontext_t* uc) { ShouldNotCallThis(); } ExtendedPC os::fetch_frame_from_context(void* ucVoid, intptr_t** ret_sp, intptr_t** ret_fp) { ShouldNotCallThis(); } frame os::fetch_frame_from_context(void* ucVoid) { ShouldNotCallThis(); } extern "C" JNIEXPORT int JVM_handle_bsd_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrecognized) { ucontext_t* uc = (ucontext_t*) ucVoid; Thread* t = ThreadLocalStorage::get_thread_slow(); SignalHandlerMark shm(t); // Note: it's not uncommon that JNI code uses signal/sigset to // install then restore certain signal handler (e.g. to temporarily // block SIGPIPE, or have a SIGILL handler when detecting CPU // type). When that happens, JVM_handle_bsd_signal() might be // invoked with junk info/ucVoid. To avoid unnecessary crash when // libjsig is not preloaded, try handle signals that do not require // siginfo/ucontext first. if (sig == SIGPIPE || sig == SIGXFSZ) { // allow chained handler to go first if (os::Bsd::chained_handler(sig, info, ucVoid)) { return true; } else { if (PrintMiscellaneous && (WizardMode || Verbose)) { char buf[64]; warning("Ignoring %s - see bugs 4229104 or 646499219", os::exception_name(sig, buf, sizeof(buf))); } return true; } } JavaThread* thread = NULL; VMThread* vmthread = NULL; if (os::Bsd::signal_handlers_are_installed) { if (t != NULL ){ if(t->is_Java_thread()) { thread = (JavaThread*)t; } else if(t->is_VM_thread()){ vmthread = (VMThread *)t; } } } if (info != NULL && thread != NULL) { // Handle ALL stack overflow variations here if (sig == SIGSEGV || sig == SIGBUS) { address addr = (address) info->si_addr; // check if fault address is within thread stack if (addr < thread->stack_base() && addr >= thread->stack_base() - thread->stack_size()) { // stack overflow if (thread->in_stack_yellow_zone(addr)) { thread->disable_stack_yellow_zone(); ShouldNotCallThis(); } else if (thread->in_stack_red_zone(addr)) { thread->disable_stack_red_zone(); ShouldNotCallThis(); } } } /*if (thread->thread_state() == _thread_in_Java) { ShouldNotCallThis(); } else*/ if (thread->thread_state() == _thread_in_vm && sig == SIGBUS && thread->doing_unsafe_access()) { ShouldNotCallThis(); } // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC // kicks in and the heap gets shrunk before the field access. /*if (sig == SIGSEGV || sig == SIGBUS) { address addr = JNI_FastGetField::find_slowcase_pc(pc); if (addr != (address)-1) { stub = addr; } }*/ // Check to see if we caught the safepoint code in the process // of write protecting the memory serialization page. It write // enables the page immediately after protecting it so we can // just return to retry the write. if ((sig == SIGSEGV || sig == SIGBUS) && os::is_memory_serialize_page(thread, (address) info->si_addr)) { // Block current thread until permission is restored. os::block_on_serialize_page_trap(); return true; } } // signal-chaining if (os::Bsd::chained_handler(sig, info, ucVoid)) { return true; } if (!abort_if_unrecognized) { // caller wants another chance, so give it to him return false; } #ifndef PRODUCT if (sig == SIGSEGV) { fatal("\n#" "\n# /--------------------\\" "\n# | segmentation fault |" "\n# \\---\\ /--------------/" "\n# /" "\n# [-] |\\_/| " "\n# (+)=C |o o|__ " "\n# | | =-*-=__\\ " "\n# OOO c_c_(___)"); } #endif // !PRODUCT const char *fmt = "caught unhandled signal " INT32_FORMAT " at address " PTR_FORMAT; char buf[128]; sprintf(buf, fmt, sig, info->si_addr); fatal(buf); } void os::Bsd::init_thread_fpu_state(void) { // Nothing to do } bool os::is_allocatable(size_t bytes) { #ifdef _LP64 return true; #else if (bytes < 2 * G) { return true; } char* addr = reserve_memory(bytes, NULL); if (addr != NULL) { release_memory(addr, bytes); } return addr != NULL; #endif // _LP64 } /////////////////////////////////////////////////////////////////////////////// // thread stack size_t os::Bsd::min_stack_allowed = 64 * K; bool os::Bsd::supports_variable_stack_size() { return true; } size_t os::Bsd::default_stack_size(os::ThreadType thr_type) { #ifdef _LP64 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M); #else size_t s = (thr_type == os::compiler_thread ? 2 * M : 512 * K); #endif // _LP64 return s; } size_t os::Bsd::default_guard_size(os::ThreadType thr_type) { // Only enable glibc guard pages for non-Java threads // (Java threads have HotSpot guard pages) return (thr_type == java_thread ? 0 : page_size()); } static void current_stack_region(address *bottom, size_t *size) { address stack_bottom; address stack_top; size_t stack_bytes; #ifdef __APPLE__ pthread_t self = pthread_self(); stack_top = (address) pthread_get_stackaddr_np(self); stack_bytes = pthread_get_stacksize_np(self); stack_bottom = stack_top - stack_bytes; #elif defined(__OpenBSD__) stack_t ss; int rslt = pthread_stackseg_np(pthread_self(), &ss); if (rslt != 0) fatal(err_msg("pthread_stackseg_np failed with err = " INT32_FORMAT, rslt)); stack_top = (address) ss.ss_sp; stack_bytes = ss.ss_size; stack_bottom = stack_top - stack_bytes; #else pthread_attr_t attr; int rslt = pthread_attr_init(&attr); // JVM needs to know exact stack location, abort if it fails if (rslt != 0) fatal(err_msg("pthread_attr_init failed with err = " INT32_FORMAT, rslt)); rslt = pthread_attr_get_np(pthread_self(), &attr); if (rslt != 0) fatal(err_msg("pthread_attr_get_np failed with err = " INT32_FORMAT, rslt)); if (pthread_attr_getstackaddr(&attr, (void **) &stack_bottom) != 0 || pthread_attr_getstacksize(&attr, &stack_bytes) != 0) { fatal("Can not locate current stack attributes!"); } pthread_attr_destroy(&attr); stack_top = stack_bottom + stack_bytes; #endif assert(os::current_stack_pointer() >= stack_bottom, "should do"); assert(os::current_stack_pointer() < stack_top, "should do"); *bottom = stack_bottom; *size = stack_top - stack_bottom; } address os::current_stack_base() { address bottom; size_t size; current_stack_region(&bottom, &size); return bottom + size; } size_t os::current_stack_size() { // stack size includes normal stack and HotSpot guard pages address bottom; size_t size; current_stack_region(&bottom, &size); return size; } ///////////////////////////////////////////////////////////////////////////// // helper functions for fatal error handler void os::print_context(outputStream* st, void* context) { ShouldNotCallThis(); } void os::print_register_info(outputStream *st, void *context) { ShouldNotCallThis(); } ///////////////////////////////////////////////////////////////////////////// // Stubs for things that would be in bsd_zero.s if it existed. // You probably want to disassemble these monkeys to check they're ok. extern "C" { int SpinPause() { } int SafeFetch32(int *adr, int errValue) { int value = errValue; value = *adr; return value; } intptr_t SafeFetchN(intptr_t *adr, intptr_t errValue) { intptr_t value = errValue; value = *adr; return value; } void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { if (from > to) { jshort *end = from + count; while (from < end) *(to++) = *(from++); } else if (from < to) { jshort *end = from; from += count - 1; to += count - 1; while (from >= end) *(to--) = *(from--); } } void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) { if (from > to) { jint *end = from + count; while (from < end) *(to++) = *(from++); } else if (from < to) { jint *end = from; from += count - 1; to += count - 1; while (from >= end) *(to--) = *(from--); } } void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { if (from > to) { jlong *end = from + count; while (from < end) os::atomic_copy64(from++, to++); } else if (from < to) { jlong *end = from; from += count - 1; to += count - 1; while (from >= end) os::atomic_copy64(from--, to--); } } void _Copy_arrayof_conjoint_bytes(HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count); } void _Copy_arrayof_conjoint_jshorts(HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 2); } void _Copy_arrayof_conjoint_jints(HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 4); } void _Copy_arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) { memmove(to, from, count * 8); } }; ///////////////////////////////////////////////////////////////////////////// // Implementations of atomic operations not supported by processors. // -- http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Atomic-Builtins.html #ifndef _LP64 extern "C" { long long unsigned int __sync_val_compare_and_swap_8( volatile void *ptr, long long unsigned int oldval, long long unsigned int newval) { ShouldNotCallThis(); } }; #endif // !_LP64 #ifndef PRODUCT void os::verify_stack_alignment() { } #endif
rjsingh/graal
src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp
C++
gpl-2.0
13,875
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2494, 1010, 2262, 1010, 14721, 1998, 1013, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 1008, 9385, 2289, 1010, 2263, 1010, 2268, 1010, 2230, 2417, 6045, 1010, 4297, 1012, 1008, 2079, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import {NgModule} from '@angular/core'; import {ConstantService} from './service/constant.service'; import {CommonModule} from '@common/common.module'; import {DatetimeValidPopupComponent} from './component/datetime-valid-popup.component'; import {TimezoneService} from '../../data-storage/service/timezone.service'; import {FieldConfigService} from '../../data-storage/service/field-config.service'; import {DataStorageCommonModule} from '../../data-storage/data-storage-common.module'; @NgModule({ imports: [ CommonModule, DataStorageCommonModule ], declarations: [ DatetimeValidPopupComponent, ], exports: [ DatetimeValidPopupComponent, ], providers: [ ConstantService, TimezoneService, FieldConfigService, ], }) export class DatasourceMetadataSharedModule { }
metatron-app/metatron-discovery
discovery-frontend/src/app/shared/datasource-metadata/datasource-metadata-shared.module.ts
TypeScript
apache-2.0
809
[ 30522, 12324, 1063, 12835, 5302, 8566, 2571, 1065, 2013, 1005, 1030, 16108, 1013, 4563, 1005, 1025, 12324, 1063, 5377, 8043, 7903, 2063, 1065, 2013, 1005, 1012, 1013, 2326, 1013, 5377, 1012, 2326, 1005, 1025, 12324, 1063, 2691, 5302, 8566, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.gojul.gojulutils.data; /** * Class {@code GojulPair} is a simple stupid pair class. This class is notably necessary * when emulating JOIN in database and such a class does not exist natively in the JDK. * This object is immutable as long as the object it contains are immutable. Since * this object is not serializable it should not be stored in objects which could be serialized, * especially Java HttpSession objects. * * @param <S> the type of the first object of the pair. * @param <T> the type of the second object of the pair. * @author jaubin */ public final class GojulPair<S, T> { private final S first; private final T second; /** * Constructor. Both parameters are nullable. Note that this constructor * does not perform any defensive copy as it is not possible there. * * @param first the first object. * @param second the second object. */ public GojulPair(final S first, final T second) { this.first = first; this.second = second; } /** * Return the first object. * * @return the first object. */ public S getFirst() { return first; } /** * Return the second object. * * @return the second object. */ public T getSecond() { return second; } /** * {@inheritDoc} */ @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GojulPair<?, ?> pair = (GojulPair<?, ?>) o; if (getFirst() != null ? !getFirst().equals(pair.getFirst()) : pair.getFirst() != null) return false; return getSecond() != null ? getSecond().equals(pair.getSecond()) : pair.getSecond() == null; } /** * {@inheritDoc} */ @Override public int hashCode() { int result = getFirst() != null ? getFirst().hashCode() : 0; result = 31 * result + (getSecond() != null ? getSecond().hashCode() : 0); return result; } /** * {@inheritDoc} */ @Override public String toString() { return "GojulPair{" + "first=" + first + ", second=" + second + '}'; } }
jaubin/gojulutils
src/main/java/org/gojul/gojulutils/data/GojulPair.java
Java
mit
2,277
[ 30522, 7427, 8917, 1012, 2175, 9103, 2140, 1012, 2175, 9103, 7630, 3775, 4877, 1012, 2951, 1025, 1013, 1008, 1008, 1008, 2465, 1063, 1030, 3642, 2175, 9103, 14277, 11215, 1065, 2003, 1037, 3722, 5236, 3940, 2465, 1012, 2023, 2465, 2003, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright(c) 2011-2015 Intel Corporation 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 Intel Corporation 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 ; 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. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; gf_6vect_dot_prod_avx(len, vec, *g_tbls, **buffs, **dests); ;;; %include "reg_sizes.asm" %ifidn __OUTPUT_FORMAT__, elf64 %define arg0 rdi %define arg1 rsi %define arg2 rdx %define arg3 rcx %define arg4 r8 %define arg5 r9 %define tmp r11 %define tmp2 r10 %define tmp3 r13 ; must be saved and restored %define tmp4 r12 ; must be saved and restored %define tmp5 r14 ; must be saved and restored %define tmp6 r15 ; must be saved and restored %define return rax %define PS 8 %define LOG_PS 3 %define func(x) x: %macro FUNC_SAVE 0 push r12 push r13 push r14 push r15 %endmacro %macro FUNC_RESTORE 0 pop r15 pop r14 pop r13 pop r12 %endmacro %endif %ifidn __OUTPUT_FORMAT__, win64 %define arg0 rcx %define arg1 rdx %define arg2 r8 %define arg3 r9 %define arg4 r12 ; must be saved, loaded and restored %define arg5 r15 ; must be saved and restored %define tmp r11 %define tmp2 r10 %define tmp3 r13 ; must be saved and restored %define tmp4 r14 ; must be saved and restored %define tmp5 rdi ; must be saved and restored %define tmp6 rsi ; must be saved and restored %define return rax %define PS 8 %define LOG_PS 3 %define stack_size 10*16 + 7*8 ; must be an odd multiple of 8 %define arg(x) [rsp + stack_size + PS + PS*x] %define func(x) proc_frame x %macro FUNC_SAVE 0 alloc_stack stack_size save_xmm128 xmm6, 0*16 save_xmm128 xmm7, 1*16 save_xmm128 xmm8, 2*16 save_xmm128 xmm9, 3*16 save_xmm128 xmm10, 4*16 save_xmm128 xmm11, 5*16 save_xmm128 xmm12, 6*16 save_xmm128 xmm13, 7*16 save_xmm128 xmm14, 8*16 save_xmm128 xmm15, 9*16 save_reg r12, 10*16 + 0*8 save_reg r13, 10*16 + 1*8 save_reg r14, 10*16 + 2*8 save_reg r15, 10*16 + 3*8 save_reg rdi, 10*16 + 4*8 save_reg rsi, 10*16 + 5*8 end_prolog mov arg4, arg(4) %endmacro %macro FUNC_RESTORE 0 vmovdqa xmm6, [rsp + 0*16] vmovdqa xmm7, [rsp + 1*16] vmovdqa xmm8, [rsp + 2*16] vmovdqa xmm9, [rsp + 3*16] vmovdqa xmm10, [rsp + 4*16] vmovdqa xmm11, [rsp + 5*16] vmovdqa xmm12, [rsp + 6*16] vmovdqa xmm13, [rsp + 7*16] vmovdqa xmm14, [rsp + 8*16] vmovdqa xmm15, [rsp + 9*16] mov r12, [rsp + 10*16 + 0*8] mov r13, [rsp + 10*16 + 1*8] mov r14, [rsp + 10*16 + 2*8] mov r15, [rsp + 10*16 + 3*8] mov rdi, [rsp + 10*16 + 4*8] mov rsi, [rsp + 10*16 + 5*8] add rsp, stack_size %endmacro %endif %define len arg0 %define vec arg1 %define mul_array arg2 %define src arg3 %define dest arg4 %define ptr arg5 %define vec_i tmp2 %define dest1 tmp3 %define dest2 tmp4 %define vskip1 tmp5 %define vskip3 tmp6 %define pos return %ifndef EC_ALIGNED_ADDR ;;; Use Un-aligned load/store %define XLDR vmovdqu %define XSTR vmovdqu %else ;;; Use Non-temporal load/stor %ifdef NO_NT_LDST %define XLDR vmovdqa %define XSTR vmovdqa %else %define XLDR vmovntdqa %define XSTR vmovntdq %endif %endif default rel [bits 64] section .text %define xmask0f xmm15 %define xgft1_lo xmm14 %define xgft1_hi xmm13 %define xgft2_lo xmm12 %define xgft2_hi xmm11 %define xgft3_lo xmm10 %define xgft3_hi xmm9 %define x0 xmm0 %define xtmpa xmm1 %define xp1 xmm2 %define xp2 xmm3 %define xp3 xmm4 %define xp4 xmm5 %define xp5 xmm6 %define xp6 xmm7 align 16 global gf_6vect_dot_prod_avx:function func(gf_6vect_dot_prod_avx) FUNC_SAVE sub len, 16 jl .return_fail xor pos, pos vmovdqa xmask0f, [mask0f] ;Load mask of lower nibble in each byte mov vskip1, vec imul vskip1, 32 mov vskip3, vec imul vskip3, 96 sal vec, LOG_PS ;vec *= PS. Make vec_i count by PS mov dest1, [dest] mov dest2, [dest+PS] .loop16: mov tmp, mul_array xor vec_i, vec_i vpxor xp1, xp1 vpxor xp2, xp2 vpxor xp3, xp3 vpxor xp4, xp4 vpxor xp5, xp5 vpxor xp6, xp6 .next_vect: mov ptr, [src+vec_i] add vec_i, PS XLDR x0, [ptr+pos] ;Get next source vector vmovdqu xgft1_lo, [tmp] ;Load array Ax{00}, Ax{01}, ..., Ax{0f} vmovdqu xgft1_hi, [tmp+16] ; " Ax{00}, Ax{10}, ..., Ax{f0} vmovdqu xgft2_lo, [tmp+vskip1*1] ;Load array Bx{00}, Bx{01}, ..., Bx{0f} vmovdqu xgft2_hi, [tmp+vskip1*1+16] ; " Bx{00}, Bx{10}, ..., Bx{f0} vmovdqu xgft3_lo, [tmp+vskip1*2] ;Load array Cx{00}, Cx{01}, ..., Cx{0f} vmovdqu xgft3_hi, [tmp+vskip1*2+16] ; " Cx{00}, Cx{10}, ..., Cx{f0} lea ptr, [vskip1 + vskip1*4] ;ptr = vskip5 vpand xtmpa, x0, xmask0f ;Mask low src nibble in bits 4-0 vpsraw x0, x0, 4 ;Shift to put high nibble into bits 4-0 vpand x0, x0, xmask0f ;Mask high src nibble in bits 4-0 vpshufb xgft1_hi, x0 ;Lookup mul table of high nibble vpshufb xgft1_lo, xtmpa ;Lookup mul table of low nibble vpxor xgft1_hi, xgft1_lo ;GF add high and low partials vpxor xp1, xgft1_hi ;xp1 += partial vpshufb xgft2_hi, x0 ;Lookup mul table of high nibble vpshufb xgft2_lo, xtmpa ;Lookup mul table of low nibble vpxor xgft2_hi, xgft2_lo ;GF add high and low partials vpxor xp2, xgft2_hi ;xp2 += partial vpshufb xgft3_hi, x0 ;Lookup mul table of high nibble vpshufb xgft3_lo, xtmpa ;Lookup mul table of low nibble vpxor xgft3_hi, xgft3_lo ;GF add high and low partials vpxor xp3, xgft3_hi ;xp3 += partial vmovdqu xgft1_lo, [tmp+vskip3] ;Load array Dx{00}, Dx{01}, ..., Dx{0f} vmovdqu xgft1_hi, [tmp+vskip3+16] ; " Dx{00}, Dx{10}, ..., Dx{f0} vmovdqu xgft2_lo, [tmp+vskip1*4] ;Load array Ex{00}, Ex{01}, ..., Ex{0f} vmovdqu xgft2_hi, [tmp+vskip1*4+16] ; " Ex{00}, Ex{10}, ..., Ex{f0} vmovdqu xgft3_lo, [tmp+ptr] ;Load array Fx{00}, Fx{01}, ..., Fx{0f} vmovdqu xgft3_hi, [tmp+ptr+16] ; " Fx{00}, Fx{10}, ..., Fx{f0} add tmp, 32 vpshufb xgft1_hi, x0 ;Lookup mul table of high nibble vpshufb xgft1_lo, xtmpa ;Lookup mul table of low nibble vpxor xgft1_hi, xgft1_lo ;GF add high and low partials vpxor xp4, xgft1_hi ;xp4 += partial vpshufb xgft2_hi, x0 ;Lookup mul table of high nibble vpshufb xgft2_lo, xtmpa ;Lookup mul table of low nibble vpxor xgft2_hi, xgft2_lo ;GF add high and low partials vpxor xp5, xgft2_hi ;xp5 += partial vpshufb xgft3_hi, x0 ;Lookup mul table of high nibble vpshufb xgft3_lo, xtmpa ;Lookup mul table of low nibble vpxor xgft3_hi, xgft3_lo ;GF add high and low partials vpxor xp6, xgft3_hi ;xp6 += partial cmp vec_i, vec jl .next_vect mov tmp, [dest+2*PS] mov ptr, [dest+3*PS] mov vec_i, [dest+4*PS] XSTR [dest1+pos], xp1 XSTR [dest2+pos], xp2 XSTR [tmp+pos], xp3 mov tmp, [dest+5*PS] XSTR [ptr+pos], xp4 XSTR [vec_i+pos], xp5 XSTR [tmp+pos], xp6 add pos, 16 ;Loop on 16 bytes at a time cmp pos, len jle .loop16 lea tmp, [len + 16] cmp pos, tmp je .return_pass ;; Tail len mov pos, len ;Overlapped offset length-16 jmp .loop16 ;Do one more overlap pass .return_pass: FUNC_RESTORE mov return, 0 ret .return_fail: FUNC_RESTORE mov return, 1 ret endproc_frame section .data align 16 mask0f: ddq 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f ;;; func core, ver, snum slversion gf_6vect_dot_prod_avx, 02, 04, 0195
marcin-github/sheepdog
lib/isa-l/erasure_code/gf_6vect_dot_prod_avx.asm
Assembly
gpl-2.0
8,751
[ 30522, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2011-2012 Dr. John Lindsay <jlindsay@uoguelph.ca> * * 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 plugins; import java.util.Date; import whitebox.geospatialfiles.WhiteboxRaster; import whitebox.interfaces.WhiteboxPlugin; import whitebox.interfaces.WhiteboxPluginHost; /** * This tool calculates the average slope gradient (i.e., slope steepness in degrees) of the flowpaths that run through each grid cell in an input digital elevation model (DEM) to the upslope divide cells. * * @author Dr. John Lindsay email: jlindsay@uoguelph.ca */ public class AverageSlopeToDivide implements WhiteboxPlugin { private WhiteboxPluginHost myHost = null; private String[] args; // Constants private static final double LnOf2 = 0.693147180559945; /** * Used to retrieve the plugin tool's name. This is a short, unique name * containing no spaces. * * @return String containing plugin name. */ @Override public String getName() { return "AverageSlopeToDivide"; } /** * Used to retrieve the plugin tool's descriptive name. This can be a longer * name (containing spaces) and is used in the interface to list the tool. * * @return String containing the plugin descriptive name. */ @Override public String getDescriptiveName() { return "Average Flowpath Slope From Cell To Divide"; } /** * Used to retrieve a short description of what the plugin tool does. * * @return String containing the plugin's description. */ @Override public String getToolDescription() { return "Measures the average slope gradient from each grid cell to all " + "upslope divide cells."; } /** * Used to identify which toolboxes this plugin tool should be listed in. * * @return Array of Strings. */ @Override public String[] getToolbox() { String[] ret = {"FlowpathTAs"}; return ret; } /** * Sets the WhiteboxPluginHost to which the plugin tool is tied. This is the * class that the plugin will send all feedback messages, progress updates, * and return objects. * * @param host The WhiteboxPluginHost that called the plugin tool. */ @Override public void setPluginHost(WhiteboxPluginHost host) { myHost = host; } /** * Used to communicate feedback pop-up messages between a plugin tool and * the main Whitebox user-interface. * * @param feedback String containing the text to display. */ private void showFeedback(String message) { if (myHost != null) { myHost.showFeedback(message); } else { System.out.println(message); } } /** * Used to communicate a return object from a plugin tool to the main * Whitebox user-interface. * * @return Object, such as an output WhiteboxRaster. */ private void returnData(Object ret) { if (myHost != null) { myHost.returnData(ret); } } private int previousProgress = 0; private String previousProgressLabel = ""; /** * Used to communicate a progress update between a plugin tool and the main * Whitebox user interface. * * @param progressLabel A String to use for the progress label. * @param progress Float containing the progress value (between 0 and 100). */ private void updateProgress(String progressLabel, int progress) { if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) { myHost.updateProgress(progressLabel, progress); } previousProgress = progress; previousProgressLabel = progressLabel; } /** * Used to communicate a progress update between a plugin tool and the main * Whitebox user interface. * * @param progress Float containing the progress value (between 0 and 100). */ private void updateProgress(int progress) { if (myHost != null && progress != previousProgress) { myHost.updateProgress(progress); } previousProgress = progress; } /** * Sets the arguments (parameters) used by the plugin. * * @param args An array of string arguments. */ @Override public void setArgs(String[] args) { this.args = args.clone(); } private boolean cancelOp = false; /** * Used to communicate a cancel operation from the Whitebox GUI. * * @param cancel Set to true if the plugin should be canceled. */ @Override public void setCancelOp(boolean cancel) { cancelOp = cancel; } private void cancelOperation() { showFeedback("Operation cancelled."); updateProgress("Progress: ", 0); } private boolean amIActive = false; /** * Used by the Whitebox GUI to tell if this plugin is still running. * * @return a boolean describing whether or not the plugin is actively being * used. */ @Override public boolean isActive() { return amIActive; } /** * Used to execute this plugin tool. */ @Override public void run() { amIActive = true; String inputHeader = null; String outputHeader = null; String DEMHeader = null; int row, col, x, y; int progress = 0; double z, val, val2, val3; int i, c; int[] dX = new int[]{1, 1, 1, 0, -1, -1, -1, 0}; int[] dY = new int[]{-1, 0, 1, 1, 1, 0, -1, -1}; double[] inflowingVals = new double[]{16, 32, 64, 128, 1, 2, 4, 8}; boolean flag = false; double flowDir = 0; double flowLength = 0; double numUpslopeFlowpaths = 0; double flowpathLengthToAdd = 0; double conversionFactor = 1; double divideElevToAdd = 0; double radToDeg = 180 / Math.PI; if (args.length <= 0) { showFeedback("Plugin parameters have not been set."); return; } inputHeader = args[0]; DEMHeader = args[1]; outputHeader = args[2]; conversionFactor = Double.parseDouble(args[3]); // check to see that the inputHeader and outputHeader are not null. if ((inputHeader == null) || (outputHeader == null)) { showFeedback("One or more of the input parameters have not been set properly."); return; } try { WhiteboxRaster pntr = new WhiteboxRaster(inputHeader, "r"); int rows = pntr.getNumberRows(); int cols = pntr.getNumberColumns(); double noData = pntr.getNoDataValue(); double gridResX = pntr.getCellSizeX(); double gridResY = pntr.getCellSizeY(); double diagGridRes = Math.sqrt(gridResX * gridResX + gridResY * gridResY); double[] gridLengths = new double[]{diagGridRes, gridResX, diagGridRes, gridResY, diagGridRes, gridResX, diagGridRes, gridResY}; WhiteboxRaster DEM = new WhiteboxRaster(DEMHeader, "r"); if (DEM.getNumberRows() != rows || DEM.getNumberColumns() != cols) { showFeedback("The input files must have the same dimensions, i.e. number of " + "rows and columns."); return; } WhiteboxRaster output = new WhiteboxRaster(outputHeader, "rw", inputHeader, WhiteboxRaster.DataType.FLOAT, -999); output.setPreferredPalette("blueyellow.pal"); output.setDataScale(WhiteboxRaster.DataScale.CONTINUOUS); output.setZUnits(pntr.getXYUnits()); WhiteboxRaster numInflowingNeighbours = new WhiteboxRaster(outputHeader.replace(".dep", "_temp1.dep"), "rw", inputHeader, WhiteboxRaster.DataType.FLOAT, 0); numInflowingNeighbours.isTemporaryFile = true; WhiteboxRaster numUpslopeDivideCells = new WhiteboxRaster(outputHeader.replace(".dep", "_temp2.dep"), "rw", inputHeader, WhiteboxRaster.DataType.FLOAT, 0); numUpslopeDivideCells.isTemporaryFile = true; WhiteboxRaster totalFlowpathLength = new WhiteboxRaster(outputHeader.replace(".dep", "_temp3.dep"), "rw", inputHeader, WhiteboxRaster.DataType.FLOAT, 0); totalFlowpathLength.isTemporaryFile = true; WhiteboxRaster totalUpslopeDivideElev = new WhiteboxRaster(outputHeader.replace(".dep", "_temp4.dep"), "rw", inputHeader, WhiteboxRaster.DataType.FLOAT, 0); totalUpslopeDivideElev.isTemporaryFile = true; updateProgress("Loop 1 of 3:", 0); for (row = 0; row < rows; row++) { for (col = 0; col < cols; col++) { if (pntr.getValue(row, col) != noData) { z = 0; for (i = 0; i < 8; i++) { if (pntr.getValue(row + dY[i], col + dX[i]) == inflowingVals[i]) { z++; } } if (z > 0) { numInflowingNeighbours.setValue(row, col, z); } else { numInflowingNeighbours.setValue(row, col, -1); } } else { output.setValue(row, col, noData); } } if (cancelOp) { cancelOperation(); return; } progress = (int) (100f * row / (rows - 1)); updateProgress("Loop 1 of 3:", progress); } updateProgress("Loop 2 of 3:", 0); for (row = 0; row < rows; row++) { for (col = 0; col < cols; col++) { val = numInflowingNeighbours.getValue(row, col); if (val <= 0 && val != noData) { flag = false; x = col; y = row; do { val = numInflowingNeighbours.getValue(y, x); if (val <= 0 && val != noData) { //there are no more inflowing neighbours to visit; carry on downslope if (val == -1) { //it's the start of a flowpath numUpslopeDivideCells.setValue(y, x, 0); numUpslopeFlowpaths = 1; divideElevToAdd = DEM.getValue(y, x); } else { numUpslopeFlowpaths = numUpslopeDivideCells.getValue(y, x); divideElevToAdd = totalUpslopeDivideElev.getValue(y, x); } numInflowingNeighbours.setValue(y, x, noData); // find it's downslope neighbour flowDir = pntr.getValue(y, x); if (flowDir > 0) { // what's the flow direction as an int? c = (int) (Math.log(flowDir) / LnOf2); flowLength = gridLengths[c]; val2 = totalFlowpathLength.getValue(y, x); flowpathLengthToAdd = val2 + numUpslopeFlowpaths * flowLength; //move x and y accordingly x += dX[c]; y += dY[c]; numUpslopeDivideCells.setValue(y, x, numUpslopeDivideCells.getValue(y, x) + numUpslopeFlowpaths); totalFlowpathLength.setValue(y, x, totalFlowpathLength.getValue(y, x) + flowpathLengthToAdd); totalUpslopeDivideElev.setValue(y, x, totalUpslopeDivideElev.getValue(y, x) + divideElevToAdd); numInflowingNeighbours.setValue(y, x, numInflowingNeighbours.getValue(y, x) - 1); } else { // you've hit the edge or a pit cell. flag = true; } } else { flag = true; } } while (!flag); } } if (cancelOp) { cancelOperation(); return; } progress = (int) (100f * row / (rows - 1)); updateProgress("Loop 2 of 3:", progress); } numUpslopeDivideCells.flush(); totalFlowpathLength.flush(); totalUpslopeDivideElev.flush(); numInflowingNeighbours.close(); updateProgress("Loop 3 of 3:", 0); double[] data1 = null; double[] data2 = null; double[] data3 = null; double[] data4 = null; double[] data5 = null; for (row = 0; row < rows; row++) { data1 = numUpslopeDivideCells.getRowValues(row); data2 = totalFlowpathLength.getRowValues(row); data3 = pntr.getRowValues(row); data4 = totalUpslopeDivideElev.getRowValues(row); data5 = DEM.getRowValues(row); for (col = 0; col < cols; col++) { if (data3[col] != noData) { if (data1[col] > 0) { val = data2[col] / data1[col]; val2 = (data4[col] / data1[col] - data5[col]) * conversionFactor; val3 = Math.atan(val2 / val) * radToDeg; output.setValue(row, col, val3); } else { output.setValue(row, col, 0); } } else { output.setValue(row, col, noData); } } if (cancelOp) { cancelOperation(); return; } progress = (int) (100f * row / (rows - 1)); updateProgress("Loop 3 of 3:", progress); } output.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); output.addMetadataEntry("Created on " + new Date()); pntr.close(); DEM.close(); numUpslopeDivideCells.close(); totalFlowpathLength.close(); totalUpslopeDivideElev.close(); output.close(); // returning a header file string displays the image. returnData(outputHeader); } catch (OutOfMemoryError oe) { myHost.showFeedback("An out-of-memory error has occurred during operation."); } catch (Exception e) { myHost.showFeedback("An error has occurred during operation. See log file for details."); myHost.logException("Error in " + getDescriptiveName(), e); } finally { updateProgress("Progress: ", 0); // tells the main application that this process is completed. amIActive = false; myHost.pluginComplete(); } } }
jblindsay/jblindsay.github.io
ghrg/Whitebox/WhiteboxGAT-linux/resources/plugins/source_files/AverageSlopeToDivide.java
Java
mit
16,874
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2249, 1011, 2262, 2852, 1012, 2198, 12110, 1026, 1046, 27164, 24322, 1030, 1057, 8649, 16284, 8458, 1012, 6187, 1028, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php declare(strict_types=1); /** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tests\Localization; /** * @group localization */ class HtTest extends LocalizationTestCase { public const LOCALE = 'ht'; // Haitian public const CASES = [ // Carbon::parse('2018-01-04 00:00:00')->addDays(1)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'Tomorrow at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->addDays(2)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'samdi at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->addDays(3)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'dimanch at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->addDays(4)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'lendi at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->addDays(5)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'madi at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'mèkredi at 12:00 AM', // Carbon::parse('2018-01-05 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-05 00:00:00')) 'jedi at 12:00 AM', // Carbon::parse('2018-01-06 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-06 00:00:00')) 'vandredi at 12:00 AM', // Carbon::parse('2018-01-07 00:00:00')->addDays(2)->calendar(Carbon::parse('2018-01-07 00:00:00')) 'madi at 12:00 AM', // Carbon::parse('2018-01-07 00:00:00')->addDays(3)->calendar(Carbon::parse('2018-01-07 00:00:00')) 'mèkredi at 12:00 AM', // Carbon::parse('2018-01-07 00:00:00')->addDays(4)->calendar(Carbon::parse('2018-01-07 00:00:00')) 'jedi at 12:00 AM', // Carbon::parse('2018-01-07 00:00:00')->addDays(5)->calendar(Carbon::parse('2018-01-07 00:00:00')) 'vandredi at 12:00 AM', // Carbon::parse('2018-01-07 00:00:00')->addDays(6)->calendar(Carbon::parse('2018-01-07 00:00:00')) 'samdi at 12:00 AM', // Carbon::now()->subDays(2)->calendar() 'Last dimanch at 8:49 PM', // Carbon::parse('2018-01-04 00:00:00')->subHours(2)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'Yesterday at 10:00 PM', // Carbon::parse('2018-01-04 12:00:00')->subHours(2)->calendar(Carbon::parse('2018-01-04 12:00:00')) 'Today at 10:00 AM', // Carbon::parse('2018-01-04 00:00:00')->addHours(2)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'Today at 2:00 AM', // Carbon::parse('2018-01-04 23:00:00')->addHours(2)->calendar(Carbon::parse('2018-01-04 23:00:00')) 'Tomorrow at 1:00 AM', // Carbon::parse('2018-01-07 00:00:00')->addDays(2)->calendar(Carbon::parse('2018-01-07 00:00:00')) 'madi at 12:00 AM', // Carbon::parse('2018-01-08 00:00:00')->subDay()->calendar(Carbon::parse('2018-01-08 00:00:00')) 'Yesterday at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->subDays(1)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'Yesterday at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->subDays(2)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'Last madi at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->subDays(3)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'Last lendi at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->subDays(4)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'Last dimanch at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->subDays(5)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'Last samdi at 12:00 AM', // Carbon::parse('2018-01-04 00:00:00')->subDays(6)->calendar(Carbon::parse('2018-01-04 00:00:00')) 'Last vandredi at 12:00 AM', // Carbon::parse('2018-01-03 00:00:00')->subDays(6)->calendar(Carbon::parse('2018-01-03 00:00:00')) 'Last jedi at 12:00 AM', // Carbon::parse('2018-01-02 00:00:00')->subDays(6)->calendar(Carbon::parse('2018-01-02 00:00:00')) 'Last mèkredi at 12:00 AM', // Carbon::parse('2018-01-07 00:00:00')->subDays(2)->calendar(Carbon::parse('2018-01-07 00:00:00')) 'Last vandredi at 12:00 AM', // Carbon::parse('2018-01-01 00:00:00')->isoFormat('Qo Mo Do Wo wo') '1st 1st 1st 1st 1st', // Carbon::parse('2018-01-02 00:00:00')->isoFormat('Do wo') '2nd 1st', // Carbon::parse('2018-01-03 00:00:00')->isoFormat('Do wo') '3rd 1st', // Carbon::parse('2018-01-04 00:00:00')->isoFormat('Do wo') '4th 1st', // Carbon::parse('2018-01-05 00:00:00')->isoFormat('Do wo') '5th 1st', // Carbon::parse('2018-01-06 00:00:00')->isoFormat('Do wo') '6th 1st', // Carbon::parse('2018-01-07 00:00:00')->isoFormat('Do wo') '7th 1st', // Carbon::parse('2018-01-11 00:00:00')->isoFormat('Do wo') '11th 2nd', // Carbon::parse('2018-02-09 00:00:00')->isoFormat('DDDo') '40th', // Carbon::parse('2018-02-10 00:00:00')->isoFormat('DDDo') '41st', // Carbon::parse('2018-04-10 00:00:00')->isoFormat('DDDo') '100th', // Carbon::parse('2018-02-10 00:00:00', 'Europe/Paris')->isoFormat('h:mm a z') '12:00 am CET', // Carbon::parse('2018-02-10 00:00:00')->isoFormat('h:mm A, h:mm a') '12:00 AM, 12:00 am', // Carbon::parse('2018-02-10 01:30:00')->isoFormat('h:mm A, h:mm a') '1:30 AM, 1:30 am', // Carbon::parse('2018-02-10 02:00:00')->isoFormat('h:mm A, h:mm a') '2:00 AM, 2:00 am', // Carbon::parse('2018-02-10 06:00:00')->isoFormat('h:mm A, h:mm a') '6:00 AM, 6:00 am', // Carbon::parse('2018-02-10 10:00:00')->isoFormat('h:mm A, h:mm a') '10:00 AM, 10:00 am', // Carbon::parse('2018-02-10 12:00:00')->isoFormat('h:mm A, h:mm a') '12:00 PM, 12:00 pm', // Carbon::parse('2018-02-10 17:00:00')->isoFormat('h:mm A, h:mm a') '5:00 PM, 5:00 pm', // Carbon::parse('2018-02-10 21:30:00')->isoFormat('h:mm A, h:mm a') '9:30 PM, 9:30 pm', // Carbon::parse('2018-02-10 23:00:00')->isoFormat('h:mm A, h:mm a') '11:00 PM, 11:00 pm', // Carbon::parse('2018-01-01 00:00:00')->ordinal('hour') '0th', // Carbon::now()->subSeconds(1)->diffForHumans() '1 segonn ago', // Carbon::now()->subSeconds(1)->diffForHumans(null, false, true) '1 segonn ago', // Carbon::now()->subSeconds(2)->diffForHumans() '2 segonn ago', // Carbon::now()->subSeconds(2)->diffForHumans(null, false, true) '2 segonn ago', // Carbon::now()->subMinutes(1)->diffForHumans() '1 minit ago', // Carbon::now()->subMinutes(1)->diffForHumans(null, false, true) '1 minit ago', // Carbon::now()->subMinutes(2)->diffForHumans() '2 minit ago', // Carbon::now()->subMinutes(2)->diffForHumans(null, false, true) '2 minit ago', // Carbon::now()->subHours(1)->diffForHumans() '1 lè ago', // Carbon::now()->subHours(1)->diffForHumans(null, false, true) '1 lè ago', // Carbon::now()->subHours(2)->diffForHumans() '2 lè ago', // Carbon::now()->subHours(2)->diffForHumans(null, false, true) '2 lè ago', // Carbon::now()->subDays(1)->diffForHumans() '1 jou ago', // Carbon::now()->subDays(1)->diffForHumans(null, false, true) '1 jou ago', // Carbon::now()->subDays(2)->diffForHumans() '2 jou ago', // Carbon::now()->subDays(2)->diffForHumans(null, false, true) '2 jou ago', // Carbon::now()->subWeeks(1)->diffForHumans() 'semèn 1 ago', // Carbon::now()->subWeeks(1)->diffForHumans(null, false, true) 'semèn 1 ago', // Carbon::now()->subWeeks(2)->diffForHumans() 'semèn 2 ago', // Carbon::now()->subWeeks(2)->diffForHumans(null, false, true) 'semèn 2 ago', // Carbon::now()->subMonths(1)->diffForHumans() 'mwa 1 ago', // Carbon::now()->subMonths(1)->diffForHumans(null, false, true) 'mwa 1 ago', // Carbon::now()->subMonths(2)->diffForHumans() 'mwa 2 ago', // Carbon::now()->subMonths(2)->diffForHumans(null, false, true) 'mwa 2 ago', // Carbon::now()->subYears(1)->diffForHumans() '1 lane ago', // Carbon::now()->subYears(1)->diffForHumans(null, false, true) '1 lane ago', // Carbon::now()->subYears(2)->diffForHumans() '2 lane ago', // Carbon::now()->subYears(2)->diffForHumans(null, false, true) '2 lane ago', // Carbon::now()->addSecond()->diffForHumans() '1 segonn from now', // Carbon::now()->addSecond()->diffForHumans(null, false, true) '1 segonn from now', // Carbon::now()->addSecond()->diffForHumans(Carbon::now()) '1 segonn after', // Carbon::now()->addSecond()->diffForHumans(Carbon::now(), false, true) '1 segonn after', // Carbon::now()->diffForHumans(Carbon::now()->addSecond()) '1 segonn before', // Carbon::now()->diffForHumans(Carbon::now()->addSecond(), false, true) '1 segonn before', // Carbon::now()->addSecond()->diffForHumans(Carbon::now(), true) '1 segonn', // Carbon::now()->addSecond()->diffForHumans(Carbon::now(), true, true) '1 segonn', // Carbon::now()->diffForHumans(Carbon::now()->addSecond()->addSecond(), true) '2 segonn', // Carbon::now()->diffForHumans(Carbon::now()->addSecond()->addSecond(), true, true) '2 segonn', // Carbon::now()->addSecond()->diffForHumans(null, false, true, 1) '1 segonn from now', // Carbon::now()->addMinute()->addSecond()->diffForHumans(null, true, false, 2) '1 minit 1 segonn', // Carbon::now()->addYears(2)->addMonths(3)->addDay()->addSecond()->diffForHumans(null, true, true, 4) '2 lane mwa 3 1 jou 1 segonn', // Carbon::now()->addYears(3)->diffForHumans(null, null, false, 4) '3 lane from now', // Carbon::now()->subMonths(5)->diffForHumans(null, null, true, 4) 'mwa 5 ago', // Carbon::now()->subYears(2)->subMonths(3)->subDay()->subSecond()->diffForHumans(null, null, true, 4) '2 lane mwa 3 1 jou 1 segonn ago', // Carbon::now()->addWeek()->addHours(10)->diffForHumans(null, true, false, 2) 'semèn 1 10 lè', // Carbon::now()->addWeek()->addDays(6)->diffForHumans(null, true, false, 2) 'semèn 1 6 jou', // Carbon::now()->addWeek()->addDays(6)->diffForHumans(null, true, false, 2) 'semèn 1 6 jou', // Carbon::now()->addWeek()->addDays(6)->diffForHumans(["join" => true, "parts" => 2]) 'semèn 1 and 6 jou from now', // Carbon::now()->addWeeks(2)->addHour()->diffForHumans(null, true, false, 2) 'semèn 2 1 lè', // Carbon::now()->addHour()->diffForHumans(["aUnit" => true]) '1 lè from now', // CarbonInterval::days(2)->forHumans() '2 jou', // CarbonInterval::create('P1DT3H')->forHumans(true) '1 jou 3 lè', ]; }
briannesbitt/Carbon
tests/Localization/HtTest.php
PHP
mit
11,523
[ 30522, 1026, 1029, 25718, 13520, 1006, 9384, 1035, 4127, 1027, 1015, 1007, 1025, 1013, 1008, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 6351, 7427, 1012, 1008, 30524, 2005, 1996, 2440, 9385, 1998, 6105, 2592, 1010, 3531, 3193, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# -*- coding: utf-8 -*- # # Copyright (C) Pootle contributors. # # This file is a part of the Pootle project. It is distributed under the GPL3 # or later license. See the LICENSE file for a copy of the license and the # AUTHORS file for copyright and authorship information. import errno import logging import os import re from django.conf import settings from pootle.core.log import STORE_RESURRECTED, store_log from pootle.core.utils.timezone import datetime_min from pootle_app.models.directory import Directory from pootle_language.models import Language from pootle_store.models import Store from pootle_store.util import absolute_real_path, relative_real_path #: Case insensitive match for language codes LANGCODE_RE = re.compile('^[a-z]{2,3}([_-][a-z]{2,3})?(@[a-z0-9]+)?$', re.IGNORECASE) #: Case insensitive match for language codes as postfix LANGCODE_POSTFIX_RE = re.compile( '^.*?[-_.]([a-z]{2,3}([_-][a-z]{2,3})?(@[a-z0-9]+)?)$', re.IGNORECASE) def direct_language_match_filename(language_code, path_name): name, ext = os.path.splitext(os.path.basename(path_name)) if name == language_code or name.lower() == language_code.lower(): return True # Check file doesn't match another language. if Language.objects.filter(code__iexact=name).count(): return False detect = LANGCODE_POSTFIX_RE.split(name) return (len(detect) > 1 and (detect[1] == language_code or detect[1].lower() == language_code.lower())) def match_template_filename(project, filename): """Test if :param:`filename` might point at a template file for a given :param:`project`. """ name, ext = os.path.splitext(os.path.basename(filename)) # FIXME: is the test for matching extension redundant? if ext == os.path.extsep + project.get_template_filetype(): if ext != os.path.extsep + project.localfiletype: # Template extension is distinct, surely file is a template. return True elif not find_lang_postfix(filename): # File name can't possibly match any language, assume it is a # template. return True return False def get_matching_language_dirs(project_dir, language): return [lang_dir for lang_dir in os.listdir(project_dir) if language.code == lang_dir] def get_non_existant_language_dir(project_dir, language, file_style, make_dirs): if file_style == "gnu": return project_dir elif make_dirs: language_dir = os.path.join(project_dir, language.code) os.mkdir(language_dir) return language_dir else: raise IndexError("Directory not found for language %s, project %s" % (language.code, project_dir)) def get_or_make_language_dir(project_dir, language, file_style, make_dirs): matching_language_dirs = get_matching_language_dirs(project_dir, language) if len(matching_language_dirs) == 0: # If no matching directories can be found, check if it is a GNU-style # project. return get_non_existant_language_dir(project_dir, language, file_style, make_dirs) else: return os.path.join(project_dir, matching_language_dirs[0]) def get_language_dir(project_dir, language, file_style, make_dirs): language_dir = os.path.join(project_dir, language.code) if not os.path.exists(language_dir): return get_or_make_language_dir(project_dir, language, file_style, make_dirs) else: return language_dir def get_translation_project_dir(language, project_dir, file_style, make_dirs=False): """Returns the base directory containing translations files for the project. :param make_dirs: if ``True``, project and language directories will be created as necessary. """ if file_style == 'gnu': return project_dir else: return get_language_dir(project_dir, language, file_style, make_dirs) def is_hidden_file(path): return path[0] == '.' def split_files_and_dirs(ignored_files, ext, real_dir, file_filter): files = [] dirs = [] for child_path in [child_path for child_path in os.listdir(real_dir) if child_path not in ignored_files and not is_hidden_file(child_path)]: full_child_path = os.path.join(real_dir, child_path) if (os.path.isfile(full_child_path) and full_child_path.endswith(ext) and file_filter(full_child_path)): files.append(child_path) elif os.path.isdir(full_child_path): dirs.append(child_path) return files, dirs def add_items(fs_items_set, db_items, create_or_resurrect_db_item, parent): """Add/make obsolete the database items to correspond to the filesystem. :param fs_items_set: items (dirs, files) currently in the filesystem :param db_items: dict (name, item) of items (dirs, stores) currently in the database :create_or_resurrect_db_item: callable that will create a new db item or resurrect an obsolete db item with a given name and parent. :parent: parent db directory for the items :return: list of all items, list of newly added items :rtype: tuple """ items = [] new_items = [] db_items_set = set(db_items) items_to_delete = db_items_set - fs_items_set items_to_create = fs_items_set - db_items_set for name in items_to_delete: db_items[name].makeobsolete() if len(items_to_delete) > 0: parent.update_all_cache() for vfolder_treeitem in parent.vfolder_treeitems: vfolder_treeitem.update_all_cache() for name in db_items_set - items_to_delete: items.append(db_items[name]) for name in items_to_create: item = create_or_resurrect_db_item(name) items.append(item) new_items.append(item) try: item.save() except Exception: logging.exception('Error while adding %s', item) return items, new_items def create_or_resurrect_store(file, parent, name, translation_project): """Create or resurrect a store db item with given name and parent.""" try: store = Store.objects.get(parent=parent, name=name) store.obsolete = False store.file_mtime = datetime_min if store.last_sync_revision is None: store.last_sync_revision = store.get_max_unit_revision() store_log(user='system', action=STORE_RESURRECTED, path=store.pootle_path, store=store.id) except Store.DoesNotExist: store = Store(file=file, parent=parent, name=name, translation_project=translation_project) store.mark_all_dirty() return store def create_or_resurrect_dir(name, parent): """Create or resurrect a directory db item with given name and parent.""" try: dir = Directory.objects.get(parent=parent, name=name) dir.obsolete = False except Directory.DoesNotExist: dir = Directory(name=name, parent=parent) dir.mark_all_dirty() return dir # TODO: rename function or even rewrite it def add_files(translation_project, ignored_files, ext, relative_dir, db_dir, file_filter=lambda _x: True): podir_path = to_podir_path(relative_dir) files, dirs = split_files_and_dirs(ignored_files, ext, podir_path, file_filter) file_set = set(files) dir_set = set(dirs) existing_stores = dict((store.name, store) for store in db_dir.child_stores.live().exclude(file='') .iterator()) existing_dirs = dict((dir.name, dir) for dir in db_dir.child_dirs.live().iterator()) files, new_files = add_items( file_set, existing_stores, lambda name: create_or_resurrect_store( file=os.path.join(relative_dir, name), parent=db_dir, name=name, translation_project=translation_project, ), db_dir, ) db_subdirs, new_db_subdirs = add_items( dir_set, existing_dirs, lambda name: create_or_resurrect_dir(name=name, parent=db_dir), db_dir, ) is_empty = len(files) == 0 for db_subdir in db_subdirs: fs_subdir = os.path.join(relative_dir, db_subdir.name) _files, _new_files, _is_empty = \ add_files(translation_project, ignored_files, ext, fs_subdir, db_subdir, file_filter) files += _files new_files += _new_files is_empty &= _is_empty if is_empty: db_dir.makeobsolete() return files, new_files, is_empty def to_podir_path(path): path = relative_real_path(path) return os.path.join(settings.POOTLE_TRANSLATION_DIRECTORY, path) def find_lang_postfix(filename): """Finds the language code at end of a filename.""" name = os.path.splitext(os.path.basename(filename))[0] if LANGCODE_RE.match(name): return name match = LANGCODE_POSTFIX_RE.match(name) if match: return match.groups()[0] for code in Language.objects.values_list('code', flat=True): if (name.endswith('-'+code) or name.endswith('_'+code) or name.endswith('.'+code) or name.lower().endswith('-'+code.lower()) or name.endswith('_'+code) or name.endswith('.'+code)): return code def translation_project_dir_exists(language, project): """Tests if there are translation files corresponding to the given :param:`language` and :param:`project`. """ if project.get_treestyle() == "gnu": # GNU style projects are tricky if language.code == 'templates': # Language is template look for template files for dirpath, dirnames, filenames in os.walk( project.get_real_path()): for filename in filenames: if (project.file_belongs_to_project(filename, match_templates=True) and match_template_filename(project, filename)): return True else: # find files with the language name in the project dir for dirpath, dirnames, filenames in os.walk( project.get_real_path()): for filename in filenames: # FIXME: don't reuse already used file if (project.file_belongs_to_project(filename, match_templates=False) and direct_language_match_filename(language.code, filename)): return True else: # find directory with the language name in the project dir try: dirpath, dirnames, filename = os.walk( project.get_real_path()).next() if language.code in dirnames: return True except StopIteration: pass return False def init_store_from_template(translation_project, template_store): """Initialize a new file for `translation_project` using `template_store`. """ if translation_project.file_style == 'gnu': target_pootle_path, target_path = get_translated_name_gnu( translation_project, template_store) else: target_pootle_path, target_path = get_translated_name( translation_project, template_store) # Create the missing directories for the new TP. target_dir = os.path.dirname(target_path) if not os.path.exists(target_dir): os.makedirs(target_dir) output_file = template_store.file.store output_file.settargetlanguage(translation_project.language.code) output_file.savefile(target_path) def get_translated_name_gnu(translation_project, store): """Given a template :param:`store` and a :param:`translation_project` return target filename. """ pootle_path_parts = store.pootle_path.split('/') pootle_path_parts[1] = translation_project.language.code pootle_path = '/'.join(pootle_path_parts[:-1]) if not pootle_path.endswith('/'): pootle_path = pootle_path + '/' suffix = "%s%s%s" % (translation_project.language.code, os.extsep, translation_project.project.localfiletype) # try loading file first try: target_store = translation_project.stores.live().get( parent__pootle_path=pootle_path, name__iexact=suffix, ) return (target_store.pootle_path, target_store.file and target_store.file.path) except Store.DoesNotExist: target_store = None # is this GNU-style with prefix? use_prefix = (store.parent.child_stores.live().exclude(file="").count() > 1 or translation_project.stores.live().exclude( name__iexact=suffix, file='').count()) if not use_prefix: # let's make sure for tp in translation_project.project.translationproject_set.exclude( language__code='templates').iterator(): temp_suffix = \ "%s%s%s" % (tp.language.code, os.extsep, translation_project.project.localfiletype) if tp.stores.live().exclude( name__iexact=temp_suffix).exclude(file="").count(): use_prefix = True break if use_prefix: if store.translation_project.language.code == 'templates': tprefix = os.path.splitext(store.name)[0] # FIXME: we should detect separator prefix = tprefix + '-' else: prefix = os.path.splitext(store.name)[0][:-len( store.translation_project.language.code)] tprefix = prefix[:-1] try: target_store = translation_project.stores.live().filter( parent__pootle_path=pootle_path, name__in=[ tprefix + '-' + suffix, tprefix + '_' + suffix, tprefix + '.' + suffix, tprefix + '-' + suffix.lower(), tprefix + '_' + suffix.lower(), tprefix + '.' + suffix.lower(), ], )[0] return (target_store.pootle_path, target_store.file and target_store.file.path) except (Store.DoesNotExist, IndexError): pass else: prefix = "" if store.file: path_parts = store.file.path.split(os.sep) name = prefix + suffix path_parts[-1] = name pootle_path_parts[-1] = name else: path_parts = store.parent.get_real_path().split(os.sep) path_parts.append(store.name) return '/'.join(pootle_path_parts), os.sep.join(path_parts) def get_translated_name(translation_project, store): name, ext = os.path.splitext(store.name) if store.file: path_parts = store.file.name.split(os.sep) else: path_parts = store.parent.get_real_path().split(os.sep) path_parts.append(store.name) pootle_path_parts = store.pootle_path.split('/') # Replace language code path_parts[1] = translation_project.language.code pootle_path_parts[1] = translation_project.language.code # Replace extension path_parts[-1] = "%s.%s" % (name, translation_project.project.localfiletype) pootle_path_parts[-1] = \ "%s.%s" % (name, translation_project.project.localfiletype) return ('/'.join(pootle_path_parts), absolute_real_path(os.sep.join(path_parts))) def does_not_exist(path): if os.path.exists(path): return False try: os.stat(path) # what the hell? except OSError as e: if e.errno == errno.ENOENT: # explicit no such file or directory return True
pavels/pootle
pootle/apps/pootle_app/project_tree.py
Python
gpl-3.0
16,304
[ 30522, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 1011, 1022, 1011, 1008, 1011, 1001, 1001, 9385, 1006, 1039, 1007, 13433, 4140, 2571, 16884, 1012, 1001, 1001, 2023, 5371, 2003, 1037, 2112, 1997, 1996, 13433, 4140, 2571, 2622, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_29) on Sat Mar 17 18:04:46 MSK 2012 --> <TITLE> ConditionalFormattingRule (POI API Documentation) </TITLE> <META NAME="date" CONTENT="2012-03-17"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="ConditionalFormattingRule (POI API Documentation)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ConditionalFormattingRule.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormatting.html" title="interface in org.apache.poi.ss.usermodel"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../org/apache/poi/ss/usermodel/CreationHelper.html" title="interface in org.apache.poi.ss.usermodel"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/poi/ss/usermodel/ConditionalFormattingRule.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ConditionalFormattingRule.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.apache.poi.ss.usermodel</FONT> <BR> Interface ConditionalFormattingRule</H2> <DL> <DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../../org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.html" title="class in org.apache.poi.hssf.usermodel">HSSFConditionalFormattingRule</A>, <A HREF="../../../../../org/apache/poi/xssf/usermodel/XSSFConditionalFormattingRule.html" title="class in org.apache.poi.xssf.usermodel">XSSFConditionalFormattingRule</A></DD> </DL> <HR> <DL> <DT><PRE>public interface <B>ConditionalFormattingRule</B></DL> </PRE> <P> Represents a description of a conditional formatting rule <P> <P> <DL> <DT><B>Author:</B></DT> <DD>Dmitriy Kumshayev, Yegor Kozlov</DD> </DL> <HR> <P> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Field Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;byte</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_CELL_VALUE_IS">CONDITION_TYPE_CELL_VALUE_IS</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This conditional formatting rule compares a cell value to a formula calculated result, using an operator</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;byte</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_FORMULA">CONDITION_TYPE_FORMULA</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This conditional formatting rule contains a formula to evaluate.</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../org/apache/poi/ss/usermodel/BorderFormatting.html" title="interface in org.apache.poi.ss.usermodel">BorderFormatting</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#createBorderFormatting()">createBorderFormatting</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a new border formatting structure if it does not exist, otherwise just return existing object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../org/apache/poi/ss/usermodel/FontFormatting.html" title="interface in org.apache.poi.ss.usermodel">FontFormatting</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#createFontFormatting()">createFontFormatting</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a new font formatting structure if it does not exist, otherwise just return existing object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../org/apache/poi/ss/usermodel/PatternFormatting.html" title="interface in org.apache.poi.ss.usermodel">PatternFormatting</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#createPatternFormatting()">createPatternFormatting</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a new pattern formatting structure if it does not exist, otherwise just return existing object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../org/apache/poi/ss/usermodel/BorderFormatting.html" title="interface in org.apache.poi.ss.usermodel">BorderFormatting</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#getBorderFormatting()">getBorderFormatting</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;byte</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#getComparisonOperation()">getComparisonOperation</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The comparison function used when the type of conditional formatting is set to <A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_CELL_VALUE_IS"><CODE>CONDITION_TYPE_CELL_VALUE_IS</CODE></A></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;byte</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#getConditionType()">getConditionType</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type of conditional formatting rule.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../org/apache/poi/ss/usermodel/FontFormatting.html" title="interface in org.apache.poi.ss.usermodel">FontFormatting</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#getFontFormatting()">getFontFormatting</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#getFormula1()">getFormula1</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The formula used to evaluate the first operand for the conditional formatting rule.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#getFormula2()">getFormula2</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The formula used to evaluate the second operand of the comparison when comparison type is <A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_CELL_VALUE_IS"><CODE>CONDITION_TYPE_CELL_VALUE_IS</CODE></A> and operator is either <A HREF="../../../../../org/apache/poi/ss/usermodel/ComparisonOperator.html#BETWEEN"><CODE>ComparisonOperator.BETWEEN</CODE></A> or <A HREF="../../../../../org/apache/poi/ss/usermodel/ComparisonOperator.html#NOT_BETWEEN"><CODE>ComparisonOperator.NOT_BETWEEN</CODE></A></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../org/apache/poi/ss/usermodel/PatternFormatting.html" title="interface in org.apache.poi.ss.usermodel">PatternFormatting</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#getPatternFormatting()">getPatternFormatting</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <!-- ============ FIELD DETAIL =========== --> <A NAME="field_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Field Detail</B></FONT></TH> </TR> </TABLE> <A NAME="CONDITION_TYPE_CELL_VALUE_IS"><!-- --></A><H3> CONDITION_TYPE_CELL_VALUE_IS</H3> <PRE> static final byte <B>CONDITION_TYPE_CELL_VALUE_IS</B></PRE> <DL> <DD>This conditional formatting rule compares a cell value to a formula calculated result, using an operator <P> <DL> <DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.poi.ss.usermodel.ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS">Constant Field Values</A></DL> </DL> <HR> <A NAME="CONDITION_TYPE_FORMULA"><!-- --></A><H3> CONDITION_TYPE_FORMULA</H3> <PRE> static final byte <B>CONDITION_TYPE_FORMULA</B></PRE> <DL> <DD>This conditional formatting rule contains a formula to evaluate. When the formula result is true, the cell is highlighted. <P> <DL> <DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.poi.ss.usermodel.ConditionalFormattingRule.CONDITION_TYPE_FORMULA">Constant Field Values</A></DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="createBorderFormatting()"><!-- --></A><H3> createBorderFormatting</H3> <PRE> <A HREF="../../../../../org/apache/poi/ss/usermodel/BorderFormatting.html" title="interface in org.apache.poi.ss.usermodel">BorderFormatting</A> <B>createBorderFormatting</B>()</PRE> <DL> <DD>Create a new border formatting structure if it does not exist, otherwise just return existing object. <P> <DD><DL> <DT><B>Returns:</B><DD>- border formatting object, never returns <code>null</code>.</DL> </DD> </DL> <HR> <A NAME="getBorderFormatting()"><!-- --></A><H3> getBorderFormatting</H3> <PRE> <A HREF="../../../../../org/apache/poi/ss/usermodel/BorderFormatting.html" title="interface in org.apache.poi.ss.usermodel">BorderFormatting</A> <B>getBorderFormatting</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>- border formatting object if defined, <code>null</code> otherwise</DL> </DD> </DL> <HR> <A NAME="createFontFormatting()"><!-- --></A><H3> createFontFormatting</H3> <PRE> <A HREF="../../../../../org/apache/poi/ss/usermodel/FontFormatting.html" title="interface in org.apache.poi.ss.usermodel">FontFormatting</A> <B>createFontFormatting</B>()</PRE> <DL> <DD>Create a new font formatting structure if it does not exist, otherwise just return existing object. <P> <DD><DL> <DT><B>Returns:</B><DD>- font formatting object, never returns <code>null</code>.</DL> </DD> </DL> <HR> <A NAME="getFontFormatting()"><!-- --></A><H3> getFontFormatting</H3> <PRE> <A HREF="../../../../../org/apache/poi/ss/usermodel/FontFormatting.html" title="interface in org.apache.poi.ss.usermodel">FontFormatting</A> <B>getFontFormatting</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>- font formatting object if defined, <code>null</code> otherwise</DL> </DD> </DL> <HR> <A NAME="createPatternFormatting()"><!-- --></A><H3> createPatternFormatting</H3> <PRE> <A HREF="../../../../../org/apache/poi/ss/usermodel/PatternFormatting.html" title="interface in org.apache.poi.ss.usermodel">PatternFormatting</A> <B>createPatternFormatting</B>()</PRE> <DL> <DD>Create a new pattern formatting structure if it does not exist, otherwise just return existing object. <P> <DD><DL> <DT><B>Returns:</B><DD>- pattern formatting object, never returns <code>null</code>.</DL> </DD> </DL> <HR> <A NAME="getPatternFormatting()"><!-- --></A><H3> getPatternFormatting</H3> <PRE> <A HREF="../../../../../org/apache/poi/ss/usermodel/PatternFormatting.html" title="interface in org.apache.poi.ss.usermodel">PatternFormatting</A> <B>getPatternFormatting</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>- pattern formatting object if defined, <code>null</code> otherwise</DL> </DD> </DL> <HR> <A NAME="getConditionType()"><!-- --></A><H3> getConditionType</H3> <PRE> byte <B>getConditionType</B>()</PRE> <DL> <DD>Type of conditional formatting rule. <p> MUST be either <A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_CELL_VALUE_IS"><CODE>CONDITION_TYPE_CELL_VALUE_IS</CODE></A> or <A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_FORMULA"><CODE>CONDITION_TYPE_FORMULA</CODE></A> </p> <P> <DD><DL> <DT><B>Returns:</B><DD>the type of condition</DL> </DD> </DL> <HR> <A NAME="getComparisonOperation()"><!-- --></A><H3> getComparisonOperation</H3> <PRE> byte <B>getComparisonOperation</B>()</PRE> <DL> <DD>The comparison function used when the type of conditional formatting is set to <A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_CELL_VALUE_IS"><CODE>CONDITION_TYPE_CELL_VALUE_IS</CODE></A> <p> MUST be a constant from <A HREF="../../../../../org/apache/poi/ss/usermodel/ComparisonOperator.html" title="class in org.apache.poi.ss.usermodel"><CODE>ComparisonOperator</CODE></A> </p> <P> <DD><DL> <DT><B>Returns:</B><DD>the conditional format operator</DL> </DD> </DL> <HR> <A NAME="getFormula1()"><!-- --></A><H3> getFormula1</H3> <PRE> java.lang.String <B>getFormula1</B>()</PRE> <DL> <DD>The formula used to evaluate the first operand for the conditional formatting rule. <p> If the condition type is <A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_CELL_VALUE_IS"><CODE>CONDITION_TYPE_CELL_VALUE_IS</CODE></A>, this field is the first operand of the comparison. If type is <A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_FORMULA"><CODE>CONDITION_TYPE_FORMULA</CODE></A>, this formula is used to determine if the conditional formatting is applied. </p> <p> If comparison type is <A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_FORMULA"><CODE>CONDITION_TYPE_FORMULA</CODE></A> the formula MUST be a Boolean function </p> <P> <DD><DL> <DT><B>Returns:</B><DD>the first formula</DL> </DD> </DL> <HR> <A NAME="getFormula2()"><!-- --></A><H3> getFormula2</H3> <PRE> java.lang.String <B>getFormula2</B>()</PRE> <DL> <DD>The formula used to evaluate the second operand of the comparison when comparison type is <A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormattingRule.html#CONDITION_TYPE_CELL_VALUE_IS"><CODE>CONDITION_TYPE_CELL_VALUE_IS</CODE></A> and operator is either <A HREF="../../../../../org/apache/poi/ss/usermodel/ComparisonOperator.html#BETWEEN"><CODE>ComparisonOperator.BETWEEN</CODE></A> or <A HREF="../../../../../org/apache/poi/ss/usermodel/ComparisonOperator.html#NOT_BETWEEN"><CODE>ComparisonOperator.NOT_BETWEEN</CODE></A> <P> <DD><DL> <DT><B>Returns:</B><DD>the second formula</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ConditionalFormattingRule.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/apache/poi/ss/usermodel/ConditionalFormatting.html" title="interface in org.apache.poi.ss.usermodel"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../org/apache/poi/ss/usermodel/CreationHelper.html" title="interface in org.apache.poi.ss.usermodel"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/poi/ss/usermodel/ConditionalFormattingRule.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ConditionalFormattingRule.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <i>Copyright 2012 The Apache Software Foundation or its licensors, as applicable.</i> </BODY> </HTML>
Stephania16/ProductDesignGame
MinimaxAlgorithm/poi-3.8/docs/apidocs/org/apache/poi/ss/usermodel/ConditionalFormattingRule.html
HTML
apache-2.0
22,506
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 5890, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 30524, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2005-2017 Team Kodi * http://kodi.tv * * 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. * * You should have received a copy of the GNU General Public License * along with KODI; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "General.h" #include "addons/kodi-addon-dev-kit/include/kodi/General.h" #include "Application.h" #include "CompileInfo.h" #include "ServiceBroker.h" #include "addons/binary-addons/AddonDll.h" #include "addons/binary-addons/BinaryAddonManager.h" #include "addons/settings/GUIDialogAddonSettings.h" #include "dialogs/GUIDialogKaiToast.h" #include "filesystem/Directory.h" #include "filesystem/SpecialProtocol.h" #include "guilib/LocalizeStrings.h" #ifdef TARGET_POSIX #include "linux/XMemUtils.h" #endif #include "settings/Settings.h" #include "utils/CharsetConverter.h" #include "utils/log.h" #include "utils/LangCodeExpander.h" #include "utils/md5.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" #include <string.h> using namespace kodi; // addon-dev-kit namespace namespace ADDON { void Interface_General::Init(AddonGlobalInterface* addonInterface) { addonInterface->toKodi->kodi = static_cast<AddonToKodiFuncTable_kodi*>(malloc(sizeof(AddonToKodiFuncTable_kodi))); addonInterface->toKodi->kodi->get_addon_info = get_addon_info; addonInterface->toKodi->kodi->open_settings_dialog = open_settings_dialog; addonInterface->toKodi->kodi->get_localized_string = get_localized_string; addonInterface->toKodi->kodi->unknown_to_utf8 = unknown_to_utf8; addonInterface->toKodi->kodi->get_language = get_language; addonInterface->toKodi->kodi->queue_notification = queue_notification; addonInterface->toKodi->kodi->get_md5 = get_md5; addonInterface->toKodi->kodi->get_temp_path = get_temp_path; addonInterface->toKodi->kodi->get_region = get_region; addonInterface->toKodi->kodi->get_free_mem = get_free_mem; addonInterface->toKodi->kodi->get_global_idle_time = get_global_idle_time; addonInterface->toKodi->kodi->get_current_skin_id = get_current_skin_id; addonInterface->toKodi->kodi->kodi_version = kodi_version; } void Interface_General::DeInit(AddonGlobalInterface* addonInterface) { if (addonInterface->toKodi && /* <-- needed as long as the old addon way is used */ addonInterface->toKodi->kodi) { free(addonInterface->toKodi->kodi); addonInterface->toKodi->kodi = nullptr; } } char* Interface_General::get_addon_info(void* kodiBase, const char* id) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (addon == nullptr || id == nullptr) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', id='%p')", __FUNCTION__, addon, id); return nullptr; } std::string str; if (strcmpi(id, "author") == 0) str = addon->Author(); else if (strcmpi(id, "changelog") == 0) str = addon->ChangeLog(); else if (strcmpi(id, "description") == 0) str = addon->Description(); else if (strcmpi(id, "disclaimer") == 0) str = addon->Disclaimer(); else if (strcmpi(id, "fanart") == 0) str = addon->FanArt(); else if (strcmpi(id, "icon") == 0) str = addon->Icon(); else if (strcmpi(id, "id") == 0) str = addon->ID(); else if (strcmpi(id, "name") == 0) str = addon->Name(); else if (strcmpi(id, "path") == 0) str = addon->Path(); else if (strcmpi(id, "profile") == 0) str = addon->Profile(); else if (strcmpi(id, "summary") == 0) str = addon->Summary(); else if (strcmpi(id, "type") == 0) str = ADDON::CAddonInfo::TranslateType(addon->Type()); else if (strcmpi(id, "version") == 0) str = addon->Version().asString(); else { CLog::Log(LOGERROR, "Interface_General::%s - add-on '%s' requests invalid id '%s'", __FUNCTION__, addon->Name().c_str(), id); return nullptr; } char* buffer = strdup(str.c_str()); return buffer; } bool Interface_General::open_settings_dialog(void* kodiBase) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (addon == nullptr) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p')", __FUNCTION__, addon); return false; } // show settings dialog AddonPtr addonInfo; if (CAddonMgr::GetInstance().GetAddon(addon->ID(), addonInfo)) { CLog::Log(LOGERROR, "Interface_General::%s - Could not get addon information for '%s'", __FUNCTION__, addon->ID().c_str()); return false; } return CGUIDialogAddonSettings::ShowForAddon(addonInfo); } char* Interface_General::get_localized_string(void* kodiBase, long label_id) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (!addon) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p')", __FUNCTION__, addon); return nullptr; } if (g_application.m_bStop) return nullptr; std::string label = g_localizeStrings.GetAddonString(addon->ID(), label_id); if (label.empty()) label = g_localizeStrings.Get(label_id); char* buffer = strdup(label.c_str()); return buffer; } char* Interface_General::unknown_to_utf8(void* kodiBase, const char* source, bool* ret, bool failOnBadChar) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (!addon || !source || !ret) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', source='%p', ret='%p')", __FUNCTION__, addon, source, ret); return nullptr; } std::string string; *ret = g_charsetConverter.unknownToUTF8(source, string, failOnBadChar); char* buffer = strdup(string.c_str()); return buffer; } char* Interface_General::get_language(void* kodiBase, int format, bool region) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (!addon) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p')", __FUNCTION__, addon); return nullptr; } std::string string = g_langInfo.GetEnglishLanguageName(); switch (format) { case LANG_FMT_ISO_639_1: { std::string langCode; g_LangCodeExpander.ConvertToISO6391(string, langCode); string = langCode; if (region) { std::string region2Code; g_LangCodeExpander.ConvertToISO6391(g_langInfo.GetRegionLocale(), region2Code); if (!region2Code.empty()) string += "-" + region2Code; } break; } case LANG_FMT_ISO_639_2: { std::string langCode; g_LangCodeExpander.ConvertToISO6392B(string, langCode); string = langCode; if (region) { std::string region3Code; g_LangCodeExpander.ConvertToISO6392B(g_langInfo.GetRegionLocale(), region3Code); if (!region3Code.empty()) string += "-" + region3Code; } break; } case LANG_FMT_ENGLISH_NAME: default: { if (region) string += "-" + g_langInfo.GetCurrentRegion(); break; } } char* buffer = strdup(string.c_str()); return buffer; } bool Interface_General::queue_notification(void* kodiBase, int type, const char* header, const char* message, const char* imageFile, unsigned int displayTime, bool withSound, unsigned int messageTime) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (addon == nullptr || message == nullptr) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', message='%p')", __FUNCTION__, addon, message); return false; } std::string usedHeader; if (header && strlen(header) > 0) usedHeader = header; else usedHeader = addon->Name(); QueueMsg qtype = static_cast<QueueMsg>(type); if (qtype != QUEUE_OWN_STYLE) { CGUIDialogKaiToast::eMessageType usedType; switch (qtype) { case QUEUE_WARNING: usedType = CGUIDialogKaiToast::Warning; withSound = true; CLog::Log(LOGDEBUG, "Interface_General::%s - %s - Warning Message: '%s'", __FUNCTION__, addon->Name().c_str(), message); break; case QUEUE_ERROR: usedType = CGUIDialogKaiToast::Error; withSound = true; CLog::Log(LOGDEBUG, "Interface_General::%s - %s - Error Message : '%s'", __FUNCTION__, addon->Name().c_str(), message); break; case QUEUE_INFO: default: usedType = CGUIDialogKaiToast::Info; withSound = false; CLog::Log(LOGDEBUG, "Interface_General::%s - %s - Info Message : '%s'", __FUNCTION__, addon->Name().c_str(), message); break; } if (imageFile && strlen(imageFile) > 0) { CLog::Log(LOGERROR, "Interface_General::%s - To use given image file '%s' must be type value set to 'QUEUE_OWN_STYLE'", __FUNCTION__, imageFile); } CGUIDialogKaiToast::QueueNotification(usedType, usedHeader, message, 3000, withSound); } else { CGUIDialogKaiToast::QueueNotification(imageFile, usedHeader, message, displayTime, withSound, messageTime); } return true; } void Interface_General::get_md5(void* kodiBase, const char* text, char* md5) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (addon == nullptr || text == nullptr) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', text='%p')", __FUNCTION__, addon, text); return; } std::string md5Int = XBMC::XBMC_MD5::GetMD5(std::string(text)); strncpy(md5, md5Int.c_str(), 40); } char* Interface_General::get_temp_path(void* kodiBase) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (addon == nullptr) { CLog::Log(LOGERROR, "Interface_General::%s - called with empty kodi instance pointer", __FUNCTION__); return nullptr; } const std::string tempPath = URIUtils::AddFileToFolder(CServiceBroker::GetBinaryAddonManager().GetTempAddonBasePath(), addon->ID()); if (!XFILE::CDirectory::Exists(tempPath)) XFILE::CDirectory::Create(tempPath); return strdup(CSpecialProtocol::TranslatePath(tempPath).c_str()); } char* Interface_General::get_region(void* kodiBase, const char* id) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (addon == nullptr || id == nullptr) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', id='%p')", __FUNCTION__, addon, id); return nullptr; } std::string result; if (strcmpi(id, "datelong") == 0) { result = g_langInfo.GetDateFormat(true); StringUtils::Replace(result, "DDDD", "%A"); StringUtils::Replace(result, "MMMM", "%B"); StringUtils::Replace(result, "D", "%d"); StringUtils::Replace(result, "YYYY", "%Y"); } else if (strcmpi(id, "dateshort") == 0) { result = g_langInfo.GetDateFormat(false); StringUtils::Replace(result, "MM", "%m"); StringUtils::Replace(result, "DD", "%d"); #ifdef TARGET_WINDOWS StringUtils::Replace(result, "M", "%#m"); StringUtils::Replace(result, "D", "%#d"); #else StringUtils::Replace(result, "M", "%-m"); StringUtils::Replace(result, "D", "%-d"); #endif StringUtils::Replace(result, "YYYY", "%Y"); } else if (strcmpi(id, "tempunit") == 0) result = g_langInfo.GetTemperatureUnitString(); else if (strcmpi(id, "speedunit") == 0) result = g_langInfo.GetSpeedUnitString(); else if (strcmpi(id, "time") == 0) { result = g_langInfo.GetTimeFormat(); StringUtils::Replace(result, "H", "%H"); StringUtils::Replace(result, "h", "%I"); StringUtils::Replace(result, "mm", "%M"); StringUtils::Replace(result, "ss", "%S"); StringUtils::Replace(result, "xx", "%p"); } else if (strcmpi(id, "meridiem") == 0) result = StringUtils::Format("%s/%s", g_langInfo.GetMeridiemSymbol(MeridiemSymbolAM).c_str(), g_langInfo.GetMeridiemSymbol(MeridiemSymbolPM).c_str()); else { CLog::Log(LOGERROR, "Interface_General::%s - add-on '%s' requests invalid id '%s'", __FUNCTION__, addon->Name().c_str(), id); return nullptr; } char* buffer = strdup(result.c_str()); return buffer; } void Interface_General::get_free_mem(void* kodiBase, long* free, long* total, bool as_bytes) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (addon == nullptr || free == nullptr || total == nullptr) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', free='%p', total='%p')", __FUNCTION__, addon, free, total); return; } MEMORYSTATUSEX stat; stat.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&stat); *free = static_cast<long>(stat.ullAvailPhys); *total = static_cast<long>(stat.ullTotalPhys); if (!as_bytes) { *free = *free / ( 1024 * 1024 ); *total = *total / ( 1024 * 1024 ); } } int Interface_General::get_global_idle_time(void* kodiBase) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (addon == nullptr) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p')", __FUNCTION__, addon); return -1; } return g_application.GlobalIdleTime(); } char* Interface_General::get_current_skin_id(void* kodiBase) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (addon == nullptr) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p')", __FUNCTION__, addon); return nullptr; } return strdup(CServiceBroker::GetSettings().GetString(CSettings::SETTING_LOOKANDFEEL_SKIN).c_str()); } void Interface_General::kodi_version(void* kodiBase, char** compile_name, int* major, int* minor, char** revision, char** tag, char** tagversion) { CAddonDll* addon = static_cast<CAddonDll*>(kodiBase); if (addon == nullptr || compile_name == nullptr || major == nullptr || minor == nullptr || revision == nullptr || tag == nullptr || tagversion == nullptr) { CLog::Log(LOGERROR, "Interface_General::%s - invalid data (addon='%p', compile_name='%p', major='%p', minor='%p', revision='%p', tag='%p', tagversion='%p')", __FUNCTION__, addon, compile_name, major, minor, revision, tag, tagversion); return; } *compile_name = strdup(CCompileInfo::GetAppName()); *major = CCompileInfo::GetMajor(); *minor = CCompileInfo::GetMinor(); *revision = strdup(CCompileInfo::GetSCMID()); std::string tagStr = CCompileInfo::GetSuffix(); if (StringUtils::StartsWithNoCase(tagStr, "alpha")) { *tag = strdup("alpha"); *tagversion = strdup(StringUtils::Mid(tagStr, 5).c_str()); } else if (StringUtils::StartsWithNoCase(tagStr, "beta")) { *tag = strdup("beta"); *tagversion = strdup(StringUtils::Mid(tagStr, 4).c_str()); } else if (StringUtils::StartsWithNoCase(tagStr, "rc")) { *tag = strdup("releasecandidate"); *tagversion = strdup(StringUtils::Mid(tagStr, 2).c_str()); } else if (tagStr.empty()) *tag = strdup("stable"); else *tag = strdup("prealpha"); } } /* namespace ADDON */
cedricde/xbmc
xbmc/addons/interfaces/General.cpp
C++
gpl-2.0
15,299
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2384, 1011, 2418, 2136, 12849, 4305, 1008, 8299, 1024, 1013, 1013, 12849, 4305, 1012, 2694, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
from __future__ import division, print_function #, unicode_literals """ Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ import numpy as np # Setup. num_max = 1000 basis = [3, 5] factors = [] for i in range(num_max): for k in basis: if not i % k: factors.append(i) break print('\nRange: {:d}'.format(num_max)) print('Number of factors: {:d}'.format(len(factors))) print('The answer: {:d}'.format(np.sum(factors))) # Done.
Who8MyLunch/euler
problem_001.py
Python
mit
632
[ 30522, 2013, 1035, 1035, 2925, 1035, 1035, 12324, 2407, 1010, 6140, 1035, 3853, 1001, 1010, 27260, 1035, 18204, 2015, 1000, 1000, 1000, 3674, 2015, 1997, 1017, 1998, 1019, 2065, 2057, 2862, 2035, 1996, 3019, 3616, 2917, 2184, 2008, 2024, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Created by siddharthsharma on 5/21/16. */ var React = require('react'); var Contact = require('./contact/app-catalog'); var Cart = require('./cart/app-cart'); var Router = require('react-router-component'); var CatalogDetail = require('./product/app-catalogdetail'); var Template = require('./app-template.js'); var Locations = Router.Locations; var Location = Router.Location; var App = React.createClass({ render:function(){ return ( <Template> <Locations> <Location path="/" handler={Catalog} /> <Location path="/cart" handler={Cart} /> <Location path="/item/:item" handler={CatalogDetail} /> </Locations> </Template> ); } }); module.exports = App;
hearsid/react-contacts-manager
app/js/components/app.js
JavaScript
mit
772
[ 30522, 1013, 1008, 1008, 1008, 2580, 2011, 15765, 25632, 26830, 8167, 2863, 2006, 1019, 1013, 2538, 1013, 2385, 1012, 1008, 1013, 13075, 10509, 1027, 5478, 1006, 1005, 10509, 1005, 1007, 1025, 13075, 3967, 1027, 5478, 1006, 1005, 1012, 1013...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include "VideoCapturePerc.h" #ifndef __NENA_VIDEOFACEPERC_INCLUDED__ #define __NENA_VIDEOFACEPERC_INCLUDED__ namespace Nena { namespace Video { namespace Perc { namespace Tracking { struct Face : public Utility::BasicStatus<> { static UINT32 const DefaultProfile = UINT_ERROR; static UINT32 const FirstSuccessfulQuery = UINT_ERROR - 1; typedef void Action; typedef HRESULT Result; typedef pxcStatus Status; PXCSmartPtr<PXCFaceAnalysis> Base; PXCFaceAnalysis::Landmark *Landmark; PXCFaceAnalysis::Detection *Detection; BOOL Paused; BOOL Enabled; UINT32 DescIndex; PXCSession::ImplDesc Desc; PXCFaceAnalysis::ProfileInfo Profile; PXCFaceAnalysis::Landmark::ProfileInfo LandmarkProfile; PXCFaceAnalysis::Detection::ProfileInfo DetectionProfile; Face(_In_ Capture *capture); Face(_In_ PXCSession *session); Action Init(_In_ Capture *capture); Action Init(_In_ PXCSession *session); Action PauseFaceAnalysis(_In_ BOOL paused); Action SubmitRequirements(_Inout_ Capture *host); Action SetProfile(void); Action SetLandmarkProfile(void); Action SetDetectionProfile(void); Action SearchProfile(_In_opt_ UINT32 option = FirstSuccessfulQuery); Action SearchLandmarkProfile(_In_opt_ UINT32 option = FirstSuccessfulQuery); Action SearchDetectionProfile(_In_opt_ UINT32 option = FirstSuccessfulQuery); Status SubmitProcessTask(_Inout_ Sample *sample); Status SubmitProcessTask(_In_ PXCImage *images[], _Outref_ PXCScheduler::SyncPoint **sync); Status SubmitProcessTask(_Inout_ Sample *sample, _In_range_(0, Sample::MaxStreams) UINT32 syncIdx); Status SubmitProcessTaskUnsafe(_Inout_ Sample *sample); Status SubmitProcessTaskUnsafe(_In_ PXCImage *images[], _Outref_ PXCScheduler::SyncPoint **sync); Status SubmitProcessTaskUnsafe(_Inout_ Sample *sample, _In_range_(0, Sample::MaxStreams) UINT32 syncIdx); UINT32 GetLastFaceCount(_Inout_opt_ Status *lastStatus = nullptr); }; } } } } #endif // !__NENA_VIDEOFACEPERC_INCLUDED__
VladSerhiienko/Nena.v.1
Libs/Recognizing/VideoTrackingFacePerc.h
C
gpl-2.0
2,126
[ 30522, 1001, 2421, 1000, 2678, 17695, 11244, 4842, 2278, 1012, 1044, 1000, 1001, 2065, 13629, 2546, 1035, 1035, 11265, 2532, 1035, 2678, 12172, 4842, 2278, 1035, 2443, 1035, 1035, 1001, 9375, 1035, 1035, 11265, 2532, 1035, 2678, 12172, 4842...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet Devices * * Copyright (C) 2011-2013 ASIX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include <linux/module.h> #include <linux/etherdevice.h> #include <linux/mii.h> #include <linux/usb.h> #include <linux/crc32.h> #include <linux/usb/usbnet.h> #include <uapi/linux/mdio.h> #include <linux/mdio.h> #define AX88179_PHY_ID 0x03 #define AX_EEPROM_LEN 0x100 #define AX88179_EEPROM_MAGIC 0x17900b95 #define AX_MCAST_FLTSIZE 8 #define AX_MAX_MCAST 64 #define AX_INT_PPLS_LINK ((u32)BIT(16)) #define AX_RXHDR_L4_TYPE_MASK 0x1c #define AX_RXHDR_L4_TYPE_UDP 4 #define AX_RXHDR_L4_TYPE_TCP 16 #define AX_RXHDR_L3CSUM_ERR 2 #define AX_RXHDR_L4CSUM_ERR 1 #define AX_RXHDR_CRC_ERR ((u32)BIT(29)) #define AX_RXHDR_DROP_ERR ((u32)BIT(31)) #define AX_ACCESS_MAC 0x01 #define AX_ACCESS_PHY 0x02 #define AX_ACCESS_EEPROM 0x04 #define AX_ACCESS_EFUS 0x05 #define AX_PAUSE_WATERLVL_HIGH 0x54 #define AX_PAUSE_WATERLVL_LOW 0x55 #define PHYSICAL_LINK_STATUS 0x02 #define AX_USB_SS 0x04 #define AX_USB_HS 0x02 #define GENERAL_STATUS 0x03 /* Check AX88179 version. UA1:Bit2 = 0, UA2:Bit2 = 1 */ #define AX_SECLD 0x04 #define AX_SROM_ADDR 0x07 #define AX_SROM_CMD 0x0a #define EEP_RD 0x04 #define EEP_BUSY 0x10 #define AX_SROM_DATA_LOW 0x08 #define AX_SROM_DATA_HIGH 0x09 #define AX_RX_CTL 0x0b #define AX_RX_CTL_DROPCRCERR 0x0100 #define AX_RX_CTL_IPE 0x0200 #define AX_RX_CTL_START 0x0080 #define AX_RX_CTL_AP 0x0020 #define AX_RX_CTL_AM 0x0010 #define AX_RX_CTL_AB 0x0008 #define AX_RX_CTL_AMALL 0x0002 #define AX_RX_CTL_PRO 0x0001 #define AX_RX_CTL_STOP 0x0000 #define AX_NODE_ID 0x10 #define AX_MULFLTARY 0x16 #define AX_MEDIUM_STATUS_MODE 0x22 #define AX_MEDIUM_GIGAMODE 0x01 #define AX_MEDIUM_FULL_DUPLEX 0x02 #define AX_MEDIUM_EN_125MHZ 0x08 #define AX_MEDIUM_RXFLOW_CTRLEN 0x10 #define AX_MEDIUM_TXFLOW_CTRLEN 0x20 #define AX_MEDIUM_RECEIVE_EN 0x100 #define AX_MEDIUM_PS 0x200 #define AX_MEDIUM_JUMBO_EN 0x8040 #define AX_MONITOR_MOD 0x24 #define AX_MONITOR_MODE_RWLC 0x02 #define AX_MONITOR_MODE_RWMP 0x04 #define AX_MONITOR_MODE_PMEPOL 0x20 #define AX_MONITOR_MODE_PMETYPE 0x40 #define AX_GPIO_CTRL 0x25 #define AX_GPIO_CTRL_GPIO3EN 0x80 #define AX_GPIO_CTRL_GPIO2EN 0x40 #define AX_GPIO_CTRL_GPIO1EN 0x20 #define AX_PHYPWR_RSTCTL 0x26 #define AX_PHYPWR_RSTCTL_BZ 0x0010 #define AX_PHYPWR_RSTCTL_IPRL 0x0020 #define AX_PHYPWR_RSTCTL_AT 0x1000 #define AX_RX_BULKIN_QCTRL 0x2e #define AX_CLK_SELECT 0x33 #define AX_CLK_SELECT_BCS 0x01 #define AX_CLK_SELECT_ACS 0x02 #define AX_CLK_SELECT_ULR 0x08 #define AX_RXCOE_CTL 0x34 #define AX_RXCOE_IP 0x01 #define AX_RXCOE_TCP 0x02 #define AX_RXCOE_UDP 0x04 #define AX_RXCOE_TCPV6 0x20 #define AX_RXCOE_UDPV6 0x40 #define AX_TXCOE_CTL 0x35 #define AX_TXCOE_IP 0x01 #define AX_TXCOE_TCP 0x02 #define AX_TXCOE_UDP 0x04 #define AX_TXCOE_TCPV6 0x20 #define AX_TXCOE_UDPV6 0x40 #define AX_LEDCTRL 0x73 #define GMII_PHY_PHYSR 0x11 #define GMII_PHY_PHYSR_SMASK 0xc000 #define GMII_PHY_PHYSR_GIGA 0x8000 #define GMII_PHY_PHYSR_100 0x4000 #define GMII_PHY_PHYSR_FULL 0x2000 #define GMII_PHY_PHYSR_LINK 0x400 #define GMII_LED_ACT 0x1a #define GMII_LED_ACTIVE_MASK 0xff8f #define GMII_LED0_ACTIVE BIT(4) #define GMII_LED1_ACTIVE BIT(5) #define GMII_LED2_ACTIVE BIT(6) #define GMII_LED_LINK 0x1c #define GMII_LED_LINK_MASK 0xf888 #define GMII_LED0_LINK_10 BIT(0) #define GMII_LED0_LINK_100 BIT(1) #define GMII_LED0_LINK_1000 BIT(2) #define GMII_LED1_LINK_10 BIT(4) #define GMII_LED1_LINK_100 BIT(5) #define GMII_LED1_LINK_1000 BIT(6) #define GMII_LED2_LINK_10 BIT(8) #define GMII_LED2_LINK_100 BIT(9) #define GMII_LED2_LINK_1000 BIT(10) #define LED0_ACTIVE BIT(0) #define LED0_LINK_10 BIT(1) #define LED0_LINK_100 BIT(2) #define LED0_LINK_1000 BIT(3) #define LED0_FD BIT(4) #define LED0_USB3_MASK 0x001f #define LED1_ACTIVE BIT(5) #define LED1_LINK_10 BIT(6) #define LED1_LINK_100 BIT(7) #define LED1_LINK_1000 BIT(8) #define LED1_FD BIT(9) #define LED1_USB3_MASK 0x03e0 #define LED2_ACTIVE BIT(10) #define LED2_LINK_1000 BIT(13) #define LED2_LINK_100 BIT(12) #define LED2_LINK_10 BIT(11) #define LED2_FD BIT(14) #define LED_VALID BIT(15) #define LED2_USB3_MASK 0x7c00 #define GMII_PHYPAGE 0x1e #define GMII_PHY_PAGE_SELECT 0x1f #define GMII_PHY_PGSEL_EXT 0x0007 #define GMII_PHY_PGSEL_PAGE0 0x0000 #define GMII_PHY_PGSEL_PAGE3 0x0003 #define GMII_PHY_PGSEL_PAGE5 0x0005 struct ax88179_data { u8 eee_enabled; u8 eee_active; u16 rxctl; u16 reserved; }; struct ax88179_int_data { __le32 intdata1; __le32 intdata2; }; static const struct { unsigned char ctrl, timer_l, timer_h, size, ifg; } AX88179_BULKIN_SIZE[] = { {7, 0x4f, 0, 0x12, 0xff}, {7, 0x20, 3, 0x16, 0xff}, {7, 0xae, 7, 0x18, 0xff}, {7, 0xcc, 0x4c, 0x18, 8}, }; static int __ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, u16 size, void *data, int in_pm) { int ret; int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16); BUG_ON(!dev); if (!in_pm) fn = usbnet_read_cmd; else fn = usbnet_read_cmd_nopm; ret = fn(dev, cmd, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, data, size); if (unlikely(ret < 0)) netdev_warn(dev->net, "Failed to read reg index 0x%04x: %d\n", index, ret); return ret; } static int __ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, u16 size, void *data, int in_pm) { int ret; int (*fn)(struct usbnet *, u8, u8, u16, u16, const void *, u16); BUG_ON(!dev); if (!in_pm) fn = usbnet_write_cmd; else fn = usbnet_write_cmd_nopm; ret = fn(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, data, size); if (unlikely(ret < 0)) netdev_warn(dev->net, "Failed to write reg index 0x%04x: %d\n", index, ret); return ret; } static void ax88179_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index, u16 size, void *data) { u16 buf; if (2 == size) { buf = *((u16 *)data); cpu_to_le16s(&buf); usbnet_write_cmd_async(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, &buf, size); } else { usbnet_write_cmd_async(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, data, size); } } static int ax88179_read_cmd_nopm(struct usbnet *dev, u8 cmd, u16 value, u16 index, u16 size, void *data) { int ret; if (2 == size) { u16 buf; ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 1); le16_to_cpus(&buf); *((u16 *)data) = buf; } else if (4 == size) { u32 buf; ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 1); le32_to_cpus(&buf); *((u32 *)data) = buf; } else { ret = __ax88179_read_cmd(dev, cmd, value, index, size, data, 1); } return ret; } static int ax88179_write_cmd_nopm(struct usbnet *dev, u8 cmd, u16 value, u16 index, u16 size, void *data) { int ret; if (2 == size) { u16 buf; buf = *((u16 *)data); cpu_to_le16s(&buf); ret = __ax88179_write_cmd(dev, cmd, value, index, size, &buf, 1); } else { ret = __ax88179_write_cmd(dev, cmd, value, index, size, data, 1); } return ret; } static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, u16 size, void *data) { int ret; if (2 == size) { u16 buf; ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 0); le16_to_cpus(&buf); *((u16 *)data) = buf; } else if (4 == size) { u32 buf; ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 0); le32_to_cpus(&buf); *((u32 *)data) = buf; } else { ret = __ax88179_read_cmd(dev, cmd, value, index, size, data, 0); } return ret; } static int ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, u16 size, void *data) { int ret; if (2 == size) { u16 buf; buf = *((u16 *)data); cpu_to_le16s(&buf); ret = __ax88179_write_cmd(dev, cmd, value, index, size, &buf, 0); } else { ret = __ax88179_write_cmd(dev, cmd, value, index, size, data, 0); } return ret; } static void ax88179_status(struct usbnet *dev, struct urb *urb) { struct ax88179_int_data *event; u32 link; if (urb->actual_length < 8) return; event = urb->transfer_buffer; le32_to_cpus((void *)&event->intdata1); link = (((__force u32)event->intdata1) & AX_INT_PPLS_LINK) >> 16; if (netif_carrier_ok(dev->net) != link) { usbnet_link_change(dev, link, 1); netdev_info(dev->net, "ax88179 - Link status is: %d\n", link); } } static int ax88179_mdio_read(struct net_device *netdev, int phy_id, int loc) { struct usbnet *dev = netdev_priv(netdev); u16 res; ax88179_read_cmd(dev, AX_ACCESS_PHY, phy_id, (__u16)loc, 2, &res); return res; } static void ax88179_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) { struct usbnet *dev = netdev_priv(netdev); u16 res = (u16) val; ax88179_write_cmd(dev, AX_ACCESS_PHY, phy_id, (__u16)loc, 2, &res); } static inline int ax88179_phy_mmd_indirect(struct usbnet *dev, u16 prtad, u16 devad) { u16 tmp16; int ret; tmp16 = devad; ret = ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, MII_MMD_CTRL, 2, &tmp16); tmp16 = prtad; ret = ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, MII_MMD_DATA, 2, &tmp16); tmp16 = devad | MII_MMD_CTRL_NOINCR; ret = ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, MII_MMD_CTRL, 2, &tmp16); return ret; } static int ax88179_phy_read_mmd_indirect(struct usbnet *dev, u16 prtad, u16 devad) { int ret; u16 tmp16; ax88179_phy_mmd_indirect(dev, prtad, devad); ret = ax88179_read_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, MII_MMD_DATA, 2, &tmp16); if (ret < 0) return ret; return tmp16; } static int ax88179_phy_write_mmd_indirect(struct usbnet *dev, u16 prtad, u16 devad, u16 data) { int ret; ax88179_phy_mmd_indirect(dev, prtad, devad); ret = ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, MII_MMD_DATA, 2, &data); if (ret < 0) return ret; return 0; } static int ax88179_suspend(struct usb_interface *intf, pm_message_t message) { struct usbnet *dev = usb_get_intfdata(intf); u16 tmp16; u8 tmp8; usbnet_suspend(intf, message); /* Disable RX path */ ax88179_read_cmd_nopm(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, &tmp16); tmp16 &= ~AX_MEDIUM_RECEIVE_EN; ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, &tmp16); /* Force bulk-in zero length */ ax88179_read_cmd_nopm(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16); tmp16 |= AX_PHYPWR_RSTCTL_BZ | AX_PHYPWR_RSTCTL_IPRL; ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16); /* change clock */ tmp8 = 0; ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8); /* Configure RX control register => stop operation */ tmp16 = AX_RX_CTL_STOP; ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &tmp16); return 0; } /* This function is used to enable the autodetach function. */ /* This function is determined by offset 0x43 of EEPROM */ static int ax88179_auto_detach(struct usbnet *dev, int in_pm) { u16 tmp16; u8 tmp8; int (*fnr)(struct usbnet *, u8, u16, u16, u16, void *); int (*fnw)(struct usbnet *, u8, u16, u16, u16, void *); if (!in_pm) { fnr = ax88179_read_cmd; fnw = ax88179_write_cmd; } else { fnr = ax88179_read_cmd_nopm; fnw = ax88179_write_cmd_nopm; } if (fnr(dev, AX_ACCESS_EEPROM, 0x43, 1, 2, &tmp16) < 0) return 0; if ((tmp16 == 0xFFFF) || (!(tmp16 & 0x0100))) return 0; /* Enable Auto Detach bit */ tmp8 = 0; fnr(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8); tmp8 |= AX_CLK_SELECT_ULR; fnw(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8); fnr(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16); tmp16 |= AX_PHYPWR_RSTCTL_AT; fnw(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16); return 0; } static int ax88179_resume(struct usb_interface *intf) { struct usbnet *dev = usb_get_intfdata(intf); u16 tmp16; u8 tmp8; usbnet_link_change(dev, 0, 0); /* Power up ethernet PHY */ tmp16 = 0; ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16); udelay(1000); tmp16 = AX_PHYPWR_RSTCTL_IPRL; ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16); msleep(200); /* Ethernet PHY Auto Detach*/ ax88179_auto_detach(dev, 1); /* Enable clock */ ax88179_read_cmd_nopm(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8); tmp8 |= AX_CLK_SELECT_ACS | AX_CLK_SELECT_BCS; ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8); msleep(100); /* Configure RX control register => start operation */ tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_IPE | AX_RX_CTL_START | AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB; ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &tmp16); return usbnet_resume(intf); } static void ax88179_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) { struct usbnet *dev = netdev_priv(net); u8 opt; if (ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MONITOR_MOD, 1, 1, &opt) < 0) { wolinfo->supported = 0; wolinfo->wolopts = 0; return; } wolinfo->supported = WAKE_PHY | WAKE_MAGIC; wolinfo->wolopts = 0; if (opt & AX_MONITOR_MODE_RWLC) wolinfo->wolopts |= WAKE_PHY; if (opt & AX_MONITOR_MODE_RWMP) wolinfo->wolopts |= WAKE_MAGIC; } static int ax88179_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) { struct usbnet *dev = netdev_priv(net); u8 opt = 0; if (wolinfo->wolopts & WAKE_PHY) opt |= AX_MONITOR_MODE_RWLC; if (wolinfo->wolopts & WAKE_MAGIC) opt |= AX_MONITOR_MODE_RWMP; if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MONITOR_MOD, 1, 1, &opt) < 0) return -EINVAL; return 0; } static int ax88179_get_eeprom_len(struct net_device *net) { return AX_EEPROM_LEN; } static int ax88179_get_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom, u8 *data) { struct usbnet *dev = netdev_priv(net); u16 *eeprom_buff; int first_word, last_word; int i, ret; if (eeprom->len == 0) return -EINVAL; eeprom->magic = AX88179_EEPROM_MAGIC; first_word = eeprom->offset >> 1; last_word = (eeprom->offset + eeprom->len - 1) >> 1; eeprom_buff = kmalloc(sizeof(u16) * (last_word - first_word + 1), GFP_KERNEL); if (!eeprom_buff) return -ENOMEM; /* ax88179/178A returns 2 bytes from eeprom on read */ for (i = first_word; i <= last_word; i++) { ret = __ax88179_read_cmd(dev, AX_ACCESS_EEPROM, i, 1, 2, &eeprom_buff[i - first_word], 0); if (ret < 0) { kfree(eeprom_buff); return -EIO; } } memcpy(data, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len); kfree(eeprom_buff); return 0; } static int ax88179_get_settings(struct net_device *net, struct ethtool_cmd *cmd) { struct usbnet *dev = netdev_priv(net); return mii_ethtool_gset(&dev->mii, cmd); } static int ax88179_set_settings(struct net_device *net, struct ethtool_cmd *cmd) { struct usbnet *dev = netdev_priv(net); return mii_ethtool_sset(&dev->mii, cmd); } static int ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_eee *data) { int val; /* Get Supported EEE */ val = ax88179_phy_read_mmd_indirect(dev, MDIO_PCS_EEE_ABLE, MDIO_MMD_PCS); if (val < 0) return val; data->supported = mmd_eee_cap_to_ethtool_sup_t(val); /* Get advertisement EEE */ val = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_ADV, MDIO_MMD_AN); if (val < 0) return val; data->advertised = mmd_eee_adv_to_ethtool_adv_t(val); /* Get LP advertisement EEE */ val = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_LPABLE, MDIO_MMD_AN); if (val < 0) return val; data->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(val); return 0; } static int ax88179_ethtool_set_eee(struct usbnet *dev, struct ethtool_eee *data) { u16 tmp16 = ethtool_adv_to_mmd_eee_adv_t(data->advertised); return ax88179_phy_write_mmd_indirect(dev, MDIO_AN_EEE_ADV, MDIO_MMD_AN, tmp16); } static int ax88179_chk_eee(struct usbnet *dev) { struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET }; struct ax88179_data *priv = (struct ax88179_data *)dev->data; mii_ethtool_gset(&dev->mii, &ecmd); if (ecmd.duplex & DUPLEX_FULL) { int eee_lp, eee_cap, eee_adv; u32 lp, cap, adv, supported = 0; eee_cap = ax88179_phy_read_mmd_indirect(dev, MDIO_PCS_EEE_ABLE, MDIO_MMD_PCS); if (eee_cap < 0) { priv->eee_active = 0; return false; } cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap); if (!cap) { priv->eee_active = 0; return false; } eee_lp = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_LPABLE, MDIO_MMD_AN); if (eee_lp < 0) { priv->eee_active = 0; return false; } eee_adv = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_ADV, MDIO_MMD_AN); if (eee_adv < 0) { priv->eee_active = 0; return false; } adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); supported = (ecmd.speed == SPEED_1000) ? SUPPORTED_1000baseT_Full : SUPPORTED_100baseT_Full; if (!(lp & adv & supported)) { priv->eee_active = 0; return false; } priv->eee_active = 1; return true; } priv->eee_active = 0; return false; } static void ax88179_disable_eee(struct usbnet *dev) { u16 tmp16; tmp16 = GMII_PHY_PGSEL_PAGE3; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHY_PAGE_SELECT, 2, &tmp16); tmp16 = 0x3246; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, MII_PHYADDR, 2, &tmp16); tmp16 = GMII_PHY_PGSEL_PAGE0; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHY_PAGE_SELECT, 2, &tmp16); } static void ax88179_enable_eee(struct usbnet *dev) { u16 tmp16; tmp16 = GMII_PHY_PGSEL_PAGE3; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHY_PAGE_SELECT, 2, &tmp16); tmp16 = 0x3247; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, MII_PHYADDR, 2, &tmp16); tmp16 = GMII_PHY_PGSEL_PAGE5; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHY_PAGE_SELECT, 2, &tmp16); tmp16 = 0x0680; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, MII_BMSR, 2, &tmp16); tmp16 = GMII_PHY_PGSEL_PAGE0; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHY_PAGE_SELECT, 2, &tmp16); } static int ax88179_get_eee(struct net_device *net, struct ethtool_eee *edata) { struct usbnet *dev = netdev_priv(net); struct ax88179_data *priv = (struct ax88179_data *)dev->data; edata->eee_enabled = priv->eee_enabled; edata->eee_active = priv->eee_active; return ax88179_ethtool_get_eee(dev, edata); } static int ax88179_set_eee(struct net_device *net, struct ethtool_eee *edata) { struct usbnet *dev = netdev_priv(net); struct ax88179_data *priv = (struct ax88179_data *)dev->data; int ret = -EOPNOTSUPP; priv->eee_enabled = edata->eee_enabled; if (!priv->eee_enabled) { ax88179_disable_eee(dev); } else { priv->eee_enabled = ax88179_chk_eee(dev); if (!priv->eee_enabled) return -EOPNOTSUPP; ax88179_enable_eee(dev); } ret = ax88179_ethtool_set_eee(dev, edata); if (ret) return ret; mii_nway_restart(&dev->mii); usbnet_link_change(dev, 0, 0); return ret; } static int ax88179_ioctl(struct net_device *net, struct ifreq *rq, int cmd) { struct usbnet *dev = netdev_priv(net); return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); } static const struct ethtool_ops ax88179_ethtool_ops = { .get_link = ethtool_op_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel, .get_wol = ax88179_get_wol, .set_wol = ax88179_set_wol, .get_eeprom_len = ax88179_get_eeprom_len, .get_eeprom = ax88179_get_eeprom, .get_settings = ax88179_get_settings, .set_settings = ax88179_set_settings, .get_eee = ax88179_get_eee, .set_eee = ax88179_set_eee, .nway_reset = usbnet_nway_reset, }; static void ax88179_set_multicast(struct net_device *net) { struct usbnet *dev = netdev_priv(net); struct ax88179_data *data = (struct ax88179_data *)dev->data; u8 *m_filter = ((u8 *)dev->data) + 12; data->rxctl = (AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_CTL_IPE); if (net->flags & IFF_PROMISC) { data->rxctl |= AX_RX_CTL_PRO; } else if (net->flags & IFF_ALLMULTI || netdev_mc_count(net) > AX_MAX_MCAST) { data->rxctl |= AX_RX_CTL_AMALL; } else if (netdev_mc_empty(net)) { /* just broadcast and directed */ } else { /* We use the 20 byte dev->data for our 8 byte filter buffer * to avoid allocating memory that is tricky to free later */ u32 crc_bits; struct netdev_hw_addr *ha; memset(m_filter, 0, AX_MCAST_FLTSIZE); netdev_for_each_mc_addr(ha, net) { crc_bits = ether_crc(ETH_ALEN, ha->addr) >> 26; *(m_filter + (crc_bits >> 3)) |= (1 << (crc_bits & 7)); } ax88179_write_cmd_async(dev, AX_ACCESS_MAC, AX_MULFLTARY, AX_MCAST_FLTSIZE, AX_MCAST_FLTSIZE, m_filter); data->rxctl |= AX_RX_CTL_AM; } ax88179_write_cmd_async(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &data->rxctl); } static int ax88179_set_features(struct net_device *net, netdev_features_t features) { u8 tmp; struct usbnet *dev = netdev_priv(net); netdev_features_t changed = net->features ^ features; if (changed & NETIF_F_IP_CSUM) { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, &tmp); tmp ^= AX_TXCOE_TCP | AX_TXCOE_UDP; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, &tmp); } if (changed & NETIF_F_IPV6_CSUM) { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, &tmp); tmp ^= AX_TXCOE_TCPV6 | AX_TXCOE_UDPV6; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, &tmp); } if (changed & NETIF_F_RXCSUM) { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_RXCOE_CTL, 1, 1, &tmp); tmp ^= AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RXCOE_CTL, 1, 1, &tmp); } return 0; } static int ax88179_change_mtu(struct net_device *net, int new_mtu) { struct usbnet *dev = netdev_priv(net); u16 tmp16; if (new_mtu <= 0 || new_mtu > 4088) return -EINVAL; net->mtu = new_mtu; dev->hard_mtu = net->mtu + net->hard_header_len; if (net->mtu > 1500) { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, &tmp16); tmp16 |= AX_MEDIUM_JUMBO_EN; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, &tmp16); } else { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, &tmp16); tmp16 &= ~AX_MEDIUM_JUMBO_EN; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, &tmp16); } /* max qlen depend on hard_mtu and rx_urb_size */ usbnet_update_max_qlen(dev); return 0; } static int ax88179_set_mac_addr(struct net_device *net, void *p) { struct usbnet *dev = netdev_priv(net); struct sockaddr *addr = p; int ret; if (netif_running(net)) return -EBUSY; if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; memcpy(net->dev_addr, addr->sa_data, ETH_ALEN); /* Set the MAC address */ ret = ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, ETH_ALEN, net->dev_addr); if (ret < 0) return ret; return 0; } static const struct net_device_ops ax88179_netdev_ops = { .ndo_open = usbnet_open, .ndo_stop = usbnet_stop, .ndo_start_xmit = usbnet_start_xmit, .ndo_tx_timeout = usbnet_tx_timeout, .ndo_change_mtu = ax88179_change_mtu, .ndo_set_mac_address = ax88179_set_mac_addr, .ndo_validate_addr = eth_validate_addr, .ndo_do_ioctl = ax88179_ioctl, .ndo_set_rx_mode = ax88179_set_multicast, .ndo_set_features = ax88179_set_features, }; static int ax88179_check_eeprom(struct usbnet *dev) { u8 i, buf, eeprom[20]; u16 csum, delay = HZ / 10; unsigned long jtimeout; /* Read EEPROM content */ for (i = 0; i < 6; i++) { buf = i; if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_SROM_ADDR, 1, 1, &buf) < 0) return -EINVAL; buf = EEP_RD; if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD, 1, 1, &buf) < 0) return -EINVAL; jtimeout = jiffies + delay; do { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD, 1, 1, &buf); if (time_after(jiffies, jtimeout)) return -EINVAL; } while (buf & EEP_BUSY); __ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_DATA_LOW, 2, 2, &eeprom[i * 2], 0); if ((i == 0) && (eeprom[0] == 0xFF)) return -EINVAL; } csum = eeprom[6] + eeprom[7] + eeprom[8] + eeprom[9]; csum = (csum >> 8) + (csum & 0xff); if ((csum + eeprom[10]) != 0xff) return -EINVAL; return 0; } static int ax88179_check_efuse(struct usbnet *dev, u16 *ledmode) { u8 i; u8 efuse[64]; u16 csum = 0; if (ax88179_read_cmd(dev, AX_ACCESS_EFUS, 0, 64, 64, efuse) < 0) return -EINVAL; if (*efuse == 0xFF) return -EINVAL; for (i = 0; i < 64; i++) csum = csum + efuse[i]; while (csum > 255) csum = (csum & 0x00FF) + ((csum >> 8) & 0x00FF); if (csum != 0xFF) return -EINVAL; *ledmode = (efuse[51] << 8) | efuse[52]; return 0; } static int ax88179_convert_old_led(struct usbnet *dev, u16 *ledvalue) { u16 led; /* Loaded the old eFuse LED Mode */ if (ax88179_read_cmd(dev, AX_ACCESS_EEPROM, 0x3C, 1, 2, &led) < 0) return -EINVAL; led >>= 8; switch (led) { case 0xFF: led = LED0_ACTIVE | LED1_LINK_10 | LED1_LINK_100 | LED1_LINK_1000 | LED2_ACTIVE | LED2_LINK_10 | LED2_LINK_100 | LED2_LINK_1000 | LED_VALID; break; case 0xFE: led = LED0_ACTIVE | LED1_LINK_1000 | LED2_LINK_100 | LED_VALID; break; case 0xFD: led = LED0_ACTIVE | LED1_LINK_1000 | LED2_LINK_100 | LED2_LINK_10 | LED_VALID; break; case 0xFC: led = LED0_ACTIVE | LED1_ACTIVE | LED1_LINK_1000 | LED2_ACTIVE | LED2_LINK_100 | LED2_LINK_10 | LED_VALID; break; default: led = LED0_ACTIVE | LED1_LINK_10 | LED1_LINK_100 | LED1_LINK_1000 | LED2_ACTIVE | LED2_LINK_10 | LED2_LINK_100 | LED2_LINK_1000 | LED_VALID; break; } *ledvalue = led; return 0; } static int ax88179_led_setting(struct usbnet *dev) { u8 ledfd, value = 0; u16 tmp, ledact, ledlink, ledvalue = 0, delay = HZ / 10; unsigned long jtimeout; /* Check AX88179 version. UA1 or UA2*/ ax88179_read_cmd(dev, AX_ACCESS_MAC, GENERAL_STATUS, 1, 1, &value); if (!(value & AX_SECLD)) { /* UA1 */ value = AX_GPIO_CTRL_GPIO3EN | AX_GPIO_CTRL_GPIO2EN | AX_GPIO_CTRL_GPIO1EN; if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_GPIO_CTRL, 1, 1, &value) < 0) return -EINVAL; } /* Check EEPROM */ if (!ax88179_check_eeprom(dev)) { value = 0x42; if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_SROM_ADDR, 1, 1, &value) < 0) return -EINVAL; value = EEP_RD; if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD, 1, 1, &value) < 0) return -EINVAL; jtimeout = jiffies + delay; do { ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_CMD, 1, 1, &value); if (time_after(jiffies, jtimeout)) return -EINVAL; } while (value & EEP_BUSY); ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_DATA_HIGH, 1, 1, &value); ledvalue = (value << 8); ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_DATA_LOW, 1, 1, &value); ledvalue |= value; /* load internal ROM for defaule setting */ if ((ledvalue == 0xFFFF) || ((ledvalue & LED_VALID) == 0)) ax88179_convert_old_led(dev, &ledvalue); } else if (!ax88179_check_efuse(dev, &ledvalue)) { if ((ledvalue == 0xFFFF) || ((ledvalue & LED_VALID) == 0)) ax88179_convert_old_led(dev, &ledvalue); } else { ax88179_convert_old_led(dev, &ledvalue); } tmp = GMII_PHY_PGSEL_EXT; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHY_PAGE_SELECT, 2, &tmp); tmp = 0x2c; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHYPAGE, 2, &tmp); ax88179_read_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_LED_ACT, 2, &ledact); ax88179_read_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_LED_LINK, 2, &ledlink); ledact &= GMII_LED_ACTIVE_MASK; ledlink &= GMII_LED_LINK_MASK; if (ledvalue & LED0_ACTIVE) ledact |= GMII_LED0_ACTIVE; if (ledvalue & LED1_ACTIVE) ledact |= GMII_LED1_ACTIVE; if (ledvalue & LED2_ACTIVE) ledact |= GMII_LED2_ACTIVE; if (ledvalue & LED0_LINK_10) ledlink |= GMII_LED0_LINK_10; if (ledvalue & LED1_LINK_10) ledlink |= GMII_LED1_LINK_10; if (ledvalue & LED2_LINK_10) ledlink |= GMII_LED2_LINK_10; if (ledvalue & LED0_LINK_100) ledlink |= GMII_LED0_LINK_100; if (ledvalue & LED1_LINK_100) ledlink |= GMII_LED1_LINK_100; if (ledvalue & LED2_LINK_100) ledlink |= GMII_LED2_LINK_100; if (ledvalue & LED0_LINK_1000) ledlink |= GMII_LED0_LINK_1000; if (ledvalue & LED1_LINK_1000) ledlink |= GMII_LED1_LINK_1000; if (ledvalue & LED2_LINK_1000) ledlink |= GMII_LED2_LINK_1000; tmp = ledact; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_LED_ACT, 2, &tmp); tmp = ledlink; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_LED_LINK, 2, &tmp); tmp = GMII_PHY_PGSEL_PAGE0; ax88179_write_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHY_PAGE_SELECT, 2, &tmp); /* LED full duplex setting */ ledfd = 0; if (ledvalue & LED0_FD) ledfd |= 0x01; else if ((ledvalue & LED0_USB3_MASK) == 0) ledfd |= 0x02; if (ledvalue & LED1_FD) ledfd |= 0x04; else if ((ledvalue & LED1_USB3_MASK) == 0) ledfd |= 0x08; if (ledvalue & LED2_FD) ledfd |= 0x10; else if ((ledvalue & LED2_USB3_MASK) == 0) ledfd |= 0x20; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_LEDCTRL, 1, 1, &ledfd); return 0; } static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) { u8 buf[5]; u16 *tmp16; u8 *tmp; struct ax88179_data *ax179_data = (struct ax88179_data *)dev->data; struct ethtool_eee eee_data; usbnet_get_endpoints(dev, intf); tmp16 = (u16 *)buf; tmp = (u8 *)buf; memset(ax179_data, 0, sizeof(*ax179_data)); /* Power up ethernet PHY */ *tmp16 = 0; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, tmp16); *tmp16 = AX_PHYPWR_RSTCTL_IPRL; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, tmp16); msleep(200); *tmp = AX_CLK_SELECT_ACS | AX_CLK_SELECT_BCS; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, tmp); msleep(100); ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, ETH_ALEN, dev->net->dev_addr); memcpy(dev->net->perm_addr, dev->net->dev_addr, ETH_ALEN); /* RX bulk configuration */ memcpy(tmp, &AX88179_BULKIN_SIZE[0], 5); ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_BULKIN_QCTRL, 5, 5, tmp); dev->rx_urb_size = 1024 * 20; *tmp = 0x34; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PAUSE_WATERLVL_LOW, 1, 1, tmp); *tmp = 0x52; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PAUSE_WATERLVL_HIGH, 1, 1, tmp); dev->net->netdev_ops = &ax88179_netdev_ops; dev->net->ethtool_ops = &ax88179_ethtool_ops; dev->net->needed_headroom = 8; /* Initialize MII structure */ dev->mii.dev = dev->net; dev->mii.mdio_read = ax88179_mdio_read; dev->mii.mdio_write = ax88179_mdio_write; dev->mii.phy_id_mask = 0xff; dev->mii.reg_num_mask = 0xff; dev->mii.phy_id = 0x03; dev->mii.supports_gmii = 1; dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM; dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM; /* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RXCOE_CTL, 1, 1, tmp); *tmp = AX_TXCOE_IP | AX_TXCOE_TCP | AX_TXCOE_UDP | AX_TXCOE_TCPV6 | AX_TXCOE_UDPV6; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, tmp); /* Configure RX control register => start operation */ *tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_IPE | AX_RX_CTL_START | AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, tmp16); *tmp = AX_MONITOR_MODE_PMETYPE | AX_MONITOR_MODE_PMEPOL | AX_MONITOR_MODE_RWMP; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MONITOR_MOD, 1, 1, tmp); /* Configure default medium type => giga */ *tmp16 = AX_MEDIUM_RECEIVE_EN | AX_MEDIUM_TXFLOW_CTRLEN | AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_FULL_DUPLEX | AX_MEDIUM_GIGAMODE; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, tmp16); ax88179_led_setting(dev); ax179_data->eee_enabled = 0; ax179_data->eee_active = 0; ax88179_disable_eee(dev); ax88179_ethtool_get_eee(dev, &eee_data); eee_data.advertised = 0; ax88179_ethtool_set_eee(dev, &eee_data); /* Restart autoneg */ mii_nway_restart(&dev->mii); usbnet_link_change(dev, 0, 0); return 0; } static void ax88179_unbind(struct usbnet *dev, struct usb_interface *intf) { u16 tmp16; /* Configure RX control register => stop operation */ tmp16 = AX_RX_CTL_STOP; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &tmp16); tmp16 = 0; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp16); /* Power down ethernet PHY */ tmp16 = 0; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16); } static void ax88179_rx_checksum(struct sk_buff *skb, u32 *pkt_hdr) { skb->ip_summed = CHECKSUM_NONE; /* checksum error bit is set */ if ((*pkt_hdr & AX_RXHDR_L3CSUM_ERR) || (*pkt_hdr & AX_RXHDR_L4CSUM_ERR)) return; /* It must be a TCP or UDP packet with a valid checksum */ if (((*pkt_hdr & AX_RXHDR_L4_TYPE_MASK) == AX_RXHDR_L4_TYPE_TCP) || ((*pkt_hdr & AX_RXHDR_L4_TYPE_MASK) == AX_RXHDR_L4_TYPE_UDP)) skb->ip_summed = CHECKSUM_UNNECESSARY; } static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) { struct sk_buff *ax_skb; int pkt_cnt; u32 rx_hdr; u16 hdr_off; u32 *pkt_hdr; /* This check is no longer done by usbnet */ if (skb->len < dev->net->hard_header_len) return 0; skb_trim(skb, skb->len - 4); memcpy(&rx_hdr, skb_tail_pointer(skb), 4); le32_to_cpus(&rx_hdr); pkt_cnt = (u16)rx_hdr; hdr_off = (u16)(rx_hdr >> 16); pkt_hdr = (u32 *)(skb->data + hdr_off); while (pkt_cnt--) { u16 pkt_len; le32_to_cpus(pkt_hdr); pkt_len = (*pkt_hdr >> 16) & 0x1fff; /* Check CRC or runt packet */ if ((*pkt_hdr & AX_RXHDR_CRC_ERR) || (*pkt_hdr & AX_RXHDR_DROP_ERR)) { skb_pull(skb, (pkt_len + 7) & 0xFFF8); pkt_hdr++; continue; } if (pkt_cnt == 0) { /* Skip IP alignment psudo header */ skb_pull(skb, 2); skb->len = pkt_len; skb_set_tail_pointer(skb, pkt_len); skb->truesize = pkt_len + sizeof(struct sk_buff); ax88179_rx_checksum(skb, pkt_hdr); return 1; } ax_skb = skb_clone(skb, GFP_ATOMIC); if (ax_skb) { ax_skb->len = pkt_len; ax_skb->data = skb->data + 2; skb_set_tail_pointer(ax_skb, pkt_len); ax_skb->truesize = pkt_len + sizeof(struct sk_buff); ax88179_rx_checksum(ax_skb, pkt_hdr); usbnet_skb_return(dev, ax_skb); } else { return 0; } skb_pull(skb, (pkt_len + 7) & 0xFFF8); pkt_hdr++; } return 1; } static struct sk_buff * ax88179_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) { u32 tx_hdr1, tx_hdr2; int frame_size = dev->maxpacket; int mss = skb_shinfo(skb)->gso_size; int headroom; tx_hdr1 = skb->len; tx_hdr2 = mss; if (((skb->len + 8) % frame_size) == 0) tx_hdr2 |= 0x80008000; /* Enable padding */ headroom = skb_headroom(skb) - 8; if ((skb_header_cloned(skb) || headroom < 0) && pskb_expand_head(skb, headroom < 0 ? 8 : 0, 0, GFP_ATOMIC)) { dev_kfree_skb_any(skb); return NULL; } skb_push(skb, 4); cpu_to_le32s(&tx_hdr2); skb_copy_to_linear_data(skb, &tx_hdr2, 4); skb_push(skb, 4); cpu_to_le32s(&tx_hdr1); skb_copy_to_linear_data(skb, &tx_hdr1, 4); return skb; } static int ax88179_link_reset(struct usbnet *dev) { struct ax88179_data *ax179_data = (struct ax88179_data *)dev->data; u8 tmp[5], link_sts; u16 mode, tmp16, delay = HZ / 10; u32 tmp32 = 0x40000000; unsigned long jtimeout; jtimeout = jiffies + delay; while (tmp32 & 0x40000000) { mode = 0; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &mode); ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &ax179_data->rxctl); /*link up, check the usb device control TX FIFO full or empty*/ ax88179_read_cmd(dev, 0x81, 0x8c, 0, 4, &tmp32); if (time_after(jiffies, jtimeout)) return 0; } mode = AX_MEDIUM_RECEIVE_EN | AX_MEDIUM_TXFLOW_CTRLEN | AX_MEDIUM_RXFLOW_CTRLEN; ax88179_read_cmd(dev, AX_ACCESS_MAC, PHYSICAL_LINK_STATUS, 1, 1, &link_sts); ax88179_read_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHY_PHYSR, 2, &tmp16); if (!(tmp16 & GMII_PHY_PHYSR_LINK)) { return 0; } else if (GMII_PHY_PHYSR_GIGA == (tmp16 & GMII_PHY_PHYSR_SMASK)) { mode |= AX_MEDIUM_GIGAMODE | AX_MEDIUM_EN_125MHZ; if (dev->net->mtu > 1500) mode |= AX_MEDIUM_JUMBO_EN; if (link_sts & AX_USB_SS) memcpy(tmp, &AX88179_BULKIN_SIZE[0], 5); else if (link_sts & AX_USB_HS) memcpy(tmp, &AX88179_BULKIN_SIZE[1], 5); else memcpy(tmp, &AX88179_BULKIN_SIZE[3], 5); } else if (GMII_PHY_PHYSR_100 == (tmp16 & GMII_PHY_PHYSR_SMASK)) { mode |= AX_MEDIUM_PS; if (link_sts & (AX_USB_SS | AX_USB_HS)) memcpy(tmp, &AX88179_BULKIN_SIZE[2], 5); else memcpy(tmp, &AX88179_BULKIN_SIZE[3], 5); } else { memcpy(tmp, &AX88179_BULKIN_SIZE[3], 5); } /* RX bulk configuration */ ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_BULKIN_QCTRL, 5, 5, tmp); dev->rx_urb_size = (1024 * (tmp[3] + 2)); if (tmp16 & GMII_PHY_PHYSR_FULL) mode |= AX_MEDIUM_FULL_DUPLEX; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, &mode); ax179_data->eee_enabled = ax88179_chk_eee(dev); netif_carrier_on(dev->net); return 0; } static int ax88179_reset(struct usbnet *dev) { u8 buf[5]; u16 *tmp16; u8 *tmp; struct ax88179_data *ax179_data = (struct ax88179_data *)dev->data; struct ethtool_eee eee_data; tmp16 = (u16 *)buf; tmp = (u8 *)buf; /* Power up ethernet PHY */ *tmp16 = 0; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, tmp16); *tmp16 = AX_PHYPWR_RSTCTL_IPRL; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, tmp16); msleep(200); *tmp = AX_CLK_SELECT_ACS | AX_CLK_SELECT_BCS; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, tmp); msleep(100); /* Ethernet PHY Auto Detach*/ ax88179_auto_detach(dev, 0); ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, ETH_ALEN, dev->net->dev_addr); memcpy(dev->net->perm_addr, dev->net->dev_addr, ETH_ALEN); /* RX bulk configuration */ memcpy(tmp, &AX88179_BULKIN_SIZE[0], 5); ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_BULKIN_QCTRL, 5, 5, tmp); dev->rx_urb_size = 1024 * 20; *tmp = 0x34; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PAUSE_WATERLVL_LOW, 1, 1, tmp); *tmp = 0x52; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PAUSE_WATERLVL_HIGH, 1, 1, tmp); dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM; dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM; /* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RXCOE_CTL, 1, 1, tmp); *tmp = AX_TXCOE_IP | AX_TXCOE_TCP | AX_TXCOE_UDP | AX_TXCOE_TCPV6 | AX_TXCOE_UDPV6; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_TXCOE_CTL, 1, 1, tmp); /* Configure RX control register => start operation */ *tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_IPE | AX_RX_CTL_START | AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, tmp16); *tmp = AX_MONITOR_MODE_PMETYPE | AX_MONITOR_MODE_PMEPOL | AX_MONITOR_MODE_RWMP; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MONITOR_MOD, 1, 1, tmp); /* Configure default medium type => giga */ *tmp16 = AX_MEDIUM_RECEIVE_EN | AX_MEDIUM_TXFLOW_CTRLEN | AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_FULL_DUPLEX | AX_MEDIUM_GIGAMODE; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, tmp16); ax88179_led_setting(dev); ax179_data->eee_enabled = 0; ax179_data->eee_active = 0; ax88179_disable_eee(dev); ax88179_ethtool_get_eee(dev, &eee_data); eee_data.advertised = 0; ax88179_ethtool_set_eee(dev, &eee_data); /* Restart autoneg */ mii_nway_restart(&dev->mii); usbnet_link_change(dev, 0, 0); return 0; } static int ax88179_stop(struct usbnet *dev) { u16 tmp16; ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, &tmp16); tmp16 &= ~AX_MEDIUM_RECEIVE_EN; ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, 2, 2, &tmp16); return 0; } static const struct driver_info ax88179_info = { .description = "ASIX AX88179 USB 3.0 Gigabit Ethernet", .bind = ax88179_bind, .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, }; static const struct driver_info ax88178a_info = { .description = "ASIX AX88178A USB 2.0 Gigabit Ethernet", .bind = ax88179_bind, .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, }; static const struct driver_info dlink_dub1312_info = { .description = "D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter", .bind = ax88179_bind, .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, }; static const struct driver_info sitecom_info = { .description = "Sitecom USB 3.0 to Gigabit Adapter", .bind = ax88179_bind, .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, }; static const struct driver_info samsung_info = { .description = "Samsung USB Ethernet Adapter", .bind = ax88179_bind, .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, }; static const struct driver_info lenovo_info = { .description = "Lenovo OneLinkDock Gigabit LAN", .bind = ax88179_bind, .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, }; static const struct driver_info cypress_GX3_info = { .description = "Cypress GX3 SuperSpeed to Gigabit Ethernet Controller", .bind = ax88179_bind, .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, }; static const struct usb_device_id products[] = { { /* ASIX AX88179 10/100/1000 */ USB_DEVICE(0x0b95, 0x1790), .driver_info = (unsigned long)&ax88179_info, }, { /* ASIX AX88178A 10/100/1000 */ USB_DEVICE(0x0b95, 0x178a), .driver_info = (unsigned long)&ax88178a_info, }, { /* D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter */ USB_DEVICE(0x2001, 0x4a00), .driver_info = (unsigned long)&dlink_dub1312_info, }, { /* Sitecom USB 3.0 to Gigabit Adapter */ USB_DEVICE(0x0df6, 0x0072), .driver_info = (unsigned long)&sitecom_info, }, { /* Samsung USB Ethernet Adapter */ USB_DEVICE(0x04e8, 0xa100), .driver_info = (unsigned long)&samsung_info, }, { /* Lenovo OneLinkDock Gigabit LAN */ USB_DEVICE(0x17ef, 0x304b), .driver_info = (unsigned long)&lenovo_info, }, { /* Cypress GX3 SuperSpeed to Gigabit Ethernet Bridge Controller */ USB_DEVICE(0x04b4, 0x3610), .driver_info = (unsigned long)&cypress_GX3_info, }, { }, }; MODULE_DEVICE_TABLE(usb, products); static struct usb_driver ax88179_178a_driver = { .name = "ax88179_178a", .id_table = products, .probe = usbnet_probe, .suspend = ax88179_suspend, .resume = ax88179_resume, .reset_resume = ax88179_resume, .disconnect = usbnet_disconnect, .supports_autosuspend = 1, .disable_hub_initiated_lpm = 1, }; module_usb_driver(ax88179_178a_driver); MODULE_DESCRIPTION("ASIX AX88179/178A based USB 3.0/2.0 Gigabit Ethernet Devices"); MODULE_LICENSE("GPL");
kendling/android_kernel_google_dragon
drivers/net/usb/ax88179_178a.c
C
gpl-2.0
45,489
[ 30522, 1013, 1008, 1008, 2004, 7646, 22260, 2620, 2620, 16576, 2683, 1013, 19289, 2050, 18833, 1017, 1012, 1014, 1013, 1016, 1012, 1014, 2000, 15453, 28518, 2102, 26110, 5733, 1008, 1008, 9385, 1006, 1039, 1007, 2249, 1011, 2286, 2004, 7646...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copied from https://github.com/fwcd/vscode-kotlin-ide and edited. // // Originaly licensed: // // The MIT License (MIT) // // Copyright (c) 2016 George Fraser // Copyright (c) 2018 fwcd // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // export function isOSWindows(): boolean { return process.platform === "win32"; } export function isOSUnixoid(): boolean { const platform = process.platform; return ( platform === "linux" || platform === "darwin" || platform === "freebsd" || platform === "openbsd" ); } export function isOSUnix(): boolean { const platform = process.platform; return ( platform === "linux" || platform === "freebsd" || platform === "openbsd" ); } export function isOSMacOS(): boolean { return process.platform === "darwin"; } export function correctBinname(binname: string): string { return binname + (process.platform === "win32" ? ".exe" : ""); } export function correctScriptName(binname: string): string { return binname + (process.platform === "win32" ? ".bat" : ""); }
nixel2007/vsc-language-1c-bsl
src/util/osUtils.ts
TypeScript
mit
2,125
[ 30522, 1013, 1013, 15826, 2013, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 1042, 16526, 2094, 1013, 5443, 16044, 1011, 12849, 19646, 2378, 1011, 8909, 2063, 1998, 5493, 1012, 1013, 1013, 1013, 1013, 2434, 2100, 7000, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Type: Highsoft.Web.Mvc.Stocks.PlotOptionsAreaStep namespace Highsoft.Web.Mvc.Stocks { public enum PlotOptionsAreaStep { False, Left, Center, Right, } }
pmrozek/highcharts
Highsoft.Web.Mvc/src/Highsoft.Web.Mvc/Stocks/PlotOptionsAreaStep.cs
C#
mit
203
[ 30522, 1013, 1013, 2828, 1024, 26836, 15794, 1012, 4773, 1012, 19842, 2278, 1012, 15768, 1012, 5436, 7361, 9285, 12069, 14083, 13699, 3415, 15327, 26836, 15794, 1012, 4773, 1012, 19842, 2278, 1012, 15768, 1063, 2270, 4372, 2819, 5436, 7361, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
{-# LANGUAGE OverloadedStrings #-} module Views.Common.SEO where import Control.Monad import qualified Data.Text as T import Data.Text.Lazy(Text) import Data.String (fromString) import qualified Text.Printf as PF import Network.URI import Text.Blaze.Html5((!)) import qualified Text.Blaze.Html5 as H import qualified Text.Blaze.Html5.Attributes as A import qualified Utils.BlazeExtra.Attributes as EA import Utils.URI.String import Models.Schema metaProperty p v = H.meta ! property p ! A.content v where property = H.customAttribute "property" metaName n v = H.meta ! A.name n ! A.content v keywordsAndDescription keywords description = do metaName "keywords" $ H.toValue keywords metaName "description" $ H.toValue description openGraph :: String -> String -> String -> H.Html openGraph title url description = do metaProperty "og:type" "website" metaProperty "og:title" $ H.toValue title metaProperty "og:url" $ H.toValue url metaProperty "og:description" $ H.toValue description canonical :: String -> H.Html canonical url = H.link ! A.rel "canonical" ! A.href ( H.toValue url) gaEvent :: String-> String ->H.Attribute gaEvent ev ct = let v = (PF.printf "ga('send', 'event', '%s', '%s');" ev ct) :: String in A.onclick $ H.toValue v utmParams :: String -> String -> [(String,String)] utmParams host name = [("utm_source",host) ,("utm_campaign",name) ,("utm_medium","website")]
DavidAlphaFox/sblog
src/Views/Common/SEO.hs
Haskell
bsd-3-clause
1,437
[ 30522, 1063, 1011, 1001, 2653, 2058, 17468, 3367, 4892, 2015, 1001, 1011, 1065, 11336, 5328, 1012, 2691, 1012, 27457, 2073, 12324, 2491, 1012, 13813, 2094, 12324, 4591, 2951, 1012, 3793, 2004, 1056, 12324, 2951, 1012, 3793, 1012, 13971, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.beigesoft.uml.factory.awt; import java.awt.Frame; import java.awt.Graphics2D; import java.awt.Image; import org.beigesoft.graphic.pojo.SettingsDraw; import org.beigesoft.graphic.pojo.Point2D; import org.beigesoft.graphic.service.ISrvDraw; import org.beigesoft.service.ISrvI18n; import org.beigesoft.ui.service.ISrvDialog; import org.beigesoft.uml.app.model.SettingsGraphicUml; import org.beigesoft.uml.assembly.AsmElementUmlInteractive; import org.beigesoft.uml.assembly.IAsmElementUmlInteractive; import org.beigesoft.uml.factory.IFactoryAsmElementUml; import org.beigesoft.uml.factory.swing.FactoryEditorText; import org.beigesoft.uml.pojo.TextUml; import org.beigesoft.uml.service.graphic.SrvGraphicText; import org.beigesoft.uml.service.interactive.SrvInteractiveText; import org.beigesoft.uml.service.persist.xmllight.FileAndWriter; import org.beigesoft.uml.service.persist.xmllight.SrvPersistLightXmlText; public class FactoryAsmTextLight implements IFactoryAsmElementUml<IAsmElementUmlInteractive<TextUml, Graphics2D, SettingsDraw, FileAndWriter>, Graphics2D, SettingsDraw, FileAndWriter, TextUml> { private final ISrvDraw<Graphics2D, SettingsDraw, Image> drawSrv; private final SettingsGraphicUml graphicSettings; private final FactoryEditorText factoryEditorTextUml; private SrvGraphicText<TextUml, Graphics2D, SettingsDraw> graphicTextumlSrv; private SrvPersistLightXmlText<TextUml> persistXmlTextUmlSrv; private SrvInteractiveText<TextUml, Graphics2D, SettingsDraw, Frame> interactiveTextUmlSrv; public FactoryAsmTextLight(ISrvDraw<Graphics2D, SettingsDraw, Image> drawSrv, ISrvI18n i18nSrv, ISrvDialog<Frame> dialogSrv, SettingsGraphicUml graphicSettings, Frame frameMain) { this.drawSrv = drawSrv; this.graphicSettings = graphicSettings; this.factoryEditorTextUml = new FactoryEditorText(i18nSrv, dialogSrv, graphicSettings, frameMain); } @Override public synchronized AsmElementUmlInteractive<TextUml, Graphics2D, SettingsDraw, FileAndWriter> createAsmElementUml() { TextUml textUml = new TextUml(); textUml.setPointStart(new Point2D(1, 1)); SettingsDraw drawSettings = new SettingsDraw(); AsmElementUmlInteractive<TextUml, Graphics2D, SettingsDraw, FileAndWriter> asmTextUml = new AsmElementUmlInteractive<TextUml, Graphics2D, SettingsDraw, FileAndWriter>(textUml, drawSettings, lazyGetGraphicTextUmlSrv(), lazyGetPersistXmlTextUmlSrv(), lazyGetInteractiveTextUmlSrv()); return asmTextUml; } public synchronized SrvInteractiveText<TextUml, Graphics2D, SettingsDraw, Frame> lazyGetInteractiveTextUmlSrv() { if(interactiveTextUmlSrv == null) { interactiveTextUmlSrv = new SrvInteractiveText<TextUml, Graphics2D, SettingsDraw, Frame> (lazyGetGraphicTextUmlSrv(), factoryEditorTextUml); } return interactiveTextUmlSrv; } public synchronized SrvPersistLightXmlText<TextUml> lazyGetPersistXmlTextUmlSrv() { if(persistXmlTextUmlSrv == null) { persistXmlTextUmlSrv = new SrvPersistLightXmlText<TextUml>(); } return persistXmlTextUmlSrv; } public synchronized SrvGraphicText<TextUml, Graphics2D, SettingsDraw> lazyGetGraphicTextUmlSrv() { if(graphicTextumlSrv == null) { graphicTextumlSrv = new SrvGraphicText<TextUml, Graphics2D, SettingsDraw>(drawSrv, graphicSettings); } return graphicTextumlSrv; } public FactoryEditorText getFactoryEditorTextUml() { return factoryEditorTextUml; } }
demidenko05/beige-uml
beige-uml-swing/src/main/java/org/beigesoft/uml/factory/awt/FactoryAsmTextLight.java
Java
apache-2.0
3,490
[ 30522, 7427, 8917, 1012, 28799, 6499, 6199, 1012, 8529, 2140, 1012, 30524, 1012, 8425, 1012, 13433, 5558, 1012, 10906, 7265, 2860, 1025, 12324, 8917, 1012, 28799, 6499, 6199, 1012, 8425, 1012, 13433, 5558, 1012, 2391, 2475, 2094, 1025, 1232...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html><html><head><title>https://cgmonline.co/tags/2ns/</title><link rel="canonical" href="https://cgmonline.co/tags/2ns/"/><meta name="robots" content="noindex"><meta charset="utf-8" /><meta http-equiv="refresh" content="0; url=https://cgmonline.co/tags/2ns/" /></head></html>
cgmonline/cgmonline
docs/tags/2ns/page/1/index.html
HTML
mit
286
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 16770, 1024, 1013, 1013, 1039, 21693, 2239, 4179, 1012, 2522, 1013, 22073, 1013, 1016, 3619, 1013, 1026, 1013, 2516, 1028, 1026, 4957, 2128, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2013.11.29 at 12:35:53 PM GMT // package org.mule.modules.hybris.model; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for celumPicturesIntegrationJobsDTO complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="celumPicturesIntegrationJobsDTO"> * &lt;complexContent> * &lt;extension base="{}abstractCollectionDTO"> * &lt;sequence> * &lt;element ref="{}celumpicturesintegrationjob" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "celumPicturesIntegrationJobsDTO", propOrder = { "celumpicturesintegrationjob" }) public class CelumPicturesIntegrationJobsDTO extends AbstractCollectionDTO { protected List<CelumPicturesIntegrationJobDTO> celumpicturesintegrationjob; /** * Gets the value of the celumpicturesintegrationjob property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the celumpicturesintegrationjob property. * * <p> * For example, to add a new item, do as follows: * <pre> * getCelumpicturesintegrationjob().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link CelumPicturesIntegrationJobDTO } * * */ public List<CelumPicturesIntegrationJobDTO> getCelumpicturesintegrationjob() { if (celumpicturesintegrationjob == null) { celumpicturesintegrationjob = new ArrayList<CelumPicturesIntegrationJobDTO>(); } return this.celumpicturesintegrationjob; } }
ryandcarter/hybris-connector
src/main/java/org/mule/modules/hybris/model/CelumPicturesIntegrationJobsDTO.java
Java
apache-2.0
2,433
[ 30522, 1013, 1013, 1013, 1013, 2023, 5371, 2001, 7013, 2011, 1996, 9262, 21246, 4294, 2005, 20950, 8031, 1006, 13118, 2497, 1007, 4431, 7375, 1010, 1058, 2475, 1012, 1016, 1012, 1018, 1011, 1016, 1013, 1013, 2156, 1026, 1037, 17850, 12879, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include "animation_manager.hpp" using namespace engine; AnimationManager AnimationManager::instance; void AnimationManager::add_animation_quad(AnimationQuad* newQuad){ animationQuads.push_back(newQuad); } void AnimationManager::add_collider(SDL_Rect* newQuad){ colliderRects.push_back(newQuad); } void AnimationManager::clearAnimationQuads(){ animationQuads.clear(); } void AnimationManager::draw_quads(){ //ORDER QUADS BY Y; std::sort(animationQuads.begin(), animationQuads.end(),[](const AnimationQuad* lhs, const AnimationQuad* rhs){ return lhs->y < rhs->y; }); for(AnimationQuad * quad : animationQuads) { SDL_RenderCopy(WindowManager::getGameCanvas(), quad->getTexture(), quad->getClipRect(), quad->getRenderQuad()); } draw_colliders(); clearAnimationQuads(); } void AnimationManager::draw_colliders(){ SDL_SetRenderDrawColor(WindowManager::getGameCanvas(), 0, 0, 0, 255); for(SDL_Rect * quad : colliderRects) { SDL_RenderDrawRect(WindowManager::getGameCanvas(), quad); } colliderRects.clear(); }
pablodiegoss/paperboy
engine/src/animation_manager.cpp
C++
gpl-3.0
1,081
[ 30522, 1001, 2421, 1000, 7284, 1035, 3208, 1012, 6522, 2361, 1000, 2478, 3415, 15327, 3194, 1025, 7284, 24805, 4590, 7284, 24805, 4590, 1024, 1024, 6013, 1025, 30524, 1008, 2047, 16211, 2094, 1007, 1063, 7284, 16211, 5104, 1012, 5245, 1035,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package algorithms.compGeometry.clustering.twopointcorrelation; import java.util.logging.Logger; /** * * @author nichole */ public class SubsetSamplingVoidFinderTest extends BaseTwoPointTest { boolean debug = true; protected Logger log = Logger.getLogger(this.getClass().getSimpleName()); public void testFindVoids_0() throws Exception { log.info("testFindVoids_0()"); float xmin = 0; float xmax = 3; float ymin = 0; float ymax = 3; int numberOfBackgroundPoints = 9; float[] xb = new float[numberOfBackgroundPoints]; float[] yb = new float[numberOfBackgroundPoints]; // make a uniform grid of background points: int nDiv = (int) Math.ceil(Math.sqrt(numberOfBackgroundPoints)); double divXSz = (xmax - xmin)/nDiv; double divYSz = (ymax - ymin)/nDiv; int c = 0; for (int j = 0; j < nDiv; j++) { float yStart = (float) (ymin + j*divYSz); if (yStart > ymax) { yStart = ymax; } for (int jj = 0; jj < nDiv; jj++) { float xStart = (float)(xmin + jj*divXSz); if (xStart > xmax) { xStart = xmax; } if (c > (numberOfBackgroundPoints - 1)) { break; } xb[c] = xStart; yb[c] = yStart; c++; } } float[] xbe = new float[numberOfBackgroundPoints]; float[] ybe = new float[numberOfBackgroundPoints]; for (int i = 0; i < numberOfBackgroundPoints; i++) { // simulate x error as a percent error of 0.03 for each bin xbe[i] = xb[i] * 0.03f; ybe[i] = (float) (Math.sqrt(yb[i])); } AxisIndexer indexer = new AxisIndexer(); indexer.sortAndIndexX(xb, yb, xbe, ybe, xb.length); IVoidFinder voidFinder = new SubsetSamplingVoidFinder(); voidFinder.findVoids(indexer); float[] linearDensities = voidFinder.getTwoPointDensities(); assertNotNull(linearDensities); log.info("n densities=" + linearDensities.length); assertTrue(linearDensities.length == 20); // count values of 2 and 1.6817929 int count0 = 0; int count1 = 0; for (int i = 0; i < linearDensities.length; i++) { float d = linearDensities[i]; if (d == 2.) { count0++; } else if (Math.abs(d - 1.6817929) < 0.0001) { count1++; } } assertTrue(count0 == 12); assertTrue(count1 == 8); } }
tectronics/two-point-correlation
src/test/java/algorithms/compGeometry/clustering/twopointcorrelation/SubsetSamplingVoidFinderTest.java
Java
mit
2,810
[ 30522, 7427, 13792, 1012, 4012, 26952, 8780, 24327, 1012, 9324, 2075, 1012, 2048, 8400, 27108, 16570, 3370, 1025, 12324, 9262, 1012, 21183, 4014, 1012, 15899, 1012, 8833, 4590, 1025, 1013, 1008, 1008, 1008, 1008, 1030, 3166, 27969, 11484, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** ****************************************************************************** * @file TIM/OCToggle/stm32l1xx_it.c * @author MCD Application Team * @version V1.1.1 * @date 13-April-2012 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and peripherals * interrupt service routine. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32l1xx_it.h" /** @addtogroup STM32L1xx_StdPeriph_Examples * @{ */ /** @addtogroup TIM_OCToggle * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ uint16_t capture = 0; extern __IO uint16_t CCR1_Val; extern __IO uint16_t CCR2_Val; extern __IO uint16_t CCR3_Val; extern __IO uint16_t CCR4_Val; /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************/ /* Cortex-M3 Processor Exceptions Handlers */ /******************************************************************************/ /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler(void) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) {} } /** * @brief This function handles Memory Manage exception. * @param None * @retval None */ void MemManage_Handler(void) { /* Go to infinite loop when Memory Manage exception occurs */ while (1) {} } /** * @brief This function handles Bus Fault exception. * @param None * @retval None */ void BusFault_Handler(void) { /* Go to infinite loop when Bus Fault exception occurs */ while (1) {} } /** * @brief This function handles Usage Fault exception. * @param None * @retval None */ void UsageFault_Handler(void) { /* Go to infinite loop when Usage Fault exception occurs */ while (1) {} } /** * @brief This function handles Debug Monitor exception. * @param None * @retval None */ void DebugMon_Handler(void) {} /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler(void) {} /** * @brief This function handles PendSV_Handler exception. * @param None * @retval None */ void PendSV_Handler(void) {} /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) {} /******************************************************************************/ /* STM32L1xx Peripherals Interrupt Handlers */ /******************************************************************************/ /** * @brief This function handles TIM3 global interrupt request. * @param None * @retval None */ void TIM3_IRQHandler(void) { /* TIM3_CH1 toggling with frequency = 244.140 Hz */ if (TIM_GetITStatus(TIM3, TIM_IT_CC1) != RESET) { TIM_ClearITPendingBit(TIM3, TIM_IT_CC1 ); capture = TIM_GetCapture1(TIM3); TIM_SetCompare1(TIM3, capture + CCR1_Val ); } /* TIM3_CH2 toggling with frequency = 976.562 Hz */ if (TIM_GetITStatus(TIM3, TIM_IT_CC2) != RESET) { TIM_ClearITPendingBit(TIM3, TIM_IT_CC2); capture = TIM_GetCapture2(TIM3); TIM_SetCompare2(TIM3, capture + CCR2_Val); } /* TIM3_CH3 toggling with frequency = 1953.125 Hz */ if (TIM_GetITStatus(TIM3, TIM_IT_CC3) != RESET) { TIM_ClearITPendingBit(TIM3, TIM_IT_CC3); capture = TIM_GetCapture3(TIM3); TIM_SetCompare3(TIM3, capture + CCR3_Val); } /* TIM3_CH4 toggling with frequency = 3906.25 Hz */ if (TIM_GetITStatus(TIM3, TIM_IT_CC4) != RESET) { TIM_ClearITPendingBit(TIM3, TIM_IT_CC4); capture = TIM_GetCapture4(TIM3); TIM_SetCompare4(TIM3, capture + CCR4_Val); } } /******************************************************************************/ /* STM32L1xx Peripherals Interrupt Handlers */ /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ /* available peripheral interrupt handler's name please refer to the startup */ /* file (startup_stm32l1xx_xx.s). */ /******************************************************************************/ /** * @brief This function handles PPP interrupt request. * @param None * @retval None */ /*void PPP_IRQHandler(void) { }*/ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
virtmedia/ultramicron
STM32L1xx_StdPeriph_Lib_V1.2.0/Project/STM32L1xx_StdPeriph_Examples/TIM/OCToggle/stm32l1xx_it.c
C
gpl-3.0
5,902
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers /***************************************************************************** * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. * * OpenRCT2 is the work of many authors, a full list can be found in contributors.md * For more information, visit https://github.com/OpenRCT2/OpenRCT2 * * OpenRCT2 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. * * A full copy of the GNU General Public License can be found in licence.txt *****************************************************************************/ #pragma endregion #include "../track_paint.h" #include "../track.h" #include "../vehicle_paint.h" #include "../../interface/viewport.h" #include "../../paint/paint.h" #include "../../paint/supports.h" #include "../ride_data.h" #include "../../world/map.h" /** rct2: 0x */ static void paint_mini_helicopters_track_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { uint32 imageId; if (direction == 0 || direction == 2) { imageId = SPR_STATION_BASE_B_SW_NE | gTrackColours[SCHEME_MISC]; sub_98197C(imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height, get_current_rotation()); imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_NE_SW | gTrackColours[SCHEME_TRACK]; sub_98199C(imageId, 0, 0, 32, 20, 1, height, 0, 0, height, get_current_rotation()); metal_a_supports_paint_setup(METAL_SUPPORTS_BOXED, 5, 0, height, gTrackColours[SCHEME_SUPPORTS]); metal_a_supports_paint_setup(METAL_SUPPORTS_BOXED, 8, 0, height, gTrackColours[SCHEME_SUPPORTS]); paint_util_push_tunnel_left(height, TUNNEL_6); } else if (direction == 1 || direction == 3) { imageId = SPR_STATION_BASE_B_NW_SE | gTrackColours[SCHEME_MISC]; sub_98197C(imageId, 0, 0, 28, 32, 1, height - 2, 2, 0, height, get_current_rotation()); imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_SE_NW | gTrackColours[SCHEME_TRACK]; sub_98199C(imageId, 0, 0, 20, 32, 1, height, 0, 0, height, get_current_rotation()); metal_a_supports_paint_setup(METAL_SUPPORTS_BOXED, 6, 0, height, gTrackColours[SCHEME_SUPPORTS]); metal_a_supports_paint_setup(METAL_SUPPORTS_BOXED, 7, 0, height, gTrackColours[SCHEME_SUPPORTS]); paint_util_push_tunnel_right(height, TUNNEL_6); } track_paint_util_draw_station(rideIndex, trackSequence, direction, height, mapElement); paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); paint_util_set_general_support_height(height + 32, 0x20); } /** rct2: 0x0081F348 */ static void paint_mini_helicopters_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { rct_xy16 position = {gPaintMapPosition.x, gPaintMapPosition.y}; uint32 imageId; if (direction & 1) { imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_SE_NW | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); paint_util_push_tunnel_right(height, TUNNEL_0); } else { imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_NE_SW | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); paint_util_push_tunnel_left(height, TUNNEL_0); } if (track_paint_util_should_paint_supports(position)) { metal_a_supports_paint_setup((direction & 1) ? METAL_SUPPORTS_STICK_ALT : METAL_SUPPORTS_STICK, 4, -1, height, gTrackColours[SCHEME_SUPPORTS]); } paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); paint_util_set_general_support_height(height + 32, 0x20); } /** rct2: 0x0081F368 */ static void paint_mini_helicopters_track_flat_to_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { rct_xy16 position = {gPaintMapPosition.x, gPaintMapPosition.y}; uint32 imageId; switch (direction) { case 0: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_SW_NE | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); paint_util_push_tunnel_left(height, TUNNEL_0); break; case 1: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_NW_SE | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); paint_util_push_tunnel_right(height, TUNNEL_2); break; case 2: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_NE_SW | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); paint_util_push_tunnel_left(height, TUNNEL_2); break; case 3: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_FLAT_TO_25_DEG_UP_SE_NW | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); paint_util_push_tunnel_right(height, TUNNEL_0); break; } if (track_paint_util_should_paint_supports(position)) { metal_a_supports_paint_setup(METAL_SUPPORTS_STICK, 4, -4, height, gTrackColours[SCHEME_SUPPORTS]); } paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); paint_util_set_general_support_height(height + 48, 0x20); } /** rct2: 0x0081F358 */ static void paint_mini_helicopters_track_25_deg_up(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { rct_xy16 position = {gPaintMapPosition.x, gPaintMapPosition.y}; uint32 imageId; switch (direction) { case 0: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_SW_NE | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); paint_util_push_tunnel_left(height - 8, TUNNEL_1); break; case 1: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_NW_SE | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); paint_util_push_tunnel_right(height + 8, TUNNEL_2); break; case 2: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_NE_SW | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); paint_util_push_tunnel_left(height + 8, TUNNEL_2); break; case 3: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_SE_NW | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); paint_util_push_tunnel_right(height - 8, TUNNEL_1); break; } if (track_paint_util_should_paint_supports(position)) { metal_a_supports_paint_setup(METAL_SUPPORTS_STICK, 4, -9, height, gTrackColours[SCHEME_SUPPORTS]); } paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); paint_util_set_general_support_height(height + 56, 0x20); } /** rct2: 0x0081F378 */ static void paint_mini_helicopters_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { rct_xy16 position = {gPaintMapPosition.x, gPaintMapPosition.y}; uint32 imageId; switch (direction) { case 0: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_SW_NE | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); paint_util_push_tunnel_left(height - 8, TUNNEL_0); break; case 1: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_NW_SE | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); paint_util_push_tunnel_right(height + 8, TUNNEL_12); break; case 2: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_NE_SW | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 32, 20, 3, height, 0, 6, height, get_current_rotation()); paint_util_push_tunnel_left(height + 8, TUNNEL_12); break; case 3: imageId = SPR_TRACK_SUBMARINE_RIDE_MINI_HELICOPTERS_25_DEG_UP_TO_FLAT_SE_NW | gTrackColours[SCHEME_TRACK]; sub_98197C(imageId, 0, 0, 20, 32, 3, height, 6, 0, height, get_current_rotation()); paint_util_push_tunnel_right(height - 8, TUNNEL_0); break; } if (track_paint_util_should_paint_supports(position)) { metal_a_supports_paint_setup(METAL_SUPPORTS_STICK, 4, -7, height, gTrackColours[SCHEME_SUPPORTS]); } paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0); paint_util_set_general_support_height(height + 40, 0x20); } /** rct2: 0x */ static void paint_mini_helicopters_track_flat_to_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { paint_mini_helicopters_track_25_deg_up_to_flat(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } /** rct2: 0x0081F388 */ static void paint_mini_helicopters_track_25_deg_down(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { paint_mini_helicopters_track_25_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } /** rct2: 0x0081F3A8 */ static void paint_mini_helicopters_track_25_deg_down_to_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { paint_mini_helicopters_track_flat_to_25_deg_up(rideIndex, trackSequence, (direction + 2) % 4, height, mapElement); } /** rct2: 0x0081F3E8 */ static void paint_mini_helicopters_track_left_quarter_turn_3_tiles(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { track_paint_util_left_quarter_turn_3_tiles_paint(3, height, direction, trackSequence, gTrackColours[SCHEME_TRACK], trackSpritesSubmarineRideMiniHelicoptersQuarterTurn3Tiles, get_current_rotation()); track_paint_util_left_quarter_turn_3_tiles_tunnel(height, TUNNEL_0, direction, trackSequence); switch (trackSequence) { case 0: metal_a_supports_paint_setup(METAL_SUPPORTS_STICK, 4, -1, height, gTrackColours[SCHEME_SUPPORTS]); paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC | SEGMENT_B4, direction), 0xFFFF, 0); break; case 2: paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0 | SEGMENT_B8, direction), 0xFFFF, 0); break; case 3: metal_a_supports_paint_setup(METAL_SUPPORTS_STICK, 4, -1, height, gTrackColours[SCHEME_SUPPORTS]); paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4 | SEGMENT_C0, direction), 0xFFFF, 0); break; } paint_util_set_general_support_height(height + 32, 0x20); } static const uint8 mini_helicopters_right_quarter_turn_3_tiles_to_left_turn_map[] = {3, 1, 2, 0}; /** rct2: 0x0081F3F8 */ static void paint_mini_helicopters_track_right_quarter_turn_3_tiles(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { trackSequence = mini_helicopters_right_quarter_turn_3_tiles_to_left_turn_map[trackSequence]; paint_mini_helicopters_track_left_quarter_turn_3_tiles(rideIndex, trackSequence, (direction + 3) % 4, height, mapElement); } /** rct2: 0x0081F408 */ static void paint_mini_helicopters_track_left_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { track_paint_util_left_quarter_turn_1_tile_paint(1, height, 0, direction, gTrackColours[SCHEME_TRACK], trackSpritesSubmarineRideMiniHelicoptersQuarterTurn1Tile, get_current_rotation()); track_paint_util_left_quarter_turn_1_tile_tunnel(direction, height, 0, TUNNEL_0, 0, TUNNEL_0); paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D0, direction), 0xFFFF, 0); paint_util_set_general_support_height(height + 32, 0x20); } /** rct2: 0x0081F418 */ static void paint_mini_helicopters_track_right_quarter_turn_1_tile(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement) { paint_mini_helicopters_track_left_quarter_turn_1_tile(rideIndex, trackSequence, (direction + 3) % 4, height, mapElement); } /** * rct2: 0x0081F268 */ TRACK_PAINT_FUNCTION get_track_paint_function_mini_helicopters(sint32 trackType, sint32 direction) { switch (trackType) { case TRACK_ELEM_FLAT: return paint_mini_helicopters_track_flat; case TRACK_ELEM_END_STATION: case TRACK_ELEM_BEGIN_STATION: case TRACK_ELEM_MIDDLE_STATION: return paint_mini_helicopters_track_station; case TRACK_ELEM_25_DEG_UP: return paint_mini_helicopters_track_25_deg_up; case TRACK_ELEM_FLAT_TO_25_DEG_UP: return paint_mini_helicopters_track_flat_to_25_deg_up; case TRACK_ELEM_25_DEG_UP_TO_FLAT: return paint_mini_helicopters_track_25_deg_up_to_flat; case TRACK_ELEM_25_DEG_DOWN: return paint_mini_helicopters_track_25_deg_down; case TRACK_ELEM_FLAT_TO_25_DEG_DOWN: return paint_mini_helicopters_track_flat_to_25_deg_down; case TRACK_ELEM_25_DEG_DOWN_TO_FLAT: return paint_mini_helicopters_track_25_deg_down_to_flat; case TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES: return paint_mini_helicopters_track_left_quarter_turn_3_tiles; case TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES: return paint_mini_helicopters_track_right_quarter_turn_3_tiles; case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE: return paint_mini_helicopters_track_left_quarter_turn_1_tile; case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE: return paint_mini_helicopters_track_right_quarter_turn_1_tile; } return NULL; }
RussianHackers/OpenRCT2
src/openrct2/ride/gentle/mini_helicopters.c
C
gpl-3.0
14,059
[ 30522, 1001, 10975, 8490, 2863, 2555, 9385, 1006, 1039, 1007, 2297, 1011, 2355, 2330, 11890, 2102, 2475, 9797, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#define SQLITE_ASCII #define SQLITE_DISABLE_LFS #define SQLITE_ENABLE_OVERSIZE_CELL_CHECK #define SQLITE_MUTEX_OMIT #define SQLITE_OMIT_AUTHORIZATION #define SQLITE_OMIT_DEPRECATED #define SQLITE_OMIT_GET_TABLE #define SQLITE_OMIT_INCRBLOB #define SQLITE_OMIT_LOOKASIDE #define SQLITE_OMIT_SHARED_CACHE #define SQLITE_OMIT_UTF16 #define SQLITE_OMIT_WAL #define SQLITE_OS_WIN #define SQLITE_SYSTEM_MALLOC #define VDBE_PROFILE_OFF #define WINDOWS_MOBILE #define NDEBUG #define _MSC_VER #define YYFALLBACK //#define SQLITE_HAS_CODEC using System; using System.Diagnostics; using System.Text; using u8 = System.Byte; using u32 = System.UInt32; namespace Community.CsharpSqlite { using sqlite3_value = Sqlite3.Mem; public partial class Sqlite3 { /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. ************************************************************************* ** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart ** C#-SQLite is an independent reimplementation of the SQLite software library ** ** SQLITE_SOURCE_ID: 2011-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2 ** ************************************************************************* */ //#include "sqliteInt.h" #if !SQLITE_OMIT_ATTACH /* ** Resolve an expression that was part of an ATTACH or DETACH statement. This ** is slightly different from resolving a normal SQL expression, because simple ** identifiers are treated as strings, not possible column names or aliases. ** ** i.e. if the parser sees: ** ** ATTACH DATABASE abc AS def ** ** it treats the two expressions as literal strings 'abc' and 'def' instead of ** looking for columns of the same name. ** ** This only applies to the root node of pExpr, so the statement: ** ** ATTACH DATABASE abc||def AS 'db2' ** ** will fail because neither abc or def can be resolved. */ static int resolveAttachExpr( NameContext pName, Expr pExpr ) { int rc = SQLITE_OK; if ( pExpr != null ) { if ( pExpr.op != TK_ID ) { rc = sqlite3ResolveExprNames( pName, ref pExpr ); if ( rc == SQLITE_OK && sqlite3ExprIsConstant( pExpr ) == 0 ) { sqlite3ErrorMsg( pName.pParse, "invalid name: \"%s\"", pExpr.u.zToken ); return SQLITE_ERROR; } } else { pExpr.op = TK_STRING; } } return rc; } /* ** An SQL user-function registered to do the work of an ATTACH statement. The ** three arguments to the function come directly from an attach statement: ** ** ATTACH DATABASE x AS y KEY z ** ** SELECT sqlite_attach(x, y, z) ** ** If the optional "KEY z" syntax is omitted, an SQL NULL is passed as the ** third argument. */ static void attachFunc( sqlite3_context context, int NotUsed, sqlite3_value[] argv ) { int i; int rc = 0; sqlite3 db = sqlite3_context_db_handle( context ); string zName; string zFile; string zPath = ""; string zErr = ""; int flags; Db aNew = null; string zErrDyn = ""; sqlite3_vfs pVfs = null; UNUSED_PARAMETER( NotUsed ); zFile = argv[0].z != null && ( argv[0].z.Length > 0 ) && argv[0].flags != MEM_Null ? sqlite3_value_text( argv[0] ) : ""; zName = argv[1].z != null && ( argv[1].z.Length > 0 ) && argv[1].flags != MEM_Null ? sqlite3_value_text( argv[1] ) : ""; //if( zFile==null ) zFile = ""; //if ( zName == null ) zName = ""; /* Check for the following errors: ** ** * Too many attached databases, ** * Transaction currently open ** * Specified database name already being used. */ if ( db.nDb >= db.aLimit[SQLITE_LIMIT_ATTACHED] + 2 ) { zErrDyn = sqlite3MPrintf( db, "too many attached databases - max %d", db.aLimit[SQLITE_LIMIT_ATTACHED] ); goto attach_error; } if ( 0 == db.autoCommit ) { zErrDyn = sqlite3MPrintf( db, "cannot ATTACH database within transaction" ); goto attach_error; } for ( i = 0; i < db.nDb; i++ ) { string z = db.aDb[i].zName; Debug.Assert( z != null && zName != null ); if ( z.Equals( zName, StringComparison.InvariantCultureIgnoreCase ) ) { zErrDyn = sqlite3MPrintf( db, "database %s is already in use", zName ); goto attach_error; } } /* Allocate the new entry in the db.aDb[] array and initialise the schema ** hash tables. */ /* Allocate the new entry in the db.aDb[] array and initialise the schema ** hash tables. */ //if( db.aDb==db.aDbStatic ){ // aNew = sqlite3DbMallocRaw(db, sizeof(db.aDb[0])*3 ); // if( aNew==0 ) return; // memcpy(aNew, db.aDb, sizeof(db.aDb[0])*2); //}else { if ( db.aDb.Length <= db.nDb ) Array.Resize( ref db.aDb, db.nDb + 1 );//aNew = sqlite3DbRealloc(db, db.aDb, sizeof(db.aDb[0])*(db.nDb+1) ); if ( db.aDb == null ) return; // if( aNew==0 ) return; //} db.aDb[db.nDb] = new Db();//db.aDb = aNew; aNew = db.aDb[db.nDb];//memset(aNew, 0, sizeof(*aNew)); // memset(aNew, 0, sizeof(*aNew)); /* Open the database file. If the btree is successfully opened, use ** it to obtain the database schema. At this point the schema may ** or may not be initialised. */ flags = (int)db.openFlags; rc = sqlite3ParseUri( db.pVfs.zName, zFile, ref flags, ref pVfs, ref zPath, ref zErr ); if ( rc != SQLITE_OK ) { //if ( rc == SQLITE_NOMEM ) //db.mallocFailed = 1; sqlite3_result_error( context, zErr, -1 ); //sqlite3_free( zErr ); return; } Debug.Assert( pVfs != null); flags |= SQLITE_OPEN_MAIN_DB; rc = sqlite3BtreeOpen( pVfs, zPath, db, ref aNew.pBt, 0, (int)flags ); //sqlite3_free( zPath ); db.nDb++; if ( rc == SQLITE_CONSTRAINT ) { rc = SQLITE_ERROR; zErrDyn = sqlite3MPrintf( db, "database is already attached" ); } else if ( rc == SQLITE_OK ) { Pager pPager; aNew.pSchema = sqlite3SchemaGet( db, aNew.pBt ); //if ( aNew.pSchema == null ) //{ // rc = SQLITE_NOMEM; //} //else if ( aNew.pSchema.file_format != 0 && aNew.pSchema.enc != ENC( db ) ) { zErrDyn = sqlite3MPrintf( db, "attached databases must use the same text encoding as main database" ); rc = SQLITE_ERROR; } pPager = sqlite3BtreePager( aNew.pBt ); sqlite3PagerLockingMode( pPager, db.dfltLockMode ); sqlite3BtreeSecureDelete( aNew.pBt, sqlite3BtreeSecureDelete( db.aDb[0].pBt, -1 ) ); } aNew.safety_level = 3; aNew.zName = zName;//sqlite3DbStrDup(db, zName); //if( rc==SQLITE_OK && aNew.zName==0 ){ // rc = SQLITE_NOMEM; //} #if SQLITE_HAS_CODEC if ( rc == SQLITE_OK ) { //extern int sqlite3CodecAttach(sqlite3*, int, const void*, int); //extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*); int nKey; string zKey; int t = sqlite3_value_type( argv[2] ); switch ( t ) { case SQLITE_INTEGER: case SQLITE_FLOAT: zErrDyn = "Invalid key value"; //sqlite3DbStrDup( db, "Invalid key value" ); rc = SQLITE_ERROR; break; case SQLITE_TEXT: case SQLITE_BLOB: nKey = sqlite3_value_bytes( argv[2] ); zKey = sqlite3_value_blob( argv[2] ).ToString(); // (char *)sqlite3_value_blob(argv[2]); rc = sqlite3CodecAttach( db, db.nDb - 1, zKey, nKey ); break; case SQLITE_NULL: /* No key specified. Use the key from the main database */ sqlite3CodecGetKey( db, 0, out zKey, out nKey ); //sqlite3CodecGetKey(db, 0, (void**)&zKey, nKey); if ( nKey > 0 || sqlite3BtreeGetReserve( db.aDb[0].pBt ) > 0 ) { rc = sqlite3CodecAttach( db, db.nDb - 1, zKey, nKey ); } break; } } #endif /* If the file was opened successfully, read the schema for the new database. ** If this fails, or if opening the file failed, then close the file and ** remove the entry from the db.aDb[] array. i.e. put everything back the way ** we found it. */ if ( rc == SQLITE_OK ) { sqlite3BtreeEnterAll( db ); rc = sqlite3Init( db, ref zErrDyn ); sqlite3BtreeLeaveAll( db ); } if ( rc != 0 ) { int iDb = db.nDb - 1; Debug.Assert( iDb >= 2 ); if ( db.aDb[iDb].pBt != null ) { sqlite3BtreeClose( ref db.aDb[iDb].pBt ); db.aDb[iDb].pBt = null; db.aDb[iDb].pSchema = null; } sqlite3ResetInternalSchema( db, -1 ); db.nDb = iDb; if ( rc == SQLITE_NOMEM || rc == SQLITE_IOERR_NOMEM ) { //// db.mallocFailed = 1; sqlite3DbFree( db, ref zErrDyn ); zErrDyn = sqlite3MPrintf( db, "out of memory" ); } else if ( zErrDyn == "" ) { zErrDyn = sqlite3MPrintf( db, "unable to open database: %s", zFile ); } goto attach_error; } return; attach_error: /* Return an error if we get here */ if ( zErrDyn != "" ) { sqlite3_result_error( context, zErrDyn, -1 ); sqlite3DbFree( db, ref zErrDyn ); } if ( rc != 0 ) sqlite3_result_error_code( context, rc ); } /* ** An SQL user-function registered to do the work of an DETACH statement. The ** three arguments to the function come directly from a detach statement: ** ** DETACH DATABASE x ** ** SELECT sqlite_detach(x) */ static void detachFunc( sqlite3_context context, int NotUsed, sqlite3_value[] argv ) { string zName = argv[0].z != null && ( argv[0].z.Length > 0 ) ? sqlite3_value_text( argv[0] ) : "";//(sqlite3_value_text(argv[0]); sqlite3 db = sqlite3_context_db_handle( context ); int i; Db pDb = null; StringBuilder zErr = new StringBuilder( 200 ); UNUSED_PARAMETER( NotUsed ); if ( zName == null ) zName = ""; for ( i = 0; i < db.nDb; i++ ) { pDb = db.aDb[i]; if ( pDb.pBt == null ) continue; if ( pDb.zName.Equals( zName, StringComparison.InvariantCultureIgnoreCase ) ) break; } if ( i >= db.nDb ) { sqlite3_snprintf( 200, zErr, "no such database: %s", zName ); goto detach_error; } if ( i < 2 ) { sqlite3_snprintf( 200, zErr, "cannot detach database %s", zName ); goto detach_error; } if ( 0 == db.autoCommit ) { sqlite3_snprintf( 200, zErr, "cannot DETACH database within transaction" ); goto detach_error; } if ( sqlite3BtreeIsInReadTrans( pDb.pBt ) || sqlite3BtreeIsInBackup( pDb.pBt ) ) { sqlite3_snprintf( 200, zErr, "database %s is locked", zName ); goto detach_error; } sqlite3BtreeClose( ref pDb.pBt ); pDb.pBt = null; pDb.pSchema = null; sqlite3ResetInternalSchema( db, -1 ); return; detach_error: sqlite3_result_error( context, zErr.ToString(), -1 ); } /* ** This procedure generates VDBE code for a single invocation of either the ** sqlite_detach() or sqlite_attach() SQL user functions. */ static void codeAttach( Parse pParse, /* The parser context */ int type, /* Either SQLITE_ATTACH or SQLITE_DETACH */ FuncDef pFunc, /* FuncDef wrapper for detachFunc() or attachFunc() */ Expr pAuthArg, /* Expression to pass to authorization callback */ Expr pFilename, /* Name of database file */ Expr pDbname, /* Name of the database to use internally */ Expr pKey /* Database key for encryption extension */ ) { NameContext sName; Vdbe v; sqlite3 db = pParse.db; int regArgs; sName = new NameContext();// memset( &sName, 0, sizeof(NameContext)); sName.pParse = pParse; if ( SQLITE_OK != resolveAttachExpr( sName, pFilename ) || SQLITE_OK != resolveAttachExpr( sName, pDbname ) || SQLITE_OK != resolveAttachExpr( sName, pKey ) ) { pParse.nErr++; goto attach_end; } #if !SQLITE_OMIT_AUTHORIZATION if( pAuthArg ){ char *zAuthArg; if( pAuthArg->op==TK_STRING ){ zAuthArg = pAuthArg->u.zToken; }else{ zAuthArg = 0; } int rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0); if(rc!=SQLITE_OK ){ goto attach_end; } } #endif //* SQLITE_OMIT_AUTHORIZATION */ v = sqlite3GetVdbe( pParse ); regArgs = sqlite3GetTempRange( pParse, 4 ); sqlite3ExprCode( pParse, pFilename, regArgs ); sqlite3ExprCode( pParse, pDbname, regArgs + 1 ); sqlite3ExprCode( pParse, pKey, regArgs + 2 ); Debug.Assert( v != null /*|| db.mallocFailed != 0 */ ); if ( v != null ) { sqlite3VdbeAddOp3( v, OP_Function, 0, regArgs + 3 - pFunc.nArg, regArgs + 3 ); Debug.Assert( pFunc.nArg == -1 || ( pFunc.nArg & 0xff ) == pFunc.nArg ); sqlite3VdbeChangeP5( v, (u8)( pFunc.nArg ) ); sqlite3VdbeChangeP4( v, -1, pFunc, P4_FUNCDEF ); /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this ** statement only). For DETACH, set it to false (expire all existing ** statements). */ sqlite3VdbeAddOp1( v, OP_Expire, ( type == SQLITE_ATTACH ) ? 1 : 0 ); } attach_end: sqlite3ExprDelete( db, ref pFilename ); sqlite3ExprDelete( db, ref pDbname ); sqlite3ExprDelete( db, ref pKey ); } /* ** Called by the parser to compile a DETACH statement. ** ** DETACH pDbname */ static FuncDef detach_func = new FuncDef( 1, /* nArg */ SQLITE_UTF8, /* iPrefEnc */ 0, /* flags */ null, /* pUserData */ null, /* pNext */ detachFunc, /* xFunc */ null, /* xStep */ null, /* xFinalize */ "sqlite_detach", /* zName */ null, /* pHash */ null /* pDestructor */ ); static void sqlite3Detach( Parse pParse, Expr pDbname ) { codeAttach( pParse, SQLITE_DETACH, detach_func, pDbname, null, null, pDbname ); } /* ** Called by the parser to compile an ATTACH statement. ** ** ATTACH p AS pDbname KEY pKey */ static FuncDef attach_func = new FuncDef( 3, /* nArg */ SQLITE_UTF8, /* iPrefEnc */ 0, /* flags */ null, /* pUserData */ null, /* pNext */ attachFunc, /* xFunc */ null, /* xStep */ null, /* xFinalize */ "sqlite_attach", /* zName */ null, /* pHash */ null /* pDestructor */ ); static void sqlite3Attach( Parse pParse, Expr p, Expr pDbname, Expr pKey ) { codeAttach( pParse, SQLITE_ATTACH, attach_func, p, p, pDbname, pKey ); } #endif // * SQLITE_OMIT_ATTACH */ /* ** Initialize a DbFixer structure. This routine must be called prior ** to passing the structure to one of the sqliteFixAAAA() routines below. ** ** The return value indicates whether or not fixation is required. TRUE ** means we do need to fix the database references, FALSE means we do not. */ static int sqlite3FixInit( DbFixer pFix, /* The fixer to be initialized */ Parse pParse, /* Error messages will be written here */ int iDb, /* This is the database that must be used */ string zType, /* "view", "trigger", or "index" */ Token pName /* Name of the view, trigger, or index */ ) { sqlite3 db; if ( NEVER( iDb < 0 ) || iDb == 1 ) return 0; db = pParse.db; Debug.Assert( db.nDb > iDb ); pFix.pParse = pParse; pFix.zDb = db.aDb[iDb].zName; pFix.zType = zType; pFix.pName = pName; return 1; } /* ** The following set of routines walk through the parse tree and assign ** a specific database to all table references where the database name ** was left unspecified in the original SQL statement. The pFix structure ** must have been initialized by a prior call to sqlite3FixInit(). ** ** These routines are used to make sure that an index, trigger, or ** view in one database does not refer to objects in a different database. ** (Exception: indices, triggers, and views in the TEMP database are ** allowed to refer to anything.) If a reference is explicitly made ** to an object in a different database, an error message is added to ** pParse.zErrMsg and these routines return non-zero. If everything ** checks out, these routines return 0. */ static int sqlite3FixSrcList( DbFixer pFix, /* Context of the fixation */ SrcList pList /* The Source list to check and modify */ ) { int i; string zDb; SrcList_item pItem; if ( NEVER( pList == null ) ) return 0; zDb = pFix.zDb; for ( i = 0; i < pList.nSrc; i++ ) {//, pItem++){ pItem = pList.a[i]; if ( pItem.zDatabase == null ) { pItem.zDatabase = zDb;// sqlite3DbStrDup( pFix.pParse.db, zDb ); } else if ( !pItem.zDatabase.Equals( zDb ,StringComparison.InvariantCultureIgnoreCase ) ) { sqlite3ErrorMsg( pFix.pParse, "%s %T cannot reference objects in database %s", pFix.zType, pFix.pName, pItem.zDatabase ); return 1; } #if !SQLITE_OMIT_VIEW || !SQLITE_OMIT_TRIGGER if ( sqlite3FixSelect( pFix, pItem.pSelect ) != 0 ) return 1; if ( sqlite3FixExpr( pFix, pItem.pOn ) != 0 ) return 1; #endif } return 0; } #if !SQLITE_OMIT_VIEW || !SQLITE_OMIT_TRIGGER static int sqlite3FixSelect( DbFixer pFix, /* Context of the fixation */ Select pSelect /* The SELECT statement to be fixed to one database */ ) { while ( pSelect != null ) { if ( sqlite3FixExprList( pFix, pSelect.pEList ) != 0 ) { return 1; } if ( sqlite3FixSrcList( pFix, pSelect.pSrc ) != 0 ) { return 1; } if ( sqlite3FixExpr( pFix, pSelect.pWhere ) != 0 ) { return 1; } if ( sqlite3FixExpr( pFix, pSelect.pHaving ) != 0 ) { return 1; } pSelect = pSelect.pPrior; } return 0; } static int sqlite3FixExpr( DbFixer pFix, /* Context of the fixation */ Expr pExpr /* The expression to be fixed to one database */ ) { while ( pExpr != null ) { if ( ExprHasAnyProperty( pExpr, EP_TokenOnly ) ) break; if ( ExprHasProperty( pExpr, EP_xIsSelect ) ) { if ( sqlite3FixSelect( pFix, pExpr.x.pSelect ) != 0 ) return 1; } else { if ( sqlite3FixExprList( pFix, pExpr.x.pList ) != 0 ) return 1; } if ( sqlite3FixExpr( pFix, pExpr.pRight ) != 0 ) { return 1; } pExpr = pExpr.pLeft; } return 0; } static int sqlite3FixExprList( DbFixer pFix, /* Context of the fixation */ ExprList pList /* The expression to be fixed to one database */ ) { int i; ExprList_item pItem; if ( pList == null ) return 0; for ( i = 0; i < pList.nExpr; i++ )//, pItem++ ) { pItem = pList.a[i]; if ( sqlite3FixExpr( pFix, pItem.pExpr ) != 0 ) { return 1; } } return 0; } #endif #if !SQLITE_OMIT_TRIGGER static int sqlite3FixTriggerStep( DbFixer pFix, /* Context of the fixation */ TriggerStep pStep /* The trigger step be fixed to one database */ ) { while ( pStep != null ) { if ( sqlite3FixSelect( pFix, pStep.pSelect ) != 0 ) { return 1; } if ( sqlite3FixExpr( pFix, pStep.pWhere ) != 0 ) { return 1; } if ( sqlite3FixExprList( pFix, pStep.pExprList ) != 0 ) { return 1; } pStep = pStep.pNext; } return 0; } #endif } }
hsu1994/Terminator
Client/Assets/Scripts/Air2000/Utility/Sqlite/Sqlite3/source/src/attach_c.cs
C#
apache-2.0
19,135
[ 30522, 1001, 9375, 29296, 4221, 1035, 2004, 6895, 2072, 1001, 9375, 29296, 4221, 1035, 4487, 19150, 1035, 1048, 10343, 1001, 9375, 29296, 4221, 1035, 9585, 1035, 15849, 4697, 1035, 3526, 1035, 4638, 1001, 9375, 29296, 4221, 1035, 20101, 259...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Nerdz.Messenger.Controller; using Nerdz.Messages; using Nerdz; namespace Tests.Controller { public class DummyUI : IMessengerView { private Credentials credentials; private IMessengerController controller; public IMessengerController Controller { set { controller = value; } get { return controller; } } public void UpdateConversations(System.Collections.Generic.List<Nerdz.Messages.IConversation> conversations) { Console.WriteLine("Conversations: "); foreach (IConversation c in conversations) { Console.WriteLine(c); } } public void UpdateMessages(System.Collections.Generic.List<Nerdz.Messages.IMessage> messages) { Console.WriteLine("Messages: "); foreach (IMessage m in messages) { Console.WriteLine(m); } } public void ShowLogin() { Console.WriteLine("Username: "); string username = "new user input from textbox"; Console.WriteLine("Password: "); string password = "password input from textbox"; credentials = new Credentials(username, password); } public void ClearConversations() { Console.WriteLine("\n\n\nConversations list cleaned\n\n"); } public void ClearConversation() { Console.WriteLine("\n\nConversation cleaned\n\n"); } public void DisplayError(string error) { Console.Error.WriteLine("[!] " + error); } public void DisplayCriticalError(string error) { Console.Error.WriteLine("CRITICAL: " + error); } public int ConversationDisplayed() { return 0; } } [TestClass] public class MessengerControllerTests { static private IMessengerView view; static private IMessengerController controller; [TestMethod] public void NewController() { Credentials c = new Credentials(0, "wrongpass"); view = new DummyUI(); try { controller = new MessengerController(view, c); } catch (LoginException) { Console.WriteLine("Wrong username and password (OK!)"); } c = new Credentials("admin", "adminadmin"); controller = new MessengerController(view, c); } [TestMethod] public void TestGetConversations() { controller.Conversations(); } [TestMethod] public void TestGetConversationOK() { controller.Conversation(0); // exists, no exception expected } [ExpectedException(typeof(CriticalException))] [TestMethod] public void TestGetConversationFAIL() { controller.Conversation(110); } [TestMethod] public void TestSendOK() { controller.Send("Gaben", "great app :>"); // user nessuno exists, no exception expected } [ExpectedException(typeof(BadStatusException))] [TestMethod] public void TestSendFAIL() { controller.Send("94949494", "great app :>"); // numeric username can't exists, so this test shoudl fail } [TestMethod] public void TestLogout() { controller.Logout(); } } }
nerdzeu/nm.net
Tests/Controller/MessengerControllerTestMethods.cs
C#
gpl-3.0
3,786
[ 30522, 2478, 2291, 1025, 2478, 7513, 1012, 26749, 8525, 20617, 1012, 3231, 3406, 27896, 1012, 3131, 22199, 2075, 1025, 2478, 11265, 4103, 2480, 1012, 11981, 1012, 11486, 1025, 2478, 11265, 4103, 2480, 1012, 7696, 1025, 2478, 11265, 4103, 24...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
(function() { function setUpTopLevelInteraction() { var TopLevelInteraction = new ITPHelper({ redirectUrl: document.body.dataset.redirectUrl, }); TopLevelInteraction.execute(); } document.addEventListener("DOMContentLoaded", setUpTopLevelInteraction); })();
Shopify/shopify_app
app/assets/javascripts/shopify_app/top_level_interaction.js
JavaScript
mit
284
[ 30522, 1006, 3853, 1006, 1007, 1063, 3853, 16437, 14399, 20414, 18809, 14621, 7542, 1006, 1007, 1063, 13075, 2327, 20414, 18809, 14621, 7542, 1027, 2047, 2009, 8458, 2884, 4842, 1006, 1063, 2417, 7442, 6593, 3126, 2140, 1024, 6254, 1012, 23...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * 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. */ package com.android.launcher3.uioverrides.touchcontrollers; import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.Utilities.EDGE_NAV_BAR; import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.graphics.PointF; import android.util.Log; import android.view.MotionEvent; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.graphics.OverviewScrim; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.VibratorWrapper; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.OverviewToHomeAnim; import com.android.quickstep.views.RecentsView; /** * Touch controller which handles swipe and hold from the nav bar to go to Overview. Swiping above * the nav bar falls back to go to All Apps. Swiping from the nav bar without holding goes to the * first home screen instead of to Overview. */ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchController { // How much of the movement to use for translating overview after swipe and hold. private static final float OVERVIEW_MOVEMENT_FACTOR = 0.25f; private static final long TRANSLATION_ANIM_MIN_DURATION_MS = 80; private static final float TRANSLATION_ANIM_VELOCITY_DP_PER_MS = 0.8f; private final RecentsView mRecentsView; private boolean mDidTouchStartInNavBar; private boolean mReachedOverview; // The last recorded displacement before we reached overview. private PointF mStartDisplacement = new PointF(); private float mStartY; private AnimatorPlaybackController mOverviewResistYAnim; // Normal to Hint animation has flag SKIP_OVERVIEW, so we update this scrim with this animator. private ObjectAnimator mNormalToHintOverviewScrimAnimator; public NoButtonNavbarToOverviewTouchController(Launcher l) { super(l); mRecentsView = l.getOverviewPanel(); if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.PAUSE_NOT_DETECTED, "NoButtonNavbarToOverviewTouchController.ctor"); } } @Override protected float getMotionPauseMaxDisplacement() { // No need to disallow pause when swiping up all the way up the screen (unlike // FlingAndHoldTouchController where user is probably intending to go to all apps). return Float.MAX_VALUE; } @Override protected boolean canInterceptTouch(MotionEvent ev) { mDidTouchStartInNavBar = (ev.getEdgeFlags() & EDGE_NAV_BAR) != 0; return super.canInterceptTouch(ev); } @Override protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) { if (fromState == NORMAL && mDidTouchStartInNavBar) { return HINT_STATE; } else if (fromState == OVERVIEW && isDragTowardPositive) { // Don't allow swiping up to all apps. return OVERVIEW; } return super.getTargetState(fromState, isDragTowardPositive); } @Override protected float initCurrentAnimation(int animComponents) { float progressMultiplier = super.initCurrentAnimation(animComponents); if (mToState == HINT_STATE) { // Track the drag across the entire height of the screen. progressMultiplier = -1 / getShiftRange(); } return progressMultiplier; } @Override public void onDragStart(boolean start, float startDisplacement) { super.onDragStart(start, startDisplacement); if (mFromState == NORMAL && mToState == HINT_STATE) { mNormalToHintOverviewScrimAnimator = ObjectAnimator.ofFloat( mLauncher.getDragLayer().getOverviewScrim(), OverviewScrim.SCRIM_PROGRESS, mFromState.getOverviewScrimAlpha(mLauncher), mToState.getOverviewScrimAlpha(mLauncher)); } mReachedOverview = false; mOverviewResistYAnim = null; } @Override protected void updateProgress(float fraction) { super.updateProgress(fraction); if (mNormalToHintOverviewScrimAnimator != null) { mNormalToHintOverviewScrimAnimator.setCurrentFraction(fraction); } } @Override public void onDragEnd(float velocity) { super.onDragEnd(velocity); mNormalToHintOverviewScrimAnimator = null; if (mLauncher.isInState(OVERVIEW)) { // Normally we would cleanup the state based on mCurrentAnimation, but since we stop // using that when we pause to go to Overview, we need to clean up ourselves. clearState(); } } @Override protected void updateSwipeCompleteAnimation(ValueAnimator animator, long expectedDuration, LauncherState targetState, float velocity, boolean isFling) { super.updateSwipeCompleteAnimation(animator, expectedDuration, targetState, velocity, isFling); if (targetState == HINT_STATE) { // Normally we compute the duration based on the velocity and distance to the given // state, but since the hint state tracks the entire screen without a clear endpoint, we // need to manually set the duration to a reasonable value. animator.setDuration(HINT_STATE.getTransitionDuration(mLauncher)); } } @Override protected void onMotionPauseChanged(boolean isPaused) { if (mCurrentAnimation == null) { return; } mNormalToHintOverviewScrimAnimator = null; mCurrentAnimation.dispatchOnCancelWithoutCancelRunnable(() -> { mLauncher.getStateManager().goToState(OVERVIEW, true, () -> { mOverviewResistYAnim = AnimatorControllerWithResistance .createRecentsResistanceFromOverviewAnim(mLauncher, null) .createPlaybackController(); mReachedOverview = true; maybeSwipeInteractionToOverviewComplete(); }); }); VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC); } private void maybeSwipeInteractionToOverviewComplete() { if (mReachedOverview && mDetector.isSettlingState()) { onSwipeInteractionCompleted(OVERVIEW, Touch.SWIPE); } } @Override protected boolean handlingOverviewAnim() { return mDidTouchStartInNavBar && super.handlingOverviewAnim(); } @Override public boolean onDrag(float yDisplacement, float xDisplacement, MotionEvent event) { if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.PAUSE_NOT_DETECTED, "NoButtonNavbarToOverviewTouchController"); } if (mMotionPauseDetector.isPaused()) { if (!mReachedOverview) { mStartDisplacement.set(xDisplacement, yDisplacement); mStartY = event.getY(); } else { mRecentsView.setTranslationX((xDisplacement - mStartDisplacement.x) * OVERVIEW_MOVEMENT_FACTOR); float yProgress = (mStartDisplacement.y - yDisplacement) / mStartY; if (yProgress > 0 && mOverviewResistYAnim != null) { mOverviewResistYAnim.setPlayFraction(yProgress); } else { mRecentsView.setTranslationY((yDisplacement - mStartDisplacement.y) * OVERVIEW_MOVEMENT_FACTOR); } } // Stay in Overview. return true; } return super.onDrag(yDisplacement, xDisplacement, event); } @Override protected void goToOverviewOnDragEnd(float velocity) { float velocityDp = dpiFromPx(velocity); boolean isFling = Math.abs(velocityDp) > 1; StateManager<LauncherState> stateManager = mLauncher.getStateManager(); boolean goToHomeInsteadOfOverview = isFling; if (goToHomeInsteadOfOverview) { new OverviewToHomeAnim(mLauncher, ()-> onSwipeInteractionCompleted(NORMAL, Touch.FLING)) .animateWithVelocity(velocity); } if (mReachedOverview) { float distanceDp = dpiFromPx(Math.max( Math.abs(mRecentsView.getTranslationX()), Math.abs(mRecentsView.getTranslationY()))); long duration = (long) Math.max(TRANSLATION_ANIM_MIN_DURATION_MS, distanceDp / TRANSLATION_ANIM_VELOCITY_DP_PER_MS); mRecentsView.animate() .translationX(0) .translationY(0) .setInterpolator(ACCEL_DEACCEL) .setDuration(duration) .withEndAction(goToHomeInsteadOfOverview ? null : this::maybeSwipeInteractionToOverviewComplete); if (!goToHomeInsteadOfOverview) { // Return to normal properties for the overview state. StateAnimationConfig config = new StateAnimationConfig(); config.duration = duration; LauncherState state = mLauncher.getStateManager().getState(); mLauncher.getStateManager().createAtomicAnimation(state, state, config).start(); } } } private float dpiFromPx(float pixels) { return Utilities.dpiFromPx(pixels, mLauncher.getResources().getDisplayMetrics()); } }
Deletescape-Media/Lawnchair
quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
Java
gpl-3.0
10,748
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 12609, 1996, 11924, 2330, 3120, 2622, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php get_header(); ?> <div class=""> <?php get_template_part(contact); ?> <div class="page" id="<?php the_title(); ?>"> <header class="bp-header cf about animate row" data-emergence="hidden" > <h1 class="bp-header__title animate col-lg-12 col-md-12 col-sm-12 col-xs-12" data-emergence="hidden">It is just that page which shows you something bad is happened (404)</h1> <div class="info col-lg-6 col-md-8 col-sm-12 col-xs-12"> </div> </header> </div> </div> <?php get_footer(); ?>
reskir/spintus
404.php
PHP
mit
537
[ 30522, 1026, 1029, 25718, 2131, 1035, 20346, 1006, 1007, 1025, 1029, 1028, 1026, 4487, 2615, 2465, 1027, 1000, 1000, 1028, 1026, 1029, 25718, 2131, 1035, 23561, 1035, 2112, 1006, 3967, 1007, 1025, 1029, 1028, 1026, 4487, 2615, 2465, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
var contenedor = {}; var json = []; var json_active = []; var timeout; var result = {}; $(document).ready(function() { $('#buscador').keyup(function() {   if (timeout) {     clearTimeout(timeout);     timeout = null;   }    timeout = setTimeout(function() { search(); }, 100); }); $("body").on('change', '#result', function() { result = $("#result").val(); load_content(json); }); $("body").on('click', '.asc', function() { var name = $(this).parent().attr('rel'); console.log(name); $(this).removeClass("asc").addClass("desc"); order(name, true); }); $("body").on('click', '.desc', function() { var name = $(this).parent().attr('rel'); $(this).removeClass("desc").addClass("asc"); order(name, false); }); }); function update(id,parent,valor){ for (var i=0; i< json.length; i++) { if (json[i].id === id){ json[i][parent] = valor; return; } } } function load_content(json) { max = result; data = json.slice(0, max); json_active = json; $("#numRows").html(json.length); contenedor.html(''); 2 var list = table.find("th[rel]"); var html = ''; $.each(data, function(i, value) { html += '<tr id="' + value.id + '">'; $.each(list, function(index) { valor = $(this).attr('rel'); if (valor != 'acction') { if ($(this).hasClass("editable")) { html += '<td><span class="edition" rel="' + value.id + '">' + value[valor] .substring(0, 60) +'</span></td>'; } else if($(this).hasClass("view")){ if(value[valor].length > 1){ var class_1 = $(this).data('class'); html += '<td><a href="javascript:void(0)" class="'+class_1+'" rel="'+ value[valor] + '" data-id="' + value.id + '"></a></td>'; }else{ html += '<td></td>'; } }else{ html += '<td>' + value[valor] + '</td>'; } } else { html += '<td>'; $.each(acction, function(k, data) { html += '<a class="' + data.class + '" rel="' + value[data.rel] + '" href="' + data.link + value[data.parameter] + '" target="'+data.target+'" >' + data.button + '</a>'; }); html += "</td>"; } if (index >= list.length - 1) { html += '</tr>'; contenedor.append(html); html = ''; } }); }); } function selectedRow(json) { var num = result; var rows = json.length; var total = rows / num; var cant = Math.floor(total); $("#result").html(''); for (i = 0; i < cant; i++) { $("#result").append("<option value=\"" + parseInt(num) + "\">" + num + "</option>"); num = num + result; } $("#result").append("<option value=\"" + parseInt(rows) + "\">" + rows + "</option>"); } function order(prop, asc) { json = json.sort(function(a, b) { if (asc) return (a[prop] > b[prop]) ? 1 : ((a[prop] < b[prop]) ? -1 : 0); else return (b[prop] > a[prop]) ? 1 : ((b[prop] < a[prop]) ? -1 : 0); }); contenedor.html(''); load_content(json); } function search() { var list = table.find("th[rel]"); var data = []; var serch = $("#buscador").val(); json.forEach(function(element, index, array) { $.each(list, function(index) { valor = $(this).attr('rel'); if (element[valor]) { if (element[valor].like('%' + serch + '%')) { data.push(element); return false; } } }); }); contenedor.html(''); load_content(data); } String.prototype.like = function(search) { if (typeof search !== 'string' || this === null) { return false; } search = search.replace(new RegExp("([\\.\\\\\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:\\-])", "g"), "\\$1"); search = search.replace(/%/g, '.*').replace(/_/g, '.'); return RegExp('^' + search + '$', 'gi').test(this); } function export_csv(JSONData, ReportTitle, ShowLabel) { var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData; var CSV = ''; // CSV += ReportTitle + '\r\n\n'; if (ShowLabel) { var row = ""; for (var index in arrData[0]) { row += index + ';'; } row = row.slice(0, -1); CSV += row + '\r\n'; } for (var i = 0; i < arrData.length; i++) { var row = ""; for (var index in arrData[i]) { row += '"' + arrData[i][index] + '";'; } row.slice(0, row.length - 1); CSV += row + '\r\n'; } if (CSV == '') { alert("Invalid data"); return; } // var fileName = "Report_"; //fileName += ReportTitle.replace(/ /g,"_"); var uri = 'data:text/csv;charset=utf-8,' + escape(CSV); var link = document.createElement("a"); link.href = uri; link.style = "visibility:hidden"; link.download = ReportTitle + ".csv"; document.body.appendChild(link); link.click(); document.body.removeChild(link); }
mpandolfelli/papelera
js/function.js
JavaScript
mit
5,520
[ 30522, 13075, 9530, 6528, 26010, 2099, 1027, 1063, 1065, 1025, 13075, 1046, 3385, 1027, 1031, 1033, 1025, 13075, 1046, 3385, 1035, 3161, 1027, 1031, 1033, 1025, 13075, 2051, 5833, 1025, 13075, 2765, 1027, 1063, 1065, 1025, 1002, 1006, 6254,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html class="theme-next mist use-motion" lang=""> <head> <meta charset="UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> <meta name="theme-color" content="#222"> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" /> <link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" /> <link href="/css/main.css?v=5.1.3" rel="stylesheet" type="text/css" /> <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.3"> <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.3"> <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.3"> <link rel="mask-icon" href="/images/logo.svg?v=5.1.3" color="#222"> <meta name="keywords" content="Hexo, NexT" /> <meta name="description" content="Gibt nichts was warmes Wasser nicht heilen könnte."> <meta property="og:type" content="website"> <meta property="og:title" content="EVA&#39;S BLOG"> <meta property="og:url" content="http://yoursite.com/archives/2017/11/index.html"> <meta property="og:site_name" content="EVA&#39;S BLOG"> <meta property="og:description" content="Gibt nichts was warmes Wasser nicht heilen könnte."> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="EVA&#39;S BLOG"> <meta name="twitter:description" content="Gibt nichts was warmes Wasser nicht heilen könnte."> <script type="text/javascript" id="hexo.configurations"> var NexT = window.NexT || {}; var CONFIG = { root: '/', scheme: 'Mist', version: '5.1.3', sidebar: {"display":"hide","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false}, fancybox: true, tabs: true, motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}, duoshuo: { userId: '0', author: 'Author' }, algolia: { applicationID: '', apiKey: '', indexName: '', hits: {"per_page":10}, labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"} } }; </script> <link rel="canonical" href="http://yoursite.com/archives/2017/11/"/> <title>Archiv | EVA'S BLOG</title> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-101651836-1', 'auto'); ga('send', 'pageview'); </script> </head> <body itemscope itemtype="http://schema.org/WebPage" lang=""> <div class="container page-archive"> <div class="headband"></div> <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader"> <div class="header-inner"><div class="site-brand-wrapper"> <div class="site-meta "> <div class="custom-logo-site-title"> <a href="/" class="brand" rel="start"> <span class="logo-line-before"><i></i></span> <span class="site-title">EVA'S BLOG</span> <span class="logo-line-after"><i></i></span> </a> </div> <p class="site-subtitle"></p> </div> <div class="site-nav-toggle"> <button> <span class="btn-bar"></span> <span class="btn-bar"></span> <span class="btn-bar"></span> </button> </div> </div> <nav class="site-nav"> <ul id="menu" class="menu"> <li class="menu-item menu-item-home"> <a href="/" rel="section"> <i class="menu-item-icon fa fa-fw fa-home"></i> <br /> Startseite </a> </li> <li class="menu-item menu-item-about"> <a href="/about/" rel="section"> <i class="menu-item-icon fa fa-fw fa-user"></i> <br /> Über </a> </li> <li class="menu-item menu-item-tags"> <a href="/tags/" rel="section"> <i class="menu-item-icon fa fa-fw fa-tags"></i> <br /> Tags </a> </li> <li class="menu-item menu-item-categories"> <a href="/categories/" rel="section"> <i class="menu-item-icon fa fa-fw fa-th"></i> <br /> Kategorien </a> </li> <li class="menu-item menu-item-archives"> <a href="/archives/" rel="section"> <i class="menu-item-icon fa fa-fw fa-archive"></i> <br /> Archiv </a> </li> </ul> </nav> </div> </header> <main id="main" class="main"> <div class="main-inner"> <div class="content-wrap"> <div id="content" class="content"> <div class="post-block archive"> <div id="posts" class="posts-collapse"> <span class="archive-move-on"></span> <span class="archive-page-counter"> Öhm..! Insgesamt 2 Artikel. Bleib dran. </span> <div class="collection-title"> <h1 class="archive-year" id="archive-year-2017">2017</h1> </div> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/11/23/Robotik-Mathematische-Grundlagen/" itemprop="url"> <span itemprop="name">Robotik: Mathematische Grundlagen</span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-11-23T17:04:01+01:00" content="2017-11-23" > 11-23 </time> </div> </header> </article> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <header class="post-header"> <h2 class="post-title"> <a class="post-title-link" href="/2017/11/23/hello-world/" itemprop="url"> <span itemprop="name">Hello World</span> </a> </h2> <div class="post-meta"> <time class="post-time" itemprop="dateCreated" datetime="2017-11-23T10:53:27+01:00" content="2017-11-23" > 11-23 </time> </div> </header> </article> </div> </div> </div> </div> <div class="sidebar-toggle"> <div class="sidebar-toggle-line-wrap"> <span class="sidebar-toggle-line sidebar-toggle-line-first"></span> <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span> <span class="sidebar-toggle-line sidebar-toggle-line-last"></span> </div> </div> <aside id="sidebar" class="sidebar"> <div class="sidebar-inner"> <section class="site-overview-wrap sidebar-panel sidebar-panel-active"> <div class="site-overview"> <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person"> <img class="site-author-image" itemprop="image" src="/images/avatar.jpg" alt="Eva CHEN" /> <p class="site-author-name" itemprop="name">Eva CHEN</p> <p class="site-description motion-element" itemprop="description">Gibt nichts was warmes Wasser nicht heilen könnte.</p> </div> <nav class="site-state motion-element"> <div class="site-state-item site-state-posts"> <a href="/archives/"> <span class="site-state-item-count">2</span> <span class="site-state-item-name">Artikel</span> </a> </div> <div class="site-state-item site-state-categories"> <a href="/categories/index.html"> <span class="site-state-item-count">1</span> <span class="site-state-item-name">Kategorien</span> </a> </div> <div class="site-state-item site-state-tags"> <a href="/tags/index.html"> <span class="site-state-item-count">4</span> <span class="site-state-item-name">Tags</span> </a> </div> </nav> <div class="links-of-author motion-element"> <span class="links-of-author-item"> <a href="mailto:evachenzehua@gmail.com" target="_blank" title="E-Mail"> <i class="fa fa-fw fa-envelope"></i>E-Mail</a> </span> <span class="links-of-author-item"> <a href="https://instagram.com/evachenzehua" target="_blank" title="Instagram"> <i class="fa fa-fw fa-instagram"></i>Instagram</a> </span> </div> </div> </section> </div> </aside> </div> </main> <footer id="footer" class="footer"> <div class="footer-inner"> <div class="copyright">&copy; <span itemprop="copyrightYear">2017</span> <span class="with-love"> <i class="fa fa-heartbeat"></i> </span> <span class="author" itemprop="copyrightHolder">Eva CHEN</span> </div> <div class="powered-by">Erstellt mit <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div> <span class="post-meta-divider">|</span> <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a></div> </div> </footer> <div class="back-to-top"> <i class="fa fa-arrow-up"></i> </div> </div> <script type="text/javascript"> if (Object.prototype.toString.call(window.Promise) !== '[object Function]') { window.Promise = null; } </script> <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script> <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script> <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script> <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script> <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script> <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script> <script type="text/javascript" src="/js/src/utils.js?v=5.1.3"></script> <script type="text/javascript" src="/js/src/motion.js?v=5.1.3"></script> <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.3"></script> <script id="dsq-count-scr" src="https://eva's blog.disqus.com/count.js" async></script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], processEscapes: true, skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'] } }); </script> <script type="text/x-mathjax-config"> MathJax.Hub.Queue(function() { var all = MathJax.Hub.getAllJax(), i; for (i=0; i < all.length; i += 1) { all[i].SourceElement().parentNode.className += ' has-jax'; } }); </script> <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> </body> </html>
evachenzehua/evachenzehua.github.io
archives/2017/11/index.html
HTML
mit
13,230
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 2465, 1027, 1000, 4323, 1011, 2279, 11094, 2224, 1011, 4367, 1000, 11374, 1027, 1000, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System.ComponentModel; using System.Runtime.CompilerServices; namespace NAudioUniversalDemo { internal class ViewModelBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } } }
skor98/DtWPF
speechKit/NAudio-master/NAudioUniversalDemo/ViewModelBase.cs
C#
mit
517
[ 30522, 2478, 2291, 1012, 6922, 5302, 9247, 1025, 2478, 2291, 1012, 2448, 7292, 1012, 21624, 8043, 30524, 2724, 3200, 22305, 14728, 15338, 11774, 3917, 3200, 22305, 2098, 1025, 5123, 7484, 11675, 2006, 21572, 4842, 3723, 22305, 2098, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.qldb.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.qldb.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * DescribeJournalKinesisStreamResult JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class DescribeJournalKinesisStreamResultJsonUnmarshaller implements Unmarshaller<DescribeJournalKinesisStreamResult, JsonUnmarshallerContext> { public DescribeJournalKinesisStreamResult unmarshall(JsonUnmarshallerContext context) throws Exception { DescribeJournalKinesisStreamResult describeJournalKinesisStreamResult = new DescribeJournalKinesisStreamResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return describeJournalKinesisStreamResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("Stream", targetDepth)) { context.nextToken(); describeJournalKinesisStreamResult.setStream(JournalKinesisStreamDescriptionJsonUnmarshaller.getInstance().unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return describeJournalKinesisStreamResult; } private static DescribeJournalKinesisStreamResultJsonUnmarshaller instance; public static DescribeJournalKinesisStreamResultJsonUnmarshaller getInstance() { if (instance == null) instance = new DescribeJournalKinesisStreamResultJsonUnmarshaller(); return instance; } }
aws/aws-sdk-java
aws-java-sdk-qldb/src/main/java/com/amazonaws/services/qldb/model/transform/DescribeJournalKinesisStreamResultJsonUnmarshaller.java
Java
apache-2.0
3,008
[ 30522, 1013, 1008, 1008, 9385, 2418, 1011, 16798, 2475, 9733, 1012, 4012, 1010, 4297, 1012, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import React from 'react' import { CLOSE_CHARACTER } from '../model/constants' import styles from './MessagesComp.module.css' export interface MessagesCompProps { _messages: readonly string[] _removeMessageByIndex: (index: number) => void } export function MessagesComp({ _messages, _removeMessageByIndex, }: MessagesCompProps) { return ( <> {_messages.map((message, index) => ( <div key={index} className={styles.message}> <div className={styles.content}>{message}</div> <button type='button' className={styles.button} onClick={() => { _removeMessageByIndex(index) }} > {CLOSE_CHARACTER} </button> </div> ))} </> ) }
andraaspar/mag
src/comp/MessagesComp.tsx
TypeScript
mit
701
[ 30522, 12324, 10509, 2013, 1005, 10509, 1005, 12324, 1063, 2485, 1035, 2839, 1065, 2013, 1005, 1012, 1012, 1013, 2944, 1013, 5377, 2015, 1005, 12324, 6782, 2013, 1005, 1012, 1013, 7696, 9006, 2361, 1012, 11336, 1012, 20116, 2015, 1005, 9167...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * Created by PhpStorm. * User: sjoder * Date: 27.05.15 * Time: 21:33 */ namespace PM\ScanBundle\Model; use PM\ScanBundle\Entity\File; /** * Class FileModel * * @package PM\ScanBundle\Model */ class FileModel { const TRANSCODE_NONE = 0; const TRANSCODE_WORKING = 1; const TRANSCODE_IGNORED = 2; const TRANSCODE_DONE = 3; const TRANSCODE_BACKUP = 8; const TRANSCODE_FAILED = 9; /** * Get Known Extension * * @return array */ public static function getKnownExtensions() { return array( 'mkv', 'mp4', 'm4v', 'mpg', 'mp2', 'mpeg', 'mpe', 'mpv', 'webm', 'flv', 'vob', 'avi', 'wmv', '3gp', 'mp3', 'cbr', 'm3a', 'aac' ); } /** * Get Path with new extension * * @param string $path * @param string $extension * * @return string */ public static function getPathWithNewExtension($path, $extension) { $path = explode('.', $path); unset($path[count($path) - 1]); return sprintf("%s.%s", implode(".", $path), $extension); } /** * Is Known Extension? * * @return bool */ public function isKnownExtension() { if (!$this instanceof File) { throw new \LogicException("Not a file"); } if (true === in_array($this->getExtension(), self::getKnownExtensions())) { return true; } return false; } }
pmdevelopment/movie-agent
src/PM/ScanBundle/Model/FileModel.php
PHP
mit
1,671
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 2580, 2011, 25718, 19718, 1012, 1008, 5310, 1024, 1055, 5558, 4063, 1008, 3058, 1024, 2676, 1012, 5709, 1012, 2321, 1008, 2051, 1024, 2538, 1024, 3943, 1008, 1013, 3415, 15327, 7610, 1032, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BillPrint { public class Print { } }
mkmpvtltd1/mkm-BookStore
BillPrint/Print.cs
C#
mit
149
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 2291, 1012, 11409, 4160, 1025, 2478, 2291, 1012, 3793, 1025, 3415, 15327, 3021, 16550, 1063, 2270, 2465, 6140, 1063, 1065, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*************************************************************************** * Copyright (C) 2009-2012 Virginia Tech Real-Time Systems Lab * * * * Original version written by Matthew Dellinger * * mdelling@vt.edu * * * * Re-written by Aaron Lindsay * * aaron@aclindsay.com * * * * 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., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include <sys/resource.h> #include "tester.h" #include "salloc.h" #include "hardware.h" /* * This is the one copy of the test struct which gets passed around everywhere * to communicate options, global variables to the pieces of the application * which need them. */ static struct test tester = { .options = 0, .workload = 0, .task_list = 0, .tasks = 0, .num_tasks = 0, .locks = 0, .num_locks = -1, .num_processors = 0, .domain_masks = 0, .global_start_time = 0 }; /* * Initialize all the locks for the taskset. */ static void initialize_test_locks() { int i; tester.locks = (chronos_mutex_t *) salloc(sizeof(chronos_mutex_t) * tester.num_locks); if (!tester.locks) fatal_error("Failed to allocate memory."); for (i = 0; i < tester.num_locks; i++) chronos_mutex_init(&tester.locks[i]); if (tester.num_locks && !(tester.options->locking & LOCKING)) warning("Locking not enabled, " "but the taskset file specifies locks. Ignoring locks."); if (!tester.num_locks && (tester.options->locking & LOCKING)) { warning("Locking enabled, " "but the taskset file doesn't specify locks. Turning locking off."); tester.options->locking = NO_LOCKING; } } static void cleanup_test_locks() { sfree(tester.locks); tester.locks = 0; tester.num_locks = 0; } /* * Read in the taskset file, initializing data structures as we go. * This function handles initializing the test struct as well as all the * task structs, locks, scheduling domain maps, period, utilization, etc. */ static void init_tasks(char *taskset_filename) { int ret, i, seen_group; int c; struct task *curr; FILE *f; //get the number of processors and create that many domain_masks tester.num_processors = get_num_processors(); //initialize domain masks tester.domain_masks = (unsigned long *)salloc(sizeof(unsigned long) * tester.num_processors); if (!tester.domain_masks) fatal_error("Failed to allocate memory."); for (i = 0; i < tester.num_processors; i++) { MASK_ZERO(tester.domain_masks[i]); } //open the file from the passed-in filename f = fopen(taskset_filename, "r"); if (!f) fatal_error("Failed to open taskset file."); //read lines from the file and initialize locks/tasks as we go seen_group = 0; while ((c = getc(f)) != EOF) { //ignore comments if (c == '#') { //snarf rest of line while (c != EOF && c != '\n') c = getc(f); //read the line which specifies the number of locks (only one such line is allowed) } else if (c == 'L' && tester.num_locks == -1) { ret = fscanf(f, " %d ", &tester.num_locks); if (ret == 0 || ret == EOF) fatal_error("Ill-formed taskset file: " "number of locks on 'L' line improperly formatted."); initialize_test_locks(); //read lines which specify a task in the taskset } else if (c == 'T') { if (tester.num_locks < 0) //number of locks must preceed first task fatal_error("Ill-formed taskset file: " "the number of locks must preceed the first task definition."); if (seen_group) fatal_error("Ill-formed taskset file: " "no task definition may follow any group line."); init_task(&tester, f); } else if (c == 'G') { seen_group = 1; init_group(&tester, f); } else fatal_error("Ill-formed taskset file: " "line doesn't begin with either '#', 'T', 'L', or 'G'."); } fclose(f); if (tester.num_locks < 0) fatal_error("Number of locks not found in taskset file."); if (tester.num_tasks <= 0) fatal_error("No tasks found in taskset file"); //create an array from the task list so access to the tasks is constant-time tester.tasks = (struct task **)salloc(sizeof(struct task *) * tester.num_tasks); if (!tester.tasks) fatal_error("Failed to allocate memory."); //go through the list of tasks and point the array elements at them i = 0; curr = tester.task_list; while (curr) { tester.tasks[i] = curr; curr = curr->next; i++; } //initialize the abort device if (init_aborts(&tester.abort_data)) fatal_error("Failed to initialize abort device."); } static void cleanup_tasks() { int i; sfree(tester.domain_masks); tester.domain_masks = 0; for (i = 0; i < tester.num_tasks; i++) { if (tester.tasks[i]->my_locks) sfree(tester.tasks[i]->my_locks); sfree(tester.tasks[i]); } tester.task_list = 0; sfree(tester.tasks); tester.tasks = 0; tester.num_tasks = 0; } /* * Zero out the counters before the next run */ static void clear_counters() { tester.sys_total_release = 0; tester.sys_met_release = 0; tester.sys_total_util = 0; tester.sys_met_util = 0; tester.sys_abort_count = 0; tester.max_tardiness = 0; } /* * Get the scheduler constant needed to pass into the call to set_scheduler, * combining the constant for the scheduler itself, as well as other scheduling * features selected by the same constant. */ static int get_scheduler(struct test_app_opts *options) { int sched = options->scheduler; if (options->priority_inheritance) sched |= SCHED_FLAG_PI; if (options->enable_hua) sched |= SCHED_FLAG_HUA; if (options->deadlock_prevention) sched |= SCHED_FLAG_NO_DEADLOCKS; return sched; } static int get_priority(struct test_app_opts *options) { if (options->scheduler & SCHED_GLOBAL_MASK) return TASK_RUN_PRIO; else return -1; } /* Calculate the time required to lock and unlock a resource */ void *get_rt_lock_time(void *p) { chronos_mutex_t r; struct sched_param param; param.sched_priority = TASK_RUN_PRIO; sched_setscheduler(0, SCHED_FIFO, &param); chronos_mutex_init(&r); chronos_mutex_lock(&r); chronos_mutex_unlock(&r); chronos_mutex_destroy(&r); return NULL; } /* * Calculate the time required to lock and unlock a resource in a real-time task. */ void calc_lock_time() { pthread_t t1; struct timespec start_time, end_time; unsigned long time = 0, temp_time = 0; struct sched_param param; int i, prio; prio = getpriority(PRIO_PROCESS, 0); param.sched_priority = MAIN_PRIO; sched_setscheduler(0, SCHED_FIFO, &param); for (i = 0; i < 100; i++) { clock_gettime(CLOCK_REALTIME, &start_time); pthread_create(&t1, NULL, get_rt_lock_time, NULL); pthread_join(t1, NULL); clock_gettime(CLOCK_REALTIME, &end_time); temp_time = timespec_subtract_ns(&start_time, &end_time); if (temp_time > time) time = temp_time; } tester.lock_time = time / THOUSAND; param.sched_priority = prio; sched_setscheduler(0, SCHED_OTHER, &param); } /* * Print statistics from the last run of the tester. */ static void print_results() { if (tester.options->output_format == OUTPUT_VERBOSE) { printf("set start_time: %ld sec %ld nsec\n", tester.global_start_time->tv_sec, tester.global_start_time->tv_nsec); printf("set end_time: %ld sec %ld nsec\n", tester.global_start_time->tv_sec + tester.options->run_time, tester.global_start_time->tv_nsec); printf("total tasks: %d,", tester.sys_total_release); printf("total deadlines met: %d,", tester.sys_met_release); printf("total possible utility: %d,", tester.sys_total_util); printf("total utility accrued: %d,", tester.sys_met_util); printf("total tasks aborted: %d\n", tester.sys_abort_count); } else if (tester.options->output_format == OUTPUT_EXCEL) { char *sched_name = get_sched_name(tester.options->scheduler); if (sched_name) printf("%s,", sched_name); printf("%d,", tester.options->cpu_usage); printf("=%d/%d,", tester.sys_met_release, tester.sys_total_release); printf("=%d/%d,", tester.sys_met_util, tester.sys_total_util); printf("=%ld\n", tester.max_tardiness); } else if (tester.options->output_format == OUTPUT_GNUPLOT) { printf("%f %f %f %ld\n", ((double)tester.options->cpu_usage) / 100, ((double)tester.sys_met_release) / ((double)tester.sys_total_release), //deadline satisfaction ratio ((double)tester.sys_met_util) / ((double)tester.sys_total_util), //accrued utility ratio tester.max_tardiness); } else { char *sched_name = get_sched_name(tester.options->scheduler); printf("%.2f", ((double)tester.options->cpu_usage) / 100); if (sched_name) printf("/%s", sched_name); printf(": Tasks: %d/%d, Utility: %d/%d, " "Aborted: %d, Tardiness %ld\n", tester.sys_met_release, tester.sys_total_release, tester.sys_met_util, tester.sys_total_util, tester.sys_abort_count, tester.max_tardiness); } } /* * Setup for and run one complete run of a taskset in the test application. This * includes initializing the real-time priorities, spawning all threads, joining * them, and tabulating their statistics, and printing the results. */ static void run() { int i; struct sched_param param, old_param; unsigned long main_mask = 0; pthread_barrierattr_t barrierattr; clear_counters(); //clear performance counters pthread_barrierattr_setpshared(&barrierattr, PTHREAD_PROCESS_SHARED); //allow access to this barrier from any process with access to the memory holding it pthread_barrier_init(tester.barrier, &barrierattr, tester.num_tasks); //initialize barrier //set outselves as a real-time task sched_getparam(0, &old_param); param.sched_priority = MAIN_PRIO; if (sched_setscheduler(0, SCHED_FIFO, &param) == -1) fatal_error("sched_setscheduler() failed."); //set task affinity of this main thread to the first processor MASK_ZERO(main_mask); MASK_SET(main_mask, 0); if (sched_setaffinity(0, sizeof(main_mask), (cpu_set_t *) & main_mask) < 0) fatal_error("sched_setaffinity() failed."); //set up the correct scheduler on all the domains we need for (i = 0; i < tester.num_processors && tester.domain_masks[i] != 0; i++) { if (set_scheduler(get_scheduler(tester.options), get_priority(tester.options), tester.domain_masks[i])) fatal_error("Selection of RT scheduler failed! " "Is the scheduler loaded?"); } //some debugging/verbose info if (tester.options->output_format == OUTPUT_VERBOSE) { printf("Percent of each task's exec time to use: %f\n", ((double)tester.options->cpu_usage) / 100); printf("Critical section length: %d\n", tester.options->cs_length); } //generate timing info for each task for (i = 0; i < tester.num_tasks; i++) { clear_task_stats(tester.tasks[i]); set_lock_usage(tester.tasks[i], &tester); calculate_releases(tester.tasks[i], &tester); if (tester.options->output_format == OUTPUT_VERBOSE) printf("period: %ld usec \t " "usage: %ld unlocked + %ld locked usec\n", tester.tasks[i]->period, tester.tasks[i]->unlocked_usage, tester.tasks[i]->locked_usage); } //initialize the global_start_time pointer to 0 so it can be reset again by the 'winning' thread tester.global_start_time = 0; //start all the thread groups for (i = 0; i < tester.num_tasks; i++) { if (group_leader(tester.tasks[i])) if (tgroup_create(&tester.tasks[i]->thread.tg, start_task_group, (void *)tester.tasks[i])) fatal_error("Failed to tgroup_create " "one of the task group leader threads."); } //wait until all the thread groups are done for (i = 0; i < tester.num_tasks; i++) { if (group_leader(tester.tasks[i])) { int ret, status = 0; ret = tgroup_join(&tester.tasks[i]->thread.tg, &status); if (ret) fatal_error("Failed to tgroup_join " "one of the task group leader processes."); if (status) fatal_error("tgroup_join joined task group " "leader process with non-zero status."); } } //return us to a normal scheduler and priority sched_setscheduler(0, SCHED_OTHER, &old_param); //accumulate statistics from individual tasks for (i = 0; i < tester.num_tasks; i++) { long tardiness; tester.sys_total_release += tester.tasks[i]->max_releases; tester.sys_met_release += tester.tasks[i]->deadlines_met; tester.sys_total_util += tester.tasks[i]->max_releases * tester.tasks[i]->utility; tester.sys_met_util += tester.tasks[i]->utility_accrued; tester.sys_abort_count += tester.tasks[i]->num_aborted; //if this task's tardiness is less than the current maximum, update it //Note: negative tardiness is 'greater' because tardiness is calculated as (deadline - end_time) tardiness = tester.tasks[i]->max_tardiness; if (tardiness < tester.max_tardiness) tester.max_tardiness = tardiness; } print_results(); //display all statistics corresponding to the output options pthread_barrier_destroy(tester.barrier); //destroy barrier } /* * Given the options passed in on the command line, initialize the application * and call each of the individual runs (will only be one if batch mode is not * enabled). */ void run_test(struct test_app_opts *options) { tester.options = options; //intiailize the memory for the barrier tester.barrier = salloc(sizeof(pthread_barrier_t)); if (!tester.barrier) fatal_error("pthread_barrier_t memory allocation failed."); tester.workload = get_workload_struct(tester.options->workload); workload_init_global(&tester); // initialize any global state the current workload has (allocating global memory, etc.) //initialize tasks based on the taskset file init_tasks(options->taskset_filename); //if requested, find the hyper-period and return if (tester.options->no_run) { printf("No run (-z) flag enabled\n"); printf("Hyper-period is: %ld seconds\n", taskset_lcm(&tester) / MILLION); return; } if (options->enable_hua) calc_lock_time(); //calculate how long locking takes (needed to calculate HUA abort handler timing information) //actually run the tests for (; options->cpu_usage <= options->end_usage; options->cpu_usage += options->interval) { run(); if (options->cpu_usage < options->end_usage) sleep(1); } cleanup_test_locks(); cleanup_tasks(); sfree(tester.barrier); }
longqzh/chronOS_test
sched_test_app/src/tester.c
C
gpl-2.0
15,697
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * \Pyrus\PackageFile\v2Iterator\FileContentsMulti * * PHP version 5 * * @category Pyrus * @package Pyrus * @author Greg Beaver <cellog@php.net> * @copyright 2010 The PEAR Group * @license http://www.opensource.org/licenses/bsd-license.php New BSD License * @link https://github.com/pyrus/Pyrus */ namespace Pyrus\PackageFile\v2Iterator; /** * iterator for tags with multiple sub-tags * * @category Pyrus * @package Pyrus * @author Greg Beaver <cellog@php.net> * @copyright 2010 The PEAR Group * @license http://www.opensource.org/licenses/bsd-license.php New BSD License * @link https://github.com/pyrus/Pyrus */ class FileContentsMulti extends FileContents { function key() { return $this->tag; } }
pyrus/Pyrus
src/Pyrus/PackageFile/v2Iterator/FileContentsMulti.php
PHP
bsd-2-clause
778
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1032, 1052, 12541, 2271, 1032, 7427, 8873, 2571, 1032, 1058, 2475, 21646, 8844, 1032, 5371, 8663, 6528, 3215, 12274, 7096, 2072, 1008, 1008, 25718, 2544, 1019, 1008, 1008, 1030, 4696, 1052, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...