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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <HTML> <HEAD> <LINK REL=STYLESHEET TYPE="text/css" HREF="stylesheet.css" TITLE="Style"> <META NAME="GENERATOR" CONTENT="Java2HTML Version 1.3.1"> <TITLE>jena.examples.ontology.classHierarchy.Main (Java2HTML)</TITLE> </HEAD> <BODY><TABLE id="Header" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td colspan="2" width="33%">&nbsp;</td> <td align="center" colspan="2" width="33%"> <font size="4">Main.java</font> </td> <td align="right" colspan="2" width="33%">&nbsp;</td> </tr> </TABLE> <pre ID="Classes"> <A NAME="1"></A><FONT ID="FormalComment">/***************************************************************************** <A NAME="2"></A> * Source code information <A NAME="3"></A> * ----------------------- <A NAME="4"></A> * Original author Ian Dickinson, HP Labs Bristol <A NAME="5"></A> * Author email ian.dickinson@hp.com <A NAME="6"></A> * Package Jena 2 <A NAME="7"></A> * Web http://sourceforge.net/projects/jena/ <A NAME="8"></A> * Created 22-Aug-2003 <A NAME="9"></A> * Filename $RCSfile: Main.java.html,v $ <A NAME="10"></A> * Revision $Revision: 1.4 $ <A NAME="11"></A> * Release status $State: Exp $ <A NAME="12"></A> * <A NAME="13"></A> * Last modified on $Date: 2007/01/17 10:44:18 $ <A NAME="14"></A> * by $Author: andy_seaborne $ <A NAME="15"></A> * <A NAME="16"></A> * (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007 Hewlett-Packard Development Company, LP <A NAME="17"></A> * (see footer for full conditions) <A NAME="18"></A> *****************************************************************************/</FONT> <A NAME="19"></A> <A NAME="20"></A><FONT ID="SingleLineComment">// Package <A NAME="21"></A></FONT><FONT ID="SingleLineComment">/////////////// <A NAME="22"></A></FONT><FONT ID="Package">package</FONT> jena.examples.ontology.classHierarchy; <A NAME="23"></A> <A NAME="24"></A> <A NAME="25"></A><FONT ID="SingleLineComment">// Imports <A NAME="26"></A></FONT><FONT ID="SingleLineComment">/////////////// <A NAME="27"></A></FONT><FONT ID="Import">import</FONT> com.hp.hpl.jena.ontology.*; <A NAME="28"></A><FONT ID="Import">import</FONT> com.hp.hpl.jena.rdf.model.ModelFactory; <A NAME="29"></A> <A NAME="30"></A> <A NAME="31"></A><FONT ID="FormalComment">/** <A NAME="32"></A> * &lt;p&gt; <A NAME="33"></A> * Execution wrapper for class hierarchy example <A NAME="34"></A> * &lt;/p&gt; <A NAME="35"></A> * <A NAME="36"></A> * @author Ian Dickinson, HP Labs <A NAME="37"></A> * (&lt;a href="mailto:Ian.Dickinson@hp.com" &gt;email&lt;/a&gt;) <A NAME="38"></A> * @version CVS $Id: Main.java.html,v 1.4 2007/01/17 10:44:18 andy_seaborne Exp $ <A NAME="39"></A> */</FONT> <A NAME="40"></A><FONT ID="Public">public</FONT> <FONT ID="Class">class</FONT> Main { <A NAME="41"></A> <FONT ID="SingleLineComment">// Constants <A NAME="42"></A></FONT> <FONT ID="SingleLineComment">////////////////////////////////// <A NAME="43"></A></FONT> <A NAME="44"></A> <FONT ID="SingleLineComment">// Static variables <A NAME="45"></A></FONT> <FONT ID="SingleLineComment">////////////////////////////////// <A NAME="46"></A></FONT> <A NAME="47"></A> <FONT ID="SingleLineComment">// Instance variables <A NAME="48"></A></FONT> <FONT ID="SingleLineComment">////////////////////////////////// <A NAME="49"></A></FONT> <A NAME="50"></A> <FONT ID="SingleLineComment">// Constructors <A NAME="51"></A></FONT> <FONT ID="SingleLineComment">////////////////////////////////// <A NAME="52"></A></FONT> <A NAME="53"></A> <FONT ID="SingleLineComment">// External signature methods <A NAME="54"></A></FONT> <FONT ID="SingleLineComment">////////////////////////////////// <A NAME="55"></A></FONT> <A NAME="56"></A> <FONT ID="Public">public</FONT> <FONT ID="Static">static</FONT> <FONT ID="Void">void</FONT> main( String[] args ) { <A NAME="57"></A> OntModel m = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM, <FONT ID="Null">null</FONT> ); <A NAME="58"></A> <A NAME="59"></A> <FONT ID="SingleLineComment">// we have a local copy of the wine ontology <A NAME="60"></A></FONT> m.getDocumentManager().addAltEntry( <FONT ID="StringLiteral">"http://www.w3.org/2001/sw/WebOnt/guide-src/wine"</FONT>, <A NAME="61"></A> <FONT ID="StringLiteral">"file:testing/reasoners/bugs/wine.owl"</FONT> ); <A NAME="62"></A> m.getDocumentManager().addAltEntry( <FONT ID="StringLiteral">"http://www.w3.org/2001/sw/WebOnt/guide-src/food"</FONT>, <A NAME="63"></A> <FONT ID="StringLiteral">"file:testing/reasoners/bugs/food.owl"</FONT> ); <A NAME="64"></A> <A NAME="65"></A> m.read( <FONT ID="StringLiteral">"http://www.w3.org/2001/sw/WebOnt/guide-src/wine"</FONT> ); <A NAME="66"></A> <A NAME="67"></A> <FONT ID="New">new</FONT> <A HREF="ClassHierarchy.java.html">ClassHierarchy</A>().showHierarchy( System.out, m ); <A NAME="68"></A> } <A NAME="69"></A> <A NAME="70"></A> <A NAME="71"></A> <FONT ID="SingleLineComment">// Internal implementation methods <A NAME="72"></A></FONT> <FONT ID="SingleLineComment">////////////////////////////////// <A NAME="73"></A></FONT> <A NAME="74"></A> <FONT ID="SingleLineComment">//============================================================================== <A NAME="75"></A></FONT> <FONT ID="SingleLineComment">// Inner class definitions <A NAME="76"></A></FONT> <FONT ID="SingleLineComment">//============================================================================== <A NAME="77"></A></FONT> <A NAME="78"></A>} <A NAME="79"></A> <A NAME="80"></A> <A NAME="81"></A><FONT ID="MultiLineComment">/* <A NAME="82"></A> (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007 Hewlett-Packard Development Company, LP <A NAME="83"></A> All rights reserved. <A NAME="84"></A> <A NAME="85"></A> Redistribution and use in source and binary forms, with or without <A NAME="86"></A> modification, are permitted provided that the following conditions <A NAME="87"></A> are met: <A NAME="88"></A> <A NAME="89"></A> 1. Redistributions of source code must retain the above copyright <A NAME="90"></A> notice, this list of conditions and the following disclaimer. <A NAME="91"></A> <A NAME="92"></A> 2. Redistributions in binary form must reproduce the above copyright <A NAME="93"></A> notice, this list of conditions and the following disclaimer in the <A NAME="94"></A> documentation and/or other materials provided with the distribution. <A NAME="95"></A> <A NAME="96"></A> 3. The name of the author may not be used to endorse or promote products <A NAME="97"></A> derived from this software without specific prior written permission. <A NAME="98"></A> <A NAME="99"></A> THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR <A NAME="100"></A> IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES <A NAME="101"></A> OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. <A NAME="102"></A> IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, <A NAME="103"></A> INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT <A NAME="104"></A> NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, <A NAME="105"></A> DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY <A NAME="106"></A> THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT <A NAME="107"></A> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF <A NAME="108"></A> THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <A NAME="109"></A>*/</FONT> <A NAME="110"></A> <A NAME="111"></A></pre> </BODY> </HTML>
BiGCAT-UM/wp2lod
lib/Jena-2.6.4/doc/examples/class-hierarchy/Main.java.html
HTML
apache-2.0
7,860
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 1014, 1013, 1013, 4372, 1000, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 4957, 2128, 2140, 1027, 6782, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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="no-js" lang=""> <head> <title>Zabuun - Learn Egyptian Arabic for English speakers</title> <meta name="description" content=""> <?php include $_SERVER['DOCUMENT_ROOT'].'/layout/head.php';?> </head> <body> <?php include $_SERVER['DOCUMENT_ROOT'].'/layout/ie8.php';?> <?php include $_SERVER['DOCUMENT_ROOT'].'/layout/header.php';?> <div class="content"> <?php include $_SERVER['DOCUMENT_ROOT'].'/layout/side.php';?> <div class="main"> <div class="location"> <p class="breadcrumbs">Essays > Tell the Truth</p> <p class="expandcollapse"> <a href="">Expand All</a> | <a href="">Collapse All</a> </p> </div> <!-- begin essay --> <h1>Tell the Truth</h1> <p> She was angry. She was angry at her husband. He lied to her. He lied many times. She was tired of his lies. She said enough was enough. She took off her ring. She dropped it into the toilet. She flushed the toilet. She got into her car. She got on the freeway. She drove the car fast. She was crying. She was very sad. She drove the car faster. She passed many cars. The speed limit was 60 mph. She was going 80 mph. A cop saw her. The cop chased her. The cop turned on his red light. He turned on his siren. She heard the cop car. She saw the flashing light. She drove faster. Now she was going 90 mph. The cop drove faster. It started to rain. She didn't slow down. She lost control. The car rolled over. It rolled over and over. She died before it came to a stop. </p> <!-- end essay --> </div> </div> <?php include $_SERVER['DOCUMENT_ROOT'].'/layout/footer.php';?> <?php include $_SERVER['DOCUMENT_ROOT'].'/layout/scripts.php';?> </body> </html>
javanigus/zabuun
essay/1452-tell-the-truth.php
PHP
mit
1,710
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 2465, 1027, 1000, 2053, 1011, 1046, 2015, 1000, 11374, 1027, 1000, 1000, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 23564, 8569, 4609, 1011, 4553, 6811, 5640, 2005, 2394, 7492, 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...
using System; using AutoTest.Core.Configuration; using Castle.Facilities.Logging; using System.Reflection; using Castle.MicroKernel.Registration; namespace AutoTest.Console { public static class ConsoleConfiguration { public static void Configure() { BootStrapper.Configure(); BootStrapper.Container .AddFacility("logging", new LoggingFacility(LoggerImplementation.Console)); BootStrapper.Container.Register(Component.For<IConsoleApplication>().ImplementedBy<ConsoleApplication>()); } public static T Locate<T>() { return BootStrapper.Services.Locate<T>(); } } }
continuoustests/AutoTest.Net
src/AutoTest.Console/ConsoleConfiguration.cs
C#
mit
619
[ 30522, 2478, 2291, 1025, 2478, 8285, 22199, 1012, 4563, 1012, 9563, 1025, 2478, 3317, 1012, 4128, 1012, 15899, 1025, 2478, 2291, 1012, 9185, 1025, 2478, 3317, 1012, 12702, 5484, 11877, 1012, 8819, 1025, 3415, 15327, 8285, 22199, 1012, 10122...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 { Component, OnInit } from '@angular/core'; // import { TreeModule, TreeNode } from "primeng/primeng"; import { BlogPostService } from '../shared/blog-post.service'; import { BlogPostDetails } from '../shared/blog-post.model'; @Component({ selector: 'ejc-blog-archive', templateUrl: './blog-archive.component.html', styleUrls: ['./blog-archive.component.scss'] }) export class BlogArchiveComponent implements OnInit { constructor( // private postService: BlogPostService ) { } ngOnInit() { } // // it would be best if the data in the blog post details file was already organized into tree nodes // private buildTreeNodes(): TreeNode[] {} }
ejchristie/ejchristie.github.io
src/app/blog/blog-archive/blog-archive.component.ts
TypeScript
mit
676
[ 30522, 12324, 1063, 6922, 1010, 2006, 5498, 2102, 1065, 2013, 1005, 1030, 16108, 1013, 4563, 1005, 1025, 1013, 1013, 12324, 1063, 3392, 5302, 8566, 2571, 1010, 3392, 3630, 3207, 1065, 2013, 1000, 3539, 3070, 1013, 3539, 3070, 1000, 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...
package com.sp.jb.service; import com.sp.jb.model.Circle; import com.sp.jb.model.Triangle; public class ShapeService { private Circle circle; private Triangle triangle; public Circle getCircle() { return circle; } public void setCircle(Circle circle) { this.circle = circle; } public Triangle getTriangle() { return triangle; } public void setTriangle(Triangle triangle) { this.triangle = triangle; } }
samirprakash/spring-aop
src/com/sp/jb/service/ShapeService.java
Java
cc0-1.0
482
[ 30522, 7427, 4012, 1012, 11867, 1012, 1046, 2497, 1012, 2326, 1025, 12324, 4012, 1012, 11867, 1012, 1046, 2497, 1012, 2944, 1012, 4418, 1025, 12324, 4012, 1012, 11867, 1012, 1046, 2497, 1012, 2944, 1012, 9546, 1025, 2270, 2465, 10466, 2121,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.codingchili.core.testing; /** * A mock class for the log listener. */ public interface MockLogListener { void onLogged(String logged); }
codingchili/chili-core
core/main/java/com/codingchili/core/testing/MockLogListener.java
Java
mit
156
[ 30522, 7427, 4012, 1012, 16861, 5428, 3669, 1012, 4563, 1012, 5604, 1025, 1013, 1008, 1008, 1008, 1037, 12934, 2465, 2005, 1996, 8833, 19373, 1012, 1008, 1013, 2270, 8278, 12934, 21197, 9863, 24454, 1063, 11675, 2006, 21197, 5999, 1006, 516...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>fastcgi++: Class Members - Functions</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">fastcgi++ </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.1 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="pages.html"><span>Related&#160;Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li class="current"><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <div id="navrow3" class="tabs2"> <ul class="tablist"> <li><a href="functions.html"><span>All</span></a></li> <li class="current"><a href="functions_func.html"><span>Functions</span></a></li> <li><a href="functions_vars.html"><span>Variables</span></a></li> <li><a href="functions_type.html"><span>Typedefs</span></a></li> <li><a href="functions_enum.html"><span>Enumerations</span></a></li> <li><a href="functions_eval.html"><span>Enumerator</span></a></li> <li><a href="functions_rela.html"><span>Related&#160;Functions</span></a></li> </ul> </div> <div id="navrow4" class="tabs3"> <ul class="tablist"> <li><a href="functions_func.html#index_a"><span>a</span></a></li> <li><a href="functions_func_0x62.html#index_b"><span>b</span></a></li> <li><a href="functions_func_0x63.html#index_c"><span>c</span></a></li> <li><a href="functions_func_0x64.html#index_d"><span>d</span></a></li> <li><a href="functions_func_0x65.html#index_e"><span>e</span></a></li> <li><a href="functions_func_0x66.html#index_f"><span>f</span></a></li> <li><a href="functions_func_0x67.html#index_g"><span>g</span></a></li> <li><a href="functions_func_0x68.html#index_h"><span>h</span></a></li> <li><a href="functions_func_0x69.html#index_i"><span>i</span></a></li> <li><a href="functions_func_0x6b.html#index_k"><span>k</span></a></li> <li><a href="functions_func_0x6c.html#index_l"><span>l</span></a></li> <li><a href="functions_func_0x6d.html#index_m"><span>m</span></a></li> <li><a href="functions_func_0x6e.html#index_n"><span>n</span></a></li> <li><a href="functions_func_0x6f.html#index_o"><span>o</span></a></li> <li><a href="functions_func_0x70.html#index_p"><span>p</span></a></li> <li><a href="functions_func_0x71.html#index_q"><span>q</span></a></li> <li><a href="functions_func_0x72.html#index_r"><span>r</span></a></li> <li class="current"><a href="functions_func_0x73.html#index_s"><span>s</span></a></li> <li><a href="functions_func_0x74.html#index_t"><span>t</span></a></li> <li><a href="functions_func_0x76.html#index_v"><span>v</span></a></li> <li><a href="functions_func_0x77.html#index_w"><span>w</span></a></li> <li><a href="functions_func_0x7a.html#index_z"><span>z</span></a></li> <li><a href="functions_func_0x7e.html#index_0x7e"><span>~</span></a></li> </ul> </div> </div><!-- top --> <div class="contents"> &#160; <h3><a class="anchor" id="index_s"></a>- s -</h3><ul> <li>secureWrite() : <a class="el" href="a00083.html#a1a720bf113ad9781e59b0fc021988d29">Fastcgipp::Transceiver</a> , <a class="el" href="a00011.html#aa1a80f3feb1355bd5bc57545d16c309e">Fastcgipp::Transceiver::Buffer</a> </li> <li>SendBlock() : <a class="el" href="a00061.html#affab5808ec21d9f6de04cc7b490e39c1">Fastcgipp::Transceiver::Buffer::SendBlock</a> </li> <li>SessionId() : <a class="el" href="a00062.html#a40475aa529077627af7004797b8ea53a">Fastcgipp::Http::SessionId</a> </li> <li>Sessions() : <a class="el" href="a00063.html#a96cff85553b8741b9ee6f749c416a563">Fastcgipp::Http::Sessions&lt; T &gt;</a> </li> <li>set() : <a class="el" href="a00027.html#a5beefe2c8e1a92df01970409ae60e624">Fastcgipp::FcgistreamSink</a> , <a class="el" href="a00026.html#af2725705f9c6fc65f69fb909b3414ab2">Fastcgipp::Fcgistream&lt; charT &gt;</a> , <a class="el" href="a00059.html#ad5dcbc6eb9e927f463a26c72957a87f8">Fastcgipp::Request&lt; charT &gt;</a> , <a class="el" href="a00068.html#a6269cf507f72261a6fecad058437b14e">ASql::Data::SetPtrBuilder&lt; T &gt;</a> , <a class="el" href="a00034.html#a153a0060fb0dc9ebeb2ec06f42d4d2f4">ASql::Data::IndySetPtrBuilder&lt; T &gt;</a> </li> <li>setAppStatus() : <a class="el" href="a00021.html#af0fc32baff5c36851ece565762e5379b">Fastcgipp::Protocol::EndRequest</a> </li> <li>SetBuilder() : <a class="el" href="a00065.html#a05e29c4ef962bfdcd9ff61995e595a47">ASql::Data::SetBuilder&lt; T &gt;</a> </li> <li>setCallback() : <a class="el" href="a00056.html#ad75059c0ca2102cbe6ad241f4674ea0f">ASql::QueryPar</a> </li> <li>SetCanceler() : <a class="el" href="a00066.html#a8722a48462a930f76e5a0c3028e61cb8">ASql::ConnectionPar&lt; T &gt;::SetCanceler</a> </li> <li>setContentLength() : <a class="el" href="a00031.html#a66c260d4888ac457b8a74dfd1ed3a1f5">Fastcgipp::Protocol::Header</a> </li> <li>setEncoding() : <a class="el" href="a00026.html#a27a7ab6628ae3cf99a9ad09d0f5b9792">Fastcgipp::Fcgistream&lt; charT &gt;</a> </li> <li>setloc() : <a class="el" href="a00059.html#a10bf656234f3434bbc8f8702fa1a9af4">Fastcgipp::Request&lt; charT &gt;</a> </li> <li>setPaddingLength() : <a class="el" href="a00031.html#a41c69247f8ed1dad60c1d2e17ac36e9d">Fastcgipp::Protocol::Header</a> </li> <li>setParameters() : <a class="el" href="a00056.html#ab3f7244f4ead7fc93c969c44b828042e">ASql::QueryPar</a> , <a class="el" href="a00049.html#a55308faeeec43e91dc591e0564f1458f">ASql::Query&lt; Parameters, Results, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Parameters &gt; &gt;::type, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Results &gt; &gt;::type &gt;</a> , <a class="el" href="a00050.html#a1d37725f9a266b0cd3d158645ba6312a">ASql::Query&lt; Parameters, Results, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Parameters &gt; &gt;::type, typename boost::enable_if&lt; boost::is_base_of&lt; Data::SetContainer, Results &gt; &gt;::type &gt;</a> , <a class="el" href="a00051.html#a767cb91146a56cf135244b17771cad32">ASql::Query&lt; Parameters, void, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Parameters &gt; &gt;::type, void &gt;</a> , <a class="el" href="a00052.html#afec6e4e08063a7efe441acca5a3f6ba4">ASql::Query&lt; Parameters, void, typename boost::enable_if&lt; boost::is_base_of&lt; Data::SetContainer, Parameters &gt; &gt;::type, void &gt;</a> </li> <li>setProtocolStatus() : <a class="el" href="a00021.html#a401b78416caffe81aae73eabe201d9de">Fastcgipp::Protocol::EndRequest</a> </li> <li>SetPtrBuilder() : <a class="el" href="a00068.html#a4d7fc089d42deae629b4fc35cb760979">ASql::Data::SetPtrBuilder&lt; T &gt;</a> </li> <li>SetRefBuilder() : <a class="el" href="a00069.html#a0eda5df3502ecad94cce266582331e50">ASql::Data::SetRefBuilder&lt; T &gt;</a> </li> <li>setRequestId() : <a class="el" href="a00031.html#a178ebdeff30eb32927dadd35b1482a02">Fastcgipp::Protocol::Header</a> </li> <li>setResults() : <a class="el" href="a00056.html#a28c9cd657f17fced8eda075f7f1d1269">ASql::QueryPar</a> , <a class="el" href="a00049.html#a68153095d4c32e1136837f6e3ccb8993">ASql::Query&lt; Parameters, Results, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Parameters &gt; &gt;::type, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Results &gt; &gt;::type &gt;</a> , <a class="el" href="a00050.html#a9166fa24a414cc5bbee5359745a3a95b">ASql::Query&lt; Parameters, Results, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Parameters &gt; &gt;::type, typename boost::enable_if&lt; boost::is_base_of&lt; Data::SetContainer, Results &gt; &gt;::type &gt;</a> , <a class="el" href="a00053.html#aa8d69832845f751713cf41fc3afa3c24">ASql::Query&lt; void, Results, void, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Results &gt; &gt;::type &gt;</a> , <a class="el" href="a00054.html#a93b50cb55ec8df86d7618acbcf5d2d4a">ASql::Query&lt; void, Results, void, typename boost::enable_if&lt; boost::is_base_of&lt; Data::SetContainer, Results &gt; &gt;::type &gt;</a> </li> <li>SetSharedPtrBuilder() : <a class="el" href="a00070.html#aeac748bea45f758a4da231a68f0a7ed4">ASql::Data::SetSharedPtrBuilder&lt; T &gt;</a> </li> <li>setType() : <a class="el" href="a00031.html#a5a59eb1abe11638b1473da815c1b0478">Fastcgipp::Protocol::Header</a> , <a class="el" href="a00090.html#a3b1494b8769dfdf692ec215a040967ef">Fastcgipp::Protocol::UnknownType</a> </li> <li>setupSignals() : <a class="el" href="a00040.html#adda39bbbf7a0f2d2481ce094ad4f1a76">Fastcgipp::ManagerPar</a> </li> <li>setVersion() : <a class="el" href="a00031.html#a2a9eafd8b84669792f3033a5d3ba9fe2">Fastcgipp::Protocol::Header</a> </li> <li>SharedData() : <a class="el" href="a00071.html#aa50071431e3483a93b59eb3ab0afffb1">ASql::QueryPar::SharedData</a> </li> <li>signalHandler() : <a class="el" href="a00040.html#a242d278d2255c97acf19a3ff411ee702">Fastcgipp::ManagerPar</a> </li> <li>size() : <a class="el" href="a00046.html#a053e499db7fb916cc10623d12fdfda6d">Fastcgipp::Http::Post&lt; charT &gt;</a> , <a class="el" href="a00009.html#a04eb51d361e540fd52833bb19051cf98">ASql::Data::Blob</a> , <a class="el" href="a00091.html#a5f8009208446e15b9bae4981ecff5b30">ASql::Data::VectorBlob</a> </li> <li>sleep() : <a class="el" href="a00083.html#a5c1bafc977eaa9e4c3e94a5b9eab59eb">Fastcgipp::Transceiver</a> </li> <li>Socket() : <a class="el" href="a00072.html#a63720dd5f4d906c6874ffc9905fa73d7">Fastcgipp::Exceptions::Socket</a> </li> <li>SocketPoll() : <a class="el" href="a00073.html#a00a748cfe698183e32990da239e6b36c">Fastcgipp::Exceptions::SocketPoll</a> </li> <li>SocketRead() : <a class="el" href="a00074.html#a7d1bdda3376e37c47cd98735171ab513">Fastcgipp::Exceptions::SocketRead</a> </li> <li>SocketWrite() : <a class="el" href="a00075.html#a504556689fd04525e88db4be17863bda">Fastcgipp::Exceptions::SocketWrite</a> </li> <li>start() : <a class="el" href="a00082.html#a29d61d0790664a9d801317951435f4b9">ASql::Transaction&lt; T &gt;</a> , <a class="el" href="a00017.html#a7c3e0381669bb135f5cad602b4ded24e">ASql::ConnectionPar&lt; T &gt;</a> </li> <li>Statement() : <a class="el" href="a00076.html#aa147c549f0d66b156c3e44602def1ed6">ASql::Statement</a> , <a class="el" href="a00077.html#a04bb1927300d27140ff8e00f7bdbcba8">ASql::MySQL::Statement</a> </li> <li>staticRebuild() : <a class="el" href="a00051.html#a410bf5056ff5208e3088c33ecfbb2448">ASql::Query&lt; Parameters, void, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Parameters &gt; &gt;::type, void &gt;</a> , <a class="el" href="a00050.html#a21b56bde4757e3bd42a4a939c6cc14c6">ASql::Query&lt; Parameters, Results, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Parameters &gt; &gt;::type, typename boost::enable_if&lt; boost::is_base_of&lt; Data::SetContainer, Results &gt; &gt;::type &gt;</a> , <a class="el" href="a00049.html#a96e6a67f819813e7de3844dcadea5c0f">ASql::Query&lt; Parameters, Results, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Parameters &gt; &gt;::type, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Results &gt; &gt;::type &gt;</a> , <a class="el" href="a00054.html#a0c5fad60c643bdfbf1557c51726abfca">ASql::Query&lt; void, Results, void, typename boost::enable_if&lt; boost::is_base_of&lt; Data::SetContainer, Results &gt; &gt;::type &gt;</a> , <a class="el" href="a00052.html#a2fddcf01a03e9bb15040fe6e8173def5">ASql::Query&lt; Parameters, void, typename boost::enable_if&lt; boost::is_base_of&lt; Data::SetContainer, Parameters &gt; &gt;::type, void &gt;</a> , <a class="el" href="a00053.html#ab9b52a440bbd75a74680ca0c21431ac3">ASql::Query&lt; void, Results, void, typename boost::enable_if&lt; boost::is_base_of&lt; Data::Set, Results &gt; &gt;::type &gt;</a> </li> <li>steal() : <a class="el" href="a00046.html#afed487b94b8303bbe282a50a03529660">Fastcgipp::Http::Post&lt; charT &gt;</a> </li> <li>STLSetContainer() : <a class="el" href="a00078.html#a174e0ecce839b0b0915bf3a02219103c">ASql::Data::STLSetContainer&lt; T &gt;</a> </li> <li>STLSetRefContainer() : <a class="el" href="a00079.html#ad658ae83293f93da24362274a8106e8b">ASql::Data::STLSetRefContainer&lt; T &gt;</a> </li> <li>STLSharedSetContainer() : <a class="el" href="a00080.html#aa64027a9d71c6b9ed518a0b790b3be94">ASql::Data::STLSharedSetContainer&lt; T &gt;</a> </li> <li>stop() : <a class="el" href="a00040.html#afafa21cdada5dc04711dbe6b8a227a65">Fastcgipp::ManagerPar</a> </li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Wed Aug 22 2012 20:35:53 for fastcgi++ by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.1 </small></address> </body> </html>
rfernandes/fastcgipp-unofficial
doc/html/functions_func_0x73.html
HTML
lgpl-3.0
13,948
[ 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...
/* * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. * 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. */ package org.graalvm.compiler.jtt.optimize; import org.junit.Before; import org.junit.Test; import org.graalvm.compiler.jtt.JTTTest; /* * Tests calls to the array copy method. */ public class ArrayCopy04 extends JTTTest { public static byte[] array = new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; public static byte[] array0 = new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; static { // Ensure System is resolved System.arraycopy(array, 0, array, 0, array.length); } @Before public void setUp() { System.currentTimeMillis(); for (int i = 0; i < array.length; i++) { array[i] = array0[i]; } } public static byte[] test(int srcPos, int destPos, int length) { System.arraycopy(array, srcPos, array, destPos, length); return array; } @Test public void run0() throws Throwable { runTest("test", 0, 0, 0); } @Test public void run1() throws Throwable { runTest("test", 0, 0, -1); } @Test public void run2() throws Throwable { runTest("test", -1, 0, 0); } @Test public void run3() throws Throwable { runTest("test", 0, -1, 0); } @Test public void run4() throws Throwable { runTest("test", 0, 0, 2); } @Test public void run5() throws Throwable { runTest("test", 0, 1, 11); } @Test public void run6() throws Throwable { runTest("test", 1, 0, 11); } @Test public void run7() throws Throwable { runTest("test", 1, 1, -1); } @Test public void run8() throws Throwable { runTest("test", 0, 1, 2); } @Test public void run9() throws Throwable { runTest("test", 1, 0, 2); } @Test public void run10() throws Throwable { runTest("test", 1, 1, 2); } @Test public void run11() throws Throwable { runTest("test", 0, 0, 6); } @Test public void run12() throws Throwable { runTest("test", 0, 1, 5); } @Test public void run13() throws Throwable { runTest("test", 1, 0, 5); } @Test public void run14() throws Throwable { runTest("test", 1, 1, 5); } @Test public void run15() throws Throwable { runTest("test", 0, 0, 11); } @Test public void run16() throws Throwable { runTest("test", 0, 1, 10); } @Test public void run17() throws Throwable { runTest("test", 1, 0, 10); } }
YouDiSN/OpenJDK-Research
jdk9/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/optimize/ArrayCopy04.java
Java
gpl-2.0
3,589
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2249, 1010, 2262, 1010, 14721, 1998, 1013, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 1008, 2079, 2025, 11477, 2030, 6366, 9385, 14444, 2030, 2023, 5371, 20346, 1012, 1008, 1008, 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...
package utilityClasses; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; import java.lang.Class; public class ScoreInfo { private String gameName; public ScoreInfo(String gN) { gameName = gN; } public void setScores(int score, String person) { String gameScores = gameName.concat("Scores.txt"); String gamePeople = gameName.concat("People.txt"); try { Scanner scoreContents = new Scanner(new File(gameScores)); ArrayList<Integer> scores = new ArrayList<Integer>(); while (scoreContents.hasNext()) { scores.add(Integer.parseInt(scoreContents.next())); } scores.add(score); // /////////////////////////////////////////////////////////// Scanner peopleContents = new Scanner(new File(gamePeople)); ArrayList<String> people = new ArrayList<String>(); while (peopleContents.hasNext()) { people.add(peopleContents.next()); } people.add(person); ArrayList<String[]> results = scoreOrder(scores, people); PrintWriter scoreWriter = new PrintWriter(new FileWriter(gameScores)); PrintWriter peopleWriter = new PrintWriter(new FileWriter(gamePeople)); for (String[] sp : results) { scoreWriter.println(sp[0]); peopleWriter.println(sp[1]); } peopleWriter.flush(); scoreWriter.flush(); peopleWriter.close(); scoreWriter.close(); scoreContents.close(); peopleContents.close(); } catch (IOException e) { } } public ArrayList<String[]> getScores() { String gameScores = gameName.concat("Scores.txt"); String gamePeople = gameName.concat("People.txt"); try { Scanner scoreContents = new Scanner(new File(gameScores)); ArrayList<Integer> scores = new ArrayList<Integer>(); while (scoreContents.hasNext()) { scores.add(Integer.parseInt(scoreContents.next())); } Scanner peopleContents = new Scanner(new File(gamePeople)); ArrayList<String> people = new ArrayList<String>(); while (peopleContents.hasNext()) { people.add(peopleContents.next()); } ArrayList<String[]> results = new ArrayList<String[]>(); for (int i = 0; i < people.size(); i++) { String[] hs = {scores.get(i).toString(), people.get(i)}; results.add(hs); } scoreContents.close(); peopleContents.close(); return results; } catch (FileNotFoundException e) { ArrayList<String[]> n = new ArrayList<String[]>(); String[] m = {"0", "UNK"}; n.add(m); return n; } } public ArrayList<String[]> scoreOrder(ArrayList<Integer> scores, ArrayList<String> people) { ArrayList<String[]> results = new ArrayList<String[]>(); for (int i = 0; i < people.size(); i++) { String[] sp = { scores.get(i).toString(), people.get(i) }; results.add(sp); } Collections.sort(results, new Comparator<String[]>() { @Override public int compare(String[] person1, String[] person2) { return person1[1].compareTo(person2[1]); } }); Collections.sort(results, new Comparator<String[]>() { @Override public int compare(String[] score1, String[] score2) { return Integer.parseInt(score2[0]) - Integer.parseInt(score1[0]); } }); return results; } // public static void main(String[] args) { // // ScoreInfo SI = new ScoreInfo("hole"); // ArrayList<String[]> scores = SI.getScores(); // SI.setScores(10, "BradyTest1"); // System.out.println(); // // } }
BinEP/Games
ScoreInfo.java
Java
mit
3,561
[ 30522, 7427, 9710, 26266, 2229, 1025, 12324, 9262, 1012, 22834, 1012, 5371, 1025, 12324, 9262, 1012, 22834, 1012, 5371, 17048, 14876, 8630, 10288, 24422, 1025, 12324, 9262, 1012, 22834, 1012, 5371, 15994, 1025, 12324, 9262, 1012, 22834, 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...
class DeepPreloader VERSION = '1.0.2' end
iknow/deep_preloader
lib/deep_preloader/version.rb
Ruby
mit
44
[ 30522, 2465, 2784, 28139, 11066, 2121, 2544, 1027, 1005, 1015, 1012, 1014, 1012, 1016, 1005, 2203, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Nemundo\Package\Bootstrap\Table; use Nemundo\Html\Table\Table; class BootstrapTable extends Table { /** * @var bool */ public $smallTable = false; /** * @var bool */ public $hover = false; /** * @var bool */ public $inverse = false; /** * @var bool */ public $striped = false; public function getContent() { $this->addCssClass('table'); if ($this->smallTable) { $this->addCssClass('table-sm'); } if ($this->hover) { $this->addCssClass('table-hover'); } if ($this->inverse) { $this->addCssClass('table-inverse'); } if ($this->striped) { $this->addCssClass('table-striped'); } return parent::getContent(); } }
nemundo/framework
src/Package/Bootstrap/Table/BootstrapTable.php
PHP
mit
853
[ 30522, 1026, 1029, 25718, 3415, 15327, 11265, 25574, 2080, 1032, 7427, 1032, 6879, 6494, 2361, 1032, 2795, 1025, 2224, 11265, 25574, 2080, 1032, 16129, 1032, 2795, 1032, 2795, 1025, 2465, 6879, 6494, 22799, 3468, 8908, 2795, 1063, 1013, 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...
/* * Copyright 2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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 jp.fieldnotes.hatunatu.dao.impl.bean; import jp.fieldnotes.hatunatu.dao.annotation.tiger.Bean; import jp.fieldnotes.hatunatu.dao.annotation.tiger.Column; import java.io.Serializable; @Bean(table = "EMP") public class Employee9 implements Serializable { private static final long serialVersionUID = 1L; private long empno; private String ename; public long getEmpno() { return this.empno; } public void setEmpno(long empno) { this.empno = empno; } @Column("eNaMe") public String getEname() { return this.ename; } public void setEname(String ename) { this.ename = ename; } public String toString() { StringBuilder buf = new StringBuilder(); buf.append(empno).append(", "); buf.append(ename); return buf.toString(); } }
azusa/hatunatu
hatunatu/src/test/java/jp/fieldnotes/hatunatu/dao/impl/bean/Employee9.java
Java
apache-2.0
1,472
[ 30522, 1013, 1008, 1008, 9385, 2325, 1996, 2434, 3166, 2030, 6048, 1012, 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, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var XmlHighlightRules = function(normalize) { var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*"; this.$rules = { start : [ {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"}, { token : ["punctuation.instruction.xml", "keyword.instruction.xml"], regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction" }, {token : "comment.start.xml", regex : "<\\!--", next : "comment"}, { token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"], regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true }, {include : "tag"}, {token : "text.end-tag-open.xml", regex: "</"}, {token : "text.tag-open.xml", regex: "<"}, {include : "reference"}, {defaultToken : "text.xml"} ], processing_instruction : [{ token : "entity.other.attribute-name.decl-attribute-name.xml", regex : tagRegex }, { token : "keyword.operator.decl-attribute-equals.xml", regex : "=" }, { include: "whitespace" }, { include: "string" }, { token : "punctuation.xml-decl.xml", regex : "\\?>", next : "start" }], doctype : [ {include : "whitespace"}, {include : "string"}, {token : "xml-pe.doctype.xml", regex : ">", next : "start"}, {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"}, {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"} ], int_subset : [{ token : "text.xml", regex : "\\s+" }, { token: "punctuation.int-subset.xml", regex: "]", next: "pop" }, { token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"], regex : "(<\\!)(" + tagRegex + ")", push : [{ token : "text", regex : "\\s+" }, { token : "punctuation.markup-decl.xml", regex : ">", next : "pop" }, {include : "string"}] }], cdata : [ {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"}, {token : "text.xml", regex : "\\s+"}, {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"} ], comment : [ {token : "comment.end.xml", regex : "-->", next : "start"}, {defaultToken : "comment.xml"} ], reference : [{ token : "constant.language.escape.reference.xml", regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" }], attr_reference : [{ token : "constant.language.escape.reference.attribute-value.xml", regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" }], tag : [{ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"], regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")", next: [ {include : "attributes"}, {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"} ] }], tag_whitespace : [ {token : "text.tag-whitespace.xml", regex : "\\s+"} ], whitespace : [ {token : "text.whitespace.xml", regex : "\\s+"} ], string: [{ token : "string.xml", regex : "'", push : [ {token : "string.xml", regex: "'", next: "pop"}, {defaultToken : "string.xml"} ] }, { token : "string.xml", regex : '"', push : [ {token : "string.xml", regex: '"', next: "pop"}, {defaultToken : "string.xml"} ] }], attributes: [{ token : "entity.other.attribute-name.xml", regex : tagRegex }, { token : "keyword.operator.attribute-equals.xml", regex : "=" }, { include: "tag_whitespace" }, { include: "attribute_value" }], attribute_value: [{ token : "string.attribute-value.xml", regex : "'", push : [ {token : "string.attribute-value.xml", regex: "'", next: "pop"}, {include : "attr_reference"}, {defaultToken : "string.attribute-value.xml"} ] }, { token : "string.attribute-value.xml", regex : '"', push : [ {token : "string.attribute-value.xml", regex: '"', next: "pop"}, {include : "attr_reference"}, {defaultToken : "string.attribute-value.xml"} ] }] }; if (this.constructor === XmlHighlightRules) this.normalizeRules(); }; (function() { this.embedTagRules = function(HighlightRules, prefix, tag){ this.$rules.tag.unshift({ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], regex : "(<)(" + tag + "(?=\\s|>|$))", next: [ {include : "attributes"}, {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"} ] }); this.$rules[tag + "-end"] = [ {include : "attributes"}, {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start", onMatch : function(value, currentState, stack) { stack.splice(0); return this.token; }} ]; this.embedRules(HighlightRules, prefix, [{ token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"], regex : "(</)(" + tag + "(?=\\s|>|$))", next: tag + "-end" }, { token: "string.cdata.xml", regex : "<\\!\\[CDATA\\[" }, { token: "string.cdata.xml", regex : "\\]\\]>" }]); }; }).call(TextHighlightRules.prototype); oop.inherits(XmlHighlightRules, TextHighlightRules); exports.XmlHighlightRules = XmlHighlightRules; }); define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var Behaviour = require("../behaviour").Behaviour; var TokenIterator = require("../../token_iterator").TokenIterator; var lang = require("../../lib/lang"); function is(token, type) { return token && token.type.lastIndexOf(type + ".xml") > -1; } var XmlBehaviour = function () { this.add("string_dquotes", "insertion", function (state, action, editor, session, text) { if (text == '"' || text == "'") { var quote = text; var selected = session.doc.getTextRange(editor.getSelectionRange()); if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { return { text: quote + selected + quote, selection: false }; } var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); var rightChar = line.substring(cursor.column, cursor.column + 1); var iterator = new TokenIterator(session, cursor.row, cursor.column); var token = iterator.getCurrentToken(); if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) { return { text: "", selection: [1, 1] }; } if (!token) token = iterator.stepBackward(); if (!token) return; while (is(token, "tag-whitespace") || is(token, "whitespace")) { token = iterator.stepBackward(); } var rightSpace = !rightChar || rightChar.match(/\s/); if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) { return { text: quote + quote, selection: [1, 1] }; } } }); this.add("string_dquotes", "deletion", function(state, action, editor, session, range) { var selected = session.doc.getTextRange(range); if (!range.isMultiLine() && (selected == '"' || selected == "'")) { var line = session.doc.getLine(range.start.row); var rightChar = line.substring(range.start.column + 1, range.start.column + 2); if (rightChar == selected) { range.end.column++; return range; } } }); this.add("autoclosing", "insertion", function (state, action, editor, session, text) { if (text == '>') { var position = editor.getSelectionRange().start; var iterator = new TokenIterator(session, position.row, position.column); var token = iterator.getCurrentToken() || iterator.stepBackward(); if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value"))) return; if (is(token, "reference.attribute-value")) return; if (is(token, "attribute-value")) { var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length; if (position.column < tokenEndColumn) return; if (position.column == tokenEndColumn) { var nextToken = iterator.stepForward(); // TODO also handle non-closed string at the end of the line if (nextToken && is(nextToken, "attribute-value")) return; iterator.stepBackward(); } } if (/^\s*>/.test(session.getLine(position.row).slice(position.column))) return; while (!is(token, "tag-name")) { token = iterator.stepBackward(); if (token.value == "<") { token = iterator.stepForward(); break; } } var tokenRow = iterator.getCurrentTokenRow(); var tokenColumn = iterator.getCurrentTokenColumn(); if (is(iterator.stepBackward(), "end-tag-open")) return; var element = token.value; if (tokenRow == position.row) element = element.substring(0, position.column - tokenColumn); if (this.voidElements.hasOwnProperty(element.toLowerCase())) return; return { text: ">" + "</" + element + ">", selection: [1, 1] }; } }); this.add("autoindent", "insertion", function (state, action, editor, session, text) { if (text == "\n") { var cursor = editor.getCursorPosition(); var line = session.getLine(cursor.row); var iterator = new TokenIterator(session, cursor.row, cursor.column); var token = iterator.getCurrentToken(); if (token && token.type.indexOf("tag-close") !== -1) { if (token.value == "/>") return; while (token && token.type.indexOf("tag-name") === -1) { token = iterator.stepBackward(); } if (!token) { return; } var tag = token.value; var row = iterator.getCurrentTokenRow(); token = iterator.stepBackward(); if (!token || token.type.indexOf("end-tag") !== -1) { return; } if (this.voidElements && !this.voidElements[tag]) { var nextToken = session.getTokenAt(cursor.row, cursor.column+1); var line = session.getLine(row); var nextIndent = this.$getIndent(line); var indent = nextIndent + session.getTabString(); if (nextToken && nextToken.value === "</") { return { text: "\n" + indent + "\n" + nextIndent, selection: [1, indent.length, 1, indent.length] }; } else { return { text: "\n" + indent }; } } } } }); }; oop.inherits(XmlBehaviour, Behaviour); exports.XmlBehaviour = XmlBehaviour; }); define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var lang = require("../../lib/lang"); var Range = require("../../range").Range; var BaseFoldMode = require("./fold_mode").FoldMode; var TokenIterator = require("../../token_iterator").TokenIterator; var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) { BaseFoldMode.call(this); this.voidElements = voidElements || {}; this.optionalEndTags = oop.mixin({}, this.voidElements); if (optionalEndTags) oop.mixin(this.optionalEndTags, optionalEndTags); }; oop.inherits(FoldMode, BaseFoldMode); var Tag = function() { this.tagName = ""; this.closing = false; this.selfClosing = false; this.start = {row: 0, column: 0}; this.end = {row: 0, column: 0}; }; function is(token, type) { return token.type.lastIndexOf(type + ".xml") > -1; } (function() { this.getFoldWidget = function(session, foldStyle, row) { var tag = this._getFirstTagInLine(session, row); if (!tag) return this.getCommentFoldWidget(session, row); if (tag.closing || (!tag.tagName && tag.selfClosing)) return foldStyle == "markbeginend" ? "end" : ""; if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase())) return ""; if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column)) return ""; return "start"; }; this.getCommentFoldWidget = function(session, row) { if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row))) return "start"; return ""; }; this._getFirstTagInLine = function(session, row) { var tokens = session.getTokens(row); var tag = new Tag(); for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; if (is(token, "tag-open")) { tag.end.column = tag.start.column + token.value.length; tag.closing = is(token, "end-tag-open"); token = tokens[++i]; if (!token) return null; tag.tagName = token.value; tag.end.column += token.value.length; for (i++; i < tokens.length; i++) { token = tokens[i]; tag.end.column += token.value.length; if (is(token, "tag-close")) { tag.selfClosing = token.value == '/>'; break; } } return tag; } else if (is(token, "tag-close")) { tag.selfClosing = token.value == '/>'; return tag; } tag.start.column += token.value.length; } return null; }; this._findEndTagInLine = function(session, row, tagName, startColumn) { var tokens = session.getTokens(row); var column = 0; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; column += token.value.length; if (column < startColumn) continue; if (is(token, "end-tag-open")) { token = tokens[i + 1]; if (token && token.value == tagName) return true; } } return false; }; this._readTagForward = function(iterator) { var token = iterator.getCurrentToken(); if (!token) return null; var tag = new Tag(); do { if (is(token, "tag-open")) { tag.closing = is(token, "end-tag-open"); tag.start.row = iterator.getCurrentTokenRow(); tag.start.column = iterator.getCurrentTokenColumn(); } else if (is(token, "tag-name")) { tag.tagName = token.value; } else if (is(token, "tag-close")) { tag.selfClosing = token.value == "/>"; tag.end.row = iterator.getCurrentTokenRow(); tag.end.column = iterator.getCurrentTokenColumn() + token.value.length; iterator.stepForward(); return tag; } } while(token = iterator.stepForward()); return null; }; this._readTagBackward = function(iterator) { var token = iterator.getCurrentToken(); if (!token) return null; var tag = new Tag(); do { if (is(token, "tag-open")) { tag.closing = is(token, "end-tag-open"); tag.start.row = iterator.getCurrentTokenRow(); tag.start.column = iterator.getCurrentTokenColumn(); iterator.stepBackward(); return tag; } else if (is(token, "tag-name")) { tag.tagName = token.value; } else if (is(token, "tag-close")) { tag.selfClosing = token.value == "/>"; tag.end.row = iterator.getCurrentTokenRow(); tag.end.column = iterator.getCurrentTokenColumn() + token.value.length; } } while(token = iterator.stepBackward()); return null; }; this._pop = function(stack, tag) { while (stack.length) { var top = stack[stack.length-1]; if (!tag || top.tagName == tag.tagName) { return stack.pop(); } else if (this.optionalEndTags.hasOwnProperty(top.tagName)) { stack.pop(); continue; } else { return null; } } }; this.getFoldWidgetRange = function(session, foldStyle, row) { var firstTag = this._getFirstTagInLine(session, row); if (!firstTag) { return this.getCommentFoldWidget(session, row) && session.getCommentFoldRange(row, session.getLine(row).length); } var isBackward = firstTag.closing || firstTag.selfClosing; var stack = []; var tag; if (!isBackward) { var iterator = new TokenIterator(session, row, firstTag.start.column); var start = { row: row, column: firstTag.start.column + firstTag.tagName.length + 2 }; if (firstTag.start.row == firstTag.end.row) start.column = firstTag.end.column; while (tag = this._readTagForward(iterator)) { if (tag.selfClosing) { if (!stack.length) { tag.start.column += tag.tagName.length + 2; tag.end.column -= 2; return Range.fromPoints(tag.start, tag.end); } else continue; } if (tag.closing) { this._pop(stack, tag); if (stack.length == 0) return Range.fromPoints(start, tag.start); } else { stack.push(tag); } } } else { var iterator = new TokenIterator(session, row, firstTag.end.column); var end = { row: row, column: firstTag.start.column }; while (tag = this._readTagBackward(iterator)) { if (tag.selfClosing) { if (!stack.length) { tag.start.column += tag.tagName.length + 2; tag.end.column -= 2; return Range.fromPoints(tag.start, tag.end); } else continue; } if (!tag.closing) { this._pop(stack, tag); if (stack.length == 0) { tag.start.column += tag.tagName.length + 2; if (tag.start.row == tag.end.row && tag.start.column < tag.end.column) tag.start.column = tag.end.column; return Range.fromPoints(tag.start, end); } } else { stack.push(tag); } } } }; }).call(FoldMode.prototype); }); define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextMode = require("./text").Mode; var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; var XmlBehaviour = require("./behaviour/xml").XmlBehaviour; var XmlFoldMode = require("./folding/xml").FoldMode; var WorkerClient = require("../worker/worker_client").WorkerClient; var Mode = function() { this.HighlightRules = XmlHighlightRules; this.$behaviour = new XmlBehaviour(); this.foldingRules = new XmlFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.voidElements = lang.arrayToMap([]); this.blockComment = {start: "<!--", end: "-->"}; this.createWorker = function(session) { var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker"); worker.attachToDocument(session.getDocument()); worker.on("error", function(e) { session.setAnnotations(e.data); }); worker.on("terminate", function() { session.clearAnnotations(); }); return worker; }; this.$id = "ace/mode/xml"; }).call(Mode.prototype); exports.Mode = Mode; });
ddico/odoo
addons/web/static/lib/ace/mode-xml.js
JavaScript
agpl-3.0
23,724
[ 30522, 9375, 1006, 1000, 9078, 1013, 5549, 1013, 20950, 1035, 12944, 1035, 3513, 1000, 1010, 1031, 1000, 5478, 1000, 1010, 1000, 14338, 1000, 1010, 1000, 11336, 1000, 1010, 1000, 9078, 1013, 5622, 2497, 1013, 1051, 7361, 1000, 1010, 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 // (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project // // All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id$ //this script may only be included - so its better to die if called directly. if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) { header("location: index.php"); exit; } /* * Render fields of a trackeritem when called from the tracker * @param array $params - params passed from tempate as key/value pairs * Added keys to set the view/edit item template in tiki14. Format as defined in the tracker, i.e. 'wiki:myPageName, 'tpl:myTpl.tpl' * 'viewItemPretty': define a template to view the item. * 'editItemPretty': define a template to edit the item. * These keys treat the template setting in the tracker as a default value and will therefore override if present. * They only apply if the default setting would apply - i.e sectionformat must be set to configured. */ function smarty_function_trackerfields($params, $smarty) { if (! isset($params['fields']) || ! is_array($params['fields'])) { return tr('Invalid fields provided.'); } if (! isset($params['trackerId']) || ! $definition = Tracker_Definition::get($params['trackerId'])) { return tr('Missing or invalid tracker reference.'); } if (! isset($params['mode'])) { $params['mode'] = 'edit'; } $smarty->loadPlugin('smarty_function_trackeroutput'); $smarty->loadPlugin('smarty_function_trackerinput'); $sectionFormat = $definition->getConfiguration('sectionFormat', 'flat'); if (! empty($params['format'])) { $sectionFormat = $params['format']; } $trackerInfo = $definition->getInformation(); $smarty->assign('tracker_info', $trackerInfo); $smarty->assign('status_types', TikiLib::lib('trk')->status_types()); $title = tr('General'); $sections = []; $auto = ['input' => [], 'output' => [], 'inline' => []]; foreach ($params['fields'] as $field) { if ($field['type'] == 'h') { $title = tr($field['name']); } else { $sections[$title][] = $field; } $permName = $field['permName']; $itemId = isset($params['itemId']) ? $params['itemId'] : null; $auto['input'][$permName] = new Tiki_Render_Lazy(function () use ($field, $smarty) { return smarty_function_trackerinput([ 'field' => $field, 'showlinks' => 'n', 'list_mode' => 'n', ], $smarty); }); // the item-list field needs the itemId here - passed via the template - otherwise it does not show a value in the template $auto['output'][$permName] = new Tiki_Render_Lazy(function () use ($field, $smarty, $itemId) { return smarty_function_trackeroutput([ 'field' => $field, 'showlinks' => 'n', 'list_mode' => 'n', 'itemId' => $itemId, ], $smarty); }); // not sure wether we can always pass itemId bc i do not know wether the key or the value is checked if ($itemId) { $auto['inline'][$permName] = new Tiki_Render_Lazy(function () use ($field, $smarty, $itemId) { return smarty_function_trackeroutput([ 'field' => $field, 'showlinks' => 'n', 'list_mode' => 'n', 'editable' => 'inline', 'itemId' => $itemId, ], $smarty); }); } } $out = array(); foreach ($sections as $title => $fields) { $out[md5($title)] = array( 'heading' => $title, 'fields' => $fields, ); } if ($params['mode'] == 'view') { $auto['default'] = $auto['output']; } else { $auto['default'] = $auto['input']; } // Compatibility attempt with the legacy $f_X format. // Note: Here we set the the closures for the field, NOT the final values! // The final values are set in trackerlib.php using field_render_value() foreach ($fields as $field) { $id = $field['fieldId']; $permName = $field['permName']; $smarty->assign('f_' . $id, $auto['default'][$permName]); // https://doc.tiki.org/Pretty+Tracker states that next to {f_id} also {f_fieldname} can be used. // Somehow there is the support missing here - so add it $smarty->assign('f_' . $permName, $auto['default'][$permName]); } // https://doc.tiki.org/Pretty+Tracker states that also that internal trackerfield names can be used /* {$f_created}: created date {$f_status_input}: status input field {$f_status}: status (output) {$f_itemId}: the item id {$f_lastmodif}: last modified date (this will display unix date, for human readable date look below) (In Tiki 8 onwards) {$itemoff}: the iteration number of each item {$tr_offset}: the offset of the item, i.e. this is the nth item of the total number of x items */ // @TODO need to add support $smarty->assign('sections', array_values($out)); $smarty->assign('fields', $params['fields']); $smarty->assign('auto', $auto); $editItemPretty = isset($params['editItemPretty']) ? $params['editItemPretty'] : ''; $viewItemPretty = isset($params['viewItemPretty']) ? $params['viewItemPretty'] : ''; $trklib = TikiLib::lib('trk'); $trklib->registerSectionFormat('config', 'edit', $editItemPretty, tr('Configured')); $trklib->registerSectionFormat('config', 'view', $viewItemPretty, tr('Configured')); $template = $trklib->getSectionFormatTemplate($sectionFormat, $params['mode']); $trklib->unregisterSectionFormat('config'); try { $result = $smarty->fetch($template); } catch (Exception $e) { // catch any exception probably casued by a pretty tracker template issue TikiLib::lib('errorreport')->report( tr('Tracker rendering error (section="%0" mode="%1")', $sectionFormat, $params['mode']) . '<br><br>' . htmlentities($e->getMessage()) ); // try again with the default section format "flat" $template = $trklib->getSectionFormatTemplate('flat', $params['mode']); $result = $smarty->fetch($template); } return $result; }
changi67/tiki
lib/smarty_tiki/function.trackerfields.php
PHP
lgpl-2.1
5,845
[ 30522, 1026, 1029, 25718, 1013, 1013, 1006, 1039, 1007, 9385, 2526, 1011, 2325, 2011, 6048, 1997, 1996, 14841, 3211, 15536, 3211, 4642, 2015, 2177, 8059, 2622, 1013, 1013, 1013, 1013, 2035, 2916, 9235, 1012, 2156, 9385, 1012, 19067, 2102, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
/*Explosion Man for general explosions on Bukkit Copyright (C) 2013 Rory Finnegan This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.gmail.bunnehrealm.explosionman; import java.io.File; import java.io.IOException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import com.gmail.bunnehrealm.explosionman.Listeners.Deathclass; import com.gmail.bunnehrealm.explosionman.Listeners.PreventDamage; import com.gmail.bunnehrealm.explosionman.Listeners.PreventFlyKick; import com.gmail.bunnehrealm.explosionman.Listeners.StopDrops; import com.gmail.bunnehrealm.explosionman.sticks.Boomstick; import com.gmail.bunnehrealm.explosionman.sticks.LeapStick; import com.gmail.bunnehrealm.explosionman.sticks.SetBoomstick; import com.gmail.bunnehrealm.explosionman.sticks.SetLeapStick; public class MainClass extends JavaPlugin { public File playersFile; public FileConfiguration players; public String fileName; public JavaPlugin plugin; public Boomstick boomListen = new Boomstick(this); public Deathclass deathListen = new Deathclass(this); public Explodecmd explodeCmd = new Explodecmd(this); public FexplodeClass fexplodeCmd = new FexplodeClass(this); public PreventDamage damageListen = new PreventDamage(this); public LaunchClass launchCmd = new LaunchClass(this); public LeapClass leapCmd = new LeapClass(this); public LeapStick leapStick = new LeapStick(this); public ExplodeKit explodeKit = new ExplodeKit(this); public PreventDamage MoreListen = new PreventDamage(this); public PreventFlyKick flyListen = new PreventFlyKick(this); public SetBoomstick setBoomstick = new SetBoomstick(this); public SetLeapStick setLeapStick = new SetLeapStick(this); public StopDrops dropListen = new StopDrops(this); public MyLeap myLeap = new MyLeap(this); public MyBoom myBoom = new MyBoom(this); @Override public void onDisable() { getLogger().info("Explosion Man has been DISABLED!"); if(playersFile.exists()) savePlayers(); else{ return; } } @Override public void onEnable() { this.getConfig().options().copyDefaults(true); this.saveDefaultConfig(); getLogger().info("Explosion Man has been ENABLED!"); PluginManager pm = getServer().getPluginManager(); pm.registerEvents(this.boomListen, this); pm.registerEvents(this.deathListen, this); pm.registerEvents(this.leapStick, this); pm.registerEvents(this.flyListen, this); pm.registerEvents(this.damageListen, this); pm.registerEvents(this.dropListen, this); getCommand("myboom").setExecutor(myBoom); getCommand("explodekit").setExecutor(explodeKit); getCommand("leap").setExecutor(leapCmd); getCommand("explode").setExecutor(explodeCmd); getCommand("setboomstick").setExecutor(setBoomstick); getCommand("setleapstick").setExecutor(setLeapStick); getCommand("fexplode").setExecutor(fexplodeCmd); getCommand("myleap").setExecutor(myLeap); getCommand("launch").setExecutor(launchCmd); playersFile = new File(getDataFolder(), "players.yml"); players = new YamlConfiguration(); try{ firstRun(); } catch(Exception e){ return; } loadPlayers(); if (!this.getConfig().isSet("dropblocks")) { this.getConfig().set("dropblocks", true); } if (!this.getConfig().isSet("explodefire")) { this.getConfig().set("explodefire", false); } if (!this.getConfig().isSet("explodeblocks")) { this.getConfig().set("exlodeblocks", true); } if (!this.getConfig().isSet("explodepower")) { this.getConfig().set("explodepower", 4); } if (!this.getConfig().isSet("explodebigpower")) { this.getConfig().set("explodebigpower", 50); } if (!this.getConfig().isSet("fexplodefire")) { this.getConfig().set("fexplodefire", false); } if (!this.getConfig().isSet("fexplodeblocks")) { this.getConfig().set("fexplodeblocks", true); } if (!this.getConfig().isSet("fexplodepower")) { this.getConfig().set("fexplodepower", 4); } if (!this.getConfig().isSet("fexplodebigpower")) { this.getConfig().set("fexplodebigpower", 50); } if (!this.getConfig().isSet("boomblocks")) { this.getConfig().set("boomblocks", true); } if (!this.getConfig().isSet("boomitem")) { this.getConfig().set("boomitem", 280); } if (!this.getConfig().isSet("boomfire")) { this.getConfig().set("boomfire", false); } if (!this.getConfig().isSet("boompower")) { this.getConfig().set("boompower", 4); } if (!this.getConfig().isSet("deathpower")) { this.getConfig().set("deathpower", 4); } if (!this.getConfig().isSet("deathfire")) { this.getConfig().set("deathfire", false); } if (!this.getConfig().isSet("deathblocks")) { this.getConfig().set("deathblocks", true); } if (!this.getConfig().isSet("explodemsg")) { this.getConfig().set("explodemsg", false); } if (!this.getConfig().isSet("explodetext")) { this.getConfig().set("explodetext", "Insert message here"); } if (!this.getConfig().isSet("fexplodemsg")) { this.getConfig().set("fexplodemsg", false); } if (!this.getConfig().isSet("fexplodetext")) { this.getConfig().set("fexplodetext", "Insert message here"); } if (!this.getConfig().isSet("boomstickmsg")) { this.getConfig().set("boomstickmsg", false); } if (!this.getConfig().isSet("boomsticktext")) { this.getConfig().set("boomsticktext", "Insert message here"); } if (!this.getConfig().isSet("launchfire")) { this.getConfig().set("launchfire", false); } if (!this.getConfig().isSet("launchblocks")) { this.getConfig().set("launchblocks", true); } if (!this.getConfig().isSet("launchpower")) { this.getConfig().set("launchpower", 4); } if (!this.getConfig().isSet("launchheight")) { this.getConfig().set("launchheight", 5); } if (!this.getConfig().isSet("launchmsg")) { this.getConfig().set("launchmsg", false); } if (!this.getConfig().isSet("launchtxt")) { this.getConfig().set("launchtxt", "Insert message here"); } if (!this.getConfig().isSet("leapfire")) { this.getConfig().set("leapfire", false); } if (!this.getConfig().isSet("leapblocks")) { this.getConfig().set("leapblocks", true); } if (!this.getConfig().isSet("leapdefault")) { this.getConfig().set("leapdefault", 5); } if (!this.getConfig().isSet("leapexplode")) { this.getConfig().set("leapexplode", true); } if (!this.getConfig().isSet("leapstartpower")) { this.getConfig().set("leapstartpower", 4); } if (!this.getConfig().isSet("leapmsg")) { this.getConfig().set("leapmsg", false); } if (!this.getConfig().isSet("leaptxt")) { this.getConfig().set("leaptxt", "Insert message here"); } if (!this.getConfig().isSet("leapstickfire")) { this.getConfig().set("leapstickfire", false); } if (!this.getConfig().isSet("leapstickblocks")) { this.getConfig().set("leapstickblocks", true); } if (!this.getConfig().isSet("leapstickid")) { this.getConfig().set("leapstickid", 289); } if (!this.getConfig().isSet("leapstickexplode")) { this.getConfig().set("leapstickexplode", true); } if (!this.getConfig().isSet("leapmsg")) { this.getConfig().set("leapmsg", false); } if (!this.getConfig().isSet("leapstickstartpower")) { this.getConfig().set("leapstickstartpower", 4); } if (!this.getConfig().isSet("leapstickmsg")) { this.getConfig().set("leapstickmsg", false); } if (!this.getConfig().isSet("leapsticktxt")) { this.getConfig().set("testms", "Insert message here"); } if (!this.getConfig().isSet("Version")) { this.getConfig().set("Version", "1.7 #(PLEASE DO NOT CHANGE)"); } this.saveConfig(); this.savePlayers(); } private void firstRun() throws Exception{ if(!playersFile.exists()){ getLogger().info("Creating a players.yml file"); playersFile.getParentFile().mkdirs(); playersFile.createNewFile(); } } public void loadPlayers() { try { players.load(playersFile); } catch (Exception e) { return; } } public void savePlayers(){ try{ players.save(playersFile); } catch(IOException e){ return; } } }
Malandrix/Explosion-Man
Explosion Man/src/com/gmail/bunnehrealm/explosionman/MainClass.java
Java
gpl-3.0
8,770
[ 30522, 1013, 1008, 7738, 2158, 2005, 2236, 18217, 2006, 20934, 24103, 2102, 9385, 1006, 1039, 1007, 2286, 14285, 9303, 20307, 2023, 2565, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 2009,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.wandrell.tabletop.pendragon.model.glory; public interface FatherClassGlory { public Integer getBaseGlory(); public String getFatherClass(); public Integer getYearlyGlory(); }
Bernardo-MG/pendragon-model-api
src/main/java/com/wandrell/tabletop/pendragon/model/glory/FatherClassGlory.java
Java
apache-2.0
205
[ 30522, 7427, 4012, 1012, 23967, 16230, 1012, 13855, 7361, 1012, 7279, 7265, 7446, 1012, 2944, 1012, 8294, 1025, 2270, 8278, 2269, 26266, 23296, 10253, 1063, 2270, 16109, 2131, 15058, 23296, 10253, 1006, 1007, 1025, 2270, 5164, 2131, 27753, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
/* Report an error and exit. Copyright (C) 2017-2019 Free Software Foundation, Inc. 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, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Borrowed from coreutils. */ #ifndef DIE_H # define DIE_H # include <error.h> # include <stdbool.h> # include <verify.h> /* Like 'error (STATUS, ...)', except STATUS must be a nonzero constant. This may pacify the compiler or help it generate better code. */ # define die(status, ...) \ verify_expr (status, (error (status, __VA_ARGS__), assume (false))) #endif /* DIE_H */
pexip/os-findutils
lib/die.h
C
gpl-3.0
1,182
[ 30522, 1013, 1008, 3189, 2019, 7561, 1998, 6164, 1012, 9385, 1006, 1039, 1007, 2418, 1011, 10476, 2489, 4007, 3192, 1010, 4297, 1012, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
Symfony Standard Edition ======================== Welcome to the Symfony Standard Edition - a fully-functional Symfony2 application that you can use as the skeleton for your new applications. This document contains information on how to download, install, and start using Symfony. For a more detailed explanation, see the [Installation][1] chapter of the Symfony Documentation. 1) Installing the Standard Edition ---------------------------------- When it comes to installing the Symfony Standard Edition, you have the following options. ### Use Composer (*recommended*) As Symfony uses [Composer][2] to manage its dependencies, the recommended way to create a new project is to use it. If you don't have Composer yet, download it following the instructions on http://getcomposer.org/ or just run the following command: curl -s http://getcomposer.org/installer | php Then, use the `create-project` command to generate a new Symfony application: php composer.phar create-project symfony/framework-standard-edition path/to/install Composer will install Symfony and all its dependencies under the `path/to/install` directory. ### Download an Archive File To quickly test Symfony, you can also download an [archive][3] of the Standard Edition and unpack it somewhere under your web server root directory. If you downloaded an archive "without vendors", you also need to install all the necessary dependencies. Download composer (see above) and run the following command: php composer.phar install 2) Checking your System Configuration ------------------------------------- Before starting coding, make sure that your local system is properly configured for Symfony. Execute the `check.php` script from the command line: php app/check.php The script returns a status code of `0` if all mandatory requirements are met, `1` otherwise. Access the `config.php` script from a browser: http://localhost/path/to/symfony/app/web/config.php If you get any warnings or recommendations, fix them before moving on. 3) Browsing the Demo Application -------------------------------- Congratulations! You're now ready to use Symfony. From the `config.php` page, click the "Bypass configuration and go to the Welcome page" link to load up your first Symfony page. You can also use a web-based configurator by clicking on the "Configure your Symfony Application online" link of the `config.php` page. To see a real-live Symfony page in action, access the following page: web/app_dev.php/demo/hello/Fabien 4) Getting started with Symfony ------------------------------- This distribution is meant to be the starting point for your Symfony applications, but it also contains some sample code that you can learn from and play with. A great way to start learning Symfony is via the [Quick Tour][4], which will take you through all the basic features of Symfony2. Once you're feeling good, you can move onto reading the official [Symfony2 book][5]. A default bundle, `AcmeDemoBundle`, shows you Symfony2 in action. After playing with it, you can remove it by following these steps: * delete the `src/Acme` directory; * remove the routing entry referencing AcmeDemoBundle in `app/config/routing_dev.yml`; * remove the AcmeDemoBundle from the registered bundles in `app/AppKernel.php`; * remove the `web/bundles/acmedemo` directory; * remove the `security.providers`, `security.firewalls.login` and `security.firewalls.secured_area` entries in the `security.yml` file or tweak the security configuration to fit your needs. What's inside? --------------- The Symfony Standard Edition is configured with the following defaults: * Twig is the only configured template engine; * Doctrine ORM/DBAL is configured; * Swiftmailer is configured; * Annotations for everything are enabled. It comes pre-configured with the following bundles: * **FrameworkBundle** - The core Symfony framework bundle * [**SensioFrameworkExtraBundle**][6] - Adds several enhancements, including template and routing annotation capability * [**DoctrineBundle**][7] - Adds support for the Doctrine ORM * [**TwigBundle**][8] - Adds support for the Twig templating engine * [**SecurityBundle**][9] - Adds security by integrating Symfony's security component * [**SwiftmailerBundle**][10] - Adds support for Swiftmailer, a library for sending emails * [**MonologBundle**][11] - Adds support for Monolog, a logging library * [**AsseticBundle**][12] - Adds support for Assetic, an asset processing library * **WebProfilerBundle** (in dev/test env) - Adds profiling functionality and the web debug toolbar * **SensioDistributionBundle** (in dev/test env) - Adds functionality for configuring and working with Symfony distributions * [**SensioGeneratorBundle**][13] (in dev/test env) - Adds code generation capabilities * **AcmeDemoBundle** (in dev/test env) - A demo bundle with some example code All libraries and bundles included in the Symfony Standard Edition are released under the MIT or BSD license. Enjoy! [1]: http://symfony.com/doc/2.3/book/installation.html [2]: http://getcomposer.org/ [3]: http://symfony.com/download [4]: http://symfony.com/doc/2.3/quick_tour/the_big_picture.html [5]: http://symfony.com/doc/2.3/index.html [6]: http://symfony.com/doc/2.3/bundles/SensioFrameworkExtraBundle/index.html [7]: http://symfony.com/doc/2.3/book/doctrine.html [8]: http://symfony.com/doc/2.3/book/templating.html [9]: http://symfony.com/doc/2.3/book/security.html [10]: http://symfony.com/doc/2.3/cookbook/email.html [11]: http://symfony.com/doc/2.3/cookbook/logging/monolog.html [12]: http://symfony.com/doc/2.3/cookbook/assetic/asset_management.html [13]: http://symfony.com/doc/2.3/bundles/SensioGeneratorBundle/index.html # Kifland
KroKroDile/Kifland
README.md
Markdown
mit
5,853
[ 30522, 25353, 2213, 14876, 4890, 3115, 3179, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 6160, 2000, 1996, 25353, 2213, 14876, 4890, 3115, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, Regents of the University of California * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of the University of California, Berkeley 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. */ package blog.model; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import blog.bn.BayesNetVar; import blog.sample.EvalContext; /** * A Formula consisting of a single boolean-valued term. * * @see blog.model.Term * @see blog.model.Formula */ public class AtomicFormula extends Formula { public AtomicFormula(Term sent) { this.sent = sent; } public Term getTerm() { return sent; } public Object evaluate(EvalContext context) { Object value = sent.evaluate(context); if (value == null) { return null; } if (!(value instanceof Boolean)) { throw new IllegalStateException("Sentence " + sent + " has non-Boolean value " + value); } return (value.equals(Boolean.TRUE) ? Boolean.TRUE : Boolean.FALSE); } /** * Returns the (basic or derived) random variable that this atomic formula * corresponds to under the given assignment. This is just the random variable * corresponding to underlying Boolean term. */ public BayesNetVar getVariable() { return sent.getVariable(); } /** * Returns a singleton collection containing the term in this atomic formula. */ public Collection getSubExprs() { return Collections.singletonList(sent); } /** * Returns true. */ public boolean isLiteral() { return true; } public List<Term> getTopLevelTerms() { return Collections.singletonList(sent); } public Set getSatisfiersIfExplicit(EvalContext context, LogicalVar subject, GenericObject genericObj) { Set result = null; context.assign(subject, genericObj); // The only time we can determine the satisfiers is if this // formula can be evaluated on genericObj. Boolean value = (Boolean) evaluate(context); if (value != null) { result = (value.booleanValue() == true ? Formula.ALL_OBJECTS : Collections.EMPTY_SET); } context.unassign(subject); return result; } public Set getNonSatisfiersIfExplicit(EvalContext context, LogicalVar subject, GenericObject genericObj) { Set result = null; context.assign(subject, genericObj); // The only time we can determine the non-satisfiers is if // this formula can be evaluated on genericObj. Boolean value = (Boolean) evaluate(context); if (value != null) { result = (value.booleanValue() == false ? Formula.ALL_OBJECTS : Collections.EMPTY_SET); } context.unassign(subject); return result; } /** * Two atomic formulas are equal if their underlying terms are equal. */ public boolean equals(Object o) { if (o instanceof AtomicFormula) { AtomicFormula other = (AtomicFormula) o; return sent.equals(other.getTerm()); } return false; } public int hashCode() { return sent.hashCode(); } /** * Returns the string representation of the underlying term. */ public String toString() { return sent.toString(); } /** * Returns true if the underlying term satisfies the type/scope constraints * and has a Boolean type. */ public boolean checkTypesAndScope(Model model, Map scope, Type childType) { Term sentInScope = sent.getTermInScope(model, scope); if (sentInScope == null) { return false; } sent = sentInScope; if (!sent.getType().isSubtypeOf(BuiltInTypes.BOOLEAN)) { System.err.println("Error: Non-Boolean term treated as " + "atomic formula: " + sent); return false; } return true; } public ArgSpec replace(Term t, ArgSpec another) { Term newSent = (Term) sent.replace(t, another); if (newSent != sent) return compileAnotherIfCompiled(new AtomicFormula(newSent)); return this; } public ArgSpec getSubstResult(Substitution subst, Set<LogicalVar> boundVars) { return new AtomicFormula((Term) sent.getSubstResult(subst, boundVars)); } /** The Term instance, assumed to be boolean-valued */ private Term sent; }
BayesianLogic/blog
src/main/java/blog/model/AtomicFormula.java
Java
bsd-3-clause
5,685
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2384, 1010, 22832, 1997, 1996, 2118, 1997, 2662, 1008, 2035, 2916, 9235, 1012, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302, 1008, 14080, 1010, 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...
/* * Copyright © 2014 - 2018 Leipzig University (Database Research Group) * * 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. */ /** * Contains implementations graph pattern matching on a single input graph. */ package org.gradoop.flink.model.impl.operators.matching.transactional.function;
niklasteichmann/gradoop
gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/matching/transactional/function/package-info.java
Java
apache-2.0
802
[ 30522, 1013, 1008, 1008, 9385, 1075, 2297, 1011, 2760, 11222, 2118, 1006, 7809, 2470, 2177, 1007, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 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...
'-------------------------------------------------------------------------------------------' ' Inicio del codigo '-------------------------------------------------------------------------------------------' ' Importando librerias '-------------------------------------------------------------------------------------------' Imports System.Data '-------------------------------------------------------------------------------------------' ' Inicio de clase "rRVentas_CBancarias" '-------------------------------------------------------------------------------------------' Partial Class rRVentas_CBancarias Inherits vis2Formularios.frmReporte Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim lcParametro0Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(0),goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia) Dim lcParametro0Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(0),goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia) Dim lcOrdenamiento As String = cusAplicacion.goReportes.pcOrden Try Dim loComandoSeleccionar As New StringBuilder() '-------------------------------------------------------------------------------------------' ' 1 - Select de Cobros '-------------------------------------------------------------------------------------------' loComandoSeleccionar.AppendLine(" SELECT CONVERT(NCHAR(10), Cobros.Fec_Ini, 103) AS Fec_Ini, ") loComandoSeleccionar.AppendLine(" CONVERT(NCHAR(10), Cobros.Fec_Ini, 112) AS Fecha2, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Tip_Ope AS Tip_Ope, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Num_Doc AS Num_Doc, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Mon_Net AS Mon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Ret ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalCobrosNoTarjetas1 ") loComandoSeleccionar.AppendLine(" FROM Cobros, Detalles_Cobros ") loComandoSeleccionar.AppendLine(" WHERE Cobros.Documento = Detalles_Cobros.Documento ") loComandoSeleccionar.AppendLine(" AND Detalles_Cobros.Tip_Ope <> 'Tarjeta' ") loComandoSeleccionar.AppendLine(" AND Cobros.Fec_Ini BETWEEN " & lcParametro0Desde) loComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta) loComandoSeleccionar.AppendLine(" AND Cobros.Status <> 'Anulado'") loComandoSeleccionar.AppendLine(" SELECT CONVERT(NCHAR(10), Cobros.Fec_Ini, 103) AS Fec_Ini, ") loComandoSeleccionar.AppendLine(" CONVERT(NCHAR(10), Cobros.Fec_Ini, 112) AS Fecha2, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Tip_Ope AS Tip_Ope, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Num_Doc AS Num_Doc, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Mon_Net AS Mon_Net, ") loComandoSeleccionar.AppendLine(" ((Detalles_Cobros.Mon_Net * Tarjetas.Por_Com) / 100) AS CMon_Com, ") loComandoSeleccionar.AppendLine(" ((Detalles_Cobros.Mon_Net * Tarjetas.Por_Ret) / 100) AS CMon_Ret ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalCobrosTarjetas1 ") loComandoSeleccionar.AppendLine(" FROM Cobros, Detalles_Cobros, Tarjetas ") loComandoSeleccionar.AppendLine(" WHERE Cobros.Documento = Detalles_Cobros.Documento ") loComandoSeleccionar.AppendLine(" AND Tarjetas.Cod_Tar = Detalles_Cobros.Cod_Tar ") loComandoSeleccionar.AppendLine(" AND Detalles_Cobros.Tip_Ope = 'Tarjeta' ") loComandoSeleccionar.AppendLine(" AND Cobros.Fec_Ini BETWEEN " & lcParametro0Desde) loComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta) loComandoSeleccionar.AppendLine(" AND Cobros.Status <> 'Anulado'") loComandoSeleccionar.AppendLine(" SELECT Fec_Ini AS Fec_Ini, ") loComandoSeleccionar.AppendLine(" Fecha2 AS Fecha2, ") loComandoSeleccionar.AppendLine(" Tip_Ope AS Tip_Ope, ") loComandoSeleccionar.AppendLine(" COUNT(Mon_Net) AS Cuantas, ") loComandoSeleccionar.AppendLine(" SUM(Mon_Net) AS Monto, ") loComandoSeleccionar.AppendLine(" SUM(CMon_Com) AS CMon_Com, ") loComandoSeleccionar.AppendLine(" SUM(CMon_Ret) AS CMon_Ret ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalCobros1 ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalCobrosNoTarjetas1 ") loComandoSeleccionar.AppendLine(" GROUP BY Fecha2, Fec_Ini, Tip_Ope ") loComandoSeleccionar.AppendLine(" UNION ALL ") loComandoSeleccionar.AppendLine(" SELECT Fec_Ini AS Fec_Ini, ") loComandoSeleccionar.AppendLine(" Fecha2 AS Fecha2, ") loComandoSeleccionar.AppendLine(" Tip_Ope AS Tip_Ope, ") loComandoSeleccionar.AppendLine(" COUNT(Mon_Net) AS Cuantas, ") loComandoSeleccionar.AppendLine(" SUM(Mon_Net) AS Monto, ") loComandoSeleccionar.AppendLine(" SUM(CMon_Com) AS CMon_Com, ") loComandoSeleccionar.AppendLine(" SUM(CMon_Ret) AS CMon_Ret ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalCobrosTarjetas1 ") loComandoSeleccionar.AppendLine(" GROUP BY Fecha2, Fec_Ini, Tip_Ope ") loComandoSeleccionar.AppendLine(" ORDER BY 1, 2, 5 ") '-------------------------------------------------------------------------------------------' ' 2 - Select de las Ventas '-------------------------------------------------------------------------------------------' loComandoSeleccionar.AppendLine(" SELECT Tip_Doc AS Tip_Doc, ") loComandoSeleccionar.AppendLine(" Cod_Tip AS Cod_Tip, ") loComandoSeleccionar.AppendLine(" CONVERT(NCHAR(10), Cuentas_Cobrar.Fec_Ini, 103) AS Fecha1, ") loComandoSeleccionar.AppendLine(" CONVERT(NCHAR(10), Cuentas_Cobrar.Fec_Ini, 112) AS Fecha2, ") loComandoSeleccionar.AppendLine(" (CASE WHEN Cod_Tip = 'FACT' THEN Cuentas_Cobrar.Documento ELSE SPACE(10) END) AS Documento, ") loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Status AS Status, ") loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Mon_Bru AS Mon_Bru, ") loComandoSeleccionar.AppendLine(" (Cuentas_Cobrar.Mon_Imp1 + Cuentas_Cobrar.Mon_Imp2 + Cuentas_Cobrar.Mon_Imp3) AS Mon_Imp, ") loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Mon_Net AS Mon_Net ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalDocumentos1 ") loComandoSeleccionar.AppendLine(" FROM Cuentas_Cobrar ") loComandoSeleccionar.AppendLine(" WHERE (Cuentas_Cobrar.Cod_Tip = 'FACT' ") loComandoSeleccionar.AppendLine(" OR Cuentas_Cobrar.Cod_Tip = 'N/CR') ") loComandoSeleccionar.AppendLine(" AND Cuentas_Cobrar.Status <> 'Anulado' ") loComandoSeleccionar.AppendLine(" AND Cuentas_Cobrar.Fec_Ini BETWEEN " & lcParametro0Desde) loComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta) loComandoSeleccionar.AppendLine(" SELECT Fecha1 AS Fecha1, ") loComandoSeleccionar.AppendLine(" Fecha2 AS Fecha2, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Tip_Doc = 'Debito' THEN 1 ELSE 0 END) AS Can_Fac, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Tip_Doc <> 'Debito' THEN 0 ELSE 1 END) AS Can_NCR, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Cod_Tip = 'FACT' THEN Mon_Bru ELSE 0.00 END) AS Mon_BruF, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Cod_Tip <> 'FACT' THEN Mon_Bru ELSE 0.00 END) AS Mon_BruNC, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Cod_Tip = 'FACT' THEN Mon_Imp ELSE 0.00 END) AS Mon_ImpF, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Cod_Tip <> 'FACT' THEN Mon_Imp ELSE 0.00 END) AS Mon_ImpNC, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Cod_Tip = 'FACT' THEN Mon_Net ELSE 0.00 END) AS Mon_NetF, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Cod_Tip <> 'FACT' THEN Mon_Net ELSE 0.00 END) AS Mon_NetNC, ") loComandoSeleccionar.AppendLine(" MIN((CASE WHEN Cod_Tip = 'FACT' THEN Documento END)) AS Doc_Ini, ") loComandoSeleccionar.AppendLine(" MAX(Documento) AS Doc_Fin ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalFacturas1 ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalDocumentos1 ") loComandoSeleccionar.AppendLine(" GROUP BY Fecha2, Fecha1 ") loComandoSeleccionar.AppendLine(" SELECT Fecha1 AS VenFecha1, ") loComandoSeleccionar.AppendLine(" Fecha2 AS VenFecha2, ") loComandoSeleccionar.AppendLine(" Can_Fac AS VenCan_Doc, ") loComandoSeleccionar.AppendLine(" Mon_BruF AS VenMon_BruF, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruNC, ") loComandoSeleccionar.AppendLine(" Mon_ImpF AS VenMon_ImpF, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_ImpNC, ") loComandoSeleccionar.AppendLine(" Mon_NetF AS VenMon_NetF, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_NetNC, ") loComandoSeleccionar.AppendLine(" (Mon_BruF - Mon_BruNC) AS VenMon_Bru, ") loComandoSeleccionar.AppendLine(" (Mon_ImpF - Mon_ImpNC) AS VenMon_Imp, ") loComandoSeleccionar.AppendLine(" (Mon_NetF - Mon_NetNC) AS VenMon_Net, ") loComandoSeleccionar.AppendLine(" Doc_Ini AS VenDoc_Ini, ") loComandoSeleccionar.AppendLine(" Doc_Fin AS VenDoc_Fin ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalFacturas2 ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalFacturas1 ") loComandoSeleccionar.AppendLine(" SELECT Fecha1 AS VenFecha1, ") loComandoSeleccionar.AppendLine(" Fecha2 AS VenFecha2, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Tip_Doc <> 'Debito' THEN 1 ELSE 0 END) AS VenCan_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruF, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Tip_Doc <> 'Debito' THEN Mon_Bru ELSE 0.00 END) AS VenMon_BruNC, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_ImpF, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Tip_Doc <> 'Debito' THEN Mon_Imp ELSE 0.00 END) AS VenMon_ImpNC, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_NetF, ") loComandoSeleccionar.AppendLine(" SUM(CASE WHEN Tip_Doc <> 'Debito' THEN Mon_Net ELSE 0.00 END) AS VenMon_NetNC, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_Imp, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_Net, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Fin ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalNotasCredito1 ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalDocumentos1 ") loComandoSeleccionar.AppendLine(" GROUP BY Fecha2, Fecha1 ") loComandoSeleccionar.AppendLine(" SELECT 'Facturas' AS VenTip_Doc, ") loComandoSeleccionar.AppendLine(" #TablaTemporalFacturas2.* ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalVentas1 ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalFacturas2 ") loComandoSeleccionar.AppendLine(" UNION ALL ") loComandoSeleccionar.AppendLine(" SELECT 'NCredito' AS VenTip_Doc, ") loComandoSeleccionar.AppendLine(" #TablaTemporalNotasCredito1.* ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalNotasCredito1 ") '-------------------------------------------------------------------------------------------' ' 3 - Select de las Relaciones de Descuentos por Facturas '-------------------------------------------------------------------------------------------' loComandoSeleccionar.AppendLine(" SELECT CONVERT(NCHAR(10), Cuentas_Cobrar.Fec_Ini, 103) AS DscFec_Ini, ") loComandoSeleccionar.AppendLine(" CONVERT(NCHAR(10), Cuentas_Cobrar.Fec_Ini, 112) AS DscFecha2, ") loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Documento AS DscDocumento, ") loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Por_Des AS DscPor_Des, ") loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Mon_Des AS DscMon_Des, ") loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Mon_Bru AS DscMon_Bru, ") loComandoSeleccionar.AppendLine(" Cuentas_Cobrar.Mon_Net AS DscMon_Net ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalDescuentos1 ") loComandoSeleccionar.AppendLine(" FROM Cuentas_Cobrar ") loComandoSeleccionar.AppendLine(" WHERE Cuentas_Cobrar.Cod_Tip = 'FACT' ") loComandoSeleccionar.AppendLine(" AND Cuentas_Cobrar.Por_Des > 0.00 ") loComandoSeleccionar.AppendLine(" AND Cuentas_Cobrar.Status <> 'Anulado' ") loComandoSeleccionar.AppendLine(" AND Cuentas_Cobrar.Fec_Ini Between " & lcParametro0Desde) loComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta) loComandoSeleccionar.AppendLine(" ORDER BY Cuentas_Cobrar.Fec_Ini ") '-------------------------------------------------------------------------------------------' ' 4 - Select de las Relaciones de Cheques '-------------------------------------------------------------------------------------------' loComandoSeleccionar.AppendLine(" SELECT CONVERT(NCHAR(10), Cobros.Fec_Ini, 103) AS ChFec_Ini, ") loComandoSeleccionar.AppendLine(" CONVERT(NCHAR(10), Cobros.Fec_Ini, 112) AS ChFecha2, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Documento AS ChDocumento, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Num_Doc AS ChNum_Doc, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Mon_Net AS ChMon_Net, ") loComandoSeleccionar.AppendLine(" Bancos.Nom_Ban AS ChNom_Ban ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalCheques1 ") loComandoSeleccionar.AppendLine(" FROM Cobros INNER JOIN Detalles_Cobros ") loComandoSeleccionar.AppendLine(" ON Cobros.Documento = Detalles_Cobros.Documento, ") loComandoSeleccionar.AppendLine(" Bancos ") loComandoSeleccionar.AppendLine(" WHERE Detalles_Cobros.Cod_Ban = Bancos.Cod_Ban ") loComandoSeleccionar.AppendLine(" AND Detalles_Cobros.Tip_Ope = 'Cheque' ") loComandoSeleccionar.AppendLine(" AND Cobros.Fec_Ini Between " & lcParametro0Desde) loComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta) loComandoSeleccionar.AppendLine(" AND Cobros.status <> 'Anulado'") loComandoSeleccionar.AppendLine(" ORDER BY Cobros.Fec_Ini ") '-------------------------------------------------------------------------------------------' ' 5 - Select de las Tarjetas '-------------------------------------------------------------------------------------------' loComandoSeleccionar.AppendLine(" SELECT Cobros.Documento AS TDocumento, ") loComandoSeleccionar.AppendLine(" CONVERT(NCHAR(10), Cobros.Fec_Ini, 103) AS TFec_Ini, ") loComandoSeleccionar.AppendLine(" CONVERT(NCHAR(10), Cobros.Fec_Ini, 112) AS TFecha2, ") loComandoSeleccionar.AppendLine(" Cobros.Cod_Ven AS TCod_Ven, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Cod_Tar AS TCod_Tar, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Num_Doc AS TNum_Doc, ") loComandoSeleccionar.AppendLine(" Detalles_Cobros.Mon_Net AS TMon_Net, ") loComandoSeleccionar.AppendLine(" Tarjetas.Por_Com AS TPor_Com, ") loComandoSeleccionar.AppendLine(" (Detalles_Cobros.Mon_Net * (Tarjetas.Por_Com / 100)) AS TMon_Com, ") loComandoSeleccionar.AppendLine(" Tarjetas.Por_Ret AS TPor_Ret, ") loComandoSeleccionar.AppendLine(" (Detalles_Cobros.Mon_Net * (Tarjetas.Por_Ret / 100)) AS TMon_Ret, ") loComandoSeleccionar.AppendLine(" Tarjetas.Cod_Tip AS TCod_Tip ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalTarjetas1 ") loComandoSeleccionar.AppendLine(" FROM Cobros INNER JOIN Detalles_Cobros ") loComandoSeleccionar.AppendLine(" ON Cobros.Documento = Detalles_Cobros.Documento, ") loComandoSeleccionar.AppendLine(" Tarjetas ") loComandoSeleccionar.AppendLine(" WHERE Tarjetas.Cod_Tar = Detalles_Cobros.Cod_Tar ") loComandoSeleccionar.AppendLine(" AND Cobros.Fec_Ini Between " & lcParametro0Desde) loComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta) loComandoSeleccionar.AppendLine(" AND Cobros.status <> 'Anulado'") loComandoSeleccionar.AppendLine(" ORDER BY Cobros.Fec_Ini ") '-------------------------------------------------------------------------------------------' ' 6 - Select de Comisiones '-------------------------------------------------------------------------------------------' loComandoSeleccionar.AppendLine(" SELECT CONVERT(NCHAR(10), Facturas.Fec_Ini, 103) AS Fec_Ini, ") loComandoSeleccionar.AppendLine(" CONVERT(NCHAR(10), Facturas.Fec_Ini, 112) AS Fecha2, ") loComandoSeleccionar.AppendLine(" Facturas.Cod_Ven AS Cod_Ven, ") loComandoSeleccionar.AppendLine(" Vendedores.Nom_Ven AS Nom_Ven, ") loComandoSeleccionar.AppendLine(" Vendedores.Por_Ven AS Por_Ven, ") loComandoSeleccionar.AppendLine(" (Renglones_Facturas.Mon_Bru) AS Mon_Bru, ") loComandoSeleccionar.AppendLine(" (Renglones_Facturas.Mon_Net + Renglones_Facturas.Mon_Imp1) AS Mon_Net, ") loComandoSeleccionar.AppendLine(" (Renglones_Facturas.Can_Art1) AS Pares ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalComisiones1 ") loComandoSeleccionar.AppendLine(" FROM Facturas, ") loComandoSeleccionar.AppendLine(" Renglones_Facturas, ") loComandoSeleccionar.AppendLine(" Vendedores ") loComandoSeleccionar.AppendLine(" WHERE Facturas.Documento = Renglones_Facturas.Documento ") loComandoSeleccionar.AppendLine(" AND Facturas.Status <> 'Anulado' ") loComandoSeleccionar.AppendLine(" AND Facturas.Cod_Ven = Vendedores.Cod_Ven ") loComandoSeleccionar.AppendLine(" AND Facturas.Fec_Ini Between " & lcParametro0Desde) loComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta) loComandoSeleccionar.AppendLine(" SELECT Fec_Ini AS Fec_Ini, ") loComandoSeleccionar.AppendLine(" Fecha2 AS Fecha2, ") loComandoSeleccionar.AppendLine(" Cod_Ven AS Cod_Ven, ") loComandoSeleccionar.AppendLine(" Nom_Ven AS Nom_Ven, ") loComandoSeleccionar.AppendLine(" Por_Ven AS Por_Ven, ") loComandoSeleccionar.AppendLine(" COUNT(*) AS Cuantos, ") loComandoSeleccionar.AppendLine(" SUM(Mon_Bru) AS Mon_Bru, ") loComandoSeleccionar.AppendLine(" SUM(Mon_Net) AS Mon_Net, ") loComandoSeleccionar.AppendLine(" SUM(Mon_Bru * (Por_Ven / 100)) AS Mon_Com, ") loComandoSeleccionar.AppendLine(" SUM(Pares) AS Pares ") loComandoSeleccionar.AppendLine(" INTO #TablaTemporalComisiones2 ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalComisiones1 ") loComandoSeleccionar.AppendLine(" GROUP BY Fecha2, Fec_Ini, Cod_Ven, Nom_Ven, Por_Ven ") loComandoSeleccionar.AppendLine(" ORDER BY Fecha2, Cod_Ven, Nom_Ven, Por_Ven; ") '-------------------------------------------------------------------------------------------' ' Union de las tablas involucradas '-------------------------------------------------------------------------------------------' loComandoSeleccionar.AppendLine(" WITH curTemporal AS ( ") loComandoSeleccionar.AppendLine(" SELECT 1 AS Orden, ") loComandoSeleccionar.AppendLine(" 'RelCob' AS Tipo, ") loComandoSeleccionar.AppendLine(" Fec_Ini AS Fec_Ini,") loComandoSeleccionar.AppendLine(" Fecha2 AS Fecha2,") loComandoSeleccionar.AppendLine(" Tip_Ope AS Tip_Ope, ") loComandoSeleccionar.AppendLine(" Cuantas AS Cuantas, ") loComandoSeleccionar.AppendLine(" Monto AS Monto, ") loComandoSeleccionar.AppendLine(" CMon_Com AS CMon_Com, ") loComandoSeleccionar.AppendLine(" CMon_Ret AS CMon_Ret, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS Cod_Ven, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS Nom_Ven, ") loComandoSeleccionar.AppendLine(" 0.00 AS Por_Ven, ") loComandoSeleccionar.AppendLine(" 0.00 AS Cuantos, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS Pares, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS TDocumento, ") loComandoSeleccionar.AppendLine(" Fec_Ini AS TFec_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TCod_Ven, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TCod_Tar, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TNum_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS TPor_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS TPor_Ret, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Ret, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS TCod_Tip, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Fin, ") loComandoSeleccionar.AppendLine(" 0.00 AS ChMon_Net, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS ChDocumento, ") loComandoSeleccionar.AppendLine(" SPACE(20) AS ChNum_Doc, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS ChNom_Ban, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS DscDocumento, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscPor_Des, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Des, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenCan_Doc, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenTip_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruF, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruNC, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Fin ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalCobros1 ") loComandoSeleccionar.AppendLine(" UNION ALL ") loComandoSeleccionar.AppendLine(" SELECT 2 AS Orden, ") loComandoSeleccionar.AppendLine(" 'RelVen' AS Tipo, ") loComandoSeleccionar.AppendLine(" VenFecha1 AS Fec_Ini,") loComandoSeleccionar.AppendLine(" VenFecha2 AS Fecha2,") loComandoSeleccionar.AppendLine(" SPACE(10) AS Tip_Ope, ") loComandoSeleccionar.AppendLine(" 0.00 AS Cuantas, ") loComandoSeleccionar.AppendLine(" 0.00 AS Monto, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Ret, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS Cod_Ven, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS Nom_Ven, ") loComandoSeleccionar.AppendLine(" 0.00 AS Por_Ven, ") loComandoSeleccionar.AppendLine(" 0.00 AS Cuantos, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS Pares, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS TDocumento, ") loComandoSeleccionar.AppendLine(" VenFecha1 AS TFec_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TCod_Ven, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TCod_Tar, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TNum_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS TPor_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS TPor_Ret, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Ret, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS TCod_Tip, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Fin, ") loComandoSeleccionar.AppendLine(" 0.00 AS ChMon_Net, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS ChDocumento, ") loComandoSeleccionar.AppendLine(" SPACE(20) AS ChNum_Doc, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS ChNom_Ban, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS DscDocumento, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscPor_Des, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Des, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Net, ") loComandoSeleccionar.AppendLine(" VenCan_Doc AS VenCan_Doc, ") loComandoSeleccionar.AppendLine(" VenTip_Doc AS VenTip_Doc, ") loComandoSeleccionar.AppendLine(" VenMon_Bru AS VenMon_Bru, ") loComandoSeleccionar.AppendLine(" VenMon_BruF AS VenMon_BruF, ") loComandoSeleccionar.AppendLine(" VenMon_BruNC AS VenMon_BruNC, ") loComandoSeleccionar.AppendLine(" VenDoc_Ini AS VenDoc_Ini, ") loComandoSeleccionar.AppendLine(" VenDoc_Fin AS VenDoc_Fin ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalVentas1 ") loComandoSeleccionar.AppendLine(" UNION ALL ") loComandoSeleccionar.AppendLine(" SELECT 3 AS Orden, ") loComandoSeleccionar.AppendLine(" 'RelDes' AS Tipo, ") loComandoSeleccionar.AppendLine(" DscFec_Ini AS Fec_Ini,") loComandoSeleccionar.AppendLine(" DscFecha2 AS Fecha2,") loComandoSeleccionar.AppendLine(" SPACE(10) AS Tip_Ope, ") loComandoSeleccionar.AppendLine(" 0.00 AS Cuantas, ") loComandoSeleccionar.AppendLine(" 0.00 AS Monto, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Ret, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS Cod_Ven, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS Nom_Ven, ") loComandoSeleccionar.AppendLine(" 0.00 AS Por_Ven, ") loComandoSeleccionar.AppendLine(" 0.00 AS Cuantos, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS Pares, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS TDocumento, ") loComandoSeleccionar.AppendLine(" DscFec_Ini AS TFec_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TCod_Ven, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TCod_Tar, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TNum_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS TPor_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS TPor_Ret, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Ret, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS TCod_Tip, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Fin, ") loComandoSeleccionar.AppendLine(" 0.00 AS ChMon_Net, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS ChDocumento, ") loComandoSeleccionar.AppendLine(" SPACE(20) AS ChNum_Doc, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS ChNom_Ban, ") loComandoSeleccionar.AppendLine(" DscDocumento AS DscDocumento, ") loComandoSeleccionar.AppendLine(" DscPor_Des AS DscPor_Des, ") loComandoSeleccionar.AppendLine(" DscMon_Des AS DscMon_Des, ") loComandoSeleccionar.AppendLine(" DscMon_Bru AS DscMon_Bru, ") loComandoSeleccionar.AppendLine(" DscMon_Net AS DscMon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenCan_Doc, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenTip_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruF, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruNC, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Fin ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalDescuentos1 ") loComandoSeleccionar.AppendLine(" UNION ALL ") loComandoSeleccionar.AppendLine(" SELECT 4 AS Orden, ") loComandoSeleccionar.AppendLine(" 'RelChe' AS Tipo, ") loComandoSeleccionar.AppendLine(" ChFec_Ini AS Fec_Ini,") loComandoSeleccionar.AppendLine(" ChFecha2 AS Fecha2,") loComandoSeleccionar.AppendLine(" SPACE(10) AS Tip_Ope, ") loComandoSeleccionar.AppendLine(" 0.00 AS Cuantas, ") loComandoSeleccionar.AppendLine(" 0.00 AS Monto, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Ret, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS Cod_Ven, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS Nom_Ven, ") loComandoSeleccionar.AppendLine(" 0.00 AS Por_Ven, ") loComandoSeleccionar.AppendLine(" 0.00 AS Cuantos, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS Pares, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS TDocumento, ") loComandoSeleccionar.AppendLine(" ChFec_Ini AS TFec_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TCod_Ven, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TCod_Tar, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TNum_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS TPor_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS TPor_Ret, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Ret, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS TCod_Tip, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Fin, ") loComandoSeleccionar.AppendLine(" ChMon_Net AS ChMon_Net, ") loComandoSeleccionar.AppendLine(" ChDocumento AS ChDocumento, ") loComandoSeleccionar.AppendLine(" ChNum_Doc AS ChNum_Doc, ") loComandoSeleccionar.AppendLine(" ChNom_Ban AS ChNom_Ban, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS DscDocumento, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscPor_Des, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Des, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenCan_Doc, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenTip_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruF, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruNC, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Fin ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalCheques1 ") loComandoSeleccionar.AppendLine(" UNION ALL ") loComandoSeleccionar.AppendLine(" SELECT 5 AS Orden, ") loComandoSeleccionar.AppendLine(" 'RelTar' AS Tipo, ") loComandoSeleccionar.AppendLine(" TFec_Ini AS Fec_Ini, ") loComandoSeleccionar.AppendLine(" TFecha2 AS Fecha2,") loComandoSeleccionar.AppendLine(" SPACE(20) AS Tip_Ope, ") loComandoSeleccionar.AppendLine(" 0.00 AS Cuantas, ") loComandoSeleccionar.AppendLine(" 0.00 AS Monto, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Ret, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS Cod_Ven, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS Nom_Ven, ") loComandoSeleccionar.AppendLine(" 0.00 AS Por_Ven, ") loComandoSeleccionar.AppendLine(" 0.00 AS Cuantos, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS Mon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS Pares, ") loComandoSeleccionar.AppendLine(" TDocumento AS TDocumento, ") loComandoSeleccionar.AppendLine(" TFec_Ini AS TFec_Ini, ") loComandoSeleccionar.AppendLine(" TCod_Ven AS TCod_Ven, ") loComandoSeleccionar.AppendLine(" TCod_Tar AS TCod_Tar, ") loComandoSeleccionar.AppendLine(" TNum_Doc AS TNum_Doc, ") loComandoSeleccionar.AppendLine(" TMon_Net AS TMon_Net, ") loComandoSeleccionar.AppendLine(" TPor_Com AS TPor_Com, ") loComandoSeleccionar.AppendLine(" TMon_Com AS TMon_Com, ") loComandoSeleccionar.AppendLine(" TPor_Ret AS TPor_Ret, ") loComandoSeleccionar.AppendLine(" TMon_Ret AS TMon_Ret, ") loComandoSeleccionar.AppendLine(" TCod_Tip AS TCod_Tip, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Fin, ") loComandoSeleccionar.AppendLine(" 0.00 AS ChMon_Net, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS ChDocumento, ") loComandoSeleccionar.AppendLine(" SPACE(20) AS ChNum_Doc, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS ChNom_Ban, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS DscDocumento, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscPor_Des, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Des, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenCan_Doc, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenTip_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruF, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruNC, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Fin ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalTarjetas1 ") loComandoSeleccionar.AppendLine(" UNION ALL ") loComandoSeleccionar.AppendLine(" SELECT 6 AS Orden,") loComandoSeleccionar.AppendLine(" 'RelCom' AS Tipo,") loComandoSeleccionar.AppendLine(" Fec_Ini AS Fec_Ini, ") loComandoSeleccionar.AppendLine(" Fecha2 AS Fecha2,") loComandoSeleccionar.AppendLine(" SPACE(20) AS Tip_Ope, ") loComandoSeleccionar.AppendLine(" 0.00 AS Cuantas, ") loComandoSeleccionar.AppendLine(" 0.00 AS Monto, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS CMon_Ret, ") loComandoSeleccionar.AppendLine(" Cod_Ven AS Cod_Ven, ") loComandoSeleccionar.AppendLine(" Nom_Ven AS Nom_Ven, ") loComandoSeleccionar.AppendLine(" Por_Ven AS Por_Ven, ") loComandoSeleccionar.AppendLine(" Cuantos AS Cuantos, ") loComandoSeleccionar.AppendLine(" Mon_Bru AS Mon_Bru, ") loComandoSeleccionar.AppendLine(" Mon_Net AS Mon_Net, ") loComandoSeleccionar.AppendLine(" Mon_Com AS Mon_Com, ") loComandoSeleccionar.AppendLine(" Pares AS Pares, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS TDocumento, ") loComandoSeleccionar.AppendLine(" Fec_Ini AS TFec_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TCod_Ven, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TCod_Tar, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS TNum_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS TPor_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Com, ") loComandoSeleccionar.AppendLine(" 0.00 AS TPor_Ret, ") loComandoSeleccionar.AppendLine(" 0.00 AS TMon_Ret, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS TCod_Tip, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS Doc_Fin, ") loComandoSeleccionar.AppendLine(" 0.00 AS ChMon_Net, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS ChDocumento, ") loComandoSeleccionar.AppendLine(" SPACE(20) AS ChNum_Doc, ") loComandoSeleccionar.AppendLine(" SPACE(30) AS ChNom_Ban, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS DscDocumento, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscPor_Des, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Des, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS DscMon_Net, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenCan_Doc, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenTip_Doc, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_Bru, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruF, ") loComandoSeleccionar.AppendLine(" 0.00 AS VenMon_BruNC, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Ini, ") loComandoSeleccionar.AppendLine(" SPACE(10) AS VenDoc_Fin ") loComandoSeleccionar.AppendLine(" FROM #TablaTemporalComisiones2 ") loComandoSeleccionar.AppendLine(" ) ") loComandoSeleccionar.AppendLine(" SELECT Orden, ") loComandoSeleccionar.AppendLine(" Tipo, ") loComandoSeleccionar.AppendLine(" Fec_Ini,") loComandoSeleccionar.AppendLine(" Tip_Ope, ") loComandoSeleccionar.AppendLine(" Cuantas, ") loComandoSeleccionar.AppendLine(" Monto, ") loComandoSeleccionar.AppendLine(" CMon_Com, ") loComandoSeleccionar.AppendLine(" CMon_Ret, ") loComandoSeleccionar.AppendLine(" Cod_Ven, ") loComandoSeleccionar.AppendLine(" Nom_Ven, ") loComandoSeleccionar.AppendLine(" Por_Ven, ") loComandoSeleccionar.AppendLine(" Cuantos, ") loComandoSeleccionar.AppendLine(" Mon_Bru, ") loComandoSeleccionar.AppendLine(" Mon_Net, ") loComandoSeleccionar.AppendLine(" Mon_Com, ") loComandoSeleccionar.AppendLine(" Pares, ") loComandoSeleccionar.AppendLine(" TDocumento, ") loComandoSeleccionar.AppendLine(" TFec_Ini, ") loComandoSeleccionar.AppendLine(" TCod_Ven, ") loComandoSeleccionar.AppendLine(" TCod_Tar, ") loComandoSeleccionar.AppendLine(" TNum_Doc, ") loComandoSeleccionar.AppendLine(" TMon_Net, ") loComandoSeleccionar.AppendLine(" TPor_Com, ") loComandoSeleccionar.AppendLine(" TMon_Com, ") loComandoSeleccionar.AppendLine(" TPor_Ret, ") loComandoSeleccionar.AppendLine(" TMon_Ret, ") loComandoSeleccionar.AppendLine(" TCod_Tip, ") loComandoSeleccionar.AppendLine(" Doc_Ini, ") loComandoSeleccionar.AppendLine(" Doc_Fin, ") loComandoSeleccionar.AppendLine(" ChMon_Net, ") loComandoSeleccionar.AppendLine(" ChDocumento, ") loComandoSeleccionar.AppendLine(" ChNum_Doc, ") loComandoSeleccionar.AppendLine(" ChNom_Ban, ") loComandoSeleccionar.AppendLine(" DscDocumento, ") loComandoSeleccionar.AppendLine(" DscPor_Des, ") loComandoSeleccionar.AppendLine(" DscMon_Des, ") loComandoSeleccionar.AppendLine(" DscMon_Bru, ") loComandoSeleccionar.AppendLine(" DscMon_Net, ") loComandoSeleccionar.AppendLine(" VenCan_Doc, ") loComandoSeleccionar.AppendLine(" VenTip_Doc, ") loComandoSeleccionar.AppendLine(" VenMon_Bru, ") loComandoSeleccionar.AppendLine(" VenMon_BruF, ") loComandoSeleccionar.AppendLine(" VenMon_BruNC, ") loComandoSeleccionar.AppendLine(" VenDoc_Ini, ") loComandoSeleccionar.AppendLine(" VenDoc_Fin ") loComandoSeleccionar.AppendLine(" FROM curTemporal ") 'loComandoSeleccionar.AppendLine(" ORDER BY Fecha2 ASC, Orden ") loComandoSeleccionar.AppendLine("ORDER BY " & lcOrdenamiento & ", Orden") Dim loServicios As New cusDatos.goDatos Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loComandoSeleccionar.ToString, "curReportes") '------------------------------------------------------------------------------------------------------- ' Verificando si el select (tabla nº0) trae registros '------------------------------------------------------------------------------------------------------- If (laDatosReporte.Tables(0).Rows.Count <= 0) Then Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Información", _ "No se Encontraron Registros para los Parámetros Especificados. ", _ vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Informacion, _ "350px", _ "200px") End If loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("rRVentas_CBancarias", laDatosReporte) Me.mTraducirReporte(loObjetoReporte) Me.mFormatearCamposReporte(loObjetoReporte) Me.crvrRVentas_CBancarias.ReportSource = loObjetoReporte Catch loExcepcion As Exception Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _ "No se pudo Completar el Proceso: " & loExcepcion.Message, _ vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _ "auto", _ "auto") End Try End Sub Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload Try loObjetoReporte.Close() Catch loExcepcion As Exception End Try End Sub End Class '-------------------------------------------------------------------------------------------' ' Fin del codigo '-------------------------------------------------------------------------------------------' ' JJD: 29/07/08: Codigo inicial '-------------------------------------------------------------------------------------------' ' JJD: 30/07/08: Ajustes a los campos que se traia el reporte '-------------------------------------------------------------------------------------------' ' JJD: 10/10/08: Adecuacion segun los parametros del reporte original '-------------------------------------------------------------------------------------------' ' JJD: 11/10/08: Continuacion de la adecuacion segun los parametros del reporte original '-------------------------------------------------------------------------------------------' ' JJD: 13/10/08: Continuacion de la adecuacion segun los parametros del reporte original '-------------------------------------------------------------------------------------------' ' JJD: 25/10/08: Ajustes a la busqueda de los cheques y las tarjetas '-------------------------------------------------------------------------------------------' ' CMS: 14/08/09: Metodo de ordenamiento, verificacionde registros '-------------------------------------------------------------------------------------------'
kodeitsolutions/ef-reports
rRVentas_CBancarias.aspx.vb
Visual Basic
mit
51,847
[ 30522, 1005, 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, 1011, 1011, 1011, 1011, 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...
# -*- coding: utf-8 -*- import random from operator import attrgetter import pytest from cfme import test_requirements from cfme.cloud.provider import CloudProvider from cfme.cloud.provider.azure import AzureProvider from cfme.cloud.provider.ec2 import EC2Provider from cfme.cloud.provider.gce import GCEProvider from cfme.cloud.provider.openstack import OpenStackProvider from cfme.common.provider import BaseProvider from cfme.infrastructure.provider.rhevm import RHEVMProvider from cfme.infrastructure.provider.virtualcenter import VMwareProvider from cfme.utils import conf from cfme.utils.blockers import BZ from cfme.utils.log import logger from cfme.utils.wait import wait_for from cfme.fixtures.provider import setup_or_skip pytestmark = [ pytest.mark.tier(1), test_requirements.c_and_u, pytest.mark.provider( [VMwareProvider, RHEVMProvider, EC2Provider, OpenStackProvider, AzureProvider, GCEProvider], required_fields=[(['cap_and_util', 'capandu_vm'], 'cu-24x7')], scope="module") ] @pytest.fixture(scope="module") def clean_setup_provider(request, provider): BaseProvider.clear_providers() setup_or_skip(request, provider) yield BaseProvider.clear_providers() def vm_count(appliance, metrics_tbl, mgmt_system_id): return bool(appliance.db.client.session.query(metrics_tbl).filter( metrics_tbl.parent_ems_id == mgmt_system_id).filter( metrics_tbl.resource_type == "VmOrTemplate").count() ) def host_count(appliance, metrics_tbl, mgmt_system_id): return bool(appliance.db.client.session.query(metrics_tbl).filter( metrics_tbl.parent_ems_id == mgmt_system_id).filter( metrics_tbl.resource_type == "Host").count() ) @pytest.fixture(scope="module") def metrics_collection(appliance, clean_setup_provider, provider, enable_candu): """Check the db is gathering collection data for the given provider. Metadata: test_flag: metrics_collection """ metrics_tbl = appliance.db.client['metrics'] mgmt_systems_tbl = appliance.db.client['ext_management_systems'] logger.info("Fetching provider ID for %s", provider.key) mgmt_system_id = appliance.db.client.session.query(mgmt_systems_tbl).filter( mgmt_systems_tbl.name == conf.cfme_data.get('management_systems', {})[provider.key]['name'] ).first().id logger.info("ID fetched; testing metrics collection now") # vms for both infa and cloud provider wait_for( vm_count, [appliance, metrics_tbl, mgmt_system_id], delay=20, timeout=1500, fail_condition=False, message="wait for VMs") # host only for infa if provider.category == "infra": wait_for( vm_count, [appliance, metrics_tbl, mgmt_system_id], delay=20, timeout=1500, fail_condition=False, message="wait for hosts.") def get_host_name(provider): cfme_host = random.choice(provider.data["hosts"]) return cfme_host.name def query_metric_db(appliance, provider, metric, vm_name=None, host_name=None): metrics_tbl = appliance.db.client['metrics'] ems = appliance.db.client['ext_management_systems'] if vm_name is None: if host_name is not None: object_name = host_name elif vm_name is not None: object_name = vm_name with appliance.db.client.transaction: provs = ( appliance.db.client.session.query(metrics_tbl.id) .join(ems, metrics_tbl.parent_ems_id == ems.id) .filter(metrics_tbl.resource_name == object_name, ems.name == provider.name) ) return appliance.db.client.session.query(metrics_tbl).filter( metrics_tbl.id.in_(provs.subquery())) @pytest.mark.rhv2 # Tests to check that specific metrics are being collected @pytest.mark.meta( blockers=[BZ(1511099, forced_streams=["5.8", "upstream"], unblock=lambda provider: not provider.one_of(GCEProvider))] ) def test_raw_metric_vm_cpu(metrics_collection, appliance, provider): vm_name = provider.data['cap_and_util']['capandu_vm'] if provider.category == "infra": query = query_metric_db(appliance, provider, 'cpu_usagemhz_rate_average', vm_name) average_rate = attrgetter('cpu_usagemhz_rate_average') elif provider.category == "cloud": query = query_metric_db(appliance, provider, 'cpu_usage_rate_average', vm_name) average_rate = attrgetter('cpu_usage_rate_average') for record in query: if average_rate(record) is not None: assert average_rate(record) > 0, 'Zero VM CPU Usage' break @pytest.mark.rhv2 @pytest.mark.uncollectif( lambda provider: provider.one_of(EC2Provider) or provider.one_of(GCEProvider)) def test_raw_metric_vm_memory(metrics_collection, appliance, provider): vm_name = provider.data['cap_and_util']['capandu_vm'] if provider.type == 'azure': query = query_metric_db(appliance, provider, 'mem_usage_absolute_average', vm_name) average_rate = attrgetter('mem_usage_absolute_average') else: query = query_metric_db(appliance, provider, 'derived_memory_used', vm_name) average_rate = attrgetter('derived_memory_used') for record in query: if average_rate(record) is not None: assert average_rate(record) > 0, 'Zero VM Memory Usage' break @pytest.mark.rhv2 @pytest.mark.meta( blockers=[BZ(1408963, forced_streams=["5.8", "upstream"], unblock=lambda provider: not provider.one_of(RHEVMProvider))] ) @pytest.mark.meta( blockers=[BZ(1511099, forced_streams=["5.8", "upstream"], unblock=lambda provider: not provider.one_of(GCEProvider))] ) def test_raw_metric_vm_network(metrics_collection, appliance, provider): vm_name = provider.data['cap_and_util']['capandu_vm'] query = query_metric_db(appliance, provider, 'net_usage_rate_average', vm_name) for record in query: if record.net_usage_rate_average is not None: assert record.net_usage_rate_average > 0, 'Zero VM Network IO' break @pytest.mark.rhv2 @pytest.mark.uncollectif( lambda provider: provider.one_of(EC2Provider)) @pytest.mark.meta( blockers=[BZ(1511099, forced_streams=["5.8", "upstream"], unblock=lambda provider: not provider.one_of(GCEProvider))] ) def test_raw_metric_vm_disk(metrics_collection, appliance, provider): vm_name = provider.data['cap_and_util']['capandu_vm'] query = query_metric_db(appliance, provider, 'disk_usage_rate_average', vm_name) for record in query: if record.disk_usage_rate_average is not None: assert record.disk_usage_rate_average > 0, 'Zero VM Disk IO' break @pytest.mark.rhv2 @pytest.mark.uncollectif( lambda provider: provider.one_of(CloudProvider)) def test_raw_metric_host_cpu(metrics_collection, appliance, provider): host_name = get_host_name(provider) query = query_metric_db(appliance, provider, 'cpu_usagemhz_rate_average', host_name) for record in query: if record.cpu_usagemhz_rate_average is not None: assert record.cpu_usagemhz_rate_average > 0, 'Zero Host CPU Usage' break @pytest.mark.rhv2 @pytest.mark.uncollectif( lambda provider: provider.one_of(CloudProvider)) def test_raw_metric_host_memory(metrics_collection, appliance, provider): host_name = get_host_name(provider) query = query_metric_db(appliance, provider, 'derived_memory_used', host_name) for record in query: if record.derived_memory_used is not None: assert record.derived_memory_used > 0, 'Zero Host Memory Usage' break @pytest.mark.rhv2 @pytest.mark.uncollectif( lambda provider: provider.one_of(CloudProvider)) def test_raw_metric_host_network(metrics_collection, appliance, provider): host_name = get_host_name(provider) query = query_metric_db(appliance, provider, 'net_usage_rate_average', host_name) for record in query: if record.net_usage_rate_average is not None: assert record.net_usage_rate_average > 0, 'Zero Host Network IO' break @pytest.mark.rhv2 @pytest.mark.uncollectif( lambda provider: provider.one_of(CloudProvider)) @pytest.mark.meta( blockers=[BZ(1424589, forced_streams=["5.8", "5.9", "upstream"], unblock=lambda provider: not provider.one_of(RHEVMProvider))] ) def test_raw_metric_host_disk(metrics_collection, appliance, provider): host_name = get_host_name(provider) query = query_metric_db(appliance, provider, 'disk_usage_rate_average', host_name) for record in query: if record.disk_usage_rate_average is not None: assert record.disk_usage_rate_average > 0, 'Zero Host Disk IO' break
anurag03/integration_tests
cfme/tests/candu/test_utilization_metrics.py
Python
gpl-2.0
8,879
[ 30522, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 1011, 1022, 1011, 1008, 1011, 12324, 6721, 2013, 6872, 12324, 2012, 16344, 18150, 3334, 12324, 1052, 17250, 3367, 2013, 12935, 4168, 12324, 3231, 1035, 5918, 2013, 12935, 4168, 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...
<?php namespace oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2; /** * @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 * @xmlType PreviousVersionIDType * @xmlName PreviousVersionID * @var oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2\PreviousVersionID */ class PreviousVersionID extends PreviousVersionIDType { } // end class PreviousVersionID
emoxie/quickbooks-sdk
src/Dependencies/XSD2PHP/test/data/expected/ubl2.0/oasis/names/specification/ubl/schema/xsd/CommonBasicComponents_2/PreviousVersionID.php
PHP
mit
426
[ 30522, 1026, 1029, 25718, 3415, 15327, 18128, 1032, 3415, 1032, 12827, 1032, 1057, 16558, 1032, 8040, 28433, 1032, 1060, 16150, 1032, 2691, 22083, 2594, 9006, 29513, 7666, 1035, 1016, 1025, 1013, 1008, 1008, 1008, 1030, 20950, 18442, 23058, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 2009 Regents of the University of Minnesota. All rights * reserved. * Copyright 2009 Mayo Foundation for Medical Education and Research. * All rights reserved. * * This program is made available under the terms of the Eclipse * Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * 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 INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A * PARTICULAR PURPOSE. See the License for the specific language * governing permissions and limitations under the License. * * Contributors: * Minnesota Supercomputing Institute - initial API and implementation ******************************************************************************/ package edu.umn.msi.tropix.storage.core; import java.io.InputStream; import java.io.OutputStream; import java.util.List; import edu.umn.msi.tropix.common.io.HasStreamInputContext; public interface StorageManager { static interface UploadCallback { void onUpload(InputStream inputStream); } static class FileMetadata { private final long dateModified; private final long length; public FileMetadata(final long dateModified, final long length) { this.dateModified = dateModified; this.length = length; } public long getDateModified() { return dateModified; } public long getLength() { return length; } } @Deprecated long getDateModified(final String id, final String gridId); boolean setDateModified(final String id, final String gridId, final long dataModified); @Deprecated long getLength(final String id, final String gridId); FileMetadata getFileMetadata(final String id, final String gridId); List<FileMetadata> getFileMetadata(final List<String> ids, final String gridId); HasStreamInputContext download(String id, String gridId); // Allow batch pre-checking to avoid extra database hits HasStreamInputContext download(final String id, final String gridId, final boolean checkAccess); UploadCallback upload(String id, String gridId); OutputStream prepareUploadStream(final String id, final String gridId); boolean delete(String id, String gridId); boolean exists(String id); boolean canDelete(String id, String callerIdentity); boolean canDownload(String id, String callerIdentity); boolean canUpload(String id, String callerIdentity); }
jmchilton/TINT
projects/TropixStorageCore/src/api/edu/umn/msi/tropix/storage/core/StorageManager.java
Java
epl-1.0
2,764
[ 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...
// // Copyright (c) 1990-2011, Scientific Toolworks, Inc. // // The License.txt file describes the conditions under which this software may be distributed. // // Author: Jason Haslam // // Additions Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware // Scintilla platform layer for Qt #ifndef PLATQT_H #define PLATQT_H #include "Platform.h" #include <QPaintDevice> #include <QPainter> #include <QHash> #ifdef SCI_NAMESPACE namespace Scintilla { #endif const char *CharacterSetID(int characterSet); inline QColor QColorFromCA(ColourDesired ca) { long c = ca.AsLong(); return QColor(c & 0xff, (c >> 8) & 0xff, (c >> 16) & 0xff); } inline QRect QRectFromPRect(PRectangle pr) { return QRect(pr.left, pr.top, pr.Width(), pr.Height()); } inline PRectangle PRectFromQRect(QRect qr) { return PRectangle(qr.x(), qr.y(), qr.x() + qr.width(), qr.y() + qr.height()); } inline Point PointFromQPoint(QPoint qp) { return Point(qp.x(), qp.y()); } class SurfaceImpl : public Surface { private: QPaintDevice *device; QPainter *painter; bool deviceOwned; bool painterOwned; float x, y; bool unicodeMode; int codePage; const char *codecName; QTextCodec *codec; public: SurfaceImpl(); virtual ~SurfaceImpl(); virtual void Init(WindowID wid); virtual void Init(SurfaceID sid, WindowID wid); virtual void InitPixMap(int width, int height, Surface *surface, WindowID wid); virtual void Release(); virtual bool Initialised(); virtual void PenColour(ColourDesired fore); virtual int LogPixelsY(); virtual int DeviceHeightFont(int points); virtual void MoveTo(int x, int y); virtual void LineTo(int x, int y); virtual void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back); virtual void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back); virtual void FillRectangle(PRectangle rc, ColourDesired back); virtual void FillRectangle(PRectangle rc, Surface &surfacePattern); virtual void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back); virtual void AlphaRectangle(PRectangle rc, int corner, ColourDesired fill, int alphaFill, ColourDesired outline, int alphaOutline, int flags); virtual void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage); virtual void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back); virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource); virtual void DrawTextNoClip(PRectangle rc, Font &font, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back); virtual void DrawTextClipped(PRectangle rc, Font &font, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back); virtual void DrawTextTransparent(PRectangle rc, Font &font, XYPOSITION ybase, const char *s, int len, ColourDesired fore); virtual void MeasureWidths(Font &font, const char *s, int len, XYPOSITION *positions); virtual XYPOSITION WidthText(Font &font, const char *s, int len); virtual XYPOSITION WidthChar(Font &font, char ch); virtual XYPOSITION Ascent(Font &font); virtual XYPOSITION Descent(Font &font); virtual XYPOSITION InternalLeading(Font &font); virtual XYPOSITION ExternalLeading(Font &font); virtual XYPOSITION Height(Font &font); virtual XYPOSITION AverageCharWidth(Font &font); virtual void SetClip(PRectangle rc); virtual void FlushCachedState(); virtual void SetUnicodeMode(bool unicodeMode); virtual void SetDBCSMode(int codePage); void BrushColour(ColourDesired back); void SetCodec(Font &font); void SetFont(Font &font); QPaintDevice *GetPaintDevice(); void SetPainter(QPainter *painter); QPainter *GetPainter(); }; #ifdef SCI_NAMESPACE } #endif #endif
sdottaka/mruby-bin-scite-mruby
tools/scintilla/qt/ScintillaEditBase/PlatQt.h
C
mit
3,724
[ 30522, 1013, 1013, 1013, 1013, 9385, 1006, 1039, 1007, 2901, 1011, 2249, 1010, 4045, 6994, 9316, 1010, 4297, 1012, 1013, 1013, 1013, 1013, 1996, 6105, 1012, 19067, 2102, 5371, 5577, 1996, 3785, 2104, 2029, 2023, 4007, 2089, 2022, 5500, 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...
// +build matcha package bridge // Go support functions for Objective-C. Note that this // file is copied into and compiled with the generated // bindings. /* #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include "go-foreign.h" */ import "C" import ( "bytes" "encoding/binary" "fmt" "math" "reflect" "runtime" "runtime/debug" "time" ) //export matchaTestFunc func matchaTestFunc() { count := C.MatchaForeignTrackerCount() for i := 0; i < 1000; i++ { z := Nil() a := Bool(true) b := Int64(1234) c := Float64(1.234) d := String("abc") e := Bytes([]byte("def123")) f := Interface(123 + 234i) if !z.IsNil() || a.ToBool() != true || b.ToInt64() != 1234 || c.ToFloat64() != 1.234 || d.ToString() != "abc" || !bytes.Equal(e.ToBytes(), []byte("def123")) || f.ToInterface() != 123+234i { panic("Primitive mismatch") } arr := Array(z, a, b, c, d, e, f) arr2 := arr.ToArray() z = arr2[0] a = arr2[1] b = arr2[2] c = arr2[3] d = arr2[4] e = arr2[5] f = arr2[6] if !z.IsNil() || a.ToBool() != true || b.ToInt64() != 1234 || c.ToFloat64() != 1.234 || d.ToString() != "abc" || !bytes.Equal(e.ToBytes(), []byte("def123")) || f.ToInterface() != 123+234i { panic("Array mismatch") } runtime.GC() } // bridge := Bridge("a") // fmt.Println("matchaTestFunc() - Bridge:", bridge) debug.FreeOSMemory() time.Sleep(time.Second) newCount := C.MatchaForeignTrackerCount() fmt.Println("count", count, newCount) if math.Abs(float64(count-newCount)) > 1 { // Allow some leeway cause finalizer acts weirdly... panic("Count mismatch") } } var bridgeCache = map[string]*Value{} var untrackChan = make(chan int64, 20) func init() { go func() { runtime.LockOSThread() for i := range untrackChan { C.MatchaForeignUntrack(C.FgnRef(i)) } runtime.UnlockOSThread() }() } type Value struct { ref int64 } func newValue(ref C.FgnRef) *Value { v := &Value{ref: int64(ref)} runtime.SetFinalizer(v, func(a *Value) { untrackChan <- a.ref }) return v } func (v *Value) _ref() C.FgnRef { return C.FgnRef(v.ref) } func Bridge(a string) *Value { if b, ok := bridgeCache[a]; ok { return b } cstr := cString(a) b := newValue(C.MatchaForeignBridge(cstr)) bridgeCache[a] = b return b } func Nil() *Value { return newValue(C.MatchaForeignNil()) } func (v *Value) IsNil() bool { defer runtime.KeepAlive(v) return bool(C.MatchaForeignIsNil(v._ref())) } func Bool(v bool) *Value { return newValue(C.MatchaForeignBool(C.bool(v))) } func (v *Value) ToBool() bool { defer runtime.KeepAlive(v) return bool(C.MatchaForeignToBool(v._ref())) } func Int64(v int64) *Value { return newValue(C.MatchaForeignInt64(C.int64_t(v))) } func (v *Value) ToInt64() int64 { defer runtime.KeepAlive(v) return int64(C.MatchaForeignToInt64(v._ref())) } func Float64(v float64) *Value { return newValue(C.MatchaForeignFloat64(C.double(v))) } func (v *Value) ToFloat64() float64 { defer runtime.KeepAlive(v) return float64(C.MatchaForeignToFloat64(v._ref())) } func String(v string) *Value { cstr := cString(v) return newValue(C.MatchaForeignString(cstr)) } func (v *Value) ToString() string { defer runtime.KeepAlive(v) buf := C.MatchaForeignToString(v._ref()) return goString(buf) } func Bytes(v []byte) *Value { cbytes := cBytes(v) return newValue(C.MatchaForeignBytes(cbytes)) } func (v *Value) ToBytes() []byte { defer runtime.KeepAlive(v) buf := C.MatchaForeignToBytes(v._ref()) return goBytes(buf) } func Interface(v interface{}) *Value { // Start with a go value. // Reflect on it. rv := reflect.ValueOf(v) // Track it, turning it into a goref. ref := matchaGoTrack(rv) // Wrap the goref in an foreign object, returning a foreign ref. return newValue(C.MatchaForeignGoRef(ref)) } func (v *Value) ToInterface() interface{} { defer runtime.KeepAlive(v) // Start with a foreign ref, referring to a foreign value wrapping a go ref. // Get the goref. ref := C.MatchaForeignToGoRef(v._ref()) // Get the go object, and unreflect. return matchaGoGet(ref).Interface() } func Array(a ...*Value) *Value { defer runtime.KeepAlive(a) ref := C.MatchaForeignArray(cArray2(a)) return newValue(ref) } func (v *Value) ToArray() []*Value { // TODO(KD): Untested.... defer runtime.KeepAlive(v) buf := C.MatchaForeignToArray(v._ref()) return goArray2(buf) } // Call accepts `nil` in its variadic arguments func (v *Value) Call(s string, args ...*Value) *Value { defer runtime.KeepAlive(v) defer runtime.KeepAlive(args) return newValue(C.MatchaForeignCall(v._ref(), cString(s), cArray2(args))) } func cArray(v []reflect.Value) C.CGoBuffer { var cstr C.CGoBuffer if len(v) == 0 { cstr = C.CGoBuffer{} } else { buf := new(bytes.Buffer) for _, i := range v { goref := matchaGoTrack(i) err := binary.Write(buf, binary.LittleEndian, goref) if err != nil { fmt.Println("binary.Write failed:", err) } } cstr = C.CGoBuffer{ ptr: C.CBytes(buf.Bytes()), len: C.int64_t(len(buf.Bytes())), } } return cstr } func cArray2(v []*Value) C.CGoBuffer { var cstr C.CGoBuffer if len(v) == 0 { cstr = C.CGoBuffer{} } else { buf := new(bytes.Buffer) for _, i := range v { foreignRef := i._ref() err := binary.Write(buf, binary.LittleEndian, foreignRef) if err != nil { fmt.Println("binary.Write failed:", err) } } cstr = C.CGoBuffer{ ptr: C.CBytes(buf.Bytes()), len: C.int64_t(len(buf.Bytes())), } } return cstr } func cBytes(v []byte) C.CGoBuffer { var cstr C.CGoBuffer if len(v) == 0 { cstr = C.CGoBuffer{} } else { cstr = C.CGoBuffer{ ptr: C.CBytes(v), len: C.int64_t(len(v)), } } return cstr } func cString(v string) C.CGoBuffer { var cstr C.CGoBuffer if len(v) == 0 { cstr = C.CGoBuffer{} } else { cstr = C.CGoBuffer{ ptr: C.CBytes([]byte(v)), len: C.int64_t(len(v)), } } return cstr } func goArray(buf C.CGoBuffer) []reflect.Value { defer C.free(buf.ptr) gorefs := make([]int64, buf.len/8) err := binary.Read(bytes.NewBuffer(C.GoBytes(buf.ptr, C.int(buf.len))), binary.LittleEndian, gorefs) if err != nil { panic(err) } rvs := []reflect.Value{} for _, i := range gorefs { rv := matchaGoGet(C.GoRef(i)) rvs = append(rvs, rv) } return rvs } func goArray2(buf C.CGoBuffer) []*Value { defer C.free(buf.ptr) fgnRef := make([]int64, buf.len/8) err := binary.Read(bytes.NewBuffer(C.GoBytes(buf.ptr, C.int(buf.len))), binary.LittleEndian, fgnRef) if err != nil { panic(err) } rvs := []*Value{} for _, i := range fgnRef { rv := newValue(C.FgnRef(i)) rvs = append(rvs, rv) } return rvs } func goString(buf C.CGoBuffer) string { defer C.free(buf.ptr) str := C.GoBytes(buf.ptr, C.int(buf.len)) return string(str) } func goBytes(buf C.CGoBuffer) []byte { defer C.free(buf.ptr) return C.GoBytes(buf.ptr, C.int(buf.len)) }
gomatcha/matcha
bridge/go-foreign.go
GO
apache-2.0
6,886
[ 30522, 1013, 1013, 1009, 3857, 2674, 2050, 7427, 2958, 1013, 1013, 2175, 2490, 4972, 2005, 7863, 1011, 1039, 1012, 3602, 2008, 2023, 1013, 1013, 5371, 2003, 15826, 2046, 1998, 9227, 2007, 1996, 7013, 1013, 1013, 8031, 2015, 1012, 1013, 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...
#include<unistd.h> #include<sys/types.h> #include<stdlib.h> #include<string.h> #include<limits.h> #include<string> using namespace std; class CXSPLog { }
dx01259/libxsp
log/src/XSPLog.h
C
gpl-3.0
172
[ 30522, 1001, 2421, 1026, 4895, 2923, 2094, 1012, 1044, 1028, 1001, 2421, 1026, 25353, 2015, 1013, 4127, 1012, 1044, 1028, 1001, 2421, 1026, 2358, 19422, 12322, 1012, 1044, 1028, 1001, 2421, 1026, 5164, 1012, 1044, 1028, 1001, 2421, 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...
#include <dfsch/lib/crypto.h> static void ecb_setup(dfsch_block_cipher_mode_context_t* cipher, uint8_t* iv, size_t iv_len){ if (iv_len != 0){ dfsch_error("ECB mode has no IV", NULL); } } static void ecb_encrypt(dfsch_block_cipher_mode_context_t* context, uint8_t* in, uint8_t* out, size_t blocks){ size_t bsize = context->cipher->cipher->block_size; int i; for (i = 0; i < blocks; i++){ context->cipher->cipher->encrypt(context->cipher, in + (bsize * i), out + (bsize * i)); } } static void ecb_decrypt(dfsch_block_cipher_mode_context_t* context, uint8_t* in, uint8_t* out, size_t blocks){ size_t bsize = context->cipher->cipher->block_size; int i; for (i = 0; i < blocks; i++){ context->cipher->cipher->decrypt(context->cipher, in + (bsize * i), out + (bsize * i)); } } dfsch_block_cipher_mode_t dfsch_crypto_ecb_mode = { .type = { .type = DFSCH_BLOCK_CIPHER_MODE_TYPE, .name = "crypto:ecb", .size = sizeof(dfsch_block_cipher_mode_context_t), }, .name = "ECB", .encrypt = ecb_encrypt, .decrypt = ecb_decrypt, .setup = ecb_setup }; static void memxor(uint8_t* dst, uint8_t* src, size_t count){ while (count){ *dst ^= *src; dst++; src++; count--; } } typedef struct cbc_context_t { dfsch_block_cipher_mode_context_t parent; uint8_t* iv; } cbc_context_t; static void cbc_setup(cbc_context_t* context, uint8_t* iv, size_t iv_len){ if (iv_len != context->parent.cipher->cipher->block_size){ dfsch_error("CBC IV length must be equal to block size", NULL); } context->iv = GC_MALLOC_ATOMIC(iv_len); memcpy(context->iv, iv, iv_len); } static void cbc_encrypt(cbc_context_t* context, uint8_t* in, uint8_t* out, size_t blocks){ size_t bsize = context->parent.cipher->cipher->block_size; int i; for (i = 0; i < blocks; i++){ memxor(context->iv, in + (bsize * i), bsize); context->parent.cipher->cipher->encrypt(context->parent.cipher, context->iv, context->iv); memcpy(out + (bsize * i), context->iv, bsize); } } static void cbc_decrypt(cbc_context_t* context, uint8_t* in, uint8_t* out, size_t blocks){ size_t bsize = context->parent.cipher->cipher->block_size; int i; uint8_t tmp[bsize]; for (i = 0; i < blocks; i++){ memcpy(tmp, in + (bsize * i), bsize); context->parent.cipher->cipher->decrypt(context->parent.cipher, in + (bsize * i), out + (bsize * i)); memxor(out + (bsize * i), context->iv, bsize); memcpy(context->iv, tmp, bsize); } } dfsch_block_cipher_mode_t dfsch_crypto_cbc_mode = { .type = { .type = DFSCH_BLOCK_CIPHER_MODE_TYPE, .name = "crypto:cbc", .size = sizeof(cbc_context_t), }, .name = "CBC", .encrypt = cbc_encrypt, .decrypt = cbc_decrypt, .setup = cbc_setup }; typedef struct cfb_context_t { dfsch_block_cipher_mode_context_t parent; uint8_t* iv; } cfb_context_t; static void cfb_setup(cfb_context_t* context, uint8_t* iv, size_t iv_len){ if (iv_len != context->parent.cipher->cipher->block_size){ dfsch_error("CFB IV length must be equal to block size", NULL); } context->iv = GC_MALLOC_ATOMIC(iv_len); memcpy(context->iv, iv, iv_len); } static void cfb_encrypt(cfb_context_t* context, uint8_t* in, uint8_t* out, size_t blocks){ size_t bsize = context->parent.cipher->cipher->block_size; int i; for (i = 0; i < blocks; i++){ context->parent.cipher->cipher->encrypt(context->parent.cipher, context->iv, context->iv); memxor(context->iv, in + (bsize * i), bsize); memcpy(out + (bsize * i), context->iv, bsize); } } static void cfb_decrypt(cfb_context_t* context, uint8_t* in, uint8_t* out, size_t blocks){ size_t bsize = context->parent.cipher->cipher->block_size; int i; uint8_t tmp[bsize]; for (i = 0; i < blocks; i++){ memcpy(tmp, in + (bsize * i), bsize); context->parent.cipher->cipher->encrypt(context->parent.cipher, context->iv, out + (bsize * i)); memxor(out + (bsize * i), tmp, bsize); memcpy(context->iv, tmp, bsize); } } dfsch_block_cipher_mode_t dfsch_crypto_cfb_mode = { .type = { .type = DFSCH_BLOCK_CIPHER_MODE_TYPE, .name = "crypto:cfb", .size = sizeof(cfb_context_t), }, .name = "CFB", .encrypt = cfb_encrypt, .decrypt = cfb_decrypt, .setup = cfb_setup }; typedef struct ofb_context_t { dfsch_block_cipher_mode_context_t parent; uint8_t* iv; } ofb_context_t; static void ofb_setup(ofb_context_t* context, uint8_t* iv, size_t iv_len){ if (iv_len != context->parent.cipher->cipher->block_size){ dfsch_error("OFB IV length must be equal to block size", NULL); } context->iv = GC_MALLOC_ATOMIC(iv_len); memcpy(context->iv, iv, iv_len); } static void ofb_operate(ofb_context_t* context, uint8_t* in, uint8_t* out, size_t blocks){ size_t bsize = context->parent.cipher->cipher->block_size; int i; for (i = 0; i < blocks; i++){ context->parent.cipher->cipher->encrypt(context->parent.cipher, context->iv, context->iv); memcpy(out + (bsize * i), in + (bsize * i), bsize); memxor(out + (bsize * i), context->iv, bsize); } } dfsch_block_cipher_mode_t dfsch_crypto_ofb_mode = { .type = { .type = DFSCH_BLOCK_CIPHER_MODE_TYPE, .name = "crypto:ofb", .size = sizeof(ofb_context_t), }, .name = "OFB", .encrypt = ofb_operate, .decrypt = ofb_operate, .setup = ofb_setup }; /* This implementation of CTR mode comes from NIST recommendation, which is different in significant details from AES-CTR used by TLS and IPsec (which are even mutually different). CTR mode can use various additional data from underlying protocol, which unfortunately means that each protocol uses completely different method of construing CTR value */ typedef struct ctr_context_t { dfsch_block_cipher_mode_context_t parent; uint8_t* ctr; } ctr_context_t; static void ctr_setup(ctr_context_t* context, uint8_t* iv, size_t iv_len){ if (iv_len != context->parent.cipher->cipher->block_size){ dfsch_error("CTR IV length must be equal to block size", NULL); } context->ctr = GC_MALLOC_ATOMIC(iv_len); memcpy(context->ctr, iv, iv_len); } static void ctr_operate(ctr_context_t* context, uint8_t* in, uint8_t* out, size_t blocks){ size_t bsize = context->parent.cipher->cipher->block_size; int i; int j; uint8_t tmp[bsize]; for (i = 0; i < blocks; i++){ context->parent.cipher->cipher->encrypt(context->parent.cipher, context->ctr, tmp); memcpy(out + (bsize * i), in + (bsize * i), bsize); memxor(out + (bsize * i), tmp, bsize); /* Increment counter, little endian */ for (j = 0; j < bsize; j++){ context->ctr[j]++; if (context->ctr[j] != 0){ break; } } } } dfsch_block_cipher_mode_t dfsch_crypto_ctr_mode = { .type = { .type = DFSCH_BLOCK_CIPHER_MODE_TYPE, .name = "crypto:ctr", .size = sizeof(ctr_context_t), }, .name = "CTR", .encrypt = ctr_operate, .decrypt = ctr_operate, .setup = ctr_setup }; typedef struct block_stream_mode_t { dfsch_stream_cipher_t parent; dfsch_block_cipher_t* cipher; } block_stream_mode_t; dfsch_type_t dfsch_block_stream_mode_type = { .type = DFSCH_META_TYPE, .superclass = DFSCH_STREAM_CIPHER_TYPE, .name = "block-stream-mode", .size = sizeof(block_stream_mode_t), }; typedef struct block_stream_context_t { block_stream_mode_t* mode; dfsch_block_cipher_context_t* cipher; uint8_t* next_input; uint8_t* last_output; size_t output_offset; size_t output_size; } block_stream_context_t; static void bs_ofb_setup(block_stream_context_t* ctx, uint8_t *key, size_t keylen, uint8_t *nonce, size_t nonce_len){ if (nonce_len != ctx->mode->cipher->block_size){ dfsch_error("Nonce for OFB mode must be same size as cipher's block", NULL); } ctx->cipher = dfsch_setup_block_cipher(ctx->mode->cipher, key, keylen); ctx->next_input = GC_MALLOC_ATOMIC(ctx->mode->cipher->block_size); ctx->last_output = GC_MALLOC_ATOMIC(ctx->mode->cipher->block_size); ctx->output_offset = ctx->mode->cipher->block_size; ctx->output_size = ctx->mode->cipher->block_size; memcpy(ctx->next_input, nonce, ctx->output_size); } static void bs_ofb_encrypt_bytes(block_stream_context_t* ctx, uint8_t* out, size_t outlen){ while (outlen){ if (ctx->output_offset >= ctx->output_size){ ctx->cipher->cipher->encrypt(ctx->cipher, ctx->next_input, ctx->last_output); memcpy(ctx->next_input, ctx->last_output, ctx->output_size); ctx->output_offset = 0; } *out ^= ctx->last_output[ctx->output_offset]; ctx->output_offset++; out++; outlen--; } } dfsch_stream_cipher_t* dfsch_make_ofb_cipher(dfsch_block_cipher_t* cipher){ block_stream_mode_t* bs = dfsch_make_object(DFSCH_BLOCK_STREAM_MODE_TYPE); bs->parent.name = dfsch_saprintf("%s in OFB mode", cipher->name); bs->parent.type.name = dfsch_saprintf("%s-ofb", cipher->type.name); bs->parent.type.size = sizeof(block_stream_context_t); bs->parent.setup = bs_ofb_setup; bs->parent.encrypt_bytes = bs_ofb_encrypt_bytes; return bs; } static void bs_ctr_setup(block_stream_context_t* ctx, uint8_t *key, size_t keylen, uint8_t *nonce, size_t nonce_len){ if (nonce_len != ctx->mode->cipher->block_size){ dfsch_error("Nonce for OFB mode must be same size as cipher's block", NULL); } ctx->cipher = dfsch_setup_block_cipher(ctx->mode->cipher, key, keylen); ctx->next_input = GC_MALLOC_ATOMIC(ctx->mode->cipher->block_size); ctx->last_output = GC_MALLOC_ATOMIC(ctx->mode->cipher->block_size); ctx->output_offset = ctx->mode->cipher->block_size; ctx->output_size = ctx->mode->cipher->block_size; memcpy(ctx->next_input, nonce, ctx->output_size); } static void bs_ctr_encrypt_bytes(block_stream_context_t* ctx, uint8_t* out, size_t outlen){ int i; while (outlen){ if (ctx->output_offset >= ctx->output_size){ ctx->cipher->cipher->encrypt(ctx->cipher, ctx->next_input, ctx->last_output); for (i = 0; i < ctx->output_size; i++){ ctx->next_input[i]++; if (ctx->next_input[i] != 0){ break; } } ctx->output_offset = 0; } *out ^= ctx->last_output[ctx->output_offset]; ctx->output_offset++; out++; outlen--; } } dfsch_stream_cipher_t* dfsch_make_ctr_cipher(dfsch_block_cipher_t* cipher){ block_stream_mode_t* bs = dfsch_make_object(DFSCH_BLOCK_STREAM_MODE_TYPE); bs->parent.name = dfsch_saprintf("%s in CTR mode", cipher->name); bs->parent.type.name = dfsch_saprintf("%s-ctr", cipher->type.name); bs->parent.type.size = sizeof(block_stream_context_t); bs->parent.setup = bs_ctr_setup; bs->parent.encrypt_bytes = bs_ctr_encrypt_bytes; return bs; }
adh/dfsch
lib/crypto/modes.c
C
gpl-2.0
12,669
[ 30522, 1001, 2421, 1026, 1040, 10343, 2818, 1013, 5622, 2497, 1013, 19888, 2080, 1012, 1044, 1028, 10763, 11675, 14925, 2497, 1035, 16437, 1006, 1040, 10343, 2818, 1035, 3796, 1035, 27715, 1035, 5549, 1035, 6123, 1035, 1056, 1008, 27715, 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...
# coding: utf-8 import os import sys from nxdrive.logging_config import get_logger from nxdrive.utils import safe_long_path from tests.common_unit_test import UnitTestCase if sys.platform == 'win32': import win32api log = get_logger(__name__) # Number of chars in path c://.../Nuxeo.. is approx 96 chars FOLDER_A = 'A' * 90 FOLDER_B = 'B' * 90 FOLDER_C = 'C' * 90 FOLDER_D = 'D' * 50 class TestLongPath(UnitTestCase): def setUp(self): UnitTestCase.setUp(self) self.local_1 = self.local_client_1 self.remote_1 = self.remote_document_client_1 log.info("Create a folder AAAA... (90 chars) in server") self.folder_a = self.remote_1.make_folder("/", FOLDER_A) self.folder_b = self.remote_1.make_folder(self.folder_a, FOLDER_B) self.folder_c = self.remote_1.make_folder(self.folder_b, FOLDER_C) self.remote_1.make_file(self.folder_c, "File1.txt", "Sample Content") def tearDown(self): log.info("Delete the folder AAA... in server") self.remote_1.delete(self.folder_a, use_trash=False) UnitTestCase.tearDown(self) def test_long_path(self): self.engine_1.start() self.wait_sync(wait_for_async=True) parent_path = os.path.join(self.local_1.abspath('/'), FOLDER_A, FOLDER_B, FOLDER_C, FOLDER_D) log.info("Creating folder with path: %s", parent_path) if sys.platform == 'win32' and not os.path.exists(parent_path): log.debug('Add \\\\?\\ prefix to path %r', parent_path) parent_path = safe_long_path(parent_path) os.makedirs(parent_path) if sys.platform == 'win32': log.info("Convert path of FOLDER_D\File2.txt to short path format") parent_path = win32api.GetShortPathName(parent_path) new_file = os.path.join(parent_path, "File2.txt") log.info("Creating file with path: %s", new_file) with open(new_file, "w") as f: f.write("Hello world") self.wait_sync(wait_for_async=True, timeout=45, fail_if_timeout=False) remote_children_of_c = self.remote_1.get_children_info(self.folder_c) children_names = [item.name for item in remote_children_of_c] log.warn("Verify if FOLDER_D is uploaded to server") self.assertIn(FOLDER_D, children_names) folder_d = [item.uid for item in remote_children_of_c if item.name == FOLDER_D][0] remote_children_of_d = self.remote_1.get_children_info(folder_d) children_names = [item.name for item in remote_children_of_d] log.warn("Verify if FOLDER_D\File2.txt is uploaded to server") self.assertIn('File2.txt', children_names) def test_setup_on_long_path(self): """ NXDRIVE 689: Fix error when adding a new account when installation path is greater than 245 characters. """ self.engine_1.stop() self.engine_1.reinit() # On Mac, avoid permission denied error self.engine_1.get_local_client().clean_xattr_root() test_folder_len = 245 - len(str(self.local_nxdrive_folder_1)) test_folder = 'A' * test_folder_len self.local_nxdrive_folder_1 = os.path.join(self.local_nxdrive_folder_1, test_folder) self.assertTrue(len(self.local_nxdrive_folder_1) > 245) self.manager_1.unbind_all() self.engine_1 = self.manager_1.bind_server( self.local_nxdrive_folder_1, self.nuxeo_url, self.user_2, self.password_2, start_engine=False) self.engine_1.start() self.engine_1.stop()
ssdi-drive/nuxeo-drive
nuxeo-drive-client/tests/test_long_path.py
Python
lgpl-2.1
3,664
[ 30522, 1001, 16861, 1024, 21183, 2546, 1011, 1022, 12324, 9808, 12324, 25353, 2015, 2013, 1050, 2595, 23663, 1012, 15899, 1035, 9530, 8873, 2290, 12324, 2131, 1035, 8833, 4590, 2013, 1050, 2595, 23663, 1012, 21183, 12146, 12324, 3647, 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...
/* AppleWin : An Apple //e emulator for Windows Copyright (C) 2010-2011, Tom Charlesworth, Michael Pohoreski AppleWin 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. AppleWin 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 AppleWin; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ typedef unsigned char u8; // TODO: change to <stdint.h> uint8_t typedef unsigned short u16; // TODO: change to <stdint.h> uint16_t // return (x < 255) ? (x+1) : 255; inline u8 IncClamp8( u8 x ) { u16 c = (~((x + 1) >> 8) & 1); u8 r = x + c; return r; } // return (x > 0) ? (x-1) : 0; inline u8 DecClamp8( u8 x ) { u16 c = (~((x - 1) >> 8) & 1); u8 r = x - c; return r; } // TODO: Verify: RGBA or BGRA (.bmp format) // 0 A n/a // 1 B Exec // 2 G Read // 3 R Write // // 0xAARRGGBB // [0] B Exec // [1] G Load // [2] R Store // [3] A n/a // RGBA r = write, g = read, b = Program Counter const int HEATMAP_W_MASK = 0x00FF0000; // Red Store const int HEATMAP_R_MASK = 0x0000FF00; // Green Load const int HEATMAP_X_MASK = 0x000000FF; // Blue Exec // This is a memory heatmap // FF = accessed on this clock cycle // FE = accessed 1 clock cycles ago // FD = accessed 2 clock cycles ago // etc. // Displayed as 256x256 64K memory access int g_aMemoryHeatmap[ 65536 ]; // TODO: Change to <stdint.h> int32_t #define HEATMAP_W(addr) g_aMemoryHeatmap[ addr ] |= HEATMAP_W_MASK #define HEATMAP_R(addr) g_aMemoryHeatmap[ addr ] |= HEATMAP_R_MASK #define HEATMAP_X(addr) g_aMemoryHeatmap[ addr ] |= HEATMAP_X_MASK #undef READ #define READ ReadByte( addr, uExecutedCycles ) inline u8 ReadByte( u16 addr, int uExecutedCycles ) { // TODO: We should have a single g_bDebuggerActive so we can have a single implementation across ][+ //e HEATMAP_R(addr); return ((addr & 0xF000) == 0xC000) ? IORead[(addr>>4) & 0xFF](regs.pc,addr,0,0,uExecutedCycles) : *(mem+addr); } #undef WRITE #define WRITE(a) \ HEATMAP_W(addr); \ { \ memdirty[addr >> 8] = 0xFF; \ LPBYTE page = memwrite[addr >> 8]; \ if (page) \ *(page+(addr & 0xFF)) = (BYTE)(a); \ else if ((addr & 0xF000) == 0xC000) \ IOWrite[(addr>>4) & 0xFF](regs.pc,addr,1,(BYTE)(a),uExecutedCycles); \ } #include "cpu/cpu_instructions.inl" //=========================================================================== // Michael's Real-Time Debugger/Visualizer CPU // Based on Modified 65C02 static DWORD Cpu65D02 (DWORD uTotalCycles) { // Optimisation: // . Copy the global /regs/ vars to stack-based local vars // (Oliver Schmidt says this gives a performance gain, see email - The real deal: "1.10.5") WORD addr; BOOL flagc; // must always be 0 or 1, no other values allowed BOOL flagn; // must always be 0 or 0x80. BOOL flagv; // any value allowed BOOL flagz; // any value allowed WORD temp; WORD temp2; WORD val; AF_TO_EF ULONG uExecutedCycles = 0; WORD base; g_bDebugBreakpointHit = 0; do { UINT uExtraCycles = 0; BYTE iOpcode; if (g_ActiveCPU == CPU_Z80) { const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles) } else HEATMAP_X( regs.pc ); if (!Fetch(iOpcode, uExecutedCycles)) break; // INV = Invalid -> Debugger Break // MSVC C PreProcessor is BROKEN... #define @ INV //#define # INV //#define @ Read() //#define $ Store() #define $ INV switch (iOpcode) { // TODO Optimization Note: ?? Move CYC(#) to array ?? // Version 2 opcode: $ AM Instruction // $=DebugBreak AM=AddressingMode //! ! ! ! ! ! // Tab-Stops case 0x00: BRK CYC(7) break; case 0x01: idx ORA CYC(6) break; case 0x02: $ IMM NOP CYC(2) break; case 0x03: $ NOP CYC(2) break; case 0x04: ZPG TSB CYC(5) break; case 0x05: ZPG ORA CYC(3) break; case 0x06: ZPG ASLc CYC(5) break; case 0x07: $ NOP CYC(2) break; case 0x08: PHP CYC(3) break; case 0x09: IMM ORA CYC(2) break; case 0x0A: asl CYC(2) break; case 0x0B: $ NOP CYC(2) break; case 0x0C: ABS TSB CYC(6) break; case 0x0D: ABS ORA CYC(4) break; case 0x0E: ABS ASLc CYC(6) break; case 0x0F: $ NOP CYC(2) break; case 0x10: REL BPL CYC(2) break; case 0x11: INDY_OPT ORA CYC(5) break; case 0x12: izp ORA CYC(5) break; case 0x13: $ NOP CYC(2) break; case 0x14: ZPG TRB CYC(5) break; case 0x15: zpx ORA CYC(4) break; case 0x16: zpx ASLc CYC(6) break; case 0x17: $ NOP CYC(2) break; case 0x18: CLC CYC(2) break; case 0x19: ABSY_OPT ORA CYC(4) break; case 0x1A: INA CYC(2) break; case 0x1B: $ NOP CYC(2) break; case 0x1C: ABS TRB CYC(6) break; case 0x1D: ABSX_OPT ORA CYC(4) break; case 0x1E: ABSX_OPT ASLc CYC(6) break; case 0x1F: $ NOP CYC(2) break; case 0x20: ABS JSR CYC(6) break; case 0x21: idx AND CYC(6) break; case 0x22: $ IMM NOP CYC(2) break; case 0x23: $ NOP CYC(2) break; case 0x24: ZPG BIT CYC(3) break; case 0x25: ZPG AND CYC(3) break; case 0x26: ZPG ROLc CYC(5) break; case 0x27: $ NOP CYC(2) break; case 0x28: PLP CYC(4) break; case 0x29: IMM AND CYC(2) break; case 0x2A: rol CYC(2) break; case 0x2B: $ NOP CYC(2) break; case 0x2C: ABS BIT CYC(4) break; case 0x2D: ABS AND CYC(2) break; case 0x2E: ABS ROLc CYC(6) break; case 0x2F: $ NOP CYC(2) break; case 0x30: REL BMI CYC(2) break; case 0x31: INDY_OPT AND CYC(5) break; case 0x32: izp AND CYC(5) break; case 0x33: $ NOP CYC(2) break; case 0x34: zpx BIT CYC(4) break; case 0x35: zpx AND CYC(4) break; case 0x36: zpx ROLc CYC(6) break; case 0x37: $ NOP CYC(2) break; case 0x38: SEC CYC(2) break; case 0x39: ABSY_OPT AND CYC(4) break; case 0x3A: DEA CYC(2) break; case 0x3B: $ NOP CYC(2) break; case 0x3C: ABSX_OPT BIT CYC(4) break; case 0x3D: ABSX_OPT AND CYC(4) break; case 0x3E: ABSX_OPT ROLc CYC(6) break; case 0x3F: $ NOP CYC(2) break; case 0x40: RTI CYC(6) DoIrqProfiling(uExecutedCycles); break; case 0x41: idx EOR CYC(6) break; case 0x42: $ IMM NOP CYC(2) break; case 0x43: $ NOP CYC(2) break; case 0x44: $ ZPG NOP CYC(3) break; case 0x45: ZPG EOR CYC(3) break; case 0x46: ZPG LSRc CYC(5) break; case 0x47: $ NOP CYC(2) break; case 0x48: PHA CYC(3) break; case 0x49: IMM EOR CYC(2) break; case 0x4A: lsr CYC(2) break; case 0x4B: $ NOP CYC(2) break; case 0x4C: ABS JMP CYC(3) break; case 0x4D: ABS EOR CYC(4) break; case 0x4E: ABS LSRc CYC(6) break; case 0x4F: $ NOP CYC(2) break; case 0x50: REL BVC CYC(2) break; case 0x51: INDY_OPT EOR CYC(5) break; case 0x52: izp EOR CYC(5) break; case 0x53: $ NOP CYC(2) break; case 0x54: $ zpx NOP CYC(4) break; case 0x55: zpx EOR CYC(4) break; case 0x56: zpx LSRc CYC(6) break; case 0x57: $ NOP CYC(2) break; case 0x58: CLI CYC(2) break; case 0x59: ABSY_OPT EOR CYC(4) break; case 0x5A: PHY CYC(3) break; case 0x5B: $ NOP CYC(2) break; case 0x5C: $ ABSX_OPT NOP CYC(8) break; case 0x5D: ABSX_OPT EOR CYC(4) break; case 0x5E: ABSX_OPT LSRc CYC(6) break; case 0x5F: $ NOP CYC(2) break; case 0x60: RTS CYC(6) break; case 0x61: idx ADCc CYC(6) break; case 0x62: $ IMM NOP CYC(2) break; case 0x63: $ NOP CYC(2) break; case 0x64: ZPG STZ CYC(3) break; case 0x65: ZPG ADCc CYC(3) break; case 0x66: ZPG RORc CYC(5) break; case 0x67: $ NOP CYC(2) break; case 0x68: PLA CYC(4) break; case 0x69: IMM ADCc CYC(2) break; case 0x6A: ror CYC(2) break; case 0x6B: $ NOP CYC(2) break; case 0x6C: IABS_CMOS JMP CYC(6) break; case 0x6D: ABS ADCc CYC(4) break; case 0x6E: ABS RORc CYC(6) break; case 0x6F: $ NOP CYC(2) break; case 0x70: REL BVS CYC(2) break; case 0x71: INDY_OPT ADCc CYC(5) break; case 0x72: izp ADCc CYC(5) break; case 0x73: $ NOP CYC(2) break; case 0x74: zpx STZ CYC(4) break; case 0x75: zpx ADCc CYC(4) break; case 0x76: zpx RORc CYC(6) break; case 0x77: $ NOP CYC(2) break; case 0x78: SEI CYC(2) break; case 0x79: ABSY_OPT ADCc CYC(4) break; case 0x7A: PLY CYC(4) break; case 0x7B: $ NOP CYC(2) break; case 0x7C: IABSX JMP CYC(6) break; case 0x7D: ABSX_OPT ADCc CYC(4) break; case 0x7E: ABSX_OPT RORc CYC(6) break; case 0x7F: $ NOP CYC(2) break; case 0x80: REL BRA CYC(2) break; case 0x81: idx STA CYC(6) break; case 0x82: $ IMM NOP CYC(2) break; case 0x83: $ NOP CYC(2) break; case 0x84: ZPG STY CYC(3) break; case 0x85: ZPG STA CYC(3) break; case 0x86: ZPG STX CYC(3) break; case 0x87: $ NOP CYC(2) break; case 0x88: DEY CYC(2) break; case 0x89: IMM BITI CYC(2) break; case 0x8A: TXA CYC(2) break; case 0x8B: $ NOP CYC(2) break; case 0x8C: ABS STY CYC(4) break; case 0x8D: ABS STA CYC(4) break; case 0x8E: ABS STX CYC(4) break; case 0x8F: $ NOP CYC(2) break; case 0x90: REL BCC CYC(2) break; case 0x91: INDY_CONST STA CYC(6) break; case 0x92: izp STA CYC(5) break; case 0x93: $ NOP CYC(2) break; case 0x94: zpx STY CYC(4) break; case 0x95: zpx STA CYC(4) break; case 0x96: zpy STX CYC(4) break; case 0x97: $ NOP CYC(2) break; case 0x98: TYA CYC(2) break; case 0x99: ABSY_CONST STA CYC(5) break; case 0x9A: TXS CYC(2) break; case 0x9B: $ NOP CYC(2) break; case 0x9C: ABS STZ CYC(4) break; case 0x9D: ABSX_CONST STA CYC(5) break; case 0x9E: ABSX_CONST STZ CYC(5) break; case 0x9F: $ NOP CYC(2) break; case 0xA0: IMM LDY CYC(2) break; case 0xA1: idx LDA CYC(6) break; case 0xA2: IMM LDX CYC(2) break; case 0xA3: $ NOP CYC(2) break; case 0xA4: ZPG LDY CYC(3) break; case 0xA5: ZPG LDA CYC(3) break; case 0xA6: ZPG LDX CYC(3) break; case 0xA7: $ NOP CYC(2) break; case 0xA8: TAY CYC(2) break; case 0xA9: IMM LDA CYC(2) break; case 0xAA: TAX CYC(2) break; case 0xAB: $ NOP CYC(2) break; case 0xAC: ABS LDY CYC(4) break; case 0xAD: ABS LDA CYC(4) break; case 0xAE: ABS LDX CYC(4) break; case 0xAF: $ NOP CYC(2) break; case 0xB0: REL BCS CYC(2) break; case 0xB1: INDY_OPT LDA CYC(5) break; case 0xB2: izp LDA CYC(5) break; case 0xB3: $ NOP CYC(2) break; case 0xB4: zpx LDY CYC(4) break; case 0xB5: zpx LDA CYC(4) break; case 0xB6: zpy LDX CYC(4) break; case 0xB7: $ NOP CYC(2) break; case 0xB8: CLV CYC(2) break; case 0xB9: ABSY_OPT LDA CYC(4) break; case 0xBA: TSX CYC(2) break; case 0xBB: $ NOP CYC(2) break; case 0xBC: ABSX_OPT LDY CYC(4) break; case 0xBD: ABSX_OPT LDA CYC(4) break; case 0xBE: ABSY_OPT LDX CYC(4) break; case 0xBF: $ NOP CYC(2) break; case 0xC0: IMM CPY CYC(2) break; case 0xC1: idx CMP CYC(6) break; case 0xC2: $ IMM NOP CYC(2) break; case 0xC3: $ NOP CYC(2) break; case 0xC4: ZPG CPY CYC(3) break; case 0xC5: ZPG CMP CYC(3) break; case 0xC6: ZPG DEC CYC(5) break; case 0xC7: $ NOP CYC(2) break; case 0xC8: INY CYC(2) break; case 0xC9: IMM CMP CYC(2) break; case 0xCA: DEX CYC(2) break; case 0xCB: $ NOP CYC(2) break; case 0xCC: ABS CPY CYC(4) break; case 0xCD: ABS CMP CYC(4) break; case 0xCE: ABS DEC CYC(6) break; case 0xCF: $ NOP CYC(2) break; case 0xD0: REL BNE CYC(2) break; case 0xD1: INDY_OPT CMP CYC(5) break; case 0xD2: izp CMP CYC(5) break; case 0xD3: $ NOP CYC(2) break; case 0xD4: $ zpx NOP CYC(4) break; case 0xD5: zpx CMP CYC(4) break; case 0xD6: zpx DEC CYC(6) break; case 0xD7: $ NOP CYC(2) break; case 0xD8: CLD CYC(2) break; case 0xD9: ABSY_OPT CMP CYC(4) break; case 0xDA: PHX CYC(3) break; case 0xDB: $ NOP CYC(2) break; case 0xDC: $ ABSX_OPT NOP CYC(4) break; case 0xDD: ABSX_OPT CMP CYC(4) break; case 0xDE: ABSX_CONST DEC CYC(7) break; case 0xDF: $ NOP CYC(2) break; case 0xE0: IMM CPX CYC(2) break; case 0xE1: idx SBCc CYC(6) break; case 0xE2: $ IMM NOP CYC(2) break; case 0xE3: $ NOP CYC(2) break; case 0xE4: ZPG CPX CYC(3) break; case 0xE5: ZPG SBCc CYC(3) break; case 0xE6: ZPG INC CYC(5) break; case 0xE7: $ NOP CYC(2) break; case 0xE8: INX CYC(2) break; case 0xE9: IMM SBCc CYC(2) break; case 0xEA: NOP CYC(2) break; case 0xEB: $ NOP CYC(2) break; case 0xEC: ABS CPX CYC(4) break; case 0xED: ABS SBCc CYC(4) break; case 0xEE: ABS INC CYC(6) break; case 0xEF: $ NOP CYC(2) break; case 0xF0: REL BEQ CYC(2) break; case 0xF1: INDY_OPT SBCc CYC(5) break; case 0xF2: izp SBCc CYC(5) break; case 0xF3: $ NOP CYC(2) break; case 0xF4: $ zpx NOP CYC(4) break; case 0xF5: zpx SBCc CYC(4) break; case 0xF6: zpx INC CYC(6) break; case 0xF7: $ NOP CYC(2) break; case 0xF8: SED CYC(2) break; case 0xF9: ABSY_OPT SBCc CYC(4) break; case 0xFA: PLX CYC(4) break; case 0xFB: $ NOP CYC(2) break; case 0xFC: $ ABSX_OPT NOP CYC(4) break; case 0xFD: ABSX_OPT SBCc CYC(4) break; case 0xFE: ABSX_CONST INC CYC(7) break; case 0xFF: $ NOP CYC(2) break; } #undef $ CheckInterruptSources(uExecutedCycles); NMI(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz); IRQ(uExecutedCycles, uExtraCycles, flagc, flagn, flagv, flagz); if( IsDebugBreakpointHit() ) break; } while (uExecutedCycles < uTotalCycles); EF_TO_AF // Emulator Flags to Apple Flags if( g_bDebugBreakpointHit ) if ((g_nAppMode != MODE_DEBUG) && (g_nAppMode != MODE_STEPPING)) // // Running at full speed? (debugger not running) RequestDebugger(); return uExecutedCycles; }
meesokim/AppleWin
source/CPU/cpu65d02.h
C
gpl-2.0
17,283
[ 30522, 1013, 1008, 6207, 10105, 1024, 2019, 6207, 1013, 1013, 1041, 7861, 20350, 2005, 3645, 9385, 1006, 1039, 1007, 2230, 1011, 2249, 1010, 3419, 2798, 5172, 1010, 2745, 13433, 16892, 5488, 6207, 10105, 2003, 2489, 4007, 1025, 2017, 2064, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 2019 Tremolo Security, Inc. * * 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.tremolosecurity.proxy; /** * * @author mlb * Provides an interface to extend a session termination from an external source instead of the built in session variables */ public interface ExternalSessionExpires { /** * * @return The expiration date/time in standard java form (milliseconds since epoch) */ public long getExpires(); }
TremoloSecurity/OpenUnison
unison/unison-sdk/src/main/java/com/tremolosecurity/proxy/ExternalSessionExpires.java
Java
apache-2.0
1,124
[ 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...
/* $Id: PtbguiMain.java 446504 2014-09-16 14:46:53Z gouriano $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Author: Andrei Gourianov * * File Description: * GUI application that works with project_tree_builder * NCBI C++ Toolkit */ package ptbgui; import java.awt.*; import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.text.JTextComponent; public class PtbguiMain extends javax.swing.JFrame { private static final long serialVersionUID = 1L; private String[] m_OriginalArgs; private ArgsParser m_ArgsParser; private Properties m_ArgsProp; private Process m_Ptb; private BufferedReader m_PtbOut; private BufferedReader m_PtbErr; private OutputStream m_PtbIn; private String m_Params, m_TmpParams; private String m_Key3root, m_KeyCpath; private Map<String, String[]> m_ProjectTags; private SortedSet<String> m_UndefSelTags; private Vector<String> m_KnownTags; private Vector<String> m_CompositeTags; private KTagsDialog m_KtagsDlg; enum eState { beforePtb, got3rdparty, gotProjects, donePtb } private eState m_State; /** Creates new form PtbguiMain */ public PtbguiMain() { initComponents(); initObjects(); resetState(); } private void initObjects() { m_ArgsParser = new ArgsParser(); m_ProjectTags = new HashMap<String, String[]>(); m_UndefSelTags = new TreeSet<String>(); m_KnownTags = new Vector<String>(); m_CompositeTags = new Vector<String>(); ButtonGroup group = new ButtonGroup(); group.add(jRadioButtonStatic); group.add(jRadioButtonDLL); initCheckList(jListApps); initCheckList(jListLibs); initCheckList(jListOther); initCheckList(jListTags); initCheckList(jListUserReq); } private void resetState() { jTabbedPane.setSelectedIndex(0); jTabbedPane.setEnabledAt(0,true); jTabbedPane.setEnabledAt(1,true); jTabbedPane.setEnabledAt(2,false); jTabbedPane.setEnabledAt(3,false); jTabbedPane.setEnabledAt(4,false); m_State = eState.beforePtb; jButtonGOK.setText("Next"); jButtonGOK.setEnabled(true); jButtonGOK.setVisible(true); jButtonGCancel.setText("Cancel"); jButtonGCancel.setEnabled(true); jButtonGCancel.setVisible(true); ((DefaultListModel)jListApps.getModel()).clear(); ((DefaultListModel)jListLibs.getModel()).clear(); ((DefaultListModel)jListOther.getModel()).clear(); ((DefaultListModel)jListTags.getModel()).clear(); ((DefaultListModel)jListUserReq.getModel()).clear(); showMoreAdvanced(false); } private void showMoreAdvanced(boolean show) { jCheckBoxNoPtb.setVisible(show); jCheckBoxNws.setVisible(show); jCheckBoxExt.setVisible(show); jLabel1.setVisible(show); jLabel2.setVisible(show); jTextFieldPtb.setVisible(show); jTextFieldRoot.setVisible(show); jButtonPtb.setVisible(show); jButtonMore.setText(show ? "< less" : "more >"); } private void initData() { initData(m_OriginalArgs); } private void initData(String args[]) { if (m_OriginalArgs == null) { m_OriginalArgs = new String[args.length]; for (int i=0; i<args.length; ++i) { m_OriginalArgs[i] = args[i]; } } m_ArgsParser.init(args); setPathText(jTextFieldPtb, m_ArgsParser.getPtb(), true); setPathText(jTextFieldRoot, m_ArgsParser.getRoot(), true); setPathText(jTextFieldLst, m_ArgsParser.getRoot(), m_ArgsParser.getSubtree()); setPathText(jTextFieldSolution, m_ArgsParser.getSolutionFile(), false); jTextFieldTags.setToolTipText( "Expression. For example: (core || web) && !test"); jTextFieldLstTags.setToolTipText( "When 'Use project tags' field above is empty, default tags will be used"); if (m_ArgsParser.getArgsFile().length() > 0) { initData(m_ArgsParser.getArgsFile(), true); return; } jTextFieldTags.setText(m_ArgsParser.getProjTag()); jTextFieldLstTags.setText(""); jTextFieldIde.setText(m_ArgsParser.getIde()); String arch = m_ArgsParser.getArch(); jTextFieldArch.setText(arch); if (arch.equals("Win32") || arch.equals("x64")) { jTextFieldArch.setToolTipText("Win32 or x64"); } jRadioButtonDLL.setSelected(m_ArgsParser.getDll()); jRadioButtonStatic.setSelected(!m_ArgsParser.getDll()); jCheckBoxNoPtb.setSelected(m_ArgsParser.m_nobuildptb); jCheckBoxNws.setSelected(m_ArgsParser.m_nws); jCheckBoxExt.setSelected(m_ArgsParser.m_ext); jTextFieldExt.setText(m_ArgsParser.getExtRoot()); jLabelArgs.setText(" "); jButtonArgsReset.setEnabled(false); if (m_ArgsProp != null) { m_ArgsProp.clear(); } // jRadioButtonDLL.setEnabled(false); // jRadioButtonStatic.setEnabled(false); adjustArch(); initKnownTags(); initTagsFromSubtree(); } private void adjustArch() { File build_root = new File(m_ArgsParser.getBuildRoot()); File[] arrFile = build_root.listFiles( new FilenameFilter() { public boolean accept(File dir, String name) { return (name.toLowerCase().matches("__configured_platform.*")); } }); jTextFieldArch.setEditable(arrFile == null || arrFile.length==0); } private void adjustBuildType() { m_ArgsParser.setDll( jRadioButtonDLL.isSelected(),true); setPathText(jTextFieldSolution, m_ArgsParser.getSolutionFile(), false); } private void initData(String file, Boolean fromArgs) { try { if (m_ArgsProp != null) { m_ArgsProp.clear(); } else { m_ArgsProp = new Properties(); } m_ArgsProp.load(new FileInputStream(new File(file))); initData(m_ArgsProp, fromArgs); jLabelArgs.setText(file); jButtonArgsReset.setEnabled(!fromArgs); } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); JOptionPane.showMessageDialog( this, "This file does not contain valid data", "Error", JOptionPane.ERROR_MESSAGE); } } private void initData(Properties prop, Boolean fromArgs) { String v; if (fromArgs) { v = m_ArgsParser.getRoot(); } else { v = getProp(prop,"__arg_root"); setPathText(jTextFieldRoot, getProp(prop,"__arg_root"), true); setPathText(jTextFieldSolution, getProp(prop,"__arg_solution"), false); } setPathText(jTextFieldLst, v, getProp(prop,"__arg_subtree")); jTextFieldTags.setText(getProp(prop,"__arg_projtag")); jTextFieldLstTags.setText(""); jTextFieldIde.setText(getProp(prop,"__arg_ide")); jTextFieldArch.setText(getProp(prop,"__arg_arch")); jRadioButtonDLL.setSelected(getProp(prop,"__arg_dll").equals("yes")); jRadioButtonStatic.setSelected(!jRadioButtonDLL.isSelected()); jCheckBoxNoPtb.setSelected(getProp(prop,"__arg_nobuildptb").equals("yes")); jCheckBoxNws.setSelected(getProp(prop,"__arg_nws").equals("yes")); jCheckBoxExt.setSelected(getProp(prop,"__arg_ext").equals("yes")); jTextFieldExt.setText(getProp(prop,"__arg_extroot")); adjustArch(); initKnownTags(); initTagsFromSubtree(); } private void initKnownTags() { String from = jTextFieldRoot.getText()+ "/src/build-system/project_tags.txt"; int n = 0; m_KnownTags.clear(); m_CompositeTags.clear(); if (!ArgsParser.existsPath(from)) { return; } try { BufferedReader r = new BufferedReader(new InputStreamReader( new FileInputStream(new File(nativeFileSeparator(from))))); String line; while ((line = r.readLine()) != null) { if (line.length() == 0 || line.charAt(0) == '#') { continue; } String[] t = line.split("="); if (t.length > 1) { m_CompositeTags.add(line.trim()); continue; } t = line.split("[, ]"); for (int i=0; i<t.length; ++i) { if (t[i].trim().length() != 0) { ++n; m_KnownTags.add(t[i].trim()); } } } } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } private void initTagsFromSubtree() { jTextFieldLstTags.setText(""); String lst = jTextFieldRoot.getText() + File.separatorChar + jTextFieldLst.getText(); File f = new File(nativeFileSeparator(lst)); if (f.isFile()) { try { BufferedReader r = new BufferedReader(new InputStreamReader( new FileInputStream(f))); String key = "#define TAGS"; String line; while ((line = r.readLine()) != null) { line = line.trim(); if (line.startsWith(key)) { line = line.replaceAll(key,""); line = line.replaceAll("\\[",""); line = line.replaceAll("\\]",""); line = line.trim(); // m_ArgsParser.setProjTagFromLst(line); jTextFieldLstTags.setText(line); break; } } } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } } private void updateData() { m_ArgsParser.setPtb(jTextFieldPtb.getText()); if (m_ArgsProp != null && !m_ArgsProp.isEmpty()) { setProp(m_ArgsProp, "__arg_root", jTextFieldRoot.getText()); setProp(m_ArgsProp, "__arg_subtree", jTextFieldLst.getText()); setProp(m_ArgsProp, "__arg_solution", jTextFieldSolution.getText()); setProp(m_ArgsProp, "__arg_projtag", jTextFieldTags.getText()); setProp(m_ArgsProp, "__arg_ide", jTextFieldIde.getText()); setProp(m_ArgsProp, "__arg_arch", jTextFieldArch.getText()); setProp(m_ArgsProp, "__arg_dll", jRadioButtonDLL.isSelected()); setProp(m_ArgsProp, "__arg_nobuildptb", jCheckBoxNoPtb.isSelected()); setProp(m_ArgsProp, "__arg_nws", jCheckBoxNws.isSelected()); setProp(m_ArgsProp, "__arg_ext", jCheckBoxExt.isSelected()); setProp(m_ArgsProp, "__arg_extroot", jTextFieldExt.getText()); try { File f = File.createTempFile("PTBconf",".ini"); f.deleteOnExit(); FileOutputStream fout = new FileOutputStream(f); Enumeration props = m_ArgsProp.propertyNames(); while (props.hasMoreElements()) { String key = props.nextElement().toString(); String value = m_ArgsProp.getProperty(key); String line = key + "=" + value + "\n"; fout.write(line.getBytes()); } fout.flush(); fout.close(); m_TmpParams = f.getPath(); } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } m_ArgsParser.setArgsFile(m_TmpParams); } else { m_ArgsParser.setRoot(jTextFieldRoot.getText()); m_ArgsParser.setSubtree(jTextFieldLst.getText()); m_ArgsParser.setSolutionFile(jTextFieldSolution.getText()); m_ArgsParser.setProjTag(jTextFieldTags.getText()); m_ArgsParser.setArch(jTextFieldArch.getText()); m_ArgsParser.setDll(jRadioButtonDLL.isSelected(), false); m_ArgsParser.m_nobuildptb = jCheckBoxNoPtb.isSelected(); m_ArgsParser.m_nws = jCheckBoxNws.isSelected(); m_ArgsParser.m_ext = jCheckBoxExt.isSelected(); m_ArgsParser.setExtRoot(jTextFieldExt.getText()); m_ArgsParser.setArgsFile(null); } } public static String nativeFileSeparator(String s) { return s.replace('/',File.separatorChar); } public static String getProp(Properties prop, String key) { return prop.containsKey(key) ? nativeFileSeparator(prop.getProperty(key).trim()) : ""; } public static String portableFileSeparator(String s) { return s.replace(File.separatorChar,'/'); } public static void setProp(Properties prop, String key, String value) { prop.setProperty(key,portableFileSeparator(value)); } public static void setProp(Properties prop, String key, boolean value) { prop.setProperty(key,value ? "yes" : "no"); } public static boolean copyFile(String from, String to) { boolean res = true; if (!from.equals(to)) { try { InputStream in = new FileInputStream(new File(from)); OutputStream out = new FileOutputStream(new File(to)); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); } catch (Exception e) { res = false; System.err.println(e.toString()); e.printStackTrace(); } } return res; } private void setPathText(JTextComponent c, String path, boolean verify) { c.setText(path); if (!verify || ArgsParser.existsPath(path)) { c.setForeground(SystemColor.controlText); c.setToolTipText(""); } else { c.setForeground(Color.red); c.setToolTipText("Path not found"); } } private void setPathText(JTextComponent c, String root, String path) { c.setText(path); if (ArgsParser.existsPath(root + File.separator + path)) { c.setForeground(SystemColor.controlText); c.setToolTipText(""); } else { c.setForeground(Color.red); c.setToolTipText("Path not found"); } } private void processPtbOutput() { String line; while (isPtbRunning()) { try { Thread.sleep(3); while (m_PtbErr != null && m_PtbErr.ready() && (line = m_PtbErr.readLine()) != null) { System.err.println(line); } while (m_PtbOut != null && m_PtbOut.ready() && (line = m_PtbOut.readLine()) != null) { if (line.startsWith("*PTBGUI{* custom")) { processAdditionalParams(); return; } else if (line.startsWith("*PTBGUI{* projects")) { processProjects(); return; } System.out.println(line); } } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } try { while (m_PtbErr != null && m_PtbErr.ready() && (line = m_PtbErr.readLine()) != null) { System.err.println(line); } while (m_PtbOut != null && m_PtbOut.ready() && (line = m_PtbOut.readLine()) != null) { System.out.println(line); } } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } if (m_State == eState.gotProjects || m_State == eState.got3rdparty) { processDone(m_Ptb.exitValue()); return; } System.exit(m_Ptb != null ? m_Ptb.exitValue() : 1); } private void processAdditionalParams() { m_State = eState.got3rdparty; jButtonGOK.setText("Next"); jButtonGCancel.setEnabled(true); int i = jTabbedPane.indexOfComponent(jPanelAdd); jTabbedPane.setEnabledAt(i,true); jTabbedPane.setSelectedIndex(i); jTextField3root.setText(""); jTextField3root.setEnabled(false); jTextFieldCpath.setText(""); jTextFieldCpath.setEnabled(false); jCheckBoxVTuneR.setEnabled(false); jCheckBoxVTuneR.setVisible(false); jCheckBoxVTuneD.setEnabled(false); jCheckBoxVTuneD.setVisible(false); jCheckBoxVTune.setSelected(false); jCheckBoxVTune.setEnabled(false); jPanelUserReq.setVisible(false); boolean vtune = false; String[] userRequests = new String[0]; String[] enabledRequests = new String[0]; try { String line; while (m_PtbOut != null && /*m_PtbOut.ready() &&*/ (line = m_PtbOut.readLine()) != null) { if (line.startsWith("*PTBGUI}*")) { if (vtune) { jCheckBoxVTune.setEnabled(true); jCheckBoxVTuneR.setEnabled(true); jCheckBoxVTuneD.setEnabled(true); jCheckBoxVTune.setSelected( jCheckBoxVTuneR.isSelected() || jCheckBoxVTuneD.isSelected()); jCheckBoxVTuneD.setVisible(jCheckBoxVTune.isSelected()); jCheckBoxVTuneR.setVisible(jCheckBoxVTune.isSelected()); } if (userRequests.length > 0) { jPanelUserReq.setVisible(true); for (int r=0; r < userRequests.length; ++r) { boolean sel = false; for (int e=0; !sel && e < enabledRequests.length; ++e) { sel = userRequests[r].equals( enabledRequests[e] ); } addProject(jListUserReq, userRequests[r], sel); } } return; } String[] kv = line.split("="); if (kv.length > 1) { String k = kv[0].trim(); String v = kv[1].trim(); if (k.equals("ThirdPartyBasePath") || k.equals("XCode_ThirdPartyBasePath")) { m_Key3root = k; jTextField3root.setEnabled(true); setPathText(jTextField3root,nativeFileSeparator(v),true); } else if (k.equals("ThirdParty_C_ncbi") || k.equals("XCode_ThirdParty_C_ncbi")) { m_KeyCpath = k; jTextFieldCpath.setEnabled(true); setPathText(jTextFieldCpath,nativeFileSeparator(v),true); } else if (k.equals("__TweakVTuneR")) { vtune = true; jCheckBoxVTuneR.setSelected(v.equals("yes")); } else if (k.equals("__TweakVTuneD")) { vtune = true; jCheckBoxVTuneD.setSelected(v.equals("yes")); } else if (k.equals("__UserRequests")) { userRequests = v.split(" "); } else if (k.equals("__EnabledUserRequests")) { enabledRequests = v.split(" "); } } } } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } private void doneAdditionalParams() { if (isPtbRunning()) { try { String s; s = "*PTBGUI{* custom" + "\n"; m_PtbIn.write(s.getBytes()); if (jTextField3root.isEnabled()) { s = m_Key3root+" = "+jTextField3root.getText()+"\n"; m_PtbIn.write(s.getBytes()); } if (jTextFieldCpath.isEnabled()) { s = m_KeyCpath+" = "+jTextFieldCpath.getText()+"\n"; m_PtbIn.write(s.getBytes()); } String yn = (jCheckBoxVTune.isSelected() && jCheckBoxVTuneR.isSelected()) ? "yes" : "no"; if (jCheckBoxVTuneR.isEnabled()) { s = "__TweakVTuneR"+" = "+ yn +"\n"; m_PtbIn.write(s.getBytes()); } yn = (jCheckBoxVTune.isSelected() && jCheckBoxVTuneD.isSelected()) ? "yes" : "no"; if (jCheckBoxVTuneD.isEnabled()) { s = "__TweakVTuneD"+" = "+ yn +"\n"; m_PtbIn.write(s.getBytes()); } if (jPanelUserReq.isVisible()) { s = "__EnabledUserRequests ="; DefaultListModel model = (DefaultListModel)jListUserReq.getModel(); for (int i =0; i< model.getSize(); ++i) { JCheckBox b = (JCheckBox)model.getElementAt(i); if (b.isSelected()) { s += " " + b.getText(); } } s += "\n"; m_PtbIn.write(s.getBytes()); } s = "*PTBGUI}* custom" + "\n"; m_PtbIn.write(s.getBytes()); m_PtbIn.flush(); } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } } private void initCheckList(JList list) { list.setModel(new DefaultListModel()); list.setCellRenderer(new CheckListRenderer()); list.addMouseListener(new CheckListMouseAdapter()); list.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jListSelectionChanged(evt); } }); } private void addProject(JList list, String project, boolean selected) { DefaultListModel model = (DefaultListModel)list.getModel(); JCheckBox b = new JCheckBox(); b.setText(project); b.setSelected(selected); model.addElement(b); } private void selectProjects(JList list, boolean select) { DefaultListModel model = (DefaultListModel)list.getModel(); for (int i =0; i< model.getSize(); ++i) { JCheckBox b = (JCheckBox)model.getElementAt(i); b.setSelected(select); } countSelected(); list.repaint(); } private void selectProjects(JList list, Vector<String> selected, Vector<String> unselected) { DefaultListModel model = (DefaultListModel)list.getModel(); for (int i =0; i< model.getSize(); ++i) { JCheckBox b = (JCheckBox)model.getElementAt(i); String prj = b.getText(); if (m_ProjectTags.containsKey(prj)) { String[] tags = m_ProjectTags.get(prj); boolean done = false; for (int t=0; !done && t<tags.length; ++t) { if (unselected.contains(tags[t])) { b.setSelected(false); done = true; } } for (int t=0; !done && t<tags.length; ++t) { if (selected.contains(tags[t])) { b.setSelected(true); done = true; } } } } list.repaint(); } private void checkProjectSelection(JList list, Vector<String> selected, Vector<String> unselected) { DefaultListModel model = (DefaultListModel)list.getModel(); for (int i =0; i< model.getSize(); ++i) { JCheckBox b = (JCheckBox)model.getElementAt(i); String prj = b.getText(); if (m_ProjectTags.containsKey(prj)) { String[] tags = m_ProjectTags.get(prj); boolean hasProhibited = false; for (int t=0; t<tags.length; ++t) { if (unselected.contains(tags[t])) { if (b.isSelected()) { m_UndefSelTags.add(tags[t]); } hasProhibited = true; } } if (!hasProhibited) { for (int t=0; t<tags.length; ++t) { if (selected.contains(tags[t])) { if (!b.isSelected()) { m_UndefSelTags.add(tags[t]); } } } } } } } private int getSelectedCount(JList list) { int count = 0; DefaultListModel model = (DefaultListModel)list.getModel(); for (int i =0; i< model.getSize(); ++i) { JCheckBox b = (JCheckBox)model.getElementAt(i); if (b.isSelected()) { ++count; } } return count; } private void countSelected() { String t = "Applications (" + getSelectedCount(jListApps) + "/" + jListApps.getModel().getSize()+ ")"; jLabelApps.setText(t); t = "Libraries (" + getSelectedCount(jListLibs) + "/" + jListLibs.getModel().getSize()+ ")"; jLabelLibs.setText(t); t = "Other (" + getSelectedCount(jListOther) + "/" + jListOther.getModel().getSize()+ ")"; jLabelOther.setText(t); verifyTagSelection(); } private void verifyTagSelection() { Vector<String> selected = new Vector<String>(); Vector<String> unselected = new Vector<String>(); DefaultListModel model = (DefaultListModel)jListTags.getModel(); for (int i =0; i< model.getSize(); ++i) { JCheckBox b = (JCheckBox)model.getElementAt(i); if (b.isSelected()) { selected.add(b.getText()); } else { unselected.add(b.getText()); } } m_UndefSelTags.clear(); checkProjectSelection(jListApps, selected, unselected); checkProjectSelection(jListLibs, selected, unselected); checkProjectSelection(jListOther, selected, unselected); for (int i =0; i< model.getSize(); ++i) { JCheckBox b = (JCheckBox)model.getElementAt(i); if (m_UndefSelTags.contains(b.getText())) { if (b.isSelected()) { b.setSelected(false); } } } CheckListRenderer r = (CheckListRenderer)(jListTags.getCellRenderer()); r.setUndefinedSelection(m_UndefSelTags); jListTags.repaint(); } private void jListSelectionChanged(java.awt.event.MouseEvent evt) { JList list = (JList) evt.getSource(); if (list == jListTags) { Vector<String> selected = new Vector<String>(); Vector<String> unselected = new Vector<String>(); DefaultListModel model = (DefaultListModel)jListTags.getModel(); int index = jListTags.locationToIndex(evt.getPoint()); JCheckBox item = (JCheckBox)model.getElementAt(index); if (m_UndefSelTags.contains(item.getText()) && !item.isSelected()) { item.setSelected(true); jListTags.repaint(); } if (item.isSelected()) { selected.add(item.getText()); } else { unselected.add(item.getText()); } /* for (int i =0; i< model.getSize(); ++i) { JCheckBox b = (JCheckBox)model.getElementAt(i); if (b.isSelected()) { selected.add(b.getText()); } else { unselected.add(b.getText()); } } */ selectProjects(jListApps, selected, unselected); selectProjects(jListLibs, selected, unselected); selectProjects(jListOther, selected, unselected); } countSelected(); } private void writeSelected(JList list, OutputStream out) { DefaultListModel model = (DefaultListModel)list.getModel(); for (int i =0; i< model.getSize(); ++i) { JCheckBox b = (JCheckBox)model.getElementAt(i); if (b.isSelected()) { try { String s = b.getText() + "\n"; out.write(s.getBytes()); } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } } } private void processProjects() { m_State = eState.gotProjects; jButtonGOK.setText("Generate project"); jButtonGCancel.setEnabled(true); int i = jTabbedPane.indexOfComponent(jPanelPrj); jTabbedPane.setEnabledAt(i,true); jTabbedPane.setSelectedIndex(i); SortedSet<String> alltags = new TreeSet<String>(); try { String line; while (m_PtbOut != null && /*m_PtbOut.ready() &&*/ (line = m_PtbOut.readLine()) != null) { if (line.startsWith("*PTBGUI}*")) { Iterator<String> tt = alltags.iterator(); while (tt.hasNext()) { addProject(jListTags,tt.next(),false); } countSelected(); return; } String[] kv = line.split(","); if (kv.length > 2) { String prj = kv[0].trim(); String type = kv[1].trim(); boolean selected = kv[2].trim().equals("select"); if (type.equals("lib")) { addProject(jListLibs,prj,selected); } else if (type.equals("app")) { addProject(jListApps,prj,selected); } else { addProject(jListOther,prj,selected); } if (kv.length > 4) { String[] tags = kv[4].trim().split("/"); for (int t=0; t<tags.length; ++t) { alltags.add(tags[t]); } m_ProjectTags.put(prj, tags); } } } } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } private void doneProjects() { if (isPtbRunning()) { try { String s; s = "*PTBGUI{* projects" + "\n"; m_PtbIn.write(s.getBytes()); writeSelected(jListApps, m_PtbIn); writeSelected(jListLibs, m_PtbIn); writeSelected(jListOther, m_PtbIn); s = "*PTBGUI}* projects" + "\n"; m_PtbIn.write(s.getBytes()); m_PtbIn.flush(); } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } } private void processDone(int exitcode) { m_State = eState.donePtb; jButtonGOK.setVisible(false); jButtonGCancel.setEnabled(true); jButtonGCancel.setText("Finish"); int i = jTabbedPane.indexOfComponent(jPanelDone); jTabbedPane.setEnabledAt(i,true); jTabbedPane.setSelectedIndex(i); if (exitcode == 0) { jLabelDone.setText("Configuration has completed successfully"); jLabelSln.setText(m_ArgsParser.getSolution()); jLabelSln.setVisible(true); jLabelGen.setVisible(true); } else { jLabelDone.setText("Configuration has FAILED"); jLabelSln.setVisible(false); jLabelGen.setVisible(false); } File args = new File(m_ArgsParser.getSolution()); m_Params = args.getParent() + File.separator + "project_tree_builder.ini.custom"; File prm = new File(m_Params); jButtonSave.setEnabled(prm.exists()); } private void startPtb() { updateData(); String[] cmdline = m_ArgsParser.createCommandline(); for (int i=0; i<cmdline.length; ++i) { System.err.print(cmdline[i]); System.err.print(" "); } System.err.println(""); Runtime r = Runtime.getRuntime(); try { String cwd = System.getProperty("user.dir"); m_Ptb = r.exec(cmdline, null, new File(cwd)); m_PtbIn = m_Ptb.getOutputStream(); InputStream out = m_Ptb.getInputStream(); InputStream err = m_Ptb.getErrorStream(); m_PtbOut = new BufferedReader(new InputStreamReader(out)); m_PtbErr = new BufferedReader(new InputStreamReader(err)); } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } private void stopPtb() { if (isPtbRunning()) { try { String s; s = "*PTBGUIabort*" + "\n"; m_PtbIn.write(s.getBytes()); m_PtbIn.flush(); for (int i=0; i<5; ++i) { if (isPtbRunning()) { Thread.sleep(300); } else { break; } } } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } if (isPtbRunning()) { m_Ptb.destroy(); } if (ArgsParser.existsPath(m_TmpParams)) { System.gc(); (new File(m_TmpParams)).delete(); } } private boolean isPtbRunning() { boolean isRunning = false; if (m_Ptb != null) { try { m_Ptb.exitValue(); } catch (IllegalThreadStateException e) { isRunning = true; } } return isRunning; } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jTabbedPane = new javax.swing.JTabbedPane(); jPanelCmnd = new javax.swing.JPanel(); jTextFieldTags = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jTextFieldLst = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jButtonLst = new javax.swing.JButton(); jLabel11 = new javax.swing.JLabel(); jButtonArgs = new javax.swing.JButton(); jRadioButtonStatic = new javax.swing.JRadioButton(); jRadioButtonDLL = new javax.swing.JRadioButton(); jSeparator2 = new javax.swing.JSeparator(); jLabel14 = new javax.swing.JLabel(); jLabelArgs = new javax.swing.JLabel(); jButtonArgsReset = new javax.swing.JButton(); jButtonKTags = new javax.swing.JButton(); jLabel10 = new javax.swing.JLabel(); jTextFieldLstTags = new javax.swing.JTextField(); jPanelAdvanced = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jTextFieldPtb = new javax.swing.JTextField(); jButtonPtb = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); jTextFieldSolution = new javax.swing.JTextField(); jCheckBoxNoPtb = new javax.swing.JCheckBox(); jCheckBoxNws = new javax.swing.JCheckBox(); jCheckBoxExt = new javax.swing.JCheckBox(); jTextFieldExt = new javax.swing.JTextField(); jLabel12 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jTextFieldIde = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); jTextFieldArch = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jTextFieldRoot = new javax.swing.JTextField(); jButtonMore = new javax.swing.JButton(); jPanelAdd = new javax.swing.JPanel(); jLabel8 = new javax.swing.JLabel(); jTextField3root = new javax.swing.JTextField(); jLabel9 = new javax.swing.JLabel(); jTextFieldCpath = new javax.swing.JTextField(); jCheckBoxVTuneR = new javax.swing.JCheckBox(); jCheckBoxVTuneD = new javax.swing.JCheckBox(); jCheckBoxVTune = new javax.swing.JCheckBox(); jPanelUserReq = new javax.swing.JPanel(); jLabelUserReq = new javax.swing.JLabel(); jScrollPane5 = new javax.swing.JScrollPane(); jListUserReq = new javax.swing.JList(); jPanelPrj = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabelApps = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); jListApps = new javax.swing.JList(); jButtonAppsPlus = new javax.swing.JButton(); jButtonAppsMinus = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jLabelLibs = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); jListLibs = new javax.swing.JList(); jButtonLibsMinus = new javax.swing.JButton(); jButtonLibsPlus = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); jLabelOther = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); jListOther = new javax.swing.JList(); jButtonOtherMinus = new javax.swing.JButton(); jButtonOtherPlus = new javax.swing.JButton(); jPanel5 = new javax.swing.JPanel(); jLabelTags = new javax.swing.JLabel(); jScrollPane4 = new javax.swing.JScrollPane(); jListTags = new javax.swing.JList(); jPanelDone = new javax.swing.JPanel(); jLabelDone = new javax.swing.JLabel(); jButtonSave = new javax.swing.JButton(); jButtonStartOver = new javax.swing.JButton(); jLabelGen = new javax.swing.JLabel(); jLabelSln = new javax.swing.JLabel(); jButtonGCancel = new javax.swing.JButton(); jButtonGOK = new javax.swing.JButton(); jLabel13 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("The Toolkit configuration parameters"); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); jTextFieldTags.setText("jTextFieldTags"); jLabel4.setText("Use project tags"); jTextFieldLst.setText("jTextFieldLst"); jTextFieldLst.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { jTextFieldLstFocusLost(evt); } }); jLabel3.setText("Subtree, or LST file"); jButtonLst.setText("..."); jButtonLst.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonLstActionPerformed(evt); } }); jLabel11.setText("Originally loaded from"); jButtonArgs.setText("Load from file..."); jButtonArgs.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonArgsActionPerformed(evt); } }); jRadioButtonStatic.setText("Static"); jRadioButtonStatic.setEnabled(false); jRadioButtonStatic.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButtonStaticActionPerformed(evt); } }); jRadioButtonDLL.setText("Dynamic"); jRadioButtonDLL.setEnabled(false); jRadioButtonDLL.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButtonDLLActionPerformed(evt); } }); jLabel14.setText("Build libraries as"); jLabelArgs.setText("l"); jLabelArgs.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jButtonArgsReset.setText("Reset"); jButtonArgsReset.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonArgsResetActionPerformed(evt); } }); jButtonKTags.setText("..."); jButtonKTags.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonKTagsActionPerformed(evt); } }); jLabel10.setText("Default project tags"); jTextFieldLstTags.setEditable(false); jTextFieldLstTags.setText("jTextFieldLstTags"); org.jdesktop.layout.GroupLayout jPanelCmndLayout = new org.jdesktop.layout.GroupLayout(jPanelCmnd); jPanelCmnd.setLayout(jPanelCmndLayout); jPanelCmndLayout.setHorizontalGroup( jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelCmndLayout.createSequentialGroup() .addContainerGap() .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelCmndLayout.createSequentialGroup() .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelCmndLayout.createSequentialGroup() .add(jLabel14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 149, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) .add(org.jdesktop.layout.GroupLayout.LEADING, jRadioButtonDLL, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, jRadioButtonStatic, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE))) .add(jSeparator2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 624, Short.MAX_VALUE) .add(jPanelCmndLayout.createSequentialGroup() .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(jLabel11, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(jButtonArgs, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 167, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabelArgs, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .add(jButtonArgsReset, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 87, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanelCmndLayout.createSequentialGroup() .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, jPanelCmndLayout.createSequentialGroup() .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 149, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jTextFieldTags, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)) .add(jPanelCmndLayout.createSequentialGroup() .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 148, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jTextFieldLst, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE))) .add(18, 18, 18) .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jButtonKTags, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jButtonLst, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))) .addContainerGap()) .add(jPanelCmndLayout.createSequentialGroup() .add(jLabel10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 149, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jTextFieldLstTags, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE) .add(83, 83, 83)))) ); jPanelCmndLayout.setVerticalGroup( jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelCmndLayout.createSequentialGroup() .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelCmndLayout.createSequentialGroup() .addContainerGap() .add(jRadioButtonStatic) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jRadioButtonDLL)) .add(jPanelCmndLayout.createSequentialGroup() .add(24, 24, 24) .add(jLabel14))) .add(19, 19, 19) .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel3) .add(jTextFieldLst, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jButtonLst, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel4) .add(jTextFieldTags, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jButtonKTags, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(jLabel10) .add(jTextFieldLstTags, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 27, Short.MAX_VALUE) .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jButtonArgs, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jButtonArgsReset)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanelCmndLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel11) .add(jLabelArgs)) .add(36, 36, 36)) ); jTabbedPane.addTab("Configuration", jPanelCmnd); jLabel1.setText("Project tree builder"); jTextFieldPtb.setText("jTextFieldPtb"); jButtonPtb.setText("..."); jButtonPtb.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonPtbActionPerformed(evt); } }); jLabel5.setText("Solution to generate"); jTextFieldSolution.setText("jTextFieldSolution"); jCheckBoxNoPtb.setText("Exclude 'Build PTB' step from CONFIGURE project"); jCheckBoxNws.setText("Do not scan the whole source tree for missing project dependencies"); jCheckBoxExt.setText("Use external libraries instead of missing in-tree ones"); jTextFieldExt.setText("jTextFieldExt"); jLabel12.setText("Look for missing libraries in this tree"); jLabel6.setText("Target IDE"); jTextFieldIde.setEditable(false); jTextFieldIde.setText("jTextFieldIde"); jLabel7.setText("Target architecture"); jTextFieldArch.setText("jTextFieldArch"); jLabel2.setText("Source root"); jTextFieldRoot.setText("jTextFieldRoot"); jTextFieldRoot.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { jTextFieldRootFocusLost(evt); } }); jButtonMore.setText("more >"); jButtonMore.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonMoreActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanelAdvancedLayout = new org.jdesktop.layout.GroupLayout(jPanelAdvanced); jPanelAdvanced.setLayout(jPanelAdvancedLayout); jPanelAdvancedLayout.setHorizontalGroup( jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelAdvancedLayout.createSequentialGroup() .addContainerGap() .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelAdvancedLayout.createSequentialGroup() .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel12, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE) .add(jLabel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE) .add(jLabel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE) .add(jLabel7, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelAdvancedLayout.createSequentialGroup() .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) .add(org.jdesktop.layout.GroupLayout.LEADING, jTextFieldIde) .add(org.jdesktop.layout.GroupLayout.LEADING, jTextFieldArch, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)) .add(289, 289, 289)) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanelAdvancedLayout.createSequentialGroup() .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, jTextFieldSolution, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 397, Short.MAX_VALUE) .add(jTextFieldExt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 397, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, jButtonMore)) .addContainerGap()))) .add(jPanelAdvancedLayout.createSequentialGroup() .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(jCheckBoxNws, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 444, Short.MAX_VALUE) .add(jCheckBoxNoPtb, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 444, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, jCheckBoxExt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 444, Short.MAX_VALUE)) .add(190, 190, 190)) .add(jPanelAdvancedLayout.createSequentialGroup() .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelAdvancedLayout.createSequentialGroup() .add(jTextFieldPtb, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jButtonPtb, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(jTextFieldRoot, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)) .addContainerGap()))) ); jPanelAdvancedLayout.setVerticalGroup( jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelAdvancedLayout.createSequentialGroup() .addContainerGap() .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel6) .add(jTextFieldIde, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel7) .add(jTextFieldArch, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel5) .add(jTextFieldSolution, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel12) .add(jTextFieldExt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jButtonMore) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jCheckBoxNoPtb) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jCheckBoxNws) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jCheckBoxExt) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel1) .add(jTextFieldPtb, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jButtonPtb, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanelAdvancedLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel2) .add(jTextFieldRoot, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jTabbedPane.addTab("Advanced", jPanelAdvanced); jLabel8.setText("Root directory of 3-rd party libraries"); jTextField3root.setText("jTextField3root"); jLabel9.setText("Path to the NCBI C Toolkit"); jTextFieldCpath.setText("jTextFieldCpath"); jCheckBoxVTuneR.setText("Release"); jCheckBoxVTuneD.setText("Debug"); jCheckBoxVTune.setText("Add VTune configurations:"); jCheckBoxVTune.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBoxVTuneActionPerformed(evt); } }); jLabelUserReq.setText("Additional requests"); jListUserReq.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane5.setViewportView(jListUserReq); org.jdesktop.layout.GroupLayout jPanelUserReqLayout = new org.jdesktop.layout.GroupLayout(jPanelUserReq); jPanelUserReq.setLayout(jPanelUserReqLayout); jPanelUserReqLayout.setHorizontalGroup( jPanelUserReqLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelUserReqLayout.createSequentialGroup() .addContainerGap() .add(jPanelUserReqLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jScrollPane5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 122, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabelUserReq, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); jPanelUserReqLayout.setVerticalGroup( jPanelUserReqLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelUserReqLayout.createSequentialGroup() .addContainerGap() .add(jLabelUserReq) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jScrollPane5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE) .addContainerGap()) ); org.jdesktop.layout.GroupLayout jPanelAddLayout = new org.jdesktop.layout.GroupLayout(jPanelAdd); jPanelAdd.setLayout(jPanelAddLayout); jPanelAddLayout.setHorizontalGroup( jPanelAddLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelAddLayout.createSequentialGroup() .addContainerGap() .add(jPanelAddLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelUserReq, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jPanelAddLayout.createSequentialGroup() .add(jPanelAddLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(jCheckBoxVTune, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(jLabel9, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(jLabel8, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE)) .add(jPanelAddLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelAddLayout.createSequentialGroup() .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jPanelAddLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jTextFieldCpath, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE) .add(jTextField3root, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE))) .add(jPanelAddLayout.createSequentialGroup() .add(72, 72, 72) .add(jCheckBoxVTuneR) .add(18, 18, 18) .add(jCheckBoxVTuneD))))) .addContainerGap()) ); jPanelAddLayout.setVerticalGroup( jPanelAddLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelAddLayout.createSequentialGroup() .addContainerGap() .add(jPanelAddLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel8) .add(jTextField3root, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanelAddLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel9) .add(jTextFieldCpath, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanelAddLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jCheckBoxVTuneR) .add(jCheckBoxVTuneD) .add(jCheckBoxVTune)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jPanelUserReq, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); jTabbedPane.addTab("Libraries and Tools", jPanelAdd); jPanelPrj.setLayout(new java.awt.GridLayout(1, 0)); jPanel2.setPreferredSize(new java.awt.Dimension(165, 280)); jLabelApps.setText("Applications"); jListApps.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane1.setViewportView(jListApps); jButtonAppsPlus.setText("+all"); jButtonAppsPlus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAppsPlusActionPerformed(evt); } }); jButtonAppsMinus.setText("-all"); jButtonAppsMinus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAppsMinusActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE) .add(jPanel2Layout.createSequentialGroup() .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel2Layout.createSequentialGroup() .add(jButtonAppsPlus) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jButtonAppsMinus)) .add(jLabelApps)) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel2Layout.createSequentialGroup() .add(jLabelApps) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jButtonAppsPlus) .add(jButtonAppsMinus))) ); jPanel3.setPreferredSize(new java.awt.Dimension(160, 280)); jLabelLibs.setText("Libraries"); jListLibs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane2.setViewportView(jListLibs); jButtonLibsMinus.setText("-all"); jButtonLibsMinus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonLibsMinusActionPerformed(evt); } }); jButtonLibsPlus.setText("+all"); jButtonLibsPlus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonLibsPlusActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE) .add(jPanel3Layout.createSequentialGroup() .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabelLibs) .add(jPanel3Layout.createSequentialGroup() .add(jButtonLibsPlus) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jButtonLibsMinus))) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup() .add(jLabelLibs) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jButtonLibsPlus) .add(jButtonLibsMinus))) ); jPanel4.setPreferredSize(new java.awt.Dimension(150, 280)); jLabelOther.setText("Other"); jListOther.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane3.setViewportView(jListOther); jButtonOtherMinus.setText("-all"); jButtonOtherMinus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonOtherMinusActionPerformed(evt); } }); jButtonOtherPlus.setText("+all"); jButtonOtherPlus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonOtherPlusActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE) .add(jPanel4Layout.createSequentialGroup() .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabelOther) .add(jPanel4Layout.createSequentialGroup() .add(jButtonOtherPlus) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jButtonOtherMinus))) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel4Layout.createSequentialGroup() .add(jLabelOther) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jButtonOtherPlus) .add(jButtonOtherMinus))) ); jPanel5.setPreferredSize(new java.awt.Dimension(140, 280)); jLabelTags.setText("Tags"); jListTags.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane4.setViewportView(jListTags); org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel5Layout.createSequentialGroup() .add(jLabelTags) .addContainerGap(111, Short.MAX_VALUE)) .add(jScrollPane4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel5Layout.createSequentialGroup() .add(jLabelTags) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jScrollPane4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) .add(29, 29, 29)) ); org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createSequentialGroup() .addContainerGap() .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE) .add(29, 29, 29)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel1Layout.createSequentialGroup() .addContainerGap() .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE) .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE) .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE)) .addContainerGap()) ); jPanelPrj.add(jPanel1); jTabbedPane.addTab("Projects", jPanelPrj); jLabelDone.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelDone.setText("jLabelDone"); jButtonSave.setText("Save configuration parameters into a file..."); jButtonSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSaveActionPerformed(evt); } }); jButtonStartOver.setText("Start over"); jButtonStartOver.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonStartOverActionPerformed(evt); } }); jLabelGen.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelGen.setText("Generated project file:"); jLabelSln.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabelSln.setText("jLabelSln"); org.jdesktop.layout.GroupLayout jPanelDoneLayout = new org.jdesktop.layout.GroupLayout(jPanelDone); jPanelDone.setLayout(jPanelDoneLayout); jPanelDoneLayout.setHorizontalGroup( jPanelDoneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanelDoneLayout.createSequentialGroup() .addContainerGap() .add(jPanelDoneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jButtonStartOver, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 305, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(org.jdesktop.layout.GroupLayout.TRAILING, jButtonSave, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 305, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(jLabelDone, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 624, Short.MAX_VALUE) .add(jLabelGen, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 624, Short.MAX_VALUE) .add(jLabelSln, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 624, Short.MAX_VALUE)) .addContainerGap()) ); jPanelDoneLayout.setVerticalGroup( jPanelDoneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanelDoneLayout.createSequentialGroup() .add(29, 29, 29) .add(jLabelDone) .add(18, 18, 18) .add(jLabelGen) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jLabelSln) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 118, Short.MAX_VALUE) .add(jButtonSave) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jButtonStartOver) .addContainerGap()) ); jTabbedPane.addTab("Done", jPanelDone); jButtonGCancel.setText("Cancel"); jButtonGCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonGCancelActionPerformed(evt); } }); jButtonGOK.setText("Next"); jButtonGOK.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonGOKActionPerformed(evt); } }); jLabel13.setText(" version 1.3.4"); jLabel13.setToolTipText(""); jLabel13.setEnabled(false); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(jLabel13) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(jButtonGOK, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 276, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(jButtonGCancel)) .add(jTabbedPane)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .addContainerGap() .add(jTabbedPane) .add(11, 11, 11) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jButtonGCancel) .add(jButtonGOK) .add(jLabel13)) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButtonPtbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPtbActionPerformed JFileChooser fd = new JFileChooser(); fd.setDialogTitle(jLabel1.getText()); File f = new File(jTextFieldPtb.getText()); fd.setCurrentDirectory(f.getParentFile()); if (fd.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { setPathText(jTextFieldPtb, fd.getSelectedFile().getPath(),true); } }//GEN-LAST:event_jButtonPtbActionPerformed private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing stopPtb(); processPtbOutput(); }//GEN-LAST:event_formWindowClosing private void jButtonLstActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLstActionPerformed JFileChooser fd = new JFileChooser(); fd.setDialogTitle(jLabel3.getText()); String root = jTextFieldRoot.getText(); String lst = root + File.separator + jTextFieldLst.getText(); File flst = new File(ArgsParser.existsPath(lst) ? lst : root); fd.setCurrentDirectory(flst.isDirectory()? flst : flst.getParentFile()); if (fd.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { String f = fd.getSelectedFile().getPath(); if (f.startsWith(root)) { f = f.substring(root.length()); if (f.startsWith("\\") || f.startsWith("/")) { f = f.substring(1); } setPathText(jTextFieldLst, root, f); } else { JOptionPane.showMessageDialog( this, "The file must be in the same tree", "Error", JOptionPane.ERROR_MESSAGE); } initTagsFromSubtree(); } }//GEN-LAST:event_jButtonLstActionPerformed private void jButtonArgsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonArgsActionPerformed JFileChooser fd = new JFileChooser(); fd.setDialogTitle(jLabel3.getText()); String args = jLabelArgs.getText(); if (ArgsParser.existsPath(args)) { File f = new File(args); fd.setCurrentDirectory(f.getParentFile()); } else { fd.setCurrentDirectory(new File(".")); } if (fd.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { initData(fd.getSelectedFile().getPath(), false); } }//GEN-LAST:event_jButtonArgsActionPerformed private void jButtonGCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGCancelActionPerformed stopPtb(); processPtbOutput(); }//GEN-LAST:event_jButtonGCancelActionPerformed private void jButtonGOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGOKActionPerformed if (m_State == eState.beforePtb) { startPtb(); } else if (m_State == eState.got3rdparty) { doneAdditionalParams(); } else if (m_State == eState.gotProjects) { doneProjects(); } if (isPtbRunning()) { jButtonGOK.setText("Please wait..."); jButtonGOK.setForeground(Color.red); jButtonGOK.paintImmediately(0,0, jButtonGOK.getWidth(), jButtonGOK.getHeight()); jButtonGOK.setForeground(SystemColor.controlText); jButtonGCancel.setText("Stop"); } processPtbOutput(); }//GEN-LAST:event_jButtonGOKActionPerformed private void jButtonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveActionPerformed JFileChooser fd = new JFileChooser(); fd.setDialogTitle(jButtonSave.getText()); String args = jLabelArgs.getText(); if (ArgsParser.existsPath(args)) { File f = new File(args); fd.setCurrentDirectory(f.getParentFile()); } else { fd.setCurrentDirectory(new File(".")); } if (fd.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { try { String f = fd.getSelectedFile().getPath(); copyFile(m_Params, f); } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } }//GEN-LAST:event_jButtonSaveActionPerformed private void jButtonArgsResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonArgsResetActionPerformed initData(); }//GEN-LAST:event_jButtonArgsResetActionPerformed private void jButtonAppsPlusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAppsPlusActionPerformed selectProjects(jListApps, true); }//GEN-LAST:event_jButtonAppsPlusActionPerformed private void jButtonAppsMinusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAppsMinusActionPerformed selectProjects(jListApps, false); }//GEN-LAST:event_jButtonAppsMinusActionPerformed private void jButtonLibsPlusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLibsPlusActionPerformed selectProjects(jListLibs, true); }//GEN-LAST:event_jButtonLibsPlusActionPerformed private void jButtonLibsMinusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLibsMinusActionPerformed selectProjects(jListLibs, false); }//GEN-LAST:event_jButtonLibsMinusActionPerformed private void jButtonOtherPlusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOtherPlusActionPerformed selectProjects(jListOther, true); }//GEN-LAST:event_jButtonOtherPlusActionPerformed private void jButtonOtherMinusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOtherMinusActionPerformed selectProjects(jListOther, false); }//GEN-LAST:event_jButtonOtherMinusActionPerformed private void jButtonStartOverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonStartOverActionPerformed resetState(); initData(); }//GEN-LAST:event_jButtonStartOverActionPerformed private void jButtonMoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMoreActionPerformed showMoreAdvanced(!jCheckBoxNoPtb.isVisible()); }//GEN-LAST:event_jButtonMoreActionPerformed private void jCheckBoxVTuneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxVTuneActionPerformed jCheckBoxVTuneD.setVisible(jCheckBoxVTune.isSelected()); jCheckBoxVTuneR.setVisible(jCheckBoxVTune.isSelected()); }//GEN-LAST:event_jCheckBoxVTuneActionPerformed private void jRadioButtonStaticActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonStaticActionPerformed adjustBuildType(); }//GEN-LAST:event_jRadioButtonStaticActionPerformed private void jRadioButtonDLLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonDLLActionPerformed adjustBuildType(); }//GEN-LAST:event_jRadioButtonDLLActionPerformed private void jButtonKTagsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonKTagsActionPerformed if (m_KtagsDlg == null) { m_KtagsDlg = new KTagsDialog(this,false); m_KtagsDlg.setLocationRelativeTo(this); } if (!m_KtagsDlg.isVisible()) { m_KtagsDlg.setTextData(m_KnownTags, m_CompositeTags); m_KtagsDlg.setVisible(true); } }//GEN-LAST:event_jButtonKTagsActionPerformed private void jTextFieldLstFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldLstFocusLost initTagsFromSubtree(); }//GEN-LAST:event_jTextFieldLstFocusLost private void jTextFieldRootFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldRootFocusLost initTagsFromSubtree(); }//GEN-LAST:event_jTextFieldRootFocusLost /** * @param args the command line arguments */ public static void main(String args[]) { PtbguiMain ptbgui = new PtbguiMain(); ptbgui.initData(args); ptbgui.setLocationRelativeTo(null); ptbgui.setVisible(true); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButtonAppsMinus; private javax.swing.JButton jButtonAppsPlus; private javax.swing.JButton jButtonArgs; private javax.swing.JButton jButtonArgsReset; private javax.swing.JButton jButtonGCancel; private javax.swing.JButton jButtonGOK; private javax.swing.JButton jButtonKTags; private javax.swing.JButton jButtonLibsMinus; private javax.swing.JButton jButtonLibsPlus; private javax.swing.JButton jButtonLst; private javax.swing.JButton jButtonMore; private javax.swing.JButton jButtonOtherMinus; private javax.swing.JButton jButtonOtherPlus; private javax.swing.JButton jButtonPtb; private javax.swing.JButton jButtonSave; private javax.swing.JButton jButtonStartOver; private javax.swing.JCheckBox jCheckBoxExt; private javax.swing.JCheckBox jCheckBoxNoPtb; private javax.swing.JCheckBox jCheckBoxNws; private javax.swing.JCheckBox jCheckBoxVTune; private javax.swing.JCheckBox jCheckBoxVTuneD; private javax.swing.JCheckBox jCheckBoxVTuneR; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JLabel jLabelApps; private javax.swing.JLabel jLabelArgs; private javax.swing.JLabel jLabelDone; private javax.swing.JLabel jLabelGen; private javax.swing.JLabel jLabelLibs; private javax.swing.JLabel jLabelOther; private javax.swing.JLabel jLabelSln; private javax.swing.JLabel jLabelTags; private javax.swing.JLabel jLabelUserReq; private javax.swing.JList jListApps; private javax.swing.JList jListLibs; private javax.swing.JList jListOther; private javax.swing.JList jListTags; private javax.swing.JList jListUserReq; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanelAdd; private javax.swing.JPanel jPanelAdvanced; private javax.swing.JPanel jPanelCmnd; private javax.swing.JPanel jPanelDone; private javax.swing.JPanel jPanelPrj; private javax.swing.JPanel jPanelUserReq; private javax.swing.JRadioButton jRadioButtonDLL; private javax.swing.JRadioButton jRadioButtonStatic; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JScrollPane jScrollPane4; private javax.swing.JScrollPane jScrollPane5; private javax.swing.JSeparator jSeparator2; private javax.swing.JTabbedPane jTabbedPane; private javax.swing.JTextField jTextField3root; private javax.swing.JTextField jTextFieldArch; private javax.swing.JTextField jTextFieldCpath; private javax.swing.JTextField jTextFieldExt; private javax.swing.JTextField jTextFieldIde; private javax.swing.JTextField jTextFieldLst; private javax.swing.JTextField jTextFieldLstTags; private javax.swing.JTextField jTextFieldPtb; private javax.swing.JTextField jTextFieldRoot; private javax.swing.JTextField jTextFieldSolution; private javax.swing.JTextField jTextFieldTags; // End of variables declaration//GEN-END:variables }
kyungtaekLIM/PSI-BLASTexB
src/ncbi-blast-2.5.0+/c++/src/build-system/project_tree_builder_gui/src/ptbgui/PtbguiMain.java
Java
lgpl-3.0
94,823
[ 30522, 1013, 1008, 1002, 8909, 1024, 13866, 2497, 25698, 24238, 1012, 9262, 4008, 26187, 2692, 2549, 2297, 1011, 5641, 1011, 2385, 2403, 1024, 4805, 1024, 5187, 2480, 2175, 29091, 2080, 1002, 1008, 1027, 1027, 1027, 1027, 1027, 1027, 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...
<?php use_helper("sfDoctrineSuperPager"); $pagerAjaxUrl = "listingAdmin/listItemsAjax?id=$listing->id"; $url = "listingAdmin/edit?id=$listing->id"; $listingManager = listingManager::getInstance(); $defn = $listingManager->getTemplateDefinition($listing->template); sfContext::getInstance()->getResponse()->setTitle(htmlentities('Editing listing - ' . $sitetree->title, null, 'utf-8', false), false); slot('breadcrumbs', get_partial('sitetree/breadcrumbs', array('sitetree' => $sitetree))); ?> <div id="sf_admin_container"> <h1><?php echo $sitetree->getTitle(); ?></h1> <div id="sf_admin_header"> <?php echo include_partial('sitetree/sitetreeInfo', array('sitetree'=>$sitetree)); ?> <div class='sitetreeInfo'> Template is <span class="site_sitetree_<?php if (!$sitetree->is_active) echo 'not_'; ?>published"> <?php echo $defn['name']; ?> </span> <?php if ($canPublish) : ?>(change template on Properties tab)<?php endif; ?> </div> <?php if (isset($defn['help'])) : ?> <div class='sitetreeInfo'> <h3><?php echo image_tag('/sfCmsPlugin/images/help.png', array('style'=>'vertical-align: top;')); ?> Template help</h3> <p><?php echo str_replace('%SITETREE%', $sitetree->getTitle(), $defn['help']); ?></p> </div> <?php endif; ?> </div> <?php $content = get_slot('cms_js'); ?> <?php slot('cms_js'); if (sfConfig::get('app_site_use_slots', false)) echo $content; // If using slot, combine them ?> <script type="text/javascript"> $(document).addEvent('domready', function () { new SimpleTabs('listing_<?php echo $sitetree->route_name; ?>_tabs', { selector: 'h4' }); }); </script> <?php end_slot(); ?> <?php if (!sfConfig::get('app_site_use_slots', false)) include_slot('cms_js'); ?> <div id="sf_admin_content"> <div id="listing_<?php echo $sitetree->route_name; ?>_tabs"> <h4>Items</h4> <div id="listing_<?php echo $sitetree->route_name; ?>_items"> <?php if ($sf_user->hasFlash('listing_notice')): ?> <div class="notice"><?php echo $sf_user->getFlash('listing_notice'); ?></div> <?php endif; ?> <p>These are the items in our list. The ordering here is the same as the ordering used on the frontend of the site (<strong><?php echo $listing->use_custom_order ? 'manually' : $listingManager->getListItemOrdering($listing->template); ?></strong>).</p> <?php echo super_pager_render($pager, $url, $pagerAjaxUrl); ?> <?php if (0 == $pager->getNbResults() && (!isset($defn['use_categories']) || true === $defn['use_categories'])) : ?> <p><span class="site_sitetree_not_published">NOTE:</span>Make sure you set up your categories on the Categories tab before adding an item.</p> <?php endif; ?> <ul class="sf_admin_actions"> <li class="sf_admin_action_new"> <?php echo link_to('Create new item', 'listingAdmin/createItem?id=' . $listing->id); ?> </li> <?php if ($canPublish) : ?> <?php $activeSites = siteManager::getInstance()->getActiveSites(); ?> <?php if (!empty($activeSites) && 1 < count($activeSites)) : ?> <li class="sf_admin_action_import"> <?php echo link_to('Import items', 'listingAdmin/importItems?id=' . $listing->id); ?> </li> <?php endif; ?> <?php endif; ?> </ul> <?php $content = get_slot('cms_js'); ?> <?php slot('cms_js'); if (sfConfig::get('app_site_use_slots', false)) echo $content; // If using slot, combine them ?> <script type="text/javascript"> $(document).addEvent('domready', function () { $$('.btn_remove').addEvent('click', function () { return confirm('Are you sure you want to delete this item - it cannot be undone'); }); }); </script> <?php end_slot(); ?> <?php if (!sfConfig::get('app_site_use_slots', false)) include_slot('cms_js'); ?> </div> <?php if (!isset($defn['use_categories']) || true === $defn['use_categories']) : ?> <h4>Categories</h4> <div id="listing_<?php echo $sitetree->route_name; ?>_categories"> <?php echo include_component('listingAdmin', 'categoryEditor', array('listing' => $listing, 'formTarget' => 'listing_'.$sitetree->route_name.'_categories', 'canAdmin'=>$canAdmin)); ?> </div> <?php endif ?> <h4>Content</h4> <div id="listing_<?php echo $sitetree->route_name; ?>_content" class="listing_content"> <?php $url = 'sitetree/index'; echo include_component('contentAdmin', 'editor', array('contentGroup' => $contentGroup, 'cancelUrl'=>$url, 'formTarget'=>'#listing_'.$sitetree->route_name.'_content')); ?> </div> <h4>Properties</h4> <div id="listing_<?php echo $sitetree->route_name; ?>_properties"> <div class="content_border_thin"> <?php if ($sitetree->is_locked) : ?> <p>Cannot edit properties of a locked page</p> <?php elseif (!$canPublish) : ?> <p>You do not have the correct permissions to edit the properties of this page.</p> <?php else: ?> <?php if ($form->hasErrors()): ?> <div class="error">Please correct the following errors</div> <?php endif; ?> <?php if ($sf_user->hasFlash('edit_notice')): ?> <div class="notice"><?php echo $sf_user->getFlash('edit_notice'); ?></div> <?php endif; ?> <p><span class="site_sitetree_not_published">WARNING:</span> Changing the template will delete the existing page content, unless the template contains the same fields.</p> <form method="post" action="#listing_<?php echo $sitetree->route_name; ?>_properties"> <?php echo $form->renderGlobalErrors(); echo $form->renderHiddenFields(); ?> <fieldset id="sf_fieldset_none"> <?php foreach ($form as $idx => $widget): if (!$widget->isHidden()) : ?> <div class="sf_admin_form_row <?php if ($widget->hasError()) echo 'errors'; ?>"> <?php echo $widget->renderError(); ?> <div> <?php echo $widget->renderLabel(); ?> <div class="content"><?php echo $widget->render(); ?></div> <?php if ($help = $widget->renderHelp()) : ?><div class="help"><?php echo str_replace('<br />', '', $help); ?></div><?php endif; ?> </div> </div> <?php endif; endforeach; ?> </fieldset> <ul class="sf_admin_actions"> <li class="sf_admin_action_save"><input type="submit" value="Save" /></li> <li class="sf_admin_action_list"><?php echo link_to('Back to sitetree', 'sitetree/index'); ?></li> </ul> </form> <?php endif; ?> </div> </div> </div> </div> </div>
angelsk/sfCmsPlugin
modules/listingAdmin/templates/editSuccess.php
PHP
mit
7,723
[ 30522, 1026, 1029, 25718, 2224, 1035, 2393, 2121, 1006, 1000, 16420, 3527, 6593, 11467, 6342, 4842, 13704, 2099, 1000, 1007, 1025, 1002, 3931, 14220, 8528, 3126, 2140, 1027, 1000, 10328, 4215, 10020, 30524, 1028, 8909, 1000, 1025, 1002, 244...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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) 2014 Ambroz Bizjak * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. */ #ifndef AMBROLIB_STATIC_ARRAY_H #define AMBROLIB_STATIC_ARRAY_H #include <stddef.h> #include <aprinter/meta/TypeSequence.h> #include <aprinter/meta/TypeSequenceMakeInt.h> #include <aprinter/base/ProgramMemory.h> #include <aprinter/BeginNamespace.h> template <typename ElemType, int Size> struct StaticArrayStruct { ElemType arr[Size]; }; template <typename, template<int> class, typename> struct StaticArrayHelper; template <typename ElemType, template<int> class ElemValue, typename... Indices> struct StaticArrayHelper<ElemType, ElemValue, TypeSequence<Indices...>> { static constexpr StaticArrayStruct<ElemType, sizeof...(Indices)> getHelperStruct() { return StaticArrayStruct<ElemType, sizeof...(Indices)>{{ElemValue<Indices::Value>::value()...}}; } }; template <typename ElemType, int Size, template<int> class ElemValue> class StaticArray { public: static size_t const Length = Size; static ElemType readAt (size_t index) { return ProgPtr<ElemType>::Make(data.arr)[index]; } private: static StaticArrayStruct<ElemType, Size> AMBRO_PROGMEM const data; }; template <typename ElemType, int Size, template<int> class ElemValue> StaticArrayStruct<ElemType, Size> AMBRO_PROGMEM const StaticArray<ElemType, Size, ElemValue>::data = StaticArrayHelper<ElemType, ElemValue, TypeSequenceMakeInt<Size>>::getHelperStruct(); #include <aprinter/EndNamespace.h> #endif
johnkingsley/aprinter
aprinter/meta/StaticArray.h
C
bsd-2-clause
2,774
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2297, 2572, 12618, 2480, 12170, 2480, 18317, 1008, 2035, 2916, 9235, 1012, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302, 1008, 14080, 1010, 2024, 7936,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
/* * The Fascinator - Portal * Copyright (C) 2008-2011 University of Southern Queensland * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package com.googlecode.fascinator.portal.services; import com.googlecode.fascinator.portal.Portal; import java.io.File; import java.util.List; import java.util.Map; import java.util.Set; public interface PortalManager { public static final String DEFAULT_PORTAL_NAME = "default"; public static final String DEFAULT_SKIN = "default"; public static final String DEFAULT_DISPLAY = "default"; public static final String DEFAULT_PORTAL_HOME = "portal"; public static final String DEFAULT_PORTAL_HOME_DEV = "src/main/config/portal"; public Map<String, Portal> getPortals(); public Portal getDefault(); public File getHomeDir(); public Portal get(String name); public boolean exists(String name); public void add(Portal portal); public void remove(String name); public void save(Portal portal); public void reharvest(String objectId); public void reharvest(Set<String> objectIds); public String getDefaultPortal(); public String getDefaultDisplay(); public List<String> getSkinPriority(); }
the-fascinator/fascinator-portal
src/main/java/com/googlecode/fascinator/portal/services/PortalManager.java
Java
gpl-2.0
1,896
[ 30522, 1013, 1008, 1008, 1996, 6904, 11020, 23207, 1011, 9445, 1008, 9385, 1006, 1039, 1007, 2263, 1011, 2249, 2118, 1997, 2670, 5322, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 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...
#include "input/inputmanager.h" namespace donut { TInputManager::TInputManager() { } TInputManager::~TInputManager() { } }
AnisB/Donut
engine/src/input/InputManager.cpp
C++
mit
135
[ 30522, 1001, 2421, 1000, 7953, 1013, 7953, 24805, 4590, 1012, 1044, 1000, 3415, 15327, 2123, 4904, 1063, 9543, 18780, 24805, 4590, 1024, 1024, 9543, 18780, 24805, 4590, 1006, 1007, 1063, 1065, 9543, 18780, 24805, 4590, 1024, 1024, 1066, 954...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* The interfaces in this file are subject to change at any time. */ #include "config.h" #include <sys/types.h> #include <errno.h> #include <string.h> #include <glib.h> #include "buffer.h" #include "vteconv.h" #ifdef VTE_COMPILATION #include "vte-private.h" #else #define VTE_UTF8_BPC (6) /* Maximum number of bytes used per UTF-8 character */ #endif typedef size_t (*convert_func)(GIConv converter, const guchar **inbuf, gsize *inbytes_left, guchar **outbuf, gsize *outbytes_left); struct _VteConv { GIConv conv; convert_func convert; gint (*close)(GIConv converter); gboolean in_unichar, out_unichar; VteByteArray *in_scratch, *out_scratch; }; /* We can't use g_utf8_strlen as that's not nul-safe :( */ static gsize _vte_conv_utf8_strlen(const gchar *p, gssize max) { const gchar *q = p + max; gsize length = 0; while (p < q) { p = g_utf8_next_char(p); length++; } return length; } /* A variant of g_utf8_validate() that allows NUL characters. * Requires that max_len >= 0 && end != NULL. */ static gboolean _vte_conv_utf8_validate(const gchar *str, gssize max_len, const gchar **end) { gboolean ret; do { ret = g_utf8_validate(str, max_len, end); max_len -= *end - str; str = *end; /* Hitting a NUL is okay. Clear the error and iterate over them. */ while (max_len > 0 && *str == '\0') { ret = TRUE; max_len--; str++; *end = str; } } while (ret && max_len > 0); return ret; } /* A variant of g_utf8_get_char_validated() that allows NUL characters. * Requires that max_len >= 0. */ static gunichar _vte_conv_utf8_get_char_validated(const gchar *p, gssize max_len) { gunichar ret; /* Handle NUL at the beginning. */ if (max_len > 0 && p[0] == '\0') return 0; ret = g_utf8_get_char_validated(p, max_len); /* If a partial match is returned but there's a NUL in the buffer * then this is a wrong error, we're facing an invalid character. */ if (ret == (gunichar) -2 && memchr(p, '\0', max_len) != NULL) ret = (gunichar) -1; return ret; } /* A bogus UTF-8 to UTF-8 conversion function which attempts to provide the * same semantics as g_iconv(). */ static size_t _vte_conv_utf8_utf8(GIConv converter, const gchar **inbuf, gsize *inbytes_left, gchar **outbuf, gsize *outbytes_left) { gboolean validated; const gchar *endptr; size_t bytes; /* We don't tolerate shenanigans! */ g_assert_cmpuint(*outbytes_left, >=, *inbytes_left); /* The only error we can throw is EILSEQ, so check for that here. */ validated = _vte_conv_utf8_validate(*inbuf, *inbytes_left, &endptr); /* Copy whatever data was validated. */ bytes = endptr - *inbuf; memcpy(*outbuf, *inbuf, bytes); *inbuf += bytes; *outbuf += bytes; *outbytes_left -= bytes; *inbytes_left -= bytes; /* Return 0 (number of non-reversible conversions performed) if everything * looked good, else EILSEQ. */ if (validated) { return 0; } /* Determine why the end of the string is not valid. */ if (_vte_conv_utf8_get_char_validated(*inbuf, *inbytes_left) == (gunichar) -2) { /* Prefix of a valid UTF-8 */ errno = EINVAL; } else { /* We had enough bytes to validate the character, and * it failed. It just doesn't look right. */ errno = EILSEQ; } return (size_t) -1; } /* Open a conversion descriptor which, in addition to normal cases, provides * UTF-8 to UTF-8 conversions and a gunichar-compatible source and target * encoding. */ VteConv _vte_conv_open(const char *target, const char *source) { VteConv ret; GIConv conv; gboolean in_unichar, out_unichar, utf8; const char *real_target, *real_source; /* No shenanigans. */ g_assert(target != NULL); g_assert(source != NULL); g_assert(strlen(target) > 0); g_assert(strlen(source) > 0); /* Assume normal iconv usage. */ in_unichar = FALSE; out_unichar = FALSE; real_source = source; real_target = target; /* Determine if we need to convert gunichars to UTF-8 on input. */ if (strcmp(target, VTE_CONV_GUNICHAR_TYPE) == 0) { real_target = "UTF-8"; out_unichar = TRUE; } /* Determine if we need to convert UTF-8 to gunichars on output. */ if (strcmp(source, VTE_CONV_GUNICHAR_TYPE) == 0) { real_source = "UTF-8"; in_unichar = TRUE; } /* Determine if this is a UTF-8 to UTF-8 conversion. */ utf8 = ((g_ascii_strcasecmp(real_target, "UTF-8") == 0) && (g_ascii_strcasecmp(real_source, "UTF-8") == 0)); /* If we're doing UTF-8 to UTF-8, just use a dummy function which * checks for bad data. */ conv = NULL; if (!utf8) { char *translit_target = g_strdup_printf ("%s//translit", real_target); conv = g_iconv_open(translit_target, real_source); g_free (translit_target); if (conv == ((GIConv) -1)) { conv = g_iconv_open(real_target, real_source); } if (conv == ((GIConv) -1)) { return VTE_INVALID_CONV; } } /* Set up the descriptor. */ ret = g_slice_new0(struct _VteConv); if (utf8) { ret->conv = NULL; ret->convert = (convert_func) _vte_conv_utf8_utf8; ret->close = NULL; } else { g_assert((conv != NULL) && (conv != ((GIConv) -1))); ret->conv = conv; ret->convert = (convert_func) g_iconv; ret->close = g_iconv_close; } /* Initialize other elements. */ ret->in_unichar = in_unichar; ret->out_unichar = out_unichar; /* Create scratch buffers. */ ret->in_scratch = _vte_byte_array_new(); ret->out_scratch = _vte_byte_array_new(); return ret; } gint _vte_conv_close(VteConv converter) { g_assert(converter != NULL); g_assert(converter != VTE_INVALID_CONV); /* Close the underlying descriptor, if there is one. */ if (converter->conv != NULL) { g_assert(converter->close != NULL); converter->close(converter->conv); } /* Free the scratch buffers. */ _vte_byte_array_free(converter->in_scratch); _vte_byte_array_free(converter->out_scratch); /* Free the structure itself. */ g_slice_free(struct _VteConv, converter); return 0; } size_t _vte_conv(VteConv converter, const guchar **inbuf, gsize *inbytes_left, guchar **outbuf, gsize *outbytes_left) { size_t ret, tmp; const guchar *work_inbuf_start, *work_inbuf_working; guchar *work_outbuf_start, *work_outbuf_working; gsize work_inbytes, work_outbytes; g_assert(converter != NULL); g_assert(converter != VTE_INVALID_CONV); work_inbuf_start = work_inbuf_working = *inbuf; work_outbuf_start = work_outbuf_working = *outbuf; work_inbytes = *inbytes_left; work_outbytes = *outbytes_left; /* Possibly convert the input data from gunichars to UTF-8. */ if (converter->in_unichar) { int i, char_count; guchar *p, *end; gunichar *g; /* Make sure the scratch buffer has enough space. */ char_count = *inbytes_left / sizeof(gunichar); _vte_byte_array_set_minimum_size(converter->in_scratch, (char_count + 1) * VTE_UTF8_BPC); /* Convert the incoming text. */ g = (gunichar*) *inbuf; p = converter->in_scratch->data; end = p + (char_count + 1) * VTE_UTF8_BPC; for (i = 0; i < char_count; i++) { p += g_unichar_to_utf8(g[i], (gchar *)p); g_assert(p <= end); } /* Update our working pointers. */ work_inbuf_start = converter->in_scratch->data; work_inbuf_working = work_inbuf_start; work_inbytes = p - work_inbuf_start; } /* Possibly set the output pointers to point at our scratch buffer. */ if (converter->out_unichar) { work_outbytes = *outbytes_left * VTE_UTF8_BPC; _vte_byte_array_set_minimum_size(converter->out_scratch, work_outbytes); work_outbuf_start = converter->out_scratch->data; work_outbuf_working = work_outbuf_start; } /* Call the underlying conversion. */ ret = 0; do { tmp = converter->convert(converter->conv, &work_inbuf_working, &work_inbytes, &work_outbuf_working, &work_outbytes); if (tmp == (size_t) -1) { /* Check for zero bytes, which we pass right through. */ if (errno == EILSEQ) { if ((work_inbytes > 0) && (work_inbuf_working[0] == '\0') && (work_outbytes > 0)) { work_outbuf_working[0] = '\0'; work_outbuf_working++; work_inbuf_working++; work_outbytes--; work_inbytes--; ret++; } else { /* No go. */ ret = -1; break; } } else { ret = -1; break; } } else { ret += tmp; break; } } while (work_inbytes > 0); /* We can't handle this particular failure, and it should * never happen. (If it does, our caller needs fixing.) */ g_assert((ret != (size_t)-1) || (errno != E2BIG)); /* Possibly convert the output from UTF-8 to gunichars. */ if (converter->out_unichar) { int left = *outbytes_left; gunichar *g; gchar *p; g = (gunichar*) *outbuf; for(p = (gchar *)work_outbuf_start; p < (gchar *)work_outbuf_working; p = g_utf8_next_char(p)) { g_assert(left>=0); *g++ = g_utf8_get_char(p); left -= sizeof(gunichar); } *outbytes_left = left; *outbuf = (guchar*) g; } else { /* Pass on the output results. */ *outbuf = work_outbuf_working; *outbytes_left -= (work_outbuf_working - work_outbuf_start); } /* Advance the input pointer to the right place. */ if (converter->in_unichar) { /* Get an idea of how many characters were converted, and * advance the pointer as required. */ gsize chars; chars = _vte_conv_utf8_strlen((const gchar *)work_inbuf_start, work_inbuf_working - work_inbuf_start); *inbuf += (sizeof(gunichar) * chars); *inbytes_left -= (sizeof(gunichar) * chars); } else { /* Pass on the input results. */ *inbuf = work_inbuf_working; *inbytes_left -= (work_inbuf_working - work_inbuf_start); } return ret; } size_t _vte_conv_cu(VteConv converter, const guchar **inbuf, gsize *inbytes_left, gunichar **outbuf, gsize *outbytes_left) { return _vte_conv(converter, inbuf, inbytes_left, (guchar**)outbuf, outbytes_left); } size_t _vte_conv_uu(VteConv converter, const gunichar **inbuf, gsize *inbytes_left, gunichar **outbuf, gsize *outbytes_left) { return _vte_conv(converter, (const guchar**)inbuf, inbytes_left, (guchar**)outbuf, outbytes_left); } size_t _vte_conv_uc(VteConv converter, const gunichar **inbuf, gsize *inbytes_left, guchar **outbuf, gsize *outbytes_left) { return _vte_conv(converter, (const guchar**)inbuf, inbytes_left, outbuf, outbytes_left); } #ifdef VTECONV_MAIN static gsize ucs4_strlen(const gunichar *p, gsize max_len) { const gunichar *q = p + max_len; gsize length = 0; while (p < q && *p++ != 0) length++; return length; } static void clear(gunichar wide[5], gchar narrow[5]) { wide[0] = 'T'; wide[1] = 'E'; wide[2] = 'S'; wide[3] = 'T'; wide[4] = '\0'; strcpy(narrow, "test"); } static int mixed_strcmp(const gunichar *wide, const guchar *narrow) { while (*wide && *narrow) { if (*wide != (gunichar)*narrow) { return -1; } wide++; narrow++; } return 0; } /* Test _vte_conv_utf8_strlen, especially where it differs from g_utf8_strlen. */ static void test_utf8_strlen (void) { g_assert_cmpuint(_vte_conv_utf8_strlen("", 0), ==, 0); g_assert_cmpuint(_vte_conv_utf8_strlen("\0\0\0\0", 4), ==, 4); g_assert_cmpuint(_vte_conv_utf8_strlen("\0A\0\0", 4), ==, 4); g_assert_cmpuint(_vte_conv_utf8_strlen("\0A\0B", 4), ==, 4); g_assert_cmpuint(_vte_conv_utf8_strlen("A\0B\0", 4), ==, 4); g_assert_cmpuint(_vte_conv_utf8_strlen("ABCD", 4), ==, 4); g_assert_cmpuint(_vte_conv_utf8_strlen("ABCDE", 4), ==, 4); g_assert_cmpuint(_vte_conv_utf8_strlen("\xC2\xA0\xC2\xA0", 4), ==, 2); } static void test_utf8_validate (void) { static const struct { char input[16]; gsize ilen; gsize endlen; gboolean validates; } tests[] = { { "\0\0\0", 0, 0, TRUE }, { "\0\0\0", 1, 1, TRUE }, { "\0\0\0", 3, 3, TRUE }, { "ab\0cd\0\0ef", 6, 6, TRUE }, { "ab\0cd\0\0ef", 7, 7, TRUE }, { "ab\0cd\0\0ef", 9, 9, TRUE }, { "ab\xE2\x94\x80\0\xE2\x94\x80yz", 11, 11, TRUE }, { "ab\x80\0cd", 6, 2, FALSE }, { "ab\xE2\0cd", 6, 2, FALSE }, }; guint i; const char *end; for (i = 0; i < G_N_ELEMENTS (tests); i++) { g_assert(_vte_conv_utf8_validate(tests[i].input, tests[i].ilen, &end) == tests[i].validates); g_assert_cmpuint((gsize)(end - tests[i].input), ==, tests[i].endlen); } } /* Test _vte_conv_utf8_get_char_validated. */ static void test_utf8_get_char_validated (void) { static const guchar mbyte_test_u[] = { 0xe2, 0x94, 0x80 }; static const guchar mbyte_test_break_u[] = { 0xe2, 0xe2, 0xe2 }; const char *mbyte_test = (const char *)mbyte_test_u; const char *mbyte_test_break = (const char *)mbyte_test_break_u; g_assert_cmpuint(_vte_conv_utf8_get_char_validated("", 0), ==, (gunichar)-2); g_assert_cmpuint(_vte_conv_utf8_get_char_validated("\0", 1), ==, 0); g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test, 1), ==, (gunichar)-2); g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test, 2), ==, (gunichar)-2); g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test, 3), ==, 0x2500); g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test_break, 1), ==, (gunichar)-2); g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test_break, 2), ==, (gunichar)-1); g_assert_cmpuint(_vte_conv_utf8_get_char_validated(mbyte_test_break, 3), ==, (gunichar)-1); g_assert_cmpuint(_vte_conv_utf8_get_char_validated("\x80\0", 2), ==, (gunichar)-1); g_assert_cmpuint(_vte_conv_utf8_get_char_validated("\xE2\0", 2), ==, (gunichar)-1); g_assert_cmpuint(_vte_conv_utf8_get_char_validated("\xE2\x94\0", 3), ==, (gunichar)-1); g_assert_cmpuint(_vte_conv_utf8_get_char_validated("\xE2\x94\x80\0", 4), ==, 0x2500); } typedef struct { gunichar wide[8]; gssize widelen; gchar narrow[8]; gssize narrowlen; char target[16]; char source[16]; } TestData; static void test_narrow_narrow (const TestData *tests, gsize n_tests) { VteConv conv; guchar buf[10]; const guchar *inbuf; guchar *outbuf; gsize inbytes, outbytes, ret; gsize i; for (i = 0; i < n_tests; i++) { memset(buf, 0, sizeof(buf)); inbuf = (const guchar *)tests[i].narrow; inbytes = tests[i].narrowlen >= 0 ? tests[i].narrowlen : strlen(tests[i].narrow); outbuf = buf; outbytes = sizeof(buf); conv = _vte_conv_open(tests[i].target, tests[i].source); ret = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); g_assert_cmpuint(ret, ==, 0); g_assert_cmpuint(inbytes, ==, 0); g_assert_cmpstr(tests[i].narrow, ==, (char *)buf); _vte_conv_close(conv); } } static void test_narrow_to_wide (const TestData *tests, gsize n_tests) { gunichar widebuf[5]; VteConv conv; const guchar *inbuf; guchar *outbuf; gsize inbytes, outbytes, ret; gsize i; for (i = 0; i < n_tests; i++) { memset(widebuf, 0, sizeof(widebuf)); inbuf = (const guchar *)tests[i].narrow; inbytes = tests[i].narrowlen >= 0 ? tests[i].narrowlen : strlen(tests[i].narrow); outbuf = (guchar*) widebuf; outbytes = sizeof(widebuf); conv = _vte_conv_open(VTE_CONV_GUNICHAR_TYPE, tests[i].source); ret = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); g_assert_cmpuint(ret, ==, 0); g_assert_cmpuint(inbytes, ==, 0); g_assert_cmpint(mixed_strcmp(widebuf, inbuf), ==, 0); _vte_conv_close(conv); } } static void test_wide_to_narrow (const TestData *tests, gsize n_tests) { char buf[10]; VteConv conv; const guchar *inbuf; guchar *outbuf; gsize inbytes, outbytes, ret; gsize i; for (i = 0; i < n_tests; i++) { memset(buf, 0, sizeof(buf)); inbuf = (const guchar *)tests[i].wide; inbytes = tests[i].widelen >= 0 ? tests[i].widelen : ucs4_strlen(tests[i].wide, sizeof(tests[i].wide)) * sizeof(gunichar); outbuf = (guchar *)buf; outbytes = sizeof(buf); conv = _vte_conv_open(tests[i].target, VTE_CONV_GUNICHAR_TYPE); ret = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); g_assert_cmpuint(ret, ==, 0); g_assert_cmpuint(inbytes, ==, 0); g_assert_cmpint(mixed_strcmp(tests[i].wide, outbuf), ==, 0); _vte_conv_close(conv); } } static void test_g_iconv_narrow_narrow (void) { static const TestData tests[] = { { { 0, }, -1, "test", -1, "UTF-8", "ISO-8859-1" }, { { 0, }, -1, "test", -1, "ISO-8859-1", "UTF-8" }, }; test_narrow_narrow (tests, G_N_ELEMENTS(tests)); } static void test_g_iconv_narrow_to_wide (void) { static const TestData tests[] = { { { 0, }, -1, "test", -1, VTE_CONV_GUNICHAR_TYPE, "ISO-8859-1" }, }; test_narrow_to_wide (tests, G_N_ELEMENTS(tests)); } static void test_g_iconv_wide_to_narrow (void) { static const TestData tests[] = { { { 'T', 'E', 'S', 'T', 0 }, -1, "", -1, "ISO-8859-1", VTE_CONV_GUNICHAR_TYPE }, }; test_wide_to_narrow (tests, G_N_ELEMENTS(tests)); } static void test_utf8_to_utf8 (void) { static const TestData tests[] = { { { 0, }, -1, "test", -1, "UTF-8", "UTF-8" }, }; test_narrow_narrow (tests, G_N_ELEMENTS (tests)); } static void test_zero_byte_passthrough (void) { gunichar wide_test[5]; gchar narrow_test[5]; VteConv conv; const guchar *inbuf; guchar *outbuf; gsize inbytes, outbytes; int i; /* Test zero-byte pass-through. */ clear(wide_test, narrow_test); memset(wide_test, 0, sizeof(wide_test)); inbuf = (guchar *)wide_test; inbytes = 3 * sizeof(gunichar); outbuf = (guchar *)narrow_test; outbytes = sizeof(narrow_test); conv = _vte_conv_open("UTF-8", VTE_CONV_GUNICHAR_TYPE); i = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); g_assert(inbytes == 0); if ((narrow_test[0] != 0) || (narrow_test[1] != 0) || (narrow_test[2] != 0)) { g_error("Conversion 6 failed.\n"); } _vte_conv_close(conv); /* Test zero-byte pass-through. */ clear(wide_test, narrow_test); memset(wide_test, 'A', sizeof(wide_test)); memset(narrow_test, 0, sizeof(narrow_test)); inbuf = (guchar *)narrow_test; inbytes = 3; outbuf = (guchar *)wide_test; outbytes = sizeof(wide_test); conv = _vte_conv_open(VTE_CONV_GUNICHAR_TYPE, "UTF-8"); i = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); g_assert(inbytes == 0); if ((wide_test[0] != 0) || (wide_test[1] != 0) || (wide_test[2] != 0)) { g_error("Conversion 7 failed.\n"); } _vte_conv_close(conv); /* Test zero-byte pass-through. */ clear(wide_test, narrow_test); memset(wide_test, 'A', sizeof(wide_test)); memset(narrow_test, 0, sizeof(narrow_test)); inbuf = (guchar *)narrow_test; inbytes = 3; outbuf = (guchar *)wide_test; outbytes = sizeof(wide_test); conv = _vte_conv_open(VTE_CONV_GUNICHAR_TYPE, "ISO-8859-1"); i = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); g_assert(inbytes == 0); if ((wide_test[0] != 0) || (wide_test[1] != 0) || (wide_test[2] != 0)) { g_error("Conversion 8 failed.\n"); } _vte_conv_close(conv); } static void test_utf8_to_utf8_error (void) { static const guchar mbyte_test[] = { 0xe2, 0x94, 0x80 }; static const guchar mbyte_test_break[] = { 0xe2, 0xe2, 0xe2 }; gchar buf[10]; VteConv conv; const guchar *inbuf; guchar *outbuf; gsize inbytes, outbytes; gsize i; /* Test UTF-8 to UTF-8 error reporting, valid multibyte. */ for (i = 0; i < sizeof(mbyte_test); i++) { int ret; inbuf = mbyte_test; inbytes = i + 1; outbuf = (guchar *)buf; outbytes = sizeof(buf); conv = _vte_conv_open("UTF-8", "UTF-8"); ret = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); switch (i) { case 0: g_assert_cmpint(ret, ==, -1); g_assert_cmpint(errno, ==, EINVAL); break; case 1: g_assert_cmpint(ret, ==, -1); g_assert_cmpint(errno, ==, EINVAL); break; case 2: g_assert_cmpint(ret, !=, -1); break; default: g_assert_not_reached(); break; } _vte_conv_close(conv); } /* Test UTF-8 to UTF-8 error reporting, invalid multibyte. */ for (i = 0; i < sizeof(mbyte_test_break); i++) { int ret; inbuf = mbyte_test_break; inbytes = i + 1; outbuf = (guchar *)buf; outbytes = sizeof(buf); conv = _vte_conv_open("UTF-8", "UTF-8"); ret = _vte_conv(conv, &inbuf, &inbytes, &outbuf, &outbytes); _vte_conv_close(conv); switch (i) { case 0: g_assert_cmpint(ret, ==, -1); g_assert_cmpint(errno, ==, EINVAL); break; case 1: g_assert_cmpint(ret, ==, -1); g_assert_cmpint(errno, ==, EILSEQ); break; case 2: g_assert_cmpint(ret, ==, -1); g_assert_cmpint(errno, ==, EILSEQ); break; default: g_assert_not_reached(); break; } } } int main (int argc, char *argv[]) { g_test_init (&argc, &argv, NULL); g_test_add_func ("/vte/conv/utf8/strlen", test_utf8_strlen); g_test_add_func ("/vte/conv/utf8/validate", test_utf8_validate); g_test_add_func ("/vte/conv/utf8/get-char", test_utf8_get_char_validated); g_test_add_func ("/vte/conv/utf8/conversion", test_utf8_to_utf8); g_test_add_func ("/vte/conv/utf8/conversion-with-error", test_utf8_to_utf8_error); g_test_add_func ("/vte/conv/narrow-narrow", test_g_iconv_narrow_narrow); g_test_add_func ("/vte/conv/narrow-to-wide", test_g_iconv_narrow_to_wide); g_test_add_func ("/vte/conv/wide-to-narrow", test_g_iconv_wide_to_narrow); g_test_add_func ("/vte/conv/zero-byte-passthrough", test_zero_byte_passthrough); return g_test_run (); } #endif
rvu95/vte
src/vteconv.cc
C++
lgpl-2.1
23,771
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2494, 2417, 6045, 1010, 4297, 1012, 1008, 1008, 2023, 3075, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 1008, 19933, 2009, 2104, 1996, 3408, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 model.contact import Contact import random def test_delete_some_contact(app, db, check_ui): if len(db.get_contact_list()) == 0: app.contact.add(Contact(firstname="test")) old_contacts = db.get_contact_list() contact = random.choice(old_contacts) app.contact.delete_contact_by_id(contact.id) assert len(old_contacts) - 1 == app.contact.count() new_contacts = db.get_contact_list() old_contacts.remove(contact) assert old_contacts == new_contacts if check_ui: assert sorted(new_contacts, key=Contact.id_or_max) == sorted(app.contact.get_contact_list(), key=Contact.id_or_max)
AndreyBalabanov/python_training
test/test_del_contact.py
Python
apache-2.0
633
[ 30522, 2013, 2944, 1012, 3967, 12324, 3967, 12324, 6721, 13366, 3231, 1035, 3972, 12870, 1035, 2070, 1035, 3967, 1006, 10439, 1010, 16962, 1010, 4638, 1035, 21318, 1007, 1024, 2065, 18798, 1006, 16962, 1012, 2131, 1035, 3967, 1035, 2862, 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) 2011-2012, Code Aurora Forum. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __PM8XXX_ADC_H #define __PM8XXX_ADC_H #include <linux/kernel.h> #include <linux/list.h> enum pm8xxx_adc_channels { CHANNEL_VCOIN = 0, CHANNEL_VBAT, CHANNEL_DCIN, CHANNEL_ICHG, CHANNEL_VPH_PWR, CHANNEL_IBAT, CHANNEL_MPP_1, CHANNEL_MPP_2, CHANNEL_BATT_THERM, CHANNEL_BATT_ID_THERM = CHANNEL_BATT_THERM, CHANNEL_BATT_ID, CHANNEL_USBIN, CHANNEL_DIE_TEMP, CHANNEL_625MV, CHANNEL_125V, CHANNEL_CHG_TEMP, CHANNEL_MUXOFF, CHANNEL_NONE, ADC_MPP_1_ATEST_8 = 20, ADC_MPP_1_USB_SNS_DIV20, ADC_MPP_1_DCIN_SNS_DIV20, ADC_MPP_1_AMUX3, ADC_MPP_1_AMUX4, ADC_MPP_1_AMUX5, ADC_MPP_1_AMUX6, ADC_MPP_1_AMUX7, ADC_MPP_1_AMUX8, ADC_MPP_1_ATEST_1, ADC_MPP_1_ATEST_2, ADC_MPP_1_ATEST_3, ADC_MPP_1_ATEST_4, ADC_MPP_1_ATEST_5, ADC_MPP_1_ATEST_6, ADC_MPP_1_ATEST_7, ADC_MPP_2_ATEST_8 = 40, ADC_MPP_2_USB_SNS_DIV20, ADC_MPP_2_DCIN_SNS_DIV20, ADC_MPP_2_AMUX3, ADC_MPP_2_AMUX4, ADC_MPP_2_AMUX5, ADC_MPP_2_AMUX6, ADC_MPP_2_AMUX7, ADC_MPP_2_AMUX8, ADC_MPP_2_ATEST_1, ADC_MPP_2_ATEST_2, ADC_MPP_2_ATEST_3, ADC_MPP_2_ATEST_4, ADC_MPP_2_ATEST_5, ADC_MPP_2_ATEST_6, ADC_MPP_2_ATEST_7, ADC_CHANNEL_MAX_NUM, }; #define PM8XXX_ADC_PMIC_0 0x0 #define PM8XXX_CHANNEL_ADC_625_UV 625000 #define PM8XXX_CHANNEL_MPP_SCALE1_IDX 20 #define PM8XXX_CHANNEL_MPP_SCALE3_IDX 40 #define PM8XXX_AMUX_MPP_1 0x1 #define PM8XXX_AMUX_MPP_2 0x2 #define PM8XXX_AMUX_MPP_3 0x3 #define PM8XXX_AMUX_MPP_4 0x4 #define PM8XXX_AMUX_MPP_5 0x5 #define PM8XXX_AMUX_MPP_6 0x6 #define PM8XXX_AMUX_MPP_7 0x7 #define PM8XXX_AMUX_MPP_8 0x8 #define PM8XXX_AMUX_MPP_9 0x9 #define PM8XXX_AMUX_MPP_10 0xA #define PM8XXX_AMUX_MPP_11 0xB #define PM8XXX_AMUX_MPP_12 0xC #define PM8XXX_ADC_DEV_NAME "pm8xxx-adc" enum pm8xxx_adc_decimation_type { ADC_DECIMATION_TYPE1 = 0, ADC_DECIMATION_TYPE2, ADC_DECIMATION_TYPE3, ADC_DECIMATION_TYPE4, ADC_DECIMATION_NONE, }; enum pm8xxx_adc_calib_type { ADC_CALIB_ABSOLUTE = 0, ADC_CALIB_RATIOMETRIC, ADC_CALIB_NONE, }; enum pm8xxx_adc_channel_scaling_param { CHAN_PATH_SCALING1 = 0, CHAN_PATH_SCALING2, CHAN_PATH_SCALING3, CHAN_PATH_SCALING4, CHAN_PATH_SCALING_NONE, }; enum pm8xxx_adc_amux_input_rsv { AMUX_RSV0 = 0, AMUX_RSV1, AMUX_RSV2, AMUX_RSV3, AMUX_RSV4, AMUX_RSV5, AMUX_NONE, }; enum pm8xxx_adc_premux_mpp_scale_type { PREMUX_MPP_SCALE_0 = 0, PREMUX_MPP_SCALE_1, PREMUX_MPP_SCALE_1_DIV3, PREMUX_MPP_NONE, }; enum pm8xxx_adc_scale_fn_type { ADC_SCALE_DEFAULT = 0, ADC_SCALE_BATT_THERM, ADC_SCALE_PA_THERM, ADC_SCALE_PMIC_THERM, ADC_SCALE_XOTHERM, ADC_SCALE_NONE, }; struct pm8xxx_adc_linear_graph { int64_t dy; int64_t dx; int64_t adc_vref; int64_t adc_gnd; }; struct pm8xxx_adc_map_pt { int32_t x; int32_t y; }; struct pm8xxx_adc_map_table { const struct pm8xxx_adc_map_pt *table; int32_t size; }; struct pm8xxx_adc_scaling_ratio { int32_t num; int32_t den; }; struct pm8xxx_adc_properties { uint32_t adc_vdd_reference; uint32_t bitresolution; bool bipolar; }; struct pm8xxx_adc_chan_properties { uint32_t offset_gain_numerator; uint32_t offset_gain_denominator; struct pm8xxx_adc_linear_graph adc_graph[2]; }; struct pm8xxx_adc_chan_result { uint32_t chan; int32_t adc_code; int64_t measurement; int64_t physical; }; #if defined(CONFIG_SENSORS_PM8XXX_ADC) \ || defined(CONFIG_SENSORS_PM8XXX_ADC_MODULE) void pm8xxx_adc_set_adcmap_btm_table( struct pm8xxx_adc_map_table *adcmap_table); int32_t pm8xxx_adc_scale_default(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt); int32_t pm8xxx_adc_tdkntcg_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt); int32_t pm8xxx_adc_scale_batt_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt); int32_t pm8xxx_adc_scale_pa_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt); int32_t pm8xxx_adc_scale_pmic_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt); int32_t pm8xxx_adc_scale_batt_id(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt); #else static inline void pm8xxx_adc_set_adcmap_btm_table( struct pm8xxx_adc_map_table *adcmap_table) { return; } static inline int32_t pm8xxx_adc_scale_default(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt) { return -ENXIO; } static inline int32_t pm8xxx_adc_tdkntcg_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt) { return -ENXIO; } static inline int32_t pm8xxx_adc_scale_batt_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt) { return -ENXIO; } static inline int32_t pm8xxx_adc_scale_pa_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt) { return -ENXIO; } static inline int32_t pm8xxx_adc_scale_pmic_therm(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt) { return -ENXIO; } static inline int32_t pm8xxx_adc_scale_batt_id(int32_t adc_code, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop, struct pm8xxx_adc_chan_result *chan_rslt) { return -ENXIO; } #endif struct pm8xxx_adc_scale_fn { int32_t (*chan) (int32_t, const struct pm8xxx_adc_properties *, const struct pm8xxx_adc_chan_properties *, struct pm8xxx_adc_chan_result *); }; struct pm8xxx_adc_amux { char *name; enum pm8xxx_adc_channels channel_name; enum pm8xxx_adc_channel_scaling_param chan_path_prescaling; enum pm8xxx_adc_amux_input_rsv adc_rsv; enum pm8xxx_adc_decimation_type adc_decimation; enum pm8xxx_adc_scale_fn_type adc_scale_fn; }; struct pm8xxx_adc_arb_btm_param { int32_t low_thr_temp; int32_t high_thr_temp; uint64_t low_thr_voltage; uint64_t high_thr_voltage; int32_t interval; void (*btm_warm_fn) (bool); void (*btm_cool_fn) (bool); }; int32_t pm8xxx_adc_batt_scaler(struct pm8xxx_adc_arb_btm_param *, const struct pm8xxx_adc_properties *adc_prop, const struct pm8xxx_adc_chan_properties *chan_prop); struct pm8xxx_adc_platform_data { struct pm8xxx_adc_properties *adc_prop; struct pm8xxx_adc_amux *adc_channel; uint32_t adc_num_board_channel; uint32_t adc_mpp_base; struct pm8xxx_adc_map_table *adc_map_btm_table; void (*pm8xxx_adc_device_register)(void); }; #if defined(CONFIG_SENSORS_PM8XXX_ADC) \ || defined(CONFIG_SENSORS_PM8XXX_ADC_MODULE) uint32_t pm8xxx_adc_read(enum pm8xxx_adc_channels channel, struct pm8xxx_adc_chan_result *result); uint32_t pm8xxx_adc_mpp_config_read(uint32_t mpp_num, enum pm8xxx_adc_channels channel, struct pm8xxx_adc_chan_result *result); uint32_t pm8xxx_adc_btm_start(void); uint32_t pm8xxx_adc_btm_end(void); uint32_t pm8xxx_adc_btm_configure(struct pm8xxx_adc_arb_btm_param *); int pm8xxx_adc_btm_is_cool(void); int pm8xxx_adc_btm_is_warm(void); #else static inline uint32_t pm8xxx_adc_read(uint32_t channel, struct pm8xxx_adc_chan_result *result) { return -ENXIO; } static inline uint32_t pm8xxx_adc_mpp_config_read(uint32_t mpp_num, enum pm8xxx_adc_channels channel, struct pm8xxx_adc_chan_result *result) { return -ENXIO; } static inline uint32_t pm8xxx_adc_btm_start(void) { return -ENXIO; } static inline uint32_t pm8xxx_adc_btm_end(void) { return -ENXIO; } static inline uint32_t pm8xxx_adc_btm_configure( struct pm8xxx_adc_arb_btm_param *param) { return -ENXIO; } static inline int pm8xxx_adc_btm_is_cool(void) { return 0; } static inline int pm8xxx_adc_btm_is_warm(void) { return 0; } #endif #endif
poondog/kangaroo-m7-mkII
include/linux/mfd/pm8xxx/pm8xxx-adc.h
C
gpl-2.0
9,028
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2249, 1011, 2262, 1010, 3642, 13158, 7057, 1012, 2035, 2916, 9235, 1012, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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":"44092148","logradouro":"Rua S\u00e3o Francisco","bairro":"Tomba","cidade":"Feira de Santana","uf":"BA","estado":"Bahia"});
lfreneda/cepdb
api/v1/44092148.jsonp.js
JavaScript
cc0-1.0
137
[ 30522, 1046, 3385, 2361, 1006, 1063, 1000, 8292, 2361, 1000, 1024, 1000, 17422, 2683, 17465, 18139, 1000, 1010, 1000, 8833, 12173, 8162, 2080, 1000, 1024, 1000, 21766, 2050, 1055, 1032, 1057, 8889, 2063, 2509, 2080, 3799, 1000, 1010, 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 (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QDECLARATIVEEXPRESSION_P_H #define QDECLARATIVEEXPRESSION_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include "qdeclarativeexpression.h" #include "private/qdeclarativeengine_p.h" #include "private/qdeclarativeguard_p.h" #include <QtScript/qscriptvalue.h> QT_BEGIN_NAMESPACE class QDeclarativeAbstractExpression { public: QDeclarativeAbstractExpression(); virtual ~QDeclarativeAbstractExpression(); bool isValid() const; QDeclarativeContextData *context() const; void setContext(QDeclarativeContextData *); virtual void refresh(); private: friend class QDeclarativeContext; friend class QDeclarativeContextData; friend class QDeclarativeContextPrivate; QDeclarativeContextData *m_context; QDeclarativeAbstractExpression **m_prevExpression; QDeclarativeAbstractExpression *m_nextExpression; }; class QDeclarativeDelayedError { public: inline QDeclarativeDelayedError() : nextError(0), prevError(0) {} inline ~QDeclarativeDelayedError() { removeError(); } QDeclarativeError error; bool addError(QDeclarativeEnginePrivate *); inline void removeError() { if (!prevError) return; if (nextError) nextError->prevError = prevError; *prevError = nextError; nextError = 0; prevError = 0; } private: QDeclarativeDelayedError *nextError; QDeclarativeDelayedError **prevError; }; class QDeclarativeQtScriptExpression : public QDeclarativeAbstractExpression, public QDeclarativeDelayedError { public: enum Mode { SharedContext, ExplicitContext }; enum EvaluateFlag { RequiresThisObject = 0x01 }; Q_DECLARE_FLAGS(EvaluateFlags, EvaluateFlag) QDeclarativeQtScriptExpression(); virtual ~QDeclarativeQtScriptExpression(); QDeclarativeRefCount *dataRef; QString expression; Mode expressionFunctionMode; QScriptValue expressionFunction; QScriptValue expressionContext; // Only used in ExplicitContext QObject *scopeObject; // Only used in SharedContext bool notifyOnValueChange() const; void setNotifyOnValueChange(bool); void resetNotifyOnChange(); void setNotifyObject(QObject *, int ); void setEvaluateFlags(EvaluateFlags flags); EvaluateFlags evaluateFlags() const; QScriptValue scriptValue(QObject *secondaryScope, bool *isUndefined); class DeleteWatcher { public: inline DeleteWatcher(QDeclarativeQtScriptExpression *data); inline ~DeleteWatcher(); inline bool wasDeleted() const; private: bool *m_wasDeleted; bool m_wasDeletedStorage; QDeclarativeQtScriptExpression *m_d; }; private: void clearGuards(); QScriptValue eval(QObject *secondaryScope, bool *isUndefined); void updateGuards(const QPODVector<QDeclarativeEnginePrivate::CapturedProperty, 16> &properties); bool trackChange; QDeclarativeNotifierEndpoint *guardList; int guardListLength; QObject *guardObject; int guardObjectNotifyIndex; bool *deleted; EvaluateFlags evalFlags; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeQtScriptExpression::EvaluateFlags) class QDeclarativeExpression; class QString; class QDeclarativeExpressionPrivate : public QObjectPrivate, public QDeclarativeQtScriptExpression { Q_DECLARE_PUBLIC(QDeclarativeExpression) public: QDeclarativeExpressionPrivate(); ~QDeclarativeExpressionPrivate(); void init(QDeclarativeContextData *, const QString &, QObject *); void init(QDeclarativeContextData *, const QScriptValue &, QObject *); void init(QDeclarativeContextData *, void *, QDeclarativeRefCount *, QObject *, const QString &, int); QVariant value(QObject *secondaryScope = 0, bool *isUndefined = 0); QScriptValue scriptValue(QObject *secondaryScope = 0, bool *isUndefined = 0); static QDeclarativeExpressionPrivate *get(QDeclarativeExpression *expr) { return static_cast<QDeclarativeExpressionPrivate *>(QObjectPrivate::get(expr)); } static QDeclarativeExpression *get(QDeclarativeExpressionPrivate *expr) { return expr->q_func(); } void _q_notify(); virtual void emitValueChanged(); static void exceptionToError(QScriptEngine *, QDeclarativeError &); static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QString &, const QString &, int, QScriptValue *); static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QScriptProgram &, QScriptValue *); bool expressionFunctionValid:1; QString url; // This is a QString for a reason. QUrls are slooooooow... int line; QByteArray name; //function name, hint for the debugger }; QDeclarativeQtScriptExpression::DeleteWatcher::DeleteWatcher(QDeclarativeQtScriptExpression *data) : m_wasDeletedStorage(false), m_d(data) { if (!m_d->deleted) m_d->deleted = &m_wasDeletedStorage; m_wasDeleted = m_d->deleted; } QDeclarativeQtScriptExpression::DeleteWatcher::~DeleteWatcher() { if (false == *m_wasDeleted && m_wasDeleted == m_d->deleted) m_d->deleted = 0; } bool QDeclarativeQtScriptExpression::DeleteWatcher::wasDeleted() const { return *m_wasDeleted; } QT_END_NAMESPACE #endif // QDECLARATIVEEXPRESSION_P_H
eric100lin/Qt-4.8.6
src/declarative/qml/qdeclarativeexpression_p.h
C
lgpl-2.1
7,580
[ 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> <html class="theme-next gemini use-motion" lang="zh-TW"> <head><meta name="generator" content="Hexo 3.8.0"> <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=2"> <meta name="theme-color" content="#536F87"> <link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2"> <link rel="stylesheet" href="/css/main.css?v=7.1.0"> <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.1.0"> <link rel="icon" type="image/png" sizes="32x32" href="/images/icon.png?v=7.1.0"> <link rel="icon" type="image/png" sizes="16x16" href="/images/icon.png?v=7.1.0"> <link rel="mask-icon" href="/images/logo.svg?v=7.1.0" color="#536F87"> <script id="hexo.configurations"> var NexT = window.NexT || {}; var CONFIG = { root: '/', scheme: 'Gemini', version: '7.1.0', sidebar: {"position":"right","width":240,"display":"post","offset":12,"onmobile":false,"dimmer":false}, back2top: true, back2top_sidebar: false, fancybox: false, fastclick: false, lazyload: false, tabs: true, motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}, 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> <meta name="description" content="K均值算法(K-mean Algorithm)應該可以說是最簡單的無監督學習算法了,因為很直觀的關係,所以這篇應該蠻短的。"> <meta name="keywords" content="技術, 獨立遊戲"> <meta property="og:type" content="article"> <meta property="og:title" content="K均值算法 K-mean Algorithm"> <meta property="og:url" content="https://www.tinytsunami.info/2017/05/14/k-mean-algorithm/index.html"> <meta property="og:site_name" content="羊羽手札"> <meta property="og:description" content="K均值算法(K-mean Algorithm)應該可以說是最簡單的無監督學習算法了,因為很直觀的關係,所以這篇應該蠻短的。"> <meta property="og:locale" content="zh-TW"> <meta property="og:updated_time" content="2018-07-29T17:41:20.380Z"> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="K均值算法 K-mean Algorithm"> <meta name="twitter:description" content="K均值算法(K-mean Algorithm)應該可以說是最簡單的無監督學習算法了,因為很直觀的關係,所以這篇應該蠻短的。"> <link rel="canonical" href="https://www.tinytsunami.info/2017/05/14/k-mean-algorithm/"> <script id="page.configurations"> CONFIG.page = { sidebar: "", }; </script> <title>K均值算法 K-mean Algorithm | 羊羽手札</title> <noscript> <style> .use-motion .motion-element, .use-motion .brand, .use-motion .menu-item, .sidebar-inner, .use-motion .post-block, .use-motion .pagination, .use-motion .comments, .use-motion .post-header, .use-motion .post-body, .use-motion .collection-title { opacity: initial; } .use-motion .logo, .use-motion .site-title, .use-motion .site-subtitle { opacity: initial; top: initial; } .use-motion .logo-line-before i { left: initial; } .use-motion .logo-line-after i { right: initial; } </style> </noscript> </head> <body itemscope itemtype="http://schema.org/WebPage" lang="zh-TW"> <div class="container sidebar-position-right page-post-detail"> <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">羊羽手札</span> <span class="logo-line-after"><i></i></span> </a> </div> <p class="site-subtitle">Tinytsunami's Blog</p> </div> <div class="site-nav-toggle"> <button aria-label="切換導航欄"> <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>首頁</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>分類</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>紀錄</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 id="posts" class="posts-expand"> <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> <div class="post-block"> <link itemprop="mainEntityOfPage" href="https://www.tinytsunami.info/2017/05/14/k-mean-algorithm/"> <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person"> <meta itemprop="name" content="Tinytusnami"> <meta itemprop="description" content="羊羽的個人部落格"> <meta itemprop="image" content="/images/head.jpg"> </span> <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization"> <meta itemprop="name" content="羊羽手札"> </span> <header class="post-header"> <h1 class="post-title" itemprop="name headline">K均值算法 K-mean Algorithm </h1> <div class="post-meta"> <span class="post-time"> <span class="post-meta-item-icon"> <i class="fa fa-calendar-o"></i> </span> <span class="post-meta-item-text">發表於</span> <time title="創建時間 2017-05-14 00:00:00" itemprop="dateCreated datePublished" datetime="2017-05-14T00:00:00Z">2017-05-14</time> <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"> <i class="fa fa-calendar-check-o"></i> </span> <span class="post-meta-item-text">更新於</span> <time title="修改時間 2018-07-29 17:41:20" itemprop="dateModified" datetime="2018-07-29T17:41:20Z">2018-07-29</time> </span> <span class="post-category"> <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"> <i class="fa fa-folder-o"></i> </span> <span class="post-meta-item-text">分類於</span> <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/資料結構與演算法/" itemprop="url" rel="index"><span itemprop="name">資料結構與演算法</span></a></span> </span> <span class="post-comments-count"> <span class="post-meta-divider">|</span> <span class="post-meta-item-icon"> <i class="fa fa-comment-o"></i> </span> <span class="post-meta-item-text">評論 </span> <a href="/2017/05/14/k-mean-algorithm/#comments" itemprop="discussionUrl"> <span class="post-comments-count fb-comments-count" data-href="https://www.tinytsunami.info/2017/05/14/k-mean-algorithm/" itemprop="commentCount">0</span> </a> </span> </div> </header> <div class="post-body" itemprop="articleBody"> <p>K均值算法(K-mean Algorithm)應該可以說是最簡單的無監督學習算法了,<br>因為很直觀的關係,所以這篇應該蠻短的。<br><a id="more"></a></p> <p>讓我們開始吧!</p> <hr> <h1 id="物以類聚"><a href="#物以類聚" class="headerlink" title="物以類聚"></a>物以類聚</h1><p>想像一下,如果「物以類聚」這件事情為真的話,<br>那麼一筆一筆的資料是不是也有這樣的特性呢?</p> <p>$X_{0} \approx X_{1}$</p> <p>兩筆資料由於特徵相近,所以映射在高維空間中的距離接近。<br>所以說,這些散布在空間中的點,<br>如果這堆點,每個都有所屬的類別的話。</p> <p>很顯然的,那就存在一個類別的中心,<br>而這個類別的中心,我們常稱作「聚類中心」。</p> <p>$\mu = \text{聚類中心}$</p> <p>越靠近這個聚類中心,代表它越屬於這個類別。</p> <h2 id="K個類別"><a href="#K個類別" class="headerlink" title="K個類別"></a>K個類別</h2><p>由於類別不只一個,<br>老實說,如果類別沒有兩個以上,那也不用去分了。<br>我們假定存在 $K$ 個類別的話,就有 $K$ 個聚類中心:</p> <p>$\mu_{0}, \mu_{1}, … , \mu_{K}$</p> <p>我們可以進一步去定義,<br>這些每個聚類都是集合,可以用來塞資料點:</p> <p>$S_{j} = \{ … \}$</p> <p>如此一來,聚類中心就有定義了:</p> <p>$\mu_{j} = \frac{1}{|S_{j}|}\sum\limits_{x_{i} \in S_{j}} x_{i}$</p> <p>聚類中心是「屬於聚類集合的點取平均」而來。</p> <hr> <h1 id="演算法"><a href="#演算法" class="headerlink" title="演算法"></a>演算法</h1><p>接下來,是演算法的實際做法:</p> <ul> <li>隨機初始化聚類中心</li> <li>計算資料點較接近哪個聚類中心 </li> <li>把接近聚類中心的資料點塞進聚類集合</li> <li>計算新的聚類中心,代替掉舊的</li> <li>重複 2 ~ 5 步驟,直到不再更新為止</li> </ul> <p>公式的定義:</p> <p>$S_{j} = \{ x_{i} : \mid x_{i} - \mu_{j}\mid ^{2} \leq \mid x_{i} - \mu_{p}\mid ^{2} \forall p, 1 &lt; p &lt; K \}$</p> <p>具體的作法就是迭代上式。至於這條公式的解釋:</p> <p>第 j 個聚類集合,如果符合:<br>「第 i 筆資料與第 j 個聚類中心的距離」小於等於「第 i 筆資料與第 p 個聚類中心的距離」的話,<br>那麼第 i 筆資料就屬於第 j 個聚類集合(對於所有的 p 都要嘗試,至於 p 的範圍是 1 ~ K)</p> <p>這是白話文翻譯。不過為了裝得很厲害的樣子,還是寫符號吧..XD<br>換言之,這筆資料是不是屬於這個聚類,就要嘗試看看他跟這個聚類中心的距離是不是小於等於其他聚類中心,<br>如果是則將它擺到這個聚類集合中;反之,則忽略這筆,繼續看下一筆資料。</p> <p>值得一提的是,通常情況下一筆資料只會被分配到一個聚類集合。<br>依照這個定義的話,如果 $\mid x_{i} - \mu_{p}\mid ^{2} = |x_{i} - \mu_{q}\mid ^{2}$ 也就是距離一樣的話,<br>那麼資料點 $x_{i}$ 就會被分配到最後一個算的聚類中心。</p> <h2 id="形式化"><a href="#形式化" class="headerlink" title="形式化"></a>形式化</h2><ul> <li>$\mu_{j} = random$</li> <li>$S_{j} = \{ x_{i} : \mid x_{i} - \mu_{j}\mid ^{2} \leq \mid x_{i} - \mu_{p}\mid ^{2} \forall p, 1 &lt; p &lt; K \}$</li> <li>$\mu_{j} = \frac{1}{|S_{j}|}\sum\limits_{x_{i} \in S_{j}} x_{i}$</li> <li>$\text{Repeat 2~3}$</li> </ul> <p>以上,就是所有的內容了。來看演示吧!</p> <hr> <h1 id="演示"><a href="#演示" class="headerlink" title="演示"></a>演示</h1><iframe scrolling="no" width="100%" height="600px" src="//jsfiddle.net/kLyn0kut/embedded/result,js,html,css/dark" frameborder="0" allowfullscreen></iframe> </div> <footer class="post-footer"> <div class="post-nav"> <div class="post-nav-next post-nav-item"> <a href="/2017/01/13/pokemon-tdv-sorted-list/" rel="next" title="寶可夢本傳:三防排名表"> <i class="fa fa-chevron-left"></i> 寶可夢本傳:三防排名表 </a> </div> <span class="post-nav-divider"></span> <div class="post-nav-prev post-nav-item"> <a href="/2017/05/14/proof-mean-and-rms/" rel="prev" title="平均值與有效值證明"> 平均值與有效值證明 <i class="fa fa-chevron-right"></i> </a> </div> </div> </footer> </div> </article> </div> </div> <div class="comments" id="comments"> <div id="gitment-container"></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"> <ul class="sidebar-nav motion-element"> <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap"> 文章目錄 </li> <li class="sidebar-nav-overview" data-target="site-overview-wrap"> 本站概要 </li> </ul> <div class="site-overview-wrap sidebar-panel"> <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/head.jpg" alt="Tinytusnami"> <p class="site-author-name" itemprop="name">Tinytusnami</p> <div class="site-description motion-element" itemprop="description">羊羽的個人部落格</div> </div> <nav class="site-state motion-element"> <div class="site-state-item site-state-posts"> <a href="/archives/"> <span class="site-state-item-count">24</span> <span class="site-state-item-name">文章</span> </a> </div> <div class="site-state-item site-state-categories"> <a href="/categories/"> <span class="site-state-item-count">12</span> <span class="site-state-item-name">分類</span> </a> </div> </nav> <div class="links-of-author motion-element"> <span class="links-of-author-item"> <a href="https://github.com/tinytsunami" title="GitHub &rarr; https://github.com/tinytsunami" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a> </span> <span class="links-of-author-item"> <a href="mailto:z27619273@gmail.com" title="E-Mail &rarr; mailto:z27619273@gmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a> </span> <span class="links-of-author-item"> <a href="https://www.facebook.com/profile.php?id=100000736195394" title="FB Page &rarr; https://www.facebook.com/profile.php?id=100000736195394" rel="noopener" target="_blank"><i class="fa fa-fw fa-facebook"></i>FB Page</a> </span> <span class="links-of-author-item"> <a href="https://www.youtube.com/channel/UCtqp9w_uA_LohDm0YXNWqSA" title="YouTube &rarr; https://www.youtube.com/channel/UCtqp9w_uA_LohDm0YXNWqSA" rel="noopener" target="_blank"><i class="fa fa-fw fa-youtube"></i>YouTube</a> </span> </div> </div> </div> <!--noindex--> <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active"> <div class="post-toc"> <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#物以類聚"><span class="nav-number">1.</span> <span class="nav-text">物以類聚</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#K個類別"><span class="nav-number">1.1.</span> <span class="nav-text">K個類別</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#演算法"><span class="nav-number">2.</span> <span class="nav-text">演算法</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#形式化"><span class="nav-number">2.1.</span> <span class="nav-text">形式化</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#演示"><span class="nav-number">3.</span> <span class="nav-text">演示</span></a></li></ol></div> </div> </div> <!--/noindex--> </div> </aside> </div> </main> <footer id="footer" class="footer"> <div class="footer-inner"> <div class="copyright">&copy; 2018 – <span itemprop="copyrightYear">2019</span> <span class="with-love" id="animate"> <i class="fa fa-bomb"></i> </span> <span class="author" itemprop="copyrightHolder">Tinytusnami</span> </div> <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 強力驅動 v3.8.0</div> <span class="post-meta-divider">|</span> <div class="theme-info">主題 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> v7.1.0</div> </div> </footer> <div class="back-to-top"> <i class="fa fa-arrow-up"></i> <span id="scrollpercent"><span>0</span>%</span> </div> </div> <script> if (Object.prototype.toString.call(window.Promise) !== '[object Function]') { window.Promise = null; } </script> <script src="/lib/jquery/index.js?v=2.1.3"></script> <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script> <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script> <script src="/js/utils.js?v=7.1.0"></script> <script src="/js/motion.js?v=7.1.0"></script> <script src="/js/affix.js?v=7.1.0"></script> <script src="/js/schemes/pisces.js?v=7.1.0"></script> <script src="/js/scrollspy.js?v=7.1.0"></script> <script src="/js/post-details.js?v=7.1.0"></script> <script src="/js/next-boot.js?v=7.1.0"></script> <!-- LOCAL: You can save these files to your site and update links --> <script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitmint.browser.js"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/default.css"> <!-- END LOCAL --> <script> function renderGitment() { var gitment = new Gitmint({ id: window.location.pathname, owner: 'tinytsunami', repo: 'tinytsunami.github.io', lang: '' || navigator.language || navigator.systemLanguage || navigator.userLanguage, oauth: { client_secret: '36ffe64406d0cfaa8d1811ebf27c58638876fc8d', client_id: '8b224f954e247f37ca81' } }); gitment.render('gitment-container'); } renderGitment(); </script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [ ['$', '$'], ['\\(', '\\)'] ], processEscapes: true, skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'] }, TeX: { equationNumbers: { autoNumber: 'AMS' } } }); MathJax.Hub.Register.StartupHook('TeX Jax Ready', function() { MathJax.InputJax.TeX.prefilterHooks.Add(function(data) { if (data.display) { var next = data.script.nextSibling; while (next && next.nodeName.toLowerCase() === '#text') { next = next.nextSibling } if (next && next.nodeName.toLowerCase() === 'br') { next.parentNode.removeChild(next) } } }); }); </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) { document.getElementById(all[i].inputID + '-Frame').parentNode.className += ' has-jax'; } }); </script> <script src="//cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> </body> </html>
tinytsunami/blog
2017/05/14/k-mean-algorithm/index.html
HTML
mit
24,034
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 2465, 1027, 1000, 4323, 1011, 2279, 21424, 2224, 1011, 4367, 1000, 11374, 1027, 1000, 1062, 2232, 1011, 1056, 2860, 1000, 1028, 30524, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 25...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 once #include "SamplingMethod.h" namespace PcapDotNet { namespace Core { /// <summary> /// This sampling method defines that we have to return 1 packet every given time-interval. /// In other words, if the interval is set to 10 milliseconds, the first packet is returned to the caller; the next returned one will be the first packet that arrives when 10ms have elapsed. /// </summary> public ref class SamplingMethodFirstAfterInterval sealed : SamplingMethod { public: /// <summary> /// Constructs by giving an interval in milliseconds. /// </summary> /// <param name="intervalInMs">The number of milliseconds to wait between packets sampled.</param> /// <exception cref="System::ArgumentOutOfRangeException">The given number of milliseconds is negative.</exception> SamplingMethodFirstAfterInterval(int intervalInMs); /// <summary> /// Constructs by giving an interval as TimeSpan. /// </summary> /// <param name="interval">The time to wait between packets sampled.</param> /// <exception cref="System::ArgumentOutOfRangeException">The interval is negative or larger than 2^31 milliseconds.</exception> SamplingMethodFirstAfterInterval(System::TimeSpan interval); internal: virtual property int Method { int get() override; } /// <summary> /// Indicates the 'waiting time' in milliseconds before one packet got accepted. /// In other words, if 'value = 10', the first packet is returned to the caller; the next returned one will be the first packet that arrives when 10ms have elapsed. /// </summary> virtual property int Value { int get() override; } private: int _intervalInMs; }; }}
peterstevens130561/sonarlint-vs
its/PcapDotNet-71480/PcapDotNet.Core/SamplingMethodFirstAfterInterval.h
C
lgpl-3.0
1,850
[ 30522, 1001, 10975, 8490, 2863, 2320, 1001, 2421, 1000, 16227, 11368, 6806, 2094, 1012, 1044, 1000, 3415, 15327, 7473, 9331, 27364, 7159, 1063, 3415, 15327, 4563, 1063, 1013, 1013, 1013, 1026, 12654, 1028, 1013, 1013, 1013, 2023, 16227, 411...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. from airflow.models import BaseOperator from airflow.utils.decorators import apply_defaults class DummyOperator(BaseOperator): """ Operator that does literally nothing. It can be used to group tasks in a DAG. """ ui_color = '#e8f7e4' @apply_defaults def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) def execute(self, context): pass
wileeam/airflow
airflow/operators/dummy_operator.py
Python
apache-2.0
1,203
[ 30522, 1001, 1001, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 1001, 2030, 2062, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 1001, 5500, 2007, 2023, 2147, 2005, 3176, 2592, 1001, 4953, 9385, 6095, 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...
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "ABI41_0_0AndroidDialogPickerProps.h" #include <ABI41_0_0React/components/image/conversions.h> #include <ABI41_0_0React/core/propsConversions.h> namespace ABI41_0_0facebook { namespace ABI41_0_0React { AndroidDialogPickerProps::AndroidDialogPickerProps( const AndroidDialogPickerProps &sourceProps, const RawProps &rawProps) : ViewProps(sourceProps, rawProps), color(convertRawProp(rawProps, "color", sourceProps.color, {})), enabled(convertRawProp(rawProps, "enabled", sourceProps.enabled, {true})), items(convertRawProp(rawProps, "items", sourceProps.items, {})), prompt(convertRawProp(rawProps, "prompt", sourceProps.prompt, {""})), selected( convertRawProp(rawProps, "selected", sourceProps.selected, {0})) {} } // namespace ABI41_0_0React } // namespace ABI41_0_0facebook
exponent/exponent
ios/versioned-react-native/ABI41_0_0/ReactNative/ReactCommon/fabric/components/picker/androidpicker/ABI41_0_0AndroidDialogPickerProps.cpp
C++
bsd-3-clause
1,031
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 9130, 1010, 4297, 1012, 1998, 2049, 18460, 1012, 1008, 1008, 2023, 3120, 3642, 2003, 7000, 2104, 1996, 10210, 6105, 2179, 1999, 1996, 1008, 6105, 5371, 1999, 1996, 7117, 14176, 1997, 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...
<div ng-controller="View2Ctrl as myCtrl"> <h2>{{ myCtrl.content }}</h2> </div>
Mango-J/angular-seed
app/view2/view2.html
HTML
mit
81
[ 30522, 1026, 4487, 2615, 12835, 1011, 11486, 1027, 1000, 3193, 2475, 6593, 12190, 2004, 2026, 6593, 12190, 1000, 1028, 1026, 1044, 2475, 1028, 1063, 1063, 2026, 6593, 12190, 1012, 4180, 1065, 1065, 1026, 1013, 1044, 2475, 1028, 1026, 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...
# # Copyright 2016 Centreon (http://www.centreon.com/) # # Centreon is a full-fledged industry-strength solution that meets # the needs in IT infrastructure and application monitoring for # service performance. # # 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 centreon::plugins::misc; use strict; use warnings; use utf8; sub windows_execute { my (%options) = @_; my $result; my ($stdout, $pid, $ended) = (''); my ($exit_code, $cmd); $cmd = $options{command_path} . '/' if (defined($options{command_path})); $cmd .= $options{command} . ' ' if (defined($options{command})); $cmd .= $options{command_options} if (defined($options{command_options})); centreon::plugins::misc::mymodule_load(output => $options{output}, module => 'Win32::Job', error_msg => "Cannot load module 'Win32::Job'."); centreon::plugins::misc::mymodule_load(output => $options{output}, module => 'Time::HiRes', error_msg => "Cannot load module 'Time::HiRes'."); $| = 1; pipe FROM_CHILD, TO_PARENT or do { $options{output}->output_add(severity => 'UNKNOWN', short_msg => "Internal error: can't create pipe from child to parent: $!"); $options{output}->display(); $options{output}->exit(); }; my $job = Win32::Job->new; if (!($pid = $job->spawn(undef, $cmd, { stdout => \*TO_PARENT, stderr => \*TO_PARENT }))) { $options{output}->output_add(severity => 'UNKNOWN', short_msg => "Internal error: execution issue: $^E"); $options{output}->display(); $options{output}->exit(); } close TO_PARENT; my $ein = ""; vec($ein, fileno(FROM_CHILD), 1) = 1; $job->watch( sub { my ($buffer); my $time = $options{timeout}; my $last_time = Time::HiRes::time(); $ended = 0; while (select($ein, undef, undef, $options{timeout})) { if (sysread(FROM_CHILD, $buffer, 16384)) { $buffer =~ s/\r//g; $stdout .= $buffer; } else { $ended = 1; last; } $options{timeout} -= Time::HiRes::time() - $last_time; last if ($options{timeout} <= 0); $last_time = Time::HiRes::time(); } return 1 if ($ended == 0); return 0; }, 0.1 ); $result = $job->status; close FROM_CHILD; if ($ended == 0) { $options{output}->output_add(severity => 'UNKNOWN', short_msg => "Command too long to execute (timeout)..."); $options{output}->display(); $options{output}->exit(); } chomp $stdout; if (defined($options{no_quit}) && $options{no_quit} == 1) { return ($stdout, $result->{$pid}->{exitcode}); } if ($result->{$pid}->{exitcode} != 0) { $stdout =~ s/\n/ - /g; $options{output}->output_add(severity => 'UNKNOWN', short_msg => "Command error: $stdout"); $options{output}->display(); $options{output}->exit(); } return ($stdout, $result->{$pid}->{exitcode}); } sub execute { my (%options) = @_; my $cmd = ''; my $args = []; my ($lerror, $stdout, $exit_code); # Build command line # Can choose which command is done remotely (can filter and use local file) if (defined($options{options}->{remote}) && ($options{options}->{remote} eq '' || !defined($options{label}) || $options{label} =~ /$options{options}->{remote}/)) { my $sub_cmd; $cmd = $options{options}->{ssh_path} . '/' if (defined($options{options}->{ssh_path})); $cmd .= $options{options}->{ssh_command} if (defined($options{options}->{ssh_command})); foreach (@{$options{options}->{ssh_option}}) { my ($lvalue, $rvalue) = split /=/; push @$args, $lvalue if (defined($lvalue)); push @$args, $rvalue if (defined($rvalue)); } if (defined($options{options}->{ssh_address}) && $options{options}->{ssh_address} ne '') { push @$args, $options{options}->{ssh_address}; } else { push @$args, $options{options}->{hostname}; } $sub_cmd = 'sudo ' if (defined($options{sudo})); $sub_cmd .= $options{command_path} . '/' if (defined($options{command_path})); $sub_cmd .= $options{command} . ' ' if (defined($options{command})); $sub_cmd .= $options{command_options} if (defined($options{command_options})); # On some equipment. Cannot get a pseudo terminal if (defined($options{ssh_pipe}) && $options{ssh_pipe} == 1) { $cmd = "echo '" . $sub_cmd . "' | " . $cmd . ' ' . join(" ", @$args); ($lerror, $stdout, $exit_code) = backtick( command => $cmd, timeout => $options{options}->{timeout}, wait_exit => 1, redirect_stderr => 1 ); } else { ($lerror, $stdout, $exit_code) = backtick( command => $cmd, arguments => [@$args, $sub_cmd], timeout => $options{options}->{timeout}, wait_exit => 1, redirect_stderr => 1 ); } } else { $cmd = 'sudo ' if (defined($options{sudo})); $cmd .= $options{command_path} . '/' if (defined($options{command_path})); $cmd .= $options{command} . ' ' if (defined($options{command})); $cmd .= $options{command_options} if (defined($options{command_options})); ($lerror, $stdout, $exit_code) = backtick( command => $cmd, timeout => $options{options}->{timeout}, wait_exit => 1, redirect_stderr => 1 ); } if (defined($options{options}->{show_output}) && ($options{options}->{show_output} eq '' || (defined($options{label}) && $options{label} eq $options{options}->{show_output}))) { print $stdout; exit $exit_code; } $stdout =~ s/\r//g; if ($lerror <= -1000) { $options{output}->output_add(severity => 'UNKNOWN', short_msg => $stdout); $options{output}->display(); $options{output}->exit(); } if (defined($options{no_quit}) && $options{no_quit} == 1) { return ($stdout, $exit_code); } if ($exit_code != 0 && (!defined($options{no_errors}) || !defined($options{no_errors}->{$exit_code}))) { $stdout =~ s/\n/ - /g; $options{output}->output_add(severity => 'UNKNOWN', short_msg => "Command error: $stdout"); $options{output}->display(); $options{output}->exit(); } return $stdout; } sub mymodule_load { my (%options) = @_; my $file; ($file = $options{module} . ".pm") =~ s{::}{/}g; eval { local $SIG{__DIE__} = 'IGNORE'; require $file; }; if ($@) { return 1 if (defined($options{no_quit}) && $options{no_quit} == 1); $options{output}->add_option_msg(long_msg => $@); $options{output}->add_option_msg(short_msg => $options{error_msg}); $options{output}->option_exit(); } return 0; } sub backtick { my %arg = ( command => undef, arguments => [], timeout => 30, wait_exit => 0, redirect_stderr => 0, @_, ); my @output; my $pid; my $return_code; my $sig_do; if ($arg{wait_exit} == 0) { $sig_do = 'IGNORE'; $return_code = undef; } else { $sig_do = 'DEFAULT'; } local $SIG{CHLD} = $sig_do; $SIG{TTOU} = 'IGNORE'; $| = 1; if (!defined($pid = open( KID, "-|" ))) { return (-1001, "Cant fork: $!", -1); } if ($pid) { eval { local $SIG{ALRM} = sub { die "Timeout by signal ALARM\n"; }; alarm( $arg{timeout} ); while (<KID>) { chomp; push @output, $_; } alarm(0); }; if ($@) { if ($pid != -1) { kill -9, $pid; } alarm(0); return (-1000, "Command too long to execute (timeout)...", -1); } else { if ($arg{wait_exit} == 1) { # We're waiting the exit code waitpid($pid, 0); $return_code = ($? >> 8); } close KID; } } else { # child # set the child process to be a group leader, so that # kill -9 will kill it and all its descendents # We have ignore SIGTTOU to let write background processes setpgrp( 0, 0 ); if ($arg{redirect_stderr} == 1) { open STDERR, ">&STDOUT"; } if (scalar(@{$arg{arguments}}) <= 0) { exec($arg{command}); } else { exec($arg{command}, @{$arg{arguments}}); } # Exec is in error. No such command maybe. exit(127); } return (0, join("\n", @output), $return_code); } sub trim { my ($value) = $_[0]; # Sometimes there is a null character $value =~ s/\x00$//; $value =~ s/^[ \t]+//; $value =~ s/[ \t]+$//; return $value; } sub powershell_encoded { my ($value) = $_[0]; require Encode; require MIME::Base64; my $bytes = Encode::encode("utf16LE", $value); my $script = MIME::Base64::encode_base64($bytes, "\n"); $script =~ s/\n//g; return $script; } sub powershell_escape { my ($value) = $_[0]; $value =~ s/`/``/g; $value =~ s/#/`#/g; $value =~ s/'/`'/g; $value =~ s/"/`"/g; return $value; } sub minimal_version { my ($version_src, $version_dst) = @_; # No Version. We skip if (!defined($version_src) || !defined($version_dst) || $version_src !~ /^[0-9]+(?:\.[0-9\.]+)*$/ || $version_dst !~ /^[0-9x]+(?:\.[0-9x]+)*$/) { return 1; } my @version_src = split /\./, $version_src; my @versions = split /\./, $version_dst; for (my $i = 0; $i < scalar(@versions); $i++) { return 1 if ($versions[$i] eq 'x'); return 1 if (!defined($version_src[$i])); $version_src[$i] =~ /^([0-9]*)/; next if ($versions[$i] == int($1)); return 0 if ($versions[$i] > int($1)); return 1 if ($versions[$i] < int($1)); } return 1; } sub change_seconds { my %options = @_; my ($str, $str_append) = ('', ''); my $periods = [ { unit => 'y', value => 31556926 }, { unit => 'M', value => 2629743 }, { unit => 'w', value => 604800 }, { unit => 'd', value => 86400 }, { unit => 'h', value => 3600 }, { unit => 'm', value => 60 }, { unit => 's', value => 1 }, ]; foreach (@$periods) { my $count = int($options{value} / $_->{value}); next if ($count == 0); $str .= $str_append . $count . $_->{unit}; $options{value} = $options{value} % $_->{value}; $str_append = ' '; } return $str; } 1; __END__
golgoth31/centreon-plugins
centreon/plugins/misc.pm
Perl
apache-2.0
12,667
[ 30522, 1001, 1001, 9385, 2355, 2803, 2239, 1006, 8299, 1024, 1013, 1013, 7479, 1012, 2803, 2239, 1012, 4012, 1013, 1007, 1001, 1001, 2803, 2239, 2003, 1037, 2440, 1011, 26712, 3068, 1011, 3997, 5576, 2008, 6010, 1001, 1996, 3791, 1999, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
/* ======================================================================== * JCommon : a free general purpose class library for the Java(tm) platform * ======================================================================== * * (C) Copyright 2000-2006, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jcommon/index.html * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This 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 Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * -------------------- * SpreadsheetDate.java * -------------------- * (C) Copyright 2000-2006, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; * * $Id: SpreadsheetDate.java,v 1.10 2006/08/29 13:59:30 mungady Exp $ * * Changes * ------- * 11-Oct-2001 : Version 1 (DG); * 05-Nov-2001 : Added getDescription() and setDescription() methods (DG); * 12-Nov-2001 : Changed name from ExcelDate.java to SpreadsheetDate.java (DG); * Fixed a bug in calculating day, month and year from serial * number (DG); * 24-Jan-2002 : Fixed a bug in calculating the serial number from the day, * month and year. Thanks to Trevor Hills for the report (DG); * 29-May-2002 : Added equals(Object) method (SourceForge ID 558850) (DG); * 03-Oct-2002 : Fixed errors reported by Checkstyle (DG); * 13-Mar-2003 : Implemented Serializable (DG); * 04-Sep-2003 : Completed isInRange() methods (DG); * 05-Sep-2003 : Implemented Comparable (DG); * 21-Oct-2003 : Added hashCode() method (DG); * 29-Aug-2006 : Removed redundant description attribute (DG); * */ package org.jfree.chart.date; import java.util.Calendar; import java.util.Date; /** * Represents a date using an integer, in a similar fashion to the * implementation in Microsoft Excel. The range of dates supported is * 1-Jan-1900 to 31-Dec-9999. * <P> * Be aware that there is a deliberate bug in Excel that recognises the year * 1900 as a leap year when in fact it is not a leap year. You can find more * information on the Microsoft website in article Q181370: * <P> * http://support.microsoft.com/support/kb/articles/Q181/3/70.asp * <P> * Excel uses the convention that 1-Jan-1900 = 1. This class uses the * convention 1-Jan-1900 = 2. * The result is that the day number in this class will be different to the * Excel figure for January and February 1900...but then Excel adds in an extra * day (29-Feb-1900 which does not actually exist!) and from that point forward * the day numbers will match. * * @author David Gilbert */ public class SpreadsheetDate extends SerialDate { /** For serialization. */ private static final long serialVersionUID = -2039586705374454461L; /** * The day number (1-Jan-1900 = 2, 2-Jan-1900 = 3, ..., 31-Dec-9999 = * 2958465). */ private final int serial; /** The day of the month (1 to 28, 29, 30 or 31 depending on the month). */ private final int day; /** The month of the year (1 to 12). */ private final int month; /** The year (1900 to 9999). */ private final int year; /** * Creates a new date instance. * * @param day the day (in the range 1 to 28/29/30/31). * @param month the month (in the range 1 to 12). * @param year the year (in the range 1900 to 9999). */ public SpreadsheetDate(final int day, final int month, final int year) { if ((year >= 1900) && (year <= 9999)) { this.year = year; } else { throw new IllegalArgumentException( "The 'year' argument must be in range 1900 to 9999." ); } if ((month >= MonthConstants.JANUARY) && (month <= MonthConstants.DECEMBER)) { this.month = month; } else { throw new IllegalArgumentException( "The 'month' argument must be in the range 1 to 12." ); } if ((day >= 1) && (day <= SerialDate.lastDayOfMonth(month, year))) { this.day = day; } else { throw new IllegalArgumentException("Invalid 'day' argument."); } // the serial number needs to be synchronised with the day-month-year... this.serial = calcSerial(day, month, year); } /** * Standard constructor - creates a new date object representing the * specified day number (which should be in the range 2 to 2958465. * * @param serial the serial number for the day (range: 2 to 2958465). */ public SpreadsheetDate(final int serial) { if ((serial >= SERIAL_LOWER_BOUND) && (serial <= SERIAL_UPPER_BOUND)) { this.serial = serial; } else { throw new IllegalArgumentException( "SpreadsheetDate: Serial must be in range 2 to 2958465."); } // the day-month-year needs to be synchronised with the serial number... // get the year from the serial date final int days = this.serial - SERIAL_LOWER_BOUND; // overestimated because we ignored leap days final int overestimatedYYYY = 1900 + (days / 365); final int leaps = SerialDate.leapYearCount(overestimatedYYYY); final int nonleapdays = days - leaps; // underestimated because we overestimated years int underestimatedYYYY = 1900 + (nonleapdays / 365); if (underestimatedYYYY == overestimatedYYYY) { this.year = underestimatedYYYY; } else { int ss1 = calcSerial(1, 1, underestimatedYYYY); while (ss1 <= this.serial) { underestimatedYYYY = underestimatedYYYY + 1; ss1 = calcSerial(1, 1, underestimatedYYYY); } this.year = underestimatedYYYY - 1; } final int ss2 = calcSerial(1, 1, this.year); int[] daysToEndOfPrecedingMonth = AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH; if (isLeapYear(this.year)) { daysToEndOfPrecedingMonth = LEAP_YEAR_AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH; } // get the month from the serial date int mm = 1; int sss = ss2 + daysToEndOfPrecedingMonth[mm] - 1; while (sss < this.serial) { mm = mm + 1; sss = ss2 + daysToEndOfPrecedingMonth[mm] - 1; } this.month = mm - 1; // what's left is d(+1); this.day = this.serial - ss2 - daysToEndOfPrecedingMonth[this.month] + 1; } /** * Returns the serial number for the date, where 1 January 1900 = 2 * (this corresponds, almost, to the numbering system used in Microsoft * Excel for Windows and Lotus 1-2-3). * * @return The serial number of this date. */ @Override public int toSerial() { return this.serial; } /** * Returns a <code>java.util.Date</code> equivalent to this date. * * @return The date. */ @Override public Date toDate() { final Calendar calendar = Calendar.getInstance(); calendar.set(getYYYY(), getMonth() - 1, getDayOfMonth(), 0, 0, 0); return calendar.getTime(); } /** * Returns the year (assume a valid range of 1900 to 9999). * * @return The year. */ @Override public int getYYYY() { return this.year; } /** * Returns the month (January = 1, February = 2, March = 3). * * @return The month of the year. */ @Override public int getMonth() { return this.month; } /** * Returns the day of the month. * * @return The day of the month. */ @Override public int getDayOfMonth() { return this.day; } /** * Returns a code representing the day of the week. * <P> * The codes are defined in the {@link SerialDate} class as: * <code>SUNDAY</code>, <code>MONDAY</code>, <code>TUESDAY</code>, * <code>WEDNESDAY</code>, <code>THURSDAY</code>, <code>FRIDAY</code>, and * <code>SATURDAY</code>. * * @return A code representing the day of the week. */ @Override public int getDayOfWeek() { return (this.serial + 6) % 7 + 1; } /** * Tests the equality of this date with an arbitrary object. * <P> * This method will return true ONLY if the object is an instance of the * {@link SerialDate} base class, and it represents the same day as this * {@link SpreadsheetDate}. * * @param object the object to compare (<code>null</code> permitted). * * @return A boolean. */ @Override public boolean equals(final Object object) { if (object instanceof SerialDate) { final SerialDate s = (SerialDate) object; return (s.toSerial() == this.toSerial()); } else { return false; } } /** * Returns a hash code for this object instance. * * @return A hash code. */ @Override public int hashCode() { return toSerial(); } /** * Returns the difference (in days) between this date and the specified * 'other' date. * * @param other the date being compared to. * * @return The difference (in days) between this date and the specified * 'other' date. */ @Override public int compare(final SerialDate other) { return this.serial - other.toSerial(); } /** * Implements the method required by the Comparable interface. * * @param other the other object (usually another SerialDate). * * @return A negative integer, zero, or a positive integer as this object * is less than, equal to, or greater than the specified object. */ @Override public int compareTo(final Object other) { return compare((SerialDate) other); } /** * Returns true if this SerialDate represents the same date as the * specified SerialDate. * * @param other the date being compared to. * * @return <code>true</code> if this SerialDate represents the same date as * the specified SerialDate. */ @Override public boolean isOn(final SerialDate other) { return (this.serial == other.toSerial()); } /** * Returns true if this SerialDate represents an earlier date compared to * the specified SerialDate. * * @param other the date being compared to. * * @return <code>true</code> if this SerialDate represents an earlier date * compared to the specified SerialDate. */ @Override public boolean isBefore(final SerialDate other) { return (this.serial < other.toSerial()); } /** * Returns true if this SerialDate represents the same date as the * specified SerialDate. * * @param other the date being compared to. * * @return <code>true</code> if this SerialDate represents the same date * as the specified SerialDate. */ @Override public boolean isOnOrBefore(final SerialDate other) { return (this.serial <= other.toSerial()); } /** * Returns true if this SerialDate represents the same date as the * specified SerialDate. * * @param other the date being compared to. * * @return <code>true</code> if this SerialDate represents the same date * as the specified SerialDate. */ @Override public boolean isAfter(final SerialDate other) { return (this.serial > other.toSerial()); } /** * Returns true if this SerialDate represents the same date as the * specified SerialDate. * * @param other the date being compared to. * * @return <code>true</code> if this SerialDate represents the same date as * the specified SerialDate. */ @Override public boolean isOnOrAfter(final SerialDate other) { return (this.serial >= other.toSerial()); } /** * Returns <code>true</code> if this {@link SerialDate} is within the * specified range (INCLUSIVE). The date order of d1 and d2 is not * important. * * @param d1 a boundary date for the range. * @param d2 the other boundary date for the range. * * @return A boolean. */ @Override public boolean isInRange(final SerialDate d1, final SerialDate d2) { return isInRange(d1, d2, SerialDate.INCLUDE_BOTH); } /** * Returns true if this SerialDate is within the specified range (caller * specifies whether or not the end-points are included). The order of d1 * and d2 is not important. * * @param d1 one boundary date for the range. * @param d2 a second boundary date for the range. * @param include a code that controls whether or not the start and end * dates are included in the range. * * @return <code>true</code> if this SerialDate is within the specified * range. */ @Override public boolean isInRange(final SerialDate d1, final SerialDate d2, final int include) { final int s1 = d1.toSerial(); final int s2 = d2.toSerial(); final int start = Math.min(s1, s2); final int end = Math.max(s1, s2); final int s = toSerial(); if (include == SerialDate.INCLUDE_BOTH) { return (s >= start && s <= end); } else if (include == SerialDate.INCLUDE_FIRST) { return (s >= start && s < end); } else if (include == SerialDate.INCLUDE_SECOND) { return (s > start && s <= end); } else { return (s > start && s < end); } } /** * Calculate the serial number from the day, month and year. * <P> * 1-Jan-1900 = 2. * * @param d the day. * @param m the month. * @param y the year. * * @return the serial number from the day, month and year. */ private int calcSerial(final int d, final int m, final int y) { final int yy = ((y - 1900) * 365) + SerialDate.leapYearCount(y - 1); int mm = SerialDate.AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH[m]; if (m > MonthConstants.FEBRUARY) { if (SerialDate.isLeapYear(y)) { mm = mm + 1; } } final int dd = d; return yy + mm + dd + 1; } }
akardapolov/ASH-Viewer
jfreechart-fse/src/main/java/org/jfree/chart/date/SpreadsheetDate.java
Java
gpl-3.0
15,332
[ 30522, 1013, 1008, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 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...
var ViewportContainers = function ( editor ) { var container = new UI.Panel(); container.setId( 'ViewportContainers' ); return container; };
adarshk/storyblocks
js/render/ViewportContainers.js
JavaScript
mit
149
[ 30522, 13075, 3193, 6442, 8663, 18249, 2545, 1027, 3853, 1006, 3559, 1007, 1063, 13075, 11661, 1027, 2047, 21318, 1012, 5997, 1006, 1007, 1025, 11661, 1012, 2275, 3593, 1006, 1005, 3193, 6442, 8663, 18249, 2545, 1005, 1007, 1025, 2709, 1166...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 Newtonsoft.Json; namespace Din.Service.Clients.ResponseObjects { public class GiphyItem { [JsonProperty("data")] public GiphyData Data { get; set; } } public class GiphyData { [JsonProperty("image_original_url")] public string ImageOriginalUrl { get; set; } } }
D4N3-777/Din_Website
src/Din.Service/Clients/ResponseObjects/GiphyResponses.cs
C#
apache-2.0
312
[ 30522, 2478, 8446, 6499, 6199, 1012, 1046, 3385, 1025, 3415, 15327, 11586, 1012, 2326, 1012, 7846, 1012, 3433, 16429, 20614, 2015, 1063, 2270, 2465, 21025, 21281, 4221, 2213, 1063, 1031, 1046, 3385, 21572, 4842, 3723, 1006, 1000, 2951, 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...
zhangyu
RobbieRain/he
test.py
Python
apache-2.0
7
[ 30522, 9327, 10513, 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, 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.researchstack.skin.ui; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Build; import org.researchstack.backbone.StorageAccess; import org.researchstack.backbone.result.StepResult; import org.researchstack.backbone.result.TaskResult; import org.researchstack.backbone.step.Step; import org.researchstack.backbone.task.Task; import org.researchstack.backbone.ui.ViewTaskActivity; import org.researchstack.backbone.ui.callbacks.ActivityCallback; import org.researchstack.backbone.ui.step.layout.StepLayout; import org.researchstack.backbone.ui.step.layout.StepPermissionRequest; import org.researchstack.backbone.utils.TextUtils; import org.researchstack.skin.DataProvider; import org.researchstack.skin.PermissionRequestManager; import org.researchstack.skin.R; import org.researchstack.skin.TaskProvider; import org.researchstack.skin.task.OnboardingTask; import org.researchstack.skin.ui.layout.SignUpEligibleStepLayout; public class SignUpTaskActivity extends ViewTaskActivity implements ActivityCallback { TaskResult consentResult; public static Intent newIntent(Context context, Task task) { Intent intent = new Intent(context, SignUpTaskActivity.class); intent.putExtra(EXTRA_TASK, task); return intent; } @Override public void onDataAuth() { if (StorageAccess.getInstance().hasPinCode(this)) { super.onDataAuth(); } else // allow signup/in if no pincode { onDataReady(); } } @Override public void onSaveStep(int action, Step step, StepResult result) { // Save result to task onSaveStepResult(step.getIdentifier(), result); // Save Pin to disk, then save our consent info if (action == ACTION_NEXT && step.getIdentifier().equals(OnboardingTask.SignUpPassCodeCreationStepIdentifier)) { String pin = (String) result.getResult(); if (!TextUtils.isEmpty(pin)) { StorageAccess.getInstance().createPinCode(this, pin); } if (consentResult != null) { saveConsentResultInfo(); } } // Show next step onExecuteStepAction(action); } @Override public void startConsentTask() { Intent intent = ConsentTaskActivity.newIntent(this, TaskProvider.getInstance().get(TaskProvider.TASK_ID_CONSENT)); startActivityForResult(intent, SignUpEligibleStepLayout.CONSENT_REQUEST); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == SignUpEligibleStepLayout.CONSENT_REQUEST) { // User has passed through the entire consent flow if (resultCode == Activity.RESULT_OK) { consentResult = (TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT); // If they've already created a pincode, save consent, otherwise go to pin creation if (StorageAccess.getInstance().hasPinCode(this)) { saveConsentResultInfo(); } if (getCurrentStep().getIdentifier() .equals(OnboardingTask.SignUpEligibleStepIdentifier)) { showNextStep(); } } // User has exited else { finish(); } } else if (PermissionRequestManager.getInstance() .onNonSystemPermissionResult(this, requestCode, resultCode, data)) { updateStepLayoutForPermission(); } else { super.onActivityResult(requestCode, resultCode, data); } } private void saveConsentResultInfo() { DataProvider.getInstance().saveConsent(this, consentResult); } @TargetApi(Build.VERSION_CODES.M) @Override public void onRequestPermission(String id) { if (PermissionRequestManager.getInstance().isNonSystemPermission(id)) { PermissionRequestManager.getInstance().onRequestNonSystemPermission(this, id); } else { requestPermissions(new String[]{id}, PermissionRequestManager.PERMISSION_REQUEST_CODE); } } @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == PermissionRequestManager.PERMISSION_REQUEST_CODE) { updateStepLayoutForPermission(); } } private void updateStepLayoutForPermission() { StepLayout stepLayout = (StepLayout) findViewById(R.id.rsb_current_step); if (stepLayout instanceof StepPermissionRequest) { ((StepPermissionRequest) stepLayout) .onUpdateForPermissionResult(); } } }
ResearchStack/ResearchStack
skin/src/main/java/org/researchstack/skin/ui/SignUpTaskActivity.java
Java
apache-2.0
4,990
[ 30522, 7427, 8917, 1012, 2470, 9153, 3600, 1012, 3096, 1012, 21318, 1025, 12324, 11924, 1012, 5754, 17287, 3508, 1012, 4539, 9331, 2072, 1025, 12324, 11924, 1012, 10439, 1012, 4023, 1025, 12324, 11924, 1012, 4180, 1012, 6123, 1025, 12324, 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...
#!/bin/bash set -e OPTIND=1 seed="" # default to no seed specified while getopts "S:" opt do case "$opt" in S) seed="-S $OPTARG" ;; esac done shift "$((OPTIND-1))" bash ../tools/autotest.sh $seed -G *.v for f in `egrep -l 'expect-(wr|rd)-ports' *.v`; do echo -n "Testing expectations for $f .." ../../yosys -qp "proc; opt; memory -nomap;; dump -outfile ${f%.v}.dmp t:\$mem" $f if grep -q expect-wr-ports $f; then grep -q "parameter \\\\WR_PORTS $(gawk '/expect-wr-ports/ { print $3; }' $f)\$" ${f%.v}.dmp || { echo " ERROR: Unexpected number of write ports."; false; } fi if grep -q expect-rd-ports $f; then grep -q "parameter \\\\RD_PORTS $(gawk '/expect-rd-ports/ { print $3; }' $f)\$" ${f%.v}.dmp || { echo " ERROR: Unexpected number of read ports."; false; } fi echo " ok." done
azonenberg/yosys
tests/memories/run-test.sh
Shell
isc
819
[ 30522, 1001, 999, 1013, 8026, 1013, 24234, 2275, 1011, 1041, 23569, 22254, 1027, 1015, 6534, 1027, 1000, 1000, 1001, 12398, 2000, 30524, 1000, 1055, 1024, 1000, 23569, 2079, 2553, 1000, 1002, 23569, 1000, 1999, 1055, 1007, 6534, 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...
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function plural(n: number): number { if (n === 1) return 1; return 5; } export default [ 'ee-TG', [ ['ŋ', 'ɣ'], ['ŋdi', 'ɣetrɔ'], ], , [ ['k', 'd', 'b', 'k', 'y', 'f', 'm'], ['kɔs', 'dzo', 'bla', 'kuɖ', 'yaw', 'fiɖ', 'mem'], ['kɔsiɖa', 'dzoɖa', 'blaɖa', 'kuɖa', 'yawoɖa', 'fiɖa', 'memleɖa'], ['kɔs', 'dzo', 'bla', 'kuɖ', 'yaw', 'fiɖ', 'mem'] ], , [ ['d', 'd', 't', 'a', 'd', 'm', 's', 'd', 'a', 'k', 'a', 'd'], ['dzv', 'dzd', 'ted', 'afɔ', 'dam', 'mas', 'sia', 'dea', 'any', 'kel', 'ade', 'dzm'], [ 'dzove', 'dzodze', 'tedoxe', 'afɔfĩe', 'dama', 'masa', 'siamlɔm', 'deasiamime', 'anyɔnyɔ', 'kele', 'adeɛmekpɔxe', 'dzome' ] ], , [['HYV', 'Yŋ'], , ['Hafi Yesu Va', 'Yesu ŋɔli']], 1, [6, 0], ['M/d/yy', 'MMM d \'lia\', y', 'MMMM d \'lia\' y', 'EEEE, MMMM d \'lia\' y'], ['HH:mm', 'HH:mm:ss', 'HH:mm:ss z', 'HH:mm:ss zzzz'], [ '{0} {1}', , , ], ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'mnn', ':'], ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'], 'CFA', 'ɣetoɖofe afrikaga CFA franc BCEAO', plural ];
vsavkin/angular
packages/common/locales/ee-TG.ts
TypeScript
mit
1,434
[ 30522, 1013, 1008, 1008, 1008, 1030, 6105, 1008, 9385, 8224, 4297, 1012, 2035, 2916, 9235, 1012, 1008, 1008, 2224, 1997, 2023, 3120, 3642, 2003, 9950, 2011, 2019, 10210, 1011, 2806, 6105, 2008, 2064, 2022, 1008, 2179, 1999, 1996, 6105, 53...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
// @flow import type { Action, ExpandedSet, ProfileSelection, } from '../actions/types'; import type { Days, StartEndRange } from '../../common/types/units'; import type { IndexIntoFuncTable, Profile, ThreadIndex } from '../../common/types/profile'; import type { TransformStacksPerThread } from '../../common/types/transforms'; import type { TrackedData } from '../../common/types/trackedData'; import type { DateGraph, CategorySummary } from '../../common/types/workers'; export type Reducer<T> = (T, Action) => T; export type RequestedLib = { pdbName: string, breakpadId: string }; export type ThreadViewOptions = { selectedStack: IndexIntoFuncTable[], expandedStacks: Array<IndexIntoFuncTable[]>, }; export type ProfileViewState = { viewOptions: { threadOrder: number[], perThread: ThreadViewOptions[], selection: ProfileSelection, scrollToSelectionGeneration: number, rootRange: StartEndRange, zeroAt: Days, }, profile: Profile, }; export type TrackedDataViewState = { trackedData: TrackedData, }; export type AppState = { view: string, error: string, isURLSetupDone: boolean, }; export type RangeFilterState = { start: number, end: number, }; export type RunnablesViewState = { expanded: Set<number>, runnables: Object[], }; export type CategoriesViewState = { expanded: Set<number> | null, categories: CategorySummary[] | null, }; export type ExploreURLState = { selectedTab: string, rangeFilters: RangeFilterState[], selectedThread: ThreadIndex, callTreeSearchString: string, invertCallstack: boolean, hidePlatformDetails: boolean, historical: boolean, durationSpec: string, runnableFilter: string | null, categoryFilter: string, platformFilter: string, onlyUserInteracting: boolean, payloadID: string | null, mode: string, transforms: TransformStacksPerThread, }; export type TrackURLState = { trackedStat: string, mode: string, }; export type UnknownURLState = { mode: string, }; export type URLState = ExploreURLState | TrackURLState | UnknownURLState; export type IconState = Set<string>; export type State = { app: AppState, profileView: ProfileViewState, trackedDataView: TrackedDataViewState, runnablesView: RunnablesViewState, categoriesView: CategoriesViewState, urlState: URLState, dateGraph: DateGraph, icons: IconState, }; export type IconWithClassName = { icon: string, className: string, };
squarewave/bhr.html
src/content/reducers/types.js
JavaScript
mpl-2.0
2,440
[ 30522, 1013, 1013, 1030, 4834, 12324, 2828, 1063, 2895, 1010, 4423, 13462, 1010, 17879, 12260, 7542, 1010, 1065, 2013, 1005, 1012, 1012, 1013, 4506, 1013, 4127, 1005, 1025, 12324, 2828, 1063, 2420, 1010, 2707, 19524, 15465, 1065, 2013, 1005...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
//~ name b258 alert(b258); //~ component b259.js
homobel/makebird-node
test/projects/large/b258.js
JavaScript
mit
52
[ 30522, 1013, 1013, 1066, 2171, 1038, 17788, 2620, 9499, 1006, 1038, 17788, 2620, 1007, 1025, 1013, 1013, 1066, 6922, 1038, 17788, 2683, 1012, 1046, 2015, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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) eZ Systems AS. All rights reserved. * For full copyright and license information view LICENSE file distributed with this source code. */ YUI.add('ez-dashboardview', function (Y) { "use strict"; /** * Provides the Dashboard View class * * @module ez-dashboardview */ Y.namespace('eZ'); /** * The dashboard view * * @namespace eZ * @class DashboardView * @constructor * @extends eZ.TemplateBasedView */ Y.eZ.DashboardView = Y.Base.create('dashboardView', Y.eZ.TemplateBasedView, [Y.eZ.HeightFit], { initializer: function () { this.after('activeChange', this._setIFrameSource); }, /** * Renders the dashboard view * * @method render * @return {eZ.DashboardView} the view itself */ render: function () { this.get('container').setHTML(this.template()); this._attachedViewEvents.push(Y.on("windowresize", Y.bind(this._uiSetHeight, this, 0))); return this; }, /** * Sets the source of the iframe to the value of the iframeSource attribute. * * @method _setIFrameSource * @private */ _setIFrameSource: function () { this.get('container').one('.ez-dashboard-content').set('src', this.get('iframeSource')); } }, { ATTRS: { /** * Stores the iframe Source * * @attribute iframeSource * @type String * @default 'http://ez.no/in-product/eZ-Platform' * @readOnly */ iframeSource: { value: '//ez.no/in-product/eZ-Platform', readOnly: true, }, }, }); });
StephaneDiot/PlatformUIBundle-1
Resources/public/js/views/ez-dashboardview.js
JavaScript
gpl-2.0
1,838
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 1041, 2480, 3001, 2004, 1012, 2035, 2916, 9235, 1012, 1008, 2005, 2440, 9385, 1998, 6105, 2592, 3193, 6105, 5371, 5500, 2007, 2023, 3120, 3642, 1012, 1008, 1013, 9805, 2072, 1012, 5587, 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 /** * Base class that represents a row from the 'sf_guard_user_group' table. * * * * This class was autogenerated by Propel 1.4.2 on: * * Tue Jan 8 23:27:28 2013 * * @package plugins.sfGuardPlugin.lib.model.om */ abstract class BasesfGuardUserGroup extends BaseObject implements Persistent { /** * The Peer class. * Instance provides a convenient way of calling static methods on a class * that calling code may not be able to identify. * @var sfGuardUserGroupPeer */ protected static $peer; /** * The value for the user_id field. * @var int */ protected $user_id; /** * The value for the group_id field. * @var int */ protected $group_id; /** * @var sfGuardUser */ protected $asfGuardUser; /** * @var sfGuardGroup */ protected $asfGuardGroup; /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. * @var boolean */ protected $alreadyInSave = false; /** * Flag to prevent endless validation loop, if this object is referenced * by another object which falls in this transaction. * @var boolean */ protected $alreadyInValidation = false; // symfony behavior const PEER = 'sfGuardUserGroupPeer'; /** * Get the [user_id] column value. * * @return int */ public function getUserId() { return $this->user_id; } /** * Get the [group_id] column value. * * @return int */ public function getGroupId() { return $this->group_id; } /** * Set the value of [user_id] column. * * @param int $v new value * @return sfGuardUserGroup The current object (for fluent API support) */ public function setUserId($v) { if ($v !== null) { $v = (int) $v; } if ($this->user_id !== $v) { $this->user_id = $v; $this->modifiedColumns[] = sfGuardUserGroupPeer::USER_ID; } if ($this->asfGuardUser !== null && $this->asfGuardUser->getId() !== $v) { $this->asfGuardUser = null; } return $this; } // setUserId() /** * Set the value of [group_id] column. * * @param int $v new value * @return sfGuardUserGroup The current object (for fluent API support) */ public function setGroupId($v) { if ($v !== null) { $v = (int) $v; } if ($this->group_id !== $v) { $this->group_id = $v; $this->modifiedColumns[] = sfGuardUserGroupPeer::GROUP_ID; } if ($this->asfGuardGroup !== null && $this->asfGuardGroup->getId() !== $v) { $this->asfGuardGroup = null; } return $this; } // setGroupId() /** * Indicates whether the columns in this object are only set to default values. * * This method can be used in conjunction with isModified() to indicate whether an object is both * modified _and_ has some values set which are non-default. * * @return boolean Whether the columns in this object are only been set with default values. */ public function hasOnlyDefaultValues() { // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() /** * Hydrates (populates) the object variables with values from the database resultset. * * An offset (0-based "start column") is specified so that objects can be hydrated * with a subset of the columns in the resultset rows. This is needed, for example, * for results of JOIN queries where the resultset row includes columns from two or * more tables. * * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) * @param int $startcol 0-based offset column which indicates which restultset column to start with. * @param boolean $rehydrate Whether this object is being re-hydrated from the database. * @return int next starting column * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. */ public function hydrate($row, $startcol = 0, $rehydrate = false) { try { $this->user_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->group_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; $this->resetModified(); $this->setNew(false); if ($rehydrate) { $this->ensureConsistency(); } // FIXME - using NUM_COLUMNS may be clearer. return $startcol + 2; // 2 = sfGuardUserGroupPeer::NUM_COLUMNS - sfGuardUserGroupPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating sfGuardUserGroup object", $e); } } /** * Checks and repairs the internal consistency of the object. * * This method is executed after an already-instantiated object is re-hydrated * from the database. It exists to check any foreign keys to make sure that * the objects related to the current object are correct based on foreign key. * * You can override this method in the stub class, but you should always invoke * the base method from the overridden method (i.e. parent::ensureConsistency()), * in case your model changes. * * @throws PropelException */ public function ensureConsistency() { if ($this->asfGuardUser !== null && $this->user_id !== $this->asfGuardUser->getId()) { $this->asfGuardUser = null; } if ($this->asfGuardGroup !== null && $this->group_id !== $this->asfGuardGroup->getId()) { $this->asfGuardGroup = null; } } // ensureConsistency /** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * * @param boolean $deep (optional) Whether to also de-associated any related objects. * @param PropelPDO $con (optional) The PropelPDO connection to use. * @return void * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ public function reload($deep = false, PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); } if ($this->isNew()) { throw new PropelException("Cannot reload an unsaved object."); } if ($con === null) { $con = Propel::getConnection(sfGuardUserGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. $stmt = sfGuardUserGroupPeer::doSelectStmt($this->buildPkeyCriteria(), $con); $row = $stmt->fetch(PDO::FETCH_NUM); $stmt->closeCursor(); if (!$row) { throw new PropelException('Cannot find matching row in the database to reload object values.'); } $this->hydrate($row, 0, true); // rehydrate if ($deep) { // also de-associate any related objects? $this->asfGuardUser = null; $this->asfGuardGroup = null; } // if (deep) } /** * Removes this object from datastore and sets delete attribute. * * @param PropelPDO $con * @return void * @throws PropelException * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(sfGuardUserGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $ret = $this->preDelete($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BasesfGuardUserGroup:delete:pre') as $callable) { if (call_user_func($callable, $this, $con)) { $con->commit(); return; } } if ($ret) { sfGuardUserGroupPeer::doDelete($this, $con); $this->postDelete($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BasesfGuardUserGroup:delete:post') as $callable) { call_user_func($callable, $this, $con); } $this->setDeleted(true); $con->commit(); } else { $con->commit(); } } catch (PropelException $e) { $con->rollBack(); throw $e; } } /** * Persists this object to the database. * * If the object is new, it inserts it; otherwise an update is performed. * All modified related objects will also be persisted in the doSave() * method. This method wraps all precipitate database operations in a * single transaction. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see doSave() */ public function save(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(sfGuardUserGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); $isInsert = $this->isNew(); try { $ret = $this->preSave($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BasesfGuardUserGroup:save:pre') as $callable) { if (is_integer($affectedRows = call_user_func($callable, $this, $con))) { $con->commit(); return $affectedRows; } } if ($isInsert) { $ret = $ret && $this->preInsert($con); } else { $ret = $ret && $this->preUpdate($con); } if ($ret) { $affectedRows = $this->doSave($con); if ($isInsert) { $this->postInsert($con); } else { $this->postUpdate($con); } $this->postSave($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BasesfGuardUserGroup:save:post') as $callable) { call_user_func($callable, $this, $con, $affectedRows); } sfGuardUserGroupPeer::addInstanceToPool($this); } else { $affectedRows = 0; } $con->commit(); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } } /** * Performs the work of inserting or updating the row in the database. * * If the object is new, it inserts it; otherwise an update is performed. * All related objects are also updated in this method. * * @param PropelPDO $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see save() */ protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their coresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->asfGuardUser !== null) { if ($this->asfGuardUser->isModified() || $this->asfGuardUser->isNew()) { $affectedRows += $this->asfGuardUser->save($con); } $this->setsfGuardUser($this->asfGuardUser); } if ($this->asfGuardGroup !== null) { if ($this->asfGuardGroup->isModified() || $this->asfGuardGroup->isNew()) { $affectedRows += $this->asfGuardGroup->save($con); } $this->setsfGuardGroup($this->asfGuardGroup); } // If this object has been modified, then save it to the database. if ($this->isModified()) { if ($this->isNew()) { $pk = sfGuardUserGroupPeer::doInsert($this, $con); $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which // should always be true here (even though technically // BasePeer::doInsert() can insert multiple rows). $this->setNew(false); } else { $affectedRows += sfGuardUserGroupPeer::doUpdate($this, $con); } $this->resetModified(); // [HL] After being saved an object is no longer 'modified' } $this->alreadyInSave = false; } return $affectedRows; } // doSave() /** * Array of ValidationFailed objects. * @var array ValidationFailed[] */ protected $validationFailures = array(); /** * Gets any ValidationFailed objects that resulted from last call to validate(). * * * @return array ValidationFailed[] * @see validate() */ public function getValidationFailures() { return $this->validationFailures; } /** * Validates the objects modified field values and all objects related to this table. * * If $columns is either a column name or an array of column names * only those columns are validated. * * @param mixed $columns Column name or an array of column names. * @return boolean Whether all columns pass validation. * @see doValidate() * @see getValidationFailures() */ public function validate($columns = null) { $res = $this->doValidate($columns); if ($res === true) { $this->validationFailures = array(); return true; } else { $this->validationFailures = $res; return false; } } /** * This function performs the validation work for complex object models. * * In addition to checking the current object, all related objects will * also be validated. If all pass then <code>true</code> is returned; otherwise * an aggreagated array of ValidationFailed objects will be returned. * * @param array $columns Array of column names to validate. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise. */ protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { $this->alreadyInValidation = true; $retval = null; $failureMap = array(); // We call the validate method on the following object(s) if they // were passed to this object by their coresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->asfGuardUser !== null) { if (!$this->asfGuardUser->validate($columns)) { $failureMap = array_merge($failureMap, $this->asfGuardUser->getValidationFailures()); } } if ($this->asfGuardGroup !== null) { if (!$this->asfGuardGroup->validate($columns)) { $failureMap = array_merge($failureMap, $this->asfGuardGroup->getValidationFailures()); } } if (($retval = sfGuardUserGroupPeer::doValidate($this, $columns)) !== true) { $failureMap = array_merge($failureMap, $retval); } $this->alreadyInValidation = false; } return (!empty($failureMap) ? $failureMap : true); } /** * Retrieves a field from the object by name passed in as a string. * * @param string $name name * @param string $type The type of fieldname the $name is of: * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM * @return mixed Value of field. */ public function getByName($name, $type = BasePeer::TYPE_PHPNAME) { $pos = sfGuardUserGroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); $field = $this->getByPosition($pos); return $field; } /** * Retrieves a field from the object by Position as specified in the xml schema. * Zero-based. * * @param int $pos position in xml schema * @return mixed Value of field at $pos */ public function getByPosition($pos) { switch($pos) { case 0: return $this->getUserId(); break; case 1: return $this->getGroupId(); break; default: return null; break; } // switch() } /** * Exports the object as an array. * * You can specify the key type of the array by passing one of the class * type constants. * * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @return an associative array containing the field names (as keys) and field values */ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) { $keys = sfGuardUserGroupPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getUserId(), $keys[1] => $this->getGroupId(), ); return $result; } /** * Sets a field from the object by name passed in as a string. * * @param string $name peer name * @param mixed $value field value * @param string $type The type of fieldname the $name is of: * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM * @return void */ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = sfGuardUserGroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } /** * Sets a field from the object by Position as specified in the xml schema. * Zero-based. * * @param int $pos position in xml schema * @param mixed $value field value * @return void */ public function setByPosition($pos, $value) { switch($pos) { case 0: $this->setUserId($value); break; case 1: $this->setGroupId($value); break; } // switch() } /** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = sfGuardUserGroupPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setUserId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setGroupId($arr[$keys[1]]); } /** * Build a Criteria object containing the values of all modified columns in this object. * * @return Criteria The Criteria object containing all modified values. */ public function buildCriteria() { $criteria = new Criteria(sfGuardUserGroupPeer::DATABASE_NAME); if ($this->isColumnModified(sfGuardUserGroupPeer::USER_ID)) $criteria->add(sfGuardUserGroupPeer::USER_ID, $this->user_id); if ($this->isColumnModified(sfGuardUserGroupPeer::GROUP_ID)) $criteria->add(sfGuardUserGroupPeer::GROUP_ID, $this->group_id); return $criteria; } /** * Builds a Criteria object containing the primary key for this object. * * Unlike buildCriteria() this method includes the primary key values regardless * of whether or not they have been modified. * * @return Criteria The Criteria object containing value(s) for primary key(s). */ public function buildPkeyCriteria() { $criteria = new Criteria(sfGuardUserGroupPeer::DATABASE_NAME); $criteria->add(sfGuardUserGroupPeer::USER_ID, $this->user_id); $criteria->add(sfGuardUserGroupPeer::GROUP_ID, $this->group_id); return $criteria; } /** * Returns the composite primary key for this object. * The array elements will be in same order as specified in XML. * @return array */ public function getPrimaryKey() { $pks = array(); $pks[0] = $this->getUserId(); $pks[1] = $this->getGroupId(); return $pks; } /** * Set the [composite] primary key. * * @param array $keys The elements of the composite key (order must match the order in XML file). * @return void */ public function setPrimaryKey($keys) { $this->setUserId($keys[0]); $this->setGroupId($keys[1]); } /** * Sets contents of passed object to values from current object. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param object $copyObj An object of sfGuardUserGroup (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false) { $copyObj->setUserId($this->user_id); $copyObj->setGroupId($this->group_id); $copyObj->setNew(true); } /** * Makes a copy of this object that will be inserted as a new row in table when saved. * It creates a new object filling in the simple attributes, but skipping any primary * keys that are defined for the table. * * If desired, this method can also make copies of all associated (fkey referrers) * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @return sfGuardUserGroup Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this); $copyObj = new $clazz(); $this->copyInto($copyObj, $deepCopy); return $copyObj; } /** * Returns a peer instance associated with this om. * * Since Peer classes are not to have any instance attributes, this method returns the * same instance for all member of this class. The method could therefore * be static, but this would prevent one from overriding the behavior. * * @return sfGuardUserGroupPeer */ public function getPeer() { if (self::$peer === null) { self::$peer = new sfGuardUserGroupPeer(); } return self::$peer; } /** * Declares an association between this object and a sfGuardUser object. * * @param sfGuardUser $v * @return sfGuardUserGroup The current object (for fluent API support) * @throws PropelException */ public function setsfGuardUser(sfGuardUser $v = null) { if ($v === null) { $this->setUserId(NULL); } else { $this->setUserId($v->getId()); } $this->asfGuardUser = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the sfGuardUser object, it will not be re-added. if ($v !== null) { $v->addsfGuardUserGroup($this); } return $this; } /** * Get the associated sfGuardUser object * * @param PropelPDO Optional Connection object. * @return sfGuardUser The associated sfGuardUser object. * @throws PropelException */ public function getsfGuardUser(PropelPDO $con = null) { if ($this->asfGuardUser === null && ($this->user_id !== null)) { $this->asfGuardUser = sfGuardUserPeer::retrieveByPk($this->user_id); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->asfGuardUser->addsfGuardUserGroups($this); */ } return $this->asfGuardUser; } /** * Declares an association between this object and a sfGuardGroup object. * * @param sfGuardGroup $v * @return sfGuardUserGroup The current object (for fluent API support) * @throws PropelException */ public function setsfGuardGroup(sfGuardGroup $v = null) { if ($v === null) { $this->setGroupId(NULL); } else { $this->setGroupId($v->getId()); } $this->asfGuardGroup = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the sfGuardGroup object, it will not be re-added. if ($v !== null) { $v->addsfGuardUserGroup($this); } return $this; } /** * Get the associated sfGuardGroup object * * @param PropelPDO Optional Connection object. * @return sfGuardGroup The associated sfGuardGroup object. * @throws PropelException */ public function getsfGuardGroup(PropelPDO $con = null) { if ($this->asfGuardGroup === null && ($this->group_id !== null)) { $this->asfGuardGroup = sfGuardGroupPeer::retrieveByPk($this->group_id); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->asfGuardGroup->addsfGuardUserGroups($this); */ } return $this->asfGuardGroup; } /** * Resets all collections of referencing foreign keys. * * This method is a user-space workaround for PHP's inability to garbage collect objects * with circular references. This is currently necessary when using Propel in certain * daemon or large-volumne/high-memory operations. * * @param boolean $deep Whether to also clear the references on all associated objects. */ public function clearAllReferences($deep = false) { if ($deep) { } // if ($deep) $this->asfGuardUser = null; $this->asfGuardGroup = null; } // symfony_behaviors behavior /** * Calls methods defined via {@link sfMixer}. */ public function __call($method, $arguments) { if (!$callable = sfMixer::getCallable('BasesfGuardUserGroup:'.$method)) { throw new sfException(sprintf('Call to undefined method BasesfGuardUserGroup::%s', $method)); } array_unshift($arguments, $this); return call_user_func_array($callable, $arguments); } } // BasesfGuardUserGroup
joseortega/finance
plugins/sfGuardPlugin/lib/model/om/BasesfGuardUserGroup.php
PHP
gpl-3.0
26,055
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 2918, 2465, 2008, 5836, 1037, 5216, 2013, 1996, 1005, 16420, 1035, 3457, 1035, 5310, 1035, 2177, 1005, 2795, 1012, 1008, 1008, 1008, 1008, 2023, 2465, 2001, 8285, 6914, 16848, 2011, 17678, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
--- layout: post status: publish published: true title: WCF Metadata Publication and Others author: display_name: Tomas Restrepo login: tomasr email: tomas@winterdom.com url: http://winterdom.com/ author_login: tomasr author_email: tomas@winterdom.com author_url: http://winterdom.com/ wordpress_id: 68 wordpress_url: http://winterdom.com/2006/10/wcfmetadatapublicationandothers date: '2006-10-19 18:11:32 +0000' date_gmt: '2006-10-19 18:11:32 +0000' categories: - WCF - WinFX - Web Services tags: [] comments: [] --- <p><!--start_raw--> <p><a href="http:&#47;&#47;blogs.msdn.com&#47;ralph.squillace&#47;">Ralph Squillace</a> posted an <a href="http:&#47;&#47;blogs.msdn.com&#47;ralph.squillace&#47;archive&#47;2006&#47;10&#47;19&#47;quick-wcf-metadata-publication-walkthrough.aspx">walkthrough entry</a> of how metadata publication (MEX + WSDL) is enabled in Windows Communication Foundation. Besides discussing the configuration aspects, he also briefly touches on how those aspects affect the runtime behavior. </p> <p>This came at a perfect time for me because I spent a few hours yesterday going over the&nbsp;System.ServiceModel assemblies with reflector trying to understand how it was that the metadata endpoints get hooked up to a service, so this helps a bit. I still need to look closely at a few issues before I understand what's going on well enough to&nbsp;try at something similar I've been&nbsp;wanting to play with...</p> <p>Ralph has also been writing some samples about Sessionless Duplex Services <a href="http:&#47;&#47;blogs.msdn.com&#47;ralph.squillace&#47;archive&#47;2006&#47;10&#47;10&#47;Sessionless-duplex-services_3F00_-No-problem.-Small-issues_2C00_-yes_3B00_-problems_2C00_-no_2E00_.aspx">here</a> and <a href="http:&#47;&#47;blogs.msdn.com&#47;ralph.squillace&#47;archive&#47;2006&#47;10&#47;19&#47;sessionless-duplex-services-part-two-lifetimes-and-contexts.aspx">here</a> which are quite interesting as well.</p> <div class="wlWriterSmartContent" id="d7bf807d-7bb0-458a-811f-90c51817d5c2:ff287cc0-1809-47be-ac08-9afa2e4e4e06" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"> <p><span class="TagSite">Technorati:</span> <a href="http:&#47;&#47;technorati.com&#47;tag&#47;Windows+Communication+Foundation" rel="tag" class="tag">Windows Communication Foundation</a>, <a href="http:&#47;&#47;technorati.com&#47;tag&#47;WCF" rel="tag" class="tag">WCF</a><br &#47;><!-- StartInsertedTags: Windows Communication Foundation, WCF :EndInsertedTags --></p></div><!--end_raw--></p>
tomasr/winterdom.com
_posts/2006-10-19-wcfmetadatapublicationandothers.html
HTML
mit
2,603
[ 30522, 1011, 1011, 1011, 9621, 1024, 2695, 3570, 1024, 10172, 2405, 1024, 2995, 2516, 1024, 15868, 2546, 27425, 4772, 1998, 2500, 3166, 1024, 30524, 2099, 3166, 1035, 10373, 1024, 12675, 1030, 3467, 9527, 1012, 4012, 3166, 1035, 24471, 2140...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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.Linq; using UnityEditor; using UnityEditor.Animations; using UnityEngine; namespace Framework.Editor { [CustomActionEditor(typeof(ActionAnimParam))] public class ActionGraphEditorAnimParamNode : ActionGraphEditorNode { public ActionAnimParam Node => (ActionAnimParam) ActionNode; public ActionGraphEditorAnimParamNode(ActionGraph graph, ActionGraphNode node, ActionGraphPresenter presenter) : base(graph, node, presenter) { } private void SetNewParam(AnimatorControllerParameter param) { Undo.RecordObject(Node, "Changed anim param"); Node.AnimParam.Name = param.name; switch (param.type) { case AnimatorControllerParameterType.Trigger: Node.AnimParam = new Variant ( new SerializedType(typeof(bool), ActionAnimParam.TriggerMetadata) ); break; case AnimatorControllerParameterType.Bool: Node.AnimParam = new Variant ( typeof(bool) ); Node.AnimParam.SetAs(param.defaultBool); break; case AnimatorControllerParameterType.Float: Node.AnimParam = new Variant ( typeof(float) ); Node.AnimParam.SetAs(param.defaultFloat); break; case AnimatorControllerParameterType.Int: Node.AnimParam = new Variant ( typeof(int) ); Node.AnimParam.SetAs(param.defaultInt); break; } Node.AnimParam.Name = param.name; } protected override void DrawContent() { if (Node.Anim) { GUI.Box(drawRect, GUIContent.none, EditorStyles.helpBox); var controller = AssetDatabase.LoadAssetAtPath<AnimatorController>(AssetDatabase.GetAssetPath(Node.Anim)); if (controller == null) { Debug.LogErrorFormat("AnimatorController must not be null."); return; } int index = -1; var paramList = controller.parameters.ToList(); var param = paramList.FirstOrDefault(p => p.name == Node.AnimParam.Name); if (param != null) { index = paramList.IndexOf(param); } drawRect.x += ContentMargin; drawRect.width = drawRect.width - ContentMargin * 2; drawRect.height = VariantUtils.FieldHeight; int newIndex = EditorGUI.Popup(drawRect, index, paramList.Select(p => p.name).ToArray()); if (newIndex != index) { SetNewParam(paramList[newIndex]); } if (string.IsNullOrWhiteSpace(Node.AnimParam?.HoldType?.Metadata)) { drawRect.y += drawRect.height; VariantUtils.DrawParameter(drawRect, Node.AnimParam, false); } } else { EditorGUI.HelpBox(drawRect, "AnimController is required!", MessageType.Error); } } } }
MrJaqbq/Unity3DFramework
Editor/ActionGraph/ActionGraphEditorAnimParamNode.cs
C#
mit
3,547
[ 30522, 2478, 2291, 1012, 11409, 4160, 1025, 2478, 8499, 2098, 15660, 1025, 2478, 8499, 2098, 15660, 1012, 7284, 2015, 1025, 2478, 8499, 13159, 3170, 1025, 3415, 15327, 7705, 1012, 3559, 1063, 1031, 7661, 18908, 19798, 15660, 1006, 2828, 112...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
#! /bin/bash ## Test of SIMPLI provisionning module source ../../../../test/test_common.sh "webstorm module provisionning - manual" ## load simpli which will do apt-get update export SIMPLI_SKIP_APT_UPDATE=1 export SIMPLI_SKIP_APT_UPGRADE=1 source "${SIMPLI_DIR}/bin/index.sh" OSL_EXIT_abort_execution_if_bad_retcode $? ## provision our stuff require offirmo/webstorm OSL_EXIT_abort_execution_if_bad_retcode $? ## display a summary (user-mode only) print_provisionning_summary echo
Offirmo/simpli
modules/offirmo/webstorm/test/run_me_to_install_oss_on_current_machine.sh
Shell
unlicense
488
[ 30522, 1001, 999, 1013, 8026, 1013, 24234, 1001, 1001, 3231, 1997, 21934, 24759, 2072, 9347, 5582, 11336, 3120, 1012, 1012, 1013, 1012, 1012, 1013, 1012, 1012, 1013, 1012, 1012, 1013, 3231, 1013, 3231, 1035, 2691, 1012, 14021, 1000, 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...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Type definition lagged_fibonacci607</title> <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> <link rel="up" href="../../boost_random/reference.html#header.boost.random.lagged_fibonacci_hpp" title="Header &lt;boost/random/lagged_fibonacci.hpp&gt;"> <link rel="prev" href="lagged_fibonacci_01_engine.html" title="Class template lagged_fibonacci_01_engine"> <link rel="next" href="lagged_fibonacci1279.html" title="Type definition lagged_fibonacci1279"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> <td align="center"><a href="../../../../index.html">Home</a></td> <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="lagged_fibonacci_01_engine.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_random/reference.html#header.boost.random.lagged_fibonacci_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="lagged_fibonacci1279.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="refentry"> <a name="boost.random.lagged_fibonacci607"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Type definition lagged_fibonacci607</span></h2> <p>lagged_fibonacci607</p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../boost_random/reference.html#header.boost.random.lagged_fibonacci_hpp" title="Header &lt;boost/random/lagged_fibonacci.hpp&gt;">boost/random/lagged_fibonacci.hpp</a>&gt; </span> <span class="keyword">typedef</span> <a class="link" href="lagged_fibonacci_01_engine.html" title="Class template lagged_fibonacci_01_engine">lagged_fibonacci_01_engine</a><span class="special">&lt;</span> <span class="keyword">double</span><span class="special">,</span> <span class="number">48</span><span class="special">,</span> <span class="number">607</span><span class="special">,</span> <span class="number">273</span> <span class="special">&gt;</span> <span class="identifier">lagged_fibonacci607</span><span class="special">;</span></pre></div> <div class="refsect1"> <a name="idp586767856"></a><h2>Description</h2> <p>The specializations lagged_fibonacci607 ... lagged_fibonacci44497 use well tested lags.</p> <p>See</p> <p> </p> <div class="blockquote"><blockquote class="blockquote"><p> "On the Periods of Generalized Fibonacci Recurrences", Richard P. Brent Computer Sciences Laboratory Australian National University, December 1992 </p></blockquote></div> <p> </p> <p>The lags used here can be found in</p> <p> </p> <div class="blockquote"><blockquote class="blockquote"><p> "Uniform random number generators for supercomputers", Richard Brent, Proc. of Fifth Australian Supercomputer Conference, Melbourne, Dec. 1992, pp. 704-706. </p></blockquote></div> <p> </p> </div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2000-2005 Jens Maurer<br>Copyright &#169; 2009, 2010 Steven Watanabe<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="lagged_fibonacci_01_engine.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_random/reference.html#header.boost.random.lagged_fibonacci_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="lagged_fibonacci1279.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
ntonjeta/iidea-Docker
examples/sobel/src/boost_1_63_0/doc/html/boost/random/lagged_fibonacci607.html
HTML
agpl-3.0
5,082
[ 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...
/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 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; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* In here, we rewrite queries (to obfuscate passwords etc.) that need it before we log them. Stored procedures may also rewrite their statements (to show the actual values of their variables etc.). There is currently no scenario where a statement can be eligible for both rewrites. (see sp_instr.cc) Special consideration will need to be taken if this assertion is changed. We also do not intersect with query cache at this time, as QC only caches SELECTs (which we don't rewrite). If and when QC becomes more general, it should probably cache the rewritten query along with the user-submitted one. (see sql_parse.cc) */ #include "auth_common.h" // append_user #include "sql_parse.h" // get_current_user #include "sql_show.h" // append_identifier #include "sp_head.h" // struct set_var_base #include "rpl_slave.h" // SLAVE_SQL, SLAVE_IO /** Append a key/value pair to a string, with an optional preceeding comma. For numeric values. @param str The string to append to @param comma Prepend a comma? @param txt C-string, must end in a space @param len strlen(txt) @param val numeric value @param cond only append if this evaluates to true @retval false if any subsequent key/value pair would be the first */ bool append_int(String *str, bool comma, const char *txt, size_t len, long val, int cond) { if (cond) { String numbuf(42); if (comma) str->append(STRING_WITH_LEN(", ")); str->append(txt,len); numbuf.set((longlong)val,&my_charset_bin); str->append(numbuf); return true; } return comma; } /** Append a key/value pair to a string if the value is non-NULL, with an optional preceeding comma. @param str The string to append to @param comma Prepend a comma? @param key C-string: the key, must be non-NULL @param val C-string: the value @retval false if any subsequent key/value pair would be the first */ bool append_str(String *str, bool comma, const char *key, const char *val) { if (val) { if (comma) str->append(STRING_WITH_LEN(", ")); str->append(key); str->append(STRING_WITH_LEN(" '")); str->append(val); str->append(STRING_WITH_LEN("'")); return true; } return comma; } /** Rewrite a GRANT statement. @param thd The THD to rewrite for. @param rlb An empty String object to put the rewritten query in. */ static void mysql_rewrite_grant(THD *thd, String *rlb) { LEX *lex= thd->lex; TABLE_LIST *first_table= (TABLE_LIST*) lex->select_lex->table_list.first; bool comma= FALSE, comma_inner; String cols(1024); int c; rlb->append(STRING_WITH_LEN("GRANT ")); if (lex->all_privileges) rlb->append(STRING_WITH_LEN("ALL PRIVILEGES")); else { ulong priv; for (c= 0, priv= SELECT_ACL; priv <= GLOBAL_ACLS; c++, priv <<= 1) { if (priv == GRANT_ACL) continue; comma_inner= FALSE; if (lex->columns.elements) // show columns, if any { class LEX_COLUMN *column; List_iterator <LEX_COLUMN> column_iter(lex->columns); cols.length(0); cols.append(STRING_WITH_LEN(" (")); /* If the statement was GRANT SELECT(f2), INSERT(f3), UPDATE(f1,f3, f2), our list cols will contain the order f2, f3, f1, and thus that's the order we'll recreate the privilege: UPDATE (f2, f3, f1) */ while ((column= column_iter++)) { if (column->rights & priv) { if (comma_inner) cols.append(STRING_WITH_LEN(", ")); else comma_inner= TRUE; cols.append(column->column.ptr(),column->column.length()); } } cols.append(STRING_WITH_LEN(")")); } if (comma_inner || (lex->grant & priv)) // show privilege name { if (comma) rlb->append(STRING_WITH_LEN(", ")); else comma= TRUE; rlb->append(command_array[c],command_lengths[c]); if (!(lex->grant & priv)) // general outranks specific rlb->append(cols); } } if (!comma) // no privs, default to USAGE rlb->append(STRING_WITH_LEN("USAGE")); } rlb->append(STRING_WITH_LEN(" ON ")); switch(lex->type) { case TYPE_ENUM_PROCEDURE: rlb->append(STRING_WITH_LEN("PROCEDURE ")); break; case TYPE_ENUM_FUNCTION: rlb->append(STRING_WITH_LEN("FUNCTION ")); break; default: break; } if (first_table) { append_identifier(thd, rlb, first_table->db, strlen(first_table->db)); rlb->append(STRING_WITH_LEN(".")); append_identifier(thd, rlb, first_table->table_name, strlen(first_table->table_name)); } else { if (lex->current_select()->db) append_identifier(thd, rlb, lex->current_select()->db, strlen(lex->current_select()->db)); else rlb->append("*"); rlb->append(STRING_WITH_LEN(".*")); } rlb->append(STRING_WITH_LEN(" TO ")); { LEX_USER *user_name, *tmp_user_name; List_iterator <LEX_USER> user_list(lex->users_list); bool comma= FALSE; while ((tmp_user_name= user_list++)) { if ((user_name= get_current_user(thd, tmp_user_name))) { append_user(thd, rlb, user_name, comma, true); comma= TRUE; } } } if (lex->ssl_type != SSL_TYPE_NOT_SPECIFIED) { rlb->append(STRING_WITH_LEN(" REQUIRE")); switch (lex->ssl_type) { case SSL_TYPE_SPECIFIED: if (lex->x509_subject) { rlb->append(STRING_WITH_LEN(" SUBJECT '")); rlb->append(lex->x509_subject); rlb->append(STRING_WITH_LEN("'")); } if (lex->x509_issuer) { rlb->append(STRING_WITH_LEN(" ISSUER '")); rlb->append(lex->x509_issuer); rlb->append(STRING_WITH_LEN("'")); } if (lex->ssl_cipher) { rlb->append(STRING_WITH_LEN(" CIPHER '")); rlb->append(lex->ssl_cipher); rlb->append(STRING_WITH_LEN("'")); } break; case SSL_TYPE_X509: rlb->append(STRING_WITH_LEN(" X509")); break; case SSL_TYPE_ANY: rlb->append(STRING_WITH_LEN(" SSL")); break; case SSL_TYPE_NOT_SPECIFIED: /* fall-thru */ case SSL_TYPE_NONE: rlb->append(STRING_WITH_LEN(" NONE")); break; } } if (lex->mqh.specified_limits || (lex->grant & GRANT_ACL)) { rlb->append(STRING_WITH_LEN(" WITH")); if (lex->grant & GRANT_ACL) rlb->append(STRING_WITH_LEN(" GRANT OPTION")); append_int(rlb, false, STRING_WITH_LEN(" MAX_QUERIES_PER_HOUR "), lex->mqh.questions, lex->mqh.specified_limits & USER_RESOURCES::QUERIES_PER_HOUR); append_int(rlb, false, STRING_WITH_LEN(" MAX_UPDATES_PER_HOUR "), lex->mqh.updates, lex->mqh.specified_limits & USER_RESOURCES::UPDATES_PER_HOUR); append_int(rlb, false, STRING_WITH_LEN(" MAX_CONNECTIONS_PER_HOUR "), lex->mqh.conn_per_hour, lex->mqh.specified_limits & USER_RESOURCES::CONNECTIONS_PER_HOUR); append_int(rlb, false, STRING_WITH_LEN(" MAX_USER_CONNECTIONS "), lex->mqh.user_conn, lex->mqh.specified_limits & USER_RESOURCES::USER_CONNECTIONS); } } /** Rewrite a SET statement. @param thd The THD to rewrite for. @param rlb An empty String object to put the rewritten query in. */ static void mysql_rewrite_set(THD *thd, String *rlb) { LEX *lex= thd->lex; List_iterator_fast<set_var_base> it(lex->var_list); set_var_base *var; bool comma= FALSE; rlb->append(STRING_WITH_LEN("SET ")); while ((var= it++)) { if (comma) rlb->append(STRING_WITH_LEN(",")); else comma= TRUE; var->print(thd, rlb); } } /** Rewrite CREATE USER statement. @param thd The THD to rewrite for. @param rlb An empty String object to put the rewritten query in. */ static void mysql_rewrite_create_user(THD *thd, String *rlb) { LEX *lex= thd->lex; LEX_USER *user_name, *tmp_user_name; List_iterator <LEX_USER> user_list(lex->users_list); bool comma= FALSE; rlb->append(STRING_WITH_LEN("CREATE USER ")); while ((tmp_user_name= user_list++)) { if ((user_name= get_current_user(thd, tmp_user_name))) { append_user(thd, rlb, user_name, comma, TRUE); comma= TRUE; } } } /** Rewrite a CHANGE MASTER statement. @param thd The THD to rewrite for. @param rlb An empty String object to put the rewritten query in. */ static void mysql_rewrite_change_master(THD *thd, String *rlb) { LEX *lex= thd->lex; rlb->append(STRING_WITH_LEN("CHANGE MASTER TO")); if (lex->mi.host) { rlb->append(STRING_WITH_LEN(" MASTER_HOST = '")); rlb->append(lex->mi.host); rlb->append(STRING_WITH_LEN("'")); } if (lex->mi.user) { rlb->append(STRING_WITH_LEN(" MASTER_USER = '")); rlb->append(lex->mi.user); rlb->append(STRING_WITH_LEN("'")); } if (lex->mi.password) { rlb->append(STRING_WITH_LEN(" MASTER_PASSWORD = <secret>")); } if (lex->mi.port) { rlb->append(STRING_WITH_LEN(" MASTER_PORT = ")); rlb->append_ulonglong(lex->mi.port); } if (lex->mi.connect_retry) { rlb->append(STRING_WITH_LEN(" MASTER_CONNECT_RETRY = ")); rlb->append_ulonglong(lex->mi.connect_retry); } if (lex->mi.ssl) { rlb->append(STRING_WITH_LEN(" MASTER_SSL = ")); rlb->append(lex->mi.ssl == LEX_MASTER_INFO::LEX_MI_ENABLE ? "1" : "0"); } if (lex->mi.ssl_ca) { rlb->append(STRING_WITH_LEN(" MASTER_SSL_CA = '")); rlb->append(lex->mi.ssl_ca); rlb->append(STRING_WITH_LEN("'")); } if (lex->mi.ssl_capath) { rlb->append(STRING_WITH_LEN(" MASTER_SSL_CAPATH = '")); rlb->append(lex->mi.ssl_capath); rlb->append(STRING_WITH_LEN("'")); } if (lex->mi.ssl_cert) { rlb->append(STRING_WITH_LEN(" MASTER_SSL_CERT = '")); rlb->append(lex->mi.ssl_cert); rlb->append(STRING_WITH_LEN("'")); } if (lex->mi.ssl_cipher) { rlb->append(STRING_WITH_LEN(" MASTER_SSL_CIPHER = '")); rlb->append(lex->mi.ssl_cipher); rlb->append(STRING_WITH_LEN("'")); } if (lex->mi.ssl_key) { rlb->append(STRING_WITH_LEN(" MASTER_SSL_KEY = '")); rlb->append(lex->mi.ssl_key); rlb->append(STRING_WITH_LEN("'")); } if (lex->mi.log_file_name) { rlb->append(STRING_WITH_LEN(" MASTER_LOG_FILE = '")); rlb->append(lex->mi.log_file_name); rlb->append(STRING_WITH_LEN("'")); } if (lex->mi.pos) { rlb->append(STRING_WITH_LEN(" MASTER_LOG_POS = ")); rlb->append_ulonglong(lex->mi.pos); } if (lex->mi.relay_log_name) { rlb->append(STRING_WITH_LEN(" RELAY_LOG_FILE = '")); rlb->append(lex->mi.relay_log_name); rlb->append(STRING_WITH_LEN("'")); } if (lex->mi.relay_log_pos) { rlb->append(STRING_WITH_LEN(" RELAY_LOG_POS = ")); rlb->append_ulonglong(lex->mi.relay_log_pos); } if (lex->mi.ssl_verify_server_cert) { rlb->append(STRING_WITH_LEN(" MASTER_SSL_VERIFY_SERVER_CERT = ")); rlb->append(lex->mi.ssl_verify_server_cert == LEX_MASTER_INFO::LEX_MI_ENABLE ? "1" : "0"); } if (lex->mi.repl_ignore_server_ids_opt) { bool first= TRUE; rlb->append(STRING_WITH_LEN(" IGNORE_SERVER_IDS = ( ")); for (uint i= 0; i < lex->mi.repl_ignore_server_ids.elements; i++) { ulong s_id; get_dynamic(&lex->mi.repl_ignore_server_ids, (uchar*) &s_id, i); if (first) first= FALSE; else rlb->append(STRING_WITH_LEN(", ")); rlb->append_ulonglong(s_id); } rlb->append(STRING_WITH_LEN(" )")); } if (lex->mi.heartbeat_opt != LEX_MASTER_INFO::LEX_MI_UNCHANGED) { rlb->append(STRING_WITH_LEN(" MASTER_HEARTBEAT_PERIOD = ")); if (lex->mi.heartbeat_opt == LEX_MASTER_INFO::LEX_MI_DISABLE) rlb->append(STRING_WITH_LEN("0")); else { char buf[64]; snprintf(buf, 64, "%f", lex->mi.heartbeat_period); rlb->append(buf); } } } /** Rewrite a START SLAVE statement. @param thd The THD to rewrite for. @param rlb An empty String object to put the rewritten query in. */ static void mysql_rewrite_start_slave(THD *thd, String *rlb) { LEX *lex= thd->lex; if (!lex->slave_connection.password) return; rlb->append(STRING_WITH_LEN("START SLAVE")); if (lex->slave_thd_opt & SLAVE_IO) rlb->append(STRING_WITH_LEN(" IO_THREAD")); /* we have printed the IO THREAD related options */ if (lex->slave_thd_opt & SLAVE_IO && lex->slave_thd_opt & SLAVE_SQL) rlb->append(STRING_WITH_LEN(",")); if (lex->slave_thd_opt & SLAVE_SQL) rlb->append(STRING_WITH_LEN(" SQL_THREAD")); /* until options */ if (lex->mi.log_file_name || lex->mi.relay_log_name) { rlb->append(STRING_WITH_LEN(" UNTIL")); if (lex->mi.log_file_name) { rlb->append(STRING_WITH_LEN(" MASTER_LOG_FILE = '")); rlb->append(lex->mi.log_file_name); rlb->append(STRING_WITH_LEN("', ")); rlb->append(STRING_WITH_LEN("MASTER_LOG_POS = ")); rlb->append_ulonglong(lex->mi.pos); } if (lex->mi.relay_log_name) { rlb->append(STRING_WITH_LEN(" RELAY_LOG_FILE = '")); rlb->append(lex->mi.relay_log_name); rlb->append(STRING_WITH_LEN("', ")); rlb->append(STRING_WITH_LEN("RELAY_LOG_POS = ")); rlb->append_ulonglong(lex->mi.relay_log_pos); } } /* connection options */ if (lex->slave_connection.user) { rlb->append(STRING_WITH_LEN(" USER = '")); rlb->append(lex->slave_connection.user); rlb->append(STRING_WITH_LEN("'")); } if (lex->slave_connection.password) rlb->append(STRING_WITH_LEN(" PASSWORD = '<secret>'")); if (lex->slave_connection.plugin_auth) { rlb->append(STRING_WITH_LEN(" DEFAULT_AUTH = '")); rlb->append(lex->slave_connection.plugin_auth); rlb->append(STRING_WITH_LEN("'")); } if (lex->slave_connection.plugin_dir) { rlb->append(STRING_WITH_LEN(" PLUGIN_DIR = '")); rlb->append(lex->slave_connection.plugin_dir); rlb->append(STRING_WITH_LEN("'")); } } /** Rewrite a SERVER OPTIONS clause (for CREATE SERVER and ALTER SERVER). @param thd The THD to rewrite for. @param rlb An empty String object to put the rewritten query in. */ static void mysql_rewrite_server_options(THD *thd, String *rlb) { LEX *lex= thd->lex; rlb->append(STRING_WITH_LEN(" OPTIONS ( ")); rlb->append(STRING_WITH_LEN("PASSWORD '<secret>'")); append_str(rlb, true, "USER", lex->server_options.get_username()); append_str(rlb, true, "HOST", lex->server_options.get_host()); append_str(rlb, true, "DATABASE", lex->server_options.get_db()); append_str(rlb, true, "OWNER", lex->server_options.get_owner()); append_str(rlb, true, "SOCKET", lex->server_options.get_socket()); append_int(rlb, true, STRING_WITH_LEN("PORT "), lex->server_options.get_port(), lex->server_options.get_port() != Server_options::PORT_NOT_SET); rlb->append(STRING_WITH_LEN(" )")); } /** Rewrite a CREATE SERVER statement. @param thd The THD to rewrite for. @param rlb An empty String object to put the rewritten query in. */ static void mysql_rewrite_create_server(THD *thd, String *rlb) { LEX *lex= thd->lex; if (!lex->server_options.get_password()) return; rlb->append(STRING_WITH_LEN("CREATE SERVER ")); rlb->append(lex->server_options.m_server_name.str ? lex->server_options.m_server_name.str : ""); rlb->append(STRING_WITH_LEN(" FOREIGN DATA WRAPPER '")); rlb->append(lex->server_options.get_scheme() ? lex->server_options.get_scheme() : ""); rlb->append(STRING_WITH_LEN("'")); mysql_rewrite_server_options(thd, rlb); } /** Rewrite a ALTER SERVER statement. @param thd The THD to rewrite for. @param rlb An empty String object to put the rewritten query in. */ static void mysql_rewrite_alter_server(THD *thd, String *rlb) { LEX *lex= thd->lex; if (!lex->server_options.get_password()) return; rlb->append(STRING_WITH_LEN("ALTER SERVER ")); rlb->append(lex->server_options.m_server_name.str ? lex->server_options.m_server_name.str : ""); mysql_rewrite_server_options(thd, rlb); } /** Rewrite a query (to obfuscate passwords etc.) Side-effects: thd->rewritten_query will contain a rewritten query, or be cleared if no rewriting took place. @param thd The THD to rewrite for. */ void mysql_rewrite_query(THD *thd) { String *rlb= &thd->rewritten_query; rlb->free(); if (thd->lex->contains_plaintext_password) { switch(thd->lex->sql_command) { case SQLCOM_GRANT: mysql_rewrite_grant(thd, rlb); break; case SQLCOM_SET_OPTION: mysql_rewrite_set(thd, rlb); break; case SQLCOM_CREATE_USER: mysql_rewrite_create_user(thd, rlb); break; case SQLCOM_CHANGE_MASTER: mysql_rewrite_change_master(thd, rlb); break; case SQLCOM_SLAVE_START: mysql_rewrite_start_slave(thd, rlb); break; case SQLCOM_CREATE_SERVER: mysql_rewrite_create_server(thd, rlb); break; case SQLCOM_ALTER_SERVER: mysql_rewrite_alter_server(thd, rlb); break; default: /* unhandled query types are legal. */ break; } } }
zach14c/mysql
sql/sql_rewrite.cc
C++
gpl-2.0
18,637
[ 30522, 1013, 1008, 9385, 1006, 1039, 1007, 2249, 1010, 2286, 1010, 14721, 1998, 1013, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 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...
<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="twitter:site" content="@kivyframework"> <title>Text layout &mdash; Kivy 1.10.0 ドキュメント</title> <link href='//fonts.googleapis.com/css?family=Source+Code+Pro:400,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="_static/fresh.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: './', VERSION: '1.10.0', COLLAPSE_MODINDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="_static/translations.js"></script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <script type="text/javascript" src="_static/jquery-effects-core-and-slide.js"></script> <script type="text/javascript" src="_static/jquery.cookie.js"></script> <script type="text/javascript" src="_static/kivy.js"></script> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="top" title="Kivy 1.10.0 ドキュメント" href="index.html" /> <link rel="up" title="Text" href="api-kivy.core.text.html" /> <link rel="next" title="Text Markup" href="api-kivy.core.text.markup.html" /> <link rel="prev" title="Text" href="api-kivy.core.text.html" /> </head> <body> <div id="topbar"> <div id="topwrapper"> <div id="toplogo"> <a href="http://kivy.org/"> <img src="_static/logo-kivy.png" alt="Kivy" height="50"/> </a> </div> <div id="topmenu"> <ul class="navigation"> <li><a class="nav-guides" href="gettingstarted/intro.html">Guides</a></li> <li><a class="nav-garden" href="http://kivy-garden.github.io/">Garden</a></li> <li><a class="nav-api" href="api-kivy.html">API Reference</a></li> <li><a class="nav-pdf" href="https://media.readthedocs.org/pdf/kivy/latest/kivy.pdf">PDF</a></li> <li><a class="nav-wiki" href="http://wiki.kivy.org">Wiki</a></li> </ul> </div> </div> </div> <div id="contentall"> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> &nbsp; <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> <input type="text" class="text" name="q" /> </form> <!-- <h3><a href="index.html">Text layout</a></h3> <ul> <li><a class="reference internal" href="#">Text layout</a></li> </ul> <h3><a href="index.html">Table Of Contents</a></h3> --> <ul> <li class="toctree-l1"><a class="reference internal" href="gettingstarted/index.html">Getting Started(翻訳済み)</a><ul> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/intro.html">Introduction (翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/installation.html">Installation(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/first_app.html">A first App(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/properties.html">Properties(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/rules.html">Kv Design Language(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/events.html">Events(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/framework.html">Non-widget stuff(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/layouts.html">Layouts(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/drawing.html">Drawing(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/packaging.html">Packaging(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/examples.html">Examples(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="gettingstarted/diving.html">Diving in(翻訳済み)</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="examples/index.html">Gallery of Examples(翻訳済み)</a><ul> <li class="toctree-l2"><a class="reference internal" href="examples/gallery.html">Gallery(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__3Drendering__main__py.html">3D Rotating Monkey Head(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__animation__animate__py.html">Widget animation(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__application__app_suite__py.html">Suite of Application Builders(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__application__app_with_build__py.html">Application example using build() + return(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__application__app_with_kv__py.html">Application built from a .kv fil(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__application__app_with_kv_in_template1__py.html">Application from a .kv in a Template Directory(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__camera__main__py.html">Camera Example(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__bezier__py.html">Bezier Example(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__canvas_stress__py.html">Canvas stress(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__circle__py.html">Circle Example(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__fbo_canvas__py.html">FBO Canvas(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__lines__py.html">Line (SmoothLine) Experiment(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__lines_extended__py.html">Lines Extended Demo(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__mesh__py.html">Mesh test(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__multitexture__py.html">Multitexture Example(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__repeat_texture__py.html">Repeat Texture on Resize(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__rotation__py.html">Rotation Example(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__stencil_canvas__py.html">Stencil demo(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__tesselate__py.html">Tesselate Demonstration</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__canvas__texture__py.html">Texture Wrapping and Coordinates Example(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__demo__camera_puzzle__py.html">Shuffled Camera Feed Puzzle(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__demo__kivycatalog__main__py.html">Kivy Catalog(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__demo__multistroke__main__py.html">Multistroke Recognition Database Demonstration(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__demo__pictures__main__py.html">Basic Picture Viewer(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__demo__shadereditor__main__py.html">Live Shader Editor(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__demo__showcase__main__py.html">Showcase of Kivy Features</a></li> <li class="toctree-l2"><a class="reference internal" href="examples/gen__demo__touchtracer__main__py.html">Touch Tracer Line Drawing Demonstration(翻訳済み)</a></li> </ul> </li> </ul> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="user-guide.html">User’s Guide(翻訳済み)</a><ul> <li class="toctree-l2"><a class="reference internal" href="installation/installation.html">Installation(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="philosophy.html">Philosophy(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="contribute.html">Contributing(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="faq.html">FAQ (翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="contact.html">Contact Us(翻訳済み)</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="guide-index.html">Programming Guide(翻訳済み)</a><ul> <li class="toctree-l2"><a class="reference internal" href="guide/basic.html">Kivy Basics(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/environment.html">Controlling the environment(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/config.html">Configure Kivy(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/architecture.html">Architectural Overview(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/events.html">Events and Properties (翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/inputs.html">Input management (翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/widgets.html">Widgets(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/graphics.html">Graphics (翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/lang.html">Kv language(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/other-frameworks.html">Integrating with other Frameworks(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/packaging.html">Packaging your application(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="guide/licensing.html">Package licensing (翻訳済み)</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="tutorials-index.html">Tutorials(翻訳済み)</a><ul> <li class="toctree-l2"><a class="reference internal" href="tutorials/pong.html">Pong Game Tutorial(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="tutorials/firstwidget.html">A Simple Paint App(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="tutorials/crashcourse.html">Crash Course(翻訳済み)</a></li> </ul> </li> <li class="toctree-l1 current"><a class="reference internal" href="api-index.html">API Reference</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="api-kivy.html">Kivy framework(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.adapters.html">Adapters</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.adapters.adapter.html">Adapter</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.adapters.args_converters.html">List Item View Argument Converters</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.adapters.dictadapter.html">DictAdapter</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.adapters.listadapter.html">ListAdapter</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.adapters.models.html">SelectableDataItem</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.adapters.simplelistadapter.html">SimpleListAdapter</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.animation.html">Animation(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.app.html">Application (翻訳中)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.atlas.html">Atlas</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.base.html">Kivy Base</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.cache.html">Cache manager</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.clock.html">Clock object(翻訳ずみ)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.compat.html">Compatibility module for Python 2.7 and &gt; 3.3</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.config.html">Configuration object</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.context.html">Context</a></li> <li class="toctree-l2 current"><a class="reference internal" href="api-kivy.core.html">Core Abstraction(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.core.audio.html">Audio</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.core.camera.html">Camera</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.core.clipboard.html">Clipboard(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.core.gl.html">OpenGL</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.core.image.html">Image</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.core.spelling.html">Spelling</a></li> <li class="toctree-l2 current"><a class="reference internal" href="api-kivy.core.text.html">Text</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.core.text.markup.html">Text Markup</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="#">Text layout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.core.video.html">Video</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.core.window.html">Window</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.deps.html">Kivy module for binary dependencies.</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.effects.html">Effects</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.effects.dampedscroll.html">Damped scroll effect</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.effects.kinetic.html">Kinetic effect</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.effects.opacityscroll.html">Opacity scroll effect</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.effects.scroll.html">Scroll effect</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.event.html">Event dispatcher</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.factory.html">Factory object</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.garden.html">Garden</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.geometry.html">Geometry utilities</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.gesture.html">Gesture recognition</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.html">Graphics(翻訳中)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.cgl.html">CGL: standard C interface for OpenGL</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.compiler.html">Graphics compiler</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.context.html">Context management</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.context_instructions.html">Context instructions</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.fbo.html">Framebuffer</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.gl_instructions.html">GL instructions</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.instructions.html">Canvas</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.opengl.html">OpenGL</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.opengl_utils.html">OpenGL utilities</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.scissor_instructions.html">Scissor Instructions</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.shader.html">Shader</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.stencil_instructions.html">Stencil instructions</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.svg.html">SVG</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.tesselator.html">Tesselator</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.texture.html">Texture</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.graphics.transformation.html">Transformation</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.html">Input management</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.factory.html">Motion Event Factory</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.motionevent.html">Motion Event</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.postproc.html">Input Postprocessing</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.postproc.calibration.html">Calibration</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.postproc.dejitter.html">Dejitter</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.postproc.doubletap.html">Double Tap</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.postproc.ignorelist.html">Ignore list</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.postproc.retaintouch.html">Retain Touch</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.postproc.tripletap.html">Triple Tap</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.provider.html">Motion Event Provider</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.html">Providers</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.androidjoystick.html">Android Joystick Input Provider</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.hidinput.html">Native support for HID input from the linux kernel</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.leapfinger.html">Leap Motion - finger only</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.linuxwacom.html">Native support of Wacom tablet from linuxwacom driver</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.mactouch.html">Native support of MultitouchSupport framework for MacBook (MaxOSX platform)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.mouse.html">Mouse provider implementation</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.mtdev.html">Native support for Multitouch devices on Linux, using libmtdev.</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.probesysfs.html">Auto Create Input Provider Config Entry for Available MT Hardware (linux only).</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.tuio.html">TUIO Input Provider</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.wm_common.html">Common definitions for a Windows provider</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.wm_pen.html">Support for WM_PEN messages (Windows platform)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.providers.wm_touch.html">Support for WM_TOUCH messages (Windows platform)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.recorder.html">Input recorder</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.input.shape.html">Motion Event Shape</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.interactive.html">Interactive launcher</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.lang.html">Kivy Language(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.lang.builder.html">Builder</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.lang.parser.html">Parser</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.lib.html">External libraries</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.lib.ddsfile.html">DDS File library</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.lib.gstplayer.html">GstPlayer</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.lib.mtdev.html">Python mtdev</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.lib.osc.html">OSC</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.lib.osc.OSC.html">NO DOCUMENTATION (module kivy.uix.recycleview)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.lib.osc.oscAPI.html">simpleOSC 0.2</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.loader.html">Asynchronous data loader</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.logger.html">Logger object</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.metrics.html">Metrics</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.modules.html">Modules</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.modules.console.html">Console</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.modules.inspector.html">Inspector</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.modules.joycursor.html">JoyCursor</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.modules.keybinding.html">Keybinding</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.modules.monitor.html">Monitor module</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.modules.recorder.html">Recorder module</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.modules.screen.html">Screen</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.modules.touchring.html">Touchring</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.modules.webdebugger.html">Web Debugger</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.multistroke.html">Multistroke gesture recognizer</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.network.html">Network support</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.network.urlrequest.html">UrlRequest</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.parser.html">Parser utilities</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.properties.html">Properties</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.resources.html">Resources management</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.storage.html">Storage</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.storage.dictstore.html">Dictionary store</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.storage.jsonstore.html">JSON store</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.storage.redisstore.html">Redis Store</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.support.html">Support</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.tools.html">Tools</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.tools.packaging.html">Packaging</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.tools.packaging.pyinstaller_hooks.html">Pyinstaller hooks</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.html">Widgets(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.abstractview.html">Abstract View</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.accordion.html">Accordion</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.actionbar.html">Action Bar</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.anchorlayout.html">Anchor Layout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.behaviors.html">Behaviors</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.behaviors.button.html">Button Behavior</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.behaviors.codenavigation.html">Code Navigation Behavior</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.behaviors.compoundselection.html">Compound Selection Behavior</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.behaviors.cover.html">Cover Behavior</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.behaviors.drag.html">Drag Behavior</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.behaviors.emacs.html">Emacs Behavior</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.behaviors.focus.html">Focus Behavior</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.behaviors.knspace.html">Kivy Namespaces</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.behaviors.togglebutton.html">ToggleButton Behavior</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.boxlayout.html">Box Layout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.bubble.html">Bubble</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.button.html">Button</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.camera.html">Camera</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.carousel.html">Carousel</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.checkbox.html">CheckBox</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.codeinput.html">Code Input</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.colorpicker.html">Color Picker</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.dropdown.html">Drop-Down List</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.effectwidget.html">EffectWidget</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.filechooser.html">FileChooser</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.floatlayout.html">Float Layout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.gesturesurface.html">Gesture Surface</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.gridlayout.html">Grid Layout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.image.html">Image</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.label.html">Label(翻訳済み)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.layout.html">Layout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.listview.html">List View</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.modalview.html">ModalView</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.pagelayout.html">PageLayout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.popup.html">Popup</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.progressbar.html">Progress Bar</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.recycleboxlayout.html">RecycleBoxLayout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.recyclegridlayout.html">RecycleGridLayout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.recyclelayout.html">RecycleLayout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.recycleview.html">RecycleView</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.recycleview.datamodel.html">RecycleView Data Model</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.recycleview.layout.html">RecycleView Layouts</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.recycleview.views.html">RecycleView Views</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.relativelayout.html">Relative Layout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.rst.html">reStructuredText renderer</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.sandbox.html">Sandbox</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.scatter.html">Scatter</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.scatterlayout.html">Scatter Layout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.screenmanager.html">Screen Manager</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.scrollview.html">ScrollView</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.selectableview.html">SelectableView</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.settings.html">Settings (翻訳中)</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.slider.html">Slider</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.spinner.html">Spinner</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.splitter.html">Splitter</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.stacklayout.html">Stack Layout</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.stencilview.html">Stencil View</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.switch.html">Switch</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.tabbedpanel.html">TabbedPanel</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.textinput.html">Text Input</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.togglebutton.html">Toggle button</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.treeview.html">Tree View</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.video.html">Video</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.videoplayer.html">Video player</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.vkeyboard.html">VKeyboard</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.uix.widget.html">Widget class</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.utils.html">Utils</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.vector.html">Vector</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.weakmethod.html">Weak Method</a></li> <li class="toctree-l2"><a class="reference internal" href="api-kivy.weakproxy.html">Weak Proxy</a></li> </ul> </li> </ul> <!-- <h3>Related Topics</h3> <ul> <li>Previous: <a href="api-kivy.core.text.html" title="previous chapter">Text</a></li> <li>Next: <a href="api-kivy.core.text.markup.html" title="next chapter">Text Markup</a></li> </ul> --> </div> </div> <div id="content"> <div class="wrapper"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="toc"><h2>Table Of Contents</h2><ul> <li><a class="reference internal" href="#">Text layout</a></li> </ul> </div> <div class="section" id="module-kivy.core.text.text_layout"> <span id="text-layout"></span><h1>Text layout<a class="headerlink" href="#module-kivy.core.text.text_layout" title="このヘッドラインへのパーマリンク">¶</a></h1> <p>An internal module for laying out text according to options and constraints. This is not part of the API and may change at any time.</p> <dl class="function"> <dt id="kivy.core.text.text_layout.layout_text"> <code class="descclassname">kivy.core.text.text_layout.</code><code class="descname">layout_text</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#kivy.core.text.text_layout.layout_text" title="この定義へのパーマリンク">¶</a></dt> <dd><p>Lays out text into a series of <a class="reference internal" href="#kivy.core.text.text_layout.LayoutWord" title="kivy.core.text.text_layout.LayoutWord"><code class="xref py py-class docutils literal"><span class="pre">LayoutWord</span></code></a> and <a class="reference internal" href="#kivy.core.text.text_layout.LayoutLine" title="kivy.core.text.text_layout.LayoutLine"><code class="xref py py-class docutils literal"><span class="pre">LayoutLine</span></code></a> instances according to the options specified.</p> <p>The function is designed to be called many times, each time new text is appended to the last line (or first line if appending upwards), unless a newline is present in the text. Each text appended is described by it&#8217;s own options which can change between successive calls. If the text is constrained, we stop as soon as the constraint is reached.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first docutils"> <dt><cite>text</cite>: string or bytes</dt> <dd><p class="first last">the text to be broken down into lines. If lines is not empty, the text is added to the last line (or first line if <cite>append_down</cite> is False) until a newline is reached which creates a new line in <cite>lines</cite>. See <a class="reference internal" href="#kivy.core.text.text_layout.LayoutLine" title="kivy.core.text.text_layout.LayoutLine"><code class="xref py py-class docutils literal"><span class="pre">LayoutLine</span></code></a>.</p> </dd> <dt><cite>lines</cite>: list</dt> <dd><p class="first last">a list of <a class="reference internal" href="#kivy.core.text.text_layout.LayoutLine" title="kivy.core.text.text_layout.LayoutLine"><code class="xref py py-class docutils literal"><span class="pre">LayoutLine</span></code></a> instances, each describing a line of the text. Calls to <a class="reference internal" href="#kivy.core.text.text_layout.layout_text" title="kivy.core.text.text_layout.layout_text"><code class="xref py py-func docutils literal"><span class="pre">layout_text()</span></code></a> append or create new <a class="reference internal" href="#kivy.core.text.text_layout.LayoutLine" title="kivy.core.text.text_layout.LayoutLine"><code class="xref py py-class docutils literal"><span class="pre">LayoutLine</span></code></a> instances in <cite>lines</cite>.</p> </dd> <dt><cite>size</cite>: 2-tuple of ints</dt> <dd><p class="first last">the size of the laid out text so far. Upon first call it should probably be (0, 0), afterwards it should be the (w, h) returned by this function in a previous call. When size reaches the constraining size, <cite>text_size</cite>, we stop adding lines and return True for the clipped parameter. size includes the x and y padding.</p> </dd> <dt><cite>text_size</cite>: 2-tuple of ints or None.</dt> <dd><p class="first last">the size constraint on the laid out text. If either element is None, the text is not constrained in that dimension. For example, (None, 200) will constrain the height, including padding to 200, while the width is unconstrained. The first line, and the first character of a line is always returned, even if it exceeds the constraint. The value be changed between different calls.</p> </dd> <dt><cite>options</cite>: dict</dt> <dd><p class="first">the label options of this <cite>text</cite>. The options are saved with each word allowing different words to have different options from successive calls.</p> <p class="last">Note, <cite>options</cite> must include a <cite>space_width</cite> key with a value indicating the width of a space for that set of options.</p> </dd> <dt><cite>get_extents</cite>: callable</dt> <dd><p class="first last">a function called with a string, which returns a tuple containing the width, height of the string.</p> </dd> <dt><cite>append_down</cite>: bool</dt> <dd><p class="first">Whether successive calls to the function appends lines before or after the existing lines. If True, they are appended to the last line and below it. If False, it&#8217;s appended at the first line and above. For example, if False, everything after the last newline in <cite>text</cite> is appended to the first line in lines. Everything before the last newline is inserted at the start of lines in same order as text; that is we do not invert the line order.</p> <p class="last">This allows laying out from top to bottom until the constrained is reached, or from bottom to top until the constrained is reached.</p> </dd> <dt><cite>complete</cite>: bool</dt> <dd><p class="first">whether this text complete lines. It use is that normally is strip in <cite>options</cite> is True, all leading and trailing spaces are removed from each line except from the last line (or first line if <cite>append_down</cite> is False) which only removes leading spaces. That&#8217;s because further text can still be appended to the last line so we cannot strip them. If <cite>complete</cite> is True, it indicates no further text is coming and all lines will be stripped.</p> <p class="last">The function can also be called with <cite>text</cite> set to the empty string and <cite>complete</cite> set to True in order for the last (first) line to be stripped.</p> </dd> </dl> </td> </tr> <tr class="field-even field"><th class="field-name">戻り値:</th><td class="field-body"><p class="first last">3-tuple, (w, h, clipped). w and h is the width and height of the text in lines so far and includes padding. This can be larger than <cite>text_size</cite>, e.g. if not even a single fitted, the first line would still be returned. <cite>clipped</cite> is True if not all the text has been added to lines because w, h reached the constrained size.</p> </td> </tr> </tbody> </table> <p>Following is a simple example with no padding and no stripping:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">kivy.core.text</span> <span class="k">import</span> <span class="n">Label</span> <span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">kivy.core.text.text_layout</span> <span class="k">import</span> <span class="n">layout_text</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">l</span> <span class="o">=</span> <span class="n">Label</span><span class="p">()</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">lines</span> <span class="o">=</span> <span class="p">[]</span> <span class="gp">&gt;&gt;&gt; </span><span class="c1"># layout text with width constraint by 50, but no height constraint</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">w</span><span class="p">,</span> <span class="n">h</span><span class="p">,</span> <span class="n">clipped</span> <span class="o">=</span> <span class="n">layout_text</span><span class="p">(</span><span class="s1">&#39;heres some text</span><span class="se">\n</span><span class="s1">ah, another line&#39;</span><span class="p">,</span> <span class="gp">... </span><span class="n">lines</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="kc">None</span><span class="p">),</span> <span class="n">l</span><span class="o">.</span><span class="n">options</span><span class="p">,</span> <span class="n">l</span><span class="o">.</span><span class="n">get_cached_extents</span><span class="p">(),</span> <span class="kc">True</span><span class="p">,</span> <span class="gp">... </span><span class="kc">False</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">w</span><span class="p">,</span> <span class="n">h</span><span class="p">,</span> <span class="n">clipped</span> <span class="go">(46, 90, False)</span> <span class="go"># now add text from bottom up, and constrain width only be 100</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">w</span><span class="p">,</span> <span class="n">h</span><span class="p">,</span> <span class="n">clipped</span> <span class="o">=</span> <span class="n">layout_text</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\n</span><span class="s1">yay, more text</span><span class="se">\n</span><span class="s1">&#39;</span><span class="p">,</span> <span class="n">lines</span><span class="p">,</span> <span class="p">(</span><span class="n">w</span><span class="p">,</span> <span class="n">h</span><span class="p">),</span> <span class="gp">... </span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="kc">None</span><span class="p">),</span> <span class="n">l</span><span class="o">.</span><span class="n">options</span><span class="p">,</span> <span class="n">l</span><span class="o">.</span><span class="n">get_cached_extents</span><span class="p">(),</span> <span class="kc">False</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">w</span><span class="p">,</span> <span class="n">h</span><span class="p">,</span> <span class="n">clipped</span> <span class="go">(77, 120, 0)</span> <span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span> <span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;line w: </span><span class="si">{}</span><span class="s1">, line h: </span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">line</span><span class="o">.</span><span class="n">w</span><span class="p">,</span> <span class="n">line</span><span class="o">.</span><span class="n">h</span><span class="p">))</span> <span class="gp">... </span> <span class="k">for</span> <span class="n">word</span> <span class="ow">in</span> <span class="n">line</span><span class="o">.</span><span class="n">words</span><span class="p">:</span> <span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;w: </span><span class="si">{}</span><span class="s1">, h: </span><span class="si">{}</span><span class="s1">, text: </span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">word</span><span class="o">.</span><span class="n">lw</span><span class="p">,</span> <span class="n">word</span><span class="o">.</span><span class="n">lh</span><span class="p">,</span> <span class="gp">... </span> <span class="p">[</span><span class="n">word</span><span class="o">.</span><span class="n">text</span><span class="p">]))</span> <span class="go">line w: 0, line h: 15</span> <span class="go">line w: 77, line h: 15</span> <span class="go">w: 77, h: 15, text: [&#39;yay, more text&#39;]</span> <span class="go">line w: 31, line h: 15</span> <span class="go">w: 31, h: 15, text: [&#39;heres&#39;]</span> <span class="go">line w: 34, line h: 15</span> <span class="go">w: 34, h: 15, text: [&#39; some&#39;]</span> <span class="go">line w: 24, line h: 15</span> <span class="go">w: 24, h: 15, text: [&#39; text&#39;]</span> <span class="go">line w: 17, line h: 15</span> <span class="go">w: 17, h: 15, text: [&#39;ah,&#39;]</span> <span class="go">line w: 46, line h: 15</span> <span class="go">w: 46, h: 15, text: [&#39; another&#39;]</span> <span class="go">line w: 23, line h: 15</span> <span class="go">w: 23, h: 15, text: [&#39; line&#39;]</span> </pre></div> </div> </dd></dl> <dl class="class"> <dt id="kivy.core.text.text_layout.LayoutWord"> <em class="property">class </em><code class="descclassname">kivy.core.text.text_layout.</code><code class="descname">LayoutWord</code><a class="headerlink" href="#kivy.core.text.text_layout.LayoutWord" title="この定義へのパーマリンク">¶</a></dt> <dd><p>ベースクラス: <code class="xref py py-class docutils literal"><span class="pre">builtins.object</span></code></p> <p>Formally describes a word contained in a line. The name word simply means a chunk of text and can be used to describe any text.</p> <p>A word has some width, height and is rendered according to options saved in <code class="xref py py-attr docutils literal"><span class="pre">options</span></code>. See <a class="reference internal" href="#kivy.core.text.text_layout.LayoutLine" title="kivy.core.text.text_layout.LayoutLine"><code class="xref py py-class docutils literal"><span class="pre">LayoutLine</span></code></a> for its usage.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first last docutils"> <dt><cite>options</cite>: dict</dt> <dd><p class="first last">the label options dictionary for this word.</p> </dd> <dt><cite>lw</cite>: int</dt> <dd><p class="first last">the width of the text in pixels.</p> </dd> <dt><cite>lh</cite>: int</dt> <dd><p class="first last">the height of the text in pixels.</p> </dd> <dt><cite>text</cite>: string</dt> <dd><p class="first last">the text of the word.</p> </dd> </dl> </td> </tr> </tbody> </table> </dd></dl> <dl class="class"> <dt id="kivy.core.text.text_layout.LayoutLine"> <em class="property">class </em><code class="descclassname">kivy.core.text.text_layout.</code><code class="descname">LayoutLine</code><a class="headerlink" href="#kivy.core.text.text_layout.LayoutLine" title="この定義へのパーマリンク">¶</a></dt> <dd><p>ベースクラス: <code class="xref py py-class docutils literal"><span class="pre">builtins.object</span></code></p> <p>Formally describes a line of text. A line of text is composed of many <a class="reference internal" href="#kivy.core.text.text_layout.LayoutWord" title="kivy.core.text.text_layout.LayoutWord"><code class="xref py py-class docutils literal"><span class="pre">LayoutWord</span></code></a> instances, each with it&#8217;s own text, size and options.</p> <p>A <a class="reference internal" href="#kivy.core.text.text_layout.LayoutLine" title="kivy.core.text.text_layout.LayoutLine"><code class="xref py py-class docutils literal"><span class="pre">LayoutLine</span></code></a> instance does not always imply that the words contained in the line ended with a newline. That is only the case if <code class="xref py py-attr docutils literal"><span class="pre">is_last_line</span></code> is True. For example a single real line of text can be split across multiple <a class="reference internal" href="#kivy.core.text.text_layout.LayoutLine" title="kivy.core.text.text_layout.LayoutLine"><code class="xref py py-class docutils literal"><span class="pre">LayoutLine</span></code></a> instances if the whole line doesn&#8217;t fit in the constrained width.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><dl class="first last docutils"> <dt><cite>x</cite>: int</dt> <dd><p class="first last">the location in a texture from where the left side of this line is began drawn.</p> </dd> <dt><cite>y</cite>: int</dt> <dd><p class="first last">the location in a texture from where the bottom of this line is drawn.</p> </dd> <dt><cite>w</cite>: int</dt> <dd><p class="first last">the width of the line. This is the sum of the individual widths of its <a class="reference internal" href="#kivy.core.text.text_layout.LayoutWord" title="kivy.core.text.text_layout.LayoutWord"><code class="xref py py-class docutils literal"><span class="pre">LayoutWord</span></code></a> instances. Does not include any padding.</p> </dd> <dt><cite>h</cite>: int</dt> <dd><p class="first last">the height of the line. This is the maximum of the individual heights of its <a class="reference internal" href="#kivy.core.text.text_layout.LayoutWord" title="kivy.core.text.text_layout.LayoutWord"><code class="xref py py-class docutils literal"><span class="pre">LayoutWord</span></code></a> instances multiplied by the <cite>line_height</cite> of these instance. So this is larger then the word height.</p> </dd> <dt><cite>is_last_line</cite>: bool</dt> <dd><p class="first last">whether this line was the last line in a paragraph. When True, it implies that the line was followed by a newline. Newlines should not be included in the text of words, but is implicit by setting this to True.</p> </dd> <dt><cite>line_wrap</cite>: bool</dt> <dd><p class="first last">whether this line is continued from a previous line which didn&#8217;t fit into a constrained width and was therefore split across multiple <a class="reference internal" href="#kivy.core.text.text_layout.LayoutLine" title="kivy.core.text.text_layout.LayoutLine"><code class="xref py py-class docutils literal"><span class="pre">LayoutLine</span></code></a> instances. <cite>line_wrap</cite> can be True or False independently of <cite>is_last_line</cite>.</p> </dd> <dt><cite>words</cite>: python list</dt> <dd><p class="first last">a list that contains only <a class="reference internal" href="#kivy.core.text.text_layout.LayoutWord" title="kivy.core.text.text_layout.LayoutWord"><code class="xref py py-class docutils literal"><span class="pre">LayoutWord</span></code></a> instances describing the text of the line.</p> </dd> </dl> </td> </tr> </tbody> </table> </dd></dl> <div class="toctree-wrapper compound"> </div> </div> <div class="footerlinks"> <table> <tr> <td class="leftlink"> <a href="api-kivy.core.text.html" title="previous chapter">&laquo; Text</a></li> </td> <td class="rightlink"> <a href="api-kivy.core.text.markup.html" title="next chapter">Text Markup &raquo;</a> </td> </tr> </table> </div> </div> </div> </div> </div> <div class="clearer"></div> </div> </div> <!-- Piwik --> <script> var _paq = _paq || []; _paq.push(['setDomains', '*.kivy.org']); _paq.push(['setCookieDomain', '*.kivy.org']); _paq.push(['enableHeartBeatTimer', 60]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//pw.kivy.org/"; _paq.push(['setTrackerUrl', u+'pw.php']); _paq.push(['setSiteId', 4]); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'pw.js'; s.parentNode.insertBefore(g,s); })(); </script> <noscript><p><img src="//pw.kivy.org/pw.php?idsite=4&rec=1" style="border:0;" alt="" /></p></noscript> <!-- End Piwik Tracking Code --> <!-- <div class="footer"> &copy; Copyright 2010, The Kivy Authors. Last updated on 10月 01, 2017. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.4.8. </div> --> </body> </html>
pyKy/kivy-doc-ja
docs/api-kivy.core.text.text_layout.html
HTML
mit
55,217
[ 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...
package com.alamkanak.weekview.sample; import android.app.Activity; import android.graphics.RectF; import android.os.Bundle; import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; import com.alamkanak.weekview.WeekView; import com.alamkanak.weekview.WeekViewEvent; import java.util.ArrayList; import java.util.Calendar; import java.util.List; /** * Created by Raquib-ul-Alam Kanak on 7/21/2014. * Website: http://april-shower.com */ public class MainActivity extends Activity implements WeekView.MonthChangeListener, WeekView.EventClickListener, WeekView.EventLongPressListener { private static final int TYPE_DAY_VIEW = 1; private static final int TYPE_THREE_DAY_VIEW = 2; private static final int TYPE_WEEK_VIEW = 3; private int mWeekViewType = TYPE_THREE_DAY_VIEW; private WeekView mWeekView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Get a reference for the week view in the layout. mWeekView = (WeekView) findViewById(R.id.weekView); // Show a toast message about the touched event. mWeekView.setOnEventClickListener(this); // The week view has infinite scrolling horizontally. We have to provide the events of a // month every time the month changes on the week view. mWeekView.setMonthChangeListener(this); // Set long press listener for events. mWeekView.setEventLongPressListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id){ case R.id.action_today: mWeekView.goToToday(); return true; case R.id.action_day_view: if (mWeekViewType != TYPE_DAY_VIEW) { item.setChecked(!item.isChecked()); mWeekViewType = TYPE_DAY_VIEW; mWeekView.setNumberOfVisibleDays(1); // Lets change some dimensions to best fit the view. mWeekView.setColumnGap((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics())); mWeekView.setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, getResources().getDisplayMetrics())); mWeekView.setEventTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, getResources().getDisplayMetrics())); } return true; case R.id.action_three_day_view: if (mWeekViewType != TYPE_THREE_DAY_VIEW) { item.setChecked(!item.isChecked()); mWeekViewType = TYPE_THREE_DAY_VIEW; mWeekView.setNumberOfVisibleDays(3); // Lets change some dimensions to best fit the view. mWeekView.setColumnGap((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics())); mWeekView.setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, getResources().getDisplayMetrics())); mWeekView.setEventTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 12, getResources().getDisplayMetrics())); } return true; case R.id.action_week_view: if (mWeekViewType != TYPE_WEEK_VIEW) { item.setChecked(!item.isChecked()); mWeekViewType = TYPE_WEEK_VIEW; mWeekView.setNumberOfVisibleDays(7); // Lets change some dimensions to best fit the view. mWeekView.setColumnGap((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics())); mWeekView.setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 10, getResources().getDisplayMetrics())); mWeekView.setEventTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 10, getResources().getDisplayMetrics())); } return true; } return super.onOptionsItemSelected(item); } @Override public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) { // Populate the week view with some events. List<WeekViewEvent> events = new ArrayList<WeekViewEvent>(); Calendar startTime = Calendar.getInstance(); startTime.set(Calendar.HOUR_OF_DAY, 3); startTime.set(Calendar.MINUTE, 0); startTime.set(Calendar.MONTH, newMonth-1); startTime.set(Calendar.YEAR, newYear); Calendar endTime = (Calendar) startTime.clone(); endTime.add(Calendar.HOUR, 1); endTime.set(Calendar.MONTH, newMonth-1); WeekViewEvent event = new WeekViewEvent(1, getEventTitle(startTime), startTime, endTime); event.setColor(getResources().getColor(R.color.event_color_01)); events.add(event); startTime = Calendar.getInstance(); startTime.set(Calendar.HOUR_OF_DAY, 3); startTime.set(Calendar.MINUTE, 30); startTime.set(Calendar.MONTH, newMonth-1); startTime.set(Calendar.YEAR, newYear); endTime = (Calendar) startTime.clone(); endTime.set(Calendar.HOUR_OF_DAY, 4); endTime.set(Calendar.MINUTE, 30); endTime.set(Calendar.MONTH, newMonth-1); event = new WeekViewEvent(10, getEventTitle(startTime), startTime, endTime); event.setColor(getResources().getColor(R.color.event_color_02)); events.add(event); startTime = Calendar.getInstance(); startTime.set(Calendar.HOUR_OF_DAY, 4); startTime.set(Calendar.MINUTE, 20); startTime.set(Calendar.MONTH, newMonth-1); startTime.set(Calendar.YEAR, newYear); endTime = (Calendar) startTime.clone(); endTime.set(Calendar.HOUR_OF_DAY, 5); endTime.set(Calendar.MINUTE, 0); event = new WeekViewEvent(10, getEventTitle(startTime), startTime, endTime); event.setColor(getResources().getColor(R.color.event_color_03)); events.add(event); startTime = Calendar.getInstance(); startTime.set(Calendar.HOUR_OF_DAY, 5); startTime.set(Calendar.MINUTE, 30); startTime.set(Calendar.MONTH, newMonth-1); startTime.set(Calendar.YEAR, newYear); endTime = (Calendar) startTime.clone(); endTime.add(Calendar.HOUR_OF_DAY, 2); endTime.set(Calendar.MONTH, newMonth-1); event = new WeekViewEvent(2, getEventTitle(startTime), startTime, endTime); event.setColor(getResources().getColor(R.color.event_color_02)); events.add(event); startTime = Calendar.getInstance(); startTime.set(Calendar.HOUR_OF_DAY, 5); startTime.set(Calendar.MINUTE, 0); startTime.set(Calendar.MONTH, newMonth-1); startTime.set(Calendar.YEAR, newYear); startTime.add(Calendar.DATE, 1); endTime = (Calendar) startTime.clone(); endTime.add(Calendar.HOUR_OF_DAY, 3); endTime.set(Calendar.MONTH, newMonth - 1); event = new WeekViewEvent(3, getEventTitle(startTime), startTime, endTime); event.setColor(getResources().getColor(R.color.event_color_03)); events.add(event); startTime = Calendar.getInstance(); startTime.set(Calendar.DAY_OF_MONTH, 15); startTime.set(Calendar.HOUR_OF_DAY, 3); startTime.set(Calendar.MINUTE, 0); startTime.set(Calendar.MONTH, newMonth-1); startTime.set(Calendar.YEAR, newYear); endTime = (Calendar) startTime.clone(); endTime.add(Calendar.HOUR_OF_DAY, 3); event = new WeekViewEvent(4, getEventTitle(startTime), startTime, endTime); event.setColor(getResources().getColor(R.color.event_color_04)); events.add(event); startTime = Calendar.getInstance(); startTime.set(Calendar.DAY_OF_MONTH, 1); startTime.set(Calendar.HOUR_OF_DAY, 3); startTime.set(Calendar.MINUTE, 0); startTime.set(Calendar.MONTH, newMonth-1); startTime.set(Calendar.YEAR, newYear); endTime = (Calendar) startTime.clone(); endTime.add(Calendar.HOUR_OF_DAY, 3); event = new WeekViewEvent(5, getEventTitle(startTime), startTime, endTime); event.setColor(getResources().getColor(R.color.event_color_01)); events.add(event); startTime = Calendar.getInstance(); startTime.set(Calendar.DAY_OF_MONTH, startTime.getActualMaximum(Calendar.DAY_OF_MONTH)); startTime.set(Calendar.HOUR_OF_DAY, 15); startTime.set(Calendar.MINUTE, 0); startTime.set(Calendar.MONTH, newMonth-1); startTime.set(Calendar.YEAR, newYear); endTime = (Calendar) startTime.clone(); endTime.add(Calendar.HOUR_OF_DAY, 3); event = new WeekViewEvent(5, getEventTitle(startTime), startTime, endTime); event.setColor(getResources().getColor(R.color.event_color_02)); events.add(event); return events; } private String getEventTitle(Calendar time) { return String.format("Event of %02d:%02d %s/%d", time.get(Calendar.HOUR_OF_DAY), time.get(Calendar.MINUTE), time.get(Calendar.MONTH)+1, time.get(Calendar.DAY_OF_MONTH)); } @Override public void onEventClick(WeekViewEvent event, RectF eventRect) { Toast.makeText(MainActivity.this, "Clicked " + event.getName(), Toast.LENGTH_SHORT).show(); } @Override public void onEventLongPress(WeekViewEvent event, RectF eventRect) { Toast.makeText(MainActivity.this, "Long pressed event: " + event.getName(), Toast.LENGTH_SHORT).show(); } }
0359xiaodong/Android-Week-View
sample/src/main/java/com/alamkanak/weekview/sample/MainActivity.java
Java
apache-2.0
10,041
[ 30522, 7427, 4012, 1012, 26234, 9126, 4817, 1012, 2733, 8584, 1012, 7099, 1025, 12324, 11924, 1012, 10439, 1012, 4023, 1025, 12324, 11924, 1012, 8389, 1012, 28667, 24475, 1025, 12324, 11924, 1012, 9808, 1012, 14012, 1025, 12324, 11924, 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...
////////////////////////////////////////////////////////////////////////////// // This file is part of the Journey MMORPG client // // Copyright © 2015-2016 Daniel Allendorf // // // // This program is free software: you can redistribute it and/or modify // // it under the terms of the GNU Affero 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 Affero General Public License for more details. // // // // You should have received a copy of the GNU Affero General Public License // // along with this program. If not, see <http://www.gnu.org/licenses/>. // ////////////////////////////////////////////////////////////////////////////// #include "Mob.h" #include "../Movement.h" #include "../../Constants.h" #include "../../Net/Packets/GameplayPackets.h" #include "../../Util/Misc.h" #include "nlnx/nx.hpp" #include <algorithm> #include <functional> namespace jrc { Mob::Mob(int32_t oid, int32_t mid, int8_t mode, uint8_t stance, uint16_t fh, bool newspawn, int8_t tm, Point<int16_t> position) : MapObject(oid) { std::string strid = string_format::extend_id(mid, 7); const nl::node src = nl::nx::mob[strid + ".img"]; nl::node info = src["info"]; level = info["level"]; watk = info["PADamage"]; matk = info["MADamage"]; wdef = info["PDDamage"]; mdef = info["MDDamage"]; accuracy = info["acc"]; avoid = info["eva"]; knockback = info["pushed"]; speed = info["speed"]; flyspeed = info["flySpeed"]; touchdamage = info["bodyAttack"].get_bool(); undead = info["undead"].get_bool(); noflip = info["noFlip"].get_bool(); notattack = info["notAttack"].get_bool(); canjump = src["jump"].size() > 0; canfly = src["fly"].size() > 0; canmove = src["move"].size() > 0 || canfly; if (canfly) { animations[STAND] = src["fly"]; animations[MOVE] = src["fly"]; } else { animations[STAND] = src["stand"]; animations[MOVE] = src["move"]; } animations[JUMP] = src["jump"]; animations[HIT] = src["hit1"]; animations[DIE] = src["die1"]; name = nl::nx::string["Mob.img"][std::to_string(mid)]["name"].get_string(); std::cout << "Mob::Mob: \"" << name << "\"\n "; for (const auto& child : src) { std::cout << child.name() << ' '; } std::cout << "\n\n"; nl::node sndsrc = nl::nx::sound["Mob.img"][strid]; hitsound = sndsrc["Damage"]; diesound = sndsrc["Die"]; speed += 100; speed *= 0.001f; flyspeed += 100; flyspeed *= 0.0005f; if (canfly) { phobj.type = PhysicsObject::FLYING; } id = mid; team = tm; set_position(position); set_control(mode); phobj.fhid = fh; phobj.set_flag(PhysicsObject::TURNATEDGES); hppercent = 0; dying = false; dead = false; fading = false; awaitdeath = false; set_stance(stance); flydirection = STRAIGHT; counter = 0; namelabel = { Text::A13M, Text::CENTER, Text::WHITE, Text::NAMETAG, name }; if (newspawn) { fadein = true; opacity.set(0.0f); } else { fadein = false; opacity.set(1.0f); } if (control && stance == Stance::STAND) { next_move(); } } void Mob::set_stance(uint8_t stancebyte) { flip = (stancebyte % 2) == 0; if (!flip) { stancebyte -= 1; } if (stancebyte < MOVE) { stancebyte = MOVE; } set_stance(static_cast<Stance>(stancebyte)); } void Mob::set_stance(Stance newstance) { if (stance != newstance) { stance = newstance; animations.at(stance).reset(); } } int8_t Mob::update(const Physics& physics) { if (!active) { return phobj.fhlayer; } bool aniend = animations.at(stance).update(); if (aniend && stance == DIE) { dead = true; } if (fading) { opacity -= 0.025f; if (opacity.last() < 0.025f) { opacity.set(0.0f); fading = false; dead = true; } } else if (fadein) { opacity += 0.025f; if (opacity.last() > 0.975f) { opacity.set(1.0f); fadein = false; } } if (dead) { active = false; return -1; } effects.update(); showhp.update(); if (!dying) { if (!canfly) { if (phobj.is_flag_not_set(PhysicsObject::TURNATEDGES)) { flip = !flip; phobj.set_flag(PhysicsObject::TURNATEDGES); if (stance == HIT) { set_stance(STAND); } } } switch (stance) { case MOVE: if (canfly) { phobj.hforce = flip ? flyspeed : -flyspeed; switch (flydirection) { case UPWARDS: phobj.vforce = -flyspeed; break; case DOWNWARDS: phobj.vforce = flyspeed; break; default: break; } } else { phobj.hforce = flip ? speed : -speed; } break; case HIT: if (canmove) { double KBFORCE = phobj.onground ? 0.2 : 0.1; phobj.hforce = flip ? -KBFORCE : KBFORCE; } break; case JUMP: phobj.vforce = -5.0; break; default: break; } physics.move_object(phobj); if (control) { counter++; bool next; switch (stance) { case HIT: next = counter > 200; break; case JUMP: next = phobj.onground; break; default: next = aniend && counter > 200; break; } if (next) { next_move(); update_movement(); counter = 0; } } } else { phobj.normalize(); physics.get_fht().update_fh(phobj); } return phobj.fhlayer; } void Mob::next_move() { if (canmove) { switch (stance) { case HIT: case STAND: set_stance(MOVE); flip = randomizer.next_bool(); break; case MOVE: case JUMP: if (canjump && phobj.onground && randomizer.below(0.25f)) { set_stance(JUMP); } else { switch (randomizer.next_int(3)) { case 0: set_stance(STAND); break; case 1: set_stance(MOVE); flip = false; break; case 2: set_stance(MOVE); flip = true; break; default: break; } } break; default: break; } if (stance == MOVE && canfly) { flydirection = randomizer.next_enum(NUM_DIRECTIONS); } } else { set_stance(STAND); } } void Mob::update_movement() { MoveMobPacket( oid, 1, 0, 0, 0, 0, 0, 0, get_position(), Movement(phobj, value_of(stance, flip)) ).dispatch(); } void Mob::draw(double viewx, double viewy, float alpha) const { Point<int16_t> absp = phobj.get_absolute(viewx, viewy, alpha); Point<int16_t> headpos = get_head_position(absp); effects.drawbelow(absp, alpha); if (!dead) { float interopc = opacity.get(alpha); animations.at(stance).draw( DrawArgument(absp, flip && !noflip, interopc), alpha ); if (showhp) { namelabel.draw(absp); if (!dying && hppercent > 0) { hpbar.draw(headpos, hppercent); } } } effects.drawabove(absp, alpha); } void Mob::set_control(int8_t mode) { control = mode > 0; aggro = mode == 2; } void Mob::send_movement(Point<int16_t> start, std::vector<Movement>&& in_movements) { if (control) { return; } set_position(start); movements = std::forward<decltype(in_movements)>(in_movements); if (movements.empty()) { return; } const Movement& lastmove = movements.front(); uint8_t laststance = lastmove.newstate; set_stance(laststance); phobj.fhid = lastmove.fh; } Point<int16_t> Mob::get_head_position(Point<int16_t> position) const { Point<int16_t> head = animations.at(stance).get_head(); position.shift_x((flip && !noflip) ? -head.x() : head.x()); position.shift_y(head.y()); return position; } void Mob::kill(int8_t animation) { switch (animation) { case 0: active = false; break; case 1: dying = true; if (awaitdeath) { apply_death(); } break; case 2: fading = true; dying = true; break; default: break; } } void Mob::show_hp(int8_t percent, uint16_t playerlevel) { if (hppercent == 0) { int16_t delta = playerlevel - level; if (delta > 9) { namelabel.change_color(Text::YELLOW); } else if (delta < -9) { namelabel.change_color(Text::RED); } } if (percent > 100) { percent = 100; } else if (percent < 0) { percent = 0; } hppercent = percent; showhp.set_for(2000); } void Mob::show_effect(const Animation& animation, int8_t pos, int8_t z, bool f) { if (!active) { return; } Point<int16_t> shift; switch (pos) { case 0: shift = get_head_position({}); break; case 1: break; case 2: break; case 3: break; case 4: break; default: break; } effects.add(animation, { shift, f }, z); } float Mob::calculate_hitchance(int16_t leveldelta, int32_t player_accuracy) const { auto faccuracy = static_cast<float>(player_accuracy); float hitchance = faccuracy / (((1.84f + 0.07f * leveldelta) * avoid) + 1.0f); if (hitchance < 0.01f) { hitchance = 0.01f; } return hitchance; } double Mob::calculate_mindamage(int16_t leveldelta, double damage, bool magic) const { double mindamage = magic ? damage - (1 + 0.01 * leveldelta) * mdef * 0.6 : damage * (1 - 0.01 * leveldelta) - wdef * 0.6; return mindamage < 1.0 ? 1.0 : mindamage; } double Mob::calculate_maxdamage(int16_t leveldelta, double damage, bool magic) const { double maxdamage = magic ? damage - (1 + 0.01 * leveldelta) * mdef * 0.5 : damage * (1 - 0.01 * leveldelta) - wdef * 0.5; return maxdamage < 1.0 ? 1.0 : maxdamage; } std::vector<std::pair<int32_t, bool>> Mob::calculate_damage(const Attack& attack) { double mindamage; double maxdamage; float hitchance; float critical; int16_t leveldelta = level - attack.playerlevel; if (leveldelta < 0) { leveldelta = 0; } Attack::DamageType damagetype = attack.damagetype; switch (damagetype) { case Attack::DMG_WEAPON: case Attack::DMG_MAGIC: mindamage = calculate_mindamage(leveldelta, attack.mindamage, damagetype == Attack::DMG_MAGIC); maxdamage = calculate_maxdamage(leveldelta, attack.maxdamage, damagetype == Attack::DMG_MAGIC); hitchance = calculate_hitchance(leveldelta, attack.accuracy); critical = attack.critical; break; case Attack::DMG_FIXED: mindamage = attack.fixdamage; maxdamage = attack.fixdamage; hitchance = 1.0f; critical = 0.0f; break; } std::vector<std::pair<int32_t, bool>> result(attack.hitcount); std::generate(result.begin(), result.end(), [&](){ return next_damage(mindamage, maxdamage, hitchance, critical); }); update_movement(); awaitdeath = false; return result; } std::pair<int32_t, bool> Mob::next_damage(double mindamage, double maxdamage, float hitchance, float critical) const { bool hit = randomizer.below(hitchance); if (!hit) { return { 0, false }; } constexpr double DAMAGECAP = 999999.0; double damage = randomizer.next_real(mindamage, maxdamage); bool iscritical = randomizer.below(critical); if (iscritical) { damage *= 1.5; } if (damage < 1) { damage = 1; } else if (damage > DAMAGECAP) { damage = DAMAGECAP; } auto intdamage = static_cast<int32_t>(damage); return { intdamage, iscritical }; } void Mob::apply_damage(int32_t damage, bool toleft) { hitsound.play(); if (dying && stance != DIE) { apply_death(); } else if (control && is_alive() && damage >= knockback) { flip = toleft; counter = 170; set_stance(HIT); update_movement(); awaitdeath = true; } } MobAttack Mob::create_touch_attack() const { if (!touchdamage) { return {}; } auto minattack = static_cast<int32_t>(watk * 0.8f); int32_t maxattack = watk; int32_t attack = randomizer.next_int(minattack, maxattack); return { attack, get_position(), id, oid }; } void Mob::apply_death() { set_stance(DIE); diesound.play(); dying = true; } bool Mob::is_alive() const { return active && !dying; } bool Mob::is_in_range(const Rectangle<int16_t>& range) const { if (!active) { return false; } Rectangle<int16_t> bounds = animations.at(stance).get_bounds(); bounds.shift(get_position()); return range.overlaps(bounds); } Point<int16_t> Mob::get_head_position() const { Point<int16_t> position = get_position(); return get_head_position(position); } }
Libre-Maple/LibreMaple-Client
Gameplay/MapleMap/Mob.cpp
C++
agpl-3.0
17,470
[ 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...
package com.capgemini.resilience.employer.service; public interface ErrorSimulationService { void generateErrorDependingOnErrorPossibility(); }
microservices-summit-2016/resilience-demo
employer-service/src/main/java/com/capgemini/resilience/employer/service/ErrorSimulationService.java
Java
apache-2.0
150
[ 30522, 7427, 4012, 1012, 6178, 3351, 25300, 1012, 24501, 18622, 10127, 1012, 11194, 1012, 2326, 1025, 2270, 8278, 10697, 5714, 9513, 8043, 7903, 2063, 1063, 11675, 9699, 2121, 29165, 3207, 11837, 4667, 5643, 18933, 14536, 15094, 13464, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.34014 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace CPU.Console.Properties { /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if ((resourceMan == null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CPU.Console.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
Diullei/Nx86
Nx86/CPU.Console/Properties/Resources.Designer.cs
C#
mit
2,781
[ 30522, 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, 1011, 1011, 1011, 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...
/** * Copyright (c) 2001-2002. Department of Family Medicine, McMaster University. All Rights Reserved. * This software is published under the GPL GNU General Public License. * 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. * * This software was written for the * Department of Family Medicine * McMaster University * Hamilton * Ontario, Canada */ package oscar.oscarDemographic.data; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.oscarehr.common.dao.RelationshipsDao; import org.oscarehr.common.model.Relationships; import org.oscarehr.util.MiscUtils; import org.oscarehr.util.SpringUtils; import oscar.util.ConversionUtils; /** * * @author Jay Gallagher */ public class DemographicRelationship { public DemographicRelationship() { } /** * @param facilityId can be null */ public void addDemographicRelationship(String demographic, String linkingDemographic, String relationship, boolean sdm, boolean emergency, String notes, String providerNo, Integer facilityId) { Relationships relationships = new Relationships(); relationships.setFacilityId(facilityId); relationships.setDemographicNo(ConversionUtils.fromIntString(demographic)); relationships.setRelationDemographicNo(ConversionUtils.fromIntString(linkingDemographic)); relationships.setRelation(relationship); relationships.setSubDecisionMaker(ConversionUtils.toBoolString(sdm)); relationships.setEmergencyContact(ConversionUtils.toBoolString(emergency)); relationships.setNotes(notes); relationships.setCreator(providerNo); relationships.setCreationDate(new Date()); RelationshipsDao dao = SpringUtils.getBean(RelationshipsDao.class); dao.persist(relationships); } public void deleteDemographicRelationship(String id) { RelationshipsDao dao = SpringUtils.getBean(RelationshipsDao.class); Relationships relationships = dao.find(ConversionUtils.fromIntString(id)); if (relationships == null) MiscUtils.getLogger().error("Unable to find demographic relationship to delete"); relationships.setDeleted(ConversionUtils.toBoolString(Boolean.TRUE)); dao.merge(relationships); } public ArrayList<Map<String, String>> getDemographicRelationships(String demographic) { RelationshipsDao dao = SpringUtils.getBean(RelationshipsDao.class); ArrayList<Map<String, String>> list = new ArrayList<Map<String, String>>(); List<Relationships> relationships = dao.findByDemographicNumber(ConversionUtils.fromIntString(demographic)); if (relationships.isEmpty()) { MiscUtils.getLogger().warn("Unable to find demographic relationship for demographic " + demographic); return list; } for (Relationships r : relationships) { HashMap<String, String> h = new HashMap<String, String>(); h.put("id", r.getId().toString()); h.put("demographic_no", String.valueOf(r.getRelationDemographicNo())); h.put("relation", r.getRelation()); h.put("sub_decision_maker", r.getSubDecisionMaker()); h.put("emergency_contact", r.getEmergencyContact()); h.put("notes", r.getNotes()); list.add(h); } return list; } public ArrayList<Map<String, String>> getDemographicRelationshipsByID(String id) { RelationshipsDao dao = SpringUtils.getBean(RelationshipsDao.class); Relationships r = dao.findActive(ConversionUtils.fromIntString(id)); ArrayList<Map<String, String>> list = new ArrayList<Map<String, String>>(); if (r == null) { MiscUtils.getLogger().warn("Unable to find demographic relationship for ID " + id); return list; } Map<String, String> h = new HashMap<String, String>(); h.put("demographic_no", ConversionUtils.toIntString(r.getDemographicNo())); h.put("relation_demographic_no", ConversionUtils.toIntString(r.getRelationDemographicNo())); h.put("relation", r.getRelation()); h.put("sub_decision_maker", r.getSubDecisionMaker()); h.put("emergency_contact", r.getEmergencyContact()); h.put("notes", r.getNotes()); list.add(h); return list; } public String getSDM(String demographic) { RelationshipsDao dao = SpringUtils.getBean(RelationshipsDao.class); List<Relationships> rs = dao.findActiveSubDecisionMaker(ConversionUtils.fromIntString(demographic)); String result = null; for (Relationships r : rs) result = ConversionUtils.toIntString(r.getRelationDemographicNo()); return result; } public List<Map<String, Object>> getDemographicRelationshipsWithNamePhone(String demographic_no) { RelationshipsDao dao = SpringUtils.getBean(RelationshipsDao.class); List<Relationships> rs = dao.findActiveSubDecisionMaker(ConversionUtils.fromIntString(demographic_no)); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); for (Relationships r : rs) { HashMap<String, Object> h = new HashMap<String, Object>(); String demo = ConversionUtils.toIntString(r.getRelationDemographicNo()); DemographicData dd = new DemographicData(); org.oscarehr.common.model.Demographic demographic = dd.getDemographic(demo); h.put("lastName", demographic.getLastName()); h.put("firstName", demographic.getFirstName()); h.put("phone", demographic.getPhone()); h.put("demographicNo", demo); h.put("relation", r.getRelation()); h.put("subDecisionMaker", ConversionUtils.fromBoolString(r.getSubDecisionMaker())); h.put("emergencyContact", ConversionUtils.fromBoolString(r.getEmergencyContact())); h.put("notes", r.getNotes()); h.put("age", demographic.getAge()); list.add(h); } return list; } public List<Map<String, Object>> getDemographicRelationshipsWithNamePhone(String demographic_no, Integer facilityId) { RelationshipsDao dao = SpringUtils.getBean(RelationshipsDao.class); List<Relationships> rs = dao.findActiveByDemographicNumberAndFacility(ConversionUtils.fromIntString(demographic_no), facilityId); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); for (Relationships r : rs) { HashMap<String, Object> h = new HashMap<String, Object>(); String demo = ConversionUtils.toIntString(r.getRelationDemographicNo()); DemographicData dd = new DemographicData(); org.oscarehr.common.model.Demographic demographic = dd.getDemographic(demo); h.put("lastName", demographic.getLastName()); h.put("firstName", demographic.getFirstName()); h.put("phone", demographic.getPhone()); h.put("demographicNo", demo); h.put("relation", r.getRelation()); h.put("subDecisionMaker", ConversionUtils.fromBoolString(r.getSubDecisionMaker())); h.put("emergencyContact", ConversionUtils.fromBoolString(r.getEmergencyContact())); h.put("notes", r.getNotes()); h.put("age", demographic.getAge()); list.add(h); } return list; } }
hexbinary/landing
src/main/java/oscar/oscarDemographic/data/DemographicRelationship.java
Java
gpl-2.0
7,383
[ 30522, 1013, 1008, 1008, 1008, 9385, 1006, 1039, 1007, 2541, 1011, 2526, 1012, 2533, 1997, 2155, 4200, 1010, 11338, 8706, 2118, 1012, 2035, 2916, 9235, 1012, 1008, 2023, 4007, 2003, 2405, 2104, 1996, 14246, 2140, 27004, 2236, 2270, 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...
/*NAVBAR*/ a.navbar-brand { height: 50px; padding: 0px 0px 0px 10px; margin-right: 10px; } .navbar-brand img { height: 50px; } #navbrand { margin-top: 4px; height: 40px; } nav.navbar.navbar-default { margin-bottom: 0px; } .navbar-nav li:hover { background-color: #f1f1f1; } /*SOCIAL MEDIA*/ .btn-social-icon { float: right; margin-top: 8px; } a.btn.btn-social-icon { background-color: transparent; color: gray; } a.btn.btn-social-icon.btn-facebook:hover { background-color: transparent; color: #3b5998; border-color: transparent; } a.btn.btn-social-icon.btn-twitter:hover { background-color: transparent; color: #55acee; border-color: transparent; } /*WELCOME INFO*/ #welcome-info { height: 600px; width: 100%; margin-top: 100px; } .welc { width: 50%; height: 100%; float: left; color: #071352; } .welc-pic { height: 100%; width: 50%; background-image: url("../img/cool_old.jpg"); background-repeat: no-repeat; background-size: 400px 500px; background-position: right; position: relative; } .welc-title { font-family: Helvetica; } .welc-title h1 { font-weight: bold; font-size: 70px; margin: 150px 100px 0px 50px; } .welc-title h3 { font-size: 35px; margin: 50px 150px 0px 50px; font-weight: lighter; } /*NOSOTROS*/ .us { height: 300px; width: 100%; text-align: center; margin-top: 50px; } .us-history { background-color: #F9CC5E; color: #785500; } .us h1 { font-size: 50px; font-weight: bold; padding: 30px 0px 0px 0px; margin-top: 0px; } .us p { font-size: 30px; font-weight: lighter; padding: 0px 100px 0px 100px; } .triangle { height: 50px; } .arrow-down { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; position: absolute; left: 50%; transform: translate(-50%) } .tri-1 { border-top: 50px solid #F9CC5E; } #us-values { height: 400px; width: 100%; text-align: center; color: #785500; margin-top: 50px; } .values { height: 100%; width: 33.22%; position: relative; float: left; } .pic { background-repeat: no-repeat; background-size: 130px 130px; width: 130px; height: 130px; margin: 0 auto; margin-top: 30px; } .pic-mis { background-image: url("../img/heart.png"); } .pic-vis { background-image: url("../img/launch.png"); } .pic-val { background-image: url("../img/ruby.png"); } .value-txt { font-family: Helvetica; font-weight: lighter; font-size: 18px; padding: 30px 40px 0px 40px; color: #071352; } .us-history { background-color: #F9CC5E; color: #785500; } /*MARCAS*/ .us-marcas { background-color: #BE4898; color: #5B003D; margin-top: 100px; } .tri-2 { border-top: 50px solid #AF2682; } #our-brands { height: 400px; width: 100%; margin-top: 50px; } .our { width: 50%; height: 100%; position: relative; float: left; } .our-img { background-image: url("../img/hand.jpg"); background-repeat: no-repeat; background-size: cover; width: 50%; height: 100%; margin: 0 auto; position: relative; } .logo { background-image: url("../img/life_skin.png"); background-repeat: no-repeat; background-size: contain; background-position: center; margin: 0 auto; height: 100%; width: 100%; } #mask { height: 100%; width: 100%; background-color: black; opacity: 0.5; display: none; position: absolute; } .our-img:hover #mask { display: block; } .our-img h3 { font-family: Helvetica; font-weight: lighter; font-size: 60px; padding: 100px 30px 10px 30px; color: white; text-align: center; visibility: hidden; position: absolute; z-index: 10; } .our-img:hover h3 { visibility: visible; } /*RESPONSABILIDAD*/ .us-responsibility { background-color: #C3EB59; color: #527100; margin-top: 100px; } .tri-3 { border-top: 50px solid #6E9801; z-index: 10; } #cases { height: 600px; width: 100%; margin-top: -50px; position: relative; } .case { height: 50%; width: 100%; } .case-1 { background-image: url("../img/org_1.jpg"); background-repeat: no-repeat; background-size: 100% 100%; background-attachment: fixed; width: 100%; height: 50%; margin: 0 auto; } .case-2 { background-image: url("../img/org_2.jpg"); background-repeat: no-repeat; background-size: 100% 100%; background-attachment: fixed; width: 100%; height: 50%; margin: 0 auto; } .case h3 { font-family: Helvetica; font-weight: lighter; font-size: 70px; color: white; text-align: center; padding: 60px; visibility: hidden; position: absolute; z-index: 10; } .case:hover #mask { display: block; height: 50%; } .case:hover h3 { visibility: visible; } /*CONTACTO*/ .us-contact { background-color: #4E5DAA; color: #071352; margin-top: 100px; height: 100px; } .tri-4 { border-top: 50px solid #0E1D6E; } .us-contact h1 { padding: 20px 0px 0px 0px; } #contact-info { height: 400px; width: 100%; margin-top: 75px; margin-bottom: 75px; } .cont { height: 100%; width: 50%; position: relative; float: left; font-family: Helvetica; } .cont h1 { font-weight: bold; text-align: center; padding-left: 20px; padding-right: 20px; color: #071352; } iframe { margin-left: 100px; margin-top: 25px; } form { padding: 0px 40px; margin: 5px; } input, textarea { padding-left: 10px; } .name { width: 100%; font-family: Helvetica; border-radius: 5px; border: 1px solid #f1f1f1; margin-top: 30px; } .email { width: 100%; font-family: Helvetica; border-radius: 5px; border: 1px solid #f1f1f1; margin-top: 10px; } .message { width: 100%; font-family: Helvetica; border-radius: 5px; border: 1px solid #f1f1f1; margin: 10px 0px 0px 0px; } .button { text-align: center; background-color: #AAD92F; border-radius: 10px; border: 0px; padding: 5px; color: #527100; font-size: 15px; margin: 10px 25px 20px 25px; float: right; width: 100px; } .button:hover { font-weight: bold; }
dafnelpz/vitalkap
assets/css/style.css
CSS
mit
5,948
[ 30522, 1013, 1008, 6583, 26493, 2906, 1008, 1013, 1037, 1012, 6583, 26493, 2906, 1011, 4435, 1063, 4578, 1024, 2753, 2361, 2595, 1025, 11687, 4667, 1024, 1014, 2361, 2595, 1014, 2361, 2595, 1014, 2361, 2595, 2184, 2361, 2595, 1025, 7785, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 command import ( "encoding/hex" "fmt" "log" "net" "net/http" "net/url" "os" "os/signal" "runtime" "sort" "strconv" "strings" "syscall" "time" "github.com/armon/go-metrics" "github.com/hashicorp/errwrap" "github.com/hashicorp/go-multierror" "github.com/hashicorp/logutils" "github.com/hashicorp/vault/audit" "github.com/hashicorp/vault/command/server" "github.com/hashicorp/vault/helper/flag-slice" "github.com/hashicorp/vault/helper/gated-writer" "github.com/hashicorp/vault/helper/mlock" vaulthttp "github.com/hashicorp/vault/http" "github.com/hashicorp/vault/logical" "github.com/hashicorp/vault/meta" "github.com/hashicorp/vault/physical" "github.com/hashicorp/vault/vault" "github.com/hashicorp/vault/version" ) // ServerCommand is a Command that starts the Vault server. type ServerCommand struct { AuditBackends map[string]audit.Factory CredentialBackends map[string]logical.Factory LogicalBackends map[string]logical.Factory ShutdownCh chan struct{} SighupCh chan struct{} meta.Meta ReloadFuncs map[string][]server.ReloadFunc } func (c *ServerCommand) Run(args []string) int { var dev, verifyOnly bool var configPath []string var logLevel, devRootTokenID, devListenAddress string flags := c.Meta.FlagSet("server", meta.FlagSetDefault) flags.BoolVar(&dev, "dev", false, "") flags.StringVar(&devRootTokenID, "dev-root-token-id", "", "") flags.StringVar(&devListenAddress, "dev-listen-address", "", "") flags.StringVar(&logLevel, "log-level", "info", "") flags.BoolVar(&verifyOnly, "verify-only", false, "") flags.Usage = func() { c.Ui.Error(c.Help()) } flags.Var((*sliceflag.StringFlag)(&configPath), "config", "config") if err := flags.Parse(args); err != nil { return 1 } if os.Getenv("VAULT_DEV_ROOT_TOKEN_ID") != "" { devRootTokenID = os.Getenv("VAULT_DEV_ROOT_TOKEN_ID") } if os.Getenv("VAULT_DEV_LISTEN_ADDRESS") != "" { devListenAddress = os.Getenv("VAULT_DEV_LISTEN_ADDRESS") } // Validation if !dev { switch { case len(configPath) == 0: c.Ui.Error("At least one config path must be specified with -config") flags.Usage() return 1 case devRootTokenID != "": c.Ui.Error("Root token ID can only be specified with -dev") flags.Usage() return 1 case devListenAddress != "": c.Ui.Error("Development address can only be specified with -dev") flags.Usage() return 1 } } // Load the configuration var config *server.Config if dev { config = server.DevConfig() if devListenAddress != "" { config.Listeners[0].Config["address"] = devListenAddress } } for _, path := range configPath { current, err := server.LoadConfig(path) if err != nil { c.Ui.Error(fmt.Sprintf( "Error loading configuration from %s: %s", path, err)) return 1 } if config == nil { config = current } else { config = config.Merge(current) } } // Ensure at least one config was found. if config == nil { c.Ui.Error("No configuration files found.") return 1 } // Ensure that a backend is provided if config.Backend == nil { c.Ui.Error("A physical backend must be specified") return 1 } // If mlockall(2) isn't supported, show a warning. We disable this // in dev because it is quite scary to see when first using Vault. if !dev && !mlock.Supported() { c.Ui.Output("==> WARNING: mlock not supported on this system!\n") c.Ui.Output(" An `mlockall(2)`-like syscall to prevent memory from being") c.Ui.Output(" swapped to disk is not supported on this system. Running") c.Ui.Output(" Vault on an mlockall(2) enabled system is much more secure.\n") } // Create a logger. We wrap it in a gated writer so that it doesn't // start logging too early. logGate := &gatedwriter.Writer{Writer: os.Stderr} logger := log.New(&logutils.LevelFilter{ Levels: []logutils.LogLevel{ "TRACE", "DEBUG", "INFO", "WARN", "ERR"}, MinLevel: logutils.LogLevel(strings.ToUpper(logLevel)), Writer: logGate, }, "", log.LstdFlags) if err := c.setupTelemetry(config); err != nil { c.Ui.Error(fmt.Sprintf("Error initializing telemetry: %s", err)) return 1 } // Initialize the backend backend, err := physical.NewBackend( config.Backend.Type, logger, config.Backend.Config) if err != nil { c.Ui.Error(fmt.Sprintf( "Error initializing backend of type %s: %s", config.Backend.Type, err)) return 1 } infoKeys := make([]string, 0, 10) info := make(map[string]string) var seal vault.Seal = &vault.DefaultSeal{} // Ensure that the seal finalizer is called, even if using verify-only defer func() { err = seal.Finalize() if err != nil { c.Ui.Error(fmt.Sprintf("Error finalizing seals: %v", err)) } }() coreConfig := &vault.CoreConfig{ Physical: backend, AdvertiseAddr: config.Backend.AdvertiseAddr, HAPhysical: nil, Seal: seal, AuditBackends: c.AuditBackends, CredentialBackends: c.CredentialBackends, LogicalBackends: c.LogicalBackends, Logger: logger, DisableCache: config.DisableCache, DisableMlock: config.DisableMlock, MaxLeaseTTL: config.MaxLeaseTTL, DefaultLeaseTTL: config.DefaultLeaseTTL, } // Initialize the separate HA physical backend, if it exists var ok bool if config.HABackend != nil { habackend, err := physical.NewBackend( config.HABackend.Type, logger, config.HABackend.Config) if err != nil { c.Ui.Error(fmt.Sprintf( "Error initializing backend of type %s: %s", config.HABackend.Type, err)) return 1 } if coreConfig.HAPhysical, ok = habackend.(physical.HABackend); !ok { c.Ui.Error("Specified HA backend does not support HA") return 1 } coreConfig.AdvertiseAddr = config.HABackend.AdvertiseAddr } else { if coreConfig.HAPhysical, ok = backend.(physical.HABackend); ok { coreConfig.AdvertiseAddr = config.Backend.AdvertiseAddr } } if envAA := os.Getenv("VAULT_ADVERTISE_ADDR"); envAA != "" { coreConfig.AdvertiseAddr = envAA } // Attempt to detect the advertise address, if possible var detect physical.AdvertiseDetect if coreConfig.HAPhysical != nil { detect, ok = coreConfig.HAPhysical.(physical.AdvertiseDetect) } else { detect, ok = coreConfig.Physical.(physical.AdvertiseDetect) } if ok && coreConfig.AdvertiseAddr == "" { advertise, err := c.detectAdvertise(detect, config) if err != nil { c.Ui.Error(fmt.Sprintf("Error detecting advertise address: %s", err)) } else if advertise == "" { c.Ui.Error("Failed to detect advertise address.") } else { coreConfig.AdvertiseAddr = advertise } } // Initialize the core core, newCoreError := vault.NewCore(coreConfig) if newCoreError != nil { if !errwrap.ContainsType(newCoreError, new(vault.NonFatalError)) { c.Ui.Error(fmt.Sprintf("Error initializing core: %s", newCoreError)) return 1 } } // If we're in dev mode, then initialize the core if dev { init, err := c.enableDev(core, devRootTokenID) if err != nil { c.Ui.Error(fmt.Sprintf( "Error initializing dev mode: %s", err)) return 1 } export := "export" quote := "'" if runtime.GOOS == "windows" { export = "set" quote = "" } c.Ui.Output(fmt.Sprintf( "==> WARNING: Dev mode is enabled!\n\n"+ "In this mode, Vault is completely in-memory and unsealed.\n"+ "Vault is configured to only have a single unseal key. The root\n"+ "token has already been authenticated with the CLI, so you can\n"+ "immediately begin using the Vault CLI.\n\n"+ "The only step you need to take is to set the following\n"+ "environment variables:\n\n"+ " "+export+" VAULT_ADDR="+quote+"http://"+config.Listeners[0].Config["address"]+quote+"\n\n"+ "The unseal key and root token are reproduced below in case you\n"+ "want to seal/unseal the Vault or play with authentication.\n\n"+ "Unseal Key: %s\nRoot Token: %s\n", hex.EncodeToString(init.SecretShares[0]), init.RootToken, )) } // Compile server information for output later info["backend"] = config.Backend.Type info["log level"] = logLevel info["mlock"] = fmt.Sprintf( "supported: %v, enabled: %v", mlock.Supported(), !config.DisableMlock) infoKeys = append(infoKeys, "log level", "mlock", "backend") if config.HABackend != nil { info["HA backend"] = config.HABackend.Type info["advertise address"] = coreConfig.AdvertiseAddr infoKeys = append(infoKeys, "HA backend", "advertise address") } else { // If the backend supports HA, then note it if coreConfig.HAPhysical != nil { info["backend"] += " (HA available)" info["advertise address"] = coreConfig.AdvertiseAddr infoKeys = append(infoKeys, "advertise address") } } // If the backend supports service discovery, run service discovery if coreConfig.HAPhysical != nil { sd, ok := coreConfig.HAPhysical.(physical.ServiceDiscovery) if ok { if err := sd.RunServiceDiscovery(c.ShutdownCh, coreConfig.AdvertiseAddr); err != nil { c.Ui.Error(fmt.Sprintf("Error initializing service discovery: %v", err)) return 1 } } } // Initialize the listeners lns := make([]net.Listener, 0, len(config.Listeners)) for i, lnConfig := range config.Listeners { ln, props, reloadFunc, err := server.NewListener(lnConfig.Type, lnConfig.Config) if err != nil { c.Ui.Error(fmt.Sprintf( "Error initializing listener of type %s: %s", lnConfig.Type, err)) return 1 } // Store the listener props for output later key := fmt.Sprintf("listener %d", i+1) propsList := make([]string, 0, len(props)) for k, v := range props { propsList = append(propsList, fmt.Sprintf( "%s: %q", k, v)) } sort.Strings(propsList) infoKeys = append(infoKeys, key) info[key] = fmt.Sprintf( "%s (%s)", lnConfig.Type, strings.Join(propsList, ", ")) lns = append(lns, ln) if reloadFunc != nil { relSlice := c.ReloadFuncs["listener|"+lnConfig.Type] relSlice = append(relSlice, reloadFunc) c.ReloadFuncs["listener|"+lnConfig.Type] = relSlice } } infoKeys = append(infoKeys, "version") info["version"] = version.GetVersion().String() // Server configuration output padding := 24 sort.Strings(infoKeys) c.Ui.Output("==> Vault server configuration:\n") for _, k := range infoKeys { c.Ui.Output(fmt.Sprintf( "%s%s: %s", strings.Repeat(" ", padding-len(k)), strings.Title(k), info[k])) } c.Ui.Output("") if verifyOnly { for _, listener := range lns { listener.Close() } return 0 } // Initialize the HTTP server server := &http.Server{} server.Handler = vaulthttp.Handler(core) for _, ln := range lns { go server.Serve(ln) } if newCoreError != nil { c.Ui.Output("==> Warning:\n\nNon-fatal error during initialization; check the logs for more information.") c.Ui.Output("") } // Output the header that the server has started c.Ui.Output("==> Vault server started! Log data will stream in below:\n") // Release the log gate. logGate.Flush() // Wait for shutdown shutdownTriggered := false for !shutdownTriggered { select { case <-c.ShutdownCh: c.Ui.Output("==> Vault shutdown triggered") if err := core.Shutdown(); err != nil { c.Ui.Error(fmt.Sprintf("Error with core shutdown: %s", err)) } shutdownTriggered = true case <-c.SighupCh: c.Ui.Output("==> Vault reload triggered") if err := c.Reload(configPath); err != nil { c.Ui.Error(fmt.Sprintf("Error(s) were encountered during reload: %s", err)) } } } for _, listener := range lns { listener.Close() } return 0 } func (c *ServerCommand) enableDev(core *vault.Core, rootTokenID string) (*vault.InitResult, error) { // Initialize it with a basic single key init, err := core.Initialize(&vault.SealConfig{ SecretShares: 1, SecretThreshold: 1, }, nil) if err != nil { return nil, err } // Copy the key so that it can be zeroed key := make([]byte, len(init.SecretShares[0])) copy(key, init.SecretShares[0]) // Unseal the core unsealed, err := core.Unseal(key) if err != nil { return nil, err } if !unsealed { return nil, fmt.Errorf("failed to unseal Vault for dev mode") } if rootTokenID != "" { req := &logical.Request{ Operation: logical.UpdateOperation, ClientToken: init.RootToken, Path: "auth/token/create", Data: map[string]interface{}{ "id": rootTokenID, "policies": []string{"root"}, "no_parent": true, "no_default_policy": true, }, } resp, err := core.HandleRequest(req) if err != nil { return nil, fmt.Errorf("failed to create root token with ID %s: %s", rootTokenID, err) } if resp == nil { return nil, fmt.Errorf("nil response when creating root token with ID %s", rootTokenID) } if resp.Auth == nil { return nil, fmt.Errorf("nil auth when creating root token with ID %s", rootTokenID) } init.RootToken = resp.Auth.ClientToken req.Path = "auth/token/revoke-self" req.Data = nil resp, err = core.HandleRequest(req) if err != nil { return nil, fmt.Errorf("failed to revoke initial root token: %s", err) } } // Set the token tokenHelper, err := c.TokenHelper() if err != nil { return nil, err } if err := tokenHelper.Store(init.RootToken); err != nil { return nil, err } return init, nil } // detectAdvertise is used to attempt advertise address detection func (c *ServerCommand) detectAdvertise(detect physical.AdvertiseDetect, config *server.Config) (string, error) { // Get the hostname host, err := detect.DetectHostAddr() if err != nil { return "", err } // set [] for ipv6 addresses if strings.Contains(host, ":") && !strings.Contains(host, "]") { host = "[" + host + "]" } // Default the port and scheme scheme := "https" port := 8200 // Attempt to detect overrides for _, list := range config.Listeners { // Only attempt TCP if list.Type != "tcp" { continue } // Check if TLS is disabled if val, ok := list.Config["tls_disable"]; ok { disable, err := strconv.ParseBool(val) if err != nil { return "", fmt.Errorf("tls_disable: %s", err) } if disable { scheme = "http" } } // Check for address override addr, ok := list.Config["address"] if !ok { addr = "127.0.0.1:8200" } // Check for localhost hostStr, portStr, err := net.SplitHostPort(addr) if err != nil { continue } if hostStr == "127.0.0.1" { host = hostStr } // Check for custom port listPort, err := strconv.Atoi(portStr) if err != nil { continue } port = listPort } // Build a URL url := &url.URL{ Scheme: scheme, Host: fmt.Sprintf("%s:%d", host, port), } // Return the URL string return url.String(), nil } // setupTelemetry is used to setup the telemetry sub-systems func (c *ServerCommand) setupTelemetry(config *server.Config) error { /* Setup telemetry Aggregate on 10 second intervals for 1 minute. Expose the metrics over stderr when there is a SIGUSR1 received. */ inm := metrics.NewInmemSink(10*time.Second, time.Minute) metrics.DefaultInmemSignal(inm) var telConfig *server.Telemetry if config.Telemetry == nil { telConfig = &server.Telemetry{} } else { telConfig = config.Telemetry } metricsConf := metrics.DefaultConfig("vault") metricsConf.EnableHostname = !telConfig.DisableHostname // Configure the statsite sink var fanout metrics.FanoutSink if telConfig.StatsiteAddr != "" { sink, err := metrics.NewStatsiteSink(telConfig.StatsiteAddr) if err != nil { return err } fanout = append(fanout, sink) } // Configure the statsd sink if telConfig.StatsdAddr != "" { sink, err := metrics.NewStatsdSink(telConfig.StatsdAddr) if err != nil { return err } fanout = append(fanout, sink) } // Initialize the global sink if len(fanout) > 0 { fanout = append(fanout, inm) metrics.NewGlobal(metricsConf, fanout) } else { metricsConf.EnableHostname = false metrics.NewGlobal(metricsConf, inm) } return nil } func (c *ServerCommand) Reload(configPath []string) error { // Read the new config var config *server.Config for _, path := range configPath { current, err := server.LoadConfig(path) if err != nil { retErr := fmt.Errorf("Error loading configuration from %s: %s", path, err) c.Ui.Error(retErr.Error()) return retErr } if config == nil { config = current } else { config = config.Merge(current) } } // Ensure at least one config was found. if config == nil { retErr := fmt.Errorf("No configuration files found") c.Ui.Error(retErr.Error()) return retErr } var reloadErrors *multierror.Error // Call reload on the listeners. This will call each listener with each // config block, but they verify the address. for _, lnConfig := range config.Listeners { for _, relFunc := range c.ReloadFuncs["listener|"+lnConfig.Type] { if err := relFunc(lnConfig.Config); err != nil { retErr := fmt.Errorf("Error encountered reloading configuration: %s", err) reloadErrors = multierror.Append(retErr) } } } return reloadErrors.ErrorOrNil() } func (c *ServerCommand) Synopsis() string { return "Start a Vault server" } func (c *ServerCommand) Help() string { helpText := ` Usage: vault server [options] Start a Vault server. This command starts a Vault server that responds to API requests. Vault will start in a "sealed" state. The Vault must be unsealed with "vault unseal" or the API before this server can respond to requests. This must be done for every server. If the server is being started against a storage backend that has brand new (no existing Vault data in it), it must be initialized with "vault init" or the API first. General Options: -config=<path> Path to the configuration file or directory. This can be specified multiple times. If it is a directory, all files with a ".hcl" or ".json" suffix will be loaded. -dev Enables Dev mode. In this mode, Vault is completely in-memory and unsealed. Do not run the Dev server in production! -dev-root-token-id="" If set, the root token returned in Dev mode will have the given ID. This *only* has an effect when running in Dev mode. Can also be specified with the VAULT_DEV_ROOT_TOKEN_ID environment variable. -dev-listen-address="" If set, this overrides the normal Dev mode listen address of "127.0.0.1:8200". Can also be specified with the VAULT_DEV_LISTEN_ADDRESS environment variable. -log-level=info Log verbosity. Defaults to "info", will be output to stderr. Supported values: "trace", "debug", "info", "warn", "err" ` return strings.TrimSpace(helpText) } // MakeShutdownCh returns a channel that can be used for shutdown // notifications for commands. This channel will send a message for every // SIGINT or SIGTERM received. func MakeShutdownCh() chan struct{} { resultCh := make(chan struct{}) shutdownCh := make(chan os.Signal, 4) signal.Notify(shutdownCh, os.Interrupt, syscall.SIGTERM) go func() { for { <-shutdownCh resultCh <- struct{}{} } }() return resultCh } // MakeSighupCh returns a channel that can be used for SIGHUP // reloading. This channel will send a message for every // SIGHUP received. func MakeSighupCh() chan struct{} { resultCh := make(chan struct{}) signalCh := make(chan os.Signal, 4) signal.Notify(signalCh, syscall.SIGHUP) go func() { for { <-signalCh resultCh <- struct{}{} } }() return resultCh }
annanay25/vault
command/server.go
GO
mpl-2.0
19,730
[ 30522, 7427, 3094, 12324, 1006, 1000, 17181, 1013, 2002, 2595, 1000, 1000, 4718, 2102, 1000, 1000, 8833, 1000, 1000, 5658, 1000, 1000, 5658, 1013, 8299, 1000, 1000, 5658, 1013, 24471, 2140, 1000, 1000, 9808, 1000, 1000, 9808, 1013, 4742, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ua.pp.shurgent.tfctech.integration.bc.blocks.pipes.transport; import net.minecraft.item.Item; import net.minecraftforge.common.util.ForgeDirection; import ua.pp.shurgent.tfctech.integration.bc.BCStuff; import ua.pp.shurgent.tfctech.integration.bc.ModPipeIconProvider; import ua.pp.shurgent.tfctech.integration.bc.blocks.pipes.handlers.PipeItemsInsertionHandler; import buildcraft.api.core.IIconProvider; import buildcraft.transport.pipes.PipeItemsQuartz; import buildcraft.transport.pipes.events.PipeEventItem; public class PipeItemsSterlingSilver extends PipeItemsQuartz { public PipeItemsSterlingSilver(Item item) { super(item); } @Override public IIconProvider getIconProvider() { return BCStuff.pipeIconProvider; } @Override public int getIconIndex(ForgeDirection direction) { return ModPipeIconProvider.TYPE.PipeItemsSterlingSilver.ordinal(); } public void eventHandler(PipeEventItem.AdjustSpeed event) { super.eventHandler(event); } public void eventHandler(PipeEventItem.Entered event) { event.item.setInsertionHandler(PipeItemsInsertionHandler.INSTANCE); } }
Shurgent/TFCTech
src/main/java/ua/pp/shurgent/tfctech/integration/bc/blocks/pipes/transport/PipeItemsSterlingSilver.java
Java
gpl-3.0
1,104
[ 30522, 7427, 25423, 1012, 4903, 1012, 18454, 25892, 2102, 1012, 1056, 11329, 15007, 1012, 8346, 1012, 4647, 1012, 5991, 1012, 12432, 1012, 3665, 1025, 12324, 5658, 1012, 3067, 10419, 1012, 8875, 1012, 8875, 1025, 12324, 5658, 1012, 3067, 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...
(function (root, undefined) { "use strict";
maniartech/framework-factory
src/(open).js
JavaScript
mit
44
[ 30522, 1006, 3853, 1006, 7117, 1010, 6151, 28344, 1007, 1063, 1000, 2224, 9384, 1000, 1025, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
<html lang="en"> <head> <title>Merged Signals - The GNU C Library</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="The GNU C Library"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Defining-Handlers.html#Defining-Handlers" title="Defining Handlers"> <link rel="prev" href="Signals-in-Handler.html#Signals-in-Handler" title="Signals in Handler"> <link rel="next" href="Nonreentrancy.html#Nonreentrancy" title="Nonreentrancy"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This file documents the GNU C Library. This is `The GNU C Library Reference Manual', for version 2.19-2014.08 (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09). Copyright (C) 1993--2014 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being ``Free Software Needs Free Documentation'' and ``GNU Lesser General Public License'', the Front-Cover texts being ``A GNU Manual'', and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled "GNU Free Documentation License". (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and modify this GNU manual. Buying copies from the FSF supports it in developing GNU and promoting software freedom.''--> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Merged-Signals"></a> <p> Next:&nbsp;<a rel="next" accesskey="n" href="Nonreentrancy.html#Nonreentrancy">Nonreentrancy</a>, Previous:&nbsp;<a rel="previous" accesskey="p" href="Signals-in-Handler.html#Signals-in-Handler">Signals in Handler</a>, Up:&nbsp;<a rel="up" accesskey="u" href="Defining-Handlers.html#Defining-Handlers">Defining Handlers</a> <hr> </div> <h4 class="subsection">24.4.5 Signals Close Together Merge into One</h4> <p><a name="index-handling-multiple-signals-2975"></a><a name="index-successive-signals-2976"></a><a name="index-merging-of-signals-2977"></a> If multiple signals of the same type are delivered to your process before your signal handler has a chance to be invoked at all, the handler may only be invoked once, as if only a single signal had arrived. In effect, the signals merge into one. This situation can arise when the signal is blocked, or in a multiprocessing environment where the system is busy running some other processes while the signals are delivered. This means, for example, that you cannot reliably use a signal handler to count signals. The only distinction you can reliably make is whether at least one signal has arrived since a given time in the past. <p>Here is an example of a handler for <code>SIGCHLD</code> that compensates for the fact that the number of signals received may not equal the number of child processes that generate them. It assumes that the program keeps track of all the child processes with a chain of structures as follows: <pre class="smallexample"> struct process { struct process *next; /* <span class="roman">The process ID of this child.</span> */ int pid; /* <span class="roman">The descriptor of the pipe or pseudo terminal</span> <span class="roman">on which output comes from this child.</span> */ int input_descriptor; /* <span class="roman">Nonzero if this process has stopped or terminated.</span> */ sig_atomic_t have_status; /* <span class="roman">The status of this child; 0 if running,</span> <span class="roman">otherwise a status value from </span><code>waitpid</code><span class="roman">.</span> */ int status; }; struct process *process_list; </pre> <p>This example also uses a flag to indicate whether signals have arrived since some time in the past&mdash;whenever the program last cleared it to zero. <pre class="smallexample"> /* <span class="roman">Nonzero means some child's status has changed</span> <span class="roman">so look at </span><code>process_list</code><span class="roman"> for the details.</span> */ int process_status_change; </pre> <p>Here is the handler itself: <pre class="smallexample"> void sigchld_handler (int signo) { int old_errno = errno; while (1) { register int pid; int w; struct process *p; /* <span class="roman">Keep asking for a status until we get a definitive result.</span> */ do { errno = 0; pid = waitpid (WAIT_ANY, &amp;w, WNOHANG | WUNTRACED); } while (pid &lt;= 0 &amp;&amp; errno == EINTR); if (pid &lt;= 0) { /* <span class="roman">A real failure means there are no more</span> <span class="roman">stopped or terminated child processes, so return.</span> */ errno = old_errno; return; } /* <span class="roman">Find the process that signaled us, and record its status.</span> */ for (p = process_list; p; p = p-&gt;next) if (p-&gt;pid == pid) { p-&gt;status = w; /* <span class="roman">Indicate that the </span><code>status</code><span class="roman"> field</span> <span class="roman">has data to look at. We do this only after storing it.</span> */ p-&gt;have_status = 1; /* <span class="roman">If process has terminated, stop waiting for its output.</span> */ if (WIFSIGNALED (w) || WIFEXITED (w)) if (p-&gt;input_descriptor) FD_CLR (p-&gt;input_descriptor, &amp;input_wait_mask); /* <span class="roman">The program should check this flag from time to time</span> <span class="roman">to see if there is any news in </span><code>process_list</code><span class="roman">.</span> */ ++process_status_change; } /* <span class="roman">Loop around to handle all the processes</span> <span class="roman">that have something to tell us.</span> */ } } </pre> <p>Here is the proper way to check the flag <code>process_status_change</code>: <pre class="smallexample"> if (process_status_change) { struct process *p; process_status_change = 0; for (p = process_list; p; p = p-&gt;next) if (p-&gt;have_status) { ... <span class="roman">Examine </span><code>p-&gt;status</code> ... } } </pre> <p class="noindent">It is vital to clear the flag before examining the list; otherwise, if a signal were delivered just before the clearing of the flag, and after the appropriate element of the process list had been checked, the status change would go unnoticed until the next signal arrived to set the flag again. You could, of course, avoid this problem by blocking the signal while scanning the list, but it is much more elegant to guarantee correctness by doing things in the right order. <p>The loop which checks process status avoids examining <code>p-&gt;status</code> until it sees that status has been validly stored. This is to make sure that the status cannot change in the middle of accessing it. Once <code>p-&gt;have_status</code> is set, it means that the child process is stopped or terminated, and in either case, it cannot stop or terminate again until the program has taken notice. See <a href="Atomic-Usage.html#Atomic-Usage">Atomic Usage</a>, for more information about coping with interruptions during accesses of a variable. <p>Here is another way you can test whether the handler has run since the last time you checked. This technique uses a counter which is never changed outside the handler. Instead of clearing the count, the program remembers the previous value and sees whether it has changed since the previous check. The advantage of this method is that different parts of the program can check independently, each part checking whether there has been a signal since that part last checked. <pre class="smallexample"> sig_atomic_t process_status_change; sig_atomic_t last_process_status_change; ... { sig_atomic_t prev = last_process_status_change; last_process_status_change = process_status_change; if (last_process_status_change != prev) { struct process *p; for (p = process_list; p; p = p-&gt;next) if (p-&gt;have_status) { ... <span class="roman">Examine </span><code>p-&gt;status</code> ... } } } </pre> </body></html>
eckucukoglu/arm-linux-gnueabihf
share/doc/gcc-linaro-arm-linux-gnueabihf/html/libc/Merged-Signals.html
HTML
gpl-2.0
9,380
[ 30522, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 5314, 7755, 1011, 1996, 27004, 1039, 3075, 1026, 1013, 2516, 1028, 1026, 18804, 8299, 1011, 1041, 15549, 2615, 1027, 1000, 4180, 1011, 2828, 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...
team1 = {"name" : "Iron Patriot", "key": "MURICA", "puzzles" : [{"idPz": 0}, // Breakfast {"idPz": 1}, // Blueprints, all {"idPz": 2}, // Morning Rotation # 1 // {"idPz": 14}, // Morning Rotation # 1 Item! (to alieviate routing issues slightly) {"idPz": 3}, // Morning Rotation # 2 // {"idPz": 15}, // Morning Rotation # 2 Item! (to alieviate routing issues slightly) {"idPz": 4}, // Morning Rotation # 3 // {"idPz": 16}, // Morning Rotation # 3 Item! (to alieviate routing issues slightly) {"idPz": 5}, // Morning Rotation # 4 // {"idPz": 17}, // Morning Rotation # 4 Item! (to alieviate routing issues slightly) {"idPz": 6}, // All together now. {"idPz": 7}, // Lunch Time {"idPz": 8}, // Evening Rotation # 1 {"idPz": 9}, // Evening Rotation # 2 {"idPz": 10}, // Evening Rotation # 3 {"idPz": 11}, // Evening Rotation # 4 {"idPz": 12}, // All together now (Blueprints) {"idPz": 13}, // All together now (Final) ], "wordweb":[], "jarvisStream" : {}, "wordwebUnknown":[0], "currentPuzzle" : 0, "teamNum" : 1, "eveningBufferIndex" : 0 } team2 = {"name" : "War Machine", "key": "WARMACHINEROX", "puzzles" : [{"idPz": 0}, // Breakfast {"idPz": 1}, // Blueprints, all {"idPz": 3}, // Morning Rotation # 2 // {"idPz": 15}, // Morning Rotation # 2 Item! (to alieviate routing issues slightly) {"idPz": 4}, // Morning Rotation # 3 // {"idPz": 16}, // Morning Rotation # 3 Item! (to alieviate routing issues slightly) {"idPz": 5}, // Morning Rotation # 4 // {"idPz": 17}, // Morning Rotation # 4 Item! (to alieviate routing issues slightly) {"idPz": 2}, // Morning Rotation # 1 // {"idPz": 14}, // Morning Rotation # 1 Item! (to alieviate routing issues slightly) {"idPz": 6}, // All together now. {"idPz": 7}, // Lunch Time {"idPz": 9}, // Evening Rotation # 2 {"idPz": 10}, // Evening Rotation # 3 {"idPz": 11}, // Evening Rotation # 4 {"idPz": 8}, // Evening Rotation # 1 {"idPz": 12}, // All together now (Blueprints) {"idPz": 13}, // All together now (Final) ], "wordweb":[], "jarvisStream" : {}, "wordwebUnknown":[0], "currentPuzzle" : 0, "teamNum" : 2, "eveningBufferIndex" : 0 } team3 = {"name" : "Hulkbuster", "key": "IRONSMASH", "puzzles" : [{"idPz": 0}, // Breakfast {"idPz": 1}, // Blueprints, all {"idPz": 4}, // Morning Rotation # 3 // {"idPz": 16}, // Morning Rotation # 3 Item! (to alieviate routing issues slightly) {"idPz": 5}, // Morning Rotation # 4 // {"idPz": 17}, // Morning Rotation # 4 Item! (to alieviate routing issues slightly) {"idPz": 2}, // Morning Rotation # 1 // {"idPz": 14}, // Morning Rotation # 1 Item! (to alieviate routing issues slightly) {"idPz": 3}, // Morning Rotation # 2 // {"idPz": 15}, // Morning Rotation # 2 Item! (to alieviate routing issues slightly) {"idPz": 6}, // All together now. {"idPz": 7}, // Lunch Time {"idPz": 10}, // Evening Rotation # 3 {"idPz": 11}, // Evening Rotation # 4 {"idPz": 8}, // Evening Rotation # 1 {"idPz": 9}, // Evening Rotation # 2 {"idPz": 12}, // All together now (Blueprints) {"idPz": 13}, // All together now (Final) ], "wordweb":[], "jarvisStream" : {}, "wordwebUnknown":[0], "currentPuzzle" : 0, "teamNum" : 3, "eveningBufferIndex" : 0 } team4 = {"name" : "Mark I", "key": "OLDSKOOL", "puzzles" : [{"idPz": 0}, // Breakfast {"idPz": 1}, // Blueprints, all {"idPz": 5}, // Morning Rotation # 4 // {"idPz": 17}, // Morning Rotation # 4 Item! (to alieviate routing issues slightly) {"idPz": 2}, // Morning Rotation # 1 // {"idPz": 14}, // Morning Rotation # 1 Item! (to alieviate routing issues slightly) {"idPz": 3}, // Morning Rotation # 2 // {"idPz": 15}, // Morning Rotation # 2 Item! (to alieviate routing issues slightly) {"idPz": 4}, // Morning Rotation # 3 // {"idPz": 16}, // Morning Rotation # 3 Item! (to alieviate routing issues slightly) {"idPz": 6}, // All together now. {"idPz": 7}, // Lunch Time {"idPz": 11}, // Evening Rotation # 4 {"idPz": 8}, // Evening Rotation # 1 {"idPz": 9}, // Evening Rotation # 2 {"idPz": 10}, // Evening Rotation # 3 {"idPz": 12}, // All together now (Blueprints) {"idPz": 13}, // All together now (Final) ], "wordweb":[], "jarvisStream" : {}, "wordwebUnknown":[0], "currentPuzzle" : 0, "teamNum" : 4, "eveningBufferIndex" : 0 } allPuzzles = [{"name": "Breakfast", //0 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, // "showInput": false, "endCondition" : {"websocket": "breakfastOver"}, // "puzzIntro": {"name": "<a href='www.skeenan.com'>Something to help, take it with you.</a>", // ".mp3": null, // "action": null}, "hint": [{"name": "Welcome to breakfast, relax, eat some.", ".mp3": null, "trig": {'time': 10}, "action": null}] }, {"name": "Blueprints", //1 "desc": "Our first Puzzle!", "file": "./puzzles/puzzle1", "estTime": 40, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "isStatPuzzle": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "wrong": "Did you really think that was the right answer?", "menace": true, "insect": true, "pluto": true, "cable": true }, "puzzIntro": {"name": "Go pick up physics quizzes", ".mp3": null, "action": null}, "hint": [{"name": "This puzzle isn't about QR codes", // ".mp3": "./audio/puzzle1/hint1", "trig": {'time': 60*10}, "text": "I can't see what you're doing from here, but have you tried to stack them?", "action": null}, {"name": "Look for letters", // ".mp3": "./audio/puzzle1/hint1", "trig": {'time': 60*15}, "text": "I can't see what you're doing from here, but have you tried to stack them?", "action": null}, {"name": "You can use an anagram solver if you want", // ".mp3": "./audio/puzzle1/hint1", "trig": {'time': 60*20}, "text": "I can't see what you're doing from here, but have you tried to stack them?", "action": null}] }, {"name": "The Grid", //2 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "isStatPuzzle": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "wolverine": true}, "puzzIntro": {"name": "We need you at the Admissions conference room", ".mp3": null, "action": null}, "hint": [{"name": "It's a Sudoku", // ".mp3": "./audio/puzzle2/hint1", "trig": {'time': 60*20}, "action": null}, {"name": "Oh look, semaphore!", // ".mp3": "./audio/puzzle2/hint1", "trig": {'time': 60*25}, "action": null}, {"name": "You should probably look at it from the side the flags are on", // ".mp3": "./audio/puzzle2/hint1", "trig": {'time': 60*30}, "action": null}] }, {"name": "The Arc", //3 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "isStatPuzzle": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "Colston": true}, "puzzIntro": {"name": "Eat", ".mp3": null, "action": null}, "hint": [] }, {"name": "Lasers", //4 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "isStatPuzzle": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "nefaria": true}, "puzzIntro": {"name": "Spalding sub-basement", ".mp3": null, "action": null}, "hint": [{"name": "If you give me power, I can give you information", // ".mp3": "./audio/puzzle2/hint1", "trig": {'time': 60*15}, "action": null}, {"name": "The dates are important", // ".mp3": "./audio/puzzle2/hint1", "trig": {'time': 60*15}, "action": null}, {"name": "Have you tried putting them in order?", // ".mp3": "./audio/puzzle2/hint1", "trig": {'time': 60*20}, "action": null}, {"name": "More information about the songs is better (feel free to use Google)", // ".mp3": "./audio/puzzle2/hint1", "trig": {'time': 60*25}, "action": null}] }, {"name": "Rebus", //5 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "isStatPuzzle": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "Harold Hogan": true}, "puzzIntro": {"name": "Lloyd Deck", ".mp3": null, "action": null}, "hint": [{"name": "The number of the puzzle will prove of use", // ".mp3": "./audio/puzzle2/hint1", "trig": {'time':60*10}, "action": null}, {"name": "index puzzle answer by puzzle number", // ".mp3": "./audio/puzzle2/hint1", "trig": {'time':60*15}, "action": null}] }, {"name": "Squares", //6 - Last before lunch "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "overlap": true, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "allSolveTogether": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "jhammer": true}, "puzzIntro": {"name": "Everyone meet at the BBB front patio", ".mp3": null, "action": null}, "hint": [] }, {"name": "Lunch", //7 - Lunch "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "showInput": false, "endCondition" : {"websocket": "lunchOver"}, // "responses": {"": "You could try to give me something, anything before you press enter you know.", // "answer": true}, // "puzzIntro": {"name": "Eat", // ".mp3": null, // "action": null}, "hint": [] }, {"name": "Teamwork", //8 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "endCondition" : {"websocket": "nextAfternoonPuzzle"}, "isAfternoon" : true, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "stop hammer time!": true }, "puzzIntro": {"name": "We need you at CDC 257", ".mp3": null, "action": null}, "hint": [] }, {"name": "Laserz", //9 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "endCondition" : {"websocket": "nextAfternoonPuzzle"}, "isAfternoon" : true, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "answer": true}, "puzzIntro": {"name": "Moore (070 - 2)", ".mp3": null, "action": null}, "hint": [] }, {"name": "The Game", //10 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "endCondition" : {"websocket": "nextAfternoonPuzzle"}, "isAfternoon" : true, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "YAYYYYYYYYYyYYYyY": true}, "puzzIntro": {"name": "A projector room close to home", ".mp3": null, "action": null}, "hint": [] }, {"name": "The Web", //11 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "endCondition" : {"websocket": "nextAfternoonPuzzle"}, "overlap": true, "isAfternoon" : true, "overlap": true, "isWordWeb": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "answer": true}, "puzzIntro": {"name": "", ".mp3": null, "action": null}, "hint": [] }, {"name": "Take two on Blueprints", //12 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "allSolveTogether": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "answer": true}, // "puzzIntro": {"name": "Eat", // ".mp3": null, // "action": null}, "hint": [] }, {"name": "This is it", //13 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "answer": false}, //Can't have a "correct answer" for the last puzzle, or else crash // "puzzIntro": {"name": "Eat", // ".mp3": null, // "action": null}, "hint": [] }, {"name": "The Mask", //14 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "responses": {"": "You could try to give me something, anything before you press enter you know.", "answer": true}, // "puzzIntro": {"name": "Eat", // ".mp3": null, // "action": null}, "hint": [] }, {"name": "The Glove", //15 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "responses": {"": "You could try to give me something, anything before you press enter you know.", "answer": true}, // "puzzIntro": {"name": "Eat", // ".mp3": null, // "action": null}, "hint": [] }, {"name": "The Core", //16 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "responses": {"": "You could try to give me something, anything before you press enter you know.", "answer": true}, // "puzzIntro": {"name": "Eat", // ".mp3": null, // "action": null}, "hint": [] }, {"name": "The Repulsor", //17 "desc": "Our second Puzzle!", "file": "./puzzles/puzzle2", "estTime": 60, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "responses": {"": "You could try to give me something, anything before you press enter you know.", "answer": true}, // "puzzIntro": {"name": "Eat", // ".mp3": null, // "action": null}, "hint": [] } ] morningBuffers = [{"name": "First Square", //0 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "dues": true, "birth": true, "oracle": true, "yolk": true }, "puzzIntro": {"name": "<a href='squares/1987.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Second Square", //1 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "unix": true, "choose": true, "him": true, "graft": true }, "puzzIntro": {"name": "<a href='squares/2631.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Another Square", //2 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "seer": true, "kraft": true, "eunuchs": true }, "puzzIntro": {"name": "<a href='squares/3237.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "The fourth", //3 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "paced": true, "idle": true, "paws": true, "tea": true }, "puzzIntro": {"name": "<a href='squares/4126.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Num Five.", //4 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "bode": true, "idyll": true, "grease": true, "laze": true }, "puzzIntro": {"name": "<a href='squares/5346.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Square six start", //5 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "lies": true, "ax": true, "tax": true, "bask": true }, "puzzIntro": {"name": "<a href='squares/6987.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Square 7 begin", //6 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "ail": true, "tacks": true, "yolk": true }, "puzzIntro": {"name": "<a href='squares/7123.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Eight Squares In", //7 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "cedar": true, "chorale": true, "marquis": true }, "puzzIntro": {"name": "<a href='squares/8873.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Nine lives, nine squares", //8 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "corral": true, "bruise": true, "sics": true, "pair": true }, "puzzIntro": {"name": "<a href='squares/9314.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Ten Four", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "oohs": true, "six": true, "quire": true, "stayed": true }, "puzzIntro": {"name": "<a href='squares/10242.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Square 11", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "want": true, "few": true, "avricle": true }, "puzzIntro": {"name": "<a href='squares/11235.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "A Dozen!", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "pride": true, "staid": true, "paste": true, "woe": true }, "puzzIntro": {"name": "<a href='squares/12198.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Lucky 13", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "reads": true, "place": true, "whoa": true, "bowed": true }, "puzzIntro": {"name": "<a href='squares/13124.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "14 it is", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "profit": true, "yule": true, "basque": true, "plaice": true }, "puzzIntro": {"name": "<a href='squares/14092.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "You're at 15!", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "lichen": true, "you'll": true, "ale": true }, "puzzIntro": {"name": "<a href='squares/15098.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Sweet 16", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "feeder": true, "cere": true, "sorted": true }, "puzzIntro": {"name": "<a href='squares/16981.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Boring 17", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "pare": true, "none": true, "chews": true, "sordid": true }, "puzzIntro": {"name": "<a href='squares/17092.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "Old enough to go to War(machine)", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "nun": true, "cache": true, "ooze": true, "wave": true }, "puzzIntro": {"name": "<a href='squares/18923.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "19", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "coin": true, "maid": true, "pryed": true, "waive": true }, "puzzIntro": {"name": "<a href='squares/19238.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] }, {"name": "20", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "plait": true, "made": true, "reeds": true, "lynx": true }, "puzzIntro": {"name": "<a href='squares/20.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] }, {"name": "21", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "links": true, "prophet": true, "floes": true, "rain": true }, "puzzIntro": {"name": "<a href='squares/21.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] }, {"name": "22", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "root": true, "reign": true, "liken": true }, "puzzIntro": {"name": "<a href='squares/22.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] }, {"name": "23", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "phew": true, "crewel": true, "tapir": true }, "puzzIntro": {"name": "<a href='squares/23.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] }, {"name": "24", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "taper": true, "allowed": true }, "puzzIntro": {"name": "<a href='squares/24.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] }, {"name": "25", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "cents": true, "ewe": true }, "puzzIntro": {"name": "<a href='squares/25.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "26", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "jewel": true, "whore": true, "sense": true }, "puzzIntro": {"name": "<a href='squares/26.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "27", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "cyclet": true, "liar": true, "joule": true }, "puzzIntro": {"name": "<a href='squares/27.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "28", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "mood": true, "pause": true, "islet": true }, "puzzIntro": {"name": "<a href='squares/28.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "29", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "epoch": true, "phlox": true, "want": true }, "puzzIntro": {"name": "<a href='squares/29.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "30", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "mooed": true, "Greece": true, "word": true }, "puzzIntro": {"name": "<a href='squares/30.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "31", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "acts": true, "whirred": true, "palate": true }, "puzzIntro": {"name": "<a href='squares/31.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "32", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "maize": true, "pallette": true }, "puzzIntro": {"name": "<a href='squares/32.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "33", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "you": true, "sine": true, "marqaee": true }, "puzzIntro": {"name": "<a href='squares/33.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "34", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "brews": true, "massed": true, "hoar": true, "sign": true }, "puzzIntro": {"name": "<a href='squares/34.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "35", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "potpourri": true, "doe": true, "epic": true }, "puzzIntro": {"name": "<a href='squares/35.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "36", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "rabbit": true, "rose": true, "popery": true }, "puzzIntro": {"name": "<a href='squares/36.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] },{"name": "37", //9 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "responses": {"": "You could try to give me something, anything before you press enter you know.", "rabbet": true, "illicit": true }, "puzzIntro": {"name": "<a href='squares/37.jpg'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] } ] eveningBuffers = [{"name": "To Find", //0 "desc": "Keep you computers open to await instruction.", "file": "./puzzles/puzzle1", "estTime": 30, "answerResponse": {"name": "", ".mp3": null}, "isActive": false, "overlap": true, "showInput": false, "endCondition" : {"websocket": "breakfastOver"}, "puzzIntro": {"name": "<a href='www.skeenan.com'>Something to help, take it with you.</a>", ".mp3": null, "action": null}, "hint": [] }] morningBufferIndex = 0 stats = {} adminSockets = {sockets: []}; teams = [team1, team2, team3, team4]; function initTeams() { for (var team in teams) { teams[team].aboutToStart = 0; teams[team].sockets = []; for (var aPuzzle in teams[team].puzzles) { aPuzzle = teams[team].puzzles[aPuzzle]; aPuzzle.puzzle = allPuzzles[aPuzzle.idPz]; aPuzzle.startTime = null; aPuzzle.elapsed = null; aPuzzle.hints = []; } startPuzzle(teams[team]) } } function reloadAllPuzzles(){ for (var team in teams) { for (var aPuzzle in teams[team].puzzles) { aPuzzle = teams[team].puzzles[aPuzzle]; aPuzzle.puzzle = allPuzzles[aPuzzle.idPz]; } } } function startPuzzle(team) { //Init Jarvis stream team.jarvisStream[team.currentPuzzle] = {"name": team.puzzles[team.currentPuzzle].puzzle.name, "desc": team.puzzles[team.currentPuzzle].puzzle.desc, "data": []} var nextIntro = team.puzzles[team.currentPuzzle].puzzle.puzzIntro if (team.puzzles[team.currentPuzzle].puzzIntro){ nextIntro = team.puzzles[team.currentPuzzle].puzzIntro } if (nextIntro){ newJarvisMessageOut(team, nextIntro) } if (team.puzzles[team.currentPuzzle].puzzle.name === "Squares"){ for (var i = morningBufferIndex; i < morningBuffers.length; i++) { newJarvisMessageOut(team, morningBuffers[i].puzzIntro) }; } if (team.puzzles[team.currentPuzzle].puzzle.name === "Lunch"){ morningBufferIndex = morningBuffers.length } startPuzzleTimer(team) } function resaveAllTeams(){ //Save all the teams } function logNewStat(team, statName, value, isIncrement){ // if (!stats[statName]){ // stats[statName] = {1: 0, 2: 0, 3: 0, 4: 0} // } // if (isIncrement){ // stats[statName][team.teamNum] += value // } else { // stats[statName][team.teamNum] = value // } // updateAllCompetitionData() } function logStatsOnTime(team){ if (team.puzzles[team.currentPuzzle].puzzle.isStatPuzzle){ logNewStat(team, team.puzzles[team.currentPuzzle].puzzle.name + " time", Math.floor(team.puzzles[team.currentPuzzle].elapsed/60), false) } } function startNextPuzzle(team){ logStatsOnTime(team) team.puzzles[team.currentPuzzle].puzzle.isActive = false if (team.currentPuzzle === -1) { team.currentPuzzle = team.lastPuzzleIndex } if (team.puzzles[team.currentPuzzle + 1].puzzle.overlap || !team.puzzles[team.currentPuzzle + 1].puzzle.isActive) { if (team.puzzles[team.currentPuzzle].puzzle.isWordWeb){ emitToAllTeams(team, "bootOffWeb", true) } team.currentPuzzle ++ team.puzzles[team.currentPuzzle].puzzle.isActive = true } else { team.lastPuzzleIndex = team.currentPuzzle team.currentPuzzle = -1 team.puzzles[-1] = {} team.puzzles[-1].puzzle = getNextBuffer(team) } startPuzzle(team) } function getNextBuffer(team){ if (morningBufferIndex < morningBuffers.length){ logNewStat(team, "Pieces Found", 1, true) output = morningBuffers[morningBufferIndex] morningBufferIndex ++ return output } else { // I'm just going to assume that we're in the afternoon // if (team.eveningBufferIndex < eveningBuffers.length){ // output = eveningBuffers[team.eveningBufferIndex] // team.eveningBufferIndex ++ // return output // } else { return {"name": "Error finding next puzzle. Let's say SEGFAULT", "responses": {"": "You could try to give me something, anything before you press enter you know.", "answer": true}} // } } } function startPuzzleTimer(team){ if (team.timer == null){ team.puzzles[team.currentPuzzle].elapsed = 0; team.timer = function(){ if (typeof this.puzzles[this.currentPuzzle].elapsed === 'undefined'){ return; } this.puzzles[this.currentPuzzle].elapsed ++; emitToAllTeams(this, 'tick', {'elapsed' : this.puzzles[this.currentPuzzle].elapsed}) checkPuzzTimerHints(this); } var myVar=setInterval(function(){team.timer()},1000); } team.puzzles[team.currentPuzzle].start } function checkPuzzTimerHints(team){ var outHint = null; var puzzHints = allPuzzles[team.currentPuzzle].hint; // var outHintIndex = 0; var isUpdated = false; for (var hint in puzzHints){ if (puzzHints[hint].trig.time != null && puzzHints[hint].trig.time == team.puzzles[team.currentPuzzle].elapsed) { outHint = puzzHints[hint]; isUpdated = true; // isUpdated = (isUpdated || (hint != oldHints[outHintIndex])); // outHintIndex ++; } } if (isUpdated){ newJarvisMessageOut(team, outHint) } } function sendAllPuzzleData(team){ //TODO: Send all relevant puzzle data, how do we make sure client only // renders the most recent hint? var puzzleOut = constructAllPuzzleData(team); emitToAllTeams(team, 'jarvisUpdate', puzzleOut) emitToAllTeams(adminSockets, 'jarvisUpdate', puzzleOut) } function constructAllPuzzleData(team){ out = {}; out.name = team.name out.currentPuzzle = team.currentPuzzle out.currentPuzzleName = team.puzzles[team.currentPuzzle].puzzle.name out.jarvisStream = team.jarvisStream out.teamNum = team.teamNum out.showInput = team.puzzles[team.currentPuzzle].puzzle.showInput out.stats = stats return out } function updateAllCompetitionData(){ try{ var puzzleOut = {} for (team in teams){ team = teams[team] puzzleOut = constructAllPuzzleData(team); emitToAllTeams(team, 'compUpdate', puzzleOut) } emitToAllTeams(adminSockets, 'jarvisUpdate', puzzleOut) } catch (err) { console.log(err) } } function newJarvisMessageOut(team, message){ team.jarvisStream[team.currentPuzzle].data.push(message); // TODO: Persist! sendAllPuzzleData(team); emitToAllTeams(team, 'jarvisMessage', message) } if (teams[0].sockets == null) { initTeams() } reloadAllPuzzles(); module.exports.teams = teams; module.exports.allPuzzles = allPuzzles; module.exports.reloadAllPuzzles = reloadAllPuzzles; module.exports.resaveAllTeams = resaveAllTeams; module.exports.startPuzzle = startPuzzle; module.exports.startNextPuzzle = startNextPuzzle; module.exports.sendAllPuzzleData = sendAllPuzzleData; module.exports.emitToAllTeams = emitToAllTeams; module.exports.constructAllPuzzleData = constructAllPuzzleData; module.exports.adminSockets = adminSockets; module.exports.newJarvisMessageOut = newJarvisMessageOut; module.exports.stats = stats; module.exports.logNewStat = logNewStat;
sean9keenan/WordWeb
backend/puzzles.js
JavaScript
mit
48,757
[ 30522, 2136, 2487, 1027, 1063, 1000, 2171, 1000, 1024, 1000, 3707, 16419, 1000, 1010, 1000, 3145, 1000, 1024, 1000, 14163, 14735, 1000, 1010, 1000, 19672, 1000, 1024, 1031, 1063, 1000, 8909, 2361, 2480, 1000, 1024, 1014, 1065, 1010, 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...
import React from "react"; import { View } from "react-native"; import styles from "./styles"; import { ListItemSeparator } from "./styles/responsive"; const ArticleListItemSeparator = () => ( <ListItemSeparator> <View style={styles.listItemSeparator} /> </ListItemSeparator> ); export default ArticleListItemSeparator;
newsuk/times-components
packages/article-list/src/article-list-item-separator.js
JavaScript
bsd-3-clause
330
[ 30522, 12324, 10509, 2013, 1000, 10509, 1000, 1025, 12324, 1063, 3193, 1065, 2013, 1000, 10509, 1011, 3128, 1000, 1025, 12324, 6782, 2013, 1000, 1012, 1013, 6782, 1000, 1025, 12324, 1063, 2862, 4221, 5244, 13699, 25879, 2953, 1065, 2013, 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...
<?php namespace wcf\data\page; use wcf\data\DatabaseObjectDecorator; /** * Represents a page node element. * * @author Marcel Werk * @copyright 2001-2019 WoltLab GmbH * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> * @package WoltLabSuite\Core\Data\Page * @since 3.0 * * @method Page getDecoratedObject() * @mixin Page */ class PageNode extends DatabaseObjectDecorator implements \Countable, \RecursiveIterator { /** * parent node * @var PageNode */ protected $parentNode; /** * children of this node * @var PageNode[] */ protected $children = []; /** * node depth * @var int */ protected $depth = 0; /** * iterator position * @var int */ private $position = 0; /** * @inheritDoc */ protected static $baseClass = Page::class; /** * Creates a new PageNode object. * * @param PageNode $parentNode * @param Page $page * @param int $depth */ public function __construct($parentNode = null, ?Page $page = null, $depth = 0) { if ($page === null) { $page = new Page(null, []); } parent::__construct($page); $this->parentNode = $parentNode; $this->depth = $depth; } /** * Sets the children of this node. * * @param PageNode[] $children */ public function setChildren(array $children) { $this->children = $children; } /** * Returns the parent node * * @return PageNode */ public function getParentNode() { return $this->parentNode; } /** * Returns the number of children. */ public function count(): int { return \count($this->children); } /** * @inheritDoc */ public function rewind() { $this->position = 0; } /** * @inheritDoc */ public function valid() { return isset($this->children[$this->position]); } /** * @inheritDoc */ public function next() { $this->position++; } /** * @inheritDoc */ public function current() { return $this->children[$this->position]; } /** * @inheritDoc */ public function key() { return $this->position; } /** * @inheritDoc */ public function getChildren() { return $this->children[$this->position]; } /** * @inheritDoc */ public function hasChildren() { return \count($this->children) > 0; } /** * Returns node depth. * * @return int */ public function getDepth() { return $this->depth; } }
Cyperghost/WCF
wcfsetup/install/files/lib/data/page/PageNode.class.php
PHP
lgpl-2.1
2,818
[ 30522, 1026, 1029, 25718, 3415, 15327, 15868, 2546, 1032, 2951, 1032, 3931, 1025, 2224, 15868, 2546, 1032, 2951, 1032, 7809, 16429, 20614, 3207, 27108, 8844, 1025, 1013, 1008, 1008, 1008, 5836, 1037, 3931, 13045, 5783, 1012, 1008, 1008, 103...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
/***************************************************************************** * ts_psip.c : TS demux ATSC A65 PSIP handling ***************************************************************************** * Copyright (C) 2016 - VideoLAN Authors * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. *****************************************************************************/ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <vlc_common.h> #include <vlc_demux.h> #include <vlc_meta.h> #include <vlc_epg.h> #ifndef _DVBPSI_DVBPSI_H_ #include <dvbpsi/dvbpsi.h> #endif #ifndef _DVBPSI_DEMUX_H_ #include <dvbpsi/demux.h> #endif #include <dvbpsi/descriptor.h> #include <dvbpsi/atsc_mgt.h> #include <dvbpsi/atsc_vct.h> #include <dvbpsi/atsc_eit.h> #include <dvbpsi/atsc_ett.h> #include <dvbpsi/atsc_stt.h> #include <dvbpsi/dr_a0.h> /* Custom decoders */ #include <dvbpsi/psi.h> #include "ts_decoders.h" #include "ts_psip_dvbpsi_fixes.h" #include "ts_pid.h" #include "ts.h" #include "ts_streams_private.h" #include "ts_scte.h" #include "ts_psip.h" #include "../codec/atsc_a65.h" #include "../codec/scte18.h" #include <assert.h> static inline char *grab_notempty( char **ppsz ) { char *psz_ret = NULL; if( *ppsz && **ppsz ) { psz_ret = *ppsz; *ppsz = NULL; } return psz_ret; } /* * Decoders activation order due to dependencies, * and because callbacks will be fired once per MGT/VCT version * STT(ref by EIT,EAS) -> MGT * MGT -> VCT,EAS,EIT/ETT */ struct ts_psip_context_t { dvbpsi_atsc_mgt_t *p_mgt; /* Used to match (EITx,ETTx)<->PIDn */ dvbpsi_atsc_stt_t *p_stt; /* Time reference for EIT/EAS */ dvbpsi_atsc_vct_t *p_vct; /* Required for EIT vchannel -> program remapping */ atsc_a65_handle_t *p_a65; /* Shared Handle to avoid iconv reopens */ uint16_t i_tabletype; /* Only used by EIT/ETT pid */ DECL_ARRAY(dvbpsi_atsc_ett_t *) etts; /* For ETT pid, used on new EIT update */ DECL_ARRAY(dvbpsi_atsc_eit_t *) eits; /* For EIT pid, used on new ETT update */ }; void ts_psip_Packet_Push( ts_pid_t *p_pid, const uint8_t *p_pktbuffer ) { if( p_pid->u.p_psip->handle->p_decoder && likely(p_pid->type == TYPE_PSIP) ) dvbpsi_packet_push( p_pid->u.p_psip->handle, (uint8_t *) p_pktbuffer ); } ts_psip_context_t * ts_psip_context_New() { ts_psip_context_t *p_ctx = malloc(sizeof(*p_ctx)); if(likely(p_ctx)) { p_ctx->p_mgt = NULL; p_ctx->p_stt = NULL; p_ctx->p_vct = NULL; p_ctx->p_a65 = NULL; p_ctx->i_tabletype = 0; ARRAY_INIT(p_ctx->etts); ARRAY_INIT(p_ctx->eits); } return p_ctx; } void ts_psip_context_Delete( ts_psip_context_t *p_ctx ) { assert( !p_ctx->p_mgt || !p_ctx->etts.i_size ); assert( !p_ctx->p_vct || !p_ctx->eits.i_size ); if( p_ctx->p_mgt ) dvbpsi_atsc_DeleteMGT( p_ctx->p_mgt ); if( p_ctx->p_stt ) dvbpsi_atsc_DeleteSTT( p_ctx->p_stt ); if ( p_ctx->p_vct ) dvbpsi_atsc_DeleteVCT( p_ctx->p_vct ); if( p_ctx->p_a65 ) atsc_a65_handle_Release( p_ctx->p_a65 ); /* Things only used for ETT/EIT */ for( int i=0; i<p_ctx->etts.i_size; i++ ) dvbpsi_atsc_DeleteETT( p_ctx->etts.p_elems[i] ); for( int i=0; i<p_ctx->eits.i_size; i++ ) dvbpsi_atsc_DeleteEIT( p_ctx->eits.p_elems[i] ); ARRAY_RESET( p_ctx->etts ); ARRAY_RESET( p_ctx->eits ); free( p_ctx ); } static ts_pid_t *ATSC_GetSiblingxTTPID( ts_pid_list_t *p_list, const dvbpsi_atsc_mgt_t *p_mgt, ts_psip_t *p_psip ) { uint16_t i_lookup; assert( p_psip->p_ctx->i_tabletype ); if( p_psip->p_ctx->i_tabletype >= ATSC_TABLE_TYPE_ETT_0 ) i_lookup = p_psip->p_ctx->i_tabletype - ATSC_TABLE_TYPE_ETT_0 + ATSC_TABLE_TYPE_EIT_0; else i_lookup = p_psip->p_ctx->i_tabletype - ATSC_TABLE_TYPE_EIT_0 + ATSC_TABLE_TYPE_ETT_0; for( const dvbpsi_atsc_mgt_table_t *p_tab = p_mgt->p_first_table; p_tab; p_tab = p_tab->p_next ) { if( p_tab->i_table_type == i_lookup ) return ts_pid_Get( p_list, p_tab->i_table_type_pid ); } return NULL; } static inline uint32_t toETMId( uint16_t i_vchannel, uint16_t i_event_id ) { return (i_vchannel << 16) | (i_event_id << 2) | 0x02; } static inline void fromETMId( uint32_t i_etm_id, uint16_t *pi_vchannel, uint16_t *pi_event_id ) { *pi_vchannel = i_etm_id >> 16; *pi_event_id = (i_etm_id & 0xFFFF) >> 2; } static const dvbpsi_atsc_ett_t * ATSC_ETTFindByETMId( ts_psip_context_t *p_ettctx, uint32_t i_etm_id, uint8_t i_version ) { int i; ARRAY_BSEARCH( p_ettctx->etts, ->i_etm_id, uint32_t, i_etm_id, i ); if( i != -1 && p_ettctx->etts.p_elems[i]->i_version == i_version ) return p_ettctx->etts.p_elems[i]; return NULL; } static const dvbpsi_atsc_eit_event_t * ATSC_EventFindByETMId( ts_psip_context_t *p_eitctx, uint32_t i_etm_id, uint8_t i_version ) { uint16_t i_vchannel_id, i_event_id; fromETMId( i_etm_id, &i_vchannel_id, &i_event_id ); for( int i=0; i<p_eitctx->eits.i_size; i++ ) { dvbpsi_atsc_eit_t *p_eit = p_eitctx->eits.p_elems[i]; if( p_eit->i_version != i_version || p_eit->i_source_id != i_vchannel_id ) continue; for( const dvbpsi_atsc_eit_event_t *p_evt = p_eit->p_first_event; p_evt ; p_evt = p_evt->p_next ) { if( p_evt->i_event_id == i_event_id ) return p_evt; } } return NULL; } static void ATSC_EITInsert( ts_psip_context_t *p_ctx, dvbpsi_atsc_eit_t *p_eit ) { for( int i=0; i<p_ctx->eits.i_size; i++ ) { dvbpsi_atsc_eit_t *p_cur_eit = p_ctx->eits.p_elems[i]; if( p_cur_eit->i_source_id == p_eit->i_source_id ) { dvbpsi_atsc_DeleteEIT( p_cur_eit ); /* Updated version */ p_ctx->eits.p_elems[i] = p_eit; return; } } ARRAY_APPEND( p_ctx->eits, p_eit ); } static void ATSC_CleanETTByChannelVersion( ts_psip_context_t *p_ctx, uint16_t i_channel, uint8_t i_version ) { int i=0; while( i<p_ctx->etts.i_size ) { dvbpsi_atsc_ett_t *p = p_ctx->etts.p_elems[i]; uint16_t i_curchan = p->i_etm_id >> 16; if( i_channel < i_curchan ) break; /* because ordered */ if( i_curchan == i_channel && p->i_version != i_version ) { dvbpsi_atsc_DeleteETT( p ); ARRAY_REMOVE( p_ctx->etts, i ); } else i++; } } static void ATSC_InsertETTOrdered( ts_psip_context_t *p_ctx, dvbpsi_atsc_ett_t *p_ett ) { int i=0; for( ; i<p_ctx->etts.i_size; i++ ) { dvbpsi_atsc_ett_t *p = p_ctx->etts.p_elems[i]; if( p->i_etm_id >= p_ett->i_etm_id ) { if( p->i_etm_id == p_ett->i_etm_id ) { dvbpsi_atsc_DeleteETT( p ); p_ctx->etts.p_elems[i] = p_ett; return; } break; } } ARRAY_INSERT( p_ctx->etts, p_ett, i ); } static bool ATSC_TranslateVChannelToProgram( const dvbpsi_atsc_vct_t *p_vct, uint16_t i_channel, uint16_t *pi_program ) { for( const dvbpsi_atsc_vct_channel_t *p_channel = p_vct->p_first_channel; p_channel; p_channel = p_channel->p_next ) { if( p_channel->i_source_id == i_channel ) { *pi_program = p_channel->i_program_number; return true; } } return false; } static void ATSC_NewTable_Callback( dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, void *p_pid ); /* Just Hook a base demux, and let NewTableCallback handle decoders creation */ static bool ATSC_Ready_SubDecoders( dvbpsi_t *p_handle, void *p_cb_pid ) { if( !dvbpsi_decoder_present( p_handle ) ) return dvbpsi_AttachDemux( p_handle, ATSC_NewTable_Callback, p_cb_pid ); return true; } void ATSC_Detach_Dvbpsi_Decoders( dvbpsi_t *p_handle ) { if( dvbpsi_decoder_present( p_handle ) ) dvbpsi_DetachDemux( p_handle ); } #define ATSC_ATTACH( handle, type, table, extension, pid ) \ ( ATSC_Ready_SubDecoders( handle, pid ) &&\ ( dvbpsi_demuxGetSubDec( (dvbpsi_demux_t *) handle->p_decoder, table, extension ) ||\ dvbpsi_atsc_Attach ## type( handle, table, extension, ATSC_ ## type ## _Callback, pid ) ) ) #define ATSC_ATTACH_WITH_FIXED_DECODER( handle, type, table, extension, pid ) \ ( ATSC_Ready_SubDecoders( handle, pid ) &&\ ( dvbpsi_demuxGetSubDec( (dvbpsi_demux_t *) handle->p_decoder, table, extension ) ||\ ts_dvbpsi_AttachRawSubDecoder( handle, table, extension, ATSC_ ## type ## _RawCallback, pid ) ) ) static const char * const rgpsz_ATSC_A53_service_types[] = { "Analog Television", "ATSC Digital Television", "ATSC Audio", "ATSC Data Only Service", "ATSC Software Download Service", }; static const char * ATSC_A53_get_service_type( uint8_t i_type ) { if( i_type == 0 || i_type > 5 ) return NULL; return rgpsz_ATSC_A53_service_types[i_type - 1]; } #ifndef ATSC_DEBUG_EIT #define EIT_DEBUG_TIMESHIFT(t) #else /* Define static time var used as anchor to current time to offset all eit entries */ static time_t i_eit_debug_offset = 0; #define EIT_DEBUG_TIMESHIFT(t) \ do {\ if( i_eit_debug_offset == 0 )\ i_eit_debug_offset = time(NULL) - t;\ t = t + i_eit_debug_offset;\ } while(0); #endif static vlc_epg_event_t * ATSC_CreateVLCEPGEvent( demux_t *p_demux, ts_psip_context_t *p_basectx, const dvbpsi_atsc_eit_event_t *p_evt, const dvbpsi_atsc_ett_t *p_ett ) { #ifndef ATSC_DEBUG_EIT VLC_UNUSED(p_demux); #endif char *psz_title = atsc_a65_Decode_multiple_string( p_basectx->p_a65, p_evt->i_title, p_evt->i_title_length ); char *psz_shortdesc_text = NULL; char *psz_longdesc_text = NULL; vlc_epg_event_t *p_epgevt = NULL; time_t i_start = atsc_a65_GPSTimeToEpoch( p_evt->i_start_time, p_basectx->p_stt->i_gps_utc_offset ); EIT_DEBUG_TIMESHIFT( i_start ); for( const dvbpsi_descriptor_t *p_dr = p_evt->p_first_descriptor; p_dr; p_dr = p_dr->p_next ) { switch( p_dr->i_tag ) { case ATSC_DESCRIPTOR_CONTENT_ADVISORY: { const uint8_t *p_data = p_dr->p_data; size_t i_data = p_dr->i_length; uint8_t i_ratings_count = p_dr->p_data[0] & 0x3F; p_data++; i_data--; for( ; i_ratings_count && i_data > 3; i_ratings_count-- ) { uint8_t i_rated_dimensions = p_data[1]; if( (size_t) i_rated_dimensions * 2 + 3 > i_data ) /* one more sanity check */ break; uint8_t desclen = p_data[(size_t) 2 + 2 * i_rated_dimensions]; p_data += (size_t) 3 + 2 * i_rated_dimensions; i_data -= (size_t) 3 + 2 * i_rated_dimensions; if( desclen > i_data ) break; if( unlikely(psz_shortdesc_text) ) free( psz_shortdesc_text ); psz_shortdesc_text = atsc_a65_Decode_multiple_string( p_basectx->p_a65, p_data, desclen ); if( psz_shortdesc_text ) /* Only keep first for now */ break; p_data += desclen; i_data -= desclen; } } default: break; } } /* Try to match ETT */ if( p_ett ) { psz_longdesc_text = atsc_a65_Decode_multiple_string( p_basectx->p_a65, p_ett->p_etm_data, p_ett->i_etm_length ); } if( i_start > VLC_TS_INVALID && psz_title ) { #ifdef ATSC_DEBUG_EIT msg_Dbg( p_demux, "EIT Event time %ld +%d %s id 0x%x", i_start, p_evt->i_length_seconds, psz_title, p_evt->i_event_id ); #endif p_epgevt = vlc_epg_event_New( p_evt->i_event_id, i_start, p_evt->i_length_seconds ); if( p_epgevt ) { p_epgevt->psz_name = grab_notempty( &psz_title ); p_epgevt->psz_short_description = grab_notempty( &psz_shortdesc_text ); p_epgevt->psz_description = grab_notempty( &psz_longdesc_text ); } } free( psz_title ); free( psz_shortdesc_text ); free( psz_longdesc_text ); return p_epgevt; } static time_t ATSC_AddVLCEPGEvent( demux_t *p_demux, ts_psip_context_t *p_basectx, const dvbpsi_atsc_eit_event_t *p_event, const dvbpsi_atsc_ett_t *p_ett, vlc_epg_t *p_epg ) { vlc_epg_event_t *p_evt = ATSC_CreateVLCEPGEvent( p_demux, p_basectx, p_event, p_ett ); if( p_evt ) { if( vlc_epg_AddEvent( p_epg, p_evt ) ) return p_evt->i_start; vlc_epg_event_Delete( p_evt ); } return VLC_TS_INVALID; } static void ATSC_EIT_Callback( void *p_pid, dvbpsi_atsc_eit_t* p_eit ) { ts_pid_t *p_eit_pid = (ts_pid_t *) p_pid; if( unlikely(p_eit_pid->type != TYPE_PSIP) ) { assert( p_eit_pid->type == TYPE_PSIP ); dvbpsi_atsc_DeleteEIT( p_eit ); return; } demux_t *p_demux = (demux_t *) p_eit_pid->u.p_psip->handle->p_sys; ts_pid_t *p_base_pid = GetPID(p_demux->p_sys, ATSC_BASE_PID); ts_psip_t *p_basepsip = p_base_pid->u.p_psip; ts_psip_context_t *p_basectx = p_basepsip->p_ctx; if( !p_eit->b_current_next || unlikely(p_base_pid->type != TYPE_PSIP || !p_basectx->p_stt || !p_basectx->p_vct) ) { dvbpsi_atsc_DeleteEIT( p_eit ); return; } uint16_t i_program_number; if ( !ATSC_TranslateVChannelToProgram( p_basectx->p_vct, p_eit->i_source_id, &i_program_number ) ) { msg_Warn( p_demux, "Received EIT for unkown channel %d", p_eit->i_source_id ); dvbpsi_atsc_DeleteEIT( p_eit ); return; } const ts_pid_t *pid_sibling_ett = ATSC_GetSiblingxTTPID( &p_demux->p_sys->pids, p_basectx->p_mgt, p_eit_pid->u.p_psip ); /* Get System Time for finding and setting current event */ time_t i_current_time = atsc_a65_GPSTimeToEpoch( p_basectx->p_stt->i_system_time, p_basectx->p_stt->i_gps_utc_offset ); EIT_DEBUG_TIMESHIFT( i_current_time ); const uint16_t i_table_type = p_eit_pid->u.p_psip->p_ctx->i_tabletype; assert(i_table_type); /* Use PID for segmenting our EPG tables updates. 1 EIT/PID transmits 3 hours, * with a max of 16 days over 128 EIT/PID. Unlike DVD, table ID is here fixed. * see ATSC A/65 5.0 */ vlc_epg_t *p_epg = vlc_epg_New( i_table_type - ATSC_TABLE_TYPE_EIT_0, i_program_number ); if( !p_epg ) { dvbpsi_atsc_DeleteEIT( p_eit ); return; } /* Use first table as present/following (not split like DVB) */ p_epg->b_present = (i_table_type == ATSC_TABLE_TYPE_EIT_0); if( !p_basectx->p_a65 && !(p_basectx->p_a65 = atsc_a65_handle_New( NULL )) ) goto end; time_t i_current_event_start_time = 0; for( const dvbpsi_atsc_eit_event_t *p_evt = p_eit->p_first_event; p_evt ; p_evt = p_evt->p_next ) { /* Try to match ETT */ const dvbpsi_atsc_ett_t *p_ett = NULL; if( pid_sibling_ett ) p_ett = ATSC_ETTFindByETMId( pid_sibling_ett->u.p_psip->p_ctx, toETMId( p_eit->i_source_id, p_evt->i_event_id ), p_eit->i_version ); /* Add Event to EPG based on EIT / available ETT */ time_t i_start = ATSC_AddVLCEPGEvent( p_demux, p_basectx, p_evt, p_ett, p_epg ); /* Try to find current event */ if( i_start <= i_current_time && i_start + p_evt->i_length_seconds > i_current_time ) i_current_event_start_time = i_start; } /* Update epg current time from system time ( required for pruning ) */ if( p_epg->b_present && i_current_event_start_time ) { vlc_epg_SetCurrent( p_epg, i_current_event_start_time ); ts_pat_t *p_pat = ts_pid_Get(&p_demux->p_sys->pids, 0)->u.p_pat; ts_pmt_t *p_pmt = ts_pat_Get_pmt(p_pat, i_program_number); if(p_pmt) { p_pmt->eit.i_event_start = p_epg->p_current->i_start; p_pmt->eit.i_event_length = p_epg->p_current->i_duration; } } if( p_epg->i_event > 0 ) es_out_Control( p_demux->out, ES_OUT_SET_GROUP_EPG, (int)i_program_number, p_epg ); end: vlc_epg_Delete( p_epg ); ATSC_EITInsert( p_eit_pid->u.p_psip->p_ctx, p_eit ); } static void ATSC_ETT_Callback( void *p_pid, dvbpsi_atsc_ett_t *p_ett ) { ts_pid_t *p_ett_pid = (ts_pid_t *) p_pid; if( unlikely(p_ett_pid->type != TYPE_PSIP) ) { assert( p_ett_pid->type == TYPE_PSIP ); dvbpsi_atsc_DeleteETT( p_ett ); return; } demux_t *p_demux = (demux_t *) p_ett_pid->u.p_psip->handle->p_sys; ts_pid_t *p_base_pid = GetPID(p_demux->p_sys, ATSC_BASE_PID); ts_psip_t *p_basepsip = p_base_pid->u.p_psip; ts_psip_context_t *p_basectx = p_basepsip->p_ctx; if( p_ett->i_etm_id & 0x02 ) /* Event ETT */ { ts_psip_context_t *p_ctx = p_ett_pid->u.p_psip->p_ctx; uint16_t i_vchannel_id, i_event_id; fromETMId( p_ett->i_etm_id, &i_vchannel_id, &i_event_id ); uint16_t i_program_number; if ( !ATSC_TranslateVChannelToProgram( p_basectx->p_vct, i_vchannel_id, &i_program_number ) ) { msg_Warn( p_demux, "Received EIT for unkown channel %d", i_vchannel_id ); dvbpsi_atsc_DeleteETT( p_ett ); return; } /* If ETT with that version isn't already in list (inserted when matched eit is present) */ if( ATSC_ETTFindByETMId( p_ctx, p_ett->i_etm_id, p_ett->i_version ) == NULL ) { const dvbpsi_atsc_mgt_t *p_mgt = ts_pid_Get( &p_demux->p_sys->pids, ATSC_BASE_PID )->u.p_psip->p_ctx->p_mgt; ts_pid_t *p_sibling_eit = ATSC_GetSiblingxTTPID( &p_demux->p_sys->pids, p_mgt, p_ett_pid->u.p_psip ); if( p_sibling_eit ) { const dvbpsi_atsc_eit_event_t *p_event = ATSC_EventFindByETMId( p_sibling_eit->u.p_psip->p_ctx, p_ett->i_etm_id, p_ett->i_version ); if( p_event ) { #ifdef ATSC_DEBUG_EIT msg_Dbg( p_demux, "Should update EIT %x (matched EIT)", p_event->i_event_id ); #endif vlc_epg_event_t *p_evt = ATSC_CreateVLCEPGEvent( p_demux, p_basectx, p_event, p_ett ); if( likely(p_evt) ) { es_out_Control( p_demux->out, ES_OUT_SET_GROUP_EPG_EVENT, (int)i_program_number, p_evt ); #ifdef ATSC_DEBUG_EIT msg_Dbg( p_demux, "Updated event %x with ETT", p_evt->i_id ); #endif vlc_epg_event_Delete( p_evt ); } } /* Insert to avoid duplicated event, and to be available to EIT if didn't appear yet */ ATSC_InsertETTOrdered( p_ctx, p_ett ); ATSC_CleanETTByChannelVersion( p_ctx, i_vchannel_id, p_ett->i_version ); return; } } } dvbpsi_atsc_DeleteETT( p_ett ); } static void ATSC_ETT_RawCallback( dvbpsi_t *p_handle, const dvbpsi_psi_section_t* p_section, void *p_base_pid ) { VLC_UNUSED( p_handle ); for( ; p_section; p_section = p_section->p_next ) { dvbpsi_atsc_ett_t *p_ett = DVBPlague_ETT_Decode( p_section ); if( p_ett ) /* Send to real callback */ ATSC_ETT_Callback( p_base_pid, p_ett ); } } static void ATSC_VCT_Callback( void *p_cb_basepid, dvbpsi_atsc_vct_t* p_vct ) { ts_pid_t *p_base_pid = (ts_pid_t *) p_cb_basepid; if( unlikely(p_base_pid->type != TYPE_PSIP || p_base_pid->i_pid != ATSC_BASE_PID) ) { assert( p_base_pid->type == TYPE_PSIP ); assert( p_base_pid->i_pid == ATSC_BASE_PID ); dvbpsi_atsc_DeleteVCT( p_vct ); return; } demux_t *p_demux = (demux_t *) p_base_pid->u.p_psip->handle->p_sys; ts_psip_context_t *p_ctx = p_base_pid->u.p_psip->p_ctx; if( !p_ctx->p_a65 && !(p_ctx->p_a65 = atsc_a65_handle_New( NULL )) ) goto end; for( const dvbpsi_atsc_vct_channel_t *p_channel = p_vct->p_first_channel; p_channel; p_channel = p_channel->p_next ) { vlc_meta_t *p_meta = vlc_meta_New(); if( p_meta ) { char *psz_name = NULL; for( dvbpsi_descriptor_t *p_dr = p_channel->p_first_descriptor; p_dr; p_dr = p_dr->p_next ) { switch( p_dr->i_tag ) { case ATSC_DESCRIPTOR_EXTENDED_CHANNEL_NAME: { dvbpsi_extended_channel_name_dr_t *p_ecndr = dvbpsi_ExtendedChannelNameDr( p_dr ); if( p_ecndr ) { if( unlikely(psz_name) ) free( psz_name ); psz_name = atsc_a65_Decode_multiple_string( p_ctx->p_a65, p_ecndr->i_long_channel_name, p_ecndr->i_long_channel_name_length ); } } break; default: break; } } if( !psz_name ) psz_name = atsc_a65_Decode_simple_UTF16_string( p_ctx->p_a65, p_channel->i_short_name, 14 ); if( psz_name ) { vlc_meta_SetTitle( p_meta, psz_name ); free( psz_name ); } const char *psz_service_type = ATSC_A53_get_service_type( p_channel->i_service_type ); if( psz_service_type ) vlc_meta_AddExtra( p_meta, "Type", psz_service_type ); es_out_Control( p_demux->out, ES_OUT_SET_GROUP_META, p_channel->i_program_number, p_meta ); vlc_meta_Delete( p_meta ); } } end: if( p_ctx->p_vct ) dvbpsi_atsc_DeleteVCT( p_ctx->p_vct ); p_ctx->p_vct = p_vct; } static void ATSC_MGT_Callback( void *p_cb_basepid, dvbpsi_atsc_mgt_t* p_mgt ) { ts_pid_t *p_base_pid = (ts_pid_t *) p_cb_basepid; if( unlikely(p_base_pid->type != TYPE_PSIP || p_base_pid->i_pid != ATSC_BASE_PID) ) { assert( p_base_pid->type == TYPE_PSIP ); assert( p_base_pid->i_pid == ATSC_BASE_PID ); dvbpsi_atsc_DeleteMGT( p_mgt ); return; } ts_psip_t *p_mgtpsip = p_base_pid->u.p_psip; demux_t *p_demux = (demux_t *) p_mgtpsip->handle->p_sys; if( ( p_mgtpsip->i_version != -1 && p_mgtpsip->i_version == p_mgt->i_version ) || p_mgt->b_current_next == 0 ) { dvbpsi_atsc_DeleteMGT( p_mgt ); return; } /* Easy way, delete and recreate every child if any new version comes * (We don't need to keep PID active as with video/PMT update) */ if( p_mgtpsip->i_version != -1 ) { if( p_mgtpsip->p_ctx->p_vct ) { dvbpsi_atsc_DeleteVCT( p_mgtpsip->p_ctx->p_vct ); p_mgtpsip->p_ctx->p_vct = NULL; } /* Remove EIT/ETT */ for( int i=0; i < p_mgtpsip->eit.i_size; i++ ) { PIDRelease( p_demux, p_mgtpsip->eit.p_elems[i] ); assert( p_mgtpsip->eit.p_elems[i]->type == TYPE_FREE ); } ARRAY_RESET(p_mgtpsip->eit); /* Remove EAS */ dvbpsi_demux_t *p_dvbpsi_demux = (dvbpsi_demux_t *) p_mgtpsip->handle->p_decoder; dvbpsi_demux_subdec_t *p_subdec = dvbpsi_demuxGetSubDec( p_dvbpsi_demux, SCTE18_TABLE_ID, 0x00 ); if( p_subdec ) { dvbpsi_DetachDemuxSubDecoder( p_dvbpsi_demux, p_subdec ); dvbpsi_DeleteDemuxSubDecoder( p_subdec ); } } if( p_mgtpsip->p_ctx->p_mgt ) dvbpsi_atsc_DeleteMGT( p_mgtpsip->p_ctx->p_mgt ); p_mgtpsip->p_ctx->p_mgt = p_mgt; p_mgtpsip->i_version = p_mgt->i_version; for( const dvbpsi_atsc_mgt_table_t *p_tab = p_mgt->p_first_table; p_tab; p_tab = p_tab->p_next ) { if( p_tab->i_table_type == ATSC_TABLE_TYPE_TVCT || p_tab->i_table_type == ATSC_TABLE_TYPE_CVCT ) { const uint8_t i_table_id = (p_tab->i_table_type == ATSC_TABLE_TYPE_CVCT) ? ATSC_CVCT_TABLE_ID : ATSC_TVCT_TABLE_ID; if( !ATSC_ATTACH( p_mgtpsip->handle, VCT, i_table_id, GetPID(p_demux->p_sys, 0)->u.p_pat->i_ts_id, p_base_pid ) ) msg_Dbg( p_demux, " * pid=%d listening for ATSC VCT", p_base_pid->i_pid ); } else if( p_tab->i_table_type >= ATSC_TABLE_TYPE_EIT_0 && p_tab->i_table_type <= ATSC_TABLE_TYPE_EIT_0 + ATSC_EIT_MAX_DEPTH_MIN1 && p_tab->i_table_type <= ATSC_TABLE_TYPE_EIT_127 && p_tab->i_table_type_pid != p_base_pid->i_pid ) { ts_pid_t *pid = GetPID(p_demux->p_sys, p_tab->i_table_type_pid); if( PIDSetup( p_demux, TYPE_PSIP, pid, NULL ) ) { SetPIDFilter( p_demux->p_sys, pid, true ); pid->u.p_psip->p_ctx->i_tabletype = p_tab->i_table_type; ATSC_Ready_SubDecoders( pid->u.p_psip->handle, pid ); msg_Dbg( p_demux, " * pid=%d reserved for ATSC EIT", pid->i_pid ); ARRAY_APPEND( p_mgtpsip->eit, pid ); } } else if( p_tab->i_table_type >= ATSC_TABLE_TYPE_ETT_0 && p_tab->i_table_type <= ATSC_TABLE_TYPE_ETT_0 + ATSC_EIT_MAX_DEPTH_MIN1 && p_tab->i_table_type <= ATSC_TABLE_TYPE_ETT_127 && p_tab->i_table_type_pid != p_base_pid->i_pid ) { ts_pid_t *pid = GetPID(p_demux->p_sys, p_tab->i_table_type_pid); if( PIDSetup( p_demux, TYPE_PSIP, pid, NULL ) ) { SetPIDFilter( p_demux->p_sys, pid, true ); pid->u.p_psip->p_ctx->i_tabletype = p_tab->i_table_type; ATSC_Ready_SubDecoders( pid->u.p_psip->handle, pid ); msg_Dbg( p_demux, " * pid=%d reserved for ATSC ETT", pid->i_pid ); ARRAY_APPEND( p_mgtpsip->eit, pid ); } } msg_Dbg( p_demux, " * pid=%d transport for ATSC PSIP type %x", p_tab->i_table_type_pid, p_tab->i_table_type ); } if( SCTE18_SI_BASE_PID == ATSC_BASE_PID && ts_dvbpsi_AttachRawSubDecoder( p_mgtpsip->handle, SCTE18_TABLE_ID, 0x00, SCTE18_Section_Callback, p_base_pid ) ) { msg_Dbg( p_demux, " * pid=%d listening for EAS", p_base_pid->i_pid ); } } static void ATSC_STT_Callback( void *p_cb_basepid, dvbpsi_atsc_stt_t* p_stt ) { ts_pid_t *p_base_pid = (ts_pid_t *) p_cb_basepid; if( unlikely(p_base_pid->type != TYPE_PSIP || p_base_pid->i_pid != ATSC_BASE_PID) ) { assert( p_base_pid->type == TYPE_PSIP ); assert( p_base_pid->i_pid == ATSC_BASE_PID ); dvbpsi_atsc_DeleteSTT( p_stt ); return; } demux_t *p_demux = (demux_t *) p_base_pid->u.p_psip->handle->p_sys; ts_psip_context_t *p_ctx = p_base_pid->u.p_psip->p_ctx; dvbpsi_t *p_handle = p_base_pid->u.p_psip->handle; if( !p_ctx->p_stt ) /* First call */ { if( !ATSC_ATTACH( p_handle, MGT, ATSC_MGT_TABLE_ID, 0x00, p_base_pid ) ) { msg_Err( p_demux, "Can't attach MGT decoder to pid %d", ATSC_BASE_PID ); ATSC_Detach_Dvbpsi_Decoders( p_handle ); dvbpsi_atsc_DeleteSTT( p_ctx->p_stt ); p_stt = NULL; } } else { dvbpsi_atsc_DeleteSTT( p_ctx->p_stt ); } if( p_stt ) { time_t i_current_time = atsc_a65_GPSTimeToEpoch( p_stt->i_system_time, p_stt->i_gps_utc_offset ); EIT_DEBUG_TIMESHIFT( i_current_time ); p_demux->p_sys->i_network_time = i_current_time; p_demux->p_sys->i_network_time_update = time(NULL); es_out_Control( p_demux->out, ES_OUT_SET_EPG_TIME, p_demux->p_sys->i_network_time ); } p_ctx->p_stt = p_stt; } static void ATSC_STT_RawCallback( dvbpsi_t *p_handle, const dvbpsi_psi_section_t* p_section, void *p_base_pid ) { VLC_UNUSED( p_handle ); for( ; p_section ; p_section = p_section->p_next ) { dvbpsi_atsc_stt_t *p_stt = DVBPlague_STT_Decode( p_section ); if( p_stt ) /* Send to real callback */ ATSC_STT_Callback( p_base_pid, p_stt ); } } bool ATSC_Attach_Dvbpsi_Base_Decoders( dvbpsi_t *p_handle, void *p_base_pid ) { if( !ATSC_ATTACH_WITH_FIXED_DECODER( p_handle, STT, ATSC_STT_TABLE_ID, 0x00, p_base_pid ) ) { ATSC_Detach_Dvbpsi_Decoders( p_handle ); /* shouldn't be any, except demux */ return false; } return true; } static void ATSC_NewTable_Callback( dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension, void *p_cb_pid ) { demux_t *p_demux = (demux_t *) p_dvbpsi->p_sys; assert( ((ts_pid_t *) p_cb_pid)->type == TYPE_PSIP ); const ts_pid_t *p_base_pid = ts_pid_Get( &p_demux->p_sys->pids, ATSC_BASE_PID ); if( !p_base_pid->u.p_psip->p_ctx->p_vct ) return; switch( i_table_id ) { case ATSC_ETT_TABLE_ID: if( !ATSC_ATTACH_WITH_FIXED_DECODER( p_dvbpsi, ETT, ATSC_ETT_TABLE_ID, i_extension, p_cb_pid ) ) msg_Warn( p_demux, "Cannot attach ETT decoder source %" PRIu16, i_extension ); break; case ATSC_EIT_TABLE_ID: if( !ATSC_ATTACH( p_dvbpsi, EIT, ATSC_EIT_TABLE_ID, i_extension, p_cb_pid ) ) msg_Warn( p_demux, "Cannot attach EIT decoder source %" PRIu16, i_extension ); break; default: break; } }
pddthinh/android-vlc
vlc/modules/demux/mpeg/ts_psip.c
C
gpl-2.0
31,798
[ 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...
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * acpi_bus.h - ACPI Bus Driver ($Revision: 22 $) * * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> */ #ifndef __ACPI_BUS_H__ #define __ACPI_BUS_H__ #include <linux/device.h> #include <linux/property.h> /* TBD: Make dynamic */ #define ACPI_MAX_HANDLES 10 struct acpi_handle_list { u32 count; acpi_handle handles[ACPI_MAX_HANDLES]; }; /* acpi_utils.h */ acpi_status acpi_extract_package(union acpi_object *package, struct acpi_buffer *format, struct acpi_buffer *buffer); acpi_status acpi_evaluate_integer(acpi_handle handle, acpi_string pathname, struct acpi_object_list *arguments, unsigned long long *data); acpi_status acpi_evaluate_reference(acpi_handle handle, acpi_string pathname, struct acpi_object_list *arguments, struct acpi_handle_list *list); acpi_status acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code, struct acpi_buffer *status_buf); acpi_status acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); bool acpi_has_method(acpi_handle handle, char *name); acpi_status acpi_execute_simple_method(acpi_handle handle, char *method, u64 arg); acpi_status acpi_evaluate_ej0(acpi_handle handle); acpi_status acpi_evaluate_lck(acpi_handle handle, int lock); bool acpi_ata_match(acpi_handle handle); bool acpi_bay_match(acpi_handle handle); bool acpi_dock_match(acpi_handle handle); bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs); union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func, union acpi_object *argv4); static inline union acpi_object * acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev, u64 func, union acpi_object *argv4, acpi_object_type type) { union acpi_object *obj; obj = acpi_evaluate_dsm(handle, guid, rev, func, argv4); if (obj && obj->type != type) { ACPI_FREE(obj); obj = NULL; } return obj; } #define ACPI_INIT_DSM_ARGV4(cnt, eles) \ { \ .package.type = ACPI_TYPE_PACKAGE, \ .package.count = (cnt), \ .package.elements = (eles) \ } bool acpi_dev_found(const char *hid); bool acpi_dev_present(const char *hid, const char *uid, s64 hrv); #ifdef CONFIG_ACPI #include <linux/proc_fs.h> #define ACPI_BUS_FILE_ROOT "acpi" extern struct proc_dir_entry *acpi_root_dir; enum acpi_bus_device_type { ACPI_BUS_TYPE_DEVICE = 0, ACPI_BUS_TYPE_POWER, ACPI_BUS_TYPE_PROCESSOR, ACPI_BUS_TYPE_THERMAL, ACPI_BUS_TYPE_POWER_BUTTON, ACPI_BUS_TYPE_SLEEP_BUTTON, ACPI_BUS_TYPE_ECDT_EC, ACPI_BUS_DEVICE_TYPE_COUNT }; struct acpi_driver; struct acpi_device; /* * ACPI Scan Handler * ----------------- */ struct acpi_hotplug_profile { struct kobject kobj; int (*scan_dependent)(struct acpi_device *adev); void (*notify_online)(struct acpi_device *adev); bool enabled:1; bool demand_offline:1; }; static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile( struct kobject *kobj) { return container_of(kobj, struct acpi_hotplug_profile, kobj); } struct acpi_scan_handler { const struct acpi_device_id *ids; struct list_head list_node; bool (*match)(const char *idstr, const struct acpi_device_id **matchid); int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); void (*detach)(struct acpi_device *dev); void (*bind)(struct device *phys_dev); void (*unbind)(struct device *phys_dev); struct acpi_hotplug_profile hotplug; }; /* * ACPI Hotplug Context * -------------------- */ struct acpi_hotplug_context { struct acpi_device *self; int (*notify)(struct acpi_device *, u32); void (*uevent)(struct acpi_device *, u32); void (*fixup)(struct acpi_device *); }; /* * ACPI Driver * ----------- */ typedef int (*acpi_op_add) (struct acpi_device * device); typedef int (*acpi_op_remove) (struct acpi_device * device); typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event); struct acpi_device_ops { acpi_op_add add; acpi_op_remove remove; acpi_op_notify notify; }; #define ACPI_DRIVER_ALL_NOTIFY_EVENTS 0x1 /* system AND device events */ struct acpi_driver { char name[80]; char class[80]; const struct acpi_device_id *ids; /* Supported Hardware IDs */ unsigned int flags; struct acpi_device_ops ops; struct device_driver drv; struct module *owner; }; /* * ACPI Device * ----------- */ /* Status (_STA) */ struct acpi_device_status { u32 present:1; u32 enabled:1; u32 show_in_ui:1; u32 functional:1; u32 battery_present:1; u32 reserved:27; }; /* Flags */ struct acpi_device_flags { u32 dynamic_status:1; u32 removable:1; u32 ejectable:1; u32 power_manageable:1; u32 match_driver:1; u32 initialized:1; u32 visited:1; u32 hotplug_notify:1; u32 is_dock_station:1; u32 of_compatible_ok:1; u32 coherent_dma:1; u32 cca_seen:1; u32 enumeration_by_parent:1; u32 reserved:19; }; /* File System */ struct acpi_device_dir { struct proc_dir_entry *entry; }; #define acpi_device_dir(d) ((d)->dir.entry) /* Plug and Play */ typedef char acpi_bus_id[8]; typedef u64 acpi_bus_address; typedef char acpi_device_name[40]; typedef char acpi_device_class[20]; struct acpi_hardware_id { struct list_head list; const char *id; }; struct acpi_pnp_type { u32 hardware_id:1; u32 bus_address:1; u32 platform_id:1; u32 reserved:29; }; struct acpi_device_pnp { acpi_bus_id bus_id; /* Object name */ struct acpi_pnp_type type; /* ID type */ acpi_bus_address bus_address; /* _ADR */ char *unique_id; /* _UID */ struct list_head ids; /* _HID and _CIDs */ acpi_device_name device_name; /* Driver-determined */ acpi_device_class device_class; /* " */ union acpi_object *str_obj; /* unicode string for _STR method */ }; #define acpi_device_bid(d) ((d)->pnp.bus_id) #define acpi_device_adr(d) ((d)->pnp.bus_address) const char *acpi_device_hid(struct acpi_device *device); #define acpi_device_uid(d) ((d)->pnp.unique_id) #define acpi_device_name(d) ((d)->pnp.device_name) #define acpi_device_class(d) ((d)->pnp.device_class) /* Power Management */ struct acpi_device_power_flags { u32 explicit_get:1; /* _PSC present? */ u32 power_resources:1; /* Power resources */ u32 inrush_current:1; /* Serialize Dx->D0 */ u32 power_removed:1; /* Optimize Dx->D0 */ u32 ignore_parent:1; /* Power is independent of parent power state */ u32 dsw_present:1; /* _DSW present? */ u32 reserved:26; }; struct acpi_device_power_state { struct { u8 valid:1; u8 explicit_set:1; /* _PSx present? */ u8 reserved:6; } flags; int power; /* % Power (compared to D0) */ int latency; /* Dx->D0 time (microseconds) */ struct list_head resources; /* Power resources referenced */ }; struct acpi_device_power { int state; /* Current state */ struct acpi_device_power_flags flags; struct acpi_device_power_state states[ACPI_D_STATE_COUNT]; /* Power states (D0-D3Cold) */ }; /* Performance Management */ struct acpi_device_perf_flags { u8 reserved:8; }; struct acpi_device_perf_state { struct { u8 valid:1; u8 reserved:7; } flags; u8 power; /* % Power (compared to P0) */ u8 performance; /* % Performance ( " ) */ int latency; /* Px->P0 time (microseconds) */ }; struct acpi_device_perf { int state; struct acpi_device_perf_flags flags; int state_count; struct acpi_device_perf_state *states; }; /* Wakeup Management */ struct acpi_device_wakeup_flags { u8 valid:1; /* Can successfully enable wakeup? */ u8 notifier_present:1; /* Wake-up notify handler has been installed */ }; struct acpi_device_wakeup_context { void (*func)(struct acpi_device_wakeup_context *context); struct device *dev; }; struct acpi_device_wakeup { acpi_handle gpe_device; u64 gpe_number; u64 sleep_state; struct list_head resources; struct acpi_device_wakeup_flags flags; struct acpi_device_wakeup_context context; struct wakeup_source *ws; int prepare_count; int enable_count; }; struct acpi_device_physical_node { unsigned int node_id; struct list_head node; struct device *dev; bool put_online:1; }; struct acpi_device_properties { const guid_t *guid; const union acpi_object *properties; struct list_head list; }; /* ACPI Device Specific Data (_DSD) */ struct acpi_device_data { const union acpi_object *pointer; struct list_head properties; const union acpi_object *of_compatible; struct list_head subnodes; }; struct acpi_gpio_mapping; /* Device */ struct acpi_device { int device_type; acpi_handle handle; /* no handle for fixed hardware */ struct fwnode_handle fwnode; struct acpi_device *parent; struct list_head children; struct list_head node; struct list_head wakeup_list; struct list_head del_list; struct acpi_device_status status; struct acpi_device_flags flags; struct acpi_device_pnp pnp; struct acpi_device_power power; struct acpi_device_wakeup wakeup; struct acpi_device_perf performance; struct acpi_device_dir dir; struct acpi_device_data data; struct acpi_scan_handler *handler; struct acpi_hotplug_context *hp; struct acpi_driver *driver; const struct acpi_gpio_mapping *driver_gpios; void *driver_data; struct device dev; unsigned int physical_node_count; unsigned int dep_unmet; struct list_head physical_node_list; struct mutex physical_node_lock; void (*remove)(struct acpi_device *); }; /* Non-device subnode */ struct acpi_data_node { const char *name; acpi_handle handle; struct fwnode_handle fwnode; struct fwnode_handle *parent; struct acpi_device_data data; struct list_head sibling; struct kobject kobj; struct completion kobj_done; }; extern const struct fwnode_operations acpi_device_fwnode_ops; extern const struct fwnode_operations acpi_data_fwnode_ops; extern const struct fwnode_operations acpi_static_fwnode_ops; bool is_acpi_device_node(const struct fwnode_handle *fwnode); bool is_acpi_data_node(const struct fwnode_handle *fwnode); static inline bool is_acpi_node(const struct fwnode_handle *fwnode) { return (is_acpi_device_node(fwnode) || is_acpi_data_node(fwnode)); } #define to_acpi_device_node(__fwnode) \ ({ \ typeof(__fwnode) __to_acpi_device_node_fwnode = __fwnode; \ \ is_acpi_device_node(__to_acpi_device_node_fwnode) ? \ container_of(__to_acpi_device_node_fwnode, \ struct acpi_device, fwnode) : \ NULL; \ }) #define to_acpi_data_node(__fwnode) \ ({ \ typeof(__fwnode) __to_acpi_data_node_fwnode = __fwnode; \ \ is_acpi_data_node(__to_acpi_data_node_fwnode) ? \ container_of(__to_acpi_data_node_fwnode, \ struct acpi_data_node, fwnode) : \ NULL; \ }) static inline bool is_acpi_static_node(const struct fwnode_handle *fwnode) { return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &acpi_static_fwnode_ops; } static inline bool acpi_data_node_match(const struct fwnode_handle *fwnode, const char *name) { return is_acpi_data_node(fwnode) ? (!strcmp(to_acpi_data_node(fwnode)->name, name)) : false; } static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev) { return &adev->fwnode; } static inline void *acpi_driver_data(struct acpi_device *d) { return d->driver_data; } #define to_acpi_device(d) container_of(d, struct acpi_device, dev) #define to_acpi_driver(d) container_of(d, struct acpi_driver, drv) static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta) { *((u32 *)&adev->status) = sta; } static inline void acpi_set_hp_context(struct acpi_device *adev, struct acpi_hotplug_context *hp) { hp->self = adev; adev->hp = hp; } void acpi_initialize_hp_context(struct acpi_device *adev, struct acpi_hotplug_context *hp, int (*notify)(struct acpi_device *, u32), void (*uevent)(struct acpi_device *, u32)); /* acpi_device.dev.bus == &acpi_bus_type */ extern struct bus_type acpi_bus_type; /* * Events * ------ */ struct acpi_bus_event { struct list_head node; acpi_device_class device_class; acpi_bus_id bus_id; u32 type; u32 data; }; extern struct kobject *acpi_kobj; extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); void acpi_bus_private_data_handler(acpi_handle, void *); int acpi_bus_get_private_data(acpi_handle, void **); int acpi_bus_attach_private_data(acpi_handle, void *); void acpi_bus_detach_private_data(acpi_handle); extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); extern int register_acpi_notifier(struct notifier_block *); extern int unregister_acpi_notifier(struct notifier_block *); /* * External Functions */ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); struct acpi_device *acpi_bus_get_acpi_device(acpi_handle handle); void acpi_bus_put_acpi_device(struct acpi_device *adev); acpi_status acpi_bus_get_status_handle(acpi_handle handle, unsigned long long *sta); int acpi_bus_get_status(struct acpi_device *device); int acpi_bus_set_power(acpi_handle handle, int state); const char *acpi_power_state_string(int state); int acpi_device_set_power(struct acpi_device *device, int state); int acpi_bus_init_power(struct acpi_device *device); int acpi_device_fix_up_power(struct acpi_device *device); int acpi_bus_update_power(acpi_handle handle, int *state_p); int acpi_device_update_power(struct acpi_device *device, int *state_p); bool acpi_bus_power_manageable(acpi_handle handle); int acpi_device_power_add_dependent(struct acpi_device *adev, struct device *dev); void acpi_device_power_remove_dependent(struct acpi_device *adev, struct device *dev); #ifdef CONFIG_PM bool acpi_bus_can_wakeup(acpi_handle handle); #else static inline bool acpi_bus_can_wakeup(acpi_handle handle) { return false; } #endif void acpi_scan_lock_acquire(void); void acpi_scan_lock_release(void); void acpi_lock_hp_context(void); void acpi_unlock_hp_context(void); int acpi_scan_add_handler(struct acpi_scan_handler *handler); int acpi_bus_register_driver(struct acpi_driver *driver); void acpi_bus_unregister_driver(struct acpi_driver *driver); int acpi_bus_scan(acpi_handle handle); void acpi_bus_trim(struct acpi_device *start); acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); int acpi_match_device_ids(struct acpi_device *device, const struct acpi_device_id *ids); void acpi_set_modalias(struct acpi_device *adev, const char *default_id, char *modalias, size_t len); int acpi_create_dir(struct acpi_device *); void acpi_remove_dir(struct acpi_device *); static inline bool acpi_device_enumerated(struct acpi_device *adev) { return adev && adev->flags.initialized && adev->flags.visited; } /** * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver * @__acpi_driver: acpi_driver struct * * Helper macro for ACPI drivers which do not do anything special in module * init/exit. This eliminates a lot of boilerplate. Each module may only * use this macro once, and calling it replaces module_init() and module_exit() */ #define module_acpi_driver(__acpi_driver) \ module_driver(__acpi_driver, acpi_bus_register_driver, \ acpi_bus_unregister_driver) /* * Bind physical devices with ACPI devices */ struct acpi_bus_type { struct list_head list; const char *name; bool (*match)(struct device *dev); struct acpi_device * (*find_companion)(struct device *); void (*setup)(struct device *); void (*cleanup)(struct device *); }; int register_acpi_bus_type(struct acpi_bus_type *); int unregister_acpi_bus_type(struct acpi_bus_type *); int acpi_bind_one(struct device *dev, struct acpi_device *adev); int acpi_unbind_one(struct device *dev); struct acpi_pci_root { struct acpi_device * device; struct pci_bus *bus; u16 segment; struct resource secondary; /* downstream bus range */ u32 osc_support_set; /* _OSC state of support bits */ u32 osc_control_set; /* _OSC state of control bits */ phys_addr_t mcfg_addr; }; /* helper */ bool acpi_dma_supported(struct acpi_device *adev); enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev); int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset, u64 *size); int acpi_dma_configure(struct device *dev, enum dev_dma_attr attr); struct acpi_device *acpi_find_child_device(struct acpi_device *parent, u64 address, bool check_children); int acpi_is_root_bridge(acpi_handle); struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); int acpi_disable_wakeup_device_power(struct acpi_device *dev); #ifdef CONFIG_X86 bool acpi_device_always_present(struct acpi_device *adev); #else static inline bool acpi_device_always_present(struct acpi_device *adev) { return false; } #endif #ifdef CONFIG_PM void acpi_pm_wakeup_event(struct device *dev); acpi_status acpi_add_pm_notifier(struct acpi_device *adev, struct device *dev, void (*func)(struct acpi_device_wakeup_context *context)); acpi_status acpi_remove_pm_notifier(struct acpi_device *adev); bool acpi_pm_device_can_wakeup(struct device *dev); int acpi_pm_device_sleep_state(struct device *, int *, int); int acpi_pm_set_device_wakeup(struct device *dev, bool enable); int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable); #else static inline void acpi_pm_wakeup_event(struct device *dev) { } static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, struct device *dev, void (*func)(struct acpi_device_wakeup_context *context)) { return AE_SUPPORT; } static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev) { return AE_SUPPORT; } static inline bool acpi_pm_device_can_wakeup(struct device *dev) { return false; } static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m) { if (p) *p = ACPI_STATE_D0; return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ? m : ACPI_STATE_D0; } static inline int acpi_pm_set_device_wakeup(struct device *dev, bool enable) { return -ENODEV; } static inline int acpi_pm_set_bridge_wakeup(struct device *dev, bool enable) { return -ENODEV; } #endif #ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT bool acpi_sleep_state_supported(u8 sleep_state); #else static inline bool acpi_sleep_state_supported(u8 sleep_state) { return false; } #endif #ifdef CONFIG_ACPI_SLEEP u32 acpi_target_system_state(void); #else static inline u32 acpi_target_system_state(void) { return ACPI_STATE_S0; } #endif static inline bool acpi_device_power_manageable(struct acpi_device *adev) { return adev->flags.power_manageable; } static inline bool acpi_device_can_wakeup(struct acpi_device *adev) { return adev->wakeup.flags.valid; } static inline bool acpi_device_can_poweroff(struct acpi_device *adev) { return adev->power.states[ACPI_STATE_D3_COLD].flags.valid || ((acpi_gbl_FADT.header.revision < 6) && adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set); } bool acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2); struct acpi_device * acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv); static inline void acpi_dev_put(struct acpi_device *adev) { put_device(&adev->dev); } #else /* CONFIG_ACPI */ static inline int register_acpi_bus_type(void *bus) { return 0; } static inline int unregister_acpi_bus_type(void *bus) { return 0; } #endif /* CONFIG_ACPI */ #endif /*__ACPI_BUS_H__*/
c0d3z3r0/linux-rockchip
include/acpi/acpi_bus.h
C
gpl-2.0
19,445
[ 30522, 1013, 1008, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1016, 1012, 1014, 1011, 2030, 1011, 2101, 1008, 1013, 1013, 1008, 1008, 9353, 8197, 1035, 3902, 1012, 1044, 1011, 9353, 8197, 3902, 4062, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 strict"; exports.__esModule = true; var _typeof2 = require("babel-runtime/helpers/typeof"); var _typeof3 = _interopRequireDefault(_typeof2); var _keys = require("babel-runtime/core-js/object/keys"); var _keys2 = _interopRequireDefault(_keys); var _getIterator2 = require("babel-runtime/core-js/get-iterator"); var _getIterator3 = _interopRequireDefault(_getIterator2); exports.explode = explode; exports.verify = verify; exports.merge = merge; var _virtualTypes = require("./path/lib/virtual-types"); var virtualTypes = _interopRequireWildcard(_virtualTypes); var _babelMessages = require("babel-messages"); var messages = _interopRequireWildcard(_babelMessages); var _babelTypes = require("babel-types"); var t = _interopRequireWildcard(_babelTypes); var _clone = require("lodash/clone"); var _clone2 = _interopRequireDefault(_clone); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function explode(visitor) { if (visitor._exploded) return visitor; visitor._exploded = true; for (var nodeType in visitor) { if (shouldIgnoreKey(nodeType)) continue; var parts = nodeType.split("|"); if (parts.length === 1) continue; var fns = visitor[nodeType]; delete visitor[nodeType]; for (var _iterator = parts, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { var _ref; if (_isArray) { if (_i >= _iterator.length) break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; _ref = _i.value; } var part = _ref; visitor[part] = fns; } } verify(visitor); delete visitor.__esModule; ensureEntranceObjects(visitor); ensureCallbackArrays(visitor); for (var _iterator2 = (0, _keys2.default)(visitor), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) { var _ref2; if (_isArray2) { if (_i2 >= _iterator2.length) break; _ref2 = _iterator2[_i2++]; } else { _i2 = _iterator2.next(); if (_i2.done) break; _ref2 = _i2.value; } var _nodeType3 = _ref2; if (shouldIgnoreKey(_nodeType3)) continue; var wrapper = virtualTypes[_nodeType3]; if (!wrapper) continue; var _fns2 = visitor[_nodeType3]; for (var type in _fns2) { _fns2[type] = wrapCheck(wrapper, _fns2[type]); } delete visitor[_nodeType3]; if (wrapper.types) { for (var _iterator4 = wrapper.types, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) { var _ref4; if (_isArray4) { if (_i4 >= _iterator4.length) break; _ref4 = _iterator4[_i4++]; } else { _i4 = _iterator4.next(); if (_i4.done) break; _ref4 = _i4.value; } var _type = _ref4; if (visitor[_type]) { mergePair(visitor[_type], _fns2); } else { visitor[_type] = _fns2; } } } else { mergePair(visitor, _fns2); } } for (var _nodeType in visitor) { if (shouldIgnoreKey(_nodeType)) continue; var _fns = visitor[_nodeType]; var aliases = t.FLIPPED_ALIAS_KEYS[_nodeType]; var deprecratedKey = t.DEPRECATED_KEYS[_nodeType]; if (deprecratedKey) { console.trace("Visitor defined for " + _nodeType + " but it has been renamed to " + deprecratedKey); aliases = [deprecratedKey]; } if (!aliases) continue; delete visitor[_nodeType]; for (var _iterator3 = aliases, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) { var _ref3; if (_isArray3) { if (_i3 >= _iterator3.length) break; _ref3 = _iterator3[_i3++]; } else { _i3 = _iterator3.next(); if (_i3.done) break; _ref3 = _i3.value; } var alias = _ref3; var existing = visitor[alias]; if (existing) { mergePair(existing, _fns); } else { visitor[alias] = (0, _clone2.default)(_fns); } } } for (var _nodeType2 in visitor) { if (shouldIgnoreKey(_nodeType2)) continue; ensureCallbackArrays(visitor[_nodeType2]); } return visitor; } function verify(visitor) { if (visitor._verified) return; if (typeof visitor === "function") { throw new Error(messages.get("traverseVerifyRootFunction")); } for (var nodeType in visitor) { if (nodeType === "enter" || nodeType === "exit") { validateVisitorMethods(nodeType, visitor[nodeType]); } if (shouldIgnoreKey(nodeType)) continue; if (t.TYPES.indexOf(nodeType) < 0) { throw new Error(messages.get("traverseVerifyNodeType", nodeType)); } var visitors = visitor[nodeType]; if ((typeof visitors === "undefined" ? "undefined" : (0, _typeof3.default)(visitors)) === "object") { for (var visitorKey in visitors) { if (visitorKey === "enter" || visitorKey === "exit") { validateVisitorMethods(nodeType + "." + visitorKey, visitors[visitorKey]); } else { throw new Error(messages.get("traverseVerifyVisitorProperty", nodeType, visitorKey)); } } } } visitor._verified = true; } function validateVisitorMethods(path, val) { var fns = [].concat(val); for (var _iterator5 = fns, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) { var _ref5; if (_isArray5) { if (_i5 >= _iterator5.length) break; _ref5 = _iterator5[_i5++]; } else { _i5 = _iterator5.next(); if (_i5.done) break; _ref5 = _i5.value; } var fn = _ref5; if (typeof fn !== "function") { throw new TypeError("Non-function found defined in " + path + " with type " + (typeof fn === "undefined" ? "undefined" : (0, _typeof3.default)(fn))); } } } function merge(visitors) { var states = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; var wrapper = arguments[2]; var rootVisitor = {}; for (var i = 0; i < visitors.length; i++) { var visitor = visitors[i]; var state = states[i]; explode(visitor); for (var type in visitor) { var visitorType = visitor[type]; if (state || wrapper) { visitorType = wrapWithStateOrWrapper(visitorType, state, wrapper); } var nodeVisitor = rootVisitor[type] = rootVisitor[type] || {}; mergePair(nodeVisitor, visitorType); } } return rootVisitor; } function wrapWithStateOrWrapper(oldVisitor, state, wrapper) { var newVisitor = {}; var _loop = function _loop(key) { var fns = oldVisitor[key]; if (!Array.isArray(fns)) return "continue"; fns = fns.map(function (fn) { var newFn = fn; if (state) { newFn = function newFn(path) { return fn.call(state, path, state); }; } if (wrapper) { newFn = wrapper(state.key, key, newFn); } return newFn; }); newVisitor[key] = fns; }; for (var key in oldVisitor) { var _ret = _loop(key); if (_ret === "continue") continue; } return newVisitor; } function ensureEntranceObjects(obj) { for (var key in obj) { if (shouldIgnoreKey(key)) continue; var fns = obj[key]; if (typeof fns === "function") { obj[key] = { enter: fns }; } } } function ensureCallbackArrays(obj) { if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter]; if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit]; } function wrapCheck(wrapper, fn) { var newFn = function newFn(path) { if (wrapper.checkPath(path)) { return fn.apply(this, arguments); } }; newFn.toString = function () { return fn.toString(); }; return newFn; } function shouldIgnoreKey(key) { if (key[0] === "_") return true; if (key === "enter" || key === "exit" || key === "shouldSkip") return true; if (key === "blacklist" || key === "noScope" || key === "skipKeys") return true; return false; } function mergePair(dest, src) { for (var key in src) { dest[key] = [].concat(dest[key] || [], src[key]); } }
jintoppy/react-training
step8-unittest/node_modules/babel-plugin-transform-decorators/node_modules/babel-traverse/lib/visitors.js
JavaScript
mit
8,665
[ 30522, 1000, 2224, 9384, 1000, 1025, 14338, 1012, 1035, 1035, 9686, 5302, 8566, 2571, 1027, 2995, 1025, 13075, 1035, 2828, 11253, 2475, 1027, 5478, 1006, 1000, 11561, 2140, 1011, 2448, 7292, 1013, 2393, 2545, 1013, 2828, 11253, 1000, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
----------------------------------- -- Base Item Shop ----------------------------------- function onTrigger(player,npc) player:PrintToPlayer("Please buy your Dynamis currency dupe base item, then trade it to me."); player:PrintToPlayer("Red (A) = San d'Oria/coins! Blue (Z) = Bastok/bills! Green (C) = Windurst/shells!"); player:PrintToPlayer("I = singles, II = hundreds, III = ten-thousand pieces."); stock = {0x1785,1, --A. Ygg. Shard I 0x1786,1, --A. Ygg. Shard II 0x1787,1, --A. Ygg. Shard III 0x1780,1, --Z. Ygg. Shard I 0x1781,1, --Z. Ygg. Shard II 0x1782,1, --Z. Ygg. Shard III 0x177B,1, --C. Ygg. Shard I 0x177C,1, --C. Ygg. Shard II 0x177D,1, --C. Ygg. Shard III } showShop(player, STATIC, stock); end; ----------------------------------- -- Currency ID Declaration ----------------------------------- rcurrency = { ["coins"] = 0, ["bills"] = 1, ["shells"] = 2, } ----------------------------------- -- Item Values Table ----------------------------------- rewardItem = { ----------------------------------- -- Dynamis Dupe Rewards Table ----------------------------------- -- Reward, Base, Cost, Currency Type-- 1, { 1452 , 6021 , 1 , 0 }, -- Reward: Bronzepiece *** Base: A. Ygg. Shard I 2, { 1453 , 6022 , 100 , 0 }, -- Reward: Silverpiece *** Base: A. Ygg. Shard II 3, { 1454 , 6023 , 10000 , 0 }, -- Reward: Goldpiece *** Base: A. Ygg. Shard III 4, { 1455 , 6016 , 1 , 1 }, -- Reward: One Byne *** Base: Z. Ygg. Shard I 5, { 1456 , 6017 , 100 , 1 }, -- Reward: 100 Byne *** Base: Z. Ygg. Shard II 6, { 1457 , 6018 , 10000 , 1 }, -- Reward: 10,000 Byne *** Base: Z. Ygg. Shard III 7, { 1449 , 6011 , 1 , 2 }, -- Reward: Whiteshell *** Base: C. Ygg. Shard I 8, { 1450 , 6012 , 100 , 2 }, -- Reward: Jadeshell *** Base: C. Ygg. Shard II 9, { 1451 , 6013 , 10000 , 2 }, -- Reward: Stripeshell *** Base: C. Ygg. Shard III }; function rewardTrade(player,npc,trade) local totalCoins = player:getCurrency("chocobuck_sandoria"); local totalBills = player:getCurrency("chocobuck_bastok"); local totalShells = player:getCurrency("chocobuck_windurst"); if (trade:getItemCount() == 1) then for nb = 2, table.getn(rewardItem), 2 do if trade:hasItemQty(rewardItem[nb][2],1) then -- Check to make sure that the trade has a base item that is in the table. cost = rewardItem[nb][3]; -- Pulls in the Cost of the Item. cType = rewardItem[nb][4]; -- Pulls in the value for Currency. rItem = rewardItem[nb][1]; -- Set Reward Item to Variable for Easier Handling. bItem = rewardItem[nb][2]; -- Set Base Item to Variable for Easier Handling. if (player:getFreeSlotsCount() == 0) then -- Check Inventory to see if 0 spaces are available. player:messageSpecial(ITEM_CANNOT_BE_OBTTAINED,rItem,1); -- Let them know they need to sort their inventory. end if (player:getFreeSlotsCount() ~= 0) and (player:hasItem(rItem) == true) then -- Check Inventory for space and if they have the reward already. player:addItem(rItem,1); -- Add item if they have it, to get the "Only Own One" Dialogue and no currency deduction. end if (player:hasItem(rItem) == false) then -- If they do not own the item, continue the script. if (cType == rcurrency.coins) and (cost <= totalCoins) then -- Check to make sure that you have enough currency. player:addItem(rItem,1); -- Grant the reward. player:delCurrency("chocobuck_sandoria",cost); -- Deduct Currency player:messageSpecial(ITEM_OBTAINED,rItem,1); -- Item Obtained Message player:delItem(bItem,1); -- Delete base item. elseif (cType == rcurrency.coins) and (cost > totalCoins) then -- Logic for if they don't have enough currency. player:PrintToPlayer("You do not have enough Chocobucks!"); -- Let them know they need more of the specified currency. elseif (cType == rcurrency.bills) and (cost <= totalBills) then -- Check to make sure that you have enough currency. player:addItem(rItem,1); -- Grant the reward. player:delCurrency("chocobuck_bastok",cost); -- Deduct Currency player:messageSpecial(ITEM_OBTAINED,rItem,1); -- Item Obtained Message player:delItem(bItem,1); -- Delete base item. elseif (cType == rcurrency.bills) and (cost > totalBills) then -- Logic for if they don't have enough currency. player:PrintToPlayer("You do not have enough Chocobucks!"); -- Let them know they need more of the specified currency. elseif (cType == rcurrency.shells) and (cost <= totalShells) then -- Check to make sure that you have enough currency. player:addItem(rItem,1); -- Grant the reward. player:delCurrency("chocobuck_windurst",cost); -- Deduct Currency player:messageSpecial(ITEM_OBTAINED,rItem,1); -- Item Obtained Message player:delItem(bItem,1); -- Delete base item. elseif (cType == rcurrency.shells) and (cost > totalShells) then -- Logic for if they don't have enough currency. player:PrintToPlayer("You do not have enough Chocobucks!"); -- Let them know they need more of the specified currency. end end end end end end;
Fenix-XI/Fenix
scripts/zones/Provenance/npcs/Dyna.lua
Lua
gpl-3.0
7,285
[ 30522, 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, 1011, 1011, 1011, 1011, 2918, 887...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
/* $Id: sportster.c,v 1.16.2.4 2004/01/13 23:48:39 keil Exp $ * * low level stuff for USR Sportster internal TA * * Author Karsten Keil * Copyright by Karsten Keil <keil@isdn4linux.de> * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * * Thanks to Christian "naddy" Weisgerber (3Com, US Robotics) for documentation * * */ #include <linux/init.h> #include "hisax.h" #include "isac.h" #include "hscx.h" #include "isdnl1.h" static const char *sportster_revision = "$Revision: 1.16.2.4 $"; #define byteout(addr, val) outb(val, addr) #define bytein(addr) inb(addr) #define SPORTSTER_ISAC 0xC000 #define SPORTSTER_HSCXA 0x0000 #define SPORTSTER_HSCXB 0x4000 #define SPORTSTER_RES_IRQ 0x8000 #define SPORTSTER_RESET 0x80 #define SPORTSTER_INTE 0x40 static inline int calc_off(unsigned int base, unsigned int off) { return (base + ((off & 0xfc) << 8) + ((off & 3) << 1)); } static inline void read_fifo(unsigned int adr, u_char *data, int size) { insb(adr, data, size); } static void write_fifo(unsigned int adr, u_char *data, int size) { outsb(adr, data, size); } /* Interface functions */ static u_char ReadISAC(struct IsdnCardState *cs, u_char offset) { return (bytein(calc_off(cs->hw.spt.isac, offset))); } static void WriteISAC(struct IsdnCardState *cs, u_char offset, u_char value) { byteout(calc_off(cs->hw.spt.isac, offset), value); } static void ReadISACfifo(struct IsdnCardState *cs, u_char *data, int size) { read_fifo(cs->hw.spt.isac, data, size); } static void WriteISACfifo(struct IsdnCardState *cs, u_char *data, int size) { write_fifo(cs->hw.spt.isac, data, size); } static u_char ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) { return (bytein(calc_off(cs->hw.spt.hscx[hscx], offset))); } static void WriteHSCX(struct IsdnCardState *cs, int hscx, u_char offset, u_char value) { byteout(calc_off(cs->hw.spt.hscx[hscx], offset), value); } /* * fast interrupt HSCX stuff goes here */ #define READHSCX(cs, nr, reg) bytein(calc_off(cs->hw.spt.hscx[nr], reg)) #define WRITEHSCX(cs, nr, reg, data) byteout(calc_off(cs->hw.spt.hscx[nr], reg), data) #define READHSCXFIFO(cs, nr, ptr, cnt) read_fifo(cs->hw.spt.hscx[nr], ptr, cnt) #define WRITEHSCXFIFO(cs, nr, ptr, cnt) write_fifo(cs->hw.spt.hscx[nr], ptr, cnt) #include "hscx_irq.c" static irqreturn_t sportster_interrupt(int intno, void *dev_id) { struct IsdnCardState *cs = dev_id; u_char val; u_long flags; spin_lock_irqsave(&cs->lock, flags); val = READHSCX(cs, 1, HSCX_ISTA); Start_HSCX: if (val) hscx_int_main(cs, val); val = ReadISAC(cs, ISAC_ISTA); Start_ISAC: if (val) isac_interrupt(cs, val); val = READHSCX(cs, 1, HSCX_ISTA); if (val) { if (cs->debug & L1_DEB_HSCX) debugl1(cs, "HSCX IntStat after IntRoutine"); goto Start_HSCX; } val = ReadISAC(cs, ISAC_ISTA); if (val) { if (cs->debug & L1_DEB_ISAC) debugl1(cs, "ISAC IntStat after IntRoutine"); goto Start_ISAC; } /* get a new irq impulse if there any pending */ bytein(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ + 1); spin_unlock_irqrestore(&cs->lock, flags); return IRQ_HANDLED; } static void release_io_sportster(struct IsdnCardState *cs) { int i, adr; byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, 0); for (i = 0; i < 64; i++) { adr = cs->hw.spt.cfg_reg + i * 1024; release_region(adr, 8); } } static void reset_sportster(struct IsdnCardState *cs) { cs->hw.spt.res_irq |= SPORTSTER_RESET; /* Reset On */ byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, cs->hw.spt.res_irq); mdelay(10); cs->hw.spt.res_irq &= ~SPORTSTER_RESET; /* Reset Off */ byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, cs->hw.spt.res_irq); mdelay(10); } static int Sportster_card_msg(struct IsdnCardState *cs, int mt, void *arg) { u_long flags; switch (mt) { case CARD_RESET: spin_lock_irqsave(&cs->lock, flags); reset_sportster(cs); spin_unlock_irqrestore(&cs->lock, flags); return (0); case CARD_RELEASE: release_io_sportster(cs); return (0); case CARD_INIT: spin_lock_irqsave(&cs->lock, flags); reset_sportster(cs); inithscxisac(cs, 1); cs->hw.spt.res_irq |= SPORTSTER_INTE; /* IRQ On */ byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, cs->hw.spt.res_irq); inithscxisac(cs, 2); spin_unlock_irqrestore(&cs->lock, flags); return (0); case CARD_TEST: return (0); } return (0); } static int __devinit get_io_range(struct IsdnCardState *cs) { int i, j, adr; for (i = 0; i < 64; i++) { adr = cs->hw.spt.cfg_reg + i * 1024; if (!request_region(adr, 8, "sportster")) { printk(KERN_WARNING "HiSax: USR Sportster config port " "%x-%x already in use\n", adr, adr + 8); break; } } if (i == 64) return (1); else { for (j = 0; j < i; j++) { adr = cs->hw.spt.cfg_reg + j * 1024; release_region(adr, 8); } return (0); } } int __devinit setup_sportster(struct IsdnCard *card) { struct IsdnCardState *cs = card->cs; char tmp[64]; strcpy(tmp, sportster_revision); printk(KERN_INFO "HiSax: USR Sportster driver Rev. %s\n", HiSax_getrev(tmp)); if (cs->typ != ISDN_CTYPE_SPORTSTER) return (0); cs->hw.spt.cfg_reg = card->para[1]; cs->irq = card->para[0]; if (!get_io_range(cs)) return (0); cs->hw.spt.isac = cs->hw.spt.cfg_reg + SPORTSTER_ISAC; cs->hw.spt.hscx[0] = cs->hw.spt.cfg_reg + SPORTSTER_HSCXA; cs->hw.spt.hscx[1] = cs->hw.spt.cfg_reg + SPORTSTER_HSCXB; switch (cs->irq) { case 5: cs->hw.spt.res_irq = 1; break; case 7: cs->hw.spt.res_irq = 2; break; case 10:cs->hw.spt.res_irq = 3; break; case 11:cs->hw.spt.res_irq = 4; break; case 12:cs->hw.spt.res_irq = 5; break; case 14:cs->hw.spt.res_irq = 6; break; case 15:cs->hw.spt.res_irq = 7; break; default:release_io_sportster(cs); printk(KERN_WARNING "Sportster: wrong IRQ\n"); return (0); } printk(KERN_INFO "HiSax: USR Sportster config irq:%d cfg:0x%X\n", cs->irq, cs->hw.spt.cfg_reg); setup_isac(cs); cs->readisac = &ReadISAC; cs->writeisac = &WriteISAC; cs->readisacfifo = &ReadISACfifo; cs->writeisacfifo = &WriteISACfifo; cs->BC_Read_Reg = &ReadHSCX; cs->BC_Write_Reg = &WriteHSCX; cs->BC_Send_Data = &hscx_fill_fifo; cs->cardmsg = &Sportster_card_msg; cs->irq_func = &sportster_interrupt; ISACVersion(cs, "Sportster:"); if (HscxVersion(cs, "Sportster:")) { printk(KERN_WARNING "Sportster: wrong HSCX versions check IO address\n"); release_io_sportster(cs); return (0); } return (1); }
talnoah/android_kernel_htc_dlx
virt/drivers/isdn/hisax/sportster.c
C
gpl-2.0
6,518
[ 30522, 1013, 1008, 1002, 8909, 1024, 2998, 3334, 1012, 1039, 1010, 1058, 1015, 1012, 2385, 1012, 1016, 1012, 1018, 2432, 1013, 5890, 1013, 2410, 2603, 1024, 4466, 1024, 4464, 26679, 2140, 4654, 2361, 1002, 1008, 1008, 2659, 2504, 4933, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <title>Blog Post Template for Bootstrap 3</title> <!-- Bootstrap core CSS --> <link href="css/bootstrap.css" rel="stylesheet"> <!-- Add custom CSS here --> <link href="css/blog-post.css" rel="stylesheet"> </head> <body> <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.php">Start Bootstrap</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse navbar-ex1-collapse"> <ul class="nav navbar-nav"> <li><a href="#about">About</a> </li> <li><a href="#services">Services</a> </li> <li><a href="#contact">Contact</a> </li> </ul> </div> <!-- /.navbar-collapse --> </div> <!-- /.container --> </nav> <div class="container"> <div class="row"> <div class="col-lg-8"> <!-- the actual blog post: title/author/date/content --> <h1>A Simple Blog Template for Bootstrap 3</h1> <p class="lead">by <a href="index.php">Start Bootstrap</a> </p> <hr> <p> <span class="glyphicon glyphicon-time"></span> Posted on August 24, 2013 at 9:00 PM</p> <hr> <img src="http://placehold.it/900x300" class="img-responsive"> <hr> <p class="lead">Science cuts two ways, of course; its products can be used for both good and evil. But there's no turning back from science. The early warnings about technological dangers also come from science.</p> <p>You know, being a test pilot isn't always the healthiest business in the world.</p> <p>Cookie jelly beans soufflé icing. Gummi bears tootsie roll powder chupa chups cheesecake chocolate jelly-o lollipop lollipop. Halvah applicake chupa chups. Marshmallow chocolate jujubes icing lollipop gummi bears chupa chups pudding bonbon. Jelly beans jelly soufflé jujubes. Sesame snaps lollipop icing donut lemon drops soufflé.</p> <p>Donut caramels gingerbread. Sweet roll macaroon pastry cotton candy oat cake sesame snaps biscuit lemon drops dessert. Candy canes carrot cake danish carrot cake soufflé jelly chocolate cake muffin. Topping brownie donut. Oat cake marzipan dragée cheesecake. Donut chocolate cake jujubes tart dragée toffee.</p> <p>Tilefish electric knifefish salmon shark southern Dolly Varden. Pacific argentine tope golden shiner ilisha barreleye loosejaw catla, dogteeth tetra catfish tenpounder nase scup Ragfish brotula." Codlet brook lamprey pleco, Japanese eel convict cichlid titan triggerfish, plownose chimaera topminnow Black scalyfin. Walleye pollock, blue shark Sacramento blackfish prickleback airbreathing catfish yellowfin cutthroat trout, goby southern sandfish. North Pacific daggertooth dorab cepalin weever flying gurnard.</p> <p><strong>Placeholder text by:</strong> </p> <ul> <li><a href="http://spaceipsum.com/">Space Ipsum</a> </li> <li><a href="http://cupcakeipsum.com/">Cupcake Ipsum</a> </li> <li><a href="http://tunaipsum.com/">Tuna Ipsum</a> </li> </ul> <hr> <!-- the comment box --> <div class="well"> <h4>Leave a Comment:</h4> <form role="form"> <div class="form-group"> <textarea class="form-control" rows="3"></textarea> </div> <button type="submit" class="btn btn-primary">Submit</button> </form> </div> <hr> <!-- the comments --> <h3>Start Bootstrap <small>9:41 PM on August 24, 2013</small> </h3> <p>This has to be the worst blog post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names.</p> <h3>Start Bootstrap <small>9:47 PM on August 24, 2013</small> </h3> <p>Don't listen to this guy, any blog with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.</p> </div> <div class="col-lg-4"> <div class="well"> <h4>Blog Search</h4> <div class="input-group"> <input type="text" class="form-control"> <span class="input-group-btn"> <button class="btn btn-default" type="button"> <span class="glyphicon glyphicon-search"></span> </button> </span> </div> <!-- /input-group --> </div> <!-- /well --> <div class="well"> <h4>Popular Blog Categories</h4> <div class="row"> <div class="col-lg-6"> <ul class="list-unstyled"> <li><a href="#dinosaurs">Dinosaurs</a> </li> <li><a href="#spaceships">Spaceships</a> </li> <li><a href="#fried-foods">Fried Foods</a> </li> <li><a href="#wild-animals">Wild Animals</a> </li> </ul> </div> <div class="col-lg-6"> <ul class="list-unstyled"> <li><a href="#alien-abductions">Alien Abductions</a> </li> <li><a href="#business-casual">Business Casual</a> </li> <li><a href="#robots">Robots</a> </li> <li><a href="#fireworks">Fireworks</a> </li> </ul> </div> </div> </div> <!-- /well --> <div class="well"> <h4>Side Widget Well</h4> <p>Bootstrap's default wells work great for side widgets! What is a widget anyways...?</p> </div> <!-- /well --> </div> </div> <hr> <footer> <div class="row"> <div class="col-lg-12"> <p>Copyright &copy; Company 2013</p> </div> </div> </footer> </div> <!-- /.container --> <!-- JavaScript --> <script src="js/jquery-1.10.2.js"></script> <script src="js/bootstrap.js"></script> </body> </html>
vic3t3chn0/templates_opensource
ruby/website/output/blog/index.html
HTML
mit
8,220
[ 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, 18804, 2171, 1027, 1000, 3193, 6442, 1000, 418...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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) 2013-2014 Thomas Müller * * 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. * * @category WurflCache * * @copyright 2013-2014 Thomas Müller * @license http://www.opensource.org/licenses/MIT MIT License * * @link https://github.com/mimmi20/WurflCache/ */ namespace WurflCache\Adapter; /** * generic Adapter Exception * * @category WurflCache * * @author Thomas Müller <t_mueller_stolzenhain@yahoo.de> * @copyright 2013-2014 Thomas Müller * @license http://www.opensource.org/licenses/MIT MIT License * * @link https://github.com/mimmi20/WurflCache/ */ class Exception extends \WurflCache\Exception { // nothing to do here }
mimmi20/WurflCache
src/Adapter/Exception.php
PHP
mit
1,729
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 9385, 1006, 1039, 1007, 2286, 1011, 2297, 2726, 12304, 1008, 1008, 6656, 2003, 2182, 3762, 4379, 1010, 2489, 1997, 3715, 1010, 2000, 2151, 2711, 11381, 1037, 1008, 6100, 1997, 2023, 4007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
# aaronwest.github.io A simple website using [Jekyll](http://jekyllrb.com) + [GitHub Pages](https://pages.github.com). Designed to function as a basic engineering notebook to jot down thoughts and ideas. To view the website visit [notebook.aaronwest.net](http://notebook.aaronwest.net).
aaronwest/aaronwest.github.io
README.md
Markdown
mit
289
[ 30522, 1001, 7158, 19650, 1012, 21025, 2705, 12083, 1012, 22834, 1037, 3722, 4037, 2478, 1031, 15333, 4801, 3363, 1033, 1006, 8299, 1024, 1013, 1013, 15333, 4801, 3363, 15185, 1012, 4012, 1007, 1009, 1031, 21025, 2705, 12083, 5530, 1033, 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...
package spider.cli import command._ import spider.Util.errorExit import com.typesafe.scalalogging.Logger object CLI { lazy val logger = Logger("spider.cli") def go(args: Array[String]): Unit = args.toSeq match { case e if args.isEmpty ⇒ Help(args) case "scrape" +: tail ⇒ Scrape(tail) case "wait" +: tail ⇒ Wait(tail) case "help" +: tail ⇒ Help(tail) case "remove" +: tail ⇒ Remove(tail) case "getcat" +: tail ⇒ GetCategory(tail) case other +: tail ⇒ errorExit(s"unknown command $other") } }
VinaLx/farm-spider
src/main/scala/spider/cli/cli.scala
Scala
mit
544
[ 30522, 7427, 6804, 1012, 18856, 2072, 12324, 3094, 1012, 1035, 12324, 6804, 1012, 21183, 4014, 1012, 7561, 10288, 4183, 12324, 4012, 1012, 4127, 10354, 2063, 1012, 26743, 21197, 4726, 1012, 8833, 4590, 4874, 18856, 2072, 1063, 13971, 11748, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 code contains NVIDIA Confidential Information and is disclosed to you // under a form of NVIDIA software license agreement provided separately to you. // // Notice // NVIDIA Corporation and its licensors retain all intellectual property and // proprietary rights in and to this software and related documentation and // any modifications thereto. Any use, reproduction, disclosure, or // distribution of this software and related documentation without an express // license agreement from NVIDIA Corporation is strictly prohibited. // // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. // // Information and code furnished is believed to be accurate and reliable. // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such // information or for any infringement of patents or other rights of third parties that may // result from its use. No license is granted by implication or otherwise under any patent // or patent rights of NVIDIA Corporation. Details are subject to change without notice. // This code supersedes and replaces all information previously supplied. // NVIDIA Corporation products are not authorized for use as critical // components in life support devices or systems without express written approval of // NVIDIA Corporation. // // Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. #ifndef PXPVDSDK_PXPVDMEMCLIENT_H #define PXPVDSDK_PXPVDMEMCLIENT_H #include "PxPvdClient.h" #include "PsHashMap.h" #include "PsMutex.h" #include "PsBroadcast.h" #include "PxProfileEventBufferClient.h" #include "PxProfileMemory.h" namespace physx { class PvdDataStream; namespace pvdsdk { class PvdImpl; class PvdMemClient : public PvdClient, public profile::PxProfileEventBufferClient, public shdfnd::UserAllocated { PX_NOCOPY(PvdMemClient) public: PvdMemClient(PvdImpl& pvd); virtual ~PvdMemClient(); bool isConnected() const; void onPvdConnected(); void onPvdDisconnected(); void flush(); PvdDataStream* getDataStream(); PvdUserRenderer* getUserRender(); // memory event void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory); void onDeallocation(void* addr); private: PvdImpl& mSDKPvd; PvdDataStream* mPvdDataStream; bool mIsConnected; // mem profile shdfnd::Mutex mMutex; // mem onallocation can called from different threads profile::PxProfileMemoryEventBuffer& mMemEventBuffer; void handleBufferFlush(const uint8_t* inData, uint32_t inLength); void handleClientRemoved(); }; } // namespace pvdsdk } // namespace physx #endif // PXPVDSDK_PXPVDMEMCLIENT_H
Bang3DEngine/Bang
Compile/CompileDependencies/ThirdParty/PhysX/PxShared/src/pvd/src/PxPvdMemClient.h
C
lgpl-3.0
3,051
[ 30522, 30524, 2592, 1998, 2003, 21362, 2000, 2017, 1013, 1013, 2104, 1037, 2433, 1997, 1050, 17258, 2401, 4007, 6105, 3820, 3024, 10329, 2000, 2017, 1012, 1013, 1013, 1013, 1013, 5060, 1013, 1013, 1050, 17258, 2401, 3840, 1998, 2049, 5622, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Save current context</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ps-rotate.html">ps_rotate</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ps-scale.html">ps_scale</a></div> <div class="up"><a href="ref.ps.html">PS Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.ps-save" class="refentry"> <div class="refnamediv"> <h1 class="refname">ps_save</h1> <p class="verinfo">(PECL ps &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">ps_save</span> &mdash; <span class="dc-title">Save current context</span></p> </div> <div class="refsect1 description" id="refsect1-function.ps-save-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>ps_save</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$psdoc</code></span> )</div> <p class="para rdfs-comment"> Saves the current graphics context, containing colors, translation and rotation settings and some more. A saved context can be restored with <span class="function"><a href="function.ps-restore.html" class="function">ps_restore()</a></span>. </p> </div> <div class="refsect1 parameters" id="refsect1-function.ps-save-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">psdoc</code></em></span> <dd> <p class="para"> Resource identifier of the postscript file as returned by <span class="function"><a href="function.ps-new.html" class="function">ps_new()</a></span>. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.ps-save-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 seealso" id="refsect1-function.ps-save-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="function"><a href="function.ps-restore.html" class="function" rel="rdfs-seeAlso">ps_restore()</a> - Restore previously save context</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ps-rotate.html">ps_rotate</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ps-scale.html">ps_scale</a></div> <div class="up"><a href="ref.ps.html">PS Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>
Sliim/sleemacs
php-manual/function.ps-save.html
HTML
gpl-3.0
3,159
[ 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...
/* * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. */ #ifndef FocusController_h #define FocusController_h #include "core/page/FocusDirection.h" #include "core/platform/graphics/LayoutRect.h" #include "wtf/Forward.h" #include "wtf/Noncopyable.h" #include "wtf/RefPtr.h" namespace WebCore { struct FocusCandidate; class Document; class Element; class Frame; class HTMLFrameOwnerElement; class IntRect; class KeyboardEvent; class Node; class Page; class TreeScope; class FocusNavigationScope { public: Node* rootNode() const; Element* owner() const; static FocusNavigationScope focusNavigationScopeOf(Node*); static FocusNavigationScope focusNavigationScopeOwnedByShadowHost(Node*); static FocusNavigationScope focusNavigationScopeOwnedByIFrame(HTMLFrameOwnerElement*); private: explicit FocusNavigationScope(TreeScope*); TreeScope* m_rootTreeScope; }; class FocusController { WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<FocusController> create(Page*); void setFocusedFrame(PassRefPtr<Frame>); Frame* focusedFrame() const { return m_focusedFrame.get(); } Frame* focusedOrMainFrame() const; bool setInitialFocus(FocusDirection); bool advanceFocus(FocusDirection direction) { return advanceFocus(direction, false); } bool setFocusedElement(Element*, PassRefPtr<Frame>, FocusDirection = FocusDirectionNone); void setActive(bool); bool isActive() const { return m_isActive; } void setFocused(bool); bool isFocused() const { return m_isFocused; } void setContainingWindowIsVisible(bool); bool containingWindowIsVisible() const { return m_containingWindowIsVisible; } private: explicit FocusController(Page*); bool advanceFocus(FocusDirection, bool initialFocus); bool advanceFocusDirectionally(FocusDirection); bool advanceFocusInDocumentOrder(FocusDirection, bool initialFocus); Node* findFocusableNodeAcrossFocusScope(FocusDirection, FocusNavigationScope startScope, Node* start); Node* findFocusableNodeRecursively(FocusDirection, FocusNavigationScope, Node* start); Node* findFocusableNodeDecendingDownIntoFrameDocument(FocusDirection, Node*); // Searches through the given tree scope, starting from start node, for the next/previous selectable element that comes after/before start node. // The order followed is as specified in section 17.11.1 of the HTML4 spec, which is elements with tab indexes // first (from lowest to highest), and then elements without tab indexes (in document order). // // @param start The node from which to start searching. The node after this will be focused. May be null. // // @return The focus node that comes after/before start node. // // See http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1 inline Node* findFocusableNode(FocusDirection, FocusNavigationScope, Node* start); Node* nextFocusableNode(FocusNavigationScope, Node* start); Node* previousFocusableNode(FocusNavigationScope, Node* start); Node* findNodeWithExactTabIndex(Node* start, int tabIndex, FocusDirection); bool advanceFocusDirectionallyInContainer(Node* container, const LayoutRect& startingRect, FocusDirection); void findFocusCandidateInContainer(Node* container, const LayoutRect& startingRect, FocusDirection, FocusCandidate& closest); Page* m_page; RefPtr<Frame> m_focusedFrame; bool m_isActive; bool m_isFocused; bool m_isChangingFocusedFrame; bool m_containingWindowIsVisible; }; } // namespace WebCore #endif // FocusController_h
indashnet/InDashNet.Open.UN2000
android/external/chromium_org/third_party/WebKit/Source/core/page/FocusController.h
C
apache-2.0
4,915
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2294, 1010, 2289, 6207, 4297, 1012, 2035, 2916, 9235, 1012, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 1998, 12441, 3596, 1010, 2007, 2030, 2302, 1008, 14080, 1010, 2024, 7936, 3024, 2008, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ define('LOG5PHP_DIR', dirname(__FILE__).'/../../main/php'); define('LOG5PHP_LINE_SEP', "\n"); define('LOG5PHP_CONFIGURATION', dirname(__FILE__).'/ndc.xml'); require_once LOG5PHP_DIR . '/autoload.inc.php'; spl_autoload_register('Log5PHP_autoload'); Log5PHP_NDC::push('Context Message'); $logger = Log5PHP_Manager::getRootLogger(); $logger->debug("Testing NDC"); Log5PHP_NDC::pop(); ?>
teamlazerbeez/PHP
Log5PHP/src/examples/php/ndc.php
PHP
apache-2.0
1,201
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 2030, 2062, 1008, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 5500, 2007, 1008, 2023, 2147, 2005, 3176, 2592, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 1998-2015 Epic Games, Inc. All Rights Reserved. #include "EnginePrivate.h" #include "PhysicsPublic.h" #include "SkeletalRender.h" #include "SkeletalRenderPublic.h" #include "MessageLog.h" #include "CollisionDebugDrawingPublic.h" #if WITH_PHYSX #include "PhysicsEngine/PhysXSupport.h" #include "Collision/PhysXCollision.h" #endif #include "Collision/CollisionDebugDrawing.h" #if WITH_APEX #include "NxParamUtils.h" #include "NxApex.h" #if WITH_APEX_CLOTHING #include "NxClothingAsset.h" #include "NxClothingActor.h" #include "NxClothingCollision.h" // for cloth morph target #include "Animation/VertexAnim/VertexAnimBase.h" #include "Animation/VertexAnim/MorphTarget.h" #endif// #if WITH_APEX_CLOTHING #endif//#if WITH_APEX #include "PhysicsEngine/PhysicsConstraintTemplate.h" #include "PhysicsEngine/PhysicsAsset.h" #define LOCTEXT_NAMESPACE "SkeletalMeshComponentPhysics" extern TAutoConsoleVariable<int32> CVarEnableClothPhysics; void FSkeletalMeshComponentPreClothTickFunction::ExecuteTick(float DeltaTime, enum ELevelTick TickType, ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent) { QUICK_SCOPE_CYCLE_COUNTER(FSkeletalMeshComponentPreClothTickFunction_ExecuteTick); if ((TickType == LEVELTICK_All) && Target && !Target->HasAnyFlags(RF_PendingKill | RF_Unreachable)) { Target->PreClothTick(DeltaTime, *this); } } FString FSkeletalMeshComponentPreClothTickFunction::DiagnosticMessage() { return TEXT("FSkeletalMeshComponentPreClothTickFunction"); } #if WITH_APEX_CLOTHING // // FClothingActor // void FClothingActor::Clear(bool bReleaseResource) { if(bReleaseResource) { GPhysCommandHandler->DeferredRelease(ApexClothingActor); } ParentClothingAsset = NULL; ApexClothingActor = NULL; } // // USkeletalMesh methods for clothing // void USkeletalMesh::LoadClothCollisionVolumes(int32 AssetIndex, NxClothingAsset* ApexClothingAsset) { if(AssetIndex >= ClothingAssets.Num()) { return; } FClothingAssetData& Asset = ClothingAssets[AssetIndex]; check(ApexClothingAsset); const NxParameterized::Interface* AssetParams = ApexClothingAsset->getAssetNxParameterized(); // load bone actors physx::PxI32 NumBoneActors; verify(NxParameterized::getParamArraySize(*AssetParams, "boneActors", NumBoneActors)); // convexes are constructed with bone vertices physx::PxI32 NumBoneVertices; verify(NxParameterized::getParamArraySize(*AssetParams, "boneVertices", NumBoneVertices)); Asset.ClothCollisionVolumes.Empty(NumBoneActors); char ParameterName[MAX_SPRINTF]; for(int32 i=0; i<NumBoneActors; i++) { FApexClothCollisionVolumeData& CollisionData = Asset.ClothCollisionVolumes[Asset.ClothCollisionVolumes.AddZeroed()]; FCStringAnsi::Sprintf(ParameterName, "boneActors[%d].boneIndex", i); verify(NxParameterized::getParamI32(*AssetParams, ParameterName, CollisionData.BoneIndex)); FCStringAnsi::Sprintf(ParameterName, "boneActors[%d].convexVerticesCount", i); verify(NxParameterized::getParamU32(*AssetParams, ParameterName, CollisionData.ConvexVerticesCount)); if(CollisionData.ConvexVerticesCount > 0) { CollisionData.BoneVertices.Empty(CollisionData.ConvexVerticesCount); FCStringAnsi::Sprintf(ParameterName, "boneActors[%d].convexVerticesStart", i); verify(NxParameterized::getParamU32(*AssetParams, ParameterName, CollisionData.ConvexVerticesStart)); // read vertex data which compose a convex int32 NumMaxVertIndex = CollisionData.ConvexVerticesStart + CollisionData.ConvexVerticesCount; check( NumMaxVertIndex <= NumBoneVertices ); for(int32 VertIdx=CollisionData.ConvexVerticesStart; VertIdx < NumMaxVertIndex; VertIdx++) { FCStringAnsi::Sprintf(ParameterName, "boneVertices[%d]", VertIdx); physx::PxVec3 BoneVertex; verify(NxParameterized::getParamVec3(*AssetParams, ParameterName, BoneVertex)); CollisionData.BoneVertices.Add(P2UVector(BoneVertex)); } } else { FCStringAnsi::Sprintf(ParameterName, "boneActors[%d].capsuleRadius", i); verify(NxParameterized::getParamF32(*AssetParams, ParameterName, CollisionData.CapsuleRadius)); FCStringAnsi::Sprintf(ParameterName, "boneActors[%d].capsuleHeight", i); verify(NxParameterized::getParamF32(*AssetParams, ParameterName, CollisionData.CapsuleHeight)); // local pose is only used for a capsule physx::PxMat44 PxLocalPose; FCStringAnsi::Sprintf(ParameterName, "boneActors[%d].localPose", i); verify(NxParameterized::getParamMat34(*AssetParams, ParameterName, PxLocalPose)); CollisionData.LocalPose = P2UMatrix(PxLocalPose); } } // load convex data physx::PxI32 NumConvexes; verify(NxParameterized::getParamArraySize(*AssetParams, "collisionConvexes", NumConvexes)); Asset.ClothCollisionConvexPlaneIndices.Empty(NumConvexes); uint32 PlaneIndex; for(int32 i=0; i<NumConvexes; i++) { FCStringAnsi::Sprintf(ParameterName, "collisionConvexes[%d]", i); verify(NxParameterized::getParamU32(*AssetParams, ParameterName, PlaneIndex)); Asset.ClothCollisionConvexPlaneIndices.Add(PlaneIndex); } // load plane data physx::PxI32 NumPlanes; verify(NxParameterized::getParamArraySize(*AssetParams, "bonePlanes", NumPlanes)); physx::PxVec3 PlaneNormal; float PlaneDist; PxReal PlaneData[4]; Asset.ClothCollisionVolumePlanes.Empty(NumPlanes); for(int32 PlaneIdx=0; PlaneIdx<NumPlanes; PlaneIdx++) { FClothBonePlane BonePlane; FCStringAnsi::Sprintf(ParameterName, "bonePlanes[%d].boneIndex", PlaneIdx); verify(NxParameterized::getParamI32(*AssetParams, ParameterName, BonePlane.BoneIndex)); FCStringAnsi::Sprintf(ParameterName, "bonePlanes[%d].n", PlaneIdx); verify(NxParameterized::getParamVec3(*AssetParams, ParameterName, PlaneNormal)); FCStringAnsi::Sprintf(ParameterName, "bonePlanes[%d].d", PlaneIdx); verify(NxParameterized::getParamF32(*AssetParams, ParameterName, PlaneDist)); for(int i=0; i<3; i++) { PlaneData[i] = PlaneNormal[i]; } PlaneData[3] = PlaneDist; BonePlane.PlaneData = P2UPlane(PlaneData); Asset.ClothCollisionVolumePlanes.Add(BonePlane); } // load bone spheres physx::PxI32 NumBoneSpheres; verify(NxParameterized::getParamArraySize(*AssetParams, "boneSpheres", NumBoneSpheres)); Asset.ClothBoneSpheres.Empty(NumBoneSpheres); physx::PxVec3 LocalPosForBoneSphere; for(int32 i=0; i<NumBoneSpheres; i++) { FApexClothBoneSphereData& BoneSphere = Asset.ClothBoneSpheres[Asset.ClothBoneSpheres.AddZeroed()]; FCStringAnsi::Sprintf(ParameterName, "boneSpheres[%d].boneIndex", i); verify(NxParameterized::getParamI32(*AssetParams, ParameterName, BoneSphere.BoneIndex)); FCStringAnsi::Sprintf(ParameterName, "boneSpheres[%d].radius", i); verify(NxParameterized::getParamF32(*AssetParams, ParameterName, BoneSphere.Radius)); FCStringAnsi::Sprintf(ParameterName, "boneSpheres[%d].localPos", i); verify(NxParameterized::getParamVec3(*AssetParams, ParameterName, LocalPosForBoneSphere)); BoneSphere.LocalPos = P2UVector(LocalPosForBoneSphere); } // load bone sphere connections, 2 bone spheres become a capsule by this connection info physx::PxI32 NumBoneSphereConnections; verify(NxParameterized::getParamArraySize(*AssetParams, "boneSphereConnections", NumBoneSphereConnections)); Asset.BoneSphereConnections.Empty(NumBoneSphereConnections); for(int32 i=0; i<NumBoneSphereConnections; i++) { uint16 &ConnectionIndex = Asset.BoneSphereConnections[Asset.BoneSphereConnections.AddZeroed()]; FCStringAnsi::Sprintf(ParameterName, "boneSphereConnections[%d]", i); verify(NxParameterized::getParamU16(*AssetParams, ParameterName, ConnectionIndex)); } } bool USkeletalMesh::HasClothSectionsInAllLODs(int AssetIndex) { bool bResult = false; for (int32 LODIndex = 0; LODIndex < LODInfo.Num(); LODIndex++) { bResult |= HasClothSections(LODIndex, AssetIndex); } return bResult; } bool USkeletalMesh::HasClothSections(int32 LODIndex, int AssetIndex) { FSkeletalMeshResource* Resource = GetImportedResource(); check(Resource->LODModels.IsValidIndex(LODIndex)); FStaticLODModel& LODModel = Resource->LODModels[LODIndex]; int32 NumSections = LODModel.Sections.Num(); for(int32 SecIdx=0; SecIdx < NumSections; SecIdx++) { uint16 ChunkIdx = LODModel.Sections[SecIdx].ChunkIndex; if(LODModel.Chunks[ChunkIdx].CorrespondClothAssetIndex == AssetIndex) { return true; } } return false; } void USkeletalMesh::GetClothSectionIndices(int32 LODIndex, int32 AssetIndex, TArray<uint32>& OutSectionIndices) { FSkeletalMeshResource* Resource = GetImportedResource(); OutSectionIndices.Empty(); check(Resource->LODModels.IsValidIndex(LODIndex)); FStaticLODModel& LODModel = Resource->LODModels[LODIndex]; int32 NumSections = LODModel.Sections.Num(); for(int32 SecIdx=0; SecIdx < NumSections; SecIdx++) { if(LODModel.Chunks[LODModel.Sections[SecIdx].ChunkIndex].CorrespondClothAssetIndex == AssetIndex) { //add cloth sections OutSectionIndices.Add(SecIdx); } } } void USkeletalMesh::GetOriginSectionIndicesWithCloth(int32 LODIndex, TArray<uint32>& OutSectionIndices) { FSkeletalMeshResource* Resource = GetImportedResource(); OutSectionIndices.Empty(); check(Resource->LODModels.IsValidIndex(LODIndex)); FStaticLODModel& LODModel = Resource->LODModels[LODIndex]; int32 NumSections = LODModel.Sections.Num(); for(int32 SecIdx=0; SecIdx < NumSections; SecIdx++) { if(LODModel.Sections[SecIdx].CorrespondClothSectionIndex >= 0) { //add original sections OutSectionIndices.Add(SecIdx); } } } void USkeletalMesh::GetOriginSectionIndicesWithCloth(int32 LODIndex, int32 AssetIndex, TArray<uint32>& OutSectionIndices) { FSkeletalMeshResource* Resource = GetImportedResource(); OutSectionIndices.Empty(); check(Resource->LODModels.IsValidIndex(LODIndex)); FStaticLODModel& LODModel = Resource->LODModels[LODIndex]; int32 NumSections = LODModel.Sections.Num(); for(int32 SecIdx=0; SecIdx < NumSections; SecIdx++) { if(LODModel.Chunks[LODModel.Sections[SecIdx].ChunkIndex].CorrespondClothAssetIndex == AssetIndex) { //add original sections OutSectionIndices.Add(LODModel.Sections[SecIdx].CorrespondClothSectionIndex); } } } bool USkeletalMesh::IsMappedClothingLOD(int32 InLODIndex, int32 InAssetIndex) { FSkeletalMeshResource* Resource = GetImportedResource(); if (Resource && Resource->LODModels.IsValidIndex(InLODIndex)) { FStaticLODModel& LODModel = Resource->LODModels[InLODIndex]; int32 NumSections = LODModel.Sections.Num(); // loop reversely for optimized search for (int32 SecIdx = NumSections-1; SecIdx >= 0; SecIdx--) { int32 ClothAssetIndex = LODModel.Chunks[LODModel.Sections[SecIdx].ChunkIndex].CorrespondClothAssetIndex; if (ClothAssetIndex == InAssetIndex) { return true; } else if (ClothAssetIndex == INDEX_NONE) // no more cloth sections { return false; } } } return false; } int32 USkeletalMesh::GetClothAssetIndex(int32 LODIndex, int32 SectionIndex) { FSkeletalMeshResource* Resource = GetImportedResource(); // no LODs if (!Resource || !Resource->LODModels.IsValidIndex(LODIndex)) { return INDEX_NONE; } FStaticLODModel& LODModel = Resource->LODModels[LODIndex]; //no sections if(!LODModel.Sections.IsValidIndex(SectionIndex)) { return INDEX_NONE; } int16 ClothSecIdx = LODModel.Sections[SectionIndex].CorrespondClothSectionIndex; //no mapping if(ClothSecIdx < 0) { return INDEX_NONE; } int16 ChunkIdx = LODModel.Sections[ClothSecIdx].ChunkIndex; return LODModel.Chunks[ChunkIdx].CorrespondClothAssetIndex; } #endif//#if WITH_APEX_CLOTHING void USkeletalMeshComponent::CreateBodySetup() { if (BodySetup == NULL && SkeletalMesh) { BodySetup = NewObject<UBodySetup>(this); } UBodySetup* OriginalBodySetup = SkeletalMesh->GetBodySetup(); BodySetup->CopyBodyPropertiesFrom(OriginalBodySetup); BodySetup->CollisionTraceFlag = CTF_UseComplexAsSimple; BodySetup->CookedFormatDataOverride = &OriginalBodySetup->CookedFormatData; //need to recreate meshes BodySetup->ClearPhysicsMeshes(); BodySetup->CreatePhysicsMeshes(); } // // USkeletalMeshComponent // UBodySetup* USkeletalMeshComponent::GetBodySetup() { if (bEnablePerPolyCollision == false) { UPhysicsAsset * const PhysicsAsset = GetPhysicsAsset(); if (SkeletalMesh && PhysicsAsset) { for (int32 i = 0; i < SkeletalMesh->RefSkeleton.GetNum(); i++) { int32 BodyIndex = PhysicsAsset->FindBodyIndex(SkeletalMesh->RefSkeleton.GetBoneName(i)); if (BodyIndex != INDEX_NONE) { return PhysicsAsset->BodySetup[BodyIndex]; } } } } else { if (BodySetup == NULL) { CreateBodySetup(); } return BodySetup; } return NULL; } bool USkeletalMeshComponent::CanEditSimulatePhysics() { return GetPhysicsAsset() != nullptr; } void USkeletalMeshComponent::SetSimulatePhysics(bool bSimulate) { if ( !bEnablePhysicsOnDedicatedServer && IsRunningDedicatedServer() ) { return; } BodyInstance.bSimulatePhysics = bSimulate; // enable blending physics bBlendPhysics = bSimulate; //Go through body setups and see which bodies should be turned on and off if (UPhysicsAsset * PhysAsset = GetPhysicsAsset()) { for (int32 BodyIdx = 0; BodyIdx < Bodies.Num(); ++BodyIdx) { if (FBodyInstance* BodyInstance = Bodies[BodyIdx]) { if (UBodySetup * PhysAssetBodySetup = PhysAsset->BodySetup[BodyIdx]) { if (PhysAssetBodySetup->PhysicsType == EPhysicsType::PhysType_Default) { BodyInstance->SetInstanceSimulatePhysics(bSimulate); } } } } } UpdatePreClothTickRegisteredState(); } void USkeletalMeshComponent::OnComponentCollisionSettingsChanged() { for(int32 i=0; i<Bodies.Num(); i++) { Bodies[i]->UpdatePhysicsFilterData(); } if (SceneProxy) { ((FSkeletalMeshSceneProxy*)SceneProxy)->SetCollisionEnabled_GameThread(IsCollisionEnabled()); } } void USkeletalMeshComponent::AddRadialImpulse(FVector Origin, float Radius, float Strength, ERadialImpulseFalloff Falloff, bool bVelChange) { if(bIgnoreRadialImpulse) { return; } const float StrengthPerMass = Strength / FMath::Max(GetMass(), KINDA_SMALL_NUMBER); for(int32 i=0; i<Bodies.Num(); i++) { const float StrengthPerBody = bVelChange ? Strength : (StrengthPerMass * Bodies[i]->GetBodyMass()); Bodies[i]->AddRadialImpulseToBody(Origin, Radius, StrengthPerBody, Falloff, bVelChange); } } void USkeletalMeshComponent::AddRadialForce(FVector Origin, float Radius, float Strength, ERadialImpulseFalloff Falloff, bool bAccelChange) { if(bIgnoreRadialForce) { return; } const float StrengthPerMass = Strength / FMath::Max(GetMass(), KINDA_SMALL_NUMBER); for(int32 i=0; i<Bodies.Num(); i++) { const float StrengthPerBody = bAccelChange ? Strength : (StrengthPerMass * Bodies[i]->GetBodyMass()); Bodies[i]->AddRadialForceToBody(Origin, Radius, StrengthPerBody, Falloff, bAccelChange); } } void USkeletalMeshComponent::WakeAllRigidBodies() { for (int32 i=0; i < Bodies.Num(); i++) { FBodyInstance* BI = Bodies[i]; check(BI); BI->WakeInstance(); } } void USkeletalMeshComponent::PutAllRigidBodiesToSleep() { for (int32 i=0; i < Bodies.Num(); i++) { FBodyInstance* BI = Bodies[i]; check(BI); BI->PutInstanceToSleep(); } } bool USkeletalMeshComponent::IsAnyRigidBodyAwake() { bool bAwake = false; // ..iterate over each body to find any that are awak for(int32 i=0; i<Bodies.Num(); i++) { FBodyInstance* BI = Bodies[i]; check(BI); if(BI->IsInstanceAwake()) { // Found an awake one - so mesh is considered 'awake' bAwake = true; continue; } } return bAwake; } void USkeletalMeshComponent::SetAllPhysicsLinearVelocity(FVector NewVel, bool bAddToCurrent) { for (int32 i=0; i < Bodies.Num(); i++) { FBodyInstance* BodyInstance = Bodies[i]; check(BodyInstance); BodyInstance->SetLinearVelocity(NewVel, bAddToCurrent); } } void USkeletalMeshComponent::SetAllPhysicsAngularVelocity(FVector const& NewAngVel, bool bAddToCurrent) { if(RootBodyData.BodyIndex < Bodies.Num()) { // Find the root actor. We use its location as the center of the rotation. FBodyInstance* RootBodyInst = Bodies[ RootBodyData.BodyIndex ]; check(RootBodyInst); FTransform RootTM = RootBodyInst->GetUnrealWorldTransform(); FVector RootPos = RootTM.GetLocation(); // Iterate over each bone, updating its velocity for (int32 i = 0; i < Bodies.Num(); i++) { FBodyInstance* const BI = Bodies[i]; check(BI); BI->SetAngularVelocity(NewAngVel, bAddToCurrent); } } } void USkeletalMeshComponent::SetAllPhysicsPosition(FVector NewPos) { if(RootBodyData.BodyIndex < Bodies.Num()) { // calculate the deltas to get the root body to NewPos FBodyInstance* RootBI = Bodies[RootBodyData.BodyIndex]; check(RootBI); if(RootBI->IsValidBodyInstance()) { // move the root body FTransform RootBodyTM = RootBI->GetUnrealWorldTransform(); FVector DeltaLoc = NewPos - RootBodyTM.GetLocation(); RootBodyTM.SetTranslation(NewPos); RootBI->SetBodyTransform(RootBodyTM, ETeleportType::TeleportPhysics); #if DO_CHECK FVector RelativeVector = (RootBI->GetUnrealWorldTransform().GetLocation() - NewPos); check(RelativeVector.SizeSquared() < 1.f); #endif // apply the delta to all the other bodies for (int32 i = 0; i < Bodies.Num(); i++) { if (i != RootBodyData.BodyIndex) { FBodyInstance* BI = Bodies[i]; check(BI); FTransform BodyTM = BI->GetUnrealWorldTransform(); BodyTM.SetTranslation(BodyTM.GetTranslation() + DeltaLoc); BI->SetBodyTransform(BodyTM, ETeleportType::TeleportPhysics); } } // Move component to new physics location SyncComponentToRBPhysics(); } } } void USkeletalMeshComponent::SetAllPhysicsRotation(FRotator NewRot) { if(RootBodyData.BodyIndex < Bodies.Num()) { // calculate the deltas to get the root body to NewRot FBodyInstance* RootBI = Bodies[RootBodyData.BodyIndex]; check(RootBI); if(RootBI->IsValidBodyInstance()) { // move the root body FQuat NewRotQuat = NewRot.Quaternion(); FTransform RootBodyTM = RootBI->GetUnrealWorldTransform(); FQuat DeltaQuat = RootBodyTM.GetRotation().Inverse() * NewRotQuat; RootBodyTM.SetRotation(NewRotQuat); RootBI->SetBodyTransform(RootBodyTM, ETeleportType::TeleportPhysics); // apply the delta to all the other bodies for (int32 i = 0; i < Bodies.Num(); i++) { if (i != RootBodyData.BodyIndex) { FBodyInstance* BI = Bodies[i]; check(BI); FTransform BodyTM = BI->GetUnrealWorldTransform(); BodyTM.SetRotation(BodyTM.GetRotation() * DeltaQuat); BI->SetBodyTransform( BodyTM, ETeleportType::TeleportPhysics ); } } // Move component to new physics location SyncComponentToRBPhysics(); } } } void USkeletalMeshComponent::ApplyDeltaToAllPhysicsTransforms(const FVector& DeltaLocation, const FQuat& DeltaRotation) { if(RootBodyData.BodyIndex < Bodies.Num()) { // calculate the deltas to get the root body to NewRot FBodyInstance* RootBI = Bodies[RootBodyData.BodyIndex]; check(RootBI); if(RootBI->IsValidBodyInstance()) { // move the root body FTransform RootBodyTM = RootBI->GetUnrealWorldTransform(); RootBodyTM.SetRotation(RootBodyTM.GetRotation() * DeltaRotation); RootBodyTM.SetTranslation(RootBodyTM.GetTranslation() + DeltaLocation); RootBI->SetBodyTransform(RootBodyTM, ETeleportType::TeleportPhysics); // apply the delta to all the other bodies for (int32 i = 0; i < Bodies.Num(); i++) { if (i != RootBodyData.BodyIndex) { FBodyInstance* BI = Bodies[i]; check(BI); FTransform BodyTM = BI->GetUnrealWorldTransform(); BodyTM.SetRotation(BodyTM.GetRotation() * DeltaRotation); BodyTM.SetTranslation(BodyTM.GetTranslation() + DeltaLocation); BI->SetBodyTransform( BodyTM, ETeleportType::TeleportPhysics ); } } // Move component to new physics location SyncComponentToRBPhysics(); } } } void USkeletalMeshComponent::SetPhysMaterialOverride(UPhysicalMaterial* NewPhysMaterial) { // Single-body case - just use PrimComp code. UPrimitiveComponent::SetPhysMaterialOverride(NewPhysMaterial); // Now update any child bodies for( int32 i = 0; i < Bodies.Num(); i++ ) { FBodyInstance* BI = Bodies[i]; BI->UpdatePhysicalMaterials(); } } DEFINE_STAT(STAT_InitArticulated); void USkeletalMeshComponent::InitArticulated(FPhysScene* PhysScene) { SCOPE_CYCLE_COUNTER(STAT_InitArticulated); UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if(PhysScene == NULL || PhysicsAsset == NULL || SkeletalMesh == NULL) { return; } if(Bodies.Num() > 0) { UE_LOG(LogSkeletalMesh, Log, TEXT("InitArticulated: Bodies already created (%s) - call TermArticulated first."), *GetPathName()); return; } FVector Scale3D = ComponentToWorld.GetScale3D(); float Scale = Scale3D.X; // Find root physics body int32 RootBodyIndex = INDEX_NONE; for(int32 i=0; i<SkeletalMesh->RefSkeleton.GetNum(); i++) { int32 BodyInstIndex = PhysicsAsset->FindBodyIndex( SkeletalMesh->RefSkeleton.GetBoneName(i) ); if(BodyInstIndex != INDEX_NONE) { RootBodyIndex = BodyInstIndex; break; } } if(RootBodyIndex == INDEX_NONE) { UE_LOG(LogSkeletalMesh, Log, TEXT("UPhysicsAssetInstance::InitInstance : Could not find root physics body: %s"), *GetName() ); return; } // Set up the map from skelmeshcomp ID to collision disable table #if WITH_PHYSX uint32 SkelMeshCompID = GetUniqueID(); PhysScene->DeferredAddCollisionDisableTable(SkelMeshCompID, &PhysicsAsset->CollisionDisableTable); int32 NumBodies = PhysicsAsset->BodySetup.Num(); if(Aggregate == NULL && NumBodies > RagdollAggregateThreshold && NumBodies <= AggregateMaxSize) { Aggregate = GPhysXSDK->createAggregate(PhysicsAsset->BodySetup.Num(), true); } else if(Aggregate && NumBodies > AggregateMaxSize) { UE_LOG(LogSkeletalMesh, Log, TEXT("USkeletalMeshComponent::InitArticulated : Too many bodies to create aggregate, Max: %u, This: %d"), AggregateMaxSize, NumBodies); } #endif //WITH_PHYSX // Create all the bodies. check(Bodies.Num() == 0); Bodies.AddZeroed(NumBodies); for(int32 i=0; i<NumBodies; i++) { UBodySetup* PhysicsAssetBodySetup = PhysicsAsset->BodySetup[i]; Bodies[i] = new FBodyInstance; FBodyInstance* BodyInst = Bodies[i]; check(BodyInst); // Get transform of bone by name. int32 BoneIndex = GetBoneIndex( PhysicsAssetBodySetup->BoneName ); if(BoneIndex != INDEX_NONE) { // Copy body setup default instance properties BodyInst->CopyBodyInstancePropertiesFrom(&PhysicsAssetBodySetup->DefaultInstance); // we don't allow them to use this in editor. For physics asset, this set up is overriden by Physics Type. // but before we hide in the detail customization, we saved with this being true, causing the simulate always happens for some bodies // so adding initialization here to disable this. // to check, please check BodySetupDetails.cpp, if (ChildProperty->GetProperty()->GetName() == TEXT("bSimulatePhysics")) // we hide this property, so it should always be false initially. // this is not true for all other BodyInstance, but for physics assets it is true. BodyInst->bSimulatePhysics = false; BodyInst->InstanceBodyIndex = i; // Set body index BodyInst->InstanceBoneIndex = BoneIndex; // Set bone index if (i == RootBodyIndex) { BodyInst->DOFMode = BodyInstance.DOFMode; BodyInst->CustomDOFPlaneNormal = BodyInstance.CustomDOFPlaneNormal; BodyInst->bLockXTranslation = BodyInstance.bLockXTranslation; BodyInst->bLockYTranslation = BodyInstance.bLockYTranslation; BodyInst->bLockZTranslation = BodyInstance.bLockZTranslation; BodyInst->bLockXRotation = BodyInstance.bLockXRotation; BodyInst->bLockYRotation = BodyInstance.bLockYRotation; BodyInst->bLockZRotation = BodyInstance.bLockZRotation; BodyInst->bLockTranslation = BodyInstance.bLockTranslation; BodyInst->bLockRotation = BodyInstance.bLockRotation; BodyInst->COMNudge = BodyInstance.COMNudge; } else { BodyInst->DOFMode = EDOFMode::None; } #if WITH_PHYSX // Create physics body instance. FTransform BoneTransform = GetBoneTransform( BoneIndex ); BodyInst->InitBody( PhysicsAssetBodySetup, BoneTransform, this, PhysScene, Aggregate); #endif //WITH_PHYSX // Remember if we have bodies in sync/async scene, so we know which scene(s) to lock when moving bodies if(BodyInst->UseAsyncScene(PhysScene)) { bHasBodiesInAsyncScene = true; } else { bHasBodiesInSyncScene = true; } } } // now update root body index because body has BodySetup now SetRootBodyIndex(RootBodyIndex); #if WITH_PHYSX if (PhysScene) { // Get the scene type from the SkeletalMeshComponent's BodyInstance const uint32 SceneType = (bHasBodiesInAsyncScene && PhysScene->HasAsyncScene()) ? PST_Async : PST_Sync; PxScene* PScene = PhysScene->GetPhysXScene(SceneType); SCOPED_SCENE_WRITE_LOCK(PScene); // add Aggregate into the scene if (Aggregate && Aggregate->getNbActors() > 0) { PScene->addAggregate(*Aggregate); // If we've used an aggregate, InitBody would not be able to set awake status as we *must* have a scene // to do that, so we reconcile this here. AActor* Owner = GetOwner(); bool bShouldSleep = !BodyInstance.bStartAwake && (Owner && Owner->GetVelocity().SizeSquared() <= KINDA_SMALL_NUMBER); for (FBodyInstance* Body : Bodies) { // Creates a DOF constraint if necessary for the body - also requires the scene to exist within the actor Body->CreateDOFLock(); // Set to sleep if necessary if (bShouldSleep) { Body->GetPxRigidDynamic_AssumesLocked()->putToSleep(); } } } } #endif //WITH_PHYSX // Create all the constraints. check(Constraints.Num() == 0); int32 NumConstraints = PhysicsAsset->ConstraintSetup.Num(); Constraints.AddZeroed(NumConstraints); for(int32 i=0; i<NumConstraints; i++) { UPhysicsConstraintTemplate* ConstraintSetup = PhysicsAsset->ConstraintSetup[i]; Constraints[i] = new FConstraintInstance; FConstraintInstance* ConInst = Constraints[i]; check( ConInst ); ConInst->ConstraintIndex = i; // Set the ConstraintIndex property in the ConstraintInstance. ConInst->CopyConstraintParamsFrom(&ConstraintSetup->DefaultInstance); // Get bodies we want to joint FBodyInstance* Body1 = GetBodyInstance(ConInst->ConstraintBone1); FBodyInstance* Body2 = GetBodyInstance(ConInst->ConstraintBone2); // If we have 2, joint 'em if(Body1 != NULL && Body2 != NULL) { ConInst->InitConstraint(this, Body1, Body2, Scale); } } // Update Flag ResetAllBodiesSimulatePhysics(); #if WITH_APEX_CLOTHING PrevRootBoneMatrix = GetBoneMatrix(0); // save the root bone transform // pre-compute cloth teleport thresholds for performance ClothTeleportCosineThresholdInRad = FMath::Cos(FMath::DegreesToRadians(TeleportRotationThreshold)); ClothTeleportDistThresholdSquared = TeleportDistanceThreshold * TeleportDistanceThreshold; #endif // #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::TermArticulated() { #if WITH_PHYSX uint32 SkelMeshCompID = GetUniqueID(); FPhysScene * PhysScene = GetWorld()->GetPhysicsScene(); if (PhysScene) { PhysScene->DeferredRemoveCollisionDisableTable(SkelMeshCompID); } // Get the scene type from the SkeletalMeshComponent's BodyInstance const uint32 SceneType = BodyInstance.UseAsyncScene(PhysScene) ? PST_Async : PST_Sync; PxScene* PScene = PhysScene->GetPhysXScene(SceneType); SCOPED_SCENE_WRITE_LOCK(PScene); #endif //#if WITH_PHYSX // We shut down the physics for each body and constraint here. // The actual UObjects will get GC'd for(int32 i=0; i<Constraints.Num(); i++) { check( Constraints[i] ); Constraints[i]->TermConstraint(); delete Constraints[i]; } Constraints.Empty(); for(int32 i=0; i<Bodies.Num(); i++) { check( Bodies[i] ); Bodies[i]->TermBody(); delete Bodies[i]; } Bodies.Empty(); #if WITH_PHYSX // releasing Aggregate, it shouldn't contain any Bodies now, because they are released above if(Aggregate) { check(!Aggregate->getNbActors()); Aggregate->release(); Aggregate = NULL; } #endif //WITH_PHYSX // Reset bools for scenes bHasBodiesInAsyncScene = false; bHasBodiesInSyncScene = false; } void USkeletalMeshComponent::TermBodiesBelow(FName ParentBoneName) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if(PhysicsAsset && SkeletalMesh && Bodies.Num() > 0) { check(Bodies.Num() == PhysicsAsset->BodySetup.Num()); // Get index of parent bone int32 ParentBoneIndex = GetBoneIndex(ParentBoneName); if(ParentBoneIndex == INDEX_NONE) { UE_LOG(LogSkeletalMesh, Log, TEXT("TermBodiesBelow: ParentBoneName '%s' is invalid"), *ParentBoneName.ToString()); return; } // First terminate any constraints at below this bone for(int32 i=0; i<Constraints.Num(); i++) { // Get bone index of constraint FName JointName = Constraints[i]->JointName; int32 JointBoneIndex = GetBoneIndex(JointName); // If constraint has bone in mesh, and is either the parent or child of it, term it if( JointBoneIndex != INDEX_NONE && (JointName == ParentBoneName || SkeletalMesh->RefSkeleton.BoneIsChildOf(JointBoneIndex, ParentBoneIndex)) ) { Constraints[i]->TermConstraint(); } } // Then iterate over bodies looking for any which are children of supplied parent for(int32 i=0; i<Bodies.Num(); i++) { // Get bone index of body if (Bodies[i]->IsValidBodyInstance()) { FName BodyName = Bodies[i]->BodySetup->BoneName; int32 BodyBoneIndex = GetBoneIndex(BodyName); // If body has bone in mesh, and is either the parent or child of it, term it if( BodyBoneIndex != INDEX_NONE && (BodyName == ParentBoneName || SkeletalMesh->RefSkeleton.BoneIsChildOf(BodyBoneIndex, ParentBoneIndex)) ) { Bodies[i]->TermBody(); } } } } } float USkeletalMeshComponent::GetTotalMassBelowBone(FName InBoneName) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if(!PhysicsAsset || !SkeletalMesh) { return 0.f; } // if physics state is invalid - i.e. collision is disabled - or it does not have a valid bodies, this will crash right away if (!IsPhysicsStateCreated() || !bHasValidBodies) { return 0.f; } TArray<int32> BodyIndices; PhysicsAsset->GetBodyIndicesBelow(BodyIndices, InBoneName, SkeletalMesh); float TotalMass = 0.f; for(int32 i=0; i<BodyIndices.Num(); i++) { TotalMass += Bodies[BodyIndices[i]]->GetBodyMass(); } return TotalMass; } void USkeletalMeshComponent::SetAllBodiesSimulatePhysics(bool bNewSimulate) { for(int32 i=0; i<Bodies.Num(); i++) { Bodies[i]->SetInstanceSimulatePhysics(bNewSimulate); } UpdatePreClothTickRegisteredState(); } void USkeletalMeshComponent::SetAllBodiesCollisionObjectType(ECollisionChannel NewChannel) { for(int32 i=0; i<Bodies.Num(); i++) { Bodies[i]->SetObjectType(NewChannel); } } void USkeletalMeshComponent::SetAllBodiesNotifyRigidBodyCollision(bool bNewNotifyRigidBodyCollision) { for(int32 i=0; i<Bodies.Num(); i++) { Bodies[i]->SetInstanceNotifyRBCollision(bNewNotifyRigidBodyCollision); } } void USkeletalMeshComponent::SetAllBodiesBelowSimulatePhysics( const FName& InBoneName, bool bNewSimulate ) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if( !PhysicsAsset || !SkeletalMesh ) { return; } // if physics state is invalid - i.e. collision is disabled - or it does not have a valid bodies, this will crash right away if (!IsPhysicsStateCreated() || !bHasValidBodies) { FMessageLog("PIE").Warning(LOCTEXT("InvalidBodies", "Invalid Bodies : Make sure collision is enabled or root bone has body in PhysicsAsset.")); return; } TArray<int32> BodyIndices; PhysicsAsset->GetBodyIndicesBelow(BodyIndices, InBoneName, SkeletalMesh); for(int32 i=0; i<BodyIndices.Num(); i++) { //UE_LOG(LogSkeletalMesh, Warning, TEXT( "ForceAllBodiesBelowUnfixed %s" ), *InAsset->BodySetup(BodyIndices(i))->BoneName.ToString() ); Bodies[BodyIndices[i]]->SetInstanceSimulatePhysics(bNewSimulate); } UpdatePreClothTickRegisteredState(); } void USkeletalMeshComponent::SetAllMotorsAngularPositionDrive(bool bEnableSwingDrive, bool bEnableTwistDrive, bool bSkipCustomPhysicsType) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if( !PhysicsAsset ) { return; } for(int32 i=0; i<Constraints.Num(); i++) { if( bSkipCustomPhysicsType ) { int32 BodyIndex = PhysicsAsset->FindBodyIndex(Constraints[i]->JointName); if( BodyIndex != INDEX_NONE && PhysicsAsset->BodySetup[BodyIndex]->PhysicsType != PhysType_Default) { continue; } } Constraints[i]->SetAngularPositionDrive(bEnableSwingDrive, bEnableTwistDrive); } } void USkeletalMeshComponent::SetNamedMotorsAngularPositionDrive(bool bEnableSwingDrive, bool bEnableTwistDrive, const TArray<FName>& BoneNames, bool bSetOtherBodiesToComplement) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if( !PhysicsAsset ) { return; } for(int32 i=0; i<Constraints.Num(); i++) { FConstraintInstance* Instance = Constraints[i]; if( BoneNames.Contains(Instance->JointName) ) { Constraints[i]->SetAngularPositionDrive(bEnableSwingDrive, bEnableTwistDrive); } else if( bSetOtherBodiesToComplement ) { Constraints[i]->SetAngularPositionDrive(!bEnableSwingDrive, !bEnableTwistDrive); } } } void USkeletalMeshComponent::SetNamedMotorsAngularVelocityDrive(bool bEnableSwingDrive, bool bEnableTwistDrive, const TArray<FName>& BoneNames, bool bSetOtherBodiesToComplement) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if( !PhysicsAsset ) { return; } for(int32 i=0; i<Constraints.Num(); i++) { FConstraintInstance* Instance = Constraints[i]; if( BoneNames.Contains(Instance->JointName) ) { Constraints[i]->SetAngularVelocityDrive(bEnableSwingDrive, bEnableTwistDrive); } else if( bSetOtherBodiesToComplement ) { Constraints[i]->SetAngularVelocityDrive(!bEnableSwingDrive, !bEnableTwistDrive); } } } void USkeletalMeshComponent::SetAllMotorsAngularVelocityDrive(bool bEnableSwingDrive, bool bEnableTwistDrive, bool bSkipCustomPhysicsType) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if( !PhysicsAsset ) { return; } for(int32 i=0; i<Constraints.Num(); i++) { if( bSkipCustomPhysicsType ) { int32 BodyIndex = PhysicsAsset->FindBodyIndex(Constraints[i]->JointName); if( BodyIndex != INDEX_NONE && PhysicsAsset->BodySetup[BodyIndex]->PhysicsType != PhysType_Default ) { continue; } } Constraints[i]->SetAngularVelocityDrive(bEnableSwingDrive, bEnableTwistDrive); } } void USkeletalMeshComponent::SetAllMotorsAngularDriveParams(float InSpring, float InDamping, float InForceLimit, bool bSkipCustomPhysicsType) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if( !PhysicsAsset ) { return; } for(int32 i=0; i<Constraints.Num(); i++) { if( bSkipCustomPhysicsType ) { int32 BodyIndex = PhysicsAsset->FindBodyIndex(Constraints[i]->JointName); if( BodyIndex != INDEX_NONE && PhysicsAsset->BodySetup[BodyIndex]->PhysicsType != PhysType_Default ) { continue; } } Constraints[i]->SetAngularDriveParams(InSpring, InDamping, InForceLimit); } } void USkeletalMeshComponent::ResetAllBodiesSimulatePhysics() { if ( !bEnablePhysicsOnDedicatedServer && IsRunningDedicatedServer() ) { return; } UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if( !PhysicsAsset ) { return; } // Fix / Unfix bones for(int32 i=0; i<Bodies.Num(); i++) { FBodyInstance* BodyInst = Bodies[i]; UBodySetup* BodyInstSetup = BodyInst->BodySetup.Get(); // Set fixed on any bodies with bAlwaysFullAnimWeight set to true if(BodyInstSetup && BodyInstSetup->PhysicsType != PhysType_Default) { if (BodyInstSetup->PhysicsType == PhysType_Simulated) { BodyInst->SetInstanceSimulatePhysics(true); } else { BodyInst->SetInstanceSimulatePhysics(false); } } } } void USkeletalMeshComponent::SetEnablePhysicsBlending(bool bNewBlendPhysics) { bBlendPhysics = bNewBlendPhysics; } void USkeletalMeshComponent::SetPhysicsBlendWeight(float PhysicsBlendWeight) { bool bShouldSimulate = PhysicsBlendWeight > 0.f; if (bShouldSimulate != IsSimulatingPhysics()) { SetSimulatePhysics(bShouldSimulate); } // if blend weight is not 1, set manual weight if ( PhysicsBlendWeight < 1.f ) { bBlendPhysics = false; SetAllBodiesPhysicsBlendWeight (PhysicsBlendWeight, true); } } void USkeletalMeshComponent::SetAllBodiesPhysicsBlendWeight(float PhysicsBlendWeight, bool bSkipCustomPhysicsType ) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if( !PhysicsAsset ) { return; } // Fix / Unfix bones for(int32 i=0; i<Bodies.Num(); i++) { FBodyInstance* BodyInst = Bodies[i]; UBodySetup* BodyInstSetup = BodyInst->BodySetup.Get(); // Set fixed on any bodies with bAlwaysFullAnimWeight set to true if(BodyInstSetup && (!bSkipCustomPhysicsType || BodyInstSetup->PhysicsType == PhysType_Default) ) { BodyInst->PhysicsBlendWeight = PhysicsBlendWeight; } } } void USkeletalMeshComponent::SetAllBodiesBelowPhysicsBlendWeight( const FName& InBoneName, float PhysicsBlendWeight, bool bSkipCustomPhysicsType ) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if( !PhysicsAsset || !SkeletalMesh ) { return; } // if physics state is invalid - i.e. collision is disabled - or it does not have a valid bodies, this will crash right away if (!IsPhysicsStateCreated() || !bHasValidBodies) { FMessageLog("PIE").Warning(LOCTEXT("InvalidBodies", "Invalid Bodies : Make sure collision is enabled or root bone has body in PhysicsAsset.")); return; } TArray<int32> BodyIndices; PhysicsAsset->GetBodyIndicesBelow(BodyIndices, InBoneName, SkeletalMesh); for(int32 i=0; i<BodyIndices.Num(); i++) { Bodies[BodyIndices[i]]->PhysicsBlendWeight = PhysicsBlendWeight; } } void USkeletalMeshComponent::AccumulateAllBodiesBelowPhysicsBlendWeight( const FName& InBoneName, float PhysicsBlendWeight, bool bSkipCustomPhysicsType ) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if( !PhysicsAsset || !SkeletalMesh ) { return; } // if physics state is invalid - i.e. collision is disabled - or it does not have a valid bodies, this will crash right away if (!IsPhysicsStateCreated() || !bHasValidBodies) { FMessageLog("PIE").Warning(LOCTEXT("InvalidBodies", "Invalid Bodies : Make sure collision is enabled or root bone has body in PhysicsAsset.")); return; } TArray<int32> BodyIndices; PhysicsAsset->GetBodyIndicesBelow(BodyIndices, InBoneName, SkeletalMesh); for(int32 i=0; i<BodyIndices.Num(); i++) { Bodies[BodyIndices[i]]->PhysicsBlendWeight = FMath::Min(Bodies[BodyIndices[i]]->PhysicsBlendWeight + PhysicsBlendWeight, 1.f); } } FConstraintInstance* USkeletalMeshComponent::FindConstraintInstance(FName ConName) { UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); if(PhysicsAsset && PhysicsAsset->ConstraintSetup.Num() == Constraints.Num()) { int32 ConIndex = PhysicsAsset->FindConstraintIndex(ConName); if(ConIndex != INDEX_NONE) { return Constraints[ConIndex]; } } return NULL; } #ifndef OLD_FORCE_UPDATE_BEHAVIOR #define OLD_FORCE_UPDATE_BEHAVIOR 0 #endif void USkeletalMeshComponent::OnUpdateTransform(bool bSkipPhysicsMove, ETeleportType Teleport) { // We are handling the physics move below, so don't handle it at higher levels Super::OnUpdateTransform(true, Teleport); // Always send new transform to physics if(bPhysicsStateCreated && !bSkipPhysicsMove) { #if !OLD_FORCE_UPDATE_BEHAVIOR UpdateKinematicBonesToAnim(GetSpaceBases(), Teleport, false); #else UpdateKinematicBonesToAnim(GetSpaceBases(), ETeleportType::TeleportPhysics, false); #endif } #if WITH_APEX_CLOTHING if(ClothingActors.Num() > 0) { //@todo: Should cloth know whether we're teleporting? // Updates cloth animation states because transform is updated UpdateClothTransform(); } #endif //#if WITH_APEX_CLOTHING } void USkeletalMeshComponent::UpdateOverlaps(TArray<FOverlapInfo> const* PendingOverlaps, bool bDoNotifies, const TArray<FOverlapInfo>* OverlapsAtEndLocation) { // Parent class (USkinnedMeshComponent) routes only to children, but we really do want to test our own bodies for overlaps. UPrimitiveComponent::UpdateOverlaps(PendingOverlaps, bDoNotifies, OverlapsAtEndLocation); } void USkeletalMeshComponent::CreatePhysicsState() { // UE_LOG(LogSkeletalMesh, Warning, TEXT("Creating Physics State (%s : %s)"), *GetNameSafe(GetOuter()), *GetName()); // Init physics if (bEnablePerPolyCollision == false) { InitArticulated(World->GetPhysicsScene()); USceneComponent::CreatePhysicsState(); // Need to route CreatePhysicsState, skip PrimitiveComponent } else { CreateBodySetup(); BodySetup->CreatePhysicsMeshes(); Super::CreatePhysicsState(); //If we're doing per poly we'll use the body instance of the primitive component } } void USkeletalMeshComponent::DestroyPhysicsState() { if (bEnablePerPolyCollision == false) { UnWeldFromParent(); UnWeldChildren(); TermArticulated(); } Super::DestroyPhysicsState(); } #if 0 && !(UE_BUILD_SHIPPING || UE_BUILD_TEST) #define DEBUGBROKENCONSTRAINTUPDATE(x) { ##x } #else #define DEBUGBROKENCONSTRAINTUPDATE(x) #endif void USkeletalMeshComponent::UpdateMeshForBrokenConstraints() { UPhysicsAsset * const PhysicsAsset = GetPhysicsAsset(); // Needs to have a SkeletalMesh, and PhysicsAsset. if( !SkeletalMesh || !PhysicsAsset ) { return; } DEBUGBROKENCONSTRAINTUPDATE(UE_LOG(LogSkeletalMesh, Log, TEXT("%3.3f UpdateMeshForBrokenConstraints"), GetWorld()->GetTimeSeconds());) // Iterate through list of constraints in the physics asset for(int32 ConstraintInstIndex = 0; ConstraintInstIndex < Constraints.Num(); ConstraintInstIndex++) { // See if we can find a constraint that has been terminated (broken) FConstraintInstance* ConstraintInst = Constraints[ConstraintInstIndex]; if( ConstraintInst && ConstraintInst->IsTerminated() ) { // Get the associated joint bone index. int32 JointBoneIndex = GetBoneIndex(ConstraintInst->JointName); if( JointBoneIndex == INDEX_NONE ) { continue; } DEBUGBROKENCONSTRAINTUPDATE(UE_LOG(LogSkeletalMesh, Log, TEXT(" Found Broken Constraint: (%d) %s"), JointBoneIndex, *PhysicsAsset->ConstraintSetup(ConstraintInstIndex)->JointName.ToString());) // Get child bodies of this joint for(int32 BodySetupIndex = 0; BodySetupIndex < PhysicsAsset->BodySetup.Num(); BodySetupIndex++) { UBodySetup* PhysicsAssetBodySetup = PhysicsAsset->BodySetup[BodySetupIndex]; int32 BoneIndex = GetBoneIndex(PhysicsAssetBodySetup->BoneName); if( BoneIndex != INDEX_NONE && (BoneIndex == JointBoneIndex || SkeletalMesh->RefSkeleton.BoneIsChildOf(BoneIndex, JointBoneIndex)) ) { DEBUGBROKENCONSTRAINTUPDATE(UE_LOG(LogSkeletalMesh, Log, TEXT(" Found Child Bone: (%d) %s"), BoneIndex, *PhysicsAssetBodySetup->BoneName.ToString());) FBodyInstance* ChildBodyInst = Bodies[BodySetupIndex]; if( ChildBodyInst ) { // Unfix Body so, it is purely physical, not kinematic. if( !ChildBodyInst->IsInstanceSimulatingPhysics() ) { DEBUGBROKENCONSTRAINTUPDATE(UE_LOG(LogSkeletalMesh, Log, TEXT(" Unfixing body."));) ChildBodyInst->SetInstanceSimulatePhysics(true); } } FConstraintInstance* ChildConstraintInst = FindConstraintInstance(PhysicsAssetBodySetup->BoneName); if( ChildConstraintInst ) { if( ChildConstraintInst->bLinearPositionDrive ) { DEBUGBROKENCONSTRAINTUPDATE(UE_LOG(LogSkeletalMesh, Log, TEXT(" Turning off LinearPositionDrive."));) ChildConstraintInst->SetLinearPositionDrive(false, false, false); } if( ChildConstraintInst->bLinearVelocityDrive ) { DEBUGBROKENCONSTRAINTUPDATE(UE_LOG(LogSkeletalMesh, Log, TEXT(" Turning off LinearVelocityDrive."));) ChildConstraintInst->SetLinearVelocityDrive(false, false, false); } if( ChildConstraintInst->bAngularOrientationDrive ) { DEBUGBROKENCONSTRAINTUPDATE(UE_LOG(LogSkeletalMesh, Log, TEXT(" Turning off AngularPositionDrive."));) ChildConstraintInst->SetAngularPositionDrive(false, false); } if( ChildConstraintInst->bAngularVelocityDrive ) { DEBUGBROKENCONSTRAINTUPDATE(UE_LOG(LogSkeletalMesh, Log, TEXT(" Turning off AngularVelocityDrive."));) ChildConstraintInst->SetAngularVelocityDrive(false, false); } } } } } } } int32 USkeletalMeshComponent::FindConstraintIndex( FName ConstraintName ) { UPhysicsAsset * const PhysicsAsset = GetPhysicsAsset(); return PhysicsAsset ? PhysicsAsset->FindConstraintIndex(ConstraintName) : INDEX_NONE; } FName USkeletalMeshComponent::FindConstraintBoneName( int32 ConstraintIndex ) { UPhysicsAsset * const PhysicsAsset = GetPhysicsAsset(); return PhysicsAsset ? PhysicsAsset->FindConstraintBoneName(ConstraintIndex) : NAME_None; } FBodyInstance* USkeletalMeshComponent::GetBodyInstance(FName BoneName, bool) const { UPhysicsAsset * const PhysicsAsset = GetPhysicsAsset(); FBodyInstance* BodyInst = NULL; if(PhysicsAsset != NULL) { // A name of NAME_None indicates 'root body' if(BoneName == NAME_None) { if(Bodies.IsValidIndex(RootBodyData.BodyIndex)) { BodyInst = Bodies[RootBodyData.BodyIndex]; } } // otherwise, look for the body else { int32 BodyIndex = PhysicsAsset->FindBodyIndex(BoneName); if(Bodies.IsValidIndex(BodyIndex)) { BodyInst = Bodies[BodyIndex]; } } } return BodyInst; } void USkeletalMeshComponent::GetWeldedBodies(TArray<FBodyInstance*> & OutWeldedBodies, TArray<FName> & OutLabels) { UPhysicsAsset* PhysicsAsset = GetPhysicsAsset(); for (int32 BodyIdx = 0; BodyIdx < Bodies.Num(); ++BodyIdx) { FBodyInstance* BI = Bodies[BodyIdx]; if (BI && BI->bWelded) { OutWeldedBodies.Add(&BodyInstance); if (PhysicsAsset) { if (UBodySetup * PhysicsAssetBodySetup = PhysicsAsset->BodySetup[BodyIdx]) { OutLabels.Add(PhysicsAssetBodySetup->BoneName); } else { OutLabels.Add(NAME_None); } } else { OutLabels.Add(NAME_None); } for (USceneComponent * Child : AttachChildren) { if (UPrimitiveComponent * PrimChild = Cast<UPrimitiveComponent>(Child)) { PrimChild->GetWeldedBodies(OutWeldedBodies, OutLabels); } } } } } void USkeletalMeshComponent::BreakConstraint(FVector Impulse, FVector HitLocation, FName InBoneName) { // you can enable/disable the instanced weights by calling int32 ConstraintIndex = FindConstraintIndex(InBoneName); if( ConstraintIndex == INDEX_NONE || ConstraintIndex >= Constraints.Num() ) { return; } FConstraintInstance* Constraint = Constraints[ConstraintIndex]; // If already broken, our job has already been done. Bail! if( Constraint->IsTerminated() ) { return; } UPhysicsAsset * const PhysicsAsset = GetPhysicsAsset(); // Figure out if Body is fixed or not FBodyInstance* Body = GetBodyInstance(Constraint->JointName); if( Body != NULL && Body->IsInstanceSimulatingPhysics() ) { // Unfix body so it can be broken. Body->SetInstanceSimulatePhysics(true); } // Break Constraint Constraint->TermConstraint(); // Make sure child bodies and constraints are released and turned to physics. UpdateMeshForBrokenConstraints(); // Add impulse to broken limb AddImpulseAtLocation(Impulse, HitLocation, InBoneName); } void USkeletalMeshComponent::SetPhysicsAsset(UPhysicsAsset* InPhysicsAsset, bool bForceReInit) { // If this is different from what we have now, or we should have an instance but for whatever reason it failed last time, teardown/recreate now. if(bForceReInit || InPhysicsAsset != GetPhysicsAsset()) { // SkelComp had a physics instance, then terminate it. TermArticulated(); // Need to update scene proxy, because it keeps a ref to the PhysicsAsset. Super::SetPhysicsAsset(InPhysicsAsset, bForceReInit); MarkRenderStateDirty(); // Update bHasValidBodies flag UpdateHasValidBodies(); // Component should be re-attached here, so create physics. if( SkeletalMesh ) { // Because we don't know what bones the new PhysicsAsset might want, we have to force an update to _all_ bones in the skeleton. RequiredBones.Reset(SkeletalMesh->RefSkeleton.GetNum()); RequiredBones.AddUninitialized( SkeletalMesh->RefSkeleton.GetNum() ); for(int32 i=0; i<SkeletalMesh->RefSkeleton.GetNum(); i++) { RequiredBones[i] = (FBoneIndexType)i; } RefreshBoneTransforms(); // Initialize new Physics Asset if(World->GetPhysicsScene() != NULL && ShouldCreatePhysicsState()) { // UE_LOG(LogSkeletalMesh, Warning, TEXT("Creating Physics State (%s : %s)"), *GetNameSafe(GetOuter()), *GetName()); InitArticulated(World->GetPhysicsScene()); } } else { // If PhysicsAsset hasn't been instanced yet, just update the template. Super::SetPhysicsAsset(InPhysicsAsset, bForceReInit); // Update bHasValidBodies flag UpdateHasValidBodies(); } // Indicate that 'required bones' array will need to be recalculated. bRequiredBonesUpToDate = false; } } void USkeletalMeshComponent::UpdateHasValidBodies() { // First clear out old data bHasValidBodies = false; const UPhysicsAsset* const PhysicsAsset = GetPhysicsAsset(); // If we have a physics asset.. if(PhysicsAsset != NULL) { // For each body in physics asset.. for( int32 BodyIndex = 0; BodyIndex < PhysicsAsset->BodySetup.Num(); BodyIndex++ ) { // .. find the matching graphics bone index int32 BoneIndex = GetBoneIndex( PhysicsAsset->BodySetup[ BodyIndex ]->BoneName ); // If we found a valid graphics bone, set the 'valid' flag if(BoneIndex != INDEX_NONE) { bHasValidBodies = true; break; } } } } void USkeletalMeshComponent::UpdatePhysicsToRBChannels() { // Iterate over each bone/body. for (int32 i = 0; i < Bodies.Num(); i++) { FBodyInstance* BI = Bodies[i]; check(BI); BI->UpdatePhysicsFilterData(); } } FVector USkeletalMeshComponent::GetSkinnedVertexPosition(int32 VertexIndex) const { #if WITH_APEX_CLOTHING // only if this component has clothing and is showing simulated results if (SkeletalMesh && SkeletalMesh->ClothingAssets.Num() > 0 && MeshObject && !bDisableClothSimulation && ClothBlendWeight > 0.0f // if cloth blend weight is 0.0, only showing skinned vertices regardless of simulation positions ) { FStaticLODModel& Model = MeshObject->GetSkeletalMeshResource().LODModels[0]; // Find the chunk and vertex within that chunk, and skinning type, for this vertex. int32 ChunkIndex; int32 VertIndexInChunk; bool bSoftVertex; bool bHasExtraBoneInfluences; Model.GetChunkAndSkinType(VertexIndex, ChunkIndex, VertIndexInChunk, bSoftVertex, bHasExtraBoneInfluences); bool bClothVertex = false; int32 ClothAssetIndex = -1; // if this chunk has cloth data if (Model.Chunks[ChunkIndex].HasApexClothData()) { bClothVertex = true; ClothAssetIndex = Model.Chunks[ChunkIndex].CorrespondClothAssetIndex; } else { // if this chunk corresponds to a cloth section, returns corresponding cloth section's info instead for (int32 SectionIdx = 0; SectionIdx < Model.Sections.Num(); SectionIdx++) { const FSkelMeshSection& Section = Model.Sections[SectionIdx]; // find a section which has this chunk index if (Section.ChunkIndex == ChunkIndex) { // if current section is disabled and the corresponding cloth section is visible if (Section.bDisabled && Section.CorrespondClothSectionIndex >= 0) { bClothVertex = true; const FSkelMeshSection& ClothSection = Model.Sections[Section.CorrespondClothSectionIndex]; const FSkelMeshChunk& ClothChunk = Model.Chunks[ClothSection.ChunkIndex]; ClothAssetIndex = ClothChunk.CorrespondClothAssetIndex; // the index can exceed the range because this vertex index is based on the corresponding original section // the number of cloth chunk's vertices is not always same as the corresponding one // cloth chunk has only soft vertices if (VertIndexInChunk >= ClothChunk.GetNumSoftVertices()) { // if the index exceeds, re-assign a random vertex index for this chunk VertIndexInChunk = FMath::TruncToInt(FMath::SRand() * (ClothChunk.GetNumSoftVertices() - 1)); } } // if found, quit this loop quickly break; } } } if (bClothVertex) { FVector SimulatedPos; if (GetClothSimulatedPosition(ClothAssetIndex, VertIndexInChunk, SimulatedPos)) { // a simulated position is in world space and convert this to local space // because SkinnedMeshComponent::GetSkinnedVertexPosition() returns the position in local space SimulatedPos = ComponentToWorld.InverseTransformPosition(SimulatedPos); // if blend weight is 1.0, doesn't need to blend with a skinned position if (ClothBlendWeight < 1.0f) { // blend with a skinned position FVector SkinnedPos = Super::GetSkinnedVertexPosition(VertexIndex); SimulatedPos = SimulatedPos*ClothBlendWeight + SkinnedPos*(1.0f - ClothBlendWeight); } return SimulatedPos; } } } #endif // #if WITH_APEX_CLOTHING return Super::GetSkinnedVertexPosition(VertexIndex); } ////////////////////////////////////////////////////////////////////////// // COLLISION extern float DebugLineLifetime; float USkeletalMeshComponent::GetDistanceToCollision(const FVector& Point, FVector& ClosestPointOnCollision) const { ClosestPointOnCollision = Point; float ClosestPointDistance = -1.f; bool bHasResult = false; for (int32 BodyIdx = 0; BodyIdx < Bodies.Num(); ++BodyIdx) { FBodyInstance* BodyInstance = Bodies[BodyIdx]; if (BodyInstance && BodyInstance->IsValidBodyInstance() && (BodyInstance->GetCollisionEnabled() != ECollisionEnabled::NoCollision)) { FVector ClosestPoint; const float Distance = Bodies[BodyIdx]->GetDistanceToBody(Point, ClosestPoint); if (Distance < 0.f) { // Invalid result, impossible to be better than ClosestPointDistance continue; } if (!bHasResult || (Distance < ClosestPointDistance)) { bHasResult = true; ClosestPointDistance = Distance; ClosestPointOnCollision = ClosestPoint; // If we're inside collision, we're not going to find anything better, so abort search we've got our best find. if (Distance <= KINDA_SMALL_NUMBER) { break; } } } } return ClosestPointDistance; } bool USkeletalMeshComponent::LineTraceComponent(struct FHitResult& OutHit, const FVector Start, const FVector End, const struct FCollisionQueryParams& Params) { UWorld* const World = GetWorld(); bool bHaveHit = false; float MinTime = MAX_FLT; FHitResult Hit; for (int32 BodyIdx=0; BodyIdx < Bodies.Num(); ++BodyIdx) { if (Bodies[BodyIdx]->LineTrace(Hit, Start, End, Params.bTraceComplex, Params.bReturnPhysicalMaterial)) { bHaveHit = true; if(MinTime > Hit.Time) { MinTime = Hit.Time; OutHit = Hit; } } } #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) if(World && (World->DebugDrawTraceTag != NAME_None) && (World->DebugDrawTraceTag == Params.TraceTag)) { TArray<FHitResult> Hits; if (bHaveHit) { Hits.Add(OutHit); } DrawLineTraces(GetWorld(), Start, End, Hits, DebugLineLifetime); } #endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST) return bHaveHit; } bool USkeletalMeshComponent::SweepComponent( FHitResult& OutHit, const FVector Start, const FVector End, const FCollisionShape& CollisionShape, bool bTraceComplex) { bool bHaveHit = false; for (int32 BodyIdx=0; BodyIdx < Bodies.Num(); ++BodyIdx) { if (Bodies[BodyIdx]->Sweep(OutHit, Start, End, CollisionShape, bTraceComplex)) { bHaveHit = true; } } return bHaveHit; } bool USkeletalMeshComponent::ComponentOverlapComponentImpl(class UPrimitiveComponent* PrimComp,const FVector Pos,const FQuat& Quat,const struct FCollisionQueryParams& Params) { //we do not support skeletal mesh vs skeletal mesh overlap test if (PrimComp->IsA<USkeletalMeshComponent>()) { UE_LOG(LogCollision, Log, TEXT("ComponentOverlapComponent : (%s) Does not support skeletalmesh with Physics Asset"), *PrimComp->GetPathName()); return false; } if (FBodyInstance* BI = PrimComp->GetBodyInstance()) { return BI->OverlapTestForBodies(Pos, Quat, Bodies); } return false; } bool USkeletalMeshComponent::OverlapComponent(const FVector& Pos, const FQuat& Rot, const FCollisionShape& CollisionShape) { for (FBodyInstance* Body : Bodies) { if (Body->OverlapTest(Pos, Rot, CollisionShape)) { return true; } } return false; } bool USkeletalMeshComponent::ComponentOverlapMultiImpl(TArray<struct FOverlapResult>& OutOverlaps, const UWorld* World, const FVector& Pos, const FQuat& Quat, ECollisionChannel TestChannel, const struct FComponentQueryParams& Params, const struct FCollisionObjectQueryParams& ObjectQueryParams) const { OutOverlaps.Reset(); if (!Bodies.IsValidIndex(RootBodyData.BodyIndex)) { return false; } const FTransform WorldToComponent(ComponentToWorld.Inverse()); const FCollisionResponseParams ResponseParams(GetCollisionResponseToChannels()); FComponentQueryParams ParamsWithSelf = Params; ParamsWithSelf.AddIgnoredComponent(this); bool bHaveBlockingHit = false; for (const FBodyInstance* Body : Bodies) { checkSlow(Body); if (Body->OverlapMulti(OutOverlaps, World, &WorldToComponent, Pos, Quat, TestChannel, ParamsWithSelf, ResponseParams, ObjectQueryParams)) { bHaveBlockingHit = true; } } return bHaveBlockingHit; } #if WITH_APEX_CLOTHING // convert a bone name from APEX stype to FBX style static FName GetConvertedBoneName(NxClothingAsset* ApexClothingAsset, int32 BoneIndex) { return *FString(ApexClothingAsset->getBoneName(BoneIndex)).Replace(TEXT(" "), TEXT("-")); } void USkeletalMeshComponent::AddClothingBounds(FBoxSphereBounds& InOutBounds) const { int32 NumAssets = ClothingActors.Num(); for(int32 i=0; i < NumAssets; i++) { if(IsValidClothingActor(i)) { NxClothingActor* Actor = ClothingActors[i].ApexClothingActor; if(Actor) { physx::PxBounds3 ApexClothingBounds = Actor->getBounds(); if (!ApexClothingBounds.isEmpty()) { FBoxSphereBounds BoxBounds = FBox( P2UVector(ApexClothingBounds.minimum), P2UVector(ApexClothingBounds.maximum) ); InOutBounds = InOutBounds + BoxBounds; } } } } } bool USkeletalMeshComponent::HasValidClothingActors() { for(int32 i=0; i < ClothingActors.Num(); i++) { if(IsValidClothingActor(i)) { return true; } } return false; } //if any changes in clothing assets, will create new actors void USkeletalMeshComponent::ValidateClothingActors() { //newly spawned component's tick group could be "specified tick group + 1" for the first few frames //but it comes back to original tick group soon if(PrimaryComponentTick.GetActualTickGroup() != PrimaryComponentTick.TickGroup) { return; } if(!SkeletalMesh) { return; } int32 NumAssets = SkeletalMesh->ClothingAssets.Num(); //if clothing assets are added or removed, re-create after removing all if(ClothingActors.Num() != NumAssets) { RemoveAllClothingActors(); if(NumAssets > 0) { ClothingActors.Empty(NumAssets); ClothingActors.AddZeroed(NumAssets); } } bool bNeedUpdateLOD = false; for(int32 AssetIdx=0; AssetIdx < NumAssets; AssetIdx++) { FClothingAssetData& ClothAsset = SkeletalMesh->ClothingAssets[AssetIdx]; // if there exist mapped sections for all LODs, create a clothing actor if (SkeletalMesh->HasClothSectionsInAllLODs(AssetIdx)) { if(CreateClothingActor(AssetIdx, ClothAsset.ApexClothingAsset)) { bNeedUpdateLOD = true; } } else { // don't have cloth sections but a clothing actor is alive if(IsValidClothingActor(AssetIdx)) { // clear this clothing actor because mapped sections are removed ClothingActors[AssetIdx].Clear(true); } } } if(bNeedUpdateLOD) { SetClothingLOD(PredictedLODLevel); } } /** * APEX clothing actor is created from APEX clothing asset for cloth simulation * If this is invalid, re-create actor , but if valid ,just skip to create */ bool USkeletalMeshComponent::CreateClothingActor(int32 AssetIndex, physx::apex::NxClothingAsset* ClothingAsset, TArray<FVector>* BlendedDelta) { int32 NumActors = ClothingActors.Num(); int32 ActorIndex = -1; //check we need to expand ClothingActors array //actor is totally corresponding to asset, 1-on-1, so asset index should be same as actor index if(AssetIndex < NumActors) { ActorIndex = AssetIndex; if(IsValidClothingActor(ActorIndex)) { // a valid actor already exists return false; } else { //removed or changed or not-created yet ClothingActors[ActorIndex].Clear(); } } if(ActorIndex < 0) { ActorIndex = ClothingActors.AddZeroed(); } // Get the (singleton!) default actor descriptor. NxParameterized::Interface* ActorDesc = ClothingAsset->getDefaultActorDesc(); PX_ASSERT(ActorDesc != NULL); // Run Cloth on the GPU verify(NxParameterized::setParamBool(*ActorDesc, "useHardwareCloth", true)); verify(NxParameterized::setParamBool(*ActorDesc, "updateStateWithGlobalMatrices", true)); FVector ScaleVector = ComponentToWorld.GetScale3D(); //support only uniform scale verify(NxParameterized::setParamF32(*ActorDesc, "actorScale", ScaleVector.X)); bool bUseInternalBoneOrder = true; verify(NxParameterized::setParamBool(*ActorDesc,"useInternalBoneOrder",bUseInternalBoneOrder)); verify(NxParameterized::setParamF32(*ActorDesc,"maxDistanceBlendTime",1.0f)); verify(NxParameterized::setParamF32(*ActorDesc,"lodWeights.maxDistance",10000)); verify(NxParameterized::setParamF32(*ActorDesc,"lodWeights.distanceWeight",1.0f)); verify(NxParameterized::setParamF32(*ActorDesc,"lodWeights.bias",0)); verify(NxParameterized::setParamF32(*ActorDesc,"lodWeights.benefitsBias",0)); verify(NxParameterized::setParamBool(*ActorDesc, "localSpaceSim", bLocalSpaceSimulation)); // Initialize the global pose FMatrix UGlobalPose = ComponentToWorld.ToMatrixWithScale(); physx::PxMat44 PxGlobalPose = U2PMatrix(UGlobalPose); PxGlobalPose = physx::PxMat44::createIdentity(); verify(NxParameterized::setParamMat44(*ActorDesc, "globalPose", PxGlobalPose)); // set max distance scale // if set "maxDistanceScale.Multipliable" to true, scaled result looks more natural // @TODO : need to expose "Multipliable"? verify(NxParameterized::setParamBool(*ActorDesc, "maxDistanceScale.Multipliable", true)); verify(NxParameterized::setParamF32(*ActorDesc, "maxDistanceScale.Scale", ClothMaxDistanceScale)); // apply delta positions of cloth morph target if (BlendedDelta) { int32 NumBlendData = BlendedDelta->Num(); TArray<PxVec3> PxBlendedData; PxBlendedData.AddUninitialized(NumBlendData); for (int32 Index = 0; Index < NumBlendData; Index++) { PxBlendedData[Index] = U2PVector((*BlendedDelta)[Index]); } NxParameterized::Handle md(*ActorDesc, "morphDisplacements"); md.resizeArray(PxBlendedData.Num()); md.setParamVec3Array(PxBlendedData.GetData(), PxBlendedData.Num()); } FPhysScene* PhysScene = NULL; if(GetWorld()) { PhysScene = GetWorld()->GetPhysicsScene(); } //this clothing actor would be crated later because this becomes invalid if(!PhysScene) { return false; } physx::apex::NxApexScene* ScenePtr = PhysScene->GetApexScene(PST_Cloth); if(!ScenePtr) { // can't create clothing actor UE_LOG(LogSkeletalMesh, Log, TEXT("CreateClothingActor: Failed to create an actor becauase PhysX Scene doesn't exist")); return false; } physx::apex::NxApexActor* apexActor = ClothingAsset->createApexActor(*ActorDesc, *ScenePtr); physx::apex::NxClothingActor* ClothingActor = static_cast<physx::apex::NxClothingActor*>(apexActor); ClothingActors[ActorIndex].ApexClothingActor = ClothingActor; ClothingActors[ActorIndex].SceneType = PST_Cloth; ClothingActors[ActorIndex].PhysScene = PhysScene; if(!ClothingActor) { UE_LOG(LogSkeletalMesh, Log, TEXT("CreateClothingActor: Failed to create an clothing actor (%s)"), ANSI_TO_TCHAR(ClothingAsset->getName())); return false; } //set parent pointer to verify later whether became invalid or not ClothingActors[ActorIndex].ParentClothingAsset = ClothingAsset; // budget is millisecond units ScenePtr->setLODResourceBudget(100); // for temporary, 100ms ClothingActor->setGraphicalLOD(PredictedLODLevel); // 0 means no simulation ClothingActor->forcePhysicalLod(1); // 1 will be changed to "GetActivePhysicalLod()" later ClothingActor->setFrozen(false); #if WITH_CLOTH_COLLISION_DETECTION // process clothing collisions once for the case that this component doesn't move if(bCollideWithEnvironment) { ProcessClothCollisionWithEnvironment(); } #endif // WITH_CLOTH_COLLISION_DETECTION return true; } void USkeletalMeshComponent::SetClothingLOD(int32 LODIndex) { int32 NumActors = ClothingActors.Num(); bool bFrozen = false; for (int32 AssetIndex = 0; AssetIndex<NumActors; AssetIndex++) { if (IsValidClothingActor(AssetIndex)) { FClothingActor& Actor = ClothingActors[AssetIndex]; int32 CurLODIndex = (int32)Actor.ApexClothingActor->getGraphicalLod(); // check whether clothing LOD is mapped for this LOD index bool IsMappedClothLOD = SkeletalMesh->IsMappedClothingLOD(LODIndex, AssetIndex); // Change Clothing LOD if a new LOD index is different from the current index if (IsMappedClothLOD && CurLODIndex != LODIndex) { //physical LOD is changed by graphical LOD Actor.ApexClothingActor->setGraphicalLOD(LODIndex); if (Actor.ApexClothingActor->isFrozen()) { bFrozen = true; } } int32 NumClothLODs = Actor.ParentClothingAsset->getNumGraphicalLodLevels(); // decide whether should enable or disable if (!IsMappedClothLOD || (LODIndex >= NumClothLODs)) { //disable clothing simulation Actor.ApexClothingActor->forcePhysicalLod(0); } else { int32 CurPhysLOD = Actor.ApexClothingActor->getActivePhysicalLod(); // if disabled, enables clothing simulation if(CurPhysLOD == 0) { Actor.ApexClothingActor->forcePhysicalLod(1); } } } } if(bFrozen) { #if WITH_EDITOR FMessageDialog::Open(EAppMsgType::Ok, NSLOCTEXT("SkelmeshComponent", "Warning_FrozenCloth", "Clothing will be melted from frozen state")); #endif // melt it because rendering mesh will be broken if frozen when changing LODs FreezeClothSection(false); } } void USkeletalMeshComponent::RemoveAllClothingActors() { int32 NumActors = ClothingActors.Num(); for(int32 i=0; i<NumActors; i++) { ClothingActors[i].Clear(IsValidClothingActor(i)); } ClothingActors.Empty(); } void USkeletalMeshComponent::ReleaseAllClothingResources() { #if WITH_CLOTH_COLLISION_DETECTION ReleaseAllParentCollisions(); ReleaseAllChildrenCollisions(); // should be called before removing clothing actors RemoveAllOverlappedComponentMap(); #endif // #if WITH_CLOTH_COLLISION_DETECTION #if WITH_APEX_CLOTHING RemoveAllClothingActors(); #endif// #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::ApplyWindForCloth(FClothingActor& ClothingActor) { //to convert from normalized value( usually 0.0 to 1.0 ) to Apex clothing wind value const float WindUnitAmout = 2500.0f; NxClothingActor* ApexClothingActor = ClothingActor.ApexClothingActor; if(!ApexClothingActor) { return; } if(World && World->Scene) { // set wind if(IsWindEnabled()) { FVector Position = ComponentToWorld.GetTranslation(); FVector WindDirection; float WindSpeed; float WindMinGust; float WindMaxGust; World->Scene->GetWindParameters(Position, WindDirection, WindSpeed, WindMinGust, WindMaxGust); physx::PxVec3 WindVelocity(WindDirection.X, WindDirection.Y, WindDirection.Z); WindVelocity *= WindUnitAmout * WindSpeed; float WindAdaption = rand()%20 * 0.1f; // make range from 0 to 2 NxParameterized::Interface* ActorDesc = ApexClothingActor->getActorDesc(); if(ActorDesc) { verify(NxParameterized::setParamVec3(*ActorDesc, "windParams.Velocity", WindVelocity)); verify(NxParameterized::setParamF32(*ActorDesc, "windParams.Adaption", WindAdaption)); } } else { physx::PxVec3 WindVelocity(0.0f); NxParameterized::Interface* ActorDesc = ApexClothingActor->getActorDesc(); if(ActorDesc) { verify(NxParameterized::setParamVec3(*ActorDesc, "windParams.Velocity", WindVelocity)); // if turned off the wind, will do fast adaption verify(NxParameterized::setParamF32(*ActorDesc, "windParams.Adaption", 2.0f)); } } } } #endif// #if WITH_APEX_CLOTHING #if WITH_CLOTH_COLLISION_DETECTION void USkeletalMeshComponent::DrawDebugConvexFromPlanes(FClothCollisionPrimitive& CollisionPrimitive, FColor& Color, bool bDrawWithPlanes) { int32 NumPlanes = CollisionPrimitive.ConvexPlanes.Num(); //draw with planes if(bDrawWithPlanes) { for(int32 PlaneIdx=0; PlaneIdx < NumPlanes; PlaneIdx++) { FPlane& Plane = CollisionPrimitive.ConvexPlanes[PlaneIdx]; DrawDebugSolidPlane(GetWorld(), Plane, CollisionPrimitive.Origin, 10, Color); } } else { FVector UniquePoint; TArray<FVector> UniqueIntersectPoints; TArray<FPlane>& Planes = CollisionPrimitive.ConvexPlanes; //find all unique intersected points for(int32 i=0; i < NumPlanes; i++) { FPlane Plane1 = Planes[i]; for(int32 j=i+1; j < NumPlanes; j++) { FPlane Plane2 = Planes[j]; for(int32 k=j+1; k < NumPlanes; k++) { FPlane Plane3 = Planes[k]; if(FMath::IntersectPlanes3(UniquePoint, Plane1, Plane2, Plane3)) { UniqueIntersectPoints.Add(UniquePoint); } } } } int32 NumPts = UniqueIntersectPoints.Num(); //shows all connected lines for just debugging for(int32 i=0; i < NumPts; i++) { for(int32 j=i+1; j < NumPts; j++) { DrawDebugLine(GetWorld(), UniqueIntersectPoints[i], UniqueIntersectPoints[j], Color, false, -1, SDPG_World, 2.0f); } } } } void USkeletalMeshComponent::DrawDebugClothCollisions() { FColor Colors[6] = { FColor::Red, FColor::Green, FColor::Blue, FColor::Cyan, FColor::Yellow, FColor::Magenta }; for( auto It = ClothOverlappedComponentsMap.CreateConstIterator(); It; ++It ) { TWeakObjectPtr<UPrimitiveComponent> PrimComp = It.Key(); TArray<FClothCollisionPrimitive> CollisionPrims; ECollisionChannel Channel = PrimComp->GetCollisionObjectType(); if (Channel == ECollisionChannel::ECC_WorldStatic) { if (!GetClothCollisionDataFromStaticMesh(PrimComp.Get(), CollisionPrims)) { return; } for(int32 PrimIndex=0; PrimIndex < CollisionPrims.Num(); PrimIndex++) { switch(CollisionPrims[PrimIndex].PrimType) { case FClothCollisionPrimitive::SPHERE: DrawDebugSphere(GetWorld(), CollisionPrims[PrimIndex].Origin, CollisionPrims[PrimIndex].Radius, 10, FColor::Red); break; case FClothCollisionPrimitive::CAPSULE: { FVector DiffVec = CollisionPrims[PrimIndex].SpherePos2 - CollisionPrims[PrimIndex].SpherePos1; float HalfHeight = DiffVec.Size() * 0.5f; FQuat Rotation = PrimComp->ComponentToWorld.GetRotation(); DrawDebugCapsule(GetWorld(), CollisionPrims[PrimIndex].Origin, HalfHeight, CollisionPrims[PrimIndex].Radius, Rotation, FColor::Red ); } break; case FClothCollisionPrimitive::CONVEX: DrawDebugConvexFromPlanes(CollisionPrims[PrimIndex], Colors[PrimIndex%6]); break; case FClothCollisionPrimitive::PLANE: break; } //draw a bounding box for double checking DrawDebugBox(GetWorld(), PrimComp->Bounds.Origin, PrimComp->Bounds.BoxExtent, FColor::Red ); } } else if (Channel == ECollisionChannel::ECC_PhysicsBody) // supports an interaction between the character and other clothing such as a curtain { bool bCreatedCollisions = false; // if a component is a skeletal mesh component with clothing, add my collisions to the component USkeletalMeshComponent* SkelMeshComp = Cast<USkeletalMeshComponent>(PrimComp.Get()); if (SkelMeshComp && SkelMeshComp->SkeletalMesh) { if (SkelMeshComp->ClothingActors.Num() > 0) { TArray<FApexClothCollisionVolumeData> NewCollisions; FindClothCollisions(NewCollisions); for (int32 ColIdx = 0; ColIdx < NewCollisions.Num(); ColIdx++) { if (NewCollisions[ColIdx].IsCapsule()) { FVector Origin = NewCollisions[ColIdx].LocalPose.GetOrigin(); // apex uses y-axis as the up-axis of capsule FVector UpAxis = NewCollisions[ColIdx].LocalPose.GetScaledAxis(EAxis::Y); float Radius = NewCollisions[ColIdx].CapsuleRadius*UpAxis.Size(); float HalfHeight = NewCollisions[ColIdx].CapsuleHeight*0.5f; FMatrix Pose = NewCollisions[ColIdx].LocalPose; FMatrix RotMat(Pose.GetScaledAxis(EAxis::X), Pose.GetScaledAxis(EAxis::Z), Pose.GetScaledAxis(EAxis::Y), FVector(0,0,0)); FQuat Rotation = RotMat.ToQuat(); DrawDebugCapsule(GetWorld(), Origin, HalfHeight, Radius, Rotation, FColor::Red); } } } } } } //draw this skeletal mesh component's bounding box DrawDebugBox(GetWorld(), Bounds.Origin, Bounds.BoxExtent, FColor::Red); } bool USkeletalMeshComponent::GetClothCollisionDataFromStaticMesh(UPrimitiveComponent* PrimComp, TArray<FClothCollisionPrimitive>& ClothCollisionPrimitives) { //make sure Num of collisions should be 0 in the case this returns false ClothCollisionPrimitives.Empty(); if(!PrimComp) { return false; } ECollisionChannel Channel = PrimComp->GetCollisionObjectType(); // accept only a static mesh if (Channel != ECollisionChannel::ECC_WorldStatic) { return false; } if (!PrimComp->BodyInstance.IsValidBodyInstance()) { return false; } bool bSuccess = false; PrimComp->BodyInstance.ExecuteOnPhysicsReadOnly([&] { TArray<PxShape*> AllShapes; const int32 NumSyncShapes = PrimComp->BodyInstance.GetAllShapes_AssumesLocked(AllShapes); if (NumSyncShapes == 0 || NumSyncShapes > 3) //skipping complicated object because of collision limitation { return; } FVector Center = PrimComp->Bounds.Origin; FTransform Transform = PrimComp->ComponentToWorld; FMatrix TransMat = Transform.ToMatrixWithScale(); for (int32 ShapeIdx = 0; ShapeIdx < NumSyncShapes; ShapeIdx++) { PxGeometryType::Enum GeomType = AllShapes[ShapeIdx]->getGeometryType(); switch (GeomType) { case PxGeometryType::eSPHERE: { FClothCollisionPrimitive ClothPrimData; PxSphereGeometry SphereGeom; AllShapes[ShapeIdx]->getSphereGeometry(SphereGeom); ClothPrimData.Origin = Center; ClothPrimData.Radius = SphereGeom.radius; ClothPrimData.PrimType = FClothCollisionPrimitive::SPHERE; ClothCollisionPrimitives.Add(ClothPrimData); } break; case PxGeometryType::eCAPSULE: { FClothCollisionPrimitive ClothPrimData; PxCapsuleGeometry CapsuleGeom; AllShapes[ShapeIdx]->getCapsuleGeometry(CapsuleGeom); ClothPrimData.Origin = Center; ClothPrimData.Radius = CapsuleGeom.radius; FVector ZAxis = TransMat.GetUnitAxis(EAxis::Z); float Radius = CapsuleGeom.radius; float HalfHeight = CapsuleGeom.halfHeight; ClothPrimData.SpherePos1 = Center + (HalfHeight * ZAxis); ClothPrimData.SpherePos2 = Center - (HalfHeight * ZAxis); ClothPrimData.PrimType = FClothCollisionPrimitive::CAPSULE; ClothCollisionPrimitives.Add(ClothPrimData); } break; case PxGeometryType::eBOX: { FClothCollisionPrimitive ClothPrimData; ClothPrimData.Origin = Center; ClothPrimData.Radius = 0; PxBoxGeometry BoxGeom; AllShapes[ShapeIdx]->getBoxGeometry(BoxGeom); ClothPrimData.ConvexPlanes.Empty(6); //box has 6 planes FPlane UPlane1(1, 0, 0, Center.X + BoxGeom.halfExtents.x); UPlane1 = UPlane1.TransformBy(TransMat); ClothPrimData.ConvexPlanes.Add(UPlane1); FPlane UPlane2(-1, 0, 0, Center.X - BoxGeom.halfExtents.x); UPlane2 = UPlane2.TransformBy(TransMat); ClothPrimData.ConvexPlanes.Add(UPlane2); FPlane UPlane3(0, 1, 0, Center.Y + BoxGeom.halfExtents.y); UPlane3 = UPlane3.TransformBy(TransMat); ClothPrimData.ConvexPlanes.Add(UPlane3); FPlane UPlane4(0, -1, 0, Center.Y - BoxGeom.halfExtents.y); UPlane4 = UPlane4.TransformBy(TransMat); ClothPrimData.ConvexPlanes.Add(UPlane4); FPlane UPlane5(0, 0, 1, Center.Z + BoxGeom.halfExtents.z); UPlane5 = UPlane5.TransformBy(TransMat); ClothPrimData.ConvexPlanes.Add(UPlane5); FPlane UPlane6(0, 0, -1, Center.Z - BoxGeom.halfExtents.z); UPlane6 = UPlane6.TransformBy(TransMat); ClothPrimData.ConvexPlanes.Add(UPlane6); ClothPrimData.PrimType = FClothCollisionPrimitive::CONVEX; ClothCollisionPrimitives.Add(ClothPrimData); } break; case PxGeometryType::eCONVEXMESH: { PxConvexMeshGeometry ConvexGeom; AllShapes[ShapeIdx]->getConvexMeshGeometry(ConvexGeom); if (ConvexGeom.convexMesh) { FClothCollisionPrimitive ClothPrimData; ClothPrimData.Origin = Center; ClothPrimData.Radius = 0; uint32 NumPoly = ConvexGeom.convexMesh->getNbPolygons(); ClothPrimData.ConvexPlanes.Empty(NumPoly); for (uint32 Poly = 0; Poly < NumPoly; Poly++) { PxHullPolygon HullData; ConvexGeom.convexMesh->getPolygonData(Poly, HullData); physx::PxPlane PPlane(HullData.mPlane[0], HullData.mPlane[1], HullData.mPlane[2], HullData.mPlane[3]); FPlane UPlane = P2UPlane(PPlane); UPlane = UPlane.TransformBy(TransMat); ClothPrimData.ConvexPlanes.Add(UPlane); } ClothPrimData.PrimType = FClothCollisionPrimitive::CONVEX; ClothCollisionPrimitives.Add(ClothPrimData); } } break; } } bSuccess = true; }); return bSuccess; } void USkeletalMeshComponent::FindClothCollisions(TArray<FApexClothCollisionVolumeData>& OutCollisions) { if (!SkeletalMesh) { return; } int32 NumAssets = SkeletalMesh->ClothingAssets.Num(); // find all new collisions passing to children for (int32 AssetIdx = 0; AssetIdx < NumAssets; AssetIdx++) { FClothingAssetData& Asset = SkeletalMesh->ClothingAssets[AssetIdx]; int32 NumCollisions = Asset.ClothCollisionVolumes.Num(); int32 ConvexCount = 0; for (int32 ColIdx = 0; ColIdx < NumCollisions; ColIdx++) { FApexClothCollisionVolumeData& Collision = Asset.ClothCollisionVolumes[ColIdx]; if (Collision.BoneIndex < 0) { continue; } FName BoneName = GetConvertedBoneName(Asset.ApexClothingAsset, Collision.BoneIndex); int32 BoneIndex = GetBoneIndex(BoneName); if (BoneIndex < 0) { continue; } FMatrix BoneMat = GetBoneMatrix(BoneIndex); FMatrix LocalToWorld = Collision.LocalPose * BoneMat; if (Collision.IsCapsule()) { FApexClothCollisionVolumeData NewCollision = Collision; NewCollision.LocalPose = LocalToWorld; OutCollisions.Add(NewCollision); } else { if (Asset.ClothCollisionConvexPlaneIndices.IsValidIndex(ConvexCount)) { uint32 PlaneIndices = Asset.ClothCollisionConvexPlaneIndices[ConvexCount]; uint32 BitShiftIndex = 1; for (uint32 PlaneIndex = 0; PlaneIndex < 32; PlaneIndex++) { if (PlaneIndices&BitShiftIndex) { FPlane UPlane = Asset.ClothCollisionVolumePlanes[PlaneIndex].PlaneData; check(Collision.BoneIndex == Asset.ClothCollisionVolumePlanes[PlaneIndex].BoneIndex); UPlane = UPlane.TransformBy(BoneMat); Collision.BonePlanes.Add(UPlane); } // shift 1 bit because a bit index means a plane's index BitShiftIndex <<= 1; } } ConvexCount++; } } } } void USkeletalMeshComponent::CreateInternalClothCollisions(TArray<FApexClothCollisionVolumeData>& InCollisions, TArray<physx::apex::NxClothingCollision*>& OutCollisions) { int32 NumCollisions = InCollisions.Num(); const int32 MaxNumCapsules = 16; // because sphere number can not be larger than 32 and 1 capsule takes 2 spheres NumCollisions = FMath::Min(NumCollisions, MaxNumCapsules); int32 NumActors = ClothingActors.Num(); for(int32 ActorIdx=0; ActorIdx < NumActors; ActorIdx++) { if (!IsValidClothingActor(ActorIdx)) { continue; } NxClothingActor* Actor = ClothingActors[ActorIdx].ApexClothingActor; int32 NumCurrentCapsules = SkeletalMesh->ClothingAssets[ActorIdx].ClothCollisionVolumes.Num(); // # of capsules for(int32 ColIdx=0; ColIdx < NumCollisions; ColIdx++) { // capsules if (InCollisions[ColIdx].IsCapsule()) { if(NumCurrentCapsules < MaxNumCapsules) { FVector Origin = InCollisions[ColIdx].LocalPose.GetOrigin(); // apex uses y-axis as the up-axis of capsule FVector UpAxis = InCollisions[ColIdx].LocalPose.GetScaledAxis(EAxis::Y); float Radius = InCollisions[ColIdx].CapsuleRadius*UpAxis.Size(); float HalfHeight = InCollisions[ColIdx].CapsuleHeight*0.5f; const FVector TopEnd = Origin + (HalfHeight * UpAxis); const FVector BottomEnd = Origin - (HalfHeight * UpAxis); NxClothingSphere* Sphere1 = Actor->createCollisionSphere(U2PVector(TopEnd), Radius); NxClothingSphere* Sphere2 = Actor->createCollisionSphere(U2PVector(BottomEnd), Radius); NxClothingCapsule* Capsule = Actor->createCollisionCapsule(*Sphere1, *Sphere2); OutCollisions.Add(Capsule); NumCurrentCapsules++; } } else // convexes { int32 NumPlanes = InCollisions[ColIdx].BonePlanes.Num(); TArray<NxClothingPlane*> ClothingPlanes; //can not exceed 32 planes NumPlanes = FMath::Min(NumPlanes, 32); ClothingPlanes.AddUninitialized(NumPlanes); for(int32 PlaneIdx=0; PlaneIdx < NumPlanes; PlaneIdx++) { PxPlane PPlane = U2PPlane(InCollisions[ColIdx].BonePlanes[PlaneIdx]); ClothingPlanes[PlaneIdx] = Actor->createCollisionPlane(PPlane); } NxClothingConvex* Convex = Actor->createCollisionConvex(ClothingPlanes.GetData(), ClothingPlanes.Num()); OutCollisions.Add(Convex); } } } } void USkeletalMeshComponent::CopyClothCollisionsToChildren() { // 3 steps // 1. release all previous parent collisions // 2. find new collisions from parent(this class) // 3. add new collisions to children int32 NumChildren = AttachChildren.Num(); TArray<USkeletalMeshComponent*> ClothChildren; for(int32 i=0; i < NumChildren; i++) { USkeletalMeshComponent* pChild = Cast<USkeletalMeshComponent>(AttachChildren[i]); if(pChild) { int32 NumActors = pChild->ClothingActors.Num(); if(NumActors > 0) { ClothChildren.Add(pChild); // release all parent collisions pChild->ReleaseAllParentCollisions(); } } } int32 NumClothChildren = ClothChildren.Num(); if(NumClothChildren == 0) { return; } TArray<FApexClothCollisionVolumeData> NewCollisions; FindClothCollisions(NewCollisions); for(int32 ChildIdx=0; ChildIdx < NumClothChildren; ChildIdx++) { ClothChildren[ChildIdx]->CreateInternalClothCollisions(NewCollisions, ClothChildren[ChildIdx]->ParentCollisions); } } void USkeletalMeshComponent::ReleaseAllChildrenCollisions() { for(int32 i=0; i<ChildrenCollisions.Num(); i++) { ReleaseClothingCollision(ChildrenCollisions[i]); } ChildrenCollisions.Empty(); } // children's collisions can affect to parent's cloth reversely void USkeletalMeshComponent::CopyChildrenClothCollisionsToParent() { // 3 steps // 1. release all previous children collisions // 2. find new collisions from children // 3. add new collisions to parent (this component) ReleaseAllChildrenCollisions(); int32 NumChildren = AttachChildren.Num(); TArray<USkeletalMeshComponent*> ClothCollisionChildren; TArray<FApexClothCollisionVolumeData> NewCollisions; for(int32 i=0; i < NumChildren; i++) { USkeletalMeshComponent* pChild = Cast<USkeletalMeshComponent>(AttachChildren[i]); if(pChild) { pChild->FindClothCollisions(NewCollisions); } } CreateInternalClothCollisions(NewCollisions, ChildrenCollisions); } void USkeletalMeshComponent::ReleaseClothingCollision(NxClothingCollision* Collision) { switch(Collision->getType()) { case NxClothingCollisionType::Capsule: { NxClothingCapsule* Capsule = static_cast<NxClothingCapsule*>(Collision); check(Capsule); Capsule->releaseWithSpheres(); } break; case NxClothingCollisionType::Convex: { NxClothingConvex* Convex = static_cast<NxClothingConvex*>(Collision); check(Convex); Convex->releaseWithPlanes(); } break; default: Collision->release(); break; } } FApexClothCollisionInfo* USkeletalMeshComponent::CreateNewClothingCollsions(UPrimitiveComponent* PrimitiveComponent) { FApexClothCollisionInfo NewInfo; TArray<FClothCollisionPrimitive> CollisionPrims; ECollisionChannel Channel = PrimitiveComponent->GetCollisionObjectType(); // crate new clothing collisions for a static mesh if (Channel == ECollisionChannel::ECC_WorldStatic) { if (!GetClothCollisionDataFromStaticMesh(PrimitiveComponent, CollisionPrims)) { return NULL; } NewInfo.OverlapCompType = FApexClothCollisionInfo::OCT_STATIC; int32 NumActors = ClothingActors.Num(); for(int32 ActorIdx=0; ActorIdx < NumActors; ActorIdx++) { NxClothingActor* Actor = ClothingActors[ActorIdx].ApexClothingActor; if(Actor) { for(int32 PrimIndex=0; PrimIndex < CollisionPrims.Num(); PrimIndex++) { NxClothingCollision* ClothCol = NULL; switch(CollisionPrims[PrimIndex].PrimType) { case FClothCollisionPrimitive::SPHERE: ClothCol = Actor->createCollisionSphere(U2PVector(CollisionPrims[PrimIndex].Origin), CollisionPrims[PrimIndex].Radius); if(ClothCol) { NewInfo.ClothingCollisions.Add(ClothCol); } break; case FClothCollisionPrimitive::CAPSULE: { float Radius = CollisionPrims[PrimIndex].Radius; NxClothingSphere* Sphere1 = Actor->createCollisionSphere(U2PVector(CollisionPrims[PrimIndex].SpherePos1), Radius); NxClothingSphere* Sphere2 = Actor->createCollisionSphere(U2PVector(CollisionPrims[PrimIndex].SpherePos2), Radius); ClothCol = Actor->createCollisionCapsule(*Sphere1, *Sphere2); if(ClothCol) { NewInfo.ClothingCollisions.Add(ClothCol); } } break; case FClothCollisionPrimitive::CONVEX: int32 NumPlanes = CollisionPrims[PrimIndex].ConvexPlanes.Num(); TArray<NxClothingPlane*> ClothingPlanes; //can not exceed 32 planes NumPlanes = FMath::Min(NumPlanes, 32); ClothingPlanes.AddUninitialized(NumPlanes); for(int32 PlaneIdx=0; PlaneIdx < NumPlanes; PlaneIdx++) { PxPlane PPlane = U2PPlane(CollisionPrims[PrimIndex].ConvexPlanes[PlaneIdx]); ClothingPlanes[PlaneIdx] = Actor->createCollisionPlane(PPlane); } ClothCol = Actor->createCollisionConvex(ClothingPlanes.GetData(), ClothingPlanes.Num()); if(ClothCol) { NewInfo.ClothingCollisions.Add(ClothCol); } break; } } } } } else if (Channel == ECollisionChannel::ECC_PhysicsBody) // creates new clothing collisions for clothing objects { bool bCreatedCollisions = false; // if a component is a skeletal mesh component with clothing, add my collisions to the component USkeletalMeshComponent* SkelMeshComp = Cast<USkeletalMeshComponent>(PrimitiveComponent); if (SkelMeshComp && SkelMeshComp->SkeletalMesh) { // if a casted skeletal mesh component is myself, then skip if (SkelMeshComp == this) { return NULL; } if (SkelMeshComp->ClothingActors.Num() > 0) { TArray<FApexClothCollisionVolumeData> NewCollisions; // get collision infos computed by current bone transforms FindClothCollisions(NewCollisions); if (NewCollisions.Num() > 0) { NewInfo.OverlapCompType = FApexClothCollisionInfo::OCT_CLOTH; SkelMeshComp->CreateInternalClothCollisions(NewCollisions, NewInfo.ClothingCollisions); bCreatedCollisions = true; } } } if (bCreatedCollisions == false) { return NULL; } } return &ClothOverlappedComponentsMap.Add(PrimitiveComponent, NewInfo); } void USkeletalMeshComponent::RemoveAllOverlappedComponentMap() { for( auto It = ClothOverlappedComponentsMap.CreateConstIterator(); It; ++It ) { const FApexClothCollisionInfo& Info = It.Value(); for(int32 i=0; i < Info.ClothingCollisions.Num(); i++) { ReleaseClothingCollision(Info.ClothingCollisions[i]); } ClothOverlappedComponentsMap.Remove(It.Key()); } ClothOverlappedComponentsMap.Empty(); } void USkeletalMeshComponent::ReleaseAllParentCollisions() { for(int32 i=0; i<ParentCollisions.Num(); i++) { ReleaseClothingCollision(ParentCollisions[i]); } ParentCollisions.Empty(); } void USkeletalMeshComponent::UpdateOverlappedComponent(UPrimitiveComponent* PrimComp, FApexClothCollisionInfo* Info) { if (Info->OverlapCompType == FApexClothCollisionInfo::OCT_CLOTH) { int32 NumCollisions = Info->ClothingCollisions.Num(); for (int32 i = 0; i < NumCollisions; i++) { ReleaseClothingCollision(Info->ClothingCollisions[i]); } Info->ClothingCollisions.Empty(NumCollisions); TArray<FApexClothCollisionVolumeData> NewCollisions; FindClothCollisions(NewCollisions); if (NewCollisions.Num() > 0) { USkeletalMeshComponent *SkelMeshComp = Cast<USkeletalMeshComponent>(PrimComp); if (SkelMeshComp) { SkelMeshComp->CreateInternalClothCollisions(NewCollisions, Info->ClothingCollisions); } } } } void USkeletalMeshComponent::ProcessClothCollisionWithEnvironment() { // don't handle collision detection if this component is in editor if(!GetWorld()->IsGameWorld()) { return; } // Increment the revision number ClothingCollisionRevision++; TArray<FOverlapResult> Overlaps; FCollisionObjectQueryParams ObjectParams; ObjectParams.AddObjectTypesToQuery(ECollisionChannel::ECC_WorldStatic); // to collide with other clothing objects ObjectParams.AddObjectTypesToQuery(ECollisionChannel::ECC_PhysicsBody); static FName ClothOverlapComponentsName(TEXT("ClothOverlapComponents")); FCollisionQueryParams Params(ClothOverlapComponentsName, false); GetWorld()->OverlapMultiByObjectType(Overlaps, Bounds.Origin, FQuat::Identity, ObjectParams, FCollisionShape::MakeBox(Bounds.BoxExtent), Params); for (int32 OverlapIdx=0; OverlapIdx<Overlaps.Num(); ++OverlapIdx) { const TWeakObjectPtr<UPrimitiveComponent>& Component = Overlaps[OverlapIdx].Component; if (Component.IsValid()) { // add intersected cloth collision FApexClothCollisionInfo* Info = ClothOverlappedComponentsMap.Find(Component); if(!Info) { Info = CreateNewClothingCollsions(Component.Get()); } // update new or valid entries to the current revision number if(Info) { Info->Revision = ClothingCollisionRevision; // if this component needs update every tick UpdateOverlappedComponent(Component.Get(), Info); } } } // releases all invalid collisions in overlapped list for( auto It = ClothOverlappedComponentsMap.CreateConstIterator(); It; ++It ) { const FApexClothCollisionInfo& Info = It.Value(); // Anything not updated above will have an old revision number. if( Info.Revision != ClothingCollisionRevision ) { for(int32 i=0; i < Info.ClothingCollisions.Num(); i++) { ReleaseClothingCollision(Info.ClothingCollisions[i]); } ClothOverlappedComponentsMap.Remove(It.Key()); } } } #endif// #if WITH_CLOTH_COLLISION_DETECTION void USkeletalMeshComponent::PreClothTick(float DeltaTime, FTickFunction& ThisTickFunction) { //IMPORTANT! // // The decision on whether to use PreClothTick or not is made by ShouldRunPreClothTick() // Any changes that are made to PreClothTick that effect whether it should be run or not // have to be reflected in ShouldRunPreClothTick() as well // if physics is disabled on dedicated server, no reason to be here. if (!bEnablePhysicsOnDedicatedServer && IsRunningDedicatedServer()) { FinalizeBoneTransform(); return; } if (IsRegistered() && IsSimulatingPhysics()) { SyncComponentToRBPhysics(); } // this used to not run if not rendered, but that causes issues such as bounds not updated // causing it to not rendered, at the end, I think we should blend body positions // for example if you're only simulating, this has to happen all the time // whether looking at it or not, otherwise // @todo better solution is to check if it has moved by changing SyncComponentToRBPhysics to return true if anything modified // and run this if that is true or rendered // that will at least reduce the chance of mismatch // generally if you move your actor position, this has to happen to approximately match their bounds if (ShouldBlendPhysicsBones()) { if (IsRegistered()) { BlendInPhysics(ThisTickFunction); } } #if WITH_APEX_CLOTHING // if skeletal mesh has clothing assets, call TickClothing if (SkeletalMesh && SkeletalMesh->ClothingAssets.Num() > 0) { TickClothing(DeltaTime, ThisTickFunction); } #endif } #if WITH_APEX_CLOTHING void USkeletalMeshComponent::UpdateClothTransform() { int32 NumActors = ClothingActors.Num(); #if WITH_CLOTH_COLLISION_DETECTION if(bCollideWithAttachedChildren) { CopyClothCollisionsToChildren(); } //check the environment when only transform is updated if(bCollideWithEnvironment && NumActors > 0) { ProcessClothCollisionWithEnvironment(); } #endif // WITH_CLOTH_COLLISION_DETECTION physx::PxMat44 PxGlobalPose = U2PMatrix(ComponentToWorld.ToMatrixWithScale()); for(int32 ActorIdx=0; ActorIdx<NumActors; ActorIdx++) { // skip if ClothingActor is NULL or invalid if(!IsValidClothingActor(ActorIdx)) { continue; } NxClothingActor* ClothingActor = ClothingActors[ActorIdx].ApexClothingActor; check(ClothingActor); NxParameterized::Interface* ActorDesc = ClothingActor->getActorDesc(); verify(NxParameterized::setParamMat44(*ActorDesc, "globalPose", PxGlobalPose)); } } void USkeletalMeshComponent::CheckClothTeleport(float DeltaTime) { // Get the root bone transform FMatrix CurRootBoneMat = GetBoneMatrix(0); if(bNeedTeleportAndResetOnceMore) { ForceClothNextUpdateTeleportAndReset(); bNeedTeleportAndResetOnceMore = false; } float DeltaTimeThreshold = 0.2f; // clothing simulation could be broken if frame-rate goes under 5 fps if(DeltaTime > DeltaTimeThreshold) { ForceClothNextUpdateTeleportAndReset(); } // distance check // TeleportDistanceThreshold is greater than Zero and not teleported yet if(TeleportDistanceThreshold > 0 && ClothTeleportMode == FClothingActor::Continuous) { float DistSquared = FVector::DistSquared(PrevRootBoneMatrix.GetOrigin(), CurRootBoneMat.GetOrigin()); if ( DistSquared > ClothTeleportDistThresholdSquared ) // if it has traveled too far { ClothTeleportMode = bResetAfterTeleport ? FClothingActor::TeleportAndReset : FClothingActor::Teleport; // clothing reset is needed once more to avoid clothing pop up when moved the component too far bNeedTeleportAndResetOnceMore = true; } } // rotation check // if TeleportRotationThreshold is greater than Zero and the user didn't do force teleport if(TeleportRotationThreshold > 0 && ClothTeleportMode == FClothingActor::Continuous) { // Detect whether teleportation is needed or not // Rotation matrix's transpose means an inverse but can't use a transpose because this matrix includes scales FMatrix AInvB = CurRootBoneMat * PrevRootBoneMatrix.InverseFast(); float Trace = AInvB.M[0][0] + AInvB.M[1][1] + AInvB.M[2][2]; float CosineTheta = (Trace - 1.0f) / 2.0f; // trace = 1+2cos(theta) for a 3x3 matrix if ( CosineTheta < ClothTeleportCosineThresholdInRad ) // has the root bone rotated too much { ClothTeleportMode = bResetAfterTeleport ? FClothingActor::TeleportAndReset : FClothingActor::Teleport; } } PrevRootBoneMatrix = CurRootBoneMat; } void USkeletalMeshComponent::ChangeClothMorphTargetMapping(FClothMorphTargetData& MorphData, FName CurrentActivatedMorphName) { int32 AssetIndex = MorphData.ClothAssetIndex; if(SkeletalMesh && SkeletalMesh->ClothingAssets.IsValidIndex(AssetIndex)) { FClothingAssetData& Asset = SkeletalMesh->ClothingAssets[AssetIndex]; // if different from prepared mapping, should do re-mapping if (Asset.PreparedMorphTargetName != CurrentActivatedMorphName) { TArray<PxVec3> ClothOriginalPosArray; int32 NumOriginPos = MorphData.OriginPos.Num(); ClothOriginalPosArray.AddUninitialized(NumOriginPos); for (int32 Index = 0; Index < NumOriginPos; Index++) { ClothOriginalPosArray[Index] = U2PVector(MorphData.OriginPos[Index]); } NxClothingAsset* ClothingAsset = Asset.ApexClothingAsset; float Epsilon = 0.0f; uint32 NumMapped = ClothingAsset->prepareMorphTargetMapping(ClothOriginalPosArray.GetData(), NumOriginPos, Epsilon); if ((int32)NumMapped < NumOriginPos) { // @TODO : // The mapping still worked, but some vertices were mapped to an original vertex with more than epsilon differences. // Either bump the epsilon or, if too many failed, emit an error message about a potentially bad mapping // if more than half failed if ((int32)NumMapped < NumOriginPos / 2) { FMessageDialog::Open(EAppMsgType::Ok, NSLOCTEXT("SkelmeshComponent", "Warning_ClothMorphTargetMapping", "Mapping vertices for Cloth Morph Target too many failed! It could introduce a bad morphing result.")); } } // change prepared morph target name Asset.PreparedMorphTargetName = CurrentActivatedMorphName; } } } void USkeletalMeshComponent::PrepareClothMorphTargets() { // if didn't turn on the cloth morph target option or already precomputed if (!bClothMorphTarget || bPreparedClothMorphTargets) { return; } ClothMorphTargets.Empty(); for (UMorphTarget* MorphTarget : SkeletalMesh->MorphTargets) { if (MorphTarget) { FName MorphTargetName = MorphTarget->GetFName(); int32 NumVerts; FVertexAnimDelta* Vertices = MorphTarget->GetDeltasAtTime(0.0f, 0, NULL, NumVerts); check(MeshObject); // should exist at least 1 LODModel check(MeshObject->GetSkeletalMeshResource().LODModels.Num() > 0); FStaticLODModel& Model = MeshObject->GetSkeletalMeshResource().LODModels[0]; // Find the chunk and vertex within that chunk, and skinning type, for this vertex. int32 ChunkIndex; int32 VertIndexInChunk; bool bSoftVertex; bool bHasExtraBoneInfluences; int32 SectionIndex = INDEX_NONE; int32 NumAssets = SkeletalMesh->ClothingAssets.Num(); TArray<TArray<PxVec3>> ClothOriginalPosArray; TArray<TArray<FVector>> ClothPositionDeltaArray; ClothOriginalPosArray.AddZeroed(NumAssets); ClothPositionDeltaArray.AddZeroed(NumAssets); int ClothChunkIndex = INDEX_NONE; for (int32 VertIdx = 0; VertIdx < NumVerts; VertIdx++) { Model.GetChunkAndSkinType(Vertices[VertIdx].SourceIdx, ChunkIndex, VertIndexInChunk, bSoftVertex, bHasExtraBoneInfluences); FSkelMeshChunk& Chunk = Model.Chunks[ChunkIndex]; for (int32 SecIdx = 0; SecIdx < Model.Sections.Num(); SecIdx++) { FSkelMeshSection& Section = Model.Sections[SecIdx]; if (Section.ChunkIndex == ChunkIndex) { // if current section is disabled and the corresponding cloth section is visible if (Section.bDisabled && Section.CorrespondClothSectionIndex >= 0) { SectionIndex = SecIdx; ClothChunkIndex = Model.Sections[Section.CorrespondClothSectionIndex].ChunkIndex; } break; } } if (SectionIndex != INDEX_NONE) { FVector Position; if (bSoftVertex) { Position = Chunk.SoftVertices[VertIndexInChunk].Position; } else { Position = Chunk.RigidVertices[VertIndexInChunk].Position; } int32 AssetIndex = Model.Chunks[ClothChunkIndex].CorrespondClothAssetIndex; // save to original positions ClothOriginalPosArray[AssetIndex].Add(U2PVector(Position)); ClothPositionDeltaArray[AssetIndex].Add(Vertices[VertIdx].PositionDelta); } } // fill in FClothMorphTargetData array for (int32 AssetIdx = 0; AssetIdx < NumAssets; AssetIdx++) { if (ClothOriginalPosArray[AssetIdx].Num() > 0) { NxClothingAsset* ClothingAsset = SkeletalMesh->ClothingAssets[AssetIdx].ApexClothingAsset; float Epsilon = 0.0f; uint32 NumMapped = ClothingAsset->prepareMorphTargetMapping(ClothOriginalPosArray[AssetIdx].GetData(), ClothOriginalPosArray[AssetIdx].Num(), Epsilon); int32 NumOriginPos = ClothOriginalPosArray[AssetIdx].Num(); if ((int32)NumMapped < NumOriginPos) { // @TODO : // The mapping still worked, but some vertices were mapped to an original vertex with more than epsilon differences. // Either bump the epsilon or, if too many failed, emit an error message about a potentially bad mapping // if more than half failed if ((int32)NumMapped < NumOriginPos / 2) { FMessageDialog::Open(EAppMsgType::Ok, NSLOCTEXT("SkelmeshComponent", "Warning_ClothMorphTargetMapping", "Mapping vertices for Cloth Morph Target too many failed! It could introduce a bad morphing result.")); } } SkeletalMesh->ClothingAssets[AssetIdx].PreparedMorphTargetName = MorphTargetName; FClothMorphTargetData *Data = new(ClothMorphTargets)FClothMorphTargetData; Data->MorphTargetName = MorphTargetName; Data->ClothAssetIndex = AssetIdx; Data->PrevWeight = 0.0f; // stores original positions TArray<PxVec3>& OriginPosArray = ClothOriginalPosArray[AssetIdx]; NumOriginPos = OriginPosArray.Num(); Data->OriginPos.AddUninitialized(NumOriginPos); for (int32 Index = 0; Index < NumOriginPos; Index++) { Data->OriginPos[Index] = P2UVector(OriginPosArray[Index]); } Data->PosDelta = ClothPositionDeltaArray[AssetIdx]; } } } } bPreparedClothMorphTargets = true; } void USkeletalMeshComponent::UpdateClothMorphTarget() { if (!bClothMorphTarget) { return; } for (int32 MorphIdx = 0; MorphIdx < ActiveVertexAnims.Num(); MorphIdx++) { if (ActiveVertexAnims[MorphIdx].Weight > 0.0f) { if (ActiveVertexAnims[MorphIdx].VertAnim) { FName MorphTargetName = ActiveVertexAnims[MorphIdx].VertAnim->GetFName(); int32 SelectedClothMorphIndex = INDEX_NONE; for (int32 ClothMorphIdx = 0; ClothMorphIdx < ClothMorphTargets.Num(); ClothMorphIdx++) { if (ClothMorphTargets[ClothMorphIdx].MorphTargetName == MorphTargetName) { SelectedClothMorphIndex = ClothMorphIdx; break; } } // if this morph target is not cloth morph target, skip this index if (SelectedClothMorphIndex == INDEX_NONE) { continue; } FClothMorphTargetData& MorphData = ClothMorphTargets[SelectedClothMorphIndex]; // if a currently mapped morph target name is same as MorphTargetName, doesn't change mapping. Otherwise, change morph target mapping ChangeClothMorphTargetMapping(MorphData, MorphTargetName); float CurWeight = ActiveVertexAnims[MorphIdx].Weight; if (CurWeight != MorphData.PrevWeight) { MorphData.PrevWeight = CurWeight; TArray<FVector> BlendedDelta; TArray<FVector>& OriginDelta = MorphData.PosDelta; if (OriginDelta.Num() > 0) { int32 ActorIndex = MorphData.ClothAssetIndex; if (!IsValidClothingActor(ActorIndex)) { continue; } BlendedDelta.AddUninitialized(OriginDelta.Num()); for (int32 DeltaIdx = 0; DeltaIdx < BlendedDelta.Num(); DeltaIdx++) { BlendedDelta[DeltaIdx] = (OriginDelta[DeltaIdx] * CurWeight); } // make current actor invalid ClothingActors[ActorIndex].Clear(true); CreateClothingActor(ActorIndex, SkeletalMesh->ClothingAssets[ActorIndex].ApexClothingAsset, &BlendedDelta); } } } } } } void USkeletalMeshComponent::UpdateClothState(float DeltaTime) { if (CVarEnableClothPhysics.GetValueOnGameThread() == 0) { return; } // if turned on bClothMorphTarget option if (bClothMorphTarget) { // @TODO : if not in editor, doesn't need to check preparation of cloth morph targets in Tick // if pre-computation is not conducted yet if (!bPreparedClothMorphTargets) { PrepareClothMorphTargets(); } UpdateClothMorphTarget(); } #if WITH_CLOTH_COLLISION_DETECTION if(bCollideWithAttachedChildren) { CopyClothCollisionsToChildren(); CopyChildrenClothCollisionsToParent(); } #endif // WITH_CLOTH_COLLISION_DETECTION int32 NumActors = ClothingActors.Num(); if(NumActors == 0) { return; } const TArray<FTransform>& BoneTransforms = MasterPoseComponent.IsValid() ? MasterPoseComponent.Get()->GetSpaceBases() : GetSpaceBases(); if(BoneTransforms.Num() == 0) { return; } physx::PxMat44 PxGlobalPose = U2PMatrix(ComponentToWorld.ToMatrixWithScale()); CheckClothTeleport(DeltaTime); // convert teleport mode to apex clothing teleport enum physx::apex::ClothingTeleportMode::Enum CurTeleportMode = (physx::apex::ClothingTeleportMode::Enum)ClothTeleportMode; for(int32 ActorIdx=0; ActorIdx<NumActors; ActorIdx++) { // skip if ClothingActor is NULL or invalid if(!IsValidClothingActor(ActorIdx)) { continue; } ApplyWindForCloth(ClothingActors[ActorIdx]); TArray<physx::PxMat44> BoneMatrices; NxClothingAsset* ClothingAsset = ClothingActors[ActorIdx].ParentClothingAsset; uint32 NumUsedBones = ClothingAsset->getNumUsedBones(); BoneMatrices.Empty(NumUsedBones); BoneMatrices.AddUninitialized(NumUsedBones); for(uint32 Index=0; Index < NumUsedBones; Index++) { FName BoneName = GetConvertedBoneName(ClothingActors[ActorIdx].ParentClothingAsset, Index); int32 BoneIndex = GetBoneIndex(BoneName); if(MasterPoseComponent.IsValid()) { int32 TempBoneIndex = BoneIndex; BoneIndex = INDEX_NONE; if(TempBoneIndex < MasterBoneMap.Num()) { int32 MasterBoneIndex = MasterBoneMap[TempBoneIndex]; // If ParentBoneIndex is valid, grab matrix from MasterPoseComponent. if( MasterBoneIndex != INDEX_NONE && MasterBoneIndex < MasterPoseComponent->GetNumSpaceBases()) { BoneIndex = MasterBoneIndex; } } } if(BoneIndex != INDEX_NONE) { BoneMatrices[Index] = U2PMatrix(BoneTransforms[BoneIndex].ToMatrixWithScale()); } else { BoneMatrices[Index] = PxMat44::createIdentity(); } } NxClothingActor* ClothingActor = ClothingActors[ActorIdx].ApexClothingActor; check(ClothingActor); // if bUseInternalboneOrder is set, "NumUsedBones" works, otherwise have to use "getNumBones" ClothingActor->updateState( PxGlobalPose, BoneMatrices.GetData(), sizeof(physx::PxMat44), NumUsedBones, CurTeleportMode); } // reset to Continuous ClothTeleportMode = FClothingActor::Continuous; } void USkeletalMeshComponent::GetClothRootBoneMatrix(int32 AssetIndex, FMatrix& OutRootBoneMatrix) const { if (IsValidClothingActor(AssetIndex)) { NxClothingAsset* Asset = ClothingActors[AssetIndex].ParentClothingAsset; check(Asset); const NxParameterized::Interface* AssetParams = Asset->getAssetNxParameterized(); uint32 InternalRootBoneIndex; verify(NxParameterized::getParamU32(*AssetParams, "rootBoneIndex", InternalRootBoneIndex)); check(InternalRootBoneIndex >= 0); FName BoneName = GetConvertedBoneName(Asset, InternalRootBoneIndex); int32 BoneIndex = GetBoneIndex(BoneName); check(BoneIndex >= 0); OutRootBoneMatrix = GetBoneMatrix(BoneIndex); } else { OutRootBoneMatrix = GetBoneMatrix(0); } } bool USkeletalMeshComponent::GetClothSimulatedPosition(int32 AssetIndex, int32 VertexIndex, FVector& OutSimulPos) const { bool bSucceed = false; if (IsValidClothingActor(AssetIndex)) { NxClothingActor* ApexClothingActor = ClothingActors[AssetIndex].ApexClothingActor; if (ApexClothingActor) { uint32 NumSimulVertices = ApexClothingActor->getNumSimulationVertices(); // handles only simulated vertices, indices of fixed vertices are bigger than # of simulated vertices if ((uint32)VertexIndex < NumSimulVertices) { bSucceed = true; const physx::PxVec3* Vertices = ApexClothingActor->getSimulationPositions(); if (bLocalSpaceSimulation) { FMatrix ClothRootBoneMatrix; GetClothRootBoneMatrix(AssetIndex, ClothRootBoneMatrix); OutSimulPos = ClothRootBoneMatrix.TransformPosition(P2UVector(Vertices[VertexIndex])); } else { OutSimulPos = P2UVector(Vertices[VertexIndex]); } } } } return bSucceed; } #endif// #if WITH_APEX_CLOTHING class FTickClothingTask { TWeakObjectPtr<USkeletalMeshComponent> SkeletalMeshComponent; float DeltaTime; public: FTickClothingTask(TWeakObjectPtr<USkeletalMeshComponent> InSkeletalMeshComponent, float InDeltaTime) : SkeletalMeshComponent(InSkeletalMeshComponent) , DeltaTime(InDeltaTime) { } FORCEINLINE TStatId GetStatId() const { RETURN_QUICK_DECLARE_CYCLE_STAT(FTickClothingTask, STATGROUP_TaskGraphTasks); } static ENamedThreads::Type GetDesiredThread() { return ENamedThreads::GameThread; } static ESubsequentsMode::Type GetSubsequentsMode() { return ESubsequentsMode::TrackSubsequents; } void DoTask(ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent) { //SCOPE_CYCLE_COUNTER(STAT_AnimGameThreadTime); if (USkeletalMeshComponent* Comp = SkeletalMeshComponent.Get()) { Comp->PerformTickClothing(DeltaTime); } } }; void USkeletalMeshComponent::PerformTickClothing(float DeltaTime) { if (CVarEnableClothPhysics.GetValueOnGameThread() == 0) { return; } #if WITH_APEX_CLOTHING // animated but bone transforms were not updated because it was not rendered if(PoseTickedThisFrame() && !bRecentlyRendered) { ForceClothNextUpdateTeleportAndReset(); } else { ValidateClothingActors(); UpdateClothState(DeltaTime); } #if 0 //if turn on this flag, you can check which primitive objects are activated for collision detection DrawDebugClothCollisions(); #endif #endif// #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::TickClothing(float DeltaTime, FTickFunction& ThisTickFunction) { if(IsValidRef(ParallelBlendPhysicsCompletionTask)) { FGraphEventArray Prerequistes; Prerequistes.Add(ParallelBlendPhysicsCompletionTask); FGraphEventRef TickClothingCompletionEvent = TGraphTask<FTickClothingTask>::CreateTask(&Prerequistes).ConstructAndDispatchWhenReady(this, DeltaTime); ThisTickFunction.GetCompletionHandle()->DontCompleteUntil(TickClothingCompletionEvent); }else { PerformTickClothing(DeltaTime); } } void USkeletalMeshComponent::GetUpdateClothSimulationData(TArray<FClothSimulData>& OutClothSimData, USkeletalMeshComponent* OverrideLocalRootComponent) { #if WITH_APEX_CLOTHING if (CVarEnableClothPhysics.GetValueOnAnyThread() == 0) { return; } int32 NumClothingActors = ClothingActors.Num(); if(NumClothingActors == 0 || bDisableClothSimulation) { OutClothSimData.Empty(); return; } if(OutClothSimData.Num() != NumClothingActors) { OutClothSimData.Empty(NumClothingActors); OutClothSimData.AddZeroed(NumClothingActors); } bool bSimulated = false; for(int32 ActorIndex=0; ActorIndex<NumClothingActors; ActorIndex++) { if(!IsValidClothingActor(ActorIndex)) { OutClothSimData[ActorIndex].ClothSimulPositions.Empty(); OutClothSimData[ActorIndex].ClothSimulNormals.Empty(); continue; } NxClothingActor* ClothingActor = ClothingActors[ActorIndex].ApexClothingActor; // update simulation positions & normals if(ClothingActor) { uint32 NumSimulVertices = ClothingActor->getNumSimulationVertices(); if(NumSimulVertices > 0) { bSimulated = true; FClothSimulData& ClothData = OutClothSimData[ActorIndex]; if(ClothData.ClothSimulPositions.Num() != NumSimulVertices) { ClothData.ClothSimulPositions.Empty(NumSimulVertices); ClothData.ClothSimulPositions.AddUninitialized(NumSimulVertices); ClothData.ClothSimulNormals.Empty(NumSimulVertices); ClothData.ClothSimulNormals.AddUninitialized(NumSimulVertices); } const physx::PxVec3* Vertices = ClothingActor->getSimulationPositions(); const physx::PxVec3* Normals = ClothingActor->getSimulationNormals(); // In case of Local space simulation, need to transform simulated positions with the internal bone matrix if (bLocalSpaceSimulation) { FMatrix ClothRootBoneMatrix; (OverrideLocalRootComponent) ? OverrideLocalRootComponent->GetClothRootBoneMatrix(ActorIndex, ClothRootBoneMatrix) : GetClothRootBoneMatrix(ActorIndex, ClothRootBoneMatrix); for (uint32 VertexIndex = 0; VertexIndex < NumSimulVertices; VertexIndex++) { ClothData.ClothSimulPositions[VertexIndex] = ClothRootBoneMatrix.TransformPosition(P2UVector(Vertices[VertexIndex])); ClothData.ClothSimulNormals[VertexIndex] = ClothRootBoneMatrix.TransformVector(P2UVector(Normals[VertexIndex])); } } else { for (uint32 VertexIndex = 0; VertexIndex < NumSimulVertices; VertexIndex++) { ClothData.ClothSimulPositions[VertexIndex] = P2UVector(Vertices[VertexIndex]); ClothData.ClothSimulNormals[VertexIndex] = P2UVector(Normals[VertexIndex]); } } } } } //no simulated vertices if(!bSimulated) { OutClothSimData.Empty(); } #endif// #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::FreezeClothSection(bool bFreeze) { #if WITH_APEX_CLOTHING int32 NumActors = ClothingActors.Num(); for(int32 ActorIdx=0; ActorIdx<NumActors; ActorIdx++) { NxClothingActor* ClothingActor = ClothingActors[ActorIdx].ApexClothingActor; if (ClothingActor) { ClothingActor->setFrozen(bFreeze); } } #endif// #if WITH_APEX_CLOTHING } bool USkeletalMeshComponent::IsValidClothingActor(int32 ActorIndex) const { #if WITH_APEX_CLOTHING if (!SkeletalMesh) { return false; } //false if ActorIndex is out-range if(ActorIndex >= SkeletalMesh->ClothingAssets.Num() || ActorIndex >= ClothingActors.Num()) { return false; } if(ClothingActors[ActorIndex].ApexClothingActor && ClothingActors[ActorIndex].ParentClothingAsset == SkeletalMesh->ClothingAssets[ActorIndex].ApexClothingAsset) { return true; } return false; #else return false; #endif// #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::DrawClothingNormals(FPrimitiveDrawInterface* PDI) { #if WITH_APEX_CLOTHING if (!SkeletalMesh) { return; } int32 NumActors = ClothingActors.Num(); for(int32 ActorIdx=0; ActorIdx<NumActors; ActorIdx++) { NxClothingActor* ClothingActor = ClothingActors[ActorIdx].ApexClothingActor; if(!IsValidClothingActor(ActorIdx)) { continue; } if (ClothingActor) { uint32 NumSimulVertices = ClothingActor->getNumSimulationVertices(); // simulation is enabled and there exist simulated vertices if(!bDisableClothSimulation && NumSimulVertices > 0) { const physx::PxVec3* Vertices = ClothingActor->getSimulationPositions(); const physx::PxVec3* Normals = ClothingActor->getSimulationNormals(); FLinearColor LineColor = FColor::Red; FVector Start, End; for(uint32 i=0; i<NumSimulVertices; i++) { Start = P2UVector(Vertices[i]); End = P2UVector(Normals[i]); End *= 5.0f; End = Start + End; PDI->DrawLine(Start, End, LineColor, SDPG_World); } } else // otherwise, draws initial values loaded from the asset file { if(SkeletalMesh->ClothingAssets[ActorIdx].ClothVisualizationInfos.Num() == 0) { LoadClothingVisualizationInfo(ActorIdx); } int32 PhysicalMeshLOD = PredictedLODLevel; // if this asset doesn't have current physical mesh LOD, then skip to visualize if(!SkeletalMesh->ClothingAssets[ActorIdx].ClothVisualizationInfos.IsValidIndex(PhysicalMeshLOD)) { continue; } FClothVisualizationInfo& VisualInfo = SkeletalMesh->ClothingAssets[ActorIdx].ClothVisualizationInfos[PhysicalMeshLOD]; uint32 NumVertices = VisualInfo.ClothPhysicalMeshVertices.Num(); FLinearColor LineColor = FColor::Red; FVector Start, End; for(uint32 i=0; i<NumVertices; i++) { Start = VisualInfo.ClothPhysicalMeshVertices[i]; End = VisualInfo.ClothPhysicalMeshNormals[i]; End *= 5.0f; End = Start + End; PDI->DrawLine(Start, End, LineColor, SDPG_World); } } } } #endif // #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::DrawClothingTangents(FPrimitiveDrawInterface* PDI) { #if WITH_APEX_CLOTHING if (!SkeletalMesh || !MeshObject) { return; } int32 NumActors = ClothingActors.Num(); for(int32 ActorIdx=0; ActorIdx<NumActors; ActorIdx++) { if(!IsValidClothingActor(ActorIdx)) { continue; } NxClothingActor* ClothingActor = ClothingActors[ActorIdx].ApexClothingActor; if (ClothingActor) { uint32 NumSimulVertices = ClothingActor->getNumSimulationVertices(); // simulation is enabled and there exist simulated vertices if(!bDisableClothSimulation && NumSimulVertices > 0) { uint16 ChunkIndex = 0; FStaticLODModel& LODModel = MeshObject->GetSkeletalMeshResource().LODModels[PredictedLODLevel]; TArray<uint32> SectionIndices; SkeletalMesh->GetClothSectionIndices(PredictedLODLevel, ActorIdx, SectionIndices); int32 NumSections = SectionIndices.Num(); for(int32 SecIdx=0; SecIdx <NumSections; SecIdx++) { uint16 SectionIndex = SectionIndices[SecIdx]; ChunkIndex = LODModel.Sections[SectionIndex].ChunkIndex; FSkelMeshChunk& Chunk = LODModel.Chunks[ChunkIndex]; const physx::PxVec3* SimulVertices = ClothingActor->getSimulationPositions(); const physx::PxVec3* SimulNormals = ClothingActor->getSimulationNormals(); uint32 NumMppingData = Chunk.ApexClothMappingData.Num(); FVector Start, End; for(uint32 MappingIndex=0; MappingIndex < NumMppingData; MappingIndex++) { FVector4 BaryCoordPos = Chunk.ApexClothMappingData[MappingIndex].PositionBaryCoordsAndDist; FVector4 BaryCoordNormal = Chunk.ApexClothMappingData[MappingIndex].NormalBaryCoordsAndDist; FVector4 BaryCoordTangent = Chunk.ApexClothMappingData[MappingIndex].TangentBaryCoordsAndDist; uint16* SimulIndices = Chunk.ApexClothMappingData[MappingIndex].SimulMeshVertIndices; bool bFixed = (SimulIndices[3] == 0xFFFF); if(bFixed) { //if met a fixed vertex, skip to draw simulated vertices continue; } check(SimulIndices[0] < NumSimulVertices && SimulIndices[1] < NumSimulVertices && SimulIndices[2] < NumSimulVertices); PxVec3 a = SimulVertices[SimulIndices[0]]; PxVec3 b = SimulVertices[SimulIndices[1]]; PxVec3 c = SimulVertices[SimulIndices[2]]; PxVec3 na = SimulNormals[SimulIndices[0]]; PxVec3 nb = SimulNormals[SimulIndices[1]]; PxVec3 nc = SimulNormals[SimulIndices[2]]; FVector Position = P2UVector( BaryCoordPos.X*(a + BaryCoordPos.W*na) + BaryCoordPos.Y*(b + BaryCoordPos.W*nb) + BaryCoordPos.Z*(c + BaryCoordPos.W*nc)); FVector Normal = P2UVector( BaryCoordNormal.X*(a + BaryCoordNormal.W*na) + BaryCoordNormal.Y*(b + BaryCoordNormal.W*nb) + BaryCoordNormal.Z*(c + BaryCoordNormal.W*nc)); FVector Tangent = P2UVector( BaryCoordTangent.X*(a + BaryCoordTangent.W*na) + BaryCoordTangent.Y*(b + BaryCoordTangent.W*nb) + BaryCoordTangent.Z*(c + BaryCoordTangent.W*nc)); Normal -= Position; Normal.Normalize(); Tangent -= Position; Tangent.Normalize(); FVector BiNormal = FVector::CrossProduct(Normal, Tangent); BiNormal.Normalize(); Start = Position; End = Normal; End *= 5.0f; End = Start + End; PDI->DrawLine(Start, End, FColor::Green, SDPG_World); End = Tangent; End *= 5.0f; End = Start + End; PDI->DrawLine(Start, End, FColor::Red, SDPG_World); End = BiNormal; End *= 5.0f; End = Start + End; PDI->DrawLine(Start, End, FColor::Blue, SDPG_World); } } } else { if(SkeletalMesh->ClothingAssets[ActorIdx].ClothVisualizationInfos.Num() == 0) { LoadClothingVisualizationInfo(ActorIdx); } int32 PhysicalMeshLOD = PredictedLODLevel; // if this asset doesn't have current physical mesh LOD, then skip to visualize if(!SkeletalMesh->ClothingAssets[ActorIdx].ClothVisualizationInfos.IsValidIndex(PhysicalMeshLOD)) { continue; } FClothVisualizationInfo& VisualInfo = SkeletalMesh->ClothingAssets[ActorIdx].ClothVisualizationInfos[PhysicalMeshLOD]; NumSimulVertices = VisualInfo.ClothPhysicalMeshVertices.Num(); uint16 ChunkIndex = 0; FStaticLODModel& LODModel = MeshObject->GetSkeletalMeshResource().LODModels[PredictedLODLevel]; TArray<uint32> SectionIndices; SkeletalMesh->GetClothSectionIndices(PredictedLODLevel, ActorIdx, SectionIndices); int32 NumSections = SectionIndices.Num(); for(int32 SecIdx=0; SecIdx <NumSections; SecIdx++) { uint16 SectionIndex = SectionIndices[SecIdx]; ChunkIndex = LODModel.Sections[SectionIndex].ChunkIndex; FSkelMeshChunk& Chunk = LODModel.Chunks[ChunkIndex]; const TArray<FVector>& SimulVertices = VisualInfo.ClothPhysicalMeshVertices; const TArray<FVector>& SimulNormals = VisualInfo.ClothPhysicalMeshNormals; uint32 NumMppingData = Chunk.ApexClothMappingData.Num(); FVector Start, End; for(uint32 MappingIndex=0; MappingIndex < NumMppingData; MappingIndex++) { FVector4 BaryCoordPos = Chunk.ApexClothMappingData[MappingIndex].PositionBaryCoordsAndDist; FVector4 BaryCoordNormal = Chunk.ApexClothMappingData[MappingIndex].NormalBaryCoordsAndDist; FVector4 BaryCoordTangent = Chunk.ApexClothMappingData[MappingIndex].TangentBaryCoordsAndDist; uint16* SimulIndices = Chunk.ApexClothMappingData[MappingIndex].SimulMeshVertIndices; bool bFixed = (SimulIndices[3] == 0xFFFF); check(SimulIndices[0] < NumSimulVertices && SimulIndices[1] < NumSimulVertices && SimulIndices[2] < NumSimulVertices); FVector a = SimulVertices[SimulIndices[0]]; FVector b = SimulVertices[SimulIndices[1]]; FVector c = SimulVertices[SimulIndices[2]]; FVector na = SimulNormals[SimulIndices[0]]; FVector nb = SimulNormals[SimulIndices[1]]; FVector nc = SimulNormals[SimulIndices[2]]; FVector Position = BaryCoordPos.X*(a + BaryCoordPos.W*na) + BaryCoordPos.Y*(b + BaryCoordPos.W*nb) + BaryCoordPos.Z*(c + BaryCoordPos.W*nc); FVector Normal = BaryCoordNormal.X*(a + BaryCoordNormal.W*na) + BaryCoordNormal.Y*(b + BaryCoordNormal.W*nb) + BaryCoordNormal.Z*(c + BaryCoordNormal.W*nc); FVector Tangent = BaryCoordTangent.X*(a + BaryCoordTangent.W*na) + BaryCoordTangent.Y*(b + BaryCoordTangent.W*nb) + BaryCoordTangent.Z*(c + BaryCoordTangent.W*nc); Normal -= Position; Normal.Normalize(); Tangent -= Position; Tangent.Normalize(); FVector BiNormal = FVector::CrossProduct(Normal, Tangent); BiNormal.Normalize(); Start = Position; End = Normal; End *= 5.0f; End = Start + End; PDI->DrawLine(Start, End, FColor::Green, SDPG_World); End = Tangent; End *= 5.0f; End = Start + End; PDI->DrawLine(Start, End, FColor::Red, SDPG_World); End = BiNormal; End *= 5.0f; End = Start + End; PDI->DrawLine(Start, End, FColor::Blue, SDPG_World); } } } } } #endif // #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::DrawClothingCollisionVolumes(FPrimitiveDrawInterface* PDI) { #if WITH_APEX_CLOTHING if (!SkeletalMesh || SkeletalMesh->ClothingAssets.Num() == 0) { return; } static bool bDrawnPlanes = false; FColor Colors[3] = { FColor::Red, FColor::Green, FColor::Blue }; FColor GrayColor(50, 50, 50); // dark gray to represent ignored collisions const int32 MaxSphereCollisions = 32; // Apex clothing supports up to 16 capsules or 32 spheres because 1 capsule takes 2 spheres for(int32 AssetIdx=0; AssetIdx < SkeletalMesh->ClothingAssets.Num(); AssetIdx++) { TArray<FApexClothCollisionVolumeData>& Collisions = SkeletalMesh->ClothingAssets[AssetIdx].ClothCollisionVolumes; int32 SphereCount = 0; for (const FApexClothCollisionVolumeData& Collision : Collisions) { if(Collision.BoneIndex < 0) { continue; } FName BoneName = GetConvertedBoneName(SkeletalMesh->ClothingAssets[AssetIdx].ApexClothingAsset, Collision.BoneIndex); int32 BoneIndex = GetBoneIndex(BoneName); if(BoneIndex < 0) { continue; } FMatrix BoneMat = GetBoneMatrix(BoneIndex); FMatrix LocalToWorld = Collision.LocalPose * BoneMat; if(Collision.IsCapsule()) { FColor CapsuleColor = Colors[AssetIdx % 3]; if (SphereCount >= MaxSphereCollisions) { CapsuleColor = GrayColor; // Draw in gray to show that these collisions are ignored } const int32 CapsuleSides = FMath::Clamp<int32>(Collision.CapsuleRadius/4.f, 16, 64); float CapsuleHalfHeight = (Collision.CapsuleHeight*0.5f+Collision.CapsuleRadius); float CapsuleRadius = Collision.CapsuleRadius*2.f; // swapped Y-axis and Z-axis to convert apex coordinate to UE coordinate DrawWireCapsule(PDI, LocalToWorld.GetOrigin(), LocalToWorld.GetUnitAxis(EAxis::X), LocalToWorld.GetUnitAxis(EAxis::Z), LocalToWorld.GetUnitAxis(EAxis::Y), CapsuleColor, Collision.CapsuleRadius, CapsuleHalfHeight, CapsuleSides, SDPG_World); SphereCount += 2; // 1 capsule takes 2 spheres } else // convex { int32 NumVerts = Collision.BoneVertices.Num(); TArray<FVector> TransformedVerts; TransformedVerts.AddUninitialized(NumVerts); for(int32 VertIdx=0; VertIdx < NumVerts; VertIdx++) { TransformedVerts[VertIdx] = BoneMat.TransformPosition(Collision.BoneVertices[VertIdx]); } // just draw all connected wires to check convex shape for(int32 i=0; i < NumVerts-2; i++) { for(int32 j=i+1; j < NumVerts; j++) { PDI->DrawLine(TransformedVerts[i], TransformedVerts[j], Colors[AssetIdx%3], SDPG_World); } } } } TArray<FClothBonePlane>& BonePlanes = SkeletalMesh->ClothingAssets[AssetIdx].ClothCollisionVolumePlanes; int32 NumPlanes = BonePlanes.Num(); FVector Origin = ComponentToWorld.GetLocation(); for(int32 PlaneIdx=0; PlaneIdx < NumPlanes; PlaneIdx++) { FName BoneName = GetConvertedBoneName(SkeletalMesh->ClothingAssets[AssetIdx].ApexClothingAsset, BonePlanes[PlaneIdx].BoneIndex); int32 BoneIndex = GetBoneIndex(BoneName); if(BoneIndex < 0) { continue; } FMatrix BoneMat = GetBoneMatrix(BoneIndex); FPlane UPlane = BonePlanes[PlaneIdx].PlaneData.TransformBy(BoneMat); FVector BoneMatOrigin = BoneMat.GetOrigin(); // draw once becasue of a bug in DrawDebugSolidPlane() method if(!bDrawnPlanes) { DrawDebugSolidPlane(GetWorld(), UPlane, BoneMatOrigin, 2, Colors[AssetIdx%3]); } } bDrawnPlanes = true; // draw bone spheres TArray<FApexClothBoneSphereData>& Spheres = SkeletalMesh->ClothingAssets[AssetIdx].ClothBoneSpheres; TArray<FVector> SpherePositions; int32 NumSpheres = Spheres.Num(); SpherePositions.AddUninitialized(NumSpheres); for(int32 i=0; i<NumSpheres; i++) { if(Spheres[i].BoneIndex < 0) { continue; } FName BoneName = GetConvertedBoneName(SkeletalMesh->ClothingAssets[AssetIdx].ApexClothingAsset, Spheres[i].BoneIndex); int32 BoneIndex = GetBoneIndex(BoneName); if(BoneIndex < 0) { continue; } FMatrix BoneMat = GetBoneMatrix(BoneIndex); FVector SpherePos = BoneMat.TransformPosition(Spheres[i].LocalPos); SpherePositions[i] = SpherePos; FTransform SphereTransform(FQuat::Identity, SpherePos); FColor SphereColor = Colors[AssetIdx % 3]; if (SphereCount >= MaxSphereCollisions) { SphereColor = GrayColor; // Draw in gray to show that these collisions are ignored } DrawWireSphere(PDI, SphereTransform, SphereColor, Spheres[i].Radius, 10, SDPG_World); SphereCount++; } // draw connections between bone spheres, this makes 2 sphere to a capsule TArray<uint16>& Connections = SkeletalMesh->ClothingAssets[AssetIdx].BoneSphereConnections; int32 NumConnections = Connections.Num(); for(int32 i=0; i<NumConnections; i+=2) { uint16 Index1 = Connections[i]; uint16 Index2 = Connections[i+1]; DrawDebugLine(GetWorld(), SpherePositions[Index1], SpherePositions[Index2], FColor::Magenta, false, -1.0f, SDPG_Foreground); } } #endif // #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::DrawClothingFixedVertices(FPrimitiveDrawInterface* PDI) { #if WITH_APEX_CLOTHING if (!SkeletalMesh || !MeshObject) { return; } int32 NumActors = ClothingActors.Num(); TArray<FMatrix> RefToLocals; // get local matrices for skinning UpdateRefToLocalMatrices(RefToLocals, this, GetSkeletalMeshResource(), 0, NULL); const float Inv_255 = 1.f/255.f; for(int32 ActorIdx=0; ActorIdx<NumActors; ActorIdx++) { if(!IsValidClothingActor(ActorIdx)) { continue; } NxClothingActor* ClothingActor = ClothingActors[ActorIdx].ApexClothingActor; if (ClothingActor) { uint32 NumSimulVertices = ClothingActor->getNumSimulationVertices(); if(SkeletalMesh->ClothingAssets[ActorIdx].ClothVisualizationInfos.Num() == 0) { LoadClothingVisualizationInfo(ActorIdx); } int32 PhysicalMeshLOD = PredictedLODLevel; // if this asset doesn't have current physical mesh LOD, then skip to visualize if(!SkeletalMesh->ClothingAssets[ActorIdx].ClothVisualizationInfos.IsValidIndex(PhysicalMeshLOD)) { continue; } FClothVisualizationInfo& VisualInfo = SkeletalMesh->ClothingAssets[ActorIdx].ClothVisualizationInfos[PhysicalMeshLOD]; NumSimulVertices = VisualInfo.ClothPhysicalMeshVertices.Num(); uint16 ChunkIndex = 0; FStaticLODModel& LODModel = MeshObject->GetSkeletalMeshResource().LODModels[PredictedLODLevel]; TArray<uint32> SectionIndices; SkeletalMesh->GetClothSectionIndices(PredictedLODLevel, ActorIdx, SectionIndices); int32 NumSections = SectionIndices.Num(); for(int32 SecIdx=0; SecIdx <NumSections; SecIdx++) { uint16 SectionIndex = SectionIndices[SecIdx]; ChunkIndex = LODModel.Sections[SectionIndex].ChunkIndex; FSkelMeshChunk& Chunk = LODModel.Chunks[ChunkIndex]; const TArray<FVector>& SimulVertices = VisualInfo.ClothPhysicalMeshVertices; const TArray<FVector>& SimulNormals = VisualInfo.ClothPhysicalMeshNormals; uint32 NumMppingData = Chunk.ApexClothMappingData.Num(); FVector Start, End; for(uint32 MappingIndex=0; MappingIndex < NumMppingData; MappingIndex++) { FVector4 BaryCoordPos = Chunk.ApexClothMappingData[MappingIndex].PositionBaryCoordsAndDist; FVector4 BaryCoordNormal = Chunk.ApexClothMappingData[MappingIndex].NormalBaryCoordsAndDist; FVector4 BaryCoordTangent = Chunk.ApexClothMappingData[MappingIndex].TangentBaryCoordsAndDist; uint16* SimulIndices = Chunk.ApexClothMappingData[MappingIndex].SimulMeshVertIndices; bool bFixed = (SimulIndices[3] == 0xFFFF); if(!bFixed) { continue; } check(SimulIndices[0] < NumSimulVertices && SimulIndices[1] < NumSimulVertices && SimulIndices[2] < NumSimulVertices); FVector a = SimulVertices[SimulIndices[0]]; FVector b = SimulVertices[SimulIndices[1]]; FVector c = SimulVertices[SimulIndices[2]]; FVector na = SimulNormals[SimulIndices[0]]; FVector nb = SimulNormals[SimulIndices[1]]; FVector nc = SimulNormals[SimulIndices[2]]; FVector Position = BaryCoordPos.X*(a + BaryCoordPos.W*na) + BaryCoordPos.Y*(b + BaryCoordPos.W*nb) + BaryCoordPos.Z*(c + BaryCoordPos.W*nc); FSoftSkinVertex& SoftVert = Chunk.SoftVertices[MappingIndex]; // skinning, APEX clothing supports up to 4 bone influences for now const uint8* BoneIndices = SoftVert.InfluenceBones; const uint8* BoneWeights = SoftVert.InfluenceWeights; FMatrix SkinningMat(ForceInitToZero); for(int32 BoneWeightIdx=0; BoneWeightIdx < Chunk.MaxBoneInfluences; BoneWeightIdx++) { float Weight = BoneWeights[BoneWeightIdx]*Inv_255; SkinningMat += RefToLocals[Chunk.BoneMap[BoneIndices[BoneWeightIdx]]]*Weight; } FVector SkinnedPosition = SkinningMat.TransformPosition(Position); // draws a skinned fixed vertex PDI->DrawPoint(SkinnedPosition, FColor::Yellow, 2, SDPG_World); } } } } #endif // #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::LoadClothingVisualizationInfo(int32 AssetIndex) { #if WITH_APEX_CLOTHING if (!SkeletalMesh || !SkeletalMesh->ClothingAssets.IsValidIndex(AssetIndex)) { return; } FClothingAssetData& AssetData = SkeletalMesh->ClothingAssets[AssetIndex]; NxClothingAsset* ApexClothingAsset = AssetData.ApexClothingAsset; const NxParameterized::Interface* AssetParams = ApexClothingAsset->getAssetNxParameterized(); int32 NumPhysicalLODs; NxParameterized::getParamArraySize(*AssetParams, "physicalMeshes", NumPhysicalLODs); check(NumPhysicalLODs == ApexClothingAsset->getNumGraphicalLodLevels()); // prepares to load data for each LOD AssetData.ClothVisualizationInfos.Empty(NumPhysicalLODs); AssetData.ClothVisualizationInfos.AddZeroed(NumPhysicalLODs); for(int32 LODIndex=0; LODIndex<NumPhysicalLODs; LODIndex++) { FClothVisualizationInfo& VisualInfo = AssetData.ClothVisualizationInfos[LODIndex]; char ParameterName[MAX_SPRINTF]; FCStringAnsi::Sprintf(ParameterName, "physicalMeshes[%d]", LODIndex); NxParameterized::Interface* PhysicalMeshParams; uint32 NumVertices = 0; uint32 NumIndices = 0; // physical mesh vertices & normals if (NxParameterized::getParamRef(*AssetParams, ParameterName, PhysicalMeshParams)) { if(PhysicalMeshParams != NULL) { verify(NxParameterized::getParamU32(*PhysicalMeshParams, "physicalMesh.numVertices", NumVertices)); // physical mesh vertices physx::PxI32 VertexCount = 0; if (NxParameterized::getParamArraySize(*PhysicalMeshParams, "physicalMesh.vertices", VertexCount)) { check(VertexCount == NumVertices); VisualInfo.ClothPhysicalMeshVertices.Empty(NumVertices); for (uint32 VertexIndex = 0; VertexIndex < NumVertices; ++VertexIndex) { FCStringAnsi::Sprintf( ParameterName, "physicalMesh.vertices[%d]", VertexIndex ); NxParameterized::Handle MeshVertexHandle(*PhysicalMeshParams); if (NxParameterized::findParam(*PhysicalMeshParams, ParameterName, MeshVertexHandle) != NULL) { physx::PxVec3 Vertex; MeshVertexHandle.getParamVec3(Vertex); VisualInfo.ClothPhysicalMeshVertices.Add(P2UVector(Vertex)); } } } // bone weights & bone indices physx::PxI32 BoneWeightsCount = 0; if (NxParameterized::getParamArraySize(*PhysicalMeshParams, "physicalMesh.boneWeights", BoneWeightsCount)) { VisualInfo.ClothPhysicalMeshBoneWeightsInfo.AddZeroed(VertexCount); int32 MaxBoneWeights = BoneWeightsCount / VertexCount; VisualInfo.NumMaxBoneInfluences = MaxBoneWeights; physx::PxI32 BoneIndicesCount = 0; verify(NxParameterized::getParamArraySize(*PhysicalMeshParams, "physicalMesh.boneIndices", BoneIndicesCount)); check(BoneIndicesCount == BoneWeightsCount); for (int32 VertexIndex = 0; VertexIndex < VertexCount; ++VertexIndex) { for(uint8 WeightIndex=0; WeightIndex < MaxBoneWeights; ++WeightIndex) { uint32 CurBoneWeightIndex = VertexIndex*MaxBoneWeights + WeightIndex; NxParameterized::Handle BoneIndexHandle(*PhysicalMeshParams); FCStringAnsi::Sprintf( ParameterName, "physicalMesh.boneIndices[%d]", CurBoneWeightIndex ); verify(NxParameterized::findParam(*PhysicalMeshParams, ParameterName, BoneIndexHandle)); uint16 BoneIndex; BoneIndexHandle.getParamU16(BoneIndex); VisualInfo.ClothPhysicalMeshBoneWeightsInfo[VertexIndex].Indices[WeightIndex] = BoneIndex; NxParameterized::Handle BoneWeightHandle(*PhysicalMeshParams); FCStringAnsi::Sprintf( ParameterName, "physicalMesh.boneWeights[%d]", CurBoneWeightIndex ); verify(NxParameterized::findParam(*PhysicalMeshParams, ParameterName, BoneWeightHandle)); float BoneWeight; BoneWeightHandle.getParamF32(BoneWeight); VisualInfo.ClothPhysicalMeshBoneWeightsInfo[VertexIndex].Weights[WeightIndex] = BoneWeight; } } } // physical mesh normals physx::PxI32 NormalCount = 0; if (NxParameterized::getParamArraySize(*PhysicalMeshParams, "physicalMesh.normals", NormalCount)) { check(NormalCount == NumVertices); VisualInfo.ClothPhysicalMeshNormals.Empty(NormalCount); for (int32 NormalIndex = 0; NormalIndex < NormalCount; ++NormalIndex) { FCStringAnsi::Sprintf( ParameterName, "physicalMesh.normals[%d]", NormalIndex ); NxParameterized::Handle MeshNormalHandle(*PhysicalMeshParams); if (NxParameterized::findParam(*PhysicalMeshParams, ParameterName, MeshNormalHandle) != NULL) { physx::PxVec3 PxNormal; MeshNormalHandle.getParamVec3(PxNormal); VisualInfo.ClothPhysicalMeshNormals.Add(P2UVector(PxNormal)); } } } // physical mesh indices verify(NxParameterized::getParamU32(*PhysicalMeshParams, "physicalMesh.numIndices", NumIndices)); physx::PxI32 IndexCount = 0; if (NxParameterized::getParamArraySize(*PhysicalMeshParams, "physicalMesh.indices", IndexCount)) { check(IndexCount == NumIndices); VisualInfo.ClothPhysicalMeshIndices.Empty(NumIndices); for (uint32 IndexIdx = 0; IndexIdx < NumIndices; ++IndexIdx) { FCStringAnsi::Sprintf( ParameterName, "physicalMesh.indices[%d]", IndexIdx ); NxParameterized::Handle MeshIndexHandle(*PhysicalMeshParams); if (NxParameterized::findParam(*PhysicalMeshParams, ParameterName, MeshIndexHandle) != NULL) { uint32 IndexParam; MeshIndexHandle.getParamU32(IndexParam); VisualInfo.ClothPhysicalMeshIndices.Add(IndexParam); } } } // constraint coefficient parameters (max distances & backstop data) verify(NxParameterized::getParamF32(*PhysicalMeshParams, "physicalMesh.maximumMaxDistance", VisualInfo.MaximumMaxDistance)); physx::PxI32 ConstraintCoeffCount = 0; if (NxParameterized::getParamArraySize(*PhysicalMeshParams, "physicalMesh.constrainCoefficients", ConstraintCoeffCount)) { check(ConstraintCoeffCount == NumVertices); VisualInfo.ClothConstrainCoeffs.Empty(ConstraintCoeffCount); VisualInfo.ClothConstrainCoeffs.AddZeroed(ConstraintCoeffCount); for (uint32 ConstCoeffIdx = 0; ConstCoeffIdx < NumIndices; ++ConstCoeffIdx) { // max distances FCStringAnsi::Sprintf( ParameterName, "physicalMesh.constrainCoefficients[%d].maxDistance", ConstCoeffIdx ); NxParameterized::Handle MeshConstCoeffHandle(*PhysicalMeshParams); if (NxParameterized::findParam(*PhysicalMeshParams, ParameterName, MeshConstCoeffHandle) != NULL) { float MaxDistance; MeshConstCoeffHandle.getParamF32(MaxDistance); VisualInfo.ClothConstrainCoeffs[ConstCoeffIdx].ClothMaxDistance = MaxDistance; } // backstop data FCStringAnsi::Sprintf( ParameterName, "physicalMesh.constrainCoefficients[%d].collisionSphereRadius", ConstCoeffIdx ); if (NxParameterized::findParam(*PhysicalMeshParams, ParameterName, MeshConstCoeffHandle) != NULL) { float BackstopCollisionSphereRadius; MeshConstCoeffHandle.getParamF32(BackstopCollisionSphereRadius); VisualInfo.ClothConstrainCoeffs[ConstCoeffIdx].ClothBackstopRadius = BackstopCollisionSphereRadius; } FCStringAnsi::Sprintf( ParameterName, "physicalMesh.constrainCoefficients[%d].collisionSphereDistance", ConstCoeffIdx ); if (NxParameterized::findParam(*PhysicalMeshParams, ParameterName, MeshConstCoeffHandle) != NULL) { float BackstopCollisionSphereDistance; MeshConstCoeffHandle.getParamF32(BackstopCollisionSphereDistance); VisualInfo.ClothConstrainCoeffs[ConstCoeffIdx].ClothBackstopDistance = BackstopCollisionSphereDistance; } } } } } } #endif // #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::LoadAllClothingVisualizationInfos() { #if WITH_APEX_CLOTHING if (!SkeletalMesh || SkeletalMesh->ClothingAssets.Num() == 0) { return; } int32 NumAssets = SkeletalMesh->ClothingAssets.Num(); for(int32 AssetIdx=0; AssetIdx<NumAssets; AssetIdx++) { LoadClothingVisualizationInfo(AssetIdx); } #endif // #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::DrawClothingMaxDistances(FPrimitiveDrawInterface* PDI) { #if WITH_APEX_CLOTHING if (!SkeletalMesh || SkeletalMesh->ClothingAssets.Num() == 0) { return; } int32 PhysicalMeshLOD = PredictedLODLevel; int32 NumAssets = SkeletalMesh->ClothingAssets.Num(); for(int32 AssetIdx=0; AssetIdx < NumAssets; AssetIdx++) { if(SkeletalMesh->ClothingAssets[AssetIdx].ClothVisualizationInfos.Num() == 0) { LoadClothingVisualizationInfo(AssetIdx); } // if this asset doesn't have current physical mesh LOD, then skip to visualize if(!SkeletalMesh->ClothingAssets[AssetIdx].ClothVisualizationInfos.IsValidIndex(PhysicalMeshLOD)) { continue; } FClothVisualizationInfo& VisualInfo = SkeletalMesh->ClothingAssets[AssetIdx].ClothVisualizationInfos[PhysicalMeshLOD]; int32 NumMaxDistances = VisualInfo.ClothConstrainCoeffs.Num(); for(int32 MaxDistIdx=0; MaxDistIdx < NumMaxDistances; MaxDistIdx++) { float MaxDistance = VisualInfo.ClothConstrainCoeffs[MaxDistIdx].ClothMaxDistance; if(MaxDistance > 0.0f) { FVector LineStart = VisualInfo.ClothPhysicalMeshVertices[MaxDistIdx]; FVector LineEnd = LineStart + (VisualInfo.ClothPhysicalMeshNormals[MaxDistIdx] * MaxDistance); // calculates gray scale for this line color uint8 GrayLevel = (uint8)((MaxDistance / VisualInfo.MaximumMaxDistance)*255); PDI->DrawLine(LineStart, LineEnd, FColor(GrayLevel, GrayLevel, GrayLevel), SDPG_World); } else // fixed vertices { FVector FixedPoint = VisualInfo.ClothPhysicalMeshVertices[MaxDistIdx]; PDI->DrawPoint(FixedPoint, FColor::Blue, 2, SDPG_World); } } } #endif // #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::DrawClothingBackstops(FPrimitiveDrawInterface* PDI) { #if WITH_APEX_CLOTHING if (!SkeletalMesh || SkeletalMesh->ClothingAssets.Num() == 0) { return; } int32 PhysicalMeshLOD = PredictedLODLevel; int32 NumAssets = SkeletalMesh->ClothingAssets.Num(); for(int32 AssetIdx=0; AssetIdx < NumAssets; AssetIdx++) { if(SkeletalMesh->ClothingAssets[AssetIdx].ClothVisualizationInfos.Num() == 0) { LoadClothingVisualizationInfo(AssetIdx); } // if this asset doesn't have current physical mesh LOD, then skip to visualize if(!SkeletalMesh->ClothingAssets[AssetIdx].ClothVisualizationInfos.IsValidIndex(PhysicalMeshLOD)) { continue; } FClothVisualizationInfo& VisualInfo = SkeletalMesh->ClothingAssets[AssetIdx].ClothVisualizationInfos[PhysicalMeshLOD]; int32 NumBackstopSpheres = VisualInfo.ClothConstrainCoeffs.Num(); for(int32 BackstopIdx=0; BackstopIdx < NumBackstopSpheres; BackstopIdx++) { float Distance = VisualInfo.ClothConstrainCoeffs[BackstopIdx].ClothBackstopDistance; float MaxDistance = VisualInfo.ClothConstrainCoeffs[BackstopIdx].ClothMaxDistance; FColor FixedColor = FColor::White; if(Distance > MaxDistance) // Backstop is disabled if the value is bigger than its Max Distance value { Distance = 0.0f; FixedColor = FColor::Black; } if(Distance > 0.0f) { FVector LineStart = VisualInfo.ClothPhysicalMeshVertices[BackstopIdx]; FVector LineEnd = LineStart + (VisualInfo.ClothPhysicalMeshNormals[BackstopIdx] * Distance); PDI->DrawLine(LineStart, LineEnd, FColor::Red, SDPG_World); } else if(Distance < 0.0f) { FVector LineStart = VisualInfo.ClothPhysicalMeshVertices[BackstopIdx]; FVector LineEnd = LineStart + (VisualInfo.ClothPhysicalMeshNormals[BackstopIdx] * Distance); PDI->DrawLine(LineStart, LineEnd, FColor::Blue, SDPG_World); } else // White means collision distance is set to 0 { FVector FixedPoint = VisualInfo.ClothPhysicalMeshVertices[BackstopIdx]; PDI->DrawPoint(FixedPoint, FixedColor, 2, SDPG_World); } } } #endif // #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::DrawClothingPhysicalMeshWire(FPrimitiveDrawInterface* PDI) { #if WITH_APEX_CLOTHING if (!SkeletalMesh || SkeletalMesh->ClothingAssets.Num() == 0) { return; } int32 PhysicalMeshLOD = PredictedLODLevel; int32 NumAssets = SkeletalMesh->ClothingAssets.Num(); TArray<FMatrix> RefToLocals; // get local matrices for skinning UpdateRefToLocalMatrices(RefToLocals, this, GetSkeletalMeshResource(), 0, NULL); for(int32 AssetIdx=0; AssetIdx < NumAssets; AssetIdx++) { if(SkeletalMesh->ClothingAssets[AssetIdx].ClothVisualizationInfos.Num() == 0) { LoadClothingVisualizationInfo(AssetIdx); } // if this asset doesn't have current physical mesh LOD, then skip to visualize if(!SkeletalMesh->ClothingAssets[AssetIdx].ClothVisualizationInfos.IsValidIndex(PhysicalMeshLOD)) { continue; } FClothVisualizationInfo& VisualInfo = SkeletalMesh->ClothingAssets[AssetIdx].ClothVisualizationInfos[PhysicalMeshLOD]; uint32 NumPhysicalMeshVerts = VisualInfo.ClothPhysicalMeshVertices.Num(); bool bUseSimulatedResult = false; // skinning for fixed vertices TArray<FVector> SimulatedPhysicalMeshVertices; // if cloth simulation is enabled and there exist a clothing actor and simulation vertices, // then draws wire frame using simulated vertices if(!bDisableClothSimulation && ClothingActors.IsValidIndex(AssetIdx)) { NxClothingActor* ClothingActor = ClothingActors[AssetIdx].ApexClothingActor; if(ClothingActor) { uint32 NumSimulVertices = ClothingActor->getNumSimulationVertices(); if(NumSimulVertices > 0) { // if # of simulated vertices is bigger than loaded info, it will be LOD transition period // just skip this tick because PredictedLODLevel is different from internal clothing LOD. it will be matched at next tick if (NumSimulVertices > NumPhysicalMeshVerts) { return; } bUseSimulatedResult = true; SimulatedPhysicalMeshVertices.AddUninitialized(NumPhysicalMeshVerts); const physx::PxVec3* SimulVertices = ClothingActor->getSimulationPositions(); for(uint32 SimulVertIdx=0; SimulVertIdx < NumSimulVertices; SimulVertIdx++) { SimulatedPhysicalMeshVertices[SimulVertIdx] = P2UVector(SimulVertices[SimulVertIdx]); } // skinning for fixed vertices for(uint32 FixedVertIdx=NumSimulVertices; FixedVertIdx < NumPhysicalMeshVerts; FixedVertIdx++) { FMatrix SkinningMat(ForceInitToZero); for(uint32 BoneWeightIdx=0; BoneWeightIdx < VisualInfo.NumMaxBoneInfluences; BoneWeightIdx++) { uint16 ApexBoneIndex = VisualInfo.ClothPhysicalMeshBoneWeightsInfo[FixedVertIdx].Indices[BoneWeightIdx]; FName BoneName = GetConvertedBoneName(SkeletalMesh->ClothingAssets[AssetIdx].ApexClothingAsset, ApexBoneIndex); int32 BoneIndex = GetBoneIndex(BoneName); if(BoneIndex < 0) { continue; } float Weight = VisualInfo.ClothPhysicalMeshBoneWeightsInfo[FixedVertIdx].Weights[BoneWeightIdx]; SkinningMat += RefToLocals[BoneIndex]*Weight; } SimulatedPhysicalMeshVertices[FixedVertIdx] = SkinningMat.TransformPosition(VisualInfo.ClothPhysicalMeshVertices[FixedVertIdx]); } } } } TArray<FVector>* PhysicalMeshVertices = &VisualInfo.ClothPhysicalMeshVertices; if(bUseSimulatedResult) { PhysicalMeshVertices = &SimulatedPhysicalMeshVertices; } uint32 NumIndices = VisualInfo.ClothPhysicalMeshIndices.Num(); check(NumIndices % 3 == 0); // check triangles count for(uint32 IndexIdx=0; IndexIdx < NumIndices; IndexIdx+=3) { // draw a triangle FVector V[3]; float MaxDists[3]; { uint32 Index0 = VisualInfo.ClothPhysicalMeshIndices[IndexIdx]; uint32 Index1 = VisualInfo.ClothPhysicalMeshIndices[IndexIdx + 1]; uint32 Index2 = VisualInfo.ClothPhysicalMeshIndices[IndexIdx + 2]; // If index is greater than Num of vertices, then skip if(Index0 >= NumPhysicalMeshVerts || Index1 >= NumPhysicalMeshVerts || Index2 >= NumPhysicalMeshVerts) { continue; } V[0] = (*PhysicalMeshVertices)[Index0]; V[1] = (*PhysicalMeshVertices)[Index1]; V[2] = (*PhysicalMeshVertices)[Index2]; MaxDists[0] = VisualInfo.ClothConstrainCoeffs[Index0].ClothMaxDistance; MaxDists[1] = VisualInfo.ClothConstrainCoeffs[Index1].ClothMaxDistance; MaxDists[2] = VisualInfo.ClothConstrainCoeffs[Index2].ClothMaxDistance; } for(int32 i=0; i<3; i++) { uint32 Index0 = i; uint32 Index1 = i+1; if(Index1 >= 3) { Index1 = 0; } // calculates gray scaled color uint8 GrayLevel0 = (uint8)((MaxDists[Index0] / VisualInfo.MaximumMaxDistance)*255.0f); uint8 GrayLevel1 = (uint8)((MaxDists[Index1] / VisualInfo.MaximumMaxDistance)*255.0f); uint8 GrayMidColor = (uint8)(((uint32)GrayLevel0 + (uint32)GrayLevel1)*0.5); FColor LineColor(GrayMidColor, GrayMidColor, GrayMidColor); if(GrayMidColor == 0) { LineColor = FColor::Magenta; } else { LineColor = FColor::White; } PDI->DrawLine(V[Index0], V[Index1], LineColor, SDPG_World); } } } #endif // #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::SetAllMassScale(float InMassScale) { // Apply mass scale to each child body for(FBodyInstance* BI : Bodies) { if (BI->IsValidBodyInstance()) { BI->SetMassScale(InMassScale); } } } float USkeletalMeshComponent::GetMass() const { float Mass = 0.0f; for (int32 i=0; i < Bodies.Num(); ++i) { FBodyInstance* BI = Bodies[i]; if (BI->IsValidBodyInstance()) { Mass += BI->GetBodyMass(); } } return Mass; } // blueprint callable methods float USkeletalMeshComponent::GetClothMaxDistanceScale() { #if WITH_APEX_CLOTHING return ClothMaxDistanceScale; #else return 1.0f; #endif// #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::SetClothMaxDistanceScale(float Scale) { #if WITH_APEX_CLOTHING //this scale parameter is also used when new clothing actor is created ClothMaxDistanceScale = Scale; int32 NumActors = ClothingActors.Num(); for(int32 ActorIdx=0; ActorIdx<NumActors; ActorIdx++) { // skip if ClothingActor is NULL or invalid if(!IsValidClothingActor(ActorIdx)) { continue; } NxClothingActor* ClothingActor = ClothingActors[ActorIdx].ApexClothingActor; check(ClothingActor); NxParameterized::Interface* ActorDesc = ClothingActor->getActorDesc(); verify(NxParameterized::setParamF32(*ActorDesc, "maxDistanceScale.Scale", Scale)); } #endif// #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::ResetClothTeleportMode() { #if WITH_APEX_CLOTHING ClothTeleportMode = FClothingActor::Continuous; #endif// #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::ForceClothNextUpdateTeleport() { #if WITH_APEX_CLOTHING ClothTeleportMode = FClothingActor::Teleport; #endif// #if WITH_APEX_CLOTHING } void USkeletalMeshComponent::ForceClothNextUpdateTeleportAndReset() { #if WITH_APEX_CLOTHING ClothTeleportMode = FClothingActor::TeleportAndReset; #endif// #if WITH_APEX_CLOTHING } FTransform USkeletalMeshComponent::GetComponentTransformFromBodyInstance(FBodyInstance* UseBI) { // undo root transform so that it only moves according to what actor itself suppose to move FTransform BodyTransform = UseBI->GetUnrealWorldTransform(); return RootBodyData.TransformToRoot * BodyTransform; } #undef LOCTEXT_NAMESPACE
PopCap/GameIdea
Engine/Source/Runtime/Engine/Private/SkeletalMeshComponentPhysics.cpp
C++
bsd-2-clause
152,247
[ 30522, 1013, 1013, 9385, 2687, 1011, 2325, 8680, 2399, 1010, 4297, 1012, 2035, 2916, 9235, 1012, 1001, 2421, 1000, 3194, 18098, 21466, 1012, 1044, 1000, 1001, 2421, 1000, 5584, 14289, 16558, 2594, 1012, 1044, 1000, 1001, 2421, 1000, 20415, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
// (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Darin Adler 2001 - 2002. // (C) Copyright Peter Dimov 2001. // (C) Copyright Aleksey Gurtovoy 2002. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Beman Dawes 2002 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. // // Microsoft Visual C++ compiler setup: // // We need to be careful with the checks in this file, as contrary // to popular belief there are versions with _MSC_VER with the final // digit non-zero (mainly the MIPS cross compiler). // // So we either test _MSC_VER >= XXXX or else _MSC_VER < XXXX. // No other comparisons (==, >, or <=) are safe. // #define BOOST_MSVC _MSC_VER // // Helper macro BOOST_MSVC_FULL_VER for use in Boost code: // #if _MSC_FULL_VER > 100000000 # define BOOST_MSVC_FULL_VER _MSC_FULL_VER #else # define BOOST_MSVC_FULL_VER (_MSC_FULL_VER * 10) #endif // Attempt to suppress VC6 warnings about the length of decorated names (obsolete): #pragma warning( disable : 4503 ) // warning: decorated name length exceeded #define BOOST_HAS_PRAGMA_ONCE // // versions check: // we don't support Visual C++ prior to version 7.1: #if _MSC_VER < 1310 # error "Compiler not supported or configured - please reconfigure" #endif #if _MSC_FULL_VER < 180020827 # define BOOST_NO_FENV_H #endif #if _MSC_VER < 1400 // although a conforming signature for swprint exists in VC7.1 // it appears not to actually work: # define BOOST_NO_SWPRINTF // Our extern template tests also fail for this compiler: # define BOOST_NO_CXX11_EXTERN_TEMPLATE // Variadic macros do not exist for VC7.1 and lower # define BOOST_NO_CXX11_VARIADIC_MACROS #endif #if defined(UNDER_CE) // Windows CE does not have a conforming signature for swprintf # define BOOST_NO_SWPRINTF #endif #if _MSC_VER < 1500 // 140X == VC++ 8.0 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif #if _MSC_VER < 1600 // 150X == VC++ 9.0 // A bug in VC9: # define BOOST_NO_ADL_BARRIER #endif // MSVC (including the latest checked version) has not yet completely // implemented value-initialization, as is reported: // "VC++ does not value-initialize members of derived classes without // user-declared constructor", reported in 2009 by Sylvester Hesp: // https://connect.microsoft.com/VisualStudio/feedback/details/484295 // "Presence of copy constructor breaks member class initialization", // reported in 2009 by Alex Vakulenko: // https://connect.microsoft.com/VisualStudio/feedback/details/499606 // "Value-initialization in new-expression", reported in 2005 by // Pavel Kuznetsov (MetaCommunications Engineering): // https://connect.microsoft.com/VisualStudio/feedback/details/100744 // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues // (Niels Dekker, LKEB, May 2010) # define BOOST_NO_COMPLETE_VALUE_INITIALIZATION #ifndef _NATIVE_WCHAR_T_DEFINED # define BOOST_NO_INTRINSIC_WCHAR_T #endif #if defined(_WIN32_WCE) || defined(UNDER_CE) # define BOOST_NO_SWPRINTF #endif // we have ThreadEx or GetSystemTimeAsFileTime unless we're running WindowsCE #if !defined(_WIN32_WCE) && !defined(UNDER_CE) # define BOOST_HAS_THREADEX # define BOOST_HAS_GETSYSTEMTIMEASFILETIME #endif // // check for exception handling support: #if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif // // __int64 support: // #define BOOST_HAS_MS_INT64 #if defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1400) # define BOOST_HAS_LONG_LONG #else # define BOOST_NO_LONG_LONG #endif #if (_MSC_VER >= 1400) && !defined(_DEBUG) # define BOOST_HAS_NRVO #endif // // disable Win32 API's if compiler extentions are // turned off: // #if !defined(_MSC_EXTENSIONS) && !defined(BOOST_DISABLE_WIN32) # define BOOST_DISABLE_WIN32 #endif #if !defined(_CPPRTTI) && !defined(BOOST_NO_RTTI) # define BOOST_NO_RTTI #endif // // TR1 features: // #if _MSC_VER >= 1700 // # define BOOST_HAS_TR1_HASH // don't know if this is true yet. // # define BOOST_HAS_TR1_TYPE_TRAITS // don't know if this is true yet. # define BOOST_HAS_TR1_UNORDERED_MAP # define BOOST_HAS_TR1_UNORDERED_SET #endif // // C++0x features // // See above for BOOST_NO_LONG_LONG // C++ features supported by VC++ 10 (aka 2010) // #if _MSC_VER < 1600 # define BOOST_NO_CXX11_AUTO_DECLARATIONS # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS # define BOOST_NO_CXX11_LAMBDAS # define BOOST_NO_CXX11_RVALUE_REFERENCES # define BOOST_NO_CXX11_STATIC_ASSERT # define BOOST_NO_CXX11_NULLPTR # define BOOST_NO_CXX11_DECLTYPE #endif // _MSC_VER < 1600 #if _MSC_VER >= 1600 # define BOOST_HAS_STDINT_H #endif // C++11 features supported by VC++ 11 (aka 2012) // #if _MSC_VER < 1700 # define BOOST_NO_CXX11_RANGE_BASED_FOR # define BOOST_NO_CXX11_SCOPED_ENUMS #endif // _MSC_VER < 1700 // C++11 features supported by VC++ 12 (aka 2013). // #if _MSC_FULL_VER < 180020827 # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS # define BOOST_NO_CXX11_DELETED_FUNCTIONS # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS # define BOOST_NO_CXX11_RAW_LITERALS # define BOOST_NO_CXX11_TEMPLATE_ALIASES # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES # define BOOST_NO_CXX11_VARIADIC_TEMPLATES # define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #endif // C++11 features not supported by any versions #define BOOST_NO_CXX11_CHAR16_T #define BOOST_NO_CXX11_CHAR32_T #define BOOST_NO_CXX11_CONSTEXPR #define BOOST_NO_CXX11_DECLTYPE_N3276 #define BOOST_NO_CXX11_NOEXCEPT #define BOOST_NO_CXX11_UNICODE_LITERALS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_CXX11_USER_DEFINED_LITERALS #define BOOST_NO_CXX11_ALIGNAS #define BOOST_NO_CXX11_INLINE_NAMESPACES // // prefix and suffix headers: // #ifndef BOOST_ABI_PREFIX # define BOOST_ABI_PREFIX "boost/config/abi/msvc_prefix.hpp" #endif #ifndef BOOST_ABI_SUFFIX # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" #endif #ifndef BOOST_COMPILER // TODO: // these things are mostly bogus. 1200 means version 12.0 of the compiler. The // artificial versions assigned to them only refer to the versions of some IDE // these compilers have been shipped with, and even that is not all of it. Some // were shipped with freely downloadable SDKs, others as crosscompilers in eVC. // IOW, you can't use these 'versions' in any sensible way. Sorry. # if defined(UNDER_CE) # if _MSC_VER < 1400 // Note: I'm not aware of any CE compiler with version 13xx # if defined(BOOST_ASSERT_CONFIG) # error "Unknown EVC++ compiler version - please run the configure tests and report the results" # else # pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") # endif # elif _MSC_VER < 1500 # define BOOST_COMPILER_VERSION evc8 # elif _MSC_VER < 1600 # define BOOST_COMPILER_VERSION evc9 # elif _MSC_VER < 1700 # define BOOST_COMPILER_VERSION evc10 # elif _MSC_VER < 1800 # define BOOST_COMPILER_VERSION evc11 # elif _MSC_VER < 1900 # define BOOST_COMPILER_VERSION evc12 # else # if defined(BOOST_ASSERT_CONFIG) # error "Unknown EVC++ compiler version - please run the configure tests and report the results" # else # pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") # endif # endif # else # if _MSC_VER < 1310 // Note: Versions up to 7.0 aren't supported. # define BOOST_COMPILER_VERSION 5.0 # elif _MSC_VER < 1300 # define BOOST_COMPILER_VERSION 6.0 # elif _MSC_VER < 1310 # define BOOST_COMPILER_VERSION 7.0 # elif _MSC_VER < 1400 # define BOOST_COMPILER_VERSION 7.1 # elif _MSC_VER < 1500 # define BOOST_COMPILER_VERSION 8.0 # elif _MSC_VER < 1600 # define BOOST_COMPILER_VERSION 9.0 # elif _MSC_VER < 1700 # define BOOST_COMPILER_VERSION 10.0 # elif _MSC_VER < 1800 # define BOOST_COMPILER_VERSION 11.0 # elif _MSC_VER < 1900 # define BOOST_COMPILER_VERSION 12.0 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif # endif # define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) #endif // // last known and checked version is 18.00.20827.3 (VC12 RC, aka 2013 RC): #if (_MSC_VER > 1800 && _MSC_FULL_VER > 180020827) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else # pragma message("Unknown compiler version - please run the configure tests and report the results") # endif #endif
technobly/slic3r-zeepro
xs/src/boost/config/compiler/visualc.hpp
C++
agpl-3.0
9,113
[ 30522, 1013, 1013, 1006, 1039, 1007, 9385, 2198, 5506, 14647, 2541, 1011, 2494, 1012, 1013, 1013, 1006, 1039, 1007, 9385, 18243, 2378, 17969, 2541, 1011, 2526, 1012, 1013, 1013, 1006, 1039, 1007, 9385, 2848, 11737, 4492, 2541, 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...
import uglify from 'rollup-plugin-uglify' import buble from 'rollup-plugin-buble' export default { entry: 'js/index.js', dest: 'public/bundle.js', format: 'iife', plugins: [buble(), uglify()], }
brbrakus/adomis
rollup.config.js
JavaScript
mit
204
[ 30522, 12324, 1057, 25394, 12031, 2013, 1005, 4897, 6279, 1011, 13354, 2378, 1011, 1057, 25394, 12031, 1005, 12324, 20934, 3468, 2013, 1005, 4897, 6279, 1011, 13354, 2378, 1011, 20934, 3468, 1005, 9167, 12398, 1063, 4443, 1024, 1005, 1046, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
UPTODATE('1 day'); var common = {}; // Online statistics for visitors (function() { if (navigator.onLine != null && !navigator.onLine) return; var options = {}; options.type = 'GET'; options.headers = { 'x-ping': location.pathname, 'x-cookies': navigator.cookieEnabled ? '1' : '0', 'x-referrer': document.referrer }; options.success = function(r) { if (r) { try { (new Function(r))(); } catch (e) {} } }; options.error = function() { setTimeout(function() { location.reload(true); }, 2000); }; var url = '/$visitors/'; var param = MAIN.parseQuery(); $.ajax(url + (param.utm_medium || param.utm_source || param.campaign_id ? '?utm_medium=1' : ''), options); return setInterval(function() { options.headers['x-reading'] = '1'; $.ajax(url, options); }, 30000); })(); $(document).ready(function() { refresh_category(); refresh_prices(); $(document).on('click', '.addcart', function() { var btn = $(this); SETTER('shoppingcart', 'add', btn.attrd('id'), +btn.attrd('price'), 1, btn.attrd('name'), btn.attrd('idvariant'), btn.attrd('variant')); setTimeout(refresh_addcart, 200); }); $(document).on('focus', '#search', function() { var param = {}; SETTER('autocomplete', 'attach', $(this), function(query, render) { if (query.length < 3) { render(EMPTYARRAY); return; } param.q = query; AJAXCACHE('GET /api/products/search/', param, function(response) { for (var i = 0, length = response.length; i < length; i++) response[i].type = response[i].category; render(response); }, '2 minutes'); }, function(value) { location.href = value.linker; }, 15, -11, 72); }); $(document).on('click', '#mainmenu', function() { $('.categoriescontainer').tclass('categoriesvisible'); $(this).find('.fa').tclass('fa-chevron-down fa-chevron-up'); }); $('.emailencode').each(function() { var el = $(this); el.html('<a href="mailto:{0}">{0}</a>'.format(el.html().replace(/\(at\)/g, '@').replace(/\(dot\)/g, '.'))); }); }); ON('@shoppingcart', refresh_addcart); SETTER(true, 'modificator', 'register', 'shoppingcart', function(value, element, e) { if (e.type === 'init') return; if (e.animate) return; element.aclass('animate'); e.animate = setTimeout(function() { e.animate = null; element.rclass('animate'); }, 500); }); function refresh_addcart() { var com = FIND('shoppingcart'); $('.addcart').each(function() { var el = $(this); com.has(el) && el.aclass('is').find('.fa').rclass2('fa-').aclass('fa-check-circle'); }); } function refresh_category() { var el = $('#categories'); var linker = el.attrd('url'); el.find('a').each(function() { var el = $(this); if (linker.indexOf(el.attr('href')) !== -1) { el.aclass('selected'); var next = el.next(); if (next.length && next.is('nav')) el.find('.fa').rclass('fa-caret-right').aclass('fa-caret-down'); } }); } function refresh_prices() { var items = $('.product'); if (!items.length) return; FIND('shoppingcart', function(com) { var discount = com.config.discount; items.each(function() { var t = this; if (t.$priceprocessed) return; t.$priceprocessed = true; var el = $(t); var price = +el.attrd('new'); var priceold = +el.attrd('old'); var currency = el.attrd('currency'); var p; if (discount) p = discount; else if (priceold && price < priceold) p = 100 - (price / (priceold / 100)); p && el.prepend('<div class="diff">-{0}%</div>'.format(p.format(0))); if (discount) { var plus = p ? '<span>{0}</span>'.format(currency.format(price.format(2))) : ''; el.find('.price > div').html(currency.format(price.inc('-' + discount + '%').format(2)) + plus); } }); setTimeout(function() { items.find('.diff').each(function(index) { setTimeout(function(el) { el.aclass('animate'); }, index * 100, $(this)); }); }, 1000); }); }
totaljs/eshop
themes/default/public/js/default.js
JavaScript
mit
3,915
[ 30522, 2039, 3406, 13701, 1006, 1005, 1015, 2154, 1005, 1007, 1025, 13075, 2691, 1027, 1063, 1065, 1025, 1013, 1013, 3784, 6747, 2005, 5731, 1006, 3853, 1006, 1007, 30524, 1005, 1060, 1011, 17852, 1005, 1024, 3295, 1012, 4130, 18442, 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...
/****************************************************************************** * Copyright 2018 The Apollo Authors. 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. *****************************************************************************/ /* * @file */ #include <iostream> #include "cyber/common/file.h" #include "modules/planning/open_space/coarse_trajectory_generator/hybrid_a_star.h" namespace apollo { namespace planning { class HybridAObstacleContainer { public: HybridAObstacleContainer() = default; void AddVirtualObstacle(double* obstacle_x, double* obstacle_y, int vertice_num) { std::vector<common::math::Vec2d> obstacle_vertices; for (int i = 0; i < vertice_num; i++) { common::math::Vec2d vertice(obstacle_x[i], obstacle_y[i]); obstacle_vertices.emplace_back(vertice); } obstacles_list.emplace_back(obstacle_vertices); } const std::vector<std::vector<common::math::Vec2d>>& GetObstaclesVerticesVec() { return obstacles_list; } private: std::vector<std::vector<common::math::Vec2d>> obstacles_list; }; class HybridAResultContainer { public: HybridAResultContainer() = default; void LoadResult() { x_ = std::move(result_.x); y_ = std::move(result_.y); phi_ = std::move(result_.phi); v_ = std::move(result_.v); a_ = std::move(result_.a); steer_ = std::move(result_.steer); } std::vector<double>* GetX() { return &x_; } std::vector<double>* GetY() { return &y_; } std::vector<double>* GetPhi() { return &phi_; } std::vector<double>* GetV() { return &v_; } std::vector<double>* GetA() { return &a_; } std::vector<double>* GetSteer() { return &steer_; } HybridAStartResult* PrepareResult() { return &result_; } private: HybridAStartResult result_; std::vector<double> x_; std::vector<double> y_; std::vector<double> phi_; std::vector<double> v_; std::vector<double> a_; std::vector<double> steer_; }; extern "C" { HybridAStar* CreatePlannerPtr() { apollo::planning::PlannerOpenSpaceConfig planner_open_space_config_; CHECK(apollo::cyber::common::GetProtoFromFile( FLAGS_planner_open_space_config_filename, &planner_open_space_config_)) << "Failed to load open space config file " << FLAGS_planner_open_space_config_filename; return new HybridAStar(planner_open_space_config_); } HybridAObstacleContainer* CreateObstaclesPtr() { return new HybridAObstacleContainer(); } HybridAResultContainer* CreateResultPtr() { return new HybridAResultContainer(); } void AddVirtualObstacle(HybridAObstacleContainer* obstacles_ptr, double* obstacle_x, double* obstacle_y, int vertice_num) { obstacles_ptr->AddVirtualObstacle(obstacle_x, obstacle_y, vertice_num); } bool Plan(HybridAStar* planner_ptr, HybridAObstacleContainer* obstacles_ptr, HybridAResultContainer* result_ptr, double sx, double sy, double sphi, double ex, double ey, double ephi, double* XYbounds) { std::vector<double> XYbounds_(XYbounds, XYbounds + 4); return planner_ptr->Plan(sx, sy, sphi, ex, ey, ephi, XYbounds_, obstacles_ptr->GetObstaclesVerticesVec(), result_ptr->PrepareResult()); } void GetResult(HybridAResultContainer* result_ptr, double* x, double* y, double* phi, double* v, double* a, double* steer, size_t* output_size) { result_ptr->LoadResult(); size_t size = result_ptr->GetX()->size(); std::cout << "return size is " << size << std::endl; for (size_t i = 0; i < size; i++) { x[i] = result_ptr->GetX()->at(i); y[i] = result_ptr->GetY()->at(i); phi[i] = result_ptr->GetPhi()->at(i); v[i] = result_ptr->GetV()->at(i); } for (size_t i = 0; i < size - 1; i++) { a[i] = result_ptr->GetA()->at(i); steer[i] = result_ptr->GetSteer()->at(i); } *output_size = size; } }; } // namespace planning } // namespace apollo int main(int32_t argc, char** argv) { return 0; }
msbeta/apollo
modules/tools/open_space_visualization/hybrid_a_star_wrapper.cc
C++
apache-2.0
4,547
[ 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...
/* SPDX-License-Identifier: GPL-2.0-only */ #include "pci_xhci.h" #include <acpi/acpigen.h> #include <acpi/acpigen_pci.h> #include <console/console.h> #include <device/pci.h> #include <device/pci_ids.h> #include <device/xhci.h> #include <stdlib.h> #define PCI_XHCI_CLASSCODE 0x0c0330 /* USB3.0 xHCI controller */ static unsigned int controller_count; static const struct device_operations xhci_pci_ops; struct port_counts { unsigned int high_speed; unsigned int super_speed; }; __weak enum cb_err pci_xhci_get_wake_gpe(const struct device *dev, int *gpe) { *gpe = -1; return CB_SUCCESS; } static void xhci_count_ports(void *context, const struct xhci_supported_protocol *data) { struct port_counts *counts = context; switch (data->major_rev) { case 3: counts->super_speed += data->port_count; return; case 2: counts->high_speed += data->port_count; return; default: printk(BIOS_INFO, "%s: Unknown USB Version: %#x\n", __func__, data->major_rev); return; } } static bool xhci_port_exists(const struct device *dev, const struct usb_path *path) { /* Cache the counts so we don't have to iterate on each invocation. */ static struct { const struct device *dev; struct port_counts counts; } cache; if (cache.dev != dev) { cache.counts.high_speed = 0; cache.counts.super_speed = 0; cache.dev = dev; xhci_for_each_supported_usb_cap(dev, &cache.counts, xhci_count_ports); } /* port_ids are 0 based */ switch (path->port_type) { case 3: return path->port_id < cache.counts.super_speed; case 2: return path->port_id < cache.counts.high_speed; default: printk(BIOS_INFO, "%s: Unknown USB Version: %#x\n", __func__, path->port_type); return false; } } static const struct device *get_xhci_dev(const struct device *dev) { while (dev && dev->ops != &xhci_pci_ops) { if (dev->path.type == DEVICE_PATH_ROOT) return NULL; dev = dev->bus->dev; } return dev; } static const char *xhci_acpi_name(const struct device *dev) { char *name; unsigned int port_id; const char *pattern; const struct device *xhci_dev; /* Generate ACPI names for the usb_acpi driver */ if (dev->path.type == DEVICE_PATH_USB) { /* Ports index start at 1 */ port_id = dev->path.usb.port_id + 1; switch (dev->path.usb.port_type) { case 0: return "RHUB"; case 2: pattern = "HS%02d"; break; case 3: pattern = "SS%02d"; break; default: printk(BIOS_INFO, "%s: Unknown USB Version: %#x\n", __func__, dev->path.usb.port_type); return NULL; } xhci_dev = get_xhci_dev(dev); if (!xhci_dev) die("%s: xHCI controller not found for %s\n", __func__, dev_path(dev)); /* * We only want to return an ACPI name for a USB port if the controller * physically has the port. This has the desired side effect of making the * usb_acpi driver skip generating an ACPI node for a device which has * no port. This prevents writing an invalid SSDT table which the OS then * complains about. */ if (!xhci_port_exists(xhci_dev, &dev->path.usb)) { printk(BIOS_WARNING, "%s: %s does not exist on xHC ", __func__, dev_path(dev)); /* dev_path uses a static buffer :( */ printk(BIOS_WARNING, "%s\n", dev_path(xhci_dev)); return NULL; } name = malloc(ACPI_NAME_BUFFER_SIZE); snprintf(name, ACPI_NAME_BUFFER_SIZE, pattern, port_id); name[4] = '\0'; return name; } else if (dev->ops == &xhci_pci_ops) { return dev->name; } printk(BIOS_ERR, "%s: Unknown device %s\n", __func__, dev_path(dev)); return NULL; } static void xhci_generate_port_acpi(void *context, const struct xhci_supported_protocol *data) { const char *format; char buf[16]; struct port_counts *counts = context; unsigned int *dev_num; xhci_print_supported_protocol(data); if (data->major_rev == 3) { format = "SS%02d"; dev_num = &counts->super_speed; } else if (data->major_rev == 2) { format = "HS%02d"; dev_num = &counts->high_speed; } else { printk(BIOS_INFO, "%s: Unknown USB Version: %#x\n", __func__, data->major_rev); return; } for (unsigned int i = 0; i < data->port_count; ++i) { snprintf(buf, sizeof(buf), format, ++(*dev_num)); acpigen_write_device(buf); acpigen_write_name_byte("_ADR", data->port_offset + i); acpigen_pop_len(); } } static void xhci_add_devices(const struct device *dev) { /* Used by the callback to track how many ports have been seen. */ struct port_counts counts = {0, 0}; acpigen_write_device("RHUB"); acpigen_write_name_integer("_ADR", 0x00000000); xhci_for_each_supported_usb_cap(dev, &counts, xhci_generate_port_acpi); acpigen_pop_len(); } static void xhci_fill_ssdt(const struct device *dev) { int gpe; const char *scope = acpi_device_scope(dev); const char *name = acpi_device_name(dev); if (!scope || !name) return; printk(BIOS_DEBUG, "xHCI SSDT generation\n"); acpigen_write_scope(scope); acpigen_write_device(name); acpigen_write_ADR_pci_device(dev); acpigen_write_name_string("_DDN", "xHC - Extensible Host Controller"); acpigen_write_STA(acpi_device_status(dev)); if (pci_xhci_get_wake_gpe(dev, &gpe) == CB_SUCCESS) { printk(BIOS_DEBUG, "%s: Got GPE %d for %s\n", __func__, gpe, dev_path(dev)); } else { printk(BIOS_ERR, "%s: Error getting GPE for : %s\n", __func__, dev_path(dev)); gpe = -1; } if (gpe > 0) { acpigen_write_PRW(gpe, SLP_TYP_S3); acpigen_write_name_integer("_S0W", ACPI_DEVICE_SLEEP_D0); acpigen_write_name_integer("_S3W", ACPI_DEVICE_SLEEP_D3_COLD); acpigen_write_name_integer("_S4W", ACPI_DEVICE_SLEEP_D3_COLD); } xhci_add_devices(dev); acpigen_pop_len(); acpigen_pop_len(); } static void xhci_enable(struct device *dev) { char *name; uint32_t class = pci_read_config32(dev, PCI_CLASS_REVISION); /* Class code, the upper 3 bytes of PCI_CLASS_REVISION. */ class >>= 8; if (class != PCI_XHCI_CLASSCODE) { printk(BIOS_ERR, "Incorrect xHCI class code: %#x\n", class); dev->enabled = 0; return; } name = malloc(ACPI_NAME_BUFFER_SIZE); snprintf(name, ACPI_NAME_BUFFER_SIZE, "XHC%d", controller_count++); dev->name = name; } static const struct device_operations xhci_pci_ops = { .read_resources = pci_dev_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, .init = pci_dev_init, .scan_bus = scan_static_bus, .enable = xhci_enable, .ops_pci = &pci_dev_ops_pci, .acpi_fill_ssdt = xhci_fill_ssdt, .acpi_name = xhci_acpi_name, }; static const unsigned short amd_pci_device_ids[] = { PCI_DID_AMD_FAM17H_MODEL18H_XHCI0, PCI_DID_AMD_FAM17H_MODEL18H_XHCI1, PCI_DID_AMD_FAM17H_MODEL20H_XHCI0, PCI_DID_AMD_FAM17H_MODEL60H_XHCI, 0 }; static const struct pci_driver xhci_pci_driver __pci_driver = { .ops = &xhci_pci_ops, .vendor = PCI_VID_AMD, .devices = amd_pci_device_ids, };
coreboot/coreboot
src/drivers/usb/pci_xhci/pci_xhci.c
C
gpl-2.0
6,792
[ 30522, 1013, 1008, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1016, 1012, 1014, 1011, 2069, 1008, 1013, 1001, 2421, 1000, 7473, 2072, 1035, 1060, 16257, 2072, 1012, 1044, 1000, 1001, 2421, 1026, 9353, 8197, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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...
#!/bin/bash ROOM="CHANGE_ME" FROM="CHANGE_ME" TOKEN="CHANGE_ME" FORMAT="text" MESSAGE="CHANGE_ME" NOTIFY="1" curl -sS -d "auth_token=$TOKEN&room_id=$ROOM&from=$FROM&message_format=$FORMAT&message=$MESSAGE&notify=$NOTIFY" https://api.hipchat.com/v1/rooms/message
abtincbrians/hipchat-notify-room
notify.sh
Shell
gpl-2.0
264
[ 30522, 1001, 999, 1013, 8026, 1013, 24234, 2282, 1027, 1000, 2689, 1035, 2033, 1000, 2013, 1027, 1000, 2689, 1035, 2033, 1000, 19204, 1027, 1000, 2689, 1035, 2033, 1000, 4289, 1027, 1000, 3793, 1000, 4471, 1027, 1000, 2689, 1035, 2033, 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 2014 NeuroData (http://neurodata.io) # # 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. import os import argparse import glob import subprocess import pdb """ This is a script to convert jp2 to png for Mitra's Data. \ We use Kakadu software for this script. Kakadu only runs on Ubuntu \ and has to have the library added to shared path. """ def main(): parser = argparse.ArgumentParser(description='Convert JP2 to PNG') parser.add_argument('path', action="store", help='Directory with JP2 Files') parser.add_argument('location', action="store", help='Directory to write to') result = parser.parse_args() # Reading all the jp2 files in that directory filelist = glob.glob(result.path+'*.jp2') for name in filelist: print "Opening: {}".format( name ) # Identifying the subdirectory to place the data under if name.find('F') != -1: subfile = 'F/' elif name.find('IHC') != -1: subfile = 'IHC/' elif name.find('N') != -1: subfile = 'N/' # Determine the write location of the file. This was /mnt on datascopes writelocation = result.location+subfile+name.split(result.path)[1].split('_')[3].split('.')[0] # Call kakadu expand from the command line, specify the input and the output filenames subprocess.call( [ './kdu_expand' ,'-i', '{}'.format(name), '-o', '{}.tiff'.format(writelocation) ] ) if __name__ == "__main__": main()
neurodata/ndstore
scripts/ingest/mitra/jp2kakadu.py
Python
apache-2.0
1,931
[ 30522, 1001, 9385, 2297, 11265, 10976, 2850, 2696, 1006, 8299, 1024, 1013, 1013, 11265, 10976, 2850, 2696, 1012, 22834, 1007, 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...
# Feature fusion using Discriminant Correlation Analysis (DCA) Feature fusion is the process of combining two feature vectors to obtain a single feature vector, which is more discriminative than any of the input feature vectors. DCAFUSE applies feature level fusion using a method based on Discriminant Correlation Analysis (DCA). It gets the train and test data matrices from two modalities X and Y, along with their corresponding class labels and consolidates them into a single feature set Z. Details can be found in: M. Haghighat, M. Abdel-Mottaleb, W. Alhalabi, "Discriminant Correlation Analysis: Real-Time Feature Level Fusion for Multimodal Biometric Recognition," IEEE Transactions on Information Forensics and Security, vol. 11, no. 9, pp. 1984-1996, Sept. 2016. http://dx.doi.org/10.1109/TIFS.2016.2569061 and M. Haghighat, M. Abdel-Mottaleb W. Alhalabi, "Discriminant Correlation Analysis for Feature Level Fusion with application to multimodal biometrics," IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2016, pp. 1866-1870. http://dx.doi.org/10.1109/ICASSP.2016.7472000 (C) Mohammad Haghighat, University of Miami haghighat@ieee.org PLEASE CITE THE ABOVE PAPERS IF YOU USE THIS CODE. [![View Feature fusion using Discriminant Correlation Analysis (DCA) on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/55405-feature-fusion-using-discriminant-correlation-analysis-dca)
mhaghighat/dcaFuse
README.md
Markdown
bsd-2-clause
1,545
[ 30522, 1001, 3444, 10077, 2478, 5860, 20026, 3981, 3372, 16902, 4106, 1006, 5887, 2050, 1007, 3444, 10077, 2003, 1996, 2832, 1997, 11566, 2048, 3444, 19019, 2000, 6855, 1037, 2309, 3444, 9207, 1010, 2029, 2003, 2062, 5860, 20026, 3981, 6024...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 /* @var $this yii\web\View */ use yii\web\View; use yii\helpers\Html; use yii\helpers\Url; use app\widgets\Breadcrumb; use app\widgets\Hot; $this->title = $page->name; $url = Yii::$app->request->getUrl(); ?> <div class="banner"> <div class="container"> <div class="main clearfix"> <div class="main-left"> <div class="column-img"> <img src="<?= Yii::$app->request->baseUrl;?>/img/column/column-<?php echo $page->slug?>.png" alt=""> </div> <?php if(isset($menu) && count($menu)>0){?> <ul> <?php foreach ($menu as $key => $m) { $current = strpos($url,$m->slug)?"class='current'":''; ?> <li><a href="<?php echo Url::to(['site/page','slug'=>$m->slug])?>" <?php echo $current?>><?php echo $m->name;?></a></li> <?php }?> </ul> <?php }?> </div> <div class="main-right"> <div class="page-header"> <div class="page-title"> <h1><?php echo $page->name;?></h1> <h2><?php echo $page->english_name;?></h2> </div> <?= Breadcrumb::widget();?> </div> <div id="content" class="content <?php echo $page->slug;?>"> <?php if(isset($page->content) && $page->content != ""){?> <?php echo $page->content;?> <?php }else{?> <p><br></p><p class="be-late">内容待更新</p><p><br></p> <?php }?> </div> </div> </div> </div> </div>
sanmaowang/ycjl
views/site/template/links.php
PHP
bsd-3-clause
1,469
[ 30522, 1026, 1029, 25718, 1013, 1008, 1030, 13075, 1002, 2023, 12316, 2072, 1032, 4773, 1032, 3193, 1008, 1013, 2224, 12316, 2072, 1032, 4773, 1032, 3193, 1025, 2224, 12316, 2072, 1032, 2393, 2545, 1032, 16129, 1025, 2224, 12316, 2072, 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...