code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
package com.opentravelsoft.service.portal; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.opentravelsoft.entity.Branch; import com.opentravelsoft.providers.BranchDao; @Service("BranchService") public class BranchServiceImpl implements BranchService { @Autowired private BranchDao branchDao; public Branch roGetBranch(int branchId) { return branchDao.get(branchId); } public List<Branch> roGetBranchList() { return branchDao.getAll(); } }
stevenzh/tourismwork
src/modules/service/src/main/java/com/opentravelsoft/service/portal/BranchServiceImpl.java
Java
gpl-2.0
563
var XMPCommonFwdDeclarations_8h = [ [ "cIUTF8Strings", "XMPCommonFwdDeclarations_8h.html#aae5dbe164f71188aa24c87fa6306539a", null ], [ "IConfigurationManager_base", "XMPCommonFwdDeclarations_8h.html#ab6a71f81b4e3c8e5d2d0c90f82fbee08", null ], [ "IError_base", "XMPCommonFwdDeclarations_8h.html#a5f4d698bf8beb5f6604b61aa1362d2c6", null ], [ "IErrorNotifier_base", "XMPCommonFwdDeclarations_8h.html#a692c91c0b558cbc476e43e7f0a9112e0", null ], [ "IMemoryAllocator_base", "XMPCommonFwdDeclarations_8h.html#ae79591aae25236208281cd3e48a2483d", null ], [ "IObjectFactory_base", "XMPCommonFwdDeclarations_8h.html#a25f44f5d5e5c651d20124037a7c3b5c3", null ], [ "IUTF8String_base", "XMPCommonFwdDeclarations_8h.html#a169532f774f2b1f3d8501e896d6f1957", null ], [ "IUTF8Strings", "XMPCommonFwdDeclarations_8h.html#ac82ab59bdaecb219834ac2ff81573414", null ], [ "MemAllocateProc", "XMPCommonFwdDeclarations_8h.html#a6ddf5efa8f9b686e5d7fef41d6b10096", null ], [ "MemReleaseProc", "XMPCommonFwdDeclarations_8h.html#a79edf1f9139609bf6ed70b24cc99a2e0", null ], [ "pcIConfigurable", "XMPCommonFwdDeclarations_8h.html#a394d772cfe78f1dbeba6059e7a3c65d6", null ], [ "pcIConfigurationManager", "XMPCommonFwdDeclarations_8h.html#a2a6831c5d17f5c9990c01268f67b7bb2", null ], [ "pcIConfigurationManager_base", "XMPCommonFwdDeclarations_8h.html#a39556e80a6bda05757b7f2766ddc2ba1", null ], [ "pcIError", "XMPCommonFwdDeclarations_8h.html#a0e0c89c232b777fb332e0ddc10b65fc2", null ], [ "pcIError_base", "XMPCommonFwdDeclarations_8h.html#ae3cc983230819089dc742273902228c5", null ], [ "pcIErrorNotifier", "XMPCommonFwdDeclarations_8h.html#aa4baade1a8eb0dbb544860e0c89362f8", null ], [ "pcIErrorNotifier_base", "XMPCommonFwdDeclarations_8h.html#a15919ce22d7dc4def5a590f0dbb882ca", null ], [ "pcIMemoryAllocator", "XMPCommonFwdDeclarations_8h.html#af5a7d4d78400043e3e49dfa6a2725abb", null ], [ "pcIMemoryAllocator_base", "XMPCommonFwdDeclarations_8h.html#a42a89fb94134c8eaed66765f2975b3f9", null ], [ "pcIObjectFactory", "XMPCommonFwdDeclarations_8h.html#a272e32106a7573db514736bfb68a1673", null ], [ "pcIObjectFactory_base", "XMPCommonFwdDeclarations_8h.html#a8d7232279921e3ccaa69fe314052415b", null ], [ "pcISharedObject_I", "XMPCommonFwdDeclarations_8h.html#affd72b6c7abbc84fdef10b5a607cd432", null ], [ "pcIThreadSafe_I", "XMPCommonFwdDeclarations_8h.html#a2becb4c0d21c71e1dcecdcaae0e92bd7", null ], [ "pcIUTF8String", "XMPCommonFwdDeclarations_8h.html#aa9b2c45fd472c6e0e322a94c87e36e23", null ], [ "pcIUTF8String_base", "XMPCommonFwdDeclarations_8h.html#a34ccf48e077c7308540d98149a4a8b2b", null ], [ "pcvoid", "XMPCommonFwdDeclarations_8h.html#a19692335f9547f4bc07d0ff727f14605", null ], [ "pIConfigurable", "XMPCommonFwdDeclarations_8h.html#a9befc7ddfe5977c8176eed763d9ce69e", null ], [ "pIConfigurationManager", "XMPCommonFwdDeclarations_8h.html#a66f57b67d8be6cbf836ad084a3d27d76", null ], [ "pIConfigurationManager_base", "XMPCommonFwdDeclarations_8h.html#a20fcfcaa614eba9a9fcdf2353b82fdb7", null ], [ "pIError", "XMPCommonFwdDeclarations_8h.html#ac0db32de8e6a3688ad0dfc36c2757fb4", null ], [ "pIError_base", "XMPCommonFwdDeclarations_8h.html#a4e907810e5d5937b974343d279e0181d", null ], [ "pIErrorNotifier", "XMPCommonFwdDeclarations_8h.html#a9981f3ca088023224e80dbad05090f3c", null ], [ "pIErrorNotifier_base", "XMPCommonFwdDeclarations_8h.html#a4ad7bda9e1289b0bb93510402b6e86f9", null ], [ "pIMemoryAllocator", "XMPCommonFwdDeclarations_8h.html#a605dcb5281a71a01673c81e6508f932f", null ], [ "pIMemoryAllocator_base", "XMPCommonFwdDeclarations_8h.html#aff75b5c835a8eb072072be6b404aa0d5", null ], [ "pIObjectFactory", "XMPCommonFwdDeclarations_8h.html#a0863cf1c24764306839671985373b93f", null ], [ "pIObjectFactory_base", "XMPCommonFwdDeclarations_8h.html#adb1552a01da782d3f1c5ff00e49f48f8", null ], [ "pISharedObject_I", "XMPCommonFwdDeclarations_8h.html#ada4b051c58f05ef398453930451bc13d", null ], [ "pIThreadSafe_I", "XMPCommonFwdDeclarations_8h.html#ac9c07c42e647a17838c9314b8d2823d9", null ], [ "pIUTF8String", "XMPCommonFwdDeclarations_8h.html#a27ba1868ebc552bef10fe156bd4e340b", null ], [ "pIUTF8String_base", "XMPCommonFwdDeclarations_8h.html#a0430b250dd00621dcb9f32a3acb87b7f", null ], [ "pvoid", "XMPCommonFwdDeclarations_8h.html#ab59e650373a5efadfbfd2486313258a6", null ], [ "spcIConfigurationManager", "XMPCommonFwdDeclarations_8h.html#abe53a5a98ec0d2d6ce76d1d820794177", null ], [ "spcIError", "XMPCommonFwdDeclarations_8h.html#a3f0de5ba5753a56896f2941927b23560", null ], [ "spcIErrorNotifier", "XMPCommonFwdDeclarations_8h.html#a4eeee081576f932942082744eb05456c", null ], [ "spcIMemoryAllocator", "XMPCommonFwdDeclarations_8h.html#a183fc5e814bdad0ddf9946ddc35c307a", null ], [ "spcIUTF8String", "XMPCommonFwdDeclarations_8h.html#a91aaab1f1d7030b26df65258bd131a63", null ], [ "spcIUTF8Strings", "XMPCommonFwdDeclarations_8h.html#a181114a44f34efda2d8b4cb98446de86", null ], [ "spcIUTF8Strings_const", "XMPCommonFwdDeclarations_8h.html#aeea9f5dbdf44fd5382b0ca50dda8f2cf", null ], [ "spcvoid", "XMPCommonFwdDeclarations_8h.html#a93bf79ca806273dc229d940504654caa", null ], [ "spIConfigurationManager", "XMPCommonFwdDeclarations_8h.html#a4ebcc3c8cb04d7593dc3250aa720f0d4", null ], [ "spIError", "XMPCommonFwdDeclarations_8h.html#adb05c7ceec43360b84aee536612151f9", null ], [ "spIErrorNotifier", "XMPCommonFwdDeclarations_8h.html#a4d5b76921b44568978986a81d2c19336", null ], [ "spIMemoryAllocator", "XMPCommonFwdDeclarations_8h.html#a9423cafa21356df5d02adf7a94f4e4b0", null ], [ "spIUTF8String", "XMPCommonFwdDeclarations_8h.html#ac9d7760a1805b1e28828511a2c8c5588", null ], [ "spIUTF8Strings", "XMPCommonFwdDeclarations_8h.html#a5f4ff8126658f07efbc881778bfea430", null ], [ "spIUTF8Strings_const", "XMPCommonFwdDeclarations_8h.html#ab4410cb115c4e0fa0800ab6ebf21abf7", null ], [ "spvoid", "XMPCommonFwdDeclarations_8h.html#a28d3e703084f75a411ece4bb7b22fdd4", null ], [ "BASE_CLASS", "XMPCommonFwdDeclarations_8h.html#a376c8e3ade71b2836888a07746dd3882", null ], [ "BASE_CLASS", "XMPCommonFwdDeclarations_8h.html#ae2d21f9711d5fdc36354b14a401ec53b", null ], [ "BASE_CLASS", "XMPCommonFwdDeclarations_8h.html#a55f2498472648e9b5647f039202820b2", null ], [ "BASE_CLASS", "XMPCommonFwdDeclarations_8h.html#afee5efdc17ad732ac218b39bb305ed63", null ], [ "BASE_CLASS", "XMPCommonFwdDeclarations_8h.html#a5d655944f5ebfaff4c6f61d227257035", null ], [ "BASE_CLASS", "XMPCommonFwdDeclarations_8h.html#a41216c3793d99220ce00076ad18f9b44", null ], [ "MemAllocate", "XMPCommonFwdDeclarations_8h.html#a3349137d458c48d779670626d7b6ba1a", null ], [ "MemRelease", "XMPCommonFwdDeclarations_8h.html#ad4c125f465214507005d84a360fa83e5", null ] ];
yanburman/sjcam_raw2dng
xmp_sdk/docs/API/XMPCommonFwdDeclarations_8h.js
JavaScript
gpl-2.0
6,862
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>thSolver v1.0: /home/carlos/Work/Code+Data/Publicly Released Code/v1.0/dep/src/getLocalNormal_tria6.c Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.4.6 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> <li id="current"><a href="files.html"><span>Files</span></a></li> </ul></div> <div class="tabs"> <ul> <li><a href="files.html"><span>File&nbsp;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul></div> <h1>/home/carlos/Work/Code+Data/Publicly Released Code/v1.0/dep/src/getLocalNormal_tria6.c</h1><a href="getLocalNormal__tria6_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/******************************************************************************</span> <a name="l00002"></a>00002 <span class="comment">* File : getLocalNormal_tria6.c *</span> <a name="l00003"></a>00003 <span class="comment">* Author : Carlos Rosales Fernandez (carlos@ihpc.a-star.edu.sg) *</span> <a name="l00004"></a>00004 <span class="comment">* Date : 01-09-2006 *</span> <a name="l00005"></a>00005 <span class="comment">* Revision : 1.0 *</span> <a name="l00006"></a>00006 <span class="comment">*******************************************************************************</span> <a name="l00007"></a>00007 <span class="comment">* DESCRIPTION *</span> <a name="l00008"></a>00008 <span class="comment">* Returns the unit normal[] vector at a local evaluation point given by L[] *</span> <a name="l00009"></a>00009 <span class="comment">* that is interior to the element with global coordinates X[NODE][COORDINATE].*</span> <a name="l00010"></a>00010 <span class="comment">* Works for quadratic interpolation in triangular elements (6-noded triangles)*</span> <a name="l00011"></a>00011 <span class="comment">******************************************************************************/</span> <a name="l00012"></a>00012 <a name="l00013"></a>00013 <span class="comment">/******************************************************************************</span> <a name="l00014"></a>00014 <span class="comment">* COPYRIGHT &amp; LICENSE INFORMATION *</span> <a name="l00015"></a>00015 <span class="comment">* *</span> <a name="l00016"></a>00016 <span class="comment">* Copyright 2006 Carlos Rosales Fernandez and The Institute of High *</span> <a name="l00017"></a>00017 <span class="comment">* Performance Computing (A*STAR) *</span> <a name="l00018"></a>00018 <span class="comment">* *</span> <a name="l00019"></a>00019 <span class="comment">* This file is part of depSolver. *</span> <a name="l00020"></a>00020 <span class="comment">* *</span> <a name="l00021"></a>00021 <span class="comment">* depSolver is free software; you can redistribute it and/or modify *</span> <a name="l00022"></a>00022 <span class="comment">* it under the terms of the GNU General Public License as published by *</span> <a name="l00023"></a>00023 <span class="comment">* the Free Software Foundation; either version 2 of the License, or *</span> <a name="l00024"></a>00024 <span class="comment">* (at your option) any later version. *</span> <a name="l00025"></a>00025 <span class="comment">* *</span> <a name="l00026"></a>00026 <span class="comment">* depSolver is distributed in the hope that it will be useful, *</span> <a name="l00027"></a>00027 <span class="comment">* but WITHOUT ANY WARRANTY; without even the implied warranty of *</span> <a name="l00028"></a>00028 <span class="comment">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *</span> <a name="l00029"></a>00029 <span class="comment">* GNU General Public License for more details. *</span> <a name="l00030"></a>00030 <span class="comment">* *</span> <a name="l00031"></a>00031 <span class="comment">* You should have received a copy of the GNU General Public License *</span> <a name="l00032"></a>00032 <span class="comment">* along with depSolver; if not, write to the Free Software *</span> <a name="l00033"></a>00033 <span class="comment">* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *</span> <a name="l00034"></a>00034 <span class="comment">******************************************************************************/</span> <a name="l00035"></a>00035 <a name="l00036"></a>00036 <span class="preprocessor">#include &lt;stdio.h&gt;</span> <a name="l00037"></a>00037 <span class="preprocessor">#include &lt;stdlib.h&gt;</span> <a name="l00038"></a>00038 <span class="preprocessor">#include &lt;math.h&gt;</span> <a name="l00039"></a>00039 <a name="l00040"></a><a class="code" href="integral__tria6_8h.html#ab3dfb95b698f597fe5d2e0a084a0e76">00040</a> <span class="keywordtype">int</span> <a class="code" href="getLocalNormal__tria6_8c.html#ab3dfb95b698f597fe5d2e0a084a0e76">getLocalNormal_tria6</a>(<span class="keywordtype">double</span> *L, <span class="keywordtype">double</span> X[6][3], <span class="keywordtype">double</span> *normal) <a name="l00041"></a>00041 { <a name="l00042"></a>00042 <span class="keywordtype">double</span> ax, ay, az, dx1, dx2, dy1, dy2, dz1, dz2, L1, L2, normalmod; <a name="l00043"></a>00043 <a name="l00044"></a>00044 <span class="comment">/* Auxiliar quantities */</span> <a name="l00045"></a>00045 L1 = L[0]; <a name="l00046"></a>00046 L2 = L[1]; <a name="l00047"></a>00047 ax = X[1][0] - X[3][0] + X[4][0] - X[5][0]; <a name="l00048"></a>00048 ay = X[1][1] - X[3][1] + X[4][1] - X[5][1]; <a name="l00049"></a>00049 az = X[1][2] - X[3][2] + X[4][2] - X[5][2]; <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="comment">/* Derivatives of (x,y,z) with respect to L1 and L2 */</span> <a name="l00052"></a>00052 dx1 = 4.0*(L1*(X[0][0] + X[4][0] - 2.0*X[5][0]) + L2*ax + X[5][0]) - X[0][0] - 3.0*X[4][0]; <a name="l00053"></a>00053 dx2 = 4.0*(L1*ax + L2*(X[2][0] + X[4][0] - 2.0*X[3][0]) + X[3][0]) - X[2][0] - 3.0*X[4][0]; <a name="l00054"></a>00054 dy1 = 4.0*(L1*(X[0][1] + X[4][1] - 2.0*X[5][1]) + L2*ay + X[5][1]) - X[0][1] - 3.0*X[4][1]; <a name="l00055"></a>00055 dy2 = 4.0*(L1*ay + L2*(X[2][1] + X[4][1] - 2.0*X[3][1]) + X[3][1]) - X[2][1] - 3.0*X[4][1]; <a name="l00056"></a>00056 dz1 = 4.0*(L1*(X[0][2] + X[4][2] - 2.0*X[5][2]) + L2*az + X[5][2]) - X[0][2] - 3.0*X[4][2]; <a name="l00057"></a>00057 dz2 = 4.0*(L1*az + L2*(X[2][2] + X[4][2] - 2.0*X[3][2]) + X[3][2]) - X[2][2] - 3.0*X[4][2]; <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="comment">/* Normal components and modulus (inverted) */</span> <a name="l00060"></a>00060 normal[0] = dy1*dz2 - dy2*dz1; <a name="l00061"></a>00061 normal[1] = dx2*dz1 - dx1*dz2; <a name="l00062"></a>00062 normal[2] = dx1*dy2 - dx2*dy1; <a name="l00063"></a>00063 normalmod = 1.0/sqrt(normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2]); <a name="l00064"></a>00064 <a name="l00065"></a>00065 <span class="comment">/* Get unit normal */</span> <a name="l00066"></a>00066 normal[0] = normal[0]*normalmod; <a name="l00067"></a>00067 normal[1] = normal[1]*normalmod; <a name="l00068"></a>00068 normal[2] = normal[2]*normalmod; <a name="l00069"></a>00069 <a name="l00070"></a>00070 <span class="keywordflow">return</span> 0; <a name="l00071"></a>00071 } <a name="l00072"></a>00072 </pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Sep 1 18:53:06 2006 for thSolver v1.0 by&nbsp; <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address> </body> </html>
carlosrosales/thsolver
docs/html/getLocalNormal__tria6_8c-source.html
HTML
gpl-2.0
8,886
////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // // copyright : (C) 2008 by Eran Ifrah // file name : vcimporter.h // // ------------------------------------------------------------------------- // A // _____ _ _ _ _ // / __ \ | | | | (_) | // | / \/ ___ __| | ___| | _| |_ ___ // | | / _ \ / _ |/ _ \ | | | __/ _ ) // | \__/\ (_) | (_| | __/ |___| | || __/ // \____/\___/ \__,_|\___\_____/_|\__\___| // // F i l e // // 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. // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// #ifndef VCIMPORTER_H #define VCIMPORTER_H #include "codelite_exports.h" #include "map" #include "project.h" #include "project_settings.h" #include "wx/string.h" #include <wx/txtstrm.h> #include <wx/wfstream.h> struct VcProjectData { wxString name; wxString id; wxString filepath; wxArrayString deps; }; class WXDLLIMPEXP_SDK VcImporter { wxString m_fileName; bool m_isOk; wxFileInputStream* m_is; wxTextInputStream* m_tis; std::map<wxString, VcProjectData> m_projects; wxString m_compiler; wxString m_compilerLowercase; public: VcImporter(const wxString& fileName, const wxString& defaultCompiler); virtual ~VcImporter(); bool Import(wxString& errMsg); private: // read line, skip empty lines bool ReadLine(wxString& line); bool OnProject(const wxString& firstLine, wxString& errMsg); void RemoveGershaim(wxString& str); void CreateWorkspace(); void CreateProjects(); bool ConvertProject(VcProjectData& data); void AddConfiguration(ProjectSettingsPtr settings, wxXmlNode* config); void CreateFiles(wxXmlNode* parent, wxString vdPath, ProjectPtr proj); wxArrayString SplitString(const wxString& s); }; #endif // VCIMPORTER_H
eranif/codelite
Plugin/vcimporter.h
C
gpl-2.0
2,446
/* * Wayland Support * * Copyright (C) 2013 Intel Corporation * Copyright (C) 2015 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 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, see <http://www.gnu.org/licenses/>. */ /* * Copyright © 2008 Kristian Høgsberg * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "config.h" #include "wayland/meta-wayland-popup.h" #include "wayland/meta-wayland-pointer.h" #include "wayland/meta-wayland-private.h" #include "wayland/meta-wayland-surface.h" G_DEFINE_INTERFACE (MetaWaylandPopupSurface, meta_wayland_popup_surface, G_TYPE_OBJECT); struct _MetaWaylandPopupGrab { MetaWaylandPointerGrab generic; struct wl_client *grab_client; struct wl_list all_popups; }; struct _MetaWaylandPopup { MetaWaylandPopupGrab *grab; MetaWaylandPopupSurface *popup_surface; struct wl_list link; }; static void meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab, MetaWaylandSurface *surface); static void meta_wayland_popup_grab_end (MetaWaylandPopupGrab *grab); static void meta_wayland_popup_surface_default_init (MetaWaylandPopupSurfaceInterface *iface) { } static void meta_wayland_popup_surface_done (MetaWaylandPopupSurface *popup_surface) { META_WAYLAND_POPUP_SURFACE_GET_IFACE (popup_surface)->done (popup_surface); } static void meta_wayland_popup_surface_dismiss (MetaWaylandPopupSurface *popup_surface) { META_WAYLAND_POPUP_SURFACE_GET_IFACE (popup_surface)->dismiss (popup_surface); } static MetaWaylandSurface * meta_wayland_popup_surface_get_surface (MetaWaylandPopupSurface *popup_surface) { return META_WAYLAND_POPUP_SURFACE_GET_IFACE (popup_surface)->get_surface (popup_surface); } static void popup_grab_focus (MetaWaylandPointerGrab *grab, MetaWaylandSurface *surface) { MetaWaylandPopupGrab *popup_grab = (MetaWaylandPopupGrab*)grab; MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (grab->pointer); MetaWaylandPointer *pointer = grab->pointer; /* * We rely on having a pointer grab even when the seat doesn't have * the pointer capability. In this case, we shouldn't update any pointer focus * since there is no such thing when the seat doesn't have the pointer * capability. */ if (!meta_wayland_seat_has_pointer (seat)) return; /* Popup grabs are in owner-events mode (ie, events for the same client are reported as normal) */ if (surface && wl_resource_get_client (surface->resource) == popup_grab->grab_client) meta_wayland_pointer_set_focus (grab->pointer, surface); else if (pointer->button_count == 0) meta_wayland_pointer_set_focus (grab->pointer, NULL); } static void popup_grab_motion (MetaWaylandPointerGrab *grab, const ClutterEvent *event) { meta_wayland_pointer_send_motion (grab->pointer, event); } static void popup_grab_button (MetaWaylandPointerGrab *grab, const ClutterEvent *event) { MetaWaylandPointer *pointer = grab->pointer; if (pointer->focus_surface) meta_wayland_pointer_send_button (grab->pointer, event); else if (clutter_event_type (event) == CLUTTER_BUTTON_RELEASE && pointer->button_count == 0) meta_wayland_pointer_end_popup_grab (grab->pointer); } static void popup_grab_cancel (MetaWaylandPointerGrab *grab) { meta_wayland_pointer_end_popup_grab (grab->pointer); } static MetaWaylandPointerGrabInterface popup_grab_interface = { popup_grab_focus, popup_grab_motion, popup_grab_button, popup_grab_cancel }; MetaWaylandPopupGrab * meta_wayland_popup_grab_create (MetaWaylandPointer *pointer, MetaWaylandPopupSurface *popup_surface) { MetaWaylandSurface *surface = meta_wayland_popup_surface_get_surface (popup_surface); struct wl_client *client = wl_resource_get_client (surface->resource); MetaWaylandPopupGrab *grab; grab = g_new0 (MetaWaylandPopupGrab, 1); grab->generic.interface = &popup_grab_interface; grab->generic.pointer = pointer; grab->grab_client = client; wl_list_init (&grab->all_popups); meta_wayland_popup_grab_begin (grab, surface); return grab; } void meta_wayland_popup_grab_destroy (MetaWaylandPopupGrab *grab) { meta_wayland_popup_grab_end (grab); g_free (grab); } static void meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab, MetaWaylandSurface *surface) { MetaWaylandPointer *pointer = grab->generic.pointer; MetaWindow *window = meta_wayland_surface_get_window (surface); meta_wayland_pointer_start_grab (pointer, (MetaWaylandPointerGrab*)grab); meta_display_begin_grab_op (window->display, window, META_GRAB_OP_WAYLAND_POPUP, FALSE, /* pointer_already_grabbed */ FALSE, /* frame_action */ 1, /* button. XXX? */ 0, /* modmask */ meta_display_get_current_time_roundtrip ( window->display), pointer->grab_x, pointer->grab_y); } void meta_wayland_popup_grab_end (MetaWaylandPopupGrab *grab) { MetaWaylandPopup *popup, *tmp; g_assert (grab->generic.interface == &popup_grab_interface); wl_list_for_each_safe (popup, tmp, &grab->all_popups, link) { meta_wayland_popup_surface_done (popup->popup_surface); meta_wayland_popup_destroy (popup); } { MetaDisplay *display = meta_get_display (); meta_display_end_grab_op (display, meta_display_get_current_time_roundtrip (display)); } meta_wayland_pointer_end_grab (grab->generic.pointer); } MetaWaylandSurface * meta_wayland_popup_grab_get_top_popup (MetaWaylandPopupGrab *grab) { MetaWaylandPopup *popup; g_assert (!wl_list_empty (&grab->all_popups)); popup = wl_container_of (grab->all_popups.next, popup, link); return meta_wayland_popup_surface_get_surface (popup->popup_surface); } gboolean meta_wayland_pointer_grab_is_popup_grab (MetaWaylandPointerGrab *grab) { return grab->interface == &popup_grab_interface; } void meta_wayland_popup_destroy (MetaWaylandPopup *popup) { meta_wayland_popup_surface_dismiss (popup->popup_surface); wl_list_remove (&popup->link); g_free (popup); } void meta_wayland_popup_dismiss (MetaWaylandPopup *popup) { MetaWaylandPopupGrab *popup_grab = popup->grab; meta_wayland_popup_destroy (popup); if (wl_list_empty (&popup_grab->all_popups)) { meta_wayland_pointer_end_popup_grab (popup_grab->generic.pointer); } else { MetaWaylandSurface *top_popup_surface; MetaWaylandSeat *seat; top_popup_surface = meta_wayland_popup_grab_get_top_popup (popup_grab); seat = meta_wayland_pointer_get_seat (popup_grab->generic.pointer); if (meta_wayland_seat_has_keyboard (seat)) meta_wayland_keyboard_set_focus (seat->keyboard, top_popup_surface); } } MetaWaylandSurface * meta_wayland_popup_get_top_popup (MetaWaylandPopup *popup) { return meta_wayland_popup_grab_get_top_popup (popup->grab); } MetaWaylandPopup * meta_wayland_popup_create (MetaWaylandPopupSurface *popup_surface, MetaWaylandPopupGrab *grab) { MetaWaylandSurface *surface = meta_wayland_popup_surface_get_surface (popup_surface); MetaWaylandPopup *popup; MetaWaylandSeat *seat; /* Don't allow creating popups if the grab has a different client. */ if (grab->grab_client != wl_resource_get_client (surface->resource)) return NULL; popup = g_new0 (MetaWaylandPopup, 1); popup->grab = grab; popup->popup_surface = popup_surface; wl_list_insert (&grab->all_popups, &popup->link); seat = meta_wayland_pointer_get_seat (grab->generic.pointer); if (meta_wayland_seat_has_keyboard (seat)) meta_wayland_keyboard_set_focus (seat->keyboard, surface); return popup; }
GNOME/mutter
src/wayland/meta-wayland-popup.c
C
gpl-2.0
9,651
cmd_drivers/video/backlight/built-in.o := /root/Kernel/toolchain/prebuilt/arm-eabi-4.4.3/bin/arm-eabi-ld -EL -r -o drivers/video/backlight/built-in.o drivers/video/backlight/lcd.o drivers/video/backlight/backlight.o
garwynn/D710SPR_GB27_Kernel
drivers/video/backlight/.built-in.o.cmd
Batchfile
gpl-2.0
221
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\Code\Test\Unit\Model\File\Validator; use Magento\Framework\Phrase; class NotProtectedExtensionTest extends \PHPUnit\Framework\TestCase { /** * @var \Magento\MediaStorage\Model\File\Validator\NotProtectedExtension */ protected $_model; /** * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_scopeConfig; /** * @var string */ protected $_protectedList = 'exe,php,jar'; protected function setUp() { $this->_scopeConfig = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class); $this->_scopeConfig->expects( $this->atLeastOnce() )->method( 'getValue' )->with( $this->equalTo( \Magento\MediaStorage\Model\File\Validator\NotProtectedExtension::XML_PATH_PROTECTED_FILE_EXTENSIONS ), $this->equalTo(\Magento\Store\Model\ScopeInterface::SCOPE_STORE), $this->equalTo(null) )->will( $this->returnValue($this->_protectedList) ); $this->_model = new \Magento\MediaStorage\Model\File\Validator\NotProtectedExtension($this->_scopeConfig); } public function testGetProtectedFileExtensions() { $this->assertEquals($this->_protectedList, $this->_model->getProtectedFileExtensions()); } public function testInitialization() { $property = new \ReflectionProperty( \Magento\MediaStorage\Model\File\Validator\NotProtectedExtension::class, '_messageTemplates' ); $property->setAccessible(true); $defaultMess = [ 'protectedExtension' => new Phrase('File with an extension "%value%" is protected and cannot be uploaded'), ]; $this->assertEquals($defaultMess, $property->getValue($this->_model)); $property = new \ReflectionProperty( \Magento\MediaStorage\Model\File\Validator\NotProtectedExtension::class, '_protectedFileExtensions' ); $property->setAccessible(true); $protectedList = ['exe', 'php', 'jar']; $this->assertEquals($protectedList, $property->getValue($this->_model)); } public function testIsValid() { $this->assertTrue($this->_model->isValid('html')); $this->assertTrue($this->_model->isValid('jpg')); $this->assertFalse($this->_model->isValid('php')); $this->assertFalse($this->_model->isValid('jar')); $this->assertFalse($this->_model->isValid('exe')); } }
kunj1988/Magento2
lib/internal/Magento/Framework/Code/Test/Unit/Model/File/Validator/NotProtectedExtensionTest.php
PHP
gpl-2.0
2,729
# include <string> # include <iostream> using namespace std; class Solution { public: string replaceSpace(string str) { string ret; for (int i = 0; i < str.length(); ++i) { if (str[i] != ' ') ret += str[i]; else ret += "\%20"; } return ret; } }; int main() { Solution s; std::cout << s.replaceSpace("we are w!"); return 0; }
fyh/training
online judge/book/jianzhioffer/0/5.cpp
C++
gpl-2.0
379
'use strict'; const express = require('express'); const path = require('path'); const logger = require('morgan'); const cookieParser = require('cookie-parser'); const bodyParser = require('body-parser'); const cons = require('consolidate'); const session = require('express-session'); const mysql = require('mysql'); const index = require('./routes/index'); const users = require('./routes/users'); const signup = require('./routes/signup'); const savequestion = require('./routes/savequestion'); const questions = require('./routes/questions'); const questionbyid = require('./routes/questionbyid'); const saveanswer = require('./routes/saveanswer'); const login = require('./routes/login'); const logout = require('./routes/logout'); const downvote = require('./routes/downvote'); const upvote = require('./routes/upvote'); const app = express(); const config = require('./config'); console.log(`Run at ${ process.env.NODE_ENV}`); const con = mysql.createConnection(config.MYSQL); con.connect((err) => { if (err) { throw err; } console.log('Connected to database'); }); const sess = { secret: 'awhdRkRSKSLSIEHGugdYdfd' }; app.use(session(sess)); // view engine setup app.engine('html', cons.swig); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'html'); // uncomment after placing your favicon in /public //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); app.use(express.static(path.join(__dirname, 'public'))); app.use('/', index); app.use('/users', users); app.use('/login', login); app.use('/savequestion', savequestion); app.use('/questions', questions); app.use('/questionbyid', questionbyid); app.use('/saveanswer', saveanswer); app.use('/signup', signup); app.use('/logout', logout); app.use('/downvote', downvote); app.use('/upvote', upvote); // catch 404 and forward to error handler app.use((req, res, next) => { const err = new Error('Not Found'); err.status = 404; next(err); }); // Author Narendra Kumawat app.use((err, req, res, next) => { res.locals.message = err.message; res.locals.error = req.app.get('env') === 'development' ? err : {}; res.status(err.status || 500); res.render('error'); }); module.exports = app;
NK145/overflow
app.js
JavaScript
gpl-2.0
2,370
package es.uniovi.asw.trivial.gui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.WindowConstants; import javax.swing.border.EmptyBorder; import es.uniovi.asw.trivial.model.Posicion; import es.uniovi.asw.trivial.model.Pregunta; public class PreguntaDialog extends JDialog { /** * */ private static final long serialVersionUID = 1L; private final JPanel contentPanel = new JPanel(); private JTextField textField; private JTextField textPregunta; Timer timer; private final int TIEMPO_RESPUESTA = 15; private final int DELAY = 1000; public PreguntaDialog(final Color color, final String categoria, final Pregunta p, final Tablero tablero) { for(UIManager.LookAndFeelInfo laf:UIManager.getInstalledLookAndFeels()) if("Nimbus".equals(laf.getName())) try { UIManager.setLookAndFeel(laf.getClassName()); } catch (Exception e1) { e1.printStackTrace(); } setResizable(false); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setModal(true); setAlwaysOnTop(true); setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPanel.setBackground(color); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); { JPanel panel = new JPanel(); contentPanel.add(panel, BorderLayout.NORTH); panel.setLayout(new GridLayout(2, 1, 0, 0)); { JLabel lblPregunta = new JLabel("Pregunta:"); lblPregunta.setHorizontalAlignment(SwingConstants.CENTER); panel.add(lblPregunta); } { textPregunta = new JTextField(); textPregunta.setHorizontalAlignment(SwingConstants.CENTER); textPregunta.setEditable(false); panel.add(textPregunta); textPregunta.setText(p.getPregunta()); } } { JPanel panel = new JPanel(); panel.setBackground(color); contentPanel.add(panel); panel.setLayout(new GridLayout(0, 2, 0, 0)); { for (int i = 0; i < p.getRespuestas().length; i++) { JButton bt = new JButton(p.getRespuestas()[i]); final int num = i; bt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { timer.stop(); // cambiar turno jugador if (num != p.getCorrecta()) { tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()) .setTocaJugar(false); tablero.getNombresUsuarios() .get(tablero.getUsuarioJugando()) .setBackground(Color.white); if (tablero.getUsuarioJugando() + 1 == tablero .getCj().getUsuarios().size()) tablero.setUsuarioJugando(0); else tablero.setUsuarioJugando(tablero .getUsuarioJugando() + 1); tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()) .setTocaJugar(true); tablero.getNombresUsuarios() .get(tablero.getUsuarioJugando()) .setBackground(Color.yellow); } else { JLabel manzana = new JLabel(); String[] cat = categoria.split(" "); //Celdas especiales if (cat.length>1 && categoria.contains("Especial") && !tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()).getCategoriasGanadas().contains(cat[1]) ){ tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()).getCategoriasGanadas().add(cat[1]); manzana.setIcon(new ImageIcon( PreguntaDialog.class .getResource("/es/uniovi/asw/trivial/gui/img/manzana" + cat[1] + ".gif"))); tablero.getPanelesUsuarios() .get(tablero.getUsuarioJugando()) .add(manzana); tablero.revalidate(); tablero.repaint(); } } JOptionPane.showMessageDialog(PreguntaDialog.this, p.getContestacion()[num]); if (p.getCorrecta() == num) { // Acertadas ++ } else { // falladas ++ } if(tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()).isGanador(tablero.getColores().size())){ partidaFinalizada(tablero); } //tablero.getCj().getUsuarios().get(tablero.getUsuarioJugando()).setPosicion(new Posicion(i,j)); tablero.estadoBotones(false); tablero.getBtnDado().setEnabled(true); tablero.repaint(); dispose(); } private void partidaFinalizada(final Tablero tablero) { String textWin=tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()).getLogin() + " ha ganado!!"; JOptionPane.showMessageDialog(PreguntaDialog.this, textWin); //Guardar ganador partida en bd para estadísticas de partidas ganadas aqui tablero.getPanelTablero().removeAll(); JButton volverLogin= new JButton(); JTextField textoWin = new JTextField(); textoWin.setText(textWin); textoWin.setEditable(false); volverLogin.setIcon(new ImageIcon(PreguntaDialog.class.getResource("/es/uniovi/asw/trivial/gui/img/btnAtras.png"))); tablero.getBtnDado().setVisible(false); volverLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new Menuprincipal().setVisible(true); tablero.dispose(); } }); tablero.getPanelTablero().setLayout(new BorderLayout()); tablero.getPanelTablero().add(textoWin,BorderLayout.NORTH); tablero.getPanelTablero().add(volverLogin,BorderLayout.CENTER); tablero.revalidate(); tablero.repaint(); } }); bt.setActionCommand("Pregunta1"); panel.add(bt); } } } { JPanel buttonPane = new JPanel(); getContentPane().add(buttonPane, BorderLayout.SOUTH); buttonPane.setLayout(new BorderLayout(0, 0)); { final JProgressBar progressBar = new JProgressBar(); { ActionListener listener = new ActionListener() { int counter = TIEMPO_RESPUESTA; public void actionPerformed(ActionEvent ae) { counter--; progressBar.setValue(counter); if (counter < 1) { JOptionPane.showMessageDialog(PreguntaDialog.this, "Tiempo agotado!"); timer.stop(); dispose(); } } }; timer = new Timer(DELAY, listener); timer.start(); } buttonPane.add(progressBar); progressBar.setMaximum(TIEMPO_RESPUESTA); } } { JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.NORTH); { JLabel lblHasElegidoUna = new JLabel( "Has elegido una pregunta de:"); panel.add(lblHasElegidoUna); } { textField = new JTextField(); textField.setEditable(false); panel.add(textField); textField.setColumns(10); textField.setText(categoria); } } } public PreguntaDialog(final Posicion posicion,final Color color, final String categoria, final Pregunta p, final Tablero tablero) { setResizable(false); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setModal(true); setAlwaysOnTop(true); setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPanel.setBackground(color); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); { JPanel panel = new JPanel(); contentPanel.add(panel, BorderLayout.NORTH); panel.setLayout(new GridLayout(2, 1, 0, 0)); { JLabel lblPregunta = new JLabel("Pregunta:"); lblPregunta.setHorizontalAlignment(SwingConstants.CENTER); panel.add(lblPregunta); } { textPregunta = new JTextField(); textPregunta.setHorizontalAlignment(SwingConstants.CENTER); textPregunta.setEditable(false); panel.add(textPregunta); textPregunta.setText(p.getPregunta()); } } { JPanel panel = new JPanel(); panel.setBackground(color); contentPanel.add(panel); panel.setLayout(new GridLayout(0, 2, 0, 0)); { for (int i = 0; i < p.getRespuestas().length; i++) { JButton bt = new JButton(p.getRespuestas()[i]); final int num = i; bt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { timer.stop(); // cambiar turno jugador if (num != p.getCorrecta()) { tablero.getCj().getUsuarios().get(tablero.getUsuarioJugando()).setPosicion(posicion); tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()) .setTocaJugar(false); tablero.getNombresUsuarios() .get(tablero.getUsuarioJugando()) .setBackground(Color.white); if (tablero.getUsuarioJugando() + 1 == tablero .getCj().getUsuarios().size()){ tablero.setUsuarioJugando(0); } else{ tablero.setUsuarioJugando(tablero .getUsuarioJugando() + 1); } tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()) .setTocaJugar(true); tablero.getNombresUsuarios() .get(tablero.getUsuarioJugando()) .setBackground(Color.yellow); } else { JLabel manzana = new JLabel(); String[] cat = categoria.split(" "); //Celdas especiales if (cat.length>1 && categoria.contains("Especial") && !tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()).getCategoriasGanadas().contains(cat[1]) ){ tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()).getCategoriasGanadas().add(cat[1]); manzana.setIcon(new ImageIcon( PreguntaDialog.class .getResource("/es/uniovi/asw/trivial/gui/img/manzana" + cat[1] + ".gif"))); tablero.getPanelesUsuarios() .get(tablero.getUsuarioJugando()) .add(manzana); tablero.revalidate(); tablero.repaint(); } tablero.getCj().getUsuarios().get(tablero.getUsuarioJugando()).setPosicion(posicion); } JOptionPane.showMessageDialog(PreguntaDialog.this, p.getContestacion()[num]); if (p.getCorrecta() == num) { // Acertadas ++ } else { // falladas ++ } if(tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()).isGanador(tablero.getColores().size())){ partidaFinalizada(tablero); } //System.out.println(tablero.getUsuarioJugando()); //tablero.getCj().getUsuarios().get(tablero.getUsuarioJugando()).setPosicion(posicion); tablero.estadoBotones(false); tablero.getBtnDado().setEnabled(true); tablero.repaint(); dispose(); } private void partidaFinalizada(final Tablero tablero) { String textWin=tablero.getCj().getUsuarios() .get(tablero.getUsuarioJugando()).getLogin() + " ha ganado!!"; JOptionPane.showMessageDialog(PreguntaDialog.this, textWin); //Guardar ganador partida en bd para estadísticas de partidas ganadas aqui tablero.getPanelTablero().removeAll(); JButton volverLogin= new JButton(); JTextField textoWin = new JTextField(); textoWin.setText(textWin); textoWin.setEditable(false); volverLogin.setIcon(new ImageIcon(PreguntaDialog.class.getResource("/es/uniovi/asw/trivial/gui/img/btnAtras.png"))); tablero.getBtnDado().setVisible(false); volverLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new Menuprincipal().setVisible(true); tablero.dispose(); } }); tablero.getPanelTablero().setLayout(new BorderLayout()); tablero.getPanelTablero().add(textoWin,BorderLayout.NORTH); tablero.getPanelTablero().add(volverLogin,BorderLayout.CENTER); tablero.revalidate(); tablero.repaint(); } }); bt.setActionCommand("Pregunta1"); panel.add(bt); } } } { JPanel buttonPane = new JPanel(); getContentPane().add(buttonPane, BorderLayout.SOUTH); buttonPane.setLayout(new BorderLayout(0, 0)); { final JProgressBar progressBar = new JProgressBar(); { ActionListener listener = new ActionListener() { int counter = TIEMPO_RESPUESTA; public void actionPerformed(ActionEvent ae) { counter--; progressBar.setValue(counter); if (counter < 1) { JOptionPane.showMessageDialog(PreguntaDialog.this, "Tiempo agotado!"); timer.stop(); dispose(); } } }; timer = new Timer(DELAY, listener); timer.start(); } buttonPane.add(progressBar); progressBar.setMaximum(TIEMPO_RESPUESTA); } } { JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.NORTH); { JLabel lblHasElegidoUna = new JLabel( "Has elegido una pregunta de:"); panel.add(lblHasElegidoUna); } { textField = new JTextField(); textField.setEditable(false); panel.add(textField); textField.setColumns(10); textField.setText(categoria); } } } }
Arquisoft/Trivial2b
extract/src/main/java/es/uniovi/asw/trivial/gui/PreguntaDialog.java
Java
gpl-2.0
13,763
// -*- C++ -*- /* 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 */ /* * @file xmemory.h * @brief Manage different kinds of memory, main entry for memory. * @author Emery Berger <http://www.cs.umass.edu/~emery> * @author Tongping Liu <http://www.cs.umass.edu/~tonyliu> * @author Charlie Curtsinger <http://www.cs.umass.edu/~charlie> */ #ifndef XMEMORY_H_ #define XMEMORY_H_ #include <signal.h> #if !defined(_WIN32) #include <sys/wait.h> #include <sys/types.h> #include <sys/socket.h> #include <fcntl.h> #include <unistd.h> #endif #include <set> #include "xglobals.h" // Heap Layers #include "heaplayers/stlallocator.h" #include "warpheap.h" #include "xoneheap.h" #include "xheap.h" #include "xpageentry.h" #include "objectheader.h" #include "internalheap.h" // Encapsulates all memory spaces (globals & heap). class xmemory { private: /// The globals region. static xglobals _globals; /// Protected heap. static warpheap<xdefines::NUM_HEAPS, xdefines::PROTECTEDHEAP_CHUNK, xoneheap<xheap<xdefines::PROTECTEDHEAP_SIZE> > > _pheap; /// A signal stack, for catching signals. static stack_t _sigstk; static int _heapid; // Private on purpose xmemory(void) {} public: static void initialize(void) { DEBUG("initializing xmemory"); // Intercept SEGV signals (used for trapping initial reads and // writes to pages). installSignalHandler(); // Call _pheap so that xheap.h can be initialized at first and then can work normally. _pheap.initialize(); _globals.initialize(); xpageentry::getInstance().initialize(); // Initialize the internal heap. InternalHeap::getInstance().initialize(); } static void finalize(void) { _globals.finalize(); _pheap.finalize(); } static void setThreadIndex(int id) { _globals.setThreadIndex(id); _pheap.setThreadIndex(id); // Calculate the sub-heapid by the global thread index. _heapid = id % xdefines::NUM_HEAPS; } static inline void *malloc(size_t sz) { void * ptr = _pheap.malloc(_heapid, sz); return ptr; } static inline void * realloc(void * ptr, size_t sz) { size_t s = getSize(ptr); void * newptr = malloc(sz); if (newptr) { size_t copySz = (s < sz) ? s : sz; memcpy(newptr, ptr, copySz); } free(ptr); return newptr; } static inline void free(void * ptr) { return _pheap.free(_heapid, ptr); } /// @return the allocated size of a dynamically-allocated object. static inline size_t getSize(void * ptr) { // Just pass the pointer along to the heap. return _pheap.getSize(ptr); } static void openProtection(void) { _globals.openProtection(NULL); _pheap.openProtection(_pheap.getend()); } static void closeProtection(void) { _globals.closeProtection(); _pheap.closeProtection(); } static inline void begin(bool cleanup) { // Reset global and heap protection. _globals.begin(cleanup); _pheap.begin(cleanup); } static void mem_write(void * dest, void *val) { if(_pheap.inRange(dest)) { _pheap.mem_write(dest, val); } else if(_globals.inRange(dest)) { _globals.mem_write(dest, val); } } static inline void handleWrite(void * addr) { if (_pheap.inRange(addr)) { _pheap.handleWrite(addr); } else if (_globals.inRange(addr)) { _globals.handleWrite(addr); } else { // None of the above - something is wrong. fprintf(stderr, "%d: wrong faulted address\n", getpid()); assert(0); } } static inline void commit(bool update) { _pheap.checkandcommit(update); _globals.checkandcommit(update); } #ifdef LAZY_COMMIT static inline void forceCommit(int pid) { _pheap.forceCommit(pid, _pheap.getend()); } // Since globals will not owned by one thread, there is no need // to cleanup and commit. static inline void cleanupOwnedBlocks(void) { _pheap.cleanupOwnedBlocks(); } static inline void commitOwnedPage(int page_no, bool set_shared) { _pheap.commitOwnedPage(page_no, set_shared); } // Commit every page owned by me. static inline void finalcommit(bool release) { _pheap.finalcommit(release); } #endif public: /* Signal-related functions for tracking page accesses. */ /// @brief Signal handler to trap SEGVs. static void segvHandle(int signum, siginfo_t * siginfo, void * context) { void * addr = siginfo->si_addr; // address of access // Check if this was a SEGV that we are supposed to trap. if (siginfo->si_code == SEGV_ACCERR) { xmemory::handleWrite(addr); } else if (siginfo->si_code == SEGV_MAPERR) { fprintf (stderr, "%d : map error with addr %p!\n", getpid(), addr); ::abort(); } else { fprintf (stderr, "%d : other access error with addr %p.\n", getpid(), addr); ::abort(); } } #ifdef LAZY_COMMIT static void signalHandler(int signum, siginfo_t * siginfo, void * context) { union sigval signal = siginfo->si_value; int page_no; page_no = signal.sival_int; xmemory::commitOwnedPage(page_no, true); } #endif /// @brief Install a handler for SEGV signals. static void installSignalHandler(void) { #if defined(linux) // Set up an alternate signal stack. _sigstk.ss_sp = mmap(NULL, SIGSTKSZ, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); _sigstk.ss_size = SIGSTKSZ; _sigstk.ss_flags = 0; sigaltstack(&_sigstk, (stack_t *) 0); #endif // Now set up a signal handler for SIGSEGV events. struct sigaction siga; sigemptyset(&siga.sa_mask); // Set the following signals to a set sigaddset(&siga.sa_mask, SIGSEGV); sigaddset(&siga.sa_mask, SIGALRM); #ifdef LAZY_COMMIT sigaddset(&siga.sa_mask, SIGUSR1); #endif sigprocmask(SIG_BLOCK, &siga.sa_mask, NULL); // Point to the handler function. #if defined(linux) siga.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_RESTART | SA_NODEFER; #else siga.sa_flags = SA_SIGINFO | SA_RESTART; #endif siga.sa_sigaction = xmemory::segvHandle; if (sigaction(SIGSEGV, &siga, NULL) == -1) { perror("sigaction(SIGSEGV)"); exit(-1); } #ifdef LAZY_COMMIT // We set the signal handler siga.sa_sigaction = xmemory::signalHandler; if (sigaction (SIGUSR1, &siga, NULL) == -1) { perror("sigaction(SIGUSR1)"); exit(-1); } #endif sigprocmask(SIG_UNBLOCK, &siga.sa_mask, NULL); } }; #endif
plasma-umass/dthreads
src/include/xmemory.h
C
gpl-2.0
7,096
@extends('master') @section('title') Login @stop @section('body') {!! Form::open(array('action' => 'Auth\AuthController@postLogin', 'method' => 'post')) !!} <div class="login-container animated fadeInDown"> <div class="loginbox bg-white"> <div class="loginbox-title">{{ $message }}</div> <div class="loginbox-social"> <div class="social-title ">Use your email address</div> <!--<div class="social-title ">Connect with Your Social Accounts</div> <div class="social-buttons"> <a href="#" class="button-facebook"> <i class="social-icon fa fa-facebook"></i> </a> <a href="#" class="button-twitter"> <i class="social-icon fa fa-twitter"></i> </a> <a href="#" class="button-google"> <i class="social-icon fa fa-google-plus"></i> </a> </div>--> </div> <div class="loginbox-or"> <div class="or-line"></div> <div class="or">v</div> </div> <div class="loginbox-textbox"> <input id='email' name='email' type="text" class="form-control" placeholder="Email" /> </div> <div class="loginbox-textbox"> <input id='password' name='password' type="password" class="form-control" placeholder="Password" /> </div> <div class="loginbox-forgot"> <a href="#">Forgot Password?</a> </div> <div class="loginbox-submit"> <input type="button" class="btn btn-default shiny btn-block" value="Login" onclick='formhash(this.form, this.form.password);'/> </div> <div class="loginbox-signup"> <a href="register.html">Sign Up With Email</a> </div> </div> <div class="logobox"> @if ($errors->any()) @foreach ($errors->all() as $error) <div class="alert alert-danger fade in"> <button class="close" data-dismiss="alert">×</button> <i class="fa-fw fa fa-times"></i> <strong>Error !</strong> {{ $error }} </div> @endforeach @endif </div> </div> {!! Form::close() !!} @stop @section('footer') <footer style="visibility=hidden;"></footer> @stop
nishol/alphaalphaalpha
test/resources/views/pages/login.blade.php
PHP
gpl-2.0
2,476
<?php // Prevent loading this file directly if ( !defined('SENDPRESS_VERSION') ) { header('HTTP/1.0 403 Forbidden'); die; } class SendPress_Data extends SendPress_DB_Tables { static function nonce(){ return 'sendpress-is-awesome'; } static function nonce_field(){ wp_nonce_field( SendPress_Data::nonce() ); } static function email_post_type(){ return 'sp_newsletters'; } static function report_post_type(){ return 'sp_report'; } static function gmdate(){ return gmdate('Y-m-d H:i:s'); } /********************* BASE static functionS **************************/ static function wpdbQuery($query, $type) { global $wpdb; $result = $wpdb->$type( $query ); return $result; } static function wpdbQueryArray($query) { global $wpdb; $result = $wpdb->get_results( $query , ARRAY_N); return $result; } static function let_to_num( $v ) { $l = substr( $v, -1 ); $ret = substr( $v, 0, -1 ); switch ( strtoupper( $l ) ) { case 'P': $ret *= 1024; case 'T': $ret *= 1024; case 'G': $ret *= 1024; case 'M': $ret *= 1024; case 'K': $ret *= 1024; break; } return $ret; } /********************* BASE static functionS **************************/ /********************* QUEUE static functionS **************************/ static function get_single_email_from_queue(){ global $wpdb; $date = date_i18n('Y-m-d H:i:s'); $info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ". SendPress_Data::queue_table() ." WHERE success = 0 AND max_attempts != attempts AND inprocess = 0 and ( date_sent = '0000-00-00 00:00:00' or date_sent < %s ) ORDER BY id LIMIT 1", $date)); return $info; } static function remove_from_queue($id){ global $wpdb; $table = self::queue_table(); $wpdb->query( $wpdb->prepare("DELETE FROM $table WHERE emailID = %d", $id ) ); } static function delete_queue_emails(){ $table = self::queue_table(); self::wpdbQuery("DELETE FROM $table WHERE success = 0", 'query'); } static function queue_email_process($id){ $table = self::queue_table(); global $wpdb; $result = $wpdb->update( $table ,array('inprocess'=>'1','last_attempt'=>date('Y-m-d H:i:s')), array('id'=> $id) ); } static function requeue_emails(){ $table = self::queue_table(); global $wpdb; $result = $wpdb->update( $table ,array('attempts'=>'0'), array('attempts'=> '3' ,'success'=>'0') ); } static function emails_in_queue($id = false){ global $wpdb; $table = self::queue_table(); if($id == false){ $query = "SELECT COUNT(*) FROM $table where success = 0"; $query.=" AND ( date_sent = '0000-00-00 00:00:00' or date_sent < '".date_i18n('Y-m-d H:i:s')."') "; if(isset($_GET["listid"]) && $_GET["listid"]> 0 ){ $query .= ' AND listID = '. $_GET["listid"]; } if(isset($_GET["qs"] )){ $query .= ' AND to_email LIKE "%'. $_GET["qs"] .'%"'; } } else { $query = $wpdb->prepare("SELECT COUNT(*) FROM $table where emailID = %d and success = 0", $id ); } return $wpdb->get_var( $query ); } static function emails_stuck_in_queue($id = false){ global $wpdb; $table = self::queue_table(); $hour_ago = strtotime('-1 hour'); $hour = date('Y-m-d H:i:s', $hour_ago); $query = "SELECT COUNT(*) FROM $table where success = 0 and (( inprocess = 1 and last_attempt < %s and last_attempt != '0000-00-00 00:00:00') or (max_attempts = attempts) ) "; return $wpdb->get_var( $wpdb->prepare($query, $hour) ); } static function get_lists_in_queue(){ global $wpdb; $table = self::queue_table(); $hour_ago = strtotime('-1 hour'); $hour = date('Y-m-d H:i:s', $hour_ago); $query = "SELECT listID FROM $table where success = 0 group by listID "; $id=$wpdb->get_results( $query ); $listdata = array(); foreach ($id as $list) { $listdata[] = array('id'=>$list->listID,'title'=>get_the_title($list->listID)); } return $listdata; } static function clean_queue_table(){ global $wpdb; $hour_ago = strtotime('-1 hour'); $hour = date('Y-m-d H:i:s', $hour_ago); $hour_ago = strtotime('-7 day'); $day = date('Y-m-d H:i:s', $hour_ago); $table = self::queue_table(); $query = $wpdb->prepare("DELETE FROM $table where last_attempt < %s and success = %d", $day, 1 ); $wpdb->query( $query ); $query = $wpdb->prepare("UPDATE $table set inprocess = 0 where last_attempt < %s and success = %d and inprocess = %d", $hour, 0 ,1 ); $wpdb->query( $query ); } static function emails_sent_in_queue($type = "hour" ){ global $wpdb; if($type == "hour"){ $hour_ago = strtotime('-1 hour'); $time = date('Y-m-d H:i:s', $hour_ago); } if($type == "day"){ $hour_ago = strtotime('-1 day'); $time = date('Y-m-d H:i:s', $hour_ago); } $table = self::queue_table(); $query = $wpdb->prepare("SELECT COUNT(*) FROM $table where last_attempt > %s and success = %d", $time, 1 ); return $wpdb->get_var( $query ); } static function process_with_iron( $id ){ global $wpdb; $table = self::queue_table(); $query = $wpdb->prepare("SELECT id from $table where id = %d and inprocess = %d" , $id,0); $id = $wpdb->get_var($query); if(!isset($id)){ return 0; } $result = $wpdb->update( $table ,array('inprocess'=>'1','last_attempt'=>date('Y-m-d H:i:s')), array('id'=> $id) ); return $result; } static function fetch_queue_for_iron(){ global $wpdb; $table = self::queue_table(); $counter = SendPress_Option::get('last_queue_id'); if($counter == false){ $coutner = 0; } else { $query = $wpdb->prepare("SELECT id from $table where id = %d" , $counter+1); $id = $wpdb->get_var($query); if(!isset($id)){ $counter= 0; } } $query = $wpdb->prepare("SELECT * FROM $table WHERE id > %d LIMIT 10" , $counter); $data = $wpdb->get_results($query,ARRAY_A); $end = end($data); if($end['id']){ SendPress_Option::set('last_queue_id', $end['id']); } return $data; } static function add_email_to_queue($values){ global $wpdb; $table = SendPress_Data::queue_table(); $messageid = SendPress_Data::unique_message_id(); $values["messageID"] = $messageid; $values["date_published"] = date('Y-m-d H:i:s'); $wpdb->insert( $table, $values); } static function unique_message_id() { if ( isset($_SERVER['SERVER_NAME'] ) ) { $servername = $_SERVER['SERVER_NAME']; } else { $servername = 'localhost.localdomain'; } $uniq_id = md5(uniqid(time())); $result = sprintf('%s@%s', $uniq_id, $servername); return $result; } static function get_charset_types(){ return array( "UTF-8", "UTF-7", "BIG5", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "Windows-1251", "Windows-1252"); } static function get_encoding_types(){ return array("8bit", "7bit", "binary", "base64", "quoted-printable"); } /********************* QUEUE static functionS **************************/ /********************* POST NOTIFICATION static functionS ***************/ static function get_post_notification_types(){ return array("pn-instant" => "Instant", "pn-daily" => "Daily", "pn-weekly" => "Weekly"); } /********************* POST NOTIFICATION static functionS ***************/ /********************* REPORTS static functionS **************************/ static function update_report_sent_count( $id ) { $sent = get_post_meta($id , '_sent_total', 1); $sent++; update_post_meta( $id ,'_sent_total' , $sent ); } static function get_last_report(){ $f = get_posts(array('post_type' => 'sp_report','posts_per_page' => 1)); return $f[0]; } /** * Get url's in the database by the report and url string * * @param mixed $id the report id. * @param mixed $url_string the url string. * * @access public * * @return mixed Value. */ static function get_url_by_id( $id ) { global $wpdb; $table = SendPress_Data::report_url_table(); $result = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $table WHERE urlID = %d", $id) ); return $result; } static function get_url_by_report_url( $id , $url_string ){ $table = self::report_url_table(); $result = self::wpdbQuery("SELECT * FROM $table WHERE reportID = '$id' AND url = '$url_string'", 'get_results'); return $result; } static function get_open_without_id($rid, $sid){ global $wpdb; $table = SendPress_Data::subscriber_event_table(); $result = $wpdb->query( $wpdb->prepare("SELECT * FROM $table WHERE reportID = %d AND subscriberID = %d AND type='open' ", $rid, $sid ) ); return $result; } static function insert_report_url( $url ){ global $wpdb; $wpdb->insert( self::report_url_table(), $url); return $wpdb->insert_id; } static function get_clicks_and_opens($rid){ global $wpdb; $table = self::subscriber_event_table(); $result = $wpdb->get_results("SELECT COUNT(eventID) as count,date(eventdate) as day FROM $table WHERE reportID = '$rid' GROUP BY date(eventdate) ORDER BY eventID DESC ;"); return $result; } static function get_clicks_count($rid){ global $wpdb; $table = self::subscriber_event_table(); $result = $wpdb->get_results("SELECT COUNT(eventID) as count,date(eventdate) as day FROM $table WHERE reportID = '$rid' AND type = 'click' GROUP BY date(eventdate) ORDER BY eventID DESC ;"); return $result; } static function get_opens_count($rid){ global $wpdb; $table = self::subscriber_event_table(); $result = $wpdb->get_results("SELECT COUNT(eventID) as count,date(eventdate) as day FROM $table WHERE reportID = '$rid' AND type = 'open' GROUP BY date(eventdate) ORDER BY eventID DESC ;"); return $result; } static function get_opens_unique_count($rid){ global $wpdb; $table = self::subscriber_event_table(); $result = $wpdb->get_results("SELECT COUNT(t.eventID) as count,date(t.eventdate) as day FROM (Select eventdate,eventID FROM $table WHERE reportID = '$rid' AND type = 'open' GROUP BY subscriberID) as t GROUP BY date(eventdate) ORDER BY eventID DESC "); return $result; } static function get_clicks_unique_count($rid){ global $wpdb; $table = self::subscriber_event_table(); $result = $wpdb->get_results("SELECT COUNT(t.eventID) as count,date(t.eventdate) as day FROM (Select eventdate,eventID FROM $table WHERE reportID = '$rid' AND type = 'click' GROUP BY subscriberID) as t GROUP BY date(eventdate) ORDER BY eventID DESC "); return $result; } static function track_click( $sid, $rid, $lid, $ip , $device_type, $device ){ global $wpdb; if(false == SendPress_Data::get_open_without_id($rid,$sid) ){ SendPress_Data::track_open($sid, $rid, $ip, $device_type, $device ); } $urlData = array( 'eventdate'=>date('Y-m-d H:i:s'), 'subscriberID' => $sid, 'reportID' => $rid, 'urlID'=>$lid, 'ip'=>$ip, 'devicetype'=> $device_type, 'device'=> $device, 'type'=>'click' ); $wpdb->insert( SendPress_Data::subscriber_event_table(), $urlData); //print_r($this->get_open_without_id($rid,$sid)); } static function track_open( $sid, $rid, $ip = null , $device_type=null, $device=null ){ global $wpdb; $wpdb->insert( SendPress_Data::subscriber_event_table() , array('reportID'=> $rid,'subscriberID'=>$sid,'eventdate'=>date('Y-m-d H:i:s'),'type'=>'open' ,'ip'=>$ip,'devicetype'=> $device_type,'device'=> $device)); } static function get_subscriber_event_count_month($date, $type){ global $wpdb; $table = SendPress_Data::subscriber_event_table();//SELECT * FROM table_name WHERE MONTH(date_column) = 4; $result = $wpdb->get_var("SELECT COUNT(eventdate) as count FROM $table WHERE type = '$type' AND MONTH(eventdate) = $date"); return $result; } //date_column between "2001-01-05" and "2001-01-10" static function get_subscriber_event_count_week($date1, $date2, $type){ global $wpdb; $table = SendPress_Data::subscriber_event_table(); $result = $wpdb->get_var("SELECT COUNT(eventdate) as count FROM $table WHERE type = '$type' AND date(eventdate) BETWEEN '$date1' AND '$date2'"); return $result; } static function get_subscriber_event_count_day($date, $type){ global $wpdb; $table = SendPress_Data::subscriber_event_table();//SELECT * FROM table_name WHERE MONTH(date_column) = 4; $result = $wpdb->get_var("SELECT COUNT(eventdate) as count FROM $table WHERE type = '$type' AND date(eventdate) = '$date'"); return $result; } /********************* END REPORTS static functionS **************************/ /************************* LIST static functionS ****************************/ static function get_list_details($id){ return get_post( $id ); } static function create_list($values){ // Create post object $my_post = array( 'post_title' => $values['name'], 'post_content' => '', 'post_status' => 'publish', 'post_type'=>'sendpress_list' ); // Insert the post into the database $new_id = wp_insert_post( $my_post ); update_post_meta($new_id,'public',$values['public']); //add_post_meta($new_id,'last_send_date',$newlist->last_send_date); //add_post_meta($new_id,'legacy_id',$newlist->listID); //$this->upgrade_lists_new_id( $newlist->listID, $new_id); // $table = $this->lists_table(); //$result = $this->wpdbQuery("INSERT INTO $table (name, created, public) VALUES( '" .$values['name'] . "', '" . date('Y-m-d H:i:s') . "','" .$values['public'] . "')", 'query'); return $new_id; } static function update_list($listID, $values){ global $wpdb; //$table = $this->lists_table(); //$result = $wpdb->update($table,$values, array('listID'=> $listID) ); $my_post = array( 'post_title' => $values['name'], 'ID'=> $listID, ); // Insert the post into the database $new_id = wp_update_post( $my_post ); update_post_meta($new_id,'public',$values['public']); return $new_id; } static function get_lists($args = array(), $use_wpquery = true){ $args = apply_filters('sendpress_get_lists', array_merge($args, array( 'numberposts' => -1, 'offset' => 0, 'orderby' => 'post_title', 'order' => 'DESC' ))); //set the post type after filter so our function name always makes sense ;) $args['post_type'] = 'sendpress_list'; return ( $use_wpquery ) ? new WP_Query( $args ) : get_posts( $args ); } /********************* END LIST FUNCTIONS ****************************/ /********************* SUBSCRIBER static functionS **************************/ static function remove_all_subscribers( $list_id = false ){ if($list_id !== false && is_numeric( $list_id )){ global $wpdb; $table = self::list_subcribers_table(); $wpdb->query( $wpdb->prepare("DELETE FROM $table WHERE listID = %d", $list_id) ); } } static function delete_all_subscribers(){ global $wpdb; $wpdb->query( "DELETE FROM " . SendPress_Data::subscriber_table() ." " ); $wpdb->query( "DELETE FROM " . SendPress_Data::list_subcribers_table() ." " ); $wpdb->query( "DELETE FROM " . SendPress_Data::subscriber_event_table() ." " ); } static function delete_subscriber($subscriberID = false){ if($subscriberID != false){ global $wpdb; $wpdb->query( $wpdb->prepare( "DELETE FROM " . SendPress_Data::subscriber_table() ." WHERE subscriberID = %d", $subscriberID ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM " . SendPress_Data::list_subcribers_table() ." WHERE subscriberID = %d", $subscriberID ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM " . SendPress_Data::subscriber_event_table() ." WHERE subscriberID = %d", $subscriberID ) ); } } static function sync_emails_to_list($listid, $emails){ global $wpdb; $query_get = "SELECT subscriberID FROM ". SendPress_Data::subscriber_table(). " WHERE email in ('".implode("','", $emails)."')"; $data = $wpdb->get_results($query_get); $query_update_status ="INSERT IGNORE INTO ". SendPress_Data::list_subcribers_table(). "(subscriberID,listID,status,updated ) VALUES "; $total = count($data); $x = 0; if($total > 0){ $good_ids =array(); foreach ($data as $value) { $x++; $good_ids[] = $value->subscriberID; $query_update_status .= "( ".$value->subscriberID . "," . $listid . ",2,'" .date('Y-m-d H:i:s') . "') "; if($total > $x ){ $query_update_status .=",";} } $query_update_status .=";"; $wpdb->query($query_update_status); /* $clean_list_query = "DELETE FROM " .SendPress_Data::list_subcribers_table(). " WHERE listID = ".$listid." AND subscriberID not in ('".implode("','", $good_ids)."')"; $wpdb->query($clean_list_query); */ } } static function drop_active_subscribers_for_sync( $listid = false ) { if( $listid != false ){ global $wpdb; $clean_list_query = "DELETE FROM " .SendPress_Data::list_subcribers_table(). " WHERE listID = ".$listid." AND status = 2"; $wpdb->query($clean_list_query); } } static function sync_lists_micro( $listid, $emails ) { } static function update_subscriber($subscriberID, $values){ $table = SendPress_Data::subscriber_table(); global $wpdb; $result = $wpdb->update($table,$values, array('subscriberID'=> $subscriberID) ); } static function update_subscriber_by_email($email, $values){ $table = SendPress_Data::subscriber_table(); global $wpdb; $key = SendPress_Data::random_code(); //$id = SendPress_Data::get_subscriber_by_email($email); $q = "INSERT INTO $table (email,wp_user_id,identity_key,join_date,firstname,lastname) VALUES (%s,%d,%s,%s,%s,%s) ON DUPLICATE KEY UPDATE wp_user_id=%d,firstname=%s,lastname=%s"; $q = $wpdb->prepare($q,$email,$values['wp_user_id'],$key,date('Y-m-d H:i:s'),$values['firstname'],$values['lastname'],$values['wp_user_id'],$values['firstname'],$values['lastname']); $result = $wpdb->query($q); //$result = $wpdb->update($table, $values, array('email'=> $email) ); } static function get_subcribers_by_meta($meta_key = false, $meta_value = false, $list_id= false){ if($meta_key == false){ return false; } global $wpdb; $meta_table = SendPress_Data::subscriber_meta_table(); $subscriber_table = SendPress_Data::subscriber_table(); $list_table = SendPress_Data::list_subcribers_table(); if($list_id == false){ $query = "SELECT t2.*,t1.* FROM $meta_table as t1, $subscriber_table as t2 WHERE (t1.subscriberID = t2.subscriberID) "; } else { $query = "SELECT t2.*,t1.meta_value,t1.listID FROM $meta_table as t1, $subscriber_table as t2 , $list_table as t3 WHERE (t1.subscriberID = t2.subscriberID) AND (t2.subscriberID = t3.subscriberID) "; } $query .= $wpdb->prepare(" AND t1.meta_key = %s", $meta_key ); if($meta_value != false){ $query .= $wpdb->prepare(" AND t1.meta_value = %s", $meta_value); } if($list_id != false){ $query .= $wpdb->prepare(" AND t3.subscriberID = t1.subscriberID AND t3.listID = %d AND t3.status = 2 ", $list_id); } return $wpdb->get_results($query); } static function get_subscriber_meta($subscriber_id =false, $meta_key =false, $list_id = false, $multi = false){ if($subscriber_id == false){ return false; } global $wpdb; $meta_table = SendPress_Data::subscriber_meta_table(); $subscriber_table = SendPress_Data::subscriber_table(); $list_table = SendPress_Data::list_subcribers_table(); if($meta_key == false){ $query = $wpdb->prepare("SELECT meta_key,meta_value FROM $meta_table WHERE subscriberID = %s",$subscriber_id); if($list_id != false){ $query .= $wpdb->prepare(" AND listID = %s ", $list_id ); } } else { $query = $wpdb->prepare("SELECT meta_value FROM $meta_table WHERE subscriberID = %d AND meta_key = %s ",$subscriber_id, $meta_key); if($list_id != false){ $query .= $wpdb->prepare(" AND listID = %s ", $list_id ); } if($multi == false){ $query .= " ORDER BY smeta_id DESC LIMIT 1"; return $wpdb->get_var($query); } else { $query .= " ORDER BY smeta_id DESC "; } } return $wpdb->get_results($query); } static function add_subscriber_meta($subscriber_id,$meta_key,$meta_value,$list_id = false){ global $wpdb; $meta_table = SendPress_Data::subscriber_meta_table(); if($list_id == false){ $list_id = 0; } return $wpdb->insert( $meta_table, array('subscriberID'=>$subscriber_id,'meta_key' => $meta_key , 'meta_value' => $meta_value ,'listID'=>$list_id) ); } static function update_subscriber_meta($subscriber_id,$meta_key,$meta_value,$list_id = false){ global $wpdb; $meta_table = SendPress_Data::subscriber_meta_table(); $has_data = SendPress_Data::get_subscriber_meta( $subscriber_id, $meta_key, $list_id, true ); if(empty($has_data)){ return SendPress_Data::add_subscriber_meta( $subscriber_id, $meta_key, $meta_value, $list_id ); } else { return $wpdb->update( $meta_table, array('meta_value'=>$meta_value), array('subscriberID'=>$subscriber_id,'meta_key' => $meta_key , 'meta_value' => $has_data[0]->meta_value ) ); } } static function get_most_active_subscriber( $limit = 10 ){ global $wpdb; $table = SendPress_Data::subscriber_event_table(); $query = "select count(subscriberID), subscriberID from $table group by subscriberID order by count(subscriberID) DESC LIMIT $limit"; return $wpdb->get_results( $query ); } function export_subscirbers($listID = false){ global $wpdb; if($listID){ $query = "SELECT t1.*, t3.status FROM " . SendPress_Data::subscriber_table() ." as t1,". SendPress_Data::list_subcribers_table()." as t2,". SendPress_Data::subscriber_status_table()." as t3 " ; $query .= " WHERE (t1.subscriberID = t2.subscriberID) AND ( t3.statusid = t2.status ) AND (t2.listID = ". $listID .")"; } else { $query = "SELECT * FROM " . SendPress_Data::subscriber_table(); } return $wpdb->get_results( $query ); } static function get_subscriber($subscriberID, $listID = false){ if($listID){ $query = "SELECT t1.*, t3.status FROM " . self::subscriber_table() ." as t1,". self::list_subcribers_table()." as t2,". self::subscriber_status_table()." as t3 " ; $query .= " WHERE (t1.subscriberID = t2.subscriberID) AND ( t3.statusid = t2.status ) AND (t2.listID = ". $listID ." AND t2.subscriberID = ". $subscriberID .")"; } else { $query = "SELECT * FROM " . self::subscriber_table() ." WHERE subscriberID = ". $subscriberID ; } return self::wpdbQuery($query, 'get_row'); } static function get_active_subscribers_lists($list_ids = array() ){ global $wpdb; $lists = implode(',', $list_ids); $query = "SELECT t1.subscriberID,t1.email, t3.status, t2.listid, count(*) FROM " . SendPress_Data::subscriber_table() ." as t1,". SendPress_Data::list_subcribers_table()." as t2,". SendPress_Data::subscriber_status_table()." as t3 " ; $query .= " WHERE (t1.subscriberID = t2.subscriberID) AND ( t3.statusid = t2.status ) AND (t2.status = 2) AND (t2.listID in ( ". $lists ." )) GROUP BY t1.subscriberID "; return $wpdb->get_results( $query ); } static function get_active_subscribers_lists_with_id($list_ids = array() , $id = 0 ){ global $wpdb; $lists = implode(',', $list_ids); $query = "SELECT t1.subscriberID,t1.email, t3.status, t2.listid, count(*) FROM " . SendPress_Data::subscriber_table() ." as t1,". SendPress_Data::list_subcribers_table()." as t2,". SendPress_Data::subscriber_status_table()." as t3 " ; $query .= " WHERE (t1.subscriberID = t2.subscriberID) AND ( t3.statusid = t2.status ) AND (t2.status = 2) AND (t2.listID in ( ". $lists ." )) AND t1.subscriberID > ".$id." GROUP BY t1.subscriberID LIMIT 1000"; return $wpdb->get_results( $query ); } static function get_active_subscribers_count($list_ids = array() ){ global $wpdb; $lists = implode(',', $list_ids); $query = "SELECT t1.subscriberID FROM " . SendPress_Data::subscriber_table() ." as t1,". SendPress_Data::list_subcribers_table()." as t2,". SendPress_Data::subscriber_status_table()." as t3 " ; $query .= " WHERE (t1.subscriberID = t2.subscriberID) AND ( t3.statusid = t2.status ) AND (t2.status = 2) AND (t2.listID in ( ". $lists ." )) GROUP BY t1.subscriberID "; $x =$wpdb->get_results( $query ); return count($x); } static function set_subscriber_status($listID, $subscriberID, $status = 0) { $table = self::list_subcribers_table(); $result = self::wpdbQuery("SELECT id FROM $table WHERE listID = $listID AND subscriberID = $subscriberID ", 'get_var'); if($result == false){ $result = self::wpdbQuery("INSERT INTO $table (listID, subscriberID, status, updated) VALUES( '" . $listID . "', '" . $subscriberID . "','".$status."','".date('Y-m-d H:i:s')."')", 'query'); } return $result; } static function update_subscriber_status( $listID, $subscriberID ,$status, $event = true){ $table = SendPress_Data::list_subcribers_table(); $check = SendPress_Data::get_subscriber_list_status($listID, $subscriberID); if( $check == false ){ SendPress_Data::set_subscriber_status($listID,$subscriberID,$status); } else { global $wpdb; $result = $wpdb->update($table,array('status'=>$status,'updated'=>date('Y-m-d H:i:s')), array('subscriberID'=> $subscriberID,'listID'=>$listID) ); } if($event == true){ //add event for notification tracking SendPress_Data::add_subscribe_event($subscriberID, $listID, $status); } return SendPress_Data::get_subscriber_list_status($listID, $subscriberID); } static function remove_subscriber_status( $list_id = false , $subscriberID = false){ if($list_id !== false && is_numeric( $list_id ) && $subscriberID !== false){ global $wpdb; $table = self::list_subcribers_table(); $wpdb->query( $wpdb->prepare("DELETE FROM $table WHERE listID = %d AND subscriberID = %d ", $list_id, $subscriberID) ); } } static function get_subscriber_list_status( $listID,$subscriberID ) { $table = SendPress_Data::list_subcribers_table(); $result = SendPress_Data::wpdbQuery("SELECT t3.status,t2.updated,t3.statusid FROM ". SendPress_Data::list_subcribers_table()." as t2,". SendPress_Data::subscriber_status_table()." as t3 WHERE t2.subscriberID = $subscriberID AND t2.listID = $listID AND t2.status = t3.statusid ", 'get_row'); return $result; } static function is_subsriber_on_list($lid,$sid){ global $wpdb; $table = SendPress_Data::list_subcribers_table(); $id = $wpdb->get_var( $wpdb->prepare("SELECT id FROM $table WHERE listID = %d AND subscriberID = %d ", $lid, $sid) ); if($id > 0 ){ return true; } return false; } static function get_subscriber_events($sid){ global $wpdb; $table = SendPress_Data::subscriber_event_table(); return $wpdb->get_results( $wpdb->prepare("SELECT * FROM $table WHERE subscriberID = %d order by eventID DESC", $sid) ); } static function get_optin_events($limit = 10){ global $wpdb; $table = SendPress_Data::subscriber_event_table(); return $wpdb->get_results( $wpdb->prepare("SELECT * FROM $table WHERE type = 'optin' order by eventID DESC LIMIT %d", $limit) ); } static function register_event( $event='unknown_event_type' , $sid = null , $rid = null ){ global $wpdb; $event_data = array( 'eventdate'=>SendPress_Data::gmdate(), 'subscriberID' => $sid, 'reportID' => $rid, 'type'=> $event ); $wpdb->insert( SendPress_Data::subscriber_event_table(), $event_data); } static function add_subscriber_event( $sid, $rid, $lid=null, $uid=null, $ip=null, $device_type=null, $device=null, $type='confirm' ){ global $wpdb; $event_data = array( 'eventdate'=>SendPress_Data::gmdate(), 'subscriberID' => $sid, 'reportID' => $rid, 'listID'=>$lid, 'urlID'=>$uid, 'ip'=>$ip, 'devicetype'=> $device_type, 'device'=> $device, 'type'=>$type ); $wpdb->insert( SendPress_Data::subscriber_event_table(), $event_data); } static function add_subscribe_event( $sid, $lid, $type ){ global $wpdb; $event_type = 'unknown_event_type'; if( is_numeric($type) ){ if($type == 2){ $event_type = 'subscribed'; }elseif($type == 3){ $event_type = 'unsubscribed'; }elseif($type==4){ $event_type = 'bounce'; }elseif($type==1){ $event_type = 'optin'; } } $event_data = array( 'eventdate'=>SendPress_Data::gmdate(), 'subscriberID' => $sid, 'listID'=>$lid, 'type'=>$event_type ); $wpdb->insert( SendPress_Data::subscriber_event_table(), $event_data); //if instant, check if we need a notification and send one SendPress_Notifications_Manager::send_instant_notification($event_data); } static function unsubscribe_from_list( $sid, $rid, $lid ) { global $wpdb; $stat = get_post_meta($rid, '_unsubscribe_count', true ); if($stat ==''){ $stat = 1; } else{ $stat++; } update_post_meta($rid, '_unsubscribe_count', $stat ); $wpdb->update( SendPress_Data::list_subcribers_table() , array('status'=> 3) , array('listID'=> $lid,'subscriberID'=>$sid )); } static function get_subscriber_by_email( $email ){ global $wpdb; $table = SendPress_Data::subscriber_table(); $result = $wpdb->get_var( $wpdb->prepare("SELECT subscriberID FROM $table WHERE email = %s ", $email) ); return $result; } static function add_subscriber($values){ $table = SendPress_Data::subscriber_table(); $email = $values['email']; if(!isset($values['join_date'])){ $values['join_date'] = SendPress_Data::gmdate(); } if(!isset($values['identity_key'])){ $values['identity_key'] = SendPress_Data::random_code(); } if( !filter_var($email, FILTER_VALIDATE_EMAIL) ){ return false; } $result = SendPress_Data::get_subscriber_by_email($email); if( $result ){ return $result; } global $wpdb; $result = $wpdb->insert($table,$values); //$result = $this->wpdbQuery("SELECT @lastid2 := LAST_INSERT_ID()",'query'); return $wpdb->insert_id; } static function bounce_email($email){ $id = SendPress_Data::get_subscriber_by_email($email); if($id !== false){ $lists = SendPress_Data::get_lists_for_subscriber($id); foreach ($lists as $list) { if( $list->status == 2 ) { $report_id = SendPress_Data::get_last_send( $id ); SendPress_Data::update_subscriber_status($list->listID, $id, 4 , false); //( $sid, $rid, $uid, $ip , $device_type, $device, $type='confirm' ) //( $sid, $rid, $lid=null, $uid=null, $ip=null, $device_type=null, $device=null, $type='confirm' ) SendPress_Data::add_subscriber_event( $id,$report_id,$list->listID,null ,null, null, null, 'bounce'); } } } } static function get_last_send( $sid ){ global $wpdb; $table = SendPress_Data::subscriber_event_table();//SELECT * FROM table_name WHERE MONTH(date_column) = 4; $result = $wpdb->get_var( $wpdb->prepare("SELECT reportID FROM $table WHERE type = 'send' AND subscriberID = %d ORDER BY eventdate DESC",$sid)); return $result; } static function get_lists_for_subscriber( $value ) { global $wpdb; $table = SendPress_Data::list_subcribers_table(); $result = $wpdb->get_results("SELECT * FROM $table WHERE subscriberID = '$value'"); return $result; } static function get_list_ids_for_subscriber( $value ) { global $wpdb; $table = SendPress_Data::list_subcribers_table(); $result = $wpdb->get_results("SELECT listID FROM $table WHERE subscriberID = '$value'"); return $result; } static function subscribe_user($listid, $email, $first, $last, $status = 2, $custom = array()){ $success = false; $subscriberID = SendPress_Data::add_subscriber(array('firstname' => $first,'lastname' => $last,'email' => $email)); if( false === $subscriberID ){ return false; } $args = array( 'post_type' => 'sendpress_list','numberposts' => -1, 'offset' => 0, 'orderby' => 'post_title', 'order' => 'DESC', ); $lists = get_posts( $args ); $listids = explode(',', $listid); //$lists = $s->getData($s->lists_table()); //$listids = array(); if( $status == 2 && SendPress_Option::is_double_optin() ){ $status = 1; SendPress_Manager::send_optin( $subscriberID, $listids, $lists); } foreach($lists as $list){ if( in_array($list->ID, $listids) ){ $current_status = SendPress_Data::get_subscriber_list_status( $list->ID, $subscriberID ); if( empty($current_status) || ( isset($current_status->status) && $current_status->status < 2 ) ){ $success = SendPress_Data::update_subscriber_status($list->ID, $subscriberID, $status); } else { $success = true; } } } foreach ($custom as $key => $value) { SendPress_Data::update_subscriber_meta($subscriberID,$key,$value,$listid); } return $success; } static function read_file_to_str($file){ return file_get_contents($file); } static function import_csv_array($data, $map, $list){ global $wpdb; $query ="INSERT IGNORE INTO ". SendPress_Data::subscriber_table(). "(email,firstname,lastname,join_date,identity_key) VALUES "; $total = count($data); $emails_added = array(); $x = 0; foreach($data as $key_line => $line){ $values =""; if( array_key_exists('email',$map) ){ $email = $line[$map['email']]; if(is_email($email)){ $values.="'".mysql_real_escape_string($email,$wpdb->dbh)."',"; $emails_added[] = $email; if(array_key_exists('firstname',$map)){ $values.="'".mysql_real_escape_string(trim($line[$map['firstname']]),$wpdb->dbh)."',"; } else { $values .= "'',"; } if(array_key_exists('lastname',$map)){ $values.="'".mysql_real_escape_string(trim($line[$map['lastname']]),$wpdb->dbh)."',"; } else { $values .= "'',"; } $values .= "'".date('Y-m-d H:i:s') ."',"; $values .= "'".SendPress_Data::random_code()."'"; $query .= " ($values) "; } } $x++; if($total > $x && $values != ""){ $query .=",";} unset($data[$key_line]); } $query .=";"; $wpdb->query($query); $query_get = "SELECT subscriberID FROM ". SendPress_Data::subscriber_table(). " WHERE email in ('".implode("','", $emails_added)."')"; $data = $wpdb->get_results($query_get); $query_update_status ="INSERT IGNORE INTO ". SendPress_Data::list_subcribers_table(). "(subscriberID,listID,status,updated ) VALUES "; $total = count($data); $x = 0; if($total > 0){ foreach ($data as $value) { $x++; $query_update_status .= "( ".$value->subscriberID . "," . $list . ",2,'" .date('Y-m-d H:i:s') . "') "; if($total > $x ){ $query_update_status .=",";} } $query_update_status .=";"; $wpdb->query($query_update_status); } } static function csv_to_array($csv_file_content , $rows_to_read = 0 , $delimiter = ',' , $enclosure = '' ){ $data = array(); $csv_data_array = explode( "\n" , $csv_file_content ); $i=1; foreach($csv_data_array as $csv_line){ if($rows_to_read!=0 && $i> $rows_to_read) return $data; if(function_exists('str_getcsv')){ $data[] = str_getcsv($csv_line, $delimiter,$enclosure); }else{ $data[]= SendPress_Data::break_csv_apart($csv_line, $delimiter,$enclosure); } $i++; } return $data; } /* * * Creates an array from a posted textarea * * expects 3 fields or less: @sendpress.me, fname, lname * */ static function subscriber_csv_post_to_array($csv, $delimiter = ',', $enclosure = '"', $escape = '\\', $terminator = "\n") { $r = array(); $rows = explode($terminator,trim($csv)); $names = array_shift($rows); $names = explode(',', $names); $nc = count($names); foreach ($rows as $row) { if (trim($row)) { $needle = substr_count($row, ','); if($needle == false){ $row .=',,'; } if($needle == 1){ $row .=','; } $values = explode(',' , $row); if (!$values) $values = array_fill(0,$nc,null); $r[] = array_combine($names,$values); } } return $r; } static function break_csv_apart($csv_line , $delimiter , $enclose , $preserve=false){ $response = array(); $n = 0; if(empty($enclose)){ $response = explode($delimiter, $csv_line); }else{ $dtx = explode($enclose, $csv_line); foreach($dtx as $item){ if($n++%2){ array_push($response, array_pop($response) . ($preserve ? $enclose : '') . $item.( $preserve ? $enclose : '')); }else{ $del = explode($delimiter, $item); array_push($response, array_pop($response) . array_shift($del)); $response = array_merge($response, $del); } } } return $response; } static function random_code() { $now = time(); $random_code = substr( $now, strlen( $now ) - 3, 3 ) . substr( md5( uniqid( rand(), true ) ), 0, 8 ) . substr( md5( $now . rand() ), 0, 4); return $random_code; } /** * Gets all currently created subscriber status out of the DB * @return array */ static function get_statuses( ) { global $wpdb; return $wpdb->get_results("SELECT * FROM " . SendPress_Data::subscriber_status_table() ); } // COUNT DATA static function get_count_subscribers($listID = false, $status = 2) { global $wpdb; $table = SendPress_Data::list_subcribers_table(); $query = "SELECT COUNT(t1.subscriberID) FROM " . SendPress_Data::subscriber_table() ." as t1,". SendPress_Data::list_subcribers_table()." as t2,". SendPress_Data::subscriber_status_table()." as t3"; $query .= " WHERE (t1.subscriberID = t2.subscriberID) AND (t2.status = t3.statusid ) AND(t2.status = %d) "; if($listID !== false){ $query .= "AND (t2.listID = %d)"; } else { $query .= ""; } // "SELECT COUNT(*) FROM $table WHERE listID = $listID AND status = $status" $count = $wpdb->get_var( $wpdb->prepare( $query, $status, $listID)); return $count; } static function bd_nice_number($n) { // first strip any formatting; $n = (0+str_replace(",","",$n)); // is this a number? if(!is_numeric($n)) return false; // now filter it; if($n>1000000000000) return round(($n/1000000000000),1).' trillion'; else if($n>1000000000) return round(($n/1000000000),1).' billion'; else if($n>1000000) return round(($n/1000000),1).' million'; else if($n>99999) return round(($n/1000),0).'K'; return number_format($n); } /********************* END SUBSCRIBER static functionS **************************/ /********************* TEMPLATE POST static functionS **************************/ /** * Takes a key and looks up or creates a template post for storing data. * * * @param mixed $_token Description. * * @access public * * @return mixed Value. */ static function get_template_id_by_slug( $slug ) { global $wpdb; $_id = 0; $slug = strtolower( str_replace( ' ', '_', $slug ) ); if ( $slug ) { // Tell the static function what to look for in a post. $_args = array('post_parent' => '0', 'post_type' => 'sptemplates', 'name' => 'sp-template-' . $slug, 'post_status' => 'draft', 'comment_status' => 'closed', 'ping_status' => 'closed' ); $querystr = " SELECT $wpdb->posts.* FROM $wpdb->posts WHERE $wpdb->posts.post_name = 'sp-template-$slug' ORDER BY $wpdb->posts.post_date DESC "; $_posts = $wpdb->get_results($querystr, OBJECT); //print_r($_posts); // look in the database for a "silent" post that meets our criteria. //$_posts = get_posts( $_args ); // If we've got a post, loop through and get it's ID. if ( count( $_posts ) ) { $_id = $_posts[0]->ID; } else { // If no post is present, insert one. // Prepare some additional data to go with the post insertion. $_words = explode( '_', $slug ); $_title = join( ' ', $_words ); $_title = ucwords( $_title ); $_post_data = array( 'post_title' => $_title ); $_post_data = array( 'post_name' => $_args['name'] ); //$_post_data = array( 'post_name' => ); $_post_data = array_merge( $_post_data, $_args ); $_id = wp_insert_post( $_post_data ); } // End IF Statement } return $_id; } /** * Takes a key and looks up or creates a template post for storing data. * * * @param mixed $_token Description. * * @access public * * @return mixed Value. */ static function get_template_by_slug( $slug ) { global $wpdb; $_id = 0; $slug = strtolower( str_replace( ' ', '_', $slug ) ); if ( $slug ) { // Tell the static function what to look for in a post. $_args = array('post_parent' => '0', 'post_type' => 'sptemplates', 'name' => 'sp-template-' . $slug, 'post_status' => 'draft', 'comment_status' => 'closed', 'ping_status' => 'closed' ); // look in the database for a "silent" post that meets our criteria. //$_posts = get_posts( $_args ); $querystr = " SELECT $wpdb->posts.* FROM $wpdb->posts WHERE $wpdb->posts.post_name = 'sp-template-$slug' ORDER BY $wpdb->posts.post_date DESC "; $_posts = $wpdb->get_results($querystr, OBJECT); // If we've got a post, loop through and get it's ID. if ( count( $_posts ) ) { $_id = $_posts[0]->ID; } else { // If no post is present, insert one. // Prepare some additional data to go with the post insertion. $_words = explode( '_', $slug ); $_title = join( ' ', $_words ); $_title = ucwords( $_title ); $_post_data = array( 'post_title' => $_title ); $_post_data = array( 'post_name' => $_args['name'] ); //$_post_data = array( 'post_name' => ); $_post_data = array_merge( $_post_data, $_args ); $_id = wp_insert_post( $_post_data ); } // End IF Statement } return get_post( $_id ); } /********************* END TEMPLATE POST static functionS **************************/ /********************* PUBLIC VIEW static functionS **************************/ /** * Get field class name * * @param string $type Field type * * @return bool|string Field class name OR false on failure */ static function get_public_view_class( $view = false){ if($view !== false){ $view = str_replace('-',' ',$view); $view = ucwords( $view ); $view = str_replace(' ','_',$view); $class = "SendPress_Public_View_{$view}"; if ( class_exists( $class ) ) return $class; } return "SendPress_Public_View"; } /********************* END PUBLIC VIEW FUNCTIONS **************************/ static function set_double_optin_content( ){ $optin = self::get_template_by_slug('double-optin'); $optin->post_content = self::optin_content(); $optin->post_title = self::optin_title(); delete_transient( 'sendpress_email_html_'. $optin->ID ); wp_update_post( $optin ); } static function optin_title(){ return "Please respond to join the *|SITE:TITLE|* email list."; } static function optin_content(){ return "Howdy. We're ready to send you emails from *|SITE:TITLE|*, but first we need you to confirm that this is what you really want. If you want *|SITE:TITLE|* content delivered by email, all you have to do is click the link below. Thanks! ----------------------------------------------------------- CONFIRM BY VISITING THE LINK BELOW: *|SP:CONFIRMLINK|* Click the link above to give us permission to send you information. It's fast and easy! If you cannot click the full URL above, please copy and paste it into your web browser. ----------------------------------------------------------- If you do not want to confirm, simply ignore this message. "; } static function get_key(){ $key = SendPress_Option::get('email_key'); if($key == false){ $key = sha1(microtime(true).mt_rand(10000,90000)); SendPress_Option::set('email_key', $key); } return $key; } static function encrypt( $message ) { $key = self::get_key(); $message = json_encode($message); $encstring = ''; $keylength = strlen($key); $messagelength = strlen($message); /* for($i=0;$i<=$messagelength - 1;$i++) { $msgord = ord(substr($message,$i,1)); $keyord = ord(substr($key,$i % $keylength,1)); if ($msgord + $keyord <= 255){$encstring .= chr($msgord + $keyord);} if ($msgord + $keyord > 255){$encstring .= chr(($msgord + $keyord)-256);} } */ return urlencode(str_replace("=","",base64_encode( $message))); } static function decrypt($message) { $key = self::get_key(); $decstring =''; $keylength = strlen($key); $message = base64_decode($message); $json = json_decode($message); if( is_object($json) && !is_null($json) ){ return $json; } else { $messagelength = strlen($message); for($i=0;$i<=$messagelength - 1;$i++) { $msgord = ord(substr($message,$i,1)); $keyord = ord(substr($key,$i % $keylength,1)); if ($msgord - $keyord >= 0){$decstring .= chr($msgord - $keyord);} if ($msgord + $keyord < 0){$decstring .= chr(($msgord - $keyord)+256);} } return json_decode($decstring); } } }
hlavina/vava
wp-content/plugins/sendpress/classes/class-sendpress-data.php
PHP
gpl-2.0
45,704
/* * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. 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; 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. */ #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/ctype.h> #include <linux/types.h> #include <linux/delay.h> #include <linux/device.h> #include <linux/i2c.h> #include <linux/regulator/consumer.h> #include <linux/fsl_devices.h> #include <mach/mipi_csi2.h> #include <media/v4l2-chip-ident.h> #include <media/v4l2-int-device.h> #include "mxc_v4l2_capture.h" #include <linux/proc_fs.h> #define OV5640_VOLTAGE_ANALOG 2800000 #define OV5640_VOLTAGE_DIGITAL_CORE 1500000 #define OV5640_VOLTAGE_DIGITAL_IO 1800000 #define MIN_FPS 15 #define MAX_FPS 30 #define DEFAULT_FPS 30 #define OV5640_XCLK_MIN 6000000 #define OV5640_XCLK_MAX 24000000 #define OV5640_CHIP_ID_HIGH_BYTE 0x300A #define OV5640_CHIP_ID_LOW_BYTE 0x300B enum ov5640_mode { ov5640_mode_MIN = 0, ov5640_mode_VGA_640_480 = 0, ov5640_mode_QVGA_320_240 = 1, ov5640_mode_NTSC_720_480 = 2, ov5640_mode_PAL_720_576 = 3, ov5640_mode_720P_1280_720 = 4, ov5640_mode_1080P_1920_1080 = 5, ov5640_mode_QSXGA_2592_1944 = 6, ov5640_mode_QCIF_176_144 = 7, ov5640_mode_XGA_1024_768 = 8, ov5640_mode_MAX = 8, ov5640_mode_INIT = 0xff, /*only for sensor init*/ }; enum ov5640_frame_rate { ov5640_15_fps, ov5640_30_fps }; /* image size under 1280 * 960 are SUBSAMPLING * image size upper 1280 * 960 are SCALING */ enum ov5640_downsize_mode { SUBSAMPLING, SCALING, }; struct reg_value { u16 u16RegAddr; u8 u8Val; u8 u8Mask; u32 u32Delay_ms; }; struct ov5640_mode_info { enum ov5640_mode mode; enum ov5640_downsize_mode dn_mode; u32 width; u32 height; struct reg_value *init_data_ptr; u32 init_data_size; }; #define CMD_MAIN 0x3022 #define CMD_ACK 0x3023 #define CMD_PARA0 0x3024 #define CMD_PARA1 0x3025 #define CMD_PARA2 0x3026 #define CMD_PARA3 0x3027 #define CMD_PARA4 0x3028 #define FW_STATUS 0x3029 /*! * Maintains the information on the current state of the sesor. */ static struct sensor_data ov5640_data; static struct reg_value ov5640_af_firmware[] = { {0x8000, 0x02, 0, 0}, {0x8001, 0x0b, 0, 0}, {0x8002,0x03, 0, 0}, {0x8003, 0x02, 0, 0}, {0x8004, 0x07, 0, 0}, {0x8005,0x5d, 0, 0}, {0x8006, 0xc2, 0, 0}, {0x8007, 0x01, 0, 0}, {0x8008,0x22, 0, 0}, {0x8009, 0x22, 0, 0}, {0x800a, 0x00, 0, 0}, {0x800b,0x02, 0, 0}, {0x800c, 0x0a, 0, 0}, {0x800d, 0xed, 0, 0}, {0x800e,0xe5, 0, 0}, {0x800f, 0x40, 0, 0}, {0x8010, 0x60, 0, 0}, {0x8011,0x03, 0, 0}, {0x8012, 0x02, 0, 0}, {0x8013, 0x00, 0, 0}, {0x8014,0x97, 0, 0}, {0x8015, 0xf5, 0, 0}, {0x8016, 0x3f, 0, 0}, {0x8017,0xd2, 0, 0}, {0x8018, 0x34, 0, 0}, {0x8019, 0x75, 0, 0}, {0x801a,0x29, 0, 0}, {0x801b, 0xff, 0, 0}, {0x801c, 0x75, 0, 0}, {0x801d,0x2a, 0, 0}, {0x801e, 0x0e, 0, 0}, {0x801f, 0x75, 0, 0}, {0x8020,0x2b, 0, 0}, {0x8021, 0x55, 0, 0}, {0x8022, 0x75, 0, 0}, {0x8023,0x2c, 0, 0}, {0x8024, 0x01, 0, 0}, {0x8025, 0x12, 0, 0}, {0x8026,0x09, 0, 0}, {0x8027, 0xe0, 0, 0}, {0x8028, 0xe4, 0, 0}, {0x8029,0xff, 0, 0}, {0x802a, 0xef, 0, 0}, {0x802b, 0x25, 0, 0}, {0x802c,0xe0, 0, 0}, {0x802d, 0x24, 0, 0}, {0x802e, 0x41, 0, 0}, {0x802f,0xf8, 0, 0}, {0x8030, 0xe4, 0, 0}, {0x8031, 0xf6, 0, 0}, {0x8032,0x08, 0, 0}, {0x8033, 0xf6, 0, 0}, {0x8034, 0x0f, 0, 0}, {0x8035,0xbf, 0, 0}, {0x8036, 0x34, 0, 0}, {0x8037, 0xf2, 0, 0}, {0x8038,0x90, 0, 0}, {0x8039, 0x0e, 0, 0}, {0x803a, 0x88, 0, 0}, {0x803b,0xe4, 0, 0}, {0x803c, 0x93, 0, 0}, {0x803d, 0xff, 0, 0}, {0x803e,0xe5, 0, 0}, {0x803f, 0x3e, 0, 0}, {0x8040, 0xc3, 0, 0}, {0x8041,0x9f, 0, 0}, {0x8042, 0x50, 0, 0}, {0x8043, 0x04, 0, 0}, {0x8044,0x7f, 0, 0}, {0x8045, 0x05, 0, 0}, {0x8046, 0x80, 0, 0}, {0x8047,0x02, 0, 0}, {0x8048, 0x7f, 0, 0}, {0x8049, 0xfb, 0, 0}, {0x804a,0x78, 0, 0}, {0x804b, 0xb0, 0, 0}, {0x804c, 0xa6, 0, 0}, {0x804d,0x07, 0, 0}, {0x804e, 0x12, 0, 0}, {0x804f, 0x0a, 0, 0}, {0x8050,0x4a, 0, 0}, {0x8051, 0x40, 0, 0}, {0x8052, 0x04, 0, 0}, {0x8053,0x7f, 0, 0}, {0x8054, 0x03, 0, 0}, {0x8055, 0x80, 0, 0}, {0x8056,0x02, 0, 0}, {0x8057, 0x7f, 0, 0}, {0x8058, 0x30, 0, 0}, {0x8059,0x78, 0, 0}, {0x805a, 0xaf, 0, 0}, {0x805b, 0xa6, 0, 0}, {0x805c,0x07, 0, 0}, {0x805d, 0xe6, 0, 0}, {0x805e, 0x18, 0, 0}, {0x805f,0xf6, 0, 0}, {0x8060, 0x08, 0, 0}, {0x8061, 0xe6, 0, 0}, {0x8062,0x78, 0, 0}, {0x8063, 0xac, 0, 0}, {0x8064, 0xf6, 0, 0}, {0x8065,0x78, 0, 0}, {0x8066, 0xaf, 0, 0}, {0x8067, 0xe6, 0, 0}, {0x8068,0x78, 0, 0}, {0x8069, 0xad, 0, 0}, {0x806a, 0xf6, 0, 0}, {0x806b,0x78, 0, 0}, {0x806c, 0xb2, 0, 0}, {0x806d, 0x76, 0, 0}, {0x806e,0x33, 0, 0}, {0x806f, 0xe4, 0, 0}, {0x8070, 0x08, 0, 0}, {0x8071,0xf6, 0, 0}, {0x8072, 0x78, 0, 0}, {0x8073, 0xab, 0, 0}, {0x8074,0x76, 0, 0}, {0x8075, 0x01, 0, 0}, {0x8076, 0x75, 0, 0}, {0x8077,0x3d, 0, 0}, {0x8078, 0x02, 0, 0}, {0x8079, 0x78, 0, 0}, {0x807a,0xa9, 0, 0}, {0x807b, 0xf6, 0, 0}, {0x807c, 0x08, 0, 0}, {0x807d,0xf6, 0, 0}, {0x807e, 0x74, 0, 0}, {0x807f, 0xff, 0, 0}, {0x8080,0x78, 0, 0}, {0x8081, 0xb4, 0, 0}, {0x8082, 0xf6, 0, 0}, {0x8083,0x08, 0, 0}, {0x8084, 0xf6, 0, 0}, {0x8085, 0x75, 0, 0}, {0x8086,0x40, 0, 0}, {0x8087, 0x01, 0, 0}, {0x8088, 0x78, 0, 0}, {0x8089,0xaf, 0, 0}, {0x808a, 0xe6, 0, 0}, {0x808b, 0x75, 0, 0}, {0x808c,0xf0, 0, 0}, {0x808d, 0x05, 0, 0}, {0x808e, 0xa4, 0, 0}, {0x808f,0xf5, 0, 0}, {0x8090, 0x3e, 0, 0}, {0x8091, 0x12, 0, 0}, {0x8092,0x07, 0, 0}, {0x8093, 0xf1, 0, 0}, {0x8094, 0xc2, 0, 0}, {0x8095,0x36, 0, 0}, {0x8096, 0x22, 0, 0}, {0x8097, 0x78, 0, 0}, {0x8098,0xab, 0, 0}, {0x8099, 0xe6, 0, 0}, {0x809a, 0xd3, 0, 0}, {0x809b,0x94, 0, 0}, {0x809c, 0x00, 0, 0}, {0x809d, 0x40, 0, 0}, {0x809e,0x02, 0, 0}, {0x809f, 0x16, 0, 0}, {0x80a0, 0x22, 0, 0}, {0x80a1,0xe5, 0, 0}, {0x80a2, 0x40, 0, 0}, {0x80a3, 0x64, 0, 0}, {0x80a4,0x05, 0, 0}, {0x80a5, 0x70, 0, 0}, {0x80a6, 0x28, 0, 0}, {0x80a7,0xf5, 0, 0}, {0x80a8, 0x40, 0, 0}, {0x80a9, 0xc2, 0, 0}, {0x80aa,0x01, 0, 0}, {0x80ab, 0x78, 0, 0}, {0x80ac, 0xac, 0, 0}, {0x80ad,0xe6, 0, 0}, {0x80ae, 0x25, 0, 0}, {0x80af, 0xe0, 0, 0}, {0x80b0,0x24, 0, 0}, {0x80b1, 0x41, 0, 0}, {0x80b2, 0xf8, 0, 0}, {0x80b3,0xe6, 0, 0}, {0x80b4, 0xfe, 0, 0}, {0x80b5, 0x08, 0, 0}, {0x80b6,0xe6, 0, 0}, {0x80b7, 0xff, 0, 0}, {0x80b8, 0x78, 0, 0}, {0x80b9,0x41, 0, 0}, {0x80ba, 0xa6, 0, 0}, {0x80bb, 0x06, 0, 0}, {0x80bc,0x08, 0, 0}, {0x80bd, 0xa6, 0, 0}, {0x80be, 0x07, 0, 0}, {0x80bf,0xa2, 0, 0}, {0x80c0, 0x36, 0, 0}, {0x80c1, 0xe4, 0, 0}, {0x80c2,0x33, 0, 0}, {0x80c3, 0xf5, 0, 0}, {0x80c4, 0x31, 0, 0}, {0x80c5,0x90, 0, 0}, {0x80c6, 0x30, 0, 0}, {0x80c7, 0x28, 0, 0}, {0x80c8,0xf0, 0, 0}, {0x80c9, 0x75, 0, 0}, {0x80ca, 0x3f, 0, 0}, {0x80cb,0x10, 0, 0}, {0x80cc, 0xd2, 0, 0}, {0x80cd, 0x34, 0, 0}, {0x80ce,0x22, 0, 0}, {0x80cf, 0xe5, 0, 0}, {0x80d0, 0x3e, 0, 0}, {0x80d1,0x75, 0, 0}, {0x80d2, 0xf0, 0, 0}, {0x80d3, 0x05, 0, 0}, {0x80d4,0x84, 0, 0}, {0x80d5, 0x78, 0, 0}, {0x80d6, 0xaf, 0, 0}, {0x80d7,0xf6, 0, 0}, {0x80d8, 0x90, 0, 0}, {0x80d9, 0x0e, 0, 0}, {0x80da,0x85, 0, 0}, {0x80db, 0xe4, 0, 0}, {0x80dc, 0x93, 0, 0}, {0x80dd,0xff, 0, 0}, {0x80de, 0x25, 0, 0}, {0x80df, 0xe0, 0, 0}, {0x80e0,0x24, 0, 0}, {0x80e1, 0x0a, 0, 0}, {0x80e2, 0xf8, 0, 0}, {0x80e3,0xe6, 0, 0}, {0x80e4, 0xfc, 0, 0}, {0x80e5, 0x08, 0, 0}, {0x80e6,0xe6, 0, 0}, {0x80e7, 0xfd, 0, 0}, {0x80e8, 0x78, 0, 0}, {0x80e9,0xaf, 0, 0}, {0x80ea, 0xe6, 0, 0}, {0x80eb, 0x25, 0, 0}, {0x80ec,0xe0, 0, 0}, {0x80ed, 0x24, 0, 0}, {0x80ee, 0x41, 0, 0}, {0x80ef,0xf8, 0, 0}, {0x80f0, 0xa6, 0, 0}, {0x80f1, 0x04, 0, 0}, {0x80f2,0x08, 0, 0}, {0x80f3, 0xa6, 0, 0}, {0x80f4, 0x05, 0, 0}, {0x80f5,0xef, 0, 0}, {0x80f6, 0x12, 0, 0}, {0x80f7, 0x0a, 0, 0}, {0x80f8,0x51, 0, 0}, {0x80f9, 0xd3, 0, 0}, {0x80fa, 0x78, 0, 0}, {0x80fb,0xaa, 0, 0}, {0x80fc, 0x96, 0, 0}, {0x80fd, 0xee, 0, 0}, {0x80fe,0x18, 0, 0}, {0x80ff, 0x96, 0, 0}, {0x8100, 0x40, 0, 0}, {0x8101,0x0d, 0, 0}, {0x8102, 0x78, 0, 0}, {0x8103, 0xaf, 0, 0}, {0x8104,0xe6, 0, 0}, {0x8105, 0x78, 0, 0}, {0x8106, 0xac, 0, 0}, {0x8107,0xf6, 0, 0}, {0x8108, 0x78, 0, 0}, {0x8109, 0xa9, 0, 0}, {0x810a,0xa6, 0, 0}, {0x810b, 0x06, 0, 0}, {0x810c, 0x08, 0, 0}, {0x810d,0xa6, 0, 0}, {0x810e, 0x07, 0, 0}, {0x810f, 0x90, 0, 0}, {0x8110,0x0e, 0, 0}, {0x8111, 0x85, 0, 0}, {0x8112, 0xe4, 0, 0}, {0x8113,0x93, 0, 0}, {0x8114, 0x12, 0, 0}, {0x8115, 0x0a, 0, 0}, {0x8116,0x51, 0, 0}, {0x8117, 0xc3, 0, 0}, {0x8118, 0x78, 0, 0}, {0x8119,0xb5, 0, 0}, {0x811a, 0x96, 0, 0}, {0x811b, 0xee, 0, 0}, {0x811c,0x18, 0, 0}, {0x811d, 0x96, 0, 0}, {0x811e, 0x50, 0, 0}, {0x811f,0x0d, 0, 0}, {0x8120, 0x78, 0, 0}, {0x8121, 0xaf, 0, 0}, {0x8122,0xe6, 0, 0}, {0x8123, 0x78, 0, 0}, {0x8124, 0xad, 0, 0}, {0x8125,0xf6, 0, 0}, {0x8126, 0x78, 0, 0}, {0x8127, 0xb4, 0, 0}, {0x8128,0xa6, 0, 0}, {0x8129, 0x06, 0, 0}, {0x812a, 0x08, 0, 0}, {0x812b,0xa6, 0, 0}, {0x812c, 0x07, 0, 0}, {0x812d, 0x78, 0, 0}, {0x812e,0xa9, 0, 0}, {0x812f, 0xe6, 0, 0}, {0x8130, 0xfe, 0, 0}, {0x8131,0x08, 0, 0}, {0x8132, 0xe6, 0, 0}, {0x8133, 0xc3, 0, 0}, {0x8134,0x78, 0, 0}, {0x8135, 0xb5, 0, 0}, {0x8136, 0x96, 0, 0}, {0x8137,0xff, 0, 0}, {0x8138, 0xee, 0, 0}, {0x8139, 0x18, 0, 0}, {0x813a,0x96, 0, 0}, {0x813b, 0x78, 0, 0}, {0x813c, 0xb6, 0, 0}, {0x813d,0xf6, 0, 0}, {0x813e, 0x08, 0, 0}, {0x813f, 0xa6, 0, 0}, {0x8140,0x07, 0, 0}, {0x8141, 0x90, 0, 0}, {0x8142, 0x0e, 0, 0}, {0x8143,0x8a, 0, 0}, {0x8144, 0xe4, 0, 0}, {0x8145, 0x18, 0, 0}, {0x8146,0x12, 0, 0}, {0x8147, 0x0a, 0, 0}, {0x8148, 0x2f, 0, 0}, {0x8149,0x40, 0, 0}, {0x814a, 0x02, 0, 0}, {0x814b, 0xd2, 0, 0}, {0x814c,0x36, 0, 0}, {0x814d, 0x78, 0, 0}, {0x814e, 0xaf, 0, 0}, {0x814f,0xe6, 0, 0}, {0x8150, 0x08, 0, 0}, {0x8151, 0x26, 0, 0}, {0x8152,0x08, 0, 0}, {0x8153, 0xf6, 0, 0}, {0x8154, 0xe5, 0, 0}, {0x8155,0x40, 0, 0}, {0x8156, 0x64, 0, 0}, {0x8157, 0x01, 0, 0}, {0x8158,0x70, 0, 0}, {0x8159, 0x55, 0, 0}, {0x815a, 0xe6, 0, 0}, {0x815b,0xc3, 0, 0}, {0x815c, 0x78, 0, 0}, {0x815d, 0xb3, 0, 0}, {0x815e,0x12, 0, 0}, {0x815f, 0x0a, 0, 0}, {0x8160, 0x25, 0, 0}, {0x8161,0x40, 0, 0}, {0x8162, 0x10, 0, 0}, {0x8163, 0x12, 0, 0}, {0x8164,0x0a, 0, 0}, {0x8165, 0x20, 0, 0}, {0x8166, 0x50, 0, 0}, {0x8167,0x0b, 0, 0}, {0x8168, 0x30, 0, 0}, {0x8169, 0x36, 0, 0}, {0x816a,0x41, 0, 0}, {0x816b, 0x78, 0, 0}, {0x816c, 0xaf, 0, 0}, {0x816d,0xe6, 0, 0}, {0x816e, 0x78, 0, 0}, {0x816f, 0xac, 0, 0}, {0x8170,0x66, 0, 0}, {0x8171, 0x60, 0, 0}, {0x8172, 0x39, 0, 0}, {0x8173,0x12, 0, 0}, {0x8174, 0x0a, 0, 0}, {0x8175, 0x48, 0, 0}, {0x8176,0x40, 0, 0}, {0x8177, 0x04, 0, 0}, {0x8178, 0x7f, 0, 0}, {0x8179,0xfe, 0, 0}, {0x817a, 0x80, 0, 0}, {0x817b, 0x02, 0, 0}, {0x817c,0x7f, 0, 0}, {0x817d, 0x02, 0, 0}, {0x817e, 0x78, 0, 0}, {0x817f,0xb0, 0, 0}, {0x8180, 0xa6, 0, 0}, {0x8181, 0x07, 0, 0}, {0x8182,0x78, 0, 0}, {0x8183, 0xac, 0, 0}, {0x8184, 0xe6, 0, 0}, {0x8185,0x24, 0, 0}, {0x8186, 0x03, 0, 0}, {0x8187, 0x78, 0, 0}, {0x8188,0xb2, 0, 0}, {0x8189, 0xf6, 0, 0}, {0x818a, 0x78, 0, 0}, {0x818b,0xac, 0, 0}, {0x818c, 0xe6, 0, 0}, {0x818d, 0x24, 0, 0}, {0x818e,0xfd, 0, 0}, {0x818f, 0x78, 0, 0}, {0x8190, 0xb3, 0, 0}, {0x8191,0xf6, 0, 0}, {0x8192, 0x12, 0, 0}, {0x8193, 0x0a, 0, 0}, {0x8194,0x48, 0, 0}, {0x8195, 0x40, 0, 0}, {0x8196, 0x06, 0, 0}, {0x8197,0x78, 0, 0}, {0x8198, 0xb3, 0, 0}, {0x8199, 0xe6, 0, 0}, {0x819a,0xff, 0, 0}, {0x819b, 0x80, 0, 0}, {0x819c, 0x04, 0, 0}, {0x819d,0x78, 0, 0}, {0x819e, 0xb2, 0, 0}, {0x819f, 0xe6, 0, 0}, {0x81a0,0xff, 0, 0}, {0x81a1, 0x78, 0, 0}, {0x81a2, 0xb1, 0, 0}, {0x81a3,0xa6, 0, 0}, {0x81a4, 0x07, 0, 0}, {0x81a5, 0x75, 0, 0}, {0x81a6,0x40, 0, 0}, {0x81a7, 0x02, 0, 0}, {0x81a8, 0x78, 0, 0}, {0x81a9,0xab, 0, 0}, {0x81aa, 0x76, 0, 0}, {0x81ab, 0x01, 0, 0}, {0x81ac,0x02, 0, 0}, {0x81ad, 0x02, 0, 0}, {0x81ae, 0x6e, 0, 0}, {0x81af,0xe5, 0, 0}, {0x81b0, 0x40, 0, 0}, {0x81b1, 0x64, 0, 0}, {0x81b2,0x02, 0, 0}, {0x81b3, 0x60, 0, 0}, {0x81b4, 0x03, 0, 0}, {0x81b5,0x02, 0, 0}, {0x81b6, 0x02, 0, 0}, {0x81b7, 0x4e, 0, 0}, {0x81b8,0x78, 0, 0}, {0x81b9, 0xb1, 0, 0}, {0x81ba, 0xe6, 0, 0}, {0x81bb,0xff, 0, 0}, {0x81bc, 0xc3, 0, 0}, {0x81bd, 0x78, 0, 0}, {0x81be,0xb3, 0, 0}, {0x81bf, 0x12, 0, 0}, {0x81c0, 0x0a, 0, 0}, {0x81c1,0x26, 0, 0}, {0x81c2, 0x40, 0, 0}, {0x81c3, 0x08, 0, 0}, {0x81c4,0x12, 0, 0}, {0x81c5, 0x0a, 0, 0}, {0x81c6, 0x20, 0, 0}, {0x81c7,0x50, 0, 0}, {0x81c8, 0x03, 0, 0}, {0x81c9, 0x02, 0, 0}, {0x81ca,0x02, 0, 0}, {0x81cb, 0x4c, 0, 0}, {0x81cc, 0x12, 0, 0}, {0x81cd,0x0a, 0, 0}, {0x81ce, 0x48, 0, 0}, {0x81cf, 0x40, 0, 0}, {0x81d0,0x04, 0, 0}, {0x81d1, 0x7f, 0, 0}, {0x81d2, 0xff, 0, 0}, {0x81d3,0x80, 0, 0}, {0x81d4, 0x02, 0, 0}, {0x81d5, 0x7f, 0, 0}, {0x81d6,0x01, 0, 0}, {0x81d7, 0x78, 0, 0}, {0x81d8, 0xb0, 0, 0}, {0x81d9,0xa6, 0, 0}, {0x81da, 0x07, 0, 0}, {0x81db, 0x78, 0, 0}, {0x81dc,0xac, 0, 0}, {0x81dd, 0xe6, 0, 0}, {0x81de, 0x04, 0, 0}, {0x81df,0x78, 0, 0}, {0x81e0, 0xb2, 0, 0}, {0x81e1, 0xf6, 0, 0}, {0x81e2,0x78, 0, 0}, {0x81e3, 0xac, 0, 0}, {0x81e4, 0xe6, 0, 0}, {0x81e5,0x14, 0, 0}, {0x81e6, 0x78, 0, 0}, {0x81e7, 0xb3, 0, 0}, {0x81e8,0xf6, 0, 0}, {0x81e9, 0x18, 0, 0}, {0x81ea, 0x12, 0, 0}, {0x81eb,0x0a, 0, 0}, {0x81ec, 0x4a, 0, 0}, {0x81ed, 0x40, 0, 0}, {0x81ee,0x04, 0, 0}, {0x81ef, 0xe6, 0, 0}, {0x81f0, 0xff, 0, 0}, {0x81f1,0x80, 0, 0}, {0x81f2, 0x02, 0, 0}, {0x81f3, 0x7f, 0, 0}, {0x81f4,0x00, 0, 0}, {0x81f5, 0x78, 0, 0}, {0x81f6, 0xb2, 0, 0}, {0x81f7,0xa6, 0, 0}, {0x81f8, 0x07, 0, 0}, {0x81f9, 0xd3, 0, 0}, {0x81fa,0x08, 0, 0}, {0x81fb, 0xe6, 0, 0}, {0x81fc, 0x64, 0, 0}, {0x81fd,0x80, 0, 0}, {0x81fe, 0x94, 0, 0}, {0x81ff, 0x80, 0, 0}, {0x8200,0x40, 0, 0}, {0x8201, 0x04, 0, 0}, {0x8202, 0xe6, 0, 0}, {0x8203,0xff, 0, 0}, {0x8204, 0x80, 0, 0}, {0x8205, 0x02, 0, 0}, {0x8206,0x7f, 0, 0}, {0x8207, 0x00, 0, 0}, {0x8208, 0x78, 0, 0}, {0x8209,0xb3, 0, 0}, {0x820a, 0xa6, 0, 0}, {0x820b, 0x07, 0, 0}, {0x820c,0xc3, 0, 0}, {0x820d, 0x18, 0, 0}, {0x820e, 0xe6, 0, 0}, {0x820f,0x64, 0, 0}, {0x8210, 0x80, 0, 0}, {0x8211, 0x94, 0, 0}, {0x8212,0xb3, 0, 0}, {0x8213, 0x50, 0, 0}, {0x8214, 0x04, 0, 0}, {0x8215,0xe6, 0, 0}, {0x8216, 0xff, 0, 0}, {0x8217, 0x80, 0, 0}, {0x8218,0x02, 0, 0}, {0x8219, 0x7f, 0, 0}, {0x821a, 0x33, 0, 0}, {0x821b,0x78, 0, 0}, {0x821c, 0xb2, 0, 0}, {0x821d, 0xa6, 0, 0}, {0x821e,0x07, 0, 0}, {0x821f, 0xc3, 0, 0}, {0x8220, 0x08, 0, 0}, {0x8221,0xe6, 0, 0}, {0x8222, 0x64, 0, 0}, {0x8223, 0x80, 0, 0}, {0x8224,0x94, 0, 0}, {0x8225, 0xb3, 0, 0}, {0x8226, 0x50, 0, 0}, {0x8227,0x04, 0, 0}, {0x8228, 0xe6, 0, 0}, {0x8229, 0xff, 0, 0}, {0x822a,0x80, 0, 0}, {0x822b, 0x02, 0, 0}, {0x822c, 0x7f, 0, 0}, {0x822d,0x33, 0, 0}, {0x822e, 0x78, 0, 0}, {0x822f, 0xb3, 0, 0}, {0x8230,0xa6, 0, 0}, {0x8231, 0x07, 0, 0}, {0x8232, 0x12, 0, 0}, {0x8233,0x0a, 0, 0}, {0x8234, 0x48, 0, 0}, {0x8235, 0x40, 0, 0}, {0x8236,0x06, 0, 0}, {0x8237, 0x78, 0, 0}, {0x8238, 0xb3, 0, 0}, {0x8239,0xe6, 0, 0}, {0x823a, 0xff, 0, 0}, {0x823b, 0x80, 0, 0}, {0x823c,0x04, 0, 0}, {0x823d, 0x78, 0, 0}, {0x823e, 0xb2, 0, 0}, {0x823f,0xe6, 0, 0}, {0x8240, 0xff, 0, 0}, {0x8241, 0x78, 0, 0}, {0x8242,0xb1, 0, 0}, {0x8243, 0xa6, 0, 0}, {0x8244, 0x07, 0, 0}, {0x8245,0x75, 0, 0}, {0x8246, 0x40, 0, 0}, {0x8247, 0x03, 0, 0}, {0x8248,0x78, 0, 0}, {0x8249, 0xab, 0, 0}, {0x824a, 0x76, 0, 0}, {0x824b,0x01, 0, 0}, {0x824c, 0x80, 0, 0}, {0x824d, 0x20, 0, 0}, {0x824e,0xe5, 0, 0}, {0x824f, 0x40, 0, 0}, {0x8250, 0x64, 0, 0}, {0x8251,0x03, 0, 0}, {0x8252, 0x70, 0, 0}, {0x8253, 0x26, 0, 0}, {0x8254,0x78, 0, 0}, {0x8255, 0xb1, 0, 0}, {0x8256, 0xe6, 0, 0}, {0x8257,0xff, 0, 0}, {0x8258, 0xc3, 0, 0}, {0x8259, 0x78, 0, 0}, {0x825a,0xb3, 0, 0}, {0x825b, 0x12, 0, 0}, {0x825c, 0x0a, 0, 0}, {0x825d,0x26, 0, 0}, {0x825e, 0x40, 0, 0}, {0x825f, 0x05, 0, 0}, {0x8260,0x12, 0, 0}, {0x8261, 0x0a, 0, 0}, {0x8262, 0x20, 0, 0}, {0x8263,0x40, 0, 0}, {0x8264, 0x09, 0, 0}, {0x8265, 0x78, 0, 0}, {0x8266,0xac, 0, 0}, {0x8267, 0xe6, 0, 0}, {0x8268, 0x78, 0, 0}, {0x8269,0xb1, 0, 0}, {0x826a, 0xf6, 0, 0}, {0x826b, 0x75, 0, 0}, {0x826c,0x40, 0, 0}, {0x826d, 0x04, 0, 0}, {0x826e, 0x78, 0, 0}, {0x826f,0xb1, 0, 0}, {0x8270, 0xe6, 0, 0}, {0x8271, 0x75, 0, 0}, {0x8272,0xf0, 0, 0}, {0x8273, 0x05, 0, 0}, {0x8274, 0xa4, 0, 0}, {0x8275,0xf5, 0, 0}, {0x8276, 0x3e, 0, 0}, {0x8277, 0x02, 0, 0}, {0x8278,0x07, 0, 0}, {0x8279, 0xf1, 0, 0}, {0x827a, 0xe5, 0, 0}, {0x827b,0x40, 0, 0}, {0x827c, 0xb4, 0, 0}, {0x827d, 0x04, 0, 0}, {0x827e,0x1f, 0, 0}, {0x827f, 0x90, 0, 0}, {0x8280, 0x0e, 0, 0}, {0x8281,0x89, 0, 0}, {0x8282, 0xe4, 0, 0}, {0x8283, 0x78, 0, 0}, {0x8284,0xb6, 0, 0}, {0x8285, 0x12, 0, 0}, {0x8286, 0x0a, 0, 0}, {0x8287,0x2f, 0, 0}, {0x8288, 0x40, 0, 0}, {0x8289, 0x02, 0, 0}, {0x828a,0xd2, 0, 0}, {0x828b, 0x36, 0, 0}, {0x828c, 0x75, 0, 0}, {0x828d,0x40, 0, 0}, {0x828e, 0x05, 0, 0}, {0x828f, 0x75, 0, 0}, {0x8290,0x29, 0, 0}, {0x8291, 0xff, 0, 0}, {0x8292, 0x75, 0, 0}, {0x8293,0x2a, 0, 0}, {0x8294, 0x0e, 0, 0}, {0x8295, 0x75, 0, 0}, {0x8296,0x2b, 0, 0}, {0x8297, 0x59, 0, 0}, {0x8298, 0x75, 0, 0}, {0x8299,0x2c, 0, 0}, {0x829a, 0x01, 0, 0}, {0x829b, 0x12, 0, 0}, {0x829c,0x09, 0, 0}, {0x829d, 0xe0, 0, 0}, {0x829e, 0x22, 0, 0}, {0x829f,0xef, 0, 0}, {0x82a0, 0x8d, 0, 0}, {0x82a1, 0xf0, 0, 0}, {0x82a2,0xa4, 0, 0}, {0x82a3, 0xa8, 0, 0}, {0x82a4, 0xf0, 0, 0}, {0x82a5,0xcf, 0, 0}, {0x82a6, 0x8c, 0, 0}, {0x82a7, 0xf0, 0, 0}, {0x82a8,0xa4, 0, 0}, {0x82a9, 0x28, 0, 0}, {0x82aa, 0xce, 0, 0}, {0x82ab,0x8d, 0, 0}, {0x82ac, 0xf0, 0, 0}, {0x82ad, 0xa4, 0, 0}, {0x82ae,0x2e, 0, 0}, {0x82af, 0xfe, 0, 0}, {0x82b0, 0x22, 0, 0}, {0x82b1,0xbc, 0, 0}, {0x82b2, 0x00, 0, 0}, {0x82b3, 0x0b, 0, 0}, {0x82b4,0xbe, 0, 0}, {0x82b5, 0x00, 0, 0}, {0x82b6, 0x29, 0, 0}, {0x82b7,0xef, 0, 0}, {0x82b8, 0x8d, 0, 0}, {0x82b9, 0xf0, 0, 0}, {0x82ba,0x84, 0, 0}, {0x82bb, 0xff, 0, 0}, {0x82bc, 0xad, 0, 0}, {0x82bd,0xf0, 0, 0}, {0x82be, 0x22, 0, 0}, {0x82bf, 0xe4, 0, 0}, {0x82c0,0xcc, 0, 0}, {0x82c1, 0xf8, 0, 0}, {0x82c2, 0x75, 0, 0}, {0x82c3,0xf0, 0, 0}, {0x82c4, 0x08, 0, 0}, {0x82c5, 0xef, 0, 0}, {0x82c6,0x2f, 0, 0}, {0x82c7, 0xff, 0, 0}, {0x82c8, 0xee, 0, 0}, {0x82c9,0x33, 0, 0}, {0x82ca, 0xfe, 0, 0}, {0x82cb, 0xec, 0, 0}, {0x82cc,0x33, 0, 0}, {0x82cd, 0xfc, 0, 0}, {0x82ce, 0xee, 0, 0}, {0x82cf,0x9d, 0, 0}, {0x82d0, 0xec, 0, 0}, {0x82d1, 0x98, 0, 0}, {0x82d2,0x40, 0, 0}, {0x82d3, 0x05, 0, 0}, {0x82d4, 0xfc, 0, 0}, {0x82d5,0xee, 0, 0}, {0x82d6, 0x9d, 0, 0}, {0x82d7, 0xfe, 0, 0}, {0x82d8,0x0f, 0, 0}, {0x82d9, 0xd5, 0, 0}, {0x82da, 0xf0, 0, 0}, {0x82db,0xe9, 0, 0}, {0x82dc, 0xe4, 0, 0}, {0x82dd, 0xce, 0, 0}, {0x82de,0xfd, 0, 0}, {0x82df, 0x22, 0, 0}, {0x82e0, 0xed, 0, 0}, {0x82e1,0xf8, 0, 0}, {0x82e2, 0xf5, 0, 0}, {0x82e3, 0xf0, 0, 0}, {0x82e4,0xee, 0, 0}, {0x82e5, 0x84, 0, 0}, {0x82e6, 0x20, 0, 0}, {0x82e7,0xd2, 0, 0}, {0x82e8, 0x1c, 0, 0}, {0x82e9, 0xfe, 0, 0}, {0x82ea,0xad, 0, 0}, {0x82eb, 0xf0, 0, 0}, {0x82ec, 0x75, 0, 0}, {0x82ed,0xf0, 0, 0}, {0x82ee, 0x08, 0, 0}, {0x82ef, 0xef, 0, 0}, {0x82f0,0x2f, 0, 0}, {0x82f1, 0xff, 0, 0}, {0x82f2, 0xed, 0, 0}, {0x82f3,0x33, 0, 0}, {0x82f4, 0xfd, 0, 0}, {0x82f5, 0x40, 0, 0}, {0x82f6,0x07, 0, 0}, {0x82f7, 0x98, 0, 0}, {0x82f8, 0x50, 0, 0}, {0x82f9,0x06, 0, 0}, {0x82fa, 0xd5, 0, 0}, {0x82fb, 0xf0, 0, 0}, {0x82fc,0xf2, 0, 0}, {0x82fd, 0x22, 0, 0}, {0x82fe, 0xc3, 0, 0}, {0x82ff,0x98, 0, 0}, {0x8300, 0xfd, 0, 0}, {0x8301, 0x0f, 0, 0}, {0x8302,0xd5, 0, 0}, {0x8303, 0xf0, 0, 0}, {0x8304, 0xea, 0, 0}, {0x8305,0x22, 0, 0}, {0x8306, 0xe8, 0, 0}, {0x8307, 0x8f, 0, 0}, {0x8308,0xf0, 0, 0}, {0x8309, 0xa4, 0, 0}, {0x830a, 0xcc, 0, 0}, {0x830b,0x8b, 0, 0}, {0x830c, 0xf0, 0, 0}, {0x830d, 0xa4, 0, 0}, {0x830e,0x2c, 0, 0}, {0x830f, 0xfc, 0, 0}, {0x8310, 0xe9, 0, 0}, {0x8311,0x8e, 0, 0}, {0x8312, 0xf0, 0, 0}, {0x8313, 0xa4, 0, 0}, {0x8314,0x2c, 0, 0}, {0x8315, 0xfc, 0, 0}, {0x8316, 0x8a, 0, 0}, {0x8317,0xf0, 0, 0}, {0x8318, 0xed, 0, 0}, {0x8319, 0xa4, 0, 0}, {0x831a,0x2c, 0, 0}, {0x831b, 0xfc, 0, 0}, {0x831c, 0xea, 0, 0}, {0x831d,0x8e, 0, 0}, {0x831e, 0xf0, 0, 0}, {0x831f, 0xa4, 0, 0}, {0x8320,0xcd, 0, 0}, {0x8321, 0xa8, 0, 0}, {0x8322, 0xf0, 0, 0}, {0x8323,0x8b, 0, 0}, {0x8324, 0xf0, 0, 0}, {0x8325, 0xa4, 0, 0}, {0x8326,0x2d, 0, 0}, {0x8327, 0xcc, 0, 0}, {0x8328, 0x38, 0, 0}, {0x8329,0x25, 0, 0}, {0x832a, 0xf0, 0, 0}, {0x832b, 0xfd, 0, 0}, {0x832c,0xe9, 0, 0}, {0x832d, 0x8f, 0, 0}, {0x832e, 0xf0, 0, 0}, {0x832f,0xa4, 0, 0}, {0x8330, 0x2c, 0, 0}, {0x8331, 0xcd, 0, 0}, {0x8332,0x35, 0, 0}, {0x8333, 0xf0, 0, 0}, {0x8334, 0xfc, 0, 0}, {0x8335,0xeb, 0, 0}, {0x8336, 0x8e, 0, 0}, {0x8337, 0xf0, 0, 0}, {0x8338,0xa4, 0, 0}, {0x8339, 0xfe, 0, 0}, {0x833a, 0xa9, 0, 0}, {0x833b,0xf0, 0, 0}, {0x833c, 0xeb, 0, 0}, {0x833d, 0x8f, 0, 0}, {0x833e,0xf0, 0, 0}, {0x833f, 0xa4, 0, 0}, {0x8340, 0xcf, 0, 0}, {0x8341,0xc5, 0, 0}, {0x8342, 0xf0, 0, 0}, {0x8343, 0x2e, 0, 0}, {0x8344,0xcd, 0, 0}, {0x8345, 0x39, 0, 0}, {0x8346, 0xfe, 0, 0}, {0x8347,0xe4, 0, 0}, {0x8348, 0x3c, 0, 0}, {0x8349, 0xfc, 0, 0}, {0x834a,0xea, 0, 0}, {0x834b, 0xa4, 0, 0}, {0x834c, 0x2d, 0, 0}, {0x834d,0xce, 0, 0}, {0x834e, 0x35, 0, 0}, {0x834f, 0xf0, 0, 0}, {0x8350,0xfd, 0, 0}, {0x8351, 0xe4, 0, 0}, {0x8352, 0x3c, 0, 0}, {0x8353,0xfc, 0, 0}, {0x8354, 0x22, 0, 0}, {0x8355, 0x75, 0, 0}, {0x8356,0xf0, 0, 0}, {0x8357, 0x08, 0, 0}, {0x8358, 0x75, 0, 0}, {0x8359,0x82, 0, 0}, {0x835a, 0x00, 0, 0}, {0x835b, 0xef, 0, 0}, {0x835c,0x2f, 0, 0}, {0x835d, 0xff, 0, 0}, {0x835e, 0xee, 0, 0}, {0x835f,0x33, 0, 0}, {0x8360, 0xfe, 0, 0}, {0x8361, 0xcd, 0, 0}, {0x8362,0x33, 0, 0}, {0x8363, 0xcd, 0, 0}, {0x8364, 0xcc, 0, 0}, {0x8365,0x33, 0, 0}, {0x8366, 0xcc, 0, 0}, {0x8367, 0xc5, 0, 0}, {0x8368,0x82, 0, 0}, {0x8369, 0x33, 0, 0}, {0x836a, 0xc5, 0, 0}, {0x836b,0x82, 0, 0}, {0x836c, 0x9b, 0, 0}, {0x836d, 0xed, 0, 0}, {0x836e,0x9a, 0, 0}, {0x836f, 0xec, 0, 0}, {0x8370, 0x99, 0, 0}, {0x8371,0xe5, 0, 0}, {0x8372, 0x82, 0, 0}, {0x8373, 0x98, 0, 0}, {0x8374,0x40, 0, 0}, {0x8375, 0x0c, 0, 0}, {0x8376, 0xf5, 0, 0}, {0x8377,0x82, 0, 0}, {0x8378, 0xee, 0, 0}, {0x8379, 0x9b, 0, 0}, {0x837a,0xfe, 0, 0}, {0x837b, 0xed, 0, 0}, {0x837c, 0x9a, 0, 0}, {0x837d,0xfd, 0, 0}, {0x837e, 0xec, 0, 0}, {0x837f, 0x99, 0, 0}, {0x8380,0xfc, 0, 0}, {0x8381, 0x0f, 0, 0}, {0x8382, 0xd5, 0, 0}, {0x8383,0xf0, 0, 0}, {0x8384, 0xd6, 0, 0}, {0x8385, 0xe4, 0, 0}, {0x8386,0xce, 0, 0}, {0x8387, 0xfb, 0, 0}, {0x8388, 0xe4, 0, 0}, {0x8389,0xcd, 0, 0}, {0x838a, 0xfa, 0, 0}, {0x838b, 0xe4, 0, 0}, {0x838c,0xcc, 0, 0}, {0x838d, 0xf9, 0, 0}, {0x838e, 0xa8, 0, 0}, {0x838f,0x82, 0, 0}, {0x8390, 0x22, 0, 0}, {0x8391, 0xb8, 0, 0}, {0x8392,0x00, 0, 0}, {0x8393, 0xc1, 0, 0}, {0x8394, 0xb9, 0, 0}, {0x8395,0x00, 0, 0}, {0x8396, 0x59, 0, 0}, {0x8397, 0xba, 0, 0}, {0x8398,0x00, 0, 0}, {0x8399, 0x2d, 0, 0}, {0x839a, 0xec, 0, 0}, {0x839b,0x8b, 0, 0}, {0x839c, 0xf0, 0, 0}, {0x839d, 0x84, 0, 0}, {0x839e,0xcf, 0, 0}, {0x839f, 0xce, 0, 0}, {0x83a0, 0xcd, 0, 0}, {0x83a1,0xfc, 0, 0}, {0x83a2, 0xe5, 0, 0}, {0x83a3, 0xf0, 0, 0}, {0x83a4,0xcb, 0, 0}, {0x83a5, 0xf9, 0, 0}, {0x83a6, 0x78, 0, 0}, {0x83a7,0x18, 0, 0}, {0x83a8, 0xef, 0, 0}, {0x83a9, 0x2f, 0, 0}, {0x83aa,0xff, 0, 0}, {0x83ab, 0xee, 0, 0}, {0x83ac, 0x33, 0, 0}, {0x83ad,0xfe, 0, 0}, {0x83ae, 0xed, 0, 0}, {0x83af, 0x33, 0, 0}, {0x83b0,0xfd, 0, 0}, {0x83b1, 0xec, 0, 0}, {0x83b2, 0x33, 0, 0}, {0x83b3,0xfc, 0, 0}, {0x83b4, 0xeb, 0, 0}, {0x83b5, 0x33, 0, 0}, {0x83b6,0xfb, 0, 0}, {0x83b7, 0x10, 0, 0}, {0x83b8, 0xd7, 0, 0}, {0x83b9,0x03, 0, 0}, {0x83ba, 0x99, 0, 0}, {0x83bb, 0x40, 0, 0}, {0x83bc,0x04, 0, 0}, {0x83bd, 0xeb, 0, 0}, {0x83be, 0x99, 0, 0}, {0x83bf,0xfb, 0, 0}, {0x83c0, 0x0f, 0, 0}, {0x83c1, 0xd8, 0, 0}, {0x83c2,0xe5, 0, 0}, {0x83c3, 0xe4, 0, 0}, {0x83c4, 0xf9, 0, 0}, {0x83c5,0xfa, 0, 0}, {0x83c6, 0x22, 0, 0}, {0x83c7, 0x78, 0, 0}, {0x83c8,0x18, 0, 0}, {0x83c9, 0xef, 0, 0}, {0x83ca, 0x2f, 0, 0}, {0x83cb,0xff, 0, 0}, {0x83cc, 0xee, 0, 0}, {0x83cd, 0x33, 0, 0}, {0x83ce,0xfe, 0, 0}, {0x83cf, 0xed, 0, 0}, {0x83d0, 0x33, 0, 0}, {0x83d1,0xfd, 0, 0}, {0x83d2, 0xec, 0, 0}, {0x83d3, 0x33, 0, 0}, {0x83d4,0xfc, 0, 0}, {0x83d5, 0xc9, 0, 0}, {0x83d6, 0x33, 0, 0}, {0x83d7,0xc9, 0, 0}, {0x83d8, 0x10, 0, 0}, {0x83d9, 0xd7, 0, 0}, {0x83da,0x05, 0, 0}, {0x83db, 0x9b, 0, 0}, {0x83dc, 0xe9, 0, 0}, {0x83dd,0x9a, 0, 0}, {0x83de, 0x40, 0, 0}, {0x83df, 0x07, 0, 0}, {0x83e0,0xec, 0, 0}, {0x83e1, 0x9b, 0, 0}, {0x83e2, 0xfc, 0, 0}, {0x83e3,0xe9, 0, 0}, {0x83e4, 0x9a, 0, 0}, {0x83e5, 0xf9, 0, 0}, {0x83e6,0x0f, 0, 0}, {0x83e7, 0xd8, 0, 0}, {0x83e8, 0xe0, 0, 0}, {0x83e9,0xe4, 0, 0}, {0x83ea, 0xc9, 0, 0}, {0x83eb, 0xfa, 0, 0}, {0x83ec,0xe4, 0, 0}, {0x83ed, 0xcc, 0, 0}, {0x83ee, 0xfb, 0, 0}, {0x83ef,0x22, 0, 0}, {0x83f0, 0x75, 0, 0}, {0x83f1, 0xf0, 0, 0}, {0x83f2,0x10, 0, 0}, {0x83f3, 0xef, 0, 0}, {0x83f4, 0x2f, 0, 0}, {0x83f5,0xff, 0, 0}, {0x83f6, 0xee, 0, 0}, {0x83f7, 0x33, 0, 0}, {0x83f8,0xfe, 0, 0}, {0x83f9, 0xed, 0, 0}, {0x83fa, 0x33, 0, 0}, {0x83fb,0xfd, 0, 0}, {0x83fc, 0xcc, 0, 0}, {0x83fd, 0x33, 0, 0}, {0x83fe,0xcc, 0, 0}, {0x83ff, 0xc8, 0, 0}, {0x8400, 0x33, 0, 0}, {0x8401,0xc8, 0, 0}, {0x8402, 0x10, 0, 0}, {0x8403, 0xd7, 0, 0}, {0x8404,0x07, 0, 0}, {0x8405, 0x9b, 0, 0}, {0x8406, 0xec, 0, 0}, {0x8407,0x9a, 0, 0}, {0x8408, 0xe8, 0, 0}, {0x8409, 0x99, 0, 0}, {0x840a,0x40, 0, 0}, {0x840b, 0x0a, 0, 0}, {0x840c, 0xed, 0, 0}, {0x840d,0x9b, 0, 0}, {0x840e, 0xfd, 0, 0}, {0x840f, 0xec, 0, 0}, {0x8410,0x9a, 0, 0}, {0x8411, 0xfc, 0, 0}, {0x8412, 0xe8, 0, 0}, {0x8413,0x99, 0, 0}, {0x8414, 0xf8, 0, 0}, {0x8415, 0x0f, 0, 0}, {0x8416,0xd5, 0, 0}, {0x8417, 0xf0, 0, 0}, {0x8418, 0xda, 0, 0}, {0x8419,0xe4, 0, 0}, {0x841a, 0xcd, 0, 0}, {0x841b, 0xfb, 0, 0}, {0x841c,0xe4, 0, 0}, {0x841d, 0xcc, 0, 0}, {0x841e, 0xfa, 0, 0}, {0x841f,0xe4, 0, 0}, {0x8420, 0xc8, 0, 0}, {0x8421, 0xf9, 0, 0}, {0x8422,0x22, 0, 0}, {0x8423, 0xeb, 0, 0}, {0x8424, 0x9f, 0, 0}, {0x8425,0xf5, 0, 0}, {0x8426, 0xf0, 0, 0}, {0x8427, 0xea, 0, 0}, {0x8428,0x9e, 0, 0}, {0x8429, 0x42, 0, 0}, {0x842a, 0xf0, 0, 0}, {0x842b,0xe9, 0, 0}, {0x842c, 0x9d, 0, 0}, {0x842d, 0x42, 0, 0}, {0x842e,0xf0, 0, 0}, {0x842f, 0xe8, 0, 0}, {0x8430, 0x9c, 0, 0}, {0x8431,0x45, 0, 0}, {0x8432, 0xf0, 0, 0}, {0x8433, 0x22, 0, 0}, {0x8434,0xe8, 0, 0}, {0x8435, 0x60, 0, 0}, {0x8436, 0x0f, 0, 0}, {0x8437,0xef, 0, 0}, {0x8438, 0xc3, 0, 0}, {0x8439, 0x33, 0, 0}, {0x843a,0xff, 0, 0}, {0x843b, 0xee, 0, 0}, {0x843c, 0x33, 0, 0}, {0x843d,0xfe, 0, 0}, {0x843e, 0xed, 0, 0}, {0x843f, 0x33, 0, 0}, {0x8440,0xfd, 0, 0}, {0x8441, 0xec, 0, 0}, {0x8442, 0x33, 0, 0}, {0x8443,0xfc, 0, 0}, {0x8444, 0xd8, 0, 0}, {0x8445, 0xf1, 0, 0}, {0x8446,0x22, 0, 0}, {0x8447, 0xe4, 0, 0}, {0x8448, 0x93, 0, 0}, {0x8449,0xfc, 0, 0}, {0x844a, 0x74, 0, 0}, {0x844b, 0x01, 0, 0}, {0x844c,0x93, 0, 0}, {0x844d, 0xfd, 0, 0}, {0x844e, 0x74, 0, 0}, {0x844f,0x02, 0, 0}, {0x8450, 0x93, 0, 0}, {0x8451, 0xfe, 0, 0}, {0x8452,0x74, 0, 0}, {0x8453, 0x03, 0, 0}, {0x8454, 0x93, 0, 0}, {0x8455,0xff, 0, 0}, {0x8456, 0x22, 0, 0}, {0x8457, 0xe6, 0, 0}, {0x8458,0xfb, 0, 0}, {0x8459, 0x08, 0, 0}, {0x845a, 0xe6, 0, 0}, {0x845b,0xf9, 0, 0}, {0x845c, 0x08, 0, 0}, {0x845d, 0xe6, 0, 0}, {0x845e,0xfa, 0, 0}, {0x845f, 0x08, 0, 0}, {0x8460, 0xe6, 0, 0}, {0x8461,0xcb, 0, 0}, {0x8462, 0xf8, 0, 0}, {0x8463, 0x22, 0, 0}, {0x8464,0xec, 0, 0}, {0x8465, 0xf6, 0, 0}, {0x8466, 0x08, 0, 0}, {0x8467,0xed, 0, 0}, {0x8468, 0xf6, 0, 0}, {0x8469, 0x08, 0, 0}, {0x846a,0xee, 0, 0}, {0x846b, 0xf6, 0, 0}, {0x846c, 0x08, 0, 0}, {0x846d,0xef, 0, 0}, {0x846e, 0xf6, 0, 0}, {0x846f, 0x22, 0, 0}, {0x8470,0xa4, 0, 0}, {0x8471, 0x25, 0, 0}, {0x8472, 0x82, 0, 0}, {0x8473,0xf5, 0, 0}, {0x8474, 0x82, 0, 0}, {0x8475, 0xe5, 0, 0}, {0x8476,0xf0, 0, 0}, {0x8477, 0x35, 0, 0}, {0x8478, 0x83, 0, 0}, {0x8479,0xf5, 0, 0}, {0x847a, 0x83, 0, 0}, {0x847b, 0x22, 0, 0}, {0x847c,0xd0, 0, 0}, {0x847d, 0x83, 0, 0}, {0x847e, 0xd0, 0, 0}, {0x847f,0x82, 0, 0}, {0x8480, 0xf8, 0, 0}, {0x8481, 0xe4, 0, 0}, {0x8482,0x93, 0, 0}, {0x8483, 0x70, 0, 0}, {0x8484, 0x12, 0, 0}, {0x8485,0x74, 0, 0}, {0x8486, 0x01, 0, 0}, {0x8487, 0x93, 0, 0}, {0x8488,0x70, 0, 0}, {0x8489, 0x0d, 0, 0}, {0x848a, 0xa3, 0, 0}, {0x848b,0xa3, 0, 0}, {0x848c, 0x93, 0, 0}, {0x848d, 0xf8, 0, 0}, {0x848e,0x74, 0, 0}, {0x848f, 0x01, 0, 0}, {0x8490, 0x93, 0, 0}, {0x8491,0xf5, 0, 0}, {0x8492, 0x82, 0, 0}, {0x8493, 0x88, 0, 0}, {0x8494,0x83, 0, 0}, {0x8495, 0xe4, 0, 0}, {0x8496, 0x73, 0, 0}, {0x8497,0x74, 0, 0}, {0x8498, 0x02, 0, 0}, {0x8499, 0x93, 0, 0}, {0x849a,0x68, 0, 0}, {0x849b, 0x60, 0, 0}, {0x849c, 0xef, 0, 0}, {0x849d,0xa3, 0, 0}, {0x849e, 0xa3, 0, 0}, {0x849f, 0xa3, 0, 0}, {0x84a0,0x80, 0, 0}, {0x84a1, 0xdf, 0, 0}, {0x84a2, 0x90, 0, 0}, {0x84a3,0x38, 0, 0}, {0x84a4, 0x04, 0, 0}, {0x84a5, 0x78, 0, 0}, {0x84a6,0x45, 0, 0}, {0x84a7, 0x12, 0, 0}, {0x84a8, 0x08, 0, 0}, {0x84a9,0xe6, 0, 0}, {0x84aa, 0x90, 0, 0}, {0x84ab, 0x38, 0, 0}, {0x84ac,0x00, 0, 0}, {0x84ad, 0xe0, 0, 0}, {0x84ae, 0xfe, 0, 0}, {0x84af,0xa3, 0, 0}, {0x84b0, 0xe0, 0, 0}, {0x84b1, 0xfd, 0, 0}, {0x84b2,0xed, 0, 0}, {0x84b3, 0xff, 0, 0}, {0x84b4, 0xc3, 0, 0}, {0x84b5,0x12, 0, 0}, {0x84b6, 0x08, 0, 0}, {0x84b7, 0x9f, 0, 0}, {0x84b8,0x90, 0, 0}, {0x84b9, 0x38, 0, 0}, {0x84ba, 0x10, 0, 0}, {0x84bb,0x12, 0, 0}, {0x84bc, 0x08, 0, 0}, {0x84bd, 0x93, 0, 0}, {0x84be,0x90, 0, 0}, {0x84bf, 0x38, 0, 0}, {0x84c0, 0x06, 0, 0}, {0x84c1,0x78, 0, 0}, {0x84c2, 0x47, 0, 0}, {0x84c3, 0x12, 0, 0}, {0x84c4,0x08, 0, 0}, {0x84c5, 0xe6, 0, 0}, {0x84c6, 0x90, 0, 0}, {0x84c7,0x38, 0, 0}, {0x84c8, 0x02, 0, 0}, {0x84c9, 0xe0, 0, 0}, {0x84ca,0xfe, 0, 0}, {0x84cb, 0xa3, 0, 0}, {0x84cc, 0xe0, 0, 0}, {0x84cd,0xfd, 0, 0}, {0x84ce, 0xed, 0, 0}, {0x84cf, 0xff, 0, 0}, {0x84d0,0xc3, 0, 0}, {0x84d1, 0x12, 0, 0}, {0x84d2, 0x08, 0, 0}, {0x84d3,0x9f, 0, 0}, {0x84d4, 0x90, 0, 0}, {0x84d5, 0x38, 0, 0}, {0x84d6,0x12, 0, 0}, {0x84d7, 0x12, 0, 0}, {0x84d8, 0x08, 0, 0}, {0x84d9,0x93, 0, 0}, {0x84da, 0xa3, 0, 0}, {0x84db, 0xe0, 0, 0}, {0x84dc,0xb4, 0, 0}, {0x84dd, 0x31, 0, 0}, {0x84de, 0x07, 0, 0}, {0x84df,0x78, 0, 0}, {0x84e0, 0x45, 0, 0}, {0x84e1, 0x79, 0, 0}, {0x84e2,0x45, 0, 0}, {0x84e3, 0x12, 0, 0}, {0x84e4, 0x08, 0, 0}, {0x84e5,0xfc, 0, 0}, {0x84e6, 0x90, 0, 0}, {0x84e7, 0x38, 0, 0}, {0x84e8,0x14, 0, 0}, {0x84e9, 0xe0, 0, 0}, {0x84ea, 0xb4, 0, 0}, {0x84eb,0x71, 0, 0}, {0x84ec, 0x15, 0, 0}, {0x84ed, 0x78, 0, 0}, {0x84ee,0x45, 0, 0}, {0x84ef, 0xe6, 0, 0}, {0x84f0, 0xfe, 0, 0}, {0x84f1,0x08, 0, 0}, {0x84f2, 0xe6, 0, 0}, {0x84f3, 0x78, 0, 0}, {0x84f4,0x02, 0, 0}, {0x84f5, 0xce, 0, 0}, {0x84f6, 0xc3, 0, 0}, {0x84f7,0x13, 0, 0}, {0x84f8, 0xce, 0, 0}, {0x84f9, 0x13, 0, 0}, {0x84fa,0xd8, 0, 0}, {0x84fb, 0xf9, 0, 0}, {0x84fc, 0x79, 0, 0}, {0x84fd,0x46, 0, 0}, {0x84fe, 0xf7, 0, 0}, {0x84ff, 0xee, 0, 0}, {0x8500,0x19, 0, 0}, {0x8501, 0xf7, 0, 0}, {0x8502, 0x90, 0, 0}, {0x8503,0x38, 0, 0}, {0x8504, 0x15, 0, 0}, {0x8505, 0xe0, 0, 0}, {0x8506,0xb4, 0, 0}, {0x8507, 0x31, 0, 0}, {0x8508, 0x07, 0, 0}, {0x8509,0x78, 0, 0}, {0x850a, 0x47, 0, 0}, {0x850b, 0x79, 0, 0}, {0x850c,0x47, 0, 0}, {0x850d, 0x12, 0, 0}, {0x850e, 0x08, 0, 0}, {0x850f,0xfc, 0, 0}, {0x8510, 0x90, 0, 0}, {0x8511, 0x38, 0, 0}, {0x8512,0x15, 0, 0}, {0x8513, 0xe0, 0, 0}, {0x8514, 0xb4, 0, 0}, {0x8515,0x71, 0, 0}, {0x8516, 0x15, 0, 0}, {0x8517, 0x78, 0, 0}, {0x8518,0x47, 0, 0}, {0x8519, 0xe6, 0, 0}, {0x851a, 0xfe, 0, 0}, {0x851b,0x08, 0, 0}, {0x851c, 0xe6, 0, 0}, {0x851d, 0x78, 0, 0}, {0x851e,0x02, 0, 0}, {0x851f, 0xce, 0, 0}, {0x8520, 0xc3, 0, 0}, {0x8521,0x13, 0, 0}, {0x8522, 0xce, 0, 0}, {0x8523, 0x13, 0, 0}, {0x8524,0xd8, 0, 0}, {0x8525, 0xf9, 0, 0}, {0x8526, 0x79, 0, 0}, {0x8527,0x48, 0, 0}, {0x8528, 0xf7, 0, 0}, {0x8529, 0xee, 0, 0}, {0x852a,0x19, 0, 0}, {0x852b, 0xf7, 0, 0}, {0x852c, 0x79, 0, 0}, {0x852d,0x45, 0, 0}, {0x852e, 0x12, 0, 0}, {0x852f, 0x08, 0, 0}, {0x8530,0xce, 0, 0}, {0x8531, 0x09, 0, 0}, {0x8532, 0x12, 0, 0}, {0x8533,0x08, 0, 0}, {0x8534, 0xce, 0, 0}, {0x8535, 0xaf, 0, 0}, {0x8536,0x3a, 0, 0}, {0x8537, 0x12, 0, 0}, {0x8538, 0x08, 0, 0}, {0x8539,0x84, 0, 0}, {0x853a, 0x7d, 0, 0}, {0x853b, 0x50, 0, 0}, {0x853c,0x12, 0, 0}, {0x853d, 0x02, 0, 0}, {0x853e, 0xb1, 0, 0}, {0x853f,0x78, 0, 0}, {0x8540, 0x4d, 0, 0}, {0x8541, 0xa6, 0, 0}, {0x8542,0x06, 0, 0}, {0x8543, 0x08, 0, 0}, {0x8544, 0xa6, 0, 0}, {0x8545,0x07, 0, 0}, {0x8546, 0xaf, 0, 0}, {0x8547, 0x38, 0, 0}, {0x8548,0x12, 0, 0}, {0x8549, 0x08, 0, 0}, {0x854a, 0x84, 0, 0}, {0x854b,0x7d, 0, 0}, {0x854c, 0x50, 0, 0}, {0x854d, 0x12, 0, 0}, {0x854e,0x02, 0, 0}, {0x854f, 0xb1, 0, 0}, {0x8550, 0x78, 0, 0}, {0x8551,0x49, 0, 0}, {0x8552, 0xa6, 0, 0}, {0x8553, 0x06, 0, 0}, {0x8554,0x08, 0, 0}, {0x8555, 0xa6, 0, 0}, {0x8556, 0x07, 0, 0}, {0x8557,0xaf, 0, 0}, {0x8558, 0x3b, 0, 0}, {0x8559, 0x78, 0, 0}, {0x855a,0x47, 0, 0}, {0x855b, 0x12, 0, 0}, {0x855c, 0x08, 0, 0}, {0x855d,0x86, 0, 0}, {0x855e, 0x7d, 0, 0}, {0x855f, 0x3c, 0, 0}, {0x8560,0x12, 0, 0}, {0x8561, 0x02, 0, 0}, {0x8562, 0xb1, 0, 0}, {0x8563,0x78, 0, 0}, {0x8564, 0x4f, 0, 0}, {0x8565, 0xa6, 0, 0}, {0x8566,0x06, 0, 0}, {0x8567, 0x08, 0, 0}, {0x8568, 0xa6, 0, 0}, {0x8569,0x07, 0, 0}, {0x856a, 0xaf, 0, 0}, {0x856b, 0x39, 0, 0}, {0x856c,0x7e, 0, 0}, {0x856d, 0x00, 0, 0}, {0x856e, 0x78, 0, 0}, {0x856f,0x47, 0, 0}, {0x8570, 0x12, 0, 0}, {0x8571, 0x08, 0, 0}, {0x8572,0x88, 0, 0}, {0x8573, 0x7d, 0, 0}, {0x8574, 0x3c, 0, 0}, {0x8575,0x12, 0, 0}, {0x8576, 0x02, 0, 0}, {0x8577, 0xb1, 0, 0}, {0x8578,0x78, 0, 0}, {0x8579, 0x4b, 0, 0}, {0x857a, 0xa6, 0, 0}, {0x857b,0x06, 0, 0}, {0x857c, 0x08, 0, 0}, {0x857d, 0xa6, 0, 0}, {0x857e,0x07, 0, 0}, {0x857f, 0xc3, 0, 0}, {0x8580, 0x78, 0, 0}, {0x8581,0x4e, 0, 0}, {0x8582, 0xe6, 0, 0}, {0x8583, 0x94, 0, 0}, {0x8584,0x08, 0, 0}, {0x8585, 0x18, 0, 0}, {0x8586, 0xe6, 0, 0}, {0x8587,0x94, 0, 0}, {0x8588, 0x00, 0, 0}, {0x8589, 0x50, 0, 0}, {0x858a,0x05, 0, 0}, {0x858b, 0x76, 0, 0}, {0x858c, 0x00, 0, 0}, {0x858d,0x08, 0, 0}, {0x858e, 0x76, 0, 0}, {0x858f, 0x08, 0, 0}, {0x8590,0xc3, 0, 0}, {0x8591, 0x78, 0, 0}, {0x8592, 0x50, 0, 0}, {0x8593,0xe6, 0, 0}, {0x8594, 0x94, 0, 0}, {0x8595, 0x08, 0, 0}, {0x8596,0x18, 0, 0}, {0x8597, 0xe6, 0, 0}, {0x8598, 0x94, 0, 0}, {0x8599,0x00, 0, 0}, {0x859a, 0x50, 0, 0}, {0x859b, 0x05, 0, 0}, {0x859c,0x76, 0, 0}, {0x859d, 0x00, 0, 0}, {0x859e, 0x08, 0, 0}, {0x859f,0x76, 0, 0}, {0x85a0, 0x08, 0, 0}, {0x85a1, 0x78, 0, 0}, {0x85a2,0x4d, 0, 0}, {0x85a3, 0x12, 0, 0}, {0x85a4, 0x08, 0, 0}, {0x85a5,0xbb, 0, 0}, {0x85a6, 0xff, 0, 0}, {0x85a7, 0xd3, 0, 0}, {0x85a8,0x78, 0, 0}, {0x85a9, 0x4a, 0, 0}, {0x85aa, 0xe6, 0, 0}, {0x85ab,0x9f, 0, 0}, {0x85ac, 0x18, 0, 0}, {0x85ad, 0xe6, 0, 0}, {0x85ae,0x9e, 0, 0}, {0x85af, 0x40, 0, 0}, {0x85b0, 0x0e, 0, 0}, {0x85b1,0x78, 0, 0}, {0x85b2, 0x4d, 0, 0}, {0x85b3, 0xe6, 0, 0}, {0x85b4,0x13, 0, 0}, {0x85b5, 0xfe, 0, 0}, {0x85b6, 0x08, 0, 0}, {0x85b7,0xe6, 0, 0}, {0x85b8, 0x78, 0, 0}, {0x85b9, 0x4a, 0, 0}, {0x85ba,0x12, 0, 0}, {0x85bb, 0x08, 0, 0}, {0x85bc, 0xf1, 0, 0}, {0x85bd,0x80, 0, 0}, {0x85be, 0x04, 0, 0}, {0x85bf, 0x7e, 0, 0}, {0x85c0,0x00, 0, 0}, {0x85c1, 0x7f, 0, 0}, {0x85c2, 0x00, 0, 0}, {0x85c3,0x78, 0, 0}, {0x85c4, 0x51, 0, 0}, {0x85c5, 0x12, 0, 0}, {0x85c6,0x08, 0, 0}, {0x85c7, 0xb3, 0, 0}, {0x85c8, 0xff, 0, 0}, {0x85c9,0xd3, 0, 0}, {0x85ca, 0x78, 0, 0}, {0x85cb, 0x4c, 0, 0}, {0x85cc,0xe6, 0, 0}, {0x85cd, 0x9f, 0, 0}, {0x85ce, 0x18, 0, 0}, {0x85cf,0xe6, 0, 0}, {0x85d0, 0x9e, 0, 0}, {0x85d1, 0x40, 0, 0}, {0x85d2,0x0e, 0, 0}, {0x85d3, 0x78, 0, 0}, {0x85d4, 0x4f, 0, 0}, {0x85d5,0xe6, 0, 0}, {0x85d6, 0x13, 0, 0}, {0x85d7, 0xfe, 0, 0}, {0x85d8,0x08, 0, 0}, {0x85d9, 0xe6, 0, 0}, {0x85da, 0x78, 0, 0}, {0x85db,0x4c, 0, 0}, {0x85dc, 0x12, 0, 0}, {0x85dd, 0x08, 0, 0}, {0x85de,0xf1, 0, 0}, {0x85df, 0x80, 0, 0}, {0x85e0, 0x04, 0, 0}, {0x85e1,0x7e, 0, 0}, {0x85e2, 0x00, 0, 0}, {0x85e3, 0x7f, 0, 0}, {0x85e4,0x00, 0, 0}, {0x85e5, 0xe4, 0, 0}, {0x85e6, 0xfc, 0, 0}, {0x85e7,0xfd, 0, 0}, {0x85e8, 0x78, 0, 0}, {0x85e9, 0x55, 0, 0}, {0x85ea,0x12, 0, 0}, {0x85eb, 0x04, 0, 0}, {0x85ec, 0x64, 0, 0}, {0x85ed,0x78, 0, 0}, {0x85ee, 0x4d, 0, 0}, {0x85ef, 0x12, 0, 0}, {0x85f0,0x08, 0, 0}, {0x85f1, 0xbb, 0, 0}, {0x85f2, 0x78, 0, 0}, {0x85f3,0x4a, 0, 0}, {0x85f4, 0x26, 0, 0}, {0x85f5, 0xff, 0, 0}, {0x85f6,0xee, 0, 0}, {0x85f7, 0x18, 0, 0}, {0x85f8, 0x36, 0, 0}, {0x85f9,0xfe, 0, 0}, {0x85fa, 0x78, 0, 0}, {0x85fb, 0x59, 0, 0}, {0x85fc,0x12, 0, 0}, {0x85fd, 0x08, 0, 0}, {0x85fe, 0xb3, 0, 0}, {0x85ff,0x78, 0, 0}, {0x8600, 0x4c, 0, 0}, {0x8601, 0x26, 0, 0}, {0x8602,0xff, 0, 0}, {0x8603, 0xee, 0, 0}, {0x8604, 0x18, 0, 0}, {0x8605,0x36, 0, 0}, {0x8606, 0xfe, 0, 0}, {0x8607, 0xe4, 0, 0}, {0x8608,0xfc, 0, 0}, {0x8609, 0xfd, 0, 0}, {0x860a, 0x78, 0, 0}, {0x860b,0x5d, 0, 0}, {0x860c, 0x12, 0, 0}, {0x860d, 0x04, 0, 0}, {0x860e,0x64, 0, 0}, {0x860f, 0x12, 0, 0}, {0x8610, 0x08, 0, 0}, {0x8611,0xc3, 0, 0}, {0x8612, 0x78, 0, 0}, {0x8613, 0x59, 0, 0}, {0x8614,0x12, 0, 0}, {0x8615, 0x04, 0, 0}, {0x8616, 0x57, 0, 0}, {0x8617,0xd3, 0, 0}, {0x8618, 0x12, 0, 0}, {0x8619, 0x04, 0, 0}, {0x861a,0x23, 0, 0}, {0x861b, 0x40, 0, 0}, {0x861c, 0x08, 0, 0}, {0x861d,0x12, 0, 0}, {0x861e, 0x08, 0, 0}, {0x861f, 0xc3, 0, 0}, {0x8620,0x78, 0, 0}, {0x8621, 0x59, 0, 0}, {0x8622, 0x12, 0, 0}, {0x8623,0x04, 0, 0}, {0x8624, 0x64, 0, 0}, {0x8625, 0x78, 0, 0}, {0x8626,0x47, 0, 0}, {0x8627, 0x12, 0, 0}, {0x8628, 0x08, 0, 0}, {0x8629,0xc5, 0, 0}, {0x862a, 0x78, 0, 0}, {0x862b, 0x5d, 0, 0}, {0x862c,0x12, 0, 0}, {0x862d, 0x04, 0, 0}, {0x862e, 0x57, 0, 0}, {0x862f,0xd3, 0, 0}, {0x8630, 0x12, 0, 0}, {0x8631, 0x04, 0, 0}, {0x8632,0x23, 0, 0}, {0x8633, 0x40, 0, 0}, {0x8634, 0x0a, 0, 0}, {0x8635,0x78, 0, 0}, {0x8636, 0x47, 0, 0}, {0x8637, 0x12, 0, 0}, {0x8638,0x08, 0, 0}, {0x8639, 0xc5, 0, 0}, {0x863a, 0x78, 0, 0}, {0x863b,0x5d, 0, 0}, {0x863c, 0x12, 0, 0}, {0x863d, 0x04, 0, 0}, {0x863e,0x64, 0, 0}, {0x863f, 0xe4, 0, 0}, {0x8640, 0xfd, 0, 0}, {0x8641,0x78, 0, 0}, {0x8642, 0x54, 0, 0}, {0x8643, 0x12, 0, 0}, {0x8644,0x08, 0, 0}, {0x8645, 0xde, 0, 0}, {0x8646, 0x24, 0, 0}, {0x8647,0x01, 0, 0}, {0x8648, 0x12, 0, 0}, {0x8649, 0x08, 0, 0}, {0x864a,0xa7, 0, 0}, {0x864b, 0x78, 0, 0}, {0x864c, 0x58, 0, 0}, {0x864d,0x12, 0, 0}, {0x864e, 0x08, 0, 0}, {0x864f, 0xde, 0, 0}, {0x8650,0x24, 0, 0}, {0x8651, 0x02, 0, 0}, {0x8652, 0x12, 0, 0}, {0x8653,0x08, 0, 0}, {0x8654, 0xa7, 0, 0}, {0x8655, 0x78, 0, 0}, {0x8656,0x5c, 0, 0}, {0x8657, 0x12, 0, 0}, {0x8658, 0x08, 0, 0}, {0x8659,0xde, 0, 0}, {0x865a, 0x24, 0, 0}, {0x865b, 0x03, 0, 0}, {0x865c,0x12, 0, 0}, {0x865d, 0x08, 0, 0}, {0x865e, 0xa7, 0, 0}, {0x865f,0x78, 0, 0}, {0x8660, 0x60, 0, 0}, {0x8661, 0x12, 0, 0}, {0x8662,0x08, 0, 0}, {0x8663, 0xde, 0, 0}, {0x8664, 0x24, 0, 0}, {0x8665,0x04, 0, 0}, {0x8666, 0x12, 0, 0}, {0x8667, 0x08, 0, 0}, {0x8668,0xa7, 0, 0}, {0x8669, 0x0d, 0, 0}, {0x866a, 0xbd, 0, 0}, {0x866b,0x05, 0, 0}, {0x866c, 0xd4, 0, 0}, {0x866d, 0xc2, 0, 0}, {0x866e,0x0e, 0, 0}, {0x866f, 0xc2, 0, 0}, {0x8670, 0x06, 0, 0}, {0x8671,0x22, 0, 0}, {0x8672, 0x85, 0, 0}, {0x8673, 0x08, 0, 0}, {0x8674,0x36, 0, 0}, {0x8675, 0x90, 0, 0}, {0x8676, 0x30, 0, 0}, {0x8677,0x24, 0, 0}, {0x8678, 0xe0, 0, 0}, {0x8679, 0xf5, 0, 0}, {0x867a,0x32, 0, 0}, {0x867b, 0xa3, 0, 0}, {0x867c, 0xe0, 0, 0}, {0x867d,0xf5, 0, 0}, {0x867e, 0x33, 0, 0}, {0x867f, 0xa3, 0, 0}, {0x8680,0xe0, 0, 0}, {0x8681, 0xf5, 0, 0}, {0x8682, 0x34, 0, 0}, {0x8683,0xa3, 0, 0}, {0x8684, 0xe0, 0, 0}, {0x8685, 0xf5, 0, 0}, {0x8686,0x35, 0, 0}, {0x8687, 0xa3, 0, 0}, {0x8688, 0xe0, 0, 0}, {0x8689,0xf5, 0, 0}, {0x868a, 0x31, 0, 0}, {0x868b, 0xd2, 0, 0}, {0x868c,0x33, 0, 0}, {0x868d, 0xe5, 0, 0}, {0x868e, 0x36, 0, 0}, {0x868f,0x12, 0, 0}, {0x8690, 0x04, 0, 0}, {0x8691, 0x7c, 0, 0}, {0x8692,0x06, 0, 0}, {0x8693, 0xc0, 0, 0}, {0x8694, 0x03, 0, 0}, {0x8695,0x06, 0, 0}, {0x8696, 0xc4, 0, 0}, {0x8697, 0x04, 0, 0}, {0x8698,0x06, 0, 0}, {0x8699, 0xca, 0, 0}, {0x869a, 0x07, 0, 0}, {0x869b,0x06, 0, 0}, {0x869c, 0xd3, 0, 0}, {0x869d, 0x08, 0, 0}, {0x869e,0x06, 0, 0}, {0x869f, 0xe3, 0, 0}, {0x86a0, 0x80, 0, 0}, {0x86a1,0x06, 0, 0}, {0x86a2, 0xe6, 0, 0}, {0x86a3, 0x81, 0, 0}, {0x86a4,0x07, 0, 0}, {0x86a5, 0x41, 0, 0}, {0x86a6, 0x8f, 0, 0}, {0x86a7,0x07, 0, 0}, {0x86a8, 0x30, 0, 0}, {0x86a9, 0x90, 0, 0}, {0x86aa,0x07, 0, 0}, {0x86ab, 0x41, 0, 0}, {0x86ac, 0x91, 0, 0}, {0x86ad,0x07, 0, 0}, {0x86ae, 0x41, 0, 0}, {0x86af, 0x92, 0, 0}, {0x86b0,0x07, 0, 0}, {0x86b1, 0x41, 0, 0}, {0x86b2, 0x93, 0, 0}, {0x86b3,0x07, 0, 0}, {0x86b4, 0x41, 0, 0}, {0x86b5, 0x94, 0, 0}, {0x86b6,0x07, 0, 0}, {0x86b7, 0x41, 0, 0}, {0x86b8, 0x98, 0, 0}, {0x86b9,0x07, 0, 0}, {0x86ba, 0x3e, 0, 0}, {0x86bb, 0x9f, 0, 0}, {0x86bc,0x00, 0, 0}, {0x86bd, 0x00, 0, 0}, {0x86be, 0x07, 0, 0}, {0x86bf,0x5c, 0, 0}, {0x86c0, 0x12, 0, 0}, {0x86c1, 0x0a, 0, 0}, {0x86c2,0x8a, 0, 0}, {0x86c3, 0x22, 0, 0}, {0x86c4, 0x12, 0, 0}, {0x86c5,0x0a, 0, 0}, {0x86c6, 0x8a, 0, 0}, {0x86c7, 0xd2, 0, 0}, {0x86c8,0x03, 0, 0}, {0x86c9, 0x22, 0, 0}, {0x86ca, 0xa2, 0, 0}, {0x86cb,0x36, 0, 0}, {0x86cc, 0xe4, 0, 0}, {0x86cd, 0x33, 0, 0}, {0x86ce,0xf5, 0, 0}, {0x86cf, 0x31, 0, 0}, {0x86d0, 0x02, 0, 0}, {0x86d1,0x07, 0, 0}, {0x86d2, 0x41, 0, 0}, {0x86d3, 0xc2, 0, 0}, {0x86d4,0x01, 0, 0}, {0x86d5, 0xc2, 0, 0}, {0x86d6, 0x02, 0, 0}, {0x86d7,0xc2, 0, 0}, {0x86d8, 0x03, 0, 0}, {0x86d9, 0x12, 0, 0}, {0x86da,0x09, 0, 0}, {0x86db, 0x06, 0, 0}, {0x86dc, 0x75, 0, 0}, {0x86dd,0x3f, 0, 0}, {0x86de, 0x70, 0, 0}, {0x86df, 0xd2, 0, 0}, {0x86e0,0x34, 0, 0}, {0x86e1, 0x80, 0, 0}, {0x86e2, 0x5e, 0, 0}, {0x86e3,0x02, 0, 0}, {0x86e4, 0x0a, 0, 0}, {0x86e5, 0xd3, 0, 0}, {0x86e6,0x85, 0, 0}, {0x86e7, 0x32, 0, 0}, {0x86e8, 0x38, 0, 0}, {0x86e9,0x85, 0, 0}, {0x86ea, 0x33, 0, 0}, {0x86eb, 0x39, 0, 0}, {0x86ec,0xe5, 0, 0}, {0x86ed, 0x3a, 0, 0}, {0x86ee, 0xc3, 0, 0}, {0x86ef,0x13, 0, 0}, {0x86f0, 0xff, 0, 0}, {0x86f1, 0xe5, 0, 0}, {0x86f2,0x38, 0, 0}, {0x86f3, 0xc3, 0, 0}, {0x86f4, 0x9f, 0, 0}, {0x86f5,0x50, 0, 0}, {0x86f6, 0x02, 0, 0}, {0x86f7, 0x8f, 0, 0}, {0x86f8,0x38, 0, 0}, {0x86f9, 0xe5, 0, 0}, {0x86fa, 0x3b, 0, 0}, {0x86fb,0xc3, 0, 0}, {0x86fc, 0x13, 0, 0}, {0x86fd, 0xff, 0, 0}, {0x86fe,0xe5, 0, 0}, {0x86ff, 0x39, 0, 0}, {0x8700, 0xc3, 0, 0}, {0x8701,0x9f, 0, 0}, {0x8702, 0x50, 0, 0}, {0x8703, 0x02, 0, 0}, {0x8704,0x8f, 0, 0}, {0x8705, 0x39, 0, 0}, {0x8706, 0xe5, 0, 0}, {0x8707,0x3a, 0, 0}, {0x8708, 0xc3, 0, 0}, {0x8709, 0x13, 0, 0}, {0x870a,0xff, 0, 0}, {0x870b, 0xfd, 0, 0}, {0x870c, 0xe5, 0, 0}, {0x870d,0x38, 0, 0}, {0x870e, 0x90, 0, 0}, {0x870f, 0x0e, 0, 0}, {0x8710,0x7f, 0, 0}, {0x8711, 0x12, 0, 0}, {0x8712, 0x0a, 0, 0}, {0x8713,0xa6, 0, 0}, {0x8714, 0x40, 0, 0}, {0x8715, 0x04, 0, 0}, {0x8716,0xee, 0, 0}, {0x8717, 0x9f, 0, 0}, {0x8718, 0xf5, 0, 0}, {0x8719,0x38, 0, 0}, {0x871a, 0xe5, 0, 0}, {0x871b, 0x3b, 0, 0}, {0x871c,0xc3, 0, 0}, {0x871d, 0x13, 0, 0}, {0x871e, 0xff, 0, 0}, {0x871f,0xfd, 0, 0}, {0x8720, 0xe5, 0, 0}, {0x8721, 0x39, 0, 0}, {0x8722,0x90, 0, 0}, {0x8723, 0x0e, 0, 0}, {0x8724, 0x80, 0, 0}, {0x8725,0x12, 0, 0}, {0x8726, 0x0a, 0, 0}, {0x8727, 0xa6, 0, 0}, {0x8728,0x40, 0, 0}, {0x8729, 0x14, 0, 0}, {0x872a, 0xee, 0, 0}, {0x872b,0x9f, 0, 0}, {0x872c, 0xf5, 0, 0}, {0x872d, 0x39, 0, 0}, {0x872e,0x80, 0, 0}, {0x872f, 0x0e, 0, 0}, {0x8730, 0x85, 0, 0}, {0x8731,0x35, 0, 0}, {0x8732, 0x3b, 0, 0}, {0x8733, 0x85, 0, 0}, {0x8734,0x34, 0, 0}, {0x8735, 0x3a, 0, 0}, {0x8736, 0x85, 0, 0}, {0x8737,0x33, 0, 0}, {0x8738, 0x39, 0, 0}, {0x8739, 0x85, 0, 0}, {0x873a,0x32, 0, 0}, {0x873b, 0x38, 0, 0}, {0x873c, 0x80, 0, 0}, {0x873d,0x03, 0, 0}, {0x873e, 0x02, 0, 0}, {0x873f, 0x04, 0, 0}, {0x8740,0xa2, 0, 0}, {0x8741, 0x90, 0, 0}, {0x8742, 0x30, 0, 0}, {0x8743,0x24, 0, 0}, {0x8744, 0xe5, 0, 0}, {0x8745, 0x32, 0, 0}, {0x8746,0xf0, 0, 0}, {0x8747, 0xa3, 0, 0}, {0x8748, 0xe5, 0, 0}, {0x8749,0x33, 0, 0}, {0x874a, 0xf0, 0, 0}, {0x874b, 0xa3, 0, 0}, {0x874c,0xe5, 0, 0}, {0x874d, 0x34, 0, 0}, {0x874e, 0xf0, 0, 0}, {0x874f,0xa3, 0, 0}, {0x8750, 0xe5, 0, 0}, {0x8751, 0x35, 0, 0}, {0x8752,0xf0, 0, 0}, {0x8753, 0xa3, 0, 0}, {0x8754, 0xe5, 0, 0}, {0x8755,0x31, 0, 0}, {0x8756, 0xf0, 0, 0}, {0x8757, 0x90, 0, 0}, {0x8758,0x30, 0, 0}, {0x8759, 0x23, 0, 0}, {0x875a, 0xe4, 0, 0}, {0x875b,0xf0, 0, 0}, {0x875c, 0x22, 0, 0}, {0x875d, 0xc0, 0, 0}, {0x875e,0xe0, 0, 0}, {0x875f, 0xc0, 0, 0}, {0x8760, 0x83, 0, 0}, {0x8761,0xc0, 0, 0}, {0x8762, 0x82, 0, 0}, {0x8763, 0xc0, 0, 0}, {0x8764,0xd0, 0, 0}, {0x8765, 0x90, 0, 0}, {0x8766, 0x3f, 0, 0}, {0x8767,0x0c, 0, 0}, {0x8768, 0xe0, 0, 0}, {0x8769, 0xf5, 0, 0}, {0x876a,0x27, 0, 0}, {0x876b, 0xe5, 0, 0}, {0x876c, 0x27, 0, 0}, {0x876d,0x30, 0, 0}, {0x876e, 0xe3, 0, 0}, {0x876f, 0x42, 0, 0}, {0x8770,0x30, 0, 0}, {0x8771, 0x35, 0, 0}, {0x8772, 0x34, 0, 0}, {0x8773,0x90, 0, 0}, {0x8774, 0x60, 0, 0}, {0x8775, 0x19, 0, 0}, {0x8776,0xe0, 0, 0}, {0x8777, 0xf5, 0, 0}, {0x8778, 0x0a, 0, 0}, {0x8779,0xa3, 0, 0}, {0x877a, 0xe0, 0, 0}, {0x877b, 0xf5, 0, 0}, {0x877c,0x0b, 0, 0}, {0x877d, 0x30, 0, 0}, {0x877e, 0x01, 0, 0}, {0x877f,0x06, 0, 0}, {0x8780, 0x30, 0, 0}, {0x8781, 0x32, 0, 0}, {0x8782,0x03, 0, 0}, {0x8783, 0xd3, 0, 0}, {0x8784, 0x80, 0, 0}, {0x8785,0x01, 0, 0}, {0x8786, 0xc3, 0, 0}, {0x8787, 0x92, 0, 0}, {0x8788,0x09, 0, 0}, {0x8789, 0x30, 0, 0}, {0x878a, 0x02, 0, 0}, {0x878b,0x06, 0, 0}, {0x878c, 0x30, 0, 0}, {0x878d, 0x32, 0, 0}, {0x878e,0x03, 0, 0}, {0x878f, 0xd3, 0, 0}, {0x8790, 0x80, 0, 0}, {0x8791,0x01, 0, 0}, {0x8792, 0xc3, 0, 0}, {0x8793, 0x92, 0, 0}, {0x8794,0x0a, 0, 0}, {0x8795, 0x30, 0, 0}, {0x8796, 0x32, 0, 0}, {0x8797,0x0c, 0, 0}, {0x8798, 0x30, 0, 0}, {0x8799, 0x03, 0, 0}, {0x879a,0x09, 0, 0}, {0x879b, 0x20, 0, 0}, {0x879c, 0x02, 0, 0}, {0x879d,0x06, 0, 0}, {0x879e, 0x20, 0, 0}, {0x879f, 0x01, 0, 0}, {0x87a0,0x03, 0, 0}, {0x87a1, 0xd3, 0, 0}, {0x87a2, 0x80, 0, 0}, {0x87a3,0x01, 0, 0}, {0x87a4, 0xc3, 0, 0}, {0x87a5, 0x92, 0, 0}, {0x87a6,0x0b, 0, 0}, {0x87a7, 0x90, 0, 0}, {0x87a8, 0x30, 0, 0}, {0x87a9,0x01, 0, 0}, {0x87aa, 0xe0, 0, 0}, {0x87ab, 0x44, 0, 0}, {0x87ac,0x40, 0, 0}, {0x87ad, 0xf0, 0, 0}, {0x87ae, 0xe0, 0, 0}, {0x87af,0x54, 0, 0}, {0x87b0, 0xbf, 0, 0}, {0x87b1, 0xf0, 0, 0}, {0x87b2,0xe5, 0, 0}, {0x87b3, 0x27, 0, 0}, {0x87b4, 0x30, 0, 0}, {0x87b5,0xe1, 0, 0}, {0x87b6, 0x14, 0, 0}, {0x87b7, 0x30, 0, 0}, {0x87b8,0x33, 0, 0}, {0x87b9, 0x11, 0, 0}, {0x87ba, 0x90, 0, 0}, {0x87bb,0x30, 0, 0}, {0x87bc, 0x22, 0, 0}, {0x87bd, 0xe0, 0, 0}, {0x87be,0xf5, 0, 0}, {0x87bf, 0x08, 0, 0}, {0x87c0, 0xe4, 0, 0}, {0x87c1,0xf0, 0, 0}, {0x87c2, 0x30, 0, 0}, {0x87c3, 0x00, 0, 0}, {0x87c4,0x03, 0, 0}, {0x87c5, 0xd3, 0, 0}, {0x87c6, 0x80, 0, 0}, {0x87c7,0x01, 0, 0}, {0x87c8, 0xc3, 0, 0}, {0x87c9, 0x92, 0, 0}, {0x87ca,0x08, 0, 0}, {0x87cb, 0xe5, 0, 0}, {0x87cc, 0x27, 0, 0}, {0x87cd,0x30, 0, 0}, {0x87ce, 0xe5, 0, 0}, {0x87cf, 0x12, 0, 0}, {0x87d0,0x90, 0, 0}, {0x87d1, 0x56, 0, 0}, {0x87d2, 0x90, 0, 0}, {0x87d3,0xe0, 0, 0}, {0x87d4, 0xf5, 0, 0}, {0x87d5, 0x09, 0, 0}, {0x87d6,0x30, 0, 0}, {0x87d7, 0x30, 0, 0}, {0x87d8, 0x09, 0, 0}, {0x87d9,0x30, 0, 0}, {0x87da, 0x05, 0, 0}, {0x87db, 0x03, 0, 0}, {0x87dc,0xd3, 0, 0}, {0x87dd, 0x80, 0, 0}, {0x87de, 0x01, 0, 0}, {0x87df,0xc3, 0, 0}, {0x87e0, 0x92, 0, 0}, {0x87e1, 0x0d, 0, 0}, {0x87e2,0x90, 0, 0}, {0x87e3, 0x3f, 0, 0}, {0x87e4, 0x0c, 0, 0}, {0x87e5,0xe5, 0, 0}, {0x87e6, 0x27, 0, 0}, {0x87e7, 0xf0, 0, 0}, {0x87e8,0xd0, 0, 0}, {0x87e9, 0xd0, 0, 0}, {0x87ea, 0xd0, 0, 0}, {0x87eb,0x82, 0, 0}, {0x87ec, 0xd0, 0, 0}, {0x87ed, 0x83, 0, 0}, {0x87ee,0xd0, 0, 0}, {0x87ef, 0xe0, 0, 0}, {0x87f0, 0x32, 0, 0}, {0x87f1,0x90, 0, 0}, {0x87f2, 0x0e, 0, 0}, {0x87f3, 0x7d, 0, 0}, {0x87f4,0xe4, 0, 0}, {0x87f5, 0x93, 0, 0}, {0x87f6, 0xfe, 0, 0}, {0x87f7,0x74, 0, 0}, {0x87f8, 0x01, 0, 0}, {0x87f9, 0x93, 0, 0}, {0x87fa,0xff, 0, 0}, {0x87fb, 0xc3, 0, 0}, {0x87fc, 0x90, 0, 0}, {0x87fd,0x0e, 0, 0}, {0x87fe, 0x7b, 0, 0}, {0x87ff, 0x74, 0, 0}, {0x8800,0x01, 0, 0}, {0x8801, 0x93, 0, 0}, {0x8802, 0x9f, 0, 0}, {0x8803,0xff, 0, 0}, {0x8804, 0xe4, 0, 0}, {0x8805, 0x93, 0, 0}, {0x8806,0x9e, 0, 0}, {0x8807, 0xfe, 0, 0}, {0x8808, 0xe4, 0, 0}, {0x8809,0x8f, 0, 0}, {0x880a, 0x30, 0, 0}, {0x880b, 0x8e, 0, 0}, {0x880c,0x2f, 0, 0}, {0x880d, 0xf5, 0, 0}, {0x880e, 0x2e, 0, 0}, {0x880f,0xf5, 0, 0}, {0x8810, 0x2d, 0, 0}, {0x8811, 0xab, 0, 0}, {0x8812,0x30, 0, 0}, {0x8813, 0xaa, 0, 0}, {0x8814, 0x2f, 0, 0}, {0x8815,0xa9, 0, 0}, {0x8816, 0x2e, 0, 0}, {0x8817, 0xa8, 0, 0}, {0x8818,0x2d, 0, 0}, {0x8819, 0xaf, 0, 0}, {0x881a, 0x3e, 0, 0}, {0x881b,0xfc, 0, 0}, {0x881c, 0xfd, 0, 0}, {0x881d, 0xfe, 0, 0}, {0x881e,0x12, 0, 0}, {0x881f, 0x03, 0, 0}, {0x8820, 0x06, 0, 0}, {0x8821,0x12, 0, 0}, {0x8822, 0x0a, 0, 0}, {0x8823, 0xb8, 0, 0}, {0x8824,0xe4, 0, 0}, {0x8825, 0x7b, 0, 0}, {0x8826, 0xff, 0, 0}, {0x8827,0xfa, 0, 0}, {0x8828, 0xf9, 0, 0}, {0x8829, 0xf8, 0, 0}, {0x882a,0x12, 0, 0}, {0x882b, 0x03, 0, 0}, {0x882c, 0x91, 0, 0}, {0x882d,0x12, 0, 0}, {0x882e, 0x0a, 0, 0}, {0x882f, 0xb8, 0, 0}, {0x8830,0x90, 0, 0}, {0x8831, 0x0e, 0, 0}, {0x8832, 0x69, 0, 0}, {0x8833,0xe4, 0, 0}, {0x8834, 0x12, 0, 0}, {0x8835, 0x0a, 0, 0}, {0x8836,0xcd, 0, 0}, {0x8837, 0x12, 0, 0}, {0x8838, 0x0a, 0, 0}, {0x8839,0xb8, 0, 0}, {0x883a, 0xe4, 0, 0}, {0x883b, 0x85, 0, 0}, {0x883c,0x3d, 0, 0}, {0x883d, 0x2c, 0, 0}, {0x883e, 0xf5, 0, 0}, {0x883f,0x2b, 0, 0}, {0x8840, 0xf5, 0, 0}, {0x8841, 0x2a, 0, 0}, {0x8842,0xf5, 0, 0}, {0x8843, 0x29, 0, 0}, {0x8844, 0xaf, 0, 0}, {0x8845,0x2c, 0, 0}, {0x8846, 0xae, 0, 0}, {0x8847, 0x2b, 0, 0}, {0x8848,0xad, 0, 0}, {0x8849, 0x2a, 0, 0}, {0x884a, 0xac, 0, 0}, {0x884b,0x29, 0, 0}, {0x884c, 0xa3, 0, 0}, {0x884d, 0x12, 0, 0}, {0x884e,0x0a, 0, 0}, {0x884f, 0xcd, 0, 0}, {0x8850, 0x8f, 0, 0}, {0x8851,0x2c, 0, 0}, {0x8852, 0x8e, 0, 0}, {0x8853, 0x2b, 0, 0}, {0x8854,0x8d, 0, 0}, {0x8855, 0x2a, 0, 0}, {0x8856, 0x8c, 0, 0}, {0x8857,0x29, 0, 0}, {0x8858, 0xe5, 0, 0}, {0x8859, 0x30, 0, 0}, {0x885a,0x45, 0, 0}, {0x885b, 0x2c, 0, 0}, {0x885c, 0xf5, 0, 0}, {0x885d,0x30, 0, 0}, {0x885e, 0xe5, 0, 0}, {0x885f, 0x2f, 0, 0}, {0x8860,0x45, 0, 0}, {0x8861, 0x2b, 0, 0}, {0x8862, 0xf5, 0, 0}, {0x8863,0x2f, 0, 0}, {0x8864, 0xe5, 0, 0}, {0x8865, 0x2e, 0, 0}, {0x8866,0x45, 0, 0}, {0x8867, 0x2a, 0, 0}, {0x8868, 0xf5, 0, 0}, {0x8869,0x2e, 0, 0}, {0x886a, 0xe5, 0, 0}, {0x886b, 0x2d, 0, 0}, {0x886c,0x45, 0, 0}, {0x886d, 0x29, 0, 0}, {0x886e, 0xf5, 0, 0}, {0x886f,0x2d, 0, 0}, {0x8870, 0xe4, 0, 0}, {0x8871, 0xf5, 0, 0}, {0x8872,0x22, 0, 0}, {0x8873, 0xf5, 0, 0}, {0x8874, 0x23, 0, 0}, {0x8875,0x85, 0, 0}, {0x8876, 0x30, 0, 0}, {0x8877, 0x1e, 0, 0}, {0x8878,0x85, 0, 0}, {0x8879, 0x2f, 0, 0}, {0x887a, 0x1d, 0, 0}, {0x887b,0x85, 0, 0}, {0x887c, 0x2e, 0, 0}, {0x887d, 0x1c, 0, 0}, {0x887e,0x85, 0, 0}, {0x887f, 0x2d, 0, 0}, {0x8880, 0x1b, 0, 0}, {0x8881,0x02, 0, 0}, {0x8882, 0x0a, 0, 0}, {0x8883, 0x5c, 0, 0}, {0x8884,0x78, 0, 0}, {0x8885, 0x45, 0, 0}, {0x8886, 0x7e, 0, 0}, {0x8887,0x00, 0, 0}, {0x8888, 0xe6, 0, 0}, {0x8889, 0xfc, 0, 0}, {0x888a,0x08, 0, 0}, {0x888b, 0xe6, 0, 0}, {0x888c, 0xfd, 0, 0}, {0x888d,0x12, 0, 0}, {0x888e, 0x02, 0, 0}, {0x888f, 0x9f, 0, 0}, {0x8890,0x7c, 0, 0}, {0x8891, 0x00, 0, 0}, {0x8892, 0x22, 0, 0}, {0x8893,0xe0, 0, 0}, {0x8894, 0xa3, 0, 0}, {0x8895, 0xe0, 0, 0}, {0x8896,0x75, 0, 0}, {0x8897, 0xf0, 0, 0}, {0x8898, 0x02, 0, 0}, {0x8899,0xa4, 0, 0}, {0x889a, 0xff, 0, 0}, {0x889b, 0xae, 0, 0}, {0x889c,0xf0, 0, 0}, {0x889d, 0xc3, 0, 0}, {0x889e, 0x08, 0, 0}, {0x889f,0xe6, 0, 0}, {0x88a0, 0x9f, 0, 0}, {0x88a1, 0xf6, 0, 0}, {0x88a2,0x18, 0, 0}, {0x88a3, 0xe6, 0, 0}, {0x88a4, 0x9e, 0, 0}, {0x88a5,0xf6, 0, 0}, {0x88a6, 0x22, 0, 0}, {0x88a7, 0xff, 0, 0}, {0x88a8,0xe5, 0, 0}, {0x88a9, 0xf0, 0, 0}, {0x88aa, 0x34, 0, 0}, {0x88ab,0x60, 0, 0}, {0x88ac, 0x8f, 0, 0}, {0x88ad, 0x82, 0, 0}, {0x88ae,0xf5, 0, 0}, {0x88af, 0x83, 0, 0}, {0x88b0, 0xec, 0, 0}, {0x88b1,0xf0, 0, 0}, {0x88b2, 0x22, 0, 0}, {0x88b3, 0xe4, 0, 0}, {0x88b4,0xfc, 0, 0}, {0x88b5, 0xfd, 0, 0}, {0x88b6, 0x12, 0, 0}, {0x88b7,0x04, 0, 0}, {0x88b8, 0x64, 0, 0}, {0x88b9, 0x78, 0, 0}, {0x88ba,0x4f, 0, 0}, {0x88bb, 0xe6, 0, 0}, {0x88bc, 0xc3, 0, 0}, {0x88bd,0x13, 0, 0}, {0x88be, 0xfe, 0, 0}, {0x88bf, 0x08, 0, 0}, {0x88c0,0xe6, 0, 0}, {0x88c1, 0x13, 0, 0}, {0x88c2, 0x22, 0, 0}, {0x88c3,0x78, 0, 0}, {0x88c4, 0x45, 0, 0}, {0x88c5, 0xe6, 0, 0}, {0x88c6,0xfe, 0, 0}, {0x88c7, 0x08, 0, 0}, {0x88c8, 0xe6, 0, 0}, {0x88c9,0xff, 0, 0}, {0x88ca, 0xe4, 0, 0}, {0x88cb, 0xfc, 0, 0}, {0x88cc,0xfd, 0, 0}, {0x88cd, 0x22, 0, 0}, {0x88ce, 0xe7, 0, 0}, {0x88cf,0xc4, 0, 0}, {0x88d0, 0xf8, 0, 0}, {0x88d1, 0x54, 0, 0}, {0x88d2,0xf0, 0, 0}, {0x88d3, 0xc8, 0, 0}, {0x88d4, 0x68, 0, 0}, {0x88d5,0xf7, 0, 0}, {0x88d6, 0x09, 0, 0}, {0x88d7, 0xe7, 0, 0}, {0x88d8,0xc4, 0, 0}, {0x88d9, 0x54, 0, 0}, {0x88da, 0x0f, 0, 0}, {0x88db,0x48, 0, 0}, {0x88dc, 0xf7, 0, 0}, {0x88dd, 0x22, 0, 0}, {0x88de,0xe6, 0, 0}, {0x88df, 0xfc, 0, 0}, {0x88e0, 0xed, 0, 0}, {0x88e1,0x75, 0, 0}, {0x88e2, 0xf0, 0, 0}, {0x88e3, 0x04, 0, 0}, {0x88e4,0xa4, 0, 0}, {0x88e5, 0x22, 0, 0}, {0x88e6, 0xe0, 0, 0}, {0x88e7,0xfe, 0, 0}, {0x88e8, 0xa3, 0, 0}, {0x88e9, 0xe0, 0, 0}, {0x88ea,0xfd, 0, 0}, {0x88eb, 0xee, 0, 0}, {0x88ec, 0xf6, 0, 0}, {0x88ed,0xed, 0, 0}, {0x88ee, 0x08, 0, 0}, {0x88ef, 0xf6, 0, 0}, {0x88f0,0x22, 0, 0}, {0x88f1, 0x13, 0, 0}, {0x88f2, 0xff, 0, 0}, {0x88f3,0xc3, 0, 0}, {0x88f4, 0xe6, 0, 0}, {0x88f5, 0x9f, 0, 0}, {0x88f6,0xff, 0, 0}, {0x88f7, 0x18, 0, 0}, {0x88f8, 0xe6, 0, 0}, {0x88f9,0x9e, 0, 0}, {0x88fa, 0xfe, 0, 0}, {0x88fb, 0x22, 0, 0}, {0x88fc,0xe6, 0, 0}, {0x88fd, 0xc3, 0, 0}, {0x88fe, 0x13, 0, 0}, {0x88ff,0xf7, 0, 0}, {0x8900, 0x08, 0, 0}, {0x8901, 0xe6, 0, 0}, {0x8902,0x13, 0, 0}, {0x8903, 0x09, 0, 0}, {0x8904, 0xf7, 0, 0}, {0x8905,0x22, 0, 0}, {0x8906, 0xe4, 0, 0}, {0x8907, 0xf5, 0, 0}, {0x8908,0x3e, 0, 0}, {0x8909, 0x90, 0, 0}, {0x890a, 0x0e, 0, 0}, {0x890b,0x77, 0, 0}, {0x890c, 0x93, 0, 0}, {0x890d, 0xff, 0, 0}, {0x890e,0xe4, 0, 0}, {0x890f, 0x8f, 0, 0}, {0x8910, 0x2c, 0, 0}, {0x8911,0xf5, 0, 0}, {0x8912, 0x2b, 0, 0}, {0x8913, 0xf5, 0, 0}, {0x8914,0x2a, 0, 0}, {0x8915, 0xf5, 0, 0}, {0x8916, 0x29, 0, 0}, {0x8917,0xaf, 0, 0}, {0x8918, 0x2c, 0, 0}, {0x8919, 0xae, 0, 0}, {0x891a,0x2b, 0, 0}, {0x891b, 0xad, 0, 0}, {0x891c, 0x2a, 0, 0}, {0x891d,0xac, 0, 0}, {0x891e, 0x29, 0, 0}, {0x891f, 0x90, 0, 0}, {0x8920,0x0e, 0, 0}, {0x8921, 0x6a, 0, 0}, {0x8922, 0x12, 0, 0}, {0x8923,0x0a, 0, 0}, {0x8924, 0xcd, 0, 0}, {0x8925, 0x8f, 0, 0}, {0x8926,0x2c, 0, 0}, {0x8927, 0x8e, 0, 0}, {0x8928, 0x2b, 0, 0}, {0x8929,0x8d, 0, 0}, {0x892a, 0x2a, 0, 0}, {0x892b, 0x8c, 0, 0}, {0x892c,0x29, 0, 0}, {0x892d, 0x90, 0, 0}, {0x892e, 0x0e, 0, 0}, {0x892f,0x72, 0, 0}, {0x8930, 0x12, 0, 0}, {0x8931, 0x04, 0, 0}, {0x8932,0x47, 0, 0}, {0x8933, 0xef, 0, 0}, {0x8934, 0x45, 0, 0}, {0x8935,0x2c, 0, 0}, {0x8936, 0xf5, 0, 0}, {0x8937, 0x2c, 0, 0}, {0x8938,0xee, 0, 0}, {0x8939, 0x45, 0, 0}, {0x893a, 0x2b, 0, 0}, {0x893b,0xf5, 0, 0}, {0x893c, 0x2b, 0, 0}, {0x893d, 0xed, 0, 0}, {0x893e,0x45, 0, 0}, {0x893f, 0x2a, 0, 0}, {0x8940, 0xf5, 0, 0}, {0x8941,0x2a, 0, 0}, {0x8942, 0xec, 0, 0}, {0x8943, 0x45, 0, 0}, {0x8944,0x29, 0, 0}, {0x8945, 0xf5, 0, 0}, {0x8946, 0x29, 0, 0}, {0x8947,0xe4, 0, 0}, {0x8948, 0xf5, 0, 0}, {0x8949, 0x22, 0, 0}, {0x894a,0xf5, 0, 0}, {0x894b, 0x23, 0, 0}, {0x894c, 0x85, 0, 0}, {0x894d,0x2c, 0, 0}, {0x894e, 0x1e, 0, 0}, {0x894f, 0x85, 0, 0}, {0x8950,0x2b, 0, 0}, {0x8951, 0x1d, 0, 0}, {0x8952, 0x85, 0, 0}, {0x8953,0x2a, 0, 0}, {0x8954, 0x1c, 0, 0}, {0x8955, 0x85, 0, 0}, {0x8956,0x29, 0, 0}, {0x8957, 0x1b, 0, 0}, {0x8958, 0x12, 0, 0}, {0x8959,0x0a, 0, 0}, {0x895a, 0x5c, 0, 0}, {0x895b, 0xe4, 0, 0}, {0x895c,0xf5, 0, 0}, {0x895d, 0x22, 0, 0}, {0x895e, 0xf5, 0, 0}, {0x895f,0x23, 0, 0}, {0x8960, 0x90, 0, 0}, {0x8961, 0x0e, 0, 0}, {0x8962,0x72, 0, 0}, {0x8963, 0x12, 0, 0}, {0x8964, 0x0a, 0, 0}, {0x8965,0xc1, 0, 0}, {0x8966, 0x12, 0, 0}, {0x8967, 0x0a, 0, 0}, {0x8968,0x5c, 0, 0}, {0x8969, 0xe4, 0, 0}, {0x896a, 0xf5, 0, 0}, {0x896b,0x22, 0, 0}, {0x896c, 0xf5, 0, 0}, {0x896d, 0x23, 0, 0}, {0x896e,0x90, 0, 0}, {0x896f, 0x0e, 0, 0}, {0x8970, 0x6e, 0, 0}, {0x8971,0x12, 0, 0}, {0x8972, 0x0a, 0, 0}, {0x8973, 0xc1, 0, 0}, {0x8974,0x02, 0, 0}, {0x8975, 0x0a, 0, 0}, {0x8976, 0x5c, 0, 0}, {0x8977,0x75, 0, 0}, {0x8978, 0x89, 0, 0}, {0x8979, 0x03, 0, 0}, {0x897a,0x75, 0, 0}, {0x897b, 0xa8, 0, 0}, {0x897c, 0x01, 0, 0}, {0x897d,0x75, 0, 0}, {0x897e, 0xb8, 0, 0}, {0x897f, 0x04, 0, 0}, {0x8980,0x75, 0, 0}, {0x8981, 0x29, 0, 0}, {0x8982, 0xff, 0, 0}, {0x8983,0x75, 0, 0}, {0x8984, 0x2a, 0, 0}, {0x8985, 0x0e, 0, 0}, {0x8986,0x75, 0, 0}, {0x8987, 0x2b, 0, 0}, {0x8988, 0x15, 0, 0}, {0x8989,0x75, 0, 0}, {0x898a, 0x2c, 0, 0}, {0x898b, 0x0d, 0, 0}, {0x898c,0x12, 0, 0}, {0x898d, 0x09, 0, 0}, {0x898e, 0xe0, 0, 0}, {0x898f,0x12, 0, 0}, {0x8990, 0x00, 0, 0}, {0x8991, 0x09, 0, 0}, {0x8992,0x12, 0, 0}, {0x8993, 0x0a, 0, 0}, {0x8994, 0xd3, 0, 0}, {0x8995,0x12, 0, 0}, {0x8996, 0x00, 0, 0}, {0x8997, 0x06, 0, 0}, {0x8998,0xd2, 0, 0}, {0x8999, 0x00, 0, 0}, {0x899a, 0xd2, 0, 0}, {0x899b,0x33, 0, 0}, {0x899c, 0xd2, 0, 0}, {0x899d, 0xaf, 0, 0}, {0x899e,0x75, 0, 0}, {0x899f, 0x29, 0, 0}, {0x89a0, 0xff, 0, 0}, {0x89a1,0x75, 0, 0}, {0x89a2, 0x2a, 0, 0}, {0x89a3, 0x0e, 0, 0}, {0x89a4,0x75, 0, 0}, {0x89a5, 0x2b, 0, 0}, {0x89a6, 0x49, 0, 0}, {0x89a7,0x75, 0, 0}, {0x89a8, 0x2c, 0, 0}, {0x89a9, 0x03, 0, 0}, {0x89aa,0x12, 0, 0}, {0x89ab, 0x09, 0, 0}, {0x89ac, 0xe0, 0, 0}, {0x89ad,0x30, 0, 0}, {0x89ae, 0x08, 0, 0}, {0x89af, 0x09, 0, 0}, {0x89b0,0xc2, 0, 0}, {0x89b1, 0x33, 0, 0}, {0x89b2, 0x12, 0, 0}, {0x89b3,0x06, 0, 0}, {0x89b4, 0x72, 0, 0}, {0x89b5, 0xc2, 0, 0}, {0x89b6,0x08, 0, 0}, {0x89b7, 0xd2, 0, 0}, {0x89b8, 0x33, 0, 0}, {0x89b9,0x30, 0, 0}, {0x89ba, 0x09, 0, 0}, {0x89bb, 0x09, 0, 0}, {0x89bc,0xc2, 0, 0}, {0x89bd, 0x35, 0, 0}, {0x89be, 0x12, 0, 0}, {0x89bf,0x00, 0, 0}, {0x89c0, 0x0e, 0, 0}, {0x89c1, 0xc2, 0, 0}, {0x89c2,0x09, 0, 0}, {0x89c3, 0xd2, 0, 0}, {0x89c4, 0x35, 0, 0}, {0x89c5,0x30, 0, 0}, {0x89c6, 0x0e, 0, 0}, {0x89c7, 0x03, 0, 0}, {0x89c8,0x12, 0, 0}, {0x89c9, 0x04, 0, 0}, {0x89ca, 0xa2, 0, 0}, {0x89cb,0x30, 0, 0}, {0x89cc, 0x34, 0, 0}, {0x89cd, 0xdf, 0, 0}, {0x89ce,0x90, 0, 0}, {0x89cf, 0x30, 0, 0}, {0x89d0, 0x29, 0, 0}, {0x89d1,0xe5, 0, 0}, {0x89d2, 0x3f, 0, 0}, {0x89d3, 0xf0, 0, 0}, {0x89d4,0xb4, 0, 0}, {0x89d5, 0x10, 0, 0}, {0x89d6, 0x05, 0, 0}, {0x89d7,0x90, 0, 0}, {0x89d8, 0x30, 0, 0}, {0x89d9, 0x23, 0, 0}, {0x89da,0xe4, 0, 0}, {0x89db, 0xf0, 0, 0}, {0x89dc, 0xc2, 0, 0}, {0x89dd,0x34, 0, 0}, {0x89de, 0x80, 0, 0}, {0x89df, 0xcd, 0, 0}, {0x89e0,0xae, 0, 0}, {0x89e1, 0x2a, 0, 0}, {0x89e2, 0xaf, 0, 0}, {0x89e3,0x2b, 0, 0}, {0x89e4, 0xe4, 0, 0}, {0x89e5, 0xfd, 0, 0}, {0x89e6,0xed, 0, 0}, {0x89e7, 0xc3, 0, 0}, {0x89e8, 0x95, 0, 0}, {0x89e9,0x2c, 0, 0}, {0x89ea, 0x50, 0, 0}, {0x89eb, 0x33, 0, 0}, {0x89ec,0x12, 0, 0}, {0x89ed, 0x0b, 0, 0}, {0x89ee, 0x1a, 0, 0}, {0x89ef,0xe4, 0, 0}, {0x89f0, 0x93, 0, 0}, {0x89f1, 0xf5, 0, 0}, {0x89f2,0x2d, 0, 0}, {0x89f3, 0x74, 0, 0}, {0x89f4, 0x01, 0, 0}, {0x89f5,0x93, 0, 0}, {0x89f6, 0xf5, 0, 0}, {0x89f7, 0x2e, 0, 0}, {0x89f8,0x45, 0, 0}, {0x89f9, 0x2d, 0, 0}, {0x89fa, 0x60, 0, 0}, {0x89fb,0x23, 0, 0}, {0x89fc, 0x85, 0, 0}, {0x89fd, 0x2e, 0, 0}, {0x89fe,0x82, 0, 0}, {0x89ff, 0x85, 0, 0}, {0x8a00, 0x2d, 0, 0}, {0x8a01,0x83, 0, 0}, {0x8a02, 0xe0, 0, 0}, {0x8a03, 0xfc, 0, 0}, {0x8a04,0x12, 0, 0}, {0x8a05, 0x0b, 0, 0}, {0x8a06, 0x1a, 0, 0}, {0x8a07,0x74, 0, 0}, {0x8a08, 0x03, 0, 0}, {0x8a09, 0x93, 0, 0}, {0x8a0a,0x52, 0, 0}, {0x8a0b, 0x04, 0, 0}, {0x8a0c, 0x12, 0, 0}, {0x8a0d,0x0b, 0, 0}, {0x8a0e, 0x1a, 0, 0}, {0x8a0f, 0x74, 0, 0}, {0x8a10,0x02, 0, 0}, {0x8a11, 0x93, 0, 0}, {0x8a12, 0x42, 0, 0}, {0x8a13,0x04, 0, 0}, {0x8a14, 0x85, 0, 0}, {0x8a15, 0x2e, 0, 0}, {0x8a16,0x82, 0, 0}, {0x8a17, 0x85, 0, 0}, {0x8a18, 0x2d, 0, 0}, {0x8a19,0x83, 0, 0}, {0x8a1a, 0xec, 0, 0}, {0x8a1b, 0xf0, 0, 0}, {0x8a1c,0x0d, 0, 0}, {0x8a1d, 0x80, 0, 0}, {0x8a1e, 0xc7, 0, 0}, {0x8a1f,0x22, 0, 0}, {0x8a20, 0x78, 0, 0}, {0x8a21, 0xb1, 0, 0}, {0x8a22,0xe6, 0, 0}, {0x8a23, 0xd3, 0, 0}, {0x8a24, 0x08, 0, 0}, {0x8a25,0xff, 0, 0}, {0x8a26, 0xe6, 0, 0}, {0x8a27, 0x64, 0, 0}, {0x8a28,0x80, 0, 0}, {0x8a29, 0xf8, 0, 0}, {0x8a2a, 0xef, 0, 0}, {0x8a2b,0x64, 0, 0}, {0x8a2c, 0x80, 0, 0}, {0x8a2d, 0x98, 0, 0}, {0x8a2e,0x22, 0, 0}, {0x8a2f, 0x93, 0, 0}, {0x8a30, 0xff, 0, 0}, {0x8a31,0x7e, 0, 0}, {0x8a32, 0x00, 0, 0}, {0x8a33, 0xe6, 0, 0}, {0x8a34,0xfc, 0, 0}, {0x8a35, 0x08, 0, 0}, {0x8a36, 0xe6, 0, 0}, {0x8a37,0xfd, 0, 0}, {0x8a38, 0x12, 0, 0}, {0x8a39, 0x02, 0, 0}, {0x8a3a,0x9f, 0, 0}, {0x8a3b, 0x78, 0, 0}, {0x8a3c, 0xb4, 0, 0}, {0x8a3d,0xe6, 0, 0}, {0x8a3e, 0xfc, 0, 0}, {0x8a3f, 0x08, 0, 0}, {0x8a40,0xe6, 0, 0}, {0x8a41, 0xfd, 0, 0}, {0x8a42, 0xd3, 0, 0}, {0x8a43,0xef, 0, 0}, {0x8a44, 0x9d, 0, 0}, {0x8a45, 0xee, 0, 0}, {0x8a46,0x9c, 0, 0}, {0x8a47, 0x22, 0, 0}, {0x8a48, 0x78, 0, 0}, {0x8a49,0xb0, 0, 0}, {0x8a4a, 0xd3, 0, 0}, {0x8a4b, 0xe6, 0, 0}, {0x8a4c,0x64, 0, 0}, {0x8a4d, 0x80, 0, 0}, {0x8a4e, 0x94, 0, 0}, {0x8a4f,0x80, 0, 0}, {0x8a50, 0x22, 0, 0}, {0x8a51, 0x25, 0, 0}, {0x8a52,0xe0, 0, 0}, {0x8a53, 0x24, 0, 0}, {0x8a54, 0x0a, 0, 0}, {0x8a55,0xf8, 0, 0}, {0x8a56, 0xe6, 0, 0}, {0x8a57, 0xfe, 0, 0}, {0x8a58,0x08, 0, 0}, {0x8a59, 0xe6, 0, 0}, {0x8a5a, 0xff, 0, 0}, {0x8a5b,0x22, 0, 0}, {0x8a5c, 0xa2, 0, 0}, {0x8a5d, 0xaf, 0, 0}, {0x8a5e,0x92, 0, 0}, {0x8a5f, 0x31, 0, 0}, {0x8a60, 0xc2, 0, 0}, {0x8a61,0xaf, 0, 0}, {0x8a62, 0xe5, 0, 0}, {0x8a63, 0x23, 0, 0}, {0x8a64,0x45, 0, 0}, {0x8a65, 0x22, 0, 0}, {0x8a66, 0x90, 0, 0}, {0x8a67,0x0e, 0, 0}, {0x8a68, 0x5d, 0, 0}, {0x8a69, 0x60, 0, 0}, {0x8a6a,0x0b, 0, 0}, {0x8a6b, 0x12, 0, 0}, {0x8a6c, 0x0b, 0, 0}, {0x8a6d,0x0f, 0, 0}, {0x8a6e, 0xe0, 0, 0}, {0x8a6f, 0xf5, 0, 0}, {0x8a70,0x19, 0, 0}, {0x8a71, 0xe0, 0, 0}, {0x8a72, 0xf5, 0, 0}, {0x8a73,0x1a, 0, 0}, {0x8a74, 0x80, 0, 0}, {0x8a75, 0x0f, 0, 0}, {0x8a76,0x12, 0, 0}, {0x8a77, 0x0b, 0, 0}, {0x8a78, 0x0f, 0, 0}, {0x8a79,0xe5, 0, 0}, {0x8a7a, 0x1d, 0, 0}, {0x8a7b, 0xf0, 0, 0}, {0x8a7c,0x90, 0, 0}, {0x8a7d, 0x0e, 0, 0}, {0x8a7e, 0x5f, 0, 0}, {0x8a7f,0x12, 0, 0}, {0x8a80, 0x0b, 0, 0}, {0x8a81, 0x0f, 0, 0}, {0x8a82,0xe5, 0, 0}, {0x8a83, 0x1e, 0, 0}, {0x8a84, 0xf0, 0, 0}, {0x8a85,0xa2, 0, 0}, {0x8a86, 0x31, 0, 0}, {0x8a87, 0x92, 0, 0}, {0x8a88,0xaf, 0, 0}, {0x8a89, 0x22, 0, 0}, {0x8a8a, 0xd2, 0, 0}, {0x8a8b,0x01, 0, 0}, {0x8a8c, 0xc2, 0, 0}, {0x8a8d, 0x02, 0, 0}, {0x8a8e,0xe4, 0, 0}, {0x8a8f, 0xf5, 0, 0}, {0x8a90, 0x40, 0, 0}, {0x8a91,0xf5, 0, 0}, {0x8a92, 0x3f, 0, 0}, {0x8a93, 0xd2, 0, 0}, {0x8a94,0x34, 0, 0}, {0x8a95, 0xd2, 0, 0}, {0x8a96, 0x32, 0, 0}, {0x8a97,0xd2, 0, 0}, {0x8a98, 0x35, 0, 0}, {0x8a99, 0xd2, 0, 0}, {0x8a9a,0x01, 0, 0}, {0x8a9b, 0xc2, 0, 0}, {0x8a9c, 0x02, 0, 0}, {0x8a9d,0xf5, 0, 0}, {0x8a9e, 0x40, 0, 0}, {0x8a9f, 0xf5, 0, 0}, {0x8aa0,0x3f, 0, 0}, {0x8aa1, 0xd2, 0, 0}, {0x8aa2, 0x34, 0, 0}, {0x8aa3,0xd2, 0, 0}, {0x8aa4, 0x32, 0, 0}, {0x8aa5, 0x22, 0, 0}, {0x8aa6,0x2d, 0, 0}, {0x8aa7, 0xfd, 0, 0}, {0x8aa8, 0xe4, 0, 0}, {0x8aa9,0x33, 0, 0}, {0x8aaa, 0xfc, 0, 0}, {0x8aab, 0xe4, 0, 0}, {0x8aac,0x93, 0, 0}, {0x8aad, 0xfe, 0, 0}, {0x8aae, 0xfb, 0, 0}, {0x8aaf,0xd3, 0, 0}, {0x8ab0, 0xed, 0, 0}, {0x8ab1, 0x9b, 0, 0}, {0x8ab2,0x74, 0, 0}, {0x8ab3, 0x80, 0, 0}, {0x8ab4, 0xf8, 0, 0}, {0x8ab5,0x6c, 0, 0}, {0x8ab6, 0x98, 0, 0}, {0x8ab7, 0x22, 0, 0}, {0x8ab8,0x8f, 0, 0}, {0x8ab9, 0x30, 0, 0}, {0x8aba, 0x8e, 0, 0}, {0x8abb,0x2f, 0, 0}, {0x8abc, 0x8d, 0, 0}, {0x8abd, 0x2e, 0, 0}, {0x8abe,0x8c, 0, 0}, {0x8abf, 0x2d, 0, 0}, {0x8ac0, 0x22, 0, 0}, {0x8ac1,0x12, 0, 0}, {0x8ac2, 0x04, 0, 0}, {0x8ac3, 0x47, 0, 0}, {0x8ac4,0x8f, 0, 0}, {0x8ac5, 0x1e, 0, 0}, {0x8ac6, 0x8e, 0, 0}, {0x8ac7,0x1d, 0, 0}, {0x8ac8, 0x8d, 0, 0}, {0x8ac9, 0x1c, 0, 0}, {0x8aca,0x8c, 0, 0}, {0x8acb, 0x1b, 0, 0}, {0x8acc, 0x22, 0, 0}, {0x8acd,0x93, 0, 0}, {0x8ace, 0xf9, 0, 0}, {0x8acf, 0xf8, 0, 0}, {0x8ad0,0x02, 0, 0}, {0x8ad1, 0x04, 0, 0}, {0x8ad2, 0x34, 0, 0}, {0x8ad3,0x90, 0, 0}, {0x8ad4, 0x0e, 0, 0}, {0x8ad5, 0x81, 0, 0}, {0x8ad6,0x12, 0, 0}, {0x8ad7, 0x04, 0, 0}, {0x8ad8, 0x47, 0, 0}, {0x8ad9,0x8f, 0, 0}, {0x8ada, 0x3b, 0, 0}, {0x8adb, 0x8e, 0, 0}, {0x8adc,0x3a, 0, 0}, {0x8add, 0x8d, 0, 0}, {0x8ade, 0x39, 0, 0}, {0x8adf,0x8c, 0, 0}, {0x8ae0, 0x38, 0, 0}, {0x8ae1, 0xd2, 0, 0}, {0x8ae2,0x06, 0, 0}, {0x8ae3, 0x30, 0, 0}, {0x8ae4, 0x06, 0, 0}, {0x8ae5,0x03, 0, 0}, {0x8ae6, 0xd3, 0, 0}, {0x8ae7, 0x80, 0, 0}, {0x8ae8,0x01, 0, 0}, {0x8ae9, 0xc3, 0, 0}, {0x8aea, 0x92, 0, 0}, {0x8aeb,0x0e, 0, 0}, {0x8aec, 0x22, 0, 0}, {0x8aed, 0xc0, 0, 0}, {0x8aee,0xe0, 0, 0}, {0x8aef, 0xc0, 0, 0}, {0x8af0, 0x83, 0, 0}, {0x8af1,0xc0, 0, 0}, {0x8af2, 0x82, 0, 0}, {0x8af3, 0x90, 0, 0}, {0x8af4,0x3f, 0, 0}, {0x8af5, 0x0d, 0, 0}, {0x8af6, 0xe0, 0, 0}, {0x8af7,0xf5, 0, 0}, {0x8af8, 0x28, 0, 0}, {0x8af9, 0xe5, 0, 0}, {0x8afa,0x28, 0, 0}, {0x8afb, 0xf0, 0, 0}, {0x8afc, 0xd0, 0, 0}, {0x8afd,0x82, 0, 0}, {0x8afe, 0xd0, 0, 0}, {0x8aff, 0x83, 0, 0}, {0x8b00,0xd0, 0, 0}, {0x8b01, 0xe0, 0, 0}, {0x8b02, 0x32, 0, 0}, {0x8b03,0x78, 0, 0}, {0x8b04, 0x7f, 0, 0}, {0x8b05, 0xe4, 0, 0}, {0x8b06,0xf6, 0, 0}, {0x8b07, 0xd8, 0, 0}, {0x8b08, 0xfd, 0, 0}, {0x8b09,0x75, 0, 0}, {0x8b0a, 0x81, 0, 0}, {0x8b0b, 0xc0, 0, 0}, {0x8b0c,0x02, 0, 0}, {0x8b0d, 0x09, 0, 0}, {0x8b0e, 0x77, 0, 0}, {0x8b0f,0xe4, 0, 0}, {0x8b10, 0x93, 0, 0}, {0x8b11, 0xfe, 0, 0}, {0x8b12,0x74, 0, 0}, {0x8b13, 0x01, 0, 0}, {0x8b14, 0x93, 0, 0}, {0x8b15,0xf5, 0, 0}, {0x8b16, 0x82, 0, 0}, {0x8b17, 0x8e, 0, 0}, {0x8b18,0x83, 0, 0}, {0x8b19, 0x22, 0, 0}, {0x8b1a, 0x8f, 0, 0}, {0x8b1b,0x82, 0, 0}, {0x8b1c, 0x8e, 0, 0}, {0x8b1d, 0x83, 0, 0}, {0x8b1e,0x75, 0, 0}, {0x8b1f, 0xf0, 0, 0}, {0x8b20, 0x04, 0, 0}, {0x8b21,0xed, 0, 0}, {0x8b22, 0x02, 0, 0}, {0x8b23, 0x04, 0, 0}, {0x8b24,0x70, 0, 0}, {0x8b25, 0x00, 0, 0}, {0x8b26, 0x00, 0, 0}, {0x8b27,0x00, 0, 0}, {0x8b28, 0x00, 0, 0}, {0x8b29, 0x00, 0, 0}, {0x8b2a,0x00, 0, 0}, {0x8b2b, 0x00, 0, 0}, {0x8b2c, 0x00, 0, 0}, {0x8b2d,0x00, 0, 0}, {0x8b2e, 0x00, 0, 0}, {0x8b2f, 0x00, 0, 0}, {0x8b30,0x00, 0, 0}, {0x8b31, 0x00, 0, 0}, {0x8b32, 0x00, 0, 0}, {0x8b33,0x00, 0, 0}, {0x8b34, 0x00, 0, 0}, {0x8b35, 0x00, 0, 0}, {0x8b36,0x00, 0, 0}, {0x8b37, 0x00, 0, 0}, {0x8b38, 0x00, 0, 0}, {0x8b39,0x00, 0, 0}, {0x8b3a, 0x00, 0, 0}, {0x8b3b, 0x00, 0, 0}, {0x8b3c,0x00, 0, 0}, {0x8b3d, 0x00, 0, 0}, {0x8b3e, 0x00, 0, 0}, {0x8b3f,0x00, 0, 0}, {0x8b40, 0x00, 0, 0}, {0x8b41, 0x00, 0, 0}, {0x8b42,0x00, 0, 0}, {0x8b43, 0x00, 0, 0}, {0x8b44, 0x00, 0, 0}, {0x8b45,0x00, 0, 0}, {0x8b46, 0x00, 0, 0}, {0x8b47, 0x00, 0, 0}, {0x8b48,0x00, 0, 0}, {0x8b49, 0x00, 0, 0}, {0x8b4a, 0x00, 0, 0}, {0x8b4b,0x00, 0, 0}, {0x8b4c, 0x00, 0, 0}, {0x8b4d, 0x00, 0, 0}, {0x8b4e,0x00, 0, 0}, {0x8b4f, 0x00, 0, 0}, {0x8b50, 0x00, 0, 0}, {0x8b51,0x00, 0, 0}, {0x8b52, 0x00, 0, 0}, {0x8b53, 0x00, 0, 0}, {0x8b54,0x00, 0, 0}, {0x8b55, 0x00, 0, 0}, {0x8b56, 0x00, 0, 0}, {0x8b57,0x00, 0, 0}, {0x8b58, 0x00, 0, 0}, {0x8b59, 0x00, 0, 0}, {0x8b5a,0x00, 0, 0}, {0x8b5b, 0x00, 0, 0}, {0x8b5c, 0x00, 0, 0}, {0x8b5d,0x00, 0, 0}, {0x8b5e, 0x00, 0, 0}, {0x8b5f, 0x00, 0, 0}, {0x8b60,0x00, 0, 0}, {0x8b61, 0x00, 0, 0}, {0x8b62, 0x00, 0, 0}, {0x8b63,0x00, 0, 0}, {0x8b64, 0x00, 0, 0}, {0x8b65, 0x00, 0, 0}, {0x8b66,0x00, 0, 0}, {0x8b67, 0x00, 0, 0}, {0x8b68, 0x00, 0, 0}, {0x8b69,0x00, 0, 0}, {0x8b6a, 0x00, 0, 0}, {0x8b6b, 0x00, 0, 0}, {0x8b6c,0x00, 0, 0}, {0x8b6d, 0x00, 0, 0}, {0x8b6e, 0x00, 0, 0}, {0x8b6f,0x00, 0, 0}, {0x8b70, 0x00, 0, 0}, {0x8b71, 0x00, 0, 0}, {0x8b72,0x00, 0, 0}, {0x8b73, 0x00, 0, 0}, {0x8b74, 0x00, 0, 0}, {0x8b75,0x00, 0, 0}, {0x8b76, 0x00, 0, 0}, {0x8b77, 0x00, 0, 0}, {0x8b78,0x00, 0, 0}, {0x8b79, 0x00, 0, 0}, {0x8b7a, 0x00, 0, 0}, {0x8b7b,0x00, 0, 0}, {0x8b7c, 0x00, 0, 0}, {0x8b7d, 0x00, 0, 0}, {0x8b7e,0x00, 0, 0}, {0x8b7f, 0x00, 0, 0}, {0x8b80, 0x00, 0, 0}, {0x8b81,0x00, 0, 0}, {0x8b82, 0x00, 0, 0}, {0x8b83, 0x00, 0, 0}, {0x8b84,0x00, 0, 0}, {0x8b85, 0x00, 0, 0}, {0x8b86, 0x00, 0, 0}, {0x8b87,0x00, 0, 0}, {0x8b88, 0x00, 0, 0}, {0x8b89, 0x00, 0, 0}, {0x8b8a,0x00, 0, 0}, {0x8b8b, 0x00, 0, 0}, {0x8b8c, 0x00, 0, 0}, {0x8b8d,0x00, 0, 0}, {0x8b8e, 0x00, 0, 0}, {0x8b8f, 0x00, 0, 0}, {0x8b90,0x00, 0, 0}, {0x8b91, 0x00, 0, 0}, {0x8b92, 0x00, 0, 0}, {0x8b93,0x00, 0, 0}, {0x8b94, 0x00, 0, 0}, {0x8b95, 0x00, 0, 0}, {0x8b96,0x00, 0, 0}, {0x8b97, 0x00, 0, 0}, {0x8b98, 0x00, 0, 0}, {0x8b99,0x00, 0, 0}, {0x8b9a, 0x00, 0, 0}, {0x8b9b, 0x00, 0, 0}, {0x8b9c,0x00, 0, 0}, {0x8b9d, 0x00, 0, 0}, {0x8b9e, 0x00, 0, 0}, {0x8b9f,0x00, 0, 0}, {0x8ba0, 0x00, 0, 0}, {0x8ba1, 0x00, 0, 0}, {0x8ba2,0x00, 0, 0}, {0x8ba3, 0x00, 0, 0}, {0x8ba4, 0x00, 0, 0}, {0x8ba5,0x00, 0, 0}, {0x8ba6, 0x00, 0, 0}, {0x8ba7, 0x00, 0, 0}, {0x8ba8,0x00, 0, 0}, {0x8ba9, 0x00, 0, 0}, {0x8baa, 0x00, 0, 0}, {0x8bab,0x00, 0, 0}, {0x8bac, 0x00, 0, 0}, {0x8bad, 0x00, 0, 0}, {0x8bae,0x00, 0, 0}, {0x8baf, 0x00, 0, 0}, {0x8bb0, 0x00, 0, 0}, {0x8bb1,0x00, 0, 0}, {0x8bb2, 0x00, 0, 0}, {0x8bb3, 0x00, 0, 0}, {0x8bb4,0x00, 0, 0}, {0x8bb5, 0x00, 0, 0}, {0x8bb6, 0x00, 0, 0}, {0x8bb7,0x00, 0, 0}, {0x8bb8, 0x00, 0, 0}, {0x8bb9, 0x00, 0, 0}, {0x8bba,0x00, 0, 0}, {0x8bbb, 0x00, 0, 0}, {0x8bbc, 0x00, 0, 0}, {0x8bbd,0x00, 0, 0}, {0x8bbe, 0x00, 0, 0}, {0x8bbf, 0x00, 0, 0}, {0x8bc0,0x00, 0, 0}, {0x8bc1, 0x00, 0, 0}, {0x8bc2, 0x00, 0, 0}, {0x8bc3,0x00, 0, 0}, {0x8bc4, 0x00, 0, 0}, {0x8bc5, 0x00, 0, 0}, {0x8bc6,0x00, 0, 0}, {0x8bc7, 0x00, 0, 0}, {0x8bc8, 0x00, 0, 0}, {0x8bc9,0x00, 0, 0}, {0x8bca, 0x00, 0, 0}, {0x8bcb, 0x00, 0, 0}, {0x8bcc,0x00, 0, 0}, {0x8bcd, 0x00, 0, 0}, {0x8bce, 0x00, 0, 0}, {0x8bcf,0x00, 0, 0}, {0x8bd0, 0x00, 0, 0}, {0x8bd1, 0x00, 0, 0}, {0x8bd2,0x00, 0, 0}, {0x8bd3, 0x00, 0, 0}, {0x8bd4, 0x00, 0, 0}, {0x8bd5,0x00, 0, 0}, {0x8bd6, 0x00, 0, 0}, {0x8bd7, 0x00, 0, 0}, {0x8bd8,0x00, 0, 0}, {0x8bd9, 0x00, 0, 0}, {0x8bda, 0x00, 0, 0}, {0x8bdb,0x00, 0, 0}, {0x8bdc, 0x00, 0, 0}, {0x8bdd, 0x00, 0, 0}, {0x8bde,0x00, 0, 0}, {0x8bdf, 0x00, 0, 0}, {0x8be0, 0x00, 0, 0}, {0x8be1,0x00, 0, 0}, {0x8be2, 0x00, 0, 0}, {0x8be3, 0x00, 0, 0}, {0x8be4,0x00, 0, 0}, {0x8be5, 0x00, 0, 0}, {0x8be6, 0x00, 0, 0}, {0x8be7,0x00, 0, 0}, {0x8be8, 0x00, 0, 0}, {0x8be9, 0x00, 0, 0}, {0x8bea,0x00, 0, 0}, {0x8beb, 0x00, 0, 0}, {0x8bec, 0x00, 0, 0}, {0x8bed,0x00, 0, 0}, {0x8bee, 0x00, 0, 0}, {0x8bef, 0x00, 0, 0}, {0x8bf0,0x00, 0, 0}, {0x8bf1, 0x00, 0, 0}, {0x8bf2, 0x00, 0, 0}, {0x8bf3,0x00, 0, 0}, {0x8bf4, 0x00, 0, 0}, {0x8bf5, 0x00, 0, 0}, {0x8bf6,0x00, 0, 0}, {0x8bf7, 0x00, 0, 0}, {0x8bf8, 0x00, 0, 0}, {0x8bf9,0x00, 0, 0}, {0x8bfa, 0x00, 0, 0}, {0x8bfb, 0x00, 0, 0}, {0x8bfc,0x00, 0, 0}, {0x8bfd, 0x00, 0, 0}, {0x8bfe, 0x00, 0, 0}, {0x8bff,0x00, 0, 0}, {0x8c00, 0x00, 0, 0}, {0x8c01, 0x00, 0, 0}, {0x8c02,0x00, 0, 0}, {0x8c03, 0x00, 0, 0}, {0x8c04, 0x00, 0, 0}, {0x8c05,0x00, 0, 0}, {0x8c06, 0x00, 0, 0}, {0x8c07, 0x00, 0, 0}, {0x8c08,0x00, 0, 0}, {0x8c09, 0x00, 0, 0}, {0x8c0a, 0x00, 0, 0}, {0x8c0b,0x00, 0, 0}, {0x8c0c, 0x00, 0, 0}, {0x8c0d, 0x00, 0, 0}, {0x8c0e,0x00, 0, 0}, {0x8c0f, 0x00, 0, 0}, {0x8c10, 0x00, 0, 0}, {0x8c11,0x00, 0, 0}, {0x8c12, 0x00, 0, 0}, {0x8c13, 0x00, 0, 0}, {0x8c14,0x00, 0, 0}, {0x8c15, 0x00, 0, 0}, {0x8c16, 0x00, 0, 0}, {0x8c17,0x00, 0, 0}, {0x8c18, 0x00, 0, 0}, {0x8c19, 0x00, 0, 0}, {0x8c1a,0x00, 0, 0}, {0x8c1b, 0x00, 0, 0}, {0x8c1c, 0x00, 0, 0}, {0x8c1d,0x00, 0, 0}, {0x8c1e, 0x00, 0, 0}, {0x8c1f, 0x00, 0, 0}, {0x8c20,0x00, 0, 0}, {0x8c21, 0x00, 0, 0}, {0x8c22, 0x00, 0, 0}, {0x8c23,0x00, 0, 0}, {0x8c24, 0x00, 0, 0}, {0x8c25, 0x00, 0, 0}, {0x8c26,0x00, 0, 0}, {0x8c27, 0x00, 0, 0}, {0x8c28, 0x00, 0, 0}, {0x8c29,0x00, 0, 0}, {0x8c2a, 0x00, 0, 0}, {0x8c2b, 0x00, 0, 0}, {0x8c2c,0x00, 0, 0}, {0x8c2d, 0x00, 0, 0}, {0x8c2e, 0x00, 0, 0}, {0x8c2f,0x00, 0, 0}, {0x8c30, 0x00, 0, 0}, {0x8c31, 0x00, 0, 0}, {0x8c32,0x00, 0, 0}, {0x8c33, 0x00, 0, 0}, {0x8c34, 0x00, 0, 0}, {0x8c35,0x00, 0, 0}, {0x8c36, 0x00, 0, 0}, {0x8c37, 0x00, 0, 0}, {0x8c38,0x00, 0, 0}, {0x8c39, 0x00, 0, 0}, {0x8c3a, 0x00, 0, 0}, {0x8c3b,0x00, 0, 0}, {0x8c3c, 0x00, 0, 0}, {0x8c3d, 0x00, 0, 0}, {0x8c3e,0x00, 0, 0}, {0x8c3f, 0x00, 0, 0}, {0x8c40, 0x00, 0, 0}, {0x8c41,0x00, 0, 0}, {0x8c42, 0x00, 0, 0}, {0x8c43, 0x00, 0, 0}, {0x8c44,0x00, 0, 0}, {0x8c45, 0x00, 0, 0}, {0x8c46, 0x00, 0, 0}, {0x8c47,0x00, 0, 0}, {0x8c48, 0x00, 0, 0}, {0x8c49, 0x00, 0, 0}, {0x8c4a,0x00, 0, 0}, {0x8c4b, 0x00, 0, 0}, {0x8c4c, 0x00, 0, 0}, {0x8c4d,0x00, 0, 0}, {0x8c4e, 0x00, 0, 0}, {0x8c4f, 0x00, 0, 0}, {0x8c50,0x00, 0, 0}, {0x8c51, 0x00, 0, 0}, {0x8c52, 0x00, 0, 0}, {0x8c53,0x00, 0, 0}, {0x8c54, 0x00, 0, 0}, {0x8c55, 0x00, 0, 0}, {0x8c56,0x00, 0, 0}, {0x8c57, 0x00, 0, 0}, {0x8c58, 0x00, 0, 0}, {0x8c59,0x00, 0, 0}, {0x8c5a, 0x00, 0, 0}, {0x8c5b, 0x00, 0, 0}, {0x8c5c,0x00, 0, 0}, {0x8c5d, 0x00, 0, 0}, {0x8c5e, 0x00, 0, 0}, {0x8c5f,0x00, 0, 0}, {0x8c60, 0x00, 0, 0}, {0x8c61, 0x00, 0, 0}, {0x8c62,0x00, 0, 0}, {0x8c63, 0x00, 0, 0}, {0x8c64, 0x00, 0, 0}, {0x8c65,0x00, 0, 0}, {0x8c66, 0x00, 0, 0}, {0x8c67, 0x00, 0, 0}, {0x8c68,0x00, 0, 0}, {0x8c69, 0x00, 0, 0}, {0x8c6a, 0x00, 0, 0}, {0x8c6b,0x00, 0, 0}, {0x8c6c, 0x00, 0, 0}, {0x8c6d, 0x00, 0, 0}, {0x8c6e,0x00, 0, 0}, {0x8c6f, 0x00, 0, 0}, {0x8c70, 0x00, 0, 0}, {0x8c71,0x00, 0, 0}, {0x8c72, 0x00, 0, 0}, {0x8c73, 0x00, 0, 0}, {0x8c74,0x00, 0, 0}, {0x8c75, 0x00, 0, 0}, {0x8c76, 0x00, 0, 0}, {0x8c77,0x00, 0, 0}, {0x8c78, 0x00, 0, 0}, {0x8c79, 0x00, 0, 0}, {0x8c7a,0x00, 0, 0}, {0x8c7b, 0x00, 0, 0}, {0x8c7c, 0x00, 0, 0}, {0x8c7d,0x00, 0, 0}, {0x8c7e, 0x00, 0, 0}, {0x8c7f, 0x00, 0, 0}, {0x8c80,0x00, 0, 0}, {0x8c81, 0x00, 0, 0}, {0x8c82, 0x00, 0, 0}, {0x8c83,0x00, 0, 0}, {0x8c84, 0x00, 0, 0}, {0x8c85, 0x00, 0, 0}, {0x8c86,0x00, 0, 0}, {0x8c87, 0x00, 0, 0}, {0x8c88, 0x00, 0, 0}, {0x8c89,0x00, 0, 0}, {0x8c8a, 0x00, 0, 0}, {0x8c8b, 0x00, 0, 0}, {0x8c8c,0x00, 0, 0}, {0x8c8d, 0x00, 0, 0}, {0x8c8e, 0x00, 0, 0}, {0x8c8f,0x00, 0, 0}, {0x8c90, 0x00, 0, 0}, {0x8c91, 0x00, 0, 0}, {0x8c92,0x00, 0, 0}, {0x8c93, 0x00, 0, 0}, {0x8c94, 0x00, 0, 0}, {0x8c95,0x00, 0, 0}, {0x8c96, 0x00, 0, 0}, {0x8c97, 0x00, 0, 0}, {0x8c98,0x00, 0, 0}, {0x8c99, 0x00, 0, 0}, {0x8c9a, 0x00, 0, 0}, {0x8c9b,0x00, 0, 0}, {0x8c9c, 0x00, 0, 0}, {0x8c9d, 0x00, 0, 0}, {0x8c9e,0x00, 0, 0}, {0x8c9f, 0x00, 0, 0}, {0x8ca0, 0x00, 0, 0}, {0x8ca1,0x00, 0, 0}, {0x8ca2, 0x00, 0, 0}, {0x8ca3, 0x00, 0, 0}, {0x8ca4,0x00, 0, 0}, {0x8ca5, 0x00, 0, 0}, {0x8ca6, 0x00, 0, 0}, {0x8ca7,0x00, 0, 0}, {0x8ca8, 0x00, 0, 0}, {0x8ca9, 0x00, 0, 0}, {0x8caa,0x00, 0, 0}, {0x8cab, 0x00, 0, 0}, {0x8cac, 0x00, 0, 0}, {0x8cad,0x00, 0, 0}, {0x8cae, 0x00, 0, 0}, {0x8caf, 0x00, 0, 0}, {0x8cb0,0x00, 0, 0}, {0x8cb1, 0x00, 0, 0}, {0x8cb2, 0x00, 0, 0}, {0x8cb3,0x00, 0, 0}, {0x8cb4, 0x00, 0, 0}, {0x8cb5, 0x00, 0, 0}, {0x8cb6,0x00, 0, 0}, {0x8cb7, 0x00, 0, 0}, {0x8cb8, 0x00, 0, 0}, {0x8cb9,0x00, 0, 0}, {0x8cba, 0x00, 0, 0}, {0x8cbb, 0x00, 0, 0}, {0x8cbc,0x00, 0, 0}, {0x8cbd, 0x00, 0, 0}, {0x8cbe, 0x00, 0, 0}, {0x8cbf,0x00, 0, 0}, {0x8cc0, 0x00, 0, 0}, {0x8cc1, 0x00, 0, 0}, {0x8cc2,0x00, 0, 0}, {0x8cc3, 0x00, 0, 0}, {0x8cc4, 0x00, 0, 0}, {0x8cc5,0x00, 0, 0}, {0x8cc6, 0x00, 0, 0}, {0x8cc7, 0x00, 0, 0}, {0x8cc8,0x00, 0, 0}, {0x8cc9, 0x00, 0, 0}, {0x8cca, 0x00, 0, 0}, {0x8ccb,0x00, 0, 0}, {0x8ccc, 0x00, 0, 0}, {0x8ccd, 0x00, 0, 0}, {0x8cce,0x00, 0, 0}, {0x8ccf, 0x00, 0, 0}, {0x8cd0, 0x00, 0, 0}, {0x8cd1,0x00, 0, 0}, {0x8cd2, 0x00, 0, 0}, {0x8cd3, 0x00, 0, 0}, {0x8cd4,0x00, 0, 0}, {0x8cd5, 0x00, 0, 0}, {0x8cd6, 0x00, 0, 0}, {0x8cd7,0x00, 0, 0}, {0x8cd8, 0x00, 0, 0}, {0x8cd9, 0x00, 0, 0}, {0x8cda,0x00, 0, 0}, {0x8cdb, 0x00, 0, 0}, {0x8cdc, 0x00, 0, 0}, {0x8cdd,0x00, 0, 0}, {0x8cde, 0x00, 0, 0}, {0x8cdf, 0x00, 0, 0}, {0x8ce0,0x00, 0, 0}, {0x8ce1, 0x00, 0, 0}, {0x8ce2, 0x00, 0, 0}, {0x8ce3,0x00, 0, 0}, {0x8ce4, 0x00, 0, 0}, {0x8ce5, 0x00, 0, 0}, {0x8ce6,0x00, 0, 0}, {0x8ce7, 0x00, 0, 0}, {0x8ce8, 0x00, 0, 0}, {0x8ce9,0x00, 0, 0}, {0x8cea, 0x00, 0, 0}, {0x8ceb, 0x00, 0, 0}, {0x8cec,0x00, 0, 0}, {0x8ced, 0x00, 0, 0}, {0x8cee, 0x00, 0, 0}, {0x8cef,0x00, 0, 0}, {0x8cf0, 0x00, 0, 0}, {0x8cf1, 0x00, 0, 0}, {0x8cf2,0x00, 0, 0}, {0x8cf3, 0x00, 0, 0}, {0x8cf4, 0x00, 0, 0}, {0x8cf5,0x00, 0, 0}, {0x8cf6, 0x00, 0, 0}, {0x8cf7, 0x00, 0, 0}, {0x8cf8,0x00, 0, 0}, {0x8cf9, 0x00, 0, 0}, {0x8cfa, 0x00, 0, 0}, {0x8cfb,0x00, 0, 0}, {0x8cfc, 0x00, 0, 0}, {0x8cfd, 0x00, 0, 0}, {0x8cfe,0x00, 0, 0}, {0x8cff, 0x00, 0, 0}, {0x8d00, 0x00, 0, 0}, {0x8d01,0x00, 0, 0}, {0x8d02, 0x00, 0, 0}, {0x8d03, 0x00, 0, 0}, {0x8d04,0x00, 0, 0}, {0x8d05, 0x00, 0, 0}, {0x8d06, 0x00, 0, 0}, {0x8d07,0x00, 0, 0}, {0x8d08, 0x00, 0, 0}, {0x8d09, 0x00, 0, 0}, {0x8d0a,0x00, 0, 0}, {0x8d0b, 0x00, 0, 0}, {0x8d0c, 0x00, 0, 0}, {0x8d0d,0x00, 0, 0}, {0x8d0e, 0x00, 0, 0}, {0x8d0f, 0x00, 0, 0}, {0x8d10,0x00, 0, 0}, {0x8d11, 0x00, 0, 0}, {0x8d12, 0x00, 0, 0}, {0x8d13,0x00, 0, 0}, {0x8d14, 0x00, 0, 0}, {0x8d15, 0x00, 0, 0}, {0x8d16,0x00, 0, 0}, {0x8d17, 0x00, 0, 0}, {0x8d18, 0x00, 0, 0}, {0x8d19,0x00, 0, 0}, {0x8d1a, 0x00, 0, 0}, {0x8d1b, 0x00, 0, 0}, {0x8d1c,0x00, 0, 0}, {0x8d1d, 0x00, 0, 0}, {0x8d1e, 0x00, 0, 0}, {0x8d1f,0x00, 0, 0}, {0x8d20, 0x00, 0, 0}, {0x8d21, 0x00, 0, 0}, {0x8d22,0x00, 0, 0}, {0x8d23, 0x00, 0, 0}, {0x8d24, 0x00, 0, 0}, {0x8d25,0x00, 0, 0}, {0x8d26, 0x00, 0, 0}, {0x8d27, 0x00, 0, 0}, {0x8d28,0x00, 0, 0}, {0x8d29, 0x00, 0, 0}, {0x8d2a, 0x00, 0, 0}, {0x8d2b,0x00, 0, 0}, {0x8d2c, 0x00, 0, 0}, {0x8d2d, 0x00, 0, 0}, {0x8d2e,0x00, 0, 0}, {0x8d2f, 0x00, 0, 0}, {0x8d30, 0x00, 0, 0}, {0x8d31,0x00, 0, 0}, {0x8d32, 0x00, 0, 0}, {0x8d33, 0x00, 0, 0}, {0x8d34,0x00, 0, 0}, {0x8d35, 0x00, 0, 0}, {0x8d36, 0x00, 0, 0}, {0x8d37,0x00, 0, 0}, {0x8d38, 0x00, 0, 0}, {0x8d39, 0x00, 0, 0}, {0x8d3a,0x00, 0, 0}, {0x8d3b, 0x00, 0, 0}, {0x8d3c, 0x00, 0, 0}, {0x8d3d,0x00, 0, 0}, {0x8d3e, 0x00, 0, 0}, {0x8d3f, 0x00, 0, 0}, {0x8d40,0x00, 0, 0}, {0x8d41, 0x00, 0, 0}, {0x8d42, 0x00, 0, 0}, {0x8d43,0x00, 0, 0}, {0x8d44, 0x00, 0, 0}, {0x8d45, 0x00, 0, 0}, {0x8d46,0x00, 0, 0}, {0x8d47, 0x00, 0, 0}, {0x8d48, 0x00, 0, 0}, {0x8d49,0x00, 0, 0}, {0x8d4a, 0x00, 0, 0}, {0x8d4b, 0x00, 0, 0}, {0x8d4c,0x00, 0, 0}, {0x8d4d, 0x00, 0, 0}, {0x8d4e, 0x00, 0, 0}, {0x8d4f,0x00, 0, 0}, {0x8d50, 0x00, 0, 0}, {0x8d51, 0x00, 0, 0}, {0x8d52,0x00, 0, 0}, {0x8d53, 0x00, 0, 0}, {0x8d54, 0x00, 0, 0}, {0x8d55,0x00, 0, 0}, {0x8d56, 0x00, 0, 0}, {0x8d57, 0x00, 0, 0}, {0x8d58,0x00, 0, 0}, {0x8d59, 0x00, 0, 0}, {0x8d5a, 0x00, 0, 0}, {0x8d5b,0x00, 0, 0}, {0x8d5c, 0x00, 0, 0}, {0x8d5d, 0x00, 0, 0}, {0x8d5e,0x00, 0, 0}, {0x8d5f, 0x00, 0, 0}, {0x8d60, 0x00, 0, 0}, {0x8d61,0x00, 0, 0}, {0x8d62, 0x00, 0, 0}, {0x8d63, 0x00, 0, 0}, {0x8d64,0x00, 0, 0}, {0x8d65, 0x00, 0, 0}, {0x8d66, 0x00, 0, 0}, {0x8d67,0x00, 0, 0}, {0x8d68, 0x00, 0, 0}, {0x8d69, 0x00, 0, 0}, {0x8d6a,0x00, 0, 0}, {0x8d6b, 0x00, 0, 0}, {0x8d6c, 0x00, 0, 0}, {0x8d6d,0x00, 0, 0}, {0x8d6e, 0x00, 0, 0}, {0x8d6f, 0x00, 0, 0}, {0x8d70,0x00, 0, 0}, {0x8d71, 0x00, 0, 0}, {0x8d72, 0x00, 0, 0}, {0x8d73,0x00, 0, 0}, {0x8d74, 0x00, 0, 0}, {0x8d75, 0x00, 0, 0}, {0x8d76,0x00, 0, 0}, {0x8d77, 0x00, 0, 0}, {0x8d78, 0x00, 0, 0}, {0x8d79,0x00, 0, 0}, {0x8d7a, 0x00, 0, 0}, {0x8d7b, 0x00, 0, 0}, {0x8d7c,0x00, 0, 0}, {0x8d7d, 0x00, 0, 0}, {0x8d7e, 0x00, 0, 0}, {0x8d7f,0x00, 0, 0}, {0x8d80, 0x00, 0, 0}, {0x8d81, 0x00, 0, 0}, {0x8d82,0x00, 0, 0}, {0x8d83, 0x00, 0, 0}, {0x8d84, 0x00, 0, 0}, {0x8d85,0x00, 0, 0}, {0x8d86, 0x00, 0, 0}, {0x8d87, 0x00, 0, 0}, {0x8d88,0x00, 0, 0}, {0x8d89, 0x00, 0, 0}, {0x8d8a, 0x00, 0, 0}, {0x8d8b,0x00, 0, 0}, {0x8d8c, 0x00, 0, 0}, {0x8d8d, 0x00, 0, 0}, {0x8d8e,0x00, 0, 0}, {0x8d8f, 0x00, 0, 0}, {0x8d90, 0x00, 0, 0}, {0x8d91,0x00, 0, 0}, {0x8d92, 0x00, 0, 0}, {0x8d93, 0x00, 0, 0}, {0x8d94,0x00, 0, 0}, {0x8d95, 0x00, 0, 0}, {0x8d96, 0x00, 0, 0}, {0x8d97,0x00, 0, 0}, {0x8d98, 0x00, 0, 0}, {0x8d99, 0x00, 0, 0}, {0x8d9a,0x00, 0, 0}, {0x8d9b, 0x00, 0, 0}, {0x8d9c, 0x00, 0, 0}, {0x8d9d,0x00, 0, 0}, {0x8d9e, 0x00, 0, 0}, {0x8d9f, 0x00, 0, 0}, {0x8da0,0x00, 0, 0}, {0x8da1, 0x00, 0, 0}, {0x8da2, 0x00, 0, 0}, {0x8da3,0x00, 0, 0}, {0x8da4, 0x00, 0, 0}, {0x8da5, 0x00, 0, 0}, {0x8da6,0x00, 0, 0}, {0x8da7, 0x00, 0, 0}, {0x8da8, 0x00, 0, 0}, {0x8da9,0x00, 0, 0}, {0x8daa, 0x00, 0, 0}, {0x8dab, 0x00, 0, 0}, {0x8dac,0x00, 0, 0}, {0x8dad, 0x00, 0, 0}, {0x8dae, 0x00, 0, 0}, {0x8daf,0x00, 0, 0}, {0x8db0, 0x00, 0, 0}, {0x8db1, 0x00, 0, 0}, {0x8db2,0x00, 0, 0}, {0x8db3, 0x00, 0, 0}, {0x8db4, 0x00, 0, 0}, {0x8db5,0x00, 0, 0}, {0x8db6, 0x00, 0, 0}, {0x8db7, 0x00, 0, 0}, {0x8db8,0x00, 0, 0}, {0x8db9, 0x00, 0, 0}, {0x8dba, 0x00, 0, 0}, {0x8dbb,0x00, 0, 0}, {0x8dbc, 0x00, 0, 0}, {0x8dbd, 0x00, 0, 0}, {0x8dbe,0x00, 0, 0}, {0x8dbf, 0x00, 0, 0}, {0x8dc0, 0x00, 0, 0}, {0x8dc1,0x00, 0, 0}, {0x8dc2, 0x00, 0, 0}, {0x8dc3, 0x00, 0, 0}, {0x8dc4,0x00, 0, 0}, {0x8dc5, 0x00, 0, 0}, {0x8dc6, 0x00, 0, 0}, {0x8dc7,0x00, 0, 0}, {0x8dc8, 0x00, 0, 0}, {0x8dc9, 0x00, 0, 0}, {0x8dca,0x00, 0, 0}, {0x8dcb, 0x00, 0, 0}, {0x8dcc, 0x00, 0, 0}, {0x8dcd,0x00, 0, 0}, {0x8dce, 0x00, 0, 0}, {0x8dcf, 0x00, 0, 0}, {0x8dd0,0x00, 0, 0}, {0x8dd1, 0x00, 0, 0}, {0x8dd2, 0x00, 0, 0}, {0x8dd3,0x00, 0, 0}, {0x8dd4, 0x00, 0, 0}, {0x8dd5, 0x00, 0, 0}, {0x8dd6,0x00, 0, 0}, {0x8dd7, 0x00, 0, 0}, {0x8dd8, 0x00, 0, 0}, {0x8dd9,0x00, 0, 0}, {0x8dda, 0x00, 0, 0}, {0x8ddb, 0x00, 0, 0}, {0x8ddc,0x00, 0, 0}, {0x8ddd, 0x00, 0, 0}, {0x8dde, 0x00, 0, 0}, {0x8ddf,0x00, 0, 0}, {0x8de0, 0x00, 0, 0}, {0x8de1, 0x00, 0, 0}, {0x8de2,0x00, 0, 0}, {0x8de3, 0x00, 0, 0}, {0x8de4, 0x00, 0, 0}, {0x8de5,0x00, 0, 0}, {0x8de6, 0x00, 0, 0}, {0x8de7, 0x00, 0, 0}, {0x8de8,0x00, 0, 0}, {0x8de9, 0x00, 0, 0}, {0x8dea, 0x00, 0, 0}, {0x8deb,0x00, 0, 0}, {0x8dec, 0x00, 0, 0}, {0x8ded, 0x00, 0, 0}, {0x8dee,0x00, 0, 0}, {0x8def, 0x00, 0, 0}, {0x8df0, 0x00, 0, 0}, {0x8df1,0x00, 0, 0}, {0x8df2, 0x00, 0, 0}, {0x8df3, 0x00, 0, 0}, {0x8df4,0x00, 0, 0}, {0x8df5, 0x00, 0, 0}, {0x8df6, 0x00, 0, 0}, {0x8df7,0x00, 0, 0}, {0x8df8, 0x00, 0, 0}, {0x8df9, 0x00, 0, 0}, {0x8dfa,0x00, 0, 0}, {0x8dfb, 0x00, 0, 0}, {0x8dfc, 0x00, 0, 0}, {0x8dfd,0x00, 0, 0}, {0x8dfe, 0x00, 0, 0}, {0x8dff, 0x00, 0, 0}, {0x8e00,0x11, 0, 0}, {0x8e01, 0x03, 0, 0}, {0x8e02, 0x21, 0, 0}, {0x8e03,0x14, 0, 0}, {0x8e04, 0x31, 0, 0}, {0x8e05, 0x31, 0, 0}, {0x8e06,0x4f, 0, 0}, {0x8e07, 0x56, 0, 0}, {0x8e08, 0x54, 0, 0}, {0x8e09,0x20, 0, 0}, {0x8e0a, 0x20, 0, 0}, {0x8e0b, 0x20, 0, 0}, {0x8e0c,0x20, 0, 0}, {0x8e0d, 0x20, 0, 0}, {0x8e0e, 0x20, 0, 0}, {0x8e0f,0x00, 0, 0}, {0x8e10, 0x10, 0, 0}, {0x8e11, 0x00, 0, 0}, {0x8e12,0x56, 0, 0}, {0x8e13, 0x40, 0, 0}, {0x8e14, 0x1a, 0, 0}, {0x8e15,0x30, 0, 0}, {0x8e16, 0x29, 0, 0}, {0x8e17, 0x7e, 0, 0}, {0x8e18,0x00, 0, 0}, {0x8e19, 0x30, 0, 0}, {0x8e1a, 0x04, 0, 0}, {0x8e1b,0x20, 0, 0}, {0x8e1c, 0xdf, 0, 0}, {0x8e1d, 0x30, 0, 0}, {0x8e1e,0x05, 0, 0}, {0x8e1f, 0x40, 0, 0}, {0x8e20, 0xbf, 0, 0}, {0x8e21,0x50, 0, 0}, {0x8e22, 0x25, 0, 0}, {0x8e23, 0x04, 0, 0}, {0x8e24,0xfb, 0, 0}, {0x8e25, 0x50, 0, 0}, {0x8e26, 0x03, 0, 0}, {0x8e27,0x00, 0, 0}, {0x8e28, 0xfd, 0, 0}, {0x8e29, 0x50, 0, 0}, {0x8e2a,0x27, 0, 0}, {0x8e2b, 0x01, 0, 0}, {0x8e2c, 0xfe, 0, 0}, {0x8e2d,0x60, 0, 0}, {0x8e2e, 0x00, 0, 0}, {0x8e2f, 0x11, 0, 0}, {0x8e30,0x00, 0, 0}, {0x8e31, 0x3f, 0, 0}, {0x8e32, 0x05, 0, 0}, {0x8e33,0x30, 0, 0}, {0x8e34, 0x00, 0, 0}, {0x8e35, 0x3f, 0, 0}, {0x8e36,0x06, 0, 0}, {0x8e37, 0x22, 0, 0}, {0x8e38, 0x00, 0, 0}, {0x8e39,0x3f, 0, 0}, {0x8e3a, 0x01, 0, 0}, {0x8e3b, 0x29, 0, 0}, {0x8e3c,0x00, 0, 0}, {0x8e3d, 0x3f, 0, 0}, {0x8e3e, 0x02, 0, 0}, {0x8e3f,0x00, 0, 0}, {0x8e40, 0x00, 0, 0}, {0x8e41, 0x36, 0, 0}, {0x8e42,0x06, 0, 0}, {0x8e43, 0x07, 0, 0}, {0x8e44, 0x00, 0, 0}, {0x8e45,0x3f, 0, 0}, {0x8e46, 0x0b, 0, 0}, {0x8e47, 0x0f, 0, 0}, {0x8e48,0xf0, 0, 0}, {0x8e49, 0x30, 0, 0}, {0x8e4a, 0x01, 0, 0}, {0x8e4b,0x40, 0, 0}, {0x8e4c, 0xbf, 0, 0}, {0x8e4d, 0x30, 0, 0}, {0x8e4e,0x01, 0, 0}, {0x8e4f, 0x00, 0, 0}, {0x8e50, 0xbf, 0, 0}, {0x8e51,0x30, 0, 0}, {0x8e52, 0x29, 0, 0}, {0x8e53, 0x70, 0, 0}, {0x8e54,0x00, 0, 0}, {0x8e55, 0x3a, 0, 0}, {0x8e56, 0x00, 0, 0}, {0x8e57,0x01, 0, 0}, {0x8e58, 0xfe, 0, 0}, {0x8e59, 0x3a, 0, 0}, {0x8e5a,0x00, 0, 0}, {0x8e5b, 0x00, 0, 0}, {0x8e5c, 0xfe, 0, 0}, {0x8e5d,0x36, 0, 0}, {0x8e5e, 0x03, 0, 0}, {0x8e5f, 0x36, 0, 0}, {0x8e60,0x02, 0, 0}, {0x8e61, 0x41, 0, 0}, {0x8e62, 0x44, 0, 0}, {0x8e63,0x58, 0, 0}, {0x8e64, 0x20, 0, 0}, {0x8e65, 0x18, 0, 0}, {0x8e66,0x10, 0, 0}, {0x8e67, 0x0a, 0, 0}, {0x8e68, 0x04, 0, 0}, {0x8e69,0x04, 0, 0}, {0x8e6a, 0x00, 0, 0}, {0x8e6b, 0x03, 0, 0}, {0x8e6c,0xff, 0, 0}, {0x8e6d, 0x64, 0, 0}, {0x8e6e, 0x00, 0, 0}, {0x8e6f,0x00, 0, 0}, {0x8e70, 0x80, 0, 0}, {0x8e71, 0x00, 0, 0}, {0x8e72,0x00, 0, 0}, {0x8e73, 0x00, 0, 0}, {0x8e74, 0x00, 0, 0}, {0x8e75,0x00, 0, 0}, {0x8e76, 0x00, 0, 0}, {0x8e77, 0x02, 0, 0}, {0x8e78,0x04, 0, 0}, {0x8e79, 0x06, 0, 0}, {0x8e7a, 0x00, 0, 0}, {0x8e7b,0x03, 0, 0}, {0x8e7c, 0x98, 0, 0}, {0x8e7d, 0x00, 0, 0}, {0x8e7e,0xcc, 0, 0}, {0x8e7f, 0x50, 0, 0}, {0x8e80, 0x3c, 0, 0}, {0x8e81,0x28, 0, 0}, {0x8e82, 0x1e, 0, 0}, {0x8e83, 0x10, 0, 0}, {0x8e84,0x10, 0, 0}, {0x8e85, 0x00, 0, 0}, {0x8e86, 0x00, 0, 0}, {0x8e87,0x00, 0, 0}, {0x8e88, 0x6e, 0, 0}, {0x8e89, 0x05, 0, 0}, {0x8e8a,0x05, 0, 0}, {0x8e8b, 0x00, 0, 0}, {0x8e8c, 0xa5, 0, 0}, {0x8e8d,0x5a, 0, 0}, /* un-documented registers */ {0x3022, 0x00, 0, 0}, {0x3023, 0x00, 0, 0}, {0x3024,0x00, 0, 0}, {0x3025, 0x00, 0, 0}, {0x3026, 0x00, 0, 0}, {0x3027,0x00, 0, 0}, {0x3028, 0x00, 0, 0}, {0x3029, 0xff, 0, 0} }; static struct reg_value ov5640_init_setting_30fps_VGA[] = { {0x3103, 0x11, 0, 0}, {0x3008, 0x82, 0, 5}, {0x3008, 0x42, 0, 0}, {0x3103, 0x03, 0, 0}, {0x3017, 0x00, 0, 0}, {0x3018, 0x00, 0, 0}, {0x3034, 0x18, 0, 0}, {0x3035, 0x14, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3037, 0x13, 0, 0}, {0x3108, 0x01, 0, 0}, {0x3630, 0x36, 0, 0}, {0x3631, 0x0e, 0, 0}, {0x3632, 0xe2, 0, 0}, {0x3633, 0x12, 0, 0}, {0x3621, 0xe0, 0, 0}, {0x3704, 0xa0, 0, 0}, {0x3703, 0x5a, 0, 0}, {0x3715, 0x78, 0, 0}, {0x3717, 0x01, 0, 0}, {0x370b, 0x60, 0, 0}, {0x3705, 0x1a, 0, 0}, {0x3905, 0x02, 0, 0}, {0x3906, 0x10, 0, 0}, {0x3901, 0x0a, 0, 0}, {0x3731, 0x12, 0, 0}, {0x3600, 0x08, 0, 0}, {0x3601, 0x33, 0, 0}, {0x302d, 0x60, 0, 0}, {0x3620, 0x52, 0, 0}, {0x371b, 0x20, 0, 0}, {0x471c, 0x50, 0, 0}, {0x3a13, 0x43, 0, 0}, {0x3a18, 0x00, 0, 0}, {0x3a19, 0xf8, 0, 0}, {0x3635, 0x13, 0, 0}, {0x3636, 0x03, 0, 0}, {0x3634, 0x40, 0, 0}, {0x3622, 0x01, 0, 0}, {0x3c01, 0xa4, 0, 0}, {0x3c04, 0x28, 0, 0}, {0x3c05, 0x98, 0, 0}, {0x3c06, 0x00, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c08, 0x00, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0}, {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x3000, 0x00, 0, 0}, {0x3002, 0x1c, 0, 0}, {0x3004, 0xff, 0, 0}, {0x3006, 0xc3, 0, 0}, {0x300e, 0x45, 0, 0}, {0x302e, 0x08, 0, 0}, {0x4300, 0x3f, 0, 0}, {0x501f, 0x00, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x440e, 0x00, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x4837, 0x0a, 0, 0}, {0x4800, 0x04, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5000, 0xa7, 0, 0}, {0x5001, 0xa3, 0, 0}, {0x5180, 0xff, 0, 0}, {0x5181, 0xf2, 0, 0}, {0x5182, 0x00, 0, 0}, {0x5183, 0x14, 0, 0}, {0x5184, 0x25, 0, 0}, {0x5185, 0x24, 0, 0}, {0x5186, 0x09, 0, 0}, {0x5187, 0x09, 0, 0}, {0x5188, 0x09, 0, 0}, {0x5189, 0x88, 0, 0}, {0x518a, 0x54, 0, 0}, {0x518b, 0xee, 0, 0}, {0x518c, 0xb2, 0, 0}, {0x518d, 0x50, 0, 0}, {0x518e, 0x34, 0, 0}, {0x518f, 0x6b, 0, 0}, {0x5190, 0x46, 0, 0}, {0x5191, 0xf8, 0, 0}, {0x5192, 0x04, 0, 0}, {0x5193, 0x70, 0, 0}, {0x5194, 0xf0, 0, 0}, {0x5195, 0xf0, 0, 0}, {0x5196, 0x03, 0, 0}, {0x5197, 0x01, 0, 0}, {0x5198, 0x04, 0, 0}, {0x5199, 0x6c, 0, 0}, {0x519a, 0x04, 0, 0}, {0x519b, 0x00, 0, 0}, {0x519c, 0x09, 0, 0}, {0x519d, 0x2b, 0, 0}, {0x519e, 0x38, 0, 0}, {0x5381, 0x1e, 0, 0}, {0x5382, 0x5b, 0, 0}, {0x5383, 0x08, 0, 0}, {0x5384, 0x0a, 0, 0}, {0x5385, 0x7e, 0, 0}, {0x5386, 0x88, 0, 0}, {0x5387, 0x7c, 0, 0}, {0x5388, 0x6c, 0, 0}, {0x5389, 0x10, 0, 0}, {0x538a, 0x01, 0, 0}, {0x538b, 0x98, 0, 0}, {0x5300, 0x08, 0, 0}, {0x5301, 0x30, 0, 0}, {0x5302, 0x10, 0, 0}, {0x5303, 0x00, 0, 0}, {0x5304, 0x08, 0, 0}, {0x5305, 0x30, 0, 0}, {0x5306, 0x08, 0, 0}, {0x5307, 0x16, 0, 0}, {0x5309, 0x08, 0, 0}, {0x530a, 0x30, 0, 0}, {0x530b, 0x04, 0, 0}, {0x530c, 0x06, 0, 0}, {0x5480, 0x01, 0, 0}, {0x5481, 0x08, 0, 0}, {0x5482, 0x14, 0, 0}, {0x5483, 0x28, 0, 0}, {0x5484, 0x51, 0, 0}, {0x5485, 0x65, 0, 0}, {0x5486, 0x71, 0, 0}, {0x5487, 0x7d, 0, 0}, {0x5488, 0x87, 0, 0}, {0x5489, 0x91, 0, 0}, {0x548a, 0x9a, 0, 0}, {0x548b, 0xaa, 0, 0}, {0x548c, 0xb8, 0, 0}, {0x548d, 0xcd, 0, 0}, {0x548e, 0xdd, 0, 0}, {0x548f, 0xea, 0, 0}, {0x5490, 0x1d, 0, 0}, {0x5580, 0x02, 0, 0}, {0x5583, 0x40, 0, 0}, {0x5584, 0x10, 0, 0}, {0x5589, 0x10, 0, 0}, {0x558a, 0x00, 0, 0}, {0x558b, 0xf8, 0, 0}, {0x5800, 0x23, 0, 0}, {0x5801, 0x14, 0, 0}, {0x5802, 0x0f, 0, 0}, {0x5803, 0x0f, 0, 0}, {0x5804, 0x12, 0, 0}, {0x5805, 0x26, 0, 0}, {0x5806, 0x0c, 0, 0}, {0x5807, 0x08, 0, 0}, {0x5808, 0x05, 0, 0}, {0x5809, 0x05, 0, 0}, {0x580a, 0x08, 0, 0}, {0x580b, 0x0d, 0, 0}, {0x580c, 0x08, 0, 0}, {0x580d, 0x03, 0, 0}, {0x580e, 0x00, 0, 0}, {0x580f, 0x00, 0, 0}, {0x5810, 0x03, 0, 0}, {0x5811, 0x09, 0, 0}, {0x5812, 0x07, 0, 0}, {0x5813, 0x03, 0, 0}, {0x5814, 0x00, 0, 0}, {0x5815, 0x01, 0, 0}, {0x5816, 0x03, 0, 0}, {0x5817, 0x08, 0, 0}, {0x5818, 0x0d, 0, 0}, {0x5819, 0x08, 0, 0}, {0x581a, 0x05, 0, 0}, {0x581b, 0x06, 0, 0}, {0x581c, 0x08, 0, 0}, {0x581d, 0x0e, 0, 0}, {0x581e, 0x29, 0, 0}, {0x581f, 0x17, 0, 0}, {0x5820, 0x11, 0, 0}, {0x5821, 0x11, 0, 0}, {0x5822, 0x15, 0, 0}, {0x5823, 0x28, 0, 0}, {0x5824, 0x46, 0, 0}, {0x5825, 0x26, 0, 0}, {0x5826, 0x08, 0, 0}, {0x5827, 0x26, 0, 0}, {0x5828, 0x64, 0, 0}, {0x5829, 0x26, 0, 0}, {0x582a, 0x24, 0, 0}, {0x582b, 0x22, 0, 0}, {0x582c, 0x24, 0, 0}, {0x582d, 0x24, 0, 0}, {0x582e, 0x06, 0, 0}, {0x582f, 0x22, 0, 0}, {0x5830, 0x40, 0, 0}, {0x5831, 0x42, 0, 0}, {0x5832, 0x24, 0, 0}, {0x5833, 0x26, 0, 0}, {0x5834, 0x24, 0, 0}, {0x5835, 0x22, 0, 0}, {0x5836, 0x22, 0, 0}, {0x5837, 0x26, 0, 0}, {0x5838, 0x44, 0, 0}, {0x5839, 0x24, 0, 0}, {0x583a, 0x26, 0, 0}, {0x583b, 0x28, 0, 0}, {0x583c, 0x42, 0, 0}, {0x583d, 0xce, 0, 0}, {0x5025, 0x00, 0, 0}, {0x3a0f, 0x30, 0, 0}, {0x3a10, 0x28, 0, 0}, {0x3a1b, 0x30, 0, 0}, {0x3a1e, 0x26, 0, 0}, {0x3a11, 0x60, 0, 0}, {0x3a1f, 0x14, 0, 0}, {0x3008, 0x02, 0, 0}, {0x3c00, 0x04, 0, 300}, }; static struct reg_value ov5640_setting_30fps_VGA_640_480[] = { {0x3035, 0x14, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0}, {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x04, 0, 0}, {0x380f, 0x38, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x0e, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, {0x3503, 0x00, 0, 0}, }; static struct reg_value ov5640_setting_15fps_VGA_640_480[] = { {0x3035, 0x22, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0}, {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, }; static struct reg_value ov5640_setting_30fps_XGA_1024_768[] = { {0x3035, 0x14, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0}, {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x04, 0, 0}, {0x380f, 0x38, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x0e, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, {0x3503, 0x00, 0, 0}, {0x3808, 0x04, 0, 0}, {0x3809, 0x00, 0, 0}, {0x380a, 0x03, 0, 0}, {0x380b, 0x00, 0, 0}, {0x3035, 0x12, 0, 0}, }; static struct reg_value ov5640_setting_15fps_XGA_1024_768[] = { {0x3035, 0x22, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0}, {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, {0x3808, 0x04, 0, 0}, {0x3809, 0x00, 0, 0}, {0x380a, 0x03, 0, 0}, {0x380b, 0x00, 0, 0}, }; static struct reg_value ov5640_setting_30fps_QVGA_320_240[] = { {0x3035, 0x14, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x01, 0, 0}, {0x3809, 0x40, 0, 0}, {0x380a, 0x00, 0, 0}, {0x380b, 0xf0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, }; static struct reg_value ov5640_setting_15fps_QVGA_320_240[] = { {0x3035, 0x22, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x01, 0, 0}, {0x3809, 0x40, 0, 0}, {0x380a, 0x00, 0, 0}, {0x380b, 0xf0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, }; static struct reg_value ov5640_setting_30fps_QCIF_176_144[] = { {0x3035, 0x14, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x00, 0, 0}, {0x3809, 0xb0, 0, 0}, {0x380a, 0x00, 0, 0}, {0x380b, 0x90, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, }; static struct reg_value ov5640_setting_15fps_QCIF_176_144[] = { {0x3035, 0x22, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x00, 0, 0}, {0x3809, 0xb0, 0, 0}, {0x380a, 0x00, 0, 0}, {0x380b, 0x90, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, }; static struct reg_value ov5640_setting_30fps_NTSC_720_480[] = { {0x3035, 0x12, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x02, 0, 0}, {0x3809, 0xd0, 0, 0}, {0x380a, 0x01, 0, 0}, {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x3c, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, }; static struct reg_value ov5640_setting_15fps_NTSC_720_480[] = { {0x3035, 0x22, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x02, 0, 0}, {0x3809, 0xd0, 0, 0}, {0x380a, 0x01, 0, 0}, {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x3c, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, }; static struct reg_value ov5640_setting_30fps_PAL_720_576[] = { {0x3035, 0x12, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x02, 0, 0}, {0x3809, 0xd0, 0, 0}, {0x380a, 0x02, 0, 0}, {0x380b, 0x40, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x38, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, }; static struct reg_value ov5640_setting_15fps_PAL_720_576[] = { {0x3035, 0x22, 0, 0}, {0x3036, 0x38, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0}, {0x3808, 0x02, 0, 0}, {0x3809, 0xd0, 0, 0}, {0x380a, 0x02, 0, 0}, {0x380b, 0x40, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0}, {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x38, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, }; static struct reg_value ov5640_setting_30fps_720P_1280_720[] = { {0x3008, 0x42, 0, 0}, {0x3035, 0x21, 0, 0}, {0x3036, 0x54, 0, 0}, {0x3c07, 0x07, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0xfa, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x06, 0, 0}, {0x3807, 0xa9, 0, 0}, {0x3808, 0x05, 0, 0}, {0x3809, 0x00, 0, 0}, {0x380a, 0x02, 0, 0}, {0x380b, 0xd0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x64, 0, 0}, {0x380e, 0x02, 0, 0}, {0x380f, 0xe4, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x02, 0, 0}, {0x3a03, 0xe4, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0xbc, 0, 0}, {0x3a0a, 0x01, 0, 0}, {0x3a0b, 0x72, 0, 0}, {0x3a0e, 0x01, 0, 0}, {0x3a0d, 0x02, 0, 0}, {0x3a14, 0x02, 0, 0}, {0x3a15, 0xe4, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x02, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x37, 0, 0}, {0x460c, 0x20, 0, 0}, {0x3824, 0x04, 0, 0}, {0x5001, 0x83, 0, 0}, {0x4005, 0x1a, 0, 0}, {0x3008, 0x02, 0, 0}, {0x3503, 0, 0, 0}, }; static struct reg_value ov5640_setting_15fps_720P_1280_720[] = { {0x3035, 0x41, 0, 0}, {0x3036, 0x54, 0, 0}, {0x3c07, 0x07, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x41, 0, 0}, {0x3821, 0x07, 0, 0}, {0x3814, 0x31, 0, 0}, {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0xfa, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x06, 0, 0}, {0x3807, 0xa9, 0, 0}, {0x3808, 0x05, 0, 0}, {0x3809, 0x00, 0, 0}, {0x380a, 0x02, 0, 0}, {0x380b, 0xd0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x64, 0, 0}, {0x380e, 0x02, 0, 0}, {0x380f, 0xe4, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0}, {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x02, 0, 0}, {0x3a03, 0xe4, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0xbc, 0, 0}, {0x3a0a, 0x01, 0, 0}, {0x3a0b, 0x72, 0, 0}, {0x3a0e, 0x01, 0, 0}, {0x3a0d, 0x02, 0, 0}, {0x3a14, 0x02, 0, 0}, {0x3a15, 0xe4, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x02, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x37, 0, 0}, {0x460c, 0x20, 0, 0}, {0x3824, 0x04, 0, 0}, {0x5001, 0x83, 0, 0}, }; static struct reg_value ov5640_setting_30fps_1080P_1920_1080[] = { {0x3008, 0x42, 0, 0}, {0x3035, 0x21, 0, 0}, {0x3036, 0x54, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x40, 0, 0}, {0x3821, 0x06, 0, 0}, {0x3814, 0x11, 0, 0}, {0x3815, 0x11, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x00, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9f, 0, 0}, {0x3808, 0x0a, 0, 0}, {0x3809, 0x20, 0, 0}, {0x380a, 0x07, 0, 0}, {0x380b, 0x98, 0, 0}, {0x380c, 0x0b, 0, 0}, {0x380d, 0x1c, 0, 0}, {0x380e, 0x07, 0, 0}, {0x380f, 0xb0, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0}, {0x3618, 0x04, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x21, 0, 0}, {0x3709, 0x12, 0, 0}, {0x370c, 0x00, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x06, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0x83, 0, 0}, {0x3035, 0x11, 0, 0}, {0x3036, 0x54, 0, 0}, {0x3c07, 0x07, 0, 0}, {0x3c08, 0x00, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3800, 0x01, 0, 0}, {0x3801, 0x50, 0, 0}, {0x3802, 0x01, 0, 0}, {0x3803, 0xb2, 0, 0}, {0x3804, 0x08, 0, 0}, {0x3805, 0xef, 0, 0}, {0x3806, 0x05, 0, 0}, {0x3807, 0xf1, 0, 0}, {0x3808, 0x07, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x04, 0, 0}, {0x380b, 0x38, 0, 0}, {0x380c, 0x09, 0, 0}, {0x380d, 0xc4, 0, 0}, {0x380e, 0x04, 0, 0}, {0x380f, 0x60, 0, 0}, {0x3612, 0x2b, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3a02, 0x04, 0, 0}, {0x3a03, 0x60, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x50, 0, 0}, {0x3a0a, 0x01, 0, 0}, {0x3a0b, 0x18, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x04, 0, 0}, {0x3a15, 0x60, 0, 0}, {0x4713, 0x02, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x37, 0, 0}, {0x460c, 0x20, 0, 0}, {0x3824, 0x04, 0, 0}, {0x4005, 0x1a, 0, 0}, {0x3008, 0x02, 0, 0}, {0x3503, 0, 0, 0}, }; static struct reg_value ov5640_setting_15fps_1080P_1920_1080[] = { {0x3008, 0x42, 0, 0}, {0x3035, 0x21, 0, 0}, {0x3036, 0x54, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x40, 0, 0}, {0x3821, 0x06, 0, 0}, {0x3814, 0x11, 0, 0}, {0x3815, 0x11, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x00, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9f, 0, 0}, {0x3808, 0x0a, 0, 0}, {0x3809, 0x20, 0, 0}, {0x380a, 0x07, 0, 0}, {0x380b, 0x98, 0, 0}, {0x380c, 0x0b, 0, 0}, {0x380d, 0x1c, 0, 0}, {0x380e, 0x07, 0, 0}, {0x380f, 0xb0, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0}, {0x3618, 0x04, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x21, 0, 0}, {0x3709, 0x12, 0, 0}, {0x370c, 0x00, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x06, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0x83, 0, 0}, {0x3035, 0x21, 0, 0}, {0x3036, 0x54, 0, 1}, {0x3c07, 0x07, 0, 0}, {0x3c08, 0x00, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3800, 0x01, 0, 0}, {0x3801, 0x50, 0, 0}, {0x3802, 0x01, 0, 0}, {0x3803, 0xb2, 0, 0}, {0x3804, 0x08, 0, 0}, {0x3805, 0xef, 0, 0}, {0x3806, 0x05, 0, 0}, {0x3807, 0xf1, 0, 0}, {0x3808, 0x07, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x04, 0, 0}, {0x380b, 0x38, 0, 0}, {0x380c, 0x09, 0, 0}, {0x380d, 0xc4, 0, 0}, {0x380e, 0x04, 0, 0}, {0x380f, 0x60, 0, 0}, {0x3612, 0x2b, 0, 0}, {0x3708, 0x64, 0, 0}, {0x3a02, 0x04, 0, 0}, {0x3a03, 0x60, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x50, 0, 0}, {0x3a0a, 0x01, 0, 0}, {0x3a0b, 0x18, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x04, 0, 0}, {0x3a15, 0x60, 0, 0}, {0x4713, 0x02, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x37, 0, 0}, {0x460c, 0x20, 0, 0}, {0x3824, 0x04, 0, 0}, {0x4005, 0x1a, 0, 0}, {0x3008, 0x02, 0, 0}, {0x3503, 0, 0, 0}, }; static struct reg_value ov5640_setting_15fps_QSXGA_2592_1944[] = { {0x4202, 0x0f, 0, 0}, /* stream off the sensor */ {0x3820, 0x40, 0, 0}, {0x3821, 0x06, 0, 0}, /*disable flip*/ {0x3035, 0x21, 0, 0}, {0x3036, 0x54, 0, 0}, {0x3c07, 0x08, 0, 0}, {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0}, {0x3820, 0x40, 0, 0}, {0x3821, 0x06, 0, 0}, {0x3814, 0x11, 0, 0}, {0x3815, 0x11, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0}, {0x3802, 0x00, 0, 0}, {0x3803, 0x00, 0, 0}, {0x3804, 0x0a, 0, 0}, {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9f, 0, 0}, {0x3808, 0x0a, 0, 0}, {0x3809, 0x20, 0, 0}, {0x380a, 0x07, 0, 0}, {0x380b, 0x98, 0, 0}, {0x380c, 0x0b, 0, 0}, {0x380d, 0x1c, 0, 0}, {0x380e, 0x07, 0, 0}, {0x380f, 0xb0, 0, 0}, {0x3810, 0x00, 0, 0}, {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0}, {0x3618, 0x04, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x21, 0, 0}, {0x3709, 0x12, 0, 0}, {0x370c, 0x00, 0, 0}, {0x3a02, 0x03, 0, 0}, {0x3a03, 0xd8, 0, 0}, {0x3a08, 0x01, 0, 0}, {0x3a09, 0x27, 0, 0}, {0x3a0a, 0x00, 0, 0}, {0x3a0b, 0xf6, 0, 0}, {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0}, {0x4001, 0x02, 0, 0}, {0x4004, 0x06, 0, 0}, {0x4713, 0x03, 0, 0}, {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0}, {0x3824, 0x02, 0, 0}, {0x5001, 0x83, 0, 70}, {0x4202, 0x00, 0, 0}, /* stream on the sensor */ }; static struct ov5640_mode_info ov5640_mode_info_data[2][ov5640_mode_MAX + 1] = { { {ov5640_mode_VGA_640_480, SUBSAMPLING, 640, 480, ov5640_setting_15fps_VGA_640_480, ARRAY_SIZE(ov5640_setting_15fps_VGA_640_480)}, {ov5640_mode_QVGA_320_240, SUBSAMPLING, 320, 240, ov5640_setting_15fps_QVGA_320_240, ARRAY_SIZE(ov5640_setting_15fps_QVGA_320_240)}, {ov5640_mode_NTSC_720_480, SUBSAMPLING, 720, 480, ov5640_setting_15fps_NTSC_720_480, ARRAY_SIZE(ov5640_setting_15fps_NTSC_720_480)}, {ov5640_mode_PAL_720_576, SUBSAMPLING, 720, 576, ov5640_setting_15fps_PAL_720_576, ARRAY_SIZE(ov5640_setting_15fps_PAL_720_576)}, {ov5640_mode_720P_1280_720, SUBSAMPLING, 1280, 720, ov5640_setting_15fps_720P_1280_720, ARRAY_SIZE(ov5640_setting_15fps_720P_1280_720)}, {ov5640_mode_1080P_1920_1080, SCALING, 1920, 1080, ov5640_setting_15fps_1080P_1920_1080, ARRAY_SIZE(ov5640_setting_15fps_1080P_1920_1080)}, {ov5640_mode_QSXGA_2592_1944, SCALING, 2592, 1944, ov5640_setting_15fps_QSXGA_2592_1944, ARRAY_SIZE(ov5640_setting_15fps_QSXGA_2592_1944)}, {ov5640_mode_QCIF_176_144, SUBSAMPLING, 176, 144, ov5640_setting_15fps_QCIF_176_144, ARRAY_SIZE(ov5640_setting_15fps_QCIF_176_144)}, {ov5640_mode_XGA_1024_768, SUBSAMPLING, 1024, 768, ov5640_setting_15fps_XGA_1024_768, ARRAY_SIZE(ov5640_setting_15fps_XGA_1024_768)}, }, { {ov5640_mode_VGA_640_480, SUBSAMPLING, 640, 480, ov5640_setting_30fps_VGA_640_480, ARRAY_SIZE(ov5640_setting_30fps_VGA_640_480)}, {ov5640_mode_QVGA_320_240, SUBSAMPLING, 320, 240, ov5640_setting_30fps_QVGA_320_240, ARRAY_SIZE(ov5640_setting_30fps_QVGA_320_240)}, {ov5640_mode_NTSC_720_480, SUBSAMPLING, 720, 480, ov5640_setting_30fps_NTSC_720_480, ARRAY_SIZE(ov5640_setting_30fps_NTSC_720_480)}, {ov5640_mode_PAL_720_576, SUBSAMPLING, 720, 576, ov5640_setting_30fps_PAL_720_576, ARRAY_SIZE(ov5640_setting_30fps_PAL_720_576)}, {ov5640_mode_720P_1280_720, SUBSAMPLING, 1280, 720, ov5640_setting_30fps_720P_1280_720, ARRAY_SIZE(ov5640_setting_30fps_720P_1280_720)}, {ov5640_mode_1080P_1920_1080, SCALING, 1920, 1080, ov5640_setting_30fps_1080P_1920_1080, ARRAY_SIZE(ov5640_setting_30fps_1080P_1920_1080)}, {ov5640_mode_QSXGA_2592_1944, -1, 0, 0, NULL, 0}, {ov5640_mode_QCIF_176_144, SUBSAMPLING, 176, 144, ov5640_setting_30fps_QCIF_176_144, ARRAY_SIZE(ov5640_setting_30fps_QCIF_176_144)}, {ov5640_mode_XGA_1024_768, SUBSAMPLING, 1024, 768, ov5640_setting_30fps_XGA_1024_768, ARRAY_SIZE(ov5640_setting_30fps_XGA_1024_768)}, }, }; static struct regulator *io_regulator; static struct regulator *core_regulator; static struct regulator *analog_regulator; static struct regulator *gpo_regulator; static struct fsl_mxc_camera_platform_data *camera_plat; static int ov5640_probe(struct i2c_client *adapter, const struct i2c_device_id *device_id); static int ov5640_remove(struct i2c_client *client); static s32 ov5640_read_reg(u16 reg, u8 *val); static s32 ov5640_write_reg(u16 reg, u8 val); static const struct i2c_device_id ov5640_id[] = { {"ov5640_mipi", 0}, {}, }; MODULE_DEVICE_TABLE(i2c, ov5640_id); static struct i2c_driver ov5640_i2c_driver = { .driver = { .owner = THIS_MODULE, .name = "ov5640_mipi", }, .probe = ov5640_probe, .remove = ov5640_remove, .id_table = ov5640_id, }; static s32 update_device_addr(struct sensor_data *sensor) { int ret; u8 buf[4]; unsigned reg = 0x3100; unsigned default_addr = 0x3c; struct i2c_msg msg; if (sensor->i2c_client->addr == default_addr) return 0; buf[0] = reg >> 8; buf[1] = reg & 0xff; buf[2] = sensor->i2c_client->addr << 1; msg.addr = default_addr; msg.flags = 0; msg.len = 3; msg.buf = buf; ret = i2c_transfer(sensor->i2c_client->adapter, &msg, 1); if (ret < 0) pr_err("%s: ov5640_mipi ret=%d\n", __func__, ret); return ret; } static s32 ov5640_write_reg(u16 reg, u8 val) { u8 au8Buf[3] = {0}; au8Buf[0] = reg >> 8; au8Buf[1] = reg & 0xff; au8Buf[2] = val; if (i2c_master_send(ov5640_data.i2c_client, au8Buf, 3) < 0) { pr_err("%s:write reg error:reg=%x,val=%x\n", __func__, reg, val); return -1; } pr_debug("reg=%x,val=%x\n", reg, val); return 0; } static s32 ov5640_read_reg(u16 reg, u8 *val) { u8 au8RegBuf[2] = {0}; u8 u8RdVal = 0; au8RegBuf[0] = reg >> 8; au8RegBuf[1] = reg & 0xff; if (2 != i2c_master_send(ov5640_data.i2c_client, au8RegBuf, 2)) { pr_err("%s:write reg error:reg=%x\n", __func__, reg); return -1; } if (1 != i2c_master_recv(ov5640_data.i2c_client, &u8RdVal, 1)) { pr_err("%s:read reg error:reg=%x,val=%x\n", __func__, reg, u8RdVal); return -1; } *val = u8RdVal; return u8RdVal; } static s32 power_control(struct sensor_data *sensor, int on) { struct fsl_mxc_camera_platform_data *plat = camera_plat; if (sensor->on != on) { if (plat->pwdn) plat->pwdn(on ? 0 : 1); sensor->on = on; } return 0; } static int prev_sysclk, prev_HTS; static int AE_low, AE_high, AE_Target = 52; void OV5640_stream_on(void) { ov5640_write_reg(0x4202, 0x00); } void OV5640_stream_off(void) { ov5640_write_reg(0x4202, 0x0f); } static const int sclk_rdiv_map[] = {1, 2, 4, 8}; int OV5640_get_sysclk(void) { /* calculate sysclk */ int tmp; unsigned Multiplier, PreDiv, SysDiv, Pll_rdiv, Bit_div2x = 1; unsigned div, sclk_rdiv, sysclk; u8 temp; tmp = ov5640_read_reg(0x3034, &temp); if (tmp < 0) return tmp; tmp &= 0x0f; if (tmp == 8 || tmp == 10) Bit_div2x = tmp / 2; tmp = ov5640_read_reg(0x3035, &temp); if (tmp < 0) return tmp; SysDiv = tmp >> 4; if (SysDiv == 0) SysDiv = 16; tmp = ov5640_read_reg(0x3036, &temp); if (tmp < 0) return tmp; Multiplier = tmp; tmp = ov5640_read_reg(0x3037, &temp); if (tmp < 0) return tmp; PreDiv = tmp & 0x0f; Pll_rdiv = ((tmp >> 4) & 0x01) + 1; tmp = ov5640_read_reg(0x3108, &temp); if (tmp < 0) return tmp; sclk_rdiv = sclk_rdiv_map[tmp & 0x03]; sysclk = ov5640_data.mclk / 10000 * Multiplier; div = PreDiv * SysDiv * Pll_rdiv * Bit_div2x * sclk_rdiv; if (!div) { pr_err("%s:Error divide by 0, (%d * %d * %d * %d * %d)\n", __func__, PreDiv, SysDiv, Pll_rdiv, Bit_div2x, sclk_rdiv); return -EINVAL; } if (!sysclk) { pr_err("%s:Error 0 clk, ov5640_data.mclk=%d, Multiplier=%d\n", __func__, ov5640_data.mclk, Multiplier); return -EINVAL; } sysclk /= div; pr_debug("%s: sysclk(%d) = %d / 10000 * %d / (%d * %d * %d * %d * %d)\n", __func__, sysclk, ov5640_data.mclk, Multiplier, PreDiv, SysDiv, Pll_rdiv, Bit_div2x, sclk_rdiv); return sysclk; } void OV5640_set_night_mode(void) { /* read HTS from register settings */ u8 mode; ov5640_read_reg(0x3a00, &mode); mode &= 0xfb; ov5640_write_reg(0x3a00, mode); } int OV5640_get_HTS(void) { /* read HTS from register settings */ int HTS; u8 temp; HTS = ov5640_read_reg(0x380c, &temp); HTS = (HTS<<8) + ov5640_read_reg(0x380d, &temp); return HTS; } int OV5640_get_VTS(void) { /* read VTS from register settings */ int VTS; u8 temp; VTS = ov5640_read_reg(0x380e, &temp);/* total vertical size[15:8] high byte */ VTS = (VTS<<8) + ov5640_read_reg(0x380f, &temp); return VTS; } int OV5640_set_VTS(int VTS) { /* write VTS to registers */ int temp; temp = VTS & 0xff; ov5640_write_reg(0x380f, temp); temp = VTS>>8; ov5640_write_reg(0x380e, temp); return 0; } int OV5640_get_shutter(void) { /* read shutter, in number of line period */ int shutter; u8 temp; shutter = (ov5640_read_reg(0x03500, &temp) & 0x0f); shutter = (shutter<<8) + ov5640_read_reg(0x3501, &temp); shutter = (shutter<<4) + (ov5640_read_reg(0x3502, &temp)>>4); return shutter; } int OV5640_set_shutter(int shutter) { /* write shutter, in number of line period */ int temp; shutter = shutter & 0xffff; temp = shutter & 0x0f; temp = temp<<4; ov5640_write_reg(0x3502, temp); temp = shutter & 0xfff; temp = temp>>4; ov5640_write_reg(0x3501, temp); temp = shutter>>12; ov5640_write_reg(0x3500, temp); return 0; } int OV5640_get_gain16(void) { /* read gain, 16 = 1x */ int gain16; u8 temp; gain16 = ov5640_read_reg(0x350a, &temp) & 0x03; gain16 = (gain16<<8) + ov5640_read_reg(0x350b, &temp); return gain16; } int OV5640_set_gain16(int gain16) { /* write gain, 16 = 1x */ u8 temp; gain16 = gain16 & 0x3ff; temp = gain16 & 0xff; ov5640_write_reg(0x350b, temp); temp = gain16>>8; ov5640_write_reg(0x350a, temp); return 0; } int OV5640_get_light_freq(void) { /* get banding filter value */ int temp, temp1, light_freq = 0; u8 tmp; temp = ov5640_read_reg(0x3c01, &tmp); if (temp & 0x80) { /* manual */ temp1 = ov5640_read_reg(0x3c00, &tmp); if (temp1 & 0x04) { /* 50Hz */ light_freq = 50; } else { /* 60Hz */ light_freq = 60; } } else { /* auto */ temp1 = ov5640_read_reg(0x3c0c, &tmp); if (temp1 & 0x01) { /* 50Hz */ light_freq = 50; } else { /* 60Hz */ light_freq = 60; } } return light_freq; } void OV5640_set_bandingfilter(void) { int prev_VTS; int band_step60, max_band60, band_step50, max_band50; /* read preview PCLK */ prev_sysclk = OV5640_get_sysclk(); /* read preview HTS */ prev_HTS = OV5640_get_HTS(); /* read preview VTS */ prev_VTS = OV5640_get_VTS(); if (prev_HTS <= 0) { pr_err("%s: error: prev_sysclk=%x, prev_HTS=%x, prev_VTS=%x\n", __func__, prev_sysclk, prev_HTS, prev_VTS); prev_HTS = 640; return; } pr_debug("prev_sysclk=%x, prev_HTS=%x, prev_VTS=%x\n", prev_sysclk, prev_HTS, prev_VTS); /* calculate banding filter */ /* 60Hz */ band_step60 = prev_sysclk * 100/prev_HTS * 100/120; ov5640_write_reg(0x3a0a, (band_step60 >> 8)); ov5640_write_reg(0x3a0b, (band_step60 & 0xff)); max_band60 = (int)((prev_VTS-4)/band_step60); ov5640_write_reg(0x3a0d, max_band60); /* 50Hz */ band_step50 = prev_sysclk * 100/prev_HTS; ov5640_write_reg(0x3a08, (band_step50 >> 8)); ov5640_write_reg(0x3a09, (band_step50 & 0xff)); max_band50 = (int)((prev_VTS-4)/band_step50); ov5640_write_reg(0x3a0e, max_band50); } int OV5640_set_AE_target(int target) { /* stable in high */ int fast_high, fast_low; AE_low = target * 23 / 25; /* 0.92 */ AE_high = target * 27 / 25; /* 1.08 */ fast_high = AE_high<<1; if (fast_high > 255) fast_high = 255; fast_low = AE_low >> 1; ov5640_write_reg(0x3a0f, AE_high); ov5640_write_reg(0x3a10, AE_low); ov5640_write_reg(0x3a1b, AE_high); ov5640_write_reg(0x3a1e, AE_low); ov5640_write_reg(0x3a11, fast_high); ov5640_write_reg(0x3a1f, fast_low); return 0; } void OV5640_turn_on_AE_AG(int enable) { u8 ae_ag_ctrl; ov5640_read_reg(0x3503, &ae_ag_ctrl); if (enable) { /* turn on auto AE/AG */ ae_ag_ctrl = ae_ag_ctrl & ~(0x03); } else { /* turn off AE/AG */ ae_ag_ctrl = ae_ag_ctrl | 0x03; } ov5640_write_reg(0x3503, ae_ag_ctrl); } bool binning_on(void) { u8 temp; ov5640_read_reg(0x3821, &temp); temp &= 0xfe; if (temp) return true; else return false; } static void ov5640_set_virtual_channel(int channel) { u8 channel_id; ov5640_read_reg(0x4814, &channel_id); channel_id &= ~(3 << 6); ov5640_write_reg(0x4814, channel_id | (channel << 6)); } /* download ov5640 settings to sensor through i2c */ static int ov5640_download_firmware(struct reg_value *pModeSetting, s32 ArySize) { register u32 Delay_ms = 0; register u16 RegAddr = 0; register u8 Mask = 0; register u8 Val = 0; u8 RegVal = 0; int i, retval = 0; for (i = 0; i < ArySize; ++i, ++pModeSetting) { Delay_ms = pModeSetting->u32Delay_ms; RegAddr = pModeSetting->u16RegAddr; Val = pModeSetting->u8Val; Mask = pModeSetting->u8Mask; if (Mask) { retval = ov5640_read_reg(RegAddr, &RegVal); if (retval < 0) goto err; RegVal &= ~(u8)Mask; Val &= Mask; Val |= RegVal; } retval = ov5640_write_reg(RegAddr, Val); if (retval < 0) goto err; if (Delay_ms) msleep(Delay_ms); } err: return retval; } /* sensor changes between scaling and subsampling * go through exposure calcualtion */ static int ov5640_change_mode_exposure_calc(enum ov5640_frame_rate frame_rate, enum ov5640_mode mode) { struct reg_value *pModeSetting = NULL; s32 ArySize = 0; u8 average; int prev_shutter, prev_gain16; int cap_shutter, cap_gain16; int cap_sysclk, cap_HTS, cap_VTS; int light_freq, cap_bandfilt, cap_maxband; long cap_gain16_shutter; int retval = 0; /* check if the input mode and frame rate is valid */ pModeSetting = ov5640_mode_info_data[frame_rate][mode].init_data_ptr; ArySize = ov5640_mode_info_data[frame_rate][mode].init_data_size; ov5640_data.pix.width = ov5640_mode_info_data[frame_rate][mode].width; ov5640_data.pix.height = ov5640_mode_info_data[frame_rate][mode].height; if (ov5640_data.pix.width == 0 || ov5640_data.pix.height == 0 || pModeSetting == NULL || ArySize == 0) return -EINVAL; /* auto focus */ /* OV5640_auto_focus();//if no af function, just skip it */ /* turn off AE/AG */ OV5640_turn_on_AE_AG(0); /* read preview shutter */ prev_shutter = OV5640_get_shutter(); if ((binning_on()) && (mode != ov5640_mode_720P_1280_720) && (mode != ov5640_mode_1080P_1920_1080)) prev_shutter *= 2; /* read preview gain */ prev_gain16 = OV5640_get_gain16(); /* get average */ ov5640_read_reg(0x56a1, &average); /* turn off night mode for capture */ OV5640_set_night_mode(); /* turn off overlay */ /* ov5640_write_reg(0x3022, 0x06);//if no af function, just skip it */ OV5640_stream_off(); /* Write capture setting */ retval = ov5640_download_firmware(pModeSetting, ArySize); if (retval < 0) goto err; /* read capture VTS */ cap_VTS = OV5640_get_VTS(); cap_HTS = OV5640_get_HTS(); cap_sysclk = OV5640_get_sysclk(); pr_debug("cap_sysclk=%x, cap_HTS=%x, cap_VTS=%x\n", cap_sysclk, cap_HTS, cap_VTS); /* calculate capture banding filter */ light_freq = OV5640_get_light_freq(); if (light_freq == 60) { /* 60Hz */ cap_bandfilt = cap_sysclk * 100 / cap_HTS * 100 / 120; } else { /* 50Hz */ cap_bandfilt = cap_sysclk * 100 / cap_HTS; } cap_maxband = (int)((cap_VTS - 4)/cap_bandfilt); /* calculate capture shutter/gain16 */ if (average > AE_low && average < AE_high) { /* in stable range */ cap_gain16_shutter = prev_gain16 * prev_shutter * cap_sysclk/prev_sysclk * prev_HTS/cap_HTS * AE_Target / average; } else { cap_gain16_shutter = prev_gain16 * prev_shutter * cap_sysclk/prev_sysclk * prev_HTS/cap_HTS; } /* gain to shutter */ if (cap_gain16_shutter < (cap_bandfilt * 16)) { /* shutter < 1/100 */ cap_shutter = cap_gain16_shutter/16; if (cap_shutter < 1) cap_shutter = 1; cap_gain16 = cap_gain16_shutter/cap_shutter; if (cap_gain16 < 16) cap_gain16 = 16; } else { if (cap_gain16_shutter > (cap_bandfilt * cap_maxband * 16)) { /* exposure reach max */ cap_shutter = cap_bandfilt * cap_maxband; cap_gain16 = cap_gain16_shutter / cap_shutter; } else { /* 1/100 < (cap_shutter = n/100) =< max */ cap_shutter = ((int) (cap_gain16_shutter/16 / cap_bandfilt)) *cap_bandfilt; cap_gain16 = cap_gain16_shutter / cap_shutter; } } /* write capture gain */ OV5640_set_gain16(cap_gain16); /* write capture shutter */ if (cap_shutter > (cap_VTS - 4)) { cap_VTS = cap_shutter + 4; OV5640_set_VTS(cap_VTS); } OV5640_set_shutter(cap_shutter); OV5640_stream_on(); err: return retval; } /* if sensor changes inside scaling or subsampling * change mode directly * */ static int ov5640_change_mode_direct(enum ov5640_frame_rate frame_rate, enum ov5640_mode mode) { struct reg_value *pModeSetting = NULL; s32 ArySize = 0; int retval = 0; /* check if the input mode and frame rate is valid */ pModeSetting = ov5640_mode_info_data[frame_rate][mode].init_data_ptr; ArySize = ov5640_mode_info_data[frame_rate][mode].init_data_size; ov5640_data.pix.width = ov5640_mode_info_data[frame_rate][mode].width; ov5640_data.pix.height = ov5640_mode_info_data[frame_rate][mode].height; if (ov5640_data.pix.width == 0 || ov5640_data.pix.height == 0 || pModeSetting == NULL || ArySize == 0) return -EINVAL; /* turn off AE/AG */ OV5640_turn_on_AE_AG(0); OV5640_stream_off(); /* Write capture setting */ retval = ov5640_download_firmware(pModeSetting, ArySize); if (retval < 0) goto err; OV5640_stream_on(); OV5640_turn_on_AE_AG(1); err: return retval; } static int ov5640_download_autofocus(void) { u8 r; int sval = ov5640_read_reg(0x3000, &r); if (0 > sval) { pr_err("%s:Error reading control reg\n", __func__); return sval; } r |= 0x20; ov5640_write_reg(0x3000,r); sval = ov5640_download_firmware( ov5640_af_firmware, ARRAY_SIZE(ov5640_af_firmware)); if (0 > sval) { pr_err("%s: Error downloading firmware\n", __func__); } else pr_info("%s: Downloaded firmware successfully: %d\n", __func__,sval); r &= ~0x20; ov5640_write_reg(0x3000,r); /* VCM control4 */ ov5640_write_reg(0x3606,0x07); return sval; } static int trigger_auto_focus(void){ ov5640_write_reg(CMD_ACK, 0x01); ov5640_write_reg(CMD_MAIN, 0x03); return 0; } static int ioctl_send_command(struct v4l2_int_device *s, struct v4l2_send_command_control *vc) { int ret = -1; int retval1,retval2; u8 loca_val=0; switch (vc->id) { case 105: //step to specified position pr_debug("Stepping to position: %d\n", vc->value0); if(vc->value0 < 0 || vc->value0 > 255) return ret; loca_val = vc->value0; ov5640_write_reg(CMD_PARA3, 0); ov5640_write_reg(CMD_PARA4, loca_val); retval1=ov5640_write_reg(CMD_ACK, 0x01); retval2=ov5640_write_reg(CMD_MAIN, 0x1a); if(retval1 != 0 || retval2 != 0) { pr_err("%s:error stepping to 0x%02x: %d/%d\n", __func__, vc->value0, retval1,retval2); ret = -1; } else { pr_debug("step successful\n"); ret = 0; } break; default: pr_err("%s:Unknown ctrl 0x%x\n", __func__, vc->id); break; } return ret; } static int ov5640_init_mode(enum ov5640_frame_rate frame_rate, enum ov5640_mode mode, enum ov5640_mode orig_mode) { struct reg_value *pModeSetting = NULL; s32 ArySize = 0; int retval = 0; void *mipi_csi2_info; u32 mipi_reg, msec_wait4stable = 0; enum ov5640_downsize_mode dn_mode, orig_dn_mode; if ((mode > ov5640_mode_MAX || mode < ov5640_mode_MIN) && (mode != ov5640_mode_INIT)) { pr_err("Wrong ov5640 mode detected!\n"); return -1; } mipi_csi2_info = mipi_csi2_get_info(); /* initial mipi dphy */ if (mipi_csi2_info) { if (!mipi_csi2_get_status(mipi_csi2_info)) mipi_csi2_enable(mipi_csi2_info); if (mipi_csi2_get_status(mipi_csi2_info)) { mipi_csi2_set_lanes(mipi_csi2_info, 2); /*Only reset MIPI CSI2 HW at sensor initialize*/ if (mode == ov5640_mode_INIT) mipi_csi2_reset(mipi_csi2_info); if (ov5640_data.pix.pixelformat == V4L2_PIX_FMT_UYVY) mipi_csi2_set_datatype(mipi_csi2_info, MIPI_DT_YUV422); else if (ov5640_data.pix.pixelformat == V4L2_PIX_FMT_RGB565) mipi_csi2_set_datatype(mipi_csi2_info, MIPI_DT_RGB565); else pr_err("currently this sensor format can not be supported!\n"); } else { pr_err("Can not enable mipi csi2 driver!\n"); return -1; } } else { printk(KERN_ERR "Fail to get mipi_csi2_info!\n"); return -1; } dn_mode = ov5640_mode_info_data[frame_rate][mode].dn_mode; orig_dn_mode = ov5640_mode_info_data[frame_rate][orig_mode].dn_mode; if (mode == ov5640_mode_INIT) { pModeSetting = ov5640_init_setting_30fps_VGA; ArySize = ARRAY_SIZE(ov5640_init_setting_30fps_VGA); ov5640_data.pix.width = 640; ov5640_data.pix.height = 480; retval = ov5640_download_firmware(pModeSetting, ArySize); if (retval < 0) goto err; retval = ov5640_download_autofocus(); if (retval < 0) { pr_err("%s: error downloading autofocus firmware\n", __func__); goto err; } trigger_auto_focus(); pModeSetting = ov5640_setting_30fps_VGA_640_480; ArySize = ARRAY_SIZE(ov5640_setting_30fps_VGA_640_480); retval = ov5640_download_firmware(pModeSetting, ArySize); } else if ((dn_mode == SUBSAMPLING && orig_dn_mode == SCALING) || (dn_mode == SCALING && orig_dn_mode == SUBSAMPLING)) { /* change between subsampling and scaling * go through exposure calucation */ retval = ov5640_change_mode_exposure_calc(frame_rate, mode); } else { /* change inside subsampling or scaling * download firmware directly */ retval = ov5640_change_mode_direct(frame_rate, mode); } if (retval < 0) goto err; OV5640_set_AE_target(AE_Target); OV5640_get_light_freq(); OV5640_set_bandingfilter(); ov5640_set_virtual_channel(ov5640_data.virtual_channel); /* add delay to wait for sensor stable */ if (mode == ov5640_mode_QSXGA_2592_1944) { /* dump the first two frames: 1/7.5*2 * the frame rate of QSXGA is 7.5fps */ msec_wait4stable = 267; } else if (frame_rate == ov5640_15_fps) { /* dump the first nine frames: 1/15*9 */ msec_wait4stable = 600; } else if (frame_rate == ov5640_30_fps) { /* dump the first nine frames: 1/30*9 */ msec_wait4stable = 300; } msleep(msec_wait4stable); if (mipi_csi2_info) { unsigned int i; i = 0; /* wait for mipi sensor ready */ mipi_reg = mipi_csi2_dphy_status(mipi_csi2_info); while ((mipi_reg == 0x200) && (i < 10)) { mipi_reg = mipi_csi2_dphy_status(mipi_csi2_info); i++; msleep(10); } if (i >= 10) { pr_err("mipi csi2 can not receive sensor clk!\n"); return -1; } i = 0; /* wait for mipi stable */ mipi_reg = mipi_csi2_get_error1(mipi_csi2_info); while ((mipi_reg != 0x0) && (i < 10)) { mipi_reg = mipi_csi2_get_error1(mipi_csi2_info); i++; msleep(10); } if (i >= 10) { pr_err("mipi csi2 can not reveive data correctly!\n"); return -1; } } err: return retval; } /* --------------- IOCTL functions from v4l2_int_ioctl_desc --------------- */ static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p) { if (s == NULL) { pr_err(" ERROR!! no slave device set!\n"); return -1; } memset(p, 0, sizeof(*p)); p->u.bt656.clock_curr = ov5640_data.mclk; pr_debug(" clock_curr=mclk=%d\n", ov5640_data.mclk); p->if_type = V4L2_IF_TYPE_BT656; p->u.bt656.mode = V4L2_IF_TYPE_BT656_MODE_NOBT_8BIT; p->u.bt656.clock_min = OV5640_XCLK_MIN; p->u.bt656.clock_max = OV5640_XCLK_MAX; p->u.bt656.bt_sync_correct = 1; /* Indicate external vsync */ return 0; } /*! * ioctl_s_power - V4L2 sensor interface handler for VIDIOC_S_POWER ioctl * @s: pointer to standard V4L2 device structure * @on: indicates power mode (on or off) * * Turns the power on or off, depending on the value of on and returns the * appropriate error code. */ static int ioctl_s_power(struct v4l2_int_device *s, int on) { struct sensor_data *sensor = s->priv; if (on && !sensor->on) { if (io_regulator) if (regulator_enable(io_regulator) != 0) return -EIO; if (core_regulator) if (regulator_enable(core_regulator) != 0) return -EIO; if (gpo_regulator) if (regulator_enable(gpo_regulator) != 0) return -EIO; if (analog_regulator) if (regulator_enable(analog_regulator) != 0) return -EIO; /* Make sure power on */ power_control(sensor, 1); } else if (!on && sensor->on) { if (analog_regulator) regulator_disable(analog_regulator); if (core_regulator) regulator_disable(core_regulator); if (io_regulator) regulator_disable(io_regulator); if (gpo_regulator) regulator_disable(gpo_regulator); power_control(sensor, 0); } return 0; } /*! * ioctl_g_parm - V4L2 sensor interface handler for VIDIOC_G_PARM ioctl * @s: pointer to standard V4L2 device structure * @a: pointer to standard V4L2 VIDIOC_G_PARM ioctl structure * * Returns the sensor's video CAPTURE parameters. */ static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a) { struct sensor_data *sensor = s->priv; struct v4l2_captureparm *cparm = &a->parm.capture; int ret = 0; switch (a->type) { /* This is the only case currently handled. */ case V4L2_BUF_TYPE_VIDEO_CAPTURE: memset(a, 0, sizeof(*a)); a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; cparm->capability = sensor->streamcap.capability; cparm->timeperframe = sensor->streamcap.timeperframe; cparm->capturemode = sensor->streamcap.capturemode; ret = 0; break; /* These are all the possible cases. */ case V4L2_BUF_TYPE_VIDEO_OUTPUT: case V4L2_BUF_TYPE_VIDEO_OVERLAY: case V4L2_BUF_TYPE_VBI_CAPTURE: case V4L2_BUF_TYPE_VBI_OUTPUT: case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: ret = -EINVAL; break; default: pr_debug(" type is unknown - %d\n", a->type); ret = -EINVAL; break; } return ret; } /*! * ioctl_s_parm - V4L2 sensor interface handler for VIDIOC_S_PARM ioctl * @s: pointer to standard V4L2 device structure * @a: pointer to standard V4L2 VIDIOC_S_PARM ioctl structure * * Configures the sensor to use the input parameters, if possible. If * not possible, reverts to the old parameters and returns the * appropriate error code. */ static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a) { struct sensor_data *sensor = s->priv; struct v4l2_fract *timeperframe = &a->parm.capture.timeperframe; u32 tgt_fps; /* target frames per secound */ enum ov5640_frame_rate frame_rate; enum ov5640_mode orig_mode; int ret = 0; /* Make sure power on */ power_control(sensor, 1); switch (a->type) { /* This is the only case currently handled. */ case V4L2_BUF_TYPE_VIDEO_CAPTURE: /* Check that the new frame rate is allowed. */ if ((timeperframe->numerator == 0) || (timeperframe->denominator == 0)) { timeperframe->denominator = DEFAULT_FPS; timeperframe->numerator = 1; } tgt_fps = timeperframe->denominator / timeperframe->numerator; if (tgt_fps > MAX_FPS) { timeperframe->denominator = MAX_FPS; timeperframe->numerator = 1; } else if (tgt_fps < MIN_FPS) { timeperframe->denominator = MIN_FPS; timeperframe->numerator = 1; } /* Actual frame rate we use */ tgt_fps = timeperframe->denominator / timeperframe->numerator; if (tgt_fps == 15) frame_rate = ov5640_15_fps; else if (tgt_fps == 30) frame_rate = ov5640_30_fps; else { pr_err(" The camera frame rate is not supported!\n"); return -EINVAL; } orig_mode = sensor->streamcap.capturemode; ret = ov5640_init_mode(frame_rate, (u32)a->parm.capture.capturemode, orig_mode); if (ret < 0) return ret; sensor->streamcap.timeperframe = *timeperframe; sensor->streamcap.capturemode = (u32)a->parm.capture.capturemode; break; /* These are all the possible cases. */ case V4L2_BUF_TYPE_VIDEO_OUTPUT: case V4L2_BUF_TYPE_VIDEO_OVERLAY: case V4L2_BUF_TYPE_VBI_CAPTURE: case V4L2_BUF_TYPE_VBI_OUTPUT: case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: pr_debug(" type is not " \ "V4L2_BUF_TYPE_VIDEO_CAPTURE but %d\n", a->type); ret = -EINVAL; break; default: pr_debug(" type is unknown - %d\n", a->type); ret = -EINVAL; break; } return ret; } /*! * ioctl_g_fmt_cap - V4L2 sensor interface handler for ioctl_g_fmt_cap * @s: pointer to standard V4L2 device structure * @f: pointer to standard V4L2 v4l2_format structure * * Returns the sensor's current pixel format in the v4l2_format * parameter. */ static int ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f) { struct sensor_data *sensor = s->priv; f->fmt.pix = sensor->pix; return 0; } /*! * ioctl_g_ctrl - V4L2 sensor interface handler for VIDIOC_G_CTRL ioctl * @s: pointer to standard V4L2 device structure * @vc: standard V4L2 VIDIOC_G_CTRL ioctl structure * * If the requested control is supported, returns the control's current * value from the video_control[] array. Otherwise, returns -EINVAL * if the control is not supported. */ static int ioctl_g_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc) { int ret = 0; switch (vc->id) { case V4L2_CID_BRIGHTNESS: vc->value = ov5640_data.brightness; break; case V4L2_CID_HUE: vc->value = ov5640_data.hue; break; case V4L2_CID_CONTRAST: vc->value = ov5640_data.contrast; break; case V4L2_CID_SATURATION: vc->value = ov5640_data.saturation; break; case V4L2_CID_RED_BALANCE: vc->value = ov5640_data.red; break; case V4L2_CID_BLUE_BALANCE: vc->value = ov5640_data.blue; break; case V4L2_CID_EXPOSURE: vc->value = ov5640_data.ae_mode; break; default: ret = -EINVAL; } return ret; } /*! * ioctl_s_ctrl - V4L2 sensor interface handler for VIDIOC_S_CTRL ioctl * @s: pointer to standard V4L2 device structure * @vc: standard V4L2 VIDIOC_S_CTRL ioctl structure * * If the requested control is supported, sets the control's current * value in HW (and updates the video_control[] array). Otherwise, * returns -EINVAL if the control is not supported. */ static int ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc) { int retval = 0; pr_debug("In ov5640:ioctl_s_ctrl %d\n", vc->id); switch (vc->id) { case V4L2_CID_BRIGHTNESS: break; case V4L2_CID_AUTO_FOCUS_START: retval = trigger_auto_focus(); break; case V4L2_CID_CONTRAST: break; case V4L2_CID_SATURATION: break; case V4L2_CID_HUE: break; case V4L2_CID_AUTO_WHITE_BALANCE: break; case V4L2_CID_DO_WHITE_BALANCE: break; case V4L2_CID_RED_BALANCE: break; case V4L2_CID_BLUE_BALANCE: break; case V4L2_CID_GAMMA: break; case V4L2_CID_EXPOSURE: break; case V4L2_CID_AUTOGAIN: break; case V4L2_CID_GAIN: break; case V4L2_CID_HFLIP: break; case V4L2_CID_VFLIP: break; default: retval = -EPERM; break; } return retval; } /*! * ioctl_enum_framesizes - V4L2 sensor interface handler for * VIDIOC_ENUM_FRAMESIZES ioctl * @s: pointer to standard V4L2 device structure * @fsize: standard V4L2 VIDIOC_ENUM_FRAMESIZES ioctl structure * * Return 0 if successful, otherwise -EINVAL. */ static int ioctl_enum_framesizes(struct v4l2_int_device *s, struct v4l2_frmsizeenum *fsize) { if (fsize->index > ov5640_mode_MAX) return -EINVAL; fsize->pixel_format = ov5640_data.pix.pixelformat; fsize->discrete.width = max(ov5640_mode_info_data[0][fsize->index].width, ov5640_mode_info_data[1][fsize->index].width); fsize->discrete.height = max(ov5640_mode_info_data[0][fsize->index].height, ov5640_mode_info_data[1][fsize->index].height); return 0; } /*! * ioctl_g_chip_ident - V4L2 sensor interface handler for * VIDIOC_DBG_G_CHIP_IDENT ioctl * @s: pointer to standard V4L2 device structure * @id: pointer to int * * Return 0. */ static int ioctl_g_chip_ident(struct v4l2_int_device *s, int *id) { ((struct v4l2_dbg_chip_ident *)id)->match.type = V4L2_CHIP_MATCH_I2C_DRIVER; strcpy(((struct v4l2_dbg_chip_ident *)id)->match.name, "ov5640_mipi_camera"); return 0; } /*! * ioctl_init - V4L2 sensor interface handler for VIDIOC_INT_INIT * @s: pointer to standard V4L2 device structure */ static int ioctl_init(struct v4l2_int_device *s) { return 0; } /*! * ioctl_enum_fmt_cap - V4L2 sensor interface handler for VIDIOC_ENUM_FMT * @s: pointer to standard V4L2 device structure * @fmt: pointer to standard V4L2 fmt description structure * * Return 0. */ static int ioctl_enum_fmt_cap(struct v4l2_int_device *s, struct v4l2_fmtdesc *fmt) { if (fmt->index > ov5640_mode_MAX) return -EINVAL; fmt->pixelformat = ov5640_data.pix.pixelformat; return 0; } /*! * ioctl_dev_init - V4L2 sensor interface handler for vidioc_int_dev_init_num * @s: pointer to standard V4L2 device structure * * Initialise the device when slave attaches to the master. */ static int ioctl_dev_init(struct v4l2_int_device *s) { struct sensor_data *sensor = s->priv; u32 tgt_xclk; /* target xclk */ u32 tgt_fps; /* target frames per secound */ int ret; enum ov5640_frame_rate frame_rate; void *mipi_csi2_info; ov5640_data.on = true; /* mclk */ tgt_xclk = ov5640_data.mclk; tgt_xclk = min(tgt_xclk, (u32)OV5640_XCLK_MAX); tgt_xclk = max(tgt_xclk, (u32)OV5640_XCLK_MIN); ov5640_data.mclk = tgt_xclk; pr_debug(" Setting mclk to %d MHz\n", tgt_xclk / 1000000); // set_mclk_rate(&ov5640_data.mclk, ov5640_data.mclk_source); /* Default camera frame rate is set in probe */ tgt_fps = sensor->streamcap.timeperframe.denominator / sensor->streamcap.timeperframe.numerator; if (tgt_fps == 15) frame_rate = ov5640_15_fps; else if (tgt_fps == 30) frame_rate = ov5640_30_fps; else return -EINVAL; /* Only support 15fps or 30fps now. */ mipi_csi2_info = mipi_csi2_get_info(); /* enable mipi csi2 */ if (mipi_csi2_info) mipi_csi2_enable(mipi_csi2_info); else { printk(KERN_ERR "Fail to get mipi_csi2_info!\n"); return -EPERM; } ret = ov5640_init_mode(frame_rate, ov5640_mode_INIT, ov5640_mode_INIT); return ret; } /*! * ioctl_dev_exit - V4L2 sensor interface handler for vidioc_int_dev_exit_num * @s: pointer to standard V4L2 device structure * * Delinitialise the device when slave detaches to the master. */ static int ioctl_dev_exit(struct v4l2_int_device *s) { void *mipi_csi2_info; mipi_csi2_info = mipi_csi2_get_info(); /* disable mipi csi2 */ if (mipi_csi2_info) if (mipi_csi2_get_status(mipi_csi2_info)) mipi_csi2_disable(mipi_csi2_info); return 0; } /*! * This structure defines all the ioctls for this module and links them to the * enumeration. */ static struct v4l2_int_ioctl_desc ov5640_ioctl_desc[] = { {vidioc_int_dev_init_num, (v4l2_int_ioctl_func*) ioctl_dev_init}, {vidioc_int_dev_exit_num, ioctl_dev_exit}, {vidioc_int_s_power_num, (v4l2_int_ioctl_func*) ioctl_s_power}, {vidioc_int_g_ifparm_num, (v4l2_int_ioctl_func*) ioctl_g_ifparm}, /* {vidioc_int_g_needs_reset_num, (v4l2_int_ioctl_func *)ioctl_g_needs_reset}, */ /* {vidioc_int_reset_num, (v4l2_int_ioctl_func *)ioctl_reset}, */ {vidioc_int_init_num, (v4l2_int_ioctl_func*) ioctl_init}, {vidioc_int_enum_fmt_cap_num, (v4l2_int_ioctl_func *) ioctl_enum_fmt_cap}, /* {vidioc_int_try_fmt_cap_num, (v4l2_int_ioctl_func *)ioctl_try_fmt_cap}, */ {vidioc_int_g_fmt_cap_num, (v4l2_int_ioctl_func *) ioctl_g_fmt_cap}, /* {vidioc_int_s_fmt_cap_num, (v4l2_int_ioctl_func *) ioctl_s_fmt_cap}, */ {vidioc_int_g_parm_num, (v4l2_int_ioctl_func *) ioctl_g_parm}, {vidioc_int_s_parm_num, (v4l2_int_ioctl_func *) ioctl_s_parm}, /* {vidioc_int_queryctrl_num, (v4l2_int_ioctl_func *)ioctl_queryctrl}, */ {vidioc_int_g_ctrl_num, (v4l2_int_ioctl_func *) ioctl_g_ctrl}, {vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func *) ioctl_s_ctrl}, {vidioc_int_enum_framesizes_num, (v4l2_int_ioctl_func *) ioctl_enum_framesizes}, {vidioc_int_g_chip_ident_num, (v4l2_int_ioctl_func *) ioctl_g_chip_ident}, {vidioc_int_send_command_num, (v4l2_int_ioctl_func *) ioctl_send_command}, }; static struct v4l2_int_slave ov5640_slave = { .ioctls = ov5640_ioctl_desc, .num_ioctls = ARRAY_SIZE(ov5640_ioctl_desc), }; static struct v4l2_int_device ov5640_int_device = { .module = THIS_MODULE, .name = "ov5640_mipi", .type = v4l2_int_type_slave, .u = { .slave = &ov5640_slave, }, }; static int write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data) { char localbuf[256]; if( count < sizeof(localbuf) ){ if(copy_from_user(localbuf,buffer,count)){ printk(KERN_ERR "Error reading user buf\n" ); } else { int addr0 ; int value ; int numScanned ; if(2 == (numScanned = sscanf(localbuf,"%04x %02x", &addr0, &value)) ){ if( (0xFFFF >= addr0) && (0xff >= value) ){ s32 rval ; rval = ov5640_write_reg(addr0,value); if (rval < 0) pr_err("%s, write reg 0x%x failed: %d\n", __func__, addr0, rval); else pr_err("ov5642[%04x] = %02x\n", addr0,value); } else printk(KERN_ERR "Invalid data: %s\n", localbuf); } else if(1 == numScanned){ if(0xFFFF > addr0){ s32 rval; u8 value; rval = ov5640_read_reg(addr0,&value); if (0 == rval) { pr_err("ov5642[%04x] == 0x%02x\n", addr0,value); } else { pr_err("%s, read reg 0x%x failed: %d\n", __func__, addr0, rval); } } } else printk(KERN_ERR "Invalid data: %s\n", localbuf); } } return count ; } /*! * ov5640 I2C probe function * * @param adapter struct i2c_adapter * * @return Error code indicating success or failure */ static int ov5640_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct sensor_data *sensor = &ov5640_data; int retval; struct fsl_mxc_camera_platform_data *plat_data = client->dev.platform_data; u8 chip_id_high, chip_id_low; struct proc_dir_entry *pde; /* Set initial values for the sensor struct. */ memset(&ov5640_data, 0, sizeof(ov5640_data)); sensor->mipi_camera = 1; ov5640_data.mclk = 24000000; /* 6 - 54 MHz, typical 24MHz */ ov5640_data.mclk = plat_data->mclk; ov5640_data.mclk_source = plat_data->mclk_source; ov5640_data.ipu = plat_data->ipu; ov5640_data.csi = plat_data->csi; ov5640_data.io_init = plat_data->io_init; sensor->virtual_channel = sensor->csi | (sensor->ipu << 1); ov5640_data.i2c_client = client; ov5640_data.pix.pixelformat = V4L2_PIX_FMT_UYVY; ov5640_data.pix.width = 640; ov5640_data.pix.height = 480; ov5640_data.streamcap.capability = V4L2_MODE_HIGHQUALITY | V4L2_CAP_TIMEPERFRAME; ov5640_data.streamcap.capturemode = 0; ov5640_data.streamcap.timeperframe.denominator = DEFAULT_FPS; ov5640_data.streamcap.timeperframe.numerator = 1; camera_plat = plat_data; if (plat_data->io_regulator) { io_regulator = regulator_get(&client->dev, plat_data->io_regulator); if (!IS_ERR(io_regulator)) { regulator_set_voltage(io_regulator, OV5640_VOLTAGE_DIGITAL_IO, OV5640_VOLTAGE_DIGITAL_IO); retval = regulator_enable(io_regulator); if (retval) { pr_err("%s:io set voltage error\n", __func__); goto err1; } else { dev_dbg(&client->dev, "%s:io set voltage ok\n", __func__); } } else io_regulator = NULL; } if (plat_data->core_regulator) { core_regulator = regulator_get(&client->dev, plat_data->core_regulator); if (!IS_ERR(core_regulator)) { regulator_set_voltage(core_regulator, OV5640_VOLTAGE_DIGITAL_CORE, OV5640_VOLTAGE_DIGITAL_CORE); retval = regulator_enable(core_regulator); if (retval) { pr_err("%s:core set voltage error\n", __func__); goto err2; } else { dev_dbg(&client->dev, "%s:core set voltage ok\n", __func__); } } else core_regulator = NULL; } if (plat_data->analog_regulator) { analog_regulator = regulator_get(&client->dev, plat_data->analog_regulator); if (!IS_ERR(analog_regulator)) { regulator_set_voltage(analog_regulator, OV5640_VOLTAGE_ANALOG, OV5640_VOLTAGE_ANALOG); retval = regulator_enable(analog_regulator); if (retval) { pr_err("%s:analog set voltage error\n", __func__); goto err3; } else { dev_dbg(&client->dev, "%s:analog set voltage ok\n", __func__); } } else analog_regulator = NULL; } if (plat_data->io_init) plat_data->io_init(); if (plat_data->lock) plat_data->lock(); power_control(&ov5640_data, 1); update_device_addr(&ov5640_data); if (plat_data->unlock) plat_data->unlock(); retval = ov5640_read_reg(OV5640_CHIP_ID_HIGH_BYTE, &chip_id_high); if (retval < 0 || chip_id_high != 0x56) { pr_warning("camera ov5640_mipi is not found\n"); retval = -ENODEV; goto err4; } retval = ov5640_read_reg(OV5640_CHIP_ID_LOW_BYTE, &chip_id_low); if (retval < 0 || chip_id_low != 0x40) { pr_warning("camera ov5640_mipi is not found\n"); retval = -ENODEV; goto err4; } power_control(&ov5640_data, 0); ov5640_int_device.priv = &ov5640_data; retval = v4l2_int_device_register(&ov5640_int_device); pde = create_proc_entry("driver/ov5640", 0, 0); if( pde ) { pde->write_proc = write_proc ; pde->data = &ov5640_int_device ; } else printk( KERN_ERR "Error creating ov5642 proc entry\n" ); pr_info("camera ov5640_mipi is found\n"); return retval; err4: if (analog_regulator) { regulator_disable(analog_regulator); regulator_put(analog_regulator); } err3: if (core_regulator) { regulator_disable(core_regulator); regulator_put(core_regulator); } err2: if (io_regulator) { regulator_disable(io_regulator); regulator_put(io_regulator); } err1: return retval; } /*! * ov5640 I2C detach function * * @param client struct i2c_client * * @return Error code indicating success or failure */ static int ov5640_remove(struct i2c_client *client) { remove_proc_entry("driver/ov5640", NULL); v4l2_int_device_unregister(&ov5640_int_device); if (gpo_regulator) { regulator_disable(gpo_regulator); regulator_put(gpo_regulator); } if (analog_regulator) { regulator_disable(analog_regulator); regulator_put(analog_regulator); } if (core_regulator) { regulator_disable(core_regulator); regulator_put(core_regulator); } if (io_regulator) { regulator_disable(io_regulator); regulator_put(io_regulator); } return 0; } /*! * ov5640 init function * Called by insmod ov5640_camera.ko. * * @return Error code indicating success or failure */ static __init int ov5640_init(void) { u8 err; err = i2c_add_driver(&ov5640_i2c_driver); if (err != 0) pr_err("%s:driver registration failed, error=%d\n", __func__, err); return err; } /*! * OV5640 cleanup function * Called on rmmod ov5640_camera.ko * * @return Error code indicating success or failure */ static void __exit ov5640_clean(void) { i2c_del_driver(&ov5640_i2c_driver); } module_init(ov5640_init); module_exit(ov5640_clean); MODULE_AUTHOR("Freescale Semiconductor, Inc."); MODULE_DESCRIPTION("OV5640 MIPI Camera Driver"); MODULE_LICENSE("GPL"); MODULE_VERSION("1.0"); MODULE_ALIAS("CSI");
alberto-fc/gg
drivers/media/platform/mxc/capture/ov5640_mipi.c
C
gpl-2.0
156,399
@IF EXIST "%~dp0\node.exe" ( "%~dp0\node.exe" "%~dp0\..\purify-css\bin\purifycss" %* ) ELSE ( node "%~dp0\..\purify-css\bin\purifycss" %* )
alvarpoon/evie
wp-content/themes/evie/node_modules/grunt-purifycss/node_modules/.bin/purifycss.cmd
Batchfile
gpl-2.0
145
# BCP functionality for oasisIM to put data in MSSQL tables from unix.\n BCP.c is in src/dblib/unittests.\n
edhayes1/BCP
README.md
Markdown
gpl-2.0
108
package teammates.test.cases.datatransfer; import static teammates.common.util.Const.EOL; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.testng.annotations.Test; import teammates.common.datatransfer.DataBundle; import teammates.common.datatransfer.FeedbackParticipantType; import teammates.common.datatransfer.attributes.FeedbackQuestionAttributes; import teammates.common.datatransfer.questions.FeedbackQuestionType; import teammates.common.datatransfer.questions.FeedbackTextQuestionDetails; import teammates.common.util.Const; import teammates.common.util.FieldValidator; import teammates.common.util.StringHelper; import teammates.test.cases.BaseTestCase; import com.google.appengine.api.datastore.Text; /** * SUT: {@link FeedbackQuestionAttributes}. */ public class FeedbackQuestionAttributesTest extends BaseTestCase { private DataBundle typicalBundle = getTypicalDataBundle(); private static class FeedbackQuestionAttributesWithModifiableTimestamp extends FeedbackQuestionAttributes { void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } } @Test public void testDefaultTimestamp() { FeedbackQuestionAttributesWithModifiableTimestamp fq = new FeedbackQuestionAttributesWithModifiableTimestamp(); fq.setCreatedAt(null); fq.setUpdatedAt(null); Date defaultTimeStamp = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP; ______TS("success : defaultTimeStamp for createdAt date"); assertEquals(defaultTimeStamp, fq.getCreatedAt()); ______TS("success : defaultTimeStamp for updatedAt date"); assertEquals(defaultTimeStamp, fq.getUpdatedAt()); } @Test public void testValidate() throws Exception { FeedbackQuestionAttributes fq = new FeedbackQuestionAttributes(); fq.feedbackSessionName = ""; fq.courseId = ""; fq.creatorEmail = ""; fq.questionType = FeedbackQuestionType.TEXT; fq.giverType = FeedbackParticipantType.NONE; fq.recipientType = FeedbackParticipantType.RECEIVER; fq.showGiverNameTo = new ArrayList<FeedbackParticipantType>(); fq.showGiverNameTo.add(FeedbackParticipantType.SELF); fq.showGiverNameTo.add(FeedbackParticipantType.STUDENTS); fq.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(); fq.showRecipientNameTo.add(FeedbackParticipantType.SELF); fq.showRecipientNameTo.add(FeedbackParticipantType.STUDENTS); fq.showResponsesTo = new ArrayList<FeedbackParticipantType>(); fq.showResponsesTo.add(FeedbackParticipantType.NONE); fq.showResponsesTo.add(FeedbackParticipantType.SELF); assertFalse(fq.isValid()); String errorMessage = getPopulatedErrorMessage( FieldValidator.SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, fq.creatorEmail, FieldValidator.FEEDBACK_SESSION_NAME_FIELD_NAME, FieldValidator.REASON_EMPTY, FieldValidator.FEEDBACK_SESSION_NAME_MAX_LENGTH) + EOL + getPopulatedErrorMessage( FieldValidator.COURSE_ID_ERROR_MESSAGE, fq.courseId, FieldValidator.COURSE_ID_FIELD_NAME, FieldValidator.REASON_EMPTY, FieldValidator.COURSE_ID_MAX_LENGTH) + EOL + "Invalid creator's email: " + getPopulatedErrorMessage( FieldValidator.EMAIL_ERROR_MESSAGE, fq.creatorEmail, FieldValidator.EMAIL_FIELD_NAME, FieldValidator.REASON_EMPTY, FieldValidator.EMAIL_MAX_LENGTH) + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.giverType.toString(), FieldValidator.GIVER_TYPE_NAME) + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.recipientType.toString(), FieldValidator.RECIPIENT_TYPE_NAME) + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showGiverNameTo.get(0).toString(), FieldValidator.VIEWER_TYPE_NAME) + EOL + "Trying to show giver name to STUDENTS without showing response first." + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showRecipientNameTo.get(0).toString(), FieldValidator.VIEWER_TYPE_NAME) + EOL + "Trying to show recipient name to STUDENTS without showing response first." + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showResponsesTo.get(0).toString(), FieldValidator.VIEWER_TYPE_NAME) + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showResponsesTo.get(1).toString(), FieldValidator.VIEWER_TYPE_NAME); assertEquals(errorMessage, StringHelper.toString(fq.getInvalidityInfo())); fq.feedbackSessionName = "First Feedback Session"; fq.courseId = "CS1101"; fq.creatorEmail = "instructor1@course1.com"; fq.giverType = FeedbackParticipantType.TEAMS; fq.recipientType = FeedbackParticipantType.OWN_TEAM; assertFalse(fq.isValid()); errorMessage = String.format(FieldValidator.PARTICIPANT_TYPE_TEAM_ERROR_MESSAGE, fq.recipientType.toDisplayRecipientName(), fq.giverType.toDisplayGiverName()) + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showGiverNameTo.get(0).toString(), FieldValidator.VIEWER_TYPE_NAME) + EOL + "Trying to show giver name to STUDENTS without showing response first." + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showRecipientNameTo.get(0).toString(), FieldValidator.VIEWER_TYPE_NAME) + EOL + "Trying to show recipient name to STUDENTS without showing response first." + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showResponsesTo.get(0).toString(), FieldValidator.VIEWER_TYPE_NAME) + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showResponsesTo.get(1).toString(), FieldValidator.VIEWER_TYPE_NAME); assertEquals(errorMessage, StringHelper.toString(fq.getInvalidityInfo())); fq.recipientType = FeedbackParticipantType.OWN_TEAM_MEMBERS; assertFalse(fq.isValid()); errorMessage = String.format(FieldValidator.PARTICIPANT_TYPE_TEAM_ERROR_MESSAGE, fq.recipientType.toDisplayRecipientName(), fq.giverType.toDisplayGiverName()) + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showGiverNameTo.get(0).toString(), FieldValidator.VIEWER_TYPE_NAME) + EOL + "Trying to show giver name to STUDENTS without showing response first." + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showRecipientNameTo.get(0).toString(), FieldValidator.VIEWER_TYPE_NAME) + EOL + "Trying to show recipient name to STUDENTS without showing response first." + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showResponsesTo.get(0).toString(), FieldValidator.VIEWER_TYPE_NAME) + EOL + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, fq.showResponsesTo.get(1).toString(), FieldValidator.VIEWER_TYPE_NAME); assertEquals(errorMessage, StringHelper.toString(fq.getInvalidityInfo())); fq.recipientType = FeedbackParticipantType.TEAMS; fq.showGiverNameTo = new ArrayList<FeedbackParticipantType>(); fq.showGiverNameTo.add(FeedbackParticipantType.RECEIVER); fq.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(); fq.showRecipientNameTo.add(FeedbackParticipantType.RECEIVER); fq.showResponsesTo = new ArrayList<FeedbackParticipantType>(); fq.showResponsesTo.add(FeedbackParticipantType.RECEIVER); assertTrue(fq.isValid()); } @Test public void testGetQuestionDetails() { ______TS("Text question: new Json format"); FeedbackQuestionAttributes fq = typicalBundle.feedbackQuestions.get("qn5InSession1InCourse1"); FeedbackTextQuestionDetails questionDetails = new FeedbackTextQuestionDetails("New format text question"); fq.setQuestionDetails(questionDetails); assertTrue(fq.isValid()); assertEquals(fq.getQuestionDetails().getQuestionText(), "New format text question"); ______TS("Text question: old string format"); fq = typicalBundle.feedbackQuestions.get("qn2InSession1InCourse1"); assertEquals(fq.getQuestionDetails().getQuestionText(), "Rate 1 other student's product"); } @Test public void testRemoveIrrelevantVisibilityOptions() { ______TS("test teams->none"); FeedbackQuestionAttributes question = new FeedbackQuestionAttributes(); List<FeedbackParticipantType> participants = new ArrayList<FeedbackParticipantType>(); question.feedbackSessionName = "test session"; question.courseId = "some course"; question.creatorEmail = "test@case.com"; question.questionMetaData = new Text("test qn from teams->none."); question.questionNumber = 1; question.questionType = FeedbackQuestionType.TEXT; question.giverType = FeedbackParticipantType.TEAMS; question.recipientType = FeedbackParticipantType.NONE; question.numberOfEntitiesToGiveFeedbackTo = Const.MAX_POSSIBLE_RECIPIENTS; participants.add(FeedbackParticipantType.OWN_TEAM_MEMBERS); participants.add(FeedbackParticipantType.RECEIVER); participants.add(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS); question.showGiverNameTo = new ArrayList<FeedbackParticipantType>(participants); question.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(participants); participants.add(FeedbackParticipantType.STUDENTS); question.showResponsesTo = new ArrayList<FeedbackParticipantType>(participants); question.removeIrrelevantVisibilityOptions(); assertTrue(question.showGiverNameTo.isEmpty()); assertTrue(question.showRecipientNameTo.isEmpty()); // check that other types are not removed assertTrue(question.showResponsesTo.contains(FeedbackParticipantType.STUDENTS)); assertEquals(question.showResponsesTo.size(), 1); ______TS("test students->teams"); question.giverType = FeedbackParticipantType.STUDENTS; question.recipientType = FeedbackParticipantType.TEAMS; participants.clear(); participants.add(FeedbackParticipantType.INSTRUCTORS); participants.add(FeedbackParticipantType.OWN_TEAM_MEMBERS); participants.add(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS); question.showGiverNameTo = new ArrayList<FeedbackParticipantType>(participants); participants.add(FeedbackParticipantType.STUDENTS); question.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(participants); question.showResponsesTo = new ArrayList<FeedbackParticipantType>(participants); question.removeIrrelevantVisibilityOptions(); assertEquals(question.showGiverNameTo.size(), 2); assertEquals(question.showRecipientNameTo.size(), 3); assertEquals(question.showResponsesTo.size(), 3); assertFalse(question.showGiverNameTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); assertFalse(question.showRecipientNameTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); assertFalse(question.showResponsesTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); ______TS("test students->team members including giver"); question.giverType = FeedbackParticipantType.STUDENTS; question.recipientType = FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF; participants.clear(); participants.add(FeedbackParticipantType.INSTRUCTORS); participants.add(FeedbackParticipantType.OWN_TEAM_MEMBERS); participants.add(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS); question.showGiverNameTo = new ArrayList<FeedbackParticipantType>(participants); participants.add(FeedbackParticipantType.STUDENTS); question.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(participants); question.showResponsesTo = new ArrayList<FeedbackParticipantType>(participants); question.removeIrrelevantVisibilityOptions(); assertEquals(question.showGiverNameTo.size(), 3); assertEquals(question.showRecipientNameTo.size(), 4); assertEquals(question.showResponsesTo.size(), 4); assertFalse(question.showGiverNameTo.contains(FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF)); assertFalse(question.showRecipientNameTo.contains(FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF)); assertFalse(question.showResponsesTo.contains(FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF)); ______TS("test students->instructors"); question.giverType = FeedbackParticipantType.STUDENTS; question.recipientType = FeedbackParticipantType.INSTRUCTORS; participants.clear(); participants.add(FeedbackParticipantType.RECEIVER); participants.add(FeedbackParticipantType.INSTRUCTORS); participants.add(FeedbackParticipantType.OWN_TEAM_MEMBERS); participants.add(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS); participants.add(FeedbackParticipantType.STUDENTS); question.showGiverNameTo = new ArrayList<FeedbackParticipantType>(participants); question.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(participants); question.showResponsesTo = new ArrayList<FeedbackParticipantType>(participants); question.removeIrrelevantVisibilityOptions(); assertEquals(question.showGiverNameTo.size(), 4); assertEquals(question.showRecipientNameTo.size(), 4); assertEquals(question.showResponsesTo.size(), 4); assertFalse(question.showGiverNameTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); assertFalse(question.showRecipientNameTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); assertFalse(question.showResponsesTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); ______TS("test students->own team"); question.giverType = FeedbackParticipantType.STUDENTS; question.recipientType = FeedbackParticipantType.OWN_TEAM; participants.clear(); participants.add(FeedbackParticipantType.RECEIVER); participants.add(FeedbackParticipantType.INSTRUCTORS); participants.add(FeedbackParticipantType.OWN_TEAM_MEMBERS); participants.add(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS); participants.add(FeedbackParticipantType.STUDENTS); question.showGiverNameTo = new ArrayList<FeedbackParticipantType>(participants); question.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(participants); question.showResponsesTo = new ArrayList<FeedbackParticipantType>(participants); question.removeIrrelevantVisibilityOptions(); assertEquals(question.showGiverNameTo.size(), 4); assertEquals(question.showRecipientNameTo.size(), 4); assertEquals(question.showResponsesTo.size(), 4); assertFalse(question.showGiverNameTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); assertFalse(question.showRecipientNameTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); assertFalse(question.showResponsesTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); ______TS("test students->own team members"); question.giverType = FeedbackParticipantType.STUDENTS; question.recipientType = FeedbackParticipantType.OWN_TEAM_MEMBERS; participants.clear(); participants.add(FeedbackParticipantType.RECEIVER); participants.add(FeedbackParticipantType.INSTRUCTORS); participants.add(FeedbackParticipantType.OWN_TEAM_MEMBERS); participants.add(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS); participants.add(FeedbackParticipantType.STUDENTS); question.showGiverNameTo = new ArrayList<FeedbackParticipantType>(participants); question.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(participants); question.showResponsesTo = new ArrayList<FeedbackParticipantType>(participants); question.removeIrrelevantVisibilityOptions(); assertEquals(question.showGiverNameTo.size(), 4); assertEquals(question.showRecipientNameTo.size(), 4); assertEquals(question.showResponsesTo.size(), 4); assertFalse(question.showGiverNameTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); assertFalse(question.showRecipientNameTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); assertFalse(question.showResponsesTo.contains(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)); } }
GriffinHines/teammates
src/test/java/teammates/test/cases/datatransfer/FeedbackQuestionAttributesTest.java
Java
gpl-2.0
18,651
# NatixisUnofficialAPI Unofficial python API for Natixis Interepargne accounts Less than an "alfa" version, I just need some feedbacks on the data retrieved by the module natixis.connections.DataRetriever. Three containers retrieved: - map \<key: investment_name, value: current_investment_value, number_of_parts\> - map \<key: investment_name, map \<key: purchase_date, value: purchase_value, parts_number_bought\> \> - map \<key: availability_date, map \<key: investment_name, value: number_of_available_parts\> \> A Natixis data handler has been developed, built upon the three containers above, aiming to ease the reading of data. It provides following methods: - get_amount_by_stock_name(self, stock_name) - get_amount_total_investment(self) - get_total_amount_by_date(self, date=None, stock_name="", closest_availability_only=False) - get_paid_by_stock_name(self, stock_name=None) - get_total_gain(self) - get_gain_by_stock_name(self, stock_name) - get_next_available_amount(self) It currently does not support: - cases in which you already withdrew some parts. - error cases Please try to play with the main.py file, just insert your credentials in the pre-set variables, save it and launch it: python main.py Any feedback on the data retrieved consinstency + contribution are more than welcome
marcomaio/NatixisUnofficialAPI
README.md
Markdown
gpl-2.0
1,309
/* * Copyright (c) 2000-2010 LSI Corporation. * * * Name: mpi2.h * Title: MPI Message independent structures and definitions * including System Interface Register Set and * scatter/gather formats. * Creation Date: June 21, 2006 * * mpi2.h Version: 02.00.17 * * Version History * --------------- * * Date Version Description * -------- -------- ------------------------------------------------------ * 04-30-07 02.00.00 Corresponds to Fusion-MPT MPI Specification Rev A. * 06-04-07 02.00.01 Bumped MPI2_HEADER_VERSION_UNIT. * 06-26-07 02.00.02 Bumped MPI2_HEADER_VERSION_UNIT. * 08-31-07 02.00.03 Bumped MPI2_HEADER_VERSION_UNIT. * Moved ReplyPostHostIndex register to offset 0x6C of the * MPI2_SYSTEM_INTERFACE_REGS and modified the define for * MPI2_REPLY_POST_HOST_INDEX_OFFSET. * Added union of request descriptors. * Added union of reply descriptors. * 10-31-07 02.00.04 Bumped MPI2_HEADER_VERSION_UNIT. * Added define for MPI2_VERSION_02_00. * Fixed the size of the FunctionDependent5 field in the * MPI2_DEFAULT_REPLY structure. * 12-18-07 02.00.05 Bumped MPI2_HEADER_VERSION_UNIT. * Removed the MPI-defined Fault Codes and extended the * product specific codes up to 0xEFFF. * Added a sixth key value for the WriteSequence register * and changed the flush value to 0x0. * Added message function codes for Diagnostic Buffer Post * and Diagnsotic Release. * New IOCStatus define: MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED * Moved MPI2_VERSION_UNION from mpi2_ioc.h. * 02-29-08 02.00.06 Bumped MPI2_HEADER_VERSION_UNIT. * 03-03-08 02.00.07 Bumped MPI2_HEADER_VERSION_UNIT. * 05-21-08 02.00.08 Bumped MPI2_HEADER_VERSION_UNIT. * Added #defines for marking a reply descriptor as unused. * 06-27-08 02.00.09 Bumped MPI2_HEADER_VERSION_UNIT. * 10-02-08 02.00.10 Bumped MPI2_HEADER_VERSION_UNIT. * Moved LUN field defines from mpi2_init.h. * 01-19-09 02.00.11 Bumped MPI2_HEADER_VERSION_UNIT. * 05-06-09 02.00.12 Bumped MPI2_HEADER_VERSION_UNIT. * In all request and reply descriptors, replaced VF_ID * field with MSIxIndex field. * Removed DevHandle field from * MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR and made those * bytes reserved. * Added RAID Accelerator functionality. * 07-30-09 02.00.13 Bumped MPI2_HEADER_VERSION_UNIT. * 10-28-09 02.00.14 Bumped MPI2_HEADER_VERSION_UNIT. * Added MSI-x index mask and shift for Reply Post Host * Index register. * Added function code for Host Based Discovery Action. * 02-10-10 02.00.15 Bumped MPI2_HEADER_VERSION_UNIT. * Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL. * Added defines for product-specific range of message * function codes, 0xF0 to 0xFF. * 05-12-10 02.00.16 Bumped MPI2_HEADER_VERSION_UNIT. * Added alternative defines for the SGE Direction bit. * 08-11-10 02.00.17 Bumped MPI2_HEADER_VERSION_UNIT. * -------------------------------------------------------------------------- */ #ifndef MPI2_H #define MPI2_H /***************************************************************************** * * MPI Version Definitions * *****************************************************************************/ #define MPI2_VERSION_MAJOR (0x02) #define MPI2_VERSION_MINOR (0x00) #define MPI2_VERSION_MAJOR_MASK (0xFF00) #define MPI2_VERSION_MAJOR_SHIFT (8) #define MPI2_VERSION_MINOR_MASK (0x00FF) #define MPI2_VERSION_MINOR_SHIFT (0) #define MPI2_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \ MPI2_VERSION_MINOR) #define MPI2_VERSION_02_00 (0x0200) /* versioning for this MPI header set */ #define MPI2_HEADER_VERSION_UNIT (0x11) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) #define MPI2_HEADER_VERSION_DEV_MASK (0x00FF) #define MPI2_HEADER_VERSION_DEV_SHIFT (0) #define MPI2_HEADER_VERSION ((MPI2_HEADER_VERSION_UNIT << 8) | MPI2_HEADER_VERSION_DEV) /***************************************************************************** * * IOC State Definitions * *****************************************************************************/ #define MPI2_IOC_STATE_RESET (0x00000000) #define MPI2_IOC_STATE_READY (0x10000000) #define MPI2_IOC_STATE_OPERATIONAL (0x20000000) #define MPI2_IOC_STATE_FAULT (0x40000000) #define MPI2_IOC_STATE_MASK (0xF0000000) #define MPI2_IOC_STATE_SHIFT (28) /* Fault state range for prodcut specific codes */ #define MPI2_FAULT_PRODUCT_SPECIFIC_MIN (0x0000) #define MPI2_FAULT_PRODUCT_SPECIFIC_MAX (0xEFFF) /***************************************************************************** * * System Interface Register Definitions * *****************************************************************************/ typedef volatile struct _MPI2_SYSTEM_INTERFACE_REGS { U32 Doorbell; /* 0x00 */ U32 WriteSequence; /* 0x04 */ U32 HostDiagnostic; /* 0x08 */ U32 Reserved1; /* 0x0C */ U32 DiagRWData; /* 0x10 */ U32 DiagRWAddressLow; /* 0x14 */ U32 DiagRWAddressHigh; /* 0x18 */ U32 Reserved2[5]; /* 0x1C */ U32 HostInterruptStatus; /* 0x30 */ U32 HostInterruptMask; /* 0x34 */ U32 DCRData; /* 0x38 */ U32 DCRAddress; /* 0x3C */ U32 Reserved3[2]; /* 0x40 */ U32 ReplyFreeHostIndex; /* 0x48 */ U32 Reserved4[8]; /* 0x4C */ U32 ReplyPostHostIndex; /* 0x6C */ U32 Reserved5; /* 0x70 */ U32 HCBSize; /* 0x74 */ U32 HCBAddressLow; /* 0x78 */ U32 HCBAddressHigh; /* 0x7C */ U32 Reserved6[16]; /* 0x80 */ U32 RequestDescriptorPostLow; /* 0xC0 */ U32 RequestDescriptorPostHigh; /* 0xC4 */ U32 Reserved7[14]; /* 0xC8 */ } MPI2_SYSTEM_INTERFACE_REGS, MPI2_POINTER PTR_MPI2_SYSTEM_INTERFACE_REGS, Mpi2SystemInterfaceRegs_t, MPI2_POINTER pMpi2SystemInterfaceRegs_t; /* * Defines for working with the Doorbell register. */ #define MPI2_DOORBELL_OFFSET (0x00000000) /* IOC --> System values */ #define MPI2_DOORBELL_USED (0x08000000) #define MPI2_DOORBELL_WHO_INIT_MASK (0x07000000) #define MPI2_DOORBELL_WHO_INIT_SHIFT (24) #define MPI2_DOORBELL_FAULT_CODE_MASK (0x0000FFFF) #define MPI2_DOORBELL_DATA_MASK (0x0000FFFF) /* System --> IOC values */ #define MPI2_DOORBELL_FUNCTION_MASK (0xFF000000) #define MPI2_DOORBELL_FUNCTION_SHIFT (24) #define MPI2_DOORBELL_ADD_DWORDS_MASK (0x00FF0000) #define MPI2_DOORBELL_ADD_DWORDS_SHIFT (16) /* * Defines for the WriteSequence register */ #define MPI2_WRITE_SEQUENCE_OFFSET (0x00000004) #define MPI2_WRSEQ_KEY_VALUE_MASK (0x0000000F) #define MPI2_WRSEQ_FLUSH_KEY_VALUE (0x0) #define MPI2_WRSEQ_1ST_KEY_VALUE (0xF) #define MPI2_WRSEQ_2ND_KEY_VALUE (0x4) #define MPI2_WRSEQ_3RD_KEY_VALUE (0xB) #define MPI2_WRSEQ_4TH_KEY_VALUE (0x2) #define MPI2_WRSEQ_5TH_KEY_VALUE (0x7) #define MPI2_WRSEQ_6TH_KEY_VALUE (0xD) /* * Defines for the HostDiagnostic register */ #define MPI2_HOST_DIAGNOSTIC_OFFSET (0x00000008) #define MPI2_DIAG_BOOT_DEVICE_SELECT_MASK (0x00001800) #define MPI2_DIAG_BOOT_DEVICE_SELECT_DEFAULT (0x00000000) #define MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW (0x00000800) #define MPI2_DIAG_CLEAR_FLASH_BAD_SIG (0x00000400) #define MPI2_DIAG_FORCE_HCB_ON_RESET (0x00000200) #define MPI2_DIAG_HCB_MODE (0x00000100) #define MPI2_DIAG_DIAG_WRITE_ENABLE (0x00000080) #define MPI2_DIAG_FLASH_BAD_SIG (0x00000040) #define MPI2_DIAG_RESET_HISTORY (0x00000020) #define MPI2_DIAG_DIAG_RW_ENABLE (0x00000010) #define MPI2_DIAG_RESET_ADAPTER (0x00000004) #define MPI2_DIAG_HOLD_IOC_RESET (0x00000002) /* * Offsets for DiagRWData and address */ #define MPI2_DIAG_RW_DATA_OFFSET (0x00000010) #define MPI2_DIAG_RW_ADDRESS_LOW_OFFSET (0x00000014) #define MPI2_DIAG_RW_ADDRESS_HIGH_OFFSET (0x00000018) /* * Defines for the HostInterruptStatus register */ #define MPI2_HOST_INTERRUPT_STATUS_OFFSET (0x00000030) #define MPI2_HIS_SYS2IOC_DB_STATUS (0x80000000) #define MPI2_HIS_IOP_DOORBELL_STATUS MPI2_HIS_SYS2IOC_DB_STATUS #define MPI2_HIS_RESET_IRQ_STATUS (0x40000000) #define MPI2_HIS_REPLY_DESCRIPTOR_INTERRUPT (0x00000008) #define MPI2_HIS_IOC2SYS_DB_STATUS (0x00000001) #define MPI2_HIS_DOORBELL_INTERRUPT MPI2_HIS_IOC2SYS_DB_STATUS /* * Defines for the HostInterruptMask register */ #define MPI2_HOST_INTERRUPT_MASK_OFFSET (0x00000034) #define MPI2_HIM_RESET_IRQ_MASK (0x40000000) #define MPI2_HIM_REPLY_INT_MASK (0x00000008) #define MPI2_HIM_RIM MPI2_HIM_REPLY_INT_MASK #define MPI2_HIM_IOC2SYS_DB_MASK (0x00000001) #define MPI2_HIM_DIM MPI2_HIM_IOC2SYS_DB_MASK /* * Offsets for DCRData and address */ #define MPI2_DCR_DATA_OFFSET (0x00000038) #define MPI2_DCR_ADDRESS_OFFSET (0x0000003C) /* * Offset for the Reply Free Queue */ #define MPI2_REPLY_FREE_HOST_INDEX_OFFSET (0x00000048) /* * Defines for the Reply Descriptor Post Queue */ #define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) #define MPI2_REPLY_POST_HOST_INDEX_MASK (0x00FFFFFF) #define MPI2_RPHI_MSIX_INDEX_MASK (0xFF000000) #define MPI2_RPHI_MSIX_INDEX_SHIFT (24) /* * Defines for the HCBSize and address */ #define MPI2_HCB_SIZE_OFFSET (0x00000074) #define MPI2_HCB_SIZE_SIZE_MASK (0xFFFFF000) #define MPI2_HCB_SIZE_HCB_ENABLE (0x00000001) #define MPI2_HCB_ADDRESS_LOW_OFFSET (0x00000078) #define MPI2_HCB_ADDRESS_HIGH_OFFSET (0x0000007C) /* * Offsets for the Request Queue */ #define MPI2_REQUEST_DESCRIPTOR_POST_LOW_OFFSET (0x000000C0) #define MPI2_REQUEST_DESCRIPTOR_POST_HIGH_OFFSET (0x000000C4) /***************************************************************************** * * Message Descriptors * *****************************************************************************/ /* Request Descriptors */ /* Default Request Descriptor */ typedef struct _MPI2_DEFAULT_REQUEST_DESCRIPTOR { U8 RequestFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U16 SMID; /* 0x02 */ U16 LMID; /* 0x04 */ U16 DescriptorTypeDependent; /* 0x06 */ } MPI2_DEFAULT_REQUEST_DESCRIPTOR, MPI2_POINTER PTR_MPI2_DEFAULT_REQUEST_DESCRIPTOR, Mpi2DefaultRequestDescriptor_t, MPI2_POINTER pMpi2DefaultRequestDescriptor_t; /* defines for the RequestFlags field */ #define MPI2_REQ_DESCRIPT_FLAGS_TYPE_MASK (0x0E) #define MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO (0x00) #define MPI2_REQ_DESCRIPT_FLAGS_SCSI_TARGET (0x02) #define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY (0x06) #define MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE (0x08) #define MPI2_REQ_DESCRIPT_FLAGS_RAID_ACCELERATOR (0x0A) #define MPI2_REQ_DESCRIPT_FLAGS_IOC_FIFO_MARKER (0x01) /* High Priority Request Descriptor */ typedef struct _MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR { U8 RequestFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U16 SMID; /* 0x02 */ U16 LMID; /* 0x04 */ U16 Reserved1; /* 0x06 */ } MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR, MPI2_POINTER PTR_MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR, Mpi2HighPriorityRequestDescriptor_t, MPI2_POINTER pMpi2HighPriorityRequestDescriptor_t; /* SCSI IO Request Descriptor */ typedef struct _MPI2_SCSI_IO_REQUEST_DESCRIPTOR { U8 RequestFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U16 SMID; /* 0x02 */ U16 LMID; /* 0x04 */ U16 DevHandle; /* 0x06 */ } MPI2_SCSI_IO_REQUEST_DESCRIPTOR, MPI2_POINTER PTR_MPI2_SCSI_IO_REQUEST_DESCRIPTOR, Mpi2SCSIIORequestDescriptor_t, MPI2_POINTER pMpi2SCSIIORequestDescriptor_t; /* SCSI Target Request Descriptor */ typedef struct _MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR { U8 RequestFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U16 SMID; /* 0x02 */ U16 LMID; /* 0x04 */ U16 IoIndex; /* 0x06 */ } MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR, MPI2_POINTER PTR_MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR, Mpi2SCSITargetRequestDescriptor_t, MPI2_POINTER pMpi2SCSITargetRequestDescriptor_t; /* RAID Accelerator Request Descriptor */ typedef struct _MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR { U8 RequestFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U16 SMID; /* 0x02 */ U16 LMID; /* 0x04 */ U16 Reserved; /* 0x06 */ } MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR, MPI2_POINTER PTR_MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR, Mpi2RAIDAcceleratorRequestDescriptor_t, MPI2_POINTER pMpi2RAIDAcceleratorRequestDescriptor_t; /* union of Request Descriptors */ typedef union _MPI2_REQUEST_DESCRIPTOR_UNION { MPI2_DEFAULT_REQUEST_DESCRIPTOR Default; MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR HighPriority; MPI2_SCSI_IO_REQUEST_DESCRIPTOR SCSIIO; MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR SCSITarget; MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR RAIDAccelerator; U64 Words; } MPI2_REQUEST_DESCRIPTOR_UNION, MPI2_POINTER PTR_MPI2_REQUEST_DESCRIPTOR_UNION, Mpi2RequestDescriptorUnion_t, MPI2_POINTER pMpi2RequestDescriptorUnion_t; /* Reply Descriptors */ /* Default Reply Descriptor */ typedef struct _MPI2_DEFAULT_REPLY_DESCRIPTOR { U8 ReplyFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U16 DescriptorTypeDependent1; /* 0x02 */ U32 DescriptorTypeDependent2; /* 0x04 */ } MPI2_DEFAULT_REPLY_DESCRIPTOR, MPI2_POINTER PTR_MPI2_DEFAULT_REPLY_DESCRIPTOR, Mpi2DefaultReplyDescriptor_t, MPI2_POINTER pMpi2DefaultReplyDescriptor_t; /* defines for the ReplyFlags field */ #define MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK (0x0F) #define MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS (0x00) #define MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY (0x01) #define MPI2_RPY_DESCRIPT_FLAGS_TARGETASSIST_SUCCESS (0x02) #define MPI2_RPY_DESCRIPT_FLAGS_TARGET_COMMAND_BUFFER (0x03) #define MPI2_RPY_DESCRIPT_FLAGS_RAID_ACCELERATOR_SUCCESS (0x05) #define MPI2_RPY_DESCRIPT_FLAGS_UNUSED (0x0F) /* values for marking a reply descriptor as unused */ #define MPI2_RPY_DESCRIPT_UNUSED_WORD0_MARK (0xFFFFFFFF) #define MPI2_RPY_DESCRIPT_UNUSED_WORD1_MARK (0xFFFFFFFF) /* Address Reply Descriptor */ typedef struct _MPI2_ADDRESS_REPLY_DESCRIPTOR { U8 ReplyFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U16 SMID; /* 0x02 */ U32 ReplyFrameAddress; /* 0x04 */ } MPI2_ADDRESS_REPLY_DESCRIPTOR, MPI2_POINTER PTR_MPI2_ADDRESS_REPLY_DESCRIPTOR, Mpi2AddressReplyDescriptor_t, MPI2_POINTER pMpi2AddressReplyDescriptor_t; #define MPI2_ADDRESS_REPLY_SMID_INVALID (0x00) /* SCSI IO Success Reply Descriptor */ typedef struct _MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR { U8 ReplyFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U16 SMID; /* 0x02 */ U16 TaskTag; /* 0x04 */ U16 Reserved1; /* 0x06 */ } MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR, MPI2_POINTER PTR_MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR, Mpi2SCSIIOSuccessReplyDescriptor_t, MPI2_POINTER pMpi2SCSIIOSuccessReplyDescriptor_t; /* TargetAssist Success Reply Descriptor */ typedef struct _MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR { U8 ReplyFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U16 SMID; /* 0x02 */ U8 SequenceNumber; /* 0x04 */ U8 Reserved1; /* 0x05 */ U16 IoIndex; /* 0x06 */ } MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR, MPI2_POINTER PTR_MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR, Mpi2TargetAssistSuccessReplyDescriptor_t, MPI2_POINTER pMpi2TargetAssistSuccessReplyDescriptor_t; /* Target Command Buffer Reply Descriptor */ typedef struct _MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR { U8 ReplyFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U8 VP_ID; /* 0x02 */ U8 Flags; /* 0x03 */ U16 InitiatorDevHandle; /* 0x04 */ U16 IoIndex; /* 0x06 */ } MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR, MPI2_POINTER PTR_MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR, Mpi2TargetCommandBufferReplyDescriptor_t, MPI2_POINTER pMpi2TargetCommandBufferReplyDescriptor_t; /* defines for Flags field */ #define MPI2_RPY_DESCRIPT_TCB_FLAGS_PHYNUM_MASK (0x3F) /* RAID Accelerator Success Reply Descriptor */ typedef struct _MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR { U8 ReplyFlags; /* 0x00 */ U8 MSIxIndex; /* 0x01 */ U16 SMID; /* 0x02 */ U32 Reserved; /* 0x04 */ } MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR, MPI2_POINTER PTR_MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR, Mpi2RAIDAcceleratorSuccessReplyDescriptor_t, MPI2_POINTER pMpi2RAIDAcceleratorSuccessReplyDescriptor_t; /* union of Reply Descriptors */ typedef union _MPI2_REPLY_DESCRIPTORS_UNION { MPI2_DEFAULT_REPLY_DESCRIPTOR Default; MPI2_ADDRESS_REPLY_DESCRIPTOR AddressReply; MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR SCSIIOSuccess; MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR TargetAssistSuccess; MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR TargetCommandBuffer; MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR RAIDAcceleratorSuccess; U64 Words; } MPI2_REPLY_DESCRIPTORS_UNION, MPI2_POINTER PTR_MPI2_REPLY_DESCRIPTORS_UNION, Mpi2ReplyDescriptorsUnion_t, MPI2_POINTER pMpi2ReplyDescriptorsUnion_t; /***************************************************************************** * * Message Functions * *****************************************************************************/ #define MPI2_FUNCTION_SCSI_IO_REQUEST (0x00) /* SCSI IO */ #define MPI2_FUNCTION_SCSI_TASK_MGMT (0x01) /* SCSI Task Management */ #define MPI2_FUNCTION_IOC_INIT (0x02) /* IOC Init */ #define MPI2_FUNCTION_IOC_FACTS (0x03) /* IOC Facts */ #define MPI2_FUNCTION_CONFIG (0x04) /* Configuration */ #define MPI2_FUNCTION_PORT_FACTS (0x05) /* Port Facts */ #define MPI2_FUNCTION_PORT_ENABLE (0x06) /* Port Enable */ #define MPI2_FUNCTION_EVENT_NOTIFICATION (0x07) /* Event Notification */ #define MPI2_FUNCTION_EVENT_ACK (0x08) /* Event Acknowledge */ #define MPI2_FUNCTION_FW_DOWNLOAD (0x09) /* FW Download */ #define MPI2_FUNCTION_TARGET_ASSIST (0x0B) /* Target Assist */ #define MPI2_FUNCTION_TARGET_STATUS_SEND (0x0C) /* Target Status Send */ #define MPI2_FUNCTION_TARGET_MODE_ABORT (0x0D) /* Target Mode Abort */ #define MPI2_FUNCTION_FW_UPLOAD (0x12) /* FW Upload */ #define MPI2_FUNCTION_RAID_ACTION (0x15) /* RAID Action */ #define MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH (0x16) /* SCSI IO RAID Passthrough */ #define MPI2_FUNCTION_TOOLBOX (0x17) /* Toolbox */ #define MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR (0x18) /* SCSI Enclosure Processor */ #define MPI2_FUNCTION_SMP_PASSTHROUGH (0x1A) /* SMP Passthrough */ #define MPI2_FUNCTION_SAS_IO_UNIT_CONTROL (0x1B) /* SAS IO Unit Control */ #define MPI2_FUNCTION_SATA_PASSTHROUGH (0x1C) /* SATA Passthrough */ #define MPI2_FUNCTION_DIAG_BUFFER_POST (0x1D) /* Diagnostic Buffer Post */ #define MPI2_FUNCTION_DIAG_RELEASE (0x1E) /* Diagnostic Release */ #define MPI2_FUNCTION_TARGET_CMD_BUF_BASE_POST (0x24) /* Target Command Buffer Post Base */ #define MPI2_FUNCTION_TARGET_CMD_BUF_LIST_POST (0x25) /* Target Command Buffer Post List */ #define MPI2_FUNCTION_RAID_ACCELERATOR (0x2C) /* RAID Accelerator*/ /* Host Based Discovery Action */ #define MPI2_FUNCTION_HOST_BASED_DISCOVERY_ACTION (0x2F) /* Power Management Control */ #define MPI2_FUNCTION_PWR_MGMT_CONTROL (0x30) /* beginning of product-specific range */ #define MPI2_FUNCTION_MIN_PRODUCT_SPECIFIC (0xF0) /* end of product-specific range */ #define MPI2_FUNCTION_MAX_PRODUCT_SPECIFIC (0xFF) /* Doorbell functions */ #define MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET (0x40) #define MPI2_FUNCTION_HANDSHAKE (0x42) /***************************************************************************** * * IOC Status Values * *****************************************************************************/ /* mask for IOCStatus status value */ #define MPI2_IOCSTATUS_MASK (0x7FFF) /**************************************************************************** * Common IOCStatus values for all replies ****************************************************************************/ #define MPI2_IOCSTATUS_SUCCESS (0x0000) #define MPI2_IOCSTATUS_INVALID_FUNCTION (0x0001) #define MPI2_IOCSTATUS_BUSY (0x0002) #define MPI2_IOCSTATUS_INVALID_SGL (0x0003) #define MPI2_IOCSTATUS_INTERNAL_ERROR (0x0004) #define MPI2_IOCSTATUS_INVALID_VPID (0x0005) #define MPI2_IOCSTATUS_INSUFFICIENT_RESOURCES (0x0006) #define MPI2_IOCSTATUS_INVALID_FIELD (0x0007) #define MPI2_IOCSTATUS_INVALID_STATE (0x0008) #define MPI2_IOCSTATUS_OP_STATE_NOT_SUPPORTED (0x0009) /**************************************************************************** * Config IOCStatus values ****************************************************************************/ #define MPI2_IOCSTATUS_CONFIG_INVALID_ACTION (0x0020) #define MPI2_IOCSTATUS_CONFIG_INVALID_TYPE (0x0021) #define MPI2_IOCSTATUS_CONFIG_INVALID_PAGE (0x0022) #define MPI2_IOCSTATUS_CONFIG_INVALID_DATA (0x0023) #define MPI2_IOCSTATUS_CONFIG_NO_DEFAULTS (0x0024) #define MPI2_IOCSTATUS_CONFIG_CANT_COMMIT (0x0025) /**************************************************************************** * SCSI IO Reply ****************************************************************************/ #define MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR (0x0040) #define MPI2_IOCSTATUS_SCSI_INVALID_DEVHANDLE (0x0042) #define MPI2_IOCSTATUS_SCSI_DEVICE_NOT_THERE (0x0043) #define MPI2_IOCSTATUS_SCSI_DATA_OVERRUN (0x0044) #define MPI2_IOCSTATUS_SCSI_DATA_UNDERRUN (0x0045) #define MPI2_IOCSTATUS_SCSI_IO_DATA_ERROR (0x0046) #define MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR (0x0047) #define MPI2_IOCSTATUS_SCSI_TASK_TERMINATED (0x0048) #define MPI2_IOCSTATUS_SCSI_RESIDUAL_MISMATCH (0x0049) #define MPI2_IOCSTATUS_SCSI_TASK_MGMT_FAILED (0x004A) #define MPI2_IOCSTATUS_SCSI_IOC_TERMINATED (0x004B) #define MPI2_IOCSTATUS_SCSI_EXT_TERMINATED (0x004C) /**************************************************************************** * For use by SCSI Initiator and SCSI Target end-to-end data protection ****************************************************************************/ #define MPI2_IOCSTATUS_EEDP_GUARD_ERROR (0x004D) #define MPI2_IOCSTATUS_EEDP_REF_TAG_ERROR (0x004E) #define MPI2_IOCSTATUS_EEDP_APP_TAG_ERROR (0x004F) /**************************************************************************** * SCSI Target values ****************************************************************************/ #define MPI2_IOCSTATUS_TARGET_INVALID_IO_INDEX (0x0062) #define MPI2_IOCSTATUS_TARGET_ABORTED (0x0063) #define MPI2_IOCSTATUS_TARGET_NO_CONN_RETRYABLE (0x0064) #define MPI2_IOCSTATUS_TARGET_NO_CONNECTION (0x0065) #define MPI2_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH (0x006A) #define MPI2_IOCSTATUS_TARGET_DATA_OFFSET_ERROR (0x006D) #define MPI2_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA (0x006E) #define MPI2_IOCSTATUS_TARGET_IU_TOO_SHORT (0x006F) #define MPI2_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT (0x0070) #define MPI2_IOCSTATUS_TARGET_NAK_RECEIVED (0x0071) /**************************************************************************** * Serial Attached SCSI values ****************************************************************************/ #define MPI2_IOCSTATUS_SAS_SMP_REQUEST_FAILED (0x0090) #define MPI2_IOCSTATUS_SAS_SMP_DATA_OVERRUN (0x0091) /**************************************************************************** * Diagnostic Buffer Post / Diagnostic Release values ****************************************************************************/ #define MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED (0x00A0) /**************************************************************************** * RAID Accelerator values ****************************************************************************/ #define MPI2_IOCSTATUS_RAID_ACCEL_ERROR (0x00B0) /**************************************************************************** * IOCStatus flag to indicate that log info is available ****************************************************************************/ #define MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE (0x8000) /**************************************************************************** * IOCLogInfo Types ****************************************************************************/ #define MPI2_IOCLOGINFO_TYPE_MASK (0xF0000000) #define MPI2_IOCLOGINFO_TYPE_SHIFT (28) #define MPI2_IOCLOGINFO_TYPE_NONE (0x0) #define MPI2_IOCLOGINFO_TYPE_SCSI (0x1) #define MPI2_IOCLOGINFO_TYPE_FC (0x2) #define MPI2_IOCLOGINFO_TYPE_SAS (0x3) #define MPI2_IOCLOGINFO_TYPE_ISCSI (0x4) #define MPI2_IOCLOGINFO_LOG_DATA_MASK (0x0FFFFFFF) /***************************************************************************** * * Standard Message Structures * *****************************************************************************/ /**************************************************************************** * Request Message Header for all request messages ****************************************************************************/ typedef struct _MPI2_REQUEST_HEADER { U16 FunctionDependent1; /* 0x00 */ U8 ChainOffset; /* 0x02 */ U8 Function; /* 0x03 */ U16 FunctionDependent2; /* 0x04 */ U8 FunctionDependent3; /* 0x06 */ U8 MsgFlags; /* 0x07 */ U8 VP_ID; /* 0x08 */ U8 VF_ID; /* 0x09 */ U16 Reserved1; /* 0x0A */ } MPI2_REQUEST_HEADER, MPI2_POINTER PTR_MPI2_REQUEST_HEADER, MPI2RequestHeader_t, MPI2_POINTER pMPI2RequestHeader_t; /**************************************************************************** * Default Reply ****************************************************************************/ typedef struct _MPI2_DEFAULT_REPLY { U16 FunctionDependent1; /* 0x00 */ U8 MsgLength; /* 0x02 */ U8 Function; /* 0x03 */ U16 FunctionDependent2; /* 0x04 */ U8 FunctionDependent3; /* 0x06 */ U8 MsgFlags; /* 0x07 */ U8 VP_ID; /* 0x08 */ U8 VF_ID; /* 0x09 */ U16 Reserved1; /* 0x0A */ U16 FunctionDependent5; /* 0x0C */ U16 IOCStatus; /* 0x0E */ U32 IOCLogInfo; /* 0x10 */ } MPI2_DEFAULT_REPLY, MPI2_POINTER PTR_MPI2_DEFAULT_REPLY, MPI2DefaultReply_t, MPI2_POINTER pMPI2DefaultReply_t; /* common version structure/union used in messages and configuration pages */ typedef struct _MPI2_VERSION_STRUCT { U8 Dev; /* 0x00 */ U8 Unit; /* 0x01 */ U8 Minor; /* 0x02 */ U8 Major; /* 0x03 */ } MPI2_VERSION_STRUCT; typedef union _MPI2_VERSION_UNION { MPI2_VERSION_STRUCT Struct; U32 Word; } MPI2_VERSION_UNION; /* LUN field defines, common to many structures */ #define MPI2_LUN_FIRST_LEVEL_ADDRESSING (0x0000FFFF) #define MPI2_LUN_SECOND_LEVEL_ADDRESSING (0xFFFF0000) #define MPI2_LUN_THIRD_LEVEL_ADDRESSING (0x0000FFFF) #define MPI2_LUN_FOURTH_LEVEL_ADDRESSING (0xFFFF0000) #define MPI2_LUN_LEVEL_1_WORD (0xFF00) #define MPI2_LUN_LEVEL_1_DWORD (0x0000FF00) /***************************************************************************** * * Fusion-MPT MPI Scatter Gather Elements * *****************************************************************************/ /**************************************************************************** * MPI Simple Element structures ****************************************************************************/ typedef struct _MPI2_SGE_SIMPLE32 { U32 FlagsLength; U32 Address; } MPI2_SGE_SIMPLE32, MPI2_POINTER PTR_MPI2_SGE_SIMPLE32, Mpi2SGESimple32_t, MPI2_POINTER pMpi2SGESimple32_t; typedef struct _MPI2_SGE_SIMPLE64 { U32 FlagsLength; U64 Address; } MPI2_SGE_SIMPLE64, MPI2_POINTER PTR_MPI2_SGE_SIMPLE64, Mpi2SGESimple64_t, MPI2_POINTER pMpi2SGESimple64_t; typedef struct _MPI2_SGE_SIMPLE_UNION { U32 FlagsLength; union { U32 Address32; U64 Address64; } u; } MPI2_SGE_SIMPLE_UNION, MPI2_POINTER PTR_MPI2_SGE_SIMPLE_UNION, Mpi2SGESimpleUnion_t, MPI2_POINTER pMpi2SGESimpleUnion_t; /**************************************************************************** * MPI Chain Element structures ****************************************************************************/ typedef struct _MPI2_SGE_CHAIN32 { U16 Length; U8 NextChainOffset; U8 Flags; U32 Address; } MPI2_SGE_CHAIN32, MPI2_POINTER PTR_MPI2_SGE_CHAIN32, Mpi2SGEChain32_t, MPI2_POINTER pMpi2SGEChain32_t; typedef struct _MPI2_SGE_CHAIN64 { U16 Length; U8 NextChainOffset; U8 Flags; U64 Address; } MPI2_SGE_CHAIN64, MPI2_POINTER PTR_MPI2_SGE_CHAIN64, Mpi2SGEChain64_t, MPI2_POINTER pMpi2SGEChain64_t; typedef struct _MPI2_SGE_CHAIN_UNION { U16 Length; U8 NextChainOffset; U8 Flags; union { U32 Address32; U64 Address64; } u; } MPI2_SGE_CHAIN_UNION, MPI2_POINTER PTR_MPI2_SGE_CHAIN_UNION, Mpi2SGEChainUnion_t, MPI2_POINTER pMpi2SGEChainUnion_t; /**************************************************************************** * MPI Transaction Context Element structures ****************************************************************************/ typedef struct _MPI2_SGE_TRANSACTION32 { U8 Reserved; U8 ContextSize; U8 DetailsLength; U8 Flags; U32 TransactionContext[1]; U32 TransactionDetails[1]; } MPI2_SGE_TRANSACTION32, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION32, Mpi2SGETransaction32_t, MPI2_POINTER pMpi2SGETransaction32_t; typedef struct _MPI2_SGE_TRANSACTION64 { U8 Reserved; U8 ContextSize; U8 DetailsLength; U8 Flags; U32 TransactionContext[2]; U32 TransactionDetails[1]; } MPI2_SGE_TRANSACTION64, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION64, Mpi2SGETransaction64_t, MPI2_POINTER pMpi2SGETransaction64_t; typedef struct _MPI2_SGE_TRANSACTION96 { U8 Reserved; U8 ContextSize; U8 DetailsLength; U8 Flags; U32 TransactionContext[3]; U32 TransactionDetails[1]; } MPI2_SGE_TRANSACTION96, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION96, Mpi2SGETransaction96_t, MPI2_POINTER pMpi2SGETransaction96_t; typedef struct _MPI2_SGE_TRANSACTION128 { U8 Reserved; U8 ContextSize; U8 DetailsLength; U8 Flags; U32 TransactionContext[4]; U32 TransactionDetails[1]; } MPI2_SGE_TRANSACTION128, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION128, Mpi2SGETransaction_t128, MPI2_POINTER pMpi2SGETransaction_t128; typedef struct _MPI2_SGE_TRANSACTION_UNION { U8 Reserved; U8 ContextSize; U8 DetailsLength; U8 Flags; union { U32 TransactionContext32[1]; U32 TransactionContext64[2]; U32 TransactionContext96[3]; U32 TransactionContext128[4]; } u; U32 TransactionDetails[1]; } MPI2_SGE_TRANSACTION_UNION, MPI2_POINTER PTR_MPI2_SGE_TRANSACTION_UNION, Mpi2SGETransactionUnion_t, MPI2_POINTER pMpi2SGETransactionUnion_t; /**************************************************************************** * MPI SGE union for IO SGL's ****************************************************************************/ typedef struct _MPI2_MPI_SGE_IO_UNION { union { MPI2_SGE_SIMPLE_UNION Simple; MPI2_SGE_CHAIN_UNION Chain; } u; } MPI2_MPI_SGE_IO_UNION, MPI2_POINTER PTR_MPI2_MPI_SGE_IO_UNION, Mpi2MpiSGEIOUnion_t, MPI2_POINTER pMpi2MpiSGEIOUnion_t; /**************************************************************************** * MPI SGE union for SGL's with Simple and Transaction elements ****************************************************************************/ typedef struct _MPI2_SGE_TRANS_SIMPLE_UNION { union { MPI2_SGE_SIMPLE_UNION Simple; MPI2_SGE_TRANSACTION_UNION Transaction; } u; } MPI2_SGE_TRANS_SIMPLE_UNION, MPI2_POINTER PTR_MPI2_SGE_TRANS_SIMPLE_UNION, Mpi2SGETransSimpleUnion_t, MPI2_POINTER pMpi2SGETransSimpleUnion_t; /**************************************************************************** * All MPI SGE types union ****************************************************************************/ typedef struct _MPI2_MPI_SGE_UNION { union { MPI2_SGE_SIMPLE_UNION Simple; MPI2_SGE_CHAIN_UNION Chain; MPI2_SGE_TRANSACTION_UNION Transaction; } u; } MPI2_MPI_SGE_UNION, MPI2_POINTER PTR_MPI2_MPI_SGE_UNION, Mpi2MpiSgeUnion_t, MPI2_POINTER pMpi2MpiSgeUnion_t; /**************************************************************************** * MPI SGE field definition and masks ****************************************************************************/ /* Flags field bit definitions */ #define MPI2_SGE_FLAGS_LAST_ELEMENT (0x80) #define MPI2_SGE_FLAGS_END_OF_BUFFER (0x40) #define MPI2_SGE_FLAGS_ELEMENT_TYPE_MASK (0x30) #define MPI2_SGE_FLAGS_LOCAL_ADDRESS (0x08) #define MPI2_SGE_FLAGS_DIRECTION (0x04) #define MPI2_SGE_FLAGS_ADDRESS_SIZE (0x02) #define MPI2_SGE_FLAGS_END_OF_LIST (0x01) #define MPI2_SGE_FLAGS_SHIFT (24) #define MPI2_SGE_LENGTH_MASK (0x00FFFFFF) #define MPI2_SGE_CHAIN_LENGTH_MASK (0x0000FFFF) /* Element Type */ #define MPI2_SGE_FLAGS_TRANSACTION_ELEMENT (0x00) #define MPI2_SGE_FLAGS_SIMPLE_ELEMENT (0x10) #define MPI2_SGE_FLAGS_CHAIN_ELEMENT (0x30) #define MPI2_SGE_FLAGS_ELEMENT_MASK (0x30) /* Address location */ #define MPI2_SGE_FLAGS_SYSTEM_ADDRESS (0x00) /* Direction */ #define MPI2_SGE_FLAGS_IOC_TO_HOST (0x00) #define MPI2_SGE_FLAGS_HOST_TO_IOC (0x04) #define MPI2_SGE_FLAGS_DEST (MPI2_SGE_FLAGS_IOC_TO_HOST) #define MPI2_SGE_FLAGS_SOURCE (MPI2_SGE_FLAGS_HOST_TO_IOC) /* Address Size */ #define MPI2_SGE_FLAGS_32_BIT_ADDRESSING (0x00) #define MPI2_SGE_FLAGS_64_BIT_ADDRESSING (0x02) /* Context Size */ #define MPI2_SGE_FLAGS_32_BIT_CONTEXT (0x00) #define MPI2_SGE_FLAGS_64_BIT_CONTEXT (0x02) #define MPI2_SGE_FLAGS_96_BIT_CONTEXT (0x04) #define MPI2_SGE_FLAGS_128_BIT_CONTEXT (0x06) #define MPI2_SGE_CHAIN_OFFSET_MASK (0x00FF0000) #define MPI2_SGE_CHAIN_OFFSET_SHIFT (16) /**************************************************************************** * MPI SGE operation Macros ****************************************************************************/ /* SIMPLE FlagsLength manipulations... */ #define MPI2_SGE_SET_FLAGS(f) ((U32)(f) << MPI2_SGE_FLAGS_SHIFT) #define MPI2_SGE_GET_FLAGS(f) (((f) & ~MPI2_SGE_LENGTH_MASK) >> MPI2_SGE_FLAGS_SHIFT) #define MPI2_SGE_LENGTH(f) ((f) & MPI2_SGE_LENGTH_MASK) #define MPI2_SGE_CHAIN_LENGTH(f) ((f) & MPI2_SGE_CHAIN_LENGTH_MASK) #define MPI2_SGE_SET_FLAGS_LENGTH(f,l) (MPI2_SGE_SET_FLAGS(f) | MPI2_SGE_LENGTH(l)) #define MPI2_pSGE_GET_FLAGS(psg) MPI2_SGE_GET_FLAGS((psg)->FlagsLength) #define MPI2_pSGE_GET_LENGTH(psg) MPI2_SGE_LENGTH((psg)->FlagsLength) #define MPI2_pSGE_SET_FLAGS_LENGTH(psg,f,l) (psg)->FlagsLength = MPI2_SGE_SET_FLAGS_LENGTH(f,l) /* CAUTION - The following are READ-MODIFY-WRITE! */ #define MPI2_pSGE_SET_FLAGS(psg,f) (psg)->FlagsLength |= MPI2_SGE_SET_FLAGS(f) #define MPI2_pSGE_SET_LENGTH(psg,l) (psg)->FlagsLength |= MPI2_SGE_LENGTH(l) #define MPI2_GET_CHAIN_OFFSET(x) ((x & MPI2_SGE_CHAIN_OFFSET_MASK) >> MPI2_SGE_CHAIN_OFFSET_SHIFT) /***************************************************************************** * * Fusion-MPT IEEE Scatter Gather Elements * *****************************************************************************/ /**************************************************************************** * IEEE Simple Element structures ****************************************************************************/ typedef struct _MPI2_IEEE_SGE_SIMPLE32 { U32 Address; U32 FlagsLength; } MPI2_IEEE_SGE_SIMPLE32, MPI2_POINTER PTR_MPI2_IEEE_SGE_SIMPLE32, Mpi2IeeeSgeSimple32_t, MPI2_POINTER pMpi2IeeeSgeSimple32_t; typedef struct _MPI2_IEEE_SGE_SIMPLE64 { U64 Address; U32 Length; U16 Reserved1; U8 Reserved2; U8 Flags; } MPI2_IEEE_SGE_SIMPLE64, MPI2_POINTER PTR_MPI2_IEEE_SGE_SIMPLE64, Mpi2IeeeSgeSimple64_t, MPI2_POINTER pMpi2IeeeSgeSimple64_t; typedef union _MPI2_IEEE_SGE_SIMPLE_UNION { MPI2_IEEE_SGE_SIMPLE32 Simple32; MPI2_IEEE_SGE_SIMPLE64 Simple64; } MPI2_IEEE_SGE_SIMPLE_UNION, MPI2_POINTER PTR_MPI2_IEEE_SGE_SIMPLE_UNION, Mpi2IeeeSgeSimpleUnion_t, MPI2_POINTER pMpi2IeeeSgeSimpleUnion_t; /**************************************************************************** * IEEE Chain Element structures ****************************************************************************/ typedef MPI2_IEEE_SGE_SIMPLE32 MPI2_IEEE_SGE_CHAIN32; typedef MPI2_IEEE_SGE_SIMPLE64 MPI2_IEEE_SGE_CHAIN64; typedef union _MPI2_IEEE_SGE_CHAIN_UNION { MPI2_IEEE_SGE_CHAIN32 Chain32; MPI2_IEEE_SGE_CHAIN64 Chain64; } MPI2_IEEE_SGE_CHAIN_UNION, MPI2_POINTER PTR_MPI2_IEEE_SGE_CHAIN_UNION, Mpi2IeeeSgeChainUnion_t, MPI2_POINTER pMpi2IeeeSgeChainUnion_t; /**************************************************************************** * All IEEE SGE types union ****************************************************************************/ typedef struct _MPI2_IEEE_SGE_UNION { union { MPI2_IEEE_SGE_SIMPLE_UNION Simple; MPI2_IEEE_SGE_CHAIN_UNION Chain; } u; } MPI2_IEEE_SGE_UNION, MPI2_POINTER PTR_MPI2_IEEE_SGE_UNION, Mpi2IeeeSgeUnion_t, MPI2_POINTER pMpi2IeeeSgeUnion_t; /**************************************************************************** * IEEE SGE field definitions and masks ****************************************************************************/ /* Flags field bit definitions */ #define MPI2_IEEE_SGE_FLAGS_ELEMENT_TYPE_MASK (0x80) #define MPI2_IEEE32_SGE_FLAGS_SHIFT (24) #define MPI2_IEEE32_SGE_LENGTH_MASK (0x00FFFFFF) /* Element Type */ #define MPI2_IEEE_SGE_FLAGS_SIMPLE_ELEMENT (0x00) #define MPI2_IEEE_SGE_FLAGS_CHAIN_ELEMENT (0x80) /* Data Location Address Space */ #define MPI2_IEEE_SGE_FLAGS_ADDR_MASK (0x03) #define MPI2_IEEE_SGE_FLAGS_SYSTEM_ADDR (0x00) #define MPI2_IEEE_SGE_FLAGS_IOCDDR_ADDR (0x01) #define MPI2_IEEE_SGE_FLAGS_IOCPLB_ADDR (0x02) #define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR (0x03) /**************************************************************************** * IEEE SGE operation Macros ****************************************************************************/ /* SIMPLE FlagsLength manipulations... */ #define MPI2_IEEE32_SGE_SET_FLAGS(f) ((U32)(f) << MPI2_IEEE32_SGE_FLAGS_SHIFT) #define MPI2_IEEE32_SGE_GET_FLAGS(f) (((f) & ~MPI2_IEEE32_SGE_LENGTH_MASK) >> MPI2_IEEE32_SGE_FLAGS_SHIFT) #define MPI2_IEEE32_SGE_LENGTH(f) ((f) & MPI2_IEEE32_SGE_LENGTH_MASK) #define MPI2_IEEE32_SGE_SET_FLAGS_LENGTH(f, l) (MPI2_IEEE32_SGE_SET_FLAGS(f) | MPI2_IEEE32_SGE_LENGTH(l)) #define MPI2_IEEE32_pSGE_GET_FLAGS(psg) MPI2_IEEE32_SGE_GET_FLAGS((psg)->FlagsLength) #define MPI2_IEEE32_pSGE_GET_LENGTH(psg) MPI2_IEEE32_SGE_LENGTH((psg)->FlagsLength) #define MPI2_IEEE32_pSGE_SET_FLAGS_LENGTH(psg,f,l) (psg)->FlagsLength = MPI2_IEEE32_SGE_SET_FLAGS_LENGTH(f,l) /* CAUTION - The following are READ-MODIFY-WRITE! */ #define MPI2_IEEE32_pSGE_SET_FLAGS(psg,f) (psg)->FlagsLength |= MPI2_IEEE32_SGE_SET_FLAGS(f) #define MPI2_IEEE32_pSGE_SET_LENGTH(psg,l) (psg)->FlagsLength |= MPI2_IEEE32_SGE_LENGTH(l) /***************************************************************************** * * Fusion-MPT MPI/IEEE Scatter Gather Unions * *****************************************************************************/ typedef union _MPI2_SIMPLE_SGE_UNION { MPI2_SGE_SIMPLE_UNION MpiSimple; MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple; } MPI2_SIMPLE_SGE_UNION, MPI2_POINTER PTR_MPI2_SIMPLE_SGE_UNION, Mpi2SimpleSgeUntion_t, MPI2_POINTER pMpi2SimpleSgeUntion_t; typedef union _MPI2_SGE_IO_UNION { MPI2_SGE_SIMPLE_UNION MpiSimple; MPI2_SGE_CHAIN_UNION MpiChain; MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple; MPI2_IEEE_SGE_CHAIN_UNION IeeeChain; } MPI2_SGE_IO_UNION, MPI2_POINTER PTR_MPI2_SGE_IO_UNION, Mpi2SGEIOUnion_t, MPI2_POINTER pMpi2SGEIOUnion_t; /**************************************************************************** * * Values for SGLFlags field, used in many request messages with an SGL * ****************************************************************************/ /* values for MPI SGL Data Location Address Space subfield */ #define MPI2_SGLFLAGS_ADDRESS_SPACE_MASK (0x0C) #define MPI2_SGLFLAGS_SYSTEM_ADDRESS_SPACE (0x00) #define MPI2_SGLFLAGS_IOCDDR_ADDRESS_SPACE (0x04) #define MPI2_SGLFLAGS_IOCPLB_ADDRESS_SPACE (0x08) #define MPI2_SGLFLAGS_IOCPLBNTA_ADDRESS_SPACE (0x0C) /* values for SGL Type subfield */ #define MPI2_SGLFLAGS_SGL_TYPE_MASK (0x03) #define MPI2_SGLFLAGS_SGL_TYPE_MPI (0x00) #define MPI2_SGLFLAGS_SGL_TYPE_IEEE32 (0x01) #define MPI2_SGLFLAGS_SGL_TYPE_IEEE64 (0x02) #endif
andi34/kernel_samsung_espresso-cm
drivers/scsi/mpt2sas/mpi/mpi2.h
C
gpl-2.0
47,640
package org.janelia.render.client; import com.beust.jcommander.Parameter; import com.beust.jcommander.ParametersDelegate; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; import org.janelia.alignment.ArgbRenderer; import org.janelia.alignment.RenderParameters; import org.janelia.alignment.Utils; import org.janelia.alignment.spec.Bounds; import org.janelia.alignment.spec.stack.StackMetaData; import org.janelia.alignment.util.FileUtil; import org.janelia.alignment.util.ImageProcessorCache; import org.janelia.alignment.util.LabelImageProcessorCache; import org.janelia.render.client.parameter.CommandLineParameters; import org.janelia.render.client.parameter.RenderWebServiceParameters; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Java client for rendering a composite image of all tiles in a section for one or more sections. * Images are placed in [rootDirectory]/[project]/[stack]/sections_at_[scale]/000/1/123.png * * @author Eric Trautman */ public class RenderSectionClient { public static class Parameters extends CommandLineParameters { @ParametersDelegate public RenderWebServiceParameters renderWeb = new RenderWebServiceParameters(); @Parameter( names = "--stack", description = "Stack name", required = true) public String stack; @Parameter( names = "--rootDirectory", description = "Root directory for rendered layers (e.g. /nrs/flyem/render/scapes)", required = true) public String rootDirectory; @Parameter( names = "--scale", description = "Scale for each rendered layer" ) public Double scale = 0.02; @Parameter( names = "--format", description = "Format for rendered boxes" ) public String format = Utils.PNG_FORMAT; @Parameter( names = "--doFilter", description = "Use ad hoc filter to support alignment", arity = 1) public boolean doFilter = true; @Parameter( names = "--filterListName", description = "Apply this filter list to all rendering (overrides doFilter option)" ) public String filterListName; @Parameter( names = "--channels", description = "Specify channel(s) and weights to render (e.g. 'DAPI' or 'DAPI__0.7__TdTomato__0.3')" ) public String channels; @Parameter( names = "--fillWithNoise", description = "Fill image with noise before rendering to improve point match derivation", arity = 1) public boolean fillWithNoise = true; @Parameter( description = "Z values for sections to render", required = true) public List<Double> zValues; @Parameter( names = "--bounds", description = "Bounds used for all layers: xmin, xmax, ymin,ymax" ) public List<Integer> bounds; @Parameter( names = "--customOutputFolder", description = "Custom named folder for output. Overrides the default format 'sections_at_#' folder" ) public String customOutputFolder; @Parameter( names = "--customSubFolder", description = "Name for subfolder to customOutputFolder, if used" ) public String customSubFolder; @Parameter( names = "--padFileNamesWithZeros", description = "Pad outputfilenames with leading zeroes, i.e. 12.tiff -> 00012.tiff" ) public boolean padFileNameWithZeroes; @Parameter( names = "--maxIntensity", description = "Max intensity to render image" ) public Integer maxIntensity; @Parameter( names = "--minIntensity", description = "Min intensity to render image" ) public Integer minIntensity; @Parameter( names = "--renderTileLabels", description = "Render tiles as single color labels" ) public boolean renderTileLabels; @Parameter( names = "--useStackBounds", description = "Use stack bounds instead of layer bounds for rendered canvas" ) public boolean useStackBounds; } /** * @param args see {@link Parameters} for command line argument details. */ public static void main(final String[] args) { final ClientRunner clientRunner = new ClientRunner(args) { @Override public void runClient(final String[] args) throws Exception { final Parameters parameters = new Parameters(); parameters.parse(args); LOG.info("runClient: entry, parameters={}", parameters); final RenderSectionClient client = new RenderSectionClient(parameters); for (final Double z : parameters.zValues) { client.generateImageForZ(z); } } }; clientRunner.run(); } private final Parameters clientParameters; private final File sectionDirectory; private final int maxCachedPixels; private final ImageProcessorCache imageProcessorCache; private final RenderDataClient renderDataClient; private final Bounds stackBounds; private RenderSectionClient(final Parameters clientParameters) throws IOException { this.clientParameters = clientParameters; final Path sectionPath; if (clientParameters.customOutputFolder != null) { if (clientParameters.customSubFolder != null) { sectionPath = Paths.get(clientParameters.rootDirectory, clientParameters.customOutputFolder, clientParameters.customSubFolder); } else { sectionPath = Paths.get(clientParameters.rootDirectory, clientParameters.customOutputFolder); } } else { final String sectionsAtScaleName = "sections_at_" + clientParameters.scale; sectionPath = Paths.get(clientParameters.rootDirectory, clientParameters.renderWeb.project, clientParameters.stack, sectionsAtScaleName); } this.sectionDirectory = sectionPath.toAbsolutePath().toFile(); FileUtil.ensureWritableDirectory(this.sectionDirectory); // set cache size to 50MB so that masks get cached but most of RAM is left for target image this.maxCachedPixels = 50 * 1000000; if (clientParameters.renderTileLabels) { this.imageProcessorCache = null; } else { this.imageProcessorCache = new ImageProcessorCache(maxCachedPixels, false, false); } this.renderDataClient = clientParameters.renderWeb.getDataClient(); if (clientParameters.useStackBounds) { final StackMetaData stackMetaData = renderDataClient.getStackMetaData(clientParameters.stack); this.stackBounds = stackMetaData.getStats().getStackBounds(); } else { this.stackBounds = null; } } private void generateImageForZ(final Double z) throws Exception { LOG.info("generateImageForZ: {}, entry, sectionDirectory={}, dataClient={}", z, sectionDirectory, renderDataClient); final Bounds layerBounds = stackBounds == null ? renderDataClient.getLayerBounds(clientParameters.stack, z) : stackBounds; String parametersUrl; if(clientParameters.bounds != null && clientParameters.bounds.size() == 4) //Read bounds from supplied parameters { LOG.debug("Using user bounds"); parametersUrl = renderDataClient.getRenderParametersUrlString(clientParameters.stack, clientParameters.bounds.get(0), //Min X clientParameters.bounds.get(2), //Min Y z, clientParameters.bounds.get(1) - clientParameters.bounds.get(0), //Width clientParameters.bounds.get(3) - clientParameters.bounds.get(2), //Height clientParameters.scale, clientParameters.filterListName); } else //Get bounds from render { LOG.debug("Using render bounds"); parametersUrl = renderDataClient.getRenderParametersUrlString(clientParameters.stack, layerBounds.getMinX(), layerBounds.getMinY(), z, (int) (layerBounds.getDeltaX() + 0.5), (int) (layerBounds.getDeltaY() + 0.5), clientParameters.scale, clientParameters.filterListName); } if (clientParameters.minIntensity != null) { if (clientParameters.maxIntensity != null) { parametersUrl += "?minIntensity=" + clientParameters.minIntensity + "&maxIntensity=" + clientParameters.maxIntensity; } else { parametersUrl += "?minIntensity=" + clientParameters.minIntensity; } } else if (clientParameters.maxIntensity != null) { parametersUrl += "?maxIntensity=" + clientParameters.maxIntensity; } LOG.debug("generateImageForZ: {}, loading {}", z, parametersUrl); final RenderParameters renderParameters = RenderParameters.loadFromUrl(parametersUrl); renderParameters.setFillWithNoise(clientParameters.fillWithNoise); renderParameters.setDoFilter(clientParameters.doFilter); renderParameters.setChannels(clientParameters.channels); final File sectionFile = getSectionFile(z); final BufferedImage sectionImage = renderParameters.openTargetImage(); final ImageProcessorCache cache; if (clientParameters.renderTileLabels) { renderParameters.setBinaryMask(true); // masked edges should not be interpolated for labels cache = new LabelImageProcessorCache(maxCachedPixels, false, false, renderParameters.getTileSpecs()); } else { cache = this.imageProcessorCache; } ArgbRenderer.render(renderParameters, sectionImage, cache); Utils.saveImage(sectionImage, sectionFile.getAbsolutePath(), clientParameters.format, true, 0.85f); LOG.info("generateImageForZ: {}, exit", z); } private File getSectionFile(final Double z) { final String fileName = clientParameters.padFileNameWithZeroes ? String.format("%05d", z.intValue()) : z.toString(); final File parentDirectory; if (clientParameters.customOutputFolder == null) { final int thousands = z.intValue() / 1000; final File thousandsDir = new File(sectionDirectory, String.format("%03d", thousands)); final int hundreds = (z.intValue() % 1000) / 100; parentDirectory = new File(thousandsDir, String.valueOf(hundreds)); } else { parentDirectory = sectionDirectory; } FileUtil.ensureWritableDirectory(parentDirectory); return new File(parentDirectory, fileName + "." + clientParameters.format.toLowerCase()); } private static final Logger LOG = LoggerFactory.getLogger(RenderSectionClient.class); }
saalfeldlab/render
render-ws-java-client/src/main/java/org/janelia/render/client/RenderSectionClient.java
Java
gpl-2.0
12,829
// panel_copy.cpp // // An RDCatch event copier. // // (C) Copyright 2002-2005 Fred Gleason <fredg@paravelsystems.com> // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License 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. // // 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., 675 Mass Ave, Cambridge, MA 02139, USA. // #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <qapplication.h> #include <rddb.h> #include <rdescape_string.h> #include <rd.h> #include <dbversion.h> #include <panel_copy.h> #include <rdcmd_switch.h> MainObject::MainObject(QObject *parent) : QObject(parent) { bool found=false; QString src_hostname; QString dest_hostname; QString src_station; QString dest_station; QString sql; RDSqlQuery *q; RDSqlQuery *q1; // // Read Command Options // RDCmdSwitch *cmd= new RDCmdSwitch(qApp->argc(),qApp->argv(),"panel_copy", PANEL_COPY_USAGE); delete cmd; rd_config=new RDConfig(RD_CONF_FILE); rd_config->load(); // // Read Switches // for(int i=1;i<qApp->argc();i+=2) { found=false; if(QString(qApp->argv()[i])=="-h") { // Source mySQL Hostname if((i+1)==qApp->argc()) { fprintf(stderr,"panel_copy: invalid argument\n"); exit(256); } src_hostname=qApp->argv()[i+1]; found=true; } if(QString(qApp->argv()[i])=="-H") { // Source mySQL Hostname if((i+1)==qApp->argc()) { fprintf(stderr,"panel_copy: invalid argument\n"); exit(256); } dest_hostname=qApp->argv()[i+1]; found=true; } if(!found) { fprintf(stderr,"panel_copy: invalid argument\n"); exit(256); } } if(src_hostname.isEmpty()) { fprintf(stderr,"panel_copy: invalid source mySQL hostname\n"); exit(256); } if(dest_hostname.isEmpty()) { fprintf(stderr,"panel_copy: invalid destination mySQL hostname\n"); exit(256); } if(src_hostname==dest_hostname) { fprintf(stderr,"panel_copy: cannot copy a database onto itself\n"); exit(256); } // // Open Databases // src_db=QSqlDatabase::addDatabase("QMYSQL3","SRCDB"); if(!src_db) { fprintf(stderr,"panel_copy: can't open source mySQL database\n"); exit(1); } src_db->setDatabaseName(rd_config->mysqlDbname()); src_db->setUserName(rd_config->mysqlUsername()); src_db->setPassword(rd_config->mysqlPassword()); src_db->setHostName(src_hostname); if(!src_db->open()) { fprintf(stderr,"panel_copy: unable to connect to source mySQL server\n"); src_db->removeDatabase(rd_config->mysqlDbname()); exit(256); } dest_db=QSqlDatabase::addDatabase("QMYSQL3","DESTDB"); if(!dest_db) { fprintf(stderr,"panel_copy: can't open destination mySQL database\n"); exit(1); } dest_db->setDatabaseName(rd_config->mysqlDbname()); dest_db->setUserName(rd_config->mysqlUsername()); dest_db->setPassword(rd_config->mysqlPassword()); dest_db->setHostName(dest_hostname); if(!dest_db->open()) { fprintf(stderr, "panel_copy: unable to connect to destination mySQL server\n"); dest_db->removeDatabase(rd_config->mysqlDbname()); exit(256); } // // Check Database Versions // sql="select DB from VERSION"; q=new RDSqlQuery(sql,src_db); if(!q->first()) { fprintf(stderr, "panel_copy: unable to read source database version\n"); exit(256); } if(q->value(0).toInt()!=RD_VERSION_DATABASE) { fprintf(stderr,"panel_copy: source database version mismatch\n"); exit(256); } delete q; q=new RDSqlQuery(sql,dest_db); if(!q->first()) { fprintf(stderr, "panel_copy: unable to read destination database version\n"); exit(256); } if(q->value(0).toInt()!=RD_VERSION_DATABASE) { fprintf(stderr,"panel_copy: destination database version mismatch\n"); exit(256); } delete q; // // Confirmation Prompt // printf("\n"); printf("****** WARNING ******\n"); printf(" This operation will OVERWRITE ALL SOUNDPANEL BUTTON ASSIGNMENTS on the destination database!"); printf(" Press RETURN to continue, or CNTL-C to abort."); printf("\n"); while(getchar()!=10); printf("Copying button assignments..."); fflush(stdout); // // Delete current destination entries // sql="delete from PANELS"; q=new RDSqlQuery(sql,dest_db); delete q; // // Copy Entries // sql=QString("select ")+ "TYPE,"+ // 00 "OWNER,"+ // 01 "PANEL_NO,"+ // 02 "ROW_NO,"+ // 03 "COLUMN_NO,"+ // 04 "LABEL,"+ // 05 "CART,"+ // 06 "DEFAULT_COLOR "+ // 07 "from PANELS"; q=new RDSqlQuery(sql,src_db); while(q->next()) { sql=QString("insert into PANELS set ")+ QString().sprintf("TYPE=%d,",q->value(0).toInt())+ "OWNER=\""+RDEscapeString(q->value(1).toString())+"\","+ QString().sprintf("PANEL_NO=%d,",q->value(2).toInt())+ QString().sprintf("ROW_NO=%d,",q->value(3).toInt())+ QString().sprintf("COLUMN_NO=%d,",q->value(4).toInt())+ "LABEL=\""+RDEscapeString(q->value(5).toString())+"\","+ QString().sprintf("CART=%d,",q->value(6).toInt())+ "DEFAULT_COLOR=\""+RDEscapeString(q->value(7).toString())+"\""; q1=new RDSqlQuery(sql,dest_db); delete q1; } delete q; printf("done.\n"); exit(0); } int main(int argc,char *argv[]) { QApplication a(argc,argv,false); new MainObject(NULL); return a.exec(); }
radio-helsinki-graz/rivendell
importers/panel_copy.cpp
C++
gpl-2.0
5,858
#!/usr/bin/python import unittest class FooTest(unittest.TestCase): '''Sample test case -- FooTest()''' def setUp(self): '''Set up for testing...''' print 'FooTest:setUp_:begin' testName = self.shortDescription() if (testName == 'Test routine A'): print 'setting up for test A' elif (testName == 'Test routine B'): print 'setting up for test B' else: print 'UNKNOWN TEST ROUTINE' print 'FooTest:setUp_:end' def testA(self): '''Test routine A''' print 'FooTest: running testA...' def testB(self): '''Test routine B''' print 'FooTest: running testB...' def tearDown(self): '''Tear down from testing...''' print 'FooTest:tearDown_:begin' testName = self.shortDescription() if (testName == 'Test routine A'): print 'cleaning up after test A' elif (testName == 'Test routine B'): print 'cleaning up after test B' else: print 'UNKNOWN TEST ROUTINE' print 'FooTest:tearDown_:end' class BarTest(unittest.TestCase): '''Sample test case -- BarTest()''' def setUp(self): '''Set up for testing...''' print 'BarTest:setUp_:begin' testName = self.shortDescription() if (testName == 'Test routine A'): print 'setting up for test A' elif (testName == 'Test routine B'): print 'setting up for test B' else: print 'UNKNOWN TEST ROUTINE' print 'BarTest:setUp_:end' def testA(self): '''Test routine A''' print 'BarTest: running testA...' def testB(self): '''Test routine B''' print 'BarTest: running testB...' def tearDown(self): '''Tear down from testing...''' print 'BarTest:tearDown_:begin' testName = self.shortDescription() if (testName == 'Test routine A'): print 'cleaning up after test A' elif (testName == 'Test routine B'): print 'cleaning up after test B' else: print 'UNKNOWN TEST ROUTINE' print 'BarTest:tearDown_:end' if __name__ == '__main__': unittest.main()
jeffwright13/unittest_tutorial
test_foo.py
Python
gpl-2.0
2,412
#!/bin/bash # Author : dark-Amateur # Date : 2013-12-11 # Version : 0.1 # log= log_time= IP= date= now= inotifywait=/usr/bin/inotifywait # while $inotifywait -q -e modify $log > /dev/null; do log_time=$(grep 'Failed password' $log | awk '{print $2"-"$3}' | tail -n1 | cut -d':' -f1,2) now=$(date '+%d-%H:%M') if [ "$now" == "$log_time" ]; then IP=$(grep 'Failed password' $log | tail -n1 | sed 's/^.*from //g' | sed '/port.*$//g') echo $IP fi done
berget/show_IP
binIP.sh
Shell
gpl-2.0
476
/* * Copyright (C) 2016 Team Kodi * http://kodi.tv * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "addons/AddonBuilder.h" #include "addons/AudioDecoder.h" #include "addons/AudioEncoder.h" #include "addons/ContextMenuAddon.h" #include "addons/GameResource.h" #include "addons/ImageDecoder.h" #include "addons/ImageResource.h" #include "addons/InputStream.h" #include "addons/LanguageResource.h" #include "addons/PluginSource.h" #include "addons/Repository.h" #include "addons/Scraper.h" #include "addons/ScreenSaver.h" #include "addons/Service.h" #include "addons/Skin.h" #include "addons/UISoundsResource.h" #include "addons/VFSEntry.h" #include "addons/Visualisation.h" #include "addons/Webinterface.h" #include "cores/AudioEngine/Engines/ActiveAE/AudioDSPAddons/ActiveAEDSP.h" #include "games/addons/GameClient.h" #include "games/controllers/Controller.h" #include "peripherals/addons/PeripheralAddon.h" #include "addons/PVRClient.h" #include "utils/StringUtils.h" namespace ADDON { std::shared_ptr<IAddon> CAddonBuilder::Build() { if (m_built) throw std::logic_error("Already built"); if (m_props.id.empty()) return nullptr; m_built = true; if (m_props.type == ADDON_UNKNOWN) return std::make_shared<CAddon>(std::move(m_props)); if (m_extPoint == nullptr) return FromProps(std::move(m_props)); const TYPE type(m_props.type); // Handle screensaver special cases if (type == ADDON_SCREENSAVER) { // built in screensaver if (StringUtils::StartsWithNoCase(m_extPoint->plugin->identifier, "screensaver.xbmc.builtin.")) return std::make_shared<CAddon>(std::move(m_props)); // python screensaver if (URIUtils::HasExtension(CAddonMgr::GetInstance().GetExtValue(m_extPoint->configuration, "@library"), ".py")) return std::make_shared<CScreenSaver>(std::move(m_props)); } // Handle audio encoder special cases if (type == ADDON_AUDIOENCODER) { // built in audio encoder if (StringUtils::StartsWithNoCase(m_extPoint->plugin->identifier, "audioencoder.xbmc.builtin.")) return CAudioEncoder::FromExtension(std::move(m_props), m_extPoint); } // Ensure binary types have a valid library for the platform if (type == ADDON_VIZ || type == ADDON_SCREENSAVER || type == ADDON_PVRDLL || type == ADDON_ADSPDLL || type == ADDON_AUDIOENCODER || type == ADDON_AUDIODECODER || type == ADDON_VFS || type == ADDON_IMAGEDECODER || type == ADDON_INPUTSTREAM || type == ADDON_PERIPHERALDLL || type == ADDON_GAMEDLL) { std::string value = CAddonMgr::GetInstance().GetPlatformLibraryName(m_extPoint->plugin->extensions->configuration); if (value.empty()) return AddonPtr(); } switch (type) { case ADDON_PLUGIN: case ADDON_SCRIPT: return CPluginSource::FromExtension(std::move(m_props), m_extPoint); case ADDON_SCRIPT_LIBRARY: case ADDON_SCRIPT_LYRICS: case ADDON_SCRIPT_MODULE: case ADDON_SUBTITLE_MODULE: case ADDON_SCRIPT_WEATHER: return std::make_shared<CAddon>(std::move(m_props)); case ADDON_WEB_INTERFACE: return CWebinterface::FromExtension(std::move(m_props), m_extPoint); case ADDON_SERVICE: return CService::FromExtension(std::move(m_props), m_extPoint); case ADDON_SCRAPER_ALBUMS: case ADDON_SCRAPER_ARTISTS: case ADDON_SCRAPER_MOVIES: case ADDON_SCRAPER_MUSICVIDEOS: case ADDON_SCRAPER_TVSHOWS: case ADDON_SCRAPER_LIBRARY: return CScraper::FromExtension(std::move(m_props), m_extPoint); #if defined(HAS_VISUALISATION) case ADDON_VIZ: return std::make_shared<CVisualisation>(std::move(m_props)); #endif case ADDON_SCREENSAVER: return std::make_shared<CScreenSaver>(std::move(m_props)); #ifdef HAS_PVRCLIENTS case ADDON_PVRDLL: return PVR::CPVRClient::FromExtension(std::move(m_props), m_extPoint); #endif case ADDON_ADSPDLL: return std::make_shared<ActiveAE::CActiveAEDSPAddon>(std::move(m_props)); case ADDON_AUDIOENCODER: return CAudioEncoder::FromExtension(std::move(m_props), m_extPoint); case ADDON_AUDIODECODER: return CAudioDecoder::FromExtension(std::move(m_props), m_extPoint); case ADDON_IMAGEDECODER: return CImageDecoder::FromExtension(std::move(m_props), m_extPoint); case ADDON_INPUTSTREAM: return CInputStream::FromExtension(std::move(m_props), m_extPoint); case ADDON_PERIPHERALDLL: return PERIPHERALS::CPeripheralAddon::FromExtension(std::move(m_props), m_extPoint); case ADDON_GAMEDLL: return GAME::CGameClient::FromExtension(std::move(m_props), m_extPoint); case ADDON_VFS: return CVFSEntry::FromExtension(std::move(m_props), m_extPoint); case ADDON_SKIN: return CSkinInfo::FromExtension(std::move(m_props), m_extPoint); case ADDON_RESOURCE_IMAGES: return CImageResource::FromExtension(std::move(m_props), m_extPoint); case ADDON_RESOURCE_GAMES: return CGameResource::FromExtension(std::move(m_props), m_extPoint); case ADDON_RESOURCE_LANGUAGE: return CLanguageResource::FromExtension(std::move(m_props), m_extPoint); case ADDON_RESOURCE_UISOUNDS: return std::make_shared<CUISoundsResource>(std::move(m_props)); case ADDON_REPOSITORY: return CRepository::FromExtension(std::move(m_props), m_extPoint); case ADDON_CONTEXT_ITEM: return CContextMenuAddon::FromExtension(std::move(m_props), m_extPoint); case ADDON_GAME_CONTROLLER: return GAME::CController::FromExtension(std::move(m_props), m_extPoint); default: break; } return AddonPtr(); } AddonPtr CAddonBuilder::FromProps(AddonProps addonProps) { // FIXME: there is no need for this as none of the derived classes will contain any useful // information. We should return CAddon instances only, however there are several places that // down casts, which need to fixed first. switch (addonProps.type) { case ADDON_PLUGIN: case ADDON_SCRIPT: return AddonPtr(new CPluginSource(std::move(addonProps))); case ADDON_SCRIPT_LIBRARY: case ADDON_SCRIPT_LYRICS: case ADDON_SCRIPT_WEATHER: case ADDON_SCRIPT_MODULE: case ADDON_SUBTITLE_MODULE: return AddonPtr(new CAddon(std::move(addonProps))); case ADDON_WEB_INTERFACE: return AddonPtr(new CWebinterface(std::move(addonProps))); case ADDON_SERVICE: return AddonPtr(new CService(std::move(addonProps))); case ADDON_SCRAPER_ALBUMS: case ADDON_SCRAPER_ARTISTS: case ADDON_SCRAPER_MOVIES: case ADDON_SCRAPER_MUSICVIDEOS: case ADDON_SCRAPER_TVSHOWS: case ADDON_SCRAPER_LIBRARY: return AddonPtr(new CScraper(std::move(addonProps))); case ADDON_SKIN: return AddonPtr(new CSkinInfo(std::move(addonProps))); #if defined(HAS_VISUALISATION) case ADDON_VIZ: return AddonPtr(new CVisualisation(std::move(addonProps))); #endif case ADDON_SCREENSAVER: return AddonPtr(new CScreenSaver(std::move(addonProps))); case ADDON_PVRDLL: return AddonPtr(new PVR::CPVRClient(std::move(addonProps))); case ADDON_ADSPDLL: return AddonPtr(new ActiveAE::CActiveAEDSPAddon(std::move(addonProps))); case ADDON_AUDIOENCODER: return AddonPtr(new CAudioEncoder(std::move(addonProps))); case ADDON_AUDIODECODER: return AddonPtr(new CAudioDecoder(std::move(addonProps))); case ADDON_RESOURCE_IMAGES: return AddonPtr(new CImageResource(std::move(addonProps))); case ADDON_RESOURCE_GAMES: return AddonPtr(new CGameResource(std::move(addonProps))); case ADDON_RESOURCE_LANGUAGE: return AddonPtr(new CLanguageResource(std::move(addonProps))); case ADDON_RESOURCE_UISOUNDS: return AddonPtr(new CUISoundsResource(std::move(addonProps))); case ADDON_REPOSITORY: return AddonPtr(new CRepository(std::move(addonProps))); case ADDON_CONTEXT_ITEM: return AddonPtr(new CContextMenuAddon(std::move(addonProps))); case ADDON_INPUTSTREAM: return AddonPtr(new CInputStream(std::move(addonProps))); case ADDON_PERIPHERALDLL: return AddonPtr(new PERIPHERALS::CPeripheralAddon(std::move(addonProps), false, false)); //! @todo implement case ADDON_GAME_CONTROLLER: return AddonPtr(new GAME::CController(std::move(addonProps))); case ADDON_GAMEDLL: return AddonPtr(new GAME::CGameClient(std::move(addonProps))); default: break; } return AddonPtr(); } }
InuSasha/xbmc
xbmc/addons/AddonBuilder.cpp
C++
gpl-2.0
9,095
#include <windows.h> #include <stdlib.h> #include <string.h> #include <tchar.h> #include <math.h> #include <fstream> #include <iostream> #include <cstdio> #include <ctime> #include <sstream> #include<iostream> #include<cstdlib> #include "EasyBMP.h" #include "stdafx.h" #include <cstring> using namespace std; //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // DEFINICION DE VARIABLES Y FUNCIONES //WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW //Variables definidas #define pi_2 (4.0 * asin(1.0)) #define MAX_SIZE 5 #define PI 3.14159 #define T_LOW 65 #define T_HIGH 80 HINSTANCE iniciar; //Definicion de funciones int importImg(char*); void outputImg(void); void printFileInfo(BMP); float convolve(int[][5], int, float, int, int); void gaussianBlue(void); void sobel(void); void noMax(void); void hysteresis(void); void hysteresis2(void); bool isFirstMax(double , double , double ); int getOrientation(float); bool isBetween(float, float, float, float, float); //Variables Globales int T_LOWA; int T_HIGHA; int i,j,m,n; int greaterFounda; int betweenFounda; double **imageArray; double **imageArray2; double **thetas; double **thetas2; double** magArray; double** magArray2; float doscincuenta; double estadistica[100]; int INF= (1<<20); int cont=0; double sum=0; double sumASM=0; double sumC=0; double miniASM=INF; double miniC=INF; unsigned int ROWS; unsigned int COLUMNS; char DEPTH; // Global variables int N,M; int R,C; double dt[1024][1024],Qr[1024][1024],Qi[1024][1024],Qm[1024][1024]; // The main window class name. static TCHAR szWindowClass[] = _T("BMPLoad"); // The string that appears in the application's title bar. static TCHAR szTitle[] = _T("Algoritmo Canny Edge"); HINSTANCE hInst; // Forward declarations of functions included in this code module: LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); //Variables propias para manejo de botones double dot[1024][1024],Qra[1024][1024],Qia[1024][1024],Qma[1024][1024]; OPENFILENAME exam ; wchar_t szFile[MAX_PATH] ; char *FileNameBufo=(char *)malloc(MAX_PATH); bool bandera= false; // Esta bandera es un booleano que controla la carga de archivos. En caso de ser falsa nocarga nada, si es verdadera carga un archivo. /*HWND sHwnd; void SetWindowHandle(HWND hwnd){ sHwnd= hwnd; }*/ // ********** // class CRaster // - Clase generica para imagenes BMP raster. void printFileInfo(BMP image){ cout << endl << "File info:" << endl; cout << image.TellWidth() << " x " << image.TellHeight() << " at " << image.TellBitDepth() << " bpp" << endl << endl; } //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // FUNCIONES PARA IMPLEMENTACION DE SOBEL Y CANNY //WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW //fUNCION PARA MODIFICAR ARCHIVVO void outputImg(void){ //setup Output IMG BMP OutputIMG; int byte; OutputIMG.SetBitDepth(DEPTH); OutputIMG.SetSize(COLUMNS,ROWS); cout<< "Output Image to File" << endl; for( int j=0 ; j < ROWS ; j++) { for( int i=0 ; i < COLUMNS ; i++) { byte = imageArray[i][j]; OutputIMG(i,j)->Red = byte; OutputIMG(i,j)->Green = byte; OutputIMG(i,j)->Blue = byte; } } OutputIMG.WriteToFile("Output.bmp"); cout << "\n**** NOW GO OPEN Output.BMP ******" << endl; } //*************************** // convolve is a general helper funciton that applies a convolution // to the image and then returns the weighted sum so that // it can replace whatever pixel we were just analyzing //************************** float convolve(int con[][MAX_SIZE], int dim, float divisor, int i, int j) { int midx = dim/2; int midy = dim/2; float weightedSum = 0; for(int x = i-midx; x < i + dim-midx; x++) { for(int y = j-midy; y < j + dim-midy; y++) { weightedSum += divisor*(double)(con[x-i+midx][y-j+midy]*imageArray[x][y]); } } return weightedSum; } //***************************** // gaussian blur // applies a gaussian blur via a convolution of a gaussian // matrix with sigma = 1.4. hard-coded in. // future development of can generate the gauss matrix on the fly //***************************** void gaussianBlur(void) { //define gauss matrix int gaussArray[5][5] = { {2, 4, 5, 4, 2}, {4, 9, 12,9, 4}, {5, 12, 15, 12, 5}, {4, 9, 12,9, 4}, {2, 4, 5, 4, 2} }; float gaussDivisor = 1.0/159.0; float sum = 0.0; int dim = 5; for(int i=2; i < COLUMNS-2; i++) { for(int j=2; j < ROWS-2; j++) { sum = convolve(gaussArray,dim, gaussDivisor, i, j); imageArray[i][j] = (int)sum; } } } //**************************** // Applies a sobel filter to find the gradient direction // and magnitude. those values are then stored in thetas and magArray // so that info can be used later for further analysis //**************************** void sobel(void) { float sum = 0.0; float G_x, G_y, G, theta; int sobel_y[5][5] = { {-1, 0, 1,0,0}, {-2, 0, 2,0,0}, {-1, 0, 1,0,0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}; int sobel_x[5][5] = { {1, 2, 1, 0, 0}, {0, 0, 0, 0, 0}, {-1, -2, -1, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }; int dim = 3; //columns and rows might be mixed up here for (int i = 1; i < COLUMNS-1; i++ ) { for (int j = 1; j < ROWS-1; j++ ) { G_x = convolve(sobel_x, dim, 1, i, j); G_y = convolve(sobel_y, dim, 1, i, j); G = sqrt(G_x*G_x + G_y*G_y); // cout << G << "\n"; // cout << atan2(G_y, G_x) << "\n"; thetas[i][j] = getOrientation(180.0*atan2(G_y, G_x)/PI); // cout << thetas[i][j] << endl; magArray[i][j] = G; } } } //*************************** // helper function that returns true if a>b and c //*************************** bool isFirstMax(double a, double b, double c){ if(a>b && a>c){ return true; } return 0; } //**************************** // buckets the thetas into 0, 45, 90, 135 //**************************** int getOrientation(float angle) { if(isBetween(angle, -22.5, 22.5, -180, -157.5 ) || isBetween(angle, 157.5, 180, -22.5, 0)) return 0; if(isBetween(angle, 22.5, 67.5, -157.5, -112.5)) return 45; if(isBetween(angle, 67.5, 112.5, -112.5, -67.5)) return 90; if(isBetween(angle, 112.5, 157.5, -67.5, -22.5)) return 135; return -1; } //***************************** //helper function that says whether arg is between a-b or c-d //***************************** bool isBetween(float arg, float a, float b, float c, float d) { if((arg >= a && arg <= b) || (arg >= c && arg <= d)) { return true; } else { return false; } } //***************************** //non-maximum suppression //depending on the orientation, pixels are either thrown away or accepted //by checking it's neighbors //***************************** void noMax(void){ int theta = 0; for( int j=1 ; j < ROWS-1 ; j++) { for( int i=1 ; i < COLUMNS-1 ; i++) { theta = (int) thetas[i][j]; switch(theta){ case 0: if(isFirstMax(magArray[i][j],magArray[i+1][j],magArray[i-1][j])){ imageArray[i][j] = 0; // black } else{ imageArray[i][j] = 255; // white } break; case 45: if(isFirstMax(magArray[i][j],magArray[i+1][j+1],magArray[i-1][j-1])){ imageArray[i][j] = 0; // black } else{ imageArray[i][j] = 255; // white } break; case 90: if(isFirstMax(magArray[i][j],magArray[i][j+1],magArray[i][j-1])){ imageArray[i][j] = 0.0; // black } else{ imageArray[i][j] = 255.0; // white } break; case 135: if(isFirstMax(magArray[i][j],magArray[i+1][j-1],magArray[i-1][j+1])){ imageArray[i][j] = 0.0; // black } else{ imageArray[i][j] = 255.0; // white } break; default: // cout << "error in nomax()"<< endl; break; } } } } //***************************** //non-maximum suppression //depending on the orientation, pixels are either thrown away or accepted //by checking it's neighbors //***************************** //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // ALGORITMO EN ENSAMBLADOR DE LA FUNCION NOMAX //WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW void noMax2(void){ int theta = 0; int i=0, j=0; int acumFilas=1, acumColumnas=1, filas=ROWS-1, columnas=COLUMNS-1; for( int j=1 ; j < ROWS-1 ; j++) { for( int i=1 ; i < COLUMNS-1 ; i++) { __asm{ while1: mov eax, filas mov ebx, acumFilas cmp eax, ebx jge finwhile ;////////////////////WHILE QUE RECORRE LA MATRIZ while2: mov eax, columnas mov ebx, acumColumnas cmp eax, ebx jge finwhile } theta = (int) thetas[i][j]; int bandera1=1; int bandera2=1; int n_255=255; int n_0=0; int n_45=45; int n_90=90; int n_135=135; double basura; //////ARRANCA CODIGO CON UN SWITCH, EL CUAL MANEJAMOS CON ETIQUETAS /////////////////////////////////////////////////// ///////////////////////////////////////////////////// __asm{ mov eax, theta mov ebx, n_0 cmp eax, ebx je caso0 ;// COMPARA TETHA CON 0 PARA ENTRAR AL PRIMER CASO mov ebx, n_45 cmp eax, ebx je caso45 ;// COMPARA TETHA CON 45 PARA ENTRAR AL PRIMER CASO mov ebx, n_90 cmp eax, ebx je caso90 ;// COMPARA TETHA CON 90 PARA ENTRAR AL PRIMER CASO mov ebx, n_135 cmp eax, ebx je caso135 ;// COMPARA TETHA CON 0 PARA ENTRAR AL PRIMER CASO caso0: finit mov esi, i mov edi, j mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i][j] mov esi, i inc esi mov edi, j mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i+1][j] ;/////////COMPARACION fcomi ST(0), ST(1) jge no_comparacion mov bandera1, 0 fstp basura mov esi, i dec esi mov edi, j mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i-1][j] ;//COMPARACION 2 fcomi ST(0), ST(1) jge no_comparacion mov bandera2, 0 fstp basura finit fldz ;cargo el cero mov esi, i mov edi, j mov edx, type imageArray imul edi, type double imul esi, edx fstp [qword ptr imageArray +esi+edi] ;igualo imageArray[i][j]=0 mov bandera1, 1 ; muevo la bandera a 1 otra vez mov bandera2, 1 ; muevo la bandera a 1 otra vez jmp finswitch no_comparacion: ;else finit fild n_255 mov esi, i mov edi, j mov edx, type imageArray imul edi, type double imul esi, edx fstp [qword ptr imageArray +esi+edi] ;igualo imageArray[i][j]=255 mov bandera1, 1 ; muevo la bandera a 1 otra vez mov bandera2, 1 ; muevo la bandera a 1 otra vez jmp finswitch } /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// //////eN CASO DE QUE SEA DE 45 GRADOS /////////////////////////////////////////////////// ///////////////////////////////////////////////////// __asm{ caso45: finit mov esi, i mov edi, j mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i][j] mov esi, i inc esi mov edi, j inc edi mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i+1][j+1] ;/////////COMPARACION fcomi ST(0), ST(1) jge no_comparacion2 mov bandera1, 0 fstp basura mov esi, i dec esi mov edi, j dec esi mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i-1][j-1] ;//COMPARACION 2 fcomi ST(0), ST(1) jge no_comparacion2 mov bandera2, 0 fstp basura finit fldz ;cargo el cero mov esi, i mov edi, j mov edx, type imageArray imul edi, type double imul esi, edx fstp [qword ptr imageArray +esi+edi] ;igualo imageArray[i][j]=0 mov bandera1, 1 ; muevo la bandera a 1 otra vez mov bandera2, 1 ; muevo la bandera a 1 otra vez jmp finswitch no_comparacion2: ;else finit fild n_255 mov esi, i mov edi, j mov edx, type imageArray imul edi, type double imul esi, edx fstp [qword ptr imageArray +esi+edi] ;igualo imageArray[i][j]=255 mov bandera1, 1 ; muevo la bandera a 1 otra vez mov bandera2, 1 ; muevo la bandera a 1 otra vez jmp finswitch } /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// //////ENN CASO DE QUE SEA DE 90 GRADOS /////////////////////////////////////////////////// ///////////////////////////////////////////////////// __asm{ caso90: finit mov esi, i mov edi, j mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i][j] mov esi, i mov edi, j inc edi mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i][j+1] ;/////////COMPARACION fcomi ST(0), ST(1) jge no_comparacion3 mov bandera1, 0 fstp basura mov esi, i mov edi, j dec edi mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i][j-1] ;//COMPARACION 2 fcomi ST(0), ST(1) jge no_comparacion3 mov bandera2, 0 fstp basura finit fldz ;cargo el cero mov esi, i mov edi, j mov edx, type imageArray imul edi, type double imul esi, edx fstp [qword ptr imageArray +esi+edi] ;igualo imageArray[i][j]=0 mov bandera1, 1 ; muevo la bandera a 1 otra vez mov bandera2, 1 ; muevo la bandera a 1 otra vez jmp finswitch no_comparacion3: ;else finit fild n_255 mov esi, i mov edi, j mov edx, type imageArray imul edi, type double imul esi, edx fstp [qword ptr imageArray +esi+edi] ;igualo imageArray[i][j]=255 mov bandera1, 1 ; muevo la bandera a 1 otra vez mov bandera2, 1 ; muevo la bandera a 1 otra vez jmp finswitch } /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// //////EN CASO DE QUE SEA DE 135 GRADOS /////////////////////////////////////////////////// ///////////////////////////////////////////////////// __asm{ caso135: finit mov esi, i mov edi, j mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i][j] mov esi, i inc esi mov edi, j dec edi mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i+1][j-1] ;/////////COMPARACION fcomi ST(0), ST(1) jge no_comparacion4 mov bandera1, 0 fstp basura mov esi, i dec esi mov edi, j inc edi mov edx, type magArray imul edi, type double imul esi, edx fld [qword ptr magArray +esi+edi] ;Apilo magArray[i-1][j+1] ;//COMPARACION 2 fcomi ST(0), ST(1) jge no_comparacion4 mov bandera2, 0 fstp basura finit fldz ;cargo el cero mov esi, i mov edi, j mov edx, type imageArray imul edi, type double imul esi, edx fstp [qword ptr imageArray +esi+edi] ;igualo imageArray[i][j]=0 mov bandera1, 1 ; muevo la bandera a 1 otra vez mov bandera2, 1 ; muevo la bandera a 1 otra vez no_comparacion4: ;else finit fild n_255 mov esi, i mov edi, j mov edx, type imageArray imul edi, type double imul esi, edx fstp [qword ptr imageArray +esi+edi] ;igualo imageArray[i][j]=255 mov bandera1, 1 ; muevo la bandera a 1 otra vez mov bandera2, 1 ; muevo la bandera a 1 otra vez finswitch: mov ebx, acumColumnas inc ebx mov acumColumnas, ebx finwhile2: mov eax, acumFilas inc eax mov acumFilas, eax finwhile: } /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// } } } //******************************* //hysteresis noise filter makes lines continuous and filters out the noise // see the pdf that we used to understand this step in english (Step 5) //******************************* void hysteresis(void){ bool greaterFound; bool betweenFound; for( int j=2 ; j < ROWS-2 ; j++){ for( int i=2 ; i < COLUMNS-2 ; i++){ if(magArray[i][j] < T_LOW){ imageArray[i][j] = 255; // white } if(magArray[i][j] > T_HIGH){ imageArray[i][j] = 0; // black } /*If pixel (x, y) has gradient magnitude between tlow and thigh and any of its neighbors in a 3 × 3 region around it have gradient magnitudes greater than thigh, keep the edge*/ if(magArray[i][j] >= T_LOW && magArray[i][j] <= T_HIGH){ greaterFound = false; betweenFound = false; for(int m = -1; m < 2; m++) { for(int n = -1; n < 2; n++){ if(magArray[i+m][j+n] > T_HIGH) { imageArray[i][j] = 0; greaterFound = true; } if(magArray[i][j] > T_LOW && magArray[i][j] < T_HIGH) betweenFound = true; } } if(!greaterFound && betweenFound) { for(int m = -2; m < 3; m++) { for(int n = -2; n < 3; n++) { if(magArray[i+m][j+n] > T_HIGH) greaterFound = true; } } } if(greaterFound) imageArray[i][j] = 0; else imageArray[i][j] = 255; } } } } //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // FUNCION HYSTERESIS EN ENSAMBLADOR //WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW void hysteresis2(void){ doscincuenta=255.0; //constante utilizada parda realizar los procedimientos T_LOWA=65; //asignacion inicial de variables cout<<"ROWS-2 // "<<ROWS-2<<endl; //impresiones para verificar funcionamiento de la aplicación cout<<"COLUMNS-2 // "<<COLUMNS-2<<endl; //impresiones para verificar funcionamiento de la aplicación T_HIGHA=80; //asignacion inicial de variables _asm{ mov j,2 ;//se inicia la j en 2, el for comienza desde 2 y termina en ROWS-2 while1: ;// los for de esta funcion fueron implementados como whiles,esto debido a lo grande que son y la cantidad de operaciones que realizan } cout<<"j "<<j<<endl; //impresiones de prueba _asm{ mov eax,j mov ebx,ROWS sub ebx,2 cmp eax,ebx ;//aca se encuentran las comparaciones para verificar si se debe salir del while o no jge finwhile1 ; //salta si cumple la co mov i,2 ;//la i comienza en 2, el for va desde 2 hata COLUMNS-2 while2: ;//este for tambien fue implementando como un while } cout<<"i "<<i<<endl; // impresiones de verificacion _asm{ mov eax,i mov ebx,COLUMNS sub ebx,2 cmp eax,ebx ; //comparaciones para verificar si se debe terminar el procedimiento o no jge finwhile2 mov esi,i mov edi,j mov edx,type magArray imul edi,type double ;//multiplicar edi por el tipo del dato del arreglo imul esi,edx ;// manejo de indices para poder acceder a ciertas posiciones de la matriz ;fild T_LOWA ;fld [qword ptr magArray +esi+edi] ;fcomi ST(0),ST(1) ;jge finsi1 ;//estas lineas verifican ciertas condiciones para poder cambiar ;finit ;//ciertas posiciones de la matriz imageArray por el numero 255 ;fld doscincuenta ;fstp [qword ptr magArray +esi+edi] ;finsi1: } if(magArray[i][j]<T_LOW){ imageArray[i][j]=255; //lineas de apoyo en c++ para verficiar condiciones } if(magArray[i][j]>T_HIGH){ //lineas de apoyo en c++ para verificar condiciones imageArray[i][j]=0; } _asm{ fild T_LOWA fld [qword ptr magArray +esi+edi] fcomi ST(0),ST(1) jl finsi3 finit fild T_HIGHA fld [qword ptr magArray +esi+edi] fcomi ST(0),ST(1) jg finsi3 mov greaterFounda,0 ; //la unica forma de entrar a realizar los siguientes procedimientos mov betweenFounda,0 ;// es que cumpla estas condiciones if(magArray[i][j] >= T_LOW && magArray[i][j] <= T_HIGH){ mov eax,0 sub eax,1 ;//esta línea marca el inicio de la variable m, la cual comienza en -1 y se utiliza en el siguiente while mov m,eax ; while3: mov eax,m mov ebx,2 cmp eax,ebx ;//comparaciones para verificar y controlar la ejecucion del while, para que no se vaya a un cico infinito jge finwhile3 mov eax,0 sub eax,1 mov n,eax ; //inicializacion de la variable n , comienza en -1 while4: mov eax,n mov ebx,2 cmp eax,ebx ;//comparaciones de control del ciclo while, para que no se vaya a un ciclo infinito jge finwhile4 mov eax,i add eax,m mov esi,eax mov edx,type magArray ; //manejo de los indices de la matriz imul esi,edx ;// manejo de los indices de la matriz mov eax,j add eax,n mov edi,eax imul edi,type double finit fild T_HIGHA fld [qword ptr magArray +esi+edi] fcomi ST(0),ST(1) ; //realiza la siguiente comparacion if(magArray[i+m][j+n] > T_HIGH) { jle finsi4 mov esi,i mov edi,j mov edx,type imageArray imul edi,type double //multiplicar edi por el tipo del dato del arreglo imul esi,edx finit fldz fstp [qword ptr imageArray +esi+edi] ;// realiza la siguiente asignacion imageArray[i][j] = 0; mov greaterFounda,1 ;//la variable greaterFounda queda en True, equivalente a quedar en 1 finsi4: mov esi,i mov edi,j mov edx,type magArray imul edi,type double //multiplicar edi por el tipo del dato del arreglo imul esi,edx fild T_LOWA fld [qword ptr magArray +esi+edi] fcomi ST(0),ST(1) jle finsi5 la variable m en 1, esto para el manejo del ciclo while jmp while3 finwhile3: mov eax,0 cmp eax,greaterFounda jl finsi6 mov eax,1 cmp eax,betweenFounda ;//este bloque de codigo realiza las siguientes comparaciones if(!greaterFound && betweenFound) { jg finsi6 mov eax,0 ;// a continuacion, si cumplio con las condiciones anteriores procedera a entrar en un doble ciclo while sub eax,2finit fild T_HIGHA fld [qword ptr magArray +esi+edi] ;// este bloque de codigo realiza la siguiente comparacion if(magArray[i][j] > T_LOW && magArray[i][j] < T_HIGH) fcomi ST(0),ST(1) jge finsi5 mov betweenFounda,1 ;//asigna a betweenFounda un uno, equivalente a asignarle un True como en el caso del algoritmo de C++ finsi5: inc n ;//incremento de variable n en 1, esto para el manejo del ciclo while jmp while4 finwhile4: inc m ://incremento de mov m,eax ; //asgina un valor inicial a m para así poder iniciar con el ciclo while while5: mov eax,m mov ebx,3 cmp eax,ebx ;//comparaciones para controlar la ejecucion del ciclo while, se realiza hasta que sea mayor o igual a 3 jge finwhile5 mov eax,0 sub eax,2 mov n,eax ; //asginacion inicial de la variable n para la ejecucion del ciclo while6 while6: mov eax,n mov ebx,3 cmp eax,ebx ;//comparaciones para control del ciclo while jge finwhile6 mov eax,i add eax,m mov esi,eax mov edx,type magArray ;//manejo de indices de la matriz imul esi,edx ;//manejo de indices de la matriz mov eax,j add eax,n mov edi,eax imul edi,type double ;//manejo de indices de la matriz finit fild T_HIGHA fld [qword ptr magArray +esi+edi] fcomi ST(0),ST(1) ;// esto realiza la siguiente comparacion if(magArray[i+m][j+n] > T_HIGH) jle finsi7 mov greaterFounda,1 ;//asigna a esta variable un 1 si cumplió con la condicion anterior, equivalente en c++ a asignar True finsi7: inc n ;// incrementa n para poder continuar con el flujo del ciclo jmp while6 finwhile6: inc m ;//incrementa a m para continuar con el flujo del ciclo jmp while5 finwhile5: finsi6: finsi3: inc i ;//incremento de la variable i para continuar con el ciclo while jmp while2 finwhile2: inc j ;//incremento de la variable j para continuar con el ciclo while mas externo } // cout<<"i "<<i<<endl; //impresiones para verificacion y depuracion del algoritmo _asm{ jmp while1 finwhile1: ;//fin el while mas externo, cuando termine termina la ejecucion de esta función } } class CRaster { public: int Width,Height; // Dimensiones int BPP; // Bits por Pixel. char * Raster; // Bits de la Imagen. RGBQUAD * Palette; // Paleta RGB para la imagen. int BytesPerRow; // Ancho de las filas (en bytes). BITMAPINFO * pbmi; // estructura BITMAPINFO // Funciones miembro de la clase (se definen despues): int LoadBMP (char * szFile); int GDIPaint (HDC hdc,int x,int y, int w, int h); void AbrirArchivo(HWND hWnd); }; // ********** // Función principal de Windows. // - Inicio del programa int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION)); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = CreateSolidBrush(RGB(229,203,255)); wcex.lpszMenuName = NULL; wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION)); if (!RegisterClassEx(&wcex)) { MessageBox(NULL, _T("Fallo el registro de la ventana!"), _T("Win32 Guided Tour"), NULL); return 1; } hInst = hInstance; // Store instance handle in our global variable HWND hWnd = CreateWindow( szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1000, 700, NULL, NULL, hInstance, NULL ); if (!hWnd) { MessageBox(NULL, _T("Call to CreateWindow failed!"), _T("Win32"), NULL); return 1; } // The parameters to ShowWindow explained: // hWnd: the value returned from CreateWindow // nCmdShow: the fourth parameter from WinMain ShowWindow(hWnd,SW_MAXIMIZE); UpdateWindow(hWnd); // Main message loop: MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int) msg.wParam; } // // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // FUNCION DONDE SE INICIA Y SE REALIZA EL PROCESO DE DIBUJO //WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HDC hdc; //variables para botones y barra de menu int winMenuId, winMenuEvent; static HWND examinar, estadisticas, Instruc, Salir; RECT rect; static CRaster bmp; LPCWSTR a; long cl; int x,y,f,g,R,G,B, FilaColumnaQr,FilaColumnaQi,FilaColumnaQm,FilaColumnaDt,columnasfg,columnasxy; // Definiciión de variables necesarias para el cálculo de la trasformada int _2_l = 2; double ang; ofstream ar_r,ar_i,ar_m; double r_m_n; char mensaje[50]; clock_t tc,ta; // Se crean dos variables para tomar el tiempo del cálculo en c++ (tc) y en assembley (ta) double TiempoAssembly, TiempoC; wstringstream TIEMPOS; TCHAR greeting[] = _T("Algoritmo Canny Edge"); //vARIABLES PARA IMPRIMIR LABELS static HWND hwndDireccion ; static HWND hwndBienvenida ; //static HWND iniciar ; switch (message) { case WM_CREATE: //MENSAJE DE INSTRUCCIONES hwndDireccion = CreateWindow(L"EDIT", L" INSTRUCCIONES: ", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 50, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L"____________________________________________________________", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 70, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" La función del presente programa es por medio del algoritmo", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 90, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" de Canny Edge es detectar los bordes de alguna imagen", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 110, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" seleccionada.", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 130, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" ", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 150, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" Para seleccionar una imagen, se debe presionar el botón", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 170, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" Examinar, inmediatamente aparecerá la venta para seleccionar", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 190, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" la imagen a transformar, teniendo esto el programa procederá", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 210, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" a realizar los cálculos en C++ y en Assambler, calculando", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 230, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" también sus respectivos tiempos. Luego se mostrara por", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 250, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" pantalla las imágenes respectivas.", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 270, 410, 20, hWnd, 0, iniciar, NULL); hwndDireccion = CreateWindow(L"EDIT", L" ", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 290, 410, 20, hWnd, 0, iniciar, NULL); //MENSAJE DE INFORMACION hwndBienvenida = CreateWindow(L"EDIT", L" DETECTOR DE BORDES CON ALGORITMO DE CANNY EDGE ", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 350, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L"__________________________________________________", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 370, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L" Fecha de creación: 16/12/2013", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 390, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L" Versión 1.0.0.0", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 410, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L" Desarrolladores:", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 430, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L" °Jeison Higuita Sanchez", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 450, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L" °Jonathan Vallejo Muñoz", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 470, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L" ", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 490, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L" Universidad Nacional de Colombia", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 510, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L" Arquitectura de Computadores", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 530, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L" Medellín", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 550, 410, 20, hWnd, 0, iniciar, NULL); hwndBienvenida = CreateWindow(L"EDIT", L" ", WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_DISABLED, 900, 570, 410, 20, hWnd, 0, iniciar, NULL); //Se crea un botón examinar examinar = CreateWindow(L"BUTTON", L"Examinar", WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON|BS_MULTILINE, 260,300, 100,38, hWnd, NULL, (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), NULL); /// se crea el botón salir, para salir del programa Salir = CreateWindow(L"BUTTON", L"Salir", WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON|BS_MULTILINE, 400,300, 100,38, hWnd, NULL, (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), NULL); estadisticas = CreateWindow(L"BUTTON", L"Estadisticas", WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON|BS_MULTILINE, 540,300, 100,38, hWnd, NULL, (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), NULL); break; case WM_COMMAND: if(examinar == (HWND)lParam){ //SI PRESIONA EL BOTON DE EXAMINAR bmp.AbrirArchivo(hWnd); if(bandera){ bandera= false; GetClientRect(hWnd,&rect); Rectangle((HDC)wParam,rect.left,rect.top,rect.right,rect.bottom); InvalidateRect(hWnd,NULL,TRUE); // Inicia un dispositivo de dibujo hdc=BeginPaint (hWnd,&ps); // Pega la imagen en el dispositivo de dibujo en las coordenadas 0,0 bmp.GDIPaint (hdc,130,70,0,0); // Se recorre la imagen y se lee el color del punto, si es negro (0 = RGB(0,0,0)) // Se pinta con rojo (1000), sino, se deja intacto ROWS=bmp.Height; // Altura de la Imagen COLUMNS=bmp.Width; // Ancho de la Imagen //allocate Memory imageArray = new double *[COLUMNS] ; // row memory allocation for( int i = 0 ; i < COLUMNS ; i++ ){ // column memory allocation imageArray[i] = new double[ROWS]; } imageArray2 = new double *[COLUMNS] ; // row memory allocation for( int i = 0 ; i < COLUMNS ; i++ ){ // column memory allocation imageArray2[i] = new double[ROWS]; } thetas = new double *[COLUMNS]; for(int i = 0; i < COLUMNS; i++) { thetas[i] = new double[ROWS]; } magArray = new double *[COLUMNS]; for(int i=0; i < COLUMNS; i++) { magArray[i] = new double[ROWS]; } int Temp; //r_m_n = sqrt((double)(N*M)); // Valor necesario para cálculo de la transformada (Raiz cuadrada del área de la imagen). for (f=0;f<ROWS;f++) // Primer ciclo para llenado de las Matrices dt y dot { for (g=0;g<COLUMNS;g++) // Segundo ciclo para llenado de las Matrices dt y dot { cl=GetPixel(hdc,g+130,f+70); // Función para obtener el pixel en la posición dada B=GetBValue(cl); // Valor o cantidad de azul en el pixel R=GetRValue(cl); // Valor o cantidad de rojo en el pixel G=GetGValue(cl); // Valor o cantidad de verde en el pixel Temp=(int)(((0.299*(float)R+0.587*(float)G+0.114*(float)B))); // Cálculo del valor en cada posición de la matriz dt //dot[f][g]=(float)(((0.3*(float)R+0.59*(float)G+0.11*(float)B))*(float)(pow(-1.0,(double)(f+g)))); // Cálculo del valor en cada posición de la matriz dot (para uso en assembler) imageArray[g][f] = Temp; imageArray2[g][f] = Temp; } } ///////MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //CALCULO EN C++ ///////WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW tc= clock(); // Se inicia a tomar el tiempo que demora haciendo el cálculo gaussianBlur(); sobel(); noMax(); hysteresis(); tc= clock() - tc; // Se toma el tiempo y se le resta el que tenía. TiempoC= ((double)tc / ((double)(CLOCKS_PER_SEC)))*1000; // Se pasa Tiempo C++ a milisegundos SetTextColor(hdc,RGB(0,0,0)); // Color para la letra SetBkColor(hdc,RGB(229,203,255)); // Color para el fondo del label de la letra TextOutA(hdc,M+340,(50),"Canny Edge en C++: ",20); // Texto para mostrar la transformada de Fourier en c++ for (f=0;f<ROWS;f++) { for (g=0;g<COLUMNS;g++) {//PINTA LA IMAGEN CALCULADA CON C++ SetPixel(hdc,f+M+340,g+N+70,RGB((int)imageArray[f][g],(int)imageArray[f][g],(int)imageArray[f][g])); } } //outputImg(); imageArray = new double *[COLUMNS] ; // row memory allocation for( int i = 0 ; i < COLUMNS ; i++ ){ // column memory allocation imageArray[i] = new double[ROWS]; } thetas = new double *[COLUMNS]; for(int i = 0; i < COLUMNS; i++) { thetas[i] = new double[ROWS]; } magArray = new double *[COLUMNS]; for(int i=0; i < COLUMNS; i++) { magArray[i] = new double[ROWS]; } for (f=0;f<ROWS;f++) // Primer ciclo para llenado de las Matrices dt y dot { for (g=0;g<COLUMNS;g++) // Segundo ciclo para llenado de las Matrices dt y dot { imageArray[g][f] = imageArray2[g][f]; } } ///////MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM //CALCULO EN ASSAMBLER ///////WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW ta= clock(); // Se incia a tomar el tiempo que demora en hacer el cálculo. gaussianBlur(); sobel(); noMax2(); hysteresis2(); ta= clock() - ta; // Se hace la resta del tiempo en ese preciso momento y el que se tenía de referencia. TiempoAssembly= ((double)ta / ((double)CLOCKS_PER_SEC)) * 1000; // Se pasa TiempoASM a milisegundos SetTextColor(hdc,RGB(0,0,0)); // Color para la letra SetBkColor(hdc,RGB(229,203,255)); // Color para el fondo del label de la letra TextOutA(hdc,M+550,(N+50),"Canny Edge en ASM: ",20); // Texto para mostrar la transformada de Fourier en asm for (f=0;f<ROWS;f++) { for (g=0;g<COLUMNS;g++) {//PINTA LA IMAGEN CALCULADA CON ASSAMBLY SetPixel(hdc,f+M+550,g+N+70,RGB((int)imageArray[f][g],(int)imageArray[f][g],(int)imageArray[f][g])); } } // Se llena el buffer para mostrar por un messageBox TIEMPOS<<"Tiempo C++: "<<TiempoC<<" milisegundos"<<endl <<"Tiempo ASM: "<<TiempoAssembly<<" milisegundos"<<endl <<"Diferencia: "<<abs(TiempoC-TiempoAssembly)<<" milisegundos"; sum+=abs(TiempoC-TiempoAssembly); sumASM+=TiempoAssembly; sumC+=TiempoC; cont++; miniASM=min(miniASM,TiempoAssembly); miniC=min(miniC,TiempoC); //MUESTRA LOS TIEMPOS MessageBox(NULL,TIEMPOS.str().c_str(),_T("Tiempos"),NULL); EndPaint(hWnd, &ps); } }else if(Salir == (HWND)lParam){ DestroyWindow(hWnd); } else if(estadisticas == (HWND)lParam){ if(cont==0){ wstringstream IMPRIMIR; IMPRIMIR<<"Por el momento no se a ingresado ningun dato "<<endl; MessageBox(NULL,IMPRIMIR.str().c_str(),_T("Estadisticas"),NULL); }else{ double res=sum/((double)cont); wstringstream IMPRIMIR; IMPRIMIR<<"Promedio de diferencias: "<<res<<" milisegundos"<<endl <<"Promedio en ASM: "<<(sumASM/((double)cont ))<<" milisegundos"<<endl <<"Promedio en C++: "<<(sumC/((double)cont ))<<" milisegundos"<<endl <<"Tiempo ASM minimo: "<<miniASM<<" milisegundos"<<endl <<"Tiempo C++ minimo: "<<miniC<<" milisegundos"<<endl; MessageBox(NULL,IMPRIMIR.str().c_str(),_T("Estadisticas"),NULL); } } break; case WM_PAINT: hdc=BeginPaint (hWnd,&ps); EndPaint(hWnd, &ps); break; case WM_DESTROY: MessageBox(NULL, _T("El progama se a ejecutado con exito"), _T("Fin"), NULL); PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); break; } return 0; } // ********** // CRaster::LoadBMPFile (FileName); // - Carga un archivo BMP en un objeto CRaster // * soporta archivos non-RLE-compressed de 1, 2, 4, 8 & 24 bits-por-pixel int CRaster::LoadBMP (char * szFile) { BITMAPFILEHEADER bmfh; BITMAPINFOHEADER bmih; // Abrir archivo. ifstream bmpfile (szFile , ios::in | ios::binary); if (! bmpfile.is_open()) return 1; // Error al leer el archivo // Cargar bitmap fileheader & infoheader bmpfile.read ((char*)&bmfh,sizeof (BITMAPFILEHEADER)); bmpfile.read ((char*)&bmih,sizeof (BITMAPINFOHEADER)); // Comprobar el tipo de archivo if (bmfh.bfType!='MB') return 2; // El archivo no es un BMP // Asignación de algunas variables necesarias: BPP=bmih.biBitCount; //Bits por pixel Width=bmih.biWidth; //Ancho de la imagen Height= (bmih.biHeight>0) ? bmih.biHeight : -bmih.biHeight; // Valor absoluto de la altura BytesPerRow = Width * BPP / 8; BytesPerRow += (4-BytesPerRow%4) % 4; // Byts por fila // Si BPP no es 24, Carga la paleta if (BPP==24) pbmi=(BITMAPINFO*)new char [sizeof(BITMAPINFO)]; else { pbmi=(BITMAPINFO*) new char[sizeof(BITMAPINFOHEADER)+(1<<BPP)*sizeof(RGBQUAD)]; Palette=(RGBQUAD*)((char*)pbmi+sizeof(BITMAPINFOHEADER)); bmpfile.read ((char*)Palette,sizeof (RGBQUAD) * (1<<BPP)); } pbmi->bmiHeader=bmih; // Cargar Raster bmpfile.seekg (bmfh.bfOffBits,ios::beg); Raster= new char[BytesPerRow*Height]; // (Si la altura es positiva el BMP esta grabado de abajo-arriba, se lee en sentido inverso) if (bmih.biHeight>0) for (int n=Height-1;n>=0;n--) bmpfile.read (Raster+BytesPerRow*n,BytesPerRow); else bmpfile.read (Raster,BytesPerRow*Height); // Una dirección arriba abajo es negativa, se ajusta: pbmi->bmiHeader.biHeight=-Height; bmpfile.close(); return 0; } // ********** // CRaster::GDIPaint (hdc,x,y); // * Pintar el raster en el Dispositivo de Contexto de la Ventana (DC). int CRaster::GDIPaint (HDC hdc,int x,int y, int w, int h) { // Pegar la imagen en el DC. return SetDIBitsToDevice (hdc,x,y,Width,Height,w,h,0,Height,(LPVOID)Raster,pbmi,0); } void CRaster::AbrirArchivo(HWND hWnd){ ZeroMemory( &exam , sizeof( exam)); exam.lStructSize = sizeof ( exam ); exam.hwndOwner = hWnd; exam.lpstrFile = szFile; exam.lpstrFile[0] = '\0'; exam.nMaxFile = sizeof( szFile ); exam.lpstrFilter = _TEXT("Bitmap\0*.BMP\0"); exam.nFilterIndex =1; exam.lpstrFileTitle = NULL ; exam.nMaxFileTitle = 0 ; exam.lpstrInitialDir=NULL ; exam.Flags = OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST ; if(GetOpenFileName(&exam)){ i= wcstombs(FileNameBufo,exam.lpstrFile,MAX_PATH); // Se pasa el tipo de dato de exam.lpstrFile a char * y se guarda en FileNameBufo bandera= true; LoadBMP(FileNameBufo); } }
jhta/Segunda_Entrega_Arquitectura
Segunda_Entrega_Arquitectura/main.cpp
C++
gpl-2.0
45,338
# UKTI Contact Form [![Build Status](https://img.shields.io/travis/uktrade/contact-ukti.svg?style=flat-square)](https://travis-ci.org/uktrade/contact-ukti) [![Dependency Status (gemnasium)](https://img.shields.io/gemnasium/UKTradeInvestment/contact-ukti.svg?style=flat-square&label=dependencies%20%28Gemnasium%29)](https://gemnasium.com/UKTradeInvestment/contact-ukti) [![Dependency Status (david)](https://img.shields.io/david/uktrade/contact-ukti.svg?style=flat-square&label=dependencies%20%28David%29)](https://david-dm.org/uktrade/contact-ukti) [![devDependency Status](https://img.shields.io/david/dev/uktrade/contact-ukti.svg?style=flat-square&label=devDependencies%20%28David%29)](https://david-dm.org/uktrade/contact-ukti#info=devDependencies) ## Dependencies - Redis ## Quick start Install the dependencies and build the project resources ```bash npm install ``` [Redis](http://redis.io/topics/quickstart) is used for session handling by the application and will need to be installed and running prior to starting the app - if you don't have it installed locally you can run from a docker container: ```bash docker run -d -p 6379:6379 redis ``` Initiate the server in development mode (Express is used to serve the static resources in development). To see some log messages set the log level with the env var LOG_LEVEL. ```bash npm run dev ``` See the [development documentation](./documentation/DEVELOPMENT.MD) for a complete description of the application and how to maintain and support BRP. ## Start application Start the application in default mode (production). ```bash npm start ``` ## Development Start the application with [Nodemon](https://www.npmjs.com/package/nodemon) in development mode. Debug is switched on and the server restarts when the JS or Sass are recompiled. ```bash npm run dev ``` ## Assets Compile the Sass to CSS ```bash npm run sass ``` Compile JS using [Browserify](http://browserify.org/) ```bash npm run browserify ``` ## Tests To run all unit and acceptance tests and linting run: ```bash npm run test ``` ### Unit tests Unit tests are run using [Mocha](https://mochajs.org/). Tests are defined in [`./test/unit`](./test/unit/) ```bash npm run test:unit ``` ### Acceptance tests Acceptance tests use [webdriverio](http://webdriver.io/) and [cucumber-js](https://github.com/cucumber/cucumber-js) to run feature tests ```bash npm run test:acceptance ``` ### Linting and code style Run the EcmaScript (ES) linter. Rules are defined in [.eslintrc](./.eslintrc) ```bash npm run lint ``` Run the jscs style checker. Rules are defined in [.jscsrc.json](./.jscsrc.json) ```bash npm run style ``` ## Code coverage Analyse the test coverage of the codebase (for results - open [./reports/coverage/lcov-report/index.html](./reports/coverage/lcov-report/index.html)) ```bash npm run coverage ``` or using environment variable on unit tests ```bash export npm_config_coverage=true npm run test:unit ``` ## Code quality Analyse the quality of the codebase (for results - open [./reports/plato/index.html](./reports/plato/index.html)) ```bash npm run quality ``` ## Development SMTP Server [Maildev](http://djfarrelly.github.io/MailDev/) can be run as a development SMTP server to catch emails being sent and preview the results. ```bash npm run maildev ``` By default, in development, a stub transport will be used for emails. To sent to maildev you will need to create the env var SMTP_USER and set it to any value: ```bash export SMTP_USER='test'; ``` Now start the app and it will send emails via maildev. -------------------------------------------------------------------------------- - See the [package.json](./package.json) for a full list of scripts. - Full list of [environment variables](./documentation/ENVIRONMENT_VARIABLES.md)
UKTradeInvestment/contact-ukti
README.md
Markdown
gpl-2.0
3,810
Products = new Mongo.Collection('products'); Cart = new Mongo.Collection('cart'); Orders = new Mongo.Collection('orders'); Categories = new Mongo.Collection('categories');
dmarco/Meteorshop
lib/collections.js
JavaScript
gpl-2.0
172
<!doctype html> <!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> <!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]--> <!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]--> <head> <meta charset="utf-8"> <title>STS-114 Photos &#8211; I exist as I am</title> <meta name="description" content=""> <meta name="keywords" content=""> <!-- Twitter Cards --> <meta name="twitter:card" content="summary"> <meta name="twitter:image" content="http://localhost:4000/images/"> <meta name="twitter:title" content="STS-114 Photos"> <meta name="twitter:description" content=""> <meta name="twitter:creator" content="@jottley"> <!-- Open Graph --> <meta property="og:locale" content="en_US"> <meta property="og:type" content="article"> <meta property="og:title" content="STS-114 Photos"> <meta property="og:description" content=""> <meta property="og:url" content="http://localhost:4000/general/sts-114-photos"> <meta property="og:site_name" content="I exist as I am"> <link rel="canonical" href="http://localhost:4000/general/sts-114-photos"> <link href="http://localhost:4000/feed.xml" type="application/atom+xml" rel="alternate" title="I exist as I am Feed"> <!-- http://t.co/dKP3o1e --> <meta name="HandheldFriendly" content="True"> <meta name="MobileOptimized" content="320"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Google Webfonts --> <link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700|PT+Serif:400,700,400italic' rel='stylesheet' type='text/css'> <!-- For all browsers --> <link rel="stylesheet" href="http://localhost:4000/assets/css/main.min.css"> <!--[if (lt IE 9) & (!IEMobile)]> <link rel="stylesheet" href="http://localhost:4000/assets/css/ie.min.css"> <![endif]--> <meta http-equiv="cleartype" content="on"> <!-- Load Modernizr --> <script src="http://localhost:4000/assets/js/modernizr.js"></script> <!-- Icons --> <!-- 16x16 --> <link rel="shortcut icon" href="http://localhost:4000/favicon.ico"> <!-- 32x32 --> <link rel="shortcut icon" href="http://localhost:4000/favicon.png"> <!-- 57x57 (precomposed) for iPhone 3GS, pre-2011 iPod Touch and older Android devices --> <link rel="apple-touch-icon-precomposed" href="http://localhost:4000/images/apple-touch-icon-precomposed.png"> <!-- 72x72 (precomposed) for 1st generation iPad, iPad 2 and iPad mini --> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://localhost:4000/images/apple-touch-icon-72x72-precomposed.png"> <!-- 114x114 (precomposed) for iPhone 4, 4S, 5 and post-2011 iPod Touch --> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://localhost:4000/images/apple-touch-icon-114x114-precomposed.png"> <!-- 144x144 (precomposed) for iPad 3rd and 4th generation --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://localhost:4000/images/apple-touch-icon-144x144-precomposed.png"> </head> <body class="article" itemscope itemtype="http://schema.org/WebPage"> <!--[if lt IE 9]><div class="browser-upgrade alert alert-info">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</div><![endif]--> <div id="outer-wrap"> <div id="inner-wrap"> <header id="top" role="banner"> <div class="block"> <h1 class="block-title">I exist as I am</h1> <a class="nav-btn" id="nav-open-btn" href="#nav">Navigation</a> </div> </header> <nav id="nav" role="navigation"> <div class="block"> <h2 class="block-title">Chapters</h2> <ul> <li><a href="http://localhost:4000/" >Home</a></li> <li><a href="http://localhost:4000/about/" >About</a></li> <li><a href="http://localhost:4000/articles/" >Articles</a></li> <li><a href="http://localhost:4000/feed.xml" title="Atom/RSS feed">Feed</a> </ul> <a class="close-btn" id="nav-close-btn" href="#top">Return to Content</a> </div> </nav> <div id="main" role="main" itemprop="mainContentOfPage" itemscope itemtype="http://schema.org/Blog"> <div class="article-author-side"> <img src="http://localhost:4000/images/photo.JPG" class="bio-photo" alt="Jared Ottley bio photo"></a> <h3>Jared Ottley</h3> <p>Jared Ottley is a Tech Lead Engineer and Salesforce SME at <a href='http://www.alfresco.com'>Alfresco</a>. To wind down he coaches lacrosse Springville High School. As the father of 6 he is raising a geek army. He has a degree in Political Science and drives a Mini.</p> <a href="mailto:jared@ottleys.net" class="author-social"><i class="icon-mail"></i> jared@ottleys.net</a> <a href="http://twitter.com/jottley" class="author-social" target="_blank"><i class="icon-twitter"></i> Twitter</a> <a href="http://facebook.com/jottley" class="author-social" target="_blank"><i class="icon-facebook"></i> Facebook</a> <a href="http://linkedin.com/in/jottley" class="author-social" target="_blank"><i class="icon-linkedin"></i> LinkedIn</a> <a href="http://instagram.com/jaredrottley" class="author-social" target="_blank"><i class="icon-instagram"></i> Instagram</a> <a href="http://github.com/jottley" class="author-social" target="_blank"><i class="icon-github"></i> Github</a> <a href="http://lastfm.com/user/jottley" class="author-social" target="_blank"><i class="icon-lastfm"></i> Last.fm</a> <a href="http://www.flickr.com/photos/jottley" class="author-social" target="_blank"><i class="icon-flickr"></i> Flickr</a> </div> <article itemscope itemtype="http://schema.org/BlogPosting" itemprop="blogPost"> <div class="headline-wrap"> <h1 itemprop="name">STS-114 Photos</h1> <h2></h2> </div><!--/ .headline-wrap --> <div class="article-wrap" itemprop="text"> <p>Dad sent some photos from STS-114. These are some pretty nice shots.</p> <div align="center"> <a href="http://jared.ottleys.net/archives/images/8H8P0558.jpg" rel="lightbox[75]"><img src="http://jared.ottleys.net/archives/images/8H8P0558.jpg" height="141" width="213" alt="" /></a>&nbsp;<a href="http://jared.ottleys.net/archives/images/8S2S6825_Discoveryhead-on.jpg" rel="lightbox[75]"><img src="http://jared.ottleys.net/archives/images/8S2S6825_Discoveryhead-on.jpg" height="141" width="213" alt="" /></a> </div> <div align="center"> <a href="http://jared.ottleys.net/archives/images/steve.jpg" rel="lightbox[75]"><img src="http://jared.ottleys.net/archives/images/steve.jpg" height="145" width="213" alt="" /></a>&nbsp;<a href="http://jared.ottleys.net/archives/images/steve5.jpg" rel="lightbox[75]"><img src="http://jared.ottleys.net/archives/images/steve5.jpg" height="145" width="213" alt="" /></a> </div> <div align="center"> <a href="http://jared.ottleys.net/archives/images/steve3.jpg" rel="lightbox[75]"><img src="http://jared.ottleys.net/archives/images/steve3.jpg" height="213" width="145" alt="" /></a>&nbsp;<a href="http://jared.ottleys.net/archives/images/steve4.jpg" rel="lightbox[75]"><img src="http://jared.ottleys.net/archives/images/steve4.jpg" height="213" width="145" alt="" /></a> </div> <hr /> <footer role="contentinfo"> <div class="article-author-bottom"> <img src="http://localhost:4000/images/photo.JPG" class="bio-photo" alt="Jared Ottley bio photo"></a> <h3>Jared Ottley</h3> <p>Jared Ottley is a Tech Lead Engineer and Salesforce SME at <a href='http://www.alfresco.com'>Alfresco</a>. To wind down he coaches lacrosse Springville High School. As the father of 6 he is raising a geek army. He has a degree in Political Science and drives a Mini.</p> <a href="mailto:jared@ottleys.net" class="author-social"><i class="icon-mail"></i> jared@ottleys.net</a> <a href="http://twitter.com/jottley" class="author-social" target="_blank"><i class="icon-twitter"></i> Twitter</a> <a href="http://facebook.com/jottley" class="author-social" target="_blank"><i class="icon-facebook"></i> Facebook</a> <a href="http://linkedin.com/in/jottley" class="author-social" target="_blank"><i class="icon-linkedin"></i> LinkedIn</a> <a href="http://instagram.com/jaredrottley" class="author-social" target="_blank"><i class="icon-instagram"></i> Instagram</a> <a href="http://github.com/jottley" class="author-social" target="_blank"><i class="icon-github"></i> Github</a> <a href="http://lastfm.com/user/jottley" class="author-social" target="_blank"><i class="icon-lastfm"></i> Last.fm</a> <a href="http://www.flickr.com/photos/jottley" class="author-social" target="_blank"><i class="icon-flickr"></i> Flickr</a> </div> <p class="byline"><strong>STS-114 Photos</strong> was published on <time datetime="2005-08-10T00:00:00-06:00" itemprop="datePublished">August 10, 2005</time> by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name"><a href="http://localhost:4000/about" title="About Jared Ottley" itemprop="url">Jared Ottley</a></span></span>.</p> </footer> </div><!-- /.article-wrap --> </article> </div><!-- /#main --> <div class="footer-wrap"> <div class="related-articles"> <h4>You might also enjoy <small class="pull-right">(<a href="http://localhost:4000/articles">View all articles</a>)</small></h4> <ul> </ul> <hr /> </div><!-- /.related-articles --> <footer> <span>&copy; 2020 Jared Ottley. The thoughts here are my own and are not my employers...so blame me.</span> </footer> </div><!-- /.footer-wrap --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="http://localhost:4000/assets/js/vendor/jquery-1.9.1.min.js"><\/script>')</script> <script src="http://localhost:4000/assets/js/scripts.min.js"></script> <script src="http://localhost:4000/assets/js/main.js"></script> <!-- Asynchronous Google Analytics snippet --> <script> var _gaq = _gaq || []; var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js'; _gaq.push(['_require', 'inpage_linkid', pluginUrl]); _gaq.push(['_setAccount', 'UA-73397-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </body> </html>
jottley/jottley.github.io
_site/general/sts-114-photos.html
HTML
gpl-2.0
10,734
<?php /* * The template for displaying a header title section */ global $theme_option, $gdlr_post_option; $header_background = ''; if( !empty($gdlr_post_option['header-background']) ){ if( is_numeric($gdlr_post_option['header-background']) ){ $image_src = wp_get_attachment_image_src($gdlr_post_option['header-background'], 'full'); $header_background = ' style="background-image: url(\'' . $image_src[0] . '\');" '; }else{ $header_background = ' style="background-image: url(\'' . $gdlr_post_option['header-background'] . '\');" '; } } ?> <?php if( is_page() && (empty($gdlr_post_option['show-title']) || $gdlr_post_option['show-title'] != 'disable') ){ ?> <?php $page_background = ''; ?> <div class="gdlr-page-title-wrapper" <?php echo $header_background; ?> > <div class="gdlr-page-title-overlay"></div> <div class="gdlr-page-title-container container" > <h1 class="gdlr-page-title"><?php the_title(); ?></h1> <?php if( !empty($gdlr_post_option['page-caption']) ){ ?> <span class="gdlr-page-caption"><?php echo gdlr_text_filter($gdlr_post_option['page-caption']); ?></span> <?php } ?> </div> </div> <?php }else if( is_single() && $post->post_type == 'post' ){ if( !empty($gdlr_post_option['page-title']) ){ $page_title = $gdlr_post_option['page-title']; $page_caption = $gdlr_post_option['page-caption']; }else{ $page_title = $theme_option['post-title']; $page_caption = $theme_option['post-caption']; } ?> <div class="gdlr-page-title-wrapper" <?php echo $header_background; ?> > <div class="gdlr-page-title-overlay"></div> <div class="gdlr-page-title-container container" > <h3 class="gdlr-page-title"><?php echo gdlr_text_filter($page_title); ?></h3> <?php if( !empty($page_caption) ){ ?> <span class="gdlr-page-caption"><?php echo gdlr_text_filter($page_caption); ?></span> <?php } ?> </div> </div> <?php }else if( is_single() ){ // for custom post type $page_title = get_the_title(); if( !empty($gdlr_post_option) && !empty($gdlr_post_option['page-caption']) ){ $page_caption = $gdlr_post_option['page-caption']; }else if($post->post_type == 'portfolio' && !empty($theme_option['page-caption']) ){ $page_caption = $theme_option['portfolio-caption']; } ?> <div class="gdlr-page-title-wrapper" <?php echo $header_background; ?> > <div class="gdlr-page-title-overlay"></div> <div class="gdlr-page-title-container container" > <h1 class="gdlr-page-title"><?php echo gdlr_text_filter($page_title); ?></h1> <?php if( !empty($page_caption) ){ ?> <span class="gdlr-page-caption"><?php echo gdlr_text_filter($page_caption); ?></span> <?php } ?> </div> </div> <?php }else if( is_404() ){ ?> <div class="gdlr-page-title-wrapper" <?php echo $header_background; ?> > <div class="gdlr-page-title-overlay"></div> <div class="gdlr-page-title-container container" > <h1 class="gdlr-page-title"><?php _e('404', 'gdlr_translate'); ?></h1> <span class="gdlr-page-caption"><?php _e('Page not found', 'gdlr_translate'); ?></span> </div> </div> <?php }else if( is_archive() || is_search() ){ if( is_search() ){ $title = __('Search Results', 'gdlr_translate'); $caption = get_search_query(); }else if( is_category() || is_tax('portfolio_category') || is_tax('product_cat') ){ $title = __('Category','gdlr_translate'); $caption = single_cat_title('', false); }else if( is_tag() || is_tax('portfolio_tag') || is_tax('product_tag') ){ $title = __('Tag','gdlr_translate'); $caption = single_cat_title('', false); }else if( is_day() ){ $title = __('Day','gdlr_translate'); $caption = get_the_date('F j, Y'); }else if( is_month() ){ $title = __('Month','gdlr_translate'); $caption = get_the_date('F Y'); }else if( is_year() ){ $title = __('Year','gdlr_translate'); $caption = get_the_date('Y'); }else if( is_author() ){ $title = __('By','gdlr_translate'); $author_id = get_query_var('author'); $author = get_user_by('id', $author_id); $caption = $author->display_name; }else if( is_post_type_archive('product') ){ $title = __('Shop', 'gdlr_translate'); $caption = ''; }else{ $title = get_the_title(); $caption = ''; } ?> <div class="gdlr-page-title-wrapper" <?php echo $header_background; ?> > <div class="gdlr-page-title-overlay"></div> <div class="gdlr-page-title-container container" > <span class="gdlr-page-title"><?php echo gdlr_text_filter($title); ?></span> <?php if( !empty($caption) ){ ?> <h1 class="gdlr-page-caption"><?php echo gdlr_text_filter($caption); ?></h1> <?php } ?> </div> </div> <?php } ?> <!-- is search -->
javalidigital/stm
wp-content/themes/mediso-v1-02/header-title.php
PHP
gpl-2.0
4,722
/////////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2006-2019 Esper Team. All rights reserved. / // http://esper.codehaus.org / // ---------------------------------------------------------------------------------- / // The software in this package is published under the terms of the GPL license / // a copy of which has been included with this distribution in the license.txt file. / /////////////////////////////////////////////////////////////////////////////////////// using com.espertech.esper.common.client; using com.espertech.esper.common.@internal.context.module; using com.espertech.esper.common.@internal.epl.expression.core; using com.espertech.esper.common.@internal.epl.expression.time.eval; using com.espertech.esper.common.@internal.view.access; using com.espertech.esper.common.@internal.view.core; using com.espertech.esper.common.@internal.view.previous; namespace com.espertech.esper.common.@internal.view.exttimedwin { /// <summary> /// Factory for <seealso cref="ExternallyTimedWindowView" />. /// </summary> public class ExternallyTimedWindowViewFactory : DataWindowViewFactory, DataWindowViewWithPrevious { protected internal EventType eventType; protected internal TimePeriodCompute timePeriodCompute; protected internal ExprEvaluator timestampEval; public ExprEvaluator TimestampEval { get => timestampEval; set => timestampEval = value; } public TimePeriodCompute TimePeriodCompute { set => timePeriodCompute = value; } public void Init( ViewFactoryContext viewFactoryContext, EPStatementInitServices services) { } public View MakeView(AgentInstanceViewFactoryChainContext agentInstanceViewFactoryContext) { var timePeriodProvide = timePeriodCompute.GetNonVariableProvide(agentInstanceViewFactoryContext.AgentInstanceContext); var randomAccess = agentInstanceViewFactoryContext.StatementContext.ViewServicePreviousFactory .GetOptPreviousExprRandomAccess(agentInstanceViewFactoryContext); return new ExternallyTimedWindowView( this, randomAccess, agentInstanceViewFactoryContext, timePeriodProvide); } public EventType EventType { get => eventType; set => eventType = value; } public string ViewName => ViewEnum.EXT_TIMED_WINDOW.GetViewName(); PreviousGetterStrategy DataWindowViewWithPrevious.MakePreviousGetter() { return MakePreviousGetter(); } public RandomAccessByIndexGetter MakePreviousGetter() { return new RandomAccessByIndexGetter(); } } } // end of namespace
espertechinc/nesper
src/NEsper.Common/common/internal/view/exttimedwin/ExternallyTimedWindowViewFactory.cs
C#
gpl-2.0
3,094
// // Tizen Native SDK // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. // // Licensed under the Flora License, Version 1.1 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://floralicense.org/license/ // // 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. // #include <unique_ptr.h> #include "GroupConfigurationForm.h" #include "MainForm.h" #include "FormFactory.h" using namespace std; using namespace Tizen::Base; using namespace Tizen::Ui; using namespace Tizen::Ui::Controls; using namespace Tizen::Graphics; using namespace Tizen::Base::Collection; using namespace Tizen::Net::Wifi; using namespace Tizen::Ui::Scenes; GroupConfigurationForm::GroupConfigurationForm(void) : __pEditFieldIntent(null) , __pEditFieldClientCount(null) { } GroupConfigurationForm::~GroupConfigurationForm(void) { } bool GroupConfigurationForm::Initialize(void) { Construct(FORM_STYLE_NORMAL | FORM_STYLE_HEADER | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER); SetName(FORM_GROUP_CONFIG); return true; } void GroupConfigurationForm::ShowMessageBox(const String& title, const String& text) { MessageBox messageBox; int modalResult = 0; messageBox.Construct(title, text, MSGBOX_STYLE_NONE, MESSAGE_BOX_TIMEOUT); messageBox.ShowAndWait(modalResult); } result GroupConfigurationForm::OnInitializing(void) { result r = E_SUCCESS; Header* pHeader = GetHeader(); if (pHeader != null) { pHeader->SetStyle(HEADER_STYLE_TITLE); pHeader->SetTitleText(L"Group configuration info"); } Footer* pFooter = GetFooter(); if (pFooter != null) { pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); FooterItem footerItemDone; footerItemDone.Construct(ID_OPTION_DONE); footerItemDone.SetText("Done"); pFooter->AddItem(footerItemDone); pFooter->AddActionEventListener(*this); } SetFormBackEventListener(this); Rectangle clientRect = GetClientAreaBounds(); static const int GAP_BETWEEN_GROUPS = 32; int emptySpaceHeight = (clientRect.height - (2 * EDIT_FIELD_HEIGHT + GAP_BETWEEN_GROUPS)) / 2; int currentHeight = emptySpaceHeight; __pEditFieldIntent = new EditField; __pEditFieldIntent->Construct(Rectangle(EDIT_FILED_X, currentHeight, clientRect.width - EDIT_FIEILD_MARGIN, EDIT_FIELD_HEIGHT), EDIT_FIELD_STYLE_NUMBER, INPUT_STYLE_FULLSCREEN, true, EDIT_FIELD_GROUP_INDENT_LIMIT, GROUP_STYLE_NONE); __pEditFieldIntent->SetTitleText(L"Intent"); __pEditFieldIntent->AddTextEventListener(*this); AddControl(*__pEditFieldIntent); currentHeight += EDIT_FIELD_HEIGHT + GAP_BETWEEN_GROUPS; __pEditFieldClientCount = new EditField; __pEditFieldClientCount->Construct(Rectangle(EDIT_FILED_X, currentHeight, clientRect.width - EDIT_FIEILD_MARGIN, EDIT_FIELD_HEIGHT), EDIT_FIELD_STYLE_NUMBER, INPUT_STYLE_FULLSCREEN, true, EDIT_FIELD_GROUP_CLIENT_LIMIT, GROUP_STYLE_NONE); __pEditFieldClientCount->SetTitleText(L"Max. Clients"); __pEditFieldClientCount->AddTextEventListener(*this); AddControl(*__pEditFieldClientCount); Draw(true); return r; } void GroupConfigurationForm::OnActionPerformed(const Control& source, int actionId) { if (actionId == ID_OPTION_DONE) { int groupOwnerIntent = 0; int maxClientCount = 8; Integer::Decode(__pEditFieldIntent->GetText(), groupOwnerIntent); Integer::Decode(__pEditFieldClientCount->GetText(), maxClientCount); if (groupOwnerIntent > MAX_WIFI_DIRECT_GROUP_OWNER_INTENT) { ShowMessageBox(L"Invalid Value", L"Intent cannot be greater than 15"); return; } if (maxClientCount > MAX_WIFI_DIRECT_CONNECTED_CLIENTS) { ShowMessageBox(L"Invalid Value", L"Connected Clients cannot be greater than 8"); return; } WifiDirectGroupInfo* pGroupInfo = new WifiDirectGroupInfo; pGroupInfo->SetGroupOwnerIntent(groupOwnerIntent); pGroupInfo->SetMaxNumberOfClients(maxClientCount); ArrayList* pArgs = new ArrayList(); pArgs->Add(*pGroupInfo); SceneManager* pSceneManager = SceneManager::GetInstance(); AppAssert(pSceneManager); pSceneManager->GoBackward(BackwardSceneTransition(), pArgs); } } void GroupConfigurationForm::OnFormBackRequested(Controls::Form& source) { SceneManager* pSceneManager = SceneManager::GetInstance(); AppAssert(pSceneManager); pSceneManager->GoBackward(BackwardSceneTransition()); } void GroupConfigurationForm::OnTextValueChanged(const Control& source) { } void GroupConfigurationForm::OnSceneActivatedN(const SceneId &previousSceneId, const SceneId &currentSceneId, IList *pArgs) { TryReturnVoid(pArgs != null, "The argument list is null"); unique_ptr<IList> pList(pArgs); WifiDirectGroupInfo* pGroupInfo = static_cast<WifiDirectGroupInfo*>(pList->GetAt(0)); TryReturnVoid(pGroupInfo != null, "Failed to get Group Info"); String groupOwnerIntent; groupOwnerIntent.Format(3, L"%2d", pGroupInfo->GetGroupOwnerIntent()); groupOwnerIntent.Trim(); __pEditFieldIntent->SetText(groupOwnerIntent); String maxClients; maxClients.Format(2, L"%1d", pGroupInfo->GetMaxNumberOfClients()); __pEditFieldClientCount->SetText(maxClients); RequestRedraw(); }
naoyukimori/TizenRobot_Kondo
RobotChat/src/GroupConfigurationForm.cpp
C++
gpl-2.0
5,560
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!! # This file is machine-generated by lib/unicore/mktables from the Unicode # database, Version 6.0.0. Any changes made here will be lost! # !!!!!!! INTERNAL PERL USE ONLY !!!!!!! # This file is for internal use by the Perl program only. The format and even # the name or existence of this file are subject to change without notice. # Don't use it directly. return <<'END'; 0030 0039 0041 005A 0061 007A END
Honor8Dev/android_kernel_huawei_FRD-L04
drivers/huawei_platform/lcd/tools/localperl/lib/5.14.2/unicore/lib/Perl/PosixAln.pl
Perl
gpl-2.0
474
<?php /* * Lupus In Tabula * Created by Edoardo Morassutto <edoardo.morassutto@gmail.com> */ ?> <div id="elencoRuoli"> <table> <tr><th>Ruolo</th><th>Numero</th></tr> <?php foreach ($status["ruoli"] as $ruolo => $num) { if ($num > 0) echo "<tr><td>$ruolo</td><td>$num</td></tr>"; if ($num == "on") echo "<tr><td>Massone</td><td>2</td></tr>"; } ?> </table> </div>
edomora97/lupus
pages/elencoRuoli.php
PHP
gpl-2.0
497
/* * $Id$ * * (C) 2008 by dbt <info@dbox2-tuning.de> * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef __gui_widget_progressbar_h__ #define __gui_widget_progressbar_h__ #include "config.h" #include <gui/color.h> #include <driver/framebuffer.h> #include <driver/fontrenderer.h> #include <system/settings.h> #include <string> class CProgressBar { private: CFrameBuffer * frameBuffer; int font_pbar; int frame_widht; int last_width; int red, green, yellow; bool blink, invert, bl_changed; int width, height; void realpaint(const int pos_x, const int pos_y, const int value, const int max_value, const fb_pixel_t activebar_col, const fb_pixel_t passivebar_col, const fb_pixel_t backgroundbar_col, const fb_pixel_t shadowbar_col, const char *upper_labeltext, const uint8_t uppertext_col, const char *iconfile, bool paintZero); public: /* parameters: blinkenligts: true if you want code to follow progressbar_color. needed, no default. w, h: width / height of bar. Can later be set with paintProgressbar. paintProgressBar2 can oly be used if w and h are set. r, g, b: percentage of the bar where red/green/yellow is used. only used if blinkenlights == true. inv: false => red on the left side, true: red on right side. */ CProgressBar(const bool blinkenlights, const int w = -1, const int h = -1, const int r = 40, const int g = 100, const int b = 70, const bool inv = false); ~CProgressBar(); /// void paintProgressBar(...) /*! description of parameters: position of progressbar: pos_x > start position on screen x pos_y > start position on screen y pb_width > with of progressbar pb_height > height of progressbar definitions of values: value > value, you will display max_value > maximal value that you will display appearance: activebar_col > color of inner bar that shows the current value passivebar_col > color of passive bar frame_col > general frame color of progressbar, set 0 for no frame shadowbar_col color > shadow behind progressbar, set 0 for no shadow upper_labeltext > optional, label text, will be painted upper/left the progressbar uppertext_col > optional, but necessary with label text, color of label text iconfile > optional, name of iconfile paintZero > optional, if set to true and value = 0, then paints a diagonal line instead of active bar as symbolic for a zero value */ void paintProgressBar ( const int pos_x, const int pos_y, const int pb_width, const int pb_height, const int value, const int max_value, const fb_pixel_t activebar_col = 0, const fb_pixel_t passivebar_col = 0, const fb_pixel_t frame_col = 0, const fb_pixel_t shadowbar_col = 0, const char * upper_labeltext = NULL, const uint8_t uppertext_col = 0, const char * iconfile = NULL, bool paintZero = false); void paintProgressBar2 (const int pos_x, const int pos_y, const int value, const int max_value = 100, const fb_pixel_t activebar_col = 0, const fb_pixel_t passivebar_col = 0, const fb_pixel_t frame_col = 0, const fb_pixel_t shadowbar_col = 0, const char * upper_labeltext = NULL, const uint8_t uppertext_col = 0, const char * iconfile = NULL, bool paintZero = false); void paintProgressBarDefault ( const int pos_x, const int pos_y, const int pb_width, const int pb_height, const int value, const int max_value); }; #endif /* __gui_widget_progressbar_h__ */
UkCvs/commando
apps/tuxbox/neutrino/src/gui/widget/progressbar.h
C
gpl-2.0
4,340
<?php namespace Drupal\lesson4\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Routing\AccessAwareRouter; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; /** * Class DefaultController * @package Drupal\lesson4\Controller */ class DefaultController extends ControllerBase { /** @var AccessAwareRouter */ private $router; /** * DefaultController constructor. * @param AccessAwareRouter $router */ public function __construct(AccessAwareRouter $router) { $this->router = $router; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('router') ); } /** * Page example. * * @return array */ public function pageExampleAction() { return [ 'theme example' => [ '#theme' => 'lesson4_theme_example', '#title' => $this->t('title'), '#description' => $this->t('description'), ], 'render element example' => [ '#type' => 'lesson4_element', '#label' => 'Custom render element label', '#description' => 'Custom render element description', ], 'core element example' => [ '#markup' => '<h3>Element example</h3>' ], ]; } /** * Redirect example. * * @return RedirectResponse */ public function redirectExampleAction() { drupal_set_message($this->t('You are redirected.')); return new RedirectResponse($this->router->generate('lesson4.page_example')); } }
Max-Yudin/drupal-school
modules/custom/lesson4/src/Controller/DefaultController.php
PHP
gpl-2.0
1,798
#ifndef __SCENE_PRIMITIVE_ARRAY__H_ #define __SCENE_PRIMITIVE_ARRAY__H_ /*LICENSE_START*/ /* * Copyright (C) 2014 Washington University School of Medicine * * 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. */ /*LICENSE_END*/ #include "SceneObjectArray.h" namespace caret { class ScenePrimitiveArray : public SceneObjectArray { public: virtual ~ScenePrimitiveArray(); virtual ScenePrimitiveArray* castToScenePrimitiveArray(); virtual const ScenePrimitiveArray* castToScenePrimitiveArray() const; protected: ScenePrimitiveArray(const QString& name, const SceneObjectDataTypeEnum::Enum dataType); private: ScenePrimitiveArray(const ScenePrimitiveArray&); ScenePrimitiveArray& operator=(const ScenePrimitiveArray&); public: // ADD_NEW_METHODS_HERE /** * Get the values as a boolean. * @param arrayIndex * Index of element. * @return The value. */ virtual bool booleanValue(const int32_t arrayIndex) const = 0; /** * Get the values as a float. * @param arrayIndex * Index of element. * @return The value. */ virtual float floatValue(const int32_t arrayIndex) const = 0; /** * Get the values as a integer. * @param arrayIndex * Index of element. * @return The value. */ virtual int32_t integerValue(const int32_t arrayIndex) const = 0; /** * Get the values as a long integer. * @param arrayIndex * Index of element. * @return The value. */ virtual int64_t longIntegerValue(const int32_t arrayIndex) const = 0; /** * Get the values as a string. * @param arrayIndex * Index of element. * @return The value. */ virtual AString stringValue(const int32_t arrayIndex) const = 0; /** * Get the values as an unsigned byte. * @param arrayIndex * Index of element. * @return The value. */ virtual uint8_t unsignedByteValue(const int32_t arrayIndex) const = 0; virtual void booleanValues(bool valuesOut[], const int32_t arrayNumberOfElements, const bool defaultValue) const; virtual void booleanValues(std::vector<bool>& valuesOut, const bool defaultValue) const; virtual void booleanVectorValues(std::vector<bool>& valuesOut) const; virtual void floatValues(float valuesOut[], const int32_t arrayNumberOfElements, const float defaultValue) const; virtual void floatValues(std::vector<float>& valuesOut, const float defaultValue) const; virtual void floatVectorValues(std::vector<float>& valuesOut) const; virtual void integerValues(int32_t valuesOut[], const int32_t arrayNumberOfElements, const int32_t defaultValue) const; virtual void integerValues(std::vector<int32_t>& valuesOut, const int32_t defaultValue) const; virtual void integerVectorValues(std::vector<int32_t>& valuesOut) const; virtual void longIntegerValues(int64_t valuesOut[], const int32_t arrayNumberOfElements, const int64_t defaultValue) const; virtual void longIntegerValues(std::vector<int64_t>& valuesOut, const int64_t defaultValue) const; virtual void longIntegerVectorValues(std::vector<int64_t>& valuesOut) const; virtual void stringValues(AString valuesOut[], const int32_t arrayNumberOfElements, const AString& defaultValue) const; virtual void stringValues(std::vector<AString>& valuesOut, const AString& defaultValue) const; virtual void stringVectorValues(std::vector<AString>& valuesOut) const; virtual void unsignedByteValues(uint8_t valuesOut[], const int32_t arrayNumberOfElements, const uint8_t defaultValue) const; virtual void unsignedByteValues(std::vector<uint8_t>& valuesOut, const uint8_t defaultValue) const; virtual void unsignedByteVectorValues(std::vector<uint8_t>& valuesOut) const; private: // ADD_NEW_MEMBERS_HERE }; #ifdef __SCENE_PRIMITIVE_ARRAY_DECLARE__ // <PLACE DECLARATIONS OF STATIC MEMBERS HERE> #endif // __SCENE_PRIMITIVE_ARRAY_DECLARE__ } // namespace #endif //__SCENE_PRIMITIVE_ARRAY__H_
Washington-University/workbench
src/Scenes/ScenePrimitiveArray.h
C
gpl-2.0
5,931
/* This file is part of the KDE libraries Copyright (C) 2000 Simon Hausmann <hausmann@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <kapplication.h> #include <klocale.h> #include <kcmdlineargs.h> static const KCmdLineOptions options[] = { { "+url", 0, 0 }, KCmdLineLastOption }; int main( int argc, char **argv ) { KLocale::setMainCatalogue("kdelibs"); KCmdLineArgs::init( argc, argv, "kmailservice", I18N_NOOP("KMailService"), I18N_NOOP("Mail service"), "unknown" ); KCmdLineArgs::addCmdLineOptions( options ); KApplication a( false, false ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if ( args->count() != 1 ) return 1; a.invokeMailer(KURL(args->arg(0)), a.startupId(), true); return 0; }
iegor/kdelibs
kio/misc/kmailservice.cpp
C++
gpl-2.0
1,436
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html <?php language_attributes(); ?> xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory') ?>/global/css/master.css" media="all" /> <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory') ?>/global/inc/custom_theme_stylesheet.css.php" media="all" /> <link rel="icon" href="<?php bloginfo('stylesheet_directory') ?>/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="<?php bloginfo('stylesheet_directory') ?>/favicon.ico" type="image/x-icon"> <?php if ( is_single() or is_page() ) : ?> <link rel="stylesheet" href="<?php bloginfo('template_directory') ?>/global/css/single.css" media="all" /> <?php endif; ?> <?php wp_enqueue_script( 'jquery' ); ?> <?php wp_enqueue_script( 'resetDefault', get_bloginfo('template_directory') .'/global/js/resetDefault.js', 'jquery' ); ?> <?php wp_enqueue_script( 'lavaLamp', get_bloginfo('template_directory') .'/global/js/jquery.lavalamp.js', 'jquery' ); ?> <?php wp_enqueue_script( 'easing', get_bloginfo('template_directory') .'/global/js/easing.js', 'jquery' ); ?> <?php wp_enqueue_script( 'jquery.cookie', get_bloginfo('template_directory') .'/global/js/jquery.cookie.js', 'jquery' ); ?> <?php if ( is_home() and !is_paged() ) wp_enqueue_script( 'stepCarousel', get_bloginfo('template_directory') .'/global/js/stepCarousel.js', 'jquery' ); ?> <?php wp_enqueue_script( 'functions', get_bloginfo('template_directory') .'/global/js/functions.js', 'jquery' ); ?> <?php if ( is_singular() and comments_open() and (get_option('thread_comments') == 1) or is_page() and comments_open() and (get_option('thread_comments') == 1) ) wp_enqueue_script( 'comment-reply' ); ?> <?php wp_head(); ?> <!--[if IE 6]> <script src="<?php bloginfo('template_directory'); ?>/global/js/DD_belatedPNG.js"></script> <script type="text/javascript"> DD_belatedPNG.fix( '#header h2 a, #header div.nav div.bg, span.tab, #content span.twitt, #header .rss, #content, #content div.wrapper, #content div.outer, #content div.inner, #content .bigTitle, #content .thumb, #content div.main div.posts ul.posts li .comment, #footer' ); </script> <![endif]--> <?php $ctheme = get_option('custom_theme'); $hlCategory = $ctheme['general']['hlCategory']; $my_query1 = new WP_Query('cat='. $hlCategory .'&posts_per_page=10'); if ( $my_query1->have_posts() && is_home() and !is_paged() ) : ?> <script type="text/javascript"> // steop carousel stepcarousel.setup({ galleryid: 'mygallery', //id of carousel DIV beltclass: 'gallery', //class of inner "belt" DIV containing all the panel DIVs panelclass: 'panel', //class of panel DIVs each holding content panelbehavior: {speed:400, wraparound:true, persist:true}, defaultbuttons: {enable: true, moveby: 1, leftnav: ['<?php bloginfo("template_directory") ?>/global/img/bt/bt_prev.png', 15, 100], rightnav: ['<?php bloginfo("template_directory") ?>/global/img/bt/bt_next.png', -30, 100]}, statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file'] }) </script> <?php endif ?> </head> <body <?php body_class() ?>> <div id="general"> <div id="header"> <div class="nav"> <div class="bg"></div> <div class="middle"> <ul class="nav"> <li><a href="<?php bloginfo('url'); ?>" title=""><?php _e('Home', 'evoeTheme'); ?></a></li> <?php wp_list_pages('title_li='); ?> </ul> </div> </div> <div class="skip"> <a href="#content" title="<?php _e('Skip to content', 'evoeTheme'); ?>"><?php _e('Skip to content', 'evoeTheme'); ?></a> </div>
CoordCulturaDigital-Minc/culturadigital.br
wp-content/themes/EvoeTheme-video-online/header.php
PHP
gpl-2.0
4,584
<?php /** * CodeIgniter * * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); /** * Loader Class * * Loads framework components. * * @package CodeIgniter * @subpackage Libraries * @category Loader * @author EllisLab Dev Team * @link https://codeigniter.com/user_guide/libraries/loader.html */ class CI_Loader { // All these are set automatically. Don't mess with them. /** * Nesting level of the output buffering mechanism * * @var int */ protected $_ci_ob_level; /** * List of paths to load views from * * @var array */ protected $_ci_view_paths = array(VIEWPATH => TRUE); /** * List of paths to load libraries from * * @var array */ protected $_ci_library_paths = array(APPPATH, BASEPATH); /** * List of paths to load models from * * @var array */ protected $_ci_model_paths = array(APPPATH); /** * List of paths to load helpers from * * @var array */ protected $_ci_helper_paths = array(APPPATH, BASEPATH); /** * List of cached variables * * @var array */ protected $_ci_cached_vars = array(); /** * List of loaded classes * * @var array */ protected $_ci_classes = array(); /** * List of loaded models * * @var array */ protected $_ci_models = array(); /** * List of loaded helpers * * @var array */ protected $_ci_helpers = array(); /** * List of class name mappings * * @var array */ protected $_ci_varmap = array( 'unit_test' => 'unit', 'user_agent' => 'agent' ); // -------------------------------------------------------------------- /** * Class constructor * * Sets component load paths, gets the initial output buffering level. * * @return void */ public function __construct() { $this->_ci_ob_level = ob_get_level(); $this->_ci_classes =& is_loaded(); log_message('info', 'Loader Class Initialized'); } // -------------------------------------------------------------------- /** * Initializer * * @todo Figure out a way to move this to the constructor * without breaking *package_path*() methods. * @uses CI_Loader::_ci_autoloader() * @used-by CI_Controller::__construct() * @return void */ public function initialize() { $this->_ci_autoloader(); } // -------------------------------------------------------------------- /** * CI Autoloader * * Loads component listed in the config/autoload.php file. * * @used-by CI_Loader::initialize() * @return void */ protected function _ci_autoloader() { if (file_exists(APPPATH . 'config/autoload.php')) { include(APPPATH . 'config/autoload.php'); } if (file_exists(APPPATH . 'config/' . ENVIRONMENT . '/autoload.php')) { include(APPPATH . 'config/' . ENVIRONMENT . '/autoload.php'); } if (!isset($autoload)) { return; } // Autoload packages if (isset($autoload['packages'])) { foreach ($autoload['packages'] as $package_path) { $this->add_package_path($package_path); } } // Load any custom config file if (count($autoload['config']) > 0) { foreach ($autoload['config'] as $val) { $this->config($val); } } // Autoload helpers and languages foreach (array('helper', 'language') as $type) { if (isset($autoload[$type]) && count($autoload[$type]) > 0) { $this->$type($autoload[$type]); } } // Autoload drivers if (isset($autoload['drivers'])) { $this->driver($autoload['drivers']); } // Load libraries if (isset($autoload['libraries']) && count($autoload['libraries']) > 0) { // Load the database driver. if (in_array('database', $autoload['libraries'])) { $this->database(); $autoload['libraries'] = array_diff($autoload['libraries'], array('database')); } // Load all other libraries $this->library($autoload['libraries']); } // Autoload models if (isset($autoload['model'])) { $this->model($autoload['model']); } } // -------------------------------------------------------------------- /** * Add Package Path * * Prepends a parent path to the library, model, helper and config * path arrays. * * @see CI_Loader::$_ci_library_paths * @see CI_Loader::$_ci_model_paths * @see CI_Loader::$_ci_helper_paths * @see CI_Config::$_config_paths * * @param string $path Path to add * @param bool $view_cascade (default: TRUE) * @return object */ public function add_package_path($path, $view_cascade = TRUE) { $path = rtrim($path, '/') . '/'; array_unshift($this->_ci_library_paths, $path); array_unshift($this->_ci_model_paths, $path); array_unshift($this->_ci_helper_paths, $path); $this->_ci_view_paths = array($path . 'views/' => $view_cascade) + $this->_ci_view_paths; // Add config file path $config =& $this->_ci_get_component('config'); $config->_config_paths[] = $path; return $this; } // -------------------------------------------------------------------- /** * CI Component getter * * Get a reference to a specific library or model. * * @param string $component Component name * @return bool */ protected function &_ci_get_component($component) { $CI =& get_instance(); return $CI->$component; } // -------------------------------------------------------------------- /** * Config Loader * * Loads a config file (an alias for CI_Config::load()). * * @uses CI_Config::load() * @param string $file Configuration file name * @param bool $use_sections Whether configuration values should be loaded into their own section * @param bool $fail_gracefully Whether to just return FALSE or display an error message * @return bool TRUE if the file was loaded correctly or FALSE on failure */ public function config($file, $use_sections = FALSE, $fail_gracefully = FALSE) { return get_instance()->config->load($file, $use_sections, $fail_gracefully); } // -------------------------------------------------------------------- /** * Driver Loader * * Loads a driver library. * * @param string|string[] $library Driver name(s) * @param array $params Optional parameters to pass to the driver * @param string $object_name An optional object name to assign to * * @return object|bool Object or FALSE on failure if $library is a string * and $object_name is set. CI_Loader instance otherwise. */ public function driver($library, $params = NULL, $object_name = NULL) { if (is_array($library)) { foreach ($library as $key => $value) { if (is_int($key)) { $this->driver($value, $params); } else { $this->driver($key, $params, $value); } } return $this; } elseif (empty($library)) { return FALSE; } if (!class_exists('CI_Driver_Library', FALSE)) { // We aren't instantiating an object here, just making the base class available require BASEPATH . 'libraries/Driver.php'; } // We can save the loader some time since Drivers will *always* be in a subfolder, // and typically identically named to the library if (!strpos($library, '/')) { $library = ucfirst($library) . '/' . $library; } return $this->library($library, $params, $object_name); } // -------------------------------------------------------------------- /** * Library Loader * * Loads and instantiates libraries. * Designed to be called from application controllers. * * @param string $library Library name * @param array $params Optional parameters to pass to the library class constructor * @param string $object_name An optional object name to assign to * @return object */ public function library($library, $params = NULL, $object_name = NULL) { if (empty($library)) { return $this; } elseif (is_array($library)) { foreach ($library as $key => $value) { if (is_int($key)) { $this->library($value, $params); } else { $this->library($key, $params, $value); } } return $this; } if ($params !== NULL && ! is_array($params)) { $params = NULL; } $this->_ci_load_library($library, $params, $object_name); return $this; } // -------------------------------------------------------------------- /** * Internal CI Library Loader * * @used-by CI_Loader::library() * @uses CI_Loader::_ci_init_library() * * @param string $class Class name to load * @param mixed $params Optional parameters to pass to the class constructor * @param string $object_name Optional object name to assign to * @return void */ protected function _ci_load_library($class, $params = NULL, $object_name = NULL) { // Get the class name, and while we're at it trim any slashes. // The directory path can be included as part of the class name, // but we don't want a leading slash $class = str_replace('.php', '', trim($class, '/')); // Was the path included with the class name? // We look for a slash to determine this if (($last_slash = strrpos($class, '/')) !== FALSE) { // Extract the path $subdir = substr($class, 0, ++$last_slash); // Get the filename from the path $class = substr($class, $last_slash); } else { $subdir = ''; } $class = ucfirst($class); // Is this a stock library? There are a few special conditions if so ... if (file_exists(BASEPATH . 'libraries/' . $subdir . $class . '.php')) { return $this->_ci_load_stock_library($class, $subdir, $params, $object_name); } // Let's search for the requested library file and load it. foreach ($this->_ci_library_paths as $path) { // BASEPATH has already been checked for if ($path === BASEPATH) { continue; } $filepath = $path . 'libraries/' . $subdir . $class . '.php'; // Safety: Was the class already loaded by a previous call? if (class_exists($class, FALSE)) { // Before we deem this to be a duplicate request, let's see // if a custom object name is being supplied. If so, we'll // return a new instance of the object if ($object_name !== NULL) { $CI =& get_instance(); if (!isset($CI->$object_name)) { return $this->_ci_init_library($class, '', $params, $object_name); } } log_message('debug', $class . ' class already loaded. Second attempt ignored.'); return; } // Does the file exist? No? Bummer... elseif (!file_exists($filepath)) { continue; } include_once($filepath); return $this->_ci_init_library($class, '', $params, $object_name); } // One last attempt. Maybe the library is in a subdirectory, but it wasn't specified? if ($subdir === '') { return $this->_ci_load_library($class . '/' . $class, $params, $object_name); } // If we got this far we were unable to find the requested class. log_message('error', 'Unable to load the requested class: ' . $class); show_error('Unable to load the requested class: ' . $class); } // -------------------------------------------------------------------- /** * Internal CI Stock Library Loader * * @used-by CI_Loader::_ci_load_library() * @uses CI_Loader::_ci_init_library() * * @param string $library_name Library name to load * @param string $file_path Path to the library filename, relative to libraries/ * @param mixed $params Optional parameters to pass to the class constructor * @param string $object_name Optional object name to assign to * @return void */ protected function _ci_load_stock_library($library_name, $file_path, $params, $object_name) { $prefix = 'CI_'; if (class_exists($prefix . $library_name, FALSE)) { if (class_exists(config_item('subclass_prefix') . $library_name, FALSE)) { $prefix = config_item('subclass_prefix'); } // Before we deem this to be a duplicate request, let's see // if a custom object name is being supplied. If so, we'll // return a new instance of the object if ($object_name !== NULL) { $CI =& get_instance(); if (!isset($CI->$object_name)) { return $this->_ci_init_library($library_name, $prefix, $params, $object_name); } } log_message('debug', $library_name . ' class already loaded. Second attempt ignored.'); return; } $paths = $this->_ci_library_paths; array_pop($paths); // BASEPATH array_pop($paths); // APPPATH (needs to be the first path checked) array_unshift($paths, APPPATH); foreach ($paths as $path) { if (file_exists($path = $path . 'libraries/' . $file_path . $library_name . '.php')) { // Override include_once($path); if (class_exists($prefix . $library_name, FALSE)) { return $this->_ci_init_library($library_name, $prefix, $params, $object_name); } else { log_message('debug', $path . ' exists, but does not declare ' . $prefix . $library_name); } } } include_once(BASEPATH . 'libraries/' . $file_path . $library_name . '.php'); // Check for extensions $subclass = config_item('subclass_prefix') . $library_name; foreach ($paths as $path) { if (file_exists($path = $path . 'libraries/' . $file_path . $subclass . '.php')) { include_once($path); if (class_exists($subclass, FALSE)) { $prefix = config_item('subclass_prefix'); break; } else { log_message('debug', $path . ' exists, but does not declare ' . $subclass); } } } return $this->_ci_init_library($library_name, $prefix, $params, $object_name); } // -------------------------------------------------------------------- /** * Internal CI Library Instantiator * * @used-by CI_Loader::_ci_load_stock_library() * @used-by CI_Loader::_ci_load_library() * * @param string $class Class name * @param string $prefix Class name prefix * @param array|null|bool $config Optional configuration to pass to the class constructor: * FALSE to skip; * NULL to search in config paths; * array containing configuration data * @param string $object_name Optional object name to assign to * @return void */ protected function _ci_init_library($class, $prefix, $config = FALSE, $object_name = NULL) { // Is there an associated config file for this class? Note: these should always be lowercase if ($config === NULL) { // Fetch the config paths containing any package paths $config_component = $this->_ci_get_component('config'); if (is_array($config_component->_config_paths)) { $found = FALSE; foreach ($config_component->_config_paths as $path) { // We test for both uppercase and lowercase, for servers that // are case-sensitive with regard to file names. Load global first, // override with environment next if (file_exists($path . 'config/' . strtolower($class) . '.php')) { include($path . 'config/' . strtolower($class) . '.php'); $found = TRUE; } elseif (file_exists($path . 'config/' . ucfirst(strtolower($class)) . '.php')) { include($path . 'config/' . ucfirst(strtolower($class)) . '.php'); $found = TRUE; } if (file_exists($path . 'config/' . ENVIRONMENT . '/' . strtolower($class) . '.php')) { include($path . 'config/' . ENVIRONMENT . '/' . strtolower($class) . '.php'); $found = TRUE; } elseif (file_exists($path . 'config/' . ENVIRONMENT . '/' . ucfirst(strtolower($class)) . '.php')) { include($path . 'config/' . ENVIRONMENT . '/' . ucfirst(strtolower($class)) . '.php'); $found = TRUE; } // Break on the first found configuration, thus package // files are not overridden by default paths if ($found === TRUE) { break; } } } } $class_name = $prefix . $class; // Is the class name valid? if (!class_exists($class_name, FALSE)) { log_message('error', 'Non-existent class: ' . $class_name); show_error('Non-existent class: ' . $class_name); } // Set the variable name we will assign the class to // Was a custom class name supplied? If so we'll use it if (empty($object_name)) { $object_name = strtolower($class); if (isset($this->_ci_varmap[$object_name])) { $object_name = $this->_ci_varmap[$object_name]; } } // Don't overwrite existing properties $CI =& get_instance(); if (isset($CI->$object_name)) { if ($CI->$object_name instanceof $class_name) { log_message('debug', $class_name . " has already been instantiated as '" . $object_name . "'. Second attempt aborted."); return; } show_error("Resource '" . $object_name . "' already exists and is not a " . $class_name . " instance."); } // Save the class name and object name $this->_ci_classes[$object_name] = $class; // Instantiate the class $CI->$object_name = isset($config) ? new $class_name($config) : new $class_name(); } // -------------------------------------------------------------------- /** * Database Loader * * @param mixed $params Database configuration options * @param bool $return Whether to return the database object * @param bool $query_builder Whether to enable Query Builder * (overrides the configuration setting) * * @return object|bool Database object if $return is set to TRUE, * FALSE on failure, CI_Loader instance in any other case */ public function database($params = '', $return = FALSE, $query_builder = NULL) { // Grab the super object $CI =& get_instance(); // Do we even need to load the database class? if ($return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db) && !empty($CI->db->conn_id)) { return FALSE; } require_once(BASEPATH . 'database/DB.php'); if ($return === TRUE) { return DB($params, $query_builder); } // Initialize the db variable. Needed to prevent // reference errors with some configurations $CI->db = ''; // Load the DB class $CI->db =& DB($params, $query_builder); return $this; } // -------------------------------------------------------------------- /** * Model Loader * * Loads and instantiates models. * * @param string $model Model name * @param string $name An optional object name to assign to * @param bool $db_conn An optional database connection configuration to initialize * @return object */ public function model($model, $name = '', $db_conn = FALSE) { if (empty($model)) { return $this; } elseif (is_array($model)) { foreach ($model as $key => $value) { is_int($key) ? $this->model($value, '', $db_conn) : $this->model($key, $value, $db_conn); } return $this; } $path = ''; // Is the model in a sub-folder? If so, parse out the filename and path. if (($last_slash = strrpos($model, '/')) !== FALSE) { // The path is in front of the last slash $path = substr($model, 0, ++$last_slash); // And the model name behind it $model = substr($model, $last_slash); } if (empty($name)) { $name = $model; } if (in_array($name, $this->_ci_models, TRUE)) { return $this; } $CI =& get_instance(); if (isset($CI->$name)) { throw new RuntimeException('The model name you are loading is the name of a resource that is already being used: '.$name); } if ($db_conn !== FALSE && ! class_exists('CI_DB', FALSE)) { if ($db_conn === TRUE) { $db_conn = ''; } $this->database($db_conn, FALSE, TRUE); } // Note: All of the code under this condition used to be just: // // load_class('Model', 'core'); // // However, load_class() instantiates classes // to cache them for later use and that prevents // MY_Model from being an abstract class and is // sub-optimal otherwise anyway. if ( ! class_exists('CI_Model', FALSE)) { $app_path = APPPATH.'core'.DIRECTORY_SEPARATOR; if (file_exists($app_path.'Model.php')) { require_once($app_path.'Model.php'); if ( ! class_exists('CI_Model', FALSE)) { throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model"); } } elseif ( ! class_exists('CI_Model', FALSE)) { require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); } $class = config_item('subclass_prefix').'Model'; if (file_exists($app_path.$class.'.php')) { require_once($app_path.$class.'.php'); if ( ! class_exists($class, FALSE)) { throw new RuntimeException($app_path.$class.".php exists, but doesn't declare class ".$class); } } } $model = ucfirst($model); if ( ! class_exists($model, FALSE)) { foreach ($this->_ci_model_paths as $mod_path) { if ( ! file_exists($mod_path.'models/'.$path.$model.'.php')) { continue; } require_once($mod_path.'models/'.$path.$model.'.php'); if ( ! class_exists($model, FALSE)) { throw new RuntimeException($mod_path."models/".$path.$model.".php exists, but doesn't declare class ".$model); } break; } if ( ! class_exists($model, FALSE)) { throw new RuntimeException('Unable to locate the model you have specified: '.$model); } } elseif ( ! is_subclass_of($model, 'CI_Model')) { throw new RuntimeException("Class ".$model." already exists and doesn't extend CI_Model"); } $this->_ci_models[] = $name; $CI->$name = new $model(); return $this; } // -------------------------------------------------------------------- /** * Is Loaded * * A utility method to test if a class is in the self::$_ci_classes array. * * @used-by Mainly used by Form Helper function _get_validation_object(). * * @param string $class Class name to check for * @return string|bool Class object name if loaded or FALSE */ public function is_loaded($class) { return array_search(ucfirst($class), $this->_ci_classes, TRUE); } // -------------------------------------------------------------------- /** * Load the Database Utilities Class * * @param object $db Database object * @param bool $return Whether to return the DB Utilities class object or not * @return object */ public function dbutil($db = NULL, $return = FALSE) { $CI =& get_instance(); if ( ! is_object($db) OR ! ($db instanceof CI_DB)) { class_exists('CI_DB', FALSE) OR $this->database(); $db =& $CI->db; } require_once(BASEPATH.'database/DB_utility.php'); require_once(BASEPATH.'database/drivers/'.$db->dbdriver.'/'.$db->dbdriver.'_utility.php'); $class = 'CI_DB_'.$db->dbdriver.'_utility'; if ($return === TRUE) { return new $class($db); } $CI->dbutil = new $class($db); return $this; } // -------------------------------------------------------------------- /** * Load the Database Forge Class * * @param object $db Database object * @param bool $return Whether to return the DB Forge class object or not * @return object */ public function dbforge($db = NULL, $return = FALSE) { $CI =& get_instance(); if ( ! is_object($db) OR ! ($db instanceof CI_DB)) { class_exists('CI_DB', FALSE) OR $this->database(); $db =& $CI->db; } require_once(BASEPATH.'database/DB_forge.php'); require_once(BASEPATH.'database/drivers/'.$db->dbdriver.'/'.$db->dbdriver.'_forge.php'); if ( ! empty($db->subdriver)) { $driver_path = BASEPATH.'database/drivers/'.$db->dbdriver.'/subdrivers/'.$db->dbdriver.'_'.$db->subdriver.'_forge.php'; if (file_exists($driver_path)) { require_once($driver_path); $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; } } else { $class = 'CI_DB_'.$db->dbdriver.'_forge'; } if ($return === TRUE) { return new $class($db); } $CI->dbforge = new $class($db); return $this; } // -------------------------------------------------------------------- /** * View Loader * * Loads "view" files. * * @param string $view View name * @param array $vars An associative array of data * to be extracted for use in the view * @param bool $return Whether to return the view output * or leave it to the Output class * @return object|string */ public function view($view, $vars = array(), $return = FALSE) { return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_prepare_view_vars($vars), '_ci_return' => $return)); } // -------------------------------------------------------------------- /** * Internal CI Data Loader * * Used to load views and files. * * Variables are prefixed with _ci_ to avoid symbol collision with * variables made available to view files. * * @used-by CI_Loader::view() * @used-by CI_Loader::file() * @param array $_ci_data Data to load * @return object */ protected function _ci_load($_ci_data) { // Set the default data variables foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val) { $$_ci_val = isset($_ci_data[$_ci_val]) ? $_ci_data[$_ci_val] : FALSE; } $file_exists = FALSE; // Set the path to the requested file if (is_string($_ci_path) && $_ci_path !== '') { $_ci_x = explode('/', $_ci_path); $_ci_file = end($_ci_x); } else { $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; foreach ($this->_ci_view_paths as $_ci_view_file => $cascade) { if (file_exists($_ci_view_file.$_ci_file)) { $_ci_path = $_ci_view_file.$_ci_file; $file_exists = TRUE; break; } if ( ! $cascade) { break; } } } if ( ! $file_exists && ! file_exists($_ci_path)) { show_error('Unable to load the requested file: '.$_ci_file); } // This allows anything loaded using $this->load (views, files, etc.) // to become accessible from within the Controller and Model functions. $_ci_CI =& get_instance(); foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) { if ( ! isset($this->$_ci_key)) { $this->$_ci_key =& $_ci_CI->$_ci_key; } } /* * Extract and cache variables * * You can either set variables using the dedicated $this->load->vars() * function or via the second parameter of this function. We'll merge * the two types and cache them so that views that are embedded within * other views can have access to these variables. */ empty($_ci_vars) OR $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars); extract($this->_ci_cached_vars); /* * Buffer the output * * We buffer the output for two reasons: * 1. Speed. You get a significant speed boost. * 2. So that the final rendered template can be post-processed by * the output class. Why do we need post processing? For one thing, * in order to show the elapsed page load time. Unless we can * intercept the content right before it's sent to the browser and * then stop the timer it won't be accurate. */ ob_start(); // If the PHP installation does not support short tags we'll // do a little string replacement, changing the short tags // to standard PHP echo statements. if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) { echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); } else { include($_ci_path); // include() vs include_once() allows for multiple views with the same name } log_message('info', 'File loaded: '.$_ci_path); // Return the file data if requested if ($_ci_return === TRUE) { $buffer = ob_get_contents(); @ob_end_clean(); return $buffer; } /* * Flush the buffer... or buff the flusher? * * In order to permit views to be nested within * other views, we need to flush the content back out whenever * we are beyond the first level of output buffering so that * it can be seen and included properly by the first included * template and any subsequent ones. Oy! */ if (ob_get_level() > $this->_ci_ob_level + 1) { ob_end_flush(); } else { $_ci_CI->output->append_output(ob_get_contents()); @ob_end_clean(); } return $this; } // -------------------------------------------------------------------- /** * Prepare variables for _ci_vars, to be later extract()-ed inside views * * Converts objects to associative arrays and filters-out internal * variable names (i.e. keys prefixed with '_ci_'). * * @param mixed $vars * @return array */ protected function _ci_prepare_view_vars($vars) { if (!is_array($vars)) { $vars = is_object($vars) ? get_object_vars($vars) : array(); } foreach (array_keys($vars) as $key) { if (strncmp($key, '_ci_', 4) === 0) { unset($vars[$key]); } } return $vars; } // -------------------------------------------------------------------- /** * Generic File Loader * * @param string $path File path * @param bool $return Whether to return the file output * @return object|string */ public function file($path, $return = FALSE) { return $this->_ci_load(array('_ci_path' => $path, '_ci_return' => $return)); } // -------------------------------------------------------------------- /** * Set Variables * * Once variables are set they become available within * the controller class and its "view" files. * * @param array|object|string $vars * An associative array or object containing values * to be set, or a value's name if string * @param string $val Value to set, only used if $vars is a string * @return object */ public function vars($vars, $val = '') { $vars = is_string($vars) ? array($vars => $val) : $this->_ci_prepare_view_vars($vars); foreach ($vars as $key => $val) { $this->_ci_cached_vars[$key] = $val; } return $this; } // -------------------------------------------------------------------- /** * Clear Cached Variables * * Clears the cached variables. * * @return CI_Loader */ public function clear_vars() { $this->_ci_cached_vars = array(); return $this; } // -------------------------------------------------------------------- /** * Get Variable * * Check if a variable is set and retrieve it. * * @param string $key Variable name * @return mixed The variable or NULL if not found */ public function get_var($key) { return isset($this->_ci_cached_vars[$key]) ? $this->_ci_cached_vars[$key] : NULL; } // -------------------------------------------------------------------- /** * Get Variables * * Retrieves all loaded variables. * * @return array */ public function get_vars() { return $this->_ci_cached_vars; } // -------------------------------------------------------------------- /** * Load Helpers * * An alias for the helper() method in case the developer has * written the plural form of it. * * @uses CI_Loader::helper() * @param string|string[] $helpers Helper name(s) * @return object */ public function helpers($helpers = array()) { return $this->helper($helpers); } // -------------------------------------------------------------------- /** * Helper Loader * * @param string|string[] $helpers Helper name(s) * @return object */ public function helper($helpers = array()) { is_array($helpers) OR $helpers = array($helpers); foreach ($helpers as &$helper) { $filename = basename($helper); $filepath = ($filename === $helper) ? '' : substr($helper, 0, strlen($helper) - strlen($filename)); $filename = strtolower(preg_replace('#(_helper)?(\.php)?$#i', '', $filename)) . '_helper'; $helper = $filepath . $filename; if (isset($this->_ci_helpers[$helper])) { continue; } // Is this a helper extension request? $ext_helper = config_item('subclass_prefix') . $filename; $ext_loaded = FALSE; foreach ($this->_ci_helper_paths as $path) { if (file_exists($path . 'helpers/' . $ext_helper . '.php')) { include_once($path . 'helpers/' . $ext_helper . '.php'); $ext_loaded = TRUE; } } // If we have loaded extensions - check if the base one is here if ($ext_loaded === TRUE) { $base_helper = BASEPATH . 'helpers/' . $helper . '.php'; if (!file_exists($base_helper)) { show_error('Unable to load the requested file: helpers/' . $helper . '.php'); } include_once($base_helper); $this->_ci_helpers[$helper] = TRUE; log_message('info', 'Helper loaded: ' . $helper); continue; } // No extensions found ... try loading regular helpers and/or overrides foreach ($this->_ci_helper_paths as $path) { if (file_exists($path . 'helpers/' . $helper . '.php')) { include_once($path . 'helpers/' . $helper . '.php'); $this->_ci_helpers[$helper] = TRUE; log_message('info', 'Helper loaded: ' . $helper); break; } } // unable to load the helper if (!isset($this->_ci_helpers[$helper])) { show_error('Unable to load the requested file: helpers/' . $helper . '.php'); } } return $this; } // -------------------------------------------------------------------- /** * Language Loader * * Loads language files. * * @param string|string[] $files List of language file names to load * @param string Language name * @return object */ public function language($files, $lang = '') { get_instance()->lang->load($files, $lang); return $this; } // -------------------------------------------------------------------- /** * Get Package Paths * * Return a list of all package paths. * * @param bool $include_base Whether to include BASEPATH (default: FALSE) * @return array */ public function get_package_paths($include_base = FALSE) { return ($include_base === TRUE) ? $this->_ci_library_paths : $this->_ci_model_paths; } // -------------------------------------------------------------------- /** * Remove Package Path * * Remove a path from the library, model, helper and/or config * path arrays if it exists. If no path is provided, the most recently * added path will be removed removed. * * @param string $path Path to remove * @return object */ public function remove_package_path($path = '') { $config =& $this->_ci_get_component('config'); if ($path === '') { array_shift($this->_ci_library_paths); array_shift($this->_ci_model_paths); array_shift($this->_ci_helper_paths); array_shift($this->_ci_view_paths); array_pop($config->_config_paths); } else { $path = rtrim($path, '/') . '/'; foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) { if (($key = array_search($path, $this->{$var})) !== FALSE) { unset($this->{$var}[$key]); } } if (isset($this->_ci_view_paths[$path . 'views/'])) { unset($this->_ci_view_paths[$path . 'views/']); } if (($key = array_search($path, $config->_config_paths)) !== FALSE) { unset($config->_config_paths[$key]); } } // make sure the application default paths are still in the array $this->_ci_library_paths = array_unique(array_merge($this->_ci_library_paths, array(APPPATH, BASEPATH))); $this->_ci_helper_paths = array_unique(array_merge($this->_ci_helper_paths, array(APPPATH, BASEPATH))); $this->_ci_model_paths = array_unique(array_merge($this->_ci_model_paths, array(APPPATH))); $this->_ci_view_paths = array_merge($this->_ci_view_paths, array(APPPATH . 'views/' => TRUE)); $config->_config_paths = array_unique(array_merge($config->_config_paths, array(APPPATH))); return $this; } }
jimok82/CIOpenReview
htdocs/system/core/Loader.php
PHP
gpl-2.0
41,150
<!doctype html> <?php $mysqli = new mysqli("localhost", "oacfdcco_denise", "z@T8i0IRuD@t", "oacfdcco_joo1"); /* check connection */ if (mysqli_connect_error ()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } ?> <html> <head> <link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:400,600' rel='stylesheet' type='text/css' /> <style type="text/css"> body,li,ul,h1,h2,h3,h4,h5,h6,.site-title,.p { font-family: 'Source Sans Pro', sans-serif; } h2 { color: #849d2a; } </style> <title>Breakfast Thursday, September 4, 2014</title> </head> <body bgcolor="#FFFFFF"> <h2>Breakfast Thursday, September 4, 2014</h2> <?php // Meal Counts $query = "SELECT count(*) FROM mjitm_eb_registrants WHERE mjitm_eb_registrants.event_id=23"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->bind_result($breakfast1count); $stmt->fetch(); $stmt->close(); } $query = "SELECT COUNT(*) FROM `mjitm_eb_registrants` WHERE `event_id`=4"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->bind_result($conferencecount); $stmt->fetch(); $stmt->close(); } $query = "SELECT count(*) FROM mjitm_eb_field_values JOIN mjitm_eb_registrants ON mjitm_eb_registrants.id = mjitm_eb_field_values.registrant_id WHERE mjitm_eb_registrants.event_id=4 AND mjitm_eb_field_values.field_id=26 AND mjitm_eb_field_values.field_value='yes'"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->bind_result($guestcount); $stmt->fetch(); $stmt->close(); } $totalbreakfast1count = $breakfast1count + $conferencecount + $guestcount; echo "The total count for this meal is "; echo $totalbreakfast1count; echo ".<br/>This includes: <br/><br/><table width=250px><tr><td align=right>"; echo "Special attendees: </td><td>"; echo $breakfast1count; echo "</td></tr><tr><td align=right>Guests:</td><td>"; echo $guestcount; echo "</td></tr><tr><td align=right>Delegates:</td><td>"; echo $conferencecount; echo "</td></tr></table><br/><br/>"; ?> Shown below are the special dietary requirements. <h3>Delegates</h3> <table width="700px"> <tr> <td width="10%"><strong>First Name</strong></td> <td width="10%"><strong>Last Name</strong></td> <td width="50%"><strong>Dietary Requirements</strong></td> </tr> <?php $query = "SELECT mjitm_eb_registrants.first_name, mjitm_eb_registrants.last_name, mjitm_eb_field_values.field_value FROM mjitm_eb_registrants JOIN mjitm_eb_field_values ON mjitm_eb_registrants.id=mjitm_eb_field_values.registrant_id WHERE mjitm_eb_registrants.event_id=4 AND mjitm_eb_field_values.field_id=9 AND mjitm_eb_field_values.field_value != \"\""; if ($stmt = $mysqli->prepare($query)) { /* execute statement */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($firstname, $lastname, $dietaryreqs); /* fetch values */ while ($stmt->fetch()) { echo "<tr><td>"; echo $firstname; echo "</td><td>"; echo $lastname; echo "</td><td>"; echo $dietaryreqs; echo "</td></tr>"; } echo "</table>"; /* close statement */ $stmt->close(); } ?> <br/><br/> <h3>Guests</h3> <table width="700px"> <tr> <td width="10%"><strong>First Name</strong></td> <td width="10%"><strong>Last Name</strong></td> <td width="50%"><strong>Dietary Requirements</strong></td> </tr> <?php $query = "SELECT mjitm_eb_field_values.field_value FROM mjitm_eb_field_values JOIN mjitm_eb_registrants ON mjitm_eb_field_values.registrant_id = mjitm_eb_registrants.id WHERE mjitm_eb_registrants.event_id=4 AND ( mjitm_eb_field_values.field_id=17 OR mjitm_eb_field_values.field_id=27 OR mjitm_eb_field_values.field_id=28 ) AND mjitm_eb_field_values.field_value != \"\" ORDER BY mjitm_eb_field_values.registrant_id, mjitm_eb_field_values.field_id=17, mjitm_eb_field_values.field_id=27, mjitm_eb_field_values.field_id=28"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->bind_result($value); } /* fetch values */ while ($stmt->fetch()) { echo "<tr><td>"; echo $value; $stmt->fetch(); echo "</td><td>"; echo $value; $stmt->fetch(); echo "</td><td>"; echo $value; echo "</td></tr>"; } echo "</table>"; /* close statement */ $stmt->close(); ?> <br/><br/> <h3>Special Attendees</h3> <table width="700px"> <tr> <td width="10%"><strong>First Name</strong></td> <td width="10%"><strong>Last Name</strong></td> <td width="50%"><strong>Dietary Requirements</strong></td> </tr> <?php $query = "SELECT mjitm_eb_registrants.first_name, mjitm_eb_registrants.last_name, mjitm_eb_field_values.field_value FROM mjitm_eb_registrants JOIN mjitm_eb_field_values ON mjitm_eb_registrants.id=mjitm_eb_field_values.registrant_id WHERE mjitm_eb_registrants.event_id = 23 AND (mjitm_eb_field_values.field_id=9 AND mjitm_eb_field_values.field_value != \"\")"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->bind_result($firstname, $lastname, $dietaryreqs); } while ($stmt->fetch()) { echo "<tr><td>"; echo $firstname; $stmt->fetch(); echo "</td><td>"; echo $lastname; $stmt->fetch(); echo "</td><td>"; echo $dietaryreqs; echo "</td></tr>"; } echo "</table>"; $stmt->close(); // Close the database connection mysql_close(); ?> </body> </html>
LauraRey/oacfdc
reports/breakfast1.php
PHP
gpl-2.0
5,411
package jp.co.evangelion.nervhome.selector.gles; import jp.co.evangelion.nervhome.gles.C143b; import jp.co.evangelion.nervhome.gles.C145d; public class C059h { public static final String TAG = C059h.class.getSimpleName(); public static C143b MPa(float p1, float p2) { return C145d.MPa(0.82F * (p1 / p2), 0.82F); } }
SquallATF/MAGIHome
src/jp/co/evangelion/nervhome/selector/gles/C059h.java
Java
gpl-2.0
336
<?php if ( !defined( 'BPB_VERSION' ) ) exit; /** * Follow Check * Removed the Add Follow button if the user is blocking us. * @since 1.0 * @version 1.0 */ function bpb_follow_check( $follow_id, $follow ) { $leader_id = $follow->leader_id; //bp_displayed_user_id(); $follower_id = $follow->follower_id; //bp_loggedin_user_id(); $list = bpb_get_blocked_users_list_by_type( $leader_id, BPB_FOLLOW ); if ( in_array( $follower_id, (array) $list ) ) return -1; return $follow_id; } /** * Add Follow Action * Replicate the follows_action_add_follow() with a custom check * to prevent users from constructing new followship requests to users * who block them. Used since even though the button is not shown, you can still * construct a request though the URL. * @since 1.0 * @version 1.0 */ function bpb_follow_action_start() { global $bp; if ( !bp_is_current_component( $bp->follow->followers->slug ) || !bp_is_current_action( 'start' ) ) return false; if ( bp_displayed_user_id() == bp_loggedin_user_id() ) return false; $list = bpb_get_blocked_users_list_by_type( bp_displayed_user_id(), BPB_FOLLOW ); if ( in_array( bp_loggedin_user_id(), $list ) ) return false; check_admin_referer( 'start_following' ); if ( bp_follow_is_following( array( 'leader_id' => bp_displayed_user_id(), 'follower_id' => bp_loggedin_user_id() ) ) ) bp_core_add_message( sprintf( __( 'You are already following %s.', 'bp-follow' ), bp_get_displayed_user_fullname() ), 'error' ); else { if ( !bp_follow_start_following( array( 'leader_id' => bp_displayed_user_id(), 'follower_id' => bp_loggedin_user_id() ) ) ) bp_core_add_message( sprintf( __( 'There was a problem when trying to follow %s, please try again.', 'bp-follow' ), bp_get_displayed_user_fullname() ), 'error' ); else bp_core_add_message( sprintf( __( 'You are now following %s.', 'bp-follow' ), bp_get_displayed_user_fullname() ) ); } // it's possible that wp_get_referer() returns false, so let's fallback to the displayed user's page $redirect = wp_get_referer() ? wp_get_referer() : bp_displayed_user_domain(); bp_core_redirect( $redirect ); return false; } ?>
olek1984/dremboard
wp-content/plugins/bp-member-block/includes/bpb-follows.php
PHP
gpl-2.0
2,208
#include "AppDelegate.cpp" #include "Options.cpp" #include "Utils.cpp" #include "Touchable.cpp" #include "Entity.cpp" #include "Button.cpp" #include "Text.cpp" #include "EntityManager.cpp" #include "BatchEntityManager.cpp" #include "Screens/Screen.cpp" #include "Menu.cpp" #include "Credits.cpp" #include "Loader.cpp" #include "Loading.cpp" #include "Languages.cpp" #include "Game.cpp" #include "Screens/Popup.cpp" #include "ScreenManager.cpp" #include "Texture.cpp" #include "ButtonReceiver.cpp" #include "Popup.cpp" #include "GetGold.cpp" #include "GetSilver.cpp" #include "GameBackground.cpp" #include "GameArea.cpp" #include "SplashScreen.cpp" #include "Garage.cpp" #include "Properties.cpp" #include "Cloud.cpp" #include "InAppPurchasesList.cpp" #include "InAppPurchaseEventHandler.cpp" #include "SpriteBatch.cpp" #include "platform/android/jni/JniHelper.h" #include <jni.h> #include <platform/CCPlatformConfig.h> #include <android/log.h> #define LOG_TAG "main" #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) using namespace cocos2d; extern "C" { jint JNI_OnLoad(JavaVM *vm, void *reserved) { JniHelper::setJavaVM(vm); return JNI_VERSION_1_4; } void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) { if (!CCDirector::sharedDirector()->getOpenGLView()) { CCEGLView *view = CCEGLView::sharedOpenGLView(); view->setFrameSize(w, h); AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } else { ccDrawInit(); ccGLInvalidateStateCache(); CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); CCTextureCache::reloadAllTextures(); CCNotificationCenter::sharedNotificationCenter()->postNotification(EVENT_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } } }
tooflya/beat-my-robo
proj.android/jni/hellocpp/main.cpp
C++
gpl-2.0
1,942
/* Copyright (c) 2015, 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 */ #include "data_type_checks.h" void TestDataTypeUtility:: test_mysql_type_decimal(Row_of_fields::iterator& field_it, std::string& expected) { // Not yet implemented } void TestDataTypeUtility:: test_mysql_type_newdecimal(Row_of_fields::iterator& field_it, std::string& expected) { // Not yet implemented } void TestDataTypeUtility:: test_mysql_type_tiny(Row_of_fields::iterator& field_it, int expected) { int val= static_cast<int>((*field_it).as_int8()); EXPECT_EQ(expected, val); } void TestDataTypeUtility:: test_mysql_type_short(Row_of_fields::iterator& field_it, int expected) { int val= static_cast<int>((*field_it).as_int16()); EXPECT_EQ(expected, val); } void TestDataTypeUtility:: test_mysql_type_long(Row_of_fields::iterator& field_it, long expected) { long val= static_cast<long>((*field_it).as_int32()); EXPECT_EQ(expected, val); } void TestDataTypeUtility:: test_mysql_type_float(Row_of_fields::iterator& field_it, float expected) { float val= (*field_it).as_float(); EXPECT_FLOAT_EQ(expected, val); } void TestDataTypeUtility:: test_mysql_type_double(Row_of_fields::iterator& field_it, double expected) { double val= (*field_it).as_double(); EXPECT_DOUBLE_EQ(expected, val); } void TestDataTypeUtility:: test_mysql_type_longlong(Row_of_fields::iterator& field_it, long long expected) { long long val= static_cast<long long>((*field_it).as_int64()); EXPECT_EQ(expected, val); } void TestDataTypeUtility:: test_mysql_type_medium_int(Row_of_fields::iterator& field_it, int expected) { int val= static_cast<int>((*field_it).as_int24()); EXPECT_EQ(expected, val); } void TestDataTypeUtility:: test_mysql_type_date(Row_of_fields::iterator& field_it, Date& expected) { Date val= (*field_it).as_date(); EXPECT_EQ(val.day, expected.day); EXPECT_EQ(val.month, expected.month); EXPECT_EQ(val.year, expected.year); } void TestDataTypeUtility:: test_mysql_type_newdate(Row_of_fields::iterator& field_it, std::string& expected) { // Not yet implemented } void TestDataTypeUtility:: test_mysql_type_time(Row_of_fields::iterator& field_it, Time& expected) { Time val= (*field_it).as_time(); EXPECT_EQ(val.hour, expected.hour); EXPECT_EQ(val.min, expected.min); EXPECT_EQ(val.sec, expected.sec); } void TestDataTypeUtility:: test_mysql_type_datetime(Row_of_fields::iterator& field_it, Date_time& expected) { Date_time val= (*field_it).as_date_time(); EXPECT_EQ(val.day, expected.day); EXPECT_EQ(val.month, expected.month); EXPECT_EQ(val.year, expected.year); EXPECT_EQ(val.hour, expected.hour); EXPECT_EQ(val.min, expected.min); EXPECT_EQ(val.sec, expected.sec); } void TestDataTypeUtility:: test_mysql_type_year(Row_of_fields::iterator& field_it, long expected) { long val= (*field_it).as_year(); EXPECT_EQ(expected, val); } void TestDataTypeUtility:: test_mysql_type_varchar(Row_of_fields::iterator& field_it, std::string& expected) { std::string val; converter.to(val, *field_it); EXPECT_STREQ(expected.c_str(), val.c_str()); } void TestDataTypeUtility:: test_mysql_type_bit(Row_of_fields::iterator& field_it, std::string& expected) { std::string val; converter.to(val, *field_it); EXPECT_STREQ(expected.c_str(), val.c_str()); } void TestDataTypeUtility:: test_mysql_type_enum(Row_of_fields::iterator& field_it, std::string& expected) { std::string val; converter.to(val, *field_it); EXPECT_STREQ(expected.c_str(), val.c_str()); } void TestDataTypeUtility:: test_mysql_type_set(Row_of_fields::iterator& field_it, std::string& expected) { std::string val; converter.to(val, *field_it); EXPECT_STREQ(expected.c_str(), val.c_str()); } void TestDataTypeUtility:: test_mysql_type_tiny_blob(Row_of_fields::iterator& field_it, std::string& expected) { std::string val; converter.to(val, *field_it); EXPECT_STREQ(expected.c_str(), val.c_str()); } void TestDataTypeUtility:: test_mysql_type_medium_blob(Row_of_fields::iterator& field_it, std::string& expected) { std::string val; converter.to(val, *field_it); EXPECT_STREQ(expected.c_str(), val.c_str()); } void TestDataTypeUtility:: test_mysql_type_long_blob(Row_of_fields::iterator& field_it, std::string& expected) { std::string val; converter.to(val, *field_it); EXPECT_STREQ(expected.c_str(), val.c_str()); } void TestDataTypeUtility:: test_mysql_type_blob(Row_of_fields::iterator& field_it, std::string& expected) { std::string val; converter.to(val, *field_it); EXPECT_STREQ(expected.c_str(), val.c_str()); } void TestDataTypeUtility:: test_mysql_type_var_string(Row_of_fields::iterator& field_it, std::string& expected) { std::string val; converter.to(val, *field_it); EXPECT_STREQ(expected.c_str(), val.c_str()); } void TestDataTypeUtility:: test_mysql_type_string(Row_of_fields::iterator& field_it, std::string& expected) { std::string val; converter.to(val, *field_it); EXPECT_STREQ(expected.c_str(), val.c_str()); } void TestDataTypeUtility:: test_mysql_type_json(Row_of_fields::iterator& field_it, std::string& expected) { // Not yet implemented }
bullsoft/mysql-binlog-events
tests/data_type_checks.cpp
C++
gpl-2.0
6,368
/** * MLV Sound addon module */ /* * Copyright (C) 2013 Magic Lantern Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 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. */ #include <module.h> #include <dryos.h> #include <menu.h> #include <config.h> #include <bmp.h> #include <beep.h> #include <propvalues.h> #include <raw.h> #include "../trace/trace.h" #include "../mlv_rec/mlv.h" #define MLV_SND_BUFFERS 4 static uint32_t trace_ctx = TRACE_ERROR; static CONFIG_INT("mlv.snd.enabled", mlv_snd_enabled, 0); static CONFIG_INT("mlv.snd.mlv_snd_enable_tracing", mlv_snd_enable_tracing, 0); int mlv_snd_is_enabled() { return mlv_snd_enabled; } extern int StartASIFDMAADC(void *, uint32_t, void *, uint32_t, void (*)(), uint32_t); extern int SetNextASIFADCBuffer(void *, uint32_t); extern WEAK_FUNC(ret_0) int PowerAudioOutput(); extern WEAK_FUNC(ret_0) void audio_configure(int); extern WEAK_FUNC(ret_0) int SetAudioVolumeOut(uint32_t); extern WEAK_FUNC(ret_0) int SoundDevActiveIn(uint32_t); extern WEAK_FUNC(ret_0) int SoundDevShutDownIn(); extern void SetSamplingRate(int sample_rate, int channels); extern uint64_t get_us_clock_value(); extern void mlv_rec_get_slot_info(int32_t slot, uint32_t *size, void **address); extern int32_t mlv_rec_get_free_slot(); extern void mlv_rec_release_slot(int32_t slot, uint32_t write); extern void mlv_rec_set_rel_timestamp(mlv_hdr_t *hdr, uint64_t timestamp); extern void mlv_rec_queue_block(mlv_hdr_t *hdr); static volatile int32_t mlv_snd_rec_active = 0; static struct msg_queue * volatile mlv_snd_buffers_empty = NULL; static struct msg_queue * volatile mlv_snd_buffers_done = NULL; static volatile uint32_t mlv_snd_in_buffers = 64; static volatile uint32_t mlv_snd_frame_number = 0; static volatile uint32_t mlv_snd_in_buffer_size = 0; static uint32_t mlv_snd_rates[] = { 48000, 44100, 22050, 11025, 8000 }; #define MLV_SND_RATE_TEXT "48kHz", "44.1kHz", "22kHz", "11kHz", "8kHz" static uint32_t mlv_snd_rate_sel = 0; static uint32_t mlv_snd_in_sample_rate = 0; static uint32_t mlv_snd_in_channels = 2; static uint32_t mlv_snd_in_bits_per_sample = 16; typedef struct { uint16_t *data; uint32_t length; uint32_t frameNumber; uint64_t timestamp; /* these are filled when the ASIF buffer comes from a MLV frame slot */ void *mlv_slot_buffer; int32_t mlv_slot_id; int32_t mlv_slot_end; } audio_data_t; audio_data_t *mlv_snd_current_buffer = NULL; audio_data_t *mlv_snd_next_buffer = NULL; #define MLV_SND_STATE_IDLE 0 /* waiting for action, set by writer task upon exit */ #define MLV_SND_STATE_PREPARE 1 /* recording was started, set by mlv_snd_start() */ #define MLV_SND_STATE_READY 2 /* buffers etc are set up, set by mlv_snd_alloc_buffers() */ #define MLV_SND_STATE_SOUND_RUNNING 3 /* ASIF sound recording was started, set by mlv_snd_vsync() */ #define MLV_SND_STATE_SOUND_STOPPING 4 /* stop audio recording, set by mlv_snd_stop() */ #define MLV_SND_STATE_SOUND_STOP_ASIF 5 /* waiting for ASIF to process its last buffer, set by mlv_snd_asif_in_cbr() */ #define MLV_SND_STATE_SOUND_STOP_TASK 6 /* waiting for thread to stop, set by mlv_snd_asif_in_cbr() */ #define MLV_SND_STATE_SOUND_STOPPED 7 /* all threads and stuff is stopped, finish cleanup, set by task */ static uint32_t mlv_snd_state = MLV_SND_STATE_IDLE; static void mlv_snd_asif_in_cbr() { /* the next buffer is now being filled, so update timestamp. do this first to be closer to real start. */ if(mlv_snd_next_buffer) { mlv_snd_next_buffer->timestamp = get_us_clock_value(); } /* and pass the filled buffer into done queue */ if(mlv_snd_current_buffer) { mlv_snd_current_buffer->frameNumber = mlv_snd_frame_number; mlv_snd_frame_number++; msg_queue_post(mlv_snd_buffers_done, (uint32_t) mlv_snd_current_buffer); } /* the "next" buffer is the current one being filled */ mlv_snd_current_buffer = mlv_snd_next_buffer; mlv_snd_next_buffer = NULL; switch(mlv_snd_state) { case MLV_SND_STATE_SOUND_RUNNING: { uint32_t count = 0; if(msg_queue_count(mlv_snd_buffers_empty, &count)) { trace_write(trace_ctx, "mlv_snd_asif_in_cbr: msg_queue_count failed"); mlv_snd_state = MLV_SND_STATE_SOUND_STOP_ASIF; return; } if(count < 1) { trace_write(trace_ctx, "mlv_snd_asif_in_cbr: no free buffers available"); mlv_snd_state = MLV_SND_STATE_SOUND_STOP_ASIF; return; } /* get the new "next" and queue */ if(msg_queue_receive(mlv_snd_buffers_empty, &mlv_snd_next_buffer, 10)) { trace_write(trace_ctx, "mlv_snd_asif_in_cbr: msg_queue_receive(mlv_snd_buffers_empty, ) failed"); mlv_snd_state = MLV_SND_STATE_SOUND_STOP_ASIF; return; } trace_write(trace_ctx, "mlv_snd_asif_in_cbr: queueing buffer in slot %d", mlv_snd_next_buffer->mlv_slot_id); SetNextASIFADCBuffer(mlv_snd_next_buffer->data, mlv_snd_next_buffer->length); break; } case MLV_SND_STATE_SOUND_STOPPING: trace_write(trace_ctx, "mlv_snd_asif_in_cbr: stopping 1"); mlv_snd_state = MLV_SND_STATE_SOUND_STOP_ASIF; break; case MLV_SND_STATE_SOUND_STOP_ASIF: trace_write(trace_ctx, "mlv_snd_asif_in_cbr: stopping 2"); mlv_snd_state = MLV_SND_STATE_SOUND_STOP_TASK; break; default: break; } } static void mlv_snd_flush_entries(struct msg_queue *queue, uint32_t clear) { uint32_t msgs = 0; msg_queue_count(queue, &msgs); trace_write(trace_ctx, "mlv_snd_flush_entries: %d entries to free in queue", msgs); while(msgs > 0) { audio_data_t *entry = NULL; if(msg_queue_receive(queue, &entry, 10)) { trace_write(trace_ctx, "mlv_snd_flush_entries: msg_queue_receive(queue, ) failed"); return; } trace_write(trace_ctx, "mlv_snd_flush_entries: entry is MLV slot"); mlv_audf_hdr_t *hdr = (mlv_audf_hdr_t *)entry->mlv_slot_buffer; if(clear) { trace_write(trace_ctx, "mlv_snd_flush_entries: NULL slot %d entry", entry->mlv_slot_id); mlv_set_type((mlv_hdr_t *)hdr, "NULL"); } else { trace_write(trace_ctx, "mlv_snd_flush_entries: data %d entry for frame #%d", entry->mlv_slot_id, entry->frameNumber); mlv_set_type((mlv_hdr_t *)hdr, "AUDF"); hdr->frameNumber = entry->frameNumber; mlv_rec_set_rel_timestamp((mlv_hdr_t*)hdr, entry->timestamp); } if(entry->mlv_slot_end) { trace_write(trace_ctx, "mlv_snd_flush_entries: entry is MLV slot %d (last buffer, so release)", entry->mlv_slot_id); mlv_rec_release_slot(entry->mlv_slot_id, 1); } free(entry); msg_queue_count(queue, &msgs); } trace_write(trace_ctx, "mlv_snd_flush_entries: done"); } static void mlv_snd_stop() { trace_write(trace_ctx, "mlv_snd_stop: stopping worker and audio"); mlv_snd_state = MLV_SND_STATE_SOUND_STOPPING; /* wait until audio and task stopped */ uint32_t loops = 100; while((mlv_snd_state != MLV_SND_STATE_SOUND_STOPPED) && (--loops > 0)) { msleep(20); } if(mlv_snd_state != MLV_SND_STATE_SOUND_STOPPED) { bmp_printf(FONT(FONT_MED, COLOR_RED, COLOR_BLACK), 10, 130, "audio failed to stop, state %d", mlv_snd_state); trace_write(trace_ctx, "mlv_snd_stop: failed to stop audio (state %d)", mlv_snd_state); beep(); } /* some models may need this */ SoundDevShutDownIn(); audio_configure(1); /* now flush the buffers */ trace_write(trace_ctx, "mlv_snd_stop: flush mlv_snd_buffers_done"); mlv_snd_flush_entries(mlv_snd_buffers_done, 0); trace_write(trace_ctx, "mlv_snd_stop: flush mlv_snd_buffers_empty"); mlv_snd_flush_entries(mlv_snd_buffers_empty, 1); mlv_snd_state = MLV_SND_STATE_IDLE; } static void mlv_snd_queue_slot() { void *address = NULL; uint32_t queued = 0; uint32_t size = 0; uint32_t used = 0; uint32_t hdr_size = 0x100; uint32_t block_size = hdr_size + mlv_snd_in_buffer_size; int32_t slot = mlv_rec_get_free_slot(); trace_write(trace_ctx, "mlv_snd_queue_slot: free slot %d", slot); /* get buffer memory address and available size */ mlv_rec_get_slot_info(slot, &size, &address); if(!address) { trace_write(trace_ctx, "mlv_snd_queue_slot: failed to get address"); return; } /* make sure that there is still place for a NULL block */ while((used + block_size + sizeof(mlv_hdr_t) < size) && (queued < 128)) { /* setup AUDF header for that block */ mlv_audf_hdr_t *hdr = (mlv_audf_hdr_t *)((uint32_t)address + used); trace_write(trace_ctx, "mlv_snd_queue_slot: used:%d / %d, block_size:%d, address: 0x%08X", used, size, block_size, hdr); used += block_size; mlv_set_type((mlv_hdr_t *)hdr, "NULL"); hdr->blockSize = block_size; hdr->frameNumber = 0xFFFFFFFF; hdr->frameSpace = hdr_size - sizeof(mlv_audf_hdr_t); hdr->timestamp = 0xFFFFFFFFFFFFFFFF; /* store information about the buffer in the according queue entry */ audio_data_t *entry = malloc(sizeof(audio_data_t)); /* data is right after the header */ entry->data = (void*)((uint32_t)hdr + hdr_size); entry->length = mlv_snd_in_buffer_size; entry->timestamp = 0; /* refer to the slot we are adding */ entry->mlv_slot_buffer = hdr; entry->mlv_slot_id = slot; entry->mlv_slot_end = 0; /* check if this was the last frame and set end flag if so */ if((used + block_size + sizeof(mlv_hdr_t) >= size) || (queued >= 128)) { /* this tells the writer task that the buffer is filled with that entry being done and can be committed */ entry->mlv_slot_end = 1; } msg_queue_post(mlv_snd_buffers_empty, (uint32_t) entry); queued++; } /* now add a trailing NULL block */ mlv_hdr_t *hdr = (mlv_hdr_t *)((uint32_t)address + used); mlv_set_type((mlv_hdr_t *)hdr, "NULL"); hdr->blockSize = size - used; hdr->timestamp = 0xFFFFFFFFFFFFFFFF; } static void mlv_snd_prepare_audio() { mlv_snd_frame_number = 0; mlv_snd_in_sample_rate = mlv_snd_rates[mlv_snd_rate_sel]; /* some models may need this */ SoundDevActiveIn(0); /* set up audio output according to configuration */ SetSamplingRate(mlv_snd_in_sample_rate, 0); /* set 16 bit per sample, stereo. not nice, should be done through SetAudioChannels() (0xFF10EFF4 on 5D3) */ MEM(0xC092011C) = 6; } static void mlv_snd_alloc_buffers() { /* calculate buffer size */ int fps = 5; mlv_snd_in_buffer_size = (mlv_snd_in_sample_rate * (mlv_snd_in_bits_per_sample / 8) * mlv_snd_in_channels) / fps; trace_write(trace_ctx, "mlv_snd_alloc_buffers: mlv_snd_in_buffer_size = %d", mlv_snd_in_buffer_size); mlv_snd_queue_slot(); mlv_snd_queue_slot(); /* now everything is ready to fire - real output activation happens as soon mlv_snd_running is set to 1 and mlv_snd_vsync() gets called */ mlv_snd_state = MLV_SND_STATE_READY; } static void mlv_snd_writer(int unused) { uint32_t done = 0; TASK_LOOP { audio_data_t *buffer = NULL; if(done) { break; } switch(mlv_snd_state) { case MLV_SND_STATE_SOUND_STOP_TASK: trace_write(trace_ctx, " --> WRITER: exiting"); done = 1; break; case MLV_SND_STATE_SOUND_RUNNING: /* receive write job from dispatcher */ if(msg_queue_receive(mlv_snd_buffers_done, &buffer, 500)) { static uint32_t timeouts = 0; trace_write(trace_ctx, " --> WRITER: message timed out %d times now", ++timeouts); break; } /* this must never happen */ if(!buffer) { static uint32_t timeouts = 0; trace_write(trace_ctx, " --> WRITER: message NULL %d times now", ++timeouts); break; } /* the slot was for MLV video, handle it */ trace_write(trace_ctx, " --> WRITER: entry is MLV slot %d, setting frame #%d", buffer->mlv_slot_id, buffer->frameNumber); mlv_audf_hdr_t *hdr = (mlv_audf_hdr_t *)buffer->mlv_slot_buffer; mlv_set_type((mlv_hdr_t *)hdr, "AUDF"); /* fill recording information */ hdr->frameNumber = buffer->frameNumber; mlv_rec_set_rel_timestamp((mlv_hdr_t*)hdr, buffer->timestamp); /* only queue for writing if the whole mlv_rec slot was filled */ if(buffer->mlv_slot_end) { trace_write(trace_ctx, " --> WRITER: entry is MLV slot %d (last buffer, so release)", buffer->mlv_slot_id); mlv_rec_release_slot(buffer->mlv_slot_id, 1); mlv_snd_queue_slot(); } free(buffer); break; default: msleep(100); break; } } mlv_snd_state = MLV_SND_STATE_SOUND_STOPPED; } static void mlv_snd_start() { if(mlv_snd_enable_tracing && (trace_ctx == TRACE_ERROR)) { char filename[] = "mlv_snd.txt"; trace_ctx = trace_start("mlv_snd", filename); trace_format(trace_ctx, TRACE_FMT_TIME_REL | TRACE_FMT_COMMENT, ' '); } trace_write(trace_ctx, "mlv_snd_start: starting"); mlv_snd_prepare_audio(); task_create("mlv_snd", 0x16, 0x1000, mlv_snd_writer, NULL); mlv_snd_state = MLV_SND_STATE_PREPARE; } static void mlv_snd_queue_wavi() { trace_write(trace_ctx, "mlv_snd_queue_wavi: queueing a WAVI block"); /* queue an WAVI block that contains information about the audio format */ mlv_wavi_hdr_t *hdr = malloc(sizeof(mlv_wavi_hdr_t)); mlv_set_type((mlv_hdr_t*)hdr, "WAVI"); hdr->blockSize = sizeof(mlv_wavi_hdr_t); mlv_rec_set_rel_timestamp((mlv_hdr_t*)hdr, get_us_clock_value()); /* this part is compatible to RIFF WAVE/fmt header */ hdr->format = 1; hdr->channels = mlv_snd_in_channels; hdr->samplingRate = mlv_snd_in_sample_rate; hdr->bytesPerSecond = mlv_snd_in_sample_rate * (mlv_snd_in_bits_per_sample / 8) * mlv_snd_in_channels; hdr->blockAlign = (mlv_snd_in_bits_per_sample / 8) * mlv_snd_in_channels; hdr->bitsPerSample = mlv_snd_in_bits_per_sample; mlv_rec_queue_block((mlv_hdr_t *)hdr); } /* public functions for raw_rec */ uint32_t raw_rec_cbr_starting() { if(!mlv_snd_enabled) { return 0; } if(mlv_snd_state == MLV_SND_STATE_IDLE) { trace_write(trace_ctx, "raw_rec_cbr_starting: starting mlv_snd"); mlv_snd_rec_active = 1; mlv_snd_start(); } return 0; } uint32_t raw_rec_cbr_started() { if(mlv_snd_state == MLV_SND_STATE_PREPARE) { trace_write(trace_ctx, "raw_rec_cbr_started: allocating buffers"); mlv_snd_alloc_buffers(); mlv_snd_queue_wavi(); } return 0; } uint32_t raw_rec_cbr_stopping() { if(mlv_snd_state != MLV_SND_STATE_IDLE) { trace_write(trace_ctx, "raw_rec_cbr_stopping: stopping"); mlv_snd_stop(); mlv_snd_rec_active = 0; } return 0; } uint32_t raw_rec_cbr_mlv_block(mlv_hdr_t *hdr) { if(!memcmp(hdr->blockType, "MLVI", 4)) { mlv_file_hdr_t *file_hdr = (mlv_file_hdr_t *)hdr; /* this block is filled on recording start and when the block gets updates on recording end */ file_hdr->audioClass = 1; /* 0=none, 1=WAV */ file_hdr->audioFrameCount = mlv_snd_frame_number; } return 0; } static void mlv_snd_trace_buf(char *caption, uint8_t *buffer, uint32_t length) { char *str = malloc(length * 2 + 1); for(uint32_t pos = 0; pos < length; pos++) { snprintf(&str[pos * 2], 3, "%02X", buffer[pos]); } trace_write(trace_ctx, "%s: %s", caption, str); free(str); } static unsigned int mlv_snd_vsync(unsigned int unused) { if(!mlv_snd_enabled) { return 0; } if(mlv_snd_state != MLV_SND_STATE_READY) { return 0; } /* in running mode, start audio recording here */ uint32_t msgs = 0; msg_queue_count(mlv_snd_buffers_empty, &msgs); if(msgs >= 2) { trace_write(trace_ctx, "mlv_snd_vsync: starting audio"); /* get two buffers and queue them to ASIF */ mlv_snd_current_buffer = NULL; mlv_snd_next_buffer = NULL; msg_queue_receive(mlv_snd_buffers_empty, &mlv_snd_current_buffer, 10); msg_queue_receive(mlv_snd_buffers_empty, &mlv_snd_next_buffer, 10); if(mlv_snd_current_buffer && mlv_snd_next_buffer) { mlv_snd_state = MLV_SND_STATE_SOUND_RUNNING; audio_configure(1); StartASIFDMAADC(mlv_snd_current_buffer->data, mlv_snd_current_buffer->length, mlv_snd_next_buffer->data, mlv_snd_next_buffer->length, mlv_snd_asif_in_cbr, 0); /* the current one will get filled right now */ mlv_snd_current_buffer->timestamp = get_us_clock_value(); trace_write(trace_ctx, "mlv_snd_vsync: starting audio DONE"); } else { trace_write(trace_ctx, "mlv_snd_vsync: msg_queue_receive(mlv_snd_buffers_empty, ...) failed, retry next time"); } } return 0; } static struct menu_entry mlv_snd_menu[] = { { .name = "MLV Sound", .priv = &mlv_snd_enabled, .max = 1, .help = "Enable sound recording for MLV.", .submenu_width = 710, .children = (struct menu_entry[]) { { .name = "Sampling rate", .priv = &mlv_snd_rate_sel, .min = 0, .max = COUNT(mlv_snd_rates)-1, .choices = CHOICES(MLV_SND_RATE_TEXT), .help = "Select your sampling rate.", }, { .name = "Trace output", .priv = &mlv_snd_enable_tracing, .min = 0, .max = 1, .help = "Enable log file tracing. Needs camera restart.", }, MENU_EOL, }, }, }; static unsigned int mlv_snd_init() { /* causes ERR70 ?! */ //if(mlv_snd_enable_tracing) //{ // char filename[] = "mlv_snd.txt"; // trace_ctx = trace_start("mlv_snd", filename); // trace_format(trace_ctx, TRACE_FMT_TIME_REL | TRACE_FMT_COMMENT, ' '); //} trace_write(trace_ctx, "mlv_snd_init: init queues"); mlv_snd_buffers_empty = (struct msg_queue *) msg_queue_create("mlv_snd_buffers_empty", 300); mlv_snd_buffers_done = (struct msg_queue *) msg_queue_create("mlv_snd_buffers_done", 300); menu_add("Audio", mlv_snd_menu, COUNT(mlv_snd_menu)); trace_write(trace_ctx, "mlv_snd_init: done"); return 0; } static unsigned int mlv_snd_deinit() { if(trace_ctx != TRACE_ERROR) { trace_stop(trace_ctx, 0); trace_ctx = TRACE_ERROR; } return 0; } MODULE_INFO_START() MODULE_INIT(mlv_snd_init) MODULE_DEINIT(mlv_snd_deinit) MODULE_INFO_END() MODULE_CBRS_START() MODULE_CBR(CBR_VSYNC, mlv_snd_vsync, 0) MODULE_CBRS_END() MODULE_CONFIGS_START() MODULE_CONFIG(mlv_snd_enabled) MODULE_CONFIG(mlv_snd_enable_tracing) MODULE_CONFIGS_END()
WilJoey/magic-lantern
modules/mlv_snd/mlv_snd.c
C
gpl-2.0
21,781
#include <string.h> void* memset(void* bufptr, int value, size_t size) { unsigned char* buf = (unsigned char*) bufptr; for ( size_t i = 0; i < size; i++ ) buf[i] = (unsigned char) value; return bufptr; }
hellbender-os/hellbender-os
libc/string/memset.c
C
gpl-2.0
215
<?php /** * Custom template tags for this theme. * * Eventually, some of the functionality here could be replaced by core features. * * @package onething */ if (!function_exists('onething_paging_nav')) : /** * Display navigation to next/previous set of posts when applicable. * * @return void */ function onething_paging_nav() { // Don't print empty markup if there's only one page. if ($GLOBALS['wp_query']->max_num_pages < 2) { return; } ?> <nav class="navigation paging-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Posts navigation', 'onething'); ?></h1> <div class="nav-links"> <?php if (get_next_posts_link()) : ?> <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', 'onething')); ?></div> <?php endif; ?> <?php if (get_previous_posts_link()) : ?> <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', 'onething')); ?></div> <?php endif; ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php } endif; if (!function_exists('onething_post_nav')) : /** * Display navigation to next/previous post when applicable. * * @return void */ function onething_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <div class="post-nav-box clear"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'onething'); ?></h1> <div class="nav-links"> <?php previous_post_link('<div class="nav-previous"><div class="nav-indicator">' . _x('Previous Post:', 'Previous post', 'onething') . '</div><h1>%link</h1></div>', '%title'); next_post_link('<div class="nav-next"><div class="nav-indicator">' . _x('Next Post:', 'Next post', 'onething') . '</div><h1>%link</h1></div>', '%title'); ?> </div><!-- .nav-links --> </div><!-- .post-nav-box --> </nav><!-- .navigation --> <?php } endif; if (!function_exists('onething_posted_on')) : /** * Prints HTML with meta information for the current post-date/time and author. */ function onething_posted_on() { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>'; if (get_the_time('U') !== get_the_modified_time('U')) { $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>'; } $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()) ); printf(__('<span class="byline">Written by %2$s</span><span class="posted-on">%1$s</span>', 'onething'), sprintf('<a href="%1$s" rel="bookmark">%2$s</a>', esc_url(get_permalink()), $time_string ), sprintf('<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_html(get_the_author()) ) ); } endif; /** * Returns true if a blog has more than 1 category. */ function onething_categorized_blog() { if (false === ( $all_the_cool_cats = get_transient('all_the_cool_cats') )) { // Create an array of all the categories that are attached to posts. $all_the_cool_cats = get_categories(array( 'fields' => 'ids', 'hide_empty' => 1, // We only need to know if there is more than one category. 'number' => 2, )); // Count the number of categories that are attached to the posts. $all_the_cool_cats = count($all_the_cool_cats); set_transient('all_the_cool_cats', $all_the_cool_cats); } if ($all_the_cool_cats > 1) { // This blog has more than 1 category so onething_categorized_blog should return true. return true; } else { // This blog has only 1 category so onething_categorized_blog should return false. return false; } } /** * Flush out the transients used in onething_categorized_blog. */ function onething_category_transient_flusher() { // Like, beat it. Dig? delete_transient('all_the_cool_cats'); } add_action('edit_category', 'onething_category_transient_flusher'); add_action('save_post', 'onething_category_transient_flusher'); /* * Social media icon menu as per http://justintadlock.com/archives/2013/08/14/social-nav-menus-part-2 */ function onething_social_menu() { if (has_nav_menu('social')) { wp_nav_menu( array( 'theme_location' => 'social', 'container' => 'div', 'container_id' => 'menu-social', 'container_class' => 'menu-social', 'menu_id' => 'menu-social-items', 'menu_class' => 'menu-items', 'depth' => 1, 'link_before' => '<span class="screen-reader-text">', 'link_after' => '</span>', 'fallback_cb' => '', ) ); } }
u843867/onething
wp-content/themes/onething/inc/template-tags.php
PHP
gpl-2.0
5,714
/* * Copyright 2005-2008 Sun Microsystems, Inc. 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. Sun designates this * particular file as subject to the "Classpath" exception as provided * by Sun in the LICENSE file that accompanied this code. * * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. * */ package org.jogamp.java3d; /** * Listener interface for monitoring errors in Shader Programs. * Compile and link errors are reported by the shader compiler, as are * runtime errors, such as those resulting from shader attributes that * aren't found or are of the wrong type. * * @see VirtualUniverse#addShaderErrorListener * * @since Java 3D 1.4 */ public interface ShaderErrorListener { /** * Invoked when an error occurs while compiling, linking or * executing a programmable shader. * * @param error object that contains the details of the error. */ public void errorOccurred(ShaderError error); }
gouessej/java3d-core
src/main/java/org/jogamp/java3d/ShaderErrorListener.java
Java
gpl-2.0
1,854
// Copyright (C) 2005 - 2022 Settlers Freaks (sf-team at siedler25.org) // // SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include "IngameWindow.h" #include "gameTypes/ServerType.h" #include <boost/signals2/connection.hpp> class iwDirectIPConnect : public IngameWindow { private: ServerType serverType_; boost::signals2::scoped_connection onErrorConnection_; public: iwDirectIPConnect(ServerType serverType); /// Connects to the given server or fills in the info if it has a password void Connect(const std::string& hostOrIp, unsigned short port, bool isIPv6, bool hasPwd); private: void SetStatus(const std::string& text, unsigned color); void Msg_EditChange(unsigned ctrl_id) override; void Msg_EditEnter(unsigned ctrl_id) override; void Msg_ButtonClick(unsigned ctrl_id) override; void Msg_OptionGroupChange(unsigned ctrl_id, unsigned selection) override; };
Return-To-The-Roots/s25client
libs/s25main/ingameWindows/iwDirectIPConnect.h
C
gpl-2.0
919
#ifdef __cplusplus extern"C"{ #endif #ifdef __cplusplus } #endif #include"compile_to_c.h" #ifdef __cplusplus extern"C"{ #endif T6 ZDW(ZM1*C,T0*a1){T6 R=0;T2 Zet=0;if((((C)->ZZb))!=((void*)(Zo))){Zet=(((ZA3*)(((C)->ZZb)))->ZWb);while(!((T6)((R)||((T6)((Z3)((Zet)<(ZGs(0)))))))) {R=((T6)(Z5v((T7*)((((T93*)(((((ZA3*)(((C)->ZZb)))->ZUb))[Zet]))->Zse)),a1)));Zet=(Z3)(((Zet))-(ZGs(1)));}}return R;}void ZEW(T0*a1,T2 a2){if(((((T89*)(ZPM))->Zaf))==(ZGs(1))){ZFW(((ZX6*)a1),a2);}}void ZGW(ZM1*C){if((((C)->Zfd))!=((void*)(Zo))){ZHW((ZX6*)(((C)->Zfd))); }}void ZIW(ZM1*C,T81 a1,T0*a2,T0*a3){(C->ZCb)=a1;(C->ZZb)=a2;(C->Zfd)=a3;}void ZJW(ZM1*C){if((((C)->Zfd))!=((void*)(Zo))){ZKW((ZX6*)(((C)->Zfd))); }}T6 ZLW(ZM1*C){T6 R=0;if((((C)->Zfd))!=((void*)(Zo))){R=((T6)(ZMW((ZX6*)(((C)->Zfd)))));}return R;}void ZNW(ZM1*C,T0*a1){if((((C)->Zfd))!=((void*)(Zo))){ ZOW((ZX6*)(((C)->Zfd)),a1);}}T0*ZPW(ZM1*C,T0*a1){T0*R=Zo;if((ZZy(((T79*)(((((T91*)a1))->ZZb)))))==(ZGs(1))){R=((T0*)(C));}else{{Zp8*n=((Zp8*)Zh(sizeof(*n))); *n=Z2l;ZzR(n,(T0*)C,a1);R=((T0*)n);}}return R;}T0*ZQW(ZM1*C,T0*a1){T0*R=Zo;if((((C)->Z4c))==((void*)(Zo))){(C->Z4c)=a1;if((((C)->Zfd))!=((void*)(Zo))){ (C->Zfd)=ZRW((ZX6*)(((C)->Zfd)),a1);}R=((T0*)(C));}else{{ZM1*n=((ZM1*)Zh(sizeof(*n)));*n=Zgd;ZIW(n,((C)->ZCb),((C)->ZZb),((C)->Zfd)); R=((T0*)n);}R=ZQW(((ZM1*)R),a1);}return R;}void ZSW(ZO1*C){ZTW(C);ZpG((((ZD8*)(((C)->Z2c)))->ZCb),((C)->ZFb),((C)->Z3c));}T0*ZUW(void){ if(ZrG==0){ZrG=1;{{ZG9*n=((ZG9*)Zh(sizeof(*n)));*n=Zfm;ZqG=((T0*)n);{ZG9*C1=n;ZhF(C1,ZGs(53));}}ZgF(((ZG9*)ZqG),ZtG);ZgF(((ZG9*)ZqG),ZuG); ZgF(((ZG9*)ZqG),ZvG);ZgF(((ZG9*)ZqG),ZwG);ZgF(((ZG9*)ZqG),ZxG);ZgF(((ZG9*)ZqG),ZyG);ZgF(((ZG9*)ZqG),ZzG);ZgF(((ZG9*)ZqG),ZAG);ZgF(((ZG9*)ZqG),(((void)((T27*)(ZVW()))),ZCG(ZDG))); ZgF(((ZG9*)ZqG),(((void)((T27*)(ZVW()))),ZCG(ZEG)));}}return ZqG;}T0*ZWW(ZO1*C,T0*a1,T0*a2,T0*a3){T0*R=Zo;T0*ZGG=Zo;T0*ZHG=Zo;R=a1;if(ZIG(a2)){ if(ZIG(a3)){ZHG=Z9G(a3);ZGG=Z9G(a2);if((ZHG)!=((void*)(ZGG))){if(ZJG(a2,a3)){R=ZKG(a1,a3);if((T6)(((R)!=((void*)(a1)))&&((T6)(!(ZfF((ZG9*)(ZUW()),(((ZD8*)(((C)->Z2c)))->Zse))))))){ {T81 Zow;Z5G((*(Zow=ZLG(a1),&Zow)));}{T0*b1=ZMG;Zmx((T7*)(Z2G),b1);}{T0*b1=ZGG;Zmx((T7*)(Z2G),b1);}{T0*b1=ZNG;Zmx((T7*)(Z2G),b1);}{T0*b1=ZHG; Zmx((T7*)(Z2G),b1);}{T0*b1=ZOG;Zmx((T7*)(Z2G),b1);}ZPG((T80*)(Z4G));}}else{((((T7*)((T7*)(Z2G))))->Zdc)=(ZGs(0));((((T82*)((T82*)(ZQG()))))->ZWb)=(ZGs(-1)); }}}}return R;}T6 ZXW(ZO1*C,T0*a1){T6 R=0;T0*ZUG=Zo;if((((C)->ZFb))==((void*)(Zo))){R=((T6)(1));}else{R=((T6)(ZVG((Za3*)(((C)->ZFb)),a1))); }if(R){if((((C)->Z3c))==((void*)(Zo))){R=((T6)(ZWG(((C)->Z1c),a1)));}else if(ZXG(((C)->Z1c))){if(ZYG(((C)->Z3c),a1)){R=((T6)((ZZG(((C)->Z3c),a1))!=((void*)(Zo)))); }else{R=((T6)(0));}}else{R=((T6)(ZWG(((C)->Z1c),a1)));if(R){if((((C)->Z3c))!=((void*)(Zo))){ZUG=(((ZZ3*)(Z_G((((ZQ7*)(((C)->Z3c)))->Z4c))))->Zof); if((Z3)(((Z3)(((((((Ze7*)(((((Z23*)ZUG))->Zae))))->ZWb)))+(ZGs(1))))>(ZGs(1)))){R=((T6)(ZYG(((C)->Z3c),ZUG)));}}}}}return R;}T0*ZYW(ZO1*C,T0*a1){ T0*R=Zo;R=Z1H((Za3*)(((C)->ZFb)),a1);if((R)==((void*)(Zo))){{T81 Zow;Z5G((*(Zow=Z2H((Za3*)(((C)->ZFb))),&Zow)));}{T0*b1=Z3H;Zmx((T7*)(Z2G),b1); }Z4H(a1);ZaG((T80*)(Z4G));}return R;}T0*ZZW(ZO1*C){T0*R=Zo;T0*ZdH=Zo;T0*ZiL=Zo;(C->Z1c)=ZaH(((C)->Z1c));ZbH((Za3*)(((C)->ZFb)));if((Z3)(((((T89*)(ZPM))->Zaf))>=(ZGs(2)))){ R=((T0*)(C));}else if((ZmK)==((void*)((((ZD8*)(((C)->Z2c)))->Zse)))){if((T6)(((T6)((ZqU(ZGH(((C)->Z1c))))&&((T6)(Z_W(((C)->Z1c))))))&&((T6)(Z_W(((((Za3*)(((C)->ZFb))))->Z2j)))))){ {ZZ4*n=((ZZ4*)Zh(sizeof(*n)));*n=Z5h;ZvL(n,(((ZD8*)(((C)->Z2c)))->ZCb));R=((T0*)n);}}else{ZdH=(((ZZ3*)((((ZQ7*)(((C)->Z3c)))->Znf)))->Zof); if((T6)(((T6)(((T6)((((Z3)(((((((Ze7*)(((((Z23*)ZdH))->Zae))))->ZWb)))+(ZGs(1))))==(ZGs(1)))&&((T6)(Z_W(((C)->Z1c))))))&&((T6)(Z_W(((((Za3*)(((C)->ZFb))))->Z2j))))))&&((T6)(((((T85*)(((((T87*)((((ZX4*)(Z0X(((C)->Z3c))))->Zvb))))->Zpc)))->Zse))==((void*)(Z9I)))))){ {ZZ4*n=((ZZ4*)Zh(sizeof(*n)));*n=Z5h;ZvL(n,(((ZD8*)(((C)->Z2c)))->ZCb));R=((T0*)n);}}else{R=((T0*)(C));}}}else if(ZXG(((C)->Z1c))){if(Z_W(((((Za3*)(((C)->ZFb))))->Z2j))){ R=Z1X(C,((C)->Z3c));}else{R=((T0*)(C));}}else if(((Z3)(((((((Ze7*)((((Z23*)((((ZZ3*)((((ZQ7*)(((C)->Z3c)))->Znf)))->Zof)))->Zae))))->ZWb)))+(ZGs(1))))==(ZGs(1))){ if((T6)((Z_W(((C)->Z1c)))&&((T6)(Z_W(((((Za3*)(((C)->ZFb))))->Z2j)))))){ZdH=(((ZZ3*)((((ZQ7*)(((C)->Z3c)))->Znf)))->Zof);ZiL=ZIL((ZZ3*)((((((Ze7*)(((((Z23*)ZdH))->Zae))))->ZUb))[ZGs(0)]),((C)->Z3c)); R=Z1X(C,ZiL);}else{R=((T0*)(C));}}else{R=((T0*)(C));}return R;}void Z2X(ZO1*C){T0*ZdH=Zo;if((((C)->Z3c))!=((void*)(Zo))){if((((C)->ZFb))!=((void*)(Zo))){ ZdH=(((ZZ3*)((((ZQ7*)(((C)->Z3c)))->Znf)))->Zof);if((Z3)(((Z3)(((((((Ze7*)(((((Z23*)ZdH))->Zae))))->ZWb)))+(ZGs(1))))>=(ZGs(1)))){{T81 Zow;ZeH((T43*)(ZSG),(*(Zow=Z3X(C),&Zow)),((C)->Z3c),ZdH);}}}}ZgH(((C)->Z1c));if((((C)->ZFb))!=((void*)(Zo))){ZhH((Za3*)(((C)->ZFb))); }}T0*Z1X(ZO1*C,T0*a1){T0*R=Zo;T0*Z4X=Zo;Z4X=a1;if(Zo!=(Z4X)){switch(((T0*)Z4X)->id){case 592:break;default:Z4X=Zo;}}if((T6)(((Z4X)!=((void*)(Zo)))&&((T6)(ZYG(Z4X,(((ZZ3*)(((((ZI7*)Z4X))->Znf)))->Zof)))))){ R=Z5X(((ZI7*)Z4X));}if((R)==((void*)(Zo))){R=((T0*)(C));}return R;}void ZTW(ZO1*C){if((ZiH(((C)->Z3c)))==((void*)(Zo))){{T81 Zow;Z5G((*(Zow=Z8G(((C)->Z3c)),&Zow))); }Z5G((((ZD8*)(((C)->Z2c)))->ZCb));Z6X(Z1G(29,"Feature found is a procedure."));}}T6 Z7X(ZO1*C,T0*a1){T6 R=0;R=((T6)(ZXW(C,a1)));if(R){ R=((T6)(!(ZmH(ZnH(Z8X(C))))));}return R;}void Z9X(ZO1*C,T0*a1,T0*a2){ZqH(((C)->Z1c),a1,a2);ZrH((Za3*)(((C)->ZFb)),a1,a2);}void ZaX(ZO1*C){ {T81 Zow;Z5G((*(Zow=Z3X(C),&Zow)));}{T0*b1=Z1G(63,"A separate target must be an argument of the enclosing routine.");Zmx((T7*)(Z2G),b1); }ZaG((T80*)(Z4G));}void ZbX(ZO1*C,T0*a1,T0*a2,T0*a3){(C->Z1c)=a1;(C->Z2c)=a2;(C->ZFb)=a3;}void ZcX(ZO1*C,T0*a1){T0*ZxH=Zo;ZxH=ZyH(((C)->Z1c),a1); if((ZxH)==((void*)(Zo))){{T81 Zow;Z5G((*(Zow=ZLG(((C)->Z1c)),&Zow)));}{T0*b1=Z1G(11,"Bad target.");Zmx((T7*)(Z2G),b1);}Z4H(a1);ZaG((T80*)(Z4G)); }(C->Z1c)=ZxH;}void Z6X(T0*a1){{T0*b1=a1;Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}void ZdX(ZO1*C){{T0*b1=ZAH;Zmx((T7*)(Z2G),b1);}{T81 Zow; Z5G((*(Zow=Z3X(C),&Zow)));}Z3G((T80*)(Z4G));}T2 ZeX(void){T2 R=0;return R;}void ZfX(ZO1*C,T3 a1){if((a1)==(((T3)'R'))){{T81 Zow;ZDH(((C)->Z3c),(*(Zow=Z3X(C),&Zow))); }}ZEH(((C)->Z1c),a1);ZEH(((((Za3*)(((C)->ZFb))))->Z2j),a1);}T0*Z8X(ZO1*C){T0*R=Zo;T0*ZFH=Zo;R=ZiH(((C)->Z3c));ZFH=R;if(Zo!=(ZFH)){switch(((T0*)ZFH)->id){ case 280:break;default:ZFH=Zo;}}if((ZFH)!=((void*)(Zo))){R=ZnH(ZGH(((((Za3*)(((C)->ZFb))))->Z2j)));}return R;}void ZgX(ZO1*C){T0*ZIH=Zo; T0*ZJH=Zo;T0*ZdH=Zo;if((((C)->Z3c))!=((void*)(Zo))){ZIH=ZGH(((C)->Z1c));ZJH=Z_G(ZIH);ZdH=((((ZZ3*)ZJH))->Zof);if((Z3)(((Z3)(((((((Ze7*)(((((Z23*)ZdH))->Zae))))->ZWb)))+(ZGs(1))))>(ZGs(1)))){ ZKH(((C)->Z1c),((C)->Z3c));}}ZLH(((C)->Z1c));ZMH((Za3*)(((C)->ZFb)));}T6 ZhX(ZO1*C){T6 R=0;R=((T6)(ZOH((Za3*)(((C)->ZFb)))));if(R){}else if(ZXG(((C)->Z1c))){if((ZPH())!=((void*)(((C)->Z3c)))){R=((T6)(ZQH(((C)->Z3c))));}}else{R=((T6)(ZRH(((C)->Z1c))));}return R;}T0*ZVW(void){ if(ZTH==0){ZTH=1;{{T27*n=((T27*)Zh(1));ZSH=((T0*)n);ZUH(ZVH);ZUH(ZWH);ZUH(ZXH);ZUH(ZYH);ZUH(ZZH);ZUH(Z_H);ZUH(Z0I);ZUH(Z1I);ZUH(Z2I); ZUH(Z3I);ZUH(Z4I);ZUH(Z5I);ZUH(Z6I);ZUH(Z7I);ZUH(Z8I);ZUH(Z9I);ZUH(ZaI);ZUH(ZbI);ZUH(ZcI);ZUH(ZdI);ZUH(ZeI);ZUH(ZfI);ZUH(ZgI);ZUH(ZhI); ZUH(ZiI);ZUH(ZjI);ZUH(ZkI);ZUH(ZlI);ZUH(ZmI);ZUH(ZnI);ZUH(ZoI);ZUH(ZpI);ZUH(ZqI);ZUH(ZrI);ZUH(ZsI);ZUH(ZtI);ZUH(ZuI);ZUH(ZvI);ZUH(ZwI); ZUH(ZxI);ZUH(ZyI);ZUH(ZzI);ZUH(ZAI);ZUH(ZBI);ZUH(ZCI);ZUH(ZDI);ZUH(ZEI);ZUH(ZFI);ZUH(ZGI);ZUH(ZHI);ZUH(ZII);ZUH(ZJI);ZUH(ZKI);ZUH(ZLI); ZUH(ZMI);ZUH(ZNI);ZUH(ZOI);ZUH(ZPI);ZUH(ZQI);ZUH(ZAG);ZUH(ZzG);ZUH(ZRI);ZUH(ZyG);ZUH(ZxG);ZUH(ZuG);ZUH(ZSI);ZUH(ZvG);ZUH(ZTI);ZUH(ZUI); ZUH(ZVI);ZUH(ZWI);ZUH(ZXI);ZUH(ZtG);ZUH(ZYI);ZUH(ZZI);ZUH(Z_I);ZUH(Z0J);ZUH(Z1J);ZUH(Z2J);ZUH(ZvH);ZUH(Z3J);ZUH(Z4J);ZUH(Z5J);ZUH(Z6J); ZUH(Z7J);ZUH(Z8J);ZUH(Z9J);ZUH(ZaJ);ZUH(ZbJ);ZUH(ZcJ);ZUH(ZdJ);ZUH(ZeJ);ZUH(ZfJ);ZUH(ZgJ);ZUH(ZhJ);ZUH(ZiJ);ZUH(ZjJ);ZUH(ZkJ);ZUH(ZlJ); ZUH(ZmJ);ZUH(ZnJ);ZUH(ZoJ);ZUH(ZpJ);ZUH(ZqJ);ZUH(ZrJ);ZUH(ZsJ);ZUH(ZtJ);ZUH(ZuJ);ZUH(ZvJ);ZUH(ZwJ);ZUH(ZxJ);ZUH(ZyJ);ZUH(ZzJ);ZUH(ZAJ); ZUH(ZBJ);ZUH(ZCJ);ZUH(ZDJ);ZUH(ZEJ);ZUH(ZFJ);ZUH(ZGJ);ZUH(ZHJ);ZUH(ZIJ);ZUH(ZJJ);ZUH(ZKJ);ZUH(ZLJ);ZUH(ZMJ);ZUH(ZNJ);ZUH(ZOJ);ZUH(ZwG); ZUH(ZPJ);ZUH(ZQJ);ZUH(ZRJ);ZUH(ZSJ);ZUH(ZTJ);ZUH(ZUJ);ZUH(ZVJ);ZUH(ZWJ);ZUH(ZXJ);ZUH(ZYJ);ZUH(ZZJ);ZUH(Z_J);ZUH(Z0K);ZUH(Z1K);ZUH(Z2K); ZUH(Z3K);ZUH(Z4K);ZUH(Z5K);ZUH(Z6K);ZUH(Z7K);ZUH(Z8K);ZUH(Z9K);ZUH(ZaK);ZUH(ZbK);ZUH(ZcK);ZUH(ZdK);ZUH(ZeK);ZUH(ZfK);ZUH(ZgK);ZUH(ZhK); ZUH(ZiK);ZUH(ZjK);ZUH(ZkK);ZUH(ZlK);ZUH(ZmK);ZUH(ZnK);ZUH(ZoK);ZUH(ZpK);ZUH(ZqK);ZUH(ZrK);ZUH(ZsK);ZUH(ZtK);ZUH(ZuK);ZUH(ZvK);ZUH(ZwK); ZUH(ZxK);ZUH(ZyK);ZUH(ZzK);ZUH(ZAK);ZUH(ZBK);ZUH(ZCK);ZUH(ZDK);ZUH(ZEK);ZUH(ZFK);ZUH(ZGK);ZUH(ZHK);ZUH(ZIK);ZUH(ZJK);ZUH(ZKK);ZUH(ZLK); ZUH(ZMK);ZUH(ZXH);ZUH(ZNK);ZUH(ZOK);ZUH(ZPK);ZUH(ZQK);ZUH(ZRK);ZUH(ZSK);ZUH(ZTK);ZUH(ZUK);ZUH(ZVK);ZUH(ZWK);ZUH(ZXK);ZUH(ZYK);ZUH(ZZK); }}}return ZSH;}T6 ZiX(ZO1*C){T6 R=0;if(Z0L(((C)->Z1c))){if((((C)->ZFb))!=((void*)(Zo))){R=((T6)(Z1L((Za3*)(((C)->ZFb)))));}else{R=((T6)(1)); }}return R;}T6 ZjX(ZO1*C,T0*a1){T6 R=0;R=((T6)(Z3L(ZGH(((C)->Z1c)))));R=((T6)((T6)((Z4L(((C)->Z1c),a1))||((T6)(R)))));if((a1)!=((void*)(Zo))){ if(Z5L(((Zz6*)a1),((C)->Z1c))){R=((T6)(1));}}else if((T6)((Z3L(ZGH(((C)->Z1c))))&&((T6)(!(ZXG(((C)->Z1c))))))){Z6L(((C)->Z1c));}return R;}void ZkX(ZO1*C,T0*a1){T6 Z8L=0;T0*Z9L=Zo;Z8L=((T6)(ZaL((Z84*)(ZkH),a1)));Z9L=ZnH(Z8X(C));if(ZbL(Z9L)){if(ZbL(a1)){ZcL(a1);ZdL((Z84*)(ZkH),((T3)'\050')); {ZO1*C1=C;ZeL((Z84*)(ZkH),(T0*)C1);}ZdL((Z84*)(ZkH),((T3)'\051'));}else{{ZO1*C1=C;ZeL((Z84*)(ZkH),(T0*)C1);}}}else{if(ZbL(a1)){{ZO1*C1=C; ZeL((Z84*)(ZkH),(T0*)C1);}}else{if(ZfL(a1)){ZdL((Z84*)(ZkH),((T3)'\046'));ZdL((Z84*)(ZkH),((T3)'\050'));{ZO1*C1=C;ZeL((Z84*)(ZkH),(T0*)C1); }ZdL((Z84*)(ZkH),((T3)'\051'));}else{{ZO1*C1=C;ZeL((Z84*)(ZkH),(T0*)C1);}}}}if(Z8L){ZgL((Z84*)(ZkH));}}void ZlX(ZO1*C,T0*a1){T0*ZiL=Zo; T0*ZJH=Zo;T0*ZjL=Zo;T0*ZkL=Zo;ZjL=ZGH(((C)->Z1c));if((ZjL)!=((void*)(Zo))){ZJH=Z_G(ZjL);if((ZJH)!=((void*)(Zo))){ZkL=((((ZZ3*)ZJH))->Zvb); ZiL=ZlL(((T87*)ZkL),ZJH,((C)->Z1c),((C)->Z2c),a1);}}if((ZiL)==((void*)(Zo))){Z5G((((ZD8*)(((C)->Z2c)))->ZCb));{T0*b1=Z1G(25,"Bad target for this call."); Zmx((T7*)(Z2G),b1);}Z4H(a1);ZaG((T80*)(Z4G));}(C->Z3c)=ZiL;}T2 ZmX(ZO1*C){T2 R=0;ZdX(C);return R;}T0*ZnX(ZO1*C,T0*a1){T0*R=Zo;T0*ZqL=Zo; T0*ZpL=Zo;T0*ZoX=Zo;T0*ZJH=Zo;T0*Z5O=Zo;if((((C)->Z4c))==((void*)(Zo))){(C->Z4c)=a1;ZcX(C,a1);ZqL=ZGH(((C)->Z1c));ZoX=ZnH(ZqL);if(Zo!=(ZoX)){ switch(((T0*)ZoX)->id){case 296:case 298:break;default:ZoX=Zo;}}if((ZoX)!=((void*)(Zo))){ZJH=ZpX(((Z1a*)ZoX));(C->Z3c)=ZqX(((ZZ3*)ZJH),ZoX,((C)->Z2c)); (C->ZFb)=ZrX((Za3*)(((C)->ZFb)));(C->ZFb)=ZYW(C,a1);}else{(C->ZFb)=ZYW(C,a1);ZpL=ZGH(((((Za3*)(((C)->ZFb))))->Z2j));(C->Z1c)=ZWW(C,((C)->Z1c),ZqL,ZpL); ZlX(C,a1);}if((ZoX)!=((void*)(Zo))){Z5O=(((ZD8*)(((C)->Z2c)))->Zse);if((Z5O)!=((void*)(ZQJ))){{T0*b1=Z1G(67,"You must use \"item\" to get the result of the execution of an agent."); Zmx((T7*)(Z2G),b1);}if((Z5O)==((void*)(ZaJ))){{T0*b1=Z1G(35," (Just replace \"call\" with \"item\".)");Zmx((T7*)(Z2G),b1);}}Z5G((((ZD8*)(((C)->Z2c)))->ZCb)); ZaG((T80*)(Z4G));}{Zt4*n=((Zt4*)Zh(sizeof(*n)));*n=Zxg;ZsX(n,(T0*)C);R=((T0*)n);}}else{ZSW(C);R=((T0*)(C));}}else{{ZO1*n=((ZO1*)Zh(sizeof(*n))); *n=Zhd;ZbX(n,((C)->Z1c),((C)->Z2c),((C)->ZFb));R=((T0*)n);}R=ZyH(R,a1);}return R;}T0*ZtX(ZO1*C){T0*R=Zo;T0*ZkL=Zo;T0*ZyL=Zo;T0*ZjL=Zo; ZkL=ZzL(((C)->Z1c));if((ZkL)!=((void*)(Zo))){ZyL=ZAL(((T87*)ZkL),((C)->Z2c));if((ZyL)!=((void*)(Zo))){ZjL=ZBL(ZyL);if((ZjL)!=((void*)(Zo))){ R=ZCL(ZjL);}}}return R;}void ZuX(ZO1*C){if((((C)->Z3c))!=((void*)(Zo))){ZEL(((C)->Z3c));}ZFL(((C)->Z1c));if((((C)->ZFb))!=((void*)(Zo))){ ZGL((Za3*)(((C)->ZFb)));}}void ZvX(ZO1*C){T0*ZJH=Zo;T0*ZiL=Zo;ZiL=((C)->Z3c);ZJH=((((ZQ7*)ZiL))->Znf);(C->Z3c)=ZIL((ZZ3*)((((((Ze7*)((((Z23*)(((((ZZ3*)ZJH))->Zof)))->Zae))))->ZUb))[ZGs(0)]),ZiL); }T81 Z3X(ZO1*C){T81 R={Zo,Zo,0};R=(((ZD8*)(((C)->Z2c)))->ZCb);return R;}void ZwX(T81 a1,T0*a2){Z5G(a1);{T0*b1=a2;Zmx((T7*)(Z2G),b1);} Z3G((T80*)(Z4G));}void ZxX(ZS1*C,T0*a1,T0*a2,T0*a3,T0*a4){(C->Zjd)=a1;(C->Zkd)=a2;(C->Zld)=a3;(C->Z1d)=a4;}void ZyX(ZS1*C){ZLH(((C)->Z1d)); }T6 ZzX(ZS1*C){T6 R=0;R=((T6)(ZRH(((C)->Z1d))));return R;}void ZAX(ZS1*C,T0*a1){T6 ZxR=0;ZxR=((T6)(Z4L(((C)->Z1d),a1)));}T0*ZBX(ZS1*C,T0*a1){ T0*R=Zo;T0*Z3V=Zo;if((((C)->Z4c))==((void*)(Zo))){(C->Z4c)=a1;Z3V=ZyH(((C)->Z1d),a1);if((Z3V)==((void*)(Zo))){{T81 Zow;ZwX((*(Zow=ZCX(C),&Zow)),Z1G(17,"Bad loop variant.")); }}else{(C->Z1d)=Z3V;if(!(ZzT(ZGH(((C)->Z1d))))){{T81 Zow;ZwX((*(Zow=ZLG(((C)->Z1d)),&Zow)),Z1G(38,"Expression of variant must be INTEGER.")); }}}if(((((T80*)(Z4G))->ZEg))==(ZGs(0))){R=((T0*)(C));}}else{{ZS1*n=((ZS1*)Zh(sizeof(*n)));*n=Zmd;ZxX(n,((C)->Zjd),((C)->Zkd),((C)->Zld),((C)->Z1d)); R=((T0*)n);}R=ZBX(((ZS1*)R),a1);}return R;}T81 ZCX(ZS1*C){T81 R={Zo,Zo,0};if((((C)->Zkd))!=((void*)(Zo))){R=(((Zr6*)(((C)->Zkd)))->ZCb); }else{{T81 Zow;R=(*(Zow=ZLG(((C)->Z1d)),&Zow));}}return R;}void ZDX(ZU1*C){ZEX(C);ZpG((((ZD8*)(((C)->Z2c)))->ZCb),Zo,((C)->Z3c));}T0*ZFX(ZU1*C,T0*a1){ T0*R=Zo;T0*Z4X=Zo;Z4X=a1;if(Zo!=(Z4X)){switch(((T0*)Z4X)->id){case 592:break;default:Z4X=Zo;}}if((T6)(((Z4X)!=((void*)(Zo)))&&((T6)(ZYG(Z4X,(((ZZ3*)(((((ZI7*)Z4X))->Znf)))->Zof)))))){ R=Z5X(((ZI7*)Z4X));}if((R)==((void*)(Zo))){R=((T0*)(C));}return R;}T6 ZGX(ZU1*C,T0*a1){T6 R=0;T0*ZUG=Zo;R=((T6)(1));if(R){if((((C)->Z3c))==((void*)(Zo))){ R=((T6)(ZWG(((C)->Z1c),a1)));}else if(ZXG(((C)->Z1c))){if(ZYG(((C)->Z3c),a1)){R=((T6)((ZZG(((C)->Z3c),a1))!=((void*)(Zo))));}else{R=((T6)(0)); }}else{R=((T6)(ZWG(((C)->Z1c),a1)));if(R){if((((C)->Z3c))!=((void*)(Zo))){ZUG=(((ZZ3*)(Z_G((((ZQ7*)(((C)->Z3c)))->Z4c))))->Zof);if((Z3)(((Z3)(((((((Ze7*)(((((Z23*)ZUG))->Zae))))->ZWb)))+(ZGs(1))))>(ZGs(1)))){ R=((T6)(ZYG(((C)->Z3c),ZUG)));}}}}}return R;}T0*ZHX(ZU1*C){T0*R=Zo;T0*ZIX=Zo;T0*ZJX=Zo;T0*ZdH=Zo;T0*ZKX=Zo;T0*ZqL=Zo;T81 ZjG={Zo,Zo,0}; T0*ZiL=Zo;(C->Z1c)=ZaH(((C)->Z1c));ZqL=ZnH(ZGH(((C)->Z1c)));ZIX=(((ZD8*)((((ZQ7*)(((C)->Z3c)))->Zpc)))->Zse);if((ZOJ)==((void*)(ZIX))){ if(ZqU(ZqL)){{ZZ4*n=((ZZ4*)Zh(sizeof(*n)));*n=Z5h;ZvL(n,(((ZD8*)(((C)->Z2c)))->ZCb));R=((T0*)n);}}else{{ZZ8*n=((ZZ8*)Zh(sizeof(*n))); *n=Zml;ZwL(n,(((ZD8*)(((C)->Z2c)))->ZCb));R=((T0*)n);}}if(!(Z_W(((C)->Z1c)))){{T0*b1=Z1G(114,"Must use \173""GENERAL\175"".is_expanded_type with such a target expression (keep in mind that the target is not evaluated)."); Zmx((T7*)(Z2G),b1);}{T81 Zow;Z5G((*(Zow=ZLG(((C)->Z1c)),&Zow)));}ZaG((T80*)(Z4G));}}else if((ZLJ)==((void*)(ZIX))){if(ZIG(ZqL)){{ZZ4*n=((ZZ4*)Zh(sizeof(*n))); *n=Z5h;ZvL(n,(((ZD8*)(((C)->Z2c)))->ZCb));R=((T0*)n);}}else{{ZZ8*n=((ZZ8*)Zh(sizeof(*n)));*n=Zml;ZwL(n,(((ZD8*)(((C)->Z2c)))->ZCb));R=((T0*)n); }}if(!(Z_W(((C)->Z1c)))){{T0*b1=Z1G(120,"Must use \173""GENERAL\175"".is_basic_expanded_type with such a target expression (keep in mind that the target is not evaluated)."); Zmx((T7*)(Z2G),b1);}{T81 Zow;Z5G((*(Zow=ZLG(((C)->Z1c)),&Zow)));}ZaG((T80*)(Z4G));}}else if((ZNJ)==((void*)(ZIX))){ZjG=(((ZD8*)(((C)->Z2c)))->ZCb); if(ZzT(ZqL)){{Zw1*n=((Zw1*)Zh(sizeof(*n)));*n=ZQl;ZMN(n,(T11)(ZGs(0)),ZjG);ZKX=((T0*)n);}{ZH2*n=((ZH2*)Zh(sizeof(*n)));*n=ZUd;ZLX(n,((C)->Z1c),ZjG,ZKX); R=((T0*)n);}R=ZaH(R);}else if((T6)((ZqT(ZqL))||((T6)(ZbU(ZqL))))){{ZC9*n=((ZC9*)Zh(sizeof(*n)));*n=Zdm;ZMX(n,ZjG,ZNX);R=((T0*)n);}{ZH2*n=((ZH2*)Zh(sizeof(*n))); *n=ZUd;ZLX(n,((C)->Z1c),ZjG,R);R=((T0*)n);}R=ZaH(R);}else if(ZmU(ZqL)){{ZZ8*n=((ZZ8*)Zh(sizeof(*n)));*n=Zml;ZwL(n,ZjG);R=((T0*)n);}{ZH2*n=((ZH2*)Zh(sizeof(*n))); *n=ZUd;ZLX(n,((C)->Z1c),ZjG,R);R=((T0*)n);}R=ZaH(R);}else if(ZET(ZqL)){{ZH4*n=((ZH4*)Zh(sizeof(*n)));*n=ZRg;ZOX(n,ZjG,((T3)'\000'));R=((T0*)n); }{ZH2*n=((ZH2*)Zh(sizeof(*n)));*n=ZUd;ZLX(n,((C)->Z1c),ZjG,R);R=((T0*)n);}R=ZaH(R);}else if(ZPX(ZqL)){{ZZ4*n=((ZZ4*)Zh(sizeof(*n)));*n=Z5h; ZvL(n,ZjG);R=((T0*)n);}}else if(ZsP(ZqL)){{ZZ4*n=((ZZ4*)Zh(sizeof(*n)));*n=Z5h;ZvL(n,ZjG);R=((T0*)n);}}else{R=((T0*)(C));}}else if((T6)(((ZfJ)==((void*)(ZIX)))&&((T6)(ZMR(ZqL))))){ ZJX=ZqL;if(Zo!=(ZJX)){switch(((T0*)ZJX)->id){case 304:case 306:break;default:ZJX=Zo;}}ZjG=(((ZD8*)(((C)->Z2c)))->ZCb);{Zw1*n=((Zw1*)Zh(sizeof(*n))); *n=ZQl;ZMN(n,(T11)(ZQX(ZJX)),ZjG);R=((T0*)n);}}if((R)!=((void*)(Zo))){}else if((Z3)(((((T89*)(ZPM))->Zaf))>=(ZGs(2)))){R=((T0*)(C));} else if(ZXG(((C)->Z1c))){R=ZRX(C,((C)->Z3c));}else if(Z4V(((C)->Z1c))){R=ZRX(C,((C)->Z3c));}else if(((Z3)(((((((Ze7*)((((Z23*)((((ZZ3*)((((ZQ7*)(((C)->Z3c)))->Znf)))->Zof)))->Zae))))->ZWb)))+(ZGs(1))))==(ZGs(1))){ if(Z_W(((C)->Z1c))){ZdH=(((ZZ3*)((((ZQ7*)(((C)->Z3c)))->Znf)))->Zof);ZiL=ZIL((ZZ3*)((((((Ze7*)(((((Z23*)ZdH))->Zae))))->ZUb))[ZGs(0)]),((C)->Z3c)); R=ZRX(C,ZiL);}else{R=((T0*)(C));}}else{R=((T0*)(C));}return R;}void ZSX(ZU1*C){T0*ZdH=Zo;if((((C)->Z3c))!=((void*)(Zo))){}ZgH(((C)->Z1c)); }T0*ZRX(ZU1*C,T0*a1){T0*R=Zo;T0*ZTX=Zo;R=ZFX(C,a1);if((R)==((void*)(C))){ZTX=a1;if(Zo!=(ZTX)){switch(((T0*)ZTX)->id){case 583:break;default: ZTX=Zo;}}if((ZTX)!=((void*)(Zo))){R=((((ZC7*)ZTX))->Zde);}}return R;}void ZEX(ZU1*C){if((ZiH(((C)->Z3c)))==((void*)(Zo))){{T81 Zow;Z5G((*(Zow=Z8G(((C)->Z3c)),&Zow))); }Z5G((((ZD8*)(((C)->Z2c)))->ZCb));ZUX(Z1G(29,"Feature found is a procedure."));}}void ZVX(ZU1*C){T0*ZOP=Zo;ZOP=(((ZD8*)(((C)->Z2c)))->Zse); if((ZOJ)==((void*)(ZOP))){if(ZqU(ZnH(ZGH(((C)->Z1c))))){ZdL((Z84*)(ZkH),((T3)'1'));}else{ZdL((Z84*)(ZkH),((T3)'0'));}}else if((ZLJ)==((void*)(ZOP))){ if(ZIG(ZGH(((C)->Z1c)))){ZdL((Z84*)(ZkH),((T3)'1'));}else{ZdL((Z84*)(ZkH),((T3)'0'));}}else{{ZU1*C1=C;ZeL((Z84*)(ZkH),(T0*)C1);}}}T6 ZWX(ZU1*C,T0*a1){ T6 R=0;R=((T6)(ZGX(C,a1)));if(R){R=((T6)(!(ZmH(ZnH(ZXX(C))))));}return R;}void ZYX(ZU1*C,T0*a1,T0*a2){ZqH(((C)->Z1c),a1,a2);}void ZZX(ZU1*C){ {T81 Zow;Z5G((*(Zow=Z_X(C),&Zow)));}{T0*b1=Z1G(63,"A separate target must be an argument of the enclosing routine.");Zmx((T7*)(Z2G),b1); }ZaG((T80*)(Z4G));}void Z0Y(ZU1*C,T0*a1,T0*a2){(C->Z1c)=a1;(C->Z2c)=a2;}void Z1Y(ZU1*C,T0*a1){T0*ZxH=Zo;ZxH=ZyH(((C)->Z1c),a1);if((ZxH)==((void*)(Zo))){ {T81 Zow;Z5G((*(Zow=ZLG(((C)->Z1c)),&Zow)));}{T0*b1=Z1G(11,"Bad target.");Zmx((T7*)(Z2G),b1);}Z4H(a1);ZaG((T80*)(Z4G));}(C->Z1c)=ZxH; }void ZUX(T0*a1){{T0*b1=a1;Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}void Z2Y(ZU1*C){{T0*b1=ZAH;Zmx((T7*)(Z2G),b1);}{T81 Zow;Z5G((*(Zow=Z_X(C),&Zow))); }Z3G((T80*)(Z4G));}T2 Z3Y(void){T2 R=0;return R;}void Z4Y(ZU1*C,T3 a1){if((a1)==(((T3)'R'))){{T81 Zow;ZDH(((C)->Z3c),(*(Zow=Z_X(C),&Zow))); }}ZEH(((C)->Z1c),a1);}T0*ZXX(ZU1*C){T0*R=Zo;R=ZiH(((C)->Z3c));return R;}void Z5Y(ZU1*C){T0*ZIH=Zo;T0*ZJH=Zo;T0*ZdH=Zo;if((((C)->Z3c))!=((void*)(Zo))){ ZIH=ZGH(((C)->Z1c));ZJH=Z_G(ZIH);ZdH=((((ZZ3*)ZJH))->Zof);if((Z3)(((Z3)(((((((Ze7*)(((((Z23*)ZdH))->Zae))))->ZWb)))+(ZGs(1))))>(ZGs(1)))){ ZKH(((C)->Z1c),((C)->Z3c));}}ZLH(((C)->Z1c));}T6 Z6Y(ZU1*C){T6 R=0;if(R){}else if(ZXG(((C)->Z1c))){if((ZPH())!=((void*)(((C)->Z3c)))){ R=((T6)(ZQH(((C)->Z3c))));}}else{R=((T6)(ZRH(((C)->Z1c))));}return R;}T6 Z7Y(ZU1*C){T6 R=0;if(Z0L(((C)->Z1c))){R=((T6)(1));}return R; }T6 Z8Y(ZU1*C,T0*a1){T6 R=0;R=((T6)(Z3L(ZGH(((C)->Z1c)))));R=((T6)((T6)((Z4L(((C)->Z1c),a1))||((T6)(R)))));if((a1)!=((void*)(Zo))){if(Z5L(((Zz6*)a1),((C)->Z1c))){ R=((T6)(1));}}else if((T6)((Z3L(ZGH(((C)->Z1c))))&&((T6)(!(ZXG(((C)->Z1c))))))){Z6L(((C)->Z1c));}return R;}T6 Z9Y(ZU1*C){T6 R=0;T0*ZiL=Zo; T0*ZdH=Zo;if(Z_W(((C)->Z1c))){if((Z3)(((((T43*)(ZSG))->ZQk))>=(ZGs(4)))){ZiL=((C)->Z3c);ZdH=(((ZZ3*)(((((ZQ7*)ZiL))->Znf)))->Zof);if(((Z3)(((((((Ze7*)(((((Z23*)ZdH))->Zae))))->ZWb)))+(ZGs(1))))==(ZGs(1))){ ZiL=ZIL((ZZ3*)((((((Ze7*)(((((Z23*)ZdH))->Zae))))->ZUb))[ZGs(0)]),ZiL);R=((T6)(ZaY(ZiL)));}}}return R;}void ZbY(ZU1*C,T0*a1){T6 Z8L=0; T0*Z9L=Zo;Z8L=((T6)(ZaL((Z84*)(ZkH),a1)));Z9L=ZnH(ZXX(C));if(ZbL(Z9L)){if(ZbL(a1)){ZcL(a1);ZdL((Z84*)(ZkH),((T3)'\050'));ZVX(C);ZdL((Z84*)(ZkH),((T3)'\051')); }else{ZVX(C);}}else{if(ZbL(a1)){ZVX(C);}else{if(ZfL(a1)){ZdL((Z84*)(ZkH),((T3)'\046'));ZdL((Z84*)(ZkH),((T3)'\050'));ZVX(C);ZdL((Z84*)(ZkH),((T3)'\051')); }else{ZVX(C);}}}if(Z8L){ZgL((Z84*)(ZkH));}}void ZcY(ZU1*C,T0*a1){T0*ZiL=Zo;T0*ZJH=Zo;T0*ZjL=Zo;T0*ZkL=Zo;ZjL=ZGH(((C)->Z1c));if((ZjL)!=((void*)(Zo))){ ZJH=Z_G(ZjL);if((ZJH)!=((void*)(Zo))){ZkL=((((ZZ3*)ZJH))->Zvb);ZiL=ZlL(((T87*)ZkL),ZJH,((C)->Z1c),((C)->Z2c),a1);}}if((ZiL)==((void*)(Zo))){ Z5G((((ZD8*)(((C)->Z2c)))->ZCb));{T0*b1=Z1G(25,"Bad target for this call.");Zmx((T7*)(Z2G),b1);}Z4H(a1);ZaG((T80*)(Z4G));}(C->Z3c)=ZiL; }T2 ZdY(ZU1*C){T2 R=0;T0*ZTX=Zo;ZTX=((C)->Z3c);if(Zo!=(ZTX)){switch(((T0*)ZTX)->id){case 583:break;default:ZTX=Zo;}}if((ZTX)==((void*)(Zo))){ Z2Y(C);}else{R=ZSU(((((ZC7*)ZTX))->Zde));}return R;}T0*ZeY(ZU1*C,T0*a1){T0*R=Zo;if((((C)->Z4c))==((void*)(Zo))){(C->Z4c)=a1;Z1Y(C,a1); ZcY(C,a1);R=((T0*)(C));ZDX(C);}else{{ZU1*n=((ZU1*)Zh(sizeof(*n)));*n=Znd;Z0Y(n,((C)->Z1c),((C)->Z2c));R=((T0*)n);}R=ZeY(((ZU1*)R),a1); }return R;}T0*ZfY(ZU1*C){T0*R=Zo;T0*ZkL=Zo;T0*ZyL=Zo;T0*ZjL=Zo;ZkL=ZzL(((C)->Z1c));if((ZkL)!=((void*)(Zo))){ZyL=ZAL(((T87*)ZkL),((C)->Z2c)); if((ZyL)!=((void*)(Zo))){ZjL=ZBL(ZyL);if((ZjL)!=((void*)(Zo))){R=ZCL(ZjL);}}}return R;}void ZgY(ZU1*C){if((((C)->Z3c))!=((void*)(Zo))){ ZEL(((C)->Z3c));}ZFL(((C)->Z1c));}void ZhY(ZU1*C){T0*ZJH=Zo;T0*ZiL=Zo;ZiL=((C)->Z3c);ZJH=((((ZQ7*)ZiL))->Znf);(C->Z3c)=ZIL((ZZ3*)((((((Ze7*)((((Z23*)(((((ZZ3*)ZJH))->Zof)))->Zae))))->ZUb))[ZGs(0)]),ZiL); }T81 Z_X(ZU1*C){T81 R={Zo,Zo,0};R=(((ZD8*)(((C)->Z2c)))->ZCb);return R;}T0*ZiY(ZW1*C,T0*a1){T0*R=Zo;{Zp8*n=((Zp8*)Zh(sizeof(*n)));*n=Z2l; ZzR(n,(T0*)C,a1);R=((T0*)n);}return R;}T0*ZjY(ZW1*C,T0*a1){T0*R=Zo;T0*ZiL=Zo;ZiL=ZPH();if((((C)->Z3c))==((void*)(Zo))){(C->Z3c)=ZiL;R=((T0*)(C)); }else if((((C)->Z3c))==((void*)(ZiL))){R=((T0*)(C));}else{{ZW1*n=((ZW1*)Zh(sizeof(*n)));*n=Zod;((((ZW1*)(n)))->ZCb)=(((C)->ZCb));R=((T0*)n); }R=ZjY(((ZW1*)R),a1);}return R;}void ZeV(Z_1*C,T0*a1){T0*ZiL=Zo;T0*ZkY=Zo;T0*ZJH=Zo;if((((C)->Zrd))==((void*)(Zo))){Z5G(((C)->ZCb));{T0*b1=Z1G(50,"Cannot create a class with an empty creation list."); Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}if((Z3)((Z8O((Zz8*)(((C)->Zrd))))>(ZGs(1)))){ZMT(a1,ZdV);Z5G(((C)->ZCb));{T0*b1=Z1G(106,"Expanded class must have no creation procedure, or only one creation procedure with no arguments (VTEC.2)."); Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}ZJH=Z_G(a1);ZiL=ZyP(((ZZ3*)ZJH),(((Zz8*)(((C)->Zrd)))->ZGd));if((ZiL)==((void*)(Zo))){Z5G(((C)->ZCb)); {T0*b1=Z1G(23,"Creation procedure for ");Zmx((T7*)(Z2G),b1);}ZMT(a1,Z1G(11," not found."));ZaG((T80*)(Z4G));}ZkY=ZiL;if(Zo!=(ZkY)){switch(((T0*)ZkY)->id){ case 451:break;default:ZkY=Zo;}}if((ZkY)==((void*)(Zo))){Z5G(((C)->ZCb));{T81 Zow;Z5G((*(Zow=Z8G(ZiL),&Zow)));}{T0*b1=Z1G(33,Z9q);Zmx((T7*)(Z2G),b1); }ZaG((T80*)(Z4G));}if((((((ZG7*)ZkY))->ZFb))!=((void*)(Zo))){ZMT(a1,ZdV);Z5G(((C)->ZCb));{T81 Zow;Z5G((*(Zow=ZlY(((ZG7*)ZkY)),&Zow))); }{T0*b1=Z1G(31,"Procedure found has arguments. ");Zmx((T7*)(Z2G),b1);}{T0*b1=Z1G(106,"Expanded class must have no creation procedure, or only one creation procedure with no arguments (VTEC.2)."); Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}}T0*ZgV(Z_1*C){T0*R=Zo;if((((C)->Zrd))!=((void*)(Zo))){if(ZmY((Zz8*)(((C)->Zrd)))){R=ZWJ;}else{ R=(((ZD8*)((((Zz8*)(((C)->Zrd)))->ZGd)))->Zse);}}return R;}void ZnY(Z_1*C,T81 a1,T0*a2,T0*a3,T0*a4){(C->ZCb)=a1;(C->Zjc)=a2;(C->Zqd)=a3; (C->Zrd)=a4;}T0*ZjV(Z_1*C,T0*a1){T0*R=Zo;T2 Zet=0;T0*Z5O=Zo;T0*ZoY=Zo;T0*ZJH=Zo;T0*ZiL=Zo;if((((C)->Zrd))!=((void*)(Zo))){ZJH=Z_G(a1); Zet=Z8O((Zz8*)(((C)->Zrd)));while(!((T6)(((ZiL)!=((void*)(Zo)))||((T6)((Z3)((Zet)<=(ZGs(0)))))))){Z5O=Z7O((Zz8*)(((C)->Zrd)),Zet);if((((((ZD8*)Z5O))->Zse))==((void*)(ZpJ))){ ZiL=ZyP(((ZZ3*)ZJH),Z5O);ZoY=Z5O;}Zet=(Z3)(((Zet))-(ZGs(1)));}if((T6)(((ZiL)==((void*)(Zo)))&&((T6)(ZqU(a1))))){Zet=Z8O((Zz8*)(((C)->Zrd))); while(!((T6)(((ZiL)!=((void*)(Zo)))||((T6)((Z3)((Zet)<=(ZGs(0)))))))){Z5O=Z7O((Zz8*)(((C)->Zrd)),Zet);ZiL=ZyP(((ZZ3*)ZJH),Z5O);ZoY=Z5O; if((ZiL)!=((void*)(Zo))){if((ZAP(ZiL))!=((void*)(Zo))){ZiL=Zo;}}Zet=(Z3)(((Zet))-(ZGs(1)));}}if((ZiL)!=((void*)(Zo))){R=ZiL;if(Zo!=(R)){ switch(((T0*)R)->id){case 451:break;default:R=Zo;}}if((R)==((void*)(Zo))){{T81 Zow;Z5G((*(Zow=Z8G(ZiL),&Zow)));}Z5G(((((ZD8*)ZoY))->ZCb)); {T0*b1=ZpY;Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}}}return R;}T6 ZnV(Z_1*C,T0*a1){T6 R=0;if((((C)->Zrd))!=((void*)(Zo))){R=((T6)(ZqY((Zz8*)(((C)->Zrd)),a1))); }return R;}T0*ZlV(Z_1*C,T0*a1){T0*R=Zo;if((((C)->Zrd))!=((void*)(Zo))){R=ZrY((Zz8*)(((C)->Zrd)),a1);}return R;}void ZsY(Z32*C){ZtY(C); ZpG((((ZD8*)(((C)->Z2c)))->ZCb),((C)->ZFb),((C)->Z3c));}T0*ZuY(void){if(ZrG==0){ZrG=1;{{ZG9*n=((ZG9*)Zh(sizeof(*n)));*n=Zfm;ZqG=((T0*)n); {ZG9*C1=n;ZhF(C1,ZGs(53));}}ZgF(((ZG9*)ZqG),ZtG);ZgF(((ZG9*)ZqG),ZuG);ZgF(((ZG9*)ZqG),ZvG);ZgF(((ZG9*)ZqG),ZwG);ZgF(((ZG9*)ZqG),ZxG); ZgF(((ZG9*)ZqG),ZyG);ZgF(((ZG9*)ZqG),ZzG);ZgF(((ZG9*)ZqG),ZAG);ZgF(((ZG9*)ZqG),(((void)((T27*)(ZvY()))),ZCG(ZDG)));ZgF(((ZG9*)ZqG),(((void)((T27*)(ZvY()))),ZCG(ZEG))); }}return ZqG;}T0*ZwY(Z32*C,T0*a1,T0*a2,T0*a3){T0*R=Zo;T0*ZGG=Zo;T0*ZHG=Zo;R=a1;if(ZIG(a2)){if(ZIG(a3)){ZHG=Z9G(a3);ZGG=Z9G(a2);if((ZHG)!=((void*)(ZGG))){ if(ZJG(a2,a3)){R=ZKG(a1,a3);if((T6)(((R)!=((void*)(a1)))&&((T6)(!(ZfF((ZG9*)(ZuY()),(((ZD8*)(((C)->Z2c)))->Zse))))))){{T81 Zow;Z5G((*(Zow=ZLG(a1),&Zow))); }{T0*b1=ZMG;Zmx((T7*)(Z2G),b1);}{T0*b1=ZGG;Zmx((T7*)(Z2G),b1);}{T0*b1=ZNG;Zmx((T7*)(Z2G),b1);}{T0*b1=ZHG;Zmx((T7*)(Z2G),b1);}{T0*b1=ZOG; Zmx((T7*)(Z2G),b1);}ZPG((T80*)(Z4G));}}else{((((T7*)((T7*)(Z2G))))->Zdc)=(ZGs(0));((((T82*)((T82*)(ZQG()))))->ZWb)=(ZGs(-1));}}}}return R;}T6 ZxY(Z32*C,T0*a1){T6 R=0;T0*ZUG=Zo;if((((C)->ZFb))==((void*)(Zo))){R=((T6)(1));}else{R=((T6)(ZVG((Za3*)(((C)->ZFb)),a1)));}if(R){ if((((C)->Z3c))==((void*)(Zo))){R=((T6)(ZWG(((C)->Z1c),a1)));}else if(ZXG(((C)->Z1c))){if(ZYG(((C)->Z3c),a1)){R=((T6)((ZZG(((C)->Z3c),a1))!=((void*)(Zo)))); }else{R=((T6)(0));}}else{R=((T6)(ZWG(((C)->Z1c),a1)));if(R){if((((C)->Z3c))!=((void*)(Zo))){ZUG=(((ZZ3*)(Z_G((((ZQ7*)(((C)->Z3c)))->Z4c))))->Zof); if((Z3)(((Z3)(((((((Ze7*)(((((Z23*)ZUG))->Zae))))->ZWb)))+(ZGs(1))))>(ZGs(1)))){R=((T6)(ZYG(((C)->Z3c),ZUG)));}}}}}return R;}T0*ZyY(Z32*C,T0*a1){ T0*R=Zo;R=Z1H((Za3*)(((C)->ZFb)),a1);if((R)==((void*)(Zo))){{T81 Zow;Z5G((*(Zow=Z2H((Za3*)(((C)->ZFb))),&Zow)));}{T0*b1=Z3H;Zmx((T7*)(Z2G),b1); }Z4H(a1);ZaG((T80*)(Z4G));}return R;}void ZzY(Z32*C,T0*a1,T0*a2,T0*a3){(C->Z3c)=Zo;(C->Z4c)=Zo;(C->Z1c)=a1;(C->Z2c)=a2;(C->ZFb)=a3;}T0*ZAY(Z32*C){ T0*R=Zo;if((((T43*)(ZSG))->ZRk)){R=((T0*)(C));}else{R=ZBY(C);if((R)!=((void*)(C))){Z8H((T43*)(ZSG));}}return R;}T0*ZCY(Z32*C){T0*R=Zo; (C->Z1c)=ZaH(((C)->Z1c));ZbH((Za3*)(((C)->ZFb)));R=ZBY(C);return R;}void ZDY(Z32*C){T0*ZdH=Zo;if((((C)->Z3c))!=((void*)(Zo))){if((((C)->ZFb))!=((void*)(Zo))){ ZdH=(((ZZ3*)((((ZQ7*)(((C)->Z3c)))->Znf)))->Zof);if((Z3)(((Z3)(((((((Ze7*)(((((Z23*)ZdH))->Zae))))->ZWb)))+(ZGs(1))))>=(ZGs(1)))){{T81 Zow;ZeH((T43*)(ZSG),(*(Zow=ZEY(C),&Zow)),((C)->Z3c),ZdH);}}}}ZgH(((C)->Z1c));if((((C)->ZFb))!=((void*)(Zo))){ZhH((Za3*)(((C)->ZFb))); }}void ZtY(Z32*C){if((ZiH(((C)->Z3c)))==((void*)(Zo))){{T81 Zow;Z5G((*(Zow=Z8G(((C)->Z3c)),&Zow)));}Z5G((((ZD8*)(((C)->Z2c)))->ZCb)); ZFY(Z1G(29,"Feature found is a procedure."));}}T6 ZGY(Z32*C,T0*a1){T6 R=0;R=((T6)(ZxY(C,a1)));if(R){R=((T6)(!(ZmH(ZnH(ZHY(C))))));}return R;}void ZIY(Z32*C,T0*a1,T0*a2){ZqH(((C)->Z1c),a1,a2);ZrH((Za3*)(((C)->ZFb)),a1,a2);}void ZJY(Z32*C){{T81 Zow;Z5G((*(Zow=ZEY(C),&Zow))); }{T0*b1=Z1G(63,"A separate target must be an argument of the enclosing routine.");Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}void ZKY(Z32*C,T0*a1,T81 a2,T0*a3){(C->Z1c)=a1;{ZD8*n=((ZD8*)Zh(sizeof(*n)));*n=Zfn;ZuH(n,(ZCI),a2);(C->Z2c)=((T0*)n);}{Za3*n=((Za3*)Zh(sizeof(*n)));*n=Z3j;((((Za3*)(n)))->Z2j)=(a3); (C->ZFb)=((T0*)n);}}void ZLY(Z32*C,T0*a1){T0*ZxH=Zo;ZxH=ZyH(((C)->Z1c),a1);if((ZxH)==((void*)(Zo))){{T81 Zow;Z5G((*(Zow=ZLG(((C)->Z1c)),&Zow))); }{T0*b1=Z1G(11,"Bad target.");Zmx((T7*)(Z2G),b1);}Z4H(a1);ZaG((T80*)(Z4G));}(C->Z1c)=ZxH;}void ZFY(T0*a1){{T0*b1=a1;Zmx((T7*)(Z2G),b1); }ZaG((T80*)(Z4G));}void ZMY(Z32*C){{T0*b1=ZAH;Zmx((T7*)(Z2G),b1);}{T81 Zow;Z5G((*(Zow=ZEY(C),&Zow)));}Z3G((T80*)(Z4G));}T2 ZNY(void){ T2 R=0;return R;}void ZOY(Z32*C,T3 a1){if((a1)==(((T3)'R'))){{T81 Zow;ZDH(((C)->Z3c),(*(Zow=ZEY(C),&Zow)));}}ZEH(((C)->Z1c),a1);ZEH(((((Za3*)(((C)->ZFb))))->Z2j),a1); }T0*ZHY(Z32*C){T0*R=Zo;T0*ZFH=Zo;R=ZiH(((C)->Z3c));ZFH=R;if(Zo!=(ZFH)){switch(((T0*)ZFH)->id){case 280:break;default:ZFH=Zo;}}if((ZFH)!=((void*)(Zo))){ R=ZnH(ZGH(((((Za3*)(((C)->ZFb))))->Z2j)));}return R;}void ZPY(Z32*C){T0*ZIH=Zo;T0*ZJH=Zo;T0*ZdH=Zo;if((((C)->Z3c))!=((void*)(Zo))){ZIH=ZGH(((C)->Z1c)); ZJH=Z_G(ZIH);ZdH=((((ZZ3*)ZJH))->Zof);if((Z3)(((Z3)(((((((Ze7*)(((((Z23*)ZdH))->Zae))))->ZWb)))+(ZGs(1))))>(ZGs(1)))){ZKH(((C)->Z1c),((C)->Z3c)); }}ZLH(((C)->Z1c));ZMH((Za3*)(((C)->ZFb)));}T6 ZQY(Z32*C){T6 R=0;R=((T6)(ZOH((Za3*)(((C)->ZFb)))));if(R){}else if(ZXG(((C)->Z1c))){if((ZPH())!=((void*)(((C)->Z3c)))){ R=((T6)(ZQH(((C)->Z3c))));}}else{R=((T6)(ZRH(((C)->Z1c))));}return R;}T0*ZvY(void){if(ZTH==0){ZTH=1;{{T27*n=((T27*)Zh(1));ZSH=((T0*)n); ZUH(ZVH);ZUH(ZWH);ZUH(ZXH);ZUH(ZYH);ZUH(ZZH);ZUH(Z_H);ZUH(Z0I);ZUH(Z1I);ZUH(Z2I);ZUH(Z3I);ZUH(Z4I);ZUH(Z5I);ZUH(Z6I);ZUH(Z7I);ZUH(Z8I); ZUH(Z9I);ZUH(ZaI);ZUH(ZbI);ZUH(ZcI);ZUH(ZdI);ZUH(ZeI);ZUH(ZfI);ZUH(ZgI);ZUH(ZhI);ZUH(ZiI);ZUH(ZjI);ZUH(ZkI);ZUH(ZlI);ZUH(ZmI);ZUH(ZnI); ZUH(ZoI);ZUH(ZpI);ZUH(ZqI);ZUH(ZrI);ZUH(ZsI);ZUH(ZtI);ZUH(ZuI);ZUH(ZvI);ZUH(ZwI);ZUH(ZxI);ZUH(ZyI);ZUH(ZzI);ZUH(ZAI);ZUH(ZBI);ZUH(ZCI); ZUH(ZDI);ZUH(ZEI);ZUH(ZFI);ZUH(ZGI);ZUH(ZHI);ZUH(ZII);ZUH(ZJI);ZUH(ZKI);ZUH(ZLI);ZUH(ZMI);ZUH(ZNI);ZUH(ZOI);ZUH(ZPI);ZUH(ZQI);ZUH(ZAG); ZUH(ZzG);ZUH(ZRI);ZUH(ZyG);ZUH(ZxG);ZUH(ZuG);ZUH(ZSI);ZUH(ZvG);ZUH(ZTI);ZUH(ZUI);ZUH(ZVI);ZUH(ZWI);ZUH(ZXI);ZUH(ZtG);ZUH(ZYI);ZUH(ZZI); ZUH(Z_I);ZUH(Z0J);ZUH(Z1J);ZUH(Z2J);ZUH(ZvH);ZUH(Z3J);ZUH(Z4J);ZUH(Z5J);ZUH(Z6J);ZUH(Z7J);ZUH(Z8J);ZUH(Z9J);ZUH(ZaJ);ZUH(ZbJ);ZUH(ZcJ); ZUH(ZdJ);ZUH(ZeJ);ZUH(ZfJ);ZUH(ZgJ);ZUH(ZhJ);ZUH(ZiJ);ZUH(ZjJ);ZUH(ZkJ);ZUH(ZlJ);ZUH(ZmJ);ZUH(ZnJ);ZUH(ZoJ);ZUH(ZpJ);ZUH(ZqJ);ZUH(ZrJ); ZUH(ZsJ);ZUH(ZtJ);ZUH(ZuJ);ZUH(ZvJ);ZUH(ZwJ);ZUH(ZxJ);ZUH(ZyJ);ZUH(ZzJ);ZUH(ZAJ);ZUH(ZBJ);ZUH(ZCJ);ZUH(ZDJ);ZUH(ZEJ);ZUH(ZFJ);ZUH(ZGJ); ZUH(ZHJ);ZUH(ZIJ);ZUH(ZJJ);ZUH(ZKJ);ZUH(ZLJ);ZUH(ZMJ);ZUH(ZNJ);ZUH(ZOJ);ZUH(ZwG);ZUH(ZPJ);ZUH(ZQJ);ZUH(ZRJ);ZUH(ZSJ);ZUH(ZTJ);ZUH(ZUJ); ZUH(ZVJ);ZUH(ZWJ);ZUH(ZXJ);ZUH(ZYJ);ZUH(ZZJ);ZUH(Z_J);ZUH(Z0K);ZUH(Z1K);ZUH(Z2K);ZUH(Z3K);ZUH(Z4K);ZUH(Z5K);ZUH(Z6K);ZUH(Z7K);ZUH(Z8K); ZUH(Z9K);ZUH(ZaK);ZUH(ZbK);ZUH(ZcK);ZUH(ZdK);ZUH(ZeK);ZUH(ZfK);ZUH(ZgK);ZUH(ZhK);ZUH(ZiK);ZUH(ZjK);ZUH(ZkK);ZUH(ZlK);ZUH(ZmK);ZUH(ZnK); ZUH(ZoK);ZUH(ZpK);ZUH(ZqK);ZUH(ZrK);ZUH(ZsK);ZUH(ZtK);ZUH(ZuK);ZUH(ZvK);ZUH(ZwK);ZUH(ZxK);ZUH(ZyK);ZUH(ZzK);ZUH(ZAK);ZUH(ZBK);ZUH(ZCK); ZUH(ZDK);ZUH(ZEK);ZUH(ZFK);ZUH(ZGK);ZUH(ZHK);ZUH(ZIK);ZUH(ZJK);ZUH(ZKK);ZUH(ZLK);ZUH(ZMK);ZUH(ZXH);ZUH(ZNK);ZUH(ZOK);ZUH(ZPK);ZUH(ZQK); ZUH(ZRK);ZUH(ZSK);ZUH(ZTK);ZUH(ZUK);ZUH(ZVK);ZUH(ZWK);ZUH(ZXK);ZUH(ZYK);ZUH(ZZK);}}}return ZSH;}T6 ZRY(Z32*C){T6 R=0;if(Z0L(((C)->Z1c))){ if((((C)->ZFb))!=((void*)(Zo))){R=((T6)(Z1L((Za3*)(((C)->ZFb)))));}else{R=((T6)(1));}}return R;}T6 ZSY(Z32*C,T0*a1){T6 R=0;R=((T6)(Z3L(ZGH(((C)->Z1c))))); R=((T6)((T6)((Z4L(((C)->Z1c),a1))||((T6)(R)))));if((a1)!=((void*)(Zo))){if(Z5L(((Zz6*)a1),((C)->Z1c))){R=((T6)(1));}}else if((T6)((Z3L(ZGH(((C)->Z1c))))&&((T6)(!(ZXG(((C)->Z1c))))))){ Z6L(((C)->Z1c));}return R;}void ZTY(Z32*C,T0*a1){T6 Z8L=0;T0*Z9L=Zo;Z8L=((T6)(ZaL((Z84*)(ZkH),a1)));Z9L=ZnH(ZHY(C));if(ZbL(Z9L)){if(ZbL(a1)){ ZcL(a1);ZdL((Z84*)(ZkH),((T3)'\050'));{Z32*C1=C;ZeL((Z84*)(ZkH),(T0*)C1);}ZdL((Z84*)(ZkH),((T3)'\051'));}else{{Z32*C1=C;ZeL((Z84*)(ZkH),(T0*)C1); }}}else{if(ZbL(a1)){{Z32*C1=C;ZeL((Z84*)(ZkH),(T0*)C1);}}else{if(ZfL(a1)){ZdL((Z84*)(ZkH),((T3)'\046'));ZdL((Z84*)(ZkH),((T3)'\050')); {Z32*C1=C;ZeL((Z84*)(ZkH),(T0*)C1);}ZdL((Z84*)(ZkH),((T3)'\051'));}else{{Z32*C1=C;ZeL((Z84*)(ZkH),(T0*)C1);}}}}if(Z8L){ZgL((Z84*)(ZkH)); }}void ZUY(Z32*C,T0*a1){T0*ZiL=Zo;T0*ZJH=Zo;T0*ZjL=Zo;T0*ZkL=Zo;ZjL=ZGH(((C)->Z1c));if((ZjL)!=((void*)(Zo))){ZJH=Z_G(ZjL);if((ZJH)!=((void*)(Zo))){ ZkL=((((ZZ3*)ZJH))->Zvb);ZiL=ZlL(((T87*)ZkL),ZJH,((C)->Z1c),((C)->Z2c),a1);}}if((ZiL)==((void*)(Zo))){Z5G((((ZD8*)(((C)->Z2c)))->ZCb)); {T0*b1=Z1G(25,"Bad target for this call.");Zmx((T7*)(Z2G),b1);}Z4H(a1);ZaG((T80*)(Z4G));}(C->Z3c)=ZiL;}T0*ZVY(Z32*C){T0*R=Zo;R=Zh(sizeof(*C)); *((Z32*)R)=*C;return R;}T2 ZWY(Z32*C){T2 R=0;ZMY(C);return R;}T0*ZXY(Z32*C,T0*a1){T0*R=Zo;T0*ZpL=Zo;T0*ZqL=Zo;T0*ZrL=Zo;if((((C)->Z4c))==((void*)(Zo))){ (C->Z4c)=a1;ZLY(C,a1);(C->ZFb)=ZyY(C,a1);ZqL=ZGH(((C)->Z1c));ZpL=ZGH(((((Za3*)(((C)->ZFb))))->Z2j));(C->Z1c)=ZwY(C,((C)->Z1c),ZqL,ZpL); ZUY(C,a1);R=ZAY(C);ZsY(C);}else{ZrL=ZVY(C);ZzY(((Z32*)ZrL),((C)->Z1c),((C)->Z2c),((C)->ZFb));R=ZXY(((Z32*)ZrL),a1);}return R;}T0*ZBY(Z32*C){ T0*R=Zo;T0*ZsL=Zo;ZsL=((C)->Z1c);if(Zo!=(ZsL)){switch(((T0*)ZsL)->id){case 318:case 319:break;default:ZsL=Zo;}}if((ZsL)==((void*)(Zo))){ R=((T0*)(C));}else if(ZuL(ZsL)){R=((((Za3*)(((C)->ZFb))))->Z2j);}else{{ZZ8*n=((ZZ8*)Zh(sizeof(*n)));*n=Zml;ZwL(n,(((ZD8*)(((C)->Z2c)))->ZCb)); R=((T0*)n);}}return R;}T0*ZYY(Z32*C){T0*R=Zo;T0*ZkL=Zo;T0*ZyL=Zo;T0*ZjL=Zo;ZkL=ZzL(((C)->Z1c));if((ZkL)!=((void*)(Zo))){ZyL=ZAL(((T87*)ZkL),((C)->Z2c)); if((ZyL)!=((void*)(Zo))){ZjL=ZBL(ZyL);if((ZjL)!=((void*)(Zo))){R=ZCL(ZjL);}}}return R;}void ZZY(Z32*C){if((((C)->Z3c))!=((void*)(Zo))){ ZEL(((C)->Z3c));}ZFL(((C)->Z1c));if((((C)->ZFb))!=((void*)(Zo))){ZGL((Za3*)(((C)->ZFb)));}}void Z_Y(Z32*C){T0*ZJH=Zo;T0*ZiL=Zo;ZiL=((C)->Z3c); ZJH=((((ZQ7*)ZiL))->Znf);(C->Z3c)=ZIL((ZZ3*)((((((Ze7*)((((Z23*)(((((ZZ3*)ZJH))->Zof)))->Zae))))->ZUb))[ZGs(0)]),ZiL);}T81 ZEY(Z32*C){ T81 R={Zo,Zo,0};R=(((ZD8*)(((C)->Z2c)))->ZCb);return R;}void Z0Z(Zd2*C){if((((C)->ZFb))!=((void*)(Zo))){ZhH((Za3*)(((C)->ZFb)));}}void Z1Z(Zd2*C){Z2Z((Z84*)(ZkH),((C)->Z3c),((C)->ZFb));Z3Z(((C)->Z3c));Z4Z((Z84*)(ZkH));}T6 Z5Z(T0*a1){T6 R=0;return R;}void Z6Z(Zd2*C,T0*a1,T0*a2){ if((((C)->ZFb))!=((void*)(Zo))){ZrH((Za3*)(((C)->ZFb)),a1,a2);}}void Z7Z(Zd2*C){Z5G(((C)->ZCb));{T0*b1=Z1G(63,"A separate target must be an argument of the enclosing routine."); Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}void Z8Z(Zd2*C,T81 a1,T0*a2,T0*a3){(C->ZCb)=a1;(C->ZAd)=a2;(C->ZFb)=a3;}void Z9Z(T0*a1){{T0*b1=a1; Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}void ZaZ(Zd2*C){{T0*b1=ZAH;Zmx((T7*)(Z2G),b1);}Z5G(((C)->ZCb));Z3G((T80*)(Z4G));}T0*ZbZ(Zd2*C){ T0*R=Zo;R=ZiH(((C)->Z3c));return R;}T0*ZcZ(Zd2*C,T0*a1){T0*R=Zo;T0*ZyL=Zo;T0*ZdZ=Zo;T0*ZeZ=Zo;ZyL=Z0X(a1);ZdZ=((((ZX4*)ZyL))->Zvb);ZeZ=((((T87*)ZdZ))->Zlg); if((ZeZ)==((void*)(Zo))){Z5G(((C)->ZCb));Z9Z(Z1G(71,"Precursor call is allowed only when the enclosing routine is redefined."));}else{ R=ZfZ(((Z7a*)ZeZ),(T0*)C,a1);}return R;}void ZgZ(Zd2*C){if((((C)->ZFb))!=((void*)(Zo))){ZMH((Za3*)(((C)->ZFb)));}}void ZhZ(Zd2*C,T0*a1){ T0*ZKO=Zo;if((((C)->ZFb))!=((void*)(Zo))){ZKO=Z1H((Za3*)(((C)->ZFb)),a1);if((ZKO)==((void*)(Zo))){{T81 Zow;Z5G((*(Zow=Z2H((Za3*)(((C)->ZFb))),&Zow))); }{T0*b1=ZiZ;Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}else{(C->ZFb)=ZKO;}}ZpG(((C)->ZCb),((C)->ZFb),((C)->Z3c));}T0*ZjZ(T0*a1,T0*a2){T0*R=Zo; {ZD8*n=((ZD8*)Zh(sizeof(*n)));*n=Zfn;ZkZ(n,(T2)((((T87*)(((((ZX4*)a2))->Zvb)))->_id)),a1);R=((T0*)n);}return R;}T6 ZlZ(T0*a1){T6 R=0; return R;}T2 ZmZ(Zd2*C){T2 R=0;ZaZ(C);return R;}T0*ZnZ(Zd2*C,T0*a1){T0*R=Zo;T0*ZoZ=Zo;T0*ZpZ=Zo;T0*ZqZ=Zo;if((((C)->Z4c))==((void*)(Zo))){ (C->Z4c)=a1;R=((T0*)(C));ZoZ=ZPH();if((ZiH(ZoZ))==((void*)(Zo))){Z5G(((C)->ZCb));Z9Z(Z1G(84,"Inside a procedure, a Precursor call must be a procedure call (not a function call).")); }ZpZ=ZcZ(C,ZoZ);ZqZ=ZjZ(((((ZQ7*)ZoZ))->Zpc),ZpZ);(C->Z3c)=ZjD(((ZR6*)((((ZZ3*)(Z_G(a1)))->Ztg))),ZqZ);if((((C)->Z3c))==((void*)(Zo))){ {Zg7*n=((Zg7*)Zh(sizeof(*n)));*n=ZVj;ZrZ(n,a1,ZqZ,ZpZ);(C->Z3c)=((T0*)n);}}ZhZ(C,a1);}else{{Zd2*n=((Zd2*)Zh(sizeof(*n)));*n=ZBd;Z8Z(n,((C)->ZCb),((C)->ZAd),((C)->ZFb)); R=((T0*)n);}R=ZnZ(((Zd2*)R),a1);}return R;}T0*ZsZ(Zd2*C){T0*R=Zo;T0*ZyL=Zo;T0*ZjL=Zo;if((((C)->Z3c))!=((void*)(Zo))){ZyL=Z0X(((C)->Z3c)); ZjL=ZBL(ZyL);R=ZCL(ZjL);}return R;}void ZtZ(Zd2*C){if((((C)->Z3c))!=((void*)(Zo))){ZEL(((C)->Z3c));}if((((C)->ZFb))!=((void*)(Zo))){ZGL((Za3*)(((C)->ZFb))); }}T0*ZuZ(Zj2*C,T0*a1){T0*R=Zo;T0*ZvZ=Zo;{T81 Zow;ZwZ(&(((C)->ZEd)),(*(Zow=ZrP(a1),&Zow)));}{T0*b1=ZxZ;Zmx((T7*)(ZyZ),b1);}ZvZ=a1;if(Zo!=(ZvZ)){ switch(((T0*)ZvZ)->id){case 300:break;default:ZvZ=Zo;}}{Zq9*n=((Zq9*)Zh(sizeof(*n)));*n=Z3m;ZzZ(n,ZAZ(&(((C)->ZEd))),((((Zq9*)ZvZ))->ZFj)); R=((T0*)n);}R=ZxP(R,((C)->Z4c));return R;}void ZBZ(T81 a1,T0*a2){Z5G(a1);{T0*b1=a2;Zmx((T7*)(Z2G),b1);}ZPG((T80*)(Z4G));}T6 ZCZ(Zj2*C,T0*a1){ T6 R=0;T0*ZDZ=Zo;T0*ZoY=Zo;T0*ZEZ=Zo;R=((T6)((T6)((ZyW(a1))&&((T6)((ZnH(a1))==((void*)(a1)))))));if((T6)((R)&&((T6)((((C)->Z3c))!=((void*)(Zo)))))){ ZDZ=(((ZQ7*)(((C)->Z3c)))->Z4c);ZEZ=(((T85*)((((T87*)(ZsO(ZDZ)))->Zpc)))->Zse);ZoY=(((ZD8*)((((ZQ7*)(((C)->Z3c)))->Zpc)))->Zse);if((ZWJ)==((void*)(ZoY))){ R=((T6)((T6)(((T6)(((T6)(((T6)(((T6)(((ZWH)==((void*)(ZEZ)))||((T6)((Z7I)==((void*)(ZEZ))))))||((T6)((ZvI)==((void*)(ZEZ))))))||((T6)((Z3I)==((void*)(ZEZ))))))||((T6)((ZwI)==((void*)(ZEZ))))))||((T6)((ZxI)==((void*)(ZEZ))))))); }else if((Z8J)==((void*)(ZoY))){R=((T6)((ZvI)==((void*)(ZEZ))));}else if((ZMK)==((void*)(ZoY))){R=((T6)((T6)(((T6)(((ZWH)==((void*)(ZEZ)))||((T6)((Z7I)==((void*)(ZEZ))))))||((T6)((Z3I)==((void*)(ZEZ))))))); }else{R=((T6)(0));}}return R;}void ZFZ(T81 a1,T0*a2){Z5G(a1);{T0*b1=a2;Zmx((T7*)(Z2G),b1);}Z3G((T80*)(Z4G));}T0*ZGZ(Zj2*C){T0*R=Zo;if((((C)->ZDd))!=((void*)(Zo))){ R=ZsR(((C)->ZDd));}return R;}T0*ZHZ(Zj2*C){T0*R=Zo;if((((T43*)(ZSG))->ZRk)){R=((T0*)(C));}else{R=ZIZ(C);if((R)!=((void*)(C))){Z8H((T43*)(ZSG)); }}return R;}T0*ZJZ(Zj2*C){T0*R=Zo;if(ZIG(((C)->ZGb))){R=ZKZ(((C)->ZGb),((C)->ZCb));}else{R=((T0*)(C));}return R;}void ZLZ(Zj2*C){T0*ZEQ=Zo; ZEQ=ZGZ(C);if((ZEQ)!=((void*)(Zo))){ZhH(((Za3*)ZEQ));}}T2 ZMZ(Zj2*C){T2 R=0;if((((C)->ZDd))!=((void*)(Zo))){R=ZNZ(((C)->ZDd));}return R;}void ZOZ(Zj2*C){if(ZbL(((C)->ZGb))){ZgM((Z84*)(ZkH),ZPZ);}ZQZ(C,((C)->ZGb));if(ZbL(((C)->ZGb))){ZdL((Z84*)(ZkH),((T3)'\051'));}}T0*ZRZ(Zj2*C,T0*a1){ T0*R=Zo;if(Z5v((T7*)((((T85*)(ZBT(a1)))->Zse)),Z1G(10,Zsp))){Z5G(((C)->ZCb));if((((C)->ZGb))==((void*)(Zo))){{T81 Zow;Z5G((*(Zow=ZrP(a1),&Zow))); }}{T0*b1=Z1G(146,"DICTIONARY will be deferred in SmartEiffel 2. You should use HASHED_DICTIONARY instead. This instruction will actually create a HASHED_DICTIONARY."); Zmx((T7*)(Z2G),b1);}ZPG((T80*)(Z4G));R=ZuZ(C,a1);}else if(Z5v((T7*)((((T85*)(ZBT(a1)))->Zse)),Z1G(3,"SET"))){Z5G(((C)->ZCb));if((((C)->ZGb))==((void*)(Zo))){ {T81 Zow;Z5G((*(Zow=ZrP(a1),&Zow)));}}{T0*b1=Z1G(125,"SET will be deferred in SmartEiffel 2. You should use HASHED_SET instead. This instruction will actually create a HASHED_SET."); Zmx((T7*)(Z2G),b1);}ZPG((T80*)(Z4G));R=ZSZ(C,a1);}else{R=a1;}return R;}void ZTZ(Zj2*C){Z5G(((C)->ZCb));{T0*b1=Z1G(63,"A separate target must be an argument of the enclosing routine."); Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}void ZUZ(Zj2*C,T81 a1,T0*a2,T0*a3){(C->ZCb)=a1;(C->ZGb)=a2;(C->ZDd)=a3;}void ZVZ(T0*a1){{T0*b1=a1; Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}void ZWZ(Zj2*C){{T0*b1=ZAH;Zmx((T7*)(Z2G),b1);}Z5G(((C)->ZCb));Z3G((T80*)(Z4G));}void ZXZ(Zj2*C,T3 a1){if((((C)->Z3c))!=((void*)(Zo))){if((a1)==(((T3)'R'))){ZDH(((C)->Z3c),((C)->ZCb));}}}void ZYZ(Zj2*C){T0*ZEQ=Zo;ZEQ=ZGZ(C);if((ZEQ)!=((void*)(Zo))){ ZMH(((Za3*)ZEQ));}}T6 ZZZ(Zj2*C){T6 R=0;T0*ZEQ=Zo;ZEQ=ZGZ(C);if((ZEQ)!=((void*)(Zo))){R=((T6)(ZOH(((Za3*)ZEQ))));}return R;}T6 Z_Z(Zj2*C){ T6 R=0;T0*Z0_=Zo;Z0_=ZHZ(C);if((Z0_)!=((void*)(C))){R=((T6)(Z0L(Z0_)));}else if((T6)(((ZGZ(C))==((void*)(Zo)))||((T6)(Z1L((Za3*)(ZGZ(C))))))){ R=((T6)(ZCZ(C,((C)->ZGb))));}return R;}void Z1_(Zj2*C,T0*a1){T0*ZjL=Zo;T0*ZsL=Zo;T0*ZtL=Zo;ZjL=ZnH(a1);if((((T43*)(ZSG))->ZRk)){}else if((((T87*)(ZsO(ZjL)))->Zeg)){ZMT(ZjL,Z1G(14," is deferred. "));ZBZ(((C)->ZCb),Z1G(21,"Cannot create object."));}if(Z2_(a1)){ZsL=((((C)->ZCb)).Zvb); ZtL=ZLT((T85*)(Z3_(a1)));if((ZsL)==((void*)(ZtL))){Z5G(((C)->ZCb));{T0*b1=Z1G(38,"Creation call on formal generic type (");Zmx((T7*)(Z2G),b1); }ZMT(a1,Z1G(2,ZKn));ZaG((T80*)(Z4G));}}if(Z3L(a1)){((((T43*)((T43*)(ZSG))))->ZXk)=(1);}ZCP((ZZ3*)(Z_G(ZjL)));}T0*ZSZ(Zj2*C,T0*a1){T0*R=Zo; T0*ZvZ=Zo;{T81 Zow;ZwZ(&(((C)->ZEd)),(*(Zow=ZrP(a1),&Zow)));}{T0*b1=Z4_;Zmx((T7*)(ZyZ),b1);}ZvZ=a1;if(Zo!=(ZvZ)){switch(((T0*)ZvZ)->id){ case 300:break;default:ZvZ=Zo;}}{Zq9*n=((Zq9*)Zh(sizeof(*n)));*n=Z3m;ZzZ(n,ZAZ(&(((C)->ZEd))),((((Zq9*)ZvZ))->ZFj));R=((T0*)n);}R=ZxP(R,((C)->Z4c)); return R;}T6 Z5_(T0*a1){T6 R=0;return R;}void ZQZ(Zj2*C,T0*a1){T0*ZJH=Zo;T6 Z6_=0;T0*ZEQ=Zo;Z6_=((T6)(((((T89*)(ZPM))->Zaf))==(ZGs(1)))); ZJH=Z_G(((C)->ZGb));ZgM((Z84*)(ZkH),Z7_);ZDM((Z84*)(ZkH),(T11)(((((ZZ3*)ZJH))->_id)));if((((C)->Z3c))!=((void*)(Zo))){ZgM((Z84*)(ZkH),(((ZD8*)((((ZQ7*)(((C)->Z3c)))->Zpc)))->Zse)); }ZdL((Z84*)(ZkH),((T3)'\050'));if(!(Z6_)){ZgM((Z84*)(ZkH),Z8_);}ZEQ=ZGZ(C);if((ZEQ)!=((void*)(Zo))){if(!(Z6_)){ZdL((Z84*)(ZkH),((T3)'\054')); }Z9_(((Za3*)ZEQ),ZAP(((C)->Z3c)));}ZdL((Z84*)(ZkH),((T3)'\051'));}void Za_(Zj2*C,T0*a1){T0*Z5O=Zo;T0*Zb_=Zo;T0*Zc_=Zo;T0*ZEQ=Zo;T2 Zd_=0; T0*Ze_=Zo;T0*ZJH=Zo;T0*Zf_=Zo;ZJH=Z_G(a1);if((((C)->ZDd))==((void*)(Zo))){(C->Z3c)=Zg_(((ZZ3*)ZJH));if((((C)->Z3c))!=((void*)(Zo))){} else if(((((T87*)(ZsO(a1)))->Zmg))!=(Zo)){{T0*b1=Z1G(27,"Creation clause exists for ");Zmx((T7*)(Z2G),b1);}ZMT(a1,Z1G(2,ZPn));ZFZ(((C)->ZCb),Z1G(27,"You must use a constructor.")); }}else{Z5O=(((ZP6*)(((C)->ZDd)))->Z2c);Zc_=((((((ZD8*)Z5O))->ZCb)).Zvb);Zb_=ZsO(a1);if(Zh_(a1)){Z5O=Zi_(((T87*)Zb_),Zc_,Z5O);if((Z5O)==((void*)(Zo))){ Z5O=(((ZP6*)(((C)->ZDd)))->Z2c);Zj_(Z5O);{T0*b1=Z1G(20," Type to create is \"");Zmx((T7*)(Z2G),b1);}{T0*b1=Z9G(a1);Zmx((T7*)(Z2G),b1); }ZVZ(Zk_);}}(C->Z3c)=ZyP(((ZZ3*)ZJH),Z5O);if((((C)->Z3c))==((void*)(Zo))){Zl_(C,Z5O);}else{Zf_=Z0X(((C)->Z3c));Zm_(Z0X(((C)->Z3c)),((((ZD8*)Z5O))->ZCb)); }if((((T43*)(ZSG))->ZRk)){}else if(!(Zn_((T87*)(((((ZZ3*)ZJH))->Zvb)),Z5O))){Z5G((((ZD8*)((((ZP6*)(((C)->ZDd)))->Z2c)))->ZCb));Z5G(((((ZD8*)Z5O))->ZCb)); {T0*b1=((((ZD8*)Z5O))->Zse);Zmx((T7*)(Z2G),b1);}{T0*b1=Z1G(32," is not in the creation list of ");Zmx((T7*)(Z2G),b1);}ZMT(a1,Z0O);ZaG((T80*)(Z4G)); }Zo_((ZZ3*)((((ZQ7*)(((C)->Z3c)))->Znf)),Z_G(((C)->Z4c)));if((ZiH(((C)->Z3c)))!=((void*)(Zo))){{T81 Zow;Z5G((*(Zow=Z8G(((C)->Z3c)),&Zow))); }Z5G(((((ZD8*)Z5O))->ZCb));ZVZ(ZpY);}Zd_=ZMZ(C);if((Z3)((Zd_)>(ZGs(0)))){ZEQ=Z1H((Za3*)(ZGZ(C)),((C)->Z4c));if((ZEQ)==((void*)(Zo))){ {T81 Zow;ZFZ((*(Zow=Z2H((Za3*)(ZsR(((C)->ZDd)))),&Zow)),ZiZ);}}}{T81 Zow;ZpG((*(Zow=Zp_(((C)->ZDd)),&Zow)),ZEQ,((C)->Z3c));}Ze_=((C)->ZCd); if((Ze_)==((void*)(Zo))){Ze_=(((ZP6*)(((C)->ZDd)))->Z1c);}(C->ZDd)=Zq_(((C)->ZDd),((C)->Z4c),Ze_,ZEQ,((C)->Z3c));}}T2 Zr_(Zj2*C){T2 R=0; ZWZ(C);return R;}T0*Zs_(Zj2*C,T0*a1){T0*R=Zo;T0*ZJH=Zo;if((((C)->Z4c))==((void*)(Zo))){(C->Z4c)=a1;Zt_(C);Z1_(C,((C)->ZGb));Za_(C,((C)->ZGb)); R=ZHZ(C);ZJH=Z_G(((C)->ZGb));if(!(ZIG(((((ZZ3*)ZJH))->Z4c)))){Zu_(((ZZ3*)ZJH),((C)->Z3c));}}else{{Zj2*n=((Zj2*)Zh(sizeof(*n)));*n=ZFd; ZUZ(n,((C)->ZCb),((C)->ZGb),((C)->ZDd));R=((T0*)n);}R=ZyH(R,a1);}return R;}T0*ZIZ(Zj2*C){T0*R=Zo;if(ZIG(((C)->ZGb))){R=ZKZ(((C)->ZGb),((C)->ZCb)); }else{R=((T0*)(C));}return R;}T0*Zv_(Zj2*C){T0*R=Zo;R=ZsO(((C)->ZGb));return R;}void Zw_(Zj2*C){if((ZGZ(C))!=((void*)(Zo))){ZGL((Za3*)(ZGZ(C))); }}void Zl_(Zj2*C,T0*a1){Z5G((((ZD8*)((((ZP6*)(((C)->ZDd)))->Z2c)))->ZCb));Z5G(((((ZD8*)a1))->ZCb));ZVZ(Z1G(29,"Creation procedure not found.")); }void Zt_(Zj2*C){T0*ZxH=Zo;T0*Zx_=Zo;ZxH=ZxP(((C)->ZGb),((C)->Z4c));if((T6)(((ZxH)==((void*)(Zo)))||((T6)(!(ZyW(ZxH)))))){{T81 Zow;Z5G((*(Zow=ZrP(((C)->ZGb)),&Zow))); }ZVZ(Z1G(22,"Invalid explicit type."));}else{(C->ZGb)=ZRZ(C,ZxH);}if((((C)->ZCd))!=((void*)(Zo))){Zx_=ZGH(((C)->ZCd));if(!(ZJG(((C)->ZGb),Zx_))){ ZVZ(Z1G(24," Bad explicit type mark."));}if((Z9G(((C)->ZGb)))!=((void*)(Z9G(Zx_)))){{T81 Zow;Zy_((*(Zow=ZrP(((C)->ZGb)),&Zow)),((C)->ZGb),Zx_); }}}}T0*Zz_=Zo;T0*ZA_=Zo;int ZB_=0;T0*ZC_(void){if(ZB_==0){ZB_=1;{{T47*n=((T47*)Zh(sizeof(*n)));*n=M47;ZA_=((T0*)n);ZtD(n,(T2)(Zxt(2048))); }}}return ZA_;}T0*ZD_=Zo;int ZE_=0;T0*ZF_(void){if(ZE_==0){ZE_=1;{{T51*n=((T51*)Zh(sizeof(*n)));*n=M51;ZD_=((T0*)n);ZG_(n);}}}return ZD_; }T10 ZH_(T42*C,T0*a1){T10 R=0;T81 Z4W={Zo,Zo,0};if(ZrD((T47*)(ZC_()),a1)){R=ZmD((T47*)(ZC_()),a1);}else if((((C)->ZKd))==(Zxt(32764))){ {T0*b1=ZI_;Zmx((T7*)(Z2G),b1);}{T2 b1=(T2)(Zxt(32764));Z6t(b1,Z2G);}{T0*b1=ZJ_;Zmx((T7*)(Z2G),b1);}ZaG((T80*)(Z4G));}else{(C->ZKd)=(Z2)(((((C)->ZKd)))+(ZGs(1))); R=((C)->ZKd);ZsD((T47*)(ZC_()),R,a1);}return R;}void ZK_(T42*C){ZnD((T47*)(ZC_()),(T10)(ZGs(0)),ZjI);ZnD((T47*)(ZC_()),(T10)(ZGs(1)),ZbI); ZnD((T47*)(ZC_()),(T10)(ZGs(2)),ZeI);ZnD((T47*)(ZC_()),(T10)(ZGs(2)),ZdI);ZnD((T47*)(ZC_()),(T10)(ZGs(3)),Z1I);ZnD((T47*)(ZC_()),(T10)(ZGs(4)),ZrI); ZnD((T47*)(ZC_()),(T10)(ZGs(4)),ZqI);ZnD((T47*)(ZC_()),(T10)(ZGs(5)),Z4I);ZnD((T47*)(ZC_()),(T10)(ZGs(5)),ZsI);ZnD((T47*)(ZC_()),(T10)(ZGs(6)),Z_H); ZnD((T47*)(ZC_()),(T10)(ZGs(7)),ZvI);ZnD((T47*)(ZC_()),(T10)(ZGs(8)),ZlI);ZnD((T47*)(ZC_()),(T10)(ZGs(9)),ZOK);ZnD((T47*)(ZC_()),(T10)(ZGs(10)),ZcI); ZnD((T47*)(ZC_()),(T10)(ZGs(11)),ZfI);(C->ZKd)=ZGs(11);if(!((((T43*)(ZSG))->ZTk))){ZL_(C);}}void ZL_(T42*C){T3 Zex=0;T0*ZM_=Zo;T10 ZN_=0; T10 ZO_=0;T0*ZP_=Zo;T1 Zdx=0;T2 ZQ_=0;ZQ_=(T2)(((C)->ZKd));{T44*n=((T44*)Zh(sizeof(*n)));*n=M44;ZP_=((T0*)n);}ZR_((T38*)(ZS_()),ZP_,ZT_((T51*)(ZF_()))); if((((((T44*)ZP_))->Ztc))!=(Zo)){if(((((T44*)ZP_))->ZRh)){Zdx=ZGs(6);}while(!((Z1)((Zdx)>(ZGs(4))))){ZU_(((T44*)ZP_));if(((((T44*)ZP_))->ZRh)){ Zdx=ZGs(5);}else{Zex=((((T44*)ZP_))->ZQh);}{int z1=Zdx;switch(z1){case 0:{int z2=Zex;switch(z2){case 9:case 10:case 13:case 32:break; case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:ZN_=(T10)(ZJs(Zex));Zdx=ZGs(1);break;default:;Zdx=ZGs(6); }}break;case 1:{int z2=Zex;switch(z2){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:ZN_=(Z2)((((Z2)(((ZN_))*(ZGs(10)))))+((T10)(ZJs(Zex)))); break;case 34:ZM_=Zz_;((((T7*)(((T7*)ZM_))))->Zdc)=(ZGs(0));Zdx=ZGs(3);break;case 9:case 32:Zdx=ZGs(2);break;default:;Zdx=ZGs(6);}}break; case 2:{int z2=Zex;switch(z2){case 34:ZM_=Zz_;((((T7*)(((T7*)ZM_))))->Zdc)=(ZGs(0));Zdx=ZGs(3);break;case 9:case 10:case 13:case 32:break; default:;Zdx=ZGs(6);}}break;case 3:{int z2=Zex;switch(z2){case 34:ZO_=(Z2)(((ZO_))+(ZGs(1)));if((Z3)(((T2)(ZN_))>(ZQ_))){ZM_=(((void)((T27*)(ZV_()))),ZCG(ZM_)); ZnD((T47*)(ZC_()),ZN_,ZM_);(C->ZKd)=ZCt(((C)->ZKd),ZN_);}Zdx=ZGs(4);break;case 9:case 10:case 13:Zdx=ZGs(6);break;default:;Zgt(((T7*)ZM_),Zex); }}break;case 4:{int z2=Zex;switch(z2){case 35:Zdx=ZGs(0);break;}}break;}}}ZW_(((T44*)ZP_));if((Zdx)==(ZGs(6))){ZvP((T38*)(ZS_()),Z1G(27,"Corrupted *.id file (after ")); ZSP((T38*)(ZS_()),(T2)(ZO_));ZvP((T38*)(ZS_()),Z1G(17," correct items).\n"));}ZvP((T38*)(ZS_()),ZX_);ZSP((T38*)(ZS_()),(T2)(((C)->ZKd))); ZvP((T38*)(ZS_()),ZY_);}}T0*ZS_(void){if(ZeP==0){ZeP=1;{{T38*n=((T38*)Zh(sizeof(*n)));*n=M38;ZdP=((T0*)n);}}}return ZdP;}T0*ZV_(void){ if(ZTH==0){ZTH=1;{{T27*n=((T27*)Zh(1));ZSH=((T0*)n);ZUH(ZVH);ZUH(ZWH);ZUH(ZXH);ZUH(ZYH);ZUH(ZZH);ZUH(Z_H);ZUH(Z0I);ZUH(Z1I);ZUH(Z2I); ZUH(Z3I);ZUH(Z4I);ZUH(Z5I);ZUH(Z6I);ZUH(Z7I);ZUH(Z8I);ZUH(Z9I);ZUH(ZaI);ZUH(ZbI);ZUH(ZcI);ZUH(ZdI);ZUH(ZeI);ZUH(ZfI);ZUH(ZgI);ZUH(ZhI); ZUH(ZiI);ZUH(ZjI);ZUH(ZkI);ZUH(ZlI);ZUH(ZmI);ZUH(ZnI);ZUH(ZoI);ZUH(ZpI);ZUH(ZqI);ZUH(ZrI);ZUH(ZsI);ZUH(ZtI);ZUH(ZuI);ZUH(ZvI);ZUH(ZwI); ZUH(ZxI);ZUH(ZyI);ZUH(ZzI);ZUH(ZAI);ZUH(ZBI);ZUH(ZCI);ZUH(ZDI);ZUH(ZEI);ZUH(ZFI);ZUH(ZGI);ZUH(ZHI);ZUH(ZII);ZUH(ZJI);ZUH(ZKI);ZUH(ZLI); ZUH(ZMI);ZUH(ZNI);ZUH(ZOI);ZUH(ZPI);ZUH(ZQI);ZUH(ZAG);ZUH(ZzG);ZUH(ZRI);ZUH(ZyG);ZUH(ZxG);ZUH(ZuG);ZUH(ZSI);ZUH(ZvG);ZUH(ZTI);ZUH(ZUI); ZUH(ZVI);ZUH(ZWI);ZUH(ZXI);ZUH(ZtG);ZUH(ZYI);ZUH(ZZI);ZUH(Z_I);ZUH(Z0J);ZUH(Z1J);ZUH(Z2J);ZUH(ZvH);ZUH(Z3J);ZUH(Z4J);ZUH(Z5J);ZUH(Z6J); ZUH(Z7J);ZUH(Z8J);ZUH(Z9J);ZUH(ZaJ);ZUH(ZbJ);ZUH(ZcJ);ZUH(ZdJ);ZUH(ZeJ);ZUH(ZfJ);ZUH(ZgJ);ZUH(ZhJ);ZUH(ZiJ);ZUH(ZjJ);ZUH(ZkJ);ZUH(ZlJ); ZUH(ZmJ);ZUH(ZnJ);ZUH(ZoJ);ZUH(ZpJ);ZUH(ZqJ);ZUH(ZrJ);ZUH(ZsJ);ZUH(ZtJ);ZUH(ZuJ);ZUH(ZvJ);ZUH(ZwJ);ZUH(ZxJ);ZUH(ZyJ);ZUH(ZzJ);ZUH(ZAJ); ZUH(ZBJ);ZUH(ZCJ);ZUH(ZDJ);ZUH(ZEJ);ZUH(ZFJ);ZUH(ZGJ);ZUH(ZHJ);ZUH(ZIJ);ZUH(ZJJ);ZUH(ZKJ);ZUH(ZLJ);ZUH(ZMJ);ZUH(ZNJ);ZUH(ZOJ);ZUH(ZwG); ZUH(ZPJ);ZUH(ZQJ);ZUH(ZRJ);ZUH(ZSJ);ZUH(ZTJ);ZUH(ZUJ);ZUH(ZVJ);ZUH(ZWJ);ZUH(ZXJ);ZUH(ZYJ);ZUH(ZZJ);ZUH(Z_J);ZUH(Z0K);ZUH(Z1K);ZUH(Z2K); ZUH(Z3K);ZUH(Z4K);ZUH(Z5K);ZUH(Z6K);ZUH(Z7K);ZUH(Z8K);ZUH(Z9K);ZUH(ZaK);ZUH(ZbK);ZUH(ZcK);ZUH(ZdK);ZUH(ZeK);ZUH(ZfK);ZUH(ZgK);ZUH(ZhK); ZUH(ZiK);ZUH(ZjK);ZUH(ZkK);ZUH(ZlK);ZUH(ZmK);ZUH(ZnK);ZUH(ZoK);ZUH(ZpK);ZUH(ZqK);ZUH(ZrK);ZUH(ZsK);ZUH(ZtK);ZUH(ZuK);ZUH(ZvK);ZUH(ZwK); ZUH(ZxK);ZUH(ZyK);ZUH(ZzK);ZUH(ZAK);ZUH(ZBK);ZUH(ZCK);ZUH(ZDK);ZUH(ZEK);ZUH(ZFK);ZUH(ZGK);ZUH(ZHK);ZUH(ZIK);ZUH(ZJK);ZUH(ZKK);ZUH(ZLK); ZUH(ZMK);ZUH(ZXH);ZUH(ZNK);ZUH(ZOK);ZUH(ZPK);ZUH(ZQK);ZUH(ZRK);ZUH(ZSK);ZUH(ZTK);ZUH(ZUK);ZUH(ZVK);ZUH(ZWK);ZUH(ZXK);ZUH(ZYK);ZUH(ZZK); }}}return ZSH;}T0*ZZ_(T10 a1){T0*R=Zo;R=ZpD((T47*)(ZC_()),a1);return R;} #ifdef __cplusplus } #endif
berenddeboer/smarteiffel-bdb
install/germ/compile_to_c7.c
C
gpl-2.0
48,429
awsv2s3ios ========== Here's a simple sample app showing how to up/download files from Amazon S3 from your iOS App using Access &amp; Secret Key credentials, i.e. NOT using Cognito which is only available in two regions at the moment.
patsch/awsv2s3ios
README.md
Markdown
gpl-2.0
236
package br.com.sgo.managedbean.cadastro; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import org.primefaces.context.RequestContext; import org.primefaces.event.SelectEvent; import br.com.sgo.dao.administrativo.AdministrativoSessionFacade; import br.com.sgo.model.administrativo.Combustivel; import br.com.sgo.model.administrativo.Marca; import br.com.sgo.model.administrativo.Modelo; import br.com.sgo.model.administrativo.Veiculo; @ManagedBean @ViewScoped public class CadastroVeiculoMBean { private AdministrativoSessionFacade admSession; private List<Veiculo> veiculos = new ArrayList<Veiculo>(); private Veiculo veiculo; private List<Combustivel> combustiveis; private String titulo_dialog; public String getTitulo_dialog() { return titulo_dialog; } @PostConstruct public void init() { admSession = new AdministrativoSessionFacade(); veiculos = admSession.listarVeiculosAtivos(); combustiveis = Arrays.asList(Combustivel.values()); novoVeiculo(); } public List<Combustivel> getCombustiveis() { return combustiveis; } public void setCombustiveis(List<Combustivel> combustiveis) { this.combustiveis = combustiveis; } public void incluirVeiculo() { admSession.salvarVeiculo(veiculo); // Refresh nos veículos listados veiculos = admSession.listarVeiculosAtivos(); novoVeiculo(); } public void selecionarVeiculo(Veiculo veiculo) { this.veiculo = veiculo; titulo_dialog = new String("Editar Veículo"); } public void excluirVeiculo() { admSession.removerVeiculo(veiculo); // Refresh nos veículos listados veiculos = admSession.listarVeiculosAtivos(); novoVeiculo(); } public Veiculo getVeiculo() { return veiculo; } public void setVeiculo(Veiculo veiculo) { this.veiculo = veiculo; } public List<Veiculo> getVeiculos() { return veiculos; } public void setClientes(List<Veiculo> veiculos) { this.veiculos = veiculos; } public void buscarModelo() { Map<String, Object> opcoes = new HashMap<String, Object>(); opcoes.put("resizable", false); opcoes.put("draggable", true); opcoes.put("modal", true); RequestContext.getCurrentInstance().openDialog("buscarModelo", opcoes, null); } public void retBuscarModelo(SelectEvent evt) { Modelo modelo = (Modelo) evt.getObject(); veiculo.setModelo(modelo); } public void novoVeiculo() { Marca marca = new Marca(); Modelo modelo = new Modelo(); modelo.setMarca(marca); veiculo = new Veiculo(); veiculo.setModelo(modelo); veiculo.setAno_fabricacao(Calendar.getInstance().get(Calendar.YEAR)); veiculo.setAno_modelo(Calendar.getInstance().get(Calendar.YEAR)); titulo_dialog = new String("Inclusão de novo Veículo"); } }
rsnatividade/CNRSistemas
sgo/src/main/java/br/com/sgo/managedbean/cadastro/CadastroVeiculoMBean.java
Java
gpl-2.0
3,034
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $URL$ * $Id$ * */ #ifndef TOON_FLUX_H #define TOON_FLUX_H #include "toon/character.h" class ToonEngine; namespace Toon { class CharacterFlux : public Character { public: CharacterFlux(ToonEngine *vm); virtual ~CharacterFlux(); void setPosition(int32 x, int32 y); void playStandingAnim(); void playWalkAnim(int32 start, int32 end); void update(int32 timeIncrement); int32 getRandomIdleAnim(); void setVisible(bool visible); static int32 fixFacingForAnimation(int32 originalFacing, int32 animationId); }; } // End of namespace Toon #endif
tramboi/scummvm-test
engines/toon/flux.h
C
gpl-2.0
1,480
# physincubus.github.io personal webpage
physincubus/physincubus.github.io
README.md
Markdown
gpl-2.0
41
#ifndef TORUS_H #define TORUS_H #include "objects/solid.h" #include "transformer.h" /** * A mathematical torus. * * A torus are the points satisfying * * \f[ (x^2 + y^2 + z^2 + R^2 - r^2)^2 - 4R^2(x^2+y^2) = 0 \f] * * with volume * * \f[ V = \frac{1}{4}\pi^2(r+R)(R-r)^2 \f] * * and surface area * * \f[ A = \pi^2(R^2 - r^2) \f] * * We solve the torus-ray intersection by letting torus be defined by * * \f[ T(x,y,z) = (x^2 + y^2 + z^2 + R^2 - r^2)^2 - 4R^2(x^2+y^2) \f] * * and ray be defined by * * \f[ D(t) = (p_x,p_y,p_z) + t(d_x,d_y,d_z) \f] * * Expanding \f$ T(D(t)) = 0 \f$ gives the quartic equation * * \f[ a_1 t^4 + a_2 t^3 + a_3 t^2 + a_4 t + a_5 = 0\f] * * where * \f[ a_1 = d_x^4 + \left(2d_y^2 + 2d_z^2\right)d_x^2 + \left(d_y^4 + 2d_z^2d_y^2 + d_z^4\right) \f] \f[ a_2 = \left(4d_x^3 + \left(4d_y^2 + 4d_z^2\right)d_x\right)p_x + \left(\left(4d_yp_y + 4d_zp_z\right)d_x^2 + \left(\left(4d_y^3 + 4d_z^2d_y\right)p_y + \left(4d_zp_zd_y^2 + 4d_z^3p_z\right)\right)\right) \f] \f[ a_3 = \left(-2d_x^2 + \left(-2d_y^2 + 2d_z^2\right)\right)R^2 + \left(\left(-2d_x^2 + \left(-2d_y^2 - 2d_z^2\right)\right)r^2 + \left(\left(6d_x^2 + \left(2d_y^2 + 2d_z^2\right)\right)p_x^2 + \left(8d_yp_y + 8d_zp_z\right)d_xp_x + \left(\left(2p_y^2 + 2p_z^2\right)d_x^2 + \left(\left(6d_y^2 + 2d_z^2\right)p_y^2 + 8d_zp_zd_yp_y + \left(2p_z^2d_y^2 + 6d_z^2p_z^2\right)\right)\right)\right)\right) \f] \f[ a_4 = \left(-4d_xp_x + \left(-4d_yp_y + 4d_zp_z\right)\right)R^2 + \left(\left(-4d_xp_x + \left(-4d_yp_y - 4d_zp_z\right)\right)r^2 + \left(4d_xp_x^3 + \left(4d_yp_y + 4d_zp_z\right)p_x^2 + \left(4p_y^2 + 4p_z^2\right)d_xp_x + \left(4d_yp_y^3 + 4d_zp_zp_y^2 + 4p_z^2d_yp_y + 4d_zp_z^3\right)\right)\right) \f] \f[ a_5 = R^4 + \left(-2r^2 + \left(-2p_x^2 + \left(-2p_y^2 + 2p_z^2\right)\right)\right)R^2 + \left(r^4 + \left(-2p_x^2 + \left(-2p_y^2 - 2p_z^2\right)\right)r^2 + \left(p_x^4 + \left(2p_y^2 + 2p_z^2\right)p_x^2 + \left(p_y^4 + 2p_z^2p_y^2 + p_z^4\right)\right)\right) \f] */ class Torus : public Solid, public Transformer { public: /// Constructor Torus(double R, double r, const Material *m); virtual ~Torus(){}; virtual void transform(const Matrix &m); virtual AABox getBoundingBox() const; virtual SceneObject *clone() const; uint32_t allIntersections(const Ray &ray, Intersection *result) const; uint32_t maxIntersections() const; bool inside(const Vector &point) const; double signedDistance(const Vector &p) const; private: double _fastIntersect(const Ray &ray) const; void _fullIntersect(const Ray &ray, const double t, Intersection &result) const; Vector normal(const Vector &point) const; uint32_t allPositiveRoots(const Ray &world_ray, double roots[4]) const; double r; double R; }; #endif
thabz/RayGay
src/objects/torus.h
C
gpl-2.0
2,827
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_55) on Sun Feb 15 12:27:27 PST 2015 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>Serialized Form (Solr 5.0.0 API)</title> <meta name="date" content="2015-02-15"> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Serialized Form (Solr 5.0.0 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="overview-summary.html">Overview</a></li> <li><a href="org/apache/solr/uima/processor/package-summary.html">Package</a></li> <li>Class</li> <li>Use</li> <li><a href="org/apache/solr/uima/processor/package-tree.html">Tree</a></li> <li><a href="deprecated-list.html">Deprecated</a></li> <li><a href="help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="index.html?serialized-form.html" target="_top">Frames</a></li> <li><a href="serialized-form.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Serialized Form" class="title">Serialized Form</h1> </div> <div class="serializedFormContainer"> <ul class="blockList"> <li class="blockList"> <h2 title="Package">Package&nbsp;org.apache.solr.uima.processor</h2> <ul class="blockList"> <li class="blockList"><a name="org.apache.solr.uima.processor.FieldMappingException"> <!-- --> </a> <h3>Class <a href="org/apache/solr/uima/processor/FieldMappingException.html" title="class in org.apache.solr.uima.processor">org.apache.solr.uima.processor.FieldMappingException</a> extends <a href="http://download.oracle.com/javase/7/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a> implements Serializable</h3> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="overview-summary.html">Overview</a></li> <li><a href="org/apache/solr/uima/processor/package-summary.html">Package</a></li> <li>Class</li> <li>Use</li> <li><a href="org/apache/solr/uima/processor/package-tree.html">Tree</a></li> <li><a href="deprecated-list.html">Deprecated</a></li> <li><a href="help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="index.html?serialized-form.html" target="_top">Frames</a></li> <li><a href="serialized-form.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small> <i>Copyright &copy; 2000-2015 Apache Software Foundation. All Rights Reserved.</i> <script src='/prettify.js' type='text/javascript'></script> <script type='text/javascript'> (function(){ var oldonload = window.onload; if (typeof oldonload != 'function') { window.onload = prettyPrint; } else { window.onload = function() { oldonload(); prettyPrint(); } } })(); </script> </small></p> </body> </html>
annieweng/solr_example
solr-5.0.0/docs/solr-uima/serialized-form.html
HTML
gpl-2.0
4,805
/* pmacct (Promiscuous mode IP Accounting package) pmacct is Copyright (C) 2003-2015 by Paolo Lucente */ /* 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. */ /* defines */ #define PLUGIN_ID_CORE 0 #define PLUGIN_ID_MEMORY 1 #define PLUGIN_ID_PRINT 2 #define PLUGIN_ID_NFPROBE 3 #define PLUGIN_ID_SFPROBE 4 #define PLUGIN_ID_MYSQL 5 #define PLUGIN_ID_PGSQL 6 #define PLUGIN_ID_SQLITE3 7 #define PLUGIN_ID_TEE 8 #define PLUGIN_ID_MONGODB 9 #define PLUGIN_ID_AMQP 10 #define PLUGIN_ID_UNKNOWN -1 /* vars */ int protocols_number; /* structures */ static const struct _primitives_matrix_struct _primitives_matrix[] = { /* primitive, pmacctd, uacctd, nfacctd, sfacctd */ {"L2", 1, 1, 1, 1, ""}, {"cos", 1, 0, 1, 1, "Ethernet CoS, 802.1P"}, {"etype", 1, 0, 1, 1, "Ethernet Ethertype"}, {"src_mac", 1, 1, 1, 1, "Source MAC address"}, {"dst_mac", 1, 1, 1, 1, "Destination MAC address"}, {"vlan", 1, 1, 1, 1, "Ethernet VLAN, 802.1Q"}, {"L3", 1, 1, 1, 1, ""}, {"src_host", 1, 1, 1, 1, "Source IPv4/IPv6 address"}, {"dst_host", 1, 1, 1, 1, "Destination IPv4/IPv6 address"}, {"src_mask", 1, 1, 1, 1, "Source network mask"}, {"dst_mask", 1, 1, 1, 1, "Destination network mask"}, {"src_net", 1, 1, 1, 1, "Source IPv4/IPv6 prefix"}, {"dst_net", 1, 1, 1, 1, "Destination IPv4/IPv6 prefix"}, {"proto", 1, 1, 1, 1, "IP protocol"}, {"tos", 1, 1, 1, 1, "IP ToS"}, {"L4", 1, 1, 1, 1, ""}, {"src_port", 1, 1, 1, 1, "Source TCP/UDP port"}, {"dst_port", 1, 1, 1, 1, "Destination TCP/UDP port"}, {"tcpflags", 1, 1, 1, 1, "TCP flags"}, {"BGP", 1, 1, 1, 1, ""}, {"src_as", 1, 1, 1, 1, "Source ASN"}, {"dst_as", 1, 1, 1, 1, "Destination ASN"}, {"as_path", 1, 1, 1, 1, "AS PATH"}, {"std_comm", 1, 1, 1, 1, "Standard Communities"}, {"ext_comm", 1, 1, 1, 1, "Extended Communities"}, {"local_pref", 1, 1, 1, 1, "Local Preference"}, {"med", 1, 1, 1, 1, "Multi-Exit Discriminator"}, {"src_as_path", 1, 1, 1, 1, "Source AS PATH (via reverse BGP lookup)"}, {"src_std_comm", 1, 1, 1, 1, "Source Standard Communities (via reverse BGP lookup)"}, {"src_ext_comm", 1, 1, 1, 1, "Source Extended Communities (via reverse BGP lookup)"}, {"src_local_pref", 1, 1, 1, 1, "Source Local Preference (by default via reverse BGP lookup)"}, {"src_med", 1, 1, 1, 1, "Source MED (by default via reverse BGP lookup)"}, {"mpls_vpn_rd", 0, 0, 1, 1, "MPLS VPN Route Distinguisher"}, {"peer_src_as", 1, 1, 1, 1, "Source peer ASN (by default via reverse BGP lookup)"}, {"peer_dst_as", 1, 1, 1, 1, "Destination peer ASN"}, {"peer_dst_ip", 1, 1, 1, 1, "BGP next-hop"}, {"NAT", 1, 1, 1, 1, ""}, {"fw_event", 0, 0, 1, 0, "Firewall event ID"}, {"nat_event", 0, 0, 1, 0, "NAT event ID"}, {"post_nat_src_host", 0, 0, 1, 0, "Source IPv4/IPv6 address after NAT translation"}, {"post_nat_dst_host", 0, 0, 1, 0, "Destination IPv4/IPv6 address after NAT translation"}, {"post_nat_src_port", 0, 0, 1, 0, "Source TCP/UDP port after NAT translation"}, {"post_nat_dst_port", 0, 0, 1, 0, "Destination TCP/UDP port after NAT translation"}, {"MPLS", 1, 1, 1, 1, ""}, {"mpls_label_bottom", 1, 1, 1, 0, "Bottom MPLS label"}, {"mpls_label_top", 1, 1, 1, 0, "Top MPLS label"}, {"mpls_stack_depth", 1, 1, 1, 0, "MPLS stack depth"}, {"MISC", 1, 1, 1, 1, ""}, {"class", 1, 1, 1, 1, "L7 protocol classification"}, {"flows", 0, 0, 1, 0, "IP flows"}, {"src_host_country", 1, 1, 1, 1, "Source IP address GeoIP resolution: country"}, {"dst_host_country", 1, 1, 1, 1, "Destination IP address GeoIP resolution: country"}, {"in_iface", 0, 1, 1, 1, "Input interface, SNMP ifIndex"}, {"out_iface", 0, 1, 1, 1, "Output interface, SNMP ifIndex"}, {"peer_src_ip", 0, 0, 1, 1, "IP address or identificator of telemetry exporting device"}, {"pkt_len_distrib", 1, 1, 1, 1, "Packet length distribution"}, {"sampling_rate", 1, 1, 1, 1, "Sampling rate"}, {"tag", 1, 1, 1, 1, "Numeric tag, ie. as result of pre_tag_map evaluation"}, {"tag2", 1, 1, 1, 1, "Numeric tag, ie. as result of pre_tag_map evaluation"}, {"label", 1, 1, 1, 1, "String label, ie. as result of pre_tag_map evaluation"}, {"TIME", 1, 1, 1, 1, ""}, {"timestamp_start", 1, 1, 1, 1, "Observation time or flow start time"}, {"timestamp_end", 0, 0, 1, 0, "Flow end time"}, {"", 0, 0, 0, 0, ""} }; static const struct _protocols_struct _protocols[] = { {"ip", 0}, {"icmp", 1}, {"igmp", 2}, {"ggp", 3}, {"4", 4}, {"5", 5}, {"tcp", 6}, {"7", 7}, {"egp", 8}, {"igp", 9}, {"10", 10}, {"11", 11}, {"12", 12}, {"13", 13}, {"14", 14}, {"15", 15}, {"16", 16}, {"udp", 17}, {"mux", 18}, {"19", 19}, {"20", 20}, {"21", 21}, {"22", 22}, {"23", 23}, {"24", 24}, {"25", 25}, {"26", 26}, {"27", 27}, {"28", 28}, {"29", 29}, {"30", 30}, {"31", 31}, {"32", 32}, {"33", 33}, {"34", 34}, {"35", 35}, {"36", 36}, {"37", 37}, {"38", 38}, {"39", 39}, {"40", 40}, {"ipv6", 41}, {"42", 42}, {"ipv6-route", 43}, {"ipv6-frag", 44}, {"45", 45}, {"rsvp", 46}, {"gre", 47}, {"48", 48}, {"49", 49}, {"ipv6-crypt", 50}, {"ipv6-auth", 51}, {"52", 52}, {"53", 53}, {"54", 54}, {"mobile", 55}, {"tlsp", 56}, {"57", 57}, {"ipv6-icmp", 58}, {"ipv6-nonxt", 59}, {"ipv6-opts", 60}, {"61", 61}, {"62", 62}, {"63", 63}, {"64", 64}, {"65", 65}, {"66", 66}, {"67", 67}, {"68", 68}, {"69", 69}, {"70", 70}, {"71", 71}, {"72", 72}, {"73", 73}, {"74", 74}, {"75", 75}, {"76", 76}, {"77", 77}, {"78", 78}, {"79", 79}, {"iso-ip", 80}, {"81", 81}, {"82", 82}, {"vines", 83}, {"84", 84}, {"85", 85}, {"86", 86}, {"87", 87}, {"eigrp", 88}, {"ospf", 89}, {"90", 90}, {"larp", 91}, {"92", 92}, {"ax.25", 93}, {"ipip", 94}, {"95", 95}, {"96", 96}, {"97", 97}, {"encap", 98}, {"99", 99}, {"100", 100}, {"101", 101}, {"pnni", 102}, {"pim", 103}, {"104", 104}, {"105", 105}, {"106", 106}, {"107", 107}, {"IPcomp", 108}, {"109", 109}, {"110", 110}, {"ipx-in-ip", 111}, {"vrrp", 112}, {"113", 113}, {"114", 114}, {"l2tp", 115}, {"116", 116}, {"117", 117}, {"118", 118}, {"119", 119}, {"120", 120}, {"121", 121}, {"122", 122}, {"123", 123}, {"isis", 124}, {"125", 125}, {"126", 126}, {"127", 127}, {"128", 128}, {"129", 129}, {"130", 130}, {"131", 131}, {"sctp", 132}, {"fc", 133}, {"", -1}, }; /* cps = custom primitive semantics */ static const char *cps_type[] = { "", "u", "x", "s", "s", "s", "s" }; static const int cps_flen[] = { 0, 3, 5, 0, 10, 0, 0, 0, 20 }; #if defined __PMACCTD_C || defined __UACCTD_C static struct _devices_struct _devices[] = { #if defined DLT_LOOP {null_handler, DLT_LOOP}, #endif {null_handler, DLT_NULL}, {eth_handler, DLT_EN10MB}, {ppp_handler, DLT_PPP}, {fddi_handler, DLT_FDDI}, {tr_handler, DLT_IEEE802}, #if defined DLT_IEEE802_11 {ieee_802_11_handler, DLT_IEEE802_11}, #endif #if defined DLT_LINUX_SLL {sll_handler, DLT_LINUX_SLL}, #endif #if defined DLT_RAW {raw_handler, DLT_RAW}, #endif #if defined DLT_C_HDLC {chdlc_handler, DLT_C_HDLC}, #endif #ifdef DLT_HDLC {chdlc_handler, DLT_HDLC}, #endif {NULL, -1}, }; #endif #ifdef __CFG_C static const struct _dictionary_line dictionary[] = { {"debug", cfg_key_debug}, {"syslog", cfg_key_syslog}, {"logfile", cfg_key_logfile}, {"pidfile", cfg_key_pidfile}, {"daemonize", cfg_key_daemonize}, {"aggregate", cfg_key_aggregate}, {"aggregate_primitives", cfg_key_aggregate_primitives}, {"snaplen", cfg_key_snaplen}, {"aggregate_filter", cfg_key_aggregate_filter}, {"promisc", cfg_key_promisc}, {"pcap_filter", cfg_key_pcap_filter}, {"core_proc_name", cfg_key_proc_name}, {"pmacctd_as", cfg_key_nfacctd_as_new}, {"uacctd_as", cfg_key_nfacctd_as_new}, {"pmacctd_net", cfg_key_nfacctd_net}, {"uacctd_net", cfg_key_nfacctd_net}, {"use_ip_next_hop", cfg_key_use_ip_next_hop}, {"plugins", NULL}, {"plugin_pipe_size", cfg_key_plugin_pipe_size}, {"plugin_pipe_backlog", cfg_key_plugin_pipe_backlog}, {"plugin_buffer_size", cfg_key_plugin_buffer_size}, {"interface", cfg_key_interface}, {"interface_wait", cfg_key_interface_wait}, {"files_umask", cfg_key_files_umask}, {"files_uid", cfg_key_files_uid}, {"files_gid", cfg_key_files_gid}, {"savefile_wait", cfg_key_savefile_wait}, {"networks_mask", cfg_key_networks_mask}, {"networks_file", cfg_key_networks_file}, {"networks_file_filter", cfg_key_networks_file_filter}, {"networks_cache_entries", cfg_key_networks_cache_entries}, {"ports_file", cfg_key_ports_file}, {"timestamps_secs", cfg_key_timestamps_secs}, {"imt_path", cfg_key_imt_path}, {"imt_passwd", cfg_key_imt_passwd}, {"imt_buckets", cfg_key_imt_buckets}, {"imt_mem_pools_number", cfg_key_imt_mem_pools_number}, {"imt_mem_pools_size", cfg_key_imt_mem_pools_size}, {"sql_db", cfg_key_sql_db}, {"sql_table", cfg_key_sql_table}, {"sql_table_schema", cfg_key_sql_table_schema}, {"sql_table_version", cfg_key_sql_table_version}, {"sql_table_type", cfg_key_sql_table_type}, {"sql_host", cfg_key_sql_host}, {"sql_data", cfg_key_sql_data}, {"sql_backup_host", cfg_key_sql_recovery_backup_host}, /* obsolete */ {"sql_user", cfg_key_sql_user}, {"sql_passwd", cfg_key_sql_passwd}, {"sql_refresh_time", cfg_key_sql_refresh_time}, {"sql_startup_delay", cfg_key_sql_startup_delay}, {"sql_optimize_clauses", cfg_key_sql_optimize_clauses}, {"sql_history", cfg_key_sql_history}, {"sql_history_offset", cfg_key_sql_history_offset}, {"sql_history_roundoff", cfg_key_sql_history_roundoff}, {"sql_history_since_epoch", cfg_key_sql_history_since_epoch}, {"sql_recovery_backup_host", cfg_key_sql_recovery_backup_host}, {"sql_recovery_logfile", cfg_key_sql_recovery_logfile}, {"sql_delimiter", cfg_key_sql_delimiter}, {"sql_max_writers", cfg_key_sql_max_writers}, {"sql_trigger_exec", cfg_key_sql_trigger_exec}, {"sql_trigger_time", cfg_key_sql_trigger_time}, {"sql_cache_entries", cfg_key_sql_cache_entries}, {"sql_dont_try_update", cfg_key_sql_dont_try_update}, {"sql_preprocess", cfg_key_sql_preprocess}, {"sql_preprocess_type", cfg_key_sql_preprocess_type}, {"sql_multi_values", cfg_key_sql_multi_values}, {"sql_aggressive_classification", cfg_key_sql_aggressive_classification}, {"sql_locking_style", cfg_key_sql_locking_style}, {"sql_use_copy", cfg_key_sql_use_copy}, {"sql_num_protos", cfg_key_num_protos}, {"sql_num_hosts", cfg_key_num_hosts}, {"print_refresh_time", cfg_key_sql_refresh_time}, {"print_cache_entries", cfg_key_print_cache_entries}, {"print_markers", cfg_key_print_markers}, {"print_output", cfg_key_print_output}, {"print_output_file", cfg_key_print_output_file}, {"print_output_file_append", cfg_key_print_output_file_append}, {"print_output_separator", cfg_key_print_output_separator}, {"print_latest_file", cfg_key_print_latest_file}, {"print_num_protos", cfg_key_num_protos}, {"print_time_roundoff", cfg_key_sql_history_roundoff}, {"print_trigger_exec", cfg_key_sql_trigger_exec}, {"print_history", cfg_key_sql_history}, {"print_history_offset", cfg_key_sql_history_offset}, {"print_history_roundoff", cfg_key_sql_history_roundoff}, {"print_max_writers", cfg_key_sql_max_writers}, {"print_preprocess", cfg_key_sql_preprocess}, {"print_preprocess_type", cfg_key_sql_preprocess_type}, {"print_startup_delay", cfg_key_sql_startup_delay}, {"mongo_host", cfg_key_sql_host}, {"mongo_table", cfg_key_sql_table}, {"mongo_user", cfg_key_sql_user}, {"mongo_passwd", cfg_key_sql_passwd}, {"mongo_refresh_time", cfg_key_sql_refresh_time}, {"mongo_cache_entries", cfg_key_print_cache_entries}, {"mongo_history", cfg_key_sql_history}, {"mongo_history_offset", cfg_key_sql_history_offset}, {"mongo_history_roundoff", cfg_key_sql_history_roundoff}, {"mongo_time_roundoff", cfg_key_sql_history_roundoff}, {"mongo_trigger_exec", cfg_key_sql_trigger_exec}, {"mongo_insert_batch", cfg_key_mongo_insert_batch}, {"mongo_indexes_file", cfg_key_sql_table_schema}, {"mongo_max_writers", cfg_key_sql_max_writers}, {"mongo_preprocess", cfg_key_sql_preprocess}, {"mongo_preprocess_type", cfg_key_sql_preprocess_type}, {"mongo_startup_delay", cfg_key_sql_startup_delay}, {"mongo_num_protos", cfg_key_num_protos}, {"amqp_refresh_time", cfg_key_sql_refresh_time}, {"amqp_history", cfg_key_sql_history}, {"amqp_history_offset", cfg_key_sql_history_offset}, {"amqp_history_roundoff", cfg_key_sql_history_roundoff}, {"amqp_time_roundoff", cfg_key_sql_history_roundoff}, {"amqp_host", cfg_key_sql_host}, {"amqp_user", cfg_key_sql_user}, {"amqp_passwd", cfg_key_sql_passwd}, {"amqp_exchange", cfg_key_sql_db}, {"amqp_exchange_type", cfg_key_amqp_exchange_type}, {"amqp_routing_key", cfg_key_sql_table}, {"amqp_routing_key_rr", cfg_key_amqp_routing_key_rr}, {"amqp_persistent_msg", cfg_key_amqp_persistent_msg}, {"amqp_frame_max", cfg_key_amqp_frame_max}, {"amqp_cache_entries", cfg_key_print_cache_entries}, {"amqp_max_writers", cfg_key_sql_max_writers}, {"amqp_preprocess", cfg_key_sql_preprocess}, {"amqp_preprocess_type", cfg_key_sql_preprocess_type}, {"amqp_startup_delay", cfg_key_sql_startup_delay}, {"amqp_heartbeat_interval", cfg_key_amqp_heartbeat_interval}, {"amqp_multi_values", cfg_key_sql_multi_values}, {"amqp_num_protos", cfg_key_num_protos}, {"amqp_vhost", cfg_key_amqp_vhost}, {"nfacctd_proc_name", cfg_key_proc_name}, {"nfacctd_port", cfg_key_nfacctd_port}, {"nfacctd_ip", cfg_key_nfacctd_ip}, {"nfacctd_allow_file", cfg_key_nfacctd_allow_file}, {"nfacctd_time_secs", cfg_key_nfacctd_time_secs}, {"nfacctd_time_new", cfg_key_nfacctd_time_new}, {"nfacctd_as_new", cfg_key_nfacctd_as_new}, {"nfacctd_net", cfg_key_nfacctd_net}, {"nfacctd_mcast_groups", cfg_key_nfacctd_mcast_groups}, {"nfacctd_peer_as", cfg_key_nfprobe_peer_as}, {"nfacctd_pipe_size", cfg_key_nfacctd_pipe_size}, {"nfacctd_pro_rating", cfg_key_nfacctd_pro_rating}, {"nfacctd_account_options", cfg_key_nfacctd_account_options}, {"nfacctd_stitching", cfg_key_nfacctd_stitching}, {"nfacctd_ext_sampling_rate", cfg_key_pmacctd_ext_sampling_rate}, {"nfacctd_renormalize", cfg_key_sfacctd_renormalize}, {"nfacctd_disable_checks", cfg_key_nfacctd_disable_checks}, {"pmacctd_proc_name", cfg_key_proc_name}, {"pmacctd_force_frag_handling", cfg_key_pmacctd_force_frag_handling}, {"pmacctd_frag_buffer_size", cfg_key_pmacctd_frag_buffer_size}, {"pmacctd_flow_buffer_size", cfg_key_pmacctd_flow_buffer_size}, {"pmacctd_flow_buffer_buckets", cfg_key_pmacctd_flow_buffer_buckets}, {"pmacctd_conntrack_buffer_size", cfg_key_pmacctd_conntrack_buffer_size}, {"pmacctd_flow_lifetime", cfg_key_pmacctd_flow_lifetime}, {"pmacctd_flow_tcp_lifetime", cfg_key_pmacctd_flow_tcp_lifetime}, {"pmacctd_ext_sampling_rate", cfg_key_pmacctd_ext_sampling_rate}, {"pmacctd_pipe_size", cfg_key_nfacctd_pipe_size}, {"pmacctd_stitching", cfg_key_nfacctd_stitching}, {"pmacctd_renormalize", cfg_key_sfacctd_renormalize}, {"uacctd_proc_name", cfg_key_proc_name}, {"uacctd_force_frag_handling", cfg_key_pmacctd_force_frag_handling}, {"uacctd_frag_buffer_size", cfg_key_pmacctd_frag_buffer_size}, {"uacctd_flow_buffer_size", cfg_key_pmacctd_flow_buffer_size}, {"uacctd_flow_buffer_buckets", cfg_key_pmacctd_flow_buffer_buckets}, {"uacctd_conntrack_buffer_size", cfg_key_pmacctd_conntrack_buffer_size}, {"uacctd_flow_lifetime", cfg_key_pmacctd_flow_lifetime}, {"uacctd_flow_tcp_lifetime", cfg_key_pmacctd_flow_tcp_lifetime}, {"uacctd_ext_sampling_rate", cfg_key_pmacctd_ext_sampling_rate}, {"uacctd_stitching", cfg_key_nfacctd_stitching}, {"uacctd_renormalize", cfg_key_sfacctd_renormalize}, {"pcap_savefile", cfg_key_pcap_savefile}, {"refresh_maps", cfg_key_maps_refresh}, // legacy {"maps_refresh", cfg_key_maps_refresh}, {"maps_index", cfg_key_maps_index}, {"maps_entries", cfg_key_maps_entries}, {"maps_row_len", cfg_key_maps_row_len}, {"pre_tag_map", cfg_key_pre_tag_map}, {"pre_tag_map_entries", cfg_key_maps_entries}, // legacy {"pre_tag_filter", cfg_key_pre_tag_filter}, {"pre_tag2_filter", cfg_key_pre_tag2_filter}, {"pre_tag_label_filter", cfg_key_pre_tag_label_filter}, {"post_tag", cfg_key_post_tag}, {"post_tag2", cfg_key_post_tag2}, {"sampling_rate", cfg_key_sampling_rate}, {"sampling_map", cfg_key_sampling_map}, {"sfacctd_proc_name", cfg_key_proc_name}, {"sfacctd_port", cfg_key_nfacctd_port}, {"sfacctd_ip", cfg_key_nfacctd_ip}, {"sfacctd_allow_file", cfg_key_nfacctd_allow_file}, {"sfacctd_as_new", cfg_key_nfacctd_as_new}, {"sfacctd_net", cfg_key_nfacctd_net}, {"sfacctd_peer_as", cfg_key_nfprobe_peer_as}, {"sfacctd_pipe_size", cfg_key_nfacctd_pipe_size}, {"sfacctd_renormalize", cfg_key_sfacctd_renormalize}, {"sfacctd_disable_checks", cfg_key_nfacctd_disable_checks}, {"sfacctd_mcast_groups", cfg_key_nfacctd_mcast_groups}, {"sfacctd_stitching", cfg_key_nfacctd_stitching}, {"sfacctd_ext_sampling_rate", cfg_key_pmacctd_ext_sampling_rate}, {"classifiers", cfg_key_classifiers}, {"classifier_tentatives", cfg_key_classifier_tentatives}, {"classifier_table_num", cfg_key_classifier_table_num}, {"nfprobe_timeouts", cfg_key_nfprobe_timeouts}, {"nfprobe_hoplimit", cfg_key_nfprobe_hoplimit}, {"nfprobe_maxflows", cfg_key_nfprobe_maxflows}, {"nfprobe_receiver", cfg_key_nfprobe_receiver}, {"nfprobe_engine", cfg_key_nfprobe_engine}, {"nfprobe_version", cfg_key_nfprobe_version}, {"nfprobe_peer_as", cfg_key_nfprobe_peer_as}, {"nfprobe_source_ip", cfg_key_nfprobe_source_ip}, {"nfprobe_ipprec", cfg_key_nfprobe_ip_precedence}, {"nfprobe_direction", cfg_key_nfprobe_direction}, {"nfprobe_ifindex", cfg_key_nfprobe_ifindex}, {"sfprobe_receiver", cfg_key_sfprobe_receiver}, {"sfprobe_agentip", cfg_key_sfprobe_agentip}, {"sfprobe_agentsubid", cfg_key_sfprobe_agentsubid}, {"sfprobe_peer_as", cfg_key_nfprobe_peer_as}, {"sfprobe_ipprec", cfg_key_nfprobe_ip_precedence}, {"sfprobe_direction", cfg_key_nfprobe_direction}, {"sfprobe_ifindex", cfg_key_nfprobe_ifindex}, {"sfprobe_ifspeed", cfg_key_sfprobe_ifspeed}, {"tee_receiver", cfg_key_nfprobe_receiver}, {"tee_receivers", cfg_key_tee_receivers}, {"tee_source_ip", cfg_key_nfprobe_source_ip}, {"tee_transparent", cfg_key_tee_transparent}, {"tee_max_receivers", cfg_key_tee_max_receivers}, {"tee_max_receiver_pools", cfg_key_tee_max_receiver_pools}, {"tee_ipprec", cfg_key_nfprobe_ip_precedence}, {"tee_pipe_size", cfg_key_tee_pipe_size}, {"bgp_daemon", cfg_key_nfacctd_bgp}, {"bgp_daemon_ip", cfg_key_nfacctd_bgp_ip}, {"bgp_daemon_id", cfg_key_nfacctd_bgp_id}, {"bgp_daemon_port", cfg_key_nfacctd_bgp_port}, {"bgp_daemon_pipe_size", cfg_key_nfacctd_bgp_pipe_size}, {"bgp_daemon_max_peers", cfg_key_nfacctd_bgp_max_peers}, {"bgp_daemon_msglog_output", cfg_key_nfacctd_bgp_msglog_output}, {"bgp_daemon_msglog_file", cfg_key_nfacctd_bgp_msglog_file}, {"bgp_daemon_msglog_amqp_host", cfg_key_nfacctd_bgp_msglog_amqp_host}, {"bgp_daemon_msglog_amqp_vhost", cfg_key_nfacctd_bgp_msglog_amqp_vhost}, {"bgp_daemon_msglog_amqp_user", cfg_key_nfacctd_bgp_msglog_amqp_user}, {"bgp_daemon_msglog_amqp_passwd", cfg_key_nfacctd_bgp_msglog_amqp_passwd}, {"bgp_daemon_msglog_amqp_exchange", cfg_key_nfacctd_bgp_msglog_amqp_exchange}, {"bgp_daemon_msglog_amqp_exchange_type", cfg_key_nfacctd_bgp_msglog_amqp_exchange_type}, {"bgp_daemon_msglog_amqp_routing_key", cfg_key_nfacctd_bgp_msglog_amqp_routing_key}, {"bgp_daemon_msglog_amqp_routing_key_rr", cfg_key_nfacctd_bgp_msglog_amqp_routing_key_rr}, {"bgp_daemon_msglog_amqp_persistent_msg", cfg_key_nfacctd_bgp_msglog_amqp_persistent_msg}, {"bgp_daemon_msglog_amqp_frame_max", cfg_key_nfacctd_bgp_msglog_amqp_frame_max}, {"bgp_daemon_msglog_amqp_heartbeat_interval", cfg_key_nfacctd_bgp_msglog_amqp_heartbeat_interval}, {"bgp_daemon_msglog_amqp_retry", cfg_key_nfacctd_bgp_msglog_amqp_retry}, {"bgp_daemon_allow_file", cfg_key_nfacctd_bgp_allow_file}, {"bgp_daemon_ipprec", cfg_key_nfacctd_bgp_ip_precedence}, {"bgp_daemon_md5_file", cfg_key_nfacctd_bgp_md5_file}, {"bgp_daemon_batch", cfg_key_nfacctd_bgp_batch}, {"bgp_daemon_batch_interval", cfg_key_nfacctd_bgp_batch_interval}, {"bgp_aspath_radius", cfg_key_nfacctd_bgp_aspath_radius}, {"bgp_stdcomm_pattern", cfg_key_nfacctd_bgp_stdcomm_pattern}, {"bgp_extcomm_pattern", cfg_key_nfacctd_bgp_extcomm_pattern}, {"bgp_stdcomm_pattern_to_asn", cfg_key_nfacctd_bgp_stdcomm_pattern_to_asn}, {"bgp_peer_as_skip_subas", cfg_key_nfacctd_bgp_peer_as_skip_subas}, {"bgp_peer_src_as_map", cfg_key_nfacctd_bgp_peer_src_as_map}, {"bgp_src_local_pref_map", cfg_key_nfacctd_bgp_src_local_pref_map}, {"bgp_src_med_map", cfg_key_nfacctd_bgp_src_med_map}, {"bgp_peer_src_as_type", cfg_key_nfacctd_bgp_peer_src_as_type}, {"bgp_src_std_comm_type", cfg_key_nfacctd_bgp_src_std_comm_type}, {"bgp_src_ext_comm_type", cfg_key_nfacctd_bgp_src_ext_comm_type}, {"bgp_src_as_path_type", cfg_key_nfacctd_bgp_src_as_path_type}, {"bgp_src_local_pref_type", cfg_key_nfacctd_bgp_src_local_pref_type}, {"bgp_src_med_type", cfg_key_nfacctd_bgp_src_med_type}, {"bgp_agent_map", cfg_key_nfacctd_bgp_to_agent_map}, {"bgp_follow_default", cfg_key_nfacctd_bgp_follow_default}, {"bgp_follow_nexthop", cfg_key_nfacctd_bgp_follow_nexthop}, {"bgp_neighbors_file", cfg_key_nfacctd_bgp_neighbors_file}, {"bgp_table_peer_buckets", cfg_key_nfacctd_bgp_table_peer_buckets}, {"bgp_table_per_peer_buckets", cfg_key_nfacctd_bgp_table_per_peer_buckets}, {"bgp_table_attr_hash_buckets", cfg_key_nfacctd_bgp_table_attr_hash_buckets}, {"bgp_table_per_peer_hash", cfg_key_nfacctd_bgp_table_per_peer_hash}, {"bgp_table_dump_output", cfg_key_nfacctd_bgp_table_dump_output}, {"bgp_table_dump_file", cfg_key_nfacctd_bgp_table_dump_file}, {"bgp_table_dump_refresh_time", cfg_key_nfacctd_bgp_table_dump_refresh_time}, {"bgp_table_dump_amqp_host", cfg_key_nfacctd_bgp_table_dump_amqp_host}, {"bgp_table_dump_amqp_vhost", cfg_key_nfacctd_bgp_table_dump_amqp_vhost}, {"bgp_table_dump_amqp_user", cfg_key_nfacctd_bgp_table_dump_amqp_user}, {"bgp_table_dump_amqp_passwd", cfg_key_nfacctd_bgp_table_dump_amqp_passwd}, {"bgp_table_dump_amqp_exchange", cfg_key_nfacctd_bgp_table_dump_amqp_exchange}, {"bgp_table_dump_amqp_exchange_type", cfg_key_nfacctd_bgp_table_dump_amqp_exchange_type}, {"bgp_table_dump_amqp_routing_key", cfg_key_nfacctd_bgp_table_dump_amqp_routing_key}, {"bgp_table_dump_amqp_routing_key_rr", cfg_key_nfacctd_bgp_table_dump_amqp_routing_key_rr}, {"bgp_table_dump_amqp_persistent_msg", cfg_key_nfacctd_bgp_table_dump_amqp_persistent_msg}, {"bgp_table_dump_amqp_frame_max", cfg_key_nfacctd_bgp_table_dump_amqp_frame_max}, {"bgp_table_dump_amqp_heartbeat_interval", cfg_key_nfacctd_bgp_table_dump_amqp_heartbeat_interval}, {"bmp_daemon", cfg_key_nfacctd_bmp}, {"bmp_daemon_ip", cfg_key_nfacctd_bmp_ip}, {"bmp_daemon_port", cfg_key_nfacctd_bmp_port}, {"bmp_daemon_pipe_size", cfg_key_nfacctd_bmp_pipe_size}, {"bmp_daemon_max_peers", cfg_key_nfacctd_bmp_max_peers}, {"bmp_daemon_allow_file", cfg_key_nfacctd_bmp_allow_file}, {"bmp_daemon_ipprec", cfg_key_nfacctd_bmp_ip_precedence}, {"bmp_daemon_batch", cfg_key_nfacctd_bmp_batch}, {"bmp_daemon_batch_interval", cfg_key_nfacctd_bmp_batch_interval}, {"bmp_daemon_msglog_output", cfg_key_nfacctd_bmp_msglog_output}, {"bmp_daemon_msglog_file", cfg_key_nfacctd_bmp_msglog_file}, {"bmp_daemon_msglog_amqp_host", cfg_key_nfacctd_bmp_msglog_amqp_host}, {"bmp_daemon_msglog_amqp_vhost", cfg_key_nfacctd_bmp_msglog_amqp_vhost}, {"bmp_daemon_msglog_amqp_user", cfg_key_nfacctd_bmp_msglog_amqp_user}, {"bmp_daemon_msglog_amqp_passwd", cfg_key_nfacctd_bmp_msglog_amqp_passwd}, {"bmp_daemon_msglog_amqp_exchange", cfg_key_nfacctd_bmp_msglog_amqp_exchange}, {"bmp_daemon_msglog_amqp_exchange_type", cfg_key_nfacctd_bmp_msglog_amqp_exchange_type}, {"bmp_daemon_msglog_amqp_routing_key", cfg_key_nfacctd_bmp_msglog_amqp_routing_key}, {"bmp_daemon_msglog_amqp_routing_key_rr", cfg_key_nfacctd_bmp_msglog_amqp_routing_key_rr}, {"bmp_daemon_msglog_amqp_persistent_msg", cfg_key_nfacctd_bmp_msglog_amqp_persistent_msg}, {"bmp_daemon_msglog_amqp_frame_max", cfg_key_nfacctd_bmp_msglog_amqp_frame_max}, {"bmp_daemon_msglog_amqp_heartbeat_interval", cfg_key_nfacctd_bmp_msglog_amqp_heartbeat_interval}, {"bmp_daemon_msglog_amqp_retry", cfg_key_nfacctd_bmp_msglog_amqp_retry}, {"bmp_neighbors_file", cfg_key_nfacctd_bmp_neighbors_file}, {"bmp_table_peer_buckets", cfg_key_nfacctd_bmp_table_peer_buckets}, {"bmp_table_per_peer_buckets", cfg_key_nfacctd_bmp_table_per_peer_buckets}, {"bmp_table_attr_hash_buckets", cfg_key_nfacctd_bmp_table_attr_hash_buckets}, {"bmp_table_per_peer_hash", cfg_key_nfacctd_bmp_table_per_peer_hash}, {"bmp_dump_output", cfg_key_nfacctd_bmp_dump_output}, {"bmp_dump_file", cfg_key_nfacctd_bmp_dump_file}, {"bmp_dump_refresh_time", cfg_key_nfacctd_bmp_dump_refresh_time}, {"bmp_dump_amqp_host", cfg_key_nfacctd_bmp_dump_amqp_host}, {"bmp_dump_amqp_vhost", cfg_key_nfacctd_bmp_dump_amqp_vhost}, {"bmp_dump_amqp_user", cfg_key_nfacctd_bmp_dump_amqp_user}, {"bmp_dump_amqp_passwd", cfg_key_nfacctd_bmp_dump_amqp_passwd}, {"bmp_dump_amqp_exchange", cfg_key_nfacctd_bmp_dump_amqp_exchange}, {"bmp_dump_amqp_exchange_type", cfg_key_nfacctd_bmp_dump_amqp_exchange_type}, {"bmp_dump_amqp_routing_key", cfg_key_nfacctd_bmp_dump_amqp_routing_key}, {"bmp_dump_amqp_routing_key_rr", cfg_key_nfacctd_bmp_dump_amqp_routing_key_rr}, {"bmp_dump_amqp_persistent_msg", cfg_key_nfacctd_bmp_dump_amqp_persistent_msg}, {"bmp_dump_amqp_frame_max", cfg_key_nfacctd_bmp_dump_amqp_frame_max}, {"bmp_dump_amqp_heartbeat_interval", cfg_key_nfacctd_bmp_dump_amqp_heartbeat_interval}, {"flow_to_rd_map", cfg_key_nfacctd_flow_to_rd_map}, {"isis_daemon", cfg_key_nfacctd_isis}, {"isis_daemon_ip", cfg_key_nfacctd_isis_ip}, {"isis_daemon_net", cfg_key_nfacctd_isis_net}, {"isis_daemon_iface", cfg_key_nfacctd_isis_iface}, {"isis_daemon_mtu", cfg_key_nfacctd_isis_mtu}, {"isis_daemon_msglog", cfg_key_nfacctd_isis_msglog}, {"igp_daemon", cfg_key_nfacctd_isis}, {"igp_daemon_map", cfg_key_igp_daemon_map}, {"igp_daemon_map_msglog", cfg_key_igp_daemon_map_msglog}, #if defined WITH_GEOIP {"geoip_ipv4_file", cfg_key_geoip_ipv4_file}, #if defined ENABLE_IPV6 {"geoip_ipv6_file", cfg_key_geoip_ipv6_file}, #endif #endif {"uacctd_group", cfg_key_uacctd_group}, {"uacctd_nl_size", cfg_key_uacctd_nl_size}, {"tunnel_0", cfg_key_tunnel_0}, {"pkt_len_distrib_bins", cfg_key_pkt_len_distrib_bins}, {"tmp_net_own_field", cfg_key_tmp_net_own_field}, {"", NULL}, }; static struct plugin_type_entry plugin_types_list[] = { {PLUGIN_ID_CORE, "core", NULL}, {PLUGIN_ID_MEMORY, "memory", imt_plugin}, {PLUGIN_ID_PRINT, "print", print_plugin}, {PLUGIN_ID_NFPROBE, "nfprobe", nfprobe_plugin}, {PLUGIN_ID_SFPROBE, "sfprobe", sfprobe_plugin}, #ifdef WITH_MYSQL {PLUGIN_ID_MYSQL, "mysql", mysql_plugin}, #endif #ifdef WITH_PGSQL {PLUGIN_ID_PGSQL, "pgsql", pgsql_plugin}, #endif #ifdef WITH_SQLITE3 {PLUGIN_ID_SQLITE3, "sqlite3", sqlite3_plugin}, #endif #ifdef WITH_MONGODB {PLUGIN_ID_MONGODB, "mongodb", mongodb_plugin}, #endif #ifdef WITH_RABBITMQ {PLUGIN_ID_AMQP, "amqp", amqp_plugin}, #endif {PLUGIN_ID_TEE, "tee", tee_plugin}, {PLUGIN_ID_UNKNOWN, "", NULL}, }; #endif #ifdef __NL_C static struct tunnel_entry tunnel_handlers_list[] = { {"gtp", gtp_tunnel_func, gtp_tunnel_configurator}, {"", NULL, NULL}, }; #endif
Wintereise/pmacct
src/pmacct-data.h
C
gpl-2.0
28,543
/* * linux/drivers/cpufreq/cpufreq.c * * Copyright (C) 2001 Russell King * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> * * Oct 2005 - Ashok Raj <ashok.raj@intel.com> * Added handling for CPU hotplug * Feb 2006 - Jacob Shin <jacob.shin@amd.com> * Fix handling for CPU hotplug -- affected CPUs * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/notifier.h> #include <linux/cpufreq.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/spinlock.h> #include <linux/device.h> #include <linux/slab.h> #include <linux/cpu.h> #include <linux/completion.h> #include <linux/mutex.h> #include <linux/syscore_ops.h> #include <trace/events/power.h> /** * The "cpufreq driver" - the arch- or hardware-dependent low * level driver of CPUFreq support, and its spinlock. This lock * also protects the cpufreq_cpu_data array. */ static struct cpufreq_driver *cpufreq_driver; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); #ifdef CONFIG_HOTPLUG_CPU /* This one keeps track of the previously set governor of a removed CPU */ struct cpufreq_cpu_save_data { char gov[CPUFREQ_NAME_LEN]; unsigned int max, min; }; static DEFINE_PER_CPU(struct cpufreq_cpu_save_data, cpufreq_policy_save); #endif static DEFINE_SPINLOCK(cpufreq_driver_lock); /* * cpu_policy_rwsem is a per CPU reader-writer semaphore designed to cure * all cpufreq/hotplug/workqueue/etc related lock issues. * * The rules for this semaphore: * - Any routine that wants to read from the policy structure will * do a down_read on this semaphore. * - Any routine that will write to the policy structure and/or may take away * the policy altogether (eg. CPU hotplug), will hold this lock in write * mode before doing so. * * Additional rules: * - All holders of the lock should check to make sure that the CPU they * are concerned with are online after they get the lock. * - Governor routines that can be called in cpufreq hotplug path should not * take this sem as top level hotplug notifier handler takes this. * - Lock should not be held across * __cpufreq_governor(data, CPUFREQ_GOV_STOP); */ static DEFINE_PER_CPU(int, cpufreq_policy_cpu); static DEFINE_PER_CPU(struct rw_semaphore, cpu_policy_rwsem); #define lock_policy_rwsem(mode, cpu) \ int lock_policy_rwsem_##mode \ (int cpu) \ { \ int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu); \ BUG_ON(policy_cpu == -1); \ down_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu)); \ if (unlikely(!cpu_online(cpu))) { \ up_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu)); \ return -1; \ } \ \ return 0; \ } lock_policy_rwsem(read, cpu); lock_policy_rwsem(write, cpu); static void unlock_policy_rwsem_read(int cpu) { int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu); BUG_ON(policy_cpu == -1); up_read(&per_cpu(cpu_policy_rwsem, policy_cpu)); } void unlock_policy_rwsem_write(int cpu) { int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu); BUG_ON(policy_cpu == -1); up_write(&per_cpu(cpu_policy_rwsem, policy_cpu)); } /* internal prototypes */ static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); static unsigned int __cpufreq_get(unsigned int cpu); static void handle_update(struct work_struct *work); /** * Two notifier lists: the "policy" list is involved in the * validation process for a new CPU frequency policy; the * "transition" list for kernel code that needs to handle * changes to devices when the CPU clock speed changes. * The mutex locks both lists. */ static BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list); static struct srcu_notifier_head cpufreq_transition_notifier_list; static bool init_cpufreq_transition_notifier_list_called; static int __init init_cpufreq_transition_notifier_list(void) { srcu_init_notifier_head(&cpufreq_transition_notifier_list); init_cpufreq_transition_notifier_list_called = true; return 0; } pure_initcall(init_cpufreq_transition_notifier_list); static LIST_HEAD(cpufreq_governor_list); static DEFINE_MUTEX(cpufreq_governor_mutex); static struct cpufreq_policy *__cpufreq_cpu_get(unsigned int cpu, int sysfs) { struct cpufreq_policy *data; unsigned long flags; if (cpu >= nr_cpu_ids) goto err_out; /* get the cpufreq driver */ spin_lock_irqsave(&cpufreq_driver_lock, flags); if (!cpufreq_driver) goto err_out_unlock; if (!try_module_get(cpufreq_driver->owner)) goto err_out_unlock; /* get the CPU */ data = per_cpu(cpufreq_cpu_data, cpu); if (!data) goto err_out_put_module; if (!sysfs && !kobject_get(&data->kobj)) goto err_out_put_module; spin_unlock_irqrestore(&cpufreq_driver_lock, flags); return data; err_out_put_module: module_put(cpufreq_driver->owner); err_out_unlock: spin_unlock_irqrestore(&cpufreq_driver_lock, flags); err_out: return NULL; } struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) { return __cpufreq_cpu_get(cpu, 0); } EXPORT_SYMBOL_GPL(cpufreq_cpu_get); static struct cpufreq_policy *cpufreq_cpu_get_sysfs(unsigned int cpu) { return __cpufreq_cpu_get(cpu, 1); } static void __cpufreq_cpu_put(struct cpufreq_policy *data, int sysfs) { if (!sysfs) kobject_put(&data->kobj); module_put(cpufreq_driver->owner); } void cpufreq_cpu_put(struct cpufreq_policy *data) { __cpufreq_cpu_put(data, 0); } EXPORT_SYMBOL_GPL(cpufreq_cpu_put); static void cpufreq_cpu_put_sysfs(struct cpufreq_policy *data) { __cpufreq_cpu_put(data, 1); } /********************************************************************* * EXTERNALLY AFFECTING FREQUENCY CHANGES * *********************************************************************/ /** * adjust_jiffies - adjust the system "loops_per_jiffy" * * This function alters the system "loops_per_jiffy" for the clock * speed change. Note that loops_per_jiffy cannot be updated on SMP * systems as each CPU might be scaled differently. So, use the arch * per-CPU loops_per_jiffy value wherever possible. */ #ifndef CONFIG_SMP static unsigned long l_p_j_ref; static unsigned int l_p_j_ref_freq; static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) { if (ci->flags & CPUFREQ_CONST_LOOPS) return; if (!l_p_j_ref_freq) { l_p_j_ref = loops_per_jiffy; l_p_j_ref_freq = ci->old; pr_debug("saving %lu as reference value for loops_per_jiffy; " "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq); } if ((val == CPUFREQ_PRECHANGE && ci->old < ci->new) || (val == CPUFREQ_POSTCHANGE && ci->old > ci->new) || (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, ci->new); pr_debug("scaling loops_per_jiffy to %lu " "for frequency %u kHz\n", loops_per_jiffy, ci->new); } } #else static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) { return; } #endif /** * cpufreq_notify_transition - call notifier chain and adjust_jiffies * on frequency transition. * * This function calls the transition notifiers and the "adjust_jiffies" * function. It is called twice on all CPU frequency changes that have * external effects. */ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) { struct cpufreq_policy *policy; BUG_ON(irqs_disabled()); freqs->flags = cpufreq_driver->flags; pr_debug("notification %u of frequency transition to %u kHz\n", state, freqs->new); policy = per_cpu(cpufreq_cpu_data, freqs->cpu); switch (state) { case CPUFREQ_PRECHANGE: /* detect if the driver reported a value as "old frequency" * which is not equal to what the cpufreq core thinks is * "old frequency". */ if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { if ((policy) && (policy->cpu == freqs->cpu) && (policy->cur) && (policy->cur != freqs->old)) { pr_debug("Warning: CPU frequency is" " %u, cpufreq assumed %u kHz.\n", freqs->old, policy->cur); freqs->old = policy->cur; } } srcu_notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_PRECHANGE, freqs); adjust_jiffies(CPUFREQ_PRECHANGE, freqs); break; case CPUFREQ_POSTCHANGE: adjust_jiffies(CPUFREQ_POSTCHANGE, freqs); pr_debug("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new, (unsigned long)freqs->cpu); trace_power_frequency(POWER_PSTATE, freqs->new, freqs->cpu); trace_cpu_frequency(freqs->new, freqs->cpu); srcu_notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_POSTCHANGE, freqs); if (likely(policy) && likely(policy->cpu == freqs->cpu)) { policy->cur = freqs->new; sysfs_notify(&policy->kobj, NULL, "scaling_cur_freq"); } break; } } EXPORT_SYMBOL_GPL(cpufreq_notify_transition); /** * cpufreq_notify_utilization - notify CPU userspace about CPU utilization * change * * This function is called everytime the CPU load is evaluated by the * ondemand governor. It notifies userspace of cpu load changes via sysfs. */ void cpufreq_notify_utilization(struct cpufreq_policy *policy, unsigned int util) { if (policy) policy->util = util; if (policy->util >= MIN_CPU_UTIL_NOTIFY) sysfs_notify(&policy->kobj, NULL, "cpu_utilization"); } /********************************************************************* * SYSFS INTERFACE * *********************************************************************/ static struct cpufreq_governor *__find_governor(const char *str_governor) { struct cpufreq_governor *t; list_for_each_entry(t, &cpufreq_governor_list, governor_list) if (!strnicmp(str_governor, t->name, CPUFREQ_NAME_LEN)) return t; return NULL; } /** * cpufreq_parse_governor - parse a governor string */ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy, struct cpufreq_governor **governor) { int err = -EINVAL; if (!cpufreq_driver) goto out; if (cpufreq_driver->setpolicy) { if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) { *policy = CPUFREQ_POLICY_PERFORMANCE; err = 0; } else if (!strnicmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) { *policy = CPUFREQ_POLICY_POWERSAVE; err = 0; } } else if (cpufreq_driver->target) { struct cpufreq_governor *t; mutex_lock(&cpufreq_governor_mutex); t = __find_governor(str_governor); if (t == NULL) { int ret; mutex_unlock(&cpufreq_governor_mutex); ret = request_module("cpufreq_%s", str_governor); mutex_lock(&cpufreq_governor_mutex); if (ret == 0) t = __find_governor(str_governor); } if (t != NULL) { *governor = t; err = 0; } mutex_unlock(&cpufreq_governor_mutex); } out: return err; } /** * cpufreq_per_cpu_attr_read() / show_##file_name() - * print out cpufreq information * * Write out information from cpufreq_driver->policy[cpu]; object must be * "unsigned int". */ #define show_one(file_name, object) \ static ssize_t show_##file_name \ (struct cpufreq_policy *policy, char *buf) \ { \ return sprintf(buf, "%u\n", policy->object); \ } show_one(cpuinfo_min_freq, cpuinfo.min_freq); show_one(cpuinfo_max_freq, cpuinfo.max_freq); show_one(cpuinfo_transition_latency, cpuinfo.transition_latency); show_one(scaling_min_freq, min); show_one(scaling_max_freq, max); show_one(scaling_cur_freq, cur); show_one(cpu_utilization, util); static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy); /** * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access */ #define store_one(file_name, object) \ static ssize_t store_##file_name \ (struct cpufreq_policy *policy, const char *buf, size_t count) \ { \ unsigned int ret = -EINVAL; \ struct cpufreq_policy new_policy; \ \ ret = cpufreq_get_policy(&new_policy, policy->cpu); \ if (ret) \ return -EINVAL; \ \ ret = sscanf(buf, "%u", &new_policy.object); \ if (ret != 1) \ return -EINVAL; \ \ ret = __cpufreq_set_policy(policy, &new_policy); \ policy->user_policy.object = policy->object; \ \ return ret ? ret : count; \ } store_one(scaling_min_freq, min); store_one(scaling_max_freq, max); /** * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware */ static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy, char *buf) { unsigned int cur_freq = __cpufreq_get(policy->cpu); if (!cur_freq) return sprintf(buf, "<unknown>"); return sprintf(buf, "%u\n", cur_freq); } /** * show_scaling_governor - show the current policy for the specified CPU */ static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf) { if (policy->policy == CPUFREQ_POLICY_POWERSAVE) return sprintf(buf, "powersave\n"); else if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) return sprintf(buf, "performance\n"); else if (policy->governor) return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n", policy->governor->name); return -EINVAL; } /** * store_scaling_governor - store policy for the specified CPU */ static ssize_t store_scaling_governor(struct cpufreq_policy *policy, const char *buf, size_t count) { unsigned int ret = -EINVAL; char str_governor[16]; struct cpufreq_policy new_policy; char *envp[3]; char buf1[64]; char buf2[64]; ret = cpufreq_get_policy(&new_policy, policy->cpu); if (ret) return ret; ret = sscanf(buf, "%15s", str_governor); if (ret != 1) return -EINVAL; if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) return -EINVAL; /* Do not use cpufreq_set_policy here or the user_policy.max will be wrongly overridden */ ret = __cpufreq_set_policy(policy, &new_policy); policy->user_policy.policy = policy->policy; policy->user_policy.governor = policy->governor; sysfs_notify(&policy->kobj, NULL, "scaling_governor"); snprintf(buf1, sizeof(buf1), "GOV=%s", policy->governor->name); snprintf(buf2, sizeof(buf2), "CPU=%u", policy->cpu); envp[0] = buf1; envp[1] = buf2; envp[2] = NULL; kobject_uevent_env(cpufreq_global_kobject, KOBJ_ADD, envp); if (ret) return ret; else return count; } /** * show_scaling_driver - show the cpufreq driver currently loaded */ static ssize_t show_scaling_driver(struct cpufreq_policy *policy, char *buf) { return scnprintf(buf, CPUFREQ_NAME_LEN, "%s\n", cpufreq_driver->name); } /** * show_scaling_available_governors - show the available CPUfreq governors */ static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy, char *buf) { ssize_t i = 0; struct cpufreq_governor *t; if (!cpufreq_driver->target) { i += sprintf(buf, "performance powersave"); goto out; } list_for_each_entry(t, &cpufreq_governor_list, governor_list) { if (i >= (ssize_t) ((PAGE_SIZE / sizeof(char)) - (CPUFREQ_NAME_LEN + 2))) goto out; i += scnprintf(&buf[i], CPUFREQ_NAME_LEN, "%s ", t->name); } out: i += sprintf(&buf[i], "\n"); return i; } static ssize_t show_cpus(const struct cpumask *mask, char *buf) { ssize_t i = 0; unsigned int cpu; for_each_cpu(cpu, mask) { if (i) i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), " "); i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), "%u", cpu); if (i >= (PAGE_SIZE - 5)) break; } i += sprintf(&buf[i], "\n"); return i; } /** * show_related_cpus - show the CPUs affected by each transition even if * hw coordination is in use */ static ssize_t show_related_cpus(struct cpufreq_policy *policy, char *buf) { if (cpumask_empty(policy->related_cpus)) return show_cpus(policy->cpus, buf); return show_cpus(policy->related_cpus, buf); } /** * show_affected_cpus - show the CPUs affected by each transition */ static ssize_t show_affected_cpus(struct cpufreq_policy *policy, char *buf) { return show_cpus(policy->cpus, buf); } static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy, const char *buf, size_t count) { unsigned int freq = 0; unsigned int ret; if (!policy->governor || !policy->governor->store_setspeed) return -EINVAL; ret = sscanf(buf, "%u", &freq); if (ret != 1) return -EINVAL; policy->governor->store_setspeed(policy, freq); return count; } static ssize_t show_scaling_setspeed(struct cpufreq_policy *policy, char *buf) { if (!policy->governor || !policy->governor->show_setspeed) return sprintf(buf, "<unsupported>\n"); return policy->governor->show_setspeed(policy, buf); } /** * show_scaling_driver - show the current cpufreq HW/BIOS limitation */ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf) { unsigned int limit; int ret; if (cpufreq_driver->bios_limit) { ret = cpufreq_driver->bios_limit(policy->cpu, &limit); if (!ret) return sprintf(buf, "%u\n", limit); } return sprintf(buf, "%u\n", policy->cpuinfo.max_freq); } #ifdef CONFIG_CPU_VOLTAGE_TABLE extern ssize_t acpuclk_get_vdd_levels_str(char *buf); extern void acpuclk_set_vdd(unsigned acpu_khz, int vdd); static ssize_t show_vdd_levels(struct kobject *a, struct attribute *b, char *buf) { return acpuclk_get_vdd_levels_str(buf); } static ssize_t store_vdd_levels(struct kobject *a, struct attribute *b, const char *buf, size_t count) { int i = 0, j; int pair[2] = { 0, 0 }; int sign = 0; if (count < 1) return 0; if (buf[0] == '-') { sign = -1; i++; } else if (buf[0] == '+') { sign = 1; i++; } for (j = 0; i < count; i++) { char c = buf[i]; if ((c >= '0') && (c <= '9')) { pair[j] *= 10; pair[j] += (c - '0'); } else if ((c == ' ') || (c == '\t')) { if (pair[j] != 0) { j++; if ((sign != 0) || (j > 1)) break; } } else break; } if (sign != 0) { if (pair[0] > 0) acpuclk_set_vdd(0, sign * pair[0]); } else { if ((pair[0] > 0) && (pair[1] > 0)) acpuclk_set_vdd((unsigned)pair[0], pair[1]); else return -EINVAL; } return count; } #endif /* CONFIG_CPU_VOLTAGE_TABLE */ cpufreq_freq_attr_ro_perm(cpuinfo_cur_freq, 0400); cpufreq_freq_attr_ro(cpuinfo_min_freq); cpufreq_freq_attr_ro(cpuinfo_max_freq); cpufreq_freq_attr_ro(cpuinfo_transition_latency); cpufreq_freq_attr_ro(scaling_available_governors); cpufreq_freq_attr_ro(scaling_driver); cpufreq_freq_attr_ro(scaling_cur_freq); cpufreq_freq_attr_ro(bios_limit); cpufreq_freq_attr_ro(related_cpus); cpufreq_freq_attr_ro(affected_cpus); cpufreq_freq_attr_ro(cpu_utilization); cpufreq_freq_attr_rw(scaling_min_freq); cpufreq_freq_attr_rw(scaling_max_freq); cpufreq_freq_attr_rw(scaling_governor); cpufreq_freq_attr_rw(scaling_setspeed); #ifdef CONFIG_CPU_VOLTAGE_TABLE define_one_global_rw(vdd_levels); #endif static struct attribute *default_attrs[] = { &cpuinfo_min_freq.attr, &cpuinfo_max_freq.attr, &cpuinfo_transition_latency.attr, &scaling_min_freq.attr, &scaling_max_freq.attr, &affected_cpus.attr, &cpu_utilization.attr, &related_cpus.attr, &scaling_governor.attr, &scaling_driver.attr, &scaling_available_governors.attr, &scaling_setspeed.attr, NULL }; #ifdef CONFIG_CPU_VOLTAGE_TABLE static struct attribute *vddtbl_attrs[] = { &vdd_levels.attr, NULL }; static struct attribute_group vddtbl_attr_group = { .attrs = vddtbl_attrs, .name = "vdd_table", }; #endif /* CONFIG_CPU_VOLTAGE_TABLE */ struct kobject *cpufreq_global_kobject; EXPORT_SYMBOL(cpufreq_global_kobject); #define to_policy(k) container_of(k, struct cpufreq_policy, kobj) #define to_attr(a) container_of(a, struct freq_attr, attr) static ssize_t show(struct kobject *kobj, struct attribute *attr, char *buf) { struct cpufreq_policy *policy = to_policy(kobj); struct freq_attr *fattr = to_attr(attr); ssize_t ret = -EINVAL; policy = cpufreq_cpu_get_sysfs(policy->cpu); if (!policy) goto no_policy; if (lock_policy_rwsem_read(policy->cpu) < 0) goto fail; if (fattr->show) ret = fattr->show(policy, buf); else ret = -EIO; unlock_policy_rwsem_read(policy->cpu); fail: cpufreq_cpu_put_sysfs(policy); no_policy: return ret; } static ssize_t store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count) { struct cpufreq_policy *policy = to_policy(kobj); struct freq_attr *fattr = to_attr(attr); ssize_t ret = -EINVAL; policy = cpufreq_cpu_get_sysfs(policy->cpu); if (!policy) goto no_policy; if (lock_policy_rwsem_write(policy->cpu) < 0) goto fail; if (fattr->store) ret = fattr->store(policy, buf, count); else ret = -EIO; unlock_policy_rwsem_write(policy->cpu); fail: cpufreq_cpu_put_sysfs(policy); no_policy: return ret; } static void cpufreq_sysfs_release(struct kobject *kobj) { struct cpufreq_policy *policy = to_policy(kobj); pr_debug("last reference is dropped\n"); complete(&policy->kobj_unregister); } static const struct sysfs_ops sysfs_ops = { .show = show, .store = store, }; static struct kobj_type ktype_cpufreq = { .sysfs_ops = &sysfs_ops, .default_attrs = default_attrs, .release = cpufreq_sysfs_release, }; /* * Returns: * Negative: Failure * 0: Success * Positive: When we have a managed CPU and the sysfs got symlinked */ static int cpufreq_add_dev_policy(unsigned int cpu, struct cpufreq_policy *policy, struct sys_device *sys_dev) { int ret = 0; #ifdef CONFIG_SMP unsigned long flags; unsigned int j; #ifdef CONFIG_HOTPLUG_CPU struct cpufreq_governor *gov; gov = __find_governor(per_cpu(cpufreq_policy_save, cpu).gov); if (gov) { policy->governor = gov; pr_debug("Restoring governor %s for cpu %d\n", policy->governor->name, cpu); } if (per_cpu(cpufreq_policy_save, cpu).min) { policy->min = per_cpu(cpufreq_policy_save, cpu).min; policy->user_policy.min = policy->min; } if (per_cpu(cpufreq_policy_save, cpu).max) { policy->max = per_cpu(cpufreq_policy_save, cpu).max; policy->user_policy.max = policy->max; } pr_debug("Restoring CPU%d min %d and max %d\n", cpu, policy->min, policy->max); #endif for_each_cpu(j, policy->cpus) { struct cpufreq_policy *managed_policy; if (cpu == j) continue; /* Check for existing affected CPUs. * They may not be aware of it due to CPU Hotplug. * cpufreq_cpu_put is called when the device is removed * in __cpufreq_remove_dev() */ managed_policy = cpufreq_cpu_get(j); if (unlikely(managed_policy)) { /* Set proper policy_cpu */ unlock_policy_rwsem_write(cpu); per_cpu(cpufreq_policy_cpu, cpu) = managed_policy->cpu; if (lock_policy_rwsem_write(cpu) < 0) { /* Should not go through policy unlock path */ if (cpufreq_driver->exit) cpufreq_driver->exit(policy); cpufreq_cpu_put(managed_policy); return -EBUSY; } spin_lock_irqsave(&cpufreq_driver_lock, flags); cpumask_copy(managed_policy->cpus, policy->cpus); per_cpu(cpufreq_cpu_data, cpu) = managed_policy; spin_unlock_irqrestore(&cpufreq_driver_lock, flags); pr_debug("CPU already managed, adding link\n"); ret = sysfs_create_link(&sys_dev->kobj, &managed_policy->kobj, "cpufreq"); if (ret) cpufreq_cpu_put(managed_policy); /* * Success. We only needed to be added to the mask. * Call driver->exit() because only the cpu parent of * the kobj needed to call init(). */ if (cpufreq_driver->exit) cpufreq_driver->exit(policy); if (!ret) return 1; else return ret; } } #endif return ret; } /* symlink affected CPUs */ static int cpufreq_add_dev_symlink(unsigned int cpu, struct cpufreq_policy *policy) { unsigned int j; int ret = 0; for_each_cpu(j, policy->cpus) { struct cpufreq_policy *managed_policy; struct sys_device *cpu_sys_dev; if (j == cpu) continue; if (!cpu_online(j)) continue; pr_debug("CPU %u already managed, adding link\n", j); managed_policy = cpufreq_cpu_get(cpu); cpu_sys_dev = get_cpu_sysdev(j); ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, "cpufreq"); if (ret) { cpufreq_cpu_put(managed_policy); return ret; } } return ret; } static int cpufreq_add_dev_interface(unsigned int cpu, struct cpufreq_policy *policy, struct sys_device *sys_dev) { struct cpufreq_policy new_policy; struct freq_attr **drv_attr; unsigned long flags; int ret = 0; unsigned int j; /* prepare interface data */ ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj, "cpufreq"); if (ret) return ret; /* set up files for this cpu device */ drv_attr = cpufreq_driver->attr; while ((drv_attr) && (*drv_attr)) { ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); if (ret) goto err_out_kobj_put; drv_attr++; } if (cpufreq_driver->get) { ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); if (ret) goto err_out_kobj_put; } if (cpufreq_driver->target) { ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); if (ret) goto err_out_kobj_put; } if (cpufreq_driver->bios_limit) { ret = sysfs_create_file(&policy->kobj, &bios_limit.attr); if (ret) goto err_out_kobj_put; } spin_lock_irqsave(&cpufreq_driver_lock, flags); for_each_cpu(j, policy->cpus) { if (!cpu_online(j)) continue; per_cpu(cpufreq_cpu_data, j) = policy; per_cpu(cpufreq_policy_cpu, j) = policy->cpu; } spin_unlock_irqrestore(&cpufreq_driver_lock, flags); ret = cpufreq_add_dev_symlink(cpu, policy); if (ret) goto err_out_kobj_put; memcpy(&new_policy, policy, sizeof(struct cpufreq_policy)); /* assure that the starting sequence is run in __cpufreq_set_policy */ policy->governor = NULL; /* set default policy */ ret = __cpufreq_set_policy(policy, &new_policy); policy->user_policy.policy = policy->policy; policy->user_policy.governor = policy->governor; if (ret) { pr_debug("setting policy failed\n"); if (cpufreq_driver->exit) cpufreq_driver->exit(policy); } return ret; err_out_kobj_put: kobject_put(&policy->kobj); wait_for_completion(&policy->kobj_unregister); return ret; } /** * cpufreq_add_dev - add a CPU device * * Adds the cpufreq interface for a CPU device. * * The Oracle says: try running cpufreq registration/unregistration concurrently * with with cpu hotplugging and all hell will break loose. Tried to clean this * mess up, but more thorough testing is needed. - Mathieu */ static int cpufreq_add_dev(struct sys_device *sys_dev) { unsigned int cpu = sys_dev->id; int ret = 0, found = 0; struct cpufreq_policy *policy; unsigned long flags; unsigned int j; #ifdef CONFIG_HOTPLUG_CPU int sibling; #endif if (cpu_is_offline(cpu)) return 0; pr_debug("adding CPU %u\n", cpu); #ifdef CONFIG_SMP /* check whether a different CPU already registered this * CPU because it is in the same boat. */ policy = cpufreq_cpu_get(cpu); if (unlikely(policy)) { cpufreq_cpu_put(policy); return 0; } #endif if (!try_module_get(cpufreq_driver->owner)) { ret = -EINVAL; goto module_out; } ret = -ENOMEM; policy = kzalloc(sizeof(struct cpufreq_policy), GFP_KERNEL); if (!policy) goto nomem_out; if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL)) goto err_free_policy; if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) goto err_free_cpumask; policy->cpu = cpu; cpumask_copy(policy->cpus, cpumask_of(cpu)); /* Initially set CPU itself as the policy_cpu */ per_cpu(cpufreq_policy_cpu, cpu) = cpu; ret = (lock_policy_rwsem_write(cpu) < 0); WARN_ON(ret); init_completion(&policy->kobj_unregister); INIT_WORK(&policy->update, handle_update); /* Set governor before ->init, so that driver could check it */ #ifdef CONFIG_HOTPLUG_CPU for_each_online_cpu(sibling) { struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling); if (cp && cp->governor && (cpumask_test_cpu(cpu, cp->related_cpus))) { policy->governor = cp->governor; found = 1; break; } } #endif if (!found) policy->governor = CPUFREQ_DEFAULT_GOVERNOR; /* call driver. From then on the cpufreq must be able * to accept all calls to ->verify and ->setpolicy for this CPU */ ret = cpufreq_driver->init(policy); if (ret) { pr_debug("initialization failed\n"); goto err_unlock_policy; } policy->user_policy.min = policy->min; policy->user_policy.max = policy->max; blocking_notifier_call_chain(&cpufreq_policy_notifier_list, CPUFREQ_START, policy); ret = cpufreq_add_dev_policy(cpu, policy, sys_dev); if (ret) { if (ret > 0) /* This is a managed cpu, symlink created, exit with 0 */ ret = 0; goto err_unlock_policy; } ret = cpufreq_add_dev_interface(cpu, policy, sys_dev); if (ret) goto err_out_unregister; unlock_policy_rwsem_write(cpu); kobject_uevent(&policy->kobj, KOBJ_ADD); module_put(cpufreq_driver->owner); pr_debug("initialization complete\n"); return 0; err_out_unregister: spin_lock_irqsave(&cpufreq_driver_lock, flags); for_each_cpu(j, policy->cpus) per_cpu(cpufreq_cpu_data, j) = NULL; spin_unlock_irqrestore(&cpufreq_driver_lock, flags); kobject_put(&policy->kobj); wait_for_completion(&policy->kobj_unregister); err_unlock_policy: unlock_policy_rwsem_write(cpu); free_cpumask_var(policy->related_cpus); err_free_cpumask: free_cpumask_var(policy->cpus); err_free_policy: kfree(policy); nomem_out: module_put(cpufreq_driver->owner); module_out: return ret; } /** * __cpufreq_remove_dev - remove a CPU device * * Removes the cpufreq interface for a CPU device. * Caller should already have policy_rwsem in write mode for this CPU. * This routine frees the rwsem before returning. */ static int __cpufreq_remove_dev(struct sys_device *sys_dev) { unsigned int cpu = sys_dev->id; unsigned long flags; struct cpufreq_policy *data; struct kobject *kobj; struct completion *cmp; #ifdef CONFIG_SMP struct sys_device *cpu_sys_dev; unsigned int j; #endif pr_debug("unregistering CPU %u\n", cpu); spin_lock_irqsave(&cpufreq_driver_lock, flags); data = per_cpu(cpufreq_cpu_data, cpu); if (!data) { spin_unlock_irqrestore(&cpufreq_driver_lock, flags); unlock_policy_rwsem_write(cpu); return -EINVAL; } per_cpu(cpufreq_cpu_data, cpu) = NULL; #ifdef CONFIG_SMP /* if this isn't the CPU which is the parent of the kobj, we * only need to unlink, put and exit */ if (unlikely(cpu != data->cpu)) { pr_debug("removing link\n"); cpumask_clear_cpu(cpu, data->cpus); spin_unlock_irqrestore(&cpufreq_driver_lock, flags); kobj = &sys_dev->kobj; cpufreq_cpu_put(data); unlock_policy_rwsem_write(cpu); sysfs_remove_link(kobj, "cpufreq"); return 0; } #endif #ifdef CONFIG_SMP #ifdef CONFIG_HOTPLUG_CPU strncpy(per_cpu(cpufreq_policy_save, cpu).gov, data->governor->name, CPUFREQ_NAME_LEN); per_cpu(cpufreq_policy_save, cpu).min = data->min; per_cpu(cpufreq_policy_save, cpu).max = data->max; pr_debug("Saving CPU%d policy min %d and max %d\n", cpu, data->min, data->max); #endif /* if we have other CPUs still registered, we need to unlink them, * or else wait_for_completion below will lock up. Clean the * per_cpu(cpufreq_cpu_data) while holding the lock, and remove * the sysfs links afterwards. */ if (unlikely(cpumask_weight(data->cpus) > 1)) { for_each_cpu(j, data->cpus) { if (j == cpu) continue; per_cpu(cpufreq_cpu_data, j) = NULL; } } spin_unlock_irqrestore(&cpufreq_driver_lock, flags); if (unlikely(cpumask_weight(data->cpus) > 1)) { for_each_cpu(j, data->cpus) { if (j == cpu) continue; pr_debug("removing link for cpu %u\n", j); #ifdef CONFIG_HOTPLUG_CPU strncpy(per_cpu(cpufreq_policy_save, j).gov, data->governor->name, CPUFREQ_NAME_LEN); per_cpu(cpufreq_policy_save, j).min = data->min; per_cpu(cpufreq_policy_save, j).max = data->max; pr_debug("Saving CPU%d policy min %d and max %d\n", j, data->min, data->max); #endif cpu_sys_dev = get_cpu_sysdev(j); kobj = &cpu_sys_dev->kobj; unlock_policy_rwsem_write(cpu); sysfs_remove_link(kobj, "cpufreq"); lock_policy_rwsem_write(cpu); cpufreq_cpu_put(data); } } #else spin_unlock_irqrestore(&cpufreq_driver_lock, flags); #endif if (cpufreq_driver->target) __cpufreq_governor(data, CPUFREQ_GOV_STOP); kobj = &data->kobj; cmp = &data->kobj_unregister; unlock_policy_rwsem_write(cpu); kobject_put(kobj); /* we need to make sure that the underlying kobj is actually * not referenced anymore by anybody before we proceed with * unloading. */ pr_debug("waiting for dropping of refcount\n"); wait_for_completion(cmp); pr_debug("wait complete\n"); lock_policy_rwsem_write(cpu); if (cpufreq_driver->exit) cpufreq_driver->exit(data); unlock_policy_rwsem_write(cpu); #ifdef CONFIG_HOTPLUG_CPU /* when the CPU which is the parent of the kobj is hotplugged * offline, check for siblings, and create cpufreq sysfs interface * and symlinks */ if (unlikely(cpumask_weight(data->cpus) > 1)) { /* first sibling now owns the new sysfs dir */ cpumask_clear_cpu(cpu, data->cpus); cpufreq_add_dev(get_cpu_sysdev(cpumask_first(data->cpus))); /* finally remove our own symlink */ lock_policy_rwsem_write(cpu); __cpufreq_remove_dev(sys_dev); } #endif free_cpumask_var(data->related_cpus); free_cpumask_var(data->cpus); kfree(data); return 0; } static int cpufreq_remove_dev(struct sys_device *sys_dev) { unsigned int cpu = sys_dev->id; int retval; if (cpu_is_offline(cpu)) return 0; if (unlikely(lock_policy_rwsem_write(cpu))) BUG(); retval = __cpufreq_remove_dev(sys_dev); return retval; } static void handle_update(struct work_struct *work) { struct cpufreq_policy *policy = container_of(work, struct cpufreq_policy, update); unsigned int cpu = policy->cpu; pr_debug("handle_update for cpu %u called\n", cpu); cpufreq_update_policy(cpu); } /** * cpufreq_out_of_sync - If actual and saved CPU frequency differs, we're in deep trouble. * @cpu: cpu number * @old_freq: CPU frequency the kernel thinks the CPU runs at * @new_freq: CPU frequency the CPU actually runs at * * We adjust to current frequency first, and need to clean up later. * So either call to cpufreq_update_policy() or schedule handle_update()). */ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigned int new_freq) { struct cpufreq_freqs freqs; pr_debug("Warning: CPU frequency out of sync: cpufreq and timing " "core thinks of %u, is %u kHz.\n", old_freq, new_freq); freqs.cpu = cpu; freqs.old = old_freq; freqs.new = new_freq; cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); } /** * cpufreq_quick_get - get the CPU frequency (in kHz) from policy->cur * @cpu: CPU number * * This is the last known freq, without actually getting it from the driver. * Return value will be same as what is shown in scaling_cur_freq in sysfs. */ unsigned int cpufreq_quick_get(unsigned int cpu) { struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); unsigned int ret_freq = 0; if (policy) { ret_freq = policy->cur; cpufreq_cpu_put(policy); } return ret_freq; } EXPORT_SYMBOL(cpufreq_quick_get); static unsigned int __cpufreq_get(unsigned int cpu) { struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); unsigned int ret_freq = 0; if (!cpufreq_driver->get) return ret_freq; ret_freq = cpufreq_driver->get(cpu); if (ret_freq && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { /* verify no discrepancy between actual and saved value exists */ if (unlikely(ret_freq != policy->cur)) { cpufreq_out_of_sync(cpu, policy->cur, ret_freq); schedule_work(&policy->update); } } return ret_freq; } /** * cpufreq_get - get the current CPU frequency (in kHz) * @cpu: CPU number * * Get the CPU current (static) CPU frequency */ unsigned int cpufreq_get(unsigned int cpu) { unsigned int ret_freq = 0; struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); if (!policy) goto out; if (unlikely(lock_policy_rwsem_read(cpu))) goto out_policy; ret_freq = __cpufreq_get(cpu); unlock_policy_rwsem_read(cpu); out_policy: cpufreq_cpu_put(policy); out: return ret_freq; } EXPORT_SYMBOL(cpufreq_get); static struct sysdev_driver cpufreq_sysdev_driver = { .add = cpufreq_add_dev, .remove = cpufreq_remove_dev, }; /** * cpufreq_bp_suspend - Prepare the boot CPU for system suspend. * * This function is only executed for the boot processor. The other CPUs * have been put offline by means of CPU hotplug. */ static int cpufreq_bp_suspend(void) { int ret = 0; int cpu = smp_processor_id(); struct cpufreq_policy *cpu_policy; pr_debug("suspending cpu %u\n", cpu); /* If there's no policy for the boot CPU, we have nothing to do. */ cpu_policy = cpufreq_cpu_get(cpu); if (!cpu_policy) return 0; if (cpufreq_driver->suspend) { ret = cpufreq_driver->suspend(cpu_policy); if (ret) printk(KERN_ERR "cpufreq: suspend failed in ->suspend " "step on CPU %u\n", cpu_policy->cpu); } cpufreq_cpu_put(cpu_policy); return ret; } /** * cpufreq_bp_resume - Restore proper frequency handling of the boot CPU. * * 1.) resume CPUfreq hardware support (cpufreq_driver->resume()) * 2.) schedule call cpufreq_update_policy() ASAP as interrupts are * restored. It will verify that the current freq is in sync with * what we believe it to be. This is a bit later than when it * should be, but nonethteless it's better than calling * cpufreq_driver->get() here which might re-enable interrupts... * * This function is only executed for the boot CPU. The other CPUs have not * been turned on yet. */ static void cpufreq_bp_resume(void) { int ret = 0; int cpu = smp_processor_id(); struct cpufreq_policy *cpu_policy; pr_debug("resuming cpu %u\n", cpu); /* If there's no policy for the boot CPU, we have nothing to do. */ cpu_policy = cpufreq_cpu_get(cpu); if (!cpu_policy) return; if (cpufreq_driver->resume) { ret = cpufreq_driver->resume(cpu_policy); if (ret) { printk(KERN_ERR "cpufreq: resume failed in ->resume " "step on CPU %u\n", cpu_policy->cpu); goto fail; } } schedule_work(&cpu_policy->update); fail: cpufreq_cpu_put(cpu_policy); } static struct syscore_ops cpufreq_syscore_ops = { .suspend = cpufreq_bp_suspend, .resume = cpufreq_bp_resume, }; /********************************************************************* * NOTIFIER LISTS INTERFACE * *********************************************************************/ /** * cpufreq_register_notifier - register a driver with cpufreq * @nb: notifier function to register * @list: CPUFREQ_TRANSITION_NOTIFIER or CPUFREQ_POLICY_NOTIFIER * * Add a driver to one of two lists: either a list of drivers that * are notified about clock rate changes (once before and once after * the transition), or a list of drivers that are notified about * changes in cpufreq policy. * * This function may sleep, and has the same return conditions as * blocking_notifier_chain_register. */ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list) { int ret; WARN_ON(!init_cpufreq_transition_notifier_list_called); switch (list) { case CPUFREQ_TRANSITION_NOTIFIER: ret = srcu_notifier_chain_register( &cpufreq_transition_notifier_list, nb); break; case CPUFREQ_POLICY_NOTIFIER: ret = blocking_notifier_chain_register( &cpufreq_policy_notifier_list, nb); break; default: ret = -EINVAL; } return ret; } EXPORT_SYMBOL(cpufreq_register_notifier); /** * cpufreq_unregister_notifier - unregister a driver with cpufreq * @nb: notifier block to be unregistered * @list: CPUFREQ_TRANSITION_NOTIFIER or CPUFREQ_POLICY_NOTIFIER * * Remove a driver from the CPU frequency notifier list. * * This function may sleep, and has the same return conditions as * blocking_notifier_chain_unregister. */ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list) { int ret; switch (list) { case CPUFREQ_TRANSITION_NOTIFIER: ret = srcu_notifier_chain_unregister( &cpufreq_transition_notifier_list, nb); break; case CPUFREQ_POLICY_NOTIFIER: ret = blocking_notifier_chain_unregister( &cpufreq_policy_notifier_list, nb); break; default: ret = -EINVAL; } return ret; } EXPORT_SYMBOL(cpufreq_unregister_notifier); /********************************************************************* * GOVERNORS * *********************************************************************/ int __cpufreq_driver_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) { int retval = -EINVAL; pr_debug("target for CPU %u: %u kHz, relation %u\n", policy->cpu, target_freq, relation); if (cpu_online(policy->cpu) && cpufreq_driver->target) retval = cpufreq_driver->target(policy, target_freq, relation); return retval; } EXPORT_SYMBOL_GPL(__cpufreq_driver_target); int cpufreq_driver_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) { int ret = -EINVAL; policy = cpufreq_cpu_get(policy->cpu); if (!policy) goto no_policy; if (unlikely(lock_policy_rwsem_write(policy->cpu))) goto fail; ret = __cpufreq_driver_target(policy, target_freq, relation); unlock_policy_rwsem_write(policy->cpu); fail: cpufreq_cpu_put(policy); no_policy: return ret; } EXPORT_SYMBOL_GPL(cpufreq_driver_target); int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) { int ret = 0; policy = cpufreq_cpu_get(policy->cpu); if (!policy) return -EINVAL; if (cpu_online(cpu) && cpufreq_driver->getavg) ret = cpufreq_driver->getavg(policy, cpu); cpufreq_cpu_put(policy); return ret; } EXPORT_SYMBOL_GPL(__cpufreq_driver_getavg); /* * when "event" is CPUFREQ_GOV_LIMITS */ static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) { int ret; /* Only must be defined when default governor is known to have latency restrictions, like e.g. conservative or ondemand. That this is the case is already ensured in Kconfig */ #ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE struct cpufreq_governor *gov = &cpufreq_gov_performance; #else struct cpufreq_governor *gov = NULL; #endif if (policy->governor->max_transition_latency && policy->cpuinfo.transition_latency > policy->governor->max_transition_latency) { if (!gov) return -EINVAL; else { printk(KERN_WARNING "%s governor failed, too long" " transition latency of HW, fallback" " to %s governor\n", policy->governor->name, gov->name); policy->governor = gov; } } if (!try_module_get(policy->governor->owner)) return -EINVAL; pr_debug("__cpufreq_governor for CPU %u, event %u\n", policy->cpu, event); ret = policy->governor->governor(policy, event); /* we keep one module reference alive for each CPU governed by this CPU */ if ((event != CPUFREQ_GOV_START) || ret) module_put(policy->governor->owner); if ((event == CPUFREQ_GOV_STOP) && !ret) module_put(policy->governor->owner); return ret; } int cpufreq_register_governor(struct cpufreq_governor *governor) { int err; if (!governor) return -EINVAL; mutex_lock(&cpufreq_governor_mutex); err = -EBUSY; if (__find_governor(governor->name) == NULL) { err = 0; list_add(&governor->governor_list, &cpufreq_governor_list); } mutex_unlock(&cpufreq_governor_mutex); return err; } EXPORT_SYMBOL_GPL(cpufreq_register_governor); void cpufreq_unregister_governor(struct cpufreq_governor *governor) { #ifdef CONFIG_HOTPLUG_CPU int cpu; #endif if (!governor) return; #ifdef CONFIG_HOTPLUG_CPU for_each_present_cpu(cpu) { if (cpu_online(cpu)) continue; if (!strcmp(per_cpu(cpufreq_policy_save, cpu).gov, governor->name)) strcpy(per_cpu(cpufreq_policy_save, cpu).gov, "\0"); per_cpu(cpufreq_policy_save, cpu).min = 0; per_cpu(cpufreq_policy_save, cpu).max = 0; } #endif mutex_lock(&cpufreq_governor_mutex); list_del(&governor->governor_list); mutex_unlock(&cpufreq_governor_mutex); return; } EXPORT_SYMBOL_GPL(cpufreq_unregister_governor); /********************************************************************* * POLICY INTERFACE * *********************************************************************/ /** * cpufreq_get_policy - get the current cpufreq_policy * @policy: struct cpufreq_policy into which the current cpufreq_policy * is written * * Reads the current cpufreq policy. */ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu) { struct cpufreq_policy *cpu_policy; if (!policy) return -EINVAL; cpu_policy = cpufreq_cpu_get(cpu); if (!cpu_policy) return -EINVAL; memcpy(policy, cpu_policy, sizeof(struct cpufreq_policy)); cpufreq_cpu_put(cpu_policy); return 0; } EXPORT_SYMBOL(cpufreq_get_policy); /* * data : current policy. * policy : policy to be set. */ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_policy *policy) { int ret = 0; pr_debug("setting new policy for CPU %u: %u - %u kHz\n", policy->cpu, policy->min, policy->max); memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo)); if (policy->min > data->max || policy->max < data->min) { ret = -EINVAL; goto error_out; } /* verify the cpu speed can be set within this limit */ ret = cpufreq_driver->verify(policy); if (ret) goto error_out; /* adjust if necessary - all reasons */ blocking_notifier_call_chain(&cpufreq_policy_notifier_list, CPUFREQ_ADJUST, policy); /* adjust if necessary - hardware incompatibility*/ blocking_notifier_call_chain(&cpufreq_policy_notifier_list, CPUFREQ_INCOMPATIBLE, policy); /* verify the cpu speed can be set within this limit, which might be different to the first one */ ret = cpufreq_driver->verify(policy); if (ret) goto error_out; /* notification of the new policy */ blocking_notifier_call_chain(&cpufreq_policy_notifier_list, CPUFREQ_NOTIFY, policy); data->min = policy->min; data->max = policy->max; pr_debug("new min and max freqs are %u - %u kHz\n", data->min, data->max); if (cpufreq_driver->setpolicy) { data->policy = policy->policy; pr_debug("setting range\n"); ret = cpufreq_driver->setpolicy(policy); } else { if (policy->governor != data->governor) { /* save old, working values */ struct cpufreq_governor *old_gov = data->governor; pr_debug("governor switch\n"); /* end old governor */ if (data->governor) __cpufreq_governor(data, CPUFREQ_GOV_STOP); /* start new governor */ data->governor = policy->governor; if (__cpufreq_governor(data, CPUFREQ_GOV_START)) { /* new governor failed, so re-start old one */ pr_debug("starting governor %s failed\n", data->governor->name); if (old_gov) { data->governor = old_gov; __cpufreq_governor(data, CPUFREQ_GOV_START); } ret = -EINVAL; goto error_out; } /* might be a policy change, too, so fall through */ } pr_debug("governor: change or update limits\n"); __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); } error_out: return ret; } /** * cpufreq_update_policy - re-evaluate an existing cpufreq policy * @cpu: CPU which shall be re-evaluated * * Useful for policy notifiers which have different necessities * at different times. */ int cpufreq_update_policy(unsigned int cpu) { struct cpufreq_policy *data = cpufreq_cpu_get(cpu); struct cpufreq_policy policy; int ret; if (!data) { ret = -ENODEV; goto no_policy; } if (unlikely(lock_policy_rwsem_write(cpu))) { ret = -EINVAL; goto fail; } pr_debug("updating policy for CPU %u\n", cpu); memcpy(&policy, data, sizeof(struct cpufreq_policy)); policy.min = data->user_policy.min; policy.max = data->user_policy.max; policy.policy = data->user_policy.policy; policy.governor = data->user_policy.governor; /* BIOS might change freq behind our back -> ask driver for current freq and notify governors about a change */ if (cpufreq_driver->get) { policy.cur = cpufreq_driver->get(cpu); if (!data->cur) { pr_debug("Driver did not initialize current freq"); data->cur = policy.cur; } else { if (data->cur != policy.cur) cpufreq_out_of_sync(cpu, data->cur, policy.cur); } } ret = __cpufreq_set_policy(data, &policy); unlock_policy_rwsem_write(cpu); fail: cpufreq_cpu_put(data); no_policy: return ret; } EXPORT_SYMBOL(cpufreq_update_policy); static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; struct sys_device *sys_dev; sys_dev = get_cpu_sysdev(cpu); if (sys_dev) { switch (action) { case CPU_ONLINE: case CPU_ONLINE_FROZEN: cpufreq_add_dev(sys_dev); break; case CPU_DOWN_PREPARE: case CPU_DOWN_PREPARE_FROZEN: if (unlikely(lock_policy_rwsem_write(cpu))) BUG(); __cpufreq_remove_dev(sys_dev); break; case CPU_DOWN_FAILED: case CPU_DOWN_FAILED_FROZEN: cpufreq_add_dev(sys_dev); break; } } return NOTIFY_OK; } static struct notifier_block __refdata cpufreq_cpu_notifier = { .notifier_call = cpufreq_cpu_callback, }; /********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/ /** * cpufreq_register_driver - register a CPU Frequency driver * @driver_data: A struct cpufreq_driver containing the values# * submitted by the CPU Frequency driver. * * Registers a CPU Frequency driver to this core code. This code * returns zero on success, -EBUSY when another driver got here first * (and isn't unregistered in the meantime). * */ int cpufreq_register_driver(struct cpufreq_driver *driver_data) { unsigned long flags; int ret; if (!driver_data || !driver_data->verify || !driver_data->init || ((!driver_data->setpolicy) && (!driver_data->target))) return -EINVAL; pr_debug("trying to register driver %s\n", driver_data->name); if (driver_data->setpolicy) driver_data->flags |= CPUFREQ_CONST_LOOPS; spin_lock_irqsave(&cpufreq_driver_lock, flags); if (cpufreq_driver) { spin_unlock_irqrestore(&cpufreq_driver_lock, flags); return -EBUSY; } cpufreq_driver = driver_data; spin_unlock_irqrestore(&cpufreq_driver_lock, flags); ret = sysdev_driver_register(&cpu_sysdev_class, &cpufreq_sysdev_driver); if (ret) goto err_null_driver; if (!(cpufreq_driver->flags & CPUFREQ_STICKY)) { int i; ret = -ENODEV; /* check for at least one working CPU */ for (i = 0; i < nr_cpu_ids; i++) if (cpu_possible(i) && per_cpu(cpufreq_cpu_data, i)) { ret = 0; break; } /* if all ->init() calls failed, unregister */ if (ret) { pr_debug("no CPU initialized for driver %s\n", driver_data->name); goto err_sysdev_unreg; } } register_hotcpu_notifier(&cpufreq_cpu_notifier); pr_debug("driver %s up and running\n", driver_data->name); return 0; err_sysdev_unreg: sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); err_null_driver: spin_lock_irqsave(&cpufreq_driver_lock, flags); cpufreq_driver = NULL; spin_unlock_irqrestore(&cpufreq_driver_lock, flags); return ret; } EXPORT_SYMBOL_GPL(cpufreq_register_driver); /** * cpufreq_unregister_driver - unregister the current CPUFreq driver * * Unregister the current CPUFreq driver. Only call this if you have * the right to do so, i.e. if you have succeeded in initialising before! * Returns zero if successful, and -EINVAL if the cpufreq_driver is * currently not initialised. */ int cpufreq_unregister_driver(struct cpufreq_driver *driver) { unsigned long flags; if (!cpufreq_driver || (driver != cpufreq_driver)) return -EINVAL; pr_debug("unregistering driver %s\n", driver->name); sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); unregister_hotcpu_notifier(&cpufreq_cpu_notifier); spin_lock_irqsave(&cpufreq_driver_lock, flags); cpufreq_driver = NULL; spin_unlock_irqrestore(&cpufreq_driver_lock, flags); return 0; } EXPORT_SYMBOL_GPL(cpufreq_unregister_driver); static int __init cpufreq_core_init(void) { int cpu; #ifdef CONFIG_CPU_VOLTAGE_TABLE int rc; #endif /* CONFIG_CPU_VOLTAGE_TABLE */ for_each_possible_cpu(cpu) { per_cpu(cpufreq_policy_cpu, cpu) = -1; init_rwsem(&per_cpu(cpu_policy_rwsem, cpu)); } cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_sysdev_class.kset.kobj); BUG_ON(!cpufreq_global_kobject); register_syscore_ops(&cpufreq_syscore_ops); #ifdef CONFIG_CPU_VOLTAGE_TABLE rc = sysfs_create_group(cpufreq_global_kobject, &vddtbl_attr_group); #endif /* CONFIG_CPU_VOLTAGE_TABLE */ return 0; } core_initcall(cpufreq_core_init);
BytecodeMe/vanquish
drivers/cpufreq/cpufreq.c
C
gpl-2.0
53,029
/** * OWASP Benchmark Project v1.2beta * * This file is part of the Open Web Application Security Project (OWASP) * Benchmark Project. For details, please see * <a href="https://www.owasp.org/index.php/Benchmark">https://www.owasp.org/index.php/Benchmark</a>. * * The OWASP Benchmark 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. * * The OWASP Benchmark 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. * * @author Nick Sanidas <a href="https://www.aspectsecurity.com">Aspect Security</a> * @created 2015 */ package org.owasp.benchmark.testcode; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/BenchmarkTest00095") public class BenchmarkTest00095 extends HttpServlet { private static final long serialVersionUID = 1L; @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); javax.servlet.http.Cookie[] theCookies = request.getCookies(); String param = null; boolean foundit = false; if (theCookies != null) { for (javax.servlet.http.Cookie theCookie : theCookies) { if (theCookie.getName().equals("vector")) { param = java.net.URLDecoder.decode(theCookie.getValue(), "UTF-8"); foundit = true; } } if (!foundit) { // no cookie found in collection param = ""; } } else { // no cookies param = ""; } StringBuilder sbxyz69363 = new StringBuilder(param); String bar = sbxyz69363.append("_SafeStuff").toString(); double stuff = new java.util.Random().nextGaussian(); String rememberMeKey = Double.toString(stuff).substring(2); // Trim off the 0. at the front. String user = "Gayle"; String fullClassName = this.getClass().getName(); String testCaseNumber = fullClassName.substring(fullClassName.lastIndexOf('.')+1+"BenchmarkTest".length()); user+= testCaseNumber; String cookieName = "rememberMe" + testCaseNumber; boolean foundUser = false; javax.servlet.http.Cookie[] cookies = request.getCookies(); for (int i = 0; cookies != null && ++i < cookies.length && !foundUser;) { javax.servlet.http.Cookie cookie = cookies[i]; if (cookieName.equals(cookie.getName())) { if (cookie.getValue().equals(request.getSession().getAttribute(cookieName))) { foundUser = true; } } } if (foundUser) { response.getWriter().println("Welcome back: " + user + "<br/>"); } else { javax.servlet.http.Cookie rememberMe = new javax.servlet.http.Cookie(cookieName, rememberMeKey); rememberMe.setSecure(true); request.getSession().setAttribute(cookieName, rememberMeKey); response.addCookie(rememberMe); response.getWriter().println(user + " has been remembered with cookie: " + rememberMe.getName() + " whose value is: " + rememberMe.getValue() + "<br/>"); } response.getWriter().println("Weak Randomness Test java.util.Random.nextGaussian() executed"); } }
andresriancho/Benchmark
src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00095.java
Java
gpl-2.0
3,591
<?php include_once './config.php'; if(isset($_GET['delid'])){ $del = deleteEvent($_GET['delid']); if($del){ header('location: viewevents.php?delsucc=true'); } } ?>
TeamSyed/EventWebApp
public_html/DelConfirm.php
PHP
gpl-2.0
185
--created by ygopro puzzle maker Debug.SetAIName('高性能电子头脑') Debug.ReloadFieldBegin(DUEL_ATTACK_FIRST_TURN+DUEL_SIMPLE_AI) Debug.SetPlayerInfo(0,100,0,0) Debug.SetPlayerInfo(1,8000,0,0) Debug.AddCard(64034255,0,0,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(87902575,0,0,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(73580471,0,0,LOCATION_EXTRA,0,POS_FACEUP_ATTACK) Debug.AddCard(25862681,0,0,LOCATION_EXTRA,0,POS_FACEUP_ATTACK) Debug.AddCard(75652080,0,0,LOCATION_SZONE,0,POS_FACEDOWN_ATTACK) Debug.AddCard(31550470,0,0,LOCATION_SZONE,1,POS_FACEDOWN_ATTACK) c2=Debug.AddCard(5645210,0,0,LOCATION_MZONE,2,POS_FACEUP_ATTACK) Debug.AddCard(27174286,0,0,LOCATION_SZONE,2,POS_FACEDOWN_ATTACK) Debug.AddCard(82324105,0,0,LOCATION_SZONE,3,POS_FACEDOWN_ATTACK) Debug.AddCard(49600724,0,0,LOCATION_SZONE,4,POS_FACEDOWN_ATTACK) Debug.AddCard(28297833,0,0,LOCATION_HAND,0,POS_FACEUP_ATTACK) Debug.AddCard(1475311,0,0,LOCATION_HAND,1,POS_FACEUP_ATTACK) Debug.AddCard(36733451,0,0,LOCATION_HAND,2,POS_FACEUP_ATTACK) Debug.AddCard(9596126,0,0,LOCATION_HAND,3,POS_FACEUP_ATTACK) Debug.AddCard(14778250,0,0,LOCATION_HAND,4,POS_FACEUP_ATTACK) Debug.AddCard(33420078,0,0,LOCATION_HAND,5,POS_FACEUP_ATTACK) Debug.AddCard(25774450,0,0,LOCATION_HAND,6,POS_FACEUP_ATTACK) Debug.AddCard(88240808,1,1,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(2525268,1,1,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(71413901,1,1,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(36107810,1,1,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(88240808,1,1,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(71413901,1,1,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(71413901,1,1,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(88240808,1,1,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(2525268,1,1,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(36107810,1,1,LOCATION_DECK,0,POS_FACEUP_ATTACK) Debug.AddCard(68462976,1,1,LOCATION_SZONE,5,POS_FACEUP_ATTACK) Debug.AddCard(44508094,1,1,LOCATION_MZONE,1,POS_FACEUP_ATTACK) e3=Debug.AddCard(98867329,1,1,LOCATION_SZONE,1,POS_FACEUP_ATTACK) c1=Debug.AddCard(73853830,1,1,LOCATION_MZONE,2,POS_FACEUP_ATTACK) e2=Debug.AddCard(34664411,1,1,LOCATION_SZONE,2,POS_FACEUP_ATTACK) Debug.AddCard(88619463,1,1,LOCATION_MZONE,3,POS_FACEUP_ATTACK) e1=Debug.AddCard(83746708,1,1,LOCATION_SZONE,3,POS_FACEUP_ATTACK) Debug.AddCard(44947065,1,1,LOCATION_SZONE,4,POS_FACEUP_ATTACK) Debug.PreEquip(e1,c1) Debug.PreEquip(e2,c1) Debug.PreEquip(e3,c2) Debug.ReloadFieldEnd() Debug.ShowHint("Win in this turn!") aux.BeginPuzzle()
anshkumar/yugioh-glaze
assets/single/QB040.lua
Lua
gpl-2.0
2,549
#!/bin/sh xrandr --output HDMI-0 --off --output DP-0 --mode 2560x1600 --pos 0x0 --rotate normal --output DP-1 --off --output eDP-1-1 --mode 1600x900 --pos 2560x0 --rotate normal --output DP-1-1 --off --output HDMI-1-1 --off
erikdejonge/devenv
screenlayout/30inchDual.sh
Shell
gpl-2.0
224
qydra ===== Qt interface to control Hydra power supply
rGlory/qydra
README.md
Markdown
gpl-2.0
56
<?php /** * @file * Contains \Drupal\Console\Command\Locale\LanguageDeleteDebugCommand. */ namespace Drupal\Console\Command\Locale; use Drupal\Console\Style\DrupalStyle; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\Console\Command\ContainerAwareCommand; class LanguageDeleteCommand extends ContainerAwareCommand { use LocaleTrait; protected function configure() { $this ->setName('locale:language:delete') ->setDescription($this->trans('commands.locale.language.delete.description')) ->addArgument( 'language', InputArgument::REQUIRED, $this->trans('commands.locale.translation.status.arguments.language') ); $this->addDependency('locale'); } protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $moduleHandler = $this->getModuleHandler(); $moduleHandler->loadInclude('locale', 'inc', 'locale.translation'); $moduleHandler->loadInclude('locale', 'module'); $language = $input->getArgument('language'); $languagesObjects = locale_translatable_language_list(); $languages = $this->getLanguages(); if (isset($languagesObjects[$language])) { $languageEntity = $languagesObjects[$language]; } elseif (array_search($language, $languages)) { $langcode = array_search($language, $languages); $languageEntity = $languagesObjects[$langcode]; } else { $io->error( sprintf( $this->trans('commands.locale.language.delete.messages.invalid-language'), $language ) ); return; } try { $configurable_language_storage = $this->getService('entity_type.manager')->getStorage('configurable_language'); $configurable_language_storage->load($languageEntity->getId())->delete(); $io->info( sprintf( $this->trans('commands.locale.language.delete.messages.language-deleted-successfully'), $languageEntity->getName() ) ); } catch (\Exception $e) { $io->error($e->getMessage()); } } }
durgeshs/DrupalConsole
src/Command/Locale/LanguageDeleteCommand.php
PHP
gpl-2.0
2,535
<?php // $Id$ // vim: expandtab sw=4 ts=4 sts=4: /** * message from platform to send class * * @version 1.9 $Revision$ * @copyright (c) 2001-2014, Universite catholique de Louvain (UCL) * @author Claroline Team <info@claroline.net> * @copyright (c) 2001-2014, Universite catholique de Louvain (UCL) * @license http://www.gnu.org/copyleft/gpl.html * GNU GENERAL PUBLIC LICENSE version 2 or later * @package internal_messaging */ require_once __DIR__ . '/messagetosend.lib.php'; class PlatformMessageToSend extends MessageToSend { const CLARO_SYSTEM_USER_ID = 0; /** * create an message to send with the information in parameters * * @param int $sender user identification * if it's not defined it use the current user id * @param string $subject subject of the message * @param string $message content of the message */ public function __construct( $subject = parent::NOSUBJECT, $message = parent::NOMESSAGE ) { parent::__construct( self::CLARO_SYSTEM_USER_ID, $subject , $message ); } /** * The sender cannot be changed * @see MessageToSend::setSender * @throws Exception when called */ public function setSender( $userId = null ) { throw new Exception( 'Sender cannot be changed!' ); } }
zefredz/claroline
claroline/messaging/lib/message/platformmessagetosend.lib.php
PHP
gpl-2.0
1,370
<?php function get_product_main_image_title($products_id, $language_id) { $product_main_image_title_query = xtc_db_query("SELECT products_main_image_title from ".TABLE_PRODUCTS_DESCRIPTION." WHERE products_id = '".$products_id."' AND language_id = '".$language_id."'"); $product_main_image_title = xtc_db_fetch_array($product_main_image_title_query); return $product_main_image_title['products_main_image_title']; } ?>
shophelfer/shophelfer.com-shop
inc/get_product_main_image_title.php
PHP
gpl-2.0
436
/* * Yalp Store * Copyright (C) 2018 Sergey Yeriomin <yeriomin@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package com.github.yeriomin.yalpstore.task.playstore; import android.Manifest; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.database.sqlite.SQLiteDatabase; import android.os.Build; import android.util.Log; import com.github.yeriomin.yalpstore.BuildConfig; import com.github.yeriomin.yalpstore.NetworkUtil; import com.github.yeriomin.yalpstore.Paths; import com.github.yeriomin.yalpstore.PreferenceUtil; import com.github.yeriomin.yalpstore.R; import com.github.yeriomin.yalpstore.SqliteHelper; import com.github.yeriomin.yalpstore.UpdatableAppsActivity; import com.github.yeriomin.yalpstore.UpdateAllReceiver; import com.github.yeriomin.yalpstore.YalpStoreApplication; import com.github.yeriomin.yalpstore.download.DownloadManager; import com.github.yeriomin.yalpstore.download.State; import com.github.yeriomin.yalpstore.install.InstallerAbstract; import com.github.yeriomin.yalpstore.install.InstallerFactory; import com.github.yeriomin.yalpstore.model.App; import com.github.yeriomin.yalpstore.model.Event; import com.github.yeriomin.yalpstore.model.EventDao; import com.github.yeriomin.yalpstore.notification.NotificationManagerWrapper; import java.io.File; import java.util.List; public class BackgroundUpdatableAppsTask extends UpdatableAppsTask implements CloneableTask { private boolean forceUpdate = false; public void setForceUpdate(boolean forceUpdate) { this.forceUpdate = forceUpdate; } @Override public CloneableTask clone() { BackgroundUpdatableAppsTask task = new BackgroundUpdatableAppsTask(); task.setForceUpdate(forceUpdate); task.setContext(context); return task; } @Override protected void onPostExecute(List<App> apps) { super.onPostExecute(apps); if (!success()) { return; } int updatesCount = this.updatableApps.size(); Log.i(this.getClass().getName(), "Found updates for " + updatesCount + " apps"); try { insertEvent(updatesCount); } catch (Throwable e) { // No failure to log an event is important enough to let the app crash Log.e(getClass().getSimpleName(), "Could not log event: " + e.getClass().getName() + " " + e.getMessage()); } if (updatesCount == 0) { context.sendBroadcast(new Intent(UpdateAllReceiver.ACTION_ALL_UPDATES_COMPLETE), null); return; } if (canUpdate()) { process(context, updatableApps); } else { notifyUpdatesFound(context, updatesCount); } } private void insertEvent(int updatesCount) { Event event = new Event(); event.setType(Event.TYPE.BACKGROUND_UPDATE_CHECK); event.setMessage(context.getString(R.string.notification_updates_available_message, updatesCount)); SQLiteDatabase db = new SqliteHelper(context).getWritableDatabase(); new EventDao(db).insert(event); db.close(); } private boolean canUpdate() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !PreferenceUtil.getBoolean(context, PreferenceUtil.PREFERENCE_DOWNLOAD_INTERNAL_STORAGE) && context.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED ) { return false; } return forceUpdate || (PreferenceUtil.getBoolean(context, PreferenceUtil.PREFERENCE_BACKGROUND_UPDATE_DOWNLOAD) && (!PreferenceUtil.getBoolean(context, PreferenceUtil.PREFERENCE_BACKGROUND_UPDATE_WIFI_ONLY) || !NetworkUtil.isMetered(context) ) ) ; } private void process(Context context, List<App> apps) { boolean canInstallInBackground = PreferenceUtil.canInstallInBackground(context); YalpStoreApplication application = (YalpStoreApplication) context.getApplicationContext(); application.clearPendingUpdates(); for (App app: apps) { if (DownloadManager.isCancelled(app.getPackageName())) { Log.i(getClass().getSimpleName(), app.getPackageName() + " cancelled before starting"); continue; } application.addPendingUpdate(app.getPackageName()); File apkPath = Paths.getApkPath(context, app.getPackageName(), app.getVersionCode()); if (!apkPath.exists() || (PreferenceUtil.getBoolean(context, PreferenceUtil.PREFERENCE_DOWNLOAD_INTERNAL_STORAGE) && null == DownloadManager.getApkExpectedHash(app.getPackageName()) ) ) { apkPath.delete(); download(context, app); } else if (canInstallInBackground) { // Not passing context because it might be an activity // and we want it to run in background InstallerFactory.get(context.getApplicationContext()).verifyAndInstall(app); } else { notifyDownloadedAlready(app); application.removePendingUpdate(app.getPackageName()); } } } private void download(Context context, App app) { Log.i(getClass().getSimpleName(), "Starting download of update for " + app.getPackageName()); getPurchaseTask(context, app).execute(); } private BackgroundPurchaseTask getPurchaseTask(Context context, App app) { BackgroundPurchaseTask task = new BackgroundPurchaseTask(); task.setApp(app); task.setContext(context); task.setTriggeredBy(context instanceof Activity ? State.TriggeredBy.UPDATE_ALL_BUTTON : State.TriggeredBy.SCHEDULED_UPDATE ); return task; } private void notifyUpdatesFound(Context context, int updatesCount) { Intent i = new Intent(context, UpdatableAppsActivity.class); i.setAction(Intent.ACTION_VIEW); new NotificationManagerWrapper(context).show( BuildConfig.APPLICATION_ID, i, context.getString(R.string.notification_updates_available_title), context.getString(R.string.notification_updates_available_message, updatesCount) ); } private void notifyDownloadedAlready(App app) { new NotificationManagerWrapper(context).show( app.getPackageName(), InstallerAbstract.getDownloadChecksumServiceIntent(app.getPackageName()), app.getDisplayName(), context.getString(R.string.notification_download_complete) ); } }
yeriomin/YalpStore
app/src/main/java/com/github/yeriomin/yalpstore/task/playstore/BackgroundUpdatableAppsTask.java
Java
gpl-2.0
7,510
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Page Not Found :(</title> <style> ::-moz-selection { background: #b3d4fc; text-shadow: none; } ::selection { background: #b3d4fc; text-shadow: none; } html { padding: 30px 10px; font-size: 20px; line-height: 1.4; color: #737373; background: #f0f0f0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } html, input { font-family: "Tauri", Helvetica, Arial, sans-serif; } body { max-width: 500px; _width: 500px; padding: 30px 20px 50px; border: 1px solid #b3b3b3; border-radius: 4px; margin: 0 auto; box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff; background: #fcfcfc; } h1 { margin: 0 10px; font-size: 50px; text-align: center; } h1 span { color: #bbb; } h3 { margin: 1.5em 0 0.5em; } p { margin: 1em 0; } ul { padding: 0 0 0 40px; margin: 1em 0; } .container { max-width: 380px; _width: 380px; margin: 0 auto; } /* google search */ #goog-fixurl ul { list-style: none; padding: 0; margin: 0; } #goog-fixurl form { margin: 0; } #goog-wm-qt, #goog-wm-sb { border: 1px solid #bbb; font-size: 16px; line-height: normal; vertical-align: top; color: #444; border-radius: 2px; } #goog-wm-qt { width: 220px; height: 20px; padding: 5px; margin: 5px 10px 0 0; box-shadow: inset 0 1px 1px #ccc; } #goog-wm-sb { display: inline-block; height: 32px; padding: 0 10px; margin: 5px 0 0; white-space: nowrap; cursor: pointer; background-color: #f5f5f5; background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1); background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1); -webkit-appearance: none; -moz-appearance: none; appearance: none; *overflow: visible; *display: inline; *zoom: 1; } #goog-wm-sb:hover, #goog-wm-sb:focus { border-color: #aaa; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); background-color: #f8f8f8; } #goog-wm-qt:hover, #goog-wm-qt:focus { border-color: #105cb6; outline: 0; color: #222; } input::-moz-focus-inner { padding: 0; border: 0; } </style> </head> <body> <div class="container"> <h1>Not found <span>:(</span></h1> <p>Sorry, but the page you were trying to view does not exist.</p> <p>It looks like this was the result of either:</p> <ul> <li>a mistyped address</li> <li>an out-of-date link</li> </ul> <script> var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host; </script> <script src="//linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script> </div> <!-- Start of StatCounter Code for Default Guide --> <script type="text/javascript"> var sc_project=10071736; var sc_invisible=1; var sc_security="57881cbb"; var scJsHost = (("https:" == document.location.protocol) ? "https://secure." : "http://www."); document.write("<sc"+"ript type='text/javascript' src='" + scJsHost+ "statcounter.com/counter/counter.js'></"+"script>"); </script> <noscript><div class="statcounter"><a title="click tracking" href="http://statcounter.com/" target="_blank"><img class="statcounter" src="http://c.statcounter.com/10071736/0/57881cbb/1/" alt="click tracking"></a></div></noscript> <!-- End of StatCounter Code for Default Guide --> </body> </html>
TheAdamGalloway/TheAdamGalloway.github.io
404.html
HTML
gpl-2.0
5,159
/* * QLogic Fibre Channel HBA Driver * Copyright (c) 2003-2012 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ #include "qla_def.h" #include <linux/kthread.h> #include <linux/vmalloc.h> #include <linux/delay.h> /* BSG support for ELS/CT pass through */ void qla2x00_bsg_job_done(void *data, void *ptr, int res) { srb_t *sp = (srb_t *)ptr; struct scsi_qla_host *vha = (scsi_qla_host_t *)data; struct fc_bsg_job *bsg_job = sp->u.bsg_job; bsg_job->reply->result = res; bsg_job->job_done(bsg_job); sp->free(vha, sp); } void qla2x00_bsg_sp_free(void *data, void *ptr) { srb_t *sp = (srb_t *)ptr; struct scsi_qla_host *vha = sp->fcport->vha; struct fc_bsg_job *bsg_job = sp->u.bsg_job; struct qla_hw_data *ha = vha->hw; struct qla_mt_iocb_rqst_fx00 *piocb_rqst; if (sp->type == SRB_FXIOCB_BCMD) { piocb_rqst = (struct qla_mt_iocb_rqst_fx00 *) &bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; if (piocb_rqst->flags & SRB_FXDISC_REQ_DMA_VALID) dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (piocb_rqst->flags & SRB_FXDISC_RESP_DMA_VALID) dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); } else { dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); } if (sp->type == SRB_CT_CMD || sp->type == SRB_FXIOCB_BCMD || sp->type == SRB_ELS_CMD_HST) kfree(sp->fcport); qla2x00_rel_sp(vha, sp); } int qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *vha, struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag) { int i, ret, num_valid; uint8_t *bcode; struct qla_fcp_prio_entry *pri_entry; uint32_t *bcode_val_ptr, bcode_val; ret = 1; num_valid = 0; bcode = (uint8_t *)pri_cfg; bcode_val_ptr = (uint32_t *)pri_cfg; bcode_val = (uint32_t)(*bcode_val_ptr); if (bcode_val == 0xFFFFFFFF) { /* No FCP Priority config data in flash */ ql_dbg(ql_dbg_user, vha, 0x7051, "No FCP Priority config data.\n"); return 0; } if (bcode[0] != 'H' || bcode[1] != 'Q' || bcode[2] != 'O' || bcode[3] != 'S') { /* Invalid FCP priority data header*/ ql_dbg(ql_dbg_user, vha, 0x7052, "Invalid FCP Priority data header. bcode=0x%x.\n", bcode_val); return 0; } if (flag != 1) return ret; pri_entry = &pri_cfg->entry[0]; for (i = 0; i < pri_cfg->num_entries; i++) { if (pri_entry->flags & FCP_PRIO_ENTRY_TAG_VALID) num_valid++; pri_entry++; } if (num_valid == 0) { /* No valid FCP priority data entries */ ql_dbg(ql_dbg_user, vha, 0x7053, "No valid FCP Priority data entries.\n"); ret = 0; } else { /* FCP priority data is valid */ ql_dbg(ql_dbg_user, vha, 0x7054, "Valid FCP priority data. num entries = %d.\n", num_valid); } return ret; } static int qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int ret = 0; uint32_t len; uint32_t oper; if (!(IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) || IS_QLA82XX(ha))) { ret = -EINVAL; goto exit_fcp_prio_cfg; } /* Get the sub command */ oper = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; /* Only set config is allowed if config memory is not allocated */ if (!ha->fcp_prio_cfg && (oper != QLFC_FCP_PRIO_SET_CONFIG)) { ret = -EINVAL; goto exit_fcp_prio_cfg; } switch (oper) { case QLFC_FCP_PRIO_DISABLE: if (ha->flags.fcp_prio_enabled) { ha->flags.fcp_prio_enabled = 0; ha->fcp_prio_cfg->attributes &= ~FCP_PRIO_ATTR_ENABLE; qla24xx_update_all_fcp_prio(vha); bsg_job->reply->result = DID_OK; } else { ret = -EINVAL; bsg_job->reply->result = (DID_ERROR << 16); goto exit_fcp_prio_cfg; } break; case QLFC_FCP_PRIO_ENABLE: if (!ha->flags.fcp_prio_enabled) { if (ha->fcp_prio_cfg) { ha->flags.fcp_prio_enabled = 1; ha->fcp_prio_cfg->attributes |= FCP_PRIO_ATTR_ENABLE; qla24xx_update_all_fcp_prio(vha); bsg_job->reply->result = DID_OK; } else { ret = -EINVAL; bsg_job->reply->result = (DID_ERROR << 16); goto exit_fcp_prio_cfg; } } break; case QLFC_FCP_PRIO_GET_CONFIG: len = bsg_job->reply_payload.payload_len; if (!len || len > FCP_PRIO_CFG_SIZE) { ret = -EINVAL; bsg_job->reply->result = (DID_ERROR << 16); goto exit_fcp_prio_cfg; } bsg_job->reply->result = DID_OK; bsg_job->reply->reply_payload_rcv_len = sg_copy_from_buffer( bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, ha->fcp_prio_cfg, len); break; case QLFC_FCP_PRIO_SET_CONFIG: len = bsg_job->request_payload.payload_len; if (!len || len > FCP_PRIO_CFG_SIZE) { bsg_job->reply->result = (DID_ERROR << 16); ret = -EINVAL; goto exit_fcp_prio_cfg; } if (!ha->fcp_prio_cfg) { ha->fcp_prio_cfg = vmalloc(FCP_PRIO_CFG_SIZE); if (!ha->fcp_prio_cfg) { ql_log(ql_log_warn, vha, 0x7050, "Unable to allocate memory for fcp prio " "config data (%x).\n", FCP_PRIO_CFG_SIZE); bsg_job->reply->result = (DID_ERROR << 16); ret = -ENOMEM; goto exit_fcp_prio_cfg; } } memset(ha->fcp_prio_cfg, 0, FCP_PRIO_CFG_SIZE); sg_copy_to_buffer(bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, ha->fcp_prio_cfg, FCP_PRIO_CFG_SIZE); /* validate fcp priority data */ if (!qla24xx_fcp_prio_cfg_valid(vha, (struct qla_fcp_prio_cfg *) ha->fcp_prio_cfg, 1)) { bsg_job->reply->result = (DID_ERROR << 16); ret = -EINVAL; /* If buffer was invalidatic int * fcp_prio_cfg is of no use */ vfree(ha->fcp_prio_cfg); ha->fcp_prio_cfg = NULL; goto exit_fcp_prio_cfg; } ha->flags.fcp_prio_enabled = 0; if (ha->fcp_prio_cfg->attributes & FCP_PRIO_ATTR_ENABLE) ha->flags.fcp_prio_enabled = 1; qla24xx_update_all_fcp_prio(vha); bsg_job->reply->result = DID_OK; break; default: ret = -EINVAL; break; } exit_fcp_prio_cfg: if (!ret) bsg_job->job_done(bsg_job); return ret; } static int qla2x00_process_els(struct fc_bsg_job *bsg_job) { struct fc_rport *rport; fc_port_t *fcport = NULL; struct Scsi_Host *host; scsi_qla_host_t *vha; struct qla_hw_data *ha; srb_t *sp; const char *type; int req_sg_cnt, rsp_sg_cnt; int rval = (DRIVER_ERROR << 16); uint16_t nextlid = 0; if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { rport = bsg_job->rport; fcport = *(fc_port_t **) rport->dd_data; host = rport_to_shost(rport); vha = shost_priv(host); ha = vha->hw; type = "FC_BSG_RPT_ELS"; } else { host = bsg_job->shost; vha = shost_priv(host); ha = vha->hw; type = "FC_BSG_HST_ELS_NOLOGIN"; } /* pass through is supported only for ISP 4Gb or higher */ if (!IS_FWI2_CAPABLE(ha)) { ql_dbg(ql_dbg_user, vha, 0x7001, "ELS passthru not supported for ISP23xx based adapters.\n"); rval = -EPERM; goto done; } /* Multiple SG's are not supported for ELS requests */ if (bsg_job->request_payload.sg_cnt > 1 || bsg_job->reply_payload.sg_cnt > 1) { ql_dbg(ql_dbg_user, vha, 0x7002, "Multiple SG's are not suppored for ELS requests, " "request_sg_cnt=%x reply_sg_cnt=%x.\n", bsg_job->request_payload.sg_cnt, bsg_job->reply_payload.sg_cnt); rval = -EPERM; goto done; } /* ELS request for rport */ if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { /* make sure the rport is logged in, * if not perform fabric login */ if (qla2x00_fabric_login(vha, fcport, &nextlid)) { ql_dbg(ql_dbg_user, vha, 0x7003, "Failed to login port %06X for ELS passthru.\n", fcport->d_id.b24); rval = -EIO; goto done; } } else { /* Allocate a dummy fcport structure, since functions * preparing the IOCB and mailbox command retrieves port * specific information from fcport structure. For Host based * ELS commands there will be no fcport structure allocated */ fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL); if (!fcport) { rval = -ENOMEM; goto done; } /* Initialize all required fields of fcport */ fcport->vha = vha; fcport->d_id.b.al_pa = bsg_job->request->rqst_data.h_els.port_id[0]; fcport->d_id.b.area = bsg_job->request->rqst_data.h_els.port_id[1]; fcport->d_id.b.domain = bsg_job->request->rqst_data.h_els.port_id[2]; fcport->loop_id = (fcport->d_id.b.al_pa == 0xFD) ? NPH_FABRIC_CONTROLLER : NPH_F_PORT; } if (!vha->flags.online) { ql_log(ql_log_warn, vha, 0x7005, "Host not online.\n"); rval = -EIO; goto done; } req_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!req_sg_cnt) { rval = -ENOMEM; goto done_free_fcport; } rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); if (!rsp_sg_cnt) { rval = -ENOMEM; goto done_free_fcport; } if ((req_sg_cnt != bsg_job->request_payload.sg_cnt) || (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { ql_log(ql_log_warn, vha, 0x7008, "dma mapping resulted in different sg counts, " "request_sg_cnt: %x dma_request_sg_cnt:%x reply_sg_cnt:%x " "dma_reply_sg_cnt:%x.\n", bsg_job->request_payload.sg_cnt, req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } /* Alloc SRB structure */ sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) { rval = -ENOMEM; goto done_unmap_sg; } sp->type = (bsg_job->request->msgcode == FC_BSG_RPT_ELS ? SRB_ELS_CMD_RPT : SRB_ELS_CMD_HST); sp->name = (bsg_job->request->msgcode == FC_BSG_RPT_ELS ? "bsg_els_rpt" : "bsg_els_hst"); sp->u.bsg_job = bsg_job; sp->free = qla2x00_bsg_sp_free; sp->done = qla2x00_bsg_job_done; ql_dbg(ql_dbg_user, vha, 0x700a, "bsg rqst type: %s els type: %x - loop-id=%x " "portid=%-2x%02x%02x.\n", type, bsg_job->request->rqst_data.h_els.command_code, fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x700e, "qla2x00_start_sp failed = %d\n", rval); qla2x00_rel_sp(vha, sp); rval = -EIO; goto done_unmap_sg; } return rval; done_unmap_sg: dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); goto done_free_fcport; done_free_fcport: if (bsg_job->request->msgcode == FC_BSG_HST_ELS_NOLOGIN) kfree(fcport); done: return rval; } inline uint16_t qla24xx_calc_ct_iocbs(uint16_t dsds) { uint16_t iocbs; iocbs = 1; if (dsds > 2) { iocbs += (dsds - 2) / 5; if ((dsds - 2) % 5) iocbs++; } return iocbs; } static int qla2x00_process_ct(struct fc_bsg_job *bsg_job) { srb_t *sp; struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval = (DRIVER_ERROR << 16); int req_sg_cnt, rsp_sg_cnt; uint16_t loop_id; struct fc_port *fcport; char *type = "FC_BSG_HST_CT"; req_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!req_sg_cnt) { ql_log(ql_log_warn, vha, 0x700f, "dma_map_sg return %d for request\n", req_sg_cnt); rval = -ENOMEM; goto done; } rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); if (!rsp_sg_cnt) { ql_log(ql_log_warn, vha, 0x7010, "dma_map_sg return %d for reply\n", rsp_sg_cnt); rval = -ENOMEM; goto done; } if ((req_sg_cnt != bsg_job->request_payload.sg_cnt) || (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { ql_log(ql_log_warn, vha, 0x7011, "request_sg_cnt: %x dma_request_sg_cnt: %x reply_sg_cnt:%x " "dma_reply_sg_cnt: %x\n", bsg_job->request_payload.sg_cnt, req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } if (!vha->flags.online) { ql_log(ql_log_warn, vha, 0x7012, "Host is not online.\n"); rval = -EIO; goto done_unmap_sg; } loop_id = (bsg_job->request->rqst_data.h_ct.preamble_word1 & 0xFF000000) >> 24; switch (loop_id) { case 0xFC: loop_id = cpu_to_le16(NPH_SNS); break; case 0xFA: loop_id = vha->mgmt_svr_loop_id; break; default: ql_dbg(ql_dbg_user, vha, 0x7013, "Unknown loop id: %x.\n", loop_id); rval = -EINVAL; goto done_unmap_sg; } /* Allocate a dummy fcport structure, since functions preparing the * IOCB and mailbox command retrieves port specific information * from fcport structure. For Host based ELS commands there will be * no fcport structure allocated */ fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL); if (!fcport) { ql_log(ql_log_warn, vha, 0x7014, "Failed to allocate fcport.\n"); rval = -ENOMEM; goto done_unmap_sg; } /* Initialize all required fields of fcport */ fcport->vha = vha; fcport->d_id.b.al_pa = bsg_job->request->rqst_data.h_ct.port_id[0]; fcport->d_id.b.area = bsg_job->request->rqst_data.h_ct.port_id[1]; fcport->d_id.b.domain = bsg_job->request->rqst_data.h_ct.port_id[2]; fcport->loop_id = loop_id; /* Alloc SRB structure */ sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) { ql_log(ql_log_warn, vha, 0x7015, "qla2x00_get_sp failed.\n"); rval = -ENOMEM; goto done_free_fcport; } sp->type = SRB_CT_CMD; sp->name = "bsg_ct"; sp->iocbs = qla24xx_calc_ct_iocbs(req_sg_cnt + rsp_sg_cnt); sp->u.bsg_job = bsg_job; sp->free = qla2x00_bsg_sp_free; sp->done = qla2x00_bsg_job_done; ql_dbg(ql_dbg_user, vha, 0x7016, "bsg rqst type: %s else type: %x - " "loop-id=%x portid=%02x%02x%02x.\n", type, (bsg_job->request->rqst_data.h_ct.preamble_word2 >> 16), fcport->loop_id, fcport->d_id.b.domain, fcport->d_id.b.area, fcport->d_id.b.al_pa); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x7017, "qla2x00_start_sp failed=%d.\n", rval); qla2x00_rel_sp(vha, sp); rval = -EIO; goto done_free_fcport; } return rval; done_free_fcport: kfree(fcport); done_unmap_sg: dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); done: return rval; } /* Disable loopback mode */ static inline int qla81xx_reset_loopback_mode(scsi_qla_host_t *vha, uint16_t *config, int wait, int wait2) { int ret = 0; int rval = 0; uint16_t new_config[4]; struct qla_hw_data *ha = vha->hw; if (!IS_QLA81XX(ha) && !IS_QLA8031(ha)) goto done_reset_internal; memset(new_config, 0 , sizeof(new_config)); if ((config[0] & INTERNAL_LOOPBACK_MASK) >> 1 == ENABLE_INTERNAL_LOOPBACK || (config[0] & INTERNAL_LOOPBACK_MASK) >> 1 == ENABLE_EXTERNAL_LOOPBACK) { new_config[0] = config[0] & ~INTERNAL_LOOPBACK_MASK; ql_dbg(ql_dbg_user, vha, 0x70bf, "new_config[0]=%02x\n", (new_config[0] & INTERNAL_LOOPBACK_MASK)); memcpy(&new_config[1], &config[1], sizeof(uint16_t) * 3) ; ha->notify_dcbx_comp = wait; ha->notify_lb_portup_comp = wait2; ret = qla81xx_set_port_config(vha, new_config); if (ret != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x7025, "Set port config failed.\n"); ha->notify_dcbx_comp = 0; ha->notify_lb_portup_comp = 0; rval = -EINVAL; goto done_reset_internal; } /* Wait for DCBX complete event */ if (wait && !wait_for_completion_timeout(&ha->dcbx_comp, (DCBX_COMP_TIMEOUT * HZ))) { ql_dbg(ql_dbg_user, vha, 0x7026, "DCBX completion not received.\n"); ha->notify_dcbx_comp = 0; ha->notify_lb_portup_comp = 0; rval = -EINVAL; goto done_reset_internal; } else ql_dbg(ql_dbg_user, vha, 0x7027, "DCBX completion received.\n"); if (wait2 && !wait_for_completion_timeout(&ha->lb_portup_comp, (LB_PORTUP_COMP_TIMEOUT * HZ))) { ql_dbg(ql_dbg_user, vha, 0x70c5, "Port up completion not received.\n"); ha->notify_lb_portup_comp = 0; rval = -EINVAL; goto done_reset_internal; } else ql_dbg(ql_dbg_user, vha, 0x70c6, "Port up completion received.\n"); ha->notify_dcbx_comp = 0; ha->notify_lb_portup_comp = 0; } done_reset_internal: return rval; } /* * Set the port configuration to enable the internal or external loopback * depending on the loopback mode. */ static inline int qla81xx_set_loopback_mode(scsi_qla_host_t *vha, uint16_t *config, uint16_t *new_config, uint16_t mode) { int ret = 0; int rval = 0; struct qla_hw_data *ha = vha->hw; if (!IS_QLA81XX(ha) && !IS_QLA8031(ha)) goto done_set_internal; if (mode == INTERNAL_LOOPBACK) new_config[0] = config[0] | (ENABLE_INTERNAL_LOOPBACK << 1); else if (mode == EXTERNAL_LOOPBACK) new_config[0] = config[0] | (ENABLE_EXTERNAL_LOOPBACK << 1); ql_dbg(ql_dbg_user, vha, 0x70be, "new_config[0]=%02x\n", (new_config[0] & INTERNAL_LOOPBACK_MASK)); memcpy(&new_config[1], &config[1], sizeof(uint16_t) * 3); ha->notify_dcbx_comp = 1; ret = qla81xx_set_port_config(vha, new_config); if (ret != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x7021, "set port config failed.\n"); ha->notify_dcbx_comp = 0; rval = -EINVAL; goto done_set_internal; } /* Wait for DCBX complete event */ if (!wait_for_completion_timeout(&ha->dcbx_comp, (DCBX_COMP_TIMEOUT * HZ))) { ql_dbg(ql_dbg_user, vha, 0x7022, "DCBX completion not received.\n"); ret = qla81xx_reset_loopback_mode(vha, new_config, 0, 0); /* * If the reset of the loopback mode doesn't work take a FCoE * dump and reset the chip. */ if (ret) { ha->isp_ops->fw_dump(vha, 0); set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); } rval = -EINVAL; } else { if (ha->flags.idc_compl_status) { ql_dbg(ql_dbg_user, vha, 0x70c3, "Bad status in IDC Completion AEN\n"); rval = -EINVAL; ha->flags.idc_compl_status = 0; } else ql_dbg(ql_dbg_user, vha, 0x7023, "DCBX completion received.\n"); } ha->notify_dcbx_comp = 0; done_set_internal: return rval; } static int qla2x00_process_loopback(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval; uint8_t command_sent; char *type; struct msg_echo_lb elreq; uint16_t response[MAILBOX_REGISTER_COUNT]; uint16_t config[4], new_config[4]; uint8_t *fw_sts_ptr; uint8_t *req_data = NULL; dma_addr_t req_data_dma; uint32_t req_data_len; uint8_t *rsp_data = NULL; dma_addr_t rsp_data_dma; uint32_t rsp_data_len; if (!vha->flags.online) { ql_log(ql_log_warn, vha, 0x7019, "Host is not online.\n"); return -EIO; } elreq.req_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!elreq.req_sg_cnt) { ql_log(ql_log_warn, vha, 0x701a, "dma_map_sg returned %d for request.\n", elreq.req_sg_cnt); return -ENOMEM; } elreq.rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); if (!elreq.rsp_sg_cnt) { ql_log(ql_log_warn, vha, 0x701b, "dma_map_sg returned %d for reply.\n", elreq.rsp_sg_cnt); rval = -ENOMEM; goto done_unmap_req_sg; } if ((elreq.req_sg_cnt != bsg_job->request_payload.sg_cnt) || (elreq.rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { ql_log(ql_log_warn, vha, 0x701c, "dma mapping resulted in different sg counts, " "request_sg_cnt: %x dma_request_sg_cnt: %x " "reply_sg_cnt: %x dma_reply_sg_cnt: %x.\n", bsg_job->request_payload.sg_cnt, elreq.req_sg_cnt, bsg_job->reply_payload.sg_cnt, elreq.rsp_sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } req_data_len = rsp_data_len = bsg_job->request_payload.payload_len; req_data = dma_alloc_coherent(&ha->pdev->dev, req_data_len, &req_data_dma, GFP_KERNEL); if (!req_data) { ql_log(ql_log_warn, vha, 0x701d, "dma alloc failed for req_data.\n"); rval = -ENOMEM; goto done_unmap_sg; } rsp_data = dma_alloc_coherent(&ha->pdev->dev, rsp_data_len, &rsp_data_dma, GFP_KERNEL); if (!rsp_data) { ql_log(ql_log_warn, vha, 0x7004, "dma alloc failed for rsp_data.\n"); rval = -ENOMEM; goto done_free_dma_req; } /* Copy the request buffer in req_data now */ sg_copy_to_buffer(bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, req_data, req_data_len); elreq.send_dma = req_data_dma; elreq.rcv_dma = rsp_data_dma; elreq.transfer_size = req_data_len; elreq.options = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; elreq.iteration_count = bsg_job->request->rqst_data.h_vendor.vendor_cmd[2]; if (atomic_read(&vha->loop_state) == LOOP_READY && (ha->current_topology == ISP_CFG_F || ((IS_QLA81XX(ha) || IS_QLA8031(ha)) && le32_to_cpu(*(uint32_t *)req_data) == ELS_OPCODE_BYTE && req_data_len == MAX_ELS_FRAME_PAYLOAD)) && elreq.options == EXTERNAL_LOOPBACK) { type = "FC_BSG_HST_VENDOR_ECHO_DIAG"; ql_dbg(ql_dbg_user, vha, 0x701e, "BSG request type: %s.\n", type); command_sent = INT_DEF_LB_ECHO_CMD; rval = qla2x00_echo_test(vha, &elreq, response); } else { if (IS_QLA81XX(ha) || IS_QLA8031(ha)) { memset(config, 0, sizeof(config)); memset(new_config, 0, sizeof(new_config)); if (qla81xx_get_port_config(vha, config)) { ql_log(ql_log_warn, vha, 0x701f, "Get port config failed.\n"); rval = -EPERM; goto done_free_dma_rsp; } if ((config[0] & INTERNAL_LOOPBACK_MASK) != 0) { ql_dbg(ql_dbg_user, vha, 0x70c4, "Loopback operation already in " "progress.\n"); rval = -EAGAIN; goto done_free_dma_rsp; } ql_dbg(ql_dbg_user, vha, 0x70c0, "elreq.options=%04x\n", elreq.options); if (elreq.options == EXTERNAL_LOOPBACK) if (IS_QLA8031(ha)) rval = qla81xx_set_loopback_mode(vha, config, new_config, elreq.options); else rval = qla81xx_reset_loopback_mode(vha, config, 1, 0); else rval = qla81xx_set_loopback_mode(vha, config, new_config, elreq.options); if (rval) { rval = -EPERM; goto done_free_dma_rsp; } type = "FC_BSG_HST_VENDOR_LOOPBACK"; ql_dbg(ql_dbg_user, vha, 0x7028, "BSG request type: %s.\n", type); command_sent = INT_DEF_LB_LOOPBACK_CMD; rval = qla2x00_loopback_test(vha, &elreq, response); if (response[0] == MBS_COMMAND_ERROR && response[1] == MBS_LB_RESET) { ql_log(ql_log_warn, vha, 0x7029, "MBX command error, Aborting ISP.\n"); set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); qla2xxx_wake_dpc(vha); qla2x00_wait_for_chip_reset(vha); /* Also reset the MPI */ if (IS_QLA81XX(ha)) { if (qla81xx_restart_mpi_firmware(vha) != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x702a, "MPI reset failed.\n"); } } rval = -EIO; goto done_free_dma_rsp; } if (new_config[0]) { int ret; /* Revert back to original port config * Also clear internal loopback */ ret = qla81xx_reset_loopback_mode(vha, new_config, 0, 1); if (ret) { /* * If the reset of the loopback mode * doesn't work take FCoE dump and then * reset the chip. */ ha->isp_ops->fw_dump(vha, 0); set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); } } } else { type = "FC_BSG_HST_VENDOR_LOOPBACK"; ql_dbg(ql_dbg_user, vha, 0x702b, "BSG request type: %s.\n", type); command_sent = INT_DEF_LB_LOOPBACK_CMD; rval = qla2x00_loopback_test(vha, &elreq, response); } } if (rval) { ql_log(ql_log_warn, vha, 0x702c, "Vendor request %s failed.\n", type); rval = 0; bsg_job->reply->result = (DID_ERROR << 16); bsg_job->reply->reply_payload_rcv_len = 0; } else { ql_dbg(ql_dbg_user, vha, 0x702d, "Vendor request %s completed.\n", type); bsg_job->reply->result = (DID_OK << 16); sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, rsp_data, rsp_data_len); } bsg_job->reply_len = sizeof(struct fc_bsg_reply) + sizeof(response) + sizeof(uint8_t); fw_sts_ptr = ((uint8_t *)bsg_job->req->sense) + sizeof(struct fc_bsg_reply); memcpy(fw_sts_ptr, response, sizeof(response)); fw_sts_ptr += sizeof(response); *fw_sts_ptr = command_sent; done_free_dma_rsp: dma_free_coherent(&ha->pdev->dev, rsp_data_len, rsp_data, rsp_data_dma); done_free_dma_req: dma_free_coherent(&ha->pdev->dev, req_data_len, req_data, req_data_dma); done_unmap_sg: dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); done_unmap_req_sg: dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!rval) bsg_job->job_done(bsg_job); return rval; } static int qla84xx_reset(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval = 0; uint32_t flag; if (!IS_QLA84XX(ha)) { ql_dbg(ql_dbg_user, vha, 0x702f, "Not 84xx, exiting.\n"); return -EINVAL; } flag = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; rval = qla84xx_reset_chip(vha, flag == A84_ISSUE_RESET_DIAG_FW); if (rval) { ql_log(ql_log_warn, vha, 0x7030, "Vendor request 84xx reset failed.\n"); rval = (DID_ERROR << 16); } else { ql_dbg(ql_dbg_user, vha, 0x7031, "Vendor request 84xx reset completed.\n"); bsg_job->reply->result = DID_OK; bsg_job->job_done(bsg_job); } return rval; } static int qla84xx_updatefw(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; struct verify_chip_entry_84xx *mn = NULL; dma_addr_t mn_dma, fw_dma; void *fw_buf = NULL; int rval = 0; uint32_t sg_cnt; uint32_t data_len; uint16_t options; uint32_t flag; uint32_t fw_ver; if (!IS_QLA84XX(ha)) { ql_dbg(ql_dbg_user, vha, 0x7032, "Not 84xx, exiting.\n"); return -EINVAL; } sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!sg_cnt) { ql_log(ql_log_warn, vha, 0x7033, "dma_map_sg returned %d for request.\n", sg_cnt); return -ENOMEM; } if (sg_cnt != bsg_job->request_payload.sg_cnt) { ql_log(ql_log_warn, vha, 0x7034, "DMA mapping resulted in different sg counts, " "request_sg_cnt: %x dma_request_sg_cnt: %x.\n", bsg_job->request_payload.sg_cnt, sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } data_len = bsg_job->request_payload.payload_len; fw_buf = dma_alloc_coherent(&ha->pdev->dev, data_len, &fw_dma, GFP_KERNEL); if (!fw_buf) { ql_log(ql_log_warn, vha, 0x7035, "DMA alloc failed for fw_buf.\n"); rval = -ENOMEM; goto done_unmap_sg; } sg_copy_to_buffer(bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, fw_buf, data_len); mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); if (!mn) { ql_log(ql_log_warn, vha, 0x7036, "DMA alloc failed for fw buffer.\n"); rval = -ENOMEM; goto done_free_fw_buf; } flag = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; fw_ver = le32_to_cpu(*((uint32_t *)((uint32_t *)fw_buf + 2))); memset(mn, 0, sizeof(struct access_chip_84xx)); mn->entry_type = VERIFY_CHIP_IOCB_TYPE; mn->entry_count = 1; options = VCO_FORCE_UPDATE | VCO_END_OF_DATA; if (flag == A84_ISSUE_UPDATE_DIAGFW_CMD) options |= VCO_DIAG_FW; mn->options = cpu_to_le16(options); mn->fw_ver = cpu_to_le32(fw_ver); mn->fw_size = cpu_to_le32(data_len); mn->fw_seq_size = cpu_to_le32(data_len); mn->dseg_address[0] = cpu_to_le32(LSD(fw_dma)); mn->dseg_address[1] = cpu_to_le32(MSD(fw_dma)); mn->dseg_length = cpu_to_le32(data_len); mn->data_seg_cnt = cpu_to_le16(1); rval = qla2x00_issue_iocb_timeout(vha, mn, mn_dma, 0, 120); if (rval) { ql_log(ql_log_warn, vha, 0x7037, "Vendor request 84xx updatefw failed.\n"); rval = (DID_ERROR << 16); } else { ql_dbg(ql_dbg_user, vha, 0x7038, "Vendor request 84xx updatefw completed.\n"); bsg_job->reply_len = sizeof(struct fc_bsg_reply); bsg_job->reply->result = DID_OK; } dma_pool_free(ha->s_dma_pool, mn, mn_dma); done_free_fw_buf: dma_free_coherent(&ha->pdev->dev, data_len, fw_buf, fw_dma); done_unmap_sg: dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!rval) bsg_job->job_done(bsg_job); return rval; } static int qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; struct access_chip_84xx *mn = NULL; dma_addr_t mn_dma, mgmt_dma; void *mgmt_b = NULL; int rval = 0; struct qla_bsg_a84_mgmt *ql84_mgmt; uint32_t sg_cnt; uint32_t data_len = 0; uint32_t dma_direction = DMA_NONE; if (!IS_QLA84XX(ha)) { ql_log(ql_log_warn, vha, 0x703a, "Not 84xx, exiting.\n"); return -EINVAL; } ql84_mgmt = (struct qla_bsg_a84_mgmt *)((char *)bsg_job->request + sizeof(struct fc_bsg_request)); if (!ql84_mgmt) { ql_log(ql_log_warn, vha, 0x703b, "MGMT header not provided, exiting.\n"); return -EINVAL; } mn = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &mn_dma); if (!mn) { ql_log(ql_log_warn, vha, 0x703c, "DMA alloc failed for fw buffer.\n"); return -ENOMEM; } memset(mn, 0, sizeof(struct access_chip_84xx)); mn->entry_type = ACCESS_CHIP_IOCB_TYPE; mn->entry_count = 1; switch (ql84_mgmt->mgmt.cmd) { case QLA84_MGMT_READ_MEM: case QLA84_MGMT_GET_INFO: sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); if (!sg_cnt) { ql_log(ql_log_warn, vha, 0x703d, "dma_map_sg returned %d for reply.\n", sg_cnt); rval = -ENOMEM; goto exit_mgmt; } dma_direction = DMA_FROM_DEVICE; if (sg_cnt != bsg_job->reply_payload.sg_cnt) { ql_log(ql_log_warn, vha, 0x703e, "DMA mapping resulted in different sg counts, " "reply_sg_cnt: %x dma_reply_sg_cnt: %x.\n", bsg_job->reply_payload.sg_cnt, sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } data_len = bsg_job->reply_payload.payload_len; mgmt_b = dma_alloc_coherent(&ha->pdev->dev, data_len, &mgmt_dma, GFP_KERNEL); if (!mgmt_b) { ql_log(ql_log_warn, vha, 0x703f, "DMA alloc failed for mgmt_b.\n"); rval = -ENOMEM; goto done_unmap_sg; } if (ql84_mgmt->mgmt.cmd == QLA84_MGMT_READ_MEM) { mn->options = cpu_to_le16(ACO_DUMP_MEMORY); mn->parameter1 = cpu_to_le32( ql84_mgmt->mgmt.mgmtp.u.mem.start_addr); } else if (ql84_mgmt->mgmt.cmd == QLA84_MGMT_GET_INFO) { mn->options = cpu_to_le16(ACO_REQUEST_INFO); mn->parameter1 = cpu_to_le32(ql84_mgmt->mgmt.mgmtp.u.info.type); mn->parameter2 = cpu_to_le32( ql84_mgmt->mgmt.mgmtp.u.info.context); } break; case QLA84_MGMT_WRITE_MEM: sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!sg_cnt) { ql_log(ql_log_warn, vha, 0x7040, "dma_map_sg returned %d.\n", sg_cnt); rval = -ENOMEM; goto exit_mgmt; } dma_direction = DMA_TO_DEVICE; if (sg_cnt != bsg_job->request_payload.sg_cnt) { ql_log(ql_log_warn, vha, 0x7041, "DMA mapping resulted in different sg counts, " "request_sg_cnt: %x dma_request_sg_cnt: %x.\n", bsg_job->request_payload.sg_cnt, sg_cnt); rval = -EAGAIN; goto done_unmap_sg; } data_len = bsg_job->request_payload.payload_len; mgmt_b = dma_alloc_coherent(&ha->pdev->dev, data_len, &mgmt_dma, GFP_KERNEL); if (!mgmt_b) { ql_log(ql_log_warn, vha, 0x7042, "DMA alloc failed for mgmt_b.\n"); rval = -ENOMEM; goto done_unmap_sg; } sg_copy_to_buffer(bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, mgmt_b, data_len); mn->options = cpu_to_le16(ACO_LOAD_MEMORY); mn->parameter1 = cpu_to_le32(ql84_mgmt->mgmt.mgmtp.u.mem.start_addr); break; case QLA84_MGMT_CHNG_CONFIG: mn->options = cpu_to_le16(ACO_CHANGE_CONFIG_PARAM); mn->parameter1 = cpu_to_le32(ql84_mgmt->mgmt.mgmtp.u.config.id); mn->parameter2 = cpu_to_le32(ql84_mgmt->mgmt.mgmtp.u.config.param0); mn->parameter3 = cpu_to_le32(ql84_mgmt->mgmt.mgmtp.u.config.param1); break; default: rval = -EIO; goto exit_mgmt; } if (ql84_mgmt->mgmt.cmd != QLA84_MGMT_CHNG_CONFIG) { mn->total_byte_cnt = cpu_to_le32(ql84_mgmt->mgmt.len); mn->dseg_count = cpu_to_le16(1); mn->dseg_address[0] = cpu_to_le32(LSD(mgmt_dma)); mn->dseg_address[1] = cpu_to_le32(MSD(mgmt_dma)); mn->dseg_length = cpu_to_le32(ql84_mgmt->mgmt.len); } rval = qla2x00_issue_iocb(vha, mn, mn_dma, 0); if (rval) { ql_log(ql_log_warn, vha, 0x7043, "Vendor request 84xx mgmt failed.\n"); rval = (DID_ERROR << 16); } else { ql_dbg(ql_dbg_user, vha, 0x7044, "Vendor request 84xx mgmt completed.\n"); bsg_job->reply_len = sizeof(struct fc_bsg_reply); bsg_job->reply->result = DID_OK; if ((ql84_mgmt->mgmt.cmd == QLA84_MGMT_READ_MEM) || (ql84_mgmt->mgmt.cmd == QLA84_MGMT_GET_INFO)) { bsg_job->reply->reply_payload_rcv_len = bsg_job->reply_payload.payload_len; sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, mgmt_b, data_len); } } done_unmap_sg: if (mgmt_b) dma_free_coherent(&ha->pdev->dev, data_len, mgmt_b, mgmt_dma); if (dma_direction == DMA_TO_DEVICE) dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); else if (dma_direction == DMA_FROM_DEVICE) dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); exit_mgmt: dma_pool_free(ha->s_dma_pool, mn, mn_dma); if (!rval) bsg_job->job_done(bsg_job); return rval; } static int qla24xx_iidma(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); int rval = 0; struct qla_port_param *port_param = NULL; fc_port_t *fcport = NULL; uint16_t mb[MAILBOX_REGISTER_COUNT]; uint8_t *rsp_ptr = NULL; if (!IS_IIDMA_CAPABLE(vha->hw)) { ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); return -EINVAL; } port_param = (struct qla_port_param *)((char *)bsg_job->request + sizeof(struct fc_bsg_request)); if (!port_param) { ql_log(ql_log_warn, vha, 0x7047, "port_param header not provided.\n"); return -EINVAL; } if (port_param->fc_scsi_addr.dest_type != EXT_DEF_TYPE_WWPN) { ql_log(ql_log_warn, vha, 0x7048, "Invalid destination type.\n"); return -EINVAL; } list_for_each_entry(fcport, &vha->vp_fcports, list) { if (fcport->port_type != FCT_TARGET) continue; if (memcmp(port_param->fc_scsi_addr.dest_addr.wwpn, fcport->port_name, sizeof(fcport->port_name))) continue; break; } if (!fcport) { ql_log(ql_log_warn, vha, 0x7049, "Failed to find port.\n"); return -EINVAL; } if (atomic_read(&fcport->state) != FCS_ONLINE) { ql_log(ql_log_warn, vha, 0x704a, "Port is not online.\n"); return -EINVAL; } if (fcport->flags & FCF_LOGIN_NEEDED) { ql_log(ql_log_warn, vha, 0x704b, "Remote port not logged in flags = 0x%x.\n", fcport->flags); return -EINVAL; } if (port_param->mode) rval = qla2x00_set_idma_speed(vha, fcport->loop_id, port_param->speed, mb); else rval = qla2x00_get_idma_speed(vha, fcport->loop_id, &port_param->speed, mb); if (rval) { ql_log(ql_log_warn, vha, 0x704c, "iIDMA cmd failed for %02x%02x%02x%02x%02x%02x%02x%02x -- " "%04x %x %04x %04x.\n", fcport->port_name[0], fcport->port_name[1], fcport->port_name[2], fcport->port_name[3], fcport->port_name[4], fcport->port_name[5], fcport->port_name[6], fcport->port_name[7], rval, fcport->fp_speed, mb[0], mb[1]); rval = (DID_ERROR << 16); } else { if (!port_param->mode) { bsg_job->reply_len = sizeof(struct fc_bsg_reply) + sizeof(struct qla_port_param); rsp_ptr = ((uint8_t *)bsg_job->reply) + sizeof(struct fc_bsg_reply); memcpy(rsp_ptr, port_param, sizeof(struct qla_port_param)); } bsg_job->reply->result = DID_OK; bsg_job->job_done(bsg_job); } return rval; } static int qla2x00_optrom_setup(struct fc_bsg_job *bsg_job, scsi_qla_host_t *vha, uint8_t is_update) { uint32_t start = 0; int valid = 0; struct qla_hw_data *ha = vha->hw; if (unlikely(pci_channel_offline(ha->pdev))) return -EINVAL; start = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; if (start > ha->optrom_size) { ql_log(ql_log_warn, vha, 0x7055, "start %d > optrom_size %d.\n", start, ha->optrom_size); return -EINVAL; } if (ha->optrom_state != QLA_SWAITING) { ql_log(ql_log_info, vha, 0x7056, "optrom_state %d.\n", ha->optrom_state); return -EBUSY; } ha->optrom_region_start = start; ql_dbg(ql_dbg_user, vha, 0x7057, "is_update=%d.\n", is_update); if (is_update) { if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0) valid = 1; else if (start == (ha->flt_region_boot * 4) || start == (ha->flt_region_fw * 4)) valid = 1; else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha) || IS_CNA_CAPABLE(ha) || IS_QLA2031(ha)) valid = 1; if (!valid) { ql_log(ql_log_warn, vha, 0x7058, "Invalid start region 0x%x/0x%x.\n", start, bsg_job->request_payload.payload_len); return -EINVAL; } ha->optrom_region_size = start + bsg_job->request_payload.payload_len > ha->optrom_size ? ha->optrom_size - start : bsg_job->request_payload.payload_len; ha->optrom_state = QLA_SWRITING; } else { ha->optrom_region_size = start + bsg_job->reply_payload.payload_len > ha->optrom_size ? ha->optrom_size - start : bsg_job->reply_payload.payload_len; ha->optrom_state = QLA_SREADING; } ha->optrom_buffer = vmalloc(ha->optrom_region_size); if (!ha->optrom_buffer) { ql_log(ql_log_warn, vha, 0x7059, "Read: Unable to allocate memory for optrom retrieval " "(%x)\n", ha->optrom_region_size); ha->optrom_state = QLA_SWAITING; return -ENOMEM; } memset(ha->optrom_buffer, 0, ha->optrom_region_size); return 0; } static int qla2x00_read_optrom(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval = 0; if (ha->flags.nic_core_reset_hdlr_active) return -EBUSY; rval = qla2x00_optrom_setup(bsg_job, vha, 0); if (rval) return rval; ha->isp_ops->read_optrom(vha, ha->optrom_buffer, ha->optrom_region_start, ha->optrom_region_size); sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, ha->optrom_buffer, ha->optrom_region_size); bsg_job->reply->reply_payload_rcv_len = ha->optrom_region_size; bsg_job->reply->result = DID_OK; vfree(ha->optrom_buffer); ha->optrom_buffer = NULL; ha->optrom_state = QLA_SWAITING; bsg_job->job_done(bsg_job); return rval; } static int qla2x00_update_optrom(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval = 0; rval = qla2x00_optrom_setup(bsg_job, vha, 1); if (rval) return rval; /* Set the isp82xx_no_md_cap not to capture minidump */ ha->flags.isp82xx_no_md_cap = 1; sg_copy_to_buffer(bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, ha->optrom_buffer, ha->optrom_region_size); ha->isp_ops->write_optrom(vha, ha->optrom_buffer, ha->optrom_region_start, ha->optrom_region_size); bsg_job->reply->result = DID_OK; vfree(ha->optrom_buffer); ha->optrom_buffer = NULL; ha->optrom_state = QLA_SWAITING; bsg_job->job_done(bsg_job); return rval; } static int qla2x00_update_fru_versions(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval = 0; uint8_t bsg[DMA_POOL_SIZE]; struct qla_image_version_list *list = (void *)bsg; struct qla_image_version *image; uint32_t count; dma_addr_t sfp_dma; void *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); if (!sfp) { bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_NO_MEMORY; goto done; } sg_copy_to_buffer(bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, list, sizeof(bsg)); image = list->version; count = list->count; while (count--) { memcpy(sfp, &image->field_info, sizeof(image->field_info)); rval = qla2x00_write_sfp(vha, sfp_dma, sfp, image->field_address.device, image->field_address.offset, sizeof(image->field_info), image->field_address.option); if (rval) { bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_MAILBOX; goto dealloc; } image++; } bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = 0; dealloc: dma_pool_free(ha->s_dma_pool, sfp, sfp_dma); done: bsg_job->reply_len = sizeof(struct fc_bsg_reply); bsg_job->reply->result = DID_OK << 16; bsg_job->job_done(bsg_job); return 0; } static int qla2x00_read_fru_status(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval = 0; uint8_t bsg[DMA_POOL_SIZE]; struct qla_status_reg *sr = (void *)bsg; dma_addr_t sfp_dma; uint8_t *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); if (!sfp) { bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_NO_MEMORY; goto done; } sg_copy_to_buffer(bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, sr, sizeof(*sr)); rval = qla2x00_read_sfp(vha, sfp_dma, sfp, sr->field_address.device, sr->field_address.offset, sizeof(sr->status_reg), sr->field_address.option); sr->status_reg = *sfp; if (rval) { bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_MAILBOX; goto dealloc; } sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, sr, sizeof(*sr)); bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = 0; dealloc: dma_pool_free(ha->s_dma_pool, sfp, sfp_dma); done: bsg_job->reply_len = sizeof(struct fc_bsg_reply); bsg_job->reply->reply_payload_rcv_len = sizeof(*sr); bsg_job->reply->result = DID_OK << 16; bsg_job->job_done(bsg_job); return 0; } static int qla2x00_write_fru_status(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval = 0; uint8_t bsg[DMA_POOL_SIZE]; struct qla_status_reg *sr = (void *)bsg; dma_addr_t sfp_dma; uint8_t *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); if (!sfp) { bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_NO_MEMORY; goto done; } sg_copy_to_buffer(bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, sr, sizeof(*sr)); *sfp = sr->status_reg; rval = qla2x00_write_sfp(vha, sfp_dma, sfp, sr->field_address.device, sr->field_address.offset, sizeof(sr->status_reg), sr->field_address.option); if (rval) { bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_MAILBOX; goto dealloc; } bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = 0; dealloc: dma_pool_free(ha->s_dma_pool, sfp, sfp_dma); done: bsg_job->reply_len = sizeof(struct fc_bsg_reply); bsg_job->reply->result = DID_OK << 16; bsg_job->job_done(bsg_job); return 0; } static int qla2x00_write_i2c(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval = 0; uint8_t bsg[DMA_POOL_SIZE]; struct qla_i2c_access *i2c = (void *)bsg; dma_addr_t sfp_dma; uint8_t *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); if (!sfp) { bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_NO_MEMORY; goto done; } sg_copy_to_buffer(bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, i2c, sizeof(*i2c)); memcpy(sfp, i2c->buffer, i2c->length); rval = qla2x00_write_sfp(vha, sfp_dma, sfp, i2c->device, i2c->offset, i2c->length, i2c->option); if (rval) { bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_MAILBOX; goto dealloc; } bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = 0; dealloc: dma_pool_free(ha->s_dma_pool, sfp, sfp_dma); done: bsg_job->reply_len = sizeof(struct fc_bsg_reply); bsg_job->reply->result = DID_OK << 16; bsg_job->job_done(bsg_job); return 0; } static int qla2x00_read_i2c(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval = 0; uint8_t bsg[DMA_POOL_SIZE]; struct qla_i2c_access *i2c = (void *)bsg; dma_addr_t sfp_dma; uint8_t *sfp = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &sfp_dma); if (!sfp) { bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_NO_MEMORY; goto done; } sg_copy_to_buffer(bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, i2c, sizeof(*i2c)); rval = qla2x00_read_sfp(vha, sfp_dma, sfp, i2c->device, i2c->offset, i2c->length, i2c->option); if (rval) { bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_MAILBOX; goto dealloc; } memcpy(i2c->buffer, sfp, i2c->length); sg_copy_from_buffer(bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, i2c, sizeof(*i2c)); bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = 0; dealloc: dma_pool_free(ha->s_dma_pool, sfp, sfp_dma); done: bsg_job->reply_len = sizeof(struct fc_bsg_reply); bsg_job->reply->reply_payload_rcv_len = sizeof(*i2c); bsg_job->reply->result = DID_OK << 16; bsg_job->job_done(bsg_job); return 0; } static int qla24xx_process_bidir_cmd(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; uint16_t thread_id; uint32_t rval = EXT_STATUS_OK; uint16_t req_sg_cnt = 0; uint16_t rsp_sg_cnt = 0; uint16_t nextlid = 0; uint32_t tot_dsds; srb_t *sp = NULL; uint32_t req_data_len = 0; uint32_t rsp_data_len = 0; /* Check the type of the adapter */ if (!IS_BIDI_CAPABLE(ha)) { ql_log(ql_log_warn, vha, 0x70a0, "This adapter is not supported\n"); rval = EXT_STATUS_NOT_SUPPORTED; goto done; } if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { rval = EXT_STATUS_BUSY; goto done; } /* Check if host is online */ if (!vha->flags.online) { ql_log(ql_log_warn, vha, 0x70a1, "Host is not online\n"); rval = EXT_STATUS_DEVICE_OFFLINE; goto done; } /* Check if cable is plugged in or not */ if (vha->device_flags & DFLG_NO_CABLE) { ql_log(ql_log_warn, vha, 0x70a2, "Cable is unplugged...\n"); rval = EXT_STATUS_INVALID_CFG; goto done; } /* Check if the switch is connected or not */ if (ha->current_topology != ISP_CFG_F) { ql_log(ql_log_warn, vha, 0x70a3, "Host is not connected to the switch\n"); rval = EXT_STATUS_INVALID_CFG; goto done; } /* Check if operating mode is P2P */ if (ha->operating_mode != P2P) { ql_log(ql_log_warn, vha, 0x70a4, "Host is operating mode is not P2p\n"); rval = EXT_STATUS_INVALID_CFG; goto done; } thread_id = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; mutex_lock(&ha->selflogin_lock); if (vha->self_login_loop_id == 0) { /* Initialize all required fields of fcport */ vha->bidir_fcport.vha = vha; vha->bidir_fcport.d_id.b.al_pa = vha->d_id.b.al_pa; vha->bidir_fcport.d_id.b.area = vha->d_id.b.area; vha->bidir_fcport.d_id.b.domain = vha->d_id.b.domain; vha->bidir_fcport.loop_id = vha->loop_id; if (qla2x00_fabric_login(vha, &(vha->bidir_fcport), &nextlid)) { ql_log(ql_log_warn, vha, 0x70a7, "Failed to login port %06X for bidirectional IOCB\n", vha->bidir_fcport.d_id.b24); mutex_unlock(&ha->selflogin_lock); rval = EXT_STATUS_MAILBOX; goto done; } vha->self_login_loop_id = nextlid - 1; } /* Assign the self login loop id to fcport */ mutex_unlock(&ha->selflogin_lock); vha->bidir_fcport.loop_id = vha->self_login_loop_id; req_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!req_sg_cnt) { rval = EXT_STATUS_NO_MEMORY; goto done; } rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); if (!rsp_sg_cnt) { rval = EXT_STATUS_NO_MEMORY; goto done_unmap_req_sg; } if ((req_sg_cnt != bsg_job->request_payload.sg_cnt) || (rsp_sg_cnt != bsg_job->reply_payload.sg_cnt)) { ql_dbg(ql_dbg_user, vha, 0x70a9, "Dma mapping resulted in different sg counts " "[request_sg_cnt: %x dma_request_sg_cnt: %x reply_sg_cnt: " "%x dma_reply_sg_cnt: %x]\n", bsg_job->request_payload.sg_cnt, req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); rval = EXT_STATUS_NO_MEMORY; goto done_unmap_sg; } if (req_data_len != rsp_data_len) { rval = EXT_STATUS_BUSY; ql_log(ql_log_warn, vha, 0x70aa, "req_data_len != rsp_data_len\n"); goto done_unmap_sg; } req_data_len = bsg_job->request_payload.payload_len; rsp_data_len = bsg_job->reply_payload.payload_len; /* Alloc SRB structure */ sp = qla2x00_get_sp(vha, &(vha->bidir_fcport), GFP_KERNEL); if (!sp) { ql_dbg(ql_dbg_user, vha, 0x70ac, "Alloc SRB structure failed\n"); rval = EXT_STATUS_NO_MEMORY; goto done_unmap_sg; } /*Populate srb->ctx with bidir ctx*/ sp->u.bsg_job = bsg_job; sp->free = qla2x00_bsg_sp_free; sp->type = SRB_BIDI_CMD; sp->done = qla2x00_bsg_job_done; /* Add the read and write sg count */ tot_dsds = rsp_sg_cnt + req_sg_cnt; rval = qla2x00_start_bidir(sp, vha, tot_dsds); if (rval != EXT_STATUS_OK) goto done_free_srb; /* the bsg request will be completed in the interrupt handler */ return rval; done_free_srb: mempool_free(sp, ha->srb_mempool); done_unmap_sg: dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); done_unmap_req_sg: dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); done: /* Return an error vendor specific response * and complete the bsg request */ bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = rval; bsg_job->reply_len = sizeof(struct fc_bsg_reply); bsg_job->reply->reply_payload_rcv_len = 0; bsg_job->reply->result = (DID_OK) << 16; bsg_job->job_done(bsg_job); /* Always retrun success, vendor rsp carries correct status */ return 0; } static int qlafx00_mgmt_cmd(struct fc_bsg_job *bsg_job) { struct Scsi_Host *host = bsg_job->shost; scsi_qla_host_t *vha = shost_priv(host); struct qla_hw_data *ha = vha->hw; int rval = (DRIVER_ERROR << 16); struct qla_mt_iocb_rqst_fx00 *piocb_rqst; srb_t *sp; int req_sg_cnt = 0, rsp_sg_cnt = 0; struct fc_port *fcport; char *type = "FC_BSG_HST_FX_MGMT"; /* Copy the IOCB specific information */ piocb_rqst = (struct qla_mt_iocb_rqst_fx00 *) &bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; /* Dump the vendor information */ ql_dump_buffer(ql_dbg_user + ql_dbg_verbose , vha, 0x70cf, (uint8_t *)piocb_rqst, sizeof(struct qla_mt_iocb_rqst_fx00)); if (!vha->flags.online) { ql_log(ql_log_warn, vha, 0x70d0, "Host is not online.\n"); rval = -EIO; goto done; } if (piocb_rqst->flags & SRB_FXDISC_REQ_DMA_VALID) { req_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); if (!req_sg_cnt) { ql_log(ql_log_warn, vha, 0x70c7, "dma_map_sg return %d for request\n", req_sg_cnt); rval = -ENOMEM; goto done; } } if (piocb_rqst->flags & SRB_FXDISC_RESP_DMA_VALID) { rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); if (!rsp_sg_cnt) { ql_log(ql_log_warn, vha, 0x70c8, "dma_map_sg return %d for reply\n", rsp_sg_cnt); rval = -ENOMEM; goto done_unmap_req_sg; } } ql_dbg(ql_dbg_user, vha, 0x70c9, "request_sg_cnt: %x dma_request_sg_cnt: %x reply_sg_cnt:%x " "dma_reply_sg_cnt: %x\n", bsg_job->request_payload.sg_cnt, req_sg_cnt, bsg_job->reply_payload.sg_cnt, rsp_sg_cnt); /* Allocate a dummy fcport structure, since functions preparing the * IOCB and mailbox command retrieves port specific information * from fcport structure. For Host based ELS commands there will be * no fcport structure allocated */ fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL); if (!fcport) { ql_log(ql_log_warn, vha, 0x70ca, "Failed to allocate fcport.\n"); rval = -ENOMEM; goto done_unmap_rsp_sg; } /* Alloc SRB structure */ sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) { ql_log(ql_log_warn, vha, 0x70cb, "qla2x00_get_sp failed.\n"); rval = -ENOMEM; goto done_free_fcport; } /* Initialize all required fields of fcport */ fcport->vha = vha; fcport->loop_id = piocb_rqst->dataword; sp->type = SRB_FXIOCB_BCMD; sp->name = "bsg_fx_mgmt"; sp->iocbs = qla24xx_calc_ct_iocbs(req_sg_cnt + rsp_sg_cnt); sp->u.bsg_job = bsg_job; sp->free = qla2x00_bsg_sp_free; sp->done = qla2x00_bsg_job_done; ql_dbg(ql_dbg_user, vha, 0x70cc, "bsg rqst type: %s fx_mgmt_type: %x id=%x\n", type, piocb_rqst->func_type, fcport->loop_id); rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x70cd, "qla2x00_start_sp failed=%d.\n", rval); mempool_free(sp, ha->srb_mempool); rval = -EIO; goto done_free_fcport; } return rval; done_free_fcport: kfree(fcport); done_unmap_rsp_sg: if (piocb_rqst->flags & SRB_FXDISC_RESP_DMA_VALID) dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); done_unmap_req_sg: if (piocb_rqst->flags & SRB_FXDISC_REQ_DMA_VALID) dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); done: return rval; } static int qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job) { switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) { case QL_VND_LOOPBACK: return qla2x00_process_loopback(bsg_job); case QL_VND_A84_RESET: return qla84xx_reset(bsg_job); case QL_VND_A84_UPDATE_FW: return qla84xx_updatefw(bsg_job); case QL_VND_A84_MGMT_CMD: return qla84xx_mgmt_cmd(bsg_job); case QL_VND_IIDMA: return qla24xx_iidma(bsg_job); case QL_VND_FCP_PRIO_CFG_CMD: return qla24xx_proc_fcp_prio_cfg_cmd(bsg_job); case QL_VND_READ_FLASH: return qla2x00_read_optrom(bsg_job); case QL_VND_UPDATE_FLASH: return qla2x00_update_optrom(bsg_job); case QL_VND_SET_FRU_VERSION: return qla2x00_update_fru_versions(bsg_job); case QL_VND_READ_FRU_STATUS: return qla2x00_read_fru_status(bsg_job); case QL_VND_WRITE_FRU_STATUS: return qla2x00_write_fru_status(bsg_job); case QL_VND_WRITE_I2C: return qla2x00_write_i2c(bsg_job); case QL_VND_READ_I2C: return qla2x00_read_i2c(bsg_job); case QL_VND_DIAG_IO_CMD: return qla24xx_process_bidir_cmd(bsg_job); case QL_VND_FX00_MGMT_CMD: return qlafx00_mgmt_cmd(bsg_job); default: return -ENOSYS; } } int qla24xx_bsg_request(struct fc_bsg_job *bsg_job) { int ret = -EINVAL; struct fc_rport *rport; fc_port_t *fcport = NULL; struct Scsi_Host *host; scsi_qla_host_t *vha; /* In case no data transferred. */ bsg_job->reply->reply_payload_rcv_len = 0; if (bsg_job->request->msgcode == FC_BSG_RPT_ELS) { rport = bsg_job->rport; fcport = *(fc_port_t **) rport->dd_data; host = rport_to_shost(rport); vha = shost_priv(host); } else { host = bsg_job->shost; vha = shost_priv(host); } if (qla2x00_reset_active(vha)) { ql_dbg(ql_dbg_user, vha, 0x709f, "BSG: ISP abort active/needed -- cmd=%d.\n", bsg_job->request->msgcode); return -EBUSY; } ql_dbg(ql_dbg_user, vha, 0x7000, "Entered %s msgcode=0x%x.\n", __func__, bsg_job->request->msgcode); switch (bsg_job->request->msgcode) { case FC_BSG_RPT_ELS: case FC_BSG_HST_ELS_NOLOGIN: ret = qla2x00_process_els(bsg_job); break; case FC_BSG_HST_CT: ret = qla2x00_process_ct(bsg_job); break; case FC_BSG_HST_VENDOR: ret = qla2x00_process_vendor_specific(bsg_job); break; case FC_BSG_HST_ADD_RPORT: case FC_BSG_HST_DEL_RPORT: case FC_BSG_RPT_CT: default: ql_log(ql_log_warn, vha, 0x705a, "Unsupported BSG request.\n"); break; } return ret; } int qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job) { scsi_qla_host_t *vha = shost_priv(bsg_job->shost); struct qla_hw_data *ha = vha->hw; srb_t *sp; int cnt, que; unsigned long flags; struct req_que *req; /* find the bsg job from the active list of commands */ spin_lock_irqsave(&ha->hardware_lock, flags); for (que = 0; que < ha->max_req_queues; que++) { req = ha->req_q_map[que]; if (!req) continue; for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { sp = req->outstanding_cmds[cnt]; if (sp) { if (((sp->type == SRB_CT_CMD) || (sp->type == SRB_ELS_CMD_HST) || (sp->type == SRB_FXIOCB_BCMD)) && (sp->u.bsg_job == bsg_job)) { spin_unlock_irqrestore(&ha->hardware_lock, flags); if (ha->isp_ops->abort_command(sp)) { ql_log(ql_log_warn, vha, 0x7089, "mbx abort_command " "failed.\n"); bsg_job->req->errors = bsg_job->reply->result = -EIO; } else { ql_dbg(ql_dbg_user, vha, 0x708a, "mbx abort_command " "success.\n"); bsg_job->req->errors = bsg_job->reply->result = 0; } spin_lock_irqsave(&ha->hardware_lock, flags); goto done; } } } } spin_unlock_irqrestore(&ha->hardware_lock, flags); ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n"); bsg_job->req->errors = bsg_job->reply->result = -ENXIO; return 0; done: spin_unlock_irqrestore(&ha->hardware_lock, flags); if (bsg_job->request->msgcode == FC_BSG_HST_CT) kfree(sp->fcport); qla2x00_rel_sp(vha, sp); return 0; }
evolver56k/xpenology
drivers/scsi/qla2xxx/qla_bsg.c
C
gpl-2.0
59,034
/* This is part of TeXworks, an environment for working with TeX documents Copyright (C) 2011-2013 Jonathan Kew, Stefan Löffler, Charlie Sharpsteen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. For links to further information, or to contact the authors, see <http://www.tug.org/texworks/>. */ // Default paths to TeX binaries on Windows, for TeXworks #define DEFAULT_BIN_PATHS "c:/texlive/2013/bin;c:/texlive/2012/bin;c:/texlive/2011/bin;c:/texlive/2010/bin;c:/texlive/2009/bin;c:/texlive/2008/bin;c:/texlive/2007/bin;c:/w32tex/bin;c:/Program Files/MiKTeX 3.0/miktex/bin;c:/Program Files (x86)/MiKTeX 3.0/miktex/bin;c:/Program Files/MiKTeX 2.9/miktex/bin;c:/Program Files (x86)/MiKTeX 2.9/miktex/bin;c:/Program Files/MiKTeX 2.8/miktex/bin;c:/Program Files (x86)/MiKTeX 2.8/miktex/bin;c:/Program Files/MiKTeX 2.7/miktex/bin;c:/Program Files (x86)/MiKTeX 2.7/miktex/bin"
svn2github/texworks
src/DefaultBinaryPathsWin.h
C
gpl-2.0
1,455
/* This file is part of libkabc. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "resourcenet.h" #include "resourcenetconfig.h" #include "kabc/addressbook.h" #include "kabc/formatfactory.h" #include "kabc/stdaddressbook.h" #include <kio/netaccess.h> #include <kio/scheduler.h> #include <kdebug.h> #include <klocalizedstring.h> #include <ksavefile.h> #include <ktemporaryfile.h> #include <kurlrequester.h> #include <kconfiggroup.h> #include <QtCore/QFile> using namespace KABC; class ResourceNet::ResourceNetPrivate { public: KIO::Job *mLoadJob; bool mIsLoading; KIO::Job *mSaveJob; bool mIsSaving; }; ResourceNet::ResourceNet() : Resource(), mFormat( 0 ), mTempFile( 0 ), d( new ResourceNetPrivate ) { init( KUrl(), QLatin1String( "vcard" ) ); } ResourceNet::ResourceNet( const KConfigGroup &group ) : Resource( group ), mFormat( 0 ), mTempFile( 0 ), d( new ResourceNetPrivate ) { init( KUrl( group.readPathEntry( "NetUrl", QString() ) ), group.readEntry( "NetFormat" ) ); } ResourceNet::ResourceNet( const KUrl &url, const QString &format ) : Resource(), mFormat( 0 ), mTempFile( 0 ), d( new ResourceNetPrivate ) { init( url, format ); } void ResourceNet::init( const KUrl &url, const QString &format ) { d->mLoadJob = 0; d->mIsLoading = false; d->mSaveJob = 0; d->mIsSaving = false; mFormatName = format; FormatFactory *factory = FormatFactory::self(); mFormat = factory->format( mFormatName ); if ( !mFormat ) { mFormatName = QLatin1String( "vcard" ); mFormat = factory->format( mFormatName ); } setUrl( url ); } ResourceNet::~ResourceNet() { if ( d->mIsLoading ) { d->mLoadJob->kill(); } if ( d->mIsSaving ) { d->mSaveJob->kill(); } delete d; d = 0; delete mFormat; mFormat = 0; deleteLocalTempFile(); } void ResourceNet::writeConfig( KConfigGroup &group ) { Resource::writeConfig( group ); group.writePathEntry( "NetUrl", mUrl.url() ); group.writeEntry( "NetFormat", mFormatName ); } Ticket *ResourceNet::requestSaveTicket() { kDebug(); return createTicket( this ); } void ResourceNet::releaseSaveTicket( Ticket *ticket ) { delete ticket; } bool ResourceNet::doOpen() { return true; } void ResourceNet::doClose() { } bool ResourceNet::load() { QString tempFile; if ( !KIO::NetAccess::download( mUrl, tempFile, 0 ) ) { addressBook()->error( i18n( "Unable to download file '%1'.", mUrl.prettyUrl() ) ); return false; } QFile file( tempFile ); if ( !file.open( QIODevice::ReadOnly ) ) { addressBook()->error( i18n( "Unable to open file '%1'.", tempFile ) ); KIO::NetAccess::removeTempFile( tempFile ); return false; } bool result = clearAndLoad( &file ); if ( !result ) { addressBook()->error( i18n( "Problems parsing file '%1'.", tempFile ) ); } KIO::NetAccess::removeTempFile( tempFile ); return result; } bool ResourceNet::clearAndLoad( QFile *file ) { clear(); return mFormat->loadAll( addressBook(), this, file ); } bool ResourceNet::asyncLoad() { if ( d->mIsLoading ) { abortAsyncLoading(); } if ( d->mIsSaving ) { kWarning() << "Aborted asyncLoad() because we're still saving!"; return false; } bool ok = createLocalTempFile(); if ( !ok ) { emit loadingError( this, i18n( "Unable to open file '%1'.", mTempFile->fileName() ) ); deleteLocalTempFile(); return false; } KUrl dest; dest.setPath( mTempFile->fileName() ); KIO::Scheduler::checkSlaveOnHold( true ); d->mLoadJob = KIO::file_copy( mUrl, dest, -1, KIO::Overwrite | KIO::HideProgressInfo ); d->mIsLoading = true; connect( d->mLoadJob, SIGNAL(result(KJob*)), this, SLOT(downloadFinished(KJob*)) ); return true; } void ResourceNet::abortAsyncLoading() { kDebug(); if ( d->mLoadJob ) { d->mLoadJob->kill(); // result not emitted d->mLoadJob = 0; } deleteLocalTempFile(); d->mIsLoading = false; } void ResourceNet::abortAsyncSaving() { kDebug(); if ( d->mSaveJob ) { d->mSaveJob->kill(); // result not emitted d->mSaveJob = 0; } deleteLocalTempFile(); d->mIsSaving = false; } bool ResourceNet::save( Ticket *ticket ) { Q_UNUSED( ticket ); kDebug(); if ( d->mIsSaving ) { abortAsyncSaving(); } KTemporaryFile tempFile; bool ok = tempFile.open(); if ( ok ) { saveToFile( &tempFile ); tempFile.flush(); } if ( !ok ) { addressBook()->error( i18n( "Unable to save file '%1'.", tempFile.fileName() ) ); return false; } ok = KIO::NetAccess::upload( tempFile.fileName(), mUrl, 0 ); if ( !ok ) { addressBook()->error( i18n( "Unable to upload to '%1'.", mUrl.prettyUrl() ) ); } return ok; } bool ResourceNet::asyncSave( Ticket *ticket ) { Q_UNUSED( ticket ); kDebug(); if ( d->mIsSaving ) { abortAsyncSaving(); } if ( d->mIsLoading ) { kWarning() << "Aborted asyncSave() because we're still loading!"; return false; } bool ok = createLocalTempFile(); if ( ok ) { saveToFile( mTempFile ); mTempFile->flush(); } if ( !ok ) { emit savingError( this, i18n( "Unable to save file '%1'.", mTempFile->fileName() ) ); deleteLocalTempFile(); return false; } KUrl src; src.setPath( mTempFile->fileName() ); KIO::Scheduler::checkSlaveOnHold( true ); d->mIsSaving = true; d->mSaveJob = KIO::file_copy( src, mUrl, -1, KIO::Overwrite | KIO::HideProgressInfo ); connect( d->mSaveJob, SIGNAL(result(KJob*)), this, SLOT(uploadFinished(KJob*)) ); return true; } bool ResourceNet::createLocalTempFile() { deleteStaleTempFile(); mTempFile = new KTemporaryFile(); return mTempFile->open(); } void ResourceNet::deleteStaleTempFile() { if ( hasTempFile() ) { kDebug() << "stale temp file detected" << mTempFile->fileName(); deleteLocalTempFile(); } } void ResourceNet::deleteLocalTempFile() { delete mTempFile; mTempFile = 0; } void ResourceNet::saveToFile( QFile *file ) { mFormat->saveAll( addressBook(), this, file ); } void ResourceNet::setUrl( const KUrl &url ) { mUrl = url; } KUrl ResourceNet::url() const { return mUrl; } void ResourceNet::setFormat( const QString &name ) { mFormatName = name; delete mFormat; FormatFactory *factory = FormatFactory::self(); mFormat = factory->format( mFormatName ); } QString ResourceNet::format() const { return mFormatName; } void ResourceNet::downloadFinished( KJob *job ) { Q_UNUSED( job ); kDebug(); d->mIsLoading = false; if ( !hasTempFile() ) { emit loadingError( this, i18n( "Download failed, could not create temporary file" ) ); return; } QFile file( mTempFile->fileName() ); if ( file.open( QIODevice::ReadOnly ) ) { if ( clearAndLoad( &file ) ) { emit loadingFinished( this ); } else { emit loadingError( this, i18n( "Problems during parsing file '%1'.", mTempFile->fileName() ) ); } } else { emit loadingError( this, i18n( "Unable to open file '%1'.", mTempFile->fileName() ) ); } deleteLocalTempFile(); } void ResourceNet::uploadFinished( KJob *job ) { kDebug(); d->mIsSaving = false; if ( job->error() ) { emit savingError( this, job->errorString() ); } else { emit savingFinished( this ); } deleteLocalTempFile(); }
kolab-groupware/kdepimlibs
kabc/plugins/net/resourcenet.cpp
C++
gpl-2.0
8,171
<?php //============================================================+ // File name : tcpdf_fonts.php // Version : 1.1.0 // Begin : 2008-01-01 // Last Update : 2014-12-10 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- // Copyright (C) 2008-2014 Nicola Asuni - Tecnick.com LTD // // This file is part of TCPDF software library. // // TCPDF 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 3 of the // License, or (at your option) any later version. // // TCPDF 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 TCPDF. If not, see <http://www.gnu.org/licenses/>. // // See LICENSE.TXT file for more information. // ------------------------------------------------------------------- // // Description :Font methods for TCPDF library. // //============================================================+ /** * @file * Unicode data and font methods for TCPDF library. * @author Nicola Asuni * @package com.tecnick.tcpdf */ /** * @class TCPDF_FONTS * Font methods for TCPDF library. * @package com.tecnick.tcpdf * @version 1.1.0 * @author Nicola Asuni - info@tecnick.com */ class TCPDF_FONTS { /** * Static cache used for speed up uniord performances * @protected */ protected static $cache_uniord = array(); /** * Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable). * @param $fontfile (string) Font file (full path). * @param $fonttype (string) Font type. Leave empty for autodetect mode. Valid values are: TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT = CID-0 Chinese Traditional. * @param $enc (string) Name of the encoding table to use. Leave empty for default mode. Omit this parameter for TrueType Unicode and symbolic fonts like Symbol or ZapfDingBats. * @param $flags (int) Unsigned 32-bit integer containing flags specifying various characteristics of the font (PDF32000:2008 - 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for symbol or +32 for non-symbol; +64 for italic. Fixed and Italic mode are generally autodetected so you have to set it to 32 = non-symbolic font (default) or 4 = symbolic font. * @param $outpath (string) Output path for generated font files (must be writeable by the web server). Leave empty for default font folder. * @param $platid (int) Platform ID for CMAP table to extract (when building a Unicode font for Windows this value should be 3, for Macintosh should be 1). * @param $encid (int) Encoding ID for CMAP table to extract (when building a Unicode font for Windows this value should be 1, for Macintosh should be 0). When Platform ID is 3, legal values for Encoding ID are: 0=Symbol, 1=Unicode, 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab, 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4. * @param $addcbbox (boolean) If true includes the character bounding box information on the php font file. * @param $link (boolean) If true link to system font instead of copying the font data (not transportable) - Note: do not work with Type1 fonts. * @return (string) TCPDF font name or boolean false in case of error. * @author Nicola Asuni * @since 5.9.123 (2010-09-30) * @public static */ public static function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $outpath='', $platid=3, $encid=1, $addcbbox=false, $link=false) { if (!TCPDF_STATIC::file_exists($fontfile)) { // Could not find file return false; } // font metrics $fmetric = array(); // build new font name for TCPDF compatibility $font_path_parts = pathinfo($fontfile); if (!isset($font_path_parts['filename'])) { $font_path_parts['filename'] = substr($font_path_parts['basename'], 0, -(strlen($font_path_parts['extension']) + 1)); } $font_name = strtolower($font_path_parts['filename']); $font_name = preg_replace('/[^a-z0-9_]/', '', $font_name); $search = array('bold', 'oblique', 'italic', 'regular'); $replace = array('b', 'i', 'i', ''); $font_name = str_replace($search, $replace, $font_name); if (empty($font_name)) { // set generic name $font_name = 'tcpdffont'; } // set output path if (empty($outpath)) { $outpath = self::_getfontpath(); } // check if this font already exist if (@TCPDF_STATIC::file_exists($outpath.$font_name.'.php')) { // this font already exist (delete it from fonts folder to rebuild it) return $font_name; } $fmetric['file'] = $font_name; $fmetric['ctg'] = $font_name.'.ctg.z'; // get font data $font = file_get_contents($fontfile); $fmetric['originalsize'] = strlen($font); // autodetect font type if (empty($fonttype)) { if (TCPDF_STATIC::_getULONG($font, 0) == 0x10000) { // True Type (Unicode or not) $fonttype = 'TrueTypeUnicode'; } elseif (substr($font, 0, 4) == 'OTTO') { // Open Type (Unicode or not) //Unsupported font format: OpenType with CFF data return false; } else { // Type 1 $fonttype = 'Type1'; } } // set font type switch ($fonttype) { case 'CID0CT': case 'CID0CS': case 'CID0KR': case 'CID0JP': { $fmetric['type'] = 'cidfont0'; break; } case 'Type1': { $fmetric['type'] = 'Type1'; if (empty($enc) AND (($flags & 4) == 0)) { $enc = 'cp1252'; } break; } case 'TrueType': { $fmetric['type'] = 'TrueType'; break; } case 'TrueTypeUnicode': default: { $fmetric['type'] = 'TrueTypeUnicode'; break; } } // set encoding maps (if any) $fmetric['enc'] = preg_replace('/[^A-Za-z0-9_\-]/', '', $enc); $fmetric['diff'] = ''; if (($fmetric['type'] == 'TrueType') OR ($fmetric['type'] == 'Type1')) { if (!empty($enc) AND ($enc != 'cp1252') AND isset(TCPDF_FONT_DATA::$encmap[$enc])) { // build differences from reference encoding $enc_ref = TCPDF_FONT_DATA::$encmap['cp1252']; $enc_target = TCPDF_FONT_DATA::$encmap[$enc]; $last = 0; for ($i = 32; $i <= 255; ++$i) { if ($enc_target[$i] != $enc_ref[$i]) { if ($i != ($last + 1)) { $fmetric['diff'] .= $i.' '; } $last = $i; $fmetric['diff'] .= '/'.$enc_target[$i].' '; } } } } // parse the font by type if ($fmetric['type'] == 'Type1') { // ---------- TYPE 1 ---------- // read first segment $a = unpack('Cmarker/Ctype/Vsize', substr($font, 0, 6)); if ($a['marker'] != 128) { // Font file is not a valid binary Type1 return false; } $fmetric['size1'] = $a['size']; $data = substr($font, 6, $fmetric['size1']); // read second segment $a = unpack('Cmarker/Ctype/Vsize', substr($font, (6 + $fmetric['size1']), 6)); if ($a['marker'] != 128) { // Font file is not a valid binary Type1 return false; } $fmetric['size2'] = $a['size']; $encrypted = substr($font, (12 + $fmetric['size1']), $fmetric['size2']); $data .= $encrypted; // store compressed font $fmetric['file'] .= '.z'; $fp = TCPDF_STATIC::fopenLocal($outpath.$fmetric['file'], 'wb'); fwrite($fp, gzcompress($data)); fclose($fp); // get font info $fmetric['Flags'] = $flags; preg_match ('#/FullName[\s]*\(([^\)]*)#', $font, $matches); $fmetric['name'] = preg_replace('/[^a-zA-Z0-9_\-]/', '', $matches[1]); preg_match('#/FontBBox[\s]*{([^}]*)#', $font, $matches); $fmetric['bbox'] = trim($matches[1]); $bv = explode(' ', $fmetric['bbox']); $fmetric['Ascent'] = intval($bv[3]); $fmetric['Descent'] = intval($bv[1]); preg_match('#/ItalicAngle[\s]*([0-9\+\-]*)#', $font, $matches); $fmetric['italicAngle'] = intval($matches[1]); if ($fmetric['italicAngle'] != 0) { $fmetric['Flags'] |= 64; } preg_match('#/UnderlinePosition[\s]*([0-9\+\-]*)#', $font, $matches); $fmetric['underlinePosition'] = intval($matches[1]); preg_match('#/UnderlineThickness[\s]*([0-9\+\-]*)#', $font, $matches); $fmetric['underlineThickness'] = intval($matches[1]); preg_match('#/isFixedPitch[\s]*([^\s]*)#', $font, $matches); if ($matches[1] == 'true') { $fmetric['Flags'] |= 1; } // get internal map $imap = array(); if (preg_match_all('#dup[\s]([0-9]+)[\s]*/([^\s]*)[\s]put#sU', $font, $fmap, PREG_SET_ORDER) > 0) { foreach ($fmap as $v) { $imap[$v[2]] = $v[1]; } } // decrypt eexec encrypted part $r = 55665; // eexec encryption constant $c1 = 52845; $c2 = 22719; $elen = strlen($encrypted); $eplain = ''; for ($i = 0; $i < $elen; ++$i) { $chr = ord($encrypted[$i]); $eplain .= chr($chr ^ ($r >> 8)); $r = ((($chr + $r) * $c1 + $c2) % 65536); } if (preg_match('#/ForceBold[\s]*([^\s]*)#', $eplain, $matches) > 0) { if ($matches[1] == 'true') { $fmetric['Flags'] |= 0x40000; } } if (preg_match('#/StdVW[\s]*\[([^\]]*)#', $eplain, $matches) > 0) { $fmetric['StemV'] = intval($matches[1]); } else { $fmetric['StemV'] = 70; } if (preg_match('#/StdHW[\s]*\[([^\]]*)#', $eplain, $matches) > 0) { $fmetric['StemH'] = intval($matches[1]); } else { $fmetric['StemH'] = 30; } if (preg_match('#/BlueValues[\s]*\[([^\]]*)#', $eplain, $matches) > 0) { $bv = explode(' ', $matches[1]); if (count($bv) >= 6) { $v1 = intval($bv[2]); $v2 = intval($bv[4]); if ($v1 <= $v2) { $fmetric['XHeight'] = $v1; $fmetric['CapHeight'] = $v2; } else { $fmetric['XHeight'] = $v2; $fmetric['CapHeight'] = $v1; } } else { $fmetric['XHeight'] = 450; $fmetric['CapHeight'] = 700; } } else { $fmetric['XHeight'] = 450; $fmetric['CapHeight'] = 700; } // get the number of random bytes at the beginning of charstrings if (preg_match('#/lenIV[\s]*([0-9]*)#', $eplain, $matches) > 0) { $lenIV = intval($matches[1]); } else { $lenIV = 4; } $fmetric['Leading'] = 0; // get charstring data $eplain = substr($eplain, (strpos($eplain, '/CharStrings') + 1)); preg_match_all('#/([A-Za-z0-9\.]*)[\s][0-9]+[\s]RD[\s](.*)[\s]ND#sU', $eplain, $matches, PREG_SET_ORDER); if (!empty($enc) AND isset(TCPDF_FONT_DATA::$encmap[$enc])) { $enc_map = TCPDF_FONT_DATA::$encmap[$enc]; } else { $enc_map = false; } $fmetric['cw'] = ''; $fmetric['MaxWidth'] = 0; $cwidths = array(); foreach ($matches as $k => $v) { $cid = 0; if (isset($imap[$v[1]])) { $cid = $imap[$v[1]]; } elseif ($enc_map !== false) { $cid = array_search($v[1], $enc_map); if ($cid === false) { $cid = 0; } elseif ($cid > 1000) { $cid -= 1000; } } // decrypt charstring encrypted part $r = 4330; // charstring encryption constant $c1 = 52845; $c2 = 22719; $cd = $v[2]; $clen = strlen($cd); $ccom = array(); for ($i = 0; $i < $clen; ++$i) { $chr = ord($cd[$i]); $ccom[] = ($chr ^ ($r >> 8)); $r = ((($chr + $r) * $c1 + $c2) % 65536); } // decode numbers $cdec = array(); $ck = 0; $i = $lenIV; while ($i < $clen) { if ($ccom[$i] < 32) { $cdec[$ck] = $ccom[$i]; if (($ck > 0) AND ($cdec[$ck] == 13)) { // hsbw command: update width $cwidths[$cid] = $cdec[($ck - 1)]; } ++$i; } elseif (($ccom[$i] >= 32) AND ($ccom[$i] <= 246)) { $cdec[$ck] = ($ccom[$i] - 139); ++$i; } elseif (($ccom[$i] >= 247) AND ($ccom[$i] <= 250)) { $cdec[$ck] = ((($ccom[$i] - 247) * 256) + $ccom[($i + 1)] + 108); $i += 2; } elseif (($ccom[$i] >= 251) AND ($ccom[$i] <= 254)) { $cdec[$ck] = ((-($ccom[$i] - 251) * 256) - $ccom[($i + 1)] - 108); $i += 2; } elseif ($ccom[$i] == 255) { $sval = chr($ccom[($i + 1)]).chr($ccom[($i + 2)]).chr($ccom[($i + 3)]).chr($ccom[($i + 4)]); $vsval = unpack('li', $sval); $cdec[$ck] = $vsval['i']; $i += 5; } ++$ck; } } // end for each matches $fmetric['MissingWidth'] = $cwidths[0]; $fmetric['MaxWidth'] = $fmetric['MissingWidth']; $fmetric['AvgWidth'] = 0; // set chars widths for ($cid = 0; $cid <= 255; ++$cid) { if (isset($cwidths[$cid])) { if ($cwidths[$cid] > $fmetric['MaxWidth']) { $fmetric['MaxWidth'] = $cwidths[$cid]; } $fmetric['AvgWidth'] += $cwidths[$cid]; $fmetric['cw'] .= ','.$cid.'=>'.$cwidths[$cid]; } else { $fmetric['cw'] .= ','.$cid.'=>'.$fmetric['MissingWidth']; } } $fmetric['AvgWidth'] = round($fmetric['AvgWidth'] / count($cwidths)); } else { // ---------- TRUE TYPE ---------- $offset = 0; // offset position of the font data if (TCPDF_STATIC::_getULONG($font, $offset) != 0x10000) { // sfnt version must be 0x00010000 for TrueType version 1.0. return false; } if ($fmetric['type'] != 'cidfont0') { if ($link) { // creates a symbolic link to the existing font symlink($fontfile, $outpath.$fmetric['file']); } else { // store compressed font $fmetric['file'] .= '.z'; $fp = TCPDF_STATIC::fopenLocal($outpath.$fmetric['file'], 'wb'); fwrite($fp, gzcompress($font)); fclose($fp); } } $offset += 4; // get number of tables $numTables = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; // skip searchRange, entrySelector and rangeShift $offset += 6; // tables array $table = array(); // ---------- get tables ---------- for ($i = 0; $i < $numTables; ++$i) { // get table info $tag = substr($font, $offset, 4); $offset += 4; $table[$tag] = array(); $table[$tag]['checkSum'] = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $table[$tag]['offset'] = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $table[$tag]['length'] = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; } // check magicNumber $offset = $table['head']['offset'] + 12; if (TCPDF_STATIC::_getULONG($font, $offset) != 0x5F0F3CF5) { // magicNumber must be 0x5F0F3CF5 return false; } $offset += 4; $offset += 2; // skip flags // get FUnits $fmetric['unitsPerEm'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; // units ratio constant $urk = (1000 / $fmetric['unitsPerEm']); $offset += 16; // skip created, modified $xMin = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk); $offset += 2; $yMin = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk); $offset += 2; $xMax = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk); $offset += 2; $yMax = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk); $offset += 2; $fmetric['bbox'] = ''.$xMin.' '.$yMin.' '.$xMax.' '.$yMax.''; $macStyle = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; // PDF font flags $fmetric['Flags'] = $flags; if (($macStyle & 2) == 2) { // italic flag $fmetric['Flags'] |= 64; } // get offset mode (indexToLocFormat : 0 = short, 1 = long) $offset = $table['head']['offset'] + 50; $short_offset = (TCPDF_STATIC::_getSHORT($font, $offset) == 0); $offset += 2; // get the offsets to the locations of the glyphs in the font, relative to the beginning of the glyphData table $indexToLoc = array(); $offset = $table['loca']['offset']; if ($short_offset) { // short version $tot_num_glyphs = floor($table['loca']['length'] / 2); // numGlyphs + 1 for ($i = 0; $i < $tot_num_glyphs; ++$i) { $indexToLoc[$i] = TCPDF_STATIC::_getUSHORT($font, $offset) * 2; if (isset($indexToLoc[($i - 1)]) && ($indexToLoc[$i] == $indexToLoc[($i - 1)])) { // the last glyph didn't have an outline unset($indexToLoc[($i - 1)]); } $offset += 2; } } else { // long version $tot_num_glyphs = floor($table['loca']['length'] / 4); // numGlyphs + 1 for ($i = 0; $i < $tot_num_glyphs; ++$i) { $indexToLoc[$i] = TCPDF_STATIC::_getULONG($font, $offset); if (isset($indexToLoc[($i - 1)]) && ($indexToLoc[$i] == $indexToLoc[($i - 1)])) { // the last glyph didn't have an outline unset($indexToLoc[($i - 1)]); } $offset += 4; } } // get glyphs indexes of chars from cmap table $offset = $table['cmap']['offset'] + 2; $numEncodingTables = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $encodingTables = array(); for ($i = 0; $i < $numEncodingTables; ++$i) { $encodingTables[$i]['platformID'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $encodingTables[$i]['encodingID'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $encodingTables[$i]['offset'] = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; } // ---------- get os/2 metrics ---------- $offset = $table['OS/2']['offset']; $offset += 2; // skip version // xAvgCharWidth $fmetric['AvgWidth'] = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk); $offset += 2; // usWeightClass $usWeightClass = round(TCPDF_STATIC::_getUFWORD($font, $offset) * $urk); // estimate StemV and StemH (400 = usWeightClass for Normal - Regular font) $fmetric['StemV'] = round((70 * $usWeightClass) / 400); $fmetric['StemH'] = round((30 * $usWeightClass) / 400); $offset += 2; $offset += 2; // usWidthClass $fsType = TCPDF_STATIC::_getSHORT($font, $offset); $offset += 2; if ($fsType == 2) { // This Font cannot be modified, embedded or exchanged in any manner without first obtaining permission of the legal owner. return false; } // ---------- get font name ---------- $fmetric['name'] = ''; $offset = $table['name']['offset']; $offset += 2; // skip Format selector (=0). // Number of NameRecords that follow n. $numNameRecords = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; // Offset to start of string storage (from start of table). $stringStorageOffset = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; for ($i = 0; $i < $numNameRecords; ++$i) { $offset += 6; // skip Platform ID, Platform-specific encoding ID, Language ID. // Name ID. $nameID = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; if ($nameID == 6) { // String length (in bytes). $stringLength = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; // String offset from start of storage area (in bytes). $stringOffset = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $offset = ($table['name']['offset'] + $stringStorageOffset + $stringOffset); $fmetric['name'] = substr($font, $offset, $stringLength); $fmetric['name'] = preg_replace('/[^a-zA-Z0-9_\-]/', '', $fmetric['name']); break; } else { $offset += 4; // skip String length, String offset } } if (empty($fmetric['name'])) { $fmetric['name'] = $font_name; } // ---------- get post data ---------- $offset = $table['post']['offset']; $offset += 4; // skip Format Type $fmetric['italicAngle'] = TCPDF_STATIC::_getFIXED($font, $offset); $offset += 4; $fmetric['underlinePosition'] = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk); $offset += 2; $fmetric['underlineThickness'] = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk); $offset += 2; $isFixedPitch = (TCPDF_STATIC::_getULONG($font, $offset) == 0) ? false : true; $offset += 2; if ($isFixedPitch) { $fmetric['Flags'] |= 1; } // ---------- get hhea data ---------- $offset = $table['hhea']['offset']; $offset += 4; // skip Table version number // Ascender $fmetric['Ascent'] = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk); $offset += 2; // Descender $fmetric['Descent'] = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk); $offset += 2; // LineGap $fmetric['Leading'] = round(TCPDF_STATIC::_getFWORD($font, $offset) * $urk); $offset += 2; // advanceWidthMax $fmetric['MaxWidth'] = round(TCPDF_STATIC::_getUFWORD($font, $offset) * $urk); $offset += 2; $offset += 22; // skip some values // get the number of hMetric entries in hmtx table $numberOfHMetrics = TCPDF_STATIC::_getUSHORT($font, $offset); // ---------- get maxp data ---------- $offset = $table['maxp']['offset']; $offset += 4; // skip Table version number // get the the number of glyphs in the font. $numGlyphs = TCPDF_STATIC::_getUSHORT($font, $offset); // ---------- get CIDToGIDMap ---------- $ctg = array(); foreach ($encodingTables as $enctable) { // get only specified Platform ID and Encoding ID if (($enctable['platformID'] == $platid) AND ($enctable['encodingID'] == $encid)) { $offset = $table['cmap']['offset'] + $enctable['offset']; $format = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; switch ($format) { case 0: { // Format 0: Byte encoding table $offset += 4; // skip length and version/language for ($c = 0; $c < 256; ++$c) { $g = TCPDF_STATIC::_getBYTE($font, $offset); $ctg[$c] = $g; ++$offset; } break; } case 2: { // Format 2: High-byte mapping through table $offset += 4; // skip length and version/language $numSubHeaders = 0; for ($i = 0; $i < 256; ++$i) { // Array that maps high bytes to subHeaders: value is subHeader index * 8. $subHeaderKeys[$i] = (TCPDF_STATIC::_getUSHORT($font, $offset) / 8); $offset += 2; if ($numSubHeaders < $subHeaderKeys[$i]) { $numSubHeaders = $subHeaderKeys[$i]; } } // the number of subHeaders is equal to the max of subHeaderKeys + 1 ++$numSubHeaders; // read subHeader structures $subHeaders = array(); $numGlyphIndexArray = 0; for ($k = 0; $k < $numSubHeaders; ++$k) { $subHeaders[$k]['firstCode'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $subHeaders[$k]['entryCount'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $subHeaders[$k]['idDelta'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $subHeaders[$k]['idRangeOffset'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $subHeaders[$k]['idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8)); $subHeaders[$k]['idRangeOffset'] /= 2; $numGlyphIndexArray += $subHeaders[$k]['entryCount']; } for ($k = 0; $k < $numGlyphIndexArray; ++$k) { $glyphIndexArray[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } for ($i = 0; $i < 256; ++$i) { $k = $subHeaderKeys[$i]; if ($k == 0) { // one byte code $c = $i; $g = $glyphIndexArray[0]; $ctg[$c] = $g; } else { // two bytes code $start_byte = $subHeaders[$k]['firstCode']; $end_byte = $start_byte + $subHeaders[$k]['entryCount']; for ($j = $start_byte; $j < $end_byte; ++$j) { // combine high and low bytes $c = (($i << 8) + $j); $idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']); $g = ($glyphIndexArray[$idRangeOffset] + $subHeaders[$k]['idDelta']) % 65536; if ($g < 0) { $g = 0; } $ctg[$c] = $g; } } } break; } case 4: { // Format 4: Segment mapping to delta values $length = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $offset += 2; // skip version/language $segCount = floor(TCPDF_STATIC::_getUSHORT($font, $offset) / 2); $offset += 2; $offset += 6; // skip searchRange, entrySelector, rangeShift $endCount = array(); // array of end character codes for each segment for ($k = 0; $k < $segCount; ++$k) { $endCount[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } $offset += 2; // skip reservedPad $startCount = array(); // array of start character codes for each segment for ($k = 0; $k < $segCount; ++$k) { $startCount[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } $idDelta = array(); // delta for all character codes in segment for ($k = 0; $k < $segCount; ++$k) { $idDelta[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } $idRangeOffset = array(); // Offsets into glyphIdArray or 0 for ($k = 0; $k < $segCount; ++$k) { $idRangeOffset[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } $gidlen = (floor($length / 2) - 8 - (4 * $segCount)); $glyphIdArray = array(); // glyph index array for ($k = 0; $k < $gidlen; ++$k) { $glyphIdArray[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } for ($k = 0; $k < $segCount - 1; ++$k) { for ($c = $startCount[$k]; $c <= $endCount[$k]; ++$c) { if ($idRangeOffset[$k] == 0) { $g = ($idDelta[$k] + $c) % 65536; } else { $gid = (floor($idRangeOffset[$k] / 2) + ($c - $startCount[$k]) - ($segCount - $k)); $g = ($glyphIdArray[$gid] + $idDelta[$k]) % 65536; } if ($g < 0) { $g = 0; } $ctg[$c] = $g; } } break; } case 6: { // Format 6: Trimmed table mapping $offset += 4; // skip length and version/language $firstCode = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $entryCount = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; for ($k = 0; $k < $entryCount; ++$k) { $c = ($k + $firstCode); $g = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $ctg[$c] = $g; } break; } case 8: { // Format 8: Mixed 16-bit and 32-bit coverage $offset += 10; // skip reserved, length and version/language for ($k = 0; $k < 8192; ++$k) { $is32[$k] = TCPDF_STATIC::_getBYTE($font, $offset); ++$offset; } $nGroups = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; for ($i = 0; $i < $nGroups; ++$i) { $startCharCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $endCharCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $startGlyphID = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; for ($k = $startCharCode; $k <= $endCharCode; ++$k) { $is32idx = floor($c / 8); if ((isset($is32[$is32idx])) AND (($is32[$is32idx] & (1 << (7 - ($c % 8)))) == 0)) { $c = $k; } else { // 32 bit format // convert to decimal (http://www.unicode.org/faq//utf_bom.html#utf16-4) //LEAD_OFFSET = (0xD800 - (0x10000 >> 10)) = 55232 //SURROGATE_OFFSET = (0x10000 - (0xD800 << 10) - 0xDC00) = -56613888 $c = ((55232 + ($k >> 10)) << 10) + (0xDC00 + ($k & 0x3FF)) -56613888; } $ctg[$c] = 0; ++$startGlyphID; } } break; } case 10: { // Format 10: Trimmed array $offset += 10; // skip reserved, length and version/language $startCharCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $numChars = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; for ($k = 0; $k < $numChars; ++$k) { $c = ($k + $startCharCode); $g = TCPDF_STATIC::_getUSHORT($font, $offset); $ctg[$c] = $g; $offset += 2; } break; } case 12: { // Format 12: Segmented coverage $offset += 10; // skip length and version/language $nGroups = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; for ($k = 0; $k < $nGroups; ++$k) { $startCharCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $endCharCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $startGlyphCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; for ($c = $startCharCode; $c <= $endCharCode; ++$c) { $ctg[$c] = $startGlyphCode; ++$startGlyphCode; } } break; } case 13: { // Format 13: Many-to-one range mappings // to be implemented ... break; } case 14: { // Format 14: Unicode Variation Sequences // to be implemented ... break; } } } } if (!isset($ctg[0])) { $ctg[0] = 0; } // get xHeight (height of x) $offset = ($table['glyf']['offset'] + $indexToLoc[$ctg[120]] + 4); $yMin = TCPDF_STATIC::_getFWORD($font, $offset); $offset += 4; $yMax = TCPDF_STATIC::_getFWORD($font, $offset); $offset += 2; $fmetric['XHeight'] = round(($yMax - $yMin) * $urk); // get CapHeight (height of H) $offset = ($table['glyf']['offset'] + $indexToLoc[$ctg[72]] + 4); $yMin = TCPDF_STATIC::_getFWORD($font, $offset); $offset += 4; $yMax = TCPDF_STATIC::_getFWORD($font, $offset); $offset += 2; $fmetric['CapHeight'] = round(($yMax - $yMin) * $urk); // ceate widths array $cw = array(); $offset = $table['hmtx']['offset']; for ($i = 0 ; $i < $numberOfHMetrics; ++$i) { $cw[$i] = round(TCPDF_STATIC::_getUFWORD($font, $offset) * $urk); $offset += 4; // skip lsb } if ($numberOfHMetrics < $numGlyphs) { // fill missing widths with the last value $cw = array_pad($cw, $numGlyphs, $cw[($numberOfHMetrics - 1)]); } $fmetric['MissingWidth'] = $cw[0]; $fmetric['cw'] = ''; $fmetric['cbbox'] = ''; for ($cid = 0; $cid <= 65535; ++$cid) { if (isset($ctg[$cid])) { if (isset($cw[$ctg[$cid]])) { $fmetric['cw'] .= ','.$cid.'=>'.$cw[$ctg[$cid]]; } if ($addcbbox AND isset($indexToLoc[$ctg[$cid]])) { $offset = ($table['glyf']['offset'] + $indexToLoc[$ctg[$cid]]); $xMin = round(TCPDF_STATIC::_getFWORD($font, $offset + 2) * $urk); $yMin = round(TCPDF_STATIC::_getFWORD($font, $offset + 4) * $urk); $xMax = round(TCPDF_STATIC::_getFWORD($font, $offset + 6) * $urk); $yMax = round(TCPDF_STATIC::_getFWORD($font, $offset + 8) * $urk); $fmetric['cbbox'] .= ','.$cid.'=>array('.$xMin.','.$yMin.','.$xMax.','.$yMax.')'; } } } } // end of true type if (($fmetric['type'] == 'TrueTypeUnicode') AND (count($ctg) == 256)) { $fmetric['type'] = 'TrueType'; } // ---------- create php font file ---------- $pfile = '<'.'?'.'php'."\n"; $pfile .= '// TCPDF FONT FILE DESCRIPTION'."\n"; $pfile .= '$type=\''.$fmetric['type'].'\';'."\n"; $pfile .= '$name=\''.$fmetric['name'].'\';'."\n"; $pfile .= '$up='.$fmetric['underlinePosition'].';'."\n"; $pfile .= '$ut='.$fmetric['underlineThickness'].';'."\n"; if ($fmetric['MissingWidth'] > 0) { $pfile .= '$dw='.$fmetric['MissingWidth'].';'."\n"; } else { $pfile .= '$dw='.$fmetric['AvgWidth'].';'."\n"; } $pfile .= '$diff=\''.$fmetric['diff'].'\';'."\n"; if ($fmetric['type'] == 'Type1') { // Type 1 $pfile .= '$enc=\''.$fmetric['enc'].'\';'."\n"; $pfile .= '$file=\''.$fmetric['file'].'\';'."\n"; $pfile .= '$size1='.$fmetric['size1'].';'."\n"; $pfile .= '$size2='.$fmetric['size2'].';'."\n"; } else { $pfile .= '$originalsize='.$fmetric['originalsize'].';'."\n"; if ($fmetric['type'] == 'cidfont0') { // CID-0 switch ($fonttype) { case 'CID0JP': { $pfile .= '// Japanese'."\n"; $pfile .= '$enc=\'UniJIS-UTF16-H\';'."\n"; $pfile .= '$cidinfo=array(\'Registry\'=>\'Adobe\', \'Ordering\'=>\'Japan1\',\'Supplement\'=>5);'."\n"; $pfile .= 'include(dirname(__FILE__).\'/uni2cid_aj16.php\');'."\n"; break; } case 'CID0KR': { $pfile .= '// Korean'."\n"; $pfile .= '$enc=\'UniKS-UTF16-H\';'."\n"; $pfile .= '$cidinfo=array(\'Registry\'=>\'Adobe\', \'Ordering\'=>\'Korea1\',\'Supplement\'=>0);'."\n"; $pfile .= 'include(dirname(__FILE__).\'/uni2cid_ak12.php\');'."\n"; break; } case 'CID0CS': { $pfile .= '// Chinese Simplified'."\n"; $pfile .= '$enc=\'UniGB-UTF16-H\';'."\n"; $pfile .= '$cidinfo=array(\'Registry\'=>\'Adobe\', \'Ordering\'=>\'GB1\',\'Supplement\'=>2);'."\n"; $pfile .= 'include(dirname(__FILE__).\'/uni2cid_ag15.php\');'."\n"; break; } case 'CID0CT': default: { $pfile .= '// Chinese Traditional'."\n"; $pfile .= '$enc=\'UniCNS-UTF16-H\';'."\n"; $pfile .= '$cidinfo=array(\'Registry\'=>\'Adobe\', \'Ordering\'=>\'CNS1\',\'Supplement\'=>0);'."\n"; $pfile .= 'include(dirname(__FILE__).\'/uni2cid_aj16.php\');'."\n"; break; } } } else { // TrueType $pfile .= '$enc=\''.$fmetric['enc'].'\';'."\n"; $pfile .= '$file=\''.$fmetric['file'].'\';'."\n"; $pfile .= '$ctg=\''.$fmetric['ctg'].'\';'."\n"; // create CIDToGIDMap $cidtogidmap = str_pad('', 131072, "\x00"); // (256 * 256 * 2) = 131072 foreach ($ctg as $cid => $gid) { $cidtogidmap = self::updateCIDtoGIDmap($cidtogidmap, $cid, $ctg[$cid]); } // store compressed CIDToGIDMap $fp = TCPDF_STATIC::fopenLocal($outpath.$fmetric['ctg'], 'wb'); fwrite($fp, gzcompress($cidtogidmap)); fclose($fp); } } $pfile .= '$desc=array('; $pfile .= '\'Flags\'=>'.$fmetric['Flags'].','; $pfile .= '\'FontBBox\'=>\'['.$fmetric['bbox'].']\','; $pfile .= '\'ItalicAngle\'=>'.$fmetric['italicAngle'].','; $pfile .= '\'Ascent\'=>'.$fmetric['Ascent'].','; $pfile .= '\'Descent\'=>'.$fmetric['Descent'].','; $pfile .= '\'Leading\'=>'.$fmetric['Leading'].','; $pfile .= '\'CapHeight\'=>'.$fmetric['CapHeight'].','; $pfile .= '\'XHeight\'=>'.$fmetric['XHeight'].','; $pfile .= '\'StemV\'=>'.$fmetric['StemV'].','; $pfile .= '\'StemH\'=>'.$fmetric['StemH'].','; $pfile .= '\'AvgWidth\'=>'.$fmetric['AvgWidth'].','; $pfile .= '\'MaxWidth\'=>'.$fmetric['MaxWidth'].','; $pfile .= '\'MissingWidth\'=>'.$fmetric['MissingWidth'].''; $pfile .= ');'."\n"; if (!empty($fmetric['cbbox'])) { $pfile .= '$cbbox=array('.substr($fmetric['cbbox'], 1).');'."\n"; } $pfile .= '$cw=array('.substr($fmetric['cw'], 1).');'."\n"; $pfile .= '// --- EOF ---'."\n"; // store file $fp = TCPDF_STATIC::fopenLocal($outpath.$font_name.'.php', 'w'); fwrite($fp, $pfile); fclose($fp); // return TCPDF font name return $font_name; } /** * Returs the checksum of a TTF table. * @param $table (string) table to check * @param $length (int) length of table in bytes * @return int checksum * @author Nicola Asuni * @since 5.2.000 (2010-06-02) * @public static */ public static function _getTTFtableChecksum($table, $length) { $sum = 0; $tlen = ($length / 4); $offset = 0; for ($i = 0; $i < $tlen; ++$i) { $v = unpack('Ni', substr($table, $offset, 4)); $sum += $v['i']; $offset += 4; } $sum = unpack('Ni', pack('N', $sum)); return $sum['i']; } /** * Returns a subset of the TrueType font data without the unused glyphs. * @param $font (string) TrueType font data. * @param $subsetchars (array) Array of used characters (the glyphs to keep). * @return (string) A subset of TrueType font data without the unused glyphs. * @author Nicola Asuni * @since 5.2.000 (2010-06-02) * @public static */ public static function _getTrueTypeFontSubset($font, $subsetchars) { ksort($subsetchars); $offset = 0; // offset position of the font data if (TCPDF_STATIC::_getULONG($font, $offset) != 0x10000) { // sfnt version must be 0x00010000 for TrueType version 1.0. return $font; } $offset += 4; // get number of tables $numTables = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; // skip searchRange, entrySelector and rangeShift $offset += 6; // tables array $table = array(); // for each table for ($i = 0; $i < $numTables; ++$i) { // get table info $tag = substr($font, $offset, 4); $offset += 4; $table[$tag] = array(); $table[$tag]['checkSum'] = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $table[$tag]['offset'] = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $table[$tag]['length'] = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; } // check magicNumber $offset = $table['head']['offset'] + 12; if (TCPDF_STATIC::_getULONG($font, $offset) != 0x5F0F3CF5) { // magicNumber must be 0x5F0F3CF5 return $font; } $offset += 4; // get offset mode (indexToLocFormat : 0 = short, 1 = long) $offset = $table['head']['offset'] + 50; $short_offset = (TCPDF_STATIC::_getSHORT($font, $offset) == 0); $offset += 2; // get the offsets to the locations of the glyphs in the font, relative to the beginning of the glyphData table $indexToLoc = array(); $offset = $table['loca']['offset']; if ($short_offset) { // short version $tot_num_glyphs = floor($table['loca']['length'] / 2); // numGlyphs + 1 for ($i = 0; $i < $tot_num_glyphs; ++$i) { $indexToLoc[$i] = TCPDF_STATIC::_getUSHORT($font, $offset) * 2; $offset += 2; } } else { // long version $tot_num_glyphs = ($table['loca']['length'] / 4); // numGlyphs + 1 for ($i = 0; $i < $tot_num_glyphs; ++$i) { $indexToLoc[$i] = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; } } // get glyphs indexes of chars from cmap table $subsetglyphs = array(); // glyph IDs on key $subsetglyphs[0] = true; // character codes that do not correspond to any glyph in the font should be mapped to glyph index 0 $offset = $table['cmap']['offset'] + 2; $numEncodingTables = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $encodingTables = array(); for ($i = 0; $i < $numEncodingTables; ++$i) { $encodingTables[$i]['platformID'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $encodingTables[$i]['encodingID'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $encodingTables[$i]['offset'] = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; } foreach ($encodingTables as $enctable) { // get all platforms and encodings $offset = $table['cmap']['offset'] + $enctable['offset']; $format = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; switch ($format) { case 0: { // Format 0: Byte encoding table $offset += 4; // skip length and version/language for ($c = 0; $c < 256; ++$c) { if (isset($subsetchars[$c])) { $g = TCPDF_STATIC::_getBYTE($font, $offset); $subsetglyphs[$g] = true; } ++$offset; } break; } case 2: { // Format 2: High-byte mapping through table $offset += 4; // skip length and version/language $numSubHeaders = 0; for ($i = 0; $i < 256; ++$i) { // Array that maps high bytes to subHeaders: value is subHeader index * 8. $subHeaderKeys[$i] = (TCPDF_STATIC::_getUSHORT($font, $offset) / 8); $offset += 2; if ($numSubHeaders < $subHeaderKeys[$i]) { $numSubHeaders = $subHeaderKeys[$i]; } } // the number of subHeaders is equal to the max of subHeaderKeys + 1 ++$numSubHeaders; // read subHeader structures $subHeaders = array(); $numGlyphIndexArray = 0; for ($k = 0; $k < $numSubHeaders; ++$k) { $subHeaders[$k]['firstCode'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $subHeaders[$k]['entryCount'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $subHeaders[$k]['idDelta'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $subHeaders[$k]['idRangeOffset'] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $subHeaders[$k]['idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8)); $subHeaders[$k]['idRangeOffset'] /= 2; $numGlyphIndexArray += $subHeaders[$k]['entryCount']; } for ($k = 0; $k < $numGlyphIndexArray; ++$k) { $glyphIndexArray[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } for ($i = 0; $i < 256; ++$i) { $k = $subHeaderKeys[$i]; if ($k == 0) { // one byte code $c = $i; if (isset($subsetchars[$c])) { $g = $glyphIndexArray[0]; $subsetglyphs[$g] = true; } } else { // two bytes code $start_byte = $subHeaders[$k]['firstCode']; $end_byte = $start_byte + $subHeaders[$k]['entryCount']; for ($j = $start_byte; $j < $end_byte; ++$j) { // combine high and low bytes $c = (($i << 8) + $j); if (isset($subsetchars[$c])) { $idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']); $g = ($glyphIndexArray[$idRangeOffset] + $subHeaders[$k]['idDelta']) % 65536; if ($g < 0) { $g = 0; } $subsetglyphs[$g] = true; } } } } break; } case 4: { // Format 4: Segment mapping to delta values $length = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $offset += 2; // skip version/language $segCount = floor(TCPDF_STATIC::_getUSHORT($font, $offset) / 2); $offset += 2; $offset += 6; // skip searchRange, entrySelector, rangeShift $endCount = array(); // array of end character codes for each segment for ($k = 0; $k < $segCount; ++$k) { $endCount[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } $offset += 2; // skip reservedPad $startCount = array(); // array of start character codes for each segment for ($k = 0; $k < $segCount; ++$k) { $startCount[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } $idDelta = array(); // delta for all character codes in segment for ($k = 0; $k < $segCount; ++$k) { $idDelta[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } $idRangeOffset = array(); // Offsets into glyphIdArray or 0 for ($k = 0; $k < $segCount; ++$k) { $idRangeOffset[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } $gidlen = (floor($length / 2) - 8 - (4 * $segCount)); $glyphIdArray = array(); // glyph index array for ($k = 0; $k < $gidlen; ++$k) { $glyphIdArray[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } for ($k = 0; $k < $segCount; ++$k) { for ($c = $startCount[$k]; $c <= $endCount[$k]; ++$c) { if (isset($subsetchars[$c])) { if ($idRangeOffset[$k] == 0) { $g = ($idDelta[$k] + $c) % 65536; } else { $gid = (floor($idRangeOffset[$k] / 2) + ($c - $startCount[$k]) - ($segCount - $k)); $g = ($glyphIdArray[$gid] + $idDelta[$k]) % 65536; } if ($g < 0) { $g = 0; } $subsetglyphs[$g] = true; } } } break; } case 6: { // Format 6: Trimmed table mapping $offset += 4; // skip length and version/language $firstCode = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $entryCount = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; for ($k = 0; $k < $entryCount; ++$k) { $c = ($k + $firstCode); if (isset($subsetchars[$c])) { $g = TCPDF_STATIC::_getUSHORT($font, $offset); $subsetglyphs[$g] = true; } $offset += 2; } break; } case 8: { // Format 8: Mixed 16-bit and 32-bit coverage $offset += 10; // skip reserved, length and version/language for ($k = 0; $k < 8192; ++$k) { $is32[$k] = TCPDF_STATIC::_getBYTE($font, $offset); ++$offset; } $nGroups = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; for ($i = 0; $i < $nGroups; ++$i) { $startCharCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $endCharCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $startGlyphID = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; for ($k = $startCharCode; $k <= $endCharCode; ++$k) { $is32idx = floor($c / 8); if ((isset($is32[$is32idx])) AND (($is32[$is32idx] & (1 << (7 - ($c % 8)))) == 0)) { $c = $k; } else { // 32 bit format // convert to decimal (http://www.unicode.org/faq//utf_bom.html#utf16-4) //LEAD_OFFSET = (0xD800 - (0x10000 >> 10)) = 55232 //SURROGATE_OFFSET = (0x10000 - (0xD800 << 10) - 0xDC00) = -56613888 $c = ((55232 + ($k >> 10)) << 10) + (0xDC00 + ($k & 0x3FF)) -56613888; } if (isset($subsetchars[$c])) { $subsetglyphs[$startGlyphID] = true; } ++$startGlyphID; } } break; } case 10: { // Format 10: Trimmed array $offset += 10; // skip reserved, length and version/language $startCharCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $numChars = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; for ($k = 0; $k < $numChars; ++$k) { $c = ($k + $startCharCode); if (isset($subsetchars[$c])) { $g = TCPDF_STATIC::_getUSHORT($font, $offset); $subsetglyphs[$g] = true; } $offset += 2; } break; } case 12: { // Format 12: Segmented coverage $offset += 10; // skip length and version/language $nGroups = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; for ($k = 0; $k < $nGroups; ++$k) { $startCharCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $endCharCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; $startGlyphCode = TCPDF_STATIC::_getULONG($font, $offset); $offset += 4; for ($c = $startCharCode; $c <= $endCharCode; ++$c) { if (isset($subsetchars[$c])) { $subsetglyphs[$startGlyphCode] = true; } ++$startGlyphCode; } } break; } case 13: { // Format 13: Many-to-one range mappings // to be implemented ... break; } case 14: { // Format 14: Unicode Variation Sequences // to be implemented ... break; } } } // include all parts of composite glyphs $new_sga = $subsetglyphs; while (!empty($new_sga)) { $sga = $new_sga; $new_sga = array(); foreach ($sga as $key => $val) { if (isset($indexToLoc[$key])) { $offset = ($table['glyf']['offset'] + $indexToLoc[$key]); $numberOfContours = TCPDF_STATIC::_getSHORT($font, $offset); $offset += 2; if ($numberOfContours < 0) { // composite glyph $offset += 8; // skip xMin, yMin, xMax, yMax do { $flags = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; $glyphIndex = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; if (!isset($subsetglyphs[$glyphIndex])) { // add missing glyphs $new_sga[$glyphIndex] = true; } // skip some bytes by case if ($flags & 1) { $offset += 4; } else { $offset += 2; } if ($flags & 8) { $offset += 2; } elseif ($flags & 64) { $offset += 4; } elseif ($flags & 128) { $offset += 8; } } while ($flags & 32); } } } $subsetglyphs += $new_sga; } // sort glyphs by key (and remove duplicates) ksort($subsetglyphs); // build new glyf and loca tables $glyf = ''; $loca = ''; $offset = 0; $glyf_offset = $table['glyf']['offset']; for ($i = 0; $i < $tot_num_glyphs; ++$i) { if (isset($subsetglyphs[$i])) { $length = ($indexToLoc[($i + 1)] - $indexToLoc[$i]); $glyf .= substr($font, ($glyf_offset + $indexToLoc[$i]), $length); } else { $length = 0; } if ($short_offset) { $loca .= pack('n', floor($offset / 2)); } else { $loca .= pack('N', $offset); } $offset += $length; } // array of table names to preserve (loca and glyf tables will be added later) // the cmap table is not needed and shall not be present, since the mapping from character codes to glyph descriptions is provided separately $table_names = array ('head', 'hhea', 'hmtx', 'maxp', 'cvt ', 'fpgm', 'prep'); // minimum required table names // get the tables to preserve $offset = 12; foreach ($table as $tag => $val) { if (in_array($tag, $table_names)) { $table[$tag]['data'] = substr($font, $table[$tag]['offset'], $table[$tag]['length']); if ($tag == 'head') { // set the checkSumAdjustment to 0 $table[$tag]['data'] = substr($table[$tag]['data'], 0, 8)."\x0\x0\x0\x0".substr($table[$tag]['data'], 12); } $pad = 4 - ($table[$tag]['length'] % 4); if ($pad != 4) { // the length of a table must be a multiple of four bytes $table[$tag]['length'] += $pad; $table[$tag]['data'] .= str_repeat("\x0", $pad); } $table[$tag]['offset'] = $offset; $offset += $table[$tag]['length']; // check sum is not changed (so keep the following line commented) //$table[$tag]['checkSum'] = self::_getTTFtableChecksum($table[$tag]['data'], $table[$tag]['length']); } else { unset($table[$tag]); } } // add loca $table['loca']['data'] = $loca; $table['loca']['length'] = strlen($loca); $pad = 4 - ($table['loca']['length'] % 4); if ($pad != 4) { // the length of a table must be a multiple of four bytes $table['loca']['length'] += $pad; $table['loca']['data'] .= str_repeat("\x0", $pad); } $table['loca']['offset'] = $offset; $table['loca']['checkSum'] = self::_getTTFtableChecksum($table['loca']['data'], $table['loca']['length']); $offset += $table['loca']['length']; // add glyf $table['glyf']['data'] = $glyf; $table['glyf']['length'] = strlen($glyf); $pad = 4 - ($table['glyf']['length'] % 4); if ($pad != 4) { // the length of a table must be a multiple of four bytes $table['glyf']['length'] += $pad; $table['glyf']['data'] .= str_repeat("\x0", $pad); } $table['glyf']['offset'] = $offset; $table['glyf']['checkSum'] = self::_getTTFtableChecksum($table['glyf']['data'], $table['glyf']['length']); // rebuild font $font = ''; $font .= pack('N', 0x10000); // sfnt version $numTables = count($table); $font .= pack('n', $numTables); // numTables $entrySelector = floor(log($numTables, 2)); $searchRange = pow(2, $entrySelector) * 16; $rangeShift = ($numTables * 16) - $searchRange; $font .= pack('n', $searchRange); // searchRange $font .= pack('n', $entrySelector); // entrySelector $font .= pack('n', $rangeShift); // rangeShift $offset = ($numTables * 16); foreach ($table as $tag => $data) { $font .= $tag; // tag $font .= pack('N', $data['checkSum']); // checkSum $font .= pack('N', ($data['offset'] + $offset)); // offset $font .= pack('N', $data['length']); // length } foreach ($table as $data) { $font .= $data['data']; } // set checkSumAdjustment on head table $checkSumAdjustment = 0xB1B0AFBA - self::_getTTFtableChecksum($font, strlen($font)); $font = substr($font, 0, $table['head']['offset'] + 8).pack('N', $checkSumAdjustment).substr($font, $table['head']['offset'] + 12); return $font; } /** * Outputs font widths * @param $font (array) font data * @param $cidoffset (int) offset for CID values * @return PDF command string for font widths * @author Nicola Asuni * @since 4.4.000 (2008-12-07) * @public static */ public static function _putfontwidths($font, $cidoffset=0) { ksort($font['cw']); $rangeid = 0; $range = array(); $prevcid = -2; $prevwidth = -1; $interval = false; // for each character foreach ($font['cw'] as $cid => $width) { $cid -= $cidoffset; if ($font['subset'] AND (!isset($font['subsetchars'][$cid]))) { // ignore the unused characters (font subsetting) continue; } if ($width != $font['dw']) { if ($cid == ($prevcid + 1)) { // consecutive CID if ($width == $prevwidth) { if ($width == $range[$rangeid][0]) { $range[$rangeid][] = $width; } else { array_pop($range[$rangeid]); // new range $rangeid = $prevcid; $range[$rangeid] = array(); $range[$rangeid][] = $prevwidth; $range[$rangeid][] = $width; } $interval = true; $range[$rangeid]['interval'] = true; } else { if ($interval) { // new range $rangeid = $cid; $range[$rangeid] = array(); $range[$rangeid][] = $width; } else { $range[$rangeid][] = $width; } $interval = false; } } else { // new range $rangeid = $cid; $range[$rangeid] = array(); $range[$rangeid][] = $width; $interval = false; } $prevcid = $cid; $prevwidth = $width; } } // optimize ranges $prevk = -1; $nextk = -1; $prevint = false; foreach ($range as $k => $ws) { $cws = count($ws); if (($k == $nextk) AND (!$prevint) AND ((!isset($ws['interval'])) OR ($cws < 4))) { if (isset($range[$k]['interval'])) { unset($range[$k]['interval']); } $range[$prevk] = array_merge($range[$prevk], $range[$k]); unset($range[$k]); } else { $prevk = $k; } $nextk = $k + $cws; if (isset($ws['interval'])) { if ($cws > 3) { $prevint = true; } else { $prevint = false; } if (isset($range[$k]['interval'])) { unset($range[$k]['interval']); } --$nextk; } else { $prevint = false; } } // output data $w = ''; foreach ($range as $k => $ws) { if (count(array_count_values($ws)) == 1) { // interval mode is more compact $w .= ' '.$k.' '.($k + count($ws) - 1).' '.$ws[0]; } else { // range mode $w .= ' '.$k.' [ '.implode(' ', $ws).' ]'; } } return '/W ['.$w.' ]'; } /** * Update the CIDToGIDMap string with a new value. * @param $map (string) CIDToGIDMap. * @param $cid (int) CID value. * @param $gid (int) GID value. * @return (string) CIDToGIDMap. * @author Nicola Asuni * @since 5.9.123 (2011-09-29) * @public static */ public static function updateCIDtoGIDmap($map, $cid, $gid) { if (($cid >= 0) AND ($cid <= 0xFFFF) AND ($gid >= 0)) { if ($gid > 0xFFFF) { $gid -= 0x10000; } $map[($cid * 2)] = chr($gid >> 8); $map[(($cid * 2) + 1)] = chr($gid & 0xFF); } return $map; } /** * Return fonts path * @return string * @public static */ public static function _getfontpath() { if (!defined('K_PATH_FONTS') AND is_dir($fdir = realpath(dirname(__FILE__).'/../fonts'))) { if (substr($fdir, -1) != '/') { $fdir .= '/'; } define('K_PATH_FONTS', $fdir); } return defined('K_PATH_FONTS') ? K_PATH_FONTS : ''; } /** * Return font full path * @param $file (string) Font file name. * @param $fontdir (string) Font directory (set to false fto search on default directories) * @return string Font full path or empty string * @author Nicola Asuni * @since 6.0.025 * @public static */ public static function getFontFullPath($file, $fontdir=false) { $fontfile = ''; // search files on various directories if (($fontdir !== false) AND @TCPDF_STATIC::file_exists($fontdir.$file)) { $fontfile = $fontdir.$file; } elseif (@TCPDF_STATIC::file_exists(self::_getfontpath().$file)) { $fontfile = self::_getfontpath().$file; } elseif (@TCPDF_STATIC::file_exists($file)) { $fontfile = $file; } return $fontfile; } /** * Get a reference font size. * @param $size (string) String containing font size value. * @param $refsize (float) Reference font size in points. * @return float value in points * @public static */ public static function getFontRefSize($size, $refsize=12) { switch ($size) { case 'xx-small': { $size = ($refsize - 4); break; } case 'x-small': { $size = ($refsize - 3); break; } case 'small': { $size = ($refsize - 2); break; } case 'medium': { $size = $refsize; break; } case 'large': { $size = ($refsize + 2); break; } case 'x-large': { $size = ($refsize + 4); break; } case 'xx-large': { $size = ($refsize + 6); break; } case 'smaller': { $size = ($refsize - 3); break; } case 'larger': { $size = ($refsize + 3); break; } } return $size; } // ==================================================================================================================== // REIMPLEMENTED // ==================================================================================================================== /** * Returns the unicode caracter specified by the value * @param $c (int) UTF-8 value * @param $unicode (boolean) True if we are in unicode mode, false otherwise. * @return Returns the specified character. * @since 2.3.000 (2008-03-05) * @public static */ public static function unichr($c, $unicode=true) { $c = intval($c); if (!$unicode) { return chr($c); } elseif ($c <= 0x7F) { // one byte return chr($c); } elseif ($c <= 0x7FF) { // two bytes return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F); } elseif ($c <= 0xFFFF) { // three bytes return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F); } elseif ($c <= 0x10FFFF) { // four bytes return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F); } else { return ''; } } /** * Returns the unicode caracter specified by UTF-8 value * @param $c (int) UTF-8 value * @return Returns the specified character. * @public static */ public static function unichrUnicode($c) { return self::unichr($c, true); } /** * Returns the unicode caracter specified by ASCII value * @param $c (int) UTF-8 value * @return Returns the specified character. * @public static */ public static function unichrASCII($c) { return self::unichr($c, false); } /** * Converts array of UTF-8 characters to UTF16-BE string.<br> * Based on: http://www.faqs.org/rfcs/rfc2781.html * <pre> * Encoding UTF-16: * * Encoding of a single character from an ISO 10646 character value to * UTF-16 proceeds as follows. Let U be the character number, no greater * than 0x10FFFF. * * 1) If U < 0x10000, encode U as a 16-bit unsigned integer and * terminate. * * 2) Let U' = U - 0x10000. Because U is less than or equal to 0x10FFFF, * U' must be less than or equal to 0xFFFFF. That is, U' can be * represented in 20 bits. * * 3) Initialize two 16-bit unsigned integers, W1 and W2, to 0xD800 and * 0xDC00, respectively. These integers each have 10 bits free to * encode the character value, for a total of 20 bits. * * 4) Assign the 10 high-order bits of the 20-bit U' to the 10 low-order * bits of W1 and the 10 low-order bits of U' to the 10 low-order * bits of W2. Terminate. * * Graphically, steps 2 through 4 look like: * U' = yyyyyyyyyyxxxxxxxxxx * W1 = 110110yyyyyyyyyy * W2 = 110111xxxxxxxxxx * </pre> * @param $unicode (array) array containing UTF-8 unicode values * @param $setbom (boolean) if true set the Byte Order Mark (BOM = 0xFEFF) * @return string * @protected * @author Nicola Asuni * @since 2.1.000 (2008-01-08) * @public static */ public static function arrUTF8ToUTF16BE($unicode, $setbom=false) { $outstr = ''; // string to be returned if ($setbom) { $outstr .= "\xFE\xFF"; // Byte Order Mark (BOM) } foreach ($unicode as $char) { if ($char == 0x200b) { // skip Unicode Character 'ZERO WIDTH SPACE' (DEC:8203, U+200B) } elseif ($char == 0xFFFD) { $outstr .= "\xFF\xFD"; // replacement character } elseif ($char < 0x10000) { $outstr .= chr($char >> 0x08); $outstr .= chr($char & 0xFF); } else { $char -= 0x10000; $w1 = 0xD800 | ($char >> 0x0a); $w2 = 0xDC00 | ($char & 0x3FF); $outstr .= chr($w1 >> 0x08); $outstr .= chr($w1 & 0xFF); $outstr .= chr($w2 >> 0x08); $outstr .= chr($w2 & 0xFF); } } return $outstr; } /** * Convert an array of UTF8 values to array of unicode characters * @param $ta (array) The input array of UTF8 values. * @param $isunicode (boolean) True for Unicode mode, false otherwise. * @return Return array of unicode characters * @since 4.5.037 (2009-04-07) * @public static */ public static function UTF8ArrayToUniArray($ta, $isunicode=true) { if ($isunicode) { return array_map(array('TCPDF_FONTS', 'unichrUnicode'), $ta); } return array_map(array('TCPDF_FONTS', 'unichrASCII'), $ta); } /** * Extract a slice of the $strarr array and return it as string. * @param $strarr (string) The input array of characters. * @param $start (int) the starting element of $strarr. * @param $end (int) first element that will not be returned. * @param $unicode (boolean) True if we are in unicode mode, false otherwise. * @return Return part of a string * @public static */ public static function UTF8ArrSubString($strarr, $start='', $end='', $unicode=true) { if (strlen($start) == 0) { $start = 0; } if (strlen($end) == 0) { $end = count($strarr); } $string = ''; for ($i = $start; $i < $end; ++$i) { $string .= self::unichr($strarr[$i], $unicode); } return $string; } /** * Extract a slice of the $uniarr array and return it as string. * @param $uniarr (string) The input array of characters. * @param $start (int) the starting element of $strarr. * @param $end (int) first element that will not be returned. * @return Return part of a string * @since 4.5.037 (2009-04-07) * @public static */ public static function UniArrSubString($uniarr, $start='', $end='') { if (strlen($start) == 0) { $start = 0; } if (strlen($end) == 0) { $end = count($uniarr); } $string = ''; for ($i=$start; $i < $end; ++$i) { $string .= $uniarr[$i]; } return $string; } /** * Converts UTF-8 characters array to array of Latin1 characters array<br> * @param $unicode (array) array containing UTF-8 unicode values * @return array * @author Nicola Asuni * @since 4.8.023 (2010-01-15) * @public static */ public static function UTF8ArrToLatin1Arr($unicode) { $outarr = array(); // array to be returned foreach ($unicode as $char) { if ($char < 256) { $outarr[] = $char; } elseif (array_key_exists($char, TCPDF_FONT_DATA::$uni_utf8tolatin)) { // map from UTF-8 $outarr[] = TCPDF_FONT_DATA::$uni_utf8tolatin[$char]; } elseif ($char == 0xFFFD) { // skip } else { $outarr[] = 63; // '?' character } } return $outarr; } /** * Converts UTF-8 characters array to array of Latin1 string<br> * @param $unicode (array) array containing UTF-8 unicode values * @return array * @author Nicola Asuni * @since 4.8.023 (2010-01-15) * @public static */ public static function UTF8ArrToLatin1($unicode) { $outstr = ''; // string to be returned foreach ($unicode as $char) { if ($char < 256) { $outstr .= chr($char); } elseif (array_key_exists($char, TCPDF_FONT_DATA::$uni_utf8tolatin)) { // map from UTF-8 $outstr .= chr(TCPDF_FONT_DATA::$uni_utf8tolatin[$char]); } elseif ($char == 0xFFFD) { // skip } else { $outstr .= '?'; } } return $outstr; } /** * Converts UTF-8 character to integer value.<br> * Uses the getUniord() method if the value is not cached. * @param $uch (string) character string to process. * @return integer Unicode value * @public static */ public static function uniord($uch) { if (!isset(self::$cache_uniord[$uch])) { self::$cache_uniord[$uch] = self::getUniord($uch); } return self::$cache_uniord[$uch]; } /** * Converts UTF-8 character to integer value.<br> * Invalid byte sequences will be replaced with 0xFFFD (replacement character)<br> * Based on: http://www.faqs.org/rfcs/rfc3629.html * <pre> * Char. number range | UTF-8 octet sequence * (hexadecimal) | (binary) * --------------------+----------------------------------------------- * 0000 0000-0000 007F | 0xxxxxxx * 0000 0080-0000 07FF | 110xxxxx 10xxxxxx * 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx * 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx * --------------------------------------------------------------------- * * ABFN notation: * --------------------------------------------------------------------- * UTF8-octets = *( UTF8-char ) * UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 * UTF8-1 = %x00-7F * UTF8-2 = %xC2-DF UTF8-tail * * UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / * %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) * UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / * %xF4 %x80-8F 2( UTF8-tail ) * UTF8-tail = %x80-BF * --------------------------------------------------------------------- * </pre> * @param $uch (string) character string to process. * @return integer Unicode value * @author Nicola Asuni * @public static */ public static function getUniord($uch) { if (function_exists('mb_convert_encoding')) { list(, $char) = @unpack('N', mb_convert_encoding($uch, 'UCS-4BE', 'UTF-8')); if ($char >= 0) { return $char; } } $bytes = array(); // array containing single character byte sequences $countbytes = 0; $numbytes = 1; // number of octetc needed to represent the UTF-8 character $length = strlen($uch); for ($i = 0; $i < $length; ++$i) { $char = ord($uch[$i]); // get one string character at time if ($countbytes == 0) { // get starting octect if ($char <= 0x7F) { return $char; // use the character "as is" because is ASCII } elseif (($char >> 0x05) == 0x06) { // 2 bytes character (0x06 = 110 BIN) $bytes[] = ($char - 0xC0) << 0x06; ++$countbytes; $numbytes = 2; } elseif (($char >> 0x04) == 0x0E) { // 3 bytes character (0x0E = 1110 BIN) $bytes[] = ($char - 0xE0) << 0x0C; ++$countbytes; $numbytes = 3; } elseif (($char >> 0x03) == 0x1E) { // 4 bytes character (0x1E = 11110 BIN) $bytes[] = ($char - 0xF0) << 0x12; ++$countbytes; $numbytes = 4; } else { // use replacement character for other invalid sequences return 0xFFFD; } } elseif (($char >> 0x06) == 0x02) { // bytes 2, 3 and 4 must start with 0x02 = 10 BIN $bytes[] = $char - 0x80; ++$countbytes; if ($countbytes == $numbytes) { // compose UTF-8 bytes to a single unicode value $char = $bytes[0]; for ($j = 1; $j < $numbytes; ++$j) { $char += ($bytes[$j] << (($numbytes - $j - 1) * 0x06)); } if ((($char >= 0xD800) AND ($char <= 0xDFFF)) OR ($char >= 0x10FFFF)) { // The definition of UTF-8 prohibits encoding character numbers between // U+D800 and U+DFFF, which are reserved for use with the UTF-16 // encoding form (as surrogate pairs) and do not directly represent // characters. return 0xFFFD; // use replacement character } else { return $char; } } } else { // use replacement character for other invalid sequences return 0xFFFD; } } return 0xFFFD; } /** * Converts UTF-8 strings to codepoints array.<br> * Invalid byte sequences will be replaced with 0xFFFD (replacement character)<br> * @param $str (string) string to process. * @param $isunicode (boolean) True when the documetn is in Unicode mode, false otherwise. * @param $currentfont (array) Reference to current font array. * @return array containing codepoints (UTF-8 characters values) * @author Nicola Asuni * @public static */ public static function UTF8StringToArray($str, $isunicode=true, &$currentfont=array()) { if ($isunicode) { // requires PCRE unicode support turned on $chars = TCPDF_STATIC::pregSplit('//','u', $str, -1, PREG_SPLIT_NO_EMPTY); $carr = array_map(array('TCPDF_FONTS', 'uniord'), $chars); } else { $chars = str_split($str); $carr = array_map('ord', $chars); } if (is_array($currentfont['subsetchars']) && is_array($carr)) { $currentfont['subsetchars'] += array_fill_keys($carr, true); } else { $currentfont['subsetchars'] = array_merge($currentfont['subsetchars'], $carr); } return $carr; } /** * Converts UTF-8 strings to Latin1 when using the standard 14 core fonts.<br> * @param $str (string) string to process. * @param $isunicode (boolean) True when the documetn is in Unicode mode, false otherwise. * @param $currentfont (array) Reference to current font array. * @return string * @since 3.2.000 (2008-06-23) * @public static */ public static function UTF8ToLatin1($str, $isunicode=true, &$currentfont=array()) { $unicode = self::UTF8StringToArray($str, $isunicode, $currentfont); // array containing UTF-8 unicode values return self::UTF8ArrToLatin1($unicode); } /** * Converts UTF-8 strings to UTF16-BE.<br> * @param $str (string) string to process. * @param $setbom (boolean) if true set the Byte Order Mark (BOM = 0xFEFF) * @param $isunicode (boolean) True when the documetn is in Unicode mode, false otherwise. * @param $currentfont (array) Reference to current font array. * @return string * @author Nicola Asuni * @since 1.53.0.TC005 (2005-01-05) * @public static */ public static function UTF8ToUTF16BE($str, $setbom=false, $isunicode=true, &$currentfont=array()) { if (!$isunicode) { return $str; // string is not in unicode } $unicode = self::UTF8StringToArray($str, $isunicode, $currentfont); // array containing UTF-8 unicode values return self::arrUTF8ToUTF16BE($unicode, $setbom); } /** * Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/). * @param $str (string) string to manipulate. * @param $setbom (bool) if true set the Byte Order Mark (BOM = 0xFEFF) * @param $forcertl (bool) if true forces RTL text direction * @param $isunicode (boolean) True if the document is in Unicode mode, false otherwise. * @param $currentfont (array) Reference to current font array. * @return string * @author Nicola Asuni * @since 2.1.000 (2008-01-08) * @public static */ public static function utf8StrRev($str, $setbom=false, $forcertl=false, $isunicode=true, &$currentfont=array()) { return self::utf8StrArrRev(self::UTF8StringToArray($str, $isunicode, $currentfont), $str, $setbom, $forcertl, $isunicode, $currentfont); } /** * Reverse the RLT substrings array using the Bidirectional Algorithm (http://unicode.org/reports/tr9/). * @param $arr (array) array of unicode values. * @param $str (string) string to manipulate (or empty value). * @param $setbom (bool) if true set the Byte Order Mark (BOM = 0xFEFF) * @param $forcertl (bool) if true forces RTL text direction * @param $isunicode (boolean) True if the document is in Unicode mode, false otherwise. * @param $currentfont (array) Reference to current font array. * @return string * @author Nicola Asuni * @since 4.9.000 (2010-03-27) * @public static */ public static function utf8StrArrRev($arr, $str='', $setbom=false, $forcertl=false, $isunicode=true, &$currentfont=array()) { return self::arrUTF8ToUTF16BE(self::utf8Bidi($arr, $str, $forcertl, $isunicode, $currentfont), $setbom); } /** * Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/). * @param $ta (array) array of characters composing the string. * @param $str (string) string to process * @param $forcertl (bool) if 'R' forces RTL, if 'L' forces LTR * @param $isunicode (boolean) True if the document is in Unicode mode, false otherwise. * @param $currentfont (array) Reference to current font array. * @return array of unicode chars * @author Nicola Asuni * @since 2.4.000 (2008-03-06) * @public static */ public static function utf8Bidi($ta, $str='', $forcertl=false, $isunicode=true, &$currentfont=array()) { // paragraph embedding level $pel = 0; // max level $maxlevel = 0; if (TCPDF_STATIC::empty_string($str)) { // create string from array $str = self::UTF8ArrSubString($ta, '', '', $isunicode); } // check if string contains arabic text if (preg_match(TCPDF_FONT_DATA::$uni_RE_PATTERN_ARABIC, $str)) { $arabic = true; } else { $arabic = false; } // check if string contains RTL text if (!($forcertl OR $arabic OR preg_match(TCPDF_FONT_DATA::$uni_RE_PATTERN_RTL, $str))) { return $ta; } // get number of chars $numchars = count($ta); if ($forcertl == 'R') { $pel = 1; } elseif ($forcertl == 'L') { $pel = 0; } else { // P2. In each paragraph, find the first character of type L, AL, or R. // P3. If a character is found in P2 and it is of type AL or R, then set the paragraph embedding level to one; otherwise, set it to zero. for ($i=0; $i < $numchars; ++$i) { $type = TCPDF_FONT_DATA::$uni_type[$ta[$i]]; if ($type == 'L') { $pel = 0; break; } elseif (($type == 'AL') OR ($type == 'R')) { $pel = 1; break; } } } // Current Embedding Level $cel = $pel; // directional override status $dos = 'N'; $remember = array(); // start-of-level-run $sor = $pel % 2 ? 'R' : 'L'; $eor = $sor; // Array of characters data $chardata = Array(); // X1. Begin by setting the current embedding level to the paragraph embedding level. Set the directional override status to neutral. Process each character iteratively, applying rules X2 through X9. Only embedding levels from 0 to 61 are valid in this phase. // In the resolution of levels in rules I1 and I2, the maximum embedding level of 62 can be reached. for ($i=0; $i < $numchars; ++$i) { if ($ta[$i] == TCPDF_FONT_DATA::$uni_RLE) { // X2. With each RLE, compute the least greater odd embedding level. // a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to neutral. // b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status. $next_level = $cel + ($cel % 2) + 1; if ($next_level < 62) { $remember[] = array('num' => TCPDF_FONT_DATA::$uni_RLE, 'cel' => $cel, 'dos' => $dos); $cel = $next_level; $dos = 'N'; $sor = $eor; $eor = $cel % 2 ? 'R' : 'L'; } } elseif ($ta[$i] == TCPDF_FONT_DATA::$uni_LRE) { // X3. With each LRE, compute the least greater even embedding level. // a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to neutral. // b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status. $next_level = $cel + 2 - ($cel % 2); if ( $next_level < 62 ) { $remember[] = array('num' => TCPDF_FONT_DATA::$uni_LRE, 'cel' => $cel, 'dos' => $dos); $cel = $next_level; $dos = 'N'; $sor = $eor; $eor = $cel % 2 ? 'R' : 'L'; } } elseif ($ta[$i] == TCPDF_FONT_DATA::$uni_RLO) { // X4. With each RLO, compute the least greater odd embedding level. // a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to right-to-left. // b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status. $next_level = $cel + ($cel % 2) + 1; if ($next_level < 62) { $remember[] = array('num' => TCPDF_FONT_DATA::$uni_RLO, 'cel' => $cel, 'dos' => $dos); $cel = $next_level; $dos = 'R'; $sor = $eor; $eor = $cel % 2 ? 'R' : 'L'; } } elseif ($ta[$i] == TCPDF_FONT_DATA::$uni_LRO) { // X5. With each LRO, compute the least greater even embedding level. // a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to left-to-right. // b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status. $next_level = $cel + 2 - ($cel % 2); if ( $next_level < 62 ) { $remember[] = array('num' => TCPDF_FONT_DATA::$uni_LRO, 'cel' => $cel, 'dos' => $dos); $cel = $next_level; $dos = 'L'; $sor = $eor; $eor = $cel % 2 ? 'R' : 'L'; } } elseif ($ta[$i] == TCPDF_FONT_DATA::$uni_PDF) { // X7. With each PDF, determine the matching embedding or override code. If there was a valid matching code, restore (pop) the last remembered (pushed) embedding level and directional override. if (count($remember)) { $last = count($remember ) - 1; if (($remember[$last]['num'] == TCPDF_FONT_DATA::$uni_RLE) OR ($remember[$last]['num'] == TCPDF_FONT_DATA::$uni_LRE) OR ($remember[$last]['num'] == TCPDF_FONT_DATA::$uni_RLO) OR ($remember[$last]['num'] == TCPDF_FONT_DATA::$uni_LRO)) { $match = array_pop($remember); $cel = $match['cel']; $dos = $match['dos']; $sor = $eor; $eor = ($cel > $match['cel'] ? $cel : $match['cel']) % 2 ? 'R' : 'L'; } } } elseif (($ta[$i] != TCPDF_FONT_DATA::$uni_RLE) AND ($ta[$i] != TCPDF_FONT_DATA::$uni_LRE) AND ($ta[$i] != TCPDF_FONT_DATA::$uni_RLO) AND ($ta[$i] != TCPDF_FONT_DATA::$uni_LRO) AND ($ta[$i] != TCPDF_FONT_DATA::$uni_PDF)) { // X6. For all types besides RLE, LRE, RLO, LRO, and PDF: // a. Set the level of the current character to the current embedding level. // b. Whenever the directional override status is not neutral, reset the current character type to the directional override status. if ($dos != 'N') { $chardir = $dos; } else { if (isset(TCPDF_FONT_DATA::$uni_type[$ta[$i]])) { $chardir = TCPDF_FONT_DATA::$uni_type[$ta[$i]]; } else { $chardir = 'L'; } } // stores string characters and other information $chardata[] = array('char' => $ta[$i], 'level' => $cel, 'type' => $chardir, 'sor' => $sor, 'eor' => $eor); } } // end for each char // X8. All explicit directional embeddings and overrides are completely terminated at the end of each paragraph. Paragraph separators are not included in the embedding. // X9. Remove all RLE, LRE, RLO, LRO, PDF, and BN codes. // X10. The remaining rules are applied to each run of characters at the same level. For each run, determine the start-of-level-run (sor) and end-of-level-run (eor) type, either L or R. This depends on the higher of the two levels on either side of the boundary (at the start or end of the paragraph, the level of the 'other' run is the base embedding level). If the higher level is odd, the type is R; otherwise, it is L. // 3.3.3 Resolving Weak Types // Weak types are now resolved one level run at a time. At level run boundaries where the type of the character on the other side of the boundary is required, the type assigned to sor or eor is used. // Nonspacing marks are now resolved based on the previous characters. $numchars = count($chardata); // W1. Examine each nonspacing mark (NSM) in the level run, and change the type of the NSM to the type of the previous character. If the NSM is at the start of the level run, it will get the type of sor. $prevlevel = -1; // track level changes $levcount = 0; // counts consecutive chars at the same level for ($i=0; $i < $numchars; ++$i) { if ($chardata[$i]['type'] == 'NSM') { if ($levcount) { $chardata[$i]['type'] = $chardata[$i]['sor']; } elseif ($i > 0) { $chardata[$i]['type'] = $chardata[($i-1)]['type']; } } if ($chardata[$i]['level'] != $prevlevel) { $levcount = 0; } else { ++$levcount; } $prevlevel = $chardata[$i]['level']; } // W2. Search backward from each instance of a European number until the first strong type (R, L, AL, or sor) is found. If an AL is found, change the type of the European number to Arabic number. $prevlevel = -1; $levcount = 0; for ($i=0; $i < $numchars; ++$i) { if ($chardata[$i]['char'] == 'EN') { for ($j=$levcount; $j >= 0; $j--) { if ($chardata[$j]['type'] == 'AL') { $chardata[$i]['type'] = 'AN'; } elseif (($chardata[$j]['type'] == 'L') OR ($chardata[$j]['type'] == 'R')) { break; } } } if ($chardata[$i]['level'] != $prevlevel) { $levcount = 0; } else { ++$levcount; } $prevlevel = $chardata[$i]['level']; } // W3. Change all ALs to R. for ($i=0; $i < $numchars; ++$i) { if ($chardata[$i]['type'] == 'AL') { $chardata[$i]['type'] = 'R'; } } // W4. A single European separator between two European numbers changes to a European number. A single common separator between two numbers of the same type changes to that type. $prevlevel = -1; $levcount = 0; for ($i=0; $i < $numchars; ++$i) { if (($levcount > 0) AND (($i+1) < $numchars) AND ($chardata[($i+1)]['level'] == $prevlevel)) { if (($chardata[$i]['type'] == 'ES') AND ($chardata[($i-1)]['type'] == 'EN') AND ($chardata[($i+1)]['type'] == 'EN')) { $chardata[$i]['type'] = 'EN'; } elseif (($chardata[$i]['type'] == 'CS') AND ($chardata[($i-1)]['type'] == 'EN') AND ($chardata[($i+1)]['type'] == 'EN')) { $chardata[$i]['type'] = 'EN'; } elseif (($chardata[$i]['type'] == 'CS') AND ($chardata[($i-1)]['type'] == 'AN') AND ($chardata[($i+1)]['type'] == 'AN')) { $chardata[$i]['type'] = 'AN'; } } if ($chardata[$i]['level'] != $prevlevel) { $levcount = 0; } else { ++$levcount; } $prevlevel = $chardata[$i]['level']; } // W5. A sequence of European terminators adjacent to European numbers changes to all European numbers. $prevlevel = -1; $levcount = 0; for ($i=0; $i < $numchars; ++$i) { if ($chardata[$i]['type'] == 'ET') { if (($levcount > 0) AND ($chardata[($i-1)]['type'] == 'EN')) { $chardata[$i]['type'] = 'EN'; } else { $j = $i+1; while (($j < $numchars) AND ($chardata[$j]['level'] == $prevlevel)) { if ($chardata[$j]['type'] == 'EN') { $chardata[$i]['type'] = 'EN'; break; } elseif ($chardata[$j]['type'] != 'ET') { break; } ++$j; } } } if ($chardata[$i]['level'] != $prevlevel) { $levcount = 0; } else { ++$levcount; } $prevlevel = $chardata[$i]['level']; } // W6. Otherwise, separators and terminators change to Other Neutral. $prevlevel = -1; $levcount = 0; for ($i=0; $i < $numchars; ++$i) { if (($chardata[$i]['type'] == 'ET') OR ($chardata[$i]['type'] == 'ES') OR ($chardata[$i]['type'] == 'CS')) { $chardata[$i]['type'] = 'ON'; } if ($chardata[$i]['level'] != $prevlevel) { $levcount = 0; } else { ++$levcount; } $prevlevel = $chardata[$i]['level']; } //W7. Search backward from each instance of a European number until the first strong type (R, L, or sor) is found. If an L is found, then change the type of the European number to L. $prevlevel = -1; $levcount = 0; for ($i=0; $i < $numchars; ++$i) { if ($chardata[$i]['char'] == 'EN') { for ($j=$levcount; $j >= 0; $j--) { if ($chardata[$j]['type'] == 'L') { $chardata[$i]['type'] = 'L'; } elseif ($chardata[$j]['type'] == 'R') { break; } } } if ($chardata[$i]['level'] != $prevlevel) { $levcount = 0; } else { ++$levcount; } $prevlevel = $chardata[$i]['level']; } // N1. A sequence of neutrals takes the direction of the surrounding strong text if the text on both sides has the same direction. European and Arabic numbers act as if they were R in terms of their influence on neutrals. Start-of-level-run (sor) and end-of-level-run (eor) are used at level run boundaries. $prevlevel = -1; $levcount = 0; for ($i=0; $i < $numchars; ++$i) { if (($levcount > 0) AND (($i+1) < $numchars) AND ($chardata[($i+1)]['level'] == $prevlevel)) { if (($chardata[$i]['type'] == 'N') AND ($chardata[($i-1)]['type'] == 'L') AND ($chardata[($i+1)]['type'] == 'L')) { $chardata[$i]['type'] = 'L'; } elseif (($chardata[$i]['type'] == 'N') AND (($chardata[($i-1)]['type'] == 'R') OR ($chardata[($i-1)]['type'] == 'EN') OR ($chardata[($i-1)]['type'] == 'AN')) AND (($chardata[($i+1)]['type'] == 'R') OR ($chardata[($i+1)]['type'] == 'EN') OR ($chardata[($i+1)]['type'] == 'AN'))) { $chardata[$i]['type'] = 'R'; } elseif ($chardata[$i]['type'] == 'N') { // N2. Any remaining neutrals take the embedding direction $chardata[$i]['type'] = $chardata[$i]['sor']; } } elseif (($levcount == 0) AND (($i+1) < $numchars) AND ($chardata[($i+1)]['level'] == $prevlevel)) { // first char if (($chardata[$i]['type'] == 'N') AND ($chardata[$i]['sor'] == 'L') AND ($chardata[($i+1)]['type'] == 'L')) { $chardata[$i]['type'] = 'L'; } elseif (($chardata[$i]['type'] == 'N') AND (($chardata[$i]['sor'] == 'R') OR ($chardata[$i]['sor'] == 'EN') OR ($chardata[$i]['sor'] == 'AN')) AND (($chardata[($i+1)]['type'] == 'R') OR ($chardata[($i+1)]['type'] == 'EN') OR ($chardata[($i+1)]['type'] == 'AN'))) { $chardata[$i]['type'] = 'R'; } elseif ($chardata[$i]['type'] == 'N') { // N2. Any remaining neutrals take the embedding direction $chardata[$i]['type'] = $chardata[$i]['sor']; } } elseif (($levcount > 0) AND ((($i+1) == $numchars) OR (($i+1) < $numchars) AND ($chardata[($i+1)]['level'] != $prevlevel))) { //last char if (($chardata[$i]['type'] == 'N') AND ($chardata[($i-1)]['type'] == 'L') AND ($chardata[$i]['eor'] == 'L')) { $chardata[$i]['type'] = 'L'; } elseif (($chardata[$i]['type'] == 'N') AND (($chardata[($i-1)]['type'] == 'R') OR ($chardata[($i-1)]['type'] == 'EN') OR ($chardata[($i-1)]['type'] == 'AN')) AND (($chardata[$i]['eor'] == 'R') OR ($chardata[$i]['eor'] == 'EN') OR ($chardata[$i]['eor'] == 'AN'))) { $chardata[$i]['type'] = 'R'; } elseif ($chardata[$i]['type'] == 'N') { // N2. Any remaining neutrals take the embedding direction $chardata[$i]['type'] = $chardata[$i]['sor']; } } elseif ($chardata[$i]['type'] == 'N') { // N2. Any remaining neutrals take the embedding direction $chardata[$i]['type'] = $chardata[$i]['sor']; } if ($chardata[$i]['level'] != $prevlevel) { $levcount = 0; } else { ++$levcount; } $prevlevel = $chardata[$i]['level']; } // I1. For all characters with an even (left-to-right) embedding direction, those of type R go up one level and those of type AN or EN go up two levels. // I2. For all characters with an odd (right-to-left) embedding direction, those of type L, EN or AN go up one level. for ($i=0; $i < $numchars; ++$i) { $odd = $chardata[$i]['level'] % 2; if ($odd) { if (($chardata[$i]['type'] == 'L') OR ($chardata[$i]['type'] == 'AN') OR ($chardata[$i]['type'] == 'EN')) { $chardata[$i]['level'] += 1; } } else { if ($chardata[$i]['type'] == 'R') { $chardata[$i]['level'] += 1; } elseif (($chardata[$i]['type'] == 'AN') OR ($chardata[$i]['type'] == 'EN')) { $chardata[$i]['level'] += 2; } } $maxlevel = max($chardata[$i]['level'],$maxlevel); } // L1. On each line, reset the embedding level of the following characters to the paragraph embedding level: // 1. Segment separators, // 2. Paragraph separators, // 3. Any sequence of whitespace characters preceding a segment separator or paragraph separator, and // 4. Any sequence of white space characters at the end of the line. for ($i=0; $i < $numchars; ++$i) { if (($chardata[$i]['type'] == 'B') OR ($chardata[$i]['type'] == 'S')) { $chardata[$i]['level'] = $pel; } elseif ($chardata[$i]['type'] == 'WS') { $j = $i+1; while ($j < $numchars) { if ((($chardata[$j]['type'] == 'B') OR ($chardata[$j]['type'] == 'S')) OR (($j == ($numchars-1)) AND ($chardata[$j]['type'] == 'WS'))) { $chardata[$i]['level'] = $pel; break; } elseif ($chardata[$j]['type'] != 'WS') { break; } ++$j; } } } // Arabic Shaping // Cursively connected scripts, such as Arabic or Syriac, require the selection of positional character shapes that depend on adjacent characters. Shaping is logically applied after the Bidirectional Algorithm is used and is limited to characters within the same directional run. if ($arabic) { $endedletter = array(1569,1570,1571,1572,1573,1575,1577,1583,1584,1585,1586,1608,1688); $alfletter = array(1570,1571,1573,1575); $chardata2 = $chardata; $laaletter = false; $charAL = array(); $x = 0; for ($i=0; $i < $numchars; ++$i) { if ((TCPDF_FONT_DATA::$uni_type[$chardata[$i]['char']] == 'AL') OR ($chardata[$i]['char'] == 32) OR ($chardata[$i]['char'] == 8204)) { $charAL[$x] = $chardata[$i]; $charAL[$x]['i'] = $i; $chardata[$i]['x'] = $x; ++$x; } } $numAL = $x; for ($i=0; $i < $numchars; ++$i) { $thischar = $chardata[$i]; if ($i > 0) { $prevchar = $chardata[($i-1)]; } else { $prevchar = false; } if (($i+1) < $numchars) { $nextchar = $chardata[($i+1)]; } else { $nextchar = false; } if (TCPDF_FONT_DATA::$uni_type[$thischar['char']] == 'AL') { $x = $thischar['x']; if ($x > 0) { $prevchar = $charAL[($x-1)]; } else { $prevchar = false; } if (($x+1) < $numAL) { $nextchar = $charAL[($x+1)]; } else { $nextchar = false; } // if laa letter if (($prevchar !== false) AND ($prevchar['char'] == 1604) AND (in_array($thischar['char'], $alfletter))) { $arabicarr = TCPDF_FONT_DATA::$uni_laa_array; $laaletter = true; if ($x > 1) { $prevchar = $charAL[($x-2)]; } else { $prevchar = false; } } else { $arabicarr = TCPDF_FONT_DATA::$uni_arabicsubst; $laaletter = false; } if (($prevchar !== false) AND ($nextchar !== false) AND ((TCPDF_FONT_DATA::$uni_type[$prevchar['char']] == 'AL') OR (TCPDF_FONT_DATA::$uni_type[$prevchar['char']] == 'NSM')) AND ((TCPDF_FONT_DATA::$uni_type[$nextchar['char']] == 'AL') OR (TCPDF_FONT_DATA::$uni_type[$nextchar['char']] == 'NSM')) AND ($prevchar['type'] == $thischar['type']) AND ($nextchar['type'] == $thischar['type']) AND ($nextchar['char'] != 1567)) { if (in_array($prevchar['char'], $endedletter)) { if (isset($arabicarr[$thischar['char']][2])) { // initial $chardata2[$i]['char'] = $arabicarr[$thischar['char']][2]; } } else { if (isset($arabicarr[$thischar['char']][3])) { // medial $chardata2[$i]['char'] = $arabicarr[$thischar['char']][3]; } } } elseif (($nextchar !== false) AND ((TCPDF_FONT_DATA::$uni_type[$nextchar['char']] == 'AL') OR (TCPDF_FONT_DATA::$uni_type[$nextchar['char']] == 'NSM')) AND ($nextchar['type'] == $thischar['type']) AND ($nextchar['char'] != 1567)) { if (isset($arabicarr[$chardata[$i]['char']][2])) { // initial $chardata2[$i]['char'] = $arabicarr[$thischar['char']][2]; } } elseif ((($prevchar !== false) AND ((TCPDF_FONT_DATA::$uni_type[$prevchar['char']] == 'AL') OR (TCPDF_FONT_DATA::$uni_type[$prevchar['char']] == 'NSM')) AND ($prevchar['type'] == $thischar['type'])) OR (($nextchar !== false) AND ($nextchar['char'] == 1567))) { // final if (($i > 1) AND ($thischar['char'] == 1607) AND ($chardata[$i-1]['char'] == 1604) AND ($chardata[$i-2]['char'] == 1604)) { //Allah Word // mark characters to delete with false $chardata2[$i-2]['char'] = false; $chardata2[$i-1]['char'] = false; $chardata2[$i]['char'] = 65010; } else { if (($prevchar !== false) AND in_array($prevchar['char'], $endedletter)) { if (isset($arabicarr[$thischar['char']][0])) { // isolated $chardata2[$i]['char'] = $arabicarr[$thischar['char']][0]; } } else { if (isset($arabicarr[$thischar['char']][1])) { // final $chardata2[$i]['char'] = $arabicarr[$thischar['char']][1]; } } } } elseif (isset($arabicarr[$thischar['char']][0])) { // isolated $chardata2[$i]['char'] = $arabicarr[$thischar['char']][0]; } // if laa letter if ($laaletter) { // mark characters to delete with false $chardata2[($charAL[($x-1)]['i'])]['char'] = false; } } // end if AL (Arabic Letter) } // end for each char /* * Combining characters that can occur with Arabic Shadda (0651 HEX, 1617 DEC) are replaced. * Putting the combining mark and shadda in the same glyph allows us to avoid the two marks overlapping each other in an illegible manner. */ for ($i = 0; $i < ($numchars-1); ++$i) { if (($chardata2[$i]['char'] == 1617) AND (isset(TCPDF_FONT_DATA::$uni_diacritics[($chardata2[$i+1]['char'])]))) { // check if the subtitution font is defined on current font if (isset($currentfont['cw'][(TCPDF_FONT_DATA::$uni_diacritics[($chardata2[$i+1]['char'])])])) { $chardata2[$i]['char'] = false; $chardata2[$i+1]['char'] = TCPDF_FONT_DATA::$uni_diacritics[($chardata2[$i+1]['char'])]; } } } // remove marked characters foreach ($chardata2 as $key => $value) { if ($value['char'] === false) { unset($chardata2[$key]); } } $chardata = array_values($chardata2); $numchars = count($chardata); unset($chardata2); unset($arabicarr); unset($laaletter); unset($charAL); } // L2. From the highest level found in the text to the lowest odd level on each line, including intermediate levels not actually present in the text, reverse any contiguous sequence of characters that are at that level or higher. for ($j=$maxlevel; $j > 0; $j--) { $ordarray = Array(); $revarr = Array(); $onlevel = false; for ($i=0; $i < $numchars; ++$i) { if ($chardata[$i]['level'] >= $j) { $onlevel = true; if (isset(TCPDF_FONT_DATA::$uni_mirror[$chardata[$i]['char']])) { // L4. A character is depicted by a mirrored glyph if and only if (a) the resolved directionality of that character is R, and (b) the Bidi_Mirrored property value of that character is true. $chardata[$i]['char'] = TCPDF_FONT_DATA::$uni_mirror[$chardata[$i]['char']]; } $revarr[] = $chardata[$i]; } else { if ($onlevel) { $revarr = array_reverse($revarr); $ordarray = array_merge($ordarray, $revarr); $revarr = Array(); $onlevel = false; } $ordarray[] = $chardata[$i]; } } if ($onlevel) { $revarr = array_reverse($revarr); $ordarray = array_merge($ordarray, $revarr); } $chardata = $ordarray; } $ordarray = array(); foreach ($chardata as $cd) { $ordarray[] = $cd['char']; // store char values for subsetting $currentfont['subsetchars'][$cd['char']] = true; } return $ordarray; } } // END OF TCPDF_FONTS CLASS //============================================================+ // END OF FILE //============================================================+
fpcorso/qsm-certificate
php/TCPDF/include/tcpdf_fonts.php
PHP
gpl-2.0
96,225
/* * generic functions used by VFIO devices * * Copyright Red Hat, Inc. 2012 * * Authors: * Alex Williamson <alex.williamson@redhat.com> * * This work is licensed under the terms of the GNU GPL, version 2. See * the COPYING file in the top-level directory. * * Based on qemu-kvm device-assignment: * Adapted for KVM by Qumranet. * Copyright (c) 2007, Neocleus, Alex Novik (alex@neocleus.com) * Copyright (c) 2007, Neocleus, Guy Zana (guy@neocleus.com) * Copyright (C) 2008, Qumranet, Amit Shah (amit.shah@qumranet.com) * Copyright (C) 2008, Red Hat, Amit Shah (amit.shah@redhat.com) * Copyright (C) 2008, IBM, Muli Ben-Yehuda (muli@il.ibm.com) */ #include <sys/ioctl.h> #include <sys/mman.h> #include <linux/vfio.h> #include "hw/vfio/vfio-common.h" #include "hw/vfio/vfio.h" #include "exec/address-spaces.h" #include "exec/memory.h" #include "hw/hw.h" #include "qemu/error-report.h" #include "sysemu/kvm.h" #include "trace.h" struct vfio_group_head vfio_group_list = QLIST_HEAD_INITIALIZER(vfio_group_list); struct vfio_as_head vfio_address_spaces = QLIST_HEAD_INITIALIZER(vfio_address_spaces); #ifdef CONFIG_KVM /* * We have a single VFIO pseudo device per KVM VM. Once created it lives * for the life of the VM. Closing the file descriptor only drops our * reference to it and the device's reference to kvm. Therefore once * initialized, this file descriptor is only released on QEMU exit and * we'll re-use it should another vfio device be attached before then. */ static int vfio_kvm_device_fd = -1; #endif /* * Common VFIO interrupt disable */ void vfio_disable_irqindex(VFIODevice *vbasedev, int index) { struct vfio_irq_set irq_set = { .argsz = sizeof(irq_set), .flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_TRIGGER, .index = index, .start = 0, .count = 0, }; ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, &irq_set); } void vfio_unmask_single_irqindex(VFIODevice *vbasedev, int index) { struct vfio_irq_set irq_set = { .argsz = sizeof(irq_set), .flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_UNMASK, .index = index, .start = 0, .count = 1, }; ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, &irq_set); } void vfio_mask_single_irqindex(VFIODevice *vbasedev, int index) { struct vfio_irq_set irq_set = { .argsz = sizeof(irq_set), .flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_MASK, .index = index, .start = 0, .count = 1, }; ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, &irq_set); } /* * IO Port/MMIO - Beware of the endians, VFIO is always little endian */ void vfio_region_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { VFIORegion *region = opaque; VFIODevice *vbasedev = region->vbasedev; union { uint8_t byte; uint16_t word; uint32_t dword; uint64_t qword; } buf; switch (size) { case 1: buf.byte = data; break; case 2: buf.word = cpu_to_le16(data); break; case 4: buf.dword = cpu_to_le32(data); break; default: hw_error("vfio: unsupported write size, %d bytes", size); break; } if (pwrite(vbasedev->fd, &buf, size, region->fd_offset + addr) != size) { error_report("%s(%s:region%d+0x%"HWADDR_PRIx", 0x%"PRIx64 ",%d) failed: %m", __func__, vbasedev->name, region->nr, addr, data, size); } trace_vfio_region_write(vbasedev->name, region->nr, addr, data, size); /* * A read or write to a BAR always signals an INTx EOI. This will * do nothing if not pending (including not in INTx mode). We assume * that a BAR access is in response to an interrupt and that BAR * accesses will service the interrupt. Unfortunately, we don't know * which access will service the interrupt, so we're potentially * getting quite a few host interrupts per guest interrupt. */ vbasedev->ops->vfio_eoi(vbasedev); } uint64_t vfio_region_read(void *opaque, hwaddr addr, unsigned size) { VFIORegion *region = opaque; VFIODevice *vbasedev = region->vbasedev; union { uint8_t byte; uint16_t word; uint32_t dword; uint64_t qword; } buf; uint64_t data = 0; if (pread(vbasedev->fd, &buf, size, region->fd_offset + addr) != size) { error_report("%s(%s:region%d+0x%"HWADDR_PRIx", %d) failed: %m", __func__, vbasedev->name, region->nr, addr, size); return (uint64_t)-1; } switch (size) { case 1: data = buf.byte; break; case 2: data = le16_to_cpu(buf.word); break; case 4: data = le32_to_cpu(buf.dword); break; default: hw_error("vfio: unsupported read size, %d bytes", size); break; } trace_vfio_region_read(vbasedev->name, region->nr, addr, size, data); /* Same as write above */ vbasedev->ops->vfio_eoi(vbasedev); return data; } const MemoryRegionOps vfio_region_ops = { .read = vfio_region_read, .write = vfio_region_write, .endianness = DEVICE_LITTLE_ENDIAN, }; /* * DMA - Mapping and unmapping for the "type1" IOMMU interface used on x86 */ static int vfio_dma_unmap(VFIOContainer *container, hwaddr iova, ram_addr_t size) { struct vfio_iommu_type1_dma_unmap unmap = { .argsz = sizeof(unmap), .flags = 0, .iova = iova, .size = size, }; if (ioctl(container->fd, VFIO_IOMMU_UNMAP_DMA, &unmap)) { error_report("VFIO_UNMAP_DMA: %d\n", -errno); return -errno; } return 0; } static int vfio_dma_map(VFIOContainer *container, hwaddr iova, ram_addr_t size, void *vaddr, bool readonly) { struct vfio_iommu_type1_dma_map map = { .argsz = sizeof(map), .flags = VFIO_DMA_MAP_FLAG_READ, .vaddr = (__u64)(uintptr_t)vaddr, .iova = iova, .size = size, }; if (!readonly) { map.flags |= VFIO_DMA_MAP_FLAG_WRITE; } /* * Try the mapping, if it fails with EBUSY, unmap the region and try * again. This shouldn't be necessary, but we sometimes see it in * the the VGA ROM space. */ if (ioctl(container->fd, VFIO_IOMMU_MAP_DMA, &map) == 0 || (errno == EBUSY && vfio_dma_unmap(container, iova, size) == 0 && ioctl(container->fd, VFIO_IOMMU_MAP_DMA, &map) == 0)) { return 0; } error_report("VFIO_MAP_DMA: %d\n", -errno); return -errno; } static bool vfio_listener_skipped_section(MemoryRegionSection *section) { return (!memory_region_is_ram(section->mr) && !memory_region_is_iommu(section->mr)) || /* * Sizing an enabled 64-bit BAR can cause spurious mappings to * addresses in the upper part of the 64-bit address space. These * are never accessed by the CPU and beyond the address width of * some IOMMU hardware. TODO: VFIO should tell us the IOMMU width. */ section->offset_within_address_space & (1ULL << 63); } static void vfio_iommu_map_notify(Notifier *n, void *data) { VFIOGuestIOMMU *giommu = container_of(n, VFIOGuestIOMMU, n); VFIOContainer *container = giommu->container; IOMMUTLBEntry *iotlb = data; MemoryRegion *mr; hwaddr xlat; hwaddr len = iotlb->addr_mask + 1; void *vaddr; int ret; trace_vfio_iommu_map_notify(iotlb->iova, iotlb->iova + iotlb->addr_mask); /* * The IOMMU TLB entry we have just covers translation through * this IOMMU to its immediate target. We need to translate * it the rest of the way through to memory. */ mr = address_space_translate(&address_space_memory, iotlb->translated_addr, &xlat, &len, iotlb->perm & IOMMU_WO); if (!memory_region_is_ram(mr)) { error_report("iommu map to non memory area %"HWADDR_PRIx"\n", xlat); return; } /* * Translation truncates length to the IOMMU page size, * check that it did not truncate too much. */ if (len & iotlb->addr_mask) { error_report("iommu has granularity incompatible with target AS\n"); return; } if ((iotlb->perm & IOMMU_RW) != IOMMU_NONE) { vaddr = memory_region_get_ram_ptr(mr) + xlat; ret = vfio_dma_map(container, iotlb->iova, iotlb->addr_mask + 1, vaddr, !(iotlb->perm & IOMMU_WO) || mr->readonly); if (ret) { error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", " "0x%"HWADDR_PRIx", %p) = %d (%m)", container, iotlb->iova, iotlb->addr_mask + 1, vaddr, ret); } } else { ret = vfio_dma_unmap(container, iotlb->iova, iotlb->addr_mask + 1); if (ret) { error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", " "0x%"HWADDR_PRIx") = %d (%m)", container, iotlb->iova, iotlb->addr_mask + 1, ret); } } } static void vfio_listener_region_add(MemoryListener *listener, MemoryRegionSection *section) { VFIOContainer *container = container_of(listener, VFIOContainer, iommu_data.type1.listener); hwaddr iova, end; Int128 llend; void *vaddr; int ret; if (vfio_listener_skipped_section(section)) { trace_vfio_listener_region_add_skip( section->offset_within_address_space, section->offset_within_address_space + int128_get64(int128_sub(section->size, int128_one()))); return; } if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK) != (section->offset_within_region & ~TARGET_PAGE_MASK))) { error_report("%s received unaligned region", __func__); return; } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); llend = int128_make64(section->offset_within_address_space); llend = int128_add(llend, section->size); llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK)); if (int128_ge(int128_make64(iova), llend)) { return; } memory_region_ref(section->mr); if (memory_region_is_iommu(section->mr)) { VFIOGuestIOMMU *giommu; trace_vfio_listener_region_add_iommu(iova, int128_get64(int128_sub(llend, int128_one()))); /* * FIXME: We should do some checking to see if the * capabilities of the host VFIO IOMMU are adequate to model * the guest IOMMU * * FIXME: For VFIO iommu types which have KVM acceleration to * avoid bouncing all map/unmaps through qemu this way, this * would be the right place to wire that up (tell the KVM * device emulation the VFIO iommu handles to use). */ /* * This assumes that the guest IOMMU is empty of * mappings at this point. * * One way of doing this is: * 1. Avoid sharing IOMMUs between emulated devices or different * IOMMU groups. * 2. Implement VFIO_IOMMU_ENABLE in the host kernel to fail if * there are some mappings in IOMMU. * * VFIO on SPAPR does that. Other IOMMU models may do that different, * they must make sure there are no existing mappings or * loop through existing mappings to map them into VFIO. */ giommu = g_malloc0(sizeof(*giommu)); giommu->iommu = section->mr; giommu->container = container; giommu->n.notify = vfio_iommu_map_notify; QLIST_INSERT_HEAD(&container->giommu_list, giommu, giommu_next); memory_region_register_iommu_notifier(giommu->iommu, &giommu->n); return; } /* Here we assume that memory_region_is_ram(section->mr)==true */ end = int128_get64(llend); vaddr = memory_region_get_ram_ptr(section->mr) + section->offset_within_region + (iova - section->offset_within_address_space); trace_vfio_listener_region_add_ram(iova, end - 1, vaddr); ret = vfio_dma_map(container, iova, end - iova, vaddr, section->readonly); if (ret) { error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", " "0x%"HWADDR_PRIx", %p) = %d (%m)", container, iova, end - iova, vaddr, ret); /* * On the initfn path, store the first error in the container so we * can gracefully fail. Runtime, there's not much we can do other * than throw a hardware error. */ if (!container->iommu_data.type1.initialized) { if (!container->iommu_data.type1.error) { container->iommu_data.type1.error = ret; } } else { hw_error("vfio: DMA mapping failed, unable to continue"); } } } static void vfio_listener_region_del(MemoryListener *listener, MemoryRegionSection *section) { VFIOContainer *container = container_of(listener, VFIOContainer, iommu_data.type1.listener); hwaddr iova, end; int ret; if (vfio_listener_skipped_section(section)) { trace_vfio_listener_region_del_skip( section->offset_within_address_space, section->offset_within_address_space + int128_get64(int128_sub(section->size, int128_one()))); return; } if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK) != (section->offset_within_region & ~TARGET_PAGE_MASK))) { error_report("%s received unaligned region", __func__); return; } if (memory_region_is_iommu(section->mr)) { VFIOGuestIOMMU *giommu; QLIST_FOREACH(giommu, &container->giommu_list, giommu_next) { if (giommu->iommu == section->mr) { memory_region_unregister_iommu_notifier(&giommu->n); QLIST_REMOVE(giommu, giommu_next); g_free(giommu); break; } } /* * FIXME: We assume the one big unmap below is adequate to * remove any individual page mappings in the IOMMU which * might have been copied into VFIO. This works for a page table * based IOMMU where a big unmap flattens a large range of IO-PTEs. * That may not be true for all IOMMU types. */ } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); end = (section->offset_within_address_space + int128_get64(section->size)) & TARGET_PAGE_MASK; if (iova >= end) { return; } trace_vfio_listener_region_del(iova, end - 1); ret = vfio_dma_unmap(container, iova, end - iova); memory_region_unref(section->mr); if (ret) { error_report("vfio_dma_unmap(%p, 0x%"HWADDR_PRIx", " "0x%"HWADDR_PRIx") = %d (%m)", container, iova, end - iova, ret); } } const MemoryListener vfio_memory_listener = { .region_add = vfio_listener_region_add, .region_del = vfio_listener_region_del, }; void vfio_listener_release(VFIOContainer *container) { memory_listener_unregister(&container->iommu_data.type1.listener); } int vfio_mmap_region(Object *obj, VFIORegion *region, MemoryRegion *mem, MemoryRegion *submem, void **map, size_t size, off_t offset, const char *name) { int ret = 0; VFIODevice *vbasedev = region->vbasedev; if (VFIO_ALLOW_MMAP && size && region->flags & VFIO_REGION_INFO_FLAG_MMAP) { int prot = 0; if (region->flags & VFIO_REGION_INFO_FLAG_READ) { prot |= PROT_READ; } if (region->flags & VFIO_REGION_INFO_FLAG_WRITE) { prot |= PROT_WRITE; } *map = mmap(NULL, size, prot, MAP_SHARED, vbasedev->fd, region->fd_offset + offset); if (*map == MAP_FAILED) { *map = NULL; ret = -errno; goto empty_region; } memory_region_init_ram_ptr(submem, obj, name, size, *map); memory_region_set_skip_dump(submem); } else { empty_region: /* Create a zero sized sub-region to make cleanup easy. */ memory_region_init(submem, obj, name, 0); } memory_region_add_subregion(mem, offset, submem); return ret; } void vfio_reset_handler(void *opaque) { VFIOGroup *group; VFIODevice *vbasedev; QLIST_FOREACH(group, &vfio_group_list, next) { QLIST_FOREACH(vbasedev, &group->device_list, next) { vbasedev->ops->vfio_compute_needs_reset(vbasedev); } } QLIST_FOREACH(group, &vfio_group_list, next) { QLIST_FOREACH(vbasedev, &group->device_list, next) { if (vbasedev->needs_reset) { vbasedev->ops->vfio_hot_reset_multi(vbasedev); } } } } static void vfio_kvm_device_add_group(VFIOGroup *group) { #ifdef CONFIG_KVM struct kvm_device_attr attr = { .group = KVM_DEV_VFIO_GROUP, .attr = KVM_DEV_VFIO_GROUP_ADD, .addr = (uint64_t)(unsigned long)&group->fd, }; if (!kvm_enabled()) { return; } if (vfio_kvm_device_fd < 0) { struct kvm_create_device cd = { .type = KVM_DEV_TYPE_VFIO, }; if (kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd)) { error_report("Failed to create KVM VFIO device: %m\n"); return; } vfio_kvm_device_fd = cd.fd; } if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) { error_report("Failed to add group %d to KVM VFIO device: %m", group->groupid); } #endif } static void vfio_kvm_device_del_group(VFIOGroup *group) { #ifdef CONFIG_KVM struct kvm_device_attr attr = { .group = KVM_DEV_VFIO_GROUP, .attr = KVM_DEV_VFIO_GROUP_DEL, .addr = (uint64_t)(unsigned long)&group->fd, }; if (vfio_kvm_device_fd < 0) { return; } if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) { error_report("Failed to remove group %d from KVM VFIO device: %m", group->groupid); } #endif } static VFIOAddressSpace *vfio_get_address_space(AddressSpace *as) { VFIOAddressSpace *space; QLIST_FOREACH(space, &vfio_address_spaces, list) { if (space->as == as) { return space; } } /* No suitable VFIOAddressSpace, create a new one */ space = g_malloc0(sizeof(*space)); space->as = as; QLIST_INIT(&space->containers); QLIST_INSERT_HEAD(&vfio_address_spaces, space, list); return space; } static void vfio_put_address_space(VFIOAddressSpace *space) { if (QLIST_EMPTY(&space->containers)) { QLIST_REMOVE(space, list); g_free(space); } } static int vfio_connect_container(VFIOGroup *group, AddressSpace *as) { VFIOContainer *container; int ret, fd; VFIOAddressSpace *space; space = vfio_get_address_space(as); QLIST_FOREACH(container, &space->containers, next) { if (!ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &container->fd)) { group->container = container; QLIST_INSERT_HEAD(&container->group_list, group, container_next); return 0; } } fd = qemu_open("/dev/vfio/vfio", O_RDWR); if (fd < 0) { error_report("vfio: failed to open /dev/vfio/vfio: %m"); ret = -errno; goto put_space_exit; } ret = ioctl(fd, VFIO_GET_API_VERSION); if (ret != VFIO_API_VERSION) { error_report("vfio: supported vfio version: %d, " "reported version: %d", VFIO_API_VERSION, ret); ret = -EINVAL; goto close_fd_exit; } container = g_malloc0(sizeof(*container)); container->space = space; container->fd = fd; if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU)) { ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd); if (ret) { error_report("vfio: failed to set group container: %m"); ret = -errno; goto free_container_exit; } ret = ioctl(fd, VFIO_SET_IOMMU, VFIO_TYPE1_IOMMU); if (ret) { error_report("vfio: failed to set iommu for container: %m"); ret = -errno; goto free_container_exit; } container->iommu_data.type1.listener = vfio_memory_listener; container->iommu_data.release = vfio_listener_release; memory_listener_register(&container->iommu_data.type1.listener, container->space->as); if (container->iommu_data.type1.error) { ret = container->iommu_data.type1.error; error_report("vfio: memory listener initialization failed for container"); goto listener_release_exit; } container->iommu_data.type1.initialized = true; } else if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU)) { ret = ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &fd); if (ret) { error_report("vfio: failed to set group container: %m"); ret = -errno; goto free_container_exit; } ret = ioctl(fd, VFIO_SET_IOMMU, VFIO_SPAPR_TCE_IOMMU); if (ret) { error_report("vfio: failed to set iommu for container: %m"); ret = -errno; goto free_container_exit; } /* * The host kernel code implementing VFIO_IOMMU_DISABLE is called * when container fd is closed so we do not call it explicitly * in this file. */ ret = ioctl(fd, VFIO_IOMMU_ENABLE); if (ret) { error_report("vfio: failed to enable container: %m"); ret = -errno; goto free_container_exit; } container->iommu_data.type1.listener = vfio_memory_listener; container->iommu_data.release = vfio_listener_release; memory_listener_register(&container->iommu_data.type1.listener, container->space->as); } else { error_report("vfio: No available IOMMU models"); ret = -EINVAL; goto free_container_exit; } QLIST_INIT(&container->group_list); QLIST_INSERT_HEAD(&space->containers, container, next); group->container = container; QLIST_INSERT_HEAD(&container->group_list, group, container_next); return 0; listener_release_exit: vfio_listener_release(container); free_container_exit: g_free(container); close_fd_exit: close(fd); put_space_exit: vfio_put_address_space(space); return ret; } static void vfio_disconnect_container(VFIOGroup *group) { VFIOContainer *container = group->container; if (ioctl(group->fd, VFIO_GROUP_UNSET_CONTAINER, &container->fd)) { error_report("vfio: error disconnecting group %d from container", group->groupid); } QLIST_REMOVE(group, container_next); group->container = NULL; if (QLIST_EMPTY(&container->group_list)) { VFIOAddressSpace *space = container->space; if (container->iommu_data.release) { container->iommu_data.release(container); } QLIST_REMOVE(container, next); trace_vfio_disconnect_container(container->fd); close(container->fd); g_free(container); vfio_put_address_space(space); } } VFIOGroup *vfio_get_group(int groupid, AddressSpace *as) { VFIOGroup *group; char path[32]; struct vfio_group_status status = { .argsz = sizeof(status) }; QLIST_FOREACH(group, &vfio_group_list, next) { if (group->groupid == groupid) { /* Found it. Now is it already in the right context? */ if (group->container->space->as == as) { return group; } else { error_report("vfio: group %d used in multiple address spaces", group->groupid); return NULL; } } } group = g_malloc0(sizeof(*group)); snprintf(path, sizeof(path), "/dev/vfio/%d", groupid); group->fd = qemu_open(path, O_RDWR); if (group->fd < 0) { error_report("vfio: error opening %s: %m", path); goto free_group_exit; } if (ioctl(group->fd, VFIO_GROUP_GET_STATUS, &status)) { error_report("vfio: error getting group status: %m"); goto close_fd_exit; } if (!(status.flags & VFIO_GROUP_FLAGS_VIABLE)) { error_report("vfio: error, group %d is not viable, please ensure " "all devices within the iommu_group are bound to their " "vfio bus driver.", groupid); goto close_fd_exit; } group->groupid = groupid; QLIST_INIT(&group->device_list); if (vfio_connect_container(group, as)) { error_report("vfio: failed to setup container for group %d", groupid); goto close_fd_exit; } if (QLIST_EMPTY(&vfio_group_list)) { qemu_register_reset(vfio_reset_handler, NULL); } QLIST_INSERT_HEAD(&vfio_group_list, group, next); vfio_kvm_device_add_group(group); return group; close_fd_exit: close(group->fd); free_group_exit: g_free(group); return NULL; } void vfio_put_group(VFIOGroup *group) { if (!QLIST_EMPTY(&group->device_list)) { return; } vfio_kvm_device_del_group(group); vfio_disconnect_container(group); QLIST_REMOVE(group, next); trace_vfio_put_group(group->fd); close(group->fd); g_free(group); if (QLIST_EMPTY(&vfio_group_list)) { qemu_unregister_reset(vfio_reset_handler, NULL); } } int vfio_get_device(VFIOGroup *group, const char *name, VFIODevice *vbasedev) { struct vfio_device_info dev_info = { .argsz = sizeof(dev_info) }; int ret; ret = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, name); if (ret < 0) { error_report("vfio: error getting device %s from group %d: %m", name, group->groupid); error_printf("Verify all devices in group %d are bound to vfio-<bus> " "or pci-stub and not already in use\n", group->groupid); return ret; } vbasedev->fd = ret; vbasedev->group = group; QLIST_INSERT_HEAD(&group->device_list, vbasedev, next); ret = ioctl(vbasedev->fd, VFIO_DEVICE_GET_INFO, &dev_info); if (ret) { error_report("vfio: error getting device info: %m"); goto error; } vbasedev->num_irqs = dev_info.num_irqs; vbasedev->num_regions = dev_info.num_regions; vbasedev->flags = dev_info.flags; trace_vfio_get_device(name, dev_info.flags, dev_info.num_regions, dev_info.num_irqs); vbasedev->reset_works = !!(dev_info.flags & VFIO_DEVICE_FLAGS_RESET); ret = vbasedev->ops->vfio_populate_device(vbasedev); error: if (ret) { vfio_put_base_device(vbasedev); } return ret; } void vfio_put_base_device(VFIODevice *vbasedev) { QLIST_REMOVE(vbasedev, next); vbasedev->group = NULL; trace_vfio_put_base_device(vbasedev->fd); close(vbasedev->fd); } static int vfio_container_do_ioctl(AddressSpace *as, int32_t groupid, int req, void *param) { VFIOGroup *group; VFIOContainer *container; int ret = -1; group = vfio_get_group(groupid, as); if (!group) { error_report("vfio: group %d not registered", groupid); return ret; } container = group->container; if (group->container) { ret = ioctl(container->fd, req, param); if (ret < 0) { error_report("vfio: failed to ioctl container: ret=%d, %s", ret, strerror(errno)); } } vfio_put_group(group); return ret; } int vfio_container_ioctl(AddressSpace *as, int32_t groupid, int req, void *param) { /* We allow only certain ioctls to the container */ switch (req) { case VFIO_CHECK_EXTENSION: case VFIO_IOMMU_SPAPR_TCE_GET_INFO: break; default: /* Return an error on unknown requests */ error_report("vfio: unsupported ioctl %X", req); return -1; } return vfio_container_do_ioctl(as, groupid, req, param); }
zhuguihua/qemu
hw/vfio/common.c
C
gpl-2.0
29,029
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>ACIS configuration / ACIS documentation</title> <link rel="stylesheet" href="style.css"> </head> <body> <h1 id="idp662240">ACIS configuration</h1> <h3><i>Table of contents</i></h3> <p class="toc">   <a href="#mainconf">The <code class="C">main.conf</code> file</a><br>   <a href="#idp666000">Parameters</a><br>      <a href="#idp666400">Core</a><br>      <a href="#idp689408">Perl</a><br>      <a href="#idp699792">Database parameters</a><br>      <a href="#idp706608">Data input (primary metadata: research, institutions, citations, etc.)</a><br>      <a href="#idp717360">Data output (personal data and submitted institutions)</a><br>      <a href="#conf-research">Research profile</a><br>         <a href="#conf-fuzzy">Fuzzy search</a><br>      <a href="#apu-conf">APU</a><br>      <a href="#cit-screen-conf">Citations screens</a><br>      <a href="#idp768048">Logging, debugging and performance profiling</a><br>      <a href="#idp778576">Other</a><br>   <a href="#binsetup">Updating a running system's configuration -- <code class="C">bin/setup</code> utility</a><br></p> <h2 id="mainconf" C="main.conf">The <code class="C">main.conf</code> file</h2> <p>The primary configuration file of an ACIS installation is <code>main.conf</code>. This file is an AppConfig file, which means it has a simple parameter=value syntax, described in detail in <a href="http://search.cpan.org/~abw/AppConfig/lib/AppConfig.pm">AppConfig manpage</a>. There is an example of such file in <a class="f" href="internal.html#mainconfeg">main.conf.eg</a> in ACIS home directory.</p> <h2 id="idp666000">Parameters</h2> <h3 id="idp666400">Core</h3> <dl> <dt id="site-name" C="site-name"><code class="C">site-name</code></dt> <dd> Short name of your website. Will be used in generated page titles as a prefix, in emails as [part] of subject lines. The parameter is required. </dd> <dt id="site-name-long" C="site-name-long"><code class="C">site-name-long</code></dt> <dd> Full name of the website. Will be shown at the top of each page and used in emails to refer back to the service. Required. </dd> <dt id="admin-email" C="admin-email"><code class="C">admin-email</code></dt> <dd>Email address of the site administrator, i.e. yourself. Required.</dd> <dt id="base-url" C="base-url"><code class="C">base-url</code></dt> <dd>URL of the ACIS CGI script. If you want ACIS to respond at the top-level URL of your website, set this to something like <code>http://web.site.org</code>. But then you need to configure your web server accordingly. <a href="apache-conf.html#acis-site-top">How to do that in Apache.</a> Do not put a trailing slash into this value. If you get this value wrong, ACIS will not correctly interpret users' requests. Required.</dd> <dt id="base-cgi-script-filename" C="base-cgi-script-filename"><code class="C">base-cgi-script-filename</code></dt> <dd>Filename of the CGI script, which ACIS creates and which is accessible through the <a class="c" href="conf.html#base-url">base-url</a> URL. </dd> <dt id="base-fcgi-script-filename" C="base-fcgi-script-filename"><code class="C">base-fcgi-script-filename</code></dt> <dd>Filename of the FCGI script, which ACIS creates and which is accessible through the <a class="c" href="conf.html#base-url">base-url</a> URL. Required</dd> <dt id="home-url" C="home-url"><code class="C">home-url</code></dt> <dd>URL of the public homepage of the service. Value of <a class="c" href="conf.html#site-name-long">site-name-long</a>, displayed on each page will link to it. May be the same as base-url or different. Required.</dd> <dt id="static-base-url" C="static-base-url"><code class="C">static-base-url</code></dt> <dd>URL of web-accessible directory for ACIS to store its static web-accessible files. ACIS will use it for JavaScript and CSS files, personal profile pages, et cetera. It may be the same as <a class="c" href="conf.html#base-url">base-url</a>, but you'll need to configure your webserver accordingly. It has to serve static files by itself, and call ACIS for everything else. Required.</dd> <dt id="static-base-dir" C="static-base-dir"><code class="C">static-base-dir</code></dt> <dd>Path to the directory, corresponding to the <a class="c" href="conf.html#static-base-url">static-base-url</a>. Required.</dd> <dt id="compact-redirected-profile-urls" C="compact-redirected-profile-urls"><code class="C">compact-redirected-profile-urls</code></dt> <dd>This either contains a true value (e.g. <code>1</code>) or false. Set to true if you want shorter personal profile URLs and <a href="apache-conf.html#redirect-profile-urls">have setup your webserver accordingly</a>. URL of a profile page is built as follows: <a class="c" href="conf.html#static-base-url">static-base-url</a> + <a class="c" href="conf.html#profile-pages-dir">profile-pages-dir</a> + profile's unique part + <code>"/"</code>. Profile's unique part is its short-id in slash-separated form: e.g. <code>"p/s/i/d/3"</code>. If you enable this option, this part will instead be just short-id, e.g. <code>"psid3"</code> and the whole URL will be shorter and cleaner. Default value: undef, i.e. false; </dd> <dt id="profile-pages-dir" C="profile-pages-dir"><code class="C">profile-pages-dir</code></dt> <dd>Prefix of the profile pages URLs. Terminate it with a slash. See previous item for an explanation. Default value: <code>"profile/"</code>.</dd> <dt id="session-lifetime" C="session-lifetime"><code class="C">session-lifetime</code></dt> <dd>For how many minutes a session lives without a user action, untill it expires. Default value: 15.</dd> <dt id="system-email" C="system-email"><code class="C">system-email</code></dt> <dd>Value for the "From:" header of email messages, that ACIS will send. Required.</dd> <dt id="sendmail" C="sendmail"><code class="C">sendmail</code></dt> <dd> A mail-sending program name. May be something like <code>/usr/sbin/sendmail -t</code> . Required.</dd> </dl> <h3 id="idp689408">Perl</h3> <dl> <dt id="perlbin" C="perlbin"><code class="C">perlbin</code></dt> <dd>Perl binary to use for ACIS and its utilities. Default: taken from <code>`which perl`</code> during <a class="c" href="conf.html#binsetup">bin/setup</a>.</dd> <dt id="perllibprepend" C="perllibprepend"><code class="C">perllibprepend</code></dt> <dd>Type: string. Additional directory for Perl libraries. This option prepends a Perl library directory <i>directory</i> into the main CGI file <code>a.cgi</code>. It should be used to instruct perl about where to look for modules (in addition to standard perl library directories). See also: <code>@INC</code> entry in the <a href="http://perldoc.perl.org/perlvar.html">perlvar</a> manpage and the <a href="http://perldoc.perl.org/functions/require.html"> require function</a> manpage. </dd> <dt id="perllibadd" C="perllibadd"><code class="C">perllibadd</code></dt> <dd>Type: string. Additional directory for Perl libraries. This option appends a Perl library directory <i>directory</i> into the main CGI file <code>a.cgi</code>, by saying <code>BEGIN{ push @INC, '</code><i>directory</i><code>'; }</code>. </dd> <dt id="known-valid-proxies" C="known-valid-proxies"><code class="C">known-valid-proxies</code></dt> <dd>A list of known proxies, whose addresses should be considered source of the request IPs, when logging and otherwise using request IP. Format: comma-separated list of numerical IP addresses. </dd> </dl> <h3 id="idp699792">Database parameters</h3> <dl> <dt id="db-name" C="db-name"><code class="C">db-name</code></dt> <dd>Name of a MySQL database that ACIS and its components will use to store its own data. Required.</dd> <dt id="db-user" C="db-user"><code class="C">db-user</code></dt> <dd>Name of the MySQL database user to use when connecting to MySQL server. Required. </dd> <dt id="db-pass" C="db-pass"><code class="C">db-pass</code></dt> <dd>Password to use when connecting to MySQL server. Required.</dd> <dt id="acis-db-name" C="acis-db-name"><code class="C">acis-db-name</code></dt> <dt id="sid-db-name" C="sid-db-name"><code class="C">sid-db-name</code></dt> <dt id="metadata-db-name" C="metadata-db-name"><code class="C">metadata-db-name</code></dt> <dd>All three are deprecated parameters replaced by the single <a class="c" href="conf.html#db-name">db-name</a>. They were used to specify MySQL database names for specific compontents of ACIS. Certain database tables would then go to "acis" database, some to "sid" database and the rest to the "metadata" database. Should not be used in new acis installations.</dd> </dl> <h3 id="idp706608">Data input (primary metadata: research, institutions, citations, etc.)</h3> <dl> <dt id="metadata-collections" C="metadata-collections"><code class="C">metadata-collections</code></dt> <dd>Additional metadata collections to monitor and process with the RI daemon. The variable contains space-delimited collection identifiers for ACIS to process. Each collection must be further defined with a pair of corresponding <a class="c" href="conf.html#metadata--home">metadata-<i>X</i>-home</a> and <a class="c" href="conf.html#metadata--type">metadata-<i>X</i>-type</a> parameters, where <i>X</i> is the identifier. The identifiers must be unique. Optional.</dd> <dt id="metadata--type" C="metadata-"><code class="C">metadata-<i>X</i>-type</code></dt> <dd>Type of data collection <i>X</i>. Useful possible values: "<code>RePEcRec</code>", "<code>AMF</code>", "<code>CitationsAMF</code>" (for <a href="citations.html">citations</a> data) and "<code>FullTextUrlsAMF</code>" (for <a href="researchprofile.html#fturls">full-text URLs</a> data).</dd> <dt id="metadata--home" C="metadata-"><code class="C">metadata-<i>X</i>-home</code></dt> <dd>Directory where the files of collection <i>X</i> are.</dd> </dl> <h3 id="idp717360">Data output (personal data and submitted institutions)</h3> <dl> <dt id="person-id-prefix" C="person-id-prefix"><code class="C">person-id-prefix</code></dt> <dd>Prefix to the generated personal record identifiers (not short-ids, if you care). Required.</dd> <dt id="metadata-redif-output-dir" C="metadata-redif-output-dir"><code class="C">metadata-redif-output-dir</code></dt> <dd>Directory to put generated ReDIF files into. Optional. </dd> <dt id="metadata-amf-output-dir" C="metadata-amf-output-dir"><code class="C">metadata-amf-output-dir</code></dt> <dd>Directory to put generated AMF files into. Optional. </dd> <dt id="institutions-maintainer-email" C="institutions-maintainer-email"><code class="C">institutions-maintainer-email</code></dt> <dd>Email address of the person maintaining the institutions database. When users submit an institution's data, message will be sent to this address. Defaults to <a class="c" href="conf.html#admin-email">admin-email</a>, if not specified.</dd> </dl> <h3 id="conf-research">Research profile</h3> <p>See <a href="researchprofile.html">Research Profile</a> document.</p> <dl> <dt id="research-additional-searches" C="research-additional-searches"><code class="C">research-additional-searches</code></dt> <dd>Type: boolean. Whether or not to run additional, disk and CPU-consuming database queries as part of automatic research searches. They are not required as it is, but increase quality of search under certain conditions; sometimes they would find works for the users, which would not have been found otherwise. Default: off.</dd> <dt id="document-document-links-profile" C="document-document-links-profile"><code class="C">document-document-links-profile</code></dt> <dd>Enable <a href="researchprofile.html#doclinks">Document to document links</a> screen? Default: false.</dd> <dt id="full-text-urls-recognition" C="full-text-urls-recognition"><code class="C">full-text-urls-recognition</code></dt> <dd>Enable Full-Text URLs screen in research profile? Default: no.</dd> </dl> <h4 id="conf-fuzzy">Fuzzy search</h4> <p>See <a href="researchprofile.html#research-fuzzy">Fuzzy search</a> in research profile.</p> <dl> <dt id="fuzzy-name-search" C="fuzzy-name-search"><code class="C">fuzzy-name-search</code></dt> <dd>Type: Boolean. Run or not run fuzzy-matching during the research automatic searches? The value does not matter if <a class="c" href="conf.html#research-additional-searches">research-additional-searches</a> is false, fuzzy searches are a kind of additional searches. Default: no, do not run.</dd> <dt id="fuzzy-name-search-min-common-prefix" C="fuzzy-name-search-min-common-prefix"><code class="C">fuzzy-name-search-min-common-prefix</code></dt> <dd>The number of characters n of at the start of a name variation that has to match in the name expressions exactly. Default: 3.</dd> <dt id="fuzzy-name-search-min-variation-length" C="fuzzy-name-search-min-variation-length"><code class="C">fuzzy-name-search-min-variation-length</code></dt> <dd>The minimum number of characters m that a name variation would have to have in order to qualify for being fuzzy matched. The default is 7.</dd> <dt id="fuzzy-name-search-max-name-occurr-in-doc-names" C="fuzzy-name-search-max-name-occurr-in-doc-names"><code class="C">fuzzy-name-search-max-name-occurr-in-doc-names</code></dt> <dd>The maximum number of occurrences of a name expression in the document author names table before it is considered for fuzzy matching. The default is 1. If this parameter is set to 0 or is not set, no maximum is checked.</dd> <dt id="fuzzy-name-search-max-name-occurr-in-name-variations" C="fuzzy-name-search-max-name-occurr-in-name-variations"><code class="C">fuzzy-name-search-max-name-occurr-in-name-variations</code></dt> <dd>The maximum number of occurrences of a name expression in the name variations table before it is considered for fuzzy matching. By default, maximum is 0, ie. a name expression should not be present among name variations. Set is to -1 to disable this limit.</dd> <dt id="fuzzy-name-search-via-web" C="fuzzy-name-search-via-web"><code class="C">fuzzy-name-search-via-web</code></dt> <dd>Should fuzzy name searches be run when research search is initiated by the online user? (When a search is APU-initiated, this is a question of <a class="c" href="conf.html#fuzzy-name-search">fuzzy-name-search</a>.) Default: false. (This option requires enabled <a class="c" href="conf.html#fuzzy-name-search">fuzzy-name-search</a> and <a class="c" href="conf.html#research-additional-searches">research-additional-searches</a>.)</dd> </dl> <h3 id="apu-conf">APU</h3> <p>This is about <a href="apu.html">automatic profile update</a>.</p> <dl> <dt id="minimum-apu-period-days" C="minimum-apu-period-days"><code class="C">minimum-apu-period-days</code></dt> <dd>Type: integer number. This is the miminum number of days between APU runs for a single record. In other words, APU won't be run for a record, if last time APU has already been done for it less than that many days ago. Default: 21 (day). (More often than this may cause an overwhelming effect on some users in case of a growing database, if every time at APU something is found and every time an email is sent.)</dd> <dt id="echo-apu-mails" C="echo-apu-mails"><code class="C">echo-apu-mails</code></dt> <dd>Type: Boolean. Whether or not send a copy of all APU mails to the service admin. If set to true, admin's email will be added into the <code>BCC:</code> field. </dd> <dt id="apu-research-mail-include-approx-hits" C="apu-research-mail-include-approx-hits"><code class="C">apu-research-mail-include-approx-hits</code></dt> <dd>Type: Boolean. Include approximate (non-exact) matches into the ARPU mail? Default: no.</dd> <dt id="apu-research-max-suggestions-in-a-mail" C="apu-research-max-suggestions-in-a-mail"><code class="C">apu-research-max-suggestions-in-a-mail</code></dt> <dd>How many research items to list in an ARPU mail at most? Default: no limit.</dd> <dt id="apu-citations-auto-add-limit" C="apu-citations-auto-add-limit"><code class="C">apu-citations-auto-add-limit</code></dt> <dd>Add no more than this given amount of citations to a person profile in one APU go. Default: no limit.</dd> <dt id="disable-citation-mails" C="disable-citation-mails"><code class="C">disable-citation-mails</code></dt> <dd>Type: Boolean. Do not send APU-citation mails (even if changes have been done to a profile during APU).</dd> </dl> <h3 id="cit-screen-conf">Citations screens</h3> <p>This is for <a href="citations.html">citations features</a>.</p> <dl> <dt id="citations-profile" C="citations-profile"><code class="C">citations-profile</code></dt> <dd>To show the citation profile to the users or not? Boolean value. Default: false.</dd> <dt id="citation-document-similarity-func" C="citation-document-similarity-func"><code class="C">citation-document-similarity-func</code></dt> <dd> <p>The parameter specifies a Perl function which ACIS will call internally. The function will be called for assessing similarity between a citation string and a document record and must conform to the <a href="citations.html#cit-doc-similarity-pi">Citation-document similarity assessment interface</a>.</p> <p>The function must accept two parameters on input and return a numerical value between 0 (no similarity) and 1 (a perfect match) inclusive.</p> <p>The default value for this parameter provides a function, documented in section <a href="citations.html#similarity-default-func">Default citation-document similarity assessment algorithm</a>.</p> </dd> <dt id="citation-document-similarity-useful-threshold" C="citation-document-similarity-useful-threshold"><code class="C">citation-document-similarity-useful-threshold</code></dt> <dd> <p>Citations, which have similarity value less than this threshold, won't even be suggested for user's consideration as potential.</p> <p>Default value: 0.65</p> </dd> <dt id="citation-document-similarity-preselect-threshold" C="citation-document-similarity-preselect-threshold"><code class="C">citation-document-similarity-preselect-threshold</code></dt> <dd> <p>Citations, which have similarity value higher or equal than this threshold, will be offered as pre-selected by default (for a specific document).</p> <p>Default value: 0.85</p> </dd> <dt id="citation-document-similarity-ttl" C="citation-document-similarity-ttl"><code class="C">citation-document-similarity-ttl</code></dt> <dd> <p>Time-to-live for calculated similarity values in days. After a similarity value is calculated by the similarity function, the value is stored in the database. After time-to-live days pass since the original calculation took place, this value will be considered expired and will be re-calculated with then-current similarity function.</p> <p>Default value: 100</p> </dd> <dt id="citations-max-online-comparisons" C="citations-max-online-comparisons"><code class="C">citations-max-online-comparisons</code></dt> <dd> <p>A limit on the number of computationally expensive citation-document comparisons to run for a online user. This is to avoid putting a big load on a running system, and thus making it unresponsive to user. Depending on the machine performance and the number of users, setting it to something like 400 may be a good idea.</p> <p>Default: undefined, i.e. no limit.</p> </dd> <dt id="citation-presentation-reverse" C="citation-presentation-reverse"><code class="C">citation-presentation-reverse</code></dt> <dd> <p>On the potential citations screen, show HOW the work is cited first, and WHERE it is cited second. For example: "as: ...(citation string) in: ...(work title) by ... (authors)". This may make looking through a large list of citations easier for the user.</p> <p>Default: off. So by default each citation is presented this way: "in: ... by ..." on the first line, and "as: ..." on the second.</p> </dd> <dt id="citations-by-document-search-at-profile-load" C="citations-by-document-search-at-profile-load"><code class="C">citations-by-document-search-at-profile-load</code></dt> <dd><p>Boolean. If true, enables one additional online search. When user first enters into citation profile (in a session), immediately execute a search for citations by his document ids. Default: false.</p></dd> <dt id="citations-do-not-store-useless-similarity" C="citations-do-not-store-useless-similarity"><code class="C">citations-do-not-store-useless-similarity</code></dt> <dd> <p>Boolean. When ACIS runs a citation-document comparison, it usually (by default) stores its value in the database. (In the cit_doc_similarity table.) Later these comparison results may be reused. If this parameter is set to a true value, then only those comparisons which resulted in a usefully-high similarity value would have their result stored in the database.</p> <p>This is a way to trade performance for database size (i.e. disk space). Default: false.</p> </dd> </dl> <h3 id="idp768048">Logging, debugging and performance profiling</h3> <dl> <dt id="debug-info-visible" C="debug-info-visible"><code class="C">debug-info-visible</code></dt> <dd>Whether or not to append debuging info to each generated web page. Do not enable this on production systems: it can be used by hackers to gain knowledge of the internal site configuration, which is not a safe thing. Also, makes pages much bigger and system slower. Default: undef, ie. feature is off.</dd> <dt id="debug-log" C="debug-log"><code class="C">debug-log</code></dt> <dd>When specified to a writeable file name, each ACIS request's processing will be debug-logged to this file. Verbose. Default: undef, ie. the feature is off.</dd> <dt id="extreme-debug" C="extreme-debug"><code class="C">extreme-debug</code></dt> <dd>Enables printing of the internal debugging messages on every web page immediately, as ACIS processes a request. Default: undef, ie. feature is off.</dd> <dt id="debug-transformations" C="debug-transformations"><code class="C">debug-transformations</code></dt> <dd>ACIS uses XSLT stylesheets to produce HTML pages (and email messages). For each request ACIS generates an XML document and then pipes it to the appropriate XSLT stylesheet. When this option is enabled, ACIS will save intermediate XML file into <code>{HOME}/presenter_data.xml</code> and the XSLT result into <code>{HOME}/presenter_result.xml</code>. If the files exist, ACIS will overwrite it silently, so at any given time these files will contain only the last request' data. This option might be helpful for debugging the XSLT stylesheets. Default: undef, ie. feature is off.</dd> <dt id="log-profiling-data" C="log-profiling-data"><code class="C">log-profiling-data</code></dt> <dd>Boolean parameter. Enables logging of system profiling data to the <code class="f BROKEN">{HOME}/profiling.log</code>. Default: off.</dd> <dt id="show-profiling-data" C="show-profiling-data"><code class="C">show-profiling-data</code></dt> <dd>Boolean parameter. Enables display of system profiling data (timings) at the end of each page. Default: off.</dd> <dt id="requests-log" C="requests-log"><code class="C">requests-log</code></dt> <dd>Name of file to log every incoming request to. Defaults to string <code>"*stderr*"</code> which means "log to standard error output filehandle". Usually, Apache redirects stderr output of CGI scripts to the error log of the website.</dd> </dl> <h3 id="idp778576">Other</h3> <dl> <dt id="template-set" C="template-set"><code class="C">template-set</code></dt> <dd>Name of a set of XSLT presentation files to use. A set of XSLT presentation files is a directory, path, relative to <code>{HOME}/presentation/</code> directory. Default value: "<code>default</code>". So by default XSLT templates are read from <code>{HOME}/presentation/default/</code>. </dd> <dt id="presenters-dir" C="presenters-dir"><code class="C">presenters-dir</code></dt> <dd>Specifies a path, where to search for XSLT templates and some other related files. Overrides <a class="c" href="conf.html#template-set">template-set</a> if defined. Default: XSLT templates are read from <code>{HOME}/presentation/default/</code>.</dd> <dt id="umask" C="umask"><code class="C">umask</code></dt> <dd>The umask to use when creating files and directories. This value directly influences the access permissions of the created files. Read perl's <code>perldoc -f umask</code> and/or Unix' <code>man umask</code>. Optional.</dd> <dt id="require-modules" C="require-modules"><code class="C">require-modules</code></dt> <dd>List of perl modules or simply ".pl" files to load (<code>require</code>) upon system start. Whitespace separated.</dd> <dt id="backup-directory" C="backup-directory"><code class="C">backup-directory</code></dt> <dd>Type: string. Path to a directory for <a class="c" href="adm.html#binbackup_tables">bin/backup_tables</a> to put its backups into. Must exist at the time <a class="c" href="adm.html#binbackup_tables">bin/backup_tables</a> is run. </dd> </dl> <h2 id="binsetup" C="bin/setup">Updating a running system's configuration -- <code class="C">bin/setup</code> utility</h2> <p><a class="c" href="conf.html#mainconf">main.conf</a> file is the main ACIS configuration file. Yet it is not directly read by ACIS and any of its' components during normal operation. Instead they read their own separate configuration files. For instance, <code>ardb.conf</code>, <code>acis.conf</code>, <code>RI/collections</code>, <code>thisconf.sh</code>, et cetera.</p> <p>All these files are created and updated from <a class="c" href="conf.html#mainconf">main.conf</a>'s contents by the <code>bin/setup</code> utility.</p> <p><code>bin/setup</code> reads <a class="c" href="conf.html#mainconf">main.conf</a> and generates other necessary files. You need to run it every time after changing <a class="c" href="conf.html#mainconf">main.conf</a> to make configuration changes get reflected in the installation. You may also need to restart the <a href="daemon.html#ri-daemon">daemon program</a> so that it is aware of the changes you made.</p> <p>About the other utilities read the <a href="adm.html#utils">respective section</a> in the <a href="adm.html">administrator's guide</a>.</p> <address class="footer"> <p>Generated: Fri May 2 18:03:53 2014</p> <p><a href="http://acis.openlib.org/">ACIS project</a>, acis<i>@</i>openlib<span>.org</span></p> </address> </body> </html>
kurmanka/acis.r
doc/conf.html
HTML
gpl-2.0
26,688
//----------------------------------------------------------------- // Background Object // C++ Source - Background.cpp //----------------------------------------------------------------- //----------------------------------------------------------------- // Include Files //----------------------------------------------------------------- #include "Background.h" //----------------------------------------------------------------- // Background Constructor(s)/Destructor //----------------------------------------------------------------- Background::Background(int iWidth, int iHeight, COLORREF crColor) { // Initialize the member variables m_iWidth = iWidth; m_iHeight = iHeight; m_crColor = crColor; m_pBitmap = NULL; } Background::Background(Bitmap* pBitmap) { // Initialize the member variables m_crColor = 0; m_pBitmap = pBitmap; m_iWidth = pBitmap->GetWidth(); m_iHeight = pBitmap->GetHeight(); } Background::~Background() { } //----------------------------------------------------------------- // Background General Methods //----------------------------------------------------------------- void Background::Update() { // Do nothing since the basic background is not animated } void Background::Draw(HDC hDC) { // Draw the background if (m_pBitmap != NULL) m_pBitmap->Draw(hDC, 0, 0); else { RECT rect = { 0, 0, m_iWidth, m_iHeight }; HBRUSH hBrush = CreateSolidBrush(m_crColor); FillRect(hDC, &rect, hBrush); DeleteObject(hBrush); } } //----------------------------------------------------------------- // StarryBackground Constructor //----------------------------------------------------------------- StarryBackground::StarryBackground(int iWidth, int iHeight, int iNumStars, int iTwinkleDelay) : Background(iWidth, iHeight, 0) { // Initialize the member variables m_iNumStars = min(iNumStars, 100); m_iTwinkleDelay = iTwinkleDelay; // Create the stars for (int i = 0; i < iNumStars; i++) { m_ptStars[i].x = rand() % iWidth; m_ptStars[i].y = rand() % iHeight; m_crStarColors[i] = RGB(128, 128, 128); } } StarryBackground::~StarryBackground() { } //----------------------------------------------------------------- // StarryBackground General Methods //----------------------------------------------------------------- void StarryBackground::Update() { // Randomly change the shade of the stars so that they twinkle int iRGB; for (int i = 0; i < m_iNumStars; i++) if ((rand() % m_iTwinkleDelay) == 0) { iRGB = rand() % 256; m_crStarColors[i] = RGB(iRGB, iRGB, iRGB); } } void StarryBackground::Draw(HDC hDC) { // Draw the solid black background RECT rect = { 0, 0, m_iWidth, m_iHeight }; HBRUSH hBrush = CreateSolidBrush(RGB(0, 0, 0)); FillRect(hDC, &rect, hBrush); DeleteObject(hBrush); // Draw the stars for (int i = 0; i < m_iNumStars; i++) SetPixel(hDC, m_ptStars[i].x, m_ptStars[i].y, m_crStarColors[i]); }
illuz/SmallRPG
SmallRPG/Background.cpp
C++
gpl-2.0
3,016
/* * USB Serial Converter driver * * Copyright (C) 2009 - 2013 Johan Hovold (jhovold@gmail.com) * Copyright (C) 1999 - 2012 Greg Kroah-Hartman (greg@kroah.com) * Copyright (C) 2000 Peter Berger (pberger@brimson.com) * Copyright (C) 2000 Al Borchers (borchers@steinerpoint.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 as published by the Free Software Foundation. * * This driver was originally based on the ACM driver by Armin Fuerst (which was * based on a driver by Brad Keryan) * * See Documentation/usb/usb-serial.txt for more information on using this * driver */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/tty.h> #include <linux/tty_driver.h> #include <linux/tty_flip.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/seq_file.h> #include <linux/spinlock.h> #include <linux/mutex.h> #include <linux/list.h> #include <linux/uaccess.h> #include <linux/serial.h> #include <linux/usb.h> #include <linux/usb/serial.h> #include <linux/kfifo.h> #include <linux/idr.h> #include "pl2303.h" #define DRIVER_AUTHOR "Greg Kroah-Hartman <gregkh@linuxfoundation.org>" #define DRIVER_DESC "USB Serial Driver core" #define USB_SERIAL_TTY_MAJOR 188 #define USB_SERIAL_TTY_MINORS 512 /* should be enough for a while */ /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead the MODULE_DEVICE_TABLE declarations in each serial driver cause the "hotplug" program to pull in whatever module is necessary via modprobe, and modprobe will load usbserial because the serial drivers depend on it. */ static DEFINE_IDR(serial_minors); static DEFINE_MUTEX(table_lock); static LIST_HEAD(usb_serial_driver_list); /* * Look up the serial port structure. If it is found and it hasn't been * disconnected, return with the parent usb_serial structure's disc_mutex held * and its refcount incremented. Otherwise return NULL. */ struct usb_serial_port *usb_serial_port_get_by_minor(unsigned minor) { struct usb_serial *serial; struct usb_serial_port *port; mutex_lock(&table_lock); port = idr_find(&serial_minors, minor); if (!port) goto exit; serial = port->serial; mutex_lock(&serial->disc_mutex); if (serial->disconnected) { mutex_unlock(&serial->disc_mutex); port = NULL; } else { kref_get(&serial->kref); } exit: mutex_unlock(&table_lock); return port; } static int allocate_minors(struct usb_serial *serial, int num_ports) { struct usb_serial_port *port; unsigned int i, j; int minor; dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports); mutex_lock(&table_lock); for (i = 0; i < num_ports; ++i) { port = serial->port[i]; minor = idr_alloc(&serial_minors, port, 0, 0, GFP_KERNEL); if (minor < 0) goto error; port->minor = minor; port->port_number = i; } serial->minors_reserved = 1; mutex_unlock(&table_lock); return 0; error: /* unwind the already allocated minors */ for (j = 0; j < i; ++j) idr_remove(&serial_minors, serial->port[j]->minor); mutex_unlock(&table_lock); return minor; } static void release_minors(struct usb_serial *serial) { int i; mutex_lock(&table_lock); for (i = 0; i < serial->num_ports; ++i) idr_remove(&serial_minors, serial->port[i]->minor); mutex_unlock(&table_lock); serial->minors_reserved = 0; } static void destroy_serial(struct kref *kref) { struct usb_serial *serial; struct usb_serial_port *port; int i; serial = to_usb_serial(kref); /* return the minor range that this device had */ if (serial->minors_reserved) release_minors(serial); if (serial->attached && serial->type->release) serial->type->release(serial); /* Now that nothing is using the ports, they can be freed */ for (i = 0; i < serial->num_port_pointers; ++i) { port = serial->port[i]; if (port) { port->serial = NULL; put_device(&port->dev); } } usb_put_intf(serial->interface); usb_put_dev(serial->dev); kfree(serial); } void usb_serial_put(struct usb_serial *serial) { kref_put(&serial->kref, destroy_serial); } /***************************************************************************** * Driver tty interface functions *****************************************************************************/ /** * serial_install - install tty * @driver: the driver (USB in our case) * @tty: the tty being created * * Create the termios objects for this tty. We use the default * USB serial settings but permit them to be overridden by * serial->type->init_termios. * * This is the first place a new tty gets used. Hence this is where we * acquire references to the usb_serial structure and the driver module, * where we store a pointer to the port, and where we do an autoresume. * All these actions are reversed in serial_cleanup(). */ static int serial_install(struct tty_driver *driver, struct tty_struct *tty) { int idx = tty->index; struct usb_serial *serial; struct usb_serial_port *port; int retval = -ENODEV; port = usb_serial_port_get_by_minor(idx); if (!port) return retval; serial = port->serial; if (!try_module_get(serial->type->driver.owner)) goto error_module_get; retval = usb_autopm_get_interface(serial->interface); if (retval) goto error_get_interface; retval = tty_port_install(&port->port, driver, tty); if (retval) goto error_init_termios; mutex_unlock(&serial->disc_mutex); /* allow the driver to update the settings */ if (serial->type->init_termios) serial->type->init_termios(tty); tty->driver_data = port; return retval; error_init_termios: usb_autopm_put_interface(serial->interface); error_get_interface: module_put(serial->type->driver.owner); error_module_get: usb_serial_put(serial); mutex_unlock(&serial->disc_mutex); return retval; } static int serial_port_activate(struct tty_port *tport, struct tty_struct *tty) { struct usb_serial_port *port = container_of(tport, struct usb_serial_port, port); struct usb_serial *serial = port->serial; int retval; mutex_lock(&serial->disc_mutex); if (serial->disconnected) retval = -ENODEV; else retval = port->serial->type->open(tty, port); mutex_unlock(&serial->disc_mutex); if (retval < 0) retval = usb_translate_errors(retval); return retval; } static int serial_open(struct tty_struct *tty, struct file *filp) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); return tty_port_open(&port->port, tty, filp); } /** * serial_port_shutdown - shut down hardware * @tport: tty port to shut down * * Shut down a USB serial port. Serialized against activate by the * tport mutex and kept to matching open/close pairs * of calls by the ASYNCB_INITIALIZED flag. * * Not called if tty is console. */ static void serial_port_shutdown(struct tty_port *tport) { struct usb_serial_port *port = container_of(tport, struct usb_serial_port, port); struct usb_serial_driver *drv = port->serial->type; if (drv->close) drv->close(port); } static void serial_hangup(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); tty_port_hangup(&port->port); } static void serial_close(struct tty_struct *tty, struct file *filp) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); tty_port_close(&port->port, tty, filp); } /** * serial_cleanup - free resources post close/hangup * @port: port to free up * * Do the resource freeing and refcount dropping for the port. * Avoid freeing the console. * * Called asynchronously after the last tty kref is dropped. */ static void serial_cleanup(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct usb_serial *serial; struct module *owner; dev_dbg(tty->dev, "%s\n", __func__); /* The console is magical. Do not hang up the console hardware * or there will be tears. */ if (port->port.console) return; tty->driver_data = NULL; serial = port->serial; owner = serial->type->driver.owner; mutex_lock(&serial->disc_mutex); if (!serial->disconnected) usb_autopm_put_interface(serial->interface); mutex_unlock(&serial->disc_mutex); usb_serial_put(serial); module_put(owner); } static int serial_write(struct tty_struct *tty, const unsigned char *buf, int count) { struct usb_serial_port *port = tty->driver_data; int retval = -ENODEV; if (port->serial->dev->state == USB_STATE_NOTATTACHED) goto exit; dev_dbg(tty->dev, "%s - %d byte(s)\n", __func__, count); retval = port->serial->type->write(tty, port, buf, count); if (retval < 0) retval = usb_translate_errors(retval); exit: return retval; } static int serial_write_room(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); return port->serial->type->write_room(tty); } static int serial_chars_in_buffer(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct usb_serial *serial = port->serial; dev_dbg(tty->dev, "%s\n", __func__); if (serial->disconnected) return 0; return serial->type->chars_in_buffer(tty); } static void serial_wait_until_sent(struct tty_struct *tty, int timeout) { struct usb_serial_port *port = tty->driver_data; struct usb_serial *serial = port->serial; dev_dbg(tty->dev, "%s\n", __func__); if (!port->serial->type->wait_until_sent) return; mutex_lock(&serial->disc_mutex); if (!serial->disconnected) port->serial->type->wait_until_sent(tty, timeout); mutex_unlock(&serial->disc_mutex); } static void serial_throttle(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); if (port->serial->type->throttle) port->serial->type->throttle(tty); } static void serial_unthrottle(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); if (port->serial->type->unthrottle) port->serial->type->unthrottle(tty); } static int serial_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; int retval = -ENOIOCTLCMD; dev_dbg(tty->dev, "%s - cmd 0x%04x\n", __func__, cmd); switch (cmd) { case TIOCMIWAIT: if (port->serial->type->tiocmiwait) retval = port->serial->type->tiocmiwait(tty, arg); break; default: if (port->serial->type->ioctl) retval = port->serial->type->ioctl(tty, cmd, arg); } return retval; } static void serial_set_termios(struct tty_struct *tty, struct ktermios *old) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); if (port->serial->type->set_termios) port->serial->type->set_termios(tty, port, old); else tty_termios_copy_hw(&tty->termios, old); } static int serial_break(struct tty_struct *tty, int break_state) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); if (port->serial->type->break_ctl) port->serial->type->break_ctl(tty, break_state); return 0; } static int serial_proc_show(struct seq_file *m, void *v) { struct usb_serial *serial; struct usb_serial_port *port; int i; char tmp[40]; seq_puts(m, "usbserinfo:1.0 driver:2.0\n"); for (i = 0; i < USB_SERIAL_TTY_MINORS; ++i) { port = usb_serial_port_get_by_minor(i); if (port == NULL) continue; serial = port->serial; seq_printf(m, "%d:", i); if (serial->type->driver.owner) seq_printf(m, " module:%s", module_name(serial->type->driver.owner)); seq_printf(m, " name:\"%s\"", serial->type->description); seq_printf(m, " vendor:%04x product:%04x", le16_to_cpu(serial->dev->descriptor.idVendor), le16_to_cpu(serial->dev->descriptor.idProduct)); seq_printf(m, " num_ports:%d", serial->num_ports); seq_printf(m, " port:%d", port->port_number); usb_make_path(serial->dev, tmp, sizeof(tmp)); seq_printf(m, " path:%s", tmp); seq_putc(m, '\n'); usb_serial_put(serial); mutex_unlock(&serial->disc_mutex); } return 0; } static int serial_proc_open(struct inode *inode, struct file *file) { return single_open(file, serial_proc_show, NULL); } static const struct file_operations serial_proc_fops = { .owner = THIS_MODULE, .open = serial_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static int serial_tiocmget(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); if (port->serial->type->tiocmget) return port->serial->type->tiocmget(tty); return -EINVAL; } static int serial_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); if (port->serial->type->tiocmset) return port->serial->type->tiocmset(tty, set, clear); return -EINVAL; } static int serial_get_icount(struct tty_struct *tty, struct serial_icounter_struct *icount) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); if (port->serial->type->get_icount) return port->serial->type->get_icount(tty, icount); return -EINVAL; } /* * We would be calling tty_wakeup here, but unfortunately some line * disciplines have an annoying habit of calling tty->write from * the write wakeup callback (e.g. n_hdlc.c). */ void usb_serial_port_softint(struct usb_serial_port *port) { schedule_work(&port->work); } EXPORT_SYMBOL_GPL(usb_serial_port_softint); static void usb_serial_port_work(struct work_struct *work) { struct usb_serial_port *port = container_of(work, struct usb_serial_port, work); tty_port_tty_wakeup(&port->port); } static void usb_serial_port_poison_urbs(struct usb_serial_port *port) { int i; for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) usb_poison_urb(port->read_urbs[i]); for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) usb_poison_urb(port->write_urbs[i]); usb_poison_urb(port->interrupt_in_urb); usb_poison_urb(port->interrupt_out_urb); } static void usb_serial_port_unpoison_urbs(struct usb_serial_port *port) { int i; for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) usb_unpoison_urb(port->read_urbs[i]); for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) usb_unpoison_urb(port->write_urbs[i]); usb_unpoison_urb(port->interrupt_in_urb); usb_unpoison_urb(port->interrupt_out_urb); } static void usb_serial_port_release(struct device *dev) { struct usb_serial_port *port = to_usb_serial_port(dev); int i; dev_dbg(dev, "%s\n", __func__); usb_free_urb(port->interrupt_in_urb); usb_free_urb(port->interrupt_out_urb); for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) { usb_free_urb(port->read_urbs[i]); kfree(port->bulk_in_buffers[i]); } for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) { usb_free_urb(port->write_urbs[i]); kfree(port->bulk_out_buffers[i]); } kfifo_free(&port->write_fifo); kfree(port->interrupt_in_buffer); kfree(port->interrupt_out_buffer); tty_port_destroy(&port->port); kfree(port); } static struct usb_serial *create_serial(struct usb_device *dev, struct usb_interface *interface, struct usb_serial_driver *driver) { struct usb_serial *serial; serial = kzalloc(sizeof(*serial), GFP_KERNEL); if (!serial) return NULL; serial->dev = usb_get_dev(dev); serial->type = driver; serial->interface = usb_get_intf(interface); kref_init(&serial->kref); mutex_init(&serial->disc_mutex); serial->minors_reserved = 0; return serial; } static const struct usb_device_id *match_dynamic_id(struct usb_interface *intf, struct usb_serial_driver *drv) { struct usb_dynid *dynid; spin_lock(&drv->dynids.lock); list_for_each_entry(dynid, &drv->dynids.list, node) { if (usb_match_one_id(intf, &dynid->id)) { spin_unlock(&drv->dynids.lock); return &dynid->id; } } spin_unlock(&drv->dynids.lock); return NULL; } static const struct usb_device_id *get_iface_id(struct usb_serial_driver *drv, struct usb_interface *intf) { const struct usb_device_id *id; id = usb_match_id(intf, drv->id_table); if (id) { dev_dbg(&intf->dev, "static descriptor matches\n"); goto exit; } id = match_dynamic_id(intf, drv); if (id) dev_dbg(&intf->dev, "dynamic descriptor matches\n"); exit: return id; } /* Caller must hold table_lock */ static struct usb_serial_driver *search_serial_device( struct usb_interface *iface) { const struct usb_device_id *id = NULL; struct usb_serial_driver *drv; struct usb_driver *driver = to_usb_driver(iface->dev.driver); /* Check if the usb id matches a known device */ list_for_each_entry(drv, &usb_serial_driver_list, driver_list) { if (drv->usb_driver == driver) id = get_iface_id(drv, iface); if (id) return drv; } return NULL; } static int serial_port_carrier_raised(struct tty_port *port) { struct usb_serial_port *p = container_of(port, struct usb_serial_port, port); struct usb_serial_driver *drv = p->serial->type; if (drv->carrier_raised) return drv->carrier_raised(p); /* No carrier control - don't block */ return 1; } static void serial_port_dtr_rts(struct tty_port *port, int on) { struct usb_serial_port *p = container_of(port, struct usb_serial_port, port); struct usb_serial_driver *drv = p->serial->type; if (drv->dtr_rts) drv->dtr_rts(p, on); } static const struct tty_port_operations serial_port_ops = { .carrier_raised = serial_port_carrier_raised, .dtr_rts = serial_port_dtr_rts, .activate = serial_port_activate, .shutdown = serial_port_shutdown, }; static int usb_serial_probe(struct usb_interface *interface, const struct usb_device_id *id) { struct device *ddev = &interface->dev; struct usb_device *dev = interface_to_usbdev(interface); struct usb_serial *serial = NULL; struct usb_serial_port *port; struct usb_host_interface *iface_desc; struct usb_endpoint_descriptor *endpoint; struct usb_endpoint_descriptor *interrupt_in_endpoint[MAX_NUM_PORTS]; struct usb_endpoint_descriptor *interrupt_out_endpoint[MAX_NUM_PORTS]; struct usb_endpoint_descriptor *bulk_in_endpoint[MAX_NUM_PORTS]; struct usb_endpoint_descriptor *bulk_out_endpoint[MAX_NUM_PORTS]; struct usb_serial_driver *type = NULL; int retval; int buffer_size; int i; int j; int num_interrupt_in = 0; int num_interrupt_out = 0; int num_bulk_in = 0; int num_bulk_out = 0; int num_ports = 0; int max_endpoints; mutex_lock(&table_lock); type = search_serial_device(interface); if (!type) { mutex_unlock(&table_lock); dev_dbg(ddev, "none matched\n"); return -ENODEV; } if (!try_module_get(type->driver.owner)) { mutex_unlock(&table_lock); dev_err(ddev, "module get failed, exiting\n"); return -EIO; } mutex_unlock(&table_lock); serial = create_serial(dev, interface, type); if (!serial) { module_put(type->driver.owner); return -ENOMEM; } /* if this device type has a probe function, call it */ if (type->probe) { const struct usb_device_id *id; id = get_iface_id(type, interface); retval = type->probe(serial, id); if (retval) { dev_dbg(ddev, "sub driver rejected device\n"); usb_serial_put(serial); module_put(type->driver.owner); return retval; } } /* descriptor matches, let's find the endpoints needed */ /* check out the endpoints */ iface_desc = interface->cur_altsetting; for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { endpoint = &iface_desc->endpoint[i].desc; if (usb_endpoint_is_bulk_in(endpoint)) { /* we found a bulk in endpoint */ dev_dbg(ddev, "found bulk in on endpoint %d\n", i); if (num_bulk_in < MAX_NUM_PORTS) { bulk_in_endpoint[num_bulk_in] = endpoint; ++num_bulk_in; } } if (usb_endpoint_is_bulk_out(endpoint)) { /* we found a bulk out endpoint */ dev_dbg(ddev, "found bulk out on endpoint %d\n", i); if (num_bulk_out < MAX_NUM_PORTS) { bulk_out_endpoint[num_bulk_out] = endpoint; ++num_bulk_out; } } if (usb_endpoint_is_int_in(endpoint)) { /* we found a interrupt in endpoint */ dev_dbg(ddev, "found interrupt in on endpoint %d\n", i); if (num_interrupt_in < MAX_NUM_PORTS) { interrupt_in_endpoint[num_interrupt_in] = endpoint; ++num_interrupt_in; } } if (usb_endpoint_is_int_out(endpoint)) { /* we found an interrupt out endpoint */ dev_dbg(ddev, "found interrupt out on endpoint %d\n", i); if (num_interrupt_out < MAX_NUM_PORTS) { interrupt_out_endpoint[num_interrupt_out] = endpoint; ++num_interrupt_out; } } } #if defined(CONFIG_USB_SERIAL_PL2303) || defined(CONFIG_USB_SERIAL_PL2303_MODULE) /* BEGIN HORRIBLE HACK FOR PL2303 */ /* this is needed due to the looney way its endpoints are set up */ if (((le16_to_cpu(dev->descriptor.idVendor) == PL2303_VENDOR_ID) && (le16_to_cpu(dev->descriptor.idProduct) == PL2303_PRODUCT_ID)) || ((le16_to_cpu(dev->descriptor.idVendor) == ATEN_VENDOR_ID) && (le16_to_cpu(dev->descriptor.idProduct) == ATEN_PRODUCT_ID)) || ((le16_to_cpu(dev->descriptor.idVendor) == ALCOR_VENDOR_ID) && (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID)) || ((le16_to_cpu(dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && (le16_to_cpu(dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_EF81))) { if (interface != dev->actconfig->interface[0]) { /* check out the endpoints of the other interface*/ iface_desc = dev->actconfig->interface[0]->cur_altsetting; for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { endpoint = &iface_desc->endpoint[i].desc; if (usb_endpoint_is_int_in(endpoint)) { /* we found a interrupt in endpoint */ dev_dbg(ddev, "found interrupt in for Prolific device on separate interface\n"); if (num_interrupt_in < MAX_NUM_PORTS) { interrupt_in_endpoint[num_interrupt_in] = endpoint; ++num_interrupt_in; } } } } /* Now make sure the PL-2303 is configured correctly. * If not, give up now and hope this hack will work * properly during a later invocation of usb_serial_probe */ if (num_bulk_in == 0 || num_bulk_out == 0) { dev_info(ddev, "PL-2303 hack: descriptors matched but endpoints did not\n"); usb_serial_put(serial); module_put(type->driver.owner); return -ENODEV; } } /* END HORRIBLE HACK FOR PL2303 */ #endif #ifdef CONFIG_USB_SERIAL_GENERIC if (type == &usb_serial_generic_device) { num_ports = num_bulk_out; if (num_ports == 0) { dev_err(ddev, "Generic device with no bulk out, not allowed.\n"); usb_serial_put(serial); module_put(type->driver.owner); return -EIO; } dev_info(ddev, "The \"generic\" usb-serial driver is only for testing and one-off prototypes.\n"); dev_info(ddev, "Tell linux-usb@vger.kernel.org to add your device to a proper driver.\n"); } #endif if (!num_ports) { /* if this device type has a calc_num_ports function, call it */ if (type->calc_num_ports) num_ports = type->calc_num_ports(serial); if (!num_ports) num_ports = type->num_ports; } if (num_ports > MAX_NUM_PORTS) { dev_warn(ddev, "too many ports requested: %d\n", num_ports); num_ports = MAX_NUM_PORTS; } serial->num_ports = num_ports; serial->num_bulk_in = num_bulk_in; serial->num_bulk_out = num_bulk_out; serial->num_interrupt_in = num_interrupt_in; serial->num_interrupt_out = num_interrupt_out; /* found all that we need */ dev_info(ddev, "%s converter detected\n", type->description); /* create our ports, we need as many as the max endpoints */ /* we don't use num_ports here because some devices have more endpoint pairs than ports */ max_endpoints = max(num_bulk_in, num_bulk_out); max_endpoints = max(max_endpoints, num_interrupt_in); max_endpoints = max(max_endpoints, num_interrupt_out); max_endpoints = max(max_endpoints, (int)serial->num_ports); serial->num_port_pointers = max_endpoints; dev_dbg(ddev, "setting up %d port structure(s)\n", max_endpoints); for (i = 0; i < max_endpoints; ++i) { port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); if (!port) goto probe_error; tty_port_init(&port->port); port->port.ops = &serial_port_ops; port->serial = serial; spin_lock_init(&port->lock); /* Keep this for private driver use for the moment but should probably go away */ INIT_WORK(&port->work, usb_serial_port_work); serial->port[i] = port; port->dev.parent = &interface->dev; port->dev.driver = NULL; port->dev.bus = &usb_serial_bus_type; port->dev.release = &usb_serial_port_release; device_initialize(&port->dev); } /* set up the endpoint information */ for (i = 0; i < num_bulk_in; ++i) { endpoint = bulk_in_endpoint[i]; port = serial->port[i]; buffer_size = max_t(int, serial->type->bulk_in_size, usb_endpoint_maxp(endpoint)); port->bulk_in_size = buffer_size; port->bulk_in_endpointAddress = endpoint->bEndpointAddress; for (j = 0; j < ARRAY_SIZE(port->read_urbs); ++j) { set_bit(j, &port->read_urbs_free); port->read_urbs[j] = usb_alloc_urb(0, GFP_KERNEL); if (!port->read_urbs[j]) goto probe_error; port->bulk_in_buffers[j] = kmalloc(buffer_size, GFP_KERNEL); if (!port->bulk_in_buffers[j]) goto probe_error; usb_fill_bulk_urb(port->read_urbs[j], dev, usb_rcvbulkpipe(dev, endpoint->bEndpointAddress), port->bulk_in_buffers[j], buffer_size, serial->type->read_bulk_callback, port); } port->read_urb = port->read_urbs[0]; port->bulk_in_buffer = port->bulk_in_buffers[0]; } for (i = 0; i < num_bulk_out; ++i) { endpoint = bulk_out_endpoint[i]; port = serial->port[i]; if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL)) goto probe_error; buffer_size = serial->type->bulk_out_size; if (!buffer_size) buffer_size = usb_endpoint_maxp(endpoint); port->bulk_out_size = buffer_size; port->bulk_out_endpointAddress = endpoint->bEndpointAddress; for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j) { set_bit(j, &port->write_urbs_free); port->write_urbs[j] = usb_alloc_urb(0, GFP_KERNEL); if (!port->write_urbs[j]) goto probe_error; port->bulk_out_buffers[j] = kmalloc(buffer_size, GFP_KERNEL); if (!port->bulk_out_buffers[j]) goto probe_error; usb_fill_bulk_urb(port->write_urbs[j], dev, usb_sndbulkpipe(dev, endpoint->bEndpointAddress), port->bulk_out_buffers[j], buffer_size, serial->type->write_bulk_callback, port); } port->write_urb = port->write_urbs[0]; port->bulk_out_buffer = port->bulk_out_buffers[0]; } if (serial->type->read_int_callback) { for (i = 0; i < num_interrupt_in; ++i) { endpoint = interrupt_in_endpoint[i]; port = serial->port[i]; port->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); if (!port->interrupt_in_urb) goto probe_error; buffer_size = usb_endpoint_maxp(endpoint); port->interrupt_in_endpointAddress = endpoint->bEndpointAddress; port->interrupt_in_buffer = kmalloc(buffer_size, GFP_KERNEL); if (!port->interrupt_in_buffer) goto probe_error; usb_fill_int_urb(port->interrupt_in_urb, dev, usb_rcvintpipe(dev, endpoint->bEndpointAddress), port->interrupt_in_buffer, buffer_size, serial->type->read_int_callback, port, endpoint->bInterval); } } else if (num_interrupt_in) { dev_dbg(ddev, "The device claims to support interrupt in transfers, but read_int_callback is not defined\n"); } if (serial->type->write_int_callback) { for (i = 0; i < num_interrupt_out; ++i) { endpoint = interrupt_out_endpoint[i]; port = serial->port[i]; port->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); if (!port->interrupt_out_urb) goto probe_error; buffer_size = usb_endpoint_maxp(endpoint); port->interrupt_out_size = buffer_size; port->interrupt_out_endpointAddress = endpoint->bEndpointAddress; port->interrupt_out_buffer = kmalloc(buffer_size, GFP_KERNEL); if (!port->interrupt_out_buffer) goto probe_error; usb_fill_int_urb(port->interrupt_out_urb, dev, usb_sndintpipe(dev, endpoint->bEndpointAddress), port->interrupt_out_buffer, buffer_size, serial->type->write_int_callback, port, endpoint->bInterval); } } else if (num_interrupt_out) { dev_dbg(ddev, "The device claims to support interrupt out transfers, but write_int_callback is not defined\n"); } usb_set_intfdata(interface, serial); /* if this device type has an attach function, call it */ if (type->attach) { retval = type->attach(serial); if (retval < 0) goto probe_error; serial->attached = 1; if (retval > 0) { /* quietly accept this device, but don't bind to a serial port as it's about to disappear */ serial->num_ports = 0; goto exit; } } else { serial->attached = 1; } /* Avoid race with tty_open and serial_install by setting the * disconnected flag and not clearing it until all ports have been * registered. */ serial->disconnected = 1; if (allocate_minors(serial, num_ports)) { dev_err(ddev, "No more free serial minor numbers\n"); goto probe_error; } /* register all of the individual ports with the driver core */ for (i = 0; i < num_ports; ++i) { port = serial->port[i]; dev_set_name(&port->dev, "ttyUSB%d", port->minor); dev_dbg(ddev, "registering %s\n", dev_name(&port->dev)); device_enable_async_suspend(&port->dev); retval = device_add(&port->dev); if (retval) dev_err(ddev, "Error registering port device, continuing\n"); } serial->disconnected = 0; usb_serial_console_init(serial->port[0]->minor); exit: module_put(type->driver.owner); return 0; probe_error: usb_serial_put(serial); module_put(type->driver.owner); return -EIO; } static void usb_serial_disconnect(struct usb_interface *interface) { int i; struct usb_serial *serial = usb_get_intfdata(interface); struct device *dev = &interface->dev; struct usb_serial_port *port; struct tty_struct *tty; usb_serial_console_disconnect(serial); mutex_lock(&serial->disc_mutex); /* must set a flag, to signal subdrivers */ serial->disconnected = 1; mutex_unlock(&serial->disc_mutex); for (i = 0; i < serial->num_ports; ++i) { port = serial->port[i]; tty = tty_port_tty_get(&port->port); if (tty) { tty_vhangup(tty); tty_kref_put(tty); } usb_serial_port_poison_urbs(port); wake_up_interruptible(&port->port.delta_msr_wait); cancel_work_sync(&port->work); if (device_is_registered(&port->dev)) device_del(&port->dev); } if (serial->type->disconnect) serial->type->disconnect(serial); /* let the last holder of this object cause it to be cleaned up */ usb_serial_put(serial); dev_info(dev, "device disconnected\n"); } int usb_serial_suspend(struct usb_interface *intf, pm_message_t message) { struct usb_serial *serial = usb_get_intfdata(intf); int i, r = 0; serial->suspending = 1; /* * serial->type->suspend() MUST return 0 in system sleep context, * otherwise, the resume callback has to recover device from * previous suspend failure. */ if (serial->type->suspend) { r = serial->type->suspend(serial, message); if (r < 0) { serial->suspending = 0; goto err_out; } } for (i = 0; i < serial->num_ports; ++i) usb_serial_port_poison_urbs(serial->port[i]); err_out: return r; } EXPORT_SYMBOL(usb_serial_suspend); static void usb_serial_unpoison_port_urbs(struct usb_serial *serial) { int i; for (i = 0; i < serial->num_ports; ++i) usb_serial_port_unpoison_urbs(serial->port[i]); } int usb_serial_resume(struct usb_interface *intf) { struct usb_serial *serial = usb_get_intfdata(intf); int rv; usb_serial_unpoison_port_urbs(serial); serial->suspending = 0; if (serial->type->resume) rv = serial->type->resume(serial); else rv = usb_serial_generic_resume(serial); return rv; } EXPORT_SYMBOL(usb_serial_resume); static int usb_serial_reset_resume(struct usb_interface *intf) { struct usb_serial *serial = usb_get_intfdata(intf); int rv; usb_serial_unpoison_port_urbs(serial); serial->suspending = 0; if (serial->type->reset_resume) { rv = serial->type->reset_resume(serial); } else { rv = -EOPNOTSUPP; intf->needs_binding = 1; } return rv; } static const struct tty_operations serial_ops = { .open = serial_open, .close = serial_close, .write = serial_write, .hangup = serial_hangup, .write_room = serial_write_room, .ioctl = serial_ioctl, .set_termios = serial_set_termios, .throttle = serial_throttle, .unthrottle = serial_unthrottle, .break_ctl = serial_break, .chars_in_buffer = serial_chars_in_buffer, .wait_until_sent = serial_wait_until_sent, .tiocmget = serial_tiocmget, .tiocmset = serial_tiocmset, .get_icount = serial_get_icount, .cleanup = serial_cleanup, .install = serial_install, .proc_fops = &serial_proc_fops, }; struct tty_driver *usb_serial_tty_driver; /* Driver structure we register with the USB core */ static struct usb_driver usb_serial_driver = { .name = "usbserial", .probe = usb_serial_probe, .disconnect = usb_serial_disconnect, .suspend = usb_serial_suspend, .resume = usb_serial_resume, .no_dynamic_id = 1, .supports_autosuspend = 1, }; static int __init usb_serial_init(void) { int result; usb_serial_tty_driver = alloc_tty_driver(USB_SERIAL_TTY_MINORS); if (!usb_serial_tty_driver) return -ENOMEM; /* Initialize our global data */ result = bus_register(&usb_serial_bus_type); if (result) { pr_err("%s - registering bus driver failed\n", __func__); goto exit_bus; } usb_serial_tty_driver->driver_name = "usbserial"; usb_serial_tty_driver->name = "ttyUSB"; usb_serial_tty_driver->major = USB_SERIAL_TTY_MAJOR; usb_serial_tty_driver->minor_start = 1; usb_serial_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; usb_serial_tty_driver->subtype = SERIAL_TYPE_NORMAL; usb_serial_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; usb_serial_tty_driver->init_termios = tty_std_termios; usb_serial_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; usb_serial_tty_driver->init_termios.c_ispeed = 9600; usb_serial_tty_driver->init_termios.c_ospeed = 9600; tty_set_operations(usb_serial_tty_driver, &serial_ops); result = tty_register_driver(usb_serial_tty_driver); if (result) { pr_err("%s - tty_register_driver failed\n", __func__); goto exit_reg_driver; } /* register the USB driver */ result = usb_register(&usb_serial_driver); if (result < 0) { pr_err("%s - usb_register failed\n", __func__); goto exit_tty; } /* register the generic driver, if we should */ result = usb_serial_generic_register(); if (result < 0) { pr_err("%s - registering generic driver failed\n", __func__); goto exit_generic; } return result; exit_generic: usb_deregister(&usb_serial_driver); exit_tty: tty_unregister_driver(usb_serial_tty_driver); exit_reg_driver: bus_unregister(&usb_serial_bus_type); exit_bus: pr_err("%s - returning with error %d\n", __func__, result); put_tty_driver(usb_serial_tty_driver); return result; } static void __exit usb_serial_exit(void) { usb_serial_console_exit(); usb_serial_generic_deregister(); usb_deregister(&usb_serial_driver); tty_unregister_driver(usb_serial_tty_driver); put_tty_driver(usb_serial_tty_driver); bus_unregister(&usb_serial_bus_type); idr_destroy(&serial_minors); } module_init(usb_serial_init); module_exit(usb_serial_exit); #define set_to_generic_if_null(type, function) \ do { \ if (!type->function) { \ type->function = usb_serial_generic_##function; \ pr_debug("%s: using generic " #function "\n", \ type->driver.name); \ } \ } while (0) static void usb_serial_operations_init(struct usb_serial_driver *device) { set_to_generic_if_null(device, open); set_to_generic_if_null(device, write); set_to_generic_if_null(device, close); set_to_generic_if_null(device, write_room); set_to_generic_if_null(device, chars_in_buffer); if (device->tx_empty) set_to_generic_if_null(device, wait_until_sent); set_to_generic_if_null(device, read_bulk_callback); set_to_generic_if_null(device, write_bulk_callback); set_to_generic_if_null(device, process_read_urb); set_to_generic_if_null(device, prepare_write_buffer); } static int usb_serial_register(struct usb_serial_driver *driver) { int retval; if (usb_disabled()) return -ENODEV; if (!driver->description) driver->description = driver->driver.name; if (!driver->usb_driver) { WARN(1, "Serial driver %s has no usb_driver\n", driver->description); return -EINVAL; } usb_serial_operations_init(driver); /* Add this device to our list of devices */ mutex_lock(&table_lock); list_add(&driver->driver_list, &usb_serial_driver_list); retval = usb_serial_bus_register(driver); if (retval) { pr_err("problem %d when registering driver %s\n", retval, driver->description); list_del(&driver->driver_list); } else { pr_info("USB Serial support registered for %s\n", driver->description); } mutex_unlock(&table_lock); return retval; } static void usb_serial_deregister(struct usb_serial_driver *device) { pr_info("USB Serial deregistering driver %s\n", device->description); mutex_lock(&table_lock); list_del(&device->driver_list); mutex_unlock(&table_lock); usb_serial_bus_deregister(device); } /** * usb_serial_register_drivers - register drivers for a usb-serial module * @serial_drivers: NULL-terminated array of pointers to drivers to be registered * @name: name of the usb_driver for this set of @serial_drivers * @id_table: list of all devices this @serial_drivers set binds to * * Registers all the drivers in the @serial_drivers array, and dynamically * creates a struct usb_driver with the name @name and id_table of @id_table. */ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[], const char *name, const struct usb_device_id *id_table) { int rc; struct usb_driver *udriver; struct usb_serial_driver * const *sd; /* * udriver must be registered before any of the serial drivers, * because the store_new_id() routine for the serial drivers (in * bus.c) probes udriver. * * Performance hack: We don't want udriver to be probed until * the serial drivers are registered, because the probe would * simply fail for lack of a matching serial driver. * So we leave udriver's id_table set to NULL until we are all set. * * Suspend/resume support is implemented in the usb-serial core, * so fill in the PM-related fields in udriver. */ udriver = kzalloc(sizeof(*udriver), GFP_KERNEL); if (!udriver) return -ENOMEM; udriver->name = name; udriver->no_dynamic_id = 1; udriver->supports_autosuspend = 1; udriver->suspend = usb_serial_suspend; udriver->resume = usb_serial_resume; udriver->probe = usb_serial_probe; udriver->disconnect = usb_serial_disconnect; /* we only set the reset_resume field if the serial_driver has one */ for (sd = serial_drivers; *sd; ++sd) { if ((*sd)->reset_resume) { udriver->reset_resume = usb_serial_reset_resume; break; } } rc = usb_register(udriver); if (rc) goto failed_usb_register; for (sd = serial_drivers; *sd; ++sd) { (*sd)->usb_driver = udriver; rc = usb_serial_register(*sd); if (rc) goto failed; } /* Now set udriver's id_table and look for matches */ udriver->id_table = id_table; rc = driver_attach(&udriver->drvwrap.driver); return 0; failed: while (sd-- > serial_drivers) usb_serial_deregister(*sd); usb_deregister(udriver); failed_usb_register: kfree(udriver); return rc; } EXPORT_SYMBOL_GPL(usb_serial_register_drivers); /** * usb_serial_deregister_drivers - deregister drivers for a usb-serial module * @serial_drivers: NULL-terminated array of pointers to drivers to be deregistered * * Deregisters all the drivers in the @serial_drivers array and deregisters and * frees the struct usb_driver that was created by the call to * usb_serial_register_drivers(). */ void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]) { struct usb_driver *udriver = (*serial_drivers)->usb_driver; for (; *serial_drivers; ++serial_drivers) usb_serial_deregister(*serial_drivers); usb_deregister(udriver); kfree(udriver); } EXPORT_SYMBOL_GPL(usb_serial_deregister_drivers); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL");
pro4tlzz/P9000-Kernel
drivers/usb/serial/usb-serial.c
C
gpl-2.0
40,404
#!/usr/bin/perl # # dpkg-buildflags # # Copyright © 2010 Raphaël Hertzog <hertzog@debian.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. use strict; use warnings; use Dpkg; use Dpkg::Gettext; use Dpkg::ErrorHandling; use Dpkg::BuildFlags; textdomain("dpkg-dev"); sub version { printf _g("Debian %s version %s.\n"), $progname, $version; printf _g(" Copyright (C) 2010 Raphael Hertzog <hertzog\@debian.org>."); printf _g(" This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. "); } sub usage { printf _g( "Usage: %s [<action>] Actions: --get <flag> output the requested flag to stdout. --origin <flag> output the origin of the flag to stdout: value is one of vendor, system, user, env. --list output a list of the flags supported by the current vendor. --export=(sh|make) output commands to be executed in shell or make that export all the compilation flags as environment variables. --help show this help message. --version show the version. "), $progname; } my ($param, $action); while (@ARGV) { $_ = shift(@ARGV); if (m/^--(get|origin)$/) { usageerr(_g("two commands specified: --%s and --%s"), $1, $action) if defined($action); $action = $1; $param = shift(@ARGV); usageerr(_g("%s needs a parameter"), $_) unless defined $param; } elsif (m/^--export(?:=(sh|make))?$/) { usageerr(_g("two commands specified: --%s and --%s"), "export", $action) if defined($action); my $type = $1 || "sh"; $action = "export-$type"; } elsif (m/^--list$/) { usageerr(_g("two commands specified: --%s and --%s"), "list", $action) if defined($action); $action = "list"; } elsif (m/^-(h|-help)$/) { usage(); exit 0; } elsif (m/^--version$/) { version(); exit 0; } else { usageerr(_g("unknown option \`%s'"), $_); } } usageerr(_g("need an action option")) unless defined($action); my $build_flags = Dpkg::BuildFlags->new(); if ($action eq "list") { foreach my $flag ($build_flags->list()) { print "$flag\n"; } exit(0); } $build_flags->load_config(); if ($action eq "get") { if ($build_flags->has($param)) { print $build_flags->get($param) . "\n"; exit(0); } } elsif ($action eq "origin") { if ($build_flags->has($param)) { print $build_flags->get_origin($param) . "\n"; exit(0); } } elsif ($action =~ m/^export-(.*)$/) { my $export_type = $1; foreach my $flag ($build_flags->list()) { next unless $flag =~ /^[A-Z]/; # Skip flags starting with lowercase my $value = $build_flags->get($flag); if ($export_type eq "sh") { $value =~ s/"/\"/g; print "export $flag=\"$value\"\n"; } elsif ($export_type eq "make") { $value =~ s/\$/\$\$/g; print "export $flag := $value\n"; } } exit(0); } exit(1);
nxmirrors/dpkg
scripts/dpkg-buildflags.pl
Perl
gpl-2.0
3,600
/* Copyright (C) 2011-2017 xfgryujk https://tieba.baidu.com/f?kw=%D2%BB%B8%F6%BC%AB%C6%E4%D2%FE%C3%D8%D6%BB%D3%D0xfgryujk%D6%AA%B5%C0%B5%C4%B5%D8%B7%BD 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. */ // InputDlg.cpp : 实现文件 // #include "stdafx.h" #include <InputDlg.h> #include "resource.h" // CInputDlg 对话框 const UINT CInputDlg::IDD = IDD_INPUT_DIALOG; IMPLEMENT_DYNAMIC(CInputDlg, CDialog) CInputDlg::CInputDlg(const CString& title, CString& content, BOOL* isRegex, BOOL showRegexCheck, UINT nIDTemplate, CWnd* pParent /*=NULL*/) : CDialog(nIDTemplate, pParent), m_title(title), m_content(content), m_isRegex(isRegex), m_showRegexCheck(showRegexCheck) { } CInputDlg::~CInputDlg() { } void CInputDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_EDIT1, m_edit); DDX_Control(pDX, IDC_CHECK1, m_regexCheck); } BEGIN_MESSAGE_MAP(CInputDlg, CDialog) END_MESSAGE_MAP() // CInputDlg 消息处理程序 // 初始化 BOOL CInputDlg::OnInitDialog() { CDialog::OnInitDialog(); SetWindowText(m_title); m_edit.SetWindowText(m_content); if (m_isRegex != NULL) m_regexCheck.SetCheck(*m_isRegex); if (m_showRegexCheck) m_regexCheck.ShowWindow(SW_NORMAL); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE } // 确定 void CInputDlg::OnOK() { m_edit.GetWindowText(m_content); if (m_isRegex != NULL) *m_isRegex = m_regexCheck.GetCheck(); CDialog::OnOK(); }
xfgryujk/TiebaManager
Helper/InputDlg.cpp
C++
gpl-2.0
2,142
<?php /** * * PHP 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @package Cake.Model * @since CakePHP(tm) v 0.2.9 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ App::uses('AppModel', 'Model'); /** * Permissions linking AROs with ACOs * * @package Cake.Model */ class Permission extends AppModel { /** * Model name * * @var string */ public $name = 'Permission'; /** * Explicitly disable in-memory query caching * * @var boolean */ public $cacheQueries = false; /** * Override default table name * * @var string */ public $useTable = 'aros_acos'; /** * Permissions link AROs with ACOs * * @var array */ public $belongsTo = array('Aro', 'Aco'); /** * No behaviors for this model * * @var array */ public $actsAs = null; /** * Constructor, used to tell this model to use the * database configured for ACL */ public function __construct() { $config = Configure::read('Acl.database'); if (!empty($config)) { $this->useDbConfig = $config; } parent::__construct(); } /** * Checks if the given $aro has access to action $action in $aco * * @param string $aro ARO The requesting object identifier. * @param string $aco ACO The controlled object identifier. * @param string $action Action (defaults to *) * @return boolean Success (true if ARO has access to action in ACO, false otherwise) */ public function check($aro, $aco, $action = "*") { if (!$aro || !$aco) { return false; } $permKeys = $this->getAcoKeys($this->schema()); $aroPath = $this->Aro->node($aro); $acoPath = $this->Aco->node($aco); if (!$aroPath || !$acoPath) { trigger_error(__d('cake_dev', "DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s", print_r($aro, true), print_r($aco, true)), E_USER_WARNING); return false; } if (!$acoPath) { trigger_error(__d('cake_dev', "DbAcl::check() - Failed ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s", print_r($aro, true), print_r($aco, true)), E_USER_WARNING); return false; } if ($action !== '*' && !in_array('_' . $action, $permKeys)) { trigger_error(__d('cake_dev', "ACO permissions key %s does not exist in DbAcl::check()", $action), E_USER_NOTICE); return false; } $inherited = array(); $acoIDs = Hash::extract($acoPath, '{n}.' . $this->Aco->alias . '.id'); $count = count($aroPath); for ($i = 0; $i < $count; $i++) { $permAlias = $this->alias; $perms = $this->find('all', array( 'conditions' => array( "{$permAlias}.aro_id" => $aroPath[$i][$this->Aro->alias]['id'], "{$permAlias}.aco_id" => $acoIDs ), 'order' => array($this->Aco->alias . '.lft' => 'desc'), 'recursive' => 0 )); if (empty($perms)) { continue; } $perms = Hash::extract($perms, '{n}.' . $this->alias); foreach ($perms as $perm) { if ($action === '*') { foreach ($permKeys as $key) { if (!empty($perm)) { if ($perm[$key] == -1) { return false; } elseif ($perm[$key] == 1) { $inherited[$key] = 1; } } } if (count($inherited) === count($permKeys)) { return true; } } else { switch ($perm['_' . $action]) { case -1: return false; case 0: continue; case 1: return true; } } } } return false; } /** * Allow $aro to have access to action $actions in $aco * * @param string $aro ARO The requesting object identifier. * @param string $aco ACO The controlled object identifier. * @param string $actions Action (defaults to *) Invalid permissions will result in an exception * @param integer $value Value to indicate access type (1 to give access, -1 to deny, 0 to inherit) * @return boolean Success * @throws AclException on Invalid permission key. */ public function allow($aro, $aco, $actions = "*", $value = 1) { $perms = $this->getAclLink($aro, $aco); $permKeys = $this->getAcoKeys($this->schema()); $save = array(); if (!$perms) { trigger_error(__d('cake_dev', 'DbAcl::allow() - Invalid node'), E_USER_WARNING); return false; } if (isset($perms[0])) { $save = $perms[0][$this->alias]; } if ($actions === "*") { $save = array_combine($permKeys, array_pad(array(), count($permKeys), $value)); } else { if (!is_array($actions)) { $actions = array('_' . $actions); } foreach ($actions as $action) { if ($action{0} !== '_') { $action = '_' . $action; } if (!in_array($action, $permKeys, true)) { throw new AclException(__d('cake_dev', 'Invalid permission key "%s"', $action)); } $save[$action] = $value; } } list($save['aro_id'], $save['aco_id']) = array($perms['aro'], $perms['aco']); if ($perms['link'] && !empty($perms['link'])) { $save['id'] = $perms['link'][0][$this->alias]['id']; } else { unset($save['id']); $this->id = null; } return ($this->save($save) !== false); } /** * Get an array of access-control links between the given Aro and Aco * * @param string $aro ARO The requesting object identifier. * @param string $aco ACO The controlled object identifier. * @return array Indexed array with: 'aro', 'aco' and 'link' */ public function getAclLink($aro, $aco) { $obj = array(); $obj['Aro'] = $this->Aro->node($aro); $obj['Aco'] = $this->Aco->node($aco); if (empty($obj['Aro']) || empty($obj['Aco'])) { return false; } $aro = Hash::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'); $aco = Hash::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id'); $aro = current($aro); $aco = current($aco); return array( 'aro' => $aro, 'aco' => $aco, 'link' => $this->find('all', array('conditions' => array( $this->alias . '.aro_id' => $aro, $this->alias . '.aco_id' => $aco ))) ); } /** * Get the crud type keys * * @param array $keys Permission schema * @return array permission keys */ public function getAcoKeys($keys) { $newKeys = array(); $keys = array_keys($keys); foreach ($keys as $key) { if (!in_array($key, array('id', 'aro_id', 'aco_id'))) { $newKeys[] = $key; } } return $newKeys; } }
foccusdev/site
sistema/lib/Cake/Model/Permission.php
PHP
gpl-2.0
6,643
/* * scandir, alphasort - scan a directory * * implementation for systems that do not have it in libc */ #include "../config.h" #ifndef HAVE_SCANDIR #include <sys/types.h> #include <dirent.h> #include <stdlib.h> #include <stddef.h> #include <string.h> /* * convenience helper function for scandir's |compar()| function: * sort directory entries using strcoll(3) */ int alphasort(const void *_a, const void *_b) { struct dirent **a = (struct dirent **)_a; struct dirent **b = (struct dirent **)_b; return strcoll((*a)->d_name, (*b)->d_name); } #define strverscmp(a,b) strcoll(a,b) /* for now */ /* * convenience helper function for scandir's |compar()| function: * sort directory entries using GNU |strverscmp()| */ int versionsort(const void *_a, const void *_b) { struct dirent **a = (struct dirent **)_a; struct dirent **b = (struct dirent **)_b; return strverscmp((*a)->d_name, (*b)->d_name); } /* * The scandir() function reads the directory dirname and builds an * array of pointers to directory entries using malloc(3). It returns * the number of entries in the array. A pointer to the array of * directory entries is stored in the location referenced by namelist. * * The select parameter is a pointer to a user supplied subroutine * which is called by scandir() to select which entries are to be * included in the array. The select routine is passed a pointer to * a directory entry and should return a non-zero value if the * directory entry is to be included in the array. If select is null, * then all the directory entries will be included. * * The compar parameter is a pointer to a user supplied subroutine * which is passed to qsort(3) to sort the completed array. If this * pointer is null, the array is not sorted. */ int scandir(const char *dirname, struct dirent ***ret_namelist, int (*select)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)) { int i, len; int used, allocated; DIR *dir; struct dirent *ent, *ent2; struct dirent **namelist = NULL; if ((dir = opendir(dirname)) == NULL) return -1; used = 0; allocated = 2; namelist = malloc(allocated * sizeof(struct dirent *)); if (!namelist) goto error; while ((ent = readdir(dir)) != NULL) { if (select != NULL && !select(ent)) continue; /* duplicate struct direct for this entry */ len = offsetof(struct dirent, d_name) + strlen(ent->d_name) + 1; if ((ent2 = malloc(len)) == NULL) return -1; if (used >= allocated) { allocated *= 2; namelist = realloc(namelist, allocated * sizeof(struct dirent *)); if (!namelist) goto error; } memcpy(ent2, ent, len); namelist[used++] = ent2; } closedir(dir); if (compar) qsort(namelist, used, sizeof(struct dirent *), (int (*)(const void *, const void *)) compar); *ret_namelist = namelist; return used; error: if (namelist) { for (i = 0; i < used; i++) free(namelist[i]); free(namelist); } return -1; } #endif #if STANDALONE_MAIN int main(int argc, char **argv) { struct dirent **namelist; int i, n; n = scandir("/etc", &namelist, NULL, alphasort); for (i = 0; i < n; i++) printf("%s\n", namelist[i]->d_name); } #endif
GeeXboX/mplayer-ui
osdep/scandir.c
C
gpl-2.0
3,284
/////////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2006-2019 Esper Team. All rights reserved. / // http://esper.codehaus.org / // ---------------------------------------------------------------------------------- / // The software in this package is published under the terms of the GPL license / // a copy of which has been included with this distribution in the license.txt file. / /////////////////////////////////////////////////////////////////////////////////////// using System; namespace com.espertech.esper.compat { public delegate Object Callable() ; public delegate T Callable<T>(); public interface ICallable<T> { T Call(); } }
espertechinc/nesper
src/NEsper.Compat/compat/Callable.cs
C#
gpl-2.0
837
<?php /** * --------------------------------------------------------------------- * GLPI - Gestionnaire Libre de Parc Informatique * Copyright (C) 2015-2017 Teclib' and contributors. * * http://glpi-project.org * * based on GLPI - Gestionnaire Libre de Parc Informatique * Copyright (C) 2003-2014 by the INDEPNET Development Team. * * --------------------------------------------------------------------- * * LICENSE * * This file is part of GLPI. * * GLPI 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. * * GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>. * --------------------------------------------------------------------- */ /** @file * @brief */ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } /// Class DeviceMemory class DeviceMemory extends CommonDevice { static protected $forward_entity_to = array('Item_DeviceMemory', 'Infocom'); static function getTypeName($nb=0) { return _n('Memory', 'Memories', $nb); } function getAdditionalFields() { return array_merge(parent::getAdditionalFields(), array(array('name' => 'size_default', 'label' => __('Size by default'), 'type' => 'text', 'unit' => __('Mio')), array('name' => 'frequence', 'label' => __('Frequency'), 'type' => 'text', 'unit' => __('MHz')), array('name' => 'devicememorytypes_id', 'label' => __('Type'), 'type' => 'dropdownValue'), array('name' => 'devicememorymodels_id', 'label' => __('Model'), 'type' => 'dropdownValue'))); } function getSearchOptionsNew() { $tab = parent::getSearchOptionsNew(); $tab[] = [ 'id' => '11', 'table' => $this->getTable(), 'field' => 'size_default', 'name' => __('Size by default'), 'datatype' => 'string' ]; $tab[] = [ 'id' => '12', 'table' => $this->getTable(), 'field' => 'frequence', 'name' => __('Frequency'), 'datatype' => 'string' ]; $tab[] = [ 'id' => '13', 'table' => 'glpi_devicememorytypes', 'field' => 'name', 'name' => __('Type'), 'datatype' => 'dropdown' ]; $tab[] = [ 'id' => '14', 'table' => 'glpi_devicememorymodels', 'field' => 'name', 'name' => __('Model'), 'datatype' => 'dropdown' ]; return $tab; } /** * @since version 0.85 * @param $input * * @return number **/ function prepareInputForAddOrUpdate($input) { foreach (array('size_default') as $field) { if (isset($input[$field]) && !is_numeric($input[$field])) { $input[$field] = 0; } } return $input; } /** * @since version 0.85 * @see CommonDropdown::prepareInputForAdd() **/ function prepareInputForAdd($input) { return self::prepareInputForAddOrUpdate($input); } /** * @since version 0.85 * @see CommonDropdown::prepareInputForUpdate() **/ function prepareInputForUpdate($input) { return self::prepareInputForAddOrUpdate($input); } /** * @since version 0.84 * * @see CommonDevice::getHTMLTableHeader() **/ static function getHTMLTableHeader($itemtype, HTMLTableBase $base, HTMLTableSuperHeader $super=NULL, HTMLTableHeader $father=NULL, array $options=array()) { $column = parent::getHTMLTableHeader($itemtype, $base, $super, $father, $options); if ($column == $father) { return $father; } switch ($itemtype) { case 'Computer' : Manufacturer::getHTMLTableHeader(__CLASS__, $base, $super, $father, $options); $base->addHeader('devicememory_type', __('Type'), $super, $father); $base->addHeader('devicememory_frequency', __('Frequency'), $super, $father); break; } } /** * @since version 0.84 * * @see CommonDevice::getHTMLTableCellForItem() **/ function getHTMLTableCellForItem(HTMLTableRow $row=NULL, CommonDBTM $item=NULL, HTMLTableCell $father=NULL, array $options=array()) { $column = parent::getHTMLTableCellForItem($row, $item, $father, $options); if ($column == $father) { return $father; } switch ($item->getType()) { case 'Computer' : Manufacturer::getHTMLTableCellsForItem($row, $this, NULL, $options); if ($this->fields["devicememorytypes_id"]) { $row->addCell($row->getHeaderByName('devicememory_type'), Dropdown::getDropdownName("glpi_devicememorytypes", $this->fields["devicememorytypes_id"]), $father); } if (!empty($this->fields["frequence"])) { $row->addCell($row->getHeaderByName('devicememory_frequency'), $this->fields["frequence"], $father); } break; } } /** * Criteria used for import function * * @see CommonDevice::getImportCriteria() * * @since version 0.84 **/ function getImportCriteria() { return array('designation' => 'equal', 'devicememorytypes_id' => 'equal', 'manufacturers_id' => 'equal', 'frequence' => 'delta:10'); } }
eltharin/glpi
inc/devicememory.class.php
PHP
gpl-2.0
6,770
/****************************************************************************** * @section DESCRIPTION * * Initilization library. * * @section LICENSE * * The Variable Infiltration Capacity (VIC) macroscale hydrological model * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil * and Environmental Engineering, University of Washington. * * The VIC model 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. *****************************************************************************/ #include <vic_driver_shared_image.h> /****************************************************************************** * @brief Initialize soil con sructure. *****************************************************************************/ void initialize_soil_con(soil_con_struct *soil_con) { extern option_struct options; size_t i; size_t j; soil_con->FS_ACTIVE = 0; soil_con->gridcel = MISSING_USI; soil_con->AlbedoPar = 0.; soil_con->elevation = 0.; soil_con->lat = 0.; soil_con->lng = 0.; soil_con->time_zone_lng = 0.; soil_con->annual_prec = 0.; soil_con->aspect = 0.; soil_con->avg_temp = 0.; soil_con->avgJulyAirTemp = 0.; soil_con->b_infilt = 0.; soil_con->c = 0.; soil_con->cell_area = 0.; soil_con->dp = 0.; soil_con->Ds = 0.; soil_con->Dsmax = 0.; soil_con->ehoriz = 0.; soil_con->frost_slope = 0.; soil_con->max_infil = 0.; soil_con->max_snow_distrib_slope = 0.; soil_con->rough = 0.; soil_con->slope = 0.; soil_con->snow_rough = 0.; soil_con->whoriz = 0.; soil_con->Ws = 0.; for (i = 0; i < MAX_LAYERS; i++) { soil_con->bubble[i] = 0.; soil_con->bulk_density[i] = 0.; soil_con->bulk_dens_min[i] = 0.; soil_con->bulk_dens_org[i] = 0.; soil_con->depth[i] = 0.; soil_con->expt[i] = 0.; soil_con->init_moist[i] = 0.; soil_con->Ksat[i] = 0.; soil_con->max_moist[i] = 0.; soil_con->phi_s[i] = 0.; soil_con->porosity[i] = 0.; soil_con->quartz[i] = 0.; soil_con->organic[i] = 0.; soil_con->resid_moist[i] = 0.; soil_con->soil_density[i] = 0.; soil_con->soil_dens_min[i] = 0.; soil_con->soil_dens_org[i] = 0.; soil_con->Wcr[i] = 0.; soil_con->Wpwp[i] = 0.; } for (i = 0; i < MAX_NODES; i++) { soil_con->alpha[i] = 0.; soil_con->beta[i] = 0.; soil_con->bubble_node[i] = 0.; soil_con->dz_node[i] = 0.; soil_con->Zsum_node[i] = 0.; soil_con->expt_node[i] = 0.; soil_con->gamma[i] = 0.; soil_con->max_moist_node[i] = 0.; } for (i = 0; i < MAX_FROST_AREAS; i++) { soil_con->frost_fract[i] = 0.; } for (i = 0; i < options.SNOW_BAND; i++) { soil_con->AboveTreeLine[i] = false; soil_con->BandElev[i] = 0.; soil_con->AreaFract[i] = 1.; soil_con->Pfactor[i] = 0.; soil_con->Tfactor[i] = 0.; } for (i = 0; i < MAX_LAYERS + 2; i++) { for (j = 0; j < MAX_ZWTVMOIST; j++) { soil_con->zwtvmoist_zwt[i][j] = 0.; soil_con->zwtvmoist_moist[i][j] = 0.; } } } /****************************************************************************** * @brief Initialize veg con sructure. *****************************************************************************/ void initialize_veg_con(veg_con_struct *veg_con) { extern option_struct options; size_t i; veg_con->Cv = 0.; veg_con->veg_class = NODATA_VEG; // -1 to force a crash if inappropriate veg_con->vegetat_type_num = 0.; veg_con->sigma_slope = 0.; veg_con->lag_one = 0.; veg_con->fetch = 0.; veg_con->LAKE = 0; for (i = 0; i < MAX_LAYERS; i++) { veg_con->root[i] = 0.; } for (i = 0; i < options.ROOT_ZONES; i++) { veg_con->zone_depth[i] = 0.; veg_con->zone_fract[i] = 0.; } if (options.CARBON) { for (i = 0; i < options.Ncanopy; i++) { veg_con->CanopLayerBnd[i] = 0.; } } } /****************************************************************************** * @brief Initialize domain info stucture *****************************************************************************/ void initialize_domain_info(domain_info_struct *info) { snprintf(info->lat_var, MAXSTRING, "%s", "MISSING"); snprintf(info->lon_var, MAXSTRING, "%s", "MISSING"); snprintf(info->mask_var, MAXSTRING, "%s", "MISSING"); snprintf(info->area_var, MAXSTRING, "%s", "MISSING"); snprintf(info->frac_var, MAXSTRING, "%s", "MISSING"); snprintf(info->y_dim, MAXSTRING, "%s", "MISSING"); snprintf(info->x_dim, MAXSTRING, "%s", "MISSING"); info->n_coord_dims = 0; } /****************************************************************************** * @brief Initialize global structures *****************************************************************************/ void initialize_global_structures(void) { extern domain_struct global_domain; extern domain_struct local_domain; extern int mpi_rank; initialize_domain_info(&local_domain.info); if (mpi_rank == VIC_MPI_ROOT) { initialize_options(); initialize_global(); initialize_parameters(); initialize_filenames(); initialize_domain_info(&global_domain.info); initialize_domain(&global_domain); } }
wietsefranssen/VIC
vic/drivers/shared_image/src/init_library.c
C
gpl-2.0
6,176
<?php /* Smarty version 2.6.26, created on 2010-04-27 15:22:28 compiled from CRM/common/Navigation.tpl */ ?> <?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); smarty_core_load_plugins(array('plugins' => array(array('function', 'crmURL', 'CRM/common/Navigation.tpl', 29, false),array('block', 'ts', 'CRM/common/Navigation.tpl', 33, false),)), $this); ?> <div id="menu-container" style="display:none;"> <ul id="civicrm-menu"> <li id="crm-qsearch" class="menumain"> <form action="<?php echo CRM_Utils_System::crmURL(array('p' => 'civicrm/contact/search/basic','h' => 0), $this);?> " name="search_block" id="id_search_block" method="post" onsubmit="getSearchURLValue( );"> <div> <input type="text" class="form-text" id="sort_name" name="sort_name" style="width: 12em;"/> <input type="hidden" id="sort_contact_id" value="" /> <input type="submit" value="<?php $this->_tag_stack[] = array('ts', array()); $_block_repeat=true;smarty_block_ts($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);while ($_block_repeat) { ob_start(); ?>Go<?php $_block_content = ob_get_contents(); ob_end_clean(); $_block_repeat=false;echo smarty_block_ts($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat); } array_pop($this->_tag_stack); ?>" name="_qf_Basic_refresh" class="form-submit default" style="display: none;"/> </div> </form> </li> <?php echo $this->_tpl_vars['navigation']; ?> </ul> </div> <?php echo ' <script type="text/javascript"> function getSearchURLValue( ) { var contactId = cj( \'#sort_contact_id\' ).val(); if ( ! contactId || isNaN( contactId ) ) { var sortValue = cj( \'#sort_name\' ).val(); if ( sortValue ) { //using xmlhttprequest check if there is only one contact and redirect to view page var dataUrl = '; ?> "<?php echo CRM_Utils_System::crmURL(array('p' => 'civicrm/ajax/contact','h' => 0,'q' => 'name='), $this);?> "<?php echo ' + sortValue; var response = cj.ajax({ url: dataUrl, async: false }).responseText; contactId = response; } } if ( contactId ) { var url = '; ?> "<?php echo CRM_Utils_System::crmURL(array('p' => 'civicrm/contact/view','h' => 0,'q' => 'reset=1&cid='), $this);?> "<?php echo ' + contactId; document.getElementById(\'id_search_block\').action = url; } } /* Need to fix this properly*/ cj( function() { cj("#admin-menu").find("li :contains(\'CiviCRM\')").click(function() { cj("#civicrm-menu").toggle(); return false; }); var contactUrl = '; ?> "<?php echo CRM_Utils_System::crmURL(array('p' => 'civicrm/ajax/contactlist','q' => 'context=navigation','h' => 0), $this);?> "<?php echo '; cj( \'#sort_name\' ).autocomplete( contactUrl, { width: 200, selectFirst: false, minChars:2, matchContains: true }).result(function(event, data, formatted) { document.location='; ?> "<?php echo CRM_Utils_System::crmURL(array('p' => 'civicrm/contact/view','h' => 0,'q' => 'reset=1&cid='), $this);?> "<?php echo '+data[1]; return false; }); }); var framework = "'; ?> <?php echo $this->_tpl_vars['config']->userFramework; ?> <?php echo '"; if( framework != \'Joomla\') { cj(\'body\').prepend( cj("#menu-container").html() ); //Track Scrolling cj(window).scroll( function () { var scroll = document.documentElement.scrollTop || document.body.scrollTop; cj(\'#civicrm-menu\').css({top: "scroll", position: "fixed", top: "0px"}); cj(\'div.sticky-header\').css({ \'top\' : "23px", position: "fixed" }); }); } else { cj(\'div#toolbar-box div.m\').html(cj("#menu-container").html()); cj(\'#civicrm-menu\').ready( function(){ cj(\'.outerbox\').css({ \'margin-top\': \'6px\'}); cj(\'#root-menu-div .menu-ul li\').css({ \'padding-bottom\' : \'2px\', \'margin-top\' : \'2px\' }); cj(\'img.menu-item-arrow\').css({ \'top\' : \'4px\' }); }); } var resourceBase = '; ?> "<?php echo $this->_tpl_vars['config']->resourceBase; ?> "<?php echo '; cj(\'#civicrm-menu\').menu( {arrowSrc: resourceBase + \'packages/jquery/css/images/arrow.png\'} ); </script> '; ?>
bhirsch/voipdev
sites/default/files/civicrm/templates_c/en_US/en_US/%%0E/0E6/0E687DDC%%Navigation.tpl.php
PHP
gpl-2.0
4,383
/* * Copyright (C) 2010 Geometer Plus <contact@geometerplus.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #include "ZLNetworkSSLCertificate.h" const ZLNetworkSSLCertificate ZLNetworkSSLCertificate::NULL_CERTIFICATE(true); const ZLNetworkSSLCertificate ZLNetworkSSLCertificate::DONT_VERIFY_CERTIFICATE(false); ZLNetworkSSLCertificate::ZLNetworkSSLCertificate(bool doVerify) : DoVerify(doVerify) { } ZLNetworkSSLCertificate::ZLNetworkSSLCertificate(const std::string &path) : Path(path), DoVerify(true) { }
pocketbook-free/fbreader12
src/network/ZLNetworkSSLCertificate.cpp
C++
gpl-2.0
1,197
#ifndef LOGGING_H #define LOGGING_H #define TRACE_DEBUG "DEBUG" #define TRACE_INFO "INFOR" #define TRACE_WARNING "WARNI" #define TRACE_ERROR "ERROR" #define TRACE_FATAL "FATAL" void initLoggingFile (const char *path); void logging (const char *tag, const char *format, ...); void closeLoggingFile (); #endif /* LOGGING_H */
KraiZeur/Minish
src/logging.h
C
gpl-2.0
350
/* SPDX-License-Identifier: LGPL-2.1+ */ /*** Copyright © 2014 Intel Corporation. All rights reserved. ***/ #include <netinet/icmp6.h> #include <arpa/inet.h> #include "sd-ndisc.h" #include "missing_network.h" #include "networkd-dhcp6.h" #include "networkd-manager.h" #include "networkd-ndisc.h" #include "networkd-route.h" #include "string-util.h" #include "strv.h" #define NDISC_DNSSL_MAX 64U #define NDISC_RDNSS_MAX 64U #define NDISC_PREFIX_LFT_MIN 7200U #define DAD_CONFLICTS_IDGEN_RETRIES_RFC7217 3 /* https://tools.ietf.org/html/rfc5453 */ /* https://www.iana.org/assignments/ipv6-interface-ids/ipv6-interface-ids.xml */ #define SUBNET_ROUTER_ANYCAST_ADDRESS_RFC4291 ((struct in6_addr) { .s6_addr = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }) #define SUBNET_ROUTER_ANYCAST_PREFIXLEN 8 #define RESERVED_IPV6_INTERFACE_IDENTIFIERS_ADDRESS_RFC4291 ((struct in6_addr) { .s6_addr = { 0x02, 0x00, 0x5E, 0xFF, 0xFE } }) #define RESERVED_IPV6_INTERFACE_IDENTIFIERS_PREFIXLEN 5 #define RESERVED_SUBNET_ANYCAST_ADDRESSES_RFC4291 ((struct in6_addr) { .s6_addr = { 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } }) #define RESERVED_SUBNET_ANYCAST_PREFIXLEN 7 #define NDISC_APP_ID SD_ID128_MAKE(13,ac,81,a7,d5,3f,49,78,92,79,5d,0c,29,3a,bc,7e) static bool stableprivate_address_is_valid(const struct in6_addr *addr) { assert(addr); /* According to rfc4291, generated address should not be in the following ranges. */ if (memcmp(addr, &SUBNET_ROUTER_ANYCAST_ADDRESS_RFC4291, SUBNET_ROUTER_ANYCAST_PREFIXLEN) == 0) return false; if (memcmp(addr, &RESERVED_IPV6_INTERFACE_IDENTIFIERS_ADDRESS_RFC4291, RESERVED_IPV6_INTERFACE_IDENTIFIERS_PREFIXLEN) == 0) return false; if (memcmp(addr, &RESERVED_SUBNET_ANYCAST_ADDRESSES_RFC4291, RESERVED_SUBNET_ANYCAST_PREFIXLEN) == 0) return false; return true; } static int make_stableprivate_address(Link *link, const struct in6_addr *prefix, uint8_t prefix_len, uint8_t dad_counter, struct in6_addr *addr) { sd_id128_t secret_key; struct siphash state; uint64_t rid; size_t l; int r; /* According to rfc7217 section 5.1 * RID = F(Prefix, Net_Iface, Network_ID, DAD_Counter, secret_key) */ r = sd_id128_get_machine_app_specific(NDISC_APP_ID, &secret_key); if (r < 0) return log_error_errno(r, "Failed to generate key: %m"); siphash24_init(&state, secret_key.bytes); l = MAX(DIV_ROUND_UP(prefix_len, 8), 8); siphash24_compress(prefix, l, &state); siphash24_compress(link->ifname, strlen(link->ifname), &state); siphash24_compress(&link->mac, sizeof(struct ether_addr), &state); siphash24_compress(&dad_counter, sizeof(uint8_t), &state); rid = htole64(siphash24_finalize(&state)); memcpy(addr->s6_addr, prefix->s6_addr, l); memcpy((uint8_t *) &addr->s6_addr + l, &rid, 16 - l); return 0; } static int ndisc_netlink_route_message_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) { int r; assert(link); assert(link->ndisc_messages > 0); link->ndisc_messages--; if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)) return 1; r = sd_netlink_message_get_errno(m); if (r < 0 && r != -EEXIST) { log_link_message_error_errno(link, m, r, "Could not set NDisc route or address"); link_enter_failed(link); return 1; } if (link->ndisc_messages == 0) { link->ndisc_configured = true; r = link_request_set_routes(link); if (r < 0) { link_enter_failed(link); return 1; } link_check_ready(link); } return 1; } static int ndisc_netlink_address_message_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) { int r; assert(link); assert(link->ndisc_messages > 0); link->ndisc_messages--; if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)) return 1; r = sd_netlink_message_get_errno(m); if (r < 0 && r != -EEXIST) { log_link_message_error_errno(link, m, r, "Could not set NDisc route or address"); link_enter_failed(link); return 1; } else if (r >= 0) (void) manager_rtnl_process_address(rtnl, m, link->manager); if (link->ndisc_messages == 0) { link->ndisc_configured = true; r = link_request_set_routes(link); if (r < 0) { link_enter_failed(link); return 1; } link_check_ready(link); } return 1; } static int ndisc_router_process_default(Link *link, sd_ndisc_router *rt) { _cleanup_(route_freep) Route *route = NULL; union in_addr_union gateway; uint16_t lifetime; unsigned preference; uint32_t mtu; usec_t time_now; int r; Address *address; Iterator i; assert(link); assert(rt); r = sd_ndisc_router_get_lifetime(rt, &lifetime); if (r < 0) return log_link_warning_errno(link, r, "Failed to get gateway address from RA: %m"); if (lifetime == 0) /* not a default router */ return 0; r = sd_ndisc_router_get_address(rt, &gateway.in6); if (r < 0) return log_link_warning_errno(link, r, "Failed to get gateway address from RA: %m"); SET_FOREACH(address, link->addresses, i) { if (address->family != AF_INET6) continue; if (in_addr_equal(AF_INET6, &gateway, &address->in_addr)) { _cleanup_free_ char *buffer = NULL; (void) in_addr_to_string(AF_INET6, &address->in_addr, &buffer); log_link_debug(link, "No NDisc route added, gateway %s matches local address", strnull(buffer)); return 0; } } SET_FOREACH(address, link->addresses_foreign, i) { if (address->family != AF_INET6) continue; if (in_addr_equal(AF_INET6, &gateway, &address->in_addr)) { _cleanup_free_ char *buffer = NULL; (void) in_addr_to_string(AF_INET6, &address->in_addr, &buffer); log_link_debug(link, "No NDisc route added, gateway %s matches local address", strnull(buffer)); return 0; } } r = sd_ndisc_router_get_preference(rt, &preference); if (r < 0) return log_link_warning_errno(link, r, "Failed to get default router preference from RA: %m"); r = sd_ndisc_router_get_timestamp(rt, clock_boottime_or_monotonic(), &time_now); if (r < 0) return log_link_warning_errno(link, r, "Failed to get RA timestamp: %m"); r = sd_ndisc_router_get_mtu(rt, &mtu); if (r == -ENODATA) mtu = 0; else if (r < 0) return log_link_warning_errno(link, r, "Failed to get default router MTU from RA: %m"); r = route_new(&route); if (r < 0) return log_link_error_errno(link, r, "Could not allocate route: %m"); route->family = AF_INET6; route->table = link_get_ipv6_accept_ra_route_table(link); route->priority = link->network->dhcp_route_metric; route->protocol = RTPROT_RA; route->pref = preference; route->gw = gateway; route->lifetime = time_now + lifetime * USEC_PER_SEC; route->mtu = mtu; r = route_configure(route, link, ndisc_netlink_route_message_handler); if (r < 0) { log_link_warning_errno(link, r, "Could not set default route: %m"); link_enter_failed(link); return r; } if (r > 0) link->ndisc_messages++; Route *route_gw; LIST_FOREACH(routes, route_gw, link->network->static_routes) { if (!route_gw->gateway_from_dhcp) continue; if (route_gw->family != AF_INET6) continue; route_gw->gw = gateway; r = route_configure(route_gw, link, ndisc_netlink_route_message_handler); if (r < 0) { log_link_error_errno(link, r, "Could not set gateway: %m"); link_enter_failed(link); return r; } if (r > 0) link->ndisc_messages++; } return 0; } static int ndisc_router_generate_address(Link *link, unsigned prefixlen, uint32_t lifetime_preferred, Address *address) { bool prefix = false; struct in6_addr addr; IPv6Token *j; Iterator i; int r; assert(address); assert(link); addr = address->in_addr.in6; ORDERED_HASHMAP_FOREACH(j, link->network->ipv6_tokens, i) if (j->address_generation_type == IPV6_TOKEN_ADDRESS_GENERATION_PREFIXSTABLE && memcmp(&j->prefix, &addr, FAMILY_ADDRESS_SIZE(address->family)) == 0) { for (; j->dad_counter < DAD_CONFLICTS_IDGEN_RETRIES_RFC7217; j->dad_counter++) { r = make_stableprivate_address(link, &j->prefix, prefixlen, j->dad_counter, &address->in_addr.in6); if (r < 0) return r; if (stableprivate_address_is_valid(&address->in_addr.in6)) { prefix = true; break; } } } else if (j->address_generation_type == IPV6_TOKEN_ADDRESS_GENERATION_STATIC) { memcpy(((uint8_t *)&address->in_addr.in6) + 8, ((uint8_t *) &j->prefix) + 8, 8); prefix = true; break; } /* fallback to eui64 if prefixstable or static do not match */ if (!prefix) { /* see RFC4291 section 2.5.1 */ address->in_addr.in6.s6_addr[8] = link->mac.ether_addr_octet[0]; address->in_addr.in6.s6_addr[8] ^= 1 << 1; address->in_addr.in6.s6_addr[9] = link->mac.ether_addr_octet[1]; address->in_addr.in6.s6_addr[10] = link->mac.ether_addr_octet[2]; address->in_addr.in6.s6_addr[11] = 0xff; address->in_addr.in6.s6_addr[12] = 0xfe; address->in_addr.in6.s6_addr[13] = link->mac.ether_addr_octet[3]; address->in_addr.in6.s6_addr[14] = link->mac.ether_addr_octet[4]; address->in_addr.in6.s6_addr[15] = link->mac.ether_addr_octet[5]; } address->prefixlen = prefixlen; address->flags = IFA_F_NOPREFIXROUTE|IFA_F_MANAGETEMPADDR; address->cinfo.ifa_prefered = lifetime_preferred; return 0; } static int ndisc_router_process_autonomous_prefix(Link *link, sd_ndisc_router *rt) { uint32_t lifetime_valid, lifetime_preferred, lifetime_remaining; _cleanup_(address_freep) Address *address = NULL; Address *existing_address; unsigned prefixlen; usec_t time_now; int r; assert(link); assert(rt); r = sd_ndisc_router_get_timestamp(rt, clock_boottime_or_monotonic(), &time_now); if (r < 0) return log_link_warning_errno(link, r, "Failed to get RA timestamp: %m"); r = sd_ndisc_router_prefix_get_prefixlen(rt, &prefixlen); if (r < 0) return log_link_error_errno(link, r, "Failed to get prefix length: %m"); r = sd_ndisc_router_prefix_get_valid_lifetime(rt, &lifetime_valid); if (r < 0) return log_link_error_errno(link, r, "Failed to get prefix valid lifetime: %m"); r = sd_ndisc_router_prefix_get_preferred_lifetime(rt, &lifetime_preferred); if (r < 0) return log_link_error_errno(link, r, "Failed to get prefix preferred lifetime: %m"); /* The preferred lifetime is never greater than the valid lifetime */ if (lifetime_preferred > lifetime_valid) return 0; r = address_new(&address); if (r < 0) return log_link_error_errno(link, r, "Could not allocate address: %m"); address->family = AF_INET6; r = sd_ndisc_router_prefix_get_address(rt, &address->in_addr.in6); if (r < 0) return log_link_error_errno(link, r, "Failed to get prefix address: %m"); r = ndisc_router_generate_address(link, prefixlen, lifetime_preferred, address); if (r < 0) return log_link_error_errno(link, r, "Falied to generate prefix stable address: %m"); /* see RFC4862 section 5.5.3.e */ r = address_get(link, address->family, &address->in_addr, address->prefixlen, &existing_address); if (r > 0) { lifetime_remaining = existing_address->cinfo.tstamp / 100 + existing_address->cinfo.ifa_valid - time_now / USEC_PER_SEC; if (lifetime_valid > NDISC_PREFIX_LFT_MIN || lifetime_valid > lifetime_remaining) address->cinfo.ifa_valid = lifetime_valid; else if (lifetime_remaining <= NDISC_PREFIX_LFT_MIN) address->cinfo.ifa_valid = lifetime_remaining; else address->cinfo.ifa_valid = NDISC_PREFIX_LFT_MIN; } else if (lifetime_valid > 0) address->cinfo.ifa_valid = lifetime_valid; else return 0; /* see RFC4862 section 5.5.3.d */ if (address->cinfo.ifa_valid == 0) return 0; r = address_configure(address, link, ndisc_netlink_address_message_handler, true); if (r < 0) { log_link_warning_errno(link, r, "Could not set SLAAC address: %m"); link_enter_failed(link); return r; } if (r > 0) link->ndisc_messages++; return 0; } static int ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt) { _cleanup_(route_freep) Route *route = NULL; usec_t time_now; uint32_t lifetime; unsigned prefixlen; int r; assert(link); assert(rt); r = sd_ndisc_router_get_timestamp(rt, clock_boottime_or_monotonic(), &time_now); if (r < 0) return log_link_warning_errno(link, r, "Failed to get RA timestamp: %m"); r = sd_ndisc_router_prefix_get_prefixlen(rt, &prefixlen); if (r < 0) return log_link_error_errno(link, r, "Failed to get prefix length: %m"); r = sd_ndisc_router_prefix_get_valid_lifetime(rt, &lifetime); if (r < 0) return log_link_error_errno(link, r, "Failed to get prefix lifetime: %m"); r = route_new(&route); if (r < 0) return log_link_error_errno(link, r, "Could not allocate route: %m"); route->family = AF_INET6; route->table = link_get_ipv6_accept_ra_route_table(link); route->priority = link->network->dhcp_route_metric; route->protocol = RTPROT_RA; route->flags = RTM_F_PREFIX; route->dst_prefixlen = prefixlen; route->lifetime = time_now + lifetime * USEC_PER_SEC; r = sd_ndisc_router_prefix_get_address(rt, &route->dst.in6); if (r < 0) return log_link_error_errno(link, r, "Failed to get prefix address: %m"); r = route_configure(route, link, ndisc_netlink_route_message_handler); if (r < 0) { log_link_warning_errno(link, r, "Could not set prefix route: %m"); link_enter_failed(link); return r; } if (r > 0) link->ndisc_messages++; return 0; } static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) { _cleanup_(route_freep) Route *route = NULL; struct in6_addr gateway; uint32_t lifetime; unsigned preference, prefixlen; usec_t time_now; int r; assert(link); r = sd_ndisc_router_route_get_lifetime(rt, &lifetime); if (r < 0) return log_link_warning_errno(link, r, "Failed to get gateway address from RA: %m"); if (lifetime == 0) return 0; r = sd_ndisc_router_get_address(rt, &gateway); if (r < 0) return log_link_warning_errno(link, r, "Failed to get gateway address from RA: %m"); r = sd_ndisc_router_route_get_prefixlen(rt, &prefixlen); if (r < 0) return log_link_warning_errno(link, r, "Failed to get route prefix length: %m"); r = sd_ndisc_router_route_get_preference(rt, &preference); if (r < 0) return log_link_warning_errno(link, r, "Failed to get default router preference from RA: %m"); r = sd_ndisc_router_get_timestamp(rt, clock_boottime_or_monotonic(), &time_now); if (r < 0) return log_link_warning_errno(link, r, "Failed to get RA timestamp: %m"); r = route_new(&route); if (r < 0) return log_link_error_errno(link, r, "Could not allocate route: %m"); route->family = AF_INET6; route->table = link_get_ipv6_accept_ra_route_table(link); route->protocol = RTPROT_RA; route->pref = preference; route->gw.in6 = gateway; route->dst_prefixlen = prefixlen; route->lifetime = time_now + lifetime * USEC_PER_SEC; r = sd_ndisc_router_route_get_address(rt, &route->dst.in6); if (r < 0) return log_link_error_errno(link, r, "Failed to get route address: %m"); r = route_configure(route, link, ndisc_netlink_route_message_handler); if (r < 0) { log_link_warning_errno(link, r, "Could not set additional route: %m"); link_enter_failed(link); return r; } if (r > 0) link->ndisc_messages++; return 0; } static void ndisc_rdnss_hash_func(const NDiscRDNSS *x, struct siphash *state) { siphash24_compress(&x->address, sizeof(x->address), state); } static int ndisc_rdnss_compare_func(const NDiscRDNSS *a, const NDiscRDNSS *b) { return memcmp(&a->address, &b->address, sizeof(a->address)); } DEFINE_PRIVATE_HASH_OPS(ndisc_rdnss_hash_ops, NDiscRDNSS, ndisc_rdnss_hash_func, ndisc_rdnss_compare_func); static int ndisc_router_process_rdnss(Link *link, sd_ndisc_router *rt) { uint32_t lifetime; const struct in6_addr *a; usec_t time_now; int i, n, r; assert(link); assert(rt); r = sd_ndisc_router_get_timestamp(rt, clock_boottime_or_monotonic(), &time_now); if (r < 0) return log_link_warning_errno(link, r, "Failed to get RA timestamp: %m"); r = sd_ndisc_router_rdnss_get_lifetime(rt, &lifetime); if (r < 0) return log_link_warning_errno(link, r, "Failed to get RDNSS lifetime: %m"); n = sd_ndisc_router_rdnss_get_addresses(rt, &a); if (n < 0) return log_link_warning_errno(link, n, "Failed to get RDNSS addresses: %m"); for (i = 0; i < n; i++) { _cleanup_free_ NDiscRDNSS *x = NULL; NDiscRDNSS d = { .address = a[i], }, *y; if (lifetime == 0) { (void) set_remove(link->ndisc_rdnss, &d); link_dirty(link); continue; } y = set_get(link->ndisc_rdnss, &d); if (y) { y->valid_until = time_now + lifetime * USEC_PER_SEC; continue; } ndisc_vacuum(link); if (set_size(link->ndisc_rdnss) >= NDISC_RDNSS_MAX) { log_link_warning(link, "Too many RDNSS records per link, ignoring."); continue; } r = set_ensure_allocated(&link->ndisc_rdnss, &ndisc_rdnss_hash_ops); if (r < 0) return log_oom(); x = new(NDiscRDNSS, 1); if (!x) return log_oom(); *x = (NDiscRDNSS) { .address = a[i], .valid_until = time_now + lifetime * USEC_PER_SEC, }; r = set_put(link->ndisc_rdnss, x); if (r < 0) return log_oom(); TAKE_PTR(x); assert(r > 0); link_dirty(link); } return 0; } static void ndisc_dnssl_hash_func(const NDiscDNSSL *x, struct siphash *state) { siphash24_compress(NDISC_DNSSL_DOMAIN(x), strlen(NDISC_DNSSL_DOMAIN(x)), state); } static int ndisc_dnssl_compare_func(const NDiscDNSSL *a, const NDiscDNSSL *b) { return strcmp(NDISC_DNSSL_DOMAIN(a), NDISC_DNSSL_DOMAIN(b)); } DEFINE_PRIVATE_HASH_OPS(ndisc_dnssl_hash_ops, NDiscDNSSL, ndisc_dnssl_hash_func, ndisc_dnssl_compare_func); static void ndisc_router_process_dnssl(Link *link, sd_ndisc_router *rt) { _cleanup_strv_free_ char **l = NULL; uint32_t lifetime; usec_t time_now; char **i; int r; assert(link); assert(rt); r = sd_ndisc_router_get_timestamp(rt, clock_boottime_or_monotonic(), &time_now); if (r < 0) { log_link_warning_errno(link, r, "Failed to get RA timestamp: %m"); return; } r = sd_ndisc_router_dnssl_get_lifetime(rt, &lifetime); if (r < 0) { log_link_warning_errno(link, r, "Failed to get RDNSS lifetime: %m"); return; } r = sd_ndisc_router_dnssl_get_domains(rt, &l); if (r < 0) { log_link_warning_errno(link, r, "Failed to get RDNSS addresses: %m"); return; } STRV_FOREACH(i, l) { _cleanup_free_ NDiscDNSSL *s; NDiscDNSSL *x; s = malloc0(ALIGN(sizeof(NDiscDNSSL)) + strlen(*i) + 1); if (!s) { log_oom(); return; } strcpy(NDISC_DNSSL_DOMAIN(s), *i); if (lifetime == 0) { (void) set_remove(link->ndisc_dnssl, s); link_dirty(link); continue; } x = set_get(link->ndisc_dnssl, s); if (x) { x->valid_until = time_now + lifetime * USEC_PER_SEC; continue; } ndisc_vacuum(link); if (set_size(link->ndisc_dnssl) >= NDISC_DNSSL_MAX) { log_link_warning(link, "Too many DNSSL records per link, ignoring."); continue; } r = set_ensure_allocated(&link->ndisc_dnssl, &ndisc_dnssl_hash_ops); if (r < 0) { log_oom(); return; } s->valid_until = time_now + lifetime * USEC_PER_SEC; r = set_put(link->ndisc_dnssl, s); if (r < 0) { log_oom(); return; } s = NULL; assert(r > 0); link_dirty(link); } } static int ndisc_router_process_options(Link *link, sd_ndisc_router *rt) { int r; assert(link); assert(link->network); assert(rt); r = sd_ndisc_router_option_rewind(rt); for (;;) { uint8_t type; if (r < 0) return log_link_warning_errno(link, r, "Failed to iterate through options: %m"); if (r == 0) /* EOF */ break; r = sd_ndisc_router_option_get_type(rt, &type); if (r < 0) return log_link_warning_errno(link, r, "Failed to get RA option type: %m"); switch (type) { case SD_NDISC_OPTION_PREFIX_INFORMATION: { union in_addr_union a; uint8_t flags; r = sd_ndisc_router_prefix_get_address(rt, &a.in6); if (r < 0) return log_link_error_errno(link, r, "Failed to get prefix address: %m"); if (set_contains(link->network->ndisc_black_listed_prefix, &a.in6)) { if (DEBUG_LOGGING) { _cleanup_free_ char *b = NULL; (void) in_addr_to_string(AF_INET6, &a, &b); log_link_debug(link, "Prefix '%s' is black listed, ignoring", strna(b)); } break; } r = sd_ndisc_router_prefix_get_flags(rt, &flags); if (r < 0) return log_link_warning_errno(link, r, "Failed to get RA prefix flags: %m"); if (link->network->ipv6_accept_ra_use_onlink_prefix && FLAGS_SET(flags, ND_OPT_PI_FLAG_ONLINK)) (void) ndisc_router_process_onlink_prefix(link, rt); if (link->network->ipv6_accept_ra_use_autonomous_prefix && FLAGS_SET(flags, ND_OPT_PI_FLAG_AUTO)) (void) ndisc_router_process_autonomous_prefix(link, rt); break; } case SD_NDISC_OPTION_ROUTE_INFORMATION: (void) ndisc_router_process_route(link, rt); break; case SD_NDISC_OPTION_RDNSS: if (link->network->ipv6_accept_ra_use_dns) (void) ndisc_router_process_rdnss(link, rt); break; case SD_NDISC_OPTION_DNSSL: if (link->network->ipv6_accept_ra_use_dns) (void) ndisc_router_process_dnssl(link, rt); break; } r = sd_ndisc_router_option_next(rt); } return 0; } static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) { uint64_t flags; int r; assert(link); assert(link->network); assert(link->manager); assert(rt); r = sd_ndisc_router_get_flags(rt, &flags); if (r < 0) return log_link_warning_errno(link, r, "Failed to get RA flags: %m"); if (flags & (ND_RA_FLAG_MANAGED | ND_RA_FLAG_OTHER)) { /* (re)start DHCPv6 client in stateful or stateless mode according to RA flags */ r = dhcp6_request_address(link, !(flags & ND_RA_FLAG_MANAGED)); if (r < 0 && r != -EBUSY) log_link_warning_errno(link, r, "Could not acquire DHCPv6 lease on NDisc request: %m"); else { log_link_debug(link, "Acquiring DHCPv6 lease on NDisc request"); r = 0; } } (void) ndisc_router_process_default(link, rt); (void) ndisc_router_process_options(link, rt); return r; } static void ndisc_handler(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata) { Link *link = userdata; assert(link); if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)) return; switch (event) { case SD_NDISC_EVENT_ROUTER: (void) ndisc_router_handler(link, rt); break; case SD_NDISC_EVENT_TIMEOUT: link->ndisc_configured = true; link_check_ready(link); break; default: log_link_warning(link, "IPv6 Neighbor Discovery unknown event: %d", event); } } int ndisc_configure(Link *link) { int r; assert(link); r = sd_ndisc_new(&link->ndisc); if (r < 0) return r; r = sd_ndisc_attach_event(link->ndisc, NULL, 0); if (r < 0) return r; r = sd_ndisc_set_mac(link->ndisc, &link->mac); if (r < 0) return r; r = sd_ndisc_set_ifindex(link->ndisc, link->ifindex); if (r < 0) return r; r = sd_ndisc_set_callback(link->ndisc, ndisc_handler, link); if (r < 0) return r; return 0; } void ndisc_vacuum(Link *link) { NDiscRDNSS *r; NDiscDNSSL *d; Iterator i; usec_t time_now; assert(link); /* Removes all RDNSS and DNSSL entries whose validity time has passed */ time_now = now(clock_boottime_or_monotonic()); SET_FOREACH(r, link->ndisc_rdnss, i) if (r->valid_until < time_now) { free(set_remove(link->ndisc_rdnss, r)); link_dirty(link); } SET_FOREACH(d, link->ndisc_dnssl, i) if (d->valid_until < time_now) { free(set_remove(link->ndisc_dnssl, d)); link_dirty(link); } } void ndisc_flush(Link *link) { assert(link); /* Removes all RDNSS and DNSSL entries, without exception */ link->ndisc_rdnss = set_free_free(link->ndisc_rdnss); link->ndisc_dnssl = set_free_free(link->ndisc_dnssl); } int ipv6token_new(IPv6Token **ret) { IPv6Token *p; p = new(IPv6Token, 1); if (!p) return -ENOMEM; *p = (IPv6Token) { .address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_NONE, }; *ret = TAKE_PTR(p); return 0; } DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR( ipv6_token_hash_ops, void, trivial_hash_func, trivial_compare_func, IPv6Token, free); int config_parse_ndisc_black_listed_prefix( const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata) { Network *network = data; const char *p; int r; assert(filename); assert(lvalue); assert(rvalue); assert(data); if (isempty(rvalue)) { network->ndisc_black_listed_prefix = set_free_free(network->ndisc_black_listed_prefix); return 0; } for (p = rvalue;;) { _cleanup_free_ char *n = NULL; _cleanup_free_ struct in6_addr *a = NULL; union in_addr_union ip; r = extract_first_word(&p, &n, NULL, 0); if (r < 0) { log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse NDISC black listed prefix, ignoring assignment: %s", rvalue); return 0; } if (r == 0) return 0; r = in_addr_from_string(AF_INET6, n, &ip); if (r < 0) { log_syntax(unit, LOG_ERR, filename, line, r, "NDISC black listed prefix is invalid, ignoring assignment: %s", n); continue; } if (set_contains(network->ndisc_black_listed_prefix, &ip.in6)) continue; r = set_ensure_allocated(&network->ndisc_black_listed_prefix, &in6_addr_hash_ops); if (r < 0) return log_oom(); a = newdup(struct in6_addr, &ip.in6, 1); if (!a) return log_oom(); r = set_put(network->ndisc_black_listed_prefix, a); if (r < 0) { log_syntax(unit, LOG_ERR, filename, line, r, "Failed to store NDISC black listed prefix '%s', ignoring assignment: %m", n); continue; } TAKE_PTR(a); } return 0; } int config_parse_address_generation_type( const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata) { _cleanup_free_ IPv6Token *token = NULL; _cleanup_free_ char *word = NULL; union in_addr_union buffer; Network *network = data; const char *p; int r; assert(filename); assert(lvalue); assert(rvalue); assert(data); if (isempty(rvalue)) { network->ipv6_tokens = ordered_hashmap_free(network->ipv6_tokens); return 0; } p = rvalue; r = extract_first_word(&p, &word, ":", 0); if (r == -ENOMEM) return log_oom(); if (r <= 0) { log_syntax(unit, LOG_ERR, filename, line, r, "Invalid IPv6Token= , ignoring assignment: %s", rvalue); return 0; } r = ipv6token_new(&token); if (r < 0) return log_oom(); if (streq(word, "static")) token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_STATIC; else if (streq(word, "prefixstable")) token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_PREFIXSTABLE; else { token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_STATIC; p = rvalue; } if (isempty(p)) { log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid IPv6Token= , ignoring assignment: %s", rvalue); return 0; } r = in_addr_from_string(AF_INET6, p, &buffer); if (r < 0) { log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse IPv6 %s, ignoring: %s", lvalue, rvalue); return 0; } if (in_addr_is_null(AF_INET6, &buffer)) { log_syntax(unit, LOG_ERR, filename, line, 0, "IPv6 %s cannot be the ANY address, ignoring: %s", lvalue, rvalue); return 0; } token->prefix = buffer.in6; r = ordered_hashmap_ensure_allocated(&network->ipv6_tokens, &ipv6_token_hash_ops); if (r < 0) return log_oom(); r = ordered_hashmap_put(network->ipv6_tokens, &token->prefix, token); if (r < 0) { log_syntax(unit, LOG_ERR, filename, line, r, "Failed to store IPv6 token '%s'", rvalue); return 0; } TAKE_PTR(token); return 0; }
fsateler/systemd
src/network/networkd-ndisc.c
C
gpl-2.0
36,536
/* * OMAP3 voltage domain data * * Copyright (C) 2007, 2010 Texas Instruments, Inc. * Rajendra Nayak <rnayak@ti.com> * Lesly A M <x0080970@ti.com> * Thara Gopinath <thara@ti.com> * * Copyright (C) 2008, 2011 Nokia Corporation * Kalle Jokiniemi * Paul Walmsley * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/kernel.h> #include <linux/err.h> #include <linux/init.h> #include <plat/common.h> #include <plat/cpu.h> #include "prm-regbits-34xx.h" #include "omap_opp_data.h" #include "voltage.h" #include "vc.h" #include "vp.h" /* * VDD data */ static const struct omap_vfsm_instance_data omap3_vdd1_vfsm_data = { .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, .voltsetup_shift = OMAP3430_SETUP_TIME1_SHIFT, .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK, }; static struct omap_vdd_info omap3_vdd1_info = { .vp_data = &omap3_vp1_data, .vc_data = &omap3_vc1_data, .vfsm = &omap3_vdd1_vfsm_data, .voltdm = { .name = "mpu", }, }; static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = { .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, .voltsetup_shift = OMAP3430_SETUP_TIME2_SHIFT, .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK, }; static struct omap_vdd_info omap3_vdd2_info = { .vp_data = &omap3_vp2_data, .vc_data = &omap3_vc2_data, .vfsm = &omap3_vdd2_vfsm_data, .voltdm = { .name = "core", }, }; /* OMAP3 VDD structures */ static struct omap_vdd_info *omap3_vdd_info[] = { &omap3_vdd1_info, &omap3_vdd2_info, }; /* OMAP3 specific voltage init functions */ static int __init omap3xxx_voltage_early_init(void) { s16 prm_mod = OMAP3430_GR_MOD; s16 prm_irqst_ocp_mod = OCP_MOD; if (!cpu_is_omap34xx()) return 0; /* * XXX Will depend on the process, validation, and binning * for the currently-running IC */ if (cpu_is_omap3630()) { omap3_vdd1_info.volt_data = omap36xx_vddmpu_volt_data; omap3_vdd2_info.volt_data = omap36xx_vddcore_volt_data; omap3_vdd1_info.dep_vdd_info = omap36xx_vddmpu_dep_info; } else { omap3_vdd1_info.volt_data = omap34xx_vddmpu_volt_data; omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data; omap3_vdd1_info.dep_vdd_info = omap34xx_vddmpu_dep_info; } return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod, omap3_vdd_info, ARRAY_SIZE(omap3_vdd_info)); }; core_initcall(omap3xxx_voltage_early_init);
adamdmcbride/Nufront_linux_kernel
arch/arm/mach-omap2/voltagedomains3xxx_data.c
C
gpl-2.0
2,485
/* Check for Checks Jesse Allison 2015 */ var checkDict = new Dict('recentChecks'); var ajaxreq; function bang() { var all_the_checks = checkDict.get('body'); post(all_the_checks.length); } function updateChecks() { ajaxreq = new XMLHttpRequest(); ajaxreq.open("GET","https://data.brla.gov/resource/g5c2-myyj.json"); ajaxreq.onreadystatechange = checksLoaded; ajaxreq.send(); } function checksLoaded() { post("loading"); if (this.readyState ==4){ var obj = JSON.parse(this.responseText); post("Object Returned: "+ obj); checkDict.setparse("body",this.responseText); post("Dictionary "+checkDict); } } function checkAmounts() { var all_the_checks = checkDict.get('body'); for(var i=0; i < all_the_checks.length; i++) { var paymentDict = new Dict(all_the_checks[i]); var payment2 = paymentDict.get('gross_pay'); debugDict.parse(paymentDict); var searchString = "body["+i+"]::gross_pay"; // body[0]::gross_pay var payment = checkDict.get(searchString); outlet(0, payment); } }
lsu-emdm/Advanced-Max
BR_Data_Gatherer/checkChecker.js
JavaScript
gpl-2.0
1,024
/* * Created on 16/06/2005 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package net.indrix.arara.servlets.photo; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import net.indrix.arara.dao.DatabaseDownException; import net.indrix.arara.model.PhotoModel; import net.indrix.arara.servlets.ServletConstants; import net.indrix.arara.vo.Photo; import org.apache.log4j.Logger; /** * @author Jeff * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class ShowOnePhotoServlet extends HttpServlet { static Logger logger = Logger.getLogger("net.indrix.aves"); public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { RequestDispatcher dispatcher = null; ServletContext context = this.getServletContext(); String nextPage = null; List errors = new ArrayList(); List messages = new ArrayList(); HttpSession session = req.getSession(); String photoId = req.getParameter("photoId"); String identificationStr = req.getParameter(ServletConstants.IDENTIFICATION_KEY); List list = null; list = (List) session.getAttribute(ServletConstants.PHOTOS_LIST); if ((photoId == null) || (list == null)) { Photo photo = getPhotoFromDatabase(errors, photoId); if (photo != null) { session.setAttribute(ServletConstants.CURRENT_PHOTO, photo); nextPage = ServletConstants.ONE_PHOTO_PAGE; } else { logger.debug("List of photos not found..."); nextPage = ServletConstants.ONE_PHOTO_PAGE_ERROR; } } else { logger.debug("List of photos found..."); Iterator it = list.iterator(); int id = Integer.parseInt(photoId); boolean found = false; Photo photo = null; while (it.hasNext() && (!found)) { photo = (Photo) it.next(); if (photo.getId() == id) { logger.debug("Photo found !!!! "); found = true; PhotoModel model = new PhotoModel(); try { model.retrievePhotoImage(photo); retrieveCommentsForPhoto(model, photo); } catch (DatabaseDownException e) { logger.debug("DatabaseDownException.....", e); errors.add(ServletConstants.DATABASE_ERROR); } catch (SQLException e) { logger.debug("SQLException.....", e); errors.add(ServletConstants.DATABASE_ERROR); } } } if (!found) { photo = getPhotoFromDatabase(errors, photoId); if (!errors.isEmpty() || photo == null) { logger.debug("Photo does not exist in DB anymore"); nextPage = ServletConstants.ONE_PHOTO_PAGE_ERROR; } } session.setAttribute(ServletConstants.CURRENT_PHOTO, photo); nextPage = ServletConstants.ONE_PHOTO_PAGE; } req.setAttribute(ServletConstants.IDENTIFICATION_KEY, identificationStr); req.setAttribute(ServletConstants.VIEW_MODE_KEY, "viewMode"); dispatcher = context.getRequestDispatcher(nextPage); logger.debug("Dispatching to " + nextPage); dispatcher.forward(req, res); } private Photo getPhotoFromDatabase(List errors, String photoId) { // retrieve from database PhotoModel model = new PhotoModel(); Photo photo = null; try { photo = model.retrieve(Integer.parseInt(photoId)); if (photo != null) { retrieveCommentsForPhoto(model, photo); } logger.debug("Photo retrieved = " + photo); } catch (NumberFormatException e) { logger.error("Could not parse photoId " + photoId); errors.add(ServletConstants.DATABASE_ERROR); } catch (DatabaseDownException e) { logger.debug("DatabaseDownException....."); errors.add(ServletConstants.DATABASE_ERROR); } catch (SQLException e) { logger.debug("SQLException.....", e); errors.add(ServletConstants.DATABASE_ERROR); } return photo; } /** * This method retrieves the comments for a given photo * * @param model * @param photo * @throws DatabaseDownException * @throws SQLException */ private void retrieveCommentsForPhoto(PhotoModel model, Photo photo) throws DatabaseDownException, SQLException { // now retrieve the comments List comments = model.retrieveCommentsForPhoto(photo); photo.setComments(comments); if ((comments == null) || (comments.isEmpty())) { logger.debug("There is no comment for photo " + photo); } else { logger.debug(comments.size() + " comments found for photo " + photo); } } }
BackupTheBerlios/arara-svn
core/tags/arara-1.0/src/main/java/net/indrix/arara/servlets/photo/ShowOnePhotoServlet.java
Java
gpl-2.0
4,954
package net.lsrp.wolfie.graphics; import net.lsrp.wolfie.Game; public class Screen { public int width, height; public int[] pixels; public Screen(int width, int height) { this.width = width; this.height = height; pixels = new int[width*height]; for(int i = 0; i < pixels.length; i++) { pixels[i] = 0xFFFFAAFF; } } public void clear() { for(int i = 0; i < pixels.length; i++) { pixels[i] = 0; } } public void renderSprite(int xp, int yp, Sprite sprite) { for(int y = 0; y < sprite.SIZE; y++) { int ya = y + yp; for(int x = 0; x < sprite.SIZE; x++) { int xa = x + xp; if(xa < -sprite.SIZE || xa >= width || ya < 0 || ya >= height) break; if(xa < 0) xa = 0; int col = sprite.pixels[x + y * sprite.SIZE]; if(col != 0xFFFF00FF) pixels[xa + ya * width] = col; } } } public void renderPlatform(int xp, int yp, int wp, Sprite sprite, Sprite sprite_l, Sprite sprite_r) { for(int y = 0; y < sprite_l.SIZE; y++) { int ya = y + yp; ya+=10; for(int x = 0; x < sprite_l.SIZE; x++) { int xa = x + xp; if(xa < -sprite_l.SIZE || xa >= width || ya < 0 || ya >= height) break; if(xa < 0) xa = 0; int col = sprite_l.pixels[x + y * sprite_l.SIZE]; if(col != 0xFFFF00FF) pixels[xa + ya * width] = col; } } for(int w = 1; w < wp - 1; w++) { for(int y = 0; y < sprite.SIZE; y++) { int ya = y + yp; ya+=10; for(int x = 0; x < sprite.SIZE; x++) { int xa = x + xp + (w << 4); if(xa < -sprite.SIZE || xa >= width || ya < 0 || ya >= height) break; if(xa < 0) xa = 0; int col = sprite.pixels[x + y * sprite.SIZE]; if(col != 0xFFFF00FF) pixels[xa + ya * width] = col; } } } for(int y = 0; y < sprite_r.SIZE; y++) { int ya = y + yp; ya+=10; for(int x = 0; x < sprite_r.SIZE; x++) { int xa = x + xp + (wp-1 << 4); if(xa < -sprite_r.SIZE || xa >= width || ya < 0 || ya >= height) break; if(xa < 0) xa = 0; int col = sprite_r.pixels[x + y * sprite_r.SIZE]; if(col != 0xFFFF00FF) pixels[xa + ya * width] = col; } } } public void renderPlatformScore(int yp, Sprite sprite) { for(int y = 0; y < sprite.SIZE; y++) { int ya = y + yp; for(int x = 0; x < sprite.SIZE; x++) { int xa = x + (Game.WIDTH/2); if(xa < -sprite.SIZE || xa >= width || ya < 0 || ya >= height) break; if(xa < 0) xa = 0; int col = sprite.pixels[x + y * sprite.SIZE]; if(col != 0xFFFF00FF) pixels[xa + ya * width] = col; } } } }
Sim00n/Wolfie
Wolfie/src/net/lsrp/wolfie/graphics/Screen.java
Java
gpl-2.0
2,587
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.contacts.list; import com.android.common.widget.CompositeCursorAdapter.Partition; import com.android.contacts.R; import com.android.contacts.util.ContactLoaderUtils; import com.android.contacts.widget.AutoScrollListView; import android.app.Activity; import android.content.ContentResolver; import android.content.ContentUris; import android.content.Loader; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.database.Cursor; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.preference.PreferenceManager; import android.provider.ContactsContract; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Directory; import android.text.TextUtils; import android.util.Log; /*Start of wangqiang on 2012-3-20 17:51 cantacts_longclick*/ import com.android.contacts.widget.ContextMenuAdapter; import android.content.Context; import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.view.ContextMenu.ContextMenuInfo; import android.widget.AdapterView; import com.android.contacts.util.PhoneCapabilityTester; /*End of wangqiang on 2012-3-20 17:51 cantacts_longclick*/ import java.util.List; /*Begin: Modified by sunrise for AddContactToBlackNumber 2012/06/07*/ import android.content.ContentValues; import java.util.ArrayList; /*End: Modified by sunrise for AddContactToBlackNumber 2012/06/07*/ /*Begin: Modified by sunrise for add and del hint 2012/08/10*/ import android.widget.Toast; /*End: Modified by sunrise for add and del hint 2012/08/10*/ /** * Fragment containing a contact list used for browsing (as compared to * picking a contact with one of the PICK intents). */ public abstract class ContactBrowseListFragment extends ContactEntryListFragment<ContactListAdapter> { private static final String TAG = "ContactList"; private static final String KEY_SELECTED_URI = "selectedUri"; private static final String KEY_SELECTION_VERIFIED = "selectionVerified"; private static final String KEY_FILTER = "filter"; private static final String KEY_LAST_SELECTED_POSITION = "lastSelected"; private static final String PERSISTENT_SELECTION_PREFIX = "defaultContactBrowserSelection"; /** * The id for a delayed message that triggers automatic selection of the first * found contact in search mode. */ private static final int MESSAGE_AUTOSELECT_FIRST_FOUND_CONTACT = 1; /** * The delay that is used for automatically selecting the first found contact. */ private static final int DELAY_AUTOSELECT_FIRST_FOUND_CONTACT_MILLIS = 500; /** * The minimum number of characters in the search query that is required * before we automatically select the first found contact. */ private static final int AUTOSELECT_FIRST_FOUND_CONTACT_MIN_QUERY_LENGTH = 2; /*Start of wangqiang on 2012-3-20 17:51 cantacts_longclick*/ private static final int MENU_ITEM_VIEW_CONTACT = 1; private static final int MENU_ITEM_CALL = 2; private static final int MENU_ITEM_SEND_SMS = 3; private static final int MENU_ITEM_EDIT = 4; private static final int MENU_ITEM_DELETE = 5; private static final int MENU_ITEM_TOGGLE_STAR = 6; /*End of wangqiang on 2012-3-20 17:51 cantacts_longclick*/ /* Begin: Modified by sunrise for AddContactToBlackNumber 2012/06/05 */ private static final int MENU_ITEM_ADD_BLACK = 7; private static final int MENU_ITEM_DEL_BLACK = 8; private String rawContactsId; /* End: Modified by sunrise for AddContactToBlackNumber 2012/06/05 */ private SharedPreferences mPrefs; private Handler mHandler; private boolean mStartedLoading; private boolean mSelectionRequired; private boolean mSelectionToScreenRequested; private boolean mSmoothScrollRequested; private boolean mSelectionPersistenceRequested; private Uri mSelectedContactUri; private long mSelectedContactDirectoryId; private String mSelectedContactLookupKey; private long mSelectedContactId; private boolean mSelectionVerified; private int mLastSelectedPosition = -1; private boolean mRefreshingContactUri; private ContactListFilter mFilter; private String mPersistentSelectionPrefix = PERSISTENT_SELECTION_PREFIX; protected OnContactBrowserActionListener mListener; private ContactLookupTask mContactLookupTask; private final class ContactLookupTask extends AsyncTask<Void, Void, Uri> { private final Uri mUri; private boolean mIsCancelled; public ContactLookupTask(Uri uri) { mUri = uri; } @Override protected Uri doInBackground(Void... args) { Cursor cursor = null; try { final ContentResolver resolver = getContext().getContentResolver(); final Uri uriCurrentFormat = ContactLoaderUtils.ensureIsContactUri(resolver, mUri); cursor = resolver.query(uriCurrentFormat, new String[] { Contacts._ID, Contacts.LOOKUP_KEY }, null, null, null); if (cursor != null && cursor.moveToFirst()) { final long contactId = cursor.getLong(0); final String lookupKey = cursor.getString(1); if (contactId != 0 && !TextUtils.isEmpty(lookupKey)) { return Contacts.getLookupUri(contactId, lookupKey); } } Log.e(TAG, "Error: No contact ID or lookup key for contact " + mUri); return null; } finally { if (cursor != null) { cursor.close(); } } } public void cancel() { super.cancel(true); // Use a flag to keep track of whether the {@link AsyncTask} was cancelled or not in // order to ensure onPostExecute() is not executed after the cancel request. The flag is // necessary because {@link AsyncTask} still calls onPostExecute() if the cancel request // came after the worker thread was finished. mIsCancelled = true; } @Override protected void onPostExecute(Uri uri) { // Make sure the {@link Fragment} is at least still attached to the {@link Activity} // before continuing. Null URIs should still be allowed so that the list can be // refreshed and a default contact can be selected (i.e. the case of deleted // contacts). if (mIsCancelled || !isAdded()) { return; } onContactUriQueryFinished(uri); } } private boolean mDelaySelection; private Handler getHandler() { if (mHandler == null) { mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case MESSAGE_AUTOSELECT_FIRST_FOUND_CONTACT: selectDefaultContact(); break; } } }; } return mHandler; } @Override public void onAttach(Activity activity) { super.onAttach(activity); mPrefs = PreferenceManager.getDefaultSharedPreferences(activity); restoreFilter(); restoreSelectedUri(false); } @Override protected void setSearchMode(boolean flag) { if (isSearchMode() != flag) { if (!flag) { restoreSelectedUri(true); } super.setSearchMode(flag); } } public void setFilter(ContactListFilter filter) { setFilter(filter, true); } public void setFilter(ContactListFilter filter, boolean restoreSelectedUri) { if (mFilter == null && filter == null) { return; } if (mFilter != null && mFilter.equals(filter)) { return; } Log.v(TAG, "New filter: " + filter); mFilter = filter; mLastSelectedPosition = -1; saveFilter(); if (restoreSelectedUri) { mSelectedContactUri = null; restoreSelectedUri(true); } reloadData(); } public ContactListFilter getFilter() { return mFilter; } @Override public void restoreSavedState(Bundle savedState) { super.restoreSavedState(savedState); if (savedState == null) { return; } mFilter = savedState.getParcelable(KEY_FILTER); mSelectedContactUri = savedState.getParcelable(KEY_SELECTED_URI); mSelectionVerified = savedState.getBoolean(KEY_SELECTION_VERIFIED); mLastSelectedPosition = savedState.getInt(KEY_LAST_SELECTED_POSITION); parseSelectedContactUri(); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(KEY_FILTER, mFilter); outState.putParcelable(KEY_SELECTED_URI, mSelectedContactUri); outState.putBoolean(KEY_SELECTION_VERIFIED, mSelectionVerified); outState.putInt(KEY_LAST_SELECTED_POSITION, mLastSelectedPosition); } protected void refreshSelectedContactUri() { if (mContactLookupTask != null) { mContactLookupTask.cancel(); } if (!isSelectionVisible()) { return; } mRefreshingContactUri = true; if (mSelectedContactUri == null) { onContactUriQueryFinished(null); return; } if (mSelectedContactDirectoryId != Directory.DEFAULT && mSelectedContactDirectoryId != Directory.LOCAL_INVISIBLE) { onContactUriQueryFinished(mSelectedContactUri); } else { mContactLookupTask = new ContactLookupTask(mSelectedContactUri); mContactLookupTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[])null); } } protected void onContactUriQueryFinished(Uri uri) { mRefreshingContactUri = false; mSelectedContactUri = uri; parseSelectedContactUri(); checkSelection(); } @Override protected void prepareEmptyView() { if (isSearchMode()) { return; } else if (isSyncActive()) { if (hasIccCard()) { setEmptyText(R.string.noContactsHelpTextWithSync); } else { setEmptyText(R.string.noContactsNoSimHelpTextWithSync); } } else { if (hasIccCard()) { setEmptyText(R.string.noContactsHelpText); } else { setEmptyText(R.string.noContactsNoSimHelpText); } } } public Uri getSelectedContactUri() { return mSelectedContactUri; } /** * Sets the new selection for the list. */ public void setSelectedContactUri(Uri uri) { setSelectedContactUri(uri, true, true, true, false); } @Override public void setQueryString(String queryString, boolean delaySelection) { mDelaySelection = delaySelection; super.setQueryString(queryString, delaySelection); } /** * Sets whether or not a contact selection must be made. * @param required if true, we need to check if the selection is present in * the list and if not notify the listener so that it can load a * different list. * TODO: Figure out how to reconcile this with {@link #setSelectedContactUri}, * without causing unnecessary loading of the list if the selected contact URI is * the same as before. */ public void setSelectionRequired(boolean required) { mSelectionRequired = required; } /** * Sets the new contact selection. * * @param uri the new selection * @param required if true, we need to check if the selection is present in * the list and if not notify the listener so that it can load a * different list * @param smoothScroll if true, the UI will roll smoothly to the new * selection * @param persistent if true, the selection will be stored in shared * preferences. * @param willReloadData if true, the selection will be remembered but not * actually shown, because we are expecting that the data will be * reloaded momentarily */ private void setSelectedContactUri(Uri uri, boolean required, boolean smoothScroll, boolean persistent, boolean willReloadData) { mSmoothScrollRequested = smoothScroll; mSelectionToScreenRequested = true; if ((mSelectedContactUri == null && uri != null) || (mSelectedContactUri != null && !mSelectedContactUri.equals(uri))) { mSelectionVerified = false; mSelectionRequired = required; mSelectionPersistenceRequested = persistent; mSelectedContactUri = uri; parseSelectedContactUri(); if (!willReloadData) { // Configure the adapter to show the selection based on the // lookup key extracted from the URI ContactListAdapter adapter = getAdapter(); if (adapter != null) { adapter.setSelectedContact(mSelectedContactDirectoryId, mSelectedContactLookupKey, mSelectedContactId); getListView().invalidateViews(); } } // Also, launch a loader to pick up a new lookup URI in case it has changed refreshSelectedContactUri(); } } private void parseSelectedContactUri() { if (mSelectedContactUri != null) { String directoryParam = mSelectedContactUri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY); mSelectedContactDirectoryId = TextUtils.isEmpty(directoryParam) ? Directory.DEFAULT : Long.parseLong(directoryParam); if (mSelectedContactUri.toString().startsWith(Contacts.CONTENT_LOOKUP_URI.toString())) { List<String> pathSegments = mSelectedContactUri.getPathSegments(); mSelectedContactLookupKey = Uri.encode(pathSegments.get(2)); if (pathSegments.size() == 4) { mSelectedContactId = ContentUris.parseId(mSelectedContactUri); } } else if (mSelectedContactUri.toString().startsWith(Contacts.CONTENT_URI.toString()) && mSelectedContactUri.getPathSegments().size() >= 2) { mSelectedContactLookupKey = null; mSelectedContactId = ContentUris.parseId(mSelectedContactUri); } else { Log.e(TAG, "Unsupported contact URI: " + mSelectedContactUri); mSelectedContactLookupKey = null; mSelectedContactId = 0; } } else { mSelectedContactDirectoryId = Directory.DEFAULT; mSelectedContactLookupKey = null; mSelectedContactId = 0; } } @Override protected void configureAdapter() { super.configureAdapter(); ContactListAdapter adapter = getAdapter(); if (adapter == null) { return; } boolean searchMode = isSearchMode(); if (!searchMode && mFilter != null) { adapter.setFilter(mFilter); if (mSelectionRequired || mFilter.filterType == ContactListFilter.FILTER_TYPE_SINGLE_CONTACT) { adapter.setSelectedContact( mSelectedContactDirectoryId, mSelectedContactLookupKey, mSelectedContactId); } } // Display the user's profile if not in search mode adapter.setIncludeProfile(!searchMode); } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { super.onLoadFinished(loader, data); mSelectionVerified = false; // Refresh the currently selected lookup in case it changed while we were sleeping refreshSelectedContactUri(); } @Override public void onLoaderReset(Loader<Cursor> loader) { } private void checkSelection() { if (mSelectionVerified) { return; } if (mRefreshingContactUri) { return; } if (isLoadingDirectoryList()) { return; } ContactListAdapter adapter = getAdapter(); if (adapter == null) { return; } boolean directoryLoading = true; int count = adapter.getPartitionCount(); for (int i = 0; i < count; i++) { Partition partition = adapter.getPartition(i); if (partition instanceof DirectoryPartition) { DirectoryPartition directory = (DirectoryPartition) partition; if (directory.getDirectoryId() == mSelectedContactDirectoryId) { directoryLoading = directory.isLoading(); break; } } } if (directoryLoading) { return; } adapter.setSelectedContact( mSelectedContactDirectoryId, mSelectedContactLookupKey, mSelectedContactId); final int selectedPosition = adapter.getSelectedContactPosition(); if (selectedPosition != -1) { mLastSelectedPosition = selectedPosition; } else { if (isSearchMode()) { if (mDelaySelection) { selectFirstFoundContactAfterDelay(); if (mListener != null) { mListener.onSelectionChange(); } return; } } else if (mSelectionRequired) { // A specific contact was requested, but it's not in the loaded list. // Try reconfiguring and reloading the list that will hopefully contain // the requested contact. Only take one attempt to avoid an infinite loop // in case the contact cannot be found at all. mSelectionRequired = false; // If we were looking at a different specific contact, just reload if (mFilter != null && mFilter.filterType == ContactListFilter.FILTER_TYPE_SINGLE_CONTACT) { reloadData(); } else { // Otherwise, call the listener, which will adjust the filter. notifyInvalidSelection(); } return; } else if (mFilter != null && mFilter.filterType == ContactListFilter.FILTER_TYPE_SINGLE_CONTACT) { // If we were trying to load a specific contact, but that contact no longer // exists, call the listener, which will adjust the filter. notifyInvalidSelection(); return; } saveSelectedUri(null); selectDefaultContact(); } mSelectionRequired = false; mSelectionVerified = true; if (mSelectionPersistenceRequested) { saveSelectedUri(mSelectedContactUri); mSelectionPersistenceRequested = false; } if (mSelectionToScreenRequested) { requestSelectionToScreen(selectedPosition); } getListView().invalidateViews(); if (mListener != null) { mListener.onSelectionChange(); } } /** * Automatically selects the first found contact in search mode. The selection * is updated after a delay to allow the user to type without to much UI churn * and to save bandwidth on directory queries. */ public void selectFirstFoundContactAfterDelay() { Handler handler = getHandler(); handler.removeMessages(MESSAGE_AUTOSELECT_FIRST_FOUND_CONTACT); String queryString = getQueryString(); if (queryString != null && queryString.length() >= AUTOSELECT_FIRST_FOUND_CONTACT_MIN_QUERY_LENGTH) { handler.sendEmptyMessageDelayed(MESSAGE_AUTOSELECT_FIRST_FOUND_CONTACT, DELAY_AUTOSELECT_FIRST_FOUND_CONTACT_MILLIS); } else { setSelectedContactUri(null, false, false, false, false); } } protected void selectDefaultContact() { Uri contactUri = null; ContactListAdapter adapter = getAdapter(); if (mLastSelectedPosition != -1) { int count = adapter.getCount(); int pos = mLastSelectedPosition; if (pos >= count && count > 0) { pos = count - 1; } contactUri = adapter.getContactUri(pos); } if (contactUri == null) { contactUri = adapter.getFirstContactUri(); } setSelectedContactUri(contactUri, false, mSmoothScrollRequested, false, false); } protected void requestSelectionToScreen(int selectedPosition) { if (selectedPosition != -1) { AutoScrollListView listView = (AutoScrollListView)getListView(); listView.requestPositionToScreen( selectedPosition + listView.getHeaderViewsCount(), mSmoothScrollRequested); mSelectionToScreenRequested = false; } } @Override public boolean isLoading() { return mRefreshingContactUri || super.isLoading(); } @Override protected void startLoading() { mStartedLoading = true; mSelectionVerified = false; super.startLoading(); } public void reloadDataAndSetSelectedUri(Uri uri) { setSelectedContactUri(uri, true, true, true, true); reloadData(); } @Override public void reloadData() { if (mStartedLoading) { mSelectionVerified = false; mLastSelectedPosition = -1; super.reloadData(); } } public void setOnContactListActionListener(OnContactBrowserActionListener listener) { mListener = listener; } public void createNewContact() { if (mListener != null) mListener.onCreateNewContactAction(); } public void viewContact(Uri contactUri) { setSelectedContactUri(contactUri, false, false, true, false); if (mListener != null) mListener.onViewContactAction(contactUri); } public void editContact(Uri contactUri) { if (mListener != null) mListener.onEditContactAction(contactUri); } public void deleteContact(Uri contactUri) { if (mListener != null) mListener.onDeleteContactAction(contactUri); } public void addToFavorites(Uri contactUri) { if (mListener != null) mListener.onAddToFavoritesAction(contactUri); } public void removeFromFavorites(Uri contactUri) { if (mListener != null) mListener.onRemoveFromFavoritesAction(contactUri); } public void callContact(Uri contactUri) { if (mListener != null) mListener.onCallContactAction(contactUri); } public void smsContact(Uri contactUri) { if (mListener != null) mListener.onSmsContactAction(contactUri); } private void notifyInvalidSelection() { if (mListener != null) mListener.onInvalidSelection(); } @Override protected void finish() { super.finish(); if (mListener != null) mListener.onFinishAction(); } private void saveSelectedUri(Uri contactUri) { if (isSearchMode()) { return; } ContactListFilter.storeToPreferences(mPrefs, mFilter); Editor editor = mPrefs.edit(); if (contactUri == null) { editor.remove(getPersistentSelectionKey()); } else { editor.putString(getPersistentSelectionKey(), contactUri.toString()); } editor.apply(); } private void restoreSelectedUri(boolean willReloadData) { // The meaning of mSelectionRequired is that we need to show some // selection other than the previous selection saved in shared preferences if (mSelectionRequired) { return; } String selectedUri = mPrefs.getString(getPersistentSelectionKey(), null); if (selectedUri == null) { setSelectedContactUri(null, false, false, false, willReloadData); } else { setSelectedContactUri(Uri.parse(selectedUri), false, false, false, willReloadData); } } private void saveFilter() { ContactListFilter.storeToPreferences(mPrefs, mFilter); } private void restoreFilter() { mFilter = ContactListFilter.restoreDefaultPreferences(mPrefs); } private String getPersistentSelectionKey() { if (mFilter == null) { return mPersistentSelectionPrefix; } else { return mPersistentSelectionPrefix + "-" + mFilter.getId(); } } public boolean isOptionsMenuChanged() { // This fragment does not have an option menu of its own return false; } /*Start of wangqiang on 2012-3-20 17:52 cantacts_longclick*/ @Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info; try { info = (AdapterView.AdapterContextMenuInfo) menuInfo; } catch (ClassCastException e) { Log.wtf(TAG, "Bad menuInfo", e); return; } ContactListAdapter adapter = this.getAdapter(); int headerViewsCount = this.getListView().getHeaderViewsCount(); int position = info.position - headerViewsCount; // Setup the menu header menu.setHeaderTitle(adapter.getContactDisplayName(position)); // View contact details menu.add(0, MENU_ITEM_VIEW_CONTACT, 0, R.string.menu_viewContact); //if (adapter.getHasPhoneNumber(position)) { Cursor cursor = null; try{ cursor = this.getContext().getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, "_id="+adapter.getContactId(position), null, null); }catch (Exception e) { System.out.println(e.toString()); return; } cursor.moveToFirst(); if(cursor.getInt(cursor.getColumnIndex("has_phone_number"))!=0){ final Context context = this.getContext(); boolean hasPhoneApp = PhoneCapabilityTester.isPhone(context); boolean hasSmsApp = PhoneCapabilityTester.isSmsIntentRegistered(context); // Calling contact if (hasPhoneApp) menu.add(0, MENU_ITEM_CALL, 0, R.string.menu_call); // Send SMS item if (hasSmsApp) menu.add(0, MENU_ITEM_SEND_SMS, 0, R.string.menu_sendSMS); /* Begin: Modified by sunrise for AddContactToBlackNumber 2012/06/05 */ //System.out.println("Brows--->name_raw_contact_id:" // + cursor.getColumnIndex("name_raw_contact_id")); rawContactsId = String.valueOf(cursor.getInt(cursor .getColumnIndex("name_raw_contact_id"))); Log.i(TAG, "Brows--->rawContactsId:" + rawContactsId); Uri uriBlack = Uri .parse("content://com.ahong.blackcall.AhongBlackCallProvider/black_number/contactid/" + rawContactsId); Cursor curBlack = this.getContext().getContentResolver() .query(uriBlack, null, null, null, null); if (curBlack != null && curBlack.getCount() > 0) { menu.add(0, MENU_ITEM_DEL_BLACK, 0, R.string.menu_delFromBlackList); } else { menu.add(0, MENU_ITEM_ADD_BLACK, 0, R.string.menu_addToBlackList); } curBlack.close(); /* End: Modified by sunrise for AddContactToBlackNumber 2012/06/05 */ } // Star toggling //if (!adapter.isContactStarred(position)) { if(cursor.getInt(cursor.getColumnIndex("starred"))==0){ menu.add(0, MENU_ITEM_TOGGLE_STAR, 0, R.string.menu_addStar); } else { menu.add(0, MENU_ITEM_TOGGLE_STAR, 0, R.string.menu_removeStar); } /*Begin: Modified by xiepengfei for cursor close bug 2012/06/07*/ if(cursor!=null){ cursor.close(); cursor = null; } /*End: Modified by xiepengfei for cursor close bug 2012/06/07*/ // Contact editing menu.add(0, MENU_ITEM_EDIT, 0, R.string.menu_editContact); menu.add(0, MENU_ITEM_DELETE, 0, R.string.menu_deleteContact); } @Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info; try { info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); } catch (ClassCastException e) { Log.wtf(TAG, "Bad menuInfo", e); return false; } ContactListAdapter adapter = this.getAdapter(); int headerViewsCount = this.getListView().getHeaderViewsCount(); int position = info.position - headerViewsCount; final Uri contactUri = adapter.getContactUri(position); switch (item.getItemId()) { case MENU_ITEM_VIEW_CONTACT: { this.viewContact(contactUri); return true; } case MENU_ITEM_TOGGLE_STAR: { //if (adapter.isContactStarred(position)) { Cursor cursor = this.getContext().getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, "_id="+adapter.getContactId(position), null, null); cursor.moveToFirst(); if(cursor.getInt(cursor.getColumnIndex("starred"))!=0){ this.removeFromFavorites(contactUri); } else { this.addToFavorites(contactUri); } return true; } /* Begin: Modified by sunrise for AddContactToBlackNumber 2012/06/05 */ case MENU_ITEM_ADD_BLACK: { //new Thread(new Runnable(){public void run(/* code */)}) List<String> numberArr = new ArrayList<String>(); Cursor curNumber = this .getContext() .getContentResolver() .query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.RAW_CONTACT_ID + " =?", new String[] { rawContactsId }, null); if (curNumber != null && curNumber.moveToFirst()) { do { String number = curNumber .getString(curNumber .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); numberArr.add(number); } while (curNumber.moveToNext()); curNumber.close(); Log.i(TAG, " numberArr: " + numberArr.toString()); } else { return false; } for (String number : numberArr) { ContentValues value = new ContentValues(); if (number.length() > 48) { value.put("number", number.substring(0, 47)); } else { value.put("number", number); } // value.put("name_raw_contact_id", Integer.parseInt(rawContactsId)); value.put("name_raw_contact_id", rawContactsId); //at here,the better way is combine interface function AddBlackNumber(number) Uri uriInsert = Uri .parse("content://com.ahong.blackcall.AhongBlackCallProvider/black_number/contactid/" + rawContactsId); Uri uAdd = this.getContext().getContentResolver() .insert(uriInsert, value); Log.i(TAG, uAdd.toString()); /*Begin: Modified by sunrise for add and del hint 2012/08/10*/ if (uAdd != null) { toastToBlack(R.string.add_to_black_success); } else { toastToBlack(R.string.add_to_black_fail); return false; } /*End: Modified by sunrise for add and del hint 2012/08/10*/ } return true; } case MENU_ITEM_DEL_BLACK: { if (rawContactsId != null) { Uri uriDelete = Uri .parse("content://com.ahong.blackcall.AhongBlackCallProvider/black_number"); int result = this .getContext() .getContentResolver() .delete(uriDelete, "name_raw_contact_id = ?", new String[] { rawContactsId }); Log.i(TAG, "delete line: " + result); /*Begin: Modified by sunrise for add and del hint 2012/08/10*/ if (result > 0) { toastToBlack(R.string.del_from_black_success); } else { toastToBlack(R.string.del_from_black_fail); return false; } /*End: Modified by sunrise for add and del hint 2012/08/10*/ } return true; } /* End: Modified by sunrise for AddContactToBlackNumber 2012/06/05 */ case MENU_ITEM_CALL: { this.callContact(contactUri); return true; } case MENU_ITEM_SEND_SMS: { this.smsContact(contactUri); return true; } case MENU_ITEM_EDIT: { this.editContact(contactUri); return true; } case MENU_ITEM_DELETE: { this.deleteContact(contactUri); return true; } } return false; } /*End of wangqiang on 2012-3-20 17:52 cantacts_longclick*/ /*Begin: Modified by sunrise for add and del hint 2012/08/10*/ private void toastToBlack(int resId) { Toast.makeText(this.getContext(), resId, Toast.LENGTH_SHORT).show(); } /*End: Modified by sunrise for add and del hint 2012/08/10*/ }
risingsunm/Contacts_4.0
src/com/android/contacts/list/ContactBrowseListFragment.java
Java
gpl-2.0
37,157
<?php /** * * @author G. Giunta * @copyright (C) G. Giunta 2008-2022 * @license Licensed under GNU General Public License v2.0. See file license.txt */ ob_start(); phpinfo(); $output = ob_get_contents(); ob_end_clean(); $output = preg_replace( array( '#^.*<body>#s','#</body>.*$#s' ), '', $output ); $tpl->setVariable( 'css', 'php.css' ); $tpl->setVariable( 'info', $output );
gggeek/ggsysinfo
modules/sysinfo/php.php
PHP
gpl-2.0
384
ffxiv_gather_fisher = inheritsFrom(ml_task) function ffxiv_gather_fisher.Create() local newinst = inheritsFrom(ffxiv_gather_fisher) --ml_task members newinst.valid = true newinst.completed = false newinst.subtask = nil newinst.auxiliary = false newinst.process_elements = {} newinst.overwatch_elements = {} --ffxiv_gather_fisher members newinst.name = "ARCANIST" newinst.range = 3 newinst.targetid = 0 return newinst end function ffxiv_gather_fisher:Init() --init cnes self:AddTaskCheckCEs() end function ffxiv_gather_fisher:OnSleep() end function ffxiv_gather_fisher:OnTerminate() end function ffxiv_gather_fisher:IsGoodToAbort() end
HHmmominion/basemmominion
LuaMods/ffxivminion/class_routines/ffxiv_gather_fisher.lua
Lua
gpl-2.0
720
/* Title: Vertical CSS menu with a behavior file. Author: Stefan Vervoort Blog: http://www.divitodesign.com/blog/ Article: http://www.divitodesign.com/blog/2008/01/vertical-css-menu-with-a-behavior-file/ */ #main-nav { padding:5px 0; } #nav { behavior: url(csshover.htc); font-size:11px; font-family:Arial, Helvetica, sans-serif; } p#nav a#nav { color: #000; text-decoration:underline!important; } a{ color:#000; text-decoration:none; } p a:hover{ text-decoration: none!important; } ul#nav { list-style: none; padding: 0; margin: 0; } ul#nav li a { display: block; font-weight: bold; padding: 2px 10px; background:#f9f9f9; } ul#nav li a:hover{ background:#888; color:#fff; } ul#nav li { float: right; position: relative; width: 100px; text-align: center; margin-right:5px; border:1px solid #ccc; } ul#nav li.current a{ background:#ddd; } ul#nav li.current a:hover{ background:#888; } li ul { display: none; position:absolute; width:100px; top: 18px; left: 0; font-weight: normal; padding-left: 7px; margin-left:-1px; } ul#nav li ul.sub li{ border-width:0 1px 1px 1px!important; } ul#nav li ul.sub li a{ font-weight: normal!important; } li>ul { top: auto; left: auto; } li:hover ul, li.over ul { display: block; }
iocellnetworks/netdisk-cloud
skins/default/main-nav.css
CSS
gpl-2.0
1,279
<!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"/> <meta name="generator" content="Doxygen 1.8.7"/> <title>oRTP: /Users/jehanmonnier/workspaces/workspace-iphone-port/linphone-iphone/submodules/linphone/oRTP/src/jitterctl.h Source File</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">oRTP &#160;<span id="projectnumber">0.24.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.7 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="dir_9e51036813d6151dfecc72d5fa7c02b3.html">Users</a></li><li class="navelem"><a class="el" href="dir_0086a5bc28c2c80fdd65429b30ec7201.html">jehanmonnier</a></li><li class="navelem"><a class="el" href="dir_b858f17e34ed058634411ab8c7d24549.html">workspaces</a></li><li class="navelem"><a class="el" href="dir_0b63d9ddac5e0eae8010f03443fa7c42.html">workspace-iphone-port</a></li><li class="navelem"><a class="el" href="dir_70e119ec7732bd017bc188a7129d48ee.html">linphone-iphone</a></li><li class="navelem"><a class="el" href="dir_cf4c98acb38bffd48d5ffefce9055b2c.html">submodules</a></li><li class="navelem"><a class="el" href="dir_b04f89f5a7f8ec29a0b9160f0e142536.html">linphone</a></li><li class="navelem"><a class="el" href="dir_868997901fe332c5ff1ebd4a06734a1f.html">oRTP</a></li><li class="navelem"><a class="el" href="dir_7559c465e4c3d013b6e747e2a6ffd6d9.html">src</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">jitterctl.h</div> </div> </div><!--header--> <div class="contents"> <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/*</span></div> <div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.</span></div> <div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org</span></div> <div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"></span></div> <div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"> This library is free software; you can redistribute it and/or</span></div> <div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"> modify it under the terms of the GNU Lesser General Public</span></div> <div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment"> License as published by the Free Software Foundation; either</span></div> <div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> version 2.1 of the License, or (at your option) any later version.</span></div> <div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"></span></div> <div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment"> This library is distributed in the hope that it will be useful,</span></div> <div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div> <div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></div> <div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment"> Lesser General Public License for more details.</span></div> <div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment"></span></div> <div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment"> You should have received a copy of the GNU Lesser General Public</span></div> <div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment"> License along with this library; if not, write to the Free Software</span></div> <div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span></div> <div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="comment">*/</span></div> <div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="comment">/***************************************************************************</span></div> <div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="comment"> * jitterctl.c</span></div> <div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="comment"> *</span></div> <div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="comment"> * Mon Nov 8 11:53:21 2004</span></div> <div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="comment"> * Copyright 2004 Simon MORLAT</span></div> <div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="comment"> * Email simon.morlat@linphone.org</span></div> <div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="comment"> ****************************************************************************/</span></div> <div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; </div> <div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#ifndef JITTERCTL_H</span></div> <div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="preprocessor">#define JITTERCTL_H</span></div> <div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;</div> <div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;</div> <div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="keywordtype">void</span> jitter_control_init(<a class="code" href="struct__JitterControl.html">JitterControl</a> *ctl, <span class="keywordtype">int</span> base_jiitt_time, <a class="code" href="struct__PayloadType.html">PayloadType</a> *pt);</div> <div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="keywordtype">void</span> jitter_control_enable_adaptive(<a class="code" href="struct__JitterControl.html">JitterControl</a> *ctl, bool_t val);</div> <div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="keywordtype">void</span> jitter_control_new_packet(<a class="code" href="struct__JitterControl.html">JitterControl</a> *ctl, uint32_t packet_ts, uint32_t cur_str_ts);</div> <div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="preprocessor">#define jitter_control_adaptive_enabled(ctl) ((ctl)-&gt;adaptive)</span></div> <div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="keywordtype">void</span> jitter_control_set_payload(<a class="code" href="struct__JitterControl.html">JitterControl</a> *ctl, <a class="code" href="struct__PayloadType.html">PayloadType</a> *pt);</div> <div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="keywordtype">void</span> jitter_control_update_corrective_slide(<a class="code" href="struct__JitterControl.html">JitterControl</a> *ctl);</div> <div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="keywordtype">void</span> jitter_control_update_size(<a class="code" href="struct__JitterControl.html">JitterControl</a> *ctl, <a class="code" href="struct__queue.html">queue_t</a> *q);</div> <div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="keywordtype">float</span> jitter_control_compute_mean_size(<a class="code" href="struct__JitterControl.html">JitterControl</a> *ctl);</div> <div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;</div> <div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="keyword">static</span> ORTP_INLINE uint32_t jitter_control_get_compensated_timestamp(<a class="code" href="struct__JitterControl.html">JitterControl</a> *obj , uint32_t user_ts){</div> <div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; <span class="keywordflow">return</span> (uint32_t)( (int64_t)user_ts+obj-&gt;slide-(int64_t)obj-&gt;adapt_jitt_comp_ts);</div> <div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;}</div> <div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;</div> <div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;<span class="preprocessor">#endif</span></div> <div class="ttc" id="struct__PayloadType_html"><div class="ttname"><a href="struct__PayloadType.html">_PayloadType</a></div><div class="ttdef"><b>Definition:</b> payloadtype.h:67</div></div> <div class="ttc" id="struct__queue_html"><div class="ttname"><a href="struct__queue.html">_queue</a></div><div class="ttdef"><b>Definition:</b> str_utils.h:78</div></div> <div class="ttc" id="struct__JitterControl_html"><div class="ttname"><a href="struct__JitterControl.html">_JitterControl</a></div><div class="ttdef"><b>Definition:</b> rtpsession.h:67</div></div> </div><!-- fragment --></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Mon Mar 23 2015 12:57:57 for oRTP by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.7 </small></address> </body> </html>
PlayboyThailand/PlayboyPhone
liblinphone-sdk/new_apple-darwin/share/doc/ortp-0.24.0/html/jitterctl_8h_source.html
HTML
gpl-2.0
11,126
<?php require("../../includes/header.php"); ?><h1>Lucy and Palindromes</h1><div class="content"> <h3> Read problems statements in Russian <a target="_blank" href="http://www.codechef.com/download/translated/LTIME06/russian/PALINDR.pdf">here</a></h3> <p>Lucy had recently learnt about palindromes. As you may probably know, palindrome is a string that reads the same way in the both directions, that is left-to-right or right-to-left. For example, strings "radar" and "level" are palindromes, at the same time, strings "hello" and "world" are not.</p> <p>There is a string of <b>N</b> latin letters. Lucy asks you to answer the following queries:<br /><br /> 1 <b>L</b> <b>R</b> - reverse the substring from the <b>L</b>-th to the <b>R</b>-th character (1-indexed), inclusive.<br /><br /> 2 <b>L</b> <b>R</b> - calculate the number of distinct palindromes that can be obtained by permutting characters from the <b>L</b>-th to the <b>R</b>-th in the arbitrary order (ignoring all other characters of the string).<br /></p> <h3>Input</h3> <p>The first line of input consists of two space separated integers <b>N</b> and <b>M</b> - the length of the string and the number of queries.<br /> The second line consists of <b>N</b> characters from the set {'<b>a</b>', '<b>b</b>', '<b>c</b>', '<b>d</b>', '<b>e</b>', '<b>f</b>', '<b>g</b>', '<b>h</b>', '<b>i</b>', '<b>j</b>'}, describing the string. Then, <b>M</b> queries follow. Each query is given in one of the following forms:<br /><br /> 1 <b>L</b> <b>R</b> - reverse the substring from the <b>L</b>-th to the <b>R</b>-th character.<br /><br /> 2 <b>L</b> <b>R</b> - calculate the number of distinct palindromes that can be obtained by permutting characters from the <b>L</b>-th to the <b>R</b>-th in the arbitrary order, modulo <b>10<sup>9</sup>+7</b> (ignoring all other characters).</p> <h3>Output</h3> <p>For every query of the type <b>2</b> output the answer on the separate line.</p> <h3>Example</h3> <pre><b>Input:</b> 7 4 abacaba 2 1 7 2 2 3 1 1 2 2 2 3 <b>Output:</b> 3 0 1 </pre><h3>Scoring</h3> <p>In all the subtasks, 1 &lt;= <b>L</b> &lt;= <b>R</b> &lt;= <b>N</b>.<br /><br /> Subtask 1 (33 points): 1 &lt;= <b>N</b> &lt;= 10, 1 &lt;= <b>M</b> &lt;= 1000<br /><br /> Subtask 2 (17 points): 1 &lt;= <b>N</b> &lt;= 1000, 1 &lt;= <b>M</b> &lt;= 1000<br /><br /> Subtask 3 (23 points): 1 &lt;= <b>N</b> &lt;= 4*10<sup>4</sup>, 1 &lt;= <b>M</b> &lt;= 4*10<sup>4</sup><br /><br /> Subtask 4 (27 points): 1 &lt;= <b>N</b> &lt;= 10<sup>5</sup>, 1 &lt;= <b>M</b> &lt;= 10<sup>5</sup><br /><br /> Time limit for subtasks 1 and 2 is 1 sec, and for the subtasks 3 and 4 it's equal to 2 sec.</p> </div><table cellspacing="0" cellpadding="0" align="left"> <tr> <td width="14%">Author:</td> <td><a href="/users/xcwgf666">xcwgf666</a></td> </tr> <tr> <td width="14%">Tester:</td> <td><a href="/users/Rubanenko">Rubanenko</a></td> </tr> <tr> <td width="14%">Date Added:</td> <td>14-10-2013</td> </tr> <tr> <td width="14%">Time Limit:</td> <td>1 - 2 sec</td> </tr> <tr> <td width="14%">Source Limit:</td> <td>50000 Bytes</td> </tr> <tr> <td width="14%">Languages:</td> <td>ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.8.1, CPP11, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC</td> </tr> </table> <?php require("../../includes/footer.php"); ?>
tacoder/Virtual-Codechef-Contests
contest/LTIME06/PALINDR.php
PHP
gpl-2.0
3,742
#include "ros/ros.h" #include "std_msgs/String.h" /** * This tutorial demonstrates simple receipt of messages over the ROS system */ void chatterCallback(const std_msgs::String::ConstPtr& msg) { ROS_INFO("I heard: [%s]", msg->data.c_str()); } int main(int argc, char **argv) { /** *The ros::init() function needs to see argc and argv so that it can perform *any ROS arguments and name remapping that were provided at the command line. *For programmatic remappings you can use a different version of init() which takes remappings directly *but for most command-line programs, passing argc adn argv si the easiest way to do it. *The third argument to init() is the name of the node. * *You must call on of the versions of ros::init() before using any other part of the ROS system */ ros::init(argc,argv, "listener"); /** *NodeHandle is teh main access point to communications with the ROS system. *the first nodehandle construtect will fully initialize this node, and the last *nodehandle desctructed will close down the node. */ ros::NodeHandle n; /** *The subscribe() call is how you tell ROS that you want ot recieve messages on a given *topic. This invokes a call to the ROS master node, which keeps a registry fo who is publishing *and who is subscribing. messages are passed to a callback function, here called chatterCallback. *subscribe() returns a subscriber object that you must hod on to until you want ot unsubscribe. *When all copies of the subscriber object go out of scope, this callback will automatically be unsubscribed *from this topic * *The second parameter to the subscribe() function is the size of the message queue. If messages are *arriving faster then they are being processed, this is teh number of messages that will be buffered *up before beginning to throw away the oldest ones. */ ros::Subscriber sub = n.subscribe("chatter",1000,chatterCallback); /** * ros::spin() will enter a loop, pumping callbacks. With this version, all callbacks will be called from within *this thread (the main one). ros::spin() will exit when Ctrl-C is pressed, or the node is shutdown by the master. */ ros::spin(); return 0; }
mdkennedy3/Scarab_DCT_Control
catkin_ws/src/beginner_tutorials/src/listener.cpp
C++
gpl-2.0
2,193
<?php /** * @package HikaShop for Joomla! * @version 1.5.5 * @author hikashop.com * @copyright (C) 2010-2011 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?> <div class="iframedoc" id="iframedoc"></div> <form action="<?php echo hikashop_completeLink('tax');?>" method="post" name="adminForm"> <center> <table class="admintable"> <tr> <td class="key"> <label for="data[tax][tax_namekey]"> <?php echo JText::_( 'TAX_NAMEKEY' ); ?> </label> </td> <td> <?php if(empty($this->element->tax_namekey)){?> <input type="text" name="data[tax][tax_namekey]" value="" /> <?php }else{ echo $this->element->tax_namekey; ?><input type="hidden" name="data[tax][tax_namekey]" value="<?php echo $this->escape($this->element->tax_namekey ); ?>" /><?php }?> </td> </tr> <tr> <td class="key"> <label for="data[tax][tax_rate]"> <?php echo JText::_( 'RATE' ); ?> </label> </td> <td> <input type="text" name="data[tax][tax_rate]" value="<?php echo $this->escape(@$this->element->tax_rate*100.0 ); ?>" />% </td> </tr> </table> </center> <div class="clr"></div> <input type="hidden" name="option" value="<?php echo HIKASHOP_COMPONENT;?>" /> <input type="hidden" name="return" value="<?php echo $this->return;?>" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="ctrl" value="<?php echo JRequest::getString('ctrl');?>" /> <?php echo JHTML::_( 'form.token' ); ?> </form>
emilekott/fitt
administrator/components/com_hikashop/views/tax/tmpl/form.php
PHP
gpl-2.0
1,626
#include <TaoApiCpp/response/SimbaInsightCatsforecastGetResponse.h> QList<INCategoryTop> SimbaInsightCatsforecastGetResponse::getInCategoryTops() const { return inCategoryTops; } void SimbaInsightCatsforecastGetResponse::setInCategoryTops (QList<INCategoryTop> inCategoryTops) { this->inCategoryTops = inCategoryTops; } void SimbaInsightCatsforecastGetResponse::parseNormalResponse() { parseError(); if (responseParser->hasName("in_category_tops")) { QList<Parser *> listParser = responseParser->getListObjectParser("in_category_tops"); Parser *parser; foreach (parser, listParser) { INCategoryTop tmp; tmp.setParser(parser); tmp.parseResponse(); inCategoryTops.append(tmp); } } }
sd44/TaobaoCppQtSDK
TaoApiCpp/response/SimbaInsightCatsforecastGetResponse.cpp
C++
gpl-2.0
719